@tscircuit/fake-snippets 0.0.120 → 0.0.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/.github/workflows/bun-pver-release.yml +29 -4
  2. package/dist/assets/404-CnNkOMw-.js +1 -0
  3. package/dist/assets/Analytics-DIw7l2gi.js +84 -0
  4. package/dist/assets/BuildsList-CeqVVhbz.js +1 -0
  5. package/dist/assets/CodeAndPreview-Dycd0s15.js +722 -0
  6. package/dist/assets/DownloadButtonAndMenu-OIUhbKkj.js +194 -0
  7. package/dist/assets/FileSaver.min-BDsOlqKl.js +1 -0
  8. package/dist/assets/Footer-DU-HdqGk.js +1 -0
  9. package/dist/assets/GithubAvatarWithFallback-CQhrBiKP.js +6 -0
  10. package/dist/assets/Header-CI4GZVOv.js +1 -0
  11. package/dist/assets/Header2-CrMDmo3P.js +5 -0
  12. package/dist/assets/NotFound-DaXtEPsC.js +1 -0
  13. package/dist/assets/OrganizationCard-Bs2dw-AL.js +1 -0
  14. package/dist/assets/PackageBreadcrumb-DpOpPbGc.js +6 -0
  15. package/dist/assets/PackageCard-ejE2dLlA.js +16 -0
  16. package/dist/assets/PackageSearchResults-BI3Rtmr2.js +1 -0
  17. package/dist/assets/ProfileRouter-4xNgtXr5.js +6 -0
  18. package/dist/assets/alert-dialog-DrOB4Tui.js +1 -0
  19. package/dist/assets/authorize-D-5R3QHA.js +16 -0
  20. package/dist/assets/badge-Bk-k6kyg.js +1 -0
  21. package/dist/assets/card-CzXDit7x.js +1 -0
  22. package/dist/assets/circle-alert-Du9-4of0.js +6 -0
  23. package/dist/assets/circle-check-big-KaRyRsht.js +6 -0
  24. package/dist/assets/cpu-BnvjzmIA.js +6 -0
  25. package/dist/assets/create-organization-BHNFvE7B.js +1 -0
  26. package/dist/assets/dashboard-DDH4V91X.js +11 -0
  27. package/dist/assets/datasheet-DqKtWt-O.js +1 -0
  28. package/dist/assets/datasheets-4W6pEMf3.js +1 -0
  29. package/dist/assets/dev-login-CbHdDthp.js +1 -0
  30. package/dist/assets/editor-bqg9Yv91.js +1 -0
  31. package/dist/assets/editor_example_1-1000w.webp +0 -0
  32. package/dist/assets/editor_example_1-1200w.webp +0 -0
  33. package/dist/assets/editor_example_1-1600w.webp +0 -0
  34. package/dist/assets/editor_example_1-2000w.webp +0 -0
  35. package/dist/assets/editor_example_1-400w.webp +0 -0
  36. package/dist/assets/editor_example_1-600w.webp +0 -0
  37. package/dist/assets/editor_example_1-800w.webp +0 -0
  38. package/dist/assets/editor_example_1_more_square-1000w.webp +0 -0
  39. package/dist/assets/editor_example_1_more_square-1200w.webp +0 -0
  40. package/dist/assets/editor_example_1_more_square-1600w.webp +0 -0
  41. package/dist/assets/editor_example_1_more_square-2000w.webp +0 -0
  42. package/dist/assets/editor_example_1_more_square-400w.webp +0 -0
  43. package/dist/assets/editor_example_1_more_square-600w.webp +0 -0
  44. package/dist/assets/editor_example_1_more_square-800w.webp +0 -0
  45. package/dist/assets/editor_example_2-1000w.webp +0 -0
  46. package/dist/assets/editor_example_2-1200w.webp +0 -0
  47. package/dist/assets/editor_example_2-1600w.webp +0 -0
  48. package/dist/assets/editor_example_2-2000w.webp +0 -0
  49. package/dist/assets/editor_example_2-400w.webp +0 -0
  50. package/dist/assets/editor_example_2-600w.webp +0 -0
  51. package/dist/assets/editor_example_2-800w.webp +0 -0
  52. package/dist/assets/example_schematic-1000w.webp +0 -0
  53. package/dist/assets/example_schematic-1200w.webp +0 -0
  54. package/dist/assets/example_schematic-1600w.webp +0 -0
  55. package/dist/assets/example_schematic-2000w.webp +0 -0
  56. package/dist/assets/example_schematic-400w.webp +0 -0
  57. package/dist/assets/example_schematic-600w.webp +0 -0
  58. package/dist/assets/example_schematic-800w.webp +0 -0
  59. package/dist/assets/eye-B_NMTTT7.js +6 -0
  60. package/dist/assets/fallback-image.svg +1 -0
  61. package/dist/assets/favicon-BwEjZKGP.ico +0 -0
  62. package/dist/assets/formatTimeAgo-CawXna5h.js +6 -0
  63. package/dist/assets/github-DjKGjbX1.js +6 -0
  64. package/dist/assets/github-dark-DHJKELXO.js +1 -0
  65. package/dist/assets/github-light-DAi9KRSo.js +1 -0
  66. package/dist/assets/hash-DfKYpqTm.js +6 -0
  67. package/dist/assets/index-B17tE1vy.js +1 -0
  68. package/dist/assets/index-BQPj88OW.js +6051 -0
  69. package/dist/assets/index-DvNLZBaq.js +6 -0
  70. package/dist/assets/keyboard-4b_qLHIF.js +11 -0
  71. package/dist/assets/label-CTudXc4q.js +1 -0
  72. package/dist/assets/landing-Cjvvx-9q.js +11 -0
  73. package/dist/assets/latest-DMk4BmXW.js +1 -0
  74. package/dist/assets/layers-BJ1iwaVM.js +6 -0
  75. package/dist/assets/load-prettier-DgbV1Jgu.js +1 -0
  76. package/dist/assets/lock-BOZRJdUv.js +6 -0
  77. package/dist/assets/main-DPEM9abA.js +26 -0
  78. package/dist/assets/main-MTKdI4FA.css +1 -0
  79. package/dist/assets/my-orders-B7lEyNR9.js +1 -0
  80. package/dist/assets/organization-settings-rNvhYFgZ.js +6 -0
  81. package/dist/assets/package-editor-T4WIRP49.js +1 -0
  82. package/dist/assets/pen-D54fxNRf.js +6 -0
  83. package/dist/assets/plus-KkE_6Dq2.js +6 -0
  84. package/dist/assets/preview-release-DWhKHFWp.js +1 -0
  85. package/dist/assets/quickstart-WF3HR9Dc.js +1 -0
  86. package/dist/assets/refresh-cw-aWASTRku.js +6 -0
  87. package/dist/assets/release-builds-COa5ndHa.js +1 -0
  88. package/dist/assets/release-detail-iclJPUO-.js +6 -0
  89. package/dist/assets/releases-Clsyp-7n.js +1 -0
  90. package/dist/assets/role-badge-BGF_IMlO.js +16 -0
  91. package/dist/assets/search-CwH23pAU.js +1 -0
  92. package/dist/assets/select-BN8AF1J7.js +1 -0
  93. package/dist/assets/settings-B2bMEtS4.js +6 -0
  94. package/dist/assets/skeleton-DLAS40-y.js +1 -0
  95. package/dist/assets/svg-to-png-BX4YEHCP-JcDm8Hc5.js +1 -0
  96. package/dist/assets/svg-to-png-BX4YEHCP-pNo9Afg8.js +1 -0
  97. package/dist/assets/tabs-Ce0NFuwd.js +1 -0
  98. package/dist/assets/timeAgo-VY0F2EV9.js +10 -0
  99. package/dist/assets/tooltip-C1pwvC0K.js +11 -0
  100. package/dist/assets/trash-2-BW3eClHz.js +6 -0
  101. package/dist/assets/trending-C8246HGf.js +1 -0
  102. package/dist/assets/triangle-alert-BMIBEO1D.js +6 -0
  103. package/dist/assets/tsx-COt5Ahok.js +1 -0
  104. package/dist/assets/use-create-datasheet-B7TDsTUt.js +1 -0
  105. package/dist/assets/use-delete-package-DLKtoTOj.js +1 -0
  106. package/dist/assets/use-download-zip-CAOKjGXW.js +1 -0
  107. package/dist/assets/use-list-user-orgs-CgJIT7N4.js +1 -0
  108. package/dist/assets/use-organization-XwYYTFck.js +1 -0
  109. package/dist/assets/use-package-builds-Bx8rfxi1.js +1 -0
  110. package/dist/assets/use-package-by-package-name-1s1Pcarw.js +1 -0
  111. package/dist/assets/use-package-files-CmmWVuGn.js +1 -0
  112. package/dist/assets/use-package-release-by-id-or-version-BuuXcSZq.js +1 -0
  113. package/dist/assets/use-package-release-images-BMaZtvmk.js +1 -0
  114. package/dist/assets/use-packages-base-api-url-DA1hucM7.js +1 -0
  115. package/dist/assets/useQueries-BJ7Ue7HV.js +1 -0
  116. package/dist/assets/user-settings-BqO5FkMf.js +1 -0
  117. package/dist/assets/view-package-C-OvJr_Q.js +165 -0
  118. package/dist/assets/vitesse-light-CVO1_9PV.js +1 -0
  119. package/dist/assets/wasm-CG6Dc4jp.js +1 -0
  120. package/dist/index.html +127 -0
  121. package/dist/landing.html +34 -0
  122. package/dist/robots.txt +9 -0
  123. package/dist/sitemap.xml +118 -0
  124. package/dist/stats.html +4949 -0
  125. package/package.json +1 -1
  126. package/dist/bundle.js +0 -9288
  127. package/dist/index.d.ts +0 -2190
  128. package/dist/index.js +0 -3826
  129. package/dist/schema.d.ts +0 -3142
  130. package/dist/schema.js +0 -454
  131. package/fake-snippets-api/bun.lockb +0 -0
