"use strict";exports.id=502,exports.ids=[502],exports.modules={"./src/cc-marketplace-import.ts"(e,t,r){r.r(t),r.d(t,{importCcMarketplaces:()=>u});var s=r("../cursor-plugins/dist/index.js"),a=r("../proto/dist/generated/aiserver/v1/dashboard_pb.js"),i=r("../utils/dist/promise-extras.js"),n=r("../../../../var/folders/gy/wcfhjzc55d96bnvx1zv223lc0000gn/T/agent-cli-mac-macos-x64-019f6d3d-8812-4a7d-ad69-e1d1701ab9a2.1ELq4Ger/pnpm-virtual-store/@bufbuild+protobuf@1.10.1/node_modules/@bufbuild/protobuf/dist/esm/google/protobuf/struct_pb.js"),o=r("./src/debug.ts"),l=function(e,t,r,s){return new(r||(r=Promise))((function(a,i){function n(e){try{l(s.next(e))}catch(e){i(e)}}function o(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(n,o)}l((s=s.apply(e,t||[])).next())}))};const c={log:(e,t)=>{(0,o.debugLog)(e,null!=t?t:{})}};function u(e){return l(this,arguments,void 0,(function*(e,t={}){const r=yield function(e){return l(this,void 0,void 0,(function*(){try{const t=yield e.listMarketplaces(new a.ListMarketplacesRequest({}));return new Set(t.marketplaces.filter((e=>void 0!==e.userId)).map((e=>e.name)))}catch(e){return(0,o.debugLog)("cc-marketplace-import.listMarketplacesError",{error:e instanceof Error?e.message:String(e)}),new Set}}))}(e),{payloads:u}=yield(0,s.kx)({marketplacesDir:t.marketplacesDir,existingUserMarketplaceNames:r,logger:c});if(0===u.length)return void(0,o.debugLog)("cc-marketplace-import.noNewMarketplaces");(0,o.debugLog)("cc-marketplace-import.parsedMarketplaces",{count:u.length});const d=yield(0,i.up)(u,(t=>l(this,void 0,void 0,(function*(){return function(e,t){return l(this,void 0,void 0,(function*(){yield e.registerMarketplaceAndPlugins(function(e){return new a.RegisterMarketplaceAndPluginsRequest({gitUrl:e.gitUrl,gitRef:e.gitRef,marketplaceName:e.marketplaceName,commitSha:e.commitSha,plugins:e.plugins.map((e=>new a.RegisterPluginEntry({name:e.name,displayName:e.displayName,description:e.description,gitPath:e.gitPath,skills:e.skills,subagents:e.subagents,hooks:e.hooks,rules:e.rules,mcpServers:e.mcpServers,commands:e.commands,logoUrl:e.logoUrl,variables:e.variables?n._k.fromJson(e.variables):void 0})))})}(t)),(0,o.debugLog)("cc-marketplace-import.registered",{marketplaceName:t.marketplaceName,gitUrl:t.gitUrl,pluginCount:t.plugins.length})}))}(e,t)}))),{max:4}),p=d.filter((e=>"fulfilled"===e.status)).length,g=d.filter((e=>"rejected"===e.status)).length;(0,o.debugLog)("cc-marketplace-import.complete",{total:u.length,success:p,failures:g})}))}}};