@miadi/stateloom-web 0.1.2 → 0.1.4

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 (68) hide show
  1. package/package.json +1 -1
  2. package/server/.next/BUILD_ID +1 -1
  3. package/server/.next/app-path-routes-manifest.json +1 -0
  4. package/server/.next/build-manifest.json +2 -2
  5. package/server/.next/routes-manifest.json +6 -0
  6. package/server/.next/server/app/_global-error.html +2 -2
  7. package/server/.next/server/app/_global-error.rsc +1 -1
  8. package/server/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/server/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/server/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/server/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/server/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/server/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/server/.next/server/app/_not-found.html +1 -1
  15. package/server/.next/server/app/_not-found.rsc +2 -2
  16. package/server/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  17. package/server/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/server/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/server/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/server/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/server/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  22. package/server/.next/server/app/api/docs/route/app-paths-manifest.json +3 -0
  23. package/server/.next/server/app/api/docs/route/build-manifest.json +11 -0
  24. package/server/.next/server/app/api/docs/route/server-reference-manifest.json +4 -0
  25. package/server/.next/server/app/api/docs/route.js +8 -0
  26. package/server/.next/server/app/api/docs/route.js.map +5 -0
  27. package/server/.next/server/app/api/docs/route.js.nft.json +1 -0
  28. package/server/.next/server/app/api/docs/route_client-reference-manifest.js +2 -0
  29. package/server/.next/server/app/api/file/route.js.nft.json +1 -1
  30. package/server/.next/server/app/api/rispec/route.js.nft.json +1 -1
  31. package/server/.next/server/app/api/watch/route.js.nft.json +1 -1
  32. package/server/.next/server/app/index.html +1 -1
  33. package/server/.next/server/app/index.rsc +3 -3
  34. package/server/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  35. package/server/.next/server/app/index.segments/_full.segment.rsc +3 -3
  36. package/server/.next/server/app/index.segments/_head.segment.rsc +1 -1
  37. package/server/.next/server/app/index.segments/_index.segment.rsc +2 -2
  38. package/server/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  39. package/server/.next/server/app/page.js.nft.json +1 -1
  40. package/server/.next/server/app/page_client-reference-manifest.js +1 -1
  41. package/server/.next/server/app-paths-manifest.json +1 -0
  42. package/server/.next/server/chunks/[root-of-the-server]__13c3d2a8._.js +3 -0
  43. package/server/.next/server/chunks/[root-of-the-server]__2046b812._.js +2 -2
  44. package/server/.next/server/chunks/[root-of-the-server]__87bf4b91._.js +1 -1
  45. package/server/.next/server/chunks/[root-of-the-server]__95b05635._.js +3 -3
  46. package/server/.next/server/chunks/ssr/{[root-of-the-server]__bfd16096._.js → [root-of-the-server]__2b35b711._.js} +1 -1
  47. package/server/.next/server/chunks/ssr/[root-of-the-server]__edbb995c._.js +3 -3
  48. package/server/.next/server/chunks/web__next-internal_server_app_api_docs_route_actions_1f543c30.js +3 -0
  49. package/server/.next/server/pages/404.html +1 -1
  50. package/server/.next/server/pages/500.html +2 -2
  51. package/server/.next/static/chunks/1cbe108679f9af04.css +2 -0
  52. package/server/.next/static/chunks/c8da5c76cf5bb070.js +10 -0
  53. package/server/package-lock.json +4 -4
  54. package/server/package.json +16 -2
  55. package/server/src/app/api/docs/route.ts +31 -0
  56. package/server/src/app/globals.css +4 -9
  57. package/server/src/components/DocSwitcher.tsx +119 -31
  58. package/server/src/components/PresenceChips.tsx +77 -0
  59. package/server/src/components/SocketBridgeProvider.tsx +6 -22
  60. package/server/src/components/Toolbar.tsx +5 -0
  61. package/server/src/lib/projectFile.ts +106 -5
  62. package/server/stateloom-web.json +2 -2
  63. package/server/tsconfig.tsbuildinfo +1 -1
  64. package/server/.next/static/chunks/0a0f393b77d3422b.css +0 -2
  65. package/server/.next/static/chunks/e29b67abadc7c68a.js +0 -10
  66. /package/server/.next/static/{Q7HQy4udl4A_DaAl9bdUt → yHDbm89IPqExJUSbiWtnD}/_buildManifest.js +0 -0
  67. /package/server/.next/static/{Q7HQy4udl4A_DaAl9bdUt → yHDbm89IPqExJUSbiWtnD}/_clientMiddlewareManifest.json +0 -0
  68. /package/server/.next/static/{Q7HQy4udl4A_DaAl9bdUt → yHDbm89IPqExJUSbiWtnD}/_ssgManifest.js +0 -0
