@tscircuit/fake-snippets 0.0.119 → 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 (153) hide show
  1. package/.github/workflows/bun-pver-release.yml +29 -4
  2. package/bun-tests/fake-snippets-api/routes/bug_reports/create.test.ts +37 -0
  3. package/bun-tests/fake-snippets-api/routes/bug_reports/upload_file.test.ts +89 -0
  4. package/bun.lock +2 -2
  5. package/dist/assets/404-CnNkOMw-.js +1 -0
  6. package/dist/assets/Analytics-DIw7l2gi.js +84 -0
  7. package/dist/assets/BuildsList-CeqVVhbz.js +1 -0
  8. package/dist/assets/CodeAndPreview-Dycd0s15.js +722 -0
  9. package/dist/assets/DownloadButtonAndMenu-OIUhbKkj.js +194 -0
  10. package/dist/assets/FileSaver.min-BDsOlqKl.js +1 -0
  11. package/dist/assets/Footer-DU-HdqGk.js +1 -0
  12. package/dist/assets/GithubAvatarWithFallback-CQhrBiKP.js +6 -0
  13. package/dist/assets/Header-CI4GZVOv.js +1 -0
  14. package/dist/assets/Header2-CrMDmo3P.js +5 -0
  15. package/dist/assets/NotFound-DaXtEPsC.js +1 -0
  16. package/dist/assets/OrganizationCard-Bs2dw-AL.js +1 -0
  17. package/dist/assets/PackageBreadcrumb-DpOpPbGc.js +6 -0
  18. package/dist/assets/PackageCard-ejE2dLlA.js +16 -0
  19. package/dist/assets/PackageSearchResults-BI3Rtmr2.js +1 -0
  20. package/dist/assets/ProfileRouter-4xNgtXr5.js +6 -0
  21. package/dist/assets/alert-dialog-DrOB4Tui.js +1 -0
  22. package/dist/assets/authorize-D-5R3QHA.js +16 -0
  23. package/dist/assets/badge-Bk-k6kyg.js +1 -0
  24. package/dist/assets/card-CzXDit7x.js +1 -0
  25. package/dist/assets/circle-alert-Du9-4of0.js +6 -0
  26. package/dist/assets/circle-check-big-KaRyRsht.js +6 -0
  27. package/dist/assets/cpu-BnvjzmIA.js +6 -0
  28. package/dist/assets/create-organization-BHNFvE7B.js +1 -0
  29. package/dist/assets/dashboard-DDH4V91X.js +11 -0
  30. package/dist/assets/datasheet-DqKtWt-O.js +1 -0
  31. package/dist/assets/datasheets-4W6pEMf3.js +1 -0
  32. package/dist/assets/dev-login-CbHdDthp.js +1 -0
  33. package/dist/assets/editor-bqg9Yv91.js +1 -0
  34. package/dist/assets/editor_example_1-1000w.webp +0 -0
  35. package/dist/assets/editor_example_1-1200w.webp +0 -0
  36. package/dist/assets/editor_example_1-1600w.webp +0 -0
  37. package/dist/assets/editor_example_1-2000w.webp +0 -0
  38. package/dist/assets/editor_example_1-400w.webp +0 -0
  39. package/dist/assets/editor_example_1-600w.webp +0 -0
  40. package/dist/assets/editor_example_1-800w.webp +0 -0
  41. package/dist/assets/editor_example_1_more_square-1000w.webp +0 -0
  42. package/dist/assets/editor_example_1_more_square-1200w.webp +0 -0
  43. package/dist/assets/editor_example_1_more_square-1600w.webp +0 -0
  44. package/dist/assets/editor_example_1_more_square-2000w.webp +0 -0
  45. package/dist/assets/editor_example_1_more_square-400w.webp +0 -0
  46. package/dist/assets/editor_example_1_more_square-600w.webp +0 -0
  47. package/dist/assets/editor_example_1_more_square-800w.webp +0 -0
  48. package/dist/assets/editor_example_2-1000w.webp +0 -0
  49. package/dist/assets/editor_example_2-1200w.webp +0 -0
  50. package/dist/assets/editor_example_2-1600w.webp +0 -0
  51. package/dist/assets/editor_example_2-2000w.webp +0 -0
  52. package/dist/assets/editor_example_2-400w.webp +0 -0
  53. package/dist/assets/editor_example_2-600w.webp +0 -0
  54. package/dist/assets/editor_example_2-800w.webp +0 -0
  55. package/dist/assets/example_schematic-1000w.webp +0 -0
  56. package/dist/assets/example_schematic-1200w.webp +0 -0
  57. package/dist/assets/example_schematic-1600w.webp +0 -0
  58. package/dist/assets/example_schematic-2000w.webp +0 -0
  59. package/dist/assets/example_schematic-400w.webp +0 -0
  60. package/dist/assets/example_schematic-600w.webp +0 -0
  61. package/dist/assets/example_schematic-800w.webp +0 -0
  62. package/dist/assets/eye-B_NMTTT7.js +6 -0
  63. package/dist/assets/fallback-image.svg +1 -0
  64. package/dist/assets/favicon-BwEjZKGP.ico +0 -0
  65. package/dist/assets/formatTimeAgo-CawXna5h.js +6 -0
  66. package/dist/assets/github-DjKGjbX1.js +6 -0
  67. package/dist/assets/github-dark-DHJKELXO.js +1 -0
  68. package/dist/assets/github-light-DAi9KRSo.js +1 -0
  69. package/dist/assets/hash-DfKYpqTm.js +6 -0
  70. package/dist/assets/index-B17tE1vy.js +1 -0
  71. package/dist/assets/index-BQPj88OW.js +6051 -0
  72. package/dist/assets/index-DvNLZBaq.js +6 -0
  73. package/dist/assets/keyboard-4b_qLHIF.js +11 -0
  74. package/dist/assets/label-CTudXc4q.js +1 -0
  75. package/dist/assets/landing-Cjvvx-9q.js +11 -0
  76. package/dist/assets/latest-DMk4BmXW.js +1 -0
  77. package/dist/assets/layers-BJ1iwaVM.js +6 -0
  78. package/dist/assets/load-prettier-DgbV1Jgu.js +1 -0
  79. package/dist/assets/lock-BOZRJdUv.js +6 -0
  80. package/dist/assets/main-DPEM9abA.js +26 -0
  81. package/dist/assets/main-MTKdI4FA.css +1 -0
  82. package/dist/assets/my-orders-B7lEyNR9.js +1 -0
  83. package/dist/assets/organization-settings-rNvhYFgZ.js +6 -0
  84. package/dist/assets/package-editor-T4WIRP49.js +1 -0
  85. package/dist/assets/pen-D54fxNRf.js +6 -0
  86. package/dist/assets/plus-KkE_6Dq2.js +6 -0
  87. package/dist/assets/preview-release-DWhKHFWp.js +1 -0
  88. package/dist/assets/quickstart-WF3HR9Dc.js +1 -0
  89. package/dist/assets/refresh-cw-aWASTRku.js +6 -0
  90. package/dist/assets/release-builds-COa5ndHa.js +1 -0
  91. package/dist/assets/release-detail-iclJPUO-.js +6 -0
  92. package/dist/assets/releases-Clsyp-7n.js +1 -0
  93. package/dist/assets/role-badge-BGF_IMlO.js +16 -0
  94. package/dist/assets/search-CwH23pAU.js +1 -0
  95. package/dist/assets/select-BN8AF1J7.js +1 -0
  96. package/dist/assets/settings-B2bMEtS4.js +6 -0
  97. package/dist/assets/skeleton-DLAS40-y.js +1 -0
  98. package/dist/assets/svg-to-png-BX4YEHCP-JcDm8Hc5.js +1 -0
  99. package/dist/assets/svg-to-png-BX4YEHCP-pNo9Afg8.js +1 -0
  100. package/dist/assets/tabs-Ce0NFuwd.js +1 -0
  101. package/dist/assets/timeAgo-VY0F2EV9.js +10 -0
  102. package/dist/assets/tooltip-C1pwvC0K.js +11 -0
  103. package/dist/assets/trash-2-BW3eClHz.js +6 -0
  104. package/dist/assets/trending-C8246HGf.js +1 -0
  105. package/dist/assets/triangle-alert-BMIBEO1D.js +6 -0
  106. package/dist/assets/tsx-COt5Ahok.js +1 -0
  107. package/dist/assets/use-create-datasheet-B7TDsTUt.js +1 -0
  108. package/dist/assets/use-delete-package-DLKtoTOj.js +1 -0
  109. package/dist/assets/use-download-zip-CAOKjGXW.js +1 -0
  110. package/dist/assets/use-list-user-orgs-CgJIT7N4.js +1 -0
  111. package/dist/assets/use-organization-XwYYTFck.js +1 -0
  112. package/dist/assets/use-package-builds-Bx8rfxi1.js +1 -0
  113. package/dist/assets/use-package-by-package-name-1s1Pcarw.js +1 -0
  114. package/dist/assets/use-package-files-CmmWVuGn.js +1 -0
  115. package/dist/assets/use-package-release-by-id-or-version-BuuXcSZq.js +1 -0
  116. package/dist/assets/use-package-release-images-BMaZtvmk.js +1 -0
  117. package/dist/assets/use-packages-base-api-url-DA1hucM7.js +1 -0
  118. package/dist/assets/useQueries-BJ7Ue7HV.js +1 -0
  119. package/dist/assets/user-settings-BqO5FkMf.js +1 -0
  120. package/dist/assets/view-package-C-OvJr_Q.js +165 -0
  121. package/dist/assets/vitesse-light-CVO1_9PV.js +1 -0
  122. package/dist/assets/wasm-CG6Dc4jp.js +1 -0
  123. package/dist/index.html +127 -0
  124. package/dist/landing.html +34 -0
  125. package/dist/robots.txt +9 -0
  126. package/dist/sitemap.xml +118 -0
  127. package/dist/stats.html +4949 -0
  128. package/fake-snippets-api/lib/db/db-client.ts +89 -0
  129. package/fake-snippets-api/lib/db/schema.ts +29 -0
  130. package/fake-snippets-api/routes/api/bug_reports/create.ts +43 -0
  131. package/fake-snippets-api/routes/api/bug_reports/upload_file.ts +113 -0
  132. package/package.json +2 -2
  133. package/src/components/Header.tsx +16 -0
  134. package/src/components/PackageCard.tsx +7 -4
  135. package/src/components/PackageSearchResults.tsx +1 -7
  136. package/src/components/SearchComponent.tsx +64 -53
  137. package/src/components/TrendingPackagesCarousel.tsx +16 -23
  138. package/src/components/ViewPackagePage/components/mobile-sidebar.tsx +3 -2
  139. package/src/components/ViewPackagePage/components/preview-image-squares.tsx +6 -3
  140. package/src/hooks/use-preview-images.ts +22 -17
  141. package/src/hooks/useUpdatePackageFilesMutation.ts +8 -0
  142. package/src/lib/utils/getPackagePreviewImageUrl.ts +15 -0
  143. package/src/pages/dashboard.tsx +0 -1
  144. package/src/pages/editor.tsx +12 -9
  145. package/src/pages/organization-profile.tsx +0 -1
  146. package/src/pages/package-editor.tsx +13 -9
  147. package/src/pages/user-profile.tsx +0 -1
  148. package/dist/bundle.js +0 -9034
  149. package/dist/index.d.ts +0 -2065
  150. package/dist/index.js +0 -3737
  151. package/dist/schema.d.ts +0 -2972
  152. package/dist/schema.js +0 -426
  153. package/fake-snippets-api/bun.lockb +0 -0
