siclaw 0.1.0 → 0.1.2

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 (270) hide show
  1. package/README.md +75 -114
  2. package/dist/agentbox/gateway-client.d.ts +2 -1
  3. package/dist/agentbox/gateway-client.js +6 -2
  4. package/dist/agentbox/gateway-client.js.map +1 -1
  5. package/dist/agentbox/http-server.js +184 -19
  6. package/dist/agentbox/http-server.js.map +1 -1
  7. package/dist/agentbox/resource-handlers.d.ts +1 -0
  8. package/dist/agentbox/resource-handlers.js +23 -23
  9. package/dist/agentbox/resource-handlers.js.map +1 -1
  10. package/dist/agentbox/session.js +85 -5
  11. package/dist/agentbox/session.js.map +1 -1
  12. package/dist/agentbox-main.d.ts +2 -1
  13. package/dist/agentbox-main.js +65 -18
  14. package/dist/agentbox-main.js.map +1 -1
  15. package/dist/cli-credentials.d.ts +1 -0
  16. package/dist/cli-credentials.js +109 -0
  17. package/dist/cli-credentials.js.map +1 -0
  18. package/dist/cli-first-run.d.ts +11 -0
  19. package/dist/cli-first-run.js +99 -0
  20. package/dist/cli-first-run.js.map +1 -0
  21. package/dist/cli-main.js +33 -11
  22. package/dist/cli-main.js.map +1 -1
  23. package/dist/cli-setup.d.ts +5 -11
  24. package/dist/cli-setup.js +12 -225
  25. package/dist/cli-setup.js.map +1 -1
  26. package/dist/core/agent-factory.d.ts +4 -0
  27. package/dist/core/agent-factory.js +102 -151
  28. package/dist/core/agent-factory.js.map +1 -1
  29. package/dist/core/config.d.ts +10 -3
  30. package/dist/core/config.js +11 -95
  31. package/dist/core/config.js.map +1 -1
  32. package/dist/core/extensions/deep-investigation.d.ts +2 -1
  33. package/dist/core/extensions/deep-investigation.js +144 -24
  34. package/dist/core/extensions/deep-investigation.js.map +1 -1
  35. package/dist/core/extensions/setup.d.ts +8 -0
  36. package/dist/core/extensions/setup.js +669 -0
  37. package/dist/core/extensions/setup.js.map +1 -0
  38. package/dist/core/llm-proxy.js +7 -3
  39. package/dist/core/llm-proxy.js.map +1 -1
  40. package/dist/core/mcp-client.d.ts +0 -10
  41. package/dist/core/mcp-client.js +0 -65
  42. package/dist/core/mcp-client.js.map +1 -1
  43. package/dist/core/prompt.d.ts +1 -1
  44. package/dist/core/prompt.js +42 -5
  45. package/dist/core/prompt.js.map +1 -1
  46. package/dist/core/provider-presets.d.ts +14 -0
  47. package/dist/core/provider-presets.js +81 -0
  48. package/dist/core/provider-presets.js.map +1 -0
  49. package/dist/cron/cron-coordinator.d.ts +2 -0
  50. package/dist/cron/cron-coordinator.js +46 -14
  51. package/dist/cron/cron-coordinator.js.map +1 -1
  52. package/dist/cron/cron-executor.js +33 -8
  53. package/dist/cron/cron-executor.js.map +1 -1
  54. package/dist/cron/cron-scheduler.d.ts +1 -1
  55. package/dist/cron/gateway-client.d.ts +5 -0
  56. package/dist/cron/gateway-client.js +43 -8
  57. package/dist/cron/gateway-client.js.map +1 -1
  58. package/dist/cron-main.js +39 -9
  59. package/dist/cron-main.js.map +1 -1
  60. package/dist/gateway/agentbox/client.d.ts +11 -0
  61. package/dist/gateway/agentbox/client.js +18 -0
  62. package/dist/gateway/agentbox/client.js.map +1 -1
  63. package/dist/gateway/agentbox/k8s-spawner.d.ts +11 -2
  64. package/dist/gateway/agentbox/k8s-spawner.js +95 -52
  65. package/dist/gateway/agentbox/k8s-spawner.js.map +1 -1
  66. package/dist/gateway/agentbox/local-spawner.d.ts +1 -1
  67. package/dist/gateway/agentbox/local-spawner.js +4 -2
  68. package/dist/gateway/agentbox/local-spawner.js.map +1 -1
  69. package/dist/gateway/agentbox/manager.d.ts +0 -10
  70. package/dist/gateway/agentbox/manager.js +11 -30
  71. package/dist/gateway/agentbox/manager.js.map +1 -1
  72. package/dist/gateway/agentbox/types.d.ts +6 -4
  73. package/dist/gateway/cron/cron-service.d.ts +49 -0
  74. package/dist/gateway/cron/cron-service.js +259 -0
  75. package/dist/gateway/cron/cron-service.js.map +1 -0
  76. package/dist/gateway/db/init-schema.js +44 -0
  77. package/dist/gateway/db/init-schema.js.map +1 -1
  78. package/dist/gateway/db/migrate-sqlite.js +73 -4
  79. package/dist/gateway/db/migrate-sqlite.js.map +1 -1
  80. package/dist/gateway/db/repositories/chat-repo.d.ts +56 -2
  81. package/dist/gateway/db/repositories/chat-repo.js +132 -2
  82. package/dist/gateway/db/repositories/chat-repo.js.map +1 -1
  83. package/dist/gateway/db/repositories/config-repo.d.ts +31 -2
  84. package/dist/gateway/db/repositories/config-repo.js +57 -7
  85. package/dist/gateway/db/repositories/config-repo.js.map +1 -1
  86. package/dist/gateway/db/repositories/env-repo.d.ts +14 -0
  87. package/dist/gateway/db/repositories/env-repo.js +15 -2
  88. package/dist/gateway/db/repositories/env-repo.js.map +1 -1
  89. package/dist/gateway/db/repositories/model-config-repo.d.ts +1 -1
  90. package/dist/gateway/db/repositories/model-config-repo.js +26 -12
  91. package/dist/gateway/db/repositories/model-config-repo.js.map +1 -1
  92. package/dist/gateway/db/repositories/skill-repo.d.ts +0 -5
  93. package/dist/gateway/db/repositories/skill-review-repo.d.ts +1 -0
  94. package/dist/gateway/db/repositories/skill-review-repo.js +4 -1
  95. package/dist/gateway/db/repositories/skill-review-repo.js.map +1 -1
  96. package/dist/gateway/db/repositories/skill-version-repo.js +0 -1
  97. package/dist/gateway/db/repositories/skill-version-repo.js.map +1 -1
  98. package/dist/gateway/db/repositories/system-config-repo.d.ts +1 -1
  99. package/dist/gateway/db/repositories/system-config-repo.js +2 -1
  100. package/dist/gateway/db/repositories/system-config-repo.js.map +1 -1
  101. package/dist/gateway/db/repositories/user-env-config-repo.d.ts +13 -0
  102. package/dist/gateway/db/repositories/user-env-config-repo.js +11 -0
  103. package/dist/gateway/db/repositories/user-env-config-repo.js.map +1 -1
  104. package/dist/gateway/db/repositories/workspace-repo.d.ts +3 -2
  105. package/dist/gateway/db/repositories/workspace-repo.js +6 -2
  106. package/dist/gateway/db/repositories/workspace-repo.js.map +1 -1
  107. package/dist/gateway/db/schema-mysql.d.ts +473 -51
  108. package/dist/gateway/db/schema-mysql.js +35 -4
  109. package/dist/gateway/db/schema-mysql.js.map +1 -1
  110. package/dist/gateway/db/schema-sqlite.d.ts +522 -57
  111. package/dist/gateway/db/schema-sqlite.js +38 -6
  112. package/dist/gateway/db/schema-sqlite.js.map +1 -1
  113. package/dist/gateway/db/schema.d.ts +471 -51
  114. package/dist/gateway/db/schema.js +1 -1
  115. package/dist/gateway/db/schema.js.map +1 -1
  116. package/dist/gateway/metrics-aggregator.d.ts +65 -0
  117. package/dist/gateway/metrics-aggregator.js +244 -0
  118. package/dist/gateway/metrics-aggregator.js.map +1 -0
  119. package/dist/gateway/plugins/channel-bridge.d.ts +4 -1
  120. package/dist/gateway/plugins/channel-bridge.js +78 -86
  121. package/dist/gateway/plugins/channel-bridge.js.map +1 -1
  122. package/dist/gateway/rpc-methods.d.ts +4 -2
  123. package/dist/gateway/rpc-methods.js +962 -163
  124. package/dist/gateway/rpc-methods.js.map +1 -1
  125. package/dist/gateway/security/cert-manager.d.ts +2 -2
  126. package/dist/gateway/security/cert-manager.js +4 -2
  127. package/dist/gateway/security/cert-manager.js.map +1 -1
  128. package/dist/gateway/server.d.ts +4 -8
  129. package/dist/gateway/server.js +297 -261
  130. package/dist/gateway/server.js.map +1 -1
  131. package/dist/gateway/skills/file-writer.js +17 -11
  132. package/dist/gateway/skills/file-writer.js.map +1 -1
  133. package/dist/gateway/skills/script-evaluator.js +12 -9
  134. package/dist/gateway/skills/script-evaluator.js.map +1 -1
  135. package/dist/gateway/web/dist/assets/index-0p17ZeTP.js +740 -0
  136. package/dist/gateway/web/dist/assets/index-9eP6nPUq.js +741 -0
  137. package/dist/gateway/web/dist/assets/index-9eP6nPUq.js.map +1 -0
  138. package/dist/gateway/web/dist/assets/index-CAmSY91d.js +675 -0
  139. package/dist/gateway/web/dist/assets/index-DMFEh8Pp.css +1 -0
  140. package/dist/gateway/web/dist/assets/index-DyowBCEj.css +1 -0
  141. package/dist/gateway/web/dist/assets/index-PDK5JJDO.css +1 -0
  142. package/dist/gateway/web/dist/index.html +2 -2
  143. package/dist/gateway-main.js +27 -10
  144. package/dist/gateway-main.js.map +1 -1
  145. package/dist/memory/embeddings.js +5 -4
  146. package/dist/memory/embeddings.js.map +1 -1
  147. package/dist/memory/indexer.d.ts +23 -3
  148. package/dist/memory/indexer.js +235 -23
  149. package/dist/memory/indexer.js.map +1 -1
  150. package/dist/memory/schema.js +15 -1
  151. package/dist/memory/schema.js.map +1 -1
  152. package/dist/memory/types.d.ts +18 -0
  153. package/dist/memory/types.js +6 -1
  154. package/dist/memory/types.js.map +1 -1
  155. package/dist/shared/detect-language.d.ts +12 -0
  156. package/dist/shared/detect-language.js +78 -0
  157. package/dist/shared/detect-language.js.map +1 -0
  158. package/dist/shared/diagnostic-events.d.ts +70 -0
  159. package/dist/shared/diagnostic-events.js +38 -0
  160. package/dist/shared/diagnostic-events.js.map +1 -0
  161. package/dist/shared/local-collector.d.ts +56 -0
  162. package/dist/shared/local-collector.js +284 -0
  163. package/dist/shared/local-collector.js.map +1 -0
  164. package/dist/shared/metrics-types.d.ts +64 -0
  165. package/dist/shared/metrics-types.js +25 -0
  166. package/dist/shared/metrics-types.js.map +1 -0
  167. package/dist/shared/metrics.d.ts +19 -0
  168. package/dist/shared/metrics.js +185 -0
  169. package/dist/shared/metrics.js.map +1 -0
  170. package/dist/shared/path-utils.d.ts +15 -0
  171. package/dist/shared/path-utils.js +23 -0
  172. package/dist/shared/path-utils.js.map +1 -0
  173. package/dist/shared/retry.d.ts +35 -0
  174. package/dist/shared/retry.js +61 -0
  175. package/dist/shared/retry.js.map +1 -0
  176. package/dist/tools/command-sets.d.ts +18 -2
  177. package/dist/tools/command-sets.js +207 -32
  178. package/dist/tools/command-sets.js.map +1 -1
  179. package/dist/tools/command-validator.d.ts +56 -0
  180. package/dist/tools/command-validator.js +357 -0
  181. package/dist/tools/command-validator.js.map +1 -0
  182. package/dist/tools/create-skill.js +26 -1
  183. package/dist/tools/create-skill.js.map +1 -1
  184. package/dist/tools/credential-list.js +1 -23
  185. package/dist/tools/credential-list.js.map +1 -1
  186. package/dist/tools/credential-manager.d.ts +98 -0
  187. package/dist/tools/credential-manager.js +313 -0
  188. package/dist/tools/credential-manager.js.map +1 -0
  189. package/dist/tools/deep-search/engine.js +184 -127
  190. package/dist/tools/deep-search/engine.js.map +1 -1
  191. package/dist/tools/deep-search/prompts.d.ts +10 -2
  192. package/dist/tools/deep-search/prompts.js +37 -36
  193. package/dist/tools/deep-search/prompts.js.map +1 -1
  194. package/dist/tools/deep-search/schemas.d.ts +87 -0
  195. package/dist/tools/deep-search/schemas.js +85 -0
  196. package/dist/tools/deep-search/schemas.js.map +1 -0
  197. package/dist/tools/deep-search/sub-agent.d.ts +21 -0
  198. package/dist/tools/deep-search/sub-agent.js +153 -4
  199. package/dist/tools/deep-search/sub-agent.js.map +1 -1
  200. package/dist/tools/deep-search/tool.js +1 -0
  201. package/dist/tools/deep-search/tool.js.map +1 -1
  202. package/dist/tools/deep-search/types.d.ts +2 -0
  203. package/dist/tools/deep-search/types.js.map +1 -1
  204. package/dist/tools/dp-tools.js +29 -5
  205. package/dist/tools/dp-tools.js.map +1 -1
  206. package/dist/tools/exec-utils.d.ts +85 -0
  207. package/dist/tools/exec-utils.js +294 -0
  208. package/dist/tools/exec-utils.js.map +1 -0
  209. package/dist/tools/fork-skill.js +14 -2
  210. package/dist/tools/fork-skill.js.map +1 -1
  211. package/dist/tools/investigation-feedback.d.ts +3 -0
  212. package/dist/tools/investigation-feedback.js +71 -0
  213. package/dist/tools/investigation-feedback.js.map +1 -0
  214. package/dist/tools/manage-schedule.js +16 -6
  215. package/dist/tools/manage-schedule.js.map +1 -1
  216. package/dist/tools/netns-script.js +27 -281
  217. package/dist/tools/netns-script.js.map +1 -1
  218. package/dist/tools/node-exec.d.ts +2 -14
  219. package/dist/tools/node-exec.js +18 -225
  220. package/dist/tools/node-exec.js.map +1 -1
  221. package/dist/tools/node-script.js +14 -168
  222. package/dist/tools/node-script.js.map +1 -1
  223. package/dist/tools/pod-exec.d.ts +1 -1
  224. package/dist/tools/pod-exec.js +10 -26
  225. package/dist/tools/pod-exec.js.map +1 -1
  226. package/dist/tools/pod-nsenter-exec.js +21 -225
  227. package/dist/tools/pod-nsenter-exec.js.map +1 -1
  228. package/dist/tools/pod-script.js +10 -19
  229. package/dist/tools/pod-script.js.map +1 -1
  230. package/dist/tools/restricted-bash.d.ts +1 -17
  231. package/dist/tools/restricted-bash.js +38 -252
  232. package/dist/tools/restricted-bash.js.map +1 -1
  233. package/dist/tools/run-skill.d.ts +3 -1
  234. package/dist/tools/run-skill.js +21 -1
  235. package/dist/tools/run-skill.js.map +1 -1
  236. package/dist/tools/script-resolver.d.ts +3 -1
  237. package/dist/tools/script-resolver.js +74 -30
  238. package/dist/tools/script-resolver.js.map +1 -1
  239. package/dist/tools/update-skill.js +17 -6
  240. package/dist/tools/update-skill.js.map +1 -1
  241. package/package.json +8 -6
  242. package/siclaw.mjs +10 -1
  243. package/skills/core/cluster-events/SKILL.md +1 -1
  244. package/skills/core/deep-investigation/SKILL.md +11 -0
  245. package/skills/core/deployment-rollout-debug/SKILL.md +1 -1
  246. package/skills/core/dns-debug/SKILL.md +1 -0
  247. package/skills/core/meta.json +12 -1
  248. package/skills/core/networkpolicy-debug/SKILL.md +332 -0
  249. package/skills/core/node-logs/scripts/get-node-logs.sh +19 -9
  250. package/skills/core/pod-pending-debug/SKILL.md +1 -0
  251. package/skills/core/quota-debug/SKILL.md +203 -0
  252. package/skills/core/service-debug/SKILL.md +1 -0
  253. package/skills/core/statefulset-debug/SKILL.md +280 -0
  254. package/skills/core/volcano-diagnose-pod/SKILL.md +196 -0
  255. package/skills/core/volcano-diagnose-pod/scripts/diagnose-pod.sh +175 -0
  256. package/skills/core/volcano-gang-scheduling/SKILL.md +299 -0
  257. package/skills/core/volcano-job-diagnose/SKILL.md +319 -0
  258. package/skills/core/volcano-job-diagnose/scripts/diagnose-job.sh +253 -0
  259. package/skills/core/volcano-node-resources/SKILL.md +334 -0
  260. package/skills/core/volcano-node-resources/scripts/get-node-resources.sh +281 -0
  261. package/skills/core/volcano-queue-diagnose/SKILL.md +294 -0
  262. package/skills/core/volcano-queue-diagnose/scripts/diagnose-queue.sh +283 -0
  263. package/skills/core/volcano-resource-insufficient/SKILL.md +315 -0
  264. package/skills/core/volcano-scheduler-config/SKILL.md +371 -0
  265. package/skills/core/volcano-scheduler-config/scripts/get-scheduler-config.sh +297 -0
  266. package/skills/core/volcano-scheduler-logs/SKILL.md +241 -0
  267. package/skills/core/volcano-scheduler-logs/scripts/get-scheduler-logs.sh +159 -0
  268. package/skills/platform/create-skill/SKILL.md +35 -3
  269. package/skills/platform/manage-skill/SKILL.md +9 -2
  270. package/skills/platform/update-skill/SKILL.md +17 -6
@@ -0,0 +1,675 @@
1
+ function Qy(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Jt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ao(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jy={exports:{}},Ic={},Zy={exports:{}},Ue={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Do=Symbol.for("react.element"),KS=Symbol.for("react.portal"),GS=Symbol.for("react.fragment"),qS=Symbol.for("react.strict_mode"),YS=Symbol.for("react.profiler"),XS=Symbol.for("react.provider"),QS=Symbol.for("react.context"),JS=Symbol.for("react.forward_ref"),ZS=Symbol.for("react.suspense"),ej=Symbol.for("react.memo"),tj=Symbol.for("react.lazy"),Mm=Symbol.iterator;function nj(e){return e===null||typeof e!="object"?null:(e=Mm&&e[Mm]||e["@@iterator"],typeof e=="function"?e:null)}var ev={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tv=Object.assign,nv={};function Ji(e,t,n){this.props=e,this.context=t,this.refs=nv,this.updater=n||ev}Ji.prototype.isReactComponent={};Ji.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ji.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function rv(){}rv.prototype=Ji.prototype;function yh(e,t,n){this.props=e,this.context=t,this.refs=nv,this.updater=n||ev}var vh=yh.prototype=new rv;vh.constructor=yh;tv(vh,Ji.prototype);vh.isPureReactComponent=!0;var Im=Array.isArray,sv=Object.prototype.hasOwnProperty,bh={current:null},iv={key:!0,ref:!0,__self:!0,__source:!0};function av(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)sv.call(t,r)&&!iv.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:Do,type:e,key:i,ref:o,props:s,_owner:bh.current}}function rj(e,t){return{$$typeof:Do,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function wh(e){return typeof e=="object"&&e!==null&&e.$$typeof===Do}function sj(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Rm=/\/+/g;function wu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?sj(""+e.key):t.toString(36)}function Tl(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Do:case KS:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+wu(o,0):r,Im(s)?(n="",e!=null&&(n=e.replace(Rm,"$&/")+"/"),Tl(s,t,n,"",function(u){return u})):s!=null&&(wh(s)&&(s=rj(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(Rm,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",Im(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+wu(i,l);o+=Tl(i,t,n,c,s)}else if(c=nj(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+wu(i,l++),o+=Tl(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Xo(e,t,n){if(e==null)return e;var r=[],s=0;return Tl(e,r,"","",function(i){return t.call(n,i,s++)}),r}function ij(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var an={current:null},Pl={transition:null},aj={ReactCurrentDispatcher:an,ReactCurrentBatchConfig:Pl,ReactCurrentOwner:bh};function ov(){throw Error("act(...) is not supported in production builds of React.")}Ue.Children={map:Xo,forEach:function(e,t,n){Xo(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xo(e,function(){t++}),t},toArray:function(e){return Xo(e,function(t){return t})||[]},only:function(e){if(!wh(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ue.Component=Ji;Ue.Fragment=GS;Ue.Profiler=YS;Ue.PureComponent=yh;Ue.StrictMode=qS;Ue.Suspense=ZS;Ue.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=aj;Ue.act=ov;Ue.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=tv({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=bh.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)sv.call(t,c)&&!iv.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:Do,type:e.type,key:s,ref:i,props:r,_owner:o}};Ue.createContext=function(e){return e={$$typeof:QS,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:XS,_context:e},e.Consumer=e};Ue.createElement=av;Ue.createFactory=function(e){var t=av.bind(null,e);return t.type=e,t};Ue.createRef=function(){return{current:null}};Ue.forwardRef=function(e){return{$$typeof:JS,render:e}};Ue.isValidElement=wh;Ue.lazy=function(e){return{$$typeof:tj,_payload:{_status:-1,_result:e},_init:ij}};Ue.memo=function(e,t){return{$$typeof:ej,type:e,compare:t===void 0?null:t}};Ue.startTransition=function(e){var t=Pl.transition;Pl.transition={};try{e()}finally{Pl.transition=t}};Ue.unstable_act=ov;Ue.useCallback=function(e,t){return an.current.useCallback(e,t)};Ue.useContext=function(e){return an.current.useContext(e)};Ue.useDebugValue=function(){};Ue.useDeferredValue=function(e){return an.current.useDeferredValue(e)};Ue.useEffect=function(e,t){return an.current.useEffect(e,t)};Ue.useId=function(){return an.current.useId()};Ue.useImperativeHandle=function(e,t,n){return an.current.useImperativeHandle(e,t,n)};Ue.useInsertionEffect=function(e,t){return an.current.useInsertionEffect(e,t)};Ue.useLayoutEffect=function(e,t){return an.current.useLayoutEffect(e,t)};Ue.useMemo=function(e,t){return an.current.useMemo(e,t)};Ue.useReducer=function(e,t,n){return an.current.useReducer(e,t,n)};Ue.useRef=function(e){return an.current.useRef(e)};Ue.useState=function(e){return an.current.useState(e)};Ue.useSyncExternalStore=function(e,t,n){return an.current.useSyncExternalStore(e,t,n)};Ue.useTransition=function(){return an.current.useTransition()};Ue.version="18.3.1";Zy.exports=Ue;var g=Zy.exports;const oj=Ao(g),lj=Qy({__proto__:null,default:oj},[g]);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var cj=g,uj=Symbol.for("react.element"),dj=Symbol.for("react.fragment"),fj=Object.prototype.hasOwnProperty,hj=cj.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pj={key:!0,ref:!0,__self:!0,__source:!0};function lv(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)fj.call(t,r)&&!pj.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:uj,type:e,key:i,ref:o,props:s,_owner:hj.current}}Ic.Fragment=dj;Ic.jsx=lv;Ic.jsxs=lv;Jy.exports=Ic;var a=Jy.exports,Id={},cv={exports:{}},En={},uv={exports:{}},dv={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(R,V){var E=R.length;R.push(V);e:for(;0<E;){var Y=E-1>>>1,J=R[Y];if(0<s(J,V))R[Y]=V,R[E]=J,E=Y;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var V=R[0],E=R.pop();if(E!==V){R[0]=E;e:for(var Y=0,J=R.length,L=J>>>1;Y<L;){var Q=2*(Y+1)-1,te=R[Q],pe=Q+1,ne=R[pe];if(0>s(te,E))pe<J&&0>s(ne,te)?(R[Y]=ne,R[pe]=E,Y=pe):(R[Y]=te,R[Q]=E,Y=Q);else if(pe<J&&0>s(ne,E))R[Y]=ne,R[pe]=E,Y=pe;else break e}}return V}function s(R,V){var E=R.sortIndex-V.sortIndex;return E!==0?E:R.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],f=1,d=null,h=3,p=!1,x=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(R){for(var V=n(u);V!==null;){if(V.callback===null)r(u);else if(V.startTime<=R)r(u),V.sortIndex=V.expirationTime,t(c,V);else break;V=n(u)}}function j(R){if(b=!1,y(R),!x)if(n(c)!==null)x=!0,fe(S);else{var V=n(u);V!==null&&ee(j,V.startTime-R)}}function S(R,V){x=!1,b&&(b=!1,v(C),C=-1),p=!0;var E=h;try{for(y(V),d=n(c);d!==null&&(!(d.expirationTime>V)||R&&!M());){var Y=d.callback;if(typeof Y=="function"){d.callback=null,h=d.priorityLevel;var J=Y(d.expirationTime<=V);V=e.unstable_now(),typeof J=="function"?d.callback=J:d===n(c)&&r(c),y(V)}else r(c);d=n(c)}if(d!==null)var L=!0;else{var Q=n(u);Q!==null&&ee(j,Q.startTime-V),L=!1}return L}finally{d=null,h=E,p=!1}}var N=!1,w=null,C=-1,D=5,T=-1;function M(){return!(e.unstable_now()-T<D)}function P(){if(w!==null){var R=e.unstable_now();T=R;var V=!0;try{V=w(!0,R)}finally{V?F():(N=!1,w=null)}}else N=!1}var F;if(typeof m=="function")F=function(){m(P)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,W=z.port2;z.port1.onmessage=P,F=function(){W.postMessage(null)}}else F=function(){k(P,0)};function fe(R){w=R,N||(N=!0,F())}function ee(R,V){C=k(function(){R(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_continueExecution=function(){x||p||(x=!0,fe(S))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(R){switch(h){case 1:case 2:case 3:var V=3;break;default:V=h}var E=h;h=V;try{return R()}finally{h=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,V){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var E=h;h=R;try{return V()}finally{h=E}},e.unstable_scheduleCallback=function(R,V,E){var Y=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?Y+E:Y):E=Y,R){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=E+J,R={id:f++,callback:V,priorityLevel:R,startTime:E,expirationTime:J,sortIndex:-1},E>Y?(R.sortIndex=E,t(u,R),n(c)===null&&R===n(u)&&(b?(v(C),C=-1):b=!0,ee(j,E-Y))):(R.sortIndex=J,t(c,R),x||p||(x=!0,fe(S))),R},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(R){var V=h;return function(){var E=h;h=V;try{return R.apply(this,arguments)}finally{h=E}}}})(dv);uv.exports=dv;var mj=uv.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var gj=g,Nn=mj;function ae(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var fv=new Set,Qa={};function Js(e,t){_i(e,t),_i(e+"Capture",t)}function _i(e,t){for(Qa[e]=t,e=0;e<t.length;e++)fv.add(t[e])}var jr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rd=Object.prototype.hasOwnProperty,xj=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,_m={},Fm={};function yj(e){return Rd.call(Fm,e)?!0:Rd.call(_m,e)?!1:xj.test(e)?Fm[e]=!0:(_m[e]=!0,!1)}function vj(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function bj(e,t,n,r){if(t===null||typeof t>"u"||vj(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function on(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var $t={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){$t[e]=new on(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];$t[t]=new on(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){$t[e]=new on(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){$t[e]=new on(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){$t[e]=new on(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){$t[e]=new on(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){$t[e]=new on(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){$t[e]=new on(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){$t[e]=new on(e,5,!1,e.toLowerCase(),null,!1,!1)});var kh=/[\-:]([a-z])/g;function Sh(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(kh,Sh);$t[t]=new on(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(kh,Sh);$t[t]=new on(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(kh,Sh);$t[t]=new on(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){$t[e]=new on(e,1,!1,e.toLowerCase(),null,!1,!1)});$t.xlinkHref=new on("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){$t[e]=new on(e,1,!1,e.toLowerCase(),null,!0,!0)});function jh(e,t,n,r){var s=$t.hasOwnProperty(t)?$t[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(bj(t,n,s,r)&&(n=null),r||s===null?yj(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ar=gj.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Qo=Symbol.for("react.element"),di=Symbol.for("react.portal"),fi=Symbol.for("react.fragment"),Nh=Symbol.for("react.strict_mode"),_d=Symbol.for("react.profiler"),hv=Symbol.for("react.provider"),pv=Symbol.for("react.context"),Ch=Symbol.for("react.forward_ref"),Fd=Symbol.for("react.suspense"),Od=Symbol.for("react.suspense_list"),Eh=Symbol.for("react.memo"),Br=Symbol.for("react.lazy"),mv=Symbol.for("react.offscreen"),Om=Symbol.iterator;function ca(e){return e===null||typeof e!="object"?null:(e=Om&&e[Om]||e["@@iterator"],typeof e=="function"?e:null)}var yt=Object.assign,ku;function Ea(e){if(ku===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ku=t&&t[1]||""}return`
34
+ `+ku+e}var Su=!1;function ju(e,t){if(!e||Su)return"";Su=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
35
+ `),i=r.stack.split(`
36
+ `),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
37
+ `+s[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Su=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ea(e):""}function wj(e){switch(e.tag){case 5:return Ea(e.type);case 16:return Ea("Lazy");case 13:return Ea("Suspense");case 19:return Ea("SuspenseList");case 0:case 2:case 15:return e=ju(e.type,!1),e;case 11:return e=ju(e.type.render,!1),e;case 1:return e=ju(e.type,!0),e;default:return""}}function zd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case fi:return"Fragment";case di:return"Portal";case _d:return"Profiler";case Nh:return"StrictMode";case Fd:return"Suspense";case Od:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case pv:return(e.displayName||"Context")+".Consumer";case hv:return(e._context.displayName||"Context")+".Provider";case Ch:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Eh:return t=e.displayName||null,t!==null?t:zd(e.type)||"Memo";case Br:t=e._payload,e=e._init;try{return zd(e(t))}catch{}}return null}function kj(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return zd(t);case 8:return t===Nh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function is(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Sj(e){var t=gv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Jo(e){e._valueTracker||(e._valueTracker=Sj(e))}function xv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=gv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ql(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Vd(e,t){var n=t.checked;return yt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function zm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=is(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function yv(e,t){t=t.checked,t!=null&&jh(e,"checked",t,!1)}function Bd(e,t){yv(e,t);var n=is(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ud(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ud(e,t.type,is(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Vm(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ud(e,t,n){(t!=="number"||ql(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ta=Array.isArray;function Ti(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+is(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function $d(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ae(91));return yt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Bm(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ae(92));if(Ta(n)){if(1<n.length)throw Error(ae(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:is(n)}}function vv(e,t){var n=is(t.value),r=is(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Um(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function bv(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Hd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?bv(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Zo,wv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Zo=Zo||document.createElement("div"),Zo.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Zo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ja(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ra={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},jj=["Webkit","ms","Moz","O"];Object.keys(Ra).forEach(function(e){jj.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ra[t]=Ra[e]})});function kv(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ra.hasOwnProperty(e)&&Ra[e]?(""+t).trim():t+"px"}function Sv(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=kv(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var Nj=yt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Wd(e,t){if(t){if(Nj[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ae(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ae(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ae(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ae(62))}}function Kd(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Gd=null;function Th(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qd=null,Pi=null,Ai=null;function $m(e){if(e=Io(e)){if(typeof qd!="function")throw Error(ae(280));var t=e.stateNode;t&&(t=zc(t),qd(e.stateNode,e.type,t))}}function jv(e){Pi?Ai?Ai.push(e):Ai=[e]:Pi=e}function Nv(){if(Pi){var e=Pi,t=Ai;if(Ai=Pi=null,$m(e),t)for(e=0;e<t.length;e++)$m(t[e])}}function Cv(e,t){return e(t)}function Ev(){}var Nu=!1;function Tv(e,t,n){if(Nu)return e(t,n);Nu=!0;try{return Cv(e,t,n)}finally{Nu=!1,(Pi!==null||Ai!==null)&&(Ev(),Nv())}}function Za(e,t){var n=e.stateNode;if(n===null)return null;var r=zc(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ae(231,t,typeof n));return n}var Yd=!1;if(jr)try{var ua={};Object.defineProperty(ua,"passive",{get:function(){Yd=!0}}),window.addEventListener("test",ua,ua),window.removeEventListener("test",ua,ua)}catch{Yd=!1}function Cj(e,t,n,r,s,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(f){this.onError(f)}}var _a=!1,Yl=null,Xl=!1,Xd=null,Ej={onError:function(e){_a=!0,Yl=e}};function Tj(e,t,n,r,s,i,o,l,c){_a=!1,Yl=null,Cj.apply(Ej,arguments)}function Pj(e,t,n,r,s,i,o,l,c){if(Tj.apply(this,arguments),_a){if(_a){var u=Yl;_a=!1,Yl=null}else throw Error(ae(198));Xl||(Xl=!0,Xd=u)}}function Zs(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Pv(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Hm(e){if(Zs(e)!==e)throw Error(ae(188))}function Aj(e){var t=e.alternate;if(!t){if(t=Zs(e),t===null)throw Error(ae(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Hm(s),e;if(i===r)return Hm(s),t;i=i.sibling}throw Error(ae(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(ae(189))}}if(n.alternate!==r)throw Error(ae(190))}if(n.tag!==3)throw Error(ae(188));return n.stateNode.current===n?e:t}function Av(e){return e=Aj(e),e!==null?Dv(e):null}function Dv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Dv(e);if(t!==null)return t;e=e.sibling}return null}var Lv=Nn.unstable_scheduleCallback,Wm=Nn.unstable_cancelCallback,Dj=Nn.unstable_shouldYield,Lj=Nn.unstable_requestPaint,Ct=Nn.unstable_now,Mj=Nn.unstable_getCurrentPriorityLevel,Ph=Nn.unstable_ImmediatePriority,Mv=Nn.unstable_UserBlockingPriority,Ql=Nn.unstable_NormalPriority,Ij=Nn.unstable_LowPriority,Iv=Nn.unstable_IdlePriority,Rc=null,ar=null;function Rj(e){if(ar&&typeof ar.onCommitFiberRoot=="function")try{ar.onCommitFiberRoot(Rc,e,void 0,(e.current.flags&128)===128)}catch{}}var Gn=Math.clz32?Math.clz32:Oj,_j=Math.log,Fj=Math.LN2;function Oj(e){return e>>>=0,e===0?32:31-(_j(e)/Fj|0)|0}var el=64,tl=4194304;function Pa(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Jl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=Pa(l):(i&=o,i!==0&&(r=Pa(i)))}else o=n&~s,o!==0?r=Pa(o):i!==0&&(r=Pa(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Gn(t),s=1<<n,r|=e[n],t&=~s;return r}function zj(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vj(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-Gn(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=zj(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Qd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Rv(){var e=el;return el<<=1,!(el&4194240)&&(el=64),e}function Cu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Lo(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Gn(t),e[t]=n}function Bj(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-Gn(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Ah(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Gn(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Qe=0;function _v(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Fv,Dh,Ov,zv,Vv,Jd=!1,nl=[],Yr=null,Xr=null,Qr=null,eo=new Map,to=new Map,$r=[],Uj="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Km(e,t){switch(e){case"focusin":case"focusout":Yr=null;break;case"dragenter":case"dragleave":Xr=null;break;case"mouseover":case"mouseout":Qr=null;break;case"pointerover":case"pointerout":eo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":to.delete(t.pointerId)}}function da(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Io(t),t!==null&&Dh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function $j(e,t,n,r,s){switch(t){case"focusin":return Yr=da(Yr,e,t,n,r,s),!0;case"dragenter":return Xr=da(Xr,e,t,n,r,s),!0;case"mouseover":return Qr=da(Qr,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return eo.set(i,da(eo.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,to.set(i,da(to.get(i)||null,e,t,n,r,s)),!0}return!1}function Bv(e){var t=Ds(e.target);if(t!==null){var n=Zs(t);if(n!==null){if(t=n.tag,t===13){if(t=Pv(n),t!==null){e.blockedOn=t,Vv(e.priority,function(){Ov(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Al(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Zd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Gd=r,n.target.dispatchEvent(r),Gd=null}else return t=Io(n),t!==null&&Dh(t),e.blockedOn=n,!1;t.shift()}return!0}function Gm(e,t,n){Al(e)&&n.delete(t)}function Hj(){Jd=!1,Yr!==null&&Al(Yr)&&(Yr=null),Xr!==null&&Al(Xr)&&(Xr=null),Qr!==null&&Al(Qr)&&(Qr=null),eo.forEach(Gm),to.forEach(Gm)}function fa(e,t){e.blockedOn===t&&(e.blockedOn=null,Jd||(Jd=!0,Nn.unstable_scheduleCallback(Nn.unstable_NormalPriority,Hj)))}function no(e){function t(s){return fa(s,e)}if(0<nl.length){fa(nl[0],e);for(var n=1;n<nl.length;n++){var r=nl[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Yr!==null&&fa(Yr,e),Xr!==null&&fa(Xr,e),Qr!==null&&fa(Qr,e),eo.forEach(t),to.forEach(t),n=0;n<$r.length;n++)r=$r[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<$r.length&&(n=$r[0],n.blockedOn===null);)Bv(n),n.blockedOn===null&&$r.shift()}var Di=Ar.ReactCurrentBatchConfig,Zl=!0;function Wj(e,t,n,r){var s=Qe,i=Di.transition;Di.transition=null;try{Qe=1,Lh(e,t,n,r)}finally{Qe=s,Di.transition=i}}function Kj(e,t,n,r){var s=Qe,i=Di.transition;Di.transition=null;try{Qe=4,Lh(e,t,n,r)}finally{Qe=s,Di.transition=i}}function Lh(e,t,n,r){if(Zl){var s=Zd(e,t,n,r);if(s===null)_u(e,t,r,ec,n),Km(e,r);else if($j(s,e,t,n,r))r.stopPropagation();else if(Km(e,r),t&4&&-1<Uj.indexOf(e)){for(;s!==null;){var i=Io(s);if(i!==null&&Fv(i),i=Zd(e,t,n,r),i===null&&_u(e,t,r,ec,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else _u(e,t,r,null,n)}}var ec=null;function Zd(e,t,n,r){if(ec=null,e=Th(r),e=Ds(e),e!==null)if(t=Zs(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Pv(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return ec=e,null}function Uv(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Mj()){case Ph:return 1;case Mv:return 4;case Ql:case Ij:return 16;case Iv:return 536870912;default:return 16}default:return 16}}var Wr=null,Mh=null,Dl=null;function $v(){if(Dl)return Dl;var e,t=Mh,n=t.length,r,s="value"in Wr?Wr.value:Wr.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return Dl=s.slice(e,1<r?1-r:void 0)}function Ll(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function rl(){return!0}function qm(){return!1}function Tn(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?rl:qm,this.isPropagationStopped=qm,this}return yt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=rl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=rl)},persist:function(){},isPersistent:rl}),t}var Zi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ih=Tn(Zi),Mo=yt({},Zi,{view:0,detail:0}),Gj=Tn(Mo),Eu,Tu,ha,_c=yt({},Mo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rh,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ha&&(ha&&e.type==="mousemove"?(Eu=e.screenX-ha.screenX,Tu=e.screenY-ha.screenY):Tu=Eu=0,ha=e),Eu)},movementY:function(e){return"movementY"in e?e.movementY:Tu}}),Ym=Tn(_c),qj=yt({},_c,{dataTransfer:0}),Yj=Tn(qj),Xj=yt({},Mo,{relatedTarget:0}),Pu=Tn(Xj),Qj=yt({},Zi,{animationName:0,elapsedTime:0,pseudoElement:0}),Jj=Tn(Qj),Zj=yt({},Zi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),e2=Tn(Zj),t2=yt({},Zi,{data:0}),Xm=Tn(t2),n2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},r2={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},s2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function i2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=s2[e])?!!t[e]:!1}function Rh(){return i2}var a2=yt({},Mo,{key:function(e){if(e.key){var t=n2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ll(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?r2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rh,charCode:function(e){return e.type==="keypress"?Ll(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ll(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),o2=Tn(a2),l2=yt({},_c,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qm=Tn(l2),c2=yt({},Mo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rh}),u2=Tn(c2),d2=yt({},Zi,{propertyName:0,elapsedTime:0,pseudoElement:0}),f2=Tn(d2),h2=yt({},_c,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),p2=Tn(h2),m2=[9,13,27,32],_h=jr&&"CompositionEvent"in window,Fa=null;jr&&"documentMode"in document&&(Fa=document.documentMode);var g2=jr&&"TextEvent"in window&&!Fa,Hv=jr&&(!_h||Fa&&8<Fa&&11>=Fa),Jm=" ",Zm=!1;function Wv(e,t){switch(e){case"keyup":return m2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kv(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var hi=!1;function x2(e,t){switch(e){case"compositionend":return Kv(t);case"keypress":return t.which!==32?null:(Zm=!0,Jm);case"textInput":return e=t.data,e===Jm&&Zm?null:e;default:return null}}function y2(e,t){if(hi)return e==="compositionend"||!_h&&Wv(e,t)?(e=$v(),Dl=Mh=Wr=null,hi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Hv&&t.locale!=="ko"?null:t.data;default:return null}}var v2={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function eg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!v2[e.type]:t==="textarea"}function Gv(e,t,n,r){jv(r),t=tc(t,"onChange"),0<t.length&&(n=new Ih("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Oa=null,ro=null;function b2(e){sb(e,0)}function Fc(e){var t=gi(e);if(xv(t))return e}function w2(e,t){if(e==="change")return t}var qv=!1;if(jr){var Au;if(jr){var Du="oninput"in document;if(!Du){var tg=document.createElement("div");tg.setAttribute("oninput","return;"),Du=typeof tg.oninput=="function"}Au=Du}else Au=!1;qv=Au&&(!document.documentMode||9<document.documentMode)}function ng(){Oa&&(Oa.detachEvent("onpropertychange",Yv),ro=Oa=null)}function Yv(e){if(e.propertyName==="value"&&Fc(ro)){var t=[];Gv(t,ro,e,Th(e)),Tv(b2,t)}}function k2(e,t,n){e==="focusin"?(ng(),Oa=t,ro=n,Oa.attachEvent("onpropertychange",Yv)):e==="focusout"&&ng()}function S2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Fc(ro)}function j2(e,t){if(e==="click")return Fc(t)}function N2(e,t){if(e==="input"||e==="change")return Fc(t)}function C2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Qn=typeof Object.is=="function"?Object.is:C2;function so(e,t){if(Qn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!Rd.call(t,s)||!Qn(e[s],t[s]))return!1}return!0}function rg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sg(e,t){var n=rg(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=rg(n)}}function Xv(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Xv(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qv(){for(var e=window,t=ql();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ql(e.document)}return t}function Fh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function E2(e){var t=Qv(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Xv(n.ownerDocument.documentElement,n)){if(r!==null&&Fh(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=sg(n,i);var o=sg(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var T2=jr&&"documentMode"in document&&11>=document.documentMode,pi=null,ef=null,za=null,tf=!1;function ig(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;tf||pi==null||pi!==ql(r)||(r=pi,"selectionStart"in r&&Fh(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),za&&so(za,r)||(za=r,r=tc(ef,"onSelect"),0<r.length&&(t=new Ih("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=pi)))}function sl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var mi={animationend:sl("Animation","AnimationEnd"),animationiteration:sl("Animation","AnimationIteration"),animationstart:sl("Animation","AnimationStart"),transitionend:sl("Transition","TransitionEnd")},Lu={},Jv={};jr&&(Jv=document.createElement("div").style,"AnimationEvent"in window||(delete mi.animationend.animation,delete mi.animationiteration.animation,delete mi.animationstart.animation),"TransitionEvent"in window||delete mi.transitionend.transition);function Oc(e){if(Lu[e])return Lu[e];if(!mi[e])return e;var t=mi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Jv)return Lu[e]=t[n];return e}var Zv=Oc("animationend"),eb=Oc("animationiteration"),tb=Oc("animationstart"),nb=Oc("transitionend"),rb=new Map,ag="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ds(e,t){rb.set(e,t),Js(t,[e])}for(var Mu=0;Mu<ag.length;Mu++){var Iu=ag[Mu],P2=Iu.toLowerCase(),A2=Iu[0].toUpperCase()+Iu.slice(1);ds(P2,"on"+A2)}ds(Zv,"onAnimationEnd");ds(eb,"onAnimationIteration");ds(tb,"onAnimationStart");ds("dblclick","onDoubleClick");ds("focusin","onFocus");ds("focusout","onBlur");ds(nb,"onTransitionEnd");_i("onMouseEnter",["mouseout","mouseover"]);_i("onMouseLeave",["mouseout","mouseover"]);_i("onPointerEnter",["pointerout","pointerover"]);_i("onPointerLeave",["pointerout","pointerover"]);Js("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Js("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Js("onBeforeInput",["compositionend","keypress","textInput","paste"]);Js("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Js("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Js("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Aa="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),D2=new Set("cancel close invalid load scroll toggle".split(" ").concat(Aa));function og(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Pj(r,t,void 0,e),e.currentTarget=null}function sb(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;og(s,l,u),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;og(s,l,u),i=c}}}if(Xl)throw e=Xd,Xl=!1,Xd=null,e}function ct(e,t){var n=t[of];n===void 0&&(n=t[of]=new Set);var r=e+"__bubble";n.has(r)||(ib(t,e,2,!1),n.add(r))}function Ru(e,t,n){var r=0;t&&(r|=4),ib(n,e,r,t)}var il="_reactListening"+Math.random().toString(36).slice(2);function io(e){if(!e[il]){e[il]=!0,fv.forEach(function(n){n!=="selectionchange"&&(D2.has(n)||Ru(n,!1,e),Ru(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[il]||(t[il]=!0,Ru("selectionchange",!1,t))}}function ib(e,t,n,r){switch(Uv(t)){case 1:var s=Wj;break;case 4:s=Kj;break;default:s=Lh}n=s.bind(null,t,n,e),s=void 0,!Yd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function _u(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=Ds(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}Tv(function(){var u=i,f=Th(n),d=[];e:{var h=rb.get(e);if(h!==void 0){var p=Ih,x=e;switch(e){case"keypress":if(Ll(n)===0)break e;case"keydown":case"keyup":p=o2;break;case"focusin":x="focus",p=Pu;break;case"focusout":x="blur",p=Pu;break;case"beforeblur":case"afterblur":p=Pu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Ym;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Yj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=u2;break;case Zv:case eb:case tb:p=Jj;break;case nb:p=f2;break;case"scroll":p=Gj;break;case"wheel":p=p2;break;case"copy":case"cut":case"paste":p=e2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Qm}var b=(t&4)!==0,k=!b&&e==="scroll",v=b?h!==null?h+"Capture":null:h;b=[];for(var m=u,y;m!==null;){y=m;var j=y.stateNode;if(y.tag===5&&j!==null&&(y=j,v!==null&&(j=Za(m,v),j!=null&&b.push(ao(m,j,y)))),k)break;m=m.return}0<b.length&&(h=new p(h,x,null,n,f),d.push({event:h,listeners:b}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==Gd&&(x=n.relatedTarget||n.fromElement)&&(Ds(x)||x[Nr]))break e;if((p||h)&&(h=f.window===f?f:(h=f.ownerDocument)?h.defaultView||h.parentWindow:window,p?(x=n.relatedTarget||n.toElement,p=u,x=x?Ds(x):null,x!==null&&(k=Zs(x),x!==k||x.tag!==5&&x.tag!==6)&&(x=null)):(p=null,x=u),p!==x)){if(b=Ym,j="onMouseLeave",v="onMouseEnter",m="mouse",(e==="pointerout"||e==="pointerover")&&(b=Qm,j="onPointerLeave",v="onPointerEnter",m="pointer"),k=p==null?h:gi(p),y=x==null?h:gi(x),h=new b(j,m+"leave",p,n,f),h.target=k,h.relatedTarget=y,j=null,Ds(f)===u&&(b=new b(v,m+"enter",x,n,f),b.target=y,b.relatedTarget=k,j=b),k=j,p&&x)t:{for(b=p,v=x,m=0,y=b;y;y=ai(y))m++;for(y=0,j=v;j;j=ai(j))y++;for(;0<m-y;)b=ai(b),m--;for(;0<y-m;)v=ai(v),y--;for(;m--;){if(b===v||v!==null&&b===v.alternate)break t;b=ai(b),v=ai(v)}b=null}else b=null;p!==null&&lg(d,h,p,b,!1),x!==null&&k!==null&&lg(d,k,x,b,!0)}}e:{if(h=u?gi(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var S=w2;else if(eg(h))if(qv)S=N2;else{S=S2;var N=k2}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=j2);if(S&&(S=S(e,u))){Gv(d,S,n,f);break e}N&&N(e,h,u),e==="focusout"&&(N=h._wrapperState)&&N.controlled&&h.type==="number"&&Ud(h,"number",h.value)}switch(N=u?gi(u):window,e){case"focusin":(eg(N)||N.contentEditable==="true")&&(pi=N,ef=u,za=null);break;case"focusout":za=ef=pi=null;break;case"mousedown":tf=!0;break;case"contextmenu":case"mouseup":case"dragend":tf=!1,ig(d,n,f);break;case"selectionchange":if(T2)break;case"keydown":case"keyup":ig(d,n,f)}var w;if(_h)e:{switch(e){case"compositionstart":var C="onCompositionStart";break e;case"compositionend":C="onCompositionEnd";break e;case"compositionupdate":C="onCompositionUpdate";break e}C=void 0}else hi?Wv(e,n)&&(C="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(C="onCompositionStart");C&&(Hv&&n.locale!=="ko"&&(hi||C!=="onCompositionStart"?C==="onCompositionEnd"&&hi&&(w=$v()):(Wr=f,Mh="value"in Wr?Wr.value:Wr.textContent,hi=!0)),N=tc(u,C),0<N.length&&(C=new Xm(C,e,null,n,f),d.push({event:C,listeners:N}),w?C.data=w:(w=Kv(n),w!==null&&(C.data=w)))),(w=g2?x2(e,n):y2(e,n))&&(u=tc(u,"onBeforeInput"),0<u.length&&(f=new Xm("onBeforeInput","beforeinput",null,n,f),d.push({event:f,listeners:u}),f.data=w))}sb(d,t)})}function ao(e,t,n){return{instance:e,listener:t,currentTarget:n}}function tc(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Za(e,n),i!=null&&r.unshift(ao(e,i,s)),i=Za(e,t),i!=null&&r.push(ao(e,i,s))),e=e.return}return r}function ai(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function lg(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=Za(n,i),c!=null&&o.unshift(ao(n,c,l))):s||(c=Za(n,i),c!=null&&o.push(ao(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var L2=/\r\n?/g,M2=/\u0000|\uFFFD/g;function cg(e){return(typeof e=="string"?e:""+e).replace(L2,`
38
+ `).replace(M2,"")}function al(e,t,n){if(t=cg(t),cg(e)!==t&&n)throw Error(ae(425))}function nc(){}var nf=null,rf=null;function sf(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var af=typeof setTimeout=="function"?setTimeout:void 0,I2=typeof clearTimeout=="function"?clearTimeout:void 0,ug=typeof Promise=="function"?Promise:void 0,R2=typeof queueMicrotask=="function"?queueMicrotask:typeof ug<"u"?function(e){return ug.resolve(null).then(e).catch(_2)}:af;function _2(e){setTimeout(function(){throw e})}function Fu(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),no(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);no(t)}function Jr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function dg(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var ea=Math.random().toString(36).slice(2),ir="__reactFiber$"+ea,oo="__reactProps$"+ea,Nr="__reactContainer$"+ea,of="__reactEvents$"+ea,F2="__reactListeners$"+ea,O2="__reactHandles$"+ea;function Ds(e){var t=e[ir];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Nr]||n[ir]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=dg(e);e!==null;){if(n=e[ir])return n;e=dg(e)}return t}e=n,n=e.parentNode}return null}function Io(e){return e=e[ir]||e[Nr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function gi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ae(33))}function zc(e){return e[oo]||null}var lf=[],xi=-1;function fs(e){return{current:e}}function ut(e){0>xi||(e.current=lf[xi],lf[xi]=null,xi--)}function st(e,t){xi++,lf[xi]=e.current,e.current=t}var as={},Zt=fs(as),fn=fs(!1),Us=as;function Fi(e,t){var n=e.type.contextTypes;if(!n)return as;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function hn(e){return e=e.childContextTypes,e!=null}function rc(){ut(fn),ut(Zt)}function fg(e,t,n){if(Zt.current!==as)throw Error(ae(168));st(Zt,t),st(fn,n)}function ab(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(ae(108,kj(e)||"Unknown",s));return yt({},n,r)}function sc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||as,Us=Zt.current,st(Zt,e),st(fn,fn.current),!0}function hg(e,t,n){var r=e.stateNode;if(!r)throw Error(ae(169));n?(e=ab(e,t,Us),r.__reactInternalMemoizedMergedChildContext=e,ut(fn),ut(Zt),st(Zt,e)):ut(fn),st(fn,n)}var xr=null,Vc=!1,Ou=!1;function ob(e){xr===null?xr=[e]:xr.push(e)}function z2(e){Vc=!0,ob(e)}function hs(){if(!Ou&&xr!==null){Ou=!0;var e=0,t=Qe;try{var n=xr;for(Qe=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}xr=null,Vc=!1}catch(s){throw xr!==null&&(xr=xr.slice(e+1)),Lv(Ph,hs),s}finally{Qe=t,Ou=!1}}return null}var yi=[],vi=0,ic=null,ac=0,Ln=[],Mn=0,$s=null,yr=1,vr="";function js(e,t){yi[vi++]=ac,yi[vi++]=ic,ic=e,ac=t}function lb(e,t,n){Ln[Mn++]=yr,Ln[Mn++]=vr,Ln[Mn++]=$s,$s=e;var r=yr;e=vr;var s=32-Gn(r)-1;r&=~(1<<s),n+=1;var i=32-Gn(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,yr=1<<32-Gn(t)+s|n<<s|r,vr=i+e}else yr=1<<i|n<<s|r,vr=e}function Oh(e){e.return!==null&&(js(e,1),lb(e,1,0))}function zh(e){for(;e===ic;)ic=yi[--vi],yi[vi]=null,ac=yi[--vi],yi[vi]=null;for(;e===$s;)$s=Ln[--Mn],Ln[Mn]=null,vr=Ln[--Mn],Ln[Mn]=null,yr=Ln[--Mn],Ln[Mn]=null}var wn=null,bn=null,ht=!1,Kn=null;function cb(e,t){var n=Rn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function pg(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,wn=e,bn=Jr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,wn=e,bn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=$s!==null?{id:yr,overflow:vr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Rn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,wn=e,bn=null,!0):!1;default:return!1}}function cf(e){return(e.mode&1)!==0&&(e.flags&128)===0}function uf(e){if(ht){var t=bn;if(t){var n=t;if(!pg(e,t)){if(cf(e))throw Error(ae(418));t=Jr(n.nextSibling);var r=wn;t&&pg(e,t)?cb(r,n):(e.flags=e.flags&-4097|2,ht=!1,wn=e)}}else{if(cf(e))throw Error(ae(418));e.flags=e.flags&-4097|2,ht=!1,wn=e}}}function mg(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;wn=e}function ol(e){if(e!==wn)return!1;if(!ht)return mg(e),ht=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!sf(e.type,e.memoizedProps)),t&&(t=bn)){if(cf(e))throw ub(),Error(ae(418));for(;t;)cb(e,t),t=Jr(t.nextSibling)}if(mg(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ae(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){bn=Jr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}bn=null}}else bn=wn?Jr(e.stateNode.nextSibling):null;return!0}function ub(){for(var e=bn;e;)e=Jr(e.nextSibling)}function Oi(){bn=wn=null,ht=!1}function Vh(e){Kn===null?Kn=[e]:Kn.push(e)}var V2=Ar.ReactCurrentBatchConfig;function pa(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ae(309));var r=n.stateNode}if(!r)throw Error(ae(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(ae(284));if(!n._owner)throw Error(ae(290,e))}return e}function ll(e,t){throw e=Object.prototype.toString.call(t),Error(ae(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function gg(e){var t=e._init;return t(e._payload)}function db(e){function t(v,m){if(e){var y=v.deletions;y===null?(v.deletions=[m],v.flags|=16):y.push(m)}}function n(v,m){if(!e)return null;for(;m!==null;)t(v,m),m=m.sibling;return null}function r(v,m){for(v=new Map;m!==null;)m.key!==null?v.set(m.key,m):v.set(m.index,m),m=m.sibling;return v}function s(v,m){return v=ns(v,m),v.index=0,v.sibling=null,v}function i(v,m,y){return v.index=y,e?(y=v.alternate,y!==null?(y=y.index,y<m?(v.flags|=2,m):y):(v.flags|=2,m)):(v.flags|=1048576,m)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,m,y,j){return m===null||m.tag!==6?(m=Wu(y,v.mode,j),m.return=v,m):(m=s(m,y),m.return=v,m)}function c(v,m,y,j){var S=y.type;return S===fi?f(v,m,y.props.children,j,y.key):m!==null&&(m.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Br&&gg(S)===m.type)?(j=s(m,y.props),j.ref=pa(v,m,y),j.return=v,j):(j=zl(y.type,y.key,y.props,null,v.mode,j),j.ref=pa(v,m,y),j.return=v,j)}function u(v,m,y,j){return m===null||m.tag!==4||m.stateNode.containerInfo!==y.containerInfo||m.stateNode.implementation!==y.implementation?(m=Ku(y,v.mode,j),m.return=v,m):(m=s(m,y.children||[]),m.return=v,m)}function f(v,m,y,j,S){return m===null||m.tag!==7?(m=Os(y,v.mode,j,S),m.return=v,m):(m=s(m,y),m.return=v,m)}function d(v,m,y){if(typeof m=="string"&&m!==""||typeof m=="number")return m=Wu(""+m,v.mode,y),m.return=v,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case Qo:return y=zl(m.type,m.key,m.props,null,v.mode,y),y.ref=pa(v,null,m),y.return=v,y;case di:return m=Ku(m,v.mode,y),m.return=v,m;case Br:var j=m._init;return d(v,j(m._payload),y)}if(Ta(m)||ca(m))return m=Os(m,v.mode,y,null),m.return=v,m;ll(v,m)}return null}function h(v,m,y,j){var S=m!==null?m.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return S!==null?null:l(v,m,""+y,j);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Qo:return y.key===S?c(v,m,y,j):null;case di:return y.key===S?u(v,m,y,j):null;case Br:return S=y._init,h(v,m,S(y._payload),j)}if(Ta(y)||ca(y))return S!==null?null:f(v,m,y,j,null);ll(v,y)}return null}function p(v,m,y,j,S){if(typeof j=="string"&&j!==""||typeof j=="number")return v=v.get(y)||null,l(m,v,""+j,S);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Qo:return v=v.get(j.key===null?y:j.key)||null,c(m,v,j,S);case di:return v=v.get(j.key===null?y:j.key)||null,u(m,v,j,S);case Br:var N=j._init;return p(v,m,y,N(j._payload),S)}if(Ta(j)||ca(j))return v=v.get(y)||null,f(m,v,j,S,null);ll(m,j)}return null}function x(v,m,y,j){for(var S=null,N=null,w=m,C=m=0,D=null;w!==null&&C<y.length;C++){w.index>C?(D=w,w=null):D=w.sibling;var T=h(v,w,y[C],j);if(T===null){w===null&&(w=D);break}e&&w&&T.alternate===null&&t(v,w),m=i(T,m,C),N===null?S=T:N.sibling=T,N=T,w=D}if(C===y.length)return n(v,w),ht&&js(v,C),S;if(w===null){for(;C<y.length;C++)w=d(v,y[C],j),w!==null&&(m=i(w,m,C),N===null?S=w:N.sibling=w,N=w);return ht&&js(v,C),S}for(w=r(v,w);C<y.length;C++)D=p(w,v,C,y[C],j),D!==null&&(e&&D.alternate!==null&&w.delete(D.key===null?C:D.key),m=i(D,m,C),N===null?S=D:N.sibling=D,N=D);return e&&w.forEach(function(M){return t(v,M)}),ht&&js(v,C),S}function b(v,m,y,j){var S=ca(y);if(typeof S!="function")throw Error(ae(150));if(y=S.call(y),y==null)throw Error(ae(151));for(var N=S=null,w=m,C=m=0,D=null,T=y.next();w!==null&&!T.done;C++,T=y.next()){w.index>C?(D=w,w=null):D=w.sibling;var M=h(v,w,T.value,j);if(M===null){w===null&&(w=D);break}e&&w&&M.alternate===null&&t(v,w),m=i(M,m,C),N===null?S=M:N.sibling=M,N=M,w=D}if(T.done)return n(v,w),ht&&js(v,C),S;if(w===null){for(;!T.done;C++,T=y.next())T=d(v,T.value,j),T!==null&&(m=i(T,m,C),N===null?S=T:N.sibling=T,N=T);return ht&&js(v,C),S}for(w=r(v,w);!T.done;C++,T=y.next())T=p(w,v,C,T.value,j),T!==null&&(e&&T.alternate!==null&&w.delete(T.key===null?C:T.key),m=i(T,m,C),N===null?S=T:N.sibling=T,N=T);return e&&w.forEach(function(P){return t(v,P)}),ht&&js(v,C),S}function k(v,m,y,j){if(typeof y=="object"&&y!==null&&y.type===fi&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Qo:e:{for(var S=y.key,N=m;N!==null;){if(N.key===S){if(S=y.type,S===fi){if(N.tag===7){n(v,N.sibling),m=s(N,y.props.children),m.return=v,v=m;break e}}else if(N.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Br&&gg(S)===N.type){n(v,N.sibling),m=s(N,y.props),m.ref=pa(v,N,y),m.return=v,v=m;break e}n(v,N);break}else t(v,N);N=N.sibling}y.type===fi?(m=Os(y.props.children,v.mode,j,y.key),m.return=v,v=m):(j=zl(y.type,y.key,y.props,null,v.mode,j),j.ref=pa(v,m,y),j.return=v,v=j)}return o(v);case di:e:{for(N=y.key;m!==null;){if(m.key===N)if(m.tag===4&&m.stateNode.containerInfo===y.containerInfo&&m.stateNode.implementation===y.implementation){n(v,m.sibling),m=s(m,y.children||[]),m.return=v,v=m;break e}else{n(v,m);break}else t(v,m);m=m.sibling}m=Ku(y,v.mode,j),m.return=v,v=m}return o(v);case Br:return N=y._init,k(v,m,N(y._payload),j)}if(Ta(y))return x(v,m,y,j);if(ca(y))return b(v,m,y,j);ll(v,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,m!==null&&m.tag===6?(n(v,m.sibling),m=s(m,y),m.return=v,v=m):(n(v,m),m=Wu(y,v.mode,j),m.return=v,v=m),o(v)):n(v,m)}return k}var zi=db(!0),fb=db(!1),oc=fs(null),lc=null,bi=null,Bh=null;function Uh(){Bh=bi=lc=null}function $h(e){var t=oc.current;ut(oc),e._currentValue=t}function df(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Li(e,t){lc=e,Bh=bi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(dn=!0),e.firstContext=null)}function On(e){var t=e._currentValue;if(Bh!==e)if(e={context:e,memoizedValue:t,next:null},bi===null){if(lc===null)throw Error(ae(308));bi=e,lc.dependencies={lanes:0,firstContext:e}}else bi=bi.next=e;return t}var Ls=null;function Hh(e){Ls===null?Ls=[e]:Ls.push(e)}function hb(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Hh(t)):(n.next=s.next,s.next=n),t.interleaved=n,Cr(e,r)}function Cr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ur=!1;function Wh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pb(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function br(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,We&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Cr(e,n)}return s=r.interleaved,s===null?(t.next=t,Hh(r)):(t.next=s.next,s.next=t),r.interleaved=t,Cr(e,n)}function Ml(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ah(e,n)}}function xg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function cc(e,t,n,r){var s=e.updateQueue;Ur=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==o&&(l===null?f.firstBaseUpdate=u:l.next=u,f.lastBaseUpdate=c))}if(i!==null){var d=s.baseState;o=0,f=u=c=null,l=i;do{var h=l.lane,p=l.eventTime;if((r&h)===h){f!==null&&(f=f.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,b=l;switch(h=t,p=n,b.tag){case 1:if(x=b.payload,typeof x=="function"){d=x.call(p,d,h);break e}d=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=b.payload,h=typeof x=="function"?x.call(p,d,h):x,h==null)break e;d=yt({},d,h);break e;case 2:Ur=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(u=f=p,c=d):f=f.next=p,o|=h;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;h=l,l=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(f===null&&(c=d),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=f,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Ws|=o,e.lanes=o,e.memoizedState=d}}function yg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(ae(191,s));s.call(r)}}}var Ro={},or=fs(Ro),lo=fs(Ro),co=fs(Ro);function Ms(e){if(e===Ro)throw Error(ae(174));return e}function Kh(e,t){switch(st(co,t),st(lo,e),st(or,Ro),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Hd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Hd(t,e)}ut(or),st(or,t)}function Vi(){ut(or),ut(lo),ut(co)}function mb(e){Ms(co.current);var t=Ms(or.current),n=Hd(t,e.type);t!==n&&(st(lo,e),st(or,n))}function Gh(e){lo.current===e&&(ut(or),ut(lo))}var mt=fs(0);function uc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var zu=[];function qh(){for(var e=0;e<zu.length;e++)zu[e]._workInProgressVersionPrimary=null;zu.length=0}var Il=Ar.ReactCurrentDispatcher,Vu=Ar.ReactCurrentBatchConfig,Hs=0,xt=null,Lt=null,_t=null,dc=!1,Va=!1,uo=0,B2=0;function Ht(){throw Error(ae(321))}function Yh(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Qn(e[n],t[n]))return!1;return!0}function Xh(e,t,n,r,s,i){if(Hs=i,xt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Il.current=e===null||e.memoizedState===null?W2:K2,e=n(r,s),Va){i=0;do{if(Va=!1,uo=0,25<=i)throw Error(ae(301));i+=1,_t=Lt=null,t.updateQueue=null,Il.current=G2,e=n(r,s)}while(Va)}if(Il.current=fc,t=Lt!==null&&Lt.next!==null,Hs=0,_t=Lt=xt=null,dc=!1,t)throw Error(ae(300));return e}function Qh(){var e=uo!==0;return uo=0,e}function nr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _t===null?xt.memoizedState=_t=e:_t=_t.next=e,_t}function zn(){if(Lt===null){var e=xt.alternate;e=e!==null?e.memoizedState:null}else e=Lt.next;var t=_t===null?xt.memoizedState:_t.next;if(t!==null)_t=t,Lt=e;else{if(e===null)throw Error(ae(310));Lt=e,e={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},_t===null?xt.memoizedState=_t=e:_t=_t.next=e}return _t}function fo(e,t){return typeof t=="function"?t(e):t}function Bu(e){var t=zn(),n=t.queue;if(n===null)throw Error(ae(311));n.lastRenderedReducer=e;var r=Lt,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,u=i;do{var f=u.lane;if((Hs&f)===f)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:f,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=d,o=r):c=c.next=d,xt.lanes|=f,Ws|=f}u=u.next}while(u!==null&&u!==i);c===null?o=r:c.next=l,Qn(r,t.memoizedState)||(dn=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,xt.lanes|=i,Ws|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Uu(e){var t=zn(),n=t.queue;if(n===null)throw Error(ae(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);Qn(i,t.memoizedState)||(dn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function gb(){}function xb(e,t){var n=xt,r=zn(),s=t(),i=!Qn(r.memoizedState,s);if(i&&(r.memoizedState=s,dn=!0),r=r.queue,Jh(bb.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||_t!==null&&_t.memoizedState.tag&1){if(n.flags|=2048,ho(9,vb.bind(null,n,r,s,t),void 0,null),Ft===null)throw Error(ae(349));Hs&30||yb(n,t,s)}return s}function yb(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=xt.updateQueue,t===null?(t={lastEffect:null,stores:null},xt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function vb(e,t,n,r){t.value=n,t.getSnapshot=r,wb(t)&&kb(e)}function bb(e,t,n){return n(function(){wb(t)&&kb(e)})}function wb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Qn(e,n)}catch{return!0}}function kb(e){var t=Cr(e,1);t!==null&&qn(t,e,1,-1)}function vg(e){var t=nr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:e},t.queue=e,e=e.dispatch=H2.bind(null,xt,e),[t.memoizedState,e]}function ho(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=xt.updateQueue,t===null?(t={lastEffect:null,stores:null},xt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Sb(){return zn().memoizedState}function Rl(e,t,n,r){var s=nr();xt.flags|=e,s.memoizedState=ho(1|t,n,void 0,r===void 0?null:r)}function Bc(e,t,n,r){var s=zn();r=r===void 0?null:r;var i=void 0;if(Lt!==null){var o=Lt.memoizedState;if(i=o.destroy,r!==null&&Yh(r,o.deps)){s.memoizedState=ho(t,n,i,r);return}}xt.flags|=e,s.memoizedState=ho(1|t,n,i,r)}function bg(e,t){return Rl(8390656,8,e,t)}function Jh(e,t){return Bc(2048,8,e,t)}function jb(e,t){return Bc(4,2,e,t)}function Nb(e,t){return Bc(4,4,e,t)}function Cb(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Eb(e,t,n){return n=n!=null?n.concat([e]):null,Bc(4,4,Cb.bind(null,t,e),n)}function Zh(){}function Tb(e,t){var n=zn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Yh(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Pb(e,t){var n=zn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Yh(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ab(e,t,n){return Hs&21?(Qn(n,t)||(n=Rv(),xt.lanes|=n,Ws|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,dn=!0),e.memoizedState=n)}function U2(e,t){var n=Qe;Qe=n!==0&&4>n?n:4,e(!0);var r=Vu.transition;Vu.transition={};try{e(!1),t()}finally{Qe=n,Vu.transition=r}}function Db(){return zn().memoizedState}function $2(e,t,n){var r=ts(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Lb(e))Mb(t,n);else if(n=hb(e,t,n,r),n!==null){var s=sn();qn(n,e,r,s),Ib(n,t,r)}}function H2(e,t,n){var r=ts(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Lb(e))Mb(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Qn(l,o)){var c=t.interleaved;c===null?(s.next=s,Hh(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=hb(e,t,s,r),n!==null&&(s=sn(),qn(n,e,r,s),Ib(n,t,r))}}function Lb(e){var t=e.alternate;return e===xt||t!==null&&t===xt}function Mb(e,t){Va=dc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ib(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ah(e,n)}}var fc={readContext:On,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},W2={readContext:On,useCallback:function(e,t){return nr().memoizedState=[e,t===void 0?null:t],e},useContext:On,useEffect:bg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Rl(4194308,4,Cb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Rl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Rl(4,2,e,t)},useMemo:function(e,t){var n=nr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=nr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=$2.bind(null,xt,e),[r.memoizedState,e]},useRef:function(e){var t=nr();return e={current:e},t.memoizedState=e},useState:vg,useDebugValue:Zh,useDeferredValue:function(e){return nr().memoizedState=e},useTransition:function(){var e=vg(!1),t=e[0];return e=U2.bind(null,e[1]),nr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=xt,s=nr();if(ht){if(n===void 0)throw Error(ae(407));n=n()}else{if(n=t(),Ft===null)throw Error(ae(349));Hs&30||yb(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,bg(bb.bind(null,r,i,e),[e]),r.flags|=2048,ho(9,vb.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=nr(),t=Ft.identifierPrefix;if(ht){var n=vr,r=yr;n=(r&~(1<<32-Gn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=uo++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=B2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},K2={readContext:On,useCallback:Tb,useContext:On,useEffect:Jh,useImperativeHandle:Eb,useInsertionEffect:jb,useLayoutEffect:Nb,useMemo:Pb,useReducer:Bu,useRef:Sb,useState:function(){return Bu(fo)},useDebugValue:Zh,useDeferredValue:function(e){var t=zn();return Ab(t,Lt.memoizedState,e)},useTransition:function(){var e=Bu(fo)[0],t=zn().memoizedState;return[e,t]},useMutableSource:gb,useSyncExternalStore:xb,useId:Db,unstable_isNewReconciler:!1},G2={readContext:On,useCallback:Tb,useContext:On,useEffect:Jh,useImperativeHandle:Eb,useInsertionEffect:jb,useLayoutEffect:Nb,useMemo:Pb,useReducer:Uu,useRef:Sb,useState:function(){return Uu(fo)},useDebugValue:Zh,useDeferredValue:function(e){var t=zn();return Lt===null?t.memoizedState=e:Ab(t,Lt.memoizedState,e)},useTransition:function(){var e=Uu(fo)[0],t=zn().memoizedState;return[e,t]},useMutableSource:gb,useSyncExternalStore:xb,useId:Db,unstable_isNewReconciler:!1};function $n(e,t){if(e&&e.defaultProps){t=yt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function ff(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:yt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Uc={isMounted:function(e){return(e=e._reactInternals)?Zs(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=sn(),s=ts(e),i=br(r,s);i.payload=t,n!=null&&(i.callback=n),t=Zr(e,i,s),t!==null&&(qn(t,e,s,r),Ml(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=sn(),s=ts(e),i=br(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Zr(e,i,s),t!==null&&(qn(t,e,s,r),Ml(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=sn(),r=ts(e),s=br(n,r);s.tag=2,t!=null&&(s.callback=t),t=Zr(e,s,r),t!==null&&(qn(t,e,r,n),Ml(t,e,r))}};function wg(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!so(n,r)||!so(s,i):!0}function Rb(e,t,n){var r=!1,s=as,i=t.contextType;return typeof i=="object"&&i!==null?i=On(i):(s=hn(t)?Us:Zt.current,r=t.contextTypes,i=(r=r!=null)?Fi(e,s):as),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Uc,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function kg(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Uc.enqueueReplaceState(t,t.state,null)}function hf(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Wh(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=On(i):(i=hn(t)?Us:Zt.current,s.context=Fi(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(ff(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Uc.enqueueReplaceState(s,s.state,null),cc(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Bi(e,t){try{var n="",r=t;do n+=wj(r),r=r.return;while(r);var s=n}catch(i){s=`
39
+ Error generating stack: `+i.message+`
40
+ `+i.stack}return{value:e,source:t,stack:s,digest:null}}function $u(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function pf(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var q2=typeof WeakMap=="function"?WeakMap:Map;function _b(e,t,n){n=br(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){pc||(pc=!0,jf=r),pf(e,t)},n}function Fb(e,t,n){n=br(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){pf(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){pf(e,t),typeof r!="function"&&(es===null?es=new Set([this]):es.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Sg(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new q2;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=lN.bind(null,e,t,n),t.then(e,e))}function jg(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Ng(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=br(-1,1),t.tag=2,Zr(n,t,1))),n.lanes|=1),e)}var Y2=Ar.ReactCurrentOwner,dn=!1;function nn(e,t,n,r){t.child=e===null?fb(t,null,n,r):zi(t,e.child,n,r)}function Cg(e,t,n,r,s){n=n.render;var i=t.ref;return Li(t,s),r=Xh(e,t,n,r,i,s),n=Qh(),e!==null&&!dn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Er(e,t,s)):(ht&&n&&Oh(t),t.flags|=1,nn(e,t,r,s),t.child)}function Eg(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!op(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Ob(e,t,i,r,s)):(e=zl(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:so,n(o,r)&&e.ref===t.ref)return Er(e,t,s)}return t.flags|=1,e=ns(i,r),e.ref=t.ref,e.return=t,t.child=e}function Ob(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(so(i,r)&&e.ref===t.ref)if(dn=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(dn=!0);else return t.lanes=e.lanes,Er(e,t,s)}return mf(e,t,n,r,s)}function zb(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},st(ki,yn),yn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,st(ki,yn),yn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,st(ki,yn),yn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,st(ki,yn),yn|=r;return nn(e,t,s,n),t.child}function Vb(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function mf(e,t,n,r,s){var i=hn(n)?Us:Zt.current;return i=Fi(t,i),Li(t,s),n=Xh(e,t,n,r,i,s),r=Qh(),e!==null&&!dn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Er(e,t,s)):(ht&&r&&Oh(t),t.flags|=1,nn(e,t,n,s),t.child)}function Tg(e,t,n,r,s){if(hn(n)){var i=!0;sc(t)}else i=!1;if(Li(t,s),t.stateNode===null)_l(e,t),Rb(t,n,r),hf(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=On(u):(u=hn(n)?Us:Zt.current,u=Fi(t,u));var f=n.getDerivedStateFromProps,d=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==u)&&kg(t,o,r,u),Ur=!1;var h=t.memoizedState;o.state=h,cc(t,r,o,s),c=t.memoizedState,l!==r||h!==c||fn.current||Ur?(typeof f=="function"&&(ff(t,n,f,r),c=t.memoizedState),(l=Ur||wg(t,n,l,r,h,c,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,pb(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:$n(t.type,l),o.props=u,d=t.pendingProps,h=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=On(c):(c=hn(n)?Us:Zt.current,c=Fi(t,c));var p=n.getDerivedStateFromProps;(f=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||h!==c)&&kg(t,o,r,c),Ur=!1,h=t.memoizedState,o.state=h,cc(t,r,o,s);var x=t.memoizedState;l!==d||h!==x||fn.current||Ur?(typeof p=="function"&&(ff(t,n,p,r),x=t.memoizedState),(u=Ur||wg(t,n,u,r,h,x,c)||!1)?(f||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,x,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,x,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),o.props=r,o.state=x,o.context=c,r=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return gf(e,t,n,r,i,s)}function gf(e,t,n,r,s,i){Vb(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&hg(t,n,!1),Er(e,t,i);r=t.stateNode,Y2.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=zi(t,e.child,null,i),t.child=zi(t,null,l,i)):nn(e,t,l,i),t.memoizedState=r.state,s&&hg(t,n,!0),t.child}function Bb(e){var t=e.stateNode;t.pendingContext?fg(e,t.pendingContext,t.pendingContext!==t.context):t.context&&fg(e,t.context,!1),Kh(e,t.containerInfo)}function Pg(e,t,n,r,s){return Oi(),Vh(s),t.flags|=256,nn(e,t,n,r),t.child}var xf={dehydrated:null,treeContext:null,retryLane:0};function yf(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ub(e,t,n){var r=t.pendingProps,s=mt.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),st(mt,s&1),e===null)return uf(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Wc(o,r,0,null),e=Os(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=yf(n),t.memoizedState=xf,e):ep(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return X2(e,t,o,r,l,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=ns(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=ns(l,i):(i=Os(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?yf(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=xf,r}return i=e.child,e=i.sibling,r=ns(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ep(e,t){return t=Wc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function cl(e,t,n,r){return r!==null&&Vh(r),zi(t,e.child,null,n),e=ep(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function X2(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=$u(Error(ae(422))),cl(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Wc({mode:"visible",children:r.children},s,0,null),i=Os(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&zi(t,e.child,null,o),t.child.memoizedState=yf(o),t.memoizedState=xf,i);if(!(t.mode&1))return cl(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(ae(419)),r=$u(i,r,void 0),cl(e,t,o,r)}if(l=(o&e.childLanes)!==0,dn||l){if(r=Ft,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Cr(e,s),qn(r,e,s,-1))}return ap(),r=$u(Error(ae(421))),cl(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=cN.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,bn=Jr(s.nextSibling),wn=t,ht=!0,Kn=null,e!==null&&(Ln[Mn++]=yr,Ln[Mn++]=vr,Ln[Mn++]=$s,yr=e.id,vr=e.overflow,$s=t),t=ep(t,r.children),t.flags|=4096,t)}function Ag(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),df(e.return,t,n)}function Hu(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function $b(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(nn(e,t,r.children,n),r=mt.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ag(e,n,t);else if(e.tag===19)Ag(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(st(mt,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&uc(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Hu(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&uc(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Hu(t,!0,n,null,i);break;case"together":Hu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function _l(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Er(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ws|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ae(153));if(t.child!==null){for(e=t.child,n=ns(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ns(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Q2(e,t,n){switch(t.tag){case 3:Bb(t),Oi();break;case 5:mb(t);break;case 1:hn(t.type)&&sc(t);break;case 4:Kh(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;st(oc,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(st(mt,mt.current&1),t.flags|=128,null):n&t.child.childLanes?Ub(e,t,n):(st(mt,mt.current&1),e=Er(e,t,n),e!==null?e.sibling:null);st(mt,mt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $b(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),st(mt,mt.current),r)break;return null;case 22:case 23:return t.lanes=0,zb(e,t,n)}return Er(e,t,n)}var Hb,vf,Wb,Kb;Hb=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};vf=function(){};Wb=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Ms(or.current);var i=null;switch(n){case"input":s=Vd(e,s),r=Vd(e,r),i=[];break;case"select":s=yt({},s,{value:void 0}),r=yt({},r,{value:void 0}),i=[];break;case"textarea":s=$d(e,s),r=$d(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=nc)}Wd(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Qa.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Qa.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&ct("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};Kb=function(e,t,n,r){n!==r&&(t.flags|=4)};function ma(e,t){if(!ht)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Wt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function J2(e,t,n){var r=t.pendingProps;switch(zh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(t),null;case 1:return hn(t.type)&&rc(),Wt(t),null;case 3:return r=t.stateNode,Vi(),ut(fn),ut(Zt),qh(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ol(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Kn!==null&&(Ef(Kn),Kn=null))),vf(e,t),Wt(t),null;case 5:Gh(t);var s=Ms(co.current);if(n=t.type,e!==null&&t.stateNode!=null)Wb(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ae(166));return Wt(t),null}if(e=Ms(or.current),ol(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ir]=t,r[oo]=i,e=(t.mode&1)!==0,n){case"dialog":ct("cancel",r),ct("close",r);break;case"iframe":case"object":case"embed":ct("load",r);break;case"video":case"audio":for(s=0;s<Aa.length;s++)ct(Aa[s],r);break;case"source":ct("error",r);break;case"img":case"image":case"link":ct("error",r),ct("load",r);break;case"details":ct("toggle",r);break;case"input":zm(r,i),ct("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ct("invalid",r);break;case"textarea":Bm(r,i),ct("invalid",r)}Wd(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&al(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&al(r.textContent,l,e),s=["children",""+l]):Qa.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&ct("scroll",r)}switch(n){case"input":Jo(r),Vm(r,i,!0);break;case"textarea":Jo(r),Um(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=nc)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=bv(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[ir]=t,e[oo]=r,Hb(e,t,!1,!1),t.stateNode=e;e:{switch(o=Kd(n,r),n){case"dialog":ct("cancel",e),ct("close",e),s=r;break;case"iframe":case"object":case"embed":ct("load",e),s=r;break;case"video":case"audio":for(s=0;s<Aa.length;s++)ct(Aa[s],e);s=r;break;case"source":ct("error",e),s=r;break;case"img":case"image":case"link":ct("error",e),ct("load",e),s=r;break;case"details":ct("toggle",e),s=r;break;case"input":zm(e,r),s=Vd(e,r),ct("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=yt({},r,{value:void 0}),ct("invalid",e);break;case"textarea":Bm(e,r),s=$d(e,r),ct("invalid",e);break;default:s=r}Wd(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Sv(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&wv(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ja(e,c):typeof c=="number"&&Ja(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Qa.hasOwnProperty(i)?c!=null&&i==="onScroll"&&ct("scroll",e):c!=null&&jh(e,i,c,o))}switch(n){case"input":Jo(e),Vm(e,r,!1);break;case"textarea":Jo(e),Um(e);break;case"option":r.value!=null&&e.setAttribute("value",""+is(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Ti(e,!!r.multiple,i,!1):r.defaultValue!=null&&Ti(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=nc)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Wt(t),null;case 6:if(e&&t.stateNode!=null)Kb(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ae(166));if(n=Ms(co.current),Ms(or.current),ol(t)){if(r=t.stateNode,n=t.memoizedProps,r[ir]=t,(i=r.nodeValue!==n)&&(e=wn,e!==null))switch(e.tag){case 3:al(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&al(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ir]=t,t.stateNode=r}return Wt(t),null;case 13:if(ut(mt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ht&&bn!==null&&t.mode&1&&!(t.flags&128))ub(),Oi(),t.flags|=98560,i=!1;else if(i=ol(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ae(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ae(317));i[ir]=t}else Oi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wt(t),i=!1}else Kn!==null&&(Ef(Kn),Kn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||mt.current&1?Mt===0&&(Mt=3):ap())),t.updateQueue!==null&&(t.flags|=4),Wt(t),null);case 4:return Vi(),vf(e,t),e===null&&io(t.stateNode.containerInfo),Wt(t),null;case 10:return $h(t.type._context),Wt(t),null;case 17:return hn(t.type)&&rc(),Wt(t),null;case 19:if(ut(mt),i=t.memoizedState,i===null)return Wt(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)ma(i,!1);else{if(Mt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=uc(e),o!==null){for(t.flags|=128,ma(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return st(mt,mt.current&1|2),t.child}e=e.sibling}i.tail!==null&&Ct()>Ui&&(t.flags|=128,r=!0,ma(i,!1),t.lanes=4194304)}else{if(!r)if(e=uc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ma(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ht)return Wt(t),null}else 2*Ct()-i.renderingStartTime>Ui&&n!==1073741824&&(t.flags|=128,r=!0,ma(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ct(),t.sibling=null,n=mt.current,st(mt,r?n&1|2:n&1),t):(Wt(t),null);case 22:case 23:return ip(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?yn&1073741824&&(Wt(t),t.subtreeFlags&6&&(t.flags|=8192)):Wt(t),null;case 24:return null;case 25:return null}throw Error(ae(156,t.tag))}function Z2(e,t){switch(zh(t),t.tag){case 1:return hn(t.type)&&rc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi(),ut(fn),ut(Zt),qh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Gh(t),null;case 13:if(ut(mt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ae(340));Oi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ut(mt),null;case 4:return Vi(),null;case 10:return $h(t.type._context),null;case 22:case 23:return ip(),null;case 24:return null;default:return null}}var ul=!1,Gt=!1,eN=typeof WeakSet=="function"?WeakSet:Set,ge=null;function wi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){kt(e,t,r)}else n.current=null}function bf(e,t,n){try{n()}catch(r){kt(e,t,r)}}var Dg=!1;function tN(e,t){if(nf=Zl,e=Qv(),Fh(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,f=0,d=e,h=null;t:for(;;){for(var p;d!==n||s!==0&&d.nodeType!==3||(l=o+s),d!==i||r!==0&&d.nodeType!==3||(c=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(p=d.firstChild)!==null;)h=d,d=p;for(;;){if(d===e)break t;if(h===n&&++u===s&&(l=o),h===i&&++f===r&&(c=o),(p=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(rf={focusedElem:e,selectionRange:n},Zl=!1,ge=t;ge!==null;)if(t=ge,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ge=e;else for(;ge!==null;){t=ge;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var b=x.memoizedProps,k=x.memoizedState,v=t.stateNode,m=v.getSnapshotBeforeUpdate(t.elementType===t.type?b:$n(t.type,b),k);v.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ae(163))}}catch(j){kt(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,ge=e;break}ge=t.return}return x=Dg,Dg=!1,x}function Ba(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&bf(t,n,i)}s=s.next}while(s!==r)}}function $c(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wf(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Gb(e){var t=e.alternate;t!==null&&(e.alternate=null,Gb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ir],delete t[oo],delete t[of],delete t[F2],delete t[O2])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qb(e){return e.tag===5||e.tag===3||e.tag===4}function Lg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qb(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function kf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=nc));else if(r!==4&&(e=e.child,e!==null))for(kf(e,t,n),e=e.sibling;e!==null;)kf(e,t,n),e=e.sibling}function Sf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Sf(e,t,n),e=e.sibling;e!==null;)Sf(e,t,n),e=e.sibling}var Vt=null,Hn=!1;function Ir(e,t,n){for(n=n.child;n!==null;)Yb(e,t,n),n=n.sibling}function Yb(e,t,n){if(ar&&typeof ar.onCommitFiberUnmount=="function")try{ar.onCommitFiberUnmount(Rc,n)}catch{}switch(n.tag){case 5:Gt||wi(n,t);case 6:var r=Vt,s=Hn;Vt=null,Ir(e,t,n),Vt=r,Hn=s,Vt!==null&&(Hn?(e=Vt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Vt.removeChild(n.stateNode));break;case 18:Vt!==null&&(Hn?(e=Vt,n=n.stateNode,e.nodeType===8?Fu(e.parentNode,n):e.nodeType===1&&Fu(e,n),no(e)):Fu(Vt,n.stateNode));break;case 4:r=Vt,s=Hn,Vt=n.stateNode.containerInfo,Hn=!0,Ir(e,t,n),Vt=r,Hn=s;break;case 0:case 11:case 14:case 15:if(!Gt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&bf(n,t,o),s=s.next}while(s!==r)}Ir(e,t,n);break;case 1:if(!Gt&&(wi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){kt(n,t,l)}Ir(e,t,n);break;case 21:Ir(e,t,n);break;case 22:n.mode&1?(Gt=(r=Gt)||n.memoizedState!==null,Ir(e,t,n),Gt=r):Ir(e,t,n);break;default:Ir(e,t,n)}}function Mg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new eN),t.forEach(function(r){var s=uN.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Bn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Vt=l.stateNode,Hn=!1;break e;case 3:Vt=l.stateNode.containerInfo,Hn=!0;break e;case 4:Vt=l.stateNode.containerInfo,Hn=!0;break e}l=l.return}if(Vt===null)throw Error(ae(160));Yb(i,o,s),Vt=null,Hn=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){kt(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Xb(t,e),t=t.sibling}function Xb(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Bn(t,e),tr(e),r&4){try{Ba(3,e,e.return),$c(3,e)}catch(b){kt(e,e.return,b)}try{Ba(5,e,e.return)}catch(b){kt(e,e.return,b)}}break;case 1:Bn(t,e),tr(e),r&512&&n!==null&&wi(n,n.return);break;case 5:if(Bn(t,e),tr(e),r&512&&n!==null&&wi(n,n.return),e.flags&32){var s=e.stateNode;try{Ja(s,"")}catch(b){kt(e,e.return,b)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&yv(s,i),Kd(l,o);var u=Kd(l,i);for(o=0;o<c.length;o+=2){var f=c[o],d=c[o+1];f==="style"?Sv(s,d):f==="dangerouslySetInnerHTML"?wv(s,d):f==="children"?Ja(s,d):jh(s,f,d,u)}switch(l){case"input":Bd(s,i);break;case"textarea":vv(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Ti(s,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Ti(s,!!i.multiple,i.defaultValue,!0):Ti(s,!!i.multiple,i.multiple?[]:"",!1))}s[oo]=i}catch(b){kt(e,e.return,b)}}break;case 6:if(Bn(t,e),tr(e),r&4){if(e.stateNode===null)throw Error(ae(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(b){kt(e,e.return,b)}}break;case 3:if(Bn(t,e),tr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{no(t.containerInfo)}catch(b){kt(e,e.return,b)}break;case 4:Bn(t,e),tr(e);break;case 13:Bn(t,e),tr(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(rp=Ct())),r&4&&Mg(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Gt=(u=Gt)||f,Bn(t,e),Gt=u):Bn(t,e),tr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!f&&e.mode&1)for(ge=e,f=e.child;f!==null;){for(d=ge=f;ge!==null;){switch(h=ge,p=h.child,h.tag){case 0:case 11:case 14:case 15:Ba(4,h,h.return);break;case 1:wi(h,h.return);var x=h.stateNode;if(typeof x.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(b){kt(r,n,b)}}break;case 5:wi(h,h.return);break;case 22:if(h.memoizedState!==null){Rg(d);continue}}p!==null?(p.return=h,ge=p):Rg(d)}f=f.sibling}e:for(f=null,d=e;;){if(d.tag===5){if(f===null){f=d;try{s=d.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,c=d.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=kv("display",o))}catch(b){kt(e,e.return,b)}}}else if(d.tag===6){if(f===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(b){kt(e,e.return,b)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;f===d&&(f=null),d=d.return}f===d&&(f=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Bn(t,e),tr(e),r&4&&Mg(e);break;case 21:break;default:Bn(t,e),tr(e)}}function tr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(qb(n)){var r=n;break e}n=n.return}throw Error(ae(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Ja(s,""),r.flags&=-33);var i=Lg(e);Sf(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=Lg(e);kf(e,l,o);break;default:throw Error(ae(161))}}catch(c){kt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function nN(e,t,n){ge=e,Qb(e)}function Qb(e,t,n){for(var r=(e.mode&1)!==0;ge!==null;){var s=ge,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||ul;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Gt;l=ul;var u=Gt;if(ul=o,(Gt=c)&&!u)for(ge=s;ge!==null;)o=ge,c=o.child,o.tag===22&&o.memoizedState!==null?_g(s):c!==null?(c.return=o,ge=c):_g(s);for(;i!==null;)ge=i,Qb(i),i=i.sibling;ge=s,ul=l,Gt=u}Ig(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,ge=i):Ig(e)}}function Ig(e){for(;ge!==null;){var t=ge;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Gt||$c(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Gt)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:$n(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&yg(t,i,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}yg(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var f=u.memoizedState;if(f!==null){var d=f.dehydrated;d!==null&&no(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ae(163))}Gt||t.flags&512&&wf(t)}catch(h){kt(t,t.return,h)}}if(t===e){ge=null;break}if(n=t.sibling,n!==null){n.return=t.return,ge=n;break}ge=t.return}}function Rg(e){for(;ge!==null;){var t=ge;if(t===e){ge=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ge=n;break}ge=t.return}}function _g(e){for(;ge!==null;){var t=ge;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{$c(4,t)}catch(c){kt(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){kt(t,s,c)}}var i=t.return;try{wf(t)}catch(c){kt(t,i,c)}break;case 5:var o=t.return;try{wf(t)}catch(c){kt(t,o,c)}}}catch(c){kt(t,t.return,c)}if(t===e){ge=null;break}var l=t.sibling;if(l!==null){l.return=t.return,ge=l;break}ge=t.return}}var rN=Math.ceil,hc=Ar.ReactCurrentDispatcher,tp=Ar.ReactCurrentOwner,_n=Ar.ReactCurrentBatchConfig,We=0,Ft=null,Dt=null,Ut=0,yn=0,ki=fs(0),Mt=0,po=null,Ws=0,Hc=0,np=0,Ua=null,un=null,rp=0,Ui=1/0,gr=null,pc=!1,jf=null,es=null,dl=!1,Kr=null,mc=0,$a=0,Nf=null,Fl=-1,Ol=0;function sn(){return We&6?Ct():Fl!==-1?Fl:Fl=Ct()}function ts(e){return e.mode&1?We&2&&Ut!==0?Ut&-Ut:V2.transition!==null?(Ol===0&&(Ol=Rv()),Ol):(e=Qe,e!==0||(e=window.event,e=e===void 0?16:Uv(e.type)),e):1}function qn(e,t,n,r){if(50<$a)throw $a=0,Nf=null,Error(ae(185));Lo(e,n,r),(!(We&2)||e!==Ft)&&(e===Ft&&(!(We&2)&&(Hc|=n),Mt===4&&Hr(e,Ut)),pn(e,r),n===1&&We===0&&!(t.mode&1)&&(Ui=Ct()+500,Vc&&hs()))}function pn(e,t){var n=e.callbackNode;Vj(e,t);var r=Jl(e,e===Ft?Ut:0);if(r===0)n!==null&&Wm(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Wm(n),t===1)e.tag===0?z2(Fg.bind(null,e)):ob(Fg.bind(null,e)),R2(function(){!(We&6)&&hs()}),n=null;else{switch(_v(r)){case 1:n=Ph;break;case 4:n=Mv;break;case 16:n=Ql;break;case 536870912:n=Iv;break;default:n=Ql}n=i1(n,Jb.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Jb(e,t){if(Fl=-1,Ol=0,We&6)throw Error(ae(327));var n=e.callbackNode;if(Mi()&&e.callbackNode!==n)return null;var r=Jl(e,e===Ft?Ut:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=gc(e,r);else{t=r;var s=We;We|=2;var i=e1();(Ft!==e||Ut!==t)&&(gr=null,Ui=Ct()+500,Fs(e,t));do try{aN();break}catch(l){Zb(e,l)}while(!0);Uh(),hc.current=i,We=s,Dt!==null?t=0:(Ft=null,Ut=0,t=Mt)}if(t!==0){if(t===2&&(s=Qd(e),s!==0&&(r=s,t=Cf(e,s))),t===1)throw n=po,Fs(e,0),Hr(e,r),pn(e,Ct()),n;if(t===6)Hr(e,r);else{if(s=e.current.alternate,!(r&30)&&!sN(s)&&(t=gc(e,r),t===2&&(i=Qd(e),i!==0&&(r=i,t=Cf(e,i))),t===1))throw n=po,Fs(e,0),Hr(e,r),pn(e,Ct()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(ae(345));case 2:Ns(e,un,gr);break;case 3:if(Hr(e,r),(r&130023424)===r&&(t=rp+500-Ct(),10<t)){if(Jl(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){sn(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=af(Ns.bind(null,e,un,gr),t);break}Ns(e,un,gr);break;case 4:if(Hr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-Gn(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=Ct()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*rN(r/1960))-r,10<r){e.timeoutHandle=af(Ns.bind(null,e,un,gr),r);break}Ns(e,un,gr);break;case 5:Ns(e,un,gr);break;default:throw Error(ae(329))}}}return pn(e,Ct()),e.callbackNode===n?Jb.bind(null,e):null}function Cf(e,t){var n=Ua;return e.current.memoizedState.isDehydrated&&(Fs(e,t).flags|=256),e=gc(e,t),e!==2&&(t=un,un=n,t!==null&&Ef(t)),e}function Ef(e){un===null?un=e:un.push.apply(un,e)}function sN(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Qn(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Hr(e,t){for(t&=~np,t&=~Hc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Gn(t),r=1<<n;e[n]=-1,t&=~r}}function Fg(e){if(We&6)throw Error(ae(327));Mi();var t=Jl(e,0);if(!(t&1))return pn(e,Ct()),null;var n=gc(e,t);if(e.tag!==0&&n===2){var r=Qd(e);r!==0&&(t=r,n=Cf(e,r))}if(n===1)throw n=po,Fs(e,0),Hr(e,t),pn(e,Ct()),n;if(n===6)throw Error(ae(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ns(e,un,gr),pn(e,Ct()),null}function sp(e,t){var n=We;We|=1;try{return e(t)}finally{We=n,We===0&&(Ui=Ct()+500,Vc&&hs())}}function Ks(e){Kr!==null&&Kr.tag===0&&!(We&6)&&Mi();var t=We;We|=1;var n=_n.transition,r=Qe;try{if(_n.transition=null,Qe=1,e)return e()}finally{Qe=r,_n.transition=n,We=t,!(We&6)&&hs()}}function ip(){yn=ki.current,ut(ki)}function Fs(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,I2(n)),Dt!==null)for(n=Dt.return;n!==null;){var r=n;switch(zh(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&rc();break;case 3:Vi(),ut(fn),ut(Zt),qh();break;case 5:Gh(r);break;case 4:Vi();break;case 13:ut(mt);break;case 19:ut(mt);break;case 10:$h(r.type._context);break;case 22:case 23:ip()}n=n.return}if(Ft=e,Dt=e=ns(e.current,null),Ut=yn=t,Mt=0,po=null,np=Hc=Ws=0,un=Ua=null,Ls!==null){for(t=0;t<Ls.length;t++)if(n=Ls[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Ls=null}return e}function Zb(e,t){do{var n=Dt;try{if(Uh(),Il.current=fc,dc){for(var r=xt.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}dc=!1}if(Hs=0,_t=Lt=xt=null,Va=!1,uo=0,tp.current=null,n===null||n.return===null){Mt=1,po=t,Dt=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=Ut,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,f=l,d=f.tag;if(!(f.mode&1)&&(d===0||d===11||d===15)){var h=f.alternate;h?(f.updateQueue=h.updateQueue,f.memoizedState=h.memoizedState,f.lanes=h.lanes):(f.updateQueue=null,f.memoizedState=null)}var p=jg(o);if(p!==null){p.flags&=-257,Ng(p,o,l,i,t),p.mode&1&&Sg(i,u,t),t=p,c=u;var x=t.updateQueue;if(x===null){var b=new Set;b.add(c),t.updateQueue=b}else x.add(c);break e}else{if(!(t&1)){Sg(i,u,t),ap();break e}c=Error(ae(426))}}else if(ht&&l.mode&1){var k=jg(o);if(k!==null){!(k.flags&65536)&&(k.flags|=256),Ng(k,o,l,i,t),Vh(Bi(c,l));break e}}i=c=Bi(c,l),Mt!==4&&(Mt=2),Ua===null?Ua=[i]:Ua.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=_b(i,c,t);xg(i,v);break e;case 1:l=c;var m=i.type,y=i.stateNode;if(!(i.flags&128)&&(typeof m.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(es===null||!es.has(y)))){i.flags|=65536,t&=-t,i.lanes|=t;var j=Fb(i,l,t);xg(i,j);break e}}i=i.return}while(i!==null)}n1(n)}catch(S){t=S,Dt===n&&n!==null&&(Dt=n=n.return);continue}break}while(!0)}function e1(){var e=hc.current;return hc.current=fc,e===null?fc:e}function ap(){(Mt===0||Mt===3||Mt===2)&&(Mt=4),Ft===null||!(Ws&268435455)&&!(Hc&268435455)||Hr(Ft,Ut)}function gc(e,t){var n=We;We|=2;var r=e1();(Ft!==e||Ut!==t)&&(gr=null,Fs(e,t));do try{iN();break}catch(s){Zb(e,s)}while(!0);if(Uh(),We=n,hc.current=r,Dt!==null)throw Error(ae(261));return Ft=null,Ut=0,Mt}function iN(){for(;Dt!==null;)t1(Dt)}function aN(){for(;Dt!==null&&!Dj();)t1(Dt)}function t1(e){var t=s1(e.alternate,e,yn);e.memoizedProps=e.pendingProps,t===null?n1(e):Dt=t,tp.current=null}function n1(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Z2(n,t),n!==null){n.flags&=32767,Dt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Mt=6,Dt=null;return}}else if(n=J2(n,t,yn),n!==null){Dt=n;return}if(t=t.sibling,t!==null){Dt=t;return}Dt=t=e}while(t!==null);Mt===0&&(Mt=5)}function Ns(e,t,n){var r=Qe,s=_n.transition;try{_n.transition=null,Qe=1,oN(e,t,n,r)}finally{_n.transition=s,Qe=r}return null}function oN(e,t,n,r){do Mi();while(Kr!==null);if(We&6)throw Error(ae(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ae(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Bj(e,i),e===Ft&&(Dt=Ft=null,Ut=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dl||(dl=!0,i1(Ql,function(){return Mi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=_n.transition,_n.transition=null;var o=Qe;Qe=1;var l=We;We|=4,tp.current=null,tN(e,n),Xb(n,e),E2(rf),Zl=!!nf,rf=nf=null,e.current=n,nN(n),Lj(),We=l,Qe=o,_n.transition=i}else e.current=n;if(dl&&(dl=!1,Kr=e,mc=s),i=e.pendingLanes,i===0&&(es=null),Rj(n.stateNode),pn(e,Ct()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(pc)throw pc=!1,e=jf,jf=null,e;return mc&1&&e.tag!==0&&Mi(),i=e.pendingLanes,i&1?e===Nf?$a++:($a=0,Nf=e):$a=0,hs(),null}function Mi(){if(Kr!==null){var e=_v(mc),t=_n.transition,n=Qe;try{if(_n.transition=null,Qe=16>e?16:e,Kr===null)var r=!1;else{if(e=Kr,Kr=null,mc=0,We&6)throw Error(ae(331));var s=We;for(We|=4,ge=e.current;ge!==null;){var i=ge,o=i.child;if(ge.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(ge=u;ge!==null;){var f=ge;switch(f.tag){case 0:case 11:case 15:Ba(8,f,i)}var d=f.child;if(d!==null)d.return=f,ge=d;else for(;ge!==null;){f=ge;var h=f.sibling,p=f.return;if(Gb(f),f===u){ge=null;break}if(h!==null){h.return=p,ge=h;break}ge=p}}}var x=i.alternate;if(x!==null){var b=x.child;if(b!==null){x.child=null;do{var k=b.sibling;b.sibling=null,b=k}while(b!==null)}}ge=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,ge=o;else e:for(;ge!==null;){if(i=ge,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Ba(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,ge=v;break e}ge=i.return}}var m=e.current;for(ge=m;ge!==null;){o=ge;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,ge=y;else e:for(o=m;ge!==null;){if(l=ge,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:$c(9,l)}}catch(S){kt(l,l.return,S)}if(l===o){ge=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,ge=j;break e}ge=l.return}}if(We=s,hs(),ar&&typeof ar.onPostCommitFiberRoot=="function")try{ar.onPostCommitFiberRoot(Rc,e)}catch{}r=!0}return r}finally{Qe=n,_n.transition=t}}return!1}function Og(e,t,n){t=Bi(n,t),t=_b(e,t,1),e=Zr(e,t,1),t=sn(),e!==null&&(Lo(e,1,t),pn(e,t))}function kt(e,t,n){if(e.tag===3)Og(e,e,n);else for(;t!==null;){if(t.tag===3){Og(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(es===null||!es.has(r))){e=Bi(n,e),e=Fb(t,e,1),t=Zr(t,e,1),e=sn(),t!==null&&(Lo(t,1,e),pn(t,e));break}}t=t.return}}function lN(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=sn(),e.pingedLanes|=e.suspendedLanes&n,Ft===e&&(Ut&n)===n&&(Mt===4||Mt===3&&(Ut&130023424)===Ut&&500>Ct()-rp?Fs(e,0):np|=n),pn(e,t)}function r1(e,t){t===0&&(e.mode&1?(t=tl,tl<<=1,!(tl&130023424)&&(tl=4194304)):t=1);var n=sn();e=Cr(e,t),e!==null&&(Lo(e,t,n),pn(e,n))}function cN(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),r1(e,n)}function uN(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ae(314))}r!==null&&r.delete(t),r1(e,n)}var s1;s1=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||fn.current)dn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return dn=!1,Q2(e,t,n);dn=!!(e.flags&131072)}else dn=!1,ht&&t.flags&1048576&&lb(t,ac,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;_l(e,t),e=t.pendingProps;var s=Fi(t,Zt.current);Li(t,n),s=Xh(null,t,r,e,s,n);var i=Qh();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,hn(r)?(i=!0,sc(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Wh(t),s.updater=Uc,t.stateNode=s,s._reactInternals=t,hf(t,r,e,n),t=gf(null,t,r,!0,i,n)):(t.tag=0,ht&&i&&Oh(t),nn(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(_l(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=fN(r),e=$n(r,e),s){case 0:t=mf(null,t,r,e,n);break e;case 1:t=Tg(null,t,r,e,n);break e;case 11:t=Cg(null,t,r,e,n);break e;case 14:t=Eg(null,t,r,$n(r.type,e),n);break e}throw Error(ae(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:$n(r,s),mf(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:$n(r,s),Tg(e,t,r,s,n);case 3:e:{if(Bb(t),e===null)throw Error(ae(387));r=t.pendingProps,i=t.memoizedState,s=i.element,pb(e,t),cc(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Bi(Error(ae(423)),t),t=Pg(e,t,r,n,s);break e}else if(r!==s){s=Bi(Error(ae(424)),t),t=Pg(e,t,r,n,s);break e}else for(bn=Jr(t.stateNode.containerInfo.firstChild),wn=t,ht=!0,Kn=null,n=fb(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Oi(),r===s){t=Er(e,t,n);break e}nn(e,t,r,n)}t=t.child}return t;case 5:return mb(t),e===null&&uf(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,sf(r,s)?o=null:i!==null&&sf(r,i)&&(t.flags|=32),Vb(e,t),nn(e,t,o,n),t.child;case 6:return e===null&&uf(t),null;case 13:return Ub(e,t,n);case 4:return Kh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=zi(t,null,r,n):nn(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:$n(r,s),Cg(e,t,r,s,n);case 7:return nn(e,t,t.pendingProps,n),t.child;case 8:return nn(e,t,t.pendingProps.children,n),t.child;case 12:return nn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,st(oc,r._currentValue),r._currentValue=o,i!==null)if(Qn(i.value,o)){if(i.children===s.children&&!fn.current){t=Er(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=br(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?c.next=c:(c.next=f.next,f.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),df(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(ae(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),df(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}nn(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Li(t,n),s=On(s),r=r(s),t.flags|=1,nn(e,t,r,n),t.child;case 14:return r=t.type,s=$n(r,t.pendingProps),s=$n(r.type,s),Eg(e,t,r,s,n);case 15:return Ob(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:$n(r,s),_l(e,t),t.tag=1,hn(r)?(e=!0,sc(t)):e=!1,Li(t,n),Rb(t,r,s),hf(t,r,s,n),gf(null,t,r,!0,e,n);case 19:return $b(e,t,n);case 22:return zb(e,t,n)}throw Error(ae(156,t.tag))};function i1(e,t){return Lv(e,t)}function dN(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rn(e,t,n,r){return new dN(e,t,n,r)}function op(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fN(e){if(typeof e=="function")return op(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ch)return 11;if(e===Eh)return 14}return 2}function ns(e,t){var n=e.alternate;return n===null?(n=Rn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function zl(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")op(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case fi:return Os(n.children,s,i,t);case Nh:o=8,s|=8;break;case _d:return e=Rn(12,n,t,s|2),e.elementType=_d,e.lanes=i,e;case Fd:return e=Rn(13,n,t,s),e.elementType=Fd,e.lanes=i,e;case Od:return e=Rn(19,n,t,s),e.elementType=Od,e.lanes=i,e;case mv:return Wc(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case hv:o=10;break e;case pv:o=9;break e;case Ch:o=11;break e;case Eh:o=14;break e;case Br:o=16,r=null;break e}throw Error(ae(130,e==null?e:typeof e,""))}return t=Rn(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Os(e,t,n,r){return e=Rn(7,e,r,t),e.lanes=n,e}function Wc(e,t,n,r){return e=Rn(22,e,r,t),e.elementType=mv,e.lanes=n,e.stateNode={isHidden:!1},e}function Wu(e,t,n){return e=Rn(6,e,null,t),e.lanes=n,e}function Ku(e,t,n){return t=Rn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function hN(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Cu(0),this.expirationTimes=Cu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cu(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function lp(e,t,n,r,s,i,o,l,c){return e=new hN(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Rn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Wh(i),e}function pN(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:di,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function a1(e){if(!e)return as;e=e._reactInternals;e:{if(Zs(e)!==e||e.tag!==1)throw Error(ae(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(hn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ae(171))}if(e.tag===1){var n=e.type;if(hn(n))return ab(e,n,t)}return t}function o1(e,t,n,r,s,i,o,l,c){return e=lp(n,r,!0,e,s,i,o,l,c),e.context=a1(null),n=e.current,r=sn(),s=ts(n),i=br(r,s),i.callback=t??null,Zr(n,i,s),e.current.lanes=s,Lo(e,s,r),pn(e,r),e}function Kc(e,t,n,r){var s=t.current,i=sn(),o=ts(s);return n=a1(n),t.context===null?t.context=n:t.pendingContext=n,t=br(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Zr(s,t,o),e!==null&&(qn(e,s,o,i),Ml(e,s,o)),o}function xc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function zg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){zg(e,t),(e=e.alternate)&&zg(e,t)}function mN(){return null}var l1=typeof reportError=="function"?reportError:function(e){console.error(e)};function up(e){this._internalRoot=e}Gc.prototype.render=up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ae(409));Kc(e,t,null,null)};Gc.prototype.unmount=up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ks(function(){Kc(null,e,null,null)}),t[Nr]=null}};function Gc(e){this._internalRoot=e}Gc.prototype.unstable_scheduleHydration=function(e){if(e){var t=zv();e={blockedOn:null,target:e,priority:t};for(var n=0;n<$r.length&&t!==0&&t<$r[n].priority;n++);$r.splice(n,0,e),n===0&&Bv(e)}};function dp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function qc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Vg(){}function gN(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=xc(o);i.call(u)}}var o=o1(t,r,e,0,null,!1,!1,"",Vg);return e._reactRootContainer=o,e[Nr]=o.current,io(e.nodeType===8?e.parentNode:e),Ks(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=xc(c);l.call(u)}}var c=lp(e,0,!1,null,null,!1,!1,"",Vg);return e._reactRootContainer=c,e[Nr]=c.current,io(e.nodeType===8?e.parentNode:e),Ks(function(){Kc(t,c,n,r)}),c}function Yc(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=xc(o);l.call(c)}}Kc(t,o,e,s)}else o=gN(n,t,e,s,r);return xc(o)}Fv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Pa(t.pendingLanes);n!==0&&(Ah(t,n|1),pn(t,Ct()),!(We&6)&&(Ui=Ct()+500,hs()))}break;case 13:Ks(function(){var r=Cr(e,1);if(r!==null){var s=sn();qn(r,e,1,s)}}),cp(e,1)}};Dh=function(e){if(e.tag===13){var t=Cr(e,134217728);if(t!==null){var n=sn();qn(t,e,134217728,n)}cp(e,134217728)}};Ov=function(e){if(e.tag===13){var t=ts(e),n=Cr(e,t);if(n!==null){var r=sn();qn(n,e,t,r)}cp(e,t)}};zv=function(){return Qe};Vv=function(e,t){var n=Qe;try{return Qe=e,t()}finally{Qe=n}};qd=function(e,t,n){switch(t){case"input":if(Bd(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=zc(r);if(!s)throw Error(ae(90));xv(r),Bd(r,s)}}}break;case"textarea":vv(e,n);break;case"select":t=n.value,t!=null&&Ti(e,!!n.multiple,t,!1)}};Cv=sp;Ev=Ks;var xN={usingClientEntryPoint:!1,Events:[Io,gi,zc,jv,Nv,sp]},ga={findFiberByHostInstance:Ds,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},yN={bundleType:ga.bundleType,version:ga.version,rendererPackageName:ga.rendererPackageName,rendererConfig:ga.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ar.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Av(e),e===null?null:e.stateNode},findFiberByHostInstance:ga.findFiberByHostInstance||mN,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fl.isDisabled&&fl.supportsFiber)try{Rc=fl.inject(yN),ar=fl}catch{}}En.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xN;En.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!dp(t))throw Error(ae(200));return pN(e,t,null,n)};En.createRoot=function(e,t){if(!dp(e))throw Error(ae(299));var n=!1,r="",s=l1;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=lp(e,1,!1,null,null,n,!1,r,s),e[Nr]=t.current,io(e.nodeType===8?e.parentNode:e),new up(t)};En.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ae(188)):(e=Object.keys(e).join(","),Error(ae(268,e)));return e=Av(t),e=e===null?null:e.stateNode,e};En.flushSync=function(e){return Ks(e)};En.hydrate=function(e,t,n){if(!qc(t))throw Error(ae(200));return Yc(null,e,t,!0,n)};En.hydrateRoot=function(e,t,n){if(!dp(e))throw Error(ae(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=l1;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=o1(t,null,e,1,n??null,s,!1,i,o),e[Nr]=t.current,io(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new Gc(t)};En.render=function(e,t,n){if(!qc(t))throw Error(ae(200));return Yc(null,e,t,!1,n)};En.unmountComponentAtNode=function(e){if(!qc(e))throw Error(ae(40));return e._reactRootContainer?(Ks(function(){Yc(null,null,e,!1,function(){e._reactRootContainer=null,e[Nr]=null})}),!0):!1};En.unstable_batchedUpdates=sp;En.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!qc(n))throw Error(ae(200));if(e==null||e._reactInternals===void 0)throw Error(ae(38));return Yc(e,t,n,!1,r)};En.version="18.3.1-next-f1338f8080-20240426";function c1(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c1)}catch(e){console.error(e)}}c1(),cv.exports=En;var Xc=cv.exports;const vN=Ao(Xc),bN=Qy({__proto__:null,default:vN},[Xc]);var Bg=Xc;Id.createRoot=Bg.createRoot,Id.hydrateRoot=Bg.hydrateRoot;/**
41
+ * @remix-run/router v1.23.2
42
+ *
43
+ * Copyright (c) Remix Software Inc.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE.md file in the root directory of this source tree.
47
+ *
48
+ * @license MIT
49
+ */function ft(){return ft=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ft.apply(this,arguments)}var At;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(At||(At={}));const Ug="popstate";function wN(e){e===void 0&&(e={});function t(r,s){let{pathname:i,search:o,hash:l}=r.location;return mo("",{pathname:i,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:qs(s)}return SN(t,n,null,e)}function Oe(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Gs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function kN(){return Math.random().toString(36).substr(2,8)}function $g(e,t){return{usr:e.state,key:e.key,idx:t}}function mo(e,t,n,r){return n===void 0&&(n=null),ft({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ps(t):t,{state:n,key:t&&t.key||r||kN()})}function qs(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function ps(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function SN(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=At.Pop,c=null,u=f();u==null&&(u=0,o.replaceState(ft({},o.state,{idx:u}),""));function f(){return(o.state||{idx:null}).idx}function d(){l=At.Pop;let k=f(),v=k==null?null:k-u;u=k,c&&c({action:l,location:b.location,delta:v})}function h(k,v){l=At.Push;let m=mo(b.location,k,v);u=f()+1;let y=$g(m,u),j=b.createHref(m);try{o.pushState(y,"",j)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(j)}i&&c&&c({action:l,location:b.location,delta:1})}function p(k,v){l=At.Replace;let m=mo(b.location,k,v);u=f();let y=$g(m,u),j=b.createHref(m);o.replaceState(y,"",j),i&&c&&c({action:l,location:b.location,delta:0})}function x(k){let v=s.location.origin!=="null"?s.location.origin:s.location.href,m=typeof k=="string"?k:qs(k);return m=m.replace(/ $/,"%20"),Oe(v,"No window.location.(origin|href) available to create URL for href: "+m),new URL(m,v)}let b={get action(){return l},get location(){return e(s,o)},listen(k){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Ug,d),c=k,()=>{s.removeEventListener(Ug,d),c=null}},createHref(k){return t(s,k)},createURL:x,encodeLocation(k){let v=x(k);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:h,replace:p,go(k){return o.go(k)}};return b}var Xe;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Xe||(Xe={}));const jN=new Set(["lazy","caseSensitive","path","id","index","children"]);function NN(e){return e.index===!0}function yc(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((s,i)=>{let o=[...n,String(i)],l=typeof s.id=="string"?s.id:o.join("-");if(Oe(s.index!==!0||!s.children,"Cannot specify children on an index route"),Oe(!r[l],'Found a route id collision on id "'+l+`". Route id's must be globally unique within Data Router usages`),NN(s)){let c=ft({},s,t(s),{id:l});return r[l]=c,c}else{let c=ft({},s,t(s),{id:l,children:void 0});return r[l]=c,s.children&&(c.children=yc(s.children,t,o,r)),c}})}function Ts(e,t,n){return n===void 0&&(n="/"),Vl(e,t,n,!1)}function Vl(e,t,n,r){let s=typeof t=="string"?ps(t):t,i=Jn(s.pathname||"/",n);if(i==null)return null;let o=u1(e);EN(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=ON(i);l=_N(o[c],u,r)}return l}function CN(e,t){let{route:n,pathname:r,params:s}=e;return{id:n.id,pathname:r,params:s,data:t[n.id],handle:n.handle}}function u1(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(Oe(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=wr([r,c.relativePath]),f=n.concat(c);i.children&&i.children.length>0&&(Oe(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),u1(i.children,t,f,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:IN(u,i.index),routesMeta:f})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of d1(i.path))s(i,o,c)}),t}function d1(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=d1(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function EN(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:RN(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const TN=/^:[\w-]+$/,PN=3,AN=2,DN=1,LN=10,MN=-2,Hg=e=>e==="*";function IN(e,t){let n=e.split("/"),r=n.length;return n.some(Hg)&&(r+=MN),t&&(r+=AN),n.filter(s=>!Hg(s)).reduce((s,i)=>s+(TN.test(i)?PN:i===""?DN:LN),r)}function RN(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function _N(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,s={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,f=i==="/"?t:t.slice(i.length)||"/",d=vc({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},f),h=c.route;if(!d&&u&&n&&!r[r.length-1].route.index&&(d=vc({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},f)),!d)return null;Object.assign(s,d.params),o.push({params:s,pathname:wr([i,d.pathname]),pathnameBase:UN(wr([i,d.pathnameBase])),route:h}),d.pathnameBase!=="/"&&(i=wr([i,d.pathnameBase]))}return o}function vc(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=FN(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,f,d)=>{let{paramName:h,isOptional:p}=f;if(h==="*"){let b=l[d]||"";o=i.slice(0,i.length-b.length).replace(/(.)\/+$/,"$1")}const x=l[d];return p&&!x?u[h]=void 0:u[h]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function FN(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Gs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function ON(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Gs(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Jn(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const zN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,VN=e=>zN.test(e);function BN(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?ps(e):e,i;if(n)if(VN(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Gs(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Wg(n.substring(1),"/"):i=Wg(n,t)}else i=t;return{pathname:i,search:$N(r),hash:HN(s)}}function Wg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Gu(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function f1(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Qc(e,t){let n=f1(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Jc(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=ps(e):(s=ft({},e),Oe(!s.pathname||!s.pathname.includes("?"),Gu("?","pathname","search",s)),Oe(!s.pathname||!s.pathname.includes("#"),Gu("#","pathname","hash",s)),Oe(!s.search||!s.search.includes("#"),Gu("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let d=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),d-=1;s.pathname=h.join("/")}l=d>=0?t[d]:"/"}let c=BN(s,l),u=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||f)&&(c.pathname+="/"),c}const wr=e=>e.join("/").replace(/\/\/+/g,"/"),UN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),$N=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,HN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class bc{constructor(t,n,r,s){s===void 0&&(s=!1),this.status=t,this.statusText=n||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function go(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const h1=["post","put","patch","delete"],WN=new Set(h1),KN=["get",...h1],GN=new Set(KN),qN=new Set([301,302,303,307,308]),YN=new Set([307,308]),qu={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},XN={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ci={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},fp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,QN=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),p1="remix-router-transitions";function JN(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;Oe(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let s;if(e.mapRouteProperties)s=e.mapRouteProperties;else if(e.detectErrorBoundary){let _=e.detectErrorBoundary;s=A=>({hasErrorBoundary:_(A)})}else s=QN;let i={},o=yc(e.routes,s,void 0,i),l,c=e.basename||"/",u=e.dataStrategy||nC,f=e.patchRoutesOnNavigation,d=ft({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),h=null,p=new Set,x=null,b=null,k=null,v=e.hydrationData!=null,m=Ts(o,e.history.location,c),y=!1,j=null;if(m==null&&!f){let _=cn(404,{pathname:e.history.location.pathname}),{matches:A,route:I}=n0(o);m=A,j={[I.id]:_}}m&&!e.hydrationData&&hr(m,o,e.history.location.pathname).active&&(m=null);let S;if(m)if(m.some(_=>_.route.lazy))S=!1;else if(!m.some(_=>_.route.loader))S=!0;else if(d.v7_partialHydration){let _=e.hydrationData?e.hydrationData.loaderData:null,A=e.hydrationData?e.hydrationData.errors:null;if(A){let I=m.findIndex(U=>A[U.route.id]!==void 0);S=m.slice(0,I+1).every(U=>!Pf(U.route,_,A))}else S=m.every(I=>!Pf(I.route,_,A))}else S=e.hydrationData!=null;else if(S=!1,m=[],d.v7_partialHydration){let _=hr(null,o,e.history.location.pathname);_.active&&_.matches&&(y=!0,m=_.matches)}let N,w={historyAction:e.history.action,location:e.history.location,matches:m,initialized:S,navigation:qu,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||j,fetchers:new Map,blockers:new Map},C=At.Pop,D=!1,T,M=!1,P=new Map,F=null,z=!1,W=!1,fe=[],ee=new Set,R=new Map,V=0,E=-1,Y=new Map,J=new Set,L=new Map,Q=new Map,te=new Set,pe=new Map,ne=new Map,ie;function he(){if(h=e.history.listen(_=>{let{action:A,location:I,delta:U}=_;if(ie){ie(),ie=void 0;return}Gs(ne.size===0||U!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ue=je({currentLocation:w.location,nextLocation:I,historyAction:A});if(ue&&U!=null){let me=new Promise(Pe=>{ie=Pe});e.history.go(U*-1),Z(ue,{state:"blocked",location:I,proceed(){Z(ue,{state:"proceeding",proceed:void 0,reset:void 0,location:I}),me.then(()=>e.history.go(U))},reset(){let Pe=new Map(w.blockers);Pe.set(ue,ci),K({blockers:Pe})}});return}return ye(A,I)}),n){gC(t,P);let _=()=>xC(t,P);t.addEventListener("pagehide",_),F=()=>t.removeEventListener("pagehide",_)}return w.initialized||ye(At.Pop,w.location,{initialHydration:!0}),N}function Ce(){h&&h(),F&&F(),p.clear(),T&&T.abort(),w.fetchers.forEach((_,A)=>oe(A)),w.blockers.forEach((_,A)=>at(A))}function Te(_){return p.add(_),()=>p.delete(_)}function K(_,A){A===void 0&&(A={}),w=ft({},w,_);let I=[],U=[];d.v7_fetcherPersist&&w.fetchers.forEach((ue,me)=>{ue.state==="idle"&&(te.has(me)?U.push(me):I.push(me))}),te.forEach(ue=>{!w.fetchers.has(ue)&&!R.has(ue)&&U.push(ue)}),[...p].forEach(ue=>ue(w,{deletedFetchers:U,viewTransitionOpts:A.viewTransitionOpts,flushSync:A.flushSync===!0})),d.v7_fetcherPersist?(I.forEach(ue=>w.fetchers.delete(ue)),U.forEach(ue=>oe(ue))):U.forEach(ue=>te.delete(ue))}function $(_,A,I){var U,ue;let{flushSync:me}=I===void 0?{}:I,Pe=w.actionData!=null&&w.navigation.formMethod!=null&&Wn(w.navigation.formMethod)&&w.navigation.state==="loading"&&((U=_.state)==null?void 0:U._isRedirect)!==!0,ve;A.actionData?Object.keys(A.actionData).length>0?ve=A.actionData:ve=null:Pe?ve=w.actionData:ve=null;let X=A.loaderData?e0(w.loaderData,A.loaderData,A.matches||[],A.errors):w.loaderData,re=w.blockers;re.size>0&&(re=new Map(re),re.forEach((ke,Fe)=>re.set(Fe,ci)));let de=D===!0||w.navigation.formMethod!=null&&Wn(w.navigation.formMethod)&&((ue=_.state)==null?void 0:ue._isRedirect)!==!0;l&&(o=l,l=void 0),z||C===At.Pop||(C===At.Push?e.history.push(_,_.state):C===At.Replace&&e.history.replace(_,_.state));let Se;if(C===At.Pop){let ke=P.get(w.location.pathname);ke&&ke.has(_.pathname)?Se={currentLocation:w.location,nextLocation:_}:P.has(_.pathname)&&(Se={currentLocation:_,nextLocation:w.location})}else if(M){let ke=P.get(w.location.pathname);ke?ke.add(_.pathname):(ke=new Set([_.pathname]),P.set(w.location.pathname,ke)),Se={currentLocation:w.location,nextLocation:_}}K(ft({},A,{actionData:ve,loaderData:X,historyAction:C,location:_,initialized:!0,navigation:qu,revalidation:"idle",restoreScrollPosition:bs(_,A.matches||w.matches),preventScrollReset:de,blockers:re}),{viewTransitionOpts:Se,flushSync:me===!0}),C=At.Pop,D=!1,M=!1,z=!1,W=!1,fe=[]}async function xe(_,A){if(typeof _=="number"){e.history.go(_);return}let I=Tf(w.location,w.matches,c,d.v7_prependBasename,_,d.v7_relativeSplatPath,A==null?void 0:A.fromRouteId,A==null?void 0:A.relative),{path:U,submission:ue,error:me}=Kg(d.v7_normalizeFormMethod,!1,I,A),Pe=w.location,ve=mo(w.location,U,A&&A.state);ve=ft({},ve,e.history.encodeLocation(ve));let X=A&&A.replace!=null?A.replace:void 0,re=At.Push;X===!0?re=At.Replace:X===!1||ue!=null&&Wn(ue.formMethod)&&ue.formAction===w.location.pathname+w.location.search&&(re=At.Replace);let de=A&&"preventScrollReset"in A?A.preventScrollReset===!0:void 0,Se=(A&&A.flushSync)===!0,ke=je({currentLocation:Pe,nextLocation:ve,historyAction:re});if(ke){Z(ke,{state:"blocked",location:ve,proceed(){Z(ke,{state:"proceeding",proceed:void 0,reset:void 0,location:ve}),xe(_,A)},reset(){let Fe=new Map(w.blockers);Fe.set(ke,ci),K({blockers:Fe})}});return}return await ye(re,ve,{submission:ue,pendingError:me,preventScrollReset:de,replace:A&&A.replace,enableViewTransition:A&&A.viewTransition,flushSync:Se})}function q(){if(G(),K({revalidation:"loading"}),w.navigation.state!=="submitting"){if(w.navigation.state==="idle"){ye(w.historyAction,w.location,{startUninterruptedRevalidation:!0});return}ye(C||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:M===!0})}}async function ye(_,A,I){T&&T.abort(),T=null,C=_,z=(I&&I.startUninterruptedRevalidation)===!0,vs(w.location,w.matches),D=(I&&I.preventScrollReset)===!0,M=(I&&I.enableViewTransition)===!0;let U=l||o,ue=I&&I.overrideNavigation,me=I!=null&&I.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:Ts(U,A,c),Pe=(I&&I.flushSync)===!0;if(me&&w.initialized&&!W&&lC(w.location,A)&&!(I&&I.submission&&Wn(I.submission.formMethod))){$(A,{matches:me},{flushSync:Pe});return}let ve=hr(me,U,A.pathname);if(ve.active&&ve.matches&&(me=ve.matches),!me){let{error:De,notFoundMatches:_e,route:nt}=ze(A.pathname);$(A,{matches:_e,loaderData:{},errors:{[nt.id]:De}},{flushSync:Pe});return}T=new AbortController;let X=oi(e.history,A,T.signal,I&&I.submission),re;if(I&&I.pendingError)re=[Ps(me).route.id,{type:Xe.error,error:I.pendingError}];else if(I&&I.submission&&Wn(I.submission.formMethod)){let De=await Le(X,A,I.submission,me,ve.active,{replace:I.replace,flushSync:Pe});if(De.shortCircuited)return;if(De.pendingActionResult){let[_e,nt]=De.pendingActionResult;if(vn(nt)&&go(nt.error)&&nt.error.status===404){T=null,$(A,{matches:De.matches,loaderData:{},errors:{[_e]:nt.error}});return}}me=De.matches||me,re=De.pendingActionResult,ue=Yu(A,I.submission),Pe=!1,ve.active=!1,X=oi(e.history,X.url,X.signal)}let{shortCircuited:de,matches:Se,loaderData:ke,errors:Fe}=await He(X,A,me,ve.active,ue,I&&I.submission,I&&I.fetcherSubmission,I&&I.replace,I&&I.initialHydration===!0,Pe,re);de||(T=null,$(A,ft({matches:Se||me},t0(re),{loaderData:ke,errors:Fe})))}async function Le(_,A,I,U,ue,me){me===void 0&&(me={}),G();let Pe=pC(A,I);if(K({navigation:Pe},{flushSync:me.flushSync===!0}),ue){let re=await Zn(U,A.pathname,_.signal);if(re.type==="aborted")return{shortCircuited:!0};if(re.type==="error"){let de=Ps(re.partialMatches).route.id;return{matches:re.partialMatches,pendingActionResult:[de,{type:Xe.error,error:re.error}]}}else if(re.matches)U=re.matches;else{let{notFoundMatches:de,error:Se,route:ke}=ze(A.pathname);return{matches:de,pendingActionResult:[ke.id,{type:Xe.error,error:Se}]}}}let ve,X=Da(U,A);if(!X.route.action&&!X.route.lazy)ve={type:Xe.error,error:cn(405,{method:_.method,pathname:A.pathname,routeId:X.route.id})};else if(ve=(await Et("action",w,_,[X],U,null))[X.route.id],_.signal.aborted)return{shortCircuited:!0};if(Is(ve)){let re;return me&&me.replace!=null?re=me.replace:re=Qg(ve.response.headers.get("Location"),new URL(_.url),c,e.history)===w.location.pathname+w.location.search,await it(_,ve,!0,{submission:I,replace:re}),{shortCircuited:!0}}if(Gr(ve))throw cn(400,{type:"defer-action"});if(vn(ve)){let re=Ps(U,X.route.id);return(me&&me.replace)!==!0&&(C=At.Push),{matches:U,pendingActionResult:[re.route.id,ve]}}return{matches:U,pendingActionResult:[X.route.id,ve]}}async function He(_,A,I,U,ue,me,Pe,ve,X,re,de){let Se=ue||Yu(A,me),ke=me||Pe||s0(Se),Fe=!z&&(!d.v7_partialHydration||!X);if(U){if(Fe){let bt=qe(de);K(ft({navigation:Se},bt!==void 0?{actionData:bt}:{}),{flushSync:re})}let Ke=await Zn(I,A.pathname,_.signal);if(Ke.type==="aborted")return{shortCircuited:!0};if(Ke.type==="error"){let bt=Ps(Ke.partialMatches).route.id;return{matches:Ke.partialMatches,loaderData:{},errors:{[bt]:Ke.error}}}else if(Ke.matches)I=Ke.matches;else{let{error:bt,notFoundMatches:si,route:la}=ze(A.pathname);return{matches:si,loaderData:{},errors:{[la.id]:bt}}}}let De=l||o,[_e,nt]=qg(e.history,w,I,ke,A,d.v7_partialHydration&&X===!0,d.v7_skipActionErrorRevalidation,W,fe,ee,te,L,J,De,c,de);if(ot(Ke=>!(I&&I.some(bt=>bt.route.id===Ke))||_e&&_e.some(bt=>bt.route.id===Ke)),E=++V,_e.length===0&&nt.length===0){let Ke=Ve();return $(A,ft({matches:I,loaderData:{},errors:de&&vn(de[1])?{[de[0]]:de[1].error}:null},t0(de),Ke?{fetchers:new Map(w.fetchers)}:{}),{flushSync:re}),{shortCircuited:!0}}if(Fe){let Ke={};if(!U){Ke.navigation=Se;let bt=qe(de);bt!==void 0&&(Ke.actionData=bt)}nt.length>0&&(Ke.fetchers=St(nt)),K(Ke,{flushSync:re})}nt.forEach(Ke=>{Me(Ke.key),Ke.controller&&R.set(Ke.key,Ke.controller)});let pt=()=>nt.forEach(Ke=>Me(Ke.key));T&&T.signal.addEventListener("abort",pt);let{loaderResults:pr,fetcherResults:Vn}=await H(w,I,_e,nt,_);if(_.signal.aborted)return{shortCircuited:!0};T&&T.signal.removeEventListener("abort",pt),nt.forEach(Ke=>R.delete(Ke.key));let er=hl(pr);if(er)return await it(_,er.result,!0,{replace:ve}),{shortCircuited:!0};if(er=hl(Vn),er)return J.add(er.key),await it(_,er.result,!0,{replace:ve}),{shortCircuited:!0};let{loaderData:bu,errors:oa}=Zg(w,I,pr,de,nt,Vn,pe);pe.forEach((Ke,bt)=>{Ke.subscribe(si=>{(si||Ke.done)&&pe.delete(bt)})}),d.v7_partialHydration&&X&&w.errors&&(oa=ft({},w.errors,oa));let ws=Ve(),qo=tt(E),Yo=ws||qo||nt.length>0;return ft({matches:I,loaderData:bu,errors:oa},Yo?{fetchers:new Map(w.fetchers)}:{})}function qe(_){if(_&&!vn(_[1]))return{[_[0]]:_[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function St(_){return _.forEach(A=>{let I=w.fetchers.get(A.key),U=xa(void 0,I?I.data:void 0);w.fetchers.set(A.key,U)}),new Map(w.fetchers)}function jt(_,A,I,U){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Me(_);let ue=(U&&U.flushSync)===!0,me=l||o,Pe=Tf(w.location,w.matches,c,d.v7_prependBasename,I,d.v7_relativeSplatPath,A,U==null?void 0:U.relative),ve=Ts(me,Pe,c),X=hr(ve,me,Pe);if(X.active&&X.matches&&(ve=X.matches),!ve){we(_,A,cn(404,{pathname:Pe}),{flushSync:ue});return}let{path:re,submission:de,error:Se}=Kg(d.v7_normalizeFormMethod,!0,Pe,U);if(Se){we(_,A,Se,{flushSync:ue});return}let ke=Da(ve,re),Fe=(U&&U.preventScrollReset)===!0;if(de&&Wn(de.formMethod)){vt(_,A,re,ke,ve,X.active,ue,Fe,de);return}L.set(_,{routeId:A,path:re}),Ye(_,A,re,ke,ve,X.active,ue,Fe,de)}async function vt(_,A,I,U,ue,me,Pe,ve,X){G(),L.delete(_);function re(Tt){if(!Tt.route.action&&!Tt.route.lazy){let ii=cn(405,{method:X.formMethod,pathname:I,routeId:A});return we(_,A,ii,{flushSync:Pe}),!0}return!1}if(!me&&re(U))return;let de=w.fetchers.get(_);se(_,mC(X,de),{flushSync:Pe});let Se=new AbortController,ke=oi(e.history,I,Se.signal,X);if(me){let Tt=await Zn(ue,new URL(ke.url).pathname,ke.signal,_);if(Tt.type==="aborted")return;if(Tt.type==="error"){we(_,A,Tt.error,{flushSync:Pe});return}else if(Tt.matches){if(ue=Tt.matches,U=Da(ue,I),re(U))return}else{we(_,A,cn(404,{pathname:I}),{flushSync:Pe});return}}R.set(_,Se);let Fe=V,_e=(await Et("action",w,ke,[U],ue,_))[U.route.id];if(ke.signal.aborted){R.get(_)===Se&&R.delete(_);return}if(d.v7_fetcherPersist&&te.has(_)){if(Is(_e)||vn(_e)){se(_,zr(void 0));return}}else{if(Is(_e))if(R.delete(_),E>Fe){se(_,zr(void 0));return}else return J.add(_),se(_,xa(X)),it(ke,_e,!1,{fetcherSubmission:X,preventScrollReset:ve});if(vn(_e)){we(_,A,_e.error);return}}if(Gr(_e))throw cn(400,{type:"defer-action"});let nt=w.navigation.location||w.location,pt=oi(e.history,nt,Se.signal),pr=l||o,Vn=w.navigation.state!=="idle"?Ts(pr,w.navigation.location,c):w.matches;Oe(Vn,"Didn't find any matches after fetcher action");let er=++V;Y.set(_,er);let bu=xa(X,_e.data);w.fetchers.set(_,bu);let[oa,ws]=qg(e.history,w,Vn,X,nt,!1,d.v7_skipActionErrorRevalidation,W,fe,ee,te,L,J,pr,c,[U.route.id,_e]);ws.filter(Tt=>Tt.key!==_).forEach(Tt=>{let ii=Tt.key,Lm=w.fetchers.get(ii),WS=xa(void 0,Lm?Lm.data:void 0);w.fetchers.set(ii,WS),Me(ii),Tt.controller&&R.set(ii,Tt.controller)}),K({fetchers:new Map(w.fetchers)});let qo=()=>ws.forEach(Tt=>Me(Tt.key));Se.signal.addEventListener("abort",qo);let{loaderResults:Yo,fetcherResults:Ke}=await H(w,Vn,oa,ws,pt);if(Se.signal.aborted)return;Se.signal.removeEventListener("abort",qo),Y.delete(_),R.delete(_),ws.forEach(Tt=>R.delete(Tt.key));let bt=hl(Yo);if(bt)return it(pt,bt.result,!1,{preventScrollReset:ve});if(bt=hl(Ke),bt)return J.add(bt.key),it(pt,bt.result,!1,{preventScrollReset:ve});let{loaderData:si,errors:la}=Zg(w,Vn,Yo,void 0,ws,Ke,pe);if(w.fetchers.has(_)){let Tt=zr(_e.data);w.fetchers.set(_,Tt)}tt(er),w.navigation.state==="loading"&&er>E?(Oe(C,"Expected pending action"),T&&T.abort(),$(w.navigation.location,{matches:Vn,loaderData:si,errors:la,fetchers:new Map(w.fetchers)})):(K({errors:la,loaderData:e0(w.loaderData,si,Vn,la),fetchers:new Map(w.fetchers)}),W=!1)}async function Ye(_,A,I,U,ue,me,Pe,ve,X){let re=w.fetchers.get(_);se(_,xa(X,re?re.data:void 0),{flushSync:Pe});let de=new AbortController,Se=oi(e.history,I,de.signal);if(me){let _e=await Zn(ue,new URL(Se.url).pathname,Se.signal,_);if(_e.type==="aborted")return;if(_e.type==="error"){we(_,A,_e.error,{flushSync:Pe});return}else if(_e.matches)ue=_e.matches,U=Da(ue,I);else{we(_,A,cn(404,{pathname:I}),{flushSync:Pe});return}}R.set(_,de);let ke=V,De=(await Et("loader",w,Se,[U],ue,_))[U.route.id];if(Gr(De)&&(De=await hp(De,Se.signal,!0)||De),R.get(_)===de&&R.delete(_),!Se.signal.aborted){if(te.has(_)){se(_,zr(void 0));return}if(Is(De))if(E>ke){se(_,zr(void 0));return}else{J.add(_),await it(Se,De,!1,{preventScrollReset:ve});return}if(vn(De)){we(_,A,De.error);return}Oe(!Gr(De),"Unhandled fetcher deferred data"),se(_,zr(De.data))}}async function it(_,A,I,U){let{submission:ue,fetcherSubmission:me,preventScrollReset:Pe,replace:ve}=U===void 0?{}:U;A.response.headers.has("X-Remix-Revalidate")&&(W=!0);let X=A.response.headers.get("Location");Oe(X,"Expected a Location header on the redirect Response"),X=Qg(X,new URL(_.url),c,e.history);let re=mo(w.location,X,{_isRedirect:!0});if(n){let _e=!1;if(A.response.headers.has("X-Remix-Reload-Document"))_e=!0;else if(fp.test(X)){const nt=e.history.createURL(X);_e=nt.origin!==t.location.origin||Jn(nt.pathname,c)==null}if(_e){ve?t.location.replace(X):t.location.assign(X);return}}T=null;let de=ve===!0||A.response.headers.has("X-Remix-Replace")?At.Replace:At.Push,{formMethod:Se,formAction:ke,formEncType:Fe}=w.navigation;!ue&&!me&&Se&&ke&&Fe&&(ue=s0(w.navigation));let De=ue||me;if(YN.has(A.response.status)&&De&&Wn(De.formMethod))await ye(de,re,{submission:ft({},De,{formAction:X}),preventScrollReset:Pe||D,enableViewTransition:I?M:void 0});else{let _e=Yu(re,ue);await ye(de,re,{overrideNavigation:_e,fetcherSubmission:me,preventScrollReset:Pe||D,enableViewTransition:I?M:void 0})}}async function Et(_,A,I,U,ue,me){let Pe,ve={};try{Pe=await rC(u,_,A,I,U,ue,me,i,s)}catch(X){return U.forEach(re=>{ve[re.route.id]={type:Xe.error,error:X}}),ve}for(let[X,re]of Object.entries(Pe))if(cC(re)){let de=re.result;ve[X]={type:Xe.redirect,response:aC(de,I,X,ue,c,d.v7_relativeSplatPath)}}else ve[X]=await iC(re);return ve}async function H(_,A,I,U,ue){let me=_.matches,Pe=Et("loader",_,ue,I,A,null),ve=Promise.all(U.map(async de=>{if(de.matches&&de.match&&de.controller){let ke=(await Et("loader",_,oi(e.history,de.path,de.controller.signal),[de.match],de.matches,de.key))[de.match.route.id];return{[de.key]:ke}}else return Promise.resolve({[de.key]:{type:Xe.error,error:cn(404,{pathname:de.path})}})})),X=await Pe,re=(await ve).reduce((de,Se)=>Object.assign(de,Se),{});return await Promise.all([fC(A,X,ue.signal,me,_.loaderData),hC(A,re,U)]),{loaderResults:X,fetcherResults:re}}function G(){W=!0,fe.push(...ot()),L.forEach((_,A)=>{R.has(A)&&ee.add(A),Me(A)})}function se(_,A,I){I===void 0&&(I={}),w.fetchers.set(_,A),K({fetchers:new Map(w.fetchers)},{flushSync:(I&&I.flushSync)===!0})}function we(_,A,I,U){U===void 0&&(U={});let ue=Ps(w.matches,A);oe(_),K({errors:{[ue.route.id]:I},fetchers:new Map(w.fetchers)},{flushSync:(U&&U.flushSync)===!0})}function O(_){return Q.set(_,(Q.get(_)||0)+1),te.has(_)&&te.delete(_),w.fetchers.get(_)||XN}function oe(_){let A=w.fetchers.get(_);R.has(_)&&!(A&&A.state==="loading"&&Y.has(_))&&Me(_),L.delete(_),Y.delete(_),J.delete(_),d.v7_fetcherPersist&&te.delete(_),ee.delete(_),w.fetchers.delete(_)}function be(_){let A=(Q.get(_)||0)-1;A<=0?(Q.delete(_),te.add(_),d.v7_fetcherPersist||oe(_)):Q.set(_,A),K({fetchers:new Map(w.fetchers)})}function Me(_){let A=R.get(_);A&&(A.abort(),R.delete(_))}function et(_){for(let A of _){let I=O(A),U=zr(I.data);w.fetchers.set(A,U)}}function Ve(){let _=[],A=!1;for(let I of J){let U=w.fetchers.get(I);Oe(U,"Expected fetcher: "+I),U.state==="loading"&&(J.delete(I),_.push(I),A=!0)}return et(_),A}function tt(_){let A=[];for(let[I,U]of Y)if(U<_){let ue=w.fetchers.get(I);Oe(ue,"Expected fetcher: "+I),ue.state==="loading"&&(Me(I),Y.delete(I),A.push(I))}return et(A),A.length>0}function It(_,A){let I=w.blockers.get(_)||ci;return ne.get(_)!==A&&ne.set(_,A),I}function at(_){w.blockers.delete(_),ne.delete(_)}function Z(_,A){let I=w.blockers.get(_)||ci;Oe(I.state==="unblocked"&&A.state==="blocked"||I.state==="blocked"&&A.state==="blocked"||I.state==="blocked"&&A.state==="proceeding"||I.state==="blocked"&&A.state==="unblocked"||I.state==="proceeding"&&A.state==="unblocked","Invalid blocker state transition: "+I.state+" -> "+A.state);let U=new Map(w.blockers);U.set(_,A),K({blockers:U})}function je(_){let{currentLocation:A,nextLocation:I,historyAction:U}=_;if(ne.size===0)return;ne.size>1&&Gs(!1,"A router only supports one blocker at a time");let ue=Array.from(ne.entries()),[me,Pe]=ue[ue.length-1],ve=w.blockers.get(me);if(!(ve&&ve.state==="proceeding")&&Pe({currentLocation:A,nextLocation:I,historyAction:U}))return me}function ze(_){let A=cn(404,{pathname:_}),I=l||o,{matches:U,route:ue}=n0(I);return ot(),{notFoundMatches:U,route:ue,error:A}}function ot(_){let A=[];return pe.forEach((I,U)=>{(!_||_(U))&&(I.cancel(),A.push(U),pe.delete(U))}),A}function ys(_,A,I){if(x=_,k=A,b=I||null,!v&&w.navigation===qu){v=!0;let U=bs(w.location,w.matches);U!=null&&K({restoreScrollPosition:U})}return()=>{x=null,k=null,b=null}}function ri(_,A){return b&&b(_,A.map(U=>CN(U,w.loaderData)))||_.key}function vs(_,A){if(x&&k){let I=ri(_,A);x[I]=k()}}function bs(_,A){if(x){let I=ri(_,A),U=x[I];if(typeof U=="number")return U}return null}function hr(_,A,I){if(f)if(_){if(Object.keys(_[0].params).length>0)return{active:!0,matches:Vl(A,I,c,!0)}}else return{active:!0,matches:Vl(A,I,c,!0)||[]};return{active:!1,matches:null}}async function Zn(_,A,I,U){if(!f)return{type:"success",matches:_};let ue=_;for(;;){let me=l==null,Pe=l||o,ve=i;try{await f({signal:I,path:A,matches:ue,fetcherKey:U,patch:(de,Se)=>{I.aborted||Xg(de,Se,Pe,ve,s)}})}catch(de){return{type:"error",error:de,partialMatches:ue}}finally{me&&!I.aborted&&(o=[...o])}if(I.aborted)return{type:"aborted"};let X=Ts(Pe,A,c);if(X)return{type:"success",matches:X};let re=Vl(Pe,A,c,!0);if(!re||ue.length===re.length&&ue.every((de,Se)=>de.route.id===re[Se].route.id))return{type:"success",matches:null};ue=re}}function vu(_){i={},l=yc(_,s,void 0,i)}function Go(_,A){let I=l==null;Xg(_,A,l||o,i,s),I&&(o=[...o],K({}))}return N={get basename(){return c},get future(){return d},get state(){return w},get routes(){return o},get window(){return t},initialize:he,subscribe:Te,enableScrollRestoration:ys,navigate:xe,fetch:jt,revalidate:q,createHref:_=>e.history.createHref(_),encodeLocation:_=>e.history.encodeLocation(_),getFetcher:O,deleteFetcher:be,dispose:Ce,getBlocker:It,deleteBlocker:at,patchRoutes:Go,_internalFetchControllers:R,_internalActiveDeferreds:pe,_internalSetRoutes:vu},N}function ZN(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Tf(e,t,n,r,s,i,o,l){let c,u;if(o){c=[];for(let d of t)if(c.push(d),d.route.id===o){u=d;break}}else c=t,u=t[t.length-1];let f=Jc(s||".",Qc(c,i),Jn(e.pathname,n)||e.pathname,l==="path");if(s==null&&(f.search=e.search,f.hash=e.hash),(s==null||s===""||s===".")&&u){let d=pp(f.search);if(u.route.index&&!d)f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index";else if(!u.route.index&&d){let h=new URLSearchParams(f.search),p=h.getAll("index");h.delete("index"),p.filter(b=>b).forEach(b=>h.append("index",b));let x=h.toString();f.search=x?"?"+x:""}}return r&&n!=="/"&&(f.pathname=f.pathname==="/"?n:wr([n,f.pathname])),qs(f)}function Kg(e,t,n,r){if(!r||!ZN(r))return{path:n};if(r.formMethod&&!dC(r.formMethod))return{path:n,error:cn(405,{method:r.formMethod})};let s=()=>({path:n,error:cn(400,{type:"invalid-body"})}),i=r.formMethod||"get",o=e?i.toUpperCase():i.toLowerCase(),l=x1(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!Wn(o))return s();let h=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((p,x)=>{let[b,k]=x;return""+p+b+"="+k+`
50
+ `},""):String(r.body);return{path:n,submission:{formMethod:o,formAction:l,formEncType:r.formEncType,formData:void 0,json:void 0,text:h}}}else if(r.formEncType==="application/json"){if(!Wn(o))return s();try{let h=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:o,formAction:l,formEncType:r.formEncType,formData:void 0,json:h,text:void 0}}}catch{return s()}}}Oe(typeof FormData=="function","FormData is not available in this environment");let c,u;if(r.formData)c=Af(r.formData),u=r.formData;else if(r.body instanceof FormData)c=Af(r.body),u=r.body;else if(r.body instanceof URLSearchParams)c=r.body,u=Jg(c);else if(r.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(r.body),u=Jg(c)}catch{return s()}let f={formMethod:o,formAction:l,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(Wn(f.formMethod))return{path:n,submission:f};let d=ps(n);return t&&d.search&&pp(d.search)&&c.append("index",""),d.search="?"+c,{path:qs(d),submission:f}}function Gg(e,t,n){n===void 0&&(n=!1);let r=e.findIndex(s=>s.route.id===t);return r>=0?e.slice(0,n?r+1:r):e}function qg(e,t,n,r,s,i,o,l,c,u,f,d,h,p,x,b){let k=b?vn(b[1])?b[1].error:b[1].data:void 0,v=e.createURL(t.location),m=e.createURL(s),y=n;i&&t.errors?y=Gg(n,Object.keys(t.errors)[0],!0):b&&vn(b[1])&&(y=Gg(n,b[0]));let j=b?b[1].statusCode:void 0,S=o&&j&&j>=400,N=y.filter((C,D)=>{let{route:T}=C;if(T.lazy)return!0;if(T.loader==null)return!1;if(i)return Pf(T,t.loaderData,t.errors);if(eC(t.loaderData,t.matches[D],C)||c.some(F=>F===C.route.id))return!0;let M=t.matches[D],P=C;return Yg(C,ft({currentUrl:v,currentParams:M.params,nextUrl:m,nextParams:P.params},r,{actionResult:k,actionStatus:j,defaultShouldRevalidate:S?!1:l||v.pathname+v.search===m.pathname+m.search||v.search!==m.search||m1(M,P)}))}),w=[];return d.forEach((C,D)=>{if(i||!n.some(z=>z.route.id===C.routeId)||f.has(D))return;let T=Ts(p,C.path,x);if(!T){w.push({key:D,routeId:C.routeId,path:C.path,matches:null,match:null,controller:null});return}let M=t.fetchers.get(D),P=Da(T,C.path),F=!1;h.has(D)?F=!1:u.has(D)?(u.delete(D),F=!0):M&&M.state!=="idle"&&M.data===void 0?F=l:F=Yg(P,ft({currentUrl:v,currentParams:t.matches[t.matches.length-1].params,nextUrl:m,nextParams:n[n.length-1].params},r,{actionResult:k,actionStatus:j,defaultShouldRevalidate:S?!1:l})),F&&w.push({key:D,routeId:C.routeId,path:C.path,matches:T,match:P,controller:new AbortController})}),[N,w]}function Pf(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let r=t!=null&&t[e.id]!==void 0,s=n!=null&&n[e.id]!==void 0;return!r&&s?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!s}function eC(e,t,n){let r=!t||n.route.id!==t.route.id,s=e[n.route.id]===void 0;return r||s}function m1(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Yg(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Xg(e,t,n,r,s){var i;let o;if(e){let u=r[e];Oe(u,"No route found to patch children into: routeId = "+e),u.children||(u.children=[]),o=u.children}else o=n;let l=t.filter(u=>!o.some(f=>g1(u,f))),c=yc(l,s,[e||"_","patch",String(((i=o)==null?void 0:i.length)||"0")],r);o.push(...c)}function g1(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>{var s;return(s=t.children)==null?void 0:s.some(i=>g1(n,i))}):!1}async function tC(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let s=n[e.id];Oe(s,"No route found in manifest");let i={};for(let o in r){let c=s[o]!==void 0&&o!=="hasErrorBoundary";Gs(!c,'Route "'+s.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!c&&!jN.has(o)&&(i[o]=r[o])}Object.assign(s,i),Object.assign(s,ft({},t(s),{lazy:void 0}))}async function nC(e){let{matches:t}=e,n=t.filter(s=>s.shouldLoad);return(await Promise.all(n.map(s=>s.resolve()))).reduce((s,i,o)=>Object.assign(s,{[n[o].route.id]:i}),{})}async function rC(e,t,n,r,s,i,o,l,c,u){let f=i.map(p=>p.route.lazy?tC(p.route,c,l):void 0),d=i.map((p,x)=>{let b=f[x],k=s.some(m=>m.route.id===p.route.id);return ft({},p,{shouldLoad:k,resolve:async m=>(m&&r.method==="GET"&&(p.route.lazy||p.route.loader)&&(k=!0),k?sC(t,r,p,b,m,u):Promise.resolve({type:Xe.data,result:void 0}))})}),h=await e({matches:d,request:r,params:i[0].params,fetcherKey:o,context:u});try{await Promise.all(f)}catch{}return h}async function sC(e,t,n,r,s,i){let o,l,c=u=>{let f,d=new Promise((x,b)=>f=b);l=()=>f(),t.signal.addEventListener("abort",l);let h=x=>typeof u!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):u({request:t,params:n.params,context:i},...x!==void 0?[x]:[]),p=(async()=>{try{return{type:"data",result:await(s?s(b=>h(b)):h())}}catch(x){return{type:"error",result:x}}})();return Promise.race([p,d])};try{let u=n.route[e];if(r)if(u){let f,[d]=await Promise.all([c(u).catch(h=>{f=h}),r]);if(f!==void 0)throw f;o=d}else if(await r,u=n.route[e],u)o=await c(u);else if(e==="action"){let f=new URL(t.url),d=f.pathname+f.search;throw cn(405,{method:t.method,pathname:d,routeId:n.route.id})}else return{type:Xe.data,result:void 0};else if(u)o=await c(u);else{let f=new URL(t.url),d=f.pathname+f.search;throw cn(404,{pathname:d})}Oe(o.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(u){return{type:Xe.error,result:u}}finally{l&&t.signal.removeEventListener("abort",l)}return o}async function iC(e){let{result:t,type:n}=e;if(y1(t)){let d;try{let h=t.headers.get("Content-Type");h&&/\bapplication\/json\b/.test(h)?t.body==null?d=null:d=await t.json():d=await t.text()}catch(h){return{type:Xe.error,error:h}}return n===Xe.error?{type:Xe.error,error:new bc(t.status,t.statusText,d),statusCode:t.status,headers:t.headers}:{type:Xe.data,data:d,statusCode:t.status,headers:t.headers}}if(n===Xe.error){if(r0(t)){var r,s;if(t.data instanceof Error){var i,o;return{type:Xe.error,error:t.data,statusCode:(i=t.init)==null?void 0:i.status,headers:(o=t.init)!=null&&o.headers?new Headers(t.init.headers):void 0}}return{type:Xe.error,error:new bc(((r=t.init)==null?void 0:r.status)||500,void 0,t.data),statusCode:go(t)?t.status:void 0,headers:(s=t.init)!=null&&s.headers?new Headers(t.init.headers):void 0}}return{type:Xe.error,error:t,statusCode:go(t)?t.status:void 0}}if(uC(t)){var l,c;return{type:Xe.deferred,deferredData:t,statusCode:(l=t.init)==null?void 0:l.status,headers:((c=t.init)==null?void 0:c.headers)&&new Headers(t.init.headers)}}if(r0(t)){var u,f;return{type:Xe.data,data:t.data,statusCode:(u=t.init)==null?void 0:u.status,headers:(f=t.init)!=null&&f.headers?new Headers(t.init.headers):void 0}}return{type:Xe.data,data:t}}function aC(e,t,n,r,s,i){let o=e.headers.get("Location");if(Oe(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!fp.test(o)){let l=r.slice(0,r.findIndex(c=>c.route.id===n)+1);o=Tf(new URL(t.url),l,s,!0,o,i),e.headers.set("Location",o)}return e}function Qg(e,t,n,r){let s=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(fp.test(e)){let i=e,o=i.startsWith("//")?new URL(t.protocol+i):new URL(i);if(s.includes(o.protocol))throw new Error("Invalid redirect location");let l=Jn(o.pathname,n)!=null;if(o.origin===t.origin&&l)return o.pathname+o.search+o.hash}try{let i=r.createURL(e);if(s.includes(i.protocol))throw new Error("Invalid redirect location")}catch{}return e}function oi(e,t,n,r){let s=e.createURL(x1(t)).toString(),i={signal:n};if(r&&Wn(r.formMethod)){let{formMethod:o,formEncType:l}=r;i.method=o.toUpperCase(),l==="application/json"?(i.headers=new Headers({"Content-Type":l}),i.body=JSON.stringify(r.json)):l==="text/plain"?i.body=r.text:l==="application/x-www-form-urlencoded"&&r.formData?i.body=Af(r.formData):i.body=r.formData}return new Request(s,i)}function Af(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Jg(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function oC(e,t,n,r,s){let i={},o=null,l,c=!1,u={},f=n&&vn(n[1])?n[1].error:void 0;return e.forEach(d=>{if(!(d.route.id in t))return;let h=d.route.id,p=t[h];if(Oe(!Is(p),"Cannot handle redirect results in processLoaderData"),vn(p)){let x=p.error;f!==void 0&&(x=f,f=void 0),o=o||{};{let b=Ps(e,h);o[b.route.id]==null&&(o[b.route.id]=x)}i[h]=void 0,c||(c=!0,l=go(p.error)?p.error.status:500),p.headers&&(u[h]=p.headers)}else Gr(p)?(r.set(h,p.deferredData),i[h]=p.deferredData.data,p.statusCode!=null&&p.statusCode!==200&&!c&&(l=p.statusCode),p.headers&&(u[h]=p.headers)):(i[h]=p.data,p.statusCode&&p.statusCode!==200&&!c&&(l=p.statusCode),p.headers&&(u[h]=p.headers))}),f!==void 0&&n&&(o={[n[0]]:f},i[n[0]]=void 0),{loaderData:i,errors:o,statusCode:l||200,loaderHeaders:u}}function Zg(e,t,n,r,s,i,o){let{loaderData:l,errors:c}=oC(t,n,r,o);return s.forEach(u=>{let{key:f,match:d,controller:h}=u,p=i[f];if(Oe(p,"Did not find corresponding fetcher result"),!(h&&h.signal.aborted))if(vn(p)){let x=Ps(e.matches,d==null?void 0:d.route.id);c&&c[x.route.id]||(c=ft({},c,{[x.route.id]:p.error})),e.fetchers.delete(f)}else if(Is(p))Oe(!1,"Unhandled fetcher revalidation redirect");else if(Gr(p))Oe(!1,"Unhandled fetcher deferred data");else{let x=zr(p.data);e.fetchers.set(f,x)}}),{loaderData:l,errors:c}}function e0(e,t,n,r){let s=ft({},t);for(let i of n){let o=i.route.id;if(t.hasOwnProperty(o)?t[o]!==void 0&&(s[o]=t[o]):e[o]!==void 0&&i.route.loader&&(s[o]=e[o]),r&&r.hasOwnProperty(o))break}return s}function t0(e){return e?vn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ps(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function n0(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function cn(e,t){let{pathname:n,routeId:r,method:s,type:i,message:o}=t===void 0?{}:t,l="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(l="Bad Request",s&&n&&r?c="You made a "+s+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":i==="defer-action"?c="defer() is not supported in actions":i==="invalid-body"&&(c="Unable to encode submission body")):e===403?(l="Forbidden",c='Route "'+r+'" does not match URL "'+n+'"'):e===404?(l="Not Found",c='No route matches URL "'+n+'"'):e===405&&(l="Method Not Allowed",s&&n&&r?c="You made a "+s.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":s&&(c='Invalid request method "'+s.toUpperCase()+'"')),new bc(e||500,l,new Error(c),!0)}function hl(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,s]=t[n];if(Is(s))return{key:r,result:s}}}function x1(e){let t=typeof e=="string"?ps(e):e;return qs(ft({},t,{hash:""}))}function lC(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function cC(e){return y1(e.result)&&qN.has(e.result.status)}function Gr(e){return e.type===Xe.deferred}function vn(e){return e.type===Xe.error}function Is(e){return(e&&e.type)===Xe.redirect}function r0(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function uC(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function y1(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function dC(e){return GN.has(e.toLowerCase())}function Wn(e){return WN.has(e.toLowerCase())}async function fC(e,t,n,r,s){let i=Object.entries(t);for(let o=0;o<i.length;o++){let[l,c]=i[o],u=e.find(h=>(h==null?void 0:h.route.id)===l);if(!u)continue;let f=r.find(h=>h.route.id===u.route.id),d=f!=null&&!m1(f,u)&&(s&&s[u.route.id])!==void 0;Gr(c)&&d&&await hp(c,n,!1).then(h=>{h&&(t[l]=h)})}}async function hC(e,t,n){for(let r=0;r<n.length;r++){let{key:s,routeId:i,controller:o}=n[r],l=t[s];e.find(u=>(u==null?void 0:u.route.id)===i)&&Gr(l)&&(Oe(o,"Expected an AbortController for revalidating fetcher deferred result"),await hp(l,o.signal,!0).then(u=>{u&&(t[s]=u)}))}}async function hp(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Xe.data,data:e.deferredData.unwrappedData}}catch(s){return{type:Xe.error,error:s}}return{type:Xe.data,data:e.deferredData.data}}}function pp(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Da(e,t){let n=typeof t=="string"?ps(t).search:t.search;if(e[e.length-1].route.index&&pp(n||""))return e[e.length-1];let r=f1(e);return r[r.length-1]}function s0(e){let{formMethod:t,formAction:n,formEncType:r,text:s,formData:i,json:o}=e;if(!(!t||!n||!r)){if(s!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:s};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function Yu(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function pC(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function xa(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function mC(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function zr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function gC(e,t){try{let n=e.sessionStorage.getItem(p1);if(n){let r=JSON.parse(n);for(let[s,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(s,new Set(i||[]))}}catch{}}function xC(e,t){if(t.size>0){let n={};for(let[r,s]of t)n[r]=[...s];try{e.sessionStorage.setItem(p1,JSON.stringify(n))}catch(r){Gs(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
51
+ * React Router v6.30.3
52
+ *
53
+ * Copyright (c) Remix Software Inc.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE.md file in the root directory of this source tree.
57
+ *
58
+ * @license MIT
59
+ */function $i(){return $i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$i.apply(this,arguments)}const _o=g.createContext(null),mp=g.createContext(null),Dr=g.createContext(null),gp=g.createContext(null),ur=g.createContext({outlet:null,matches:[],isDataRoute:!1}),v1=g.createContext(null);function yC(e,t){let{relative:n}=t===void 0?{}:t;ta()||Oe(!1);let{basename:r,navigator:s}=g.useContext(Dr),{hash:i,pathname:o,search:l}=Zc(e,{relative:n}),c=o;return r!=="/"&&(c=o==="/"?r:wr([r,o])),s.createHref({pathname:c,search:l,hash:i})}function ta(){return g.useContext(gp)!=null}function ms(){return ta()||Oe(!1),g.useContext(gp).location}function b1(e){g.useContext(Dr).static||g.useLayoutEffect(e)}function dr(){let{isDataRoute:e}=g.useContext(ur);return e?MC():vC()}function vC(){ta()||Oe(!1);let e=g.useContext(_o),{basename:t,future:n,navigator:r}=g.useContext(Dr),{matches:s}=g.useContext(ur),{pathname:i}=ms(),o=JSON.stringify(Qc(s,n.v7_relativeSplatPath)),l=g.useRef(!1);return b1(()=>{l.current=!0}),g.useCallback(function(u,f){if(f===void 0&&(f={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let d=Jc(u,JSON.parse(o),i,f.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:wr([t,d.pathname])),(f.replace?r.replace:r.push)(d,f.state,f)},[t,r,o,i,e])}const bC=g.createContext(null);function wC(e){let t=g.useContext(ur).outlet;return t&&g.createElement(bC.Provider,{value:e},t)}function kC(){let{matches:e}=g.useContext(ur),t=e[e.length-1];return t?t.params:{}}function Zc(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=g.useContext(Dr),{matches:s}=g.useContext(ur),{pathname:i}=ms(),o=JSON.stringify(Qc(s,r.v7_relativeSplatPath));return g.useMemo(()=>Jc(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function SC(e,t,n,r){ta()||Oe(!1);let{navigator:s}=g.useContext(Dr),{matches:i}=g.useContext(ur),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ms(),f;f=u;let d=f.pathname||"/",h=d;if(c!=="/"){let b=c.replace(/^\//,"").split("/");h="/"+d.replace(/^\//,"").split("/").slice(b.length).join("/")}let p=Ts(e,{pathname:h});return TC(p&&p.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:wr([c,s.encodeLocation?s.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:wr([c,s.encodeLocation?s.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),i,n,r)}function jC(){let e=AC(),t=go(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:s},n):null,null)}const NC=g.createElement(jC,null);class CC extends g.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?g.createElement(ur.Provider,{value:this.props.routeContext},g.createElement(v1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function EC(e){let{routeContext:t,match:n,children:r}=e,s=g.useContext(_o);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),g.createElement(ur.Provider,{value:t},r)}function TC(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(s=n)==null?void 0:s.errors;if(l!=null){let f=o.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id])!==void 0);f>=0||Oe(!1),o=o.slice(0,Math.min(o.length,f+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f<o.length;f++){let d=o[f];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=f),d.route.id){let{loaderData:h,errors:p}=n,x=d.route.loader&&h[d.route.id]===void 0&&(!p||p[d.route.id]===void 0);if(d.route.lazy||x){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((f,d,h)=>{let p,x=!1,b=null,k=null;n&&(p=l&&d.route.id?l[d.route.id]:void 0,b=d.route.errorElement||NC,c&&(u<0&&h===0?(IC("route-fallback"),x=!0,k=null):u===h&&(x=!0,k=d.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,h+1)),m=()=>{let y;return p?y=b:x?y=k:d.route.Component?y=g.createElement(d.route.Component,null):d.route.element?y=d.route.element:y=f,g.createElement(EC,{match:d,routeContext:{outlet:f,matches:v,isDataRoute:n!=null},children:y})};return n&&(d.route.ErrorBoundary||d.route.errorElement||h===0)?g.createElement(CC,{location:n.location,revalidation:n.revalidation,component:b,error:p,children:m(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):m()},null)}var xp=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(xp||{}),w1=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(w1||{});function k1(e){let t=g.useContext(_o);return t||Oe(!1),t}function S1(e){let t=g.useContext(mp);return t||Oe(!1),t}function PC(e){let t=g.useContext(ur);return t||Oe(!1),t}function j1(e){let t=PC(),n=t.matches[t.matches.length-1];return n.route.id||Oe(!1),n.route.id}function AC(){var e;let t=g.useContext(v1),n=S1(w1.UseRouteError),r=j1();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}let DC=0;function LC(e){let{router:t,basename:n}=k1(xp.UseBlocker),r=S1(),[s,i]=g.useState(""),o=g.useCallback(l=>{if(typeof e!="function")return!!e;if(n==="/")return e(l);let{currentLocation:c,nextLocation:u,historyAction:f}=l;return e({currentLocation:$i({},c,{pathname:Jn(c.pathname,n)||c.pathname}),nextLocation:$i({},u,{pathname:Jn(u.pathname,n)||u.pathname}),historyAction:f})},[n,e]);return g.useEffect(()=>{let l=String(++DC);return i(l),()=>t.deleteBlocker(l)},[t]),g.useEffect(()=>{s!==""&&t.getBlocker(s,o)},[t,s,o]),s&&r.blockers.has(s)?r.blockers.get(s):ci}function MC(){let{router:e}=k1(xp.UseNavigateStable),t=j1(),n=g.useRef(!1);return b1(()=>{n.current=!0}),g.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,$i({fromRouteId:t},i)))},[e,t])}const i0={};function IC(e,t,n){i0[e]||(i0[e]=!0)}function RC(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function Df(e){let{to:t,replace:n,state:r,relative:s}=e;ta()||Oe(!1);let{future:i,static:o}=g.useContext(Dr),{matches:l}=g.useContext(ur),{pathname:c}=ms(),u=dr(),f=Jc(t,Qc(l,i.v7_relativeSplatPath),c,s==="path"),d=JSON.stringify(f);return g.useEffect(()=>u(JSON.parse(d),{replace:n,state:r,relative:s}),[u,d,s,n,r]),null}function yp(e){return wC(e.context)}function _C(e){let{basename:t="/",children:n=null,location:r,navigationType:s=At.Pop,navigator:i,static:o=!1,future:l}=e;ta()&&Oe(!1);let c=t.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:c,navigator:i,static:o,future:$i({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof r=="string"&&(r=ps(r));let{pathname:f="/",search:d="",hash:h="",state:p=null,key:x="default"}=r,b=g.useMemo(()=>{let k=Jn(f,c);return k==null?null:{location:{pathname:k,search:d,hash:h,state:p,key:x},navigationType:s}},[c,f,d,h,p,x,s]);return b==null?null:g.createElement(Dr.Provider,{value:u},g.createElement(gp.Provider,{children:n,value:b}))}new Promise(()=>{});function FC(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:g.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:g.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:g.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
60
+ * React Router DOM v6.30.3
61
+ *
62
+ * Copyright (c) Remix Software Inc.
63
+ *
64
+ * This source code is licensed under the MIT license found in the
65
+ * LICENSE.md file in the root directory of this source tree.
66
+ *
67
+ * @license MIT
68
+ */function Hi(){return Hi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hi.apply(this,arguments)}function N1(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function OC(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zC(e,t){return e.button===0&&(!t||t==="_self")&&!OC(e)}function Lf(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function VC(e,t){let n=Lf(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(i=>{n.append(s,i)})}),n}const BC=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],UC=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],$C="6";try{window.__reactRouterVersion=$C}catch{}function HC(e,t){return JN({basename:void 0,future:Hi({},void 0,{v7_prependBasename:!0}),history:wN({window:void 0}),hydrationData:WC(),routes:e,mapRouteProperties:FC,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function WC(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Hi({},t,{errors:KC(t.errors)})),t}function KC(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,s]of t)if(s&&s.__type==="RouteErrorResponse")n[r]=new bc(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(s.__subType){let i=window[s.__subType];if(typeof i=="function")try{let o=new i(s.message);o.stack="",n[r]=o}catch{}}if(n[r]==null){let i=new Error(s.message);i.stack="",n[r]=i}}else n[r]=s;return n}const C1=g.createContext({isTransitioning:!1}),GC=g.createContext(new Map),qC="startTransition",a0=lj[qC],YC="flushSync",o0=bN[YC];function XC(e){a0?a0(e):e()}function ya(e){o0?o0(e):e()}class QC{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function JC(e){let{fallbackElement:t,router:n,future:r}=e,[s,i]=g.useState(n.state),[o,l]=g.useState(),[c,u]=g.useState({isTransitioning:!1}),[f,d]=g.useState(),[h,p]=g.useState(),[x,b]=g.useState(),k=g.useRef(new Map),{v7_startTransition:v}=r||{},m=g.useCallback(C=>{v?XC(C):C()},[v]),y=g.useCallback((C,D)=>{let{deletedFetchers:T,flushSync:M,viewTransitionOpts:P}=D;C.fetchers.forEach((z,W)=>{z.data!==void 0&&k.current.set(W,z.data)}),T.forEach(z=>k.current.delete(z));let F=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!P||F){M?ya(()=>i(C)):m(()=>i(C));return}if(M){ya(()=>{h&&(f&&f.resolve(),h.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:P.currentLocation,nextLocation:P.nextLocation})});let z=n.window.document.startViewTransition(()=>{ya(()=>i(C))});z.finished.finally(()=>{ya(()=>{d(void 0),p(void 0),l(void 0),u({isTransitioning:!1})})}),ya(()=>p(z));return}h?(f&&f.resolve(),h.skipTransition(),b({state:C,currentLocation:P.currentLocation,nextLocation:P.nextLocation})):(l(C),u({isTransitioning:!0,flushSync:!1,currentLocation:P.currentLocation,nextLocation:P.nextLocation}))},[n.window,h,f,k,m]);g.useLayoutEffect(()=>n.subscribe(y),[n,y]),g.useEffect(()=>{c.isTransitioning&&!c.flushSync&&d(new QC)},[c]),g.useEffect(()=>{if(f&&o&&n.window){let C=o,D=f.promise,T=n.window.document.startViewTransition(async()=>{m(()=>i(C)),await D});T.finished.finally(()=>{d(void 0),p(void 0),l(void 0),u({isTransitioning:!1})}),p(T)}},[m,o,f,n.window]),g.useEffect(()=>{f&&o&&s.location.key===o.location.key&&f.resolve()},[f,h,s.location,o]),g.useEffect(()=>{!c.isTransitioning&&x&&(l(x.state),u({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),b(void 0))},[c.isTransitioning,x]),g.useEffect(()=>{},[]);let j=g.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:C=>n.navigate(C),push:(C,D,T)=>n.navigate(C,{state:D,preventScrollReset:T==null?void 0:T.preventScrollReset}),replace:(C,D,T)=>n.navigate(C,{replace:!0,state:D,preventScrollReset:T==null?void 0:T.preventScrollReset})}),[n]),S=n.basename||"/",N=g.useMemo(()=>({router:n,navigator:j,static:!1,basename:S}),[n,j,S]),w=g.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return g.useEffect(()=>RC(r,n.future),[r,n.future]),g.createElement(g.Fragment,null,g.createElement(_o.Provider,{value:N},g.createElement(mp.Provider,{value:s},g.createElement(GC.Provider,{value:k.current},g.createElement(C1.Provider,{value:c},g.createElement(_C,{basename:S,location:s.location,navigationType:s.historyAction,navigator:j,future:w},s.initialized||n.future.v7_partialHydration?g.createElement(ZC,{routes:n.routes,future:n.future,state:s}):t))))),null)}const ZC=g.memo(e5);function e5(e){let{routes:t,future:n,state:r}=e;return SC(t,void 0,r,n)}const t5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",n5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,r5=g.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:f,viewTransition:d}=t,h=N1(t,BC),{basename:p}=g.useContext(Dr),x,b=!1;if(typeof u=="string"&&n5.test(u)&&(x=u,t5))try{let y=new URL(window.location.href),j=u.startsWith("//")?new URL(y.protocol+u):new URL(u),S=Jn(j.pathname,p);j.origin===y.origin&&S!=null?u=S+j.search+j.hash:b=!0}catch{}let k=yC(u,{relative:s}),v=i5(u,{replace:o,state:l,target:c,preventScrollReset:f,relative:s,viewTransition:d});function m(y){r&&r(y),y.defaultPrevented||v(y)}return g.createElement("a",Hi({},h,{href:x||k,onClick:b||i?r:m,ref:n,target:c}))}),Mf=g.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:s=!1,className:i="",end:o=!1,style:l,to:c,viewTransition:u,children:f}=t,d=N1(t,UC),h=Zc(c,{relative:d.relative}),p=ms(),x=g.useContext(mp),{navigator:b,basename:k}=g.useContext(Dr),v=x!=null&&a5(h)&&u===!0,m=b.encodeLocation?b.encodeLocation(h).pathname:h.pathname,y=p.pathname,j=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;s||(y=y.toLowerCase(),j=j?j.toLowerCase():null,m=m.toLowerCase()),j&&k&&(j=Jn(j,k)||j);const S=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let N=y===m||!o&&y.startsWith(m)&&y.charAt(S)==="/",w=j!=null&&(j===m||!o&&j.startsWith(m)&&j.charAt(m.length)==="/"),C={isActive:N,isPending:w,isTransitioning:v},D=N?r:void 0,T;typeof i=="function"?T=i(C):T=[i,N?"active":null,w?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let M=typeof l=="function"?l(C):l;return g.createElement(r5,Hi({},d,{"aria-current":D,className:T,ref:n,style:M,to:c,viewTransition:u}),typeof f=="function"?f(C):f)});var If;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(If||(If={}));var l0;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(l0||(l0={}));function s5(e){let t=g.useContext(_o);return t||Oe(!1),t}function i5(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=dr(),u=ms(),f=Zc(e,{relative:o});return g.useCallback(d=>{if(zC(d,n)){d.preventDefault();let h=r!==void 0?r:qs(u)===qs(f);c(e,{replace:h,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,f,r,s,n,e,i,o,l])}function eu(e){let t=g.useRef(Lf(e)),n=g.useRef(!1),r=ms(),s=g.useMemo(()=>VC(r.search,n.current?null:t.current),[r.search]),i=dr(),o=g.useCallback((l,c)=>{const u=Lf(typeof l=="function"?l(s):l);n.current=!0,i("?"+u,c)},[i,s]);return[s,o]}function a5(e,t){t===void 0&&(t={});let n=g.useContext(C1);n==null&&Oe(!1);let{basename:r}=s5(If.useViewTransitionState),s=Zc(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Jn(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Jn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return vc(s.pathname,o)!=null||vc(s.pathname,i)!=null}/**
69
+ * @license lucide-react v0.395.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */const o5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),E1=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
74
+ * @license lucide-react v0.395.0 - ISC
75
+ *
76
+ * This source code is licensed under the ISC license.
77
+ * See the LICENSE file in the root directory of this source tree.
78
+ */var l5={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"};/**
79
+ * @license lucide-react v0.395.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */const c5=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>g.createElement("svg",{ref:c,...l5,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:E1("lucide",s),...l},[...o.map(([u,f])=>g.createElement(u,f)),...Array.isArray(i)?i:[i]]));/**
84
+ * @license lucide-react v0.395.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const le=(e,t)=>{const n=g.forwardRef(({className:r,...s},i)=>g.createElement(c5,{ref:i,iconNode:t,className:E1(`lucide-${o5(e)}`,r),...s}));return n.displayName=`${e}`,n};/**
89
+ * @license lucide-react v0.395.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */const u5=le("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
94
+ * @license lucide-react v0.395.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const d5=le("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
99
+ * @license lucide-react v0.395.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const T1=le("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
104
+ * @license lucide-react v0.395.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */const c0=le("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
109
+ * @license lucide-react v0.395.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const f5=le("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
114
+ * @license lucide-react v0.395.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const vp=le("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
119
+ * @license lucide-react v0.395.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */const Wi=le("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
124
+ * @license lucide-react v0.395.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */const h5=le("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
129
+ * @license lucide-react v0.395.0 - ISC
130
+ *
131
+ * This source code is licensed under the ISC license.
132
+ * See the LICENSE file in the root directory of this source tree.
133
+ */const p5=le("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/**
134
+ * @license lucide-react v0.395.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ */const P1=le("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
139
+ * @license lucide-react v0.395.0 - ISC
140
+ *
141
+ * This source code is licensed under the ISC license.
142
+ * See the LICENSE file in the root directory of this source tree.
143
+ */const m5=le("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/**
144
+ * @license lucide-react v0.395.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */const qt=le("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
149
+ * @license lucide-react v0.395.0 - ISC
150
+ *
151
+ * This source code is licensed under the ISC license.
152
+ * See the LICENSE file in the root directory of this source tree.
153
+ */const rs=le("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
154
+ * @license lucide-react v0.395.0 - ISC
155
+ *
156
+ * This source code is licensed under the ISC license.
157
+ * See the LICENSE file in the root directory of this source tree.
158
+ */const os=le("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
159
+ * @license lucide-react v0.395.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */const Bl=le("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
164
+ * @license lucide-react v0.395.0 - ISC
165
+ *
166
+ * This source code is licensed under the ISC license.
167
+ * See the LICENSE file in the root directory of this source tree.
168
+ */const xo=le("CircleAlert",[["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"}]]);/**
169
+ * @license lucide-react v0.395.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */const Lr=le("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
174
+ * @license lucide-react v0.395.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ */const g5=le("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
179
+ * @license lucide-react v0.395.0 - ISC
180
+ *
181
+ * This source code is licensed under the ISC license.
182
+ * See the LICENSE file in the root directory of this source tree.
183
+ */const ei=le("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
184
+ * @license lucide-react v0.395.0 - ISC
185
+ *
186
+ * This source code is licensed under the ISC license.
187
+ * See the LICENSE file in the root directory of this source tree.
188
+ */const A1=le("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
189
+ * @license lucide-react v0.395.0 - ISC
190
+ *
191
+ * This source code is licensed under the ISC license.
192
+ * See the LICENSE file in the root directory of this source tree.
193
+ */const u0=le("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
194
+ * @license lucide-react v0.395.0 - ISC
195
+ *
196
+ * This source code is licensed under the ISC license.
197
+ * See the LICENSE file in the root directory of this source tree.
198
+ */const Ys=le("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
199
+ * @license lucide-react v0.395.0 - ISC
200
+ *
201
+ * This source code is licensed under the ISC license.
202
+ * See the LICENSE file in the root directory of this source tree.
203
+ */const x5=le("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
204
+ * @license lucide-react v0.395.0 - ISC
205
+ *
206
+ * This source code is licensed under the ISC license.
207
+ * See the LICENSE file in the root directory of this source tree.
208
+ */const Rs=le("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
209
+ * @license lucide-react v0.395.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */const D1=le("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
214
+ * @license lucide-react v0.395.0 - ISC
215
+ *
216
+ * This source code is licensed under the ISC license.
217
+ * See the LICENSE file in the root directory of this source tree.
218
+ */const y5=le("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
219
+ * @license lucide-react v0.395.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */const Rf=le("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
224
+ * @license lucide-react v0.395.0 - ISC
225
+ *
226
+ * This source code is licensed under the ISC license.
227
+ * See the LICENSE file in the root directory of this source tree.
228
+ */const Xs=le("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
229
+ * @license lucide-react v0.395.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */const L1=le("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
234
+ * @license lucide-react v0.395.0 - ISC
235
+ *
236
+ * This source code is licensed under the ISC license.
237
+ * See the LICENSE file in the root directory of this source tree.
238
+ */const v5=le("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
239
+ * @license lucide-react v0.395.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */const Fo=le("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
244
+ * @license lucide-react v0.395.0 - ISC
245
+ *
246
+ * This source code is licensed under the ISC license.
247
+ * See the LICENSE file in the root directory of this source tree.
248
+ */const qr=le("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
249
+ * @license lucide-react v0.395.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */const b5=le("FileKey",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"10",cy:"16",r:"2",key:"4ckbqe"}],["path",{d:"m16 10-4.5 4.5",key:"7p3ebg"}],["path",{d:"m15 11 1 1",key:"1bsyx3"}]]);/**
254
+ * @license lucide-react v0.395.0 - ISC
255
+ *
256
+ * This source code is licensed under the ISC license.
257
+ * See the LICENSE file in the root directory of this source tree.
258
+ */const w5=le("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
259
+ * @license lucide-react v0.395.0 - ISC
260
+ *
261
+ * This source code is licensed under the ISC license.
262
+ * See the LICENSE file in the root directory of this source tree.
263
+ */const k5=le("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/**
264
+ * @license lucide-react v0.395.0 - ISC
265
+ *
266
+ * This source code is licensed under the ISC license.
267
+ * See the LICENSE file in the root directory of this source tree.
268
+ */const M1=le("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/**
269
+ * @license lucide-react v0.395.0 - ISC
270
+ *
271
+ * This source code is licensed under the ISC license.
272
+ * See the LICENSE file in the root directory of this source tree.
273
+ */const bp=le("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/**
274
+ * @license lucide-react v0.395.0 - ISC
275
+ *
276
+ * This source code is licensed under the ISC license.
277
+ * See the LICENSE file in the root directory of this source tree.
278
+ */const Oo=le("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
279
+ * @license lucide-react v0.395.0 - ISC
280
+ *
281
+ * This source code is licensed under the ISC license.
282
+ * See the LICENSE file in the root directory of this source tree.
283
+ */const I1=le("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
284
+ * @license lucide-react v0.395.0 - ISC
285
+ *
286
+ * This source code is licensed under the ISC license.
287
+ * See the LICENSE file in the root directory of this source tree.
288
+ */const R1=le("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
289
+ * @license lucide-react v0.395.0 - ISC
290
+ *
291
+ * This source code is licensed under the ISC license.
292
+ * See the LICENSE file in the root directory of this source tree.
293
+ */const tu=le("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
294
+ * @license lucide-react v0.395.0 - ISC
295
+ *
296
+ * This source code is licensed under the ISC license.
297
+ * See the LICENSE file in the root directory of this source tree.
298
+ */const Tr=le("KeyRound",[["path",{d:"M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z",key:"167ctg"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
299
+ * @license lucide-react v0.395.0 - ISC
300
+ *
301
+ * This source code is licensed under the ISC license.
302
+ * See the LICENSE file in the root directory of this source tree.
303
+ */const S5=le("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
304
+ * @license lucide-react v0.395.0 - ISC
305
+ *
306
+ * This source code is licensed under the ISC license.
307
+ * See the LICENSE file in the root directory of this source tree.
308
+ */const wp=le("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
309
+ * @license lucide-react v0.395.0 - ISC
310
+ *
311
+ * This source code is licensed under the ISC license.
312
+ * See the LICENSE file in the root directory of this source tree.
313
+ */const _1=le("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
314
+ * @license lucide-react v0.395.0 - ISC
315
+ *
316
+ * This source code is licensed under the ISC license.
317
+ * See the LICENSE file in the root directory of this source tree.
318
+ */const j5=le("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
319
+ * @license lucide-react v0.395.0 - ISC
320
+ *
321
+ * This source code is licensed under the ISC license.
322
+ * See the LICENSE file in the root directory of this source tree.
323
+ */const Ae=le("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
324
+ * @license lucide-react v0.395.0 - ISC
325
+ *
326
+ * This source code is licensed under the ISC license.
327
+ * See the LICENSE file in the root directory of this source tree.
328
+ */const wc=le("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
329
+ * @license lucide-react v0.395.0 - ISC
330
+ *
331
+ * This source code is licensed under the ISC license.
332
+ * See the LICENSE file in the root directory of this source tree.
333
+ */const N5=le("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
334
+ * @license lucide-react v0.395.0 - ISC
335
+ *
336
+ * This source code is licensed under the ISC license.
337
+ * See the LICENSE file in the root directory of this source tree.
338
+ */const C5=le("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
339
+ * @license lucide-react v0.395.0 - ISC
340
+ *
341
+ * This source code is licensed under the ISC license.
342
+ * See the LICENSE file in the root directory of this source tree.
343
+ */const E5=le("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
344
+ * @license lucide-react v0.395.0 - ISC
345
+ *
346
+ * This source code is licensed under the ISC license.
347
+ * See the LICENSE file in the root directory of this source tree.
348
+ */const kp=le("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
349
+ * @license lucide-react v0.395.0 - ISC
350
+ *
351
+ * This source code is licensed under the ISC license.
352
+ * See the LICENSE file in the root directory of this source tree.
353
+ */const Sp=le("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
354
+ * @license lucide-react v0.395.0 - ISC
355
+ *
356
+ * This source code is licensed under the ISC license.
357
+ * See the LICENSE file in the root directory of this source tree.
358
+ */const zo=le("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
359
+ * @license lucide-react v0.395.0 - ISC
360
+ *
361
+ * This source code is licensed under the ISC license.
362
+ * See the LICENSE file in the root directory of this source tree.
363
+ */const T5=le("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
364
+ * @license lucide-react v0.395.0 - ISC
365
+ *
366
+ * This source code is licensed under the ISC license.
367
+ * See the LICENSE file in the root directory of this source tree.
368
+ */const yo=le("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
369
+ * @license lucide-react v0.395.0 - ISC
370
+ *
371
+ * This source code is licensed under the ISC license.
372
+ * See the LICENSE file in the root directory of this source tree.
373
+ */const _f=le("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
374
+ * @license lucide-react v0.395.0 - ISC
375
+ *
376
+ * This source code is licensed under the ISC license.
377
+ * See the LICENSE file in the root directory of this source tree.
378
+ */const en=le("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
379
+ * @license lucide-react v0.395.0 - ISC
380
+ *
381
+ * This source code is licensed under the ISC license.
382
+ * See the LICENSE file in the root directory of this source tree.
383
+ */const P5=le("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
384
+ * @license lucide-react v0.395.0 - ISC
385
+ *
386
+ * This source code is licensed under the ISC license.
387
+ * See the LICENSE file in the root directory of this source tree.
388
+ */const F1=le("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
389
+ * @license lucide-react v0.395.0 - ISC
390
+ *
391
+ * This source code is licensed under the ISC license.
392
+ * See the LICENSE file in the root directory of this source tree.
393
+ */const Qt=le("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
394
+ * @license lucide-react v0.395.0 - ISC
395
+ *
396
+ * This source code is licensed under the ISC license.
397
+ * See the LICENSE file in the root directory of this source tree.
398
+ */const vo=le("SearchCode",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/**
399
+ * @license lucide-react v0.395.0 - ISC
400
+ *
401
+ * This source code is licensed under the ISC license.
402
+ * See the LICENSE file in the root directory of this source tree.
403
+ */const kn=le("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
404
+ * @license lucide-react v0.395.0 - ISC
405
+ *
406
+ * This source code is licensed under the ISC license.
407
+ * See the LICENSE file in the root directory of this source tree.
408
+ */const A5=le("SendHorizontal",[["path",{d:"m3 3 3 9-3 9 19-9Z",key:"1aobqy"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/**
409
+ * @license lucide-react v0.395.0 - ISC
410
+ *
411
+ * This source code is licensed under the ISC license.
412
+ * See the LICENSE file in the root directory of this source tree.
413
+ */const D5=le("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
414
+ * @license lucide-react v0.395.0 - ISC
415
+ *
416
+ * This source code is licensed under the ISC license.
417
+ * See the LICENSE file in the root directory of this source tree.
418
+ */const L5=le("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
419
+ * @license lucide-react v0.395.0 - ISC
420
+ *
421
+ * This source code is licensed under the ISC license.
422
+ * See the LICENSE file in the root directory of this source tree.
423
+ */const nu=le("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
424
+ * @license lucide-react v0.395.0 - ISC
425
+ *
426
+ * This source code is licensed under the ISC license.
427
+ * See the LICENSE file in the root directory of this source tree.
428
+ */const M5=le("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
429
+ * @license lucide-react v0.395.0 - ISC
430
+ *
431
+ * This source code is licensed under the ISC license.
432
+ * See the LICENSE file in the root directory of this source tree.
433
+ */const bo=le("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
434
+ * @license lucide-react v0.395.0 - ISC
435
+ *
436
+ * This source code is licensed under the ISC license.
437
+ * See the LICENSE file in the root directory of this source tree.
438
+ */const ru=le("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
439
+ * @license lucide-react v0.395.0 - ISC
440
+ *
441
+ * This source code is licensed under the ISC license.
442
+ * See the LICENSE file in the root directory of this source tree.
443
+ */const O1=le("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
444
+ * @license lucide-react v0.395.0 - ISC
445
+ *
446
+ * This source code is licensed under the ISC license.
447
+ * See the LICENSE file in the root directory of this source tree.
448
+ */const jp=le("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
449
+ * @license lucide-react v0.395.0 - ISC
450
+ *
451
+ * This source code is licensed under the ISC license.
452
+ * See the LICENSE file in the root directory of this source tree.
453
+ */const Np=le("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/**
454
+ * @license lucide-react v0.395.0 - ISC
455
+ *
456
+ * This source code is licensed under the ISC license.
457
+ * See the LICENSE file in the root directory of this source tree.
458
+ */const z1=le("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
459
+ * @license lucide-react v0.395.0 - ISC
460
+ *
461
+ * This source code is licensed under the ISC license.
462
+ * See the LICENSE file in the root directory of this source tree.
463
+ */const I5=le("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
464
+ * @license lucide-react v0.395.0 - ISC
465
+ *
466
+ * This source code is licensed under the ISC license.
467
+ * See the LICENSE file in the root directory of this source tree.
468
+ */const R5=le("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/**
469
+ * @license lucide-react v0.395.0 - ISC
470
+ *
471
+ * This source code is licensed under the ISC license.
472
+ * See the LICENSE file in the root directory of this source tree.
473
+ */const Cp=le("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
474
+ * @license lucide-react v0.395.0 - ISC
475
+ *
476
+ * This source code is licensed under the ISC license.
477
+ * See the LICENSE file in the root directory of this source tree.
478
+ */const Fn=le("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
479
+ * @license lucide-react v0.395.0 - ISC
480
+ *
481
+ * This source code is licensed under the ISC license.
482
+ * See the LICENSE file in the root directory of this source tree.
483
+ */const V1=le("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
484
+ * @license lucide-react v0.395.0 - ISC
485
+ *
486
+ * This source code is licensed under the ISC license.
487
+ * See the LICENSE file in the root directory of this source tree.
488
+ */const B1=le("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
489
+ * @license lucide-react v0.395.0 - ISC
490
+ *
491
+ * This source code is licensed under the ISC license.
492
+ * See the LICENSE file in the root directory of this source tree.
493
+ */const wo=le("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
494
+ * @license lucide-react v0.395.0 - ISC
495
+ *
496
+ * This source code is licensed under the ISC license.
497
+ * See the LICENSE file in the root directory of this source tree.
498
+ */const mn=le("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
499
+ * @license lucide-react v0.395.0 - ISC
500
+ *
501
+ * This source code is licensed under the ISC license.
502
+ * See the LICENSE file in the root directory of this source tree.
503
+ */const zs=le("TriangleAlert",[["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"}]]);/**
504
+ * @license lucide-react v0.395.0 - ISC
505
+ *
506
+ * This source code is licensed under the ISC license.
507
+ * See the LICENSE file in the root directory of this source tree.
508
+ */const Ff=le("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
509
+ * @license lucide-react v0.395.0 - ISC
510
+ *
511
+ * This source code is licensed under the ISC license.
512
+ * See the LICENSE file in the root directory of this source tree.
513
+ */const _5=le("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
514
+ * @license lucide-react v0.395.0 - ISC
515
+ *
516
+ * This source code is licensed under the ISC license.
517
+ * See the LICENSE file in the root directory of this source tree.
518
+ */const Ki=le("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
519
+ * @license lucide-react v0.395.0 - ISC
520
+ *
521
+ * This source code is licensed under the ISC license.
522
+ * See the LICENSE file in the root directory of this source tree.
523
+ */const ss=le("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
524
+ * @license lucide-react v0.395.0 - ISC
525
+ *
526
+ * This source code is licensed under the ISC license.
527
+ * See the LICENSE file in the root directory of this source tree.
528
+ */const F5=le("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
529
+ * @license lucide-react v0.395.0 - ISC
530
+ *
531
+ * This source code is licensed under the ISC license.
532
+ * See the LICENSE file in the root directory of this source tree.
533
+ */const Ep=le("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
534
+ * @license lucide-react v0.395.0 - ISC
535
+ *
536
+ * This source code is licensed under the ISC license.
537
+ * See the LICENSE file in the root directory of this source tree.
538
+ */const U1=le("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
539
+ * @license lucide-react v0.395.0 - ISC
540
+ *
541
+ * This source code is licensed under the ISC license.
542
+ * See the LICENSE file in the root directory of this source tree.
543
+ */const Ge=le("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
544
+ * @license lucide-react v0.395.0 - ISC
545
+ *
546
+ * This source code is licensed under the ISC license.
547
+ * See the LICENSE file in the root directory of this source tree.
548
+ */const su=le("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function $1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=$1(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function O5(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=$1(e))&&(r&&(r+=" "),r+=t);return r}const Tp="-",z5=e=>{const t=B5(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(Tp);return l[0]===""&&l.length!==1&&l.shift(),H1(l,t)||V5(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},H1=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?H1(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(Tp);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},d0=/^\[(.+)\]$/,V5=e=>{if(d0.test(e)){const t=d0.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},B5=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return $5(Object.entries(e.classGroups),n).forEach(([i,o])=>{Of(o,r,i,t)}),r},Of=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:f0(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(U5(s)){Of(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{Of(o,f0(t,i),n,r)})})},f0=(e,t)=>{let n=e;return t.split(Tp).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},U5=e=>e.isThemeGetter,$5=(e,t)=>t?e.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,s]}):e,H5=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},W1="!",W5=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let u=0,f=0,d;for(let k=0;k<l.length;k++){let v=l[k];if(u===0){if(v===s&&(r||l.slice(k,k+i)===t)){c.push(l.slice(f,k)),f=k+i;continue}if(v==="/"){d=k;continue}}v==="["?u++:v==="]"&&u--}const h=c.length===0?l:l.substring(f),p=h.startsWith(W1),x=p?h.substring(1):h,b=d&&d>f?d-f:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:b}};return n?l=>n({className:l,parseClassName:o}):o},K5=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},G5=e=>({cache:H5(e.cacheSize),parseClassName:W5(e),...z5(e)}),q5=/\s+/,Y5=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(q5);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:f,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let x=!!p,b=r(x?h.substring(0,p):h);if(!b){if(!x){l=u+(l.length>0?" "+l:l);continue}if(b=r(h),!b){l=u+(l.length>0?" "+l:l);continue}x=!1}const k=K5(f).join(":"),v=d?k+W1:k,m=v+b;if(i.includes(m))continue;i.push(m);const y=s(b,x);for(let j=0;j<y.length;++j){const S=y[j];i.push(v+S)}l=u+(l.length>0?" "+l:l)}return l};function X5(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=K1(t))&&(r&&(r+=" "),r+=n);return r}const K1=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=K1(e[r]))&&(n&&(n+=" "),n+=t);return n};function Q5(e,...t){let n,r,s,i=o;function o(c){const u=t.reduce((f,d)=>d(f),e());return n=G5(u),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const u=r(c);if(u)return u;const f=Y5(c,n);return s(c,f),f}return function(){return i(X5.apply(null,arguments))}}const lt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},G1=/^\[(?:([a-z-]+):)?(.+)\]$/i,J5=/^\d+\/\d+$/,Z5=new Set(["px","full","screen"]),eE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,nE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,rE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mr=e=>Ii(e)||Z5.has(e)||J5.test(e),Rr=e=>na(e,"length",fE),Ii=e=>!!e&&!Number.isNaN(Number(e)),Xu=e=>na(e,"number",Ii),va=e=>!!e&&Number.isInteger(Number(e)),iE=e=>e.endsWith("%")&&Ii(e.slice(0,-1)),Ie=e=>G1.test(e),_r=e=>eE.test(e),aE=new Set(["length","size","percentage"]),oE=e=>na(e,aE,q1),lE=e=>na(e,"position",q1),cE=new Set(["image","url"]),uE=e=>na(e,cE,pE),dE=e=>na(e,"",hE),ba=()=>!0,na=(e,t,n)=>{const r=G1.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},fE=e=>tE.test(e)&&!nE.test(e),q1=()=>!1,hE=e=>rE.test(e),pE=e=>sE.test(e),mE=()=>{const e=lt("colors"),t=lt("spacing"),n=lt("blur"),r=lt("brightness"),s=lt("borderColor"),i=lt("borderRadius"),o=lt("borderSpacing"),l=lt("borderWidth"),c=lt("contrast"),u=lt("grayscale"),f=lt("hueRotate"),d=lt("invert"),h=lt("gap"),p=lt("gradientColorStops"),x=lt("gradientColorStopPositions"),b=lt("inset"),k=lt("margin"),v=lt("opacity"),m=lt("padding"),y=lt("saturate"),j=lt("scale"),S=lt("sepia"),N=lt("skew"),w=lt("space"),C=lt("translate"),D=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto",Ie,t],P=()=>[Ie,t],F=()=>["",mr,Rr],z=()=>["auto",Ii,Ie],W=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],fe=()=>["solid","dashed","dotted","double","none"],ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>["start","end","center","between","around","evenly","stretch"],V=()=>["","0",Ie],E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Y=()=>[Ii,Ie];return{cacheSize:500,separator:":",theme:{colors:[ba],spacing:[mr,Rr],blur:["none","",_r,Ie],brightness:Y(),borderColor:[e],borderRadius:["none","","full",_r,Ie],borderSpacing:P(),borderWidth:F(),contrast:Y(),grayscale:V(),hueRotate:Y(),invert:V(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[iE,Rr],inset:M(),margin:M(),opacity:Y(),padding:P(),saturate:Y(),scale:Y(),sepia:V(),skew:Y(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",Ie]}],container:["container"],columns:[{columns:[_r]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...W(),Ie]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",va,Ie]}],basis:[{basis:M()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ie]}],grow:[{grow:V()}],shrink:[{shrink:V()}],order:[{order:["first","last","none",va,Ie]}],"grid-cols":[{"grid-cols":[ba]}],"col-start-end":[{col:["auto",{span:["full",va,Ie]},Ie]}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":[ba]}],"row-start-end":[{row:["auto",{span:[va,Ie]},Ie]}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ie]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ie]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...R()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...R(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...R(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[m]}],px:[{px:[m]}],py:[{py:[m]}],ps:[{ps:[m]}],pe:[{pe:[m]}],pt:[{pt:[m]}],pr:[{pr:[m]}],pb:[{pb:[m]}],pl:[{pl:[m]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[w]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[w]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ie,t]}],"min-w":[{"min-w":[Ie,t,"min","max","fit"]}],"max-w":[{"max-w":[Ie,t,"none","full","min","max","fit","prose",{screen:[_r]},_r]}],h:[{h:[Ie,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ie,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ie,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ie,t,"auto","min","max","fit"]}],"font-size":[{text:["base",_r,Rr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Xu]}],"font-family":[{font:[ba]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ie]}],"line-clamp":[{"line-clamp":["none",Ii,Xu]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",mr,Ie]}],"list-image":[{"list-image":["none",Ie]}],"list-style-type":[{list:["none","disc","decimal",Ie]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",mr,Rr]}],"underline-offset":[{"underline-offset":["auto",mr,Ie]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ie]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...W(),lE]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",oE]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},uE]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...fe(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:fe()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...fe()]}],"outline-offset":[{"outline-offset":[mr,Ie]}],"outline-w":[{outline:[mr,Rr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[mr,Rr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",_r,dE]}],"shadow-color":[{shadow:[ba]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...ee(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ee()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",_r,Ie]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ie]}],duration:[{duration:Y()}],ease:[{ease:["linear","in","out","in-out",Ie]}],delay:[{delay:Y()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ie]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[va,Ie]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ie]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ie]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ie]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mr,Rr,Xu]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},gE=Q5(mE);function B(...e){return gE(O5(e))}const ko="siclaw_auth",iu=()=>{try{const e=localStorage.getItem(ko);if(e)return JSON.parse(e)}catch{localStorage.removeItem(ko)}return{isAuthenticated:!1}},xE=e=>{localStorage.setItem(ko,JSON.stringify(e))},yE=async e=>{try{const n=await(await fetch("/api/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json();if(n.ok&&n.token){const r={isAuthenticated:!0,token:n.token,user:n.user};return xE(r),{ok:!0,token:n.token,user:n.user}}return{ok:!1,error:n.error||"Login failed"}}catch{return{ok:!1,error:"Network error"}}},Y1=()=>{localStorage.removeItem(ko),window.location.href="/login"},vE=()=>iu().token,ls=()=>iu().user;function bE(e){try{return JSON.parse(atob(e.split(".")[1])).exp*1e3<Date.now()-6e4}catch{return!0}}const Qu=()=>{const e=iu();return!e.isAuthenticated||!e.token?!1:bE(e.token)?(localStorage.removeItem(ko),window.location.href="/login",!1):!0},wE=()=>{const e=vE(),n=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;return e?`${n}?token=${encodeURIComponent(e)}`:n};var Yy,Xy;let X1={name:((Yy=ls())==null?void 0:Yy.username)||"User",role:"",initials:Pp(((Xy=ls())==null?void 0:Xy.username)||"User"),avatarBg:"bg-primary-100"};function Pp(e){const t=e.split(" ");return t.length>=2?`${t[0][0]}${t[1][0]}`.toUpperCase():e.substring(0,2).toUpperCase()}const Gi=()=>{const e=localStorage.getItem("siclaw_user_profile");return e?JSON.parse(e):X1},kc=e=>{const n={...Gi(),...e};return e.name&&(n.initials=Pp(e.name)),X1=n,localStorage.setItem("siclaw_user_profile",JSON.stringify(n)),window.dispatchEvent(new Event("user-profile-updated")),n};async function kE(e){try{const t=await e("profile.get");if(!t.profile)return null;const n=t.profile,r=n.name||"User";return{name:r,role:n.role||"",initials:Pp(r),avatarBg:n.avatarBg||"bg-primary-100"}}catch{return null}}async function SE(e,t){await e("profile.update",t),kc(t)}async function jE(e){const t=ls(),n=await kE(e);if(n)kc(n);else if(t){const r=Gi();(r.name==="User"||r.name==="SRE Admin")&&kc({name:t.username})}}const Q1=g.createContext(null),h0=[300,600,1200,2500,5e3];function NE({children:e}){const[t,n]=g.useState("disconnected"),r=g.useRef(null),s=g.useRef(0),i=g.useRef(new Map),o=g.useRef(new Set),l=g.useRef(0),c=g.useRef(),u=g.useRef(!1),f=g.useRef(),d=g.useRef("disconnected"),h=g.useCallback(y=>{d.current=y,n(y)},[]),p=g.useCallback(()=>{if(u.current||!Qu())return;const y=h0[Math.min(l.current,h0.length-1)];l.current++,console.log(`[ws] Reconnecting in ${y}ms (attempt ${l.current})`),c.current=setTimeout(()=>{x()},y)},[]),x=g.useCallback(()=>{if(r.current&&(r.current.onopen=null,r.current.onclose=null,r.current.onerror=null,r.current.onmessage=null,(r.current.readyState===WebSocket.OPEN||r.current.readyState===WebSocket.CONNECTING)&&r.current.close(),r.current=null),f.current&&clearTimeout(f.current),!Qu()){console.warn("[ws] Not authenticated, skipping connect");return}h("connecting");const y=wE();console.log(`[ws] Connecting to: ${y} (attempt ${l.current})`);const j=new WebSocket(y);r.current=j,f.current=setTimeout(()=>{j.readyState!==WebSocket.OPEN&&(console.warn(`[ws] Connection timeout (3s), readyState=${j.readyState}, retrying...`),j.onclose=null,j.close(),r.current=null,h("disconnected"),p())},3e3),j.onopen=()=>{clearTimeout(f.current),console.log("[ws] Connected"),l.current=0,h("connected")},j.onmessage=S=>{try{const N=JSON.parse(S.data);if(N.type==="res"&&N.id){const w=i.current.get(N.id);if(w){const C=N.error?{code:N.error.code,message:N.error.message??"Unknown error"}:void 0;w(N.payload??N.result,C),i.current.delete(N.id)}}for(const w of Array.from(o.current))w(N)}catch(N){console.error("[ws] Failed to parse message:",N)}},j.onclose=S=>{clearTimeout(f.current),console.log(`[ws] Closed: code=${S.code} reason=${S.reason}`),r.current=null,h("disconnected"),p()},j.onerror=S=>{console.error("[ws] Error:",S)}},[h,p]),b=g.useCallback(()=>{var y;u.current=!0,c.current&&(clearTimeout(c.current),c.current=void 0),(y=r.current)==null||y.close(),r.current=null,h("disconnected")},[h]),k=g.useCallback((y,j)=>new Promise((S,N)=>{if(!r.current||r.current.readyState!==WebSocket.OPEN){N(new Error("WebSocket not connected"));return}const w=String(++s.current);i.current.set(w,(C,D)=>{var T;if(D){if((T=D.message)!=null&&T.includes("Unauthorized")){Y1();return}N(new Error(D.message))}else S(C)}),r.current.send(JSON.stringify({type:"req",id:w,method:y,params:j??{}}))}),[]),v=g.useCallback(y=>(o.current.add(y),()=>{o.current.delete(y)}),[]);g.useEffect(()=>(Qu()&&(u.current=!1,x()),()=>{b()}),[x,b]);const m={status:t,isConnected:t==="connected",sendRpc:k,connect:x,disconnect:b,subscribe:v};return a.jsx(Q1.Provider,{value:m,children:e})}function zt(e={}){const t=g.useContext(Q1);if(!t)throw new Error("useWebSocket must be used within WebSocketProvider");const n=g.useRef(e.onMessage);n.current=e.onMessage,g.useEffect(()=>{if(!n.current)return;const s=i=>{var o;return(o=n.current)==null?void 0:o.call(n,i)};return t.subscribe(s)},[t.subscribe]);const r=g.useRef(e.onStatusChange);return r.current=e.onStatusChange,g.useEffect(()=>{var s;(s=r.current)==null||s.call(r,t.status)},[t.status]),{status:t.status,connect:t.connect,disconnect:t.disconnect,sendRpc:t.sendRpc,isConnected:t.isConnected}}function CE(e){const t=new Map,n=[];for(const r of e)if(r.type==="cron_result"&&r.relatedId){const s=t.get(r.relatedId);s?s.push(r):t.set(r.relatedId,[r])}else n.push({key:r.id,type:r.type,title:r.title,relatedId:r.relatedId,notifications:[r],latestAt:r.createdAt,unreadCount:r.isRead?0:1});for(const[r,s]of t)n.push({key:`cron:${r}`,type:"cron_result",title:s[0].title,relatedId:r,notifications:s,latestAt:s[0].createdAt,unreadCount:s.filter(i=>!i.isRead).length});return n.sort((r,s)=>{const i=r.latestAt?new Date(r.latestAt).getTime():0;return(s.latestAt?new Date(s.latestAt).getTime():0)-i}),n}function EE(e){const[t,n]=g.useState([]),[r,s]=g.useState(0),i=g.useCallback(async()=>{try{const[d,h]=await Promise.all([e("notification.list"),e("notification.unreadCount")]);n(d.notifications??[]),s(h.count??0)}catch(d){console.error("[useNotifications] Failed to load:",d)}},[e]),o=g.useCallback(async d=>{try{await e("notification.markRead",{id:d}),n(h=>h.map(p=>p.id===d?{...p,isRead:!0}:p)),s(h=>Math.max(0,h-1))}catch(h){console.error("[useNotifications] markRead failed:",h)}},[e]),l=g.useCallback(async()=>{try{await e("notification.markRead",{id:"all"}),n(d=>d.map(h=>({...h,isRead:!0}))),s(0)}catch(d){console.error("[useNotifications] markAllRead failed:",d)}},[e]),c=g.useCallback(async d=>{try{await e("notification.dismiss",{id:d}),n(h=>{const p=h.find(x=>x.id===d);return p&&!p.isRead&&s(x=>Math.max(0,x-1)),h.filter(x=>x.id!==d)})}catch(h){console.error("[useNotifications] dismissOne failed:",h)}},[e]),u=g.useCallback(async()=>{try{await e("notification.dismissAll"),n([]),s(0)}catch(d){console.error("[useNotifications] dismissAll failed:",d)}},[e]),f=g.useCallback(d=>{if(d.type==="event"&&d.event==="notification"&&d.payload){const h=d.payload;n(p=>[h,...p]),s(p=>p+1)}},[]);return{notifications:t,unreadCount:r,loadNotifications:i,markRead:o,markAllRead:l,dismissOne:c,dismissAll:u,handleWsEvent:f}}const TE={cron_result:{icon:wo,chipLabel:"Scheduled Task",bgClass:"bg-blue-100",textClass:"text-blue-600",chipBg:"bg-blue-50",chipText:"text-blue-700"},vote_up:{icon:B1,chipLabel:"Vote",bgClass:"bg-green-100",textClass:"text-green-600",chipBg:"bg-green-50",chipText:"text-green-700"},vote_down:{icon:V1,chipLabel:"Vote",bgClass:"bg-red-100",textClass:"text-red-600",chipBg:"bg-red-50",chipText:"text-red-700"},skill_reverted:{icon:Ff,chipLabel:"Skill Reverted",bgClass:"bg-orange-100",textClass:"text-orange-600",chipBg:"bg-orange-50",chipText:"text-orange-700"},skill_approved:{icon:ru,chipLabel:"Approved",bgClass:"bg-green-100",textClass:"text-green-600",chipBg:"bg-green-50",chipText:"text-green-700"},skill_rejected:{icon:O1,chipLabel:"Rejected",bgClass:"bg-red-100",textClass:"text-red-600",chipBg:"bg-red-50",chipText:"text-red-700"},contribution_rejected:{icon:ei,chipLabel:"Rejected",bgClass:"bg-red-100",textClass:"text-red-600",chipBg:"bg-red-50",chipText:"text-red-700"},skill_review_requested:{icon:bo,chipLabel:"Publish Review",bgClass:"bg-amber-100",textClass:"text-amber-600",chipBg:"bg-amber-50",chipText:"text-amber-700"},contribution_review_requested:{icon:ss,chipLabel:"Team Review",bgClass:"bg-blue-100",textClass:"text-blue-600",chipBg:"bg-blue-50",chipText:"text-blue-700"}},PE={icon:vp,chipLabel:"Notification",bgClass:"bg-gray-100",textClass:"text-gray-600",chipBg:"bg-gray-50",chipText:"text-gray-700"};function J1(e){return TE[e]??PE}function Z1(e){if(!e)return"";const t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:t.toLocaleDateString()}const p0=new Set(["skill_approved","skill_rejected","contribution_rejected","skill_reverted"]),Ju=new Set(["skill_review_requested","contribution_review_requested"]),AE=300;function m0({notif:e,onMarkRead:t,onDelete:n,onClose:r,nested:s}){var p;const[i,o]=g.useState(!0),l=dr(),c=J1(e.type),u=c.icon,f=(((p=e.message)==null?void 0:p.length)??0)>AE,d=(p0.has(e.type)||Ju.has(e.type))&&e.relatedId,h=()=>{e.isRead||t(e.id),Ju.has(e.type)&&e.relatedId?(r==null||r(),l("/skills?tab=approvals")):p0.has(e.type)&&e.relatedId&&(r==null||r(),l(`/skills/${e.relatedId}`))};return a.jsx("div",{onClick:h,className:B("group relative px-3 py-2.5 border-b border-gray-50 hover:bg-gray-50/80 transition-colors cursor-pointer",!e.isRead&&"bg-blue-50/40",s&&"pl-10 border-b-0 py-2"),children:a.jsxs("div",{className:"flex items-start gap-2.5",children:[!s&&a.jsxs("div",{className:"relative flex-shrink-0 mt-0.5",children:[a.jsx("div",{className:B("w-7 h-7 rounded-full flex items-center justify-center",c.bgClass),children:a.jsx(u,{className:B("w-3.5 h-3.5",c.textClass)})}),!e.isRead&&a.jsx("div",{className:"absolute -top-0.5 -right-0.5 w-2.5 h-2.5 rounded-full bg-blue-500 border-2 border-white"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-1.5 mb-0.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[!s&&a.jsx("span",{className:B("inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium flex-shrink-0",c.chipBg,c.chipText),children:c.chipLabel}),a.jsx("span",{className:"text-[10px] text-gray-400",children:Z1(e.createdAt)})]}),a.jsx("button",{onClick:x=>{x.stopPropagation(),n(e.id)},className:"flex-shrink-0 p-1 rounded hover:bg-gray-200 text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity",title:"Delete",children:a.jsx(Ge,{className:"w-3 h-3"})})]}),a.jsx("p",{className:"text-sm text-gray-900 leading-snug break-words",children:e.title}),e.message&&a.jsxs("div",{className:"mt-1",children:[a.jsx("p",{className:B("text-xs text-gray-500 leading-relaxed break-words whitespace-pre-wrap",i&&f&&"line-clamp-5"),children:e.message}),f&&a.jsx("button",{onClick:x=>{x.stopPropagation(),o(!i)},className:"text-[10px] text-primary-600 hover:text-primary-700 font-medium mt-0.5",children:i?"Show more":"Show less"})]}),d&&!e.isRead&&a.jsxs("button",{onClick:x=>{x.stopPropagation(),h()},className:"mt-1 text-[11px] text-primary-600 hover:text-primary-700 font-medium hover:underline",children:[Ju.has(e.type)?"Go to Approvals":"View Skill Details"," →"]})]})]})})}function DE({group:e,onMarkRead:t,onDelete:n,onClose:r}){const[s,i]=g.useState(!1);if(e.notifications.length===1)return a.jsx(m0,{notif:e.notifications[0],onMarkRead:t,onDelete:n,onClose:r});const o=J1(e.type),l=o.icon;return a.jsxs("div",{className:"border-b border-gray-50",children:[a.jsxs("button",{onClick:()=>i(!s),className:B("w-full text-left px-3 py-2.5 hover:bg-gray-50/80 transition-colors flex items-start gap-2.5",e.unreadCount>0&&"bg-blue-50/40"),children:[a.jsxs("div",{className:"relative flex-shrink-0 mt-0.5",children:[a.jsx("div",{className:B("w-7 h-7 rounded-full flex items-center justify-center",o.bgClass),children:a.jsx(l,{className:B("w-3.5 h-3.5",o.textClass)})}),e.unreadCount>0&&a.jsx("div",{className:"absolute -top-0.5 -right-0.5 w-2.5 h-2.5 rounded-full bg-blue-500 border-2 border-white"})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[a.jsx("span",{className:B("inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium flex-shrink-0",o.chipBg,o.chipText),children:o.chipLabel}),a.jsx("span",{className:"text-[10px] text-gray-400",children:Z1(e.latestAt)})]}),a.jsx("p",{className:"text-sm text-gray-900 leading-snug break-words",children:e.title}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsxs("span",{className:"text-[10px] text-gray-400",children:[e.notifications.length," notifications"]}),e.unreadCount>0&&a.jsxs("span",{className:"text-[10px] text-blue-500 font-medium",children:[e.unreadCount," unread"]})]})]}),a.jsx(os,{className:B("w-4 h-4 text-gray-400 flex-shrink-0 mt-1 transition-transform duration-200",s&&"rotate-90")})]}),s&&a.jsx("div",{className:"bg-gray-50/50",children:e.notifications.map(c=>a.jsx(m0,{notif:c,onMarkRead:t,onDelete:n,onClose:r,nested:!0},c.id))})]})}function LE(){const{sendRpc:e,isConnected:t}=zt({onMessage:x=>u(x)}),{notifications:n,unreadCount:r,loadNotifications:s,markRead:i,markAllRead:o,dismissOne:l,dismissAll:c,handleWsEvent:u}=EE(e),[f,d]=g.useState(!1),h=g.useRef(null),p=g.useMemo(()=>CE(n),[n]);return g.useEffect(()=>{t&&s()},[t,s]),g.useEffect(()=>{if(!f)return;const x=b=>{h.current&&!h.current.contains(b.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[f]),a.jsxs("div",{className:"relative",ref:h,children:[a.jsxs("button",{onClick:()=>d(!f),className:"relative p-1.5 rounded-md text-gray-400 hover:text-gray-900 hover:bg-gray-100 transition-colors",children:[a.jsx(vp,{className:"w-4.5 h-4.5"}),r>0&&a.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex h-4 min-w-[16px] items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold text-white",children:r>99?"99+":r})]}),f&&a.jsxs("div",{className:"absolute top-full left-0 mt-2 w-[28rem] bg-white rounded-xl shadow-lg border border-gray-200 overflow-hidden z-50",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-100 flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Notifications"}),a.jsxs("div",{className:"flex items-center gap-2",children:[r>0&&a.jsxs("button",{onClick:o,className:"flex items-center gap-1 text-xs text-primary-600 hover:text-primary-700 font-medium",children:[a.jsx(qt,{className:"w-3 h-3"}),"Mark all read"]}),n.length>0&&a.jsxs("button",{onClick:c,className:"flex items-center gap-1 text-xs text-red-500 hover:text-red-600 font-medium",title:"Clear all notifications",children:[a.jsx(mn,{className:"w-3 h-3"}),"Clear all"]})]})]}),a.jsx("div",{className:"max-h-[480px] overflow-y-auto",children:p.length===0?a.jsx("div",{className:"py-8 text-center text-sm text-gray-400",children:"No notifications"}):p.map(x=>a.jsx(DE,{group:x,onMarkRead:i,onDelete:l,onClose:()=>d(!1)},x.key))})]})]})}const ew=g.createContext(null),g0="siclaw_workspace_id";function ME({children:e}){const{sendRpc:t,isConnected:n}=zt(),[r,s]=g.useState([]),[i,o]=g.useState(null),l=g.useRef(!1),c=g.useCallback(async()=>{if(n)try{const d=(await t("workspace.list")).workspaces??[];s(d);const h=localStorage.getItem(g0),p=h?d.find(b=>b.id===h):null,x=d.find(b=>b.isDefault)??d[0]??null;o(p??x)}catch(f){console.error("Failed to load workspaces:",f)}},[n,t]),u=g.useCallback(f=>{o(f),localStorage.setItem(g0,f.id)},[]);return g.useEffect(()=>{n&&!l.current&&(l.current=!0,c())},[n,c]),a.jsx(ew.Provider,{value:{workspaces:r,currentWorkspace:i,setCurrentWorkspace:u,reload:c},children:e})}function Ap(){const e=g.useContext(ew);if(!e)throw new Error("useWorkspace must be used within a WorkspaceProvider");return e}const IE=[{icon:y5,label:"Pilot",to:"/pilot"},{icon:P1,label:"Workspace",to:"/workspace"},{icon:wo,label:"Cron Jobs",to:"/cron"},{icon:su,label:"Triggers",to:"/triggers"}],Zu=[{icon:z1,label:"Agent",key:"agent",items:[{icon:_1,label:"Skills",to:"/skills"},{icon:_f,label:"MCP",to:"/mcp"}]},{icon:nu,label:"Settings",key:"settings",items:[{icon:M5,label:"Channels",to:"/channels",adminOnly:!0},{icon:m5,label:"Brains",to:"/brains"},{icon:Xs,label:"Models",to:"/models",adminOnly:!0},{icon:Tr,label:"Credentials",to:"/credentials"},{icon:jp,label:"Permissions",to:"/permissions",adminOnly:!0},{icon:U1,label:"System",to:"/settings/system",adminOnly:!0}]}];function x0(e,t){const n=`sidebar-${e}-expanded`,[r,s]=g.useState(()=>{if(t)return!0;const o=localStorage.getItem(n);return o===null?!0:o==="true"});return g.useEffect(()=>{t&&!r&&(s(!0),localStorage.setItem(n,"true"))},[t]),{expanded:r,toggle:()=>{const o=!r;s(o),localStorage.setItem(n,String(o))}}}const y0={indigo:"bg-indigo-500",blue:"bg-blue-500",green:"bg-green-500",amber:"bg-amber-500",rose:"bg-rose-500",purple:"bg-purple-500",teal:"bg-teal-500",gray:"bg-gray-400"};function RE(){var k;const e=dr(),t=ms(),[n,r]=g.useState(Gi()),s=ls(),i=(s==null?void 0:s.username)==="admin",{workspaces:o,currentWorkspace:l,setCurrentWorkspace:c}=Ap(),[u,f]=g.useState(!1),d=g.useRef(null);g.useEffect(()=>{const v=m=>{d.current&&!d.current.contains(m.target)&&f(!1)};return u&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[u]);const h=v=>v.items.filter(m=>!m.adminOnly||i).some(m=>t.pathname.startsWith(m.to)),p=x0("agent",h(Zu[0])),x=x0("settings",h(Zu[1])),b=[p,x];return g.useEffect(()=>{const v=()=>r(Gi());return window.addEventListener("user-profile-updated",v),()=>window.removeEventListener("user-profile-updated",v)},[]),a.jsxs("aside",{className:"w-64 h-screen bg-gray-50 border-r border-gray-200 flex flex-col shrink-0",children:[a.jsxs("div",{className:"h-14 flex items-center justify-between px-4 border-b border-gray-200 bg-white",children:[a.jsxs("div",{className:"flex items-center gap-2.5 text-primary-600",children:[a.jsx("div",{className:"p-1 bg-primary-50 rounded-md",children:a.jsx(D1,{className:"w-5 h-5"})}),a.jsx("span",{className:"font-bold text-gray-900 tracking-tight",children:"Siclaw"})]}),a.jsx(LE,{})]}),o.length>0&&a.jsx("div",{className:"px-3 py-2 border-b border-gray-200",ref:d,children:a.jsxs("div",{className:"relative",children:[a.jsxs("button",{onClick:()=>f(!u),className:"w-full flex items-center gap-2 px-3 py-2 rounded-lg bg-white border border-gray-200 hover:border-gray-300 text-sm font-medium text-gray-900 shadow-sm transition-colors",children:[a.jsx("span",{className:B("w-2 h-2 rounded-full shrink-0",y0[((k=l==null?void 0:l.configJson)==null?void 0:k.color)??"indigo"]??"bg-indigo-500")}),a.jsx("span",{className:"flex-1 text-left truncate",children:(l==null?void 0:l.name)??"Default"}),a.jsx(rs,{className:B("w-4 h-4 text-gray-400 transition-transform",u&&"rotate-180")})]}),u&&a.jsxs("div",{className:"absolute top-full left-0 right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg z-50 py-1 max-h-48 overflow-y-auto",children:[o.map(v=>{var m;return a.jsxs("button",{onClick:()=>{c(v),f(!1)},className:B("w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-gray-50 transition-colors",(l==null?void 0:l.id)===v.id&&"bg-indigo-50 text-indigo-700"),children:[a.jsx("span",{className:B("w-2 h-2 rounded-full shrink-0",y0[((m=v.configJson)==null?void 0:m.color)??"indigo"]??"bg-indigo-500")}),a.jsx("span",{className:"truncate",children:v.name}),v.isDefault&&a.jsx("span",{className:"text-xs text-gray-400 ml-auto",children:"default"})]},v.id)}),a.jsx("div",{className:"border-t border-gray-100 mt-1 pt-1",children:a.jsx("button",{onClick:()=>{f(!1),e("/workspace")},className:"w-full px-3 py-2 text-sm text-indigo-600 text-left hover:bg-gray-50 transition-colors",children:"Manage Workspaces"})})]})]})}),a.jsxs("div",{className:"flex-1 py-4 px-3 space-y-1 overflow-y-auto",children:[IE.map(v=>a.jsxs(Mf,{to:v.to,className:({isActive:m})=>B("flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-normal transition-all",m?"bg-primary-50 text-primary-700":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:[a.jsx(v.icon,{className:"w-[18px] h-[18px] stroke-[1.25]"}),v.label]},v.to)),Zu.map((v,m)=>{const y=v.items.filter(w=>!w.adminOnly||i);if(y.length===0)return null;const{expanded:j,toggle:S}=b[m],N=h(v);return a.jsxs("div",{className:"pt-2",children:[a.jsxs("button",{onClick:S,className:B("flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-normal transition-all w-full text-left",N?"text-gray-900":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:[a.jsx(v.icon,{className:"w-[18px] h-[18px] stroke-[1.25]"}),a.jsx("span",{className:"flex-1",children:v.label}),a.jsx(os,{className:B("w-3.5 h-3.5 stroke-[1.5] text-gray-400 transition-transform",j&&"rotate-90")})]}),j&&y.map(w=>a.jsxs(Mf,{to:w.to,className:({isActive:C})=>B("flex items-center gap-3 pl-9 pr-3 py-2 rounded-lg text-sm font-normal transition-all",C?"bg-primary-50 text-primary-700":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:[a.jsx(w.icon,{className:"w-[18px] h-[18px] stroke-[1.25]"}),w.label]},w.to))]},v.key)})]}),a.jsx("div",{className:"p-3 border-t border-gray-200 bg-white",children:a.jsxs("button",{onClick:()=>e("/settings"),className:"flex items-center gap-3 w-full p-2 rounded-md hover:bg-gray-50 transition-colors text-left group",children:[a.jsx("div",{className:B("w-8 h-8 rounded-full flex items-center justify-center text-primary-700 font-semibold text-xs ring-2 ring-white shadow-sm",n.avatarBg),children:n.initials}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-sm font-medium text-gray-900 group-hover:text-primary-600 transition-colors truncate",children:n.name}),a.jsxs("div",{className:"text-xs text-gray-500 truncate",children:["@",(s==null?void 0:s.username)??"user"]})]}),a.jsx(nu,{className:"w-4 h-4 text-gray-400 group-hover:text-gray-600"})]})})]})}function _E(){const{sendRpc:e,isConnected:t}=zt(),n=g.useRef(!1);return g.useEffect(()=>{t&&!n.current&&(n.current=!0,jE(e))},[t,e]),a.jsxs("div",{className:"flex h-screen bg-white overflow-hidden",children:[a.jsx(RE,{}),a.jsx("main",{className:"flex-1 flex flex-col relative overflow-hidden bg-white",children:a.jsx(yp,{})})]})}function FE(){return a.jsx(NE,{children:a.jsx(ME,{children:a.jsx(_E,{})})})}const OE=()=>{const{isAuthenticated:e}=iu();return e?a.jsx(yp,{}):a.jsx(Df,{to:"/login",replace:!0})};function zE(){const e=dr(),[t]=eu(),[n,r]=g.useState(""),[s,i]=g.useState(""),[o,l]=g.useState(""),[c,u]=g.useState(!1),[f,d]=g.useState(!1);g.useEffect(()=>{const x=t.get("error");x&&l(decodeURIComponent(x)),fetch("/api/sso/config").then(b=>b.json()).then(b=>d(b.enabled)).catch(()=>{})},[t]);const h=async x=>{x.preventDefault(),l(""),u(!0);try{const b=await yE({username:n,password:s});b.ok?e("/"):l(b.error||"Login failed")}catch{l("Network error")}finally{u(!1)}},p=()=>{window.location.href="/auth/sso"};return a.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col items-center justify-center p-4",children:[a.jsxs("div",{className:"w-full max-w-sm bg-white rounded-2xl shadow-xl border border-gray-100 overflow-hidden",children:[a.jsxs("div",{className:"p-8 pb-6 flex flex-col items-center text-center",children:[a.jsx("div",{className:"w-16 h-16 bg-primary-50 rounded-2xl flex items-center justify-center mb-6 text-primary-600",children:a.jsx(D1,{className:"w-8 h-8"})}),a.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Welcome Back"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Sign in to access your Siclaw workspace"})]}),a.jsxs("form",{onSubmit:h,className:"p-8 pt-0 space-y-4",children:[o&&a.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-100 rounded-lg text-red-600 text-sm",children:[a.jsx(xo,{className:"w-4 h-4 flex-shrink-0"}),a.jsx("span",{children:o})]}),f&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",onClick:p,className:"w-full flex items-center justify-center gap-3 px-4 py-3 bg-primary-600 text-white rounded-xl hover:bg-primary-700 transition-all font-medium shadow-lg shadow-primary-100",children:[a.jsx(v5,{className:"w-5 h-5"}),a.jsx("span",{children:"Sign in with SSO"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("span",{className:"w-full border-t border-gray-100"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-white px-2 text-gray-400",children:"or sign in with password"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-gray-700",children:"Username"}),a.jsx("input",{id:"username",type:"text",value:n,onChange:x=>r(x.target.value),className:"w-full px-4 py-2.5 bg-gray-50 border border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent transition-all",placeholder:"Enter your username",required:!0,autoFocus:!f,disabled:c})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700",children:"Password"}),a.jsx("input",{id:"password",type:"password",value:s,onChange:x=>i(x.target.value),className:"w-full px-4 py-2.5 bg-gray-50 border border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent transition-all",placeholder:"Enter your password",required:!0,disabled:c})]}),a.jsxs("button",{type:"submit",disabled:c||!n||!s,className:"w-full flex items-center justify-center gap-3 px-4 py-3 bg-gray-900 text-white rounded-xl hover:bg-gray-800 transition-all font-medium shadow-lg shadow-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[c?a.jsx(Ae,{className:"w-5 h-5 animate-spin"}):a.jsx(N5,{className:"w-5 h-5"}),a.jsx("span",{children:c?"Signing in...":"Sign In"})]}),!f&&a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("span",{className:"w-full border-t border-gray-100"})}),a.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:a.jsx("span",{className:"bg-white px-2 text-gray-400",children:"Restricted Access"})})]})]})]}),a.jsx("div",{className:"mt-8 text-center text-xs text-gray-400",children:"© 2025 Siclaw. All rights reserved."})]})}function VE(){const e=dr(),[t]=eu();return g.useEffect(()=>{const n=t.get("token"),r=t.get("userId"),s=t.get("username");if(n&&r&&s){const i={isAuthenticated:!0,token:n,user:{id:r,username:s}};localStorage.setItem("siclaw_auth",JSON.stringify(i)),e("/",{replace:!0})}else e("/login?error=sso_callback_failed",{replace:!0})},[t,e]),a.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col items-center justify-center",children:[a.jsx(Ae,{className:"w-8 h-8 animate-spin text-gray-400 mb-4"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Completing sign in..."})]})}function BE({sessions:e,currentSessionKey:t,onSelectSession:n,onNewSession:r,onDeleteSession:s}){const[i,o]=g.useState(""),l=i?e.filter(u=>(u.title||"").toLowerCase().includes(i.toLowerCase())||(u.preview||"").toLowerCase().includes(i.toLowerCase())):e,c=u=>{if(!u)return"";try{const f=new Date(u),h=new Date().getTime()-f.getTime(),p=Math.floor(h/(1e3*60*60*24));return p===0?f.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):p===1?"Yesterday":p<7?f.toLocaleDateString([],{weekday:"short"}):f.toLocaleDateString([],{month:"short",day:"numeric"})}catch{return""}};return a.jsxs("div",{className:"h-full flex flex-col bg-gray-50/50",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 bg-white",children:[a.jsxs("div",{className:"relative group",children:[a.jsx(kn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 group-focus-within:text-primary-500 transition-colors"}),a.jsx("input",{type:"text",placeholder:"Search...",value:i,onChange:u=>o(u.target.value),className:"w-full pl-9 pr-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm text-gray-900 focus:outline-none focus:border-primary-500 focus:bg-white transition-all placeholder:text-gray-400"})]}),a.jsxs("button",{onClick:r,className:"w-full mt-3 flex items-center justify-center gap-2 py-2 bg-white border border-gray-200 rounded-lg text-sm font-medium text-gray-700 hover:border-primary-200 hover:text-primary-600 transition-all shadow-sm",children:[a.jsx(en,{className:"w-4 h-4"}),"New Session"]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-1",children:[a.jsx("div",{className:"px-2 pb-2 text-xs font-semibold text-gray-400 uppercase tracking-wider",children:"Recent"}),l.length===0&&a.jsx("div",{className:"px-2 py-8 text-center text-sm text-gray-400",children:i?"No matching sessions":"No sessions yet"}),l.map(u=>{const f=u.key===t;return a.jsxs("div",{onClick:()=>n(u.key),className:B("p-3 rounded-lg cursor-pointer transition-all border group relative",f?"bg-white border-primary-200 shadow-sm ring-1 ring-primary-50 text-gray-900":"bg-transparent border-transparent hover:bg-white hover:border-gray-200 hover:shadow-sm text-gray-600"),children:[a.jsxs("div",{className:"flex justify-between items-start mb-1",children:[a.jsx("h3",{className:B("font-semibold text-sm truncate pr-2",f?"text-primary-700":"text-gray-900"),children:u.title||"Untitled Session"}),a.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[a.jsx("span",{className:"text-[10px] text-gray-400 pt-0.5",children:c(u.lastActiveAt||u.createdAt)}),s&&a.jsx("button",{onClick:d=>{d.stopPropagation(),s(u.key)},className:"p-1 text-gray-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-all",children:a.jsx(mn,{className:"w-3 h-3"})})]})]}),a.jsx("p",{className:"text-xs text-gray-500 truncate",children:u.preview||" "})]},u.key)})]})]})}function UE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $E=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,WE={};function v0(e,t){return(WE.jsx?HE:$E).test(e)}const KE=/[ \t\n\f\r]/g;function GE(e){return typeof e=="object"?e.type==="text"?b0(e.value):!1:b0(e)}function b0(e){return e.replace(KE,"")===""}class Vo{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Vo.prototype.normal={};Vo.prototype.property={};Vo.prototype.space=void 0;function tw(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Vo(n,r,t)}function zf(e){return e.toLowerCase()}class gn{constructor(t,n){this.attribute=n,this.property=t}}gn.prototype.attribute="";gn.prototype.booleanish=!1;gn.prototype.boolean=!1;gn.prototype.commaOrSpaceSeparated=!1;gn.prototype.commaSeparated=!1;gn.prototype.defined=!1;gn.prototype.mustUseProperty=!1;gn.prototype.number=!1;gn.prototype.overloadedBoolean=!1;gn.prototype.property="";gn.prototype.spaceSeparated=!1;gn.prototype.space=void 0;let qE=0;const Re=ti(),Pt=ti(),Vf=ti(),ce=ti(),rt=ti(),Ri=ti(),xn=ti();function ti(){return 2**++qE}const Bf=Object.freeze(Object.defineProperty({__proto__:null,boolean:Re,booleanish:Pt,commaOrSpaceSeparated:xn,commaSeparated:Ri,number:ce,overloadedBoolean:Vf,spaceSeparated:rt},Symbol.toStringTag,{value:"Module"})),ed=Object.keys(Bf);class Dp extends gn{constructor(t,n,r,s){let i=-1;if(super(t,n),w0(this,"space",s),typeof r=="number")for(;++i<ed.length;){const o=ed[i];w0(this,ed[i],(r&Bf[o])===Bf[o])}}}Dp.prototype.defined=!0;function w0(e,t,n){n&&(e[t]=n)}function ra(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Dp(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[zf(r)]=r,n[zf(i.attribute)]=r}return new Vo(t,n,e.space)}const nw=ra({properties:{ariaActiveDescendant:null,ariaAtomic:Pt,ariaAutoComplete:null,ariaBusy:Pt,ariaChecked:Pt,ariaColCount:ce,ariaColIndex:ce,ariaColSpan:ce,ariaControls:rt,ariaCurrent:null,ariaDescribedBy:rt,ariaDetails:null,ariaDisabled:Pt,ariaDropEffect:rt,ariaErrorMessage:null,ariaExpanded:Pt,ariaFlowTo:rt,ariaGrabbed:Pt,ariaHasPopup:null,ariaHidden:Pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:rt,ariaLevel:ce,ariaLive:null,ariaModal:Pt,ariaMultiLine:Pt,ariaMultiSelectable:Pt,ariaOrientation:null,ariaOwns:rt,ariaPlaceholder:null,ariaPosInSet:ce,ariaPressed:Pt,ariaReadOnly:Pt,ariaRelevant:null,ariaRequired:Pt,ariaRoleDescription:rt,ariaRowCount:ce,ariaRowIndex:ce,ariaRowSpan:ce,ariaSelected:Pt,ariaSetSize:ce,ariaSort:null,ariaValueMax:ce,ariaValueMin:ce,ariaValueNow:ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function rw(e,t){return t in e?e[t]:t}function sw(e,t){return rw(e,t.toLowerCase())}const YE=ra({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ri,acceptCharset:rt,accessKey:rt,action:null,allow:null,allowFullScreen:Re,allowPaymentRequest:Re,allowUserMedia:Re,alt:null,as:null,async:Re,autoCapitalize:null,autoComplete:rt,autoFocus:Re,autoPlay:Re,blocking:rt,capture:null,charSet:null,checked:Re,cite:null,className:rt,cols:ce,colSpan:null,content:null,contentEditable:Pt,controls:Re,controlsList:rt,coords:ce|Ri,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Re,defer:Re,dir:null,dirName:null,disabled:Re,download:Vf,draggable:Pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Re,formTarget:null,headers:rt,height:ce,hidden:Vf,high:ce,href:null,hrefLang:null,htmlFor:rt,httpEquiv:rt,id:null,imageSizes:null,imageSrcSet:null,inert:Re,inputMode:null,integrity:null,is:null,isMap:Re,itemId:null,itemProp:rt,itemRef:rt,itemScope:Re,itemType:rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Re,low:ce,manifest:null,max:null,maxLength:ce,media:null,method:null,min:null,minLength:ce,multiple:Re,muted:Re,name:null,nonce:null,noModule:Re,noValidate:Re,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Re,optimum:ce,pattern:null,ping:rt,placeholder:null,playsInline:Re,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Re,referrerPolicy:null,rel:rt,required:Re,reversed:Re,rows:ce,rowSpan:ce,sandbox:rt,scope:null,scoped:Re,seamless:Re,selected:Re,shadowRootClonable:Re,shadowRootDelegatesFocus:Re,shadowRootMode:null,shape:null,size:ce,sizes:null,slot:null,span:ce,spellCheck:Pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ce,step:null,style:null,tabIndex:ce,target:null,title:null,translate:null,type:null,typeMustMatch:Re,useMap:null,value:Pt,width:ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:rt,axis:null,background:null,bgColor:null,border:ce,borderColor:null,bottomMargin:ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Re,declare:Re,event:null,face:null,frame:null,frameBorder:null,hSpace:ce,leftMargin:ce,link:null,longDesc:null,lowSrc:null,marginHeight:ce,marginWidth:ce,noResize:Re,noHref:Re,noShade:Re,noWrap:Re,object:null,profile:null,prompt:null,rev:null,rightMargin:ce,rules:null,scheme:null,scrolling:Pt,standby:null,summary:null,text:null,topMargin:ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Re,disableRemotePlayback:Re,prefix:null,property:null,results:ce,security:null,unselectable:null},space:"html",transform:sw}),XE=ra({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:xn,accentHeight:ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ce,amplitude:ce,arabicForm:null,ascent:ce,attributeName:null,attributeType:null,azimuth:ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ce,by:null,calcMode:null,capHeight:ce,className:rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ce,diffuseConstant:ce,direction:null,display:null,dur:null,divisor:ce,dominantBaseline:null,download:Re,dx:null,dy:null,edgeMode:null,editable:null,elevation:ce,enableBackground:null,end:null,event:null,exponent:ce,externalResourcesRequired:null,fill:null,fillOpacity:ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ri,g2:Ri,glyphName:Ri,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ce,horizOriginX:ce,horizOriginY:ce,id:null,ideographic:ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ce,k:ce,k1:ce,k2:ce,k3:ce,k4:ce,kernelMatrix:xn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ce,overlineThickness:ce,paintOrder:null,panose1:null,path:null,pathLength:ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ce,pointsAtY:ce,pointsAtZ:ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:xn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xn,rev:xn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xn,requiredFeatures:xn,requiredFonts:xn,requiredFormats:xn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ce,specularExponent:ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ce,strikethroughThickness:ce,string:null,stroke:null,strokeDashArray:xn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ce,strokeOpacity:ce,strokeWidth:null,style:null,surfaceScale:ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:xn,tabIndex:ce,tableValues:null,target:null,targetX:ce,targetY:ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:xn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ce,underlineThickness:ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ce,values:null,vAlphabetic:ce,vMathematical:ce,vectorEffect:null,vHanging:ce,vIdeographic:ce,version:null,vertAdvY:ce,vertOriginX:ce,vertOriginY:ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:rw}),iw=ra({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),aw=ra({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:sw}),ow=ra({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),QE={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},JE=/[A-Z]/g,k0=/-[a-z]/g,ZE=/^data[-\w.:]+$/i;function e4(e,t){const n=zf(t);let r=t,s=gn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ZE.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(k0,n4);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!k0.test(i)){let o=i.replace(JE,t4);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=Dp}return new s(r,t)}function t4(e){return"-"+e.toLowerCase()}function n4(e){return e.charAt(1).toUpperCase()}const r4=tw([nw,YE,iw,aw,ow],"html"),Lp=tw([nw,XE,iw,aw,ow],"svg");function s4(e){return e.join(" ").trim()}var Mp={},S0=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i4=/\n/g,a4=/^\s*/,o4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l4=/^:\s*/,c4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u4=/^[;\s]*/,d4=/^\s+|\s+$/g,f4=`
549
+ `,j0="/",N0="*",As="",h4="comment",p4="declaration";function m4(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(x){var b=x.match(i4);b&&(n+=b.length);var k=x.lastIndexOf(f4);r=~k?x.length-k:r+x.length}function i(){var x={line:n,column:r};return function(b){return b.position=new o(x),u(),b}}function o(x){this.start=x,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(x){var b=new Error(t.source+":"+n+":"+r+": "+x);if(b.reason=x,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(x){var b=x.exec(e);if(b){var k=b[0];return s(k),e=e.slice(k.length),b}}function u(){c(a4)}function f(x){var b;for(x=x||[];b=d();)b!==!1&&x.push(b);return x}function d(){var x=i();if(!(j0!=e.charAt(0)||N0!=e.charAt(1))){for(var b=2;As!=e.charAt(b)&&(N0!=e.charAt(b)||j0!=e.charAt(b+1));)++b;if(b+=2,As===e.charAt(b-1))return l("End of comment missing");var k=e.slice(2,b-2);return r+=2,s(k),e=e.slice(b),r+=2,x({type:h4,comment:k})}}function h(){var x=i(),b=c(o4);if(b){if(d(),!c(l4))return l("property missing ':'");var k=c(c4),v=x({type:p4,property:C0(b[0].replace(S0,As)),value:k?C0(k[0].replace(S0,As)):As});return c(u4),v}}function p(){var x=[];f(x);for(var b;b=h();)b!==!1&&(x.push(b),f(x));return x}return u(),p()}function C0(e){return e?e.replace(d4,As):As}var g4=m4,x4=Jt&&Jt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mp,"__esModule",{value:!0});Mp.default=v4;const y4=x4(g4);function v4(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,y4.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;s?t(o,l,i):l&&(n=n||{},n[o]=l)}),n}var au={};Object.defineProperty(au,"__esModule",{value:!0});au.camelCase=void 0;var b4=/^--[a-zA-Z0-9_-]+$/,w4=/-([a-z])/g,k4=/^[^-]+$/,S4=/^-(webkit|moz|ms|o|khtml)-/,j4=/^-(ms)-/,N4=function(e){return!e||k4.test(e)||b4.test(e)},C4=function(e,t){return t.toUpperCase()},E0=function(e,t){return"".concat(t,"-")},E4=function(e,t){return t===void 0&&(t={}),N4(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(j4,E0):e=e.replace(S4,E0),e.replace(w4,C4))};au.camelCase=E4;var T4=Jt&&Jt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},P4=T4(Mp),A4=au;function Uf(e,t){var n={};return!e||typeof e!="string"||(0,P4.default)(e,function(r,s){r&&s&&(n[(0,A4.camelCase)(r,t)]=s)}),n}Uf.default=Uf;var D4=Uf;const L4=Ao(D4),lw=cw("end"),Ip=cw("start");function cw(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function M4(e){const t=Ip(e),n=lw(e);if(t&&n)return{start:t,end:n}}function Ha(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?T0(e.position):"start"in e||"end"in e?T0(e):"line"in e||"column"in e?$f(e):""}function $f(e){return P0(e&&e.line)+":"+P0(e&&e.column)}function T0(e){return $f(e&&e.start)+"-"+$f(e&&e.end)}function P0(e){return e&&typeof e=="number"?e:1}class tn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Ha(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tn.prototype.file="";tn.prototype.name="";tn.prototype.reason="";tn.prototype.message="";tn.prototype.stack="";tn.prototype.column=void 0;tn.prototype.line=void 0;tn.prototype.ancestors=void 0;tn.prototype.cause=void 0;tn.prototype.fatal=void 0;tn.prototype.place=void 0;tn.prototype.ruleId=void 0;tn.prototype.source=void 0;const Rp={}.hasOwnProperty,I4=new Map,R4=/[A-Z]/g,_4=new Set(["table","tbody","thead","tfoot","tr"]),F4=new Set(["td","th"]),uw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function O4(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=K4(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=W4(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Lp:r4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=dw(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function dw(e,t,n){if(t.type==="element")return z4(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return V4(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return U4(e,t,n);if(t.type==="mdxjsEsm")return B4(e,t);if(t.type==="root")return $4(e,t,n);if(t.type==="text")return H4(e,t)}function z4(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Lp,e.schema=s),e.ancestors.push(t);const i=hw(e,t.tagName,!1),o=G4(e,t);let l=Fp(e,t);return _4.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!GE(c):!0})),fw(e,o,i,t),_p(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function V4(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}So(e,t.position)}function B4(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);So(e,t.position)}function U4(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Lp,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:hw(e,t.name,!0),o=q4(e,t),l=Fp(e,t);return fw(e,o,i,t),_p(o,l),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function $4(e,t,n){const r={};return _p(r,Fp(e,t)),e.create(t,e.Fragment,r,n)}function H4(e,t){return t.value}function fw(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function _p(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function W4(e,t,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:t;return l?u(i,o,l):u(i,o)}}function K4(e,t){return n;function n(r,s,i,o){const l=Array.isArray(i.children),c=Ip(r);return t(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function G4(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Rp.call(t.properties,s)){const i=Y4(e,s,t.properties[s]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&F4.has(t.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function q4(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else So(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else So(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Fp(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:I4;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;o=c+"-"+u,s.set(c,u+1)}}const l=dw(e,i,o);l!==void 0&&n.push(l)}return n}function Y4(e,t,n){const r=e4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?UE(n):s4(n)),r.property==="style"){let s=typeof n=="object"?n:X4(e,String(n));return e.stylePropertyNameCase==="css"&&(s=Q4(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?QE[r.property]||r.property:r.attribute,n]}}function X4(e,t){try{return L4(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new tn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=uw+"#cannot-parse-style-attribute",s}}function hw(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const l=v0(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=o}else r=v0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Rp.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);So(e)}function So(e,t){const n=new tn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=uw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Q4(e){const t={};let n;for(n in e)Rp.call(e,n)&&(t[J4(n)]=e[n]);return t}function J4(e){let t=e.replace(R4,Z4);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Z4(e){return"-"+e.toLowerCase()}const td={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},eT={};function Op(e,t){const n=eT,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return pw(e,r,s)}function pw(e,t,n){if(tT(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return A0(e.children,t,n)}return Array.isArray(e)?A0(e,t,n):""}function A0(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=pw(e[s],t,n);return r.join("")}function tT(e){return!!(e&&typeof e=="object")}const D0=document.createElement("i");function zp(e){const t="&"+e+";";D0.innerHTML=t;const n=D0.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Sn(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function In(e,t){return e.length>0?(Sn(e,e.length,0,t),e):t}const L0={}.hasOwnProperty;function mw(e){const t={};let n=-1;for(;++n<e.length;)nT(t,e[n]);return t}function nT(e,t){let n;for(n in t){const s=(L0.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){L0.call(s,o)||(s[o]=[]);const l=i[o];rT(s[o],Array.isArray(l)?l:l?[l]:[])}}}function rT(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Sn(e,0,0,r)}function gw(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Yn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rn=gs(/[A-Za-z]/),Yt=gs(/[\dA-Za-z]/),sT=gs(/[#-'*+\--9=?A-Z^-~]/);function Sc(e){return e!==null&&(e<32||e===127)}const Hf=gs(/\d/),iT=gs(/[\dA-Fa-f]/),aT=gs(/[!-/:-@[-`{-~]/);function Ne(e){return e!==null&&e<-2}function Ze(e){return e!==null&&(e<0||e===32)}function Be(e){return e===-2||e===-1||e===32}const ou=gs(new RegExp("\\p{P}|\\p{S}","u")),Qs=gs(/\s/);function gs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function sa(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Yt(e.charCodeAt(n+1))&&Yt(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function $e(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Be(c)?(e.enter(n),l(c)):t(c)}function l(c){return Be(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const oT={tokenize:lT};function lT(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),$e(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ne(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const cT={tokenize:uT},M0={tokenize:dT};function uT(e){const t=this,n=[];let r=0,s,i,o;return l;function l(y){if(r<n.length){const j=n[r];return t.containerState=j[1],e.attempt(j[0].continuation,c,u)(y)}return u(y)}function c(y){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&m();const j=t.events.length;let S=j,N;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){N=t.events[S][1].end;break}v(r);let w=j;for(;w<t.events.length;)t.events[w][1].end={...N},w++;return Sn(t.events,S+1,0,t.events.slice(j)),t.events.length=w,u(y)}return l(y)}function u(y){if(r===n.length){if(!s)return h(y);if(s.currentConstruct&&s.currentConstruct.concrete)return x(y);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(M0,f,d)(y)}function f(y){return s&&m(),v(r),h(y)}function d(y){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,x(y)}function h(y){return t.containerState={},e.attempt(M0,p,x)(y)}function p(y){return r++,n.push([t.currentConstruct,t.containerState]),h(y)}function x(y){if(y===null){s&&m(),v(0),e.consume(y);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),b(y)}function b(y){if(y===null){k(e.exit("chunkFlow"),!0),v(0),e.consume(y);return}return Ne(y)?(e.consume(y),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(y),b)}function k(y,j){const S=t.sliceStream(y);if(j&&S.push(null),y.previous=i,i&&(i.next=y),i=y,s.defineSkip(y.start),s.write(S),t.parser.lazy[y.start.line]){let N=s.events.length;for(;N--;)if(s.events[N][1].start.offset<o&&(!s.events[N][1].end||s.events[N][1].end.offset>o))return;const w=t.events.length;let C=w,D,T;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){if(D){T=t.events[C][1].end;break}D=!0}for(v(r),N=w;N<t.events.length;)t.events[N][1].end={...T},N++;Sn(t.events,C+1,0,t.events.slice(w)),t.events.length=N}}function v(y){let j=n.length;for(;j-- >y;){const S=n[j];t.containerState=S[1],S[0].exit.call(t,e)}n.length=y}function m(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function dT(e,t,n){return $e(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function qi(e){if(e===null||Ze(e)||Qs(e))return 1;if(ou(e))return 2}function lu(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Wf={name:"attention",resolveAll:fT,tokenize:hT};function fT(e,t){let n=-1,r,s,i,o,l,c,u,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},h={...e[n][1].start};I0(d,-c),I0(h,c),o={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=In(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=In(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=In(u,lu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=In(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,u=In(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,Sn(e,r-1,n-r+3,u),n=r+u.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function hT(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=qi(r);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),f=qi(c),d=!f||f===2&&s||n.includes(c),h=!s||s===2&&f||n.includes(r);return u._open=!!(i===42?d:d&&(s||!h)),u._close=!!(i===42?h:h&&(f||!d)),t(c)}}function I0(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const pT={name:"autolink",tokenize:mT};function mT(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return rn(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||Yt(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||Yt(p))&&r++<32?(e.consume(p),l):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Sc(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),f):sT(p)?(e.consume(p),u):n(p)}function f(p){return Yt(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,f):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||Yt(p))&&r++<63){const x=p===45?h:d;return e.consume(p),x}return n(p)}}const Bo={partial:!0,tokenize:gT};function gT(e,t,n){return r;function r(i){return Be(i)?$e(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||Ne(i)?t(i):n(i)}}const xw={continuation:{tokenize:yT},exit:vT,name:"blockQuote",tokenize:xT};function xT(e,t,n){const r=this;return s;function s(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Be(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function yT(e,t,n){const r=this;return s;function s(o){return Be(o)?$e(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(xw,t,n)(o)}}function vT(e){e.exit("blockQuote")}const yw={name:"characterEscape",tokenize:bT};function bT(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return aT(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const vw={name:"characterReference",tokenize:wT};function wT(e,t,n){const r=this;let s=0,i,o;return l;function l(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),c}function c(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=Yt,f(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=iT,f):(e.enter("characterReferenceValue"),i=7,o=Hf,f(d))}function f(d){if(d===59&&s){const h=e.exit("characterReferenceValue");return o===Yt&&!zp(r.sliceSerialize(h))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&s++<i?(e.consume(d),f):n(d)}}const R0={partial:!0,tokenize:ST},_0={concrete:!0,name:"codeFenced",tokenize:kT};function kT(e,t,n){const r=this,s={partial:!0,tokenize:S};let i=0,o=0,l;return c;function c(N){return u(N)}function u(N){const w=r.events[r.events.length-1];return i=w&&w[1].type==="linePrefix"?w[2].sliceSerialize(w[1],!0).length:0,l=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(N)}function f(N){return N===l?(o++,e.consume(N),f):o<3?n(N):(e.exit("codeFencedFenceSequence"),Be(N)?$e(e,d,"whitespace")(N):d(N))}function d(N){return N===null||Ne(N)?(e.exit("codeFencedFence"),r.interrupt?t(N):e.check(R0,b,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(N))}function h(N){return N===null||Ne(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(N)):Be(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),$e(e,p,"whitespace")(N)):N===96&&N===l?n(N):(e.consume(N),h)}function p(N){return N===null||Ne(N)?d(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(N))}function x(N){return N===null||Ne(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(N)):N===96&&N===l?n(N):(e.consume(N),x)}function b(N){return e.attempt(s,j,k)(N)}function k(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),v}function v(N){return i>0&&Be(N)?$e(e,m,"linePrefix",i+1)(N):m(N)}function m(N){return N===null||Ne(N)?e.check(R0,b,j)(N):(e.enter("codeFlowValue"),y(N))}function y(N){return N===null||Ne(N)?(e.exit("codeFlowValue"),m(N)):(e.consume(N),y)}function j(N){return e.exit("codeFenced"),t(N)}function S(N,w,C){let D=0;return T;function T(W){return N.enter("lineEnding"),N.consume(W),N.exit("lineEnding"),M}function M(W){return N.enter("codeFencedFence"),Be(W)?$e(N,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):P(W)}function P(W){return W===l?(N.enter("codeFencedFenceSequence"),F(W)):C(W)}function F(W){return W===l?(D++,N.consume(W),F):D>=o?(N.exit("codeFencedFenceSequence"),Be(W)?$e(N,z,"whitespace")(W):z(W)):C(W)}function z(W){return W===null||Ne(W)?(N.exit("codeFencedFence"),w(W)):C(W)}}}function ST(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const nd={name:"codeIndented",tokenize:NT},jT={partial:!0,tokenize:CT};function NT(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),$e(e,i,"linePrefix",5)(u)}function i(u){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Ne(u)?e.attempt(jT,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Ne(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function CT(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Ne(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):$e(e,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Ne(o)?s(o):n(o)}}const ET={name:"codeText",previous:PT,resolve:TT,tokenize:AT};function TT(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function PT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function AT(e,t,n){let r=0,s,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),l(d)}function l(d){return d===96?(e.consume(d),r++,l):(e.exit("codeTextSequence"),c(d))}function c(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),c):d===96?(i=e.enter("codeTextSequence"),s=0,f(d)):Ne(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||Ne(d)?(e.exit("codeTextData"),c(d)):(e.consume(d),u)}function f(d){return d===96?(e.consume(d),s++,f):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",u(d))}}class DT{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&wa(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),wa(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),wa(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);wa(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);wa(this.left,n.reverse())}}}function wa(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function bw(e){const t={};let n=-1,r,s,i,o,l,c,u;const f=new DT(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,LT(f,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=f.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(f.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...f.get(s)[1].start},l=f.slice(s,n),l.unshift(r),f.splice(s,n-s+1,l))}}return Sn(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!u}function LT(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let f,d,h=-1,p=n,x=0,b=0;const k=[b];for(;p;){for(;e.get(++s)[1]!==p;);i.push(s),p._tokenizer||(f=r.sliceStream(p),p.next||f.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(f),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(b=h+1,k.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):k.pop(),h=k.length;h--;){const v=l.slice(k[h],k[h+1]),m=i.pop();c.push([m,m+v.length-1]),e.splice(m,2,v)}for(c.reverse(),h=-1;++h<c.length;)u[x+c[h][0]]=x+c[h][1],x+=c[h][1]-c[h][0]-1;return u}const MT={resolve:RT,tokenize:_T},IT={partial:!0,tokenize:FT};function RT(e){return bw(e),e}function _T(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):Ne(l)?e.check(IT,o,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function FT(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),$e(e,i,"linePrefix")}function i(o){if(o===null||Ne(o))return n(o);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function ww(e,t,n,r,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let f=0;return d;function d(v){return v===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(v),e.exit(i),h):v===null||v===32||v===41||Sc(v)?n(v):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(v))}function h(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(l),h(v)):v===null||v===60||Ne(v)?n(v):(e.consume(v),v===92?x:p)}function x(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function b(v){return!f&&(v===null||v===41||Ze(v))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(v)):f<u&&v===40?(e.consume(v),f++,b):v===41?(e.consume(v),f--,b):v===null||v===32||v===40||Sc(v)?n(v):(e.consume(v),v===92?k:b)}function k(v){return v===40||v===41||v===92?(e.consume(v),b):b(v)}}function kw(e,t,n,r,s,i){const o=this;let l=0,c;return u;function u(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(i),f}function f(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):Ne(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||Ne(p)||l++>999?(e.exit("chunkString"),f(p)):(e.consume(p),c||(c=!Be(p)),p===92?h:d)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,d):d(p)}}function Sw(e,t,n,r,s,i){let o;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),o=h===40?41:h,c):n(h)}function c(h){return h===o?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===o?(e.exit(i),c(o)):h===null?n(h):Ne(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),$e(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===o||h===null||Ne(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?d:f)}function d(h){return h===o||h===92?(e.consume(h),f):f(h)}}function Wa(e,t){let n;return r;function r(s){return Ne(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Be(s)?$e(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const OT={name:"definition",tokenize:VT},zT={partial:!0,tokenize:BT};function VT(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return kw.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=Yn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Ze(p)?Wa(e,u)(p):u(p)}function u(p){return ww(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function f(p){return e.attempt(zT,d,d)(p)}function d(p){return Be(p)?$e(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Ne(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function BT(e,t,n){return r;function r(l){return Ze(l)?Wa(e,s)(l):n(l)}function s(l){return Sw(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Be(l)?$e(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Ne(l)?t(l):n(l)}}const UT={name:"hardBreakEscape",tokenize:$T};function $T(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return Ne(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const HT={name:"headingAtx",resolve:WT,tokenize:KT};function WT(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Sn(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function KT(e,t,n){let r=0;return s;function s(f){return e.enter("atxHeading"),i(f)}function i(f){return e.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&r++<6?(e.consume(f),o):f===null||Ze(f)?(e.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(e.enter("atxHeadingSequence"),c(f)):f===null||Ne(f)?(e.exit("atxHeading"),t(f)):Be(f)?$e(e,l,"whitespace")(f):(e.enter("atxHeadingText"),u(f))}function c(f){return f===35?(e.consume(f),c):(e.exit("atxHeadingSequence"),l(f))}function u(f){return f===null||f===35||Ze(f)?(e.exit("atxHeadingText"),l(f)):(e.consume(f),u)}}const GT=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],F0=["pre","script","style","textarea"],qT={concrete:!0,name:"htmlFlow",resolveTo:QT,tokenize:JT},YT={partial:!0,tokenize:eP},XT={partial:!0,tokenize:ZT};function QT(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function JT(e,t,n){const r=this;let s,i,o,l,c;return u;function u(L){return f(L)}function f(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),h):L===47?(e.consume(L),i=!0,b):L===63?(e.consume(L),s=3,r.interrupt?t:E):rn(L)?(e.consume(L),o=String.fromCharCode(L),k):n(L)}function h(L){return L===45?(e.consume(L),s=2,p):L===91?(e.consume(L),s=5,l=0,x):rn(L)?(e.consume(L),s=4,r.interrupt?t:E):n(L)}function p(L){return L===45?(e.consume(L),r.interrupt?t:E):n(L)}function x(L){const Q="CDATA[";return L===Q.charCodeAt(l++)?(e.consume(L),l===Q.length?r.interrupt?t:P:x):n(L)}function b(L){return rn(L)?(e.consume(L),o=String.fromCharCode(L),k):n(L)}function k(L){if(L===null||L===47||L===62||Ze(L)){const Q=L===47,te=o.toLowerCase();return!Q&&!i&&F0.includes(te)?(s=1,r.interrupt?t(L):P(L)):GT.includes(o.toLowerCase())?(s=6,Q?(e.consume(L),v):r.interrupt?t(L):P(L)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):i?m(L):y(L))}return L===45||Yt(L)?(e.consume(L),o+=String.fromCharCode(L),k):n(L)}function v(L){return L===62?(e.consume(L),r.interrupt?t:P):n(L)}function m(L){return Be(L)?(e.consume(L),m):T(L)}function y(L){return L===47?(e.consume(L),T):L===58||L===95||rn(L)?(e.consume(L),j):Be(L)?(e.consume(L),y):T(L)}function j(L){return L===45||L===46||L===58||L===95||Yt(L)?(e.consume(L),j):S(L)}function S(L){return L===61?(e.consume(L),N):Be(L)?(e.consume(L),S):y(L)}function N(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),c=L,w):Be(L)?(e.consume(L),N):C(L)}function w(L){return L===c?(e.consume(L),c=null,D):L===null||Ne(L)?n(L):(e.consume(L),w)}function C(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||Ze(L)?S(L):(e.consume(L),C)}function D(L){return L===47||L===62||Be(L)?y(L):n(L)}function T(L){return L===62?(e.consume(L),M):n(L)}function M(L){return L===null||Ne(L)?P(L):Be(L)?(e.consume(L),M):n(L)}function P(L){return L===45&&s===2?(e.consume(L),fe):L===60&&s===1?(e.consume(L),ee):L===62&&s===4?(e.consume(L),Y):L===63&&s===3?(e.consume(L),E):L===93&&s===5?(e.consume(L),V):Ne(L)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(YT,J,F)(L)):L===null||Ne(L)?(e.exit("htmlFlowData"),F(L)):(e.consume(L),P)}function F(L){return e.check(XT,z,J)(L)}function z(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),W}function W(L){return L===null||Ne(L)?F(L):(e.enter("htmlFlowData"),P(L))}function fe(L){return L===45?(e.consume(L),E):P(L)}function ee(L){return L===47?(e.consume(L),o="",R):P(L)}function R(L){if(L===62){const Q=o.toLowerCase();return F0.includes(Q)?(e.consume(L),Y):P(L)}return rn(L)&&o.length<8?(e.consume(L),o+=String.fromCharCode(L),R):P(L)}function V(L){return L===93?(e.consume(L),E):P(L)}function E(L){return L===62?(e.consume(L),Y):L===45&&s===2?(e.consume(L),E):P(L)}function Y(L){return L===null||Ne(L)?(e.exit("htmlFlowData"),J(L)):(e.consume(L),Y)}function J(L){return e.exit("htmlFlow"),t(L)}}function ZT(e,t,n){const r=this;return s;function s(o){return Ne(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function eP(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Bo,t,n)}}const tP={name:"htmlText",tokenize:nP};function nP(e,t,n){const r=this;let s,i,o;return l;function l(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),c}function c(E){return E===33?(e.consume(E),u):E===47?(e.consume(E),S):E===63?(e.consume(E),y):rn(E)?(e.consume(E),C):n(E)}function u(E){return E===45?(e.consume(E),f):E===91?(e.consume(E),i=0,x):rn(E)?(e.consume(E),m):n(E)}function f(E){return E===45?(e.consume(E),p):n(E)}function d(E){return E===null?n(E):E===45?(e.consume(E),h):Ne(E)?(o=d,ee(E)):(e.consume(E),d)}function h(E){return E===45?(e.consume(E),p):d(E)}function p(E){return E===62?fe(E):E===45?h(E):d(E)}function x(E){const Y="CDATA[";return E===Y.charCodeAt(i++)?(e.consume(E),i===Y.length?b:x):n(E)}function b(E){return E===null?n(E):E===93?(e.consume(E),k):Ne(E)?(o=b,ee(E)):(e.consume(E),b)}function k(E){return E===93?(e.consume(E),v):b(E)}function v(E){return E===62?fe(E):E===93?(e.consume(E),v):b(E)}function m(E){return E===null||E===62?fe(E):Ne(E)?(o=m,ee(E)):(e.consume(E),m)}function y(E){return E===null?n(E):E===63?(e.consume(E),j):Ne(E)?(o=y,ee(E)):(e.consume(E),y)}function j(E){return E===62?fe(E):y(E)}function S(E){return rn(E)?(e.consume(E),N):n(E)}function N(E){return E===45||Yt(E)?(e.consume(E),N):w(E)}function w(E){return Ne(E)?(o=w,ee(E)):Be(E)?(e.consume(E),w):fe(E)}function C(E){return E===45||Yt(E)?(e.consume(E),C):E===47||E===62||Ze(E)?D(E):n(E)}function D(E){return E===47?(e.consume(E),fe):E===58||E===95||rn(E)?(e.consume(E),T):Ne(E)?(o=D,ee(E)):Be(E)?(e.consume(E),D):fe(E)}function T(E){return E===45||E===46||E===58||E===95||Yt(E)?(e.consume(E),T):M(E)}function M(E){return E===61?(e.consume(E),P):Ne(E)?(o=M,ee(E)):Be(E)?(e.consume(E),M):D(E)}function P(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),s=E,F):Ne(E)?(o=P,ee(E)):Be(E)?(e.consume(E),P):(e.consume(E),z)}function F(E){return E===s?(e.consume(E),s=void 0,W):E===null?n(E):Ne(E)?(o=F,ee(E)):(e.consume(E),F)}function z(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Ze(E)?D(E):(e.consume(E),z)}function W(E){return E===47||E===62||Ze(E)?D(E):n(E)}function fe(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function ee(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),R}function R(E){return Be(E)?$e(e,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):V(E)}function V(E){return e.enter("htmlTextData"),o(E)}}const Vp={name:"labelEnd",resolveAll:aP,resolveTo:oP,tokenize:lP},rP={tokenize:cP},sP={tokenize:uP},iP={tokenize:dP};function aP(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Sn(e,0,e.length,n),e}function oP(e,t){let n=e.length,r=0,s,i,o,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},f={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=In(l,e.slice(i+1,i+r+3)),l=In(l,[["enter",f,t]]),l=In(l,lu(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),l=In(l,[["exit",f,t],e[o-2],e[o-1],["exit",u,t]]),l=In(l,e.slice(o+1)),l=In(l,[["exit",c,t]]),Sn(e,i,e.length,l),e}function lP(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(h){return i?i._inactive?d(h):(o=r.parser.defined.includes(Yn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):n(h)}function c(h){return h===40?e.attempt(rP,f,o?f:d)(h):h===91?e.attempt(sP,f,o?u:d)(h):o?f(h):d(h)}function u(h){return e.attempt(iP,f,d)(h)}function f(h){return t(h)}function d(h){return i._balanced=!0,n(h)}}function cP(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return Ze(d)?Wa(e,i)(d):i(d)}function i(d){return d===41?f(d):ww(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Ze(d)?Wa(e,c)(d):f(d)}function l(d){return n(d)}function c(d){return d===34||d===39||d===40?Sw(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):f(d)}function u(d){return Ze(d)?Wa(e,f)(d):f(d)}function f(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function uP(e,t,n){const r=this;return s;function s(l){return kw.call(r,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Yn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function dP(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const fP={name:"labelStartImage",resolveAll:Vp.resolveAll,tokenize:hP};function hP(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const pP={name:"labelStartLink",resolveAll:Vp.resolveAll,tokenize:mP};function mP(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const rd={name:"lineEnding",tokenize:gP};function gP(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),$e(e,t,"linePrefix")}}const Ul={name:"thematicBreak",tokenize:xP};function xP(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Ne(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Be(u)?$e(e,l,"whitespace")(u):l(u))}}const ln={continuation:{tokenize:wP},exit:SP,name:"list",tokenize:bP},yP={partial:!0,tokenize:jP},vP={partial:!0,tokenize:kP};function bP(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const x=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Hf(p)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Ul,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return Hf(p)&&++o<10?(e.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Bo,r.interrupt?n:f,e.attempt(yP,h,d))}function f(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function d(p){return Be(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function wP(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Bo,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$e(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Be(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(vP,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,$e(e,e.attempt(ln,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function kP(e,t,n){const r=this;return $e(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function SP(e){e.exit(this.containerState.type)}function jP(e,t,n){const r=this;return $e(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!Be(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const O0={name:"setextUnderline",resolveTo:NP,tokenize:CP};function NP(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function CP(e,t,n){const r=this;let s;return i;function i(u){let f=r.events.length,d;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){d=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Be(u)?$e(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Ne(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const EP={tokenize:TP};function TP(e){const t=this,n=e.attempt(Bo,r,e.attempt(this.parser.constructs.flowInitial,s,$e(e,e.attempt(this.parser.constructs.flow,s,e.attempt(MT,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const PP={resolveAll:Nw()},AP=jw("string"),DP=jw("text");function jw(e){return{resolveAll:Nw(e==="text"?LP:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,l);return o;function o(f){return u(f)?i(f):l(f)}function l(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return u(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function u(f){if(f===null)return!0;const d=s[f];let h=-1;if(d)for(;++h<d.length;){const p=d[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Nw(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function LP(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const MP={42:ln,43:ln,45:ln,48:ln,49:ln,50:ln,51:ln,52:ln,53:ln,54:ln,55:ln,56:ln,57:ln,62:xw},IP={91:OT},RP={[-2]:nd,[-1]:nd,32:nd},_P={35:HT,42:Ul,45:[O0,Ul],60:qT,61:O0,95:Ul,96:_0,126:_0},FP={38:vw,92:yw},OP={[-5]:rd,[-4]:rd,[-3]:rd,33:fP,38:vw,42:Wf,60:[pT,tP],91:pP,92:[UT,yw],93:Vp,95:Wf,96:ET},zP={null:[Wf,PP]},VP={null:[42,95]},BP={null:[]},UP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:VP,contentInitial:IP,disable:BP,document:MP,flow:_P,flowInitial:RP,insideSpan:zP,string:FP,text:OP},Symbol.toStringTag,{value:"Module"}));function $P(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],l=[];const c={attempt:w(S),check:w(N),consume:m,enter:y,exit:j,interrupt:w(N,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:x,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:d};let f=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function d(M){return o=In(o,M),k(),o[o.length-1]!==null?[]:(C(t,0),u.events=lu(i,u.events,u),u.events)}function h(M,P){return WP(p(M),P)}function p(M){return HP(o,M)}function x(){const{_bufferIndex:M,_index:P,line:F,column:z,offset:W}=r;return{_bufferIndex:M,_index:P,line:F,column:z,offset:W}}function b(M){s[M.line]=M.column,T()}function k(){let M;for(;r._index<o.length;){const P=o[r._index];if(typeof P=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<P.length;)v(P.charCodeAt(r._bufferIndex));else v(P)}}function v(M){f=f(M)}function m(M){Ne(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,T()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=M}function y(M,P){const F=P||{};return F.type=M,F.start=x(),u.events.push(["enter",F,u]),l.push(F),F}function j(M){const P=l.pop();return P.end=x(),u.events.push(["exit",P,u]),P}function S(M,P){C(M,P.from)}function N(M,P){P.restore()}function w(M,P){return F;function F(z,W,fe){let ee,R,V,E;return Array.isArray(z)?J(z):"tokenize"in z?J([z]):Y(z);function Y(pe){return ne;function ne(ie){const he=ie!==null&&pe[ie],Ce=ie!==null&&pe.null,Te=[...Array.isArray(he)?he:he?[he]:[],...Array.isArray(Ce)?Ce:Ce?[Ce]:[]];return J(Te)(ie)}}function J(pe){return ee=pe,R=0,pe.length===0?fe:L(pe[R])}function L(pe){return ne;function ne(ie){return E=D(),V=pe,pe.partial||(u.currentConstruct=pe),pe.name&&u.parser.constructs.disable.null.includes(pe.name)?te():pe.tokenize.call(P?Object.assign(Object.create(u),P):u,c,Q,te)(ie)}}function Q(pe){return M(V,E),W}function te(pe){return E.restore(),++R<ee.length?L(ee[R]):fe}}}function C(M,P){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&Sn(u.events,P,u.events.length-P,M.resolve(u.events.slice(P),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function D(){const M=x(),P=u.previous,F=u.currentConstruct,z=u.events.length,W=Array.from(l);return{from:z,restore:fe};function fe(){r=M,u.previous=P,u.currentConstruct=F,u.events.length=z,l=W,T()}}function T(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function HP(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function WP(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
550
+ `;break}case-3:{o=`\r
551
+ `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function KP(e){const r={constructs:mw([UP,...(e||{}).extensions||[]]),content:s(oT),defined:[],document:s(cT),flow:s(EP),lazy:{},string:s(AP),text:s(DP)};return r;function s(i){return o;function o(l){return $P(r,i,l)}}}function GP(e){for(;!bw(e););return e}const z0=/[\0\t\n\r]/g;function qP(){let e=1,t="",n=!0,r;return s;function s(i,o,l){const c=[];let u,f,d,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(z0.lastIndex=d,u=z0.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(d);break}if(p===10&&d===h&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),d<h&&(c.push(i.slice(d,h)),e+=h-d),p){case 0:{c.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,c.push(-2);e++<f;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}d=h+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const YP=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function XP(e){return e.replace(YP,QP)}function QP(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return gw(n.slice(i?2:1),i?16:10)}return zp(n)||e}const Cw={}.hasOwnProperty;function JP(e,t,n){return typeof t!="string"&&(n=t,t=void 0),ZP(n)(GP(KP(n).document().write(qP()(e,t,!0))))}function ZP(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(qe),autolinkProtocol:D,autolinkEmail:D,atxHeading:i(q),blockQuote:i(Ce),characterEscape:D,characterReference:D,codeFenced:i(Te),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Te,o),codeText:i(K,o),codeTextData:D,data:D,codeFlowValue:D,definition:i($),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(xe),hardBreakEscape:i(ye),hardBreakTrailing:i(ye),htmlFlow:i(Le,o),htmlFlowData:D,htmlText:i(Le,o),htmlTextData:D,image:i(He),label:o,link:i(qe),listItem:i(jt),listItemValue:h,listOrdered:i(St,d),listUnordered:i(St),paragraph:i(vt),reference:L,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(q),strong:i(Ye),thematicBreak:i(Et)},exit:{atxHeading:c(),atxHeadingSequence:S,autolink:c(),autolinkEmail:he,autolinkProtocol:ie,blockQuote:c(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:pe,characterReference:ne,codeFenced:c(k),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:x,codeFlowValue:T,codeIndented:c(v),codeText:c(W),codeTextData:T,data:T,definition:c(),definitionDestinationString:j,definitionLabelString:m,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(P),hardBreakTrailing:c(P),htmlFlow:c(F),htmlFlowData:T,htmlText:c(z),htmlTextData:T,image:c(ee),label:V,labelText:R,lineEnding:M,link:c(fe),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Q,resourceDestinationString:E,resourceTitleString:Y,resource:J,setextHeading:c(C),setextHeadingLineSequence:w,setextHeadingText:N,strong:c(),thematicBreak:c()}};Ew(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let G={type:"root",children:[]};const se={stack:[G],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:f,data:n},we=[];let O=-1;for(;++O<H.length;)if(H[O][1].type==="listOrdered"||H[O][1].type==="listUnordered")if(H[O][0]==="enter")we.push(O);else{const oe=we.pop();O=s(H,oe,O)}for(O=-1;++O<H.length;){const oe=t[H[O][0]];Cw.call(oe,H[O][1].type)&&oe[H[O][1].type].call(Object.assign({sliceSerialize:H[O][2].sliceSerialize},se),H[O][1])}if(se.tokenStack.length>0){const oe=se.tokenStack[se.tokenStack.length-1];(oe[1]||V0).call(se,void 0,oe[0])}for(G.position={start:Fr(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Fr(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},O=-1;++O<t.transforms.length;)G=t.transforms[O](G)||G;return G}function s(H,G,se){let we=G-1,O=-1,oe=!1,be,Me,et,Ve;for(;++we<=se;){const tt=H[we];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?O++:O--,Ve=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(be&&!Ve&&!O&&!et&&(et=we),Ve=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ve=void 0}if(!O&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||O===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(be){let It=we;for(Me=void 0;It--;){const at=H[It];if(at[1].type==="lineEnding"||at[1].type==="lineEndingBlank"){if(at[0]==="exit")continue;Me&&(H[Me][1].type="lineEndingBlank",oe=!0),at[1].type="lineEnding",Me=It}else if(!(at[1].type==="linePrefix"||at[1].type==="blockQuotePrefix"||at[1].type==="blockQuotePrefixWhitespace"||at[1].type==="blockQuoteMarker"||at[1].type==="listItemIndent"))break}et&&(!Me||et<Me)&&(be._spread=!0),be.end=Object.assign({},Me?H[Me][1].start:tt[1].end),H.splice(Me||we,0,["exit",be,tt[2]]),we++,se++}if(tt[1].type==="listItemPrefix"){const It={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};be=It,H.splice(we,0,["enter",It,tt[2]]),we++,se++,et=void 0,Ve=!0}}}return H[G][1]._spread=oe,se}function i(H,G){return se;function se(we){l.call(this,H(we),we),G&&G.call(this,we)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(H,G,se){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([G,se||void 0]),H.position={start:Fr(G.start),end:void 0}}function c(H){return G;function G(se){H&&H.call(this,se),u.call(this,se)}}function u(H,G){const se=this.stack.pop(),we=this.tokenStack.pop();if(we)we[0].type!==H.type&&(G?G.call(this,H,we[0]):(we[1]||V0).call(this,H,we[0]));else throw new Error("Cannot close `"+H.type+"` ("+Ha({start:H.start,end:H.end})+"): it’s not open");se.position.end=Fr(H.end)}function f(){return Op(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(H){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function p(){const H=this.resume(),G=this.stack[this.stack.length-1];G.lang=H}function x(){const H=this.resume(),G=this.stack[this.stack.length-1];G.meta=H}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const H=this.resume(),G=this.stack[this.stack.length-1];G.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const H=this.resume(),G=this.stack[this.stack.length-1];G.value=H.replace(/(\r?\n|\r)$/g,"")}function m(H){const G=this.resume(),se=this.stack[this.stack.length-1];se.label=G,se.identifier=Yn(this.sliceSerialize(H)).toLowerCase()}function y(){const H=this.resume(),G=this.stack[this.stack.length-1];G.title=H}function j(){const H=this.resume(),G=this.stack[this.stack.length-1];G.url=H}function S(H){const G=this.stack[this.stack.length-1];if(!G.depth){const se=this.sliceSerialize(H).length;G.depth=se}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function w(H){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function C(){this.data.setextHeadingSlurpLineEnding=void 0}function D(H){const se=this.stack[this.stack.length-1].children;let we=se[se.length-1];(!we||we.type!=="text")&&(we=it(),we.position={start:Fr(H.start),end:void 0},se.push(we)),this.stack.push(we)}function T(H){const G=this.stack.pop();G.value+=this.sliceSerialize(H),G.position.end=Fr(H.end)}function M(H){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const se=G.children[G.children.length-1];se.position.end=Fr(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&(D.call(this,H),T.call(this,H))}function P(){this.data.atHardBreak=!0}function F(){const H=this.resume(),G=this.stack[this.stack.length-1];G.value=H}function z(){const H=this.resume(),G=this.stack[this.stack.length-1];G.value=H}function W(){const H=this.resume(),G=this.stack[this.stack.length-1];G.value=H}function fe(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=G,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function ee(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=G,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function R(H){const G=this.sliceSerialize(H),se=this.stack[this.stack.length-2];se.label=XP(G),se.identifier=Yn(G).toLowerCase()}function V(){const H=this.stack[this.stack.length-1],G=this.resume(),se=this.stack[this.stack.length-1];if(this.data.inReference=!0,se.type==="link"){const we=H.children;se.children=we}else se.alt=G}function E(){const H=this.resume(),G=this.stack[this.stack.length-1];G.url=H}function Y(){const H=this.resume(),G=this.stack[this.stack.length-1];G.title=H}function J(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function Q(H){const G=this.resume(),se=this.stack[this.stack.length-1];se.label=G,se.identifier=Yn(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function te(H){this.data.characterReferenceType=H.type}function pe(H){const G=this.sliceSerialize(H),se=this.data.characterReferenceType;let we;se?(we=gw(G,se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=zp(G);const O=this.stack[this.stack.length-1];O.value+=we}function ne(H){const G=this.stack.pop();G.position.end=Fr(H.end)}function ie(H){T.call(this,H);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(H)}function he(H){T.call(this,H);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(H)}function Ce(){return{type:"blockquote",children:[]}}function Te(){return{type:"code",lang:null,meta:null,value:""}}function K(){return{type:"inlineCode",value:""}}function $(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xe(){return{type:"emphasis",children:[]}}function q(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function Le(){return{type:"html",value:""}}function He(){return{type:"image",title:null,url:"",alt:null}}function qe(){return{type:"link",title:null,url:"",children:[]}}function St(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function jt(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function vt(){return{type:"paragraph",children:[]}}function Ye(){return{type:"strong",children:[]}}function it(){return{type:"text",value:""}}function Et(){return{type:"thematicBreak"}}}function Fr(e){return{line:e.line,column:e.column,offset:e.offset}}function Ew(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Ew(e,r):e3(e,r)}}function e3(e,t){let n;for(n in t)if(Cw.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function V0(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ha({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ha({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ha({start:t.start,end:t.end})+") is still open")}function t3(e){const t=this;t.parser=n;function n(r){return JP(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function n3(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function r3(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
552
+ `}]}function s3(e,t){const n=t.value?t.value+`
553
+ `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function i3(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function a3(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function o3(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=sa(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function l3(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function c3(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Tw(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function u3(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Tw(e,t);const s={src:sa(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function d3(e,t){const n={src:sa(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function f3(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function h3(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Tw(e,t);const s={href:sa(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function p3(e,t){const n={href:sa(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function m3(e,t,n){const r=e.all(t),s=n?g3(n):Pw(t),i={},o=[];if(typeof t.checked=="boolean"){const f=r[0];let d;f&&f.type==="element"&&f.tagName==="p"?d=f:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const f=r[l];(s||l!==0||f.type!=="element"||f.tagName!=="p")&&o.push({type:"text",value:`
554
+ `}),f.type==="element"&&f.tagName==="p"&&!s?o.push(...f.children):o.push(f)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
555
+ `});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function g3(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Pw(n[r])}return t}function Pw(e){const t=e.spread;return t??e.children.length>1}function x3(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function y3(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function v3(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function b3(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w3(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Ip(t.children[1]),c=lw(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function k3(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const d=t.children[c],h={},p=o?o[c]:void 0;p&&(h.align=p);let x={type:"element",tagName:i,properties:h,children:[]};d&&(x.children=e.all(d),e.patch(d,x),x=e.applyData(d,x)),u.push(x)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,f),e.applyData(t,f)}function S3(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const B0=9,U0=32;function j3(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push($0(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push($0(t.slice(s),s>0,!1)),i.join("")}function $0(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===B0||i===U0;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===B0||i===U0;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function N3(e,t){const n={type:"text",value:j3(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function C3(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const E3={blockquote:n3,break:r3,code:s3,delete:i3,emphasis:a3,footnoteReference:o3,heading:l3,html:c3,imageReference:u3,image:d3,inlineCode:f3,linkReference:h3,link:p3,listItem:m3,list:x3,paragraph:y3,root:v3,strong:b3,table:w3,tableCell:S3,tableRow:k3,text:N3,thematicBreak:C3,toml:pl,yaml:pl,definition:pl,footnoteDefinition:pl};function pl(){}const Aw=-1,cu=0,Ka=1,jc=2,Bp=3,Up=4,$p=5,Hp=6,Dw=7,Lw=8,H0=typeof self=="object"?self:globalThis,T3=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case cu:case Aw:return n(o,s);case Ka:{const l=n([],s);for(const c of o)l.push(r(c));return l}case jc:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case Bp:return n(new Date(o),s);case Up:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case $p:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case Hp:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case Dw:{const{name:l,message:c}=o;return n(new H0[l](c),s)}case Lw:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new H0[i](o),s)};return r},W0=e=>T3(new Map,e)(0),li="",{toString:P3}={},{keys:A3}=Object,ka=e=>{const t=typeof e;if(t!=="object"||!e)return[cu,t];const n=P3.call(e).slice(8,-1);switch(n){case"Array":return[Ka,li];case"Object":return[jc,li];case"Date":return[Bp,li];case"RegExp":return[Up,li];case"Map":return[$p,li];case"Set":return[Hp,li];case"DataView":return[Ka,n]}return n.includes("Array")?[Ka,n]:n.includes("Error")?[Dw,n]:[jc,n]},ml=([e,t])=>e===cu&&(t==="function"||t==="symbol"),D3=(e,t,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=ka(o);switch(l){case cu:{let f=o;switch(c){case"bigint":l=Lw,f=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([Aw],o)}return s([l,f],o)}case Ka:{if(c){let h=o;return c==="DataView"?h=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(o)),s([c,[...h]],o)}const f=[],d=s([l,f],o);for(const h of o)f.push(i(h));return d}case jc:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const f=[],d=s([l,f],o);for(const h of A3(o))(e||!ml(ka(o[h])))&&f.push([i(h),i(o[h])]);return d}case Bp:return s([l,o.toISOString()],o);case Up:{const{source:f,flags:d}=o;return s([l,{source:f,flags:d}],o)}case $p:{const f=[],d=s([l,f],o);for(const[h,p]of o)(e||!(ml(ka(h))||ml(ka(p))))&&f.push([i(h),i(p)]);return d}case Hp:{const f=[],d=s([l,f],o);for(const h of o)(e||!ml(ka(h)))&&f.push(i(h));return d}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},K0=(e,{json:t,lossy:n}={})=>{const r=[];return D3(!(t||n),!!t,new Map,r)(e),r},Nc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?W0(K0(e,t)):structuredClone(e):(e,t)=>W0(K0(e,t));function L3(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function M3(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function I3(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||L3,r=e.options.footnoteBackLabel||M3,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const f=e.all(u),d=String(u.identifier).toUpperCase(),h=sa(d.toLowerCase());let p=0;const x=[],b=e.footnoteCounts.get(d);for(;b!==void 0&&++p<=b;){x.length>0&&x.push({type:"text",value:" "});let m=typeof n=="string"?n:n(c,p);typeof m=="string"&&(m={type:"text",value:m}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(m)?m:[m]})}const k=f[f.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const m=k.children[k.children.length-1];m&&m.type==="text"?m.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...x)}else f.push(...x);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(f,!0)};e.patch(u,v),l.push(v)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Nc(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
556
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
557
+ `}]}}const uu=function(e){if(e==null)return O3;if(typeof e=="function")return du(e);if(typeof e=="object")return Array.isArray(e)?R3(e):_3(e);if(typeof e=="string")return F3(e);throw new Error("Expected function, string, or object as test")};function R3(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=uu(e[n]);return du(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function _3(e){const t=e;return du(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function F3(e){return du(t);function t(n){return n&&n.type===e}}function du(e){return t;function t(n,r,s){return!!(z3(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function O3(){return!0}function z3(e){return e!==null&&typeof e=="object"&&"type"in e}const Mw=[],V3=!0,Kf=!1,B3="skip";function Iw(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=uu(s),o=r?-1:1;l(e,void 0,[])();function l(c,u,f){const d=c&&typeof c=="object"?c:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=Mw,x,b,k;if((!t||i(c,u,f[f.length-1]||void 0))&&(p=U3(n(c,f)),p[0]===Kf))return p;if("children"in c&&c.children){const v=c;if(v.children&&p[0]!==B3)for(b=(r?v.children.length:-1)+o,k=f.concat(v);b>-1&&b<v.children.length;){const m=v.children[b];if(x=l(m,b,k)(),x[0]===Kf)return x;b=typeof x[1]=="number"?x[1]:b+o}}return p}}}function U3(e){return Array.isArray(e)?e:typeof e=="number"?[V3,e]:e==null?Mw:[e]}function Wp(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),Iw(e,i,l,s);function l(c,u){const f=u[u.length-1],d=f?f.children.indexOf(c):void 0;return o(c,d,f)}}const Gf={}.hasOwnProperty,$3={};function H3(e,t){const n=t||$3,r=new Map,s=new Map,i=new Map,o={...E3,...n.handlers},l={all:u,applyData:K3,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:W3,wrap:q3};return Wp(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const d=f.type==="definition"?r:s,h=String(f.identifier).toUpperCase();d.has(h)||d.set(h,f)}}),l;function c(f,d){const h=f.type,p=l.handlers[h];if(Gf.call(l.handlers,h)&&p)return p(l,f,d);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in f){const{children:b,...k}=f,v=Nc(k);return v.children=l.all(f),v}return Nc(f)}return(l.options.unknownHandler||G3)(l,f,d)}function u(f){const d=[];if("children"in f){const h=f.children;let p=-1;for(;++p<h.length;){const x=l.one(h[p],f);if(x){if(p&&h[p-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=G0(x.value)),!Array.isArray(x)&&x.type==="element")){const b=x.children[0];b&&b.type==="text"&&(b.value=G0(b.value))}Array.isArray(x)?d.push(...x):d.push(x)}}}return d}}function W3(e,t){e.position&&(t.position=M4(e))}function K3(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Nc(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function G3(e,t){const n=t.data||{},r="value"in t&&!(Gf.call(n,"hProperties")||Gf.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function q3(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
558
+ `});++r<e.length;)r&&n.push({type:"text",value:`
559
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
560
+ `}),n}function G0(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function q0(e,t){const n=H3(e,t),r=n.one(e,void 0),s=I3(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
561
+ `},s),i}function Y3(e,t){return e&&"run"in e?async function(n,r){const s=q0(n,{file:r,...t});await e.run(s,r)}:function(n,r){return q0(n,{file:r,...e||t})}}function Y0(e){if(e)throw e}var $l=Object.prototype.hasOwnProperty,Rw=Object.prototype.toString,X0=Object.defineProperty,Q0=Object.getOwnPropertyDescriptor,J0=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Rw.call(t)==="[object Array]"},Z0=function(t){if(!t||Rw.call(t)!=="[object Object]")return!1;var n=$l.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&$l.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||$l.call(t,s)},ex=function(t,n){X0&&n.name==="__proto__"?X0(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},tx=function(t,n){if(n==="__proto__")if($l.call(t,n)){if(Q0)return Q0(t,n).value}else return;return t[n]},X3=function e(){var t,n,r,s,i,o,l=arguments[0],c=1,u=arguments.length,f=!1;for(typeof l=="boolean"&&(f=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=tx(l,n),s=tx(t,n),l!==s&&(f&&s&&(Z0(s)||(i=J0(s)))?(i?(i=!1,o=r&&J0(r)?r:[]):o=r&&Z0(r)?r:{},ex(l,{name:n,newValue:e(f,o,s)})):typeof s<"u"&&ex(l,{name:n,newValue:s}));return l};const sd=Ao(X3);function qf(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Q3(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(c,...u){const f=e[++i];let d=-1;if(c){o(c);return}for(;++d<s.length;)(u[d]===null||u[d]===void 0)&&(u[d]=s[d]);s=u,f?J3(f,l)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function J3(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(u){const f=u;if(l&&n)throw f;return s(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){n||(n=!0,t(o,...l))}function i(o){s(null,o)}}const rr={basename:Z3,dirname:eA,extname:tA,join:nA,sep:"/"};function Z3(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Uo(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function eA(e){if(Uo(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function tA(e){Uo(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function nA(...e){let t=-1,n;for(;++t<e.length;)Uo(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":rA(n)}function rA(e){Uo(e);const t=e.codePointAt(0)===47;let n=sA(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function sA(e,t){let n="",r=0,s=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Uo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const iA={cwd:aA};function aA(){return"/"}function Yf(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function oA(e){if(typeof e=="string")e=new URL(e);else if(!Yf(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return lA(e)}function lA(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const id=["history","path","basename","stem","extname","dirname"];class _w{constructor(t){let n;t?Yf(t)?n={path:t}:typeof t=="string"||cA(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":iA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<id.length;){const i=id[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)id.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?rr.basename(this.path):void 0}set basename(t){od(t,"basename"),ad(t,"basename"),this.path=rr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?rr.dirname(this.path):void 0}set dirname(t){nx(this.basename,"dirname"),this.path=rr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?rr.extname(this.path):void 0}set extname(t){if(ad(t,"extname"),nx(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=rr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Yf(t)&&(t=oA(t)),od(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?rr.basename(this.path,this.extname):void 0}set stem(t){od(t,"stem"),ad(t,"stem"),this.path=rr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new tn(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ad(e,t){if(e&&e.includes(rr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+rr.sep+"`")}function od(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function nx(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function cA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const uA=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},dA={}.hasOwnProperty;class Kp extends uA{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Q3()}copy(){const t=new Kp;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(sd(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ud("data",this.frozen),this.namespace[t]=n,this):dA.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ud("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=gl(t),r=this.parser||this.Parser;return ld("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ld("process",this.parser||this.Parser),cd("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const l=gl(t),c=r.parse(l);r.run(c,l,function(f,d,h){if(f||!d||!h)return u(f);const p=d,x=r.stringify(p,h);pA(x)?h.value=x:h.result=x,u(f,h)});function u(f,d){f||!d?o(f):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),ld("processSync",this.parser||this.Parser),cd("processSync",this.compiler||this.Compiler),this.process(t,s),sx("processSync","process",n),r;function s(i,o){n=!0,Y0(i),r=o}}run(t,n,r){rx(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,l){const c=gl(n);s.run(t,c,u);function u(f,d,h){const p=d||t;f?l(f):o?o(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),sx("runSync","run",r),s;function i(o,l){Y0(o),s=l,r=!0}}stringify(t,n){this.freeze();const r=gl(n),s=this.compiler||this.Compiler;return cd("stringify",s),rx(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(ud("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[f,...d]=u;c(f,d)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=sd(!0,s.settings,u.settings))}function l(u){let f=-1;if(u!=null)if(Array.isArray(u))for(;++f<u.length;){const d=u[f];i(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,f){let d=-1,h=-1;for(;++d<r.length;)if(r[d][0]===u){h=d;break}if(h===-1)r.push([u,...f]);else if(f.length>0){let[p,...x]=f;const b=r[h][1];qf(b)&&qf(p)&&(p=sd(!0,b,p)),r[h]=[u,p,...x]}}}}const fA=new Kp().freeze();function ld(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ud(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function rx(e){if(!qf(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function sx(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function gl(e){return hA(e)?e:new _w(e)}function hA(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function pA(e){return typeof e=="string"||mA(e)}function mA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const gA="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ix=[],ax={allowDangerousHtml:!0},xA=/^(https?|ircs?|mailto|xmpp)$/i,yA=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function vA(e){const t=bA(e),n=wA(e);return kA(t.runSync(t.parse(n),n),e)}function bA(e){const t=e.rehypePlugins||ix,n=e.remarkPlugins||ix,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ax}:ax;return fA().use(t3).use(n).use(Y3,r).use(t)}function wA(e){const t=e.children||"",n=new _w;return typeof t=="string"&&(n.value=t),n}function kA(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||SA;for(const f of yA)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+gA+f.id,void 0);return Wp(e,u),O4(e,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(f,d,h){if(f.type==="raw"&&h&&typeof d=="number")return o?h.children.splice(d,1):h.children[d]={type:"text",value:f.value},d;if(f.type==="element"){let p;for(p in td)if(Object.hasOwn(td,p)&&Object.hasOwn(f.properties,p)){const x=f.properties[p],b=td[p];(b===null||b.includes(f.tagName))&&(f.properties[p]=c(String(x||""),p,f))}}if(f.type==="element"){let p=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!p&&r&&typeof d=="number"&&(p=!r(f,d,h)),p&&h&&typeof d=="number")return l&&f.children?h.children.splice(d,1,...f.children):h.children.splice(d,1),d}}}function SA(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||xA.test(e.slice(0,t))?e:""}function ox(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function jA(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function NA(e,t,n){const s=uu((n||{}).ignore||[]),i=CA(t);let o=-1;for(;++o<i.length;)Iw(e,"text",l);function l(u,f){let d=-1,h;for(;++d<f.length;){const p=f[d],x=h?h.children:void 0;if(s(p,x?x.indexOf(p):void 0,h))return;h=p}if(h)return c(u,f)}function c(u,f){const d=f[f.length-1],h=i[o][0],p=i[o][1];let x=0;const k=d.children.indexOf(u);let v=!1,m=[];h.lastIndex=0;let y=h.exec(u.value);for(;y;){const j=y.index,S={index:y.index,input:y.input,stack:[...f,u]};let N=p(...y,S);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?h.lastIndex=j+1:(x!==j&&m.push({type:"text",value:u.value.slice(x,j)}),Array.isArray(N)?m.push(...N):N&&m.push(N),x=j+y[0].length,v=!0),!h.global)break;y=h.exec(u.value)}return v?(x<u.value.length&&m.push({type:"text",value:u.value.slice(x)}),d.children.splice(k,1,...m)):m=[u],k+m.length}}function CA(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([EA(s[0]),TA(s[1])])}return t}function EA(e){return typeof e=="string"?new RegExp(jA(e),"g"):e}function TA(e){return typeof e=="function"?e:function(){return e}}const dd="phrasing",fd=["autolink","link","image","label"];function PA(){return{transforms:[_A],enter:{literalAutolink:DA,literalAutolinkEmail:hd,literalAutolinkHttp:hd,literalAutolinkWww:hd},exit:{literalAutolink:RA,literalAutolinkEmail:IA,literalAutolinkHttp:LA,literalAutolinkWww:MA}}}function AA(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:fd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:dd,notInConstruct:fd},{character:":",before:"[ps]",after:"\\/",inConstruct:dd,notInConstruct:fd}]}}function DA(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function hd(e){this.config.enter.autolinkProtocol.call(this,e)}function LA(e){this.config.exit.autolinkProtocol.call(this,e)}function MA(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function IA(e){this.config.exit.autolinkEmail.call(this,e)}function RA(e){this.exit(e)}function _A(e){NA(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,FA],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),OA]],{ignore:["link","linkReference"]})}function FA(e,t,n,r,s){let i="";if(!Fw(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!zA(n)))return!1;const o=VA(n+r);if(!o[0])return!1;const l={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function OA(e,t,n,r){return!Fw(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function zA(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function VA(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=ox(e,"(");let i=ox(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function Fw(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Qs(n)||ou(n))&&(!t||n!==47)}Ow.peek=YA;function BA(){this.buffer()}function UA(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function $A(){this.buffer()}function HA(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function WA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function KA(e){this.exit(e)}function GA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qA(e){this.exit(e)}function YA(){return"["}function Ow(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),l(),o(),i+=s.move("]"),i}function XA(){return{enter:{gfmFootnoteCallString:BA,gfmFootnoteCall:UA,gfmFootnoteDefinitionLabelString:$A,gfmFootnoteDefinition:HA},exit:{gfmFootnoteCallString:WA,gfmFootnoteCall:KA,gfmFootnoteDefinitionLabelString:GA,gfmFootnoteDefinition:qA}}}function QA(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ow},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const l=i.createTracker(o);let c=l.move("[^");const u=i.enter("footnoteDefinition"),f=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),f(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
562
+ `:" ")+i.indentLines(i.containerFlow(r,l.current()),t?zw:JA))),u(),c}}function JA(e,t,n){return t===0?e:zw(e,t,n)}function zw(e,t,n){return(n?"":" ")+e}const ZA=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Vw.peek=sD;function eD(){return{canContainEols:["delete"],enter:{strikethrough:nD},exit:{strikethrough:rD}}}function tD(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ZA}],handlers:{delete:Vw}}}function nD(e){this.enter({type:"delete",children:[]},e)}function rD(e){this.exit(e)}function Vw(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function sD(){return"~"}function iD(e){return e.length}function aD(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||iD,i=[],o=[],l=[],c=[];let u=0,f=-1;for(;++f<e.length;){const b=[],k=[];let v=-1;for(e[f].length>u&&(u=e[f].length);++v<e[f].length;){const m=oD(e[f][v]);if(n.alignDelimiters!==!1){const y=s(m);k[v]=y,(c[v]===void 0||y>c[v])&&(c[v]=y)}b.push(m)}o[f]=b,l[f]=k}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<u;)i[d]=lx(r[d]);else{const b=lx(r);for(;++d<u;)i[d]=b}d=-1;const h=[],p=[];for(;++d<u;){const b=i[d];let k="",v="";b===99?(k=":",v=":"):b===108?k=":":b===114&&(v=":");let m=n.alignDelimiters===!1?1:Math.max(1,c[d]-k.length-v.length);const y=k+"-".repeat(m)+v;n.alignDelimiters!==!1&&(m=k.length+m+v.length,m>c[d]&&(c[d]=m),p[d]=m),h[d]=y}o.splice(1,0,h),l.splice(1,0,p),f=-1;const x=[];for(;++f<o.length;){const b=o[f],k=l[f];d=-1;const v=[];for(;++d<u;){const m=b[d]||"";let y="",j="";if(n.alignDelimiters!==!1){const S=c[d]-(k[d]||0),N=i[d];N===114?y=" ".repeat(S):N===99?S%2?(y=" ".repeat(S/2+.5),j=" ".repeat(S/2-.5)):(y=" ".repeat(S/2),j=y):j=" ".repeat(S)}n.delimiterStart!==!1&&!d&&v.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&m==="")&&(n.delimiterStart!==!1||d)&&v.push(" "),n.alignDelimiters!==!1&&v.push(y),v.push(m),n.alignDelimiters!==!1&&v.push(j),n.padding!==!1&&v.push(" "),(n.delimiterEnd!==!1||d!==u-1)&&v.push("|")}x.push(n.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return x.join(`
563
+ `)}function oD(e){return e==null?"":String(e)}function lx(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function lD(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),cD);return s(),o}function cD(e,t,n){return">"+(n?"":" ")+e}function uD(e,t){return cx(e,t.inConstruct,!0)&&!cx(e,t.notInConstruct,!1)}function cx(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function ux(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
564
+ `&&uD(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
565
+ `}function dD(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function fD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function hD(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function pD(e,t,n,r){const s=hD(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(fD(e,n)){const d=n.enter("codeIndented"),h=n.indentLines(i,mD);return d(),h}const l=n.createTracker(r),c=s.repeat(Math.max(dD(i,s)+1,3)),u=n.enter("codeFenced");let f=l.move(c);if(e.lang){const d=n.enter(`codeFencedLang${o}`);f+=l.move(n.safe(e.lang,{before:f,after:" ",encode:["`"],...l.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${o}`);f+=l.move(" "),f+=l.move(n.safe(e.meta,{before:f,after:`
566
+ `,encode:["`"],...l.current()})),d()}return f+=l.move(`
567
+ `),i&&(f+=l.move(i+`
568
+ `)),f+=l.move(c),u(),f}function mD(e,t,n){return(n?"":" ")+e}function Gp(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function gD(e,t,n,r){const s=Gp(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":`
569
+ `,...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),o(),u}function xD(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function jo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Cc(e,t,n){const r=qi(e),s=qi(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Bw.peek=yD;function Bw(e,t,n,r){const s=xD(n),i=n.enter("emphasis"),o=n.createTracker(r),l=o.move(s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),f=Cc(r.before.charCodeAt(r.before.length-1),u,s);f.inside&&(c=jo(u)+c.slice(1));const d=c.charCodeAt(c.length-1),h=Cc(r.after.charCodeAt(0),d,s);h.inside&&(c=c.slice(0,-1)+jo(d));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:f.outside},l+c+p}function yD(e,t,n){return n.options.emphasis||"*"}function vD(e,t){let n=!1;return Wp(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Kf}),!!((!e.depth||e.depth<3)&&Op(e)&&(t.options.setext||n))}function bD(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(vD(e,n)){const f=n.enter("headingSetext"),d=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:`
570
+ `,after:`
571
+ `});return d(),f(),h+`
572
+ `+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
573
+ `))+1))}const o="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
574
+ `,...i.current()});return/^[\t ]/.test(u)&&(u=jo(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),c(),l(),u}Uw.peek=wD;function Uw(e){return e.value||""}function wD(){return"<"}$w.peek=kD;function $w(e,t,n,r){const s=Gp(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),l()),u+=c.move(")"),o(),u}function kD(){return"!"}Hw.peek=SD;function Hw(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const f=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=f,i(),s==="full"||!u||u!==d?c+=l.move(d+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function SD(){return"!"}Ww.peek=jD;function Ww(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],l=n.compilePattern(o);let c;if(o.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return s+r+s}function jD(){return"`"}function Kw(e,t){const n=Op(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Gw.peek=ND;function Gw(e,t,n,r){const s=Gp(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let l,c;if(Kw(e,n)){const f=n.stack;n.stack=[],l=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),l(),n.stack=f,d}l=n.enter("link"),c=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(c=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=o.move(" "+s),u+=o.move(n.safe(e.title,{before:u,after:s,...o.current()})),u+=o.move(s),c()),u+=o.move(")"),l(),u}function ND(e,t,n){return Kw(e,n)?"<":"["}qw.peek=CD;function qw(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),o();const f=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return o(),n.stack=f,i(),s==="full"||!u||u!==d?c+=l.move(d+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function CD(){return"["}function qp(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function ED(e){const t=qp(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function TD(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Yw(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function PD(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?TD(n):qp(n);const l=e.ordered?o==="."?")":".":ED(n);let c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const f=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Yw(n)===o&&f){let d=-1;for(;++d<e.children.length;){const h=e.children[d];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(o=l),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),u}function AD(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function DD(e,t,n,r){const s=AD(n);let i=n.bulletCurrent||qp(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(o-i.length)),l.shift(o);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),f);return c(),u;function f(d,h,p){return h?(p?"":" ".repeat(o))+d:(p?i:i+" ".repeat(o-i.length))+d}}function LD(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const MD=uu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ID(e,t,n,r){return(e.children.some(function(o){return MD(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function RD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Xw.peek=_D;function Xw(e,t,n,r){const s=RD(n),i=n.enter("strong"),o=n.createTracker(r),l=o.move(s+s);let c=o.move(n.containerPhrasing(e,{after:s,before:l,...o.current()}));const u=c.charCodeAt(0),f=Cc(r.before.charCodeAt(r.before.length-1),u,s);f.inside&&(c=jo(u)+c.slice(1));const d=c.charCodeAt(c.length-1),h=Cc(r.after.charCodeAt(0),d,s);h.inside&&(c=c.slice(0,-1)+jo(d));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:f.outside},l+c+p}function _D(e,t,n){return n.options.strong||"*"}function FD(e,t,n,r){return n.safe(e.value,r)}function OD(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function zD(e,t,n){const r=(Yw(n)+(n.options.ruleSpaces?" ":"")).repeat(OD(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Qw={blockquote:lD,break:ux,code:pD,definition:gD,emphasis:Bw,hardBreak:ux,heading:bD,html:Uw,image:$w,imageReference:Hw,inlineCode:Ww,link:Gw,linkReference:qw,list:PD,listItem:DD,paragraph:LD,root:ID,strong:Xw,text:FD,thematicBreak:zD};function VD(){return{enter:{table:BD,tableData:dx,tableHeader:dx,tableRow:$D},exit:{codeText:HD,table:UD,tableData:pd,tableHeader:pd,tableRow:pd}}}function BD(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function UD(e){this.exit(e),this.data.inTable=void 0}function $D(e){this.enter({type:"tableRow",children:[]},e)}function pd(e){this.exit(e)}function dx(e){this.enter({type:"tableCell",children:[]},e)}function HD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,WD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function WD(e,t){return t==="|"?t:e}function KD(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
575
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:c,tableRow:l}};function o(p,x,b,k){return u(f(p,b,k),p.align)}function l(p,x,b,k){const v=d(p,b,k),m=u([v]);return m.slice(0,m.indexOf(`
576
+ `))}function c(p,x,b,k){const v=b.enter("tableCell"),m=b.enter("phrasing"),y=b.containerPhrasing(p,{...k,before:i,after:i});return m(),v(),y}function u(p,x){return aD(p,{align:x,alignDelimiters:r,padding:n,stringLength:s})}function f(p,x,b){const k=p.children;let v=-1;const m=[],y=x.enter("table");for(;++v<k.length;)m[v]=d(k[v],x,b);return y(),m}function d(p,x,b){const k=p.children;let v=-1;const m=[],y=x.enter("tableRow");for(;++v<k.length;)m[v]=c(k[v],p,x,b);return y(),m}function h(p,x,b){let k=Qw.inlineCode(p,x,b);return b.stack.includes("tableCell")&&(k=k.replace(/\|/g,"\\$&")),k}}function GD(){return{exit:{taskListCheckValueChecked:fx,taskListCheckValueUnchecked:fx,paragraph:YD}}}function qD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:XD}}}function fx(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function YD(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){o=l;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function XD(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(o);let c=Qw.listItem(e,t,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(f){return f+o}}function QD(){return[PA(),XA(),eD(),VD(),GD()]}function JD(e){return{extensions:[AA(),QA(e),tD(),KD(e),qD()]}}const ZD={tokenize:iL,partial:!0},Jw={tokenize:aL,partial:!0},Zw={tokenize:oL,partial:!0},ek={tokenize:lL,partial:!0},eL={tokenize:cL,partial:!0},tk={name:"wwwAutolink",tokenize:rL,previous:rk},nk={name:"protocolAutolink",tokenize:sL,previous:sk},Mr={name:"emailAutolink",tokenize:nL,previous:ik},fr={};function tL(){return{text:fr}}let ks=48;for(;ks<123;)fr[ks]=Mr,ks++,ks===58?ks=65:ks===91&&(ks=97);fr[43]=Mr;fr[45]=Mr;fr[46]=Mr;fr[95]=Mr;fr[72]=[Mr,nk];fr[104]=[Mr,nk];fr[87]=[Mr,tk];fr[119]=[Mr,tk];function nL(e,t,n){const r=this;let s,i;return o;function o(d){return!Xf(d)||!ik.call(r,r.previous)||Yp(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(d))}function l(d){return Xf(d)?(e.consume(d),l):d===64?(e.consume(d),c):n(d)}function c(d){return d===46?e.check(eL,f,u)(d):d===45||d===95||Yt(d)?(i=!0,e.consume(d),c):f(d)}function u(d){return e.consume(d),s=!0,c}function f(d){return i&&s&&rn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function rL(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!rk.call(r,r.previous)||Yp(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(ZD,e.attempt(Jw,e.attempt(Zw,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function sL(e,t,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&sk.call(r,r.previous)&&!Yp(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),e.consume(d),l):n(d)}function l(d){if(rn(d)&&s.length<5)return s+=String.fromCodePoint(d),e.consume(d),l;if(d===58){const h=s.toLowerCase();if(h==="http"||h==="https")return e.consume(d),c}return n(d)}function c(d){return d===47?(e.consume(d),i?u:(i=!0,c)):n(d)}function u(d){return d===null||Sc(d)||Ze(d)||Qs(d)||ou(d)?n(d):e.attempt(Jw,e.attempt(Zw,f),n)(d)}function f(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function iL(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function aL(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(ek,c,l)(u):u===null||Ze(u)||Qs(u)||u!==45&&ou(u)?c(u):(i=!0,e.consume(u),o)}function l(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),o}function c(u){return s||r||!i?n(u):t(u)}}function oL(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(ek,t,i)(o):o===null||Ze(o)||Qs(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function lL(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),i):l===93?(e.consume(l),s):l===60||l===null||Ze(l)||Qs(l)?t(l):n(l)}function s(l){return l===null||l===40||l===91||Ze(l)||Qs(l)?t(l):r(l)}function i(l){return rn(l)?o(l):n(l)}function o(l){return l===59?(e.consume(l),r):rn(l)?(e.consume(l),o):n(l)}}function cL(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return Yt(i)?n(i):t(i)}}function rk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ze(e)}function sk(e){return!rn(e)}function ik(e){return!(e===47||Xf(e))}function Xf(e){return e===43||e===45||e===46||e===95||Yt(e)}function Yp(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const uL={tokenize:yL,partial:!0};function dL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:mL,continuation:{tokenize:gL},exit:xL}},text:{91:{name:"gfmFootnoteCall",tokenize:pL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:fL,resolveTo:hL}}}}function fL(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){o=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!o||!o._balanced)return n(c);const u=Yn(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function hL(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function pL(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return l;function l(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),c}function c(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(d){if(i>999||d===93&&!o||d===null||d===91||Ze(d))return n(d);if(d===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(Yn(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Ze(d)||(o=!0),i++,e.consume(d),d===92?f:u}function f(d){return d===91||d===92||d===93?(e.consume(d),i++,u):u(d)}}function mL(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,l;return c;function c(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):n(x)}function f(x){if(o>999||x===93&&!l||x===null||x===91||Ze(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=Yn(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Ze(x)||(l=!0),o++,e.consume(x),x===92?d:f}function d(x){return x===91||x===92||x===93?(e.consume(x),o++,f):f(x)}function h(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),s.includes(i)||s.push(i),$e(e,p,"gfmFootnoteDefinitionWhitespace")):n(x)}function p(x){return t(x)}}function gL(e,t,n){return e.check(Bo,t,e.attempt(uL,t,n))}function xL(e){e.exit("gfmFootnoteDefinition")}function yL(e,t,n){const r=this;return $e(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function vL(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},d={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},h=[["enter",f,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",d,l]],p=l.parser.constructs.insideSpan.null;p&&Sn(h,h.length,0,lu(p,o.slice(u+1,c),l)),Sn(h,h.length,0,[["exit",d,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",f,l]]),Sn(o,u-1,c-u+3,h),c=u+h.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function i(o,l,c){const u=this.previous,f=this.events;let d=0;return h;function h(x){return u===126&&f[f.length-1][1].type!=="characterEscape"?c(x):(o.enter("strikethroughSequenceTemporary"),p(x))}function p(x){const b=qi(u);if(x===126)return d>1?c(x):(o.consume(x),d++,p);if(d<2&&!n)return c(x);const k=o.exit("strikethroughSequenceTemporary"),v=qi(x);return k._open=!v||v===2&&!!b,k._close=!b||b===2&&!!v,l(x)}}}class bL{constructor(){this.map=[]}add(t,n,r){wL(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function wL(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function kL(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function SL(){return{flow:{null:{name:"table",tokenize:jL,resolveAll:NL}}}}function jL(e,t,n){const r=this;let s=0,i=0,o;return l;function l(T){let M=r.events.length-1;for(;M>-1;){const z=r.events[M][1].type;if(z==="lineEnding"||z==="linePrefix")M--;else break}const P=M>-1?r.events[M][1].type:null,F=P==="tableHead"||P==="tableRow"?N:c;return F===N&&r.parser.lazy[r.now().line]?n(T):F(T)}function c(T){return e.enter("tableHead"),e.enter("tableRow"),u(T)}function u(T){return T===124||(o=!0,i+=1),f(T)}function f(T){return T===null?n(T):Ne(T)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),p):n(T):Be(T)?$e(e,f,"whitespace")(T):(i+=1,o&&(o=!1,s+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),o=!0,f):(e.enter("data"),d(T)))}function d(T){return T===null||T===124||Ze(T)?(e.exit("data"),f(T)):(e.consume(T),T===92?h:d)}function h(T){return T===92||T===124?(e.consume(T),d):d(T)}function p(T){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(T):(e.enter("tableDelimiterRow"),o=!1,Be(T)?$e(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):x(T))}function x(T){return T===45||T===58?k(T):T===124?(o=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),b):S(T)}function b(T){return Be(T)?$e(e,k,"whitespace")(T):k(T)}function k(T){return T===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),v):T===45?(i+=1,v(T)):T===null||Ne(T)?j(T):S(T)}function v(T){return T===45?(e.enter("tableDelimiterFiller"),m(T)):S(T)}function m(T){return T===45?(e.consume(T),m):T===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(T))}function y(T){return Be(T)?$e(e,j,"whitespace")(T):j(T)}function j(T){return T===124?x(T):T===null||Ne(T)?!o||s!==i?S(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):S(T)}function S(T){return n(T)}function N(T){return e.enter("tableRow"),w(T)}function w(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),w):T===null||Ne(T)?(e.exit("tableRow"),t(T)):Be(T)?$e(e,w,"whitespace")(T):(e.enter("data"),C(T))}function C(T){return T===null||T===124||Ze(T)?(e.exit("data"),w(T)):(e.consume(T),T===92?D:C)}function D(T){return T===92||T===124?(e.consume(T),C):C(T)}}function NL(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],l=!1,c=0,u,f,d;const h=new bL;for(;++n<e.length;){const p=e[n],x=p[1];p[0]==="enter"?x.type==="tableHead"?(l=!1,c!==0&&(hx(h,t,c,u,f),f=void 0,c=0),u={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},h.add(n,0,[["enter",u,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],l&&(l=!1,f={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},h.add(n,0,[["enter",f,t]])),s=x.type==="tableDelimiterRow"?2:f?3:1):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],d=xl(h,t,i,s,void 0,d),i=[0,0,0,0]),o[2]=n)):x.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],d=xl(h,t,i,s,void 0,d)),i=o,o=[i[1],n,0,0])):x.type==="tableHead"?(l=!0,c=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(c=n,i[1]!==0?(o[0]=o[1],d=xl(h,t,i,s,n,d)):o[1]!==0&&(d=xl(h,t,o,s,n,d)),s=0):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=n)}for(c!==0&&hx(h,t,c,u,f),h.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=kL(t.events,n))}return e}function xl(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},ui(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const c=ui(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=ui(t.events,n[2]),f=ui(t.events,n[3]),d={type:l,start:Object.assign({},u),end:Object.assign({},f)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const h=t.events[n[2]],p=t.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,b=n[3]-n[2]-1;e.add(x,b,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return s!==void 0&&(i.end=Object.assign({},ui(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function hx(e,t,n,r,s){const i=[],o=ui(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function ui(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const CL={name:"tasklistCheck",tokenize:TL};function EL(){return{text:{91:CL}}}function TL(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Ze(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o):n(c)}function o(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return Ne(c)?t(c):Be(c)?e.check({tokenize:PL},t,n)(c):n(c)}}function PL(e,t,n){return $e(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function AL(e){return mw([tL(),dL(),vL(e),SL(),EL()])}const DL={};function LL(e){const t=this,n=e||DL,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(AL(n)),i.push(QD()),o.push(JD(n))}function ML(e){return e.split(/(```[\s\S]*?```|`[^`]+`)/g).map((n,r)=>r%2===1?n:n.replace(new RegExp("(?<=\\w)_(?=\\w)","g"),"\\_")).join("")}function Xp({children:e}){return a.jsx(vA,{remarkPlugins:[LL],components:{pre({children:t}){return a.jsx("pre",{className:"bg-slate-900 text-slate-100 rounded-lg p-4 overflow-x-auto my-3 text-sm leading-relaxed",children:t})},code({className:t,children:n,...r}){return t?a.jsx("code",{className:`font-mono text-[13px] ${t??""}`,...r,children:n}):a.jsx("code",{className:"bg-gray-100 text-pink-600 px-1.5 py-0.5 rounded text-[13px] font-mono",...r,children:n})},p({children:t}){return a.jsx("p",{className:"mb-2 last:mb-0",children:t})},ul({children:t}){return a.jsx("ul",{className:"list-disc pl-5 mb-2 space-y-1",children:t})},ol({children:t}){return a.jsx("ol",{className:"list-decimal pl-5 mb-2 space-y-1",children:t})},li({children:t}){return a.jsx("li",{className:"leading-relaxed",children:t})},h1({children:t}){return a.jsx("h1",{className:"text-xl font-bold mb-2 mt-3 first:mt-0",children:t})},h2({children:t}){return a.jsx("h2",{className:"text-lg font-bold mb-2 mt-3 first:mt-0",children:t})},h3({children:t}){return a.jsx("h3",{className:"text-base font-bold mb-1.5 mt-2 first:mt-0",children:t})},a({href:t,children:n}){return a.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:n})},blockquote({children:t}){return a.jsx("blockquote",{className:"border-l-4 border-gray-300 pl-4 my-2 text-gray-600 italic",children:t})},table({children:t}){return a.jsx("div",{className:"overflow-x-auto my-2",children:a.jsx("table",{className:"min-w-full text-sm border border-gray-200 rounded",children:t})})},th({children:t}){return a.jsx("th",{className:"border-b border-gray-200 bg-gray-50 px-3 py-2 text-left font-semibold",children:t})},td({children:t}){return a.jsx("td",{className:"border-b border-gray-100 px-3 py-2",children:t})},hr(){return a.jsx("hr",{className:"my-3 border-gray-200"})},strong({children:t}){return a.jsx("strong",{className:"font-semibold",children:t})}},children:ML(e)})}function px(e){return e<1e3?String(e):e<1e4||e<1e5?(e/1e3).toFixed(1)+"k":Math.round(e/1e3)+"k"}function IL(e){return e<.01?"$"+e.toFixed(3):"$"+e.toFixed(2)}function RL({onSend:e,onAbort:t,disabled:n,isLoading:r,contextUsage:s,isCompacting:i,editingSkill:o,onClearEditSkill:l,skills:c,onEditSkill:u,pendingMessages:f,onRemovePending:d,dpFocus:h,dpActive:p,onSetDpActive:x}){const[b,k]=g.useState(""),[v,m]=g.useState(!1),y=g.useRef(!1),j=p??!1,S=x??(()=>{}),[N,w]=g.useState(!1),[C,D]=g.useState(""),T=g.useRef(null),M=g.useCallback(async()=>{const z=b.trim();if(!z||n)return;let W="";j&&(W+=`[Deep Investigation]
577
+ `),o&&(W+=`[Skill: ${o.name}]
578
+ `),W+=z,e(W.trim()),k("")},[b,n,e,o,j]),P=g.useCallback(z=>{z.key==="Enter"&&!z.shiftKey&&!y.current&&!z.nativeEvent.isComposing&&(z.preventDefault(),M())},[M]),F=b.trim();return a.jsx(a.Fragment,{children:a.jsx("div",{className:"w-full px-4 pb-2 z-20 bg-gradient-to-t from-gray-50 via-gray-50 to-transparent pt-10",children:a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:B("relative bg-white rounded-[24px] shadow-lg border transition-all duration-200",v?"border-gray-300 shadow-xl":"border-gray-200",n&&"opacity-60"),children:[a.jsxs("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 min-w-0",children:[c&&c.length>0&&u&&a.jsxs("div",{className:"relative",children:[a.jsx("button",{type:"button",onClick:()=>{w(!N),D("")},disabled:n,className:B("p-1.5 rounded-lg transition-colors disabled:opacity-50",N?"text-indigo-600 bg-indigo-50":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:"Select skill to edit",children:a.jsx(Wi,{className:"w-4 h-4"})}),N&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>w(!1)}),a.jsxs("div",{className:"absolute bottom-full left-0 mb-1 bg-white rounded-xl shadow-xl border border-gray-200 z-20 w-[280px] max-h-[360px] flex flex-col",children:[a.jsx("div",{className:"px-3 pt-3 pb-2",children:a.jsxs("div",{className:"relative",children:[a.jsx(kn,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400"}),a.jsx("input",{ref:T,type:"text",value:C,onChange:z=>D(z.target.value),placeholder:"Search skills...",className:"w-full pl-8 pr-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-1 focus:ring-indigo-300 focus:border-indigo-300",autoFocus:!0})]})}),a.jsx("div",{className:"overflow-y-auto flex-1 pb-2",children:(()=>{const z=C.toLowerCase(),W=c.filter(R=>R.name.toLowerCase().includes(z)||R.description.toLowerCase().includes(z)),fe=[{label:"Personal",scope:"personal"},{label:"Team Skills",scope:"team"},{label:"System Skills",scope:"builtin"}];return W.length>0?fe.map(({label:R,scope:V})=>{const E=W.filter(Y=>Y.scope===V);return E.length===0?null:a.jsxs("div",{children:[a.jsx("div",{className:"px-3 pt-2 pb-1",children:a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-gray-400",children:R})}),E.map(Y=>{const J=(o==null?void 0:o.id)===String(Y.id);return a.jsxs("button",{type:"button",className:B("flex flex-col w-full px-3 py-1.5 text-left transition-colors",J?"bg-indigo-50 border-l-2 border-indigo-500":"hover:bg-gray-50 border-l-2 border-transparent"),onClick:()=>{u(String(Y.id),Y.name),w(!1)},children:[a.jsx("span",{className:B("text-sm font-medium truncate",J?"text-indigo-700":"text-gray-700"),children:Y.name}),Y.description&&a.jsx("span",{className:"text-xs text-gray-400 truncate",children:Y.description})]},Y.id)})]},V)}):a.jsx("div",{className:"px-3 py-4 text-center text-sm text-gray-400",children:"No skills found"})})()})]})]})]}),a.jsx("button",{type:"button",onClick:()=>S(!j),disabled:n,className:B("p-1.5 rounded-lg transition-colors disabled:opacity-50",j?"text-blue-600 bg-blue-50":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:j?"Deep Investigation enabled — click to disable":"Enable Deep Investigation",children:a.jsx(vo,{className:"w-4 h-4"})}),a.jsx("div",{className:"ml-auto flex items-center gap-3 shrink-0"})]}),(j||o)&&a.jsx("div",{className:"flex flex-wrap gap-2 px-4 pb-1",children:j&&a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg border text-xs font-medium bg-blue-50 border-blue-200 text-blue-700",children:[a.jsx(vo,{className:"w-3.5 h-3.5 text-blue-500"}),a.jsx("span",{children:"Deep Investigation"}),h&&a.jsx("span",{className:"px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 text-[10px] font-semibold uppercase",children:h.replace(/_/g," ")}),a.jsx("button",{type:"button",className:"ml-0.5 p-0.5 rounded hover:bg-blue-200 transition-colors",onClick:()=>S(!1),children:a.jsx(Ge,{className:"w-3 h-3"})})]})}),o&&a.jsx("div",{className:"flex flex-wrap gap-2 px-4 pb-1",children:a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg border text-xs font-medium bg-indigo-50 border-indigo-200 text-indigo-700",children:[a.jsx(Wi,{className:"w-3.5 h-3.5 text-indigo-500"}),a.jsx("span",{children:o.name}),a.jsx("button",{type:"button",className:"ml-0.5 p-0.5 rounded hover:bg-indigo-200 transition-colors",onClick:()=>l==null?void 0:l(),children:a.jsx(Ge,{className:"w-3 h-3"})})]})}),f&&f.length>0&&a.jsx("div",{className:"flex flex-col gap-1 px-4 pb-1",children:f.map((z,W)=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-amber-50 border border-amber-200 text-xs text-amber-800",children:[a.jsx("span",{className:"flex-1 truncate",children:z}),a.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-amber-200 transition-colors shrink-0",onClick:()=>d==null?void 0:d(W),title:"Remove this instruction",children:a.jsx(Ge,{className:"w-3 h-3"})})]},W))}),a.jsx("textarea",{value:b,onFocus:()=>m(!0),onBlur:()=>m(!1),onChange:z=>k(z.target.value),onKeyDown:P,onCompositionStart:()=>{y.current=!0},onCompositionEnd:()=>{y.current=!1},placeholder:n?"Connecting...":"Reply...",disabled:n,className:"w-full bg-transparent border-none outline-none px-6 py-3 pr-14 text-[15px] text-gray-900 placeholder:text-gray-400 focus:ring-0 focus:outline-none resize-none min-h-[48px] max-h-[200px] disabled:cursor-not-allowed",rows:1,style:{height:"auto"}}),r&&b.trim()?a.jsx("button",{onClick:M,className:"absolute right-3 bottom-3 p-2 rounded-lg bg-primary-600 text-white shadow-md hover:bg-primary-700 transition-all",title:"Send steer instruction",children:a.jsx(c0,{className:"w-5 h-5"})}):r?a.jsx("button",{onClick:t,className:"absolute right-3 bottom-3 p-2 rounded-lg bg-red-500 text-white shadow-md hover:bg-red-600 transition-all",title:"Stop generating",children:a.jsx(I5,{className:"w-5 h-5"})}):a.jsx("button",{onClick:M,disabled:!F||n,className:B("absolute right-3 bottom-3 p-2 rounded-lg transition-all",F&&!n?"bg-primary-600 text-white shadow-md hover:bg-primary-700":"bg-gray-100 text-gray-300 cursor-not-allowed"),children:a.jsx(c0,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"mt-4 flex items-center justify-between px-1",children:[a.jsx("p",{className:"text-xs text-gray-400",children:"AI may make mistakes. Please verify important information."}),i?a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-amber-500",children:[a.jsx(Ae,{className:"w-3 h-3 animate-spin"}),a.jsx("span",{children:"Compacting..."})]}):s&&s.percent>0?a.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-400 font-mono cursor-default",children:[a.jsxs("span",{title:`Input: ${s.inputTokens.toLocaleString()} tokens`,children:["↑ ",px(s.inputTokens)]}),a.jsxs("span",{title:`Output: ${s.outputTokens.toLocaleString()} tokens`,children:["↓ ",px(s.outputTokens)]}),s.cost>0&&a.jsx("span",{title:"API cost this session",children:IL(s.cost)}),a.jsxs("span",{className:"flex items-center gap-1",title:`Context: ${s.tokens.toLocaleString()} / ${s.contextWindow.toLocaleString()} tokens`,children:[Math.round(s.percent),"%",a.jsx("span",{className:B("inline-block w-1.5 h-1.5 rounded-full",s.percent>75?"bg-red-400":s.percent>50?"bg-yellow-400":"bg-green-400")})]})]}):null]})]})})})}function _L({message:e,status:t,onOpenPanel:n}){let r=null;try{r=JSON.parse(e.content)}catch{}if(!(r!=null&&r.skill))return null;const{skill:s}=r,i=e.toolName==="update_skill";return a.jsx("div",{className:"pl-12",children:a.jsxs("div",{className:B("inline-flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors",t==="saved"&&"border-green-200 bg-green-50/50",t==="dismissed"&&"border-gray-200 bg-gray-50/50 opacity-60",t==="superseded"&&"border-gray-200 bg-gray-50/50 opacity-40",t==="pending"&&"border-indigo-200 bg-indigo-50/50"),children:[a.jsx(Wi,{className:B("w-4 h-4 shrink-0",t==="saved"?"text-green-500":t==="dismissed"?"text-gray-400":t==="superseded"?"text-gray-300":"text-indigo-500")}),a.jsx("span",{className:B("text-sm font-medium",t==="superseded"?"text-gray-400":"text-gray-800"),children:s.name}),t==="saved"&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-green-100 text-green-700",children:[a.jsx(qt,{className:"w-2.5 h-2.5"}),i?"Updated":"Saved"]}),t==="dismissed"&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-gray-100 text-gray-500",children:[a.jsx(Ge,{className:"w-2.5 h-2.5"}),"Dismissed"]}),t==="superseded"&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-gray-100 text-gray-400",children:[a.jsx(wp,{className:"w-2.5 h-2.5"}),"Superseded"]}),t==="pending"&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-indigo-100 text-indigo-600",children:[a.jsx(Ys,{className:"w-2.5 h-2.5"}),"Pending"]}),t!=="superseded"&&n&&a.jsxs("button",{onClick:()=>n(e),className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium text-gray-500 hover:text-indigo-600 hover:bg-indigo-50 transition-colors",children:[a.jsx(Fo,{className:"w-3 h-3"}),"View"]})]})})}async function yl(e,t,n,r){try{const s=await e("cron.list"),i=r?s.jobs.filter(o=>o.envId===r):s.jobs;if(t)return i.find(o=>o.id===t)??null;if(n){const o=n.toLowerCase(),l=i.find(f=>f.name===n);if(l)return l;const c=i.find(f=>f.name.toLowerCase()===o);if(c)return c;const u=i.find(f=>f.name.toLowerCase().includes(o)||o.includes(f.name.toLowerCase()));if(u)return u}return i.length===1?i[0]:null}catch{return null}}function FL({message:e,status:t,onOpenPanel:n,sendRpc:r,updateMessageMeta:s,selectedEnvId:i}){var y;const[o,l]=g.useState("idle"),[c,u]=g.useState(""),f=g.useRef(!1);let d=null;try{d=JSON.parse(e.content)}catch{}g.useEffect(()=>{!d||d.error||!r||!s||f.current||t==="saved"||t==="dismissed"||t==="superseded"||(f.current=!0,h())},[t]);const h=async()=>{var j,S,N,w;if(!(!d||!r||!s)){if(!i){l("error"),u("Please select an environment first");return}l("executing");try{const C=d.action;if(C==="create"&&d.schedule)await r("cron.save",{name:d.schedule.name,description:d.schedule.description,schedule:d.schedule.schedule,status:d.schedule.status||"active",envId:i??null});else if(C==="update"&&d.schedule){const D=await yl(r,d.id,d.name??((j=d.schedule)==null?void 0:j.name),i);if(!D)throw new Error("Schedule not found");await r("cron.save",{id:D.id,name:d.schedule.name,description:d.schedule.description,schedule:d.schedule.schedule,status:d.schedule.status||"active",envId:i??null})}else if(C==="delete"){const D=await yl(r,d.id,d.name??((S=d.schedule)==null?void 0:S.name),i);if(!D)throw new Error("Schedule not found");await r("cron.delete",{id:D.id})}else if(C==="pause"||C==="resume"){const D=await yl(r,d.id,d.name??((N=d.schedule)==null?void 0:N.name),i);if(!D)throw new Error("Schedule not found");await r("cron.setStatus",{id:D.id,status:C==="pause"?"paused":"active"})}else if(C==="rename"){const D=await yl(r,d.id,d.name??((w=d.schedule)==null?void 0:w.name),i);if(!D)throw new Error("Schedule not found");await r("cron.rename",{id:D.id,newName:d.newName})}l("done"),await s(e.id,{scheduleCard:"saved"})}catch(C){l("error"),u((C==null?void 0:C.message)||"Operation failed")}}};if(!d||d.error)return null;const p=d.action,x=p==="rename",b=p==="delete",k=x?`${d.name||d.id} → ${d.newName}`:((y=d.schedule)==null?void 0:y.name)||d.name||d.id||"...",v=()=>{switch(p){case"delete":return"Deleted";case"pause":return"Paused";case"resume":return"Resumed";case"rename":return"Renamed";case"update":return"Updated";default:return"Saved"}},m=o==="done"?"saved":t;return a.jsx("div",{className:"pl-12",children:a.jsxs("div",{className:B("inline-flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors",m==="saved"&&"border-green-200 bg-green-50/50",m==="dismissed"&&"border-gray-200 bg-gray-50/50 opacity-60",m==="superseded"&&"border-gray-200 bg-gray-50/50 opacity-40",m==="pending"&&(b?"border-red-200 bg-red-50/50":"border-amber-200 bg-amber-50/50"),o==="error"&&"border-red-200 bg-red-50/50"),children:[a.jsx(Ys,{className:B("w-4 h-4 shrink-0",m==="saved"?"text-green-500":m==="dismissed"?"text-gray-400":m==="superseded"?"text-gray-300":o==="error"||b?"text-red-500":"text-amber-500")}),a.jsx("span",{className:B("text-sm font-medium",m==="superseded"?"text-gray-400":"text-gray-800"),children:k}),d.schedule&&a.jsx("span",{className:"font-mono text-xs text-gray-500 bg-gray-100 px-1.5 py-0.5 rounded",children:d.schedule.schedule}),o==="executing"&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-600",children:[a.jsx(Ae,{className:"w-2.5 h-2.5 animate-spin"}),"Processing"]}),o==="error"&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-red-100 text-red-600",children:[a.jsx(xo,{className:"w-2.5 h-2.5"}),c]}),o!=="executing"&&o!=="error"&&m==="saved"&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-green-100 text-green-700",children:[a.jsx(qt,{className:"w-2.5 h-2.5"}),v()]}),m==="dismissed"&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-gray-100 text-gray-500",children:[a.jsx(Ge,{className:"w-2.5 h-2.5"}),"Dismissed"]}),m==="superseded"&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-gray-100 text-gray-400",children:[a.jsx(wp,{className:"w-2.5 h-2.5"}),"Superseded"]}),m!=="superseded"&&n&&o!=="executing"&&a.jsxs("button",{onClick:()=>n(e),className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium text-gray-500 hover:text-amber-600 hover:bg-amber-50 transition-colors",children:[a.jsx(Fo,{className:"w-3 h-3"}),"View"]})]})})}const OL={VALIDATED:"validated",INVALIDATED:"invalidated",INCONCLUSIVE:"inconclusive",PENDING:"pending",SKIPPED:"skipped"};function zL(e){var u,f;if(!e||!e.includes("Deep Search Summary"))return null;const t=e.match(/### Conclusion\n([\s\S]*?)(?=\n### )/),n=((u=t==null?void 0:t[1])==null?void 0:u.trim())??"",r=[],s=e.match(/### Hypothesis Verdicts\n([\s\S]*?)(?=\n### )/);if(s){const d=s[1],h=/^- (?:✅|❌|⚠️|⏳|⏭️)\s+(\w+)\s+\*\*(\w+)\*\*:\s+(.+?)\s+—\s+(\d+)%/gm;let p;for(;(p=h.exec(d))!==null;){const x=p[1],b=p[2],k=p[3],v=parseInt(p[4],10);r.push({id:b,text:k,status:OL[x]??"pending",confidence:v})}if(r.length===0){const x=d.split(`
579
+ `);let b=null;for(const k of x){const v=k.match(/^- .+?\*\*(\w+)\*\*:\s+(.+?)\s+—\s+(\d+)%/);if(v){let m="pending";k.includes("VALIDATED")&&!k.includes("INVALIDATED")?m="validated":k.includes("INVALIDATED")?m="invalidated":k.includes("INCONCLUSIVE")?m="inconclusive":k.includes("SKIPPED")?m="skipped":k.includes("PENDING")&&(m="pending"),b&&r.push(b),b={id:v[1],text:v[2],status:m,confidence:parseInt(v[3],10)}}else k.trim()&&b&&k.startsWith(" ")&&(b.reasoning=k.trim())}b&&r.push(b)}else{const x=d.split(`
580
+ `);let b=-1;for(const k of x)k.startsWith("- ")?b++:k.startsWith(" ")&&k.trim()&&b>=0&&b<r.length&&(r[b].reasoning=k.trim())}}const i=e.match(/Tool calls:\s*(\d+)\s*\|\s*Duration:\s*([^\s|]+)\s*\|\s*Hypotheses:\s*(.+)/),o={toolCalls:i?parseInt(i[1],10):0,duration:(i==null?void 0:i[2])??"",hypothesesSummary:((f=i==null?void 0:i[3])==null?void 0:f.trim())??""},l=e.match(/Full report:\s*`([^`]+)`/),c=l==null?void 0:l[1];return{conclusion:n,hypotheses:r,stats:o,reportPath:c}}function VL(e){const t=e.hypotheses;return!t||!Array.isArray(t)?null:t.map(n=>{var r;return{id:n.id,text:n.text,status:n.status??"pending",confidence:n.confidence??0,reasoning:n.reasoning,toolCallsUsed:n.toolCallsUsed,evidence:(r=n.evidence)==null?void 0:r.filter(s=>s.command||s.outputPreview)}})}function md({status:e,className:t}){const n=B("w-4 h-4 shrink-0",t);switch(e){case"validated":return a.jsx(Lr,{className:B(n,"text-green-500")});case"invalidated":return a.jsx(ei,{className:B(n,"text-red-400")});case"inconclusive":return a.jsx(zs,{className:B(n,"text-amber-500")});case"skipped":return a.jsx(Np,{className:B(n,"text-gray-400")});case"validating":return a.jsx(Ae,{className:B(n,"text-blue-500 animate-spin")});case"pending":default:return a.jsx(Ys,{className:B(n,"text-gray-400")})}}const gd={validated:"VALIDATED",invalidated:"INVALIDATED",inconclusive:"INCONCLUSIVE",pending:"PENDING",skipped:"SKIPPED",validating:"VALIDATING"},BL={validated:"text-green-600",invalidated:"text-red-500",inconclusive:"text-amber-600",pending:"text-gray-500",skipped:"text-gray-400",validating:"text-blue-500"};function UL(){const e=g.useRef(Date.now()),[t,n]=g.useState(0);g.useEffect(()=>{const i=setInterval(()=>{n(Math.floor((Date.now()-e.current)/1e3))},1e3);return()=>clearInterval(i)},[]);const r=Math.floor(t/60),s=t%60;return a.jsxs("span",{className:"text-xs text-gray-400 font-mono tabular-nums",children:[r,":",s.toString().padStart(2,"0")]})}function $L({message:e,progress:t}){var x;const[n,r]=g.useState(!1),s=e.toolStatus==="running",i=e.toolStatus==="error",o=s?null:zL(e.content),l=e.toolDetails?VL(e.toolDetails):null,c=((x=e.toolDetails)==null?void 0:x.reportPath)??(o==null?void 0:o.reportPath),u=e.toolInput||"",d=(l??(o==null?void 0:o.hypotheses)??[]).slice().sort((b,k)=>b.status==="validated"&&k.status!=="validated"?-1:k.status==="validated"&&b.status!=="validated"?1:k.confidence-b.confidence);if(s){const b=t&&t.hypotheses.length>0;return a.jsx("div",{className:"pl-12",children:a.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50/50 px-4 py-3 max-w-2xl",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(kn,{className:"w-4 h-4 text-blue-500 shrink-0"}),a.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"Deep Investigation"}),(t==null?void 0:t.phase)&&a.jsx("span",{className:"text-xs font-medium px-1.5 py-0.5 rounded bg-blue-100 text-blue-700",children:t.phase}),a.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a.jsx(UL,{}),a.jsx(Ae,{className:"w-4 h-4 animate-spin text-blue-500"})]})]}),u&&a.jsxs("p",{className:"text-sm text-gray-600 mb-3 line-clamp-2",children:["“",u,"”"]}),b?a.jsx("div",{className:"space-y-1 mb-3",children:t.hypotheses.map(k=>a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(md,{status:k.status,className:"mt-0.5"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"text-sm text-gray-700",children:[a.jsx("span",{className:"font-medium",children:k.id})," ",a.jsx("span",{className:"text-gray-600",children:k.text})]}),a.jsx("span",{className:B("text-xs font-medium ml-1.5",BL[k.status]||"text-gray-500"),children:k.status==="validating"&&k.lastAction?a.jsx("span",{className:"text-blue-500 font-mono",children:k.lastAction}):k.status==="validated"||k.status==="invalidated"||k.status==="inconclusive"?`${gd[k.status]||k.status} (${k.confidence}%)`:gd[k.status]||k.status})]})]},k.id))}):null,a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-blue-100/60 rounded-md",children:[a.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin text-blue-500 shrink-0"}),a.jsx("span",{className:"text-xs text-blue-700 font-mono truncate",children:(t==null?void 0:t.currentAction)||"Investigating hypotheses..."})]})]})})}if(i||!o)return a.jsx("div",{className:"pl-12",children:a.jsxs("div",{className:"rounded-lg border border-red-200 bg-red-50/50 px-4 py-3 max-w-2xl",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(kn,{className:"w-4 h-4 text-red-500 shrink-0"}),a.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"Deep Investigation"}),a.jsx(ei,{className:"w-4 h-4 text-red-500 ml-auto shrink-0"})]}),u&&a.jsxs("p",{className:"text-sm text-gray-600 mb-2",children:["“",u,"”"]}),a.jsx("pre",{className:"text-xs text-red-600 whitespace-pre-wrap bg-red-100/60 rounded-md px-3 py-2",children:e.content||"Investigation failed."})]})});const h=d.length>0,p=d.some(b=>b.evidence&&b.evidence.length>0);return a.jsx("div",{className:"pl-12",children:a.jsxs("div",{className:B("rounded-lg border px-4 py-3 max-w-2xl transition-colors",h?"border-green-200 bg-green-50/50":"border-gray-200 bg-gray-50/50"),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(kn,{className:B("w-4 h-4 shrink-0",h?"text-green-500":"text-gray-500")}),a.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"Deep Investigation"}),a.jsxs("span",{className:B("ml-auto text-xs font-medium px-1.5 py-0.5 rounded flex items-center gap-1","bg-green-100 text-green-700"),children:[a.jsx(Lr,{className:"w-3 h-3"}),"Done"]})]}),(o==null?void 0:o.conclusion)&&a.jsx("div",{className:"mb-3 text-sm text-gray-700 leading-relaxed [&_p]:mb-1.5 [&_p:last-child]:mb-0 [&_strong]:text-gray-800 [&_ul]:list-disc [&_ul]:pl-4 [&_ol]:list-decimal [&_ol]:pl-4 [&_li]:mb-0.5",children:a.jsx(Xp,{children:o.conclusion})}),d.length>0&&a.jsx("div",{className:"space-y-1.5 mb-3",children:d.map(b=>{const k=b.status==="skipped"||b.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(md,{status:b.status,className:"mt-0.5"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-1.5",children:[a.jsx("span",{className:"text-sm font-medium text-gray-800 shrink-0",children:b.id}),a.jsx("span",{className:"text-sm text-gray-700 truncate",children:b.text}),a.jsxs("span",{className:B("text-xs font-semibold px-1.5 py-0.5 rounded shrink-0 ml-auto",b.status==="validated"?"bg-green-100 text-green-700":b.status==="invalidated"?"bg-red-100 text-red-600":b.status==="inconclusive"?"bg-amber-100 text-amber-700":"bg-gray-100 text-gray-500"),children:[b.confidence,"%"]})]}),!k&&b.reasoning&&a.jsx("p",{className:"text-xs text-gray-500 mt-0.5 leading-relaxed line-clamp-2",children:b.reasoning})]})]})},b.id)})}),n&&d.length>0&&a.jsx("div",{className:"border-t border-green-200 pt-3 mb-3 space-y-3",children:d.filter(b=>b.evidence&&b.evidence.length>0||b.toolCallsUsed).map(b=>a.jsxs("div",{className:"bg-white/70 rounded-md px-3 py-2 border border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(md,{status:b.status}),a.jsxs("span",{className:"text-sm font-medium text-gray-800",children:[b.id,": ",b.text]}),a.jsxs("span",{className:B("ml-auto text-xs font-semibold px-1.5 py-0.5 rounded shrink-0",b.status==="validated"?"bg-green-100 text-green-700":b.status==="invalidated"?"bg-red-100 text-red-600":b.status==="inconclusive"?"bg-amber-100 text-amber-700":"bg-gray-100 text-gray-600"),children:[gd[b.status]," (",b.confidence,"%)"]})]}),b.evidence&&b.evidence.length>0&&a.jsxs("div",{className:"mt-2 space-y-1.5",children:[a.jsx("span",{className:"text-[11px] font-semibold text-gray-500 uppercase tracking-wider",children:"Evidence"}),b.evidence.map((k,v)=>a.jsxs("div",{className:"bg-gray-50 rounded px-2.5 py-1.5 border border-gray-100",children:[a.jsxs("div",{className:"font-mono text-[11px] text-gray-700 truncate",children:[a.jsxs("span",{className:"text-gray-400",children:[k.tool,":"]})," ",k.command]}),k.outputPreview&&a.jsx("pre",{className:"text-[11px] text-gray-500 mt-1 whitespace-pre-wrap line-clamp-3 leading-relaxed",children:k.outputPreview})]},v))]}),b.toolCallsUsed!=null&&a.jsxs("p",{className:"text-[11px] text-gray-400 mt-1.5",children:[b.toolCallsUsed," tool calls"]})]},b.id))}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var k;const b=(o==null?void 0:o.stats.toolCalls)??((k=e.toolDetails)==null?void 0:k.totalToolCalls)??0;return b>0?a.jsxs("span",{children:[b," calls"]}):null})(),(()=>{var k;if(o!=null&&o.stats.duration)return a.jsx("span",{children:o.stats.duration});const b=(k=e.toolDetails)==null?void 0:k.durationMs;return b?a.jsxs("span",{children:[(b/1e3).toFixed(1),"s"]}):null})(),(o==null?void 0:o.stats.hypothesesSummary)&&a.jsx("span",{children:o.stats.hypothesesSummary})]}),p&&a.jsx("button",{type:"button",className:"flex items-center gap-1 text-xs text-gray-500 hover:text-gray-700 transition-colors cursor-pointer",onClick:()=>r(!n),children:n?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"Collapse"}),a.jsx(Bl,{className:"w-3.5 h-3.5"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"Evidence"}),a.jsx(rs,{className:"w-3.5 h-3.5"})]})})]}),n&&c&&a.jsxs("div",{className:"mt-2 pt-2 border-t border-green-200",children:[a.jsx("span",{className:"text-xs text-gray-400",children:"Full report: "}),a.jsx("code",{className:"text-xs text-gray-500 bg-gray-100 px-1.5 py-0.5 rounded",children:c})]})]})})}function HL(e){if(!e)return[];const t=e.split(/\n---\s*\n/).filter(i=>i.trim());if(t.length>=2)return t.map((i,o)=>vl(i.trim(),o+1));const n=e.split(/\n(?=#{2,3}\s*(?:Hypothesis|H)\s*\d)/i).filter(i=>i.trim());if(n.length>=2)return n.map((i,o)=>vl(i.trim(),o+1));const r=e.split(/\n(?=#{2,3}\s*\d+[.)]\s)/).filter(i=>i.trim());if(r.length>=2){const i=l=>/^#{2,3}\s*\d+[.)]\s/m.test(l),o=r.filter(i);if(o.length>=2)return o.map((l,c)=>vl(l.trim(),c+1))}const s=e.split(/\n(?=\*{2}(?:Hypothesis|H)\s*\d)/i).filter(i=>i.trim());if(s.length>=2){const i=l=>/\*{2}(?:Hypothesis|H)\s*\d/i.test(l),o=s.filter(i);if(o.length>=2)return o.map((l,c)=>vl(l.trim(),c+1))}return WL(e)}function vl(e,t){const n=e.split(`
581
+ `).map(l=>l.trim()).filter(Boolean);let r,s="",i="";const o=[];for(const l of n){const c=l.match(/^\*{2}(?:Hypothesis|H)\s*\d+[:\s]*(.*?)\*{2}\s*$/i);if(c){const x=c[1],b=x.match(/[(\uff08](?:confidence|置信度)[:\s:]*(\d+)\s*%[)\uff09]/i);b&&(r=parseInt(b[1],10)),s=sr(x.replace(/[(\uff08](?:confidence|置信度)[:\s:]*\d+\s*%[)\uff09]/i,"").trim());continue}const u=l.match(/^#{2,3}\s*(?:Hypothesis|H)\s*\d+[:\s]*(.*)/i);if(u){const x=u[1],b=x.match(/[(\uff08](?:confidence|置信度)[:\s:]*(\d+)\s*%[)\uff09]/i);b&&(r=parseInt(b[1],10)),s=sr(x.replace(/[(\uff08](?:confidence|置信度)[:\s:]*\d+\s*%[)\uff09]/i,"").trim());continue}const f=l.match(/^#{2,3}\s*\d+[.)]\s*(.*)/);if(f){const x=f[1],b=x.match(/[(\uff08](?:confidence|置信度)[:\s:]*(\d+)\s*%[)\uff09]/i);b&&(r=parseInt(b[1],10)),s=sr(x.replace(/[(\uff08](?:confidence|置信度)[:\s:]*\d+\s*%[)\uff09]/i,"").trim());continue}const d=l.match(/^\*{0,2}(?:confidence|置信度)\*{0,2}[:\s:]*(\d+)\s*%/i);if(d){r=parseInt(d[1],10);continue}if(l.match(/^\*{0,2}(?:validation tools?|verification tools?)\*{0,2}[:\s]/i))continue;if(l.match(/`(node_exec|pod_exec|bash|run_skill|node_script)[:\s]/)){o.push(sr(l));continue}const h=l.replace(/^[-*]\s+/,""),p=h.match(/^\*{0,2}(?:description|描述)\*{0,2}[:\s:]*(.*)/i);if(p&&p[1]){const x=sr(p[1]);s?i?o.push(x):i=x:s=x;continue}if(h.match(/^(?:\*{0,2})(?:validation method|validation|expected result|验证方法|验证|预期结果)(?:\*{0,2})[:\s:]/i)){o.push(sr(h));continue}if(!s&&h.length>10&&!h.startsWith("**Validation")&&!h.startsWith("**Confidence")&&!h.startsWith("**验证")&&!h.startsWith("**置信度")){s=sr(h);continue}if(s){const x=sr(h);x.length>5&&(i?o.push(x):i=x)}}if(r==null){const l=e.match(/(\d+)\s*%/);l&&(r=parseInt(l[1],10))}return{index:t,title:s||`Hypothesis ${t}`,confidence:r,description:i||void 0,detailLines:o}}function WL(e){const t=[],n=e.split(`
582
+ `);let r=null;for(const s of n){const i=s.trim();if(!i)continue;const o=i.match(/^(\d+)[.)]\s+(.+)/);if(o){r&&t.push(r);const l=sr(o[2]),c=l.match(/(\d+)\s*%/);r={index:parseInt(o[1],10),title:l.replace(/\(\d+%\)/,"").trim(),confidence:c?parseInt(c[1],10):void 0,detailLines:[]}}else if(r&&(i.startsWith("-")||i.startsWith("*")||/^\s/.test(s))){const l=sr(i.replace(/^[-*]\s+/,""));l.length>5&&r.detailLines.push(l)}}return r&&t.push(r),t}function sr(e){return e.replace(/\*{1,2}([^*]+)\*{1,2}/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^[#\s]+/,"").trim()}function KL({message:e,sendMessage:t,abortResponse:n,onHypothesesConfirmed:r,superseded:s}){var C,D;const[i,o]=g.useState(!1),[l,c]=g.useState(""),[u,f]=g.useState(null),[d,h]=g.useState(!1),p=e.toolStatus==="running",x=e.toolStatus==="success",b=((C=e.toolDetails)==null?void 0:C.hypotheses)||e.toolInput||"",k=HL(b);if(s)return a.jsx("div",{className:"pl-12",children:a.jsx("div",{className:"rounded-lg border border-gray-200 bg-gray-50/50 px-4 py-2 max-w-2xl opacity-50",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(kn,{className:"w-4 h-4 text-gray-400 shrink-0"}),a.jsx("span",{className:"text-sm text-gray-500",children:"Hypotheses"}),a.jsxs("span",{className:"text-xs text-gray-400",children:[k.length," items"]}),a.jsx("span",{className:"ml-auto text-xs text-gray-400",children:"Superseded"})]})})});const v=x&&((D=e.toolDetails)==null?void 0:D.autoConfirmed)===!0,m=x&&!p&&!i&&!v&&!d,y=()=>{r&&k.length>0&&r(k.map(T=>({id:`H${T.index}`,text:T.title,confidence:T.confidence??0})))},j=()=>{t&&(t("The user has confirmed hypotheses. Please call deep_search to validate them."),h(!0),y())},S=()=>{l.trim()&&t&&(t(`User feedback: ${l.trim()}. Please revise the hypotheses based on this feedback, then call propose_hypotheses again to present the updated hypotheses and wait for user confirmation before calling deep_search.`),o(!1),c(""),h(!0))},N=()=>{n&&n()},w=T=>{f(u===T?null:T)};return a.jsx("div",{className:"pl-12",children:a.jsxs("div",{className:B("rounded-lg border px-4 py-3 max-w-2xl transition-colors",x?"border-indigo-200 bg-indigo-50/50":"border-blue-200 bg-blue-50/50"),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(kn,{className:"w-4 h-4 text-indigo-500 shrink-0"}),a.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"Deep Investigation"}),a.jsx("span",{className:"text-xs text-gray-500",children:"Hypothesis Review"}),x&&(v||d)&&a.jsxs("span",{className:"ml-auto text-xs font-medium px-1.5 py-0.5 rounded flex items-center gap-1 bg-indigo-100 text-indigo-700",children:[a.jsx(Lr,{className:"w-3 h-3"}),"Confirmed"]}),x&&!v&&!d&&!i&&a.jsx("span",{className:"ml-auto text-xs text-amber-600 font-medium px-1.5 py-0.5 rounded bg-amber-50",children:"Awaiting review"})]}),k.length>0?a.jsx("div",{className:"space-y-1 mb-3",children:k.map(T=>{const M=u===T.index,P=T.detailLines.length>0||T.description;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",className:B("flex items-center gap-2 w-full text-left px-2 py-1.5 rounded-md transition-colors",P?"hover:bg-indigo-100/60 cursor-pointer":"cursor-default",M&&"bg-indigo-100/60"),onClick:()=>P&&w(T.index),children:[P?a.jsx(os,{className:B("w-3 h-3 text-gray-400 shrink-0 transition-transform",M&&"rotate-90")}):a.jsx("span",{className:"w-3 shrink-0"}),a.jsx("span",{className:"text-xs font-semibold text-indigo-500 bg-indigo-100 rounded-full w-5 h-5 flex items-center justify-center shrink-0",children:T.index}),a.jsx("span",{className:"flex-1 text-sm text-gray-700 min-w-0 truncate",children:T.title}),T.confidence!=null&&a.jsxs("span",{className:B("text-xs font-semibold px-1.5 py-0.5 rounded shrink-0",T.confidence>=70?"bg-indigo-100 text-indigo-700":T.confidence>=40?"bg-blue-100 text-blue-600":"bg-gray-100 text-gray-500"),children:[T.confidence,"%"]})]}),M&&P&&a.jsxs("div",{className:"ml-10 pl-2 border-l-2 border-indigo-200 mt-1 mb-2 space-y-1",children:[T.description&&a.jsx("p",{className:"text-xs text-gray-600 leading-relaxed",children:T.description}),T.detailLines.map((F,z)=>a.jsx("p",{className:"text-xs text-gray-500 leading-relaxed",children:F},z))]})]},T.index)})}):a.jsx("div",{className:"mb-3 text-sm text-gray-600",children:a.jsx(Xp,{children:b})}),i&&a.jsxs("div",{className:"mb-3 flex gap-2",children:[a.jsx("input",{type:"text",value:l,onChange:T=>c(T.target.value),onKeyDown:T=>T.key==="Enter"&&S(),placeholder:"Add/modify hypotheses...",className:"flex-1 text-sm border border-indigo-200 rounded-md px-3 py-1.5 focus:outline-none focus:ring-1 focus:ring-indigo-400",autoFocus:!0}),a.jsxs("button",{type:"button",onClick:S,disabled:!l.trim(),className:"text-xs font-medium px-3 py-1.5 rounded-md bg-indigo-600 text-white hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-1 cursor-pointer",children:[a.jsx(D5,{className:"w-3 h-3"}),"Send"]}),a.jsx("button",{type:"button",onClick:()=>{o(!1),c("")},className:"text-xs font-medium px-2 py-1.5 rounded-md text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors cursor-pointer",children:a.jsx(Ge,{className:"w-3.5 h-3.5"})})]}),m&&a.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-indigo-100",children:[a.jsxs("button",{type:"button",onClick:j,className:"flex items-center gap-1 text-xs font-medium px-3 py-1.5 rounded-md bg-indigo-600 text-white hover:bg-indigo-700 transition-colors cursor-pointer",children:[a.jsx(yo,{className:"w-3 h-3"}),"Confirm & Run"]}),a.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-md text-indigo-600 hover:bg-indigo-100 transition-colors cursor-pointer",children:[a.jsx(kp,{className:"w-3 h-3"}),"Modify"]}),a.jsxs("button",{type:"button",onClick:N,className:"flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-md text-gray-500 hover:bg-gray-100 hover:text-red-600 transition-colors cursor-pointer",children:[a.jsx(Ge,{className:"w-3 h-3"}),"Cancel"]})]})]})})}function GL({status:e}){return e==="done"?a.jsx(Lr,{className:"w-4 h-4 text-green-500 shrink-0 mt-0.5"}):e==="in_progress"?a.jsx(Ae,{className:"w-4 h-4 text-blue-500 animate-spin shrink-0 mt-0.5"}):e==="skipped"?a.jsx(Np,{className:"w-3.5 h-3.5 text-gray-400 shrink-0 mt-0.5"}):e==="error"?a.jsx(ei,{className:"w-4 h-4 text-red-500 shrink-0 mt-0.5"}):a.jsx(A1,{className:"w-4 h-4 text-gray-300 shrink-0 mt-0.5"})}function qL({status:e}){const t="w-3.5 h-3.5 shrink-0";switch(e){case"validated":return a.jsx(Lr,{className:B(t,"text-green-500")});case"invalidated":return a.jsx(ei,{className:B(t,"text-red-400")});case"inconclusive":return a.jsx(zs,{className:B(t,"text-amber-500")});case"validating":return a.jsx(Ae,{className:B(t,"text-blue-500 animate-spin")});case"skipped":return a.jsx(Np,{className:B(t,"text-gray-400")});default:return a.jsx(Ys,{className:B(t,"text-gray-300")})}}function YL({used:e,max:t}){const n=t>0?Math.min(100,Math.round(e/t*100)):0;return a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"flex-1 h-1 bg-gray-200 rounded-full overflow-hidden max-w-[80px]",children:a.jsx("div",{className:"h-full bg-blue-400 rounded-full transition-all",style:{width:`${n}%`}})}),a.jsxs("span",{className:"text-[10px] text-gray-400 font-mono tabular-nums",children:[e,"/",t]})]})}const mx={validated:"text-green-600",invalidated:"text-red-500",inconclusive:"text-amber-600",validating:"text-blue-500",pending:"text-gray-400",skipped:"text-gray-400"},XL={validated:"VALIDATED",invalidated:"INVALIDATED",inconclusive:"INCONCLUSIVE",validating:"validating...",pending:"pending",skipped:"SKIPPED"};function QL({h:e}){const t=e.status==="validated"||e.status==="invalidated"||e.status==="inconclusive"||e.status==="skipped",n=e.status==="validating";return a.jsxs("div",{className:B("flex items-start gap-1.5 py-0.5",t&&"opacity-70"),children:[a.jsx(qL,{status:e.status}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-1",children:[a.jsx("span",{className:B("text-xs font-medium shrink-0",n?"text-blue-700":t?"text-gray-500":"text-gray-600"),children:e.id}),a.jsx("span",{className:B("text-xs truncate",t?"text-gray-400":"text-gray-600"),children:e.text}),e.confidence>0&&a.jsxs("span",{className:B("text-[10px] font-semibold shrink-0 ml-auto",mx[e.status]||"text-gray-400"),children:[e.confidence,"%"]})]}),n&&a.jsxs("div",{className:"mt-0.5 space-y-0.5",children:[e.maxCalls>0&&a.jsx(YL,{used:e.callsUsed,max:e.maxCalls}),e.lastAction&&a.jsx("p",{className:"text-[10px] text-blue-500 font-mono truncate",children:e.lastAction})]}),t&&a.jsxs("span",{className:B("text-[10px] font-medium",mx[e.status]),children:[XL[e.status],e.callsUsed>0&&` · ${e.callsUsed} calls`]})]})]})}function JL({items:e,investigationProgress:t,onDismiss:n}){const r=e.filter(d=>d.status==="done"||d.status==="skipped").length,s=e.length,i=r===s,o=e.some(d=>d.status==="error"),l=e.find(d=>d.status==="in_progress")||e.find(d=>d.status==="pending"),c=e.find(d=>d.id==="deep_search"),u=(t==null?void 0:t.hypotheses)??[],f=((c==null?void 0:c.status)==="in_progress"||(c==null?void 0:c.status)==="done")&&u.length>0;return a.jsx("div",{className:"pl-12",children:a.jsxs("div",{className:B("rounded-lg border px-4 py-3 transition-colors max-w-lg",o?"border-red-200 bg-red-50/50":i?"border-green-200 bg-green-50/50":"border-indigo-200 bg-indigo-50/50"),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(vo,{className:B("w-4 h-4 shrink-0",o?"text-red-500":i?"text-green-500":"text-indigo-500")}),a.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"Deep Investigation"}),l&&!i&&l.status==="in_progress"&&a.jsx("span",{className:"text-xs text-gray-500",children:l.label}),a.jsxs("span",{className:B("ml-auto text-xs font-medium px-1.5 py-0.5 rounded",o?"bg-red-100 text-red-700":i?"bg-green-100 text-green-700":"bg-indigo-100 text-indigo-700"),children:[r,"/",s]}),n&&!i&&a.jsx("button",{onClick:()=>{window.confirm("Exit investigation? Current progress will be summarized.")&&n()},className:"ml-1 p-0.5 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-600",title:"Exit investigation",children:a.jsx(Ge,{className:"w-3.5 h-3.5"})})]}),a.jsx("div",{className:"space-y-1.5",children:e.map(d=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(GL,{status:d.status}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("span",{className:B("text-sm leading-relaxed",d.status==="done"?"text-gray-400 line-through":d.status==="skipped"?"text-gray-400":d.status==="error"?"text-red-600 font-medium":d.status==="in_progress"?"text-gray-800 font-medium":"text-gray-600"),children:d.label}),d.summary&&(d.status==="done"||d.status==="skipped"||d.status==="error")&&a.jsx("p",{className:B("text-xs mt-0.5",d.status==="error"?"text-red-500":"text-gray-500"),style:{textDecoration:"none"},children:d.summary})]})]}),d.id==="deep_search"&&f&&a.jsxs("div",{className:"ml-6 mt-1.5 mb-1 pl-2 border-l-2 border-indigo-200 space-y-0.5",children:[u.map(h=>a.jsx(QL,{h},h.id)),(t==null?void 0:t.currentAction)&&a.jsxs("div",{className:"flex items-center gap-1.5 mt-1 px-2 py-1 bg-blue-50 rounded",children:[a.jsx(Ae,{className:"w-3 h-3 animate-spin text-blue-400 shrink-0"}),a.jsx("span",{className:"text-[10px] text-blue-600 font-mono truncate",children:t.currentAction})]})]})]},d.id))})]})})}const ZL=[{icon:Wi,title:"Skills",description:"Reusable diagnostic scripts for common SRE tasks"},{icon:vo,title:"Deep Investigation",description:"Hypothesis-driven root cause analysis with evidence"},{icon:Xs,title:"Memory",description:"Remembers findings and context across sessions"},{icon:wo,title:"Scheduled Jobs",description:"Automated health checks on a cron schedule"}],eM=["Check my cluster health","List available skills","What happened since my last session?"],gx="Introduce yourself and help me get started",tM={kubeconfig:"Kubeconfig",ssh_password:"SSH",ssh_key:"SSH Key",api_token:"API Token",api_basic_auth:"API Auth"};function nM({systemStatus:e,onSendPrompt:t,onNavigateModels:n,onNavigateCredentials:r}){const s=(e==null?void 0:e.hasProfile)===!1,i=(e==null?void 0:e.hasModels)??!1,o=(e==null?void 0:e.credentials)??{},l=Object.keys(o).length>0,c=(e==null?void 0:e.sessionCount)??0,u=i&&l&&c>0,f=d=>{if(!i){n();return}t(d)};return a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 max-w-2xl mx-auto space-y-8",children:[s&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx("h1",{className:"text-2xl font-semibold text-gray-800",children:"Welcome to Siclaw"}),a.jsx("p",{className:"text-gray-500 text-sm",children:"Your personal SRE assistant that learns, remembers, and grows with you"})]}),e&&!u&&a.jsxs("div",{className:"w-full bg-white border border-gray-200 rounded-2xl shadow-sm p-5 space-y-3",children:[a.jsx("h2",{className:"text-sm font-semibold text-gray-700",children:"Getting Started"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(xd,{step:1,done:i,label:"Configure AI Model",subtitle:"Add a model provider to start chatting",onClick:n}),a.jsx(xd,{step:2,done:l,label:"Add Credentials",subtitle:"Connect to your clusters and servers via SSH or Kubeconfig",onClick:r}),a.jsx(xd,{step:3,done:c>0,label:"Start your first conversation",subtitle:"Ask Siclaw to diagnose an issue or run a skill"})]})]}),a.jsx("div",{className:"w-full grid grid-cols-2 gap-3",children:ZL.map(d=>a.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-sm p-4 space-y-1.5",children:[a.jsx(d.icon,{className:"w-5 h-5 text-gray-400"}),a.jsx("p",{className:"text-sm font-medium text-gray-700",children:d.title}),a.jsx("p",{className:"text-xs text-gray-500 leading-relaxed",children:d.description})]},d.title))}),u&&l&&a.jsx(xx,{credentials:o})]}),!s&&l&&a.jsx(xx,{credentials:o}),e&&a.jsxs("div",{className:"w-full space-y-3",children:[a.jsx("p",{className:"text-xs text-center text-gray-400",children:"Try asking"}),a.jsxs("div",{className:"flex flex-wrap gap-2 justify-center",children:[s&&a.jsx("button",{onClick:()=>f(gx),className:"rounded-full px-4 py-2 bg-blue-50 hover:bg-blue-100 border border-blue-200 text-sm text-blue-700 transition-colors",children:gx}),eM.map(d=>a.jsx("button",{onClick:()=>f(d),className:"rounded-full px-4 py-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 text-sm text-gray-700 transition-colors",children:d},d))]}),!i&&a.jsx("p",{className:"text-xs text-center text-amber-600",children:"Configure a model first to start chatting"})]})]})}function xd({step:e,done:t,label:n,subtitle:r,onClick:s}){const i=a.jsxs("div",{className:"flex items-start gap-3",children:[t?a.jsx(Lr,{className:"w-5 h-5 text-green-500 mt-0.5 shrink-0"}):a.jsx(A1,{className:"w-5 h-5 text-gray-300 mt-0.5 shrink-0"}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:`text-sm font-medium ${t?"text-gray-400":"text-gray-800"}`,children:[e,". ",n]}),a.jsx("p",{className:`text-xs mt-0.5 ${t?"text-gray-300":"text-gray-500"}`,children:r})]}),!t&&s&&a.jsx(T1,{className:"w-4 h-4 text-gray-400 mt-0.5 ml-auto shrink-0"})]});return s?a.jsx("button",{onClick:s,className:"w-full text-left px-3 py-2.5 rounded-xl hover:bg-gray-50 transition-colors",children:i}):a.jsx("div",{className:"px-3 py-2.5",children:i})}function xx({credentials:e}){const t=Object.entries(e);return t.length===0?null:a.jsxs("div",{className:"w-full bg-white border border-gray-200 rounded-2xl shadow-sm p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Tr,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Credentials"})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(([n,r])=>a.jsxs("span",{className:"inline-flex items-center text-xs bg-gray-50 text-gray-600 border border-gray-200 rounded-full px-2.5 py-1",children:[tM[n]||n," ×",r]},n))})]})}function rM(e){const t=new Map,n=new Map;for(const r of e){if(r.role!=="tool"||r.toolName!=="create_skill"&&r.toolName!=="update_skill")continue;let s=null;try{s=JSON.parse(r.content)}catch{continue}if(!(s!=null&&s.skill))continue;const i=s.skillId||s.skill.name;n.has(i)||n.set(i,[]),n.get(i).push(r.id);const o=r.metadata;(o==null?void 0:o.skillCard)==="saved"?t.set(r.id,"saved"):(o==null?void 0:o.skillCard)==="dismissed"?t.set(r.id,"dismissed"):t.set(r.id,"pending")}for(const[,r]of n){let s=-1;for(let i=r.length-1;i>=0;i--)if(t.get(r[i])==="pending"){s=i;break}for(let i=0;i<r.length;i++)t.get(r[i])==="pending"&&i!==s&&t.set(r[i],"superseded")}return t}function sM(e){var r;const t=new Map,n=new Map;for(const s of e){if(s.role!=="tool"||s.toolName!=="manage_schedule")continue;let i=null;try{i=JSON.parse(s.content)}catch{continue}if(!i)continue;const o=((r=i.schedule)==null?void 0:r.name)||i.id||s.id;n.has(o)||n.set(o,[]),n.get(o).push(s.id);const l=s.metadata;(l==null?void 0:l.scheduleCard)==="saved"?t.set(s.id,"saved"):(l==null?void 0:l.scheduleCard)==="dismissed"?t.set(s.id,"dismissed"):t.set(s.id,"pending")}for(const[,s]of n){let i=-1;for(let o=s.length-1;o>=0;o--)if(t.get(s[o])==="pending"){i=o;break}for(let o=0;o<s.length;o++)t.get(s[o])==="pending"&&o!==i&&t.set(s[o],"superseded")}return t}function iM({messages:e,isLoading:t,isLoadingHistory:n,wsStatus:r,isConnected:s,hasMore:i,isLoadingMore:o,sendMessage:l,abortResponse:c,loadMoreHistory:u,sendRpc:f,contextUsage:d,isCompacting:h,skills:p,editingSkill:x,onEditSkill:b,onClearEditSkill:k,onSkillSaved:v,onOpenSkillPanel:m,onOpenSchedulePanel:y,panelMessage:j,updateMessageMeta:S,pendingMessages:N,onRemovePending:w,investigationProgress:C,dpActive:D,onSetDpActive:T,dpFocus:M,dpChecklist:P,onHypothesesConfirmed:F,onExitDp:z,systemStatus:W,onNavigateModels:fe,onNavigateCredentials:ee}){const R=g.useRef(null),V=g.useRef(null),E=g.useRef(0),Y=g.useRef(0),J=g.useRef(!1),L=g.useCallback((ie=!0)=>{requestAnimationFrame(()=>{var he;(he=R.current)==null||he.scrollIntoView(ie?{behavior:"smooth"}:void 0)})},[]),Q=g.useMemo(()=>rM(e),[e]),te=g.useMemo(()=>sM(e),[e]),pe=g.useMemo(()=>{for(let ie=e.length-1;ie>=0;ie--)if(e[ie].toolName==="propose_hypotheses"&&!e[ie].isStreaming)return e[ie].id;return null},[e]);g.useEffect(()=>{const ie=V.current;if(ie){if(E.current){const he=ie.scrollHeight-E.current;he>0&&(ie.scrollTop+=he),E.current=0}else if(Y.current===0&&e.length>0)J.current=!1,L(!1);else if(e.length>Y.current){const he=e[e.length-1];(he==null?void 0:he.role)==="user"?(J.current=!1,L(!1)):J.current||L(!0)}else J.current||L(!0);Y.current=e.length}},[e,L]);const ne=g.useCallback(()=>{const ie=V.current;if(!ie)return;const{scrollTop:he,scrollHeight:Ce,clientHeight:Te}=ie,K=Ce-he-Te;J.current=K>300,!(!i||o||!u)&&ie.scrollTop<80&&(E.current=ie.scrollHeight,u())},[i,o,u]);return a.jsxs("div",{className:"flex-1 flex flex-col h-full bg-white",children:[a.jsx("div",{className:"absolute top-4 right-16 z-30",children:a.jsxs("div",{className:B("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium transition-colors",s?"bg-green-50 text-green-600":r==="connecting"?"bg-yellow-50 text-yellow-600":"bg-red-50 text-red-600"),children:[s?a.jsx(Ep,{className:"w-3 h-3"}):r==="connecting"?a.jsx(Ae,{className:"w-3 h-3 animate-spin"}):a.jsx(F5,{className:"w-3 h-3"}),a.jsx("span",{children:s?"Connected":r==="connecting"?"Connecting...":"Disconnected"})]})}),a.jsx("div",{ref:V,className:"flex-1 overflow-y-auto px-4 lg:px-8 py-8",onScroll:ne,children:a.jsxs("div",{className:"max-w-5xl mx-auto space-y-8",children:[n?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-gray-400",children:[a.jsx(Ae,{className:"w-8 h-8 animate-spin text-gray-300 mb-4"}),a.jsx("p",{className:"text-sm",children:"Loading messages..."})]}):e.length===0?a.jsx(nM,{systemStatus:W??null,onSendPrompt:l,onNavigateModels:fe??(()=>{}),onNavigateCredentials:ee??(()=>{})}):a.jsxs(a.Fragment,{children:[o&&a.jsx("div",{className:"flex justify-center py-2",children:a.jsx(Ae,{className:"w-4 h-4 animate-spin text-gray-400"})}),!i&&e.length>0&&a.jsx("div",{className:"flex justify-center",children:a.jsx("span",{className:"text-xs font-semibold text-gray-400 bg-gray-100 px-3 py-1 rounded-full",children:"Start of conversation"})}),e.filter(ie=>!ie.hidden).map(ie=>a.jsx(cM,{message:ie,sendRpc:f,skills:p,editingSkill:x,onEditSkill:b,onSkillSaved:v,skillStatus:Q.get(ie.id),scheduleStatus:te.get(ie.id),onOpenSkillPanel:m,onOpenSchedulePanel:y,updateMessageMeta:S,isInPanel:(j==null?void 0:j.id)===ie.id,investigationProgress:C,sendMessage:l,abortResponse:c,dpFocus:M,onHypothesesConfirmed:F,hypothesesSuperseded:pe!=null&&ie.toolName==="propose_hypotheses"&&ie.id!==pe},ie.id)),P&&P.length>0&&a.jsx(JL,{items:P,investigationProgress:C,onDismiss:z}),t&&a.jsxs("div",{className:"flex gap-4",children:[a.jsx("div",{className:"w-8 h-8 rounded-full bg-white border border-gray-200 flex items-center justify-center text-primary-600 shadow-sm",children:a.jsx(Xs,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex items-center gap-2 text-gray-400",children:[a.jsx(Ae,{className:"w-4 h-4 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Thinking..."})]})]})]}),a.jsx("div",{ref:R})]})}),a.jsx(RL,{onSend:l,onAbort:c,disabled:!s,isLoading:t,contextUsage:d,isCompacting:h,editingSkill:x,onClearEditSkill:k,skills:p,onEditSkill:b,pendingMessages:N,onRemovePending:w,dpFocus:M,dpActive:D,onSetDpActive:T})]})}function aM(e){const t=[],n=/\[User Script: ([^\s]+) \((\w+)\)\]\n*/g,r=e.replace(n,(s,i,o)=>(t.push({name:i,lang:o}),"")).trim();return{scripts:t,text:r}}function oM(e){const t=e.match(/\[Skill: ([^\]]+)\]\n*/);if(t)return{skillName:t[1],text:e.replace(t[0],"").trim()};const n=e.match(/\[Editing Skill: ([^\]]+)\]\n(?:.*\n)*?---\n*/);return n?{skillName:n[1],text:e.replace(n[0],"").trim()}:{skillName:null,text:e}}function lM(e){const t=e.match(/\[Deep Investigation\]\n*/);return t?{isDeepInvestigation:!0,text:e.replace(t[0],"").trim()}:{isDeepInvestigation:!1,text:e}}function cM({message:e,skills:t,onEditSkill:n,skillStatus:r,scheduleStatus:s,onOpenSkillPanel:i,onOpenSchedulePanel:o,sendRpc:l,updateMessageMeta:c,investigationProgress:u,sendMessage:f,abortResponse:d,dpFocus:h,onHypothesesConfirmed:p,hypothesesSuperseded:x}){const b=e.role==="user";if(e.role==="tool")return(e.toolName==="create_skill"||e.toolName==="update_skill")&&!e.isStreaming?a.jsx(_L,{message:e,status:r??"pending",onOpenPanel:i}):e.toolName==="manage_schedule"&&!e.isStreaming?a.jsx(FL,{message:e,status:s??"pending",onOpenPanel:o,sendRpc:l,updateMessageMeta:c}):e.toolName==="deep_search"?e.isStreaming&&h?null:a.jsx($L,{message:e,progress:e.isStreaming?u:void 0}):e.toolName==="propose_hypotheses"&&!e.isStreaming?a.jsx(KL,{message:e,sendMessage:f,abortResponse:d,onHypothesesConfirmed:p,superseded:x}):a.jsx(uM,{message:e,skills:t,onEditSkill:n});const{isDeepInvestigation:v,text:m}=b?lM(e.content):{isDeepInvestigation:!1,text:e.content},{scripts:y,text:j}=b?aM(m):{scripts:[],text:m},{skillName:S,text:N}=b?oM(j):{skillName:null,text:j};return a.jsxs("div",{className:B("flex gap-4 group",b?"flex-row-reverse":"flex-row"),children:[a.jsx("div",{className:B("w-8 h-8 rounded-full flex items-center justify-center shrink-0 shadow-sm border",b?"bg-primary-600 border-primary-600 text-white":"bg-white border-gray-200 text-primary-600"),children:b?a.jsx(Ki,{className:"w-4 h-4"}):a.jsx(Xs,{className:"w-5 h-5"})}),a.jsxs("div",{className:B("flex flex-col min-w-0",b?"items-end":"items-start"),children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[a.jsx("span",{className:"text-sm font-semibold text-gray-900",children:b?"You":"Siclaw"}),a.jsx("span",{className:"text-xs text-gray-400",children:e.timestamp}),e.isStreaming&&!b&&a.jsx(Ae,{className:"w-3 h-3 animate-spin text-gray-400"})]}),(v||S||y.length>0)&&a.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:[v&&a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-blue-50 border border-blue-200 text-xs font-medium text-blue-700",children:[a.jsx(vo,{className:"w-3.5 h-3.5 text-blue-500"}),a.jsx("span",{children:"Deep Investigation"}),h&&a.jsx("span",{className:"ml-1 px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 text-[10px] font-semibold uppercase",children:h})]}),S&&a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-indigo-50 border border-indigo-200 text-xs font-medium text-indigo-700",children:[a.jsx(Wi,{className:"w-3.5 h-3.5 text-indigo-500"}),a.jsx("span",{children:S})]}),y.map((w,C)=>a.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-primary-50 border border-primary-200 text-xs font-medium text-primary-800",children:[w.lang==="python"?a.jsx(qr,{className:"w-3.5 h-3.5 text-blue-600"}):a.jsx(Fn,{className:"w-3.5 h-3.5 text-green-600"}),a.jsx("span",{children:w.name})]},C))]}),N&&a.jsx("div",{className:B("px-5 py-3.5 rounded-2xl text-[15px] leading-relaxed shadow-sm max-w-3xl min-w-0 overflow-hidden",b?"bg-primary-600 text-white rounded-tr-sm [&_pre]:bg-black/20 [&_pre]:text-white [&_code]:bg-white/15 [&_code]:text-white [&_a]:text-blue-200":"bg-white border border-gray-200 text-gray-800 rounded-tl-sm"),children:a.jsx(Xp,{children:N})})]})]})}function uM({message:e,skills:t,onEditSkill:n}){const[r,s]=g.useState(!1),i=e.isStreaming||r,o=(()=>{if(e.toolName!=="run_skill"||!t||!n)return null;const l=e.toolInput;return l?t.find(c=>c.scope==="personal"&&(c.name===l||c.dirName===l))??null:null})();return a.jsx("div",{className:"pl-12 min-w-0",children:a.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg shadow-sm overflow-hidden",children:[a.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-4 py-2 bg-gray-50 border-b border-gray-200 hover:bg-gray-100 transition-colors cursor-pointer text-left min-w-0",onClick:()=>s(!r),children:[a.jsx(os,{className:B("w-3.5 h-3.5 text-gray-400 transition-transform shrink-0",i&&"rotate-90")}),a.jsx(Fn,{className:"w-4 h-4 text-gray-500 shrink-0"}),a.jsx("span",{className:"font-mono text-xs font-semibold text-gray-700 shrink-0",children:e.toolName}),e.toolInput&&a.jsx("span",{className:"font-mono text-xs text-gray-500 truncate min-w-0",children:e.toolInput}),e.toolStatus==="running"&&a.jsx(Ae,{className:"w-3 h-3 animate-spin text-blue-400 ml-auto shrink-0"}),e.toolStatus==="success"&&a.jsx(Lr,{className:"w-3.5 h-3.5 text-green-500 ml-auto shrink-0"}),e.toolStatus==="error"&&a.jsx(ei,{className:"w-3.5 h-3.5 text-red-500 ml-auto shrink-0"}),e.toolStatus==="aborted"&&a.jsx(f5,{className:"w-3.5 h-3.5 text-amber-500 ml-auto shrink-0"}),o&&!e.isStreaming&&a.jsx("span",{className:"ml-auto shrink-0 p-1 rounded hover:bg-indigo-100 text-gray-400 hover:text-indigo-600 transition-colors",title:"Edit this skill",onClick:l=>{l.stopPropagation(),n(String(o.id),o.name)},children:a.jsx(zo,{className:"w-3.5 h-3.5"})})]}),i&&a.jsxs("div",{className:"overflow-x-auto bg-slate-50 max-h-80 overflow-y-auto",children:[e.toolInput&&a.jsx("div",{className:"px-4 pt-3 pb-2 border-b border-slate-200",children:a.jsx("pre",{className:"text-xs font-mono leading-relaxed text-slate-800 whitespace-pre-wrap break-all",children:e.toolInput})}),a.jsx("div",{className:"p-4",children:a.jsx("pre",{className:"text-xs font-mono leading-relaxed text-slate-600 whitespace-pre-wrap",children:e.content||(e.toolStatus==="aborted"?"Aborted.":"Running...")})})]})]})})}class dM{diff(t,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const i=this.castInput(t,r),o=this.castInput(n,r),l=this.removeEmpty(this.tokenize(i,r)),c=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(l,c,r,s)}diffWithOptionsObj(t,n,r,s){var i;const o=m=>{if(m=this.postProcess(m,r),s){setTimeout(function(){s(m)},0);return}else return m},l=n.length,c=t.length;let u=1,f=l+c;r.maxEditLength!=null&&(f=Math.min(f,r.maxEditLength));const d=(i=r.timeout)!==null&&i!==void 0?i:1/0,h=Date.now()+d,p=[{oldPos:-1,lastComponent:void 0}];let x=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&x+1>=l)return o(this.buildValues(p[0].lastComponent,n,t));let b=-1/0,k=1/0;const v=()=>{for(let m=Math.max(b,-u);m<=Math.min(k,u);m+=2){let y;const j=p[m-1],S=p[m+1];j&&(p[m-1]=void 0);let N=!1;if(S){const C=S.oldPos-m;N=S&&0<=C&&C<l}const w=j&&j.oldPos+1<c;if(!N&&!w){p[m]=void 0;continue}if(!w||N&&j.oldPos<S.oldPos?y=this.addToPath(S,!0,!1,0,r):y=this.addToPath(j,!1,!0,1,r),x=this.extractCommon(y,n,t,m,r),y.oldPos+1>=c&&x+1>=l)return o(this.buildValues(y.lastComponent,n,t))||!0;p[m]=y,y.oldPos+1>=c&&(k=Math.min(k,m-1)),x+1>=l&&(b=Math.max(b,m+1))}u++};if(s)(function m(){setTimeout(function(){if(u>f||Date.now()>h)return s(void 0);v()||m()},0)})();else for(;u<=f&&Date.now()<=h;){const m=v();if(m)return m}}addToPath(t,n,r,s,i){const o=t.lastComponent;return o&&!i.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:t.oldPos+s,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(t,n,r,s,i){const o=n.length,l=r.length;let c=t.oldPos,u=c-s,f=0;for(;u+1<o&&c+1<l&&this.equals(r[c+1],n[u+1],i);)u++,c++,f++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return f&&!i.oneChangePerToken&&(t.lastComponent={count:f,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const s=[];let i;for(;t;)s.push(t),i=t.previousComponent,delete t.previousComponent,t=i;s.reverse();const o=s.length;let l=0,c=0,u=0;for(;l<o;l++){const f=s[l];if(f.removed)f.value=this.join(r.slice(u,u+f.count)),u+=f.count;else{if(!f.added&&this.useLongestToken){let d=n.slice(c,c+f.count);d=d.map(function(h,p){const x=r[u+p];return x.length>h.length?x:h}),f.value=this.join(d)}else f.value=this.join(n.slice(c,c+f.count));c+=f.count,f.added||(u+=f.count)}}return s}}class fM extends dM{constructor(){super(...arguments),this.tokenize=pM}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
583
+ `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
584
+ `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
585
+ `)&&(t=t.slice(0,-1)),n.endsWith(`
586
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const hM=new fM;function Qf(e,t,n){return hM.diff(e,t,n)}function pM(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
587
+ `));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let s=0;s<r.length;s++){const i=r[s];s%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function mM({message:e,sendRpc:t,skills:n,onSave:r,onDismiss:s,onClose:i,updateMessageMeta:o}){const l=e.metadata,c=l==null?void 0:l.skillCard,u=l==null?void 0:l.reviewStatus,f=c==="saved"||c==="dismissed"?"saved":"idle",[d,h]=g.useState(f),[p,x]=g.useState(""),[b,k]=g.useState(f==="saved"?"Saved":""),[v,m]=g.useState(u),[y,j]=g.useState(null),[S,N]=g.useState(!1),[w,C]=g.useState(new Set),[D,T]=g.useState(!0);let M=null;try{M=JSON.parse(e.content)}catch{}const P=M==null?void 0:M.skill,F=e.toolName==="update_skill",z=e.toolName==="fork_skill"||!!(M!=null&&M.fork),W=P?n.find(ne=>ne.name===P.name&&ne.scope==="personal")??n.find(ne=>ne.name===P.name)??(M!=null&&M.skillId?n.find(ne=>ne.name===M.skillId&&ne.scope==="personal")??n.find(ne=>ne.name===M.skillId):void 0):void 0,fe=z?n.find(ne=>ne.name===((M==null?void 0:M.sourceSkillName)??(P==null?void 0:P.name))&&ne.scope!=="personal")??n.find(ne=>ne.name===((M==null?void 0:M.sourceSkillName)??(P==null?void 0:P.name))):void 0,ee=W?String(W.id):(M==null?void 0:M.skillId)||void 0,R=!F&&!z?W:void 0,V=!!R;g.useEffect(()=>{(c==="saved"||c==="dismissed")&&(h("saved"),k(c==="saved"?"Saved":"Dismissed"))},[c]),g.useEffect(()=>{const ne=F?ee:z&&fe?String(fe.id):void 0;!ne||!t||(N(!0),t("skill.get",{id:ne}).then(ie=>{j(ie.files??null)}).catch(()=>j(null)).finally(()=>N(!1)))},[F,z,ee,fe,t]);const E=F||z&&!!y,Y=g.useMemo(()=>{if(!E||!(P!=null&&P.specs)||!(y!=null&&y.specs))return null;const ne=Qf(y.specs??"",P.specs??"");return ne.every(ie=>!ie.added&&!ie.removed)?null:ne},[E,P==null?void 0:P.specs,y==null?void 0:y.specs]),J=g.useMemo(()=>{if(!E||!(P!=null&&P.scripts))return null;const ne=new Map(((y==null?void 0:y.scripts)??[]).map(he=>[he.name,he.content])),ie=[];for(const he of P.scripts){const Ce=ne.get(he.name);if(!Ce)ie.push({name:he.name,status:"new"});else{const Te=Qf(Ce??"",he.content??""),K=Te.some($=>$.added||$.removed);ie.push({name:he.name,status:K?"changed":"unchanged",changes:K?Te:void 0})}}return ie},[F,P==null?void 0:P.scripts,y==null?void 0:y.scripts]),L=F&&Y===null&&(J==null?void 0:J.every(ne=>ne.status==="unchanged")),Q=()=>{if(!P)return"";let ne=2,ie=`${P.name}-${ne}`;for(;n.some(he=>he.name===ie);)ne++,ie=`${P.name}-${ne}`;return ie},te=async ne=>{var ie;if(P){h("saving"),x(""),k("");try{const he=(ie=P.scripts)==null?void 0:ie.map(Te=>({name:Te.name,content:Te.content}));let Ce;if(z&&ne!=="create-new-name"){const Te=fe?String(fe.id):void 0;if(!Te)throw new Error(`Source skill "${(M==null?void 0:M.sourceSkillName)??P.name}" not found`);Ce=(await t("skill.fork",{sourceId:Te,name:P.name,description:P.description,type:P.type,specs:P.specs,scripts:he})).reviewStatus,k("Forked to Personal")}else if(ne==="update")W&&W.scope!=="personal"?(Ce=(await t("skill.fork",{sourceId:String(W.id),name:P.name,description:P.description,type:P.type,specs:P.specs,scripts:he})).reviewStatus,k("Saved to Personal")):(Ce=(await t("skill.update",{id:ee,name:P.name,description:P.description,type:P.type,specs:P.specs,scripts:he})).reviewStatus,k("Updated"));else if(ne==="update-existing"&&R)R.scope==="personal"?(Ce=(await t("skill.update",{id:String(R.id),name:P.name,description:P.description,type:P.type,specs:P.specs,scripts:he})).reviewStatus,k("Updated")):(Ce=(await t("skill.fork",{sourceId:String(R.id),name:P.name,description:P.description,type:P.type,specs:P.specs,scripts:he})).reviewStatus,k("Saved to Personal"));else if(ne==="create-new-name"){const Te=Q();Ce=(await t("skill.create",{name:Te,description:P.description,type:P.type,specs:P.specs,scripts:he})).reviewStatus,k(`Saved as "${Te}"`)}else Ce=(await t("skill.create",{name:P.name,description:P.description,type:P.type,specs:P.specs,scripts:he})).reviewStatus,k("Saved");m(Ce),h("saved"),await o(e.id,{skillCard:"saved",reviewStatus:Ce}),r(e)}catch(he){h("error"),x((he==null?void 0:he.message)||"Failed to save skill")}}},pe=async()=>{await o(e.id,{skillCard:"dismissed"}),s(e)};return P?a.jsxs("div",{className:"w-[480px] border-l border-gray-200 bg-white flex flex-col shrink-0 h-full",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-200 bg-gradient-to-r from-indigo-50 to-purple-50 flex items-center justify-between shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(Wi,{className:"w-4 h-4 text-indigo-600 shrink-0"}),a.jsx("span",{className:"font-semibold text-sm text-gray-900 truncate",children:P.name}),P.type&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium bg-indigo-100 text-indigo-700 shrink-0",children:[a.jsx(Cp,{className:"w-2.5 h-2.5"}),P.type]})]}),a.jsx("button",{onClick:i,className:"p-1 rounded hover:bg-white/60 transition-colors shrink-0",children:a.jsx(Ge,{className:"w-4 h-4 text-gray-500"})})]}),P.description&&a.jsx("div",{className:"px-4 py-2 border-b border-gray-100 text-xs text-gray-600",children:P.description}),a.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:S?a.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-400",children:[a.jsx(Ae,{className:"w-5 h-5 animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading current version..."})]}):L?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-400",children:[a.jsx(qt,{className:"w-8 h-8 mb-2 text-green-400"}),a.jsx("span",{className:"text-sm font-medium text-green-600",children:"Already up to date"}),a.jsx("span",{className:"text-xs text-gray-400 mt-1",children:"No changes detected"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"border-b border-gray-100",children:[a.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-4 py-2.5 hover:bg-gray-50 transition-colors text-left",onClick:()=>T(!D),children:[a.jsx(os,{className:B("w-3.5 h-3.5 text-gray-400 transition-transform",D&&"rotate-90")}),a.jsx("span",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"SKILL.md"}),F&&Y&&a.jsx("span",{className:"ml-auto text-[10px] font-medium text-amber-600 bg-amber-50 px-1.5 py-0.5 rounded",children:"changed"})]}),D&&a.jsx("div",{className:"px-4 pb-3 max-h-96 overflow-y-auto",children:F&&Y?a.jsx(yx,{changes:Y}):a.jsx("pre",{className:"text-xs font-mono leading-relaxed text-gray-600 whitespace-pre-wrap",children:P.specs})})]}),P.scripts&&P.scripts.length>0&&a.jsxs("div",{className:"border-b border-gray-100",children:[a.jsx("div",{className:"px-4 py-2.5",children:a.jsx("span",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Scripts"})}),P.scripts.map((ne,ie)=>{const he=J==null?void 0:J[ie],Ce=w.has(ne.name);return a.jsxs("div",{className:"border-t border-gray-50",children:[a.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-4 py-2 hover:bg-gray-50 transition-colors text-left",onClick:()=>C(Te=>{const K=new Set(Te);return K.has(ne.name)?K.delete(ne.name):K.add(ne.name),K}),children:[a.jsx(os,{className:B("w-3 h-3 text-gray-400 transition-transform",Ce&&"rotate-90")}),ne.name.endsWith(".py")?a.jsx(qr,{className:"w-3.5 h-3.5 text-blue-500"}):a.jsx(Fn,{className:"w-3.5 h-3.5 text-green-500"}),a.jsx("span",{className:"text-xs font-mono text-gray-700",children:ne.name}),he&&a.jsx("span",{className:B("ml-auto text-[10px] font-medium px-1.5 py-0.5 rounded",he.status==="new"?"text-green-600 bg-green-50":he.status==="changed"?"text-amber-600 bg-amber-50":"text-gray-400 bg-gray-50"),children:he.status})]}),Ce&&a.jsx("div",{className:"px-4 pb-3 max-h-64 overflow-y-auto",children:he!=null&&he.changes?a.jsx(yx,{changes:he.changes}):a.jsx("pre",{className:"text-xs font-mono leading-relaxed text-gray-600 whitespace-pre-wrap",children:ne.content})})]},ne.name)})]})]})}),d==="idle"&&V&&a.jsxs("div",{className:"px-4 py-2 bg-amber-50 border-t border-amber-200 flex items-start gap-2 shrink-0",children:[a.jsx(zs,{className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5"}),a.jsxs("span",{className:"text-xs text-amber-800",children:["A ",R.scope," skill named ",a.jsxs("strong",{children:['"',P.name,'"']})," already exists."]})]}),d==="saved"&&v==="draft"&&a.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-t border-gray-200 flex items-start gap-2 shrink-0",children:[a.jsx(tu,{className:"w-3.5 h-3.5 text-gray-400 shrink-0 mt-0.5"}),a.jsx("span",{className:"text-xs text-gray-600",children:"Saved as draft. Available in test environments. Request publish to use in production."})]}),a.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-gray-50/80 flex items-center justify-between shrink-0",children:[a.jsx("button",{onClick:pe,disabled:d==="saving",className:"px-3 py-1.5 rounded-lg text-xs font-medium text-gray-600 hover:bg-gray-200 transition-colors",children:"Dismiss"}),a.jsxs("div",{className:"flex items-center gap-2",children:[d==="idle"&&!L&&(()=>{if(z&&fe){const ne=n.some(ie=>ie.name===P.name&&ie.scope==="personal");return a.jsxs("button",{onClick:()=>te(ne?"create-new-name":"create"),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-purple-600 text-white hover:bg-purple-700 transition-colors shadow-sm",children:[a.jsx(bp,{className:"w-3.5 h-3.5"}),"Fork to Personal"]})}if(F&&ee){const ne=W&&W.scope!=="personal";return a.jsx("button",{onClick:()=>te("update"),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-indigo-600 text-white hover:bg-indigo-700 transition-colors shadow-sm",children:ne?a.jsxs(a.Fragment,{children:[a.jsx(Rf,{className:"w-3.5 h-3.5"})," Save to Personal"]}):a.jsxs(a.Fragment,{children:[a.jsx(Qt,{className:"w-3.5 h-3.5"})," Update Skill"]})})}return V?a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>te("update-existing"),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-amber-600 text-white hover:bg-amber-700 transition-colors shadow-sm",children:R.scope==="personal"?a.jsxs(a.Fragment,{children:[a.jsx(Qt,{className:"w-3.5 h-3.5"})," Update Existing"]}):a.jsxs(a.Fragment,{children:[a.jsx(Rf,{className:"w-3.5 h-3.5"})," Save to Personal"]})}),a.jsx("button",{onClick:()=>te("create-new-name"),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-gray-700 hover:bg-gray-100 border border-gray-300 transition-colors",children:"Save as New"})]}):a.jsxs("button",{onClick:()=>te("create"),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-indigo-600 text-white hover:bg-indigo-700 transition-colors shadow-sm",children:[a.jsx(Qt,{className:"w-3.5 h-3.5"}),"Save Skill"]})})(),d==="idle"&&L&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-green-600",children:[a.jsx(qt,{className:"w-3.5 h-3.5"}),"Up to date"]}),d==="saving"&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-indigo-600",children:[a.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin"}),"Saving..."]}),d==="saved"&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-green-600",children:[a.jsx(qt,{className:"w-3.5 h-3.5"}),b||"Saved"]}),d==="error"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-red-600",children:[a.jsx(xo,{className:"w-3.5 h-3.5"}),p]}),a.jsx("button",{onClick:()=>{h("idle"),x("")},className:"px-2.5 py-1 rounded-lg text-xs font-medium text-red-600 hover:bg-red-50 border border-red-200 transition-colors",children:"Retry"})]})]})]})]}):a.jsx("div",{className:"w-[480px] border-l border-gray-200 bg-white flex flex-col shrink-0",children:a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Invalid skill data"}),a.jsx("button",{onClick:i,className:"p-1 rounded hover:bg-gray-100",children:a.jsx(Ge,{className:"w-4 h-4 text-gray-400"})})]})})}function yx({changes:e}){return a.jsx("pre",{className:"text-xs font-mono leading-relaxed whitespace-pre-wrap",children:e.map((t,n)=>a.jsx("span",{className:B(t.added&&"bg-green-100 text-green-800",t.removed&&"bg-red-100 text-red-800 line-through",!t.added&&!t.removed&&"text-gray-500"),children:t.value},n))})}async function Sa(e,t,n,r){try{const s=await e("cron.list"),i=r?s.jobs.filter(o=>o.envId===r):s.jobs;if(t)return i.find(o=>o.id===t)??null;if(n){const o=n.toLowerCase(),l=i.find(f=>f.name===n);if(l)return l;const c=i.find(f=>f.name.toLowerCase()===o);if(c)return c;const u=i.find(f=>f.name.toLowerCase().includes(o)||o.includes(f.name.toLowerCase()));if(u)return u}return i.length===1?i[0]:null}catch{return null}}function gM({message:e,sendRpc:t,onSave:n,onDismiss:r,onClose:s,updateMessageMeta:i,selectedEnvId:o}){var Q;const l=(Q=e.metadata)==null?void 0:Q.scheduleCard,c=l==="saved"||l==="dismissed"?"saved":"idle",[u,f]=g.useState(c),[d,h]=g.useState(""),[p,x]=g.useState(null),[b,k]=g.useState(!1),[v,m]=g.useState(!0),[y,j]=g.useState(!0);let S=null;try{S=JSON.parse(e.content)}catch{}const N=S==null?void 0:S.action,w=S==null?void 0:S.schedule,C=N==="create",D=N==="update",T=N==="delete",M=N==="pause",P=N==="resume",F=N==="rename",z=F?(S==null?void 0:S.name)||(S==null?void 0:S.id)||"...":(w==null?void 0:w.name)||(S==null?void 0:S.name)||(S==null?void 0:S.id)||"...";g.useEffect(()=>{(l==="saved"||l==="dismissed")&&f("saved")},[l]);const W=g.useRef(!1);g.useEffect(()=>{if(W.current||u!=="idle")return;const te=e.metadata;te!=null&&te.scheduleCard||(M||P)&&(W.current=!0,E())},[M,P,u]),g.useEffect(()=>{!D||!t||(k(!0),Sa(t,S==null?void 0:S.id,(S==null?void 0:S.name)??(w==null?void 0:w.name),o).then(te=>x(te)).catch(()=>x(null)).finally(()=>k(!1)))},[D,S==null?void 0:S.id,S==null?void 0:S.name,w==null?void 0:w.name,t,o]);const fe=D&&p&&w&&p.schedule!==w.schedule,ee=D&&p&&w&&p.status!==w.status,R=g.useMemo(()=>{if(!D||!p||!w)return null;const te=p.description??"",pe=w.description??"";if(te===pe)return null;const ne=Qf(te,pe);return ne.every(ie=>!ie.added&&!ie.removed)?null:ne},[D,p,w]),V=D&&p&&!fe&&!ee&&!R,E=async()=>{if(S){if(!o){f("error"),h("Please select an environment first");return}f("saving"),h("");try{if(C&&w)await t("cron.save",{name:w.name,description:w.description,schedule:w.schedule,status:w.status||"active",envId:o??null});else if(D&&w){const te=await Sa(t,S.id,S.name,o);if(!te)throw new Error("Schedule not found");await t("cron.save",{id:te.id,name:w.name,description:w.description,schedule:w.schedule,status:w.status||"active",envId:o??null})}else if(T){const te=await Sa(t,S.id,S.name,o);if(!te)throw new Error("Schedule not found");await t("cron.delete",{id:te.id})}else if(M||P){const te=await Sa(t,S.id,S.name,o);if(!te)throw new Error("Schedule not found");await t("cron.setStatus",{id:te.id,status:M?"paused":"active"})}else if(F){const te=await Sa(t,S.id,S.name,o);if(!te)throw new Error("Schedule not found");await t("cron.rename",{id:te.id,newName:S.newName})}f("saved"),await i(e.id,{scheduleCard:"saved"}),n(e)}catch(te){f("error"),h((te==null?void 0:te.message)||"Operation failed")}}},Y=async()=>{await i(e.id,{scheduleCard:"dismissed"}),r(e)};if(!S||S.error)return a.jsx("div",{className:"w-[480px] border-l border-gray-200 bg-white flex flex-col shrink-0",children:a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200",children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Invalid schedule data"}),a.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-gray-100",children:a.jsx(Ge,{className:"w-4 h-4 text-gray-400"})})]})});const J=xM(N);return M||P?a.jsxs("div",{className:"w-[320px] border-l border-gray-200 bg-white flex flex-col shrink-0",children:[a.jsxs("div",{className:B("px-4 py-3 border-b border-gray-200 bg-gradient-to-r flex items-center justify-between shrink-0",J.gradient),children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(Ys,{className:B("w-4 h-4 shrink-0",J.iconColor)}),a.jsx("span",{className:"font-semibold text-sm text-gray-900 truncate",children:z})]}),a.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-white/60 transition-colors shrink-0",children:a.jsx(Ge,{className:"w-4 h-4 text-gray-500"})})]}),a.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4",children:[u==="saving"&&a.jsxs(a.Fragment,{children:[a.jsx(Ae,{className:B("w-8 h-8 mb-3 animate-spin",J.iconColor)}),a.jsx("span",{className:"text-sm text-gray-600",children:M?"Pausing...":"Resuming..."})]}),u==="saved"&&a.jsxs(a.Fragment,{children:[a.jsx(qt,{className:"w-8 h-8 mb-3 text-green-500"}),a.jsx("span",{className:"text-sm font-medium text-green-600",children:M?"Schedule paused":"Schedule resumed"})]}),u==="error"&&a.jsxs(a.Fragment,{children:[a.jsx(xo,{className:"w-8 h-8 mb-3 text-red-500"}),a.jsx("span",{className:"text-sm font-medium text-red-600",children:d}),a.jsx("button",{onClick:()=>{f("idle"),h(""),W.current=!1},className:"mt-3 px-3 py-1.5 rounded-lg text-xs font-medium text-red-600 hover:bg-red-50 border border-red-200",children:"Retry"})]}),u==="idle"&&a.jsxs(a.Fragment,{children:[a.jsx(Ae,{className:B("w-8 h-8 mb-3 animate-spin",J.iconColor)}),a.jsx("span",{className:"text-sm text-gray-500",children:"Preparing..."})]})]})]}):a.jsxs("div",{className:"w-[480px] border-l border-gray-200 bg-white flex flex-col shrink-0 h-full",children:[a.jsxs("div",{className:B("px-4 py-3 border-b border-gray-200 bg-gradient-to-r flex items-center justify-between shrink-0",J.gradient),children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(Ys,{className:B("w-4 h-4 shrink-0",J.iconColor)}),a.jsx("span",{className:"font-semibold text-sm text-gray-900 truncate",children:z}),a.jsxs("span",{className:B("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium shrink-0",J.badgeColor),children:[a.jsx(Cp,{className:"w-2.5 h-2.5"}),J.badge]})]}),a.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-white/60 transition-colors shrink-0",children:a.jsx(Ge,{className:"w-4 h-4 text-gray-500"})})]}),S.summary&&a.jsx("div",{className:"px-4 py-2 border-b border-gray-100 text-xs text-gray-600",children:S.summary}),a.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:b?a.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-400",children:[a.jsx(Ae,{className:"w-5 h-5 animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading current version..."})]}):V?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-400",children:[a.jsx(qt,{className:"w-8 h-8 mb-2 text-green-400"}),a.jsx("span",{className:"text-sm font-medium text-green-600",children:"Already up to date"}),a.jsx("span",{className:"text-xs text-gray-400 mt-1",children:"No changes detected"})]}):a.jsxs(a.Fragment,{children:[(w||F)&&a.jsxs("div",{className:"border-b border-gray-100",children:[a.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-4 py-2.5 hover:bg-gray-50 transition-colors text-left",onClick:()=>m(!v),children:[a.jsx(os,{className:B("w-3.5 h-3.5 text-gray-400 transition-transform",v&&"rotate-90")}),a.jsx("span",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Schedule"}),D&&(fe||ee)&&a.jsx("span",{className:"ml-auto text-[10px] font-medium text-amber-600 bg-amber-50 px-1.5 py-0.5 rounded",children:"changed"})]}),v&&a.jsxs("div",{className:"px-4 pb-3 space-y-3",children:[w&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Cron Expression"}),D&&fe&&p?a.jsxs("div",{className:"mt-1 space-y-1",children:[a.jsx("div",{className:"font-mono text-xs bg-red-50 text-red-700 px-2 py-1 rounded line-through",children:p.schedule}),a.jsx("div",{className:"font-mono text-xs bg-green-50 text-green-700 px-2 py-1 rounded",children:w.schedule})]}):a.jsx("div",{className:"font-mono text-xs text-gray-700 bg-gray-50 px-2 py-1 rounded mt-1",children:w.schedule})]}),w&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Status"}),D&&ee&&p?a.jsxs("div",{className:"mt-1 space-y-1",children:[a.jsx("div",{className:"text-xs bg-red-50 text-red-700 px-2 py-1 rounded line-through",children:p.status}),a.jsx("div",{className:"text-xs bg-green-50 text-green-700 px-2 py-1 rounded",children:w.status})]}):a.jsx("div",{className:"text-xs text-gray-700 bg-gray-50 px-2 py-1 rounded mt-1",children:w.status||"active"})]}),F&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-medium text-gray-400 uppercase tracking-wider",children:"Name"}),a.jsxs("div",{className:"mt-1 space-y-1",children:[a.jsx("div",{className:"text-xs bg-red-50 text-red-700 px-2 py-1 rounded line-through",children:(S==null?void 0:S.name)||(S==null?void 0:S.id)}),a.jsx("div",{className:"text-xs bg-green-50 text-green-700 px-2 py-1 rounded",children:S==null?void 0:S.newName})]})]})]})]}),((w==null?void 0:w.description)||D&&(p==null?void 0:p.description))&&a.jsxs("div",{className:"border-b border-gray-100",children:[a.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-4 py-2.5 hover:bg-gray-50 transition-colors text-left",onClick:()=>j(!y),children:[a.jsx(os,{className:B("w-3.5 h-3.5 text-gray-400 transition-transform",y&&"rotate-90")}),a.jsx("span",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider",children:"Description"}),R&&a.jsx("span",{className:"ml-auto text-[10px] font-medium text-amber-600 bg-amber-50 px-1.5 py-0.5 rounded",children:"changed"})]}),y&&a.jsx("div",{className:"px-4 pb-3",children:R?a.jsx(yM,{changes:R}):a.jsx("pre",{className:"text-xs font-mono leading-relaxed text-gray-600 whitespace-pre-wrap",children:(w==null?void 0:w.description)||(p==null?void 0:p.description)||""})})]}),T&&!w&&a.jsxs("div",{className:"px-4 py-6 flex flex-col items-center text-center",children:[a.jsx(J.Icon,{className:B("w-8 h-8 mb-3",J.iconColor)}),a.jsx("span",{className:"text-sm text-gray-600",children:"This will permanently delete the schedule."})]})]})}),a.jsxs("div",{className:"px-4 py-3 border-t border-gray-200 bg-gray-50/80 flex items-center justify-between shrink-0",children:[a.jsx("button",{onClick:Y,disabled:u==="saving",className:"px-3 py-1.5 rounded-lg text-xs font-medium text-gray-600 hover:bg-gray-200 transition-colors",children:"Dismiss"}),a.jsxs("div",{className:"flex items-center gap-2",children:[u==="idle"&&!V&&a.jsxs("button",{onClick:E,className:B("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-white transition-colors shadow-sm",J.btnClass),children:[a.jsx(J.Icon,{className:"w-3.5 h-3.5"}),J.label]}),u==="idle"&&V&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-green-600",children:[a.jsx(qt,{className:"w-3.5 h-3.5"}),"Up to date"]}),u==="saving"&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-amber-600",children:[a.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin"}),"Processing..."]}),u==="saved"&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-green-600",children:[a.jsx(qt,{className:"w-3.5 h-3.5"}),"Done"]}),u==="error"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-red-600",children:[a.jsx(xo,{className:"w-3.5 h-3.5"}),d]}),a.jsx("button",{onClick:()=>{f("idle"),h("")},className:"px-2.5 py-1 rounded-lg text-xs font-medium text-red-600 hover:bg-red-50 border border-red-200 transition-colors",children:"Retry"})]})]})]})]})}function xM(e){switch(e){case"delete":return{label:"Delete Schedule",Icon:mn,btnClass:"bg-red-600 hover:bg-red-700",gradient:"from-red-50 to-orange-50",badge:"Delete",badgeColor:"bg-red-100 text-red-700",iconColor:"text-red-500"};case"pause":return{label:"Pause Schedule",Icon:Sp,btnClass:"bg-amber-600 hover:bg-amber-700",gradient:"from-amber-50 to-orange-50",badge:"Pause",badgeColor:"bg-amber-100 text-amber-700",iconColor:"text-amber-500"};case"resume":return{label:"Resume Schedule",Icon:yo,btnClass:"bg-green-600 hover:bg-green-700",gradient:"from-green-50 to-emerald-50",badge:"Resume",badgeColor:"bg-green-100 text-green-700",iconColor:"text-green-500"};case"rename":return{label:"Rename Schedule",Icon:zo,btnClass:"bg-blue-600 hover:bg-blue-700",gradient:"from-blue-50 to-indigo-50",badge:"Rename",badgeColor:"bg-blue-100 text-blue-700",iconColor:"text-blue-500"};case"update":return{label:"Update Schedule",Icon:Qt,btnClass:"bg-amber-600 hover:bg-amber-700",gradient:"from-amber-50 to-orange-50",badge:"Update",badgeColor:"bg-amber-100 text-amber-700",iconColor:"text-amber-500"};default:return{label:"Save Schedule",Icon:Qt,btnClass:"bg-amber-600 hover:bg-amber-700",gradient:"from-amber-50 to-yellow-50",badge:"Create",badgeColor:"bg-amber-100 text-amber-700",iconColor:"text-amber-500"}}}function yM({changes:e}){return a.jsx("pre",{className:"text-xs font-mono leading-relaxed whitespace-pre-wrap",children:e.map((t,n)=>a.jsx("span",{className:B(t.added&&"bg-green-100 text-green-800",t.removed&&"bg-red-100 text-red-800 line-through",!t.added&&!t.removed&&"text-gray-500"),children:t.value},n))})}const Qp=g.createContext({});function Jp(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const fu=g.createContext(null),Zp=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class vM extends g.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function bM({children:e,isPresent:t}){const n=g.useId(),r=g.useRef(null),s=g.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=g.useContext(Zp);return g.useInsertionEffect(()=>{const{width:o,height:l,top:c,left:u}=s.current;if(t||!r.current||!o||!l)return;r.current.dataset.motionPopId=n;const f=document.createElement("style");return i&&(f.nonce=i),document.head.appendChild(f),f.sheet&&f.sheet.insertRule(`
588
+ [data-motion-pop-id="${n}"] {
589
+ position: absolute !important;
590
+ width: ${o}px !important;
591
+ height: ${l}px !important;
592
+ top: ${c}px !important;
593
+ left: ${u}px !important;
594
+ }
595
+ `),()=>{document.head.removeChild(f)}},[t]),a.jsx(vM,{isPresent:t,childRef:r,sizeRef:s,children:g.cloneElement(e,{ref:r})})}const wM=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const l=Jp(kM),c=g.useId(),u=g.useCallback(d=>{l.set(d,!0);for(const h of l.values())if(!h)return;r&&r()},[l,r]),f=g.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:d=>(l.set(d,!1),()=>l.delete(d))}),i?[Math.random(),u]:[n,u]);return g.useMemo(()=>{l.forEach((d,h)=>l.set(h,!1))},[n]),g.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),o==="popLayout"&&(e=a.jsx(bM,{isPresent:n,children:e})),a.jsx(fu.Provider,{value:f,children:e})};function kM(){return new Map}function ak(e=!0){const t=g.useContext(fu);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=g.useId();g.useEffect(()=>{e&&s(i)},[e]);const o=g.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,o]:[!0]}const bl=e=>e.key||"";function vx(e){const t=[];return g.Children.forEach(e,n=>{g.isValidElement(n)&&t.push(n)}),t}const em=typeof window<"u",ok=em?g.useLayoutEffect:g.useEffect,Xn=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1})=>{const[l,c]=ak(o),u=g.useMemo(()=>vx(e),[e]),f=o&&!l?[]:u.map(bl),d=g.useRef(!0),h=g.useRef(u),p=Jp(()=>new Map),[x,b]=g.useState(u),[k,v]=g.useState(u);ok(()=>{d.current=!1,h.current=u;for(let j=0;j<k.length;j++){const S=bl(k[j]);f.includes(S)?p.delete(S):p.get(S)!==!0&&p.set(S,!1)}},[k,f.length,f.join("-")]);const m=[];if(u!==x){let j=[...u];for(let S=0;S<k.length;S++){const N=k[S],w=bl(N);f.includes(w)||(j.splice(S,0,N),m.push(N))}i==="wait"&&m.length&&(j=m),v(vx(j)),b(u);return}const{forceRender:y}=g.useContext(Qp);return a.jsx(a.Fragment,{children:k.map(j=>{const S=bl(j),N=o&&!l?!1:u===k||f.includes(S),w=()=>{if(p.has(S))p.set(S,!0);else return;let C=!0;p.forEach(D=>{D||(C=!1)}),C&&(y==null||y(),v(h.current),o&&(c==null||c()),r&&r())};return a.jsx(wM,{isPresent:N,initial:!d.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:N?void 0:w,children:j},S)})})},jn=e=>e;let lk=jn;function tm(e){let t;return()=>(t===void 0&&(t=e()),t)}const Yi=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},kr=e=>e*1e3,Sr=e=>e/1e3,SM={useManualTiming:!1};function jM(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function l(u){i.has(u)&&(c.schedule(u),e()),u(o)}const c={schedule:(u,f=!1,d=!1)=>{const p=d&&r?t:n;return f&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(l),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const wl=["read","resolveKeyframes","update","preRender","render","postRender"],NM=40;function ck(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=wl.reduce((v,m)=>(v[m]=jM(i),v),{}),{read:l,resolveKeyframes:c,update:u,preRender:f,render:d,postRender:h}=o,p=()=>{const v=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(v-s.timestamp,NM),1),s.timestamp=v,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),f.process(s),d.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},x=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:wl.reduce((v,m)=>{const y=o[m];return v[m]=(j,S=!1,N=!1)=>(n||x(),y.schedule(j,S,N)),v},{}),cancel:v=>{for(let m=0;m<wl.length;m++)o[wl[m]].cancel(v)},state:s,steps:o}}const{schedule:dt,cancel:cs,state:Bt,steps:yd}=ck(typeof requestAnimationFrame<"u"?requestAnimationFrame:jn,!0),uk=g.createContext({strict:!1}),bx={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Xi={};for(const e in bx)Xi[e]={isEnabled:t=>bx[e].some(n=>!!t[n])};function CM(e){for(const t in e)Xi[t]={...Xi[t],...e[t]}}const EM=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Ec(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||EM.has(e)}let dk=e=>!Ec(e);function TM(e){e&&(dk=t=>t.startsWith("on")?!Ec(t):e(t))}try{TM(require("@emotion/is-prop-valid").default)}catch{}function PM(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(dk(s)||n===!0&&Ec(s)||!t&&!Ec(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function AM(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const hu=g.createContext({});function No(e){return typeof e=="string"||Array.isArray(e)}function pu(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const nm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],rm=["initial",...nm];function mu(e){return pu(e.animate)||rm.some(t=>No(e[t]))}function fk(e){return!!(mu(e)||e.variants)}function DM(e,t){if(mu(e)){const{initial:n,animate:r}=e;return{initial:n===!1||No(n)?n:void 0,animate:No(r)?r:void 0}}return e.inherit!==!1?t:{}}function LM(e){const{initial:t,animate:n}=DM(e,g.useContext(hu));return g.useMemo(()=>({initial:t,animate:n}),[wx(t),wx(n)])}function wx(e){return Array.isArray(e)?e.join(" "):e}const MM=Symbol.for("motionComponentSymbol");function Si(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function IM(e,t,n){return g.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Si(n)&&(n.current=r))},[t])}const sm=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),RM="framerAppearId",hk="data-"+sm(RM),{schedule:im}=ck(queueMicrotask,!1),pk=g.createContext({});function _M(e,t,n,r,s){var i,o;const{visualElement:l}=g.useContext(hu),c=g.useContext(uk),u=g.useContext(fu),f=g.useContext(Zp).reducedMotion,d=g.useRef(null);r=r||c.renderer,!d.current&&r&&(d.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:f}));const h=d.current,p=g.useContext(pk);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&FM(d.current,n,s,p);const x=g.useRef(!1);g.useInsertionEffect(()=>{h&&x.current&&h.update(n,u)});const b=n[hk],k=g.useRef(!!b&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,b))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,b)));return ok(()=>{h&&(x.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),im.render(h.render),k.current&&h.animationState&&h.animationState.animateChanges())}),g.useEffect(()=>{h&&(!k.current&&h.animationState&&h.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var v;(v=window.MotionHandoffMarkAsComplete)===null||v===void 0||v.call(window,b)}),k.current=!1))}),h}function FM(e,t,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:mk(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&Si(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function mk(e){if(e)return e.options.allowProjection!==!1?e.projection:mk(e.parent)}function OM({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,o;e&&CM(e);function l(u,f){let d;const h={...g.useContext(Zp),...u,layoutId:zM(u)},{isStatic:p}=h,x=LM(u),b=r(u,p);if(!p&&em){VM();const k=BM(h);d=k.MeasureLayout,x.visualElement=_M(s,b,h,t,k.ProjectionNode)}return a.jsxs(hu.Provider,{value:x,children:[d&&x.visualElement?a.jsx(d,{visualElement:x.visualElement,...h}):null,n(s,u,IM(b,x.visualElement,f),b,p,x.visualElement)]})}l.displayName=`motion.${typeof s=="string"?s:`create(${(o=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&o!==void 0?o:""})`}`;const c=g.forwardRef(l);return c[MM]=s,c}function zM({layoutId:e}){const t=g.useContext(Qp).id;return t&&e!==void 0?t+"-"+e:e}function VM(e,t){g.useContext(uk).strict}function BM(e){const{drag:t,layout:n}=Xi;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const UM=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function am(e){return typeof e!="string"||e.includes("-")?!1:!!(UM.indexOf(e)>-1||/[A-Z]/u.test(e))}function kx(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function om(e,t,n,r){if(typeof t=="function"){const[s,i]=kx(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=kx(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const Jf=e=>Array.isArray(e),$M=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),HM=e=>Jf(e)?e[e.length-1]||0:e,Xt=e=>!!(e&&e.getVelocity);function Hl(e){const t=Xt(e)?e.get():e;return $M(t)?t.toValue():t}function WM({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const o={latestValues:KM(r,s,i,e),renderState:t()};return n&&(o.onMount=l=>n({props:r,current:l,...o}),o.onUpdate=l=>n(l)),o}const gk=e=>(t,n)=>{const r=g.useContext(hu),s=g.useContext(fu),i=()=>WM(e,t,r,s);return n?i():Jp(i)};function KM(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=Hl(i[h]);let{initial:o,animate:l}=e;const c=mu(e),u=fk(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),l===void 0&&(l=t.animate));let f=n?n.initial===!1:!1;f=f||o===!1;const d=f?l:o;if(d&&typeof d!="boolean"&&!pu(d)){const h=Array.isArray(d)?d:[d];for(let p=0;p<h.length;p++){const x=om(e,h[p]);if(x){const{transitionEnd:b,transition:k,...v}=x;for(const m in v){let y=v[m];if(Array.isArray(y)){const j=f?y.length-1:0;y=y[j]}y!==null&&(s[m]=y)}for(const m in b)s[m]=b[m]}}}return s}const ia=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ni=new Set(ia),xk=e=>t=>typeof t=="string"&&t.startsWith(e),yk=xk("--"),GM=xk("var(--"),lm=e=>GM(e)?qM.test(e.split("/*")[0].trim()):!1,qM=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,vk=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Pr=(e,t,n)=>n>t?t:n<e?e:n,aa={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Co={...aa,transform:e=>Pr(0,1,e)},kl={...aa,default:1},$o=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vr=$o("deg"),lr=$o("%"),Ee=$o("px"),YM=$o("vh"),XM=$o("vw"),Sx={...lr,parse:e=>lr.parse(e)/100,transform:e=>lr.transform(e*100)},QM={borderWidth:Ee,borderTopWidth:Ee,borderRightWidth:Ee,borderBottomWidth:Ee,borderLeftWidth:Ee,borderRadius:Ee,radius:Ee,borderTopLeftRadius:Ee,borderTopRightRadius:Ee,borderBottomRightRadius:Ee,borderBottomLeftRadius:Ee,width:Ee,maxWidth:Ee,height:Ee,maxHeight:Ee,top:Ee,right:Ee,bottom:Ee,left:Ee,padding:Ee,paddingTop:Ee,paddingRight:Ee,paddingBottom:Ee,paddingLeft:Ee,margin:Ee,marginTop:Ee,marginRight:Ee,marginBottom:Ee,marginLeft:Ee,backgroundPositionX:Ee,backgroundPositionY:Ee},JM={rotate:Vr,rotateX:Vr,rotateY:Vr,rotateZ:Vr,scale:kl,scaleX:kl,scaleY:kl,scaleZ:kl,skew:Vr,skewX:Vr,skewY:Vr,distance:Ee,translateX:Ee,translateY:Ee,translateZ:Ee,x:Ee,y:Ee,z:Ee,perspective:Ee,transformPerspective:Ee,opacity:Co,originX:Sx,originY:Sx,originZ:Ee},jx={...aa,transform:Math.round},cm={...QM,...JM,zIndex:jx,size:Ee,fillOpacity:Co,strokeOpacity:Co,numOctaves:jx},ZM={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},eI=ia.length;function tI(e,t,n){let r="",s=!0;for(let i=0;i<eI;i++){const o=ia[i],l=e[o];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(o.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=vk(l,cm[o]);if(!c){s=!1;const f=ZM[o]||o;r+=`${f}(${u}) `}n&&(t[o]=u)}}return r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function um(e,t,n){const{style:r,vars:s,transformOrigin:i}=e;let o=!1,l=!1;for(const c in t){const u=t[c];if(ni.has(c)){o=!0;continue}else if(yk(c)){s[c]=u;continue}else{const f=vk(u,cm[c]);c.startsWith("origin")?(l=!0,i[c]=f):r[c]=f}}if(t.transform||(o||n?r.transform=tI(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:f=0}=i;r.transformOrigin=`${c} ${u} ${f}`}}const nI={offset:"stroke-dashoffset",array:"stroke-dasharray"},rI={offset:"strokeDashoffset",array:"strokeDasharray"};function sI(e,t,n=1,r=0,s=!0){e.pathLength=1;const i=s?nI:rI;e[i.offset]=Ee.transform(-r);const o=Ee.transform(t),l=Ee.transform(n);e[i.array]=`${o} ${l}`}function Nx(e,t,n){return typeof e=="string"?e:Ee.transform(t+n*e)}function iI(e,t,n){const r=Nx(t,e.x,e.width),s=Nx(n,e.y,e.height);return`${r} ${s}`}function dm(e,{attrX:t,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:l=1,pathOffset:c=0,...u},f,d){if(um(e,u,d),f){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:x}=e;h.transform&&(x&&(p.transform=h.transform),delete h.transform),x&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=iI(x,s!==void 0?s:.5,i!==void 0?i:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),o!==void 0&&sI(h,o,l,c,!1)}const fm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),bk=()=>({...fm(),attrs:{}}),hm=e=>typeof e=="string"&&e.toLowerCase()==="svg";function wk(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const kk=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Sk(e,t,n,r){wk(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(kk.has(s)?s:sm(s),t.attrs[s])}const Tc={};function aI(e){Object.assign(Tc,e)}function jk(e,{layout:t,layoutId:n}){return ni.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Tc[e]||e==="opacity")}function pm(e,t,n){var r;const{style:s}=e,i={};for(const o in s)(Xt(s[o])||t.style&&Xt(t.style[o])||jk(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function Nk(e,t,n){const r=pm(e,t,n);for(const s in e)if(Xt(e[s])||Xt(t[s])){const i=ia.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function oI(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Cx=["x","y","width","height","cx","cy","r"],lI={useVisualState:gk({scrapeMotionValuesFromProps:Nk,createRenderState:bk,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const l in s)if(ni.has(l)){i=!0;break}}if(!i)return;let o=!t;if(t)for(let l=0;l<Cx.length;l++){const c=Cx[l];e[c]!==t[c]&&(o=!0)}o&&dt.read(()=>{oI(n,r),dt.render(()=>{dm(r,s,hm(n.tagName),e.transformTemplate),Sk(n,r)})})}})},cI={useVisualState:gk({scrapeMotionValuesFromProps:pm,createRenderState:fm})};function Ck(e,t,n){for(const r in t)!Xt(t[r])&&!jk(r,n)&&(e[r]=t[r])}function uI({transformTemplate:e},t){return g.useMemo(()=>{const n=fm();return um(n,t,e),Object.assign({},n.vars,n.style)},[t])}function dI(e,t){const n=e.style||{},r={};return Ck(r,n,e),Object.assign(r,uI(e,t)),r}function fI(e,t){const n={},r=dI(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function hI(e,t,n,r){const s=g.useMemo(()=>{const i=bk();return dm(i,t,hm(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Ck(i,e.style,e),s.style={...i,...s.style}}return s}function pI(e=!1){return(n,r,s,{latestValues:i},o)=>{const c=(am(n)?hI:fI)(r,i,o,n),u=PM(r,typeof n=="string",e),f=n!==g.Fragment?{...u,...c,ref:s}:{},{children:d}=r,h=g.useMemo(()=>Xt(d)?d.get():d,[d]);return g.createElement(n,{...f,children:h})}}function mI(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const o={...am(r)?lI:cI,preloadedFeatures:e,useRender:pI(s),createVisualElement:t,Component:r};return OM(o)}}function Ek(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function gu(e,t,n){const r=e.getProps();return om(r,t,n!==void 0?n:r.custom,e)}const gI=tm(()=>window.ScrollTimeline!==void 0);class xI{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t,n){const r=this.animations.map(s=>{if(gI()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;n<this.animations.length;n++)t=Math.max(t,this.animations[n].duration);return t}runAll(t){this.animations.forEach(n=>n[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class yI extends xI{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function mm(e,t){return e?e[t]||e.default||e:void 0}const Zf=2e4;function Tk(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Zf;)t+=n,r=e.next(t);return t>=Zf?1/0:t}function gm(e){return typeof e=="function"}function Ex(e,t){e.timeline=t,e.onfinish=null}const xm=e=>Array.isArray(e)&&typeof e[0]=="number",vI={linearEasing:void 0};function bI(e,t){const n=tm(e);return()=>{var r;return(r=vI[t])!==null&&r!==void 0?r:n()}}const Pc=bI(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Pk=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i<s;i++)r+=e(Yi(0,s-1,i))+", ";return`linear(${r.substring(0,r.length-2)})`};function Ak(e){return!!(typeof e=="function"&&Pc()||!e||typeof e=="string"&&(e in eh||Pc())||xm(e)||Array.isArray(e)&&e.every(Ak))}const La=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,eh={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:La([0,.65,.55,1]),circOut:La([.55,0,1,.45]),backIn:La([.31,.01,.66,-.59]),backOut:La([.33,1.53,.69,.99])};function Dk(e,t){if(e)return typeof e=="function"&&Pc()?Pk(e,t):xm(e)?La(e):Array.isArray(e)?e.map(n=>Dk(n,t)||eh.easeOut):eh[e]}const Un={x:!1,y:!1};function Lk(){return Un.x||Un.y}function wI(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function Mk(e,t){const n=wI(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function Tx(e){return t=>{t.pointerType==="touch"||Lk()||e(t)}}function kI(e,t,n={}){const[r,s,i]=Mk(e,n),o=Tx(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const f=Tx(d=>{u(d),c.removeEventListener("pointerleave",f)});c.addEventListener("pointerleave",f,s)});return r.forEach(l=>{l.addEventListener("pointerenter",o,s)}),i}const Ik=(e,t)=>t?e===t?!0:Ik(e,t.parentElement):!1,ym=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,SI=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function jI(e){return SI.has(e.tagName)||e.tabIndex!==-1}const Ma=new WeakSet;function Px(e){return t=>{t.key==="Enter"&&e(t)}}function vd(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const NI=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Px(()=>{if(Ma.has(n))return;vd(n,"down");const s=Px(()=>{vd(n,"up")}),i=()=>vd(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Ax(e){return ym(e)&&!Lk()}function CI(e,t,n={}){const[r,s,i]=Mk(e,n),o=l=>{const c=l.currentTarget;if(!Ax(l)||Ma.has(c))return;Ma.add(c);const u=t(l),f=(p,x)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",h),!(!Ax(p)||!Ma.has(c))&&(Ma.delete(c),typeof u=="function"&&u(p,{success:x}))},d=p=>{f(p,n.useGlobalTarget||Ik(c,p.target))},h=p=>{f(p,!1)};window.addEventListener("pointerup",d,s),window.addEventListener("pointercancel",h,s)};return r.forEach(l=>{!jI(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),l.addEventListener("focus",u=>NI(u,s),s)}),i}function EI(e){return e==="x"||e==="y"?Un[e]?null:(Un[e]=!0,()=>{Un[e]=!1}):Un.x||Un.y?null:(Un.x=Un.y=!0,()=>{Un.x=Un.y=!1})}const Rk=new Set(["width","height","top","left","right","bottom",...ia]);let Wl;function TI(){Wl=void 0}const cr={now:()=>(Wl===void 0&&cr.set(Bt.isProcessing||SM.useManualTiming?Bt.timestamp:performance.now()),Wl),set:e=>{Wl=e,queueMicrotask(TI)}};function vm(e,t){e.indexOf(t)===-1&&e.push(t)}function bm(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class wm{constructor(){this.subscriptions=[]}add(t){return vm(this.subscriptions,t),()=>bm(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function _k(e,t){return t?e*(1e3/t):0}const Dx=30,PI=e=>!isNaN(parseFloat(e));class AI{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=cr.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=cr.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=PI(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new wm);const r=this.events[t].add(n);return t==="change"?()=>{r(),dt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=cr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Dx)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Dx);return _k(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Eo(e,t){return new AI(e,t)}function DI(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Eo(n))}function LI(e,t){const n=gu(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=HM(i[o]);DI(e,o,l)}}function MI(e){return!!(Xt(e)&&e.add)}function th(e,t){const n=e.getValue("willChange");if(MI(n))return n.add(t)}function Fk(e){return e.props[hk]}const Ok=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,II=1e-7,RI=12;function _I(e,t,n,r,s){let i,o,l=0;do o=t+(n-t)/2,i=Ok(o,r,s)-e,i>0?n=o:t=o;while(Math.abs(i)>II&&++l<RI);return o}function Ho(e,t,n,r){if(e===t&&n===r)return jn;const s=i=>_I(i,0,1,e,n);return i=>i===0||i===1?i:Ok(s(i),t,r)}const zk=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Vk=e=>t=>1-e(1-t),Bk=Ho(.33,1.53,.69,.99),km=Vk(Bk),Uk=zk(km),$k=e=>(e*=2)<1?.5*km(e):.5*(2-Math.pow(2,-10*(e-1))),Sm=e=>1-Math.sin(Math.acos(e)),Hk=Vk(Sm),Wk=zk(Sm),Kk=e=>/^0[^.\s]+$/u.test(e);function FI(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Kk(e):!0}const Ga=e=>Math.round(e*1e5)/1e5,jm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function OI(e){return e==null}const zI=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Nm=(e,t)=>n=>!!(typeof n=="string"&&zI.test(n)&&n.startsWith(e)||t&&!OI(n)&&Object.prototype.hasOwnProperty.call(n,t)),Gk=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(jm);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},VI=e=>Pr(0,255,e),bd={...aa,transform:e=>Math.round(VI(e))},_s={test:Nm("rgb","red"),parse:Gk("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+bd.transform(e)+", "+bd.transform(t)+", "+bd.transform(n)+", "+Ga(Co.transform(r))+")"};function BI(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const nh={test:Nm("#"),parse:BI,transform:_s.transform},ji={test:Nm("hsl","hue"),parse:Gk("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+lr.transform(Ga(t))+", "+lr.transform(Ga(n))+", "+Ga(Co.transform(r))+")"},Kt={test:e=>_s.test(e)||nh.test(e)||ji.test(e),parse:e=>_s.test(e)?_s.parse(e):ji.test(e)?ji.parse(e):nh.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?_s.transform(e):ji.transform(e)},UI=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $I(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(jm))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(UI))===null||n===void 0?void 0:n.length)||0)>0}const qk="number",Yk="color",HI="var",WI="var(",Lx="${}",KI=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function To(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=t.replace(KI,c=>(Kt.test(c)?(r.color.push(i),s.push(Yk),n.push(Kt.parse(c))):c.startsWith(WI)?(r.var.push(i),s.push(HI),n.push(c)):(r.number.push(i),s.push(qk),n.push(parseFloat(c))),++i,Lx)).split(Lx);return{values:n,split:l,indexes:r,types:s}}function Xk(e){return To(e).values}function Qk(e){const{split:t,types:n}=To(e),r=t.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=t[o],s[o]!==void 0){const l=n[o];l===qk?i+=Ga(s[o]):l===Yk?i+=Kt.transform(s[o]):i+=s[o]}return i}}const GI=e=>typeof e=="number"?0:e;function qI(e){const t=Xk(e);return Qk(e)(t.map(GI))}const us={test:$I,parse:Xk,createTransformer:Qk,getAnimatableNone:qI},YI=new Set(["brightness","contrast","saturate","opacity"]);function XI(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(jm)||[];if(!r)return e;const s=n.replace(r,"");let i=YI.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const QI=/\b([a-z-]*)\(.*?\)/gu,rh={...us,getAnimatableNone:e=>{const t=e.match(QI);return t?t.map(XI).join(" "):e}},JI={...cm,color:Kt,backgroundColor:Kt,outlineColor:Kt,fill:Kt,stroke:Kt,borderColor:Kt,borderTopColor:Kt,borderRightColor:Kt,borderBottomColor:Kt,borderLeftColor:Kt,filter:rh,WebkitFilter:rh},Cm=e=>JI[e];function Jk(e,t){let n=Cm(e);return n!==rh&&(n=us),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const ZI=new Set(["auto","none","0"]);function eR(e,t,n){let r=0,s;for(;r<e.length&&!s;){const i=e[r];typeof i=="string"&&!ZI.has(i)&&To(i).values.length&&(s=e[r]),r++}if(s&&n)for(const i of t)e[i]=Jk(n,s)}const Mx=e=>e===aa||e===Ee,Ix=(e,t)=>parseFloat(e.split(", ")[t]),Rx=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return Ix(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?Ix(i[1],e):0}},tR=new Set(["x","y","z"]),nR=ia.filter(e=>!tR.has(e));function rR(e){const t=[];return nR.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Qi={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Rx(4,13),y:Rx(5,14)};Qi.translateX=Qi.x;Qi.translateY=Qi.y;const Vs=new Set;let sh=!1,ih=!1;function Zk(){if(ih){const e=Array.from(Vs).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=rR(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))===null||l===void 0||l.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}ih=!1,sh=!1,Vs.forEach(e=>e.complete()),Vs.clear()}function eS(){Vs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ih=!0)})}function sR(){eS(),Zk()}class Em{constructor(t,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Vs.add(this),sh||(sh=!0,dt.read(eS),dt.resolveKeyframes(Zk))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i<t.length;i++)if(t[i]===null)if(i===0){const o=s==null?void 0:s.get(),l=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const c=r.readValue(n,l);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=l),s&&o===void 0&&s.set(t[0])}else t[i]=t[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Vs.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Vs.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const tS=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),iR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function aR(e){const t=iR.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function nS(e,t,n=1){const[r,s]=aR(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const o=i.trim();return tS(o)?parseFloat(o):o}return lm(s)?nS(s,t,n+1):s}const rS=e=>t=>t.test(e),oR={test:e=>e==="auto",parse:e=>e},sS=[aa,Ee,lr,Vr,XM,YM,oR],_x=e=>sS.find(rS(e));class iS extends Em{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let u=t[c];if(typeof u=="string"&&(u=u.trim(),lm(u))){const f=nS(u,n.current);f!==void 0&&(t[c]=f),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Rk.has(r)||t.length!==2)return;const[s,i]=t,o=_x(s),l=_x(i);if(o!==l)if(Mx(o)&&Mx(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)FI(t[s])&&r.push(s);r.length&&eR(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Qi[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&t.getValue(r,s).jump(s,!1)}measureEndState(){var t;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,l=s[o];s[o]=Qi[r](n.measureViewportBox(),window.getComputedStyle(n.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),!((t=this.removedTransforms)===null||t===void 0)&&t.length&&this.removedTransforms.forEach(([c,u])=>{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const Fx=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(us.test(e)||e==="0")&&!e.startsWith("url("));function lR(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function cR(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=Fx(s,t),l=Fx(i,t);return!o||!l?!1:lR(e)||(n==="spring"||gm(n))&&r}const uR=e=>e!==null;function xu(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(uR),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const dR=40;class aS{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=cr.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>dR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&sR(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=cr.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!cR(t,r,s,i))if(o)this.options.duration=0;else{c&&c(xu(t,this.options,n)),l&&l(),this.resolveFinishedPromise();return}const f=this.initPlayback(t,n);f!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...f},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const gt=(e,t,n)=>e+(t-e)*n;function wd(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function fR({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,o=0;if(!t)s=i=o=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;s=wd(c,l,e+1/3),i=wd(c,l,e),o=wd(c,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Ac(e,t){return n=>n>0?t:e}const kd=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},hR=[nh,_s,ji],pR=e=>hR.find(t=>t.test(e));function Ox(e){const t=pR(e);if(!t)return!1;let n=t.parse(e);return t===ji&&(n=fR(n)),n}const zx=(e,t)=>{const n=Ox(e),r=Ox(t);if(!n||!r)return Ac(e,t);const s={...n};return i=>(s.red=kd(n.red,r.red,i),s.green=kd(n.green,r.green,i),s.blue=kd(n.blue,r.blue,i),s.alpha=gt(n.alpha,r.alpha,i),_s.transform(s))},mR=(e,t)=>n=>t(e(n)),Wo=(...e)=>e.reduce(mR),ah=new Set(["none","hidden"]);function gR(e,t){return ah.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function xR(e,t){return n=>gt(e,t,n)}function Tm(e){return typeof e=="number"?xR:typeof e=="string"?lm(e)?Ac:Kt.test(e)?zx:bR:Array.isArray(e)?oS:typeof e=="object"?Kt.test(e)?zx:yR:Ac}function oS(e,t){const n=[...e],r=n.length,s=e.map((i,o)=>Tm(i)(i,t[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function yR(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Tm(e[s])(e[s],t[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function vR(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],l=e.indexes[o][s[o]],c=(n=e.values[l])!==null&&n!==void 0?n:0;r[i]=c,s[o]++}return r}const bR=(e,t)=>{const n=us.createTransformer(t),r=To(e),s=To(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?ah.has(e)&&!s.values.length||ah.has(t)&&!r.values.length?gR(e,t):Wo(oS(vR(r,s),s.values),n):Ac(e,t)};function lS(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?gt(e,t,n):Tm(e)(e,t)}const wR=5;function cS(e,t,n){const r=Math.max(t-wR,0);return _k(n-e(r),t-r)}const wt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Sd=.001;function kR({duration:e=wt.duration,bounce:t=wt.bounce,velocity:n=wt.velocity,mass:r=wt.mass}){let s,i,o=1-t;o=Pr(wt.minDamping,wt.maxDamping,o),e=Pr(wt.minDuration,wt.maxDuration,Sr(e)),o<1?(s=u=>{const f=u*o,d=f*e,h=f-n,p=oh(u,o),x=Math.exp(-d);return Sd-h/p*x},i=u=>{const d=u*o*e,h=d*n+n,p=Math.pow(o,2)*Math.pow(u,2)*e,x=Math.exp(-d),b=oh(Math.pow(u,2),o);return(-s(u)+Sd>0?-1:1)*((h-p)*x)/b}):(s=u=>{const f=Math.exp(-u*e),d=(u-n)*e+1;return-Sd+f*d},i=u=>{const f=Math.exp(-u*e),d=(n-u)*(e*e);return f*d});const l=5/e,c=jR(s,i,l);if(e=kr(e),isNaN(c))return{stiffness:wt.stiffness,damping:wt.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const SR=12;function jR(e,t,n){let r=n;for(let s=1;s<SR;s++)r=r-e(r)/t(r);return r}function oh(e,t){return e*Math.sqrt(1-t*t)}const NR=["duration","bounce"],CR=["stiffness","damping","mass"];function Vx(e,t){return t.some(n=>e[n]!==void 0)}function ER(e){let t={velocity:wt.velocity,stiffness:wt.stiffness,damping:wt.damping,mass:wt.mass,isResolvedFromDuration:!1,...e};if(!Vx(e,CR)&&Vx(e,NR))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Pr(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:wt.mass,stiffness:s,damping:i}}else{const n=kR(e);t={...t,...n,mass:wt.mass},t.isResolvedFromDuration=!0}return t}function uS(e=wt.visualDuration,t=wt.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:u,mass:f,duration:d,velocity:h,isResolvedFromDuration:p}=ER({...n,velocity:-Sr(n.velocity||0)}),x=h||0,b=u/(2*Math.sqrt(c*f)),k=o-i,v=Sr(Math.sqrt(c/f)),m=Math.abs(k)<5;r||(r=m?wt.restSpeed.granular:wt.restSpeed.default),s||(s=m?wt.restDelta.granular:wt.restDelta.default);let y;if(b<1){const S=oh(v,b);y=N=>{const w=Math.exp(-b*v*N);return o-w*((x+b*v*k)/S*Math.sin(S*N)+k*Math.cos(S*N))}}else if(b===1)y=S=>o-Math.exp(-v*S)*(k+(x+v*k)*S);else{const S=v*Math.sqrt(b*b-1);y=N=>{const w=Math.exp(-b*v*N),C=Math.min(S*N,300);return o-w*((x+b*v*k)*Math.sinh(C)+S*k*Math.cosh(C))/S}}const j={calculatedDuration:p&&d||null,next:S=>{const N=y(S);if(p)l.done=S>=d;else{let w=0;b<1&&(w=S===0?kr(x):cS(y,S,N));const C=Math.abs(w)<=r,D=Math.abs(o-N)<=s;l.done=C&&D}return l.value=l.done?o:N,l},toString:()=>{const S=Math.min(Tk(j),Zf),N=Pk(w=>j.next(S*w).value,S,30);return S+"ms "+N}};return j}function Bx({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:f}){const d=e[0],h={done:!1,value:d},p=C=>l!==void 0&&C<l||c!==void 0&&C>c,x=C=>l===void 0?c:c===void 0||Math.abs(l-C)<Math.abs(c-C)?l:c;let b=n*t;const k=d+b,v=o===void 0?k:o(k);v!==k&&(b=v-d);const m=C=>-b*Math.exp(-C/r),y=C=>v+m(C),j=C=>{const D=m(C),T=y(C);h.done=Math.abs(D)<=u,h.value=h.done?v:T};let S,N;const w=C=>{p(h.value)&&(S=C,N=uS({keyframes:[h.value,x(h.value)],velocity:cS(y,C,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:f}))};return w(0),{calculatedDuration:null,next:C=>{let D=!1;return!N&&S===void 0&&(D=!0,j(C),w(C)),S!==void 0&&C>=S?N.next(C-S):(!D&&j(C),h)}}}const TR=Ho(.42,0,1,1),PR=Ho(0,0,.58,1),dS=Ho(.42,0,.58,1),AR=e=>Array.isArray(e)&&typeof e[0]!="number",DR={linear:jn,easeIn:TR,easeInOut:dS,easeOut:PR,circIn:Sm,circInOut:Wk,circOut:Hk,backIn:km,backInOut:Uk,backOut:Bk,anticipate:$k},Ux=e=>{if(xm(e)){lk(e.length===4);const[t,n,r,s]=e;return Ho(t,n,r,s)}else if(typeof e=="string")return DR[e];return e};function LR(e,t,n){const r=[],s=n||lS,i=e.length-1;for(let o=0;o<i;o++){let l=s(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||jn:t;l=Wo(c,l)}r.push(l)}return r}function MR(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const i=e.length;if(lk(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=LR(t,r,s),c=l.length,u=f=>{if(o&&f<e[0])return t[0];let d=0;if(c>1)for(;d<e.length-2&&!(f<e[d+1]);d++);const h=Yi(e[d],e[d+1],f);return l[d](h)};return n?f=>u(Pr(e[0],e[i-1],f)):u}function IR(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Yi(0,t,r);e.push(gt(n,1,s))}}function RR(e){const t=[0];return IR(t,e.length-1),t}function _R(e,t){return e.map(n=>n*t)}function FR(e,t){return e.map(()=>t||dS).splice(0,e.length-1)}function Dc({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=AR(r)?r.map(Ux):Ux(r),i={done:!1,value:t[0]},o=_R(n&&n.length===t.length?n:RR(t),e),l=MR(o,t,{ease:Array.isArray(s)?s:FR(t,s)});return{calculatedDuration:e,next:c=>(i.value=l(c),i.done=c>=e,i)}}const OR=e=>{const t=({timestamp:n})=>e(n);return{start:()=>dt.update(t,!0),stop:()=>cs(t),now:()=>Bt.isProcessing?Bt.timestamp:cr.now()}},zR={decay:Bx,inertia:Bx,tween:Dc,keyframes:Dc,spring:uS},VR=e=>e/100;class Pm extends aS{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,o=(s==null?void 0:s.KeyframeResolver)||Em,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new o(i,l,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,l=gm(n)?n:zR[n]||Dc;let c,u;l!==Dc&&typeof t[0]!="number"&&(c=Wo(VR,lS(t[0],t[1])),t=[0,100]);const f=l({...this.options,keyframes:t});i==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-o})),f.calculatedDuration===null&&(f.calculatedDuration=Tk(f));const{calculatedDuration:d}=f,h=d+s,p=h*(r+1)-s;return{generator:f,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:d,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:C}=this.options;return{done:!0,value:C[C.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:f,resolvedDuration:d}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:x,repeatDelay:b,onUpdate:k}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-f/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-h*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>f;this.currentTime=Math.max(v,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=f);let y=this.currentTime,j=i;if(p){const C=Math.min(this.currentTime,f)/d;let D=Math.floor(C),T=C%1;!T&&C>=1&&(T=1),T===1&&D--,D=Math.min(D,p+1),!!(D%2)&&(x==="reverse"?(T=1-T,b&&(T-=b/d)):x==="mirror"&&(j=o)),y=Pr(0,1,T)*d}const S=m?{done:!1,value:c[0]}:j.next(y);l&&(S.value=l(S.value));let{done:N}=S;!m&&u!==null&&(N=this.speed>=0?this.currentTime>=f:this.currentTime<=0);const w=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return w&&s!==void 0&&(S.value=xu(c,this.options,s)),k&&k(S.value),w&&this.finish(),S}get duration(){const{resolved:t}=this;return t?Sr(t.calculatedDuration):0}get time(){return Sr(this.currentTime)}set time(t){t=kr(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Sr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=OR,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const BR=new Set(["opacity","clipPath","filter","transform"]);function UR(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const f=Dk(l,s);return Array.isArray(f)&&(u.easing=f),e.animate(u,{delay:r,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const $R=tm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Lc=10,HR=2e4;function WR(e){return gm(e.type)||e.type==="spring"||!Ak(e.ease)}function KR(e,t){const n=new Pm({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&i<HR;)r=n.sample(i),s.push(r.value),i+=Lc;return{times:void 0,keyframes:s,duration:i-Lc,ease:"linear"}}const fS={anticipate:$k,backInOut:Uk,circInOut:Wk};function GR(e){return e in fS}class $x extends aS{constructor(t){super(t);const{name:n,motionValue:r,element:s,keyframes:i}=this.options;this.resolver=new iS(i,(o,l)=>this.onKeyframesResolved(o,l),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:o,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof i=="string"&&Pc()&&GR(i)&&(i=fS[i]),WR(this.options)){const{onComplete:d,onUpdate:h,motionValue:p,element:x,...b}=this.options,k=KR(t,b);t=k.keyframes,t.length===1&&(t[1]=t[0]),r=k.duration,s=k.times,i=k.ease,o="keyframes"}const f=UR(l.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return f.startTime=u??this.calcStartTime(),this.pendingTimeline?(Ex(f,this.pendingTimeline),this.pendingTimeline=void 0):f.onfinish=()=>{const{onComplete:d}=this.options;l.set(xu(t,this.options,n)),d&&d(),this.cancel(),this.resolveFinishedPromise()},{animation:f,duration:r,times:s,type:o,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Sr(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Sr(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=kr(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return jn;const{animation:r}=n;Ex(r,t)}return jn}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:f,onComplete:d,element:h,...p}=this.options,x=new Pm({...p,keyframes:r,duration:s,type:i,ease:o,times:l,isGenerator:!0}),b=kr(this.time);u.setWithVelocity(x.sample(b-Lc).value,x.sample(b).value,Lc)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return $R()&&r&&BR.has(r)&&!c&&!u&&!s&&i!=="mirror"&&o!==0&&l!=="inertia"}}const qR={type:"spring",stiffness:500,damping:25,restSpeed:10},YR=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),XR={type:"keyframes",duration:.8},QR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},JR=(e,{keyframes:t})=>t.length>2?XR:ni.has(e)?e.startsWith("scale")?YR(t[1]):qR:QR;function ZR({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:u,...f}){return!!Object.keys(f).length}const Am=(e,t,n,r={},s,i)=>o=>{const l=mm(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-kr(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:i?void 0:s};ZR(l)||(f={...f,...JR(e,f)}),f.duration&&(f.duration=kr(f.duration)),f.repeatDelay&&(f.repeatDelay=kr(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let d=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(f.duration=0,f.delay===0&&(d=!0)),d&&!i&&t.get()!==void 0){const h=xu(f.keyframes,l);if(h!==void 0)return dt.update(()=>{f.onUpdate(h),f.onComplete()}),new yI([])}return!i&&$x.supports(f)?new $x(f):new Pm(f)};function e_({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function hS(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=e.getDefaultTransition(),transitionEnd:l,...c}=t;r&&(o=r);const u=[],f=s&&e.animationState&&e.animationState.getState()[s];for(const d in c){const h=e.getValue(d,(i=e.latestValues[d])!==null&&i!==void 0?i:null),p=c[d];if(p===void 0||f&&e_(f,d))continue;const x={delay:n,...mm(o||{},d)};let b=!1;if(window.MotionHandoffAnimation){const v=Fk(e);if(v){const m=window.MotionHandoffAnimation(v,d,dt);m!==null&&(x.startTime=m,b=!0)}}th(e,d),h.start(Am(d,h,p,e.shouldReduceMotion&&Rk.has(d)?{type:!1}:x,e,b));const k=h.animation;k&&u.push(k)}return l&&Promise.all(u).then(()=>{dt.update(()=>{l&&LI(e,l)})}),u}function lh(e,t,n={}){var r;const s=gu(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(hS(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:f=0,staggerChildren:d,staggerDirection:h}=i;return t_(e,t,f+u,d,h,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,f]=c==="beforeChildren"?[o,l]:[l,o];return u().then(()=>f())}else return Promise.all([o(),l(n.delay)])}function t_(e,t,n=0,r=0,s=1,i){const o=[],l=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(e.variantChildren).sort(n_).forEach((u,f)=>{u.notify("AnimationStart",t),o.push(lh(u,t,{...i,delay:n+c(f)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function n_(e,t){return e.sortNodePosition(t)}function r_(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>lh(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=lh(e,t,n);else{const s=typeof t=="function"?gu(e,t,n.custom):t;r=Promise.all(hS(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const s_=rm.length;function pS(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?pS(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<s_;n++){const r=rm[n],s=e.props[r];(No(s)||s===!1)&&(t[r]=s)}return t}const i_=[...nm].reverse(),a_=nm.length;function o_(e){return t=>Promise.all(t.map(({animation:n,options:r})=>r_(e,n,r)))}function l_(e){let t=o_(e),n=Hx(),r=!0;const s=c=>(u,f)=>{var d;const h=gu(e,f,c==="exit"?(d=e.presenceContext)===null||d===void 0?void 0:d.custom:void 0);if(h){const{transition:p,transitionEnd:x,...b}=h;u={...u,...b,...x}}return u};function i(c){t=c(e)}function o(c){const{props:u}=e,f=pS(e.parent)||{},d=[],h=new Set;let p={},x=1/0;for(let k=0;k<a_;k++){const v=i_[k],m=n[v],y=u[v]!==void 0?u[v]:f[v],j=No(y),S=v===c?m.isActive:null;S===!1&&(x=k);let N=y===f[v]&&y!==u[v]&&j;if(N&&r&&e.manuallyAnimateOnMount&&(N=!1),m.protectedKeys={...p},!m.isActive&&S===null||!y&&!m.prevProp||pu(y)||typeof y=="boolean")continue;const w=c_(m.prevProp,y);let C=w||v===c&&m.isActive&&!N&&j||k>x&&j,D=!1;const T=Array.isArray(y)?y:[y];let M=T.reduce(s(v),{});S===!1&&(M={});const{prevResolvedValues:P={}}=m,F={...P,...M},z=ee=>{C=!0,h.has(ee)&&(D=!0,h.delete(ee)),m.needsAnimating[ee]=!0;const R=e.getValue(ee);R&&(R.liveStyle=!1)};for(const ee in F){const R=M[ee],V=P[ee];if(p.hasOwnProperty(ee))continue;let E=!1;Jf(R)&&Jf(V)?E=!Ek(R,V):E=R!==V,E?R!=null?z(ee):h.add(ee):R!==void 0&&h.has(ee)?z(ee):m.protectedKeys[ee]=!0}m.prevProp=y,m.prevResolvedValues=M,m.isActive&&(p={...p,...M}),r&&e.blockInitialAnimation&&(C=!1),C&&(!(N&&w)||D)&&d.push(...T.map(ee=>({animation:ee,options:{type:v}})))}if(h.size){const k={};h.forEach(v=>{const m=e.getBaseTarget(v),y=e.getValue(v);y&&(y.liveStyle=!0),k[v]=m??null}),d.push({animation:k})}let b=!!d.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),r=!1,b?t(d):Promise.resolve()}function l(c,u){var f;if(n[c].isActive===u)return Promise.resolve();(f=e.variantChildren)===null||f===void 0||f.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const d=o(c);for(const h in n)n[h].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=Hx(),r=!0}}}function c_(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Ek(t,e):!1}function Ss(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Hx(){return{animate:Ss(!0),whileInView:Ss(),whileHover:Ss(),whileTap:Ss(),whileDrag:Ss(),whileFocus:Ss(),exit:Ss()}}class xs{constructor(t){this.isMounted=!1,this.node=t}update(){}}class u_ extends xs{constructor(t){super(t),t.animationState||(t.animationState=l_(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();pu(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let d_=0;class f_ extends xs{constructor(){super(...arguments),this.id=d_++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const h_={animation:{Feature:u_},exit:{Feature:f_}};function Po(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Ko(e){return{point:{x:e.pageX,y:e.pageY}}}const p_=e=>t=>ym(t)&&e(t,Ko(t));function qa(e,t,n,r){return Po(e,t,p_(n),r)}const Wx=(e,t)=>Math.abs(e-t);function m_(e,t){const n=Wx(e.x,t.x),r=Wx(e.y,t.y);return Math.sqrt(n**2+r**2)}class mS{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const d=Nd(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=m_(d.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:x}=d,{timestamp:b}=Bt;this.history.push({...x,timestamp:b});const{onStart:k,onMove:v}=this.handlers;h||(k&&k(this.lastMoveEvent,d),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,d)},this.handlePointerMove=(d,h)=>{this.lastMoveEvent=d,this.lastMoveEventInfo=jd(h,this.transformPagePoint),dt.update(this.updatePoint,!0)},this.handlePointerUp=(d,h)=>{this.end();const{onEnd:p,onSessionEnd:x,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Nd(d.type==="pointercancel"?this.lastMoveEventInfo:jd(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(d,k),x&&x(d,k)},!ym(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=Ko(t),l=jd(o,this.transformPagePoint),{point:c}=l,{timestamp:u}=Bt;this.history=[{...c,timestamp:u}];const{onSessionStart:f}=n;f&&f(t,Nd(l,this.history)),this.removeListeners=Wo(qa(this.contextWindow,"pointermove",this.handlePointerMove),qa(this.contextWindow,"pointerup",this.handlePointerUp),qa(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),cs(this.updatePoint)}}function jd(e,t){return t?{point:t(e.point)}:e}function Kx(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Nd({point:e},t){return{point:e,delta:Kx(e,gS(t)),offset:Kx(e,g_(t)),velocity:x_(t,.1)}}function g_(e){return e[0]}function gS(e){return e[e.length-1]}function x_(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=gS(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>kr(t)));)n--;if(!r)return{x:0,y:0};const i=Sr(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const xS=1e-4,y_=1-xS,v_=1+xS,yS=.01,b_=0-yS,w_=0+yS;function Cn(e){return e.max-e.min}function k_(e,t,n){return Math.abs(e-t)<=n}function Gx(e,t,n,r=.5){e.origin=r,e.originPoint=gt(t.min,t.max,e.origin),e.scale=Cn(n)/Cn(t),e.translate=gt(n.min,n.max,e.origin)-e.originPoint,(e.scale>=y_&&e.scale<=v_||isNaN(e.scale))&&(e.scale=1),(e.translate>=b_&&e.translate<=w_||isNaN(e.translate))&&(e.translate=0)}function Ya(e,t,n,r){Gx(e.x,t.x,n.x,r?r.originX:void 0),Gx(e.y,t.y,n.y,r?r.originY:void 0)}function qx(e,t,n){e.min=n.min+t.min,e.max=e.min+Cn(t)}function S_(e,t,n){qx(e.x,t.x,n.x),qx(e.y,t.y,n.y)}function Yx(e,t,n){e.min=t.min-n.min,e.max=e.min+Cn(t)}function Xa(e,t,n){Yx(e.x,t.x,n.x),Yx(e.y,t.y,n.y)}function j_(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?gt(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?gt(n,e,r.max):Math.min(e,n)),e}function Xx(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function N_(e,{top:t,left:n,bottom:r,right:s}){return{x:Xx(e.x,n,s),y:Xx(e.y,t,r)}}function Qx(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function C_(e,t){return{x:Qx(e.x,t.x),y:Qx(e.y,t.y)}}function E_(e,t){let n=.5;const r=Cn(e),s=Cn(t);return s>r?n=Yi(t.min,t.max-r,e.min):r>s&&(n=Yi(e.min,e.max-s,t.min)),Pr(0,1,n)}function T_(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ch=.35;function P_(e=ch){return e===!1?e=0:e===!0&&(e=ch),{x:Jx(e,"left","right"),y:Jx(e,"top","bottom")}}function Jx(e,t,n){return{min:Zx(e,t),max:Zx(e,n)}}function Zx(e,t){return typeof e=="number"?e:e[t]||0}const ey=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ni=()=>({x:ey(),y:ey()}),ty=()=>({min:0,max:0}),Nt=()=>({x:ty(),y:ty()});function Dn(e){return[e("x"),e("y")]}function vS({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function A_({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function D_(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Cd(e){return e===void 0||e===1}function uh({scale:e,scaleX:t,scaleY:n}){return!Cd(e)||!Cd(t)||!Cd(n)}function Cs(e){return uh(e)||bS(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function bS(e){return ny(e.x)||ny(e.y)}function ny(e){return e&&e!=="0%"}function Mc(e,t,n){const r=e-n,s=t*r;return n+s}function ry(e,t,n,r,s){return s!==void 0&&(e=Mc(e,s,r)),Mc(e,n,r)+t}function dh(e,t=0,n=1,r,s){e.min=ry(e.min,t,n,r,s),e.max=ry(e.max,t,n,r,s)}function wS(e,{x:t,y:n}){dh(e.x,t.translate,t.scale,t.originPoint),dh(e.y,n.translate,n.scale,n.originPoint)}const sy=.999999999999,iy=1.0000000000001;function L_(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Ei(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,wS(e,o)),r&&Cs(i.latestValues)&&Ei(e,i.latestValues))}t.x<iy&&t.x>sy&&(t.x=1),t.y<iy&&t.y>sy&&(t.y=1)}function Ci(e,t){e.min=e.min+t,e.max=e.max+t}function ay(e,t,n,r,s=.5){const i=gt(e.min,e.max,s);dh(e,t,n,i,r)}function Ei(e,t){ay(e.x,t.x,t.scaleX,t.scale,t.originX),ay(e.y,t.y,t.scaleY,t.scale,t.originY)}function kS(e,t){return vS(D_(e.getBoundingClientRect(),t))}function M_(e,t,n){const r=kS(e,n),{scroll:s}=t;return s&&(Ci(r.x,s.offset.x),Ci(r.y,s.offset.y)),r}const SS=({current:e})=>e?e.ownerDocument.defaultView:null,I_=new WeakMap;class R_{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Nt(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=f=>{const{dragSnapToOrigin:d}=this.getProps();d?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ko(f).point)},i=(f,d)=>{const{drag:h,dragPropagation:p,onDragStart:x}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=EI(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Dn(k=>{let v=this.getAxisMotionValue(k).get()||0;if(lr.test(v)){const{projection:m}=this.visualElement;if(m&&m.layout){const y=m.layout.layoutBox[k];y&&(v=Cn(y)*(parseFloat(v)/100))}}this.originPoint[k]=v}),x&&dt.postRender(()=>x(f,d)),th(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},o=(f,d)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:x,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:k}=d;if(p&&this.currentDirection===null){this.currentDirection=__(k),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",d.point,k),this.updateAxis("y",d.point,k),this.visualElement.render(),b&&b(f,d)},l=(f,d)=>this.stop(f,d),c=()=>Dn(f=>{var d;return this.getAnimationState(f)==="paused"&&((d=this.getAxisMotionValue(f).animation)===null||d===void 0?void 0:d.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new mS(t,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:SS(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&dt.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Sl(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=j_(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&Si(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=N_(s.layoutBox,n):this.constraints=!1,this.elastic=P_(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Dn(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=T_(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Si(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=M_(r,s.root,this.visualElement.getTransformPagePoint());let o=C_(s.layout.layoutBox,i);if(n){const l=n(A_(o));this.hasMutatedConstraints=!!l,l&&(o=vS(l))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Dn(f=>{if(!Sl(f,n,this.currentDirection))return;let d=c&&c[f]||{};o&&(d={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,x={type:"inertia",velocity:r?t[f]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...d};return this.startAxisValueAnimation(f,x)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return th(this.visualElement,t),r.start(Am(t,r,0,n,this.visualElement,!1))}stopAnimation(){Dn(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Dn(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Dn(n=>{const{drag:r}=this.getProps();if(!Sl(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n];i.set(t[n]-gt(o,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Si(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Dn(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=E_({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Dn(o=>{if(!Sl(o,t,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(gt(c,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;I_.set(this.visualElement,this);const t=this.visualElement.current,n=qa(t,"pointerdown",c=>{const{drag:u,dragListener:f=!0}=this.getProps();u&&f&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Si(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),dt.read(r);const o=Po(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Dn(f=>{const d=this.getAxisMotionValue(f);d&&(this.originPoint[f]+=c[f].translate,d.set(d.get()+c[f].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=ch,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function Sl(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function __(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class F_ extends xs{constructor(t){super(t),this.removeGroupControls=jn,this.removeListeners=jn,this.controls=new R_(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||jn}unmount(){this.removeGroupControls(),this.removeListeners()}}const oy=e=>(t,n)=>{e&&dt.postRender(()=>e(t,n))};class O_ extends xs{constructor(){super(...arguments),this.removePointerDownListener=jn}onPointerDown(t){this.session=new mS(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:SS(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:oy(t),onStart:oy(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&dt.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=qa(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Kl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ly(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ja={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ee.test(e))e=parseFloat(e);else return e;const n=ly(e,t.target.x),r=ly(e,t.target.y);return`${n}% ${r}%`}},z_={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=us.parse(e);if(s.length>5)return r;const i=us.createTransformer(e),o=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;s[0+o]/=l,s[1+o]/=c;const u=gt(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class V_ extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;aI(B_),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Kl.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||dt.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),im.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function jS(e){const[t,n]=ak(),r=g.useContext(Qp);return a.jsx(V_,{...e,layoutGroup:r,switchLayoutGroup:g.useContext(pk),isPresent:t,safeToRemove:n})}const B_={borderRadius:{...ja,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ja,borderTopRightRadius:ja,borderBottomLeftRadius:ja,borderBottomRightRadius:ja,boxShadow:z_};function U_(e,t,n){const r=Xt(e)?e:Eo(e);return r.start(Am("",r,t,n)),r.animation}function $_(e){return e instanceof SVGElement&&e.tagName!=="svg"}const H_=(e,t)=>e.depth-t.depth;class W_{constructor(){this.children=[],this.isDirty=!1}add(t){vm(this.children,t),this.isDirty=!0}remove(t){bm(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(H_),this.isDirty=!1,this.children.forEach(t)}}function K_(e,t){const n=cr.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(cs(r),e(i-t))};return dt.read(r,!0),()=>cs(r)}const NS=["TopLeft","TopRight","BottomLeft","BottomRight"],G_=NS.length,cy=e=>typeof e=="string"?parseFloat(e):e,uy=e=>typeof e=="number"||Ee.test(e);function q_(e,t,n,r,s,i){s?(e.opacity=gt(0,n.opacity!==void 0?n.opacity:1,Y_(r)),e.opacityExit=gt(t.opacity!==void 0?t.opacity:1,0,X_(r))):i&&(e.opacity=gt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<G_;o++){const l=`border${NS[o]}Radius`;let c=dy(t,l),u=dy(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||uy(c)===uy(u)?(e[l]=Math.max(gt(cy(c),cy(u),r),0),(lr.test(u)||lr.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=gt(t.rotate||0,n.rotate||0,r))}function dy(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const Y_=CS(0,.5,Hk),X_=CS(.5,.95,jn);function CS(e,t,n){return r=>r<e?0:r>t?1:n(Yi(e,t,r))}function fy(e,t){e.min=t.min,e.max=t.max}function Pn(e,t){fy(e.x,t.x),fy(e.y,t.y)}function hy(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function py(e,t,n,r,s){return e-=t,e=Mc(e,1/n,r),s!==void 0&&(e=Mc(e,1/s,r)),e}function Q_(e,t=0,n=1,r=.5,s,i=e,o=e){if(lr.test(t)&&(t=parseFloat(t),t=gt(o.min,o.max,t/100)-o.min),typeof t!="number")return;let l=gt(i.min,i.max,r);e===i&&(l-=t),e.min=py(e.min,t,n,l,s),e.max=py(e.max,t,n,l,s)}function my(e,t,[n,r,s],i,o){Q_(e,t[n],t[r],t[s],t.scale,i,o)}const J_=["x","scaleX","originX"],Z_=["y","scaleY","originY"];function gy(e,t,n,r){my(e.x,t,J_,n?n.x:void 0,r?r.x:void 0),my(e.y,t,Z_,n?n.y:void 0,r?r.y:void 0)}function xy(e){return e.translate===0&&e.scale===1}function ES(e){return xy(e.x)&&xy(e.y)}function yy(e,t){return e.min===t.min&&e.max===t.max}function e6(e,t){return yy(e.x,t.x)&&yy(e.y,t.y)}function vy(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function TS(e,t){return vy(e.x,t.x)&&vy(e.y,t.y)}function by(e){return Cn(e.x)/Cn(e.y)}function wy(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class t6{constructor(){this.members=[]}add(t){vm(this.members,t),t.scheduleRender()}remove(t){if(bm(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function n6(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:f,rotateX:d,rotateY:h,skewX:p,skewY:x}=n;u&&(r=`perspective(${u}px) ${r}`),f&&(r+=`rotate(${f}deg) `),d&&(r+=`rotateX(${d}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),x&&(r+=`skewY(${x}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const Es={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Ia=typeof window<"u"&&window.MotionDebug!==void 0,Ed=["","X","Y","Z"],r6={visibility:"hidden"},ky=1e3;let s6=0;function Td(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function PS(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Fk(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",dt,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&PS(r)}function AS({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=t==null?void 0:t()){this.id=s6++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Ia&&(Es.totalNodes=Es.resolvedTargetDeltas=Es.recalculatedProjection=0),this.nodes.forEach(o6),this.nodes.forEach(f6),this.nodes.forEach(h6),this.nodes.forEach(l6),Ia&&window.MotionDebug.record(Es)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new W_)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new wm),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,l=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=$_(o),this.instance=o;const{layoutId:c,layout:u,visualElement:f}=this.options;if(f&&!f.current&&f.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),l&&(u||c)&&(this.isLayoutDirty=!0),e){let d;const h=()=>this.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=K_(h,250),Kl.hasAnimatedSinceResize&&(Kl.hasAnimatedSinceResize=!1,this.nodes.forEach(jy))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&f&&(c||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||f.getDefaultTransition()||y6,{onLayoutAnimationStart:k,onLayoutAnimationComplete:v}=f.getProps(),m=!this.targetLayout||!TS(this.targetLayout,x)||p,y=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(m||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,y);const j={...mm(b,"layout"),onPlay:k,onComplete:v};(f.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j)}else h||jy(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,cs(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(p6),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&PS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const d=this.path[f];d.shouldResetTransform=!0,d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Sy);return}this.isUpdating||this.nodes.forEach(u6),this.isUpdating=!1,this.nodes.forEach(d6),this.nodes.forEach(i6),this.nodes.forEach(a6),this.clearAllSnapshots();const l=cr.now();Bt.delta=Pr(0,1e3/60,l-Bt.timestamp),Bt.timestamp=l,Bt.isProcessing=!0,yd.update.process(Bt),yd.preRender.process(Bt),yd.render.process(Bt),Bt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,im.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(c6),this.sharedNodes.forEach(m6)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,dt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){dt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Nt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!ES(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,f=u!==this.prevTransformTemplateValue;o&&(l||Cs(this.latestValues)||f)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),v6(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:l}=this.options;if(!l)return Nt();const c=l.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(b6))){const{scroll:f}=this.root;f&&(Ci(c.x,f.offset.x),Ci(c.y,f.offset.y))}return c}removeElementScroll(o){var l;const c=Nt();if(Pn(c,o),!((l=this.scroll)===null||l===void 0)&&l.wasRoot)return c;for(let u=0;u<this.path.length;u++){const f=this.path[u],{scroll:d,options:h}=f;f!==this.root&&d&&h.layoutScroll&&(d.wasRoot&&Pn(c,o),Ci(c.x,d.offset.x),Ci(c.y,d.offset.y))}return c}applyTransform(o,l=!1){const c=Nt();Pn(c,o);for(let u=0;u<this.path.length;u++){const f=this.path[u];!l&&f.options.layoutScroll&&f.scroll&&f!==f.root&&Ei(c,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),Cs(f.latestValues)&&Ei(c,f.latestValues)}return Cs(this.latestValues)&&Ei(c,this.latestValues),c}removeTransform(o){const l=Nt();Pn(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Cs(u.latestValues))continue;uh(u.latestValues)&&u.updateSnapshot();const f=Nt(),d=u.measurePageBox();Pn(f,d),gy(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,f)}return Cs(this.latestValues)&&gy(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Bt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var l;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((l=this.parent)===null||l===void 0)&&l.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:h}=this.options;if(!(!this.layout||!(d||h))){if(this.resolvedRelativeTargetAt=Bt.timestamp,!this.targetDelta&&!this.relativeTarget){const p=this.getClosestProjectingParent();p&&p.layout&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nt(),this.relativeTargetOrigin=Nt(),Xa(this.relativeTargetOrigin,this.layout.layoutBox,p.layout.layoutBox),Pn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Nt(),this.targetWithTransforms=Nt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),S_(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Pn(this.target,this.layout.layoutBox),wS(this.target,this.targetDelta)):Pn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const p=this.getClosestProjectingParent();p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?(this.relativeParent=p,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Nt(),this.relativeTargetOrigin=Nt(),Xa(this.relativeTargetOrigin,this.target,p.target),Pn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Ia&&Es.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||uh(this.parent.latestValues)||bS(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const l=this.getLead(),c=!!this.resumingFrom||this!==l;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===Bt.timestamp&&(u=!1),u)return;const{layout:f,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(f||d))return;Pn(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,p=this.treeScale.y;L_(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Nt());const{target:x}=l;if(!x){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(hy(this.prevProjectionDelta.x,this.projectionDelta.x),hy(this.prevProjectionDelta.y,this.projectionDelta.y)),Ya(this.projectionDelta,this.layoutCorrected,x,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==p||!wy(this.projectionDelta.x,this.prevProjectionDelta.x)||!wy(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",x)),Ia&&Es.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)===null||l===void 0||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ni(),this.projectionDelta=Ni(),this.projectionDeltaWithTransform=Ni()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},f={...this.latestValues},d=Ni();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const h=Nt(),p=c?c.source:void 0,x=this.layout?this.layout.source:void 0,b=p!==x,k=this.getStack(),v=!k||k.members.length<=1,m=!!(b&&!v&&this.options.crossfade===!0&&!this.path.some(x6));this.animationProgress=0;let y;this.mixTargetDelta=j=>{const S=j/1e3;Ny(d.x,o.x,S),Ny(d.y,o.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Xa(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),g6(this.relativeTarget,this.relativeTargetOrigin,h,S),y&&e6(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=Nt()),Pn(y,this.relativeTarget)),b&&(this.animationValues=f,q_(f,u,this.latestValues,S,m,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(cs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=dt.update(()=>{Kl.hasAnimatedSinceResize=!0,this.currentAnimation=U_(0,ky,{...o,onUpdate:l=>{this.mixTargetDelta(l),o.onUpdate&&o.onUpdate(l)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ky),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:f}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&DS(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Nt();const d=Cn(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+d;const h=Cn(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}Pn(l,c),Ei(l,f),Ya(this.projectionDeltaWithTransform,this.layoutCorrected,l,f)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new t6),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:l}=this.options;return l?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:l}=this.options;return l?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&Td("z",o,u,this.animationValues);for(let f=0;f<Ed.length;f++)Td(`rotate${Ed[f]}`,o,u,this.animationValues),Td(`skew${Ed[f]}`,o,u,this.animationValues);o.render();for(const f in u)o.setStaticValue(f,u[f]),this.animationValues&&(this.animationValues[f]=u[f]);o.scheduleRender()}getProjectionStyles(o){var l,c;if(!this.instance||this.isSVG)return;if(!this.isVisible)return r6;const u={visibility:""},f=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=Hl(o==null?void 0:o.pointerEvents)||"",u.transform=f?f(this.latestValues,""):"none",u;const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){const b={};return this.options.layoutId&&(b.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,b.pointerEvents=Hl(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Cs(this.latestValues)&&(b.transform=f?f({},""):"none",this.hasProjected=!1),b}const h=d.animationValues||d.latestValues;this.applyTransformsToTarget(),u.transform=n6(this.projectionDeltaWithTransform,this.treeScale,h),f&&(u.transform=f(h,u.transform));const{x:p,y:x}=this.projectionDelta;u.transformOrigin=`${p.origin*100}% ${x.origin*100}% 0`,d.animationValues?u.opacity=d===this?(c=(l=h.opacity)!==null&&l!==void 0?l:this.latestValues.opacity)!==null&&c!==void 0?c:1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:u.opacity=d===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const b in Tc){if(h[b]===void 0)continue;const{correct:k,applyTo:v}=Tc[b],m=u.transform==="none"?h[b]:k(h[b],d);if(v){const y=v.length;for(let j=0;j<y;j++)u[v[j]]=m}else u[b]=m}return this.options.layoutId&&(u.pointerEvents=d===this?Hl(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(Sy),this.root.sharedNodes.clear()}}}function i6(e){e.updateLayout()}function a6(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,o=n.source!==e.layout.source;i==="size"?Dn(d=>{const h=o?n.measuredBox[d]:n.layoutBox[d],p=Cn(h);h.min=r[d].min,h.max=h.min+p}):DS(i,n.layoutBox,r)&&Dn(d=>{const h=o?n.measuredBox[d]:n.layoutBox[d],p=Cn(r[d]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+p)});const l=Ni();Ya(l,r,n.layoutBox);const c=Ni();o?Ya(c,e.applyTransform(s,!0),n.measuredBox):Ya(c,r,n.layoutBox);const u=!ES(l);let f=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:h,layout:p}=d;if(h&&p){const x=Nt();Xa(x,n.layoutBox,h.layoutBox);const b=Nt();Xa(b,r,p.layoutBox),TS(x,b)||(f=!0),d.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=x,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:f})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function o6(e){Ia&&Es.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function l6(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function c6(e){e.clearSnapshot()}function Sy(e){e.clearMeasurements()}function u6(e){e.isLayoutDirty=!1}function d6(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function jy(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function f6(e){e.resolveTargetDelta()}function h6(e){e.calcProjection()}function p6(e){e.resetSkewAndRotation()}function m6(e){e.removeLeadSnapshot()}function Ny(e,t,n){e.translate=gt(t.translate,0,n),e.scale=gt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Cy(e,t,n,r){e.min=gt(t.min,n.min,r),e.max=gt(t.max,n.max,r)}function g6(e,t,n,r){Cy(e.x,t.x,n.x,r),Cy(e.y,t.y,n.y,r)}function x6(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const y6={duration:.45,ease:[.4,0,.1,1]},Ey=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ty=Ey("applewebkit/")&&!Ey("chrome/")?Math.round:jn;function Py(e){e.min=Ty(e.min),e.max=Ty(e.max)}function v6(e){Py(e.x),Py(e.y)}function DS(e,t,n){return e==="position"||e==="preserve-aspect"&&!k_(by(t),by(n),.2)}function b6(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const w6=AS({attachResizeListener:(e,t)=>Po(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Pd={current:void 0},LS=AS({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Pd.current){const e=new w6({});e.mount(window),e.setOptions({layoutScroll:!0}),Pd.current=e}return Pd.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),k6={pan:{Feature:O_},drag:{Feature:F_,ProjectionNode:LS,MeasureLayout:jS}};function Ay(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&dt.postRender(()=>i(t,Ko(t)))}class S6 extends xs{mount(){const{current:t}=this.node;t&&(this.unmount=kI(t,n=>(Ay(this.node,n,"Start"),r=>Ay(this.node,r,"End"))))}unmount(){}}class j6 extends xs{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Wo(Po(this.node.current,"focus",()=>this.onFocus()),Po(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Dy(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&dt.postRender(()=>i(t,Ko(t)))}class N6 extends xs{mount(){const{current:t}=this.node;t&&(this.unmount=CI(t,n=>(Dy(this.node,n,"Start"),(r,{success:s})=>Dy(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const fh=new WeakMap,Ad=new WeakMap,C6=e=>{const t=fh.get(e.target);t&&t(e)},E6=e=>{e.forEach(C6)};function T6({root:e,...t}){const n=e||document;Ad.has(n)||Ad.set(n,{});const r=Ad.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(E6,{root:e,...t})),r[s]}function P6(e,t,n){const r=T6(t);return fh.set(e,n),r.observe(e),()=>{fh.delete(e),r.unobserve(e)}}const A6={some:0,all:1};class D6 extends xs{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:A6[s]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:d}=this.node.getProps(),h=u?f:d;h&&h(c)};return P6(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(L6(t,n))&&this.startObserver()}unmount(){}}function L6({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const M6={inView:{Feature:D6},tap:{Feature:N6},focus:{Feature:j6},hover:{Feature:S6}},I6={layout:{ProjectionNode:LS,MeasureLayout:jS}},hh={current:null},MS={current:!1};function R6(){if(MS.current=!0,!!em)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>hh.current=e.matches;e.addListener(t),t()}else hh.current=!1}const _6=[...sS,Kt,us],F6=e=>_6.find(rS(e)),Ly=new WeakMap;function O6(e,t,n){for(const r in t){const s=t[r],i=n[r];if(Xt(s))e.addValue(r,s);else if(Xt(i))e.addValue(r,Eo(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=e.getStaticValue(r);e.addValue(r,Eo(o!==void 0?o:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const My=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class z6{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Em,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=cr.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,dt.render(this.render,!1,!0))};const{latestValues:c,renderState:u,onUpdate:f}=o;this.onUpdate=f,this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=mu(n),this.isVariantNode=fk(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in h){const x=h[p];c[p]!==void 0&&Xt(x)&&x.set(c[p],!1)}}mount(t){this.current=t,Ly.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),MS.current||R6(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:hh.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Ly.delete(this.current),this.projection&&this.projection.unmount(),cs(this.notifyUpdate),cs(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=ni.has(t),s=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&dt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Xi){const n=Xi[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Nt()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<My.length;r++){const s=My[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=t[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=O6(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Eo(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(tS(s)||Kk(s))?s=parseFloat(s):!F6(s)&&us.test(n)&&(s=Jk(t,n)),this.setBaseTarget(t,Xt(s)?s.get():s)),Xt(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=om(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!Xt(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new wm),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class IS extends z6{constructor(){super(...arguments),this.KeyframeResolver=iS}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Xt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function V6(e){return window.getComputedStyle(e)}class B6 extends IS{constructor(){super(...arguments),this.type="html",this.renderInstance=wk}readValueFromInstance(t,n){if(ni.has(n)){const r=Cm(n);return r&&r.default||0}else{const r=V6(t),s=(yk(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return kS(t,n)}build(t,n,r){um(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return pm(t,n,r)}}class U6 extends IS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Nt}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(ni.has(n)){const r=Cm(n);return r&&r.default||0}return n=kk.has(n)?n:sm(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Nk(t,n,r)}build(t,n,r){dm(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){Sk(t,n,r,s)}mount(t){this.isSVGTag=hm(t.tagName),super.mount(t)}}const $6=(e,t)=>am(e)?new U6(t):new B6(t,{allowProjection:e!==g.Fragment}),H6=mI({...h_,...M6,...k6,...I6},$6),Ot=AM(H6),W6={Core:Xs,Network:Oo,Security:Fn,Database:L1,Utility:Rs,Custom:Rs,Monitoring:Xs,Automation:Fn},RS=e=>W6[e]||Rs;async function ph(e,t){const n=await e("skill.list",t);return{skills:(n.skills??[]).map(s=>({...s,icon:RS(s.type||"Custom"),version:`v${s.version||1}`,enabled:s.enabled??!0})),hasMore:n.hasMore??!1}}async function mh(e,t){var r,s,i;const n=await e("skill.get",{id:t});return n?{...n,icon:RS(n.type||"Custom"),version:`v${n.version||1}`,enabled:n.enabled??!0,specs:(r=n.files)==null?void 0:r.specs,scripts:(i=(s=n.files)==null?void 0:s.scripts)==null?void 0:i.map((o,l)=>({id:`s-${l}`,info:o.name.endsWith(".py")?"python":"shell",name:o.name,content:o.content})),publishedFiles:n.publishedFiles??null,stagingVersion:n.stagingVersion}:null}async function K6(e,t,n){var s;const r=(s=t.scripts)==null?void 0:s.map(i=>({name:i.name,content:i.content}));n?await e("skill.create",{name:t.name,description:t.description,type:t.type,specs:t.specs,scripts:r,labels:t.labels}):await e("skill.update",{id:String(t.id),name:t.name,description:t.description,type:t.type,specs:t.specs,scripts:r})}async function G6(e,t){await e("skill.delete",{id:t})}async function q6(e,t,n){return e("skill.vote",{id:t,vote:n})}async function Y6(e,t,n){return e("skill.revert",{id:t,reason:n})}async function X6(e,t,n,r,s){return e("skill.review",{id:t,decision:n,reason:r,stagingVersion:s})}async function Q6(e,t,n){return e("skill.submit",{id:t,contributeToTeam:n})}async function J6(e,t){return e("skill.withdraw",{id:t})}async function Z6(e,t){return e("skill.getReview",{id:t})}async function eF(e,t){return e("skill.history",{id:t})}async function tF(e,t,n){return e("skill.diff",{id:t,teamDiff:n})}async function _S(e,t,n){return e("skill.rollback",{id:t,version:n})}async function nF(e){return(await e("label.list")).labels??[]}async function Iy(e,t,n){return e("skill.updateLabels",{id:t,labels:n})}async function rF(e,t,n){return e("skill.fork",{sourceId:t,...n})}async function FS(e,t){return rF(e,String(t))}function Ry(e,t){const n={...e,hypotheses:[...e.hypotheses]};switch(t.type){case"phase":n.phase=t.phase,t.detail&&(n.currentAction=t.detail);break;case"hypothesis":{const r=t.id,s=n.hypotheses.findIndex(o=>o.id===r),i={id:r,text:t.text||(s>=0?n.hypotheses[s].text:""),status:t.status,confidence:t.confidence,callsUsed:s>=0?n.hypotheses[s].callsUsed:0,maxCalls:s>=0?n.hypotheses[s].maxCalls:10};s>=0?n.hypotheses[s]={...n.hypotheses[s],...i}:n.hypotheses.push(i);break}case"tool_exec":{const r=t.hypothesisId,s=t.callsUsed,i=t.maxCalls,o=t.tool,l=t.command,c=l.length>60?l.slice(0,57)+"...":l;if(n.currentAction=`${r?r+" ":""}[${s}/${i}] ${o}: ${c}`,r){const u=n.hypotheses.findIndex(f=>f.id===r);u>=0&&(n.hypotheses[u]={...n.hypotheses[u],callsUsed:s,maxCalls:i,lastAction:`[${s}/${i}] ${o}: ${c}`,status:n.hypotheses[u].status==="pending"?"validating":n.hypotheses[u].status})}break}case"budget_exhausted":{const r=t.hypothesisId;if(r){const s=n.hypotheses.findIndex(i=>i.id===r);s>=0&&(n.hypotheses[s]={...n.hypotheses[s],callsUsed:t.callsUsed})}break}}return n}const Dd="siclaw_current_session",_y="siclaw_selected_brain";function Fy(){return[{id:"triage",label:"Quick triage",status:"pending"},{id:"hypotheses",label:"Propose hypotheses",status:"pending"},{id:"deep_search",label:"Deep search validation",status:"pending"},{id:"conclusion",label:"Present findings",status:"pending"}]}function sF(e,t){try{const n=JSON.parse(t);return OS(e,n)}catch{return t}}function OS(e,t){if(!t)return"";const n=e.toLowerCase();if(n==="bash"||n==="shell"||n==="command")return t.command||t.cmd||"";if(n==="node_exec"){const s=t.node||"",i=t.command||"";return s&&i?`${s} $ ${i}`:s||i}if(n==="node_script"){const s=t.node||"",i=t.skill||"",o=t.script||"",l=t.args||"",c=[i,o].filter(Boolean).join("/"),u=l?`${c} ${l}`:c;return s&&u?`${s} $ ${u}`:s||u}if(n==="pod_exec"){const s=t.pod||"",i=t.namespace||"",o=t.command||"",l=i?`${s} -n ${i}`:s;return l&&o?`${l} $ ${o}`:l||o}if(n==="pod_script"){const s=t.pod||"",i=t.namespace||"",o=t.skill||"",l=t.script||"",c=t.args||"",u=i?`${s} -n ${i}`:s,f=[o,l].filter(Boolean).join("/"),d=c?`${f} ${c}`:f;return u&&d?`${u} $ ${d}`:u||d}if(n==="pod_nsenter_exec"){const s=t.pod||"",i=t.namespace||"",o=t.command||"",l=i?`${s} -n ${i}`:s;return l&&o?`${l} $ ${o}`:l||o}if(n==="read"||n==="readfile"||n==="write"||n==="writefile"||n==="edit")return t.file_path||t.path||"";if(n==="grep"||n==="search"){const s=t.pattern||"",i=t.path||"";return i?`${s} in ${i}`:s}if(n==="glob")return t.pattern||"";if(n==="create_skill")return t.name||"";if(n==="run_skill"){const s=t.skill||"",i=t.script||"",o=t.args||"",l=[s,i].filter(Boolean).join("/");return o?`${l} ${o}`:l}if(n==="task_plan")return t.title||"";if(n==="deep_search")return t.question||"";if(n==="update_plan"){const s=t.step,i=t.status||"";return s!=null?`Step ${s}: ${i}`:i}return Object.values(t).filter(s=>typeof s=="string"&&s.length>0)[0]||JSON.stringify(t)}function iF(){const{currentWorkspace:e}=Ap(),t=e==null?void 0:e.id,n=g.useRef(t),[r,s]=g.useState([]),[i,o]=g.useState(null),[l,c]=g.useState(null),[u,f]=g.useState(null),d="siclaw_dp_active",[h,p]=g.useState(()=>localStorage.getItem(d)==="true"),[x,b]=g.useState([]),[k,v]=g.useState(()=>sessionStorage.getItem(Dd)),[m,y]=g.useState(!1),[j,S]=g.useState([]),[N,w]=g.useState(!1),[C,D]=g.useState(!1),[T,M]=g.useState(!1),[P,F]=g.useState(null),[z,W]=g.useState(!1),fe=g.useRef(!1),[ee,R]=g.useState([]),[V,E]=g.useState(null),[Y,J]=g.useState(null),[L,Q]=g.useState([]),[te,pe]=g.useState(null),[ne,ie]=g.useState(null),[he,Ce]=g.useState(()=>localStorage.getItem(_y)||"pi-agent"),[Te,K]=g.useState(null),$=g.useRef(()=>{}),xe=g.useRef(()=>{}),q=g.useRef(()=>{}),ye=g.useRef(()=>{}),Le=g.useRef(0),He=g.useRef(),qe=g.useRef(k);g.useEffect(()=>{qe.current=k},[k]);const St=g.useRef(new Set),jt=(A,I)=>{const U=setTimeout(()=>{St.current.delete(U),A()},I);St.current.add(U)},vt=()=>{for(const A of St.current)clearTimeout(A);St.current.clear()},Ye=()=>{f(null),c(null),o(null)};g.useEffect(()=>{k?sessionStorage.setItem(Dd,k):sessionStorage.removeItem(Dd)},[k]),g.useEffect(()=>{localStorage.setItem(d,String(h))},[h]),g.useEffect(()=>{localStorage.setItem(_y,he)},[he]);const it=g.useCallback(A=>{Ce(A)},[]),Et=g.useCallback(A=>{var I,U,ue;if(A.type==="event"&&A.payload){const me=A.payload,Pe=me.sessionId;if(Pe&&Pe!==qe.current)return;switch(Le.current=Date.now(),me.type){case"message_update":{const X=me.assistantMessageEvent;(X==null?void 0:X.type)==="text_delta"&&X.delta&&s(re=>{const de=re[re.length-1];return de!=null&&de.isStreaming&&de.role==="assistant"?[...re.slice(0,-1),{...de,content:de.content+X.delta}]:[...re,{id:`msg-${Date.now()}`,role:"assistant",content:X.delta,timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),isStreaming:!0}]});break}case"tool_execution_start":{const X=me.toolName,re=me.args,de=OS(X??"",re),Se=X==="update_plan"||X==="manage_checklist"||X==="end_investigation";if(X==="deep_search"&&o(ke=>ke??{hypotheses:[]}),X==="manage_checklist"){const ke=(re==null?void 0:re.updates)||[];f(Fe=>{const De=Fe?Fe.map(pt=>({...pt})):Fy();for(const pt of ke){const pr=De.find(Vn=>Vn.id===pt.id);pr&&(pt.status&&(pt.status==="done"||pt.status==="skipped"||pt.status==="in_progress"||pt.status==="pending")&&(pr.status=pt.status),pt.summary&&(pr.summary=pt.summary))}const _e=De.find(pt=>pt.status==="in_progress");return c(_e?_e.id:null),De.every(pt=>pt.status==="done"||pt.status==="skipped")&&jt(()=>Ye(),3e3),De})}X==="end_investigation"&&Ye(),s(ke=>[...ke,{id:`tool-${Date.now()}`,role:"tool",content:"",toolName:X??"tool",toolInput:de,toolStatus:"running",timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),isStreaming:!0,hidden:Se}]);break}case"tool_execution_end":{const X=me.result,re=((I=X==null?void 0:X.content)==null?void 0:I.filter(Fe=>Fe.type==="text").map(Fe=>Fe.text??"").join(""))??"",de=X==null?void 0:X.details,Se=me.isError,ke=me.dbMessageId;s(Fe=>{const De=Fe[Fe.length-1];return(De==null?void 0:De.role)==="tool"&&De.isStreaming?(De.toolName==="deep_search"&&jt(()=>{o(_e=>_e&&_e.hypotheses.every(nt=>nt.status!=="validating"&&nt.status!=="pending")?null:_e)},5e3),[...Fe.slice(0,-1),{...De,content:re,toolStatus:Se?"error":"success",isStreaming:!1,...de?{toolDetails:de}:{},...ke?{id:ke}:{}}]):Fe});break}case"tool_progress":{const X=me.progress;me.toolName==="deep_search"&&X&&o(re=>Ry(re??{hypotheses:[]},X));break}case"message_start":{const X=me.message;if((X==null?void 0:X.customType)==="dp-checklist-sync"&&((U=X.details)!=null&&U.items)){const re=X.details.items;f(de=>{if(!de)return de;const Se=de.map(Fe=>({...Fe}));for(const Fe of re){const De=Se.find(_e=>_e.id===Fe.id);De&&(De.status=Fe.status,Fe.summary&&(De.summary=Fe.summary))}return Se.every(Fe=>Fe.status==="done"||Fe.status==="skipped")&&jt(()=>Ye(),3e3),Se});break}if((X==null?void 0:X.role)==="user"){const re=((ue=X.content)==null?void 0:ue.filter(de=>de.type==="text").map(de=>de.text??"").join(""))??"";re&&S(de=>{const Se=de.indexOf(re);return Se<0?de:(s(ke=>[...ke,{id:`msg-${Date.now()}`,role:"user",content:re,timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}]),[...de.slice(0,Se),...de.slice(Se+1)])})}break}case"message_end":s(X=>X.map(re=>re.isStreaming&&re.role==="assistant"?{...re,isStreaming:!1}:re));break;case"auto_compaction_start":W(!0);break;case"auto_compaction_end":W(!1),xe.current();break;case"turn_end":s(X=>X.map(re=>re.isStreaming?{...re,isStreaming:!1}:re)),S(X=>X.length>0?X.slice(1):X);break;case"prompt_done":s(X=>X.map(re=>re.isStreaming?{...re,isStreaming:!1}:re)),fe.current||y(!1),S([]),$.current(),xe.current(),q.current(),ye.current(),f(X=>{if(!X)return X;const re=X.find(ke=>ke.id==="deep_search");if(!re||re.status!=="done"||!X.some(ke=>ke.status==="pending"||ke.status==="in_progress"))return X;const Se=X.map(ke=>ke.status==="pending"||ke.status==="in_progress"?{...ke,status:"done",summary:ke.summary||"Auto-completed"}:ke);return jt(()=>Ye(),3e3),Se});break}}},[]),{status:H,sendRpc:G,isConnected:se}=zt({onMessage:Et}),we=g.useCallback(async()=>{if(se)try{const A=await ph(G);R(A.skills)}catch(A){console.error("Failed to load skills:",A)}},[se,G]),O=g.useCallback(async()=>{if(se)try{const A=await G("model.list"),I=A.models??[];if(Q(I),pe(A.default??null),I.length>0)if(A.default){const U=I.find(ue=>ue.provider===A.default.provider&&ue.id===A.default.modelId);ie(U||(ue=>ue??I[0]))}else ie(U=>U??I[0])}catch(A){console.error("Failed to load models:",A)}},[se,G]),oe=g.useCallback(async()=>{if(se)try{const A=await G("system.status");E(A)}catch{}},[se,G]),be=g.useCallback(async()=>{if(!(!se||!k||ne))try{const A=await G("model.get",{sessionId:k});A.model&&ie(A.model),A.brainType&&K(A.brainType)}catch{}},[se,k,ne,G]),Me=g.useCallback((A,I)=>{J({id:A,name:I})},[]),et=g.useCallback(()=>{J(null)},[]),Ve=g.useCallback(async()=>{if(se)try{const A={};t&&(A.workspaceId=t);const I=await G("session.list",A);b(I.sessions??[])}catch(A){console.error("Failed to load sessions:",A)}},[se,G,t]);$.current=Ve,q.current=O,ye.current=be;const tt=g.useCallback(async()=>{if(!(!se||!k))try{const A=await G("chat.context",{sessionId:k});A&&F({tokens:A.tokens,contextWindow:A.contextWindow,percent:A.percent,inputTokens:A.inputTokens,outputTokens:A.outputTokens,cacheReadTokens:A.cacheReadTokens,cacheWriteTokens:A.cacheWriteTokens,cost:A.cost})}catch{}},[se,k,G]);xe.current=tt;const It=A=>A.map(I=>({...I,toolInput:I.role==="tool"&&I.toolInput?sF(I.toolName??"",I.toolInput):void 0,isoTimestamp:I.timestamp,timestamp:I.timestamp?new Date(I.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",hidden:I.hidden||I.role==="tool"&&(I.toolName==="update_plan"||I.toolName==="manage_checklist")})),at=g.useCallback(async A=>{if(se){v(A),s([]),D(!1),w(!0),vt(),Ye();try{const I=await G("chat.history",{sessionId:A});s(It(I.messages??[])),D(I.hasMore??!1)}catch(I){console.error("Failed to load history:",I)}finally{w(!1)}try{const I=await G("model.get",{sessionId:A});I.model&&ie(I.model),I.brainType&&K(I.brainType)}catch{}}},[se,G]),Z=g.useCallback(async()=>{if(!se||!k||!C||T)return;const A=r[0];if(A){M(!0);try{const I=await G("chat.history",{sessionId:k,before:A.isoTimestamp}),U=It(I.messages??[]);s(ue=>[...U,...ue]),D(I.hasMore??!1)}catch(I){console.error("Failed to load more history:",I)}finally{M(!1)}}},[se,k,C,T,r,G]),je=g.useCallback(async A=>{if(!se||!A.trim())return;if(m){try{await G("chat.steer",{text:A,sessionId:qe.current}),S(U=>[...U,A])}catch(U){console.error("Failed to steer:",U)}return}A.startsWith("[Deep Investigation]")&&(f(Fy().map(U=>U.id==="triage"?{...U,status:"in_progress"}:U)),c("triage"));const I={id:`user-${Date.now()}`,role:"user",content:A,timestamp:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};s(U=>[...U,I]),y(!0);try{const U=await G("chat.send",{sessionId:k,message:A,modelProvider:ne==null?void 0:ne.provider,modelId:ne==null?void 0:ne.id,brainType:he,workspaceId:t});U.brainType&&K(U.brainType),U.sessionId&&U.sessionId!==k&&(v(U.sessionId),$.current())}catch(U){console.error("Failed to send message:",U),y(!1)}},[se,m,k,ne,he,G]),ze=g.useCallback(async()=>{if(se){fe.current=!0,S([]),vt(),Ye(),s(A=>A.map(I=>I.isStreaming?{...I,isStreaming:!1,...I.role==="tool"?{toolStatus:"aborted"}:{}}:I));try{await G("chat.abort",{sessionId:qe.current})}catch(A){console.error("Failed to abort:",A)}fe.current=!1,y(!1)}},[se,G]),ot=g.useCallback(async()=>{if(S([]),!!se)try{await G("chat.clearQueue",{sessionId:qe.current})}catch(A){console.error("Failed to clear queue:",A)}},[se,G]),ys=g.useCallback(async A=>{if(S(I=>{const U=[...I];return U.splice(A,1),U}),!!se)try{await G("chat.clearQueue",{sessionId:qe.current}),S(I=>{for(const U of I)G("chat.steer",{text:U,sessionId:qe.current}).catch(()=>{});return I})}catch(I){console.error("Failed to remove pending message:",I)}},[se,G]),ri=g.useCallback(async(A,I)=>{if(s(U=>U.map(ue=>ue.id===A?{...ue,metadata:{...ue.metadata,...I}}:ue)),se)try{await G("message.updateMeta",{id:A,metadata:I})}catch(U){console.error("Failed to persist message metadata:",U)}},[se,G]),vs=g.useCallback(()=>{vt(),Ye()},[]),bs=g.useCallback(()=>{vs(),je(`[DP_EXIT]
596
+ Please briefly summarize the current investigation progress and findings.`)},[vs,je]),hr=g.useCallback(A=>{f(I=>I&&I.map(U=>U.id==="triage"&&U.status!=="done"?{...U,status:"done",summary:U.summary||"Done"}:U.id==="hypotheses"&&U.status!=="done"?{...U,status:"done",summary:U.summary||"Confirmed"}:U.id==="deep_search"?{...U,status:"in_progress"}:U)),c("deep_search"),o({hypotheses:A.map(I=>({id:I.id,text:I.text,status:"pending",confidence:I.confidence,callsUsed:0,maxCalls:10}))}),G("chat.confirmHypotheses",{sessionId:qe.current}).catch(()=>{})},[G]),Zn=g.useCallback(()=>{v(null),s([]),F(null),W(!1);const A=te?L.find(I=>I.provider===te.provider&&I.id===te.modelId):null;ie(A??L[0]??null),K(null),vt(),Ye(),oe()},[L,te,oe]),vu=g.useCallback(async A=>{if(se)try{await G("session.delete",{sessionId:A}),k===A&&(v(null),s([])),Ve()}catch(I){console.error("Failed to delete session:",I)}},[se,G,k,Ve]);g.useEffect(()=>{!se&&m&&(y(!1),fe.current=!1,S([]),s(A=>A.map(I=>I.isStreaming?{...I,isStreaming:!1,...I.role==="tool"?{toolStatus:"error"}:{}}:I)),vt(),f(A=>A?A.map(I=>I.status==="in_progress"||I.status==="pending"?{...I,status:"error",summary:"Connection lost"}:I):null),c(null),o(null),jt(()=>Ye(),1e4))},[se]);const Go=u?45e3:12e4;g.useEffect(()=>{if(m)return Le.current=Date.now(),He.current=setInterval(()=>{Date.now()-Le.current>Go&&(console.warn("[usePilot] Stale loading detected — resetting UI"),y(!1),fe.current=!1,S([]),s(A=>A.map(I=>I.isStreaming?{...I,isStreaming:!1,...I.role==="tool"?{toolStatus:"error"}:{}}:I)),vt(),f(A=>A?A.map(I=>I.status==="in_progress"||I.status==="pending"?{...I,status:"error",summary:"Response timeout"}:I):null),c(null),o(null),jt(()=>Ye(),1e4))},15e3),()=>clearInterval(He.current);He.current&&(clearInterval(He.current),He.current=void 0)},[m,Go]);const _=g.useCallback(async()=>{if(se)try{const A=await G("chat.dpProgress",{sessionId:qe.current});if(!A.events||A.events.length===0)return;let I={hypotheses:[]};for(const U of A.events)I=Ry(I,U);o(I)}catch{}},[se,G]);return g.useEffect(()=>{n.current!==t&&n.current!==void 0&&(v(null),s([]),F(null),W(!1),K(null),vt(),Ye(),se&&Ve()),n.current=t},[t]),g.useEffect(()=>{se&&(Ve(),we(),O(),oe(),k&&at(k).then(()=>_()))},[se]),g.useEffect(()=>{const A=new BroadcastChannel("siclaw-model-config");return A.onmessage=()=>{q.current()},()=>A.close()},[]),{messages:r,investigationProgress:i,dpActive:h,setDpActive:p,dpFocus:l,dpChecklist:u,sessions:x,currentSessionKey:k,isLoading:m,isLoadingHistory:N,hasMore:C,isLoadingMore:T,contextUsage:P,isCompacting:z,skills:ee,systemStatus:V,editingSkill:Y,pendingMessages:j,wsStatus:H,isConnected:se,sendMessage:je,abortResponse:ze,loadHistory:at,loadMoreHistory:Z,createSession:Zn,deleteSession:vu,loadSessions:Ve,setCurrentSessionKey:v,sendRpc:G,startEditSkill:Me,clearEditSkill:et,loadSkills:we,updateMessageMeta:ri,clearPendingMessages:ot,removePendingMessage:ys,confirmHypotheses:hr,dismissDpChecklist:vs,exitDpMode:bs,models:L,selectedModel:ne,selectedBrain:he,selectBrain:it,sessionBrainType:Te}}function aF(){const[e,t]=g.useState(!1),[n,r]=g.useState(null),s=dr(),i=iF(),o=g.useRef(new Set),l=g.useCallback(()=>{i.clearEditSkill(),i.loadSkills()},[i]),c=g.useCallback(async d=>{(d.toolName==="create_skill"||d.toolName==="update_skill")&&await i.loadSkills(),r(null)},[i]),u=g.useCallback(d=>{r(null)},[]),f=g.useCallback(d=>{r(d)},[]);return g.useEffect(()=>{if(!n)return;const d=n.id;if(!d.startsWith("tool-")&&!d.startsWith("msg-"))return;const h=i.messages.find(p=>p.content===n.content&&p.toolName===n.toolName);h&&h.id!==n.id&&r(h)},[i.messages,n]),g.useEffect(()=>{const d=i.messages;if(d.length!==0)for(let h=d.length-1;h>=0;h--){const p=d[h];if(p.role!=="tool"||p.isStreaming||!p.content||p.isoTimestamp||p.toolName!=="create_skill"&&p.toolName!=="update_skill")continue;const x=`${p.toolName}:${p.content.slice(0,200)}`;if(o.current.has(x))continue;try{const k=JSON.parse(p.content);if(!(k!=null&&k.skill))continue}catch{continue}const b=p.metadata;if(!((b==null?void 0:b.skillCard)==="saved"||(b==null?void 0:b.skillCard)==="dismissed")){o.current.add(x),r(p);break}}},[i.messages]),a.jsxs("div",{className:"flex h-full relative bg-white overflow-hidden font-sans",children:[a.jsx(Xn,{children:e&&a.jsxs(a.Fragment,{children:[a.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>t(!1),className:"absolute inset-0 bg-stone-200/40 backdrop-blur-[2px] z-40 transition-all"}),a.jsxs(Ot.div,{initial:{x:-320},animate:{x:0},exit:{x:-320},transition:{type:"spring",stiffness:350,damping:35},className:"absolute top-0 bottom-0 left-0 w-[300px] bg-[#F7F6F3] border-r border-[#E5E5E5] z-50 shadow-2xl flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-[#E5E5E5]",children:[a.jsx("span",{className:"text-sm font-medium text-[#444]",children:"Recent Sessions"}),a.jsx("button",{onClick:()=>t(!1),className:"text-[#999] hover:text-[#333]",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(BE,{sessions:i.sessions,currentSessionKey:i.currentSessionKey,onSelectSession:d=>{i.loadHistory(d),t(!1)},onNewSession:()=>{i.createSession(),t(!1)},onDeleteSession:i.deleteSession})})]})]})}),a.jsxs("div",{className:"flex-1 relative flex flex-col bg-white min-w-0",children:[a.jsxs("header",{className:"absolute top-0 left-0 right-0 h-16 flex items-center justify-between px-4 z-30",children:[a.jsx("div",{className:"flex items-center",children:!e&&a.jsx("button",{onClick:()=>t(!0),className:"p-2 rounded-lg text-gray-400 hover:text-gray-800 hover:bg-gray-100 transition-all",title:"View History",children:a.jsx(R1,{className:"w-5 h-5"})})}),a.jsx("div",{className:"flex items-center",children:a.jsx("button",{onClick:()=>i.createSession(),className:"p-2 rounded-lg text-gray-400 hover:text-gray-800 hover:bg-gray-100 transition-all",title:"New Session",children:a.jsx(en,{className:"w-5 h-5"})})})]}),a.jsx("div",{className:"flex-1 pt-16 flex flex-col min-h-0",children:a.jsx(iM,{messages:i.messages,isLoading:i.isLoading,isLoadingHistory:i.isLoadingHistory,wsStatus:i.wsStatus,isConnected:i.isConnected,hasMore:i.hasMore,isLoadingMore:i.isLoadingMore,sendMessage:i.sendMessage,abortResponse:i.abortResponse,loadMoreHistory:i.loadMoreHistory,sendRpc:i.sendRpc,contextUsage:i.contextUsage,isCompacting:i.isCompacting,skills:i.skills,editingSkill:i.editingSkill,onEditSkill:i.startEditSkill,onClearEditSkill:i.clearEditSkill,onSkillSaved:l,onOpenSkillPanel:f,onOpenSchedulePanel:f,panelMessage:n,updateMessageMeta:i.updateMessageMeta,pendingMessages:i.pendingMessages,onRemovePending:i.removePendingMessage,investigationProgress:i.investigationProgress,dpActive:i.dpActive,onSetDpActive:i.setDpActive,dpFocus:i.dpFocus,dpChecklist:i.dpChecklist,onHypothesesConfirmed:i.confirmHypotheses,onExitDp:i.exitDpMode,systemStatus:i.systemStatus,onNavigateModels:()=>s("/models"),onNavigateCredentials:()=>s("/credentials")})})]}),n&&(n.toolName==="create_skill"||n.toolName==="update_skill"?a.jsx(mM,{message:n,sendRpc:i.sendRpc,skills:i.skills,onSave:c,onDismiss:u,onClose:()=>r(null),updateMessageMeta:i.updateMessageMeta}):n.toolName==="manage_schedule"?a.jsx(gM,{message:n,sendRpc:i.sendRpc,onSave:c,onDismiss:u,onClose:()=>r(null),updateMessageMeta:i.updateMessageMeta,selectedEnvId:void 0}):null)]})}const Je=({content:e,children:t,position:n="top",delay:r=.2})=>{const[s,i]=g.useState(!1),o=g.useRef(null),[l,c]=g.useState({top:0,left:0}),u=g.useCallback(()=>{if(o.current){const f=o.current.getBoundingClientRect();let d=0,h=0;const p=8;switch(n){case"top":d=f.top-p,h=f.left+f.width/2;break;case"bottom":d=f.bottom+p,h=f.left+f.width/2;break;case"left":d=f.top+f.height/2,h=f.left-p;break;case"right":d=f.top+f.height/2,h=f.right+p;break}c({top:d,left:h})}i(!0)},[n]);return a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:o,className:"relative flex items-center",onMouseEnter:u,onMouseLeave:()=>i(!1),children:t}),Xc.createPortal(a.jsx(Xn,{children:s&&a.jsx(Ot.div,{initial:{opacity:0,scale:.96,y:n==="top"?4:n==="bottom"?-4:0,x:n==="left"?4:n==="right"?-4:0,top:l.top,left:l.left},animate:{opacity:1,scale:1,y:0,x:0},exit:{opacity:0,scale:.96},transition:{duration:.15,delay:r,ease:"easeOut"},style:{position:"fixed",top:0,left:0,pointerEvents:"none"},className:"z-[9999]",children:a.jsx("div",{className:`
597
+ relative px-3 py-1.5 text-xs font-semibold text-gray-700 bg-white
598
+ border border-gray-100 rounded-lg shadow-[0_4px_12px_-2px_rgba(0,0,0,0.08)]
599
+ whitespace-nowrap select-none
600
+ ${n==="top"?"-translate-x-1/2 -translate-y-full":""}
601
+ ${n==="bottom"?"-translate-x-1/2":""}
602
+ ${n==="left"?"-translate-x-full -translate-y-1/2":""}
603
+ ${n==="right"?"-translate-y-1/2":""}
604
+ `,children:e})})}),document.body)]})};function Bs({isOpen:e,onClose:t,onConfirm:n,title:r,description:s,confirmText:i="Confirm",cancelText:o="Cancel",variant:l="primary"}){if(!e)return null;const u={primary:{icon:g5,iconColor:"text-primary-600",iconBg:"bg-primary-50",button:"bg-primary-600 hover:bg-primary-700 focus:ring-primary-100"},danger:{icon:zs,iconColor:"text-red-600",iconBg:"bg-red-50",button:"bg-red-600 hover:bg-red-700 focus:ring-red-100"},warning:{icon:Lr,iconColor:"text-orange-600",iconBg:"bg-orange-50",button:"bg-orange-600 hover:bg-orange-700 focus:ring-orange-100"}}[l],f=u.icon;return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-gray-900/40 backdrop-blur-sm transition-opacity",onClick:t}),a.jsx("div",{className:"relative w-full max-w-md bg-white rounded-2xl shadow-xl border border-gray-100 overflow-hidden text-left transform transition-all animate-in fade-in zoom-in-95 duration-200",children:a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:B("p-3 rounded-xl flex-shrink-0",u.iconBg),children:a.jsx(f,{className:B("w-6 h-6",u.iconColor)})}),a.jsxs("div",{className:"flex-1 pt-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 leading-none mb-2",children:r}),a.jsx("p",{className:"text-sm text-gray-500 leading-relaxed",children:s})]}),a.jsx("button",{onClick:t,className:"p-1 text-gray-400 hover:text-gray-500 hover:bg-gray-100 rounded-lg transition-colors",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"mt-8 flex items-center justify-end gap-3",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-100 transition-colors",children:o}),a.jsx("button",{onClick:()=>{n(),t()},className:B("px-4 py-2 text-sm font-medium text-white rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2 transition-all",u.button),children:i})]})]})})]})}const Oy=30;function oF(e){const[t,n]=g.useState([]),[r,s]=g.useState(!0),[i,o]=g.useState(!1),[l,c]=g.useState(!1),[u,f]=g.useState("all"),[d,h]=g.useState(""),p=g.useCallback(async(M,P)=>{const F=M??u,z=P??d;f(F),h(z),s(!0);try{const W=await ph(e,{limit:Oy,offset:0,scope:F==="all"||F==="approvals"?void 0:F,search:z||void 0,pendingOnly:F==="approvals"?!0:void 0});n(W.skills),c(W.hasMore)}catch(W){console.error("[useSkills] Failed to load:",W)}finally{s(!1)}},[e,u,d]),x=g.useCallback(async()=>{if(!(i||!l)){o(!0);try{const M=await ph(e,{limit:Oy,offset:t.length,scope:u==="all"||u==="approvals"?void 0:u,search:d||void 0,pendingOnly:u==="approvals"?!0:void 0});n(P=>[...P,...M.skills]),c(M.hasMore)}catch(M){console.error("[useSkills] Failed to load more:",M)}finally{o(!1)}}},[e,t.length,u,d,i,l]),b=g.useCallback(async M=>{const P=!M.enabled;try{await e("skill.setEnabled",{name:M.name,enabled:P}),n(F=>F.map(z=>z.name===M.name?{...z,enabled:P}:z))}catch(F){console.error("[useSkills] toggleEnabled failed:",F)}},[e]),k=g.useCallback(async(M,P)=>{await e("skill.submit",{id:String(M.id),contributeToTeam:P}),await p()},[e,p]),v=g.useCallback(async M=>{await Q6(e,String(M.id)),await p()},[e,p]),m=g.useCallback(async M=>{try{await e("skill.review",{id:String(M.id),decision:"approve"}),await p()}catch(P){console.error("[useSkills] approveSkill failed:",P)}},[e,p]),y=g.useCallback(async(M,P)=>{try{await e("skill.review",{id:String(M.id),decision:"reject",reason:P}),await p()}catch(F){console.error("[useSkills] rejectSkill failed:",F)}},[e,p]),j=g.useCallback(async M=>{try{await e("skill.delete",{id:String(M.id)}),n(P=>P.filter(F=>F.id!==M.id))}catch(P){console.error("[useSkills] deleteSkill failed:",P)}},[e]),S=g.useCallback(async M=>{try{await FS(e,String(M.id)),await p()}catch(P){console.error("[useSkills] copyToPersonal failed:",P)}},[e,p]),N=g.useCallback(async(M,P)=>{try{const F=await q6(e,String(M.id),P);n(z=>z.map(W=>W.id===M.id?{...W,upvotes:F.upvotes,downvotes:F.downvotes,userVote:F.userVote}:W))}catch(F){console.error("[useSkills] voteSkill failed:",F)}},[e]),w=g.useCallback(async(M,P)=>{try{await Y6(e,String(M.id),P),await p()}catch(F){console.error("[useSkills] revertSkill failed:",F)}},[e,p]),C=g.useCallback(async(M,P,F,z)=>{await X6(e,String(M.id),P,F,z),await p()},[e,p]),D=g.useCallback(async(M,P)=>{try{await _S(e,String(M.id),P),await p()}catch(F){console.error("[useSkills] rollbackSkill failed:",F)}},[e,p]),T=g.useCallback(async M=>{try{(await J6(e,String(M.id))).wasNew?n(F=>F.filter(z=>z.id!==M.id)):await p()}catch(P){console.error("[useSkills] withdrawSkill failed:",P)}},[e,p]);return{skills:t,isLoading:r,isLoadingMore:i,hasMore:l,loadSkills:p,loadMore:x,toggleEnabled:b,publishSkill:k,requestPublish:v,approveSkill:m,rejectSkill:y,deleteSkill:j,copyToPersonal:S,voteSkill:N,revertSkill:w,reviewSkill:C,withdrawSkill:T,rollbackSkill:D}}function yu(e,t){const[n,r]=g.useState({isAdmin:!1,permissions:[],isReviewer:!1,loaded:!1});return g.useEffect(()=>{t&&e("permission.mine").then(s=>{const i=s.isAdmin,o=s.permissions;r({isAdmin:i,permissions:o,isReviewer:i||o.includes("skill_reviewer"),loaded:!0})}).catch(s=>{console.warn("[usePermissions] Failed to fetch permissions:",s),r(i=>({...i,loaded:!0}))})},[t,e]),n}function lF(){var we;const e=dr(),[t,n]=eu(),{sendRpc:r,isConnected:s}=zt(),{skills:i,isLoading:o,isLoadingMore:l,hasMore:c,loadSkills:u,loadMore:f,toggleEnabled:d,requestPublish:h,publishSkill:p,copyToPersonal:x,approveSkill:b,rejectSkill:k,deleteSkill:v,voteSkill:m,revertSkill:y,reviewSkill:j,withdrawSkill:S}=oF(r),N=ls(),w=(N==null?void 0:N.username)==="admin",{isReviewer:C}=yu(r,s),D=t.get("tab"),T=sessionStorage.getItem("skills_tab"),[M,P]=g.useState(D||T||"all"),[F,z]=g.useState(""),[W,fe]=g.useState(new Set),[ee,R]=g.useState(!1),[V,E]=g.useState([]),Y=g.useRef(null),J=g.useRef(),L=g.useRef(null),Q={kubernetes:"bg-blue-50 text-blue-700 border-blue-200","bare-metal":"bg-blue-50 text-blue-700 border-blue-200",switch:"bg-blue-50 text-blue-700 border-blue-200",network:"bg-purple-50 text-purple-700 border-purple-200",rdma:"bg-purple-50 text-purple-700 border-purple-200",scheduling:"bg-purple-50 text-purple-700 border-purple-200",storage:"bg-purple-50 text-purple-700 border-purple-200",compute:"bg-purple-50 text-purple-700 border-purple-200",general:"bg-purple-50 text-purple-700 border-purple-200",diagnostic:"bg-green-50 text-green-700 border-green-200",monitoring:"bg-green-50 text-green-700 border-green-200",performance:"bg-green-50 text-green-700 border-green-200",configuration:"bg-green-50 text-green-700 border-green-200",sre:"bg-orange-50 text-orange-700 border-orange-200",developer:"bg-orange-50 text-orange-700 border-orange-200"},te={Environment:["kubernetes","bare-metal","switch"],Domain:["network","rdma","scheduling","storage","compute","general"],Operation:["diagnostic","monitoring","performance","configuration"],...w?{Role:["sre","developer"]}:{}},pe=g.useMemo(()=>{const O=new Set(V.map(Ve=>Ve.label)),oe=new Map(V.map(Ve=>[Ve.label,Ve.count])),be=[],Me=new Set;for(const[Ve,tt]of Object.entries(te)){const It=tt.filter(at=>O.has(at)).map(at=>({label:at,count:oe.get(at)??0}));It.length>0&&(be.push({group:Ve,labels:It}),It.forEach(at=>Me.add(at.label)))}const et=V.filter(Ve=>!Me.has(Ve.label)).map(Ve=>({label:Ve.label,count:Ve.count}));return et.length>0&&be.push({group:"Other",labels:et}),be},[V,w]),ne=O=>{fe(oe=>{const be=new Set(oe);return be.has(O)?be.delete(O):be.add(O),be})};g.useEffect(()=>{if(!ee)return;const O=oe=>{Y.current&&!Y.current.contains(oe.target)&&R(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[ee]);const ie=O=>{const oe=O.target.value;z(oe),clearTimeout(J.current),J.current=setTimeout(()=>{u(M,oe)},300)},he=O=>{P(O),sessionStorage.setItem("skills_tab",O),n(O==="all"?{}:{tab:O}),u(O,F)},Ce=g.useCallback(()=>{const O=L.current;!O||l||!c||O.scrollHeight-O.scrollTop-O.clientHeight<200&&f()},[l,c,f]),[Te,K]=g.useState({isOpen:!1,skill:null,reason:""}),[$,xe]=g.useState({isOpen:!1,title:"",description:"",variant:"primary",confirmText:"Confirm",onConfirm:()=>{}}),q=()=>xe(O=>({...O,isOpen:!1})),ye=g.useRef(!1);g.useEffect(()=>{s&&!ye.current&&(ye.current=!0,u(M,""),nF(r).then(E).catch(()=>{}))},[s]),g.useEffect(()=>{const O=t.get("tab");if(!O)return;const oe=O;oe!==M&&(P(oe),sessionStorage.setItem("skills_tab",oe),u(oe,F))},[t]);const Le=W.size===0?i:i.filter(O=>{const oe=O.labels??[];return[...W].every(be=>oe.includes(be))}),He=()=>e("/skills/new"),qe=(O,oe)=>{O.stopPropagation(),d(oe)},St=O=>{xe({isOpen:!0,title:"Error",description:O,variant:"warning",confirmText:"OK",onConfirm:()=>{}})},jt=(O,oe)=>{O.stopPropagation(),xe({isOpen:!0,title:"Publish Skill",description:`Are you sure you want to publish "${oe.name}"? It will be reviewed by an admin before becoming available in production.`,variant:"primary",confirmText:"Request Publish",onConfirm:()=>{h(oe).catch(be=>St((be==null?void 0:be.message)||String(be)))}})},vt=(O,oe)=>{O.stopPropagation(),xe({isOpen:!0,title:"Contribute to Team",description:`Contribute "${oe.name}" to the team? An admin will review before it becomes a shared team skill.`,variant:"primary",confirmText:"Contribute",onConfirm:()=>{p(oe,!0).catch(be=>St((be==null?void 0:be.message)||String(be)))}})},Ye=(O,oe)=>{O.stopPropagation(),xe({isOpen:!0,title:"Fork to Personal",description:`This will fork "${oe.name}" into your personal skills. You can edit and customize the fork, and optionally contribute changes back to the team.`,variant:"primary",confirmText:"Fork Skill",onConfirm:()=>{x(oe)}})},it=(O,oe,be)=>{O.stopPropagation(),m(oe,be)},Et=(O,oe)=>{O.stopPropagation(),K({isOpen:!0,skill:oe,reason:""})},H=()=>{Te.skill&&y(Te.skill,Te.reason||void 0),K({isOpen:!1,skill:null,reason:""})},G=(O,oe)=>{O.stopPropagation(),xe({isOpen:!0,title:"Withdraw Publish Request",description:`Withdraw the publish request for "${oe.name}"? The skill will revert to its previous state.`,variant:"warning",confirmText:"Withdraw",onConfirm:()=>{S(oe)}})},se=(O,oe)=>{O.stopPropagation(),xe({isOpen:!0,title:"Delete Skill",description:`Are you sure you want to permanently delete "${oe.name}"? This action cannot be undone.`,variant:"danger",confirmText:"Delete",onConfirm:()=>{v(oe)}})};return a.jsxs("div",{className:"h-full bg-white flex flex-col relative",children:[a.jsx(Bs,{isOpen:$.isOpen,onClose:q,onConfirm:$.onConfirm,title:$.title,description:$.description,variant:$.variant,confirmText:$.confirmText}),Te.isOpen&&a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-gray-900/40 backdrop-blur-sm",onClick:()=>K({isOpen:!1,skill:null,reason:""})}),a.jsx("div",{className:"relative w-full max-w-md bg-white rounded-2xl shadow-xl border border-gray-100 overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:a.jsxs("div",{className:"p-6",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-3 rounded-xl bg-orange-50 flex-shrink-0",children:a.jsx(Ff,{className:"w-6 h-6 text-orange-600"})}),a.jsxs("div",{className:"flex-1 pt-1",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Revert to Personal"}),a.jsxs("p",{className:"text-sm text-gray-500 mb-4",children:['This will move "',(we=Te.skill)==null?void 0:we.name,`" back to the author's personal library.`]}),a.jsx("textarea",{value:Te.reason,onChange:O=>K(oe=>({...oe,reason:O.target.value})),placeholder:"Reason for revert (optional)",className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-orange-200 resize-none",rows:3})]})]}),a.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[a.jsx("button",{onClick:()=>K({isOpen:!1,skill:null,reason:""}),className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:"Cancel"}),a.jsx("button",{onClick:H,className:"px-4 py-2 text-sm font-medium text-white bg-orange-600 hover:bg-orange-700 rounded-lg shadow-sm transition-all",children:"Revert"})]})]})})]}),a.jsxs("header",{className:"h-16 flex items-center justify-between px-6 bg-white sticky top-0 z-10",children:[a.jsxs("div",{className:"flex gap-2",children:[[{id:"all",label:"All Skills",icon:_1},{id:"builtin",label:"System Skills",icon:jp},{id:"team",label:"Team Skills",icon:ss},{id:"personal",label:"My Skills",icon:Ki}].map(O=>a.jsx("button",{onClick:()=>he(O.id),className:B("flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-all border",M===O.id?"bg-gray-900 text-white border-gray-900 shadow-sm":"bg-white text-gray-500 border-transparent hover:bg-gray-50 hover:text-gray-700"),children:O.label},O.id)),C&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-px h-6 bg-gray-200 self-center mx-1"}),a.jsxs("button",{onClick:()=>he("approvals"),className:B("flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-all border",M==="approvals"?"bg-orange-50 text-orange-700 border-orange-200 shadow-sm":"bg-white text-gray-500 border-transparent hover:bg-orange-50 hover:text-orange-600"),children:[a.jsx(u0,{className:"w-3.5 h-3.5"}),"Approvals",i.filter(O=>O.contributionStatus==="pending"||O.reviewStatus==="pending").length>0&&a.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-orange-500 text-[10px] text-white",children:i.filter(O=>O.contributionStatus==="pending"||O.reviewStatus==="pending").length})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative group",children:[a.jsx(kn,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 group-focus-within:text-primary-500 transition-colors"}),a.jsx("input",{type:"text",placeholder:"Search skills...",value:F,onChange:ie,className:"pl-9 pr-3 py-1.5 bg-gray-50 border-none rounded-md text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-200 w-48 transition-all"})]}),M==="personal"&&a.jsx(Je,{content:"Create Skill",children:a.jsx("button",{onClick:He,className:"p-2 rounded-lg text-gray-400 hover:text-gray-900 hover:bg-gray-100 transition-all",children:a.jsx(en,{className:"w-5 h-5"})})})]})]}),V.length>0&&M!=="approvals"&&a.jsxs("div",{className:"px-6 py-2 border-b border-gray-100 bg-gray-50/50 flex items-center gap-2 flex-wrap",children:[a.jsxs("div",{ref:Y,className:"relative",children:[a.jsxs("button",{onClick:()=>R(O=>!O),className:B("flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium border transition-all",ee?"bg-gray-100 text-gray-700 border-gray-300":"bg-white text-gray-500 border-gray-200 hover:border-gray-300 hover:text-gray-700"),children:[a.jsx(Cp,{className:"w-3 h-3"}),"Labels",W.size>0&&a.jsx("span",{className:"flex h-4 min-w-[16px] items-center justify-center rounded-full bg-gray-700 text-[10px] text-white px-1",children:W.size}),a.jsx(rs,{className:B("w-3 h-3 transition-transform",ee&&"rotate-180")})]}),ee&&a.jsx("div",{className:"absolute left-0 top-full mt-1 w-64 bg-white rounded-lg shadow-lg border border-gray-200 z-30 py-1 max-h-80 overflow-y-auto",children:pe.map(({group:O,labels:oe})=>a.jsxs("div",{children:[a.jsx("div",{className:"px-3 py-1.5 text-[10px] font-bold uppercase tracking-wider text-gray-400",children:O}),oe.map(({label:be,count:Me})=>a.jsxs("button",{onClick:()=>ne(be),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs hover:bg-gray-50 transition-colors",children:[a.jsx("span",{className:B("w-3.5 h-3.5 rounded border flex items-center justify-center shrink-0",W.has(be)?"bg-gray-700 border-gray-700 text-white":"border-gray-300"),children:W.has(be)&&a.jsx(qt,{className:"w-2.5 h-2.5"})}),a.jsx("span",{className:B("px-1.5 py-0.5 rounded text-[10px] font-medium border",Q[be]||"bg-gray-50 text-gray-600 border-gray-200"),children:be}),a.jsx("span",{className:"ml-auto text-gray-400 text-[10px]",children:Me})]},be))]},O))})]}),[...W].map(O=>a.jsxs("span",{className:B("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border",Q[O]||"bg-gray-100 text-gray-700 border-gray-300"),children:[O,a.jsx("button",{onClick:()=>ne(O),className:"hover:opacity-70",children:a.jsx(Ge,{className:"w-3 h-3"})})]},O)),W.size>0&&a.jsx("button",{onClick:()=>fe(new Set),className:"px-2 py-0.5 rounded-full text-xs text-gray-400 hover:text-gray-600 flex items-center gap-0.5",children:"Clear all"})]}),a.jsxs("div",{ref:L,onScroll:Ce,className:"flex-1 overflow-y-auto p-8",children:[o?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx(Ae,{className:"w-6 h-6 animate-spin text-gray-400"})}):M==="approvals"?a.jsxs("div",{className:"max-w-4xl mx-auto space-y-4",children:[Le.map(O=>{const oe=O.reviewStatus==="pending",be=O.contributionStatus==="pending";return a.jsx(uF,{skill:O,isScriptReview:oe,isContributionReview:be,isAdmin:C,sendRpc:r,onApproveContribution:async()=>{await b(O)},onRejectContribution:async Me=>{await k(O,Me)},onReviewDecision:async(Me,et,Ve)=>{await j(O,Me,et,Ve)},onNavigate:()=>e(`/skills/${O.id}`)},O.id)}),Le.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-gray-400 text-sm",children:[a.jsx(u0,{className:"w-8 h-8 mb-3 opacity-20"}),"No pending approvals"]})]}):a.jsx("div",{className:"max-w-6xl mx-auto",children:Le.length===0&&!o&&M!=="personal"?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-gray-400 text-sm",children:[a.jsx(ss,{className:"w-8 h-8 mb-3 opacity-20"}),M==="team"?"No team skills yet. Team skills are promoted from personal skills through the approval process.":"No skills found."]}):a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[Le.map(O=>a.jsxs("div",{className:B("group rounded-xl border p-6 hover:shadow-md transition-all duration-200 flex flex-col relative overflow-hidden",O.reviewStatus==="pending"?"bg-amber-50/30 border-amber-100":O.reviewStatus==="draft"?"bg-gray-50/50 border-gray-200":O.enabled?"bg-white border-gray-200":"bg-gray-50/80 border-gray-100"),children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:B("w-8 h-8 rounded-lg border flex items-center justify-center transition-colors",O.enabled?"bg-gray-50 border-gray-100 group-hover:border-gray-200 group-hover:bg-gray-100":"bg-gray-100 border-gray-100"),children:a.jsx(O.icon,{className:B("w-4 h-4",O.enabled?"text-gray-700":"text-gray-400")})}),a.jsx(dF,{enabled:O.enabled,onToggle:oe=>qe(oe,O),disabled:O.reviewStatus==="pending"})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:B("font-bold mb-1",O.enabled?"text-gray-900":"text-gray-400"),children:O.name}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap mb-2",children:[O.contributionStatus==="pending"&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full bg-orange-50 text-orange-600 text-[10px] font-bold border border-orange-100 whitespace-nowrap",children:[a.jsx(ss,{className:"w-2.5 h-2.5"}),"Team Pending"]}),O.reviewStatus==="draft"&&a.jsx("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full bg-gray-50 text-gray-500 text-[10px] font-bold border border-gray-200 whitespace-nowrap",children:"Draft"}),O.reviewStatus==="pending"&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full bg-amber-50 text-amber-700 text-[10px] font-bold border border-amber-200 whitespace-nowrap",children:[a.jsx(bo,{className:"w-2.5 h-2.5"}),"Pending Publish"]}),O.reviewStatus==="approved"&&(O.scope==="personal"||O.scope==="team")&&(()=>{const oe=Number(String(O.version).replace(/^v/,""));return O.publishedVersion!=null&&oe>O.publishedVersion?a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full bg-blue-50 text-blue-600 text-[10px] font-bold border border-blue-200 whitespace-nowrap",children:[a.jsx(qr,{className:"w-2.5 h-2.5"}),"Modified"]}):a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full bg-green-50 text-green-600 text-[10px] font-bold border border-green-200 whitespace-nowrap",children:[a.jsx(qt,{className:"w-2.5 h-2.5"}),"Approved"]})})(),O.scope==="builtin"&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full bg-gray-100 text-gray-600 text-[10px] font-bold border border-gray-200 whitespace-nowrap",children:[a.jsx(wc,{className:"w-2.5 h-2.5"}),"System"]})]}),a.jsx("p",{className:B("text-sm leading-relaxed line-clamp-2",O.enabled?"text-gray-500":"text-gray-400"),children:O.description}),O.labels&&O.labels.length>0&&(()=>{const be=O.labels.slice(0,3),Me=O.labels.length-3;return a.jsxs("div",{className:"flex flex-wrap gap-1 mt-2",children:[be.map(et=>a.jsx("span",{onClick:Ve=>{Ve.stopPropagation(),ne(et)},className:B("px-1.5 py-0.5 rounded text-[10px] font-medium border cursor-pointer hover:opacity-80 transition-opacity",Q[et]||"bg-gray-50 text-gray-600 border-gray-200"),children:et},et)),Me>0&&a.jsx(Je,{content:O.labels.slice(3).join(", "),position:"bottom",children:a.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-gray-100 text-gray-500 border border-gray-200",children:["+",Me]})})]})})()]}),O.scope==="team"&&a.jsxs("div",{className:"mt-auto pt-3 border-t border-gray-50 flex items-center gap-3",children:[a.jsxs("button",{onClick:oe=>it(oe,O,1),className:B("flex items-center gap-1 px-2 py-1 rounded-md text-xs font-medium transition-colors",O.userVote===1?"bg-green-100 text-green-700 border border-green-200":"text-gray-400 hover:text-green-600 hover:bg-green-50"),children:[a.jsx(B1,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:O.upvotes||0})]}),a.jsxs("button",{onClick:oe=>it(oe,O,-1),className:B("flex items-center gap-1 px-2 py-1 rounded-md text-xs font-medium transition-colors",O.userVote===-1?"bg-red-100 text-red-700 border border-red-200":"text-gray-400 hover:text-red-600 hover:bg-red-50"),children:[a.jsx(V1,{className:"w-3.5 h-3.5"}),a.jsx("span",{children:O.downvotes||0})]})]}),a.jsxs("div",{className:B("pt-4 border-t border-gray-50 flex items-center justify-between",O.scope!=="team"&&"mt-auto"),children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-gray-400",children:[a.jsxs("span",{className:B("px-2 py-0.5 rounded flex items-center gap-1",O.scope==="builtin"?"bg-gray-100 text-gray-700":O.scope==="team"?"bg-blue-50 text-blue-700":"bg-purple-50 text-purple-700"),children:[O.scope==="builtin"&&a.jsx(wc,{className:"w-3 h-3"}),O.scope==="builtin"?"System":O.scope==="team"?"Team":"Personal"]}),(O.scope==="team"||O.scope==="personal")&&a.jsx("span",{className:"px-1.5 py-0.5 rounded bg-gray-50 text-gray-500 text-[10px] font-medium border border-gray-100",children:O.version})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[O.scope==="personal"&&O.reviewStatus==="pending"&&a.jsx(Je,{content:"Withdraw",children:a.jsx("button",{onClick:oe=>G(oe,O),className:"p-1.5 text-gray-400 hover:text-orange-600 hover:bg-orange-50 rounded-lg transition-colors",children:a.jsx(F1,{className:"w-4 h-4"})})}),O.scope==="personal"&&O.reviewStatus!=="pending"&&a.jsx(Je,{content:"Request Publish",children:a.jsx("button",{onClick:oe=>jt(oe,O),className:"p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",children:a.jsx(A5,{className:"w-4 h-4"})})}),O.scope==="personal"&&O.reviewStatus==="approved"&&O.contributionStatus!=="pending"&&a.jsx(Je,{content:"Contribute to Team",children:a.jsx("button",{onClick:oe=>vt(oe,O),className:"p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-colors",children:a.jsx(_5,{className:"w-4 h-4"})})}),O.scope!=="personal"&&a.jsx(Je,{content:"Fork to Personal",children:a.jsx("button",{onClick:oe=>Ye(oe,O),className:"p-1.5 text-gray-400 hover:text-purple-600 hover:bg-purple-50 rounded-lg transition-colors",children:a.jsx(bp,{className:"w-4 h-4"})})}),w&&O.scope==="team"&&a.jsx(Je,{content:"Revert to Personal",children:a.jsx("button",{onClick:oe=>Et(oe,O),className:"p-1.5 text-gray-400 hover:text-orange-600 hover:bg-orange-50 rounded-lg transition-colors",children:a.jsx(Ff,{className:"w-4 h-4"})})}),(O.scope==="personal"||w&&O.scope==="team")&&a.jsx(Je,{content:"Version History",children:a.jsx("button",{onClick:oe=>{oe.stopPropagation(),e(`/skills/${O.id}?history=true`)},className:"p-1.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition-colors",children:a.jsx(M1,{className:"w-4 h-4"})})}),a.jsx(Je,{content:O.scope==="personal"?"Configure Skill":"View Details",children:a.jsx("button",{onClick:()=>e(`/skills/${O.id}`),className:"p-1.5 text-gray-400 hover:text-primary-600 hover:bg-primary-50 rounded-lg transition-colors",children:O.scope==="personal"?a.jsx(nu,{className:"w-4 h-4"}):a.jsx(Fo,{className:"w-4 h-4"})})}),(O.scope==="personal"||w&&O.scope==="team")&&a.jsx(Je,{content:"Delete Skill",children:a.jsx("button",{onClick:oe=>se(oe,O),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",children:a.jsx(mn,{className:"w-4 h-4"})})})]})]})]},O.id)),M==="personal"&&a.jsxs("button",{onClick:He,className:"border-2 border-dashed border-gray-200 rounded-xl p-6 flex flex-col items-center justify-center text-gray-400 hover:border-primary-300 hover:text-primary-600 hover:bg-primary-50/50 transition-all gap-3 min-h-[200px]",children:[a.jsx("div",{className:"p-3 rounded-full bg-gray-50 group-hover:bg-white",children:a.jsx(en,{className:"w-6 h-6"})}),a.jsx("span",{className:"font-semibold text-sm",children:"Create Custom Skill"})]})]})}),l&&a.jsx("div",{className:"flex items-center justify-center py-6",children:a.jsx(Ae,{className:"w-5 h-5 animate-spin text-gray-400"})})]})]})}const jl={low:"bg-green-50 text-green-700 border-green-200",medium:"bg-yellow-50 text-yellow-700 border-yellow-200",high:"bg-orange-50 text-orange-700 border-orange-200",critical:"bg-red-50 text-red-700 border-red-200"},cF={critical:zs,high:zs,medium:zs,low:tu};function uF({skill:e,isScriptReview:t,isContributionReview:n,isAdmin:r,sendRpc:s,onApproveContribution:i,onRejectContribution:o,onReviewDecision:l,onNavigate:c}){const[u,f]=g.useState(!1),[d,h]=g.useState([]),[p,x]=g.useState(null),[b,k]=g.useState(!1),[v,m]=g.useState(""),[y,j]=g.useState(!1),[S,N]=g.useState(new Set),[w,C]=g.useState(null),[D,T]=g.useState(!1),[M,P]=g.useState(!1),[F,z]=g.useState({isOpen:!1,title:"",description:"",variant:"primary",confirmText:"",onConfirm:()=>{}}),[W,fe]=g.useState({isOpen:!1,message:""}),ee=async()=>{if(u){f(!1);return}f(!0),k(!0);try{const Q=[mh(s,String(e.id)),Z6(s,String(e.id))],te=await Promise.all(Q);x(te[0]),te[1]&&h(te[1].reviews)}catch(Q){console.error("[Approvals] Failed to load review data:",Q)}finally{k(!1)}},R=async()=>{if(w!==null){P(!M);return}T(!0),P(!0);try{const Q=await tF(s,String(e.id),n);C(Q.diff||"No changes detected.")}catch(Q){console.error("[Approvals] Failed to load diff:",Q),C("Failed to load diff.")}finally{T(!1)}},V=async Q=>{j(!0);try{t?await l(Q,v||void 0,p==null?void 0:p.stagingVersion):n&&(Q==="approve"?await i():await o(v||void 0))}catch(te){const pe=(te==null?void 0:te.message)||String(te);pe.includes("STAGING_VERSION_CONFLICT")?fe({isOpen:!0,message:"Content has changed since you reviewed it. Please reload and review again."}):fe({isOpen:!0,message:pe})}finally{j(!1)}},E=Q=>{z(Q==="approve"?{isOpen:!0,title:"Approve Skill",description:`Are you sure you want to approve "${e.name}"? It will become active in production.`,variant:"primary",confirmText:n?"Approve & Publish to Team":"Approve",onConfirm:()=>V("approve")}:{isOpen:!0,title:"Reject Skill",description:`Are you sure you want to reject "${e.name}"?${v?"":" You can add a reason above before confirming."}`,variant:"danger",confirmText:"Reject",onConfirm:()=>V("reject")})},Y=Q=>{N(te=>{const pe=new Set(te);return pe.has(Q)?pe.delete(Q):pe.add(Q),pe})},J=d.find(Q=>Q.reviewerType==="ai"),L={builtin:{label:"System Skills",cls:"bg-gray-100 text-gray-700",icon:wc},team:{label:"Team Skills",cls:"bg-blue-50 text-blue-700 border-blue-100",icon:ss},personal:{label:"Personal",cls:"bg-purple-50 text-purple-700 border-purple-100",icon:Ki}}[e.scope]||{label:e.scope,cls:"bg-gray-100 text-gray-600",icon:Ki};return a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden hover:shadow-sm transition-shadow",children:[a.jsx(Bs,{isOpen:F.isOpen,onClose:()=>z(Q=>({...Q,isOpen:!1})),onConfirm:F.onConfirm,title:F.title,description:F.description,variant:F.variant,confirmText:F.confirmText}),a.jsx(Bs,{isOpen:W.isOpen,onClose:()=>fe({isOpen:!1,message:""}),onConfirm:()=>{},title:"Operation Failed",description:W.message,variant:"danger",confirmText:"OK"}),a.jsxs("div",{className:"p-4 flex items-center justify-between cursor-pointer",onClick:ee,children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:B("w-10 h-10 rounded-lg border flex items-center justify-center",t?"bg-amber-50 border-amber-100 text-amber-600":n?"bg-blue-50 border-blue-100 text-blue-600":"bg-orange-50 border-orange-100 text-orange-600"),children:t?a.jsx(bo,{className:"w-5 h-5"}):n?a.jsx(ss,{className:"w-5 h-5"}):a.jsx(e.icon,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("h3",{className:"font-bold text-gray-900",children:e.name}),a.jsxs("span",{className:B("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium border",L.cls),children:[a.jsx(L.icon,{className:"w-2.5 h-2.5"}),L.label]}),t&&a.jsxs("span",{className:B("inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] font-bold border","bg-amber-50 text-amber-700 border-amber-200"),children:[a.jsx(w5,{className:"w-2.5 h-2.5"})," Publish Request"]}),n&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full bg-blue-50 text-blue-700 text-[10px] font-bold border border-blue-200",children:[a.jsx(ss,{className:"w-2.5 h-2.5"}),"Team Promotion"]}),J&&a.jsx("span",{className:B("px-1.5 py-0.5 rounded-full text-[10px] font-bold border uppercase",jl[J.riskLevel]||jl.low),children:J.riskLevel}),a.jsx("span",{className:"px-2 py-0.5 rounded-full bg-purple-50 text-purple-700 text-[10px] font-medium border border-purple-100",children:e.author||"Unknown"})]}),a.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:e.description})]})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsx(Je,{content:"View in Editor",children:a.jsx("button",{onClick:Q=>{Q.stopPropagation(),c()},className:"p-2 text-gray-400 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors",children:a.jsx(Fo,{className:"w-4 h-4"})})}),a.jsx("button",{className:"p-2 text-gray-400 hover:text-gray-700 transition-colors",children:u?a.jsx(Bl,{className:"w-4 h-4"}):a.jsx(rs,{className:"w-4 h-4"})})]})]}),u&&a.jsx("div",{className:"border-t border-gray-100 p-6 space-y-4 bg-gray-50/30",children:b?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx(Ae,{className:"w-5 h-5 animate-spin text-gray-400"})}):a.jsxs(a.Fragment,{children:[J&&a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[a.jsx("h4",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider mb-3",children:"AI Review Summary"}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx("span",{className:"text-sm text-gray-600",children:"Risk Level:"}),a.jsx("span",{className:B("px-2 py-0.5 rounded-full text-xs font-bold border uppercase",jl[J.riskLevel]||jl.low),children:J.riskLevel})]}),a.jsx("p",{className:"text-sm text-gray-600 mb-3",children:J.summary}),J.findings&&J.findings.length>0&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("span",{className:"text-xs font-medium text-gray-500",children:[J.findings.length," finding(s):"]}),J.findings.map((Q,te)=>{const pe=cF[Q.severity]||tu;return a.jsxs("div",{className:B("flex items-start gap-2 p-2 rounded-md text-sm border",Q.severity==="critical"?"bg-red-50/50 border-red-100":Q.severity==="high"?"bg-orange-50/50 border-orange-100":Q.severity==="medium"?"bg-yellow-50/50 border-yellow-100":"bg-gray-50 border-gray-100"),children:[a.jsx(pe,{className:B("w-4 h-4 mt-0.5 shrink-0",Q.severity==="critical"?"text-red-500":Q.severity==="high"?"text-orange-500":Q.severity==="medium"?"text-yellow-500":"text-gray-400")}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-gray-700",children:Q.description}),Q.lineRef&&a.jsxs("span",{className:"text-gray-400 text-xs ml-2",children:["(",Q.lineRef,")"]}),Q.snippet&&a.jsx("pre",{className:"mt-1 text-xs bg-gray-100 rounded px-2 py-1 overflow-x-auto text-gray-600",children:Q.snippet})]})]},te)})]})]}),!J&&a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4 text-center text-sm text-gray-400",children:[a.jsx(Ae,{className:"w-4 h-4 animate-spin inline mr-2"}),"AI review in progress..."]}),(t||n)&&a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden",children:[a.jsxs("button",{onClick:R,className:"w-full flex items-center gap-2 px-4 py-3 text-sm text-left hover:bg-gray-50 transition-colors",children:[a.jsx(M1,{className:"w-4 h-4 text-indigo-500"}),a.jsx("span",{className:"font-bold text-xs text-gray-400 uppercase tracking-wider flex-1",children:"Changes (Diff)"}),D?a.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin text-gray-400"}):M?a.jsx(Bl,{className:"w-3.5 h-3.5 text-gray-400"}):a.jsx(rs,{className:"w-3.5 h-3.5 text-gray-400"})]}),M&&w!==null&&a.jsx("div",{className:"border-t border-gray-100",children:a.jsx("pre",{className:"p-3 bg-[#1e1e1e] text-xs font-mono overflow-x-auto max-h-80 overflow-y-auto",children:w.split(`
605
+ `).map((Q,te)=>a.jsx("div",{className:B(Q.startsWith("+")&&!Q.startsWith("+++")?"text-green-400 bg-green-950/30":Q.startsWith("-")&&!Q.startsWith("---")?"text-red-400 bg-red-950/30":Q.startsWith("@@")?"text-cyan-400":"text-[#d4d4d4]"),children:Q},te))})})]}),(()=>{const Q=p==null?void 0:p.scripts;return Q&&Q.length>0?a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[a.jsx("h4",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider mb-3",children:"Scripts"}),a.jsx("div",{className:"space-y-2",children:Q.map(te=>a.jsxs("div",{className:"border border-gray-100 rounded-lg overflow-hidden",children:[a.jsxs("button",{onClick:()=>Y(te.name),className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-gray-50 transition-colors",children:[a.jsx("div",{className:B("w-6 h-6 rounded flex items-center justify-center shrink-0",te.info==="python"?"bg-blue-50 text-blue-600":"bg-green-50 text-green-600"),children:te.info==="python"?a.jsx(qr,{className:"w-3 h-3"}):a.jsx(Fn,{className:"w-3 h-3"})}),a.jsx("span",{className:"font-medium text-gray-700 flex-1",children:te.name}),S.has(te.name)?a.jsx(Bl,{className:"w-3.5 h-3.5 text-gray-400"}):a.jsx(rs,{className:"w-3.5 h-3.5 text-gray-400"})]}),S.has(te.name)&&a.jsx("pre",{className:"p-3 bg-[#1e1e1e] text-[#d4d4d4] text-xs font-mono overflow-x-auto max-h-64 overflow-y-auto",children:te.content})]},te.id))})]}):null})(),(p==null?void 0:p.specs)&&a.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[a.jsx("h4",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider mb-3",children:"SKILL.md (Specs)"}),a.jsx("pre",{className:"text-xs text-gray-600 bg-gray-50 rounded-lg p-3 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap",children:p.specs})]}),r&&(t||n)&&a.jsxs("div",{className:"space-y-3 pt-2",children:[a.jsx("textarea",{value:v,onChange:Q=>m(Q.target.value),placeholder:"Reason for rejection (optional, visible to the author)",className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-amber-200 resize-none",rows:2}),a.jsxs("div",{className:"flex items-center justify-end gap-3",children:[a.jsxs("button",{onClick:()=>E("reject"),disabled:y,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-red-700 bg-red-50 border border-red-200 hover:bg-red-100 rounded-lg transition-all disabled:opacity-50",children:[a.jsx(Ge,{className:"w-4 h-4"}),"Reject"]}),a.jsxs("button",{onClick:()=>E("approve"),disabled:y,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-green-700 bg-green-50 border border-green-200 hover:bg-green-100 rounded-lg transition-all disabled:opacity-50",children:[a.jsx(qt,{className:"w-4 h-4"}),n?"Approve & Publish to Team":"Approve"]})]})]})]})})]})}function dF({enabled:e,onToggle:t,disabled:n}){return a.jsx(Je,{content:n?"Under review":e?"Disable Skill":"Enable Skill",children:a.jsx("button",{role:"switch","aria-checked":e,onClick:n?void 0:t,disabled:n,className:B("relative inline-flex h-5 w-9 flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",n?"bg-gray-200 opacity-50 cursor-not-allowed":e?"bg-green-500 focus-visible:ring-green-500 cursor-pointer":"bg-gray-200 focus-visible:ring-gray-400 cursor-pointer"),children:a.jsx("span",{className:B("pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-in-out",e&&!n?"translate-x-4":"translate-x-0")})})})}var zS={},Rt=Jt&&Jt.__assign||function(){return Rt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Rt.apply(this,arguments)},fF=Jt&&Jt.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var s=Object.getOwnPropertyDescriptor(t,n);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,s)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),hF=Jt&&Jt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),pF=Jt&&Jt.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&fF(t,e,n);return hF(t,e),t},mF=Jt&&Jt.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n};Object.defineProperty(zS,"__esModule",{value:!0});var An=pF(g),gF=89,Nl=90,xF=77,zy=57,Vy=219,By=222,Uy=192,$y=100,yF=3e3,vF=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),Ld=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),Gl="npm__react-simple-code-editor__textarea",bF=`
606
+ /**
607
+ * Reset the text fill color so that placeholder is visible
608
+ */
609
+ .`.concat(Gl,`:empty {
610
+ -webkit-text-fill-color: inherit !important;
611
+ }
612
+
613
+ /**
614
+ * Hack to apply on some CSS on IE10 and IE11
615
+ */
616
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
617
+ /**
618
+ * IE doesn't support '-webkit-text-fill-color'
619
+ * So we use 'color: transparent' to make the text transparent on IE
620
+ * Unlike other browsers, it doesn't affect caret color in IE
621
+ */
622
+ .`).concat(Gl,` {
623
+ color: transparent !important;
624
+ }
625
+
626
+ .`).concat(Gl,`::selection {
627
+ background-color: #accef7 !important;
628
+ color: transparent !important;
629
+ }
630
+ }
631
+ `),wF=An.forwardRef(function(t,n){var r=t.autoFocus,s=t.disabled,i=t.form,o=t.highlight,l=t.ignoreTabKey,c=l===void 0?!1:l,u=t.insertSpaces,f=u===void 0?!0:u,d=t.maxLength,h=t.minLength,p=t.name,x=t.onBlur,b=t.onClick,k=t.onFocus,v=t.onKeyDown,m=t.onKeyUp,y=t.onValueChange,j=t.padding,S=j===void 0?0:j,N=t.placeholder,w=t.preClassName,C=t.readOnly,D=t.required,T=t.style,M=t.tabSize,P=M===void 0?2:M,F=t.textareaClassName,z=t.textareaId,W=t.value,fe=mF(t,["autoFocus","disabled","form","highlight","ignoreTabKey","insertSpaces","maxLength","minLength","name","onBlur","onClick","onFocus","onKeyDown","onKeyUp","onValueChange","padding","placeholder","preClassName","readOnly","required","style","tabSize","textareaClassName","textareaId","value"]),ee=An.useRef({stack:[],offset:-1}),R=An.useRef(null),V=An.useState(!0),E=V[0],Y=V[1],J={paddingTop:typeof S=="object"?S.top:S,paddingRight:typeof S=="object"?S.right:S,paddingBottom:typeof S=="object"?S.bottom:S,paddingLeft:typeof S=="object"?S.left:S},L=o(W),Q=function($,xe){return $.substring(0,xe).split(`
632
+ `)},te=An.useCallback(function($,xe){var q,ye,Le;xe===void 0&&(xe=!1);var He=ee.current,qe=He.stack,St=He.offset;if(qe.length&&St>-1){ee.current.stack=qe.slice(0,St+1);var jt=ee.current.stack.length;if(jt>$y){var vt=jt-$y;ee.current.stack=qe.slice(vt,jt),ee.current.offset=Math.max(ee.current.offset-vt,0)}}var Ye=Date.now();if(xe){var it=ee.current.stack[ee.current.offset];if(it&&Ye-it.timestamp<yF){var Et=/[^a-z0-9]([a-z0-9]+)$/i,H=(q=Q(it.value,it.selectionStart).pop())===null||q===void 0?void 0:q.match(Et),G=(ye=Q($.value,$.selectionStart).pop())===null||ye===void 0?void 0:ye.match(Et);if(H!=null&&H[1]&&(!((Le=G==null?void 0:G[1])===null||Le===void 0)&&Le.startsWith(H[1]))){ee.current.stack[ee.current.offset]=Rt(Rt({},$),{timestamp:Ye});return}}}ee.current.stack.push(Rt(Rt({},$),{timestamp:Ye})),ee.current.offset++},[]),pe=An.useCallback(function(){var $=R.current;if($){var xe=$.value,q=$.selectionStart,ye=$.selectionEnd;te({value:xe,selectionStart:q,selectionEnd:ye})}},[te]),ne=function($){var xe=R.current;xe&&(xe.value=$.value,xe.selectionStart=$.selectionStart,xe.selectionEnd=$.selectionEnd,y==null||y($.value))},ie=function($){var xe=R.current,q=ee.current.stack[ee.current.offset];q&&xe&&(ee.current.stack[ee.current.offset]=Rt(Rt({},q),{selectionStart:xe.selectionStart,selectionEnd:xe.selectionEnd})),te($),ne($)},he=function(){var $=ee.current,xe=$.stack,q=$.offset,ye=xe[q-1];ye&&(ne(ye),ee.current.offset=Math.max(q-1,0))},Ce=function(){var $=ee.current,xe=$.stack,q=$.offset,ye=xe[q+1];ye&&(ne(ye),ee.current.offset=Math.min(q+1,xe.length-1))},Te=function($){if(!(v&&(v($),$.defaultPrevented))){$.key==="Escape"&&$.currentTarget.blur();var xe=$.currentTarget,q=xe.value,ye=xe.selectionStart,Le=xe.selectionEnd,He=(f?" ":" ").repeat(P);if($.key==="Tab"&&!c&&E)if($.preventDefault(),$.shiftKey){var qe=Q(q,ye),St=qe.length-1,jt=Q(q,Le).length-1,vt=q.split(`
633
+ `).map(function(Me,et){return et>=St&&et<=jt&&Me.startsWith(He)?Me.substring(He.length):Me}).join(`
634
+ `);if(q!==vt){var Ye=qe[St];ie({value:vt,selectionStart:Ye!=null&&Ye.startsWith(He)?ye-He.length:ye,selectionEnd:Le-(q.length-vt.length)})}}else if(ye!==Le){var qe=Q(q,ye),it=qe.length-1,Et=Q(q,Le).length-1,Ye=qe[it];ie({value:q.split(`
635
+ `).map(function(Ve,tt){return tt>=it&&tt<=Et?He+Ve:Ve}).join(`
636
+ `),selectionStart:Ye&&/\S/.test(Ye)?ye+He.length:ye,selectionEnd:Le+He.length*(Et-it+1)})}else{var H=ye+He.length;ie({value:q.substring(0,ye)+He+q.substring(Le),selectionStart:H,selectionEnd:H})}else if($.key==="Backspace"){var G=ye!==Le,se=q.substring(0,ye);if(se.endsWith(He)&&!G){$.preventDefault();var H=ye-He.length;ie({value:q.substring(0,ye-He.length)+q.substring(Le),selectionStart:H,selectionEnd:H})}}else if($.key==="Enter"){if(ye===Le){var we=Q(q,ye).pop(),O=we==null?void 0:we.match(/^\s+/);if(O!=null&&O[0]){$.preventDefault();var oe=`
637
+ `+O[0],H=ye+oe.length;ie({value:q.substring(0,ye)+oe+q.substring(Le),selectionStart:H,selectionEnd:H})}}}else if($.keyCode===zy||$.keyCode===Vy||$.keyCode===By||$.keyCode===Uy){var be=void 0;$.keyCode===zy&&$.shiftKey?be=["(",")"]:$.keyCode===Vy?$.shiftKey?be=["{","}"]:be=["[","]"]:$.keyCode===By?$.shiftKey?be=['"','"']:be=["'","'"]:$.keyCode===Uy&&!$.shiftKey&&(be=["`","`"]),ye!==Le&&be&&($.preventDefault(),ie({value:q.substring(0,ye)+be[0]+q.substring(ye,Le)+be[1]+q.substring(Le),selectionStart:ye,selectionEnd:Le+2}))}else(Ld?$.metaKey&&$.keyCode===Nl:$.ctrlKey&&$.keyCode===Nl)&&!$.shiftKey&&!$.altKey?($.preventDefault(),he()):(Ld?$.metaKey&&$.keyCode===Nl&&$.shiftKey:vF?$.ctrlKey&&$.keyCode===gF:$.ctrlKey&&$.keyCode===Nl&&$.shiftKey)&&!$.altKey?($.preventDefault(),Ce()):$.keyCode===xF&&$.ctrlKey&&(!Ld||$.shiftKey)&&($.preventDefault(),Y(function(Me){return!Me}))}},K=function($){var xe=$.currentTarget,q=xe.value,ye=xe.selectionStart,Le=xe.selectionEnd;te({value:q,selectionStart:ye,selectionEnd:Le},!0),y(q)};return An.useEffect(function(){pe()},[pe]),An.useImperativeHandle(n,function(){return{get session(){return{history:ee.current}},set session($){ee.current=$.history}}},[]),An.createElement("div",Rt({},fe,{style:Rt(Rt({},Na.container),T)}),An.createElement("pre",Rt({className:w,"aria-hidden":"true",style:Rt(Rt(Rt({},Na.editor),Na.highlight),J)},typeof L=="string"?{dangerouslySetInnerHTML:{__html:L+"<br />"}}:{children:L})),An.createElement("textarea",{ref:function($){return R.current=$},style:Rt(Rt(Rt({},Na.editor),Na.textarea),J),className:Gl+(F?" ".concat(F):""),id:z,value:W,onChange:K,onKeyDown:Te,onClick:b,onKeyUp:m,onFocus:k,onBlur:x,disabled:s,form:i,maxLength:d,minLength:h,name:p,placeholder:N,readOnly:C,required:D,autoFocus:r,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-gramm":!1}),An.createElement("style",{dangerouslySetInnerHTML:{__html:bF}}))}),Na={container:{position:"relative",textAlign:"left",boxSizing:"border-box",padding:0,overflow:"hidden"},textarea:{position:"absolute",top:0,left:0,height:"100%",width:"100%",resize:"none",color:"inherit",overflow:"hidden",MozOsxFontSmoothing:"grayscale",WebkitFontSmoothing:"antialiased",WebkitTextFillColor:"transparent"},highlight:{position:"relative",pointerEvents:"none"},editor:{margin:0,border:0,background:"none",boxSizing:"inherit",display:"inherit",fontFamily:"inherit",fontSize:"inherit",fontStyle:"inherit",fontVariantLigatures:"inherit",fontWeight:"inherit",letterSpacing:"inherit",lineHeight:"inherit",tabSize:"inherit",textIndent:"inherit",textRendering:"inherit",textTransform:"inherit",whiteSpace:"pre-wrap",wordBreak:"keep-all",overflowWrap:"break-word"}},kF=zS.default=wF,VS={exports:{}};(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
638
+ * Prism: Lightweight, robust, elegant syntax highlighting
639
+ *
640
+ * @license MIT <https://opensource.org/licenses/MIT>
641
+ * @author Lea Verou <https://lea.verou.me>
642
+ * @namespace
643
+ * @public
644
+ */var n=function(r){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,i=0,o={},l={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function m(y){return y instanceof c?new c(y.type,m(y.content),y.alias):Array.isArray(y)?y.map(m):y.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(m){return Object.prototype.toString.call(m).slice(8,-1)},objId:function(m){return m.__id||Object.defineProperty(m,"__id",{value:++i}),m.__id},clone:function m(y,j){j=j||{};var S,N;switch(l.util.type(y)){case"Object":if(N=l.util.objId(y),j[N])return j[N];S={},j[N]=S;for(var w in y)y.hasOwnProperty(w)&&(S[w]=m(y[w],j));return S;case"Array":return N=l.util.objId(y),j[N]?j[N]:(S=[],j[N]=S,y.forEach(function(C,D){S[D]=m(C,j)}),S);default:return y}},getLanguage:function(m){for(;m;){var y=s.exec(m.className);if(y)return y[1].toLowerCase();m=m.parentElement}return"none"},setLanguage:function(m,y){m.className=m.className.replace(RegExp(s,"gi"),""),m.classList.add("language-"+y)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(S){var m=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(m){var y=document.getElementsByTagName("script");for(var j in y)if(y[j].src==m)return y[j]}return null}},isActive:function(m,y,j){for(var S="no-"+y;m;){var N=m.classList;if(N.contains(y))return!0;if(N.contains(S))return!1;m=m.parentElement}return!!j}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(m,y){var j=l.util.clone(l.languages[m]);for(var S in y)j[S]=y[S];return j},insertBefore:function(m,y,j,S){S=S||l.languages;var N=S[m],w={};for(var C in N)if(N.hasOwnProperty(C)){if(C==y)for(var D in j)j.hasOwnProperty(D)&&(w[D]=j[D]);j.hasOwnProperty(C)||(w[C]=N[C])}var T=S[m];return S[m]=w,l.languages.DFS(l.languages,function(M,P){P===T&&M!=m&&(this[M]=w)}),w},DFS:function m(y,j,S,N){N=N||{};var w=l.util.objId;for(var C in y)if(y.hasOwnProperty(C)){j.call(y,C,y[C],S||C);var D=y[C],T=l.util.type(D);T==="Object"&&!N[w(D)]?(N[w(D)]=!0,m(D,j,null,N)):T==="Array"&&!N[w(D)]&&(N[w(D)]=!0,m(D,j,C,N))}}},plugins:{},highlightAll:function(m,y){l.highlightAllUnder(document,m,y)},highlightAllUnder:function(m,y,j){var S={callback:j,container:m,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),l.hooks.run("before-all-elements-highlight",S);for(var N=0,w;w=S.elements[N++];)l.highlightElement(w,y===!0,S.callback)},highlightElement:function(m,y,j){var S=l.util.getLanguage(m),N=l.languages[S];l.util.setLanguage(m,S);var w=m.parentElement;w&&w.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(w,S);var C=m.textContent,D={element:m,language:S,grammar:N,code:C};function T(P){D.highlightedCode=P,l.hooks.run("before-insert",D),D.element.innerHTML=D.highlightedCode,l.hooks.run("after-highlight",D),l.hooks.run("complete",D),j&&j.call(D.element)}if(l.hooks.run("before-sanity-check",D),w=D.element.parentElement,w&&w.nodeName.toLowerCase()==="pre"&&!w.hasAttribute("tabindex")&&w.setAttribute("tabindex","0"),!D.code){l.hooks.run("complete",D),j&&j.call(D.element);return}if(l.hooks.run("before-highlight",D),!D.grammar){T(l.util.encode(D.code));return}if(y&&r.Worker){var M=new Worker(l.filename);M.onmessage=function(P){T(P.data)},M.postMessage(JSON.stringify({language:D.language,code:D.code,immediateClose:!0}))}else T(l.highlight(D.code,D.grammar,D.language))},highlight:function(m,y,j){var S={code:m,grammar:y,language:j};if(l.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=l.tokenize(S.code,S.grammar),l.hooks.run("after-tokenize",S),c.stringify(l.util.encode(S.tokens),S.language)},tokenize:function(m,y){var j=y.rest;if(j){for(var S in j)y[S]=j[S];delete y.rest}var N=new d;return h(N,N.head,m),f(m,N,y,N.head,0),x(N)},hooks:{all:{},add:function(m,y){var j=l.hooks.all;j[m]=j[m]||[],j[m].push(y)},run:function(m,y){var j=l.hooks.all[m];if(!(!j||!j.length))for(var S=0,N;N=j[S++];)N(y)}},Token:c};r.Prism=l;function c(m,y,j,S){this.type=m,this.content=y,this.alias=j,this.length=(S||"").length|0}c.stringify=function m(y,j){if(typeof y=="string")return y;if(Array.isArray(y)){var S="";return y.forEach(function(T){S+=m(T,j)}),S}var N={type:y.type,content:m(y.content,j),tag:"span",classes:["token",y.type],attributes:{},language:j},w=y.alias;w&&(Array.isArray(w)?Array.prototype.push.apply(N.classes,w):N.classes.push(w)),l.hooks.run("wrap",N);var C="";for(var D in N.attributes)C+=" "+D+'="'+(N.attributes[D]||"").replace(/"/g,"&quot;")+'"';return"<"+N.tag+' class="'+N.classes.join(" ")+'"'+C+">"+N.content+"</"+N.tag+">"};function u(m,y,j,S){m.lastIndex=y;var N=m.exec(j);if(N&&S&&N[1]){var w=N[1].length;N.index+=w,N[0]=N[0].slice(w)}return N}function f(m,y,j,S,N,w){for(var C in j)if(!(!j.hasOwnProperty(C)||!j[C])){var D=j[C];D=Array.isArray(D)?D:[D];for(var T=0;T<D.length;++T){if(w&&w.cause==C+","+T)return;var M=D[T],P=M.inside,F=!!M.lookbehind,z=!!M.greedy,W=M.alias;if(z&&!M.pattern.global){var fe=M.pattern.toString().match(/[imsuy]*$/)[0];M.pattern=RegExp(M.pattern.source,fe+"g")}for(var ee=M.pattern||M,R=S.next,V=N;R!==y.tail&&!(w&&V>=w.reach);V+=R.value.length,R=R.next){var E=R.value;if(y.length>m.length)return;if(!(E instanceof c)){var Y=1,J;if(z){if(J=u(ee,V,m,F),!J||J.index>=m.length)break;var pe=J.index,L=J.index+J[0].length,Q=V;for(Q+=R.value.length;pe>=Q;)R=R.next,Q+=R.value.length;if(Q-=R.value.length,V=Q,R.value instanceof c)continue;for(var te=R;te!==y.tail&&(Q<L||typeof te.value=="string");te=te.next)Y++,Q+=te.value.length;Y--,E=m.slice(V,Q),J.index-=V}else if(J=u(ee,0,E,F),!J)continue;var pe=J.index,ne=J[0],ie=E.slice(0,pe),he=E.slice(pe+ne.length),Ce=V+E.length;w&&Ce>w.reach&&(w.reach=Ce);var Te=R.prev;ie&&(Te=h(y,Te,ie),V+=ie.length),p(y,Te,Y);var K=new c(C,P?l.tokenize(ne,P):ne,W,ne);if(R=h(y,Te,K),he&&h(y,R,he),Y>1){var $={cause:C+","+T,reach:Ce};f(m,y,j,R.prev,V,$),w&&$.reach>w.reach&&(w.reach=$.reach)}}}}}}function d(){var m={value:null,prev:null,next:null},y={value:null,prev:m,next:null};m.next=y,this.head=m,this.tail=y,this.length=0}function h(m,y,j){var S=y.next,N={value:j,prev:y,next:S};return y.next=N,S.prev=N,m.length++,N}function p(m,y,j){for(var S=y.next,N=0;N<j&&S!==m.tail;N++)S=S.next;y.next=S,S.prev=y,m.length-=N}function x(m){for(var y=[],j=m.head.next;j!==m.tail;)y.push(j.value),j=j.next;return y}if(!r.document)return r.addEventListener&&(l.disableWorkerMessageHandler||r.addEventListener("message",function(m){var y=JSON.parse(m.data),j=y.language,S=y.code,N=y.immediateClose;r.postMessage(l.highlight(S,l.languages[j],j)),N&&r.close()},!1)),l;var b=l.util.currentScript();b&&(l.filename=b.src,b.hasAttribute("data-manual")&&(l.manual=!0));function k(){l.manual||l.highlightAll()}if(!l.manual){var v=document.readyState;v==="loading"||v==="interactive"&&b&&b.defer?document.addEventListener("DOMContentLoaded",k):window.requestAnimationFrame?window.requestAnimationFrame(k):window.setTimeout(k,16)}return l}(t);e.exports&&(e.exports=n),typeof Jt<"u"&&(Jt.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&amp;/,"&"))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(s,i){var o={};o["language-"+i]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[i]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var l={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};l["language-"+i]={pattern:/[\s\S]+/,inside:n.languages[i]};var c={};c[s]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:l},n.languages.insertBefore("markup","cdata",c)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(r,s){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:n.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,function(r){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var i=r.languages.markup;i&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))}(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,function(){if(typeof n>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",s=function(b,k){return"✖ Error "+b+" while fetching file: "+k},i="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",c="loading",u="loaded",f="failed",d="pre[data-src]:not(["+l+'="'+u+'"]):not(['+l+'="'+c+'"])';function h(b,k,v){var m=new XMLHttpRequest;m.open("GET",b,!0),m.onreadystatechange=function(){m.readyState==4&&(m.status<400&&m.responseText?k(m.responseText):m.status>=400?v(s(m.status,m.statusText)):v(i))},m.send(null)}function p(b){var k=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(b||"");if(k){var v=Number(k[1]),m=k[2],y=k[3];return m?y?[v,Number(y)]:[v,void 0]:[v,v]}}n.hooks.add("before-highlightall",function(b){b.selector+=", "+d}),n.hooks.add("before-sanity-check",function(b){var k=b.element;if(k.matches(d)){b.code="",k.setAttribute(l,c);var v=k.appendChild(document.createElement("CODE"));v.textContent=r;var m=k.getAttribute("data-src"),y=b.language;if(y==="none"){var j=(/\.(\w+)$/.exec(m)||[,"none"])[1];y=o[j]||j}n.util.setLanguage(v,y),n.util.setLanguage(k,y);var S=n.plugins.autoloader;S&&S.loadLanguages(y),h(m,function(N){k.setAttribute(l,u);var w=p(k.getAttribute("data-range"));if(w){var C=N.split(/\r\n?|\n/g),D=w[0],T=w[1]==null?C.length:w[1];D<0&&(D+=C.length),D=Math.max(0,Math.min(D-1,C.length)),T<0&&(T+=C.length),T=Math.max(0,Math.min(T,C.length)),N=C.slice(D,T).join(`
645
+ `),k.hasAttribute("data-start")||k.setAttribute("data-start",String(D+1))}v.textContent=N,n.highlightElement(v)},function(N){k.setAttribute(l,f),v.textContent=N})}}),n.plugins.fileHighlight={highlight:function(k){for(var v=(k||document).querySelectorAll(d),m=0,y;y=v[m++];)n.highlightElement(y)}};var x=!1;n.fileHighlight=function(){x||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),x=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}}()})(VS);var SF=VS.exports;const Cl=Ao(SF);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;(function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],i=r.variable[1].inside,o=0;o<s.length;o++)i[s[o]]=e.languages.bash[s[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);const Md=`inputs:
646
+ - name: target
647
+ description: The target resource to analyze
648
+ required: true
649
+
650
+ outputs:
651
+ - name: analysis_report
652
+ description: Markdown formatted analysis result
653
+
654
+ troubleshooting:
655
+ - "Ensure network connectivity to the target"
656
+
657
+ examples:
658
+ - "run analysis --target=payment-service"`,gh=document.createElement("style");gh.textContent=`
659
+ code[class*="language-"], pre[class*="language-"] {
660
+ text-shadow: none !important;
661
+ font-family: "JetBrains Mono", "Fira Code", monospace !important;
662
+ }
663
+ .token.comment, .token.prolog, .token.doctype, .token.cdata { color: #6a9955; }
664
+ .token.punctuation { color: #d4d4d4; }
665
+ .token.namespace { opacity: .7; }
666
+ .token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted { color: #b5cea8; }
667
+ .token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #ce9178; }
668
+ .token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: #d4d4d4; }
669
+ .token.atrule, .token.attr-value, .token.keyword { color: #c586c0; }
670
+ .token.function, .token.class-name { color: #dcdcaa; }
671
+ .token.regex, .token.important, .token.variable { color: #d16969; }
672
+ `;document.head.querySelector("style[data-prism-custom]")||(gh.setAttribute("data-prism-custom","true"),document.head.appendChild(gh));const jF=["Custom","Database","Security","Network","Core","Utility","Monitoring","Automation"],Dm="siclaw_skill_draft:";function NF(e,t){const n={name:t.name,description:t.description,type:t.type,version:t.version,specs:t.specs||"",scripts:(t.scripts||[]).map(r=>({id:r.id,info:r.info,name:r.name,content:r.content})),savedAt:Date.now()};try{localStorage.setItem(Dm+e,JSON.stringify(n))}catch{}}function CF(e){try{const t=localStorage.getItem(Dm+e);return t?JSON.parse(t):null}catch{return null}}function Ca(e){localStorage.removeItem(Dm+e)}function Hy(e,t){return!e||!t?!1:e.name!==t.name||e.description!==t.description||e.specs!==t.specs||e.type!==t.type||e.version!==t.version||JSON.stringify((e.scripts||[]).map(n=>({id:n.id,info:n.info,name:n.name,content:n.content})))!==JSON.stringify((t.scripts||[]).map(n=>({id:n.id,info:n.info,name:n.name,content:n.content})))}function EF(e){const t=Math.floor((Date.now()-e)/1e3);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function TF(){var Et,H,G,se,we,O,oe,be,Me,et,Ve,tt,It,at;const{id:e}=kC(),t=dr(),[n]=eu(),{sendRpc:r,isConnected:s}=zt(),[i,o]=g.useState(!1),[l,c]=g.useState(null),[u,f]=g.useState(null),[d,h]=g.useState(!1),[p,x]=g.useState(!1),[b,k]=g.useState(!1),v=g.useRef(null),m=g.useRef(null),[y,j]=g.useState(!1),[S,N]=g.useState(!1),[w,C]=g.useState(!1),[D,T]=g.useState([]),[M,P]=g.useState(!1),[F,z]=g.useState(null),[W,fe]=g.useState(null),[ee,R]=g.useState(null),V=e==="new",E=!!l&&l.scope!=="personal",Y=ls(),J=(Y==null?void 0:Y.username)==="admin",L=(l==null?void 0:l.authorId)===(Y==null?void 0:Y.id),Q=async()=>{if(!(!l||!e))try{j(!0);const Z=await FS(r,String(l.id));t(`/skills/${Z.id}`)}catch(Z){console.error("[SkillEditor] Fork failed:",Z)}finally{j(!1)}},te=async()=>{if(!(!e||V)){if(w){C(!1);return}P(!0);try{const Z=await eF(r,e);T(Z.versions),C(!0)}catch(Z){console.error("[SkillEditor] Failed to load history:",Z)}finally{P(!1)}}},pe=async Z=>{if(!(!e||V))try{await _S(r,e,Z);const je=await mh(r,e);if(je){const ze={...je,specs:je.specs||Md,scripts:je.scripts||[]};c(ze),fe(ze),Ca(e)}C(!1),z(null)}catch(je){console.error("[SkillEditor] Rollback failed:",je)}},ne=(l==null?void 0:l.scope)==="personal"&&L||(l==null?void 0:l.scope)==="team"&&J;g.useEffect(()=>{if(x(!1),k(!1),R(null),!e)return;const Z=ze=>{fe(ze);const ot=CF(e);ot&&ot.savedAt>0?(c({...ze,name:ot.name,description:ot.description,type:ot.type,version:ot.version,specs:ot.specs,scripts:ot.scripts}),R({savedAt:ot.savedAt})):c(ze)};if(e==="new"){m.current=null;const ze={id:`new-${Date.now()}`,name:"New Custom Skill",description:"Describe what this skill does...",type:"Custom",icon:Rs,status:"not_installed",version:"0.0.1",specs:Md,scripts:[],scope:"personal",author:"Current User",contributionStatus:"none",enabled:!0};Z(ze),o(!1),f(null);return}if(!s||m.current===e)return;m.current=e;let je=!1;return mh(r,e).then(ze=>{if(!je)if(ze){const ot={...ze,specs:ze.specs||Md,scripts:ze.scripts||[]};Z(ot)}else t("/skills")}),()=>{je=!0}},[e,t,s,r]),g.useEffect(()=>{n.get("history")==="true"&&!w&&!V&&te()},[n]);const ie=g.useMemo(()=>Hy(l,W),[l,W]);g.useEffect(()=>{if(!e||!l||!W||E)return;const Z=setTimeout(()=>{Hy(l,W)?NF(e,l):Ca(e)},1e3);return()=>clearTimeout(Z)},[e,l,W,E]),g.useEffect(()=>{const Z=je=>{ie&&je.preventDefault()};return window.addEventListener("beforeunload",Z),()=>window.removeEventListener("beforeunload",Z)},[ie]);const he=g.useRef(!1),Ce=LC(()=>ie&&!he.current),Te=g.useCallback(()=>{e&&W&&(Ca(e),c(W),R(null))},[e,W]),K=g.useCallback(()=>{R(null)},[]),$=async()=>{if(l)try{h(!0),await K6(r,l,V),e&&Ca(e),fe(l),he.current=!0,t("/skills")}catch(Z){console.error("[SkillEditor] Save failed:",Z)}finally{h(!1)}},xe=()=>{l&&N(!0)},q=async()=>{if(l)try{await G6(r,String(l.id)),e&&Ca(e),he.current=!0,t("/skills")}catch(Z){console.error("[SkillEditor] Delete failed:",Z)}},[ye,Le]=g.useState(null),[He,qe]=g.useState(""),St=Z=>{Le(Z),qe(Z==="python"?"script.py":"script.sh"),x(!1)},jt=()=>{if(!ye||!He.trim())return;const Z={id:`new-${Date.now()}`,info:ye,name:He.trim(),content:ye==="python"?'print("New Python Script")':`#!/bin/bash
673
+
674
+ echo "New Shell Script"`};c(je=>je?{...je,scripts:[...je.scripts||[],Z]}:null),f(Z.id),Le(null),qe("")},vt=(Z,je)=>{if(Z.stopPropagation(),!(l!=null&&l.scripts))return;const ze=l.scripts.filter(ot=>ot.id!==je);c({...l,scripts:ze}),u===je&&ze.length>0?f(ze[0].id):u===je&&ze.length===0&&f(null)},Ye=Z=>{var ot;const je=(ot=Z.target.files)==null?void 0:ot[0];if(!je)return;const ze=new FileReader;ze.onload=ys=>{var hr;const ri=(hr=ys.target)==null?void 0:hr.result,vs=je.name.endsWith(".py"),bs={id:`upload-${Date.now()}`,info:vs?"python":"shell",name:je.name,content:ri};c(Zn=>Zn?{...Zn,scripts:[...Zn.scripts||[],bs]}:null),f(bs.id)},ze.readAsText(je),Z.target.value=""},it=Z=>{l&&c({...l,name:Z.target.value})};return l?a.jsxs("div",{className:"h-full bg-white flex flex-col relative",children:[a.jsx(Xn,{children:ye&&a.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-black/20 backdrop-blur-[1px]",children:a.jsxs(Ot.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},className:"bg-white rounded-xl shadow-2xl border border-gray-100 p-5 w-80 space-y-4",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"text-sm font-bold text-gray-900",children:["New ",ye==="python"?"Python":"Shell"," Script"]}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Enter a filename for your script."})]}),a.jsx("input",{autoFocus:!0,type:"text",value:He,onChange:Z=>qe(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&jt(),className:"w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg text-sm text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary-500/50",placeholder:ye==="python"?"script.py":"script.sh"}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:()=>Le(null),className:"px-3 py-1.5 text-xs font-medium text-gray-500 hover:text-gray-700 hover:bg-gray-50 rounded-lg transition-colors",children:"Cancel"}),a.jsx("button",{onClick:jt,disabled:!He.trim(),className:"px-3 py-1.5 text-xs font-medium bg-primary-600 text-white hover:bg-primary-700 rounded-lg shadow-sm disabled:opacity-50 transition-all",children:"Create Script"})]})]})})}),a.jsxs("header",{className:"flex items-center justify-between px-6 py-3 border-b border-gray-100 bg-white shrink-0 h-14",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx(Je,{content:"Back to Skills",children:a.jsx("button",{onClick:()=>t("/skills"),className:"p-2 -ml-2 text-gray-400 hover:text-gray-700 rounded-lg hover:bg-gray-100 transition-colors",children:a.jsx(d5,{className:"w-5 h-5"})})}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[E?a.jsx("span",{className:"text-base font-bold text-gray-900 px-1 -ml-1 h-6 flex items-center",children:l.name}):a.jsx("input",{type:"text",value:l.name,onChange:it,className:"text-base font-bold text-gray-900 bg-transparent border-none focus:ring-0 p-0 hover:bg-gray-50 rounded px-1 -ml-1 transition-colors w-64 h-6"}),ie&&a.jsx("span",{className:"text-amber-500 text-lg leading-none",title:"Unsaved changes",children:"●"})]}),l.scope&&l.scope!=="personal"&&a.jsxs("span",{className:B("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium",l.scope==="builtin"?"bg-gray-100 text-gray-700":"bg-blue-50 text-blue-700"),children:[l.scope==="builtin"?a.jsx(wc,{className:"w-2.5 h-2.5"}):a.jsx(ss,{className:"w-2.5 h-2.5"}),l.scope==="builtin"?"System Skills":"Team Skills",a.jsx("span",{className:"text-gray-400 ml-0.5",children:"· Read-only"})]})]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Je,{content:i?"Hide Scripts":"Show Scripts",children:a.jsx("button",{onClick:()=>o(!i),className:B("p-2 rounded-lg text-gray-400 transition-all border border-transparent hover:border-gray-200 hover:bg-gray-50",i?"text-primary-600 bg-primary-50 hover:bg-primary-100 hover:border-primary-200":""),children:a.jsx(j5,{className:"w-5 h-5"})})}),!V&&a.jsx(Je,{content:w?"Hide History":"Version History",children:a.jsx("button",{onClick:te,disabled:M,className:B("p-2 rounded-lg text-gray-400 transition-all border border-transparent hover:border-gray-200 hover:bg-gray-50",w?"text-indigo-600 bg-indigo-50 hover:bg-indigo-100 hover:border-indigo-200":""),children:M?a.jsx(Ae,{className:"w-5 h-5 animate-spin"}):a.jsx(R1,{className:"w-5 h-5"})})}),a.jsx("div",{className:"h-5 w-px bg-gray-200 mx-1"}),E?a.jsx(Je,{content:"Fork to Personal",children:a.jsx("button",{onClick:Q,disabled:y,className:"p-2 text-purple-600 hover:bg-purple-50 rounded-lg transition-colors disabled:opacity-50",children:y?a.jsx(Ae,{className:"w-5 h-5 animate-spin"}):a.jsx(bp,{className:"w-5 h-5"})})}):a.jsxs(a.Fragment,{children:[a.jsx(Je,{content:d?"Saving...":"Save Changes",children:a.jsx("button",{onClick:$,disabled:d,className:"p-2 text-primary-600 hover:bg-primary-50 rounded-lg transition-colors disabled:opacity-50",children:d?a.jsx(Ae,{className:"w-5 h-5 animate-spin"}):a.jsx(Qt,{className:"w-5 h-5"})})}),a.jsx(Je,{content:"Delete Skill",children:a.jsx("button",{onClick:xe,className:"p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",children:a.jsx(mn,{className:"w-5 h-5"})})})]})]})]}),ee&&a.jsxs("div",{className:"px-6 py-2.5 bg-amber-50 border-b border-amber-200 flex items-center gap-2 shrink-0",children:[a.jsxs("span",{className:"text-sm text-amber-800",children:["Unsaved draft found (",EF(ee.savedAt),")"]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:K,className:"px-3 py-1 text-xs font-medium text-amber-700 hover:bg-amber-100 rounded-md transition-colors",children:"Keep Draft"}),a.jsx("button",{onClick:Te,className:"px-3 py-1 text-xs font-medium text-amber-700 hover:bg-amber-100 rounded-md transition-colors",children:"Discard"})]}),l.reviewStatus==="pending"&&a.jsxs("div",{className:"px-6 py-2.5 bg-amber-50 border-b border-amber-200 flex items-center gap-2 shrink-0",children:[a.jsx(bo,{className:"w-4 h-4 text-amber-600"}),a.jsx("span",{className:"text-sm text-amber-800 font-medium",children:"This skill is pending publish review. Test environment has the latest version."})]}),l.reviewStatus==="approved"&&l.scope==="personal"&&l.publishedVersion!=null&&Number(String(l.version).replace(/^v/,""))>l.publishedVersion&&a.jsxs("div",{className:"px-6 py-2.5 bg-blue-50 border-b border-blue-200 flex items-center gap-2 shrink-0",children:[a.jsx(qr,{className:"w-4 h-4 text-blue-500"}),a.jsxs("span",{className:"text-sm text-blue-800 font-medium",children:["Modified since published v",l.publishedVersion,". Submit for review to publish changes to production."]})]}),l.reviewStatus==="draft"&&l.scope==="personal"&&a.jsxs("div",{className:"px-6 py-2.5 bg-gray-50 border-b border-gray-200 flex items-center gap-2 shrink-0",children:[a.jsx(bo,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-600 font-medium",children:"Draft — available in test environments only. Request publish to use in production."})]}),a.jsxs("div",{className:"flex flex-1 overflow-hidden min-h-0 bg-gray-50/50",children:[a.jsx("div",{className:B("flex flex-col transition-all duration-300 relative bg-white border-r border-gray-200",i?"w-[70%] max-w-[70%]":"w-full"),children:a.jsxs("div",{className:"flex-1 overflow-y-auto p-6 flex flex-col gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-wider mb-2 block",children:"Description"}),a.jsx("textarea",{value:l.description,onChange:Z=>!E&&c({...l,description:Z.target.value}),readOnly:E,className:B("w-full px-3 py-2 border border-gray-200 rounded-lg text-sm text-gray-700 outline-none resize-none transition-all placeholder:text-gray-400",E?"bg-gray-50 cursor-default":"bg-gray-50/50 focus:ring-1 focus:ring-primary-500/50 focus:bg-white focus:border-primary-500"),rows:2,placeholder:"Enter a description..."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-wider mb-2 block",children:"Category"}),a.jsxs("div",{className:"relative group/cat",children:[a.jsx("input",{type:"text",value:l.type,onChange:Z=>!E&&c({...l,type:Z.target.value}),onFocus:()=>!E&&k(!0),readOnly:E,className:B("w-full px-3 py-2 border border-gray-200 rounded-lg text-sm text-gray-700 outline-none transition-all placeholder:text-gray-400",E?"bg-gray-50 cursor-default":"bg-gray-50/50 focus:ring-1 focus:ring-primary-500/50 focus:bg-white focus:border-primary-500"),placeholder:"Select or type..."}),!E&&a.jsx("button",{onClick:()=>k(!b),className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 p-1",children:a.jsx(rs,{className:"w-4 h-4"})}),b&&!E&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>k(!1)}),a.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg z-20 py-1 max-h-48 overflow-y-auto",children:jF.map(Z=>a.jsx("button",{className:"w-full text-left px-3 py-2 text-sm hover:bg-gray-50 text-gray-700 hover:text-primary-600 transition-colors",onClick:()=>{c({...l,type:Z}),k(!1)},children:Z},Z))})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-wider mb-2 block",children:"Version"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:l.version,readOnly:!0,className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm text-gray-700 outline-none bg-gray-50 cursor-default",placeholder:"e.g. v1"}),l.publishedVersion!=null&&String(l.publishedVersion)!==((Et=l.version)==null?void 0:Et.replace(/^v/,""))&&a.jsxs("span",{className:"text-xs text-green-600 whitespace-nowrap",children:["(published: v",l.publishedVersion,")"]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-wider mb-2 block",children:"Labels"}),a.jsxs("div",{className:"flex flex-wrap gap-1.5 items-center",children:[(l.labels??[]).map(Z=>a.jsxs("span",{className:B("px-1.5 py-0.5 rounded text-[10px] font-medium border bg-gray-50 text-gray-600 border-gray-200 inline-flex items-center gap-1",!E&&"pr-0.5"),children:[Z,!E&&a.jsx("button",{onClick:()=>{const je=(l.labels??[]).filter(ze=>ze!==Z);c({...l,labels:je}),V||Iy(r,String(l.id),je).catch(()=>{})},className:"ml-0.5 p-0.5 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-600 transition-colors",children:a.jsx(Ge,{className:"w-2.5 h-2.5"})})]},Z)),!E&&a.jsx("input",{type:"text",placeholder:"+ Add label",className:"text-[11px] px-1.5 py-0.5 border border-transparent rounded bg-transparent text-gray-500 outline-none w-20 focus:border-gray-200 focus:bg-white placeholder:text-gray-300",onKeyDown:Z=>{if(Z.key==="Enter"||Z.key===","){Z.preventDefault();const je=Z.target.value.trim();if(je&&!(l.labels??[]).includes(je)){const ze=[...l.labels??[],je];c({...l,labels:ze}),V||Iy(r,String(l.id),ze).catch(()=>{})}Z.target.value=""}}})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-[400px]",children:[a.jsxs("label",{className:"text-[11px] font-bold text-gray-400 uppercase tracking-wider mb-2 flex justify-between group px-1",children:["Skill Specification (YAML)",a.jsx("span",{className:"text-[10px] text-gray-400 font-medium normal-case group-hover:text-primary-600 cursor-pointer transition-colors opacity-0 group-hover:opacity-100",children:"Reset Template"})]}),a.jsx("div",{className:"relative flex-1 group/editor",children:a.jsx("textarea",{value:l.specs,onChange:Z=>!E&&c({...l,specs:Z.target.value}),readOnly:E,className:B("w-full h-full px-4 py-3 border border-gray-200 rounded-lg text-xs font-mono text-gray-700 outline-none resize-none leading-relaxed transition-all",E?"bg-gray-50 cursor-default":"bg-gray-50/50 focus:ring-1 focus:ring-primary-500/50 focus:bg-white focus:border-primary-500"),spellCheck:!1})})]})]})}),i&&a.jsxs("div",{className:"flex-1 flex flex-col bg-white",children:[a.jsxs("div",{className:"px-6 py-4 flex items-center justify-between border-b border-gray-100 bg-white",children:[a.jsxs("h3",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:["Scripts (",((H=l.scripts)==null?void 0:H.length)||0,")"]}),!E&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Je,{content:"Upload Script",children:a.jsx("button",{onClick:()=>{var Z;return(Z=v.current)==null?void 0:Z.click()},className:"p-1.5 text-gray-400 hover:text-gray-700 hover:bg-gray-100 rounded-lg transition-colors",children:a.jsx(k5,{className:"w-4 h-4"})})}),a.jsxs("div",{className:"relative",children:[a.jsx(Je,{content:"New Script",children:a.jsx("button",{onClick:()=>x(!p),className:"p-1.5 text-gray-400 hover:text-primary-600 hover:bg-primary-50 rounded-lg transition-colors",children:a.jsx(en,{className:"w-4 h-4"})})}),p&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>x(!1)}),a.jsxs("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white border border-gray-100 rounded-lg shadow-xl z-20 py-1 flex flex-col overflow-hidden",children:[a.jsxs("button",{onClick:()=>St("shell"),className:"px-3 py-2.5 text-left text-xs text-gray-700 hover:bg-gray-50 flex items-center gap-2",children:[a.jsx(Fn,{className:"w-3.5 h-3.5 text-green-600"}),"Shell Script"]}),a.jsxs("button",{onClick:()=>St("python"),className:"px-3 py-2.5 text-left text-xs text-gray-700 hover:bg-gray-50 flex items-center gap-2",children:[a.jsx(qr,{className:"w-3.5 h-3.5 text-blue-600"}),"Python Script"]})]})]})]}),a.jsx("input",{type:"file",ref:v,className:"hidden",accept:".sh,.py,.txt",onChange:Ye})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-6 pt-2",children:!l.scripts||l.scripts.length===0?a.jsxs("div",{className:"h-40 flex flex-col items-center justify-center border-2 border-dashed border-gray-200 rounded-xl bg-gray-50/50",children:[a.jsx("div",{className:"p-3 bg-white rounded-full shadow-sm mb-3",children:a.jsx(Rs,{className:"w-6 h-6 text-gray-300"})}),a.jsx("p",{className:"text-sm text-gray-500 font-medium",children:"No scripts yet"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Add or upload a script to get started"})]}):a.jsx("div",{className:"flex flex-col gap-2",children:l.scripts.map(Z=>a.jsxs("div",{onClick:()=>f(Z.id),className:"group flex items-center justify-between p-3 bg-white border border-gray-200 hover:border-primary-500/50 hover:shadow-sm rounded-lg cursor-pointer transition-all duration-200",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:B("w-8 h-8 rounded-md flex items-center justify-center shrink-0",Z.info==="python"?"bg-blue-50 text-blue-600":"bg-green-50 text-green-600"),children:Z.info==="python"?a.jsx(qr,{className:"w-4 h-4"}):a.jsx(Fn,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 group-hover:text-primary-600 transition-colors",children:Z.name}),a.jsxs("span",{className:"text-[10px] text-gray-400 font-mono",children:[Z.info==="python"?"Python":"Bash"," · ",Z.content.length,"B"]})]})]}),a.jsxs("div",{className:"flex items-center gap-1 opacity-100 sm:opacity-0 group-hover:opacity-100 transition-opacity pl-4",children:[a.jsx(Je,{content:E?"View Script":"Edit Script",children:a.jsx("button",{onClick:je=>{je.stopPropagation(),f(Z.id)},className:"p-1.5 text-gray-400 hover:text-primary-600 hover:bg-primary-50 rounded-md transition-colors",children:E?a.jsx(Fo,{className:"w-4 h-4"}):a.jsx(Rs,{className:"w-4 h-4"})})}),!E&&a.jsx(Je,{content:"Delete Script",children:a.jsx("button",{onClick:je=>vt(je,Z.id),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-md transition-colors",children:a.jsx(mn,{className:"w-4 h-4"})})})]})]},Z.id))})})]}),a.jsx(Xn,{children:w&&a.jsxs(Ot.div,{initial:{width:0,opacity:0},animate:{width:320,opacity:1},exit:{width:0,opacity:0},transition:{duration:.2},className:"border-l border-gray-200 bg-white flex flex-col overflow-hidden shrink-0",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-gray-100 flex items-center justify-between",children:[a.jsx("h3",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:"Version History"}),a.jsx("button",{onClick:()=>C(!1),className:"p-1 text-gray-400 hover:text-gray-700 rounded",children:a.jsx(Ge,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:D.length===0?a.jsx("p",{className:"text-sm text-gray-400 text-center py-8",children:"No published versions yet"}):D.map(Z=>a.jsxs("div",{className:"p-3 rounded-lg border border-gray-100 hover:border-gray-200 transition-colors",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsxs("span",{className:"text-sm font-bold text-gray-900",children:["v",Z.version]}),ne&&a.jsx(Je,{content:"Rollback to this version",children:a.jsx("button",{onClick:()=>z(Z.version),className:"p-1 text-gray-400 hover:text-orange-600 hover:bg-orange-50 rounded transition-colors",children:a.jsx(F1,{className:"w-3.5 h-3.5"})})})]}),a.jsx("p",{className:"text-xs text-gray-500 truncate",children:Z.message}),a.jsxs("div",{className:"flex items-center gap-2 mt-1.5 text-[10px] text-gray-400",children:[a.jsx("span",{children:Z.author}),Z.date&&a.jsx("span",{children:new Date(Z.date).toLocaleDateString()})]})]},Z.hash))})]})}),a.jsx(Xn,{children:u&&a.jsxs(Ot.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.15},className:"absolute inset-0 z-50 bg-[#1e1e1e] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-[#252526] border-b border-[#1e1e1e]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:B("w-8 h-8 rounded flex items-center justify-center",((se=(G=l.scripts)==null?void 0:G.find(Z=>Z.id===u))==null?void 0:se.info)==="python"?"bg-[#37373d] text-yellow-400":"bg-[#37373d] text-green-400"),children:((O=(we=l.scripts)==null?void 0:we.find(Z=>Z.id===u))==null?void 0:O.info)==="python"?a.jsx(qr,{className:"w-4 h-4"}):a.jsx(Fn,{className:"w-4 h-4"})}),a.jsx("span",{className:"text-sm font-medium text-gray-200 font-mono",children:(be=(oe=l.scripts)==null?void 0:oe.find(Z=>Z.id===u))==null?void 0:be.name})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!E&&a.jsx(Je,{content:"Save Script",children:a.jsx("button",{onClick:$,className:"p-1.5 text-gray-400 hover:text-white hover:bg-[#333] rounded transition-colors",children:a.jsx(Qt,{className:"w-5 h-5"})})}),a.jsx(Je,{content:"Close Editor",children:a.jsx("button",{onClick:()=>f(null),className:"p-1.5 text-gray-400 hover:text-white hover:bg-[#333] rounded transition-colors",children:a.jsx(Ge,{className:"w-5 h-5"})})})]})]}),a.jsx("div",{className:"flex-1 relative font-mono text-sm overflow-y-auto custom-scrollbar",children:a.jsx(kF,{value:((et=(Me=l.scripts)==null?void 0:Me.find(Z=>Z.id===u))==null?void 0:et.content)||"",onValueChange:Z=>{var je;E||c({...l,scripts:(je=l.scripts)==null?void 0:je.map(ze=>ze.id===u?{...ze,content:Z}:ze)})},highlight:Z=>{var ot;const je=(ot=l.scripts)==null?void 0:ot.find(ys=>ys.id===u),ze=(je==null?void 0:je.info)==="python"?Cl.languages.python:Cl.languages.bash;return Cl.highlight(Z,ze||Cl.languages.js,(je==null?void 0:je.info)||"javascript")},padding:24,style:{fontFamily:'"JetBrains Mono", "Fira Code", monospace',fontSize:14,backgroundColor:"#1e1e1e",color:"#d4d4d4",minHeight:"100%"},className:"min-h-full",textareaClassName:"focus:outline-none"})}),a.jsxs("div",{className:"h-6 bg-[#007acc] text-white flex items-center px-4 text-[11px] font-medium gap-6 select-none border-t border-[#007acc]",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Rs,{className:"w-3 h-3 opacity-70"}),a.jsx("span",{children:((tt=(Ve=l.scripts)==null?void 0:Ve.find(Z=>Z.id===u))==null?void 0:tt.info)==="python"?"Python 3.10":"Bash 5.0"})]}),a.jsx("span",{className:"flex-1"}),a.jsx("span",{children:"UTF-8"}),a.jsxs("span",{children:["Ln ",(at=(It=l.scripts)==null?void 0:It.find(Z=>Z.id===u))==null?void 0:at.content.split(`
675
+ `).length,", Col 1"]})]})]})})]}),a.jsx(Bs,{isOpen:S,onClose:()=>N(!1),onConfirm:q,title:"Delete Skill",description:"Are you sure you want to delete this skill? This action cannot be undone.",confirmText:"Delete",variant:"danger"}),a.jsx(Bs,{isOpen:F!==null,onClose:()=>z(null),onConfirm:()=>F!==null&&pe(F),title:"Rollback Version",description:`Are you sure you want to rollback to v${F}? This will overwrite the current working copy and published snapshot.`,confirmText:"Rollback",variant:"warning"}),a.jsx(Bs,{isOpen:Ce.state==="blocked",onClose:()=>{var Z;return Ce.state==="blocked"&&((Z=Ce.reset)==null?void 0:Z.call(Ce))},onConfirm:()=>{var Z;return Ce.state==="blocked"&&((Z=Ce.proceed)==null?void 0:Z.call(Ce))},title:"Unsaved Changes",description:"You have unsaved changes. Your draft has been auto-saved and can be restored next time you open this skill.",confirmText:"Leave",cancelText:"Keep Editing",variant:"warning"})]}):a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx(Ae,{className:"animate-spin text-gray-400"})})}function PF(e){const[t,n]=g.useState([]),[r,s]=g.useState(!0),i=g.useCallback(async()=>{try{const l=await e("channels.list");n(l.channels)}catch(l){console.error("[useChannels] Failed to load:",l)}finally{s(!1)}},[e]),o=g.useCallback(async(l,c,u)=>{await e("channels.save",{id:l,enabled:c,config:u}),await i()},[e,i]);return{channels:t,loading:r,loadChannels:i,saveChannel:o}}const AF=[{id:"slack",name:"Slack",description:"Slack workspace bot with rich message formatting and threads.",icon:I1},{id:"discord",name:"Discord",description:"Discord server bot with slash commands and channel messaging.",icon:Fn},{id:"telegram",name:"Telegram",description:"Bot integration for Telegram groups and direct messages.",icon:kp},{id:"lark",name:"Lark",description:"Enterprise bot for Lark with interactive cards and approval flows.",icon:E5},{id:"whatsapp",name:"WhatsApp",description:"WhatsApp Business API integration for customer messaging.",icon:T5,comingSoon:!0}];function DF(e){return AF.map(t=>{const n=e.find(r=>r.id===t.id);return{...t,status:(n==null?void 0:n.status)??"disconnected",error:n==null?void 0:n.error,config:(n==null?void 0:n.config)??{},enabled:(n==null?void 0:n.enabled)??!1}})}function LF({channel:e,isOpen:t,onClose:n,onSave:r}){const[s,i]=g.useState({}),[o,l]=g.useState(!1),[c,u]=g.useState(!1);g.useEffect(()=>{e&&(i({...e.config}),l(e.enabled))},[e]);const f=async()=>{if(!(!e||c)){u(!0);try{await r(e.id,o,s)}finally{u(!1)}}};return e?a.jsx(Xn,{children:t&&a.jsxs(a.Fragment,{children:[a.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:n,className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-40"}),a.jsxs(Ot.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:200},className:"fixed right-0 top-0 bottom-0 w-[480px] bg-white shadow-2xl z-50 flex flex-col border-l border-gray-100",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-white",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-gray-50 rounded-lg border border-gray-100",children:a.jsx(e.icon,{className:"w-5 h-5 text-gray-700"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-gray-900",children:e.name}),a.jsx("p",{className:"text-xs text-gray-400",children:"Configuration"})]})]}),a.jsx("button",{onClick:n,className:"p-2 text-gray-400 hover:text-gray-700 hover:bg-gray-50 rounded-lg transition-colors",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50/50 rounded-xl border border-gray-100",children:[a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900",children:"Enable Integration"}),a.jsx("span",{className:"text-xs text-gray-500",children:"Allow Siclaw to use this channel"})]}),a.jsx("button",{onClick:()=>l(!o),className:B("w-11 h-6 rounded-full transition-colors relative",o?"bg-primary-600":"bg-gray-200"),children:a.jsx("span",{className:B("w-4 h-4 rounded-full bg-white shadow-sm absolute top-1 transition-all",o?"left-6":"left-1")})})]}),a.jsx("div",{className:"h-px bg-gray-100 w-full"}),a.jsxs("div",{className:"space-y-4",children:[e.id==="lark"&&a.jsxs(a.Fragment,{children:[a.jsx(Or,{label:"App ID",value:s.appId||"",onChange:d=>i({...s,appId:d}),placeholder:"cli_...",required:!0}),a.jsx(Or,{label:"App Secret",value:s.appSecret||"",onChange:d=>i({...s,appSecret:d}),placeholder:"Your app secret...",type:"password",required:!0})]}),e.id==="telegram"&&a.jsx(Or,{label:"Bot Token",value:s.botToken||"",onChange:d=>i({...s,botToken:d}),placeholder:"123456:ABC-DEF...",type:"password",required:!0}),e.id==="slack"&&a.jsxs(a.Fragment,{children:[a.jsx(Or,{label:"Bot Token",value:s.botToken||"",onChange:d=>i({...s,botToken:d}),placeholder:"xoxb-...",type:"password",required:!0}),a.jsx(Or,{label:"App Token",value:s.appToken||"",onChange:d=>i({...s,appToken:d}),placeholder:"xapp-...",type:"password",required:!0})]}),e.id==="discord"&&a.jsx(Or,{label:"Bot Token",value:s.token||"",onChange:d=>i({...s,token:d}),placeholder:"Your bot token...",type:"password",required:!0}),e.id==="whatsapp"&&a.jsxs(a.Fragment,{children:[a.jsx(Or,{label:"Access Token",value:s.accessToken||"",onChange:d=>i({...s,accessToken:d}),placeholder:"Your access token...",type:"password",required:!0}),a.jsx(Or,{label:"Phone Number ID",value:s.phoneNumberId||"",onChange:d=>i({...s,phoneNumberId:d}),placeholder:"Phone number ID...",required:!0})]})]}),e.status==="error"&&e.error&&a.jsxs("div",{className:"p-3 bg-red-50 border border-red-100 rounded-lg",children:[a.jsx("p",{className:"text-sm text-red-700 font-medium",children:"Connection Error"}),a.jsx("p",{className:"text-xs text-red-600 mt-1",children:e.error})]})]})}),a.jsxs("div",{className:"p-6 border-t border-gray-100 bg-gray-50/50 flex items-center justify-between",children:[a.jsx("span",{className:"text-xs text-gray-400",children:e.status==="connected"?"Currently Connected":e.status==="error"?"Connection Error":"Not Connected"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-lg transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:f,disabled:c,className:"px-4 py-2 text-sm font-medium bg-primary-600 text-white hover:bg-primary-700 rounded-lg shadow-sm flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Qt,{className:"w-4 h-4"}),c?"Saving...":"Save Configuration"]})]})]})]})]})}):null}function Or({label:e,value:t,onChange:n,placeholder:r,type:s="text",required:i}){return a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700 flex items-center gap-1",children:[e,i&&a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:s,value:t,onChange:o=>n(o.target.value),placeholder:r,className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 transition-all font-mono"})]})}function MF(){const{sendRpc:e,isConnected:t}=zt(),{channels:n,loading:r,loadChannels:s,saveChannel:i}=PF(e),[o,l]=g.useState(null),[c,u]=g.useState(!1),f=g.useRef(!1);g.useEffect(()=>{t&&!f.current&&(f.current=!0,s())},[t,s]);const d=DF(n),h=x=>{x.comingSoon||(l(x),u(!0))},p=async(x,b,k)=>{await i(x,b,k),u(!1)};return a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsx("header",{className:"h-16 flex items-center justify-end px-6 bg-white sticky top-0 z-10",children:a.jsx("div",{className:"flex items-center gap-2"})}),a.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:a.jsx("div",{className:"max-w-5xl mx-auto space-y-6",children:r?a.jsx("div",{className:"text-center text-gray-400 py-12",children:"Loading channels..."}):a.jsx("div",{className:"grid grid-cols-1 gap-4",children:d.map(x=>a.jsxs("div",{className:B("group bg-white rounded-xl border border-gray-200 p-5 flex items-center justify-between transition-all",x.comingSoon?"opacity-60":"hover:border-primary-200 hover:shadow-sm"),children:[a.jsxs("div",{className:"flex items-center gap-5",children:[a.jsx("div",{className:B("w-8 h-8 rounded-lg flex items-center justify-center border transition-colors",x.status==="connected"?"bg-white border-gray-200":"bg-gray-50 border-gray-200 grayscale"),children:a.jsx(x.icon,{className:B("w-4 h-4",x.status==="connected"?"text-gray-900":"text-gray-400")})}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("h3",{className:"font-bold text-gray-900",children:x.name}),x.comingSoon&&a.jsx("span",{className:"px-2 py-0.5 rounded-full bg-gray-100 text-gray-500 text-[10px] font-bold uppercase tracking-wide border border-gray-200",children:"Coming Soon"}),!x.comingSoon&&x.status==="connected"&&a.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-50 text-green-700 text-[10px] font-bold uppercase tracking-wide border border-green-100",children:[a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse"}),"Active"]}),!x.comingSoon&&x.status==="error"&&a.jsx("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-50 text-red-700 text-[10px] font-bold uppercase tracking-wide border border-red-100",children:"Error"})]}),a.jsx("p",{className:"text-sm text-gray-500 max-w-xl",children:x.description}),x.status==="error"&&x.error&&a.jsx("p",{className:"text-xs text-red-500 mt-1 max-w-xl truncate",children:x.error})]})]}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"text-right hidden sm:block min-w-[100px]",children:[a.jsx("div",{className:"text-xs font-medium text-gray-400",children:"Status"}),a.jsx("div",{className:B("text-sm font-medium",x.status==="connected"?"text-green-600":x.status==="error"?"text-red-500":"text-gray-400"),children:x.comingSoon?"Coming Soon":x.status==="connected"?"Operational":x.status==="error"?"Error":"Not Configured"})]}),a.jsx("div",{className:"h-8 w-px bg-gray-100 hidden sm:block"}),a.jsx("button",{onClick:()=>h(x),disabled:x.comingSoon,className:B("px-4 py-2 rounded-lg font-medium text-sm transition-colors shadow-sm border min-w-[100px]",x.comingSoon?"bg-gray-100 border-gray-200 text-gray-400 cursor-not-allowed":x.status==="connected"?"bg-white border-gray-200 text-gray-700 hover:bg-gray-50":"bg-primary-600 border-primary-600 text-white hover:bg-primary-700"),children:x.comingSoon?"Coming Soon":x.status==="connected"?"Configure":"Connect"})]})]},x.id))})})}),a.jsx(LF,{channel:o,isOpen:c,onClose:()=>u(!1),onSave:p})]})}function IF(e){const[t,n]=g.useState([]),[r,s]=g.useState(!0),i=g.useCallback(async()=>{try{const c=await e("trigger.list");n((c.triggers??[]).map(u=>{var f,d;return{...u,icon:((f=u.configJson)==null?void 0:f.icon)||"zap",description:((d=u.configJson)==null?void 0:d.description)||u.name}}))}catch(c){console.error("[useTriggers] Failed to load:",c)}finally{s(!1)}},[e]),o=g.useCallback(async c=>{const u=await e("trigger.save",{id:c.id,name:c.name,type:c.type,status:c.status,config:{description:c.description,icon:c.icon}});return await i(),u},[e,i]),l=g.useCallback(async c=>{await e("trigger.delete",{id:c}),await i()},[e,i]);return{triggers:t,loading:r,loadTriggers:i,saveTrigger:o,deleteTrigger:l}}const BS=[{id:"zap",icon:su,label:"Zap"},{id:"wifi",icon:Ep,label:"WiFi"},{id:"activity",icon:u5,label:"Activity"},{id:"server",icon:L5,label:"Server"},{id:"database",icon:L1,label:"Database"},{id:"cloud",icon:x5,label:"Cloud"},{id:"box",icon:p5,label:"Box"},{id:"terminal",icon:Fn,label:"Terminal"},{id:"cpu",icon:Xs,label:"CPU"},{id:"globe",icon:Oo,label:"Globe"},{id:"message",icon:kp,label:"Message"},{id:"bell",icon:vp,label:"Bell"}],RF=e=>{var t;return((t=BS.find(n=>n.id===e))==null?void 0:t.icon)||su};function _F({trigger:e,isOpen:t,onClose:n,onSave:r}){const[s,i]=g.useState(""),[o,l]=g.useState(""),[c,u]=g.useState("webhook"),[f,d]=g.useState("zap"),[h,p]=g.useState(!1),[x,b]=g.useState(!1);g.useEffect(()=>{t&&(e?(i(e.name),l(e.description),u(e.type),d(e.icon||"zap")):(i(""),l(""),u("webhook"),d("zap")))},[t,e]);const k=async()=>{if(!(!s.trim()||x)){b(!0);try{await r({id:e==null?void 0:e.id,name:s,description:o,type:c,status:(e==null?void 0:e.status)||"active",icon:f})}finally{b(!1)}}},v=m=>{navigator.clipboard.writeText(m),p(!0),setTimeout(()=>p(!1),2e3)};return a.jsx(Xn,{children:t&&a.jsxs(a.Fragment,{children:[a.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:n,className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-40"}),a.jsxs(Ot.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:200},className:"fixed right-0 top-0 bottom-0 w-[480px] bg-white shadow-2xl z-50 flex flex-col border-l border-gray-100",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-white",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-gray-900",children:e?"Endpoint Details":"New Endpoint"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Configure inbound integration"})]}),a.jsx("button",{onClick:n,className:"p-2 text-gray-400 hover:text-gray-700 hover:bg-gray-50 rounded-lg transition-colors",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Endpoint Type"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("button",{onClick:()=>u("webhook"),disabled:!!e,className:B("p-3 rounded-lg border text-left transition-all relative overflow-hidden",c==="webhook"?"border-primary-500 bg-primary-50/50 text-primary-700 ring-1 ring-primary-500":"border-gray-200 hover:border-gray-300 hover:bg-gray-50",!!e&&c!=="webhook"&&"opacity-50 cursor-not-allowed"),children:[a.jsx("div",{className:"font-semibold text-sm mb-0.5",children:"Webhook"}),a.jsx("div",{className:"text-[10px] opacity-70",children:"HTTP POST payloads"})]}),a.jsxs("button",{onClick:()=>u("websocket"),disabled:!!e,className:B("p-3 rounded-lg border text-left transition-all relative overflow-hidden",c==="websocket"?"border-primary-500 bg-primary-50/50 text-primary-700 ring-1 ring-primary-500":"border-gray-200 hover:border-gray-300 hover:bg-gray-50",!!e&&c!=="websocket"&&"opacity-50 cursor-not-allowed"),children:[a.jsx("div",{className:"font-semibold text-sm mb-0.5",children:"WebSocket"}),a.jsx("div",{className:"text-[10px] opacity-70",children:"Coming Soon"})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Display Icon"}),a.jsx("div",{className:"grid grid-cols-6 gap-2",children:BS.map(m=>a.jsx("button",{onClick:()=>d(m.id),className:B("aspect-square flex flex-col items-center justify-center rounded-lg border transition-all hover:bg-gray-50",f===m.id?"border-primary-500 bg-primary-50 text-primary-600 ring-1 ring-primary-500":"border-gray-200 text-gray-500"),title:m.label,children:a.jsx(m.icon,{className:"w-5 h-5"})},m.id))})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:s,onChange:m=>i(m.target.value),placeholder:"e.g. Grafana Production",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Description"}),a.jsx("textarea",{value:o,onChange:m=>l(m.target.value),placeholder:"Optional description...",rows:3,className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 resize-none"})]})]}),e&&e.endpointUrl&&a.jsxs("div",{className:"mt-6 space-y-4 pt-6 border-t border-gray-100",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Connection Details"}),a.jsxs("div",{className:"bg-gray-50 rounded-lg border border-gray-200 p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[a.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:c==="webhook"?"Endpoint URL":"Stream URL"}),a.jsxs("button",{onClick:()=>v(e.endpointUrl),className:"text-primary-600 hover:text-primary-700 text-xs font-medium flex items-center gap-1",children:[h?a.jsx(qt,{className:"w-3 h-3"}):a.jsx(Rf,{className:"w-3 h-3"}),h?"Copied":"Copy"]})]}),a.jsx("div",{className:"font-mono text-xs text-gray-700 bg-white border border-gray-200 rounded p-2 break-all select-all",children:e.endpointUrl})]}),e.secret&&a.jsxs("div",{children:[a.jsx("div",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1.5",children:"Authentication Header"}),a.jsx("div",{className:"bg-white border border-gray-200 rounded p-3",children:a.jsxs("div",{className:"flex gap-2 font-mono text-xs text-blue-600",children:[a.jsx("span",{className:"shrink-0 selection:bg-blue-100",children:"Authorization: Bearer"}),a.jsx("span",{className:"text-gray-600 break-all select-all",children:e.secret})]})})]})]}),a.jsxs("div",{className:"flex gap-3 p-3 bg-blue-50 text-blue-700 rounded-lg text-xs leading-relaxed",children:[a.jsx(tu,{className:"w-4 h-4 shrink-0 mt-0.5"}),"Use the URL and Secret above to configure your third-party service provider. Incoming events will be processed by the Rules Engine."]})]})]}),a.jsxs("div",{className:"p-6 border-t border-gray-100 bg-white flex items-center justify-end gap-3",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 rounded-lg transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:k,disabled:!s.trim()||x,className:"px-4 py-2 text-sm font-medium bg-primary-600 text-white hover:bg-primary-700 rounded-lg shadow-sm flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Qt,{className:"w-4 h-4"}),x?"Saving...":e?"Save Changes":"Create Endpoint"]})]})]})]})})}function FF(){const{sendRpc:e,isConnected:t}=zt(),{triggers:n,loading:r,loadTriggers:s,saveTrigger:i,deleteTrigger:o}=IF(e),[l,c]=g.useState(!1),[u,f]=g.useState(null),d=g.useRef(!1);g.useEffect(()=>{t&&!d.current&&(d.current=!0,s())},[t,s]);const h=()=>{f(null),c(!0)},p=v=>{f(v),c(!0)},x=async v=>{await i(v),c(!1)},b=async(v,m)=>{v.stopPropagation();const y=m.status==="active"?"inactive":"active";await i({...m,status:y})},k=async(v,m)=>{v.stopPropagation(),await o(m)};return a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsx("header",{className:"h-16 flex items-center justify-end px-6 bg-white sticky top-0 z-10",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative group",children:[a.jsx(kn,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 group-focus-within:text-primary-500 transition-colors"}),a.jsx("input",{type:"text",placeholder:"Search endpoints...",className:"pl-9 pr-3 py-1.5 bg-gray-50 border-none rounded-md text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-200 w-48 transition-all"})]}),a.jsx(Je,{content:"New Endpoint",children:a.jsx("button",{onClick:h,className:"p-2 rounded-lg text-gray-400 hover:text-gray-900 hover:bg-gray-100 transition-all",children:a.jsx(en,{className:"w-5 h-5"})})})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto p-8 bg-white",children:r?a.jsx("div",{className:"flex items-center justify-center h-40 text-gray-400 text-sm",children:"Loading..."}):a.jsxs("div",{className:"max-w-6xl mx-auto grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[n.map(v=>a.jsxs("div",{onClick:()=>p(v),className:"group bg-white rounded-xl border border-gray-200 p-5 hover:shadow-md hover:border-primary-200 transition-all cursor-pointer relative overflow-hidden",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsx("div",{className:B("w-8 h-8 flex items-center justify-center rounded-lg border",v.type==="webhook"?"bg-purple-50 border-purple-100 text-purple-600":"bg-emerald-50 border-emerald-100 text-emerald-600"),children:(()=>{const m=RF(v.icon);return a.jsx(m,{className:"w-4 h-4"})})()}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:m=>b(m,v),className:B("p-2 rounded-lg transition-colors border",v.status==="active"?"bg-white border-gray-200 text-gray-400 hover:text-orange-500 hover:border-orange-200":"bg-green-50 border-green-200 text-green-600"),title:v.status==="active"?"Deactivate Endpoint":"Activate Endpoint",children:v.status==="active"?a.jsx(Sp,{className:"w-4 h-4"}):a.jsx(yo,{className:"w-4 h-4"})}),a.jsx("button",{onClick:m=>k(m,v.id),className:"p-2 rounded-lg transition-colors border bg-white border-gray-200 text-gray-400 hover:text-red-500 hover:border-red-200",title:"Delete Endpoint",children:a.jsx(mn,{className:"w-4 h-4"})})]})]}),a.jsxs("h3",{className:"font-bold text-gray-900 mb-1 group-hover:text-primary-600 transition-colors flex items-center gap-2",children:[v.name,a.jsx(T1,{className:"w-3 h-3 opacity-0 group-hover:opacity-100 -translate-x-2 group-hover:translate-x-0 transition-all text-primary-400"})]}),a.jsx("p",{className:"text-sm text-gray-500 mb-4 line-clamp-2 min-h-[40px]",children:v.description||"No description provided."}),a.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-50 text-xs text-gray-400",children:[a.jsxs("span",{className:"font-mono bg-gray-50 px-1.5 py-0.5 rounded text-gray-500",children:["ID: ",v.id.split("_")[1]||v.id]}),a.jsxs("div",{children:["Last active: ",a.jsx("span",{className:"text-gray-600 font-medium",children:v.lastActive||"Never"})]})]})]},v.id)),a.jsxs("button",{onClick:h,className:"flex flex-col items-center justify-center p-6 rounded-xl border-2 border-dashed border-gray-200 text-gray-400 hover:border-primary-300 hover:text-primary-600 hover:bg-primary-50/50 transition-all gap-3 min-h-[200px]",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-50 flex items-center justify-center group-hover:bg-white transition-colors",children:a.jsx(en,{className:"w-6 h-6"})}),a.jsx("span",{className:"font-medium",children:"Create New Endpoint"})]})]})}),a.jsx(_F,{isOpen:l,onClose:()=>c(!1),trigger:u,onSave:x})]})}function OF(e){const[t,n]=g.useState([]),[r,s]=g.useState(!0),[i,o]=g.useState(null),l=g.useCallback(async()=>{o(null);try{const f=await e("cron.list");n(f.jobs??[])}catch(f){const d=f instanceof Error?f.message:String(f);console.error("[useCronJobs] Failed to load:",d),o(d)}finally{s(!1)}},[e]),c=g.useCallback(async f=>{const d=await e("cron.save",{id:f.id,name:f.name,description:f.description,schedule:f.schedule,skillId:f.skillId,status:f.status,envId:f.envId??null});return await l(),d},[e,l]),u=g.useCallback(async f=>{await e("cron.delete",{id:f}),await l()},[e,l]);return{jobs:t,loading:r,error:i,loadJobs:l,saveJob:c,deleteJob:u}}function zF({job:e,isOpen:t,onClose:n,onSave:r}){const[s,i]=g.useState(""),[o,l]=g.useState(""),[c,u]=g.useState(""),[f,d]=g.useState(!1);g.useEffect(()=>{t&&(e?(i(e.name),l(e.description),u(e.schedule)):(i(""),l(""),u("0 9 * * 1-5")),d(!1))},[t,e]);const h=async()=>{if(!(!s.trim()||!c.trim()||f)){d(!0);try{await r({id:e==null?void 0:e.id,name:s,description:o,schedule:c,status:(e==null?void 0:e.status)||"active"})}catch(p){console.error("[CronDrawer] Save failed:",p)}finally{d(!1)}}};return a.jsx(Xn,{children:t&&a.jsxs(a.Fragment,{children:[a.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:n,className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-40"}),a.jsxs(Ot.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:200},className:"fixed right-0 top-0 bottom-0 w-[480px] bg-white shadow-2xl z-50 flex flex-col border-l border-gray-100",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-white",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-gray-900",children:e?"Edit Schedule":"New Schedule"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Automate skills with cron jobs"})]}),a.jsx("button",{onClick:n,className:"p-2 text-gray-400 hover:text-gray-700 hover:bg-gray-50 rounded-lg transition-colors",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[a.jsx(Ys,{className:"w-4 h-4 text-primary-500"}),"Cron Schedule ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:"text",value:c,onChange:p=>u(p.target.value),placeholder:"* * * * *",className:"w-full px-4 py-3 bg-gray-50 border border-gray-200 rounded-lg text-sm font-mono text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 transition-all"}),a.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-400",children:"UTC"})]}),a.jsxs("p",{className:"text-xs text-gray-500",children:["Format: ",a.jsx("code",{children:"min hour day month weekday"}),". ",a.jsx("a",{href:"https://crontab.guru",target:"_blank",className:"text-primary-600 hover:underline",children:"Help?"})]})]}),a.jsx("div",{className:"h-px bg-gray-100 w-full"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Job Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:s,onChange:p=>i(p.target.value),placeholder:"e.g. Weekly Report",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Description"}),a.jsx("textarea",{value:o,onChange:p=>l(p.target.value),placeholder:"Describe what this scheduled job does (Natural Language).",rows:4,className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 resize-none"})]})]})]}),a.jsxs("div",{className:"p-6 border-t border-gray-100 bg-white flex items-center justify-end gap-3",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-lg transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:h,disabled:!s.trim()||!c.trim()||f,className:"px-4 py-2 text-sm font-medium bg-primary-600 text-white hover:bg-primary-700 rounded-lg shadow-sm flex items-center gap-2 disabled:opacity-50",children:[f?a.jsx(Ae,{className:"w-4 h-4 animate-spin"}):a.jsx(Qt,{className:"w-4 h-4"}),f?"Saving...":e?"Save Job":"Create Schedule"]})]})]})]})})}function VF(){const{sendRpc:e,isConnected:t}=zt(),{jobs:n,loading:r,error:s,loadJobs:i,saveJob:o,deleteJob:l}=OF(e),[c,u]=g.useState(!1),[f,d]=g.useState(null),[h,p]=g.useState(null),x=g.useRef(!1);g.useEffect(()=>{t&&!x.current&&(x.current=!0,i())},[t,i]);const b=()=>{d(null),u(!0)},k=S=>{d(S),u(!0)},v=async S=>{try{await o(S),u(!1)}catch(N){console.error("[CronPage] Save failed:",N),alert(N instanceof Error?N.message:"Failed to save schedule")}},m=async(S,N)=>{S.stopPropagation();const w=N.status==="active"?"paused":"active";try{await o({...N,status:w})}catch(C){console.error("[CronPage] Toggle failed:",C)}},y=(S,N)=>{S.stopPropagation(),p(N)},j=async()=>{if(h)try{await l(h)}catch(S){console.error("[CronPage] Delete failed:",S)}finally{p(null)}};return a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsx("header",{className:"h-16 flex items-center justify-end px-6 bg-white sticky top-0 z-10",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative group",children:[a.jsx(kn,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 group-focus-within:text-primary-500 transition-colors"}),a.jsx("input",{type:"text",placeholder:"Search schedules...",className:"pl-9 pr-3 py-1.5 bg-gray-50 border-none rounded-md text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-200 w-48 transition-all"})]}),a.jsx(Je,{content:"Add Schedule",children:a.jsx("button",{onClick:b,className:"p-2 rounded-lg text-gray-400 hover:text-gray-900 hover:bg-gray-100 transition-all",children:a.jsx(en,{className:"w-5 h-5"})})})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto p-8 bg-white",children:r?a.jsx("div",{className:"flex items-center justify-center h-40 text-gray-400 text-sm",children:"Loading..."}):s?a.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-red-400 text-sm gap-2",children:[a.jsxs("p",{children:["Failed to load schedules: ",s]}),a.jsx("button",{onClick:i,className:"px-3 py-1 rounded bg-gray-100 text-gray-600 hover:bg-gray-200 text-xs",children:"Retry"})]}):a.jsxs("div",{className:"max-w-6xl mx-auto space-y-4",children:[n.map(S=>a.jsxs("div",{onClick:()=>k(S),className:"group bg-white rounded-xl border border-gray-200 p-5 hover:shadow-md hover:border-primary-200 transition-all cursor-pointer relative overflow-hidden flex items-center gap-6",children:[a.jsx("div",{className:B("w-1 h-12 rounded-full shrink-0",S.status==="active"?"bg-green-500":"bg-gray-300")}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"font-bold text-gray-900 mb-1 group-hover:text-primary-600 transition-colors truncate",children:S.name}),a.jsx("p",{className:"text-sm text-gray-500 truncate mb-2",children:S.description}),a.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-gray-600 font-mono bg-gray-50 px-2 py-0.5 rounded",children:[a.jsx(wo,{className:"w-3 h-3 text-gray-400"}),S.schedule]}),a.jsxs("div",{className:"flex items-center gap-1.5 text-gray-500 font-medium",children:[a.jsx(yo,{className:"w-3 h-3"}),a.jsx("span",{children:"Bot Automated"})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsx("button",{onClick:N=>m(N,S),className:B("p-2 rounded-lg transition-colors border",S.status==="active"?"bg-white border-gray-200 text-gray-400 hover:text-orange-500 hover:border-orange-200":"bg-green-50 border-green-200 text-green-600"),title:S.status==="active"?"Pause Job":"Resume Job",children:S.status==="active"?a.jsx(Sp,{className:"w-4 h-4"}):a.jsx(yo,{className:"w-4 h-4"})}),a.jsx("button",{onClick:N=>y(N,S.id),className:"p-2 rounded-lg text-gray-400 hover:text-red-600 hover:bg-red-50 hover:border-red-200 border border-transparent transition-all",title:"Delete Job",children:a.jsx(mn,{className:"w-4 h-4"})})]})]},S.id)),n.length===0&&a.jsxs("div",{className:"text-center py-20 text-gray-400",children:[a.jsx(wo,{className:"w-12 h-12 mx-auto mb-4 text-gray-200"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"No Scheduled Jobs"}),a.jsx("p",{className:"mb-6 max-w-sm mx-auto",children:"Create a cron job to automate your skills periodically."}),a.jsx("button",{onClick:b,className:"px-4 py-2 bg-primary-600 text-white rounded-lg font-medium hover:bg-primary-700 transition-colors",children:"+ Create First Schedule"})]})]})}),a.jsx(zF,{isOpen:c,onClose:()=>u(!1),job:f,onSave:v}),a.jsx(Bs,{isOpen:h!==null,onClose:()=>p(null),onConfirm:j,title:"Delete Schedule",description:"Are you sure you want to delete this scheduled job? This action cannot be undone.",confirmText:"Delete",variant:"danger"})]})}function BF({isOpen:e,onClose:t,user:n,onSave:r}){const[s,i]=g.useState(n);if(g.useEffect(()=>{i(n)},[n,e]),!e)return null;const o=l=>{l.preventDefault(),r(s),t()};return a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-gray-900/40 backdrop-blur-sm transition-opacity",onClick:t}),a.jsxs("div",{className:"relative w-full max-w-md bg-white rounded-xl shadow-xl border border-gray-100 overflow-hidden animate-in fade-in zoom-in-95 duration-200",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-100",children:[a.jsx("h3",{className:"font-semibold text-gray-900",children:"Edit Profile"}),a.jsx("button",{onClick:t,className:"p-1 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg transition-colors",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsxs("form",{onSubmit:o,className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Full Name"}),a.jsx("input",{type:"text",value:s.name,onChange:l=>i({...s,name:l.target.value}),className:"w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-100 focus:border-primary-400 transition-all text-sm"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Role / Job Title"}),a.jsx("input",{type:"text",value:s.role,onChange:l=>i({...s,role:l.target.value}),className:"w-full px-3 py-2 bg-gray-50 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-100 focus:border-primary-400 transition-all text-sm"})]}),a.jsxs("div",{className:"pt-4 flex justify-end gap-3",children:[a.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-100",children:"Cancel"}),a.jsx("button",{type:"submit",className:"px-4 py-2 text-sm font-medium text-white bg-primary-600 rounded-lg shadow-sm hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2",children:"Save Changes"})]})]})]})]})}function UF(){const[e,t]=g.useState(Gi()),[n,r]=g.useState(!1),{sendRpc:s,isConnected:i}=zt(),o=ls(),[l,c]=g.useState(!0),u=g.useRef(!1);g.useEffect(()=>{!i||u.current||(u.current=!0,s("permission.mine").then(d=>c(d.ssoUser??!1)).catch(()=>{}))},[i,s]),g.useEffect(()=>{const d=()=>{const h=Gi();t(h)};return window.addEventListener("user-profile-updated",d),()=>window.removeEventListener("user-profile-updated",d)},[]);const f=async d=>{kc(d);try{await SE(s,d)}catch{}};return a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsx(BF,{isOpen:n,onClose:()=>r(!1),user:e,onSave:f}),a.jsx("header",{className:"h-16 flex items-center justify-end px-6 bg-white sticky top-0 z-10",children:a.jsxs("div",{className:"relative group",children:[a.jsx(kn,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 group-focus-within:text-primary-500 transition-colors"}),a.jsx("input",{type:"text",placeholder:"Search settings...",className:"pl-9 pr-3 py-1.5 bg-gray-50 border-none rounded-md text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-200 w-48 transition-all"})]})}),a.jsx("div",{className:"flex-1 overflow-y-auto bg-white p-8",children:a.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6 flex items-center gap-6 shadow-sm",children:[a.jsx("div",{className:"w-20 h-20 rounded-full bg-gray-100 flex items-center justify-center border border-gray-200",children:a.jsx(Ki,{className:"w-10 h-10 text-gray-400"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("h2",{className:"text-xl font-bold text-gray-900",children:e.name})}),a.jsx("p",{className:"text-gray-500 text-sm mt-1",children:e.role}),o&&a.jsxs("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-gray-400",children:[a.jsx(I1,{className:"w-3.5 h-3.5"}),a.jsx("span",{className:"font-mono",children:o.id})]})]}),a.jsx("button",{onClick:()=>r(!0),className:"px-4 py-2 bg-white border border-gray-200 text-gray-700 rounded-lg text-sm font-medium hover:bg-gray-50 hover:border-gray-300 transition-all shadow-sm",children:"Edit Profile"})]}),!l&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider px-1",children:"Security"}),a.jsx($F,{sendRpc:s})]}),a.jsx("div",{className:"pt-6",children:a.jsxs("button",{onClick:Y1,className:"w-full p-3 rounded-lg border border-red-100 bg-red-50 text-red-600 text-sm font-medium hover:bg-red-100 transition-colors flex items-center justify-center gap-2",children:[a.jsx(C5,{className:"w-4 h-4"}),"Sign Out"]})}),a.jsx("div",{className:"text-center text-xs text-gray-400 pb-8",children:"Siclaw v0.1.0"})]})})]})}function $F({sendRpc:e}){const[t,n]=g.useState(""),[r,s]=g.useState(""),[i,o]=g.useState(""),[l,c]=g.useState(!1),[u,f]=g.useState(""),[d,h]=g.useState(!1),p=async x=>{if(x.preventDefault(),f(""),h(!1),r!==i){f("New passwords do not match");return}if(r.length<4){f("Password must be at least 4 characters");return}c(!0);try{await e("user.changePassword",{oldPassword:t,newPassword:r}),h(!0),n(""),s(""),o("")}catch(b){f((b==null?void 0:b.message)||"Failed to change password")}finally{c(!1)}};return a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm p-5",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx(Tr,{className:"w-5 h-5 text-gray-400"}),a.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Change Password"})]}),a.jsxs("form",{onSubmit:p,className:"space-y-3",children:[a.jsx("input",{type:"password",value:t,onChange:x=>n(x.target.value),placeholder:"Current password",className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",required:!0}),a.jsx("input",{type:"password",value:r,onChange:x=>s(x.target.value),placeholder:"New password",className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",required:!0}),a.jsx("input",{type:"password",value:i,onChange:x=>o(x.target.value),placeholder:"Confirm new password",className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",required:!0}),u&&a.jsx("p",{className:"text-xs text-red-600",children:u}),d&&a.jsx("p",{className:"text-xs text-green-600",children:"Password changed successfully."}),a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 transition-colors disabled:opacity-50 inline-flex items-center gap-2",children:[l&&a.jsx(Ae,{className:"w-4 h-4 animate-spin"}),"Change Password"]})})]})]})}const HF=[{icon:Ki,label:"Profile",to:"/settings",end:!0},{icon:Tr,label:"Credentials",to:"/settings/credentials",end:!1},{icon:U1,label:"System",to:"/settings/system",end:!1}];function WF(){return a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsx("div",{className:"border-b border-gray-200 px-6 bg-white shrink-0",children:a.jsx("nav",{className:"flex gap-1",children:HF.map(e=>a.jsxs(Mf,{to:e.to,end:e.end,className:({isActive:t})=>B("flex items-center gap-2 px-4 py-3 text-sm font-medium border-b-2 transition-colors -mb-px",t?"border-primary-600 text-primary-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"),children:[a.jsx(e.icon,{className:"w-4 h-4"}),e.label]},e.to))})}),a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(yp,{})})]})}const El=[{key:"jwt",title:"JWT Secret",icon:Tr,fields:[{key:"secret",label:"Secret",type:"password",placeholder:"Enter new JWT secret (leave empty to keep current)",writeOnly:!0}]},{key:"sso",title:"SSO Configuration",icon:ru,fields:[{key:"enabled",label:"Enable SSO",type:"toggle"},{key:"issuer",label:"Issuer URL",type:"text",placeholder:"https://dex.example.com"},{key:"clientId",label:"Client ID",type:"text"},{key:"clientSecret",label:"Client Secret",type:"password"},{key:"redirectUri",label:"Redirect URI",type:"text",placeholder:"https://your-domain/auth/callback"}]},{key:"system",title:"System Settings",icon:Oo,fields:[{key:"baseUrl",label:"Base URL",type:"text",placeholder:"https://your-domain.com"},{key:"platformUrl",label:"Platform URL",type:"text",placeholder:"https://your-platform-url"},{key:"agentboxImage",label:"AgentBox Image",type:"text",placeholder:"siclaw-agentbox:latest"}]}];function KF(){const{sendRpc:e,isConnected:t}=zt(),{isAdmin:n,loaded:r}=yu(e,t),[s,i]=g.useState({}),[o,l]=g.useState({}),[c,u]=g.useState(null),[f,d]=g.useState(null),h=g.useRef(!1),p=new Set(El.flatMap(j=>j.fields.filter(S=>S.writeOnly).map(S=>`${j.key}.${S.key}`))),[x,b]=g.useState(new Set),k=g.useCallback(async()=>{try{const S=(await e("system.getConfig")).config??{},N=new Set,w={};for(const[C,D]of Object.entries(S))p.has(C)?D&&N.add(C):w[C]=D;b(N),i(w),l(w)}catch(j){console.warn("[SystemSettings] Failed to load config:",j)}},[e]);g.useEffect(()=>{!t||!n||h.current||(h.current=!0,k())},[t,n,k]);const v=(j,S)=>{i(N=>({...N,[j]:S})),d(null)},m=j=>{const S=El.find(N=>N.key===j);return S?S.fields.some(N=>{const w=`${j}.${N.key}`;return N.writeOnly?!!s[w]:(s[w]??"")!==(o[w]??"")}):!1},y=async j=>{u(j),d(null);try{const S=El.find(w=>w.key===j),N={};for(const w of S.fields){const C=`${j}.${w.key}`,D=s[C]??"";D&&!D.includes("****")?N[w.key]=D:D||(N[w.key]="")}await e("system.saveSection",{section:j,values:N}),await k()}catch(S){d((S==null?void 0:S.message)||"Save failed")}finally{u(null)}};return r?n?a.jsxs("div",{className:"h-full overflow-y-auto p-6 space-y-6",children:[f&&a.jsx("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg text-sm",children:f}),El.map(j=>{const S=j.icon,N=m(j.key),w=c===j.key;return a.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(S,{className:"w-4 h-4 text-gray-500"}),a.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:j.title})]}),a.jsxs("button",{onClick:()=>y(j.key),disabled:!N||w,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors "+(N&&!w?"bg-primary-600 text-white hover:bg-primary-700":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:[w?a.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(Qt,{className:"w-3.5 h-3.5"}),"Save"]})]}),a.jsx("div",{className:"p-5 space-y-4",children:j.fields.map(C=>{const D=`${j.key}.${C.key}`;if(C.type==="toggle"){const z=s[D]==="true";return a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-xs font-medium text-gray-600",children:C.label}),a.jsx("button",{type:"button",role:"switch","aria-checked":z,onClick:()=>v(D,z?"false":"true"),className:"relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 "+(z?"bg-primary-600":"bg-gray-200"),children:a.jsx("span",{className:"pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out "+(z?"translate-x-4":"translate-x-0")})})]},D)}const T=j.fields.find(z=>z.type==="toggle"),M=T?s[`${j.key}.${T.key}`]!=="true":!1,F=C.writeOnly&&x.has(D);return a.jsxs("div",{className:M?"opacity-50":"",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-600",children:C.label}),F&&!s[D]&&a.jsx("span",{className:"text-xs text-green-600 font-medium",children:"Configured"})]}),a.jsx("input",{type:C.type,value:s[D]??"",onChange:z=>v(D,z.target.value),placeholder:C.placeholder,disabled:M,className:"w-full px-3 py-2 border border-gray-200 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"+(M?" bg-gray-50 cursor-not-allowed":"")})]},D)})})]},j.key)})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-400",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-medium text-gray-500 mb-1",children:"System Settings"}),a.jsx("div",{className:"text-sm",children:"Admin access required"})]})}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-400",children:a.jsx(Ae,{className:"w-5 h-5 animate-spin"})})}function GF(){const{sendRpc:e,isConnected:t}=zt(),n=ls(),r=(n==null?void 0:n.username)==="admin",[s,i]=g.useState([]),[o,l]=g.useState(!0),[c,u]=g.useState(null),[f,d]=g.useState(!1),[h,p]=g.useState(null),x=async()=>{try{const m=await e("permission.listUsers");i(m.users)}catch(m){console.error("[Permissions] Failed to load users:",m)}finally{l(!1)}},b=g.useRef(!1);g.useEffect(()=>{t&&r&&!b.current&&(b.current=!0,x())},[t]);const k=async(m,y)=>{const j=m.permissions.includes(y);u(m.id);try{j?await e("permission.revoke",{userId:m.id,permission:y}):await e("permission.grant",{userId:m.id,permission:y}),await x()}catch(S){console.error("[Permissions] Toggle failed:",S)}finally{u(null)}},v=async m=>{u(m.id);try{await e("user.setTestOnly",{userId:m.id,testOnly:!m.testOnly}),await x()}catch(y){console.error("[Permissions] Toggle testOnly failed:",y)}finally{u(null)}};return r?a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsxs("header",{className:"h-16 flex items-center justify-between px-6 bg-white sticky top-0 z-10 border-b border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-primary-50 rounded-lg",children:a.jsx(jp,{className:"w-5 h-5 text-primary-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-bold text-gray-900",children:"Permissions"}),a.jsx("p",{className:"text-xs text-gray-500",children:"Manage user permissions and access control"})]})]}),a.jsxs("button",{onClick:()=>d(!0),className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 transition-colors",children:[a.jsx(en,{className:"w-4 h-4"}),"Create Intern"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:a.jsx("div",{className:"max-w-4xl mx-auto",children:o?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsx(Ae,{className:"w-6 h-6 animate-spin text-gray-400"})}):a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50/50",children:[a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"User"}),a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Username"}),a.jsx("th",{className:"text-center px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"SSO"}),a.jsx("th",{className:"text-center px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Test Only"}),a.jsx("th",{className:"text-center px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Skill Reviewer"}),a.jsx("th",{className:"text-center px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),a.jsx("tbody",{children:s.map(m=>a.jsxs("tr",{className:"border-b border-gray-50 last:border-0 hover:bg-gray-50/50 transition-colors",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:B("w-8 h-8 rounded-full flex items-center justify-center text-xs font-semibold",m.isAdmin?"bg-primary-100 text-primary-700":"bg-gray-100 text-gray-600"),children:(m.name||m.username).charAt(0).toUpperCase()}),a.jsx("span",{className:"text-sm font-medium text-gray-900",children:m.name||m.username})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"text-sm text-gray-500",children:m.username})}),a.jsx("td",{className:"px-6 py-4 text-center",children:m.ssoUser?a.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-blue-50 text-blue-700 text-xs font-medium",children:"SSO"}):a.jsx("span",{className:"text-xs text-gray-300",children:"-"})}),a.jsx("td",{className:"px-6 py-4 text-center",children:m.isAdmin?a.jsx("span",{className:"text-xs text-gray-300",children:"-"}):a.jsx("button",{onClick:()=>v(m),disabled:c===m.id,className:"inline-flex items-center justify-center",children:c===m.id?a.jsx(Ae,{className:"w-4 h-4 animate-spin text-gray-400"}):a.jsx("div",{className:B("relative inline-flex h-5 w-9 flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out cursor-pointer",m.testOnly?"bg-amber-500":"bg-gray-200"),children:a.jsx("span",{className:B("pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-in-out",m.testOnly?"translate-x-4":"translate-x-0")})})})}),a.jsx("td",{className:"px-6 py-4 text-center",children:m.isAdmin?a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full bg-primary-50 text-primary-700 text-xs font-medium",children:[a.jsx(ru,{className:"w-3 h-3"}),"Always"]}):a.jsx("button",{onClick:()=>k(m,"skill_reviewer"),disabled:c===m.id,className:"inline-flex items-center justify-center",children:c===m.id?a.jsx(Ae,{className:"w-4 h-4 animate-spin text-gray-400"}):a.jsx("div",{className:B("relative inline-flex h-5 w-9 flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out cursor-pointer",m.permissions.includes("skill_reviewer")?"bg-green-500":"bg-gray-200"),children:a.jsx("span",{className:B("pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-in-out",m.permissions.includes("skill_reviewer")?"translate-x-4":"translate-x-0")})})})}),a.jsx("td",{className:"px-6 py-4 text-center",children:!m.isAdmin&&!m.ssoUser&&a.jsxs("button",{onClick:()=>p(m.id),className:"inline-flex items-center gap-1 px-2 py-1 text-xs font-medium text-gray-600 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors",title:"Reset Password",children:[a.jsx(Tr,{className:"w-3 h-3"}),"Reset Pwd"]})})]},m.id))})]})})})}),f&&a.jsx(qF,{sendRpc:e,onClose:()=>d(!1),onCreated:x}),h&&a.jsx(YF,{userId:h,sendRpc:e,onClose:()=>p(null)})]}):a.jsx("div",{className:"h-full flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx(O1,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-1",children:"Admin access required"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Only administrators can manage permissions."})]})})}function qF({sendRpc:e,onClose:t,onCreated:n}){const[r,s]=g.useState(""),[i,o]=g.useState(""),[l,c]=g.useState(!1),[u,f]=g.useState(""),d=async h=>{if(h.preventDefault(),!(!r||!i)){c(!0),f("");try{await e("user.create",{username:r,password:i,testOnly:!0}),n(),t()}catch(p){f((p==null?void 0:p.message)||"Failed to create user")}finally{c(!1)}}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30",onClick:t,children:a.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-sm p-6",onClick:h=>h.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Create Intern Account"}),a.jsx("button",{onClick:t,className:"p-1 text-gray-400 hover:text-gray-600 rounded",children:a.jsx(Ge,{className:"w-4 h-4"})})]}),a.jsxs("form",{onSubmit:d,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Username"}),a.jsx("input",{type:"text",value:r,onChange:h=>s(h.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",placeholder:"intern_username",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),a.jsx("input",{type:"password",value:i,onChange:h=>o(h.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",placeholder:"Password",required:!0})]}),a.jsxs("p",{className:"text-xs text-gray-500",children:["This account will be created with ",a.jsx("span",{className:"font-medium text-amber-600",children:"Test Only"})," access."]}),u&&a.jsx("p",{className:"text-xs text-red-600",children:u}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 transition-colors disabled:opacity-50",children:l?a.jsx(Ae,{className:"w-4 h-4 animate-spin"}):"Create"})]})]})]})})}function YF({userId:e,sendRpc:t,onClose:n}){const[r,s]=g.useState(""),[i,o]=g.useState(!1),[l,c]=g.useState(""),[u,f]=g.useState(!1),d=async h=>{if(h.preventDefault(),!!r){o(!0),c("");try{await t("user.resetPassword",{userId:e,password:r}),f(!0),setTimeout(n,1500)}catch(p){c((p==null?void 0:p.message)||"Failed to reset password")}finally{o(!1)}}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30",onClick:n,children:a.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-sm p-6",onClick:h=>h.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Reset Password"}),a.jsx("button",{onClick:n,className:"p-1 text-gray-400 hover:text-gray-600 rounded",children:a.jsx(Ge,{className:"w-4 h-4"})})]}),u?a.jsx("p",{className:"text-sm text-green-600 font-medium",children:"Password reset successfully."}):a.jsxs("form",{onSubmit:d,className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"New Password"}),a.jsx("input",{type:"password",value:r,onChange:h=>s(h.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",placeholder:"New password",required:!0})]}),l&&a.jsx("p",{className:"text-xs text-red-600",children:l}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:i,className:"px-4 py-2 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 transition-colors disabled:opacity-50",children:i?a.jsx(Ae,{className:"w-4 h-4 animate-spin"}):"Reset"})]})]})]})})}function XF({provider:e,models:t,isAdmin:n,onClose:r,onAdd:s,onRemove:i}){const[o,l]=g.useState("llm"),[c,u]=g.useState(!1),[f,d]=g.useState(""),[h,p]=g.useState(""),[x,b]=g.useState(128e3),[k,v]=g.useState(65536),[m,y]=g.useState(!1),[j,S]=g.useState(1024),[N,w]=g.useState(!1),[C,D]=g.useState(null),T=t.filter(R=>R.category!=="embedding"),M=t.filter(R=>R.category==="embedding"),P=o==="llm"?T:M,F=()=>{d(""),p(""),b(128e3),v(65536),y(!1),S(1024),u(!1)},z=async()=>{if(!(!f.trim()||!h.trim())){w(!0);try{await s({id:f.trim(),name:h.trim(),contextWindow:o==="embedding"?0:x,maxTokens:o==="embedding"?0:k,reasoning:o==="embedding"?!1:m,category:o==="embedding"?"embedding":"llm"}),F()}catch(R){console.error("Failed to add model:",R)}finally{w(!1)}}},W=async R=>{D(R);try{await i(R)}catch(V){console.error("Failed to remove model:",V)}finally{D(null)}},fe=R=>{l(R),F()},ee=[{id:"llm",label:"Chat Models"},{id:"embedding",label:"Embedding Models"}];return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[a.jsxs("div",{className:"px-6 py-4 border-b border-gray-100",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["Models — ",e]}),a.jsx("button",{onClick:r,className:"p-1 rounded-lg hover:bg-gray-100 text-gray-400 hover:text-gray-600",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"flex items-center gap-2",children:ee.map(R=>a.jsx("button",{onClick:()=>fe(R.id),className:["px-3 py-1 rounded-full text-xs font-medium transition-all border",o===R.id?"bg-gray-900 text-white border-gray-900":"bg-white text-gray-500 border-gray-200 hover:bg-gray-50 hover:text-gray-700"].join(" "),children:R.label},R.id))})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:[P.length===0?a.jsxs("p",{className:"text-sm text-gray-400 text-center py-8",children:["No ",o==="embedding"?"embedding":"chat"," models configured"]}):a.jsx("div",{className:"space-y-2",children:P.map(R=>a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 rounded-xl border border-gray-100 bg-gray-50/50",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm font-medium text-gray-900 truncate",children:R.name}),a.jsx("div",{className:"text-xs text-gray-400 truncate",children:R.id}),a.jsx("div",{className:"flex gap-3 mt-1 text-xs text-gray-400",children:o==="embedding"?a.jsxs("span",{children:["Dimensions: ",R.dimensions??"—"]}):a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:["Context: ",(R.contextWindow/1e3).toFixed(0),"k"]}),a.jsxs("span",{children:["Max: ",(R.maxTokens/1e3).toFixed(0),"k"]}),R.reasoning&&a.jsx("span",{className:"text-indigo-500",children:"Reasoning"})]})})]}),n&&a.jsx("button",{onClick:()=>W(R.id),disabled:C===R.id,className:"ml-3 p-1.5 rounded-lg text-gray-400 hover:text-red-500 hover:bg-red-50 disabled:opacity-50",title:"Remove model",children:a.jsx(mn,{className:"w-4 h-4"})})]},R.id))}),n&&c&&a.jsxs("div",{className:"mt-4 p-4 rounded-xl border border-indigo-100 bg-indigo-50/30 space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Model ID"}),a.jsx("input",{type:"text",value:f,onChange:R=>d(R.target.value),className:"w-full px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300",placeholder:o==="embedding"?"e.g. BAAI/bge-m3":"e.g. openai/gpt-4o"})]}),a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Display Name"}),a.jsx("input",{type:"text",value:h,onChange:R=>p(R.target.value),className:"w-full px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300",placeholder:o==="embedding"?"e.g. BGE-M3":"e.g. GPT-4o"})]}),o==="embedding"?a.jsxs("div",{className:"col-span-2",children:[a.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Dimensions"}),a.jsx("input",{type:"number",value:j,onChange:R=>S(Number(R.target.value)),className:"w-full px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Context Window"}),a.jsx("input",{type:"number",value:x,onChange:R=>b(Number(R.target.value)),className:"w-full px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:"Max Tokens"}),a.jsx("input",{type:"number",value:k,onChange:R=>v(Number(R.target.value)),className:"w-full px-3 py-1.5 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300"})]})]})]}),o==="llm"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"checkbox",id:"reasoning",checked:m,onChange:R=>y(R.target.checked),className:"rounded border-gray-300 text-indigo-600 focus:ring-indigo-300"}),a.jsx("label",{htmlFor:"reasoning",className:"text-sm text-gray-600",children:"Reasoning model"})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:()=>u(!1),className:"px-3 py-1.5 text-sm text-gray-600 hover:bg-gray-100 rounded-lg",children:"Cancel"}),a.jsx("button",{onClick:z,disabled:N||!f.trim()||!h.trim(),className:"px-3 py-1.5 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50",children:N?"Adding...":"Add"})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-gray-100",children:[n&&!c?a.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-indigo-600 hover:bg-indigo-50 rounded-lg",children:[a.jsx(en,{className:"w-4 h-4"}),"Add ",o==="embedding"?"Embedding":"Chat"," Model"]}):a.jsx("div",{}),a.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800 rounded-lg hover:bg-gray-100",children:"Close"})]})]})})}const xh=[{name:"openai",displayName:"OpenAI",baseUrl:"https://api.openai.com/v1",api:"openai-completions",models:[{id:"gpt-5.4",name:"GPT-5.4",reasoning:!1,contextWindow:2e5,maxTokens:32768,category:"llm"},{id:"gpt-4o",name:"GPT-4o",reasoning:!1,contextWindow:128e3,maxTokens:16384,category:"llm"},{id:"gpt-4o-mini",name:"GPT-4o Mini",reasoning:!1,contextWindow:128e3,maxTokens:16384,category:"llm"},{id:"o3",name:"o3",reasoning:!0,contextWindow:2e5,maxTokens:1e5,category:"llm"},{id:"o3-mini",name:"o3-mini",reasoning:!0,contextWindow:2e5,maxTokens:1e5,category:"llm"},{id:"o4-mini",name:"o4-mini",reasoning:!0,contextWindow:2e5,maxTokens:1e5,category:"llm"},{id:"text-embedding-3-small",name:"Text Embedding 3 Small",reasoning:!1,contextWindow:8191,maxTokens:0,category:"embedding",dimensions:1536},{id:"text-embedding-3-large",name:"Text Embedding 3 Large",reasoning:!1,contextWindow:8191,maxTokens:0,category:"embedding",dimensions:3072}]},{name:"anthropic",displayName:"Anthropic",baseUrl:"https://api.anthropic.com",api:"anthropic",authHeader:!0,models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",reasoning:!0,contextWindow:2e5,maxTokens:32e3,category:"llm"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",reasoning:!1,contextWindow:2e5,maxTokens:16384,category:"llm"},{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",reasoning:!1,contextWindow:2e5,maxTokens:8192,category:"llm"}]},{name:"google",displayName:"Google Gemini",baseUrl:"https://generativelanguage.googleapis.com/v1beta/openai",api:"openai-completions",models:[{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro",reasoning:!0,contextWindow:1048576,maxTokens:65536,category:"llm"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",reasoning:!0,contextWindow:1048576,maxTokens:65536,category:"llm"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",reasoning:!0,contextWindow:1048576,maxTokens:65536,category:"llm"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",reasoning:!1,contextWindow:1048576,maxTokens:8192,category:"llm"}]},{name:"zhipu",displayName:"Zhipu",baseUrl:"https://open.bigmodel.cn/api/paas/v4",api:"openai-completions",models:[{id:"glm-5",name:"GLM-5",reasoning:!0,contextWindow:203e3,maxTokens:8192,category:"llm"},{id:"glm-4-plus",name:"GLM-4 Plus",reasoning:!1,contextWindow:128e3,maxTokens:4096,category:"llm"},{id:"glm-4-long",name:"GLM-4 Long",reasoning:!1,contextWindow:1e6,maxTokens:4096,category:"llm"},{id:"glm-4-air",name:"GLM-4 Air",reasoning:!1,contextWindow:128e3,maxTokens:4096,category:"llm"},{id:"glm-4-airx",name:"GLM-4 AirX",reasoning:!1,contextWindow:128e3,maxTokens:4096,category:"llm"},{id:"glm-4-flash",name:"GLM-4 Flash",reasoning:!1,contextWindow:128e3,maxTokens:4096,category:"llm"},{id:"glm-4-flashx",name:"GLM-4 FlashX",reasoning:!1,contextWindow:128e3,maxTokens:4096,category:"llm"},{id:"embedding-3",name:"Embedding 3",reasoning:!1,contextWindow:8192,maxTokens:0,category:"embedding",dimensions:2048}]},{name:"moonshot",displayName:"Moonshot",baseUrl:"https://api.moonshot.cn/v1",api:"openai-completions",models:[{id:"kimi-k2.5",name:"Kimi K2.5",reasoning:!1,contextWindow:256e3,maxTokens:8192,category:"llm"},{id:"kimi-k2",name:"Kimi K2",reasoning:!1,contextWindow:128e3,maxTokens:8192,category:"llm"},{id:"moonshot-v1-128k",name:"Moonshot v1 128K",reasoning:!1,contextWindow:128e3,maxTokens:4096,category:"llm"},{id:"moonshot-v1-32k",name:"Moonshot v1 32K",reasoning:!1,contextWindow:32e3,maxTokens:4096,category:"llm"}]}];function US({baseUrl:e,apiKey:t,api:n,disabled:r}){const{sendRpc:s}=zt(),[i,o]=g.useState("idle"),[l,c]=g.useState(""),u=async()=>{if(!(!e||!t)){o("testing"),c("");try{const p=await s("provider.testConnection",{baseUrl:e,apiKey:t,api:n});o(p.ok?"success":"error"),c(p.message)}catch(p){o("error"),c(p instanceof Error?p.message:"Test failed")}}},f={idle:a.jsx(Ep,{className:"w-4 h-4"}),testing:a.jsx(Ae,{className:"w-4 h-4 animate-spin"}),success:a.jsx(Lr,{className:"w-4 h-4"}),error:a.jsx(ei,{className:"w-4 h-4"})},d={idle:"text-gray-600 border-gray-200 hover:bg-gray-50",testing:"text-indigo-600 border-indigo-200 bg-indigo-50",success:"text-green-600 border-green-200 bg-green-50",error:"text-red-600 border-red-200 bg-red-50"},h=!r&&!!e&&!!t&&i!=="testing";return a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsxs("button",{type:"button",onClick:u,disabled:!h,className:`flex items-center gap-1.5 px-3 py-2 text-sm font-medium border rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${d[i]}`,children:[f[i],i==="testing"?"Testing...":"Test Connection"]}),l&&a.jsx("p",{className:`text-xs ${i==="success"?"text-green-600":"text-red-500"}`,children:l})]})}function QF({isOpen:e,provider:t,onClose:n,onSave:r}){const s=!!t,[i,o]=g.useState(null),[l,c]=g.useState(""),[u,f]=g.useState(""),[d,h]=g.useState(""),[p,x]=g.useState("openai-completions"),[b,k]=g.useState(!1),[v,m]=g.useState(!1),[y,j]=g.useState("");g.useEffect(()=>{if(e)if(j(""),m(!1),h(""),t){c(t.name),f(t.baseUrl),x(t.api),k(t.authHeader??!1);const C=xh.find(D=>D.name===t.name);o(C??null)}else o(null),c(""),f(""),x("openai-completions"),k(!1)},[e,t]);const S=C=>{s||(o(C),c(C.name),f(C.baseUrl),x(C.api),k(C.authHeader??!1))},N=()=>{s||(o(null),c(""),f(""),x("openai-completions"),k(!1))},w=async()=>{if(!l.trim()){j("Provider name is required");return}m(!0),j("");try{await r({name:l.trim(),baseUrl:u.trim(),apiKey:d,api:p,authHeader:b}),n()}catch(C){j(C instanceof Error?C.message:"Failed to save")}finally{m(!1)}};return a.jsx(Xn,{children:e&&a.jsxs(a.Fragment,{children:[a.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:n,className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-40"}),a.jsxs(Ot.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:200},className:"fixed right-0 top-0 bottom-0 w-[480px] bg-white shadow-2xl z-50 flex flex-col border-l border-gray-100",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-gray-900",children:s?"Edit Provider":"Add Provider"}),a.jsx("p",{className:"text-xs text-gray-400",children:s?t.name:"Configure a new model provider"})]}),a.jsx("button",{onClick:n,className:"p-2 text-gray-400 hover:text-gray-700 hover:bg-gray-50 rounded-lg transition-colors",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[!s&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Provider Template"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[xh.map(C=>a.jsx("button",{onClick:()=>S(C),className:`px-3 py-1.5 text-xs font-medium rounded-lg border transition-colors ${(i==null?void 0:i.name)===C.name?"border-indigo-500 bg-indigo-100 text-indigo-700":"border-gray-200 bg-white text-gray-600 hover:border-gray-300"}`,children:C.displayName},C.name)),a.jsx("button",{onClick:N,className:`px-3 py-1.5 text-xs font-medium rounded-lg border transition-colors ${i?"border-gray-200 bg-white text-gray-600 hover:border-gray-300":"border-indigo-500 bg-indigo-100 text-indigo-700"}`,children:"Custom"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Provider Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:l,onChange:C=>c(C.target.value),disabled:s,className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300 disabled:opacity-60 disabled:bg-gray-50",placeholder:"e.g. openai, deepseek"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"API Type"}),i?a.jsx("div",{className:"px-3 py-2 border border-gray-100 rounded-lg text-sm bg-gray-50 text-gray-500",children:p==="anthropic"?"Anthropic":"OpenAI Compatible"}):a.jsxs("select",{value:p,onChange:C=>{const D=C.target.value;x(D),k(D==="anthropic")},className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300",children:[a.jsx("option",{value:"openai-completions",children:"OpenAI Compatible"}),a.jsx("option",{value:"anthropic",children:"Anthropic"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Base URL"}),a.jsx("input",{type:"text",value:u,onChange:C=>f(C.target.value),className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300",placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["API Key ",s&&t.apiKeySet&&a.jsx("span",{className:"text-gray-400 font-normal",children:"(currently set)"})]}),a.jsx("input",{type:"password",value:d,onChange:C=>h(C.target.value),className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300",placeholder:s&&t.apiKeySet?"Leave blank to keep current key":"sk-..."})]}),a.jsx(US,{baseUrl:u,apiKey:s&&!d&&t.apiKeySet?"***":d,api:p,disabled:!u||!d&&!(s&&t.apiKeySet)}),y&&a.jsx("p",{className:"text-xs text-red-500",children:y})]}),a.jsxs("div",{className:"p-6 border-t border-gray-100 bg-white flex items-center justify-end gap-3",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 rounded-lg transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:w,disabled:v||!l.trim(),className:"px-4 py-2 text-sm font-medium bg-indigo-600 text-white hover:bg-indigo-700 rounded-lg shadow-sm flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Qt,{className:"w-4 h-4"}),v?"Saving...":s?"Save Changes":"Create Provider"]})]})]})]})})}function JF({onComplete:e}){const{sendRpc:t}=zt(),[n,r]=g.useState(null),[s,i]=g.useState(!1),[o,l]=g.useState(""),[c,u]=g.useState(""),[f,d]=g.useState(""),[h,p]=g.useState("openai-completions"),[x,b]=g.useState(null),[k,v]=g.useState(""),[m,y]=g.useState(""),[j,S]=g.useState(!1),[N,w]=g.useState(""),C=F=>{r(F),i(!1),l(F.name),u(F.baseUrl),p(F.api),b(null),w("");const z=F.models.find(W=>W.category==="llm");z&&b(z)},D=()=>{r(null),i(!0),l(""),u(""),p("openai-completions"),b(null),v(""),y(""),w("")},T=async()=>{const F=o.trim();if(!F){w("Provider name is required");return}if(!f){w("API Key is required");return}const z=s?k.trim():x==null?void 0:x.id,W=s?m.trim()||k.trim():x==null?void 0:x.name;if(!z){w("Please select or enter a model");return}S(!0),w("");try{await t("provider.quickSetup",{provider:F,baseUrl:c.trim(),apiKey:f,api:h,authHeader:(n==null?void 0:n.authHeader)??!1,model:{id:z,name:W,reasoning:(x==null?void 0:x.reasoning)??!1,contextWindow:(x==null?void 0:x.contextWindow)??128e3,maxTokens:(x==null?void 0:x.maxTokens)??65536,category:(x==null?void 0:x.category)??"llm"},setAsDefault:!0}),e()}catch(fe){w(fe instanceof Error?fe.message:"Failed to save")}finally{S(!1)}},M=n||s,P=(n==null?void 0:n.models.filter(F=>F.category==="llm"))??[];return a.jsxs("div",{className:"rounded-2xl border-2 border-dashed border-indigo-200 bg-indigo-50/30 p-8",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(su,{className:"w-5 h-5 text-indigo-500"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Quick Setup"})]}),a.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"Select a provider to get started. You can add more providers later."}),a.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[xh.map(F=>a.jsx("button",{onClick:()=>C(F),className:`px-4 py-2 text-sm font-medium rounded-lg border transition-colors ${(n==null?void 0:n.name)===F.name?"border-indigo-500 bg-indigo-100 text-indigo-700":"border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50"}`,children:F.displayName},F.name)),a.jsx("button",{onClick:D,className:`px-4 py-2 text-sm font-medium rounded-lg border transition-colors ${s?"border-indigo-500 bg-indigo-100 text-indigo-700":"border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50"}`,children:"Custom"})]}),M&&a.jsxs("div",{className:"space-y-4 max-w-xl",children:[s&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Provider Name"}),a.jsx("input",{type:"text",value:o,onChange:F=>l(F.target.value),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300",placeholder:"e.g. my-provider"})]}),n&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"API Type"}),a.jsx("div",{className:"px-3 py-2 border border-gray-100 rounded-lg text-sm bg-gray-50 text-gray-500",children:n.api==="anthropic"?"Anthropic":"OpenAI Compatible"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Base URL"}),a.jsx("input",{type:"text",value:c,onChange:F=>u(F.target.value),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300",placeholder:"https://api.example.com/v1"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"API Key"}),a.jsx("input",{type:"password",value:f,onChange:F=>d(F.target.value),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300",placeholder:"sk-..."})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Model"}),s?a.jsxs("div",{className:"space-y-2",children:[a.jsx("input",{type:"text",value:k,onChange:F=>v(F.target.value),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300",placeholder:"Model ID (e.g. gpt-4o)"}),a.jsx("input",{type:"text",value:m,onChange:F=>y(F.target.value),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300",placeholder:"Display name (optional)"})]}):a.jsxs("div",{className:"relative",children:[a.jsxs("select",{value:(x==null?void 0:x.id)??"",onChange:F=>{const z=P.find(W=>W.id===F.target.value);z&&b(z)},className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300 appearance-none pr-8",children:[a.jsx("option",{value:"",children:"Select a model"}),P.map(F=>a.jsxs("option",{value:F.id,children:[F.name," ",F.reasoning?"(reasoning)":""]},F.id))]}),a.jsx(rs,{className:"w-4 h-4 text-gray-400 absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none"})]})]}),N&&a.jsx("p",{className:"text-sm text-red-500",children:N}),a.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[a.jsx(US,{baseUrl:c,apiKey:f,api:h}),a.jsx("button",{onClick:T,disabled:j||!f,className:"flex items-center gap-2 px-5 py-2 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:j?"Saving...":"Save & Activate"})]})]})]})}function ZF(){const{sendRpc:e,isConnected:t}=zt(),{isAdmin:n}=yu(e,t),[r,s]=g.useState([]),[i,o]=g.useState([]),[l,c]=g.useState(""),[u,f]=g.useState(""),[d,h]=g.useState(!1),[p,x]=g.useState(""),[b,k]=g.useState(1024),[v,m]=g.useState(null),[y,j]=g.useState(!1),[S,N]=g.useState(!1),[w,C]=g.useState(null),[D,T]=g.useState(null),M=g.useRef(!1),P=g.useCallback(async()=>{try{const K=await e("provider.list");s(K.providers??[])}catch(K){console.error("Failed to load providers:",K)}},[e]),F=g.useCallback(async()=>{try{const K=await e("model.list");if(o(K.models??[]),K.default){const $=`${K.default.provider}::${K.default.modelId}`;c($),f($)}}catch(K){console.error("Failed to load models:",K)}},[e]),z=g.useCallback(async()=>{try{const K=await e("embedding.getConfig");K.config&&(x(`${K.config.provider}::${K.config.model}`),k(K.config.dimensions),m(K.config))}catch(K){console.error("Failed to load embedding config:",K)}},[e]);g.useEffect(()=>{t&&!M.current&&(M.current=!0,P(),F(),z())},[t,P,F,z]);const W=K=>{const $=K.indexOf("::");return $<0?{provider:"",modelId:""}:{provider:K.slice(0,$),modelId:K.slice($+2)}},fe=async()=>{const{provider:K,modelId:$}=W(l);if(!(!K||!$)){h(!0);try{await e("config.setDefaultModel",{provider:K,modelId:$}),f(l);try{new BroadcastChannel("siclaw-model-config").postMessage("default-changed")}catch{}}catch(xe){console.error("Failed to save default model:",xe)}finally{h(!1)}}},ee=async()=>{const{provider:K,modelId:$}=W(p);if(!(!K||!$||!b)){j(!0);try{await e("embedding.setConfig",{provider:K,model:$,dimensions:b}),m({provider:K,model:$,dimensions:b})}catch(xe){console.error("Failed to save embedding config:",xe)}finally{j(!1)}}},R=async K=>{const $={provider:K.name,baseUrl:K.baseUrl,api:K.api,authHeader:K.authHeader};K.apiKey&&($.apiKey=K.apiKey),await e("provider.save",$),await P()},V=async(K,$)=>{await e("provider.addModel",{provider:K,model:$}),await Promise.all([P(),F()])},E=async(K,$)=>{await e("provider.removeModel",{provider:K,modelId:$}),await Promise.all([P(),F()])},Y=async K=>{if(window.confirm(`Delete provider "${K}" and all its models?`))try{await e("provider.delete",{provider:K}),await Promise.all([P(),F()])}catch($){console.error("Failed to delete provider:",$)}},J=()=>{P(),F()},L=()=>{C(null),N(!0)},Q=K=>{C(K),N(!0)},te=i.filter(K=>K.category!=="embedding"),pe=i.filter(K=>K.category==="embedding"),ne=K=>{var xe;const $={};for(const q of K)($[xe=q.provider]??($[xe]=[])).push(q);return $},ie=ne(te),he=ne(pe),Ce=l!==u,Te=v?p!==`${v.provider}::${v.model}`||b!==v.dimensions:!!p;return a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-8 max-w-5xl mx-auto w-full",children:[a.jsxs("section",{className:"mb-10",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Providers"}),n&&r.length>0&&a.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 transition-colors",children:[a.jsx(en,{className:"w-4 h-4"}),"Add Provider"]})]}),r.length===0?n?a.jsx(JF,{onComplete:J}):a.jsx("p",{className:"text-sm text-gray-400 text-center py-12",children:"No providers configured"}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:r.map(K=>a.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 hover:shadow-md transition-shadow",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:K.name}),a.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-gray-100 text-gray-500",children:K.api})]}),a.jsxs("div",{className:"space-y-2 mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[a.jsx(Oo,{className:"w-3.5 h-3.5 text-gray-400"}),a.jsx("span",{className:"truncate",children:K.baseUrl||"Not set"})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[a.jsx(S5,{className:"w-3.5 h-3.5 text-gray-400"}),a.jsx("span",{children:K.apiKeySet?K.apiKey:"Not set"})]}),a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[a.jsx(wp,{className:"w-3.5 h-3.5 text-gray-400"}),a.jsxs("span",{children:[K.modelCount," model",K.modelCount!==1?"s":""]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>T(K.name),className:"flex-1 px-3 py-1.5 text-sm font-medium text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-lg transition-colors",children:"Models"}),n&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>Q(K),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-gray-600 bg-gray-100 hover:bg-gray-200 rounded-lg transition-colors",children:[a.jsx(nu,{className:"w-3.5 h-3.5"}),"Settings"]}),a.jsx("button",{onClick:()=>Y(K.name),className:"flex items-center px-2 py-1.5 text-sm text-red-500 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",title:"Delete provider",children:a.jsx(mn,{className:"w-3.5 h-3.5"})})]})]})]},K.name))})]}),r.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"mb-10",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Default Chat Model"}),a.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-gray-50/50 p-6",children:[a.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"The default model for new chat sessions."}),a.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[a.jsxs("div",{className:"flex-1 min-w-[300px]",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Model"}),a.jsxs("select",{value:l,onChange:K=>c(K.target.value),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300",children:[a.jsx("option",{value:"",children:"Select model"}),Object.entries(ie).map(([K,$])=>a.jsx("optgroup",{label:K,children:$.map(xe=>a.jsx("option",{value:`${K}::${xe.id}`,children:xe.name},`${K}::${xe.id}`))},K))]})]}),n&&a.jsxs("button",{onClick:fe,disabled:d||!Ce||!l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Qt,{className:"w-4 h-4"}),d?"Saving...":"Save"]})]})]})]}),a.jsxs("section",{className:"mb-10",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Default Embedding Model"}),a.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-gray-50/50 p-6",children:[a.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Configure the embedding model used for memory search and semantic retrieval."}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[a.jsxs("div",{className:"flex-1 min-w-[300px]",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Model"}),a.jsxs("select",{value:p,onChange:K=>x(K.target.value),disabled:!n,className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300 disabled:opacity-50",children:[a.jsx("option",{value:"",children:"Select model"}),Object.entries(he).map(([K,$])=>a.jsx("optgroup",{label:K,children:$.map(xe=>a.jsx("option",{value:`${K}::${xe.id}`,children:xe.name},`${K}::${xe.id}`))},K))]})]}),a.jsxs("div",{className:"w-[120px]",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Dimensions"}),a.jsx("input",{type:"number",value:b,onChange:K=>k(Number(K.target.value)||0),disabled:!n,placeholder:"1024",className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300 focus:border-indigo-300 disabled:opacity-50"})]}),n&&a.jsxs("button",{onClick:ee,disabled:y||!Te||!p||!b,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Qt,{className:"w-4 h-4"}),y?"Saving...":"Save"]})]})})]})]})]})]}),a.jsx(QF,{isOpen:S,provider:w,onClose:()=>N(!1),onSave:R}),D&&a.jsx(XF,{provider:D,models:i.filter(K=>K.provider===D),isAdmin:n,onClose:()=>T(null),onAdd:K=>V(D,K),onRemove:K=>E(D,K)})]})}const Wy="siclaw_selected_brain",eO=[{id:"pi-agent",name:"PI Agent",description:"Multi-turn agentic framework with tool execution and auto-compaction",icon:h5},{id:"claude-sdk",name:"Claude Agent SDK",description:"Anthropic's native agent SDK with built-in tool use",icon:z1}];function tO(){const[e,t]=g.useState(()=>localStorage.getItem(Wy)||"pi-agent");return g.useEffect(()=>{localStorage.setItem(Wy,e)},[e]),a.jsx("div",{className:"h-full bg-white flex flex-col",children:a.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-8 max-w-5xl mx-auto w-full",children:a.jsxs("section",{children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Agent Engine"}),a.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-gray-50/50 p-6",children:[a.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Choose the agent engine used for new chat sessions. This determines how tools are executed and conversations are managed."}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:eO.map(n=>{const r=e===n.id,s=n.icon;return a.jsxs("button",{type:"button",onClick:()=>t(n.id),className:B("rounded-xl border p-5 cursor-pointer transition-all text-left",r?"border-indigo-300 bg-indigo-50/50 ring-2 ring-indigo-200":"border-gray-200 bg-white hover:border-gray-300 hover:shadow-sm"),children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsx("div",{className:B("p-2 rounded-lg",r?"bg-indigo-100 text-indigo-600":"bg-gray-100 text-gray-500"),children:a.jsx(s,{className:"w-5 h-5"})}),r&&a.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-indigo-600 bg-indigo-100 px-2 py-0.5 rounded-full",children:[a.jsx(qt,{className:"w-3 h-3"}),"Active"]})]}),a.jsx("h3",{className:B("text-sm font-semibold mb-1",r?"text-indigo-900":"text-gray-900"),children:n.name}),a.jsx("p",{className:"text-sm text-gray-500",children:n.description})]},n.id)})})]})]})})})}function nO(e){const[t,n]=g.useState([]),[r,s]=g.useState(!0),i=g.useCallback(async()=>{try{const u=await e("credential.list");n(u.credentials??[])}catch(u){console.error("[useCredentials] Failed to load:",u)}finally{s(!1)}},[e]),o=g.useCallback(async u=>{const f=await e("credential.create",u);return await i(),f},[e,i]),l=g.useCallback(async(u,f)=>{await e("credential.update",{id:u,...f}),await i()},[e,i]),c=g.useCallback(async u=>{await e("credential.delete",{id:u}),await i()},[e,i]);return{credentials:t,loading:r,loadCredentials:i,createCredential:o,updateCredential:l,deleteCredential:c}}const rO={ssh_password:"SSH Password",ssh_key:"SSH Key",kubeconfig:"Kubeconfig",api_token:"API Token",api_basic_auth:"API Basic Auth"},$S=[{value:"ssh_password",label:"SSH Password"},{value:"ssh_key",label:"SSH Key"},{value:"kubeconfig",label:"Kubeconfig"},{value:"api_token",label:"API Token"},{value:"api_basic_auth",label:"API Basic Auth"}],sO={ssh_password:Fn,ssh_key:ru,kubeconfig:b5,api_token:Oo,api_basic_auth:Tr};function iO({credential:e,isOpen:t,onClose:n,onSave:r,onUpdate:s}){const i=!!e,[o,l]=g.useState("ssh_password"),[c,u]=g.useState(""),[f,d]=g.useState(""),[h,p]=g.useState(""),[x,b]=g.useState(""),[k,v]=g.useState(""),[m,y]=g.useState(""),[j,S]=g.useState(""),[N,w]=g.useState(""),[C,D]=g.useState(""),[T,M]=g.useState(""),[P,F]=g.useState(""),[z,W]=g.useState(""),[fe,ee]=g.useState(""),[R,V]=g.useState(""),[E,Y]=g.useState(""),[J,L]=g.useState(""),[Q,te]=g.useState(""),[pe,ne]=g.useState(""),[ie,he]=g.useState(!1);g.useEffect(()=>{if(t)if(ne(""),he(!1),e){l(e.type),u(e.name),d(e.description??"");const q=e.configJson??{};switch(e.type){case"ssh_password":p(q.host??""),b(q.port??""),v(q.username??""),y("");break;case"ssh_key":S(q.host??""),w(q.port??""),D(q.username??""),M(""),F("");break;case"kubeconfig":W("");break;case"api_token":ee(q.url??""),V("");break;case"api_basic_auth":Y(q.url??""),L(q.username??""),te("");break}}else l("ssh_password"),u(""),d(""),p(""),b(""),v(""),y(""),S(""),w(""),D(""),M(""),F(""),W(""),ee(""),V(""),Y(""),L(""),te("")},[t,e]);const Ce=()=>{switch(o){case"ssh_password":{const q={username:k,password:m};return h&&(q.host=h),x&&(q.port=x),q}case"ssh_key":{const q={username:C,privateKey:T};return j&&(q.host=j),N&&(q.port=N),P&&(q.passphrase=P),q}case"kubeconfig":return{content:z};case"api_token":return{url:fe,token:R};case"api_basic_auth":return{url:E,username:J,password:Q}}},Te=()=>{if(!c.trim())return!1;switch(o){case"ssh_password":return!!(k&&(i||m));case"ssh_key":return!!(C&&(i||T));case"kubeconfig":return i||!!z;case"api_token":return!!(fe&&(i||R));case"api_basic_auth":return!!(E&&J&&(i||Q))}},K=async()=>{if(!ie){he(!0),ne("");try{if(i){const q={name:c,description:f||void 0},ye=Ce();(o==="ssh_password"?!!m:o==="ssh_key"?!!T:o==="kubeconfig"?!!z:o==="api_token"?!!R:!!Q)&&(q.configJson=ye),await s(e.id,q)}else await r({name:c,type:o,description:f||void 0,configJson:Ce()});n()}catch(q){ne((q==null?void 0:q.message)||"Failed to save")}finally{he(!1)}}},$=i?"Edit Credential":"New Credential",xe=i?e.name:"Add a new credential";return a.jsx(Xn,{children:t&&a.jsxs(a.Fragment,{children:[a.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:n,className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-40"}),a.jsxs(Ot.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:200},className:"fixed right-0 top-0 bottom-0 w-[480px] bg-white shadow-2xl z-50 flex flex-col border-l border-gray-100",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-white",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-gray-900",children:$}),a.jsx("p",{className:"text-xs text-gray-400",children:xe})]}),a.jsx("button",{onClick:n,className:"p-2 text-gray-400 hover:text-gray-700 hover:bg-gray-50 rounded-lg transition-colors",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Type ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:$S.map(q=>{const ye=sO[q.value],Le=o===q.value;return a.jsxs("button",{type:"button",disabled:i,onClick:()=>l(q.value),className:B("flex items-center gap-2 px-3 py-2.5 rounded-lg border text-sm font-medium transition-colors text-left",Le?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-200 text-gray-600 hover:border-gray-300 hover:bg-gray-50",i&&"opacity-60 cursor-not-allowed"),children:[a.jsx(ye,{className:"w-4 h-4"}),q.label]},q.value)})})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:c,onChange:q=>u(q.target.value),placeholder:"e.g. Production SSH, Staging API",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Description"}),a.jsx("input",{type:"text",value:f,onChange:q=>d(q.target.value),placeholder:"Optional description",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),o==="ssh_password"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Host"}),a.jsx("input",{type:"text",value:h,onChange:q=>p(q.target.value),placeholder:"10.0.0.1",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Port"}),a.jsx("input",{type:"text",value:x,onChange:q=>b(q.target.value),placeholder:"22",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Username ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:k,onChange:q=>v(q.target.value),placeholder:"root",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Password ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"password",value:m,onChange:q=>y(q.target.value),placeholder:i?"(unchanged)":"Password",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]})]}),o==="ssh_key"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Host"}),a.jsx("input",{type:"text",value:j,onChange:q=>S(q.target.value),placeholder:"10.0.0.1",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Port"}),a.jsx("input",{type:"text",value:N,onChange:q=>w(q.target.value),placeholder:"22",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Username ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:C,onChange:q=>D(q.target.value),placeholder:"root",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Private Key ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("textarea",{value:T,onChange:q=>M(q.target.value),placeholder:i?"(unchanged) Paste new key to replace...":"Paste private key (PEM format)...",rows:8,className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 resize-none"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Passphrase"}),a.jsx("input",{type:"password",value:P,onChange:q=>F(q.target.value),placeholder:i?"(unchanged)":"Optional passphrase",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]})]}),o==="kubeconfig"&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Kubeconfig Content ",a.jsx("span",{className:"text-red-500",children:"*"})]}),i&&a.jsx("p",{className:"text-xs text-gray-400",children:"Kubeconfig is stored. Paste new content to replace it."}),a.jsx("textarea",{value:z,onChange:q=>W(q.target.value),placeholder:i?"(unchanged) Paste new kubeconfig to replace...":"Paste kubeconfig YAML content...",rows:12,className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 resize-none"})]}),o==="api_token"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["URL ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:fe,onChange:q=>ee(q.target.value),placeholder:"https://api.example.com",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Token ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"password",value:R,onChange:q=>V(q.target.value),placeholder:i?"(unchanged)":"Bearer token value",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]})]}),o==="api_basic_auth"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["URL ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:E,onChange:q=>Y(q.target.value),placeholder:"https://api.example.com",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Username ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:J,onChange:q=>L(q.target.value),placeholder:"Username",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Password ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"password",value:Q,onChange:q=>te(q.target.value),placeholder:i?"(unchanged)":"Password",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]})]}),pe&&a.jsx("p",{className:"text-xs text-red-500",children:pe})]}),a.jsxs("div",{className:"p-6 border-t border-gray-100 bg-white flex items-center justify-end gap-3",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 rounded-lg transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:K,disabled:!Te()||ie,className:"px-4 py-2 text-sm font-medium bg-primary-600 text-white hover:bg-primary-700 rounded-lg shadow-sm flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Qt,{className:"w-4 h-4"}),ie?"Saving...":i?"Save Changes":"Create Credential"]})]})]})]})})}const aO={ssh_password:"bg-emerald-50 text-emerald-700",ssh_key:"bg-teal-50 text-teal-700",kubeconfig:"bg-blue-50 text-blue-700",api_token:"bg-purple-50 text-purple-700",api_basic_auth:"bg-amber-50 text-amber-700"};function oO(){const{sendRpc:e,isConnected:t}=zt(),{credentials:n,loading:r,loadCredentials:s,createCredential:i,updateCredential:o,deleteCredential:l}=nO(e),[c,u]=g.useState(""),[f,d]=g.useState(""),[h,p]=g.useState(!1),[x,b]=g.useState(null),[k,v]=g.useState(null),m=g.useRef(!1);g.useEffect(()=>{t&&!m.current&&(m.current=!0,s())},[t]);const y=g.useMemo(()=>{let w=n;if(f&&(w=w.filter(C=>C.type===f)),c.trim()){const C=c.toLowerCase();w=w.filter(D=>D.name.toLowerCase().includes(C)||(D.description??"").toLowerCase().includes(C)||D.configSummary.toLowerCase().includes(C))}return w},[n,c,f]),j=()=>{b(null),p(!0)},S=w=>{b(w),p(!0)},N=async(w,C)=>{if(w.stopPropagation(),!k){v(C);try{await l(C)}catch(D){console.error("[Credentials] Delete failed:",D)}finally{v(null)}}};return a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsxs("header",{className:"h-16 flex items-center justify-between px-6 bg-white sticky top-0 z-10 border-b border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-primary-50 rounded-lg",children:a.jsx(Tr,{className:"w-5 h-5 text-primary-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-bold text-gray-900",children:"Credentials"}),a.jsx("p",{className:"text-xs text-gray-500",children:"Manage your SSH, API, and Kubeconfig credentials"})]})]}),a.jsxs("button",{onClick:j,className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 transition-colors",children:[a.jsx(en,{className:"w-4 h-4"}),"New Credential"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx(kn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",value:c,onChange:w=>u(w.target.value),placeholder:"Search credentials...",className:"w-full pl-9 pr-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("select",{value:f,onChange:w=>d(w.target.value),className:"px-3 py-2 border border-gray-200 rounded-lg text-sm text-gray-700 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 bg-white",children:[a.jsx("option",{value:"",children:"All Types"}),$S.map(w=>a.jsx("option",{value:w.value,children:w.label},w.value))]})]}),r?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsx(Ae,{className:"w-6 h-6 animate-spin text-gray-400"})}):y.length===0?a.jsxs("div",{className:"text-center py-20",children:[a.jsx(Tr,{className:"w-12 h-12 text-gray-200 mx-auto mb-4"}),a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-1",children:n.length===0?"No credentials yet":"No matching credentials"}),a.jsx("p",{className:"text-xs text-gray-500",children:n.length===0?"Create your first credential to get started.":"Try adjusting your search or filter."})]}):a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50/50",children:[a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Name"}),a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Type"}),a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Details"}),a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Description"}),a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Updated"}),a.jsx("th",{className:"text-center px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),a.jsx("tbody",{children:y.map(w=>a.jsxs("tr",{onClick:()=>S(w),className:"border-b border-gray-50 last:border-0 hover:bg-gray-50/50 transition-colors cursor-pointer",children:[a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"text-sm font-medium text-gray-900",children:w.name})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:B("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",aO[w.type]),children:rO[w.type]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"text-sm text-gray-500 font-mono text-xs",children:w.configSummary})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"text-sm text-gray-500 truncate block max-w-[200px]",children:w.description||"-"})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"text-xs text-gray-400",children:w.updatedAt?new Date(w.updatedAt).toLocaleDateString():"-"})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx("button",{onClick:C=>{C.stopPropagation(),S(w)},className:"p-1.5 text-gray-400 hover:text-primary-600 hover:bg-primary-50 rounded-lg transition-colors",title:"Edit",children:a.jsx(zo,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:C=>N(C,w.id),disabled:k===w.id,className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors disabled:opacity-50",title:"Delete",children:k===w.id?a.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(mn,{className:"w-3.5 h-3.5"})})]})})]},w.id))})]})})]})}),a.jsx(iO,{credential:x,isOpen:h,onClose:()=>p(!1),onSave:async w=>{await i(w)},onUpdate:async(w,C)=>{await o(w,C)}})]})}const lO=[{name:"indigo",class:"bg-indigo-500"},{name:"blue",class:"bg-blue-500"},{name:"green",class:"bg-green-500"},{name:"amber",class:"bg-amber-500"},{name:"rose",class:"bg-rose-500"},{name:"purple",class:"bg-purple-500"},{name:"teal",class:"bg-teal-500"},{name:"gray",class:"bg-gray-400"}];function cO({workspace:e,onClose:t,onSaved:n,sendRpc:r}){var ee,R;const s=!e,i=(e==null?void 0:e.isDefault)??!1,[o,l]=g.useState("general"),[c,u]=g.useState((e==null?void 0:e.name)??""),[f,d]=g.useState(((ee=e==null?void 0:e.configJson)==null?void 0:ee.color)??"indigo"),[h,p]=g.useState(((R=e==null?void 0:e.configJson)==null?void 0:R.systemPrompt)??""),[x,b]=g.useState(!1),[k,v]=g.useState(new Set),[m,y]=g.useState(new Set),[j,S]=g.useState(new Set),[N,w]=g.useState([]),[C,D]=g.useState([]),[T,M]=g.useState([]);g.useEffect(()=>{r("skill.list",{limit:500}).then(V=>w(V.skills??[])).catch(()=>{}),r("workspace.availableTools").then(V=>D(V.tools??[])).catch(()=>{}),r("credential.list").then(V=>M(V.credentials??[])).catch(()=>{}),e&&!e.isDefault&&r("workspace.getConfig",{id:e.id}).then(V=>{v(new Set(V.skills??[])),y(new Set(V.tools??[])),S(new Set(V.credentials??[]))}).catch(()=>{})},[r,e]);const P=g.useCallback(V=>{v(E=>{const Y=new Set(E);return Y.has(V)?Y.delete(V):Y.add(V),Y})},[]),F=g.useCallback(V=>{y(E=>{const Y=new Set(E);return Y.has(V)?Y.delete(V):Y.add(V),Y})},[]),z=g.useCallback(V=>{S(E=>{const Y=new Set(E);return Y.has(V)?Y.delete(V):Y.add(V),Y})},[]),W=async()=>{if(c.trim()){b(!0);try{if(s){const E=(await r("workspace.create",{name:c.trim(),config:{color:f,systemPrompt:h||void 0}})).workspace.id;await Promise.all([r("workspace.setSkills",{workspaceId:E,skills:[...k]}),r("workspace.setTools",{workspaceId:E,tools:[...m]}),r("workspace.setCredentials",{workspaceId:E,credentialIds:[...j]})])}else i||(await r("workspace.update",{id:e.id,name:c.trim(),config:{...e.configJson,color:f,systemPrompt:h||void 0}}),await Promise.all([r("workspace.setSkills",{workspaceId:e.id,skills:[...k]}),r("workspace.setTools",{workspaceId:e.id,tools:[...m]}),r("workspace.setCredentials",{workspaceId:e.id,credentialIds:[...j]})]));n()}catch(V){console.error("Failed to save workspace:",V)}finally{b(!1)}}},fe=[{key:"general",label:"General"},...i?[]:[{key:"skills",label:`Skills (${k.size})`},{key:"tools",label:`Tools (${m.size})`},{key:"credentials",label:`Credentials (${j.size})`}]];return a.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-50",onClick:t,children:a.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-lg max-h-[85vh] flex flex-col",onClick:V=>V.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:s?"Create Workspace":i?"Default Workspace":`Edit: ${e.name}`}),a.jsx("button",{onClick:t,className:"p-1.5 text-gray-400 hover:text-gray-600 rounded-md",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"flex gap-1 px-6 pt-3 border-b border-gray-100",children:fe.map(V=>a.jsx("button",{onClick:()=>l(V.key),className:`px-3 py-2 text-sm font-medium rounded-t-md transition-colors ${o===V.key?"text-indigo-600 border-b-2 border-indigo-600":"text-gray-500 hover:text-gray-700"}`,children:V.label},V.key))}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:[o==="general"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Name"}),a.jsx("input",{type:"text",value:c,onChange:V=>u(V.target.value),disabled:i,placeholder:"My Workspace",className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300 disabled:opacity-50"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Color"}),a.jsx("div",{className:"flex gap-2",children:lO.map(V=>a.jsx("button",{onClick:()=>!i&&d(V.name),disabled:i,className:`w-7 h-7 rounded-full ${V.class} flex items-center justify-center transition-transform ${f===V.name?"ring-2 ring-offset-2 ring-indigo-400 scale-110":"hover:scale-105"} disabled:opacity-50`,children:f===V.name&&a.jsx(qt,{className:"w-3.5 h-3.5 text-white"})},V.name))})]}),!i&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"System Prompt"}),a.jsx("textarea",{value:h,onChange:V=>p(V.target.value),placeholder:"Optional: custom instructions for this workspace...",rows:4,className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300 resize-none"})]}),i&&a.jsx("p",{className:"text-sm text-gray-400 italic",children:"The default workspace includes all skills, tools, and credentials. It cannot be modified."})]}),o==="skills"&&a.jsx("div",{className:"space-y-1",children:N.length===0?a.jsx("p",{className:"text-sm text-gray-400 py-4 text-center",children:"No skills available"}):N.map(V=>a.jsxs("label",{className:"flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-gray-50 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:k.has(V.name),onChange:()=>P(V.name),className:"rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"}),a.jsx("span",{className:"text-sm text-gray-900 flex-1",children:V.name}),a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-100 text-gray-500",children:V.scope})]},V.name))}),o==="tools"&&a.jsx("div",{className:"space-y-1",children:C.length===0?a.jsx("p",{className:"text-sm text-gray-400 py-4 text-center",children:"No tools available"}):C.map(V=>a.jsxs("label",{className:"flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-gray-50 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:m.has(V),onChange:()=>F(V),className:"rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"}),a.jsx("span",{className:"text-sm text-gray-900 font-mono",children:V})]},V))}),o==="credentials"&&a.jsx("div",{className:"space-y-1",children:T.length===0?a.jsx("p",{className:"text-sm text-gray-400 py-4 text-center",children:"No credentials available"}):T.map(V=>a.jsxs("label",{className:"flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-gray-50 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:j.has(V.id),onChange:()=>z(V.id),className:"rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"}),a.jsx("span",{className:"text-sm text-gray-900 flex-1",children:V.name}),a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-100 text-gray-500",children:V.type})]},V.id))})]}),!i&&a.jsxs("div",{className:"flex justify-end gap-3 px-6 py-4 border-t border-gray-200",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-600 bg-gray-100 hover:bg-gray-200 rounded-lg",children:"Cancel"}),a.jsx("button",{onClick:W,disabled:x||!c.trim(),className:"px-4 py-2 text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 rounded-lg disabled:opacity-50",children:x?"Saving...":s?"Create":"Save"})]})]})})}const uO={indigo:"bg-indigo-500",blue:"bg-blue-500",green:"bg-green-500",amber:"bg-amber-500",rose:"bg-rose-500",purple:"bg-purple-500",teal:"bg-teal-500",gray:"bg-gray-400"};function dO(e){return uO[e??""]??"bg-indigo-500"}function fO(){const{sendRpc:e,isConnected:t}=zt(),{reload:n}=Ap(),[r,s]=g.useState([]),[i,o]=g.useState(null),[l,c]=g.useState(!1),[u,f]=g.useState({}),[d,h]=g.useState({}),[p,x]=g.useState({}),b=g.useRef(!1),k=g.useCallback(async()=>{if(t)try{const j=(await e("workspace.list")).workspaces??[];s(j);for(const S of j)S.isDefault||e("workspace.getConfig",{id:S.id}).then(N=>{f(w=>{var C;return{...w,[S.id]:((C=N.skills)==null?void 0:C.length)??0}}),h(w=>{var C;return{...w,[S.id]:((C=N.tools)==null?void 0:C.length)??0}}),x(w=>{var C;return{...w,[S.id]:((C=N.environments)==null?void 0:C.length)??0}})}).catch(()=>{})}catch(y){console.error("Failed to load workspaces:",y)}},[t,e]);g.useEffect(()=>{t&&!b.current&&(b.current=!0,k())},[t,k]);const v=async y=>{if(!y.isDefault&&window.confirm(`Delete workspace "${y.name}"? Sessions in this workspace will no longer be scoped.`))try{await e("workspace.delete",{id:y.id}),await k(),n()}catch(j){console.error("Failed to delete workspace:",j)}},m=()=>{o(null),c(!1),k(),n()};return a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-8 max-w-5xl mx-auto w-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-semibold text-gray-900",children:"Workspaces"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Isolated contexts with scoped skills, tools, and environments."})]}),a.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-lg hover:bg-indigo-700",children:[a.jsx(en,{className:"w-4 h-4"}),"New Workspace"]})]}),r.length===0?a.jsx("p",{className:"text-sm text-gray-400 text-center py-12",children:"No workspaces configured"}):a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.map(y=>{var j;return a.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-5 hover:shadow-md transition-shadow",children:[a.jsxs("div",{className:"flex items-start justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`w-3 h-3 rounded-full ${dO((j=y.configJson)==null?void 0:j.color)}`}),a.jsx("h3",{className:"text-base font-semibold text-gray-900",children:y.name})]}),y.isDefault&&a.jsxs("span",{className:"flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-amber-50 text-amber-600",children:[a.jsx(R5,{className:"w-3 h-3"}),"Default"]})]}),a.jsx("div",{className:"space-y-1.5 mb-4 text-sm text-gray-500",children:y.isDefault?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(P1,{className:"w-3.5 h-3.5 text-gray-400"}),a.jsx("span",{children:"All skills, tools & environments"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-3.5 text-center text-xs font-mono text-gray-400",children:"S"}),a.jsxs("span",{children:[u[y.id]??0," skills"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-3.5 text-center text-xs font-mono text-gray-400",children:"T"}),a.jsxs("span",{children:[d[y.id]??0," tools"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"w-3.5 text-center text-xs font-mono text-gray-400",children:"E"}),a.jsxs("span",{children:[p[y.id]??0," environments"]})]})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>o(y),className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 text-sm font-medium text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-lg transition-colors",children:[a.jsx(zo,{className:"w-3.5 h-3.5"}),y.isDefault?"View":"Edit"]}),!y.isDefault&&a.jsx("button",{onClick:()=>v(y),className:"flex items-center px-2 py-1.5 text-sm text-red-500 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",title:"Delete workspace",children:a.jsx(mn,{className:"w-3.5 h-3.5"})})]})]},y.id)}),a.jsxs("button",{onClick:()=>c(!0),className:"rounded-2xl border-2 border-dashed border-gray-200 p-5 flex flex-col items-center justify-center gap-2 text-gray-400 hover:border-indigo-300 hover:text-indigo-500 transition-colors min-h-[160px]",children:[a.jsx(en,{className:"w-6 h-6"}),a.jsx("span",{className:"text-sm font-medium",children:"Create Workspace"})]})]})]}),(i||l)&&a.jsx(cO,{workspace:i,onClose:()=>{o(null),c(!1)},onSaved:m,sendRpc:e})]})}function hO(e){const[t,n]=g.useState([]),[r,s]=g.useState(!0),i=g.useCallback(async()=>{try{const f=await e("mcp.list");n(f.servers??[])}catch(f){console.error("[useMcpServers] Failed to load:",f)}finally{s(!1)}},[e]),o=g.useCallback(async f=>{const d=await e("mcp.create",f);return await i(),d},[e,i]),l=g.useCallback(async(f,d)=>{await e("mcp.update",{id:f,...d}),await i()},[e,i]),c=g.useCallback(async f=>{await e("mcp.toggle",{id:f}),await i()},[e,i]),u=g.useCallback(async f=>{await e("mcp.delete",{id:f}),await i()},[e,i]);return{servers:t,loading:r,loadServers:i,createServer:o,updateServer:l,toggleServer:c,deleteServer:u}}const pO={stdio:"Stdio",sse:"SSE","streamable-http":"Streamable HTTP"},HS=[{value:"streamable-http",label:"Streamable HTTP"},{value:"sse",label:"SSE"},{value:"stdio",label:"Stdio"}];function Ky(e){const t=e.filter(r=>r.key.trim());if(t.length===0)return;const n={};for(const r of t)n[r.key.trim()]=r.value;return n}function Gy(e){return!e||Object.keys(e).length===0?[{key:"",value:""}]:[...Object.entries(e).map(([t,n])=>({key:t,value:n})),{key:"",value:""}]}function qy({label:e,pairs:t,onChange:n}){const r=(o,l,c)=>{const u=t.map((f,d)=>d===o?{...f,[l]:c}:f);n(u)},s=o=>{const l=t.filter((c,u)=>u!==o);l.length===0&&l.push({key:"",value:""}),n(l)},i=()=>{n([...t,{key:"",value:""}])};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:e}),a.jsxs("button",{type:"button",onClick:i,className:"flex items-center gap-1 px-2 py-0.5 text-xs font-medium text-primary-600 hover:text-primary-700 hover:bg-primary-50 rounded-md transition-colors",children:[a.jsx(en,{className:"w-3.5 h-3.5"}),"Add"]})]}),a.jsx("div",{className:"space-y-2",children:t.map((o,l)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:o.key,onChange:c=>r(l,"key",c.target.value),placeholder:"Key",className:"flex-1 px-2.5 py-1.5 bg-white border border-gray-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"}),a.jsx("input",{type:"text",value:o.value,onChange:c=>r(l,"value",c.target.value),placeholder:"Value",className:"flex-1 px-2.5 py-1.5 bg-white border border-gray-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"}),t.length>1&&a.jsx("button",{type:"button",onClick:()=>s(l),className:"p-1 text-gray-400 hover:text-red-500 transition-colors",children:a.jsx(mn,{className:"w-3.5 h-3.5"})})]},l))})]})}function mO({server:e,isOpen:t,onClose:n,onSave:r,onUpdate:s}){const i=!!e,[o,l]=g.useState("streamable-http"),[c,u]=g.useState(""),[f,d]=g.useState(""),[h,p]=g.useState(""),[x,b]=g.useState(""),[k,v]=g.useState(""),[m,y]=g.useState([{key:"",value:""}]),[j,S]=g.useState([{key:"",value:""}]),[N,w]=g.useState(""),[C,D]=g.useState(!1);g.useEffect(()=>{var z;t&&(w(""),D(!1),e?(l(e.transport),u(e.name),d(e.description??""),p(e.url??""),b(e.command??""),v(((z=e.argsJson)==null?void 0:z.join(" "))??""),y(Gy(e.envJson)),S(Gy(e.headersJson))):(l("streamable-http"),u(""),d(""),p(""),b(""),v(""),y([{key:"",value:""}]),S([{key:"",value:""}])))},[t,e]);const T=()=>c.trim()?o==="stdio"?!!x.trim():!!h.trim():!1,M=async()=>{if(!C){D(!0),w("");try{const z={name:c,transport:o,description:f||void 0};o==="stdio"?(z.command=x,k.trim()&&(z.argsJson=k.split(/\s+/).filter(Boolean)),z.envJson=Ky(m)):(z.url=h,z.headersJson=Ky(j)),i?await s(e.id,z):await r(z),n()}catch(z){w((z==null?void 0:z.message)||"Failed to save")}finally{D(!1)}}},P=i?"Edit MCP Server":"New MCP Server",F=i?e.name:"Register a new MCP server";return a.jsx(Xn,{children:t&&a.jsxs(a.Fragment,{children:[a.jsx(Ot.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:n,className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-40"}),a.jsxs(Ot.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:200},className:"fixed right-0 top-0 bottom-0 w-[480px] bg-white shadow-2xl z-50 flex flex-col border-l border-gray-100",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-white",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-bold text-gray-900",children:P}),a.jsx("p",{className:"text-xs text-gray-400",children:F})]}),a.jsx("button",{onClick:n,className:"p-2 text-gray-400 hover:text-gray-700 hover:bg-gray-50 rounded-lg transition-colors",children:a.jsx(Ge,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Transport ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:HS.map(z=>{const W=o===z.value;return a.jsx("button",{type:"button",disabled:i,onClick:()=>l(z.value),className:B("px-3 py-2 rounded-lg border text-sm font-medium transition-colors text-center",W?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-200 text-gray-600 hover:border-gray-300 hover:bg-gray-50",i&&"opacity-60 cursor-not-allowed"),children:z.label},z.value)})})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:c,onChange:z=>u(z.target.value),placeholder:"e.g. tools-server, filesystem",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Description"}),a.jsx("input",{type:"text",value:f,onChange:z=>d(z.target.value),placeholder:"Optional description",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),o==="stdio"?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Command ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:x,onChange:z=>b(z.target.value),placeholder:"e.g. npx, node, python",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Arguments"}),a.jsx("input",{type:"text",value:k,onChange:z=>v(z.target.value),placeholder:"e.g. -y @modelcontextprotocol/server-filesystem /workspace",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Space-separated arguments"})]}),a.jsx(qy,{label:"Environment Variables",pairs:m,onChange:y})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["URL ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{type:"text",value:h,onChange:z=>p(z.target.value),placeholder:"http://localhost:8000/mcp",className:"w-full px-3 py-2 bg-white border border-gray-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsx(qy,{label:"Headers",pairs:j,onChange:S})]}),N&&a.jsx("p",{className:"text-xs text-red-500",children:N})]}),a.jsxs("div",{className:"p-6 border-t border-gray-100 bg-white flex items-center justify-end gap-3",children:[a.jsx("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 rounded-lg transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:M,disabled:!T()||C,className:"px-4 py-2 text-sm font-medium bg-primary-600 text-white hover:bg-primary-700 rounded-lg shadow-sm flex items-center gap-2 disabled:opacity-50",children:[a.jsx(Qt,{className:"w-4 h-4"}),C?"Saving...":i?"Save Changes":"Create Server"]})]})]})]})})}const gO={"streamable-http":"bg-blue-50 text-blue-700",sse:"bg-purple-50 text-purple-700",stdio:"bg-emerald-50 text-emerald-700"},xO={seed:"bg-gray-50 text-gray-500",db:"bg-indigo-50 text-indigo-600",file:"bg-amber-50 text-amber-600"};function yO(){const{sendRpc:e,isConnected:t}=zt(),{isAdmin:n}=yu(e,t),{servers:r,loading:s,loadServers:i,createServer:o,updateServer:l,toggleServer:c,deleteServer:u}=hO(e),[f,d]=g.useState(""),[h,p]=g.useState(""),[x,b]=g.useState(!1),[k,v]=g.useState(null),[m,y]=g.useState(null),[j,S]=g.useState(null),N=g.useRef(!1);g.useEffect(()=>{t&&!N.current&&(N.current=!0,i())},[t]);const w=g.useMemo(()=>{let P=r;if(h&&(P=P.filter(F=>F.transport===h)),f.trim()){const F=f.toLowerCase();P=P.filter(z=>z.name.toLowerCase().includes(F)||(z.description??"").toLowerCase().includes(F)||(z.url??"").toLowerCase().includes(F)||(z.command??"").toLowerCase().includes(F))}return P},[r,f,h]),C=()=>{v(null),b(!0)},D=P=>{v(P),b(!0)},T=async(P,F)=>{if(P.stopPropagation(),!j){S(F);try{await c(F)}catch(z){console.error("[McpServers] Toggle failed:",z)}finally{S(null)}}},M=async(P,F,z)=>{if(P.stopPropagation(),!m&&window.confirm(`Delete MCP server "${z}"?`)){y(F);try{await u(F)}catch(W){console.error("[McpServers] Delete failed:",W),alert(`Delete failed: ${(W==null?void 0:W.message)||"Unknown error"}`)}finally{y(null)}}};return a.jsxs("div",{className:"h-full bg-white flex flex-col",children:[a.jsxs("header",{className:"h-16 flex items-center justify-between px-6 bg-white sticky top-0 z-10 border-b border-gray-100",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-primary-50 rounded-lg",children:a.jsx(_f,{className:"w-5 h-5 text-primary-600"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-bold text-gray-900",children:"MCP Servers"}),a.jsx("p",{className:"text-xs text-gray-500",children:"Manage Model Context Protocol server connections"})]})]}),n&&a.jsxs("button",{onClick:C,className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-white bg-primary-600 rounded-lg hover:bg-primary-700 transition-colors",children:[a.jsx(en,{className:"w-4 h-4"}),"New Server"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-8",children:a.jsxs("div",{className:"max-w-5xl mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsxs("div",{className:"relative flex-1 max-w-xs",children:[a.jsx(kn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",value:f,onChange:P=>d(P.target.value),placeholder:"Search servers...",className:"w-full pl-9 pr-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500"})]}),a.jsxs("select",{value:h,onChange:P=>p(P.target.value),className:"px-3 py-2 border border-gray-200 rounded-lg text-sm text-gray-700 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 bg-white",children:[a.jsx("option",{value:"",children:"All Transports"}),HS.map(P=>a.jsx("option",{value:P.value,children:P.label},P.value))]})]}),s?a.jsx("div",{className:"flex items-center justify-center py-20",children:a.jsx(Ae,{className:"w-6 h-6 animate-spin text-gray-400"})}):w.length===0?a.jsxs("div",{className:"text-center py-20",children:[a.jsx(_f,{className:"w-12 h-12 text-gray-200 mx-auto mb-4"}),a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-1",children:r.length===0?"No MCP servers yet":"No matching servers"}),a.jsx("p",{className:"text-xs text-gray-500",children:r.length===0?"Register your first MCP server to get started.":"Try adjusting your search or filter."})]}):a.jsx("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50/50",children:[a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Name"}),a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Transport"}),a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Endpoint"}),a.jsx("th",{className:"text-center px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Status"}),a.jsx("th",{className:"text-left px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Source"}),n&&a.jsx("th",{className:"text-center px-6 py-3 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),a.jsx("tbody",{children:w.map(P=>a.jsxs("tr",{onClick:n?()=>D(P):void 0,className:B("border-b border-gray-50 last:border-0 hover:bg-gray-50/50 transition-colors",n&&"cursor-pointer"),children:[a.jsx("td",{className:"px-6 py-4",children:a.jsxs("div",{children:[a.jsx("span",{className:"text-sm font-medium text-gray-900",children:P.name}),P.description&&a.jsx("p",{className:"text-xs text-gray-400 mt-0.5 truncate max-w-[200px]",children:P.description})]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:B("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",gO[P.transport]??"bg-gray-50 text-gray-600"),children:pO[P.transport]??P.transport})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:"text-xs text-gray-500 font-mono truncate block max-w-[240px]",children:P.url||P.command||"-"})}),a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("span",{className:B("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium",P.enabled?"bg-green-50 text-green-700":"bg-gray-100 text-gray-500"),children:[a.jsx("span",{className:B("w-1.5 h-1.5 rounded-full",P.enabled?"bg-green-500":"bg-gray-400")}),P.enabled?"Enabled":"Disabled"]})}),a.jsx("td",{className:"px-6 py-4",children:a.jsx("span",{className:B("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",xO[P.source??"db"]??"bg-gray-50 text-gray-500"),children:P.source??"db"})}),n&&a.jsx("td",{className:"px-6 py-4 text-center",children:a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx("button",{onClick:F=>T(F,P.id),disabled:j===P.id,className:B("p-1.5 rounded-lg transition-colors",P.enabled?"text-green-600 hover:text-orange-600 hover:bg-orange-50":"text-gray-400 hover:text-green-600 hover:bg-green-50","disabled:opacity-50"),title:P.enabled?"Disable":"Enable",children:j===P.id?a.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(P5,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:F=>{F.stopPropagation(),D(P)},className:"p-1.5 text-gray-400 hover:text-primary-600 hover:bg-primary-50 rounded-lg transition-colors",title:"Edit",children:a.jsx(zo,{className:"w-3.5 h-3.5"})}),a.jsx("button",{onClick:F=>M(F,P.id,P.name),disabled:m===P.id,className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors disabled:opacity-50",title:"Delete",children:m===P.id?a.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin"}):a.jsx(mn,{className:"w-3.5 h-3.5"})})]})})]},P.id))})]})})]})}),n&&a.jsx(mO,{server:k,isOpen:x,onClose:()=>b(!1),onSave:async P=>{await o(P)},onUpdate:async(P,F)=>{await l(P,F)}})]})}function vO({title:e}){return a.jsx("div",{className:"flex-1 flex items-center justify-center text-gray-400",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-medium text-gray-500 mb-1",children:e}),a.jsx("div",{className:"text-sm",children:"Coming soon"})]})})}const bO=HC([{path:"/login",element:a.jsx(zE,{})},{path:"/login/sso-callback",element:a.jsx(VE,{})},{element:a.jsx(OE,{}),children:[{path:"/",element:a.jsx(FE,{}),children:[{index:!0,element:a.jsx(Df,{to:"/pilot",replace:!0})},{path:"pilot",element:a.jsx(aF,{})},{path:"skills",children:[{index:!0,element:a.jsx(lF,{})},{path:":id",element:a.jsx(TF,{})}]},{path:"channels",element:a.jsx(MF,{})},{path:"triggers",element:a.jsx(FF,{})},{path:"cron",element:a.jsx(VF,{})},{path:"permissions",element:a.jsx(GF,{})},{path:"settings",element:a.jsx(WF,{}),children:[{index:!0,element:a.jsx(UF,{})},{path:"system",element:a.jsx(KF,{})}]},{path:"credentials",element:a.jsx(oO,{})},{path:"sessions",element:a.jsx(vO,{title:"Sessions"})},{path:"workspace",element:a.jsx(fO,{})},{path:"mcp",element:a.jsx(yO,{})},{path:"brains",element:a.jsx(tO,{})},{path:"models",element:a.jsx(ZF,{})}]}]},{path:"*",element:a.jsx(Df,{to:"/login",replace:!0})}]);function wO(){return a.jsx(JC,{router:bO})}Id.createRoot(document.getElementById("root")).render(a.jsx(wO,{}));