@@ -1,28 +1,53 @@
1
1
  # Created using @tscircuit/plop (npm install -g @tscircuit/plop)
2
2
  name: Publish to npm
3
3
  on:
4
- workflow_dispatch:
5
4
  push:
6
5
  branches:
7
6
  - main
8
7
  paths:
9
8
  - 'fake-snippets-api/**'
9
+ workflow_dispatch:
10
+
10
11
  jobs:
11
12
  publish:
12
13
  runs-on: ubuntu-latest
14
+ if: ${{ !(github.event_name == 'push' && startsWith(github.event.head_commit.message, 'v')) }}
13
15
  steps:
14
16
  - uses: actions/checkout@v4
17
+ with:
18
+ token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
15
19
  - name: Setup bun
16
20
  uses: oven-sh/setup-bun@v2
17
21
  with:
18
22
  bun-version: latest
19
- - uses: actions/setup-node@v5
23
+ - uses: actions/setup-node@v3
20
24
  with:
21
25
  node-version: 20
22
26
  registry-url: https://registry.npmjs.org/
23
27
  - run: npm install -g pver
24
28
  - run: bun install --frozen-lockfile
25
- - run: bun run build:fake-api
26
- - run: pver release
29
+ - run: bun run build
30
+ - run: pver release --no-push-main
27
31
  env:
