crewx 0.8.7-rc.6 → 0.8.7-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{MarketPage-Ln8V3XxD.js → MarketPage-UzEGTS2s.js} +2 -2
- package/dist/assets/{PromptTab-BTpyp1lj.js → PromptTab-C0GGkZzv.js} +1 -1
- package/dist/assets/{arc-DjR7gr6p.js → arc-VHL0iCgQ.js} +1 -1
- package/dist/assets/{architectureDiagram-UYN6MBPD-CB3UTX3z.js → architectureDiagram-UYN6MBPD-BKDkJInM.js} +1 -1
- package/dist/assets/{blockDiagram-ZHA2E4KO-BWPwe_5k.js → blockDiagram-ZHA2E4KO-zQeZLKqf.js} +1 -1
- package/dist/assets/{c4Diagram-6F5ED5ID-CGlWLWxo.js → c4Diagram-6F5ED5ID-B3jTks4z.js} +1 -1
- package/dist/assets/channel-lPlHEyck.js +1 -0
- package/dist/assets/{chunk-5HRBRIJM-DNoifHHI.js → chunk-5HRBRIJM-D-5wuzDZ.js} +1 -1
- package/dist/assets/{chunk-7U56Z5CX-DW00V012.js → chunk-7U56Z5CX-D95Ootcf.js} +1 -1
- package/dist/assets/{chunk-ASOPGD6M-BwzokkxT.js → chunk-ASOPGD6M-DG-xoGal.js} +1 -1
- package/dist/assets/{chunk-KFBOBJHC-CRHCR9ef.js → chunk-KFBOBJHC-BtjU88JB.js} +1 -1
- package/dist/assets/{chunk-T2TOU4HS-ycqOBaQ9.js → chunk-T2TOU4HS-jJiQESqN.js} +1 -1
- package/dist/assets/{chunk-TMUBEWPD-BiuTyl0H.js → chunk-TMUBEWPD-xha6guad.js} +1 -1
- package/dist/assets/classDiagram-LNE6IOMH-BxIai2wM.js +1 -0
- package/dist/assets/classDiagram-v2-MQ7JQ4JX-BxIai2wM.js +1 -0
- package/dist/assets/{dagre-4EVJKHTY-aykBW7uB.js → dagre-4EVJKHTY-D1CBNihr.js} +1 -1
- package/dist/assets/{diagram-QW4FP2JN-BiudXMxh.js → diagram-QW4FP2JN-CKC6jVRL.js} +1 -1
- package/dist/assets/{erDiagram-6RL3IURR-CbLZ73Z9.js → erDiagram-6RL3IURR-CaFJW180.js} +1 -1
- package/dist/assets/{flowDiagram-7ASYPVHJ-kck7XIup.js → flowDiagram-7ASYPVHJ-C9zObePt.js} +1 -1
- package/dist/assets/{ganttDiagram-NTVNEXSI-DAzfjjNZ.js → ganttDiagram-NTVNEXSI-tVbydcng.js} +1 -1
- package/dist/assets/{gitGraph-YCYPL57B-DGkoHrQZ.js → gitGraph-YCYPL57B-DaXeRwul.js} +1 -1
- package/dist/assets/{gitGraphDiagram-NRZ2UAAF-BM2vwUE6.js → gitGraphDiagram-NRZ2UAAF-6gMs0F5b.js} +1 -1
- package/dist/assets/{infoDiagram-A4XQUW5V-GzPB4wL4.js → infoDiagram-A4XQUW5V-CzcVas6Y.js} +1 -1
- package/dist/assets/{journeyDiagram-G5WM74LC-KqqOdGKl.js → journeyDiagram-G5WM74LC-CodkcXgJ.js} +1 -1
- package/dist/assets/{kanban-definition-QRCXZQQD-BnVggn46.js → kanban-definition-QRCXZQQD-BXAiKIHD.js} +1 -1
- package/dist/assets/{linear-1stfQ7I2.js → linear-CdYaqG0Q.js} +1 -1
- package/dist/assets/{main-CCNSQP12.js → main-8qPNZsN6.js} +6 -6
- package/dist/assets/{mindmap-definition-GWI6TPTV-D6maiI4R.js → mindmap-definition-GWI6TPTV-CMjxfI4X.js} +1 -1
- package/dist/assets/{pieDiagram-YF2LJOPJ-BMG2uQnh.js → pieDiagram-YF2LJOPJ-B43VVsd3.js} +1 -1
- package/dist/assets/{quadrantDiagram-OS5C2QUG-jX6qsjEC.js → quadrantDiagram-OS5C2QUG-opEzrXR0.js} +1 -1
- package/dist/assets/{requirementDiagram-MIRIMTAZ-x38etcz_.js → requirementDiagram-MIRIMTAZ-DRLigTeq.js} +1 -1
- package/dist/assets/{sankeyDiagram-Y46BX6SQ-BWETWlYi.js → sankeyDiagram-Y46BX6SQ-BkPKcqrn.js} +1 -1
- package/dist/assets/{sequenceDiagram-G6AWOVSC-DUP3f5WX.js → sequenceDiagram-G6AWOVSC-gnZaBixg.js} +1 -1
- package/dist/assets/{stateDiagram-MAYHULR4-C4UXj9_c.js → stateDiagram-MAYHULR4-Cc7nhVym.js} +1 -1
- package/dist/assets/stateDiagram-v2-4JROLMXI-DZ3F2sKi.js +1 -0
- package/dist/assets/{timeline-definition-U7ZMHBDA-6DTCXvRY.js → timeline-definition-U7ZMHBDA-CDTK1edS.js} +1 -1
- package/dist/assets/{xychartDiagram-6QU3TZC5-BRNEMEeO.js → xychartDiagram-6QU3TZC5-BW2srdio.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +8 -8
- package/packages/cli/package.json +1 -1
- package/dist/assets/channel-DecBQsq0.js +0 -1
- package/dist/assets/classDiagram-LNE6IOMH-DX-Ced-k.js +0 -1
- package/dist/assets/classDiagram-v2-MQ7JQ4JX-DX-Ced-k.js +0 -1
- package/dist/assets/stateDiagram-v2-4JROLMXI-BwdSmVaP.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aB as b,aC as Se,aD as j,aE as N,aF as Ue,aG as g,aH as e,aI as ce,aJ as K,aK as le,aL as
|
|
1
|
+
import{aB as b,aC as Se,aD as j,aE as N,aF as Ue,aG as g,aH as e,aI as ce,aJ as K,aK as le,aL as w,aM as me,aN as xe,aO as Pe,aP as ue,aQ as W,aR as Ve,aS as Fe,aT as ge,aU as Be,aV as Oe}from"./main-8qPNZsN6.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -53,4 +53,4 @@ import{aB as b,aC as Se,aD as j,aE as N,aF as Ue,aG as g,aH as e,aI as ce,aJ as
|
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const rt=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],je=b("workflow",rt);function z(t){return t instanceof Error?t.message:String(t)}function nt(t){return[...t].sort((a,r)=>a.isInstalled!==r.isInstalled?a.isInstalled?-1:1:(a.displayName||a.name).localeCompare(r.displayName||r.name))}const ie={trusted:2,verified:1,unverified:0};function Ne(t,a){return ie[t]>=ie[a]?t:a}function lt(t=[],a=[]){return Array.from(new Set([...t,...a]))}function it(t,a){var s;if(!t)return a;const r=Ne(t.trustLevel,a.trustLevel);return{...t,...a,displayName:a.displayName||t.displayName||a.name,description:a.description||t.description,author:a.author||t.author,version:a.version||t.version,tags:lt(t.tags,a.tags),type:a.type||t.type,trustLevel:r,isVerified:r!=="unverified",isInstalled:t.isInstalled||a.isInstalled,registryId:a.registryId??t.registryId,registryName:a.registryName??t.registryName,installSource:a.installSource??t.installSource,hasUpdate:a.hasUpdate??t.hasUpdate,remoteVersion:a.remoteVersion??t.remoteVersion,isCustomized:a.isCustomized??t.isCustomized,authors:(s=a.authors)!=null&&s.length?a.authors:t.authors,updatedAt:a.updatedAt??t.updatedAt,stars:a.stars??t.stars,license:a.license??t.license,installCount:a.installCount??t.installCount}}function S(t){const a=new Map;for(const s of t){const l=a.get(s.name)??[];l.push(s),a.set(s.name,l)}const r=[];for(const[,s]of a){if(s.length===1){r.push(s[0]);continue}const l=new Map;for(const d of s){const o=d.registryId??"_local",m=l.get(o);l.set(o,it(m,d))}r.push(...l.values())}return nt(r)}function dt(t,a){return t.map(r=>{const s=Ne(r.trustLevel,a.trustLevel);return{...r,registryId:r.registryId??a.id,registryName:r.registryName??a.name,trustLevel:s,isVerified:s!=="unverified"}})}function ot(t){return t.find(a=>a.isDefault)??t.find(a=>a.trustLevel!=="unverified")??t[0]??null}function ct(t,a){return S([...t,...a])}function G(t,a){var r;return a&&t.some(s=>s.name===a)?a:((r=t[0])==null?void 0:r.name)??null}const mt=Se((t,a)=>({initialized:!1,loading:!1,loadingOfficial:!1,loadingInstalled:!1,savingRegistry:!1,deletingRegistryId:null,mutatingItemName:null,error:null,registries:[],officialRegistryId:null,allItems:[],activeFilter:"all",searchQuery:"",selectedItemName:null,setActiveFilter:r=>t({activeFilter:r}),setSearchQuery:r=>t({searchQuery:r}),setSelectedItem:r=>t({selectedItemName:r}),initialize:async()=>{const r=a().selectedItemName;t({loading:!0,loadingOfficial:!0,loadingInstalled:!0,error:null});try{const l=(await j.getMarketRegistries()).registries,d=ot(l),[o,m]=await Promise.all([Promise.allSettled(l.map(p=>j.getRegistryMarketItems(p.id).then(y=>dt(y.items,p)))),j.getInstalledMarkets()]),u=o.filter(p=>p.status==="fulfilled").flatMap(p=>p.value),c=S(m.items.filter(p=>!p.source||p.source==="local")),f=ct(u,c);t({initialized:!0,loading:!1,loadingOfficial:!1,loadingInstalled:!1,registries:l,officialRegistryId:(d==null?void 0:d.id)??null,allItems:f,selectedItemName:G(f,r)}),j.checkMarketUpdates().then(p=>{!p||Object.keys(p).length===0||t(y=>({allItems:y.allItems.map(M=>{const v=p[M.name];return v?{...M,hasUpdate:v.hasUpdate,remoteVersion:v.remoteVersion,isCustomized:v.isCustomized}:M})}))}).catch(()=>{})}catch(s){throw t({loading:!1,loadingOfficial:!1,loadingInstalled:!1,error:z(s)}),s}},refresh:async()=>{await a().initialize()},addRegistry:async(r,s)=>{const l=r.trim();if(!l){const d=new Error("Registry URL is required");throw t({error:d.message}),d}t({savingRegistry:!0,error:null});try{const d=(s==null?void 0:s.trim())||void 0;await j.addMarketRegistry(l,d),await a().initialize(),t({savingRegistry:!1})}catch(d){throw t({savingRegistry:!1,error:z(d)}),d}},deleteRegistry:async r=>{t({deletingRegistryId:r,error:null});try{await j.deleteMarketRegistry(r),await a().initialize(),t({deletingRegistryId:null})}catch(s){throw t({deletingRegistryId:null,error:z(s)}),s}},installItem:async(r,s)=>{t({mutatingItemName:s,error:null});try{await j.installMarketItem(r,s),t(l=>{const d=l.registries.find(m=>m.id===r),o=S(l.allItems.map(m=>m.name===s?{...m,isInstalled:!0,registryId:m.registryId??r,registryName:m.registryName??(d==null?void 0:d.name)}:m));return{allItems:o,mutatingItemName:null,selectedItemName:G(o,l.selectedItemName??s)}})}catch(l){throw t({mutatingItemName:null,error:z(l)}),l}},uninstallItem:async r=>{t({mutatingItemName:r,error:null});try{await j.uninstallMarketItem(r),t(s=>{const l=S(s.allItems.map(d=>d.name===r?{...d,isInstalled:!1}:d));return{allItems:l,mutatingItemName:null,selectedItemName:G(l,s.selectedItemName)}})}catch(s){throw t({mutatingItemName:null,error:z(s)}),s}},clearError:()=>t({error:null})}));function ve(t,a){if(!t)return"—";const r=new Date(t);return Number.isNaN(r.getTime())?"—":new Intl.DateTimeFormat(a,{year:"numeric",month:"short",day:"numeric"}).format(r)}function xt(t,a){if(!t)return null;const r=new Date(t);if(Number.isNaN(r.getTime()))return null;const s=r.getTime()-Date.now(),l=[{unit:"year",ms:1e3*60*60*24*365},{unit:"month",ms:1e3*60*60*24*30},{unit:"week",ms:1e3*60*60*24*7},{unit:"day",ms:1e3*60*60*24},{unit:"hour",ms:1e3*60*60},{unit:"minute",ms:1e3*60}],d=new Intl.RelativeTimeFormat(a,{numeric:"auto"});for(const o of l)if(Math.abs(s)>=o.ms||o.unit==="minute")return d.format(Math.round(s/o.ms),o.unit);return null}function de(t,a){return typeof t!="number"?"—":new Intl.NumberFormat(a,{notation:"compact",compactDisplay:"short",maximumFractionDigits:1}).format(t)}function J(t){switch(t==null?void 0:t.toLowerCase()){case"template":return"template";case"agent":return"agent";case"workflow":return"workflow";case"plugin":return"plugin";default:return"skill"}}function we({type:t}){const{t:a}=N(),r=J(t),s={skill:"bg-violet-50 text-violet-700",template:"bg-amber-50 text-amber-700",agent:"bg-emerald-50 text-emerald-700",workflow:"bg-cyan-50 text-cyan-700",plugin:"bg-rose-50 text-rose-700"},l={skill:be,template:he,agent:me,workflow:je,plugin:fe},d={skill:a("market.types.skill"),template:a("market.types.template"),agent:a("market.types.agent"),workflow:a("market.types.workflow"),plugin:a("market.types.plugin")},o=l[r];return e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${s[r]}`,children:[e.jsx(o,{size:12}),d[r]]})}const ut={trusted:{bg:"bg-green-50",text:"text-green-700",icon:xe,label:"market.badges.trusted"},verified:{bg:"bg-blue-50",text:"text-blue-700",icon:pe,label:"market.badges.verified"},unverified:{bg:"bg-gray-50",text:"text-gray-500",icon:U,label:"market.badges.unverified"}};function gt({level:t}){const{t:a}=N(),r=ut[t],s=r.icon;return e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium ${r.bg} ${r.text}`,children:[e.jsx(s,{size:13}),a(r.label)]})}function ke(t){if(t.trustLevel==="unverified"){if(t.type==="plugin")return{allowed:!1,reason:"market.trust.blockedPlugin"};if(t.type==="exec")return{allowed:!1,reason:"market.trust.blockedExec"}}return t.trustLevel==="verified"&&t.type==="plugin"?{allowed:!0,needsConfirm:!0}:{allowed:!0}}function pt({itemName:t,onConfirm:a,onCancel:r}){const{t:s}=N();return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{role:"dialog","aria-modal":"true",className:"w-full max-w-md overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl",children:[e.jsxs("div",{className:"border-b border-gray-200 px-6 py-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:s("market.pluginDialog.title")}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s("market.pluginDialog.description")})]}),e.jsxs("div",{className:"space-y-3 px-6 py-5",children:[e.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-amber-900",children:t}),e.jsx("p",{className:"mt-1 text-sm text-amber-800",children:s("market.pluginDialog.warning")})]}),e.jsxs("ul",{className:"space-y-2 text-sm text-gray-600",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(U,{size:14,className:"shrink-0 text-amber-500"}),s("market.pluginDialog.perm1")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(U,{size:14,className:"shrink-0 text-amber-500"}),s("market.pluginDialog.perm2")]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 px-6 py-4",children:[e.jsx("button",{type:"button",onClick:r,className:"rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200",children:s("market.actions.cancel")}),e.jsx("button",{type:"button",onClick:a,className:"rounded-lg bg-red-500 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-red-600",children:s("market.actions.install")})]})]})})}function yt({url:t,tokenEnv:a,error:r,submitting:s,onChangeUrl:l,onChangeTokenEnv:d,onClose:o,onSubmit:m}){const{t:u}=N(),c=f=>{f.preventDefault(),m()};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{role:"dialog","aria-modal":"true",className:"w-full max-w-xl overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl",children:[e.jsxs("div",{className:"border-b border-gray-200 px-6 py-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:u("market.addRegistryModal.title")}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:u("market.addRegistryModal.description")})]}),e.jsxs("form",{onSubmit:c,children:[e.jsxs("div",{className:"space-y-4 px-6 py-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"registry-url",className:"mb-2 block text-sm font-medium text-gray-700",children:u("market.addRegistryModal.urlLabel")}),e.jsx("input",{id:"registry-url",type:"url",value:t,onChange:f=>l(f.target.value),placeholder:u("market.addRegistryModal.urlPlaceholder"),className:"w-full rounded-lg border border-gray-300 px-4 py-3 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"registry-token-env",className:"mb-2 block text-sm font-medium text-gray-700",children:[u("market.addRegistryModal.tokenEnvLabel","Token Env Variable"),e.jsx("span",{className:"ml-1 text-xs font-normal text-gray-400",children:u("market.addRegistryModal.optional","(optional)")})]}),e.jsx("input",{id:"registry-token-env",type:"text",value:a,onChange:f=>d(f.target.value),placeholder:u("market.addRegistryModal.tokenEnvPlaceholder","e.g. GITHUB_TOKEN"),className:"w-full rounded-lg border border-gray-300 px-4 py-3 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"}),e.jsx("p",{className:"mt-1.5 text-xs text-gray-500",children:u("market.addRegistryModal.tokenEnvHint","Environment variable name for private GitHub PAT. The token value must be set in .env or shell profile.")})]}),e.jsx("div",{className:"rounded-xl border border-blue-200 bg-blue-50 px-4 py-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-white text-blue-600",children:e.jsx(Be,{size:18})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-blue-900",children:u("market.addRegistryModal.compatibilityTitle")}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-blue-800",children:u("market.addRegistryModal.compatibilityDescription")})]})]})}),r&&e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-red-700",children:[e.jsx(K,{size:18,className:"mt-0.5 shrink-0"}),e.jsx("p",{className:"text-sm",children:r})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 px-6 py-4",children:[e.jsx("button",{type:"button",onClick:o,disabled:s,className:"rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200 disabled:cursor-not-allowed disabled:opacity-50",children:u("market.actions.cancel")}),e.jsxs("button",{type:"submit",disabled:s,className:"inline-flex items-center gap-2 rounded-lg bg-blue-500 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-50",children:[s?e.jsx(k,{size:16,className:"animate-spin"}):e.jsx(W,{size:16}),u("market.actions.addRegistry")]})]})]})]})})}function ht({registry:t,deleting:a,onDelete:r}){const{t:s,i18n:l}=N();return e.jsxs("article",{className:"flex flex-col gap-4 rounded-xl border border-gray-200 bg-white p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("div",{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl ${t.trustLevel!=="unverified"?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-500"}`,children:e.jsx(ge,{size:20})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"truncate text-base font-semibold text-gray-900",children:t.name}),e.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${t.isDefault?"bg-amber-50 text-amber-700":"bg-gray-100 text-gray-600"}`,children:t.isDefault?s("market.registryCard.defaultBadge"):s("market.registryCard.customBadge")})]}),e.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"mt-2 inline-flex break-all text-sm text-blue-600 hover:text-blue-700",children:[e.jsx("span",{children:t.url}),e.jsx(Oe,{size:14,className:"ml-1 mt-0.5 shrink-0"})]})]})]}),e.jsxs("button",{type:"button",onClick:()=>r(t.id),disabled:t.isDefault||a,className:`inline-flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${t.isDefault?"cursor-not-allowed bg-gray-100 text-gray-400":"bg-red-50 text-red-600 hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-50"}`,children:[a?e.jsx(k,{size:15,className:"animate-spin"}):e.jsx(ue,{size:15}),t.isDefault?s("market.registryCard.lockedAction"):s("market.actions.deleteRegistry")]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-3",children:[e.jsx("p",{className:"text-xs text-gray-500",children:s("market.registryCard.skillCount")}),e.jsx("p",{className:"mt-1 text-lg font-semibold text-gray-900",children:t.itemCount})]}),e.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-3",children:[e.jsx("p",{className:"text-xs text-gray-500",children:s("market.registryCard.addedAt")}),e.jsx("p",{className:"mt-1 text-sm font-medium text-gray-900",children:ve(t.addedAt,l.language)})]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:t.isDefault?s("market.registryCard.defaultHint"):s("market.registryCard.customHint")})]})}function ft({registries:t,loading:a,deletingRegistryId:r,onAdd:s,onClose:l,onDelete:d}){const{t:o}=N();return e.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{role:"dialog","aria-modal":"true",className:"flex max-h-[85vh] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-6 py-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:o("market.registryModal.title")}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:o("market.registryModal.description")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-2 rounded-lg bg-blue-500 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-600",children:[e.jsx(W,{size:16}),o("market.actions.addRegistry")]}),e.jsx("button",{type:"button",onClick:l,className:"rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200",children:o("market.actions.close")})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5",children:a?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(k,{size:22,className:"animate-spin text-gray-400"})}):t.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-gray-300 px-6 py-16 text-center",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 text-gray-400",children:e.jsx(ge,{size:20})}),e.jsx("h3",{className:"mt-4 text-base font-semibold text-gray-900",children:o("market.empty.registryTitle")}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:o("market.empty.registryDescription")})]}):e.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:t.map(m=>e.jsx(ht,{registry:m,deleting:r===m.id,onDelete:d},m.id))})})]})})}function oe({skill:t,selected:a,onSelect:r}){const{t:s,i18n:l}=N(),d=xt(t.updatedAt,l.language),o=J(t.type),m={skill:be,template:he,agent:me,workflow:je,plugin:fe},u={skill:t.isInstalled?"bg-blue-100 text-blue-600":"bg-gray-100 text-gray-500",template:"bg-amber-100 text-amber-700",agent:"bg-emerald-100 text-emerald-700",workflow:"bg-cyan-100 text-cyan-700",plugin:"bg-rose-100 text-rose-700"},c=m[o];return e.jsx("button",{type:"button",onClick:()=>r(t.name),className:`w-full rounded-xl border p-3 text-left transition-colors ${a?"border-blue-200 bg-blue-50 shadow-sm":"border-transparent bg-white hover:border-gray-200 hover:bg-gray-50"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl ${u[o]}`,children:e.jsx(c,{size:18})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-gray-900",children:t.displayName||t.name}),t.trustLevel==="trusted"&&e.jsx(xe,{className:"h-3.5 w-3.5 shrink-0 text-green-600"}),t.trustLevel==="verified"&&e.jsx(pe,{className:"h-3.5 w-3.5 shrink-0 text-blue-500"}),e.jsx(we,{type:t.type})]}),e.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-gray-500",children:t.description||s("market.card.noDescription")}),e.jsxs("p",{className:"mt-2 text-[11px] text-gray-400",children:[t.registryName||t.author||s("market.card.unknownAuthor"),d?` · ${s("market.list.updatedLabel",{time:d})}`:""]})]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[t.isInstalled&&e.jsx("span",{className:"rounded-full bg-green-100 px-2 py-0.5 text-[10px] font-medium text-green-700",children:s("market.badges.installed")}),t.hasUpdate&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-orange-50 px-2 py-0.5 text-[10px] font-medium text-orange-700",children:[e.jsx(ye,{size:10}),s("market.badges.updateAvailable",{version:t.remoteVersion})]})]})]})})}function A({icon:t,label:a,value:r}){return e.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[e.jsx("span",{className:"text-gray-400",children:t}),e.jsx("span",{children:a})]}),e.jsx("p",{className:"mt-2 text-sm font-semibold text-gray-900",children:r})]})}function bt({skill:t,markdownBody:a,descriptionLoading:r,descriptionError:s,busy:l,canInstall:d,onInstall:o,onUninstall:m,onRefresh:u}){const{t:c,i18n:f}=N(),p=typeof(t==null?void 0:t.installCount)=="number";return t?e.jsxs("section",{className:"flex h-full min-h-[520px] flex-col rounded-2xl border border-gray-200 bg-white p-6 shadow-sm",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-gray-200 pb-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h2",{className:"text-2xl font-semibold text-gray-900",children:t.displayName||t.name}),e.jsxs("span",{className:"rounded-full bg-gray-100 px-2.5 py-1 text-xs font-medium text-gray-600",children:["v",t.version]}),t.hasUpdate&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-orange-50 px-2.5 py-1 text-xs font-medium text-orange-700",children:[e.jsx(ye,{size:12}),c("market.badges.updateAvailable",{version:t.remoteVersion})]}),e.jsx(we,{type:t.type}),e.jsx(gt,{level:t.trustLevel})]}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:t.registryName||t.author||c("market.card.unknownAuthor")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.isInstalled?e.jsxs("button",{type:"button",onClick:()=>m(t.name),disabled:l,className:"inline-flex items-center gap-2 rounded-lg bg-red-50 px-4 py-2 text-sm font-medium text-red-600 transition-colors hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-50",children:[l?e.jsx(k,{size:16,className:"animate-spin"}):e.jsx(ue,{size:16}),c("market.actions.uninstall")]}):(()=>{const y=ke(t);return y.allowed?e.jsxs("button",{type:"button",onClick:()=>o(t),disabled:l||!d,className:"inline-flex items-center gap-2 rounded-lg bg-blue-500 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-50",children:[l?e.jsx(k,{size:16,className:"animate-spin"}):e.jsx(W,{size:16}),c("market.actions.install")]}):e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-400",children:[e.jsx(U,{size:16}),c(y.reason)]})})(),e.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-2 rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200",children:[e.jsx(ce,{size:16}),c("market.actions.checkUpdates")]})]})]}),e.jsxs("div",{className:"space-y-6 py-6",children:[t.isCustomized&&t.hasUpdate&&e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3",children:[e.jsx(K,{size:16,className:"mt-0.5 shrink-0 text-amber-600"}),e.jsx("p",{className:"text-sm text-amber-800",children:c("market.badges.customizedWarning")})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:c("market.detail.description")}),e.jsx("div",{className:"mt-2",children:r?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsx(k,{size:16,className:"animate-spin"}),e.jsx("span",{children:c("market.detail.loadingBody")})]}):t.isInstalled?a!=null&&a.trim()?e.jsx(Ve,{content:a,className:"text-sm"}):e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{className:"mb-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:s}),e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-6 text-gray-600",children:t.description||c("market.card.noDescription")})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-6 text-gray-600",children:t.description||c("market.card.noDescription")}),e.jsx("div",{className:"rounded-xl border border-blue-200 bg-blue-50 px-4 py-3 text-sm text-blue-800",children:c("market.detail.installToViewBody")})]})})]}),t.tags.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:c("market.detail.tags")}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.tags.map(y=>e.jsxs("span",{className:"rounded-full border border-gray-200 bg-gray-50 px-2.5 py-1 text-xs text-gray-600",children:["#",y]},y))})]}),t.authors&&t.authors.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:c("market.detail.developers")}),e.jsx("div",{className:"mt-3 space-y-3",children:t.authors.map(y=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:y.avatarUrl,alt:`@${y.login}`,className:"h-8 w-8 rounded-full border border-gray-200 object-cover"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium text-gray-900",children:y.name||y.login}),e.jsxs("div",{className:"text-xs text-gray-500",children:["@",y.login]})]}),typeof y.contributions=="number"&&e.jsx("div",{className:"text-xs text-gray-400",children:c("market.detail.contributions",{count:y.contributions})})]},`${t.name}-${y.login}`))})]})]}),e.jsxs("div",{className:`mt-auto grid gap-3 border-t border-gray-200 pt-6 sm:grid-cols-2 ${p?"xl:grid-cols-4":"xl:grid-cols-3"}`,children:[e.jsx(A,{icon:e.jsx(st,{size:14}),label:c("market.detail.stats.stars"),value:de(t.stars,f.language)}),p&&e.jsx(A,{icon:e.jsx(Fe,{size:14}),label:c("market.detail.stats.installs"),value:de(t.installCount,f.language)}),e.jsx(A,{icon:e.jsx(Xe,{size:14}),label:c("market.detail.stats.license"),value:t.license||c("market.detail.unavailable")}),e.jsx(A,{icon:e.jsx(Ge,{size:14}),label:c("market.detail.stats.updatedAt"),value:ve(t.updatedAt,f.language)})]})]}):e.jsx("div",{className:"flex h-full min-h-[520px] items-center justify-center rounded-2xl border border-gray-200 bg-white p-8 shadow-sm",children:e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 text-gray-400",children:e.jsx(Pe,{size:20})}),e.jsx("h3",{className:"mt-4 text-base font-semibold text-gray-900",children:c("market.detail.emptyTitle")}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:c("market.detail.emptyDescription")})]})})}function Nt(){const{t}=N(),{setPageHeader:a}=Ue(),[r,s]=g.useState(!1),[l,d]=g.useState(!1),[o,m]=g.useState(""),[u,c]=g.useState(""),[f,p]=g.useState(null),[y,P]=g.useState({}),[M,v]=g.useState(null),[Ie,R]=g.useState(null),[D,V]=g.useState(null),{initialized:Z,loading:L,savingRegistry:Ce,deletingRegistryId:Me,mutatingItemName:ze,error:X,registries:Re,officialRegistryId:F,allItems:I,activeFilter:C,searchQuery:B,selectedItemName:T,setActiveFilter:De,setSearchQuery:Le,setSelectedItem:_,initialize:Y,refresh:$,addRegistry:ee,deleteRegistry:te,installItem:ae,uninstallItem:se,clearError:E}=mt();g.useEffect(()=>{Z||Y().catch(()=>{})},[Z,Y]);const re=g.useMemo(()=>I.filter(n=>n.isInstalled).length,[I]),w=g.useMemo(()=>{const n=B.trim().toLowerCase();return I.filter(x=>C==="installed"&&!x.isInstalled||C!=="all"&&C!=="installed"&&J(x.type)!==C?!1:n?[x.displayName,x.name,x.description,x.author,x.registryName,...x.tags].filter(h=>!!h).some(h=>h.toLowerCase().includes(n)):!0)},[C,I,B]),i=g.useMemo(()=>w.find(n=>n.name===T)??w[0]??null,[w,T]),O=i?y[i.name]:void 0;g.useEffect(()=>{const n=(i==null?void 0:i.name)??null;n!==T&&_(n)},[i,T,_]),g.useEffect(()=>{if(!(i!=null&&i.isInstalled)){R(null),v(h=>h===(i==null?void 0:i.name)?null:h);return}if(O!==void 0){R(null);return}let n=!1;const x=i.name;return v(x),R(null),j.getInstalledMarketDetail(x).then(h=>{n||P(Ae=>({...Ae,[x]:h.body??""}))}).catch(h=>{n||R(h instanceof Error?h.message:t("market.errors.detailLoad"))}).finally(()=>{n||v(h=>h===x?null:h)}),()=>{n=!0}},[i==null?void 0:i.isInstalled,i==null?void 0:i.name,O,t]);const H=g.useCallback(n=>{n&&P(x=>{if(!(n in x))return x;const h={...x};return delete h[n],h})},[]);g.useEffect(()=>{a({title:t("market.title"),subtitle:t("market.subtitle.summary",{total:I.length,installed:re}),actions:e.jsxs("button",{type:"button",onClick:()=>{E(),H((i==null?void 0:i.name)??null),$().catch(()=>{})},className:"inline-flex items-center gap-2 rounded-lg bg-gray-100 px-3 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200",children:[e.jsx(ce,{size:16,className:L?"animate-spin":""}),t("market.actions.refresh")]})})},[I.length,E,L,$,H,i==null?void 0:i.name,a,t,re]);const Q=g.useCallback(n=>{const x=n.registryId??F;x&&ae(x,n.name).catch(()=>{})},[ae,F]),Te=g.useCallback(n=>{const x=ke(n);if(x.allowed){if(x.needsConfirm){V(n);return}Q(n)}},[Q]),_e=g.useCallback(n=>{window.confirm(t("market.actions.confirmUninstall",{name:n}))&&se(n).catch(()=>{})},[t,se]),$e=g.useCallback(n=>{te(n).catch(()=>{})},[te]),Ee=g.useCallback(async()=>{p(null);try{await ee(o,u||void 0),m(""),c(""),d(!1)}catch(n){p(n instanceof Error?n.message:t("market.errors.addRegistry"))}},[ee,o,u,t]),q=w.filter(n=>n.isInstalled),ne=w.filter(n=>!n.isInstalled);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-6",children:[X&&e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-red-700",children:[e.jsx(K,{size:18,className:"mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t("market.errors.bannerTitle")}),e.jsx("p",{className:"mt-1 break-words text-sm",children:X})]}),e.jsx("button",{type:"button",onClick:()=>{E(),$().catch(()=>{})},className:"shrink-0 rounded-md bg-red-100 px-3 py-1.5 text-xs font-medium text-red-700 transition-colors hover:bg-red-200",children:t("market.actions.retry")})]}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-2xl border border-gray-200 bg-white p-4 shadow-sm lg:flex-row lg:items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(le,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"search",value:B,onChange:n=>Le(n.target.value),placeholder:t("market.searchPlaceholder"),className:"w-full rounded-xl border border-gray-300 py-2.5 pl-10 pr-4 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("button",{type:"button",onClick:()=>s(!0),className:"inline-flex items-center justify-center gap-2 rounded-xl border border-gray-200 bg-gray-50 px-4 py-2.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100",children:[e.jsx(et,{size:16}),t("market.actions.manageSources")]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:["all","installed","skill","template","agent","workflow","plugin"].map(n=>e.jsx("button",{type:"button",onClick:()=>De(n),className:`rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${C===n?"border-blue-500 bg-blue-500 text-white":"border-gray-200 bg-white text-gray-600 hover:bg-gray-50"}`,children:t(`market.filters.${n}`)},n))}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs("section",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm",children:[e.jsxs("div",{className:"border-b border-gray-200 px-4 py-3",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-900",children:t("market.list.title")}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:t("market.list.count",{count:w.length})})]}),e.jsx("div",{className:"max-h-[640px] overflow-y-auto p-3",children:L?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(k,{size:22,className:"animate-spin text-gray-400"})}):w.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-gray-300 px-4 py-12 text-center",children:[e.jsx("div",{className:"mx-auto flex h-10 w-10 items-center justify-center rounded-full bg-gray-100 text-gray-400",children:e.jsx(le,{size:18})}),e.jsx("h3",{className:"mt-3 text-sm font-semibold text-gray-900",children:t("market.empty.filteredTitle")}),e.jsx("p",{className:"mt-2 text-xs leading-5 text-gray-500",children:t("market.empty.filteredDescription")})]}):e.jsxs("div",{className:"space-y-3",children:[q.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"px-1 text-xs font-semibold uppercase tracking-wide text-gray-400",children:t("market.list.installedHeading")}),q.map(n=>e.jsx(oe,{skill:n,selected:(i==null?void 0:i.name)===n.name,onSelect:_},`${n.registryId??"_"}:${n.name}`))]}),ne.length>0&&e.jsxs("div",{className:"space-y-2",children:[q.length>0&&e.jsx("p",{className:"px-1 pt-2 text-xs font-semibold uppercase tracking-wide text-gray-400",children:t("market.list.availableHeading")}),ne.map(n=>e.jsx(oe,{skill:n,selected:(i==null?void 0:i.name)===n.name,onSelect:_},`${n.registryId??"_"}:${n.name}`))]})]})})]}),e.jsx(bt,{skill:i,markdownBody:O,descriptionLoading:i?M===i.name:!1,descriptionError:Ie,busy:i?ze===i.name:!1,canInstall:!!((i==null?void 0:i.registryId)??F),onInstall:Te,onUninstall:_e,onRefresh:()=>{E(),H((i==null?void 0:i.name)??null),$().catch(()=>{})}})]})]}),r&&e.jsx(ft,{registries:Re,loading:L,deletingRegistryId:Me,onAdd:()=>{p(null),m(""),c(""),d(!0)},onClose:()=>s(!1),onDelete:$e}),l&&e.jsx(yt,{url:o,tokenEnv:u,error:f,submitting:Ce,onChangeUrl:m,onChangeTokenEnv:c,onClose:()=>{p(null),d(!1)},onSubmit:Ee}),D&&e.jsx(pt,{itemName:D.displayName||D.name,onConfirm:()=>{Q(D),V(null)},onCancel:()=>V(null)})]})}export{Nt as default};
|
|
56
|
+
*/const rt=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],je=b("workflow",rt);function z(t){return t instanceof Error?t.message:String(t)}function nt(t){return[...t].sort((a,r)=>a.isInstalled!==r.isInstalled?a.isInstalled?-1:1:(a.displayName||a.name).localeCompare(r.displayName||r.name))}const ie={trusted:2,verified:1,unverified:0};function Ne(t,a){return ie[t]>=ie[a]?t:a}function lt(t=[],a=[]){return Array.from(new Set([...t,...a]))}function it(t,a){var s;if(!t)return a;const r=Ne(t.trustLevel,a.trustLevel);return{...t,...a,displayName:a.displayName||t.displayName||a.name,description:a.description||t.description,author:a.author||t.author,version:a.version||t.version,tags:lt(t.tags,a.tags),type:a.type||t.type,trustLevel:r,isVerified:r!=="unverified",isInstalled:t.isInstalled||a.isInstalled,registryId:a.registryId??t.registryId,registryName:a.registryName??t.registryName,installSource:a.installSource??t.installSource,hasUpdate:a.hasUpdate??t.hasUpdate,remoteVersion:a.remoteVersion??t.remoteVersion,isCustomized:a.isCustomized??t.isCustomized,authors:(s=a.authors)!=null&&s.length?a.authors:t.authors,updatedAt:a.updatedAt??t.updatedAt,stars:a.stars??t.stars,license:a.license??t.license,installCount:a.installCount??t.installCount}}function S(t){const a=new Map;for(const s of t){const l=a.get(s.name)??[];l.push(s),a.set(s.name,l)}const r=[];for(const[,s]of a){if(s.length===1){r.push(s[0]);continue}const l=new Map;for(const d of s){const o=d.registryId??"_local",m=l.get(o);l.set(o,it(m,d))}r.push(...l.values())}return nt(r)}function dt(t,a){return t.map(r=>{const s=Ne(r.trustLevel,a.trustLevel);return{...r,registryId:r.registryId??a.id,registryName:r.registryName??a.name,trustLevel:s,isVerified:s!=="unverified"}})}function ot(t){return t.find(a=>a.isDefault)??t.find(a=>a.trustLevel!=="unverified")??t[0]??null}function ct(t,a){return S([...t,...a])}function G(t,a){var r;return a&&t.some(s=>s.name===a)?a:((r=t[0])==null?void 0:r.name)??null}const mt=Se((t,a)=>({initialized:!1,loading:!1,loadingOfficial:!1,loadingInstalled:!1,savingRegistry:!1,deletingRegistryId:null,mutatingItemName:null,error:null,registries:[],officialRegistryId:null,allItems:[],activeFilter:"all",searchQuery:"",selectedItemName:null,setActiveFilter:r=>t({activeFilter:r}),setSearchQuery:r=>t({searchQuery:r}),setSelectedItem:r=>t({selectedItemName:r}),initialize:async()=>{const r=a().selectedItemName;t({loading:!0,loadingOfficial:!0,loadingInstalled:!0,error:null});try{const l=(await j.getMarketRegistries()).registries,d=ot(l),[o,m]=await Promise.all([Promise.allSettled(l.map(p=>j.getRegistryMarketItems(p.id).then(y=>dt(y.items,p)))),j.getInstalledMarkets()]),u=o.filter(p=>p.status==="fulfilled").flatMap(p=>p.value),c=S(m.items.filter(p=>!p.source||p.source==="local")),f=ct(u,c);t({initialized:!0,loading:!1,loadingOfficial:!1,loadingInstalled:!1,registries:l,officialRegistryId:(d==null?void 0:d.id)??null,allItems:f,selectedItemName:G(f,r)}),j.checkMarketUpdates().then(p=>{!p||Object.keys(p).length===0||t(y=>({allItems:y.allItems.map(M=>{const v=p[M.name];return v?{...M,hasUpdate:v.hasUpdate,remoteVersion:v.remoteVersion,isCustomized:v.isCustomized}:M})}))}).catch(()=>{})}catch(s){throw t({loading:!1,loadingOfficial:!1,loadingInstalled:!1,error:z(s)}),s}},refresh:async()=>{await a().initialize()},addRegistry:async(r,s)=>{const l=r.trim();if(!l){const d=new Error("Registry URL is required");throw t({error:d.message}),d}t({savingRegistry:!0,error:null});try{const d=(s==null?void 0:s.trim())||void 0;await j.addMarketRegistry(l,d),await a().initialize(),t({savingRegistry:!1})}catch(d){throw t({savingRegistry:!1,error:z(d)}),d}},deleteRegistry:async r=>{t({deletingRegistryId:r,error:null});try{await j.deleteMarketRegistry(r),await a().initialize(),t({deletingRegistryId:null})}catch(s){throw t({deletingRegistryId:null,error:z(s)}),s}},installItem:async(r,s)=>{t({mutatingItemName:s,error:null});try{await j.installMarketItem(r,s),t(l=>{const d=l.registries.find(m=>m.id===r),o=S(l.allItems.map(m=>m.name===s?{...m,isInstalled:!0,registryId:m.registryId??r,registryName:m.registryName??(d==null?void 0:d.name)}:m));return{allItems:o,mutatingItemName:null,selectedItemName:G(o,l.selectedItemName??s)}})}catch(l){throw t({mutatingItemName:null,error:z(l)}),l}},uninstallItem:async r=>{t({mutatingItemName:r,error:null});try{await j.uninstallMarketItem(r),t(s=>{const l=S(s.allItems.map(d=>d.name===r?{...d,isInstalled:!1}:d));return{allItems:l,mutatingItemName:null,selectedItemName:G(l,s.selectedItemName)}})}catch(s){throw t({mutatingItemName:null,error:z(s)}),s}},clearError:()=>t({error:null})}));function ve(t,a){if(!t)return"—";const r=new Date(t);return Number.isNaN(r.getTime())?"—":new Intl.DateTimeFormat(a,{year:"numeric",month:"short",day:"numeric"}).format(r)}function xt(t,a){if(!t)return null;const r=new Date(t);if(Number.isNaN(r.getTime()))return null;const s=r.getTime()-Date.now(),l=[{unit:"year",ms:1e3*60*60*24*365},{unit:"month",ms:1e3*60*60*24*30},{unit:"week",ms:1e3*60*60*24*7},{unit:"day",ms:1e3*60*60*24},{unit:"hour",ms:1e3*60*60},{unit:"minute",ms:1e3*60}],d=new Intl.RelativeTimeFormat(a,{numeric:"auto"});for(const o of l)if(Math.abs(s)>=o.ms||o.unit==="minute")return d.format(Math.round(s/o.ms),o.unit);return null}function de(t,a){return typeof t!="number"?"—":new Intl.NumberFormat(a,{notation:"compact",compactDisplay:"short",maximumFractionDigits:1}).format(t)}function J(t){switch(t==null?void 0:t.toLowerCase()){case"template":return"template";case"agent":return"agent";case"workflow":return"workflow";case"plugin":return"plugin";default:return"skill"}}function ke({type:t}){const{t:a}=N(),r=J(t),s={skill:"bg-violet-50 text-violet-700",template:"bg-amber-50 text-amber-700",agent:"bg-emerald-50 text-emerald-700",workflow:"bg-cyan-50 text-cyan-700",plugin:"bg-rose-50 text-rose-700"},l={skill:be,template:he,agent:me,workflow:je,plugin:fe},d={skill:a("market.types.skill"),template:a("market.types.template"),agent:a("market.types.agent"),workflow:a("market.types.workflow"),plugin:a("market.types.plugin")},o=l[r];return e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${s[r]}`,children:[e.jsx(o,{size:12}),d[r]]})}const ut={trusted:{bg:"bg-green-50",text:"text-green-700",icon:xe,label:"market.badges.trusted"},verified:{bg:"bg-blue-50",text:"text-blue-700",icon:pe,label:"market.badges.verified"},unverified:{bg:"bg-gray-50",text:"text-gray-500",icon:U,label:"market.badges.unverified"}};function gt({level:t}){const{t:a}=N(),r=ut[t],s=r.icon;return e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium ${r.bg} ${r.text}`,children:[e.jsx(s,{size:13}),a(r.label)]})}function we(t){if(t.trustLevel==="unverified"){if(t.type==="plugin")return{allowed:!1,reason:"market.trust.blockedPlugin"};if(t.type==="exec")return{allowed:!1,reason:"market.trust.blockedExec"}}return t.trustLevel==="verified"&&t.type==="plugin"?{allowed:!0,needsConfirm:!0}:{allowed:!0}}function pt({itemName:t,onConfirm:a,onCancel:r}){const{t:s}=N();return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{role:"dialog","aria-modal":"true",className:"w-full max-w-md overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl",children:[e.jsxs("div",{className:"border-b border-gray-200 px-6 py-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:s("market.pluginDialog.title")}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s("market.pluginDialog.description")})]}),e.jsxs("div",{className:"space-y-3 px-6 py-5",children:[e.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-amber-900",children:t}),e.jsx("p",{className:"mt-1 text-sm text-amber-800",children:s("market.pluginDialog.warning")})]}),e.jsxs("ul",{className:"space-y-2 text-sm text-gray-600",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(U,{size:14,className:"shrink-0 text-amber-500"}),s("market.pluginDialog.perm1")]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(U,{size:14,className:"shrink-0 text-amber-500"}),s("market.pluginDialog.perm2")]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 px-6 py-4",children:[e.jsx("button",{type:"button",onClick:r,className:"rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200",children:s("market.actions.cancel")}),e.jsx("button",{type:"button",onClick:a,className:"rounded-lg bg-red-500 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-red-600",children:s("market.actions.install")})]})]})})}function yt({url:t,tokenEnv:a,error:r,submitting:s,onChangeUrl:l,onChangeTokenEnv:d,onClose:o,onSubmit:m}){const{t:u}=N(),c=f=>{f.preventDefault(),m()};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{role:"dialog","aria-modal":"true",className:"w-full max-w-xl overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl",children:[e.jsxs("div",{className:"border-b border-gray-200 px-6 py-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:u("market.addRegistryModal.title")}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:u("market.addRegistryModal.description")})]}),e.jsxs("form",{onSubmit:c,children:[e.jsxs("div",{className:"space-y-4 px-6 py-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"registry-url",className:"mb-2 block text-sm font-medium text-gray-700",children:u("market.addRegistryModal.urlLabel")}),e.jsx("input",{id:"registry-url",type:"url",value:t,onChange:f=>l(f.target.value),placeholder:u("market.addRegistryModal.urlPlaceholder"),className:"w-full rounded-lg border border-gray-300 px-4 py-3 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"registry-token-env",className:"mb-2 block text-sm font-medium text-gray-700",children:[u("market.addRegistryModal.tokenEnvLabel","Token Env Variable"),e.jsx("span",{className:"ml-1 text-xs font-normal text-gray-400",children:u("market.addRegistryModal.optional","(optional)")})]}),e.jsx("input",{id:"registry-token-env",type:"text",value:a,onChange:f=>d(f.target.value),placeholder:u("market.addRegistryModal.tokenEnvPlaceholder","e.g. GITHUB_TOKEN"),className:"w-full rounded-lg border border-gray-300 px-4 py-3 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"}),e.jsx("p",{className:"mt-1.5 text-xs text-gray-500",children:u("market.addRegistryModal.tokenEnvHint","Environment variable name for private GitHub PAT. The token value must be set in .env or shell profile.")})]}),e.jsx("div",{className:"rounded-xl border border-blue-200 bg-blue-50 px-4 py-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-white text-blue-600",children:e.jsx(Be,{size:18})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-blue-900",children:u("market.addRegistryModal.compatibilityTitle")}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-blue-800",children:u("market.addRegistryModal.compatibilityDescription")})]})]})}),r&&e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-red-700",children:[e.jsx(K,{size:18,className:"mt-0.5 shrink-0"}),e.jsx("p",{className:"text-sm",children:r})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 px-6 py-4",children:[e.jsx("button",{type:"button",onClick:o,disabled:s,className:"rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200 disabled:cursor-not-allowed disabled:opacity-50",children:u("market.actions.cancel")}),e.jsxs("button",{type:"submit",disabled:s,className:"inline-flex items-center gap-2 rounded-lg bg-blue-500 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-50",children:[s?e.jsx(w,{size:16,className:"animate-spin"}):e.jsx(W,{size:16}),u("market.actions.addRegistry")]})]})]})]})})}function ht({registry:t,deleting:a,onDelete:r}){const{t:s,i18n:l}=N();return e.jsxs("article",{className:"flex flex-col gap-4 rounded-xl border border-gray-200 bg-white p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("div",{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl ${t.trustLevel!=="unverified"?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-500"}`,children:e.jsx(ge,{size:20})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"truncate text-base font-semibold text-gray-900",children:t.name}),e.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${t.isDefault?"bg-amber-50 text-amber-700":"bg-gray-100 text-gray-600"}`,children:t.isDefault?s("market.registryCard.defaultBadge"):s("market.registryCard.customBadge")})]}),e.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"mt-2 inline-flex break-all text-sm text-blue-600 hover:text-blue-700",children:[e.jsx("span",{children:t.url}),e.jsx(Oe,{size:14,className:"ml-1 mt-0.5 shrink-0"})]})]})]}),e.jsxs("button",{type:"button",onClick:()=>r(t.id),disabled:t.isDefault||a,className:`inline-flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${t.isDefault?"cursor-not-allowed bg-gray-100 text-gray-400":"bg-red-50 text-red-600 hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-50"}`,children:[a?e.jsx(w,{size:15,className:"animate-spin"}):e.jsx(ue,{size:15}),t.isDefault?s("market.registryCard.lockedAction"):s("market.actions.deleteRegistry")]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-3",children:[e.jsx("p",{className:"text-xs text-gray-500",children:s("market.registryCard.skillCount")}),e.jsx("p",{className:"mt-1 text-lg font-semibold text-gray-900",children:t.itemCount})]}),e.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-3",children:[e.jsx("p",{className:"text-xs text-gray-500",children:s("market.registryCard.addedAt")}),e.jsx("p",{className:"mt-1 text-sm font-medium text-gray-900",children:ve(t.addedAt,l.language)})]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:t.isDefault?s("market.registryCard.defaultHint"):s("market.registryCard.customHint")})]})}function ft({registries:t,loading:a,deletingRegistryId:r,onAdd:s,onClose:l,onDelete:d}){const{t:o}=N();return e.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center bg-black/40 p-4",children:e.jsxs("div",{role:"dialog","aria-modal":"true",className:"flex max-h-[85vh] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-6 py-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:o("market.registryModal.title")}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:o("market.registryModal.description")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-2 rounded-lg bg-blue-500 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-600",children:[e.jsx(W,{size:16}),o("market.actions.addRegistry")]}),e.jsx("button",{type:"button",onClick:l,className:"rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200",children:o("market.actions.close")})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5",children:a?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(w,{size:22,className:"animate-spin text-gray-400"})}):t.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-gray-300 px-6 py-16 text-center",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 text-gray-400",children:e.jsx(ge,{size:20})}),e.jsx("h3",{className:"mt-4 text-base font-semibold text-gray-900",children:o("market.empty.registryTitle")}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:o("market.empty.registryDescription")})]}):e.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:t.map(m=>e.jsx(ht,{registry:m,deleting:r===m.id,onDelete:d},m.id))})})]})})}function oe({skill:t,selected:a,onSelect:r}){const{t:s,i18n:l}=N(),d=xt(t.updatedAt,l.language),o=J(t.type),m={skill:be,template:he,agent:me,workflow:je,plugin:fe},u={skill:t.isInstalled?"bg-blue-100 text-blue-600":"bg-gray-100 text-gray-500",template:"bg-amber-100 text-amber-700",agent:"bg-emerald-100 text-emerald-700",workflow:"bg-cyan-100 text-cyan-700",plugin:"bg-rose-100 text-rose-700"},c=m[o];return e.jsx("button",{type:"button",onClick:()=>r(t.name),className:`w-full rounded-xl border p-3 text-left transition-colors ${a?"border-blue-200 bg-blue-50 shadow-sm":"border-transparent bg-white hover:border-gray-200 hover:bg-gray-50"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl ${u[o]}`,children:e.jsx(c,{size:18})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-gray-900",children:t.displayName||t.name}),t.trustLevel==="trusted"&&e.jsx(xe,{className:"h-3.5 w-3.5 shrink-0 text-green-600"}),t.trustLevel==="verified"&&e.jsx(pe,{className:"h-3.5 w-3.5 shrink-0 text-blue-500"}),e.jsx(ke,{type:t.type})]}),e.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-gray-500",children:t.description||s("market.card.noDescription")}),e.jsxs("p",{className:"mt-2 text-[11px] text-gray-400",children:[t.registryName||t.author||s("market.card.unknownAuthor"),d?` · ${s("market.list.updatedLabel",{time:d})}`:""]})]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[t.isInstalled&&e.jsx("span",{className:"rounded-full bg-green-100 px-2 py-0.5 text-[10px] font-medium text-green-700",children:s("market.badges.installed")}),t.hasUpdate&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-orange-50 px-2 py-0.5 text-[10px] font-medium text-orange-700",children:[e.jsx(ye,{size:10}),s("market.badges.updateAvailable",{version:t.remoteVersion})]})]})]})})}function A({icon:t,label:a,value:r}){return e.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[e.jsx("span",{className:"text-gray-400",children:t}),e.jsx("span",{children:a})]}),e.jsx("p",{className:"mt-2 text-sm font-semibold text-gray-900",children:r})]})}function bt({skill:t,markdownBody:a,descriptionLoading:r,descriptionError:s,busy:l,canInstall:d,onInstall:o,onUninstall:m,onRefresh:u}){const{t:c,i18n:f}=N(),p=typeof(t==null?void 0:t.installCount)=="number";return t?e.jsxs("section",{className:"flex h-full min-h-[520px] flex-col rounded-2xl border border-gray-200 bg-white p-6 shadow-sm",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-gray-200 pb-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h2",{className:"text-2xl font-semibold text-gray-900",children:t.displayName||t.name}),e.jsxs("span",{className:"rounded-full bg-gray-100 px-2.5 py-1 text-xs font-medium text-gray-600",children:["v",t.version]}),t.hasUpdate&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-orange-50 px-2.5 py-1 text-xs font-medium text-orange-700",children:[e.jsx(ye,{size:12}),c("market.badges.updateAvailable",{version:t.remoteVersion})]}),e.jsx(ke,{type:t.type}),e.jsx(gt,{level:t.trustLevel})]}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:t.registryName||t.author||c("market.card.unknownAuthor")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.isInstalled?e.jsxs("button",{type:"button",onClick:()=>m(t.name),disabled:l,className:"inline-flex items-center gap-2 rounded-lg bg-red-50 px-4 py-2 text-sm font-medium text-red-600 transition-colors hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-50",children:[l?e.jsx(w,{size:16,className:"animate-spin"}):e.jsx(ue,{size:16}),c("market.actions.uninstall")]}):(()=>{const y=we(t);return y.allowed?e.jsxs("button",{type:"button",onClick:()=>o(t),disabled:l||!d,className:"inline-flex items-center gap-2 rounded-lg bg-blue-500 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-50",children:[l?e.jsx(w,{size:16,className:"animate-spin"}):e.jsx(W,{size:16}),c("market.actions.install")]}):e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-400",children:[e.jsx(U,{size:16}),c(y.reason)]})})(),e.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-2 rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200",children:[e.jsx(ce,{size:16}),c("market.actions.checkUpdates")]})]})]}),e.jsxs("div",{className:"space-y-6 py-6",children:[t.isCustomized&&t.hasUpdate&&e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3",children:[e.jsx(K,{size:16,className:"mt-0.5 shrink-0 text-amber-600"}),e.jsx("p",{className:"text-sm text-amber-800",children:c("market.badges.customizedWarning")})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:c("market.detail.description")}),e.jsx("div",{className:"mt-2",children:r?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsx(w,{size:16,className:"animate-spin"}),e.jsx("span",{children:c("market.detail.loadingBody")})]}):t.isInstalled?a!=null&&a.trim()?e.jsx(Ve,{content:a,className:"text-sm"}):e.jsxs(e.Fragment,{children:[s&&e.jsx("div",{className:"mb-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:s}),e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-6 text-gray-600",children:t.description||c("market.card.noDescription")})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-6 text-gray-600",children:t.description||c("market.card.noDescription")}),e.jsx("div",{className:"rounded-xl border border-blue-200 bg-blue-50 px-4 py-3 text-sm text-blue-800",children:c("market.detail.installToViewBody")})]})})]}),t.tags.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:c("market.detail.tags")}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.tags.map(y=>e.jsxs("span",{className:"rounded-full border border-gray-200 bg-gray-50 px-2.5 py-1 text-xs text-gray-600",children:["#",y]},y))})]}),t.authors&&t.authors.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:c("market.detail.developers")}),e.jsx("div",{className:"mt-3 space-y-3",children:t.authors.map(y=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:y.avatarUrl,alt:`@${y.login}`,className:"h-8 w-8 rounded-full border border-gray-200 object-cover"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium text-gray-900",children:y.name||y.login}),e.jsxs("div",{className:"text-xs text-gray-500",children:["@",y.login]})]}),typeof y.contributions=="number"&&e.jsx("div",{className:"text-xs text-gray-400",children:c("market.detail.contributions",{count:y.contributions})})]},`${t.name}-${y.login}`))})]})]}),e.jsxs("div",{className:`mt-auto grid gap-3 border-t border-gray-200 pt-6 sm:grid-cols-2 ${p?"xl:grid-cols-4":"xl:grid-cols-3"}`,children:[e.jsx(A,{icon:e.jsx(st,{size:14}),label:c("market.detail.stats.stars"),value:de(t.stars,f.language)}),p&&e.jsx(A,{icon:e.jsx(Fe,{size:14}),label:c("market.detail.stats.installs"),value:de(t.installCount,f.language)}),e.jsx(A,{icon:e.jsx(Xe,{size:14}),label:c("market.detail.stats.license"),value:t.license||c("market.detail.unavailable")}),e.jsx(A,{icon:e.jsx(Ge,{size:14}),label:c("market.detail.stats.updatedAt"),value:ve(t.updatedAt,f.language)})]})]}):e.jsx("div",{className:"flex h-full min-h-[520px] items-center justify-center rounded-2xl border border-gray-200 bg-white p-8 shadow-sm",children:e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 text-gray-400",children:e.jsx(Pe,{size:20})}),e.jsx("h3",{className:"mt-4 text-base font-semibold text-gray-900",children:c("market.detail.emptyTitle")}),e.jsx("p",{className:"mt-2 text-sm text-gray-500",children:c("market.detail.emptyDescription")})]})})}function Nt(){const{t}=N(),{setPageHeader:a}=Ue(),[r,s]=g.useState(!1),[l,d]=g.useState(!1),[o,m]=g.useState(""),[u,c]=g.useState(""),[f,p]=g.useState(null),[y,P]=g.useState({}),[M,v]=g.useState(null),[Ie,R]=g.useState(null),[D,V]=g.useState(null),{initialized:Z,loading:L,savingRegistry:Ce,deletingRegistryId:Me,mutatingItemName:ze,error:X,registries:Re,officialRegistryId:F,allItems:I,activeFilter:C,searchQuery:B,selectedItemName:T,setActiveFilter:De,setSearchQuery:Le,setSelectedItem:_,initialize:Y,refresh:$,addRegistry:ee,deleteRegistry:te,installItem:ae,uninstallItem:se,clearError:E}=mt();g.useEffect(()=>{Z||Y().catch(()=>{})},[Z,Y]);const re=g.useMemo(()=>I.filter(n=>n.isInstalled).length,[I]),k=g.useMemo(()=>{const n=B.trim().toLowerCase();return I.filter(x=>C==="installed"&&!x.isInstalled||C!=="all"&&C!=="installed"&&J(x.type)!==C?!1:n?[x.displayName,x.name,x.description,x.author,x.registryName,...x.tags].filter(h=>!!h).some(h=>h.toLowerCase().includes(n)):!0)},[C,I,B]),i=g.useMemo(()=>k.find(n=>n.name===T)??k[0]??null,[k,T]),O=i?y[i.name]:void 0;g.useEffect(()=>{const n=(i==null?void 0:i.name)??null;n!==T&&_(n)},[i,T,_]),g.useEffect(()=>{if(!(i!=null&&i.isInstalled)){R(null),v(h=>h===(i==null?void 0:i.name)?null:h);return}if(O!==void 0){R(null);return}let n=!1;const x=i.name;return v(x),R(null),j.getInstalledMarketDetail(x).then(h=>{n||P(Ae=>({...Ae,[x]:h.body??""}))}).catch(h=>{n||R(h instanceof Error?h.message:t("market.errors.detailLoad"))}).finally(()=>{n||v(h=>h===x?null:h)}),()=>{n=!0}},[i==null?void 0:i.isInstalled,i==null?void 0:i.name,O,t]);const H=g.useCallback(n=>{n&&P(x=>{if(!(n in x))return x;const h={...x};return delete h[n],h})},[]);g.useEffect(()=>{a({title:t("market.title"),subtitle:t("market.subtitle.summary",{total:I.length,installed:re}),actions:e.jsxs("button",{type:"button",onClick:()=>{E(),H((i==null?void 0:i.name)??null),$().catch(()=>{})},className:"inline-flex items-center gap-2 rounded-lg bg-gray-100 px-3 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200",children:[e.jsx(ce,{size:16,className:L?"animate-spin":""}),t("market.actions.refresh")]})})},[I.length,E,L,$,H,i==null?void 0:i.name,a,t,re]);const Q=g.useCallback(n=>{const x=n.registryId??F;x&&ae(x,n.name).catch(()=>{})},[ae,F]),Te=g.useCallback(n=>{const x=we(n);if(x.allowed){if(x.needsConfirm){V(n);return}Q(n)}},[Q]),_e=g.useCallback(n=>{window.confirm(t("market.actions.confirmUninstall",{name:n}))&&se(n).catch(()=>{})},[t,se]),$e=g.useCallback(n=>{te(n).catch(()=>{})},[te]),Ee=g.useCallback(async()=>{p(null);try{await ee(o,u||void 0),m(""),c(""),d(!1)}catch(n){p(n instanceof Error?n.message:t("market.errors.addRegistry"))}},[ee,o,u,t]),q=k.filter(n=>n.isInstalled),ne=k.filter(n=>!n.isInstalled);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-6",children:[X&&e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-red-700",children:[e.jsx(K,{size:18,className:"mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t("market.errors.bannerTitle")}),e.jsx("p",{className:"mt-1 break-words text-sm",children:X})]}),e.jsx("button",{type:"button",onClick:()=>{E(),$().catch(()=>{})},className:"shrink-0 rounded-md bg-red-100 px-3 py-1.5 text-xs font-medium text-red-700 transition-colors hover:bg-red-200",children:t("market.actions.retry")})]}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-2xl border border-gray-200 bg-white p-4 shadow-sm lg:flex-row lg:items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(le,{size:16,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"search",value:B,onChange:n=>Le(n.target.value),placeholder:t("market.searchPlaceholder"),className:"w-full rounded-xl border border-gray-300 py-2.5 pl-10 pr-4 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("button",{type:"button",onClick:()=>s(!0),className:"inline-flex items-center justify-center gap-2 rounded-xl border border-gray-200 bg-gray-50 px-4 py-2.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100",children:[e.jsx(et,{size:16}),t("market.actions.manageSources")]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:["all","installed","skill","template","agent"].map(n=>e.jsx("button",{type:"button",onClick:()=>De(n),className:`rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ${C===n?"border-blue-500 bg-blue-500 text-white":"border-gray-200 bg-white text-gray-600 hover:bg-gray-50"}`,children:t(`market.filters.${n}`)},n))}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs("section",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm",children:[e.jsxs("div",{className:"border-b border-gray-200 px-4 py-3",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-900",children:t("market.list.title")}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:t("market.list.count",{count:k.length})})]}),e.jsx("div",{className:"max-h-[640px] overflow-y-auto p-3",children:L?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(w,{size:22,className:"animate-spin text-gray-400"})}):k.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-gray-300 px-4 py-12 text-center",children:[e.jsx("div",{className:"mx-auto flex h-10 w-10 items-center justify-center rounded-full bg-gray-100 text-gray-400",children:e.jsx(le,{size:18})}),e.jsx("h3",{className:"mt-3 text-sm font-semibold text-gray-900",children:t("market.empty.filteredTitle")}),e.jsx("p",{className:"mt-2 text-xs leading-5 text-gray-500",children:t("market.empty.filteredDescription")})]}):e.jsxs("div",{className:"space-y-3",children:[q.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"px-1 text-xs font-semibold uppercase tracking-wide text-gray-400",children:t("market.list.installedHeading")}),q.map(n=>e.jsx(oe,{skill:n,selected:(i==null?void 0:i.name)===n.name,onSelect:_},`${n.registryId??"_"}:${n.name}`))]}),ne.length>0&&e.jsxs("div",{className:"space-y-2",children:[q.length>0&&e.jsx("p",{className:"px-1 pt-2 text-xs font-semibold uppercase tracking-wide text-gray-400",children:t("market.list.availableHeading")}),ne.map(n=>e.jsx(oe,{skill:n,selected:(i==null?void 0:i.name)===n.name,onSelect:_},`${n.registryId??"_"}:${n.name}`))]})]})})]}),e.jsx(bt,{skill:i,markdownBody:O,descriptionLoading:i?M===i.name:!1,descriptionError:Ie,busy:i?ze===i.name:!1,canInstall:!!((i==null?void 0:i.registryId)??F),onInstall:Te,onUninstall:_e,onRefresh:()=>{E(),H((i==null?void 0:i.name)??null),$().catch(()=>{})}})]})]}),r&&e.jsx(ft,{registries:Re,loading:L,deletingRegistryId:Me,onAdd:()=>{p(null),m(""),c(""),d(!0)},onClose:()=>s(!1),onDelete:$e}),l&&e.jsx(yt,{url:o,tokenEnv:u,error:f,submitting:Ce,onChangeUrl:m,onChangeTokenEnv:c,onClose:()=>{p(null),d(!1)},onSubmit:Ee}),D&&e.jsx(pt,{itemName:D.displayName||D.name,onConfirm:()=>{Q(D),V(null)},onCancel:()=>V(null)})]})}export{Nt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aB as H,aE as B,aG as u,aH as r,aW as ke,aL as X,aR as we,aX as je,aD as F,aY as de,aK as ue,aZ as K,aT as Ne,a_ as Ce,a$ as Le,b0 as _e,aP as Ee,b1 as pe,b2 as Se,b3 as De,b4 as Me,b5 as Ae,b6 as $e,b7 as Te,b8 as Ie,b9 as Pe,ba as Re,bb as Be,bc as ze,bd as Oe,be as qe,bf as Fe,bg as He,bh as Ve,bi as Ke,bj as We,bk as Qe,bl as Ue,bm as Xe,bn as Je,bo as Ge,bp as Y}from"./main-
|
|
1
|
+
import{aB as H,aE as B,aG as u,aH as r,aW as ke,aL as X,aR as we,aX as je,aD as F,aY as de,aK as ue,aZ as K,aT as Ne,a_ as Ce,a$ as Le,b0 as _e,aP as Ee,b1 as pe,b2 as Se,b3 as De,b4 as Me,b5 as Ae,b6 as $e,b7 as Te,b8 as Ie,b9 as Pe,ba as Re,bb as Be,bc as ze,bd as Oe,be as qe,bf as Fe,bg as He,bh as Ve,bi as Ke,bj as We,bk as Qe,bl as Ue,bm as Xe,bn as Je,bo as Ge,bp as Y}from"./main-8qPNZsN6.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as ln,a0 as an,a1 as y,a2 as tn,a3 as G,a4 as q,a5 as _,a6 as un,a7 as rn,a8 as K,a9 as o,aa as z,ab as sn,ac as on,ad as fn}from"./main-
|
|
1
|
+
import{$ as ln,a0 as an,a1 as y,a2 as tn,a3 as G,a4 as q,a5 as _,a6 as un,a7 as rn,a8 as K,a9 as o,aa as z,ab as sn,ac as on,ad as fn}from"./main-8qPNZsN6.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,B,a){var O=I-l,i=D-h,n=B-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function V(l,h,I,D,v,A,B){var a=l-I,O=h-D,i=(B?A:-A)/K(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,C=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*K(fn(0,T*T*R-P*P)),$=(P*g-m*S)/R,j=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=$-C,e=j-t,r=w-C,F=p-t;return x*x+e*e>r*r+F*F&&($=w,j=p),{cx:$,cy:j,x01:-n,y01:-d,x11:$*(v/T-1),y11:j*(v/T-1)}}function hn(){var l=cn,h=yn,I=z(0),D=null,v=gn,A=dn,B=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,C=un(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(C>tn-y)a.moveTo(s*G(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*G(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=C,S=C,$=B.apply(this,arguments)/2,j=$>y&&(D?+D.apply(this,arguments):K(u*u+s*s)),w=_(un(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(j>y){var F=sn(j/u*q($)),L=sn(j/s*q($));(P-=F*2)>y?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(S-=L*2)>y?(L*=t?1:-1,m+=L,g-=L):(S=0,m=g=(f+c)/2)}var H=s*G(m),J=s*q(m),M=u*G(T),N=u*q(T);if(w>y){var Q=s*G(g),U=s*q(g),W=u*G(R),X=u*q(R),E;if(C<rn)if(E=pn(H,J,W,X,Q,U,M,N)){var Y=H-E[0],Z=J-E[1],b=Q-E[0],k=U-E[1],nn=1/q(on((Y*b+Z*k)/(K(Y*Y+Z*Z)*K(b*b+k*k)))/2),en=K(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(H,J),a.arc(0,0,s,m,g,!t)):a.moveTo(H,J),!(u>y)||!(P>y)?a.lineTo(M,N):p>y?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[G(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:z(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:z(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:z(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:z(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:z(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:z(+n),i):A},i.padAngle=function(n){return arguments.length?(B=typeof n=="function"?n:z(+n),i):B},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|