@tickernelz/paperclip-pro-ui 2026.925.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (424) hide show
  1. package/README.md +30 -0
  2. package/dist/android-chrome-192x192.png +0 -0
  3. package/dist/android-chrome-512x512.png +0 -0
  4. package/dist/announcement-preview.svg +11 -0
  5. package/dist/apple-touch-icon.png +0 -0
  6. package/dist/assets/AgentAvatar-BR1Z_L_Z.js +1 -0
  7. package/dist/assets/AgentIdentity-BgihkjQU.js +1 -0
  8. package/dist/assets/Agents.production-BsKiBknO.js +2 -0
  9. package/dist/assets/CompanyActivity.production-Bp4gxpq3.js +1 -0
  10. package/dist/assets/CompanyExport-BvUhFYBr.js +4 -0
  11. package/dist/assets/CompanySkills.production-htb9HH0N.js +10 -0
  12. package/dist/assets/Costs.production-CzulNW6Y.js +1 -0
  13. package/dist/assets/EmptyState-DOb3I5aU.js +1 -0
  14. package/dist/assets/MarkdownBody-AdwNLx7A.js +16 -0
  15. package/dist/assets/MarkdownEditor-B3NYD32f.js +85 -0
  16. package/dist/assets/OrgChart.production-DbBigpMZ.js +1 -0
  17. package/dist/assets/PageSkeleton-C-C3Xlc_.js +1 -0
  18. package/dist/assets/RoutineDetail.production-DJn3YZiR.js +1 -0
  19. package/dist/assets/RoutineRunVariablesDialog-BkLLbP3a.js +5 -0
  20. package/dist/assets/Routines.production-BBDkh1yN.js +1 -0
  21. package/dist/assets/SidebarContext-9UFQ2Pex.js +1 -0
  22. package/dist/assets/StatusIcon-DMDp_WJw.js +1 -0
  23. package/dist/assets/abnfDiagram-VCTEODGH-wiE_K2ku.js +1 -0
  24. package/dist/assets/agents-DrLpWAcm.js +1 -0
  25. package/dist/assets/apl-MHzTCvfx.js +1 -0
  26. package/dist/assets/arc-BQ55EiX2.js +1 -0
  27. package/dist/assets/architecture-7GRP2DOG-B-bRgmfI.js +1 -0
  28. package/dist/assets/architectureDiagram-5GKGNRK7-BkhBoP5_.js +36 -0
  29. package/dist/assets/array-CL5Tisss.js +1 -0
  30. package/dist/assets/asciiarmor-DFLNSgns.js +1 -0
  31. package/dist/assets/asn1-CfPVWRYE.js +1 -0
  32. package/dist/assets/asterisk-CJ4OeA7Y.js +1 -0
  33. package/dist/assets/badge-BLr1M3ne.js +1 -0
  34. package/dist/assets/blockDiagram-I7D4REHJ-fyVn7r-9.js +129 -0
  35. package/dist/assets/bot-CET4VfU-.js +1 -0
  36. package/dist/assets/brainfuck-NEHkmXMc.js +1 -0
  37. package/dist/assets/button-DCI8NFig.js +1 -0
  38. package/dist/assets/c4Diagram-7LVT6UL2-BqC3qTZS.js +38 -0
  39. package/dist/assets/card-BD8MkPAL.js +1 -0
  40. package/dist/assets/channel-0B5iAV5A.js +1 -0
  41. package/dist/assets/character-CguPM7IG.js +1 -0
  42. package/dist/assets/check-C6myARng.js +1 -0
  43. package/dist/assets/checkbox-CmYq-YMP.js +1 -0
  44. package/dist/assets/chevron-down-D2wNtbQf.js +1 -0
  45. package/dist/assets/chevron-right-CU6xIk8W.js +1 -0
  46. package/dist/assets/chunk-2Q5K7J3B-CkPHWFj-.js +1 -0
  47. package/dist/assets/chunk-4HAMMTFA-CGGd_Pxz.js +62 -0
  48. package/dist/assets/chunk-5VM5RSS4-2H3r6wq0.js +15 -0
  49. package/dist/assets/chunk-75Z2AOVW-BaPl5WA6.js +2 -0
  50. package/dist/assets/chunk-DU6HZSFF-2P5iNHqg.js +127 -0
  51. package/dist/assets/chunk-F27PBJKO-Ci7GmRgM.js +1 -0
  52. package/dist/assets/chunk-FOHPRMQF-7Ogwfo6e.js +153 -0
  53. package/dist/assets/chunk-GMAD6QVW-BfvaaEBW.js +70 -0
  54. package/dist/assets/chunk-GVQU2GXP-Cwp_Wpj2.js +1 -0
  55. package/dist/assets/chunk-IMKFNOWR-BjXu-u1C.js +231 -0
  56. package/dist/assets/chunk-JWPE2WC7--HEGjv3t.js +1 -0
  57. package/dist/assets/chunk-L3NEJ4N5-JUd1UqX1.js +1 -0
  58. package/dist/assets/chunk-OSK3NFVY-DlrxddG-.js +10 -0
  59. package/dist/assets/chunk-P2QGCYS3-CjqEi3mx.js +1 -0
  60. package/dist/assets/chunk-POPQ4Y6H-BytmIqFc.js +1 -0
  61. package/dist/assets/chunk-PWAF6VOD-CR3rNBNB.js +1 -0
  62. package/dist/assets/chunk-SHT3W25Y-B1Klag0Z.js +168 -0
  63. package/dist/assets/chunk-SVP7TREG-A4BO1_5v.js +88 -0
  64. package/dist/assets/chunk-TICWLB2K-B4lRXha0.js +206 -0
  65. package/dist/assets/chunk-XXDRQBXY-BhrH-9FX.js +1 -0
  66. package/dist/assets/chunk-Y2CYZVJY-OvsAdhaO.js +1 -0
  67. package/dist/assets/classDiagram-ZZMXUADV-icHQAbF4.js +1 -0
  68. package/dist/assets/classDiagram-v2-VYDZK3BY-icHQAbF4.js +1 -0
  69. package/dist/assets/clike-CIx9nZSv.js +1 -0
  70. package/dist/assets/clipboard-BZT4l65i.js +1 -0
  71. package/dist/assets/clojure-DFaIEz5O.js +1 -0
  72. package/dist/assets/cmake-koz-qBlo.js +1 -0
  73. package/dist/assets/cobol-Bo8Zw9gB.js +1 -0
  74. package/dist/assets/coffeescript-CXYzYf-Y.js +1 -0
  75. package/dist/assets/commonlisp-C4OOCwkD.js +1 -0
  76. package/dist/assets/company-members-C1IoXITE.js +1 -0
  77. package/dist/assets/cose-bilkent-JH36ORCC-ShY6JvWh.js +1 -0
  78. package/dist/assets/createLucideIcon-D-iIM3hK.js +92 -0
  79. package/dist/assets/crystal-BlJXQDvy.js +1 -0
  80. package/dist/assets/css-DEZwfVpY.js +1 -0
  81. package/dist/assets/cynefin-OW5HDTMX-SmJ8tLYh.js +1 -0
  82. package/dist/assets/cynefinDiagram-5FMLGOSQ-Qp2NNXUx.js +62 -0
  83. package/dist/assets/cypher-z2oFsVv2.js +1 -0
  84. package/dist/assets/cytoscape.esm-B68Piqei.js +321 -0
  85. package/dist/assets/d-Dkt6y7AQ.js +1 -0
  86. package/dist/assets/dagre-Bnei_7lW.js +1 -0
  87. package/dist/assets/dagre-GXQ25YYZ-C1bu-Sbk.js +4 -0
  88. package/dist/assets/defaultLocale-C2Bpu8Ih.js +1 -0
  89. package/dist/assets/definition-qmfin__X.js +1 -0
  90. package/dist/assets/diagram-S7CK7UJ4-D0cqRe3j.js +30 -0
  91. package/dist/assets/diagram-UQ7AKVKN-DdEgR6LR.js +41 -0
  92. package/dist/assets/diagram-VSXAHHWV-B_APewr5.js +3 -0
  93. package/dist/assets/diagram-VX7I27RA-B2quR8-z.js +24 -0
  94. package/dist/assets/diagram-Z3DM3KII-BpQRCt5N.js +24 -0
  95. package/dist/assets/diff-C60bAYOU.js +1 -0
  96. package/dist/assets/dist-B0TRtKS8.js +1 -0
  97. package/dist/assets/dist-B3Uu-urE.js +1 -0
  98. package/dist/assets/dist-BRrJTSwu.js +1 -0
  99. package/dist/assets/dist-BX-OCtve.js +7 -0
  100. package/dist/assets/dist-BXoB5t8y.js +1 -0
  101. package/dist/assets/dist-BeN6V24C.js +1 -0
  102. package/dist/assets/dist-Bs8B1orN.js +1 -0
  103. package/dist/assets/dist-BuzarGBs.js +1 -0
  104. package/dist/assets/dist-C2jegCUe.js +2 -0
  105. package/dist/assets/dist-C8CoeHVO.js +6 -0
  106. package/dist/assets/dist-CBo4NvFW.js +1 -0
  107. package/dist/assets/dist-CSbL7rtN.js +1 -0
  108. package/dist/assets/dist-CWrRKmYk.js +1 -0
  109. package/dist/assets/dist-CXeuJs-w.js +1 -0
  110. package/dist/assets/dist-Cc3Bt6H4.js +1 -0
  111. package/dist/assets/dist-Cj4C2HPs.js +1 -0
  112. package/dist/assets/dist-DCJXgQu0.js +13 -0
  113. package/dist/assets/dist-DKJ0FdKS.js +1 -0
  114. package/dist/assets/dist-DZgNtG8a.js +1 -0
  115. package/dist/assets/dist-DoBOMP6Y.js +1 -0
  116. package/dist/assets/dist-DpmnjHX9.js +1 -0
  117. package/dist/assets/dist-DsLYqWnM.js +1 -0
  118. package/dist/assets/dist-DyyIM2uF.js +3 -0
  119. package/dist/assets/dist-YH7EZ8d1.js +1 -0
  120. package/dist/assets/dist-oQmcCiSD.js +1 -0
  121. package/dist/assets/dist-sLIQSVjm.js +13 -0
  122. package/dist/assets/dist-xQwUswee.js +1 -0
  123. package/dist/assets/dockerfile-BttNdtK0.js +1 -0
  124. package/dist/assets/dtd-CCVZU5Da.js +1 -0
  125. package/dist/assets/dylan-3pmV5wzs.js +1 -0
  126. package/dist/assets/ebnf-bm-I2WIh.js +1 -0
  127. package/dist/assets/ebnfDiagram-PWID7BFC-C9x73jSZ.js +1 -0
  128. package/dist/assets/ecl-BIv3PrZb.js +1 -0
  129. package/dist/assets/eiffel-DuLnr4-r.js +1 -0
  130. package/dist/assets/elm-njbaCU-L.js +1 -0
  131. package/dist/assets/environments-Cd-g_MmN.js +1 -0
  132. package/dist/assets/erDiagram-RLTQ6QDP-Dkp7z94L.js +99 -0
  133. package/dist/assets/erlang-CuhOC2I8.js +1 -0
  134. package/dist/assets/eventmodeling-NTZA5JFV-CCSRuDgA.js +1 -0
  135. package/dist/assets/external-link-BKz-OKDG.js +1 -0
  136. package/dist/assets/factor-CM3-9V3b.js +1 -0
  137. package/dist/assets/fcl-nWsMJ92o.js +1 -0
  138. package/dist/assets/file-text-DXa-cUrm.js +1 -0
  139. package/dist/assets/flowDiagram-HODETNUW-CDvpIOlT.js +1 -0
  140. package/dist/assets/forth-BQ9HrCVY.js +1 -0
  141. package/dist/assets/fortran-DHJe28ev.js +1 -0
  142. package/dist/assets/ganttDiagram-EL5Y4UJY-CJs7mNJX.js +292 -0
  143. package/dist/assets/gas-ByO0qYMr.js +1 -0
  144. package/dist/assets/gherkin-CwOmHL5K.js +1 -0
  145. package/dist/assets/gitGraph-4MIJSDKK-SUTvd_QT.js +1 -0
  146. package/dist/assets/gitGraphDiagram-WWUBYQGX-ByeD7NPE.js +106 -0
  147. package/dist/assets/graphlib-DHhK3saS.js +1 -0
  148. package/dist/assets/groovy-ByXGF8cx.js +1 -0
  149. package/dist/assets/haskell-CHSpCNOy.js +1 -0
  150. package/dist/assets/haxe-P2jh68ck.js +1 -0
  151. package/dist/assets/health-Dc13TJNg.js +1 -0
  152. package/dist/assets/heartbeats-CY77VTM_.js +1 -0
  153. package/dist/assets/http-0jwMmfWP.js +1 -0
  154. package/dist/assets/idl-DTVVj6r5.js +1 -0
  155. package/dist/assets/index-CWuperHN.css +1 -0
  156. package/dist/assets/index-ZrmXLuMX.js +733 -0
  157. package/dist/assets/info-A6RAGUB7-DP8pqSDg.js +1 -0
  158. package/dist/assets/infoDiagram-27XIBGKW-B6sR9qVK.js +2 -0
  159. package/dist/assets/init-BXPE0p7i.js +1 -0
  160. package/dist/assets/input-BkGpMopE.js +1 -0
  161. package/dist/assets/ishikawaDiagram-5VMMS53U-HFQ3gYGN.js +70 -0
  162. package/dist/assets/javascript-Cblpdx44.js +1 -0
  163. package/dist/assets/journeyDiagram-3NMN7TZE-BtoNErTz.js +139 -0
  164. package/dist/assets/julia-KVJvUu_F.js +1 -0
  165. package/dist/assets/kanban-definition-UXKFOSKX-Y55yoRj4.js +89 -0
  166. package/dist/assets/katex-Du_FPwxl.js +257 -0
  167. package/dist/assets/label-C-aWneNy.js +5 -0
  168. package/dist/assets/line-CJEZO7lL.js +1 -0
  169. package/dist/assets/linear-s0r5e4qh.js +1 -0
  170. package/dist/assets/livescript-DSHsJPcD.js +1 -0
  171. package/dist/assets/loader-circle-DwlcG9aS.js +1 -0
  172. package/dist/assets/lua-Vher-70I.js +1 -0
  173. package/dist/assets/mathematica-CE9SaVsW.js +1 -0
  174. package/dist/assets/mbox-JGl1Fgvq.js +1 -0
  175. package/dist/assets/mention-chips-pBjlxGok.js +17 -0
  176. package/dist/assets/mermaid-parser.core-CHJSk6z0.js +7 -0
  177. package/dist/assets/mermaid.core-G_BSi0G0.js +42 -0
  178. package/dist/assets/mindmap-definition-YA3MSWOX-BnlANYwV.js +96 -0
  179. package/dist/assets/mirc-BGWbO906.js +1 -0
  180. package/dist/assets/mllike-DuNQsEw8.js +1 -0
  181. package/dist/assets/model-DL5biheO.js +1 -0
  182. package/dist/assets/modelica-5XCgKQt8.js +1 -0
  183. package/dist/assets/mscgen-mVFg19ri.js +1 -0
  184. package/dist/assets/mumps-C7oS353s.js +1 -0
  185. package/dist/assets/nginx-DXVlpyCz.js +1 -0
  186. package/dist/assets/nsis-KFC6hioG.js +1 -0
  187. package/dist/assets/ntriples-5ckCopnn.js +1 -0
  188. package/dist/assets/octagon-alert-CTp78pR9.js +1 -0
  189. package/dist/assets/octave-D1J2QQNt.js +1 -0
  190. package/dist/assets/ordinal-BJyFM1v8.js +1 -0
  191. package/dist/assets/oz-CPsllMDD.js +1 -0
  192. package/dist/assets/packet-AYTQ26CC-DHxu-C4z.js +1 -0
  193. package/dist/assets/pascal-B-I6JP0Y.js +1 -0
  194. package/dist/assets/path-D6mommQw.js +1 -0
  195. package/dist/assets/pegDiagram-XKGWAZYB-CHhCzuLt.js +1 -0
  196. package/dist/assets/perl-CI8WIWBi.js +1 -0
  197. package/dist/assets/pie-WAS4IAKB-CP_gIBKD.js +1 -0
  198. package/dist/assets/pieDiagram-E7YTZNPT-CEGI1j0Q.js +39 -0
  199. package/dist/assets/pig-FQI0W3S3.js +1 -0
  200. package/dist/assets/powershell-BAu6x78A.js +1 -0
  201. package/dist/assets/preload-helper-CceJXRIF.js +1 -0
  202. package/dist/assets/prod-COP_vZWu.js +495 -0
  203. package/dist/assets/properties-BKTTDgau.js +1 -0
  204. package/dist/assets/protobuf-UWh8gh_j.js +1 -0
  205. package/dist/assets/pug-C20tNwmy.js +1 -0
  206. package/dist/assets/puppet-BAHVzCkO.js +1 -0
  207. package/dist/assets/python-C2DOnsac.js +1 -0
  208. package/dist/assets/q-Cooe-Nh8.js +1 -0
  209. package/dist/assets/quadrantDiagram-AXDQQJYC-BfVC-A1t.js +7 -0
  210. package/dist/assets/r-CktBKya9.js +1 -0
  211. package/dist/assets/radar-RG4KPBEZ-DbvKbV6l.js +1 -0
  212. package/dist/assets/railroad-74A4TZTK-BPHjMWIu.js +1 -0
  213. package/dist/assets/railroad-abnf-HS5TGJTU-DKY8xCGL.js +1 -0
  214. package/dist/assets/railroad-ebnf-LZEXJU2U-DK75GN4x.js +1 -0
  215. package/dist/assets/railroad-peg-WCYAUIDC-0bHp9JB9.js +1 -0
  216. package/dist/assets/railroadDiagram-O6MQD6OU-Bwh6snZb.js +1 -0
  217. package/dist/assets/requirementDiagram-BXWQKSXE-NEvTOdsw.js +84 -0
  218. package/dist/assets/rolldown-runtime-ZpX3ckPj.js +1 -0
  219. package/dist/assets/rotate-ccw-BhopZISX.js +1 -0
  220. package/dist/assets/rough.esm-DnC5Tr1g.js +1 -0
  221. package/dist/assets/router-BxwR1PwE.js +15 -0
  222. package/dist/assets/rpm-Csj9nLHl.js +1 -0
  223. package/dist/assets/ruby-bGx9eo-K.js +1 -0
  224. package/dist/assets/runtime-IAg0vdY9.js +4137 -0
  225. package/dist/assets/sankeyDiagram-P5KCCOFB-AvKb1lr-.js +40 -0
  226. package/dist/assets/sas-Drou_EQ9.js +1 -0
  227. package/dist/assets/save-D5KpMLil.js +1 -0
  228. package/dist/assets/scheme-DcjG9bAf.js +1 -0
  229. package/dist/assets/select-BqqjvKLd.js +1 -0
  230. package/dist/assets/sequenceDiagram-WJ2MYXX4-BP0QZnHN.js +162 -0
  231. package/dist/assets/sheet-Z4n6AEBA.js +1 -0
  232. package/dist/assets/shell-BSKClwid.js +1 -0
  233. package/dist/assets/sieve-CcvsXPZo.js +1 -0
  234. package/dist/assets/simple-mode-B79cVo-x.js +1 -0
  235. package/dist/assets/sizeCapture-INFHLROL-XURNLuv_.js +1 -0
  236. package/dist/assets/skeleton-BxD7FB8M.js +1 -0
  237. package/dist/assets/smalltalk-Cmg-4mjQ.js +1 -0
  238. package/dist/assets/solr-Dj8ahEwG.js +1 -0
  239. package/dist/assets/sparql-LAJYmgfk.js +1 -0
  240. package/dist/assets/spreadsheet-B8doD_pL.js +1 -0
  241. package/dist/assets/sql-C3kWxFGw.js +1 -0
  242. package/dist/assets/src-Bssc388C.js +1 -0
  243. package/dist/assets/stateDiagram-D77RDMKH-Ce0Wj7yz.js +1 -0
  244. package/dist/assets/stateDiagram-v2-MP3YSRHH-CREL-f_f.js +1 -0
  245. package/dist/assets/stex-CW6K5Nmu.js +1 -0
  246. package/dist/assets/stylus-BS-Ienrc.js +1 -0
  247. package/dist/assets/swift-BD82LMDK.js +1 -0
  248. package/dist/assets/swimlanes-42K2YHIH-CX7zPtNU.js +1 -0
  249. package/dist/assets/swimlanesDiagram-VR7AAH4N-B22pD4D6.js +8 -0
  250. package/dist/assets/tabs-Dqn3cNzC.js +1 -0
  251. package/dist/assets/tcl-RZa1cqc-.js +1 -0
  252. package/dist/assets/textile-C-BY_OGF.js +1 -0
  253. package/dist/assets/tiddlywiki-C9bm_Oju.js +1 -0
  254. package/dist/assets/tiki-DJOT-rFT.js +1 -0
  255. package/dist/assets/timeline-definition-24CTP7MA-Bw21rjHm.js +120 -0
  256. package/dist/assets/toml-Civ2fTsu.js +1 -0
  257. package/dist/assets/treeView-Q6P3EWNA-CzxfDhvq.js +1 -0
  258. package/dist/assets/treemap-WGGIJYW6-DNWYF4zd.js +1 -0
  259. package/dist/assets/triangle-alert-DOta-xfM.js +1 -0
  260. package/dist/assets/troff-Lns35Xcq.js +1 -0
  261. package/dist/assets/ttcn-7vlxVTUK.js +1 -0
  262. package/dist/assets/ttcn-cfg-B8qhhp6o.js +1 -0
  263. package/dist/assets/turtle-DTIS1YQ7.js +1 -0
  264. package/dist/assets/use-adapter-capabilities-0-4PhK9y.js +1 -0
  265. package/dist/assets/useHiddenSettings-D9d6LOsg.js +1 -0
  266. package/dist/assets/vb-BO8UacKu.js +1 -0
  267. package/dist/assets/vbscript-DWLru3lT.js +1 -0
  268. package/dist/assets/velocity-BIIn-Nl2.js +1 -0
  269. package/dist/assets/vennDiagram-4TSXK5OY-BuncstTm.js +34 -0
  270. package/dist/assets/verilog-BVYlmXGg.js +1 -0
  271. package/dist/assets/vhdl-Cn8cC8Yb.js +1 -0
  272. package/dist/assets/wardley-WFR3VGLG-C18JBEVS.js +1 -0
  273. package/dist/assets/wardleyDiagram-VM6X3IG4-DOHY7xcd.js +78 -0
  274. package/dist/assets/webidl-ChvzbZ5-.js +1 -0
  275. package/dist/assets/xquery-BKN7qEbU.js +1 -0
  276. package/dist/assets/xychartDiagram-S5SC5T6Z-qOWxoNte.js +7 -0
  277. package/dist/assets/yacas-BG9ha7tU.js +1 -0
  278. package/dist/assets/z80-CB2cGLew.js +1 -0
  279. package/dist/assets/zap-gf6Ev631.js +41 -0
  280. package/dist/brands/adapters/LICENSE +21 -0
  281. package/dist/brands/adapters/README.md +7 -0
  282. package/dist/brands/adapters/cursor-dark.svg +1 -0
  283. package/dist/brands/adapters/cursor.svg +1 -0
  284. package/dist/brands/adapters/gemini-color.svg +1 -0
  285. package/dist/brands/adapters/grok-dark.svg +1 -0
  286. package/dist/brands/adapters/grok.svg +1 -0
  287. package/dist/brands/adapters/hermesagent-dark.svg +1 -0
  288. package/dist/brands/adapters/hermesagent.svg +1 -0
  289. package/dist/brands/adapters/kimi-color-light.svg +1 -0
  290. package/dist/brands/adapters/kimi-color.svg +1 -0
  291. package/dist/brands/adapters/pi-dark.svg +1 -0
  292. package/dist/brands/adapters/pi.svg +1 -0
  293. package/dist/brands/apps/LOBE-LICENSE +21 -0
  294. package/dist/brands/apps/agentmail-dark.svg +16 -0
  295. package/dist/brands/apps/agentmail.svg +17 -0
  296. package/dist/brands/apps/airtable.svg +1 -0
  297. package/dist/brands/apps/anthropic-dark.svg +1 -0
  298. package/dist/brands/apps/anthropic.svg +1 -0
  299. package/dist/brands/apps/api-key-generic.svg +1 -0
  300. package/dist/brands/apps/arcade.png +0 -0
  301. package/dist/brands/apps/asana.svg +12 -0
  302. package/dist/brands/apps/beehiiv.png +0 -0
  303. package/dist/brands/apps/bitly.svg +1 -0
  304. package/dist/brands/apps/box.svg +1 -0
  305. package/dist/brands/apps/brex-dark.svg +1 -0
  306. package/dist/brands/apps/brex.svg +1 -0
  307. package/dist/brands/apps/candid.png +0 -0
  308. package/dist/brands/apps/clickhouse-dark.svg +1 -0
  309. package/dist/brands/apps/clickhouse.svg +1 -0
  310. package/dist/brands/apps/cloudflare.svg +1 -0
  311. package/dist/brands/apps/cloudinary-dark.svg +1 -0
  312. package/dist/brands/apps/cloudinary.svg +3 -0
  313. package/dist/brands/apps/coda.svg +1 -0
  314. package/dist/brands/apps/composio-dark.svg +11 -0
  315. package/dist/brands/apps/composio.svg +16 -0
  316. package/dist/brands/apps/context7-dark.svg +8 -0
  317. package/dist/brands/apps/context7.svg +8 -0
  318. package/dist/brands/apps/discord-dark.svg +1 -0
  319. package/dist/brands/apps/discord.svg +1 -0
  320. package/dist/brands/apps/egnyte.svg +1 -0
  321. package/dist/brands/apps/embat.svg +1 -0
  322. package/dist/brands/apps/executor.png +0 -0
  323. package/dist/brands/apps/fireflies.svg +76 -0
  324. package/dist/brands/apps/github-dark.svg +10 -0
  325. package/dist/brands/apps/github.svg +10 -0
  326. package/dist/brands/apps/gmail.svg +1 -0
  327. package/dist/brands/apps/google-calendar.svg +1 -0
  328. package/dist/brands/apps/google-chat.svg +1 -0
  329. package/dist/brands/apps/google-docs.svg +1 -0
  330. package/dist/brands/apps/google-drive.svg +1 -0
  331. package/dist/brands/apps/google-people.svg +1 -0
  332. package/dist/brands/apps/google-sheets.svg +1 -0
  333. package/dist/brands/apps/google-slides.svg +1 -0
  334. package/dist/brands/apps/google-workspace-search.svg +1 -0
  335. package/dist/brands/apps/hugging-face.svg +8 -0
  336. package/dist/brands/apps/imessage-photon.png +0 -0
  337. package/dist/brands/apps/jam-dev-dark.svg +1 -0
  338. package/dist/brands/apps/jam-dev.svg +1 -0
  339. package/dist/brands/apps/jira-dark.svg +1 -0
  340. package/dist/brands/apps/jira.svg +4 -0
  341. package/dist/brands/apps/kernel.svg +3 -0
  342. package/dist/brands/apps/linear-dark.svg +5 -0
  343. package/dist/brands/apps/linear.svg +5 -0
  344. package/dist/brands/apps/local-falcon.png +0 -0
  345. package/dist/brands/apps/make-dark.svg +1 -0
  346. package/dist/brands/apps/make.svg +1 -0
  347. package/dist/brands/apps/manifest.json +496 -0
  348. package/dist/brands/apps/manufact-dark.svg +6 -0
  349. package/dist/brands/apps/manufact.svg +5 -0
  350. package/dist/brands/apps/mem0.svg +1 -0
  351. package/dist/brands/apps/microsoft-teams.svg +68 -0
  352. package/dist/brands/apps/miro-dark.svg +1 -0
  353. package/dist/brands/apps/miro.svg +4 -0
  354. package/dist/brands/apps/mixpanel-dark.svg +1 -0
  355. package/dist/brands/apps/mixpanel.svg +1 -0
  356. package/dist/brands/apps/netlify-dark.svg +1 -0
  357. package/dist/brands/apps/netlify.svg +16 -0
  358. package/dist/brands/apps/notion-dark.svg +1 -0
  359. package/dist/brands/apps/notion.svg +1 -0
  360. package/dist/brands/apps/oauth-generic.svg +1 -0
  361. package/dist/brands/apps/openai-dark.svg +1 -0
  362. package/dist/brands/apps/openai.svg +1 -0
  363. package/dist/brands/apps/openrouter-dark.svg +3 -0
  364. package/dist/brands/apps/openrouter.svg +3 -0
  365. package/dist/brands/apps/oreilly.svg +1 -0
  366. package/dist/brands/apps/pagerduty.svg +4 -0
  367. package/dist/brands/apps/planetscale-dark.svg +1 -0
  368. package/dist/brands/apps/planetscale.svg +1 -0
  369. package/dist/brands/apps/posthog-dark.svg +1 -0
  370. package/dist/brands/apps/posthog.svg +1 -0
  371. package/dist/brands/apps/postman.svg +1 -0
  372. package/dist/brands/apps/railway-dark.svg +1 -0
  373. package/dist/brands/apps/railway.svg +1 -0
  374. package/dist/brands/apps/razorpay-dark.svg +1 -0
  375. package/dist/brands/apps/razorpay.svg +1 -0
  376. package/dist/brands/apps/resend-dark.svg +1 -0
  377. package/dist/brands/apps/resend.svg +1 -0
  378. package/dist/brands/apps/sanity-dark.svg +1 -0
  379. package/dist/brands/apps/sanity.svg +1 -0
  380. package/dist/brands/apps/sentry-dark.svg +1 -0
  381. package/dist/brands/apps/sentry.svg +1 -0
  382. package/dist/brands/apps/shopify.svg +24 -0
  383. package/dist/brands/apps/similarweb-dark.svg +1 -0
  384. package/dist/brands/apps/similarweb.svg +1 -0
  385. package/dist/brands/apps/slack.png +0 -0
  386. package/dist/brands/apps/slack.svg +17 -0
  387. package/dist/brands/apps/stripe.svg +11 -0
  388. package/dist/brands/apps/supabase.svg +15 -0
  389. package/dist/brands/apps/telegram.svg +12 -0
  390. package/dist/brands/apps/ticket-tailor-dark.svg +1 -0
  391. package/dist/brands/apps/ticket-tailor.svg +1 -0
  392. package/dist/brands/apps/ticktick.svg +1 -0
  393. package/dist/brands/apps/todoist.svg +1 -0
  394. package/dist/brands/apps/vercel-dark.svg +1 -0
  395. package/dist/brands/apps/vercel.svg +1 -0
  396. package/dist/brands/apps/webflow.svg +1 -0
  397. package/dist/brands/apps/wix-dark.svg +12 -0
  398. package/dist/brands/apps/wix.svg +12 -0
  399. package/dist/brands/apps/xai-dark.svg +1 -0
  400. package/dist/brands/apps/xai.svg +1 -0
  401. package/dist/brands/apps/xero.svg +1 -0
  402. package/dist/brands/apps/youcom-dark.svg +13 -0
  403. package/dist/brands/apps/youcom.svg +13 -0
  404. package/dist/brands/apps/zapier.svg +1 -0
  405. package/dist/brands/claude-color.svg +17 -0
  406. package/dist/brands/codex-color.svg +17 -0
  407. package/dist/brands/opencode-logo-dark-square.svg +18 -0
  408. package/dist/brands/opencode-logo-light-square.svg +18 -0
  409. package/dist/favicon-16x16.png +0 -0
  410. package/dist/favicon-32x32.png +0 -0
  411. package/dist/favicon.ico +0 -0
  412. package/dist/favicon.svg +9 -0
  413. package/dist/fonts/InterVariable-Italic.woff2 +0 -0
  414. package/dist/fonts/InterVariable.woff2 +0 -0
  415. package/dist/fonts/NOTICE.md +17 -0
  416. package/dist/index.html +97 -0
  417. package/dist/paperclip-thinking.svg +17 -0
  418. package/dist/site.webmanifest +30 -0
  419. package/dist/sw.js +85 -0
  420. package/dist/worktree-favicon-16x16.png +0 -0
  421. package/dist/worktree-favicon-32x32.png +0 -0
  422. package/dist/worktree-favicon.ico +0 -0
  423. package/dist/worktree-favicon.svg +9 -0
  424. package/package.json +22 -0
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # @tickernelz/paperclip-pro-ui
2
+
3
+ Published static assets for the Paperclip board UI.
4
+
5
+ ## What gets published
6
+
7
+ The npm package contains the production build under `dist/`. It does not ship the UI source tree or workspace-only dependencies.
8
+
9
+ ## Storybook
10
+
11
+ Storybook config, stories, and fixtures live under `ui/storybook/`.
12
+
13
+ ```sh
14
+ pnpm --filter @tickernelz/paperclip-pro-ui storybook
15
+ pnpm --filter @tickernelz/paperclip-pro-ui build-storybook
16
+ ```
17
+
18
+ ## Typical use
19
+
20
+ Install the package, then serve or copy the built files from `node_modules/@tickernelz/paperclip-pro-ui/dist`.
21
+
22
+ ## Editor dependency identity
23
+
24
+ Keep the root and workspace overrides for `@codemirror/state`,
25
+ `@codemirror/view`, and `@lezer/common` aligned. CodeMirror requires shared
26
+ extension identity, while Lezer parsers and syntax highlighters require shared
27
+ `NodeProp` IDs. Multiple Lezer copies can crash code-block highlighting with
28
+ `tags is not iterable`. `src/lib/codemirror-single-instance.test.ts` checks the
29
+ installed dependency graph and highlights sample code through the editor's real
30
+ language dependencies. GitHub Actions owns regeneration of `pnpm-lock.yaml`.
Binary file
Binary file
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="704" height="272" viewBox="0 0 704 272">
2
+ <defs>
3
+ <linearGradient id="background" x2="1" y2="1"><stop stop-color="#e8e4dc"/><stop offset="1" stop-color="#d0dbd3"/></linearGradient>
4
+ <pattern id="grid" width="32" height="32" patternUnits="userSpaceOnUse"><path d="M32 0H0V32" fill="none" stroke="#677d72" stroke-opacity=".12"/></pattern>
5
+ </defs>
6
+ <path fill="url(#background)" d="M0 0h704v272H0z"/><path fill="url(#grid)" d="M0 0h704v272H0z"/>
7
+ <circle cx="610" cy="45" r="135" fill="none" stroke="#677d72" stroke-opacity=".18"/>
8
+ <circle cx="610" cy="45" r="90" fill="none" stroke="#677d72" stroke-opacity=".18"/>
9
+ <text x="40" y="140" font-family="Arial,sans-serif" font-size="56" font-weight="700" letter-spacing="-2" fill="#273b32">paperclip</text>
10
+ <text x="43" y="181" font-family="Arial,sans-serif" font-size="18" fill="#50665b">Ideas become work.</text>
11
+ </svg>
Binary file
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var o=(a,e)=>b(a,"name",{value:e,configurable:!0});import{i as C}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as E,Lr as w,S as v,c as N,l as A,lt as h,n as R,o as z,pt as k}from"./createLucideIcon-D-iIM3hK.js";var m=C(w(),1),i=C(E(),1),y=Object.defineProperty,g=o((a,e)=>y(a,"name",{value:e,configurable:!0}),"__name"),I="Avatar",[T,X]=N(I),F=[0,()=>{}],[P,_]=T(I),M=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,...n}=e,[r,u]=m.useState("idle"),[c,l]=S();return(0,i.jsx)(P,{scope:s,imageLoadingStatus:r,setImageLoadingStatus:u,imageCount:c,setImageCount:l,children:(0,i.jsx)(A.span,{...n,ref:t})})},"Avatar2"),"Avatar")),U="AvatarImage",q=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,src:n,onLoadingStatusChange:r,...u}=e,c=_(U,s);c.setImageCount;const l=j(n,{referrerPolicy:u.referrerPolicy,crossOrigin:u.crossOrigin,loadingStatus:c.imageLoadingStatus,setLoadingStatus:c.setImageLoadingStatus}),d=R(f=>{r?.(f)}),p=m.useRef(l);return z(()=>{const f=p.current;p.current=l,l!==f&&d(l)},[l,d]),l==="loaded"?(0,i.jsx)(A.img,{...u,ref:t,src:n}):null},"AvatarImage2"),"AvatarImage")),O="AvatarFallback",G=m.forwardRef(g(o(function(e,t){const{__scopeAvatar:s,delayMs:n,...r}=e,u=_(O,s),[c,l]=m.useState(n===void 0);return m.useEffect(()=>{if(n!==void 0){const d=window.setTimeout(()=>l(!0),n);return()=>window.clearTimeout(d)}},[n]),c&&u.imageLoadingStatus!=="loaded"?(0,i.jsx)(A.span,{...r,ref:t}):null},"AvatarFallback2"),"AvatarFallback"));function j(a,{loadingStatus:e,setLoadingStatus:t,referrerPolicy:s,crossOrigin:n}){return z(()=>{if(!a){t("error");return}const r=new window.Image,u=g(l=>{const d=l.currentTarget;t(x(d))},"handleLoad"),c=g(()=>t("error"),"handleError");return r.addEventListener("load",u),r.addEventListener("error",c),s&&(r.referrerPolicy=s),r.crossOrigin=n??null,r.src=a,t(x(r)),()=>{r.removeEventListener("load",u),r.removeEventListener("error",c),t("idle")}},[a,n,s,t]),e}o(j,"useImageLoadingStatus");g(j,"useImageLoadingStatus");function x(a){return a.complete?a.naturalWidth>0?"loaded":"error":"loading"}o(x,"getImageLoadingStatus");g(x,"getImageLoadingStatus");function S(){return F}o(S,"useImageCount");g(S,"useImageCount");function W(a){}o(W,"useUpdateImageCount");g(W,"useUpdateImageCount");function $({className:a,size:e="default",shape:t="circle",...s}){return(0,i.jsx)(M,{"data-slot":"avatar","data-size":e,"data-shape":t,className:v("group/avatar relative flex size-8 shrink-0 overflow-hidden select-none data-[size=lg]:size-10 data-[size=sm]:size-6 data-[size=xs]:size-5",t==="square"?"rounded-md":"rounded-full",a),...s})}o($,"Avatar");function B({className:a,...e}){return(0,i.jsx)(q,{"data-slot":"avatar-image",className:v("aspect-square size-full object-cover",a),...e})}o(B,"AvatarImage");function K({className:a,...e}){return(0,i.jsx)(G,{"data-slot":"avatar-fallback",className:v("bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[shape=square]/avatar:rounded-md group-data-[size=sm]/avatar:text-xs group-data-[size=xs]/avatar:text-(length:--text-nano)",a),...e})}o(K,"AvatarFallback");function Y({className:a,...e}){return(0,i.jsx)("div",{"data-slot":"avatar-group",className:v("*:data-[slot=avatar]:ring-background group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2",a),...e})}o(Y,"AvatarGroup");function Z({className:a,...e}){return(0,i.jsx)("div",{"data-slot":"avatar-group-count",className:v("bg-muted text-muted-foreground ring-background relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",a),...e})}o(Z,"AvatarGroupCount");function L(a){const e=a.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():a.slice(0,2).toUpperCase()}o(L,"deriveInitials");var V={xs:"text-sm",sm:"text-xs",default:"text-sm",lg:"text-sm"};function aa({name:a,avatarUrl:e,initials:t,size:s="default",shape:n="circle",className:r}){const u=t??L(a);return(0,i.jsxs)("span",{className:v("inline-flex min-w-0 gap-1.5 items-center",s==="xs"&&"gap-1",s==="lg"&&"gap-2",r),title:a,children:[(0,i.jsxs)($,{size:s,shape:n,children:[e&&(0,i.jsx)(B,{src:e,alt:a}),(0,i.jsx)(K,{children:u})]}),(0,i.jsx)("span",{className:v("truncate",V[s]),children:a})]})}o(aa,"Identity");var D={16:"size-4",20:"size-5",24:"size-6",32:"size-8",40:"size-10",48:"size-12",64:"size-16",96:"size-24",128:"size-32",256:"size-64",512:"size-128"};function ea({agent:a,appearance:e,size:t=24,name:s,label:n,pose:r="rest",muted:u=!1,className:c}){const l=k(e??a?.appearance,a?.id),d=h(l,t,1,r,u),[p,f]=(0,m.useState)(null);return(0,i.jsx)("span",{"data-slot":"agent-avatar",className:v("relative inline-flex shrink-0 items-center justify-center align-middle",D[t],c),role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,children:p===d?(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:L(s??a?.name??"Agent")}):(0,i.jsx)("img",{src:d,srcSet:`${h(l,t,2,r,u)} 2x`,alt:"",width:t,height:t,decoding:"async",loading:"lazy",className:"size-full object-contain",onError:o(()=>f(d),"onError")})})}o(ea,"AgentAvatar");export{$ as a,Z as c,L as i,B as l,D as n,K as o,aa as r,Y as s,ea as t};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var r=(t,e)=>m(t,"name",{value:e,configurable:!0});import{i}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as x,S as n}from"./createLucideIcon-D-iIM3hK.js";import{t as l}from"./AgentAvatar-BR1Z_L_Z.js";var s=i(x(),1);function f({agent:t,size:e="default",className:a}){return(0,s.jsxs)("span",{title:t.name,className:n("inline-flex min-w-0 items-center gap-1.5",a),children:[(0,s.jsx)(l,{agent:t,size:{xs:20,sm:24,default:32,lg:40}[e]}),(0,s.jsx)("span",{className:n("truncate",e==="sm"?"text-xs":"text-sm"),children:t.name??"Agent"})]})}r(f,"AgentIdentity");export{f as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-ZrmXLuMX.js","assets/rolldown-runtime-ZpX3ckPj.js","assets/createLucideIcon-D-iIM3hK.js","assets/preload-helper-CceJXRIF.js","assets/router-BxwR1PwE.js","assets/zap-gf6Ev631.js","assets/agents-DrLpWAcm.js","assets/EmptyState-DOb3I5aU.js","assets/button-DCI8NFig.js","assets/RoutineRunVariablesDialog-BkLLbP3a.js","assets/mention-chips-pBjlxGok.js","assets/bot-CET4VfU-.js","assets/MarkdownEditor-B3NYD32f.js","assets/dist-Cc3Bt6H4.js","assets/dist-B3Uu-urE.js","assets/AgentAvatar-BR1Z_L_Z.js","assets/dist-DCJXgQu0.js","assets/sheet-Z4n6AEBA.js","assets/checkbox-CmYq-YMP.js","assets/check-C6myARng.js","assets/chevron-right-CU6xIk8W.js","assets/label-C-aWneNy.js","assets/StatusIcon-DMDp_WJw.js","assets/clipboard-BZT4l65i.js","assets/loader-circle-DwlcG9aS.js","assets/octagon-alert-CTp78pR9.js","assets/select-BqqjvKLd.js","assets/chevron-down-D2wNtbQf.js","assets/heartbeats-CY77VTM_.js","assets/useHiddenSettings-D9d6LOsg.js","assets/health-Dc13TJNg.js","assets/rotate-ccw-BhopZISX.js","assets/triangle-alert-DOta-xfM.js","assets/badge-BLr1M3ne.js","assets/environments-Cd-g_MmN.js","assets/input-BkGpMopE.js","assets/company-members-C1IoXITE.js","assets/AgentIdentity-BgihkjQU.js","assets/card-BD8MkPAL.js","assets/PageSkeleton-C-C3Xlc_.js","assets/skeleton-BxD7FB8M.js","assets/tabs-Dqn3cNzC.js","assets/use-adapter-capabilities-0-4PhK9y.js","assets/save-D5KpMLil.js","assets/external-link-BKz-OKDG.js","assets/MarkdownBody-AdwNLx7A.js","assets/file-text-DXa-cUrm.js","assets/SidebarContext-9UFQ2Pex.js","assets/index-CWuperHN.css"])))=>i.map(i=>d[i]);
2
+ var Pe=Object.defineProperty;var n=(e,a)=>Pe(e,"name",{value:a,configurable:!0});import{i as oe}from"./rolldown-runtime-ZpX3ckPj.js";import{En as ke,Fr as qe,Lr as Me,S as B,U as Fe,Y as j,_ as ce,g as U,nr as N,z as Re}from"./createLucideIcon-D-iIM3hK.js";import{t as $e}from"./preload-helper-CceJXRIF.js";import{it as Be,o as ze,t as de}from"./router-BxwR1PwE.js";import{S as Ke}from"./zap-gf6Ev631.js";import{t as ue}from"./AgentAvatar-BR1Z_L_Z.js";import{t as Oe}from"./tabs-Dqn3cNzC.js";import{t as ae}from"./agents-DrLpWAcm.js";import{r as De,t as re}from"./EmptyState-DOb3I5aU.js";import{t as ie}from"./bot-CET4VfU-.js";import{k as Ue,t as V}from"./button-DCI8NFig.js";import{i as Ve,o as He,t as Ge}from"./heartbeats-CY77VTM_.js";import{t as me}from"./triangle-alert-DOta-xfM.js";import{n as Qe}from"./SidebarContext-9UFQ2Pex.js";import{n as Je,t as le}from"./environments-Cd-g_MmN.js";import{t as Ye}from"./PageSkeleton-C-C3Xlc_.js";import{$t as We,It as Xe,Jt as Ze,Lt as pe,Wt as H,Yt as et,an as ge,cn as tt,dn as st,in as nt,nn as xe,on as G,rn as at,sn as rt,un as fe}from"./index-ZrmXLuMX.js";var g=oe(Me(),1),t=oe(qe(),1),he=ke,it=(0,g.lazy)(()=>$e(()=>import("./index-ZrmXLuMX.js").then(e=>e.wt).then(e=>({default:e.ConfigureBuiltInAgentModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48]))),lt=["all","active","paused","error","builtin"],ot=[{value:"all",label:"All"},{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"error",label:"Error"},{value:"builtin",label:"Built-in"}];function ct(e){return lt.includes(e)}n(ct,"isFilterTab");var J={label:"Local",detail:"Paperclip host",title:"Local - Paperclip host"},ve={label:"—",detail:"Loading environment",title:"Loading environment"},be=new Set(["terminated","pending_approval"]);function je(e,a){return a==="all"?!0:a==="active"?e==="active"||e==="running"||e==="idle":a==="paused"?e==="paused":a==="error"?e==="error":!0}n(je,"matchesFilter");function dt(e,a,i){return e.filter(r=>be.has(r.status)?!1:a==="builtin"?i.has(r.id):je(r.status,a)).sort((r,o)=>r.name.localeCompare(o.name))}n(dt,"filterAgents");function ut(e){const a=e.adapterConfig?.model;if(typeof a!="string")return null;const i=a.trim();return i.length>0?i:null}n(ut,"getConfiguredModel");function mt(e){return e==="ssh"?"SSH":e.charAt(0).toUpperCase()+e.slice(1)}n(mt,"formatEnvironmentDriver");function pt(e,a){const i=typeof e.config.provider=="string"?e.config.provider.trim():"";return i?a?.sandboxProviders?.[i]?.displayName??i:"Sandbox"}n(pt,"getSandboxProviderLabel");function gt(e,a){const i=Ze(e)?"Managed by Paperclip":e.driver==="sandbox"?`${pt(e,a)} sandbox provider`:e.driver==="local"?"Paperclip host":mt(e.driver);return{label:e.name,detail:i,title:`${e.name} - ${i}`}}n(gt,"describeEnvironment");function xt(e){return{label:"Unknown environment",detail:e.slice(0,8),title:`Unknown environment - ${e}`}}n(xt,"describeMissingEnvironment");function ft(e,a,i,r){const o=e.defaultEnvironmentId??i;if(!o)return J;const x=a.get(o);return x?gt(x,r):xt(o)}n(ft,"resolveAgentEnvironment");function Ne(e,a,i){return e.reduce((r,o)=>{const x=Ne(o.reports,a,i);return be.has(o.status)?(r.push(...x),r):(((a==="builtin"?i.has(o.id):je(o.status,a))||x.length>0)&&r.push({...o,reports:x}),r)},[]).sort((r,o)=>r.name.localeCompare(o.name))}n(Ne,"filterOrgTree");function Mt(){const{selectedCompanyId:e}=Fe(),{openNewAgent:a}=Ve(),{setBreadcrumbs:i}=De(),r=ze(),o=Be(),{isMobile:x}=Qe(),C=o.pathname.split("/").pop()??"all",v=ct(C)?C:"all",[S,m]=(0,g.useState)("org"),A=x,p=A?"list":S,{data:l}=N({queryKey:j.instance.settings,queryFn:n(()=>Je.get(),"queryFn"),enabled:!!e}),u=l?.experimental.enableBuiltInAgents===!0,h=v==="builtin"&&!u?"all":v,z=(0,g.useMemo)(()=>ot.filter(s=>s.value!=="builtin"||u),[u]),{data:E}=N({queryKey:j.builtInAgents.list(e),queryFn:n(()=>st.list(e),"queryFn"),enabled:!!e&&u}),b=(0,g.useMemo)(()=>{const s=new Map;if(!u)return s;for(const c of E??[])c.agentId&&s.set(c.agentId,c);return s},[E,u]),k=(0,g.useMemo)(()=>new Set(b.keys()),[b]),[y,_]=(0,g.useState)(null),{data:d,isLoading:Ie,error:Y}=N({queryKey:j.agents.list(e),queryFn:n(()=>ae.list(e),"queryFn"),enabled:!!e}),{data:T}=N({queryKey:j.org(e),queryFn:n(()=>ae.org(e),"queryFn"),enabled:!!e&&p==="org"}),q=l?.experimental.enableEnvironments===!0,{data:L}=N({queryKey:j.environments.list(e),queryFn:n(()=>le.list(e),"queryFn"),enabled:!!e&&q}),{data:W}=N({queryKey:j.environments.capabilities(e),queryFn:n(()=>le.capabilities(e),"queryFn"),enabled:!!e&&q}),X=[...j.liveRuns(e),"agents-page"],K=nt({companyId:e,resourceKey:"live-runs:agents-page",queryKey:X,enabled:!!e,refetchInterval:15e3,leaderOnly:!0}),{data:O,dataUpdatedAt:Ce}=N({queryKey:X,queryFn:n(()=>Ge.liveRunsForCompany(e),"queryFn"),enabled:K.enabled,refetchInterval:K.refetchInterval});at(K,O,Ce);const M=tt(e),f=rt(e),F=(0,g.useMemo)(()=>{const s=new Map;for(const c of O??[]){if(c.status!=="running"&&c.status!=="queued")continue;const P=s.get(c.agentId);if(P){P.liveCount+=1;continue}s.set(c.agentId,{runId:c.id,liveCount:1})}return s},[O]),Se=(0,g.useMemo)(()=>{const s=new Map;for(const c of d??[])s.set(c.id,c);return s},[d]),Z=(0,g.useMemo)(()=>{const s=new Map;for(const c of L??[])s.set(c.id,c);return s},[L]),ee=(0,g.useMemo)(()=>{const s=new Map;for(const c of d??[])s.set(c.id,ft(c,Z,l?.defaultEnvironmentId??null,W));return s},[d,Z,W,l?.defaultEnvironmentId]);if((0,g.useEffect)(()=>{i([{label:"Agents"}])},[i]),(0,g.useEffect)(()=>{e&&v==="builtin"&&l&&!u&&r("/agents/all",{replace:!0})},[u,l,r,v,e]),!e)return(0,t.jsx)(re,{icon:ie,message:"Select a company to view agents."});if(Ie)return(0,t.jsx)(Ye,{variant:"list"});const w=dt(d??[],h,k),D=Ne(T??[],h,k),te=q&&L===void 0,se=q&&(L===void 0||L.length>1),Ae=n(s=>te?ve:ee.get(s)??J,"resolveRenderedEnvironment"),Ee=n(s=>{const c=s.orgChainHealth?.status==="invalid_org_chain",P=f.isPending&&f.variables?.resourceType==="agent"&&f.variables.resourceId===s.id,_e=P&&f.variables?.starred!==void 0,ne=P&&f.variables?.starred===void 0,Te=ge(M.data,"agent",s.id),I=b.get(s.id),Le=I?.status==="needs_setup"||I?.status==="pending_approval",R=I&&Le?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(fe,{status:I.status}),I.status==="needs_setup"&&(0,t.jsx)("span",{onClick:n($=>{$.preventDefault(),$.stopPropagation()},"onClick"),children:(0,t.jsx)(V,{size:"xs",variant:"outline",onClick:n(()=>_(I),"onClick"),children:"Set up"})})]}):null;return(0,t.jsx)(Xe,{title:s.name,titleClassName:"flex-1 xl:flex-none xl:w-56",titleTextClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitleClassName:"whitespace-normal break-words xl:truncate xl:whitespace-nowrap",subtitle:`${he[s.role]??s.role}${s.title?` - ${s.title}`:""}`,to:ce(s),className:B("group",s.pausedAt&&h!=="paused"?"opacity-50":"",G(M.data,"agent",s.id)==="left"?"sm:text-foreground/55":""),leading:c?(0,t.jsx)(me,{className:"h-3.5 w-3.5 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(ue,{agent:s,size:32}),secondaryRow:R?(0,t.jsx)("div",{className:"xl:hidden flex flex-wrap items-center gap-1.5",children:R}):void 0,meta:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[R&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-1.5",children:R}),(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(we,{agent:s,environment:Ae(s.id),showEnvironment:se})})]}),metaSpacerClassName:"hidden xl:block",trailing:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[F.has(s.id)&&(0,t.jsx)(Q,{agentRef:U(s),runId:F.get(s.id).runId,liveCount:F.get(s.id).liveCount}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(H,{status:s.status})}),(0,t.jsx)(xe,{size:"row",starred:Te,pending:_e,resourceName:s.name,onToggle:n($=>f.mutate({resourceType:"agent",resourceId:s.id,resourceName:s.name,starred:$}),"onToggle")})]}),(0,t.jsx)(pe,{state:G(M.data,"agent",s.id),pending:ne,pendingState:ne?f.variables?.state??null:null,resourceName:s.name,onJoin:n(()=>f.mutate({resourceType:"agent",resourceId:s.id,resourceName:s.name,state:"joined"}),"onJoin"),onLeave:n(()=>f.mutate({resourceType:"agent",resourceId:s.id,resourceName:s.name,state:"left"}),"onLeave")})]})},s.id)},"renderAgentRow");return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsx)(Oe,{value:h,onValueChange:n(s=>r(`/agents/${s}`),"onValueChange"),children:(0,t.jsx)(We,{items:z,value:h,onValueChange:n(s=>r(`/agents/${s}`),"onValueChange")})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[!A&&(0,t.jsxs)("div",{className:"flex items-center border border-border",role:"group","aria-label":"View mode",children:[(0,t.jsx)("button",{className:B("p-1.5 transition-colors",p==="list"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:n(()=>m("list"),"onClick"),title:"List view","aria-label":"List view","aria-pressed":p==="list",children:(0,t.jsx)(He,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("button",{className:B("p-1.5 transition-colors",p==="org"?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:n(()=>m("org"),"onClick"),title:"Org chart view","aria-label":"Org chart view","aria-pressed":p==="org",children:(0,t.jsx)(Ke,{className:"h-3.5 w-3.5"})})]}),(0,t.jsxs)(V,{size:"sm",variant:"outline",onClick:a,children:[(0,t.jsx)(Ue,{className:"h-3.5 w-3.5 mr-1.5"}),"New Agent"]})]})]}),w.length>0&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[w.length," agent",w.length!==1?"s":""]}),Y&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:Y.message}),d&&d.length===0&&(0,t.jsx)(re,{icon:ie,message:"Create your first agent to get started.",action:"New Agent",onAction:a}),p==="list"&&w.length>0&&(0,t.jsx)("div",{children:w.map(Ee)}),p==="list"&&d&&d.length>0&&w.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),p==="org"&&D.length>0&&(0,t.jsx)("div",{className:"py-1",children:D.map(s=>(0,t.jsx)(ye,{node:s,depth:0,agentMap:Se,liveRunByAgent:F,environmentByAgentId:ee,environmentDataLoading:te,showEnvironment:se,tab:h,memberships:M.data,membershipMutation:f,builtInByAgentId:b,onConfigureBuiltIn:_},s.id))}),p==="org"&&T&&T.length>0&&D.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No agents match the selected status."}),p==="org"&&T&&T.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No organizational hierarchy defined."}),y&&e&&(0,t.jsx)(g.Suspense,{fallback:null,children:(0,t.jsx)(it,{companyId:e,state:y,open:y!==null,onOpenChange:n(s=>{s||_(null)},"onOpenChange")})})]})}n(Mt,"Agents");function ye({node:e,depth:a,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:x,showEnvironment:C,tab:v,memberships:S,membershipMutation:m,builtInByAgentId:A,onConfigureBuiltIn:p}){const l=i.get(e.id),u=A.get(e.id),h=u?.status==="needs_setup"||u?.status==="pending_approval",z=!!(l&&l.orgChainHealth?.status==="invalid_org_chain"),E=G(S,"agent",e.id),b=m.isPending&&m.variables?.resourceType==="agent"&&m.variables.resourceId===e.id,k=b&&m.variables?.starred!==void 0,y=b&&m.variables?.starred===void 0,_=ge(S,"agent",e.id);return(0,t.jsxs)("div",{style:{paddingLeft:a*24},children:[(0,t.jsxs)(de,{to:l?ce(l):`/agents/${e.id}`,className:B("group flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-accent/50 transition-colors w-full text-left no-underline text-inherit",l?.pausedAt&&v!=="paused"&&"opacity-50",E==="left"&&"sm:text-foreground/55"),children:[z?(0,t.jsx)(me,{className:"h-3.5 w-3.5 shrink-0 text-amber-500","aria-label":"Invalid reporting chain"}):(0,t.jsx)(ue,{agent:l??e,size:24}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"min-w-(--sz-7rem) truncate",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[he[e.role]??e.role,l?.title?` - ${l.title}`:""]})]}),u&&h&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,t.jsx)(fe,{status:u.status}),u.status==="needs_setup"&&(0,t.jsx)("span",{onClick:n(d=>{d.preventDefault(),d.stopPropagation()},"onClick"),children:(0,t.jsx)(V,{size:"xs",variant:"outline",onClick:n(()=>p(u),"onClick"),children:"Set up"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,t.jsx)("span",{className:"sm:hidden",children:r.has(e.id)?(0,t.jsx)(Q,{agentRef:l?U(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}):(0,t.jsx)(H,{status:e.status})}),(0,t.jsxs)("div",{className:"hidden sm:flex items-center gap-3",children:[r.has(e.id)&&(0,t.jsx)(Q,{agentRef:l?U(l):e.id,runId:r.get(e.id).runId,liveCount:r.get(e.id).liveCount}),l&&(0,t.jsx)("div",{className:"hidden xl:flex items-center gap-3",children:(0,t.jsx)(we,{agent:l,environment:x?ve:o.get(l.id)??J,showEnvironment:C})}),(0,t.jsx)("span",{className:"w-20 flex justify-end",children:(0,t.jsx)(H,{status:e.status})})]}),(0,t.jsx)(pe,{state:E,pending:y,pendingState:y?m.variables?.state:null,resourceName:e.name,onJoin:n(()=>m.mutate({resourceType:"agent",resourceId:e.id,resourceName:e.name,state:"joined"}),"onJoin"),onLeave:n(()=>m.mutate({resourceType:"agent",resourceId:e.id,resourceName:e.name,state:"left"}),"onLeave")}),(0,t.jsx)("div",{className:"hidden sm:flex items-center gap-3",children:(0,t.jsx)(xe,{size:"row",starred:_,pending:k,resourceName:e.name,onToggle:n(d=>m.mutate({resourceType:"agent",resourceId:e.id,resourceName:e.name,starred:d}),"onToggle")})})]})]}),e.reports&&e.reports.length>0&&(0,t.jsx)("div",{className:"border-l border-border ml-4",children:e.reports.map(d=>(0,t.jsx)(ye,{node:d,depth:a+1,agentMap:i,liveRunByAgent:r,environmentByAgentId:o,environmentDataLoading:x,showEnvironment:C,tab:v,memberships:S,membershipMutation:m,builtInByAgentId:A,onConfigureBuiltIn:p},d.id))})]})}n(ye,"OrgTreeNode");function we({agent:e,environment:a,showEnvironment:i}){const r=ut(e),o=et(e.adapterType);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate font-mono text-xs text-muted-foreground",title:r??void 0,children:r??"—"}),(0,t.jsx)("div",{className:"truncate font-mono text-(length:--text-micro) text-muted-foreground/70",title:o,children:o})]}),i&&(0,t.jsxs)("div",{className:"w-44 min-w-0 leading-tight",children:[(0,t.jsx)("div",{className:"truncate text-xs text-muted-foreground",title:a.title,children:a.label}),(0,t.jsx)("div",{className:"truncate text-(length:--text-micro) text-muted-foreground/70",children:a.detail})]}),(0,t.jsx)("span",{className:"w-24 whitespace-nowrap text-right text-xs text-muted-foreground",children:e.lastHeartbeatAt?Re(e.lastHeartbeatAt):"—"})]})}n(we,"AgentMetaColumns");function Q({agentRef:e,runId:a,liveCount:i}){return(0,t.jsxs)(de,{to:`/agents/${e}/runs/${a}`,className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-blue-500/10 hover:bg-blue-500/20 transition-colors no-underline",onClick:n(r=>r.stopPropagation(),"onClick"),children:[(0,t.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,t.jsx)("span",{className:"animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),(0,t.jsxs)("span",{className:"text-(length:--text-micro) font-medium text-blue-600 dark:text-blue-400",children:["Live",i>1?` (${i})`:""]})]})}n(Q,"LiveRunIndicator");export{Mt as Agents};
@@ -0,0 +1 @@
1
+ var xe=Object.defineProperty;var r=(t,a)=>xe(t,"name",{value:a,configurable:!0});import{i as ne}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as pe,Lr as he,S as ge,U as fe,Y as G,Yn as W,nr as X,z as ye}from"./createLucideIcon-D-iIM3hK.js";import{ct as ve,t as re}from"./router-BxwR1PwE.js";import{r as ee,t as je}from"./AgentAvatar-BR1Z_L_Z.js";import{i as te,r as be,t as Ne}from"./tabs-Dqn3cNzC.js";import{t as we}from"./agents-DrLpWAcm.js";import{r as Ae,t as Te}from"./EmptyState-DOb3I5aU.js";import{c as _,i as y,n as D,s as F,t as k}from"./select-BqqjvKLd.js";import{t as T}from"./button-DCI8NFig.js";import{t as se}from"./input-BkGpMopE.js";import{o as Se,r as Ce}from"./company-members-C1IoXITE.js";import{r as v,t as j}from"./card-BD8MkPAL.js";import{Gn as Ee,O as ae,Pn as Ie,Rt as Ue,_n as Pe,bn as Le,fn as Re,yn as _e}from"./index-ZrmXLuMX.js";var l=ne(he(),1),e=ne(pe(),1),De=50,n="__all",Fe=[{value:n,label:"All actions"},{value:"issue.",label:"Tasks"},{value:"agent.",label:"Agents"},{value:"heartbeat.",label:"Runs"},{value:"approval.",label:"Approvals"},{value:"project.",label:"Projects"},{value:"goal.",label:"Goals"},{value:"tool_gateway.",label:"Tools"},{value:"cost.",label:"Costs"},{value:"company.",label:"Company"}],ke=[{value:n,label:"All entities"},{value:"issue",label:"Task"},{value:"agent",label:"Agent"},{value:"project",label:"Project"},{value:"goal",label:"Goal"},{value:"company",label:"Company"}];function Be(t){if(!t)return;const a=new Date(`${t}T00:00:00.000Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Be,"toStartIso");function Ve(t){if(!t)return;const a=new Date(`${t}T23:59:59.999Z`);return Number.isNaN(a.getTime())?void 0:a.toISOString()}r(Ve,"toEndIso");function $e({record:t,agentMap:a,userProfileMap:d}){const u=t.agentId??(t.actorType==="agent"?t.actorId:null),c=u?a.get(u):null;if(c)return(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5",title:c.name,children:[(0,e.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,e.jsx)(je,{agent:c,size:16,className:"h-3 w-3"})}),(0,e.jsx)("span",{className:"truncate font-medium text-foreground",children:c.name})]});if(t.actorType==="user"&&t.actorId){const m=d.get(t.actorId);return(0,e.jsx)(ee,{name:m?.label??"User",avatarUrl:m?.image??null,size:"sm",className:"font-medium text-foreground"})}const h=t.actorType==="plugin"?"Plugin":t.actorType==="agent"?"Agent":t.actorType==="user"?"User":"System";return(0,e.jsx)(ee,{name:h,size:"sm",className:"font-medium text-foreground"})}r($e,"AuditActor");function qe({record:t}){const{issue:a,document:d}=t.entity,u=a?.identifier??a?.id??null;return u?(0,e.jsx)(re,{to:`/issues/${u}`,className:"font-medium text-primary hover:underline",children:a?.identifier?`${a.identifier}${a.title?` · ${a.title}`:""}`:"the task"}):d?(0,e.jsx)("span",{className:"font-medium text-foreground",children:d.key}):(0,e.jsx)("span",{className:"text-muted-foreground",children:t.entityType})}r(qe,"AuditEntityNode");function ze({record:t,agentMap:a,userProfileMap:d}){const u=Ue(t.action,t.details,{agentMap:a,userProfileMap:d}),c=t.responsibleUserId?d.get(t.responsibleUserId):null,h=!!(t.responsibleUserId&&!(t.actorType==="user"&&t.actorId===t.responsibleUserId)),m=c?.label??(t.responsibleUserId?"a user":null),g=t.entity.comment?.excerpt?.trim(),x=t.entity.issue&&t.entity.document?t.entity.document.key:null;return(0,e.jsx)("li",{className:"px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-foreground",children:[(0,e.jsx)($e,{record:t,agentMap:a,userProfileMap:d}),(0,e.jsx)("span",{className:"text-muted-foreground",children:u}),(0,e.jsx)(qe,{record:t})]}),g?(0,e.jsxs)("p",{className:"line-clamp-2 border-l-2 border-border pl-2 text-muted-foreground",children:["“",g,"”"]}):null,x?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Document ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:x})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[h&&m?(0,e.jsxs)("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5",children:["on behalf of ",m]}):null,t.runId&&t.agentId?(0,e.jsx)(re,{to:`/agents/${t.agentId}/runs/${t.runId}`,className:"text-primary hover:underline",children:"View run"}):null,(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro) opacity-70",children:t.action})]})]}),(0,e.jsx)("time",{className:"shrink-0 whitespace-nowrap text-xs text-muted-foreground",dateTime:t.createdAt,title:new Date(t.createdAt).toLocaleString(),children:ye(t.createdAt)})]})})}r(ze,"AuditRow");function Me(){return(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(Pe,{className:"h-10 w-10 text-muted-foreground/50"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Agent audit is a Paperclip Enterprise view"}),(0,e.jsxs)("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:["The agent audit log gives you a searchable, exportable record of everything your agents did — every comment, task change, approval, and run — with the responsible person for each action. Ask an administrator to grant you the"," ",(0,e.jsx)("span",{className:"font-mono text-(length:--text-micro)",children:"audit:view_agent_actions"})," ","permission to view it."]})]})]})})}r(Me,"AuditUpsell");function Oe({companyId:t,lockedAgentId:a,hideHeader:d,mode:u,onModeChange:c}){const{pushToast:h}=Re(),[m,g]=(0,l.useState)(n),[x,B]=(0,l.useState)(n),[S,V]=(0,l.useState)(n),[C,$]=(0,l.useState)(n),[E,q]=(0,l.useState)(""),[I,z]=(0,l.useState)(""),[Z,Q]=(0,l.useState)(!1),[U,H]=(0,l.useState)(!1),M=X({queryKey:G.agents.list(t),queryFn:r(()=>we.list(t),"queryFn")}),O=X({queryKey:G.access.companyUserDirectory(t),queryFn:r(()=>Se.listUserDirectory(t),"queryFn"),retry:!1}),ie=(0,l.useMemo)(()=>new Map((M.data??[]).map(s=>[s.id,s])),[M.data]),le=(0,l.useMemo)(()=>Ce(O.data?.users),[O.data]),f=a?"agents":u??"all",o={actorScope:f,agentId:a??(m===n?void 0:m),responsibleUserId:x===n?void 0:x,action:S===n?void 0:S,entityType:C===n?void 0:C,from:Be(E),to:Ve(I)},b=!!(!a&&m!==n||x!==n||S!==n||C!==n||E||I),i=Ee({queryKey:G.audit.agentActions(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),queryFn:r(({pageParam:s})=>ae.listAgentActions(t,{...o,limit:De,cursor:s??void 0}),"queryFn"),initialPageParam:null,getNextPageParam:r(s=>s.nextCursor??void 0,"getNextPageParam"),retry:r((s,p)=>!(p instanceof W&&p.status===403)&&s<2,"retry")}),K=i.error instanceof W&&i.error.status===403,P=i.data?.pages.some(s=>s.accessTier==="basic")??!1,oe=i.data?.pages.some(s=>s.accessTier==="full")??!1,Y=(0,l.useMemo)(()=>{const s=i.data?.pages??[];return(P?s.filter(p=>p.accessTier!=="full"):s).flatMap(p=>p.items)},[i.data,P]),L=P?"basic":i.data?.pages[0]?.accessTier,N=P&&oe,ce=a?!0:L==="full",de=!!(N&&U&&!i.isFetching),R=!!(!a&&!de&&(K&&b||N)),w=!!(K&&!a&&f==="agents"&&c),ue=!!(!a&&c&&!w&&(f==="agents"||L==="full"));(0,l.useEffect)(()=>{w&&c?.("all")},[w,c]),(0,l.useEffect)(()=>{!a&&(L==="basic"||R)&&(g(n),B(n),V(n),$(n),q(""),z(""))},[L,N,a,R]),(0,l.useEffect)(()=>{if(!N){U&&H(!1);return}U||(H(!0),i.refetch())},[U,i,N]);const J=r(()=>{g(n),B(n),V(n),$(n),q(""),z("")},"clearFilters"),me=r(async()=>{Q(!0);try{const s=await ae.exportAgentActionsCsv(t,{actorScope:o.actorScope,agentId:o.agentId,responsibleUserId:o.responsibleUserId,action:o.action,entityType:o.entityType,from:o.from,to:o.to}),p=URL.createObjectURL(s),A=document.createElement("a");A.href=p,A.download=`${f==="agents"?"agent-audit":"activity"}-${t}.csv`,document.body.appendChild(A),A.click(),A.remove(),window.setTimeout(()=>URL.revokeObjectURL(p),5e3),h({title:"Audit exported",body:"Your CSV download has started.",tone:"success"})}catch(s){h({title:"Export failed",body:s instanceof Error?s.message:"Could not export the audit log.",tone:"error"})}finally{Q(!1)}},"handleExport");return K&&!R&&!w?(0,e.jsx)(Me,{}):(0,e.jsxs)("div",{className:"space-y-4",children:[d?null:(0,e.jsx)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Activity"}),(0,e.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:f==="agents"?"Every recorded agent action, newest first — with the responsible person and run behind each one.":"Everything happening in your company, newest first — people, agents, and the system. Each line is one recorded action."})]})}),ue?(0,e.jsx)(Ne,{value:f,onValueChange:r(s=>c?.(s),"onValueChange"),children:(0,e.jsxs)(be,{"aria-label":"Activity scope",children:[(0,e.jsx)(te,{value:"all",children:"All activity"}),(0,e.jsx)(te,{value:"agents",children:"Agent actions"})]})}):null,ce?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a?null:(0,e.jsxs)(k,{value:m,onValueChange:g,children:[(0,e.jsx)(F,{className:"w-40",children:(0,e.jsx)(_,{placeholder:"Agent"})}),(0,e.jsxs)(D,{children:[(0,e.jsx)(y,{value:n,children:"All agents"}),(M.data??[]).map(s=>(0,e.jsx)(y,{value:s.id,children:s.name},s.id))]})]}),(0,e.jsxs)(k,{value:x,onValueChange:B,children:[(0,e.jsx)(F,{className:"w-52",children:(0,e.jsx)(_,{placeholder:"Responsible user"})}),(0,e.jsxs)(D,{children:[(0,e.jsx)(y,{value:n,children:"All responsible users"}),(O.data?.users??[]).map(s=>(0,e.jsx)(y,{value:s.principalId,children:s.user?.name??s.user?.email??s.principalId.slice(0,8)},s.principalId))]})]}),(0,e.jsxs)(k,{value:S,onValueChange:V,children:[(0,e.jsx)(F,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Action"})}),(0,e.jsx)(D,{children:Fe.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsxs)(k,{value:C,onValueChange:$,children:[(0,e.jsx)(F,{className:"w-36",children:(0,e.jsx)(_,{placeholder:"Entity"})}),(0,e.jsx)(D,{children:ke.map(s=>(0,e.jsx)(y,{value:s.value,children:s.label},s.value))})]}),(0,e.jsx)(se,{type:"date","aria-label":"From date",value:E,max:I||void 0,onChange:r(s=>q(s.target.value),"onChange"),className:"w-36"}),(0,e.jsx)(se,{type:"date","aria-label":"To date",value:I,min:E||void 0,onChange:r(s=>z(s.target.value),"onChange"),className:"w-36"}),b?(0,e.jsx)(T,{variant:"ghost",size:"sm",onClick:J,children:"Clear filters"}):null,(0,e.jsxs)(T,{variant:"outline",size:"sm",className:"ml-auto",onClick:me,disabled:Z||i.isLoading||Y.length===0,children:[(0,e.jsx)(Ie,{className:"mr-1.5 h-4 w-4"}),Z?"Exporting…":"Export CSV"]})]}):null,R||w?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Refreshing audit access…"})}):i.isLoading?(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"py-14 text-center text-sm text-muted-foreground",children:"Loading…"})}):i.error?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:i.error instanceof Error?i.error.message:"Failed to load the audit log."}),(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.refetch(),"onClick"),children:"Try again"})]})}):Y.length===0?(0,e.jsx)(j,{children:(0,e.jsxs)(v,{className:"flex flex-col items-center gap-3 py-14 text-center",children:[(0,e.jsx)(_e,{className:"h-10 w-10 text-muted-foreground/40"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:b?"No actions match these filters":"Nothing here yet"}),(0,e.jsx)("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:b?"Try a wider date range or different filters.":f==="agents"?"As soon as your agents start doing things, their actions show up here.":"As soon as anyone in your company does something, it shows up here."})]}),b?(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:J,children:"Clear filters"}):null]})}):(0,e.jsx)(j,{children:(0,e.jsx)(v,{className:"px-0 py-0",children:(0,e.jsx)("ul",{className:ge("divide-y divide-border"),children:Y.map(s=>(0,e.jsx)(ze,{record:s,agentMap:ie,userProfileMap:le},s.id))})})}),i.hasNextPage?(0,e.jsx)("div",{className:"flex justify-center",children:(0,e.jsx)(T,{variant:"outline",size:"sm",onClick:r(()=>i.fetchNextPage(),"onClick"),disabled:i.isFetchingNextPage,children:i.isFetchingNextPage?"Loading…":"Load more"})}):null,(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Recorded by Paperclip — entries can't be edited. Sensitive values are never stored."})]})}r(Oe,"AuditFeed");function rt(){const{selectedCompanyId:t}=fe(),{setBreadcrumbs:a}=Ae(),[d,u]=ve(),c=d.get("mode")==="agents"?"agents":"all";(0,l.useEffect)(()=>{a([{label:"Activity"}])},[a]);const h=(0,l.useCallback)(m=>{u(g=>{const x=new URLSearchParams(g);return m==="agents"?x.set("mode","agents"):x.delete("mode"),x},{replace:!0})},[u]);return t?(0,e.jsx)(Oe,{companyId:t,mode:c,onModeChange:h}):(0,e.jsx)(Te,{icon:Le,message:"Select a company to view activity."})}r(rt,"CompanyActivity");export{rt as CompanyActivity};
@@ -0,0 +1,4 @@
1
+ var ze=Object.defineProperty;var d=(e,r)=>ze(e,"name",{value:r,configurable:!0});import{i as we}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as De,Ht as _e,Jn as te,Lr as Ue,S as ne,U as We,X as qe,Y as G,at as Ke,nr as X,tr as pe}from"./createLucideIcon-D-iIM3hK.js";import{it as Ye,o as Ze,p as Ge}from"./router-BxwR1PwE.js";import{Q as Xe}from"./mention-chips-pBjlxGok.js";import{l as He,p as z}from"./zap-gf6Ev631.js";import{t as Je}from"./agents-DrLpWAcm.js";import{g as Qe}from"./StatusIcon-DMDp_WJw.js";import{r as Ve,t as D}from"./EmptyState-DOb3I5aU.js";import{t as H}from"./button-DCI8NFig.js";import{t as fe}from"./MarkdownBody-AdwNLx7A.js";import{t as et}from"./loader-circle-DwlcG9aS.js";import{t as me}from"./rotate-ccw-BhopZISX.js";import{t as tt}from"./PageSkeleton-C-C3Xlc_.js";import{Ct as st,Pn as nt,St as rt,Ut as ot,a as at,bt as he,fn as it,i as ct,ln as lt,n as dt,r as ut,t as je,tn as pt,vt as ft,xt as mt,yt as ht}from"./index-ZrmXLuMX.js";var h=we(Ue(),1),xt=["agents","projects","skills","routines","tasks","attachments"],gt={agents:"Agents",projects:"Projects",skills:"Skills",routines:"Routines",tasks:"Tasks",attachments:"Attachments"};function bt(){return{agents:!0,projects:!0,skills:!0,routines:!0,tasks:!0,attachments:!0}}d(bt,"buildDefaultExportCategorySelection");function ye(e){return e.tasks||e.routines}d(ye,"isAttachmentsCategoryEnabled");function ve(e){const r=new Set;for(const a of e){if(!a.recurring)continue;const n=a.path.trim();if(!n)continue;r.add(n);const o=n.lastIndexOf("/");o>=0&&r.add(`${n.slice(0,o+1)}`)}return r}d(ve,"buildRecurringTaskPrefixes");function wt(e,r){for(const a of r)if(e===a||e.startsWith(a))return!0;return!1}d(wt,"isRecurringTaskFile");function jt(e){const r=new Set,a=new Set;for(const n of e)for(const o of n.attachments??[]){const c=o.sha256.trim().toLowerCase();c&&(n.recurring?r:a).add(c)}return{recurring:r,oneOff:a}}d(jt,"buildAttachmentShaOwnership");var yt=new Set(["agents","projects","skills","routines","tasks"]);function vt(e){const r=new Map;for(const a of e){const n=a.sha256.trim().toLowerCase();if(!n)continue;const o=r.get(n)??new Set,c=a.ownedBy&&a.ownedBy.length>0?a.ownedBy:["always"];for(const p of c)o.add(p);r.set(n,o)}return r}d(vt,"buildEmbeddedAssetShaOwnership");function kt(e,r){for(const a of e)if(!yt.has(a)||r[a])return!0;return!1}d(kt,"isEmbeddedAssetBlobIncluded");function ke(e,r){return e.startsWith("agents/")?"agents":e.startsWith("projects/")?"projects":e.startsWith("skills/")?"skills":e.startsWith("tasks/")?wt(e,r)?"routines":"tasks":e.startsWith("blobs/")?"attachments":null}d(ke,"categorizeExportFile");function St(e,r){const a=ve(r),n={agents:0,projects:0,skills:0,routines:0,tasks:0,attachments:0};for(const o of e){const c=ke(o,a);c&&(n[c]+=1)}return n}d(St,"countExportFilesByCategory");function Ct(e){const{filePaths:r,issues:a,categories:n}=e,o=ve(a),c=jt(a),p=vt(e.embeddedAssets??[]),f=n.attachments&&ye(n),x=new Set;for(const l of r){const b=ke(l,o);if(b===null){x.add(l);continue}if(b==="attachments"){const i=l.slice(6).trim().toLowerCase(),g=p.get(i);if(g&&kt(g,n)){x.add(l);continue}if(!f)continue;const j=c.recurring.has(i),y=c.oneOff.has(i);!j&&!y?g||x.add(l):(y&&n.tasks||j&&n.routines)&&x.add(l);continue}n[b]&&x.add(l)}return x}d(Ct,"buildExportCheckedFiles");function Se(e,r){if(!r.has(e))return r.add(e),e;let a=2;for(;;){const n=`${e}-${a}`;if(!r.has(n))return r.add(n),n;a+=1}}d(Se,"uniqueSlug");function Et(e){const r=new Set,a=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=_e(o.name)??"agent";a.set(o.id,Se(c,r))}return a}d(Et,"buildPortableAgentSlugMap");function Nt(e){const r=new Set,a=new Map,n=[...e].sort((o,c)=>o.name.localeCompare(c.name));for(const o of n){const c=Ke(o.name,o.name);a.set(o.id,Se(c,r))}return a}d(Nt,"buildPortableProjectSlugMap");function At(e){const r=Et(e.agents),a=Nt(e.projects),n={agents:e.orderedAgents.map(o=>r.get(o.id)).filter(o=>!!o),projects:e.orderedProjects.map(o=>a.get(o.id)).filter(o=>!!o)};return n.agents.length>0||n.projects.length>0?n:void 0}d(At,"buildPortableSidebarOrder");var t=we(De(),1);function Ce(e){const r=new Set,a=new Set,n=new Set;for(const o of e){const c=o.match(/^agents\/([^/]+)\//);c&&r.add(c[1]);const p=o.match(/^projects\/([^/]+)\//);p&&a.add(p[1]);const f=o.match(/^tasks\/([^/]+)\//);f&&n.add(f[1])}return{agents:r,projects:a,tasks:n,routines:new Set(n)}}d(Ce,"checkedSlugs");function Pt(e,r){const a=Ce(r),n=e.split(`
2
+ `),o=[],c=new Set(["agents","projects","tasks","routines"]),p=new Set(["agents","projects"]);let f=null,x=null,l=!0,b=null,i=null,g=[],j=null,y=[];function T(){i!==null&&g.length>0&&(y.push(i),y.push(...g)),i=null,g=[]}d(T,"flushSidebarSection");function N(){T(),j!==null&&y.length>0&&(o.push(j),o.push(...y)),j=null,y=[]}d(N,"flushSection");for(const w of n){const U=w.match(/^([a-zA-Z_][\w-]*):\s*(.*)$/);if(U&&!w.startsWith(" ")){N(),x=null,l=!0;const E=U[0].split(":")[0];if(c.has(E)){f=E,j=w;continue}else if(E==="sidebar"){f=E,b=null,j=w;continue}else{f=null,o.push(w);continue}}if(f==="sidebar"){const E=w.match(/^ ([\w-]+):\s*$/);if(E&&!w.startsWith(" ")){T();const A=E[1];b=A&&p.has(A)?A:null,i=b?w:null;continue}const L=w.match(/^ - ["']?([^"'\n]+)["']?\s*$/);if(L&&b){const A=L[1],W=a[b];A&&W.has(A)&&g.push(w);continue}if(b){g.push(w);continue}}if(f&&c.has(f)){const E=w.match(/^ ([\w][\w-]*):\s*(.*)$/);if(E&&!w.startsWith(" ")){const L=E[1];x=L,l=a[f].has(L),l&&y.push(w);continue}if(x!==null){l&&y.push(w);continue}y.push(w);continue}o.push(w)}N();let C=o.join(`
3
+ `);const _=C.match(/^\s{2}logoPath:\s*["']?([^"'\n]+)["']?\s*$/m);return _&&!r.has(_[1])&&(C=C.replace(/^\s{2}logoPath:\s*["']?([^"'\n]+)["']?\s*\n?/m,"")),C}d(Pt,"filterPaperclipYaml");function Ee(e,r){if(!r)return e;const a=r.toLowerCase();return e.map(n=>{if(n.kind==="file")return n.name.toLowerCase().includes(a)||n.path.toLowerCase().includes(a)?n:null;const o=Ee(n.children,r);return o.length>0?{...n,children:o}:null}).filter(n=>n!==null)}d(Ee,"filterTree");function Rt(e,r){const a=new Set,n=r.toLowerCase();function o(c,p){if(c.kind==="file"){if(c.name.toLowerCase().includes(n)||c.path.toLowerCase().includes(n))for(const f of p)a.add(f)}else for(const f of c.children)o(f,[...p,c.path])}d(o,"walk");for(const c of e)o(c,[]);return a}d(Rt,"collectMatchedParentDirs");var xe=10;function Tt(e,r,a,n){let o=0,c=0;return{nodes:e.map(p=>{if(p.kind==="dir"&&p.name==="tasks"){o=p.children.length;const f=[],x=[],l=a.toLowerCase();for(const g of p.children){const j=mt([g],"file"),y=n!==null&&j.has(n),T=a&&(g.name.toLowerCase().includes(l)||g.path.toLowerCase().includes(l)||[...j].some(N=>N.toLowerCase().includes(l)));y||T?f.push(g):x.push(g)}const b=Math.max(0,r-f.length),i=[...f,...x.slice(0,b)];return c=i.length,{...p,children:i}}return p}),totalTaskChildren:o,visibleTaskChildren:c}}d(Tt,"paginateTaskNodes");function Ne(e,r,a){const n={};for(const o of Object.keys(e))r.has(o)&&(n[o]=a[o]??e[o]);return n}d(Ne,"filterExportForDownload");function Lt(e,r,a){const n=Ne(e.files,r,a),o=ct(n,e.rootPath),c=new ArrayBuffer(o.byteLength);new Uint8Array(c).set(o);const p=new Blob([c],{type:"application/zip"}),f=URL.createObjectURL(p),x=document.createElement("a");x.href=f,x.download=`${e.rootPath}.zip`,document.body.appendChild(x),x.click(),x.remove(),window.setTimeout(()=>URL.revokeObjectURL(f),1e3)}d(Lt,"downloadZip");function Ot({data:e,onSkillClick:r}){return(0,t.jsx)("div",{className:"rounded-md border border-border bg-accent/20 px-4 py-3 mb-4",children:(0,t.jsx)("dl",{className:"grid grid-cols-(--gtc-5) gap-x-4 gap-y-1.5 text-sm",children:Object.entries(e).map(([a,n])=>(0,t.jsxs)("div",{className:"contents",children:[(0,t.jsx)("dt",{className:"text-muted-foreground whitespace-nowrap py-0.5",children:ft[a]??a}),(0,t.jsx)("dd",{className:"py-0.5",children:Array.isArray(n)?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(o=>(0,t.jsx)("button",{type:"button",className:ne("inline-flex items-center rounded-md border border-border bg-background px-2 py-0.5 text-xs",a==="skills"&&r&&"cursor-pointer hover:bg-accent/50 hover:border-foreground/30 transition-colors"),onClick:d(()=>a==="skills"&&r?.(o),"onClick"),children:o},o))}):(0,t.jsx)("span",{children:n})})]},a))})})}d(Ot,"FrontmatterCard");var Mt={ceo:"CEO",cto:"CTO",cmo:"CMO",cfo:"CFO",coo:"COO",vp:"VP",manager:"Manager",engineer:"Engineer",agent:"Agent"};function Ft(e,r,a,n){const o=Ce(r),c=e.agents.filter(i=>o.agents.has(i.slug)),p=e.projects.filter(i=>o.projects.has(i.slug)),f=e.issues.filter(i=>o.tasks.has(i.slug)),x=e.skills.filter(i=>[...r].some(g=>g.startsWith(`skills/${i.key}/`)||g.startsWith("skills/")&&g.includes(`/${i.slug}/`))),l=[];l.push(`# ${a}`),l.push(""),n&&(l.push(`> ${n}`),l.push("")),c.length>0&&(l.push("![Org Chart](images/org-chart.png)"),l.push("")),l.push("## What's Inside"),l.push(""),l.push("This is an [Agent Company](https://paperclip.ing) package."),l.push("");const b=[];if(c.length>0&&b.push(["Agents",c.length]),p.length>0&&b.push(["Projects",p.length]),x.length>0&&b.push(["Skills",x.length]),f.length>0&&b.push(["Tasks",f.length]),b.length>0){l.push("| Content | Count |"),l.push("|---------|-------|");for(const[i,g]of b)l.push(`| ${i} | ${g} |`);l.push("")}if(c.length>0){l.push("### Agents"),l.push(""),l.push("| Agent | Role | Reports To |"),l.push("|-------|------|------------|");for(const i of c){const g=Mt[i.role]??i.role,j=i.reportsToSlug??"—";l.push(`| ${i.name} | ${g} | ${j} |`)}l.push("")}if(p.length>0){l.push("### Projects"),l.push("");for(const i of p){const g=i.description?` — ${i.description}`:"";l.push(`- **${i.name}**${g}`)}l.push("")}return l.push("## Getting Started"),l.push(""),l.push("```bash"),l.push("npx @tickernelz/paperclip-pro company import this-github-url-or-folder"),l.push("```"),l.push(""),l.push("See [Paperclip](https://paperclip.ing) for more information."),l.push(""),l.push("---"),l.push(`Exported from [Paperclip](https://paperclip.ing) on ${new Date().toISOString().split("T")[0]}`),l.push(""),l.join(`
4
+ `)}d(Ft,"generateReadmeFromSelection");function It(e){const{src:r,selectedFile:a,allFiles:n,orgChartPreviewUrl:o}=e;if(/^(?:https?:|data:)/i.test(r))return null;if(r.replace(/^\.\//,"")==="images/org-chart.png"&&o)return o;const c=(a.includes("/")?a.slice(0,a.lastIndexOf("/")+1):"")+r,p=n[c]??n[r];return p?je(c in n?c:r,p):null}d(It,"resolveExportPreviewImageSrc");function $t({selectedFile:e,content:r,allFiles:a,orgChartPreviewUrl:n,onSkillClick:o}){if(!e||r===null)return(0,t.jsx)(D,{icon:z,message:"Select a file to preview its contents."});const c=dt(r),p=e.endsWith(".md")&&c!==null,f=p&&c?st(c):null,x=ut(e,r)?je(e,r):null,l=p?b=>It({src:b,selectedFile:e,allFiles:a,orgChartPreviewUrl:n}):void 0;return(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"border-b border-border px-5 py-3",children:(0,t.jsx)("div",{className:"truncate font-mono text-sm",children:e})}),(0,t.jsx)("div",{className:"min-h-(--sz-560px) px-5 py-5",children:f?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Ot,{data:f.data,onSkillClick:o}),f.body.trim()&&(0,t.jsx)(fe,{resolveImageSrc:l,softBreaks:!1,linkIssueReferences:!1,children:f.body})]}):p?(0,t.jsx)(fe,{resolveImageSrc:l,softBreaks:!1,linkIssueReferences:!1,children:c??""}):x?(0,t.jsx)("div",{className:"flex min-h-(--sz-520px) items-center justify-center rounded-lg border border-border bg-accent/10 p-6",children:(0,t.jsx)("img",{src:x,alt:e,className:"max-h-(--sz-480px) max-w-full object-contain"})}):c!==null?(0,t.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words border-0 bg-transparent p-0 font-mono text-sm text-foreground",children:(0,t.jsx)("code",{children:c})}):(0,t.jsx)("div",{className:"rounded-lg border border-border bg-accent/10 px-4 py-3 text-sm text-muted-foreground",children:"Binary asset preview is not available for this file type."})})]})}d($t,"ExportPreviewPane");function ge(e){const r="/company/export/files/",a=Ge(e),n=a.indexOf(r);return n===-1?null:decodeURIComponent(a.slice(n+22))||null}d(ge,"filePathFromLocation");function be(e){const r=e.split("/").slice(0,-1),a=[];let n="";for(const o of r)n=n?`${n}/${o}`:o,a.push(n);return a}d(be,"expandAncestors");function Bt(e){return(e instanceof DOMException||e instanceof Error)&&e.name==="AbortError"}d(Bt,"isAbortError");function se(e){return e instanceof Error?e.message:"Failed to load export data."}d(se,"previewErrorMessage");function es(){const{selectedCompanyId:e,selectedCompany:r}=We(),{setBreadcrumbs:a}=Ve(),{pushToast:n}=it(),o=Ze(),c=Ye(),p=(0,h.useRef)(ge(c.pathname)),{data:f}=X({queryKey:G.auth.session,queryFn:d(()=>qe.getSession(),"queryFn")}),{data:x=[]}=X({queryKey:G.agents.list(e),queryFn:d(()=>Je.list(e),"queryFn"),enabled:!!e}),{data:l=[]}=X({queryKey:G.projects.list(e),queryFn:d(()=>Qe.list(e),"queryFn"),enabled:!!e}),{data:b}=X({queryKey:G.companies.exportFidelity(e),queryFn:d(()=>te.exportFidelity(e),"queryFn"),enabled:!!e}),[i,g]=(0,h.useState)(null),[j,y]=(0,h.useState)(null),[T,N]=(0,h.useState)(new Set),[C,_]=(0,h.useState)(()=>({...bt(),tasks:!1,routines:!1,attachments:!1})),[w,U]=(0,h.useState)(""),[E,L]=(0,h.useState)(xe),[A,W]=(0,h.useState)(!1),q=(0,h.useRef)(null),I=(0,h.useRef)(null),M=(0,h.useRef)(0),re=(0,h.useRef)(null),oe=f?.user?.id??f?.session?.userId??null,J=(0,h.useMemo)(()=>x.filter(s=>s.status!=="terminated"),[x]),Q=(0,h.useMemo)(()=>l,[l]),{orderedAgents:ae}=lt({agents:J,companyId:e,userId:oe}),{orderedProjects:ie}=pt({projects:Q,companyId:e,userId:oe}),ce=(0,h.useMemo)(()=>At({agents:J,orderedAgents:ae,projects:Q,orderedProjects:ie}),[ae,ie,J,Q]),V=C.tasks||C.routines,ee=(0,h.useCallback)((s,u=!1)=>{y(s),s?o(`/company/export/files/${encodeURI(s)}`,{replace:u}):o("/company/export",{replace:u})},[o]);(0,h.useEffect)(()=>{if(!i)return;const s=ge(c.pathname);s&&s in i.files&&s!==j?(y(s),N(u=>{const m=new Set(u);for(const v of be(s))m.add(v);return m})):!s&&j&&y(null)},[c.pathname,i]),(0,h.useEffect)(()=>{a([{label:r?.name??"Organization",href:"/dashboard"},{label:"Settings",href:"/company/settings"},{label:"Export"}])},[r?.name,a]);const P=pe({mutationFn:d(({includeIssues:s,includeSkills:u,signal:m})=>te.exportPreview(e,{include:{company:!0,agents:!0,projects:!0,issues:s,skills:u},sidebarOrder:ce},{signal:m}),"mutationFn"),onSuccess:d((s,u)=>{if(u.requestId!==M.current)return;g(s);const m=he(s.files),v=new Set;for(const k of m)k.kind==="dir"&&k.name!=="tasks"&&v.add(k.path);const S=p.current;if(S&&S in s.files){y(S);const k=be(S);N(new Set([...v,...k]))}else{const k="README.md"in s.files?"README.md":Object.keys(s.files)[0];k&&ee(k,!0),N(v)}},"onSuccess"),onError:d((s,u)=>{u.requestId!==M.current||Bt(s)||n({tone:"error",title:"Export failed",body:se(s)})},"onError")});function F(){if(!e)return;I.current?.abort();const s=new AbortController,u=M.current+1;M.current=u,I.current=s,W(!1),P.mutate({includeIssues:V,includeSkills:C.skills,requestId:u,signal:s.signal})}d(F,"startPreviewRequest");const K=pe({mutationFn:d(()=>te.exportBundle(e,{include:{company:!0,agents:!0,projects:!0,issues:V,skills:C.skills},selectedFiles:Array.from(R).sort(),sidebarOrder:ce}),"mutationFn"),onSuccess:d(s=>{const u=new Set(Object.keys(s.files));Lt(s,u,s.files),n({tone:"success",title:"Export downloaded",body:`${u.size} file${u.size===1?"":"s"} exported as ${s.rootPath}.zip`})},"onSuccess"),onError:d(s=>{n({tone:"error",title:"Export failed",body:s instanceof Error?s.message:"Failed to build export package."})},"onError")});(0,h.useEffect)(()=>{e&&(re.current!==e&&(re.current=e,g(null),y(null)),F())},[e,V,C.skills]),(0,h.useEffect)(()=>()=>{M.current+=1,I.current?.abort()},[]);const O=(0,h.useMemo)(()=>i?he(i.files):[],[i]),R=(0,h.useMemo)(()=>i?Ct({filePaths:Object.keys(i.files),issues:i.manifest.issues,categories:C,embeddedAssets:i.manifest.embeddedAssets??[]}):new Set,[i,C]),Ae=(0,h.useMemo)(()=>i?St(Object.keys(i.files),i.manifest.issues):null,[i]),{displayTree:Pe,totalTaskChildren:le,visibleTaskChildren:de}=(0,h.useMemo)(()=>{let s=O;w&&(s=Ee(s,w));const u=Tt(s,E,w,j);return{displayTree:u.nodes,totalTaskChildren:u.totalTaskChildren,visibleTaskChildren:u.visibleTaskChildren}},[O,w,E,j]),Re=(0,h.useMemo)(()=>{const s={};function u(m){if(m.kind==="file"){const S=R.has(m.path);return S||(s[m.path]="muted"),S}let v=!1;for(const S of m.children)u(S)&&(v=!0);return v||(s[m.path]="muted"),v}d(u,"walk");for(const m of O)u(m);return s},[O,R]),Y=(0,h.useMemo)(()=>{if(!i)return{};const s={...i.files},u=i.paperclipExtensionPath;if(u&&typeof i.files[u]=="string"&&(s[u]=Pt(i.files[u],R)),typeof i.files["README.md"]=="string"){const m=i.manifest.company?.name??r?.name??"Company",v=i.manifest.company?.description??null;s["README.md"]=Ft(i.manifest,R,m,v)}return s},[i,R,r?.name]),Te=(0,h.useMemo)(()=>i?at(Ne(i.files,R,Y),i.rootPath):0,[i,R,Y]),ue=(0,h.useMemo)(()=>rt(O),[O]),$=R.size,B=(0,h.useMemo)(()=>i?i.warnings.filter(s=>!/terminated agent/i.test(s)):[],[i]);function Le(s){N(u=>{const m=new Set(u);return m.has(s)?m.delete(s):m.add(s),m})}d(Le,"handleToggleDir");function Oe(s){_(u=>({...u,[s]:!u[s]}))}d(Oe,"handleToggleCategory");function Me(s){const u=w.length>0,m=s.length>0;if(m&&!u&&(q.current=new Set(T)),U(s),m){const v=Rt(O,s);N(S=>{const k=new Set(S);for(const Z of v)k.add(Z);return k})}else u&&q.current&&(N(q.current),q.current=null)}d(Me,"handleSearchChange");function Fe(s){if(!i)return;const u=i.manifest.skills.find(m=>m.key===s||m.slug===s)?.path??`skills/${s}/SKILL.md`;u in i.files&&(ee(u),N(m=>{const v=new Set(m);v.add("skills");const S=u.split("/").slice(0,-1);let k="";for(const Z of S)k=k?`${k}/${Z}`:Z,v.add(k);return v}))}d(Fe,"handleSkillClick");function Ie(){!i||R.size===0||K.isPending||K.mutate()}d(Ie,"handleDownload");function $e(){M.current+=1,I.current?.abort(),I.current=null,P.reset(),W(!0)}if(d($e,"handleCancelPreview"),!e)return(0,t.jsx)(D,{icon:z,message:"Select an organization to export."});if(P.isPending&&!i)return(0,t.jsx)(tt,{variant:"detail"});if(A&&!i)return(0,t.jsx)(D,{icon:z,title:"Export preview cancelled",message:"The preview request was cancelled. Your export settings are unchanged.",action:"Retry preview",onAction:F,hideActionIcon:!0});if(P.isError&&!i)return(0,t.jsx)(D,{icon:z,title:"Export preview failed",message:se(P.error),description:"Retry the preview. You do not need to reload this page.",action:"Retry preview",onAction:F,hideActionIcon:!0});if(!i)return(0,t.jsx)(D,{icon:z,title:"Export preview unavailable",message:"No export preview is loaded.",action:"Load preview",onAction:F,hideActionIcon:!0});const Be=j?Y[j]??null:null;return(0,t.jsxs)("div",{className:"max-w-6xl",children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 border-b border-border bg-background px-5 py-3",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[(0,t.jsxs)("span",{className:"font-medium",children:[r?.name??"Organization"," export"]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["Exporting ",$.toLocaleString()," of ",ue.toLocaleString()," file",ue===1?"":"s",$>0&&` (~${ot(Te)})`]}),B.length>0&&(0,t.jsxs)("span",{className:"text-amber-500",children:[B.length," warning",B.length===1?"":"s"]})]}),(0,t.jsxs)(H,{size:"sm",onClick:Ie,disabled:$===0||K.isPending||P.isPending||P.isError||A,children:[(0,t.jsx)(nt,{className:"mr-1.5 h-3.5 w-3.5"}),K.isPending?"Building export...":`Export ${$.toLocaleString()} file${$===1?"":"s"}`]})]})}),B.length>0&&(0,t.jsx)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:B.map(s=>(0,t.jsx)("div",{className:"text-xs text-amber-500",children:s},s))}),b&&b.warnings.length>0&&(0,t.jsxs)("div",{className:"mx-5 mt-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:[(0,t.jsx)("h3",{className:"mb-1.5 text-xs font-medium",children:"Not included in this export"}),b.warnings.map(s=>(0,t.jsx)("div",{className:ne("text-xs",s.severity==="blocker"?"font-medium text-destructive":"text-amber-500"),children:s.message},s.code))]}),(0,t.jsxs)("div",{className:"grid gap-4 xl:h-(--sz-calc-30) xl:grid-cols-(--gtc-25) xl:gap-0",children:[(0,t.jsxs)("aside",{className:"flex max-h-(--sz-24rem) flex-col overflow-hidden border-b border-border xl:max-h-none xl:border-b-0 xl:border-r",children:[(0,t.jsx)("div",{className:"border-b border-border px-4 py-3 shrink-0",children:(0,t.jsx)("h2",{className:"text-base font-semibold",children:"Package files"})}),(0,t.jsxs)("div",{className:"border-b border-border px-4 py-3 shrink-0",children:[(0,t.jsx)("h3",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"What to include"}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5",role:"group","aria-label":"What to include",children:xt.map(s=>{const u=s==="attachments"&&!ye(C),m=C[s]&&!u,v=Ae?.[s]??0,S=i.manifest.includes.issues||s!=="tasks"&&s!=="routines"&&s!=="attachments";return(0,t.jsxs)("label",{className:ne("flex items-center gap-2 text-sm",u?"cursor-not-allowed opacity-50":"cursor-pointer"),title:u?"Attachments travel with tasks and routines; re-enable one of them to include attachments.":void 0,children:[(0,t.jsx)("input",{type:"checkbox",checked:m,disabled:u,onChange:d(()=>Oe(s),"onChange"),className:"accent-foreground","data-export-category":s}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:gt[s]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:S?v.toLocaleString():"—"})]},s)})}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Task and routine history is opt-in because it can be large."})]}),(0,t.jsx)("div",{className:"border-b border-border px-3 py-2 shrink-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border px-2 py-1",children:[(0,t.jsx)(He,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("input",{type:"text",value:w,onChange:d(s=>Me(s.target.value),"onChange"),placeholder:"Search files...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-page-search-target":"true"})]})}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,t.jsx)(ht,{nodes:Pe,selectedFile:j,expandedDirs:T,onToggleDir:Le,onSelectFile:ee,fileTones:Re,showCheckboxes:!1,wrapLabels:!1}),le>de&&!w&&(0,t.jsx)("div",{className:"px-4 py-2",children:(0,t.jsxs)("button",{type:"button",onClick:d(()=>L(s=>s+xe),"onClick"),className:"w-full rounded-md border border-border px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/30 hover:text-foreground transition-colors",children:["Show more tasks (",de," of ",le,")"]})})]})]}),(0,t.jsxs)("div",{className:"relative min-w-0 overflow-y-auto xl:pl-6",children:[(0,t.jsx)($t,{selectedFile:j,content:Be,allFiles:Y,orgChartPreviewUrl:`/api/companies/${encodeURIComponent(e)}/org.svg`,onSkillClick:Fe}),P.isPending?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-background/90 px-6 text-center",role:"status","aria-live":"polite","aria-busy":"true","data-export-preview-state":"loading",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsx)(et,{className:"h-6 w-6 animate-spin text-muted-foreground"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Updating export preview…"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large task histories can take a minute. You can untick Tasks or cancel this update."})]}),(0,t.jsxs)(H,{type:"button",variant:"outline",size:"sm",onClick:$e,children:[(0,t.jsx)(Xe,{}),"Cancel update"]})]})}):A?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-background/90 px-6 text-center","data-export-preview-state":"cancelled",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Preview update cancelled"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"The previous preview remains available. Retry when you are ready."})]}),(0,t.jsxs)(H,{type:"button",variant:"outline",size:"sm",onClick:F,children:[(0,t.jsx)(me,{}),"Retry preview"]})]})}):P.isError?(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex min-h-(--sz-520px) items-center justify-center bg-background/90 px-6 text-center",role:"alert","data-export-preview-state":"error",children:(0,t.jsxs)("div",{className:"flex max-w-md flex-col items-center gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-destructive",children:"Export preview failed"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:se(P.error)})]}),(0,t.jsxs)(H,{type:"button",variant:"outline",size:"sm",onClick:F,children:[(0,t.jsx)(me,{}),"Retry preview"]})]})}):null]})]})]})}d(es,"CompanyExport");export{es as CompanyExport};
@@ -0,0 +1,10 @@
1
+ var gr=Object.defineProperty;var n=(t,l)=>gr(t,"name",{value:l,configurable:!0});import{i as vn}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as fr,Lr as br,Pr as jr,S as M,U as vr,Y as f,nr as xe,tr as Y,z as yr}from"./createLucideIcon-D-iIM3hK.js";import{ct as kr,o as Nr,st as wr,t as Je}from"./router-BxwR1PwE.js";import{Q as Sr,tt as Cr}from"./mention-chips-pBjlxGok.js";import{N as pe,g as Fr,l as Ir,o as yn,x as Dr}from"./zap-gf6Ev631.js";import{c as Lr,i as _,t as Br}from"./MarkdownEditor-B3NYD32f.js";import{b as Pr,v as Ws,y as kn}from"./sheet-Z4n6AEBA.js";import{t as nn}from"./AgentAvatar-BR1Z_L_Z.js";import{A as Er,C as Ar,O as Ls,S as Ds,a as fs,c as bs,f as qe,g as Bs,h as Re,k as Tr,n as jt,o as Ts,p as $e,r as js,s as vt,t as Kr,u as vs,v as Ps,x as xt,y as Es}from"./checkbox-CmYq-YMP.js";import{i as As,r as Nn,t as wn}from"./tabs-Dqn3cNzC.js";import{n as Ft,t as Hs}from"./agents-DrLpWAcm.js";import{m as Sn}from"./StatusIcon-DMDp_WJw.js";import{t as Mr}from"./use-adapter-capabilities-0-4PhK9y.js";import{r as qr,t as Ze}from"./EmptyState-DOb3I5aU.js";import{t as Cn}from"./check-C6myARng.js";import{t as ps}from"./chevron-down-D2wNtbQf.js";import{t as Fn}from"./chevron-right-CU6xIk8W.js";import{n as Rr,t as ht}from"./save-D5KpMLil.js";import{k as yt,t as k}from"./button-DCI8NFig.js";import{i as In,r as It}from"./clipboard-BZT4l65i.js";import{t as gs}from"./external-link-BKz-OKDG.js";import{t as kt,y as $r}from"./MarkdownBody-AdwNLx7A.js";import{t as Dt}from"./file-text-DXa-cUrm.js";import{t as Dn}from"./triangle-alert-DOta-xfM.js";import{t as le}from"./badge-BLr1M3ne.js";import{t as Me}from"./input-BkGpMopE.js";import"./AgentIdentity-BgihkjQU.js";import{t as Le}from"./PageSkeleton-C-C3Xlc_.js";import{An as zr,At as _r,Bn as rn,Bt as Ur,Dt as Lt,En as Or,Et as Vr,Ft as Ln,J as Qr,Kt as Hr,Ln as Gr,Mn as Bn,Mt as pt,Nn as Pn,Nt as Wr,Ot as Yr,Pn as Nt,Pt as En,Q as Xr,Sn as Zr,Tn as Jr,X as ea,Y as sa,Z as ta,Zt as An,_ as na,bn as Tn,c as ra,ct as aa,d as la,dt as an,et as ia,f as Ks,fn as oa,ft as Xe,g as da,gn as ca,h as ua,ht as he,it as ma,jn as ys,jt as Gs,kn as xa,kt as gt,l as ha,lt as pa,m as Kn,mn as ga,nt as fa,o as ba,ot as ja,p as ft,rt as va,s as ya,st as ka,tt as Na,u as wa,ut as Mn,vn as Sa,wn as wt,zn as St}from"./index-ZrmXLuMX.js";var c=vn(br(),1),e=vn(fr(),1),ln=16,on=24,dn="min-h-9";function cn(t){return(0,e.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...t,children:(0,e.jsx)("path",{d:"M12 4 21 19H3z"})})}n(cn,"VercelMark");function qn(t){const l=t.replace(/\r\n/g,`
2
+ `);if(!l.startsWith(`---
3
+ `))return l.trim();const a=l.indexOf(`
4
+ ---
5
+ `,4);return a<0?l.trim():l.slice(a+5).trim()}n(qn,"stripFrontmatter");function Ct(t){const l=t.replace(/\r\n/g,`
6
+ `);if(!l.startsWith(`---
7
+ `))return{frontmatter:null,body:l};const a=l.indexOf(`
8
+ ---
9
+ `,4);return a<0?{frontmatter:null,body:l}:{frontmatter:l.slice(4,a).trim(),body:l.slice(a+5).trimStart()}}n(Ct,"splitFrontmatter");function Ca(t,l){const a=Ct(t);return a.frontmatter?["---",a.frontmatter,"---","",l].join(`
10
+ `):l}n(Ca,"mergeFrontmatter");function Rn(t){const l={name:"",path:null,kind:"dir",children:[]};for(const u of t){const m=u.path.split("/").filter(Boolean);let r=l,g="";for(const[o,x]of m.entries()){g=g?`${g}/${x}`:x;const N=o===m.length-1;let v=r.children.find(F=>F.name===x);v||(v={name:x,path:N?u.path:g,kind:N?"file":"dir",fileKind:N?u.kind:void 0,children:[]},r.children.push(v)),r=v}}function a(u){u.children.sort((m,r)=>m.kind!==r.kind?m.kind==="dir"?-1:1:m.name==="SKILL.md"?-1:r.name==="SKILL.md"?1:m.name.localeCompare(r.name)),u.children.forEach(a)}return n(a,"sortNode"),a(l),l.children}n(Rn,"buildTree");function Ys(t,l){const a=l?.toLowerCase()??"",u=a.includes("skills.sh")||a.includes("vercel-labs/skills");switch(t){case"skills_sh":return{icon:cn,label:l??"skills.sh",managedLabel:"skills.sh managed"};case"github":return u?{icon:cn,label:l??"skills.sh",managedLabel:"skills.sh managed"}:{icon:Sn,label:l??"GitHub",managedLabel:"GitHub managed"};case"url":return{icon:xa,label:l??"URL",managedLabel:"URL managed"};case"local":return{icon:Ft,label:l??"Folder",managedLabel:"Folder managed"};case"paperclip":return{icon:Jr,label:l??"Paperclip",managedLabel:"Paperclip managed"};default:return{icon:pe,label:l??"Catalog",managedLabel:"Catalog managed"}}}n(Ys,"sourceMeta");function Xs(t){return t?t.slice(0,7):null}n(Xs,"shortRef");function Fa(t){const l=[`${t.discovered} found`,`${t.imported.length} imported`,`${t.updated.length} updated`];return t.conflicts.length>0&&l.push(`${t.conflicts.length} conflicts`),t.skipped.length>0&&l.push(`${t.skipped.length} skipped`),`${l.join(", ")} across ${t.scannedWorkspaces} workspace${t.scannedWorkspaces===1?"":"s"}.`}n(Fa,"formatProjectScanSummary");function Ia(t){return t==="script"||t==="reference"?$r:Dt}n(Ia,"fileIcon");function un(t){const l=t.split("/").filter(Boolean),a=[];for(let u=0;u<l.length-1;u+=1)a.push(l.slice(0,u+1).join("/"));return a}n(un,"parentDirectoryPaths");function mn(t,l){if(!t||typeof t!="object")return null;const a=t[l];if(typeof a!="string")return null;const u=a.trim();return u.length>0?u:null}n(mn,"readonlyMetadataValue");function Da(t){const l=mn(t,"sourceKind")??mn(t,"catalogKind");return l==="bundled"?"bundled":l==="optional"?"optional":null}n(Da,"readonlyMetadataKind");function La(t){if(t.sourceBadge==="paperclip"||t.sourceType==="local_path"&&!t.sourceBadge.toString().includes("github"))return"company";if(t.sourceType==="catalog"||t.sourceBadge==="catalog"){const l=t.catalogKind??Da(t.metadata);return l==="bundled"?"bundled":l==="optional"?"optional":"company"}return t.sourceBadge==="github"||t.sourceBadge==="skills_sh"||t.sourceBadge==="url"||t.sourceBadge==="local"?"external":"company"}n(La,"classifySource");function $n({level:t}){const l={markdown_only:{icon:ca,label:"Markdown only",tooltip:"Text only — no scripts, no binaries, no assets.",className:"border-border bg-muted/40 text-muted-foreground"},assets:{icon:Ft,label:"Includes assets",tooltip:"Ships images, fonts, or other non-script files.",className:"border-cyan-500/30 bg-cyan-500/10 text-cyan-800 dark:text-cyan-200"},scripts_executables:{icon:Dn,label:"Includes scripts",tooltip:"Ships executable scripts. Review before installing.",className:"border-amber-500/40 bg-amber-500/10 text-amber-800 dark:text-amber-200"}},a=l[t]??l.markdown_only,u=a.icon;return(0,e.jsxs)(qe,{children:[(0,e.jsx)(Re,{asChild:!0,children:(0,e.jsxs)(le,{variant:"outline",className:M("text-(length:--text-micro)",a.className),children:[(0,e.jsx)(u,{className:"h-3 w-3","aria-hidden":"true"}),a.label]})}),(0,e.jsx)($e,{children:a.tooltip})]})}n($n,"TrustChip");function zn({compatibility:t}){if(t==="compatible")return null;const l={unknown:{icon:Rr,label:"Unknown format",tooltip:"Paperclip could not validate this skill as Agent Skills markdown. Install at your own risk.",className:"border-yellow-500/40 bg-yellow-500/10 text-yellow-800 dark:text-yellow-200"},invalid:{icon:Or,label:"Invalid",tooltip:"This skill cannot be installed — content is not valid Agent Skills markdown.",className:"border-destructive/40 bg-destructive/10 text-destructive"}}[t],a=l.icon;return(0,e.jsxs)(qe,{children:[(0,e.jsx)(Re,{asChild:!0,children:(0,e.jsxs)(le,{variant:"outline",className:M("text-(length:--text-micro)",l.className),children:[(0,e.jsx)(a,{className:"h-3 w-3","aria-hidden":"true"}),l.label]})}),(0,e.jsx)($e,{children:l.tooltip})]})}n(zn,"CompatChip");function Ba({packageName:t,packageVersion:l}){return t?(0,e.jsxs)(qe,{children:[(0,e.jsx)(Re,{asChild:!0,children:(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-muted/30 px-1.5 py-0.5 font-mono text-(length:--text-nano) text-muted-foreground",children:[(0,e.jsx)(pe,{className:"h-3 w-3","aria-hidden":"true"}),(0,e.jsxs)("span",{children:[t,l?` v${l}`:""]})]})}),(0,e.jsx)($e,{children:"Installed from the app-shipped skills catalog. Provenance is signed by package version and content hash."})]}):null}n(Ba,"ProvenanceBadge");function Pa(t){return t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`}n(Pa,"formatBytes");var Ea=["all","installed","catalog","bundled"];function Aa(t){return Ea.includes(t)?t:"installed"}n(Aa,"resolveDiscoveryTab");function Ta(t,l){const a=new URLSearchParams(t);return l==="installed"?a.delete("tab"):a.set("tab",l),a.delete("category"),l!=="installed"&&a.delete("folder"),a}n(Ta,"withDiscoveryTab");function Ka(t,l){return[{label:"Skills",href:"/skills"},...(t.folderId?ja(Xe(l),t.folderId):[]).map((a,u)=>({label:u===0?aa(a):a.name,href:`/skills?folder=${encodeURIComponent(a.id)}`})),{label:t.name}]}n(Ka,"skillDetailBreadcrumbs");var xn={agents:"Most agents",stars:"Most stars",forks:"Most forks",recent:"Recently updated",alphabetical:"Alphabetical"},Ma=["agents","stars","forks","recent","alphabetical"];function hn(t,l){return t.packageVersion?`v${t.packageVersion}`:l?"core":t.sourceRef?Xs(t.sourceRef):null}n(hn,"discoveryVersionLabel");function pn(t){const l=[],a=new Set;for(const u of t){const m=u?.trim();!m||a.has(m)||(a.add(m),l.push(m))}return l}n(pn,"uniqueCategories");function gn(t){return[...t].sort().join(",")}n(gn,"categorySetKey");function qa(t){return`${t.sharingScope==="private"?"Sharing: private":"Sharing: company"} | ${t.categories.length?`Categories: ${t.categories.join(", ")}`:"Categories: none"}`}n(qa,"skillSettingsToastBody");function Ra(t,l){const a=new Map(l.map(r=>[r.key,r])),u=[],m=new Set;for(const r of t){m.add(r.key);const g=a.get(r.key)??null,o=r.catalogKind==="bundled"||g?.kind==="bundled";u.push({key:r.key,skillId:r.id,folderId:r.folderId??null,catalogRef:g?g.id:null,name:r.name,slug:r.slug,author:r.authorName??r.sourceLabel??"you",version:hn(r,o),tagline:r.tagline??null,description:r.description??null,categories:pn([...r.categories??[],g?.category]),iconUrl:r.iconUrl,color:r.color,starCount:r.starCount??0,agentCount:r.attachedAgentCount??0,forkCount:r.forkCount??0,installed:!0,required:o,forkedFrom:!!r.forkedFromSkillId,updatedAt:new Date(r.updatedAt).getTime()||0,sourceBadge:r.sourceBadge,sourceLabel:r.sourceLabel})}for(const r of l){if(m.has(r.key))continue;const g=r.kind==="bundled";u.push({key:r.key,skillId:null,folderId:null,catalogRef:r.id,name:r.name,slug:r.slug,author:r.packageName??"Paperclip",version:hn({packageVersion:r.packageVersion??null,sourceRef:null},g),tagline:null,description:r.description,categories:pn([r.category,...r.tags??[]]),iconUrl:null,color:null,starCount:0,agentCount:0,forkCount:0,installed:!1,required:g,forkedFrom:!1,updatedAt:0,sourceBadge:"catalog",sourceLabel:r.packageName??"Catalog"})}return u}n(Ra,"buildDiscoveryCards");function $a(t,l){switch(l){case"installed":return t.filter(a=>a.installed);case"catalog":return t.filter(a=>a.catalogRef!=null);case"bundled":return t.filter(a=>a.required);default:return t}}n($a,"cardsForTab");function za(t,l,a){const u=n((m,r)=>m.name.localeCompare(r.name),"byName");return[...t].sort((m,r)=>{if(a&&m.required!==r.required)return m.required?1:-1;switch(l){case"stars":return r.starCount-m.starCount||u(m,r);case"forks":return r.forkCount-m.forkCount||u(m,r);case"recent":return r.updatedAt-m.updatedAt||u(m,r);case"alphabetical":return u(m,r);default:return r.agentCount-m.agentCount||u(m,r)}})}n(za,"sortDiscoveryCards");function fn(t,l){return l?[t.name,t.slug,t.author,t.tagline??"",t.description??"",t.categories.join(" ")].join(" ").toLowerCase().includes(l.toLowerCase()):!0}n(fn,"discoveryMatchesSearch");function bn({icon:t,value:l}){return(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)(t,{className:"h-3 w-3","aria-hidden":"true"}),l]})}n(bn,"SkillStat");function _n({label:t}){return(0,e.jsx)(le,{variant:"outline",className:"border-border bg-muted/40 text-(length:--text-nano) capitalize text-muted-foreground",children:t})}n(_n,"SkillCategoryChip");function _a({card:t,folders:l,selected:a=!1,selectMode:u=!1,showFolderBadge:m=!1,onOpen:r,onSelectChange:g,onMove:o,onCreateFolderAndMove:x,onOpenMove:N}){const v=m&&t.installed?t.folderId?l?.find(p=>p.id===t.folderId)??null:null:void 0,F=t.folderId?l?.find(p=>p.id===t.folderId)??null:null,y=t.installed&&!t.required&&!(F&&ka(F));return(0,e.jsxs)("div",{onClick:n(()=>r(t),"onClick"),onKeyDown:n(p=>{p.target===p.currentTarget&&(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),r(t))},"onKeyDown"),role:"button",tabIndex:0,className:M("group flex h-full min-h-(--sz-11_5rem) flex-col rounded-lg border border-border bg-card p-4 text-left cursor-pointer transition-colors hover:border-foreground/20 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",t.required&&"bg-muted/30"),children:[(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[u&&y?(0,e.jsx)("input",{type:"checkbox",className:"mt-1 h-4 w-4 rounded border-border",checked:a,"aria-label":`Select ${t.name}`,onClick:n(p=>p.stopPropagation(),"onClick"),onChange:n(p=>g?.(t,p.target.checked),"onChange")}):null,(0,e.jsx)(Lt,{card:t}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"truncate font-mono text-sm font-medium text-foreground",children:t.name}),(0,e.jsxs)("div",{className:"truncate text-xs text-muted-foreground",children:["by ",t.author,t.version?` · ${t.version}`:""]}),v!==void 0?(0,e.jsxs)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)(ia,{color:v?.color,className:"h-2 w-2"}),(0,e.jsx)("span",{className:"truncate",children:v?v.name:"Unfiled"})]}):null]}),(()=>{const p=Ys(t.sourceBadge??"catalog",t.sourceLabel??null),A=p.icon;return(0,e.jsx)("span",{className:"shrink-0 text-muted-foreground",title:`From ${p.label}`,"aria-label":`From ${p.label}`,children:(0,e.jsx)(A,{className:"h-3.5 w-3.5","aria-hidden":"true"})})})(),y&&l&&o&&x?(0,e.jsxs)(Bs,{children:[(0,e.jsx)(Ls,{asChild:!0,children:(0,e.jsx)(k,{variant:"ghost",size:"icon-sm",className:"-mr-1 -mt-1 opacity-70 group-hover:opacity-100","aria-label":`More actions for ${t.name}`,onClick:n(p=>p.stopPropagation(),"onClick"),children:(0,e.jsx)(Er,{className:"h-4 w-4"})})}),(0,e.jsxs)(Ps,{align:"end",onClick:n(p=>p.stopPropagation(),"onClick"),children:[N?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(Es,{onSelect:n(()=>N(t),"onSelect"),children:[(0,e.jsx)(Bn,{className:"h-3.5 w-3.5"}),"Move to folder…"]}),(0,e.jsx)(Ar,{})]}):null,(0,e.jsx)(fa,{folders:l,currentFolderId:t.folderId,onMove:n(p=>o(t,p),"onMove"),onCreateAndMove:n(()=>x(t),"onCreateAndMove")})]})]}):null]}),t.forkedFrom?(0,e.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1 text-(length:--text-micro) text-muted-foreground",children:[(0,e.jsx)(ys,{className:"h-3 w-3","aria-hidden":"true"}),"Forked"]}):null,(0,e.jsx)("p",{className:"mt-2 line-clamp-2 min-h-8 text-xs text-muted-foreground",children:Ln({tagline:t.tagline,description:t.description,key:t.key,name:t.name})??""}),(0,e.jsxs)("div",{className:"mt-auto pt-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-(length:--text-micro) text-muted-foreground",children:[(0,e.jsxs)("span",{children:[t.agentCount," ",t.agentCount===1?"agent":"agents"]}),t.starCount>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,e.jsx)(bn,{icon:yn,value:String(t.starCount)})]}):null,t.forkCount>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,e.jsx)(bn,{icon:ys,value:String(t.forkCount)})]}):null]}),(0,e.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[t.installed?(0,e.jsx)(le,{variant:"outline",className:"border-emerald-500/30 bg-emerald-500/10 text-(length:--text-nano) text-emerald-700 dark:text-emerald-300",children:"Installed"}):null,t.categories.slice(0,2).map(p=>(0,e.jsx)(_n,{label:p},p)),t.required?(0,e.jsxs)(le,{variant:"outline",className:"ml-auto border-border bg-muted/60 text-(length:--text-nano) text-muted-foreground",children:[(0,e.jsx)(Fr,{className:"h-3 w-3","aria-hidden":"true"}),"Bundled"]}):null]})]})]})}n(_a,"SkillCard");function Ua({categories:t,total:l,active:a,onSelect:u}){return(0,e.jsxs)("nav",{className:"flex flex-col gap-0.5 px-2",children:[(0,e.jsxs)("button",{type:"button",onClick:n(()=>u(null),"onClick"),className:M("flex items-center justify-between rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-accent/40",a==null?"bg-accent/60 font-medium text-foreground":"text-muted-foreground"),children:[(0,e.jsx)("span",{children:"All"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:l})]}),t.map(m=>(0,e.jsxs)("button",{type:"button",onClick:n(()=>u(m.slug),"onClick"),className:M("flex items-center justify-between rounded-md px-2 py-1.5 text-sm capitalize transition-colors hover:bg-accent/40",a===m.slug?"bg-accent/60 font-medium text-foreground":"text-muted-foreground"),children:[(0,e.jsx)("span",{className:"truncate",children:m.slug}),(0,e.jsx)("span",{className:"ml-2 shrink-0 text-xs text-muted-foreground",children:m.count})]},m.slug))]})}n(Ua,"CategoryNav");function Oa({tab:t,tabCounts:l,onTabChange:a,categories:u,categoryTotal:m,activeCategory:r,onCategoryChange:g,search:o,onSearchChange:x,sort:N,onSortChange:v,cards:F,onOpenCard:y,loading:p,error:A,totalCount:$,onCreate:X,onImport:j,onImportFromProject:L,onBrowseCatalog:b,onScan:K,scanPending:Z,scanStatus:ge,folderResult:q,folderSelection:U="all",foldersLoading:fe=!1,selectMode:D=!1,selectedSkillIds:W=[],onFolderSelect:de,onCreateFolder:we,onRenameFolder:Be,onEditFolder:ze,onMoveFolder:Se,onDeleteFolder:es,onToggleSelectMode:be,onSelectCard:ie,onMoveCard:ce,onCreateFolderAndMoveCard:je,onMoveSelected:_e,onCreateFolderAndMoveSelected:ss,onClearSelected:ts,onOpenMobileFolders:qs,onCreateFolderIn:ns,onEnsureMyFolder:rs,onOpenMoveCard:ks,folderNudgeStorageKey:J}){const[O,Ue]=(0,c.useState)("all"),ue=(0,c.useMemo)(()=>{const w=new Set;for(const Fe of F)Fe.sourceBadge&&w.add(Fe.sourceBadge);return Array.from(w).sort()},[F]);(0,c.useEffect)(()=>{O!=="all"&&!ue.includes(O)&&Ue("all")},[ue,O]);const Ce=(0,c.useMemo)(()=>O==="all"?F:F.filter(w=>w.sourceBadge===O),[F,O]),ve=O!=="all",V=!!(ns&&Be&&ze&&Se&&es),me=!!(q&&q.folders.length>0&&de&&V),ne=(0,c.useMemo)(()=>{if(!q||U==="all"||U==="unfiled")return null;const w=q.folders.find(Fe=>Fe.id===U);return w?.systemKey?.startsWith("project:")?w:null},[q,U]),ye=ne?.systemKey?.slice(8)||null;return(0,e.jsxs)("div",{className:"flex min-h-(--sz-calc-30) md:h-(--sz-calc-33) md:min-h-0 md:overflow-hidden",children:[me?(0,e.jsx)("div",{className:"hidden shrink-0 pl-4 pt-4 md:block",children:(0,e.jsx)(ra,{result:q,selection:U,loading:fe,tags:u,activeTag:r,onSelect:de,onSelectTag:g,onCreateFolder:ns,onRenameFolder:Be,onEditFolder:ze,onMoveFolder:Se,onDeleteFolder:es,onEnsureMyFolder:rs})}):null,(0,e.jsxs)("aside",{className:M("hidden w-60 shrink-0 flex-col overflow-hidden border-r border-border md:flex",me&&"md:hidden"),children:[(0,e.jsxs)("div",{className:"border-b border-border px-4 py-4",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Skills Store"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Discover, install, fork, share"})]}),(0,e.jsx)("div",{className:"px-4 pb-1 pt-3 text-(length:--text-micro) font-medium uppercase tracking-wide text-muted-foreground",children:"Categories"}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto pb-4",children:(0,e.jsx)(Ua,{categories:u,total:m,active:r,onSelect:g})})]}),(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex h-9 min-w-(--sz-12rem) flex-1 items-center gap-2 rounded-md border border-border px-2.5",children:[(0,e.jsx)(Ir,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,e.jsx)("input",{value:o,onChange:n(w=>x(w.target.value),"onChange"),placeholder:"Search skills, authors, categories…",className:"h-full w-full bg-transparent text-base outline-none placeholder:text-muted-foreground sm:text-sm"})]}),(0,e.jsxs)(Bs,{children:[(0,e.jsx)(Ls,{asChild:!0,children:(0,e.jsxs)(k,{variant:"outline",size:"sm",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"Sort"}),(0,e.jsx)("span",{className:"ml-1.5",children:xn[N]}),(0,e.jsx)(ps,{className:"ml-1 h-3.5 w-3.5"})]})}),(0,e.jsx)(Ps,{align:"end",children:(0,e.jsx)(xt,{value:N,onValueChange:n(w=>v(w),"onValueChange"),children:Ma.map(w=>(0,e.jsx)(Ds,{value:w,children:xn[w]},w))})})]}),ue.length>1?(0,e.jsxs)(Bs,{children:[(0,e.jsx)(Ls,{asChild:!0,children:(0,e.jsxs)(k,{variant:"outline",size:"sm",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"Source"}),(0,e.jsx)("span",{className:"ml-1.5 capitalize",children:O==="all"?"All":Ys(O,null).label}),(0,e.jsx)(ps,{className:"ml-1 h-3.5 w-3.5"})]})}),(0,e.jsx)(Ps,{align:"end",children:(0,e.jsxs)(xt,{value:O,onValueChange:Ue,children:[(0,e.jsx)(Ds,{value:"all",children:"All sources"}),ue.map(w=>(0,e.jsx)(Ds,{value:w,children:Ys(w,null).label},w))]})})]}):null,(0,e.jsx)(k,{variant:"ghost",size:"icon-sm",onClick:n(()=>K(),"onClick"),disabled:Z,"aria-label":"Scan project workspaces for skills",title:"Scan project workspaces for skills",children:(0,e.jsx)(Ws,{className:M("h-4 w-4",Z&&"animate-spin")})}),(0,e.jsx)(k,{asChild:!0,variant:"outline",size:"sm",children:(0,e.jsxs)(Je,{to:"/skills/studio",children:[(0,e.jsx)(Pn,{className:"h-3.5 w-3.5"}),"Studio"]})}),(0,e.jsxs)(Bs,{children:[(0,e.jsx)(Ls,{asChild:!0,children:(0,e.jsxs)(k,{size:"sm",variant:"default",children:[(0,e.jsx)(yt,{className:"mr-1 h-3.5 w-3.5"}),"New",(0,e.jsx)(ps,{className:"ml-1 h-3.5 w-3.5"})]})}),(0,e.jsxs)(Ps,{align:"end",children:[(0,e.jsxs)(Es,{onSelect:X,children:[(0,e.jsx)(kn,{className:"mr-2 h-4 w-4"}),"Create new skill"]}),(0,e.jsxs)(Es,{onSelect:b,children:[(0,e.jsx)(pe,{className:"mr-2 h-4 w-4"}),"Browse catalog"]}),(0,e.jsxs)(Es,{onSelect:j,children:[(0,e.jsx)(Dr,{className:"mr-2 h-4 w-4"}),"Import from path or URL"]}),(0,e.jsxs)(Es,{onSelect:L,children:[(0,e.jsx)(Pr,{className:"mr-2 h-4 w-4"}),"Import skills from project"]})]})]}),q&&de?(0,e.jsx)("div",{className:"w-full md:hidden",children:(0,e.jsx)(ta,{result:q,selection:U,allLabel:"All skills",onClick:qs??(()=>{})})}):null,we&&!me?(0,e.jsxs)(k,{variant:"outline",size:"sm",onClick:we,children:[(0,e.jsx)(yt,{className:"mr-1 h-3.5 w-3.5"}),"New folder"]}):null,be?(0,e.jsx)(k,{variant:"ghost",size:"sm",onClick:be,children:D?"Done":"Select"}):null]}),u.length>0?(0,e.jsx)("div",{className:"border-b border-border px-4 py-2 md:hidden",children:(0,e.jsxs)(Bs,{children:[(0,e.jsx)(Ls,{asChild:!0,children:(0,e.jsxs)(k,{variant:"outline",size:"sm",className:"w-full justify-between",children:[(0,e.jsx)("span",{className:"capitalize",children:r??"All categories"}),(0,e.jsx)(ps,{className:"h-3.5 w-3.5"})]})}),(0,e.jsx)(Ps,{align:"start",className:"max-h-72 overflow-auto",children:(0,e.jsxs)(xt,{value:r??"__all__",onValueChange:n(w=>g(w==="__all__"?null:w),"onValueChange"),children:[(0,e.jsxs)(Ds,{value:"__all__",children:["All (",m,")"]}),u.map(w=>(0,e.jsxs)(Ds,{value:w.slug,className:"capitalize",children:[w.slug," (",w.count,")"]},w.slug))]})})]})}):null,(0,e.jsx)("div",{className:"border-b border-border px-4",children:(0,e.jsx)(wn,{value:t,onValueChange:n(w=>a(w),"onValueChange"),children:(0,e.jsxs)(Nn,{variant:"line",className:"p-0",children:[(0,e.jsxs)(As,{value:"all",className:"px-3",children:[(0,e.jsx)("span",{children:"All"}),(0,e.jsx)("span",{className:"ml-1.5 text-(length:--text-micro) text-muted-foreground",children:l.all})]}),(0,e.jsxs)(As,{value:"installed",className:"px-3",children:[(0,e.jsx)("span",{children:"Installed"}),(0,e.jsx)("span",{className:"ml-1.5 text-(length:--text-micro) text-muted-foreground",children:l.installed})]}),(0,e.jsxs)(As,{value:"catalog",className:"px-3",children:[(0,e.jsx)("span",{children:"Catalog"}),(0,e.jsx)("span",{className:"ml-1.5 text-(length:--text-micro) text-muted-foreground",children:l.catalog})]}),(0,e.jsxs)(As,{value:"bundled",className:"px-3",children:[(0,e.jsx)("span",{children:"Bundled"}),(0,e.jsx)("span",{className:"ml-1.5 text-(length:--text-micro) text-muted-foreground",children:l.bundled})]})]})})}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[ge?(0,e.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:ge}):null,me&&de?(0,e.jsxs)("div",{className:"mb-4 flex items-center justify-between gap-2",children:[(0,e.jsx)(ba,{result:q,selection:U,onSelect:de}),ne&&ye?(0,e.jsxs)(k,{variant:"ghost",size:"sm",onClick:n(()=>K(ye),"onClick"),disabled:Z,"aria-label":`Refresh ${ne.name} project skills`,title:`Refresh skills from ${ne.name}`,children:[(0,e.jsx)(Ws,{className:M("h-3.5 w-3.5",Z&&"animate-spin")}),"Refresh"]}):null]}):null,J&&we&&q&&q.folders.length===0&&!p&&F.length>0?(0,e.jsx)(Qr,{storageKey:J,itemLabelPlural:"skills",onCreateFolder:we}):null,D&&_e&&ss&&ts?(0,e.jsx)("div",{className:"mb-3",children:(0,e.jsx)(sa,{selectedCount:W.length,folders:q?.folders??[],onMove:_e,onCreateAndMove:ss,onClear:ts,onDone:be??ts})}):null,p?(0,e.jsx)(Le,{variant:"list"}):A?(0,e.jsx)("div",{className:"py-6 text-sm text-destructive",children:A}):Ce.length===0?(0,e.jsxs)("div",{className:"py-12",children:[(0,e.jsx)(Ze,{icon:zr,message:$===0?"No skills yet. Create one or install from the catalog.":o||r||ve?"No skills match your filters.":"No skills in this tab yet."}),$===0?(0,e.jsxs)("div",{className:"mt-3 flex flex-col items-center gap-2",children:[(0,e.jsxs)(k,{size:"sm",onClick:b,children:[(0,e.jsx)(pe,{className:"mr-1.5 h-3.5 w-3.5"})," Browse catalog"]}),(0,e.jsx)(k,{size:"sm",variant:"ghost",onClick:X,children:"Create a skill"})]}):o||r||ve?(0,e.jsx)("div",{className:"mt-3 flex justify-center",children:(0,e.jsx)(k,{size:"sm",variant:"ghost",onClick:n(()=>{x(""),g(null),Ue("all")},"onClick"),children:"Clear filters"})}):null]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("p",{className:"mb-3 text-xs text-muted-foreground",children:[Ce.length," ",Ce.length===1?"skill":"skills",r?(0,e.jsxs)("span",{className:"capitalize",children:[" · ",r]}):null]}),(0,e.jsx)("div",{className:"grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(19rem,1fr))]",children:Ce.map(w=>(0,e.jsx)(_a,{card:w,folders:q?.folders,selected:W.includes(w.skillId??""),selectMode:D,showFolderBadge:!!(q&&o.trim()),onOpen:y,onSelectChange:ie,onMove:ce,onCreateFolderAndMove:je,onOpenMove:ks},w.key))})]})]})]})]})}n(Oa,"DiscoveryGrid");function Va({initialDraft:t,onCreate:l,isPending:a,error:u,onCancel:m}){const[r,g]=(0,c.useState)(0),[o,x]=(0,c.useState)(t),[N,v]=(0,c.useState)(t.slug.trim().length>0),F=o.categories.join(", "),y=["Basics","Design","Content","Review"];(0,c.useEffect)(()=>{g(0),x(t),v(t.slug.trim().length>0)},[t]);function p(j){x(L=>({...L,...j}))}n(p,"patchDraft");const A=o.name.trim().length>0,$=o.slug.trim()||pt(o.name);function X(){l(Wr(o))}return n(X,"submit"),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"flex items-center gap-2 border-b border-border pb-3",children:y.map((j,L)=>(0,e.jsx)("button",{type:"button",onClick:n(()=>g(L),"onClick"),className:M("rounded-md px-2 py-1 text-xs",r===L?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:j},j))}),o.forkedFromName?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsx)(ys,{className:"h-3.5 w-3.5"}),"Forking ",o.forkedFromName]}):null,r===0?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(Me,{value:o.name,onChange:n(j=>{const L=j.target.value;p({name:L,slug:N?o.slug:pt(L),markdown:o.markdown===Gs(o.name,o.tagline)?Gs(L,o.tagline):o.markdown})},"onChange"),placeholder:"Skill name",className:"h-9"}),(0,e.jsx)(Me,{value:o.slug,onChange:n(j=>{const L=pt(j.target.value);v(L.length>0),p({slug:L})},"onChange"),placeholder:"skill-shortname",className:"h-9 font-mono"}),(0,e.jsx)(jt,{value:o.tagline,onChange:n(j=>{const L=j.target.value;p({tagline:L,description:o.description?o.description:L,markdown:o.markdown===Gs(o.name,o.tagline)?Gs(o.name,L):o.markdown})},"onChange"),placeholder:"One-line promise for the skill",className:"min-h-20"})]}):r===1?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(Lt,{size:48,card:{key:$||o.name||"new-skill",name:o.name||"New Skill",slug:$||"skill",iconUrl:null,color:o.color}}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium",children:o.name||"New Skill"}),(0,e.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:o.tagline||"No tagline yet."})]})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"mb-2 block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Color"}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[Yr.map(j=>(0,e.jsx)("button",{type:"button",onClick:n(()=>p({color:j}),"onClick"),className:M("h-7 w-7 rounded-md border",o.color===j?"border-foreground":"border-border"),style:{backgroundColor:j},"aria-label":`Use ${j}`},j)),(0,e.jsx)(Me,{value:o.color,onChange:n(j=>p({color:j.target.value}),"onChange"),className:"h-7 w-28 font-mono text-xs"})]})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"mb-2 block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Categories"}),(0,e.jsx)(Me,{value:F,onChange:n(j=>p({categories:En(j.target.value)}),"onChange"),placeholder:"engineering, review, memory",className:"h-9"})]})]}):r===2?(0,e.jsx)("div",{className:"space-y-2",children:(0,e.jsx)(jt,{value:o.markdown,onChange:n(j=>p({markdown:j.target.value}),"onChange"),className:"h-(--sz-calc-34) resize-y font-mono text-xs"})}):(0,e.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,e.jsxs)("div",{className:"grid grid-cols-(--gtc-26) gap-y-2",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"Name"}),(0,e.jsx)("span",{children:o.name||"Untitled"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:"Slug"}),(0,e.jsx)("span",{className:"font-mono",children:$||"skill"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:"Scope"}),(0,e.jsx)("span",{children:o.sharingScope==="private"?"Private":"Company"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:"Categories"}),(0,e.jsx)("span",{children:o.categories.length?o.categories.join(", "):"none"})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sharing"}),(0,e.jsxs)("div",{className:"grid gap-2 sm:grid-cols-3",children:[["company","private"].map(j=>(0,e.jsxs)("button",{type:"button",onClick:n(()=>p({sharingScope:j}),"onClick"),className:M("rounded-md border px-3 py-2 text-left text-sm",o.sharingScope===j?"border-foreground bg-accent/50":"border-border"),children:[(0,e.jsx)("span",{className:"block font-medium",children:j==="company"?"Company":"Private"}),(0,e.jsx)("span",{className:"mt-1 block text-xs text-muted-foreground",children:j==="company"?"Visible inside this company.":"Only visible in your library."})]},j)),(0,e.jsxs)("button",{type:"button",disabled:!0,className:"rounded-md border border-dashed border-border px-3 py-2 text-left text-sm text-muted-foreground",children:[(0,e.jsx)("span",{className:"block font-medium",children:"Public link"}),(0,e.jsx)("span",{className:"mt-1 block text-xs",children:"Coming later."})]})]})]})]}),u?(0,e.jsx)("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:u}):null,(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 border-t border-border pt-3",children:[(0,e.jsx)(k,{variant:"ghost",size:"sm",onClick:m,disabled:a,children:"Cancel"}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(k,{variant:"ghost",size:"sm",onClick:n(()=>g(j=>Math.max(0,j-1)),"onClick"),disabled:a||r===0,children:"Back"}),r<y.length-1?(0,e.jsx)(k,{size:"sm",onClick:n(()=>g(j=>Math.min(y.length-1,j+1)),"onClick"),disabled:!A,children:"Next"}):(0,e.jsx)(k,{size:"sm",onClick:X,disabled:a||!A,children:a?"Creating...":o.forkedFromSkillId?"Create fork":"Create skill"})]})]})]})}n(Va,"NewSkillWizard");function Qa({skill:t,packageName:l,packageVersion:a,installedSkill:u,installedSkillId:m,fileQuery:r,selectedPath:g,onInstall:o,onUpdate:x,onOpenInstalled:N,loadingPrimaryAction:v}){if(!t)return(0,e.jsx)(Ze,{icon:pe,message:"Select a catalog skill to inspect."});const F=u?.originHash??null,y=!!(u&&F&&F!==t.contentHash),p=!!u;let A;t.compatibility==="invalid"?A=(0,e.jsxs)(qe,{children:[(0,e.jsx)(Re,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsxs)(k,{disabled:!0,children:[(0,e.jsx)(Nt,{className:"mr-1.5 h-3.5 w-3.5"}),"Install skill"]})})}),(0,e.jsx)($e,{children:"This skill cannot be installed — its content is not valid Agent Skills markdown."})]}):p?y?A=(0,e.jsxs)(k,{onClick:x,disabled:v,className:"border-amber-500/40 bg-amber-500/20 text-amber-900 dark:text-amber-100 hover:bg-amber-500/30",children:[(0,e.jsx)(St,{className:"mr-1.5 h-3.5 w-3.5"}),"Update from catalog"]}):A=(0,e.jsxs)(k,{variant:"ghost",onClick:n(()=>m&&N(m),"onClick"),children:[(0,e.jsx)(Cn,{className:"mr-1.5 h-3.5 w-3.5"}),"Installed · Open in library"]}):A=(0,e.jsxs)(k,{onClick:o,disabled:v,children:[t.trustLevel==="scripts_executables"?(0,e.jsx)(Dn,{className:"mr-1.5 h-3.5 w-3.5"}):(0,e.jsx)(Nt,{className:"mr-1.5 h-3.5 w-3.5"}),v?"Preparing...":"Install skill in this organization"]});const $=r.data?.markdown?qn(r.data.content):r.data?.content??"";return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"border-b border-border px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("h1",{className:"flex items-center gap-2 truncate text-2xl font-semibold",children:[(0,e.jsx)(pe,{className:M("h-5 w-5 shrink-0 text-muted-foreground",t.kind==="optional"&&"opacity-70"),"aria-hidden":"true"}),t.name]}),(0,e.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-muted-foreground",children:t.description}),(0,e.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"rounded border border-border bg-muted/40 px-1.5 py-0.5 uppercase tracking-wide",children:t.kind}),(0,e.jsx)("span",{children:"·"}),(0,e.jsx)("span",{children:t.category}),(0,e.jsx)("span",{children:"·"}),(0,e.jsx)(Ba,{packageName:l,packageVersion:a})]})]}),(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:A})]}),(0,e.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2 border-t border-border pt-4",children:[(0,e.jsx)($n,{level:t.trustLevel}),(0,e.jsx)(zn,{compatibility:t.compatibility}),y?(0,e.jsxs)(qe,{children:[(0,e.jsx)(Re,{asChild:!0,children:(0,e.jsxs)(le,{variant:"outline",className:"border-amber-500/40 bg-amber-500/10 text-(length:--text-micro) text-amber-800 dark:text-amber-200",children:[(0,e.jsx)(St,{className:"h-3 w-3","aria-hidden":"true"}),"Update available"]})}),(0,e.jsx)($e,{children:"Catalog content hash has changed since this skill was installed."})]}):null,t.requires.length>0?(0,e.jsxs)(le,{variant:"outline",className:"border-border bg-muted/40 text-(length:--text-micro) text-muted-foreground",children:["Requires: ",t.requires.join(", ")]}):null,t.recommendedForRoles.length>0?(0,e.jsxs)(le,{variant:"outline",className:"border-border bg-muted/40 text-(length:--text-micro) text-muted-foreground",children:["Roles: ",t.recommendedForRoles.join(" · ")]}):null,t.tags.length>0?(0,e.jsxs)(le,{variant:"outline",className:"border-border bg-muted/40 text-(length:--text-micro) text-muted-foreground",children:["Tags: ",t.tags.join(" · ")]}):null]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"uppercase tracking-(--tracking-caps)",children:"Key"}),(0,e.jsx)("span",{className:"font-mono",children:t.key}),(0,e.jsx)("span",{className:"uppercase tracking-(--tracking-caps)",children:"·"}),(0,e.jsx)("span",{className:"uppercase tracking-(--tracking-caps)",children:"Hash"}),(0,e.jsxs)("span",{className:"font-mono",children:[t.contentHash.slice(0,24),"…"]}),(0,e.jsx)(Vr,{text:t.contentHash,copiedLabel:"Copied hash",ariaLabel:"Copy content hash",title:"Copy content hash",className:"inline-flex h-6 w-6 items-center justify-center rounded-sm border border-border text-muted-foreground hover:bg-accent hover:text-foreground",children:(0,e.jsx)(In,{className:"h-3 w-3"})})]})]}),(0,e.jsx)("div",{className:"border-b border-border px-5 py-3",children:(0,e.jsx)("div",{className:"truncate font-mono text-sm",children:g})}),(0,e.jsx)("div",{className:"min-h-(--sz-400px) px-5 py-5",children:r.isLoading?(0,e.jsx)(Le,{variant:"detail"}):r.error?(0,e.jsx)("div",{className:"text-sm text-destructive",children:r.error instanceof Error?r.error.message:"Failed to load file"}):r.data?r.data.markdown?(0,e.jsx)(kt,{softBreaks:!1,linkIssueReferences:!1,children:$}):(0,e.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap wrap-break-word border-0 bg-transparent p-0 font-mono text-sm text-foreground",children:(0,e.jsx)("code",{children:r.data.content})}):(0,e.jsx)("div",{className:"text-sm text-muted-foreground",children:"Select a file to inspect."})})]})}n(Qa,"CatalogDetailPane");function Ha(t){return new Set(t.filter(l=>l.supportsSkills&&!l.required).map(l=>l.id))}n(Ha,"defaultInstallAgentSelection");function Ga({open:t,onOpenChange:l,skill:a,packageName:u,packageVersion:m,conflict:r,defaultSlug:g,defaultForce:o,defaultAction:x,agents:N,isPending:v,error:F,onConfirm:y}){const[p,A]=(0,c.useState)(""),[$,X]=(0,c.useState)(!1),[j,L]=(0,c.useState)(!1),[b,K]=(0,c.useState)(new Set),[Z,ge]=(0,c.useState)(!1),q=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{t&&(A(g??""),X(o),L(x==="replace"||o))},[t,g,o,x]),(0,c.useEffect)(()=>{t&&!q.current&&ge(!1),q.current=t},[t]),(0,c.useEffect)(()=>{!t||Z||K(x==="install"?Ha(N):new Set)},[t,Z,x,N]),!a)return null;let U="Install skill",fe="default";return x==="update"?U="Install update":x==="replace"&&(U="Replace existing skill",fe="destructive"),v&&(U="Installing…"),(0,e.jsx)(js,{open:t,onOpenChange:n(D=>v?null:l(D),"onOpenChange"),children:(0,e.jsxs)(fs,{className:"sm:max-w-2xl",showCloseButton:!v,children:[(0,e.jsxs)(bs,{children:[(0,e.jsxs)(vs,{children:[x==="update"?"Update":x==="replace"?"Replace":"Install"," · ",a.name]}),(0,e.jsxs)(Ts,{children:[(0,e.jsx)("span",{className:"capitalize",children:a.kind})," · ",a.category,u?(0,e.jsxs)(e.Fragment,{children:[" · ",u,m?` v${m}`:""]}):null]})]}),(0,e.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,e.jsx)("div",{className:"rounded-md border border-border p-3",children:(0,e.jsxs)("div",{className:"grid grid-cols-(--gtc-26) gap-y-2 text-xs",children:[(0,e.jsx)("div",{className:"text-muted-foreground",children:"Trust"}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)($n,{level:a.trustLevel}),a.trustLevel==="markdown_only"?(0,e.jsx)("span",{className:"text-muted-foreground",children:"Safe"}):a.trustLevel==="scripts_executables"?(0,e.jsx)("span",{className:"text-amber-800 dark:text-amber-200",children:"Review required"}):(0,e.jsx)("span",{className:"text-muted-foreground",children:"Non-script assets"})]}),(0,e.jsx)("div",{className:"text-muted-foreground",children:"Compatibility"}),(0,e.jsx)("div",{className:"flex items-center gap-2",children:a.compatibility==="compatible"?(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,e.jsx)(Cn,{className:"h-3 w-3","aria-hidden":"true"}),"Compatible"]}):(0,e.jsx)(zn,{compatibility:a.compatibility})}),(0,e.jsx)("div",{className:"text-muted-foreground",children:"Requires"}),(0,e.jsx)("div",{className:"text-foreground",children:a.requires.length===0?"none":a.requires.join(", ")}),(0,e.jsx)("div",{className:"text-muted-foreground",children:"Roles"}),(0,e.jsx)("div",{className:"text-foreground",children:a.recommendedForRoles.length===0?"any":a.recommendedForRoles.join(" · ")}),(0,e.jsx)("div",{className:"text-muted-foreground",children:"Provenance"}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"truncate",children:[u??"—",m?` v${m}`:""]}),(0,e.jsx)("div",{className:"truncate font-mono text-(length:--text-micro) text-muted-foreground",children:a.contentHash})]})]})}),(0,e.jsxs)("div",{className:"rounded-md border border-border",children:[(0,e.jsxs)("div",{className:"border-b border-border px-3 py-2 text-xs uppercase tracking-wide text-muted-foreground",children:["Files (",a.files.length,")"]}),(0,e.jsx)("div",{className:"max-h-48 overflow-y-auto",children:a.files.map(D=>(0,e.jsxs)("div",{className:"grid grid-cols-(--gtc-27) items-center gap-x-3 border-b border-border/50 px-3 py-1.5 text-xs last:border-b-0",children:[(0,e.jsx)("span",{className:"truncate font-mono text-muted-foreground",children:D.path}),(0,e.jsx)("span",{className:"rounded border border-border bg-muted/40 px-1 py-0.5 text-(length:--text-nano) uppercase text-muted-foreground",children:D.kind}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-muted-foreground",children:Pa(D.sizeBytes)})]},D.path))})]}),r?(0,e.jsxs)("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-xs text-amber-800 dark:text-amber-200",children:["An existing skill with key ",(0,e.jsx)("span",{className:"font-mono",children:r.key})," is installed (",r.sourceLabel??r.sourceType,"). Installing will ",x==="update"?"overwrite the catalog content":"replace the existing skill","."]}):null,x==="install"?(0,e.jsxs)("div",{className:"rounded-md border border-border p-3",children:[(0,e.jsx)("div",{className:"mb-1 text-xs uppercase tracking-wide text-muted-foreground",children:"Enable for agents"}),(0,e.jsx)("p",{className:"mb-2 text-xs text-muted-foreground",children:"Installing adds the skill to the company library. Agents can only use it once it is enabled for them."}),(0,e.jsx)(An,{agents:N,selectedAgentIds:b,onChange:n(D=>{ge(!0),K(D)},"onChange"),showSelectionPreview:!1,emptyMessage:"No agents in this company support skills yet.",isAgentDisabled:n(D=>{const W=D;return W.required||!W.supportsSkills},"isAgentDisabled"),getDescription:n(D=>{const W=D;return`${W.adapterType}${W.required?" · required":""}${W.supportsSkills?"":" · skills not supported"}`},"getDescription")})]}):null,(0,e.jsxs)("button",{type:"button",onClick:n(()=>L(D=>!D),"onClick"),className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[j?(0,e.jsx)(ps,{className:"h-3 w-3"}):(0,e.jsx)(Fn,{className:"h-3 w-3"}),"Advanced"]}),j?(0,e.jsxs)("div",{className:"space-y-3 rounded-md border border-border p-3 text-xs",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"mb-1 block uppercase tracking-wide text-muted-foreground",children:"Slug override"}),(0,e.jsx)(Me,{value:p,onChange:n(D=>A(D.target.value),"onChange"),placeholder:g??a.slug,className:"h-8"})]}),(0,e.jsxs)("label",{className:"flex items-center gap-2",children:[(0,e.jsx)(Kr,{checked:$,onCheckedChange:n(D=>X(!!D),"onCheckedChange")}),(0,e.jsx)("span",{children:"Force replace existing same-key skill"})]})]}):null,F?(0,e.jsx)("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-3 text-xs text-destructive",children:F}):null]}),(0,e.jsxs)(vt,{children:[(0,e.jsx)(k,{variant:"ghost",onClick:n(()=>l(!1),"onClick"),disabled:v,children:"Cancel"}),(0,e.jsx)(k,{variant:fe,onClick:n(()=>y({slug:p.trim().length>0?p.trim():null,force:$,agentIds:x==="install"?Array.from(b):[]}),"onClick"),disabled:v,children:U})]})]})})}n(Ga,"InstallPreviewDialog");function jn({agents:t,attachedAgentIds:l,versions:a,selectedVersionId:u,pending:m,onSubmit:r,fullWidth:g=!1}){const[o,x]=(0,c.useState)(u),N=(0,c.useMemo)(()=>new Set(l),[l]),v=t.filter(y=>y.supportsSkills),F=[...a].sort((y,p)=>p.revisionNumber-y.revisionNumber);return(0,e.jsx)(An,{agents:t,selectedAgentIds:N,onSave:n(y=>r(Array.from(y),o),"onSave"),pending:m,triggerLabel:"Add to agent",triggerIcon:(0,e.jsx)(yt,{className:"mr-1.5 h-3.5 w-3.5"}),triggerVariant:"default",triggerSize:"sm",triggerFullWidth:g,triggerClassName:M(g&&"w-full"),contentAlign:"end",showSelectionPreview:!1,onOpenChange:n(y=>{y&&x(u)},"onOpenChange"),headerContent:F.length>0?(0,e.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-xs",children:[(0,e.jsx)("span",{className:"shrink-0 text-muted-foreground",children:"Version"}),(0,e.jsxs)("select",{value:o??"__latest__",onChange:n(y=>x(y.target.value==="__latest__"?null:y.target.value),"onChange"),className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs text-foreground",children:[(0,e.jsx)("option",{value:"__latest__",children:"Latest"}),F.map(y=>(0,e.jsxs)("option",{value:y.id,children:["v",y.revisionNumber,y.label?` · ${y.label}`:""]},y.id))]})]}):null,emptyMessage:v.length===0?"No agents in this company support skills yet.":"No agents yet.",isAgentDisabled:n(y=>{const p=y;return p.required||!p.supportsSkills},"isAgentDisabled"),getDescription:n(y=>{const p=y;return`${p.adapterType}${p.required?" · required":""}${p.supportsSkills?"":" · skills not supported"}`},"getDescription"),renderNameSuffix:n(y=>y.paused?(0,e.jsxs)(le,{variant:"outline",className:"[&>svg]:size-2.5 border-amber-500/30 bg-amber-500/10 px-1.5 text-(length:--text-nano) uppercase tracking-wide text-amber-500",children:[(0,e.jsx)(wt,{className:"h-2.5 w-2.5","aria-hidden":"true"}),"Paused"]}):null,"renderNameSuffix")})}n(jn,"AttachAgentsPopover");function Bt({nodes:t,skillId:l,selectedPath:a,expandedDirs:u,onToggleDir:m,onSelectPath:r,fileHref:g=n((x,N)=>Ks(x,N),"fileHref"),depth:o=0}){return(0,e.jsx)("div",{children:t.map(x=>{const N=x.kind==="dir"&&x.path?u.has(x.path):!1;if(x.kind==="dir")return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:M("group grid w-full grid-cols-(--gtc-3) items-center gap-x-1 pr-3 text-left text-sm text-muted-foreground hover:bg-accent/30 hover:text-foreground",dn),children:[(0,e.jsxs)("button",{type:"button",className:"flex min-w-0 items-center gap-2 py-1 text-left",style:{paddingLeft:`${ln+o*on}px`},onClick:n(()=>x.path&&m(x.path),"onClick"),children:[(0,e.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:N?(0,e.jsx)(It,{className:"h-3.5 w-3.5"}):(0,e.jsx)(Ft,{className:"h-3.5 w-3.5"})}),(0,e.jsx)("span",{className:"truncate",children:x.name})]}),(0,e.jsx)("button",{type:"button",className:"flex h-9 w-9 items-center justify-center self-center rounded-sm text-muted-foreground opacity-70 transition-(--tp-background-color-color-opacity) hover:bg-accent hover:text-foreground group-hover:opacity-100",onClick:n(()=>x.path&&m(x.path),"onClick"),children:N?(0,e.jsx)(ps,{className:"h-3.5 w-3.5"}):(0,e.jsx)(Fn,{className:"h-3.5 w-3.5"})})]}),N&&(0,e.jsx)(Bt,{nodes:x.children,skillId:l,selectedPath:a,expandedDirs:u,onToggleDir:m,onSelectPath:r,fileHref:g,depth:o+1})]},x.path??x.name);const v=Ia(x.fileKind??"other");return(0,e.jsxs)(Je,{className:M("flex w-full items-center gap-2 pr-3 text-left text-sm text-muted-foreground hover:bg-accent/30 hover:text-foreground",dn,x.path===a&&"text-foreground"),style:{paddingInlineStart:`${ln+o*on}px`},to:g(l,x.path),onClick:n(()=>x.path&&r(x.path),"onClick"),children:[(0,e.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:(0,e.jsx)(v,{className:"h-3.5 w-3.5"})}),(0,e.jsx)("span",{className:"truncate",children:x.name})]},x.path??x.name)})})}n(Bt,"SkillTree");var Wa=[{value:"overview",label:"Overview",icon:Dt},{value:"files",label:"Files",icon:It},{value:"versions",label:"Versions",icon:Tn},{value:"agents",label:"Agents",icon:ga}];function bt(t){return t?.usedByAgents.find(l=>l.versionId)?.versionId??null}n(bt,"currentVersionSelection");function Ms(t){return t?`v${t.revisionNumber}${t.label?` · ${t.label}`:""}`:"Latest"}n(Ms,"versionLabel");function Ya(t,l){const a=[...t].sort((m,r)=>r.revisionNumber-m.revisionNumber),u=l?a.find(m=>m.id===l)??null:a[0]??null;return u?{leftVersionId:(a.find(m=>m.revisionNumber<u.revisionNumber)??null)?.id??null,rightVersionId:u.id}:{leftVersionId:null,rightVersionId:null}}n(Ya,"getSkillVersionDiffSelection");function Xa({open:t,onOpenChange:l,versions:a,leftVersionId:u,rightVersionId:m,onLeftVersionChange:r,onRightVersionChange:g}){const o=[...a].sort((b,K)=>K.revisionNumber-b.revisionNumber),x=o.find(b=>b.id===u)??null,N=o.find(b=>b.id===m)??null,v=(0,c.useMemo)(()=>{const b=new Set;for(const K of x?.fileInventory??[])b.add(K.path);for(const K of N?.fileInventory??[])b.add(K.path);return Array.from(b).sort((K,Z)=>K==="SKILL.md"?-1:Z==="SKILL.md"?1:K.localeCompare(Z))},[x,N]),[F,y]=(0,c.useState)("SKILL.md"),p=v.includes(F)?F:v[0]??"SKILL.md",A=x?.fileInventory.find(b=>b.path===p),$=N?.fileInventory.find(b=>b.path===p),X=(0,c.useMemo)(()=>Ur(A?.content??"",$?.content??""),[A?.content,$?.content]),j={context:"bg-transparent",removed:"bg-red-500/10 text-red-900 dark:text-red-100",added:"bg-green-500/10 text-green-900 dark:text-green-100"},L={context:" ",removed:"-",added:"+"};return(0,c.useEffect)(()=>{t&&v.length>0&&!v.includes(F)&&y(v[0])},[v,t,F]),(0,e.jsx)(js,{open:t,onOpenChange:l,children:(0,e.jsxs)(fs,{className:"flex max-h-(--sz-85vh) w-full !max-w-(--pct-90) flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[(0,e.jsx)(bs,{className:"shrink-0",children:(0,e.jsx)(vs,{children:"Diff · skill files"})}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs",children:[(0,e.jsxs)("label",{className:"flex items-center gap-2",children:[(0,e.jsx)(le,{variant:"outline",className:"border-red-500/30 bg-red-500/10 uppercase tracking-wider text-red-400",children:"Old"}),(0,e.jsxs)("select",{value:u??"",onChange:n(b=>r(b.target.value||null),"onChange"),className:"h-8 w-44 rounded-md border border-border bg-background px-2 text-xs",children:[(0,e.jsx)("option",{value:"",children:"Initial"}),o.map(b=>(0,e.jsx)("option",{value:b.id,children:Ms(b)},b.id))]})]}),(0,e.jsxs)("label",{className:"flex items-center gap-2",children:[(0,e.jsx)(le,{variant:"outline",className:"border-green-500/30 bg-green-500/10 uppercase tracking-wider text-green-400",children:"New"}),(0,e.jsx)("select",{value:N?.id??"",onChange:n(b=>g(b.target.value||null),"onChange"),className:"h-8 w-44 rounded-md border border-border bg-background px-2 text-xs",children:o.map(b=>(0,e.jsx)("option",{value:b.id,children:Ms(b)},b.id))})]})]})]}),(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 gap-3",children:[(0,e.jsx)("aside",{className:"hidden w-56 shrink-0 overflow-auto border-r border-border pr-3 md:block",children:v.map(b=>(0,e.jsxs)("button",{type:"button",onClick:n(()=>y(b),"onClick"),className:M("flex w-full items-center gap-2 px-2 py-1.5 text-left font-mono text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",p===b&&"bg-accent/50 text-foreground"),children:[(0,e.jsx)(Dt,{className:"h-3.5 w-3.5 shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:b})]},b))}),(0,e.jsx)("div",{className:"min-w-0 flex-1 overflow-auto rounded-md border border-border text-xs",children:N?x?.id===N.id?(0,e.jsx)("div",{className:"p-6 text-center text-sm text-muted-foreground",children:"Both sides are the same version."}):(0,e.jsxs)("div",{className:"font-mono text-xs leading-6",children:[(0,e.jsxs)("div",{className:"grid grid-cols-(--gtc-1) border-b border-border/60 bg-muted/30 px-3 py-2 text-(length:--text-micro) uppercase tracking-wide text-muted-foreground",children:[(0,e.jsx)("span",{children:"Old"}),(0,e.jsx)("span",{children:"New"}),(0,e.jsx)("span",{}),(0,e.jsx)("span",{children:p})]}),X.map((b,K)=>(0,e.jsxs)("div",{className:M("grid grid-cols-(--gtc-1) gap-0 border-b border-border/30 px-3",j[b.kind]),children:[(0,e.jsx)("span",{className:"select-none border-r border-border/30 pr-3 text-right text-muted-foreground",children:b.oldLineNumber??""}),(0,e.jsx)("span",{className:"select-none border-r border-border/30 px-3 text-right text-muted-foreground",children:b.newLineNumber??""}),(0,e.jsx)("span",{className:"select-none px-3 text-center text-muted-foreground",children:L[b.kind]}),(0,e.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words px-3 py-0 text-inherit",children:b.text.length>0?b.text:" "})]},`${b.kind}-${K}-${b.oldLineNumber??"x"}-${b.newLineNumber??"x"}`))]}):(0,e.jsx)("div",{className:"p-6 text-center text-sm text-muted-foreground",children:"Select a version to compare."})})]})]})})}n(Xa,"SkillVersionDiffDialog");function Za({folderPath:t,onMove:l}){const{copied:a,failed:u,copy:m}=Hr(),r=t&&t.length>0?t:"Unfiled";return(0,e.jsxs)("section",{children:[(0,e.jsx)("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Location"}),(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/30 px-2.5 py-1.5",children:[(0,e.jsx)(It,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",title:r,children:r})]}),(0,e.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,e.jsxs)(k,{size:"sm",variant:"outline",onClick:n(()=>{m(r)},"onClick"),children:[(0,e.jsx)(In,{className:"mr-1.5 h-3.5 w-3.5"}),a?"Copied":u?"Copy failed":"Copy path"]}),l?(0,e.jsxs)(k,{size:"sm",variant:"outline",onClick:l,children:[(0,e.jsx)(Bn,{className:"mr-1.5 h-3.5 w-3.5"}),"Move"]}):null]})]})}n(Za,"SkillLocationCard");function Ja({categories:t,pending:l,onSave:a}){const[u,m]=(0,c.useState)("");function r(g){const o=g.trim().toLowerCase();if(!o||t.includes(o)){m("");return}a([...t,o]),m("")}return n(r,"addTag"),(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:[(0,e.jsx)(Lr,{className:"h-3 w-3"}),"Tags"]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[t.map(g=>(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-border bg-accent/40 px-2 py-0.5 text-xs text-foreground",children:[g,(0,e.jsx)("button",{type:"button","aria-label":`Remove tag ${g}`,disabled:l,onClick:n(()=>a(t.filter(o=>o!==g)),"onClick"),className:"text-muted-foreground hover:text-foreground disabled:opacity-50",children:(0,e.jsx)(Sr,{className:"h-3 w-3"})})]},g)),t.length===0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"No tags yet."}):null]}),(0,e.jsx)(Me,{value:u,onChange:n(g=>m(g.target.value),"onChange"),onKeyDown:n(g=>{g.key==="Enter"&&(g.preventDefault(),r(u))},"onKeyDown"),onBlur:n(()=>u.trim()&&r(u),"onBlur"),placeholder:"Add a tag…",disabled:l,className:"mt-2 h-8 text-sm"})]})}n(Ja,"SkillTagsEditor");function el({detail:t,folderDisplayPath:l,catalogSource:a,routeSkills:u,loading:m,activeTab:r,onTabChange:g,selectedPath:o,file:x,fileLoading:N,viewMode:v,editMode:F,draft:y,setViewMode:p,setEditMode:A,setDraft:$,onSave:X,savePending:j,versions:L,versionsLoading:b,attachAgents:K,onSubmitAttach:Z,attachPending:ge,expandedDirs:q,onToggleDir:U,onSelectPath:fe,updateStatus:D,updateStatusLoading:W,onCheckUpdates:de,checkUpdatesPending:we,onInstallUpdate:Be,installUpdatePending:ze,onToggleStar:Se,starPending:es,onFork:be,onUpdateSettings:ie,updateSettingsPending:ce,onMoveToFolder:je,onDelete:_e,deletePending:ss,studioHref:ts}){const[qs,ns]=(0,c.useState)(!1),[rs,ks]=(0,c.useState)(!1),[J,O]=(0,c.useState)("company"),[Ue,ue]=(0,c.useState)(""),Ce=(0,c.useRef)(null),[ve,V]=(0,c.useState)(!1),[me,ne]=(0,c.useState)(!1);(0,c.useEffect)(()=>{const h=Ce.current;!h||ve||ne(h.scrollHeight-h.clientHeight>1)},[t?.description,t?.tagline,t?.id,ve]),(0,c.useEffect)(()=>{V(!1)},[t?.id]),(0,c.useEffect)(()=>{!t||rs||(O(t.sharingScope==="public_link"?"company":t.sharingScope),ue(t.categories.join(", ")))},[t,rs]);const ye=[...L].sort((h,P)=>P.revisionNumber-h.revisionNumber),[w,Fe]=(0,c.useState)(null),[Zs,as]=(0,c.useState)(null);function Rs(h){const P=Ya(ye,h);Fe(P.leftVersionId),as(P.rightVersionId),ns(!!P.rightVersionId)}n(Rs,"openVersionDiff");const ls=x?.content??"",Ns=F&&!!x?.editable&&y!==ls;if((0,c.useEffect)(()=>{if(!Ns)return;const h=n(P=>{P.preventDefault(),P.returnValue=""},"handler");return window.addEventListener("beforeunload",h),()=>window.removeEventListener("beforeunload",h)},[Ns]),!t)return m?(0,e.jsx)(Le,{variant:"detail"}):(0,e.jsx)(Ze,{icon:pe,message:"Skill not found."});const I=t,Js=ts??Kn(I.id),re=Ys(I.sourceBadge,I.sourceLabel),is=re.icon,Oe=x?.markdown?qn(x.content):x?.content??"",et=Xs(I.sourceRef),os=Xs(D?.latestRef),Ve=L.find(h=>h.id===bt(I))??null,ds=Ln(I)??re.label,$s=En(Ue),zs=gn($s)!==gn(I.categories),Pe=J!==(I.sharingScope==="public_link"?"company":I.sharingScope),Qe=zs||Pe,ws=new Map(K.map(h=>[h.id,h])),T=a&&a.type==="github"?a:null,Ss=T?T.hostname==="github.com"?"GitHub":T.hostname:null,Ee=T?`${T.owner}/${T.repo}${T.path?`/${T.path}`:""}`:null,_s=T?T.url??`https://${T.hostname}/${T.owner}/${T.repo}/tree/${T.ref}/${T.path}`.replace(/\/$/,""):null,ee=I.sourcePath||I.sourceLocator||null,cs=I.homepageUrl??(ee&&/^(https?:\/\/|[\w.-]+\.[a-z]{2,}\/)/i.test(ee)?ee.startsWith("http")?ee:`https://${ee}`:null);function se(){return(0,e.jsxs)("div",{className:"grid min-h-(--sz-560px) gap-0 lg:grid-cols-(--gtc-28)",children:[(0,e.jsxs)("aside",{className:"border-b border-border pb-3 lg:border-b-0 lg:border-r lg:pb-0 lg:pr-3",children:[(0,e.jsx)("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Files"}),(0,e.jsx)(Bt,{nodes:Rn(I.fileInventory),skillId:I.id,selectedPath:o,expandedDirs:q,onToggleDir:U,onSelectPath:fe,fileHref:n((h,P)=>Ks(I,u??[I],P),"fileHref")})]}),(0,e.jsxs)("section",{className:"min-w-0 lg:pl-5",children:[(0,e.jsxs)("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-3 border-b border-border pb-3",children:[(0,e.jsx)("div",{className:"min-w-0 truncate font-mono text-sm",children:x?.path??o}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[x?.markdown&&!F?(0,e.jsxs)("div",{className:"flex items-center border border-border",children:[(0,e.jsx)("button",{className:M("px-3 py-1.5 text-sm",v==="preview"?"text-foreground":"text-muted-foreground"),onClick:n(()=>p("preview"),"onClick"),children:(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(Cr,{className:"h-3.5 w-3.5"})," View"]})}),(0,e.jsx)("button",{className:M("border-l border-border px-3 py-1.5 text-sm",v==="code"?"text-foreground":"text-muted-foreground"),onClick:n(()=>p("code"),"onClick"),children:(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(Gr,{className:"h-3.5 w-3.5"})," Code"]})})]}):null,I.editable&&x?.editable?F?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(k,{variant:"ghost",size:"sm",onClick:n(()=>A(!1),"onClick"),disabled:j,children:"Cancel"}),(0,e.jsxs)(k,{size:"sm",onClick:X,disabled:j,children:[(0,e.jsx)(ht,{className:"mr-1.5 h-3.5 w-3.5"}),j?"Saving...":"Save"]})]}):(0,e.jsxs)(k,{variant:"ghost",size:"sm",onClick:n(()=>A(!0),"onClick"),children:[(0,e.jsx)(kn,{className:"mr-1.5 h-3.5 w-3.5"})," Edit"]}):I.editable?null:(0,e.jsxs)(k,{type:"button",variant:"outline",size:"sm",onClick:be,title:I.editableReason??"Fork this skill to edit it.",children:[(0,e.jsx)(ys,{className:"mr-1.5 h-3.5 w-3.5"}),"Fork"]})]})]}),N?(0,e.jsx)(Le,{variant:"detail"}):x?F&&x.editable?x.markdown?(0,e.jsx)(Br,{value:y,onChange:$,bordered:!1,className:"min-h-(--sz-520px)"}):(0,e.jsx)(jt,{value:y,onChange:n(h=>$(h.target.value),"onChange"),className:"min-h-(--sz-520px) rounded-none border-0 bg-transparent px-0 py-0 font-mono text-sm shadow-none focus-visible:ring-0"}):x.markdown&&v==="preview"?(0,e.jsx)(kt,{softBreaks:!1,linkIssueReferences:!1,children:Oe}):(0,e.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap wrap-break-word border-0 bg-transparent p-0 font-mono text-sm text-foreground",children:(0,e.jsx)("code",{children:x.content})}):(0,e.jsx)("div",{className:"text-sm text-muted-foreground",children:"Select a file to inspect."})]})]})}n(se,"renderFilesBody");function Ae(){return(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("section",{children:[(0,e.jsx)("h2",{className:"mb-2 text-sm font-medium",children:"About"}),N?(0,e.jsx)(Le,{variant:"detail"}):x?.markdown?(0,e.jsx)(kt,{softBreaks:!1,linkIssueReferences:!1,children:Oe||I.description||"No overview yet."}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:I.description??"No overview yet."})]}),(0,e.jsxs)("section",{className:"grid min-w-0 gap-3 text-sm sm:grid-cols-2",children:[(0,e.jsxs)("div",{className:"min-w-0 border-b border-border py-2",children:[(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:"Key"}),(0,e.jsx)("div",{className:"mt-1 truncate font-mono",children:I.key})]}),(0,e.jsxs)("div",{className:"min-w-0 border-b border-border py-2",children:[(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:"Source"}),(0,e.jsx)("div",{className:"mt-1 min-w-0 [overflow-wrap:anywhere]",children:ee??re.label})]}),(0,e.jsxs)("div",{className:"min-w-0 border-b border-border py-2",children:[(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:"Version"}),(0,e.jsx)("div",{className:"mt-1",children:Ms(I.currentVersion??null)})]}),(0,e.jsxs)("div",{className:"min-w-0 border-b border-border py-2",children:[(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:"Mode"}),(0,e.jsx)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:I.editable?"Editable":(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{children:"Read only"}),(0,e.jsxs)(k,{type:"button",variant:"outline",size:"xs",onClick:be,children:[(0,e.jsx)(ys,{className:"mr-1 h-3 w-3"}),"Fork"]})]})})]})]})]})}n(Ae,"renderOverviewBody");function Q(){return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{className:"text-sm text-muted-foreground",children:b?"Loading versions...":`${L.length} ${L.length===1?"version":"versions"}`}),(0,e.jsxs)(k,{type:"button",variant:"outline",size:"sm",onClick:n(()=>Rs(),"onClick"),disabled:ye.length<2,children:[(0,e.jsx)(Tn,{className:"mr-1.5 h-3.5 w-3.5"})," Compare"]})]}),(0,e.jsx)("div",{className:"border-y border-border",children:b?(0,e.jsx)(Le,{variant:"list"}):ye.length===0?(0,e.jsx)("div",{className:"py-6 text-sm text-muted-foreground",children:"No saved versions yet."}):ye.map(h=>(0,e.jsxs)("div",{className:"grid gap-2 border-b border-border px-0 py-3 text-sm last:border-b-0 sm:grid-cols-(--gtc-13)",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"font-medium",children:Ms(h)}),(0,e.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:[yr(h.createdAt)," · ",h.fileInventory.length," files"]})]}),(0,e.jsx)(k,{type:"button",variant:"ghost",size:"sm",onClick:n(()=>Rs(h.id),"onClick"),children:"View diff"})]},h.id))}),(0,e.jsx)(Xa,{open:qs,onOpenChange:ns,versions:ye,leftVersionId:w,rightVersionId:Zs,onLeftVersionChange:Fe,onRightVersionChange:as})]})}n(Q,"renderVersionsBody");function st(){const h=I.usedByAgents;return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:[h.length," ",h.length===1?"agent":"agents"," attached",Ve?` · ${Ms(Ve)}`:" · Latest"]}),(0,e.jsx)(jn,{agents:K,attachedAgentIds:h.map(P=>P.id),versions:L,selectedVersionId:bt(I),pending:ge,onSubmit:Z})]}),h.length===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-border py-8 text-center text-sm text-muted-foreground",children:"No agents are using this skill yet. Use “Add to agent” to attach it."}):(0,e.jsx)("div",{className:"border-y border-border",children:h.map(P=>{const ae=ws.get(P.id);return(0,e.jsxs)("div",{className:"flex items-center gap-3 border-b border-border py-3 text-sm last:border-b-0",children:[(0,e.jsx)(nn,{agent:ae,size:16,className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"truncate font-medium",children:P.name}),ae?.paused?(0,e.jsxs)(le,{variant:"outline",className:"[&>svg]:size-2.5 border-amber-500/30 bg-amber-500/10 px-1.5 text-(length:--text-nano) uppercase tracking-wide text-amber-500",children:[(0,e.jsx)(wt,{className:"h-2.5 w-2.5","aria-hidden":"true"}),"Paused"]}):null]}),(0,e.jsx)("div",{className:"mt-0.5 text-xs text-muted-foreground",children:P.adapterType})]}),(0,e.jsx)(Je,{to:`/agents/${P.urlKey}/skills`,className:"shrink-0 text-xs text-muted-foreground no-underline hover:text-foreground",children:"View"})]},P.id)})})]})}n(st,"renderAgentsBody");const tt=r==="files"?se():r==="versions"?Q():r==="agents"?st():Ae();return(0,e.jsxs)("div",{className:"min-h-(--sz-calc-30)",children:[(0,e.jsx)("div",{className:"border-b border-border px-4 py-5",children:(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,e.jsx)(Lt,{card:{key:t.key,name:t.name,slug:t.slug,iconUrl:t.iconUrl,color:t.color},size:44}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e.jsx)("h1",{className:"truncate text-2xl font-semibold",children:t.name}),(0,e.jsxs)(qe,{children:[(0,e.jsx)(Re,{asChild:!0,children:(0,e.jsx)("span",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground","aria-label":`Installed from ${re.label}`,children:(0,e.jsx)(is,{className:"h-4 w-4"})})}),(0,e.jsxs)($e,{children:["Installed from ",re.label]})]})]}),t.authorName?(0,e.jsxs)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:["by ",(0,e.jsx)("span",{className:"text-foreground",children:t.authorName})]}):null,ds?(0,e.jsxs)("div",{className:"mt-1 max-w-2xl",children:[(0,e.jsx)("p",{ref:Ce,className:M("text-sm text-muted-foreground",!ve&&"line-clamp-4"),children:ds}),me?(0,e.jsx)("button",{type:"button",onClick:n(()=>V(h=>!h),"onClick"),className:"mt-0.5 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:ve?"Show less":"View all"}):null]}):null]})]}),(0,e.jsx)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:t.categories.slice(0,4).map(h=>(0,e.jsx)(_n,{label:h},h))})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-1",children:[(0,e.jsx)(k,{variant:"outline",size:"sm",asChild:!0,children:(0,e.jsxs)(Je,{to:Js,children:[(0,e.jsx)(Pn,{className:"mr-1.5 h-3.5 w-3.5"}),"Open in Studio"]})}),(0,e.jsxs)("div",{className:"flex items-center overflow-hidden rounded-md border border-border",children:[(0,e.jsxs)(qe,{children:[(0,e.jsx)(Re,{asChild:!0,children:(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)(Nt,{className:"h-3.5 w-3.5","aria-hidden":"true"}),(0,e.jsx)("span",{className:"font-medium text-foreground",children:t.attachedAgentCount}),(0,e.jsx)("span",{className:"hidden sm:inline",children:t.attachedAgentCount===1?"install":"installs"})]})}),(0,e.jsx)($e,{children:"Agents in this company that currently have this skill installed."})]}),(0,e.jsxs)("button",{type:"button",onClick:Se,disabled:es,className:"inline-flex items-center gap-1.5 border-l border-border px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground disabled:opacity-50",title:t.starredByCurrentActor?"Unstar this skill":"Star this skill",children:[(0,e.jsx)(yn,{className:M("h-3.5 w-3.5",t.starredByCurrentActor&&"fill-current text-yellow-400")}),(0,e.jsx)("span",{className:"hidden sm:inline",children:t.starredByCurrentActor?"Starred":"Star"}),(0,e.jsx)("span",{className:"font-medium text-foreground",children:t.starCount})]}),(0,e.jsxs)("button",{type:"button",onClick:be,className:"inline-flex items-center gap-1.5 border-l border-border px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground",title:"Fork this skill",children:[(0,e.jsx)(ys,{className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{className:"hidden sm:inline",children:"Fork"}),(0,e.jsx)("span",{className:"font-medium text-foreground",children:t.forkCount})]})]})]})]})}),(0,e.jsxs)("div",{className:"grid gap-6 px-4 py-4 xl:grid-cols-(--gtc-29)",children:[(0,e.jsxs)("main",{className:"min-w-0",children:[(0,e.jsx)(wn,{value:r,onValueChange:n(h=>g(h),"onValueChange"),children:(0,e.jsx)(Nn,{variant:"line",className:"mb-5 w-full max-w-full justify-start overflow-x-auto border-b border-border p-0 pb-1.5 [scrollbar-width:none]",children:Wa.map(h=>{const P=h.icon;return(0,e.jsxs)(As,{value:h.value,className:"px-3",children:[(0,e.jsx)(P,{className:"mr-1.5 h-3.5 w-3.5"}),h.label]},h.value)})})}),tt]}),(0,e.jsxs)("aside",{className:"min-w-0 space-y-6 border-t border-border pt-4 xl:border-l xl:border-t-0 xl:pl-5 xl:pt-0",children:[(0,e.jsx)(Za,{folderPath:l??Mn(t.folderPath),onMove:je}),(0,e.jsx)(Ja,{categories:t.categories,pending:ce,onSave:n(h=>ie({categories:h,sharingScope:t.sharingScope==="public_link"?"company":t.sharingScope}),"onSave")}),(0,e.jsxs)("section",{children:[(0,e.jsx)("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Agents"}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(jn,{agents:K,attachedAgentIds:t.usedByAgents.map(h=>h.id),versions:L,selectedVersionId:bt(t),pending:ge,onSubmit:Z,fullWidth:!0}),t.usedByAgents.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No agents attached yet."}):(0,e.jsxs)("div",{className:"space-y-0.5",children:[t.usedByAgents.slice(0,3).map(h=>{const P=ws.get(h.id);return(0,e.jsxs)(Je,{to:`/agents/${h.urlKey}/skills`,className:"flex items-center gap-2 rounded-md px-1.5 py-1 text-sm no-underline hover:bg-accent/40",children:[(0,e.jsx)(nn,{agent:P,size:16,className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate text-foreground",children:h.name}),P?.paused?(0,e.jsx)(wt,{className:"h-3 w-3 shrink-0 text-amber-500","aria-label":"Paused"}):null]},h.id)}),t.usedByAgents.length>3?(0,e.jsxs)("p",{className:"px-1.5 pt-0.5 text-xs text-muted-foreground",children:["and ",t.usedByAgents.length-3," more"]}):null]})]})]}),(0,e.jsxs)("section",{children:[(0,e.jsx)("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Source"}),T?(0,e.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[(0,e.jsx)(Sn,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-foreground",children:Ss}),(0,e.jsxs)("a",{href:_s??void 0,target:"_blank",rel:"noreferrer",title:Ee??void 0,className:"mt-0.5 flex max-w-full items-start gap-1 text-xs text-muted-foreground no-underline transition-colors [overflow-wrap:anywhere] hover:text-foreground",children:[(0,e.jsx)("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:Ee}),(0,e.jsx)(gs,{className:"h-3 w-3 shrink-0","aria-hidden":"true"})]}),(0,e.jsxs)("div",{className:"mt-0.5 truncate font-mono text-(length:--text-micro) text-muted-foreground",title:T.commit,children:[T.ref,T.commit?` · ${T.commit.slice(0,7)}`:""]})]})]}):(0,e.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[(0,e.jsx)(is,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-foreground",children:re.label}),ee?cs?(0,e.jsxs)("a",{href:cs,target:"_blank",rel:"noreferrer",title:ee??void 0,className:"mt-0.5 flex max-w-full items-start gap-1 text-xs text-muted-foreground no-underline transition-colors [overflow-wrap:anywhere] hover:text-foreground",children:[(0,e.jsx)("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:ee}),(0,e.jsx)(gs,{className:"h-3 w-3 shrink-0","aria-hidden":"true"})]}):(0,e.jsx)("div",{className:"mt-0.5 min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]",title:ee??void 0,children:ee}):(0,e.jsx)("div",{className:"mt-0.5 text-xs text-muted-foreground",children:re.managedLabel})]})]})]}),t.sourceType==="github"?(0,e.jsxs)("section",{children:[(0,e.jsx)("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Updates"}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsxs)(qe,{children:[(0,e.jsx)(Re,{asChild:!0,children:(0,e.jsx)(Zr,{className:"h-3.5 w-3.5 shrink-0","aria-label":"Pinned source revision"})}),(0,e.jsx)($e,{children:"Pinned source revision"})]}),(0,e.jsx)("span",{className:"truncate font-mono text-foreground",children:et??"untracked"})]}),(0,e.jsxs)(k,{variant:"outline",size:"sm",className:"w-full",onClick:de,disabled:we||W,children:[(0,e.jsx)(Ws,{className:M("mr-1.5 h-3.5 w-3.5",(we||W)&&"animate-spin")}),"Check for updates"]}),D?.supported&&D.hasUpdate?(0,e.jsxs)(k,{size:"sm",className:"w-full",onClick:Be,disabled:ze,children:[(0,e.jsx)(St,{className:M("mr-1.5 h-3.5 w-3.5",ze&&"animate-spin")}),"Install update",os?` ${os}`:""]}):D?.supported&&!D.hasUpdate&&!W?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Up to date."}):null]})]}):null,(0,e.jsx)("section",{children:(0,e.jsxs)("button",{type:"button",onClick:n(()=>{O(t.sharingScope==="public_link"?"company":t.sharingScope),ue(t.categories.join(", ")),ks(!0)},"onClick"),className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-accent/30 hover:text-foreground",children:[(0,e.jsx)(Sa,{className:"h-4 w-4 shrink-0"}),(0,e.jsx)("span",{className:"flex-1",children:"Settings"})]})})]})]}),Ns?(0,e.jsxs)("div",{className:"fixed bottom-6 left-1/2 z-40 flex -translate-x-1/2 items-center gap-3 rounded-full border border-border bg-background/95 px-4 py-2 shadow-lg backdrop-blur",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"Unsaved changes"}),(0,e.jsx)(k,{variant:"ghost",size:"sm",onClick:n(()=>{$(ls),A(!1)},"onClick"),disabled:j,children:"Discard"}),(0,e.jsxs)(k,{size:"sm",onClick:X,disabled:j,children:[(0,e.jsx)(ht,{className:"mr-1.5 h-3.5 w-3.5"}),j?"Saving…":"Save changes"]})]}):null,(0,e.jsx)(js,{open:rs,onOpenChange:ks,children:(0,e.jsxs)(fs,{className:"sm:max-w-md",children:[(0,e.jsxs)(bs,{children:[(0,e.jsx)(vs,{children:"Skill settings"}),(0,e.jsxs)(Ts,{children:["Manage how ",t.name," is grouped and shared."]})]}),(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("label",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Categories"}),(0,e.jsx)(Me,{value:Ue,onChange:n(h=>ue(h.target.value),"onChange"),placeholder:"engineering, review, memory",className:"h-9",disabled:ce}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Separate categories with commas. Leave empty to clear categories."})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("label",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sharing"}),(0,e.jsxs)("select",{value:J,onChange:n(h=>O(h.target.value),"onChange"),disabled:ce,className:"h-9 w-full rounded-md border border-border bg-background px-2 text-sm text-foreground",children:[(0,e.jsx)("option",{value:"company",children:"Company — visible inside this company"}),(0,e.jsx)("option",{value:"private",children:"Private — only visible in your library"})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Public link sharing is coming later."})]}),(0,e.jsxs)("div",{className:"flex justify-end gap-2 border-t border-border pt-4",children:[(0,e.jsx)(k,{type:"button",variant:"ghost",size:"sm",onClick:n(()=>{O(I.sharingScope==="public_link"?"company":I.sharingScope),ue(I.categories.join(", "))},"onClick"),disabled:!Qe||ce,children:"Reset"}),(0,e.jsxs)(k,{type:"button",size:"sm",onClick:n(()=>ie({sharingScope:J,categories:$s}),"onClick"),disabled:!Qe||ce,children:[(0,e.jsx)(ht,{className:"mr-1.5 h-3.5 w-3.5"}),ce?"Saving…":"Save settings"]})]}),t.editable?(0,e.jsxs)("div",{className:"rounded-md border border-destructive/40 p-3",children:[(0,e.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-destructive",children:"Danger zone"}),(0,e.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-3",children:[(0,e.jsx)("p",{className:"min-w-0 text-xs text-muted-foreground",children:"Remove this skill from the company library."}),(0,e.jsxs)(k,{variant:"destructive",size:"sm",className:"shrink-0",onClick:_e,disabled:ss,title:t.usedByAgents.length>0?"Detach this skill from all agents before removing it.":void 0,children:[(0,e.jsx)(Tr,{className:"mr-1.5 h-3.5 w-3.5"}),ss?"Removing…":"Remove"]})]})]}):null]})]})})]})}n(el,"SkillDetailPage");function Bl(){const{"*":t}=wr(),l=Nr(),a=jr(),[u,m]=kr(),{selectedCompanyId:r}=vr(),{setBreadcrumbs:g}=qr(),{pushToast:o}=oa(),x=Mr(),N=na(),v=n((s,i,d,C)=>{N.capture(s,C)||o({tone:"error",title:i,body:s instanceof Error&&s.message?s.message:d})},"reportSkillError"),[F,y]=(0,c.useState)(""),[p,A]=(0,c.useState)(""),[$,X]=(0,c.useState)(!1),[j,L]=(0,c.useState)(null),[b,K]=(0,c.useState)({}),[Z,ge]=(0,c.useState)("preview"),[q,U]=(0,c.useState)(!1),[fe,D]=(0,c.useState)(""),[W,de]=(0,c.useState)(null),[we,Be]=(0,c.useState)(null),[ze,Se]=(0,c.useState)(null),[es,be]=(0,c.useState)(!1),[ie,ce]=(0,c.useState)(null),[je,_e]=(0,c.useState)(null),[ss,ts]=(0,c.useState)(""),[qs,ns]=(0,c.useState)("all"),[rs,ks]=(0,c.useState)(""),[J,O]=(0,c.useState)("SKILL.md"),[Ue,ue]=(0,c.useState)(null),[Ce,ve]=(0,c.useState)({}),[V,me]=(0,c.useState)({open:!1,catalogSkill:null,conflict:null,defaultSlug:null,defaultForce:!1,defaultAction:"install",error:null}),[ne,ye]=(0,c.useState)(""),[w,Fe]=(0,c.useState)("agents"),[Zs,as]=(0,c.useState)(null),[Rs,ls]=(0,c.useState)(!1),[Ns,I]=(0,c.useState)(!1),[Js,re]=(0,c.useState)(!1),[is,Oe]=(0,c.useState)(null),[et,os]=(0,c.useState)(null),[Ve,ds]=(0,c.useState)(null),[$s,zs]=(0,c.useState)(!1),[Pe,Qe]=(0,c.useState)(null),[ws,T]=(0,c.useState)(!1),[Ss,Ee]=(0,c.useState)([]),[_s,ee]=(0,c.useState)([]),cs=(0,c.useMemo)(()=>wa(t),[t]),se=t==="studio/new",Ae=se?null:cs.skillToken,Q=cs.filePath,st=u.get("view")==="catalog"?"catalog":"installed",tt=u.get("source")??"all";["all","company","bundled","optional","external"].includes(tt);const h=u.get("catalog"),P=u.get("tab"),ae=Aa(P),Un=["overview","files","versions","agents"].includes(P)?P:cs.hasExplicitFilePath||Q!=="SKILL.md"?"files":"overview",He=u.get("category"),oe=se&&u.get("forkFrom")?.trim()||null,nt=se&&u.get("folderId")?.trim()||null,rt=!se&&!Ae&&!h,G=ma(u.get("folder"));function Pt(s){m(i=>Ta(i,s))}n(Pt,"setDiscoveryTab");function us(s){m(i=>{const d=new URLSearchParams(i);d.set("tab","installed"),d.delete("category");const C=va(s);return C?d.set("folder",C):d.delete("folder"),d})}n(us,"setFolderSelection");function ms(s=[],i=null){ee(s),Oe(null),os(i),re(!0)}n(ms,"openCreateFolder");function Et(s){m(i=>{const d=new URLSearchParams(i);return s==="overview"?d.delete("tab"):d.set("tab",s),d})}n(Et,"setDetailTab");function On(s){m(i=>{const d=new URLSearchParams(i);return s?d.set("category",s):d.delete("category"),d})}n(On,"setDiscoveryCategory");function Vn(s,i="SKILL.md"){m(d=>{const C=new URLSearchParams(d);return s?C.set("catalog",s):C.delete("catalog"),C}),O(i)}n(Vn,"selectCatalog"),(0,c.useEffect)(()=>{se&&as(null)},[se,oe]),(0,c.useEffect)(()=>{u.has("view")&&m(s=>{const i=new URLSearchParams(s);return i.delete("view"),i},{replace:!0})},[u,m]);const Ge=xe({queryKey:f.companySkills.list(r??""),queryFn:n(()=>_.list(r),"queryFn"),enabled:!!r}),ke=xe({queryKey:f.folders.list(r??"","skill"),queryFn:n(()=>he.list(r,"skill"),"queryFn"),enabled:!!(r&&(rt&&ae==="installed"||Ae))}),te=Ge.data??[],Cs=(0,c.useMemo)(()=>la(Ae,te),[Ae,te]),S=Cs.skill?.id??null,xs=xe({queryKey:f.companySkills.detail(r??"",S??""),queryFn:n(()=>_.detail(r,S),"queryFn"),enabled:!!(r&&S)}),Te=xe({queryKey:f.companySkills.file(r??"",S??"",Q),queryFn:n(()=>_.file(r,S,Q),"queryFn"),enabled:!!(r&&S&&Q)}),At=xe({queryKey:f.companySkills.versions(r??"",S??""),queryFn:n(()=>_.versions(r,S),"queryFn"),enabled:!!(r&&S)}),We=xe({queryKey:f.companySkills.detail(r??"",oe??""),queryFn:n(()=>_.detail(r,oe),"queryFn"),enabled:!!(r&&se&&oe)}),Qn=(0,c.useMemo)(()=>{if(!se)return gt();const s=oe?We.data?_r(We.data):gt():gt();return nt?{...s,folderId:nt}:s},[se,We.data,oe,nt]),Hn=(0,c.useMemo)(()=>{if(G==="all"||G==="unfiled")return null;const s=Xe(ke.data).byId.get(G);return!s||s.path==="bundled"||s.path.startsWith("bundled/")||s.path==="projects"||s.path.startsWith("projects/")?null:s.id},[G,ke.data]),Us=xe({queryKey:f.companySkills.updateStatus(r??"",S??""),queryFn:n(()=>_.updateStatus(r,S),"queryFn"),enabled:!!(r&&S&&(xs.data?.sourceType==="github"||W?.sourceType==="github")),staleTime:6e4});(0,c.useEffect)(()=>{if(!Cs.skill||!Cs.shouldRedirect||Ge.isLoading)return;const s=u.toString();l({pathname:Ks(Cs.skill,te,Q),search:s?`?${s}`:""},{replace:!0})},[te,l,Cs,u,Q,Ge.isLoading]),(0,c.useEffect)(()=>{L(S)},[S]),(0,c.useEffect)(()=>{if(!S||Q==="SKILL.md")return;const s=un(Q);s.length!==0&&K(i=>{const d=new Set(i[S]??[]);let C=!1;for(const E of s)d.has(E)||(d.add(E),C=!0);return C?{...i,[S]:d}:i})},[Q,S]),(0,c.useEffect)(()=>{U(!1)},[S,Q]),(0,c.useEffect)(()=>{xs.data&&de(xs.data)},[xs.data]),(0,c.useEffect)(()=>{Te.data&&(Be(Te.data),D(Te.data.markdown?Ct(Te.data.content).body:Te.data.content))},[Te.data]),(0,c.useEffect)(()=>{S||(de(null),Be(null))},[S]);const B=xs.data??W;(0,c.useEffect)(()=>{g([{label:"Skills",href:"/skills"},...se?[{label:oe?"Fork skill":"New skill"}]:B?Ka(B,ke.data).slice(1):Ae?[{label:"Detail"}]:[]])},[B,se,Ae,g,ke.data,oe]);const Os=Te.data??we;function hs(s,i){return Ks(s,ua(te,s),i)}n(hs,"routeForSkill");function at(s,i){const d=te.find(C=>C.id===s)??(B?.id===s?B:null);return d?hs(d,i):Ks(s,i)}n(at,"routeForSkillId");function Gn(){ce(S),_e(B??null),be(!0)}n(Gn,"openDeleteDialog");function Vs(s){be(s),s||(ce(null),_e(null))}n(Vs,"closeDeleteDialog");const lt=Y({mutationFn:n(s=>_.importFromSource(r,s),"mutationFn"),onSuccess:n(async s=>{await a.invalidateQueries({queryKey:f.companySkills.list(r)}),s.imported[0]&&l(hs(s.imported[0])),o({tone:"success",title:"Skills imported",body:`${s.imported.length} skill${s.imported.length===1?"":"s"} added.`}),s.warnings[0]&&o({tone:"warn",title:"Import warnings",body:s.warnings[0]}),A("")},"onSuccess"),onError:n(s=>{v(s,"Skill import failed","Failed to import skill source.","Importing skills")},"onError")}),Tt=Y({mutationFn:n(s=>_.scanProjects(r,s?{projectIds:[s]}:{}),"mutationFn"),onMutate:n(s=>{Se(s?"Refreshing project skills...":"Scanning project workspaces for skills...")},"onMutate"),onSuccess:n(async s=>{Se("Refreshing skills list..."),await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.folders.list(r,"skill")})]);const i=Fa(s);Se(i),o({tone:"success",title:"Project skill scan complete",body:i}),s.conflicts[0]?o({tone:"warn",title:"Skill conflicts found",body:s.conflicts[0].reason}):s.warnings[0]&&o({tone:"warn",title:"Scan warnings",body:s.warnings[0]})},"onSuccess"),onError:n(s=>{Se(null),v(s,"Project skill scan failed","Failed to scan project workspaces.","Scanning projects for skills")},"onError")}),Kt=Y({mutationFn:n(s=>_.create(r,s),"mutationFn"),onSuccess:n(async s=>{await a.invalidateQueries({queryKey:f.companySkills.list(r)}),l(hs(s)),as(null),o({tone:"success",title:s.forkedFromSkillId?"Skill fork created":"Skill created",body:`${s.name} is now editable in the Paperclip workspace.`})},"onSuccess"),onError:n(s=>{const i=s instanceof Error?s.message:"Failed to create skill.";as(i),v(s,"Skill creation failed","Failed to create skill.","Creating a skill")},"onError")}),Mt=Y({mutationFn:n(()=>_.updateFile(r,S,Q,Os?.markdown?Ca(Os.content,fe):fe),"mutationFn"),onSuccess:n(async s=>{await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.companySkills.detail(r,S)}),a.invalidateQueries({queryKey:f.companySkills.file(r,S,Q)})]),D(s.markdown?Ct(s.content).body:s.content),U(!1),o({tone:"success",title:"Skill saved",body:s.path})},"onSuccess"),onError:n(s=>{o({tone:"error",title:"Save failed",body:s instanceof Error?s.message:"Failed to save skill file."})},"onError")}),qt=Y({mutationFn:n(()=>{if(!B)throw new Error("Select a skill first.");return B.starredByCurrentActor?_.unstar(r,B.id):_.star(r,B.id)},"mutationFn"),onSuccess:n(async()=>{B&&await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.companySkills.detail(r,B.id)})])},"onSuccess"),onError:n(s=>{o({tone:"error",title:"Star failed",body:s instanceof Error?s.message:"Failed to update star."})},"onError")}),Rt=Y({mutationFn:n(s=>_.update(r,s.skillId,s.updates),"mutationFn"),onSuccess:n(async s=>{a.setQueryData(f.companySkills.detail(r,s.id),i=>i&&{...i,...s}),a.setQueryData(f.companySkills.list(r),i=>i?.map(d=>d.id===s.id?{...d,...s}:d)),await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.companySkills.detail(r,s.id)})]),o({tone:"success",title:"Skill settings updated",body:qa(s)})},"onSuccess"),onError:n(s=>{o({tone:"error",title:"Skill settings update failed",body:s instanceof Error?s.message:"Failed to update skill settings."})},"onError")}),$t=Y({mutationFn:n(()=>_.installUpdate(r,S),"mutationFn"),onSuccess:n(async s=>{await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.companySkills.detail(r,S)}),a.invalidateQueries({queryKey:f.companySkills.updateStatus(r,S)}),a.invalidateQueries({queryKey:f.companySkills.file(r,S,Q)})]),l(hs(s,Q)),o({tone:"success",title:"Skill updated",body:s.sourceRef?`Pinned to ${Xs(s.sourceRef)}`:s.name})},"onSuccess"),onError:n(s=>{v(s,"Update failed","Failed to install skill update.","Updating this skill")},"onError")}),Ie=xe({queryKey:f.companySkills.catalog(),queryFn:n(()=>_.catalogList(),"queryFn"),enabled:!!r,staleTime:6e4}),zt=xe({queryKey:f.companySkills.catalogDetail(h??""),queryFn:n(()=>_.catalogDetail(h),"queryFn"),enabled:!!(r&&h),staleTime:6e4}),Wn=xe({queryKey:f.companySkills.catalogFile(h??"",J),queryFn:n(()=>_.catalogFile(h,J),"queryFn"),enabled:!!(r&&h&&J),staleTime:6e4}),_t=xe({queryKey:f.agents.list(r??""),queryFn:n(()=>Hs.list(r),"queryFn"),enabled:!!r}),Fs=(0,c.useMemo)(()=>new Map(te.map(s=>[s.key,s])),[te]);(0,c.useMemo)(()=>{const s=new Set;for(const i of Ie.data??[])s.add(i.category);return Array.from(s).sort()},[Ie.data]);const Ke=(0,c.useMemo)(()=>Ra(te,Ie.data??[]),[te,Ie.data]),Yn=(0,c.useMemo)(()=>({all:Ke.length,installed:Ke.filter(s=>s.installed).length,catalog:Ke.filter(s=>s.catalogRef!=null).length,bundled:Ke.filter(s=>s.required).length}),[Ke]),Ye=(0,c.useMemo)(()=>$a(Ke,ae),[Ke,ae]),Xn=(0,c.useMemo)(()=>{const s=new Map;for(const i of Ye)for(const d of i.categories)s.set(d,(s.get(d)??0)+1);return Array.from(s.entries()).map(([i,d])=>({slug:i,count:d})).sort((i,d)=>d.count-i.count||i.slug.localeCompare(d.slug))},[Ye]),Ut=ne.trim().length>0,it=(0,c.useMemo)(()=>{if(G==="all"||G==="unfiled")return null;const s=Xe(ke.data);return s.byId.has(G)?an(s,G):null},[G,ke.data]),Zn=(0,c.useMemo)(()=>za(Ye.filter(s=>He&&!s.categories.includes(He)||ae==="installed"&&!Ut&&(G==="unfiled"&&s.folderId||it&&(!s.folderId||!it.has(s.folderId)))?!1:fn(s,ne.trim())),w,ae!=="bundled"),[Ye,He,ne,Ut,w,ae,G,it]),R=zt.data??(Ie.data??[]).find(s=>s.id===h||s.key===h)??null;(0,c.useEffect)(()=>{ue(R?.id??null)},[R?.id]),(0,c.useEffect)(()=>{if(!R||J==="SKILL.md")return;const s=un(J);s.length!==0&&ve(i=>{const d=new Set(i[R.id]??[]);let C=!1;for(const E of s)d.has(E)||(d.add(E),C=!0);return C?{...i,[R.id]:d}:i})},[J,R]),(0,c.useMemo)(()=>{const s={all:te.length,company:0,bundled:0,optional:0,external:0};for(const i of te){const d=La(i);s[d]+=1}return s},[te]);const ot=Y({mutationFn:n(s=>_.installCatalog(r,{catalogSkillId:s.catalogSkillId,slug:s.slug,force:s.force}),"mutationFn"),onSuccess:n(async(s,i)=>{const d=s.action==="created"?i.agentIds:[];let C=0,E=0;for(const De of d)try{await Hs.syncSkills(De,[{key:s.skill.key,versionId:null}],"add",r??void 0),C+=1}catch{E+=1}await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.companySkills.detail(r,s.skill.id)})]),me(De=>({...De,open:!1,error:null})),o({tone:"success",title:s.action==="created"?"Skill installed":s.action==="updated"?"Skill updated":"Skill is up to date",body:s.action==="created"?C>0?`${s.skill.name} — enabled for ${C} agent${C===1?"":"s"}.`:`${s.skill.name} is in the library but not enabled for any agent yet. Use "Add to agent" to enable it.`:s.skill.name}),E>0&&o({tone:"warn",title:"Skill installed, but enabling failed",body:`Could not enable ${s.skill.name} for ${E} agent${E===1?"":"s"}. Use "Add to agent" on the skill page.`}),s.warnings[0]&&o({tone:"warn",title:"Install warnings",body:s.warnings[0]}),s.action==="created"&&l(hs(s.skill))},"onSuccess"),onError:n(s=>{const i=s instanceof Error?s.message:"Failed to install catalog skill.";me(d=>({...d,error:i})),N.capture(s,"Installing this skill")},"onError")}),Ot=Y({mutationFn:n(s=>he.create(r,{kind:"skill",parentId:et,...s}),"mutationFn"),onSuccess:n(async s=>{if(re(!1),Oe(null),os(null),await a.invalidateQueries({queryKey:f.folders.list(r,"skill")}),_s.length>0){const i=_s;ee([]);try{await Promise.all(i.map(d=>he.moveItem(r,{kind:"skill",itemId:d,folderId:s.id}))),await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.folders.list(r,"skill")})])}catch(d){o({tone:"error",title:"Folder created, move failed",body:d instanceof Error?d.message:"Failed to move the selected skills."});return}}else us(s.id);o({tone:"success",title:"Folder created",body:s.name})},"onSuccess"),onError:n(s=>{o({tone:"error",title:"Folder save failed",body:s instanceof Error?s.message:"Failed to save folder."})},"onError")}),dt=Y({mutationFn:n(({folderId:s,payload:i})=>he.update(r,s,i),"mutationFn"),onSuccess:n(async()=>{re(!1),Oe(null),await a.invalidateQueries({queryKey:f.folders.list(r,"skill")})},"onSuccess"),onError:n(s=>{o({tone:"error",title:"Folder save failed",body:s instanceof Error?s.message:"Failed to update folder."})},"onError")}),Vt=Y({mutationFn:n(({folderId:s,parentId:i})=>he.moveFolder(r,s,{parentId:i,position:0}),"mutationFn"),onSuccess:n(async s=>{await a.invalidateQueries({queryKey:f.folders.list(r,"skill")}),us(s.id),o({tone:"success",title:"Folder moved",body:Mn(s.path)??s.name})},"onSuccess"),onError:n(s=>{o({tone:"error",title:"Folder move failed",body:s instanceof Error?s.message:"Failed to move folder."})},"onError")}),Qt=Y({mutationFn:n(s=>he.delete(r,s),"mutationFn"),onSuccess:n(async(s,i)=>{G===i&&us("all"),ds(null),await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.folders.list(r,"skill")})]),o({tone:"success",title:"Folder deleted",body:"Skills moved to Unfiled."})},"onSuccess"),onError:n(s=>{o({tone:"error",title:"Folder delete failed",body:s instanceof Error?s.message:"Failed to delete folder."})},"onError")}),Ht=Y({mutationFn:n(({itemId:s,folderId:i})=>he.moveItem(r,{kind:"skill",itemId:s,folderId:i}),"mutationFn"),onSuccess:n(async()=>{await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.folders.list(r,"skill")})])},"onSuccess"),onError:n(s=>{o({tone:"error",title:"Move failed",body:s instanceof Error?s.message:"Failed to move skill."})},"onError")});async function Jn(s){const i=Ss;if(i.length!==0)try{await Promise.all(i.map(d=>he.moveItem(r,{kind:"skill",itemId:d,folderId:s}))),Ee([]),T(!1),await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.folders.list(r,"skill")})]),o({tone:"success",title:"Skills moved",body:`${i.length} skill${i.length===1?"":"s"} filed.`})}catch(d){o({tone:"error",title:"Failed to move skills",body:d instanceof Error?d.message:"Failed to move the selected skills."})}}n(Jn,"moveSelectedSkills");const Qs=Y({mutationFn:n(()=>he.ensureMy(r),"mutationFn"),onSuccess:n(async s=>{await a.invalidateQueries({queryKey:f.folders.list(r,"skill")}),us(s.id)},"onSuccess"),onError:n(s=>{o({tone:"error",title:"Couldn't open My Skills",body:s instanceof Error?s.message:"Failed to create your personal folder."})},"onError")});async function er(){const s=Xe(ke.data);if((G==="all"||G==="unfiled"?null:s.byId.get(G)??null)?.systemKey==="my"){try{const i=await Qs.mutateAsync();l(ft(null,i.id))}catch{return}return}l(ft(null,Hn))}n(er,"openNewSkill");async function sr(s){if((s?Xe(ke.data).byId.get(s):null)?.systemKey==="my"){try{ms([],(await Qs.mutateAsync()).id)}catch{return}return}ms([],s)}n(sr,"openCreateFolderIn");async function tr(s,i){if(i==="company"){Vt.mutate({folderId:s.id,parentId:null});return}try{const d=await Qs.mutateAsync();Vt.mutate({folderId:s.id,parentId:d.id})}catch{return}}n(tr,"moveFolderBetweenScopes");async function nr(s,i){try{const d=await he.create(r,{kind:"skill",parentId:s,name:i,color:null});return await a.invalidateQueries({queryKey:f.folders.list(r,"skill")}),d.id}catch(d){return o({tone:"error",title:"Folder create failed",body:d instanceof Error?d.message:"Failed to create folder."}),null}}n(nr,"createFolderInline");async function rr(s){if(!Pe)return;const i=Pe.skillIds;try{await Promise.all(i.map(d=>he.moveItem(r,{kind:"skill",itemId:d,folderId:s}))),await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.folders.list(r,"skill")}),...i.map(d=>a.invalidateQueries({queryKey:f.companySkills.detail(r,d)}))]),Qe(null),Ee([]),T(!1),o({tone:"success",title:i.length===1?"Skill moved":"Skills moved",body:s?`Filed under ${Ne?.folders.find(d=>d.id===s)?.name??"folder"}.`:"Moved to Unfiled."})}catch(d){o({tone:"error",title:"Move failed",body:d instanceof Error?d.message:"Failed to move."})}}n(rr,"performDialogMove");const Gt=(0,c.useMemo)(()=>(_t.data??[]).map(s=>{const i=x(s.adapterType),d=[],C=new Set((B?.usedByAgents??[]).map(E=>E.id));return{id:s.id,name:s.name,adapterType:s.adapterType,supportsSkills:!!i.supportsSkills,required:!1,icon:s.icon,paused:s.status==="paused"||s.pausedAt!=null,attached:C.has(s.id),requiredKeys:d}}),[_t.data,x,B]),Wt=Y({mutationFn:n(async s=>Hs.syncSkills(s.agentId,s.desiredSkills,"replace",r??void 0),"mutationFn"),onSuccess:n(async()=>{await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),a.invalidateQueries({queryKey:f.companySkills.detail(r,S??"")}),a.invalidateQueries({queryKey:f.companySkills.versions(r,S??"")})])},"onSuccess")});async function ar(s,i=null){if(!B)return;const d=B.key,C=new Set(s),E=(B.usedByAgents??[]).map(H=>H.id),De=new Set(E),ut=new Map((B.usedByAgents??[]).map(H=>[H.id,H.versionId??null])),xr=s.filter(H=>!De.has(H)),hr=E.filter(H=>!C.has(H)),pr=s.filter(H=>De.has(H)&&(ut.get(H)??null)!==i),en=new Set([...xr,...hr,...pr]);if(en.size!==0)try{for(const H of en){const sn=await Hs.skills(H,r??void 0),tn=(sn.desiredSkillEntries??sn.desiredSkills.map(mt=>({key:mt,versionId:null}))).filter(mt=>mt.key!==d);C.has(H)&&tn.push({key:d,versionId:i}),await Wt.mutateAsync({agentId:H,desiredSkills:tn})}o({tone:"success",title:"Agents updated",body:`${s.length} agent(s) attached.`})}catch(H){o({tone:"error",title:"Update failed",body:H instanceof Error?H.message:"Failed to update agent skills."})}}n(ar,"handleAttachSubmit");function Yt(s){const i=Fs.get(s.key)??null,d=i?.originHash??null,C=i?d&&d!==s.contentHash?"update":i.sourceType!=="catalog"?"replace":"update":"install";me({open:!0,catalogSkill:s,conflict:i,defaultSlug:i?.slug??s.slug,defaultForce:C==="replace",defaultAction:C,error:null})}n(Yt,"openInstallDialog");const Is=Y({mutationFn:n(()=>_.delete(r,ie),"mutationFn"),onSuccess:n(async s=>{Vs(!1),de(null),Be(null),await Promise.all([a.invalidateQueries({queryKey:f.companySkills.list(r)}),...ie?[a.invalidateQueries({queryKey:f.companySkills.detail(r,ie)}),a.invalidateQueries({queryKey:f.companySkills.updateStatus(r,ie)})]:[],...ie?[a.invalidateQueries({queryKey:f.companySkills.file(r,ie,Q)})]:[]]),await a.refetchQueries({queryKey:f.companySkills.list(r),type:"active"}),l("/skills",{replace:!0}),o({tone:"success",title:"Skill removed",body:`${s.name} was removed from the company skill library.`})},"onSuccess"),onError:n(s=>{v(s,"Remove failed","Failed to remove skill.","Removing this skill")},"onError")}),Ne=ke.data??null,z=rt&&ae==="installed",ct=(0,c.useMemo)(()=>{if(!Ne||ae!=="installed")return Ne;const s=Ye.filter(E=>He&&!E.categories.includes(He)?!1:fn(E,ne.trim())),i=new Map;let d=0;for(const E of s)E.folderId?i.set(E.folderId,(i.get(E.folderId)??0)+1):d+=1;const C=Xe(Ne);return{...Ne,allCount:s.length,unfiledCount:d,folders:Ne.folders.map(E=>{let De=0;for(const ut of an(C,E.id))De+=i.get(ut)??0;return{...E,itemCount:De}})}},[Ne,ae,Ye,He,ne]),lr=(0,c.useMemo)(()=>pa(Xe(Ne),B?.folderId),[Ne,B?.folderId]);if(!r)return(0,e.jsx)(Ze,{icon:pe,message:"Select a company to manage skills."});function ir(){const s=p.trim();if(s.length===0){X(!0);return}lt.mutate(s)}n(ir,"handleAddSkillSource");function or(s){if(s.skillId){l(at(s.skillId));return}s.catalogRef&&Vn(s.catalogRef)}n(or,"openDiscoveryCard");const Xt=new URLSearchParams(u);Xt.delete("catalog");const Zt=Xt.toString(),dr=Zt?`/skills?${Zt}`:"/skills",cr=B?(Ie.data??[]).find(s=>s.key===B.key)?.source??null:null,Jt=We.data?hs(We.data):"/skills",ur=oe?"Fork skill":"Create a new skill",mr=oe?"Review the fork metadata and create an editable company copy.":"Create an editable company skill in the Paperclip workspace.";return(0,e.jsxs)(e.Fragment,{children:[N.denial?(0,e.jsx)("div",{className:"px-4 pt-4",children:(0,e.jsx)(da,{denial:N.denial,onDismiss:N.reset})}):null,(0,e.jsx)(js,{open:es,onOpenChange:Vs,children:(0,e.jsxs)(fs,{className:"sm:max-w-md",children:[(0,e.jsxs)(bs,{children:[(0,e.jsx)(vs,{children:"Remove skill"}),(0,e.jsx)(Ts,{children:"Remove this skill from the company library. If any agents still use it, removal will be blocked until it is detached."})]}),(0,e.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,e.jsx)("p",{children:je?`You are about to remove ${je.name}.`:"You are about to remove this skill."}),je?.usedByAgents?.length?(0,e.jsxs)("div",{className:"rounded-md border border-border px-3 py-3 text-muted-foreground",children:["Currently used by ",je.usedByAgents.map(s=>s.name).join(", "),"."]}):null,(je?.usedByAgents.length??0)>0?(0,e.jsx)("p",{className:"text-muted-foreground",children:"Detach this skill from all agents to enable removal."}):null]}),(0,e.jsx)(vt,{children:(je?.usedByAgents.length??0)>0?(0,e.jsx)(k,{variant:"ghost",onClick:n(()=>Vs(!1),"onClick"),children:"Close"}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(k,{variant:"ghost",onClick:n(()=>Vs(!1),"onClick"),disabled:Is.isPending,children:"Cancel"}),(0,e.jsx)(k,{variant:"destructive",onClick:n(()=>Is.mutate(),"onClick"),disabled:Is.isPending||!ie,children:Is.isPending?"Removing...":"Remove skill"})]})})]})}),(0,e.jsx)(js,{open:$,onOpenChange:X,children:(0,e.jsxs)(fs,{className:"sm:max-w-md",children:[(0,e.jsxs)(bs,{children:[(0,e.jsx)(vs,{children:"Add a skill source"}),(0,e.jsx)(Ts,{children:"Paste a local path, GitHub URL, or `skills.sh` command into the field first."})]}),(0,e.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,e.jsxs)("a",{href:"https://skills.sh",target:"_blank",rel:"noreferrer",className:"flex items-start justify-between rounded-md border border-border px-3 py-3 text-foreground no-underline transition-colors hover:bg-accent/40",children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("span",{className:"block font-medium",children:"Browse skills.sh"}),(0,e.jsx)("span",{className:"mt-1 block text-muted-foreground",children:"Find install commands and paste one here."})]}),(0,e.jsx)(gs,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),(0,e.jsxs)("a",{href:"https://github.com/search?q=SKILL.md&type=code",target:"_blank",rel:"noreferrer",className:"flex items-start justify-between rounded-md border border-border px-3 py-3 text-foreground no-underline transition-colors hover:bg-accent/40",children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("span",{className:"block font-medium",children:"Search GitHub"}),(0,e.jsx)("span",{className:"mt-1 block text-muted-foreground",children:"Look for repositories with `SKILL.md`, then paste the repo URL here."})]}),(0,e.jsx)(gs,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]})]}),(0,e.jsx)(vt,{showCloseButton:!0})]})}),(0,e.jsx)(Ga,{open:V.open,onOpenChange:n(s=>me(i=>({...i,open:s,error:s?i.error:null})),"onOpenChange"),skill:V.catalogSkill,packageName:V.catalogSkill?.packageName??V.conflict?.packageName??null,packageVersion:V.catalogSkill?.packageVersion??V.conflict?.packageVersion??null,conflict:V.conflict,defaultSlug:V.defaultSlug,defaultForce:V.defaultForce,defaultAction:V.defaultAction,agents:Gt,isPending:ot.isPending,error:V.error,onConfirm:n(({slug:s,force:i,agentIds:d})=>{V.catalogSkill&&ot.mutate({catalogSkillId:V.catalogSkill.id,slug:s,force:i,agentIds:d})},"onConfirm")}),(0,e.jsx)(js,{open:Rs,onOpenChange:ls,children:(0,e.jsxs)(fs,{className:"sm:max-w-md",children:[(0,e.jsxs)(bs,{children:[(0,e.jsx)(vs,{children:"Import a skill"}),(0,e.jsx)(Ts,{children:"Paste a local path, GitHub URL, or `skills.sh` command to import a skill into this company."})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 border-b border-border pb-2",children:[(0,e.jsx)(Me,{value:p,onChange:n(s=>A(s.target.value),"onChange"),placeholder:"Paste path, GitHub URL, or skills.sh command",className:"h-9 rounded-none border-0 px-0 shadow-none focus-visible:ring-0"}),(0,e.jsx)(k,{size:"sm",onClick:ir,disabled:lt.isPending,children:lt.isPending?(0,e.jsx)(Ws,{className:"h-4 w-4 animate-spin"}):"Import"})]}),(0,e.jsxs)("a",{href:"https://skills.sh",target:"_blank",rel:"noreferrer",className:"flex items-start justify-between rounded-md border border-border px-3 py-3 text-sm text-foreground no-underline transition-colors hover:bg-accent/40",children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("span",{className:"block font-medium",children:"Browse skills.sh"}),(0,e.jsx)("span",{className:"mt-1 block text-muted-foreground",children:"Find install commands and paste one here."})]}),(0,e.jsx)(gs,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),(0,e.jsxs)("a",{href:"https://github.com/search?q=SKILL.md&type=code",target:"_blank",rel:"noreferrer",className:"flex items-start justify-between rounded-md border border-border px-3 py-3 text-sm text-foreground no-underline transition-colors hover:bg-accent/40",children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("span",{className:"block font-medium",children:"Search GitHub"}),(0,e.jsx)("span",{className:"mt-1 block text-muted-foreground",children:"Look for repositories with `SKILL.md`, then paste the repo URL."})]}),(0,e.jsx)(gs,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]})]})]})}),r?(0,e.jsx)(ha,{open:Ns,onOpenChange:I,companyId:r,onImportFromPath:n(()=>{I(!1),ls(!0)},"onImportFromPath")}):null,(0,e.jsx)(Xr,{open:Js,kind:"skill",folder:is,pending:Ot.isPending||dt.isPending,onOpenChange:n(s=>{re(s),s||os(null)},"onOpenChange"),onSubmit:n(s=>{is?dt.mutate({folderId:is.id,payload:s}):Ot.mutate(s)},"onSubmit")}),(0,e.jsx)(ea,{open:Ve!==null,folder:Ve,itemLabelPlural:"skills",pending:Qt.isPending,onOpenChange:n(s=>{s||ds(null)},"onOpenChange"),onConfirm:n(()=>{Ve&&Qt.mutate(Ve.id)},"onConfirm")}),(0,e.jsx)(Na,{open:$s,onOpenChange:zs,result:ct,selection:G,allLabel:"All skills",itemLabelPlural:"Skills",onSelect:us,onCreate:n(()=>ms(),"onCreate")}),(0,e.jsx)(ya,{open:Pe!==null,onOpenChange:n(s=>{s||Qe(null)},"onOpenChange"),result:ct,title:Pe?.title??"Move to folder",subtitle:Pe?.subtitle??null,currentFolderId:Pe?.currentFolderId??null,onMove:n(s=>{rr(s)},"onMove"),onCreateFolder:nr}),se?(0,e.jsxs)("div",{className:"min-h-(--sz-calc-30)",children:[(0,e.jsxs)("div",{className:"border-b border-border px-4 py-5",children:[(0,e.jsxs)(Je,{to:Jt,className:"mb-3 inline-flex items-center gap-1.5 text-sm text-muted-foreground no-underline transition-colors hover:text-foreground",children:[(0,e.jsx)(rn,{className:"h-4 w-4"}),"Back"]}),(0,e.jsx)("h1",{className:"text-2xl font-semibold",children:ur}),(0,e.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-muted-foreground",children:mr})]}),(0,e.jsx)("div",{className:"px-4 py-4",children:(0,e.jsx)("div",{className:"max-w-3xl",children:oe&&We.isLoading?(0,e.jsx)(Le,{variant:"detail"}):oe&&!We.data?(0,e.jsx)(Ze,{icon:pe,message:"Fork source skill not found."}):(0,e.jsx)(Va,{initialDraft:Qn,onCreate:n(s=>Kt.mutate(s),"onCreate"),isPending:Kt.isPending,error:Zs,onCancel:n(()=>l(Jt),"onCancel")})})})]}):rt?(0,e.jsx)(Oa,{tab:ae,tabCounts:Yn,onTabChange:Pt,categories:Xn,categoryTotal:Ye.length,activeCategory:He,onCategoryChange:On,search:ne,onSearchChange:ye,sort:w,onSortChange:Fe,cards:Zn,onOpenCard:or,loading:Ge.isLoading||Ie.isLoading,error:Ge.error?.message??Ie.error?.message??null,totalCount:Ke.length,onCreate:n(()=>{er()},"onCreate"),onImport:n(()=>ls(!0),"onImport"),onImportFromProject:n(()=>I(!0),"onImportFromProject"),onBrowseCatalog:n(()=>Pt("catalog"),"onBrowseCatalog"),onScan:n(s=>Tt.mutate(s),"onScan"),scanPending:Tt.isPending,scanStatus:ze,folderResult:z?ct:null,folderSelection:G,foldersLoading:ke.isLoading,selectMode:z&&ws,selectedSkillIds:Ss,onFolderSelect:z?us:void 0,onOpenMobileFolders:z?()=>zs(!0):void 0,onCreateFolder:z?()=>ms():void 0,onCreateFolderIn:z?s=>{sr(s)}:void 0,onEnsureMyFolder:z?()=>Qs.mutate():void 0,onOpenMoveCard:z?s=>{s.skillId&&Qe({skillIds:[s.skillId],title:`Move "${s.name}"`,subtitle:"Choose a destination folder.",currentFolderId:s.folderId??null})}:void 0,onRenameFolder:z?(s,i)=>dt.mutate({folderId:s.id,payload:{name:i}}):void 0,onEditFolder:z?s=>{Oe(s),re(!0)}:void 0,onMoveFolder:z?(s,i)=>{tr(s,i)}:void 0,onDeleteFolder:z?ds:void 0,onToggleSelectMode:z?()=>{T(s=>!s),ws&&Ee([])}:void 0,onSelectCard:z?(s,i)=>{s.skillId&&Ee(d=>i?Array.from(new Set([...d,s.skillId])):d.filter(C=>C!==s.skillId))}:void 0,onMoveCard:z?(s,i)=>{if(!s.skillId)return;const d=s.skillId,C=s.folderId??null;Ht.mutate({itemId:d,folderId:i}),o({tone:"success",title:"Skill moved",body:i?`Moved "${s.name}" to ${Ne?.folders.find(E=>E.id===i)?.name??"folder"}.`:`Moved "${s.name}" to Unfiled.`,action:{label:"Undo",onClick:n(()=>Ht.mutate({itemId:d,folderId:C}),"onClick")}})}:void 0,onCreateFolderAndMoveCard:z?s=>{s.skillId&&ms([s.skillId])}:void 0,onMoveSelected:z?s=>{Jn(s)}:void 0,onCreateFolderAndMoveSelected:z?()=>ms(Ss):void 0,onClearSelected:z?()=>Ee([]):void 0,folderNudgeStorageKey:z?`paperclip:skills-folder-nudge:${r??"none"}`:void 0}):st==="installed"&&S?(0,e.jsx)(el,{detail:B,folderDisplayPath:lr,catalogSource:cr,routeSkills:te,loading:Ge.isLoading||xs.isLoading,activeTab:Un,onTabChange:Et,selectedPath:Q,file:Os,fileLoading:Te.isLoading&&!Os,viewMode:Z,editMode:q,draft:fe,setViewMode:ge,setEditMode:U,setDraft:D,onSave:n(()=>Mt.mutate(),"onSave"),savePending:Mt.isPending,versions:At.data??[],versionsLoading:At.isLoading,attachAgents:Gt,onSubmitAttach:ar,attachPending:Wt.isPending,expandedDirs:b[S]??new Set,onToggleDir:n(s=>{K(i=>{const d=new Set(i[S]??[]);return d.has(s)?d.delete(s):d.add(s),{...i,[S]:d}})},"onToggleDir"),onSelectPath:n(s=>{Et("files"),l(at(S,s))},"onSelectPath"),updateStatus:Us.data,updateStatusLoading:Us.isLoading,onCheckUpdates:n(()=>{Us.refetch()},"onCheckUpdates"),checkUpdatesPending:Us.isFetching,onInstallUpdate:n(()=>$t.mutate(),"onInstallUpdate"),installUpdatePending:$t.isPending,onToggleStar:n(()=>qt.mutate(),"onToggleStar"),starPending:qt.isPending,onFork:n(()=>B&&l(ft(B.id)),"onFork"),onUpdateSettings:n(s=>B&&Rt.mutate({skillId:B.id,updates:s}),"onUpdateSettings"),onMoveToFolder:B?()=>Qe({skillIds:[B.id],title:`Move "${B.name}"`,subtitle:"Choose a destination folder.",currentFolderId:B.folderId??null}):void 0,updateSettingsPending:Rt.isPending,onDelete:Gn,deletePending:Is.isPending,studioHref:Kn(S)}):h?(0,e.jsxs)("div",{className:"min-h-(--sz-calc-30)",children:[(0,e.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,e.jsxs)(Je,{to:dr,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground no-underline transition-colors hover:text-foreground",children:[(0,e.jsx)(rn,{className:"h-4 w-4"}),"Back to store"]})}),Ie.isLoading||zt.isLoading?(0,e.jsx)(Le,{variant:"detail"}):R?(0,e.jsxs)("div",{className:"grid gap-0 xl:grid-cols-(--gtc-30)",children:[(0,e.jsxs)("aside",{className:"border-b border-border px-3 py-4 xl:border-b-0 xl:border-r",children:[(0,e.jsx)("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Files"}),(0,e.jsx)(Bt,{nodes:Rn(R.files.map(s=>({path:s.path,kind:s.kind}))),skillId:R.id,selectedPath:J,expandedDirs:Ce[R.id]??new Set,onToggleDir:n(s=>ve(i=>{const d=new Set(i[R.id]??[]);return d.has(s)?d.delete(s):d.add(s),{...i,[R.id]:d}}),"onToggleDir"),onSelectPath:n(s=>O(s),"onSelectPath"),fileHref:n(()=>`/skills?catalog=${encodeURIComponent(h)}`,"fileHref")})]}),(0,e.jsx)("div",{className:"min-w-0",children:(0,e.jsx)(Qa,{skill:R,packageName:R.packageName??Fs.get(R.key)?.packageName??null,packageVersion:R.packageVersion??Fs.get(R.key)?.packageVersion??null,installedSkill:Fs.get(R.key)??null,installedSkillId:Fs.get(R.key)?.id??null,fileQuery:Wn,selectedPath:J,onInstall:n(()=>Yt(R),"onInstall"),onUpdate:n(()=>Yt(R),"onUpdate"),onOpenInstalled:n(s=>l(at(s)),"onOpenInstalled"),loadingPrimaryAction:ot.isPending})})]}):(0,e.jsx)(Ze,{icon:pe,message:"Catalog skill not found."})]}):(0,e.jsx)("div",{className:"min-h-(--sz-calc-30)",children:Ge.isLoading?(0,e.jsx)(Le,{variant:"detail"}):(0,e.jsx)(Ze,{icon:pe,message:"Skill not found."})})]})}n(Bl,"CompanySkills");export{Bl as CompanySkills};