@@ -0,0 +1,3 @@
1
+ module.exports=[2942,(e,o,d)=>{}];
2
+
3
+ //# sourceMappingURL=web__next-internal_server_app_api_docs_route_actions_1f543c30.js.map
@@ -1 +1 @@
1
- <!DOCTYPE html><!--Q7HQy4udl4A_DaAl9bdUt--><html lang="en" class="dark"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover, user-scalable=no, interactive-widget=resizes-content"/><link rel="stylesheet" href="/_next/static/chunks/0a0f393b77d3422b.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/662d1b0ce457c16b.js"/><script src="/_next/static/chunks/5e1795a806bd6c51.js" async=""></script><script src="/_next/static/chunks/96818f5620f039a1.js" async=""></script><script src="/_next/static/chunks/turbopack-34fc7de1568e2a7f.js" async=""></script><script src="/_next/static/chunks/7a768100bec00db1.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><meta name="theme-color" content="#030712"/><meta name="color-scheme" content="dark"/><title>SMCraft Designer</title><meta name="description" content="Visual State Machine Designer"/><link rel="icon" href="/favicon.ico?favicon.0b3bf435.ico" sizes="256x256" type="image/x-icon"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="antialiased"><div hidden=""><!--$--><!--/$--></div><script>try{var s=parseFloat(localStorage.getItem("stateloom.uiScale.v1"));if(s>=0.75&&s<=1.75)document.documentElement.style.fontSize=(16*s)+"px"}catch(e){}</script><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/662d1b0ce457c16b.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[88287,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n3:I[74895,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n4:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"ViewportBoundary\"]\n9:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"MetadataBoundary\"]\nb:I[52576,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n:HL[\"/_next/static/chunks/0a0f393b77d3422b.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"Q7HQy4udl4A_DaAl9bdUt\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/0a0f393b77d3422b.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"className\":\"dark\",\"children\":[\"$\",\"body\",null,{\"className\":\"antialiased\",\"children\":[[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"try{var s=parseFloat(localStorage.getItem(\\\"stateloom.uiScale.v1\\\"));if(s\u003e=0.75\u0026\u0026s\u003c=1.75)document.documentElement.style.fontSize=(16*s)+\\\"px\\\"}catch(e){}\"}}],[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:1:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:1:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:1:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:1:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L7\",null,{\"children\":\"$L8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$La\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover, user-scalable=no, interactive-widget=resizes-content\"}],[\"$\",\"meta\",\"2\",{\"name\":\"theme-color\",\"content\":\"#030712\"}],[\"$\",\"meta\",\"3\",{\"name\":\"color-scheme\",\"content\":\"dark\"}]]\n"])</script><script>self.__next_f.push([1,"c:I[49310,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"IconMark\"]\n6:null\na:[[\"$\",\"title\",\"0\",{\"children\":\"SMCraft Designer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Visual State Machine Designer\"}],[\"$\",\"link\",\"2\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?favicon.0b3bf435.ico\",\"sizes\":\"256x256\",\"type\":\"image/x-icon\"}],[\"$\",\"$Lc\",\"3\",{}]]\n"])</script></body></html>
1
+ <!DOCTYPE html><!--yHDbm89IPqExJUSbiWtnD--><html lang="en" class="dark"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover, user-scalable=no, interactive-widget=resizes-content"/><link rel="stylesheet" href="/_next/static/chunks/1cbe108679f9af04.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/662d1b0ce457c16b.js"/><script src="/_next/static/chunks/5e1795a806bd6c51.js" async=""></script><script src="/_next/static/chunks/96818f5620f039a1.js" async=""></script><script src="/_next/static/chunks/turbopack-34fc7de1568e2a7f.js" async=""></script><script src="/_next/static/chunks/7a768100bec00db1.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><meta name="theme-color" content="#030712"/><meta name="color-scheme" content="dark"/><title>SMCraft Designer</title><meta name="description" content="Visual State Machine Designer"/><link rel="icon" href="/favicon.ico?favicon.0b3bf435.ico" sizes="256x256" type="image/x-icon"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="antialiased"><div hidden=""><!--$--><!--/$--></div><script>try{var s=parseFloat(localStorage.getItem("stateloom.uiScale.v1"));if(s>=0.75&&s<=1.75)document.documentElement.style.fontSize=(16*s)+"px"}catch(e){}</script><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/662d1b0ce457c16b.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[88287,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n3:I[74895,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n4:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"ViewportBoundary\"]\n9:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"MetadataBoundary\"]\nb:I[52576,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n:HL[\"/_next/static/chunks/1cbe108679f9af04.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"yHDbm89IPqExJUSbiWtnD\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/1cbe108679f9af04.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"className\":\"dark\",\"children\":[\"$\",\"body\",null,{\"className\":\"antialiased\",\"children\":[[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"try{var s=parseFloat(localStorage.getItem(\\\"stateloom.uiScale.v1\\\"));if(s\u003e=0.75\u0026\u0026s\u003c=1.75)document.documentElement.style.fontSize=(16*s)+\\\"px\\\"}catch(e){}\"}}],[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:1:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:1:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:1:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:1:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L7\",null,{\"children\":\"$L8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$La\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover, user-scalable=no, interactive-widget=resizes-content\"}],[\"$\",\"meta\",\"2\",{\"name\":\"theme-color\",\"content\":\"#030712\"}],[\"$\",\"meta\",\"3\",{\"name\":\"color-scheme\",\"content\":\"dark\"}]]\n"])</script><script>self.__next_f.push([1,"c:I[49310,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"IconMark\"]\n6:null\na:[[\"$\",\"title\",\"0\",{\"children\":\"SMCraft Designer\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Visual State Machine Designer\"}],[\"$\",\"link\",\"2\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?favicon.0b3bf435.ico\",\"sizes\":\"256x256\",\"type\":\"image/x-icon\"}],[\"$\",\"$Lc\",\"3\",{}]]\n"])</script></body></html>
@@ -1,2 +1,2 @@
1
- <!DOCTYPE html><!--Q7HQy4udl4A_DaAl9bdUt--><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/662d1b0ce457c16b.js"/><script src="/_next/static/chunks/5e1795a806bd6c51.js" async=""></script><script src="/_next/static/chunks/96818f5620f039a1.js" async=""></script><script src="/_next/static/chunks/turbopack-34fc7de1568e2a7f.js" async=""></script><script src="/_next/static/chunks/7a768100bec00db1.js" async=""></script><title>500: Internal Server Error.</title><link rel="icon" href="/favicon.ico?favicon.0b3bf435.ico" sizes="256x256" type="image/x-icon"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}
2
- @media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/662d1b0ce457c16b.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[88287,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n3:I[74895,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n4:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"ViewportBoundary\"]\n9:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"MetadataBoundary\"]\nb:I[52576,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"Q7HQy4udl4A_DaAl9bdUt\",\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"title\",null,{\"children\":\"500: Internal Server Error.\"}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"lineHeight\":\"48px\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}\\n@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"paddingRight\":23,\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\"},\"children\":\"500\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"28px\"},\"children\":\"Internal Server Error.\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L7\",null,{\"children\":\"$L8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$La\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"c:I[49310,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"IconMark\"]\n6:null\na:[[\"$\",\"link\",\"0\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?favicon.0b3bf435.ico\",\"sizes\":\"256x256\",\"type\":\"image/x-icon\"}],[\"$\",\"$Lc\",\"1\",{}]]\n"])</script></body></html>
1
+ <!DOCTYPE html><!--yHDbm89IPqExJUSbiWtnD--><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/662d1b0ce457c16b.js"/><script src="/_next/static/chunks/5e1795a806bd6c51.js" async=""></script><script src="/_next/static/chunks/96818f5620f039a1.js" async=""></script><script src="/_next/static/chunks/turbopack-34fc7de1568e2a7f.js" async=""></script><script src="/_next/static/chunks/7a768100bec00db1.js" async=""></script><title>500: Internal Server Error.</title><link rel="icon" href="/favicon.ico?favicon.0b3bf435.ico" sizes="256x256" type="image/x-icon"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}
2
+ @media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/662d1b0ce457c16b.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[88287,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n3:I[74895,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n4:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"ViewportBoundary\"]\n9:I[51858,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"MetadataBoundary\"]\nb:I[52576,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"yHDbm89IPqExJUSbiWtnD\",\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"title\",null,{\"children\":\"500: Internal Server Error.\"}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"lineHeight\":\"48px\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}\\n@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"paddingRight\":23,\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\"},\"children\":\"500\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"28px\"},\"children\":\"Internal Server Error.\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L7\",null,{\"children\":\"$L8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$La\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"c:I[49310,[\"/_next/static/chunks/7a768100bec00db1.js\"],\"IconMark\"]\n6:null\na:[[\"$\",\"link\",\"0\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?favicon.0b3bf435.ico\",\"sizes\":\"256x256\",\"type\":\"image/x-icon\"}],[\"$\",\"$Lc\",\"1\",{}]]\n"])</script></body></html>
@@ -0,0 +1,2 @@
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--color-red-400:#ff6568;--color-red-500:#fb2c36;--color-red-600:#e40014;--color-amber-400:#fcbb00;--color-amber-700:#b75000;--color-yellow-400:#fac800;--color-yellow-500:#edb200;--color-yellow-600:#cd8900;--color-green-400:#05df72;--color-green-500:#00c758;--color-emerald-500:#00bb7f;--color-blue-400:#54a2ff;--color-blue-500:#3080ff;--color-blue-600:#155dfc;--color-blue-900:#1c398e;--color-gray-200:#e5e7eb;--color-gray-300:#d1d5dc;--color-gray-400:#99a1af;--color-gray-500:#6a7282;--color-gray-600:#4a5565;--color-gray-700:#364153;--color-gray-800:#1e2939;--color-gray-900:#101828;--color-gray-950:#030712;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--font-weight-medium:500;--font-weight-semibold:600;--tracking-wide:.025em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-lg:.5rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0,0,.2,1);--blur-md:12px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-geist-sans);--default-mono-font-family:var(--font-geist-mono)}@supports (color:lab(0% 0 0)){:root,:host{--color-red-400:lab(63.7053% 60.745 31.3109);--color-red-500:lab(55.4814% 75.0732 48.8528);--color-red-600:lab(48.4493% 77.4328 61.5452);--color-amber-400:lab(80.1641% 16.6016 99.2089);--color-amber-700:lab(47.2709% 42.9082 69.2966);--color-yellow-400:lab(83.2664% 8.65132 106.895);--color-yellow-500:lab(76.3898% 14.5258 98.4589);--color-yellow-600:lab(62.7799% 22.4197 86.1544);--color-green-400:lab(78.503% -64.9265 39.7492);--color-green-500:lab(70.5521% -66.5147 45.8073);--color-emerald-500:lab(66.9756% -58.27 19.5419);--color-blue-400:lab(65.0361% -1.42065 -56.9802);--color-blue-500:lab(54.1736% 13.3369 -74.6839);--color-blue-600:lab(44.0605% 29.0279 -86.0352);--color-blue-900:lab(26.1542% 15.7545 -51.5504);--color-gray-200:lab(91.6229% -.159115 -2.26791);--color-gray-300:lab(85.1236% -.612259 -3.7138);--color-gray-400:lab(65.9269% -.832707 -8.17473);--color-gray-500:lab(47.7841% -.393182 -10.0268);--color-gray-600:lab(35.6337% -1.58697 -10.8425);--color-gray-700:lab(27.1134% -.956401 -12.3224);--color-gray-800:lab(16.1051% -1.18239 -11.7533);--color-gray-900:lab(8.11897% .811279 -12.254);--color-gray-950:lab(1.90334% .278696 -5.48866)}}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.inset-x-0{inset-inline:calc(var(--spacing)*0)}.inset-x-4{inset-inline:calc(var(--spacing)*4)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing)*0)}.top-1{top:calc(var(--spacing)*1)}.top-full{top:100%}.right-1{right:calc(var(--spacing)*1)}.right-1\/2{right:50%}.bottom-0{bottom:calc(var(--spacing)*0)}.left-0{left:calc(var(--spacing)*0)}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing)*-1)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.-mr-2{margin-right:calc(var(--spacing)*-2)}.mr-1{margin-right:calc(var(--spacing)*1)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.ml-0\.5{margin-left:calc(var(--spacing)*.5)}.ml-1{margin-left:calc(var(--spacing)*1)}.block{display:block}.contents{display:contents}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1{height:calc(var(--spacing)*1)}.h-2{height:calc(var(--spacing)*2)}.h-4{height:calc(var(--spacing)*4)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-\[70dvh\]{height:70dvh}.h-full{height:100%}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-\[85dvh\]{max-height:85dvh}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-11{min-height:calc(var(--spacing)*11)}.w-2{width:calc(var(--spacing)*2)}.w-6{width:calc(var(--spacing)*6)}.w-10{width:calc(var(--spacing)*10)}.w-24{width:calc(var(--spacing)*24)}.w-32{width:calc(var(--spacing)*32)}.w-56{width:calc(var(--spacing)*56)}.w-80{width:calc(var(--spacing)*80)}.w-full{width:100%}.w-px{width:1px}.max-w-\[40vw\]{max-width:40vw}.max-w-\[50vw\]{max-width:50vw}.max-w-\[80px\]{max-width:80px}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-11{min-width:calc(var(--spacing)*11)}.min-w-\[14px\]{min-width:14px}.min-w-\[16px\]{min-width:16px}.min-w-\[180px\]{min-width:180px}.flex-1{flex:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.translate-x-4{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-full{--tw-translate-y:100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.-space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*-1)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*-1)*calc(1 - var(--tw-space-x-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-blue-400{border-color:var(--color-blue-400)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-800{border-color:var(--color-gray-800)}.border-gray-800\/50{border-color:#1e293980}@supports (color:color-mix(in lab, red, red)){.border-gray-800\/50{border-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.\!bg-amber-700{background-color:var(--color-amber-700)!important}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-blue-400{background-color:var(--color-blue-400)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-blue-900\/30{background-color:#1c398e4d}@supports (color:color-mix(in lab, red, red)){.bg-blue-900\/30{background-color:color-mix(in oklab,var(--color-blue-900)30%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-gray-800\/50{background-color:#1e293980}@supports (color:color-mix(in lab, red, red)){.bg-gray-800\/50{background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.bg-gray-900{background-color:var(--color-gray-900)}.bg-gray-900\/50{background-color:#10182880}@supports (color:color-mix(in lab, red, red)){.bg-gray-900\/50{background-color:color-mix(in oklab,var(--color-gray-900)50%,transparent)}}.bg-gray-900\/95{background-color:#101828f2}@supports (color:color-mix(in lab, red, red)){.bg-gray-900\/95{background-color:color-mix(in oklab,var(--color-gray-900)95%,transparent)}}.bg-gray-950{background-color:var(--color-gray-950)}.bg-red-600{background-color:var(--color-red-600)}.bg-transparent{background-color:#0000}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pr-1{padding-right:calc(var(--spacing)*1)}.pb-0\.5{padding-bottom:calc(var(--spacing)*.5)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-geist-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.leading-4{--tw-leading:calc(var(--spacing)*4);line-height:calc(var(--spacing)*4)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.\!text-red-400{color:var(--color-red-400)!important}.\!text-white{color:var(--color-white)!important}.text-amber-400{color:var(--color-amber-400)}.text-blue-400{color:var(--color-blue-400)}.text-blue-500{color:var(--color-blue-500)}.text-emerald-500{color:var(--color-emerald-500)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-600{color:var(--color-yellow-600)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-gray-900{--tw-ring-color:var(--color-gray-900)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.placeholder\:text-gray-600::placeholder{color:var(--color-gray-600)}@media (hover:hover){.hover\:bg-blue-500:hover{background-color:var(--color-blue-500)}.hover\:bg-gray-600:hover{background-color:var(--color-gray-600)}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-gray-800\/30:hover{background-color:#1e29394d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-gray-800\/30:hover{background-color:color-mix(in oklab,var(--color-gray-800)30%,transparent)}}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-gray-400:hover{color:var(--color-gray-400)}.hover\:text-red-400:hover{color:var(--color-red-400)}}.focus\:border-blue-500:focus{border-color:var(--color-blue-500)}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}@media (min-width:48rem){.md\:pointer-events-auto{pointer-events:auto}.md\:static{position:static}.md\:z-auto{z-index:auto}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-auto{height:auto}.md\:max-h-\[80dvh\]{max-height:80dvh}.md\:max-h-\[calc\(100vh-160px\)\]{max-height:calc(100vh - 160px)}.md\:min-h-0{min-height:calc(var(--spacing)*0)}.md\:w-24{width:calc(var(--spacing)*24)}.md\:w-80{width:calc(var(--spacing)*80)}.md\:w-\[80\%\]{width:80%}.md\:max-w-3xl{max-width:var(--container-3xl)}.md\:max-w-\[16rem\]{max-width:16rem}.md\:max-w-none{max-width:none}.md\:min-w-0{min-width:calc(var(--spacing)*0)}.md\:min-w-\[140px\]{min-width:140px}.md\:translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.md\:flex-row{flex-direction:row}.md\:flex-wrap{flex-wrap:wrap}.md\:items-center{align-items:center}.md\:overflow-y-auto{overflow-y:auto}.md\:rounded-none{border-radius:0}.md\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.md\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.md\:p-0{padding:calc(var(--spacing)*0)}.md\:px-3{padding-inline:calc(var(--spacing)*3)}.md\:py-1{padding-block:calc(var(--spacing)*1)}.md\:py-1\.5{padding-block:calc(var(--spacing)*1.5)}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.md\:text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.md\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.md\:transition-none{transition-property:none}}}:root{--background:#030712;--foreground:#e2e8f0}body{background:var(--background);color:var(--foreground);font-family:Arial,Helvetica,sans-serif}.toolbar-btn{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-gray-700);background-color:var(--color-gray-800);padding-inline:calc(var(--spacing)*2.5);padding-block:calc(var(--spacing)*1);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-gray-300);border-radius:.25rem}@media (hover:hover){.toolbar-btn:hover{background-color:var(--color-gray-700)}}.toolbar-btn-sm{background-color:var(--color-gray-700);padding-inline:calc(var(--spacing)*1.5);padding-block:calc(var(--spacing)*.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-gray-300);border-radius:.25rem}@media (hover:hover){.toolbar-btn-sm:hover{background-color:var(--color-gray-600)}}:root{--sm-dock-h:3.5rem}html,body{height:100%}html,body,.app-shell{touch-action:pan-x pan-y}body{overscroll-behavior:none;overflow:hidden}.app-shell{height:100dvh;padding-top:env(safe-area-inset-top);padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}.dock-offset{padding-bottom:calc(var(--sm-dock-h) + env(safe-area-inset-bottom))}.dock-safe{padding-bottom:env(safe-area-inset-bottom)}.safe-x{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}@media (min-width:768px){.dock-offset{padding-bottom:0}}.ui-scale-pill{z-index:45;right:calc(env(safe-area-inset-right) + 12px);bottom:calc(var(--sm-dock-h) + env(safe-area-inset-bottom) + 8px);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);color:#9ca3af;white-space:nowrap;background:#111827eb;border:1px solid #374151;border-radius:9999px;align-items:center;gap:8px;padding:6px 8px 6px 12px;font-size:12px;line-height:1;display:flex;position:fixed}.ui-scale-pill button{color:#93c5fd;background:#1f2937;border-radius:9999px;min-height:32px;padding:0 12px;font-size:12px;line-height:1}@media (min-width:768px){.ui-scale-pill{bottom:calc(env(safe-area-inset-bottom) + 12px)}}.toolbar-ident,.toolbar-strip{align-items:center;gap:.375rem;min-width:0;display:flex}.toolbar-strip{scrollbar-width:thin;-webkit-overflow-scrolling:touch;flex-wrap:nowrap;overflow:auto hidden}.toolbar-strip>*{flex:none}@media (min-width:768px){.toolbar-ident,.toolbar-strip{display:contents}}@media (pointer:coarse){.toolbar-btn,.toolbar-btn-sm{justify-content:center;align-items:center;min-width:2.75rem;min-height:2.75rem;padding-inline:.75rem;font-size:.8125rem;display:inline-flex}.toolbar-strip select,.toolbar-strip input{min-height:2.75rem}input:not([type=checkbox]),select,textarea{font-size:16px}input[type=checkbox]{width:1.15rem;height:1.15rem}.touch-targets button{min-width:2.75rem;min-height:2.75rem}.touch-targets select,.touch-targets input:not([type=checkbox]){min-height:2.75rem}.touch-targets textarea{min-height:3.5rem}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
2
+ .slc-pane{--slc-surface:#030712;--slc-node-fill:#0f172a;--slc-node-stroke:#475569;--slc-composite-fill:#0c1020;--slc-final-fill:#1e293b;--slc-accent:#3b82f6;--slc-accent-fill:#1e3a5f;--slc-accent-ink:#93c5fd;--slc-danger:#ef4444;--slc-draw-source:#f59e0b;--slc-active:#22c55e;--slc-edge:#94a3b8;--slc-chip-fill:#1e293b;--slc-chip-stroke:#334155;--slc-label:#e2e8f0;--slc-muted:#94a3b8;--slc-faint:#64748b;--slc-entry:#22c55e;--slc-exit:#f97316;--slc-composite:#6366f1;--slc-panel-bg:#111827e6;--slc-panel-border:#374151;--slc-panel-hover:#1f2937;touch-action:none;width:100%;height:100%;position:relative}.slc-surface{background:var(--slc-surface);width:100%;height:100%;display:block}.slc-node{fill:var(--slc-node-fill);stroke:var(--slc-node-stroke);stroke-width:1.5px}.slc-node--final{fill:var(--slc-final-fill)}.slc-node--composite{fill:var(--slc-composite-fill)}.slc-node--source{fill:var(--slc-accent-fill);stroke:var(--slc-draw-source)}.slc-node--error{stroke:var(--slc-danger);stroke-width:2px}.slc-node--selected{stroke:var(--slc-accent);stroke-width:2.5px}.slc-node-name{fill:var(--slc-label);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:14px;font-weight:600}.slc-node-kind{fill:var(--slc-faint);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:10px}.slc-node-entry{fill:var(--slc-entry);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:9px}.slc-node-exit{fill:var(--slc-exit);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:9px}.slc-node-warn{fill:var(--slc-danger);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:12px}.slc-node-drill{fill:var(--slc-composite);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:9px}.slc-node--drawing{cursor:crosshair}.slc-node--drillable{cursor:pointer}.slc-node--draggable{cursor:grab}.slc-node--draggable:active{cursor:grabbing}.slc-node--static{cursor:default}.slc-edge{fill:none;stroke:var(--slc-edge);stroke-width:1.5px;cursor:pointer}.slc-edge:hover{stroke:var(--slc-accent-ink)}.slc-edge--selected{stroke:var(--slc-accent);stroke-width:2.5px}.slc-arrowhead{fill:var(--slc-edge)}.slc-arrowhead--selected{fill:var(--slc-accent)}.slc-chip{cursor:pointer}.slc-chip-plate{fill:var(--slc-chip-fill);stroke:var(--slc-chip-stroke);stroke-width:1px}.slc-chip-plate--selected{fill:var(--slc-accent-fill);stroke:var(--slc-accent)}.slc-chip-text{fill:var(--slc-muted);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:11px;font-weight:500}.slc-chip-text--selected{fill:var(--slc-accent-ink)}.slc-chip-guard{fill:var(--slc-faint);-webkit-user-select:none;user-select:none;font-size:9px}.slc-chip-leader{stroke:var(--slc-chip-stroke);stroke-width:1px;stroke-dasharray:2 3;pointer-events:none}.slc-chip-leader--selected{stroke:var(--slc-accent)}.slc-glyph{fill:none;stroke:#7c93b0;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.slc-glyph--selected{stroke:var(--slc-accent-ink)}.slc-glyph .slc-glyph-dot{fill:#7c93b0}.slc-glyph--selected .slc-glyph-dot{fill:var(--slc-accent-ink)}.slc-draw-hint{fill:var(--slc-draw-source);pointer-events:none;-webkit-user-select:none;user-select:none;font-size:13px}.slc-empty{fill:var(--slc-faint);font-size:16px}.slc-crumbs{z-index:10;border:1px solid var(--slc-panel-border);background:var(--slc-panel-bg);border-radius:.5rem;align-items:center;gap:.25rem;padding:.375rem .75rem;font-size:.8125rem;line-height:1.25;display:flex;position:absolute;top:.5rem;left:.5rem}.slc-crumb-item{align-items:center;gap:.25rem;display:flex}.slc-crumb-sep{color:var(--slc-faint)}.slc-crumb{cursor:pointer;color:var(--slc-muted);font:inherit;background:0 0;border:0;padding:0}.slc-crumb:hover{color:var(--slc-accent-ink)}.slc-crumb--current{color:var(--slc-accent-ink);font-weight:600}.slc-hud{z-index:10;border:1px solid var(--slc-panel-border);background:var(--slc-panel-bg);color:var(--slc-muted);-webkit-user-select:none;user-select:none;border-radius:.5rem;align-items:center;gap:.125rem;padding:.25rem .375rem;font-size:.75rem;display:flex;position:absolute;bottom:.75rem;left:.75rem}.slc-hud-btn{color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;border-radius:.25rem;padding:.125rem .375rem}.slc-hud-btn:hover:not(:disabled){background:var(--slc-panel-hover);color:var(--slc-label)}.slc-hud-btn:disabled{opacity:.4;cursor:default}.slc-hud-btn--scale{font-variant-numeric:tabular-nums;min-width:3.25rem}.slc-hud--coarse .slc-hud-btn{padding:.5rem .75rem}.slc-hud-sep{color:var(--slc-panel-border);padding:0 .125rem}.slc-hud-hint{color:var(--slc-faint);padding:0 .25rem;font-size:.625rem}.slc-picker{z-index:50;border:1px solid var(--slc-panel-border);background:var(--slc-panel-bg);border-radius:.5rem;min-width:160px;padding:.5rem;position:absolute;box-shadow:0 10px 25px #00000073}.slc-picker-title{color:var(--slc-muted);padding:0 .25rem .25rem;font-size:.75rem}.slc-picker-sub{color:var(--slc-faint);padding:0 .25rem .25rem;font-size:.75rem}.slc-picker-empty{color:var(--slc-faint);padding:.5rem .25rem;font-size:.75rem}.slc-picker-item{text-align:left;width:100%;color:var(--slc-label);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:.25rem;padding:.25rem .5rem;font-size:.875rem;display:block}.slc-picker-item:hover{background:var(--slc-panel-hover)}.slc-picker-cancel{text-align:left;border:0;border-top:1px solid var(--slc-panel-border);width:100%;color:var(--slc-faint);font:inherit;cursor:pointer;background:0 0;margin-top:.25rem;padding:.25rem .5rem;font-size:.75rem;display:block}.slc-picker-cancel:hover{color:var(--slc-label)}@keyframes slc-node-in{0%{opacity:0;transform:scale(.92)}to{opacity:1;transform:scale(1)}}@keyframes slc-node-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.9)}}@keyframes slc-edge-draw{0%{stroke-dashoffset:1px;opacity:0}to{stroke-dashoffset:0;opacity:1}}@keyframes slc-pulse{0%,to{filter:drop-shadow(0 0 1px #22c55e8c)}50%{filter:drop-shadow(0 0 6px #22c55ef2)}}.slc-node-enter{transform-box:fill-box;transform-origin:50%;animation:.22s ease-out both slc-node-in}.slc-node-exit-group{transform-box:fill-box;transform-origin:50%;pointer-events:none;animation:.2s ease-in forwards slc-node-out}.slc-edge-enter{stroke-dasharray:1;animation:.26s ease-out both slc-edge-draw}.slc-node--active{stroke:var(--slc-active);animation:1.2s ease-in-out infinite slc-pulse}@media (prefers-reduced-motion:reduce){.slc-node-enter,.slc-edge-enter{animation:none}.slc-node-exit-group{animation-duration:1ms}.slc-node--active{filter:drop-shadow(0 0 4px #22c55ed9);animation:none}}
@@ -0,0 +1,10 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63052,e=>{"use strict";let t,n,r,s;var i,a,o=e.i(14294),l=e.i(30878);function c(e){return JSON.parse(JSON.stringify(e))}function d(e,t){for(let n of e.states??[]){if(n.name===t)return e;let r=d(n,t);if(r)return r}return null}function h(e,t,n){let r=function e(t,n){if(t.name===n)return t;for(let r of t.states??[]){let t=e(r,n);if(t)return t}return null}(e,t);if(!r)throw Error(`applyPatchOps: ${n} references missing state "${t}"`);return r}function u(e,t,n){let r=function(e,t){for(let n of e.events){let e=n.events??[];for(let r=0;r<e.length;r++)if(e[r].id===t)return{source:n,event:e[r],index:r}}return null}(e,t);if(!r)throw Error(`applyPatchOps: ${n} references missing event "${t}"`);return r}function p(e,t){let n=c(e);for(let e of t)switch(e.op){case"settings.update":n.settings={...n.settings,...e.patch};break;case"state.add":{let t=null===e.parent?n.state:h(n.state,e.parent,"state.add");t.states||(t.states=[]);let r=e.index??t.states.length;t.states.splice(r,0,c(e.state));break}case"state.update":Object.assign(h(n.state,e.name,"state.update"),e.patch);break;case"state.remove":{if(n.state.name===e.name)throw Error(`applyPatchOps: cannot remove root state "${e.name}"`);let t=d(n.state,e.name);if(!t||!t.states)throw Error(`applyPatchOps: state.remove references missing state "${e.name}"`);let r=t.states.findIndex(t=>t.name===e.name);if(r<0)throw Error(`applyPatchOps: state.remove references missing state "${e.name}"`);t.states.splice(r,1),0===t.states.length&&delete t.states;break}case"state.nest":{let t=h(n.state,e.child,"state.nest"),r=h(n.state,e.newParent,"state.nest"),s=d(n.state,e.child);if(!s||!s.states)throw Error(`applyPatchOps: state.nest cannot detach root or missing state "${e.child}"`);let i=s.states.findIndex(t=>t.name===e.child),[a]=s.states.splice(i,1);0===s.states.length&&delete s.states,r.states||(r.states=[]),r.states.push(a??c(t));break}case"eventSource.add":{let t=e.index??n.events.length;n.events.splice(t,0,c(e.source));break}case"eventSource.update":{let t=n.events[e.index];if(!t)throw Error(`applyPatchOps: eventSource.update index ${e.index} out of range`);n.events[e.index]={...t,...e.patch};break}case"eventSource.remove":if(!n.events[e.index])throw Error(`applyPatchOps: eventSource.remove index ${e.index} out of range`);n.events.splice(e.index,1);break;case"event.add":{let t=n.events[e.sourceIndex];if(!t)throw Error(`applyPatchOps: event.add sourceIndex ${e.sourceIndex} out of range`);t.events||(t.events=[]);let r=e.index??t.events.length;t.events.splice(r,0,c(e.event));break}case"event.update":Object.assign(u(n,e.id,"event.update").event,e.patch);break;case"event.remove":{let t=u(n,e.id,"event.remove");t.source.events.splice(t.index,1),0===t.source.events.length&&delete t.source.events;break}case"parameter.add":{let t=u(n,e.eventId,"parameter.add");t.event.parameters||(t.event.parameters=[]);let r=e.index??t.event.parameters.length;t.event.parameters.splice(r,0,c(e.parameter));break}case"parameter.update":{let t=u(n,e.eventId,"parameter.update").event.parameters??[];if(!t[e.index])throw Error(`applyPatchOps: parameter.update index ${e.index} out of range for event "${e.eventId}"`);t[e.index]={...t[e.index],...e.patch};break}case"parameter.remove":{let t=u(n,e.eventId,"parameter.remove"),r=t.event.parameters;if(!r||!r[e.index])throw Error(`applyPatchOps: parameter.remove index ${e.index} out of range for event "${e.eventId}"`);r.splice(e.index,1),0===r.length&&delete t.event.parameters;break}case"transition.add":{let t=h(n.state,e.state,"transition.add");t.transitions||(t.transitions=[]);let r=e.index??t.transitions.length;t.transitions.splice(r,0,c(e.transition));break}case"transition.update":{let t=h(n.state,e.state,"transition.update").transitions??[];if(!t[e.index])throw Error(`applyPatchOps: transition.update index ${e.index} out of range for state "${e.state}"`);t[e.index]={...t[e.index],...e.patch};break}case"transition.remove":{let t=h(n.state,e.state,"transition.remove"),r=t.transitions;if(!r||!r[e.index])throw Error(`applyPatchOps: transition.remove index ${e.index} out of range for state "${e.state}"`);r.splice(e.index,1),0===r.length&&delete t.transitions;break}case"action.add":{let t=h(n.state,e.state,"action.add"),r=t[e.hook]??(t[e.hook]={actions:[]}),s=e.index??r.actions.length;r.actions.splice(s,0,c(e.action));break}case"action.update":{let t=h(n.state,e.state,"action.update")[e.hook];if(!t||!t.actions[e.index])throw Error(`applyPatchOps: action.update index ${e.index} out of range for state "${e.state}" ${e.hook}`);t.actions[e.index]=c(e.action);break}case"action.remove":{let t=h(n.state,e.state,"action.remove"),r=t[e.hook];if(!r||!r.actions[e.index])throw Error(`applyPatchOps: action.remove index ${e.index} out of range for state "${e.state}" ${e.hook}`);r.actions.splice(e.index,1),0===r.actions.length&&delete t[e.hook];break}case"runtime.enter":case"runtime.exit":break;default:throw Error(`applyPatchOps: unknown op ${JSON.stringify(e)}`)}return n}function f(e){let t=[e];for(let n of e.states??[])t.push(...f(n));return t}function m(e){let t=new Map;t.set(e.name,null);let n=e=>{for(let r of e.states??[])t.set(r.name,e.name),n(r)};return n(e),t}function g(e,t){return JSON.stringify(e)===JSON.stringify(t)}function x(e,t,n,r,s){let i=Math.min(n.length,r.length);for(let a=0;a<i;a++)g(n[a],r[a])||s.push({op:"action.update",state:e,hook:t,index:a,action:r[a]});for(let n=i;n<r.length;n++)s.push({op:"action.add",state:e,hook:t,action:r[n],index:n});for(let i=n.length-1;i>=r.length;i--)s.push({op:"action.remove",state:e,hook:t,index:i})}function y(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(t,31)+e.charCodeAt(n)|0;let n=(t%360+360)%360;return`hsl(${n}, 65%, 55%)`}var b=e.i(50382);let v={hSpacing:220,vSpacing:140,nodeWidth:160,nodeHeight:60,compositeWidth:300,compositeHeight:200,originX:100,originY:120,sweeps:2,includeRoot:!0},w=(e,t)=>`${e}\u0000${t}`;function k(e){let t=new Set,n=[];for(let r of e.states??[])t.has(r.name)||(t.add(r.name),n.push(r));return n}function j(e,t){let n=new Map(e.map(e=>[e,[]]));for(let e of t)n.get(e.from).push(e.to);return n}function N(e,t={}){let n={...v,...t},r="state"in e?e.state:e,s={};if(!r)return s;if(!function e(t,n,r,s,i){let a=k(t);if(0===a.length)return;let o=a.map(e=>e.name),l=new Map(a.map(e=>[e.name,e])),c=function(e){let t=new Set(e.map(e=>e.name)),n=new Set,r=[];for(let s of e)for(let e of s.transitions??[]){let i=e.nextState;if(!i||i===s.name||!t.has(i))continue;let a=w(s.name,i);n.has(a)||(n.add(a),r.push({from:s.name,to:i}))}return r}(a),d=function(e,t){let n=j(e,t),r=new Map(e.map(e=>[e,0])),s=new Set;for(let t of e){if(0!==r.get(t))continue;r.set(t,1);let e=[{node:t,i:0}];for(;e.length>0;){let t=e[e.length-1],i=n.get(t.node);if(t.i<i.length){let n=i[t.i++],a=r.get(n);1===a?s.add(w(t.node,n)):0===a&&(r.set(n,1),e.push({node:n,i:0}))}else r.set(t.node,2),e.pop()}}return s}(o,c),h=c.filter(e=>!d.has(w(e.from,e.to))),u=function(e,t){let n=j(e,t),r=new Map(e.map(e=>[e,0]));for(let e of t)r.set(e.to,(r.get(e.to)??0)+1);let s=new Map(e.map(e=>[e,0])),i=e.filter(e=>0===r.get(e));for(let e=0;e<i.length;e++){let t=i[e];for(let e of n.get(t)){s.set(e,Math.max(s.get(e),s.get(t)+1));let n=r.get(e)-1;r.set(e,n),0===n&&i.push(e)}}return s}(o,h),p=function(e,t,n){let r=new Map(e.map(e=>[e,[]]));for(let e of t)r.get(e.from).push(e.to),r.get(e.to).push(e.from);let s=new Set([n]),i=[n];for(;i.length>0;){let e=i.pop();for(let t of r.get(e)??[])s.has(t)||(s.add(t),i.push(t))}return s}(o,c,o[0]),f=0;for(let e of o)p.has(e)&&(f=Math.max(f,u.get(e)));for(let e of o)p.has(e)||u.set(e,u.get(e)+f+1);let m=Array.from({length:Math.max(...o.map(e=>u.get(e)))+1},()=>[]);for(let e of o)m[u.get(e)].push(e);!function(e,t,n){let r=new Map,s=new Map,i=(e,t,n)=>{let r=e.get(t);r?r.push(n):e.set(t,[n])};for(let e of t)i(r,e.to,e.from),i(s,e.from,e.to);let a=new Map,o=()=>{e.forEach(e=>e.forEach((e,t)=>a.set(e,t)))};o();let l=(e,t)=>{let n=e.map((e,n)=>{let r=(t.get(e)??[]).filter(e=>a.has(e));return{name:e,key:r.length?r.reduce((e,t)=>e+a.get(t),0)/r.length:n,i:n}});n.sort((e,t)=>e.key===t.key?e.i-t.i:e.key-t.key);for(let t=0;t<n.length;t++)e[t]=n[t].name};for(let t=0;t<n;t++){for(let t=1;t<e.length;t++)l(e[t],r),o();for(let t=e.length-2;t>=0;t--)l(e[t],s),o()}}(m,h,s.sweeps);let g=s.hSpacing-s.nodeWidth,x=s.vSpacing-s.nodeHeight,y=e=>Math.max(s.hSpacing,e+g),b=new Map(o.map(e=>{var t;return[e,(t=l.get(e),(t.states?.length??0)>0?{width:s.compositeWidth,height:s.compositeHeight}:{width:s.nodeWidth,height:s.nodeHeight})]})),v=m.map(e=>e.reduce((e,t)=>e+y(b.get(t).width),0)),N=n+Math.max(...v,0)/2,S=r;for(let t of(m.forEach((e,t)=>{let n=N-v[t]/2,r=s.nodeHeight;for(let t of e){let e=b.get(t),s=y(e.width);i[t]={x:Math.round(n+(s-e.width)/2),y:Math.round(S),width:e.width,height:e.height},n+=s,r=Math.max(r,e.height)}S+=r+x}),a)){if((t.states?.length??0)===0)continue;let n=i[t.name];e(t,n.x+20,n.y+40,s,i)}}(r,n.originX,n.originY,n,s),n.includeRoot){let e=k(r).map(e=>s[e.name]).filter(Boolean);if(0===e.length)s[r.name]={x:20,y:20,width:400,height:350};else{let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),i=Math.max(...e.map(e=>e.x+e.width)),a=Math.max(...e.map(e=>e.y+e.height));s[r.name]={x:Math.round(t-40),y:Math.round(n-40),width:Math.round(i-t+80),height:Math.round(a-n+80)}}}return s}let S=(e,t)=>e.length*t*.55,_=e=>`[${e.length>32?`${e.slice(0,31).trimEnd()}…`:e}]`,C=e=>({width:Math.max(56,Math.max(S(e.event,11),e.condition?S(_(e.condition),9):0)+16)+16*!!e.glyph,height:e.condition?28:18}),E=e=>({x:e.x+5,y:e.cy-12-3}),R=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height,O={along:[.5,.36,.64,.24,.76,.14,.86],aside:[0,.6,-.6],across:[0,-1.3,1.3,-2.6,2.6]},M=(e,t,n=2.2,r)=>({id:e,paths:t,strokeWidth:n,circles:r}),A=M("signal",["M3 12h10","m13 6 6 6-6 6Z"]),T=[{glyph:M("confirm",["m4 13 5.5 5.5L20 6"],2.4),words:["confirm","approve","accept","commit"]},{glyph:M("complete",["m8 12 3 3 5-6"],2.2,[{cx:12,cy:12,r:8.5}]),words:["complete","finish","done","close"]},{glyph:M("skip",["M4 17c0-6 4.5-9 9-9h6","m15 4 4.5 4-4.5 4"]),words:["skip","ignore","bypass"]},{glyph:M("flag",["M6 21V4","M6 4h12l-3 4.5 3 4.5H6Z"]),words:["flag","mark","revisit","review"]},{glyph:M("advance",["M4 6l8 6-8 6Z","M13 6l7 6-7 6Z"]),words:["advance","next","forward","step"]},{glyph:M("pause",["M9 5v14M15 5v14"],2.6),words:["pause","hold","suspend","stop"]},{glyph:M("play",["M7 4.5 19 12 7 19.5Z"]),words:["resume","start","begin","play","run"]},{glyph:M("clock",["M12 7.5V12l3.5 2.5"],2.2,[{cx:12,cy:12,r:8.5}]),words:["timeout","expire","tick","delay","after","elapse"]},{glyph:M("change",["M3 14c3-6 6-6 9 0s6 6 9 0"]),words:["change","update","edit","modify","set"]}];[...T.map(e=>e.glyph)];let $=e=>Math.round(100*e)/100;function P(e,t,n,r){return{p0:e,p1:t,p2:n,p3:r,path:`M ${$(e.x)} ${$(e.y)} C ${$(t.x)} ${$(t.y)}, ${$(n.x)} ${$(n.y)}, ${$(r.x)} ${$(r.y)}`,at:s=>{let i=1-s,a=i*i*i,o=3*i*i*s,l=3*i*s*s,c=s*s*s;return{x:a*e.x+o*t.x+l*n.x+c*r.x,y:a*e.y+o*t.y+l*n.y+c*r.y}}}}let I={min:.2,max:2.5},L={x:0,y:0,scale:1};function B(e,t=I){return Number.isFinite(e)?Math.min(t.max,Math.max(t.min,e)):1}function D(e,t,n){return{x:e.x+t,y:e.y+n,scale:e.scale}}function F(e,t,n,r=I){return q(e,e.scale*t,n,r)}function q(e,t,n,r=I){let s=B(t,r);if(s===e.scale)return e;let i={x:(n.x-e.x)/e.scale,y:(n.y-e.y)/e.scale};return{x:n.x-i.x*s,y:n.y-i.y*s,scale:s}}function U(e){let t=new Set,n=[];for(let r of e.states??[])t.has(r.name)||(t.add(r.name),n.push(r));return n}function H(e){return e.trim().replace(/[\s_]+/g,"-").replace(/[^A-Za-z0-9.-]/g,"").replace(/-{2,}/g,"-").replace(/^[-.]+|[-.]+$/g,"").slice(0,60)}function J(e){return e.parallel?e.parallel.states:e.states??[]}function Y(e,t){return J(e).find(e=>e.name===t)??null}let V={surface:"--slc-surface",nodeFill:"--slc-node-fill",nodeStroke:"--slc-node-stroke",compositeFill:"--slc-composite-fill",finalFill:"--slc-final-fill",accent:"--slc-accent",accentFill:"--slc-accent-fill",accentInk:"--slc-accent-ink",danger:"--slc-danger",drawSource:"--slc-draw-source",edge:"--slc-edge",chipFill:"--slc-chip-fill",chipStroke:"--slc-chip-stroke",label:"--slc-label",muted:"--slc-muted",faint:"--slc-faint",entry:"--slc-entry",exit:"--slc-exit",composite:"--slc-composite",active:"--slc-active",panelBg:"--slc-panel-bg",panelBorder:"--slc-panel-border",panelHover:"--slc-panel-hover"},X={x:100,y:100,width:160,height:60};function z(e,t){return 1===t?16*e:2===t?400*e:e}function W(e){return!!e&&"string"==typeof e.tagName&&(!!e.isContentEditable||["INPUT","TEXTAREA","SELECT","BUTTON","OPTION"].includes(e.tagName))}function K(e){return(e.states?.length??0)>0||(e.parallel?.states.length??0)>0}function G({mark:e,x:t,y:n,selected:r}){return(0,o.jsxs)("g",{transform:`translate(${t} ${n}) scale(0.5)`,strokeWidth:e.strokeWidth,className:`slc-glyph${r?" slc-glyph--selected":""}`,children:[(e.circles??[]).map((e,t)=>(0,o.jsx)("circle",{cx:e.cx,cy:e.cy,r:e.r,className:e.filled?"slc-glyph-dot":void 0},`c${t}`)),e.paths.map((e,t)=>(0,o.jsx)("path",{d:e},`p${t}`))]})}let Q={kind:null,id:null},Z=(0,l.forwardRef)(function(e,t){let{definition:n,positions:r,path:s=[],rootLabel:i,viewport:a,onViewportChange:c,selection:d=Q,activeStates:h,errorElements:u,drawMode:p="select",drawSource:f=null,readOnly:m=!1,showBreadcrumb:g=!0,showHud:x=!0,fitKey:y,onSelect:b,onClearSelection:v,onStateMove:w,onNavigateInto:k,onNavigateTo:j,onContextMenu:N,onCreateTransition:S,onCancelDraw:M,onDeleteState:$,onUndo:U,onRedo:H,hudExtras:Z,emptyHint:ee,theme:et,className:en,style:er,svgId:es,pinchOwner:ei="canvas"}=e,ea=(0,l.useRef)(null),eo=(0,l.useId)().replace(/:/g,""),el=(0,l.useRef)(a);el.current=a;let[ec,ed]=(0,l.useState)(null),eh=(0,l.useRef)(null),eu=(0,l.useCallback)(e=>{eh.current=e,ed(e)},[]),[ep,ef]=(0,l.useState)(null),em=(0,l.useRef)(!1),[eg,ex]=(0,l.useState)(!1),ey=(0,l.useRef)(null),[eb,ev]=(0,l.useState)(!1),ew=(0,l.useRef)(!1),ek=(0,l.useRef)(new Map),ej=(0,l.useRef)(new Map),eN=(0,l.useRef)(null),[eS,e_]=(0,l.useState)(!1),eC=(0,l.useRef)(null),eE=(0,l.useRef)(!1),[eR,eO]=(0,l.useState)(!1),eM=n.state,eA=(0,l.useMemo)(()=>{let e=function(e,t){let n=[],r=e;for(let e of t){let t=Y(r,e);if(!t)break;n.push(e),r=t}return n}(eM,s);return[i??eM?.name??"Root",...e]},[eM,s,i]),eT=(0,l.useMemo)(()=>eM?J(function(e,t){let n=e;for(let e of t){let t=Y(n,e);if(!t)break;n=t}return n}(eM,s)):[],[eM,s]),e$=eA[eA.length-1],eP=(0,l.useMemo)(()=>(function(e){let t=new Set,n=[];for(let r of e.events??[])for(let e of r.events??[])t.has(e.id)||(t.add(e.id),n.push(e.id));return n})(n),[n]),eI=(0,l.useMemo)(()=>new Set(h??[]),[h]),eL=(0,l.useMemo)(()=>new Set(u??[]),[u]),eB=(0,l.useCallback)((e,t)=>{let n=ea.current?.getBoundingClientRect();return{x:e-(n?.left??0),y:t-(n?.top??0)}},[]),eD=(0,l.useCallback)(e=>{let t=ek.current.get(e);ek.current.delete(e),t?.hasPointerCapture?.(e)&&t.releasePointerCapture?.(e)},[]),eF=(0,l.useCallback)(e=>{let t=eC.current;t&&(void 0===e||t.pointerId===e)&&(clearTimeout(t.timer),eC.current=null)},[]),eq=(0,l.useCallback)((e,t)=>{if("touch"!==e.pointerType||!N)return;eF();let{pointerId:n,clientX:r,clientY:s}=e,i=setTimeout(()=>{eC.current=null,eu(null),ey.current=null,ev(!1),eE.current=!0,navigator.vibrate?.(10),N(r,s,t)},500);eC.current={pointerId:n,x:r,y:s,target:t,timer:i}},[eF,N,eu]);(0,l.useEffect)(()=>{if(!window.matchMedia)return;let e=window.matchMedia("(pointer: coarse)"),t=()=>eO(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,l.useEffect)(()=>{let e=e=>{ej.current.delete(e.pointerId)};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[]),(0,l.useEffect)(()=>()=>eF(),[eF]);let eU=(0,l.useRef)(new Set),eH=(0,l.useRef)(new Map),eJ=(0,l.useRef)(e$),eY=(0,l.useRef)(new Set),[eV,eX]=(0,l.useState)(new Set),[ez,eW]=(0,l.useState)(new Set),[eK,eG]=(0,l.useState)(new Map),eQ=eR?10/a.scale:0,eZ=eR?28/a.scale:0,e0=(0,l.useCallback)(e=>r[e]??X,[r]);(0,l.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&"z"===e.key&&U&&(e.preventDefault(),U()),(e.ctrlKey||e.metaKey)&&("y"===e.key||e.shiftKey&&"z"===e.key)&&H&&(e.preventDefault(),H()),"Escape"===e.key&&(ef(null),M?.()),"Delete"===e.key&&"state"===d.kind&&d.id&&$&&$(d.id)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[U,H,M,$,d]);let e1=(0,l.useCallback)(e=>{let t=el.current;ey.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,origX:t.x,origY:t.y},ew.current=!1,ev(!0);let n=ea.current;n&&(ek.current.set(e.pointerId,n),n.setPointerCapture(e.pointerId))},[]),e2=(0,l.useCallback)(()=>{let e=[...ej.current.entries()];if(e.length<2)return;let[[t,n],[r,s]]=e;eF(),eu(null),ey.current=null;let i=Math.max(1,Math.hypot(s.x-n.x,s.y-n.y)),a=eB((n.x+s.x)/2,(n.y+s.y)/2);eN.current={a:t,b:r,startDist:i,startMidX:a.x,startMidY:a.y,start:el.current},ew.current=!0,e_(!0);let o=ea.current;if(o){for(let e of[t,r])if(!ek.current.has(e))try{o.setPointerCapture(e),ek.current.set(e,o)}catch{}}},[eF,eB,eu]),e5=(0,l.useCallback)(e=>{if(eE.current=!1,"touch"!==e.pointerType)return;eO(!0),ej.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=ej.current.size;t<2||(e.stopPropagation(),2===t&&e2())},[e2]),e4=(0,l.useCallback)((e,t)=>{if(0!==e.button||em.current)return;if(e.stopPropagation(),eq(e,{kind:"state",id:t}),!m&&"transition"===p)return void(f?f!==t&&ef({stateName:f,targetName:t,x:e.clientX,y:e.clientY}):b?.("state",t));if(b?.("state",t),m||!w)return;let n=e0(t);eu({name:t,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,origX:n.x,origY:n.y});let r=e.currentTarget;ek.current.set(e.pointerId,r),r.setPointerCapture?.(e.pointerId)},[b,e0,p,f,eq,eu,m,w]),e3=(0,l.useCallback)(e=>{if("touch"===e.pointerType){eq(e,{kind:"canvas"}),e1(e);return}(1===e.button||0===e.button&&em.current)&&(e.preventDefault(),e1(e))},[eq,e1]),e6=(0,l.useCallback)(e=>{ej.current.has(e.pointerId)&&ej.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=eC.current;t&&t.pointerId===e.pointerId&&Math.hypot(e.clientX-t.x,e.clientY-t.y)>8&&eF(e.pointerId);let n=eN.current;if(n){if(e.pointerId!==n.a&&e.pointerId!==n.b)return;let t=ej.current.get(n.a),r=ej.current.get(n.b);if(!t||!r)return;let s=Math.hypot(r.x-t.x,r.y-t.y),i=eB((t.x+r.x)/2,(t.y+r.y)/2);c(D(q(n.start,n.start.scale*(s/n.startDist),{x:n.startMidX,y:n.startMidY}),i.x-n.startMidX,i.y-n.startMidY));return}let r=ey.current;if(r){if(r.pointerId!==e.pointerId)return;let t=e.clientX-r.startX,n=e.clientY-r.startY,s=8*("touch"===e.pointerType);(Math.abs(t)>s||Math.abs(n)>s)&&(ew.current=!0),c({x:r.origX+t,y:r.origY+n,scale:el.current.scale});return}if(!ec||ec.pointerId!==e.pointerId||!w)return;let s=el.current.scale,i=(e.clientX-ec.startX)/s,a=(e.clientY-ec.startY)/s,o=e0(ec.name);w(ec.name,{...o,x:Math.max(0,ec.origX+i),y:Math.max(0,ec.origY+a)})},[ec,e0,w,c,eF,eB]),e8=(0,l.useCallback)(e=>{ej.current.delete(e.pointerId),eF(e.pointerId),eD(e.pointerId);let t=eN.current;if(t&&(t.a===e.pointerId||t.b===e.pointerId)){eN.current=null,e_(!1);let n=t.a===e.pointerId?t.b:t.a,r=ej.current.get(n);if(r){let e=el.current;ey.current={pointerId:n,startX:r.x,startY:r.y,origX:e.x,origY:e.y},ew.current=!0,ev(!0)}}ey.current?.pointerId===e.pointerId&&(ey.current=null),eh.current?.pointerId===e.pointerId&&eu(null),ey.current||ev(!1),eN.current||e_(!1)},[eF,eD,eu]);(0,l.useEffect)(()=>{let e=ea.current;if(!e)return;let t=e=>{e.preventDefault();let t=el.current,n=z(e.deltaX,e.deltaMode),r=z(e.deltaY,e.deltaMode);if(e.ctrlKey||e.metaKey){let n=F(t,Math.exp(-(.0025*r)),eB(e.clientX,e.clientY));n!==t&&c(n);return}let s=e.shiftKey?-(n||r):-n,i=e.shiftKey?0:-r;(0!==s||0!==i)&&c(D(t,s,i))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[c,eB]),(0,l.useEffect)(()=>{let e=e=>{"Space"!==e.code||e.repeat||W(e.target)||W(document.activeElement)||(e.preventDefault(),em.current=!0,ex(!0))},t=e=>{"Space"===e.code&&(em.current=!1,ex(!1))},n=()=>{em.current=!1,ex(!1)};return window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("blur",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("blur",n)}},[]);let e7=(0,l.useCallback)(e=>{let t=ea.current?.getBoundingClientRect(),n={x:(t?.width??0)/2,y:(t?.height??0)/2},r=el.current,s=F(r,e,n);s!==r&&c(s)},[c]),e9=(0,l.useCallback)(()=>{let e=ea.current?.getBoundingClientRect(),t={x:(e?.width??0)/2,y:(e?.height??0)/2};c(q(el.current,1,t))},[c]),te=(0,l.useCallback)(()=>{let e=ea.current?.getBoundingClientRect();if(!e)return;let t=eT.map(e=>e0(e.name));c(t.length?function(e,t,n,r={}){let s=r.padding??48,i=r.maxScale??1,a=r.limits??I;if(0===e.length||t<=0||n<=0)return{...L};let o=1/0,l=1/0,c=-1/0,d=-1/0;for(let t of e)o=Math.min(o,t.x),l=Math.min(l,t.y),c=Math.max(c,t.x+t.width),d=Math.max(d,t.y+t.height);let h=Math.max(1,c-o),u=Math.max(1,d-l),p=B(Math.min(i,Math.min(Math.max(1,t-2*s)/h,Math.max(1,n-2*s)/u)),a);return{x:(t-h*p)/2-o*p,y:(n-u*p)/2-l*p,scale:p}}(t,e.width,e.height):{...L})},[eT,e0,c]);(0,l.useImperativeHandle)(t,()=>({fit:te,zoomIn:()=>e7(1.25),zoomOut:()=>e7(.8),resetZoom:e9,element:()=>ea.current}),[te,e7,e9]);let tt=(0,l.useRef)(te);tt.current=te,(0,l.useEffect)(()=>{if(void 0===y)return;let e=requestAnimationFrame(()=>tt.current());return()=>cancelAnimationFrame(e)},[y]);let tn=(0,l.useCallback)((e,t)=>{N&&(e.preventDefault(),e.stopPropagation(),N(e.clientX,e.clientY,t?{kind:"state",id:t}:{kind:"canvas"}))},[N]),tr=(0,l.useMemo)(()=>{let e=new Set(eT.map(e=>e.name)),t=[];for(let n of eT)for(let[r,s]of(n.transitions??[]).entries())s.nextState&&e.has(s.nextState)&&t.push({from:n.name,to:s.nextState,event:s.event,stateName:n.name,index:r,condition:s.condition});return t},[eT]),ts=(0,l.useMemo)(()=>{let e=function(e,t){let n=e.map(({from:e,to:n})=>{var r,s;return e===n?null:(r=t(e),(s=t(n)).y>=r.y+r.height?["bottom","top"]:s.y+s.height<=r.y?["top","bottom"]:s.x>=r.x+r.width?["right","left"]:s.x+s.width<=r.x?["left","right"]:["bottom","top"])}),r=new Map,s=(e,t,n)=>{let s=`${e}\0${t}`,i=r.get(s);i?i.push(n):r.set(s,[n])},i=(e,t)=>"top"===t||"bottom"===t?e.x+e.width/2:e.y+e.height/2;e.forEach((e,r)=>{let a=n[r];if(!a)return;let[o,l]=a;s(e.from,o,{edge:r,toward:i(t(e.to),o),role:"out"}),s(e.to,l,{edge:r,toward:i(t(e.from),l),role:"in"})});let a=new Map;for(let[e,n]of r){let[r,s]=e.split("\0"),i=t(r),o=[...n].sort((e,t)=>e.toward===t.toward?e.edge-t.edge:e.toward-t.toward);o.forEach((e,t)=>{a.set(`${e.edge}\0${e.role}`,function(e,t,n,r){let s="top"===t||"bottom"===t,i=s?e.width:e.height,a=s?e.x+e.width/2:e.y+e.height/2,o=r>1?Math.min(.72*i,40*(r-1)):0,l=r>1?a-o/2+o*n/(r-1):a;return"top"===t?{x:l,y:e.y}:"bottom"===t?{x:l,y:e.y+e.height}:"left"===t?{x:e.x,y:l}:{x:e.x+e.width,y:l}}(i,s,t,o.length))})}return e.map((e,r)=>{let s=n[r];if(!s){var i;let n,r,s;return n=(i=t(e.from)).x+i.width,r=i.y+.35*i.height,P({x:n,y:r},{x:n+44,y:r-12},{x:n+44,y:(s=i.y+.65*i.height)+12},{x:n,y:s})}let o=a.get(`${r}\0out`),l=a.get(`${r}\0in`);var c=s[0];if("top"===c||"bottom"===c){let e=(o.y+l.y)/2;return P(o,{x:o.x,y:e},{x:l.x,y:e},l)}let d=(o.x+l.x)/2;return P(o,{x:d,y:o.y},{x:d,y:l.y},l)})}(tr,e0),t=new Map((function(e,t,n={}){let{along:r,aside:s,across:i}={...O,...n},a=e.map((e,t)=>({label:e,i:t,width:C(e).width})).sort((e,t)=>e.width===t.width?e.i-t.i:t.width-e.width),o=[];for(let{label:e}of a){let{width:n,height:a}=C(e),l=8*!!e.glyph,c=null,d=1/0;e:for(let h of i)for(let i of s)for(let s of r){let r=e.at(s),u=r.x+i*n,p=r.y+h*a,f={x:u-n/2,y:p-18,width:n,height:a},m=[...o,...t].filter(e=>R(f,e)).length,g={...f,cx:u+l,cy:p,label:e};if(0===m){c=g;break e}m<d&&(d=m,c=g)}c&&o.push(c)}return o})(tr.map((t,n)=>{let r=e0(t.from);return{id:`${t.stateName}:${t.index}`,event:t.event,condition:t.condition,glyph:!0,at:t.from===t.to?()=>({x:r.x+r.width+44+30,y:r.y+r.height/2+4}):e[n].at}}),eT.map(e=>e0(e.name))).map(e=>[e.label.id,e]));return tr.flatMap((n,r)=>{let s=`${n.stateName}:${n.index}`,i=t.get(s);return i?[{arrow:n,id:s,curve:e[r],spot:i}]:[]})},[tr,eT,e0]);(0,l.useEffect)(()=>{let e=new Set(eT.map(e=>e.name)),t=new Set(tr.map(e=>`${e.stateName}:${e.index}`)),n=eJ.current===e$,r=[...e].filter(e=>!eU.current.has(e));r.length&&eX(e=>{let t=new Set(e);return r.forEach(e=>t.add(e)),t});let s=[...t].filter(e=>!eY.current.has(e));s.length&&eW(e=>{let t=new Set(e);return s.forEach(e=>t.add(e)),t}),eX(t=>{let n=!1,r=new Set(t);return t.forEach(t=>{e.has(t)||(r.delete(t),n=!0)}),n?r:t}),eW(e=>{let n=!1,r=new Set(e);return e.forEach(e=>{t.has(e)||(r.delete(e),n=!0)}),n?r:e}),n?eG(t=>{let n=new Map(t),r=!1;return eH.current.forEach((t,s)=>{e.has(s)||n.has(s)||(n.set(s,t),r=!0)}),e.forEach(e=>{n.delete(e)&&(r=!0)}),r?n:t}):eG(e=>e.size?new Map:e),eU.current=e,eH.current=new Map(eT.map(e=>[e.name,{state:e,pos:e0(e.name)}])),eY.current=t,eJ.current=e$},[eT,e$,tr,e0]);let ti={...function(e){let t={};if(!e)return t;for(let[n,r]of Object.entries(e)){let e=V[n];e&&"string"==typeof r&&(t[e]=r)}return t}(et),...er},ta=eR?" slc-hud--coarse":"";return(0,o.jsxs)("div",{className:`slc-pane${en?` ${en}`:""}`,style:ti,"data-pinch-owner":ei,children:[g&&eA.length>1&&(0,o.jsx)("div",{className:"slc-crumbs",children:eA.map((e,t)=>(0,o.jsxs)("span",{className:"slc-crumb-item",children:[t>0&&(0,o.jsx)("span",{className:"slc-crumb-sep",children:"›"}),(0,o.jsx)("button",{type:"button",className:`slc-crumb${t===eA.length-1?" slc-crumb--current":""}`,onClick:()=>j?.(t),children:e})]},`${e}-${t}`))}),(0,o.jsxs)("svg",{ref:ea,id:es,className:"slc-surface",style:{cursor:eb?"grabbing":eg?"grab":void 0,touchAction:"none",...eR?{WebkitUserSelect:"none",userSelect:"none",WebkitTouchCallout:"none"}:{}},onPointerDownCapture:e5,onPointerDown:e3,onPointerMove:e6,onPointerUp:e8,onPointerCancel:e8,onAuxClick:e=>e.preventDefault(),onClick:e=>{if(eE.current){eE.current=!1,e.stopPropagation();return}if(ew.current){ew.current=!1;return}e.target?.tagName==="svg"&&(v?.(),ef(null))},onContextMenu:e=>tn(e),children:[(0,o.jsxs)("defs",{children:[(0,o.jsx)("marker",{id:`slc-arrow-${eo}`,markerWidth:"10",markerHeight:"7",refX:"10",refY:"3.5",orient:"auto",children:(0,o.jsx)("polygon",{points:"0 0, 10 3.5, 0 7",className:"slc-arrowhead"})}),(0,o.jsx)("marker",{id:`slc-arrow-sel-${eo}`,markerWidth:"10",markerHeight:"7",refX:"10",refY:"3.5",orient:"auto",children:(0,o.jsx)("polygon",{points:"0 0, 10 3.5, 0 7",className:"slc-arrowhead slc-arrowhead--selected"})})]}),"transition"===p&&f&&(0,o.jsxs)("text",{x:"50%",y:"30",textAnchor:"middle",className:"slc-draw-hint",children:['Click target state to create transition from "',f,'"']}),(0,o.jsxs)("g",{transform:`translate(${a.x} ${a.y}) scale(${a.scale})`,style:eb||eS?{pointerEvents:"none"}:void 0,children:[ts.map(({arrow:e,id:t,curve:n,spot:r})=>{let s="transition"===d.kind&&d.id===t,i=ez.has(t),a=n.at(.5),l=Math.hypot(a.x-r.cx,a.y-r.cy)>4;return(0,o.jsxs)("g",{children:[eR&&(0,o.jsx)("path",{d:n.path,fill:"none",stroke:"transparent",strokeWidth:eZ,strokeLinecap:"round",pointerEvents:"stroke",onClick:e=>{e.stopPropagation(),b?.("transition",t)}}),(0,o.jsx)("path",{d:n.path,pathLength:1,markerEnd:`url(#slc-arrow${s?"-sel":""}-${eo})`,className:`slc-edge${s?" slc-edge--selected":""}${i?" slc-edge-enter":""}`,onClick:e=>{e.stopPropagation(),b?.("transition",t)}}),(0,o.jsxs)("g",{className:"slc-chip",onClick:e=>{e.stopPropagation(),b?.("transition",t)},children:[l&&(0,o.jsx)("line",{x1:a.x,y1:a.y,x2:r.cx,y2:r.cy-5,className:`slc-chip-leader${s?" slc-chip-leader--selected":""}`}),eR&&(0,o.jsx)("rect",{x:r.x-eQ,y:r.y-eQ,width:r.width+2*eQ,height:r.height+2*eQ,fill:"transparent",pointerEvents:"all"}),(0,o.jsx)("rect",{x:r.x,y:r.y,width:r.width,height:r.height,rx:4,className:`slc-chip-plate${s?" slc-chip-plate--selected":""}`}),(0,o.jsx)(G,{mark:function(e){let t=e.toLowerCase();for(let{glyph:e,words:n}of T)if(n.some(e=>t.includes(e)))return e;return A}(e.event),x:E(r).x,y:E(r).y,selected:s}),(0,o.jsx)("text",{x:r.cx,y:r.cy-5,textAnchor:"middle",className:`slc-chip-text${s?" slc-chip-text--selected":""}`,children:e.event}),e.condition&&(0,o.jsxs)("text",{x:r.cx,y:r.cy+7,textAnchor:"middle",className:"slc-chip-guard",children:[(0,o.jsx)("title",{children:e.condition}),_(e.condition)]})]})]},`arrow-${t}`)}),eT.map(e=>{let t=e0(e.name),n="state"===d.kind&&d.id===e.name,r="final"===e.kind,s="history"===e.kind,i=K(e),a=f===e.name,l=eL.has(e.name),c=(e.onEntry?.actions?.length??0)>0,h=(e.onExit?.actions?.length??0)>0,u=eI.has(e.name),g=eV.has(e.name),x=eg?void 0:"transition"!==p||m?i?"slc-node--drillable":m||!w?"slc-node--static":"slc-node--draggable":"slc-node--drawing";return(0,o.jsxs)("g",{className:x,onPointerDown:t=>e4(t,e.name),onDoubleClick:t=>{t.stopPropagation(),i&&k?.(e.name)},onContextMenu:t=>tn(t,e.name),children:[eR&&(0,o.jsx)("rect",{x:t.x-eQ,y:t.y-eQ,width:t.width+2*eQ,height:t.height+2*eQ,rx:12,fill:"transparent",pointerEvents:"all"}),(0,o.jsxs)("g",{className:g?"slc-node-enter":void 0,children:[(0,o.jsx)("rect",{x:t.x,y:t.y,width:t.width,height:t.height,rx:s?30:r?4:8,strokeDasharray:r?"6 3":i?"4 2":void 0,className:["slc-node",r?"slc-node--final":i?"slc-node--composite":"",a?"slc-node--source":"",l?"slc-node--error":"",n?"slc-node--selected":"",u?"slc-node--active":""].filter(Boolean).join(" ")}),(0,o.jsx)("text",{x:t.x+t.width/2,y:t.y+(c||h?t.height/2:t.height/2+5),textAnchor:"middle",className:"slc-node-name",children:e.name}),e.kind&&"normal"!==e.kind&&(0,o.jsx)("text",{x:t.x+t.width-8,y:t.y+14,textAnchor:"end",className:"slc-node-kind",children:e.kind}),c&&(0,o.jsx)("text",{x:t.x+6,y:t.y+t.height-6,className:"slc-node-entry",children:"▸entry"}),h&&(0,o.jsx)("text",{x:t.x+t.width-6,y:t.y+t.height-6,textAnchor:"end",className:"slc-node-exit",children:"exit◂"}),l&&(0,o.jsx)("text",{x:t.x+6,y:t.y+14,className:"slc-node-warn",children:"⚠"}),i&&(0,o.jsxs)("text",{x:t.x+t.width/2,y:t.y+t.height-6,textAnchor:"middle",className:"slc-node-drill",children:["▼ ",(e.states?.length??0)+(e.parallel?.states.length??0)," children — ",eR?"double-tap":"double-click"," to enter"]})]})]},e.name)}),Array.from(eK.entries()).map(([e,{state:t,pos:n}])=>{let r="final"===t.kind,s=K(t);return(0,o.jsxs)("g",{className:"slc-node-exit-group",onAnimationEnd:t=>{"slc-node-out"===t.animationName&&eG(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},children:[(0,o.jsx)("rect",{x:n.x,y:n.y,width:n.width,height:n.height,rx:"history"===t.kind?30:r?4:8,strokeDasharray:r?"6 3":s?"4 2":void 0,className:`slc-node${r?" slc-node--final":s?" slc-node--composite":""}`}),(0,o.jsx)("text",{x:n.x+n.width/2,y:n.y+n.height/2+5,textAnchor:"middle",className:"slc-node-name",children:e})]},`exit-${e}`)})]}),0===eT.length&&(0,o.jsx)("text",{x:"50%",y:"50%",textAnchor:"middle",className:"slc-empty",children:ee??"This level has no states."})]}),x&&(0,o.jsxs)("div",{className:`slc-hud${ta}`,children:[(0,o.jsx)("button",{type:"button",className:"slc-hud-btn",title:"Zoom out (Ctrl + wheel down, or pinch in)",disabled:a.scale<=I.min,onClick:()=>e7(.8),children:"−"}),(0,o.jsxs)("button",{type:"button",className:"slc-hud-btn slc-hud-btn--scale",title:"Reset zoom to 100%",onClick:e9,children:[Math.round(100*a.scale),"%"]}),(0,o.jsx)("button",{type:"button",className:"slc-hud-btn",title:"Zoom in (Ctrl + wheel up, or pinch out)",disabled:a.scale>=I.max,onClick:()=>e7(1.25),children:"+"}),(0,o.jsx)("span",{className:"slc-hud-sep",children:"|"}),(0,o.jsx)("button",{type:"button",className:"slc-hud-btn",title:"Fit the whole machine in view",onClick:te,children:"⤢ Fit"}),Z&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"slc-hud-sep",children:"|"}),Z]}),(0,o.jsx)("span",{className:"slc-hud-sep",children:"|"}),(0,o.jsx)("span",{className:"slc-hud-hint",title:eR?"Drag to pan · pinch with two fingers to zoom · press and hold for the menu · double-tap a composite to enter it":"Wheel scrolls · Shift+wheel scrolls sideways · Ctrl+wheel zooms at the cursor · middle-drag or Space+drag pans",children:eS?"pinching":eb?"panning":eR?"drag · pinch · hold":eg?"space to pan":"wheel · ⌃wheel · space"})]}),ep&&(0,o.jsxs)("div",{className:"slc-picker",style:{left:ep.x,top:ep.y-80},onClick:e=>e.stopPropagation(),children:[(0,o.jsxs)("div",{className:"slc-picker-title",children:[ep.stateName," → ",ep.targetName]}),(0,o.jsx)("div",{className:"slc-picker-sub",children:"Select event:"}),0===eP.length?(0,o.jsx)("div",{className:"slc-picker-empty",children:"No events defined. Add events first."}):eP.map(e=>(0,o.jsx)("button",{type:"button",className:"slc-picker-item",onClick:()=>{ep&&(S?.(ep.stateName,ep.targetName,e),ef(null),M?.())},children:e},e)),(0,o.jsx)("button",{type:"button",className:"slc-picker-cancel",onClick:()=>{ef(null),M?.()},children:"Cancel"})]})]})}),ee=e=>{let t,n=new Set,r=(e,r)=>{let s="function"==typeof e?e(t):e;if(!Object.is(s,t)){let e=t;t=(null!=r?r:"object"!=typeof s||null===s)?s:Object.assign({},t,s),n.forEach(n=>n(t,e))}},s=()=>t,i={setState:r,getState:s,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e))},a=t=e(r,s,i);return i},et=e=>{let t=e?ee(e):ee,n=e=>(function(e,t=e=>e){let n=l.default.useSyncExternalStore(e.subscribe,l.default.useCallback(()=>t(e.getState()),[e,t]),l.default.useCallback(()=>t(e.getInitialState()),[e,t]));return l.default.useDebugValue(n),n})(t,e);return Object.assign(n,t),n},en=Object.create(null);en.open="0",en.close="1",en.ping="2",en.pong="3",en.message="4",en.upgrade="5",en.noop="6";let er=Object.create(null);Object.keys(en).forEach(e=>{er[en[e]]=e});let es={type:"error",data:"parser error"},ei="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),ea="function"==typeof ArrayBuffer,eo=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,el=({type:e,data:t},n,r)=>{if(ei&&t instanceof Blob)if(n)return r(t);else return ec(t,r);if(ea&&(t instanceof ArrayBuffer||eo(t)))if(n)return r(t);else return ec(new Blob([t]),r);return r(en[e]+(t||""))},ec=(e,t)=>{let n=new FileReader;return n.onload=function(){t("b"+(n.result.split(",")[1]||""))},n.readAsDataURL(e)};function ed(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let eh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eu="u"<typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<eh.length;e++)eu[eh.charCodeAt(e)]=e;let ep="function"==typeof ArrayBuffer,ef=(e,t)=>{if("string"!=typeof e)return{type:"message",data:eg(e,t)};let n=e.charAt(0);return"b"===n?{type:"message",data:em(e.substring(1),t)}:er[n]?e.length>1?{type:er[n],data:e.substring(1)}:{type:er[n]}:es},em=(e,t)=>ep?eg((e=>{let t=.75*e.length,n=e.length,r,s=0,i,a,o,l;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);let c=new ArrayBuffer(t),d=new Uint8Array(c);for(r=0;r<n;r+=4)i=eu[e.charCodeAt(r)],a=eu[e.charCodeAt(r+1)],o=eu[e.charCodeAt(r+2)],l=eu[e.charCodeAt(r+3)],d[s++]=i<<2|a>>4,d[s++]=(15&a)<<4|o>>2,d[s++]=(3&o)<<6|63&l;return c})(e),t):{base64:!0,data:e},eg=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;function ex(e){return e.reduce((e,t)=>e+t.length,0)}function ey(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let s=0;s<t;s++)n[s]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function eb(e){if(e){var t=e;for(var n in eb.prototype)t[n]=eb.prototype[n];return t}}eb.prototype.on=eb.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},eb.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},eb.prototype.off=eb.prototype.removeListener=eb.prototype.removeAllListeners=eb.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<r.length;s++)if((n=r[s])===t||n.fn===t){r.splice(s,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},eb.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,s=n.length;r<s;++r)n[r].apply(this,t)}return this},eb.prototype.emitReserved=eb.prototype.emit,eb.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},eb.prototype.hasListeners=function(e){return!!this.listeners(e).length};let ev="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),ew="u">typeof self?self:"u">typeof window?window:Function("return this")();function ek(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}let ej=ew.setTimeout,eN=ew.clearTimeout;function eS(e,t){t.useNativeTimers?(e.setTimeoutFn=ej.bind(ew),e.clearTimeoutFn=eN.bind(ew)):(e.setTimeoutFn=ew.setTimeout.bind(ew),e.clearTimeoutFn=ew.clearTimeout.bind(ew))}function e_(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class eC extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class eE extends eb{constructor(e){super(),this.writable=!1,eS(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new eC(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=ef(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return -1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){let t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class eR extends eE{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)};((e,t)=>{let n=e.split("\x1e"),r=[];for(let e=0;e<n.length;e++){let s=ef(n[e],t);if(r.push(s),"error"===s.type)break}return r})(e,this.socket.binaryType).forEach(t),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){var t;let n,r,s;this.writable=!1,t=e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})},r=Array(n=e.length),s=0,e.forEach((e,i)=>{el(e,!1,e=>{r[i]=e,++s===n&&t(r.join("\x1e"))})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=e_()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let eO=!1;try{eO="u">typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}let eM=eO;function eA(){}class eT extends eR{constructor(e){if(super(e),"u">typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="u">typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}class e$ extends eb{constructor(e,t,n){super(),this.createRequest=e,eS(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;let t=ek(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;let n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let e in n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null==(e=this._opts.cookieJar)||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null==(e=this._opts.cookieJar)||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}"u">typeof document&&(this._index=e$.requestsCount++,e$.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=eA,e)try{this._xhr.abort()}catch(e){}"u">typeof document&&delete e$.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function eP(){for(let e in e$.requests)e$.requests.hasOwnProperty(e)&&e$.requests[e].abort()}e$.requestsCount=0,e$.requests={},"u">typeof document&&("function"==typeof attachEvent?attachEvent("onunload",eP):"function"==typeof addEventListener&&addEventListener("onpagehide"in ew?"pagehide":"unload",eP,!1));let eI=(r=eL({xdomain:!1}))&&null!==r.responseType;function eL(e){let t=e.xdomain;try{if("u">typeof XMLHttpRequest&&(!t||eM))return new XMLHttpRequest}catch(e){}if(!t)try{return new ew[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}let eB="u">typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class eD extends eE{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,n=eB?{}:ek(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;el(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&ev(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=e_()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}let eF=ew.WebSocket||ew.MozWebSocket,eq={websocket:class extends eD{createSocket(e,t,n){return eB?new eF(e,t,n):t?new eF(e,t):new eF(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends eE{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{var r,s;let i,a,o,l,c=(r=Number.MAX_SAFE_INTEGER,s=this.socket.binaryType,n||(n=new TextDecoder),i=[],a=0,o=-1,l=!1,new TransformStream({transform(e,t){for(i.push(e);;){if(0===a){if(1>ex(i))break;let e=ey(i,1);l=(128&e[0])==128,a=(o=127&e[0])<126?3:126===o?1:2}else if(1===a){if(2>ex(i))break;let e=ey(i,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),a=3}else if(2===a){if(8>ex(i))break;let e=ey(i,8),n=new DataView(e.buffer,e.byteOffset,e.length),r=n.getUint32(0);if(r>2097151){t.enqueue(es);break}o=0x100000000*r+n.getUint32(4),a=3}else{if(ex(i)<o)break;let e=ey(i,o);t.enqueue(ef(l?e:n.decode(e),s)),a=0}if(0===o||o>r){t.enqueue(es);break}}}})),d=e.readable.pipeThrough(c).getReader(),h=new TransformStream({transform(e,n){var r;r=t=>{let r,s=t.length;if(s<126)new DataView((r=new Uint8Array(1)).buffer).setUint8(0,s);else if(s<65536){let e=new DataView((r=new Uint8Array(3)).buffer);e.setUint8(0,126),e.setUint16(1,s)}else{let e=new DataView((r=new Uint8Array(9)).buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(s))}e.data&&"string"!=typeof e.data&&(r[0]|=128),n.enqueue(r),n.enqueue(t)},ei&&e.data instanceof Blob?e.data.arrayBuffer().then(ed).then(r):ea&&(e.data instanceof ArrayBuffer||eo(e.data))?r(ed(e.data)):el(e,!1,e=>{t||(t=new TextEncoder),r(t.encode(e))})}});h.readable.pipeTo(e.writable),this._writer=h.writable.getWriter();let u=()=>{d.read().then(({done:e,value:t})=>{e||(this.onPacket(t),u())}).catch(e=>{})};u();let p={type:"open"};this.query.sid&&(p.data=`{"sid":"${this.query.sid}"}`),this._writer.write(p).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&ev(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null==(e=this._transport)||e.close()}},polling:class extends eT{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=eI&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new e$(eL,this.uri(),e)}}},eU=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,eH=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function eJ(e){var t,n;let r,s;if(e.length>8e3)throw"URI too long";let i=e,a=e.indexOf("["),o=e.indexOf("]");-1!=a&&-1!=o&&(e=e.substring(0,a)+e.substring(a,o).replace(/:/g,";")+e.substring(o,e.length));let l=eU.exec(e||""),c={},d=14;for(;d--;)c[eH[d]]=l[d]||"";return -1!=a&&-1!=o&&(c.source=i,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),r=(t=c.path).replace(/\/{2,9}/g,"/").split("/"),("/"==t.slice(0,1)||0===t.length)&&r.splice(0,1),"/"==t.slice(-1)&&r.splice(r.length-1,1),c.pathNames=r,n=c.query,s={},n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,n){t&&(s[t]=n)}),c.queryKey=s,c}let eY="function"==typeof addEventListener&&"function"==typeof removeEventListener,eV=[];eY&&addEventListener("offline",()=>{eV.forEach(e=>e())},!1);class eX extends eb{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=eJ(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=eJ(t.host).host);eS(this,t),this.secure=null!=t.secure?t.secure:"u">typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("u">typeof location?location.hostname:"localhost"),this.port=t.port||("u">typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),eY&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},eV.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let e=this.opts.rememberUpgrade&&eX.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",eX.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let t=Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+="string"==typeof n?function(e){let t=0,n=0;for(let r=0,s=e.length;r<s;r++)(t=e.charCodeAt(r))<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(n):Math.ceil(1.33*(n.byteLength||n.size))),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,ev(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;let s={type:e,data:t,options:n};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),r&&this.once("flush",r),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(eX.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),eY&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=eV.indexOf(this._offlineEventListener);-1!==e&&eV.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}eX.protocol=4;class ez extends eX{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;eX.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;eX.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function s(){n||(n=!0,c(),t.close(),t=null)}let i=e=>{let n=Error("probe error: "+e);n.transport=t.name,s(),this.emitReserved("upgradeError",n)};function a(){i("transport closed")}function o(){i("socket closed")}function l(e){t&&e.name!==t.name&&s()}let c=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",a),this.off("close",o),this.off("upgrading",l)};t.once("open",r),t.once("error",i),t.once("close",a),this.once("close",o),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}class eW extends ez{constructor(e,t={}){const n="object"==typeof e,r=n?{...e}:{...t};(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(e=>eq[e]).filter(e=>!!e)),super(n?r:e,r)}}eW.protocol;let eK="function"==typeof ArrayBuffer,eG=Object.prototype.toString,eQ="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===eG.call(Blob),eZ="function"==typeof File||"u">typeof File&&"[object FileConstructor]"===eG.call(File);function e0(e){return eK&&(e instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer))||eQ&&e instanceof Blob||eZ&&e instanceof File}let e1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(i=a||(a={}))[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK";class e2{constructor(e){this.replacer=e}encode(e){return(e.type===a.EVENT||e.type===a.ACK)&&function e(t,n){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(e(t[n]))return!0;return!1}if(e0(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1==arguments.length)return e(t.toJSON(),!0);for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return!0;return!1}(e)?this.encodeAsBinary({type:e.type===a.EVENT?a.BINARY_EVENT:a.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===a.BINARY_EVENT||e.type===a.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t,n,r=(t=[],n=e.data,e.data=function e(t,n,r){if(!t)return t;if(e0(t)){let e={_placeholder:!0,num:n.length};return n.push(t),e}if(Array.isArray(t)){let r=Array(t.length);for(let s=0;s<t.length;s++)r[s]=e(t[s],n);return r}if("object"==typeof t&&!(t instanceof Date)){if(t.toJSON&&"function"==typeof t.toJSON&&!r)return e(t.toJSON(),n,!0);let s={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=e(t[r],n));return s}return t}(n,t),e.attachments=t.length,{packet:e,buffers:t}),s=this.encodeAsString(r.packet),i=r.buffers;return i.unshift(s),i}}class e5 extends eb{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof e?{reviver:e}:e)}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let n=(t=this.decodeString(e)).type===a.BINARY_EVENT;n||t.type===a.BINARY_ACK?(t.type=n?a.EVENT:a.ACK,this.reconstructor=new e4(t)):super.emitReserved("decoded",t)}else if(e0(e)||e.base64)if(this.reconstructor)(t=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+e)}decodeString(e){let t=0,n={type:Number(e.charAt(0))};if(void 0===a[n.type])throw Error("unknown packet type "+n.type);if(n.type===a.BINARY_EVENT||n.type===a.BINARY_ACK){let r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);let s=e.substring(r,t);if(s!=Number(s)||"-"!==e.charAt(t))throw Error("Illegal attachments");let i=Number(s);if(!e3(i)||i<1)throw Error("Illegal attachments");if(i>this.opts.maxAttachments)throw Error("too many attachments");n.attachments=i}if("/"===e.charAt(t+1)){let r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(r,t)}else n.nsp="/";let r=e.charAt(t+1);if(""!==r&&Number(r)==r){let r=t+1;for(;++t;){let n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){let r=this.tryParse(e.substr(t));if(e5.isPayloadValid(n.type,r))n.data=r;else throw Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case a.CONNECT:return e6(t);case a.DISCONNECT:return void 0===t;case a.CONNECT_ERROR:return"string"==typeof t||e6(t);case a.EVENT:case a.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===e1.indexOf(t[0]));case a.ACK:case a.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class e4{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t,n;let e=(t=this.reconPack,n=this.buffers,t.data=function e(t,n){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<n.length)return n[t.num];throw Error("illegal attachments")}if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=e(t[r],n);else if("object"==typeof t)for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=e(t[r],n));return t}(t.data,n),delete t.attachments,t);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let e3=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function e6(e){return"[object Object]"===Object.prototype.toString.call(e)}function e8(e){var t;return"string"==typeof e.nsp&&(void 0===(t=e.id)||e3(t))&&function(e,t){switch(e){case a.CONNECT:return void 0===t||e6(t);case a.DISCONNECT:return void 0===t;case a.EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===e1.indexOf(t[0]));case a.ACK:return Array.isArray(t);case a.CONNECT_ERROR:return"string"==typeof t||e6(t);default:return!1}}(e.type,e.data)}function e7(e,t,n){return e.on(t,n),function(){e.off(t,n)}}e.s(["Decoder",()=>e5,"Encoder",()=>e2,"PacketType",()=>a,"isPacketValid",()=>e8,"protocol",0,5],11014);let e9=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class te extends eb{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[e7(e,"open",this.onopen.bind(this)),e7(e,"packet",this.onpacket.bind(this)),e7(e,"error",this.onerror.bind(this)),e7(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,s;if(e9.hasOwnProperty(e))throw Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let i={type:a.EVENT,data:t};if(i.options={},i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){let e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}let o=null==(r=null==(n=this.io.engine)?void 0:n.transport)?void 0:r.writable,l=this.connected&&!(null==(s=this.io.engine)?void 0:s._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var n;let r=null!=(n=this.flags.timeout)?n:this._opts.ackTimeout;if(void 0===r){this.acks[e]=t;return}let s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error("operation has timed out"))},r),i=(...e)=>{this.io.clearTimeoutFn(s),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let s=(e,t)=>e?r(e):n(t);s.withError=!0,t.push(s),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;let t=this._queue[0];(!t.pending||e)&&(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:a.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case a.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case a.EVENT:case a.BINARY_EVENT:this.onevent(e);break;case a.ACK:case a.BINARY_ACK:this.onack(e);break;case a.DISCONNECT:this.ondisconnect();break;case a.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){let t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length)for(let t of this._anyListeners.slice())t.apply(this,e);super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:a.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:a.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n]){t.splice(n,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n]){t.splice(n,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let t of this._anyOutgoingListeners.slice())t.apply(this,e.data)}}var tt=e.i(11014);function tn(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}tn.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(1&Math.floor(10*t))==0?e-n:e+n}return 0|Math.min(e,this.max)},tn.prototype.reset=function(){this.attempts=0},tn.prototype.setMin=function(e){this.ms=e},tn.prototype.setMax=function(e){this.max=e},tn.prototype.setJitter=function(e){this.jitter=e};class tr extends eb{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,eS(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(n=t.randomizationFactor)?n:.5),this.backoff=new tn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||tt;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null==(t=this.backoff)||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null==(t=this.backoff)||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null==(t=this.backoff)||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new eW(this.uri,this.opts);let t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;let r=e7(t,"open",function(){n.onopen(),e&&e()}),s=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=e7(t,"error",s);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),s(Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(e7(e,"ping",this.onping.bind(this)),e7(e,"data",this.ondata.bind(this)),e7(e,"error",this.onerror.bind(this)),e7(e,"close",this.onclose.bind(this)),e7(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){ev(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new te(this,e,t),this.nsps[e]=n),n}_destroy(e){for(let e of Object.keys(this.nsps))if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null==(n=this.engine)||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}let ts={};function ti(e,t){let n;"object"==typeof e&&(t=e,e=void 0);let r=function(e,t="",n){let r=e;n=n||"u">typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=eJ(e)),!r.port&&(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let s=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),s=r.source,i=r.id,a=r.path,o=ts[i]&&a in ts[i].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||o?n=new tr(s,t):(ts[i]||(ts[i]=new tr(s,t)),n=ts[i]),r.query&&!t.query&&(t.query=r.queryKey),n.socket(r.path,t)}function ta(e){if(e&&"object"==typeof e&&"clientId"in e){let t=e.clientId;if("string"==typeof t)return t}}function to(e){return"runtime.enter"===e.op||"runtime.exit"===e.op}function tl(){return{settings:{namespace:"MyApp",name:"MyStateMachine",asynchronous:!1},events:[{name:"Internal",events:[]}],state:{name:"Root",states:[{name:"Idle",kind:"normal"},{name:"End",kind:"final"}]}}}function tc(){return{positions:{}}}function td(e,t){if(e.name===t)return e;for(let n of e.states??[]){let e=td(n,t);if(e)return e}return null}function th(e,t,n){return e.name===t?n(e)??e:{...e,states:e.states?.map(e=>th(e,t,n))}}function tu(e,t){return{...e,states:e.states?.filter(e=>e.name!==t).map(e=>tu(e,t))}}function tp(e){let t=[e.name];for(let n of e.states??[])t.push(...tp(n));return t}function tf(e){return e.events.flatMap(e=>(e.events??[]).map(e=>e.id))}function tm(e){let t=[],n=tp(e.state),r=tf(e);0===r.length&&t.push({ruleId:"V001",message:"No events defined"});let s=new Set;for(let e of n)s.has(e)&&t.push({ruleId:"V002",message:`Duplicate state name: ${e}`,element:e}),s.add(e);!function e(s){for(let e of s.transitions??[])r.includes(e.event)||t.push({ruleId:"V003",message:`Transition in '${s.name}' references unknown event '${e.event}'`,element:s.name}),e.nextState&&!n.includes(e.nextState)&&t.push({ruleId:"V004",message:`Transition in '${s.name}' targets unknown state '${e.nextState}'`,element:s.name});for(let n of("final"===s.kind&&(s.transitions?.length??0)>0&&t.push({ruleId:"V007",message:`Final state '${s.name}' must not have outgoing transitions`,element:s.name}),"final"===s.kind&&(s.states?.length??0)>0&&t.push({ruleId:"V008",message:`Final state '${s.name}' must not have child states`,element:s.name}),s.states??[]))e(n)}(e.state),e.state.states&&0!==e.state.states.length||t.push({ruleId:"V005",message:"Root state must have at least one child state",element:e.state.name});let i=new Set;for(let e of r)i.has(e)&&t.push({ruleId:"V003",message:`Duplicate event ID: ${e}`,element:e}),i.add(e);return t}function tg(e,t){return{positions:{...N(e),...t.positions}}}Object.assign(ti,{Manager:tr,Socket:te,io:ti,connect:ti});let tx=(s=(e,t)=>({definition:tl(),layout:tg(tl(),tc()),viewport:{...L},fileName:null,docPath:null,dirty:!1,remoteMtime:null,remoteStatus:"idle",remoteMessage:null,activeStates:[],presence:[],_applyingRemote:!1,selection:{kind:null,id:null},drawMode:"select",drawSource:null,contextMenu:{visible:!1,x:0,y:0,target:null},undoStack:[],redoStack:[],activeTab:"properties",errors:[],showCodePreview:!1,generatedCode:null,navigationPath:["Root"],currentParent:"Root",_pushHistory:()=>{let{definition:n,layout:r,undoStack:s}=t(),i={definition:JSON.parse(JSON.stringify(n)),layout:JSON.parse(JSON.stringify(r))};e({undoStack:[...s.slice(-50),i],redoStack:[]})},setDefinition:n=>{t()._pushHistory();let r=tg(n,t().layout);e({definition:n,layout:r,dirty:!0,errors:tm(n)})},updateSettings:n=>{t()._pushHistory(),e({definition:{...t().definition,settings:{...t().definition.settings,...n}},dirty:!0})},addState:(n,r)=>{t()._pushHistory();let s={...t().definition},i=n??s.state.name;s.state=th(s.state,i,e=>({...e,states:[...e.states??[],r]}));let a=tg(s,t().layout);e({definition:s,layout:a,dirty:!0,errors:tm(s)})},updateState:(n,r)=>{t()._pushHistory();let s={...t().definition};s.state=th(s.state,n,e=>({...e,...r})),e({definition:s,dirty:!0,errors:tm(s)})},removeState:n=>{t()._pushHistory();let r={...t().definition};r.state=tu(r.state,n);let s={positions:{...t().layout.positions}};delete s.positions[n],e({definition:r,layout:s,dirty:!0,errors:tm(r)})},nestState:(n,r)=>{t()._pushHistory();let s={...t().definition},i=td(s.state,n);if(!i||n===r)return;let a=JSON.parse(JSON.stringify(i));s.state=tu(s.state,n),s.state=th(s.state,r,e=>({...e,states:[...e.states??[],a]})),e({definition:s,dirty:!0,errors:tm(s)})},addEventSource:n=>{t()._pushHistory(),e({definition:{...t().definition,events:[...t().definition.events,n]},dirty:!0})},updateEventSource:(n,r)=>{t()._pushHistory();let s={...t().definition};s.events=s.events.map((e,t)=>t===n?{...e,...r}:e),e({definition:s,dirty:!0})},removeEventSource:n=>{t()._pushHistory();let r={...t().definition};r.events=r.events.filter((e,t)=>t!==n),e({definition:r,dirty:!0,errors:tm(r)})},addEvent:(n,r=0)=>{t()._pushHistory();let s={...t().definition},i=s.events[r]??{name:"Internal",events:[]};i.events=[...i.events??[],n],s.events=s.events.map((e,t)=>t===r?i:e),e({definition:s,dirty:!0,errors:tm(s)})},updateEvent:(n,r)=>{t()._pushHistory();let s={...t().definition};s.events=s.events.map(e=>({...e,events:e.events?.map(e=>e.id===n?{...e,...r}:e)})),e({definition:s,dirty:!0})},removeEvent:n=>{t()._pushHistory();let r={...t().definition};r.events=r.events.map(e=>({...e,events:e.events?.filter(e=>e.id!==n)})),e({definition:r,dirty:!0,errors:tm(r)})},addParameter:(n,r)=>{t()._pushHistory();let s={...t().definition};s.events=s.events.map(e=>({...e,events:e.events?.map(e=>e.id===n?{...e,parameters:[...e.parameters??[],r]}:e)})),e({definition:s,dirty:!0})},removeParameter:(n,r)=>{t()._pushHistory();let s={...t().definition};s.events=s.events.map(e=>({...e,events:e.events?.map(e=>e.id===n?{...e,parameters:e.parameters?.filter((e,t)=>t!==r)}:e)})),e({definition:s,dirty:!0})},updateParameter:(n,r,s)=>{t()._pushHistory();let i={...t().definition};i.events=i.events.map(e=>({...e,events:e.events?.map(e=>e.id===n?{...e,parameters:e.parameters?.map((e,t)=>t===r?{...e,...s}:e)}:e)})),e({definition:i,dirty:!0})},addAction:(n,r,s)=>{t()._pushHistory();let i={...t().definition};i.state=th(i.state,n,e=>{let t=e[r]??{actions:[]};return{...e,[r]:{actions:[...t.actions,s]}}}),e({definition:i,dirty:!0})},removeAction:(n,r,s)=>{t()._pushHistory();let i={...t().definition};i.state=th(i.state,n,e=>{let t=e[r];return t?{...e,[r]:{actions:t.actions.filter((e,t)=>t!==s)}}:e}),e({definition:i,dirty:!0})},updateAction:(n,r,s,i)=>{t()._pushHistory();let a={...t().definition};a.state=th(a.state,n,e=>{let t=e[r];return t?{...e,[r]:{actions:t.actions.map((e,t)=>t===s?i:e)}}:e}),e({definition:a,dirty:!0})},addTransition:(n,r)=>{t()._pushHistory();let s={...t().definition};s.state=th(s.state,n,e=>({...e,transitions:[...e.transitions??[],r]})),e({definition:s,dirty:!0,errors:tm(s)})},updateTransition:(n,r,s)=>{t()._pushHistory();let i={...t().definition};i.state=th(i.state,n,e=>({...e,transitions:e.transitions?.map((e,t)=>t===r?{...e,...s}:e)})),e({definition:i,dirty:!0})},removeTransition:(n,r)=>{t()._pushHistory();let s={...t().definition};s.state=th(s.state,n,e=>({...e,transitions:e.transitions?.filter((e,t)=>t!==r)})),e({definition:s,dirty:!0,errors:tm(s)})},setStatePosition:(n,r)=>{e({layout:{positions:{...t().layout.positions,[n]:r}}})},arrangeLayout:()=>{t()._pushHistory(),e({layout:{positions:N(t().definition)}})},hydrateLayout:(n,r)=>{e({layout:{positions:{...t().layout.positions,...n}},...r?{viewport:r}:{}})},setViewport:t=>e({viewport:t}),select:(t,n)=>e({selection:{kind:t,id:n}}),clearSelection:()=>e({selection:{kind:null,id:null}}),setDrawMode:t=>e({drawMode:t,drawSource:null}),setDrawSource:t=>e({drawSource:t}),showContextMenu:(t,n,r)=>e({contextMenu:{visible:!0,x:t,y:n,target:r}}),hideContextMenu:()=>e({contextMenu:{visible:!1,x:0,y:0,target:null}}),undo:()=>{let{undoStack:n,definition:r,layout:s}=t();if(0===n.length)return;let i=n[n.length-1],a={definition:JSON.parse(JSON.stringify(r)),layout:JSON.parse(JSON.stringify(s))};e({definition:i.definition,layout:i.layout,undoStack:n.slice(0,-1),redoStack:[...t().redoStack,a],dirty:!0,errors:tm(i.definition)})},redo:()=>{let{redoStack:n,definition:r,layout:s}=t();if(0===n.length)return;let i=n[n.length-1],a={definition:JSON.parse(JSON.stringify(r)),layout:JSON.parse(JSON.stringify(s))};e({definition:i.definition,layout:i.layout,undoStack:[...t().undoStack,a],redoStack:n.slice(0,-1),dirty:!0,errors:tm(i.definition)})},canUndo:()=>t().undoStack.length>0,canRedo:()=>t().redoStack.length>0,setActiveTab:t=>e({activeTab:t}),loadFromJson:(t,n)=>{try{let r=JSON.parse(t),s=r.stateMachine??r.StateMachine??r,i=tg(s,tc()),a=s.state?.name??"Root";e({definition:s,layout:i,fileName:n??null,dirty:!1,errors:tm(s),selection:{kind:null,id:null},undoStack:[],redoStack:[],navigationPath:[a],currentParent:a})}catch(e){console.error("Failed to parse definition:",e)}},exportJson:()=>{let{definition:e}=t();return JSON.stringify({stateMachine:e},null,2)},applyRemote:(n,r,s)=>{try{let i=JSON.parse(n),a=i.stateMachine??i.StateMachine??i,o=tg(a,t().layout),l=a.state?.name??"Root",c=t(),d=new Set(tp(a.state)),h=c.navigationPath.filter(e=>d.has(e)),u=h.length?h:[l],p=u[u.length-1],f=c.selection,m=("state"===f.kind?!!f.id&&d.has(f.id):"transition"===f.kind?!!f.id&&d.has(f.id.split(":")[0]):"event"===f.kind&&!!f.id&&tf(a).includes(f.id))?f:{kind:null,id:null};e({definition:a,layout:o,fileName:s??t().fileName,dirty:!1,remoteMtime:r,remoteStatus:"synced",remoteMessage:null,errors:tm(a),selection:m,navigationPath:u,currentParent:p})}catch(t){e({remoteStatus:"error",remoteMessage:String(t)})}},setRemoteStatus:(t,n=null)=>e({remoteStatus:t,remoteMessage:n}),setRemoteMtime:t=>e({remoteMtime:t}),setDocPath:t=>e({docPath:t||null}),enterState:n=>{let r=t().activeStates;r.includes(n)||e({activeStates:[...r,n]})},exitState:n=>{let r=t().activeStates;r.includes(n)&&e({activeStates:r.filter(e=>e!==n)})},setPresence:t=>e({presence:t}),applyRemoteOps:(n,r,s)=>{e({_applyingRemote:!0});try{let s=t(),i=n.filter(e=>"runtime.enter"!==e.op&&"runtime.exit"!==e.op),a=i.length?p(s.definition,i):s.definition,o=s.activeStates;for(let e of n)"runtime.enter"===e.op?o.includes(e.state)||(o=[...o,e.state]):"runtime.exit"===e.op&&o.includes(e.state)&&(o=o.filter(t=>t!==e.state));let l=tg(a,s.layout),c=a.state?.name??"Root",d=new Set(tp(a.state)),h=s.navigationPath.filter(e=>d.has(e)),u=h.length?h:[c],f=u[u.length-1],m=s.selection,g=("state"===m.kind?!!m.id&&d.has(m.id):"transition"===m.kind?!!m.id&&d.has(m.id.split(":")[0]):"event"===m.kind&&!!m.id&&tf(a).includes(m.id))?m:{kind:null,id:null};e({definition:a,layout:l,activeStates:o,dirty:!1,remoteMtime:r,remoteStatus:"synced",remoteMessage:null,errors:tm(a),selection:g,navigationPath:u,currentParent:f})}catch(t){e({remoteStatus:"error",remoteMessage:String(t)})}finally{e({_applyingRemote:!1})}},validate:()=>{let n=tm(t().definition);return e({errors:n}),n},setGeneratedCode:t=>e({generatedCode:t}),setShowCodePreview:t=>e({showCodePreview:t}),navigateInto:n=>{let{definition:r,navigationPath:s}=t(),i=td(r.state,n);i&&(i.states?.length??0)>0&&e({navigationPath:[...s,n],currentParent:n,selection:{kind:null,id:null}})},navigateUp:n=>{let{navigationPath:r}=t();if(r.length<=1)return;let s=n??r.length-2,i=r.slice(0,s+1);e({navigationPath:i,currentParent:i[i.length-1],selection:{kind:null,id:null}})},getCurrentChildren:()=>{let{definition:e,currentParent:n}=t(),r=td(e.state,n);return r?.states??[]}}))?et(s):et,ty="canvas",tb=`[data-pinch-owner="${ty}"]`;function tv(e){return!!e&&"function"==typeof e.closest&&null!==e.closest(tb)}let tw="stateloom-canvas",tk="#030712",tj=["png","jpeg","svg","mermaid","markdown"],tN={png:"PNG",jpeg:"JPEG",svg:"SVG",mermaid:"Mermaid",markdown:"Markdown"},tS={png:"image/png",jpeg:"image/jpeg",svg:"image/svg+xml",mermaid:"text/vnd.mermaid",markdown:"text/markdown"},t_={png:"png",jpeg:"jpg",svg:"svg",mermaid:"mmd",markdown:"md"};async function tC(e,t,n={}){var r,s,i;let a;if("mermaid"===e||"markdown"===e){let n,i;a=new Blob([(r=t.definition,s="markdown"===e,n=["stateDiagram-v2"],r.state&&function e(t,n,r){let s=U(t);if(0===s.length)return;let i=" ".repeat(n+1),a=new Set;for(let e of s)for(let t of e.transitions??[]){if(!t.nextState)continue;let n=t.condition?`${t.event} [${t.condition}]`:t.event;r.push(`${i}${e.name} --> ${t.nextState} : ${n}`),a.add(e.name),a.add(t.nextState)}for(let e of s)a.has(e.name)||r.push(`${i}${e.name}`);for(let t of s)0!==U(t).length&&(r.push(`${i}state ${t.name} {`),e(t,n+1,r),r.push(`${i}}`))}(r.state,0,n),i=n.join("\n"),s?`\`\`\`mermaid
2
+ ${i}
3
+ \`\`\`
4
+ `:`${i}
5
+ `)],{type:`${tS[e]};charset=utf-8`})}else{let t=function(e={}){let t="u"<typeof document?null:document.getElementById(tw);if(!t)return null;let n=function(e){let t=e.querySelector(":scope > g");if(!t)return null;try{let e=t.getBBox();return e.width>0&&e.height>0?e:null}catch{return null}}(t);if(!n)return null;let r=e.padding??48,s=e.background??tk,i=Math.round(n.x-r),a=Math.round(n.y-r),o=Math.round(n.width+2*r),l=Math.round(n.height+2*r),c=t.cloneNode(!0);c.removeAttribute("id"),c.removeAttribute("class"),c.removeAttribute("style"),c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.setAttribute("width",String(o)),c.setAttribute("height",String(l)),c.setAttribute("viewBox",`${i} ${a} ${o} ${l}`),c.setAttribute("font-family","ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"),function e(t){for(let n of Array.from(t.children)){if("transparent"===n.getAttribute("fill")||"transparent"===n.getAttribute("stroke")){n.remove();continue}n.removeAttribute("class"),n.removeAttribute("style"),e(n)}}(c);let d=c.querySelector(":scope > g");d?.removeAttribute("transform");let h=document.createElementNS("http://www.w3.org/2000/svg","rect");return h.setAttribute("x",String(i)),h.setAttribute("y",String(a)),h.setAttribute("width",String(o)),h.setAttribute("height",String(l)),h.setAttribute("fill",s),c.insertBefore(h,c.firstChild),new XMLSerializer().serializeToString(c)}(n);if(!t)throw Error("nothing on the board to export yet");a="svg"===e?new Blob([t],{type:`${tS.svg};charset=utf-8`}):await (i=n.scale??2,new Promise((n,r)=>{let s=t.match(/width="(\d+)"\s+height="(\d+)"/),a=s?Number(s[1]):1200,o=s?Number(s[2]):800,l=URL.createObjectURL(new Blob([t],{type:"image/svg+xml;charset=utf-8"})),c=new Image;c.onload=()=>{URL.revokeObjectURL(l);let t=document.createElement("canvas");t.width=Math.max(1,Math.round(a*i)),t.height=Math.max(1,Math.round(o*i));let s=t.getContext("2d");s?(s.fillStyle=tk,s.fillRect(0,0,t.width,t.height),s.drawImage(c,0,0,t.width,t.height),t.toBlob(e=>e?n(e):r(Error("the canvas produced no image")),tS[e],"jpeg"===e?.92:void 0)):r(Error("this browser gave no 2d context to draw into"))},c.onerror=()=>{URL.revokeObjectURL(l),r(Error("the browser could not read the serialized board"))},c.src=l}))}let o=function({doc:e,machine:t,format:n,at:r}){let s,i,a=H(t??"")||H(e?(e.split(/[/\\]/).pop()??e).replace(/\.smdf\.json$/i,"").replace(/\.json$/i,""):"")||"statemachine",o=e&&(s=e.match(/(?:^|[/\\-])ep(?:isode)?-?(\d{2,4})(?:[/\\-]|$)/i))?`ep${s[1]}`:null,l=o?`${o}--`:"";return`${l}${a}--${(i=e=>String(e).padStart(2,"0"))(r.getFullYear()%100)+i(r.getMonth()+1)+i(r.getDate())+i(r.getHours())+i(r.getMinutes())+i(r.getSeconds())}.${n}`}({doc:t.docPath??t.fileName??null,machine:t.definition?.settings?.name??null,format:t_[e]??String(e),at:(void 0)??new Date}),l=URL.createObjectURL(a),c=document.createElement("a");return c.href=l,c.download=o,c.click(),URL.revokeObjectURL(l),o}let tE="stateloom.layout.v1:";async function tR(){try{let{requestedDoc:t,docQuery:n}=await e.A(32058),r=await fetch(`/api/file${n(t())}`,{cache:"no-store"});if(r.ok){let e=(await r.json())?.path;if("string"==typeof e&&e.length>0)return e}}catch{}return tx.getState().fileName??"untitled"}function tO(){let e,t,n=tx(e=>e.definition),r=tx(e=>e.layout),s=tx(e=>e.selection),i=tx(e=>e.select),a=tx(e=>e.clearSelection),c=tx(e=>e.setStatePosition),d=tx(e=>e.drawMode),h=tx(e=>e.drawSource),u=tx(e=>e.setDrawSource),p=tx(e=>e.setDrawMode),f=tx(e=>e.addTransition),m=tx(e=>e.showContextMenu),g=tx(e=>e.removeState),x=tx(e=>e.undo),y=tx(e=>e.redo),b=tx(e=>e.errors),v=tx(e=>e.navigationPath),w=tx(e=>e.navigateInto),k=tx(e=>e.navigateUp),j=tx(e=>e.activeStates),S=tx(e=>e.viewport),_=tx(e=>e.setViewport);e=(0,l.useRef)(!1),t=(0,l.useRef)(null),(0,l.useEffect)(()=>{let n=!1,r=null;(async()=>{let r=await tR();if(n)return;t.current=r;let s=function(e){try{let t=window.localStorage.getItem(`${tE}${e}`);if(!t)return null;let n=JSON.parse(t),r={};for(let[e,t]of Object.entries(n?.positions??{}))t&&"object"==typeof t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.width)&&Number.isFinite(t.height)&&(r[e]=t);return{positions:r,viewport:function(e,t=I){return e?{x:Number.isFinite(e.x)?e.x:0,y:Number.isFinite(e.y)?e.y:0,scale:B(e.scale??1,t)}:{...L}}(n?.viewport)}}catch{return null}}(r);s&&tx.getState().hydrateLayout(s.positions,s.viewport),e.current=!0})();let s=tx.subscribe((n,s)=>{e.current&&t.current&&(n.layout!==s.layout||n.viewport!==s.viewport)&&(r&&clearTimeout(r),r=setTimeout(()=>{let e=tx.getState();!function(e,t,n){try{window.localStorage.setItem(`${tE}${e}`,JSON.stringify({positions:t,viewport:n,savedAt:Date.now()}))}catch{}}(t.current,function(e,t){let n={};for(let[r,s]of Object.entries(e)){let e=t[r];e&&(s.x!==e.x||s.y!==e.y||s.width!==e.width||s.height!==e.height)&&(n[r]=s)}return n}(e.layout.positions,N(e.definition)),e.viewport)},300))});return()=>{n=!0,r&&clearTimeout(r),s()}},[]);let C=v.slice(1);return(0,o.jsx)(Z,{definition:n,positions:r.positions,path:C,rootLabel:v[0],viewport:S,onViewportChange:_,selection:{kind:"state"===s.kind||"transition"===s.kind?s.kind:null,id:s.id},activeStates:j,errorElements:b.flatMap(e=>e.element?[e.element]:[]),drawMode:"transition"===d?"transition":"select",drawSource:h,svgId:tw,pinchOwner:ty,emptyHint:window.matchMedia?.("(pointer: coarse)").matches?"Press and hold to add a state, or load a .smdf.json file":"Right-click to add a state, or load a .smdf.json file",onSelect:(e,t)=>{"state"!==e||"transition"!==d||h?i(e,t):u(t)},onClearSelection:a,onStateMove:c,onNavigateInto:w,onNavigateTo:e=>k(e),onContextMenu:(e,t,n)=>m(e,t,"state"===n.kind?{kind:"state",id:n.id}:{kind:"canvas"}),onCreateTransition:(e,t,n)=>{f(e,{event:n,nextState:t}),u(null),p("select")},onCancelDraw:()=>{p("select"),u(null)},onDeleteState:e=>{g(e),a()},onUndo:x,onRedo:y})}function tM({label:e,actions:t,onChange:n}){let r=(e,r)=>n(t.map((t,n)=>n===e?{...t,...r}:t));return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("span",{className:"text-xs font-medium text-gray-500",children:e}),(0,o.jsx)("button",{onClick:()=>n([...t,{action:"code",code:""}]),className:"text-xs text-blue-500 hover:text-blue-400",children:"+ action"})]}),t.map((e,s)=>(0,o.jsxs)("div",{className:"flex items-start gap-1 mt-1",children:[(0,o.jsxs)("select",{className:"bg-gray-800 border border-gray-700 rounded px-1 py-0.5 text-xs text-gray-200",value:e.action,onChange:e=>r(s,{action:e.target.value}),children:[(0,o.jsx)("option",{value:"code",children:"Code"}),(0,o.jsx)("option",{value:"timerStart",children:"Timer Start"}),(0,o.jsx)("option",{value:"timerStop",children:"Timer Stop"})]}),"code"===e.action?(0,o.jsx)("textarea",{className:"flex-1 bg-gray-800 border border-gray-700 rounded px-1 py-0.5 text-xs text-gray-200 h-10 font-mono",value:e.code??"",placeholder:"// action code...",onChange:e=>r(s,{code:e.target.value})}):(0,o.jsx)("input",{className:"flex-1 bg-gray-800 border border-gray-700 rounded px-1 py-0.5 text-xs text-gray-200",value:e.name??"",placeholder:"Timer name",onChange:e=>r(s,{name:e.target.value})}),(0,o.jsx)("button",{onClick:()=>n(t.filter((e,t)=>t!==s)),className:"text-red-600 hover:text-red-400 text-xs mt-0.5",children:"✕"})]},s)),0===t.length&&(0,o.jsx)("span",{className:"text-xs text-gray-700 italic",children:"none"})]})}function tA(){let e=tx(e=>e.definition),t=tx(e=>e.selection),n=tx(e=>e.updateState),r=tx(e=>e.removeState);tx(e=>e.addAction),tx(e=>e.removeAction);let s=tx(e=>e.updateTransition),i=tx(e=>e.removeTransition);if(!t.kind||!t.id)return(0,o.jsx)("div",{className:"p-3 text-xs text-gray-500",children:"Select a state or transition to edit its properties."});let a=(e,t)=>{if(e.name===t)return e;for(let n of e.states??[]){let e=a(n,t);if(e)return e}return null};if("state"===t.kind){let s=a(e.state,t.id);if(!s)return(0,o.jsx)("div",{className:"p-3 text-gray-500 text-xs",children:"State not found"});let l=s.onEntry?.actions??[],c=s.onExit?.actions??[];return(0,o.jsxs)("div",{className:"p-3 space-y-3 text-sm md:overflow-y-auto md:max-h-[calc(100vh-160px)]",children:[(0,o.jsxs)("h3",{className:"text-xs font-semibold text-gray-400",children:["State: ",s.name]}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Name"}),(0,o.jsx)("input",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200",value:s.name,onChange:e=>n(t.id,{name:e.target.value})})]}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Kind"}),(0,o.jsxs)("select",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200",value:s.kind??"normal",onChange:e=>n(t.id,{kind:e.target.value}),children:[(0,o.jsx)("option",{value:"normal",children:"Normal"}),(0,o.jsx)("option",{value:"final",children:"Final"}),(0,o.jsx)("option",{value:"history",children:"History"})]})]}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Description"}),(0,o.jsx)("textarea",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-200 h-12",value:s.description??"",onChange:e=>n(t.id,{description:e.target.value||void 0})})]}),(0,o.jsx)(tM,{label:"▸ onEntry Actions",actions:l,onChange:e=>n(t.id,{onEntry:{actions:e}})}),(0,o.jsx)(tM,{label:"◂ onExit Actions",actions:c,onChange:e=>n(t.id,{onExit:{actions:e}})}),(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"text-xs font-medium text-gray-500",children:"Transitions"}),(s.transitions??[]).map((e,n)=>(0,o.jsxs)("div",{className:"flex items-center gap-1 text-xs text-gray-400 py-1 border-b border-gray-800/50",children:[(0,o.jsxs)("span",{className:"flex-1",children:[e.event," → ",e.nextState??"(internal)"]}),e.condition&&(0,o.jsxs)("span",{className:"text-gray-600",children:["[",e.condition,"]"]}),(0,o.jsx)("button",{onClick:()=>i(t.id,n),className:"text-red-600 hover:text-red-400",children:"✕"})]},n)),(s.transitions?.length??0)===0&&(0,o.jsx)("span",{className:"text-xs text-gray-700 italic",children:"none"})]}),(0,o.jsx)("button",{onClick:()=>r(t.id),className:"text-red-500 hover:text-red-400 text-xs mt-2",children:"🗑 Delete State"})]})}if("transition"===t.kind){let[n,r]=t.id.split(":"),l=parseInt(r,10),c=a(e.state,n),d=c?.transitions?.[l];if(!d)return(0,o.jsx)("div",{className:"p-3 text-gray-500 text-xs",children:"Transition not found"});let h=tf(e),u=(function e(t){let n=[t];for(let r of t.states??[])n.push(...e(r));return n})(e.state).map(e=>e.name).filter(e=>"Root"!==e);return(0,o.jsxs)("div",{className:"p-3 space-y-3 text-sm",children:[(0,o.jsx)("h3",{className:"text-xs font-semibold text-gray-400",children:"Transition"}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Event"}),(0,o.jsx)("select",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200",value:d.event,onChange:e=>s(n,l,{event:e.target.value}),children:h.map(e=>(0,o.jsx)("option",{value:e,children:e},e))})]}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Target State"}),(0,o.jsxs)("select",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200",value:d.nextState??"",onChange:e=>s(n,l,{nextState:e.target.value||void 0}),children:[(0,o.jsx)("option",{value:"",children:"(internal transition)"}),u.map(e=>(0,o.jsx)("option",{value:e,children:e},e))]})]}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Condition (guard)"}),(0,o.jsx)("textarea",{rows:3,className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200 resize-y leading-snug",value:d.condition??"",onChange:e=>s(n,l,{condition:e.target.value||void 0})})]}),(0,o.jsx)("button",{onClick:()=>i(n,l),className:"text-red-500 hover:text-red-400 text-xs",children:"🗑 Delete Transition"})]})}return null}let tT=["string","int","float","bool","object"];function t$(){let e=tx(e=>e.definition),t=tx(e=>e.addEvent),n=tx(e=>e.updateEvent),r=tx(e=>e.removeEvent),s=tx(e=>e.addParameter),i=tx(e=>e.removeParameter),a=tx(e=>e.updateParameter),c=tx(e=>e.updateEventSource),d=tx(e=>e.select),h=tx(e=>e.selection),[u,p]=(0,l.useState)(""),[f,m]=(0,l.useState)(null),[g,x]=(0,l.useState)(null);return(0,o.jsxs)("div",{className:"p-3 text-sm",children:[e.events.map((e,t)=>(0,o.jsxs)("div",{className:"mb-3",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,o.jsx)("span",{className:"text-xs font-semibold text-gray-500",children:"Source:"}),(0,o.jsx)("input",{className:"flex-1 bg-transparent border-b border-gray-700 text-xs text-gray-300 px-1 py-0.5 focus:border-blue-500 outline-none",value:e.name,onChange:e=>c(t,{name:e.target.value})}),void 0!==e.feeder&&(0,o.jsx)("input",{className:"w-24 bg-transparent border-b border-gray-700 text-xs text-gray-400 px-1 py-0.5 focus:border-blue-500 outline-none",value:e.feeder??"",placeholder:"Feeder...",onChange:e=>c(t,{feeder:e.target.value||void 0})}),void 0===e.feeder&&(0,o.jsx)("button",{className:"text-xs text-gray-600 hover:text-gray-400",title:"Add feeder class",onClick:()=>c(t,{feeder:`${e.name}Feeder`}),children:"+feeder"})]}),(0,o.jsx)("div",{className:"-mx-1 overflow-x-auto px-1",children:(0,o.jsxs)("table",{className:"w-full text-xs",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:"text-gray-600 border-b border-gray-800",children:[(0,o.jsx)("th",{className:"text-left py-1 font-medium",children:"ID"}),(0,o.jsx)("th",{className:"text-left py-1 font-medium",children:"Description"}),(0,o.jsx)("th",{className:"text-left py-1 font-medium",children:"Params"}),(0,o.jsx)("th",{className:"w-6"})]})}),(0,o.jsx)("tbody",{children:(e.events??[]).map(e=>(0,o.jsxs)(l.Fragment,{children:[(0,o.jsxs)("tr",{className:`border-b border-gray-800/50 hover:bg-gray-800/30 cursor-pointer ${"event"===h.kind&&h.id===e.id?"bg-blue-900/30":""}`,onClick:()=>{d("event",e.id),m(f===e.id?null:e.id)},children:[(0,o.jsx)("td",{className:"py-1 pr-1",children:g===e.id?(0,o.jsx)("input",{autoFocus:!0,className:"w-full bg-gray-800 border border-gray-700 rounded px-1 text-gray-200",value:e.id,onChange:t=>n(e.id,{id:t.target.value}),onBlur:()=>x(null),onKeyDown:e=>"Enter"===e.key&&x(null),onClick:e=>e.stopPropagation()}):(0,o.jsx)("span",{className:"text-gray-300",onDoubleClick:t=>{t.stopPropagation(),x(e.id)},children:e.id})}),(0,o.jsx)("td",{className:"py-1 pr-1 text-gray-500 truncate max-w-[80px]",children:e.description??"—"}),(0,o.jsx)("td",{className:"py-1 text-gray-500",children:(e.parameters?.length??0)>0?e.parameters.map(e=>`${e.name}:${e.type}`).join(", "):"—"}),(0,o.jsx)("td",{className:"py-1",children:(0,o.jsx)("button",{onClick:t=>{t.stopPropagation(),r(e.id)},className:"text-red-600 hover:text-red-400",children:"✕"})})]}),f===e.id&&(0,o.jsx)("tr",{children:(0,o.jsx)("td",{colSpan:4,className:"py-2 px-1 bg-gray-900/50",children:(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-gray-600",children:"Description"}),(0,o.jsx)("input",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-0.5 text-gray-200 mt-0.5",value:e.description??"",onChange:t=>n(e.id,{description:t.target.value||void 0})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"text-gray-600",children:"Parameters"}),(e.parameters??[]).map((t,n)=>(0,o.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,o.jsx)("input",{className:"flex-1 bg-gray-800 border border-gray-700 rounded px-1 py-0.5 text-gray-200",value:t.name,placeholder:"name",onChange:t=>a(e.id,n,{name:t.target.value})}),(0,o.jsx)("select",{className:"bg-gray-800 border border-gray-700 rounded px-1 py-0.5 text-gray-200",value:t.type,onChange:t=>a(e.id,n,{type:t.target.value}),children:tT.map(e=>(0,o.jsx)("option",{value:e,children:e},e))}),(0,o.jsx)("button",{onClick:()=>i(e.id,n),className:"text-red-600 hover:text-red-400",children:"✕"})]},n)),(0,o.jsx)("button",{className:"text-blue-500 hover:text-blue-400 mt-1",onClick:()=>s(e.id,{name:"param",type:"string"}),children:"+ parameter"})]}),(0,o.jsxs)("div",{className:"mt-1",children:[(0,o.jsx)("span",{className:"text-gray-600",children:"Generated method:"}),(0,o.jsxs)("code",{className:"block bg-gray-800 rounded px-2 py-1 text-green-400 mt-0.5 font-mono",children:["on_",e.id.toLowerCase(),"(context",(e.parameters??[]).map(e=>`, ${e.name}: ${e.type}`).join(""),")"]})]})]})})})]},e.id))})]})})]},t)),(0,o.jsxs)("div",{className:"flex gap-1 mt-2",children:[(0,o.jsx)("input",{className:"flex-1 bg-gray-800 border border-gray-700 rounded px-2 py-1 text-gray-200",placeholder:"New event ID...",value:u,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"===e.key&&u.trim()&&(t({id:u.trim()}),p(""))}}),(0,o.jsx)("button",{onClick:()=>{u.trim()&&(t({id:u.trim()}),p(""))},className:"bg-blue-600 hover:bg-blue-500 text-white px-2 py-1 rounded",children:"+"})]})]})}function tP(){let e=tx(e=>e.definition.settings),t=tx(e=>e.definition.settings.context),n=tx(e=>e.updateSettings);return(0,o.jsxs)("div",{className:"p-3 space-y-3 text-sm",children:[(0,o.jsx)("h3",{className:"text-xs font-semibold text-gray-400",children:"Machine Settings"}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Namespace"}),(0,o.jsx)("input",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200",value:e.namespace,onChange:e=>n({namespace:e.target.value})})]}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Name"}),(0,o.jsx)("input",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-sm text-gray-200",value:e.name??"",onChange:e=>n({name:e.target.value||void 0})})]}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Description"}),(0,o.jsx)("textarea",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-200 h-12",value:e.description??"",onChange:e=>n({description:e.target.value||void 0})})]}),(0,o.jsxs)("label",{className:"flex items-center gap-2 text-sm text-gray-300",children:[(0,o.jsx)("input",{type:"checkbox",checked:e.asynchronous,onChange:e=>n({asynchronous:e.target.checked}),className:"rounded bg-gray-800 border-gray-600"}),"Asynchronous"]}),(0,o.jsx)("hr",{className:"border-gray-800"}),(0,o.jsx)("h4",{className:"text-xs font-semibold text-gray-500",children:"Context"}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Context Class"}),(0,o.jsx)("input",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-200",value:t?.class??"",placeholder:"e.g. MyStateMachineContext",onChange:e=>n({context:{...t,class:e.target.value||void 0}})})]}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Base Class"}),(0,o.jsx)("input",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-200",value:t?.baseClass??"",placeholder:"e.g. Context",onChange:e=>n({context:{...t,baseClass:e.target.value||void 0}})})]}),(0,o.jsx)("hr",{className:"border-gray-800"}),(0,o.jsx)("h4",{className:"text-xs font-semibold text-gray-500",children:"Imports"}),(0,o.jsx)("textarea",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-200 h-16 font-mono",value:(e.imports??[]).join("\n"),placeholder:"One import per line",onChange:e=>n({imports:e.target.value?e.target.value.split("\n"):[]})}),(0,o.jsx)("hr",{className:"border-gray-800"}),(0,o.jsx)("h4",{className:"text-xs font-semibold text-gray-500",children:"Object References"}),(0,o.jsx)("textarea",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-200 h-12 font-mono",value:(e.objects??[]).map(e=>`${e.instance}: ${e.class}`).join("\n"),placeholder:"instance: Class (one per line)",onChange:e=>{n({objects:e.target.value.split("\n").filter(e=>e.includes(":")).map(e=>{let[t,n]=e.split(":").map(e=>e.trim());return{instance:t,class:n}})})}}),(0,o.jsx)("hr",{className:"border-gray-800"}),(0,o.jsx)("h4",{className:"text-xs font-semibold text-gray-500",children:"Code Generation"}),(0,o.jsxs)("label",{className:"block",children:[(0,o.jsx)("span",{className:"text-xs text-gray-500",children:"Target Language"}),(0,o.jsxs)("select",{className:"w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-200",value:e.targetLanguage??"python",onChange:e=>n({targetLanguage:e.target.value}),children:[(0,o.jsx)("option",{value:"python",children:"Python"}),(0,o.jsx)("option",{value:"typescript",children:"TypeScript"}),(0,o.jsx)("option",{value:"csharp",children:"C#"})]})]})]})}function tI(){let e=tx(e=>e.errors),t=tx(e=>e.validate),n=tx(e=>e.select);return(0,o.jsxs)("div",{className:"p-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,o.jsxs)("h3",{className:"text-xs font-semibold text-gray-400",children:["Validation ",e.length>0&&(0,o.jsxs)("span",{className:"text-red-500",children:["(",e.length,")"]})]}),(0,o.jsx)("button",{onClick:()=>t(),className:"text-xs bg-gray-700 hover:bg-gray-600 text-gray-300 px-2 py-0.5 rounded",children:"Re-check"})]}),0===e.length?(0,o.jsxs)("div",{className:"flex items-center gap-2 text-green-500 text-xs",children:[(0,o.jsx)("span",{children:"✓"}),(0,o.jsx)("span",{children:"Definition is valid"})]}):(0,o.jsx)("div",{className:"space-y-0.5",children:e.map((e,t)=>(0,o.jsxs)("div",{className:`flex items-start gap-1.5 text-[13px] py-2.5 border-b border-gray-800/50 md:text-xs md:py-1 ${e.element?"cursor-pointer hover:bg-gray-800/30":""}`,onClick:()=>{e.element&&n("state",e.element)},title:e.element?`Click to select "${e.element}"`:void 0,children:[(0,o.jsx)("span",{className:`font-mono text-[10px] mt-0.5 ${"error"===e.severity?"text-red-600":"text-yellow-600"}`,children:e.ruleId}),(0,o.jsx)("span",{className:`flex-1 ${"error"===e.severity?"text-red-400":"text-yellow-400"}`,children:e.message}),e.element&&(0,o.jsxs)("span",{className:"text-gray-600 text-[10px]",children:["→ ",e.element]})]},t))})]})}var tL=e.i(76800);function tB(){let e=(0,tL.useRequestedDoc)(),[t,n]=(0,l.useState)(!1),[r,s]=(0,l.useState)(""),[i,a]=(0,l.useState)(null),[c,d]=(0,l.useState)([]),[h,u]=(0,l.useState)(null);(0,l.useEffect)(()=>{if(!t)return;let e=!0;return u(null),fetch("/api/docs",{cache:"no-store"}).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(t=>{e&&(a(t.docs??[]),d(t.roots??[]))}).catch(t=>{e&&(a([]),u(t.message))}),()=>{e=!1}},[t]);let p=e=>{n(!1),s(""),(0,tL.navigateToDoc)(e)},f=new Set((i??[]).map(e=>e.path)),m=t?(function(){try{let e=[];for(let t=0;t<window.localStorage.length;t++){let n=window.localStorage.key(t);n?.startsWith(tE)&&e.push(n.slice(tE.length))}return e.sort()}catch{return[]}})().filter(t=>t.startsWith("/")&&t!==e&&!f.has(t)):[],g=(i??[]).filter(t=>t.path!==e),x=r.trim().toLowerCase(),y=x?g.filter(e=>e.path.toLowerCase().includes(x)):g,b="block w-full truncate rounded px-1.5 py-1 text-left text-xs text-gray-300 hover:bg-gray-800";return(0,o.jsxs)("span",{className:"relative inline-flex",children:[(0,o.jsx)("button",{onClick:()=>n(e=>!e),className:"toolbar-btn",title:e?`Document: ${e}`:"Switch document",children:"⇄"}),t&&(0,o.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-80 rounded border border-gray-700 bg-gray-900 p-2 shadow-lg",children:[(0,o.jsx)("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-gray-500",children:"switch document"}),(0,o.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=r.trim();if(t){if(1===y.length)return p(y[0].path);if(t.startsWith("/"))return p(t)}},className:"mb-1 flex gap-1",children:[(0,o.jsx)("input",{value:r,onChange:e=>s(e.target.value),placeholder:null===i?"loading…":"filter, or /absolute/path.json",className:"min-w-0 flex-1 rounded border border-gray-700 bg-gray-950 px-1.5 py-1 text-xs text-gray-200 placeholder:text-gray-600"}),(0,o.jsx)("button",{type:"submit",className:"toolbar-btn",title:"Open",children:"→"})]}),(0,o.jsxs)("div",{className:"max-h-64 overflow-y-auto",children:[e&&(0,o.jsx)("button",{onClick:()=>p(null),className:b,title:"Return to the default project file",children:"⌂ default document"}),y.map(e=>(0,o.jsxs)("button",{onClick:()=>p(e.path),className:b,title:e.path,children:[e.name,(0,o.jsx)("span",{className:"ml-1 text-[10px] text-gray-600",children:e.dir})]},e.path)),m.length>0&&(0,o.jsxs)("div",{className:"mt-1 border-t border-gray-800 pt-1",children:[(0,o.jsx)("div",{className:"px-1.5 pb-0.5 text-[10px] uppercase tracking-wide text-gray-600",children:"recent"}),m.map(e=>(0,o.jsxs)("button",{onClick:()=>p(e),className:b,title:e,children:[e.split("/").pop(),(0,o.jsx)("span",{className:"ml-1 text-[10px] text-gray-600",children:e})]},e))]}),null!==i&&0===y.length&&0===m.length&&(0,o.jsx)("div",{className:"px-1.5 py-1 text-[11px] text-gray-500",children:x?"nothing matches":"no other documents here"})]}),c.length>0&&(0,o.jsxs)("div",{className:"mt-1 truncate border-t border-gray-800 pt-1 text-[10px] text-gray-600",children:["paths are as the server sees them: ",c.join(", ")]}),h&&(0,o.jsxs)("div",{className:"mt-1 text-[10px] text-gray-600",children:["this server does not list documents (",h,") — type a path"]})]})]})}function tD(){let e=tx(e=>e.presence),[t,n]=(0,l.useState)(!1);if(0===e.length)return null;let r=new Map;for(let t of e)r.set(t.role,(r.get(t.role)??0)+1);let s=[...r].map(([e,t])=>t>1?`${e} \xd7${t}`:e).join(" · ");return(0,o.jsxs)("span",{className:"relative inline-flex",children:[(0,o.jsxs)("button",{onClick:()=>n(e=>!e),className:"toolbar-btn inline-flex items-center gap-1.5",title:`Connected: ${s}`,"aria-expanded":t,"aria-label":`${e.length} connected: ${s}`,children:[(0,o.jsx)("span",{className:"flex -space-x-1",children:e.slice(0,4).map(e=>(0,o.jsx)("span",{className:"inline-block h-2 w-2 rounded-full ring-1 ring-gray-900",style:{backgroundColor:e.color??y(e.clientId)}},e.clientId))}),(0,o.jsx)("span",{className:"tabular-nums",children:e.length})]}),t&&(0,o.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 max-h-64 w-56 overflow-y-auto rounded border border-gray-700 bg-gray-900 p-2 shadow-lg",children:[(0,o.jsxs)("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-gray-500",children:["connected · ",s]}),e.map(e=>(0,o.jsxs)("div",{className:"flex items-center gap-1.5 rounded px-1 py-1 text-xs text-gray-300",title:e.clientId,children:[(0,o.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:e.color??y(e.clientId)}}),(0,o.jsx)("span",{className:"shrink-0",children:e.role}),e.name&&(0,o.jsx)("span",{className:"truncate text-gray-500",children:e.name})]},e.clientId))]})]})}function tF(){let e=tx(e=>e.definition),t=tx(e=>e.fileName),n=tx(e=>e.docPath),r=tx(e=>e.dirty),s=tx(e=>e.loadFromJson),i=tx(e=>e.exportJson),a=tx(e=>e.addState),c=tx(e=>e.validate),d=tx(e=>e.showCodePreview),h=tx(e=>e.setShowCodePreview),u=tx(e=>e.setGeneratedCode),p=tx(e=>e.drawMode),f=tx(e=>e.setDrawMode),m=tx(e=>e.arrangeLayout),g=tx(e=>e.undo),x=tx(e=>e.redo),y=tx(e=>e.undoStack),b=tx(e=>e.redoStack),v=tx(e=>e.remoteStatus),w=tx(e=>e.remoteMessage),k=tx(e=>e.setRemoteStatus),j=tx(e=>e.setRemoteMtime),N=tx(e=>e.applyRemote),S=(0,tL.useRequestedDoc)(),_=(0,l.useRef)(null),[C,E]=(0,l.useState)(!1),[R,O]=(0,l.useState)(""),[M,A]=(0,l.useState)(!1),[T,$]=(0,l.useState)("png"),[P,I]=(0,l.useState)(!1),[L,B]=(0,l.useState)(null),[D,F]=(0,l.useState)(null),q=async()=>{let e=i();A(!0);try{let t=await fetch(`/api/file${(0,tL.docQuery)(S)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})});if(t.ok){let e=await t.json();j(e.mtime),tx.setState({dirty:!1}),k("synced",null)}else{let e=await t.json().catch(()=>({error:"unknown"}));k("error",`Save failed: ${e.error??t.statusText}`)}}catch(e){k("error",`Save failed: ${e}`)}finally{A(!1)}},U=async()=>{I(!0),B(null);try{let r=await tC(T,{definition:e,docPath:n,fileName:t});F(r)}catch(e){B(e instanceof Error?e.message:String(e))}finally{I(!1)}},H=async()=>{try{let e=await fetch(`/api/file${(0,tL.docQuery)(S)}`,{cache:"no-store"});if(!e.ok)return void k("error","Reload failed");let t=await e.json();t.exists&&t.content?N(t.content,t.mtime,t.path.split("/").pop()):k("idle",`No file at ${t.path}`)}catch(e){k("error",`Reload failed: ${e}`)}},J=()=>{R.trim()&&(a(null,{name:R.trim(),kind:"normal"}),O(""),E(!1))},[Y,V]=(0,l.useState)("python"),X=async()=>{try{let e=await fetch("/api/rispec",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(e.ok){let t=await e.json();u(t.rispec)}else{let t=await e.json().catch(()=>({error:"Unknown"}));u(`# RISE rispec generation failed
6
+ ${t.error}`)}}catch(e){u(`# RISE rispec generation failed
7
+ ${e}`)}h(!0)},z=async()=>{let e=i();try{let t=await fetch("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({definition:e,language:Y})});if(t.ok){let e=await t.json();u(e.code)}else{let n=await t.json().catch(()=>({error:"Unknown error"}));u(`// Code generation failed: ${n.error}
8
+ // Showing definition JSON as fallback:
9
+ ${e}`)}}catch{u(`// Backend unavailable — showing definition JSON
10
+ ${e}`)}h(!0)};return(0,o.jsxs)("div",{className:"flex flex-col gap-1.5 px-2 py-1.5 bg-gray-900 border-b border-gray-800 md:flex-row md:flex-wrap md:items-center md:px-3",children:[(0,o.jsxs)("div",{className:"toolbar-ident",children:[(0,o.jsx)("input",{ref:_,type:"file",accept:".json,.smdf.json",onChange:e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=e=>{s(e.target?.result,t.name)},n.readAsText(t),e.target.value=""},className:"hidden"}),(0,o.jsxs)("span",{className:"text-xs text-gray-400 mr-1 truncate max-w-[50vw] md:max-w-none",children:[t??"untitled.smdf.json",r&&(0,o.jsx)("span",{className:"text-yellow-500 ml-0.5",children:"●"})]}),(0,o.jsx)(tB,{}),"synced"===v&&(0,o.jsx)("span",{className:"text-[10px] text-emerald-500",title:"In sync with disk",children:"⌁ synced"}),"remote-changed"===v&&(0,o.jsx)("span",{className:"text-[10px] text-amber-400",title:w??"",children:"↻ remote changed"}),"error"===v&&(0,o.jsx)("span",{className:"text-[10px] text-red-400",title:w??"",children:"⚠ disk error"}),"idle"===v&&(0,o.jsx)("span",{className:"text-[10px] text-gray-600",title:w??"No file bound",children:"○ no disk"}),(0,o.jsx)(tD,{}),(0,o.jsx)("div",{className:"flex-1"})]}),(0,o.jsxs)("div",{className:"toolbar-strip",children:[(0,o.jsx)("button",{onClick:g,disabled:0===y.length,className:"toolbar-btn disabled:opacity-30",title:"Undo (Ctrl+Z)",children:"↩"}),(0,o.jsx)("button",{onClick:x,disabled:0===b.length,className:"toolbar-btn disabled:opacity-30",title:"Redo (Ctrl+Y)",children:"↪"}),(0,o.jsx)("div",{className:"w-px h-4 bg-gray-700"}),(0,o.jsx)("button",{onClick:m,className:"toolbar-btn",title:"Arrange states into layers (auto-layout)",children:"⤢ Arrange"}),(0,o.jsx)("div",{className:"w-px h-4 bg-gray-700"}),(0,o.jsx)("button",{onClick:()=>f("select"===p?"transition":"select"),className:`toolbar-btn ${"transition"===p?"!bg-amber-700 !text-white":""}`,title:"transition"===p?"Exit draw mode (Esc)":"Draw transition mode",children:"transition"===p?"✏️ Drawing":"↗ Draw"}),(0,o.jsx)("div",{className:"w-px h-4 bg-gray-700"}),(0,o.jsx)("button",{onClick:()=>_.current?.click(),className:"toolbar-btn",title:"Open local .smdf.json (browser)",children:"📂"}),(0,o.jsx)("button",{onClick:q,disabled:M,className:"toolbar-btn disabled:opacity-40",title:"Save to disk (STATELOOM_PROJECT_FILE)",children:"💾 Disk"}),(0,o.jsx)("button",{onClick:H,className:"toolbar-btn",title:"Reload from disk",children:"🔄"}),(0,o.jsx)("button",{onClick:()=>{let e=new Blob([i()],{type:"application/json"}),n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t??"statemachine.smdf.json",r.click(),URL.revokeObjectURL(n)},className:"toolbar-btn",title:"Download as file",children:"📥"}),(0,o.jsx)("select",{value:T,onChange:e=>{$(e.target.value),F(null),B(null)},className:"bg-gray-800 border border-gray-700 rounded text-xs text-gray-300 px-1 py-0.5",title:"Export format",children:tj.map(e=>(0,o.jsx)("option",{value:e,children:tN[e]},e))}),(0,o.jsx)("button",{onClick:U,disabled:P,className:`toolbar-btn disabled:opacity-40 ${L?"!text-red-400":""}`,title:L??`Export the board as ${tN[T]}`,children:P?"…":"🖼 Export"}),D&&!L&&(0,o.jsxs)("span",{className:"text-[10px] text-emerald-500 truncate max-w-[40vw] md:max-w-[16rem]",title:D,children:["⤓ ",D]}),(0,o.jsx)("div",{className:"w-px h-4 bg-gray-700"}),C?(0,o.jsxs)("div",{className:"flex items-center gap-1",children:[(0,o.jsx)("input",{autoFocus:!0,className:"bg-gray-800 border border-gray-700 rounded px-2 py-0.5 text-xs text-gray-200 w-32 md:w-24",placeholder:"State name...",value:R,onChange:e=>O(e.target.value),onKeyDown:e=>{"Enter"===e.key&&J(),"Escape"===e.key&&E(!1)}}),(0,o.jsx)("button",{onClick:J,className:"toolbar-btn-sm",children:"✓"}),(0,o.jsx)("button",{onClick:()=>E(!1),className:"toolbar-btn-sm",children:"✕"})]}):(0,o.jsx)("button",{onClick:()=>E(!0),className:"toolbar-btn",children:"+State"}),(0,o.jsx)("div",{className:"w-px h-4 bg-gray-700"}),(0,o.jsx)("button",{onClick:()=>c(),className:"toolbar-btn",children:"✓ Validate"}),(0,o.jsxs)("select",{value:Y,onChange:e=>V(e.target.value),className:"bg-gray-800 border border-gray-700 rounded text-xs text-gray-300 px-1 py-0.5",children:[(0,o.jsx)("option",{value:"python",children:"Python"}),(0,o.jsx)("option",{value:"typescript",children:"TypeScript"})]}),(0,o.jsx)("button",{onClick:z,className:"toolbar-btn",children:"⚡ Generate"}),(0,o.jsx)("button",{onClick:X,className:"toolbar-btn",title:"Generate RISE rispec markdown",children:"📜 RISE"}),(0,o.jsxs)("button",{onClick:()=>h(!d),className:`toolbar-btn ${d?"text-blue-400":""}`,children:["</>"," Code"]})]})]})}function tq(){let e=tx(e=>e.generatedCode),t=tx(e=>e.showCodePreview),n=tx(e=>e.setShowCodePreview);return t?(0,o.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/60 p-2 md:p-0",children:(0,o.jsxs)("div",{className:"bg-gray-900 border border-gray-700 rounded-lg shadow-xl w-full max-h-[85dvh] md:w-[80%] md:max-w-3xl md:max-h-[80dvh] flex flex-col",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-800",children:[(0,o.jsx)("h3",{className:"text-sm font-semibold text-gray-300",children:"Generated Definition (JSON)"}),(0,o.jsx)("button",{onClick:()=>n(!1),className:"text-gray-500 hover:text-gray-300 text-lg min-h-11 min-w-11 md:min-h-0 md:min-w-0","aria-label":"Close preview",children:"✕"})]}),(0,o.jsx)("pre",{className:"flex-1 overflow-auto overscroll-contain p-4 text-[11px] leading-relaxed text-green-400 font-mono md:text-sm",children:e??"No code generated yet"}),(0,o.jsx)("div",{className:"flex justify-end px-4 py-2 border-t border-gray-800",children:(0,o.jsx)("button",{onClick:()=>{e&&navigator.clipboard.writeText(e)},className:"text-xs bg-gray-700 hover:bg-gray-600 text-gray-300 px-4 py-3 rounded md:px-3 md:py-1",children:"Copy to Clipboard"})})]})}):null}function tU(){let e=tx(e=>e.applyRemote),t=tx(e=>e.setRemoteStatus),n=tx(e=>e.setRemoteMtime),r=(0,tL.useRequestedDoc)();return(0,l.useEffect)(()=>{let s=!1,i=(0,tL.docQuery)(r);async function a(){try{let e=await fetch(`/api/file${i}`,{cache:"no-store"});if(!e.ok)return null;return await e.json()}catch{return null}}(async()=>{let n=await a();s||(n?.path&&tx.getState().setDocPath(n.path),n?.exists&&n.content?e(n.content,n.mtime,n.path.split("/").pop()):t("idle",n?`No file at ${n.path}`:null))})();let o=new EventSource(`/api/watch${i}`);return o.addEventListener("hello",e=>{try{let t=JSON.parse(e.data);"number"==typeof t?.mtime&&n(t.mtime)}catch{}}),o.addEventListener("change",async r=>{let s=0;try{s=JSON.parse(r.data)?.mtime??0}catch{}if(s<=(tx.getState().remoteMtime??0))return;let i=await a();i?.exists&&i.content&&(tx.getState().dirty?(t("remote-changed",`Disk changed at ${new Date(i.mtime).toLocaleTimeString()} — local has unsaved edits`),n(i.mtime)):e(i.content,i.mtime,i.path.split("/").pop()))}),o.addEventListener("error",()=>{t("error","Watch stream disconnected")}),()=>{s=!0,o.close()}},[e,t,n,r]),null}function tH({url:e}){let t=(0,tL.useRequestedDoc)();return(0,l.useEffect)(()=>{if(!e)return;let n=!1,r=null,s=null,i=null,a=null;return(async()=>{let o="";try{let e=await fetch(`/api/file${(0,tL.docQuery)(t)}`,{cache:"no-store"});e.ok&&(o=(await e.json())?.path??"")}catch{}n||(o&&tx.getState().setDocPath(o),(r=function(e){let{onFull:t,onPatch:n,onPresence:r,...s}=e,i=function(e){let{url:t,role:n,docId:r,name:s,token:i}=e,a=!1!==e.autoResync,o=ti(t,{auth:{token:i},autoConnect:!1}),l="disconnected",c=0,d="",h=[],u={patch:new Set,full:new Set,ack:new Set,presence:new Set,error:new Set,status:new Set};function p(e,t){for(let n of[...u[e]])n(t)}function f(e){l!==e&&(l=e,p("status",e))}function m(e){o.emit("def:request",{docId:r,sinceSeq:e})}function g(e){"number"==typeof e&&(a&&e>c+1&&m(c),c=Math.max(c,e))}function x(){p("presence",[...h])}function y(){return o.connected?Promise.resolve():new Promise((e,t)=>{f("connecting");let n=()=>{s(),e()},r=e=>{s(),t(e)},s=()=>{o.off("connect",n),o.off("connect_error",r)};o.once("connect",n),o.once("connect_error",r),o.connect()})}async function b(){return await y(),new Promise((e,t)=>{o.emit("bridge:join",{docId:r,role:n,name:s},n=>{if(!n||n.error){let e=n?.error??{code:"join_failed",message:"no join ack"};p("error",e),t(Error(`${e.code}: ${e.message}`));return}d=n.selfId,h=n.presence?[...n.presence]:[],c=n.snapshot?.seq??0,x(),e({selfId:d,snapshot:n.snapshot,presence:[...h]})})})}return o.on("connect",()=>f("connected")),o.on("disconnect",()=>f("disconnected")),o.on("connect_error",e=>{f("error"),p("error",{code:"connect_error",message:e?.message??String(e)})}),o.on("def:patch",e=>{g(e?.seq),e?.origin&&e.origin===d||p("patch",e)}),o.on("def:full",e=>{g(e?.seq),e?.origin&&e.origin===d||p("full",e)}),o.on("def:ack",e=>{p("ack",e)}),o.on("bridge:error",e=>{p("error",{code:e?.code??"error",message:e?.message??""})}),o.on("presence:list",e=>{h=Array.isArray(e)?[...e]:[],x()}),o.on("presence:join",e=>{let t=ta(e);t&&(h=[...h.filter(e=>e.clientId!==t),e],x())}),o.on("presence:leave",e=>{let t=ta(e);t&&(h=h.filter(e=>e.clientId!==t),x())}),o.on("presence:update",e=>{let t=ta(e);if(!t)return;let n=h.findIndex(e=>e.clientId===t);if(-1===n)h=[...h,e];else{let t={...h[n],...e};h=h.map((e,r)=>r===n?t:e)}x()}),{connect:y,join:b,emitPatch:function(e,t,n){o.emit("def:patch",{docId:r,ops:e,origin:d,baseSeq:n,mtime:t})},emitFull:function(e,t){o.emit("def:full",{docId:r,def:e,origin:d,mtime:t})},request:m,updatePresence:function(e){o.emit("presence:update",{docId:r,clientId:d,cursor:e.cursor,selection:e.selection})},on:function(e,t){let n=u[e];return n.add(t),()=>n.delete(t)},disconnect:function(){o.connected&&d&&o.emit("bridge:leave",{docId:r,clientId:d}),o.disconnect(),f("disconnected")},get status(){return l},get lastSeq(){return c},get presence(){return[...h]}}}(s),a=null,o=0,l=[],c=[],d={status:i.status,def:null,seq:0,presence:[],activeStates:[]},h=new Set;function u(){for(let e of(d={status:i.status,def:a,seq:o,presence:l,activeStates:c},[...h]))e()}return i.on("status",()=>u()),i.on("full",e=>{a=e.def,"number"==typeof e.seq&&(o=e.seq),t?.(e),u()}),i.on("patch",e=>{"number"==typeof e.seq&&(o=e.seq);let t=e.ops??[],r=t.filter(to),s=t.filter(e=>!to(e));s.length>0&&a&&(a=p(a,s));for(let e of r)"runtime.enter"===e.op?c.includes(e.state)||(c=[...c,e.state]):"runtime.exit"===e.op&&c.includes(e.state)&&(c=c.filter(t=>t!==e.state));n?.(e),u()}),i.on("presence",e=>{l=e,r?.(e),u()}),{getSnapshot:function(){return d},subscribe:function(e){return h.add(e),()=>{h.delete(e)}},emitPatch:function(e){i.emitPatch(e)},emitFull:function(e){i.emitFull(e)},enter:function(e,t,n){let r={op:"runtime.enter",state:e,...void 0!==t?{from:t}:{},...void 0!==n?{eventId:n}:{}};i.emitPatch([r])},exit:function(e){i.emitPatch([{op:"runtime.exit",state:e}])},connect:function(){i.join().then(e=>{a=e.snapshot.def,o=e.snapshot.seq,l=e.presence,null!==a&&t?.({docId:e.snapshot.docId,def:a,seq:o,mtime:e.snapshot.mtime,origin:"join"}),u()}).catch(()=>{u()})},disconnect:function(){i.disconnect()}}}({url:e,role:"web",docId:o,name:"web-designer",onFull:e=>{tx.getState().applyRemote(JSON.stringify({stateMachine:e.def}),e.mtime??Date.now(),o&&o.split("/").pop()||void 0),a=e.def},onPatch:e=>{tx.getState().applyRemoteOps(e.ops,e.mtime??Date.now(),e.seq),a=tx.getState().definition},onPresence:e=>{tx.getState().setPresence(e)}})).connect(),s=tx.subscribe((e,t)=>{e.definition===t.definition||e._applyingRemote||(i&&clearTimeout(i),i=setTimeout(()=>{var e,t;let n,s;if(!r||"connected"!==r.getSnapshot().status)return;let i=tx.getState().definition;if(null===a){r.emitFull(i),a=i;return}let o=(e=a,t=i,n=e??{settings:{namespace:"",asynchronous:!1},events:[],state:{name:t.state.name,states:[]}},function(e,t,n){let r={},s=!1,i=new Set([...Object.keys(e.settings),...Object.keys(t.settings)]),a=e.settings,o=t.settings;for(let e of i)g(a[e],o[e])||void 0===o[e]||(r[e]=o[e],s=!0);s&&n.push({op:"settings.update",patch:r})}(n,t,s=[]),function(e,t,n){let r=e.events,s=t.events,i=Math.min(r.length,s.length);for(let e=0;e<i;e++)!function(e,t,n,r){let s={},i=!1;for(let e of["name","file","feeder","description","timers"])g(t[e],n[e])||void 0===n[e]||(s[e]=n[e],i=!0);i&&r.push({op:"eventSource.update",index:e,patch:s});let a=t.events??[],o=n.events??[],l=new Set(o.map(e=>e.id));for(let e of a)l.has(e.id)||r.push({op:"event.remove",id:e.id});let c=a.filter(e=>l.has(e.id)),d=0;for(;d<o.length;){let t=o[d];d<c.length&&c[d].id===t.id?(function(e,t,n){let r={},s=!1;for(let n of["name","description","preAction","postAction"])g(e[n],t[n])||void 0===t[n]||(r[n]=t[n],s=!0);s&&n.push({op:"event.update",id:t.id,patch:r})}(c[d],t,r),function(e,t,n,r){let s=Math.min(t.length,n.length);for(let i=0;i<s;i++)if(!g(t[i],n[i])){let s={};t[i].name!==n[i].name&&(s.name=n[i].name),t[i].type!==n[i].type&&(s.type=n[i].type),r.push({op:"parameter.update",eventId:e,index:i,patch:s})}for(let t=s;t<n.length;t++)r.push({op:"parameter.add",eventId:e,parameter:n[t],index:t});for(let s=t.length-1;s>=n.length;s--)r.push({op:"parameter.remove",eventId:e,index:s})}(t.id,c[d].parameters??[],t.parameters??[],r)):(r.push({op:"event.add",sourceIndex:e,event:t,index:d}),c.splice(d,0,t)),d++}}(e,r[e],s[e],n);for(let e=r.length;e<s.length;e++)n.push({op:"eventSource.add",source:s[e]});for(let e=r.length-1;e>=s.length;e--)n.push({op:"eventSource.remove",index:e})}(n,t,s),function(e,t,n){let r=f(e.state),s=f(t.state),i=new Map(r.map(e=>[e.name,e])),a=new Map(s.map(e=>[e.name,e])),o=m(e.state),l=m(t.state),c=[];for(let e of s){if(i.has(e.name))continue;let t=l.get(e.name)??null,{states:r,transitions:s,...a}=e;n.push({op:"state.add",parent:t,state:{...a}}),s&&s.length>0&&c.push({state:e.name,transitions:s})}for(let e of s){if(!i.has(e.name))continue;let t=o.get(e.name)??null,r=l.get(e.name)??null;t!==r&&null!==r&&n.push({op:"state.nest",child:e.name,newParent:r})}for(let e of s){let t=i.get(e.name);if(!t)continue;let r={},s=!1;g(t.kind,e.kind)||void 0===e.kind||(r.kind=e.kind,s=!0),g(t.description,e.description)||void 0===e.description||(r.description=e.description,s=!0),s&&n.push({op:"state.update",name:e.name,patch:r}),x(e.name,"onEntry",t.onEntry?.actions??[],e.onEntry?.actions??[],n),x(e.name,"onExit",t.onExit?.actions??[],e.onExit?.actions??[],n)}for(let e of c)e.transitions.forEach((t,r)=>{n.push({op:"transition.add",state:e.state,transition:t,index:r})});for(let e of s){let t=i.get(e.name);t&&function(e,t,n,r){let s=Math.min(t.length,n.length);for(let i=0;i<s;i++){if(g(t[i],n[i]))continue;let s={};for(let e of["event","nextState","condition","description","actions"])g(t[i][e],n[i][e])||void 0===n[i][e]||(s[e]=n[i][e]);Object.keys(s).length>0&&r.push({op:"transition.update",state:e,index:i,patch:s})}for(let t=s;t<n.length;t++)r.push({op:"transition.add",state:e,transition:n[t],index:t});for(let s=t.length-1;s>=n.length;s--)r.push({op:"transition.remove",state:e,index:s})}(e.name,t.transitions??[],e.transitions??[],n)}for(let e=r.length-1;e>=0;e--){let t=r[e];if(a.has(t.name))continue;let s=t.transitions??[];for(let e=s.length-1;e>=0;e--)n.push({op:"transition.remove",state:t.name,index:e});n.push({op:"state.remove",name:t.name})}}(n,t,s),s);0!==o.length&&(r.emitPatch(o),a=i)},60))}))})(),()=>{n=!0,i&&clearTimeout(i),s&&s(),r&&r.disconnect()}},[e,t]),null}function tJ(){let e=b.default.env.NEXT_PUBLIC_STATELOOM_BRIDGE_URL??b.default.env.NEXT_PUBLIC_SMCRAFT_BRIDGE_URL;return"string"==typeof e&&e.length>0?e:void 0}let tY=null;function tV(){let e=tJ(),[t,n]=(0,l.useState)(e);return((0,l.useEffect)(()=>{let e=!0;return(tY||(tY=(async()=>{let e=tJ()??null;try{let t=await fetch("/api/config",{cache:"no-store"});if(t.ok){let n=await t.json();return{bridgeUrl:n.bridgeUrl||e,projectFile:n.projectFile??null}}}catch{}return{bridgeUrl:e,projectFile:null}})())).then(t=>{e&&t.bridgeUrl&&n(t.bridgeUrl)}),()=>{e=!1}},[]),"string"==typeof t&&t.length>0)?(0,o.jsx)(tH,{url:t}):(0,o.jsx)(tU,{})}let tX="stateloom.uiScale.v1";function tz(e){return Number.isFinite(e)?Math.min(1.75,Math.max(.75,e)):1}function tW(e){"u">typeof document&&(document.documentElement.style.fontSize=`${16*tz(e)}px`)}let tK=1,tG=!1,tQ=new Set;function tZ(){return tG||(tG=!0,tK=function(){try{let e=window.localStorage.getItem(tX);if(null===e)return 1;return tz(Number.parseFloat(e))}catch{return 1}}()),tK}function t0(){return 1}function t1(e){return tQ.add(e),()=>{tQ.delete(e)}}function t2(e,t){let n=tz(e);if(tW(n),t&&function(e){try{window.localStorage.setItem(tX,String(tz(e)))}catch{}}(n),tG=!0,n!==tK)for(let e of(tK=n,tQ))e()}function t5(e,t){return Math.max(1,Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY))}function t4(e,t){for(let n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return null}function t3(){let e=(0,l.useSyncExternalStore)(t1,tZ,t0),t=(0,l.useRef)(null),n=(0,l.useRef)(null),r=(0,l.useRef)(null);(0,l.useEffect)(()=>{tW(e)},[e]);let s=(0,l.useCallback)(e=>{n.current=e,null===r.current&&(r.current=requestAnimationFrame(()=>{r.current=null,null!==n.current&&t2(n.current,!1)}))},[]),i=(0,l.useCallback)(()=>{n.current=null,t2(1,!0)},[]);return((0,l.useEffect)(()=>{let e=()=>{let e=t.current;if(t.current=null,!e?.engaged)return;null!==r.current&&(cancelAnimationFrame(r.current),r.current=null);let s=n.current??tZ();n.current=null,t2(tz(s),!0)},i=n=>{if(2!==n.touches.length){t.current&&e();return}let[r,s]=[n.touches[0],n.touches[1]];tv(r.target)||tv(s.target)||(t.current={a:r.identifier,b:s.identifier,startScale:tZ(),startDist:t5(r,s),engaged:!1})},a=e=>{let n=t.current;if(!n)return;let r=t4(e.touches,n.a),i=t4(e.touches,n.b);if(!r||!i)return;e.preventDefault();let a=t5(r,i);if(!n.engaged){if(12>Math.abs(a-n.startDist))return;n.engaged=!0,n.startDist=a;return}s(tz(n.startScale*(a/n.startDist)))},o=n=>{let r=t.current;r&&(t4(n.touches,r.a)&&t4(n.touches,r.b)||e())};return document.addEventListener("touchstart",i,{passive:!0,capture:!0}),document.addEventListener("touchmove",a,{passive:!1,capture:!0}),document.addEventListener("touchend",o,{passive:!0,capture:!0}),document.addEventListener("touchcancel",o,{passive:!0,capture:!0}),()=>{document.removeEventListener("touchstart",i,{capture:!0}),document.removeEventListener("touchmove",a,{capture:!0}),document.removeEventListener("touchend",o,{capture:!0}),document.removeEventListener("touchcancel",o,{capture:!0}),null!==r.current&&cancelAnimationFrame(r.current)}},[s]),1===e)?null:(0,o.jsxs)("div",{className:"ui-scale-pill",role:"status","aria-live":"polite",children:[(0,o.jsxs)("span",{children:["UI ",Math.round(100*e),"%"]}),(0,o.jsx)("button",{type:"button",onClick:i,"aria-label":"Reset interface size to 100 percent",children:"Reset"})]})}function t6(){var e,t;let n,r,[s,i]=(0,l.useState)("properties"),[a,c]=(0,l.useState)(!1),d=tx(e=>e.errors),h=tx(e=>e.contextMenu),u=tx(e=>e.hideContextMenu),p=tx(e=>e.addState),f=tx(e=>e.removeState),m=tx(e=>e.setDrawMode),g=tx(e=>e.setDrawSource),x=[{id:"properties",label:"Properties",icon:"🎛"},{id:"events",label:"Events",icon:"⚡"},{id:"settings",label:"Settings",icon:"⚙"},{id:"validation",label:"Errors",icon:"⚠",badge:d.length||void 0}],y=x.find(e=>e.id===s)?.label??"";return(0,o.jsxs)("div",{className:"app-shell dock-offset flex flex-col overflow-hidden",onClick:()=>h.visible&&u(),children:[(0,o.jsx)(tV,{}),(0,o.jsx)(t3,{}),(0,o.jsx)(tF,{}),(0,o.jsxs)("div",{className:"flex flex-1 min-h-0 overflow-hidden relative",children:[(0,o.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,o.jsx)(tO,{})}),a&&(0,o.jsx)("div",{className:"fixed inset-0 z-20 bg-black/50 md:hidden",onClick:()=>c(!1),"aria-hidden":"true"}),(0,o.jsxs)("aside",{className:`safe-x fixed inset-x-0 bottom-0 z-30 h-[70dvh] flex flex-col overflow-hidden rounded-t-2xl border-t border-gray-800 bg-gray-900 shadow-2xl transition-transform duration-200 ease-out ${a?"translate-y-0":"translate-y-full pointer-events-none"} md:static md:z-auto md:h-auto md:w-80 md:translate-y-0 md:pointer-events-auto md:rounded-none md:border-t-0 md:border-l md:shadow-none md:transition-none`,children:[(0,o.jsxs)("div",{className:"md:hidden",children:[(0,o.jsx)("div",{className:"flex justify-center pt-2 pb-1",children:(0,o.jsx)("span",{className:"h-1 w-10 rounded-full bg-gray-700"})}),(0,o.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-800 px-4 pb-2",children:[(0,o.jsx)("h2",{className:"text-sm font-semibold text-gray-300",children:y}),(0,o.jsx)("button",{onClick:()=>c(!1),className:"-mr-2 px-3 py-2 text-lg text-gray-400","aria-label":"Close panel",children:"✕"})]})]}),(0,o.jsx)("div",{className:"hidden border-b border-gray-800 md:flex",children:x.map(e=>(0,o.jsxs)("button",{onClick:()=>i(e.id),className:`flex-1 text-xs py-2 px-1 text-center transition-colors relative ${s===e.id?"text-blue-400 border-b-2 border-blue-400 bg-gray-800/50":"text-gray-500 hover:text-gray-300"}`,children:[e.label,void 0!==e.badge&&e.badge>0&&(0,o.jsx)("span",{className:"absolute top-1 right-1 bg-red-600 text-white text-[9px] rounded-full px-1 min-w-[14px]",children:e.badge})]},e.id))}),(0,o.jsxs)("div",{className:"touch-targets dock-offset flex-1 overflow-y-auto overscroll-contain",children:["properties"===s&&(0,o.jsx)(tA,{}),"events"===s&&(0,o.jsx)(t$,{}),"settings"===s&&(0,o.jsx)(tP,{}),"validation"===s&&(0,o.jsx)(tI,{})]})]}),(0,o.jsx)(tq,{})]}),(0,o.jsx)("nav",{className:"dock-safe safe-x fixed inset-x-0 bottom-0 z-40 flex border-t border-gray-800 bg-gray-900/95 backdrop-blur-md md:hidden",children:x.map(e=>{let t=a&&s===e.id;return(0,o.jsxs)("button",{onClick:()=>{var t;return t=e.id,void(c(e=>!(e&&s===t)),i(t))},"aria-pressed":t,className:`relative flex h-14 flex-1 flex-col items-center justify-center gap-0.5 text-[11px] transition-colors ${t?"text-blue-400":"text-gray-500"}`,children:[(0,o.jsx)("span",{className:"text-base leading-none",children:e.icon}),(0,o.jsx)("span",{children:e.label}),void 0!==e.badge&&e.badge>0&&(0,o.jsx)("span",{className:"absolute top-1 right-1/2 translate-x-4 rounded-full bg-red-600 px-1 text-[10px] leading-4 text-white min-w-[16px]",children:e.badge}),t&&(0,o.jsx)("span",{className:"absolute inset-x-4 top-0 h-0.5 rounded-full bg-blue-400"})]},e.id)})}),h.visible&&(0,o.jsx)("div",{className:"fixed z-50 bg-gray-900 border border-gray-700 rounded-lg shadow-xl py-1 min-w-[180px] md:min-w-[140px]",style:(e=h.x,t=h.y,n=window.innerWidth,r=window.innerHeight,{left:e,top:t,maxWidth:"calc(100vw - 1rem)",maxHeight:"calc(100dvh - 1rem)",overflowY:"auto",transform:`translate(${n>0&&e>n/2?"-100%":"0"}, ${r>0&&t>r/2?"-100%":"0"})`}),onClick:e=>e.stopPropagation(),children:h.target?.kind==="state"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{className:"block w-full text-left text-sm text-gray-300 hover:bg-gray-800 px-4 py-3 md:text-xs md:px-3 md:py-1.5",onClick:()=>{m("transition"),g(h.target.id),u()},children:"↗ Draw transition from here"}),(0,o.jsx)("button",{className:"block w-full text-left text-sm text-red-400 hover:bg-gray-800 px-4 py-3 md:text-xs md:px-3 md:py-1.5",onClick:()=>{h.target?.id&&f(h.target.id),u()},children:"🗑 Delete state"})]}):(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("button",{className:"block w-full text-left text-sm text-gray-300 hover:bg-gray-800 px-4 py-3 md:text-xs md:px-3 md:py-1.5",onClick:()=>{let e=prompt("State name:");e&&p(null,{name:e,kind:"normal"}),u()},children:"+ Add state here"})})})]})}e.s(["default",()=>t6],63052)}]);