@@ -0,0 +1,165 @@
1
+ import{k as xe,b as E,j as c,R as si,B as X,E as pn,H as Xs,h as gn,I as Zs,J as rt,w as xn,K as ie,n as ge,q as Ks,N as ea,O as ai,U as ta,V as na,W as li,X as ra,Y as ia,Z as oi,$ as sa,a0 as aa,a1 as la,m as bn,a2 as oa,s as lt,v as $e,a3 as Xn,a4 as Zn,a5 as Kn,a6 as er,a7 as tr,a8 as ua,a9 as ca,u as pe,l as Me,L as nn,g as ui,aa as rn,ab as nr,ac as ha,ad as da,ae as fa,af as ma,ag as pa,P as rr}from"./index-BQPj88OW.js";import{D as yn,h as wn,i as kn,j as yt,C as ci,P as ga,k as xa,l as Ue,u as Pe,m as ba,I as ir,S as wt,n as ya,o as ht,a as wa}from"./Analytics-DIw7l2gi.js";import{T as kt,a as _t,b as Nt,c as St,P as ka,E as _a}from"./tooltip-C1pwvC0K.js";import{a as hi,D as Na,C as vt,G as it,b as Sa,u as _n,T as di,c as fi,s as Nn,h as va,w as ja,f as Ca,d as Ea,e as Aa,g as sr,i as Ta}from"./DownloadButtonAndMenu-OIUhbKkj.js";import{u as mi,a as Sn,b as pi,i as ar}from"./use-package-files-CmmWVuGn.js";import{u as Pa}from"./use-download-zip-CAOKjGXW.js";import{B as gi}from"./badge-Bk-k6kyg.js";import{S as $}from"./skeleton-DLAS40-y.js";import{c as La,b as Da,g as Ra,S as Ia}from"./use-package-builds-Bx8rfxi1.js";import{S as Ft,a as Ot,b as zt,c as Mt,d as de}from"./select-BN8AF1J7.js";import{L as Se}from"./label-CTudXc4q.js";import{u as Fa}from"./use-delete-package-DLKtoTOj.js";import{u as Oa}from"./use-packages-base-api-url-DA1hucM7.js";import{R as za}from"./refresh-cw-aWASTRku.js";import{P as xi}from"./plus-KkE_6Dq2.js";import{S as bi}from"./settings-B2bMEtS4.js";import{G as lr}from"./github-DjKGjbX1.js";import{t as Ma,G as Ba}from"./timeAgo-VY0F2EV9.js";import{C as $a}from"./circle-check-big-KaRyRsht.js";import{u as Ha}from"./use-package-release-images-BMaZtvmk.js";import{u as Va}from"./use-organization-XwYYTFck.js";import{H as Ua}from"./Header-CI4GZVOv.js";import{F as qa}from"./Footer-DU-HdqGk.js";import{u as yi}from"./use-package-by-package-name-1s1Pcarw.js";import{L as Wa}from"./lock-BOZRJdUv.js";import{H as Ga}from"./main-DPEM9abA.js";import{NotFoundPage as or}from"./404-CnNkOMw-.js";import"./FileSaver.min-BDsOlqKl.js";import"./card-CzXDit7x.js";import"./circle-alert-Du9-4of0.js";import"./useQueries-BJ7Ue7HV.js";import"./Header2-CrMDmo3P.js";import"./NotFound-DaXtEPsC.js";/**
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 Ya=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Qa=xe("circle-x",Ya);/**
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 Ja=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],Xa=xe("clipboard-list",Ja);/**
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 Za=[["path",{d:"m12 15 2 2 4-4",key:"2c609p"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ka=xe("copy-check",Za);/**
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 el=[["path",{d:"m21.12 6.4-6.05-4.06a2 2 0 0 0-2.17-.05L2.95 8.41a2 2 0 0 0-.95 1.7v5.82a2 2 0 0 0 .88 1.66l6.05 4.07a2 2 0 0 0 2.17.05l9.95-6.12a2 2 0 0 0 .95-1.7V8.06a2 2 0 0 0-.88-1.66Z",key:"1u2ovd"}],["path",{d:"M10 22v-8L2.25 9.15",key:"11pn4q"}],["path",{d:"m10 14 11.77-6.87",key:"1kt1wh"}]],tl=xe("cuboid",el);/**
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 nl=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]],rl=xe("file-terminal",nl);/**
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 il=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]],sl=xe("hourglass",il);/**
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 al=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],wi=xe("link",al);/**
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 ll=[["path",{d:"M5 12h14",key:"1ays0h"}]],ol=xe("minus",ll);/**
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 ul=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],ur=xe("refresh-ccw",ul);/**
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 cl=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],hl=xe("square-pen",cl),Be=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ve=globalThis,Ze="10.17.0";function ki(){return vn(ve),ve}function vn(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Ze,t[Ze]=t[Ze]||{}}function jn(e,t,n=ve){const r=n.__SENTRY__=n.__SENTRY__||{},i=r[Ze]=r[Ze]||{};return i[e]||(i[e]=t())}const dl="Sentry Logger ",cr={};function fl(e){if(!("console"in ve))return e();const t=ve.console,n={},r=Object.keys(cr);r.forEach(i=>{const a=cr[i];n[i]=t[i],t[i]=a});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function ml(){En().enabled=!0}function pl(){En().enabled=!1}function _i(){return En().enabled}function gl(...e){Cn("log",...e)}function xl(...e){Cn("warn",...e)}function bl(...e){Cn("error",...e)}function Cn(e,...t){Be&&_i()&&fl(()=>{ve.console[e](`${dl}[${e}]:`,...t)})}function En(){return Be?jn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const xt={enable:ml,disable:pl,isEnabled:_i,log:gl,warn:xl,error:bl},yl=Object.prototype.toString;function wl(e,t){return yl.call(e)===`[object ${t}]`}function kl(e){return wl(e,"Object")}function _l(e){return!!(e!=null&&e.then&&typeof e.then=="function")}function Nl(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Sl(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Be&&xt.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function vl(){const e=ve;return e.crypto||e.msCrypto}function Ke(e=vl()){let t=()=>Math.random()*16;try{if(e!=null&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e!=null&&e.getRandomValues&&(t=()=>{const n=new Uint8Array(1);return e.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(t()&15)>>n/4).toString(16))}const Ni=1e3;function Si(){return Date.now()/Ni}function jl(){const{performance:e}=ve;if(!(e!=null&&e.now)||!e.timeOrigin)return Si;const t=e.timeOrigin;return()=>(t+e.now())/Ni}let hr;function Cl(){return(hr??(hr=jl()))()}function El(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Cl(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:Ke()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function vi(e,t,n=2){if(!t||typeof t!="object"||n<=0)return t;if(e&&Object.keys(t).length===0)return e;const r={...e};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=vi(r[i],t[i],n-1));return r}function dr(){return Ke()}const sn="_sentrySpan";function fr(e,t){t?Sl(e,sn,t):delete e[sn]}function mr(e){return e[sn]}const Al=100;class Ae{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:dr(),sampleRand:Math.random()}}clone(){const t=new Ae;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,fr(t,mr(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&El(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n=typeof t=="function"?t(this):t,r=n instanceof Ae?n.getScopeData():kl(n)?t:void 0,{tags:i,extra:a,user:s,contexts:l,level:o,fingerprint:u=[],propagationContext:d}=r||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...l},s&&Object.keys(s).length&&(this._user=s),o&&(this._level=o),u.length&&(this._fingerprint=u),d&&(this._propagationContext=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,fr(this,void 0),this._attachments=[],this.setPropagationContext({traceId:dr(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){var a;const r=typeof n=="number"?n:Al;if(r<=0)return this;const i={timestamp:Si(),...t,message:t.message?Nl(t.message,2048):t.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(a=this._client)==null||a.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:mr(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=vi(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const r=(n==null?void 0:n.event_id)||Ke();if(!this._client)return Be&&xt.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureMessage(t,n,r){const i=(r==null?void 0:r.event_id)||Ke();if(!this._client)return Be&&xt.warn("No client configured on scope - will not capture message!"),i;const a=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:a,...r,event_id:i},this),i}captureEvent(t,n){const r=(n==null?void 0:n.event_id)||Ke();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(Be&&xt.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function Tl(){return jn("defaultCurrentScope",()=>new Ae)}function Pl(){return jn("defaultIsolationScope",()=>new Ae)}class Ll{constructor(t,n){let r;t?r=t:r=new Ae;let i;n?i=n:i=new Ae,this._stack=[{scope:r}],this._isolationScope=i}withScope(t){const n=this._pushScope();let r;try{r=t(n)}catch(i){throw this._popScope(),i}return _l(r)?r.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function He(){const e=ki(),t=vn(e);return t.stack=t.stack||new Ll(Tl(),Pl())}function Dl(e){return He().withScope(e)}function Rl(e,t){const n=He();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function pr(e){return He().withScope(()=>e(He().getIsolationScope()))}function Il(){return{withIsolationScope:pr,withScope:Dl,withSetScope:Rl,withSetIsolationScope:(e,t)=>pr(t),getCurrentScope:()=>He().getScope(),getIsolationScope:()=>He().getIsolationScope()}}function Fl(e){const t=vn(e);return t.acs?t.acs:Il()}function Ol(){const e=ki();return Fl(e).getCurrentScope()}function zl(e,t){const n=typeof t=="string"?t:void 0,r=typeof t!="string"?{captureContext:t}:void 0;return Ol().captureMessage(e,n,r)}const Ml={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};function Le(){const{packageId:e}=hi(),[t,n]=E.useState(null),[r,i]=E.useState(!0),[a,s]=E.useState(null),{data:l,isError:o}=mi(e?{package_id:e,file_path:"dist/circuit.json"}:null,{cacheTime:6e4*2,staleTime:6e4*2});return E.useEffect(()=>{if(i(!0),s(null),l)try{const u=JSON.parse(l.content_text);n(u),i(!1)}catch{s("Invalid circuit.json format"),i(!1)}else o&&(s("Circuit JSON not found in package"),i(!1))},[l,o]),{circuitJson:t,isLoading:r,error:a}}function Bl({activeView:e,onViewChange:t}){var i,a;const{circuitJson:n}=Le(),r=[{id:"files",label:"Files",icon:c.jsx(pn,{className:"h-4 w-4 mr-1"}),requiresCircuitJson:!1},{id:"3d",label:"3D",icon:c.jsx(tl,{className:"h-4 w-4 mr-1"}),requiresCircuitJson:!0},{id:"pcb",label:"PCB",icon:c.jsx(Xs,{className:"h-4 w-4 mr-1"}),requiresCircuitJson:!0},{id:"schematic",label:"Schematic",icon:c.jsx(rl,{className:"h-4 w-4 mr-1"}),requiresCircuitJson:!0},{id:"bom",label:"BOM",icon:c.jsx(Xa,{className:"h-4 w-4 mr-1"}),requiresCircuitJson:!0}];return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"bg-gray-100 dark:bg-[#161b22] rounded-md p-1 hidden lg:flex",children:c.jsx(kt,{children:r.map(s=>{const l=!n&&s.requiresCircuitJson;return c.jsxs(_t,{children:[c.jsx(Nt,{asChild:!0,children:c.jsxs("button",{className:`px-4 py-1.5 rounded-md text-sm font-medium transition-colors flex items-center ${e===s.id&&!l?"bg-white dark:bg-[#0d1117] text-gray-800 dark:text-white":l?"text-gray-400 dark:text-gray-600 cursor-not-allowed":"text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-white"}`,onClick:()=>!l&&t(s.id),disabled:l,children:[si.cloneElement(s.icon,{className:"h-4 w-4 mr-1"}),s.label]})}),l&&c.jsx(St,{children:c.jsx("p",{children:"Circuit JSON not available"})})]},s.id)})})}),c.jsx("div",{className:"lg:hidden",children:c.jsxs(yn,{children:[c.jsx(wn,{asChild:!0,children:c.jsxs(X,{variant:"outline",size:"sm",className:"h-9 border-gray-300 dark:border-[#30363d] bg-gray-100 hover:bg-gray-200 dark:bg-[#21262d] dark:hover:bg-[#30363d] text-gray-700 dark:text-[#c9d1d9]",children:[(i=r.find(s=>s.id===e))==null?void 0:i.icon,((a=r.find(s=>s.id===e))==null?void 0:a.label)||"View",c.jsx("svg",{className:"h-4 w-4 ml-1",fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("path",{d:"m6 9 6 6 6-6"})})]})}),c.jsx(kn,{align:"start",className:"z-[101]",children:c.jsx(kt,{children:r.map(s=>{const l=!n&&s.requiresCircuitJson;return c.jsxs(_t,{children:[c.jsx(Nt,{asChild:!0,children:c.jsxs(yt,{onClick:()=>!l&&t(s.id),className:`flex items-center ${l?"text-gray-400 dark:text-gray-600 cursor-not-allowed":"cursor-pointer"}`,disabled:l,children:[s.icon,s.label]})}),l&&c.jsx(St,{children:c.jsx("p",{children:"Circuit JSON not available"})})]},s.id)})})})]})})]})}function $l({packageFiles:e,activeView:t,onViewChange:n,packageInfo:r}){gn();const[i,a]=E.useState("copy"),[s,l]=E.useState("copy"),o=()=>{const g=`tsci add ${(r==null?void 0:r.name)||"@tscircuit/keyboard-default60"}`;navigator.clipboard.writeText(g),a("copied"),setTimeout(()=>a("copy"),2e3)},u=()=>{const g=`tsci clone ${(r==null?void 0:r.name)||"@tscircuit/keyboard-default60"}`;navigator.clipboard.writeText(g),l("copied"),setTimeout(()=>l("copy"),2e3)},{downloadZip:d}=Pa(),{toastLibrary:h}=Ue(),m=()=>{r&&e&&h.promise(d(r,e),{loading:"Downloading ZIP...",success:"ZIP downloaded successfully!",error:"Failed to download ZIP"})},{circuitJson:f}=Le();return c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx(Bl,{activeView:t,onViewChange:n}),c.jsxs("div",{className:"flex space-x-2",children:[c.jsx(Na,{unscopedName:r==null?void 0:r.unscoped_name,desiredImageType:t,author:(r==null?void 0:r.owner_github_username)??void 0,circuitJson:f}),c.jsxs(yn,{children:[c.jsx(wn,{asChild:!0,children:c.jsxs(X,{size:"sm",className:"bg-green-600 hover:bg-green-700 dark:bg-[#238636] dark:hover:bg-[#2ea043] text-white",children:[c.jsx(pn,{className:"h-4 w-4 mr-1.5"}),"Code",c.jsx(ci,{className:"h-4 w-4 ml-0.5"})]})}),c.jsxs(kn,{align:"end",className:"w-72 relative z-[101]",children:[c.jsx(yt,{disabled:!r,asChild:!0,children:c.jsxs("a",{href:`/editor?package_id=${r==null?void 0:r.package_id}`,className:"cursor-pointer px-2 py-3",children:[c.jsx(ka,{className:"h-4 w-4 mx-3"}),"Edit Online"]})}),c.jsxs(yt,{disabled:!r,onClick:m,className:"cursor-pointer px-2 py-3",children:[c.jsx(ga,{className:"h-4 w-4 mx-3"}),"Download ZIP"]}),c.jsx(xa,{}),c.jsxs("div",{className:"p-2",children:[c.jsxs("div",{className:"text-sm font-medium mb-4 flex items-center",children:[c.jsx(Zs,{className:"h-4 w-4 inline-block mr-1.5"}),"Install"]}),c.jsxs("div",{className:"flex items-center bg-gray-100 dark:bg-[#161b22] rounded-md p-2 text-xs font-mono",children:[c.jsxs("code",{className:"flex-1 overflow-x-auto",children:["tsci add"," ",(r==null?void 0:r.name)||"@tscircuit/keyboard-default60"]}),c.jsx("button",{className:"ml-2 p-1 hover:bg-gray-200 dark:hover:bg-[#30363d] rounded",onClick:o,children:i==="copy"?c.jsx(vt,{className:"h-4 w-4"}):c.jsx(rt,{className:"h-4 w-4 text-green-500"})})]})]}),c.jsxs("div",{className:"p-2",children:[c.jsxs("div",{className:"text-sm font-medium mb-4 flex items-center",children:[c.jsx(it,{className:"h-4 w-4 inline-block mr-1.5"}),"Clone"]}),c.jsxs("div",{className:"flex items-center bg-gray-100 dark:bg-[#161b22] rounded-md p-2 text-xs font-mono",children:[c.jsxs("code",{className:"flex-1 overflow-x-auto",children:["tsci clone"," ",(r==null?void 0:r.name)||"@tscircuit/keyboard-default60"]}),c.jsx("button",{className:"ml-2 p-1 hover:bg-gray-200 dark:hover:bg-[#30363d] rounded",onClick:u,children:s==="copy"?c.jsx(vt,{className:"h-4 w-4"}):c.jsx(rt,{className:"h-4 w-4 text-green-500"})})]})]})]})]})]})]})}const An=e=>{const{packageId:t}=hi(),n=Sa(),{author:r,packageName:i}=xn(),a=n.version,s=n.package_release_id;let l=null;r&&i&&!a&&!s?l={package_name:`${r}/${i}`,is_latest:!0}:s?l={package_release_id:s}:a&&r&&i?l={package_name_with_version:`${r}/${i}@${a}`}:t&&(l={package_id:t,is_latest:!0}),l&&(e==null?void 0:e.include_logs)!==void 0&&(l.include_logs=e.include_logs),l&&(e==null?void 0:e.include_ai_review)!==void 0&&(l.include_ai_review=e.include_ai_review);const{data:o,...u}=La(l,{refetchInterval:e==null?void 0:e.refetchInterval});return{packageRelease:o,...u}},Hl=e=>{if(!e)return!0;try{return new URL(e),!0}catch{return!1}},Vl=({initialDescription:e,initialWebsite:t,initialLicense:n,initialVisibility:r,initialDefaultView:i,initialUnscopedPackageName:a,initialGithubRepoFullName:s,isDialogOpen:l,initialAllowPrPreviews:o})=>{const[u,d]=E.useState({description:e,website:t,license:n||null,visibility:r,defaultView:i,githubRepoFullName:s,unscopedPackageName:a}),[h,m]=E.useState(null);E.useEffect(()=>{l&&(d({description:e,website:t,license:n||null,visibility:r,githubRepoFullName:s,defaultView:i,unscopedPackageName:a,allowPrPreviews:o}),m(null))},[l,e,t,n,r,i,a]),E.useEffect(()=>{u.website&&!Hl(u.website)?m("Please enter a valid URL (e.g., https://tscircuit.com)"):m(null)},[u.website]);const f=E.useMemo(()=>u.license!==n,[u.license,n]),g=E.useMemo(()=>u.visibility!==r,[u.visibility,r]),w=E.useMemo(()=>u.defaultView!==i,[u.defaultView,i]),S=E.useMemo(()=>u.allowPrPreviews!==o,[u.allowPrPreviews,o]),x=E.useMemo(()=>u.description!==e||u.website!==t||u.license!==n||u.visibility!==r||u.defaultView!==i||u.githubRepoFullName!==s||u.unscopedPackageName!==a||u.allowPrPreviews!==o,[u,e,t,n,r,i,s,a,o]),N=E.useMemo(()=>!h,[h]);return{formData:u,setFormData:d,websiteError:h,hasLicenseChanged:f,hasVisibilityChanged:g,hasDefaultViewChanged:w,hasAllowPrPreviewsChanged:S,hasChanges:x,isFormValid:N}},Ul=(e,t)=>{const n=new Date().getFullYear(),r=t??"";switch(e){case"MIT":return`MIT License
52
+
53
+ Copyright (c) ${n} ${r}
54
+
55
+ Permission is hereby granted, free of charge, to any person obtaining a copy
56
+ of this software and associated documentation files (the "Software"), to deal
57
+ in the Software without restriction, including without limitation the rights
58
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
59
+ copies of the Software, and to permit persons to whom the Software is
60
+ furnished to do so, subject to the following conditions:
61
+
62
+ The above copyright notice and this permission notice shall be included in all
63
+ copies or substantial portions of the Software.
64
+
65
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
66
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
67
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
68
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
69
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
70
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
71
+ SOFTWARE.`;case"Apache-2.0":return` Apache License
72
+ Version 2.0, January 2004
73
+ http://www.apache.org/licenses/
74
+
75
+ Copyright ${n} ${r}
76
+
77
+ Licensed under the Apache License, Version 2.0 (the "License");
78
+ you may not use this file except in compliance with the License.
79
+ You may obtain a copy of the License at
80
+
81
+ http://www.apache.org/licenses/LICENSE-2.0
82
+
83
+ Unless required by applicable law or agreed to in writing, software
84
+ distributed under the License is distributed on an "AS IS" BASIS,
85
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
86
+ See the License for the specific language governing permissions and
87
+ limitations under the License.`;case"BSD-3-Clause":return`BSD 3-Clause License
88
+
89
+ Copyright (c) ${n}, ${r}
90
+ All rights reserved.
91
+
92
+ Redistribution and use in source and binary forms, with or without
93
+ modification, are permitted provided that the following conditions are met:
94
+
95
+ 1. Redistributions of source code must retain the above copyright notice, this
96
+ list of conditions and the following disclaimer.
97
+
98
+ 2. Redistributions in binary form must reproduce the above copyright notice,
99
+ this list of conditions and the following disclaimer in the documentation
100
+ and/or other materials provided with the distribution.
101
+
102
+ 3. Neither the name of the copyright holder nor the names of its
103
+ contributors may be used to endorse or promote products derived from
104
+ this software without specific prior written permission.
105
+
106
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
107
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
108
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
109
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
110
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
111
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
112
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
113
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
114
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
115
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.`;case"GPL-3.0":return` GNU GENERAL PUBLIC LICENSE
116
+ Version 3, 29 June 2007
117
+
118
+ Copyright (C) ${n} ${r}
119
+
120
+ This program is free software: you can redistribute it and/or modify
121
+ it under the terms of the GNU General Public License as published by
122
+ the Free Software Foundation, either version 3 of the License, or
123
+ (at your option) any later version.
124
+
125
+ This program is distributed in the hope that it will be useful,
126
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
127
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
128
+ GNU General Public License for more details.
129
+
130
+ You should have received a copy of the GNU General Public License
131
+ along with this program. If not, see <http://www.gnu.org/licenses/>.`;default:return""}},ji=E.forwardRef(({className:e,...t},n)=>c.jsx(ie,{ref:n,className:ge("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));ji.displayName=ie.displayName;const Ci=E.forwardRef(({className:e,...t},n)=>c.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[c.jsx(Ks,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),c.jsx(ie.Input,{ref:n,className:ge("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Ci.displayName=ie.Input.displayName;const Ei=E.forwardRef(({className:e,...t},n)=>c.jsx(ie.List,{ref:n,className:ge("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Ei.displayName=ie.List.displayName;const Ai=E.forwardRef((e,t)=>c.jsx(ie.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Ai.displayName=ie.Empty.displayName;const Ti=E.forwardRef(({className:e,...t},n)=>c.jsx(ie.Group,{ref:n,className:ge("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Ti.displayName=ie.Group.displayName;const ql=E.forwardRef(({className:e,...t},n)=>c.jsx(ie.Separator,{ref:n,className:ge("-mx-1 h-px bg-border",e),...t}));ql.displayName=ie.Separator.displayName;const Pi=E.forwardRef(({className:e,...t},n)=>c.jsx(ie.Item,{ref:n,className:ge("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Pi.displayName=ie.Item.displayName;const Wl=ta,Gl=na,Li=E.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>c.jsx(ea,{children:c.jsx(ai,{ref:i,align:t,sideOffset:n,className:ge("z-50 w-72 rounded-md border border-slate-200 bg-white p-4 text-slate-950 shadow-md outline-none 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",e),...r})}));Li.displayName=ai.displayName;var Tt="Switch",[Yl]=ia(Tt),[Ql,Jl]=Yl(Tt),Di=E.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:s,disabled:l,value:o="on",onCheckedChange:u,form:d,...h}=e,[m,f]=E.useState(null),g=li(t,_=>f(_)),w=E.useRef(!1),S=m?d||!!m.closest("form"):!0,[x,N]=ra({prop:i,defaultProp:a??!1,onChange:u,caller:Tt});return c.jsxs(Ql,{scope:n,checked:x,disabled:l,children:[c.jsx(oi.button,{type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":Oi(x),"data-disabled":l?"":void 0,disabled:l,value:o,...h,ref:g,onClick:sa(e.onClick,_=>{N(T=>!T),S&&(w.current=_.isPropagationStopped(),w.current||_.stopPropagation())})}),S&&c.jsx(Fi,{control:m,bubbles:!w.current,name:r,value:o,checked:x,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});Di.displayName=Tt;var Ri="SwitchThumb",Ii=E.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=Jl(Ri,n);return c.jsx(oi.span,{"data-state":Oi(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});Ii.displayName=Ri;var Xl="SwitchBubbleInput",Fi=E.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{const s=E.useRef(null),l=li(s,a),o=aa(n),u=la(t);return E.useEffect(()=>{const d=s.current;if(!d)return;const h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(o!==n&&f){const g=new Event("click",{bubbles:r});f.call(d,n),d.dispatchEvent(g)}},[o,n,r]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Fi.displayName=Xl;function Oi(e){return e?"checked":"unchecked"}var zi=Di,Zl=Ii;const Mi=E.forwardRef(({className:e,...t},n)=>c.jsx(zi,{className:ge("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus-visible:ring-slate-300 dark:focus-visible:ring-offset-slate-950 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",e),...t,ref:n,children:c.jsx(Zl,{className:ge("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:bg-slate-950")})}));Mi.displayName=zi.displayName;const Kl=({selectedRepository:e,setSelectedRepository:t,disabled:n=!1,open:r=!1,addFormContent:i,formData:a})=>{var R,B,z,y,P,L;const s=Pe(),l=Oa(),o=E.useRef(e).current,[u,d]=E.useState(!1),[h,m]=E.useState(""),{data:f,error:g,refetch:w,isLoading:S}=bn(["github-repositories"],async()=>(await s.get("/github/repos/list_available")).data,{enabled:r,retry:!1}),x=async()=>{window.location.href=`${l}/github/installations/create_new_installation_redirect?return_to_page=${window.location.pathname}`},N=async()=>{try{await s.post("/github/repos/refresh"),w()}catch(j){console.error("Failed to refresh repositories:",j),w()}},_=E.useMemo(()=>{const C=((f==null?void 0:f.repos)||[]).map(H=>({value:H.full_name,label:H.unscoped_name,isPrivate:H.private,type:"repo"})),D=[{value:"connect-more",label:"Connect More Repos",type:"special",icon:"plus"},...o?[{value:"unlink//repo",label:"Unlink Repo",type:"special",icon:"minus"}]:[]];return[...C,...D]},[f==null?void 0:f.repos,o]),T=E.useMemo(()=>h?_.filter(j=>j.label.toLowerCase().includes(h.toLowerCase())||j.value.toLowerCase().includes(h.toLowerCase())):_,[_,h]),I=j=>{j==="connect-more"?x():t==null||t(j),d(!1),m("")},k=()=>{if(!e)return"Select a repository";const j=_.find(C=>C.value===e);return(j==null?void 0:j.label)||e};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-1 mb-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(Se,{htmlFor:"repository",children:"GitHub Repository"}),!(((R=g==null?void 0:g.response)==null?void 0:R.status)===400&&((z=(B=g==null?void 0:g.response)==null?void 0:B.data)==null?void 0:z.error_code)==="github_not_connected")&&c.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:N,disabled:n||S,className:"h-auto p-1",children:c.jsx(za,{className:`w-3 h-3 ${S?"animate-spin":""}`})})]}),((y=g==null?void 0:g.response)==null?void 0:y.status)===400&&((L=(P=g==null?void 0:g.response)==null?void 0:P.data)==null?void 0:L.error_code)==="github_not_connected"?c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-sm text-muted-foreground",children:"Connect your GitHub account to link this package to a repository."}),c.jsxs(X,{type:"button",variant:"outline",onClick:x,className:"w-full",disabled:n,children:[c.jsx("svg",{className:"w-4 h-4 mr-2",viewBox:"0 0 24 24",fill:"currentColor",children:c.jsx("path",{d:"M12 0C5.374 0 0 5.373 0 12 0 17.302 3.438 21.8 8.207 23.387c.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"})}),"Connect GitHub Account"]})]}):c.jsx("div",{className:"space-y-2",children:c.jsxs(Wl,{open:u,onOpenChange:d,children:[c.jsx(Gl,{asChild:!0,children:c.jsxs(X,{variant:"outline",role:"combobox","aria-expanded":u,className:"w-full justify-between",disabled:n,children:[k(),c.jsx(oa,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),c.jsx(Li,{className:"w-[var(--radix-popover-trigger-width)] p-0 z-[999]",align:"start",children:c.jsxs(ji,{shouldFilter:!1,children:[c.jsx(Ci,{value:h,onValueChange:m,placeholder:"Search repositories..."}),c.jsxs(Ei,{className:"max-h-[400px] overflow-y-auto",children:[c.jsx(Ai,{className:"text-sm text-slate-500 py-6 pl-4",children:"No repositories found."}),c.jsx(Ti,{children:T.map(j=>c.jsx(Pi,{value:j.value,onSelect:()=>I(j.value),className:"cursor-pointer hover:bg-slate-100",children:c.jsx("div",{className:"flex items-center space-x-2 w-full",children:j.type==="repo"?c.jsxs(c.Fragment,{children:[c.jsx(rt,{className:ge("mr-2 h-4 w-4",e===j.value?"opacity-100":"opacity-0")}),c.jsx("span",{children:j.label}),j.isPrivate&&c.jsx("span",{className:"text-xs text-muted-foreground",children:"(private)"})]}):c.jsxs(c.Fragment,{children:[j.icon==="plus"?c.jsx(xi,{className:"w-3 h-3 text-blue-600"}):c.jsx(ol,{className:"w-3 h-3 text-red-600"}),c.jsx("span",{className:j.icon==="plus"?"text-blue-600":"text-red-600",children:j.label})]})})},j.value))})]})]})})]})})]}),o&&e!=="unlink//repo"&&c.jsx("div",{className:"space-y-4 mt-4 p-4 border rounded-lg bg-gray-50",children:c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"space-y-0.5",children:[c.jsx(Se,{className:"text-sm font-medium",children:"Enable PR Preview"}),c.jsx("p",{className:"text-xs text-gray-500",children:"Generate preview builds for pull requests"})]}),c.jsx(Mi,{checked:a==null?void 0:a.allowPrPreviews,onCheckedChange:j=>i==null?void 0:i({allowPrPreviews:j}),disabled:n})]})})]})},eo=({open:e,onOpenChange:t,packageId:n,currentDescription:r,currentWebsite:i,currentLicense:a,currentDefaultView:s="files",currentGithubRepoFullName:l,isPrivate:o=!1,unscopedPackageName:u,packageReleaseId:d,packageAuthor:h,currentAllowPrPreviews:m,onUpdate:f})=>{const g=Pe(),{toast:w}=Ue(),S=lt(),{formData:x,setFormData:N,websiteError:_,hasLicenseChanged:T,hasChanges:I,isFormValid:k}=Vl({initialDescription:r,initialGithubRepoFullName:l??null,initialWebsite:i,initialLicense:a||null,initialDefaultView:s,initialUnscopedPackageName:u,isDialogOpen:e,initialVisibility:o?"private":"public",initialAllowPrPreviews:m}),[R,B]=E.useState(!1),[z,y]=E.useState(!1),[,P]=gn(),L=Fa({onSuccess:async()=>{await S.invalidateQueries(["packages"]),t(!1),P("/dashboard")}}),j=$e({mutationFn:async()=>{if(!k)throw new Error("Please fix the form errors before submitting");if(T&&await g.post("/package_releases/update",{package_id:n,package_release_id:d,license:x.license??"unset"}),(await g.post("/packages/update",{package_id:n,description:x.description.trim(),website:x.website.trim(),is_private:x.visibility=="private",default_view:x.defaultView,allow_pr_previews:x.allowPrPreviews,github_repo_full_name:x.githubRepoFullName==="unlink//repo"?null:x.githubRepoFullName,...x.unscopedPackageName!==u&&{name:x.unscopedPackageName.trim()}})).status!==200)throw new Error("Failed to update package details");const D=await g.get("/package_files/list",{params:{package_name_with_version:`${h}/${x.unscopedPackageName}`}}),H=D.status===200?D.data.package_files.map(J=>J.file_path):[],Y=Ul(x.license??"",h);return T&&(H.includes("LICENSE")&&!Y&&await g.post("/package_files/delete",{package_name_with_version:`${h}/${x.unscopedPackageName}`,file_path:"LICENSE"}),Y&&await g.post("/package_files/create_or_update",{package_name_with_version:`${h}/${x.unscopedPackageName}`,file_path:"LICENSE",content_text:Y})),x.unscopedPackageName!==u&&window.history.replaceState({},"",`/${h}/${x.unscopedPackageName}`),{description:x.description,website:x.website,license:x.license,visibility:x.visibility,defaultView:x.defaultView}},onMutate:async()=>{await S.cancelQueries(["packages",n]);const C=S.getQueryData(["packages",n]);return S.setQueryData(["packages",n],D=>({...D,description:x.description,website:x.website,license:x.license,is_private:x.visibility=="private",default_view:x.defaultView})),{previous:C}},onSuccess:C=>{f==null||f(C.description,C.website,C.license,C.defaultView),t(!1),S.invalidateQueries("packageFile"),S.invalidateQueries(["packageFiles",d]),w({title:"Package details updated",description:"Successfully updated package details"})},onError:(C,D,H)=>{var Y,J;S.setQueryData(["packages",n],H==null?void 0:H.previous),w({title:"Error",description:((J=(Y=C==null?void 0:C.data)==null?void 0:Y.error)==null?void 0:J.message)||"Failed to update package details. Please try again.",variant:"destructive"})},onSettled:()=>S.invalidateQueries(["packages",n])});return c.jsxs("div",{children:[c.jsx(Xn,{open:R,onOpenChange:B,children:c.jsxs(Zn,{className:"w-[90vw] p-6 rounded-2xl shadow-lg",children:[c.jsxs(Kn,{children:[c.jsx(er,{className:"text-left",children:"Confirm Deletion"}),c.jsx(tr,{className:"text-left",children:"Are you sure you want to delete this package? This action cannot be undone."})]}),c.jsxs("div",{className:"flex justify-end gap-4 mt-6",children:[c.jsx(X,{variant:"outline",onClick:()=>B(!1),disabled:L.isLoading,children:"Cancel"}),c.jsx(X,{variant:"destructive",onClick:()=>{L.mutate({package_id:n})},disabled:L.isLoading,children:L.isLoading?"Deleting...":"Delete"})]})]})}),c.jsx(Xn,{open:e!==R,onOpenChange:t,children:c.jsxs(Zn,{className:"sm:max-w-[500px] lg:h-[85vh] sm:h-[90vh] overflow-y-auto no-scrollbar w-[95vw] h-[80vh] p-6 gap-6 rounded-2xl shadow-lg",children:[c.jsxs("div",{className:"flex flex-col gap-10",children:[c.jsxs(Kn,{children:[c.jsx(er,{children:"Edit Package Details"}),c.jsx(tr,{children:"Update your package's description, website, visibility, or delete it."})]}),c.jsxs("div",{className:"",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx(Se,{htmlFor:"packageName",children:"Package Name"}),c.jsx(ir,{id:"packageName",value:x.unscopedPackageName,onChange:C=>N(D=>({...D,unscopedPackageName:C.target.value.replace(/\s+/g,"")})),placeholder:"Enter package name",disabled:j.isLoading,className:"w-full",autoComplete:"off"})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx(Se,{htmlFor:"website",children:"Website"}),c.jsx(ir,{id:"website",value:x.website,autoComplete:"off",onChange:C=>N(D=>({...D,website:C.target.value})),placeholder:"https://example.com",disabled:j.isLoading,className:"w-full","aria-invalid":!!_}),_&&c.jsx("p",{className:"text-sm text-red-500",children:_})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx(Se,{htmlFor:"visibility",children:"Visibility"}),c.jsxs(Ft,{value:x.visibility,onValueChange:C=>{N(D=>({...D,visibility:C}))},disabled:j.isLoading,children:[c.jsx(Ot,{className:"w-full",children:c.jsx(zt,{placeholder:"Select visibility"})}),c.jsxs(Mt,{className:"!z-[999]",children:[c.jsx(de,{value:"public",children:"public"}),c.jsx(de,{value:"private",children:"private"})]})]})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx(Se,{htmlFor:"description",children:"Description"}),c.jsx(ua,{id:"description",spellCheck:!1,value:x.description,onChange:C=>N(D=>({...D,description:C.target.value})),placeholder:"Enter package description",disabled:j.isLoading,className:"w-full min-h-[80px] resize-none"})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx(Se,{htmlFor:"license",children:"License"}),c.jsxs(Ft,{value:x.license||"unset",onValueChange:C=>N(D=>({...D,license:C==="unset"?null:C})),disabled:j.isLoading,children:[c.jsx(Ot,{className:"w-full",children:c.jsx(zt,{placeholder:"Select a license"})}),c.jsxs(Mt,{className:"!z-[999]",children:[c.jsx(de,{value:"MIT",children:"MIT"}),c.jsx(de,{value:"Apache-2.0",children:"Apache-2.0"}),c.jsx(de,{value:"BSD-3-Clause",children:"BSD-3-Clause"}),c.jsx(de,{value:"GPL-3.0",children:"GPL-3.0"}),c.jsx(de,{value:"unset",children:"Unset"})]})]})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx(Se,{htmlFor:"defaultView",children:"Default View"}),c.jsxs(Ft,{value:x.defaultView,onValueChange:C=>N(D=>({...D,defaultView:C})),disabled:j.isLoading,children:[c.jsx(Ot,{className:"w-full",children:c.jsx(zt,{placeholder:"Select default view"})}),c.jsxs(Mt,{className:"!z-[999]",children:[c.jsx(de,{value:"files",children:"Files"}),c.jsx(de,{value:"3d",children:"3D"}),c.jsx(de,{value:"pcb",children:"PCB"}),c.jsx(de,{value:"schematic",children:"Schematic"})]})]})]}),c.jsx("div",{className:"space-y-1",children:c.jsx(Kl,{selectedRepository:x.githubRepoFullName||"",setSelectedRepository:C=>N(D=>({...D,githubRepoFullName:C})),disabled:j.isLoading,open:e,formData:x,addFormContent:C=>{N(D=>({...D,...C}))}})})]}),c.jsxs("details",{className:"mt-2 rounded-md",onToggle:C=>y(C.currentTarget.open),children:[c.jsxs("summary",{className:"select-none cursor-pointer p-2 font-medium text-sm text-black list-none flex justify-between items-center",children:["Danger Zone",c.jsx(ci,{className:`w-4 h-4 mr-1 transition-transform ${z?"rotate-180":""}`})]}),c.jsx("div",{className:"p-2 pr-2",children:c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("div",{children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Once deleted, it cannot be recovered."})}),c.jsx(X,{variant:"destructive",size:"default",onClick:()=>B(!0),disabled:L.isLoading,className:"shrink-0 lg:w-[115px] w-[70px]",children:L.isLoading?"Deleting...":"Delete"})]})})]})]})]}),c.jsx(ca,{className:"mt-auto",children:c.jsxs("div",{className:"lg:px-2 select-none flex flex-col sm:flex-row justify-end gap-2",children:[c.jsx(X,{variant:"outline",onClick:()=>t(!1),disabled:j.isLoading,className:"sm:w-auto w-full",children:"Cancel"}),c.jsx(X,{onClick:()=>j.mutate(),disabled:j.isLoading||!I||!k,className:"sm:w-auto lg:w-[115px]",children:j.isLoading?"Updating...":"Save Changes"})]})})]})})]})},Bi=ba(eo),to={MIT:["mit license","permission is hereby granted, free of charge","without restriction","furnished to do so",'the software is provided "as is"',"without warranty of any kind","copyright (c)"],"Apache-2.0":["apache license","version 2.0","licensed under the apache license","http://www.apache.org/licenses/","subject to the following conditions","unless required by applicable law"],"BSD-3-Clause":["redistribution and use in source and binary forms","redistributions of source code must retain","redistributions in binary form must reproduce","neither the name","nor the names of its contributors may be used"],"GPL-3.0":["gnu general public license","version 3","free software foundation","either version 3 of the license","everyone is permitted to copy and distribute","gnu general public license for more details"]},$i=e=>{const t=e.toLowerCase().replace(/\s+/g," ").trim();let n={type:"unset",ratio:0};const r=.7;for(const[i,a]of Object.entries(to)){const l=a.filter(o=>t.includes(o.toLowerCase())).length/a.length;l>=r&&l>n.ratio&&(n={type:i,ratio:l})}return n.type};function no({onLicenseClick:e}={}){const{packageInfo:t,refetch:n}=_n(),{packageRelease:r}=An({include_ai_review:!0}),{data:i}=Sn(t==null?void 0:t.latest_package_release_id),a=E.useMemo(()=>{var _;return((_=i==null?void 0:i.find(T=>T.file_path==="LICENSE"))==null?void 0:_.package_file_id)||null},[i]),{data:s}=pi(a),l=E.useMemo(()=>t!=null&&t.latest_license?t==null?void 0:t.latest_license:s!=null&&s.content_text?$i(s.content_text):null,[s,t==null?void 0:t.latest_license]),o=t!=null&&t.is_package?["Package"]:["Board"],u=!t||!r,h=pe(_=>!!_.session)&&(t==null?void 0:t.owner_github_username)===pe(_=>{var T;return(T=_.session)==null?void 0:T.github_username}),[m,f]=E.useState(""),[g,w]=E.useState("");E.useEffect(()=>{t&&(f(t.description||t.ai_description||""),w((t==null?void 0:t.website)||""))},[t]);const{Dialog:S,openDialog:x}=Bi(),N=(_,T)=>{f(_),w(T),n()};return u?c.jsxs("div",{className:"mb-6",children:[c.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About"}),c.jsx($,{className:"h-4 w-full mb-3"}),c.jsx($,{className:"h-4 w-3/4 mb-4"}),c.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:[1,2,3].map(_=>c.jsx($,{className:"h-6 w-20 rounded-full"},_))}),c.jsxs("div",{className:"space-y-2",children:[c.jsx($,{className:"h-4 w-24"}),c.jsx($,{className:"h-4 w-20"}),c.jsx($,{className:"h-4 w-20"})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mb-6",children:[c.jsxs("div",{className:"flex justify-between items-center mb-2",children:[c.jsx("h2",{className:"text-lg font-semibold",children:"About"}),h&&c.jsx(X,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:x,title:"Edit package details",children:c.jsx(bi,{className:"h-4 w-4 text-gray-500"})})]}),c.jsx("p",{className:"text-sm mb-3",children:m||(t==null?void 0:t.description)||(t==null?void 0:t.ai_description)}),g&&c.jsxs("a",{href:g,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 font-medium dark:text-[#58a6ff] hover:underline text-sm flex items-center mb-4 max-w-full overflow-hidden",children:[c.jsx(wi,{className:"h-4 w-4 min-w-[16px] mr-1 flex-shrink-0"}),c.jsx("span",{className:"truncate",children:g})]}),c.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:o.map((_,T)=>c.jsx(gi,{variant:"outline",className:"text-xs rounded-full px-2 py-0.5 bg-blue-100 dark:bg-[#1f6feb33] text-blue-600 dark:text-[#58a6ff] border-blue-300 dark:border-[#1f6feb66]",children:_},T))}),c.jsxs("div",{className:"space-y-2 text-sm",children:[c.jsxs("button",{className:"flex items-center hover:underline hover:underline-offset-2 cursor-pointer hover:decoration-gray-500",onClick:e,disabled:!e,children:[c.jsx("svg",{className:"h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]",viewBox:"0 0 16 16",fill:"currentColor",children:c.jsx("path",{d:"M8.75.75V2h.985c.304 0 .603.08.867.231l1.29.736c.038.022.08.033.124.033h2.234a.75.75 0 0 1 0 1.5h-.427l2.111 4.692a.75.75 0 0 1-.154.838l-.53-.53.53.53-.001.002-.002.002-.006.006-.006.005-.01.01-.045.04c-.21.176-.441.327-.686.45C14.556 10.78 13.88 11 13 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L12.178 4.5h-.162c-.305 0-.604-.079-.868-.231l-1.29-.736a.245.245 0 0 0-.124-.033H8.75V13h2.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1 0-1.5h2.5V3.5h-.984a.245.245 0 0 0-.124.033l-1.29.736c-.264.152-.563.231-.868.231h-.162l2.112 4.692a.75.75 0 0 1-.154.838l-.53-.53.53.53-.001.002-.002.002-.006.006-.016.015-.045.04c-.21.176-.441.327-.686.45C4.556 10.78 3.88 11 3 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L2.178 4.5H1.75a.75.75 0 0 1 0-1.5h2.234a.249.249 0 0 0 .125-.033l1.29-.736c.263-.15.561-.231.865-.231H7.25V.75a.75.75 0 0 1 1.5 0Zm2.945 8.477c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L13 6.327Zm-10 0c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L3 6.327Z"})}),c.jsxs("span",{children:[l??"Unset"," license"]})]}),c.jsxs("div",{className:"flex items-center",children:[c.jsx(wt,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]"}),c.jsxs("span",{children:[t==null?void 0:t.star_count," stars "]})]}),c.jsxs("div",{className:"flex items-center",children:[c.jsx(it,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]"}),c.jsxs("span",{children:[(t==null?void 0:t.fork_count)??"0"," forks"]})]}),t!=null&&t.github_repo_full_name?c.jsxs("a",{target:"_blank",href:`https://github.com/${t.github_repo_full_name}`,className:"flex items-center hover:underline hover:underline-offset-2 cursor-pointer hover:decoration-gray-500",children:[c.jsx(lr,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]"}),c.jsx("span",{children:t==null?void 0:t.github_repo_full_name.split("/")[1]})]}):c.jsx(c.Fragment,{children:h&&c.jsxs("div",{className:"flex items-center hover:underline hover:underline-offset-2 cursor-pointer hover:decoration-gray-500",onClick:x,title:"Connect GitHub",children:[c.jsxs("div",{className:"relative mr-2",children:[c.jsx(lr,{className:"h-4 w-4 text-gray-500 dark:text-[#8b949e]"}),c.jsx(xi,{className:"h-2 w-2 absolute -bottom-0.5 -right-0.5 text-gray-500 dark:text-[#8b949e] bg-white dark:bg-[#0d1117] rounded-full"})]}),c.jsx("span",{children:"Connect GitHub"})]})})]})]}),t&&c.jsx(S,{unscopedPackageName:t.unscoped_name,packageReleaseId:t.latest_package_release_id,packageId:t.package_id,currentGithubRepoFullName:t.github_repo_full_name,currentDescription:t.description||(t==null?void 0:t.ai_description)||"",currentLicense:l,currentWebsite:(t==null?void 0:t.website)||"",isPrivate:!!t.is_private,packageAuthor:t.owner_github_username,onUpdate:N,packageName:t.name,currentDefaultView:t.default_view,currentAllowPrPreviews:t.allow_pr_previews})]})}const ro=({step:e,packageReleaseId:t})=>{const{author:n,packageName:r}=xn(),i=`/${n}/${r}/releases/${t}`;return c.jsxs(Me,{href:i,className:"flex items-center gap-2",children:[e.status==="success"&&c.jsx($a,{className:"h-4 w-4 text-green-600 dark:text-[#8b949e]"}),e.status==="error"&&c.jsx(Qa,{className:"h-4 w-4 text-red-600 dark:text-[#8b949e]"}),e.status==="running"&&c.jsx(nn,{className:"h-4 w-4 text-blue-600 animate-spin dark:text-[#8b949e]"}),e.status==="pending"&&c.jsx(sl,{className:"h-4 w-4 text-gray-500 dark:text-[#8b949e]"}),c.jsx("span",{className:"text-sm text-gray-500 dark:text-[#8b949e]",children:e.name})]})};function io(e){switch(e==null?void 0:e.transpilation_display_status){case"complete":return"success";case"error":return"error";case"building":return"running";default:return"pending"}}function so(e){switch(e==null?void 0:e.circuit_json_build_display_status){case"complete":return"success";case"error":return"error";case"building":return"running";default:return"pending"}}function Hi(){const{packageInfo:e}=_n(),{packageRelease:t}=An({include_ai_review:!0}),{data:n}=Da((t==null?void 0:t.latest_package_build_id)??null),r=[{id:"package_transpilation",name:"Package Transpilation",status:io(t)},{id:"circuit_json_build",name:"Circuit JSON Build",status:so(t)}];if(!t)return c.jsxs("div",{className:"mb-6",children:[c.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Releases"}),c.jsx("div",{className:"mb-2",children:c.jsx($,{className:"h-4 w-20"})}),c.jsx("div",{className:"mb-3",children:c.jsx($,{className:"h-4 w-24"})}),c.jsx($,{className:"h-4 w-32"})]});const{status:i,label:a}=n?Ra(n):{status:"pending",label:"pending"};return c.jsxs("div",{className:"mb-6",children:[c.jsx("h2",{className:"text-lg font-semibold mb-2",children:c.jsx(Me,{href:`/${e==null?void 0:e.name}/releases`,className:"hover:underline",children:"Releases"})}),c.jsxs("div",{className:"flex flex-col space-y-2",children:[c.jsxs(Me,{href:`/${e==null?void 0:e.name}/releases`,className:"flex items-center hover:underline",children:[c.jsx(di,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]"}),c.jsxs("span",{className:"text-sm font-medium",children:["v",t.version]})]}),c.jsxs("div",{className:"flex items-center",children:[c.jsx(ya,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]"}),c.jsx("span",{className:"text-sm text-gray-500 dark:text-[#8b949e]",children:Ma(new Date(t.created_at))})]}),r.map(s=>c.jsx(ro,{step:s,packageReleaseId:t.package_release_id},s.id)),n&&c.jsxs(Me,{href:`/${e==null?void 0:e.name}/releases`,className:"flex items-center gap-2 text-sm text-gray-500 dark:text-[#8b949e]",children:[c.jsx(Ia,{status:i}),c.jsxs("span",{children:["Package Preview ",a]})]})]})]})}function Vi({cadPreviewUrl:e,pcbPreviewUrl:t,schematicPreviewUrl:n}){const[r,i]=E.useState({"3d":e?"loading":"error",pcb:t?"loading":"error",schematic:n?"loading":"error"});E.useEffect(()=>{i({"3d":e?"loading":"error",pcb:t?"loading":"error",schematic:n?"loading":"error"})},[e,t,n]);const a=[{id:"3d",label:"3D View",backgroundClass:"bg-gray-100",imageUrl:e??void 0},{id:"pcb",label:"PCB View",backgroundClass:"bg-black",imageUrl:t??void 0},{id:"schematic",label:"Schematic View",backgroundClass:"bg-[#F5F1ED]",imageUrl:n??void 0}],s=u=>{i(d=>({...d,[u]:"loaded"}))},l=u=>{i(d=>({...d,[u]:"error"}))};return{availableViews:a.filter(u=>!!u.imageUrl).map(u=>({...u,status:r[u.id],onLoad:()=>s(u.id),onError:()=>l(u.id)})).filter(u=>u.status!=="error")}}function ao({packageInfo:e,onViewChange:t}){const{availableViews:n}=Vi({cadPreviewUrl:e==null?void 0:e.latest_cad_preview_image_url,pcbPreviewUrl:e==null?void 0:e.latest_pcb_preview_image_url,schematicPreviewUrl:e==null?void 0:e.latest_sch_preview_image_url}),r=i=>{t==null||t(i)};return c.jsx("div",{className:"grid grid-cols-3 gap-2",children:n.map(i=>c.jsx("button",{className:`aspect-square ${i.status=="loading"?"bg-slate-900/10 animate-pulse":i.backgroundClass??"bg-gray-100"} rounded-lg border border-gray-200 dark:border-[#30363d] flex items-center justify-center transition-colors overflow-hidden mb-6`,onClick:()=>r(i.id),children:i.imageUrl&&c.jsx("img",{src:i.imageUrl,className:"w-full h-full object-cover rounded-lg",onLoad:i.onLoad,onError:i.onError})},i.id))})}function lo({packageInfo:e,isLoading:t=!1,onViewChange:n,onLicenseClick:r}){return c.jsxs("div",{className:"h-full p-4 bg-white dark:bg-[#0d1117] overflow-y-auto",children:[c.jsx(no,{onLicenseClick:r}),c.jsx(ao,{packageInfo:e,onViewChange:n}),c.jsx(Hi,{})]})}function oo(e){try{const t=e.match(/<svg[^>]*>/i);if(!t)return e;const n=t[0],r=/viewBox="[^"]+"/i.test(n),i=n.match(/\swidth="([0-9.]+)"/i),a=n.match(/\sheight="([0-9.]+)"/i);let s=n;if(s=s.replace(/\swidth="[^"]*"/i,""),s=s.replace(/\sheight="[^"]*"/i,""),!r&&i&&a){const l=i[1],o=a[1];s=s.replace(/<svg/i,`<svg viewBox="0 0 ${l} ${o}"`)}return/preserveAspectRatio="[^"]+"/i.test(s)?s=s.replace(/preserveAspectRatio="[^"]+"/i,'preserveAspectRatio="xMidYMid meet"'):s=s.replace(/<svg(\s|>)/i,(l,o)=>`<svg preserveAspectRatio="xMidYMid meet"${o}`),e.replace(n,s)}catch{return e}}function uo(e){try{return`data:image/svg+xml,${encodeURIComponent(e)}`}catch{return`data:image/svg+xml,${e}`}}const co=({isLoading:e=!1,onViewChange:t})=>{const{packageInfo:n,refetch:r}=_n(),{data:i}=Sn(n==null?void 0:n.latest_package_release_id),a=E.useMemo(()=>{var k;return((k=i==null?void 0:i.find(R=>R.file_path==="LICENSE"))==null?void 0:k.package_file_id)||null},[i]),{data:s}=pi(a),l=E.useMemo(()=>{if(n!=null&&n.latest_license)return n==null?void 0:n.latest_license;if(s!=null&&s.content_text)return $i(s.content_text)},[s,n==null?void 0:n.latest_license]),o=E.useMemo(()=>n!=null&&n.is_package?["Package"]:["Board"],[n==null?void 0:n.is_package]),d=pe(k=>!!k.session)&&(n==null?void 0:n.owner_github_username)===pe(k=>{var R;return(R=k.session)==null?void 0:R.github_username}),{Dialog:h,openDialog:m}=Bi(),[f,g]=E.useState(""),[w,S]=E.useState("");E.useEffect(()=>{n&&(g(n.description||n.ai_description||""),S((n==null?void 0:n.website)||""))},[n]);const x=E.useCallback((k,R)=>{g(k),S(R),r()},[r]),{availableViews:N}=Ha({packageReleaseId:n==null?void 0:n.latest_package_release_id}),{availableViews:_}=Vi({cadPreviewUrl:n==null?void 0:n.latest_cad_preview_image_url,pcbPreviewUrl:n==null?void 0:n.latest_pcb_preview_image_url,schematicPreviewUrl:n==null?void 0:n.latest_sch_preview_image_url}),T=N.length===0||N.every(k=>!k.isLoading&&!k.imageUrl)?_:N,I=E.useCallback(k=>{t==null||t(k)},[t]);return e?c.jsxs("div",{className:"p-4 bg-white dark:bg-[#0d1117] border-b border-gray-200 dark:border-[#30363d] md:hidden",children:[c.jsx($,{className:"h-4 w-full mb-4"}),c.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:[1,2,3].map(k=>c.jsx($,{className:"h-6 w-20 rounded-full"},k))}),c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsx($,{className:"h-4 w-16"}),c.jsx($,{className:"h-4 w-16"}),c.jsx($,{className:"h-4 w-24"})]}),c.jsx("div",{className:"grid grid-cols-3 gap-2 mt-4",children:[1,2,3].map(k=>c.jsx($,{className:"aspect-square rounded-lg"},k))})]}):c.jsxs("div",{className:"p-4 bg-white dark:bg-[#0d1117] border-b border-gray-200 dark:border-[#30363d] md:hidden",children:[c.jsxs("div",{className:"flex justify-between items-start mb-4",children:[c.jsx("p",{className:"text-sm text-gray-700 dark:text-[#c9d1d9]",children:f||(n==null?void 0:n.description)||(n==null?void 0:n.ai_description)||""}),d&&c.jsx(X,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 ml-2 flex-shrink-0",onClick:m,title:"Edit package details",children:c.jsx(bi,{className:"h-4 w-4 text-gray-500"})})]}),w&&c.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 font-medium dark:text-[#58a6ff] hover:underline text-sm flex items-center mb-4 max-w-full overflow-hidden",children:[c.jsx(wi,{className:"h-4 w-4 min-w-[16px] mr-1 flex-shrink-0"}),c.jsx("span",{className:"truncate",children:w})]}),c.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:o.map((k,R)=>c.jsx(gi,{variant:"outline",className:"text-xs rounded-full px-2 py-0.5 bg-blue-100 dark:bg-[#1f6feb33] text-blue-600 dark:text-[#58a6ff] border-blue-300 dark:border-[#1f6feb66]",children:k},R))}),c.jsxs("div",{className:"flex justify-between text-sm",children:[c.jsxs("div",{className:"flex items-center",children:[c.jsx(wt,{className:"h-4 w-4 mr-1 text-gray-500 dark:text-[#8b949e]"}),c.jsx("span",{className:"mr-4",children:n?`${n.star_count} stars`:c.jsx($,{className:"h-4 w-12 inline-block"})})]}),c.jsxs("div",{className:"flex items-center",children:[c.jsx(it,{className:"h-4 w-4 mr-1 text-gray-500 dark:text-[#8b949e]"}),c.jsx("span",{className:"mr-4",children:n?`${n.fork_count??0} forks`:c.jsx($,{className:"h-4 w-12 inline-block"})})]}),c.jsxs("div",{className:"flex items-center",children:[c.jsx(di,{className:"h-4 w-4 mr-1 text-gray-500 dark:text-[#8b949e]"}),c.jsx("span",{children:n?`v${n.latest_version||"-"}`:c.jsx($,{className:"h-4 w-12 inline-block"})})]})]}),c.jsx("div",{className:"grid grid-cols-3 gap-2",children:T.map(k=>c.jsx(fo,{view:k.label,onClick:()=>I(k.id),backgroundClass:k.backgroundClass,svg:k.svg,isLoading:k.isLoading,imageUrl:k.imageUrl,status:k.status,onLoad:k.onLoad,onError:k.onError},k.id))}),n&&c.jsx(h,{currentAllowPrPreviews:n.allow_pr_previews,packageReleaseId:n.latest_package_release_id,packageId:n.package_id,currentDescription:n.description||(n==null?void 0:n.ai_description)||"",currentGithubRepoFullName:n.github_repo_full_name,currentLicense:l,currentWebsite:(n==null?void 0:n.website)||"",isPrivate:!!n.is_private,packageAuthor:n.owner_github_username,onUpdate:x,packageName:n.name,unscopedPackageName:n.unscoped_name,currentDefaultView:n.default_view})]})},ho=si.memo(co);function fo({view:e,onClick:t,backgroundClass:n,svg:r,isLoading:i,imageUrl:a,status:s,onLoad:l,onError:o}){return!r&&!i&&!a?null:c.jsxs("button",{onClick:t,className:`aspect-square ${n??"bg-gray-100"} rounded-lg border border-gray-200 dark:border-[#30363d] flex items-center justify-center transition-colors mt-4 overflow-hidden`,children:[(i||s==="loading")&&c.jsx($,{className:"w-full h-full rounded-lg"}),!i&&!s&&r&&c.jsx("img",{src:uo(oo(r)),alt:e,className:"w-full h-full object-contain"}),a&&!i&&c.jsx("img",{src:a,alt:e,className:"w-full h-full object-cover rounded-lg",onLoad:l,onError:o})]})}const Ui=["w-2/3","w-1/4","w-5/6","w-1/3","w-1/2","w-3/4"],mo='<pre class="shiki vitesse-light" style="background-color:#ffffff;color:#393a34" tabindex="0"><code><span class="line"></span></code></pre>',po=({code:e,filePath:t})=>{const{highlighter:n}=fi(),r=E.useMemo(()=>n==null?void 0:n.codeToHtml(e,{lang:"tsx",theme:"vitesse-light"}),[t,e,n]);return r&&(r==null?void 0:r.trim())!==mo?c.jsx("div",{className:"text-sm shiki",dangerouslySetInnerHTML:{__html:r}}):c.jsx("div",{className:"text-sm p-4",children:Ui.map((i,a)=>c.jsx($,{className:`h-4 mb-2 ${i}`},a))})};const go=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xo=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bo={};function gr(e,t){return(bo.jsx?xo:go).test(e)}var Fe={},Bt,xr;function yo(){if(xr)return Bt;xr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,l=/^\s+|\s+$/g,o=`
132
+ `,u="/",d="*",h="",m="comment",f="declaration";Bt=function(w,S){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];S=S||{};var x=1,N=1;function _(j){var C=j.match(t);C&&(x+=C.length);var D=j.lastIndexOf(o);N=~D?j.length-D:N+j.length}function T(){var j={line:x,column:N};return function(C){return C.position=new I(j),B(),C}}function I(j){this.start=j,this.end={line:x,column:N},this.source=S.source}I.prototype.content=w;function k(j){var C=new Error(S.source+":"+x+":"+N+": "+j);if(C.reason=j,C.filename=S.source,C.line=x,C.column=N,C.source=w,!S.silent)throw C}function R(j){var C=j.exec(w);if(C){var D=C[0];return _(D),w=w.slice(D.length),C}}function B(){R(n)}function z(j){var C;for(j=j||[];C=y();)C!==!1&&j.push(C);return j}function y(){var j=T();if(!(u!=w.charAt(0)||d!=w.charAt(1))){for(var C=2;h!=w.charAt(C)&&(d!=w.charAt(C)||u!=w.charAt(C+1));)++C;if(C+=2,h===w.charAt(C-1))return k("End of comment missing");var D=w.slice(2,C-2);return N+=2,_(D),w=w.slice(C),N+=2,j({type:m,comment:D})}}function P(){var j=T(),C=R(r);if(C){if(y(),!R(i))return k("property missing ':'");var D=R(a),H=j({type:f,property:g(C[0].replace(e,h)),value:D?g(D[0].replace(e,h)):h});return R(s),H}}function L(){var j=[];z(j);for(var C;C=P();)C!==!1&&(j.push(C),z(j));return j}return B(),L()};function g(w){return w?w.replace(l,h):h}return Bt}var br;function wo(){if(br)return Fe;br=1;var e=Fe&&Fe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.default=n;var t=e(yo());function n(r,i){var a=null;if(!r||typeof r!="string")return a;var s=(0,t.default)(r),l=typeof i=="function";return s.forEach(function(o){if(o.type==="declaration"){var u=o.property,d=o.value;l?i(u,d,o):d&&(a=a||{},a[u]=d)}}),a}return Fe}var Ye={},yr;function ko(){if(yr)return Ye;yr=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||n.test(u)||e.test(u)},s=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},o=function(u,d){return d===void 0&&(d={}),a(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(i,l):u=u.replace(r,l),u.replace(t,s))};return Ye.camelCase=o,Ye}var Qe,wr;function _o(){if(wr)return Qe;wr=1;var e=Qe&&Qe.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(wo()),n=ko();function r(i,a){var s={};return!i||typeof i!="string"||(0,t.default)(i,function(l,o){l&&o&&(s[(0,n.camelCase)(l,a)]=o)}),s}return r.default=r,Qe=r,Qe}var No=_o();const So=ui(No),qi=Wi("end"),Tn=Wi("start");function Wi(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function vo(e){const t=Tn(e),n=qi(e);if(t&&n)return{start:t,end:n}}function et(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?kr(e.position):"start"in e||"end"in e?kr(e):"line"in e||"column"in e?an(e):""}function an(e){return _r(e&&e.line)+":"+_r(e&&e.column)}function kr(e){return an(e&&e.start)+"-"+an(e&&e.end)}function _r(e){return e&&typeof e=="number"?e:1}class K extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},s=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(s=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const o=r.indexOf(":");o===-1?a.ruleId=r:(a.source=r.slice(0,o),a.ruleId=r.slice(o+1))}if(!a.place&&a.ancestors&&a.ancestors){const o=a.ancestors[a.ancestors.length-1];o&&(a.place=o.position)}const l=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=et(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}K.prototype.file="";K.prototype.name="";K.prototype.reason="";K.prototype.message="";K.prototype.stack="";K.prototype.column=void 0;K.prototype.line=void 0;K.prototype.ancestors=void 0;K.prototype.cause=void 0;K.prototype.fatal=void 0;K.prototype.place=void 0;K.prototype.ruleId=void 0;K.prototype.source=void 0;const Pn={}.hasOwnProperty,jo=new Map,Co=/[A-Z]/g,Eo=new Set(["table","tbody","thead","tfoot","tr"]),Ao=new Set(["td","th"]),Gi="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function To(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=zo(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Oo(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Nn:va,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Yi(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Yi(e,t,n){if(t.type==="element")return Po(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Lo(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ro(e,t,n);if(t.type==="mdxjsEsm")return Do(e,t);if(t.type==="root")return Io(e,t,n);if(t.type==="text")return Fo(e,t)}function Po(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Nn,e.schema=i),e.ancestors.push(t);const a=Ji(e,t.tagName,!1),s=Mo(e,t);let l=Dn(e,t);return Eo.has(t.tagName)&&(l=l.filter(function(o){return typeof o=="string"?!ja(o):!0})),Qi(e,s,a,t),Ln(s,l),e.ancestors.pop(),e.schema=r,e.create(t,a,s,n)}function Lo(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}st(e,t.position)}function Do(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);st(e,t.position)}function Ro(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Nn,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:Ji(e,t.name,!0),s=Bo(e,t),l=Dn(e,t);return Qi(e,s,a,t),Ln(s,l),e.ancestors.pop(),e.schema=r,e.create(t,a,s,n)}function Io(e,t,n){const r={};return Ln(r,Dn(e,t)),e.create(t,e.Fragment,r,n)}function Fo(e,t){return t.value}function Qi(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ln(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Oo(e,t,n){return r;function r(i,a,s,l){const u=Array.isArray(s.children)?n:t;return l?u(a,s,l):u(a,s)}}function zo(e,t){return n;function n(r,i,a,s){const l=Array.isArray(a.children),o=Tn(r);return t(i,a,s,l,{columnNumber:o?o.column-1:void 0,fileName:e,lineNumber:o?o.line:void 0},void 0)}}function Mo(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Pn.call(t.properties,i)){const a=$o(e,i,t.properties[i]);if(a){const[s,l]=a;e.tableCellAlignToStyle&&s==="align"&&typeof l=="string"&&Ao.has(t.tagName)?r=l:n[s]=l}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Bo(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const s=a.expression;s.type;const l=s.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else st(e,t.position);else{const i=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,a=e.evaluater.evaluateExpression(l.expression)}else st(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Dn(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:jo;for(;++r<t.children.length;){const a=t.children[r];let s;if(e.passKeys){const o=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(o){const u=i.get(o)||0;s=o+"-"+u,i.set(o,u+1)}}const l=Yi(e,a,s);l!==void 0&&n.push(l)}return n}function $o(e,t,n){const r=Ca(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ea(n):Aa(n)),r.property==="style"){let i=typeof n=="object"?n:Ho(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Vo(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Ml[r.property]||r.property:r.attribute,n]}}function Ho(e,t){try{return So(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new K("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Gi+"#cannot-parse-style-attribute",i}}function Ji(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let a=-1,s;for(;++a<i.length;){const l=gr(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};s=s?{type:"MemberExpression",object:s,property:l,computed:!!(a&&l.type==="Literal"),optional:!1}:l}r=s}else r=gr(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Pn.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);st(e)}function st(e,t){const n=new K("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Gi+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Vo(e){const t={};let n;for(n in e)Pn.call(e,n)&&(t[Uo(n)]=e[n]);return t}function Uo(e){let t=e.replace(Co,qo);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function qo(e){return"-"+e.toLowerCase()}const $t={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Wo={};function Rn(e,t){const n=Wo,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Xi(e,r,i)}function Xi(e,t,n){if(Go(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Nr(e.children,t,n)}return Array.isArray(e)?Nr(e,t,n):""}function Nr(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Xi(e[i],t,n);return r.join("")}function Go(e){return!!(e&&typeof e=="object")}const Sr=document.createElement("i");function In(e){const t="&"+e+";";Sr.innerHTML=t;const n=Sr.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function le(e,t,n,r){const i=e.length;let a=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);a<r.length;)s=r.slice(a,a+1e4),s.unshift(t,0),e.splice(...s),a+=1e4,t+=1e4}function ue(e,t){return e.length>0?(le(e,e.length,0,t),e):t}const vr={}.hasOwnProperty;function Zi(e){const t={};let n=-1;for(;++n<e.length;)Yo(t,e[n]);return t}function Yo(e,t){let n;for(n in t){const i=(vr.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let s;if(a)for(s in a){vr.call(i,s)||(i[s]=[]);const l=a[s];Qo(i[s],Array.isArray(l)?l:l?[l]:[])}}}function Qo(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);le(e,0,0,r)}function Ki(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function fe(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const te=je(/[A-Za-z]/),Z=je(/[\dA-Za-z]/),Jo=je(/[#-'*+\--9=?A-Z^-~]/);function jt(e){return e!==null&&(e<32||e===127)}const ln=je(/\d/),Xo=je(/[\dA-Fa-f]/),Zo=je(/[!-/:-@[-`{-~]/);function F(e){return e!==null&&e<-2}function G(e){return e!==null&&(e<0||e===32)}function V(e){return e===-2||e===-1||e===32}const Pt=je(new RegExp("\\p{P}|\\p{S}","u")),Te=je(/\s/);function je(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function qe(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const a=e.charCodeAt(n);let s="";if(a===37&&Z(e.charCodeAt(n+1))&&Z(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(s=String.fromCharCode(a));else if(a>55295&&a<57344){const l=e.charCodeAt(n+1);a<56320&&l>56319&&l<57344?(s=String.fromCharCode(a,l),i=1):s="�"}else s=String.fromCharCode(a);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function q(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return s;function s(o){return V(o)?(e.enter(n),l(o)):t(o)}function l(o){return V(o)&&a++<i?(e.consume(o),l):(e.exit(n),t(o))}}const Ko={tokenize:eu};function eu(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),q(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),a(l)}function a(l){const o=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=o),n=o,s(l)}function s(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return F(l)?(e.consume(l),e.exit("chunkText"),a):(e.consume(l),s)}}const tu={tokenize:nu},jr={tokenize:ru};function nu(e){const t=this,n=[];let r=0,i,a,s;return l;function l(_){if(r<n.length){const T=n[r];return t.containerState=T[1],e.attempt(T[0].continuation,o,u)(_)}return u(_)}function o(_){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&N();const T=t.events.length;let I=T,k;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){k=t.events[I][1].end;break}x(r);let R=T;for(;R<t.events.length;)t.events[R][1].end={...k},R++;return le(t.events,I+1,0,t.events.slice(T)),t.events.length=R,u(_)}return l(_)}function u(_){if(r===n.length){if(!i)return m(_);if(i.currentConstruct&&i.currentConstruct.concrete)return g(_);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(jr,d,h)(_)}function d(_){return i&&N(),x(r),m(_)}function h(_){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(_)}function m(_){return t.containerState={},e.attempt(jr,f,g)(_)}function f(_){return r++,n.push([t.currentConstruct,t.containerState]),m(_)}function g(_){if(_===null){i&&N(),x(0),e.consume(_);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),w(_)}function w(_){if(_===null){S(e.exit("chunkFlow"),!0),x(0),e.consume(_);return}return F(_)?(e.consume(_),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(_),w)}function S(_,T){const I=t.sliceStream(_);if(T&&I.push(null),_.previous=a,a&&(a.next=_),a=_,i.defineSkip(_.start),i.write(I),t.parser.lazy[_.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<s&&(!i.events[k][1].end||i.events[k][1].end.offset>s))return;const R=t.events.length;let B=R,z,y;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(z){y=t.events[B][1].end;break}z=!0}for(x(r),k=R;k<t.events.length;)t.events[k][1].end={...y},k++;le(t.events,B+1,0,t.events.slice(R)),t.events.length=k}}function x(_){let T=n.length;for(;T-- >_;){const I=n[T];t.containerState=I[1],I[0].exit.call(t,e)}n.length=_}function N(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function ru(e,t,n){return q(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ve(e){if(e===null||G(e)||Te(e))return 1;if(Pt(e))return 2}function Lt(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const on={name:"attention",resolveAll:iu,tokenize:su};function iu(e,t){let n=-1,r,i,a,s,l,o,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;o=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},m={...e[n][1].start};Cr(h,-o),Cr(m,o),s={type:o>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:o>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},a={type:o>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:o>1?"strong":"emphasis",start:{...s.start},end:{...l.end}},e[r][1].end={...s.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ue(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ue(u,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",a,t]]),u=ue(u,Lt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ue(u,[["exit",a,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ue(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,le(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function su(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ve(r);let a;return s;function s(o){return a=o,e.enter("attentionSequence"),l(o)}function l(o){if(o===a)return e.consume(o),l;const u=e.exit("attentionSequence"),d=Ve(o),h=!d||d===2&&i||n.includes(o),m=!i||i===2&&d||n.includes(r);return u._open=!!(a===42?h:h&&(i||!m)),u._close=!!(a===42?m:m&&(d||!h)),t(o)}}function Cr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const au={name:"autolink",tokenize:lu};function lu(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(f){return te(f)?(e.consume(f),s):f===64?n(f):u(f)}function s(f){return f===43||f===45||f===46||Z(f)?(r=1,l(f)):u(f)}function l(f){return f===58?(e.consume(f),r=0,o):(f===43||f===45||f===46||Z(f))&&r++<32?(e.consume(f),l):(r=0,u(f))}function o(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||jt(f)?n(f):(e.consume(f),o)}function u(f){return f===64?(e.consume(f),d):Jo(f)?(e.consume(f),u):n(f)}function d(f){return Z(f)?h(f):n(f)}function h(f){return f===46?(e.consume(f),r=0,d):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):m(f)}function m(f){if((f===45||Z(f))&&r++<63){const g=f===45?m:h;return e.consume(f),g}return n(f)}}const ot={partial:!0,tokenize:ou};function ou(e,t,n){return r;function r(a){return V(a)?q(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||F(a)?t(a):n(a)}}const es={continuation:{tokenize:cu},exit:hu,name:"blockQuote",tokenize:uu};function uu(e,t,n){const r=this;return i;function i(s){if(s===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),a}return n(s)}function a(s){return V(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function cu(e,t,n){const r=this;return i;function i(s){return V(s)?q(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):a(s)}function a(s){return e.attempt(es,t,n)(s)}}function hu(e){e.exit("blockQuote")}const ts={name:"characterEscape",tokenize:du};function du(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return Zo(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const ns={name:"characterReference",tokenize:fu};function fu(e,t,n){const r=this;let i=0,a,s;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),o}function o(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),a=31,s=Z,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,s=Xo,d):(e.enter("characterReferenceValue"),a=7,s=ln,d(h))}function d(h){if(h===59&&i){const m=e.exit("characterReferenceValue");return s===Z&&!In(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&i++<a?(e.consume(h),d):n(h)}}const Er={partial:!0,tokenize:pu},Ar={concrete:!0,name:"codeFenced",tokenize:mu};function mu(e,t,n){const r=this,i={partial:!0,tokenize:I};let a=0,s=0,l;return o;function o(k){return u(k)}function u(k){const R=r.events[r.events.length-1];return a=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(k)}function d(k){return k===l?(s++,e.consume(k),d):s<3?n(k):(e.exit("codeFencedFenceSequence"),V(k)?q(e,h,"whitespace")(k):h(k))}function h(k){return k===null||F(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Er,w,T)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||F(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(k)):V(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),q(e,f,"whitespace")(k)):k===96&&k===l?n(k):(e.consume(k),m)}function f(k){return k===null||F(k)?h(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||F(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(k)):k===96&&k===l?n(k):(e.consume(k),g)}function w(k){return e.attempt(i,T,S)(k)}function S(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),x}function x(k){return a>0&&V(k)?q(e,N,"linePrefix",a+1)(k):N(k)}function N(k){return k===null||F(k)?e.check(Er,w,T)(k):(e.enter("codeFlowValue"),_(k))}function _(k){return k===null||F(k)?(e.exit("codeFlowValue"),N(k)):(e.consume(k),_)}function T(k){return e.exit("codeFenced"),t(k)}function I(k,R,B){let z=0;return y;function y(D){return k.enter("lineEnding"),k.consume(D),k.exit("lineEnding"),P}function P(D){return k.enter("codeFencedFence"),V(D)?q(k,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):L(D)}function L(D){return D===l?(k.enter("codeFencedFenceSequence"),j(D)):B(D)}function j(D){return D===l?(z++,k.consume(D),j):z>=s?(k.exit("codeFencedFenceSequence"),V(D)?q(k,C,"whitespace")(D):C(D)):B(D)}function C(D){return D===null||F(D)?(k.exit("codeFencedFence"),R(D)):B(D)}}}function pu(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Ht={name:"codeIndented",tokenize:xu},gu={partial:!0,tokenize:bu};function xu(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),q(e,a,"linePrefix",5)(u)}function a(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?o(u):F(u)?e.attempt(gu,s,o)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||F(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),l)}function o(u){return e.exit("codeIndented"),t(u)}}function bu(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):F(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):q(e,a,"linePrefix",5)(s)}function a(s){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(s):F(s)?i(s):n(s)}}const yu={name:"codeText",previous:ku,resolve:wu,tokenize:_u};function wu(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ku(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _u(e,t,n){let r=0,i,a;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),r++,l):(e.exit("codeTextSequence"),o(h))}function o(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),o):h===96?(a=e.enter("codeTextSequence"),i=0,d(h)):F(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),o):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||F(h)?(e.exit("codeTextData"),o(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(a.type="codeTextData",u(h))}}class Nu{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Je(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Je(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Je(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Je(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Je(this.left,n.reverse())}}}function Je(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function rs(e){const t={};let n=-1,r,i,a,s,l,o,u;const d=new Nu(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(o=r[1]._tokenizer.events,a=0,a<o.length&&o[a][1].type==="lineEndingBlank"&&(a+=2),a<o.length&&o[a][1].type==="content"))for(;++a<o.length&&o[a][1].type!=="content";)o[a][1].type==="chunkText"&&(o[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Su(d,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(s=d.get(a),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=a);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},l=d.slice(i,n),l.unshift(r),d.splice(i,n-i+1,l))}}return le(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function Su(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const l=s.events,o=[],u={};let d,h,m=-1,f=n,g=0,w=0;const S=[w];for(;f;){for(;e.get(++i)[1]!==f;);a.push(i),f._tokenizer||(d=r.sliceStream(f),f.next||d.push(null),h&&s.defineSkip(f.start),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++m<l.length;)l[m][0]==="exit"&&l[m-1][0]==="enter"&&l[m][1].type===l[m-1][1].type&&l[m][1].start.line!==l[m][1].end.line&&(w=m+1,S.push(w),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):S.pop(),m=S.length;m--;){const x=l.slice(S[m],S[m+1]),N=a.pop();o.push([N,N+x.length-1]),e.splice(N,2,x)}for(o.reverse(),m=-1;++m<o.length;)u[g+o[m][0]]=g+o[m][1],g+=o[m][1]-o[m][0]-1;return u}const vu={resolve:Cu,tokenize:Eu},ju={partial:!0,tokenize:Au};function Cu(e){return rs(e),e}function Eu(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?a(l):F(l)?e.check(ju,s,a)(l):(e.consume(l),i)}function a(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function s(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Au(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),q(e,a,"linePrefix")}function a(s){if(s===null||F(s))return n(s);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function is(e,t,n,r,i,a,s,l,o){const u=o||Number.POSITIVE_INFINITY;let d=0;return h;function h(x){return x===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(x),e.exit(a),m):x===null||x===32||x===41||jt(x)?n(x):(e.enter(r),e.enter(s),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(x))}function m(x){return x===62?(e.enter(a),e.consume(x),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===62?(e.exit("chunkString"),e.exit(l),m(x)):x===null||x===60||F(x)?n(x):(e.consume(x),x===92?g:f)}function g(x){return x===60||x===62||x===92?(e.consume(x),f):f(x)}function w(x){return!d&&(x===null||x===41||G(x))?(e.exit("chunkString"),e.exit(l),e.exit(s),e.exit(r),t(x)):d<u&&x===40?(e.consume(x),d++,w):x===41?(e.consume(x),d--,w):x===null||x===32||x===40||jt(x)?n(x):(e.consume(x),x===92?S:w)}function S(x){return x===40||x===41||x===92?(e.consume(x),w):w(x)}}function ss(e,t,n,r,i,a){const s=this;let l=0,o;return u;function u(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(a),d}function d(f){return l>999||f===null||f===91||f===93&&!o||f===94&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):f===93?(e.exit(a),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):F(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||F(f)||l++>999?(e.exit("chunkString"),d(f)):(e.consume(f),o||(o=!V(f)),f===92?m:h)}function m(f){return f===91||f===92||f===93?(e.consume(f),l++,h):h(f)}}function as(e,t,n,r,i,a){let s;return l;function l(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),s=m===40?41:m,o):n(m)}function o(m){return m===s?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):(e.enter(a),u(m))}function u(m){return m===s?(e.exit(a),o(s)):m===null?n(m):F(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),q(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===s||m===null||F(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:d)}function h(m){return m===s||m===92?(e.consume(m),d):d(m)}}function tt(e,t){let n;return r;function r(i){return F(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):V(i)?q(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Tu={name:"definition",tokenize:Lu},Pu={partial:!0,tokenize:Du};function Lu(e,t,n){const r=this;let i;return a;function a(f){return e.enter("definition"),s(f)}function s(f){return ss.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function l(f){return i=fe(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),o):n(f)}function o(f){return G(f)?tt(e,u)(f):u(f)}function u(f){return is(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(Pu,h,h)(f)}function h(f){return V(f)?q(e,m,"whitespace")(f):m(f)}function m(f){return f===null||F(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function Du(e,t,n){return r;function r(l){return G(l)?tt(e,i)(l):n(l)}function i(l){return as(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function a(l){return V(l)?q(e,s,"whitespace")(l):s(l)}function s(l){return l===null||F(l)?t(l):n(l)}}const Ru={name:"hardBreakEscape",tokenize:Iu};function Iu(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return F(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const Fu={name:"headingAtx",resolve:Ou,tokenize:zu};function Ou(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},le(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function zu(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||G(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),o(d)):d===null||F(d)?(e.exit("atxHeading"),t(d)):V(d)?q(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function o(d){return d===35?(e.consume(d),o):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||G(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const Mu=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Tr=["pre","script","style","textarea"],Bu={concrete:!0,name:"htmlFlow",resolveTo:Vu,tokenize:Uu},$u={partial:!0,tokenize:Wu},Hu={partial:!0,tokenize:qu};function Vu(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Uu(e,t,n){const r=this;let i,a,s,l,o;return u;function u(p){return d(p)}function d(p){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(p),h}function h(p){return p===33?(e.consume(p),m):p===47?(e.consume(p),a=!0,w):p===63?(e.consume(p),i=3,r.interrupt?t:b):te(p)?(e.consume(p),s=String.fromCharCode(p),S):n(p)}function m(p){return p===45?(e.consume(p),i=2,f):p===91?(e.consume(p),i=5,l=0,g):te(p)?(e.consume(p),i=4,r.interrupt?t:b):n(p)}function f(p){return p===45?(e.consume(p),r.interrupt?t:b):n(p)}function g(p){const O="CDATA[";return p===O.charCodeAt(l++)?(e.consume(p),l===O.length?r.interrupt?t:L:g):n(p)}function w(p){return te(p)?(e.consume(p),s=String.fromCharCode(p),S):n(p)}function S(p){if(p===null||p===47||p===62||G(p)){const O=p===47,ne=s.toLowerCase();return!O&&!a&&Tr.includes(ne)?(i=1,r.interrupt?t(p):L(p)):Mu.includes(s.toLowerCase())?(i=6,O?(e.consume(p),x):r.interrupt?t(p):L(p)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(p):a?N(p):_(p))}return p===45||Z(p)?(e.consume(p),s+=String.fromCharCode(p),S):n(p)}function x(p){return p===62?(e.consume(p),r.interrupt?t:L):n(p)}function N(p){return V(p)?(e.consume(p),N):y(p)}function _(p){return p===47?(e.consume(p),y):p===58||p===95||te(p)?(e.consume(p),T):V(p)?(e.consume(p),_):y(p)}function T(p){return p===45||p===46||p===58||p===95||Z(p)?(e.consume(p),T):I(p)}function I(p){return p===61?(e.consume(p),k):V(p)?(e.consume(p),I):_(p)}function k(p){return p===null||p===60||p===61||p===62||p===96?n(p):p===34||p===39?(e.consume(p),o=p,R):V(p)?(e.consume(p),k):B(p)}function R(p){return p===o?(e.consume(p),o=null,z):p===null||F(p)?n(p):(e.consume(p),R)}function B(p){return p===null||p===34||p===39||p===47||p===60||p===61||p===62||p===96||G(p)?I(p):(e.consume(p),B)}function z(p){return p===47||p===62||V(p)?_(p):n(p)}function y(p){return p===62?(e.consume(p),P):n(p)}function P(p){return p===null||F(p)?L(p):V(p)?(e.consume(p),P):n(p)}function L(p){return p===45&&i===2?(e.consume(p),H):p===60&&i===1?(e.consume(p),Y):p===62&&i===4?(e.consume(p),se):p===63&&i===3?(e.consume(p),b):p===93&&i===5?(e.consume(p),oe):F(p)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check($u,ce,j)(p)):p===null||F(p)?(e.exit("htmlFlowData"),j(p)):(e.consume(p),L)}function j(p){return e.check(Hu,C,ce)(p)}function C(p){return e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),D}function D(p){return p===null||F(p)?j(p):(e.enter("htmlFlowData"),L(p))}function H(p){return p===45?(e.consume(p),b):L(p)}function Y(p){return p===47?(e.consume(p),s="",J):L(p)}function J(p){if(p===62){const O=s.toLowerCase();return Tr.includes(O)?(e.consume(p),se):L(p)}return te(p)&&s.length<8?(e.consume(p),s+=String.fromCharCode(p),J):L(p)}function oe(p){return p===93?(e.consume(p),b):L(p)}function b(p){return p===62?(e.consume(p),se):p===45&&i===2?(e.consume(p),b):L(p)}function se(p){return p===null||F(p)?(e.exit("htmlFlowData"),ce(p)):(e.consume(p),se)}function ce(p){return e.exit("htmlFlow"),t(p)}}function qu(e,t,n){const r=this;return i;function i(s){return F(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):n(s)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Wu(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(ot,t,n)}}const Gu={name:"htmlText",tokenize:Yu};function Yu(e,t,n){const r=this;let i,a,s;return l;function l(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),o}function o(b){return b===33?(e.consume(b),u):b===47?(e.consume(b),I):b===63?(e.consume(b),_):te(b)?(e.consume(b),B):n(b)}function u(b){return b===45?(e.consume(b),d):b===91?(e.consume(b),a=0,g):te(b)?(e.consume(b),N):n(b)}function d(b){return b===45?(e.consume(b),f):n(b)}function h(b){return b===null?n(b):b===45?(e.consume(b),m):F(b)?(s=h,Y(b)):(e.consume(b),h)}function m(b){return b===45?(e.consume(b),f):h(b)}function f(b){return b===62?H(b):b===45?m(b):h(b)}function g(b){const se="CDATA[";return b===se.charCodeAt(a++)?(e.consume(b),a===se.length?w:g):n(b)}function w(b){return b===null?n(b):b===93?(e.consume(b),S):F(b)?(s=w,Y(b)):(e.consume(b),w)}function S(b){return b===93?(e.consume(b),x):w(b)}function x(b){return b===62?H(b):b===93?(e.consume(b),x):w(b)}function N(b){return b===null||b===62?H(b):F(b)?(s=N,Y(b)):(e.consume(b),N)}function _(b){return b===null?n(b):b===63?(e.consume(b),T):F(b)?(s=_,Y(b)):(e.consume(b),_)}function T(b){return b===62?H(b):_(b)}function I(b){return te(b)?(e.consume(b),k):n(b)}function k(b){return b===45||Z(b)?(e.consume(b),k):R(b)}function R(b){return F(b)?(s=R,Y(b)):V(b)?(e.consume(b),R):H(b)}function B(b){return b===45||Z(b)?(e.consume(b),B):b===47||b===62||G(b)?z(b):n(b)}function z(b){return b===47?(e.consume(b),H):b===58||b===95||te(b)?(e.consume(b),y):F(b)?(s=z,Y(b)):V(b)?(e.consume(b),z):H(b)}function y(b){return b===45||b===46||b===58||b===95||Z(b)?(e.consume(b),y):P(b)}function P(b){return b===61?(e.consume(b),L):F(b)?(s=P,Y(b)):V(b)?(e.consume(b),P):z(b)}function L(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),i=b,j):F(b)?(s=L,Y(b)):V(b)?(e.consume(b),L):(e.consume(b),C)}function j(b){return b===i?(e.consume(b),i=void 0,D):b===null?n(b):F(b)?(s=j,Y(b)):(e.consume(b),j)}function C(b){return b===null||b===34||b===39||b===60||b===61||b===96?n(b):b===47||b===62||G(b)?z(b):(e.consume(b),C)}function D(b){return b===47||b===62||G(b)?z(b):n(b)}function H(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):n(b)}function Y(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),J}function J(b){return V(b)?q(e,oe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):oe(b)}function oe(b){return e.enter("htmlTextData"),s(b)}}const Fn={name:"labelEnd",resolveAll:Zu,resolveTo:Ku,tokenize:ec},Qu={tokenize:tc},Ju={tokenize:nc},Xu={tokenize:rc};function Zu(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&le(e,0,e.length,n),e}function Ku(e,t){let n=e.length,r=0,i,a,s,l;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const o={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[a][1].start},end:{...e[s][1].end}},d={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[s-2][1].start}};return l=[["enter",o,t],["enter",u,t]],l=ue(l,e.slice(a+1,a+r+3)),l=ue(l,[["enter",d,t]]),l=ue(l,Lt(t.parser.constructs.insideSpan.null,e.slice(a+r+4,s-3),t)),l=ue(l,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),l=ue(l,e.slice(s+1)),l=ue(l,[["exit",o,t]]),le(e,a,e.length,l),e}function ec(e,t,n){const r=this;let i=r.events.length,a,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return l;function l(m){return a?a._inactive?h(m):(s=r.parser.defined.includes(fe(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),o):n(m)}function o(m){return m===40?e.attempt(Qu,d,s?d:h)(m):m===91?e.attempt(Ju,d,s?u:h)(m):s?d(m):h(m)}function u(m){return e.attempt(Xu,d,h)(m)}function d(m){return t(m)}function h(m){return a._balanced=!0,n(m)}}function tc(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return G(h)?tt(e,a)(h):a(h)}function a(h){return h===41?d(h):is(e,s,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return G(h)?tt(e,o)(h):d(h)}function l(h){return n(h)}function o(h){return h===34||h===39||h===40?as(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return G(h)?tt(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function nc(e,t,n){const r=this;return i;function i(l){return ss.call(r,e,a,s,"reference","referenceMarker","referenceString")(l)}function a(l){return r.parser.defined.includes(fe(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function s(l){return n(l)}}function rc(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const ic={name:"labelStartImage",resolveAll:Fn.resolveAll,tokenize:sc};function sc(e,t,n){const r=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),a}function a(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),s):n(l)}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const ac={name:"labelStartLink",resolveAll:Fn.resolveAll,tokenize:lc};function lc(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),a}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Vt={name:"lineEnding",tokenize:oc};function oc(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),q(e,t,"linePrefix")}}const bt={name:"thematicBreak",tokenize:uc};function uc(e,t,n){let r=0,i;return a;function a(u){return e.enter("thematicBreak"),s(u)}function s(u){return i=u,l(u)}function l(u){return u===i?(e.enter("thematicBreakSequence"),o(u)):r>=3&&(u===null||F(u))?(e.exit("thematicBreak"),t(u)):n(u)}function o(u){return u===i?(e.consume(u),r++,o):(e.exit("thematicBreakSequence"),V(u)?q(e,l,"whitespace")(u):l(u))}}const re={continuation:{tokenize:fc},exit:pc,name:"list",tokenize:dc},cc={partial:!0,tokenize:gc},hc={partial:!0,tokenize:mc};function dc(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return l;function l(f){const g=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:ln(f)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(bt,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),o(f)}return n(f)}function o(f){return ln(f)&&++s<10?(e.consume(f),o):(!r.interrupt||s<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(ot,r.interrupt?n:d,e.attempt(cc,m,h))}function d(f){return r.containerState.initialBlankLine=!0,a++,m(f)}function h(f){return V(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),m):n(f)}function m(f){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function fc(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ot,i,a);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,q(e,t,"listItemIndent",r.containerState.size+1)(l)}function a(l){return r.containerState.furtherBlankLines||!V(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hc,t,s)(l))}function s(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,q(e,e.attempt(re,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function mc(e,t,n){const r=this;return q(e,i,"listItemIndent",r.containerState.size+1);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(a):n(a)}}function pc(e){e.exit(this.containerState.type)}function gc(e,t,n){const r=this;return q(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const s=r.events[r.events.length-1];return!V(a)&&s&&s[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Pr={name:"setextUnderline",resolveTo:xc,tokenize:bc};function xc(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",s,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function bc(e,t,n){const r=this;let i;return a;function a(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),V(u)?q(e,o,"lineSuffix")(u):o(u))}function o(u){return u===null||F(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const yc={tokenize:wc};function wc(e){const t=this,n=e.attempt(ot,r,e.attempt(this.parser.constructs.flowInitial,i,q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(vu,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const kc={resolveAll:os()},_c=ls("string"),Nc=ls("text");function ls(e){return{resolveAll:os(e==="text"?Sc:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,s,l);return s;function s(d){return u(d)?a(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),o}function o(d){return u(d)?(n.exit("data"),a(d)):(n.consume(d),o)}function u(d){if(d===null)return!0;const h=i[d];let m=-1;if(h)for(;++m<h.length;){const f=h[m];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function os(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function Sc(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,s=-1,l=0,o;for(;a--;){const u=i[a];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)l++,s--;if(s)break;s=-1}else if(u===-2)o=!0,l++;else if(u!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||o||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?s:r.start._bufferIndex+s,_index:r.start._index+a,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const vc={42:re,43:re,45:re,48:re,49:re,50:re,51:re,52:re,53:re,54:re,55:re,56:re,57:re,62:es},jc={91:Tu},Cc={[-2]:Ht,[-1]:Ht,32:Ht},Ec={35:Fu,42:bt,45:[Pr,bt],60:Bu,61:Pr,95:bt,96:Ar,126:Ar},Ac={38:ns,92:ts},Tc={[-5]:Vt,[-4]:Vt,[-3]:Vt,33:ic,38:ns,42:on,60:[au,Gu],91:ac,92:[Ru,ts],93:Fn,95:on,96:yu},Pc={null:[on,kc]},Lc={null:[42,95]},Dc={null:[]},Rc=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Lc,contentInitial:jc,disable:Dc,document:vc,flow:Ec,flowInitial:Cc,insideSpan:Pc,string:Ac,text:Tc},Symbol.toStringTag,{value:"Module"}));function Ic(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},a=[];let s=[],l=[];const o={attempt:R(I),check:R(k),consume:N,enter:_,exit:T,interrupt:R(k,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:g,parser:e,previous:null,sliceSerialize:m,sliceStream:f,write:h};let d=t.tokenize.call(u,o);return t.resolveAll&&a.push(t),u;function h(P){return s=ue(s,P),S(),s[s.length-1]!==null?[]:(B(t,0),u.events=Lt(a,u.events,u),u.events)}function m(P,L){return Oc(f(P),L)}function f(P){return Fc(s,P)}function g(){const{_bufferIndex:P,_index:L,line:j,column:C,offset:D}=r;return{_bufferIndex:P,_index:L,line:j,column:C,offset:D}}function w(P){i[P.line]=P.column,y()}function S(){let P;for(;r._index<s.length;){const L=s[r._index];if(typeof L=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<L.length;)x(L.charCodeAt(r._bufferIndex));else x(L)}}function x(P){d=d(P)}function N(P){F(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,y()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=P}function _(P,L){const j=L||{};return j.type=P,j.start=g(),u.events.push(["enter",j,u]),l.push(j),j}function T(P){const L=l.pop();return L.end=g(),u.events.push(["exit",L,u]),L}function I(P,L){B(P,L.from)}function k(P,L){L.restore()}function R(P,L){return j;function j(C,D,H){let Y,J,oe,b;return Array.isArray(C)?ce(C):"tokenize"in C?ce([C]):se(C);function se(Q){return ee;function ee(_e){const De=_e!==null&&Q[_e],Re=_e!==null&&Q.null,ct=[...Array.isArray(De)?De:De?[De]:[],...Array.isArray(Re)?Re:Re?[Re]:[]];return ce(ct)(_e)}}function ce(Q){return Y=Q,J=0,Q.length===0?H:p(Q[J])}function p(Q){return ee;function ee(_e){return b=z(),oe=Q,Q.partial||(u.currentConstruct=Q),Q.name&&u.parser.constructs.disable.null.includes(Q.name)?ne():Q.tokenize.call(L?Object.assign(Object.create(u),L):u,o,O,ne)(_e)}}function O(Q){return P(oe,b),D}function ne(Q){return b.restore(),++J<Y.length?p(Y[J]):H}}}function B(P,L){P.resolveAll&&!a.includes(P)&&a.push(P),P.resolve&&le(u.events,L,u.events.length-L,P.resolve(u.events.slice(L),u)),P.resolveTo&&(u.events=P.resolveTo(u.events,u))}function z(){const P=g(),L=u.previous,j=u.currentConstruct,C=u.events.length,D=Array.from(l);return{from:C,restore:H};function H(){r=P,u.previous=L,u.currentConstruct=j,u.events.length=C,l=D,y()}}function y(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Fc(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,a)];else{if(s=e.slice(n,i),r>-1){const l=s[0];typeof l=="string"?s[0]=l.slice(r):s.shift()}a>0&&s.push(e[i].slice(0,a))}return s}function Oc(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let s;if(typeof a=="string")s=a;else switch(a){case-5:{s="\r";break}case-4:{s=`
133
+ `;break}case-3:{s=`\r
134
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(a)}i=a===-2,r.push(s)}return r.join("")}function zc(e){const r={constructs:Zi([Rc,...(e||{}).extensions||[]]),content:i(Ko),defined:[],document:i(tu),flow:i(yc),lazy:{},string:i(_c),text:i(Nc)};return r;function i(a){return s;function s(l){return Ic(r,a,l)}}}function Mc(e){for(;!rs(e););return e}const Lr=/[\0\t\n\r]/g;function Bc(){let e=1,t="",n=!0,r;return i;function i(a,s,l){const o=[];let u,d,h,m,f;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),h=0,t="",n&&(a.charCodeAt(0)===65279&&h++,n=void 0);h<a.length;){if(Lr.lastIndex=h,u=Lr.exec(a),m=u&&u.index!==void 0?u.index:a.length,f=a.charCodeAt(m),!u){t=a.slice(h);break}if(f===10&&h===m&&r)o.push(-3),r=void 0;else switch(r&&(o.push(-5),r=void 0),h<m&&(o.push(a.slice(h,m)),e+=m-h),f){case 0:{o.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,o.push(-2);e++<d;)o.push(-1);break}case 10:{o.push(-4),e=1;break}default:r=!0,e=1}h=m+1}return l&&(r&&o.push(-5),t&&o.push(t),o.push(null)),o}}const $c=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Hc(e){return e.replace($c,Vc)}function Vc(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Ki(n.slice(a?2:1),a?16:10)}return In(n)||e}const us={}.hasOwnProperty;function Uc(e,t,n){return typeof t!="string"&&(n=t,t=void 0),qc(n)(Mc(zc(n).document().write(Bc()(e,t,!0))))}function qc(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Qn),autolinkProtocol:z,autolinkEmail:z,atxHeading:a(Wn),blockQuote:a(Re),characterEscape:z,characterReference:z,codeFenced:a(ct),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(ct,s),codeText:a(Hs,s),codeTextData:z,data:z,codeFlowValue:z,definition:a(Vs),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(Us),hardBreakEscape:a(Gn),hardBreakTrailing:a(Gn),htmlFlow:a(Yn,s),htmlFlowData:z,htmlText:a(Yn,s),htmlTextData:z,image:a(qs),label:s,link:a(Qn),listItem:a(Ws),listItemValue:m,listOrdered:a(Jn,h),listUnordered:a(Jn),paragraph:a(Gs),reference:p,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(Wn),strong:a(Ys),thematicBreak:a(Js)},exit:{atxHeading:o(),atxHeadingSequence:I,autolink:o(),autolinkEmail:De,autolinkProtocol:_e,blockQuote:o(),characterEscapeValue:y,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:Q,characterReference:ee,codeFenced:o(S),codeFencedFence:w,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:y,codeIndented:o(x),codeText:o(D),codeTextData:y,data:y,definition:o(),definitionDestinationString:T,definitionLabelString:N,definitionTitleString:_,emphasis:o(),hardBreakEscape:o(L),hardBreakTrailing:o(L),htmlFlow:o(j),htmlFlowData:y,htmlText:o(C),htmlTextData:y,image:o(Y),label:oe,labelText:J,lineEnding:P,link:o(H),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:O,resourceDestinationString:b,resourceTitleString:se,resource:ce,setextHeading:o(B),setextHeadingLineSequence:R,setextHeadingText:k,strong:o(),thematicBreak:o()}};cs(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(v){let A={type:"root",children:[]};const M={stack:[A],tokenStack:[],config:t,enter:l,exit:u,buffer:s,resume:d,data:n},U=[];let W=-1;for(;++W<v.length;)if(v[W][1].type==="listOrdered"||v[W][1].type==="listUnordered")if(v[W][0]==="enter")U.push(W);else{const he=U.pop();W=i(v,he,W)}for(W=-1;++W<v.length;){const he=t[v[W][0]];us.call(he,v[W][1].type)&&he[v[W][1].type].call(Object.assign({sliceSerialize:v[W][2].sliceSerialize},M),v[W][1])}if(M.tokenStack.length>0){const he=M.tokenStack[M.tokenStack.length-1];(he[1]||Dr).call(M,void 0,he[0])}for(A.position={start:Ne(v.length>0?v[0][1].start:{line:1,column:1,offset:0}),end:Ne(v.length>0?v[v.length-2][1].end:{line:1,column:1,offset:0})},W=-1;++W<t.transforms.length;)A=t.transforms[W](A)||A;return A}function i(v,A,M){let U=A-1,W=-1,he=!1,Ce,ye,We,Ge;for(;++U<=M;){const ae=v[U];switch(ae[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ae[0]==="enter"?W++:W--,Ge=void 0;break}case"lineEndingBlank":{ae[0]==="enter"&&(Ce&&!Ge&&!W&&!We&&(We=U),Ge=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ge=void 0}if(!W&&ae[0]==="enter"&&ae[1].type==="listItemPrefix"||W===-1&&ae[0]==="exit"&&(ae[1].type==="listUnordered"||ae[1].type==="listOrdered")){if(Ce){let Ie=U;for(ye=void 0;Ie--;){const we=v[Ie];if(we[1].type==="lineEnding"||we[1].type==="lineEndingBlank"){if(we[0]==="exit")continue;ye&&(v[ye][1].type="lineEndingBlank",he=!0),we[1].type="lineEnding",ye=Ie}else if(!(we[1].type==="linePrefix"||we[1].type==="blockQuotePrefix"||we[1].type==="blockQuotePrefixWhitespace"||we[1].type==="blockQuoteMarker"||we[1].type==="listItemIndent"))break}We&&(!ye||We<ye)&&(Ce._spread=!0),Ce.end=Object.assign({},ye?v[ye][1].start:ae[1].end),v.splice(ye||U,0,["exit",Ce,ae[2]]),U++,M++}if(ae[1].type==="listItemPrefix"){const Ie={type:"listItem",_spread:!1,start:Object.assign({},ae[1].start),end:void 0};Ce=Ie,v.splice(U,0,["enter",Ie,ae[2]]),U++,M++,We=void 0,Ge=!0}}}return v[A][1]._spread=he,M}function a(v,A){return M;function M(U){l.call(this,v(U),U),A&&A.call(this,U)}}function s(){this.stack.push({type:"fragment",children:[]})}function l(v,A,M){this.stack[this.stack.length-1].children.push(v),this.stack.push(v),this.tokenStack.push([A,M||void 0]),v.position={start:Ne(A.start),end:void 0}}function o(v){return A;function A(M){v&&v.call(this,M),u.call(this,M)}}function u(v,A){const M=this.stack.pop(),U=this.tokenStack.pop();if(U)U[0].type!==v.type&&(A?A.call(this,v,U[0]):(U[1]||Dr).call(this,v,U[0]));else throw new Error("Cannot close `"+v.type+"` ("+et({start:v.start,end:v.end})+"): it’s not open");M.position.end=Ne(v.end)}function d(){return Rn(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(v){if(this.data.expectingFirstListItemValue){const A=this.stack[this.stack.length-2];A.start=Number.parseInt(this.sliceSerialize(v),10),this.data.expectingFirstListItemValue=void 0}}function f(){const v=this.resume(),A=this.stack[this.stack.length-1];A.lang=v}function g(){const v=this.resume(),A=this.stack[this.stack.length-1];A.meta=v}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const v=this.resume(),A=this.stack[this.stack.length-1];A.value=v.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const v=this.resume(),A=this.stack[this.stack.length-1];A.value=v.replace(/(\r?\n|\r)$/g,"")}function N(v){const A=this.resume(),M=this.stack[this.stack.length-1];M.label=A,M.identifier=fe(this.sliceSerialize(v)).toLowerCase()}function _(){const v=this.resume(),A=this.stack[this.stack.length-1];A.title=v}function T(){const v=this.resume(),A=this.stack[this.stack.length-1];A.url=v}function I(v){const A=this.stack[this.stack.length-1];if(!A.depth){const M=this.sliceSerialize(v).length;A.depth=M}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function R(v){const A=this.stack[this.stack.length-1];A.depth=this.sliceSerialize(v).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function z(v){const M=this.stack[this.stack.length-1].children;let U=M[M.length-1];(!U||U.type!=="text")&&(U=Qs(),U.position={start:Ne(v.start),end:void 0},M.push(U)),this.stack.push(U)}function y(v){const A=this.stack.pop();A.value+=this.sliceSerialize(v),A.position.end=Ne(v.end)}function P(v){const A=this.stack[this.stack.length-1];if(this.data.atHardBreak){const M=A.children[A.children.length-1];M.position.end=Ne(v.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(A.type)&&(z.call(this,v),y.call(this,v))}function L(){this.data.atHardBreak=!0}function j(){const v=this.resume(),A=this.stack[this.stack.length-1];A.value=v}function C(){const v=this.resume(),A=this.stack[this.stack.length-1];A.value=v}function D(){const v=this.resume(),A=this.stack[this.stack.length-1];A.value=v}function H(){const v=this.stack[this.stack.length-1];if(this.data.inReference){const A=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=A,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function Y(){const v=this.stack[this.stack.length-1];if(this.data.inReference){const A=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=A,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function J(v){const A=this.sliceSerialize(v),M=this.stack[this.stack.length-2];M.label=Hc(A),M.identifier=fe(A).toLowerCase()}function oe(){const v=this.stack[this.stack.length-1],A=this.resume(),M=this.stack[this.stack.length-1];if(this.data.inReference=!0,M.type==="link"){const U=v.children;M.children=U}else M.alt=A}function b(){const v=this.resume(),A=this.stack[this.stack.length-1];A.url=v}function se(){const v=this.resume(),A=this.stack[this.stack.length-1];A.title=v}function ce(){this.data.inReference=void 0}function p(){this.data.referenceType="collapsed"}function O(v){const A=this.resume(),M=this.stack[this.stack.length-1];M.label=A,M.identifier=fe(this.sliceSerialize(v)).toLowerCase(),this.data.referenceType="full"}function ne(v){this.data.characterReferenceType=v.type}function Q(v){const A=this.sliceSerialize(v),M=this.data.characterReferenceType;let U;M?(U=Ki(A,M==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):U=In(A);const W=this.stack[this.stack.length-1];W.value+=U}function ee(v){const A=this.stack.pop();A.position.end=Ne(v.end)}function _e(v){y.call(this,v);const A=this.stack[this.stack.length-1];A.url=this.sliceSerialize(v)}function De(v){y.call(this,v);const A=this.stack[this.stack.length-1];A.url="mailto:"+this.sliceSerialize(v)}function Re(){return{type:"blockquote",children:[]}}function ct(){return{type:"code",lang:null,meta:null,value:""}}function Hs(){return{type:"inlineCode",value:""}}function Vs(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Us(){return{type:"emphasis",children:[]}}function Wn(){return{type:"heading",depth:0,children:[]}}function Gn(){return{type:"break"}}function Yn(){return{type:"html",value:""}}function qs(){return{type:"image",title:null,url:"",alt:null}}function Qn(){return{type:"link",title:null,url:"",children:[]}}function Jn(v){return{type:"list",ordered:v.type==="listOrdered",start:null,spread:v._spread,children:[]}}function Ws(v){return{type:"listItem",spread:v._spread,checked:null,children:[]}}function Gs(){return{type:"paragraph",children:[]}}function Ys(){return{type:"strong",children:[]}}function Qs(){return{type:"text",value:""}}function Js(){return{type:"thematicBreak"}}}function Ne(e){return{line:e.line,column:e.column,offset:e.offset}}function cs(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?cs(e,r):Wc(e,r)}}function Wc(e,t){let n;for(n in t)if(us.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Dr(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+et({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+et({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+et({start:t.start,end:t.end})+") is still open")}function Gc(e){const t=this;t.parser=n;function n(r){return Uc(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Yc(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Qc(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
135
+ `}]}function Jc(e,t){const n=t.value?t.value+`
136
+ `:"",r={};t.lang&&(r.className=["language-"+t.lang]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Xc(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Zc(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Kc(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=qe(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let s,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=a+1,l+=1,e.footnoteCounts.set(r,l);const o={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,o);const u={type:"element",tagName:"sup",properties:{},children:[o]};return e.patch(t,u),e.applyData(t,u)}function eh(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function th(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function hs(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=r:i.push({type:"text",value:r}),i}function nh(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return hs(e,t);const i={src:qe(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function rh(e,t){const n={src:qe(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function ih(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function sh(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return hs(e,t);const i={href:qe(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function ah(e,t){const n={href:qe(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function lh(e,t,n){const r=e.all(t),i=n?oh(n):ds(t),a={},s=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(i||l!==0||d.type!=="element"||d.tagName!=="p")&&s.push({type:"text",value:`
137
+ `}),d.type==="element"&&d.tagName==="p"&&!i?s.push(...d.children):s.push(d)}const o=r[r.length-1];o&&(i||o.type!=="element"||o.tagName!=="p")&&s.push({type:"text",value:`
138
+ `});const u={type:"element",tagName:"li",properties:a,children:s};return e.patch(t,u),e.applyData(t,u)}function oh(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=ds(n[r])}return t}function ds(e){const t=e.spread;return t??e.children.length>1}function uh(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const s=r[i];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function ch(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hh(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function dh(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fh(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),i.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Tn(t.children[1]),o=qi(t.children[t.children.length-1]);l&&o&&(s.position={start:l,end:o}),i.push(s)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function mh(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,l=s?s.length:t.children.length;let o=-1;const u=[];for(;++o<l;){const h=t.children[o],m={},f=s?s[o]:void 0;f&&(m.align=f);let g={type:"element",tagName:a,properties:m,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function ph(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Rr=9,Ir=32;function gh(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const a=[];for(;r;)a.push(Fr(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Fr(t.slice(i),i>0,!1)),a.join("")}function Fr(e,t,n){let r=0,i=e.length;if(t){let a=e.codePointAt(r);for(;a===Rr||a===Ir;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(i-1);for(;a===Rr||a===Ir;)i--,a=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function xh(e,t){const n={type:"text",value:gh(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function bh(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const yh={blockquote:Yc,break:Qc,code:Jc,delete:Xc,emphasis:Zc,footnoteReference:Kc,heading:eh,html:th,imageReference:nh,image:rh,inlineCode:ih,linkReference:sh,link:ah,listItem:lh,list:uh,paragraph:ch,root:hh,strong:dh,table:fh,tableCell:ph,tableRow:mh,text:xh,thematicBreak:bh,toml:dt,yaml:dt,definition:dt,footnoteDefinition:dt};function dt(){}const fs=-1,Dt=0,nt=1,Ct=2,On=3,zn=4,Mn=5,Bn=6,ms=7,ps=8,Or=typeof self=="object"?self:globalThis,wh=(e,t)=>{const n=(i,a)=>(e.set(a,i),i),r=i=>{if(e.has(i))return e.get(i);const[a,s]=t[i];switch(a){case Dt:case fs:return n(s,i);case nt:{const l=n([],i);for(const o of s)l.push(r(o));return l}case Ct:{const l=n({},i);for(const[o,u]of s)l[r(o)]=r(u);return l}case On:return n(new Date(s),i);case zn:{const{source:l,flags:o}=s;return n(new RegExp(l,o),i)}case Mn:{const l=n(new Map,i);for(const[o,u]of s)l.set(r(o),r(u));return l}case Bn:{const l=n(new Set,i);for(const o of s)l.add(r(o));return l}case ms:{const{name:l,message:o}=s;return n(new Or[l](o),i)}case ps:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:l}=new Uint8Array(s);return n(new DataView(l),s)}}return n(new Or[a](s),i)};return r},zr=e=>wh(new Map,e)(0),Oe="",{toString:kh}={},{keys:_h}=Object,Xe=e=>{const t=typeof e;if(t!=="object"||!e)return[Dt,t];const n=kh.call(e).slice(8,-1);switch(n){case"Array":return[nt,Oe];case"Object":return[Ct,Oe];case"Date":return[On,Oe];case"RegExp":return[zn,Oe];case"Map":return[Mn,Oe];case"Set":return[Bn,Oe];case"DataView":return[nt,n]}return n.includes("Array")?[nt,n]:n.includes("Error")?[ms,n]:[Ct,n]},ft=([e,t])=>e===Dt&&(t==="function"||t==="symbol"),Nh=(e,t,n,r)=>{const i=(s,l)=>{const o=r.push(s)-1;return n.set(l,o),o},a=s=>{if(n.has(s))return n.get(s);let[l,o]=Xe(s);switch(l){case Dt:{let d=s;switch(o){case"bigint":l=ps,d=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+o);d=null;break;case"undefined":return i([fs],s)}return i([l,d],s)}case nt:{if(o){let m=s;return o==="DataView"?m=new Uint8Array(s.buffer):o==="ArrayBuffer"&&(m=new Uint8Array(s)),i([o,[...m]],s)}const d=[],h=i([l,d],s);for(const m of s)d.push(a(m));return h}case Ct:{if(o)switch(o){case"BigInt":return i([o,s.toString()],s);case"Boolean":case"Number":case"String":return i([o,s.valueOf()],s)}if(t&&"toJSON"in s)return a(s.toJSON());const d=[],h=i([l,d],s);for(const m of _h(s))(e||!ft(Xe(s[m])))&&d.push([a(m),a(s[m])]);return h}case On:return i([l,s.toISOString()],s);case zn:{const{source:d,flags:h}=s;return i([l,{source:d,flags:h}],s)}case Mn:{const d=[],h=i([l,d],s);for(const[m,f]of s)(e||!(ft(Xe(m))||ft(Xe(f))))&&d.push([a(m),a(f)]);return h}case Bn:{const d=[],h=i([l,d],s);for(const m of s)(e||!ft(Xe(m)))&&d.push(a(m));return h}}const{message:u}=s;return i([l,{name:o,message:u}],s)};return a},Mr=(e,{json:t,lossy:n}={})=>{const r=[];return Nh(!(t||n),!!t,new Map,r)(e),r},Et=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?zr(Mr(e,t)):structuredClone(e):(e,t)=>zr(Mr(e,t));function Sh(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function vh(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function jh(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Sh,r=e.options.footnoteBackLabel||vh,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let o=-1;for(;++o<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[o]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),m=qe(h.toLowerCase());let f=0;const g=[],w=e.footnoteCounts.get(h);for(;w!==void 0&&++f<=w;){g.length>0&&g.push({type:"text",value:" "});let N=typeof n=="string"?n:n(o,f);typeof N=="string"&&(N={type:"text",value:N}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(o,f),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const S=d[d.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const N=S.children[S.children.length-1];N&&N.type==="text"?N.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...g)}else d.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,x),l.push(x)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Et(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
139
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
140
+ `}]}}const Rt=(function(e){if(e==null)return Th;if(typeof e=="function")return It(e);if(typeof e=="object")return Array.isArray(e)?Ch(e):Eh(e);if(typeof e=="string")return Ah(e);throw new Error("Expected function, string, or object as test")});function Ch(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Rt(e[n]);return It(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function Eh(e){const t=e;return It(n);function n(r){const i=r;let a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function Ah(e){return It(t);function t(n){return n&&n.type===e}}function It(e){return t;function t(n,r,i){return!!(Ph(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Th(){return!0}function Ph(e){return e!==null&&typeof e=="object"&&"type"in e}const gs=[],Lh=!0,un=!1,Dh="skip";function xs(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const a=Rt(i),s=r?-1:1;l(e,void 0,[])();function l(o,u,d){const h=o&&typeof o=="object"?o:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(o.type+(f?"<"+f+">":""))+")"})}return m;function m(){let f=gs,g,w,S;if((!t||a(o,u,d[d.length-1]||void 0))&&(f=Rh(n(o,d)),f[0]===un))return f;if("children"in o&&o.children){const x=o;if(x.children&&f[0]!==Dh)for(w=(r?x.children.length:-1)+s,S=d.concat(x);w>-1&&w<x.children.length;){const N=x.children[w];if(g=l(N,w,S)(),g[0]===un)return g;w=typeof g[1]=="number"?g[1]:w+s}}return f}}}function Rh(e){return Array.isArray(e)?e:typeof e=="number"?[Lh,e]:e==null?gs:[e]}function $n(e,t,n,r){let i,a,s;typeof t=="function"&&typeof n!="function"?(a=void 0,s=t,i=n):(a=t,s=n,i=r),xs(e,a,l,i);function l(o,u){const d=u[u.length-1],h=d?d.children.indexOf(o):void 0;return s(o,h,d)}}const cn={}.hasOwnProperty,Ih={};function Fh(e,t){const n=t||Ih,r=new Map,i=new Map,a=new Map,s={...yh,...n.handlers},l={all:u,applyData:zh,definitionById:r,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:s,one:o,options:n,patch:Oh,wrap:Bh};return $n(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:i,m=String(d.identifier).toUpperCase();h.has(m)||h.set(m,d)}}),l;function o(d,h){const m=d.type,f=l.handlers[m];if(cn.call(l.handlers,m)&&f)return f(l,d,h);if(l.options.passThrough&&l.options.passThrough.includes(m)){if("children"in d){const{children:w,...S}=d,x=Et(S);return x.children=l.all(d),x}return Et(d)}return(l.options.unknownHandler||Mh)(l,d,h)}function u(d){const h=[];if("children"in d){const m=d.children;let f=-1;for(;++f<m.length;){const g=l.one(m[f],d);if(g){if(f&&m[f-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Br(g.value)),!Array.isArray(g)&&g.type==="element")){const w=g.children[0];w&&w.type==="text"&&(w.value=Br(w.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function Oh(e,t){e.position&&(t.position=vo(e))}function zh(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&a&&Object.assign(n.properties,Et(a)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function Mh(e,t){const n=t.data||{},r="value"in t&&!(cn.call(n,"hProperties")||cn.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Bh(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
141
+ `});++r<e.length;)r&&n.push({type:"text",value:`
142
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
143
+ `}),n}function Br(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function $r(e,t){const n=Fh(e,t),r=n.one(e,void 0),i=jh(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&a.children.push({type:"text",value:`
144
+ `},i),a}function $h(e,t){return e&&"run"in e?async function(n,r){const i=$r(n,{file:r,...t});await e.run(i,r)}:function(n,r){return $r(n,{file:r,...e||t})}}function Hr(e){if(e)throw e}var Ut,Vr;function Hh(){if(Vr)return Ut;Vr=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},a=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!h)return!1;var m;for(m in u);return typeof m>"u"||e.call(u,m)},s=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return Ut=function o(){var u,d,h,m,f,g,w=arguments[0],S=1,x=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});S<x;++S)if(u=arguments[S],u!=null)for(d in u)h=l(w,d),m=l(u,d),w!==m&&(N&&m&&(a(m)||(f=i(m)))?(f?(f=!1,g=h&&i(h)?h:[]):g=h&&a(h)?h:{},s(w,{name:d,newValue:o(N,g,m)})):typeof m<"u"&&s(w,{name:d,newValue:m}));return w},Ut}var Vh=Hh();const qt=ui(Vh);function hn(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Uh(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);l(null,...i);function l(o,...u){const d=e[++a];let h=-1;if(o){s(o);return}for(;++h<i.length;)(u[h]===null||u[h]===void 0)&&(u[h]=i[h]);i=u,d?qh(d,l)(...u):s(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function qh(e,t){let n;return r;function r(...s){const l=e.length>s.length;let o;l&&s.push(i);try{o=e.apply(this,s)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(o&&o.then&&typeof o.then=="function"?o.then(a,i):o instanceof Error?i(o):a(o))}function i(s,...l){n||(n=!0,t(s,...l))}function a(s){i(null,s)}}const me={basename:Wh,dirname:Gh,extname:Yh,join:Qh,sep:"/"};function Wh(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ut(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else s<0&&(a=!0,s=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Gh(e){if(ut(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Yh(e){ut(e);let t=e.length,n=-1,r=0,i=-1,a=0,s;for(;t--;){const l=e.codePointAt(t);if(l===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),l===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Qh(...e){let t=-1,n;for(;++t<e.length;)ut(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Jh(n)}function Jh(e){ut(e);const t=e.codePointAt(0)===47;let n=Xh(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Xh(e,t){let n="",r=0,i=-1,a=0,s=-1,l,o;for(;++s<=e.length;){if(s<e.length)l=e.codePointAt(s);else{if(l===47)break;l=47}if(l===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(o=n.lastIndexOf("/"),o!==n.length-1){o<0?(n="",r=0):(n=n.slice(0,o),r=n.length-1-n.lastIndexOf("/")),i=s,a=0;continue}}else if(n.length>0){n="",r=0,i=s,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else l===46&&a>-1?a++:a=-1}return n}function ut(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Zh={cwd:Kh};function Kh(){return"/"}function dn(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ed(e){if(typeof e=="string")e=new URL(e);else if(!dn(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return td(e)}function td(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Wt=["history","path","basename","stem","extname","dirname"];class bs{constructor(t){let n;t?dn(t)?n={path:t}:typeof t=="string"||nd(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Zh.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Wt.length;){const a=Wt[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)Wt.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?me.basename(this.path):void 0}set basename(t){Yt(t,"basename"),Gt(t,"basename"),this.path=me.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?me.dirname(this.path):void 0}set dirname(t){Ur(this.basename,"dirname"),this.path=me.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?me.extname(this.path):void 0}set extname(t){if(Gt(t,"extname"),Ur(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=me.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){dn(t)&&(t=ed(t)),Yt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?me.basename(this.path,this.extname):void 0}set stem(t){Yt(t,"stem"),Gt(t,"stem"),this.path=me.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new K(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Gt(e,t){if(e&&e.includes(me.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+me.sep+"`")}function Yt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ur(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function nd(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const rd=(function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),id={}.hasOwnProperty;class Hn extends rd{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Uh()}copy(){const t=new Hn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(qt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Xt("data",this.frozen),this.namespace[t]=n,this):id.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Xt("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=mt(t),r=this.parser||this.Parser;return Qt("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Qt("process",this.parser||this.Parser),Jt("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,s){const l=mt(t),o=r.parse(l);r.run(o,l,function(d,h,m){if(d||!h||!m)return u(d);const f=h,g=r.stringify(f,m);ld(g)?m.value=g:m.result=g,u(d,m)});function u(d,h){d||!h?s(d):a?a(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Qt("processSync",this.parser||this.Parser),Jt("processSync",this.compiler||this.Compiler),this.process(t,i),Wr("processSync","process",n),r;function i(a,s){n=!0,Hr(a),r=s}}run(t,n,r){qr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(s,l){const o=mt(n);i.run(t,o,u);function u(d,h,m){const f=h||t;d?l(d):s?s(f):r(void 0,f,m)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),Wr("runSync","run",r),i;function a(s,l){Hr(s),i=l,r=!0}}stringify(t,n){this.freeze();const r=mt(n),i=this.compiler||this.Compiler;return Jt("stringify",i),qr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Xt("use",this.frozen),t!=null)if(typeof t=="function")o(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(u){if(typeof u=="function")o(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;o(d,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(i.settings=qt(!0,i.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];a(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function o(u,d){let h=-1,m=-1;for(;++h<r.length;)if(r[h][0]===u){m=h;break}if(m===-1)r.push([u,...d]);else if(d.length>0){let[f,...g]=d;const w=r[m][1];hn(w)&&hn(f)&&(f=qt(!0,w,f)),r[m]=[u,f,...g]}}}}const sd=new Hn().freeze();function Qt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Jt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Xt(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function qr(e){if(!hn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Wr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function mt(e){return ad(e)?e:new bs(e)}function ad(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ld(e){return typeof e=="string"||od(e)}function od(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ud="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Gr=[],Yr={allowDangerousHtml:!0},cd=/^(https?|ircs?|mailto|xmpp)$/i,hd=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function dd(e){const t=fd(e),n=md(e);return pd(t.runSync(t.parse(n),n),e)}function fd(e){const t=e.rehypePlugins||Gr,n=e.remarkPlugins||Gr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Yr}:Yr;return sd().use(Gc).use(n).use($h,r).use(t)}function md(e){const t=e.children||"",n=new bs;return typeof t=="string"&&(n.value=t),n}function pd(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,s=t.skipHtml,l=t.unwrapDisallowed,o=t.urlTransform||gd;for(const d of hd)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+ud+d.id,void 0);return $n(e,u),To(e,{Fragment:c.Fragment,components:i,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function u(d,h,m){if(d.type==="raw"&&m&&typeof h=="number")return s?m.children.splice(h,1):m.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let f;for(f in $t)if(Object.hasOwn($t,f)&&Object.hasOwn(d.properties,f)){const g=d.properties[f],w=$t[f];(w===null||w.includes(d.tagName))&&(d.properties[f]=o(String(g||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):a?a.includes(d.tagName):!1;if(!f&&r&&typeof h=="number"&&(f=!r(d,h,m)),f&&m&&typeof h=="number")return l&&d.children?m.children.splice(h,1,...d.children):m.children.splice(h,1),h}}}function gd(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||cd.test(e.slice(0,t))?e:""}function xd(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function bd(e,t,n){const i=Rt((n||{}).ignore||[]),a=yd(t);let s=-1;for(;++s<a.length;)xs(e,"text",l);function l(u,d){let h=-1,m;for(;++h<d.length;){const f=d[h],g=m?m.children:void 0;if(i(f,g?g.indexOf(f):void 0,m))return;m=f}if(m)return o(u,d)}function o(u,d){const h=d[d.length-1],m=a[s][0],f=a[s][1];let g=0;const S=h.children.indexOf(u);let x=!1,N=[];m.lastIndex=0;let _=m.exec(u.value);for(;_;){const T=_.index,I={index:_.index,input:_.input,stack:[...d,u]};let k=f(..._,I);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?m.lastIndex=T+1:(g!==T&&N.push({type:"text",value:u.value.slice(g,T)}),Array.isArray(k)?N.push(...k):k&&N.push(k),g=T+_[0].length,x=!0),!m.global)break;_=m.exec(u.value)}return x?(g<u.value.length&&N.push({type:"text",value:u.value.slice(g)}),h.children.splice(S,1,...N)):N=[u],S+N.length}}function yd(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([wd(i[0]),kd(i[1])])}return t}function wd(e){return typeof e=="string"?new RegExp(xd(e),"g"):e}function kd(e){return typeof e=="function"?e:function(){return e}}const Zt="phrasing",Kt=["autolink","link","image","label"];function _d(){return{transforms:[Ad],enter:{literalAutolink:Sd,literalAutolinkEmail:en,literalAutolinkHttp:en,literalAutolinkWww:en},exit:{literalAutolink:Ed,literalAutolinkEmail:Cd,literalAutolinkHttp:vd,literalAutolinkWww:jd}}}function Nd(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Zt,notInConstruct:Kt},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Zt,notInConstruct:Kt},{character:":",before:"[ps]",after:"\\/",inConstruct:Zt,notInConstruct:Kt}]}}function Sd(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function en(e){this.config.enter.autolinkProtocol.call(this,e)}function vd(e){this.config.exit.autolinkProtocol.call(this,e)}function jd(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Cd(e){this.config.exit.autolinkEmail.call(this,e)}function Ed(e){this.exit(e)}function Ad(e){bd(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Td],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Pd]],{ignore:["link","linkReference"]})}function Td(e,t,n,r,i){let a="";if(!ys(i)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!Ld(n)))return!1;const s=Dd(n+r);if(!s[0])return!1;const l={type:"link",title:null,url:a+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function Pd(e,t,n,r){return!ys(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Ld(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Dd(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=sr(e,"(");let a=sr(e,")");for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function ys(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Te(n)||Pt(n))&&(!t||n!==47)}ws.peek=Hd;function Rd(){this.buffer()}function Id(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Fd(){this.buffer()}function Od(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function zd(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fe(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Md(e){this.exit(e)}function Bd(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fe(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $d(e){this.exit(e)}function Hd(){return"["}function ws(e,t,n,r){const i=n.createTracker(r);let a=i.move("[^");const s=n.enter("footnoteReference"),l=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),l(),s(),a+=i.move("]"),a}function Vd(){return{enter:{gfmFootnoteCallString:Rd,gfmFootnoteCall:Id,gfmFootnoteDefinitionLabelString:Fd,gfmFootnoteDefinition:Od},exit:{gfmFootnoteCallString:zd,gfmFootnoteCall:Md,gfmFootnoteDefinitionLabelString:Bd,gfmFootnoteDefinition:$d}}}function Ud(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ws},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,a,s){const l=a.createTracker(s);let o=l.move("[^");const u=a.enter("footnoteDefinition"),d=a.enter("label");return o+=l.move(a.safe(a.associationId(r),{before:o,after:"]"})),d(),o+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),o+=l.move((t?`
145
+ `:" ")+a.indentLines(a.containerFlow(r,l.current()),t?ks:qd))),u(),o}}function qd(e,t,n){return t===0?e:ks(e,t,n)}function ks(e,t,n){return(n?"":" ")+e}const Wd=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];_s.peek=Xd;function Gd(){return{canContainEols:["delete"],enter:{strikethrough:Qd},exit:{strikethrough:Jd}}}function Yd(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Wd}],handlers:{delete:_s}}}function Qd(e){this.enter({type:"delete",children:[]},e)}function Jd(e){this.exit(e)}function _s(e,t,n,r){const i=n.createTracker(r),a=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),a(),s}function Xd(){return"~"}function Zd(e){return e.length}function Kd(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Zd,a=[],s=[],l=[],o=[];let u=0,d=-1;for(;++d<e.length;){const w=[],S=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const N=ef(e[d][x]);if(n.alignDelimiters!==!1){const _=i(N);S[x]=_,(o[x]===void 0||_>o[x])&&(o[x]=_)}w.push(N)}s[d]=w,l[d]=S}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<u;)a[h]=Qr(r[h]);else{const w=Qr(r);for(;++h<u;)a[h]=w}h=-1;const m=[],f=[];for(;++h<u;){const w=a[h];let S="",x="";w===99?(S=":",x=":"):w===108?S=":":w===114&&(x=":");let N=n.alignDelimiters===!1?1:Math.max(1,o[h]-S.length-x.length);const _=S+"-".repeat(N)+x;n.alignDelimiters!==!1&&(N=S.length+N+x.length,N>o[h]&&(o[h]=N),f[h]=N),m[h]=_}s.splice(1,0,m),l.splice(1,0,f),d=-1;const g=[];for(;++d<s.length;){const w=s[d],S=l[d];h=-1;const x=[];for(;++h<u;){const N=w[h]||"";let _="",T="";if(n.alignDelimiters!==!1){const I=o[h]-(S[h]||0),k=a[h];k===114?_=" ".repeat(I):k===99?I%2?(_=" ".repeat(I/2+.5),T=" ".repeat(I/2-.5)):(_=" ".repeat(I/2),T=_):T=" ".repeat(I)}n.delimiterStart!==!1&&!h&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||h)&&x.push(" "),n.alignDelimiters!==!1&&x.push(_),x.push(N),n.alignDelimiters!==!1&&x.push(T),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&x.push("|")}g.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return g.join(`
146
+ `)}function ef(e){return e==null?"":String(e)}function Qr(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function tf(e,t,n,r){const i=n.enter("blockquote"),a=n.createTracker(r);a.move("> "),a.shift(2);const s=n.indentLines(n.containerFlow(e,a.current()),nf);return i(),s}function nf(e,t,n){return">"+(n?"":" ")+e}function rf(e,t){return Jr(e,t.inConstruct,!0)&&!Jr(e,t.notInConstruct,!1)}function Jr(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Xr(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
147
+ `&&rf(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
148
+ `}function sf(e,t){const n=String(e);let r=n.indexOf(t),i=r,a=0,s=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++a>s&&(s=a):a=1,i=r+t.length,r=n.indexOf(t,i);return s}function af(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function lf(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function of(e,t,n,r){const i=lf(n),a=e.value||"",s=i==="`"?"GraveAccent":"Tilde";if(af(e,n)){const h=n.enter("codeIndented"),m=n.indentLines(a,uf);return h(),m}const l=n.createTracker(r),o=i.repeat(Math.max(sf(a,i)+1,3)),u=n.enter("codeFenced");let d=l.move(o);if(e.lang){const h=n.enter(`codeFencedLang${s}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${s}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:`
149
+ `,encode:["`"],...l.current()})),h()}return d+=l.move(`
150
+ `),a&&(d+=l.move(a+`
151
+ `)),d+=l.move(o),u(),d}function uf(e,t,n){return(n?"":" ")+e}function Vn(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function cf(e,t,n,r){const i=Vn(n),a=i==='"'?"Quote":"Apostrophe",s=n.enter("definition");let l=n.enter("label");const o=n.createTracker(r);let u=o.move("[");return u+=o.move(n.safe(n.associationId(e),{before:u,after:"]",...o.current()})),u+=o.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":`
152
+ `,...o.current()}))),l(),e.title&&(l=n.enter(`title${a}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),s(),u}function hf(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function at(e){return"&#x"+e.toString(16).toUpperCase()+";"}function At(e,t,n){const r=Ve(e),i=Ve(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ns.peek=df;function Ns(e,t,n,r){const i=hf(n),a=n.enter("emphasis"),s=n.createTracker(r),l=s.move(i);let o=s.move(n.containerPhrasing(e,{after:i,before:l,...s.current()}));const u=o.charCodeAt(0),d=At(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(o=at(u)+o.slice(1));const h=o.charCodeAt(o.length-1),m=At(r.after.charCodeAt(0),h,i);m.inside&&(o=o.slice(0,-1)+at(h));const f=s.move(i);return a(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+o+f}function df(e,t,n){return n.options.emphasis||"*"}function ff(e,t){let n=!1;return $n(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,un}),!!((!e.depth||e.depth<3)&&Rn(e)&&(t.options.setext||n))}function mf(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(ff(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),m=n.containerPhrasing(e,{...a.current(),before:`
153
+ `,after:`
154
+ `});return h(),d(),m+`
155
+ `+(i===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
156
+ `))+1))}const s="#".repeat(i),l=n.enter("headingAtx"),o=n.enter("phrasing");a.move(s+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
157
+ `,...a.current()});return/^[\t ]/.test(u)&&(u=at(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,n.options.closeAtx&&(u+=" "+s),o(),l(),u}Ss.peek=pf;function Ss(e){return e.value||""}function pf(){return"<"}vs.peek=gf;function vs(e,t,n,r){const i=Vn(n),a=i==='"'?"Quote":"Apostrophe",s=n.enter("image");let l=n.enter("label");const o=n.createTracker(r);let u=o.move("![");return u+=o.move(n.safe(e.alt,{before:u,after:"]",...o.current()})),u+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${a}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),s(),u}function gf(){return"!"}js.peek=xf;function js(e,t,n,r){const i=e.referenceType,a=n.enter("imageReference");let s=n.enter("label");const l=n.createTracker(r);let o=l.move("![");const u=n.safe(e.alt,{before:o,after:"]",...l.current()});o+=l.move(u+"]["),s();const d=n.stack;n.stack=[],s=n.enter("reference");const h=n.safe(n.associationId(e),{before:o,after:"]",...l.current()});return s(),n.stack=d,a(),i==="full"||!u||u!==h?o+=l.move(h+"]"):i==="shortcut"?o=o.slice(0,-1):o+=l.move("]"),o}function xf(){return"!"}Cs.peek=bf;function Cs(e,t,n){let r=e.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const s=n.unsafe[a],l=n.compilePattern(s);let o;if(s.atBreak)for(;o=l.exec(r);){let u=o.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(o.index+1)}}return i+r+i}function bf(){return"`"}function Es(e,t){const n=Rn(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}As.peek=yf;function As(e,t,n,r){const i=Vn(n),a=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let l,o;if(Es(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let h=s.move("<");return h+=s.move(n.containerPhrasing(e,{before:h,after:">",...s.current()})),h+=s.move(">"),l(),n.stack=d,h}l=n.enter("link"),o=n.enter("label");let u=s.move("[");return u+=s.move(n.containerPhrasing(e,{before:u,after:"](",...s.current()})),u+=s.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(n.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(o=n.enter("destinationRaw"),u+=s.move(n.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),o(),e.title&&(o=n.enter(`title${a}`),u+=s.move(" "+i),u+=s.move(n.safe(e.title,{before:u,after:i,...s.current()})),u+=s.move(i),o()),u+=s.move(")"),l(),u}function yf(e,t,n){return Es(e,n)?"<":"["}Ts.peek=wf;function Ts(e,t,n,r){const i=e.referenceType,a=n.enter("linkReference");let s=n.enter("label");const l=n.createTracker(r);let o=l.move("[");const u=n.containerPhrasing(e,{before:o,after:"]",...l.current()});o+=l.move(u+"]["),s();const d=n.stack;n.stack=[],s=n.enter("reference");const h=n.safe(n.associationId(e),{before:o,after:"]",...l.current()});return s(),n.stack=d,a(),i==="full"||!u||u!==h?o+=l.move(h+"]"):i==="shortcut"?o=o.slice(0,-1):o+=l.move("]"),o}function wf(){return"["}function Un(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function kf(e){const t=Un(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function _f(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ps(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Nf(e,t,n,r){const i=n.enter("list"),a=n.bulletCurrent;let s=e.ordered?_f(n):Un(n);const l=e.ordered?s==="."?")":".":kf(n);let o=t&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(o=!0),Ps(n)===s&&d){let h=-1;for(;++h<e.children.length;){const m=e.children[h];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){o=!0;break}}}}o&&(s=l),n.bulletCurrent=s;const u=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=a,i(),u}function Sf(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function vf(e,t,n,r){const i=Sf(n);let a=n.bulletCurrent||Un(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let s=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const l=n.createTracker(r);l.move(a+" ".repeat(s-a.length)),l.shift(s);const o=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return o(),u;function d(h,m,f){return m?(f?"":" ".repeat(s))+h:(f?a:a+" ".repeat(s-a.length))+h}}function jf(e,t,n,r){const i=n.enter("paragraph"),a=n.enter("phrasing"),s=n.containerPhrasing(e,r);return a(),i(),s}const Cf=Rt(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Ef(e,t,n,r){return(e.children.some(function(s){return Cf(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Af(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ls.peek=Tf;function Ls(e,t,n,r){const i=Af(n),a=n.enter("strong"),s=n.createTracker(r),l=s.move(i+i);let o=s.move(n.containerPhrasing(e,{after:i,before:l,...s.current()}));const u=o.charCodeAt(0),d=At(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(o=at(u)+o.slice(1));const h=o.charCodeAt(o.length-1),m=At(r.after.charCodeAt(0),h,i);m.inside&&(o=o.slice(0,-1)+at(h));const f=s.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},l+o+f}function Tf(e,t,n){return n.options.strong||"*"}function Pf(e,t,n,r){return n.safe(e.value,r)}function Lf(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Df(e,t,n){const r=(Ps(n)+(n.options.ruleSpaces?" ":"")).repeat(Lf(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Ds={blockquote:tf,break:Xr,code:of,definition:cf,emphasis:Ns,hardBreak:Xr,heading:mf,html:Ss,image:vs,imageReference:js,inlineCode:Cs,link:As,linkReference:Ts,list:Nf,listItem:vf,paragraph:jf,root:Ef,strong:Ls,text:Pf,thematicBreak:Df};function Rf(){return{enter:{table:If,tableData:Zr,tableHeader:Zr,tableRow:Of},exit:{codeText:zf,table:Ff,tableData:tn,tableHeader:tn,tableRow:tn}}}function If(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Ff(e){this.exit(e),this.data.inTable=void 0}function Of(e){this.enter({type:"tableRow",children:[]},e)}function tn(e){this.exit(e)}function Zr(e){this.enter({type:"tableCell",children:[]},e)}function zf(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Mf));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Mf(e,t){return t==="|"?t:e}function Bf(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
158
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:s,tableCell:o,tableRow:l}};function s(f,g,w,S){return u(d(f,w,S),f.align)}function l(f,g,w,S){const x=h(f,w,S),N=u([x]);return N.slice(0,N.indexOf(`
159
+ `))}function o(f,g,w,S){const x=w.enter("tableCell"),N=w.enter("phrasing"),_=w.containerPhrasing(f,{...S,before:a,after:a});return N(),x(),_}function u(f,g){return Kd(f,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(f,g,w){const S=f.children;let x=-1;const N=[],_=g.enter("table");for(;++x<S.length;)N[x]=h(S[x],g,w);return _(),N}function h(f,g,w){const S=f.children;let x=-1;const N=[],_=g.enter("tableRow");for(;++x<S.length;)N[x]=o(S[x],f,g,w);return _(),N}function m(f,g,w){let S=Ds.inlineCode(f,g,w);return w.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function $f(){return{exit:{taskListCheckValueChecked:Kr,taskListCheckValueUnchecked:Kr,paragraph:Vf}}}function Hf(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Uf}}}function Kr(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Vf(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let a=-1,s;for(;++a<i.length;){const l=i[a];if(l.type==="paragraph"){s=l;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Uf(e,t,n,r){const i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);a&&l.move(s);let o=Ds.listItem(e,t,n,{...r,...l.current()});return a&&(o=o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),o;function u(d){return d+s}}function qf(){return[_d(),Vd(),Gd(),Rf(),$f()]}function Wf(e){return{extensions:[Nd(),Ud(e),Yd(),Bf(e),Hf()]}}const Gf={tokenize:Kf,partial:!0},Rs={tokenize:em,partial:!0},Is={tokenize:tm,partial:!0},Fs={tokenize:nm,partial:!0},Yf={tokenize:rm,partial:!0},Os={name:"wwwAutolink",tokenize:Xf,previous:Ms},zs={name:"protocolAutolink",tokenize:Zf,previous:Bs},ke={name:"emailAutolink",tokenize:Jf,previous:$s},be={};function Qf(){return{text:be}}let Ee=48;for(;Ee<123;)be[Ee]=ke,Ee++,Ee===58?Ee=65:Ee===91&&(Ee=97);be[43]=ke;be[45]=ke;be[46]=ke;be[95]=ke;be[72]=[ke,zs];be[104]=[ke,zs];be[87]=[ke,Os];be[119]=[ke,Os];function Jf(e,t,n){const r=this;let i,a;return s;function s(h){return!fn(h)||!$s.call(r,r.previous)||qn(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(h))}function l(h){return fn(h)?(e.consume(h),l):h===64?(e.consume(h),o):n(h)}function o(h){return h===46?e.check(Yf,d,u)(h):h===45||h===95||Z(h)?(a=!0,e.consume(h),o):d(h)}function u(h){return e.consume(h),i=!0,o}function d(h){return a&&i&&te(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function Xf(e,t,n){const r=this;return i;function i(s){return s!==87&&s!==119||!Ms.call(r,r.previous)||qn(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Gf,e.attempt(Rs,e.attempt(Is,a),n),n)(s))}function a(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function Zf(e,t,n){const r=this;let i="",a=!1;return s;function s(h){return(h===72||h===104)&&Bs.call(r,r.previous)&&!qn(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),l):n(h)}function l(h){if(te(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),l;if(h===58){const m=i.toLowerCase();if(m==="http"||m==="https")return e.consume(h),o}return n(h)}function o(h){return h===47?(e.consume(h),a?u:(a=!0,o)):n(h)}function u(h){return h===null||jt(h)||G(h)||Te(h)||Pt(h)?n(h):e.attempt(Rs,e.attempt(Is,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function Kf(e,t,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,e.consume(s),i):s===46&&r===3?(e.consume(s),a):n(s)}function a(s){return s===null?n(s):t(s)}}function em(e,t,n){let r,i,a;return s;function s(u){return u===46||u===95?e.check(Fs,o,l)(u):u===null||G(u)||Te(u)||u!==45&&Pt(u)?o(u):(a=!0,e.consume(u),s)}function l(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),s}function o(u){return i||r||!a?n(u):t(u)}}function tm(e,t){let n=0,r=0;return i;function i(s){return s===40?(n++,e.consume(s),i):s===41&&r<n?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(Fs,t,a)(s):s===null||G(s)||Te(s)?t(s):(e.consume(s),i)}function a(s){return s===41&&r++,e.consume(s),i}}function nm(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),a):l===93?(e.consume(l),i):l===60||l===null||G(l)||Te(l)?t(l):n(l)}function i(l){return l===null||l===40||l===91||G(l)||Te(l)?t(l):r(l)}function a(l){return te(l)?s(l):n(l)}function s(l){return l===59?(e.consume(l),r):te(l)?(e.consume(l),s):n(l)}}function rm(e,t,n){return r;function r(a){return e.consume(a),i}function i(a){return Z(a)?n(a):t(a)}}function Ms(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||G(e)}function Bs(e){return!te(e)}function $s(e){return!(e===47||fn(e))}function fn(e){return e===43||e===45||e===46||e===95||Z(e)}function qn(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const im={tokenize:dm,partial:!0};function sm(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:um,continuation:{tokenize:cm},exit:hm}},text:{91:{name:"gfmFootnoteCall",tokenize:om},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:am,resolveTo:lm}}}}function am(e,t,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const o=r.events[i][1];if(o.type==="labelImage"){s=o;break}if(o.type==="gfmFootnoteCall"||o.type==="labelLink"||o.type==="label"||o.type==="image"||o.type==="link")break}return l;function l(o){if(!s||!s._balanced)return n(o);const u=fe(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?n(o):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),t(o))}}function lm(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",s,t],["exit",s,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function om(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,s;return l;function l(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),o}function o(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(a>999||h===93&&!s||h===null||h===91||G(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(fe(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return G(h)||(s=!0),a++,e.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(e.consume(h),a++,u):u(h)}}function um(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,s=0,l;return o;function o(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(s>999||g===93&&!l||g===null||g===91||G(g))return n(g);if(g===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return a=fe(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return G(g)||(l=!0),s++,e.consume(g),g===92?h:d}function h(g){return g===91||g===92||g===93?(e.consume(g),s++,d):d(g)}function m(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(a)||i.push(a),q(e,f,"gfmFootnoteDefinitionWhitespace")):n(g)}function f(g){return t(g)}}function cm(e,t,n){return e.check(ot,t,e.attempt(im,t,n))}function hm(e){e.exit("gfmFootnoteDefinition")}function dm(e,t,n){const r=this;return q(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(a):n(a)}}function fm(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,l){let o=-1;for(;++o<s.length;)if(s[o][0]==="enter"&&s[o][1].type==="strikethroughSequenceTemporary"&&s[o][1]._close){let u=o;for(;u--;)if(s[u][0]==="exit"&&s[u][1].type==="strikethroughSequenceTemporary"&&s[u][1]._open&&s[o][1].end.offset-s[o][1].start.offset===s[u][1].end.offset-s[u][1].start.offset){s[o][1].type="strikethroughSequence",s[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},s[u][1].start),end:Object.assign({},s[o][1].end)},h={type:"strikethroughText",start:Object.assign({},s[u][1].end),end:Object.assign({},s[o][1].start)},m=[["enter",d,l],["enter",s[u][1],l],["exit",s[u][1],l],["enter",h,l]],f=l.parser.constructs.insideSpan.null;f&&le(m,m.length,0,Lt(f,s.slice(u+1,o),l)),le(m,m.length,0,[["exit",h,l],["enter",s[o][1],l],["exit",s[o][1],l],["exit",d,l]]),le(s,u-1,o-u+3,m),o=u+m.length-2;break}}for(o=-1;++o<s.length;)s[o][1].type==="strikethroughSequenceTemporary"&&(s[o][1].type="data");return s}function a(s,l,o){const u=this.previous,d=this.events;let h=0;return m;function m(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?o(g):(s.enter("strikethroughSequenceTemporary"),f(g))}function f(g){const w=Ve(u);if(g===126)return h>1?o(g):(s.consume(g),h++,f);if(h<2&&!n)return o(g);const S=s.exit("strikethroughSequenceTemporary"),x=Ve(g);return S._open=!x||x===2&&!!w,S._close=!w||w===2&&!!x,l(g)}}}class mm{constructor(){this.map=[]}add(t,n,r){pm(this,t,n,r)}consume(t){if(this.map.sort(function(a,s){return a[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const a of i)t.push(a);i=r.pop()}this.map.length=0}}function pm(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function gm(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function xm(){return{flow:{null:{name:"table",tokenize:bm,resolveAll:ym}}}}function bm(e,t,n){const r=this;let i=0,a=0,s;return l;function l(y){let P=r.events.length-1;for(;P>-1;){const C=r.events[P][1].type;if(C==="lineEnding"||C==="linePrefix")P--;else break}const L=P>-1?r.events[P][1].type:null,j=L==="tableHead"||L==="tableRow"?k:o;return j===k&&r.parser.lazy[r.now().line]?n(y):j(y)}function o(y){return e.enter("tableHead"),e.enter("tableRow"),u(y)}function u(y){return y===124||(s=!0,a+=1),d(y)}function d(y){return y===null?n(y):F(y)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),f):n(y):V(y)?q(e,d,"whitespace")(y):(a+=1,s&&(s=!1,i+=1),y===124?(e.enter("tableCellDivider"),e.consume(y),e.exit("tableCellDivider"),s=!0,d):(e.enter("data"),h(y)))}function h(y){return y===null||y===124||G(y)?(e.exit("data"),d(y)):(e.consume(y),y===92?m:h)}function m(y){return y===92||y===124?(e.consume(y),h):h(y)}function f(y){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(y):(e.enter("tableDelimiterRow"),s=!1,V(y)?q(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):g(y))}function g(y){return y===45||y===58?S(y):y===124?(s=!0,e.enter("tableCellDivider"),e.consume(y),e.exit("tableCellDivider"),w):I(y)}function w(y){return V(y)?q(e,S,"whitespace")(y):S(y)}function S(y){return y===58?(a+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(y),e.exit("tableDelimiterMarker"),x):y===45?(a+=1,x(y)):y===null||F(y)?T(y):I(y)}function x(y){return y===45?(e.enter("tableDelimiterFiller"),N(y)):I(y)}function N(y){return y===45?(e.consume(y),N):y===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(y),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(y))}function _(y){return V(y)?q(e,T,"whitespace")(y):T(y)}function T(y){return y===124?g(y):y===null||F(y)?!s||i!==a?I(y):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(y)):I(y)}function I(y){return n(y)}function k(y){return e.enter("tableRow"),R(y)}function R(y){return y===124?(e.enter("tableCellDivider"),e.consume(y),e.exit("tableCellDivider"),R):y===null||F(y)?(e.exit("tableRow"),t(y)):V(y)?q(e,R,"whitespace")(y):(e.enter("data"),B(y))}function B(y){return y===null||y===124||G(y)?(e.exit("data"),R(y)):(e.consume(y),y===92?z:B)}function z(y){return y===92||y===124?(e.consume(y),B):B(y)}}function ym(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],l=!1,o=0,u,d,h;const m=new mm;for(;++n<e.length;){const f=e[n],g=f[1];f[0]==="enter"?g.type==="tableHead"?(l=!1,o!==0&&(ei(m,t,o,u,d),d=void 0,o=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,h=void 0,a=[0,0,0,0],s=[0,n+1,0,0],l&&(l=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",d,t]])),i=g.type==="tableDelimiterRow"?2:d?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],h=pt(m,t,a,i,void 0,h),a=[0,0,0,0]),s[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(s[0]=s[1],h=pt(m,t,a,i,void 0,h)),a=s,s=[a[1],n,0,0])):g.type==="tableHead"?(l=!0,o=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(o=n,a[1]!==0?(s[0]=s[1],h=pt(m,t,a,i,n,h)):s[1]!==0&&(h=pt(m,t,s,i,n,h)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(s[3]=n)}for(o!==0&&ei(m,t,o,u,d),m.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=gm(t.events,n))}return e}function pt(e,t,n,r,i,a){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(a.end=Object.assign({},ze(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const o=ze(t.events,n[1]);if(a={type:s,start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const u=ze(t.events,n[2]),d=ze(t.events,n[3]),h={type:l,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const m=t.events[n[2]],f=t.events[n[3]];if(m[1].end=Object.assign({},f[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,w=n[3]-n[2]-1;e.add(g,w,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return i!==void 0&&(a.end=Object.assign({},ze(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function ei(e,t,n,r,i){const a=[],s=ze(t.events,n);i&&(i.end=Object.assign({},s),a.push(["exit",i,t])),r.end=Object.assign({},s),a.push(["exit",r,t]),e.add(n+1,0,a)}function ze(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const wm={name:"tasklistCheck",tokenize:_m};function km(){return{text:{91:wm}}}function _m(e,t,n){const r=this;return i;function i(o){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(o):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(o),e.exit("taskListCheckMarker"),a)}function a(o){return G(o)?(e.enter("taskListCheckValueUnchecked"),e.consume(o),e.exit("taskListCheckValueUnchecked"),s):o===88||o===120?(e.enter("taskListCheckValueChecked"),e.consume(o),e.exit("taskListCheckValueChecked"),s):n(o)}function s(o){return o===93?(e.enter("taskListCheckMarker"),e.consume(o),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(o)}function l(o){return F(o)?t(o):V(o)?e.check({tokenize:Nm},t,n)(o):n(o)}}function Nm(e,t,n){return q(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Sm(e){return Zi([Qf(),sm(),fm(e),xm(),km()])}const vm={};function jm(e){const t=this,n=e||vm,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Sm(n)),a.push(qf()),s.push(Wf(n))}function gt({markdownContent:e}){const{highlighter:t}=fi(),[n,r]=E.useState(null),{toast:i}=Ue(),a=async s=>{try{await navigator.clipboard.writeText(s),r(s),setTimeout(()=>{r(null)},1500)}catch{i({title:"Failed to copy",description:"Could not copy to clipboard."})}};return c.jsx("div",{className:"markdown-code",children:c.jsx("div",{className:"prose dark:prose-invert prose-pre:py-0 prose-pre:px-6 prose-pre:bg-white dark:prose-pre:bg-gray-800 prose-code:font-mono markdown-content",children:c.jsx(dd,{remarkPlugins:[jm],components:{code({node:s,className:l,children:o,...u}){const d=(l==null?void 0:l.includes("language-"))||/\n/.test(String(o)),h=(o==null?void 0:o.toString())||"",m=document.createElement("div");return t&&(m.innerHTML=t.codeToHtml(h,{lang:"tsx",themes:{light:"github-light",dark:"github-dark"}})),d?c.jsxs("div",{className:"flex border rounded-lg relative",children:[c.jsx("div",{dangerouslySetInnerHTML:{__html:m.innerHTML},className:"flex-1 overflow-auto"}),n===h?c.jsx(rt,{size:25,className:"text-green-500 hover:bg-gray-100 p-1 mt-1 mr-1 cursor-pointer rounded-md absolute top-2 right-2"}):c.jsx(vt,{onClick:()=>a(h),size:25,className:"text-slate-500 hover:bg-gray-100 p-1 mt-1 mr-1 cursor-pointer rounded-md absolute top-2 right-2"})]}):c.jsx("span",{className:"bg-gray-100 dark:bg-gray-800 text-gray-800 font-semibold font-mono dark:text-gray-200 px-1 py-0.5 rounded",children:o})}},children:e})})})}function Cm({importantFiles:e=[],aiReviewText:t,aiReviewRequested:n,onRequestAiReview:r,onRequestAiDescriptionUpdate:i,isFetched:a=!1,onEditClicked:s,onLicenseFileRequested:l,pkg:o}){const[u,d]=E.useState(null),[h,m]=E.useState("copy"),{session:f}=pe(),{organization:g}=Va(o!=null&&o.owner_org_id?{orgId:String(o.owner_org_id)}:o!=null&&o.owner_github_username?{github_handle:o.owner_github_username}:{}),w=E.useMemo(()=>!!(o!=null&&o.ai_description||o!=null&&o.ai_usage_instructions),[o==null?void 0:o.ai_description,o==null?void 0:o.ai_usage_instructions]),S=E.useMemo(()=>!!t,[t]),x=E.useMemo(()=>(f==null?void 0:f.github_username)===(o==null?void 0:o.owner_github_username),[f==null?void 0:f.github_username,o==null?void 0:o.owner_github_username]),N=E.useMemo(()=>{var p;return x||(g?(p=g.user_permissions)==null?void 0:p.can_manage_package:!1)},[x,g]),_=E.useCallback(p=>{const O=p.toLowerCase();return O==="license"||O.endsWith("/license")||O==="license.txt"||O.endsWith("/license.txt")||O==="license.md"||O.endsWith("/license.md")},[]),T=E.useCallback(p=>{const O=p.toLowerCase();return O.endsWith("readme.md")||O.endsWith("readme")},[]),I=E.useCallback(p=>p.endsWith(".js")||p.endsWith(".jsx")||p.endsWith(".ts")||p.endsWith(".tsx"),[]),k=E.useCallback(p=>p.endsWith(".md")||T(p),[T]),R=E.useCallback(p=>{const O=p.split("/");return O[O.length-1]},[]),B=E.useCallback(p=>I(p)?c.jsx(pn,{className:"h-3.5 w-3.5 mr-1.5"}):c.jsx(rn,{className:"h-3.5 w-3.5 mr-1.5"}),[I]),z=E.useMemo(()=>{const p=[];return w&&p.push({type:"ai",filePath:null,label:"Description",icon:c.jsx(ht,{className:"h-3.5 w-3.5 mr-1.5"})}),(S||N)&&p.push({type:"ai-review",filePath:null,label:"AI Review",icon:c.jsx(ht,{className:"h-3.5 w-3.5 mr-1.5"})}),e.forEach(O=>{p.push({type:"file",filePath:O.file_path,label:R(O.file_path),icon:B(O.file_path)})}),p},[w,S,e,R,B]),y=E.useCallback(()=>{if(!a||z.length===0)return null;const p=z.find(ee=>ee.type==="file"&&ee.filePath&&T(ee.filePath));if(p)return p;const O=z.find(ee=>ee.type==="ai"&&w);if(O)return O;const ne=z.find(ee=>ee.type==="ai-review"&&S);if(ne)return ne;const Q=z.find(ee=>ee.type==="file");return Q||null},[a,z,T]),P=E.useCallback(p=>{if(p.type==="file"&&p.filePath&&!e.some(ne=>ne.file_path===p.filePath)){const ne=y();d(ne);return}d(p)},[e,y]);E.useEffect(()=>{if(l&&e.length>0){const p=z.find(O=>O.type==="file"&&O.filePath&&_(O.filePath));if(p)d(p);else{const O=y();d(O)}}},[l,e,z,_,y]),E.useEffect(()=>{if(u===null&&a){const p=y();d(p)}},[u,a,y]),E.useEffect(()=>{if((u==null?void 0:u.type)==="file"&&u.filePath&&!e.some(O=>O.file_path===u.filePath)){const O=y();d(O)}},[u,e,y]);const{circuitJson:L}=Le(),j=E.useMemo(()=>(u==null?void 0:u.type)!=="file"||!u.filePath?null:e.find(p=>p.file_path===u.filePath),[u,e]),{data:C,isFetched:D}=mi(j?{file_path:j.file_path,package_release_id:j.package_release_id}:null,{keepPreviousData:!0,staleTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),H=(C==null?void 0:C.content_text)||"",Y=()=>{let p="";if((u==null?void 0:u.type)==="ai-review"&&t)p=t;else if((u==null?void 0:u.type)==="ai"&&(o!=null&&o.ai_description||o!=null&&o.ai_usage_instructions)){const O=[];o!=null&&o.ai_description&&O.push(`# Description
160
+
161
+ ${o==null?void 0:o.ai_description}`),o!=null&&o.ai_usage_instructions&&O.push(`# Instructions
162
+
163
+ ${o==null?void 0:o.ai_usage_instructions}`),p=O.join(`
164
+
165
+ `)}else(u==null?void 0:u.type)==="file"&&H&&(p=H);p&&(navigator.clipboard.writeText(p),m("copied"),setTimeout(()=>m("copy"),500))},J=E.useCallback(()=>!(o!=null&&o.ai_description)&&!(o!=null&&o.ai_usage_instructions)?c.jsx("div",{className:"flex flex-col items-center justify-center py-8 px-4",children:c.jsxs("div",{className:"text-center space-y-4 max-w-md",children:[c.jsx("div",{className:"flex justify-center",children:c.jsx("div",{className:"w-12 h-12 bg-gray-200 rounded-full flex items-center justify-center",children:c.jsx(nn,{className:"h-6 w-6 text-gray-600 animate-spin"})})}),c.jsx("div",{className:"space-y-2",children:c.jsx("p",{className:"text-sm text-gray-600",children:"Our AI is generating a description for your package. This usually takes a few minutes. Please check back shortly."})})]})}):c.jsxs("div",{className:"markdown-content",children:[(o==null?void 0:o.ai_description)&&c.jsxs("div",{className:"mb-6",children:[c.jsx("h3",{className:"font-semibold text-lg mb-2",children:"Description"}),c.jsx(gt,{markdownContent:o==null?void 0:o.ai_description})]}),(o==null?void 0:o.ai_usage_instructions)&&c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-lg mb-2",children:"Instructions"}),c.jsx(gt,{markdownContent:o==null?void 0:o.ai_usage_instructions})]})]}),[o==null?void 0:o.ai_description,o==null?void 0:o.ai_usage_instructions,N,i]),oe=E.useCallback(()=>!t&&!n?c.jsx("div",{className:"flex flex-col items-center justify-center py-8 px-4",children:c.jsxs("div",{className:"text-center space-y-4 max-w-md",children:[c.jsx("div",{className:"flex justify-center",children:c.jsx("div",{className:"w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center",children:c.jsx(ht,{className:"h-6 w-6 text-blue-600"})})}),c.jsx("div",{className:"space-y-2",children:c.jsx("p",{className:"text-sm text-gray-600",children:"Get detailed feedback and suggestions for improving your package from our AI assistant."})}),N?L?c.jsxs(X,{onClick:r,size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white shadow-sm transition-all duration-200 hover:shadow-md",children:[c.jsx(ht,{className:"h-4 w-4 mr-2"}),"Request AI Review"]}):c.jsx("p",{className:"text-sm text-gray-500",children:"Circuit JSON is required for AI review."}):c.jsx("p",{className:"text-sm text-gray-500",children:"Only the package owner can generate an AI review"})]})}):!t&&n?c.jsx("div",{className:"flex flex-col items-center justify-center py-8 px-4",children:c.jsxs("div",{className:"text-center space-y-4 max-w-md",children:[c.jsx("div",{className:"flex justify-center",children:c.jsx("div",{className:"w-12 h-12 bg-gray-200 rounded-full flex items-center justify-center",children:c.jsx(nn,{className:"h-6 w-6 text-gray-600 animate-spin"})})}),c.jsx("div",{className:"space-y-2",children:c.jsx("p",{className:"text-sm text-gray-600",children:"Our AI is analyzing your package. This usually takes a few minutes. Please check back shortly."})})]})}):c.jsx(gt,{markdownContent:t||""}),[t,n,N,r]),b=E.useCallback(()=>!D||!(u!=null&&u.filePath)||!H?c.jsx("div",{className:"text-sm p-4",children:Ui.map((p,O)=>c.jsx($,{className:`h-4 mb-2 ${p}`},O))}):k(String(u==null?void 0:u.filePath))?c.jsx(gt,{markdownContent:H}):I(String(u==null?void 0:u.filePath))?c.jsx("div",{className:"overflow-x-auto no-scrollbar",children:c.jsx(po,{code:H,filePath:String(u==null?void 0:u.filePath)})}):c.jsx("pre",{className:"whitespace-pre-wrap",children:H}),[u,H,D,k,I]),se=E.useCallback(()=>{if(!u)return null;switch(u.type){case"ai":return J();case"ai-review":return oe();case"file":return b();default:return null}},[u,J,oe,b]),ce=E.useCallback(p=>`flex items-center px-3 py-1.5 rounded-md text-xs flex-shrink-0 whitespace-nowrap ${(u==null?void 0:u.type)===p.type&&(p.type!=="file"||(u==null?void 0:u.filePath)===p.filePath)?"bg-gray-200 dark:bg-[#30363d] font-medium":"text-gray-500 dark:text-[#8b949e] hover:bg-gray-200 dark:hover:bg-[#30363d]"}`,[u]);return a?e.length===0&&!w&&!S?c.jsxs("div",{className:"mt-4 border border-gray-200 dark:border-[#30363d] rounded-md overflow-hidden",children:[c.jsx("div",{className:"flex items-center pl-2 pr-4 py-2 bg-gray-100 dark:bg-[#161b22] border-b border-gray-200 dark:border-[#30363d]",children:c.jsxs("div",{className:"flex items-center",children:[c.jsx(rn,{className:"h-4 w-4 mr-2"}),c.jsx("span",{className:"font-semibold",children:"No important files found"})]})}),c.jsx("div",{className:"p-4 bg-white dark:bg-[#0d1117]",children:c.jsx("p",{className:"text-gray-500 dark:text-[#8b949e]",children:"No README, LICENSE, or other important files found in this repository."})})]}):c.jsxs("div",{className:"mt-4 border border-gray-200 dark:border-[#30363d] rounded-md overflow-hidden",children:[c.jsxs("div",{className:"flex items-center pl-2 pr-4 py-2 bg-gray-100 dark:bg-[#161b22] border-b border-gray-200 dark:border-[#30363d]",children:[c.jsx("div",{className:"flex items-center space-x-2 overflow-x-auto no-scrollbar flex-1 min-w-0",children:z.map((p,O)=>c.jsxs("button",{className:ce(p),onClick:()=>P(p),children:[p.icon,c.jsx("span",{children:p.label})]},`${p.type}-${p.filePath||O}`))}),c.jsxs("div",{className:"ml-auto flex items-center",children:[((u==null?void 0:u.type)==="file"&&H||(u==null?void 0:u.type)==="ai-review"&&t||(u==null?void 0:u.type)==="ai"&&((o==null?void 0:o.ai_description)||(o==null?void 0:o.ai_usage_instructions)))&&c.jsxs("button",{className:"hover:bg-gray-200 dark:hover:bg-[#30363d] p-1 rounded-md transition-all duration-300",onClick:Y,children:[h==="copy"?c.jsx(vt,{className:"h-4 w-4"}):c.jsx(Ka,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Copy"})]}),(u==null?void 0:u.type)==="ai-review"&&t&&N&&c.jsxs("button",{className:"hover:bg-gray-200 dark:hover:bg-[#30363d] p-1 rounded-md ml-1",onClick:r,title:"Re-request AI Review",children:[c.jsx(ur,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Re-request AI Review"})]}),(u==null?void 0:u.type)==="ai"&&w&&N&&c.jsxs("button",{className:"hover:bg-gray-200 dark:hover:bg-[#30363d] p-1 rounded-md ml-1",onClick:i,title:"Regenerate AI Description",children:[c.jsx(ur,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Regenerate AI Description"})]}),(u==null?void 0:u.type)==="file"&&N&&c.jsxs("button",{className:"hover:bg-gray-200 dark:hover:bg-[#30363d] p-1 rounded-md",onClick:()=>s==null?void 0:s(u.filePath),children:[c.jsx(hl,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Edit"})]})]})]}),c.jsx("div",{className:"p-4 bg-white dark:bg-[#0d1117]",children:se()})]}):c.jsxs("div",{className:"mt-4 border border-gray-200 dark:border-[#30363d] rounded-md overflow-hidden",children:[c.jsxs("div",{className:"flex items-center pl-2 pr-4 py-2 bg-gray-100 dark:bg-[#161b22] border-b border-gray-200 dark:border-[#30363d]",children:[c.jsxs("div",{className:"flex items-center space-x-4",children:[c.jsx($,{className:"h-6 w-24"}),c.jsx($,{className:"h-6 w-20"}),c.jsx($,{className:"h-6 w-28"})]}),c.jsxs("div",{className:"ml-auto flex items-center",children:[c.jsx($,{className:"h-4 w-4 mr-1"}),c.jsx($,{className:"h-4 w-4 ml-2"})]})]}),c.jsxs("div",{className:"p-4 bg-white dark:bg-[#0d1117]",children:[c.jsx($,{className:"h-8 w-3/4 mb-4"}),c.jsx($,{className:"h-4 w-full mb-2"}),c.jsx($,{className:"h-4 w-5/6 mb-2"}),c.jsx($,{className:"h-4 w-4/5 mb-4"}),c.jsx($,{className:"h-4 w-full mb-2"}),c.jsx($,{className:"h-4 w-3/4"})]})]})}function ti({dir:e,path:t}){return t.startsWith("/")&&(t=t.substring(1)),e?t===e?!1:t.startsWith(e+"/")&&t.substring(e.length+1).split("/").length===1:!t.includes("/")}function ni({showHiddenFiles:e,onToggleHiddenFiles:t}){return c.jsxs(yn,{children:[c.jsx(wn,{asChild:!0,children:c.jsx("button",{className:"ml-2 text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 focus:outline-none",children:c.jsx(_a,{className:"h-4 w-4"})})}),c.jsx(kn,{align:"end",className:"bg-white dark:bg-[#161b22] border border-gray-200 dark:border-[#30363d] rounded-md shadow-lg",children:c.jsxs(yt,{onSelect:n=>n.preventDefault(),onClick:t,className:"text-xs text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-[#21262d] flex items-center gap-2",children:[c.jsx(rt,{className:`h-4 w-4 transition-opacity ${e?"opacity-100":"opacity-0"}`}),"Show Hidden Files"]})})]})}function ri({packageFiles:e=[],arePackageFilesFetched:t=!1,onFileClicked:n}){const[r,i]=E.useState(""),[a,s]=E.useState(!1),{directories:l,files:o}=E.useMemo(()=>{if(!e.length)return{directories:[],files:[]};const g=new Set,w=[];return e.filter(x=>a||!ar(x.file_path)).forEach(x=>{const N=x.file_path.split("/"),_=N.pop()||"";let T="";N.forEach(I=>{T+=(T?"/":"")+I,(a||e.some(k=>k.file_path.startsWith(T+"/")&&!ar(k.file_path)))&&g.add(T)}),w.push({type:"file",path:x.file_path,name:_,content:x.file_content||x.content_text||"",created_at:x.created_at})}),{directories:Array.from(g).map(x=>{const N=x.split("/");return x?{type:"directory",path:x,name:N[N.length-1]}:null}).filter(x=>x!==null),files:w}},[e,a]),u=g=>{const w=new Date(g);if(Number.isNaN(w.getTime()))return"";const x=new Date().getTime()-w.getTime(),N=1e3*60*60*24;if(x<=0||x<N)return"today";const _=Math.floor(x/N);return _===1?"yesterday":_<7?`${_} days ago`:_<30?`${Math.floor(_/7)} weeks ago`:_<365?`${Math.floor(_/30)} months ago`:`${Math.floor(_/365)} years ago`},d=[...l.map(g=>({...g,message:"",time:""})),...o.map(g=>({...g,message:"",time:u(g.created_at)}))].sort((g,w)=>g.type==="directory"&&w.type==="file"?-1:g.type==="file"&&w.type==="directory"?1:g.name.localeCompare(w.name)),h=g=>{if(g.type==="directory")i(g.path);else if(g.type==="file"&&n){const w=e.find(S=>S.file_path===g.path);w&&n(w)}},m=()=>{const g=r.substring(0,r.lastIndexOf("/"));i(g)},f=()=>s(g=>!g);return t?c.jsxs("div",{className:"mb-4 border border-gray-200 dark:border-[#30363d] rounded-md overflow-hidden",children:[c.jsxs("div",{className:"flex items-center px-4 py-2 md:py-3 bg-gray-100 dark:bg-[#161b22] border-b border-gray-200 dark:border-[#30363d]",children:[c.jsx("div",{className:"hidden md:flex items-center text-xs",children:c.jsx("span",{className:"text-gray-500 dark:text-[#8b949e]",children:r?`Files in ${r}`:"Files"})}),c.jsxs("div",{className:"hidden md:flex ml-auto items-center text-xs text-gray-500 dark:text-[#8b949e]",children:[c.jsxs("span",{children:[o.length," files, ",l.length," directories"]}),c.jsx(ni,{showHiddenFiles:a,onToggleHiddenFiles:f})]}),c.jsxs("div",{className:"md:hidden flex items-center justify-between w-full",children:[c.jsx("div",{className:"flex items-center",children:c.jsx("span",{className:"text-xs text-gray-500 dark:text-[#8b949e]",children:r?`Files in ${r}`:"Files"})}),c.jsxs("div",{className:"flex items-center text-xs text-gray-500 dark:text-[#8b949e]",children:[c.jsxs("span",{children:[o.length+l.length," items"]}),c.jsx(ni,{showHiddenFiles:a,onToggleHiddenFiles:f})]})]})]}),c.jsx("div",{className:"bg-white dark:bg-[#0d1117]",children:d.length===0&&!r?c.jsx("div",{className:"px-4 py-8 text-center text-gray-500 dark:text-[#8b949e]",children:"No files found"}):c.jsxs(c.Fragment,{children:[r&&c.jsxs("div",{className:"flex items-center px-4 py-2 hover:bg-gray-50 dark:hover:bg-[#161b22] border-b border-gray-200 dark:border-[#30363d] cursor-pointer group",onClick:m,children:[c.jsx(nr,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]"}),c.jsx("span",{className:"text-sm group-hover:underline",children:".."}),c.jsx("span",{className:"ml-auto text-xs text-gray-500 dark:text-[#8b949e]",children:"Parent directory"})]}),d.filter(g=>ti({dir:r,path:g.path})).map((g,w)=>c.jsxs("div",{className:"flex items-center px-4 py-2 hover:bg-gray-50 dark:hover:bg-[#161b22] border-b border-gray-200 dark:border-[#30363d] cursor-pointer group",onClick:()=>h(g),children:[g.type==="directory"?c.jsx(nr,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]"}):c.jsx(rn,{className:"h-4 w-4 mr-2 text-gray-500 dark:text-[#8b949e]"}),c.jsx("span",{className:"text-sm group-hover:underline",children:g.name}),c.jsx("span",{className:"ml-auto text-xs text-gray-500 dark:text-[#8b949e]",children:g.message}),g.time&&c.jsx("span",{className:"ml-4 text-xs text-gray-500 dark:text-[#8b949e]",children:g.time})]},w)),d.filter(g=>ti({dir:r,path:g.path})).length===0&&c.jsx("div",{className:"px-4 py-8 text-center text-gray-500 dark:text-[#8b949e]",children:"No files in this directory"})]})})]}):c.jsxs("div",{className:"mb-4 border border-gray-200 dark:border-[#30363d] rounded-md overflow-hidden",children:[c.jsxs("div",{className:"flex items-center px-4 py-2 md:py-3 bg-gray-100 dark:bg-[#161b22] border-b border-gray-200 dark:border-[#30363d]",children:[c.jsx($,{className:"h-4 w-24"}),c.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[c.jsx($,{className:"h-4 w-20"}),c.jsx($,{className:"h-4 w-24"})]})]}),c.jsx("div",{className:"bg-white dark:bg-[#0d1117]",children:[...Array(5)].map((g,w)=>c.jsxs("div",{className:"flex items-center px-4 py-2 border-b border-gray-200 dark:border-[#30363d]",children:[c.jsx($,{className:"h-4 w-4 mr-2"}),c.jsx($,{className:"h-4 w-32"}),c.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[c.jsx($,{className:"h-4 w-40"}),c.jsx($,{className:"h-4 w-16"})]})]},w))})]})}function Em(){const{circuitJson:e,isLoading:t,error:n}=Le();return t?c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-8 mb-4 bg-white dark:bg-[#0d1117] flex items-center justify-center h-[620px]",children:c.jsx("p",{className:"text-gray-500 dark:text-[#8b949e]",children:"Loading 3D view..."})}):n||!e?c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-8 mb-4 bg-white dark:bg-[#0d1117] flex items-center justify-center",children:c.jsx("p",{className:"text-red-500 dark:text-red-400",children:n||"Circuit JSON not available"})}):c.jsx("div",{className:"h-[620px]",children:c.jsx(E.Suspense,{fallback:c.jsx("div",{className:"flex justify-center items-center h-full",children:c.jsx("div",{className:"w-48",children:c.jsx("div",{className:"loading",children:c.jsx("div",{className:"loading-bar"})})})}),children:c.jsx(ha,{clickToInteractEnabled:!0,circuitJson:e})})})}const Am=({containerClassName:e,...t})=>{const n=E.useRef(null),[r,i]=E.useState(620);return E.useLayoutEffect(()=>{const a=()=>{if(n.current){const l=n.current.clientHeight,o=window.innerHeight;i(Math.min(Math.max(l,620),o))}};a();const s=new ResizeObserver(a);return n.current&&s.observe(n.current),window.addEventListener("resize",a),()=>{s.disconnect(),window.removeEventListener("resize",a)}},[]),c.jsx("div",{ref:n,className:e||"w-full h-full",children:c.jsx(da,{...t,height:r})})};function Tm(){const{circuitJson:e,isLoading:t,error:n}=Le();return t?c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-8 mb-4 bg-white dark:bg-[#0d1117] flex items-center justify-center",children:c.jsx("p",{className:"text-gray-500 dark:text-[#8b949e]",children:"Loading PCB view..."})}):n||!e?c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-8 mb-4 bg-white dark:bg-[#0d1117] flex items-center justify-center",children:c.jsx("p",{className:"text-red-500 dark:text-red-400",children:n||"Circuit JSON not available"})}):c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-4 mb-4 bg-white dark:bg-[#0d1117]",children:c.jsx(Am,{disablePcbGroups:!0,clickToInteractEnabled:!0,circuitJson:e,containerClassName:"w-full h-[620px]"})})}function Pm(){const{circuitJson:e,isLoading:t,error:n}=Le();return t?c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-8 mb-4 bg-white dark:bg-[#0d1117] flex items-center justify-center h-[620px]",children:c.jsx("p",{className:"text-gray-500 dark:text-[#8b949e]",children:"Loading schematic view..."})}):n||!e?c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-8 mb-4 bg-white dark:bg-[#0d1117] flex items-center justify-center",children:c.jsx("p",{className:"text-red-500 dark:text-red-400",children:n||"Circuit JSON not available"})}):c.jsx("div",{className:"h-[620px]",children:c.jsx(fa,{disableGroups:!0,clickToInteractEnabled:!0,circuitJson:e,containerStyle:{height:620}})})}function Lm(){const{circuitJson:e,isLoading:t,error:n}=Le();return t?c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-8 mb-4 bg-white dark:bg-[#0d1117] flex items-center justify-center h-[620px]",children:c.jsx("p",{className:"text-gray-500 dark:text-[#8b949e]",children:"Loading BOM view..."})}):n||!e?c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-8 mb-4 bg-white dark:bg-[#0d1117] flex items-center justify-center",children:c.jsx("p",{className:"text-red-500 dark:text-red-400",children:n||"Circuit JSON not available"})}):c.jsx("div",{className:"border border-gray-200 dark:border-[#30363d] rounded-md p-4 mb-4 bg-white dark:bg-[#0d1117] w-full h-[620px] overflow-y-scroll",children:c.jsx(ma,{circuitJson:e})})}const Dm={"readme.md":200,readme:200,license:100,"license.md":100,"index.ts":90,"index.tsx":90,"circuit.tsx":90},Rm=e=>e.replace(/^\.\/?/,"").toLowerCase().split("/").length>1?!1:mn(e)>0,mn=e=>{const t=e.toLowerCase();for(const[n,r]of Object.entries(Dm))if(t.endsWith(n))return r;return 0},Im=({onSuccess:e}={})=>{const t=Pe(),n=pe(i=>i.session),{toast:r}=Ue();return $e(["forkPackage"],async i=>{if(!n)throw new Error("No session");const{data:a}=await t.post("/packages/fork",{package_id:i}),s=a.package;if(!s)throw new Error("Failed to fork package");return s},{onSuccess:i=>{r({title:"Package Forked",description:`Successfully forked package to @${n==null?void 0:n.github_username}/${i.unscoped_name}`});const a=new URL(window.location.href);a.pathname=`/${n==null?void 0:n.github_username}/${i.unscoped_name}`,a.search="",window.location.href=a.toString(),e==null||e(i)},onError:i=>{var s,l,o;const a=(l=(s=i==null?void 0:i.data)==null?void 0:s.error)==null?void 0:l.message;if(((o=i==null?void 0:i.data)==null?void 0:o.error_code)==="cannot_fork_own_package"){r({title:"Cannot Fork Package",description:a||"You cannot fork your own package."});return}r({title:"Error",description:a||"Failed to fork package. Please try again.",variant:"destructive"})}})},Fm=e=>{const t=e&&"name"in e?e.name:null,n=e&&"package_id"in e?e.package_id:null,r=t?yi(t):Ta(n);return bn(["packageStars",e],async()=>{var i,a;if(!e)throw new Error("Query is required");return{is_starred:((i=r.data)==null?void 0:i.is_starred)??!1,star_count:((a=r.data)==null?void 0:a.star_count)??0}},{retry:!1,enabled:!!e&&r.isSuccess})},Om=e=>{const t=Pe(),n=lt(),r=$e(async()=>{const{data:a}=await t.post("/packages/add_star",e);return a},{onMutate:async()=>{await n.cancelQueries(["packageStars",e]);const a=n.getQueryData(["packageStars",e]),s={is_starred:!0,star_count:((a==null?void 0:a.star_count)??0)+1};return n.setQueryData(["packageStars",e],s),{previousStars:a}},onError:(a,s,l)=>{l!=null&&l.previousStars&&n.setQueryData(["packageStars",e],l.previousStars)},onSettled:()=>{n.invalidateQueries(["packageStars",e])}}),i=$e(async()=>{const{data:a}=await t.post("/packages/remove_star",e);return a},{onMutate:async()=>{await n.cancelQueries(["packageStars",e]);const a=n.getQueryData(["packageStars",e]),s={is_starred:!1,star_count:Math.max(0,((a==null?void 0:a.star_count)??1)-1)};return n.setQueryData(["packageStars",e],s),{previousStars:a}},onError:(a,s,l)=>{l!=null&&l.previousStars&&n.setQueryData(["packageStars",e],l.previousStars)},onSettled:()=>{n.invalidateQueries(["packageStars",e])}});return{addStar:r,removeStar:i}},zm=e=>{var i,a;const t=Fm(e),n=Om(e??{name:""}),r=async()=>{var l;if(!e)return;((l=t.data)==null?void 0:l.is_starred)??!1?await n.removeStar.mutateAsync():await n.addStar.mutateAsync()};return{isStarred:((i=t.data)==null?void 0:i.is_starred)??!1,starCount:((a=t.data)==null?void 0:a.star_count)??0,isPending:n.addStar.isLoading||n.removeStar.isLoading,toggleStar:r}},Mm=e=>zm(e?{name:e}:null);function Bm({packageInfo:e,isPrivate:t=!1,isCurrentUserAuthor:n=!1}){const r=e==null?void 0:e.owner_github_username,i=e==null?void 0:e.unscoped_name,a=pe(k=>{var R;return(R=k.session)==null?void 0:R.token}),s=(e==null?void 0:e.owner_github_username)===pe(k=>{var R;return(R=k.session)==null?void 0:R.github_username}),l=pe(k=>k.session!=null),o=wa(),{OrderDialog:u,isOpen:d,open:h,close:m,stage:f,setStage:g}=pa({onSignIn:o,isLoggedIn:l,packageReleaseId:(e==null?void 0:e.latest_package_release_id)??""}),{isStarred:w,starCount:S,toggleStar:x}=Mm((e==null?void 0:e.name)??null),{mutateAsync:N,isLoading:_}=Im(),T=async()=>{!(e!=null&&e.name)||!l||await x()},I=async()=>{!(e!=null&&e.package_id)||!l||await N(e.package_id)};return E.useEffect(()=>{window.TSCIRCUIT_REGISTRY_API_BASE_URL=`${window.location.origin}/api`,window.TSCIRCUIT_STRIPE_CHECKOUT_BASE_URL=void 0},[a]),c.jsxs("header",{className:"bg-white border-b border-gray-200 py-4",children:[c.jsx("div",{className:"max-w-[1200px] mx-auto px-4",children:c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-y-2",children:[c.jsx("div",{className:"flex items-center min-w-0 flex-wrap",children:r&&i?c.jsxs(c.Fragment,{children:[c.jsxs("h1",{className:"text-lg md:text-xl font-bold mr-2 break-words",children:[c.jsx(Me,{href:`/${r}`,className:"text-blue-600 hover:underline",children:r}),c.jsx("span",{className:"px-1 text-gray-500",children:"/"}),c.jsx(Me,{href:`/${r}/${i}`,className:"text-blue-600 hover:underline",children:i})]}),(e==null?void 0:e.name)&&c.jsx("div",{className:`select-none inline-flex items-center px-2 py-1 rounded text-xs font-medium ${t?"bg-gray-100 text-gray-700 border border-gray-200":"bg-blue-50 text-blue-700 border border-blue-200"}`,children:t?c.jsxs(c.Fragment,{children:[c.jsx(Wa,{className:"w-3 h-3 mr-1 flex-shrink-0"}),c.jsx("span",{className:"leading-none",children:"Private"})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ba,{className:"w-3 h-3 mr-1 flex-shrink-0"}),c.jsx("span",{className:"leading-none",children:"Public"})]})})]}):c.jsx($,{className:"h-6 w-72"})}),c.jsxs("div",{className:"hidden md:flex items-center space-x-2",children:[c.jsxs(X,{variant:"outline",size:"sm",onClick:h,disabled:!(e!=null&&e.latest_package_release_id),children:[c.jsx(rr,{className:"w-4 h-4 mr-2"}),"Order"]}),c.jsx(kt,{children:c.jsxs(_t,{children:[c.jsx(Nt,{asChild:!0,children:c.jsx("span",{children:c.jsxs(X,{variant:"outline",size:"sm",className:_||!(e!=null&&e.name)||!l?"pointer-events-none":"",onClick:T,disabled:!(e!=null&&e.name)||!l,children:[c.jsx(wt,{className:`w-4 h-4 mr-2 ${w?"fill-yellow-500 text-yellow-500":""}`}),w?"Starred":"Star",(S??0)>0&&c.jsx("span",{className:"ml-1.5 bg-gray-100 text-gray-700 rounded-full px-1.5 py-0.5 text-xs font-medium",children:S})]})})}),!l&&c.jsx(St,{children:"You must Log in to star a package"})]})}),!s&&c.jsx(kt,{children:c.jsxs(_t,{children:[c.jsx(Nt,{asChild:!0,children:c.jsx("span",{children:c.jsxs(X,{variant:"outline",size:"sm",onClick:I,disabled:_||!(e!=null&&e.name)||!l,className:_||!(e!=null&&e.name)||!l?"pointer-events-none":"",children:[c.jsx(it,{className:"w-4 h-4 mr-2"}),"Fork"]})})}),!l&&c.jsx(St,{children:c.jsx("p",{children:"Log in to Fork this package"})})]})})]}),c.jsxs("div",{className:"md:hidden flex items-center space-x-2 w-full justify-end pt-2",children:[c.jsxs(X,{variant:"outline",size:"sm",onClick:h,children:[c.jsx(rr,{className:"w-4 h-4 mr-2"}),"Order"]}),c.jsxs(X,{variant:"outline",size:"sm",className:_||!(e!=null&&e.name)||!l?"pointer-events-none":"",onClick:T,disabled:!(e!=null&&e.name)||!l,children:[c.jsx(wt,{className:`w-4 h-4 mr-2 ${w?"fill-yellow-500 text-yellow-500":""}`}),w?"Starred":"Star",(S??0)>0&&c.jsx("span",{className:"ml-1.5 bg-gray-100 text-gray-700 rounded-full px-1.5 py-0.5 text-xs font-medium",children:S})]}),!s&&c.jsxs(X,{variant:"outline",size:"sm",onClick:I,className:_||!(e!=null&&e.name)||!l?"pointer-events-none":"",disabled:n||_||!(e!=null&&e.package_id),children:[c.jsx(it,{className:"w-4 h-4 mr-2"}),"Fork"]})]})]})}),c.jsx(u,{isOpen:d,onClose:m,stage:f,setStage:g})]})}const $m=({onSuccess:e}={})=>{const t=Pe(),{toast:n}=Ue(),r=lt();return $e(async({package_release_id:i})=>{const{data:a}=await t.post("/ai_reviews/create",{package_release_id:i}),s=a.ai_review,{data:l}=await t.post("/package_releases/get",{package_release_id:i},{params:{include_ai_review:!0}});return{package_release:l.package_release,ai_review:s}},{onSuccess:({package_release:i,ai_review:a})=>{n({title:"AI review requested",description:"An AI review has been requested."}),r.invalidateQueries(["packageRelease"]),e==null||e(i,a)},onError:i=>{var a,s,l;n({title:"Error",description:((s=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:s.message)||((l=i==null?void 0:i.data)==null?void 0:l.message)||"Failed to request AI review.",variant:"destructive"})}})},Hm=({onSuccess:e}={})=>{const t=Pe(),{toast:n}=Ue(),r=lt();return $e(async({package_id:i})=>{const{data:a}=await t.post("/packages/update_ai_description",{package_id:i});return a},{onSuccess:()=>{n({title:"AI description update requested",description:"The AI description will be regenerated shortly."}),r.invalidateQueries(["package"]),e==null||e()},onError:i=>{var a,s,l;n({title:"Error",description:((s=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:s.message)||((l=i==null?void 0:i.data)==null?void 0:l.message)||"Failed to request AI description update.",variant:"destructive"})}})},Vm=(e,t)=>{const n=Pe();return bn(["aiReview",e],async()=>{if(!e)throw new Error("aiReviewId is required");const{data:r}=await n.get("/ai_reviews/get",{params:{ai_review_id:e}});return r.ai_review},{enabled:!!e,refetchInterval:t==null?void 0:t.refetchInterval,refetchOnWindowFocus:!1})};function Um({packageFiles:e,arePackageFilesFetched:t=!1,packageInfo:n,packageRelease:r,onFileClicked:i,onEditClicked:a}){var z;const[s,l]=E.useState("files"),[o,u]=E.useState(null),[d,h]=E.useState(!1),m=lt(),{data:f}=Vm(o,{refetchInterval:y=>y&&!y.ai_review_text?2e3:!1});E.useEffect(()=>{f!=null&&f.ai_review_text&&(m.invalidateQueries(["packageRelease"]),u(null))},[f==null?void 0:f.ai_review_text,m]);const g=pe(y=>y.session),w=E.useMemo(()=>e==null?void 0:e.some(y=>y.file_path==="dist/circuit.json"),[e]),{mutate:S,isLoading:x}=$m({onSuccess:(y,P)=>{u(P.ai_review_id)}}),{mutate:N,isLoading:_}=Hm(),T=!!(r!=null&&r.ai_review_requested)||!!o||x,I=()=>{h(!0),setTimeout(()=>h(!1),100)};E.useEffect(()=>{if(!n||!t)return;const y=window.location.hash.slice(1),P=["files","3d","pcb","schematic","bom"],L=["3d","pcb","schematic","bom"],j=w?P:P.filter(C=>!L.includes(C));y&&j.includes(y)?l(y):n!=null&&n.default_view&&j.includes(n.default_view)?(l(n.default_view),window.location.hash=n.default_view):(l("files"),(!y||!j.includes(y))&&(window.location.hash="files"))},[n==null?void 0:n.default_view,w]);const k=(z=e==null?void 0:e.filter(y=>Rm(y.file_path)))==null?void 0:z.map(y=>y.file_path),R=E.useMemo(()=>!e||!k?[]:e.filter(y=>k.some(P=>y.file_path.endsWith(P))).sort((y,P)=>{const L=mn(y.file_path),j=mn(P.file_path);return L-j}).reverse(),[e,k]),B=()=>{switch(s){case"files":return c.jsx(ri,{packageFiles:e,arePackageFilesFetched:t,onFileClicked:i});case"3d":return c.jsx(Em,{});case"pcb":return c.jsx(Tm,{});case"schematic":return c.jsx(Pm,{});case"bom":return c.jsx(Lm,{});default:return c.jsx(ri,{packageFiles:e,arePackageFilesFetched:t,onFileClicked:i})}};return c.jsxs("div",{className:"min-h-screen bg-white dark:bg-[#0d1117] text-gray-900 dark:text-[#c9d1d9] font-sans",children:[c.jsx(Ua,{}),c.jsx(Bm,{packageInfo:n,isPrivate:(n==null?void 0:n.is_private)??!1,isCurrentUserAuthor:(n==null?void 0:n.creator_account_id)===(g==null?void 0:g.github_username)}),c.jsx("div",{className:"max-w-[1200px] mx-auto",children:c.jsx(ho,{onViewChange:y=>{l(y),window.location.hash=y},isLoading:!n})}),c.jsx("div",{className:"max-w-[1200px] mx-auto",children:c.jsxs("div",{className:"flex flex-col md:flex-row",children:[c.jsxs("div",{className:"w-full md:flex-1 border-r border-gray-200 dark:border-[#30363d] p-4 md:max-w-[calc(100%-296px)] max-w-full",children:[c.jsx($l,{activeView:s,packageFiles:e??[],onViewChange:y=>{l(y),window.location.hash=y},packageInfo:n}),B(),c.jsx(Cm,{importantFiles:R,isFetched:t,pkg:n,onEditClicked:a,aiReviewText:(r==null?void 0:r.ai_review_text)??null,aiReviewRequested:T,onRequestAiReview:()=>{r&&S({package_release_id:r.package_release_id})},onRequestAiDescriptionUpdate:()=>{n&&N({package_id:n.package_id})},onLicenseFileRequested:d})]}),c.jsx("div",{className:"hidden md:block md:w-[296px] flex-shrink-0",children:c.jsx(lo,{packageInfo:n,isLoading:!n,onViewChange:y=>{l(y),window.location.hash=y},onLicenseClick:I})}),c.jsx("div",{className:"block md:hidden w-full px-5",children:c.jsx(Hi,{})})]})}),c.jsx(qa,{})]})}const ii=({context:e,slug:t,status:n,message:r})=>{const i=E.useRef(!1);return E.useEffect(()=>{typeof window>"u"||typeof t!="string"||t.length===0||typeof n=="number"&&n!==404||i.current||(i.current=!0,zl(`package:view:${e}-not-found`,{level:"warning",tags:{slug:t},extra:{status:n,message:r}}))},[e,t,n,r]),null},Sp=()=>{const{author:e,packageName:t}=xn(),n=`${e}/${t}`,[,r]=gn(),{data:i,error:a,isLoading:s}=yi(n),{packageRelease:l,error:o,isLoading:u}=An({include_ai_review:!0,refetchInterval:m=>m!=null&&m.ai_review_requested&&!m.ai_review_text?2e3:!1}),{data:d,isFetched:h}=Sn(l==null?void 0:l.package_release_id);return!s&&a?c.jsxs(c.Fragment,{children:[c.jsx(ii,{context:"package",slug:n,status:a==null?void 0:a.status,message:a.message}),c.jsx(or,{heading:"Package Not Found"})]}):!u&&(o==null?void 0:o.status)==404?c.jsxs(c.Fragment,{children:[c.jsx(ii,{context:"package_release",slug:n,status:o.status,message:o.message}),c.jsx(or,{heading:"Package Not Found"})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ga,{children:c.jsx("title",{children:`${e}/${t} - tscircuit`})}),c.jsx(Um,{packageFiles:d??[],arePackageFilesFetched:h,packageInfo:i,packageRelease:l,importantFilePaths:["README.md","LICENSE","package.json"],onFileClicked:m=>{i!=null&&i.package_id&&r(`/editor?package_id=${i==null?void 0:i.package_id}&file_path=${m.file_path}`)},onEditClicked:m=>{i!=null&&i.package_id&&r(`/editor?package_id=${i==null?void 0:i.package_id}${m?`&file_path=${m}`:""}`)}})]})};export{Sp as ViewPackagePage};