thursday-agent 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +0 -1
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +0 -6
  6. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/server/app/_global-error.html +1 -1
  8. package/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  13. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_not-found.html +1 -1
  15. package/.next/server/app/_not-found.rsc +2 -2
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  18. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  19. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  20. package/.next/server/app/api/bot/keep-working/route.js.nft.json +1 -1
  21. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  22. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  23. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  24. package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
  25. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  26. package/.next/server/app/api/config/route.js.nft.json +1 -1
  27. package/.next/server/app/api/events/route.js.nft.json +1 -1
  28. package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
  29. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  30. package/.next/server/app/api/llm-model/catalog/route.js.nft.json +1 -1
  31. package/.next/server/app/api/llm-model/credits/route.js.nft.json +1 -1
  32. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  33. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  34. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  35. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  36. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  37. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  38. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  39. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  40. package/.next/server/app/api/reach/route.js +13 -13
  41. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  42. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  43. package/.next/server/app/api/signins/route.js +1 -1
  44. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  45. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  46. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  47. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  48. package/.next/server/app/api/thursday/skills/route.js.nft.json +1 -1
  49. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  50. package/.next/server/app/api/thursday/tool-call/route.js +14 -15
  51. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  52. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  53. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  54. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +1 -1
  55. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  56. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  58. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  59. package/.next/server/app/page/server-reference-manifest.json +56 -56
  60. package/.next/server/app/page.js +4 -4
  61. package/.next/server/app/page.js.nft.json +1 -1
  62. package/.next/server/app/page_client-reference-manifest.js +1 -1
  63. package/.next/server/app-paths-manifest.json +0 -1
  64. package/.next/server/chunks/[root-of-the-server]__014ydvq._.js +2 -2
  65. package/.next/server/chunks/[root-of-the-server]__0209ah4._.js +7 -5
  66. package/.next/server/chunks/[root-of-the-server]__04r4h-2._.js +4 -2
  67. package/.next/server/chunks/[root-of-the-server]__0542v_d._.js +3 -0
  68. package/.next/server/chunks/[root-of-the-server]__0gewdg9._.js +2 -2
  69. package/.next/server/chunks/[root-of-the-server]__0mrk2it._.js +1 -1
  70. package/.next/server/chunks/[root-of-the-server]__1-swlkw._.js +2 -2
  71. package/.next/server/chunks/[root-of-the-server]__12iddfq._.js +1 -1
  72. package/.next/server/chunks/[root-of-the-server]__1ai5lme._.js +3 -3
  73. package/.next/server/chunks/[root-of-the-server]__1cjxw0-._.js +2 -2
  74. package/.next/server/chunks/{[root-of-the-server]__1fy2g82._.js → [root-of-the-server]__1k3j52n._.js} +1 -1
  75. package/.next/server/chunks/[root-of-the-server]__1kyjt5m._.js +3 -3
  76. package/.next/server/chunks/[root-of-the-server]__1ygplx1._.js +1 -1
  77. package/.next/server/chunks/_05v8k21._.js +3 -1
  78. package/.next/server/chunks/_0awtznl._.js +1 -1
  79. package/.next/server/chunks/_0na2fj1._.js +1 -1
  80. package/.next/server/chunks/_0x-ej3f._.js +17 -17
  81. package/.next/server/chunks/_12-amdu._.js +2 -2
  82. package/.next/server/chunks/_15740dw._.js +60 -0
  83. package/.next/server/chunks/_1dc_d1q._.js +3 -3
  84. package/.next/server/chunks/_1i350l5._.js +3 -1
  85. package/.next/server/chunks/_1jc5g4p._.js +2 -2
  86. package/.next/server/chunks/_1jn-aep._.js +4 -4
  87. package/.next/server/chunks/_1m88lkh._.js +11 -11
  88. package/.next/server/chunks/_1ogqovh._.js +4 -4
  89. package/.next/server/chunks/_1uuucy-._.js +1 -1
  90. package/.next/server/chunks/_1zxp-p6._.js +1 -1
  91. package/.next/server/chunks/features_0rfvely._.js +5 -3
  92. package/.next/server/chunks/ssr/{[root-of-the-server]__1se25x0._.js → [root-of-the-server]__0hpp3nw._.js} +29 -13
  93. package/.next/server/chunks/ssr/[root-of-the-server]__0m7u9j-._.js +3 -0
  94. package/.next/server/chunks/ssr/[root-of-the-server]__0tzekbl._.js +24 -60
  95. package/.next/server/chunks/ssr/[root-of-the-server]__1cz2rz5._.js +3 -0
  96. package/.next/server/chunks/ssr/{[root-of-the-server]__0tvavy9._.js → [root-of-the-server]__1iwyp1e._.js} +1 -1
  97. package/.next/server/chunks/ssr/[root-of-the-server]__1w9hqq8._.js +1 -1
  98. package/.next/server/chunks/ssr/_097-ljd._.js +1 -1
  99. package/.next/server/chunks/ssr/{_1tmu8z-._.js → _0btzccu._.js} +2 -2
  100. package/.next/server/chunks/ssr/_0fqhhwi._.js +1 -1
  101. package/.next/server/chunks/ssr/_0hjzb5o._.js +3 -0
  102. package/.next/server/chunks/ssr/_0ld9_qq._.js +1 -1
  103. package/.next/server/chunks/ssr/{_0urj3mc._.js → _0ouzu9f._.js} +2 -2
  104. package/.next/server/chunks/ssr/{_1-zyvdb._.js → _0u7ko71._.js} +2 -2
  105. package/.next/server/chunks/ssr/{_0ltz2q5._.js → _0wd_o8-._.js} +2 -2
  106. package/.next/server/chunks/ssr/_0ya0cb0._.js +3 -0
  107. package/.next/server/chunks/ssr/_10yyqtk._.js +67 -0
  108. package/.next/server/chunks/ssr/{_1uy0xom._.js → _12eyown._.js} +3 -3
  109. package/.next/server/chunks/ssr/_12mijol._.js +11 -11
  110. package/.next/server/chunks/ssr/_132qkfz._.js +1 -1
  111. package/.next/server/chunks/ssr/_184327j._.js +1 -1
  112. package/.next/server/chunks/ssr/{_1z74dmq._.js → _19ps4p3._.js} +7 -7
  113. package/.next/server/chunks/ssr/{_1flbs77._.js → _1bhy4yg._.js} +2 -2
  114. package/.next/server/chunks/ssr/_1d423aj._.js +7 -5
  115. package/.next/server/chunks/ssr/{_1a-nuxx._.js → _1kd843u._.js} +2 -2
  116. package/.next/server/chunks/ssr/{_0ital-2._.js → _1kq2ye_._.js} +2 -2
  117. package/.next/server/chunks/ssr/_1mqn9mc._.js +1 -1
  118. package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
  119. package/.next/server/chunks/ssr/_1p8xorg._.js +3 -0
  120. package/.next/server/chunks/ssr/{_1x-kojb._.js → _1q683w8._.js} +3 -3
  121. package/.next/server/chunks/ssr/_1tawxu2._.js +3 -0
  122. package/.next/server/chunks/ssr/{_0scf7xy._.js → _1w2oba6._.js} +2 -2
  123. package/.next/server/chunks/ssr/_1xoch6f._.js +1 -1
  124. package/.next/server/chunks/ssr/{_0kjj5ts._.js → _1ybo1hd._.js} +3 -3
  125. package/.next/server/chunks/ssr/features_bot_0s11m4r._.js +3 -0
  126. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  127. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  128. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  129. package/.next/server/chunks/ssr/features_workspace_00jz2hu._.js +1 -1
  130. package/.next/server/chunks/ssr/{node_modules_1af3w91._.js → node_modules_00pocul._.js} +1 -1
  131. package/.next/server/chunks/ssr/{node_modules_0th357h._.js → node_modules_02zt4az._.js} +1 -1
  132. package/.next/server/chunks/ssr/{node_modules_0jljel9._.js → node_modules_05ojmcl._.js} +1 -1
  133. package/.next/server/chunks/ssr/{node_modules_0wnlddw._.js → node_modules_06i6bli._.js} +1 -1
  134. package/.next/server/chunks/ssr/{node_modules_06bb4q8._.js → node_modules_09dj429._.js} +1 -1
  135. package/.next/server/chunks/ssr/{node_modules_068ws5v._.js → node_modules_0auzgvx._.js} +1 -1
  136. package/.next/server/chunks/ssr/{node_modules_1ogczzz._.js → node_modules_0evjwh1._.js} +1 -1
  137. package/.next/server/chunks/ssr/{node_modules_13kwejm._.js → node_modules_0gmdur8._.js} +1 -1
  138. package/.next/server/chunks/ssr/{node_modules_1s-gb-1._.js → node_modules_0j3te-1._.js} +1 -1
  139. package/.next/server/chunks/ssr/{node_modules_1bucjlk._.js → node_modules_0rbaymq._.js} +1 -1
  140. package/.next/server/chunks/ssr/{node_modules_1wbkzl9._.js → node_modules_0tf8_1e._.js} +1 -1
  141. package/.next/server/chunks/ssr/{node_modules_12et8d5._.js → node_modules_0yqy-0b._.js} +1 -1
  142. package/.next/server/chunks/ssr/{node_modules_1lkix61._.js → node_modules_1-53ebx._.js} +1 -1
  143. package/.next/server/chunks/ssr/{node_modules_03d0rfz._.js → node_modules_1-y9aho._.js} +1 -1
  144. package/.next/server/chunks/ssr/{node_modules_0x630an._.js → node_modules_11bltzp._.js} +1 -1
  145. package/.next/server/chunks/ssr/{node_modules_0uyh_vb._.js → node_modules_18jn2qo._.js} +1 -1
  146. package/.next/server/chunks/ssr/{node_modules_0dzm4um._.js → node_modules_1_te3bu._.js} +1 -1
  147. package/.next/server/chunks/ssr/{node_modules_07rs_p2._.js → node_modules_1c0pg3k._.js} +1 -1
  148. package/.next/server/chunks/ssr/{node_modules_0sgy-dc._.js → node_modules_1en2jx5._.js} +1 -1
  149. package/.next/server/chunks/ssr/{node_modules_0ubdtk-._.js → node_modules_1p-c8cr._.js} +1 -1
  150. package/.next/server/chunks/ssr/{node_modules_1z1lrbk._.js → node_modules_1qe-oxg._.js} +1 -1
  151. package/.next/server/chunks/ssr/{node_modules_04_sbbc._.js → node_modules_1rjt833._.js} +1 -1
  152. package/.next/server/chunks/ssr/{node_modules_0yvz9e0._.js → node_modules_1tzw5sn._.js} +1 -1
  153. package/.next/server/chunks/ssr/{node_modules_1uwg-gz._.js → node_modules_1x6uwvn._.js} +1 -1
  154. package/.next/server/chunks/ssr/{node_modules_0t_ez6-._.js → node_modules_1zqddke._.js} +1 -1
  155. package/.next/server/chunks/ssr/{node_modules_05ybmta._.js → node_modules_211zgim._.js} +1 -1
  156. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0r443fh._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0y51bqj._.js} +1 -1
  157. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_10wnlbk._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1sc114e._.js} +1 -1
  158. package/.next/server/middleware-build-manifest.js +3 -3
  159. package/.next/server/pages/404.html +1 -1
  160. package/.next/server/pages/500.html +1 -1
  161. package/.next/server/server-reference-manifest.js +1 -1
  162. package/.next/server/server-reference-manifest.json +57 -57
  163. package/.next/static/chunks/{13ixzheqw7o-w.js → 03-724sj0nk_z.js} +2 -2
  164. package/.next/static/chunks/03bhu4mk8en2q.js +1 -0
  165. package/.next/static/chunks/{3h2e-xv1zxh_f.js → 04imzjhvzw65d.js} +2 -2
  166. package/.next/static/chunks/{27tvv1i-smrck.js → 0gljzv9fz1g7d.js} +1 -1
  167. package/.next/static/chunks/{37j27b3e1gt7r.js → 0h0lythv1ql93.js} +1 -1
  168. package/.next/static/chunks/{2o4dndk0d68do.js → 0hzbj7f48cmx0.js} +1 -1
  169. package/.next/static/chunks/0lwunwbl7u7pt.js +1 -0
  170. package/.next/static/chunks/{0u9ae9k_2g7k3.js → 0r6nwxg4dv83t.js} +1 -1
  171. package/.next/static/chunks/0rn9nbg6aif9f.js +17 -0
  172. package/.next/static/chunks/{3bbzsitgiltnt.js → 0x_w4shtvrrfg.js} +1 -1
  173. package/.next/static/chunks/{2sdwbfs1x5skp.js → 0ympuji_ufypd.js} +1 -1
  174. package/.next/static/chunks/{3t9huugh-5_ps.js → 0zmrz4zfzm4dt.js} +1 -1
  175. package/.next/static/chunks/{0qmd8n52hp-6v.js → 11tlxkr7a_rpc.js} +1 -1
  176. package/.next/static/chunks/{2c64drdevdla3.js → 12scesro428m7.js} +2 -2
  177. package/.next/static/chunks/16s2fx3890_jd.js +65 -0
  178. package/.next/static/chunks/{0oyz95sujd2c7.js → 1qzfgplyo18tc.js} +1 -1
  179. package/.next/static/chunks/{04e-e--5lk26x.js → 1r4zajz14jp9-.js} +1 -1
  180. package/.next/static/chunks/1s6m4cmbn7htf.js +1 -0
  181. package/.next/static/chunks/1wl9t1-3i-q8p.css +1 -0
  182. package/.next/static/chunks/2-asot3p1j3yg.js +1 -0
  183. package/.next/static/chunks/{0u3ktztrzu1fa.js → 2-jn4xscbm-i2.js} +1 -1
  184. package/.next/static/chunks/22h9gvclqtx_2.js +1 -0
  185. package/.next/static/chunks/{337g9g_ux2gj-.js → 26-eblxwnykck.js} +1 -1
  186. package/.next/static/chunks/{43q9cgbuw8krx.js → 2kzwhbuobpkw3.js} +2 -2
  187. package/.next/static/chunks/2m6jd3586ijb-.js +1 -0
  188. package/.next/static/chunks/{0_awn8tucznxc.js → 304q9p54tcgm1.js} +1 -1
  189. package/.next/static/chunks/{1u5i-jti87jbo.js → 35wdx3wt7cg4a.js} +1 -1
  190. package/.next/static/chunks/37unh9460im7v.js +18 -0
  191. package/.next/static/chunks/{01xjer0i_e5z5.js → 39gj5vxz1zpm_.js} +1 -1
  192. package/.next/static/chunks/{427qsc6kahxyo.js → 39vrqy1r_00jc.js} +1 -1
  193. package/.next/static/chunks/{245hb85nsy6j4.js → 3dipmu0mptqum.js} +1 -1
  194. package/.next/static/chunks/3gki-squw28yu.js +1 -0
  195. package/.next/static/chunks/{3obf9n3cxj99k.js → 3jvldk2wvwbge.js} +1 -1
  196. package/.next/static/chunks/{38301ji-85i30.js → 3nnzdl_te20hv.js} +1 -1
  197. package/.next/static/chunks/{2m267diam_vib.js → 3tz4dr0_8pq1-.js} +1 -1
  198. package/.next/static/chunks/{2gocl3dq0_h1s.js → 3x6pggb-2kyrk.js} +1 -1
  199. package/.next/static/chunks/{025bmrgeukcb2.js → 4440mws9jz3mt.js} +1 -1
  200. package/README.md +4 -0
  201. package/app/api/thursday/tool-call/route.ts +1 -15
  202. package/components/ui/radio-group.tsx +2 -2
  203. package/docs/images/demo-still.jpg +0 -0
  204. package/docs/live-calls.md +19 -11
  205. package/features/ai/prompts/live.prompt.ts +51 -26
  206. package/features/ai/prompts/prompt-helper.ts +1 -9
  207. package/features/ai/prompts/thursday.prompt.ts +8 -2
  208. package/features/bot/bot.run.ts +9 -3
  209. package/features/bot/bot.seed.ts +35 -91
  210. package/features/bot/components/bot-room.tsx +0 -6
  211. package/features/bot/components/bot-setting.tsx +4 -4
  212. package/features/bot/components/room-pill.tsx +4 -2
  213. package/features/bot/seed-bots.ts +2 -2
  214. package/features/intro/components/intro.tsx +2 -3
  215. package/features/reach/reach.ts +2 -2
  216. package/features/routine/components/routine-setting.tsx +1 -1
  217. package/features/signins/signins.query.ts +66 -1
  218. package/features/thursday/components/side-captions.tsx +31 -8
  219. package/features/thursday/components/thursday-setting.tsx +5 -5
  220. package/features/thursday/components/thursday.tsx +97 -39
  221. package/features/thursday/components/write-line.tsx +28 -17
  222. package/features/thursday/thursday.action.ts +4 -20
  223. package/features/thursday/thursday.schema.ts +0 -9
  224. package/features/thursday/thursday.store.ts +11 -15
  225. package/features/thursday/thursday.text.ts +10 -8
  226. package/features/thursday/tool-line.ts +17 -6
  227. package/features/thursday/use-call-ring.ts +1 -5
  228. package/features/thursday/use-text-call.ts +37 -21
  229. package/features/thursday/use-thursday.ts +14 -44
  230. package/features/workspace/workspace.ts +4 -2
  231. package/guide/bots.md +13 -3
  232. package/guide/calls.md +7 -5
  233. package/knip.json +1 -0
  234. package/lib/live/live.session.ts +0 -39
  235. package/package.json +1 -1
  236. package/scripts/live-session.test.mts +19 -26
  237. package/seed-skills/analyst/README.md +18 -0
  238. package/seed-skills/analyst/data-report/SKILL.md +60 -0
  239. package/seed-skills/analyst/data-report/references/brief.md +31 -0
  240. package/seed-skills/analyst/data-report/references/company.md +41 -0
  241. package/seed-skills/analyst/data-report/references/comparison.md +42 -0
  242. package/seed-skills/analyst/data-report/references/decision.md +28 -0
  243. package/seed-skills/analyst/data-report/references/market-size.md +49 -0
  244. package/seed-skills/analyst/data-report/references/price-check.md +33 -0
  245. package/seed-skills/analyst/data-report/references/sources.md +51 -0
  246. package/seed-skills/analyst/data-report/references/trend.md +39 -0
  247. package/seed-skills/analyst/data-report/scripts/fetch.mjs +521 -0
  248. package/seed-skills/insta/instagram/SKILL.md +36 -0
  249. package/seed-skills/insta/instagram/references/dm.md +49 -0
  250. package/seed-skills/insta/instagram/references/post.md +74 -0
  251. package/seed-skills/insta/instagram/scripts/compose.mjs +333 -0
  252. package/seed-skills/insta/instagram/scripts/inbox.mjs +163 -0
  253. package/seed-skills/insta/instagram/scripts/lib.mjs +33 -0
  254. package/seed-skills/insta/instagram/scripts/media.mjs +104 -0
  255. package/seed-skills/insta/instagram/scripts/profile.mjs +143 -0
  256. package/seed-skills/insta/instagram/scripts/read.mjs +244 -0
  257. package/seed-skills/insta/instagram/scripts/search.mjs +137 -0
  258. package/seed-skills/insta/instagram/scripts/selectors.mjs +56 -0
  259. package/seed-skills/insta/instagram/scripts/sheet.mjs +43 -0
  260. package/seed-skills/insta/instagram/templates/carousel.html +62 -0
  261. package/seed-skills/marketer/README.md +6 -4
  262. package/seed-skills/marketer/copywriting/SKILL.md +1 -1
  263. package/seed-skills/marketer/emails/SKILL.md +1 -1
  264. package/seed-skills/marketer/launch/SKILL.md +1 -1
  265. package/seed-skills/marketer/product-marketing/SKILL.md +5 -5
  266. package/seed-skills/marketer/seo-audit/SKILL.md +1 -1
  267. package/seed-skills/marketer/social/SKILL.md +1 -1
  268. package/seed-skills/tutor/picture-book/SKILL.md +16 -0
  269. package/seed-skills/tutor/picture-book/book/book.css +181 -0
  270. package/seed-skills/tutor/picture-book/book/book.html +33 -0
  271. package/seed-skills/tutor/picture-book/book/book.js +60 -0
  272. package/seed-skills/tutor/picture-book/references/picture-book.md +104 -0
  273. package/seed-skills/tutor/picture-book/scripts/book-video.mjs +177 -0
  274. package/seed-skills/tutor/picture-book/scripts/book.mjs +98 -0
  275. package/skills/browser/SKILL.md +13 -4
  276. package/skills/browser/references/scripts.md +55 -0
  277. package/skills/browser/scripts/image-size.mjs +30 -0
  278. package/skills/browser/scripts/render.mjs +126 -0
  279. package/skills/browser/scripts/session.mjs +105 -0
  280. package/skills/browser/scripts/sheet.mjs +97 -0
  281. package/skills/browser/scripts/webimage.mjs +105 -0
  282. package/skills/interactive-page/SKILL.md +4 -3
  283. package/skills/interactive-page/scripts/chart.mjs +679 -0
  284. package/skills/interactive-page/scripts/page.mjs +1 -0
  285. package/.next/server/app/api/probe/route/app-paths-manifest.json +0 -3
  286. package/.next/server/app/api/probe/route/build-manifest.json +0 -12
  287. package/.next/server/app/api/probe/route/server-reference-manifest.json +0 -4
  288. package/.next/server/app/api/probe/route.js +0 -10
  289. package/.next/server/app/api/probe/route.js.map +0 -5
  290. package/.next/server/app/api/probe/route.js.nft.json +0 -1
  291. package/.next/server/app/api/probe/route_client-reference-manifest.js +0 -3
  292. package/.next/server/chunks/[root-of-the-server]__012s2o8._.js +0 -3
  293. package/.next/server/chunks/[root-of-the-server]__0z0hc1f._.js +0 -4
  294. package/.next/server/chunks/[root-of-the-server]__1v7-zke._.js +0 -5
  295. package/.next/server/chunks/_0whlpyi._.js +0 -4
  296. package/.next/server/chunks/_next-internal_server_app_api_probe_route_actions_0cqd30j.js +0 -3
  297. package/.next/server/chunks/ssr/[root-of-the-server]__0oo-wlv._.js +0 -103
  298. package/.next/server/chunks/ssr/[root-of-the-server]__0zuns7e._.js +0 -3
  299. package/.next/server/chunks/ssr/_070nv1_._.js +0 -3
  300. package/.next/server/chunks/ssr/_0dshsh4._.js +0 -3
  301. package/.next/server/chunks/ssr/_0l_mcfz._.js +0 -3
  302. package/.next/server/chunks/ssr/_0u5xv6g._.js +0 -3
  303. package/.next/server/chunks/ssr/_157yfrk._.js +0 -3
  304. package/.next/server/chunks/ssr/features_bot_1nr94ks._.js +0 -3
  305. package/.next/static/chunks/06nt9tatr-dug.js +0 -1
  306. package/.next/static/chunks/0ge-hx0ed83a1.js +0 -1
  307. package/.next/static/chunks/0pda_vf-abwvx.js +0 -1
  308. package/.next/static/chunks/0rowp9rx3qbxu.js +0 -18
  309. package/.next/static/chunks/1grkt5gr8pbg1.js +0 -17
  310. package/.next/static/chunks/1yugpvvi8qrbu.js +0 -101
  311. package/.next/static/chunks/27lkanxvtdn09.js +0 -1
  312. package/.next/static/chunks/3fec-aeteddr-.js +0 -1
  313. package/.next/static/chunks/3go3hwp1z2_h2.css +0 -1
  314. package/.next/static/chunks/3h2bun3hcggg8.js +0 -1
  315. package/.next/static/chunks/3j1y335o95mj7.js +0 -1
  316. package/lib/probe.server.ts +0 -17
  317. package/lib/probe.ts +0 -55
  318. /package/.next/static/{u8kJqShUAa49vY7BxAWsw → En1vUPazxcYjPjnnahcN5}/_buildManifest.js +0 -0
  319. /package/.next/static/{u8kJqShUAa49vY7BxAWsw → En1vUPazxcYjPjnnahcN5}/_clientMiddlewareManifest.js +0 -0
  320. /package/.next/static/{u8kJqShUAa49vY7BxAWsw → En1vUPazxcYjPjnnahcN5}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),n=e.i(225913);e.i(271645);var s=e.i(647163);function a({className:e,...n}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,s.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...n})}e.i(652225);let r=(0,n.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:n="vertical",...a}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":n,className:(0,s.cn)(r({orientation:n}),e),...a})},"FieldContent",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,s.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...n})},"FieldLabel",0,function({className:e,...n}){return(0,t.jsx)(a,{"data-slot":"field-label",className:(0,s.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...n})}],986530)},787800,e=>{"use strict";var t=e.i(843476),n=e.i(689664),s=e.i(716327),a=e.i(867927),r=e.i(21357),o=e.i(77071),i=e.i(456420);let c={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};c.node;let l=(0,i.default)(c),d={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};d.node;let m=(0,i.default)(d);var p=e.i(759659),u=e.i(263676),h=e.i(271645),f=e.i(798120),g=e.i(167881),x=e.i(986530),v=e.i(23750),j=e.i(647163);let b=(0,h.memo)(({data:e,name:n,initialExpandDepth:s=2})=>{let a=(0,h.useMemo)(()=>"string"==typeof e?function(e){let t=e.trim();if(!(t.startsWith("{")&&t.endsWith("}"))&&!(t.startsWith("[")&&t.endsWith("]")))return{success:!1,data:e};try{return{success:!0,data:JSON.parse(e)}}catch{return{success:!1,data:e}}}(e).data:e,[e]);return(0,t.jsx)("div",{className:" text-sm transition-all duration-300",children:(0,t.jsx)(y,{data:a,name:n,depth:0,initialExpandDepth:s})})});b.displayName="JsonView";let y=(0,h.memo)(({data:e,name:n,depth:s=0,initialExpandDepth:a})=>{var r;let o=void 0===e?"undefined":Array.isArray(e)?"array":null===e?"null":typeof e,[i,c]=(0,h.useState)("string"!==o&&s<a),l={number:"text-blue-500",boolean:"text-amber-500",null:"text-purple-500",undefined:"text-gray-500",string:"text-foreground break-all whitespace-pre-wrap",default:"text-muted-foreground"};switch(o){case"object":case"array":let d,m,p;return m=(d=(r="array"===o)?e:Object.entries(e)).length,p={open:r?"[":"{",close:r?"]":"}",collapsed:r?"[ ... ]":"{ ... }",empty:r?"[]":"{}"},0===m?(0,t.jsxs)("div",{className:"flex items-center",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:"text-muted-foreground",children:p.empty})]}):(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded cursor-pointer group hover:bg-input/30",onClick:()=>c(!i),children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[n,":"]}),i?(0,t.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:p.open}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:p.collapsed}),(0,t.jsxs)("span",{className:"ml-1 text-muted-foreground group-hover:text-foreground",children:[m," ",1===m?"item":"items"]})]})]}),i&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"pl-2 ml-4 border-l border-border",children:r?d.map((e,n)=>(0,t.jsx)("div",{className:"my-1",children:(0,t.jsx)(y,{data:e,name:`${n}`,depth:s+1,initialExpandDepth:a})},n)):d.map(([e,n])=>(0,t.jsx)("div",{className:"my-1",children:(0,t.jsx)(y,{data:n,name:e,depth:s+1,initialExpandDepth:a})},e))}),(0,t.jsx)("div",{className:"text-muted-foreground",children:p.close})]})]});case"string":return e.length>100?(0,t.jsxs)("div",{className:"flex mr-1 rounded group hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[n,":"]}),(0,t.jsx)("pre",{className:(0,j.cn)(l.string,"cursor-pointer group-hover:text-foreground"),onClick:()=>c(!i),title:i?"Click to collapse":"Click to expand",children:i?`"${e}"`:`"${e.slice(0,100)}..."`})]}):(0,t.jsxs)("div",{className:"flex mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsxs)("pre",{className:l.string,children:['"',e,'"']})]});case"undefined":return(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:l.undefined,children:"undefined"})]});default:return(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:l[o]||l.default,children:null===e?"null":String(e)})]})}});y.displayName="JsonNode";var N=e.i(917162),k=e.i(818125),S=e.i(319036),w=e.i(127341),C=e.i(184762),z=e.i(6799),O=e.i(95187);let A=(0,O.createServerReference)("7f9f7203d69588d2a7607491fa423f8974ed7d8271",O.callServer,void 0,O.findSourceMapURL,"callToolAction"),T=(0,O.createServerReference)("7f3ffbe43cd0e53bcef209cec6c741a97021df5ec0",O.callServer,void 0,O.findSourceMapURL,"deleteServerAction"),I=(0,O.createServerReference)("7f37aeae9f639b84e3375d6c3d50d4e5c13c749973",O.callServer,void 0,O.findSourceMapURL,"refreshServerAction"),F=(0,O.createServerReference)("7f86f9bf2207bdccd91bb068c5bbbb14fb0b889db9",O.callServer,void 0,O.findSourceMapURL,"registerServerAction");var P=e.i(681307),$=e.i(245629);let M=P.z.object({url:P.z.url(),headers:P.z.record(P.z.string(),P.z.string()).optional(),oauthClient:P.z.object({clientId:P.z.string().min(1),clientSecret:P.z.string().optional()}).optional()}),D=P.z.object({command:P.z.string().min(1),args:P.z.array(P.z.string()).optional(),env:P.z.record(P.z.string(),P.z.string()).optional()}),R=P.z.union([M,D]),L=P.z.object({name:P.z.string(),description:P.z.string().optional(),inputSchema:P.z.looseObject({}).optional(),outputSchema:P.z.looseObject({}).optional()});function E(e){return"url"in e}P.z.object({clientInformation:P.z.looseObject({}).optional(),tokens:P.z.looseObject({}).optional(),authorizationServer:P.z.looseObject({}).optional(),codeVerifier:P.z.string().optional(),state:P.z.string().optional()});let q=P.z.object({name:P.z.string().min(1).max(40),config:R,toolCount:P.z.number().int(),lastError:P.z.string().nullish()}),B=L.extend({id:P.z.number().int(),description:P.z.string().nullish()});q.omit({toolCount:!0}).extend({tools:B.array().default([]),toolsSyncedAt:$.DateLikeSchema});let J=P.z.object({name:P.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:R}),U=P.z.union([P.z.object({mcpServers:P.z.record(P.z.string(),R)}),P.z.record(P.z.string(),R)]),K=[{name:"todoist",icon:"todoist.com",description:"Tasks, projects, and due dates",config:{url:"https://ai.todoist.net/mcp"}},{name:"home-assistant",icon:"home-assistant.io",description:"Lights, switches, and the rest of the house — your address and a long-lived token",config:{url:"http://homeassistant.local:8123/api/mcp",headers:{Authorization:"Bearer <your-home-assistant-token>"}}},{name:"kiwi",icon:"kiwi.com",description:"Flight search — no account",config:{url:"https://mcp.kiwi.com"}},{name:"zapier",icon:"zapier.com",description:"Gmail, Google Calendar, and thousands of apps you connect there",config:{url:"https://mcp.zapier.com/api/v1/connect"}},{name:"notion",icon:"notion.so",description:"Pages, databases, and search",config:{url:"https://mcp.notion.com/mcp"}},{name:"canva",icon:"canva.com",description:"Create and manage designs",config:{url:"https://mcp.canva.com/mcp"}},{name:"slack",icon:"slack.com",description:"Channels, messages, and search",config:{url:"https://mcp.slack.com/mcp"}},{name:"box",icon:"box.com",description:"Files, folders, and content search",config:{url:"https://mcp.box.com/mcp"}},{name:"airtable",icon:"airtable.com",description:"Bases, tables, and records",config:{url:"https://mcp.airtable.com/mcp"}},{name:"fireflies",icon:"fireflies.ai",description:"Meeting transcripts and summaries",config:{url:"https://mcp.fireflies.ai/mcp"}},{name:"figma",icon:"figma.com",description:"Design files and components",config:{url:"https://mcp.figma.com/mcp"}},{name:"asana",icon:"asana.com",description:"Tasks, projects, and portfolios",config:{url:"https://mcp.asana.com/mcp"}},{name:"monday",icon:"monday.com",description:"Boards, items, and updates",config:{url:"https://mcp.monday.com/mcp"}},{name:"clickup",icon:"clickup.com",description:"Tasks, docs, and spaces",config:{url:"https://mcp.clickup.com/mcp"}},{name:"linear",icon:"linear.app",description:"Issues, projects, and cycles",config:{url:"https://mcp.linear.app/mcp"}},{name:"atlassian",icon:"atlassian.com",description:"Jira and Confluence",config:{url:"https://mcp.atlassian.com/v1/mcp"}},{name:"hubspot",icon:"hubspot.com",description:"Contacts, deals, and companies",config:{url:"https://app.hubspot.com/mcp/v1/http"}},{name:"attio",icon:"attio.com",description:"CRM records and lists",config:{url:"https://mcp.attio.com/mcp"}},{name:"intercom",icon:"intercom.com",description:"Conversations and support tickets",config:{url:"https://mcp.intercom.com/mcp"}},{name:"wix",icon:"wix.com",description:"Sites, stores, and bookings",config:{url:"https://mcp.wix.com/mcp"}},{name:"webflow",icon:"webflow.com",description:"Sites, pages, and CMS collections",config:{url:"https://mcp.webflow.com/mcp"}},{name:"sanity",icon:"sanity.io",description:"Structured content and datasets",config:{url:"https://mcp.sanity.io/mcp"}},{name:"stripe",icon:"stripe.com",description:"Payments, invoices, and customers",config:{url:"https://mcp.stripe.com"}},{name:"paypal",icon:"paypal.com",description:"Payments and orders",config:{url:"https://mcp.paypal.com/mcp"}},{name:"square",icon:"squareup.com",description:"Payments, catalog, and orders",config:{url:"https://mcp.squareup.com/mcp"}},{name:"ramp",icon:"ramp.com",description:"Spend, cards, and transactions",config:{url:"https://mcp.ramp.com/mcp"}},{name:"github",icon:"github.com",description:"Repos, issues, PRs — paste a personal access token",config:{url:"https://api.githubcopilot.com/mcp/",headers:{Authorization:"Bearer <your-github-pat>"}}},{name:"vercel",icon:"vercel.com",description:"Deployments and projects",config:{url:"https://mcp.vercel.com"}},{name:"netlify",icon:"netlify.com",description:"Sites, builds, and deploys",config:{url:"https://mcp.netlify.com/mcp"}},{name:"cloudflare",icon:"cloudflare.com",description:"Workers bindings — D1, R2, KV",config:{url:"https://bindings.mcp.cloudflare.com/mcp"}},{name:"supabase",icon:"supabase.com",description:"Projects, tables, and SQL",config:{url:"https://mcp.supabase.com/mcp"}},{name:"neon",icon:"neon.tech",description:"Postgres branches and queries",config:{url:"https://mcp.neon.tech/mcp"}},{name:"prisma",icon:"prisma.io",description:"Postgres databases and schema",config:{url:"https://mcp.prisma.io/mcp"}},{name:"sentry",icon:"sentry.io",description:"Errors and performance issues",config:{url:"https://mcp.sentry.dev/mcp"}},{name:"grafana",icon:"grafana.com",description:"Dashboards, metrics, and alerts",config:{url:"https://mcp.grafana.com/mcp"}},{name:"semgrep",icon:"semgrep.dev",description:"Scan code for security findings",config:{url:"https://mcp.semgrep.ai/mcp"}},{name:"postman",icon:"postman.com",description:"Collections, environments, and requests",config:{url:"https://mcp.postman.com/mcp"}},{name:"resend",icon:"resend.com",description:"Send email and manage audiences",config:{url:"https://mcp.resend.com/mcp"}},{name:"hugging-face",icon:"huggingface.co",description:"Models, datasets, and Spaces",config:{url:"https://huggingface.co/mcp"}},{name:"apify",icon:"apify.com",description:"Run scrapers and automation actors",config:{url:"https://mcp.apify.com"}},{name:"exa",icon:"exa.ai",description:"Web search for agents",config:{url:"https://mcp.exa.ai/mcp"}},{name:"kagi",icon:"kagi.com",description:"Search, summarize, and answer",config:{url:"https://mcp.kagi.com/mcp"}},{name:"context7",icon:"context7.com",description:"Up-to-date library docs",config:{url:"https://mcp.context7.com/mcp"}},{name:"deepwiki",icon:"deepwiki.com",description:"Ask questions about any GitHub repo",config:{url:"https://mcp.deepwiki.com/mcp"}},{name:"microsoft-learn",icon:"learn.microsoft.com",description:"Microsoft and Azure docs — no account",config:{url:"https://learn.microsoft.com/api/mcp"}},{name:"aws-knowledge",icon:"aws.amazon.com",description:"AWS docs and API references — no account",config:{url:"https://knowledge-mcp.global.api.aws"}},{name:"cloudflare-docs",icon:"developers.cloudflare.com",description:"Cloudflare docs — no account",config:{url:"https://docs.mcp.cloudflare.com/mcp"}},{name:"stack-overflow",icon:"stackoverflow.com",description:"Questions, answers, and teams",config:{url:"https://mcp.stackoverflow.com"}},{name:"playwright",icon:"playwright.dev",description:"Drive a real browser",config:{command:"npx",args:["@playwright/mcp@latest"]}},{name:"chrome-devtools",icon:"developer.chrome.com",description:"Inspect and debug Chrome",config:{command:"npx",args:["chrome-devtools-mcp@latest"]}}];var H=e.i(895836),V=e.i(333999),W=e.i(609856),_=e.i(283653);function G({name:e,onDone:n}){let{data:s,isLoading:a}=(0,_.useServerRoute)(f.queryKey.mcpServer(e)),[r,o]=(0,W.useServerAction)(I,{...ei,onOk:t=>{ei.onOk(t),(0,_.revalidate)(f.queryKey.mcpServer(e))}}),[i,c]=(0,W.useServerAction)(T,{okMessage:"Server deleted",onOk:()=>{n(),(0,_.revalidate)(f.queryKey.mcp)}}),d=async()=>{await N.notify.confirm({title:`Delete ${e}?`,description:"Its connection and saved authorization go with it.",okText:"Delete",destructive:!0})&&i(e)};if(a)return(0,t.jsx)(H.SettingSkeleton,{rows:4});if(!s)return null;let m=s.tools.length,u=E(s.config)?"HTTP":"STDIO";return(0,t.jsxs)(H.SettingDialogContent,{title:s.name,description:(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[10px]",children:u}),(0,t.jsx)("span",{className:"truncate font-mono",children:el(s.config)})]}),footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(g.Button,{variant:"ghost",loading:c,onClick:d,children:[(0,t.jsx)(p.Trash2,{}),"Delete"]}),(0,t.jsxs)(g.Button,{variant:"outline",loading:o,onClick:()=>r(s.name),children:[(0,t.jsx)(l,{}),"Reconnect"]})]}),children:[s.lastError&&(0,t.jsx)("p",{className:"rounded-lg bg-destructive/10 px-3 py-2 font-mono text-xs text-destructive",children:s.lastError}),(0,t.jsxs)("p",{className:"text-right font-mono text-xs text-muted-foreground",children:[m," ",1===m?"tool":"tools"]}),s.tools.map(e=>(0,t.jsx)(Y,{tool:e,serverName:s.name},e.name))]})}function Q({server:e}){let s=e.toolCount,r=e.lastError?"error":s>0?"connected":"idle";return(0,t.jsxs)("button",{type:"button",onClick:()=>{N.notify.component({className:"sm:max-w-3xl",renderer:({close:n})=>(0,t.jsx)(G,{name:e.name,onDone:n})})},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,t.jsx)(X,{server:e})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e.name}),"connected"===r&&(0,t.jsx)(n.Check,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:"error"===r?(0,t.jsx)("span",{className:"text-destructive",children:e.lastError}):(0,t.jsxs)(t.Fragment,{children:[s>0?`${s} ${1===s?"tool":"tools"}`:"No tools yet",(0,t.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground/70",children:[" · ",el(e.config)]})]})})]}),(0,t.jsx)(a.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}function X({server:e}){let n,s=(n=K.find(t=>E(t.config)?E(e.config)&&t.config.url.replace(/\/+$/,"")===e.config.url.replace(/\/+$/,""):!E(e.config)&&t.config.command===e.config.command&&(t.config.args??[]).join(" ")===(e.config.args??[]).join(" "))??K.find(t=>t.name===e.name),n?.icon);return s?(0,t.jsx)(k.SiteIcon,{host:s,className:"size-5",fallback:(0,t.jsx)(m,{className:"size-4"})}):(0,t.jsx)(m,{className:"size-4"})}function Y({tool:e,serverName:n}){let[r,o]=(0,h.useState)(!1),[i,c]=(0,h.useState)(!1),[l,d]=(0,h.useState)(!1),m=[["inputSchema",e.inputSchema],["outputSchema",e.outputSchema]].filter(([,e])=>e);return(0,t.jsxs)("div",{className:"rounded-xl border border-border/60 bg-background p-4",children:[(0,t.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,t.jsx)("span",{className:"block truncate font-mono text-sm",children:e.name}),e.description?(0,t.jsx)("p",{className:(0,j.cn)("text-xs text-muted-foreground",!l&&"line-clamp-2",e.description.length>140&&"cursor-pointer"),onClick:()=>d(!l),children:e.description}):null]}),(0,t.jsxs)("div",{className:"mt-2 flex justify-end gap-1",children:[m.length>0&&(0,t.jsxs)(g.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>o(!r),children:[r?(0,t.jsx)(s.ChevronDown,{}):(0,t.jsx)(a.ChevronRight,{}),"Schema"]}),(0,t.jsxs)(g.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>c(!i),children:[i?(0,t.jsx)(s.ChevronDown,{}):(0,t.jsx)(a.ChevronRight,{}),"Test"]})]}),r?(0,t.jsx)("div",{className:"mt-2 space-y-3 overflow-x-auto rounded-lg border border-input p-3",children:m.map(([e,n])=>(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("span",{className:"block font-mono text-xs text-muted-foreground",children:"inputSchema"===e?"in":"out"}),(0,t.jsx)("pre",{className:"font-mono text-xs leading-relaxed whitespace-pre",children:function e(t,n=0){if(!t||"object"!=typeof t)return"unknown";let s=" ".repeat(n+1),a=" ".repeat(n);if(Array.isArray(t.enum))return t.enum.map(e=>JSON.stringify(e)).join(" | ");let r=t.anyOf??t.oneOf;if(Array.isArray(r))return r.map(t=>e(t,n)).join(" | ");if("array"===t.type){let s=e(t.items,n);return/[|{]/.test(s)?`(${s})[]`:`${s}[]`}if("object"===t.type||t.properties){let r=t.properties;if(!r||0===Object.keys(r).length)return"{}";let o=t.required??[],i=Object.entries(r).map(([t,a])=>{let r=o.includes(t)?"":"?",i=a?.description,c="string"==typeof i&&i.length<=60?` // ${i}`:"";return`${s}${t}${r}: ${e(a,n+1)}${c}`});return`{
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),n=e.i(225913);e.i(271645);var s=e.i(647163);function a({className:e,...n}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,s.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...n})}e.i(652225);let r=(0,n.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:n="vertical",...a}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":n,className:(0,s.cn)(r({orientation:n}),e),...a})},"FieldContent",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,s.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...n})},"FieldLabel",0,function({className:e,...n}){return(0,t.jsx)(a,{"data-slot":"field-label",className:(0,s.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...n})}],986530)},787800,e=>{"use strict";var t=e.i(843476),n=e.i(689664),s=e.i(716327),a=e.i(867927),r=e.i(21357),o=e.i(77071),i=e.i(456420);let c={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};c.node;let l=(0,i.default)(c),d={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};d.node;let m=(0,i.default)(d);var p=e.i(759659),u=e.i(263676),h=e.i(271645),f=e.i(798120),g=e.i(167881),x=e.i(986530),v=e.i(23750),j=e.i(647163);let b=(0,h.memo)(({data:e,name:n,initialExpandDepth:s=2})=>{let a=(0,h.useMemo)(()=>"string"==typeof e?function(e){let t=e.trim();if(!(t.startsWith("{")&&t.endsWith("}"))&&!(t.startsWith("[")&&t.endsWith("]")))return{success:!1,data:e};try{return{success:!0,data:JSON.parse(e)}}catch{return{success:!1,data:e}}}(e).data:e,[e]);return(0,t.jsx)("div",{className:" text-sm transition-all duration-300",children:(0,t.jsx)(y,{data:a,name:n,depth:0,initialExpandDepth:s})})});b.displayName="JsonView";let y=(0,h.memo)(({data:e,name:n,depth:s=0,initialExpandDepth:a})=>{var r;let o=void 0===e?"undefined":Array.isArray(e)?"array":null===e?"null":typeof e,[i,c]=(0,h.useState)("string"!==o&&s<a),l={number:"text-blue-500",boolean:"text-amber-500",null:"text-purple-500",undefined:"text-gray-500",string:"text-foreground break-all whitespace-pre-wrap",default:"text-muted-foreground"};switch(o){case"object":case"array":let d,m,p;return m=(d=(r="array"===o)?e:Object.entries(e)).length,p={open:r?"[":"{",close:r?"]":"}",collapsed:r?"[ ... ]":"{ ... }",empty:r?"[]":"{}"},0===m?(0,t.jsxs)("div",{className:"flex items-center",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:"text-muted-foreground",children:p.empty})]}):(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded cursor-pointer group hover:bg-input/30",onClick:()=>c(!i),children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[n,":"]}),i?(0,t.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:p.open}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:p.collapsed}),(0,t.jsxs)("span",{className:"ml-1 text-muted-foreground group-hover:text-foreground",children:[m," ",1===m?"item":"items"]})]})]}),i&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"pl-2 ml-4 border-l border-border",children:r?d.map((e,n)=>(0,t.jsx)("div",{className:"my-1",children:(0,t.jsx)(y,{data:e,name:`${n}`,depth:s+1,initialExpandDepth:a})},n)):d.map(([e,n])=>(0,t.jsx)("div",{className:"my-1",children:(0,t.jsx)(y,{data:n,name:e,depth:s+1,initialExpandDepth:a})},e))}),(0,t.jsx)("div",{className:"text-muted-foreground",children:p.close})]})]});case"string":return e.length>100?(0,t.jsxs)("div",{className:"flex mr-1 rounded group hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[n,":"]}),(0,t.jsx)("pre",{className:(0,j.cn)(l.string,"cursor-pointer group-hover:text-foreground"),onClick:()=>c(!i),title:i?"Click to collapse":"Click to expand",children:i?`"${e}"`:`"${e.slice(0,100)}..."`})]}):(0,t.jsxs)("div",{className:"flex mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsxs)("pre",{className:l.string,children:['"',e,'"']})]});case"undefined":return(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:l.undefined,children:"undefined"})]});default:return(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:l[o]||l.default,children:null===e?"null":String(e)})]})}});y.displayName="JsonNode";var N=e.i(917162),k=e.i(818125),S=e.i(319036),w=e.i(127341),C=e.i(184762),z=e.i(6799),O=e.i(95187);let A=(0,O.createServerReference)("7f344c3766a1a64392dd175cfda6bc586b4d2ec9d7",O.callServer,void 0,O.findSourceMapURL,"callToolAction"),T=(0,O.createServerReference)("7f51424f101e91151b853385b4c739895dfa68b072",O.callServer,void 0,O.findSourceMapURL,"deleteServerAction"),I=(0,O.createServerReference)("7fefed987ba50327eea70a99feae96188e37737789",O.callServer,void 0,O.findSourceMapURL,"refreshServerAction"),F=(0,O.createServerReference)("7f8515c143eeb315d12871b80167592d3d6d5bfa84",O.callServer,void 0,O.findSourceMapURL,"registerServerAction");var P=e.i(681307),$=e.i(245629);let M=P.z.object({url:P.z.url(),headers:P.z.record(P.z.string(),P.z.string()).optional(),oauthClient:P.z.object({clientId:P.z.string().min(1),clientSecret:P.z.string().optional()}).optional()}),D=P.z.object({command:P.z.string().min(1),args:P.z.array(P.z.string()).optional(),env:P.z.record(P.z.string(),P.z.string()).optional()}),R=P.z.union([M,D]),L=P.z.object({name:P.z.string(),description:P.z.string().optional(),inputSchema:P.z.looseObject({}).optional(),outputSchema:P.z.looseObject({}).optional()});function E(e){return"url"in e}P.z.object({clientInformation:P.z.looseObject({}).optional(),tokens:P.z.looseObject({}).optional(),authorizationServer:P.z.looseObject({}).optional(),codeVerifier:P.z.string().optional(),state:P.z.string().optional()});let q=P.z.object({name:P.z.string().min(1).max(40),config:R,toolCount:P.z.number().int(),lastError:P.z.string().nullish()}),B=L.extend({id:P.z.number().int(),description:P.z.string().nullish()});q.omit({toolCount:!0}).extend({tools:B.array().default([]),toolsSyncedAt:$.DateLikeSchema});let J=P.z.object({name:P.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:R}),U=P.z.union([P.z.object({mcpServers:P.z.record(P.z.string(),R)}),P.z.record(P.z.string(),R)]),K=[{name:"todoist",icon:"todoist.com",description:"Tasks, projects, and due dates",config:{url:"https://ai.todoist.net/mcp"}},{name:"home-assistant",icon:"home-assistant.io",description:"Lights, switches, and the rest of the house — your address and a long-lived token",config:{url:"http://homeassistant.local:8123/api/mcp",headers:{Authorization:"Bearer <your-home-assistant-token>"}}},{name:"kiwi",icon:"kiwi.com",description:"Flight search — no account",config:{url:"https://mcp.kiwi.com"}},{name:"zapier",icon:"zapier.com",description:"Gmail, Google Calendar, and thousands of apps you connect there",config:{url:"https://mcp.zapier.com/api/v1/connect"}},{name:"notion",icon:"notion.so",description:"Pages, databases, and search",config:{url:"https://mcp.notion.com/mcp"}},{name:"canva",icon:"canva.com",description:"Create and manage designs",config:{url:"https://mcp.canva.com/mcp"}},{name:"slack",icon:"slack.com",description:"Channels, messages, and search",config:{url:"https://mcp.slack.com/mcp"}},{name:"box",icon:"box.com",description:"Files, folders, and content search",config:{url:"https://mcp.box.com/mcp"}},{name:"airtable",icon:"airtable.com",description:"Bases, tables, and records",config:{url:"https://mcp.airtable.com/mcp"}},{name:"fireflies",icon:"fireflies.ai",description:"Meeting transcripts and summaries",config:{url:"https://mcp.fireflies.ai/mcp"}},{name:"figma",icon:"figma.com",description:"Design files and components",config:{url:"https://mcp.figma.com/mcp"}},{name:"asana",icon:"asana.com",description:"Tasks, projects, and portfolios",config:{url:"https://mcp.asana.com/mcp"}},{name:"monday",icon:"monday.com",description:"Boards, items, and updates",config:{url:"https://mcp.monday.com/mcp"}},{name:"clickup",icon:"clickup.com",description:"Tasks, docs, and spaces",config:{url:"https://mcp.clickup.com/mcp"}},{name:"linear",icon:"linear.app",description:"Issues, projects, and cycles",config:{url:"https://mcp.linear.app/mcp"}},{name:"atlassian",icon:"atlassian.com",description:"Jira and Confluence",config:{url:"https://mcp.atlassian.com/v1/mcp"}},{name:"hubspot",icon:"hubspot.com",description:"Contacts, deals, and companies",config:{url:"https://app.hubspot.com/mcp/v1/http"}},{name:"attio",icon:"attio.com",description:"CRM records and lists",config:{url:"https://mcp.attio.com/mcp"}},{name:"intercom",icon:"intercom.com",description:"Conversations and support tickets",config:{url:"https://mcp.intercom.com/mcp"}},{name:"wix",icon:"wix.com",description:"Sites, stores, and bookings",config:{url:"https://mcp.wix.com/mcp"}},{name:"webflow",icon:"webflow.com",description:"Sites, pages, and CMS collections",config:{url:"https://mcp.webflow.com/mcp"}},{name:"sanity",icon:"sanity.io",description:"Structured content and datasets",config:{url:"https://mcp.sanity.io/mcp"}},{name:"stripe",icon:"stripe.com",description:"Payments, invoices, and customers",config:{url:"https://mcp.stripe.com"}},{name:"paypal",icon:"paypal.com",description:"Payments and orders",config:{url:"https://mcp.paypal.com/mcp"}},{name:"square",icon:"squareup.com",description:"Payments, catalog, and orders",config:{url:"https://mcp.squareup.com/mcp"}},{name:"ramp",icon:"ramp.com",description:"Spend, cards, and transactions",config:{url:"https://mcp.ramp.com/mcp"}},{name:"github",icon:"github.com",description:"Repos, issues, PRs — paste a personal access token",config:{url:"https://api.githubcopilot.com/mcp/",headers:{Authorization:"Bearer <your-github-pat>"}}},{name:"vercel",icon:"vercel.com",description:"Deployments and projects",config:{url:"https://mcp.vercel.com"}},{name:"netlify",icon:"netlify.com",description:"Sites, builds, and deploys",config:{url:"https://mcp.netlify.com/mcp"}},{name:"cloudflare",icon:"cloudflare.com",description:"Workers bindings — D1, R2, KV",config:{url:"https://bindings.mcp.cloudflare.com/mcp"}},{name:"supabase",icon:"supabase.com",description:"Projects, tables, and SQL",config:{url:"https://mcp.supabase.com/mcp"}},{name:"neon",icon:"neon.tech",description:"Postgres branches and queries",config:{url:"https://mcp.neon.tech/mcp"}},{name:"prisma",icon:"prisma.io",description:"Postgres databases and schema",config:{url:"https://mcp.prisma.io/mcp"}},{name:"sentry",icon:"sentry.io",description:"Errors and performance issues",config:{url:"https://mcp.sentry.dev/mcp"}},{name:"grafana",icon:"grafana.com",description:"Dashboards, metrics, and alerts",config:{url:"https://mcp.grafana.com/mcp"}},{name:"semgrep",icon:"semgrep.dev",description:"Scan code for security findings",config:{url:"https://mcp.semgrep.ai/mcp"}},{name:"postman",icon:"postman.com",description:"Collections, environments, and requests",config:{url:"https://mcp.postman.com/mcp"}},{name:"resend",icon:"resend.com",description:"Send email and manage audiences",config:{url:"https://mcp.resend.com/mcp"}},{name:"hugging-face",icon:"huggingface.co",description:"Models, datasets, and Spaces",config:{url:"https://huggingface.co/mcp"}},{name:"apify",icon:"apify.com",description:"Run scrapers and automation actors",config:{url:"https://mcp.apify.com"}},{name:"exa",icon:"exa.ai",description:"Web search for agents",config:{url:"https://mcp.exa.ai/mcp"}},{name:"kagi",icon:"kagi.com",description:"Search, summarize, and answer",config:{url:"https://mcp.kagi.com/mcp"}},{name:"context7",icon:"context7.com",description:"Up-to-date library docs",config:{url:"https://mcp.context7.com/mcp"}},{name:"deepwiki",icon:"deepwiki.com",description:"Ask questions about any GitHub repo",config:{url:"https://mcp.deepwiki.com/mcp"}},{name:"microsoft-learn",icon:"learn.microsoft.com",description:"Microsoft and Azure docs — no account",config:{url:"https://learn.microsoft.com/api/mcp"}},{name:"aws-knowledge",icon:"aws.amazon.com",description:"AWS docs and API references — no account",config:{url:"https://knowledge-mcp.global.api.aws"}},{name:"cloudflare-docs",icon:"developers.cloudflare.com",description:"Cloudflare docs — no account",config:{url:"https://docs.mcp.cloudflare.com/mcp"}},{name:"stack-overflow",icon:"stackoverflow.com",description:"Questions, answers, and teams",config:{url:"https://mcp.stackoverflow.com"}},{name:"playwright",icon:"playwright.dev",description:"Drive a real browser",config:{command:"npx",args:["@playwright/mcp@latest"]}},{name:"chrome-devtools",icon:"developer.chrome.com",description:"Inspect and debug Chrome",config:{command:"npx",args:["chrome-devtools-mcp@latest"]}}];var H=e.i(895836),V=e.i(333999),W=e.i(609856),_=e.i(283653);function G({name:e,onDone:n}){let{data:s,isLoading:a}=(0,_.useServerRoute)(f.queryKey.mcpServer(e)),[r,o]=(0,W.useServerAction)(I,{...ei,onOk:t=>{ei.onOk(t),(0,_.revalidate)(f.queryKey.mcpServer(e))}}),[i,c]=(0,W.useServerAction)(T,{okMessage:"Server deleted",onOk:()=>{n(),(0,_.revalidate)(f.queryKey.mcp)}}),d=async()=>{await N.notify.confirm({title:`Delete ${e}?`,description:"Its connection and saved authorization go with it.",okText:"Delete",destructive:!0})&&i(e)};if(a)return(0,t.jsx)(H.SettingSkeleton,{rows:4});if(!s)return null;let m=s.tools.length,u=E(s.config)?"HTTP":"STDIO";return(0,t.jsxs)(H.SettingDialogContent,{title:s.name,description:(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[10px]",children:u}),(0,t.jsx)("span",{className:"truncate font-mono",children:el(s.config)})]}),footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(g.Button,{variant:"ghost",loading:c,onClick:d,children:[(0,t.jsx)(p.Trash2,{}),"Delete"]}),(0,t.jsxs)(g.Button,{variant:"outline",loading:o,onClick:()=>r(s.name),children:[(0,t.jsx)(l,{}),"Reconnect"]})]}),children:[s.lastError&&(0,t.jsx)("p",{className:"rounded-lg bg-destructive/10 px-3 py-2 font-mono text-xs text-destructive",children:s.lastError}),(0,t.jsxs)("p",{className:"text-right font-mono text-xs text-muted-foreground",children:[m," ",1===m?"tool":"tools"]}),s.tools.map(e=>(0,t.jsx)(Y,{tool:e,serverName:s.name},e.name))]})}function Q({server:e}){let s=e.toolCount,r=e.lastError?"error":s>0?"connected":"idle";return(0,t.jsxs)("button",{type:"button",onClick:()=>{N.notify.component({className:"sm:max-w-3xl",renderer:({close:n})=>(0,t.jsx)(G,{name:e.name,onDone:n})})},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,t.jsx)(X,{server:e})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e.name}),"connected"===r&&(0,t.jsx)(n.Check,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:"error"===r?(0,t.jsx)("span",{className:"text-destructive",children:e.lastError}):(0,t.jsxs)(t.Fragment,{children:[s>0?`${s} ${1===s?"tool":"tools"}`:"No tools yet",(0,t.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground/70",children:[" · ",el(e.config)]})]})})]}),(0,t.jsx)(a.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}function X({server:e}){let n,s=(n=K.find(t=>E(t.config)?E(e.config)&&t.config.url.replace(/\/+$/,"")===e.config.url.replace(/\/+$/,""):!E(e.config)&&t.config.command===e.config.command&&(t.config.args??[]).join(" ")===(e.config.args??[]).join(" "))??K.find(t=>t.name===e.name),n?.icon);return s?(0,t.jsx)(k.SiteIcon,{host:s,className:"size-5",fallback:(0,t.jsx)(m,{className:"size-4"})}):(0,t.jsx)(m,{className:"size-4"})}function Y({tool:e,serverName:n}){let[r,o]=(0,h.useState)(!1),[i,c]=(0,h.useState)(!1),[l,d]=(0,h.useState)(!1),m=[["inputSchema",e.inputSchema],["outputSchema",e.outputSchema]].filter(([,e])=>e);return(0,t.jsxs)("div",{className:"rounded-xl border border-border/60 bg-background p-4",children:[(0,t.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,t.jsx)("span",{className:"block truncate font-mono text-sm",children:e.name}),e.description?(0,t.jsx)("p",{className:(0,j.cn)("text-xs text-muted-foreground",!l&&"line-clamp-2",e.description.length>140&&"cursor-pointer"),onClick:()=>d(!l),children:e.description}):null]}),(0,t.jsxs)("div",{className:"mt-2 flex justify-end gap-1",children:[m.length>0&&(0,t.jsxs)(g.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>o(!r),children:[r?(0,t.jsx)(s.ChevronDown,{}):(0,t.jsx)(a.ChevronRight,{}),"Schema"]}),(0,t.jsxs)(g.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>c(!i),children:[i?(0,t.jsx)(s.ChevronDown,{}):(0,t.jsx)(a.ChevronRight,{}),"Test"]})]}),r?(0,t.jsx)("div",{className:"mt-2 space-y-3 overflow-x-auto rounded-lg border border-input p-3",children:m.map(([e,n])=>(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("span",{className:"block font-mono text-xs text-muted-foreground",children:"inputSchema"===e?"in":"out"}),(0,t.jsx)("pre",{className:"font-mono text-xs leading-relaxed whitespace-pre",children:function e(t,n=0){if(!t||"object"!=typeof t)return"unknown";let s=" ".repeat(n+1),a=" ".repeat(n);if(Array.isArray(t.enum))return t.enum.map(e=>JSON.stringify(e)).join(" | ");let r=t.anyOf??t.oneOf;if(Array.isArray(r))return r.map(t=>e(t,n)).join(" | ");if("array"===t.type){let s=e(t.items,n);return/[|{]/.test(s)?`(${s})[]`:`${s}[]`}if("object"===t.type||t.properties){let r=t.properties;if(!r||0===Object.keys(r).length)return"{}";let o=t.required??[],i=Object.entries(r).map(([t,a])=>{let r=o.includes(t)?"":"?",i=a?.description,c="string"==typeof i&&i.length<=60?` // ${i}`:"";return`${s}${t}${r}: ${e(a,n+1)}${c}`});return`{
2
2
  ${i.join("\n")}
3
3
  ${a}}`}return Array.isArray(t.type)?t.type.join(" | "):"string"==typeof t.type?t.type:"unknown"}(n)})]},e))}):null,i?(0,t.jsx)(Z,{tool:e,serverName:n}):null]})}function Z({tool:e,serverName:n}){let[s,a]=(0,h.useState)(()=>(function(e){let t=e.inputSchema?.properties;if(!t||"object"!=typeof t)return"{}";let n={};for(let[e,s]of Object.entries(t))n[e]=s?.type==="number"||s?.type==="integer"?0:s?.type!=="boolean"&&(s?.type==="array"?[]:s?.type==="object"?{}:"");return JSON.stringify(n,null,2)})(e)),[o,i]=(0,h.useState)(""),[c,l,d,m,p]=(0,W.useServerAction)(A,{errorMessage:!1});return(0,t.jsxs)("div",{className:"mt-2 space-y-2 rounded-lg border border-input p-3",children:[(0,t.jsx)(C.Textarea,{value:s,onChange:e=>a(e.target.value),spellCheck:!1,className:"min-h-24 resize-none font-mono text-xs"}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"font-mono text-xs text-destructive",children:o||m}),(0,t.jsxs)(g.Button,{size:"sm",loading:l,onClick:()=>{let t;try{t=s.trim()?JSON.parse(s):void 0}catch{i("Not valid JSON");return}i(""),p(),c(n,e.name,t)},children:[!l&&(0,t.jsx)(r.Play,{}),"Run"]})]}),void 0!==d&&(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg bg-muted/40 p-3",children:(0,t.jsx)(b,{data:d,initialExpandDepth:3})})]})}function ee(e){return N.notify.component({className:"sm:max-w-lg",renderer:({close:n})=>(0,t.jsx)(et,{initial:e,onDone:n})})}function et({initial:e,onDone:n}){let s=e&&E(e.config)?e.config:void 0,a=e&&!E(e.config)?e.config:void 0,[r,o]=(0,V.useObjectState)({mode:a?"stdio":"http",name:e?.name??"",url:s?.url??"",headers:ea(s?.headers),clientId:s?.oauthClient?.clientId??"",clientSecret:s?.oauthClient?.clientSecret??"",command:a?.command??"",args:(a?.args??[]).join(" "),env:ea(a?.env),raw:""}),{mode:i,name:c,url:l,headers:d,clientId:m,clientSecret:p,command:u,args:f,env:j,raw:b}=r,[y,N]=(0,W.useServerAction)(F,{...ei,onOk:e=>{ei.onOk(e),"error"!==e.status&&n()}}),k=(0,h.useMemo)(()=>{var e,t,n,s,a,r,o;let c,h;return"json"===i?function(e){let t,n=e.trim();if(!n)return{value:null,error:""};try{t=JSON.parse(n)}catch{return{value:null,error:"Not valid JSON"}}let s=R.safeParse(t);if(s.success)return{value:{name:null,config:s.data},error:""};let a=U.safeParse(t);if(!a.success)return{value:null,error:"Needs a url or a command"};let r=Object.entries("mcpServers"in a.data?a.data.mcpServers:a.data)[0];return r?{value:{name:r[0],config:r[1]},error:""}:{value:null,error:"No server in there"}}(b):"http"===i?(e=l,t=d,n=m,s=p,(c=M.safeParse({url:e.trim(),headers:er(t),oauthClient:n.trim()?{clientId:n.trim(),clientSecret:s.trim()}:void 0})).success?{value:{name:null,config:c.data},error:""}:{value:null,error:e.trim()?"Needs a valid url":""}):(a=u,r=f,o=j,(h=D.safeParse({command:a.trim(),args:r.split(/\s+/).filter(Boolean),env:er(o)})).success?{value:{name:null,config:h.data},error:""}:{value:null,error:a.trim()?"Needs a command":""})},[i,b,l,d,m,p,u,f,j]),z="json"===i?b:JSON.stringify([i,l,d,m,p,u,f,j]),[O,A]=(0,h.useState)(z);(0,h.useEffect)(()=>{let e=setTimeout(()=>A(z),700);return()=>clearTimeout(e)},[z]);let T=O===z?k.error:"",I=c||k.value?.name||"",P=J.safeParse({name:I,config:k.value?.config});function $(e){let t=k.value?.config;return t?"json"===e?o({mode:e,raw:JSON.stringify(t,null,2)}):"http"===e&&E(t)?o({mode:e,url:t.url,headers:ea(t.headers),clientId:t.oauthClient?.clientId??"",clientSecret:t.oauthClient?.clientSecret??""}):"stdio"!==e||E(t)?void o({mode:e}):o({mode:e,command:t.command,args:(t.args??[]).join(" "),env:ea(t.env)}):o({mode:e})}let L=(0,t.jsxs)("span",{className:"flex items-center gap-2 font-mono text-xs text-muted-foreground",children:["JSON",(0,t.jsx)(S.Switch,{size:"sm",checked:"json"===i,onCheckedChange:e=>{let t;return e?$("json"):void $((t=k.value?.config)&&!E(t)?"stdio":"http")}})]});return(0,t.jsx)(H.SettingDialogContent,{title:"Add MCP server",description:"Its tools become available to Thursday and every sub-agent.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Button,{variant:"ghost",onClick:n,children:"Cancel"}),(0,t.jsx)(g.Button,{disabled:!P.success,loading:N,onClick:()=>{P.success&&!N&&y(P.data)},children:"Connect"})]}),children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{children:"Name"}),(0,t.jsx)(v.Input,{value:I,onChange:e=>o({name:e.target.value}),placeholder:"notion",spellCheck:!1})]}),"json"===i?(0,t.jsxs)(x.Field,{children:[(0,t.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,t.jsx)(x.FieldLabel,{children:"JSON"}),L]}),(0,t.jsx)(C.Textarea,{value:b,onChange:e=>o({raw:e.target.value}),spellCheck:!1,placeholder:eo,className:"min-h-64 resize-none font-mono text-xs"})]}):(0,t.jsxs)(w.Tabs,{value:i,onValueChange:e=>$(e),className:"gap-6",children:[(0,t.jsxs)(x.Field,{children:[(0,t.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,t.jsx)(x.FieldLabel,{children:"Transport"}),L]}),(0,t.jsxs)(w.TabsList,{className:"w-full",children:[(0,t.jsx)(w.TabsTrigger,{value:"http",children:"HTTP"}),(0,t.jsx)(w.TabsTrigger,{value:"stdio",children:"STDIO"})]})]}),(0,t.jsxs)(w.TabsContent,{value:"http",className:"space-y-6",children:[(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{children:"URL"}),(0,t.jsx)(v.Input,{value:l,onChange:e=>o({url:e.target.value}),placeholder:"https://mcp.notion.com/mcp",spellCheck:!1,className:"font-mono text-xs"})]}),(0,t.jsx)(en,{label:"Headers",pairs:d,onChange:e=>o({headers:e}),keyPlaceholder:"Authorization",valuePlaceholder:"Bearer sk-..."}),(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{children:"OAuth client"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(v.Input,{value:m,onChange:e=>o({clientId:e.target.value}),placeholder:"Client ID",spellCheck:!1,className:"font-mono text-xs"}),(0,t.jsx)(v.Input,{value:p,onChange:e=>o({clientSecret:e.target.value}),placeholder:"Client secret",spellCheck:!1,type:"password",className:"font-mono text-xs"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Only for servers that refuse to register clients on their own, like Figma. Leave empty and one is created during sign-in."})]})]}),(0,t.jsxs)(w.TabsContent,{value:"stdio",className:"space-y-6",children:[(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{children:"Command"}),(0,t.jsx)(v.Input,{value:u,onChange:e=>o({command:e.target.value}),placeholder:"npx",spellCheck:!1,className:"font-mono text-xs"})]}),(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{children:"Args"}),(0,t.jsx)(v.Input,{value:f,onChange:e=>o({args:e.target.value}),placeholder:"-y @notionhq/notion-mcp-server",spellCheck:!1,className:"font-mono text-xs"})]}),(0,t.jsx)(en,{label:"Env",pairs:j,onChange:e=>o({env:e}),keyPlaceholder:"NOTION_TOKEN",valuePlaceholder:"ntn_..."})]})]}),T&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:T})]})})}function en({label:e,pairs:n,onChange:s,keyPlaceholder:a,valuePlaceholder:r}){let i=(e,t)=>s(n.map(n=>n.id===e?{...n,...t}:n));return(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{children:e}),(0,t.jsxs)("div",{className:"space-y-2",children:[n.map(e=>(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(v.Input,{value:e.key,onChange:t=>i(e.id,{key:t.target.value}),placeholder:a,spellCheck:!1,className:"font-mono text-xs"}),(0,t.jsx)(v.Input,{value:e.value,onChange:t=>i(e.id,{value:t.target.value}),placeholder:r,spellCheck:!1,className:"font-mono text-xs"}),(0,t.jsx)(g.Button,{variant:"ghost",size:"icon",onClick:()=>s(n.filter(t=>t.id!==e.id)),children:(0,t.jsx)(u.X,{})})]},e.id)),(0,t.jsxs)(g.Button,{variant:"outline",size:"sm",onClick:()=>s([...n,es()]),children:[(0,t.jsx)(o.Plus,{}),"Add"]})]})]})}let es=(e="",t="")=>({id:crypto.randomUUID(),key:e,value:t}),ea=e=>Object.entries(e??{}).map(([e,t])=>es(e,t)),er=e=>{let t=e.filter(e=>e.key.trim());if(t.length)return Object.fromEntries(t.map(e=>[e.key.trim(),e.value]))},eo=`/** STDIO Example */
4
4
  {
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,58137,t=>{"use strict";var e=t.i(60231),a=t.i(419524),r=t.i(139941);t.i(947716);var i=t.i(723685),s=(0,a.__name)((t,e)=>{let a=t.append("rect");if(a.attr("x",e.x),a.attr("y",e.y),a.attr("fill",e.fill),a.attr("stroke",e.stroke),a.attr("width",e.width),a.attr("height",e.height),e.name&&a.attr("name",e.name),e.rx&&a.attr("rx",e.rx),e.ry&&a.attr("ry",e.ry),void 0!==e.attrs)for(let t in e.attrs)a.attr(t,e.attrs[t]);return e.class&&a.attr("class",e.class),a},"drawRect"),l=(0,a.__name)((t,e)=>{s(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"}).lower()},"drawBackgroundRect"),n=(0,a.__name)((t,a)=>{let r=a.text.replace(e.lineBreakRegex," "),i=t.append("text");i.attr("x",a.x),i.attr("y",a.y),i.attr("class","legend"),i.style("text-anchor",a.anchor),a.class&&i.attr("class",a.class);let s=i.append("tspan");return s.attr("x",a.x+2*a.textMargin),s.text(r),i},"drawText"),d=(0,a.__name)((t,e,a,i)=>{let s=t.append("image");s.attr("x",e),s.attr("y",a);let l=(0,r.sanitizeUrl)(i);s.attr("xlink:href",l)},"drawImage"),o=(0,a.__name)((t,e,a,i)=>{let s=t.append("use");s.attr("x",e),s.attr("y",a);let l=(0,r.sanitizeUrl)(i);s.attr("xlink:href",`#${l}`)},"drawEmbeddedImage"),c=(0,a.__name)(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),x=(0,a.__name)(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),g=(0,a.__name)(()=>{let t=(0,i.select)(".mermaidTooltip");return t.empty()&&(t=(0,i.select)("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),t},"createTooltip");t.s(["createTooltip",0,g,"drawBackgroundRect",0,l,"drawEmbeddedImage",0,o,"drawImage",0,d,"drawRect",0,s,"drawText",0,n,"getNoteRect",0,c,"getTextObj",0,x])},117204,t=>{"use strict";var e=t.i(60231),a=t.i(508324),r=t.i(419524),i=(0,r.__name)((t,r,i,n)=>{t.attr("class",i);let{width:d,height:o,x:c,y:x}=s(t,r);(0,e.configureSvgSize)(t,o,d,n);let g=l(c,x,d,o,r);t.attr("viewBox",g),a.log.debug(`viewBox configured: ${g} with padding: ${r}`)},"setupViewPortForSVG"),s=(0,r.__name)((t,e)=>{let a=t.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:a.width+2*e,height:a.height+2*e,x:a.x,y:a.y}},"calculateDimensionsWithPadding"),l=(0,r.__name)((t,e,a,r,i)=>`${t-i} ${e-i} ${a} ${r}`,"createViewBox");t.s(["setupViewPortForSVG",0,i])},248585,t=>{"use strict";var e=t.i(419524);t.i(947716);var a=t.i(723685),r=(0,e.__name)((t,e)=>{let r;return"sandbox"===e&&(r=(0,a.select)("#i"+t)),("sandbox"===e?(0,a.select)(r.nodes()[0].contentDocument.body):(0,a.select)("body")).select(`[id="${t}"]`)},"getDiagramElement");t.s(["getDiagramElement",0,r])},196572,t=>{"use strict";var e=t.i(904873);t.i(248585),t.i(117204),t.i(121292),t.i(58137),t.i(369110),t.i(382793),t.i(502056),t.i(217248),t.i(224797),t.i(836333),t.i(29836),t.i(447804),t.i(60231),t.i(508324);var a=t.i(419524),r={parser:e.stateDiagram_default,get db(){return new e.StateDB(2)},renderer:e.stateRenderer_v3_unified_default,styles:e.styles_default,init:(0,a.__name)(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};t.s(["diagram",0,r])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,58137,t=>{"use strict";var e=t.i(60231),a=t.i(419524),r=t.i(779879);t.i(947716);var i=t.i(723685),s=(0,a.__name)((t,e)=>{let a=t.append("rect");if(a.attr("x",e.x),a.attr("y",e.y),a.attr("fill",e.fill),a.attr("stroke",e.stroke),a.attr("width",e.width),a.attr("height",e.height),e.name&&a.attr("name",e.name),e.rx&&a.attr("rx",e.rx),e.ry&&a.attr("ry",e.ry),void 0!==e.attrs)for(let t in e.attrs)a.attr(t,e.attrs[t]);return e.class&&a.attr("class",e.class),a},"drawRect"),l=(0,a.__name)((t,e)=>{s(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"}).lower()},"drawBackgroundRect"),n=(0,a.__name)((t,a)=>{let r=a.text.replace(e.lineBreakRegex," "),i=t.append("text");i.attr("x",a.x),i.attr("y",a.y),i.attr("class","legend"),i.style("text-anchor",a.anchor),a.class&&i.attr("class",a.class);let s=i.append("tspan");return s.attr("x",a.x+2*a.textMargin),s.text(r),i},"drawText"),d=(0,a.__name)((t,e,a,i)=>{let s=t.append("image");s.attr("x",e),s.attr("y",a);let l=(0,r.sanitizeUrl)(i);s.attr("xlink:href",l)},"drawImage"),o=(0,a.__name)((t,e,a,i)=>{let s=t.append("use");s.attr("x",e),s.attr("y",a);let l=(0,r.sanitizeUrl)(i);s.attr("xlink:href",`#${l}`)},"drawEmbeddedImage"),c=(0,a.__name)(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),x=(0,a.__name)(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),g=(0,a.__name)(()=>{let t=(0,i.select)(".mermaidTooltip");return t.empty()&&(t=(0,i.select)("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),t},"createTooltip");t.s(["createTooltip",0,g,"drawBackgroundRect",0,l,"drawEmbeddedImage",0,o,"drawImage",0,d,"drawRect",0,s,"drawText",0,n,"getNoteRect",0,c,"getTextObj",0,x])},117204,t=>{"use strict";var e=t.i(60231),a=t.i(508324),r=t.i(419524),i=(0,r.__name)((t,r,i,n)=>{t.attr("class",i);let{width:d,height:o,x:c,y:x}=s(t,r);(0,e.configureSvgSize)(t,o,d,n);let g=l(c,x,d,o,r);t.attr("viewBox",g),a.log.debug(`viewBox configured: ${g} with padding: ${r}`)},"setupViewPortForSVG"),s=(0,r.__name)((t,e)=>{let a=t.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:a.width+2*e,height:a.height+2*e,x:a.x,y:a.y}},"calculateDimensionsWithPadding"),l=(0,r.__name)((t,e,a,r,i)=>`${t-i} ${e-i} ${a} ${r}`,"createViewBox");t.s(["setupViewPortForSVG",0,i])},248585,t=>{"use strict";var e=t.i(419524);t.i(947716);var a=t.i(723685),r=(0,e.__name)((t,e)=>{let r;return"sandbox"===e&&(r=(0,a.select)("#i"+t)),("sandbox"===e?(0,a.select)(r.nodes()[0].contentDocument.body):(0,a.select)("body")).select(`[id="${t}"]`)},"getDiagramElement");t.s(["getDiagramElement",0,r])},196572,t=>{"use strict";var e=t.i(904873);t.i(248585),t.i(117204),t.i(121292),t.i(58137),t.i(369110),t.i(382793),t.i(502056),t.i(217248),t.i(224797),t.i(836333),t.i(29836),t.i(447804),t.i(60231),t.i(508324);var a=t.i(419524),r={parser:e.stateDiagram_default,get db(){return new e.StateDB(2)},renderer:e.stateRenderer_v3_unified_default,styles:e.styles_default,init:(0,a.__name)(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};t.s(["diagram",0,r])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,348033,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.BLANK_URL=s.relativeFirstCharacters=s.whitespaceEscapeCharsRegex=s.urlSchemeRegex=s.ctrlCharactersRegex=s.htmlCtrlEntityRegex=s.htmlEntitiesRegex=s.invalidProtocolRegex=void 0,s.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,s.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,s.htmlCtrlEntityRegex=/&(newline|tab);/gi,s.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,s.urlSchemeRegex=/^.+(:|&colon;)/gim,s.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,s.relativeFirstCharacters=[".","/"],s.BLANK_URL="about:blank"},139941,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.sanitizeUrl=function(e){if(!e)return r.BLANK_URL;var t,s=a(e.trim());do t=(s=a(s=s.replace(r.ctrlCharactersRegex,"").replace(r.htmlEntitiesRegex,function(e,t){return String.fromCharCode(t)}).replace(r.htmlCtrlEntityRegex,"").replace(r.ctrlCharactersRegex,"").replace(r.whitespaceEscapeCharsRegex,"").trim())).match(r.ctrlCharactersRegex)||s.match(r.htmlEntitiesRegex)||s.match(r.htmlCtrlEntityRegex)||s.match(r.whitespaceEscapeCharsRegex);while(t&&t.length>0)var i=s;if(!i)return r.BLANK_URL;if(r.relativeFirstCharacters.indexOf(i[0])>-1)return i;var l=i.trimStart(),n=l.match(r.urlSchemeRegex);if(!n)return i;var h=n[0].toLowerCase().trim();if(r.invalidProtocolRegex.test(h))return r.BLANK_URL;var o=l.replace(/\\/g,"/");if("mailto:"===h||h.includes("://"))return o;if("http:"===h||"https:"===h){if(!URL.canParse(o))return r.BLANK_URL;var u=new URL(o);return u.protocol=u.protocol.toLowerCase(),u.hostname=u.hostname.toLowerCase(),u.toString()}return o};var r=e.r(348033);function a(e){try{return decodeURIComponent(e)}catch(t){return e}}},810199,e=>{"use strict";let t=Math.abs,s=Math.atan2,r=Math.cos,a=Math.max,i=Math.min,l=Math.sin,n=Math.sqrt,h=Math.PI,o=h/2;e.s(["abs",0,t,"acos",0,function(e){return e>1?0:e<-1?h:Math.acos(e)},"asin",0,function(e){return e>=1?o:e<=-1?-o:Math.asin(e)},"atan2",0,s,"cos",0,r,"epsilon",0,1e-12,"halfPi",0,o,"max",0,a,"min",0,i,"pi",0,h,"sin",0,l,"sqrt",0,n,"tau",0,2*h])},224797,e=>{"use strict";var t=e.i(60231),s=e.i(419524),r=(0,s.__name)(e=>{let{handDrawnSeed:s}=(0,t.getConfig2)();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:s}},"solidStateFill"),a=(0,s.__name)(e=>Array.isArray(e)?e:e?e.split(";").map(e=>e.trim()).filter(Boolean):[],"normalizeStyleList"),i=(0,s.__name)(e=>{let t=l([...e.cssCompiledStyles||[],...e.cssStyles||[],...a(e.labelStyle)]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),l=(0,s.__name)(e=>{let t=new Map;return e.forEach(e=>{let[s,r]=e.split(":");t.set(s.trim(),r?.trim())}),t},"styles2Map"),n=(0,s.__name)(e=>"color"===e||"font-size"===e||"font-family"===e||"font-weight"===e||"font-style"===e||"text-decoration"===e||"text-align"===e||"text-transform"===e||"line-height"===e||"letter-spacing"===e||"word-spacing"===e||"text-shadow"===e||"text-overflow"===e||"white-space"===e||"word-wrap"===e||"word-break"===e||"overflow-wrap"===e||"hyphens"===e,"isLabelStyle"),h=(0,s.__name)(e=>{let{stylesArray:t}=i(e),s=[],r=[],a=[],l=[];return t.forEach(e=>{let t=e[0];n(t)?s.push(e.join(":")+" !important"):(r.push(e.join(":")+" !important"),t.includes("stroke")&&a.push(e.join(":")+" !important"),"fill"===t&&l.push(e.join(":")+" !important"))}),{labelStyles:s.join(";"),nodeStyles:r.join(";"),stylesArray:t,borderStyles:a,backgroundStyles:l}},"styles2String"),o=(0,s.__name)((e,s)=>{let{themeVariables:r,handDrawnSeed:a}=(0,t.getConfig2)(),{nodeBorder:l,mainBkg:n}=r,{stylesMap:h}=i(e);return Object.assign({roughness:.7,fill:h.get("fill")||n,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:h.get("stroke")||l,seed:a,strokeWidth:h.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0],strokeLineDash:u(h.get("stroke-dasharray"))},s)},"userNodeOverrides"),u=(0,s.__name)(e=>{if(!e)return[0,0];let t=e.trim().split(/\s+/).map(Number);if(1===t.length){let e=isNaN(t[0])?0:t[0];return[e,e]}return[isNaN(t[0])?0:t[0],isNaN(t[1])?0:t[1]]},"getStrokeDashArray");e.s(["compileStyles",0,i,"isLabelStyle",0,n,"solidStateFill",0,r,"styles2String",0,h,"userNodeOverrides",0,o])},29836,e=>{"use strict";var t=e.i(60231),s=e.i(508324),r=e.i(419524);let a=Object.freeze({left:0,top:0,width:16,height:16}),i=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),l=Object.freeze({...a,...i}),n=Object.freeze({...l,body:"",hidden:!1});function h(e,t){let s,r,a=(s={},!e.hFlip!=!t.hFlip&&(s.hFlip=!0),!e.vFlip!=!t.vFlip&&(s.vFlip=!0),(r=((e.rotate||0)+(t.rotate||0))%4)&&(s.rotate=r),s);for(let s in n)s in i?s in e&&!(s in a)&&(a[s]=i[s]):s in t?a[s]=t[s]:s in e&&(a[s]=e[s]);return a}function o(e,t,s){let r=e.icons,a=e.aliases||Object.create(null),i={};function l(e){i=h(r[e]||a[e],i)}return l(t),s.forEach(l),h(e,i)}let u=Object.freeze({...Object.freeze({width:null,height:null}),...i}),c=/(-?[0-9.]*[0-9]+[0-9.]*)/g,p=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function f(e,t,s){if(1===t)return e;if(s=s||100,"number"==typeof e)return Math.ceil(e*t*s)/s;if("string"!=typeof e)return e;let r=e.split(c);if(null===r||!r.length)return e;let a=[],i=r.shift(),l=p.test(i);for(;;){if(l){let e=parseFloat(i);isNaN(e)?a.push(i):a.push(Math.ceil(e*t*s)/s)}else a.push(i);if(void 0===(i=r.shift()))return a.join("");l=!l}}let g=/\sid="(\S+)"/g,d=new Map,m=(e,t)=>!!e&&!!((t&&""===e.prefix||e.prefix)&&e.name);var M={body:'<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',height:80,width:80},k=new Map,b=new Map,y=(0,r.__name)(e=>{for(let t of e){if(!t.name)throw Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(s.log.debug("Registering icon pack:",t.name),"loader"in t)b.set(t.name,t.loader);else if("icons"in t)k.set(t.name,t.icons);else throw s.log.error("Invalid icon loader:",t),Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),x=(0,r.__name)(async(e,t)=>{let r=((e,t,s,r="")=>{let a=e.split(":");if("@"===e.slice(0,1)){if(a.length<2||a.length>3)return null;r=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){let e=a.pop(),s=a.pop(),i={provider:a.length>0?a[0]:r,prefix:s,name:e};return t&&!m(i)?null:i}let i=a[0],l=i.split("-");if(l.length>1){let e={provider:r,prefix:l.shift(),name:l.join("-")};return t&&!m(e)?null:e}if(s&&""===r){let e={provider:r,prefix:"",name:i};return t&&!m(e,s)?null:e}return null})(e,!0,void 0!==t);if(!r)throw Error(`Invalid icon name: ${e}`);let a=r.prefix||t;if(!a)throw Error(`Icon name must contain a prefix: ${e}`);let i=k.get(a);if(!i){let e=b.get(a);if(!e)throw Error(`Icon set not found: ${r.prefix}`);try{i={...await e(),prefix:a},k.set(a,i)}catch(e){throw s.log.error(e),Error(`Failed to load icon set: ${r.prefix}`)}}let l=function(e,t){var s;let r,a,i;if(e.icons[t])return o(e,t,[]);let l=(s=[t],r=e.icons,a=e.aliases||Object.create(null),i=Object.create(null),(s||Object.keys(r).concat(Object.keys(a))).forEach(function e(t){if(r[t])return i[t]=[];if(!(t in i)){i[t]=null;let s=a[t]&&a[t].parent,r=s&&e(s);r&&(i[t]=[s].concat(r))}return i[t]}),i)[t];return l?o(e,t,l):null}(i,r.name);if(!l)throw Error(`Icon not found: ${e}`);return l},"getRegisteredIconData"),w=(0,r.__name)(async e=>{try{return await x(e),!0}catch{return!1}},"isIconAvailable"),v=(0,r.__name)(async(e,r,a)=>{var i;let n,h,o,c,p,m,k,b,y,w,v,S,P,O;try{n=await x(e,r?.fallbackPrefix)}catch(e){s.log.error(e),n=M}let _=(i=n,c={...l,...i},p={...u,...r},m={left:c.left,top:c.top,width:c.width,height:c.height},k=c.body,[c,p].forEach(e=>{var t,s,r,a;let i,l,n=[],h=e.hFlip,o=e.vFlip,u=e.rotate;switch(h?o?u+=2:(n.push("translate("+(m.width+m.left).toString()+" "+(0-m.top).toString()+")"),n.push("scale(-1 1)"),m.top=m.left=0):o&&(n.push("translate("+(0-m.left).toString()+" "+(m.height+m.top).toString()+")"),n.push("scale(1 -1)"),m.top=m.left=0),u<0&&(u-=4*Math.floor(u/4)),u%=4){case 1:n.unshift("rotate(90 "+(i=m.height/2+m.top).toString()+" "+i.toString()+")");break;case 2:n.unshift("rotate(180 "+(m.width/2+m.left).toString()+" "+(m.height/2+m.top).toString()+")");break;case 3:n.unshift("rotate(-90 "+(i=m.width/2+m.left).toString()+" "+i.toString()+")")}u%2==1&&(m.left!==m.top&&(i=m.left,m.left=m.top,m.top=i),m.width!==m.height&&(i=m.width,m.width=m.height,m.height=i)),n.length&&(t=k,s='<g transform="'+n.join(" ")+'">',r=(l=function(e,t="defs"){let s="",r=e.indexOf("<"+t);for(;r>=0;){let a=e.indexOf(">",r),i=e.indexOf("</"+t);if(-1===a||-1===i)break;let l=e.indexOf(">",i);if(-1===l)break;s+=e.slice(a+1,i).trim(),e=e.slice(0,r).trim()+e.slice(l+1)}return{defs:s,content:e}}(t)).defs,a=s+l.content+"</g>",k=r?"<defs>"+r+"</defs>"+a:a)}),b=p.width,y=p.height,w=m.width,v=m.height,null===b?h=f(o=null===y?"1em":"auto"===y?v:y,w/v):(h="auto"===b?w:b,o=null===y?f(h,v/w):"auto"===y?v:y),S={},(P=(e,t)=>{"unset"!==t&&"undefined"!==t&&"none"!==t&&(S[e]=t.toString())})("width",h),P("height",o),S.viewBox=(O=[m.left,m.top,w,v]).join(" "),{attributes:S,viewBox:O,body:k}),L=function(e,t){let s=-1===e.indexOf("xlink:")?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(let e in t)s+=" "+e+'="'+t[e]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}(function(e){let t,s=[];for(;t=g.exec(e);)s.push(t[1]);if(!s.length)return e;let r="suffix"+(0x1000000*Math.random()|Date.now()).toString(16);return s.forEach(t=>{var s;let a,i=(s=(s=t).replace(/[0-9]+$/,"")||"a",a=d.get(s)||0,d.set(s,a+1),a?`${s}${a}`:s),l=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),e=e.replace(RegExp(r,"g"),"")}(_.body),{..._.attributes,...a});return(0,t.sanitizeText)(L,(0,t.getConfig)())},"getIconSVG");e.s(["getIconSVG",0,v,"isIconAvailable",0,w,"registerIconPacks",0,y,"unknownIcon",0,M],29836)},419524,e=>{"use strict";var t=Object.defineProperty;e.s(["__export",0,(e,s)=>{for(var r in s)t(e,r,{get:s[r],enumerable:!0})},"__name",0,(e,s)=>t(e,"name",{value:s,configurable:!0})])},883272,e=>{"use strict";function t(e,t,s){if(e&&e.length){let[r,a]=t,i=Math.PI/180*s,l=Math.cos(i),n=Math.sin(i);for(let t of e){let[e,s]=t;t[0]=(e-r)*l-(s-a)*n+r,t[1]=(e-r)*n+(s-a)*l+a}}}function s(e,s){var r;let a=s.hachureAngle+90,i=s.hachureGap;i<0&&(i=4*s.strokeWidth),i=Math.round(Math.max(i,.1));let l=1;return s.roughness>=1&&((null==(r=s.randomizer)?void 0:r.next())||Math.random())>.7&&(l=i),function(e,s,r,a=1){let i=Math.max(s,.1),l=e[0]&&e[0][0]&&"number"==typeof e[0][0]?[e]:e,n=[0,0];if(r)for(let e of l)t(e,n,r);let h=function(e,t,s){let r=[];for(let t of e){var a,i;let e=[...t];a=e[0],i=e[e.length-1],a[0]===i[0]&&a[1]===i[1]||e.push([e[0][0],e[0][1]]),e.length>2&&r.push(e)}let l=[];t=Math.max(t,.1);let n=[];for(let e of r)for(let t=0;t<e.length-1;t++){let s=e[t],r=e[t+1];if(s[1]!==r[1]){let e=Math.min(s[1],r[1]);n.push({ymin:e,ymax:Math.max(s[1],r[1]),x:e===s[1]?s[0]:r[0],islope:(r[0]-s[0])/(r[1]-s[1])})}}if(n.sort((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax)),!n.length)return l;let h=[],o=n[0].ymin,u=0;for(;h.length||n.length;){if(n.length){let e=-1;for(let t=0;t<n.length&&!(n[t].ymin>o);t++)e=t;n.splice(0,e+1).forEach(e=>{h.push({s:o,edge:e})})}if((h=h.filter(e=>!(e.edge.ymax<=o))).sort((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x)),(1!==s||u%t==0)&&h.length>1)for(let e=0;e<h.length;e+=2){let t=e+1;if(t>=h.length)break;let s=h[e].edge,r=h[t].edge;l.push([[Math.round(s.x),o],[Math.round(r.x),o]])}o+=s,h.forEach(e=>{e.edge.x=e.edge.x+s*e.edge.islope}),u++}return l}(l,i,a);if(r){let e;for(let e of l)t(e,n,-r);e=[],h.forEach(t=>e.push(...t)),t(e,n,-r)}return h}(e,i,a,l||1)}class r{constructor(e){this.helper=e}fillPolygons(e,t){return this._fillPolygons(e,t)}_fillPolygons(e,t){let r=s(e,t);return{type:"fillSketch",ops:this.renderLines(r,t)}}renderLines(e,t){let s=[];for(let r of e)s.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],t));return s}}function a(e){let t=e[0],s=e[1];return Math.sqrt(Math.pow(t[0]-s[0],2)+Math.pow(t[1]-s[1],2))}class i extends r{fillPolygons(e,t){let r=t.hachureGap;r<0&&(r=4*t.strokeWidth);let i=s(e,Object.assign({},t,{hachureGap:r=Math.max(r,.1)})),l=Math.PI/180*t.hachureAngle,n=[],h=.5*r*Math.cos(l),o=.5*r*Math.sin(l);for(let[e,t]of i)a([e,t])&&n.push([[e[0]-h,e[1]+o],[...t]],[[e[0]+h,e[1]-o],[...t]]);return{type:"fillSketch",ops:this.renderLines(n,t)}}}class l extends r{fillPolygons(e,t){let s=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),a=this._fillPolygons(e,r);return s.ops=s.ops.concat(a.ops),s}}class n{constructor(e){this.helper=e}fillPolygons(e,t){let r=s(e,t=Object.assign({},t,{hachureAngle:0}));return this.dotsOnLines(r,t)}dotsOnLines(e,t){let s=[],r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.max(r,.1);let i=t.fillWeight;i<0&&(i=t.strokeWidth/2);let l=r/4;for(let n of e){let e=a(n),h=Math.ceil(e/r)-1,o=e-h*r,u=(n[0][0]+n[1][0])/2-r/4,c=Math.min(n[0][1],n[1][1]);for(let e=0;e<h;e++){let a=u-l+2*Math.random()*l,n=c+o+e*r-l+2*Math.random()*l,h=this.helper.ellipse(a,n,i,i,t);s.push(...h.ops)}}return{type:"fillSketch",ops:s}}}class h{constructor(e){this.helper=e}fillPolygons(e,t){let r=s(e,t);return{type:"fillSketch",ops:this.dashedLine(r,t)}}dashedLine(e,t){let s=t.dashOffset<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashOffset,r=t.dashGap<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashGap,i=[];return e.forEach(e=>{let l=a(e),n=Math.floor(l/(s+r)),h=(l+r-n*(s+r))/2,o=e[0],u=e[1];o[0]>u[0]&&(o=e[1],u=e[0]);let c=Math.atan((u[1]-o[1])/(u[0]-o[0]));for(let e=0;e<n;e++){let a=e*(s+r),l=a+s,n=[o[0]+a*Math.cos(c)+h*Math.cos(c),o[1]+a*Math.sin(c)+h*Math.sin(c)],u=[o[0]+l*Math.cos(c)+h*Math.cos(c),o[1]+l*Math.sin(c)+h*Math.sin(c)];i.push(...this.helper.doubleLineOps(n[0],n[1],u[0],u[1],t))}}),i}}class o{constructor(e){this.helper=e}fillPolygons(e,t){let r=t.hachureGap<0?4*t.strokeWidth:t.hachureGap,a=t.zigzagOffset<0?r:t.zigzagOffset,i=s(e,t=Object.assign({},t,{hachureGap:r+a}));return{type:"fillSketch",ops:this.zigzagLines(i,a,t)}}zigzagLines(e,t,s){let r=[];return e.forEach(e=>{let i=Math.round(a(e)/(2*t)),l=e[0],n=e[1];l[0]>n[0]&&(l=e[1],n=e[0]);let h=Math.atan((n[1]-l[1])/(n[0]-l[0]));for(let e=0;e<i;e++){let a=2*e*t,i=2*(e+1)*t,n=Math.sqrt(2*Math.pow(t,2)),o=[l[0]+a*Math.cos(h),l[1]+a*Math.sin(h)],u=[l[0]+i*Math.cos(h),l[1]+i*Math.sin(h)],c=[o[0]+n*Math.cos(h+Math.PI/4),o[1]+n*Math.sin(h+Math.PI/4)];r.push(...this.helper.doubleLineOps(o[0],o[1],c[0],c[1],s),...this.helper.doubleLineOps(c[0],c[1],u[0],u[1],s))}}),r}}let u={};class c{constructor(e){this.seed=e}next(){return this.seed?(0x80000000-1&(this.seed=Math.imul(48271,this.seed)))/0x80000000:Math.random()}}let p={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function f(e){let t=[],s=function(e){let t=[];for(;""!==e;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else{if(!e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];t[t.length]={type:1,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length)}return t[t.length]={type:2,text:""},t}(e),r="BOD",a=0,i=s[0];for(;2!==i.type;){let l=0,n=[];if("BOD"===r){if("M"!==i.text&&"m"!==i.text)return f("M0,0"+e);a++,l=p[i.text],r=i.text}else 1===i.type?l=p[r]:(a++,l=p[i.text],r=i.text);if(!(a+l<s.length))throw Error("Path data ended short");for(let e=a;e<a+l;e++){let t=s[e];if(1!==t.type)throw Error("Param not a number: "+r+","+t.text);n[n.length]=+t.text}if("number"!=typeof p[r])throw Error("Bad segment: "+r);{let e={key:r,data:n};t.push(e),a+=l,i=s[a],"M"===r&&(r="L"),"m"===r&&(r="l")}}return t}function g(e){let t=0,s=0,r=0,a=0,i=[];for(let{key:l,data:n}of e)switch(l){case"M":i.push({key:"M",data:[...n]}),[t,s]=n,[r,a]=n;break;case"m":t+=n[0],s+=n[1],i.push({key:"M",data:[t,s]}),r=t,a=s;break;case"L":i.push({key:"L",data:[...n]}),[t,s]=n;break;case"l":t+=n[0],s+=n[1],i.push({key:"L",data:[t,s]});break;case"C":i.push({key:"C",data:[...n]}),t=n[4],s=n[5];break;case"c":{let e=n.map((e,r)=>r%2?e+s:e+t);i.push({key:"C",data:e}),t=e[4],s=e[5];break}case"Q":i.push({key:"Q",data:[...n]}),t=n[2],s=n[3];break;case"q":{let e=n.map((e,r)=>r%2?e+s:e+t);i.push({key:"Q",data:e}),t=e[2],s=e[3];break}case"A":i.push({key:"A",data:[...n]}),t=n[5],s=n[6];break;case"a":t+=n[5],s+=n[6],i.push({key:"A",data:[n[0],n[1],n[2],n[3],n[4],t,s]});break;case"H":i.push({key:"H",data:[...n]}),t=n[0];break;case"h":t+=n[0],i.push({key:"H",data:[t]});break;case"V":i.push({key:"V",data:[...n]}),s=n[0];break;case"v":s+=n[0],i.push({key:"V",data:[s]});break;case"S":i.push({key:"S",data:[...n]}),t=n[2],s=n[3];break;case"s":{let e=n.map((e,r)=>r%2?e+s:e+t);i.push({key:"S",data:e}),t=e[2],s=e[3];break}case"T":i.push({key:"T",data:[...n]}),t=n[0],s=n[1];break;case"t":t+=n[0],s+=n[1],i.push({key:"T",data:[t,s]});break;case"Z":case"z":i.push({key:"Z",data:[]}),t=r,s=a}return i}function d(e){let t=[],s="",r=0,a=0,i=0,l=0,n=0,h=0;for(let{key:o,data:u}of e){switch(o){case"M":t.push({key:"M",data:[...u]}),[r,a]=u,[i,l]=u;break;case"C":t.push({key:"C",data:[...u]}),r=u[4],a=u[5],n=u[2],h=u[3];break;case"L":t.push({key:"L",data:[...u]}),[r,a]=u;break;case"H":r=u[0],t.push({key:"L",data:[r,a]});break;case"V":a=u[0],t.push({key:"L",data:[r,a]});break;case"S":{let e=0,i=0;"C"===s||"S"===s?(e=r+(r-n),i=a+(a-h)):(e=r,i=a),t.push({key:"C",data:[e,i,...u]}),n=u[0],h=u[1],r=u[2],a=u[3];break}case"T":{let[e,i]=u,l=0,o=0;"Q"===s||"T"===s?(l=r+(r-n),o=a+(a-h)):(l=r,o=a);let c=r+2*(l-r)/3,p=a+2*(o-a)/3,f=e+2*(l-e)/3,g=i+2*(o-i)/3;t.push({key:"C",data:[c,p,f,g,e,i]}),n=l,h=o,r=e,a=i;break}case"Q":{let[e,s,i,l]=u,o=r+2*(e-r)/3,c=a+2*(s-a)/3,p=i+2*(e-i)/3,f=l+2*(s-l)/3;t.push({key:"C",data:[o,c,p,f,i,l]}),n=e,h=s,r=i,a=l;break}case"A":{let e=Math.abs(u[0]),s=Math.abs(u[1]),i=u[2],l=u[3],n=u[4],h=u[5],o=u[6];0===e||0===s?(t.push({key:"C",data:[r,a,h,o,h,o]}),r=h,a=o):(r!==h||a!==o)&&((function e(t,s,r,a,i,l,n,h,o,u){let c=Math.PI*n/180,p=[],f=0,g=0,d=0,M=0;if(u)[f,g,d,M]=u;else{[t,s]=m(t,s,-c),[r,a]=m(r,a,-c);let e=(t-r)/2,n=(s-a)/2,u=e*e/(i*i)+n*n/(l*l);u>1&&(i*=u=Math.sqrt(u),l*=u);let p=i*i,k=l*l,b=(h===o?-1:1)*Math.sqrt(Math.abs((p*k-p*n*n-k*e*e)/(p*n*n+k*e*e)));d=b*i*n/l+(t+r)/2,M=-(b*l)*e/i+(s+a)/2,f=Math.asin(parseFloat(((s-M)/l).toFixed(9))),g=Math.asin(parseFloat(((a-M)/l).toFixed(9))),t<d&&(f=Math.PI-f),r<d&&(g=Math.PI-g),f<0&&(f=2*Math.PI+f),g<0&&(g=2*Math.PI+g),o&&f>g&&(f-=2*Math.PI),!o&&g>f&&(g-=2*Math.PI)}let k=g-f;if(Math.abs(k)>120*Math.PI/180){let t=g,s=r,h=a;p=e(r=d+i*Math.cos(g=o&&g>f?f+120*Math.PI/180*1:f+-(120*Math.PI/180*1)),a=M+l*Math.sin(g),s,h,i,l,n,0,o,[g,t,d,M])}k=g-f;let b=Math.cos(f),y=Math.cos(g),x=Math.tan(k/4),w=4/3*i*x,v=4/3*l*x,S=[t,s],P=[t+w*Math.sin(f),s-v*b],O=[r+w*Math.sin(g),a-v*y],_=[r,a];if(P[0]=2*S[0]-P[0],P[1]=2*S[1]-P[1],u)return[P,O,_].concat(p);{p=[P,O,_].concat(p);let e=[];for(let t=0;t<p.length;t+=3){let s=m(p[t][0],p[t][1],c),r=m(p[t+1][0],p[t+1][1],c),a=m(p[t+2][0],p[t+2][1],c);e.push([s[0],s[1],r[0],r[1],a[0],a[1]])}return e}})(r,a,h,o,e,s,i,l,n).forEach(function(e){t.push({key:"C",data:e})}),r=h,a=o);break}case"Z":t.push({key:"Z",data:[]}),r=i,a=l}s=o}return t}function m(e,t,s){return[e*Math.cos(s)-t*Math.sin(s),e*Math.sin(s)+t*Math.cos(s)]}let M={randOffset:function(e,t){return R(e,t)},randOffsetWithRange:function(e,t,s){return C(e,t,s)},ellipse:function(e,t,s,r,a){let i=x(s,r,a);return w(e,t,a,i).opset},doubleLineOps:function(e,t,s,r,a){return E(e,t,s,r,a,!0)}};function k(e,t,s,r,a){return{type:"path",ops:E(e,t,s,r,a)}}function b(e,t,s){let r=(e||[]).length;if(r>2){let a=[];for(let t=0;t<r-1;t++)a.push(...E(e[t][0],e[t][1],e[t+1][0],e[t+1][1],s));return t&&a.push(...E(e[r-1][0],e[r-1][1],e[0][0],e[0][1],s)),{type:"path",ops:a}}return 2===r?k(e[0][0],e[0][1],e[1][0],e[1][1],s):{type:"path",ops:[]}}function y(e,t){if(e.length){let s="number"==typeof e[0][0]?[e]:e,r=I(s[0],+(1+.2*t.roughness),t),a=t.disableMultiStroke?[]:I(s[0],1.5*(1+.22*t.roughness),_(t));for(let e=1;e<s.length;e++){let i=s[e];if(i.length){let e=I(i,+(1+.2*t.roughness),t),s=t.disableMultiStroke?[]:I(i,1.5*(1+.22*t.roughness),_(t));for(let t of e)"move"!==t.op&&r.push(t);for(let e of s)"move"!==e.op&&a.push(e)}}return{type:"path",ops:r.concat(a)}}return{type:"path",ops:[]}}function x(e,t,s){let r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),a=2*Math.PI/Math.ceil(Math.max(s.curveStepCount,s.curveStepCount/Math.sqrt(200)*r)),i=Math.abs(e/2),l=Math.abs(t/2),n=1-s.curveFitting;return i+=R(i*n,s),l+=R(l*n,s),{increment:a,rx:i,ry:l}}function w(e,t,s,r){let[a,i]=D(r.increment,e,t,r.rx,r.ry,1,r.increment*C(.1,C(.4,1,s),s),s),l=T(a,null,s);if(!s.disableMultiStroke&&0!==s.roughness){let[a]=D(r.increment,e,t,r.rx,r.ry,1.5,0,s),i=T(a,null,s);l=l.concat(i)}return{estimatedPoints:i,opset:{type:"path",ops:l}}}function v(e,t,s,r,a,i,l,n,h){let o=Math.abs(s/2),u=Math.abs(r/2);o+=R(.01*o,h),u+=R(.01*u,h);let c=a,p=i;for(;c<0;)c+=2*Math.PI,p+=2*Math.PI;p-c>2*Math.PI&&(c=0,p=2*Math.PI);let f=Math.min(2*Math.PI/h.curveStepCount/2,(p-c)/2),g=j(f,e,t,o,u,c,p,1,h);if(!h.disableMultiStroke){let s=j(f,e,t,o,u,c,p,1.5,h);g.push(...s)}return l&&(n?g.push(...E(e,t,e+o*Math.cos(c),t+u*Math.sin(c),h),...E(e,t,e+o*Math.cos(p),t+u*Math.sin(p),h)):g.push({op:"lineTo",data:[e,t]},{op:"lineTo",data:[e+o*Math.cos(c),t+u*Math.sin(c)]})),{type:"path",ops:g}}function S(e,t){let s=d(g(f(e))),r=[],a=[0,0],i=[0,0];for(let{key:e,data:l}of s)switch(e){case"M":i=[l[0],l[1]],a=[l[0],l[1]];break;case"L":r.push(...E(i[0],i[1],l[0],l[1],t)),i=[l[0],l[1]];break;case"C":{let[e,s,a,n,h,o]=l;r.push(...function(e,t,s,r,a,i,l,n){let h=[],o=[n.maxRandomnessOffset||1,(n.maxRandomnessOffset||1)+.3],u=[0,0],c=n.disableMultiStroke?1:2,p=n.preserveVertices;for(let f=0;f<c;f++)0===f?h.push({op:"move",data:[l[0],l[1]]}):h.push({op:"move",data:[l[0]+(p?0:R(o[0],n)),l[1]+(p?0:R(o[0],n))]}),u=p?[a,i]:[a+R(o[f],n),i+R(o[f],n)],h.push({op:"bcurveTo",data:[e+R(o[f],n),t+R(o[f],n),s+R(o[f],n),r+R(o[f],n),u[0],u[1]]});return h}(e,s,a,n,h,o,i,t)),i=[h,o];break}case"Z":r.push(...E(i[0],i[1],a[0],a[1],t)),i=[a[0],a[1]]}return{type:"path",ops:r}}function P(e,t){let s=[];for(let r of e)if(r.length){let e=t.maxRandomnessOffset||0,a=r.length;if(a>2){s.push({op:"move",data:[r[0][0]+R(e,t),r[0][1]+R(e,t)]});for(let i=1;i<a;i++)s.push({op:"lineTo",data:[r[i][0]+R(e,t),r[i][1]+R(e,t)]})}}return{type:"fillPath",ops:s}}function O(e,t){return(function(e,t){let s=e.fillStyle||"hachure";if(!u[s])switch(s){case"zigzag":u[s]||(u[s]=new i(t));break;case"cross-hatch":u[s]||(u[s]=new l(t));break;case"dots":u[s]||(u[s]=new n(t));break;case"dashed":u[s]||(u[s]=new h(t));break;case"zigzag-line":u[s]||(u[s]=new o(t));break;default:u[s="hachure"]||(u[s]=new r(t))}return u[s]})(t,M).fillPolygons(e,t)}function _(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function L(e){return e.randomizer||(e.randomizer=new c(e.seed||0)),e.randomizer.next()}function C(e,t,s,r=1){return s.roughness*r*(L(s)*(t-e)+e)}function R(e,t,s=1){return C(-e,e,t,s)}function E(e,t,s,r,a,i=!1){let l=i?a.disableMultiStrokeFill:a.disableMultiStroke,n=A(e,t,s,r,a,!0,!1);if(l)return n;let h=A(e,t,s,r,a,!0,!0);return n.concat(h)}function A(e,t,s,r,a,i,l){let n=Math.pow(e-s,2)+Math.pow(t-r,2),h=Math.sqrt(n),o=1;o=h<200?1:h>500?.4:-.0016668*h+1.233334;let u=a.maxRandomnessOffset||0;u*u*100>n&&(u=h/10);let c=u/2,p=.2+.2*L(a),f=a.bowing*a.maxRandomnessOffset*(r-t)/200,g=a.bowing*a.maxRandomnessOffset*(e-s)/200;f=R(f,a,o),g=R(g,a,o);let d=[],m=a.preserveVertices;return i&&(l?d.push({op:"move",data:[e+(m?0:R(c,a,o)),t+(m?0:R(c,a,o))]}):d.push({op:"move",data:[e+(m?0:R(u,a,o)),t+(m?0:R(u,a,o))]})),l?d.push({op:"bcurveTo",data:[f+e+(s-e)*p+R(c,a,o),g+t+(r-t)*p+R(c,a,o),f+e+2*(s-e)*p+R(c,a,o),g+t+2*(r-t)*p+R(c,a,o),s+(m?0:R(c,a,o)),r+(m?0:R(c,a,o))]}):d.push({op:"bcurveTo",data:[f+e+(s-e)*p+R(u,a,o),g+t+(r-t)*p+R(u,a,o),f+e+2*(s-e)*p+R(u,a,o),g+t+2*(r-t)*p+R(u,a,o),s+(m?0:R(u,a,o)),r+(m?0:R(u,a,o))]}),d}function I(e,t,s){if(!e.length)return[];let r=[];r.push([e[0][0]+R(t,s),e[0][1]+R(t,s)]),r.push([e[0][0]+R(t,s),e[0][1]+R(t,s)]);for(let a=1;a<e.length;a++)r.push([e[a][0]+R(t,s),e[a][1]+R(t,s)]),a===e.length-1&&r.push([e[a][0]+R(t,s),e[a][1]+R(t,s)]);return T(r,null,s)}function T(e,t,s){let r=e.length,a=[];if(r>3){let i=[],l=1-s.curveTightness;a.push({op:"move",data:[e[1][0],e[1][1]]});for(let t=1;t+2<r;t++){let s=e[t];i[0]=[s[0],s[1]],i[1]=[s[0]+(l*e[t+1][0]-l*e[t-1][0])/6,s[1]+(l*e[t+1][1]-l*e[t-1][1])/6],i[2]=[e[t+1][0]+(l*e[t][0]-l*e[t+2][0])/6,e[t+1][1]+(l*e[t][1]-l*e[t+2][1])/6],i[3]=[e[t+1][0],e[t+1][1]],a.push({op:"bcurveTo",data:[i[1][0],i[1][1],i[2][0],i[2][1],i[3][0],i[3][1]]})}if(t&&2===t.length){let e=s.maxRandomnessOffset;a.push({op:"lineTo",data:[t[0]+R(e,s),t[1]+R(e,s)]})}}else 3===r?(a.push({op:"move",data:[e[1][0],e[1][1]]}),a.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):2===r&&a.push(...A(e[0][0],e[0][1],e[1][0],e[1][1],s,!0,!0));return a}function D(e,t,s,r,a,i,l,n){let h=[],o=[];if(0===n.roughness){e/=4,o.push([t+r*Math.cos(-e),s+a*Math.sin(-e)]);for(let i=0;i<=2*Math.PI;i+=e){let e=[t+r*Math.cos(i),s+a*Math.sin(i)];h.push(e),o.push(e)}o.push([t+ +r,s+0*a]),o.push([t+r*Math.cos(e),s+a*Math.sin(e)])}else{let u=R(.5,n)-Math.PI/2;o.push([R(i,n)+t+.9*r*Math.cos(u-e),R(i,n)+s+.9*a*Math.sin(u-e)]);let c=2*Math.PI+u-.01;for(let l=u;l<c;l+=e){let e=[R(i,n)+t+r*Math.cos(l),R(i,n)+s+a*Math.sin(l)];h.push(e),o.push(e)}o.push([R(i,n)+t+r*Math.cos(u+2*Math.PI+.5*l),R(i,n)+s+a*Math.sin(u+2*Math.PI+.5*l)]),o.push([R(i,n)+t+.98*r*Math.cos(u+l),R(i,n)+s+.98*a*Math.sin(u+l)]),o.push([R(i,n)+t+.9*r*Math.cos(u+.5*l),R(i,n)+s+.9*a*Math.sin(u+.5*l)])}return[o,h]}function j(e,t,s,r,a,i,l,n,h){let o=i+R(.1,h),u=[];u.push([R(n,h)+t+.9*r*Math.cos(o-e),R(n,h)+s+.9*a*Math.sin(o-e)]);for(let i=o;i<=l;i+=e)u.push([R(n,h)+t+r*Math.cos(i),R(n,h)+s+a*Math.sin(i)]);return u.push([t+r*Math.cos(l),s+a*Math.sin(l)]),u.push([t+r*Math.cos(l),s+a*Math.sin(l)]),T(u,null,h)}function z(e,t=0){let s=e.length;if(s<3)throw Error("A curve must have at least three points.");let r=[];if(3===s)r.push([...e[0]],[...e[1]],[...e[2]],[...e[2]]);else{let s=[];s.push(e[0],e[0]);for(let t=1;t<e.length;t++)s.push(e[t]),t===e.length-1&&s.push(e[t]);let a=[],i=1-t;r.push([...s[0]]);for(let e=1;e+2<s.length;e++){let t=s[e];a[0]=[t[0],t[1]],a[1]=[t[0]+(i*s[e+1][0]-i*s[e-1][0])/6,t[1]+(i*s[e+1][1]-i*s[e-1][1])/6],a[2]=[s[e+1][0]+(i*s[e][0]-i*s[e+2][0])/6,s[e+1][1]+(i*s[e][1]-i*s[e+2][1])/6],a[3]=[s[e+1][0],s[e+1][1]],r.push(a[1],a[2],a[3])}}return r}function F(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function $(e,t,s){return[e[0]+(t[0]-e[0])*s,e[1]+(t[1]-e[1])*s]}function W(e,t,s,r,a){let i=a||[],l=e[t],n=e[s-1],h=0,o=1;for(let r=t+1;r<s-1;++r){let t=function(e,t,s){let r=F(t,s);if(0===r)return F(e,t);let a=((e[0]-t[0])*(s[0]-t[0])+(e[1]-t[1])*(s[1]-t[1]))/r;return F(e,$(t,s,a=Math.max(0,Math.min(1,a))))}(e[r],l,n);t>h&&(h=t,o=r)}return Math.sqrt(h)>r?(W(e,t,o+1,r,i),W(e,o,s,r,i)):(i.length||i.push(l),i.push(n)),i}function G(e,t=.15,s){let r=[],a=(e.length-1)/3;for(let s=0;s<a;s++)!function e(t,s,r,a){let i,l,n,h,o,u,c,p,f=a||[];if(i=t[s+0],l=t[s+1],n=t[s+2],h=t[s+3],o=3*l[0]-2*i[0]-h[0],o*=o,u=3*l[1]-2*i[1]-h[1],u*=u,c=3*n[0]-2*h[0]-i[0],c*=c,p=3*n[1]-2*h[1]-i[1],p*=p,o<c&&(o=c),u<p&&(u=p),o+u<r){let e=t[s+0];f.length?Math.sqrt(F(f[f.length-1],e))>1&&f.push(e):f.push(e),f.push(t[s+3])}else{let a=t[s+0],i=t[s+1],l=t[s+2],n=t[s+3],h=$(a,i,.5),o=$(i,l,.5),u=$(l,n,.5),c=$(h,o,.5),p=$(o,u,.5),g=$(c,p,.5);e([a,h,c,g],0,r,f),e([g,p,u,n],0,r,f)}return f}(e,3*s,t,r);return s&&s>0?W(r,0,r.length,s):r}let N="none";class q{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(0x80000000*Math.random())}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,t,s){return{shape:e,sets:t||[],options:s||this.defaultOptions}}line(e,t,s,r,a){let i=this._o(a);return this._d("line",[k(e,t,s,r,i)],i)}rectangle(e,t,s,r,a){var i,l,n,h;let o=this._o(a),u=[],c=b([[i=e,l=t],[i+(n=s),l],[i+n,l+(h=r)],[i,l+h]],!0,o);if(o.fill){let a=[[e,t],[e+s,t],[e+s,t+r],[e,t+r]];"solid"===o.fillStyle?u.push(P([a],o)):u.push(O([a],o))}return o.stroke!==N&&u.push(c),this._d("rectangle",u,o)}ellipse(e,t,s,r,a){let i=this._o(a),l=[],n=x(s,r,i),h=w(e,t,i,n);if(i.fill)if("solid"===i.fillStyle){let s=w(e,t,i,n).opset;s.type="fillPath",l.push(s)}else l.push(O([h.estimatedPoints],i));return i.stroke!==N&&l.push(h.opset),this._d("ellipse",l,i)}circle(e,t,s,r){let a=this.ellipse(e,t,s,s,r);return a.shape="circle",a}linearPath(e,t){let s=this._o(t);return this._d("linearPath",[b(e,!1,s)],s)}arc(e,t,s,r,a,i,l=!1,n){let h=this._o(n),o=[],u=v(e,t,s,r,a,i,l,!0,h);if(l&&h.fill)if("solid"===h.fillStyle){let l=Object.assign({},h);l.disableMultiStroke=!0;let n=v(e,t,s,r,a,i,!0,!1,l);n.type="fillPath",o.push(n)}else o.push(function(e,t,s,r,a,i,l){let n=Math.abs(s/2),h=Math.abs(r/2);n+=R(.01*n,l),h+=R(.01*h,l);let o=a,u=i;for(;o<0;)o+=2*Math.PI,u+=2*Math.PI;u-o>2*Math.PI&&(o=0,u=2*Math.PI);let c=(u-o)/l.curveStepCount,p=[];for(let s=o;s<=u;s+=c)p.push([e+n*Math.cos(s),t+h*Math.sin(s)]);return p.push([e+n*Math.cos(u),t+h*Math.sin(u)]),p.push([e,t]),O([p],l)}(e,t,s,r,a,i,h));return h.stroke!==N&&o.push(u),this._d("arc",o,h)}curve(e,t){let s=this._o(t),r=[],a=y(e,s);if(s.fill&&s.fill!==N)if("solid"===s.fillStyle){let t=y(e,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(t.ops)})}else{let t=[];if(e.length)for(let r of"number"==typeof e[0][0]?[e]:e)r.length<3?t.push(...r):3===r.length?t.push(...G(z([r[0],r[0],r[1],r[2]]),10,(1+s.roughness)/2)):t.push(...G(z(r),10,(1+s.roughness)/2));t.length&&r.push(O([t],s))}return s.stroke!==N&&r.push(a),this._d("curve",r,s)}polygon(e,t){let s=this._o(t),r=[],a=b(e,!0,s);return s.fill&&("solid"===s.fillStyle?r.push(P([e],s)):r.push(O([e],s))),s.stroke!==N&&r.push(a),this._d("polygon",r,s)}path(e,t){let s=this._o(t),r=[];if(!e)return this._d("path",r,s);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let a=s.fill&&"transparent"!==s.fill&&s.fill!==N,i=s.stroke!==N,l=!!(s.simplification&&s.simplification<1),n=function(e,t){let s=d(g(f(e))),r=[],a=[],i=[0,0],l=[],n=()=>{l.length>=4&&a.push(...G(l,1)),l=[]},h=()=>{n(),a.length&&(r.push(a),a=[])};for(let{key:e,data:t}of s)switch(e){case"M":h(),i=[t[0],t[1]],a.push(i);break;case"L":n(),a.push([t[0],t[1]]);break;case"C":if(!l.length){let e=a.length?a[a.length-1]:i;l.push([e[0],e[1]])}l.push([t[0],t[1]]),l.push([t[2],t[3]]),l.push([t[4],t[5]]);break;case"Z":n(),a.push([i[0],i[1]])}if(h(),!t)return r;let o=[];for(let e of r){let s=W(e,0,e.length,t);s.length&&o.push(s)}return o}(e,l?4-4*(s.simplification||1):(1+s.roughness)/2),h=S(e,s);if(a)if("solid"===s.fillStyle)if(1===n.length){let t=S(e,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(t.ops)})}else r.push(P(n,s));else r.push(O(n,s));return i&&(l?n.forEach(e=>{r.push(b(e,!1,s))}):r.push(h)),this._d("path",r,s)}opsToPath(e,t){let s="";for(let r of e.ops){let e="number"==typeof t&&t>=0?r.data.map(e=>+e.toFixed(t)):r.data;switch(r.op){case"move":s+=`M${e[0]} ${e[1]} `;break;case"bcurveTo":s+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case"lineTo":s+=`L${e[0]} ${e[1]} `}}return s.trim()}toPaths(e){let t=e.sets||[],s=e.options||this.defaultOptions,r=[];for(let e of t){let t=null;switch(e.type){case"path":t={d:this.opsToPath(e),stroke:s.stroke,strokeWidth:s.strokeWidth,fill:N};break;case"fillPath":t={d:this.opsToPath(e),stroke:N,strokeWidth:0,fill:s.fill||N};break;case"fillSketch":t=this.fillSketch(e,s)}t&&r.push(t)}return r}fillSketch(e,t){let s=t.fillWeight;return s<0&&(s=t.strokeWidth/2),{d:this.opsToPath(e),stroke:t.fill||N,strokeWidth:s,fill:N}}_mergedShape(e){return e.filter((e,t)=>0===t||"move"!==e.op)}}class B{constructor(e,t){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new q(t)}draw(e){let t=e.sets||[],s=e.options||this.getDefaultOptions(),r=this.ctx,a=e.options.fixedDecimalPlaceDigits;for(let i of t)switch(i.type){case"path":r.save(),r.strokeStyle="none"===s.stroke?"transparent":s.stroke,r.lineWidth=s.strokeWidth,s.strokeLineDash&&r.setLineDash(s.strokeLineDash),s.strokeLineDashOffset&&(r.lineDashOffset=s.strokeLineDashOffset),this._drawToContext(r,i,a),r.restore();break;case"fillPath":{r.save(),r.fillStyle=s.fill||"";let t="curve"===e.shape||"polygon"===e.shape||"path"===e.shape?"evenodd":"nonzero";this._drawToContext(r,i,a,t),r.restore();break}case"fillSketch":this.fillSketch(r,i,s)}}fillSketch(e,t,s){let r=s.fillWeight;r<0&&(r=s.strokeWidth/2),e.save(),s.fillLineDash&&e.setLineDash(s.fillLineDash),s.fillLineDashOffset&&(e.lineDashOffset=s.fillLineDashOffset),e.strokeStyle=s.fill||"",e.lineWidth=r,this._drawToContext(e,t,s.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,t,s,r="nonzero"){for(let r of(e.beginPath(),t.ops)){let t="number"==typeof s&&s>=0?r.data.map(e=>+e.toFixed(s)):r.data;switch(r.op){case"move":e.moveTo(t[0],t[1]);break;case"bcurveTo":e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]);break;case"lineTo":e.lineTo(t[0],t[1])}}"fillPath"===t.type?e.fill(r):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,t,s,r,a){let i=this.gen.line(e,t,s,r,a);return this.draw(i),i}rectangle(e,t,s,r,a){let i=this.gen.rectangle(e,t,s,r,a);return this.draw(i),i}ellipse(e,t,s,r,a){let i=this.gen.ellipse(e,t,s,r,a);return this.draw(i),i}circle(e,t,s,r){let a=this.gen.circle(e,t,s,r);return this.draw(a),a}linearPath(e,t){let s=this.gen.linearPath(e,t);return this.draw(s),s}polygon(e,t){let s=this.gen.polygon(e,t);return this.draw(s),s}arc(e,t,s,r,a,i,l=!1,n){let h=this.gen.arc(e,t,s,r,a,i,l,n);return this.draw(h),h}curve(e,t){let s=this.gen.curve(e,t);return this.draw(s),s}path(e,t){let s=this.gen.path(e,t);return this.draw(s),s}}let U="http://www.w3.org/2000/svg";class V{constructor(e,t){this.svg=e,this.gen=new q(t)}draw(e){let t=e.sets||[],s=e.options||this.getDefaultOptions(),r=this.svg.ownerDocument||window.document,a=r.createElementNS(U,"g"),i=e.options.fixedDecimalPlaceDigits;for(let l of t){let t=null;switch(l.type){case"path":(t=r.createElementNS(U,"path")).setAttribute("d",this.opsToPath(l,i)),t.setAttribute("stroke",s.stroke),t.setAttribute("stroke-width",s.strokeWidth+""),t.setAttribute("fill","none"),s.strokeLineDash&&t.setAttribute("stroke-dasharray",s.strokeLineDash.join(" ").trim()),s.strokeLineDashOffset&&t.setAttribute("stroke-dashoffset",`${s.strokeLineDashOffset}`);break;case"fillPath":(t=r.createElementNS(U,"path")).setAttribute("d",this.opsToPath(l,i)),t.setAttribute("stroke","none"),t.setAttribute("stroke-width","0"),t.setAttribute("fill",s.fill||""),"curve"!==e.shape&&"polygon"!==e.shape||t.setAttribute("fill-rule","evenodd");break;case"fillSketch":t=this.fillSketch(r,l,s)}t&&a.appendChild(t)}return a}fillSketch(e,t,s){let r=s.fillWeight;r<0&&(r=s.strokeWidth/2);let a=e.createElementNS(U,"path");return a.setAttribute("d",this.opsToPath(t,s.fixedDecimalPlaceDigits)),a.setAttribute("stroke",s.fill||""),a.setAttribute("stroke-width",r+""),a.setAttribute("fill","none"),s.fillLineDash&&a.setAttribute("stroke-dasharray",s.fillLineDash.join(" ").trim()),s.fillLineDashOffset&&a.setAttribute("stroke-dashoffset",`${s.fillLineDashOffset}`),a}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,t){return this.gen.opsToPath(e,t)}line(e,t,s,r,a){let i=this.gen.line(e,t,s,r,a);return this.draw(i)}rectangle(e,t,s,r,a){let i=this.gen.rectangle(e,t,s,r,a);return this.draw(i)}ellipse(e,t,s,r,a){let i=this.gen.ellipse(e,t,s,r,a);return this.draw(i)}circle(e,t,s,r){let a=this.gen.circle(e,t,s,r);return this.draw(a)}linearPath(e,t){let s=this.gen.linearPath(e,t);return this.draw(s)}polygon(e,t){let s=this.gen.polygon(e,t);return this.draw(s)}arc(e,t,s,r,a,i,l=!1,n){let h=this.gen.arc(e,t,s,r,a,i,l,n);return this.draw(h)}curve(e,t){let s=this.gen.curve(e,t);return this.draw(s)}path(e,t){let s=this.gen.path(e,t);return this.draw(s)}}e.s(["default",0,{canvas:(e,t)=>new B(e,t),svg:(e,t)=>new V(e,t),generator:e=>new q(e),newSeed:()=>q.newSeed()}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,348033,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.BLANK_URL=s.relativeFirstCharacters=s.whitespaceEscapeCharsRegex=s.urlSchemeRegex=s.ctrlCharactersRegex=s.htmlCtrlEntityRegex=s.htmlEntitiesRegex=s.invalidProtocolRegex=void 0,s.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,s.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,s.htmlCtrlEntityRegex=/&(newline|tab);/gi,s.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,s.urlSchemeRegex=/^.+(:|&colon;)/gim,s.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,s.relativeFirstCharacters=[".","/"],s.BLANK_URL="about:blank"},779879,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.sanitizeUrl=function(e){if(!e)return r.BLANK_URL;var t,s=a(e.trim());do t=(s=a(s=s.replace(r.ctrlCharactersRegex,"").replace(r.htmlEntitiesRegex,function(e,t){return String.fromCharCode(t)}).replace(r.htmlCtrlEntityRegex,"").replace(r.ctrlCharactersRegex,"").replace(r.whitespaceEscapeCharsRegex,"").trim())).match(r.ctrlCharactersRegex)||s.match(r.htmlEntitiesRegex)||s.match(r.htmlCtrlEntityRegex)||s.match(r.whitespaceEscapeCharsRegex);while(t&&t.length>0)var i=s;if(!i)return r.BLANK_URL;if(r.relativeFirstCharacters.indexOf(i[0])>-1)return i;var l=i.trimStart(),n=l.match(r.urlSchemeRegex);if(!n)return i;var h=n[0].toLowerCase().trim();if(r.invalidProtocolRegex.test(h))return r.BLANK_URL;var o=l.replace(/\\/g,"/");if("mailto:"===h||h.includes("://"))return o;if("http:"===h||"https:"===h){if(!URL.canParse(o))return r.BLANK_URL;var u=new URL(o);return u.protocol=u.protocol.toLowerCase(),u.hostname=u.hostname.toLowerCase(),u.toString()}return o};var r=e.r(348033);function a(e){try{return decodeURIComponent(e)}catch(t){return e}}},810199,e=>{"use strict";let t=Math.abs,s=Math.atan2,r=Math.cos,a=Math.max,i=Math.min,l=Math.sin,n=Math.sqrt,h=Math.PI,o=h/2;e.s(["abs",0,t,"acos",0,function(e){return e>1?0:e<-1?h:Math.acos(e)},"asin",0,function(e){return e>=1?o:e<=-1?-o:Math.asin(e)},"atan2",0,s,"cos",0,r,"epsilon",0,1e-12,"halfPi",0,o,"max",0,a,"min",0,i,"pi",0,h,"sin",0,l,"sqrt",0,n,"tau",0,2*h])},224797,e=>{"use strict";var t=e.i(60231),s=e.i(419524),r=(0,s.__name)(e=>{let{handDrawnSeed:s}=(0,t.getConfig2)();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:s}},"solidStateFill"),a=(0,s.__name)(e=>Array.isArray(e)?e:e?e.split(";").map(e=>e.trim()).filter(Boolean):[],"normalizeStyleList"),i=(0,s.__name)(e=>{let t=l([...e.cssCompiledStyles||[],...e.cssStyles||[],...a(e.labelStyle)]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),l=(0,s.__name)(e=>{let t=new Map;return e.forEach(e=>{let[s,r]=e.split(":");t.set(s.trim(),r?.trim())}),t},"styles2Map"),n=(0,s.__name)(e=>"color"===e||"font-size"===e||"font-family"===e||"font-weight"===e||"font-style"===e||"text-decoration"===e||"text-align"===e||"text-transform"===e||"line-height"===e||"letter-spacing"===e||"word-spacing"===e||"text-shadow"===e||"text-overflow"===e||"white-space"===e||"word-wrap"===e||"word-break"===e||"overflow-wrap"===e||"hyphens"===e,"isLabelStyle"),h=(0,s.__name)(e=>{let{stylesArray:t}=i(e),s=[],r=[],a=[],l=[];return t.forEach(e=>{let t=e[0];n(t)?s.push(e.join(":")+" !important"):(r.push(e.join(":")+" !important"),t.includes("stroke")&&a.push(e.join(":")+" !important"),"fill"===t&&l.push(e.join(":")+" !important"))}),{labelStyles:s.join(";"),nodeStyles:r.join(";"),stylesArray:t,borderStyles:a,backgroundStyles:l}},"styles2String"),o=(0,s.__name)((e,s)=>{let{themeVariables:r,handDrawnSeed:a}=(0,t.getConfig2)(),{nodeBorder:l,mainBkg:n}=r,{stylesMap:h}=i(e);return Object.assign({roughness:.7,fill:h.get("fill")||n,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:h.get("stroke")||l,seed:a,strokeWidth:h.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0],strokeLineDash:u(h.get("stroke-dasharray"))},s)},"userNodeOverrides"),u=(0,s.__name)(e=>{if(!e)return[0,0];let t=e.trim().split(/\s+/).map(Number);if(1===t.length){let e=isNaN(t[0])?0:t[0];return[e,e]}return[isNaN(t[0])?0:t[0],isNaN(t[1])?0:t[1]]},"getStrokeDashArray");e.s(["compileStyles",0,i,"isLabelStyle",0,n,"solidStateFill",0,r,"styles2String",0,h,"userNodeOverrides",0,o])},29836,e=>{"use strict";var t=e.i(60231),s=e.i(508324),r=e.i(419524);let a=Object.freeze({left:0,top:0,width:16,height:16}),i=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),l=Object.freeze({...a,...i}),n=Object.freeze({...l,body:"",hidden:!1});function h(e,t){let s,r,a=(s={},!e.hFlip!=!t.hFlip&&(s.hFlip=!0),!e.vFlip!=!t.vFlip&&(s.vFlip=!0),(r=((e.rotate||0)+(t.rotate||0))%4)&&(s.rotate=r),s);for(let s in n)s in i?s in e&&!(s in a)&&(a[s]=i[s]):s in t?a[s]=t[s]:s in e&&(a[s]=e[s]);return a}function o(e,t,s){let r=e.icons,a=e.aliases||Object.create(null),i={};function l(e){i=h(r[e]||a[e],i)}return l(t),s.forEach(l),h(e,i)}let u=Object.freeze({...Object.freeze({width:null,height:null}),...i}),c=/(-?[0-9.]*[0-9]+[0-9.]*)/g,p=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function f(e,t,s){if(1===t)return e;if(s=s||100,"number"==typeof e)return Math.ceil(e*t*s)/s;if("string"!=typeof e)return e;let r=e.split(c);if(null===r||!r.length)return e;let a=[],i=r.shift(),l=p.test(i);for(;;){if(l){let e=parseFloat(i);isNaN(e)?a.push(i):a.push(Math.ceil(e*t*s)/s)}else a.push(i);if(void 0===(i=r.shift()))return a.join("");l=!l}}let g=/\sid="(\S+)"/g,d=new Map,m=(e,t)=>!!e&&!!((t&&""===e.prefix||e.prefix)&&e.name);var M={body:'<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',height:80,width:80},k=new Map,b=new Map,y=(0,r.__name)(e=>{for(let t of e){if(!t.name)throw Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(s.log.debug("Registering icon pack:",t.name),"loader"in t)b.set(t.name,t.loader);else if("icons"in t)k.set(t.name,t.icons);else throw s.log.error("Invalid icon loader:",t),Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),x=(0,r.__name)(async(e,t)=>{let r=((e,t,s,r="")=>{let a=e.split(":");if("@"===e.slice(0,1)){if(a.length<2||a.length>3)return null;r=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){let e=a.pop(),s=a.pop(),i={provider:a.length>0?a[0]:r,prefix:s,name:e};return t&&!m(i)?null:i}let i=a[0],l=i.split("-");if(l.length>1){let e={provider:r,prefix:l.shift(),name:l.join("-")};return t&&!m(e)?null:e}if(s&&""===r){let e={provider:r,prefix:"",name:i};return t&&!m(e,s)?null:e}return null})(e,!0,void 0!==t);if(!r)throw Error(`Invalid icon name: ${e}`);let a=r.prefix||t;if(!a)throw Error(`Icon name must contain a prefix: ${e}`);let i=k.get(a);if(!i){let e=b.get(a);if(!e)throw Error(`Icon set not found: ${r.prefix}`);try{i={...await e(),prefix:a},k.set(a,i)}catch(e){throw s.log.error(e),Error(`Failed to load icon set: ${r.prefix}`)}}let l=function(e,t){var s;let r,a,i;if(e.icons[t])return o(e,t,[]);let l=(s=[t],r=e.icons,a=e.aliases||Object.create(null),i=Object.create(null),(s||Object.keys(r).concat(Object.keys(a))).forEach(function e(t){if(r[t])return i[t]=[];if(!(t in i)){i[t]=null;let s=a[t]&&a[t].parent,r=s&&e(s);r&&(i[t]=[s].concat(r))}return i[t]}),i)[t];return l?o(e,t,l):null}(i,r.name);if(!l)throw Error(`Icon not found: ${e}`);return l},"getRegisteredIconData"),w=(0,r.__name)(async e=>{try{return await x(e),!0}catch{return!1}},"isIconAvailable"),v=(0,r.__name)(async(e,r,a)=>{var i;let n,h,o,c,p,m,k,b,y,w,v,S,P,O;try{n=await x(e,r?.fallbackPrefix)}catch(e){s.log.error(e),n=M}let _=(i=n,c={...l,...i},p={...u,...r},m={left:c.left,top:c.top,width:c.width,height:c.height},k=c.body,[c,p].forEach(e=>{var t,s,r,a;let i,l,n=[],h=e.hFlip,o=e.vFlip,u=e.rotate;switch(h?o?u+=2:(n.push("translate("+(m.width+m.left).toString()+" "+(0-m.top).toString()+")"),n.push("scale(-1 1)"),m.top=m.left=0):o&&(n.push("translate("+(0-m.left).toString()+" "+(m.height+m.top).toString()+")"),n.push("scale(1 -1)"),m.top=m.left=0),u<0&&(u-=4*Math.floor(u/4)),u%=4){case 1:n.unshift("rotate(90 "+(i=m.height/2+m.top).toString()+" "+i.toString()+")");break;case 2:n.unshift("rotate(180 "+(m.width/2+m.left).toString()+" "+(m.height/2+m.top).toString()+")");break;case 3:n.unshift("rotate(-90 "+(i=m.width/2+m.left).toString()+" "+i.toString()+")")}u%2==1&&(m.left!==m.top&&(i=m.left,m.left=m.top,m.top=i),m.width!==m.height&&(i=m.width,m.width=m.height,m.height=i)),n.length&&(t=k,s='<g transform="'+n.join(" ")+'">',r=(l=function(e,t="defs"){let s="",r=e.indexOf("<"+t);for(;r>=0;){let a=e.indexOf(">",r),i=e.indexOf("</"+t);if(-1===a||-1===i)break;let l=e.indexOf(">",i);if(-1===l)break;s+=e.slice(a+1,i).trim(),e=e.slice(0,r).trim()+e.slice(l+1)}return{defs:s,content:e}}(t)).defs,a=s+l.content+"</g>",k=r?"<defs>"+r+"</defs>"+a:a)}),b=p.width,y=p.height,w=m.width,v=m.height,null===b?h=f(o=null===y?"1em":"auto"===y?v:y,w/v):(h="auto"===b?w:b,o=null===y?f(h,v/w):"auto"===y?v:y),S={},(P=(e,t)=>{"unset"!==t&&"undefined"!==t&&"none"!==t&&(S[e]=t.toString())})("width",h),P("height",o),S.viewBox=(O=[m.left,m.top,w,v]).join(" "),{attributes:S,viewBox:O,body:k}),L=function(e,t){let s=-1===e.indexOf("xlink:")?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(let e in t)s+=" "+e+'="'+t[e]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}(function(e){let t,s=[];for(;t=g.exec(e);)s.push(t[1]);if(!s.length)return e;let r="suffix"+(0x1000000*Math.random()|Date.now()).toString(16);return s.forEach(t=>{var s;let a,i=(s=(s=t).replace(/[0-9]+$/,"")||"a",a=d.get(s)||0,d.set(s,a+1),a?`${s}${a}`:s),l=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+i+r+"$3")}),e=e.replace(RegExp(r,"g"),"")}(_.body),{..._.attributes,...a});return(0,t.sanitizeText)(L,(0,t.getConfig)())},"getIconSVG");e.s(["getIconSVG",0,v,"isIconAvailable",0,w,"registerIconPacks",0,y,"unknownIcon",0,M],29836)},419524,e=>{"use strict";var t=Object.defineProperty;e.s(["__export",0,(e,s)=>{for(var r in s)t(e,r,{get:s[r],enumerable:!0})},"__name",0,(e,s)=>t(e,"name",{value:s,configurable:!0})])},883272,e=>{"use strict";function t(e,t,s){if(e&&e.length){let[r,a]=t,i=Math.PI/180*s,l=Math.cos(i),n=Math.sin(i);for(let t of e){let[e,s]=t;t[0]=(e-r)*l-(s-a)*n+r,t[1]=(e-r)*n+(s-a)*l+a}}}function s(e,s){var r;let a=s.hachureAngle+90,i=s.hachureGap;i<0&&(i=4*s.strokeWidth),i=Math.round(Math.max(i,.1));let l=1;return s.roughness>=1&&((null==(r=s.randomizer)?void 0:r.next())||Math.random())>.7&&(l=i),function(e,s,r,a=1){let i=Math.max(s,.1),l=e[0]&&e[0][0]&&"number"==typeof e[0][0]?[e]:e,n=[0,0];if(r)for(let e of l)t(e,n,r);let h=function(e,t,s){let r=[];for(let t of e){var a,i;let e=[...t];a=e[0],i=e[e.length-1],a[0]===i[0]&&a[1]===i[1]||e.push([e[0][0],e[0][1]]),e.length>2&&r.push(e)}let l=[];t=Math.max(t,.1);let n=[];for(let e of r)for(let t=0;t<e.length-1;t++){let s=e[t],r=e[t+1];if(s[1]!==r[1]){let e=Math.min(s[1],r[1]);n.push({ymin:e,ymax:Math.max(s[1],r[1]),x:e===s[1]?s[0]:r[0],islope:(r[0]-s[0])/(r[1]-s[1])})}}if(n.sort((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax)),!n.length)return l;let h=[],o=n[0].ymin,u=0;for(;h.length||n.length;){if(n.length){let e=-1;for(let t=0;t<n.length&&!(n[t].ymin>o);t++)e=t;n.splice(0,e+1).forEach(e=>{h.push({s:o,edge:e})})}if((h=h.filter(e=>!(e.edge.ymax<=o))).sort((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x)),(1!==s||u%t==0)&&h.length>1)for(let e=0;e<h.length;e+=2){let t=e+1;if(t>=h.length)break;let s=h[e].edge,r=h[t].edge;l.push([[Math.round(s.x),o],[Math.round(r.x),o]])}o+=s,h.forEach(e=>{e.edge.x=e.edge.x+s*e.edge.islope}),u++}return l}(l,i,a);if(r){let e;for(let e of l)t(e,n,-r);e=[],h.forEach(t=>e.push(...t)),t(e,n,-r)}return h}(e,i,a,l||1)}class r{constructor(e){this.helper=e}fillPolygons(e,t){return this._fillPolygons(e,t)}_fillPolygons(e,t){let r=s(e,t);return{type:"fillSketch",ops:this.renderLines(r,t)}}renderLines(e,t){let s=[];for(let r of e)s.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],t));return s}}function a(e){let t=e[0],s=e[1];return Math.sqrt(Math.pow(t[0]-s[0],2)+Math.pow(t[1]-s[1],2))}class i extends r{fillPolygons(e,t){let r=t.hachureGap;r<0&&(r=4*t.strokeWidth);let i=s(e,Object.assign({},t,{hachureGap:r=Math.max(r,.1)})),l=Math.PI/180*t.hachureAngle,n=[],h=.5*r*Math.cos(l),o=.5*r*Math.sin(l);for(let[e,t]of i)a([e,t])&&n.push([[e[0]-h,e[1]+o],[...t]],[[e[0]+h,e[1]-o],[...t]]);return{type:"fillSketch",ops:this.renderLines(n,t)}}}class l extends r{fillPolygons(e,t){let s=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),a=this._fillPolygons(e,r);return s.ops=s.ops.concat(a.ops),s}}class n{constructor(e){this.helper=e}fillPolygons(e,t){let r=s(e,t=Object.assign({},t,{hachureAngle:0}));return this.dotsOnLines(r,t)}dotsOnLines(e,t){let s=[],r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.max(r,.1);let i=t.fillWeight;i<0&&(i=t.strokeWidth/2);let l=r/4;for(let n of e){let e=a(n),h=Math.ceil(e/r)-1,o=e-h*r,u=(n[0][0]+n[1][0])/2-r/4,c=Math.min(n[0][1],n[1][1]);for(let e=0;e<h;e++){let a=u-l+2*Math.random()*l,n=c+o+e*r-l+2*Math.random()*l,h=this.helper.ellipse(a,n,i,i,t);s.push(...h.ops)}}return{type:"fillSketch",ops:s}}}class h{constructor(e){this.helper=e}fillPolygons(e,t){let r=s(e,t);return{type:"fillSketch",ops:this.dashedLine(r,t)}}dashedLine(e,t){let s=t.dashOffset<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashOffset,r=t.dashGap<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashGap,i=[];return e.forEach(e=>{let l=a(e),n=Math.floor(l/(s+r)),h=(l+r-n*(s+r))/2,o=e[0],u=e[1];o[0]>u[0]&&(o=e[1],u=e[0]);let c=Math.atan((u[1]-o[1])/(u[0]-o[0]));for(let e=0;e<n;e++){let a=e*(s+r),l=a+s,n=[o[0]+a*Math.cos(c)+h*Math.cos(c),o[1]+a*Math.sin(c)+h*Math.sin(c)],u=[o[0]+l*Math.cos(c)+h*Math.cos(c),o[1]+l*Math.sin(c)+h*Math.sin(c)];i.push(...this.helper.doubleLineOps(n[0],n[1],u[0],u[1],t))}}),i}}class o{constructor(e){this.helper=e}fillPolygons(e,t){let r=t.hachureGap<0?4*t.strokeWidth:t.hachureGap,a=t.zigzagOffset<0?r:t.zigzagOffset,i=s(e,t=Object.assign({},t,{hachureGap:r+a}));return{type:"fillSketch",ops:this.zigzagLines(i,a,t)}}zigzagLines(e,t,s){let r=[];return e.forEach(e=>{let i=Math.round(a(e)/(2*t)),l=e[0],n=e[1];l[0]>n[0]&&(l=e[1],n=e[0]);let h=Math.atan((n[1]-l[1])/(n[0]-l[0]));for(let e=0;e<i;e++){let a=2*e*t,i=2*(e+1)*t,n=Math.sqrt(2*Math.pow(t,2)),o=[l[0]+a*Math.cos(h),l[1]+a*Math.sin(h)],u=[l[0]+i*Math.cos(h),l[1]+i*Math.sin(h)],c=[o[0]+n*Math.cos(h+Math.PI/4),o[1]+n*Math.sin(h+Math.PI/4)];r.push(...this.helper.doubleLineOps(o[0],o[1],c[0],c[1],s),...this.helper.doubleLineOps(c[0],c[1],u[0],u[1],s))}}),r}}let u={};class c{constructor(e){this.seed=e}next(){return this.seed?(0x80000000-1&(this.seed=Math.imul(48271,this.seed)))/0x80000000:Math.random()}}let p={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function f(e){let t=[],s=function(e){let t=[];for(;""!==e;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else{if(!e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];t[t.length]={type:1,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length)}return t[t.length]={type:2,text:""},t}(e),r="BOD",a=0,i=s[0];for(;2!==i.type;){let l=0,n=[];if("BOD"===r){if("M"!==i.text&&"m"!==i.text)return f("M0,0"+e);a++,l=p[i.text],r=i.text}else 1===i.type?l=p[r]:(a++,l=p[i.text],r=i.text);if(!(a+l<s.length))throw Error("Path data ended short");for(let e=a;e<a+l;e++){let t=s[e];if(1!==t.type)throw Error("Param not a number: "+r+","+t.text);n[n.length]=+t.text}if("number"!=typeof p[r])throw Error("Bad segment: "+r);{let e={key:r,data:n};t.push(e),a+=l,i=s[a],"M"===r&&(r="L"),"m"===r&&(r="l")}}return t}function g(e){let t=0,s=0,r=0,a=0,i=[];for(let{key:l,data:n}of e)switch(l){case"M":i.push({key:"M",data:[...n]}),[t,s]=n,[r,a]=n;break;case"m":t+=n[0],s+=n[1],i.push({key:"M",data:[t,s]}),r=t,a=s;break;case"L":i.push({key:"L",data:[...n]}),[t,s]=n;break;case"l":t+=n[0],s+=n[1],i.push({key:"L",data:[t,s]});break;case"C":i.push({key:"C",data:[...n]}),t=n[4],s=n[5];break;case"c":{let e=n.map((e,r)=>r%2?e+s:e+t);i.push({key:"C",data:e}),t=e[4],s=e[5];break}case"Q":i.push({key:"Q",data:[...n]}),t=n[2],s=n[3];break;case"q":{let e=n.map((e,r)=>r%2?e+s:e+t);i.push({key:"Q",data:e}),t=e[2],s=e[3];break}case"A":i.push({key:"A",data:[...n]}),t=n[5],s=n[6];break;case"a":t+=n[5],s+=n[6],i.push({key:"A",data:[n[0],n[1],n[2],n[3],n[4],t,s]});break;case"H":i.push({key:"H",data:[...n]}),t=n[0];break;case"h":t+=n[0],i.push({key:"H",data:[t]});break;case"V":i.push({key:"V",data:[...n]}),s=n[0];break;case"v":s+=n[0],i.push({key:"V",data:[s]});break;case"S":i.push({key:"S",data:[...n]}),t=n[2],s=n[3];break;case"s":{let e=n.map((e,r)=>r%2?e+s:e+t);i.push({key:"S",data:e}),t=e[2],s=e[3];break}case"T":i.push({key:"T",data:[...n]}),t=n[0],s=n[1];break;case"t":t+=n[0],s+=n[1],i.push({key:"T",data:[t,s]});break;case"Z":case"z":i.push({key:"Z",data:[]}),t=r,s=a}return i}function d(e){let t=[],s="",r=0,a=0,i=0,l=0,n=0,h=0;for(let{key:o,data:u}of e){switch(o){case"M":t.push({key:"M",data:[...u]}),[r,a]=u,[i,l]=u;break;case"C":t.push({key:"C",data:[...u]}),r=u[4],a=u[5],n=u[2],h=u[3];break;case"L":t.push({key:"L",data:[...u]}),[r,a]=u;break;case"H":r=u[0],t.push({key:"L",data:[r,a]});break;case"V":a=u[0],t.push({key:"L",data:[r,a]});break;case"S":{let e=0,i=0;"C"===s||"S"===s?(e=r+(r-n),i=a+(a-h)):(e=r,i=a),t.push({key:"C",data:[e,i,...u]}),n=u[0],h=u[1],r=u[2],a=u[3];break}case"T":{let[e,i]=u,l=0,o=0;"Q"===s||"T"===s?(l=r+(r-n),o=a+(a-h)):(l=r,o=a);let c=r+2*(l-r)/3,p=a+2*(o-a)/3,f=e+2*(l-e)/3,g=i+2*(o-i)/3;t.push({key:"C",data:[c,p,f,g,e,i]}),n=l,h=o,r=e,a=i;break}case"Q":{let[e,s,i,l]=u,o=r+2*(e-r)/3,c=a+2*(s-a)/3,p=i+2*(e-i)/3,f=l+2*(s-l)/3;t.push({key:"C",data:[o,c,p,f,i,l]}),n=e,h=s,r=i,a=l;break}case"A":{let e=Math.abs(u[0]),s=Math.abs(u[1]),i=u[2],l=u[3],n=u[4],h=u[5],o=u[6];0===e||0===s?(t.push({key:"C",data:[r,a,h,o,h,o]}),r=h,a=o):(r!==h||a!==o)&&((function e(t,s,r,a,i,l,n,h,o,u){let c=Math.PI*n/180,p=[],f=0,g=0,d=0,M=0;if(u)[f,g,d,M]=u;else{[t,s]=m(t,s,-c),[r,a]=m(r,a,-c);let e=(t-r)/2,n=(s-a)/2,u=e*e/(i*i)+n*n/(l*l);u>1&&(i*=u=Math.sqrt(u),l*=u);let p=i*i,k=l*l,b=(h===o?-1:1)*Math.sqrt(Math.abs((p*k-p*n*n-k*e*e)/(p*n*n+k*e*e)));d=b*i*n/l+(t+r)/2,M=-(b*l)*e/i+(s+a)/2,f=Math.asin(parseFloat(((s-M)/l).toFixed(9))),g=Math.asin(parseFloat(((a-M)/l).toFixed(9))),t<d&&(f=Math.PI-f),r<d&&(g=Math.PI-g),f<0&&(f=2*Math.PI+f),g<0&&(g=2*Math.PI+g),o&&f>g&&(f-=2*Math.PI),!o&&g>f&&(g-=2*Math.PI)}let k=g-f;if(Math.abs(k)>120*Math.PI/180){let t=g,s=r,h=a;p=e(r=d+i*Math.cos(g=o&&g>f?f+120*Math.PI/180*1:f+-(120*Math.PI/180*1)),a=M+l*Math.sin(g),s,h,i,l,n,0,o,[g,t,d,M])}k=g-f;let b=Math.cos(f),y=Math.cos(g),x=Math.tan(k/4),w=4/3*i*x,v=4/3*l*x,S=[t,s],P=[t+w*Math.sin(f),s-v*b],O=[r+w*Math.sin(g),a-v*y],_=[r,a];if(P[0]=2*S[0]-P[0],P[1]=2*S[1]-P[1],u)return[P,O,_].concat(p);{p=[P,O,_].concat(p);let e=[];for(let t=0;t<p.length;t+=3){let s=m(p[t][0],p[t][1],c),r=m(p[t+1][0],p[t+1][1],c),a=m(p[t+2][0],p[t+2][1],c);e.push([s[0],s[1],r[0],r[1],a[0],a[1]])}return e}})(r,a,h,o,e,s,i,l,n).forEach(function(e){t.push({key:"C",data:e})}),r=h,a=o);break}case"Z":t.push({key:"Z",data:[]}),r=i,a=l}s=o}return t}function m(e,t,s){return[e*Math.cos(s)-t*Math.sin(s),e*Math.sin(s)+t*Math.cos(s)]}let M={randOffset:function(e,t){return R(e,t)},randOffsetWithRange:function(e,t,s){return C(e,t,s)},ellipse:function(e,t,s,r,a){let i=x(s,r,a);return w(e,t,a,i).opset},doubleLineOps:function(e,t,s,r,a){return E(e,t,s,r,a,!0)}};function k(e,t,s,r,a){return{type:"path",ops:E(e,t,s,r,a)}}function b(e,t,s){let r=(e||[]).length;if(r>2){let a=[];for(let t=0;t<r-1;t++)a.push(...E(e[t][0],e[t][1],e[t+1][0],e[t+1][1],s));return t&&a.push(...E(e[r-1][0],e[r-1][1],e[0][0],e[0][1],s)),{type:"path",ops:a}}return 2===r?k(e[0][0],e[0][1],e[1][0],e[1][1],s):{type:"path",ops:[]}}function y(e,t){if(e.length){let s="number"==typeof e[0][0]?[e]:e,r=I(s[0],+(1+.2*t.roughness),t),a=t.disableMultiStroke?[]:I(s[0],1.5*(1+.22*t.roughness),_(t));for(let e=1;e<s.length;e++){let i=s[e];if(i.length){let e=I(i,+(1+.2*t.roughness),t),s=t.disableMultiStroke?[]:I(i,1.5*(1+.22*t.roughness),_(t));for(let t of e)"move"!==t.op&&r.push(t);for(let e of s)"move"!==e.op&&a.push(e)}}return{type:"path",ops:r.concat(a)}}return{type:"path",ops:[]}}function x(e,t,s){let r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),a=2*Math.PI/Math.ceil(Math.max(s.curveStepCount,s.curveStepCount/Math.sqrt(200)*r)),i=Math.abs(e/2),l=Math.abs(t/2),n=1-s.curveFitting;return i+=R(i*n,s),l+=R(l*n,s),{increment:a,rx:i,ry:l}}function w(e,t,s,r){let[a,i]=D(r.increment,e,t,r.rx,r.ry,1,r.increment*C(.1,C(.4,1,s),s),s),l=T(a,null,s);if(!s.disableMultiStroke&&0!==s.roughness){let[a]=D(r.increment,e,t,r.rx,r.ry,1.5,0,s),i=T(a,null,s);l=l.concat(i)}return{estimatedPoints:i,opset:{type:"path",ops:l}}}function v(e,t,s,r,a,i,l,n,h){let o=Math.abs(s/2),u=Math.abs(r/2);o+=R(.01*o,h),u+=R(.01*u,h);let c=a,p=i;for(;c<0;)c+=2*Math.PI,p+=2*Math.PI;p-c>2*Math.PI&&(c=0,p=2*Math.PI);let f=Math.min(2*Math.PI/h.curveStepCount/2,(p-c)/2),g=j(f,e,t,o,u,c,p,1,h);if(!h.disableMultiStroke){let s=j(f,e,t,o,u,c,p,1.5,h);g.push(...s)}return l&&(n?g.push(...E(e,t,e+o*Math.cos(c),t+u*Math.sin(c),h),...E(e,t,e+o*Math.cos(p),t+u*Math.sin(p),h)):g.push({op:"lineTo",data:[e,t]},{op:"lineTo",data:[e+o*Math.cos(c),t+u*Math.sin(c)]})),{type:"path",ops:g}}function S(e,t){let s=d(g(f(e))),r=[],a=[0,0],i=[0,0];for(let{key:e,data:l}of s)switch(e){case"M":i=[l[0],l[1]],a=[l[0],l[1]];break;case"L":r.push(...E(i[0],i[1],l[0],l[1],t)),i=[l[0],l[1]];break;case"C":{let[e,s,a,n,h,o]=l;r.push(...function(e,t,s,r,a,i,l,n){let h=[],o=[n.maxRandomnessOffset||1,(n.maxRandomnessOffset||1)+.3],u=[0,0],c=n.disableMultiStroke?1:2,p=n.preserveVertices;for(let f=0;f<c;f++)0===f?h.push({op:"move",data:[l[0],l[1]]}):h.push({op:"move",data:[l[0]+(p?0:R(o[0],n)),l[1]+(p?0:R(o[0],n))]}),u=p?[a,i]:[a+R(o[f],n),i+R(o[f],n)],h.push({op:"bcurveTo",data:[e+R(o[f],n),t+R(o[f],n),s+R(o[f],n),r+R(o[f],n),u[0],u[1]]});return h}(e,s,a,n,h,o,i,t)),i=[h,o];break}case"Z":r.push(...E(i[0],i[1],a[0],a[1],t)),i=[a[0],a[1]]}return{type:"path",ops:r}}function P(e,t){let s=[];for(let r of e)if(r.length){let e=t.maxRandomnessOffset||0,a=r.length;if(a>2){s.push({op:"move",data:[r[0][0]+R(e,t),r[0][1]+R(e,t)]});for(let i=1;i<a;i++)s.push({op:"lineTo",data:[r[i][0]+R(e,t),r[i][1]+R(e,t)]})}}return{type:"fillPath",ops:s}}function O(e,t){return(function(e,t){let s=e.fillStyle||"hachure";if(!u[s])switch(s){case"zigzag":u[s]||(u[s]=new i(t));break;case"cross-hatch":u[s]||(u[s]=new l(t));break;case"dots":u[s]||(u[s]=new n(t));break;case"dashed":u[s]||(u[s]=new h(t));break;case"zigzag-line":u[s]||(u[s]=new o(t));break;default:u[s="hachure"]||(u[s]=new r(t))}return u[s]})(t,M).fillPolygons(e,t)}function _(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function L(e){return e.randomizer||(e.randomizer=new c(e.seed||0)),e.randomizer.next()}function C(e,t,s,r=1){return s.roughness*r*(L(s)*(t-e)+e)}function R(e,t,s=1){return C(-e,e,t,s)}function E(e,t,s,r,a,i=!1){let l=i?a.disableMultiStrokeFill:a.disableMultiStroke,n=A(e,t,s,r,a,!0,!1);if(l)return n;let h=A(e,t,s,r,a,!0,!0);return n.concat(h)}function A(e,t,s,r,a,i,l){let n=Math.pow(e-s,2)+Math.pow(t-r,2),h=Math.sqrt(n),o=1;o=h<200?1:h>500?.4:-.0016668*h+1.233334;let u=a.maxRandomnessOffset||0;u*u*100>n&&(u=h/10);let c=u/2,p=.2+.2*L(a),f=a.bowing*a.maxRandomnessOffset*(r-t)/200,g=a.bowing*a.maxRandomnessOffset*(e-s)/200;f=R(f,a,o),g=R(g,a,o);let d=[],m=a.preserveVertices;return i&&(l?d.push({op:"move",data:[e+(m?0:R(c,a,o)),t+(m?0:R(c,a,o))]}):d.push({op:"move",data:[e+(m?0:R(u,a,o)),t+(m?0:R(u,a,o))]})),l?d.push({op:"bcurveTo",data:[f+e+(s-e)*p+R(c,a,o),g+t+(r-t)*p+R(c,a,o),f+e+2*(s-e)*p+R(c,a,o),g+t+2*(r-t)*p+R(c,a,o),s+(m?0:R(c,a,o)),r+(m?0:R(c,a,o))]}):d.push({op:"bcurveTo",data:[f+e+(s-e)*p+R(u,a,o),g+t+(r-t)*p+R(u,a,o),f+e+2*(s-e)*p+R(u,a,o),g+t+2*(r-t)*p+R(u,a,o),s+(m?0:R(u,a,o)),r+(m?0:R(u,a,o))]}),d}function I(e,t,s){if(!e.length)return[];let r=[];r.push([e[0][0]+R(t,s),e[0][1]+R(t,s)]),r.push([e[0][0]+R(t,s),e[0][1]+R(t,s)]);for(let a=1;a<e.length;a++)r.push([e[a][0]+R(t,s),e[a][1]+R(t,s)]),a===e.length-1&&r.push([e[a][0]+R(t,s),e[a][1]+R(t,s)]);return T(r,null,s)}function T(e,t,s){let r=e.length,a=[];if(r>3){let i=[],l=1-s.curveTightness;a.push({op:"move",data:[e[1][0],e[1][1]]});for(let t=1;t+2<r;t++){let s=e[t];i[0]=[s[0],s[1]],i[1]=[s[0]+(l*e[t+1][0]-l*e[t-1][0])/6,s[1]+(l*e[t+1][1]-l*e[t-1][1])/6],i[2]=[e[t+1][0]+(l*e[t][0]-l*e[t+2][0])/6,e[t+1][1]+(l*e[t][1]-l*e[t+2][1])/6],i[3]=[e[t+1][0],e[t+1][1]],a.push({op:"bcurveTo",data:[i[1][0],i[1][1],i[2][0],i[2][1],i[3][0],i[3][1]]})}if(t&&2===t.length){let e=s.maxRandomnessOffset;a.push({op:"lineTo",data:[t[0]+R(e,s),t[1]+R(e,s)]})}}else 3===r?(a.push({op:"move",data:[e[1][0],e[1][1]]}),a.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):2===r&&a.push(...A(e[0][0],e[0][1],e[1][0],e[1][1],s,!0,!0));return a}function D(e,t,s,r,a,i,l,n){let h=[],o=[];if(0===n.roughness){e/=4,o.push([t+r*Math.cos(-e),s+a*Math.sin(-e)]);for(let i=0;i<=2*Math.PI;i+=e){let e=[t+r*Math.cos(i),s+a*Math.sin(i)];h.push(e),o.push(e)}o.push([t+ +r,s+0*a]),o.push([t+r*Math.cos(e),s+a*Math.sin(e)])}else{let u=R(.5,n)-Math.PI/2;o.push([R(i,n)+t+.9*r*Math.cos(u-e),R(i,n)+s+.9*a*Math.sin(u-e)]);let c=2*Math.PI+u-.01;for(let l=u;l<c;l+=e){let e=[R(i,n)+t+r*Math.cos(l),R(i,n)+s+a*Math.sin(l)];h.push(e),o.push(e)}o.push([R(i,n)+t+r*Math.cos(u+2*Math.PI+.5*l),R(i,n)+s+a*Math.sin(u+2*Math.PI+.5*l)]),o.push([R(i,n)+t+.98*r*Math.cos(u+l),R(i,n)+s+.98*a*Math.sin(u+l)]),o.push([R(i,n)+t+.9*r*Math.cos(u+.5*l),R(i,n)+s+.9*a*Math.sin(u+.5*l)])}return[o,h]}function j(e,t,s,r,a,i,l,n,h){let o=i+R(.1,h),u=[];u.push([R(n,h)+t+.9*r*Math.cos(o-e),R(n,h)+s+.9*a*Math.sin(o-e)]);for(let i=o;i<=l;i+=e)u.push([R(n,h)+t+r*Math.cos(i),R(n,h)+s+a*Math.sin(i)]);return u.push([t+r*Math.cos(l),s+a*Math.sin(l)]),u.push([t+r*Math.cos(l),s+a*Math.sin(l)]),T(u,null,h)}function z(e,t=0){let s=e.length;if(s<3)throw Error("A curve must have at least three points.");let r=[];if(3===s)r.push([...e[0]],[...e[1]],[...e[2]],[...e[2]]);else{let s=[];s.push(e[0],e[0]);for(let t=1;t<e.length;t++)s.push(e[t]),t===e.length-1&&s.push(e[t]);let a=[],i=1-t;r.push([...s[0]]);for(let e=1;e+2<s.length;e++){let t=s[e];a[0]=[t[0],t[1]],a[1]=[t[0]+(i*s[e+1][0]-i*s[e-1][0])/6,t[1]+(i*s[e+1][1]-i*s[e-1][1])/6],a[2]=[s[e+1][0]+(i*s[e][0]-i*s[e+2][0])/6,s[e+1][1]+(i*s[e][1]-i*s[e+2][1])/6],a[3]=[s[e+1][0],s[e+1][1]],r.push(a[1],a[2],a[3])}}return r}function F(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function $(e,t,s){return[e[0]+(t[0]-e[0])*s,e[1]+(t[1]-e[1])*s]}function W(e,t,s,r,a){let i=a||[],l=e[t],n=e[s-1],h=0,o=1;for(let r=t+1;r<s-1;++r){let t=function(e,t,s){let r=F(t,s);if(0===r)return F(e,t);let a=((e[0]-t[0])*(s[0]-t[0])+(e[1]-t[1])*(s[1]-t[1]))/r;return F(e,$(t,s,a=Math.max(0,Math.min(1,a))))}(e[r],l,n);t>h&&(h=t,o=r)}return Math.sqrt(h)>r?(W(e,t,o+1,r,i),W(e,o,s,r,i)):(i.length||i.push(l),i.push(n)),i}function G(e,t=.15,s){let r=[],a=(e.length-1)/3;for(let s=0;s<a;s++)!function e(t,s,r,a){let i,l,n,h,o,u,c,p,f=a||[];if(i=t[s+0],l=t[s+1],n=t[s+2],h=t[s+3],o=3*l[0]-2*i[0]-h[0],o*=o,u=3*l[1]-2*i[1]-h[1],u*=u,c=3*n[0]-2*h[0]-i[0],c*=c,p=3*n[1]-2*h[1]-i[1],p*=p,o<c&&(o=c),u<p&&(u=p),o+u<r){let e=t[s+0];f.length?Math.sqrt(F(f[f.length-1],e))>1&&f.push(e):f.push(e),f.push(t[s+3])}else{let a=t[s+0],i=t[s+1],l=t[s+2],n=t[s+3],h=$(a,i,.5),o=$(i,l,.5),u=$(l,n,.5),c=$(h,o,.5),p=$(o,u,.5),g=$(c,p,.5);e([a,h,c,g],0,r,f),e([g,p,u,n],0,r,f)}return f}(e,3*s,t,r);return s&&s>0?W(r,0,r.length,s):r}let N="none";class q{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(0x80000000*Math.random())}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,t,s){return{shape:e,sets:t||[],options:s||this.defaultOptions}}line(e,t,s,r,a){let i=this._o(a);return this._d("line",[k(e,t,s,r,i)],i)}rectangle(e,t,s,r,a){var i,l,n,h;let o=this._o(a),u=[],c=b([[i=e,l=t],[i+(n=s),l],[i+n,l+(h=r)],[i,l+h]],!0,o);if(o.fill){let a=[[e,t],[e+s,t],[e+s,t+r],[e,t+r]];"solid"===o.fillStyle?u.push(P([a],o)):u.push(O([a],o))}return o.stroke!==N&&u.push(c),this._d("rectangle",u,o)}ellipse(e,t,s,r,a){let i=this._o(a),l=[],n=x(s,r,i),h=w(e,t,i,n);if(i.fill)if("solid"===i.fillStyle){let s=w(e,t,i,n).opset;s.type="fillPath",l.push(s)}else l.push(O([h.estimatedPoints],i));return i.stroke!==N&&l.push(h.opset),this._d("ellipse",l,i)}circle(e,t,s,r){let a=this.ellipse(e,t,s,s,r);return a.shape="circle",a}linearPath(e,t){let s=this._o(t);return this._d("linearPath",[b(e,!1,s)],s)}arc(e,t,s,r,a,i,l=!1,n){let h=this._o(n),o=[],u=v(e,t,s,r,a,i,l,!0,h);if(l&&h.fill)if("solid"===h.fillStyle){let l=Object.assign({},h);l.disableMultiStroke=!0;let n=v(e,t,s,r,a,i,!0,!1,l);n.type="fillPath",o.push(n)}else o.push(function(e,t,s,r,a,i,l){let n=Math.abs(s/2),h=Math.abs(r/2);n+=R(.01*n,l),h+=R(.01*h,l);let o=a,u=i;for(;o<0;)o+=2*Math.PI,u+=2*Math.PI;u-o>2*Math.PI&&(o=0,u=2*Math.PI);let c=(u-o)/l.curveStepCount,p=[];for(let s=o;s<=u;s+=c)p.push([e+n*Math.cos(s),t+h*Math.sin(s)]);return p.push([e+n*Math.cos(u),t+h*Math.sin(u)]),p.push([e,t]),O([p],l)}(e,t,s,r,a,i,h));return h.stroke!==N&&o.push(u),this._d("arc",o,h)}curve(e,t){let s=this._o(t),r=[],a=y(e,s);if(s.fill&&s.fill!==N)if("solid"===s.fillStyle){let t=y(e,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(t.ops)})}else{let t=[];if(e.length)for(let r of"number"==typeof e[0][0]?[e]:e)r.length<3?t.push(...r):3===r.length?t.push(...G(z([r[0],r[0],r[1],r[2]]),10,(1+s.roughness)/2)):t.push(...G(z(r),10,(1+s.roughness)/2));t.length&&r.push(O([t],s))}return s.stroke!==N&&r.push(a),this._d("curve",r,s)}polygon(e,t){let s=this._o(t),r=[],a=b(e,!0,s);return s.fill&&("solid"===s.fillStyle?r.push(P([e],s)):r.push(O([e],s))),s.stroke!==N&&r.push(a),this._d("polygon",r,s)}path(e,t){let s=this._o(t),r=[];if(!e)return this._d("path",r,s);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let a=s.fill&&"transparent"!==s.fill&&s.fill!==N,i=s.stroke!==N,l=!!(s.simplification&&s.simplification<1),n=function(e,t){let s=d(g(f(e))),r=[],a=[],i=[0,0],l=[],n=()=>{l.length>=4&&a.push(...G(l,1)),l=[]},h=()=>{n(),a.length&&(r.push(a),a=[])};for(let{key:e,data:t}of s)switch(e){case"M":h(),i=[t[0],t[1]],a.push(i);break;case"L":n(),a.push([t[0],t[1]]);break;case"C":if(!l.length){let e=a.length?a[a.length-1]:i;l.push([e[0],e[1]])}l.push([t[0],t[1]]),l.push([t[2],t[3]]),l.push([t[4],t[5]]);break;case"Z":n(),a.push([i[0],i[1]])}if(h(),!t)return r;let o=[];for(let e of r){let s=W(e,0,e.length,t);s.length&&o.push(s)}return o}(e,l?4-4*(s.simplification||1):(1+s.roughness)/2),h=S(e,s);if(a)if("solid"===s.fillStyle)if(1===n.length){let t=S(e,Object.assign(Object.assign({},s),{disableMultiStroke:!0,roughness:s.roughness?s.roughness+s.fillShapeRoughnessGain:0}));r.push({type:"fillPath",ops:this._mergedShape(t.ops)})}else r.push(P(n,s));else r.push(O(n,s));return i&&(l?n.forEach(e=>{r.push(b(e,!1,s))}):r.push(h)),this._d("path",r,s)}opsToPath(e,t){let s="";for(let r of e.ops){let e="number"==typeof t&&t>=0?r.data.map(e=>+e.toFixed(t)):r.data;switch(r.op){case"move":s+=`M${e[0]} ${e[1]} `;break;case"bcurveTo":s+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case"lineTo":s+=`L${e[0]} ${e[1]} `}}return s.trim()}toPaths(e){let t=e.sets||[],s=e.options||this.defaultOptions,r=[];for(let e of t){let t=null;switch(e.type){case"path":t={d:this.opsToPath(e),stroke:s.stroke,strokeWidth:s.strokeWidth,fill:N};break;case"fillPath":t={d:this.opsToPath(e),stroke:N,strokeWidth:0,fill:s.fill||N};break;case"fillSketch":t=this.fillSketch(e,s)}t&&r.push(t)}return r}fillSketch(e,t){let s=t.fillWeight;return s<0&&(s=t.strokeWidth/2),{d:this.opsToPath(e),stroke:t.fill||N,strokeWidth:s,fill:N}}_mergedShape(e){return e.filter((e,t)=>0===t||"move"!==e.op)}}class B{constructor(e,t){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new q(t)}draw(e){let t=e.sets||[],s=e.options||this.getDefaultOptions(),r=this.ctx,a=e.options.fixedDecimalPlaceDigits;for(let i of t)switch(i.type){case"path":r.save(),r.strokeStyle="none"===s.stroke?"transparent":s.stroke,r.lineWidth=s.strokeWidth,s.strokeLineDash&&r.setLineDash(s.strokeLineDash),s.strokeLineDashOffset&&(r.lineDashOffset=s.strokeLineDashOffset),this._drawToContext(r,i,a),r.restore();break;case"fillPath":{r.save(),r.fillStyle=s.fill||"";let t="curve"===e.shape||"polygon"===e.shape||"path"===e.shape?"evenodd":"nonzero";this._drawToContext(r,i,a,t),r.restore();break}case"fillSketch":this.fillSketch(r,i,s)}}fillSketch(e,t,s){let r=s.fillWeight;r<0&&(r=s.strokeWidth/2),e.save(),s.fillLineDash&&e.setLineDash(s.fillLineDash),s.fillLineDashOffset&&(e.lineDashOffset=s.fillLineDashOffset),e.strokeStyle=s.fill||"",e.lineWidth=r,this._drawToContext(e,t,s.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,t,s,r="nonzero"){for(let r of(e.beginPath(),t.ops)){let t="number"==typeof s&&s>=0?r.data.map(e=>+e.toFixed(s)):r.data;switch(r.op){case"move":e.moveTo(t[0],t[1]);break;case"bcurveTo":e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]);break;case"lineTo":e.lineTo(t[0],t[1])}}"fillPath"===t.type?e.fill(r):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,t,s,r,a){let i=this.gen.line(e,t,s,r,a);return this.draw(i),i}rectangle(e,t,s,r,a){let i=this.gen.rectangle(e,t,s,r,a);return this.draw(i),i}ellipse(e,t,s,r,a){let i=this.gen.ellipse(e,t,s,r,a);return this.draw(i),i}circle(e,t,s,r){let a=this.gen.circle(e,t,s,r);return this.draw(a),a}linearPath(e,t){let s=this.gen.linearPath(e,t);return this.draw(s),s}polygon(e,t){let s=this.gen.polygon(e,t);return this.draw(s),s}arc(e,t,s,r,a,i,l=!1,n){let h=this.gen.arc(e,t,s,r,a,i,l,n);return this.draw(h),h}curve(e,t){let s=this.gen.curve(e,t);return this.draw(s),s}path(e,t){let s=this.gen.path(e,t);return this.draw(s),s}}let U="http://www.w3.org/2000/svg";class V{constructor(e,t){this.svg=e,this.gen=new q(t)}draw(e){let t=e.sets||[],s=e.options||this.getDefaultOptions(),r=this.svg.ownerDocument||window.document,a=r.createElementNS(U,"g"),i=e.options.fixedDecimalPlaceDigits;for(let l of t){let t=null;switch(l.type){case"path":(t=r.createElementNS(U,"path")).setAttribute("d",this.opsToPath(l,i)),t.setAttribute("stroke",s.stroke),t.setAttribute("stroke-width",s.strokeWidth+""),t.setAttribute("fill","none"),s.strokeLineDash&&t.setAttribute("stroke-dasharray",s.strokeLineDash.join(" ").trim()),s.strokeLineDashOffset&&t.setAttribute("stroke-dashoffset",`${s.strokeLineDashOffset}`);break;case"fillPath":(t=r.createElementNS(U,"path")).setAttribute("d",this.opsToPath(l,i)),t.setAttribute("stroke","none"),t.setAttribute("stroke-width","0"),t.setAttribute("fill",s.fill||""),"curve"!==e.shape&&"polygon"!==e.shape||t.setAttribute("fill-rule","evenodd");break;case"fillSketch":t=this.fillSketch(r,l,s)}t&&a.appendChild(t)}return a}fillSketch(e,t,s){let r=s.fillWeight;r<0&&(r=s.strokeWidth/2);let a=e.createElementNS(U,"path");return a.setAttribute("d",this.opsToPath(t,s.fixedDecimalPlaceDigits)),a.setAttribute("stroke",s.fill||""),a.setAttribute("stroke-width",r+""),a.setAttribute("fill","none"),s.fillLineDash&&a.setAttribute("stroke-dasharray",s.fillLineDash.join(" ").trim()),s.fillLineDashOffset&&a.setAttribute("stroke-dashoffset",`${s.fillLineDashOffset}`),a}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,t){return this.gen.opsToPath(e,t)}line(e,t,s,r,a){let i=this.gen.line(e,t,s,r,a);return this.draw(i)}rectangle(e,t,s,r,a){let i=this.gen.rectangle(e,t,s,r,a);return this.draw(i)}ellipse(e,t,s,r,a){let i=this.gen.ellipse(e,t,s,r,a);return this.draw(i)}circle(e,t,s,r){let a=this.gen.circle(e,t,s,r);return this.draw(a)}linearPath(e,t){let s=this.gen.linearPath(e,t);return this.draw(s)}polygon(e,t){let s=this.gen.polygon(e,t);return this.draw(s)}arc(e,t,s,r,a,i,l=!1,n){let h=this.gen.arc(e,t,s,r,a,i,l,n);return this.draw(h)}curve(e,t){let s=this.gen.curve(e,t);return this.draw(s)}path(e,t){let s=this.gen.path(e,t);return this.draw(s)}}e.s(["default",0,{canvas:(e,t)=>new B(e,t),svg:(e,t)=>new V(e,t),generator:e=>new q(e),newSeed:()=>q.newSeed()}])}]);