elanous 0.2.15 → 0.2.16

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 (254) hide show
  1. package/apps/pwa/out/404/index.html +1 -1
  2. package/apps/pwa/out/404.html +1 -1
  3. package/apps/pwa/out/_next/static/chunks/{1307-33ffcc49ab45123b.js → 1307-b46d45b705e8c9ae.js} +1 -1
  4. package/apps/pwa/out/_next/static/chunks/{9103-7a3ae7f60af3b99f.js → 9103-60fbef33e66f0a46.js} +1 -1
  5. package/apps/pwa/out/_next/static/chunks/app/approvals/page-79c3ed84baaedd03.js +1 -0
  6. package/apps/pwa/out/_next/static/chunks/app/autopilot/{page-e05a77df7e005b04.js → page-3cb52e5ea8fc2fa5.js} +1 -1
  7. package/apps/pwa/out/_next/static/chunks/app/board/page-a424ef80885d1743.js +1 -0
  8. package/apps/pwa/out/_next/static/chunks/app/botlab/{page-5491c115b1f9a923.js → page-c1e20d7d338713f1.js} +1 -1
  9. package/apps/pwa/out/_next/static/chunks/app/bots/{page-b8c49f6b4fa2df91.js → page-482c5dbde699947c.js} +1 -1
  10. package/apps/pwa/out/_next/static/chunks/app/ceo/page-1e962b31d1f11081.js +1 -0
  11. package/apps/pwa/out/_next/static/chunks/app/chat/{page-976813c91d7394ea.js → page-8c2d9526164f5d09.js} +1 -1
  12. package/apps/pwa/out/_next/static/chunks/app/consult/page-ffff6d819fbc6e0f.js +1 -0
  13. package/apps/pwa/out/_next/static/chunks/app/control/page-a0e2a6d1bfb52fc5.js +1 -0
  14. package/apps/pwa/out/_next/static/chunks/app/design-check/{page-72d3e7ff35a8c954.js → page-c53598cfce6156f2.js} +1 -1
  15. package/apps/pwa/out/_next/static/chunks/app/editor/{page-60c7a8e1a4fe62ce.js → page-13a63953f53c6a23.js} +1 -1
  16. package/apps/pwa/out/_next/static/chunks/app/exec/{page-2a52b316cb143d9c.js → page-5d3c8429d04f3831.js} +1 -1
  17. package/apps/pwa/out/_next/static/chunks/app/field/{page-c3ce483c8d5db370.js → page-3193bdc0bbab047a.js} +1 -1
  18. package/apps/pwa/out/_next/static/chunks/app/inside/page-76270efaee638f17.js +1 -0
  19. package/apps/pwa/out/_next/static/chunks/app/intake/{page-96f074f6538e8a2c.js → page-6107ca8ddd5e3bdd.js} +1 -1
  20. package/apps/pwa/out/_next/static/chunks/app/{layout-e97be5334d83a9f5.js → layout-dce686e582c23937.js} +1 -1
  21. package/apps/pwa/out/_next/static/chunks/app/live/page-d3d53b146416e422.js +1 -0
  22. package/apps/pwa/out/_next/static/chunks/app/loops/page-1a61c7ca1ceb3ae7.js +1 -0
  23. package/apps/pwa/out/_next/static/chunks/app/market/{page-955ec2da3be4c560.js → page-51f811fa119308b6.js} +1 -1
  24. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/{page-9f88fbc15d9058d1.js → page-dacff46049e1557e.js} +1 -1
  25. package/apps/pwa/out/_next/static/chunks/app/morning/{page-c1343f9499d86f3f.js → page-4167348049166852.js} +1 -1
  26. package/apps/pwa/out/_next/static/chunks/app/{not-found-8739a2e0ae793130.js → not-found-de52e8fdf9095f7a.js} +1 -1
  27. package/apps/pwa/out/_next/static/chunks/app/observatory/{page-c9fc5706b8abaa11.js → page-36a7d994f4ca0299.js} +1 -1
  28. package/apps/pwa/out/_next/static/chunks/app/ops/checklist/{page-d23b12bb92242558.js → page-ca3952cd78a83ca2.js} +1 -1
  29. package/apps/pwa/out/_next/static/chunks/app/ops/release/page-5b042736aa113756.js +1 -0
  30. package/apps/pwa/out/_next/static/chunks/app/ops/seats/{page-c7fea475488201a8.js → page-acb749f1e432bcf3.js} +1 -1
  31. package/apps/pwa/out/_next/static/chunks/app/outputs/page-cd78862707999911.js +1 -0
  32. package/apps/pwa/out/_next/static/chunks/app/page-54b9ef8afe6278fd.js +1 -0
  33. package/apps/pwa/out/_next/static/chunks/app/reflection/{page-5efbf81124c474ae.js → page-1ebfe049c640e171.js} +1 -1
  34. package/apps/pwa/out/_next/static/chunks/app/scheduler/{page-85f1a1fc0a82738c.js → page-57924393e3e4e539.js} +1 -1
  35. package/apps/pwa/out/_next/static/chunks/app/sessions/page-9e0ce6c8129fa641.js +1 -0
  36. package/apps/pwa/out/_next/static/chunks/app/settings/devices/{page-06ee266953d9c879.js → page-31fa1ce4c4aff9ae.js} +1 -1
  37. package/apps/pwa/out/_next/static/chunks/app/settings/{page-153c2b3bcc89e8de.js → page-0f5cd57ca928f42b.js} +1 -1
  38. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-abe8e3b74bea1ffc.js +1 -0
  39. package/apps/pwa/out/_next/static/chunks/app/setup/page-4364ef9f4e7c7f0f.js +1 -0
  40. package/apps/pwa/out/_next/static/chunks/app/share/{page-0d6d23b40263a7ea.js → page-d28573d6792b4275.js} +1 -1
  41. package/apps/pwa/out/_next/static/chunks/app/showroom/page-59f03fda76c03d22.js +1 -0
  42. package/apps/pwa/out/_next/static/chunks/app/tasks/page-d751de5f8062ff5e.js +1 -0
  43. package/apps/pwa/out/_next/static/chunks/app/term/{page-f5597e894c02cd33.js → page-fe1759f94003b32b.js} +1 -1
  44. package/apps/pwa/out/_next/static/chunks/app/today/{page-0337fdf7fb5e37b6.js → page-d64c984e855c8c68.js} +1 -1
  45. package/apps/pwa/out/_next/static/chunks/app/trace/page-86914b0dee8ab7f8.js +1 -0
  46. package/apps/pwa/out/_next/static/chunks/app/vault/{page-8fcec4c9ea2e7f70.js → page-9afdee66b820c76e.js} +1 -1
  47. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/{page-f7e631e9b4daf66e.js → page-d4aef67abf264874.js} +1 -1
  48. package/apps/pwa/out/_next/static/chunks/app/workflows/page-1ea64acadd704ace.js +1 -0
  49. package/apps/pwa/out/_next/static/chunks/app/workspace/{page-9817c7f9007466cc.js → page-3544f154c87b43ee.js} +1 -1
  50. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-30c2073bfc21c004.js +1 -0
  51. package/apps/pwa/out/_next/static/css/001d5fbaee388a25.css +1 -0
  52. package/apps/pwa/out/_next/static/css/{04dabcbcc4bfa6db.css → 085673d826b98b62.css} +1 -1
  53. package/apps/pwa/out/approvals/index.html +1 -1
  54. package/apps/pwa/out/approvals/index.txt +15 -15
  55. package/apps/pwa/out/autopilot/index.html +1 -1
  56. package/apps/pwa/out/autopilot/index.txt +15 -15
  57. package/apps/pwa/out/board/index.html +1 -1
  58. package/apps/pwa/out/board/index.txt +15 -15
  59. package/apps/pwa/out/botlab/index.html +1 -1
  60. package/apps/pwa/out/botlab/index.txt +15 -15
  61. package/apps/pwa/out/bots/index.html +1 -1
  62. package/apps/pwa/out/bots/index.txt +15 -15
  63. package/apps/pwa/out/ceo/index.html +1 -1
  64. package/apps/pwa/out/ceo/index.txt +15 -15
  65. package/apps/pwa/out/chat/index.html +1 -1
  66. package/apps/pwa/out/chat/index.txt +15 -15
  67. package/apps/pwa/out/consult/index.html +1 -1
  68. package/apps/pwa/out/consult/index.txt +15 -15
  69. package/apps/pwa/out/control/index.html +1 -1
  70. package/apps/pwa/out/control/index.txt +15 -15
  71. package/apps/pwa/out/design-check/index.html +1 -1
  72. package/apps/pwa/out/design-check/index.txt +15 -15
  73. package/apps/pwa/out/editor/index.html +1 -1
  74. package/apps/pwa/out/editor/index.txt +15 -15
  75. package/apps/pwa/out/exec/index.html +1 -1
  76. package/apps/pwa/out/exec/index.txt +15 -15
  77. package/apps/pwa/out/field/index.html +1 -1
  78. package/apps/pwa/out/field/index.txt +15 -15
  79. package/apps/pwa/out/healthz +1 -1
  80. package/apps/pwa/out/index.html +1 -1
  81. package/apps/pwa/out/index.txt +15 -15
  82. package/apps/pwa/out/inside/index.html +1 -1
  83. package/apps/pwa/out/inside/index.txt +15 -15
  84. package/apps/pwa/out/intake/index.html +1 -1
  85. package/apps/pwa/out/intake/index.txt +15 -15
  86. package/apps/pwa/out/live/index.html +1 -1
  87. package/apps/pwa/out/live/index.txt +15 -15
  88. package/apps/pwa/out/loops/index.html +1 -1
  89. package/apps/pwa/out/loops/index.txt +15 -15
  90. package/apps/pwa/out/market/index.html +1 -1
  91. package/apps/pwa/out/market/index.txt +15 -15
  92. package/apps/pwa/out/missions/placeholder/index.html +1 -1
  93. package/apps/pwa/out/missions/placeholder/index.txt +15 -15
  94. package/apps/pwa/out/morning/index.html +1 -1
  95. package/apps/pwa/out/morning/index.txt +15 -15
  96. package/apps/pwa/out/observatory/index.html +1 -1
  97. package/apps/pwa/out/observatory/index.txt +15 -15
  98. package/apps/pwa/out/ops/checklist/index.html +1 -1
  99. package/apps/pwa/out/ops/checklist/index.txt +15 -15
  100. package/apps/pwa/out/ops/release/index.html +1 -1
  101. package/apps/pwa/out/ops/release/index.txt +15 -15
  102. package/apps/pwa/out/ops/seats/index.html +1 -1
  103. package/apps/pwa/out/ops/seats/index.txt +15 -15
  104. package/apps/pwa/out/outputs/index.html +1 -1
  105. package/apps/pwa/out/outputs/index.txt +15 -15
  106. package/apps/pwa/out/reflection/index.html +1 -1
  107. package/apps/pwa/out/reflection/index.txt +16 -16
  108. package/apps/pwa/out/scheduler/index.html +1 -1
  109. package/apps/pwa/out/scheduler/index.txt +15 -15
  110. package/apps/pwa/out/sessions/index.html +1 -1
  111. package/apps/pwa/out/sessions/index.txt +15 -15
  112. package/apps/pwa/out/settings/devices/index.html +1 -1
  113. package/apps/pwa/out/settings/devices/index.txt +15 -15
  114. package/apps/pwa/out/settings/index.html +1 -1
  115. package/apps/pwa/out/settings/index.txt +15 -15
  116. package/apps/pwa/out/setup/done/index.html +1 -1
  117. package/apps/pwa/out/setup/done/index.txt +15 -15
  118. package/apps/pwa/out/setup/index.html +1 -1
  119. package/apps/pwa/out/setup/index.txt +15 -15
  120. package/apps/pwa/out/share/index.html +1 -1
  121. package/apps/pwa/out/share/index.txt +15 -15
  122. package/apps/pwa/out/showroom/index.html +1 -1
  123. package/apps/pwa/out/showroom/index.txt +15 -15
  124. package/apps/pwa/out/tasks/index.html +1 -1
  125. package/apps/pwa/out/tasks/index.txt +15 -15
  126. package/apps/pwa/out/term/index.html +1 -1
  127. package/apps/pwa/out/term/index.txt +15 -15
  128. package/apps/pwa/out/today/index.html +1 -1
  129. package/apps/pwa/out/today/index.txt +15 -15
  130. package/apps/pwa/out/trace/index.html +1 -1
  131. package/apps/pwa/out/trace/index.txt +15 -15
  132. package/apps/pwa/out/vault/index.html +1 -1
  133. package/apps/pwa/out/vault/index.txt +15 -15
  134. package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
  135. package/apps/pwa/out/workflows/chat-ui/index.txt +15 -15
  136. package/apps/pwa/out/workflows/index.html +1 -1
  137. package/apps/pwa/out/workflows/index.txt +15 -15
  138. package/apps/pwa/out/workspace/index.html +1 -1
  139. package/apps/pwa/out/workspace/index.txt +15 -15
  140. package/apps/pwa/out/worktrees/index.html +1 -1
  141. package/apps/pwa/out/worktrees/index.txt +15 -15
  142. package/graphs/doc-gen/doc-gen.yaml +24 -0
  143. package/graphs/doc-gen/recipes.yaml +3 -0
  144. package/graphs/orchestrator/orchestrator.yaml +7 -0
  145. package/graphs/orchestrator/recipes.yaml +3 -0
  146. package/graphs/steward/recipes.yaml +2 -1
  147. package/package.json +1 -1
  148. package/scripts/ci-public-export-import-gate.ts +154 -0
  149. package/scripts/ci-test-interference-gate.ts +5 -1
  150. package/scripts/ci-typecheck-changed.ts +34 -15
  151. package/scripts/docs/doc-rot.ts +164 -0
  152. package/scripts/docs/generate-graph-anatomy.ts +131 -9
  153. package/scripts/docs-cli-check.ts +4 -4
  154. package/scripts/goals/goal-census.ts +343 -0
  155. package/scripts/measure/author-section-contribution.ts +84 -0
  156. package/scripts/release-loop/cut-branch.ts +43 -13
  157. package/scripts/release-loop/gate-node.ts +3 -1
  158. package/scripts/release-loop/vault-note-node.ts +19 -2
  159. package/scripts/rhythm/monthly.ts +97 -0
  160. package/src/acp/client.ts +17 -2
  161. package/src/agent-mission/driver.ts +51 -1
  162. package/src/agent-mission/supervisor-metrics-cli.ts +40 -0
  163. package/src/agent-mission/supervisor-metrics.ts +218 -0
  164. package/src/autopilot/track-agent-shadow.ts +2 -1
  165. package/src/briefing/brief-items.ts +191 -36
  166. package/src/budget/usage-outcomes.ts +204 -0
  167. package/src/cli/brief-cli.ts +73 -0
  168. package/src/cli/know-cli.ts +20 -0
  169. package/src/cli/logs-cli.ts +43 -1
  170. package/src/cli/pr-cli.ts +80 -12
  171. package/src/cli/release-cli.ts +11 -8
  172. package/src/cli/self-update.ts +200 -1
  173. package/src/cli/usage-cli.ts +26 -0
  174. package/src/discord-self-message.ts +9 -0
  175. package/src/flow-loop/split.ts +24 -0
  176. package/src/harness/harness-cli-command.ts +36 -2
  177. package/src/harness/harness-pod-dispatch.ts +25 -55
  178. package/src/harness/harness-seams.ts +13 -3
  179. package/src/harness/helper-repair.ts +139 -8
  180. package/src/harness/helper-scan.ts +13 -2
  181. package/src/harness/nested-elanous-policy.ts +114 -0
  182. package/src/hq/hq.ts +8 -2
  183. package/src/hq/lease.ts +5 -3
  184. package/src/hq/transfer.ts +185 -0
  185. package/src/index.ts +112 -6
  186. package/src/intake-plane/digest.ts +48 -26
  187. package/src/knowledge/know-find.ts +105 -0
  188. package/src/llm.ts +75 -19
  189. package/src/loops/orchestrator/finish-rate.ts +14 -3
  190. package/src/loops/orchestrator/tick.ts +96 -25
  191. package/src/maturity/bot-slash-catalog.ts +11 -2
  192. package/src/maturity/feature-maturity.ts +2 -2
  193. package/src/maturity/tui-slash-availability.ts +9 -0
  194. package/src/oauth/overload-failover-launch.ts +75 -0
  195. package/src/oauth/overload-failover.ts +137 -0
  196. package/src/release-loop/checklist.ts +10 -5
  197. package/src/release-loop/feature-store.ts +10 -9
  198. package/src/release-loop/placement.ts +17 -8
  199. package/src/seat-dispatch/seat-ask.ts +33 -6
  200. package/src/seat-loop/seat-loop.ts +90 -3
  201. package/src/self-dev/ask-launch-flow.ts +22 -1
  202. package/src/self-dev/authored-goal-trace.ts +64 -0
  203. package/src/self-dev/dev-cli.ts +19 -1
  204. package/src/self-dev/dev-pipeline.ts +6 -5
  205. package/src/self-dev/entrance-registry.ts +10 -6
  206. package/src/self-dev/old-door.ts +73 -0
  207. package/src/self-implement/app-api-budget.ts +166 -0
  208. package/src/self-implement/budget-gate.ts +7 -5
  209. package/src/self-implement/follow-up-goals.ts +289 -0
  210. package/src/self-implement/goal-author.ts +19 -13
  211. package/src/self-implement/heal-triage.ts +44 -0
  212. package/src/self-implement/orchestrator.ts +138 -7
  213. package/src/self-implement/run-ledger.ts +4 -0
  214. package/src/self-implement/seams.ts +44 -15
  215. package/src/session-runtime/index.ts +2 -0
  216. package/src/session-runtime/retry-api.ts +87 -0
  217. package/src/session-runtime/retry-policy.ts +107 -6
  218. package/src/steward/working-backwards.ts +16 -1
  219. package/src/task-cards/card-cli.ts +25 -0
  220. package/src/task-cards/card-store.ts +5 -3
  221. package/src/task-orchestrator/surfaces/pod-ledger-collect.ts +4 -3
  222. package/src/task-orchestrator/surfaces/pod-ledger-prod-sink.ts +75 -0
  223. package/src/task-orchestrator/surfaces/pod-pool.ts +14 -5
  224. package/src/task-orchestrator/surfaces/pod-source-receive.ts +37 -1
  225. package/src/task-orchestrator/surfaces/self-implement-pod.ts +19 -10
  226. package/src/task-orchestrator/surfaces/self-implement.ts +2 -0
  227. package/src/telegram-commands.ts +5 -0
  228. package/src/telegram.ts +47 -0
  229. package/src/user-config.ts +36 -3
  230. package/src/version/packed-revision.json +1 -1
  231. package/apps/pwa/out/_next/static/chunks/app/approvals/page-0e2c57fe6add4b2a.js +0 -1
  232. package/apps/pwa/out/_next/static/chunks/app/board/page-f544338193a9a762.js +0 -1
  233. package/apps/pwa/out/_next/static/chunks/app/ceo/page-96398e364fbd4548.js +0 -1
  234. package/apps/pwa/out/_next/static/chunks/app/consult/page-28b9448091776c06.js +0 -1
  235. package/apps/pwa/out/_next/static/chunks/app/control/page-1d4901eb7c2d8822.js +0 -1
  236. package/apps/pwa/out/_next/static/chunks/app/inside/page-13c7b53e0c2519a9.js +0 -1
  237. package/apps/pwa/out/_next/static/chunks/app/live/page-65e484302921a932.js +0 -1
  238. package/apps/pwa/out/_next/static/chunks/app/loops/page-34d08facaf08f556.js +0 -1
  239. package/apps/pwa/out/_next/static/chunks/app/ops/release/page-8d47f45a0dc044ac.js +0 -1
  240. package/apps/pwa/out/_next/static/chunks/app/outputs/page-e2ee2896811e98d0.js +0 -1
  241. package/apps/pwa/out/_next/static/chunks/app/page-83b19dae8619de05.js +0 -1
  242. package/apps/pwa/out/_next/static/chunks/app/sessions/page-da6c08aae0f92768.js +0 -1
  243. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-87a11e6a05f15199.js +0 -1
  244. package/apps/pwa/out/_next/static/chunks/app/setup/page-7d4182964407c09c.js +0 -1
  245. package/apps/pwa/out/_next/static/chunks/app/showroom/page-7e8c39241f8eb6d0.js +0 -1
  246. package/apps/pwa/out/_next/static/chunks/app/tasks/page-008c1a96618a4887.js +0 -1
  247. package/apps/pwa/out/_next/static/chunks/app/trace/page-73735b64bfe1ae67.js +0 -1
  248. package/apps/pwa/out/_next/static/chunks/app/workflows/page-4881b8f9f63694b4.js +0 -1
  249. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-97f9f43172a3a90e.js +0 -1
  250. package/apps/pwa/out/_next/static/css/1f7c958c41ffa3b9.css +0 -1
  251. package/src/launch-head/seat-goal-queue-lock.fixture.ts +0 -15
  252. package/src/launch-head/seat-goal-queue.ts +0 -198
  253. /package/apps/pwa/out/_next/static/{LZcstaO9_NXypPFmujolv → rv9cierV0jSOvDBm1g0XB}/_buildManifest.js +0 -0
  254. /package/apps/pwa/out/_next/static/{LZcstaO9_NXypPFmujolv → rv9cierV0jSOvDBm1g0XB}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2885],{5997:(e,t,n)=>{"use strict";n.d(t,{Zr:()=>a,f6:()=>l,oD:()=>s});let r="elanous.daemon.sessionId";function l(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function s(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(r,e),e):localStorage.getItem(r)}();if(e)return e;let t=l();return localStorage.setItem(r,t),t}function a(){let e=l();return localStorage.setItem(r,e),e}},15151:(e,t,n)=>{"use strict";n.d(t,{C:()=>d,DaemonProvider:()=>u,Q:()=>c});var r=n(55539),l=n(46124),s=n(8101),a=n(5997),o=n(18060),i=n(72215);let d=(0,l.createContext)(null);function u(e){let{children:t}=e,n={baseUrl:"",token:"",provider:""},[u,c]=(0,l.useState)(n),[m,x]=(0,l.useState)(""),[f]=(0,l.useState)(()=>new o.ki(n));(0,l.useEffect)(()=>{let e=(0,s.Fp)();c(e),f.updateConfig(e),x((0,a.oD)()),(0,i.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[f]),(0,l.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,s.Fp)();f.updateConfig(t),c(t),(0,i.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&x(t=>t===e.newValue?t:((0,i.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[f]);let h=e=>{c(t=>{let n={...t,...e};return(0,s.Qc)(e),f.updateConfig(n),(0,i.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),n})},g=e=>{x(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,i.cY)("webterm.provider.daemon.session-set",{sessionId:e})},p=(0,l.useMemo)(()=>({config:u,setConfig:h,client:f,sessionId:m,setSessionId:g}),[u,f,m]);return(0,r.jsx)(d.Provider,{value:p,children:t})}function c(){let e=(0,l.useContext)(d);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}},17964:(e,t,n)=>{Promise.resolve().then(n.bind(n,75326))},75326:(e,t,n)=>{"use strict";n.d(t,{BotsPageContent:()=>D});var r=n(55539),l=n(46124),s=n(15151),a=n(88744);function o(e){if(null==e)return null;let t=e.replace(/[,%\s]/g,"").replace(/\*/g,"").trim();if(""===t||"-"===t||"N/A"===t)return null;let n=Number(t);return Number.isFinite(n)?n:null}let i=e=>"string"==typeof e&&""!==e?e:null,d=e=>"number"==typeof e&&Number.isFinite(e)?e:null,u=e=>"boolean"==typeof e?e:null;function c(e){var t,n,r,l,s;let a=[],c=[];for(let t of null!=(n=e.artifacts)?n:[]){let e=null!=(r=i(null==t?void 0:t.name))?r:"(이름 없음)",n=i(null==t?void 0:t.text);if(null===n){c.push(e);continue}a.push(function(e,t){var n;let r=function(e){let t=e.split("\n").filter(e=>""!==e.trim()&&!e.includes("━")),n=t.slice(0,3).join(" / ").slice(0,160),r=t.slice(0,3).join("\n");return/^Traceback \(most recent call last\):/m.test(r)?{kindOf:"파이썬 예외(Traceback)",head:n}:/^⛔\s*.*(실패|failed|error)/mi.test(r)?{kindOf:"스킬이 \xab실패\xbb라고 말했다",head:n}:/^(Error|error):/m.test(r)?{kindOf:"오류",head:n}:/^\s*command not found|No such file or directory/m.test(r)?{kindOf:"명령\xb7파일이 \xab없다\xbb",head:n}:null}(t);if(null!==r)return{kind:"failure",name:e,kindOf:r.kindOf,head:r.head};let l=function(e){var t,n,r,l;let s=null!=(l=null!=(r=null==(t=/^대상:\s*(\S+)/m.exec(e))?void 0:t[1])?r:null==(n=/^##\s+(\S+)\s+Real-Time Quote/m.exec(e))?void 0:n[1])?l:null;if(null===s)return null;let a=t=>{var n,r;return null!=(r=null==(n=RegExp("\\*\\*".concat(t,":\\*\\*\\s*([-+0-9.,]+)"),"i").exec(e))?void 0:n[1])?r:null},i=/\*\*Change:\*\*\s*([-+0-9.,]+)\s*\(([-+0-9.]+)%\)/i.exec(e),d={symbol:s,close:o(a("Close")),change:i?o(i[1]):o(a("Change")),changePct:i?o(i[2]):null,open:o(a("Open")),high:o(a("High")),low:o(a("Low")),volume:o(a("Volume")),prevClose:o(a("Prev Close"))};return[d.close,d.change,d.open,d.high,d.low,d.volume,d.prevClose].some(e=>null!==e)?d:null}(t);if(null!==l)return{kind:"quote",name:e,quote:l};let s=null!=(n=function(e){var t,n,r,l,s,a,i,d;let u=e.split("\n"),c=u.findIndex(e=>e.includes("|")&&e.includes("외국인")&&e.includes("기관")&&e.includes("개인"));if(c<0)return null;let m=e=>e.split("|").map(e=>e.trim()).filter((e,t,n)=>""!==e||0!==t&&t!==n.length-1),x=m(u[c]),f=e=>x.findIndex(t=>t.includes(e)),[h,g,p,b]=[0,f("외국인"),f("기관"),f("개인")];if(g<0||p<0||b<0)return null;let j=[];for(let e=c+1;e<u.length;e+=1){let t=u[e];if(!t.includes("|")){if(j.length>0)break;continue}if(/^\s*\|?[\s:|-]+\|?\s*$/.test(t))continue;let n=m(t);if(n.length<=Math.max(g,p,b))continue;let r=(null!=(l=n[h])?l:"").trim();""!==r&&j.push({key:r,foreign:o(n[g]),institution:o(n[p]),individual:o(n[b])})}if(0===j.length)return null;let y="";for(let e=c;e>=0;e-=1){let t=/^#{2,3}\s+(.+)$/.exec((null!=(s=u[e])?s:"").trim());if(t){y=t[1];break}}return""===y&&(y=null!=(a=null==(t=u.find(e=>""!==e.trim()&&!e.includes("━")))?void 0:t.trim())?a:"(제목 없음)"),{title:y,unit:null!=(d=null==(n=/\((백만|천|억)\)/.exec(x.join(" ")))?void 0:n[1])?d:null!=(i=null==(r=/\(([^)]*원[^)]*)\)/.exec(x.join(" ")))?void 0:r[1])?i:null,rows:j}}(t))?n:function(e){let t,n=e.trimStart();if(!n.startsWith("{"))return null;try{t=JSON.parse(n)}catch(e){return null}let r=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(let t of n){let n=e[t];if("number"==typeof n&&Number.isFinite(n))return n}return null},l=[],s=t.periods;if("object"==typeof s&&null!==s&&!Array.isArray(s))for(let[e,t]of Object.entries(s))"object"==typeof t&&null!==t&&l.push({key:e,foreign:r(t,"frgn_net_shares","frgn_net_amount_million"),institution:r(t,"inst_net_shares","inst_net_amount_million"),individual:r(t,"prsn_net_shares","prsn_net_amount_million")});if(0===l.length&&Array.isArray(t.rows))for(let e of t.rows){if("object"!=typeof e||null===e)continue;let t="string"==typeof e.date?e.date:null;null!==t&&l.push({key:t,foreign:r(e,"frgn_net_shares","frgn_net_amount_million"),institution:r(e,"inst_net_shares","inst_net_amount_million"),individual:r(e,"prsn_net_shares","prsn_net_amount_million")})}if(0===l.length)return null;let a="string"==typeof t.ticker?t.ticker:null,o="string"==typeof t.name&&t.name!==a?t.name:null;return{title:null!==o&&null!==a?"".concat(o,"(").concat(a,") 투자자 수급"):null!==a?"".concat(a," 투자자 수급"):"투자자 수급",unit:"주",rows:l}}(t);if(null!==s)return{kind:"flow",name:e,flow:s};let a=function(e){let t,n=e.split("\n"),r=n.findIndex(e=>"---BEGIN_OMNI_CRAWL_JSON---"===e);if(r<0)return{news:null,why:null,fenced:!1};let l=n.findIndex((e,t)=>t>r&&"---END_OMNI_CRAWL_JSON---"===e);if(l<0)return{news:null,why:"Omni crawl JSON 끝 울타리를 \xab못 찾았다\xbb",fenced:!0};try{t=JSON.parse(n.slice(r+1,l).join("\n"))}catch(e){return{news:null,why:"Omni crawl 울타리 안 JSON을 \xab못 읽었다\xbb",fenced:!0}}if("object"!=typeof t||null===t||Array.isArray(t))return{news:null,why:"Omni crawl JSON 최상위가 객체가 아니다",fenced:!0};let s=t;if(!Array.isArray(s.results))return{news:null,why:"Omni crawl JSON에 results 배열이 없다",fenced:!0};let a=[];for(let e of s.results){if("object"!=typeof e||null===e||Array.isArray(e))continue;let t=e.items;if(Array.isArray(t))for(let e of t)"object"!=typeof e||null===e||Array.isArray(e)||a.push({title:"string"==typeof e.title?e.title:null,url:"string"==typeof e.url?e.url:null,date:"string"==typeof e.date?e.date:null})}return{news:{query:"string"==typeof s.query?s.query:null,items:a},why:null,fenced:!0}}(t);if(null!==a.news)return{kind:"news",name:e,news:a.news};let i=t.split("\n").filter(e=>""!==e.trim()&&!e.includes("━")).slice(0,2).join(" / ").slice(0,120);if(a.fenced)return{kind:"unparsed",name:e,why:a.why,head:i};let d=function(e){let t=e.split("\n").filter(e=>""!==e.trim()&&!e.includes("━"));if(t.length<2)return null;let n=[];for(let e of t.slice(1)){let t=/^\s{1,}(\S[^:]*?)\s+:\s+(.+?)\s*$/.exec(e);if(null===t)continue;let r=t[1].trim(),l=t[2].trim();""===r||""===l||r.includes("//")||n.push({label:r,value:l,num:o(l)})}return 0===n.length?null:{title:t[0].trim(),entries:n}}(t);return null!==d?{kind:"keyed",name:e,keyed:d}:{kind:"unparsed",name:e,why:"아는 꼴이 \xab아니다\xbb(시세\xb7수급표\xb7뉴스\xb7라벨:값 넷 다 아님)",head:i}}(e,n))}return{personaId:null!=(l=i(e.personaId))?l:"unknown",runId:i(e.runId),atUtc:i(e.atUtc),ok:u(e.ok),steps:d(e.steps),failed:d(e.failed),source:null!=(s=i(e.source))?s:"unknown",delivered:u(null==(t=e.delivery)?void 0:t.sent),artifacts:a,textless:c}}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null===e)return"—";let n=Math.abs(e)>=1e3?e.toLocaleString("en-US"):String(e);return!0===t.sign&&e>0?"+".concat(n):n}async function x(e,t,n){try{var r,l,s=await e.fetchJson("/v1/bots/rounds?persona=".concat(encodeURIComponent(t),"&limit=").concat(n));if("object"!=typeof s||null===s)return{kind:"error",reason:"라우트 응답을 \xab못 읽었다\xbb(객체가 아니다)"};if(!Array.isArray(s.rounds))return{kind:"error",reason:"`rounds` 가 \xab배열이 아니다\xbb — 「0건」과 \xab다른 값\xbb이다"};let a=s.unreadableBy,o=void 0===a?null:Object.entries(a).filter(e=>{let[t]=e;return"result-missing"!==t}).reduce((e,t)=>{var n;let[,r]=t;return e+(null!=(n=d(r))?n:0)},0);return{kind:"ready",rounds:s.rounds.map(c),unreadable:null!=(r=d(s.unreadable))?r:0,unreadableNow:null!=o?o:null!=(l=d(s.unreadable))?l:0}}catch(e){return{kind:"error",reason:e instanceof Error&&e.message?e.message:String(e)}}}function f(e){let{a:t}=e,n=t.quote,l=null!==n.changePct&&n.changePct>0,s=null!==n.changePct&&n.changePct<0;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"quote-".concat(n.symbol),children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3",children:[(0,r.jsx)("h4",{className:"font-mono text-sm font-semibold",children:n.symbol}),(0,r.jsx)("span",{className:"text-lg font-bold tabular-nums",children:m(n.close)}),(0,r.jsxs)("span",{className:"text-sm font-semibold tabular-nums ".concat(l?"text-emerald-600":s?"text-rose-600":"text-muted-foreground"),children:[m(n.change,{sign:!0}),null!==n.changePct&&" (".concat(m(n.changePct,{sign:!0}),"%)")]})]}),(0,r.jsx)("dl",{className:"mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-xs text-muted-foreground sm:grid-cols-4",children:[["시가",n.open],["고가",n.high],["저가",n.low],["전일",n.prevClose]].map(e=>{let[t,n]=e;return(0,r.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,r.jsx)("dt",{children:t}),(0,r.jsx)("dd",{className:"tabular-nums text-foreground",children:m(n)})]},t)})})]})}function h(e){let{a:t}=e,n=t.flow;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"flow-block",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:n.title}),null!==n.unit&&(0,r.jsxs)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["단위: ",n.unit]}),(0,r.jsx)("div",{className:"mt-2 overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full min-w-[22rem] text-xs",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-muted-foreground",children:[(0,r.jsx)("th",{className:"py-1 text-left font-medium",children:"기간"}),["외국인","기관","개인"].map(e=>(0,r.jsx)("th",{className:"py-1 text-right font-medium",children:e},e))]})}),(0,r.jsx)("tbody",{children:n.rows.slice(0,6).map(e=>(0,r.jsxs)("tr",{className:"border-t border-border/60",children:[(0,r.jsx)("td",{className:"py-1 font-mono",children:e.key}),[e.foreign,e.institution,e.individual].map((e,t)=>(0,r.jsx)("td",{className:"py-1 text-right tabular-nums ".concat(null===e?"text-muted-foreground":e>0?"text-emerald-600":e<0?"text-rose-600":""),children:m(e,{sign:!0})},t))]},e.key))})]})}),n.rows.length>6&&(0,r.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:["…",n.rows.length-6,"줄 더 (전체는 회차 원본에)"]})]})}function g(e){let{a:t}=e,n=t.keyed;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"keyed-block",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:n.title}),(0,r.jsx)("dl",{className:"mt-2 grid gap-1 sm:grid-cols-2",children:n.entries.map(e=>(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-3 text-sm",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:e.label}),(0,r.jsx)("dd",{className:"font-semibold tabular-nums",children:e.value})]},e.label))})]})}function p(e){let{a:t}=e;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"news-block",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:null===t.news.query?"뉴스":"뉴스: ".concat(t.news.query)}),0===t.news.items.length?(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"수집된 기사가 0건이다."}):(0,r.jsx)("ul",{className:"mt-2 space-y-2",children:t.news.items.map((e,t)=>{var n,l,s,a;return(0,r.jsxs)("li",{className:"text-sm",children:[null===e.url?null!=(n=e.title)?n:"(제목 없음)":(0,r.jsx)("a",{className:"font-medium underline underline-offset-2",href:e.url,children:null!=(l=e.title)?l:e.url}),null!==e.date&&(0,r.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:e.date})]},"".concat(null!=(a=null!=(s=e.url)?s:e.title)?a:"article","-").concat(t))})})]})}function b(e){let{a:t}=e;return(0,r.jsxs)("div",{className:"rounded-lg border border-rose-500/40 bg-rose-500/5 p-3","data-testid":"failure-block",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-baseline gap-2",children:[(0,r.jsx)("h4",{className:"font-mono text-sm font-semibold",children:t.name}),(0,r.jsx)("span",{className:"rounded bg-rose-500/15 px-2 py-0.5 text-xs font-medium text-rose-700",children:"이 단계가 \xab실패\xbb했다"})]}),(0,r.jsx)("p",{className:"mt-1 text-xs text-rose-700",children:t.kindOf}),(0,r.jsx)("p",{className:"mt-1 break-words font-mono text-xs text-muted-foreground",children:t.head})]})}function j(e){let{a:t}=e;return(0,r.jsxs)("div",{className:"rounded-lg border border-dashed border-border bg-background/40 p-3","data-testid":"unparsed-block",children:[(0,r.jsx)("h4",{className:"font-mono text-sm",children:t.name}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-amber-600",children:["⚠️ 이 산출을 \xab못 읽었다\xbb — ",t.why]}),(0,r.jsx)("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:t.head})]})}function y(e){var t;let{round:n}=e,l=null!==n.failed&&n.failed>0;return(0,r.jsxs)("article",{className:"rounded-xl border border-border bg-card p-5","data-testid":"round-".concat(null!=(t=n.runId)?t:"unknown"),children:[(0,r.jsxs)("header",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Asia/Seoul";if(null===e)return"시각 \xab모름\xbb";let n=new Date(e);if(Number.isNaN(n.getTime()))return"시각을 \xab못 읽었다\xbb(".concat(e.slice(0,24),")");let r=new Intl.DateTimeFormat("ko-KR",{timeZone:t,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1});return"".concat(r.format(n)," KST")}(n.atUtc)}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"rounded px-2 py-0.5 font-medium ".concat("cron"===n.source?"bg-emerald-500/15 text-emerald-700":"bg-muted text-muted-foreground"),children:"cron"===n.source?"무인(cron)":"manual"===n.source?"손":"출처 \xab모름\xbb"}),(0,r.jsxs)("span",{className:"rounded px-2 py-0.5 font-medium ".concat(l?"bg-rose-500/15 text-rose-700":"bg-muted text-muted-foreground"),children:[null===n.steps?"단계 \xab모름\xbb":"".concat(n.steps,"단계"),l&&" \xb7 실패 ".concat(n.failed)]}),(0,r.jsx)("span",{className:"rounded px-2 py-0.5 font-medium ".concat(!0===n.delivered?"bg-sky-500/15 text-sky-700":"bg-muted text-muted-foreground"),children:null===n.delivered?"배달 \xab모름\xbb":n.delivered?"폰에 갔다":"안 갔다"})]})]}),(0,r.jsxs)("div",{className:"mt-4 space-y-3",children:[n.artifacts.map((e,t)=>"quote"===e.kind?(0,r.jsx)(f,{a:e},t):"flow"===e.kind?(0,r.jsx)(h,{a:e},t):"news"===e.kind?(0,r.jsx)(p,{a:e},t):"keyed"===e.kind?(0,r.jsx)(g,{a:e},t):"failure"===e.kind?(0,r.jsx)(b,{a:e},t):(0,r.jsx)(j,{a:e},t)),0===n.artifacts.length&&0===n.textless.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"이 회차에 산출이 \xab없다\xbb."}),n.textless.length>0&&(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["본문을 \xab안 받은\xbb 산출 ",n.textless.length,"건: ",n.textless.join(" \xb7 ")]})]})]})}function N(e){let{client:t,persona:n,title:s,subtitle:a,limit:o=3}=e,[i,d]=(0,l.useState)({kind:"loading"});return(0,l.useEffect)(()=>{let e=!0;return d({kind:"loading"}),x(t,n,o).then(t=>{e&&d(t)}),()=>{e=!1}},[t,n,o]),(0,r.jsxs)("section",{className:"flex flex-col gap-4","aria-label":"".concat(n," rounds"),"data-testid":"rounds-".concat(n),children:[(0,r.jsxs)("header",{children:[(0,r.jsx)("h2",{className:"text-xl font-bold",children:s}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a})]}),"loading"===i.kind&&(0,r.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"투자 회차를 불러오는 중…"}),"error"===i.kind&&(0,r.jsxs)("div",{role:"alert",className:"rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-destructive",children:"회차를 \xab못 받았다\xbb."}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:i.reason}),(0,r.jsxs)("p",{className:"mt-2 text-xs text-muted-foreground",children:["⚠️ 라우트 ",(0,r.jsx)("code",{className:"font-mono",children:"/v1/bots/rounds"})," 가 아직 \xab없을 수\xbb 있다(\uD83C\uDD63 축). 그때는 이 자리가 비는 것이 \xab맞다\xbb — 화면이 그것을 말하고 있다."]})]}),"ready"===i.kind&&0===i.rounds.length&&(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:["회차가 \xab0건\xbb이다.",i.unreadable>0&&" (못 읽은 자리 ".concat(i.unreadable,"곳 — 「없다」가 아니다)")]}),"ready"===i.kind&&i.rounds.length>0&&(0,r.jsxs)(r.Fragment,{children:[i.unreadableNow>0?(0,r.jsxs)("p",{role:"alert",className:"text-xs text-amber-600",children:["⚠️ ***지금 못 읽는 자리 ",i.unreadableNow,"곳*** — 아래 수는 \xab과소\xbb다."]}):i.unreadable>0?(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["못 읽은 자리 ",i.unreadable,"곳(옛 회차) — 「지금 깨진 것」은 \xab없다\xbb."]}):null,(0,r.jsx)("div",{className:"flex flex-col gap-4",children:i.rounds.map(e=>{var t,n;return(0,r.jsx)(y,{round:e},null!=(n=null!=(t=e.runId)?t:e.atUtc)?n:Math.random())})})]})]})}function w(e){let{client:t,limit:n=3}=e;return(0,r.jsx)(N,{client:t,persona:"investor",limit:n,title:"\uD83D\uDCC8 투자 회차",subtitle:"봇이 \xab실제로 낸\xbb 산출이다. ⛔ 차트는 \xab일부러\xbb 안 그린다 — 글만 낸다."})}function v(e){let{client:t,limit:n=2}=e;return(0,r.jsx)(N,{client:t,persona:"assistant",limit:n,title:"\uD83D\uDDD3️ 비서 회차",subtitle:"안 읽은 메일\xb7앞으로의 일정. ⛔ 「0」도 \xab잰 값\xbb이라 그대로 보여 준다."})}function k(e){let{client:t,limit:n=2}=e;return(0,r.jsx)(N,{client:t,persona:"newsbot",limit:n,title:"\uD83D\uDCF0 뉴스 회차",subtitle:"⚠️ 이 봇의 산출은 꼴이 여럿이다 — 못 읽은 것은 \xab이름을 대고\xbb 남는다."})}async function _(e){try{let t=await e.fetchJson("/v1/bots/commands");return{kind:"ready",commands:t}}catch(e){return{kind:"error",reason:e instanceof Error&&e.message?e.message:"string"==typeof e&&e?e:"Unknown error"}}}function S(e){let{client:t}=e,n=(0,a.v)(t),[s,o]=(0,l.useState)({kind:"loading"});(0,l.useEffect)(()=>{let e=!0;return o({kind:"loading"}),_(t).then(t=>{e&&o(t)}),()=>{e=!1}},[t]);let i=n.error,d="error"===s.kind?s.reason:null,u=null!==i||null!==d,c=!u&&(n.loading||"loading"===s.kind),m="ready"===s.kind?s.commands:[],x=!c&&!u;return(0,r.jsxs)("main",{className:"mx-auto flex w-full max-w-5xl flex-col gap-6 px-6 py-10 sm:px-10","data-testid":"bots-panel",children:[(0,r.jsxs)("header",{children:[(0,r.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Bot directory"}),(0,r.jsx)("h1",{className:"mt-2 text-3xl font-bold",children:"Bots"}),(0,r.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-muted-foreground",children:"Commands are global: every bot exposes the same catalog."}),(0,r.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-muted-foreground",children:"This surface cannot send commands yet; it only shows what you can ask bots to do."})]}),c&&(0,r.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading bot identities and command catalog…"}),i&&(0,r.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Unable to load bot identities: ",i]}),d&&(0,r.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Unable to load bot catalog: ",d]}),x&&0===n.personas.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No bots are configured."}),x&&n.personas.length>0&&0===m.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No bot commands are available."}),(0,r.jsx)(w,{client:t}),(0,r.jsx)(v,{client:t}),(0,r.jsx)(k,{client:t}),x&&n.personas.length>0&&m.length>0&&(0,r.jsx)("section",{className:"grid gap-4 md:grid-cols-2","aria-label":"Bot identities",children:n.personas.map(e=>{var t;return(0,r.jsxs)("article",{className:"rounded-xl border border-border bg-card p-5","data-testid":"bot-card-".concat(e.personaId),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:e.displayName}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:null!=(t=e.description)?t:"No description provided."}),(0,r.jsx)("h3",{className:"mt-5 text-sm font-semibold",children:"Available commands"}),(0,r.jsx)("ul",{className:"mt-3 space-y-3","aria-label":"Available bot commands",children:m.map(e=>(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-background/60 p-3",children:[(0,r.jsx)("h4",{className:"font-mono text-sm font-semibold",children:e.name}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description}),e.arguments.length>0?(0,r.jsx)("ul",{className:"mt-2 space-y-1","aria-label":"".concat(e.name," arguments"),children:e.arguments.map(e=>(0,r.jsxs)("li",{className:"text-xs text-muted-foreground",children:[(0,r.jsx)("code",{className:"font-semibold text-foreground",children:e.name}),e.required?" (required)":" (optional)"," — ",e.description]},e.name))}):(0,r.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"No arguments."})]},e.name))})]},e.personaId)})})]})}function D(){let{client:e}=(0,s.Q)();return(0,r.jsx)(S,{client:e})}},88744:(e,t,n)=>{"use strict";n.d(t,{v:()=>a});var r=n(46124),l=n(72215);let s=null;function a(e){let[t,n]=(0,r.useState)(()=>s&&Date.now()-s.at<6e4?s.data:[]),[a,o]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null),u=(0,r.useCallback)(async()=>{o(!0),d(null);try{let t=await e.listPersonas();s={at:Date.now(),data:t.personas},n(t.personas)}catch(e){d(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e]);(0,r.useEffect)(()=>{if(s&&Date.now()-s.at<6e4)return void n(s.data);u()},[u]);let c=(0,r.useCallback)(async()=>{s=null,await u()},[u]);return(0,r.useEffect)(()=>{let t=e.personasEventsUrl();if(!t)return;let n=null;try{n=new EventSource(t)}catch(e){(0,l.cY)("showroom.personas.sse.construct-error",{error:String(e)});return}let r=e=>()=>{"hello"!==e&&((0,l.cY)("showroom.personas.sse.event",{kind:e}),s=null,u())};return n.addEventListener("hello",r("hello")),n.addEventListener("load-dir",r("load-dir")),n.addEventListener("reload-all",r("reload-all")),n.addEventListener("upsert",r("upsert")),n.addEventListener("remove",r("remove")),n.onerror=e=>{(0,l.cY)("showroom.personas.sse.error",{type:e.type})},()=>{try{null==n||n.close()}catch(e){}}},[e,u]),{personas:t,loading:a,error:i,reload:c}}}},e=>{e.O(0,[8060,2463,2196,7358],()=>e(e.s=17964)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2885],{5997:(e,t,n)=>{"use strict";n.d(t,{Zr:()=>a,f6:()=>l,oD:()=>s});let r="elanous.daemon.sessionId";function l(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function s(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(r,e),e):localStorage.getItem(r)}();if(e)return e;let t=l();return localStorage.setItem(r,t),t}function a(){let e=l();return localStorage.setItem(r,e),e}},15151:(e,t,n)=>{"use strict";n.d(t,{C:()=>d,DaemonProvider:()=>u,Q:()=>c});var r=n(55539),l=n(46124),s=n(8101),a=n(5997),o=n(18060),i=n(72215);let d=(0,l.createContext)(null);function u(e){let{children:t}=e,n={baseUrl:"",token:"",provider:""},[u,c]=(0,l.useState)(n),[m,x]=(0,l.useState)(""),[f]=(0,l.useState)(()=>new o.ki(n));(0,l.useEffect)(()=>{let e=(0,s.Fp)();c(e),f.updateConfig(e),x((0,a.oD)()),(0,i.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[f]),(0,l.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,s.Fp)();f.updateConfig(t),c(t),(0,i.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&x(t=>t===e.newValue?t:((0,i.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[f]);let h=e=>{c(t=>{let n={...t,...e};return(0,s.Qc)(e),f.updateConfig(n),(0,i.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),n})},g=e=>{x(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,i.cY)("webterm.provider.daemon.session-set",{sessionId:e})},p=(0,l.useMemo)(()=>({config:u,setConfig:h,client:f,sessionId:m,setSessionId:g}),[u,f,m]);return(0,r.jsx)(d.Provider,{value:p,children:t})}function c(){let e=(0,l.useContext)(d);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}},26341:(e,t,n)=>{Promise.resolve().then(n.bind(n,75326))},75326:(e,t,n)=>{"use strict";n.d(t,{BotsPageContent:()=>D});var r=n(55539),l=n(46124),s=n(15151),a=n(88744);function o(e){if(null==e)return null;let t=e.replace(/[,%\s]/g,"").replace(/\*/g,"").trim();if(""===t||"-"===t||"N/A"===t)return null;let n=Number(t);return Number.isFinite(n)?n:null}let i=e=>"string"==typeof e&&""!==e?e:null,d=e=>"number"==typeof e&&Number.isFinite(e)?e:null,u=e=>"boolean"==typeof e?e:null;function c(e){var t,n,r,l,s;let a=[],c=[];for(let t of null!=(n=e.artifacts)?n:[]){let e=null!=(r=i(null==t?void 0:t.name))?r:"(이름 없음)",n=i(null==t?void 0:t.text);if(null===n){c.push(e);continue}a.push(function(e,t){var n;let r=function(e){let t=e.split("\n").filter(e=>""!==e.trim()&&!e.includes("━")),n=t.slice(0,3).join(" / ").slice(0,160),r=t.slice(0,3).join("\n");return/^Traceback \(most recent call last\):/m.test(r)?{kindOf:"파이썬 예외(Traceback)",head:n}:/^⛔\s*.*(실패|failed|error)/mi.test(r)?{kindOf:"스킬이 \xab실패\xbb라고 말했다",head:n}:/^(Error|error):/m.test(r)?{kindOf:"오류",head:n}:/^\s*command not found|No such file or directory/m.test(r)?{kindOf:"명령\xb7파일이 \xab없다\xbb",head:n}:null}(t);if(null!==r)return{kind:"failure",name:e,kindOf:r.kindOf,head:r.head};let l=function(e){var t,n,r,l;let s=null!=(l=null!=(r=null==(t=/^대상:\s*(\S+)/m.exec(e))?void 0:t[1])?r:null==(n=/^##\s+(\S+)\s+Real-Time Quote/m.exec(e))?void 0:n[1])?l:null;if(null===s)return null;let a=t=>{var n,r;return null!=(r=null==(n=RegExp("\\*\\*".concat(t,":\\*\\*\\s*([-+0-9.,]+)"),"i").exec(e))?void 0:n[1])?r:null},i=/\*\*Change:\*\*\s*([-+0-9.,]+)\s*\(([-+0-9.]+)%\)/i.exec(e),d={symbol:s,close:o(a("Close")),change:i?o(i[1]):o(a("Change")),changePct:i?o(i[2]):null,open:o(a("Open")),high:o(a("High")),low:o(a("Low")),volume:o(a("Volume")),prevClose:o(a("Prev Close"))};return[d.close,d.change,d.open,d.high,d.low,d.volume,d.prevClose].some(e=>null!==e)?d:null}(t);if(null!==l)return{kind:"quote",name:e,quote:l};let s=null!=(n=function(e){var t,n,r,l,s,a,i,d;let u=e.split("\n"),c=u.findIndex(e=>e.includes("|")&&e.includes("외국인")&&e.includes("기관")&&e.includes("개인"));if(c<0)return null;let m=e=>e.split("|").map(e=>e.trim()).filter((e,t,n)=>""!==e||0!==t&&t!==n.length-1),x=m(u[c]),f=e=>x.findIndex(t=>t.includes(e)),[h,g,p,b]=[0,f("외국인"),f("기관"),f("개인")];if(g<0||p<0||b<0)return null;let j=[];for(let e=c+1;e<u.length;e+=1){let t=u[e];if(!t.includes("|")){if(j.length>0)break;continue}if(/^\s*\|?[\s:|-]+\|?\s*$/.test(t))continue;let n=m(t);if(n.length<=Math.max(g,p,b))continue;let r=(null!=(l=n[h])?l:"").trim();""!==r&&j.push({key:r,foreign:o(n[g]),institution:o(n[p]),individual:o(n[b])})}if(0===j.length)return null;let y="";for(let e=c;e>=0;e-=1){let t=/^#{2,3}\s+(.+)$/.exec((null!=(s=u[e])?s:"").trim());if(t){y=t[1];break}}return""===y&&(y=null!=(a=null==(t=u.find(e=>""!==e.trim()&&!e.includes("━")))?void 0:t.trim())?a:"(제목 없음)"),{title:y,unit:null!=(d=null==(n=/\((백만|천|억)\)/.exec(x.join(" ")))?void 0:n[1])?d:null!=(i=null==(r=/\(([^)]*원[^)]*)\)/.exec(x.join(" ")))?void 0:r[1])?i:null,rows:j}}(t))?n:function(e){let t,n=e.trimStart();if(!n.startsWith("{"))return null;try{t=JSON.parse(n)}catch(e){return null}let r=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(let t of n){let n=e[t];if("number"==typeof n&&Number.isFinite(n))return n}return null},l=[],s=t.periods;if("object"==typeof s&&null!==s&&!Array.isArray(s))for(let[e,t]of Object.entries(s))"object"==typeof t&&null!==t&&l.push({key:e,foreign:r(t,"frgn_net_shares","frgn_net_amount_million"),institution:r(t,"inst_net_shares","inst_net_amount_million"),individual:r(t,"prsn_net_shares","prsn_net_amount_million")});if(0===l.length&&Array.isArray(t.rows))for(let e of t.rows){if("object"!=typeof e||null===e)continue;let t="string"==typeof e.date?e.date:null;null!==t&&l.push({key:t,foreign:r(e,"frgn_net_shares","frgn_net_amount_million"),institution:r(e,"inst_net_shares","inst_net_amount_million"),individual:r(e,"prsn_net_shares","prsn_net_amount_million")})}if(0===l.length)return null;let a="string"==typeof t.ticker?t.ticker:null,o="string"==typeof t.name&&t.name!==a?t.name:null;return{title:null!==o&&null!==a?"".concat(o,"(").concat(a,") 투자자 수급"):null!==a?"".concat(a," 투자자 수급"):"투자자 수급",unit:"주",rows:l}}(t);if(null!==s)return{kind:"flow",name:e,flow:s};let a=function(e){let t,n=e.split("\n"),r=n.findIndex(e=>"---BEGIN_OMNI_CRAWL_JSON---"===e);if(r<0)return{news:null,why:null,fenced:!1};let l=n.findIndex((e,t)=>t>r&&"---END_OMNI_CRAWL_JSON---"===e);if(l<0)return{news:null,why:"Omni crawl JSON 끝 울타리를 \xab못 찾았다\xbb",fenced:!0};try{t=JSON.parse(n.slice(r+1,l).join("\n"))}catch(e){return{news:null,why:"Omni crawl 울타리 안 JSON을 \xab못 읽었다\xbb",fenced:!0}}if("object"!=typeof t||null===t||Array.isArray(t))return{news:null,why:"Omni crawl JSON 최상위가 객체가 아니다",fenced:!0};let s=t;if(!Array.isArray(s.results))return{news:null,why:"Omni crawl JSON에 results 배열이 없다",fenced:!0};let a=[];for(let e of s.results){if("object"!=typeof e||null===e||Array.isArray(e))continue;let t=e.items;if(Array.isArray(t))for(let e of t)"object"!=typeof e||null===e||Array.isArray(e)||a.push({title:"string"==typeof e.title?e.title:null,url:"string"==typeof e.url?e.url:null,date:"string"==typeof e.date?e.date:null})}return{news:{query:"string"==typeof s.query?s.query:null,items:a},why:null,fenced:!0}}(t);if(null!==a.news)return{kind:"news",name:e,news:a.news};let i=t.split("\n").filter(e=>""!==e.trim()&&!e.includes("━")).slice(0,2).join(" / ").slice(0,120);if(a.fenced)return{kind:"unparsed",name:e,why:a.why,head:i};let d=function(e){let t=e.split("\n").filter(e=>""!==e.trim()&&!e.includes("━"));if(t.length<2)return null;let n=[];for(let e of t.slice(1)){let t=/^\s{1,}(\S[^:]*?)\s+:\s+(.+?)\s*$/.exec(e);if(null===t)continue;let r=t[1].trim(),l=t[2].trim();""===r||""===l||r.includes("//")||n.push({label:r,value:l,num:o(l)})}return 0===n.length?null:{title:t[0].trim(),entries:n}}(t);return null!==d?{kind:"keyed",name:e,keyed:d}:{kind:"unparsed",name:e,why:"아는 꼴이 \xab아니다\xbb(시세\xb7수급표\xb7뉴스\xb7라벨:값 넷 다 아님)",head:i}}(e,n))}return{personaId:null!=(l=i(e.personaId))?l:"unknown",runId:i(e.runId),atUtc:i(e.atUtc),ok:u(e.ok),steps:d(e.steps),failed:d(e.failed),source:null!=(s=i(e.source))?s:"unknown",delivered:u(null==(t=e.delivery)?void 0:t.sent),artifacts:a,textless:c}}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null===e)return"—";let n=Math.abs(e)>=1e3?e.toLocaleString("en-US"):String(e);return!0===t.sign&&e>0?"+".concat(n):n}async function x(e,t,n){try{var r,l,s=await e.fetchJson("/v1/bots/rounds?persona=".concat(encodeURIComponent(t),"&limit=").concat(n));if("object"!=typeof s||null===s)return{kind:"error",reason:"라우트 응답을 \xab못 읽었다\xbb(객체가 아니다)"};if(!Array.isArray(s.rounds))return{kind:"error",reason:"`rounds` 가 \xab배열이 아니다\xbb — 「0건」과 \xab다른 값\xbb이다"};let a=s.unreadableBy,o=void 0===a?null:Object.entries(a).filter(e=>{let[t]=e;return"result-missing"!==t}).reduce((e,t)=>{var n;let[,r]=t;return e+(null!=(n=d(r))?n:0)},0);return{kind:"ready",rounds:s.rounds.map(c),unreadable:null!=(r=d(s.unreadable))?r:0,unreadableNow:null!=o?o:null!=(l=d(s.unreadable))?l:0}}catch(e){return{kind:"error",reason:e instanceof Error&&e.message?e.message:String(e)}}}function f(e){let{a:t}=e,n=t.quote,l=null!==n.changePct&&n.changePct>0,s=null!==n.changePct&&n.changePct<0;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"quote-".concat(n.symbol),children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3",children:[(0,r.jsx)("h4",{className:"font-mono text-sm font-semibold",children:n.symbol}),(0,r.jsx)("span",{className:"text-lg font-bold tabular-nums",children:m(n.close)}),(0,r.jsxs)("span",{className:"text-sm font-semibold tabular-nums ".concat(l?"text-emerald-600":s?"text-rose-600":"text-muted-foreground"),children:[m(n.change,{sign:!0}),null!==n.changePct&&" (".concat(m(n.changePct,{sign:!0}),"%)")]})]}),(0,r.jsx)("dl",{className:"mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-xs text-muted-foreground sm:grid-cols-4",children:[["시가",n.open],["고가",n.high],["저가",n.low],["전일",n.prevClose]].map(e=>{let[t,n]=e;return(0,r.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,r.jsx)("dt",{children:t}),(0,r.jsx)("dd",{className:"tabular-nums text-foreground",children:m(n)})]},t)})})]})}function h(e){let{a:t}=e,n=t.flow;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"flow-block",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:n.title}),null!==n.unit&&(0,r.jsxs)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["단위: ",n.unit]}),(0,r.jsx)("div",{className:"mt-2 overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full min-w-[22rem] text-xs",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-muted-foreground",children:[(0,r.jsx)("th",{className:"py-1 text-left font-medium",children:"기간"}),["외국인","기관","개인"].map(e=>(0,r.jsx)("th",{className:"py-1 text-right font-medium",children:e},e))]})}),(0,r.jsx)("tbody",{children:n.rows.slice(0,6).map(e=>(0,r.jsxs)("tr",{className:"border-t border-border/60",children:[(0,r.jsx)("td",{className:"py-1 font-mono",children:e.key}),[e.foreign,e.institution,e.individual].map((e,t)=>(0,r.jsx)("td",{className:"py-1 text-right tabular-nums ".concat(null===e?"text-muted-foreground":e>0?"text-emerald-600":e<0?"text-rose-600":""),children:m(e,{sign:!0})},t))]},e.key))})]})}),n.rows.length>6&&(0,r.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:["…",n.rows.length-6,"줄 더 (전체는 회차 원본에)"]})]})}function g(e){let{a:t}=e,n=t.keyed;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"keyed-block",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:n.title}),(0,r.jsx)("dl",{className:"mt-2 grid gap-1 sm:grid-cols-2",children:n.entries.map(e=>(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-3 text-sm",children:[(0,r.jsx)("dt",{className:"text-muted-foreground",children:e.label}),(0,r.jsx)("dd",{className:"font-semibold tabular-nums",children:e.value})]},e.label))})]})}function p(e){let{a:t}=e;return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-3","data-testid":"news-block",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:null===t.news.query?"뉴스":"뉴스: ".concat(t.news.query)}),0===t.news.items.length?(0,r.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"수집된 기사가 0건이다."}):(0,r.jsx)("ul",{className:"mt-2 space-y-2",children:t.news.items.map((e,t)=>{var n,l,s,a;return(0,r.jsxs)("li",{className:"text-sm",children:[null===e.url?null!=(n=e.title)?n:"(제목 없음)":(0,r.jsx)("a",{className:"font-medium underline underline-offset-2",href:e.url,children:null!=(l=e.title)?l:e.url}),null!==e.date&&(0,r.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:e.date})]},"".concat(null!=(a=null!=(s=e.url)?s:e.title)?a:"article","-").concat(t))})})]})}function b(e){let{a:t}=e;return(0,r.jsxs)("div",{className:"rounded-lg border border-rose-500/40 bg-rose-500/5 p-3","data-testid":"failure-block",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-baseline gap-2",children:[(0,r.jsx)("h4",{className:"font-mono text-sm font-semibold",children:t.name}),(0,r.jsx)("span",{className:"rounded bg-rose-500/15 px-2 py-0.5 text-xs font-medium text-rose-700",children:"이 단계가 \xab실패\xbb했다"})]}),(0,r.jsx)("p",{className:"mt-1 text-xs text-rose-700",children:t.kindOf}),(0,r.jsx)("p",{className:"mt-1 break-words font-mono text-xs text-muted-foreground",children:t.head})]})}function j(e){let{a:t}=e;return(0,r.jsxs)("div",{className:"rounded-lg border border-dashed border-border bg-background/40 p-3","data-testid":"unparsed-block",children:[(0,r.jsx)("h4",{className:"font-mono text-sm",children:t.name}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-amber-600",children:["⚠️ 이 산출을 \xab못 읽었다\xbb — ",t.why]}),(0,r.jsx)("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:t.head})]})}function y(e){var t;let{round:n}=e,l=null!==n.failed&&n.failed>0;return(0,r.jsxs)("article",{className:"rounded-xl border border-border bg-card p-5","data-testid":"round-".concat(null!=(t=n.runId)?t:"unknown"),children:[(0,r.jsxs)("header",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Asia/Seoul";if(null===e)return"시각 \xab모름\xbb";let n=new Date(e);if(Number.isNaN(n.getTime()))return"시각을 \xab못 읽었다\xbb(".concat(e.slice(0,24),")");let r=new Intl.DateTimeFormat("ko-KR",{timeZone:t,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1});return"".concat(r.format(n)," KST")}(n.atUtc)}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"rounded px-2 py-0.5 font-medium ".concat("cron"===n.source?"bg-emerald-500/15 text-emerald-700":"bg-muted text-muted-foreground"),children:"cron"===n.source?"무인(cron)":"manual"===n.source?"손":"출처 \xab모름\xbb"}),(0,r.jsxs)("span",{className:"rounded px-2 py-0.5 font-medium ".concat(l?"bg-rose-500/15 text-rose-700":"bg-muted text-muted-foreground"),children:[null===n.steps?"단계 \xab모름\xbb":"".concat(n.steps,"단계"),l&&" \xb7 실패 ".concat(n.failed)]}),(0,r.jsx)("span",{className:"rounded px-2 py-0.5 font-medium ".concat(!0===n.delivered?"bg-sky-500/15 text-sky-700":"bg-muted text-muted-foreground"),children:null===n.delivered?"배달 \xab모름\xbb":n.delivered?"폰에 갔다":"안 갔다"})]})]}),(0,r.jsxs)("div",{className:"mt-4 space-y-3",children:[n.artifacts.map((e,t)=>"quote"===e.kind?(0,r.jsx)(f,{a:e},t):"flow"===e.kind?(0,r.jsx)(h,{a:e},t):"news"===e.kind?(0,r.jsx)(p,{a:e},t):"keyed"===e.kind?(0,r.jsx)(g,{a:e},t):"failure"===e.kind?(0,r.jsx)(b,{a:e},t):(0,r.jsx)(j,{a:e},t)),0===n.artifacts.length&&0===n.textless.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"이 회차에 산출이 \xab없다\xbb."}),n.textless.length>0&&(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["본문을 \xab안 받은\xbb 산출 ",n.textless.length,"건: ",n.textless.join(" \xb7 ")]})]})]})}function N(e){let{client:t,persona:n,title:s,subtitle:a,limit:o=3}=e,[i,d]=(0,l.useState)({kind:"loading"});return(0,l.useEffect)(()=>{let e=!0;return d({kind:"loading"}),x(t,n,o).then(t=>{e&&d(t)}),()=>{e=!1}},[t,n,o]),(0,r.jsxs)("section",{className:"flex flex-col gap-4","aria-label":"".concat(n," rounds"),"data-testid":"rounds-".concat(n),children:[(0,r.jsxs)("header",{children:[(0,r.jsx)("h2",{className:"text-xl font-bold",children:s}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a})]}),"loading"===i.kind&&(0,r.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"투자 회차를 불러오는 중…"}),"error"===i.kind&&(0,r.jsxs)("div",{role:"alert",className:"rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm",children:[(0,r.jsx)("p",{className:"font-medium text-destructive",children:"회차를 \xab못 받았다\xbb."}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:i.reason}),(0,r.jsxs)("p",{className:"mt-2 text-xs text-muted-foreground",children:["⚠️ 라우트 ",(0,r.jsx)("code",{className:"font-mono",children:"/v1/bots/rounds"})," 가 아직 \xab없을 수\xbb 있다(\uD83C\uDD63 축). 그때는 이 자리가 비는 것이 \xab맞다\xbb — 화면이 그것을 말하고 있다."]})]}),"ready"===i.kind&&0===i.rounds.length&&(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:["회차가 \xab0건\xbb이다.",i.unreadable>0&&" (못 읽은 자리 ".concat(i.unreadable,"곳 — 「없다」가 아니다)")]}),"ready"===i.kind&&i.rounds.length>0&&(0,r.jsxs)(r.Fragment,{children:[i.unreadableNow>0?(0,r.jsxs)("p",{role:"alert",className:"text-xs text-amber-600",children:["⚠️ ***지금 못 읽는 자리 ",i.unreadableNow,"곳*** — 아래 수는 \xab과소\xbb다."]}):i.unreadable>0?(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["못 읽은 자리 ",i.unreadable,"곳(옛 회차) — 「지금 깨진 것」은 \xab없다\xbb."]}):null,(0,r.jsx)("div",{className:"flex flex-col gap-4",children:i.rounds.map(e=>{var t,n;return(0,r.jsx)(y,{round:e},null!=(n=null!=(t=e.runId)?t:e.atUtc)?n:Math.random())})})]})]})}function w(e){let{client:t,limit:n=3}=e;return(0,r.jsx)(N,{client:t,persona:"investor",limit:n,title:"\uD83D\uDCC8 투자 회차",subtitle:"봇이 \xab실제로 낸\xbb 산출이다. ⛔ 차트는 \xab일부러\xbb 안 그린다 — 글만 낸다."})}function v(e){let{client:t,limit:n=2}=e;return(0,r.jsx)(N,{client:t,persona:"assistant",limit:n,title:"\uD83D\uDDD3️ 비서 회차",subtitle:"안 읽은 메일\xb7앞으로의 일정. ⛔ 「0」도 \xab잰 값\xbb이라 그대로 보여 준다."})}function k(e){let{client:t,limit:n=2}=e;return(0,r.jsx)(N,{client:t,persona:"newsbot",limit:n,title:"\uD83D\uDCF0 뉴스 회차",subtitle:"⚠️ 이 봇의 산출은 꼴이 여럿이다 — 못 읽은 것은 \xab이름을 대고\xbb 남는다."})}async function _(e){try{let t=await e.fetchJson("/v1/bots/commands");return{kind:"ready",commands:t}}catch(e){return{kind:"error",reason:e instanceof Error&&e.message?e.message:"string"==typeof e&&e?e:"Unknown error"}}}function S(e){let{client:t}=e,n=(0,a.v)(t),[s,o]=(0,l.useState)({kind:"loading"});(0,l.useEffect)(()=>{let e=!0;return o({kind:"loading"}),_(t).then(t=>{e&&o(t)}),()=>{e=!1}},[t]);let i=n.error,d="error"===s.kind?s.reason:null,u=null!==i||null!==d,c=!u&&(n.loading||"loading"===s.kind),m="ready"===s.kind?s.commands:[],x=!c&&!u;return(0,r.jsxs)("main",{className:"mx-auto flex w-full max-w-5xl flex-col gap-6 px-6 py-10 sm:px-10","data-testid":"bots-panel",children:[(0,r.jsxs)("header",{children:[(0,r.jsx)("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-muted-foreground",children:"Bot directory"}),(0,r.jsx)("h1",{className:"mt-2 text-3xl font-bold",children:"Bots"}),(0,r.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-muted-foreground",children:"Commands are global: every bot exposes the same catalog."}),(0,r.jsx)("p",{className:"mt-2 max-w-3xl text-sm text-muted-foreground",children:"This surface cannot send commands yet; it only shows what you can ask bots to do."})]}),c&&(0,r.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading bot identities and command catalog…"}),i&&(0,r.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Unable to load bot identities: ",i]}),d&&(0,r.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Unable to load bot catalog: ",d]}),x&&0===n.personas.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No bots are configured."}),x&&n.personas.length>0&&0===m.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No bot commands are available."}),(0,r.jsx)(w,{client:t}),(0,r.jsx)(v,{client:t}),(0,r.jsx)(k,{client:t}),x&&n.personas.length>0&&m.length>0&&(0,r.jsx)("section",{className:"grid gap-4 md:grid-cols-2","aria-label":"Bot identities",children:n.personas.map(e=>{var t;return(0,r.jsxs)("article",{className:"rounded-xl border border-border bg-card p-5","data-testid":"bot-card-".concat(e.personaId),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:e.displayName}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:null!=(t=e.description)?t:"No description provided."}),(0,r.jsx)("h3",{className:"mt-5 text-sm font-semibold",children:"Available commands"}),(0,r.jsx)("ul",{className:"mt-3 space-y-3","aria-label":"Available bot commands",children:m.map(e=>(0,r.jsxs)("li",{className:"rounded-lg border border-border bg-background/60 p-3",children:[(0,r.jsx)("h4",{className:"font-mono text-sm font-semibold",children:e.name}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e.description}),e.arguments.length>0?(0,r.jsx)("ul",{className:"mt-2 space-y-1","aria-label":"".concat(e.name," arguments"),children:e.arguments.map(e=>(0,r.jsxs)("li",{className:"text-xs text-muted-foreground",children:[(0,r.jsx)("code",{className:"font-semibold text-foreground",children:e.name}),e.required?" (required)":" (optional)"," — ",e.description]},e.name))}):(0,r.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"No arguments."})]},e.name))})]},e.personaId)})})]})}function D(){let{client:e}=(0,s.Q)();return(0,r.jsx)(S,{client:e})}},88744:(e,t,n)=>{"use strict";n.d(t,{v:()=>a});var r=n(46124),l=n(72215);let s=null;function a(e){let[t,n]=(0,r.useState)(()=>s&&Date.now()-s.at<6e4?s.data:[]),[a,o]=(0,r.useState)(!1),[i,d]=(0,r.useState)(null),u=(0,r.useCallback)(async()=>{o(!0),d(null);try{let t=await e.listPersonas();s={at:Date.now(),data:t.personas},n(t.personas)}catch(e){d(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e]);(0,r.useEffect)(()=>{if(s&&Date.now()-s.at<6e4)return void n(s.data);u()},[u]);let c=(0,r.useCallback)(async()=>{s=null,await u()},[u]);return(0,r.useEffect)(()=>{let t=e.personasEventsUrl();if(!t)return;let n=null;try{n=new EventSource(t)}catch(e){(0,l.cY)("showroom.personas.sse.construct-error",{error:String(e)});return}let r=e=>()=>{"hello"!==e&&((0,l.cY)("showroom.personas.sse.event",{kind:e}),s=null,u())};return n.addEventListener("hello",r("hello")),n.addEventListener("load-dir",r("load-dir")),n.addEventListener("reload-all",r("reload-all")),n.addEventListener("upsert",r("upsert")),n.addEventListener("remove",r("remove")),n.onerror=e=>{(0,l.cY)("showroom.personas.sse.error",{type:e.type})},()=>{try{null==n||n.close()}catch(e){}}},[e,u]),{personas:t,loading:a,error:i,reload:c}}}},e=>{e.O(0,[8060,2463,2196,7358],()=>e(e.s=26341)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9084],{5997:(e,t,n)=>{"use strict";n.d(t,{Zr:()=>a,f6:()=>r,oD:()=>l});let s="elanous.daemon.sessionId";function r(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function l(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(s,e),e):localStorage.getItem(s)}();if(e)return e;let t=r();return localStorage.setItem(s,t),t}function a(){let e=r();return localStorage.setItem(s,e),e}},13685:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>g});var s=n(55539),r=n(46124),l=n(15151),a=n(42006),i=n(33626),o=n(43537);let u={release:null,loops:null,decisions:null,merged:null,risks:null},d=e=>"string"==typeof e&&Number.isFinite(Date.parse(e)),c=e=>!!e&&"object"==typeof e&&!Array.isArray(e);function m(e){return null!==e&&"object"==typeof e&&"string"==typeof e.id&&"string"==typeof e.name&&"string"==typeof e.source&&(null===e.category||"string"==typeof e.category)&&(null===e.domain||"string"==typeof e.domain)&&(null===e.runVia||"string"==typeof e.runVia)&&["live","firing","stale","off"].includes(e.state)&&(null===e.cron||"string"==typeof e.cron)&&(null===e.intervalMs||"number"==typeof e.intervalMs&&Number.isFinite(e.intervalMs))&&Array.isArray(e.next)&&e.next.every(e=>"string"==typeof e)&&(null===e.lastRun||"object"==typeof e.lastRun&&null!==e.lastRun&&"string"==typeof e.lastRun.at&&(null===e.lastRun.status||"string"==typeof e.lastRun.status)&&(null===e.lastRun.exit||"number"==typeof e.lastRun.exit))}async function f(e){try{var t;let n=await e.fetchResponse(a.i6);if(!n.ok)return null;let s=await n.json();if(null===s||"object"!=typeof s||!("schedules"in s))return null;let r=s.schedules;if(!Array.isArray(r)||!r.every(m))return null;let l=(0,a.Yy)(r,Date.now()),i={};for(let e of l)i[e.verdict]=(null!=(t=i[e.verdict])?t:0)+1;let o=l.flatMap((e,t)=>"실패"===e.verdict&&d(e.lastRun)?[{id:"loop:".concat(e.id),kind:"실패 루프",title:e.name,at:r[t].lastRun.at}]:[]);return{summary:i,risks:o}}catch(e){return null}}async function y(e){try{let t=await e.fetchResponse(a.QK);if(!t.ok)return null;let n=await t.json();if(!c(n)||!c(n.loops)||!Array.isArray(n.loops.loops))return null;let s=n.loops.loops;if(!s.every(e=>c(e)&&"string"==typeof e.name&&"string"==typeof e.label&&(null===e.last||c(e.last)&&d(e.last.at)&&"string"==typeof e.last.status)))return null;return s.flatMap(e=>e.last&&["error","failed","failure","abandoned"].includes(e.last.status.toLowerCase())?[{id:"loop:".concat(e.name),kind:"실패 루프",title:e.label,at:e.last.at}]:[])}catch(e){return null}}async function p(e,t){try{let n=new Intl.DateTimeFormat("sv-SE",{timeZone:"Asia/Seoul"}).format(t),s=Date.parse("".concat(n,"T00:00:00+09:00")),[r,l]=await Promise.allSettled([e.fetchResponse("/v1/harness/runs?finishedSince=".concat(s)).then(async e=>e.ok?await e.json():null),e.fetchResponse("/v1/harness/runs?finishedSince=".concat(s-6048e5)).then(async e=>e.ok?await e.json():null)]),a="fulfilled"===r.status?r.value:null,i=c(a)?a.landed:null,o=c(a)&&(void 0===a.landedTruncated||!1===a.landedTruncated)&&null==a.landedError&&Array.isArray(i)&&i.every(e=>c(e)&&"number"==typeof e.number&&d(e.mergedAt))?new Set(i.filter(e=>Date.parse(e.mergedAt)>=s).map(e=>e.number)).size:null;if("fulfilled"!==l.status)return{merged:o,risks:null};let u=l.value;if(!c(u))return{merged:o,risks:null};let m=u.finished,f=u.entries,y="complete"===u.completeness&&Array.isArray(m)&&Array.isArray(f)&&c(u.finishedObservation)&&Number.isInteger(u.finishedObservation.skippedFiles)&&0===u.finishedObservation.skippedFiles&&m.every(e=>c(e)&&"string"==typeof e.runId&&"string"==typeof e.status&&d(e.endedAt))&&f.every(e=>c(e)&&"string"==typeof e.runId&&"string"==typeof e.status)?[...m.filter(e=>"human-stop"===e.status||"failed"===e.status||"parked"===e.status||"cancelled"===e.status&&"soft-stopped"===e.stage).map(e=>({id:"run:".concat(e.runId),kind:"멈춘 하니스 런",title:"string"==typeof e.objective&&e.objective?e.objective:e.runId,at:e.endedAt})),...f.filter(e=>"ended-unclosed"===e.status&&d(e.lastActivityTimestamp)&&!m.some(t=>t.runId===e.runId)).map(e=>({id:"run:".concat(e.runId),kind:"멈춘 하니스 런",title:"string"==typeof e.objective&&e.objective?e.objective:e.runId,at:e.lastActivityTimestamp}))]:null;return{merged:o,risks:y}}catch(e){return{merged:null,risks:null}}}async function v(e,t){try{let n=await (0,i.q)(e);if(!Array.isArray(n)||!n.every(e=>c(e)&&"string"==typeof e.id))return null;return{count:n.length,risks:n.flatMap(e=>d(e.dueAt)&&Date.parse(e.dueAt)<t?[{id:"decision:".concat(e.id),kind:"기한 지난 결정",title:"string"==typeof e.title?e.title:e.id,at:e.dueAt}]:[])}}catch(e){return null}}async function b(e){var t,n,s;let r=Date.now(),[l,a,i,u,d]=await Promise.all([(0,o.Nn)(e),f(e),y(e),v(e,r),p(e,new Date(r))]);return{release:"ready"===l.kind?4!==(s=l.data).seats.length||s.seats.some(e=>null===e.checklist)?null:{green:s.seats.reduce((e,t)=>e+t.checklist.green,0),yellow:s.seats.reduce((e,t)=>e+t.checklist.yellow,0)}:null,loops:null!=(t=null==a?void 0:a.summary)?t:null,decisions:null!=(n=null==u?void 0:u.count)?n:null,merged:d.merged,risks:a&&i&&u&&d.risks?[...new Map([...a.risks,...i,...u.risks,...d.risks].sort((e,t)=>Date.parse(e.at)-Date.parse(t.at)).map(e=>[e.id,e])).values()].sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||e.id.localeCompare(t.id)).slice(0,5):null}}function h(e){let{title:t,children:n}=e;return(0,s.jsxs)("section",{"aria-label":t,className:"min-w-0 rounded-xl border border-border bg-card p-3 sm:p-4",children:[(0,s.jsx)("h2",{className:"text-xs font-medium text-muted-foreground sm:text-sm",children:t}),(0,s.jsx)("div",{className:"mt-2 text-lg font-semibold leading-snug tabular-nums sm:text-xl",children:n})]})}function g(){var e,t;let{client:n}=(0,l.Q)(),[a,i]=(0,r.useState)(u);return(0,r.useEffect)(()=>{let e=!0;return i(u),b(n).then(t=>{e&&i(t)}),()=>{e=!1}},[n]),(0,s.jsxs)("main",{className:"mx-auto w-full min-w-0 max-w-3xl px-3 py-4 text-foreground sm:px-6",children:[(0,s.jsxs)("header",{className:"mb-4",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"운영 \xb7 오늘"}),(0,s.jsx)("h1",{className:"text-xl font-semibold",children:"대표 조망판"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2 sm:gap-4","aria-label":"대표 조망 카드",children:[(0,s.jsx)(h,{title:"릴리스 판 진행",children:a.release?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"text-emerald-600",children:["green ",a.release.green]}),(0,s.jsxs)("span",{className:"block text-amber-600",children:["노랑 ",a.release.yellow]})]}):"못 읽음"}),(0,s.jsx)(h,{title:"루프 판정",children:null===a.loops?"못 읽음":0===Object.keys(a.loops).length?"등록 0":(0,s.jsx)("div",{className:"flex flex-wrap gap-1 text-xs font-medium",children:Object.entries(a.loops).map(e=>{let[t,n]=e;return(0,s.jsxs)("span",{className:"rounded-full bg-muted px-2 py-1",children:[t," ",n]},t)})})}),(0,s.jsx)(h,{title:"결정 대기 카드",children:null!=(e=a.decisions)?e:"못 읽음"}),(0,s.jsx)(h,{title:"오늘 병합 PR",children:null!=(t=a.merged)?t:"못 읽음"})]}),(0,s.jsxs)("div",{className:"mt-2 grid min-w-0 grid-cols-2 gap-2 sm:mt-4 sm:gap-4","aria-label":"위험과 그리드 카드",children:[(0,s.jsxs)("section",{"aria-label":"위험\xb7막힘 톱 5",className:"min-w-0 rounded-xl border border-border bg-card p-2 sm:p-4",children:[(0,s.jsx)("h2",{className:"text-xs font-medium text-muted-foreground sm:text-sm",children:"위험\xb7막힘 톱 5"}),null===a.risks?(0,s.jsx)("p",{className:"mt-2 text-sm",children:"못 읽음"}):0===a.risks.length?(0,s.jsx)("p",{className:"mt-2 text-sm",children:"해당 없음"}):(0,s.jsx)("ol",{className:"mt-2 space-y-1 text-xs",children:a.risks.map(e=>(0,s.jsxs)("li",{className:"min-w-0 border-b border-border pb-1 last:border-0",children:[(0,s.jsxs)("span",{className:"block text-muted-foreground",children:[e.kind," \xb7 ",(0,s.jsx)("time",{dateTime:e.at,children:e.at.slice(0,16).replace("T"," ")})]}),(0,s.jsx)("span",{className:"block truncate",title:e.title,children:e.title})]},e.id))})]}),(0,s.jsxs)("section",{"aria-label":"그리드",className:"min-w-0 rounded-xl border border-border bg-card p-2 sm:p-4",children:[(0,s.jsx)("h2",{className:"text-xs font-medium text-muted-foreground sm:text-sm",children:"그리드"}),(0,s.jsx)("p",{className:"mt-2 text-sm",children:"준비 중"})]})]})]})}},15151:(e,t,n)=>{"use strict";n.d(t,{C:()=>u,DaemonProvider:()=>d,Q:()=>c});var s=n(55539),r=n(46124),l=n(8101),a=n(5997),i=n(18060),o=n(72215);let u=(0,r.createContext)(null);function d(e){let{children:t}=e,n={baseUrl:"",token:"",provider:""},[d,c]=(0,r.useState)(n),[m,f]=(0,r.useState)(""),[y]=(0,r.useState)(()=>new i.ki(n));(0,r.useEffect)(()=>{let e=(0,l.Fp)();c(e),y.updateConfig(e),f((0,a.oD)()),(0,o.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[y]),(0,r.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,l.Fp)();y.updateConfig(t),c(t),(0,o.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&f(t=>t===e.newValue?t:((0,o.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[y]);let p=e=>{c(t=>{let n={...t,...e};return(0,l.Qc)(e),y.updateConfig(n),(0,o.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),n})},v=e=>{f(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,o.cY)("webterm.provider.daemon.session-set",{sessionId:e})},b=(0,r.useMemo)(()=>({config:d,setConfig:p,client:y,sessionId:m,setSessionId:v}),[d,y,m]);return(0,s.jsx)(u.Provider,{value:b,children:t})}function c(){let e=(0,r.useContext)(u);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}},29325:(e,t,n)=>{"use strict";function s(e,t){if(!e.enabled||"off"===e.scheduleState)return"off";if("failed"===e.lastStatus||"error"===e.lastStatus||"failure"===e.lastStatus||"abandoned"===e.lastStatus||"expired"===e.lastStatus)return"failed";if("stale"===e.scheduleState)return"late";let n=null===e.lastRunAt?NaN:Date.parse(e.lastRunAt);if(void 0!==e.secondDueAt){let s=null===e.secondDueAt?NaN:Date.parse(e.secondDueAt);return Number.isFinite(n)&&Number.isFinite(t)&&Number.isFinite(s)&&s>n&&t>s?"late":"alive"}return Number.isFinite(t)&&Number.isFinite(n)&&null!==e.intervalMs&&Number.isFinite(e.intervalMs)&&e.intervalMs>0&&t-n>2*e.intervalMs?"late":"alive"}n.d(t,{u:()=>s})},33626:(e,t,n)=>{"use strict";async function s(e){let t=await e.fetchResponse("/v1/decisions?status=open");if(!t.ok)throw Error("decisions list failed: ".concat(t.status));return(await t.json()).decisions}async function r(e,t,n){let s=await e.fetchResponse("/v1/decisions/".concat(encodeURIComponent(t),"/decide"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({choice:n})});if(!s.ok)throw Error("decision failed: ".concat(s.status))}n.d(t,{L:()=>r,q:()=>s})},42006:(e,t,n)=>{"use strict";n.d(t,{QK:()=>a,i6:()=>l,Pz:()=>o,Em:()=>i,Yy:()=>u});var s=n(29325);let r={alive:"살아 있음",late:"늦음",failed:"실패",off:"꺼짐"},l="/v1/schedules?includeOff=1",a="/v1/dashboard/loops";async function i(e,t){var n,i,o,d,c,m,f,y;let[p,v]=await Promise.allSettled([e(l),e(a)]),b="fulfilled"===p.status?null==(n=p.value)?void 0:n.schedules:null,h="fulfilled"===v.status?null==(o=v.value)||null==(i=o.loops)?void 0:i.loops:null;if(!Array.isArray(b)&&!Array.isArray(h))throw Error("loop registries unavailable");if(!Array.isArray(b))throw Error("스케줄 레지스트리 조회 실패");if(!Array.isArray(h))throw Error("루프 레지스트리 조회 실패");let g=u(b,t).map(e=>({...e,id:"schedule:".concat(e.id)}));for(let e of h){let n=e.last?Date.parse(e.last.at):NaN,l=(0,s.u)({enabled:!1!==e.armed,lastRunAt:null!=(m=null==(d=e.last)?void 0:d.at)?m:null,lastStatus:null!=(f=null==(c=e.last)?void 0:c.status.toLowerCase())?f:null,intervalMs:null},t);g.push({id:"loop:".concat(e.name),name:e.label,layer:null!=(y=e.category)?y:"루프",owner:"미지정",mode:null===e.armed?"관측":e.armed?"armed":"off",lastRun:Number.isFinite(n)?e.last.at:null,verdict:"alive"===l?"판정 불가":r[l]})}return g}function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now,s=0,r=!0;return{async refresh(){let l=++s;try{let a=await i(e,n());r&&l===s&&t({rows:a,state:"ready"})}catch(e){r&&l===s&&t({rows:[],state:"error"})}},dispose(){r=!1}}}function u(e,t){return e.map(e=>{var n,l,a,i,o,u,d;let c=e.lastRun?Date.parse(e.lastRun.at):NaN,m=(0,s.u)({enabled:"off"!==e.state,lastRunAt:null!=(u=null==(n=e.lastRun)?void 0:n.at)?u:null,lastStatus:(null==(l=e.lastRun)?void 0:l.exit)!=null&&0!==e.lastRun.exit?"failed":(null==(a=e.lastRun)?void 0:a.status)==null||["ok","success","completed"].includes(e.lastRun.status.toLowerCase())?null!=(d=null==(o=e.lastRun)||null==(i=o.status)?void 0:i.toLowerCase())?d:null:"failed",intervalMs:e.cron?null:e.intervalMs,...e.cron?{scheduleState:e.state}:{}},t),f=!e.cron&&!(e.intervalMs&&e.intervalMs>0),y="alive"===m&&(!Number.isFinite(c)||f)?"판정 불가":r[m];return{id:e.id,name:e.name,layer:e.domain||e.category||e.source,owner:"미지정",mode:e.runVia||e.source,lastRun:Number.isFinite(c)?e.lastRun.at:null,verdict:y}})}},43537:(e,t,n)=>{"use strict";function s(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function r(e){return"string"==typeof e}function l(e){return r(e)&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/.test(e)&&Number.isFinite(Date.parse(e))&&new Date(e).toISOString().slice(0,19)===e.slice(0,19)}function a(e){return s(e)&&r(e.nodeId)&&(null===e.ok||"boolean"==typeof e.ok)&&r(e.summary)}function i(e){return s(e)&&r(e.runId)&&r(e.status)&&r(e.startedAt)&&(null===e.version||r(e.version))&&Array.isArray(e.path)&&e.path.every(r)&&Array.isArray(e.nodes)&&e.nodes.every(a)}function o(e){return s(e)&&r(e.id)&&r(e.title)&&r(e.status)&&(void 0===e.owner||r(e.owner))&&r(e.updatedAt)&&(void 0===e.evidence||r(e.evidence))}n.d(t,{HG:()=>v,Kh:()=>p,Nn:()=>f,oc:()=>y});let u=e=>Number.isInteger(e)&&e>=0;function d(e){return s(e)&&r(e.id)&&r(e.title)&&(null===e.open||u(e.open))&&(null===e.landed||u(e.landed))&&(null===e.blocked||Array.isArray(e.blocked)&&e.blocked.every(e=>s(e)&&r(e.id)&&r(e.title)))}function c(e){return s(e)&&["OP","MK","TC","UX"].includes(e.seat)&&(void 0===e.role||r(e.role))&&(null===e.now||s(e.now)&&r(e.now.text)&&r(e.now.at))&&(null===e.landed||Array.isArray(e.landed)&&e.landed.every(e=>s(e)&&u(e.pr)&&r(e.title)&&r(e.at)&&(null===e.checklistId||r(e.checklistId))))&&(null===e.blocked||Array.isArray(e.blocked)&&e.blocked.every(e=>s(e)&&r(e.id)&&r(e.title)&&"red"===e.status))&&(null===e.pendingDecisions||u(e.pendingDecisions))&&(null===e.checklist||s(e.checklist)&&["green","yellow","red","done"].every(t=>u(e.checklist[t])))&&(void 0===e.subSeats||null===e.subSeats||Array.isArray(e.subSeats)&&e.subSeats.every(d))}async function m(e,t,n){try{let s=await e.fetchResponse(t,{method:"GET"});if(403===s.status)return{kind:"forbidden"};if(!s.ok)return{kind:"error",status:s.status};let r=n(await s.json());return null===r?{kind:"error",status:s.status}:{kind:"ready",data:r}}catch(e){return{kind:"error",status:0}}}function f(e,t){return m(e,"/v1/ops/seats".concat(t?"?date=".concat(encodeURIComponent(t)):""),e=>s(e)&&r(e.date)&&Array.isArray(e.seats)&&e.seats.every(c)&&new Set(e.seats.map(e=>e.seat)).size===e.seats.length?{date:e.date,seats:e.seats}:null)}function y(e,t){return m(e,"/v1/ops/release/runs".concat(t?"?version=".concat(encodeURIComponent(t)):""),e=>Array.isArray(e)&&e.every(i)?e:null)}function p(e,t,n){return m(e,"/v1/ops/release/runs/".concat(encodeURIComponent(t),"/nodes/").concat(encodeURIComponent(n),"/log"),e=>s(e)&&r(e.log)?{log:e.log}:null)}function v(e,t){return m(e,"/v1/ops/checklist?version=".concat(encodeURIComponent(t)),e=>{var t,n,a,i;if(!(s(e)&&r(e.version)&&(void 0===e.codename||r(e.codename))&&Array.isArray(e.items)&&e.items.every(o)&&["green","yellow","red","done"].every(t=>void 0===e[t]||Number.isInteger(e[t])&&e[t]>=0)&&(void 0===e.blocked||Array.isArray(e.blocked)&&e.blocked.every(r))&&(void 0===e.byOwner||s(e.byOwner)&&Object.values(e.byOwner).every(e=>Number.isInteger(e)&&e>=0))&&(void 0===e.history||Array.isArray(e.history))))return null;let u={green:0,yellow:0,red:0,done:0};for(let t of e.items)t.status in u&&u[t.status]++;return{version:e.version,...void 0!==e.codename?{codename:e.codename}:{},schedule:s(e.schedule)&&l(e.schedule.cutAt)&&(null===e.schedule.landBy||l(e.schedule.landBy))?{cutAt:e.schedule.cutAt,landBy:e.schedule.landBy}:null,items:e.items,green:null!=(t=e.green)?t:u.green,yellow:null!=(n=e.yellow)?n:u.yellow,red:null!=(a=e.red)?a:u.red,done:null!=(i=e.done)?i:u.done,...void 0!==e.blocked?{blocked:e.blocked}:{},...void 0!==e.byOwner?{byOwner:e.byOwner}:{},...void 0!==e.history?{history:e.history}:{}}})}},75112:(e,t,n)=>{Promise.resolve().then(n.bind(n,13685))}},e=>{e.O(0,[8060,2463,2196,7358],()=>e(e.s=75112)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8457],{3704:(e,r,t)=>{"use strict";t.d(r,{A:()=>c});var i=t(46124);let l=function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.filter((e,r,t)=>!!e&&""!==e.trim()&&t.indexOf(e)===r).join(" ").trim()},a=e=>{let r=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,t)=>t?t.toUpperCase():r.toLowerCase());return r.charAt(0).toUpperCase()+r.slice(1)};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,i.createContext)({}),d=(0,i.forwardRef)((e,r)=>{var t,a,d;let{color:c,size:o,strokeWidth:u,absoluteStrokeWidth:h,className:p="",children:k,iconNode:y,...f}=e,{size:g=24,strokeWidth:v=2,absoluteStrokeWidth:b=!1,color:m="currentColor",className:x=""}=null!=(t=(0,i.useContext)(s))?t:{},w=(null!=h?h:b)?24*Number(null!=u?u:v)/Number(null!=o?o:g):null!=u?u:v;return(0,i.createElement)("svg",{ref:r,...n,width:null!=(a=null!=o?o:g)?a:n.width,height:null!=(d=null!=o?o:g)?d:n.height,stroke:null!=c?c:m,strokeWidth:w,className:l("lucide",x,p),...!k&&!(e=>{for(let r in e)if(r.startsWith("aria-")||"role"===r||"title"===r)return!0;return!1})(f)&&{"aria-hidden":"true"},...f},[...y.map(e=>{let[r,t]=e;return(0,i.createElement)(r,t)}),...Array.isArray(k)?k:[k]])}),c=(e,r)=>{let t=(0,i.forwardRef)((t,n)=>{let{className:s,...c}=t;return(0,i.createElement)(d,{ref:n,iconNode:r,className:l("lucide-".concat(a(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),s),...c})});return t.displayName=a(e),t}},8819:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},21383:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},30158:(e,r,t)=>{"use strict";t.d(r,{p:()=>n});var i=t(55539);t(46124);var l=t(8085),a=t(44373);function n(e){let{className:r,type:t,...n}=e;return(0,i.jsx)(l.p,{type:t,"data-slot":"input",className:(0,a.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",r),...n})}},35622:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]])},46586:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]])},56360:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]])},75342:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},83754:(e,r,t)=>{Promise.resolve().then(t.bind(t,50899))}},e=>{e.O(0,[211,8682,7327,8085,1826,5233,8060,7395,4144,8827,4614,899,2463,2196,7358],()=>e(e.s=83754)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8457],{3704:(e,r,t)=>{"use strict";t.d(r,{A:()=>c});var i=t(46124);let l=function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.filter((e,r,t)=>!!e&&""!==e.trim()&&t.indexOf(e)===r).join(" ").trim()},a=e=>{let r=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,t)=>t?t.toUpperCase():r.toLowerCase());return r.charAt(0).toUpperCase()+r.slice(1)};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,i.createContext)({}),d=(0,i.forwardRef)((e,r)=>{var t,a,d;let{color:c,size:o,strokeWidth:u,absoluteStrokeWidth:h,className:p="",children:k,iconNode:y,...f}=e,{size:g=24,strokeWidth:v=2,absoluteStrokeWidth:b=!1,color:m="currentColor",className:x=""}=null!=(t=(0,i.useContext)(s))?t:{},w=(null!=h?h:b)?24*Number(null!=u?u:v)/Number(null!=o?o:g):null!=u?u:v;return(0,i.createElement)("svg",{ref:r,...n,width:null!=(a=null!=o?o:g)?a:n.width,height:null!=(d=null!=o?o:g)?d:n.height,stroke:null!=c?c:m,strokeWidth:w,className:l("lucide",x,p),...!k&&!(e=>{for(let r in e)if(r.startsWith("aria-")||"role"===r||"title"===r)return!0;return!1})(f)&&{"aria-hidden":"true"},...f},[...y.map(e=>{let[r,t]=e;return(0,i.createElement)(r,t)}),...Array.isArray(k)?k:[k]])}),c=(e,r)=>{let t=(0,i.forwardRef)((t,n)=>{let{className:s,...c}=t;return(0,i.createElement)(d,{ref:n,iconNode:r,className:l("lucide-".concat(a(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),s),...c})});return t.displayName=a(e),t}},8819:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},21383:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},30158:(e,r,t)=>{"use strict";t.d(r,{p:()=>n});var i=t(55539);t(46124);var l=t(8085),a=t(44373);function n(e){let{className:r,type:t,...n}=e;return(0,i.jsx)(l.p,{type:t,"data-slot":"input",className:(0,a.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",r),...n})}},35622:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]])},46586:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]])},56360:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]])},75342:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});let i=(0,t(3704).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},79095:(e,r,t)=>{Promise.resolve().then(t.bind(t,50899))}},e=>{e.O(0,[211,8682,7327,8085,1826,5233,8060,7395,4144,8827,4614,899,2463,2196,7358],()=>e(e.s=79095)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3933],{5997:(e,t,s)=>{"use strict";s.d(t,{Zr:()=>l,f6:()=>n,oD:()=>r});let a="elanous.daemon.sessionId";function n(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function r(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(a,e),e):localStorage.getItem(a)}();if(e)return e;let t=n();return localStorage.setItem(a,t),t}function l(){let e=n();return localStorage.setItem(a,e),e}},8015:(e,t,s)=>{Promise.resolve().then(s.bind(s,29744))},15151:(e,t,s)=>{"use strict";s.d(t,{C:()=>i,DaemonProvider:()=>d,Q:()=>m});var a=s(55539),n=s(46124),r=s(8101),l=s(5997),o=s(18060),c=s(72215);let i=(0,n.createContext)(null);function d(e){let{children:t}=e,s={baseUrl:"",token:"",provider:""},[d,m]=(0,n.useState)(s),[u,p]=(0,n.useState)(""),[x]=(0,n.useState)(()=>new o.ki(s));(0,n.useEffect)(()=>{let e=(0,r.Fp)();m(e),x.updateConfig(e),p((0,l.oD)()),(0,c.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[x]),(0,n.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,r.Fp)();x.updateConfig(t),m(t),(0,c.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&p(t=>t===e.newValue?t:((0,c.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[x]);let f=e=>{m(t=>{let s={...t,...e};return(0,r.Qc)(e),x.updateConfig(s),(0,c.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),s})},h=e=>{p(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,c.cY)("webterm.provider.daemon.session-set",{sessionId:e})},g=(0,n.useMemo)(()=>({config:d,setConfig:f,client:x,sessionId:u,setSessionId:h}),[d,x,u]);return(0,a.jsx)(i.Provider,{value:g,children:t})}function m(){let e=(0,n.useContext)(i);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}},29744:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c});var a=s(55539),n=s(46124),r=s(15151);let l="user@elanvital.ai",o={name:"이름",org:"회사명",kind:"회사/개인",interest:"관심 분야",contact:"연락처",consent:"동의"};function c(){let{client:e}=(0,r.Q)(),[t,s]=(0,n.useState)(""),[c,i]=(0,n.useState)(""),[d,m]=(0,n.useState)("personal"),[u,p]=(0,n.useState)("A"),[x,f]=(0,n.useState)(""),[h,g]=(0,n.useState)(!1),[b,y]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[k,N]=(0,n.useState)(!1);async function w(s){if(s.preventDefault(),!h||b)return;let a={name:t.trim(),..."company"===d?{org:c.trim()}:{},kind:d,interest:u,contact:x.trim(),consent:!0},n=a.name?"company"!==d||a.org?a.contact?null:"contact":"org":"name";if(n){N(!0),v("".concat(o[n]," 항목을 입력해 주세요."));return}y(!0),v("");try{let t=await e.submitConsultRequest(a);if("receiptId"in t)N(!1),v("접수했습니다 \xb7 ".concat(t.receiptId," — 곧 연락드리겠습니다"));else{var r;N(!0),v("".concat(null!=(r=o[t.field])?r:"필수"," 항목을 확인해 주세요."))}}catch(e){N(!0),v("접수하지 못했습니다. 연결 상태를 확인하고 다시 보내 주세요.")}finally{y(!1)}}return(0,a.jsxs)("main",{className:"mx-auto w-full max-w-xl px-5 py-10 sm:py-16",children:[(0,a.jsxs)("header",{className:"mb-8",children:[(0,a.jsx)("p",{className:"mb-2 text-sm font-medium text-primary",children:"AX \xb7 상담 문의"}),(0,a.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:"어떤 도움이 필요하신가요?"}),(0,a.jsx)("p",{className:"mt-3 text-sm text-muted-foreground",children:"도입 상담이나 교육 과정에 대해 남겨 주세요. 확인 후 연락드리겠습니다."}),(0,a.jsxs)("p",{className:"mt-2 text-sm text-muted-foreground",children:["메일로 바로 문의: ",(0,a.jsx)("a",{className:"underline",href:"mailto:".concat(l),children:l})]})]}),(0,a.jsxs)("form",{onSubmit:w,noValidate:!0,className:"space-y-6 rounded-xl border border-border bg-card p-5 sm:p-8",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{htmlFor:"consult-name",className:"block text-sm font-medium",children:"이름"}),(0,a.jsx)("input",{id:"consult-name",name:"name",required:!0,autoComplete:"name",value:t,onChange:e=>s(e.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm"})]}),(0,a.jsxs)("fieldset",{className:"space-y-2",children:[(0,a.jsx)("legend",{className:"text-sm font-medium",children:"회사/개인"}),(0,a.jsxs)("div",{className:"flex gap-5 text-sm",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"radio",name:"kind",value:"company",checked:"company"===d,onChange:()=>m("company")}),"회사"]}),(0,a.jsxs)("label",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"radio",name:"kind",value:"personal",checked:"personal"===d,onChange:()=>m("personal")}),"개인"]})]})]}),"company"===d&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{htmlFor:"consult-org",className:"block text-sm font-medium",children:"회사명"}),(0,a.jsx)("input",{id:"consult-org",name:"org",required:!0,autoComplete:"organization",value:c,onChange:e=>i(e.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm"})]}),(0,a.jsxs)("fieldset",{className:"space-y-2",children:[(0,a.jsx)("legend",{className:"text-sm font-medium",children:"관심 분야"}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 text-sm",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"radio",name:"interest",value:"A",checked:"A"===u,onChange:()=>p("A")}),"A \xb7 AX 도입 상담"]}),(0,a.jsxs)("label",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"radio",name:"interest",value:"B",checked:"B"===u,onChange:()=>p("B")}),"B \xb7 과정\xb7교육 문의"]})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{htmlFor:"consult-contact",className:"block text-sm font-medium",children:"연락처 (메일 또는 전화)"}),(0,a.jsx)("input",{id:"consult-contact",name:"contact",required:!0,value:x,onChange:e=>f(e.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm"})]}),(0,a.jsxs)("label",{className:"flex items-start gap-3 text-sm leading-6",children:[(0,a.jsx)("input",{type:"checkbox",name:"consent",checked:h,onChange:e=>g(e.target.checked),className:"mt-1"}),(0,a.jsx)("span",{children:"입력한 정보는 상담 연락을 위해 서버로 전송하며, 상담 연락에만 사용합니다"})]}),j&&(0,a.jsx)("p",{role:k?"alert":"status",className:k?"text-sm text-destructive":"text-sm text-primary",children:j}),(0,a.jsx)("button",{type:"submit",disabled:!h||b,className:"w-full rounded-md bg-primary px-4 py-2.5 text-sm font-medium text-primary-foreground disabled:cursor-not-allowed disabled:opacity-50",children:b?"보내는 중…":"보내기"})]})]})}}},e=>{e.O(0,[8060,2463,2196,7358],()=>e(e.s=8015)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2580],{5997:(e,t,r)=>{"use strict";r.d(t,{Zr:()=>o,f6:()=>n,oD:()=>s});let a="elanous.daemon.sessionId";function n(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function s(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(a,e),e):localStorage.getItem(a)}();if(e)return e;let t=n();return localStorage.setItem(a,t),t}function o(){let e=n();return localStorage.setItem(a,e),e}},9734:(e,t,r)=>{"use strict";r.d(t,{$:()=>l});var a=r(55539),n=r(89545),s=r(17154),o=r(44373);let i=(0,s.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:r="default",size:s="default",...l}=e;return(0,a.jsx)(n.$,{"data-slot":"button",className:(0,o.cn)(i({variant:r,size:s,className:t})),...l})}},15151:(e,t,r)=>{"use strict";r.d(t,{C:()=>d,DaemonProvider:()=>c,Q:()=>u});var a=r(55539),n=r(46124),s=r(8101),o=r(5997),i=r(18060),l=r(72215);let d=(0,n.createContext)(null);function c(e){let{children:t}=e,r={baseUrl:"",token:"",provider:""},[c,u]=(0,n.useState)(r),[p,m]=(0,n.useState)(""),[g]=(0,n.useState)(()=>new i.ki(r));(0,n.useEffect)(()=>{let e=(0,s.Fp)();u(e),g.updateConfig(e),m((0,o.oD)()),(0,l.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[g]),(0,n.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,s.Fp)();g.updateConfig(t),u(t),(0,l.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&m(t=>t===e.newValue?t:((0,l.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[g]);let x=e=>{u(t=>{let r={...t,...e};return(0,s.Qc)(e),g.updateConfig(r),(0,l.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),r})},v=e=>{m(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,l.cY)("webterm.provider.daemon.session-set",{sessionId:e})},f=(0,n.useMemo)(()=>({config:c,setConfig:x,client:g,sessionId:p,setSessionId:v}),[c,g,p]);return(0,a.jsx)(d.Provider,{value:f,children:t})}function u(){let e=(0,n.useContext)(d);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}},30158:(e,t,r)=>{"use strict";r.d(t,{p:()=>o});var a=r(55539);r(46124);var n=r(8085),s=r(44373);function o(e){let{className:t,type:r,...o}=e;return(0,a.jsx)(n.p,{type:r,"data-slot":"input",className:(0,s.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...o})}},38012:(e,t,r)=>{Promise.resolve().then(r.bind(r,65137))},44373:(e,t,r)=>{"use strict";r.d(t,{cn:()=>s});var a=r(20852),n=r(30984);function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.QP)((0,a.$)(t))}},65137:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});var a=r(55539),n=r(93521);function s(){return(0,a.jsx)(n.U,{})}},93521:(e,t,r)=>{"use strict";r.d(t,{U:()=>m});var a=r(55539),n=r(46124),s=r(15151),o=r(9734),i=r(30158);function l(e){let{items:t}=e;return 0===t.length?(0,a.jsx)("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-sm text-muted-foreground",children:"No control signals matched the current filter."}):(0,a.jsx)("ul",{className:"space-y-2",children:t.map((e,t)=>{var r,n,s,o,i;let l=[(null==(r=e.scope)?void 0:r.surface)&&"surface=".concat(e.scope.surface),(null==(n=e.scope)?void 0:n.channel)&&"channel=".concat(e.scope.channel),(null==(s=e.scope)?void 0:s.sessionId)&&"session=".concat(e.scope.sessionId)].filter(Boolean).join(" \xb7 ")||"unscoped";return(0,a.jsxs)("li",{className:"rounded-lg border border-border bg-card p-3 shadow-sm",children:[(0,a.jsxs)("div",{className:"text-sm font-medium",children:[e.kind," \xb7 ",e.urgency]}),(0,a.jsxs)("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground",children:[function(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):"".concat(Math.floor(t/864e5),"d ago")}(e.createdAt)," \xb7 ",null!=(o=e.source)?o:"unknown"," \xb7 ",l]}),(0,a.jsx)("pre",{className:"mt-2 overflow-x-auto rounded-md bg-muted p-2 text-[11px]",children:JSON.stringify(null!=(i=e.payload)?i:{},null,2)})]},t)})})}let d=["background","quick-pass","normal","priority","critical"];class c{async list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new URLSearchParams;Object.entries(e).forEach(e=>{let[r,a]=e;a&&t.set(r,a)});let r=t.toString();return this.client.fetchJson("/v1/control-signals".concat(r?"?".concat(r):""))}emit(e){return this.client.fetchJson("/v1/control-signals",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}constructor(e){this.client=e}}var u=r(67327),p=r(72215);function m(){var e,t,r,m;let{client:g}=(0,s.Q)(),x=(0,n.useMemo)(()=>new c(g),[g]),[v,f]=(0,n.useState)({items:[]}),[b,h]=(0,n.useState)(!1),[y,w]=(0,n.useState)(""),[k,j]=(0,n.useState)(""),[N,S]=(0,n.useState)(""),[C,z]=(0,n.useState)(""),[I,E]=(0,n.useState)(""),[U,D]=(0,n.useState)(""),[_,O]=(0,n.useState)("normal"),[P,J]=(0,n.useState)("operator"),[R,Y]=(0,n.useState)(""),[M,V]=(0,n.useState)(""),[$,F]=(0,n.useState)(""),[L,Q]=(0,n.useState)(""),[T,q]=(0,n.useState)(!1),A=(0,n.useCallback)(async()=>{(0,p.cY)("webterm.control.list.refresh",{kind:y,surface:k,minUrgency:N,sessionId:C,limit:I}),h(!0);try{let e=await x.list({kind:y||void 0,surface:k||void 0,minUrgency:N||void 0,sessionId:C||void 0,limit:I||void 0});f(e)}catch(e){u.oR.error("signals list failed: ".concat(e instanceof Error?e.message:e))}finally{h(!1)}},[x,y,k,N,C,I]);(0,n.useEffect)(()=>{A()},[A]);let B=async e=>{if(e.preventDefault(),!U.trim())return void u.oR.error("kind required");let t={};if(L.trim())try{t=JSON.parse(L)}catch(e){u.oR.error("payload must be valid JSON");return}let r={kind:U.trim(),urgency:_,source:P.trim()||"operator",mayPreempt:T,payload:t,scope:{...R?{surface:R}:{},...M?{channel:M}:{},...$?{sessionId:$}:{}}};(0,p.cY)("webterm.control.emit",{kind:r.kind,urgency:r.urgency});try{h(!0),await x.emit(r),u.oR.success("signal emitted"),Q(""),await A()}catch(e){u.oR.error("emit failed: ".concat(e instanceof Error?e.message:e))}finally{h(!1)}},K=null!=(e=v.countsByKind)?e:{};return(0,a.jsxs)("div",{className:"mx-auto max-w-5xl space-y-4 p-4",children:[(0,a.jsxs)("header",{className:"space-y-2",children:[(0,a.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Control signals"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 text-[11px] text-muted-foreground",children:[(0,a.jsxs)("span",{className:"rounded-full border border-border px-2 py-0.5",children:["total ",null!=(t=v.total)?t:0]}),(0,a.jsxs)("span",{className:"rounded-full border border-border px-2 py-0.5",children:["latest ",null!=(r=v.latest)?r:"-"]}),Object.entries(K).map(e=>{let[t,r]=e;return(0,a.jsxs)("span",{className:"rounded-full border border-border px-2 py-0.5",children:[t," ",r]},t)})]})]}),(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),A()},className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-card p-3 shadow-sm",children:[(0,a.jsx)(i.p,{value:y,onChange:e=>w(e.target.value),placeholder:"kind",className:"flex-1 min-w-[140px]"}),(0,a.jsx)(i.p,{value:k,onChange:e=>j(e.target.value),placeholder:"surface",className:"flex-1 min-w-[140px]"}),(0,a.jsxs)("select",{value:N,onChange:e=>S(e.target.value),className:"h-9 flex-1 min-w-[170px] rounded-md border border-input bg-background px-2 text-sm",children:[(0,a.jsx)("option",{value:"",children:"min urgency (any)"}),d.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsx)(i.p,{value:C,onChange:e=>z(e.target.value),placeholder:"session id",className:"flex-1 min-w-[140px]"}),(0,a.jsx)(i.p,{value:I,onChange:e=>E(e.target.value),placeholder:"limit",type:"number",className:"w-[100px]"}),(0,a.jsx)(o.$,{type:"submit",size:"sm",disabled:b,children:"Filter"})]}),(0,a.jsxs)("form",{onSubmit:B,className:"space-y-2 rounded-lg border border-border bg-card p-3 shadow-sm",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Emit a signal"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(i.p,{value:U,onChange:e=>D(e.target.value),placeholder:"kind (required)",className:"flex-1 min-w-[140px]"}),(0,a.jsx)("select",{value:_,onChange:e=>{let t=e.target.value;"string"==typeof t&&d.includes(t)&&O(t)},className:"h-9 rounded-md border border-input bg-background px-2 text-sm",children:d.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}),(0,a.jsx)(i.p,{value:P,onChange:e=>J(e.target.value),placeholder:"source",className:"flex-1 min-w-[120px]"}),(0,a.jsx)(i.p,{value:R,onChange:e=>Y(e.target.value),placeholder:"scope.surface",className:"flex-1 min-w-[120px]"}),(0,a.jsx)(i.p,{value:M,onChange:e=>V(e.target.value),placeholder:"scope.channel",className:"flex-1 min-w-[120px]"}),(0,a.jsx)(i.p,{value:$,onChange:e=>F(e.target.value),placeholder:"scope.session",className:"flex-1 min-w-[120px]"}),(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-xs",children:[(0,a.jsx)("input",{type:"checkbox",checked:T,onChange:e=>q(e.target.checked)}),"mayPreempt"]})]}),(0,a.jsx)("textarea",{value:L,onChange:e=>Q(e.target.value),placeholder:'payload JSON (optional, e.g. {"reason":"manual"})',rows:3,className:"w-full resize-y rounded-md border border-input bg-background px-3 py-2 font-mono text-xs"}),(0,a.jsx)(o.$,{type:"submit",size:"sm",disabled:b,children:"Emit"})]}),(0,a.jsx)(l,{items:null!=(m=v.items)?m:[]})]})}}},e=>{e.O(0,[211,8682,7327,8085,8060,2463,2196,7358],()=>e(e.s=38012)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6348],{3004:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3704).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},18068:(e,t,s)=>{"use strict";s.d(t,{Qb:()=>a,SI:()=>o,dJ:()=>l});let n="elanous:auth-required",r=null,i=!1;function a(e){null===r&&(r=e,window.dispatchEvent(new CustomEvent(n,{detail:{path:e}})))}function l(e){let t=window,s=t=>e(t.detail);return t.addEventListener(n,s),null===r||i||e({path:r}),()=>t.removeEventListener(n,s)}function o(){i=!0}},24231:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3704).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},47106:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>E});var n=s(55539),r=s(81694),i=s(3004);let a=(0,s(3704).A)("circle-dashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);var l=s(74227),o=s(24231),c=s(46124),d=s(94306),u=s(21501),h=s(50363),m=s(67264),p=s(65354),g=s(79247);function f(e){let{available:t,declared:s,onPick:r,pendingId:i,previews:a,onPreview:l}=e,{systems:o,themes:c}=function(e){let t=[],s=[];for(let n of e)("design-system"===n.source?t:s).push(n);return{systems:t,themes:s}}(t);return(0,n.jsxs)("div",{className:"space-y-4",children:[o.length>0&&(0,n.jsx)(x,{title:"Design systems",hint:"Web \xb7 copies tokens.css and DESIGN.md into design/system/",items:o,declared:s,onPick:r,pendingId:i,previews:a,onPreview:l}),c.length>0&&(0,n.jsx)(x,{title:"Terminal themes",hint:"One line in DESIGN.md",items:c,declared:s,onPick:r,pendingId:i,previews:a,onPreview:l})]})}function x(e){let{title:t,hint:s,items:r,declared:i,onPick:a,pendingId:l,previews:o,onPreview:c}=e;return(0,n.jsxs)("section",{className:"space-y-2","aria-label":t,children:[(0,n.jsxs)("h3",{className:"flex items-baseline gap-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:[t,(0,n.jsxs)("span",{className:"normal-case tracking-normal",children:[r.length," \xb7 ",s]})]}),(0,n.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:r.map(e=>(0,n.jsx)(b,{direction:e,chosen:e.id===i,onPick:a,pending:l===e.id,busy:null!==l,hasPreview:(null==o?void 0:o.has(e.id))===!0&&void 0!==c,onPreview:c},e.id))})]})}function b(e){var t,s,r,a,l,o,c,d,u;let{direction:h,chosen:m,onPick:p,pending:g,busy:f,hasPreview:x,onPreview:b}=e,y=null!=(r=h.swatch.bg)?r:h.isDark?"#111111":"#ffffff",v=null!=(a=h.swatch.fg)?a:h.swatch.text,w=null!=(o=null!=(l=null==(t=h.typography)?void 0:t.display)?l:null==(s=h.typography)?void 0:s.body)?o:null;return(0,n.jsxs)("li",{"data-direction":h.id,"data-direction-id":h.id,className:"flex flex-col gap-2 rounded-md border p-3 text-sm ".concat(m?"border-primary ring-1 ring-primary":""),children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5","aria-hidden":!0,children:[[y,v,h.swatch.accent].map((e,t)=>(0,n.jsx)("span",{className:"h-5 w-5 rounded-full border",style:{backgroundColor:e,borderColor:h.swatch.muted}},t)),h.category&&(0,n.jsx)("span",{className:"ml-auto truncate text-[11px] text-muted-foreground",children:h.category})]}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate font-medium",children:null!=(c=h.label)?c:h.id}),(0,n.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[(0,n.jsx)("code",{children:h.id}),w?" \xb7 ".concat(w):""]}),(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:h.mood})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,n.jsx)("button",{type:"button",onClick:()=>null==b?void 0:b(h.id),className:"self-start rounded-md border px-2.5 py-1 text-xs hover:bg-muted","aria-label":"Preview ".concat(null!=(d=h.label)?d:h.id),children:"Preview"}),m?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-primary",children:[(0,n.jsx)(i.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Selected"]}):(0,n.jsx)("button",{type:"button",disabled:f,onClick:()=>p(h.id),className:"self-start rounded-md border px-2.5 py-1 text-xs hover:bg-muted disabled:opacity-50","aria-label":"Select ".concat(null!=(u=h.label)?u:h.id),children:g?"Selecting…":"Select"})]})]})}let y=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function v(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean)}function w(e,t){if("undefined"==typeof document)return t;let s=document.getElementById(e);return s&&"value"in s&&"string"==typeof s.value?s.value:t}function k(e){let{onCreate:t,onSelect:s,pending:r,result:i,error:a}=e,[l,o]=(0,c.useState)("url"),[d,u]=(0,c.useState)(""),[h,m]=(0,c.useState)(""),[p,g]=(0,c.useState)(""),f=v(h).filter(e=>y.test(e)),x=v(h).length,b=x>=2&&x<=6&&p.trim().length>0&&f.length===x;return(0,n.jsxs)("section",{className:"rounded-md border p-3","aria-label":"Make my system","data-make-my-system":"",children:[(0,n.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-medium",children:"Make my system"}),(0,n.jsxs)("div",{className:"flex gap-1",role:"tablist",children:[(0,n.jsx)("button",{type:"button",role:"tab","aria-selected":"url"===l,className:"rounded-md px-2 py-1 text-xs ".concat("url"===l?"bg-muted":""),onClick:()=>o("url"),children:"From a website"}),(0,n.jsx)("button",{type:"button",role:"tab","aria-selected":"colors"===l,className:"rounded-md px-2 py-1 text-xs ".concat("colors"===l?"bg-muted":""),onClick:()=>o("colors"),children:"From colors"})]})]}),(0,n.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Reference, not a copy — logos, names, images and text are not taken."}),"url"===l?(0,n.jsxs)("form",{className:"mt-2 flex flex-col gap-2 sm:flex-row",onSubmit:e=>{e.preventDefault();let s=d.trim();s&&!r&&t({kind:"url",url:s})},children:[(0,n.jsx)("label",{className:"sr-only",htmlFor:"make-system-url",children:"Website URL"}),(0,n.jsx)("input",{id:"make-system-url",type:"url",value:d,disabled:r,placeholder:"https://example.com",onChange:e=>u(e.target.value),className:"min-w-0 flex-1 rounded-md border bg-transparent px-2 py-1.5 text-sm"}),(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>{let e=w("make-system-url",d).trim();e&&!r&&t({kind:"url",url:e})},className:"rounded-md border px-3 py-1.5 text-sm hover:bg-muted disabled:opacity-50",children:r?"Measuring…":"Make it"})]}):(0,n.jsxs)("form",{className:"mt-2 space-y-2",onSubmit:e=>{e.preventDefault(),b&&!r&&t({kind:"palette",colors:f,id:p.trim()})},children:[(0,n.jsx)("label",{className:"block text-xs text-muted-foreground",htmlFor:"make-system-colors",children:"2–6 colors"}),(0,n.jsx)("input",{id:"make-system-colors",value:h,disabled:r,placeholder:"#f4efe6, #1f3a2e, #c8553d",onChange:e=>m(e.target.value),className:"w-full rounded-md border bg-transparent px-2 py-1.5 text-sm"}),f.length>0&&(0,n.jsx)("ul",{className:"flex gap-1","aria-label":"Color preview",children:f.map(e=>(0,n.jsx)("li",{className:"h-6 w-6 rounded-sm border",style:{backgroundColor:e},title:e},e))}),(0,n.jsx)("label",{className:"block text-xs text-muted-foreground",htmlFor:"make-system-id",children:"id"}),(0,n.jsx)("input",{id:"make-system-id",value:p,disabled:r,placeholder:"stumptowncoffee",onChange:e=>g(e.target.value),className:"w-full rounded-md border bg-transparent px-2 py-1.5 text-sm"}),(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>{let e=v(w("make-system-colors",h)).filter(e=>y.test(e)),s=w("make-system-id",p).trim();r||e.length<2||e.length>6||0===s.length||t({kind:"palette",colors:e,id:s})},className:"rounded-md border px-3 py-1.5 text-sm hover:bg-muted disabled:opacity-50",children:r?"Measuring…":"Make it"})]}),r&&(0,n.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Measuring…"}),a&&(0,n.jsx)("p",{className:"mt-2 text-sm text-error",role:"alert",children:a}),i&&(0,n.jsxs)("div",{className:"mt-2 space-y-1 text-sm",children:[(0,n.jsxs)("p",{children:["Made ",i.id," — ",i.tokens.length," tokens \xb7 ",i.unread," unread"]}),i.warnings.map(e=>(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:e},e)),(0,n.jsx)("button",{type:"button",onClick:()=>s(i.id),className:"rounded-md border px-2.5 py-1 text-xs hover:bg-muted",children:"Select it"})]})]})}let j={missing:"Missing",declared:"Declared",available:"Not declared"},N={missing:"bg-error/10 text-error",declared:"bg-green-600/10 text-green-700",available:"bg-muted text-muted-foreground"},S={missing:r.A,declared:i.A,available:a};function C(){return(0,d.Qj)()?(0,n.jsx)(M,{}):(0,n.jsxs)("div",{className:"mx-auto max-w-2xl space-y-2 p-6",children:[(0,n.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Design check"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connect to a NEXUS daemon to see this repository's craft rulebooks."})]})}function M(){let{data:e,isLoading:t,error:s,refetch:i,isFetching:a}=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=(0,d.M1)();return(0,u.I)({queryKey:p.AF.designCheck(),queryFn:()=>s.getDesignCheck(),enabled:null==(e=t.enabled)||e,refetchInterval:3e4})}();return(0,n.jsxs)("div",{className:"mx-auto max-w-3xl space-y-4 p-6",children:[(0,n.jsxs)("header",{className:"flex items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[(0,n.jsx)(l.A,{className:"h-5 w-5","aria-hidden":!0}),"Design check"]}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Craft rulebooks declared by this repository's ",(0,n.jsx)("code",{children:"DESIGN.md"}),"."]})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void i(),className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm hover:bg-muted","aria-label":"Refresh design check",children:[(0,n.jsx)(o.A,{className:"h-4 w-4 ".concat(a?"animate-spin":""),"aria-hidden":!0}),"Refresh"]})]}),t&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading…"}),s&&(0,n.jsxs)("p",{className:"rounded-md bg-error/10 p-3 text-sm text-error",children:["Could not reach the daemon: ",s instanceof Error?s.message:String(s)]}),e&&!1===e.ok&&(0,n.jsxs)("div",{className:"space-y-2 rounded-md border border-warning/40 bg-warning/5 p-4",children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,n.jsx)(r.A,{className:"h-4 w-4 text-warning","aria-hidden":!0}),"Design check blocked"]}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:function(e,t){switch(e){case"no-repository":return"The daemon is not running inside a git checkout, so there is no DESIGN.md to check.";case"craft-directory":return"elanous's craft rulebook directory could not be read: ".concat(null!=t?t:"(unknown path)");case"design-document":return"This repository has no readable DESIGN.md: ".concat(null!=t?t:"(unknown path)");default:return"The design check is blocked (".concat(e,").")}}(e.blockedOn,e.path)})]}),e&&!0===e.ok&&(0,n.jsx)(F,{data:e})]})}function F(e){let{data:t}=e,s=function(e){let t=new Set(e.unavailableRulebooks),s=new Map;for(let t of e.availableRulebooks)s.set(t,"available");for(let n of e.declaredRulebooks)s.set(n,t.has(n)?"missing":"declared");let n={missing:0,declared:1,available:2};return[...s.entries()].map(e=>{let[t,s]=e;return{name:t,status:s}}).sort((e,t)=>n[e.status]-n[t.status]||e.name.localeCompare(t.name))}(t),r=t.unavailableRulebooks.length;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"rounded-md p-3 text-sm ".concat(r?"bg-error/10 text-error":"bg-green-600/10 text-green-700"),children:r?"".concat(r," declared rulebook").concat(1===r?"":"s"," could not be found."):"All ".concat(t.declaredRulebooks.length," declared rulebook").concat(1===t.declaredRulebooks.length?"":"s"," resolve.")}),(0,n.jsxs)("dl",{className:"grid grid-cols-1 gap-1 text-xs text-muted-foreground sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"truncate sm:col-span-2",children:[(0,n.jsx)("dt",{className:"inline font-medium",children:"Repository: "}),(0,n.jsxs)("dd",{className:"inline",children:[(0,n.jsx)("code",{children:t.repoRoot}),t.repoSource&&(0,n.jsxs)("span",{className:"ml-1",children:["(","config"===t.repoSource?"harness.defaultRepo":"daemon folder",")"]})]})]}),(0,n.jsxs)("div",{className:"truncate",children:[(0,n.jsx)("dt",{className:"inline font-medium",children:"Document: "}),(0,n.jsx)("dd",{className:"inline",children:(0,n.jsx)("code",{children:t.documentPath})})]}),(0,n.jsxs)("div",{className:"truncate",children:[(0,n.jsx)("dt",{className:"inline font-medium",children:"Rulebooks: "}),(0,n.jsx)("dd",{className:"inline",children:(0,n.jsx)("code",{children:t.craftDirectory})})]})]}),(0,n.jsx)(O,{data:t}),0===s.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"elanous ships no craft rulebooks and this document declares none."}):(0,n.jsx)("ul",{className:"divide-y rounded-md border",children:s.map(e=>{let t=S[e.status];return(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[(0,n.jsxs)("span",{className:"flex items-center gap-2 text-sm",children:[(0,n.jsx)(t,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,n.jsx)("code",{children:e.name})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-xs ".concat(N[e.status]),children:j[e.status]})]},e.name)})})]})}function O(e){var t,s,r,i;let{data:a}=e,l=function(){let e=(0,d.M1)(),t=(0,h.jE)();return(0,m.n)({mutationFn:t=>e.setDesignDirection(t),onSuccess:()=>t.invalidateQueries({queryKey:p.AF.designCheck()})})}(),o=function(){let e=(0,d.M1)(),t=(0,h.jE)();return(0,m.n)({mutationFn:t=>e.createDesignSystem(t),onSuccess:()=>t.invalidateQueries({queryKey:p.AF.designCheck()})})}(),x=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=(0,d.M1)();return(0,u.I)({queryKey:p.AF.designPreviews(),queryFn:()=>s.listDesignPreviews(),enabled:null==(e=t.enabled)||e,refetchInterval:3e4})}(),[b,y]=(0,c.useState)(null),[v,w]=(0,c.useState)(null),j=a.directions;if((0,c.useEffect)(()=>{if(!v||!j)return;let e=document.querySelector('[data-direction-id="'.concat(v.replace(/"/g,""),'"]'));null==e||e.scrollIntoView({block:"nearest"})},[v,j]),!j)return null;let N=l.isPending&&null!=(s=l.variables)?s:null;return(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsx)("h2",{className:"text-sm font-medium",children:"Design direction"}),(0,n.jsx)(k,{pending:o.isPending,result:null!=(r=o.data)?r:null,error:o.isError?function(e){switch(e instanceof g.Iu&&e.body&&"object"==typeof e.body?e.body.reason:void 0){case"bad-url":return"That address is not an http or https URL.";case"bad-id":return"The id may only use lowercase letters, digits, and hyphens.";case"id-taken":return"That id is already taken.";case"extract-failed":return"The page could not be measured.";case"no-colors":return"Give between 2 and 6 colors.";case"busy":return"Another system is being made — wait for it to finish.";default:if(e instanceof g.Iu&&401===e.status)return"Only the owner can make a system — sign in first.";return"Could not make the system: ".concat(e instanceof Error?e.message:String(e))}}(o.error):null,onCreate:e=>{o.mutate(e,{onSuccess:e=>w(e.id)})},onSelect:e=>{w(e),l.mutate(e)}}),j.unavailable&&(0,n.jsxs)("p",{className:"rounded-md bg-error/10 p-2 text-sm text-error",children:["Declared direction ",(0,n.jsx)("code",{children:j.unavailable})," is not registered."]}),null===j.declared&&!j.unavailable&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"None declared — pick one below."}),l.isError&&(0,n.jsx)("p",{className:"rounded-md bg-error/10 p-2 text-sm text-error",children:function(e){switch(e instanceof g.Iu&&e.body&&"object"==typeof e.body?e.body.reason:void 0){case"unknown-direction":return"The daemon does not know this direction.";case"no-repository":return"The daemon has no repository to write to (set harness.defaultRepo).";case"conflicting-system-file":return"design/system/ already holds a file the daemon will not overwrite.";case"cannot-read":return"The DESIGN.md could not be read.";case"cannot-write":return"The DESIGN.md could not be written.";default:if(e instanceof g.Iu&&401===e.status)return"Only the owner can pick a direction — sign in first.";return"Could not set the direction: ".concat(e instanceof Error?e.message:String(e))}}(l.error)}),b&&(0,n.jsx)(A,{system:b,onClose:()=>y(null),onSelect:()=>l.mutate(b),selecting:N===b,busy:null!==N,alreadySelected:j.declared===b}),(0,n.jsx)(f,{available:j.available,declared:j.declared,pendingId:N,previews:new Set((null!=(i=null==(t=x.data)?void 0:t.previews)?i:[]).map(e=>e.system)),onPreview:e=>y(e),onPick:e=>l.mutate(e)})]})}function A(e){let{system:t,onClose:s,onSelect:r,selecting:i,busy:a,alreadySelected:l}=e,o=function(e){let t=(0,d.M1)();return(0,u.I)({queryKey:p.AF.designPreview(null!=e?e:""),queryFn:()=>t.getDesignPreview(e),enabled:null!==e&&""!==e})}(t);return(0,n.jsxs)("div",{className:"space-y-2 rounded-md border p-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsxs)("p",{className:"text-sm font-medium",children:["Preview \xb7 ",(0,n.jsx)("code",{children:t})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[l?(0,n.jsx)("span",{className:"text-xs text-primary",children:"Selected"}):(0,n.jsx)("button",{type:"button",disabled:a,onClick:r,className:"rounded-md border px-2.5 py-1 text-xs hover:bg-muted disabled:opacity-50","aria-label":"Select ".concat(t),children:i?"Selecting…":"Select"}),(0,n.jsx)("button",{type:"button",onClick:s,className:"rounded-md border px-2.5 py-1 text-xs hover:bg-muted","aria-label":"Close preview",children:"Close"})]})]}),o.isLoading&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading preview…"}),o.isError&&(0,n.jsxs)("p",{className:"text-sm text-error",children:["Could not load the preview: ",o.error instanceof Error?o.error.message:String(o.error)]}),o.data&&(0,n.jsx)("iframe",{sandbox:"",srcDoc:o.data.html,title:"Preview \xb7 ".concat(t),className:"h-80 w-full rounded-md border bg-white"})]})}function E(){return(0,n.jsx)(C,{})}},65354:(e,t,s)=>{"use strict";s.d(t,{AF:()=>n});let n={all:["nexus"],health:()=>[...n.all,"health"],snapshot:()=>[...n.all,"snapshot"],tabs:e=>e?[...n.all,"tabs",{kind:e}]:[...n.all,"tabs"],tab:e=>[...n.all,"tab",e],templates:()=>[...n.all,"templates"],template:e=>[...n.all,"template",e],config:()=>[...n.all,"config"],switches:()=>[...n.all,"switches"],switch:e=>[...n.all,"switch",e],secrets:()=>[...n.all,"secrets"],bindingChannels:()=>[...n.all,"bindings","channels"],bindings:e=>[...n.all,"bindings",e],binding:(e,t)=>[...n.all,"binding",e,t],logsTail:(e,t)=>t?[...n.all,"logs",e,{lines:t}]:[...n.all,"logs",e],workflows:()=>[...n.all,"workflows"],workflow:e=>[...n.all,"workflow",e],workflowRun:e=>[...n.all,"workflow-run",e],workflowRuns:()=>[...n.all,"workflow-runs"],pendingApprovals:()=>[...n.all,"workflow-pending-approvals"],platforms:()=>[...n.all,"platforms"],providers:()=>[...n.all,"providers"],worktrees:()=>[...n.all,"worktrees"],designCheck:()=>[...n.all,"design-check"],designPreviews:()=>[...n.all,"design-previews"],designPreview:e=>[...n.all,"design-preview",e],registryCatalog:()=>[...n.all,"registry-catalog"],resolvedView:()=>[...n.all,"resolved-view"]};n.snapshot(),n.tabs(),n.health(),n.snapshot(),n.config(),n.switches()},67264:(e,t,s)=>{"use strict";s.d(t,{n:()=>d});var n=s(46124),r=s(17600),i=s(92477),a=s(33814),l=s(40404),o=class extends a.Q{#e;#t=void 0;#s;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,l.f8)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,l.EN)(t.mutationKey)!==(0,l.EN)(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(e){this.#r(),this.#i(e)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#r(),this.#i()}mutate(e,t){return this.#n=t,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(e)}#r(){let e=this.#s?.state??(0,r.$)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#i(e){i.jG.batch(()=>{if(this.#n&&this.hasListeners()){let t=this.#t.variables,s=this.#t.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#n.onSuccess?.(e.data,t,s,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(e.data,null,t,s,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#n.onError?.(e.error,t,s,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(void 0,e.error,t,s,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},c=s(50363);function d(e,t){let s=(0,c.jE)(t),[r]=n.useState(()=>new o(s,e));n.useEffect(()=>{r.setOptions(e)},[r,e]);let a=n.useSyncExternalStore(n.useCallback(e=>r.subscribe(i.jG.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),d=n.useCallback((e,t)=>{r.mutate(e,t).catch(l.lQ)},[r]);if(a.error&&(0,l.GU)(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:d,mutateAsync:a.mutate}}},72215:(e,t,s)=>{"use strict";let n;s.d(t,{cY:()=>d,x8:()=>l});let r={debug:0,info:1,warn:2,error:3},i="/v1/debug-logs/batch",a=null;function l(e){a=e}class o{health(){return{pending:this.queue.length,consecutiveFailures:this.consecutiveFailures,lastOkAt:this.lastOkAt,droppedByCap:this.droppedByCap,fallbackBatches:this.fallbackBatches}}push(e){if(!(r[function(e){let t=e.slice(e.lastIndexOf(".")+1).toLowerCase();return/^(error|exception|crash|fail|failed)$/.test(t)?"error":/^(warn|degraded|timeout)$/.test(t)?"warn":/^(boot|ready|start|begin|open|ok|done|resolve|end|stop|close)$/.test(t)?"info":"debug"}(e.category)]<r[this.minLevel])){if(this.queue.push(e),this.queue.length>500){let e=this.queue.length-500;this.droppedByCap+=e,this.queue.splice(0,e)}if(this.queue.length>=100&&!this.inFlight){null!==this.timer&&(clearTimeout(this.timer),this.timer=null),this.flush();return}null===this.timer&&(this.timer=setTimeout(()=>{this.flush()},this.flushMs))}}async flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.inFlight||0===this.queue.length)return;let e=this.queue.slice(0,100);this.inFlight=!0;let t=!1,s=JSON.stringify({records:e});try{var n,r;t=await (n=this.fetchFn(s),r=this.postTimeoutMs,new Promise((e,t)=>{let s=setTimeout(()=>t(Error("debug-forward timeout after ".concat(r,"ms"))),r);n.then(t=>{clearTimeout(s),e(t)},e=>{clearTimeout(s),t(e)})}))}catch(e){t=!1}finally{this.inFlight=!1}if(!t){if(this.consecutiveFailures+=1,this.consecutiveFailures>=2&&a)try{await a(JSON.stringify({records:[...e,this.blockedNotice()]}))&&(this.fallbackBatches+=1)}catch(e){}this.wasFailing=!0,this.scheduleRetry();return}let i=this.lastOkAt;this.lastOkAt=Date.now();let l=this.consecutiveFailures;this.consecutiveFailures=0,this.queue.splice(0,e.length),this.wasFailing&&(this.wasFailing=!1,this.queue.push({ts:new Date().toISOString(),category:"pwa.debug-forwarder.recovered",event:"recovered",data:{consecutiveFailures:l,droppedByCap:this.droppedByCap,fallbackBatches:this.fallbackBatches,pending:this.queue.length,previousOkAt:i},source:{platform:"pwa"}})),this.queue.length>0&&null===this.timer&&(this.timer=setTimeout(()=>{this.flush()},this.flushMs))}scheduleRetry(){if(null!==this.timer||0===this.queue.length)return;let e=Math.min(this.flushMs*2**this.consecutiveFailures,3e4);this.timer=setTimeout(()=>{this.flush()},e)}blockedNotice(){return{ts:new Date().toISOString(),category:"pwa.debug-forwarder.http-blocked",event:"http-blocked",data:{consecutiveFailures:this.consecutiveFailures,pending:this.queue.length,droppedByCap:this.droppedByCap,lastOkAt:this.lastOkAt,via:"acp-fallback"},source:{platform:"pwa"}}}beaconFlush(){if(0!==this.queue.length)try{if("undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon){let e=this.queue.slice(0,100),t=new Blob([JSON.stringify({records:e})],{type:"application/json"});navigator.sendBeacon(i,t)&&this.queue.splice(0,e.length)}}catch(e){}}get pending(){return this.queue.length}constructor(e=c,t="debug",s=1e4,n=100){this.fetchFn=e,this.minLevel=t,this.postTimeoutMs=s,this.flushMs=n,this.queue=[],this.timer=null,this.inFlight=!1,this.consecutiveFailures=0,this.lastOkAt=null,this.droppedByCap=0,this.fallbackBatches=0,this.wasFailing=!1}}async function c(e){return(await fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:e,keepalive:!0,..."undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.timeout?{signal:AbortSignal.timeout(1e4)}:{}})).ok}function d(e,t){if("undefined"==typeof console)return;let s=new Date().toISOString();if(void 0!==t){let n="";try{let e=new WeakSet;n=JSON.stringify(t,(t,s)=>{if("bigint"==typeof s)return"".concat(s.toString(),"n");if("function"==typeof s)return"[fn ".concat(s.name||"anon","]");if(s&&"object"==typeof s){if(e.has(s))return"[circular]";e.add(s)}return s})}catch(e){n="[unserializable: ".concat(String(e),"]")}n&&n.length>800&&(n=n.slice(0,797)+"..."),console.debug("[".concat(s,"] ").concat(e," ").concat(n),t),u(s,e,n)}else console.debug("[".concat(s,"] ").concat(e)),u(s,e,void 0)}function u(e,t,s){let r,i=function(){if(void 0!==n)return n;let e=function(){try{let e="off"!==window.localStorage.getItem("elanous.pwa.debug.forward"),t=window.localStorage.getItem("elanous.pwa.debug.forwardLevel");return{forward:e,level:"info"===t||"warn"===t||"error"===t?t:"debug"}}catch(e){return{forward:!0,level:"debug"}}}();if(!e.forward)return n=null,null;let t=new o(c,e.level,1e4,1500);try{window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&t.beaconFlush()})}catch(e){}return n=t,t}();if(!i)return;let a=t.slice(t.lastIndexOf(".")+1)||t;if(void 0!==s&&""!==s)try{r=JSON.parse(s)}catch(e){r=s}i.push({ts:e,category:t,event:a,...void 0!==r?{data:r}:{},source:{platform:"pwa"}})}},74227:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3704).A)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},81694:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3704).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},90499:(e,t,s)=>{Promise.resolve().then(s.bind(s,47106))},94306:(e,t,s)=>{"use strict";s.d(t,{M1:()=>c,Qj:()=>d,tI:()=>o});var n=s(55539),r=s(46124),i=s(76642),a=s(50363);let l=(0,r.createContext)(null);function o(e){let{client:t,queryClient:s,defaultStaleTimeMs:o,children:c}=e,d=(0,r.useMemo)(()=>null!=s?s:new i.E({defaultOptions:{queries:{staleTime:null!=o?o:2e3,refetchOnWindowFocus:!1}}}),[s,o]);return(0,n.jsx)(l.Provider,{value:t,children:(0,n.jsx)(a.Ht,{client:d,children:c})})}function c(){let e=(0,r.useContext)(l);if(!e)throw Error("useNexusClient must be used within <NexusProvider>");return e}function d(){return(0,r.useContext)(l)}}},e=>{e.O(0,[3324,1844,9247,2463,2196,7358],()=>e(e.s=90499)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6348],{3004:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3704).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},18068:(e,t,s)=>{"use strict";s.d(t,{Qb:()=>a,SI:()=>o,dJ:()=>l});let n="elanous:auth-required",r=null,i=!1;function a(e){null===r&&(r=e,window.dispatchEvent(new CustomEvent(n,{detail:{path:e}})))}function l(e){let t=window,s=t=>e(t.detail);return t.addEventListener(n,s),null===r||i||e({path:r}),()=>t.removeEventListener(n,s)}function o(){i=!0}},24231:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3704).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},47106:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>E});var n=s(55539),r=s(81694),i=s(3004);let a=(0,s(3704).A)("circle-dashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);var l=s(74227),o=s(24231),c=s(46124),d=s(94306),u=s(21501),h=s(50363),m=s(67264),p=s(65354),g=s(79247);function f(e){let{available:t,declared:s,onPick:r,pendingId:i,previews:a,onPreview:l}=e,{systems:o,themes:c}=function(e){let t=[],s=[];for(let n of e)("design-system"===n.source?t:s).push(n);return{systems:t,themes:s}}(t);return(0,n.jsxs)("div",{className:"space-y-4",children:[o.length>0&&(0,n.jsx)(x,{title:"Design systems",hint:"Web \xb7 copies tokens.css and DESIGN.md into design/system/",items:o,declared:s,onPick:r,pendingId:i,previews:a,onPreview:l}),c.length>0&&(0,n.jsx)(x,{title:"Terminal themes",hint:"One line in DESIGN.md",items:c,declared:s,onPick:r,pendingId:i,previews:a,onPreview:l})]})}function x(e){let{title:t,hint:s,items:r,declared:i,onPick:a,pendingId:l,previews:o,onPreview:c}=e;return(0,n.jsxs)("section",{className:"space-y-2","aria-label":t,children:[(0,n.jsxs)("h3",{className:"flex items-baseline gap-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:[t,(0,n.jsxs)("span",{className:"normal-case tracking-normal",children:[r.length," \xb7 ",s]})]}),(0,n.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:r.map(e=>(0,n.jsx)(b,{direction:e,chosen:e.id===i,onPick:a,pending:l===e.id,busy:null!==l,hasPreview:(null==o?void 0:o.has(e.id))===!0&&void 0!==c,onPreview:c},e.id))})]})}function b(e){var t,s,r,a,l,o,c,d,u;let{direction:h,chosen:m,onPick:p,pending:g,busy:f,hasPreview:x,onPreview:b}=e,y=null!=(r=h.swatch.bg)?r:h.isDark?"#111111":"#ffffff",v=null!=(a=h.swatch.fg)?a:h.swatch.text,w=null!=(o=null!=(l=null==(t=h.typography)?void 0:t.display)?l:null==(s=h.typography)?void 0:s.body)?o:null;return(0,n.jsxs)("li",{"data-direction":h.id,"data-direction-id":h.id,className:"flex flex-col gap-2 rounded-md border p-3 text-sm ".concat(m?"border-primary ring-1 ring-primary":""),children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5","aria-hidden":!0,children:[[y,v,h.swatch.accent].map((e,t)=>(0,n.jsx)("span",{className:"h-5 w-5 rounded-full border",style:{backgroundColor:e,borderColor:h.swatch.muted}},t)),h.category&&(0,n.jsx)("span",{className:"ml-auto truncate text-[11px] text-muted-foreground",children:h.category})]}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate font-medium",children:null!=(c=h.label)?c:h.id}),(0,n.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[(0,n.jsx)("code",{children:h.id}),w?" \xb7 ".concat(w):""]}),(0,n.jsx)("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:h.mood})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,n.jsx)("button",{type:"button",onClick:()=>null==b?void 0:b(h.id),className:"self-start rounded-md border px-2.5 py-1 text-xs hover:bg-muted","aria-label":"Preview ".concat(null!=(d=h.label)?d:h.id),children:"Preview"}),m?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-primary",children:[(0,n.jsx)(i.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Selected"]}):(0,n.jsx)("button",{type:"button",disabled:f,onClick:()=>p(h.id),className:"self-start rounded-md border px-2.5 py-1 text-xs hover:bg-muted disabled:opacity-50","aria-label":"Select ".concat(null!=(u=h.label)?u:h.id),children:g?"Selecting…":"Select"})]})]})}let y=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function v(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean)}function w(e,t){if("undefined"==typeof document)return t;let s=document.getElementById(e);return s&&"value"in s&&"string"==typeof s.value?s.value:t}function k(e){let{onCreate:t,onSelect:s,pending:r,result:i,error:a}=e,[l,o]=(0,c.useState)("url"),[d,u]=(0,c.useState)(""),[h,m]=(0,c.useState)(""),[p,g]=(0,c.useState)(""),f=v(h).filter(e=>y.test(e)),x=v(h).length,b=x>=2&&x<=6&&p.trim().length>0&&f.length===x;return(0,n.jsxs)("section",{className:"rounded-md border p-3","aria-label":"Make my system","data-make-my-system":"",children:[(0,n.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-sm font-medium",children:"Make my system"}),(0,n.jsxs)("div",{className:"flex gap-1",role:"tablist",children:[(0,n.jsx)("button",{type:"button",role:"tab","aria-selected":"url"===l,className:"rounded-md px-2 py-1 text-xs ".concat("url"===l?"bg-muted":""),onClick:()=>o("url"),children:"From a website"}),(0,n.jsx)("button",{type:"button",role:"tab","aria-selected":"colors"===l,className:"rounded-md px-2 py-1 text-xs ".concat("colors"===l?"bg-muted":""),onClick:()=>o("colors"),children:"From colors"})]})]}),(0,n.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Reference, not a copy — logos, names, images and text are not taken."}),"url"===l?(0,n.jsxs)("form",{className:"mt-2 flex flex-col gap-2 sm:flex-row",onSubmit:e=>{e.preventDefault();let s=d.trim();s&&!r&&t({kind:"url",url:s})},children:[(0,n.jsx)("label",{className:"sr-only",htmlFor:"make-system-url",children:"Website URL"}),(0,n.jsx)("input",{id:"make-system-url",type:"url",value:d,disabled:r,placeholder:"https://example.com",onChange:e=>u(e.target.value),className:"min-w-0 flex-1 rounded-md border bg-transparent px-2 py-1.5 text-sm"}),(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>{let e=w("make-system-url",d).trim();e&&!r&&t({kind:"url",url:e})},className:"rounded-md border px-3 py-1.5 text-sm hover:bg-muted disabled:opacity-50",children:r?"Measuring…":"Make it"})]}):(0,n.jsxs)("form",{className:"mt-2 space-y-2",onSubmit:e=>{e.preventDefault(),b&&!r&&t({kind:"palette",colors:f,id:p.trim()})},children:[(0,n.jsx)("label",{className:"block text-xs text-muted-foreground",htmlFor:"make-system-colors",children:"2–6 colors"}),(0,n.jsx)("input",{id:"make-system-colors",value:h,disabled:r,placeholder:"#f4efe6, #1f3a2e, #c8553d",onChange:e=>m(e.target.value),className:"w-full rounded-md border bg-transparent px-2 py-1.5 text-sm"}),f.length>0&&(0,n.jsx)("ul",{className:"flex gap-1","aria-label":"Color preview",children:f.map(e=>(0,n.jsx)("li",{className:"h-6 w-6 rounded-sm border",style:{backgroundColor:e},title:e},e))}),(0,n.jsx)("label",{className:"block text-xs text-muted-foreground",htmlFor:"make-system-id",children:"id"}),(0,n.jsx)("input",{id:"make-system-id",value:p,disabled:r,placeholder:"stumptowncoffee",onChange:e=>g(e.target.value),className:"w-full rounded-md border bg-transparent px-2 py-1.5 text-sm"}),(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>{let e=v(w("make-system-colors",h)).filter(e=>y.test(e)),s=w("make-system-id",p).trim();r||e.length<2||e.length>6||0===s.length||t({kind:"palette",colors:e,id:s})},className:"rounded-md border px-3 py-1.5 text-sm hover:bg-muted disabled:opacity-50",children:r?"Measuring…":"Make it"})]}),r&&(0,n.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Measuring…"}),a&&(0,n.jsx)("p",{className:"mt-2 text-sm text-error",role:"alert",children:a}),i&&(0,n.jsxs)("div",{className:"mt-2 space-y-1 text-sm",children:[(0,n.jsxs)("p",{children:["Made ",i.id," — ",i.tokens.length," tokens \xb7 ",i.unread," unread"]}),i.warnings.map(e=>(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:e},e)),(0,n.jsx)("button",{type:"button",onClick:()=>s(i.id),className:"rounded-md border px-2.5 py-1 text-xs hover:bg-muted",children:"Select it"})]})]})}let j={missing:"Missing",declared:"Declared",available:"Not declared"},N={missing:"bg-error/10 text-error",declared:"bg-green-600/10 text-green-700",available:"bg-muted text-muted-foreground"},S={missing:r.A,declared:i.A,available:a};function C(){return(0,d.Qj)()?(0,n.jsx)(M,{}):(0,n.jsxs)("div",{className:"mx-auto max-w-2xl space-y-2 p-6",children:[(0,n.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Design check"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connect to a NEXUS daemon to see this repository's craft rulebooks."})]})}function M(){let{data:e,isLoading:t,error:s,refetch:i,isFetching:a}=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=(0,d.M1)();return(0,u.I)({queryKey:p.AF.designCheck(),queryFn:()=>s.getDesignCheck(),enabled:null==(e=t.enabled)||e,refetchInterval:3e4})}();return(0,n.jsxs)("div",{className:"mx-auto max-w-3xl space-y-4 p-6",children:[(0,n.jsxs)("header",{className:"flex items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[(0,n.jsx)(l.A,{className:"h-5 w-5","aria-hidden":!0}),"Design check"]}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Craft rulebooks declared by this repository's ",(0,n.jsx)("code",{children:"DESIGN.md"}),"."]})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>void i(),className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-sm hover:bg-muted","aria-label":"Refresh design check",children:[(0,n.jsx)(o.A,{className:"h-4 w-4 ".concat(a?"animate-spin":""),"aria-hidden":!0}),"Refresh"]})]}),t&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading…"}),s&&(0,n.jsxs)("p",{className:"rounded-md bg-error/10 p-3 text-sm text-error",children:["Could not reach the daemon: ",s instanceof Error?s.message:String(s)]}),e&&!1===e.ok&&(0,n.jsxs)("div",{className:"space-y-2 rounded-md border border-warning/40 bg-warning/5 p-4",children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,n.jsx)(r.A,{className:"h-4 w-4 text-warning","aria-hidden":!0}),"Design check blocked"]}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:function(e,t){switch(e){case"no-repository":return"The daemon is not running inside a git checkout, so there is no DESIGN.md to check.";case"craft-directory":return"elanous's craft rulebook directory could not be read: ".concat(null!=t?t:"(unknown path)");case"design-document":return"This repository has no readable DESIGN.md: ".concat(null!=t?t:"(unknown path)");default:return"The design check is blocked (".concat(e,").")}}(e.blockedOn,e.path)})]}),e&&!0===e.ok&&(0,n.jsx)(F,{data:e})]})}function F(e){let{data:t}=e,s=function(e){let t=new Set(e.unavailableRulebooks),s=new Map;for(let t of e.availableRulebooks)s.set(t,"available");for(let n of e.declaredRulebooks)s.set(n,t.has(n)?"missing":"declared");let n={missing:0,declared:1,available:2};return[...s.entries()].map(e=>{let[t,s]=e;return{name:t,status:s}}).sort((e,t)=>n[e.status]-n[t.status]||e.name.localeCompare(t.name))}(t),r=t.unavailableRulebooks.length;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"rounded-md p-3 text-sm ".concat(r?"bg-error/10 text-error":"bg-green-600/10 text-green-700"),children:r?"".concat(r," declared rulebook").concat(1===r?"":"s"," could not be found."):"All ".concat(t.declaredRulebooks.length," declared rulebook").concat(1===t.declaredRulebooks.length?"":"s"," resolve.")}),(0,n.jsxs)("dl",{className:"grid grid-cols-1 gap-1 text-xs text-muted-foreground sm:grid-cols-2",children:[(0,n.jsxs)("div",{className:"truncate sm:col-span-2",children:[(0,n.jsx)("dt",{className:"inline font-medium",children:"Repository: "}),(0,n.jsxs)("dd",{className:"inline",children:[(0,n.jsx)("code",{children:t.repoRoot}),t.repoSource&&(0,n.jsxs)("span",{className:"ml-1",children:["(","config"===t.repoSource?"harness.defaultRepo":"daemon folder",")"]})]})]}),(0,n.jsxs)("div",{className:"truncate",children:[(0,n.jsx)("dt",{className:"inline font-medium",children:"Document: "}),(0,n.jsx)("dd",{className:"inline",children:(0,n.jsx)("code",{children:t.documentPath})})]}),(0,n.jsxs)("div",{className:"truncate",children:[(0,n.jsx)("dt",{className:"inline font-medium",children:"Rulebooks: "}),(0,n.jsx)("dd",{className:"inline",children:(0,n.jsx)("code",{children:t.craftDirectory})})]})]}),(0,n.jsx)(O,{data:t}),0===s.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"elanous ships no craft rulebooks and this document declares none."}):(0,n.jsx)("ul",{className:"divide-y rounded-md border",children:s.map(e=>{let t=S[e.status];return(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[(0,n.jsxs)("span",{className:"flex items-center gap-2 text-sm",children:[(0,n.jsx)(t,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,n.jsx)("code",{children:e.name})]}),(0,n.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-xs ".concat(N[e.status]),children:j[e.status]})]},e.name)})})]})}function O(e){var t,s,r,i;let{data:a}=e,l=function(){let e=(0,d.M1)(),t=(0,h.jE)();return(0,m.n)({mutationFn:t=>e.setDesignDirection(t),onSuccess:()=>t.invalidateQueries({queryKey:p.AF.designCheck()})})}(),o=function(){let e=(0,d.M1)(),t=(0,h.jE)();return(0,m.n)({mutationFn:t=>e.createDesignSystem(t),onSuccess:()=>t.invalidateQueries({queryKey:p.AF.designCheck()})})}(),x=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=(0,d.M1)();return(0,u.I)({queryKey:p.AF.designPreviews(),queryFn:()=>s.listDesignPreviews(),enabled:null==(e=t.enabled)||e,refetchInterval:3e4})}(),[b,y]=(0,c.useState)(null),[v,w]=(0,c.useState)(null),j=a.directions;if((0,c.useEffect)(()=>{if(!v||!j)return;let e=document.querySelector('[data-direction-id="'.concat(v.replace(/"/g,""),'"]'));null==e||e.scrollIntoView({block:"nearest"})},[v,j]),!j)return null;let N=l.isPending&&null!=(s=l.variables)?s:null;return(0,n.jsxs)("section",{className:"space-y-2",children:[(0,n.jsx)("h2",{className:"text-sm font-medium",children:"Design direction"}),(0,n.jsx)(k,{pending:o.isPending,result:null!=(r=o.data)?r:null,error:o.isError?function(e){switch(e instanceof g.Iu&&e.body&&"object"==typeof e.body?e.body.reason:void 0){case"bad-url":return"That address is not an http or https URL.";case"bad-id":return"The id may only use lowercase letters, digits, and hyphens.";case"id-taken":return"That id is already taken.";case"extract-failed":return"The page could not be measured.";case"no-colors":return"Give between 2 and 6 colors.";case"busy":return"Another system is being made — wait for it to finish.";default:if(e instanceof g.Iu&&401===e.status)return"Only the owner can make a system — sign in first.";return"Could not make the system: ".concat(e instanceof Error?e.message:String(e))}}(o.error):null,onCreate:e=>{o.mutate(e,{onSuccess:e=>w(e.id)})},onSelect:e=>{w(e),l.mutate(e)}}),j.unavailable&&(0,n.jsxs)("p",{className:"rounded-md bg-error/10 p-2 text-sm text-error",children:["Declared direction ",(0,n.jsx)("code",{children:j.unavailable})," is not registered."]}),null===j.declared&&!j.unavailable&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"None declared — pick one below."}),l.isError&&(0,n.jsx)("p",{className:"rounded-md bg-error/10 p-2 text-sm text-error",children:function(e){switch(e instanceof g.Iu&&e.body&&"object"==typeof e.body?e.body.reason:void 0){case"unknown-direction":return"The daemon does not know this direction.";case"no-repository":return"The daemon has no repository to write to (set harness.defaultRepo).";case"conflicting-system-file":return"design/system/ already holds a file the daemon will not overwrite.";case"cannot-read":return"The DESIGN.md could not be read.";case"cannot-write":return"The DESIGN.md could not be written.";default:if(e instanceof g.Iu&&401===e.status)return"Only the owner can pick a direction — sign in first.";return"Could not set the direction: ".concat(e instanceof Error?e.message:String(e))}}(l.error)}),b&&(0,n.jsx)(A,{system:b,onClose:()=>y(null),onSelect:()=>l.mutate(b),selecting:N===b,busy:null!==N,alreadySelected:j.declared===b}),(0,n.jsx)(f,{available:j.available,declared:j.declared,pendingId:N,previews:new Set((null!=(i=null==(t=x.data)?void 0:t.previews)?i:[]).map(e=>e.system)),onPreview:e=>y(e),onPick:e=>l.mutate(e)})]})}function A(e){let{system:t,onClose:s,onSelect:r,selecting:i,busy:a,alreadySelected:l}=e,o=function(e){let t=(0,d.M1)();return(0,u.I)({queryKey:p.AF.designPreview(null!=e?e:""),queryFn:()=>t.getDesignPreview(e),enabled:null!==e&&""!==e})}(t);return(0,n.jsxs)("div",{className:"space-y-2 rounded-md border p-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsxs)("p",{className:"text-sm font-medium",children:["Preview \xb7 ",(0,n.jsx)("code",{children:t})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[l?(0,n.jsx)("span",{className:"text-xs text-primary",children:"Selected"}):(0,n.jsx)("button",{type:"button",disabled:a,onClick:r,className:"rounded-md border px-2.5 py-1 text-xs hover:bg-muted disabled:opacity-50","aria-label":"Select ".concat(t),children:i?"Selecting…":"Select"}),(0,n.jsx)("button",{type:"button",onClick:s,className:"rounded-md border px-2.5 py-1 text-xs hover:bg-muted","aria-label":"Close preview",children:"Close"})]})]}),o.isLoading&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading preview…"}),o.isError&&(0,n.jsxs)("p",{className:"text-sm text-error",children:["Could not load the preview: ",o.error instanceof Error?o.error.message:String(o.error)]}),o.data&&(0,n.jsx)("iframe",{sandbox:"",srcDoc:o.data.html,title:"Preview \xb7 ".concat(t),className:"h-80 w-full rounded-md border bg-white"})]})}function E(){return(0,n.jsx)(C,{})}},65354:(e,t,s)=>{"use strict";s.d(t,{AF:()=>n});let n={all:["nexus"],health:()=>[...n.all,"health"],snapshot:()=>[...n.all,"snapshot"],tabs:e=>e?[...n.all,"tabs",{kind:e}]:[...n.all,"tabs"],tab:e=>[...n.all,"tab",e],templates:()=>[...n.all,"templates"],template:e=>[...n.all,"template",e],config:()=>[...n.all,"config"],switches:()=>[...n.all,"switches"],switch:e=>[...n.all,"switch",e],secrets:()=>[...n.all,"secrets"],bindingChannels:()=>[...n.all,"bindings","channels"],bindings:e=>[...n.all,"bindings",e],binding:(e,t)=>[...n.all,"binding",e,t],logsTail:(e,t)=>t?[...n.all,"logs",e,{lines:t}]:[...n.all,"logs",e],workflows:()=>[...n.all,"workflows"],workflow:e=>[...n.all,"workflow",e],workflowRun:e=>[...n.all,"workflow-run",e],workflowRuns:()=>[...n.all,"workflow-runs"],pendingApprovals:()=>[...n.all,"workflow-pending-approvals"],platforms:()=>[...n.all,"platforms"],providers:()=>[...n.all,"providers"],worktrees:()=>[...n.all,"worktrees"],designCheck:()=>[...n.all,"design-check"],designPreviews:()=>[...n.all,"design-previews"],designPreview:e=>[...n.all,"design-preview",e],registryCatalog:()=>[...n.all,"registry-catalog"],resolvedView:()=>[...n.all,"resolved-view"]};n.snapshot(),n.tabs(),n.health(),n.snapshot(),n.config(),n.switches()},67264:(e,t,s)=>{"use strict";s.d(t,{n:()=>d});var n=s(46124),r=s(17600),i=s(92477),a=s(33814),l=s(40404),o=class extends a.Q{#e;#t=void 0;#s;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,l.f8)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,l.EN)(t.mutationKey)!==(0,l.EN)(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(e){this.#r(),this.#i(e)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#r(),this.#i()}mutate(e,t){return this.#n=t,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(e)}#r(){let e=this.#s?.state??(0,r.$)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#i(e){i.jG.batch(()=>{if(this.#n&&this.hasListeners()){let t=this.#t.variables,s=this.#t.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#n.onSuccess?.(e.data,t,s,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(e.data,null,t,s,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#n.onError?.(e.error,t,s,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(void 0,e.error,t,s,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},c=s(50363);function d(e,t){let s=(0,c.jE)(t),[r]=n.useState(()=>new o(s,e));n.useEffect(()=>{r.setOptions(e)},[r,e]);let a=n.useSyncExternalStore(n.useCallback(e=>r.subscribe(i.jG.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),d=n.useCallback((e,t)=>{r.mutate(e,t).catch(l.lQ)},[r]);if(a.error&&(0,l.GU)(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:d,mutateAsync:a.mutate}}},70628:(e,t,s)=>{Promise.resolve().then(s.bind(s,47106))},72215:(e,t,s)=>{"use strict";let n;s.d(t,{cY:()=>d,x8:()=>l});let r={debug:0,info:1,warn:2,error:3},i="/v1/debug-logs/batch",a=null;function l(e){a=e}class o{health(){return{pending:this.queue.length,consecutiveFailures:this.consecutiveFailures,lastOkAt:this.lastOkAt,droppedByCap:this.droppedByCap,fallbackBatches:this.fallbackBatches}}push(e){if(!(r[function(e){let t=e.slice(e.lastIndexOf(".")+1).toLowerCase();return/^(error|exception|crash|fail|failed)$/.test(t)?"error":/^(warn|degraded|timeout)$/.test(t)?"warn":/^(boot|ready|start|begin|open|ok|done|resolve|end|stop|close)$/.test(t)?"info":"debug"}(e.category)]<r[this.minLevel])){if(this.queue.push(e),this.queue.length>500){let e=this.queue.length-500;this.droppedByCap+=e,this.queue.splice(0,e)}if(this.queue.length>=100&&!this.inFlight){null!==this.timer&&(clearTimeout(this.timer),this.timer=null),this.flush();return}null===this.timer&&(this.timer=setTimeout(()=>{this.flush()},this.flushMs))}}async flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.inFlight||0===this.queue.length)return;let e=this.queue.slice(0,100);this.inFlight=!0;let t=!1,s=JSON.stringify({records:e});try{var n,r;t=await (n=this.fetchFn(s),r=this.postTimeoutMs,new Promise((e,t)=>{let s=setTimeout(()=>t(Error("debug-forward timeout after ".concat(r,"ms"))),r);n.then(t=>{clearTimeout(s),e(t)},e=>{clearTimeout(s),t(e)})}))}catch(e){t=!1}finally{this.inFlight=!1}if(!t){if(this.consecutiveFailures+=1,this.consecutiveFailures>=2&&a)try{await a(JSON.stringify({records:[...e,this.blockedNotice()]}))&&(this.fallbackBatches+=1)}catch(e){}this.wasFailing=!0,this.scheduleRetry();return}let i=this.lastOkAt;this.lastOkAt=Date.now();let l=this.consecutiveFailures;this.consecutiveFailures=0,this.queue.splice(0,e.length),this.wasFailing&&(this.wasFailing=!1,this.queue.push({ts:new Date().toISOString(),category:"pwa.debug-forwarder.recovered",event:"recovered",data:{consecutiveFailures:l,droppedByCap:this.droppedByCap,fallbackBatches:this.fallbackBatches,pending:this.queue.length,previousOkAt:i},source:{platform:"pwa"}})),this.queue.length>0&&null===this.timer&&(this.timer=setTimeout(()=>{this.flush()},this.flushMs))}scheduleRetry(){if(null!==this.timer||0===this.queue.length)return;let e=Math.min(this.flushMs*2**this.consecutiveFailures,3e4);this.timer=setTimeout(()=>{this.flush()},e)}blockedNotice(){return{ts:new Date().toISOString(),category:"pwa.debug-forwarder.http-blocked",event:"http-blocked",data:{consecutiveFailures:this.consecutiveFailures,pending:this.queue.length,droppedByCap:this.droppedByCap,lastOkAt:this.lastOkAt,via:"acp-fallback"},source:{platform:"pwa"}}}beaconFlush(){if(0!==this.queue.length)try{if("undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon){let e=this.queue.slice(0,100),t=new Blob([JSON.stringify({records:e})],{type:"application/json"});navigator.sendBeacon(i,t)&&this.queue.splice(0,e.length)}}catch(e){}}get pending(){return this.queue.length}constructor(e=c,t="debug",s=1e4,n=100){this.fetchFn=e,this.minLevel=t,this.postTimeoutMs=s,this.flushMs=n,this.queue=[],this.timer=null,this.inFlight=!1,this.consecutiveFailures=0,this.lastOkAt=null,this.droppedByCap=0,this.fallbackBatches=0,this.wasFailing=!1}}async function c(e){return(await fetch(i,{method:"POST",headers:{"content-type":"application/json"},body:e,keepalive:!0,..."undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.timeout?{signal:AbortSignal.timeout(1e4)}:{}})).ok}function d(e,t){if("undefined"==typeof console)return;let s=new Date().toISOString();if(void 0!==t){let n="";try{let e=new WeakSet;n=JSON.stringify(t,(t,s)=>{if("bigint"==typeof s)return"".concat(s.toString(),"n");if("function"==typeof s)return"[fn ".concat(s.name||"anon","]");if(s&&"object"==typeof s){if(e.has(s))return"[circular]";e.add(s)}return s})}catch(e){n="[unserializable: ".concat(String(e),"]")}n&&n.length>800&&(n=n.slice(0,797)+"..."),console.debug("[".concat(s,"] ").concat(e," ").concat(n),t),u(s,e,n)}else console.debug("[".concat(s,"] ").concat(e)),u(s,e,void 0)}function u(e,t,s){let r,i=function(){if(void 0!==n)return n;let e=function(){try{let e="off"!==window.localStorage.getItem("elanous.pwa.debug.forward"),t=window.localStorage.getItem("elanous.pwa.debug.forwardLevel");return{forward:e,level:"info"===t||"warn"===t||"error"===t?t:"debug"}}catch(e){return{forward:!0,level:"debug"}}}();if(!e.forward)return n=null,null;let t=new o(c,e.level,1e4,1500);try{window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&t.beaconFlush()})}catch(e){}return n=t,t}();if(!i)return;let a=t.slice(t.lastIndexOf(".")+1)||t;if(void 0!==s&&""!==s)try{r=JSON.parse(s)}catch(e){r=s}i.push({ts:e,category:t,event:a,...void 0!==r?{data:r}:{},source:{platform:"pwa"}})}},74227:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3704).A)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},81694:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3704).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},94306:(e,t,s)=>{"use strict";s.d(t,{M1:()=>c,Qj:()=>d,tI:()=>o});var n=s(55539),r=s(46124),i=s(76642),a=s(50363);let l=(0,r.createContext)(null);function o(e){let{client:t,queryClient:s,defaultStaleTimeMs:o,children:c}=e,d=(0,r.useMemo)(()=>null!=s?s:new i.E({defaultOptions:{queries:{staleTime:null!=o?o:2e3,refetchOnWindowFocus:!1}}}),[s,o]);return(0,n.jsx)(l.Provider,{value:t,children:(0,n.jsx)(a.Ht,{client:d,children:c})})}function c(){let e=(0,r.useContext)(l);if(!e)throw Error("useNexusClient must be used within <NexusProvider>");return e}function d(){return(0,r.useContext)(l)}}},e=>{e.O(0,[3324,1844,9247,2463,2196,7358],()=>e(e.s=70628)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6766],{3219:(e,s,r)=>{"use strict";r.r(s),r.d(s,{default:()=>m});var a=r(55539),l=r(46124),t=r(21501),n=r(58603),c=r(94306),i=r(75764),d=r(43431),x=r(55519);function o(e){let{palette:s,fallback:r}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("strong",{children:"노드 팔레트"}),s.map(e=>{var s;return(0,a.jsxs)("span",{title:e.description,className:"rounded border border-border px-2 py-0.5",children:[e.kind," ",e.plugin&&(0,a.jsx)("small",{className:"rounded bg-accent/15 px-1 text-accent",children:e.plugin})]},"".concat(null!=(s=e.plugin)?s:"core",":").concat(e.kind))})]}),r&&(0,a.jsx)("p",{role:"status",className:"mt-1 text-warning",children:"어휘 목록을 불러오지 못해 코어 팔레트를 표시합니다."})]})}function p(e){let{palette:s,fallback:r}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("details",{className:"border-b border-border px-3 py-2 text-xs min-[640px]:hidden","aria-label":"노드 팔레트",children:[(0,a.jsxs)("summary",{className:"cursor-pointer",children:["노드 더하기 (",s.length,")"]}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(o,{palette:s,fallback:r})})]}),(0,a.jsx)("div",{className:"hidden border-b border-border px-3 py-2 text-xs min-[640px]:block","aria-label":"노드 팔레트",children:(0,a.jsx)(o,{palette:s,fallback:r})})]})}function h(){let e="harness"===(0,n.useSearchParams)().get("mode")?"harness":"workflow",s=(0,c.Qj)(),r=(0,t.I)({queryKey:["graph-kinds",e],queryFn:()=>s.getGraphKinds(e),enabled:null!==s,retry:!1}),o=(0,l.useMemo)(()=>{var s;return(null==(s=r.data)?void 0:s.kinds.length)?r.data.kinds:("harness"===e?x.DN:x.CF).map(s=>({graph:e,kind:s,plugin:null,description:"",schema:{},core:!0}))},[r.data,e]),h=r.isError||r.isSuccess&&!r.data.kinds.length;return(0,a.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,a.jsxs)("header",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-2",children:[(0,a.jsx)("h1",{className:"text-sm font-semibold",children:"편집기"}),(0,a.jsx)("nav",{"aria-label":"그래프 편집 모드",className:"flex gap-1",children:["workflow","harness"].map(s=>(0,a.jsx)("a",{href:"/app/editor/?mode=".concat(s),"aria-current":e===s?"page":void 0,className:"rounded px-3 py-1 text-xs ".concat(e===s?"bg-accent/15 text-text-primary":"text-text-tertiary hover:bg-surface-elevated"),children:"workflow"===s?"워크플로":"실행 그래프"},s))})]}),(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[s&&(0,a.jsx)(p,{palette:o,fallback:h}),"workflow"===e?(0,a.jsx)(i.N,{palette:o}):s?(0,a.jsx)(d.F,{palette:o}):(0,a.jsx)("p",{className:"p-4 text-sm text-text-tertiary",children:"Daemon 연결이 설정되지 않았습니다. Settings 에서 Base URL 을 입력하세요."})]})]})}function m(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)("p",{className:"p-4 text-sm",children:"편집기를 불러오는 중…"}),children:(0,a.jsx)(h,{})})}},17621:(e,s,r)=>{Promise.resolve().then(r.bind(r,3219))}},e=>{e.O(0,[9901,9182,3324,1844,1866,8868,8060,9247,8949,4554,2463,2196,7358],()=>e(e.s=17621)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6766],{3219:(e,s,r)=>{"use strict";r.r(s),r.d(s,{default:()=>m});var a=r(55539),l=r(46124),t=r(21501),n=r(58603),c=r(94306),i=r(75764),d=r(43431),x=r(55519);function o(e){let{palette:s,fallback:r}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("strong",{children:"노드 팔레트"}),s.map(e=>{var s;return(0,a.jsxs)("span",{title:e.description,className:"rounded border border-border px-2 py-0.5",children:[e.kind," ",e.plugin&&(0,a.jsx)("small",{className:"rounded bg-accent/15 px-1 text-accent",children:e.plugin})]},"".concat(null!=(s=e.plugin)?s:"core",":").concat(e.kind))})]}),r&&(0,a.jsx)("p",{role:"status",className:"mt-1 text-warning",children:"어휘 목록을 불러오지 못해 코어 팔레트를 표시합니다."})]})}function p(e){let{palette:s,fallback:r}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("details",{className:"border-b border-border px-3 py-2 text-xs min-[640px]:hidden","aria-label":"노드 팔레트",children:[(0,a.jsxs)("summary",{className:"cursor-pointer",children:["노드 더하기 (",s.length,")"]}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(o,{palette:s,fallback:r})})]}),(0,a.jsx)("div",{className:"hidden border-b border-border px-3 py-2 text-xs min-[640px]:block","aria-label":"노드 팔레트",children:(0,a.jsx)(o,{palette:s,fallback:r})})]})}function h(){let e="harness"===(0,n.useSearchParams)().get("mode")?"harness":"workflow",s=(0,c.Qj)(),r=(0,t.I)({queryKey:["graph-kinds",e],queryFn:()=>s.getGraphKinds(e),enabled:null!==s,retry:!1}),o=(0,l.useMemo)(()=>{var s;return(null==(s=r.data)?void 0:s.kinds.length)?r.data.kinds:("harness"===e?x.DN:x.CF).map(s=>({graph:e,kind:s,plugin:null,description:"",schema:{},core:!0}))},[r.data,e]),h=r.isError||r.isSuccess&&!r.data.kinds.length;return(0,a.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,a.jsxs)("header",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-2",children:[(0,a.jsx)("h1",{className:"text-sm font-semibold",children:"편집기"}),(0,a.jsx)("nav",{"aria-label":"그래프 편집 모드",className:"flex gap-1",children:["workflow","harness"].map(s=>(0,a.jsx)("a",{href:"/app/editor/?mode=".concat(s),"aria-current":e===s?"page":void 0,className:"rounded px-3 py-1 text-xs ".concat(e===s?"bg-accent/15 text-text-primary":"text-text-tertiary hover:bg-surface-elevated"),children:"workflow"===s?"워크플로":"실행 그래프"},s))})]}),(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[s&&(0,a.jsx)(p,{palette:o,fallback:h}),"workflow"===e?(0,a.jsx)(i.N,{palette:o}):s?(0,a.jsx)(d.F,{palette:o}):(0,a.jsx)("p",{className:"p-4 text-sm text-text-tertiary",children:"Daemon 연결이 설정되지 않았습니다. Settings 에서 Base URL 을 입력하세요."})]})]})}function m(){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)("p",{className:"p-4 text-sm",children:"편집기를 불러오는 중…"}),children:(0,a.jsx)(h,{})})}},24922:(e,s,r)=>{Promise.resolve().then(r.bind(r,3219))}},e=>{e.O(0,[9901,9182,3324,1844,1866,8868,8060,9247,8949,4554,2463,2196,7358],()=>e(e.s=24922)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[650],{4977:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>m});var n=r(55539),s=r(46124),a=r(15151),l=r(12958);let o={report:"보고서",pdf:"PDF",video:"영상",image:"그림",text:"글",link:"링크"};function c(e,t){if(e.startsWith("/v1/exec-requests/".concat(encodeURIComponent(t),"/files/")))return{url:e,daemonFile:!0};try{let t=new URL(e);if(("https:"===t.protocol||"http:"===t.protocol)&&!t.username&&!t.password)return{url:t.href,daemonFile:!1}}catch(e){}return null}function i(e){let{client:t,id:r,result:a}=e,[l,i]=(0,s.useState)(""),[u,d]=(0,s.useState)(!1),[m,p]=(0,s.useState)(null),f=c(a.url,r),x=a.title||o[a.kind],h=(null==f?void 0:f.daemonFile)&&("video"===a.kind||"image"===a.kind);if((0,s.useEffect)(()=>{let e;if(!h||!f)return;let r=!0;return p(null),i(""),t.fetchResponse(f.url).then(async t=>{if(!t.ok)throw Error("HTTP ".concat(t.status));let n=await t.blob();r&&p(e=URL.createObjectURL(n))}).catch(()=>{r&&i("결과 파일을 열지 못했습니다. 다시 시도해 주세요.")}),()=>{r=!1,e&&URL.revokeObjectURL(e)}},[t,h,null==f?void 0:f.url]),!f)return null;async function b(){if(!(null==f?void 0:f.daemonFile)||u)return;let e="pdf"===a.kind?window.open("","_blank"):null;if("pdf"===a.kind&&!e)return void i("결과 파일을 열지 못했습니다. 다시 시도해 주세요.");e&&(e.opener=null),d(!0),i("");try{let n=await t.fetchResponse(f.url);if(!n.ok)throw Error("HTTP ".concat(n.status));let s=URL.createObjectURL(await n.blob());if(e)e.closed?URL.revokeObjectURL(s):(e.location.replace(s),setTimeout(()=>URL.revokeObjectURL(s),6e4));else{var r;let e=document.createElement("a");e.href=s,e.download=decodeURIComponent(null!=(r=f.url.split("/").at(-1))?r:x),document.body.appendChild(e),e.click(),e.remove(),setTimeout(()=>URL.revokeObjectURL(s),6e4)}}catch(t){null==e||e.close(),i("결과 파일을 열지 못했습니다. 다시 시도해 주세요.")}finally{d(!1)}}return(0,n.jsxs)("li",{className:"rounded-lg border border-border bg-background px-4 py-3 text-sm",children:[h?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"font-medium",children:x}),m&&("video"===a.kind?(0,n.jsx)("video",{controls:!0,src:m,"aria-label":x,className:"mt-2 max-w-full"}):(0,n.jsx)("img",{src:m,alt:x,className:"mt-2 max-w-full"}))]}):f.daemonFile?(0,n.jsx)("button",{type:"button",onClick:()=>void b(),disabled:u,className:"font-medium text-primary underline underline-offset-4 disabled:opacity-50",children:u?"여는 중…":x}):(0,n.jsx)("a",{href:f.url,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-primary underline underline-offset-4",children:x}),(0,n.jsxs)("span",{className:"ml-2 text-muted-foreground",children:[a.seat.toUpperCase()," \xb7 ",o[a.kind]]}),a.sources&&a.sources.length>0&&(0,n.jsx)("ul",{className:"mt-2 flex flex-wrap gap-2","aria-label":"출처",children:a.sources.slice(0,3).map((e,t)=>{let s=c(e.url,r);return s&&!s.daemonFile?(0,n.jsx)("li",{children:(0,n.jsx)("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-4",children:e.title})},"".concat(e.url,":").concat(t)):null})}),l&&(0,n.jsx)("p",{role:"alert",className:"mt-1 text-destructive",children:l})]})}function u(e){switch(e){case"planning":return"계획 중";case"running":return"진행 중";case"done":return"완료";case"failed":return"멈춤"}}function d(e){switch(e){case"waiting":return"대기";case"running":return"진행 중";case"done":return"완료";case"failed":return"못 함"}}function m(){var e,t,r,o;let{client:c}=(0,a.Q)(),[m,p]=(0,s.useState)(""),[f,x]=(0,s.useState)(!1),[h,b]=(0,s.useState)([]),[g,y]=(0,s.useState)(!1),[v,j]=(0,s.useState)(""),[N,w]=(0,s.useState)(""),[k,R]=(0,s.useState)(null),[S,U]=(0,s.useState)(null),[C,I]=(0,s.useState)(""),[E,L]=(0,s.useState)(0),[O,P]=(0,s.useState)(null),D=(0,s.useRef)(new Map),F=(0,s.useRef)(0),T=(0,s.useRef)(k);T.current=k;let _=(0,s.useRef)(null),H=(0,s.useRef)(0),M=h.some(e=>"planning"===e.status||"running"===e.status),q=null==(e=h.find(e=>e.id===k))?void 0:e.status,Y=(null==S?void 0:S.id)===k&&(null===O?S.approvals.length>0:O>0);(0,s.useEffect)(()=>{var e,t;return F.current+=1,H.current+=1,_.current=null,D.current=new Map,p(""),x(!1),b([]),y(!1),j(""),w(""),R(new URLSearchParams(null!=(t=null==(e=window.location)?void 0:e.search)?t:"").get("request")),U(null),I(""),P(null),()=>{F.current+=1}},[c]),(0,s.useEffect)(()=>{let e=!0,t=!1;async function r(){if(!t){t=!0;try{let t=await c.listExecRequests();if(!e)return;for(let e of t.items)D.current.delete(e.id);b([...D.current.values(),...t.items].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)||t.id.localeCompare(e.id))),j("")}catch(t){e&&j("맡긴 일을 읽지 못했습니다. 연결을 확인해 주세요.")}finally{t=!1,e&&y(!0)}}}r();let n=M?setInterval(()=>void r(),5e3):null;return()=>{e=!1,n&&clearInterval(n)}},[c,M]);let A=(0,s.useCallback)(async()=>{if(!k)return;let e=F.current,t=H.current,r="".concat(e,":").concat(t,":").concat(k);if(_.current!==r){_.current=r;try{let r=await c.getExecRequest(k);if(F.current!==e||H.current!==t||T.current!==k)return;U(r),I("")}catch(r){F.current===e&&H.current===t&&T.current===k&&I("상세를 읽지 못했습니다. 잠시 뒤 다시 시도해 주세요.")}finally{_.current===r&&(_.current=null)}}},[c,k]);async function V(e){e.preventDefault();let t=m.trim();if(!t||f)return;let r=F.current;x(!0),w("");try{let e=await c.submitExecRequest(t);if(F.current!==r)return;let n={id:e.id,text:t,createdAt:new Date().toISOString(),status:e.status,seats:[],resultCount:0};D.current.set(n.id,n),b(e=>[n,...e.filter(e=>e.id!==n.id)]),p("")}catch(e){F.current===r&&w("보내지 못했습니다. 연결을 확인하고 다시 시도해 주세요.")}finally{F.current===r&&x(!1)}}(0,s.useEffect)(()=>{k&&A()},[A,E]),(0,s.useEffect)(()=>{if(!k||"planning"!==q&&"running"!==q&&!Y)return;let e=setInterval(()=>void A(),5e3);return()=>clearInterval(e)},[k,q,Y,A]);let z=h.find(e=>e.id===k),J=(null==S?void 0:S.id)===k?S:null;return(0,n.jsxs)("main",{className:"mx-auto w-full max-w-2xl space-y-8 px-5 py-10 sm:py-14",children:[(0,n.jsxs)("section",{"aria-labelledby":"exec-compose",className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{id:"exec-compose",className:"text-2xl font-semibold tracking-tight",children:"COO 에게 맡기기"}),(0,n.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"할 일을 한 줄로 적어 보내세요. 자리별 진행과 결과를 여기서 볼 수 있습니다."})]}),(0,n.jsxs)("form",{onSubmit:V,className:"flex gap-2",children:[(0,n.jsx)("label",{htmlFor:"exec-text",className:"sr-only",children:"한 줄로 맡길 일"}),(0,n.jsx)("input",{id:"exec-text",name:"text",value:m,onChange:e=>p(e.target.value),placeholder:"한 줄로 맡길 일",className:"min-w-0 flex-1 rounded-lg border border-input bg-background px-3 py-2 text-sm"}),(0,n.jsx)("button",{type:"submit",disabled:!m.trim()||f,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:f?"보내는 중…":"보내기"})]}),N&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:N})]}),(0,n.jsxs)("section",{"aria-labelledby":"exec-list",className:"space-y-3",children:[(0,n.jsx)("h2",{id:"exec-list",className:"text-xl font-semibold",children:"맡긴 일"}),v&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:v}),!g&&0===h.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"불러오는 중…"}),g&&0===h.length&&!v&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"아직 맡긴 일이 없습니다."}),(0,n.jsx)("ul",{className:"space-y-2",children:h.map(e=>{var t;return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>{k!==e.id&&(H.current+=1,R(e.id),U(null),I(""),P(null))},"aria-expanded":k===e.id,className:"w-full rounded-xl border border-border bg-card p-4 text-left hover:border-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[(0,n.jsxs)("span",{className:"flex items-start justify-between gap-3",children:[(0,n.jsx)("span",{className:"min-w-0 truncate text-sm font-semibold",children:null!=(t=e.text.trim().split(/\r?\n/,1)[0])?t:""}),(0,n.jsx)("span",{className:"shrink-0 text-sm font-medium text-primary",children:u(e.status)})]}),e.seats.length>0&&(0,n.jsx)("span",{className:"mt-2 block truncate text-xs text-muted-foreground",children:e.seats.map(e=>"".concat(e.seat.toUpperCase()," ").concat(d(e.status))).join(" \xb7 ")}),e.resultCount>0&&(0,n.jsxs)("span",{className:"mt-1 block text-xs text-muted-foreground",children:["결과 ",e.resultCount,"개"]})]})},e.id)})})]}),k&&(0,n.jsxs)("section",{"aria-labelledby":"exec-detail",className:"space-y-5 rounded-xl border border-border bg-card p-5",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsx)("h2",{id:"exec-detail",className:"text-lg font-semibold",children:"맡긴 일 상세"}),(0,n.jsx)("button",{type:"button",onClick:()=>{H.current+=1,R(null),U(null),P(null)},className:"text-sm text-primary underline underline-offset-4",children:"닫기"})]}),(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:null!=(t=null==J?void 0:J.text)?t:null==z?void 0:z.text}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:u(null!=(o=null!=(r=null==J?void 0:J.status)?r:null==z?void 0:z.status)?o:"planning")}),C&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:C}),!J&&!C&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"상세 불러오는 중…"}),J&&(0,n.jsxs)(n.Fragment,{children:[J.summary&&(0,n.jsx)("p",{className:"text-sm",children:J.summary}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h3",{className:"font-semibold",children:"이렇게 나눠 맡겼습니다"}),0===J.seats.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"planning"===J.status?"COO 가 나누는 중입니다":"맡은 자리가 없습니다"}),(0,n.jsx)("ul",{className:"space-y-2",children:J.seats.map(e=>(0,n.jsxs)("li",{className:"rounded-lg border border-border bg-background px-4 py-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsxs)("span",{className:"font-semibold",children:[e.seat.toUpperCase()," \xb7 ",e.title]}),(0,n.jsx)("span",{className:"shrink-0 text-muted-foreground",children:d(e.status)})]}),"failed"===e.status&&e.reason&&(0,n.jsxs)("p",{className:"mt-2 text-destructive",children:["못 한 이유 \xb7 ",e.reason]})]},"".concat(e.seat,":").concat(e.title)))})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h3",{className:"font-semibold",children:"결과"}),0===J.results.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"아직 결과가 없습니다."}),(0,n.jsx)("ul",{className:"space-y-2",children:J.results.map(e=>(0,n.jsx)(i,{client:c,id:J.id,result:e},e.url))})]}),(0,n.jsx)(l.a,{client:c,approvals:J.approvals,onDecided:()=>L(e=>e+1),onPendingChange:P},J.id)]})]})]})}},5997:(e,t,r)=>{"use strict";r.d(t,{Zr:()=>l,f6:()=>s,oD:()=>a});let n="elanous.daemon.sessionId";function s(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function a(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(n,e),e):localStorage.getItem(n)}();if(e)return e;let t=s();return localStorage.setItem(n,t),t}function l(){let e=s();return localStorage.setItem(n,e),e}},12958:(e,t,r)=>{"use strict";r.d(t,{a:()=>o});var n=r(55539),s=r(46124),a=r(74780);let l=e=>JSON.stringify([e.graphId,e.runId]);function o(e){let{client:t,approvals:r,onDecided:o,onPendingChange:c}=e,i=(0,s.useMemo)(()=>(0,a.ll)({client:t}),[t]),[u,d]=(0,s.useState)([]),[m,p]=(0,s.useState)({}),[f,x]=(0,s.useState)(null),[h,b]=(0,s.useState)(""),g=(0,s.useRef)(0),y=r.map(l).join("|");function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m;d(e),c(r.filter(r=>!t[l(r)]&&e.some(e=>l(e)===l(r))).length)}async function j(e,t){let n=l(e);if(f||m[n]||!r.some(e=>l(e)===n)||!u.some(e=>l(e)===n))return;let s=g.current;x(n),b("");try{if(await i.decide(e.graphId,e.runId,t),g.current!==s)return;let r={...m,[n]:t};p(r),v(u,r),o();let a=await i.list();g.current===s&&v(a.items,r)}catch(e){g.current===s&&b((0,a.LP)(e,"decide"))}finally{g.current===s&&x(null)}}return((0,s.useEffect)(()=>{let e=++g.current;return(d([]),b(""),y)?(i.list().then(t=>{g.current===e&&v(t.items)}).catch(t=>{g.current===e&&b((0,a.LP)(t,"list"))}),()=>{g.current+=1}):(c(0),()=>{g.current+=1})},[i,y]),0===r.length)?null:(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h3",{className:"font-semibold",children:"게시 승인"}),h&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:h}),(0,n.jsx)("ul",{className:"space-y-2",children:r.map(e=>{let t=l(e),r=u.some(e=>l(e)===t);return(0,n.jsxs)("li",{className:"rounded-lg border border-border bg-background px-4 py-3 text-sm",children:[(0,n.jsx)("p",{children:e.message}),m[t]?(0,n.jsx)("p",{className:"mt-2 text-muted-foreground",children:"approved"===m[t]?"승인됨":"보류됨"}):r?(0,n.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:null!==f,onClick:()=>void j(e,"approved"),className:"rounded-lg bg-primary px-3 py-1 text-primary-foreground disabled:opacity-50",children:"승인"}),(0,n.jsx)("button",{type:"button",disabled:null!==f,onClick:()=>void j(e,"rejected"),className:"rounded-lg border border-border px-3 py-1 disabled:opacity-50",children:"보류"})]}):(0,n.jsx)("p",{className:"mt-2 text-muted-foreground",children:"대기 중인 승인이 아닙니다."})]},t)})})]})}},15151:(e,t,r)=>{"use strict";r.d(t,{C:()=>i,DaemonProvider:()=>u,Q:()=>d});var n=r(55539),s=r(46124),a=r(8101),l=r(5997),o=r(18060),c=r(72215);let i=(0,s.createContext)(null);function u(e){let{children:t}=e,r={baseUrl:"",token:"",provider:""},[u,d]=(0,s.useState)(r),[m,p]=(0,s.useState)(""),[f]=(0,s.useState)(()=>new o.ki(r));(0,s.useEffect)(()=>{let e=(0,a.Fp)();d(e),f.updateConfig(e),p((0,l.oD)()),(0,c.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[f]),(0,s.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,a.Fp)();f.updateConfig(t),d(t),(0,c.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&p(t=>t===e.newValue?t:((0,c.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[f]);let x=e=>{d(t=>{let r={...t,...e};return(0,a.Qc)(e),f.updateConfig(r),(0,c.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),r})},h=e=>{p(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,c.cY)("webterm.provider.daemon.session-set",{sessionId:e})},b=(0,s.useMemo)(()=>({config:u,setConfig:x,client:f,sessionId:m,setSessionId:h}),[u,f,m]);return(0,n.jsx)(i.Provider,{value:b,children:t})}function d(){let e=(0,s.useContext)(i);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}},74780:(e,t,r)=>{"use strict";function n(e){return{slides:e.slides.map(e=>{let{image:t,caption:r,include:n}=e;return{image:t,caption:r,include:n}}),caption:{hook:e.caption.hook,body:e.caption.body},hashtags:[...e.hashtags],cover:{text:e.cover.text,sub:e.cover.sub},location:e.location}}r.d(t,{$Y:()=>l,LP:()=>c,Mz:()=>n,ll:()=>u,rH:()=>o});class s extends Error{constructor(e,t){super(t),this.status=e,this.name="GraphApprovalsApiError"}}let a={list:"목록을 보려면",decide:"승인하려면",save:"초안을 저장하려면"},l="/app/settings/#bearer-token";function o(e){return e instanceof s&&(401===e.status||403===e.status)}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"decide";return e instanceof s?401===e.status||403===e.status?"".concat(a[t]," 이 기기를 데몬에 연결해야 합니다 — 설정 › 데몬 연결 › 연결 토큰 칸에 토큰을 넣어 주세요."):404===e.status?"이 실행을 찾지 못했습니다. 목록을 다시 확인해 주세요.":409===e.status?"이미 결정된 실행입니다. 목록을 다시 확인해 주세요.":400===e.status?"결정 내용을 확인한 뒤 다시 시도해 주세요.":"승인 요청을 처리하지 못했습니다. 잠시 뒤 다시 시도해 주세요.":e instanceof TypeError?"서버에 연결하지 못했습니다. 연결 상태를 확인해 주세요.":"승인 요청을 처리하지 못했습니다. 잠시 뒤 다시 시도해 주세요."}let i="/v1/graph-approvals";function u(e){var t,r;let n=(null!=(t=e.baseUrl)?t:"").replace(/\/+$/,""),a=null!=(r=e.fetchImpl)?r:fetch;async function l(t,r){let l={...r,headers:{"content-type":"application/json",...e.authHeader?{authorization:e.authHeader}:{}}},o=e.client?await e.client.fetchResponse(t,l):await a("".concat(n).concat(t),l),c=await o.json().catch(()=>null);if(!o.ok){let e=c&&"object"==typeof c&&"error"in c&&"string"==typeof c.error?c.error:"request-failed";throw new s(o.status,e)}return c}return{list:()=>l(i),decide:(e,t,r)=>l("".concat(i,"/").concat(encodeURIComponent(e),"/").concat(encodeURIComponent(t)),{method:"POST",body:JSON.stringify({decision:r})}),saveFeedDraft:(e,t,r)=>l("".concat(i,"/").concat(encodeURIComponent(e),"/").concat(encodeURIComponent(t),"/feed-draft"),{method:"PUT",body:JSON.stringify(r)}),feedMedia:async(t,r,l)=>{let o="".concat(i,"/").concat(encodeURIComponent(t),"/").concat(encodeURIComponent(r),"/media?path=").concat(encodeURIComponent(l)),c={headers:e.authHeader?{authorization:e.authHeader}:{}},u=e.client?await e.client.fetchResponse(o,c):await a("".concat(n).concat(o),c);if(!u.ok)throw new s(u.status,"media-failed");return u.blob()}}}},80361:(e,t,r)=>{Promise.resolve().then(r.bind(r,4977))}},e=>{e.O(0,[8060,2463,2196,7358],()=>e(e.s=80361)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[650],{4977:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>m});var n=r(55539),s=r(46124),a=r(15151),l=r(12958);let o={report:"보고서",pdf:"PDF",video:"영상",image:"그림",text:"글",link:"링크"};function c(e,t){if(e.startsWith("/v1/exec-requests/".concat(encodeURIComponent(t),"/files/")))return{url:e,daemonFile:!0};try{let t=new URL(e);if(("https:"===t.protocol||"http:"===t.protocol)&&!t.username&&!t.password)return{url:t.href,daemonFile:!1}}catch(e){}return null}function i(e){let{client:t,id:r,result:a}=e,[l,i]=(0,s.useState)(""),[u,d]=(0,s.useState)(!1),[m,p]=(0,s.useState)(null),f=c(a.url,r),x=a.title||o[a.kind],h=(null==f?void 0:f.daemonFile)&&("video"===a.kind||"image"===a.kind);if((0,s.useEffect)(()=>{let e;if(!h||!f)return;let r=!0;return p(null),i(""),t.fetchResponse(f.url).then(async t=>{if(!t.ok)throw Error("HTTP ".concat(t.status));let n=await t.blob();r&&p(e=URL.createObjectURL(n))}).catch(()=>{r&&i("결과 파일을 열지 못했습니다. 다시 시도해 주세요.")}),()=>{r=!1,e&&URL.revokeObjectURL(e)}},[t,h,null==f?void 0:f.url]),!f)return null;async function b(){if(!(null==f?void 0:f.daemonFile)||u)return;let e="pdf"===a.kind?window.open("","_blank"):null;if("pdf"===a.kind&&!e)return void i("결과 파일을 열지 못했습니다. 다시 시도해 주세요.");e&&(e.opener=null),d(!0),i("");try{let n=await t.fetchResponse(f.url);if(!n.ok)throw Error("HTTP ".concat(n.status));let s=URL.createObjectURL(await n.blob());if(e)e.closed?URL.revokeObjectURL(s):(e.location.replace(s),setTimeout(()=>URL.revokeObjectURL(s),6e4));else{var r;let e=document.createElement("a");e.href=s,e.download=decodeURIComponent(null!=(r=f.url.split("/").at(-1))?r:x),document.body.appendChild(e),e.click(),e.remove(),setTimeout(()=>URL.revokeObjectURL(s),6e4)}}catch(t){null==e||e.close(),i("결과 파일을 열지 못했습니다. 다시 시도해 주세요.")}finally{d(!1)}}return(0,n.jsxs)("li",{className:"rounded-lg border border-border bg-background px-4 py-3 text-sm",children:[h?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"font-medium",children:x}),m&&("video"===a.kind?(0,n.jsx)("video",{controls:!0,src:m,"aria-label":x,className:"mt-2 max-w-full"}):(0,n.jsx)("img",{src:m,alt:x,className:"mt-2 max-w-full"}))]}):f.daemonFile?(0,n.jsx)("button",{type:"button",onClick:()=>void b(),disabled:u,className:"font-medium text-primary underline underline-offset-4 disabled:opacity-50",children:u?"여는 중…":x}):(0,n.jsx)("a",{href:f.url,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-primary underline underline-offset-4",children:x}),(0,n.jsxs)("span",{className:"ml-2 text-muted-foreground",children:[a.seat.toUpperCase()," \xb7 ",o[a.kind]]}),a.sources&&a.sources.length>0&&(0,n.jsx)("ul",{className:"mt-2 flex flex-wrap gap-2","aria-label":"출처",children:a.sources.slice(0,3).map((e,t)=>{let s=c(e.url,r);return s&&!s.daemonFile?(0,n.jsx)("li",{children:(0,n.jsx)("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline underline-offset-4",children:e.title})},"".concat(e.url,":").concat(t)):null})}),l&&(0,n.jsx)("p",{role:"alert",className:"mt-1 text-destructive",children:l})]})}function u(e){switch(e){case"planning":return"계획 중";case"running":return"진행 중";case"done":return"완료";case"failed":return"멈춤"}}function d(e){switch(e){case"waiting":return"대기";case"running":return"진행 중";case"done":return"완료";case"failed":return"못 함"}}function m(){var e,t,r,o;let{client:c}=(0,a.Q)(),[m,p]=(0,s.useState)(""),[f,x]=(0,s.useState)(!1),[h,b]=(0,s.useState)([]),[g,y]=(0,s.useState)(!1),[v,j]=(0,s.useState)(""),[N,w]=(0,s.useState)(""),[k,R]=(0,s.useState)(null),[S,U]=(0,s.useState)(null),[C,I]=(0,s.useState)(""),[E,L]=(0,s.useState)(0),[O,P]=(0,s.useState)(null),D=(0,s.useRef)(new Map),F=(0,s.useRef)(0),T=(0,s.useRef)(k);T.current=k;let _=(0,s.useRef)(null),H=(0,s.useRef)(0),M=h.some(e=>"planning"===e.status||"running"===e.status),q=null==(e=h.find(e=>e.id===k))?void 0:e.status,Y=(null==S?void 0:S.id)===k&&(null===O?S.approvals.length>0:O>0);(0,s.useEffect)(()=>{var e,t;return F.current+=1,H.current+=1,_.current=null,D.current=new Map,p(""),x(!1),b([]),y(!1),j(""),w(""),R(new URLSearchParams(null!=(t=null==(e=window.location)?void 0:e.search)?t:"").get("request")),U(null),I(""),P(null),()=>{F.current+=1}},[c]),(0,s.useEffect)(()=>{let e=!0,t=!1;async function r(){if(!t){t=!0;try{let t=await c.listExecRequests();if(!e)return;for(let e of t.items)D.current.delete(e.id);b([...D.current.values(),...t.items].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)||t.id.localeCompare(e.id))),j("")}catch(t){e&&j("맡긴 일을 읽지 못했습니다. 연결을 확인해 주세요.")}finally{t=!1,e&&y(!0)}}}r();let n=M?setInterval(()=>void r(),5e3):null;return()=>{e=!1,n&&clearInterval(n)}},[c,M]);let A=(0,s.useCallback)(async()=>{if(!k)return;let e=F.current,t=H.current,r="".concat(e,":").concat(t,":").concat(k);if(_.current!==r){_.current=r;try{let r=await c.getExecRequest(k);if(F.current!==e||H.current!==t||T.current!==k)return;U(r),I("")}catch(r){F.current===e&&H.current===t&&T.current===k&&I("상세를 읽지 못했습니다. 잠시 뒤 다시 시도해 주세요.")}finally{_.current===r&&(_.current=null)}}},[c,k]);async function V(e){e.preventDefault();let t=m.trim();if(!t||f)return;let r=F.current;x(!0),w("");try{let e=await c.submitExecRequest(t);if(F.current!==r)return;let n={id:e.id,text:t,createdAt:new Date().toISOString(),status:e.status,seats:[],resultCount:0};D.current.set(n.id,n),b(e=>[n,...e.filter(e=>e.id!==n.id)]),p("")}catch(e){F.current===r&&w("보내지 못했습니다. 연결을 확인하고 다시 시도해 주세요.")}finally{F.current===r&&x(!1)}}(0,s.useEffect)(()=>{k&&A()},[A,E]),(0,s.useEffect)(()=>{if(!k||"planning"!==q&&"running"!==q&&!Y)return;let e=setInterval(()=>void A(),5e3);return()=>clearInterval(e)},[k,q,Y,A]);let z=h.find(e=>e.id===k),J=(null==S?void 0:S.id)===k?S:null;return(0,n.jsxs)("main",{className:"mx-auto w-full max-w-2xl space-y-8 px-5 py-10 sm:py-14",children:[(0,n.jsxs)("section",{"aria-labelledby":"exec-compose",className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{id:"exec-compose",className:"text-2xl font-semibold tracking-tight",children:"COO 에게 맡기기"}),(0,n.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"할 일을 한 줄로 적어 보내세요. 자리별 진행과 결과를 여기서 볼 수 있습니다."})]}),(0,n.jsxs)("form",{onSubmit:V,className:"flex gap-2",children:[(0,n.jsx)("label",{htmlFor:"exec-text",className:"sr-only",children:"한 줄로 맡길 일"}),(0,n.jsx)("input",{id:"exec-text",name:"text",value:m,onChange:e=>p(e.target.value),placeholder:"한 줄로 맡길 일",className:"min-w-0 flex-1 rounded-lg border border-input bg-background px-3 py-2 text-sm"}),(0,n.jsx)("button",{type:"submit",disabled:!m.trim()||f,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:f?"보내는 중…":"보내기"})]}),N&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:N})]}),(0,n.jsxs)("section",{"aria-labelledby":"exec-list",className:"space-y-3",children:[(0,n.jsx)("h2",{id:"exec-list",className:"text-xl font-semibold",children:"맡긴 일"}),v&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:v}),!g&&0===h.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"불러오는 중…"}),g&&0===h.length&&!v&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"아직 맡긴 일이 없습니다."}),(0,n.jsx)("ul",{className:"space-y-2",children:h.map(e=>{var t;return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>{k!==e.id&&(H.current+=1,R(e.id),U(null),I(""),P(null))},"aria-expanded":k===e.id,className:"w-full rounded-xl border border-border bg-card p-4 text-left hover:border-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",children:[(0,n.jsxs)("span",{className:"flex items-start justify-between gap-3",children:[(0,n.jsx)("span",{className:"min-w-0 truncate text-sm font-semibold",children:null!=(t=e.text.trim().split(/\r?\n/,1)[0])?t:""}),(0,n.jsx)("span",{className:"shrink-0 text-sm font-medium text-primary",children:u(e.status)})]}),e.seats.length>0&&(0,n.jsx)("span",{className:"mt-2 block truncate text-xs text-muted-foreground",children:e.seats.map(e=>"".concat(e.seat.toUpperCase()," ").concat(d(e.status))).join(" \xb7 ")}),e.resultCount>0&&(0,n.jsxs)("span",{className:"mt-1 block text-xs text-muted-foreground",children:["결과 ",e.resultCount,"개"]})]})},e.id)})})]}),k&&(0,n.jsxs)("section",{"aria-labelledby":"exec-detail",className:"space-y-5 rounded-xl border border-border bg-card p-5",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsx)("h2",{id:"exec-detail",className:"text-lg font-semibold",children:"맡긴 일 상세"}),(0,n.jsx)("button",{type:"button",onClick:()=>{H.current+=1,R(null),U(null),P(null)},className:"text-sm text-primary underline underline-offset-4",children:"닫기"})]}),(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm",children:null!=(t=null==J?void 0:J.text)?t:null==z?void 0:z.text}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:u(null!=(o=null!=(r=null==J?void 0:J.status)?r:null==z?void 0:z.status)?o:"planning")}),C&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:C}),!J&&!C&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"상세 불러오는 중…"}),J&&(0,n.jsxs)(n.Fragment,{children:[J.summary&&(0,n.jsx)("p",{className:"text-sm",children:J.summary}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h3",{className:"font-semibold",children:"이렇게 나눠 맡겼습니다"}),0===J.seats.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"planning"===J.status?"COO 가 나누는 중입니다":"맡은 자리가 없습니다"}),(0,n.jsx)("ul",{className:"space-y-2",children:J.seats.map(e=>(0,n.jsxs)("li",{className:"rounded-lg border border-border bg-background px-4 py-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsxs)("span",{className:"font-semibold",children:[e.seat.toUpperCase()," \xb7 ",e.title]}),(0,n.jsx)("span",{className:"shrink-0 text-muted-foreground",children:d(e.status)})]}),"failed"===e.status&&e.reason&&(0,n.jsxs)("p",{className:"mt-2 text-destructive",children:["못 한 이유 \xb7 ",e.reason]})]},"".concat(e.seat,":").concat(e.title)))})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h3",{className:"font-semibold",children:"결과"}),0===J.results.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"아직 결과가 없습니다."}),(0,n.jsx)("ul",{className:"space-y-2",children:J.results.map(e=>(0,n.jsx)(i,{client:c,id:J.id,result:e},e.url))})]}),(0,n.jsx)(l.a,{client:c,approvals:J.approvals,onDecided:()=>L(e=>e+1),onPendingChange:P},J.id)]})]})]})}},5997:(e,t,r)=>{"use strict";r.d(t,{Zr:()=>l,f6:()=>s,oD:()=>a});let n="elanous.daemon.sessionId";function s(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"s-".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))}function a(){let e=function(){let e=new URLSearchParams(window.location.search).get("session");return e?(localStorage.setItem(n,e),e):localStorage.getItem(n)}();if(e)return e;let t=s();return localStorage.setItem(n,t),t}function l(){let e=s();return localStorage.setItem(n,e),e}},12958:(e,t,r)=>{"use strict";r.d(t,{a:()=>o});var n=r(55539),s=r(46124),a=r(74780);let l=e=>JSON.stringify([e.graphId,e.runId]);function o(e){let{client:t,approvals:r,onDecided:o,onPendingChange:c}=e,i=(0,s.useMemo)(()=>(0,a.ll)({client:t}),[t]),[u,d]=(0,s.useState)([]),[m,p]=(0,s.useState)({}),[f,x]=(0,s.useState)(null),[h,b]=(0,s.useState)(""),g=(0,s.useRef)(0),y=r.map(l).join("|");function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m;d(e),c(r.filter(r=>!t[l(r)]&&e.some(e=>l(e)===l(r))).length)}async function j(e,t){let n=l(e);if(f||m[n]||!r.some(e=>l(e)===n)||!u.some(e=>l(e)===n))return;let s=g.current;x(n),b("");try{if(await i.decide(e.graphId,e.runId,t),g.current!==s)return;let r={...m,[n]:t};p(r),v(u,r),o();let a=await i.list();g.current===s&&v(a.items,r)}catch(e){g.current===s&&b((0,a.LP)(e,"decide"))}finally{g.current===s&&x(null)}}return((0,s.useEffect)(()=>{let e=++g.current;return(d([]),b(""),y)?(i.list().then(t=>{g.current===e&&v(t.items)}).catch(t=>{g.current===e&&b((0,a.LP)(t,"list"))}),()=>{g.current+=1}):(c(0),()=>{g.current+=1})},[i,y]),0===r.length)?null:(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("h3",{className:"font-semibold",children:"게시 승인"}),h&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:h}),(0,n.jsx)("ul",{className:"space-y-2",children:r.map(e=>{let t=l(e),r=u.some(e=>l(e)===t);return(0,n.jsxs)("li",{className:"rounded-lg border border-border bg-background px-4 py-3 text-sm",children:[(0,n.jsx)("p",{children:e.message}),m[t]?(0,n.jsx)("p",{className:"mt-2 text-muted-foreground",children:"approved"===m[t]?"승인됨":"보류됨"}):r?(0,n.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,n.jsx)("button",{type:"button",disabled:null!==f,onClick:()=>void j(e,"approved"),className:"rounded-lg bg-primary px-3 py-1 text-primary-foreground disabled:opacity-50",children:"승인"}),(0,n.jsx)("button",{type:"button",disabled:null!==f,onClick:()=>void j(e,"rejected"),className:"rounded-lg border border-border px-3 py-1 disabled:opacity-50",children:"보류"})]}):(0,n.jsx)("p",{className:"mt-2 text-muted-foreground",children:"대기 중인 승인이 아닙니다."})]},t)})})]})}},15151:(e,t,r)=>{"use strict";r.d(t,{C:()=>i,DaemonProvider:()=>u,Q:()=>d});var n=r(55539),s=r(46124),a=r(8101),l=r(5997),o=r(18060),c=r(72215);let i=(0,s.createContext)(null);function u(e){let{children:t}=e,r={baseUrl:"",token:"",provider:""},[u,d]=(0,s.useState)(r),[m,p]=(0,s.useState)(""),[f]=(0,s.useState)(()=>new o.ki(r));(0,s.useEffect)(()=>{let e=(0,a.Fp)();d(e),f.updateConfig(e),p((0,l.oD)()),(0,c.cY)("webterm.provider.daemon.init",{baseUrl:e.baseUrl,hasToken:!!e.token})},[f]),(0,s.useEffect)(()=>{let e=e=>{if("elanous.daemon.token"===e.key||"elanous.nexus.baseUrl"===e.key){let t=(0,a.Fp)();f.updateConfig(t),d(t),(0,c.cY)("webterm.provider.daemon.config-cross-tab",{key:e.key,hasToken:!!t.token});return}"elanous.daemon.sessionId"===e.key&&e.newValue&&p(t=>t===e.newValue?t:((0,c.cY)("webterm.provider.daemon.session-cross-tab",{previous:t||"(empty)",next:e.newValue}),e.newValue))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[f]);let x=e=>{d(t=>{let r={...t,...e};return(0,a.Qc)(e),f.updateConfig(r),(0,c.cY)("webterm.provider.daemon.config-update",{keys:Object.keys(e)}),r})},h=e=>{p(e),localStorage.setItem("elanous.daemon.sessionId",e),(0,c.cY)("webterm.provider.daemon.session-set",{sessionId:e})},b=(0,s.useMemo)(()=>({config:u,setConfig:x,client:f,sessionId:m,setSessionId:h}),[u,f,m]);return(0,n.jsx)(i.Provider,{value:b,children:t})}function d(){let e=(0,s.useContext)(i);if(!e)throw Error("useDaemon must be used inside <DaemonProvider>");return e}},42314:(e,t,r)=>{Promise.resolve().then(r.bind(r,4977))},74780:(e,t,r)=>{"use strict";function n(e){return{slides:e.slides.map(e=>{let{image:t,caption:r,include:n}=e;return{image:t,caption:r,include:n}}),caption:{hook:e.caption.hook,body:e.caption.body},hashtags:[...e.hashtags],cover:{text:e.cover.text,sub:e.cover.sub},location:e.location}}r.d(t,{$Y:()=>l,LP:()=>c,Mz:()=>n,ll:()=>u,rH:()=>o});class s extends Error{constructor(e,t){super(t),this.status=e,this.name="GraphApprovalsApiError"}}let a={list:"목록을 보려면",decide:"승인하려면",save:"초안을 저장하려면"},l="/app/settings/#bearer-token";function o(e){return e instanceof s&&(401===e.status||403===e.status)}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"decide";return e instanceof s?401===e.status||403===e.status?"".concat(a[t]," 이 기기를 데몬에 연결해야 합니다 — 설정 › 데몬 연결 › 연결 토큰 칸에 토큰을 넣어 주세요."):404===e.status?"이 실행을 찾지 못했습니다. 목록을 다시 확인해 주세요.":409===e.status?"이미 결정된 실행입니다. 목록을 다시 확인해 주세요.":400===e.status?"결정 내용을 확인한 뒤 다시 시도해 주세요.":"승인 요청을 처리하지 못했습니다. 잠시 뒤 다시 시도해 주세요.":e instanceof TypeError?"서버에 연결하지 못했습니다. 연결 상태를 확인해 주세요.":"승인 요청을 처리하지 못했습니다. 잠시 뒤 다시 시도해 주세요."}let i="/v1/graph-approvals";function u(e){var t,r;let n=(null!=(t=e.baseUrl)?t:"").replace(/\/+$/,""),a=null!=(r=e.fetchImpl)?r:fetch;async function l(t,r){let l={...r,headers:{"content-type":"application/json",...e.authHeader?{authorization:e.authHeader}:{}}},o=e.client?await e.client.fetchResponse(t,l):await a("".concat(n).concat(t),l),c=await o.json().catch(()=>null);if(!o.ok){let e=c&&"object"==typeof c&&"error"in c&&"string"==typeof c.error?c.error:"request-failed";throw new s(o.status,e)}return c}return{list:()=>l(i),decide:(e,t,r)=>l("".concat(i,"/").concat(encodeURIComponent(e),"/").concat(encodeURIComponent(t)),{method:"POST",body:JSON.stringify({decision:r})}),saveFeedDraft:(e,t,r)=>l("".concat(i,"/").concat(encodeURIComponent(e),"/").concat(encodeURIComponent(t),"/feed-draft"),{method:"PUT",body:JSON.stringify(r)}),feedMedia:async(t,r,l)=>{let o="".concat(i,"/").concat(encodeURIComponent(t),"/").concat(encodeURIComponent(r),"/media?path=").concat(encodeURIComponent(l)),c={headers:e.authHeader?{authorization:e.authHeader}:{}},u=e.client?await e.client.fetchResponse(o,c):await a("".concat(n).concat(o),c);if(!u.ok)throw new s(u.status,"media-failed");return u.blob()}}}}},e=>{e.O(0,[8060,2463,2196,7358],()=>e(e.s=42314)),_N_E=e.O()}]);