@lovelybunch/api 1.0.75-alpha.8 → 1.0.75-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/lib/terminal/terminal-manager.d.ts +1 -3
  2. package/dist/lib/terminal/terminal-manager.js +1 -52
  3. package/dist/routes/api/v1/ai/route.js +323 -2
  4. package/dist/routes/api/v1/chats/[id]/index.js +2 -1
  5. package/dist/routes/api/v1/chats/[id]/route.d.ts +7 -0
  6. package/dist/routes/api/v1/chats/[id]/route.js +30 -1
  7. package/dist/routes/api/v1/context/index.js +0 -2
  8. package/dist/routes/api/v1/knowledge/[filename]/index.d.ts +1 -0
  9. package/dist/routes/api/v1/knowledge/[filename]/index.js +1 -0
  10. package/dist/routes/api/v1/knowledge/[filename]/route.d.ts +3 -0
  11. package/dist/routes/api/v1/knowledge/[filename]/route.js +254 -0
  12. package/dist/routes/api/v1/knowledge/index.d.ts +1 -0
  13. package/dist/routes/api/v1/knowledge/index.js +1 -0
  14. package/dist/routes/api/v1/knowledge/route.d.ts +3 -0
  15. package/dist/routes/api/v1/knowledge/route.js +176 -0
  16. package/dist/routes/api/v1/mcp/index.js +78 -3
  17. package/dist/routes/api/v1/terminal/[proposalId]/create/route.js +2 -2
  18. package/dist/server-with-static.js +2 -0
  19. package/dist/server.js +2 -0
  20. package/package.json +4 -4
  21. package/static/assets/{ActivityPage-DSSML9J-.js → ActivityPage-OxRci_V2.js} +1 -1
  22. package/static/assets/{ApiKeysSettingsPage-Chw9PNL5.js → ApiKeysSettingsPage-C0evI19e.js} +2 -2
  23. package/static/assets/{ArchitectureEditPage-CIjqkpMz.js → ArchitectureEditPage-D7xcH6dY.js} +4 -4
  24. package/static/assets/{ArchitecturePage-Db__w054.js → ArchitecturePage-pvnlX-NW.js} +1 -1
  25. package/static/assets/{AuthSettingsPage-Bpooi8Z0.js → AuthSettingsPage-Bu0CZ1rY.js} +2 -2
  26. package/static/assets/{CallbackPage-BGLKeyjv.js → CallbackPage-D0lkjxCT.js} +1 -1
  27. package/static/assets/CodePage-BJ4PC5nb.js +2 -0
  28. package/static/assets/{CollapsibleSection-B6RO5o5R.js → CollapsibleSection-Bt_ZLnJc.js} +1 -1
  29. package/static/assets/DashboardPage-BiffPdmj.js +41 -0
  30. package/static/assets/{GitPage-DxjLaRWe.js → GitPage-TrTxZ27J.js} +2 -2
  31. package/static/assets/{GitSettingsPage-tKBXYAFm.js → GitSettingsPage-D7q5xQd_.js} +2 -2
  32. package/static/assets/{IdentityPage-D2yBjeYn.js → IdentityPage-CY0Ak2j0.js} +3 -3
  33. package/static/assets/{ImplementationStepsEditor-DWjDyZzP.js → ImplementationStepsEditor-Ctx0CvbU.js} +2 -2
  34. package/static/assets/IntegrationsSettingsPage-C2wJVdM7.js +1 -0
  35. package/static/assets/{JobDetailPage-BQmTHled.js → JobDetailPage-Phx_IlKX.js} +1 -1
  36. package/static/assets/KnowledgeDetailPage-BdTUfWqj.js +1 -0
  37. package/static/assets/KnowledgeEditPage-D8XK4IUf.js +1 -0
  38. package/static/assets/KnowledgePage-Ci9G7Br-.js +8 -0
  39. package/static/assets/{LoginPage-DptfKsWo.js → LoginPage-Dqxd7cTa.js} +1 -1
  40. package/static/assets/McpSettingsPage-10n35zXi.js +1 -0
  41. package/static/assets/NewKnowledgePage-BlJzzuh7.js +9 -0
  42. package/static/assets/{NewProposalPage-B_sDMBTK.js → NewProposalPage-BP7Ttoxk.js} +2 -2
  43. package/static/assets/{NewSkillPage-Cwy2MSr9.js → NewSkillPage-ByqN--mH.js} +1 -1
  44. package/static/assets/ProjectEditPage-DKJTY2uc.js +11 -0
  45. package/static/assets/{ProjectPage-DgUr4bVU.js → ProjectPage-2VblKCWz.js} +1 -1
  46. package/static/assets/PromptsSettingsPage-B4mOhXuo.js +1 -0
  47. package/static/assets/ProposalDetailPage-m3ysyzpj.js +1 -0
  48. package/static/assets/ProposalEditPage-3XVg_paW.js +1 -0
  49. package/static/assets/{ProposalsPage-C7n4-G05.js → ProposalsPage-B3u0aFFz.js} +3 -3
  50. package/static/assets/ResourceDetailPage-somBLUpC.js +1 -0
  51. package/static/assets/ResourcesPage-2BbjIWfF.js +41 -0
  52. package/static/assets/{RoleEditPage-Cu7ZB3yj.js → RoleEditPage-CLzX7Xhi.js} +1 -1
  53. package/static/assets/{RolePage-Sc-GFiL2.js → RolePage-qXWXZ2FZ.js} +1 -1
  54. package/static/assets/{RulesSettingsPage-DdMCzh9j.js → RulesSettingsPage-BtM7p8F6.js} +3 -3
  55. package/static/assets/SchedulePage-4tFcIBSs.js +4 -0
  56. package/static/assets/{SkillDetailPage-5sDxf3Of.js → SkillDetailPage-CroSdaju.js} +1 -1
  57. package/static/assets/{SkillEditPage-BDd2CtAS.js → SkillEditPage-Czlo8WWT.js} +1 -1
  58. package/static/assets/{SkillsPage-D2G7EfK8.js → SkillsPage-CgULbcI-.js} +2 -2
  59. package/static/assets/{SkillsSettingsPage-1N0JQOYc.js → SkillsSettingsPage-DKtpy7qk.js} +1 -1
  60. package/static/assets/SourceInput-BITn1Y15.js +1 -0
  61. package/static/assets/{TagInput-D_SdcypZ.js → TagInput-BK91_M1N.js} +1 -1
  62. package/static/assets/TerminalPage-8fwvnOo2.js +1 -0
  63. package/static/assets/TerminalSessionPage-BhO5U48p.js +13 -0
  64. package/static/assets/UserPreferencesPage-DrgYEcxO.js +1 -0
  65. package/static/assets/UserSettingsPage-Dj6lKLi8.js +1 -0
  66. package/static/assets/UtilitiesPage-Djr4qT5L.js +1 -0
  67. package/static/assets/{alert-BD5jo3SI.js → alert-CsMvyYoX.js} +1 -1
  68. package/static/assets/{arrow-down-BxcoVp6S.js → arrow-down-BZnfbld8.js} +1 -1
  69. package/static/assets/{arrow-left-CdM_IPng.js → arrow-left-WGBYWq3h.js} +1 -1
  70. package/static/assets/{arrow-up-BOJ6ob9X.js → arrow-up-BByVUPE7.js} +1 -1
  71. package/static/assets/{badge-DEiQk9C9.js → badge-AwLOflf5.js} +1 -1
  72. package/static/assets/{browser-modal-Dp1eMxt6.js → browser-modal-BzGNFfTG.js} +2 -2
  73. package/static/assets/{card-BCFxXzRk.js → card-SN5gKnu7.js} +1 -1
  74. package/static/assets/{chevron-left-C25izNzZ.js → chevron-left-C7uNq9l_.js} +1 -1
  75. package/static/assets/{plus-iamYJu5V.js → chevron-up-CHdIiLxL.js} +2 -2
  76. package/static/assets/{chevrons-up-DqbWMOjv.js → chevrons-up-TXwQuoUN.js} +1 -1
  77. package/static/assets/{circle-alert-CMRMPnbY.js → circle-alert-37E5gU9K.js} +1 -1
  78. package/static/assets/{circle-check-D5wZZPvj.js → circle-check-D02pWDME.js} +1 -1
  79. package/static/assets/{circle-check-big-NI18oHuP.js → circle-check-big-nY4PntB5.js} +1 -1
  80. package/static/assets/{circle-play-BhVU869u.js → circle-play-7EXFLo4F.js} +1 -1
  81. package/static/assets/{circle-x-BXDB-G_q.js → circle-x-By4JoTHB.js} +1 -1
  82. package/static/assets/{clipboard-DC2xmNVx.js → clipboard-BdymjxLO.js} +1 -1
  83. package/static/assets/{clock-CeCp7Pz1.js → clock-HDu44KTo.js} +1 -1
  84. package/static/assets/{download-ZF_XbTIA.js → download-Cv2G2Eg9.js} +1 -1
  85. package/static/assets/{droid-DqWsM2dp.js → droid-CPteN3f9.js} +1 -1
  86. package/static/assets/{external-link-CYBz87-P.js → external-link-DwMXcCCj.js} +1 -1
  87. package/static/assets/{eye-BT8MAvKY.js → eye-DYnjJzdb.js} +1 -1
  88. package/static/assets/{folder-git-2-BE9AIPnj.js → folder-git-2-COeWFPHS.js} +1 -1
  89. package/static/assets/index-9Tv-j_Ga.js +472 -0
  90. package/static/assets/index-GFQ5RqVh.css +2 -0
  91. package/static/assets/{info-DunFSp-x.js → info-BmtuPMhv.js} +1 -1
  92. package/static/assets/{label-vYhfrPMD.js → label-TGqbNfMO.js} +1 -1
  93. package/static/assets/{markdown-editor-BzZ8tCto.js → markdown-editor-ls1JPK_e.js} +1 -1
  94. package/static/assets/{pause-BHonpdnw.js → pause-CAWbvTiL.js} +1 -1
  95. package/static/assets/{play-CCo7tau2.js → play-DF_Qeu0H.js} +1 -1
  96. package/static/assets/{radio-group-Db-pBuyW.js → radio-group-DYTbywtK.js} +1 -1
  97. package/static/assets/{refresh-cw-Bg7vQzOw.js → refresh-cw-BFZxHqbC.js} +1 -1
  98. package/static/assets/{search-CH2zaibZ.js → search-Dr90tbch.js} +1 -1
  99. package/static/assets/select-Cs5qtMYV.js +1 -0
  100. package/static/assets/{switch-CH-VOgPo.js → switch-4TDb6YiQ.js} +1 -1
  101. package/static/assets/{tabs-XeRAjZYR.js → tabs-BrbEvF4V.js} +1 -1
  102. package/static/assets/{tag-CRP5nL5-.js → tag-DrQkepeD.js} +1 -1
  103. package/static/assets/{terminal-preview-DMJMuORo.js → terminal-preview-uuKF9_x4.js} +1 -1
  104. package/static/assets/use-terminal-BG5UXuVE.js +1 -0
  105. package/static/assets/video-DYA2WfbA.js +36 -0
  106. package/static/assets/{zap-BlzMp7dY.js → zap-h9QOsasv.js} +1 -1
  107. package/static/index.html +2 -2
  108. package/static/assets/CodePage-CrokcH-S.js +0 -2
  109. package/static/assets/DashboardPage-BaSQQ8Nv.js +0 -41
  110. package/static/assets/IntegrationsSettingsPage-Bx8-0Ig4.js +0 -1
  111. package/static/assets/KnowledgeDetailPage-QMU2bC3L.js +0 -1
  112. package/static/assets/KnowledgeEditPage-DbMJVcLc.js +0 -1
  113. package/static/assets/KnowledgePage-aU1GxZSZ.js +0 -8
  114. package/static/assets/McpSettingsPage-C3WxFwRB.js +0 -1
  115. package/static/assets/NewKnowledgePage-Cbiswrw_.js +0 -9
  116. package/static/assets/ProjectEditPage-BznWiBBc.js +0 -11
  117. package/static/assets/PromptsSettingsPage-CY0-870a.js +0 -1
  118. package/static/assets/ProposalDetailPage-K4iMXHEg.js +0 -1
  119. package/static/assets/ProposalEditPage-jZOtCMqP.js +0 -1
  120. package/static/assets/ResourcesPage-vB5-XkUv.js +0 -71
  121. package/static/assets/SchedulePage-Bkkf2wA0.js +0 -4
  122. package/static/assets/SourceInput-DlC0zwva.js +0 -1
  123. package/static/assets/TerminalPage--KZ7azvP.js +0 -1
  124. package/static/assets/TerminalSessionPage-ClvxK9ia.js +0 -13
  125. package/static/assets/UserPreferencesPage-CheOH7jZ.js +0 -1
  126. package/static/assets/UserSettingsPage-C8STDvfQ.js +0 -1
  127. package/static/assets/UtilitiesPage-9rTxR2md.js +0 -1
  128. package/static/assets/calendar-Cx5r9R7A.js +0 -6
  129. package/static/assets/index-DVTgTsDa.css +0 -2
  130. package/static/assets/index-hqVgTgRB.js +0 -462
  131. package/static/assets/use-terminal-DuGZuvd2.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as e,S as ne,_ as k,r as b,b1 as q,y as f,a2 as ie,b0 as ae,B as C,P as B,I as u,q as R,H as oe,O as le,F as ce,m as de}from"./index-9Tv-j_Ga.js";import{C as L,b as T,c as O,d as $,a as U}from"./card-SN5gKnu7.js";import{L as h}from"./label-TGqbNfMO.js";import{B as P}from"./badge-AwLOflf5.js";import{S as I}from"./switch-4TDb6YiQ.js";import{A as z,a as Y}from"./alert-CsMvyYoX.js";import{R as me,L as he}from"./browser-modal-BzGNFfTG.js";import{R as xe}from"./registry-ANRa5WBi.js";import{C as J}from"./circle-alert-37E5gU9K.js";import{C as ve}from"./circle-check-big-nY4PntB5.js";import"./search-Dr90tbch.js";function K(t){if(t){if(Array.isArray(t)){const n=t.map(l=>{if(typeof l=="string")return l.trim();if(typeof l=="number")return`${l}`}).filter(l=>typeof l=="string"&&l.length>0);return n.length>0?n:void 0}if(typeof t=="string"){const n=t.split(",").map(l=>l.trim()).filter(l=>l.length>0);return n.length>0?n:void 0}}}function G(t,n){const l=t.name||n.name,x=n.description||t.description||"",a={registryId:t.id,registryEndpoint:t.endpoint,registrySource:xe,author:t.author||n.author};(n.version||t.version)&&(a.version=n.version||t.version);const d=K(n.tags)||K(t.tags);d&&(a.tags=d),n.capabilities&&Array.isArray(n.capabilities)&&(a.capabilities=n.capabilities),n.requirements&&typeof n.requirements=="object"&&(a.requirements=n.requirements),n.links&&typeof n.links=="object"&&(a.links=n.links),n.metadata&&typeof n.metadata=="object"&&(a.mcpMetadata=n.metadata);for(const[i,p]of Object.entries(a))p==null&&delete a[i];return{name:l,command:n.configuration.command,args:n.configuration.args,url:n.configuration.url,env:n.configuration.env,enabled:!0,description:x,metadata:Object.keys(a).length>0?a:void 0}}async function pe(t){const n=t.startsWith("http")?t:`https://registry.coconut.dev${t}`,l=await fetch(n,{headers:{Accept:"application/json","User-Agent":"coconut-frontend"}});if(!l.ok)throw new Error(`Failed to fetch MCP server detail: ${l.status}`);return l.json()}function ue({open:t,onOpenChange:n,onImport:l}){return e.jsx(me,{open:t,onOpenChange:n,categoryId:"mcp-servers",title:"Coconut Registry – MCP Servers",confirmLabel:"Add Server",getDetail:x=>pe(x.endpoint),renderPreview:(x,a)=>{if(!a)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Select an MCP server to preview"});const d=G(x,a),i=d.metadata??{},p=typeof i.version=="string"?i.version:void 0,y=Array.isArray(x.tags)?x.tags:[],w=Array.isArray(i.capabilities)?i.capabilities.filter(j=>typeof j=="string"):[];return e.jsx("div",{className:"h-full min-h-0 overflow-hidden rounded-md border",children:e.jsx(ne,{className:"h-full",children:e.jsx("div",{className:"space-y-6 p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:x.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),p&&e.jsxs(P,{variant:"outline",children:["v",p]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Registry ID: ",e.jsx("span",{className:"font-mono",children:x.id})]}),y.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(j=>e.jsx(P,{variant:"secondary",children:j},j))}),e.jsxs("div",{className:"space-y-2 rounded-md border p-3 bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Configuration"}),e.jsx(P,{variant:"outline",className:"text-xs",children:d.url?"HTTP":"stdio"})]}),e.jsxs("div",{className:"space-y-1 text-sm font-mono",children:[d.url?e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"URL:"})," ",e.jsx("span",{className:"text-foreground break-all",children:d.url})]}):e.jsxs(e.Fragment,{children:[d.command&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Command:"})," ",e.jsx("span",{className:"text-foreground",children:d.command})]}),d.args&&d.args.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Args:"})," ",e.jsx("span",{className:"text-foreground",children:d.args.join(" ")})]})]}),d.env&&Object.keys(d.env).length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Env:"})," ",e.jsx("span",{className:"text-foreground",children:JSON.stringify(d.env)})]})]})]}),w.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Capabilities"}),e.jsx("ul",{className:"list-disc pl-5 text-sm text-muted-foreground space-y-1",children:w.map(j=>e.jsx("li",{children:j},j))})]}),a.documentation&&e.jsxs("div",{className:"space-y-3",children:[a.documentation.overview&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Overview"}),e.jsx(k,{className:"[&_.prose]:max-w-none text-sm",children:a.documentation.overview})]}),a.documentation.installation&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Installation"}),e.jsx(k,{className:"[&_.prose]:max-w-none text-sm",children:a.documentation.installation})]}),a.documentation.usage&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Usage"}),e.jsx(k,{className:"[&_.prose]:max-w-none text-sm",children:a.documentation.usage})]}),a.documentation.examples&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Examples"}),e.jsx(k,{className:"[&_.prose]:max-w-none text-sm",children:a.documentation.examples})]})]})]})})})})},onConfirm:async(x,a)=>{const d=G(x,a);await l({summary:x,detail:a,payload:d})}})}function Ae(){const[t,n]=b.useState({}),[l,x]=b.useState(!0),[a,d]=b.useState(!1),[i,p]=b.useState({name:"",command:"",args:"",url:"",env:"",description:"",enabled:!0}),[y,w]=b.useState(!1),[j,M]=b.useState(null),[o,N]=b.useState({name:"",command:"",args:"",url:"",env:"",description:"",enabled:!0}),[V,_]=b.useState(!1);b.useEffect(()=>{D()},[]);const D=async()=>{try{x(!0);const s=await q("/api/v1/mcp/raw-config");n(s||{})}catch(s){console.error("Failed to load MCP config:",s),f({title:"Error",description:"Failed to load MCP configuration",variant:"destructive"})}finally{x(!1)}},E=async s=>{try{d(!0),await q("/api/v1/mcp/raw-config",{method:"PUT",body:JSON.stringify(s)}),n(s),f({title:"Success",description:"MCP configuration saved successfully"})}catch(r){console.error("Failed to save MCP config:",r),f({title:"Error",description:"Failed to save MCP configuration",variant:"destructive"})}finally{d(!1)}},W=()=>{if(!i.name){f({title:"Error",description:"Server name is required",variant:"destructive"});return}const s=i.command.trim().length>0,r=i.url.trim().length>0;if(!s&&!r){f({title:"Error",description:"Either Command (for stdio) or URL (for HTTP) is required",variant:"destructive"});return}if(s&&r){f({title:"Error",description:"Provide either Command or URL, not both",variant:"destructive"});return}const c={name:i.name,enabled:i.enabled,description:i.description||void 0};if(s?(c.type="stdio",c.command=i.command,i.args.trim()&&(c.args=i.args.split(" ").filter(g=>g.trim()))):(c.type="http",c.url=i.url),i.env.trim())try{c.env=JSON.parse(i.env)}catch{f({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const v={...t,mcpServers:{...t.mcpServers,[i.name]:c}};E(v),p({name:"",command:"",args:"",url:"",env:"",description:"",enabled:!0}),w(!1)},Q=(s,r)=>{const c={...t,mcpServers:{...t.mcpServers,[s]:{...t.mcpServers[s],enabled:r}}};E(c)},X=s=>{const{[s]:r,...c}=t.mcpServers||{},v={...t,mcpServers:c};E(v)},Z=s=>{const r=t.mcpServers?.[s];r&&(N({name:r.name||s,command:r.command||"",args:r.args?.join(" ")||"",url:r.url||"",env:r.env?JSON.stringify(r.env,null,2):"",description:r.description||"",enabled:r.enabled!==!1}),M(s))},ee=s=>{const r=o.command.trim().length>0,c=o.url.trim().length>0;if(!r&&!c){f({title:"Error",description:"Either Command (for stdio) or URL (for HTTP) is required",variant:"destructive"});return}if(r&&c){f({title:"Error",description:"Provide either Command or URL, not both",variant:"destructive"});return}const v={name:o.name,enabled:o.enabled,description:o.description||void 0};if(r?(v.type="stdio",v.command=o.command,o.args.trim()&&(v.args=o.args.split(" ").filter(A=>A.trim()))):(v.type="http",v.url=o.url),o.env.trim())try{v.env=JSON.parse(o.env)}catch{f({title:"Error",description:"Invalid JSON format for environment variables",variant:"destructive"});return}const{[s]:g,...m}=t.mcpServers||{},S={...t,mcpServers:{...m,[s]:v}};E(S),M(null)},se=()=>{M(null),N({name:"",command:"",args:"",url:"",env:"",description:"",enabled:!0})},F=s=>{const r={...t,globalSettings:{...t.globalSettings,...s}};E(r)},re=async s=>{const{payload:r}=s;let c=r.name.toLowerCase().replace(/\s+/g,"-");const v=t.mcpServers||{};let g=c,m=1;for(;v[g];)g=`${c}-${m}`,m++;const S={name:g,enabled:r.enabled!==!1,description:r.description,env:r.env};r.url?(S.type="http",S.url=r.url):r.command&&(S.type="stdio",S.command=r.command,S.args=r.args);const A={...t,mcpServers:{...t.mcpServers,[g]:S}};await E(A);const te=r.url?"HTTP":"stdio";f({title:"Success",description:`MCP server "${g}" (${te}) added from registry`})};if(l)return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading configuration..."})]})});const H=t.mcpServers||{};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"MCP Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Model Context Protocol servers and settings."})]}),e.jsx(ie,{}),Object.keys(H).length===0&&!y&&e.jsxs(z,{children:[e.jsx(J,{className:"h-4 w-4"}),e.jsx(Y,{children:"No MCP servers configured yet. Add your first server to get started."})]}),e.jsxs(L,{children:[e.jsx(T,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-5 w-5"}),"MCP Servers"]}),e.jsx($,{className:"hidden sm:block",children:"Configure and manage Model Context Protocol servers for enhanced AI capabilities."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{size:"sm",variant:"outline",onClick:()=>_(!0),children:[e.jsx(he,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Registry"})]}),e.jsxs(C,{size:"sm",onClick:()=>w(!y),variant:y?"outline":"default",children:[e.jsx(B,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:y?"Cancel":"Add Server"})]})]})]})}),e.jsxs(U,{children:[y&&e.jsxs("div",{className:"space-y-4 p-3 sm:p-4 border rounded-lg mb-4",children:[e.jsx("h4",{className:"font-medium",children:"Add MCP Server"}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:"serverName",children:"Server Name"}),e.jsx(u,{id:"serverName",value:i.name,onChange:s=>p({...i,name:s.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(h,{htmlFor:"serverCommand",children:"Command"}),e.jsx(u,{id:"serverCommand",value:i.command,onChange:s=>p({...i,command:s.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:"serverArgs",children:"Arguments (space-separated)"}),e.jsx(u,{id:"serverArgs",value:i.args,onChange:s=>p({...i,args:s.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:"serverUrl",children:"URL"}),e.jsx(u,{id:"serverUrl",value:i.url,onChange:s=>p({...i,url:s.target.value}),placeholder:"e.g., https://mcp.example.com/api"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Provide either Command (for stdio) or URL (for HTTP/SSE), not both."})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:"serverDescription",children:"Description (optional)"}),e.jsx(u,{id:"serverDescription",value:i.description,onChange:s=>p({...i,description:s.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:"serverEnv",children:"Environment Variables (JSON)"}),e.jsx(R,{id:"serverEnv",value:i.env,onChange:s=>p({...i,env:s.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:"serverEnabled",checked:i.enabled,onCheckedChange:s=>p({...i,enabled:s})}),e.jsx(h,{htmlFor:"serverEnabled",children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsxs(C,{onClick:W,disabled:a,children:[e.jsx(B,{className:"h-4 w-4 mr-2"}),"Add Server"]}),e.jsx(C,{variant:"outline",onClick:()=>w(!1),children:"Cancel"})]})]}),e.jsx("div",{className:"space-y-4",children:Object.entries(H).map(([s,r])=>{const c=r.enabled!==!1,v=r.name||s,g=j===s;return e.jsx("div",{className:"border rounded-lg",children:g?e.jsxs("div",{className:"space-y-4 p-3 sm:p-4",children:[e.jsx("h4",{className:"font-medium",children:"Edit MCP Server"}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:`edit-name-${s}`,children:"Server Name"}),e.jsx(u,{id:`edit-name-${s}`,value:o.name,onChange:m=>N({...o,name:m.target.value}),placeholder:"e.g., filesystem-server"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(h,{htmlFor:`edit-command-${s}`,children:"Command"}),e.jsx(u,{id:`edit-command-${s}`,value:o.command,onChange:m=>N({...o,command:m.target.value}),placeholder:"e.g., npx @modelcontextprotocol/server-filesystem"})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:`edit-args-${s}`,children:"Arguments (space-separated)"}),e.jsx(u,{id:`edit-args-${s}`,value:o.args,onChange:m=>N({...o,args:m.target.value}),placeholder:"e.g., /path/to/allowed/directory"})]})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:`edit-url-${s}`,children:"URL"}),e.jsx(u,{id:`edit-url-${s}`,value:o.url,onChange:m=>N({...o,url:m.target.value}),placeholder:"e.g., https://mcp.example.com/api"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Provide either Command (for stdio) or URL (for HTTP/SSE), not both."})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:`edit-description-${s}`,children:"Description (optional)"}),e.jsx(u,{id:`edit-description-${s}`,value:o.description,onChange:m=>N({...o,description:m.target.value}),placeholder:"Brief description of what this server provides"})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:`edit-env-${s}`,children:"Environment Variables (JSON)"}),e.jsx(R,{id:`edit-env-${s}`,value:o.env,onChange:m=>N({...o,env:m.target.value}),placeholder:'{"KEY": "value", "ANOTHER_KEY": "another_value"}',rows:3})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:`edit-enabled-${s}`,checked:o.enabled,onCheckedChange:m=>N({...o,enabled:m})}),e.jsx(h,{htmlFor:`edit-enabled-${s}`,children:"Enable server"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(C,{onClick:()=>ee(s),disabled:a,children:"Save Changes"}),e.jsx(C,{variant:"outline",onClick:se,children:"Cancel"})]})]}):e.jsx("div",{className:"p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[c?e.jsx(ve,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"}):e.jsx(J,{className:"h-4 w-4 text-gray-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h4",{className:"font-medium text-sm sm:text-base",children:v}),e.jsx(P,{variant:c?"default":"secondary",className:"text-xs",children:c?"Enabled":"Disabled"}),e.jsx(P,{variant:"outline",className:"text-xs",children:r.url?"HTTP":"stdio"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:r.description||r.url||r.command}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:r.url?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"URL:"})," ",r.url]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Command:"})," ",r.command," ",r.args?.join(" ")]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 shrink-0",children:[e.jsx(I,{checked:c,onCheckedChange:m=>Q(s,m),disabled:a}),e.jsx(C,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Z(s),children:e.jsx(oe,{className:"h-4 w-4"})}),e.jsx(C,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>X(s),disabled:a,children:e.jsx(le,{className:"h-4 w-4"})})]})]})})},s)})})]})]}),e.jsxs(L,{children:[e.jsxs(T,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5"}),"Configuration File"]}),e.jsxs($,{children:["The MCP configuration is stored in ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:".nut/mcp/config.json"})]})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(h,{htmlFor:"configJson",children:"Current Configuration (JSON)"}),e.jsx(R,{id:"configJson",value:JSON.stringify(t,null,2),readOnly:!0,rows:12,className:"font-mono text-sm",placeholder:"Loading configuration..."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This is a read-only view of the current configuration. Use the forms above to make changes."})]}),e.jsxs(z,{children:[e.jsx(J,{className:"h-4 w-4"}),e.jsx(Y,{children:"Configuration changes are automatically saved to the MCP config file. This file can also be edited manually if you prefer working with JSON directly."})]})]})]}),e.jsxs(L,{children:[e.jsxs(T,{children:[e.jsxs(O,{className:"flex items-center gap-2",children:[e.jsx(de,{className:"h-5 w-5"}),"Global Settings"]}),e.jsx($,{children:"Configure global MCP behavior and connection settings."})]}),e.jsx(U,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(h,{htmlFor:"timeout",children:"Connection Timeout (ms)"}),e.jsx(u,{id:"timeout",type:"number",value:t.globalSettings?.timeout||3e4,onChange:s=>F({timeout:parseInt(s.target.value)}),placeholder:"30000"})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:"retryAttempts",children:"Retry Attempts"}),e.jsx(u,{id:"retryAttempts",type:"number",value:t.globalSettings?.retryAttempts||3,onChange:s=>F({retryAttempts:parseInt(s.target.value)}),placeholder:"3"})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:"logLevel",children:"Log Level"}),e.jsxs("select",{id:"logLevel",className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",value:t.globalSettings?.logLevel||"info",onChange:s=>F({logLevel:s.target.value}),children:[e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warning"}),e.jsx("option",{value:"error",children:"Error"})]})]})]})})]}),e.jsx("div",{className:"flex justify-end space-x-2",children:e.jsx(C,{variant:"outline",onClick:D,disabled:l,children:"Reload Configuration"})}),e.jsx(ue,{open:V,onOpenChange:_,onImport:re})]})}export{Ae as default};
@@ -0,0 +1,9 @@
1
+ import{u as S,a as y,r,j as e,B as j,x as E,a3 as T,L,I as b,A as I}from"./index-9Tv-j_Ga.js";import{C as i,b as c,c as l,a as d}from"./card-SN5gKnu7.js";import{L as m}from"./label-TGqbNfMO.js";import{M as A}from"./markdown-editor-ls1JPK_e.js";import{T as B}from"./TagInput-BK91_M1N.js";import{S as P}from"./SourceInput-BITn1Y15.js";import{A as M}from"./arrow-left-WGBYWq3h.js";import"./badge-AwLOflf5.js";import"./external-link-DwMXcCCj.js";function J(){const g=S(),{toast:s}=y(),[u,h]=r.useState(!1),[a,f]=r.useState(""),[n,v]=r.useState(""),[x,w]=r.useState([]),[p,C]=r.useState([]),k=async()=>{if(!a.trim()){s({title:"Error",description:"Please provide a title for the knowledge document",variant:"destructive"});return}if(!n.trim()){s({title:"Error",description:"Please provide content for the knowledge document",variant:"destructive"});return}h(!0);try{const o=await(await fetch(`${I}/api/v1/knowledge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a.trim(),content:n.trim(),metadata:{tags:x,sources:p}})})).json();if(o.success){s({title:"Success",description:"Knowledge document created successfully"});const N=o.document.filename.replace(".md","");g(`/knowledge/${N}`)}else s({title:"Error",description:o.error||"Failed to create knowledge document",variant:"destructive"})}catch(t){console.error("Error creating document:",t),s({title:"Error",description:"Failed to create knowledge document",variant:"destructive"})}finally{h(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-3xl font-bold",children:"Create Knowledge Document"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{onClick:k,disabled:u||!a.trim()||!n.trim(),size:"sm",children:[u?e.jsx(E,{className:"w-4 h-4 animate-spin"}):e.jsx(T,{className:"w-4 h-4"}),"Create Document"]}),e.jsx(j,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(L,{to:"/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(M,{className:"h-4 w-4"})})})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Basic Information"})}),e.jsx(d,{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(m,{htmlFor:"title",children:"Title *"}),e.jsx(b,{id:"title",value:a,onChange:t=>f(t.target.value),placeholder:"Enter document title...",className:"text-lg"})]})})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Metadata"})}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{children:"Tags"}),e.jsx(B,{tags:x,onChange:w,placeholder:"Add a tag"})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Sources"}),e.jsx(P,{sources:p,onChange:C})]})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Content *"})}),e.jsx(d,{children:e.jsx(A,{value:n,onChange:t=>v(t||""),placeholder:`Enter your knowledge content in Markdown...
2
+
3
+ You can use:
4
+ - **Bold text**
5
+ - *Italic text*
6
+ - # Headers
7
+ - - Lists
8
+ - [Links](https://example.com)
9
+ - Code blocks and more!`})})]})]})}export{J as default};
@@ -1,4 +1,4 @@
1
- import{u as Z,z as X,a as ee,E as te,r as n,A as k,j as e,B as j,L as E,h as F,i as L,k as P,l as I,m as r,I as y,a7 as se,R as ae,W as ie,Y as ne,Z as re,_ as oe,$ as le,a0 as ce,a1 as de}from"./index-hqVgTgRB.js";import{C as he,b as ue,c as me,a as pe}from"./card-BCFxXzRk.js";import{L as h}from"./label-vYhfrPMD.js";import{M as ge}from"./markdown-editor-BzZ8tCto.js";import{C as xe}from"./CollapsibleSection-B6RO5o5R.js";import{I as fe,L as je}from"./ImplementationStepsEditor-DWjDyZzP.js";import{T as ye}from"./TagInput-D_SdcypZ.js";import{A as ve}from"./arrow-left-CdM_IPng.js";import"./plus-iamYJu5V.js";import"./badge-DEiQk9C9.js";const R={feature:{name:"New Feature",content:`## Problem Statement
1
+ import{u as Z,v as X,a as ee,w as te,r as n,A as k,j as e,B as j,L as E,I as y,a3 as se,J as ae,Q as ie,R as ne,U as re,V as oe,W as le,Y as ce,Z as de}from"./index-9Tv-j_Ga.js";import{C as he,b as ue,c as me,a as pe}from"./card-SN5gKnu7.js";import{L as h}from"./label-TGqbNfMO.js";import{M as ge}from"./markdown-editor-ls1JPK_e.js";import{S as F,a as L,b as P,c as I,d as r}from"./select-Cs5qtMYV.js";import{C as xe}from"./CollapsibleSection-Bt_ZLnJc.js";import{I as fe,L as je}from"./ImplementationStepsEditor-Ctx0CvbU.js";import{T as ye}from"./TagInput-BK91_M1N.js";import{A as ve}from"./arrow-left-WGBYWq3h.js";import"./chevron-up-CHdIiLxL.js";import"./badge-AwLOflf5.js";const R={feature:{name:"New Feature",content:`## Problem Statement
2
2
  Describe the problem this new feature addresses.
3
3
 
4
4
  ## Proposed Solution
@@ -87,4 +87,4 @@ Brief description (avoid sensitive details).
87
87
  High-level approach to resolution.
88
88
 
89
89
  ## Verification Plan
90
- How to confirm the fix works without exposing the vulnerability.`}},M="feature";function Le(){const B=Z(),H=X(),{toast:v}=ee(),{user:u,authEnabled:w}=te(),[c,C]=n.useState(!1),[U,q]=n.useState(M),[$,p]=n.useState(!1),[S,g]=n.useState(null),b=H.state,N=b?.description||R[M].content,O=b?.title||"",[a,l]=n.useState({title:O,description:N,priority:"medium",author:{id:"current-user",name:"",email:""}}),[m,z]=n.useState([]),[D,V]=n.useState([]),[_,K]=n.useState(N),x=n.useCallback(t=>{if((t.metaKey||t.ctrlKey)&&t.key==="Enter"&&(t.preventDefault(),!c&&a.title)){const s=document.querySelector("form");s&&s.requestSubmit()}},[c,a.title]),W=a.description!==_,Y=t=>{W?(g(t),p(!0)):T(t)},T=t=>{const s=R[t];q(t),l(i=>({...i,description:s.content})),K(s.content)},G=()=>{S&&(T(S),g(null)),p(!1)},Q=()=>{g(null),p(!1)};n.useEffect(()=>(document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x)}),[x]);const A=n.useCallback(async()=>{try{const s=await(await fetch(`${k}/api/v1/user/settings`)).json();if(s.success&&s.data){const{profile:i}=s.data;l(d=>({...d,author:{...d.author,name:i?.firstName&&i?.lastName?`${i.firstName} ${i.lastName}`.trim():i?.firstName||i?.lastName||d.author.name,email:i?.email||d.author.email}}))}}catch(t){console.error("Failed to load user settings:",t)}},[]);n.useEffect(()=>{w?u&&l(t=>({...t,author:{...t.author,id:u.id||t.author.id,name:u.name||t.author.name,email:u.email||t.author.email}})):A()},[w,u,A]);const J=async t=>{t.preventDefault(),C(!0);try{const s=m.map(o=>({id:o.id,description:o.description.trim(),status:o.status})).filter(o=>o.description.length>0),i=D.map(o=>o.trim()).filter(o=>o.length>0),d={title:a.title,author:{...a.author,type:"human"},planSteps:s,metadata:{priority:a.priority,tags:i},content:a.description},f=await(await fetch(`${k}/api/v1/proposals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).json();if(f.success)v({title:"Success",description:"Proposal created successfully."}),B(`/proposals/${f.data.id}`);else throw new Error(f.error?.message||"Failed to create proposal")}catch(s){const i=s instanceof Error?s.message:"Unknown error occurred";v({title:"Error",description:`Error creating proposal: ${i}`,variant:"destructive"})}finally{C(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"New Task"}),e.jsx("p",{className:"text-muted-foreground",children:"Create a new task"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(j,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(E,{to:"/proposals",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(ve,{className:"h-4 w-4"})})})})]}),e.jsx("form",{onSubmit:J,children:e.jsxs(he,{children:[e.jsx(ue,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(me,{children:"Task Details"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{htmlFor:"template-select",className:"text-sm text-muted-foreground",children:"Template:"}),e.jsxs(F,{value:U,onValueChange:Y,children:[e.jsx(L,{className:"w-36",children:e.jsx(P,{})}),e.jsxs(I,{children:[e.jsx(r,{value:"feature",children:"New Feature"}),e.jsx(r,{value:"quick-change",children:"Quick Change"}),e.jsx(r,{value:"bug-fix",children:"Bug Fix"}),e.jsx(r,{value:"refactor",children:"Refactor"}),e.jsx(r,{value:"documentation",children:"Documentation"}),e.jsx(r,{value:"security-fix",children:"Security Fix"})]})]})]})]})}),e.jsxs(pe,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"title",children:"Title *"}),e.jsx(y,{id:"title",placeholder:"Brief overview of the proposal",value:a.title,onChange:t=>l(s=>({...s,title:t.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"description",children:"Description"}),e.jsx(ge,{value:a.description,onChange:t=>l(s=>({...s,description:t||""})),placeholder:"Write your proposal description in markdown...",height:300})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"author-name",children:"Author Name"}),e.jsx(y,{id:"author-name",value:a.author.name,onChange:t=>l(s=>({...s,author:{...s.author,name:t.target.value}})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"author-email",children:"Author Email"}),e.jsx(y,{id:"author-email",type:"email",value:a.author.email,onChange:t=>l(s=>({...s,author:{...s.author,email:t.target.value}}))})]})]}),e.jsx(xe,{icon:e.jsx(je,{className:"h-4 w-4"}),title:"Optional Implementation Detail",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"priority",children:"Priority"}),e.jsxs(F,{value:a.priority,onValueChange:t=>l(s=>({...s,priority:t})),children:[e.jsx(L,{children:e.jsx(P,{placeholder:"Select priority"})}),e.jsxs(I,{children:[e.jsx(r,{value:"low",children:"Low"}),e.jsx(r,{value:"medium",children:"Medium"}),e.jsx(r,{value:"high",children:"High"}),e.jsx(r,{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Implementation Steps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Break the change into actionable steps."})]}),m.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length," step",m.length===1?"":"s"]})]}),e.jsx(fe,{steps:m,onChange:z,disabled:c})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Tags"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Use tags to categorize this proposal by area, team, or priority."}),e.jsx(ye,{tags:D,onChange:V,disabled:c,placeholder:"Add a tag (e.g. frontend, infra)"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{type:"button",variant:"outline",asChild:!0,children:e.jsx(E,{to:"/proposals",children:"Cancel"})}),e.jsx(j,{type:"submit",disabled:c||!a.title,className:"relative",children:c?e.jsx(e.Fragment,{children:"Creating..."}):e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"Create Task",e.jsx("span",{className:"ml-2 text-xs opacity-60 font-mono",children:"⌘↵"})]})})]})]})]})}),e.jsx(ae,{open:$,onOpenChange:p,children:e.jsxs(ie,{children:[e.jsxs(ne,{children:[e.jsx(re,{children:"Switch Template?"}),e.jsx(oe,{children:"You have unsaved changes to your proposal description. Switching templates will replace your current content with the new template. This action cannot be undone."})]}),e.jsxs(le,{children:[e.jsx(ce,{onClick:Q,children:"Cancel"}),e.jsx(de,{onClick:G,children:"Switch Template"})]})]})})]})}export{Le as NewProposalPage};
90
+ How to confirm the fix works without exposing the vulnerability.`}},M="feature";function Pe(){const B=Z(),U=X(),{toast:v}=ee(),{user:u,authEnabled:w}=te(),[c,S]=n.useState(!1),[H,q]=n.useState(M),[O,p]=n.useState(!1),[C,g]=n.useState(null),b=U.state,N=b?.description||R[M].content,V=b?.title||"",[a,l]=n.useState({title:V,description:N,priority:"medium",author:{id:"current-user",name:"",email:""}}),[m,$]=n.useState([]),[D,z]=n.useState([]),[K,W]=n.useState(N),x=n.useCallback(t=>{if((t.metaKey||t.ctrlKey)&&t.key==="Enter"&&(t.preventDefault(),!c&&a.title)){const s=document.querySelector("form");s&&s.requestSubmit()}},[c,a.title]),_=a.description!==K,Q=t=>{_?(g(t),p(!0)):T(t)},T=t=>{const s=R[t];q(t),l(i=>({...i,description:s.content})),W(s.content)},Y=()=>{C&&(T(C),g(null)),p(!1)},G=()=>{g(null),p(!1)};n.useEffect(()=>(document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x)}),[x]);const A=n.useCallback(async()=>{try{const s=await(await fetch(`${k}/api/v1/user/settings`)).json();if(s.success&&s.data){const{profile:i}=s.data;l(d=>({...d,author:{...d.author,name:i?.firstName&&i?.lastName?`${i.firstName} ${i.lastName}`.trim():i?.firstName||i?.lastName||d.author.name,email:i?.email||d.author.email}}))}}catch(t){console.error("Failed to load user settings:",t)}},[]);n.useEffect(()=>{w?u&&l(t=>({...t,author:{...t.author,id:u.id||t.author.id,name:u.name||t.author.name,email:u.email||t.author.email}})):A()},[w,u,A]);const J=async t=>{t.preventDefault(),S(!0);try{const s=m.map(o=>({id:o.id,description:o.description.trim(),status:o.status})).filter(o=>o.description.length>0),i=D.map(o=>o.trim()).filter(o=>o.length>0),d={title:a.title,author:{...a.author,type:"human"},planSteps:s,metadata:{priority:a.priority,tags:i},content:a.description},f=await(await fetch(`${k}/api/v1/proposals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).json();if(f.success)v({title:"Success",description:"Proposal created successfully."}),B(`/proposals/${f.data.id}`);else throw new Error(f.error?.message||"Failed to create proposal")}catch(s){const i=s instanceof Error?s.message:"Unknown error occurred";v({title:"Error",description:`Error creating proposal: ${i}`,variant:"destructive"})}finally{S(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"New Task"}),e.jsx("p",{className:"text-muted-foreground",children:"Create a new task"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(j,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(E,{to:"/proposals",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(ve,{className:"h-4 w-4"})})})})]}),e.jsx("form",{onSubmit:J,children:e.jsxs(he,{children:[e.jsx(ue,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(me,{children:"Task Details"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{htmlFor:"template-select",className:"text-sm text-muted-foreground",children:"Template:"}),e.jsxs(F,{value:H,onValueChange:Q,children:[e.jsx(L,{className:"w-36",children:e.jsx(P,{})}),e.jsxs(I,{children:[e.jsx(r,{value:"feature",children:"New Feature"}),e.jsx(r,{value:"quick-change",children:"Quick Change"}),e.jsx(r,{value:"bug-fix",children:"Bug Fix"}),e.jsx(r,{value:"refactor",children:"Refactor"}),e.jsx(r,{value:"documentation",children:"Documentation"}),e.jsx(r,{value:"security-fix",children:"Security Fix"})]})]})]})]})}),e.jsxs(pe,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"title",children:"Title *"}),e.jsx(y,{id:"title",placeholder:"Brief overview of the proposal",value:a.title,onChange:t=>l(s=>({...s,title:t.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"description",children:"Description"}),e.jsx(ge,{value:a.description,onChange:t=>l(s=>({...s,description:t||""})),placeholder:"Write your proposal description in markdown...",height:300})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"author-name",children:"Author Name"}),e.jsx(y,{id:"author-name",value:a.author.name,onChange:t=>l(s=>({...s,author:{...s.author,name:t.target.value}})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"author-email",children:"Author Email"}),e.jsx(y,{id:"author-email",type:"email",value:a.author.email,onChange:t=>l(s=>({...s,author:{...s.author,email:t.target.value}}))})]})]}),e.jsx(xe,{icon:e.jsx(je,{className:"h-4 w-4"}),title:"Optional Implementation Detail",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"priority",children:"Priority"}),e.jsxs(F,{value:a.priority,onValueChange:t=>l(s=>({...s,priority:t})),children:[e.jsx(L,{children:e.jsx(P,{placeholder:"Select priority"})}),e.jsxs(I,{children:[e.jsx(r,{value:"low",children:"Low"}),e.jsx(r,{value:"medium",children:"Medium"}),e.jsx(r,{value:"high",children:"High"}),e.jsx(r,{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Implementation Steps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Break the change into actionable steps."})]}),m.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length," step",m.length===1?"":"s"]})]}),e.jsx(fe,{steps:m,onChange:$,disabled:c})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Tags"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Use tags to categorize this proposal by area, team, or priority."}),e.jsx(ye,{tags:D,onChange:z,disabled:c,placeholder:"Add a tag (e.g. frontend, infra)"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{type:"button",variant:"outline",asChild:!0,children:e.jsx(E,{to:"/proposals",children:"Cancel"})}),e.jsx(j,{type:"submit",disabled:c||!a.title,className:"relative",children:c?e.jsx(e.Fragment,{children:"Creating..."}):e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"Create Task",e.jsx("span",{className:"ml-2 text-xs opacity-60 font-mono",children:"⌘↵"})]})})]})]})]})}),e.jsx(ae,{open:O,onOpenChange:p,children:e.jsxs(ie,{children:[e.jsxs(ne,{children:[e.jsx(re,{children:"Switch Template?"}),e.jsx(oe,{children:"You have unsaved changes to your proposal description. Switching templates will replace your current content with the new template. This action cannot be undone."})]}),e.jsxs(le,{children:[e.jsx(ce,{onClick:G,children:"Cancel"}),e.jsx(de,{onClick:Y,children:"Switch Template"})]})]})})]})}export{Pe as NewProposalPage};
@@ -1 +1 @@
1
- import{u as z,a as H,r as a,j as e,B as b,L as w,p as J,I as P,w as W,ag as Y,A as M}from"./index-hqVgTgRB.js";import{C as G,b as K,c as Q,a as V}from"./card-BCFxXzRk.js";import{L as l}from"./label-vYhfrPMD.js";import{B as X}from"./badge-DEiQk9C9.js";import{c as Z}from"./clipboard-B9ndUJKl.js";import{A as O}from"./arrow-left-CdM_IPng.js";import{C as ee,a as se}from"./clipboard-DC2xmNVx.js";function de(){const E=z(),{toast:g}=H(),[n,j]=a.useState(!1),[v,d]=a.useState(null),[m,A]=a.useState(""),[u,L]=a.useState(""),[c,F]=a.useState("blue"),[x,C]=a.useState([]),[h,T]=a.useState(""),[y,p]=a.useState([]),[B,N]=a.useState(!0),[I,S]=a.useState(!1),D=["blue","green","red","emerald","purple","orange","yellow","teal","indigo","pink","cyan","slate","gray"],$={blue:{bg:"#3b82f6",border:"#1e40af",text:"#ffffff"},green:{bg:"#22c55e",border:"#15803d",text:"#ffffff"},red:{bg:"#ef4444",border:"#b91c1c",text:"#ffffff"},emerald:{bg:"#10b981",border:"#047857",text:"#ffffff"},purple:{bg:"#a855f7",border:"#7e22ce",text:"#ffffff"},orange:{bg:"#f97316",border:"#c2410c",text:"#ffffff"},yellow:{bg:"#eab308",border:"#a16207",text:"#ffffff"},teal:{bg:"#14b8a6",border:"#0f766e",text:"#ffffff"},indigo:{bg:"#6366f1",border:"#4338ca",text:"#ffffff"},pink:{bg:"#ec4899",border:"#be185d",text:"#ffffff"},cyan:{bg:"#06b6d4",border:"#0e7490",text:"#ffffff"},slate:{bg:"#64748b",border:"#475569",text:"#ffffff"},gray:{bg:"#6b7280",border:"#4b5563",text:"#ffffff"}};a.useEffect(()=>{let s=!0;return(async()=>{N(!0);try{const o=await fetch(`${M}/api/v1/mcp`);if(!o.ok)throw new Error("Failed to fetch MCP servers");const r=await o.json();if(!r?.success||!Array.isArray(r.servers)){s&&p([]);return}const U=r.mcpServers&&typeof r.mcpServers=="object"?r.mcpServers:{},k=r.servers.map(f=>{const i=U[f]??{};return{name:f,enabled:i?.enabled!==!1,description:typeof i?.description=="string"?i.description:void 0}});s&&(p(k),C(f=>f.filter(i=>k.some(_=>_.name===i))))}catch(o){console.error("Failed to load MCP servers",o),s&&p([])}finally{s&&N(!1)}})(),()=>{s=!1}},[]);const q=async()=>{const s=".nut/config.json";try{await Z(s),S(!0),g({title:"Copied!",description:`${s} copied to clipboard`}),setTimeout(()=>S(!1),2e3)}catch(t){console.error("Failed to copy config path:",t),g({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},R=async s=>{if(s.preventDefault(),!m.trim()||!u.trim()||!h.trim()){d("Name, description, and skill instructions are required");return}try{j(!0),d(null);const t={name:m.trim(),description:u.trim(),content:h.trim(),metadata:{color:c,mcpServers:x.length>0?x:void 0}},r=await(await fetch(`${M}/api/v1/skills`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json();r.success?E("/skills"):d(r.error?.message||"Failed to create skill")}catch(t){d(t instanceof Error?t.message:"Unknown error")}finally{j(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Create New Skill"}),e.jsx("p",{className:"text-muted-foreground",children:"Define an AI skill for automated development workflows"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(b,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(w,{to:"/skills",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(O,{className:"h-4 w-4"})})})})]}),e.jsxs(G,{children:[e.jsx(K,{children:e.jsxs(Q,{className:"flex items-center gap-2",children:[e.jsx(J,{className:"h-5 w-5"}),"Skill Configuration"]})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:R,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"name",children:"Name *"}),e.jsx(P,{id:"name",placeholder:"e.g., design expert",value:m,onChange:s=>A(s.target.value),disabled:n})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"description",children:"Description *"}),e.jsx(P,{id:"description",placeholder:"When should this skill be used?",value:u,onChange:s=>L(s.target.value),disabled:n})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:D.map(s=>{const t=$[s];return e.jsx("button",{type:"button",onClick:()=>F(s),disabled:n,className:`w-10 h-10 rounded-md border-2 transition-all ${c===s?"ring-2 ring-offset-2 shadow-md":"hover:scale-110 hover:shadow-sm"}`,style:{backgroundColor:t.bg,borderColor:c===s?t.border:"hsl(var(--border))",...c===s&&{"--tw-ring-color":t.border}},title:s,children:e.jsx("span",{className:"sr-only",children:s})},s)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"content",children:"Skill Instructions *"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["System prompt or instructions for this skill."," ","Insert ",e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:".nut/config.json"})," ",e.jsx("button",{type:"button",onClick:q,className:"inline-flex items-center align-middle text-muted-foreground hover:text-foreground transition-colors",title:"Copy .nut/config.json to clipboard",children:I?e.jsx(ee,{className:"h-3.5 w-3.5 ml-0.5"}):e.jsx(se,{className:"h-3.5 w-3.5 ml-0.5"})})," ","if you want the skill to be able to access its name, role, or email address."]}),e.jsx(W,{id:"content",placeholder:"You are a design expert that focuses on...",value:h,onChange:s=>T(s.target.value),rows:8,disabled:n,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"MCP Servers (Optional)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers this skill requires."}),e.jsx("div",{className:"space-y-2",children:B?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers..."}):y.length===0?e.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):y.map(s=>e.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[e.jsx(Y,{checked:x.includes(s.name),onCheckedChange:t=>{C(o=>t===!0?o.includes(s.name)?o:[...o,s.name]:o.filter(r=>r!==s.name))},disabled:n||!s.enabled}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s.name,!s.enabled&&e.jsx(X,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.enabled?s.description||"Enabled MCP server":"Enable this server in Settings to use it"})]})]},s.name))})]}),v&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:v}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(b,{type:"button",variant:"outline",asChild:!0,disabled:n,children:e.jsx(w,{to:"/skills",children:"Cancel"})}),e.jsx(b,{type:"submit",disabled:n,children:n?"Creating...":"Create Skill"})]})]})})]})]})}export{de as default};
1
+ import{u as z,a as H,r as a,j as e,B as b,L as w,k as J,I as P,q as W,ae as Y,A as M}from"./index-9Tv-j_Ga.js";import{C as G,b as K,c as Q,a as V}from"./card-SN5gKnu7.js";import{L as l}from"./label-TGqbNfMO.js";import{B as X}from"./badge-AwLOflf5.js";import{c as Z}from"./clipboard-B9ndUJKl.js";import{A as O}from"./arrow-left-WGBYWq3h.js";import{C as ee,a as se}from"./clipboard-BdymjxLO.js";function de(){const E=z(),{toast:g}=H(),[n,j]=a.useState(!1),[v,d]=a.useState(null),[m,A]=a.useState(""),[u,L]=a.useState(""),[c,F]=a.useState("blue"),[x,C]=a.useState([]),[h,T]=a.useState(""),[y,p]=a.useState([]),[B,N]=a.useState(!0),[I,S]=a.useState(!1),D=["blue","green","red","emerald","purple","orange","yellow","teal","indigo","pink","cyan","slate","gray"],q={blue:{bg:"#3b82f6",border:"#1e40af",text:"#ffffff"},green:{bg:"#22c55e",border:"#15803d",text:"#ffffff"},red:{bg:"#ef4444",border:"#b91c1c",text:"#ffffff"},emerald:{bg:"#10b981",border:"#047857",text:"#ffffff"},purple:{bg:"#a855f7",border:"#7e22ce",text:"#ffffff"},orange:{bg:"#f97316",border:"#c2410c",text:"#ffffff"},yellow:{bg:"#eab308",border:"#a16207",text:"#ffffff"},teal:{bg:"#14b8a6",border:"#0f766e",text:"#ffffff"},indigo:{bg:"#6366f1",border:"#4338ca",text:"#ffffff"},pink:{bg:"#ec4899",border:"#be185d",text:"#ffffff"},cyan:{bg:"#06b6d4",border:"#0e7490",text:"#ffffff"},slate:{bg:"#64748b",border:"#475569",text:"#ffffff"},gray:{bg:"#6b7280",border:"#4b5563",text:"#ffffff"}};a.useEffect(()=>{let s=!0;return(async()=>{N(!0);try{const o=await fetch(`${M}/api/v1/mcp`);if(!o.ok)throw new Error("Failed to fetch MCP servers");const r=await o.json();if(!r?.success||!Array.isArray(r.servers)){s&&p([]);return}const U=r.mcpServers&&typeof r.mcpServers=="object"?r.mcpServers:{},k=r.servers.map(f=>{const i=U[f]??{};return{name:f,enabled:i?.enabled!==!1,description:typeof i?.description=="string"?i.description:void 0}});s&&(p(k),C(f=>f.filter(i=>k.some(_=>_.name===i))))}catch(o){console.error("Failed to load MCP servers",o),s&&p([])}finally{s&&N(!1)}})(),()=>{s=!1}},[]);const $=async()=>{const s=".nut/config.json";try{await Z(s),S(!0),g({title:"Copied!",description:`${s} copied to clipboard`}),setTimeout(()=>S(!1),2e3)}catch(t){console.error("Failed to copy config path:",t),g({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},R=async s=>{if(s.preventDefault(),!m.trim()||!u.trim()||!h.trim()){d("Name, description, and skill instructions are required");return}try{j(!0),d(null);const t={name:m.trim(),description:u.trim(),content:h.trim(),metadata:{color:c,mcpServers:x.length>0?x:void 0}},r=await(await fetch(`${M}/api/v1/skills`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json();r.success?E("/skills"):d(r.error?.message||"Failed to create skill")}catch(t){d(t instanceof Error?t.message:"Unknown error")}finally{j(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Create New Skill"}),e.jsx("p",{className:"text-muted-foreground",children:"Define an AI skill for automated development workflows"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(b,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(w,{to:"/skills",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(O,{className:"h-4 w-4"})})})})]}),e.jsxs(G,{children:[e.jsx(K,{children:e.jsxs(Q,{className:"flex items-center gap-2",children:[e.jsx(J,{className:"h-5 w-5"}),"Skill Configuration"]})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:R,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"name",children:"Name *"}),e.jsx(P,{id:"name",placeholder:"e.g., design expert",value:m,onChange:s=>A(s.target.value),disabled:n})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"description",children:"Description *"}),e.jsx(P,{id:"description",placeholder:"When should this skill be used?",value:u,onChange:s=>L(s.target.value),disabled:n})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:D.map(s=>{const t=q[s];return e.jsx("button",{type:"button",onClick:()=>F(s),disabled:n,className:`w-10 h-10 rounded-md border-2 transition-all ${c===s?"ring-2 ring-offset-2 shadow-md":"hover:scale-110 hover:shadow-sm"}`,style:{backgroundColor:t.bg,borderColor:c===s?t.border:"hsl(var(--border))",...c===s&&{"--tw-ring-color":t.border}},title:s,children:e.jsx("span",{className:"sr-only",children:s})},s)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"content",children:"Skill Instructions *"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["System prompt or instructions for this skill."," ","Insert ",e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:".nut/config.json"})," ",e.jsx("button",{type:"button",onClick:$,className:"inline-flex items-center align-middle text-muted-foreground hover:text-foreground transition-colors",title:"Copy .nut/config.json to clipboard",children:I?e.jsx(ee,{className:"h-3.5 w-3.5 ml-0.5"}):e.jsx(se,{className:"h-3.5 w-3.5 ml-0.5"})})," ","if you want the skill to be able to access its name, role, or email address."]}),e.jsx(W,{id:"content",placeholder:"You are a design expert that focuses on...",value:h,onChange:s=>T(s.target.value),rows:8,disabled:n,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"MCP Servers (Optional)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers this skill requires."}),e.jsx("div",{className:"space-y-2",children:B?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers..."}):y.length===0?e.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):y.map(s=>e.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[e.jsx(Y,{checked:x.includes(s.name),onCheckedChange:t=>{C(o=>t===!0?o.includes(s.name)?o:[...o,s.name]:o.filter(r=>r!==s.name))},disabled:n||!s.enabled}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s.name,!s.enabled&&e.jsx(X,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.enabled?s.description||"Enabled MCP server":"Enable this server in Settings to use it"})]})]},s.name))})]}),v&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:v}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(b,{type:"button",variant:"outline",asChild:!0,disabled:n,children:e.jsx(w,{to:"/skills",children:"Cancel"})}),e.jsx(b,{type:"submit",disabled:n,children:n?"Creating...":"Create Skill"})]})]})})]})]})}export{de as default};
@@ -0,0 +1,11 @@
1
+ import{u as L,a as I,r as i,A as S,j as e,B as C,L as M,a3 as A,I as p}from"./index-9Tv-j_Ga.js";import{C as m,a as x,b,c as P}from"./card-SN5gKnu7.js";import{L as l}from"./label-TGqbNfMO.js";import{S as B,a as D,b as T,c as O,d as j}from"./select-Cs5qtMYV.js";import{M as V}from"./markdown-editor-ls1JPK_e.js";import{A as W}from"./arrow-left-WGBYWq3h.js";import{C as z}from"./circle-check-big-nY4PntB5.js";import"./chevron-up-CHdIiLxL.js";function G(){const E=L(),{toast:d}=I(),[a,v]=i.useState({project:{name:"",description:"",website:"",version:"1.0.0",stage:"development"}}),[u,g]=i.useState(""),[F,f]=i.useState(!0),[y,w]=i.useState(!1);i.useEffect(()=>{fetch(`${S}/api/v1/context/project`).then(t=>t.json()).then(t=>{if(t.success){const s=t.document;v({project:{name:s.metadata.project?.name||"",description:s.metadata.project?.description||"",website:s.metadata.project?.website||s.metadata.project?.repository||"",version:s.metadata.project?.version||"1.0.0",stage:s.metadata.project?.stage||"development"}}),g(s.content.trim())}f(!1)}).catch(t=>{console.error("Failed to load context:",t),d({title:"Error",description:"Failed to load project context",variant:"destructive"}),f(!1)})},[d]);const k=async()=>{w(!0);try{const s={project:Object.fromEntries(Object.entries(a.project).map(([o,r])=>[o,typeof r=="string"?r.trim():r]))},n=await(await fetch(`${S}/api/v1/context/project`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u,metadata:s})})).json();if(n.success)d({title:"Success",description:"Project context saved successfully",action:e.jsx(z,{className:"h-4 w-4"})}),E("/context/project");else throw new Error(n.error||"Failed to save context")}catch(t){console.error("Save error:",t),d({title:"Error",description:"Failed to save project context",variant:"destructive"})}finally{w(!1)}},c=(t,s)=>{v(N=>{const n={...N},o=t.split(".");let r=n;for(let h=0;h<o.length-1;h++)r=r[o[h]];return r[o[o.length-1]]=s,n})};return F?e.jsx("div",{className:"space-y-6",children:e.jsx(m,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Edit project information and documentation"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(M,{to:"/context/project",children:[e.jsx(W,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Back"})]})}),e.jsxs(C,{size:"sm",onClick:k,disabled:y,children:[e.jsx(A,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:y?"Saving...":"Save"})]})]})]}),e.jsxs(m,{children:[e.jsx(b,{children:e.jsx(P,{children:"Project Information"})}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-name",children:"Project Name"}),e.jsx(p,{id:"project-name",value:a.project.name,onChange:t=>c("project.name",t.target.value),placeholder:"My Awesome Project"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-version",children:"Version"}),e.jsx(p,{id:"project-version",value:a.project.version,onChange:t=>c("project.version",t.target.value),placeholder:"1.0.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-description",children:"Description"}),e.jsx(p,{id:"project-description",value:a.project.description,onChange:t=>c("project.description",t.target.value),placeholder:"Brief description of what this project does"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-website",children:"Website"}),e.jsx(p,{id:"project-website",value:a.project.website,onChange:t=>c("project.website",t.target.value),placeholder:"https://yourproject.com"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-stage",children:"Development Stage"}),e.jsxs(B,{value:a.project.stage,onValueChange:t=>c("project.stage",t),children:[e.jsx(D,{children:e.jsx(T,{placeholder:"Select stage"})}),e.jsxs(O,{children:[e.jsx(j,{value:"prototype",children:"Prototype"}),e.jsx(j,{value:"development",children:"Development"}),e.jsx(j,{value:"mvp",children:"MVP"}),e.jsx(j,{value:"production",children:"Production"})]})]})]})]})]})]}),e.jsxs(m,{children:[e.jsx(b,{children:e.jsx(P,{children:"Documentation"})}),e.jsx(x,{children:e.jsx(V,{value:u,onChange:t=>g(t||""),placeholder:`Write your project documentation in markdown...
2
+
3
+ ## What is this project?
4
+
5
+ Describe what your project does, who it's for, and why it exists.
6
+
7
+ ## Current State
8
+
9
+ - Development stage
10
+ - Key features that are working
11
+ - What's planned for next releases`,height:800})})]})]})}export{G as default};
@@ -1 +1 @@
1
- import{a as w,r,A as y,j as e,H as C,F as b,B as n,M as P,aB as E,L as k,Q as L,ay as z}from"./index-hqVgTgRB.js";import{C as c,a as i,b as p,c as B}from"./card-BCFxXzRk.js";import{B as x}from"./badge-DEiQk9C9.js";import{c as F}from"./clipboard-B9ndUJKl.js";import{E as D}from"./external-link-CYBz87-P.js";function I(){const{toast:d}=w(),[o,h]=r.useState(null),[j,u]=r.useState(!0),[f,l]=r.useState(!1);r.useEffect(()=>{fetch(`${y}/api/v1/context/project`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(h(s.document),l(!0)):l(!1)}).catch(()=>{l(!1)}).finally(()=>{u(!1)})},[]);const v=async()=>{const s=".nut/context/project.md";try{await F(s),d({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(m){console.error("Failed to copy path:",m),d({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},N=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"project-md",filename:"project.md",name:"project.md",path:".nut/context/project.md"}});window.dispatchEvent(s)};if(j)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading Project Overview..."})]})})})});if(!f||!o)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(b,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Project Overview Found"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Run ",e.jsx("code",{className:"bg-muted px-2 py-1 rounded",children:"coconut init"})," to create the project overview."]})]})})})});const t=o.metadata,a=t.project?.website||t.project?.repository,g=a?(s=>{try{return new URL(s.startsWith("http")?s:`https://${s}`).host.replace(/^www\./,"")}catch{return s.replace(/^https?:\/\//,"")}})(a):null;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Core project information and configuration"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(n,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(P,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(n,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(n,{size:"sm",asChild:!0,children:e.jsxs(k,{to:"/context/project/edit",children:[e.jsx(L,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),t&&e.jsx("div",{className:"grid grid-cols-1 gap-4",children:e.jsxs(c,{children:[e.jsx(p,{className:"pb-3",children:e.jsx(B,{className:"text-lg font-semibold",children:"Project Info"})}),e.jsxs(i,{className:"space-y-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.project?.name||"Unnamed Project"}),t.project?.description&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t.project.description})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(D,{className:"w-3 h-3 mr-2"}),g||"Website"]})}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[t.project?.version&&e.jsxs(x,{variant:"secondary",children:["v",t.project.version]}),t.project?.stage&&e.jsx(x,{variant:t.project.stage==="mvp"?"default":"secondary",children:t.project.stage})]})]})]})]})}),e.jsxs(c,{children:[e.jsx(p,{}),e.jsx(i,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(z,{children:o.content||"No content available"})})})]})]})}export{I as default};
1
+ import{a as w,r,A as y,j as e,x as C,F as b,B as n,M as P,ax as E,L as k,H as L,au as z}from"./index-9Tv-j_Ga.js";import{C as c,a as i,b as x,c as F}from"./card-SN5gKnu7.js";import{B as p}from"./badge-AwLOflf5.js";import{c as B}from"./clipboard-B9ndUJKl.js";import{E as D}from"./external-link-DwMXcCCj.js";function I(){const{toast:d}=w(),[o,h]=r.useState(null),[j,u]=r.useState(!0),[f,l]=r.useState(!1);r.useEffect(()=>{fetch(`${y}/api/v1/context/project`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(h(s.document),l(!0)):l(!1)}).catch(()=>{l(!1)}).finally(()=>{u(!1)})},[]);const v=async()=>{const s=".nut/context/project.md";try{await B(s),d({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(m){console.error("Failed to copy path:",m),d({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},N=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"project-md",filename:"project.md",name:"project.md",path:".nut/context/project.md"}});window.dispatchEvent(s)};if(j)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading Project Overview..."})]})})})});if(!f||!o)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(b,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Project Overview Found"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Run ",e.jsx("code",{className:"bg-muted px-2 py-1 rounded",children:"coconut init"})," to create the project overview."]})]})})})});const t=o.metadata,a=t.project?.website||t.project?.repository,g=a?(s=>{try{return new URL(s.startsWith("http")?s:`https://${s}`).host.replace(/^www\./,"")}catch{return s.replace(/^https?:\/\//,"")}})(a):null;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Core project information and configuration"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(n,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(P,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(n,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(n,{size:"sm",asChild:!0,children:e.jsxs(k,{to:"/context/project/edit",children:[e.jsx(L,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),t&&e.jsx("div",{className:"grid grid-cols-1 gap-4",children:e.jsxs(c,{children:[e.jsx(x,{className:"pb-3",children:e.jsx(F,{className:"text-lg font-semibold",children:"Project Info"})}),e.jsxs(i,{className:"space-y-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.project?.name||"Unnamed Project"}),t.project?.description&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t.project.description})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(D,{className:"w-3 h-3 mr-2"}),g||"Website"]})}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[t.project?.version&&e.jsxs(p,{variant:"secondary",children:["v",t.project.version]}),t.project?.stage&&e.jsx(p,{variant:t.project.stage==="mvp"?"default":"secondary",children:t.project.stage})]})]})]})]})}),e.jsxs(c,{children:[e.jsx(x,{}),e.jsx(i,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(z,{children:o.content||"No content available"})})})]})]})}export{I as default};
@@ -0,0 +1 @@
1
+ import{j as e,a2 as p,B as r,P as h,H as j,ai as u,O as g,I as l}from"./index-9Tv-j_Ga.js";import{C as t,b as i,c as n,d as c,a as d}from"./card-SN5gKnu7.js";import{L as a}from"./label-TGqbNfMO.js";import{S as f,a as v,b as N,c as y,d as b}from"./select-Cs5qtMYV.js";import{B as o}from"./badge-AwLOflf5.js";import{E as w}from"./eye-DYnjJzdb.js";import{D as C}from"./download-Cv2G2Eg9.js";import"./chevron-up-CHdIiLxL.js";function U(){const m=[{id:"1",name:"Code Review Assistant",description:"Prompt for AI agents to perform thorough code reviews",category:"Code Review",usage:"cursor-cli, claude-code",lastUpdated:"2 days ago",active:!0},{id:"2",name:"Architecture Advisor",description:"System prompt for architectural decision guidance",category:"Architecture",usage:"gemini-cli, claude-code",lastUpdated:"1 week ago",active:!0},{id:"3",name:"Bug Analysis Expert",description:"Specialized prompt for debugging and error analysis",category:"Debugging",usage:"cursor-cli",lastUpdated:"3 days ago",active:!1},{id:"4",name:"Documentation Generator",description:"Prompt for generating comprehensive code documentation",category:"Documentation",usage:"github-copilot, claude-code",lastUpdated:"5 days ago",active:!0}],x=["Code Review","Architecture","Debugging","Documentation","Testing","Refactoring","Security","Performance"];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"System Prompts"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage system prompts used by AI agents and integrations for consistent behavior."})]}),e.jsx(p,{}),e.jsxs(t,{children:[e.jsx(i,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Prompt Library"}),e.jsx(c,{children:"Pre-configured prompts for different AI agents and use cases."})]}),e.jsxs(r,{size:"sm",children:[e.jsx(h,{className:"h-4 w-4 mr-2"}),"New Prompt"]})]})}),e.jsx(d,{children:e.jsx("div",{className:"space-y-4",children:m.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h4",{className:"font-medium",children:s.name}),e.jsx(o,{variant:s.active?"default":"secondary",children:s.active?"Active":"Inactive"}),e.jsx(o,{variant:"outline",children:s.category})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.description}),e.jsxs("div",{className:"flex items-center space-x-4 mt-2",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used by: ",s.usage]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Updated: ",s.lastUpdated]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(w,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(j,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(u,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(g,{className:"h-4 w-4"})})]})]},s.id))})})]}),e.jsxs(t,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Create New Prompt"}),e.jsx(c,{children:"Design a new system prompt for your AI agents and integrations."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptName",children:"Prompt Name"}),e.jsx(l,{id:"promptName",placeholder:"Enter prompt name"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptCategory",children:"Category"}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(N,{placeholder:"Select category"})}),e.jsx(y,{children:x.map(s=>e.jsx(b,{value:s.toLowerCase(),children:s},s))})]})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptDescription",children:"Description"}),e.jsx(l,{id:"promptDescription",placeholder:"Brief description of the prompt's purpose"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"targetIntegrations",children:"Target Integrations"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:["cursor-cli","claude-code","gemini-cli","github-copilot"].map(s=>e.jsxs("label",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",className:"rounded"}),e.jsx("span",{className:"text-sm",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptContent",children:"Prompt Content"}),e.jsx("textarea",{id:"promptContent",className:"w-full min-h-[200px] p-3 border rounded-md font-mono text-sm",placeholder:"You are an expert code reviewer. Your task is to..."})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptVariables",children:"Variables (JSON format)"}),e.jsx("textarea",{id:"promptVariables",className:"w-full min-h-[100px] p-3 border rounded-md font-mono text-sm",placeholder:'{"language": "typescript", "framework": "react", "style": "functional"}'})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(r,{variant:"outline",children:"Preview"}),e.jsx(r,{variant:"outline",children:"Save as Draft"}),e.jsx(r,{children:"Save & Activate"})]})]})]}),e.jsxs(t,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Prompt Templates"}),e.jsx(c,{children:"Import and export prompt templates for sharing across teams."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(r,{variant:"outline",size:"sm",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Import Template"]}),e.jsx(r,{variant:"outline",size:"sm",children:"Export All Prompts"}),e.jsx(r,{variant:"outline",size:"sm",children:"Export Selected"})]}),e.jsx("div",{className:"p-4 border-2 border-dashed rounded-lg text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Drag and drop prompt template files here, or click to browse"})})]})]})]})}export{U as default};
@@ -0,0 +1 @@
1
+ import{E as ae,u as re,r as l,a as ne,j as e,B as n,L as c,H as le,J as ie,N as oe,O as ce,Q as de,R as me,U as he,V as xe,W as pe,Y as ue,Z as je,_ as O,$ as I,l as fe,D as F,a0 as R,b as B,d as H,f as V,g as z,a1 as J,q as ge,n as ve,a2 as Ne,A as f}from"./index-9Tv-j_Ga.js";import{c as Ce}from"./clipboard-B9ndUJKl.js";import{C as d,b as h,a as m,c as p,d as _}from"./card-SN5gKnu7.js";import{B as x}from"./badge-AwLOflf5.js";import{L as q}from"./label-TGqbNfMO.js";import{S as ye,a as we,b as be,c as Se,d as De}from"./select-Cs5qtMYV.js";import{g as M,C as Ae,a as ke}from"./status-utils-BDOyevaX.js";import{A as w}from"./arrow-left-WGBYWq3h.js";import{C as Te,a as Ee}from"./clipboard-BdymjxLO.js";import{I as $e}from"./info-BmtuPMhv.js";import{D as Pe}from"./download-Cv2G2Eg9.js";import{C as Ue}from"./clock-HDu44KTo.js";import"./chevron-up-CHdIiLxL.js";function Q(r){switch(r){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}function Qe(){const{id:r}=ae(),W=re(),[s,g]=l.useState(null),[Y,b]=l.useState(!0),[v,S]=l.useState(null),[D,A]=l.useState(!1),[k,T]=l.useState(!1),[E,$]=l.useState(!1),[u,N]=l.useState(""),[Z,C]=l.useState(!1),[G,y]=l.useState(!1),[j,P]=l.useState("draft"),[K,U]=l.useState(!1),{toast:L}=ne();l.useEffect(()=>{async function t(){if(r)try{b(!0);const o=await(await fetch(`${f}/api/v1/proposals/${r}`)).json();o.success?g(o.data):S(o.error?.message||"Failed to fetch proposal")}catch(a){S(a instanceof Error?a.message:"Unknown error")}finally{b(!1)}}t()},[r]);const X=async()=>{if(r){A(!0);try{const a=await(await fetch(`${f}/api/v1/proposals/${r}`,{method:"DELETE"})).json();a.success?W("/proposals"):alert(a.error?.message||"Failed to delete proposal")}catch(t){alert(`Error deleting proposal: ${t instanceof Error?t.message:"Unknown error"}`)}finally{A(!1)}}},ee=async()=>{if(!(!s||!r||j===s.status)){T(!0);try{const a=await(await fetch(`${f}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:j})})).json();a.success?(g(a.data),C(!1)):alert(a.error?.message||"Failed to update status")}catch(t){alert(`Error updating status: ${t instanceof Error?t.message:"Unknown error"}`)}finally{T(!1)}}},se=async()=>{if(!(!s||!r||!u.trim())){$(!0);try{const t={id:`comment-${Date.now()}`,content:u,author:"current-user",createdAt:new Date().toISOString()},a=[...s.comments||[],t],i=await(await fetch(`${f}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:a})})).json();i.success?(g(i.data),N(""),y(!1)):alert(i.error?.message||"Failed to add comment")}catch(t){alert(`Error adding comment: ${t instanceof Error?t.message:"Unknown error"}`)}finally{$(!1)}}},te=()=>{if(!s)return;const t={...s,exportedAt:new Date().toISOString()},a=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),o=URL.createObjectURL(a),i=document.createElement("a");i.href=o,i.download=`proposal-${s.id}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)};return Y?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(w,{className:"h-4 w-4"})})})})]}),e.jsxs(d,{children:[e.jsx(h,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]})}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-4/6 animate-pulse"})]})})]})]}):v||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:v||"Proposal not found"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(w,{className:"h-4 w-4"})})})})]}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:v||"Proposal not found"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['The proposal with ID "',r,'" could not be found.']}),e.jsx(n,{asChild:!0,className:"mt-4",children:e.jsx(c,{to:"/proposals",children:"Back to Proposals"})})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.title||s.intent}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(c,{to:"/proposals",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(w,{className:"h-4 w-4"})})}),e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(c,{to:`/proposals/${r}/edit`,children:[e.jsx(le,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs(ie,{children:[e.jsx(oe,{asChild:!0,children:e.jsxs(n,{variant:"destructive",size:"sm",disabled:D,children:[e.jsx(ce,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:D?"Deleting...":"Delete"})]})}),e.jsxs(de,{children:[e.jsxs(me,{children:[e.jsx(he,{children:"Are you absolutely sure?"}),e.jsxs(xe,{children:["This action cannot be undone. This will permanently delete the change proposal",e.jsxs("span",{className:"font-semibold",children:[' "',s.title||s.intent,'"']})," and remove it from the system."]})]}),e.jsxs(pe,{children:[e.jsx(ue,{children:"Cancel"}),e.jsx(je,{onClick:X,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Proposal"})]})]})]})]})]}),e.jsxs("button",{type:"button",onClick:async()=>{const t=`.nut/proposals/${s.id}.md`;try{await Ce(t),U(!0),L({title:"Copied!",description:`${t} copied to clipboard`}),setTimeout(()=>U(!1),2e3)}catch(a){console.error("Failed to copy path:",a),L({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono",children:[e.jsx("span",{children:`.nut/proposals/${s.id}.md`}),K?e.jsx(Te,{className:"h-3.5 w-3.5"}):e.jsx(Ee,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(d,{children:[e.jsx(h,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(p,{children:"Task Details"}),e.jsxs("div",{className:"flex gap-2",children:[s.metadata.priority&&e.jsx(x,{variant:Q(s.metadata.priority),children:s.metadata.priority}),e.jsx(x,{variant:M(s.status),children:s.status})]})]})}),e.jsx(m,{className:"space-y-4",children:s.content?e.jsx(O,{children:s.content}):e.jsx("p",{className:"text-muted-foreground",children:"No detailed content available for this proposal."})})]}),s.planSteps&&s.planSteps.length>0&&e.jsxs(d,{children:[e.jsxs(h,{children:[e.jsx(p,{children:"Implementation Steps"}),e.jsxs(_,{children:[s.planSteps.length," step",s.planSteps.length!==1?"s":""," planned"]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-3",children:s.planSteps.map((t,a)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-medium",children:a+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:t.description}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:e.jsx(x,{variant:"outline",className:"text-xs",children:t.status})})]})]},t.id))})})]}),s.comments&&s.comments.length>0&&e.jsxs(d,{children:[e.jsxs(h,{children:[e.jsx(p,{children:"Comments"}),e.jsxs(_,{children:[s.comments.length," comment",s.comments.length!==1?"s":""]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-4",children:s.comments.map((t,a)=>e.jsxs("div",{className:"border-l-2 border-muted pl-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(I,{className:"h-3 w-3"}),e.jsx("span",{children:t.author}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(t.createdAt).toLocaleString()})]}),e.jsx(O,{className:"prose-sm prose-p:mb-2 prose-ul:my-2 prose-ol:my-2",children:t.content})]},t.id||a))})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(d,{children:[e.jsx(h,{children:e.jsx(p,{children:"Task Actions"})}),e.jsxs(m,{className:"space-y-2",children:[e.jsx(n,{variant:"default",className:"w-full justify-start bg-blue-600 hover:bg-blue-700",asChild:!0,children:e.jsxs(c,{to:`/terminal/${r}?reviewOnly=true`,children:[e.jsx($e,{className:"h-4 w-4 mr-2"}),"Review Task"]})}),e.jsx(n,{variant:"default",className:"w-full justify-start",asChild:!0,children:e.jsxs(c,{to:`/terminal/${r}?startOnly=true`,children:[e.jsx(fe,{className:"h-4 w-4 mr-2"}),"Prepare Agent"]})}),e.jsxs(F,{open:Z,onOpenChange:C,children:[e.jsx(R,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",onClick:()=>P(s?.status||"draft"),children:"Change Status"})}),e.jsxs(B,{children:[e.jsxs(H,{children:[e.jsx(V,{children:"Change Task Status"}),e.jsx(z,{children:"Update the status of this task."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(q,{htmlFor:"status",children:"Status"}),e.jsxs(ye,{value:j,onValueChange:t=>P(t),children:[e.jsx(we,{children:e.jsx(be,{placeholder:"Select status"})}),e.jsx(Se,{children:Ae.map(t=>e.jsx(De,{value:t,children:ke(t)},t))})]})]})}),e.jsxs(J,{children:[e.jsx(n,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),e.jsx(n,{onClick:ee,disabled:k||j===s?.status,children:k?"Updating...":"Update Status"})]})]})]}),e.jsxs(F,{open:G,onOpenChange:y,children:[e.jsx(R,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",children:"Add Comment"})}),e.jsxs(B,{children:[e.jsxs(H,{children:[e.jsx(V,{children:"Add Comment"}),e.jsx(z,{children:"Add a comment to this change proposal."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(q,{htmlFor:"comment",children:"Comment"}),e.jsx(ge,{id:"comment",placeholder:"Enter your comment...",value:u,onChange:t=>N(t.target.value),rows:4})]})}),e.jsxs(J,{children:[e.jsx(n,{variant:"outline",onClick:()=>{y(!1),N("")},children:"Cancel"}),e.jsx(n,{onClick:se,disabled:E||!u.trim(),children:E?"Adding...":"Add Comment"})]})]})]}),e.jsxs(n,{variant:"outline",className:"w-full justify-start",onClick:te,children:[e.jsx(Pe,{className:"h-4 w-4 mr-2"}),"Export"]})]})]}),e.jsxs(d,{children:[e.jsx(h,{children:e.jsx(p,{children:"Information"})}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(I,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Author:"}),e.jsx("span",{children:s.author.name})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ve,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Created:"}),e.jsx("span",{children:new Date(s.metadata.createdAt).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ue,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Updated:"}),e.jsx("span",{children:new Date(s.metadata.updatedAt).toLocaleString()})]}),e.jsx(Ne,{}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Status:"}),e.jsx("div",{className:"mt-1",children:e.jsx(x,{variant:M(s.status),children:s.status})})]}),s.metadata.priority&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Priority:"}),e.jsx("div",{className:"mt-1",children:e.jsx(x,{variant:Q(s.metadata.priority),children:s.metadata.priority})})]}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:s.metadata.tags.map(t=>e.jsx(x,{variant:"outline",className:"text-xs",children:t},t))})]})]})]})]})]})]})}export{Qe as default};
@@ -0,0 +1 @@
1
+ import{E as R,u as U,a as H,r as o,A as P,j as e,B as m,L as x,I as O,X as V,a3 as _}from"./index-9Tv-j_Ga.js";import{L as j}from"./label-TGqbNfMO.js";import{S as k,a as L,b as D,c as F,d as r}from"./select-Cs5qtMYV.js";import{C as f,b as I,a as v,c as q,d as J}from"./card-SN5gKnu7.js";import{M as K}from"./markdown-editor-ls1JPK_e.js";import{C as W}from"./CollapsibleSection-Bt_ZLnJc.js";import{I as X,L as G}from"./ImplementationStepsEditor-Ctx0CvbU.js";import{T as Q}from"./TagInput-BK91_M1N.js";import{A as N}from"./arrow-left-WGBYWq3h.js";import"./chevron-up-CHdIiLxL.js";import"./badge-AwLOflf5.js";function ce(){const{id:i}=R(),$=U(),{toast:y}=H(),[z,S]=o.useState(!0),[h,C]=o.useState(!1),[w,b]=o.useState(null),[l,d]=o.useState({title:"",description:"",priority:"medium",status:"draft",author:{id:"current-user",name:"Current User",email:"user@example.com"}}),[p,E]=o.useState([]),[T,A]=o.useState([]);o.useEffect(()=>{i&&B()},[i]);const B=async()=>{try{S(!0);const t=await fetch(`${P}/api/v1/proposals/${i}`),s=await t.json();if(s.success||s.data||t.ok){const a=s.data||s;d({title:a.title||a.intent||"",description:a.content||"",priority:a.metadata?.priority||"medium",status:a.status||"draft",author:{id:a.author?.id||"current-user",name:a.author?.name||"Current User",email:a.author?.email||"user@example.com"}});const g=Array.isArray(a.planSteps)?a.planSteps:[];E(g.map((c,u)=>({id:c.id||`step-${u+1}`,description:c.description||"",status:c.status||"pending"}))),A(a.metadata?.tags||[])}else b(s.error?.message||"Failed to fetch proposal")}catch(t){b(t instanceof Error?t.message:"An error occurred")}finally{S(!1)}},M=async t=>{t.preventDefault(),C(!0);try{const s=p.map(n=>({id:n.id,description:n.description.trim(),status:n.status})).filter(n=>n.description.length>0),a=T.map(n=>n.trim()).filter(n=>n.length>0),g={title:l.title,status:l.status,planSteps:s,metadata:{priority:l.priority,tags:a},content:l.description},c=await fetch(`${P}/api/v1/proposals/${i}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),u=await c.json();if(u.success||c.ok)y({title:"Success",description:"Proposal updated successfully."}),$(`/proposals/${i}`);else throw new Error(u.error?.message||"Failed to update proposal")}catch(s){y({title:"Error",description:`Failed to update proposal: ${s instanceof Error?s.message:"An error occurred"}`,variant:"destructive"})}finally{C(!1)}};return z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Proposal"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading proposal data..."})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(x,{to:`/proposals/${i}`,className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsxs(f,{children:[e.jsx(I,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-1/2 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-3/4 animate-pulse"})]})}),e.jsx(v,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-64 bg-muted rounded animate-pulse"})]})})]})]}):w?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(x,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx(f,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:w})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Proposal"}),e.jsxs("p",{className:"text-muted-foreground",children:["Editing ",i]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(x,{to:`/proposals/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx("form",{onSubmit:M,children:e.jsxs(f,{children:[e.jsxs(I,{children:[e.jsx(q,{children:"Task Details"}),e.jsx(J,{children:"Update the information for your change proposal"})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"title",children:"Title *"}),e.jsx(O,{id:"title",placeholder:"Brief description of what you want to change",value:l.title,onChange:t=>d(s=>({...s,title:t.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"description",children:"Description"}),e.jsx(K,{value:l.description,onChange:t=>d(s=>({...s,description:t||""})),placeholder:"Write your proposal description in markdown...",height:400})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"status",children:"Status"}),e.jsxs(k,{value:l.status,onValueChange:t=>d(s=>({...s,status:t})),children:[e.jsx(L,{children:e.jsx(D,{placeholder:"Select status"})}),e.jsxs(F,{children:[e.jsx(r,{value:"draft",children:"Draft"}),e.jsx(r,{value:"proposed",children:"Proposed"}),e.jsx(r,{value:"in-review",children:"In Review"}),e.jsx(r,{value:"approved",children:"Approved"}),e.jsx(r,{value:"code-complete",children:"Code Complete"}),e.jsx(r,{value:"rejected",children:"Rejected"}),e.jsx(r,{value:"merged",children:"Merged"})]})]})]}),e.jsx(W,{defaultOpen:!0,icon:e.jsx(G,{className:"h-4 w-4"}),title:"Optional Implementation Detail",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"priority",children:"Priority"}),e.jsxs(k,{value:l.priority,onValueChange:t=>d(s=>({...s,priority:t})),children:[e.jsx(L,{children:e.jsx(D,{placeholder:"Select priority"})}),e.jsxs(F,{children:[e.jsx(r,{value:"low",children:"Low"}),e.jsx(r,{value:"medium",children:"Medium"}),e.jsx(r,{value:"high",children:"High"}),e.jsx(r,{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Implementation Steps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keep the implementation plan accurate as work progresses."})]}),p.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[p.length," step",p.length===1?"":"s"]})]}),e.jsx(X,{steps:p,onChange:E,disabled:h})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Tags"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tags power filtering and discovery across the proposal list."}),e.jsx(Q,{tags:T,onChange:A,disabled:h,placeholder:"Add a tag (e.g. backend, rollout)"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(m,{type:"button",variant:"outline",asChild:!0,children:e.jsxs(x,{to:`/proposals/${i}`,children:[e.jsx(V,{className:"mr-2 h-4 w-4"}),"Cancel"]})}),e.jsx(m,{type:"submit",disabled:h||!l.title,children:h?e.jsx(e.Fragment,{children:"Saving..."}):e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Save Changes"]})})]})]})]})})]})}export{ce as ProposalEditPage};
@@ -1,4 +1,4 @@
1
- import{c as xe,N as Ie,u as Le,z as Te,r as j,j as s,B as z,L as Y,I as Re,X,K as Oe,x as $e,O as Pe,v as Ke,h as ie,i as ae,k as ce,l as ue,m as B,G as Ve,A as ze}from"./index-hqVgTgRB.js";import{C as J,b as We,a as Z,c as Ue}from"./card-BCFxXzRk.js";import{B as q}from"./badge-DEiQk9C9.js";import{A as Ge,a as Ae,C as He,g as Qe}from"./status-utils-BDOyevaX.js";import{P as ee}from"./plus-iamYJu5V.js";import{S as Ye}from"./search-CH2zaibZ.js";/**
1
+ import{c as xe,z as Ie,u as Le,v as Te,r as j,j as s,B as z,L as Y,P as Z,I as Re,X,K as Oe,s as $e,p as Pe,G as Ke,A as Ve}from"./index-9Tv-j_Ga.js";import{C as J,b as ze,a as q,c as We}from"./card-SN5gKnu7.js";import{B as ee}from"./badge-AwLOflf5.js";import{S as ie,a as ae,b as ce,c as ue,d as B}from"./select-Cs5qtMYV.js";import{A as Ue,a as Ae,C as Ge,g as He}from"./status-utils-BDOyevaX.js";import{S as Qe}from"./search-Dr90tbch.js";import{C as Ye}from"./chevron-up-CHdIiLxL.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -13,5 +13,5 @@ import{c as xe,N as Ie,u as Le,z as Te,r as j,j as s,B as z,L as Y,I as Re,X,K a
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const et=[["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"}]],je=xe("funnel",et);function R(t){return Array.isArray?Array.isArray(t):ve(t)==="[object Array]"}function tt(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function st(t){return t==null?"":tt(t)}function T(t){return typeof t=="string"}function be(t){return typeof t=="number"}function rt(t){return t===!0||t===!1||nt(t)&&ve(t)=="[object Boolean]"}function Fe(t){return typeof t=="object"}function nt(t){return Fe(t)&&t!==null}function D(t){return t!=null}function le(t){return!t.trim().length}function ve(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const it="Incorrect 'index' type",at=t=>`Invalid value for key ${t}`,ct=t=>`Pattern length exceeds max of ${t}.`,ut=t=>`Missing ${t} property in key`,lt=t=>`Property 'weight' in key '${t}' must be a positive integer`,ye=Object.prototype.hasOwnProperty;class ot{constructor(e){this._keys=[],this._keyMap={};let r=0;e.forEach(n=>{let i=Me(n);this._keys.push(i),this._keyMap[i.id]=i,r+=i.weight}),this._keys.forEach(n=>{n.weight/=r})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Me(t){let e=null,r=null,n=null,i=1,a=null;if(T(t)||R(t))n=t,e=Ce(t),r=oe(t);else{if(!ye.call(t,"name"))throw new Error(ut("name"));const c=t.name;if(n=c,ye.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(lt(c));e=Ce(c),r=oe(c),a=t.getFn}return{path:e,id:r,weight:i,src:n,getFn:a}}function Ce(t){return R(t)?t:t.split(".")}function oe(t){return R(t)?t.join("."):t}function ht(t,e){let r=[],n=!1;const i=(a,c,l)=>{if(D(a))if(!c[l])r.push(a);else{let o=c[l];const h=a[o];if(!D(h))return;if(l===c.length-1&&(T(h)||be(h)||rt(h)))r.push(st(h));else if(R(h)){n=!0;for(let d=0,m=h.length;d<m;d+=1)i(h[d],c,l+1)}else c.length&&i(h,c,l+1)}};return i(t,T(e)?e.split("."):e,0),n?r:r[0]}const dt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},ft={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},mt={location:0,threshold:.6,distance:100},gt={useExtendedSearch:!1,getFn:ht,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var f={...ft,...dt,...mt,...gt};const xt=/[^ ]+/g;function pt(t=1,e=3){const r=new Map,n=Math.pow(10,e);return{get(i){const a=i.match(xt).length;if(r.has(a))return r.get(a);const c=1/Math.pow(a,.5*t),l=parseFloat(Math.round(c*n)/n);return r.set(a,l),l},clear(){r.clear()}}}class pe{constructor({getFn:e=f.getFn,fieldNormWeight:r=f.fieldNormWeight}={}){this.norm=pt(r,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,T(this.docs[0])?this.docs.forEach((e,r)=>{this._addString(e,r)}):this.docs.forEach((e,r)=>{this._addObject(e,r)}),this.norm.clear())}add(e){const r=this.size();T(e)?this._addString(e,r):this._addObject(e,r)}removeAt(e){this.records.splice(e,1);for(let r=e,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(e,r){return e[this._keysMap[r]]}size(){return this.records.length}_addString(e,r){if(!D(e)||le(e))return;let n={v:e,i:r,n:this.norm.get(e)};this.records.push(n)}_addObject(e,r){let n={i:r,$:{}};this.keys.forEach((i,a)=>{let c=i.getFn?i.getFn(e):this.getFn(e,i.path);if(D(c)){if(R(c)){let l=[];const o=[{nestedArrIndex:-1,value:c}];for(;o.length;){const{nestedArrIndex:h,value:d}=o.pop();if(D(d))if(T(d)&&!le(d)){let m={v:d,i:h,n:this.norm.get(d)};l.push(m)}else R(d)&&d.forEach((m,x)=>{o.push({nestedArrIndex:x,value:m})})}n.$[a]=l}else if(T(c)&&!le(c)){let l={v:c,n:this.norm.get(c)};n.$[a]=l}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Se(t,e,{getFn:r=f.getFn,fieldNormWeight:n=f.fieldNormWeight}={}){const i=new pe({getFn:r,fieldNormWeight:n});return i.setKeys(t.map(Me)),i.setSources(e),i.create(),i}function At(t,{getFn:e=f.getFn,fieldNormWeight:r=f.fieldNormWeight}={}){const{keys:n,records:i}=t,a=new pe({getFn:e,fieldNormWeight:r});return a.setKeys(n),a.setIndexRecords(i),a}function te(t,{errors:e=0,currentLocation:r=0,expectedLocation:n=0,distance:i=f.distance,ignoreLocation:a=f.ignoreLocation}={}){const c=e/t.length;if(a)return c;const l=Math.abs(n-r);return i?c+l/i:l?1:c}function jt(t=[],e=f.minMatchCharLength){let r=[],n=-1,i=-1,a=0;for(let c=t.length;a<c;a+=1){let l=t[a];l&&n===-1?n=a:!l&&n!==-1&&(i=a-1,i-n+1>=e&&r.push([n,i]),n=-1)}return t[a-1]&&a-n>=e&&r.push([n,a-1]),r}const W=32;function yt(t,e,r,{location:n=f.location,distance:i=f.distance,threshold:a=f.threshold,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,includeMatches:o=f.includeMatches,ignoreLocation:h=f.ignoreLocation}={}){if(e.length>W)throw new Error(ct(W));const d=e.length,m=t.length,x=Math.max(0,Math.min(n,m));let g=a,A=x;const C=l>1||o,v=C?Array(m):[];let E;for(;(E=t.indexOf(e,A))>-1;){let F=te(e,{currentLocation:E,expectedLocation:x,distance:i,ignoreLocation:h});if(g=Math.min(F,g),A=E+d,C){let k=0;for(;k<d;)v[E+k]=1,k+=1}}A=-1;let _=[],b=1,L=d+m;const G=1<<d-1;for(let F=0;F<d;F+=1){let k=0,y=L;for(;k<y;)te(e,{errors:F,currentLocation:x+y,expectedLocation:x,distance:i,ignoreLocation:h})<=g?k=y:L=y,y=Math.floor((L-k)/2+k);L=y;let V=Math.max(1,x-y+1),O=c?m:Math.min(x+y,m)+d,I=Array(O+2);I[O+1]=(1<<F)-1;for(let M=O;M>=V;M-=1){let $=M-1,Q=r[t.charAt($)];if(C&&(v[$]=+!!Q),I[M]=(I[M+1]<<1|1)&Q,F&&(I[M]|=(_[M+1]|_[M])<<1|1|_[M+1]),I[M]&G&&(b=te(e,{errors:F,currentLocation:$,expectedLocation:x,distance:i,ignoreLocation:h}),b<=g)){if(g=b,A=$,A<=x)break;V=Math.max(1,2*x-A)}}if(te(e,{errors:F+1,currentLocation:x,expectedLocation:x,distance:i,ignoreLocation:h})>g)break;_=I}const H={isMatch:A>=0,score:Math.max(.001,b)};if(C){const F=jt(v,l);F.length?o&&(H.indices=F):H.isMatch=!1}return H}function Ct(t){let e={};for(let r=0,n=t.length;r<n;r+=1){const i=t.charAt(r);e[i]=(e[i]||0)|1<<n-r-1}return e}const se=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 Be{constructor(e,{location:r=f.location,threshold:n=f.threshold,distance:i=f.distance,includeMatches:a=f.includeMatches,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,isCaseSensitive:o=f.isCaseSensitive,ignoreDiacritics:h=f.ignoreDiacritics,ignoreLocation:d=f.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:c,minMatchCharLength:l,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d},e=o?e:e.toLowerCase(),e=h?se(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const m=(g,A)=>{this.chunks.push({pattern:g,alphabet:Ct(g),startIndex:A})},x=this.pattern.length;if(x>W){let g=0;const A=x%W,C=x-A;for(;g<C;)m(this.pattern.substr(g,W),g),g+=W;if(A){const v=x-W;m(this.pattern.substr(v),v)}}else m(this.pattern,0)}searchIn(e){const{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i}=this.options;if(e=r?e:e.toLowerCase(),e=n?se(e):e,this.pattern===e){let C={isMatch:!0,score:0};return i&&(C.indices=[[0,e.length-1]]),C}const{location:a,distance:c,threshold:l,findAllMatches:o,minMatchCharLength:h,ignoreLocation:d}=this.options;let m=[],x=0,g=!1;this.chunks.forEach(({pattern:C,alphabet:v,startIndex:E})=>{const{isMatch:_,score:b,indices:L}=yt(e,C,v,{location:a+E,distance:c,threshold:l,findAllMatches:o,minMatchCharLength:h,includeMatches:i,ignoreLocation:d});_&&(g=!0),x+=b,_&&L&&(m=[...m,...L])});let A={isMatch:g,score:g?x/this.chunks.length:1};return g&&i&&(A.indices=m),A}}class K{constructor(e){this.pattern=e}static isMultiMatch(e){return we(e,this.multiRegex)}static isSingleMatch(e){return we(e,this.singleRegex)}search(){}}function we(t,e){const r=t.match(e);return r?r[1]:null}class wt extends K{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const r=e===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class Nt extends K{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Et extends K{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const r=e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class bt extends K{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const r=!e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class Ft extends K{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const r=e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class vt extends K{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const r=!e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class De extends K{constructor(e,{location:r=f.location,threshold:n=f.threshold,distance:i=f.distance,includeMatches:a=f.includeMatches,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,isCaseSensitive:o=f.isCaseSensitive,ignoreDiacritics:h=f.ignoreDiacritics,ignoreLocation:d=f.ignoreLocation}={}){super(e),this._bitapSearch=new Be(e,{location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:c,minMatchCharLength:l,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class ke extends K{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let r=0,n;const i=[],a=this.pattern.length;for(;(n=e.indexOf(this.pattern,r))>-1;)r=n+a,i.push([n,r-1]);const c=!!i.length;return{isMatch:c,score:c?0:1,indices:i}}}const he=[wt,ke,Et,bt,vt,Ft,Nt,De],Ne=he.length,Mt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,St="|";function Bt(t,e={}){return t.split(St).map(r=>{let n=r.trim().split(Mt).filter(a=>a&&!!a.trim()),i=[];for(let a=0,c=n.length;a<c;a+=1){const l=n[a];let o=!1,h=-1;for(;!o&&++h<Ne;){const d=he[h];let m=d.isMultiMatch(l);m&&(i.push(new d(m,e)),o=!0)}if(!o)for(h=-1;++h<Ne;){const d=he[h];let m=d.isSingleMatch(l);if(m){i.push(new d(m,e));break}}}return i})}const Dt=new Set([De.type,ke.type]);class kt{constructor(e,{isCaseSensitive:r=f.isCaseSensitive,ignoreDiacritics:n=f.ignoreDiacritics,includeMatches:i=f.includeMatches,minMatchCharLength:a=f.minMatchCharLength,ignoreLocation:c=f.ignoreLocation,findAllMatches:l=f.findAllMatches,location:o=f.location,threshold:h=f.threshold,distance:d=f.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:a,findAllMatches:l,ignoreLocation:c,location:o,threshold:h,distance:d},e=r?e:e.toLowerCase(),e=n?se(e):e,this.pattern=e,this.query=Bt(this.pattern,this.options)}static condition(e,r){return r.useExtendedSearch}searchIn(e){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:a}=this.options;e=i?e:e.toLowerCase(),e=a?se(e):e;let c=0,l=[],o=0;for(let h=0,d=r.length;h<d;h+=1){const m=r[h];l.length=0,c=0;for(let x=0,g=m.length;x<g;x+=1){const A=m[x],{isMatch:C,indices:v,score:E}=A.search(e);if(C){if(c+=1,o+=E,n){const _=A.constructor.type;Dt.has(_)?l=[...l,...v]:l.push(v)}}else{o=0,c=0,l.length=0;break}}if(c){let x={isMatch:!0,score:o/c};return n&&(x.indices=l),x}}return{isMatch:!1,score:1}}}const de=[];function _t(...t){de.push(...t)}function fe(t,e){for(let r=0,n=de.length;r<n;r+=1){let i=de[r];if(i.condition(t,e))return new i(t,e)}return new Be(t,e)}const re={AND:"$and",OR:"$or"},me={PATH:"$path",PATTERN:"$val"},ge=t=>!!(t[re.AND]||t[re.OR]),It=t=>!!t[me.PATH],Lt=t=>!R(t)&&Fe(t)&&!ge(t),Ee=t=>({[re.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function _e(t,e,{auto:r=!0}={}){const n=i=>{let a=Object.keys(i);const c=It(i);if(!c&&a.length>1&&!ge(i))return n(Ee(i));if(Lt(i)){const o=c?i[me.PATH]:a[0],h=c?i[me.PATTERN]:i[o];if(!T(h))throw new Error(at(o));const d={keyId:oe(o),pattern:h};return r&&(d.searcher=fe(h,e)),d}let l={children:[],operator:a[0]};return a.forEach(o=>{const h=i[o];R(h)&&h.forEach(d=>{l.children.push(n(d))})}),l};return ge(t)||(t=Ee(t)),n(t)}function Tt(t,{ignoreFieldNorm:e=f.ignoreFieldNorm}){t.forEach(r=>{let n=1;r.matches.forEach(({key:i,norm:a,score:c})=>{const l=i?i.weight:null;n*=Math.pow(c===0&&l?Number.EPSILON:c,(l||1)*(e?1:a))}),r.score=n})}function Rt(t,e){const r=t.matches;e.matches=[],D(r)&&r.forEach(n=>{if(!D(n.indices)||!n.indices.length)return;const{indices:i,value:a}=n;let c={indices:i,value:a};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function Ot(t,e){e.score=t.score}function $t(t,e,{includeMatches:r=f.includeMatches,includeScore:n=f.includeScore}={}){const i=[];return r&&i.push(Rt),n&&i.push(Ot),t.map(a=>{const{idx:c}=a,l={item:e[c],refIndex:c};return i.length&&i.forEach(o=>{o(a,l)}),l})}class U{constructor(e,r={},n){this.options={...f,...r},this.options.useExtendedSearch,this._keyStore=new ot(this.options.keys),this.setCollection(e,n)}setCollection(e,r){if(this._docs=e,r&&!(r instanceof pe))throw new Error(it);this._myIndex=r||Se(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){D(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const r=[];for(let n=0,i=this._docs.length;n<i;n+=1){const a=this._docs[n];e(a,n)&&(this.removeAt(n),n-=1,i-=1,r.push(a))}return r}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:r=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:a,sortFn:c,ignoreFieldNorm:l}=this.options;let o=T(e)?T(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return Tt(o,{ignoreFieldNorm:l}),a&&o.sort(c),be(r)&&r>-1&&(o=o.slice(0,r)),$t(o,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){const r=fe(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:a,i:c,n:l})=>{if(!D(a))return;const{isMatch:o,score:h,indices:d}=r.searchIn(a);o&&i.push({item:a,idx:c,matches:[{score:h,value:a,norm:l,indices:d}]})}),i}_searchLogical(e){const r=_e(e,this.options),n=(l,o,h)=>{if(!l.children){const{keyId:m,searcher:x}=l,g=this._findMatches({key:this._keyStore.get(m),value:this._myIndex.getValueForItemAtKeyId(o,m),searcher:x});return g&&g.length?[{idx:h,item:o,matches:g}]:[]}const d=[];for(let m=0,x=l.children.length;m<x;m+=1){const g=l.children[m],A=n(g,o,h);if(A.length)d.push(...A);else if(l.operator===re.AND)return[]}return d},i=this._myIndex.records,a={},c=[];return i.forEach(({$:l,i:o})=>{if(D(l)){let h=n(r,l,o);h.length&&(a[o]||(a[o]={idx:o,item:l,matches:[]},c.push(a[o])),h.forEach(({matches:d})=>{a[o].matches.push(...d)}))}}),c}_searchObjectList(e){const r=fe(e,this.options),{keys:n,records:i}=this._myIndex,a=[];return i.forEach(({$:c,i:l})=>{if(!D(c))return;let o=[];n.forEach((h,d)=>{o.push(...this._findMatches({key:h,value:c[d],searcher:r}))}),o.length&&a.push({idx:l,item:c,matches:o})}),a}_findMatches({key:e,value:r,searcher:n}){if(!D(r))return[];let i=[];if(R(r))r.forEach(({v:a,i:c,n:l})=>{if(!D(a))return;const{isMatch:o,score:h,indices:d}=n.searchIn(a);o&&i.push({score:h,key:e,value:a,idx:c,norm:l,indices:d})});else{const{v:a,n:c}=r,{isMatch:l,score:o,indices:h}=n.searchIn(a);l&&i.push({score:o,key:e,value:a,norm:c,indices:h})}return i}}U.version="7.1.0";U.createIndex=Se;U.parseIndex=At;U.config=f;U.parseQuery=_e;_t(kt);function Pt(t){switch(t){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}function Ht(){const[t]=Ie(),e=Le(),r=Te(),[n,i]=j.useState([]),[a,c]=j.useState([]),[l,o]=j.useState(!0),[h,d]=j.useState(null),[m,x]=j.useState(t.get("status")||"_default"),[g,A]=j.useState(t.get("priority")||"all"),[C,v]=j.useState(t.get("search")||""),[E,_]=j.useState(t.get("sortBy")||"created"),[b,L]=j.useState(t.get("order")||"desc"),[G,H]=j.useState(!1),F=j.useRef(null),k=[m!=="_default",g!=="all",E!=="created",b!=="desc"].filter(Boolean).length,y=j.useCallback(u=>{const p=new URLSearchParams(t);Object.entries(u).forEach(([S,P])=>{P&&P!=="all"&&P!=="_default"&&P!==""?p.set(S,P):p.delete(S)});const w=p.toString(),N=w?`?${w}`:"";e(`${r.pathname}${N}`)},[t,e,r.pathname]),V=j.useCallback(u=>{x(u),y({status:u==="_default"?null:u})},[y]),O=j.useCallback(u=>{A(u),y({priority:u==="all"?null:u})},[y]),I=j.useCallback(u=>{v(u),y({search:u||null})},[y]),ne=j.useCallback(u=>{_(u),y({sortBy:u==="created"?null:u})},[y]),M=j.useCallback(()=>{const u=b==="asc"?"desc":"asc";L(u),y({order:u==="desc"?null:u})},[b,y]),$=j.useCallback(u=>{if(u.key==="s"||u.key==="S"){const p=document.activeElement;p?.tagName==="INPUT"||p?.tagName==="TEXTAREA"||p?.getAttribute("contenteditable")==="true"||(u.preventDefault(),F.current?.focus())}},[]);j.useEffect(()=>(document.addEventListener("keydown",$),()=>{document.removeEventListener("keydown",$)}),[$]);const Q=j.useMemo(()=>{const u={keys:[{name:"title",weight:.4},{name:"intent",weight:.3},{name:"id",weight:.2},{name:"author.name",weight:.05},{name:"metadata.tags",weight:.05}],threshold:.3,includeScore:!0};return new U(n,u)},[n]);return j.useEffect(()=>{async function u(){try{o(!0);const w=await(await fetch(`${ze}/api/v1/proposals`)).json();w.success?(i(w.data),c(w.data)):d(w.error?.message||"Failed to fetch proposals")}catch(p){d(p instanceof Error?p.message:"Unknown error")}finally{o(!1)}}u()},[]),j.useEffect(()=>{let u=n;if(m==="_default"?u=u.filter(p=>Ge.includes(p.status)):m!=="all"&&(u=u.filter(p=>p.status===m)),g!=="all"&&(u=u.filter(p=>p.metadata.priority===g)),C.trim()){const p=Q.search(C),w=new Set(p.map(N=>N.item.id));u=u.filter(N=>w.has(N.id))}u=u.sort((p,w)=>{let N,S;switch(E){case"created":{N=new Date(p.metadata.createdAt).getTime(),S=new Date(w.metadata.createdAt).getTime();break}case"updated":{N=new Date(p.metadata.updatedAt).getTime(),S=new Date(w.metadata.updatedAt).getTime();break}case"status":{N=p.status,S=w.status;break}case"priority":{const P={critical:4,high:3,medium:2,low:1};N=P[p.metadata.priority]||0,S=P[w.metadata.priority]||0;break}case"intent":{N=(p.title||p.intent||"").toLowerCase(),S=(w.title||w.intent||"").toLowerCase();break}default:N=new Date(p.metadata.createdAt).getTime(),S=new Date(w.metadata.createdAt).getTime()}return b==="asc"?N<S?-1:N>S?1:0:N>S?-1:N<S?1:0}),c(u)},[n,m,g,C,E,b,Q]),l?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your project"})]}),s.jsx(z,{asChild:!0,children:s.jsxs(Y,{to:"/proposals/new",children:[s.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),s.jsx("div",{className:"space-y-4",children:[...Array(3)].map((u,p)=>s.jsx(J,{children:s.jsx(We,{children:s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-6 bg-muted rounded w-3/4 animate-pulse"}),s.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]}),s.jsx("div",{className:"h-6 bg-muted rounded w-20 animate-pulse"})]})})},p))})]}):h?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your project"})]}),s.jsx(z,{asChild:!0,children:s.jsxs(Y,{to:"/proposals/new",children:[s.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),s.jsx(J,{children:s.jsx(Z,{className:"pt-6",children:s.jsx("div",{className:"text-center",children:s.jsxs("p",{className:"text-destructive",children:["Error: ",h]})})})})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your project"})]}),s.jsx(z,{asChild:!0,children:s.jsxs(Y,{to:"/proposals/new",children:[s.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Ye,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),s.jsx(Re,{ref:F,placeholder:"Search tasks...",value:C,onChange:u=>I(u.target.value),className:"pl-9 pr-20 h-11 bg-muted/40 border-muted-foreground/20 focus:bg-background transition-colors"}),s.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:C?s.jsx("button",{onClick:()=>I(""),className:"h-5 w-5 rounded-full bg-muted-foreground/20 hover:bg-muted-foreground/30 flex items-center justify-center transition-colors",children:s.jsx(X,{className:"h-3 w-3"})}):s.jsx(Oe,{children:s.jsx($e,{children:"S"})})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>H(!G),className:"flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg border border-muted-foreground/20 hover:bg-muted/50 transition-colors",children:[s.jsx(je,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Filters & Sort"}),s.jsx("span",{className:"sm:hidden",children:"Filters"}),k>0&&s.jsx("span",{className:"flex items-center justify-center h-5 w-5 text-xs font-bold rounded-full bg-primary text-primary-foreground",children:k}),G?s.jsx(Pe,{className:"h-4 w-4 ml-1"}):s.jsx(Ke,{className:"h-4 w-4 ml-1"})]}),s.jsxs("div",{className:"flex-1 flex items-center gap-2 overflow-x-auto scrollbar-hide",children:[m!=="_default"&&s.jsxs("button",{onClick:()=>V("_default"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-blue-500/15 text-blue-600 dark:text-blue-400 hover:bg-blue-500/25 transition-colors whitespace-nowrap",children:[m==="all"?"All statuses":Ae(m),s.jsx(X,{className:"h-3 w-3"})]}),g!=="all"&&s.jsxs("button",{onClick:()=>O("all"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 transition-colors whitespace-nowrap",children:[g," priority",s.jsx(X,{className:"h-3 w-3"})]}),(E!=="created"||b!=="desc")&&s.jsxs("button",{onClick:()=>{ne("created"),L("desc"),y({sortBy:null,order:null})},className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-purple-500/15 text-purple-600 dark:text-purple-400 hover:bg-purple-500/25 transition-colors whitespace-nowrap",children:[E," ",b==="asc"?"↑":"↓",s.jsx(X,{className:"h-3 w-3"})]})]}),s.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[a.length," result",a.length!==1?"s":""]})]}),G&&s.jsxs("div",{className:"p-4 rounded-lg border border-muted-foreground/20 bg-muted/30 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Status"}),s.jsxs(ie,{value:m,onValueChange:V,children:[s.jsx(ae,{className:"w-full bg-background",children:s.jsx(ce,{placeholder:"Filter by status"})}),s.jsxs(ue,{children:[s.jsx(B,{value:"_default",children:"Active (Default)"}),s.jsx(B,{value:"all",children:"All statuses"}),He.map(u=>s.jsx(B,{value:u,children:Ae(u)},u))]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Priority"}),s.jsxs(ie,{value:g,onValueChange:O,children:[s.jsx(ae,{className:"w-full bg-background",children:s.jsx(ce,{placeholder:"Filter by priority"})}),s.jsxs(ue,{children:[s.jsx(B,{value:"all",children:"All priorities"}),s.jsx(B,{value:"low",children:"Low"}),s.jsx(B,{value:"medium",children:"Medium"}),s.jsx(B,{value:"high",children:"High"}),s.jsx(B,{value:"critical",children:"Critical"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Sort By"}),s.jsxs(ie,{value:E,onValueChange:u=>ne(u),children:[s.jsx(ae,{className:"w-full bg-background",children:s.jsx(ce,{})}),s.jsxs(ue,{children:[s.jsx(B,{value:"created",children:"Created Date"}),s.jsx(B,{value:"updated",children:"Updated Date"}),s.jsx(B,{value:"status",children:"Status"}),s.jsx(B,{value:"priority",children:"Priority"}),s.jsx(B,{value:"intent",children:"Title"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Order"}),s.jsx(z,{variant:"outline",onClick:M,className:"w-full justify-between bg-background",children:b==="asc"?s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Ascending"}),s.jsx(qe,{className:"h-4 w-4"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Descending"}),s.jsx(Je,{className:"h-4 w-4"})]})})]})]}),k>0&&s.jsx("div",{className:"pt-2 border-t border-muted-foreground/10",children:s.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>{V("_default"),O("all"),I("")},className:"text-muted-foreground hover:text-foreground",children:[s.jsx(X,{className:"h-3 w-3 mr-1"}),"Reset all filters"]})})]})]}),a.length===0&&n.length>0?s.jsx(J,{children:s.jsx(Z,{className:"pt-6",children:s.jsxs("div",{className:"text-center py-6",children:[s.jsx(je,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),s.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No proposals match your filters"}),s.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Try adjusting your status or priority filters."}),s.jsx(z,{variant:"outline",className:"mt-4",onClick:()=>{V("_default"),O("all"),I("")},children:"Clear Filters"})]})})}):n.length===0?s.jsx(J,{children:s.jsx(Z,{className:"pt-6",children:s.jsxs("div",{className:"text-center py-6",children:[s.jsx(Ve,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),s.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No proposals yet"}),s.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first change proposal to get started."}),s.jsx(z,{asChild:!0,className:"mt-4",children:s.jsxs(Y,{to:"/proposals/new",children:[s.jsx(ee,{className:"mr-2 h-4 w-4"}),"New Task"]})})]})})}):s.jsx("div",{className:"space-y-4",children:a.map(u=>s.jsx(Y,{to:`/proposals/${u.id}`,className:"block",children:s.jsx(J,{className:"hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:s.jsx(Z,{className:"py-4",children:s.jsx("div",{className:"flex justify-between items-start gap-4",children:s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsx(Ue,{className:"text-base leading-tight",children:u.title||u.intent}),s.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[u.metadata.priority&&s.jsx(q,{variant:Pt(u.metadata.priority),className:"text-xs",children:u.metadata.priority}),s.jsx(q,{variant:Qe(u.status),className:"text-xs",children:u.status})]})]}),u.content&&s.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[u.content.split(`
17
- `).slice(0,2).join(" ").substring(0,150),u.content.length>150?"...":""]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{className:"text-xs text-muted-foreground",children:[u.id," • by ",u.author.name," • ",new Date(u.metadata.createdAt).toLocaleDateString()]}),s.jsxs("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[u.planSteps.length>0&&s.jsxs("span",{children:[u.planSteps.length," step",u.planSteps.length!==1?"s":""]}),u.evidence.length>0&&s.jsxs("span",{children:[u.evidence.length," evidence"]}),u.metadata.tags&&u.metadata.tags.length>0&&s.jsxs("span",{children:[u.metadata.tags.length," tag",u.metadata.tags.length!==1?"s":""]})]})]}),u.metadata.tags&&u.metadata.tags.length>0&&s.jsxs("div",{className:"flex gap-1 mt-2",children:[u.metadata.tags.slice(0,3).map(p=>s.jsx(q,{variant:"outline",className:"text-xs",children:p},p)),u.metadata.tags.length>3&&s.jsxs(q,{variant:"outline",className:"text-xs",children:["+",u.metadata.tags.length-3]})]})]})})})})},u.id))})]})}export{Ht as default};
16
+ */const et=[["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"}]],je=xe("funnel",et);function R(t){return Array.isArray?Array.isArray(t):ve(t)==="[object Array]"}function tt(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function st(t){return t==null?"":tt(t)}function T(t){return typeof t=="string"}function be(t){return typeof t=="number"}function rt(t){return t===!0||t===!1||nt(t)&&ve(t)=="[object Boolean]"}function Fe(t){return typeof t=="object"}function nt(t){return Fe(t)&&t!==null}function D(t){return t!=null}function le(t){return!t.trim().length}function ve(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const it="Incorrect 'index' type",at=t=>`Invalid value for key ${t}`,ct=t=>`Pattern length exceeds max of ${t}.`,ut=t=>`Missing ${t} property in key`,lt=t=>`Property 'weight' in key '${t}' must be a positive integer`,ye=Object.prototype.hasOwnProperty;class ot{constructor(e){this._keys=[],this._keyMap={};let r=0;e.forEach(n=>{let i=Me(n);this._keys.push(i),this._keyMap[i.id]=i,r+=i.weight}),this._keys.forEach(n=>{n.weight/=r})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Me(t){let e=null,r=null,n=null,i=1,a=null;if(T(t)||R(t))n=t,e=Ce(t),r=oe(t);else{if(!ye.call(t,"name"))throw new Error(ut("name"));const c=t.name;if(n=c,ye.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(lt(c));e=Ce(c),r=oe(c),a=t.getFn}return{path:e,id:r,weight:i,src:n,getFn:a}}function Ce(t){return R(t)?t:t.split(".")}function oe(t){return R(t)?t.join("."):t}function ht(t,e){let r=[],n=!1;const i=(a,c,l)=>{if(D(a))if(!c[l])r.push(a);else{let o=c[l];const h=a[o];if(!D(h))return;if(l===c.length-1&&(T(h)||be(h)||rt(h)))r.push(st(h));else if(R(h)){n=!0;for(let d=0,m=h.length;d<m;d+=1)i(h[d],c,l+1)}else c.length&&i(h,c,l+1)}};return i(t,T(e)?e.split("."):e,0),n?r:r[0]}const dt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},ft={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},mt={location:0,threshold:.6,distance:100},gt={useExtendedSearch:!1,getFn:ht,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var f={...ft,...dt,...mt,...gt};const xt=/[^ ]+/g;function pt(t=1,e=3){const r=new Map,n=Math.pow(10,e);return{get(i){const a=i.match(xt).length;if(r.has(a))return r.get(a);const c=1/Math.pow(a,.5*t),l=parseFloat(Math.round(c*n)/n);return r.set(a,l),l},clear(){r.clear()}}}class pe{constructor({getFn:e=f.getFn,fieldNormWeight:r=f.fieldNormWeight}={}){this.norm=pt(r,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,T(this.docs[0])?this.docs.forEach((e,r)=>{this._addString(e,r)}):this.docs.forEach((e,r)=>{this._addObject(e,r)}),this.norm.clear())}add(e){const r=this.size();T(e)?this._addString(e,r):this._addObject(e,r)}removeAt(e){this.records.splice(e,1);for(let r=e,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(e,r){return e[this._keysMap[r]]}size(){return this.records.length}_addString(e,r){if(!D(e)||le(e))return;let n={v:e,i:r,n:this.norm.get(e)};this.records.push(n)}_addObject(e,r){let n={i:r,$:{}};this.keys.forEach((i,a)=>{let c=i.getFn?i.getFn(e):this.getFn(e,i.path);if(D(c)){if(R(c)){let l=[];const o=[{nestedArrIndex:-1,value:c}];for(;o.length;){const{nestedArrIndex:h,value:d}=o.pop();if(D(d))if(T(d)&&!le(d)){let m={v:d,i:h,n:this.norm.get(d)};l.push(m)}else R(d)&&d.forEach((m,x)=>{o.push({nestedArrIndex:x,value:m})})}n.$[a]=l}else if(T(c)&&!le(c)){let l={v:c,n:this.norm.get(c)};n.$[a]=l}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Se(t,e,{getFn:r=f.getFn,fieldNormWeight:n=f.fieldNormWeight}={}){const i=new pe({getFn:r,fieldNormWeight:n});return i.setKeys(t.map(Me)),i.setSources(e),i.create(),i}function At(t,{getFn:e=f.getFn,fieldNormWeight:r=f.fieldNormWeight}={}){const{keys:n,records:i}=t,a=new pe({getFn:e,fieldNormWeight:r});return a.setKeys(n),a.setIndexRecords(i),a}function te(t,{errors:e=0,currentLocation:r=0,expectedLocation:n=0,distance:i=f.distance,ignoreLocation:a=f.ignoreLocation}={}){const c=e/t.length;if(a)return c;const l=Math.abs(n-r);return i?c+l/i:l?1:c}function jt(t=[],e=f.minMatchCharLength){let r=[],n=-1,i=-1,a=0;for(let c=t.length;a<c;a+=1){let l=t[a];l&&n===-1?n=a:!l&&n!==-1&&(i=a-1,i-n+1>=e&&r.push([n,i]),n=-1)}return t[a-1]&&a-n>=e&&r.push([n,a-1]),r}const W=32;function yt(t,e,r,{location:n=f.location,distance:i=f.distance,threshold:a=f.threshold,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,includeMatches:o=f.includeMatches,ignoreLocation:h=f.ignoreLocation}={}){if(e.length>W)throw new Error(ct(W));const d=e.length,m=t.length,x=Math.max(0,Math.min(n,m));let g=a,A=x;const C=l>1||o,v=C?Array(m):[];let E;for(;(E=t.indexOf(e,A))>-1;){let F=te(e,{currentLocation:E,expectedLocation:x,distance:i,ignoreLocation:h});if(g=Math.min(F,g),A=E+d,C){let k=0;for(;k<d;)v[E+k]=1,k+=1}}A=-1;let _=[],b=1,L=d+m;const G=1<<d-1;for(let F=0;F<d;F+=1){let k=0,y=L;for(;k<y;)te(e,{errors:F,currentLocation:x+y,expectedLocation:x,distance:i,ignoreLocation:h})<=g?k=y:L=y,y=Math.floor((L-k)/2+k);L=y;let V=Math.max(1,x-y+1),O=c?m:Math.min(x+y,m)+d,I=Array(O+2);I[O+1]=(1<<F)-1;for(let M=O;M>=V;M-=1){let $=M-1,Q=r[t.charAt($)];if(C&&(v[$]=+!!Q),I[M]=(I[M+1]<<1|1)&Q,F&&(I[M]|=(_[M+1]|_[M])<<1|1|_[M+1]),I[M]&G&&(b=te(e,{errors:F,currentLocation:$,expectedLocation:x,distance:i,ignoreLocation:h}),b<=g)){if(g=b,A=$,A<=x)break;V=Math.max(1,2*x-A)}}if(te(e,{errors:F+1,currentLocation:x,expectedLocation:x,distance:i,ignoreLocation:h})>g)break;_=I}const H={isMatch:A>=0,score:Math.max(.001,b)};if(C){const F=jt(v,l);F.length?o&&(H.indices=F):H.isMatch=!1}return H}function Ct(t){let e={};for(let r=0,n=t.length;r<n;r+=1){const i=t.charAt(r);e[i]=(e[i]||0)|1<<n-r-1}return e}const se=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 Be{constructor(e,{location:r=f.location,threshold:n=f.threshold,distance:i=f.distance,includeMatches:a=f.includeMatches,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,isCaseSensitive:o=f.isCaseSensitive,ignoreDiacritics:h=f.ignoreDiacritics,ignoreLocation:d=f.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:c,minMatchCharLength:l,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d},e=o?e:e.toLowerCase(),e=h?se(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const m=(g,A)=>{this.chunks.push({pattern:g,alphabet:Ct(g),startIndex:A})},x=this.pattern.length;if(x>W){let g=0;const A=x%W,C=x-A;for(;g<C;)m(this.pattern.substr(g,W),g),g+=W;if(A){const v=x-W;m(this.pattern.substr(v),v)}}else m(this.pattern,0)}searchIn(e){const{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i}=this.options;if(e=r?e:e.toLowerCase(),e=n?se(e):e,this.pattern===e){let C={isMatch:!0,score:0};return i&&(C.indices=[[0,e.length-1]]),C}const{location:a,distance:c,threshold:l,findAllMatches:o,minMatchCharLength:h,ignoreLocation:d}=this.options;let m=[],x=0,g=!1;this.chunks.forEach(({pattern:C,alphabet:v,startIndex:E})=>{const{isMatch:_,score:b,indices:L}=yt(e,C,v,{location:a+E,distance:c,threshold:l,findAllMatches:o,minMatchCharLength:h,includeMatches:i,ignoreLocation:d});_&&(g=!0),x+=b,_&&L&&(m=[...m,...L])});let A={isMatch:g,score:g?x/this.chunks.length:1};return g&&i&&(A.indices=m),A}}class K{constructor(e){this.pattern=e}static isMultiMatch(e){return we(e,this.multiRegex)}static isSingleMatch(e){return we(e,this.singleRegex)}search(){}}function we(t,e){const r=t.match(e);return r?r[1]:null}class wt extends K{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const r=e===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class Nt extends K{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Et extends K{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const r=e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class bt extends K{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const r=!e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class Ft extends K{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const r=e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class vt extends K{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const r=!e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class De extends K{constructor(e,{location:r=f.location,threshold:n=f.threshold,distance:i=f.distance,includeMatches:a=f.includeMatches,findAllMatches:c=f.findAllMatches,minMatchCharLength:l=f.minMatchCharLength,isCaseSensitive:o=f.isCaseSensitive,ignoreDiacritics:h=f.ignoreDiacritics,ignoreLocation:d=f.ignoreLocation}={}){super(e),this._bitapSearch=new Be(e,{location:r,threshold:n,distance:i,includeMatches:a,findAllMatches:c,minMatchCharLength:l,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class ke extends K{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let r=0,n;const i=[],a=this.pattern.length;for(;(n=e.indexOf(this.pattern,r))>-1;)r=n+a,i.push([n,r-1]);const c=!!i.length;return{isMatch:c,score:c?0:1,indices:i}}}const he=[wt,ke,Et,bt,vt,Ft,Nt,De],Ne=he.length,Mt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,St="|";function Bt(t,e={}){return t.split(St).map(r=>{let n=r.trim().split(Mt).filter(a=>a&&!!a.trim()),i=[];for(let a=0,c=n.length;a<c;a+=1){const l=n[a];let o=!1,h=-1;for(;!o&&++h<Ne;){const d=he[h];let m=d.isMultiMatch(l);m&&(i.push(new d(m,e)),o=!0)}if(!o)for(h=-1;++h<Ne;){const d=he[h];let m=d.isSingleMatch(l);if(m){i.push(new d(m,e));break}}}return i})}const Dt=new Set([De.type,ke.type]);class kt{constructor(e,{isCaseSensitive:r=f.isCaseSensitive,ignoreDiacritics:n=f.ignoreDiacritics,includeMatches:i=f.includeMatches,minMatchCharLength:a=f.minMatchCharLength,ignoreLocation:c=f.ignoreLocation,findAllMatches:l=f.findAllMatches,location:o=f.location,threshold:h=f.threshold,distance:d=f.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:a,findAllMatches:l,ignoreLocation:c,location:o,threshold:h,distance:d},e=r?e:e.toLowerCase(),e=n?se(e):e,this.pattern=e,this.query=Bt(this.pattern,this.options)}static condition(e,r){return r.useExtendedSearch}searchIn(e){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:a}=this.options;e=i?e:e.toLowerCase(),e=a?se(e):e;let c=0,l=[],o=0;for(let h=0,d=r.length;h<d;h+=1){const m=r[h];l.length=0,c=0;for(let x=0,g=m.length;x<g;x+=1){const A=m[x],{isMatch:C,indices:v,score:E}=A.search(e);if(C){if(c+=1,o+=E,n){const _=A.constructor.type;Dt.has(_)?l=[...l,...v]:l.push(v)}}else{o=0,c=0,l.length=0;break}}if(c){let x={isMatch:!0,score:o/c};return n&&(x.indices=l),x}}return{isMatch:!1,score:1}}}const de=[];function _t(...t){de.push(...t)}function fe(t,e){for(let r=0,n=de.length;r<n;r+=1){let i=de[r];if(i.condition(t,e))return new i(t,e)}return new Be(t,e)}const re={AND:"$and",OR:"$or"},me={PATH:"$path",PATTERN:"$val"},ge=t=>!!(t[re.AND]||t[re.OR]),It=t=>!!t[me.PATH],Lt=t=>!R(t)&&Fe(t)&&!ge(t),Ee=t=>({[re.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function _e(t,e,{auto:r=!0}={}){const n=i=>{let a=Object.keys(i);const c=It(i);if(!c&&a.length>1&&!ge(i))return n(Ee(i));if(Lt(i)){const o=c?i[me.PATH]:a[0],h=c?i[me.PATTERN]:i[o];if(!T(h))throw new Error(at(o));const d={keyId:oe(o),pattern:h};return r&&(d.searcher=fe(h,e)),d}let l={children:[],operator:a[0]};return a.forEach(o=>{const h=i[o];R(h)&&h.forEach(d=>{l.children.push(n(d))})}),l};return ge(t)||(t=Ee(t)),n(t)}function Tt(t,{ignoreFieldNorm:e=f.ignoreFieldNorm}){t.forEach(r=>{let n=1;r.matches.forEach(({key:i,norm:a,score:c})=>{const l=i?i.weight:null;n*=Math.pow(c===0&&l?Number.EPSILON:c,(l||1)*(e?1:a))}),r.score=n})}function Rt(t,e){const r=t.matches;e.matches=[],D(r)&&r.forEach(n=>{if(!D(n.indices)||!n.indices.length)return;const{indices:i,value:a}=n;let c={indices:i,value:a};n.key&&(c.key=n.key.src),n.idx>-1&&(c.refIndex=n.idx),e.matches.push(c)})}function Ot(t,e){e.score=t.score}function $t(t,e,{includeMatches:r=f.includeMatches,includeScore:n=f.includeScore}={}){const i=[];return r&&i.push(Rt),n&&i.push(Ot),t.map(a=>{const{idx:c}=a,l={item:e[c],refIndex:c};return i.length&&i.forEach(o=>{o(a,l)}),l})}class U{constructor(e,r={},n){this.options={...f,...r},this.options.useExtendedSearch,this._keyStore=new ot(this.options.keys),this.setCollection(e,n)}setCollection(e,r){if(this._docs=e,r&&!(r instanceof pe))throw new Error(it);this._myIndex=r||Se(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){D(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const r=[];for(let n=0,i=this._docs.length;n<i;n+=1){const a=this._docs[n];e(a,n)&&(this.removeAt(n),n-=1,i-=1,r.push(a))}return r}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:r=-1}={}){const{includeMatches:n,includeScore:i,shouldSort:a,sortFn:c,ignoreFieldNorm:l}=this.options;let o=T(e)?T(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return Tt(o,{ignoreFieldNorm:l}),a&&o.sort(c),be(r)&&r>-1&&(o=o.slice(0,r)),$t(o,this._docs,{includeMatches:n,includeScore:i})}_searchStringList(e){const r=fe(e,this.options),{records:n}=this._myIndex,i=[];return n.forEach(({v:a,i:c,n:l})=>{if(!D(a))return;const{isMatch:o,score:h,indices:d}=r.searchIn(a);o&&i.push({item:a,idx:c,matches:[{score:h,value:a,norm:l,indices:d}]})}),i}_searchLogical(e){const r=_e(e,this.options),n=(l,o,h)=>{if(!l.children){const{keyId:m,searcher:x}=l,g=this._findMatches({key:this._keyStore.get(m),value:this._myIndex.getValueForItemAtKeyId(o,m),searcher:x});return g&&g.length?[{idx:h,item:o,matches:g}]:[]}const d=[];for(let m=0,x=l.children.length;m<x;m+=1){const g=l.children[m],A=n(g,o,h);if(A.length)d.push(...A);else if(l.operator===re.AND)return[]}return d},i=this._myIndex.records,a={},c=[];return i.forEach(({$:l,i:o})=>{if(D(l)){let h=n(r,l,o);h.length&&(a[o]||(a[o]={idx:o,item:l,matches:[]},c.push(a[o])),h.forEach(({matches:d})=>{a[o].matches.push(...d)}))}}),c}_searchObjectList(e){const r=fe(e,this.options),{keys:n,records:i}=this._myIndex,a=[];return i.forEach(({$:c,i:l})=>{if(!D(c))return;let o=[];n.forEach((h,d)=>{o.push(...this._findMatches({key:h,value:c[d],searcher:r}))}),o.length&&a.push({idx:l,item:c,matches:o})}),a}_findMatches({key:e,value:r,searcher:n}){if(!D(r))return[];let i=[];if(R(r))r.forEach(({v:a,i:c,n:l})=>{if(!D(a))return;const{isMatch:o,score:h,indices:d}=n.searchIn(a);o&&i.push({score:h,key:e,value:a,idx:c,norm:l,indices:d})});else{const{v:a,n:c}=r,{isMatch:l,score:o,indices:h}=n.searchIn(a);l&&i.push({score:o,key:e,value:a,norm:c,indices:h})}return i}}U.version="7.1.0";U.createIndex=Se;U.parseIndex=At;U.config=f;U.parseQuery=_e;_t(kt);function Pt(t){switch(t){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}function Qt(){const[t]=Ie(),e=Le(),r=Te(),[n,i]=j.useState([]),[a,c]=j.useState([]),[l,o]=j.useState(!0),[h,d]=j.useState(null),[m,x]=j.useState(t.get("status")||"_default"),[g,A]=j.useState(t.get("priority")||"all"),[C,v]=j.useState(t.get("search")||""),[E,_]=j.useState(t.get("sortBy")||"created"),[b,L]=j.useState(t.get("order")||"desc"),[G,H]=j.useState(!1),F=j.useRef(null),k=[m!=="_default",g!=="all",E!=="created",b!=="desc"].filter(Boolean).length,y=j.useCallback(u=>{const p=new URLSearchParams(t);Object.entries(u).forEach(([S,P])=>{P&&P!=="all"&&P!=="_default"&&P!==""?p.set(S,P):p.delete(S)});const w=p.toString(),N=w?`?${w}`:"";e(`${r.pathname}${N}`)},[t,e,r.pathname]),V=j.useCallback(u=>{x(u),y({status:u==="_default"?null:u})},[y]),O=j.useCallback(u=>{A(u),y({priority:u==="all"?null:u})},[y]),I=j.useCallback(u=>{v(u),y({search:u||null})},[y]),ne=j.useCallback(u=>{_(u),y({sortBy:u==="created"?null:u})},[y]),M=j.useCallback(()=>{const u=b==="asc"?"desc":"asc";L(u),y({order:u==="desc"?null:u})},[b,y]),$=j.useCallback(u=>{if(u.key==="s"||u.key==="S"){const p=document.activeElement;p?.tagName==="INPUT"||p?.tagName==="TEXTAREA"||p?.getAttribute("contenteditable")==="true"||(u.preventDefault(),F.current?.focus())}},[]);j.useEffect(()=>(document.addEventListener("keydown",$),()=>{document.removeEventListener("keydown",$)}),[$]);const Q=j.useMemo(()=>{const u={keys:[{name:"title",weight:.4},{name:"intent",weight:.3},{name:"id",weight:.2},{name:"author.name",weight:.05},{name:"metadata.tags",weight:.05}],threshold:.3,includeScore:!0};return new U(n,u)},[n]);return j.useEffect(()=>{async function u(){try{o(!0);const w=await(await fetch(`${Ve}/api/v1/proposals`)).json();w.success?(i(w.data),c(w.data)):d(w.error?.message||"Failed to fetch proposals")}catch(p){d(p instanceof Error?p.message:"Unknown error")}finally{o(!1)}}u()},[]),j.useEffect(()=>{let u=n;if(m==="_default"?u=u.filter(p=>Ue.includes(p.status)):m!=="all"&&(u=u.filter(p=>p.status===m)),g!=="all"&&(u=u.filter(p=>p.metadata.priority===g)),C.trim()){const p=Q.search(C),w=new Set(p.map(N=>N.item.id));u=u.filter(N=>w.has(N.id))}u=u.sort((p,w)=>{let N,S;switch(E){case"created":{N=new Date(p.metadata.createdAt).getTime(),S=new Date(w.metadata.createdAt).getTime();break}case"updated":{N=new Date(p.metadata.updatedAt).getTime(),S=new Date(w.metadata.updatedAt).getTime();break}case"status":{N=p.status,S=w.status;break}case"priority":{const P={critical:4,high:3,medium:2,low:1};N=P[p.metadata.priority]||0,S=P[w.metadata.priority]||0;break}case"intent":{N=(p.title||p.intent||"").toLowerCase(),S=(w.title||w.intent||"").toLowerCase();break}default:N=new Date(p.metadata.createdAt).getTime(),S=new Date(w.metadata.createdAt).getTime()}return b==="asc"?N<S?-1:N>S?1:0:N>S?-1:N<S?1:0}),c(u)},[n,m,g,C,E,b,Q]),l?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your agents"})]}),s.jsx(z,{asChild:!0,children:s.jsxs(Y,{to:"/proposals/new",children:[s.jsx(Z,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),s.jsx("div",{className:"space-y-4",children:[...Array(3)].map((u,p)=>s.jsx(J,{children:s.jsx(ze,{children:s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-6 bg-muted rounded w-3/4 animate-pulse"}),s.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]}),s.jsx("div",{className:"h-6 bg-muted rounded w-20 animate-pulse"})]})})},p))})]}):h?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your agents"})]}),s.jsx(z,{asChild:!0,children:s.jsxs(Y,{to:"/proposals/new",children:[s.jsx(Z,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),s.jsx(J,{children:s.jsx(q,{className:"pt-6",children:s.jsx("div",{className:"text-center",children:s.jsxs("p",{className:"text-destructive",children:["Error: ",h]})})})})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your agents"})]}),s.jsx(z,{asChild:!0,children:s.jsxs(Y,{to:"/proposals/new",children:[s.jsx(Z,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Qe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),s.jsx(Re,{ref:F,placeholder:"Search tasks...",value:C,onChange:u=>I(u.target.value),className:"pl-9 pr-20 h-11 bg-muted/40 border-muted-foreground/20 focus:bg-background transition-colors"}),s.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:C?s.jsx("button",{onClick:()=>I(""),className:"h-5 w-5 rounded-full bg-muted-foreground/20 hover:bg-muted-foreground/30 flex items-center justify-center transition-colors",children:s.jsx(X,{className:"h-3 w-3"})}):s.jsx(Oe,{children:s.jsx($e,{children:"S"})})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>H(!G),className:"flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg border border-muted-foreground/20 hover:bg-muted/50 transition-colors",children:[s.jsx(je,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Filters & Sort"}),s.jsx("span",{className:"sm:hidden",children:"Filters"}),k>0&&s.jsx("span",{className:"flex items-center justify-center h-5 w-5 text-xs font-bold rounded-full bg-primary text-primary-foreground",children:k}),G?s.jsx(Ye,{className:"h-4 w-4 ml-1"}):s.jsx(Pe,{className:"h-4 w-4 ml-1"})]}),s.jsxs("div",{className:"flex-1 flex items-center gap-2 overflow-x-auto scrollbar-hide",children:[m!=="_default"&&s.jsxs("button",{onClick:()=>V("_default"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-blue-500/15 text-blue-600 dark:text-blue-400 hover:bg-blue-500/25 transition-colors whitespace-nowrap",children:[m==="all"?"All statuses":Ae(m),s.jsx(X,{className:"h-3 w-3"})]}),g!=="all"&&s.jsxs("button",{onClick:()=>O("all"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 transition-colors whitespace-nowrap",children:[g," priority",s.jsx(X,{className:"h-3 w-3"})]}),(E!=="created"||b!=="desc")&&s.jsxs("button",{onClick:()=>{ne("created"),L("desc"),y({sortBy:null,order:null})},className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-purple-500/15 text-purple-600 dark:text-purple-400 hover:bg-purple-500/25 transition-colors whitespace-nowrap",children:[E," ",b==="asc"?"↑":"↓",s.jsx(X,{className:"h-3 w-3"})]})]}),s.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[a.length," result",a.length!==1?"s":""]})]}),G&&s.jsxs("div",{className:"p-4 rounded-lg border border-muted-foreground/20 bg-muted/30 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Status"}),s.jsxs(ie,{value:m,onValueChange:V,children:[s.jsx(ae,{className:"w-full bg-background",children:s.jsx(ce,{placeholder:"Filter by status"})}),s.jsxs(ue,{children:[s.jsx(B,{value:"_default",children:"Active (Default)"}),s.jsx(B,{value:"all",children:"All statuses"}),Ge.map(u=>s.jsx(B,{value:u,children:Ae(u)},u))]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Priority"}),s.jsxs(ie,{value:g,onValueChange:O,children:[s.jsx(ae,{className:"w-full bg-background",children:s.jsx(ce,{placeholder:"Filter by priority"})}),s.jsxs(ue,{children:[s.jsx(B,{value:"all",children:"All priorities"}),s.jsx(B,{value:"low",children:"Low"}),s.jsx(B,{value:"medium",children:"Medium"}),s.jsx(B,{value:"high",children:"High"}),s.jsx(B,{value:"critical",children:"Critical"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Sort By"}),s.jsxs(ie,{value:E,onValueChange:u=>ne(u),children:[s.jsx(ae,{className:"w-full bg-background",children:s.jsx(ce,{})}),s.jsxs(ue,{children:[s.jsx(B,{value:"created",children:"Created Date"}),s.jsx(B,{value:"updated",children:"Updated Date"}),s.jsx(B,{value:"status",children:"Status"}),s.jsx(B,{value:"priority",children:"Priority"}),s.jsx(B,{value:"intent",children:"Title"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Order"}),s.jsx(z,{variant:"outline",onClick:M,className:"w-full justify-between bg-background",children:b==="asc"?s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Ascending"}),s.jsx(qe,{className:"h-4 w-4"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Descending"}),s.jsx(Je,{className:"h-4 w-4"})]})})]})]}),k>0&&s.jsx("div",{className:"pt-2 border-t border-muted-foreground/10",children:s.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>{V("_default"),O("all"),I("")},className:"text-muted-foreground hover:text-foreground",children:[s.jsx(X,{className:"h-3 w-3 mr-1"}),"Reset all filters"]})})]})]}),a.length===0&&n.length>0?s.jsx(J,{children:s.jsx(q,{className:"pt-6",children:s.jsxs("div",{className:"text-center py-6",children:[s.jsx(je,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),s.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No proposals match your filters"}),s.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Try adjusting your status or priority filters."}),s.jsx(z,{variant:"outline",className:"mt-4",onClick:()=>{V("_default"),O("all"),I("")},children:"Clear Filters"})]})})}):n.length===0?s.jsx(J,{children:s.jsx(q,{className:"pt-6",children:s.jsxs("div",{className:"text-center py-6",children:[s.jsx(Ke,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),s.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No proposals yet"}),s.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first change proposal to get started."}),s.jsx(z,{asChild:!0,className:"mt-4",children:s.jsxs(Y,{to:"/proposals/new",children:[s.jsx(Z,{className:"mr-2 h-4 w-4"}),"New Task"]})})]})})}):s.jsx("div",{className:"space-y-4",children:a.map(u=>s.jsx(Y,{to:`/proposals/${u.id}`,className:"block",children:s.jsx(J,{className:"hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:s.jsx(q,{className:"py-4",children:s.jsx("div",{className:"flex justify-between items-start gap-4",children:s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsx(We,{className:"text-base leading-tight",children:u.title||u.intent}),s.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[u.metadata.priority&&s.jsx(ee,{variant:Pt(u.metadata.priority),className:"text-xs",children:u.metadata.priority}),s.jsx(ee,{variant:He(u.status),className:"text-xs",children:u.status})]})]}),u.content&&s.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[u.content.split(`
17
+ `).slice(0,2).join(" ").substring(0,150),u.content.length>150?"...":""]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{className:"text-xs text-muted-foreground",children:[u.id," • by ",u.author.name," • ",new Date(u.metadata.createdAt).toLocaleDateString()]}),s.jsxs("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[u.planSteps.length>0&&s.jsxs("span",{children:[u.planSteps.length," step",u.planSteps.length!==1?"s":""]}),u.evidence.length>0&&s.jsxs("span",{children:[u.evidence.length," evidence"]}),u.metadata.tags&&u.metadata.tags.length>0&&s.jsxs("span",{children:[u.metadata.tags.length," tag",u.metadata.tags.length!==1?"s":""]})]})]}),u.metadata.tags&&u.metadata.tags.length>0&&s.jsxs("div",{className:"flex gap-1 mt-2",children:[u.metadata.tags.slice(0,3).map(p=>s.jsx(ee,{variant:"outline",className:"text-xs",children:p},p)),u.metadata.tags.length>3&&s.jsxs(ee,{variant:"outline",className:"text-xs",children:["+",u.metadata.tags.length-3]})]})]})})})})},u.id))})]})}export{Qt as default};
@@ -0,0 +1 @@
1
+ import{E as X,u as q,a as Q,r as a,A as f,j as e,B as i,ah as Z,ai as z,n as ee,F as P,X as se,at as te,au as ae,av as ie,aw as re}from"./index-9Tv-j_Ga.js";import{B as ne}from"./badge-AwLOflf5.js";import{c as A}from"./clipboard-B9ndUJKl.js";import{A as M}from"./arrow-left-WGBYWq3h.js";import{L as le,H as oe,I as ce,V as de,M as W,F as me,a as $}from"./video-DYA2WfbA.js";import{D as B}from"./download-Cv2G2Eg9.js";import{T as ue}from"./tag-DrQkepeD.js";function ve(){const{id:u}=X(),k=q(),{toast:o}=Q(),[s,p]=a.useState(null),[R,b]=a.useState(!0),[C,x]=a.useState(null),[r,j]=a.useState(null),[h,L]=a.useState(!1),[g,c]=a.useState(!1),[I,F]=a.useState(!1);a.useEffect(()=>{u&&(b(!0),x(null),fetch(`${f}/api/v1/resources/${u}`).then(t=>{if(!t.ok)throw new Error(`Resource not found (${t.status})`);if(t.headers.get("content-type")?.includes("application/json"))return t.json();throw new Error("NEED_METADATA")}).then(t=>{if(t.success&&t.data)p(t.data);else if(t.id)p(t);else throw new Error("Invalid response")}).catch(async t=>{if(t.message==="NEED_METADATA")try{const d=await(await fetch(`${f}/api/v1/resources`)).json();if(d.success&&d.data){const m=d.data.find(Y=>Y.id===u);if(m){p(m);return}}x("Resource not found")}catch{x("Failed to load resource")}else x(t.message||"Failed to load resource")}).finally(()=>b(!1)))},[u]);const n=s?`${f}/api/v1/resources/${s.id}`:"",E=s?.type.startsWith("image/")??!1,T=s?s.type==="image/svg+xml"||s.name.toLowerCase().endsWith(".svg"):!1,U=s?s.type==="application/pdf"||s.name.toLowerCase().endsWith(".pdf"):!1,G=s?.type.startsWith("video/")??!1,V=s?.type.startsWith("audio/")??!1,w=s?s.type.startsWith("text/")||s.type==="application/json"||s.type.includes("javascript")||s.type.includes("typescript")||s.type.includes("xml")||s.name.toLowerCase().match(/\.(txt|md|json|js|ts|jsx|tsx|css|html|xml|yaml|yml|log|sh|bash|zsh|fish)$/)!==null:!1,v=s?s.name.toLowerCase().endsWith(".md")||s.name.toLowerCase().endsWith(".markdown"):!1,N=s?s.type==="application/json"||s.name.toLowerCase().endsWith(".json"):!1,y=s?s.type==="text/html"||s.name.toLowerCase().endsWith(".html"):!1;a.useEffect(()=>{s&&(w||v||N||y)?(L(!0),fetch(n).then(t=>{if(t.ok)return t.text();throw new Error("Failed to load file")}).then(t=>j(t)).catch(t=>{console.error("Failed to load text content:",t),j(null)}).finally(()=>L(!1))):j(null)},[s?.id,w,v,N,y,n]),a.useEffect(()=>{const t=l=>{l.key==="Escape"&&g&&c(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[g]);const _=t=>{if(t===0)return"0 B";const l=1024,d=["B","KB","MB","GB"],m=Math.floor(Math.log(t)/Math.log(l));return parseFloat((t/Math.pow(l,m)).toFixed(2))+" "+d[m]},H=t=>new Date(t).toLocaleString(),S=t=>t.startsWith("image/")?e.jsx(ce,{className:"h-6 w-6"}):t.startsWith("video/")?e.jsx(de,{className:"h-6 w-6"}):t.startsWith("audio/")?e.jsx(W,{className:"h-6 w-6"}):t.includes("text")||t.includes("document")||t.includes("code")?e.jsx(P,{className:"h-6 w-6"}):t.includes("json")||t.includes("javascript")||t.includes("typescript")?e.jsx(me,{className:"h-6 w-6"}):e.jsx(te,{className:"h-6 w-6"}),D=()=>{s&&window.open(`${f}/api/v1/resources/${s.id}?download=true`)},J=async()=>{if(s)try{const t=`.nut/resources/files/${s.path}`;await A(t),o({title:"Path copied!",description:`Copied ${t} to clipboard`})}catch{o({title:"Failed to copy",description:"Unable to copy path to clipboard",variant:"destructive"})}},O=async()=>{if(s)try{const t=`${window.location.origin}/resources/${s.id}`;await A(t),F(!0),o({title:"Link copied!",description:"Share link copied to clipboard"}),setTimeout(()=>F(!1),2e3)}catch{o({title:"Failed to copy",description:"Unable to copy link to clipboard",variant:"destructive"})}},K=()=>{if(!s)return null;if(T)return e.jsxs(e.Fragment,{children:[e.jsx("img",{src:n,alt:s.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}),e.jsx(i,{variant:"secondary",size:"icon",className:"absolute bottom-3 right-3 h-8 w-8 opacity-70 hover:opacity-100 transition-opacity",onClick:()=>c(!0),children:e.jsx($,{className:"h-4 w-4"})})]});if(U)return e.jsx("iframe",{src:n,className:"w-full h-full min-h-[600px] rounded-lg border",title:s.name});if(G)return e.jsx("video",{src:n,controls:!0,className:"max-w-full max-h-full rounded-lg shadow-lg",children:"Your browser does not support the video tag."});if(V)return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(W,{className:"h-24 w-24 text-muted-foreground/50"})}),e.jsx("div",{className:"flex-shrink-0 p-6 bg-muted/30 flex justify-center",children:e.jsx("audio",{src:n,controls:!0,className:"w-3/4 min-w-[300px]",children:"Your browser does not support the audio tag."})})]});if(v&&r!==null)return h?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6 prose prose-sm dark:prose-invert max-w-none",children:e.jsx(ae,{remarkPlugins:[re],rehypePlugins:[ie],children:r})});if(y&&r!==null)return h?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("iframe",{srcDoc:r,className:"w-full h-full min-h-[600px] rounded-lg border",title:s.name,sandbox:"allow-same-origin"});if(N&&r!==null){if(h)return e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})});let t=r;try{const l=JSON.parse(r);t=JSON.stringify(l,null,2)}catch{}return e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto",children:e.jsx("code",{children:t})})})}return w&&r!==null?h?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsx("div",{className:"w-full h-full overflow-auto p-6",children:e.jsx("pre",{className:"text-xs bg-muted p-4 rounded-lg overflow-auto whitespace-pre-wrap",children:e.jsx("code",{children:r})})}):E?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:n,alt:s.name,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"}),e.jsx(i,{variant:"secondary",size:"icon",className:"absolute bottom-3 right-3 h-8 w-8 opacity-70 hover:opacity-100 transition-opacity",onClick:()=>c(!0),children:e.jsx($,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4 text-muted-foreground",children:[S(s.type),e.jsx("p",{className:"text-sm",children:"Preview not available for this file type"}),e.jsxs(i,{variant:"outline",onClick:D,children:[e.jsx(B,{className:"mr-2 h-4 w-4"}),"Download to view"]})]})};return R?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading resource..."})}):C||!s?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:C||"Resource not found"}),e.jsxs(i,{variant:"outline",onClick:()=>k("/resources"),children:[e.jsx(M,{className:"mr-2 h-4 w-4"}),"Back to Resources"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"px-6 py-4 flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(i,{variant:"ghost",size:"icon",onClick:()=>k("/resources"),title:"Back to Resources",children:e.jsx(M,{className:"h-4 w-4"})}),S(s.type),e.jsxs("div",{className:"min-w-0 flex items-baseline gap-3",children:[e.jsx("h1",{className:"text-xl font-semibold truncate",children:s.name}),e.jsx("p",{className:"text-sm text-muted-foreground flex-shrink-0",children:s.type})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(i,{variant:"ghost",size:"sm",onClick:O,title:"Copy share link",children:I?e.jsx(Z,{className:"h-4 w-4"}):e.jsx(le,{className:"h-4 w-4"})}),e.jsx(i,{variant:"ghost",size:"sm",onClick:J,title:"Copy path to clipboard",children:e.jsx(z,{className:"h-4 w-4"})}),e.jsx(i,{variant:"ghost",size:"sm",onClick:D,title:"Download",children:e.jsx(B,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 relative flex items-center justify-center bg-muted/30 p-6 overflow-hidden border rounded-lg",children:K()}),e.jsx("div",{className:"p-6 flex-shrink-0 bg-background",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-x-6 gap-y-2 md:grid-cols-2 text-sm",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Size:"}),e.jsx("span",{children:_(s.size)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Uploaded:"}),e.jsx("span",{children:H(s.uploadedAt)})]})]}),e.jsx("div",{className:"space-y-2",children:s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.metadata.tags.map(t=>e.jsx(ne,{variant:"secondary",className:"text-xs",children:t},t))})]})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.metadata.description?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-muted-foreground",children:"Description:"}),e.jsx("span",{className:"truncate flex-1",title:s.metadata.description,children:s.metadata.description})]}):e.jsx("div",{className:"flex-1"}),s.metadata.generationPrompt&&e.jsxs(i,{size:"sm",className:"h-6 text-xs px-2 flex-shrink-0",onClick:()=>{navigator.clipboard.writeText(s.metadata.generationPrompt||""),o({title:"Prompt copied!",description:"Generation prompt copied to clipboard"})},children:[e.jsx(z,{className:"h-2.5 w-2.5 mr-1"}),"Copy Prompt"]})]})]})})]}),g&&(E||T)&&e.jsxs("div",{className:"fixed inset-0 z-[100] bg-black/95 flex items-center justify-center",onClick:()=>c(!1),children:[e.jsx(i,{variant:"ghost",size:"icon",className:"absolute top-4 right-4 h-10 w-10 text-white hover:bg-white/20",onClick:()=>c(!1),children:e.jsx(se,{className:"h-6 w-6"})}),e.jsx("img",{src:n,alt:s.name,className:"max-w-[95vw] max-h-[95vh] object-contain",onClick:t=>t.stopPropagation()})]})]})}export{ve as default};