28
32
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
33
+ GITHUB_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
34
+
35
+ - name: Create Pull Request
36
+ id: create-pr
37
+ uses: peter-evans/create-pull-request@v5
38
+ with:
39
+ commit-message: "chore: bump version"
40
+ title: "chore: bump version"
41
+ body: "Automated package update"
42
+ branch: bump-version-${{ github.run_number }}
43
+ base: main
44
+ token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
45
+ committer: tscircuitbot <githubbot@tscircuit.com>
46
+ author: tscircuitbot <githubbot@tscircuit.com>
47
+
48
+ - name: Enable auto-merge
49
+ if: steps.create-pr.outputs.pull-request-number != ''
50
+ run: |
51
+ gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash --delete-branch
52
+ env:
53
+ GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-BQPj88OW.js";import{H as r,a as s}from"./Header2-CrMDmo3P.js";import{F as i}from"./Footer-DU-HdqGk.js";import{N as n}from"./NotFound-DaXtEPsC.js";import"./Analytics-DIw7l2gi.js";import"./use-packages-base-api-url-DA1hucM7.js";function d({heading:e="Page Not Found",subtitle:t="The page you're looking for doesn't exist."}){return o.jsxs("div",{className:"flex min-h-screen flex-col",children:[o.jsxs(r,{children:[o.jsxs("title",{children:["404 - ",e," | tscircuit"]}),o.jsx("meta",{name:"description",content:t})]}),o.jsx(s,{}),o.jsx(n,{heading:e}),o.jsx(i,{})]})}export{d as NotFoundPage,d as default};
@@ -0,0 +1,84 @@
1
+ import{u as J,b as l,bQ as tt,z as G,j as e,k as O,bR as at,v as re,h as ne,aC as V,bS as _,a3 as xe,a4 as be,a5 as st,a6 as ye,a7 as we,a8 as rt,a9 as nt,B as te,H as ke,I as pe,m as ee,K as W,q as ot,bT as lt,Y as it,Z as oe,aq as ct,ar as ae,n as L,bU as dt,bV as ut,bW as pt,bX as ve,bY as Ne,bZ as je,b_ as mt,b$ as Ce,bC as ht,c0 as _e,c1 as ft,c2 as Se,c3 as $e,aT as gt,c4 as Ie,c5 as xt,c6 as Ee,l as B,al as bt,c7 as yt}from"./index-BQPj88OW.js";import{u as wt}from"./use-packages-base-api-url-DA1hucM7.js";const U=()=>{const t=wt(),s=J(a=>a.session);return l.useMemo(()=>tt.create({baseURL:t,headers:s?{Authorization:`Bearer ${s==null?void 0:s.token}`}:{}}),[s==null?void 0:s.token])},kt=(t,s,a={},r={})=>{const i=l.useRef(s),{preventDefault:d=!0,stopPropagation:u=!1,target:c=document}=r;l.useEffect(()=>{i.current=s},[s]),l.useEffect(()=>{if(!c)return;const x=m=>{const n=m.key.toLowerCase()===t.toLowerCase(),v=a.ctrl?m.ctrlKey:!0,w=a.alt?m.altKey:!0,N=a.shift?m.shiftKey:!0,b=a.meta?m.metaKey||m.ctrlKey:!0;n&&v&&w&&N&&b&&(d&&m.preventDefault(),u&&m.stopPropagation(),i.current(m))};return c.addEventListener("keydown",x),()=>c.removeEventListener("keydown",x)},[t,a.ctrl,a.alt,a.shift,a.meta,d,u,c])},vt=(t,s,a={})=>{const r={},i=t.toLowerCase().split("+").map(c=>c.trim()),d=i[i.length-1];i.slice(0,-1).forEach(c=>{switch(c){case"ctrl":r.ctrl=!0;break;case"cmd":case"meta":r.meta=!0;break;case"alt":r.alt=!0;break;case"shift":r.shift=!0;break}}),kt(d,s,r,a)};function Nt({title:t,description:s,variant:a,t:r}){return e.jsxs("div",{className:`rounded-md border p-4 shadow-lg transition-all ${r.visible?"animate-in fade-in slide-in-from-top-full":"animate-out fade-out slide-out-to-right-full"} ${a==="destructive"?"border-red-500 bg-red-500 text-slate-50":"border-slate-200 bg-white text-slate-950 dark:bg-slate-950 dark:text-slate-50"}`,children:[t&&e.jsx("div",{className:"text-sm font-semibold",children:t}),s&&e.jsx("div",{className:"text-sm opacity-90",children:s})]})}const jt=({duration:t,description:s,variant:a="default",title:r})=>s?G.custom(i=>e.jsx(Nt,{title:r,description:s,variant:a,t:i}),{duration:t}):a==="destructive"?G.error(e.jsx(e.Fragment,{children:r}),{duration:t}):G(e.jsx(e.Fragment,{children:r}),{duration:t});function le(){return{toast:jt,dismiss:G.dismiss,toastLibrary:G}}function Ct(){const{toast:t}=le();return s=>{t({title:"Not Implemented",description:e.jsxs("div",{children:["The ",s," feature is not implemented yet. Help us out!"," ",e.jsx("a",{className:"text-blue-500 hover:underline font-semibold",href:"https://github.com/tscircuit/tscircuit.com",children:"Check out our Github"})]})})}}const X=(t,s)=>{if(!t)return{score:0,matches:[]};const r=(b=>b.toLowerCase().split(" ").join(""))(t),i=s.toLowerCase(),d=[];let u=0,c=0,x=0,m=0;const n=t.toLowerCase().trim().split(/\s+/);if(n.length>1){let b=0,I=n[0],C=0;for(let j=0;j<i.length&&b<n.length;j++){const E=i[j],h=I[C];E===h?(d.push(j),C++,x++,c+=1+x*.5,(j===0||/[/\-_.]/.test(s[j-1]))&&(c+=2),C>=I.length&&(b++,m+=3,b<n.length&&(I=n[b],C=0,x=0))):C>0&&/[/\-_.]/.test(E)&&b<n.length-1?(b++,b<n.length&&(I=n[b],C=0,x=0,E===I[0]&&(d.push(j),C=1,c+=2))):x=0}if(b<n.length||b===n.length-1&&C<I.length)return{score:-1,matches:[]};c+=m}else{for(let b=0;b<i.length&&u<r.length;b++)i[b]===r[u]?(d.push(b),u++,x++,c+=1+x*.5,(b===0||/[/\-_.]/.test(s[b-1]))&&(c+=2)):x=0;if(u!==r.length)return{score:-1,matches:[]}}c+=Math.max(0,100-s.length)*.1;const w=s.split("/").pop()||s,N=t.replace(/\s+/g,"");return w.toLowerCase().includes(N.toLowerCase())&&(c+=5),{score:c,matches:d}},_t=t=>()=>{const[s,a]=l.useState(!1),[r,i]=l.useState({});return l.useMemo(()=>({openDialog:d=>{d&&i(d),a(!0)},closeDialog:()=>{a(!1),i({})},Dialog:d=>e.jsx(t,{...d,...r,open:s,onOpenChange:a}),open:s}),[s,r])};/**
2
+ * @license lucide-react v0.488.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const St=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Z=O("arrow-right",St);/**
7
+ * @license lucide-react v0.488.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const $t=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],It=O("chevron-down",$t);/**
12
+ * @license lucide-react v0.488.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Et=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Lt=O("clock",Et);/**
17
+ * @license lucide-react v0.488.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Pt=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],ja=O("menu",Pt);/**
22
+ * @license lucide-react v0.488.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const Dt=[["path",{d:"M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z",key:"1ront0"}],["path",{d:"m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9",key:"19h2x1"}],["path",{d:"M12 3v6",key:"1holv5"}]],me=O("package-2",Dt);/**
27
+ * @license lucide-react v0.488.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const Mt=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],he=O("sparkles",Mt);/**
32
+ * @license lucide-react v0.488.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const At=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Rt=O("star",At);/**
37
+ * @license lucide-react v0.488.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const Tt=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Le=O("user",Tt);/**
42
+ * @license lucide-react v0.488.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const Ot=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ca=O("x",Ot);/**
47
+ * @license lucide-react v0.488.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const Bt=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ft=O("zap",Bt),Jt=({open:t,onOpenChange:s,...a})=>e.jsx(at,{isOpen:t,onClose:()=>s(!1),...a}),zt=_t(Jt),Pe=({onSuccess:t}={})=>{const s=U(),a=J(r=>r.session);return re(["createPackage"],async({name:r,description:i,is_private:d,is_unlisted:u,org_id:c})=>{if(!a)throw new Error("No session");const{data:{package:x}}=await s.post("/packages/create",{name:r,description:i,is_private:d,is_unlisted:u,org_id:c});if(!x)throw new Error("Failed to create package");return x},{onSuccess:r=>{t==null||t(r)},onError:r=>{console.error("Error creating package:",r)}})},De=({onSuccess:t}={})=>{const s=U();return re(["createPackageRelease"],async({package_id:a,version:r,is_latest:i=!0,commit_sha:d,package_name_with_version:u})=>{var n,v;if(!u&&(!a||!r))throw new Error("Must provide either package_id + version or package_name_with_version");let c=r,x=u;if(u&&!r){const[w,N]=u.split("@");c=N,x=w}else if(u){const[w]=u.split("@");x=w}(!c||!/[0-9]/.test(c))&&(c="0.0.1");const m=x&&`${x}@${c}`;try{const{data:{package_release:w}}=await s.post("/package_releases/create",{package_id:a,version:c,is_latest:i,commit_sha:d,package_name_with_version:m});if(!w)throw new Error("Failed to create package release");return w}catch(w){if(w.status===400&&((v=(n=w.data)==null?void 0:n.error)==null?void 0:v.error_code)==="version_already_exists"&&m){await s.post("/package_releases/update",{package_name_with_version:m,is_latest:i,commit_sha:d});const{data:{package_release:N}}=await s.post("/package_releases/get",{package_name_with_version:m});if(!N)throw new Error("Failed to update package release");return N}throw w}},{onSuccess:a=>{t==null||t(a)},onError:a=>{console.error("Error creating package release:",a)}})},Me=({onSuccess:t}={})=>{const s=U();return re(["createPackageFiles"],async({file_path:a,content_text:r,content_base64:i,content_mimetype:d,package_release_id:u,package_name_with_version:c,is_release_tarball:x=!1,npm_pack_output:m})=>{if(!r&&!i||r&&i)throw new Error("Must provide either content_text or content_base64, but not both");if(!u&&!c)throw new Error("Must provide either package_release_id or package_name_with_version");const{data:{package_file:n}}=await s.post("/package_files/create",{file_path:a,content_text:r,content_base64:i,content_mimetype:d,package_release_id:u,package_name_with_version:c,is_release_tarball:x,npm_pack_output:m});if(!n)throw new Error("Failed to create package file");return n},{onSuccess:a=>{t==null||t(a)},onError:a=>{console.error("Error creating package file:",a)}})},Ut=()=>{const{toastLibrary:t}=le(),s=J(m=>m.session),[,a]=ne(),r=U(),i=Pe(),d=De(),u=Me(),c=l.useCallback(async({result:m,tsx:n})=>{if(!s)throw new Error("You must be logged in to import from JLCPCB");const v=m.component.partNumber||"component",N=(p=>p.replace(/^@/,"").trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_/]/g,"-").replace(/--+/g,"-").replace(/-+$/g,"").replace(/^-+/g,"")||"component")(v),b=`${s.github_username}/${N}`,I=async()=>{var p;try{const{data:y}=await r.post("/packages/get",{name:b});return y.package}catch(y){if((((p=y==null?void 0:y.response)==null?void 0:p.status)||(y==null?void 0:y.status))===404)return null;throw y}},C=await I();if(C)return a(`/editor?package_id=${C.package_id}`),{partNumber:v,packageId:C.package_id,existing:!0};const j=m.component.description||`Generated from JLCPCB part number ${v}`;let E;try{E=await i.mutateAsync({name:b,description:j})}catch(p){const y=await I();if(y)return a(`/editor?package_id=${y.package_id}`),{partNumber:v,packageId:y.package_id,existing:!0};throw p}const h=await d.mutateAsync({package_id:E.package_id,version:"0.1.0",is_latest:!0});return await u.mutateAsync({file_path:"index.tsx",content_text:n,package_release_id:h.package_release_id}),a(`/editor?package_id=${E.package_id}`),{partNumber:v,packageId:E.package_id,existing:!1}},[u,i,d,r,a,s]);return{importComponent:l.useCallback(async m=>{const n=c(m);t.promise(n,{loading:"Importing component...",success:({partNumber:v,existing:w})=>e.jsx("p",{children:w?`Component ${v} already exists. Opening package in the editor.`:`Component ${v} imported successfully. Opening package in the editor.`}),error:v=>e.jsx("p",{children:v instanceof Error?v.message:"Failed to import component"})}),await n},[c,t])}},_a=(t,s)=>{const a=Ht(t,s);window.open(a,"_blank")},Ht=(t,s)=>{const a=`[${t}] Failed to import from JLCPCB`,r=`I tried to import the part number ${t} from JLCPCB, but it failed. Here's the error I got:
52
+ \`\`\`
53
+ ${s}
54
+ \`\`\`
55
+
56
+ Could be an issue in \`fetchEasyEDAComponent\` or \`convertRawEasyEdaToTs\``;return`https://github.com/tscircuit/easyeda-converter/issues/new?title=${encodeURIComponent(a)}&body=${encodeURIComponent(r)}&labels=${encodeURIComponent("snippets,good first issue")}`};var Kt=t=>{var x,m;const s=V(t).pcb_hole.list(),a=V(t).pcb_plated_hole.list(),r=V(t).pcb_smtpad.list(),i=V(t).pcb_silkscreen_path.list(),d=V(t).pcb_fabrication_note_path.list(),u=V(t).pcb_silkscreen_text.list(),c=[];for(const n of s)n.hole_shape==="circle"?c.push(`<hole pcbX="${_(n.x)}" pcbY="${_(n.y)}" diameter="${_(n.hole_diameter)}" />`):n.hole_shape==="oval"&&console.warn("Unhandled oval hole in conversion (needs implementation)");for(const n of a)n.shape==="oval"||n.shape==="pill"?c.push(`<platedhole portHints={${JSON.stringify(n.port_hints)}} pcbX="${_(n.x)}" pcbY="${_(n.y)}" outerHeight="${_(n.outer_height)}" outerWidth="${_(n.outer_width)}" holeHeight="${_(n.hole_height)}" holeWidth="${_(n.hole_width)}" height="${_(n.hole_height)}" shape="${n.shape}" />`):n.shape==="circle"&&c.push(`<platedhole portHints={${JSON.stringify(n.port_hints)}} pcbX="${_(n.x)}" pcbY="${_(n.y)}" outerDiameter="${_(n.outer_diameter)}" holeDiameter="${_(n.hole_diameter)}" shape="circle" />`);for(const n of r)n.shape==="circle"?c.push(`<smtpad portHints={${JSON.stringify(n.port_hints)}} pcbX="${_(n.x)}" pcbY="${_(n.y)}" radius="${_(n.radius)}" shape="circle" />`):n.shape==="rect"&&c.push(`<smtpad portHints={${JSON.stringify(n.port_hints)}} pcbX="${_(n.x)}" pcbY="${_(n.y)}" width="${_(n.width)}" height="${_(n.height)}" shape="rect" />`);for(const n of i)c.push(`<silkscreenpath route={${JSON.stringify(n.route)}} />`);for(const n of d)c.push(`<silkscreenpath route={${JSON.stringify(n.route)}} />`);for(const n of u){const v=((x=n.anchor_position)==null?void 0:x.x)??0,w=((m=n.anchor_position)==null?void 0:m.y)??0,N=n.anchor_alignment,b=n.font_size,C=String(n.text??"").replace(/"/g,'\\"');c.push(`<silkscreentext pcbX={${v}} pcbY={${w}} anchorAlignment="${N}" fontSize={${b}} text="${C}" />`)}return`
57
+ <footprint>
58
+ ${c.join(`
59
+ `)}
60
+ </footprint>
61
+ `.trim()},qt=({pinLabels:t,componentName:s,objUrl:a,circuitJson:r,supplierPartNumbers:i,manufacturerPartNumber:d})=>{const u=Kt(r);return`
62
+ import { type ChipProps } from "tscircuit"
63
+ ${t?`const pinLabels = ${JSON.stringify(t,null," ")} as const
64
+ `:""}export const ${s} = (props: ChipProps${t?"<typeof pinLabels>":""}) => (
65
+ <chip
66
+ footprint={${u}}
67
+ ${t?"pinLabels={pinLabels}":""}
68
+ ${a?`cadModel={{
69
+ objUrl: "${a}",
70
+ rotationOffset: { x: 0, y: 0, z: 0 },
71
+ positionOffset: { x: 0, y: 0, z: 0 },
72
+ }}`:""}
73
+ ${i?`supplierPartNumbers={${JSON.stringify(i,null," ")}}`:""}
74
+ ${d?`manufacturerPartNumber="${d}"`:""}
75
+ {...props}
76
+ />
77
+ )
78
+ `.replace(/\n\s*\n/g,`
79
+ `).trim()},Vt=(t,s)=>qt({circuitJson:t,...s});const Yt=t=>{try{return JSON.parse(t),!0}catch{return!1}};function Wt({open:t,onOpenChange:s}){const[a,r]=l.useState(""),[i,d]=l.useState(null),[u,c]=l.useState(!1),[x,m]=l.useState(null);J(p=>p.session);const{toast:n}=le();U();const[,v]=ne(),w=J(p=>!!p.session),N=Pe(),{mutate:b}=De({onSuccess:()=>{n({title:"Package released",description:"Your package has been released successfully."})}}),I=Me({onSuccess:()=>{n({title:"Package files created",description:"Your package files have been created successfully."})}}),C=async p=>{var A;const y=(A=p.target.files)==null?void 0:A[0];if(y)try{const T=await y.text();JSON.parse(T),d(y),m(null)}catch{m("Please select a valid JSON file that can be parsed.")}else m("Please select a file.")},j=async()=>{let p;const y=async P=>{try{return JSON.parse(P)}catch{throw new Error("Invalid JSON format.")}},A=P=>{n({title:"Import Failed",description:P,variant:"destructive"}),c(!1)},T=P=>{n({title:"Success",description:P})};try{if(i){const S=await i.text();p=await y(S)}else if(Yt(a))c(!0),m(null),p=await y(a);else{A("Please provide a valid JSON content or file.");return}const P=Vt(p,{componentName:"Component"});console.info(P),await N.mutateAsync({description:"Imported from Circuit JSON"},{onSuccess:S=>{T("Package has been created successfully."),b({package_name_with_version:`${S.name}@latest`},{onSuccess:R=>{I.mutateAsync({file_path:"index.tsx",content_text:P,package_release_id:R.package_release_id}).then(()=>{v(`/editor?package_id=${S.package_id}`)})},onError:R=>{m(R),A("Failed to create package release.")}})},onError:S=>{m(S),A("Failed to create package.")},onSettled:()=>{c(!1),s(!1)}})}catch(P){console.error("Error importing Circuit Json:",P),A("The Circuit JSON appears to be invalid or malformed. Please check the format and try again.")}finally{c(!1)}},E=p=>{(p.ctrlKey||p.metaKey)&&p.key==="Enter"&&(p.preventDefault(),!u&&w&&(a.trim()||i)&&j())},h=p=>{p.key==="Enter"&&!p.ctrlKey&&!p.metaKey&&p.target!==document.querySelector("textarea")&&(p.preventDefault(),!u&&w&&(a.trim()||i)&&j())};return e.jsx(xe,{open:t,onOpenChange:s,children:e.jsxs(be,{onKeyDown:h,children:[e.jsxs(st,{children:[e.jsx(ye,{children:"Import Circuit JSON"}),e.jsx(we,{children:"Use this dialog to import a Circuit JSON file or paste the JSON content directly."})]}),e.jsxs("div",{className:"pb-4",children:[e.jsx(rt,{className:"mt-3",placeholder:"Paste the Circuit JSON.",value:a,onChange:p=>r(p.target.value),onKeyDown:E,disabled:!!i}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[e.jsx("label",{htmlFor:"file-input",className:"block text-sm font-medium text-gray-700",children:"Upload JSON File"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("input",{id:"file-input",type:"file",accept:"application/json",onChange:C,className:"hidden"}),e.jsx("label",{htmlFor:"file-input",className:"px-4 py-2 bg-slate-900 text-slate-50 rounded-lg shadow cursor-pointer hover:bg-slate-900/90 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-50/90 transition-all duration-200",children:"Choose File"})]}),i&&e.jsxs("p",{className:"text-sm text-gray-600",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Selected file:"})," ",i.name]})]}),x&&e.jsx("p",{className:"bg-red-100 p-2 mt-2 pre-wrap",children:x})]}),e.jsx(nt,{children:e.jsx(te,{onClick:j,disabled:u||!w,children:w?u?"Importing...":"Import":"Must be logged in for JSON import"})})]})})}const Sa=()=>{const[t,s]=l.useState(!1),[a,r]=l.useState(""),[i,d]=l.useState(!1),[u,c]=l.useState(0),x=Ct(),m=U(),{Dialog:n,openDialog:v}=zt(),{importComponent:w}=Ut(),N=J(o=>o.session),b=N==null?void 0:N.github_username,I=l.useMemo(()=>N!=null&&N.token?{Authorization:`Bearer ${N.token}`}:void 0,[N==null?void 0:N.token]),C=l.useCallback(async o=>{await w(o)},[w]),j=l.useRef(null),E=l.useMemo(()=>[{name:"Blank Circuit Board",type:"board",icon:e.jsx(ke,{className:"w-4 h-4 text-green-500"})},{name:"Blank Circuit Module",type:"package",icon:e.jsx(me,{className:"w-4 h-4 text-blue-500"})}],[]),h=l.useMemo(()=>[{name:"Blinking LED Board",type:"board",icon:e.jsx(he,{className:"w-4 h-4 text-yellow-500"})},{name:"USB-C LED Flashlight",type:"board",icon:e.jsx(he,{className:"w-4 h-4 text-yellow-500"})}],[]),p=l.useMemo(()=>[{name:"Circuit JSON",type:"package",special:!0,icon:e.jsx(pe,{className:"w-4 h-4 text-red-500"})},{name:"JLCPCB Component",type:"package",special:!0,icon:e.jsx(pe,{className:"w-4 h-4 text-red-500"})}],[]),{data:y=[],isLoading:A}=ee(["packageSearch",a],async()=>{if(!a)return[];try{const{data:o}=await m.post("/packages/search",{query:a});return o.packages||[]}catch(o){return console.warn("Failed to fetch packages:",o),[]}},{enabled:!!a,retry:!1,refetchOnWindowFocus:!1}),{data:T=[],isLoading:P}=ee(["accountSearch",a],async()=>{if(!a)return[];try{const{data:o}=await m.post("/accounts/search",{query:a,limit:5});return o.accounts||[]}catch(o){return console.warn("Failed to fetch accounts:",o),[]}},{enabled:!!a&&!!b,retry:!1,refetchOnWindowFocus:!1}),S=l.useMemo(()=>!a||!y.length?[]:y.map(o=>{const{score:g,matches:k}=X(a,o.name);return{...o,score:g,matches:k}}).filter(o=>o.score>=0).sort((o,g)=>g.score-o.score).slice(0,6),[y,a]),R=l.useMemo(()=>!a||!T.length?[]:T.map(o=>{const{score:g,matches:k}=X(a,o.github_username);return{...o,score:g,matches:k}}).filter(o=>o.score>=0).sort((o,g)=>g.score-o.score).slice(0,5),[T,a]),{data:z=[]}=ee(["cmdKMenuPackages",b],async()=>{if(!b)return[];try{return(await m.post("/packages/list",{owner_github_username:b,limit:5})).data.packages||[]}catch(o){return console.warn("Failed to fetch recent packages:",o),[]}},{enabled:!!b&&!a,retry:!1,refetchOnWindowFocus:!1,refetchOnMount:!1,cacheTime:1440*60*1e3}),D=l.useMemo(()=>{if(!a)return{blankTemplates:E,templates:h,importOptions:p};const o=E.map(f=>{const{score:$,matches:M}=X(a,f.name);return{...f,score:$,matches:M}}).filter(f=>f.score>=0).sort((f,$)=>$.score-f.score),g=h.map(f=>{const{score:$,matches:M}=X(a,f.name);return{...f,score:$,matches:M}}).filter(f=>f.score>=0).sort((f,$)=>$.score-f.score),k=p.map(f=>{const{score:$,matches:M}=X(a,`Import ${f.name}`);return{...f,score:$,matches:M}}).filter(f=>f.score>=0).sort((f,$)=>$.score-f.score);return{blankTemplates:o,templates:g,importOptions:k}},[a,E,h,p]),H=l.useMemo(()=>{const o=[];return a&&S.length>0&&S.forEach(g=>{o.push({type:"package",item:g})}),a&&R.length>0&&R.forEach(g=>{o.push({type:"account",item:g})}),!a&&z.length>0&&z.slice(0,6).forEach(g=>{o.push({type:"recent",item:g})}),D.blankTemplates.forEach(g=>{o.push({type:"blank",item:g,disabled:g.disabled})}),D.templates.forEach(g=>{o.push({type:"template",item:g})}),D.importOptions.forEach(g=>{o.push({type:"import",item:g})}),o},[a,S,R,z,D]);vt("cmd+k",()=>{s(o=>!o)}),l.useEffect(()=>{c(0)},[H.length]),l.useEffect(()=>{j.current&&j.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[u]);const Ze=l.useCallback(o=>{o.key==="ArrowDown"?(o.preventDefault(),o.stopPropagation(),c(g=>Math.min(g+1,H.length-1))):o.key==="ArrowUp"?(o.preventDefault(),o.stopPropagation(),c(g=>Math.max(g-1,0))):o.key==="Enter"?(o.preventDefault(),o.stopPropagation(),H[u]&&!H[u].disabled&&K(H[u])):o.key==="Escape"&&(o.preventDefault(),o.stopPropagation(),s(!1))},[u,H.length]),K=l.useCallback(o=>{const{type:g,item:k}=o;switch(g){case"package":case"recent":window.location.href=`/${k.name}`,s(!1);break;case"account":window.location.href=`/${k.github_username}`,s(!1);break;case"blank":case"template":k.disabled||(window.location.href=`/editor?template=${k.name.toLowerCase().replace(/ /g,"-")}`,s(!1));break;case"import":if(k.special)switch(k.name){case"Circuit JSON":s(!1),d(!0);break;case"JLCPCB Component":s(!1),v();break}else s(!1),x(`${k.name} Import`);break}},[x]),Y=l.useCallback((o,g)=>!a||!o.matches?g:g.split("").map((f,$)=>e.jsx("span",{className:o.matches.includes($)?"bg-blue-200":"",children:f},$)),[a]),q=l.useCallback((o,g)=>{const{type:k,item:f,disabled:$}=o,M=g===u,Q=`
80
+ group flex items-center justify-between px-2 sm:px-3 py-2 rounded-md cursor-pointer
81
+ transition-all duration-150 border border-transparent text-sm w-full
82
+ ${M?"bg-blue-50 border-blue-200":"hover:bg-gray-50"}
83
+ ${$?"opacity-50 cursor-not-allowed":""}
84
+ `;switch(k){case"package":case"recent":return e.jsxs("div",{ref:M?j:null,className:Q,onClick:()=>!$&&K(o),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1 overflow-hidden",children:[e.jsx(me,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),e.jsxs("div",{className:"flex flex-col min-w-0 flex-1 overflow-hidden",children:[e.jsx("span",{className:"font-medium text-gray-900 truncate max-w-full",children:k==="package"?Y(f,f.name):f.name}),f.description&&e.jsx("span",{className:"text-xs text-gray-500 truncate max-w-full",children:f.description}),k==="recent"&&e.jsx("span",{className:"text-xs text-gray-400 hidden sm:block truncate",children:new Date(f.updated_at).toLocaleDateString()})]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1 text-gray-500",children:[e.jsx(Rt,{className:"w-3 h-3 fill-yellow-400 text-yellow-400"}),e.jsx("span",{className:"text-xs",children:f.star_count??0})]}),e.jsx("span",{className:"text-xs text-gray-500 bg-gray-100 px-1.5 py-0.5 rounded hidden sm:inline",children:"package"}),M&&e.jsx(Z,{className:"w-3 h-3 text-gray-400"})]})]},`${k}-${f.package_id}`);case"account":return e.jsxs("div",{ref:M?j:null,className:Q,onClick:()=>!$&&K(o),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx("img",{src:`https://github.com/${f.github_username}.png`,alt:`${f.github_username} avatar`,className:"w-6 h-6 rounded-full flex-shrink-0",onError:et=>{var ue;const de=et.target;de.style.display="none",(ue=de.nextElementSibling)==null||ue.classList.remove("hidden")}}),e.jsx(Le,{className:"w-6 h-6 text-gray-400 flex-shrink-0 hidden"}),e.jsx("div",{className:"flex flex-col min-w-0 flex-1",children:e.jsx("span",{className:"font-medium text-gray-900 truncate",children:Y(f,f.github_username)})})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-500 bg-gray-100 px-1.5 py-0.5 rounded hidden sm:inline",children:"user"}),M&&e.jsx(Z,{className:"w-3 h-3 text-gray-400"})]})]},`account-${f.account_id}`);case"blank":case"template":return e.jsxs("div",{ref:M?j:null,className:Q,onClick:()=>!$&&K(o),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[f.icon,e.jsx("span",{className:"font-medium text-gray-900 truncate",children:Y(f,f.name)})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-500 bg-gray-100 px-1.5 py-0.5 rounded hidden sm:inline",children:f.type}),M&&e.jsx(Z,{className:"w-3 h-3 text-gray-400"})]})]},`${k}-${f.name}`);case"import":return e.jsxs("div",{ref:M?j:null,className:Q,onClick:()=>K(o),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[f.icon,e.jsxs("span",{className:"font-medium text-gray-900 truncate",children:["Import ",Y(f,f.name)]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-500 bg-gray-100 px-1.5 py-0.5 rounded hidden sm:inline",children:f.type}),M&&e.jsx(Z,{className:"w-3 h-3 text-gray-400"})]})]},`import-${f.name}`);default:return null}},[u,K,Y]);return t?e.jsxs(e.Fragment,{children:[e.jsx(xe,{open:t,onOpenChange:s,children:e.jsxs(be,{className:"max-w-xl lg:max-w-2xl w-[95vw] bg-white rounded-lg shadow-xl border border-gray-200 p-0 top-[10vh] translate-y-0",children:[e.jsx(ye,{className:"sr-only",children:"Command Menu"}),e.jsx(we,{className:"sr-only",children:"Use this menu to search packages and commands."}),e.jsxs(W,{className:"w-full overflow-hidden",loop:!1,onKeyDown:Ze,children:[e.jsxs("div",{className:"flex items-center border-b border-gray-200 px-3 sm:px-4 py-3",children:[e.jsx(ot,{className:"w-4 h-4 mr-2 text-gray-400 flex-shrink-0"}),e.jsx(W.Input,{placeholder:"Search packages and commands...",value:a,onValueChange:r,className:"w-full bg-transparent border-none outline-none text-sm text-gray-900 placeholder-gray-500"})]}),e.jsx(W.List,{className:"max-h-[60vh] sm:max-h-[50vh] overflow-y-auto p-2 sm:p-3 space-y-3 no-scrollbar",children:A||P?e.jsx(W.Loading,{className:"p-6 text-center text-gray-500",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin"}),"Loading..."]})}):e.jsxs(e.Fragment,{children:[a&&S.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2 px-2",children:"Packages"}),e.jsx("div",{className:"space-y-1",children:S.slice(0,8).map((o,g)=>q({type:"package",item:o},g))})]}),a&&R.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2 px-2",children:"Users"}),e.jsx("div",{className:"space-y-1",children:R.slice(0,5).map((o,g)=>{const k=S.length+g;return q({type:"account",item:o},k)})})]}),!a&&z.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2 px-2 flex items-center gap-1",children:[e.jsx(Lt,{className:"w-3 h-3"}),"Recent"]}),e.jsx("div",{className:"space-y-1",children:z.slice(0,6).map((o,g)=>q({type:"recent",item:o},g))})]}),D.blankTemplates.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2 px-2",children:"Create"}),e.jsx("div",{className:"space-y-1",children:D.blankTemplates.map((o,g)=>{const k=(a?S.length+R.length:z.length)+g;return q({type:"blank",item:o,disabled:o.disabled},k)})})]}),D.templates.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2 px-2",children:"Templates"}),e.jsx("div",{className:"space-y-1",children:D.templates.map((o,g)=>{const k=(a?S.length+R.length:z.length)+D.blankTemplates.length+g;return q({type:"template",item:o},k)})})]}),D.importOptions.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2 px-2",children:"Import"}),e.jsx("div",{className:"space-y-1",children:D.importOptions.map((o,g)=>{const k=(a?S.length+R.length:z.length)+D.blankTemplates.length+D.templates.length+g;return q({type:"import",item:o},k)})})]}),a&&!S.length&&!R.length&&!D.blankTemplates.length&&!D.templates.length&&!D.importOptions.length&&!A&&!P&&e.jsxs(W.Empty,{className:"py-8 text-center",children:[e.jsx("div",{className:"text-gray-400 mb-1",children:"No results found"}),e.jsx("div",{className:"text-gray-500 text-xs",children:"Try different search terms"})]})]})}),e.jsx("div",{className:"border-t border-gray-200 px-2 py-2 bg-gray-50/50 rounded-b-lg",children:e.jsxs("div",{className:"flex justify-between items-center text-[11px] sm:text-xs text-gray-500",children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-white border border-gray-200 shadow-sm rounded text-[10px] sm:text-xs",children:"↑↓"}),e.jsx("span",{className:"hidden sm:inline",children:"navigate"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-white border border-gray-200 shadow-sm rounded text-[10px] sm:text-xs",children:"↵"}),e.jsx("span",{className:"hidden sm:inline",children:"select"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1 py-0.5 font-mono bg-white border border-gray-200 shadow-sm rounded text-[10px] sm:text-xs",children:"⌘K"}),e.jsx("span",{className:"hidden sm:inline",children:"close"})]})]})})]})]})}),e.jsx(n,{onJlcpcbComponentTsxLoaded:C,jlcpcbProxyRequestHeaders:I})]}):e.jsxs(e.Fragment,{children:[e.jsx(n,{onJlcpcbComponentTsxLoaded:C,jlcpcbProxyRequestHeaders:I}),e.jsx(Wt,{open:i,onOpenChange:d})]})};function Xt(){return lt.useSyncExternalStore(Gt,()=>!0,()=>!1)}function Gt(){return()=>{}}var ie="Avatar",[Qt]=it(ie),[Zt,Ae]=Qt(ie),Re=l.forwardRef((t,s)=>{const{__scopeAvatar:a,...r}=t,[i,d]=l.useState("idle");return e.jsx(Zt,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:d,children:e.jsx(oe.span,{...r,ref:s})})});Re.displayName=ie;var Te="AvatarImage",Oe=l.forwardRef((t,s)=>{const{__scopeAvatar:a,src:r,onLoadingStatusChange:i=()=>{},...d}=t,u=Ae(Te,a),c=ea(r,d),x=ct(m=>{i(m),u.onImageLoadingStatusChange(m)});return ae(()=>{c!=="idle"&&x(c)},[c,x]),c==="loaded"?e.jsx(oe.img,{...d,ref:s,src:r}):null});Oe.displayName=Te;var Be="AvatarFallback",Fe=l.forwardRef((t,s)=>{const{__scopeAvatar:a,delayMs:r,...i}=t,d=Ae(Be,a),[u,c]=l.useState(r===void 0);return l.useEffect(()=>{if(r!==void 0){const x=window.setTimeout(()=>c(!0),r);return()=>window.clearTimeout(x)}},[r]),u&&d.imageLoadingStatus!=="loaded"?e.jsx(oe.span,{...i,ref:s}):null});Fe.displayName=Be;function fe(t,s){return t?s?(t.src!==s&&(t.src=s),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function ea(t,{referrerPolicy:s,crossOrigin:a}){const r=Xt(),i=l.useRef(null),d=r?(i.current||(i.current=new window.Image),i.current):null,[u,c]=l.useState(()=>fe(d,t));return ae(()=>{c(fe(d,t))},[d,t]),ae(()=>{const x=v=>()=>{c(v)};if(!d)return;const m=x("loaded"),n=x("error");return d.addEventListener("load",m),d.addEventListener("error",n),s&&(d.referrerPolicy=s),typeof a=="string"&&(d.crossOrigin=a),()=>{d.removeEventListener("load",m),d.removeEventListener("error",n)}},[d,a,s]),u}var Je=Re,ze=Oe,Ue=Fe;const He=l.forwardRef(({className:t,...s},a)=>e.jsx(Je,{ref:a,className:L("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...s}));He.displayName=Je.displayName;const Ke=l.forwardRef(({className:t,...s},a)=>e.jsx(ze,{ref:a,className:L("aspect-square h-full w-full",t),...s}));Ke.displayName=ze.displayName;const qe=l.forwardRef(({className:t,...s},a)=>e.jsx(Ue,{ref:a,className:L("flex h-full w-full items-center justify-center rounded-full bg-slate-100 dark:bg-slate-800",t),...s}));qe.displayName=Ue.displayName;const Ve=dt,Ye=ut,$a=ft,Ia=mt,ta=l.forwardRef(({className:t,inset:s,children:a,...r},i)=>e.jsxs(Ce,{ref:i,className:L("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100 dark:focus:bg-slate-800 dark:data-[state=open]:bg-slate-800",s&&"pl-8",t),...r,children:[a,e.jsx(ht,{className:"ml-auto h-4 w-4"})]}));ta.displayName=Ce.displayName;const aa=l.forwardRef(({className:t,...s},a)=>e.jsx(_e,{ref:a,className:L("z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",t),...s}));aa.displayName=_e.displayName;const ce=l.forwardRef(({className:t,sideOffset:s=4,...a},r)=>e.jsx(pt,{children:e.jsx(ve,{ref:r,sideOffset:s,className:L("z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));ce.displayName=ve.displayName;const F=l.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Ne,{ref:r,className:L("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-slate-100 focus:text-slate-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-800 dark:focus:text-slate-50",s&&"pl-8",t),...a}));F.displayName=Ne.displayName;const sa=l.forwardRef(({className:t,children:s,checked:a,...r},i)=>e.jsxs(Se,{ref:i,className:L("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-slate-100 focus:text-slate-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-800 dark:focus:text-slate-50",t),checked:a,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx($e,{children:e.jsx(gt,{className:"h-4 w-4"})})}),s]}));sa.displayName=Se.displayName;const ra=l.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Ie,{ref:r,className:L("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-slate-100 focus:text-slate-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-800 dark:focus:text-slate-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx($e,{children:e.jsx(xt,{className:"h-4 w-4 fill-current"})})}),s]}));ra.displayName=Ie.displayName;const na=l.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Ee,{ref:r,className:L("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...a}));na.displayName=Ee.displayName;const oa=l.forwardRef(({className:t,...s},a)=>e.jsx(je,{ref:a,className:L("-mx-1 my-1 h-px bg-slate-100 dark:bg-slate-800",t),...s}));oa.displayName=je.displayName;const la=()=>(J(t=>t.setSession),()=>{const t=window.location.href.replace("127.0.0.1","localhost"),s=`${window.location.origin.replace("127.0.0.1","localhost")}/authorize?redirect=${encodeURIComponent(t)}`;window.location.href=s}),Ea=()=>{const t=J(u=>u.session),s=!!t,a=J(u=>u.setSession),r=la(),[i,d]=l.useState(!1);return s?e.jsxs(Ve,{open:i,onOpenChange:d,children:[e.jsx(Ye,{asChild:!0,children:e.jsxs(He,{className:"w-8 h-8 login-avatar",children:[e.jsx(Ke,{src:`https://github.com/${t==null?void 0:t.github_username}.png?size=40`,alt:`${t==null?void 0:t.github_username}'s profile picture`}),e.jsx(qe,{"aria-label":"User avatar fallback",children:e.jsx(Le,{size:16,"aria-hidden":"true"})})]})}),e.jsxs(ce,{className:"ml-1 mr-1 md:ml-0 md:mr-1",children:[e.jsx(F,{asChild:!0,children:e.jsx(B,{href:`/${t==null?void 0:t.github_username}`,className:"cursor-pointer",onClick:()=>d(!1),children:"My Profile"})}),e.jsx(F,{asChild:!0,children:e.jsx(B,{href:"/dashboard",className:"cursor-pointer",onClick:()=>d(!1),children:"Dashboard"})}),e.jsx(F,{asChild:!0,children:e.jsx(B,{href:`/${t==null?void 0:t.github_username}/settings`,className:"cursor-pointer",onClick:()=>d(!1),children:"Settings"})}),e.jsx(F,{asChild:!0,children:e.jsx(B,{href:"/orgs/new",className:"cursor-pointer",onClick:()=>d(!1),children:"Create Organization"})}),e.jsx(F,{asChild:!0,children:e.jsx(B,{href:"/",className:"cursor-pointer",onClick:()=>{a(null),d(!1)},children:"Sign Out"})})]})]}):e.jsxs("div",{className:"flex items-center md:space-x-2 justify-end",children:[e.jsx(te,{onClick:()=>r(),variant:"ghost",children:"Log In"}),e.jsx(te,{onClick:()=>r(),children:"Get Started"})]})},We=l.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:L("flex h-9 w-full rounded-md border border-slate-200 bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-slate-950 placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-slate-950 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-800 dark:file:text-slate-50 dark:placeholder:text-slate-400 dark:focus-visible:ring-slate-300",t),ref:r,...a}));We.displayName="Input";const ia=bt("relative w-full rounded-lg border border-slate-200 px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-slate-950 [&>svg~*]:pl-7 dark:border-slate-800 dark:[&>svg]:text-slate-50",{variants:{variant:{default:"bg-white text-slate-950 dark:bg-slate-950 dark:text-slate-50",destructive:"border-red-500/50 text-red-500 dark:border-red-500 [&>svg]:text-red-500 dark:border-red-900/50 dark:text-red-900 dark:dark:border-red-900 dark:[&>svg]:text-red-900"}},defaultVariants:{variant:"default"}}),Xe=l.forwardRef(({className:t,variant:s,...a},r)=>e.jsx("div",{ref:r,role:"alert",className:L(ia({variant:s}),t),...a}));Xe.displayName="Alert";const ca=l.forwardRef(({className:t,...s},a)=>e.jsx("h5",{ref:a,className:L("mb-1 font-medium leading-none tracking-tight",t),...s}));ca.displayName="AlertTitle";const da=l.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:L("text-sm [&_p]:leading-relaxed",t),...s}));da.displayName="AlertDescription";const ua=({shouldOpenInNewTab:t,href:s,className:a,onClick:r,children:i})=>t?e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:a,onClick:r,children:i}):e.jsx(B,{onClick:r,className:a,href:s,children:i}),La=({onResultsFetched:t,autofocus:s=!1,closeOnClick:a})=>{const[r,i]=l.useState(""),[d,u]=l.useState(!1),[c,x]=l.useState(-1),m=U(),n=l.useRef(null),v=l.useRef(null),[w,N]=ne(),{data:b,isLoading:I}=ee(["packageSearch",r],async()=>{if(!r)return[];const{data:h}=await m.post("/packages/search",{query:r});return t&&t(h.packages),h.packages},{enabled:!!r});l.useEffect(()=>{x(-1)},[b]);const C=h=>{h.preventDefault(),r.trim()&&N(`/search?q=${encodeURIComponent(r.trim())}`)};l.useEffect(()=>{var h;s&&((h=v.current)==null||h.focus())},[]),l.useEffect(()=>{var y;if(c<0)return;const h=(y=n.current)==null?void 0:y.querySelectorAll("li"),p=h==null?void 0:h[c];p==null||p.scrollIntoView({block:"nearest"})},[c]),l.useEffect(()=>{const h=y=>{n.current&&!n.current.contains(y.target)&&u(!1)},p=y=>{y.key==="Escape"&&(u(!1),a&&a())};return document.addEventListener("mousedown",h),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p)}},[a]);const j=w==="/editor"||w==="/ai",E=w==="/editor"||w==="/ai";return e.jsxs("form",{onSubmit:C,autoComplete:"off",className:"relative w-44",children:[e.jsx(We,{autoComplete:"off",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",ref:v,type:"search","aria-autocomplete":"none",placeholder:"Search",className:"pl-4 focus:border-blue-500 placeholder-gray-400 text-sm select-none",value:r,onChange:h=>{i(h.target.value),u(!!h.target.value)},onKeyDown:h=>{if(h.key==="Backspace"&&!r&&a){a();return}if(b){if(h.key==="ArrowDown")h.preventDefault(),u(!0),x(p=>Math.min(p+1,b.length-1));else if(h.key==="ArrowUp")h.preventDefault(),x(p=>Math.max(p-1,0));else if(h.key==="Enter"&&c>=0){h.preventDefault();const p=b[c];if(p){const y=E?`/editor?package_id=${p.package_id}`:`/${p.name}`;j?window.open(y,"_blank"):N(y),u(!1),a&&a()}}}},"aria-label":"Search packages",role:"searchbox"}),I&&e.jsx("div",{className:"absolute top-full w-lg left-0 right-0 mt-1 bg-white shadow-lg rounded-lg border w-80 grid place-items-center py-4 z-50 p-3",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-gray-600 text-sm",children:"Searching..."})]})}),d&&b&&e.jsx("div",{ref:n,className:"absolute top-full md:left-0 right-0 no-scrollbar mt-2 bg-white shadow-lg rounded-md z-50 w-80 max-h-screen overflow-y-auto overflow-x-visible",children:b.length>0?e.jsx("ul",{className:"divide-y divide-gray-200 no-scrollbar",children:b.map((h,p)=>{const y=h.latest_pcb_preview_image_url??h.latest_cad_preview_image_url??h.latest_sch_preview_image_url??void 0,A=!!y;return e.jsx("li",{className:L("p-2 hover:bg-gray-50",p===c&&"bg-gray-100"),children:e.jsxs(ua,{href:E?`/editor?package_id=${h.package_id}`:`/${h.name}`,shouldOpenInNewTab:j,className:"flex",onClick:()=>{u(!1),a&&a()},children:[e.jsxs("div",{className:"w-12 h-12 overflow-hidden mr-2 flex-shrink-0 rounded-sm bg-gray-50 border flex items-center justify-center",children:[A?e.jsx("img",{src:y,alt:`PCB preview for ${h.name}`,draggable:!1,className:"w-12 h-12 object-contain p-1 scale-[4] rotate-45",onError:T=>{var P,S;T.currentTarget.style.display="none",(P=T.currentTarget.nextElementSibling)==null||P.classList.remove("hidden"),(S=T.currentTarget.nextElementSibling)==null||S.classList.add("flex")}}):null,e.jsx("div",{className:`w-12 h-12 ${A?"hidden":"flex"} items-center justify-center`,children:e.jsx(ke,{className:"w-6 h-6 text-gray-300"})})]}),e.jsxs("div",{className:"flex-grow",children:[e.jsx("div",{className:"font-medium text-blue-600 break-words text-xs",children:h.name}),h.description&&e.jsx("div",{className:"text-xs text-gray-500 break-words h-8 overflow-hidden",children:h.description})]})]})},h.package_id)})}):e.jsxs(Xe,{variant:"default",className:"p-4 text-center",children:['No results found for "',r,'"']})})]})};function Pa(){const[t,s]=l.useState(!1),a=[{name:"Blank Circuit Board",type:"board",badgeColor:"bg-blue-500"},{name:"Blank Circuit Module",type:"package",badgeColor:"bg-green-500"},{name:"Blank 3D Model",type:"model",badgeColor:"bg-purple-500 ",disabled:!0},{name:"Blank Footprint",type:"footprint",badgeColor:"bg-pink-500 ",disabled:!0}];return e.jsxs(Ve,{open:t,onOpenChange:s,children:[e.jsx(Ye,{asChild:!0,children:e.jsxs(te,{size:"sm",variant:"default",className:"bg-blue-600 hover:bg-blue-700",children:["New ",e.jsx(It,{className:"ml-1 h-4 w-4"})]})}),e.jsxs(ce,{className:"w-fit",children:[e.jsx(F,{asChild:!0,children:e.jsxs(B,{href:"/quickstart",className:"flex items-center cursor-pointer",onClick:()=>s(!1),children:[e.jsx(Ft,{className:"mr-2 h-3 w-3"}),"Quickstart Templates"]})}),a.map((r,i)=>e.jsx(F,{asChild:!0,disabled:r.disabled,children:e.jsxs(B,{href:`/editor?template=${r.name.toLowerCase().replace(/ /g,"-")}`,className:L("flex items-center cursor-pointer",r.disabled&&"opacity-50 cursor-not-allowed"),onClick:()=>!r.disabled&&s(!1),children:[e.jsx("span",{className:`w-2 h-2 rounded-full mr-2 ${r.badgeColor}`}),r.name]})},i)),e.jsx(F,{asChild:!0,children:e.jsxs(B,{href:"/quickstart",className:"flex items-center cursor-pointer",onClick:()=>s(!1),children:[e.jsx(yt,{className:"mr-2 h-3 w-3"}),"Import Part"]})})]})]})}var ge={},pa="@vercel/analytics",ma="1.5.0",ha=()=>{window.va||(window.va=function(...s){(window.vaq=window.vaq||[]).push(s)})};function Ge(){return typeof window<"u"}function Qe(){try{const t="production"}catch{}return"production"}function fa(t="auto"){if(t==="auto"){window.vam=Qe();return}window.vam=t}function ga(){return(Ge()?window.vam:Qe())||"production"}function se(){return ga()==="development"}function xa(t){return t.scriptSrc?t.scriptSrc:se()?"https://va.vercel-scripts.com/v1/script.debug.js":t.basePath?`${t.basePath}/insights/script.js`:"/_vercel/insights/script.js"}function ba(t={debug:!0}){var s;if(!Ge())return;fa(t.mode),ha(),t.beforeSend&&((s=window.va)==null||s.call(window,"beforeSend",t.beforeSend));const a=xa(t);if(document.head.querySelector(`script[src*="${a}"]`))return;const r=document.createElement("script");r.src=a,r.defer=!0,r.dataset.sdkn=pa+(t.framework?`/${t.framework}`:""),r.dataset.sdkv=ma,t.disableAutoTrack&&(r.dataset.disableAutoTrack="1"),t.endpoint?r.dataset.endpoint=t.endpoint:t.basePath&&(r.dataset.endpoint=`${t.basePath}/insights`),t.dsn&&(r.dataset.dsn=t.dsn),r.onerror=()=>{const i=se()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${a}. ${i}`)},se()&&t.debug===!1&&(r.dataset.debug="false"),document.head.appendChild(r)}function ya({route:t,path:s}){var a;(a=window.va)==null||a.call(window,"pageview",{route:t,path:s})}function wa(){if(!(typeof process>"u"||typeof ge>"u"))return ge.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function ka(t){return l.useEffect(()=>{var s;t.beforeSend&&((s=window.va)==null||s.call(window,"beforeSend",t.beforeSend))},[t.beforeSend]),l.useEffect(()=>{ba({framework:t.framework||"react",basePath:t.basePath??wa(),...t.route!==void 0&&{disableAutoTrack:!0},...t})},[]),l.useEffect(()=>{t.route&&t.path&&ya({route:t.route,path:t.path})},[t.route,t.path]),null}const Da=()=>e.jsx("div",{className:"absolute bottom-0 left-0 right-0",children:e.jsx(ka,{})});export{He as A,jt as B,It as C,Ve as D,Ct as E,La as F,Ea as G,Pa as H,We as I,Sa as J,Da as K,ja as M,me as P,Rt as S,Le as U,Ca as X,Ft as Z,la as a,zt as b,Ut as c,Wt as d,Ke as e,X as f,qe as g,Ye as h,ce as i,F as j,oa as k,le as l,_t as m,Lt as n,he as o,_a as p,$a as q,vt as r,De as s,Xe as t,U as u,da as v,Ia as w,ta as x,aa as y,Pe as z};
@@ -0,0 +1 @@
1
+ import{h as b,j as s,B as N,br as k}from"./index-BQPj88OW.js";import{C as v,b as y,c as B,a as C}from"./card-CzXDit7x.js";import{B as m}from"./badge-Bk-k6kyg.js";import{S as l}from"./skeleton-DLAS40-y.js";import{u as R,D as T,h as $,i as L,j as d}from"./Analytics-DIw7l2gi.js";import{e as D,T as M,f as S,h as o,i as c,j as A,k as a,g as P,S as G}from"./use-package-builds-Bx8rfxi1.js";import{G as H,f as j}from"./formatTimeAgo-CawXna5h.js";import{u as I}from"./useQueries-BJ7Ue7HV.js";import{G as E}from"./PackageBreadcrumb-DpOpPbGc.js";const U=({pkg:n})=>{const{data:r,isLoading:p}=D(n.package_id),u=R(),[,g]=b(),x=I((r||[]).filter(e=>e.latest_package_build_id).map(e=>({queryKey:["packageBuild",e.latest_package_build_id],queryFn:async()=>{if(!e.latest_package_build_id)return null;const{data:i}=await u.get("/package_builds/get",{params:{package_build_id:e.latest_package_build_id}});return i.package_build},enabled:!!e.latest_package_build_id,retry:!1,refetchOnWindowFocus:!1}))),_=p||x.some(e=>e.isLoading),h=new Map;return x.forEach((e,i)=>{e.data&&(r!=null&&r[i])&&h.set(r[i].package_release_id,e.data)}),s.jsx(s.Fragment,{children:s.jsx("div",{className:"space-y-6",children:s.jsxs(v,{children:[s.jsx(y,{children:s.jsx(B,{children:"Recent Releases"})}),s.jsx(C,{children:s.jsx("div",{className:"overflow-x-auto [&>div]:no-scrollbar",children:s.jsxs(M,{className:"no-scrollbar",children:[s.jsx(S,{children:s.jsxs(o,{children:[s.jsx(c,{children:"Status"}),s.jsx(c,{children:"Release ID"}),s.jsx(c,{children:"Version"}),s.jsx(c,{children:"Branch/PR"}),s.jsx(c,{children:"Latest Build"}),s.jsx(c,{children:"Created"}),s.jsx(c,{children:"Actions"})]})}),s.jsx(A,{children:_?Array.from({length:3}).map((e,i)=>s.jsxs(o,{children:[s.jsx(a,{children:s.jsx(l,{className:"h-6 w-20"})}),s.jsx(a,{children:s.jsx(l,{className:"h-6 w-16"})}),s.jsx(a,{children:s.jsx(l,{className:"h-6 w-12"})}),s.jsx(a,{children:s.jsx(l,{className:"h-6 w-32"})}),s.jsx(a,{children:s.jsx(l,{className:"h-6 w-20"})}),s.jsx(a,{children:s.jsx(l,{className:"h-6 w-16"})}),s.jsx(a,{children:s.jsx(l,{className:"h-6 w-8"})})]},i)):r==null?void 0:r.map(e=>{const i=h.get(e.package_release_id),{status:t,label:w}=P(i);return s.jsxs(o,{className:"cursor-pointer hover:bg-gray-50 no-scrollbar",onClick:()=>{g(`/${n.name}/releases/${e.package_release_id}`)},children:[s.jsx(a,{children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(G,{status:t}),s.jsx(m,{variant:t==="success"?"default":t==="error"?"destructive":"secondary",className:"text-xs",children:w})]})}),s.jsx(a,{children:s.jsx("code",{className:"text-sm bg-gray-100 px-2 py-1 rounded",children:e.package_release_id.slice(-8)})}),s.jsx(a,{children:s.jsx("span",{className:"text-sm font-medium",children:e.version||"v"+e.package_release_id.slice(-6)})}),s.jsx(a,{children:s.jsxs("div",{className:"flex items-center gap-2",children:[e.is_pr_preview?s.jsx(H,{className:"w-3 h-3 text-gray-500"}):s.jsx(E,{className:"w-3 h-3 text-gray-500"}),s.jsx(m,{variant:"outline",className:"text-xs",children:e.is_pr_preview?`#${e.github_pr_number}`:"main"})]})}),s.jsx(a,{children:s.jsx("div",{className:"max-w-xs",children:i?s.jsx("p",{className:"text-sm text-gray-600",children:j(i.created_at)}):s.jsx("p",{className:"text-sm text-gray-400",children:"No builds"})})}),s.jsx(a,{children:s.jsx("span",{className:"text-sm text-gray-600",children:j(e.created_at)})}),s.jsx(a,{children:s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(T,{children:[s.jsx($,{asChild:!0,children:s.jsx(N,{variant:"ghost",size:"sm",onClick:f=>f.stopPropagation(),children:s.jsx(k,{className:"w-3 h-3"})})}),s.jsxs(L,{align:"end",children:[s.jsx(d,{onClick:()=>{window.location.href=`/${n.name}/releases/${e.package_release_id}`},children:"View Release"}),t!=="error"&&s.jsx(d,{children:s.jsx("a",{href:`/${n.name}/releases/${i==null?void 0:i.package_release_id}/preview`,children:"Preview Release"})}),s.jsx(d,{onClick:()=>{window.location.href=`/${n.name}/releases/${e.package_release_id}/builds`},children:"View All Builds"})]})]})})})]},e.package_release_id)})})]})})})]})})})};export{U as B};