okengine 0.14.1 → 0.15.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 (205) hide show
  1. package/package.json +3 -4
  2. package/site/content/docs/elements/ai.mdx +2 -1
  3. package/site/content/docs/elements/channel.mdx +1 -0
  4. package/site/content/docs/elements/clock.mdx +3 -0
  5. package/site/content/docs/elements/flow.mdx +3 -0
  6. package/site/content/docs/elements/gate.mdx +25 -22
  7. package/site/content/docs/elements/signal.mdx +4 -4
  8. package/site/content/docs/elements/store.mdx +86 -27
  9. package/site/content/docs/elements/vault.mdx +1 -0
  10. package/site/content/docs/get-started/basic-usage.mdx +22 -13
  11. package/site/content/docs/get-started/index.mdx +5 -0
  12. package/site/content/docs/get-started/introduction.mdx +11 -3
  13. package/site/content/docs/get-started/meta.json +1 -1
  14. package/site/content/docs/get-started/project-structure.mdx +932 -0
  15. package/site/content/docs/reference/cli.md +13 -10
  16. package/site/content/docs/reference/client.mdx +25 -21
  17. package/site/content/docs/reference/security.md +1 -1
  18. package/src/auth/bindings.ts +14 -5
  19. package/src/auth/cross-plane.ts +10 -3
  20. package/src/cli/ai-setup/ai-setup.test.ts +62 -0
  21. package/src/cli/ai-setup/apply.ts +32 -1
  22. package/src/cli/attach-host-console.test.ts +3 -2
  23. package/src/cli/attach-host-console.ts +3 -0
  24. package/src/cli/build.test.ts +4 -2
  25. package/src/cli/db-seed.ts +48 -15
  26. package/src/cli/db.test.ts +104 -0
  27. package/src/cli/db.ts +122 -10
  28. package/src/cli/dev-controls.test.ts +20 -0
  29. package/src/cli/dev-controls.ts +13 -0
  30. package/src/cli/dev.test.ts +15 -4
  31. package/src/cli/dev.ts +102 -29
  32. package/src/cli/ensure-drizzle-config.ts +2 -1
  33. package/src/cli/tui/DevLive.tsx +12 -2
  34. package/src/cli/tui/keys.test.ts +2 -1
  35. package/src/cli/tui/keys.ts +3 -2
  36. package/src/compiler/aot.test.ts +1 -1
  37. package/src/compiler/extract.test.ts +409 -33
  38. package/src/compiler/extract.ts +318 -67
  39. package/src/compiler/flow-path.test.ts +96 -0
  40. package/src/compiler/flow-path.ts +173 -0
  41. package/src/compiler/generate-adopt.test.ts +112 -3
  42. package/src/compiler/generate-adopt.ts +280 -26
  43. package/src/compiler/schema-from-ast.ts +609 -0
  44. package/src/console/server/bind.ts +2 -2
  45. package/src/console/server/console.test.ts +3 -0
  46. package/src/console/server/flows.ts +120 -40
  47. package/src/console/server/invoke-user-flow.test.ts +3 -1
  48. package/src/console/server/invoke-user-flow.ts +17 -2
  49. package/src/console/server/iso-at.test.ts +9 -0
  50. package/src/console/server/iso-at.ts +11 -0
  51. package/src/console/server/security-headers.ts +6 -3
  52. package/src/console/server/spa-proxy.test.ts +1 -0
  53. package/src/console/server/sql-catalog.ts +147 -7
  54. package/src/console/server/sql-rls.test.ts +16 -0
  55. package/src/console/server/state.ts +8 -0
  56. package/src/console/server/store.test.ts +7 -4
  57. package/src/console/server/store.ts +142 -58
  58. package/src/console/ui-next/dist/assets/agent-disclosure-C0X1fbWF.js +1 -0
  59. package/src/console/ui-next/dist/assets/{cache-glyph-BanhLsEY.js → cache-glyph-F1FI122b.js} +1 -1
  60. package/src/console/ui-next/dist/assets/{call-pii-button-bqkxMrJH.js → call-pii-button-DEDCl_j3.js} +1 -1
  61. package/src/console/ui-next/dist/assets/collapsible-LPqGvfoz.js +1 -0
  62. package/src/console/ui-next/dist/assets/{confirm-sheet-DDCRmG62.js → confirm-sheet-3ptDzXbz.js} +1 -1
  63. package/src/console/ui-next/dist/assets/{duration-tone-oiRxPVsZ.js → duration-tone-sC3lGABz.js} +1 -1
  64. package/src/console/ui-next/dist/assets/{explorer-empty-HjTnVQoR.js → explorer-empty-BvYrygyO.js} +1 -1
  65. package/src/console/ui-next/dist/assets/flows-page-Dluo1Bd7.js +1 -0
  66. package/src/console/ui-next/dist/assets/{highlighted-json-CvDPvveV.js → highlighted-json-CS_O8L-r.js} +1 -1
  67. package/src/console/ui-next/dist/assets/http-method--sWDdXSB.js +1 -0
  68. package/src/console/ui-next/dist/assets/index-Ca3HZMVq.js +66 -0
  69. package/src/console/ui-next/dist/assets/index-UtTDRQpS.css +2 -0
  70. package/src/console/ui-next/dist/assets/{link-DF7SZ9Ek.js → link-COeyggt-.js} +1 -1
  71. package/src/console/ui-next/dist/assets/{observability-page-BEZDzyYh.js → observability-page-HK9-BO8z.js} +2 -2
  72. package/src/console/ui-next/dist/assets/react-D8E3mtu1.js +1 -0
  73. package/src/console/ui-next/dist/assets/replica-lag-DBIFFf7d.js +18 -0
  74. package/src/console/ui-next/dist/assets/sheet-form-Dnwa5oOR.js +1 -0
  75. package/src/console/ui-next/dist/assets/shortcut-keys-CoqwEIi0.js +1 -0
  76. package/src/console/ui-next/dist/assets/skeleton-BHcfDYcb.js +1 -0
  77. package/src/console/ui-next/dist/assets/store-page-BSohH3wM.js +41 -0
  78. package/src/console/ui-next/dist/assets/trace-detail-sheet-CFIGRnnA.js +2 -0
  79. package/src/console/ui-next/dist/assets/tree-expand-toggle-BgLl34w7.js +54 -0
  80. package/src/console/ui-next/dist/assets/units-page-B0cFE76A.js +1 -0
  81. package/src/console/ui-next/dist/assets/{use-vault-list-Cl79j_ku.js → use-vault-list-BLbZhzyF.js} +1 -1
  82. package/src/console/ui-next/dist/assets/vault-page-B1SbYe10.js +2 -0
  83. package/src/console/ui-next/dist/index.html +6 -6
  84. package/src/console/ui-next/src/client.ts +35 -7
  85. package/src/console/ui-next/src/components/motion/table/index.tsx +16 -0
  86. package/src/console/ui-next/src/components/motion/table/types.ts +4 -0
  87. package/src/console/ui-next/src/components/ui/kbd.tsx +2 -2
  88. package/src/console/ui-next/src/features/flows/traces/http-method.ts +19 -0
  89. package/src/console/ui-next/src/features/flows/traces/trace-detail.test.ts +19 -1
  90. package/src/console/ui-next/src/features/flows/traces/traces-pane.tsx +10 -3
  91. package/src/console/ui-next/src/features/store/detail/browse-section.tsx +45 -1
  92. package/src/console/ui-next/src/features/store/detail/resource-panel.tsx +78 -16
  93. package/src/console/ui-next/src/features/store/detail/store-row-detail-sheet.tsx +155 -14
  94. package/src/console/ui-next/src/features/store/explorer/store-tree.tsx +33 -133
  95. package/src/console/ui-next/src/features/store/files/file-preview.tsx +4 -1
  96. package/src/console/ui-next/src/features/store/grid/rls-policy-sheet.tsx +326 -165
  97. package/src/console/ui-next/src/features/store/grid/sql-insert-sheet.tsx +6 -0
  98. package/src/console/ui-next/src/features/store/grid/store-data-grid.tsx +50 -3
  99. package/src/console/ui-next/src/features/store/lib/files-meta.test.ts +3 -0
  100. package/src/console/ui-next/src/features/store/lib/files-meta.ts +12 -0
  101. package/src/console/ui-next/src/features/store/lib/query-defaults.test.ts +25 -0
  102. package/src/console/ui-next/src/features/store/lib/query-defaults.ts +85 -3
  103. package/src/console/ui-next/src/features/store/lib/query-gate.ts +30 -4
  104. package/src/console/ui-next/src/features/store/lib/rls-policy.test.ts +139 -0
  105. package/src/console/ui-next/src/features/store/lib/rls-policy.ts +223 -21
  106. package/src/console/ui-next/src/features/store/lib/schema-graph.ts +4 -0
  107. package/src/console/ui-next/src/features/store/lib/sql-catalog.test.ts +24 -0
  108. package/src/console/ui-next/src/features/store/lib/sql-catalog.ts +19 -0
  109. package/src/console/ui-next/src/features/store/lib/store-tree.test.ts +6 -0
  110. package/src/console/ui-next/src/features/store/lib/store-tree.ts +13 -0
  111. package/src/console/ui-next/src/features/store/query/query-console.tsx +48 -14
  112. package/src/console/ui-next/src/features/store/query/query-gate-menu.tsx +19 -20
  113. package/src/console/ui-next/src/features/store/query/query-gate-parts.tsx +2 -1
  114. package/src/console/ui-next/src/features/store/query/query-results.tsx +110 -83
  115. package/src/console/ui-next/src/features/store/schema/schema-table-node.tsx +17 -0
  116. package/src/console/ui-next/src/features/units/call/call-api-panel.tsx +112 -72
  117. package/src/console/ui-next/src/features/units/lib/contract-input.test.ts +206 -1
  118. package/src/console/ui-next/src/features/units/lib/contract-input.ts +55 -0
  119. package/src/console/ui-next/src/features/vault/lib/types.ts +1 -1
  120. package/src/docker/compose-health.test.ts +27 -0
  121. package/src/docker/compose-health.ts +19 -3
  122. package/src/docker/docker.test.ts +3 -0
  123. package/src/docker/recipes/pgdog.ts +2 -0
  124. package/src/drivers/clock-postgres.ts +13 -9
  125. package/src/drivers/instances-postgres.ts +4 -6
  126. package/src/drivers/journal-postgres.ts +13 -9
  127. package/src/drivers/pg-rls.test.ts +87 -0
  128. package/src/drivers/pg-rls.ts +233 -7
  129. package/src/drivers/pglite.ts +26 -3
  130. package/src/drivers/postgres.test.ts +23 -0
  131. package/src/drivers/postgres.ts +133 -9
  132. package/src/drivers/types.ts +10 -0
  133. package/src/elements/clock/declare.ts +26 -1
  134. package/src/elements/gate/boot.ts +5 -5
  135. package/src/elements/gate/declare.ts +36 -4
  136. package/src/elements/gate/flatten.ts +1 -1
  137. package/src/elements/gate/runtime.ts +1 -1
  138. package/src/elements/store/declare.ts +9 -6
  139. package/src/elements/store/emit-drizzle.ts +44 -8
  140. package/src/elements/store/resource.test.ts +1 -1
  141. package/src/elements/store/rls-identity.test.ts +95 -0
  142. package/src/elements/store/rls-identity.ts +116 -0
  143. package/src/elements/store/runtime.ts +4 -0
  144. package/src/elements/store/schema-decl.test.ts +37 -0
  145. package/src/elements/store/schema-decl.ts +161 -0
  146. package/src/elements/store/seed.ts +1 -1
  147. package/src/elements/store/sql-condition.test.ts +12 -0
  148. package/src/elements/store/sql-condition.ts +26 -2
  149. package/src/elements/store/sql-rls-isolation.test.ts +165 -0
  150. package/src/elements/store/sql-rls-stamp.test.ts +117 -0
  151. package/src/elements/store/sql-session.ts +81 -3
  152. package/src/elements/store/upsert-app.test.ts +1 -1
  153. package/src/elements/store.ts +14 -0
  154. package/src/http.ts +20 -3
  155. package/src/index.ts +10 -1
  156. package/src/kernel/adopt-barrel-fresh.test.ts +1 -1
  157. package/src/kernel/adopt-routes.ts +30 -2
  158. package/src/kernel/app.ts +131 -14
  159. package/src/kernel/auto-cache.test.ts +8 -8
  160. package/src/kernel/auto-registry.test.ts +49 -9
  161. package/src/kernel/boot.test.ts +4 -4
  162. package/src/kernel/boot.ts +2 -2
  163. package/src/kernel/effects-stamping.test.ts +3 -3
  164. package/src/kernel/element-registries.ts +12 -5
  165. package/src/kernel/errors.ts +24 -0
  166. package/src/kernel/flow-units.ts +64 -0
  167. package/src/kernel/flow.ts +29 -17
  168. package/src/kernel/fx.ts +23 -0
  169. package/src/kernel/horizontal-child.ts +4 -4
  170. package/src/kernel/http-path-pending.ts +20 -0
  171. package/src/kernel/http-resource.ts +4 -0
  172. package/src/kernel/http-stream.test.ts +4 -4
  173. package/src/kernel/pipeline.test.ts +2 -2
  174. package/src/kernel/plugin-elements.test.ts +1 -1
  175. package/src/kernel/plugin-needs.test.ts +1 -1
  176. package/src/kernel/ready.test.ts +2 -2
  177. package/src/kernel/resource-mount.test.ts +14 -0
  178. package/src/kernel/run-duration.test.ts +2 -2
  179. package/src/kernel/stamp-http.test.ts +79 -0
  180. package/src/kernel/stamp-http.ts +75 -0
  181. package/src/kernel/triggers.ts +52 -27
  182. package/src/manifest/types.ts +13 -0
  183. package/src/release/measure.ts +2 -2
  184. package/src/runtime/json-code-block.test.ts +2 -2
  185. package/src/runtime/serve.test.ts +4 -4
  186. package/src/term.test.ts +52 -4
  187. package/src/term.ts +125 -17
  188. package/src/test/reset-element-registries.ts +8 -3
  189. package/src/cli/ask-seed.test.ts +0 -96
  190. package/src/cli/ask-seed.ts +0 -82
  191. package/src/console/ui-next/dist/assets/collapsible-DYb0xU8C.js +0 -1
  192. package/src/console/ui-next/dist/assets/flows-page-DxDsOd4f.js +0 -1
  193. package/src/console/ui-next/dist/assets/http-method-CJCBYL2j.js +0 -1
  194. package/src/console/ui-next/dist/assets/index-Ce6WKWKM.js +0 -66
  195. package/src/console/ui-next/dist/assets/index-D4Ldtj79.css +0 -2
  196. package/src/console/ui-next/dist/assets/query-gate-parts-1m8m1iNp.js +0 -2
  197. package/src/console/ui-next/dist/assets/react-B1ML8gxg.js +0 -1
  198. package/src/console/ui-next/dist/assets/replica-lag-C8_BRt2x.js +0 -18
  199. package/src/console/ui-next/dist/assets/sheet-form-D-ata7jy.js +0 -1
  200. package/src/console/ui-next/dist/assets/shortcut-keys-DO4IsVqv.js +0 -1
  201. package/src/console/ui-next/dist/assets/skeleton-CL_X0GCj.js +0 -1
  202. package/src/console/ui-next/dist/assets/store-page-v3LXdYpr.js +0 -45
  203. package/src/console/ui-next/dist/assets/trace-detail-sheet-DFLFfUUX.js +0 -2
  204. package/src/console/ui-next/dist/assets/units-page-C0gW6Kdo.js +0 -1
  205. package/src/console/ui-next/dist/assets/vault-page-DuKzqwzW.js +0 -2
@@ -1 +1 @@
1
- import{Cr as e,F as t,L as n,P as r,wr as i}from"./shortcut-keys-DO4IsVqv.js";import{A as a,f as o}from"./xyflow-D7n4g6go.js";import{t as s}from"./dagre.esm-ZwcdTuZZ.js";import{D as c,E as l,T as u,b as d,o as f,w as p,y as m}from"./http-method-CJCBYL2j.js";function h(e){let t=e.indexOf(`.`);return t===-1?e:e.slice(0,t)}function g(e){let t=e.indexOf(`.`);return t===-1?e:e.slice(t+1)}function _(e){let t=e?.flows??{},n=new Map;for(let e of Object.keys(t)){let r=t[e]?.effects?.calls??[];for(let t of r){let r=n.get(t)??[];r.push(e),n.set(t,r)}}for(let[e,t]of n)t.sort((e,t)=>e.localeCompare(t)),n.set(e,t);return n}function v(e,t){return _(e).get(t)??[]}function y(e){return e.startsWith(`sql:`)?{id:e,kind:`store`,label:e.slice(4),facet:`sql`}:e.startsWith(`kv:`)?{id:e,kind:`store`,label:e.slice(3),facet:`kv`}:e.startsWith(`files:`)?{id:e,kind:`store`,label:e.slice(6),facet:`files`}:e.startsWith(`index:`)?{id:e,kind:`store`,label:e.slice(6),facet:`index`}:e.startsWith(`signal:`)?{id:e,kind:`signal`,label:e.slice(7)}:e.startsWith(`ai:`)?{id:e,kind:`ai`,label:e.slice(3)}:e.startsWith(`vault:`)?{id:e,kind:`vault`,label:e.slice(6)}:e.startsWith(`channel:`)?{id:e,kind:`channel`,label:e.slice(8)}:e.startsWith(`gate:`)?{id:e,kind:`gate`,label:e.slice(5)}:e.startsWith(`clock:`)?{id:e,kind:`clock`,label:e.slice(6)}:null}function b(e,t,n,r,i=!1){let a=m[r];return{id:e,source:t,target:n,type:`smoothstep`,animated:i,data:{kind:r},style:{stroke:a,strokeWidth:r===`calls`?2.5:2.25},pathOptions:{borderRadius:28},zIndex:d.edge,markerEnd:{type:o.ArrowClosed,width:14,height:14,color:a}}}function x(e){let t=e?.flows??{},n=new Set(Object.keys(t)),r=[],i=new Map;for(let e of[...n].sort()){let t=h(e),n=i.get(t)??[];n.push(e),i.set(t,n)}let a=new Map,o=new Map;for(let e of n){let n=t[e];if(!n)continue;if(n.trigger?.signal){let t=`signal:${n.trigger.signal}`,i=y(t);i&&a.set(t,i),r.push(b(`e:${t}->flow:${e}`,t,`flow:${e}`,`trigger`))}if(n.trigger?.cron||n.trigger?.every){let t=`clock:${e}`,i=n.trigger.cron??n.trigger.every??e;a.set(t,{id:t,kind:`clock`,label:i,facet:n.trigger.cron?`cron`:`every`}),r.push(b(`e:${t}->flow:${e}`,t,`flow:${e}`,`trigger`))}for(let t of n.gates??[]){let n=`gate:${t}`;a.set(n,{id:n,kind:`gate`,label:t}),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}-gates->${n}`,`flow:${e}`,n,`gates`))}let i=n.effects;if(i){for(let t of i.reads??[]){let n=y(t);n&&(a.set(t,n),o.set(t,(o.get(t)??0)+1),r.push(b(`e:flow:${e}-reads->${t}`,`flow:${e}`,t,`reads`)))}for(let t of i.writes??[]){let n=y(t);n&&(a.set(t,n),o.set(t,(o.get(t)??0)+1),r.push(b(`e:flow:${e}-writes->${t}`,`flow:${e}`,t,`writes`)))}for(let t of i.emits??[]){let n=`signal:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`emits`)))}for(let t of i.asks??[]){let n=`ai:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`asks`)))}for(let t of i.sends??[]){let n=`channel:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`sends`)))}for(let t of i.secrets??[]){let n=`vault:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`secrets`)))}for(let t of i.calls??[]){let n=c(t);if(n){let t=l(n.server);a.set(t,{id:t,kind:`ai`,label:n.server}),o.set(t,(o.get(t)??0)+1),r.push(b(`e:flow:${e}->${t}`,`flow:${e}`,t,`calls`,!0));continue}r.push(b(`e:flow:${e}->flow:${t}`,`flow:${e}`,`flow:${t}`,`calls`,!0))}}}return{nodes:S(i,t,a,o),edges:r,flowIds:n}}function S(e,t,n,r){let i=new s.graphlib.Graph({compound:!0});i.setGraph({rankdir:`LR`,align:`UL`,nodesep:16,ranksep:88,edgesep:12,marginx:8,marginy:8}),i.setDefaultEdgeLabel(()=>({}));for(let[t,n]of[...e.entries()].sort()){i.setNode(`unit:${t}`,{});for(let e of n)i.setNode(`flow:${e}`,{...p.flow}),i.setParent(`flow:${e}`,`unit:${t}`)}for(let e of n.values())i.setNode(e.id,{...p[e.kind]});let a=new Set;for(let n of e.values())for(let e of n){let n=t[e];if(!n)continue;let r=(e,t)=>{let n=`${e}->${t}`;a.has(n)||!i.hasNode(e)||!i.hasNode(t)||(a.add(n),i.setEdge(e,t))};n.trigger?.signal&&r(`signal:${n.trigger.signal}`,`flow:${e}`),(n.trigger?.cron||n.trigger?.every)&&r(`clock:${e}`,`flow:${e}`);for(let t of n.gates??[])r(`flow:${e}`,`gate:${t}`);let o=n.effects;if(o){for(let t of o.reads??[])r(`flow:${e}`,t);for(let t of o.writes??[])r(`flow:${e}`,t);for(let t of o.emits??[])r(`flow:${e}`,`signal:${t}`);for(let t of o.asks??[])r(`flow:${e}`,`ai:${t}`);for(let t of o.sends??[])r(`flow:${e}`,`channel:${t}`);for(let t of o.secrets??[])r(`flow:${e}`,`vault:${t}`);for(let t of o.calls??[]){let n=c(t);n?r(`flow:${e}`,l(n.server)):r(`flow:${e}`,`flow:${t}`)}}}s.layout(i);let o=[],{headerH:f,padX:m,padBottom:h}=u;for(let[n,r]of[...e.entries()].sort()){let e=`unit:${n}`,a=i.node(e);if(!a)continue;let s=a.x??0,c=a.y??0,l=r.length*p.flow.height+Math.max(0,r.length-1)*10,u=p.flow.width+m*2,_=f+l+h,v=s-u/2,y=c-_/2;o.push({id:e,type:`unit`,position:{x:v,y},data:{kind:`unit`,label:n,refId:e,badge:String(r.length)},selectable:!1,draggable:!1,zIndex:d.unit,width:u,height:_,style:{width:u,height:_}}),r.forEach((r,i)=>{let a=t[r];a&&o.push({id:`flow:${r}`,type:`flow`,position:{x:m,y:f+i*(p.flow.height+10)},parentId:e,extent:`parent`,zIndex:d.leaf,data:{kind:`flow`,label:g(r),refId:r,unit:n,plane:a.plane??`user`,badge:a.plane??`user`},draggable:!1,width:p.flow.width,height:p.flow.height,style:{width:p.flow.width,height:p.flow.height}})})}let _=[...n.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.label.localeCompare(t.label));for(let e of _){let t=i.node(e.id),n=p[e.kind],a=r.get(e.id)??0;o.push({id:e.id,type:e.kind,position:{x:(t?.x??0)-n.width/2,y:(t?.y??0)-n.height/2},data:{kind:e.kind,label:e.label,refId:e.id,...e.facet===void 0?{}:{facet:e.facet},badge:e.facet??(a>0?String(a):e.kind)},draggable:!1,zIndex:d.leaf,width:n.width,height:n.height,style:{width:n.width,height:n.height}})}return o}function C(e,t,n,r={}){let i=t.size>0||n.size>0;return e.map(e=>{if(e.data.kind===`unit`||e.data.kind===`law`)return e;let a=e.data.kind===`flow`?t.has(e.data.refId):n.has(e.id);return{...e,data:{...e.data,highlighted:a,dimmed:i&&!a,active:r.activeNodeId!=null&&e.id===r.activeNodeId,focused:r.focusedNodeId!=null&&e.id===r.focusedNodeId}}})}function w(e,t){let n=new Map(t.map(e=>[e.id,e]));return t.some(e=>e.data.highlighted===!0)?e.map(e=>{let t=n.get(e.source),r=n.get(e.target),i=t?.data.highlighted===!0&&r?.data.highlighted===!0,a=m[e.data?.kind??`reads`];return{...e,animated:i?!0:e.animated,style:{...e.style,stroke:a,opacity:i?1:.32,strokeWidth:i?2.75:1.75},markerEnd:e.markerEnd&&typeof e.markerEnd==`object`?{...e.markerEnd,color:a}:e.markerEnd}}):e.map(e=>({...e,style:{...e.style,opacity:1}}))}var T=100;function E(e,t){return e.filter(e=>t.has(e.flow)).sort((e,t)=>t.startedAt-e.startedAt).slice(0,T)}var D=a();function O({cache:a,dataSlot:o}){let s=f(a);return(0,D.jsxs)(r,{children:[(0,D.jsx)(n,{render:t=>(0,D.jsx)(`span`,{...t,className:e(`flex w-4 shrink-0 items-center justify-center`,s.className),"data-slot":o,"data-cache":a,"aria-label":s.label,children:(0,D.jsx)(i,{icon:s.icon,className:`size-3`,"aria-hidden":!0})})}),(0,D.jsx)(t,{side:`top`,children:s.label})]})}export{w as a,h as c,C as i,E as n,x as o,g as r,v as s,O as t};
1
+ import{F as e,I as t,R as n,Tr as r,wr as i}from"./shortcut-keys-CoqwEIi0.js";import{A as a,f as o}from"./xyflow-D7n4g6go.js";import{t as s}from"./dagre.esm-ZwcdTuZZ.js";import{D as c,E as l,O as u,T as d,b as f,s as p,x as m}from"./http-method--sWDdXSB.js";function h(e){let t=e.indexOf(`.`);return t===-1?e:e.slice(0,t)}function g(e){let t=e.indexOf(`.`);return t===-1?e:e.slice(t+1)}function _(e){let t=e?.flows??{},n=new Map;for(let e of Object.keys(t)){let r=t[e]?.effects?.calls??[];for(let t of r){let r=n.get(t)??[];r.push(e),n.set(t,r)}}for(let[e,t]of n)t.sort((e,t)=>e.localeCompare(t)),n.set(e,t);return n}function v(e,t){return _(e).get(t)??[]}function y(e){return e.startsWith(`sql:`)?{id:e,kind:`store`,label:e.slice(4),facet:`sql`}:e.startsWith(`kv:`)?{id:e,kind:`store`,label:e.slice(3),facet:`kv`}:e.startsWith(`files:`)?{id:e,kind:`store`,label:e.slice(6),facet:`files`}:e.startsWith(`index:`)?{id:e,kind:`store`,label:e.slice(6),facet:`index`}:e.startsWith(`signal:`)?{id:e,kind:`signal`,label:e.slice(7)}:e.startsWith(`ai:`)?{id:e,kind:`ai`,label:e.slice(3)}:e.startsWith(`vault:`)?{id:e,kind:`vault`,label:e.slice(6)}:e.startsWith(`channel:`)?{id:e,kind:`channel`,label:e.slice(8)}:e.startsWith(`gate:`)?{id:e,kind:`gate`,label:e.slice(5)}:e.startsWith(`clock:`)?{id:e,kind:`clock`,label:e.slice(6)}:null}function b(e,t,n,r,i=!1){let a=f[r];return{id:e,source:t,target:n,type:`smoothstep`,animated:i,data:{kind:r},style:{stroke:a,strokeWidth:r===`calls`?2.5:2.25},pathOptions:{borderRadius:28},zIndex:m.edge,markerEnd:{type:o.ArrowClosed,width:14,height:14,color:a}}}function x(e){let t=e?.flows??{},n=new Set(Object.keys(t)),r=[],i=new Map;for(let e of[...n].sort()){let t=h(e),n=i.get(t)??[];n.push(e),i.set(t,n)}let a=new Map,o=new Map;for(let e of n){let n=t[e];if(!n)continue;if(n.trigger?.signal){let t=`signal:${n.trigger.signal}`,i=y(t);i&&a.set(t,i),r.push(b(`e:${t}->flow:${e}`,t,`flow:${e}`,`trigger`))}if(n.trigger?.cron||n.trigger?.every){let t=`clock:${e}`,i=n.trigger.cron??n.trigger.every??e;a.set(t,{id:t,kind:`clock`,label:i,facet:n.trigger.cron?`cron`:`every`}),r.push(b(`e:${t}->flow:${e}`,t,`flow:${e}`,`trigger`))}for(let t of n.gates??[]){let n=`gate:${t}`;a.set(n,{id:n,kind:`gate`,label:t}),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}-gates->${n}`,`flow:${e}`,n,`gates`))}let i=n.effects;if(i){for(let t of i.reads??[]){let n=y(t);n&&(a.set(t,n),o.set(t,(o.get(t)??0)+1),r.push(b(`e:flow:${e}-reads->${t}`,`flow:${e}`,t,`reads`)))}for(let t of i.writes??[]){let n=y(t);n&&(a.set(t,n),o.set(t,(o.get(t)??0)+1),r.push(b(`e:flow:${e}-writes->${t}`,`flow:${e}`,t,`writes`)))}for(let t of i.emits??[]){let n=`signal:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`emits`)))}for(let t of i.asks??[]){let n=`ai:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`asks`)))}for(let t of i.sends??[]){let n=`channel:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`sends`)))}for(let t of i.secrets??[]){let n=`vault:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`secrets`)))}for(let t of i.calls??[]){let n=u(t);if(n){let t=c(n.server);a.set(t,{id:t,kind:`ai`,label:n.server}),o.set(t,(o.get(t)??0)+1),r.push(b(`e:flow:${e}->${t}`,`flow:${e}`,t,`calls`,!0));continue}r.push(b(`e:flow:${e}->flow:${t}`,`flow:${e}`,`flow:${t}`,`calls`,!0))}}}return{nodes:S(i,t,a,o),edges:r,flowIds:n}}function S(e,t,n,r){let i=new s.graphlib.Graph({compound:!0});i.setGraph({rankdir:`LR`,align:`UL`,nodesep:16,ranksep:88,edgesep:12,marginx:8,marginy:8}),i.setDefaultEdgeLabel(()=>({}));for(let[t,n]of[...e.entries()].sort()){i.setNode(`unit:${t}`,{});for(let e of n)i.setNode(`flow:${e}`,{...d.flow}),i.setParent(`flow:${e}`,`unit:${t}`)}for(let e of n.values())i.setNode(e.id,{...d[e.kind]});let a=new Set;for(let n of e.values())for(let e of n){let n=t[e];if(!n)continue;let r=(e,t)=>{let n=`${e}->${t}`;a.has(n)||!i.hasNode(e)||!i.hasNode(t)||(a.add(n),i.setEdge(e,t))};n.trigger?.signal&&r(`signal:${n.trigger.signal}`,`flow:${e}`),(n.trigger?.cron||n.trigger?.every)&&r(`clock:${e}`,`flow:${e}`);for(let t of n.gates??[])r(`flow:${e}`,`gate:${t}`);let o=n.effects;if(o){for(let t of o.reads??[])r(`flow:${e}`,t);for(let t of o.writes??[])r(`flow:${e}`,t);for(let t of o.emits??[])r(`flow:${e}`,`signal:${t}`);for(let t of o.asks??[])r(`flow:${e}`,`ai:${t}`);for(let t of o.sends??[])r(`flow:${e}`,`channel:${t}`);for(let t of o.secrets??[])r(`flow:${e}`,`vault:${t}`);for(let t of o.calls??[]){let n=u(t);n?r(`flow:${e}`,c(n.server)):r(`flow:${e}`,`flow:${t}`)}}}s.layout(i);let o=[],{headerH:f,padX:p,padBottom:h}=l;for(let[n,r]of[...e.entries()].sort()){let e=`unit:${n}`,a=i.node(e);if(!a)continue;let s=a.x??0,c=a.y??0,l=r.length*d.flow.height+Math.max(0,r.length-1)*10,u=d.flow.width+p*2,_=f+l+h,v=s-u/2,y=c-_/2;o.push({id:e,type:`unit`,position:{x:v,y},data:{kind:`unit`,label:n,refId:e,badge:String(r.length)},selectable:!1,draggable:!1,zIndex:m.unit,width:u,height:_,style:{width:u,height:_}}),r.forEach((r,i)=>{let a=t[r];a&&o.push({id:`flow:${r}`,type:`flow`,position:{x:p,y:f+i*(d.flow.height+10)},parentId:e,extent:`parent`,zIndex:m.leaf,data:{kind:`flow`,label:g(r),refId:r,unit:n,plane:a.plane??`user`,badge:a.plane??`user`},draggable:!1,width:d.flow.width,height:d.flow.height,style:{width:d.flow.width,height:d.flow.height}})})}let _=[...n.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.label.localeCompare(t.label));for(let e of _){let t=i.node(e.id),n=d[e.kind],a=r.get(e.id)??0;o.push({id:e.id,type:e.kind,position:{x:(t?.x??0)-n.width/2,y:(t?.y??0)-n.height/2},data:{kind:e.kind,label:e.label,refId:e.id,...e.facet===void 0?{}:{facet:e.facet},badge:e.facet??(a>0?String(a):e.kind)},draggable:!1,zIndex:m.leaf,width:n.width,height:n.height,style:{width:n.width,height:n.height}})}return o}function C(e,t,n,r={}){let i=t.size>0||n.size>0;return e.map(e=>{if(e.data.kind===`unit`||e.data.kind===`law`)return e;let a=e.data.kind===`flow`?t.has(e.data.refId):n.has(e.id);return{...e,data:{...e.data,highlighted:a,dimmed:i&&!a,active:r.activeNodeId!=null&&e.id===r.activeNodeId,focused:r.focusedNodeId!=null&&e.id===r.focusedNodeId}}})}function w(e,t){let n=new Map(t.map(e=>[e.id,e]));return t.some(e=>e.data.highlighted===!0)?e.map(e=>{let t=n.get(e.source),r=n.get(e.target),i=t?.data.highlighted===!0&&r?.data.highlighted===!0,a=f[e.data?.kind??`reads`];return{...e,animated:i?!0:e.animated,style:{...e.style,stroke:a,opacity:i?1:.32,strokeWidth:i?2.75:1.75},markerEnd:e.markerEnd&&typeof e.markerEnd==`object`?{...e.markerEnd,color:a}:e.markerEnd}}):e.map(e=>({...e,style:{...e.style,opacity:1}}))}var T=100;function E(e,t){return e.filter(e=>t.has(e.flow)).sort((e,t)=>t.startedAt-e.startedAt).slice(0,T)}var D=a();function O({cache:a,dataSlot:o}){let s=p(a);return(0,D.jsxs)(e,{children:[(0,D.jsx)(n,{render:e=>(0,D.jsx)(`span`,{...e,className:i(`flex w-4 shrink-0 items-center justify-center`,s.className),"data-slot":o,"data-cache":a,"aria-label":s.label,children:(0,D.jsx)(r,{icon:s.icon,className:`size-3`,"aria-hidden":!0})})}),(0,D.jsx)(t,{side:`top`,children:s.label})]})}export{w as a,h as c,C as i,E as n,x as o,g as r,v as s,O as t};
@@ -1 +1 @@
1
- import{Ci as e,Cr as t,Hr as n,S as r,ca as i,ei as a,la as o,wr as s,yi as c}from"./shortcut-keys-DO4IsVqv.js";import{A as l}from"./xyflow-D7n4g6go.js";import{_ as u}from"./collapsible-DYb0xU8C.js";var d=l();function f({kind:r,className:i,hex:o,inferred:l}){return r===`pk`?(0,d.jsx)(s,{icon:c,className:t(`size-3 shrink-0 text-amber-500`,i),"aria-label":`Primary key`}):r===`unique`?(0,d.jsx)(s,{icon:a,className:t(`size-3 shrink-0 text-violet-500`,i),"aria-label":`Unique`}):r===`none`?(0,d.jsx)(s,{icon:n,className:t(`size-3 shrink-0 text-muted-foreground/35`,i),"aria-label":`No key`}):(0,d.jsx)(s,{icon:e,className:t(`size-3 shrink-0`,!o&&`text-sky-500`,i),style:o?{color:o}:void 0,"aria-label":l?`Inferred foreign key`:`Foreign key`})}function p({primaryKey:e,foreignKey:t,unique:n,inferred:r,hex:i,empty:a=`spacer`}){let o=n===!0&&e!==!0;return!e&&!t&&!o?a===`none`?(0,d.jsx)(`span`,{className:`inline-flex shrink-0 items-center`,title:`None`,children:(0,d.jsx)(f,{kind:`none`})}):(0,d.jsx)(`span`,{className:`inline-flex w-3 shrink-0`,"aria-hidden":!0}):(0,d.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-px`,children:[e?(0,d.jsx)(f,{kind:`pk`}):null,t?(0,d.jsx)(f,{kind:`fk`,hex:i,inferred:r}):null,o?(0,d.jsx)(f,{kind:`unique`}):null]})}var m=`[redacted]`;function h(e){let t=[e],n=y(e),r=b(e);return n!==e&&t.push(n),r!==e&&t.push(r),t}function g(e,t){for(let n of h(t))e.add(n)}function _(e){let t=new Set;for(let n of e)g(t,n);return t}function v(e){let t=new Set;for(let n of e)t.add(y(n));return t.size}function y(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/([A-Z])([A-Z][a-z])/g,`$1_$2`).toLowerCase()}function b(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}function x({piiMasked:e,disabled:n,onToggle:a}){return(0,d.jsx)(u,{label:e?`PII hidden. Click to include cleartext (audited).`:`PII included. Click to remask.`,className:`flex self-stretch`,children:(0,d.jsxs)(r,{type:`button`,variant:`ghost`,size:`sm`,disabled:n,className:t(`h-full rounded-none px-2 text-[11px]`,!e&&`text-amber-800 dark:text-amber-300`),"aria-pressed":!e,"aria-label":e?`Include PII: disabled`:`Include PII: enabled`,onClick:a,"data-slot":`call-api-pii`,children:[(0,d.jsx)(s,{icon:e?o:i,"data-icon":`inline-start`,className:`size-3.5`}),`PII`]})})}export{v as a,_ as i,m as n,p as o,g as r,f as s,x as t};
1
+ import{S as e,Tr as t,Ur as n,bi as r,la as i,ti as a,ua as o,wi as s,wr as c}from"./shortcut-keys-CoqwEIi0.js";import{A as l}from"./xyflow-D7n4g6go.js";import{_ as u}from"./collapsible-LPqGvfoz.js";var d=l();function f({kind:e,className:i,hex:o,inferred:l}){return e===`pk`?(0,d.jsx)(t,{icon:r,className:c(`size-3 shrink-0 text-amber-500`,i),"aria-label":`Primary key`}):e===`unique`?(0,d.jsx)(t,{icon:a,className:c(`size-3 shrink-0 text-violet-500`,i),"aria-label":`Unique`}):e===`none`?(0,d.jsx)(t,{icon:n,className:c(`size-3 shrink-0 text-muted-foreground/35`,i),"aria-label":`No key`}):(0,d.jsx)(t,{icon:s,className:c(`size-3 shrink-0`,!o&&`text-sky-500`,i),style:o?{color:o}:void 0,"aria-label":l?`Inferred foreign key`:`Foreign key`})}function p({primaryKey:e,foreignKey:t,unique:n,inferred:r,hex:i,empty:a=`spacer`}){let o=n===!0&&e!==!0;return!e&&!t&&!o?a===`none`?(0,d.jsx)(`span`,{className:`inline-flex shrink-0 items-center`,title:`None`,children:(0,d.jsx)(f,{kind:`none`})}):(0,d.jsx)(`span`,{className:`inline-flex w-3 shrink-0`,"aria-hidden":!0}):(0,d.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-px`,children:[e?(0,d.jsx)(f,{kind:`pk`}):null,t?(0,d.jsx)(f,{kind:`fk`,hex:i,inferred:r}):null,o?(0,d.jsx)(f,{kind:`unique`}):null]})}var m=`[redacted]`;function h(e){let t=[e],n=y(e),r=b(e);return n!==e&&t.push(n),r!==e&&t.push(r),t}function g(e,t){for(let n of h(t))e.add(n)}function _(e){let t=new Set;for(let n of e)g(t,n);return t}function v(e){let t=new Set;for(let n of e)t.add(y(n));return t.size}function y(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/([A-Z])([A-Z][a-z])/g,`$1_$2`).toLowerCase()}function b(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}function x({piiMasked:n,disabled:r,onToggle:a}){return(0,d.jsx)(u,{label:n?`PII hidden. Click to include cleartext (audited).`:`PII included. Click to remask.`,className:`flex self-stretch`,children:(0,d.jsxs)(e,{type:`button`,variant:`ghost`,size:`sm`,disabled:r,className:c(`h-full rounded-none px-2 text-[11px]`,!n&&`text-amber-800 dark:text-amber-300`),"aria-pressed":!n,"aria-label":n?`Include PII: disabled`:`Include PII: enabled`,onClick:a,"data-slot":`call-api-pii`,children:[(0,d.jsx)(t,{icon:n?o:i,"data-icon":`inline-start`,className:`size-3.5`}),`PII`]})})}export{v as a,_ as i,m as n,p as o,g as r,f as s,x as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{C as t,D as n,E as r,F as i,Hn as a,I as o,Mt as s,Nt as c,Pt as l,Qr as u,Qt as d,R as f,Si as p,Tr as m,Ui as h,Un as g,W as _,Wr as v,X as y,Y as b,_i as x,bi as S,dn as C,en as w,gn as T,ht as E,in as ee,k as D,ki as O,kn as k,kr as A,mr as j,mt as te,nn as ne,or as re,pi as ie,pt as ae,rn as oe,t as M,tn as se,wr as N,x as ce,xi as le,yi as ue}from"./shortcut-keys-CoqwEIi0.js";import{r as de}from"./react-dom-Bph1y7z7.js";import{A as fe}from"./xyflow-D7n4g6go.js";var P=fe();function pe({label:e,keys:t,className:n,children:r}){return(0,P.jsxs)(i,{children:[(0,P.jsx)(f,{render:e=>(0,P.jsx)(`span`,{...e,className:N(`inline-flex items-center`,n),tabIndex:-1,children:r})}),(0,P.jsxs)(o,{side:`bottom`,className:`text-[11px]`,children:[e,t&&t.length>0?(0,P.jsx)(M,{keys:t}):null]})]})}function me({open:e,onToggle:t,noun:n,controlsId:r,dataSlot:i}){let a=e?`Collapse ${n}`:`Expand ${n}`;return(0,P.jsx)(pe,{label:a,className:`flex self-stretch`,children:(0,P.jsx)(`button`,{type:`button`,"aria-expanded":e,"aria-controls":r,"aria-label":a,"data-slot":i,onClick:t,className:re,children:(0,P.jsx)(m,{icon:e?le:p,className:`size-3.5`})})})}var F=e(de(),1);function he(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function ge(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function _e(e){return e/100*window.innerHeight}function ve(e){return e/100*window.innerWidth}function ye(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function be({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=ye(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=ge(t,i);break;case`em`:r=he(t,i);break;case`vh`:r=_e(i);break;case`vw`:r=ve(i)}return r}function I(e){return parseFloat(e.toFixed(3))}function L({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function xe(e){let{panels:t}=e,n=L({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=I(be({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=I(be({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=I(be({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=I(be({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function R(e,t=`Assertion error`){if(!e)throw Error(t)}function Se(e,t){return Array.from(t).sort(e===`horizontal`?Ce:we)}function Ce(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function we(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Te(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Ee(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function De({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Ee(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return R(i,`No rect found`),i}var Oe;function ke(){return Oe===void 0&&(Oe=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),Oe}function Ae(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Se(n,Array.from(t.children).filter(Te).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,De({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=ke()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:L({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var je=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},z={cursorFlags:0,state:`inactive`},Me=new je;function B(){return z}function Ne(e){return Me.addListener(`change`,e)}function Pe(e){let t=z,n={...z};n.cursorFlags=e,z=n,Me.emit(`change`,{prev:t,next:n})}function V(e){let t=z;z=e,Me.emit(`change`,{prev:t,next:e})}var Fe=e=>e,Ie=()=>{},Le=1,Re=2,ze=4,Be=8,Ve=3,He=12,Ue;function We(){return Ue===void 0&&(Ue=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Ue=!0)),Ue}function Ge({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(r!==0||i!==0){if(n===`active`&&e&&We()){let t=(e&Le)!==0,n=(e&Re)!==0,r=(e&ze)!==0,i=(e&Be)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}return We()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Ke=new WeakMap;function qe(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Ke.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=B();switch(r.state){case`active`:case`hover`:{let e=Ge({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0)}Ke.set(e,{prevStyle:t,styleSheet:n})}var H=new Map,Je=new je;function Ye(e){H=new Map(H),H.delete(e)}function Xe(e,t){for(let[t]of H)if(t.id===e)return t}function U(e,t){for(let[t,n]of H)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function W(){return H}function Ze(e,t){return Je.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function G(e,t,n){let r=H.get(e);H=new Map(H),H.set(e,t),Je.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function Qe(e){let t=B(),n=!1;return t.state===`active`&&(V({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(qe(e),n=!0,t.hitRegions.forEach(e=>{let t=U(e.group.id,!0);G(e.group,t,{isUserInteraction:!0})}))),n}function $e(e){e.defaultPrevented||Qe(e.currentTarget)}function et(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Ee(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}function tt(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function nt(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ct(e),b:ct(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();R(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:st(ot(n.a)),b:st(ot(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var rt=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function it(e){let t=getComputedStyle(lt(e)??e).display;return t===`flex`||t===`inline-flex`}function at(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||it(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||rt.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function ot(e){let t=e.length;for(;t--;){let n=e[t];if(R(n,`Missing node`),at(n))return n}return null}function st(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ct(e){let t=[];for(;e;)t.push(e),e=lt(e);return t}function lt(e){let{parentNode:t}=e;return tt(t)?t.host:t}function ut(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function dt({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Te(n)||n.contains(e)||e.contains(n))return!0;if(nt(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ut(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function ft(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Ae(r),a=et(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&dt({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function pt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function K(e,t,n=0){return Math.abs(I(e)-I(t))<=n}function q(e,t){return K(e,t)?0:e>t?1:-1}function J({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(q(r,c)<0)if(a){let e=(i+c)/2;r=q(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=I(r),r}function mt({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(K(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;R(u!=null,`Invalid first pivot index`),R(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];R(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(R(n!=null,`Previous layout not found for panel index ${t}`),K(n,i)){let t=o-n;q(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];R(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(R(n!=null,`Previous layout not found for panel index ${t}`),K(n,o)){let t=n-i;q(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];R(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&q(i,c)<0)if(e>0){let t=c-o,n=t/2;q(i+e,c)<0&&(e=q(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;q(i-e,c)<0&&(e=q(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];R(e!=null,`Previous layout not found for panel index ${r}`);let a=J({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];R(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=J({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!K(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(pt(c,l))return i;{let t=e<0?d:u,r=s[t];R(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=J({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!K(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];R(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=J({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(K(i,s)||(t-=s-i,l[r]=s),K(t,0))break;e>0?r--:r++}}}if(!K(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Y(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||q(e[n],t[n])!==0)return!1;return!0}function X({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!K(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];R(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];R(i!=null,`No layout data found for index ${e}`);let o=r[e];R(o!=null,`No layout data found for index ${e}`);let s=J({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!K(a,0))for(let e=0;e<t.length;e++){let n=r[e];R(n!=null,`No layout data found for index ${e}`);let i=n+a,o=J({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,K(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function ht({groupId:e,panelId:t}){let n=()=>{let t=W();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&K(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:I(100-e)}}return mt({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=X({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});Y(c,u)||G(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&K(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=L({group:t}),o=I(be({groupSize:a,panelElement:r,styleProp:e})/a*100);s(o)}}}function gt(e){e.defaultPrevented||ft(e,W()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=ht({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function _t(e){let t=W();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function vt({groupId:e}){let t=()=>{let t=W();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=X({layout:e,panelConstraints:r});return n?o:(Y(o,c)||G(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Z(e,t){let n=_t(e),r=U(n.id,!0),i=n.separators.find(t=>t.element===e);R(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);R(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=vt({groupId:n.id}).getLayout(),c=X({layout:mt({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Y(s,c)||G(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function yt(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=_t(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Z(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Z(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Z(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Z(t,-5);break;case`End`:e.preventDefault(),Z(t,100);break;case`Enter`:{e.preventDefault();let n=_t(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=U(n.id,!0),o=n.separators.find(e=>e.element===t);R(o,`Matching separator not found`);let s=a.get(o);R(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(R(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Z(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=_t(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);R(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Z(t,-100);break}}function bt(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=W(),n=ft(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),V({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function xt({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=mt({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Y(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Le:Re;break;case`vertical`:s|=d<0?ze:Be;break}}else G(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Ve:c|=s&Ve,t.movementY===0?c|=o&He:c|=s&He,Pe(c),qe(e)}function St(e){let t=W(),n=B();n.state===`active`&&xt({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function Ct(e){if(e.defaultPrevented)return;let t=B(),n=W();switch(t.state){case`active`:if(e.buttons===0){V({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=U(e.group.id,!0);G(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}xt({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=ft(e,n);r.length===0?t.state!==`inactive`&&V({cursorFlags:0,state:`inactive`}):V({cursorFlags:0,hitRegions:r,state:`hover`}),qe(e.currentTarget);break}}}function wt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(B().state){case`hover`:V({cursorFlags:0,state:`inactive`})}}function Tt(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||Qe(e.currentTarget)&&e.preventDefault()}function Et(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=I(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=I((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Dt(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=L({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:I(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Ot(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function kt({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=I(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=I((r[e]??0)/a*l);else{let e=I(l/c.length);for(let t of c)u[t]=e}return u}function At(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Q=new Map;function jt(e){let t=!0;R(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=L({group:e});if(t===0)return;let n=U(e.id);if(!n)return;let r=xe(e),i=n.defaultLayoutDeferred?Et(r):n.layout,a=X({layout:kt({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Y(n.layout,a)&&Ot(n.derivedPanelConstraints,r)&&n.groupSize===t)return;G(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Dt(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{R(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=L({group:e}),s=xe(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(At(e.panels,l)||(l=void 0));let u=X({layout:e.mutableState.layouts[c]??l??Et(s),panelConstraints:s}),d=e.element.ownerDocument;Q.set(d,(Q.get(d)??0)+1);let f=new Map;return Ae(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),G(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{R(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,yt)}),Q.get(d)===1&&(d.addEventListener(`contextmenu`,$e,!0),d.addEventListener(`dblclick`,gt,!0),d.addEventListener(`pointerdown`,bt,!0),d.addEventListener(`pointerleave`,St),d.addEventListener(`pointermove`,Ct),d.addEventListener(`pointerout`,wt),d.addEventListener(`pointerup`,Tt,!0)),function(){t=!1,Q.set(d,Math.max(0,(Q.get(d)??0)-1)),Ye(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,yt)}),Q.get(d)||(d.removeEventListener(`contextmenu`,$e,!0),d.removeEventListener(`dblclick`,gt,!0),d.removeEventListener(`pointerdown`,bt,!0),d.removeEventListener(`pointerleave`,St),d.removeEventListener(`pointermove`,Ct),d.removeEventListener(`pointerout`,wt),d.removeEventListener(`pointerup`,Tt,!0)),a.disconnect()}}function Mt(){let[e,t]=(0,F.useState)({});return[e,(0,F.useCallback)(()=>t({}),[])]}function Nt(e){let t=(0,F.useId)();return`${e??t}`}var $=typeof window<`u`?F.useLayoutEffect:F.useEffect;function Pt(e){let t=(0,F.useRef)(e);return $(()=>{t.current=e},[e]),(0,F.useCallback)((...e)=>t.current?.(...e),[t])}function Ft(...e){return Pt(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function It(e){let t=(0,F.useRef)({...e});return $(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Lt=(0,F.createContext)(null);function Rt(e,t){let n=(0,F.useRef)({getLayout:()=>({}),setLayout:Fe});(0,F.useImperativeHandle)(t,()=>n.current,[]),$(()=>{Object.assign(n.current,vt({groupId:e}))})}function zt({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,F.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Pt(e=>{Y(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Pt((e,t)=>{Y(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=Nt(s),v=(0,F.useRef)(null),[y,b]=Mt(),x=(0,F.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Ft(v,a);Rt(_,o);let C=Pt((e,t)=>{let r=B(),i=Xe(e),a=U(e);if(a){let e=!1;return r.state===`active`&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=It({defaultLayout:n,disableCursor:r}),T=(0,F.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Se(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Se(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Xe(_),i=U(_);r&&i&&G(r,{...i,derivedPanelConstraints:xe(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,F.useRef)(null);return $(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=jt(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=U(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=Ze(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=K(t.collapsedSize,i[t.panelId]),a=K(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=B().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,F.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,P.jsx)(Lt.Provider,{value:T,children:(0,P.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}zt.displayName=`Group`;function Bt(){let e=(0,F.useContext)(Lt);return R(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Vt(e,t){let{id:n}=Bt(),r=(0,F.useRef)({collapse:Ie,expand:Ie,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ie});(0,F.useImperativeHandle)(t,()=>r.current,[]),$(()=>{Object.assign(r.current,ht({groupId:n,panelId:e}))})}function Ht({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Nt(c),_=It({disabled:a}),v=(0,F.useRef)(null),y=Ft(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Bt(),T=d!==null,E=Pt((e,t,n)=>{d?.(e,c,n)});$(()=>{let e=v.current;if(e!==null){let t={element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}};return C(t)}},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,F.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Vt(g,f);let ee=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},D=(0,F.useSyncExternalStore)(e=>Ze(x,e),ee,ee),O;return O=D?JSON.parse(D):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,P.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Ut,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...O},children:(0,P.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Ht.displayName=`Panel`;var Ut={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Wt(){return(0,F.useRef)(null)}function Gt({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=X({layout:mt({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=X({layout:mt({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Kt({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Nt(a),l=It({disabled:n,disableDoubleClick:r}),[u,d]=(0,F.useState)({}),[f,p]=(0,F.useState)(`inactive`),[m,h]=(0,F.useState)(!1),g=(0,F.useRef)(null),_=Ft(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Bt(),C=b===`horizontal`?`vertical`:`horizontal`;$(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=Ne(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Ze(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Gt({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,F.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,P.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Kt.displayName=`Separator`;function qt({className:e,...t}){return(0,P.jsx)(zt,{className:N(`flex h-full w-full data-[orientation=vertical]:flex-col`,e),...t})}var Jt=Ht;function Yt({withHandle:e,className:t,...n}){return(0,P.jsx)(Kt,{className:N(`relative flex items-center justify-center bg-border`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1`,`aria-[orientation=vertical]:w-px`,`aria-[orientation=vertical]:after:absolute aria-[orientation=vertical]:after:inset-y-0 aria-[orientation=vertical]:after:left-1/2 aria-[orientation=vertical]:after:w-1 aria-[orientation=vertical]:after:-translate-x-1/2`,`aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full`,`aria-[orientation=horizontal]:after:absolute aria-[orientation=horizontal]:after:inset-x-0 aria-[orientation=horizontal]:after:top-1/2 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:-translate-y-1/2`,`aria-[orientation=horizontal]:[&>div]:rotate-90`,t),...n,children:e?(0,P.jsx)(`div`,{className:`z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border`,children:(0,P.jsx)(m,{icon:x,className:`size-2.5`})}):null})}function Xt(){let e=Wt(),[t,n]=(0,F.useState)(!0);return{panelRef:e,open:t,toggle:()=>{let t=e.current;t&&(t.isCollapsed()?(t.expand(),n(!0)):(t.collapse(),n(!1)))},onResize:()=>{n(!(e.current?.isCollapsed()??!1))}}}var Zt={flow:{icon:ie,label:`Flow`,symbol:`Fl`},signal:{icon:ue,label:`Signal`,symbol:`Sg`},store:{icon:u,label:`Store`,symbol:`St`},clock:{icon:v,label:`Clock`,symbol:`Ck`},gate:{icon:h,label:`Gate`,symbol:`Gt`},vault:{icon:S,label:`Vault`,symbol:`Vt`},channel:{icon:O,label:`Channel`,symbol:`Ch`},ai:{icon:A,label:`AI`,symbol:`Ai`}};function Qt({className:e,...t}){return(0,P.jsx)(n,{flat:!0,className:N(j,e),...t})}function $t({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`empty`,className:N(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,e),...t})}function en({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`empty-header`,className:N(`flex max-w-sm flex-col items-center gap-2`,e),...t})}var tn=r(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function nn({className:e,variant:t=`default`,...n}){return(0,P.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:N(tn({variant:t,className:e})),...n})}function rn({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`empty-title`,className:N(`cn-font-heading text-sm font-medium tracking-tight`,e),...t})}function an({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`empty-description`,className:N(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}var on=r(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function sn({className:e,variant:t=`default`,render:n,...r}){return ce({defaultTagName:`span`,props:c({className:N(on({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function cn(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,[a,o]=D({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=E(a,!0,!0),u=_(),[d,f]=F.useState(),p=d===null?void 0:d??u,m=w(e=>{let t=!a,n=ee(T,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return F.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var ln=F.createContext(void 0);function un(){let e=F.useContext(ln);if(e===void 0)throw Error(a(15));return e}var dn=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=b.startingStyle]=`startingStyle`,e[e.endingStyle=b.endingStyle]=`endingStyle`,e}({}),fn=function(e){return e.panelOpen=`data-panel-open`,e}({}),pn={[dn.open]:``},mn={[dn.closed]:``},hn={open(e){return e?{[fn.panelOpen]:``}:null}},gn={open(e){return e?pn:mn},...y},_n=F.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:c,style:l,...u}=e,d=w(o),f=cn({open:c,defaultOpen:i,onOpenChange:d,disabled:a}),p=F.useMemo(()=>({open:f.open,disabled:f.disabled,transitionStatus:f.transitionStatus}),[f.open,f.disabled,f.transitionStatus]),m=F.useMemo(()=>({...f,onOpenChange:d,state:p}),[f,d,p]),h=s(`div`,e,{state:p,ref:t,props:u,stateAttributesMapping:gn});return(0,P.jsx)(ln.Provider,{value:m,children:h})}),vn={...hn,...y},yn=F.forwardRef(function(e,n){let{panelId:r,open:i,handleTrigger:a,state:o,disabled:c}=un(),{className:l,disabled:u=c,render:d,nativeButton:f=!0,style:p,...m}=e,{getButtonProps:h,buttonRef:g}=t({disabled:u,focusableWhenDisabled:!0,native:f});return s(`button`,e,{state:o,ref:[n,g],props:[{"aria-controls":i?r:void 0,"aria-expanded":i,onClick:a},m,h],stateAttributesMapping:vn})}),bn={height:void 0,width:void 0};function xn(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,f=F.useRef(null),p=F.useRef(null),[m,h]=F.useState(bn),_=F.useRef(bn),v=F.useRef(!1),y=F.useRef(s),b=F.useRef(!1),[x,S]=F.useState(!1),T=F.useRef(null),E=ne(t,f),D=se(s),O=te(f),k=!s&&!a,A=x?`idle`:u,j=s&&(y.current||b.current),re=!s&&a&&p.current===`css-animation`&&m.height===void 0&&m.width===void 0?_.current:m,ie=n&&k&&p.current!==`css-animation`,M=w((e,t=!0)=>{t&&(_.current=e),h(e)}),N=w(()=>{T.current?.(),T.current=null}),ce=w(e=>{N(),T.current=()=>{T.current=null,e()}}),le=w(()=>{s&&a&&p.current===`css-animation`&&(b.current=!0)});g(()=>{!x||u===`starting`||S(!1)},[x,u]),F.useEffect(()=>()=>{le(),N()},[le,N]),g(()=>{let e=f.current;if(!e)return;!s&&T.current&&N();let t=Cn(e,j);if(p.current=t,s&&u===`idle`&&y.current&&t===`css-animation`){_.current=Sn(e);return}if(s&&u===`starting`){let n=v.current;if(v.current=!1,t===`none`){M(Sn(e)),S(!0);return}if(t===`css-transition`){let t=En(e);if(M(Sn(e)),!n)return t;let r=Tn(e,`transition-duration`,`0s`);return ce(r),S(!0),t}M(Sn(e));let r=Tn(e,`animation-name`,`none`);if(!n){r();return}let i=Tn(e,`animation-duration`,`0s`);r(),ce(i),S(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(y.current=!1,b.current=!1,t===`none`){M(bn,!1),c(!1);return}M(Sn(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=Sn(e);if(!(n.height>0||n.width>0)){c(!1);return}M(n),t===`css-animation`&&Tn(e,`animation-name`,`none`)()},[a,s,N,M,c,ce,j,u]),ae({enabled:s&&a&&A===`idle`,open:!0,ref:f,onComplete(){s&&M(bn,!1)}}),F.useEffect(()=>{if(s||!a||A!==`ending`||!f.current)return;let e=new AbortController,t=-1;function n(){D.current||(c(!1),M(bn,!1))}return t=d.request(()=>{O(n,e.signal)}),()=>{d.cancel(t),e.abort()}},[D,a,s,A,O,M,c]),g(()=>{let e=f.current;!e||!n||!k||e.setAttribute(`hidden`,`until-found`)},[k,n]),F.useEffect(function(){let e=f.current;if(!e)return;function t(e){let t=ee(C,e);o(!0,t),!t.isCanceled&&(v.current=!0,l(!0))}return oe(e,`beforematch`,t)},[o,l]);let ue=i||n||a||s;return{height:re.height,props:{...ie?{[dn.startingStyle]:``}:void 0,hidden:k,id:r},ref:E,shouldPreventOpenAnimation:j,shouldRender:ue,transitionStatus:A,width:re.width}}function Sn(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Cn(e,t){let n=k(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&wn(n.animationDuration),i=wn(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function wn(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function Tn(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===``){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function En(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{if(n===``){e.style.removeProperty(t);return}e.style.setProperty(t,n)})}let r=d.request(n);return()=>{d.cancel(r),n()}}var Dn=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),On=F.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:c,...u}=e,{defaultPanelId:d,mounted:f,onOpenChange:p,open:m,setMounted:h,setPanelIdState:_,setOpen:v,state:y,transitionStatus:b}=un(),x=r??!1,S=i??!1,C=o||void 0,w=C??d;g(()=>(_(e=>C??(e===null?void 0:e)),()=>{_(e=>e===C?null:e)}),[C,_]);let{height:T,props:E,ref:ee,shouldPreventOpenAnimation:D,shouldRender:O,transitionStatus:k,width:A}=xn({externalRef:t,hiddenUntilFound:x,id:w,keepMounted:S,mounted:f,onOpenChange:p,open:m,setMounted:h,setOpen:v,transitionStatus:b}),j={...y,transitionStatus:k},te=l(c,j),ne=s(`div`,{...e,style:void 0},{state:j,ref:ee,props:[E,{style:{[Dn.collapsiblePanelHeight]:T===void 0?`auto`:`${T}px`,[Dn.collapsiblePanelWidth]:A===void 0?`auto`:`${A}px`}},u,te?{style:te}:void 0,D?{style:{animationName:`none`}}:void 0],stateAttributesMapping:gn});return O?ne:null});function kn({...e}){return(0,P.jsx)(_n,{"data-slot":`collapsible`,...e})}function An({...e}){return(0,P.jsx)(yn,{"data-slot":`collapsible-trigger`,...e})}function jn({...e}){return(0,P.jsx)(On,{"data-slot":`collapsible-content`,...e})}export{pe as _,$t as a,nn as c,Zt as d,Xt as f,me as g,qt as h,sn as i,rn as l,Jt as m,jn as n,an as o,Yt as p,An as r,en as s,kn as t,Qt as u};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Cr as t,E as n,c as r,ea as i,i as a,ir as o,l as s,o as c,qr as l,s as u,u as d,wr as f}from"./shortcut-keys-DO4IsVqv.js";import{r as p}from"./react-dom-Bph1y7z7.js";import{A as m}from"./xyflow-D7n4g6go.js";import{c as h,o as g,s as _,t as v}from"./sheet-form-D-ata7jy.js";import{_ as y}from"./collapsible-DYb0xU8C.js";var b=e(p(),1),x=m();function S({value:e,label:n}){let[r,a]=(0,b.useState)(!1),s=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,x.jsx)(y,{label:r?`Copied`:n,children:(0,x.jsx)(`button`,{type:`button`,"aria-label":n,className:t(o,`size-4`),onClick:()=>{navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{a(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>a(!1),1200)})},children:(0,x.jsx)(f,{icon:r?i:l,className:r?`size-3 text-emerald-600 dark:text-emerald-400`:`size-3`,"aria-hidden":!0})})})}function C(e){let t={};return e.typed.trim()!==e.phrase&&(t.typed=`Type ${e.phrase} to confirm`),e.reason.trim().length<3&&(t.reason=`Reason is required (min 3 characters)`),Object.keys(t).length>0?t:null}function w({open:e,onOpenChange:i,phrase:o,title:l,description:f,children:p,pending:m=!1,error:y,confirmLabel:S,confirmVariant:w=`destructive`,slot:T=`confirm-sheet`,onConfirm:E}){let[D,O]=(0,b.useState)(``),[k,A]=(0,b.useState)(``),[j,M]=(0,b.useState)(!1);(0,b.useEffect)(()=>{e||(O(``),A(``),M(!1))},[e]);let N=j?C({typed:D,reason:k,phrase:o}):null,P=C({typed:D,reason:k,phrase:o})===null;return(0,x.jsx)(a,{open:e,onOpenChange:i,children:(0,x.jsxs)(c,{side:`right`,showOverlay:!1,className:`sm:max-w-md`,"data-slot":T,children:[(0,x.jsxs)(s,{children:[(0,x.jsx)(d,{children:l}),(0,x.jsx)(u,{children:f})]}),(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[p,(0,x.jsxs)(_,{label:`Type ${o} to confirm`,children:[(0,x.jsx)(n,{value:D,onChange:e=>O(e.target.value),onBlur:()=>M(!0),placeholder:o,"aria-label":`Type ${o} to confirm`,"aria-invalid":N?.typed?!0:void 0,flat:!0,className:t(v,`font-mono`),autoComplete:`off`}),N?.typed?(0,x.jsx)(`span`,{className:`block px-4 pb-2 text-[10px] text-destructive`,role:`alert`,children:N.typed}):null]}),(0,x.jsxs)(_,{label:`Reason`,children:[(0,x.jsx)(n,{value:k,onChange:e=>A(e.target.value),onBlur:()=>M(!0),placeholder:`Why is this change needed?`,"aria-label":`Reason`,"aria-invalid":N?.reason?!0:void 0,flat:!0,className:v}),N?.reason?(0,x.jsx)(`span`,{className:`block px-4 pb-2 text-[10px] text-destructive`,role:`alert`,children:N.reason}):null]}),y?(0,x.jsx)(g,{children:y}):null]}),(0,x.jsxs)(r,{children:[(0,x.jsx)(h,{split:!0,onClick:()=>i(!1),disabled:m,children:`Cancel`}),(0,x.jsx)(h,{variant:w,disabled:!P||m,onClick:()=>{M(!0),P&&E({confirmation:D.trim(),reason:k.trim()})},"data-slot":`confirm-action`,children:m?`Working…`:S??`Confirm ${o.toLowerCase()}`})]})]})})}export{S as n,w as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,Jr as n,Tr as r,ar as i,c as a,i as o,l as s,o as c,s as l,ta as u,u as d,wr as f}from"./shortcut-keys-CoqwEIi0.js";import{r as p}from"./react-dom-Bph1y7z7.js";import{A as m}from"./xyflow-D7n4g6go.js";import{c as h,o as g,s as _,t as v}from"./sheet-form-Dnwa5oOR.js";import{_ as y}from"./collapsible-LPqGvfoz.js";var b=e(p(),1),x=m();function S({value:e,label:t}){let[a,o]=(0,b.useState)(!1),s=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,x.jsx)(y,{label:a?`Copied`:t,children:(0,x.jsx)(`button`,{type:`button`,"aria-label":t,className:f(i,`size-4`),onClick:()=>{navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{o(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>o(!1),1200)})},children:(0,x.jsx)(r,{icon:a?u:n,className:a?`size-3 text-emerald-600 dark:text-emerald-400`:`size-3`,"aria-hidden":!0})})})}function C(e){let t={};return e.typed.trim()!==e.phrase&&(t.typed=`Type ${e.phrase} to confirm`),e.reason.trim().length<3&&(t.reason=`Reason is required (min 3 characters)`),Object.keys(t).length>0?t:null}function w({open:e,onOpenChange:n,phrase:r,title:i,description:u,children:p,pending:m=!1,error:y,confirmLabel:S,confirmVariant:w=`destructive`,slot:T=`confirm-sheet`,onConfirm:E}){let[D,O]=(0,b.useState)(``),[k,A]=(0,b.useState)(``),[j,M]=(0,b.useState)(!1);(0,b.useEffect)(()=>{e||(O(``),A(``),M(!1))},[e]);let N=j?C({typed:D,reason:k,phrase:r}):null,P=C({typed:D,reason:k,phrase:r})===null;return(0,x.jsx)(o,{open:e,onOpenChange:n,children:(0,x.jsxs)(c,{side:`right`,showOverlay:!1,className:`sm:max-w-md`,"data-slot":T,children:[(0,x.jsxs)(s,{children:[(0,x.jsx)(d,{children:i}),(0,x.jsx)(l,{children:u})]}),(0,x.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[p,(0,x.jsxs)(_,{label:`Type ${r} to confirm`,children:[(0,x.jsx)(t,{value:D,onChange:e=>O(e.target.value),onBlur:()=>M(!0),placeholder:r,"aria-label":`Type ${r} to confirm`,"aria-invalid":N?.typed?!0:void 0,flat:!0,className:f(v,`font-mono`),autoComplete:`off`}),N?.typed?(0,x.jsx)(`span`,{className:`block px-4 pb-2 text-[10px] text-destructive`,role:`alert`,children:N.typed}):null]}),(0,x.jsxs)(_,{label:`Reason`,children:[(0,x.jsx)(t,{value:k,onChange:e=>A(e.target.value),onBlur:()=>M(!0),placeholder:`Why is this change needed?`,"aria-label":`Reason`,"aria-invalid":N?.reason?!0:void 0,flat:!0,className:v}),N?.reason?(0,x.jsx)(`span`,{className:`block px-4 pb-2 text-[10px] text-destructive`,role:`alert`,children:N.reason}):null]}),y?(0,x.jsx)(g,{children:y}):null]}),(0,x.jsxs)(a,{children:[(0,x.jsx)(h,{split:!0,onClick:()=>n(!1),disabled:m,children:`Cancel`}),(0,x.jsx)(h,{variant:w,disabled:!P||m,onClick:()=>{M(!0),P&&E({confirmation:D.trim(),reason:k.trim()})},"data-slot":`confirm-action`,children:m?`Working…`:S??`Confirm ${r.toLowerCase()}`})]})]})})}export{S as n,w as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Bph1y7z7.js";import{A as n}from"./xyflow-D7n4g6go.js";import{A as r,B as i,C as a,D as o,E as s,F as c,I as l,L as u,M as d,N as f,P as p,R as m,S as h,T as g,a as _,b as v,c as y,d as b,f as x,g as S,h as C,i as w,j as T,l as E,m as D,o as O,p as k,r as A,s as j,u as M,y as N,z as P}from"./react-B1ML8gxg.js";var ee=(e,t,n)=>{let r=t-e;return((n-e)%r+r)%r+e};function F(e,t){return r(e)?e[ee(0,e.length,t)]:e}var te=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){let t=this.animations.map(t=>t.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get state(){return this.getAll(`state`)}get startTime(){return this.getAll(`startTime`)}get duration(){return I(this.animations,`duration`)}get iterationDuration(){return I(this.animations,`iterationDuration`)}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}};function I(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r][t];i!==null&&i>n&&(n=i)}return n}var ne=class extends te{then(e,t){return this.finished.finally(e).then(()=>{})}};function re(e,t){return e in t}var L=class extends y{constructor(){super(...arguments),this.type=`object`}readValueFromInstance(e,t){if(re(t,e)){let n=e[t];if(typeof n==`string`||typeof n==`number`)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(e,t){delete t.output[e]}measureInstanceViewportBox(){return M()}build(e,t){Object.assign(e.output,t)}renderInstance(e,{output:t}){Object.assign(e,t)}sortInstanceNodePosition(){return 0}},R=n(),z=e(t(),1);function B(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ie(...e){return t=>{let n=!1,r=e.map(e=>{let r=B(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():B(e[t],null)}}}}function ae(...e){return z.useCallback(ie(...e),e)}var oe=class extends z.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(k(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=k(e)&&e.offsetWidth||0,r=k(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function se({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,z.useId)(),s=(0,z.useRef)(null),c=(0,z.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,z.useContext)(w),u=ae(s,a===!1?void 0:e.props?.ref??e?.ref);return(0,z.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Bph1y7z7.js";import{A as n}from"./xyflow-D7n4g6go.js";import{A as r,B as i,C as a,D as o,E as s,F as c,I as l,L as u,M as d,N as f,P as p,R as m,S as h,T as g,a as _,b as v,c as y,d as b,f as x,g as S,h as C,i as w,j as T,l as E,m as D,o as O,p as k,r as A,s as j,u as M,y as N,z as P}from"./react-D8E3mtu1.js";var ee=(e,t,n)=>{let r=t-e;return((n-e)%r+r)%r+e};function F(e,t){return r(e)?e[ee(0,e.length,t)]:e}var te=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){let t=this.animations.map(t=>t.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get state(){return this.getAll(`state`)}get startTime(){return this.getAll(`startTime`)}get duration(){return I(this.animations,`duration`)}get iterationDuration(){return I(this.animations,`iterationDuration`)}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}};function I(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r][t];i!==null&&i>n&&(n=i)}return n}var ne=class extends te{then(e,t){return this.finished.finally(e).then(()=>{})}};function re(e,t){return e in t}var L=class extends y{constructor(){super(...arguments),this.type=`object`}readValueFromInstance(e,t){if(re(t,e)){let n=e[t];if(typeof n==`string`||typeof n==`number`)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(e,t){delete t.output[e]}measureInstanceViewportBox(){return M()}build(e,t){Object.assign(e.output,t)}renderInstance(e,{output:t}){Object.assign(e,t)}sortInstanceNodePosition(){return 0}},R=n(),z=e(t(),1);function B(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ie(...e){return t=>{let n=!1,r=e.map(e=>{let r=B(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():B(e[t],null)}}}}function ae(...e){return z.useCallback(ie(...e),e)}var oe=class extends z.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(k(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=k(e)&&e.offsetWidth||0,r=k(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function se({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,z.useId)(),s=(0,z.useRef)(null),c=(0,z.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,z.useContext)(w),u=ae(s,a===!1?void 0:e.props?.ref??e?.ref);return(0,z.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
2
2
  [data-motion-pop-id="${o}"] {
3
3
  position: absolute !important;
4
4
  width: ${e}px !important;
@@ -1 +1 @@
1
- import{Yn as e,wr as t}from"./shortcut-keys-DO4IsVqv.js";import{A as n}from"./xyflow-D7n4g6go.js";import{a as r,c as i,l as a,o,s}from"./collapsible-DYb0xU8C.js";var c=n();function l({icon:n,iconClassName:l,title:u,description:d,children:f,leading:p}){return(0,c.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[p?(0,c.jsx)(`header`,{className:e,children:(0,c.jsxs)(`div`,{className:`-ml-2 flex h-full shrink-0 items-stretch`,children:[p,(0,c.jsx)(`span`,{className:`w-px shrink-0 self-stretch bg-border/60`,"aria-hidden":!0})]})}):null,(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,c.jsxs)(r,{className:`border-0`,children:[(0,c.jsxs)(s,{children:[n?(0,c.jsx)(i,{variant:`icon`,className:l,children:(0,c.jsx)(t,{icon:n})}):null,(0,c.jsx)(a,{children:u}),d?(0,c.jsx)(o,{children:d}):null]}),f]})})]})}export{l as t};
1
+ import{Tr as e,Xn as t}from"./shortcut-keys-CoqwEIi0.js";import{A as n}from"./xyflow-D7n4g6go.js";import{a as r,c as i,l as a,o,s}from"./collapsible-LPqGvfoz.js";var c=n();function l({icon:n,iconClassName:l,title:u,description:d,children:f,leading:p}){return(0,c.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[p?(0,c.jsx)(`header`,{className:t,children:(0,c.jsxs)(`div`,{className:`-ml-2 flex h-full shrink-0 items-stretch`,children:[p,(0,c.jsx)(`span`,{className:`w-px shrink-0 self-stretch bg-border/60`,"aria-hidden":!0})]})}):null,(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,c.jsxs)(r,{className:`border-0`,children:[(0,c.jsxs)(s,{children:[n?(0,c.jsx)(i,{variant:`icon`,className:l,children:(0,c.jsx)(e,{icon:n})}):null,(0,c.jsx)(a,{children:u}),d?(0,c.jsx)(o,{children:d}):null]}),f]})})]})}export{l as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ar as t,Br as n,D as r,F as i,I as a,Jr as o,Oo as s,R as c,S as l,Tr as u,_r as d,ci as f,gr as p,hr as m,ji as h,lr as g,or as _,vr as v,wr as y,xr as b,yr as x}from"./shortcut-keys-CoqwEIi0.js";import{r as S}from"./react-dom-Bph1y7z7.js";import{A as C,a as w,c as T,d as E,o as D,p as O,r as ee,s as k,t as te}from"./xyflow-D7n4g6go.js";import{n as A,t as ne}from"./react-D8E3mtu1.js";import{t as re}from"./duration-tone-sC3lGABz.js";import{a as ie,i as ae,n as oe,o as se,r as ce,t as le}from"./trace-detail-sheet-CFIGRnnA.js";import{r as ue}from"./preload-helper-oH4irX4C.js";import{t as de,u as fe}from"./index-Ca3HZMVq.js";import{a as pe,c as me,d as j,f as he,g as ge,h as _e,l as ve,m as ye,o as be,p as xe,s as Se,u as Ce}from"./collapsible-LPqGvfoz.js";import{a as we,c as Te,i as Ee,l as De,o as Oe,s as ke}from"./highlighted-json-CS_O8L-r.js";import{C as M,D as Ae,O as N,S as P,T as je,_ as Me,b as Ne,g as Pe,v as Fe,w as F,x as I}from"./http-method--sWDdXSB.js";import{a as Ie,c as L,i as Le,n as Re,o as ze,r as Be,t as Ve}from"./cache-glyph-F1FI122b.js";import{t as He}from"./agent-disclosure-C0X1fbWF.js";var R=e(S(),1),z=[`flow`,`signal`,`store`,`clock`,`gate`,`vault`,`channel`,`ai`];function B(e,t,n){return{x:P.cx+t*Math.cos(e)-n.width/2,y:P.cy+t*Math.sin(e)-n.height/2}}function V(e){if(e<=0)return[];let t=2*Math.PI/e;return Array.from({length:e},(e,n)=>-Math.PI/2+n*t)}var Ue=2*Math.PI/z.length;function H(e,t,n=P.typeRing){if(t<=0)return[];if(t===1)return[e];let r=(M.type.width+10)/n,i=Math.min(r*(t-1),Ue*.7);return Array.from({length:t},(n,r)=>e-i/2+r/(t-1)*i)}function We(e,t){if(t<=0)return[];let n=P.typeRing,r=P.typeRing+P.typeRow;if(t===1)return[{angle:e,radius:n}];if(t===4)return Ke(e,n,r);if(t<=3)return H(e,t,n).map(e=>({angle:e,radius:n}));let i=Math.ceil(t/2),a=t-i;return[...H(e,i,n).map(e=>({angle:e,radius:n})),...H(e,a,r).map(e=>({angle:e,radius:r}))]}function Ge(e){return Math.abs(Math.cos(e))*M.type.height+Math.abs(Math.sin(e))*M.type.width}function Ke(e,t,n){let r=(Ge(e)+24)/t;return[{angle:e-r/2,radius:t},{angle:e+r/2,radius:t},{angle:e-r/2,radius:n},{angle:e+r/2,radius:n}]}function qe(e){let t=new Set([`flow`]),n=e.trigger;(n?.cron||n?.every)&&t.add(`clock`),n?.signal&&t.add(`signal`),(e.gates?.length??0)>0&&t.add(`gate`);let r=e.effects;return((r?.reads?.length??0)>0||(r?.writes?.length??0)>0)&&t.add(`store`),(r?.emits?.length??0)>0&&t.add(`signal`),(r?.sends?.length??0)>0&&t.add(`channel`),(r?.asks?.length??0)>0&&t.add(`ai`),(r?.secrets?.length??0)>0&&t.add(`vault`),z.filter(e=>t.has(e))}function Je(e){let t=new Set([`flow`]);(e.trigger===`cron`||e.trigger===`every`)&&t.add(`clock`),e.trigger===`signal`&&t.add(`signal`),e.gates.length>0&&t.add(`gate`);for(let n of e.effects)switch(n.kind){case`read`:case`write`:t.add(`store`);break;case`emit`:t.add(`signal`);break;case`send`:t.add(`channel`);break;case`ask`:t.add(`ai`);break;case`secret`:t.add(`vault`)}return z.filter(e=>t.has(e))}function Ye(e,t){let n=new Map,r=(e,t,r)=>{n.has(e)||n.set(e,r===void 0?{id:e,label:t}:{id:e,label:t,badge:r})};switch(t){case`flow`:for(let t of Object.keys(e.flows??{}).sort())r(`flow:${t}`,Be(t),L(t));break;case`signal`:for(let t of Object.keys(e.signals??{}).sort())r(`signal:${t}`,t,`signal`);for(let t of Object.values(e.flows??{})){t.trigger?.signal&&r(`signal:${t.trigger.signal}`,t.trigger.signal,`signal`);for(let e of t.effects?.emits??[])r(`signal:${e}`,e,`signal`)}break;case`store`:for(let[t,n]of Object.entries(e.stores??{})){let e=n.facet;for(let t of Object.keys(n.tables??{}).sort())r(`${e}:${t}`,t,e);let i=n.namespaces&&n.namespaces.length>0?n.namespaces:[];e===`kv`&&i.length===0&&r(`kv:${t}`,t,`kv`);for(let e of[...i].sort())r(`kv:${e}`,e,`kv`);for(let e of[...n.buckets??[]].sort())r(`files:${e}`,e,`files`);for(let e of[...n.indexes??[]].sort())r(`index:${e}`,e,`index`)}for(let t of Object.values(e.flows??{}))for(let e of[...t.effects?.reads??[],...t.effects?.writes??[]]){let t=Xe(e);t&&r(t.id,t.label,t.badge)}break;case`clock`:for(let[t,n]of Object.entries(e.clocks??{}).sort(([e],[t])=>e.localeCompare(t)))r(`clock:${t}`,t,n.cron?`cron`:n.every?`every`:`clock`);for(let[t,n]of Object.entries(e.flows??{}))n.trigger?.cron&&r(`clock:${t}`,n.trigger.cron,`cron`),n.trigger?.every&&r(`clock:${t}`,n.trigger.every,`every`);break;case`gate`:for(let t of Object.keys(e.gates??{}).sort())r(`gate:${t}`,t,`gate`);for(let t of Object.values(e.flows??{}))for(let e of t.gates??[])r(`gate:${e}`,e,`gate`);break;case`vault`:for(let t of Object.keys(e.vault??{}).sort())r(`vault:${t}`,t,`vault`);for(let t of Object.values(e.flows??{}))for(let e of t.effects?.secrets??[])r(`vault:${e}`,e,`vault`);break;case`channel`:for(let t of Object.keys(e.channels??{}).sort())r(`channel:${t}`,t,`channel`);for(let t of Object.values(e.flows??{}))for(let e of t.effects?.sends??[])r(`channel:${e}`,e,`channel`);break;case`ai`:for(let t of Object.keys(e.ai?.prompts??{}).sort())r(`ai:${t}`,t,`prompt`);for(let t of Object.keys(e.ai?.agents??{}).sort())r(`ai:${t}`,t,`agent`);for(let t of Object.values(e.flows??{}))for(let e of t.effects?.asks??[])r(`ai:${e}`,e,`prompt`)}return[...n.values()].sort((e,t)=>e.label.localeCompare(t.label))}function Xe(e){return e.startsWith(`sql:`)?{id:e,label:e.slice(4),badge:`sql`}:e.startsWith(`kv:`)?{id:e,label:e.slice(3),badge:`kv`}:e.startsWith(`files:`)?{id:e,label:e.slice(6),badge:`files`}:e.startsWith(`index:`)?{id:e,label:e.slice(6),badge:`index`}:null}var Ze={flow:Pe.map(e=>({kind:e,label:Me[e].label})),signal:[{kind:`once`,label:`once`},{kind:`broadcast`,label:`broadcast`},{kind:`live`,label:`live`}],store:[{kind:`sql`,label:`SQL`},{kind:`kv`,label:`KV`},{kind:`files`,label:`Files`},{kind:`index`,label:`Index`}],clock:[{kind:`cron`,label:`cron`},{kind:`every`,label:`every`}],gate:[{kind:`policy`,label:`policy`},{kind:`scope`,label:`scope`},{kind:`rate`,label:`rate`},{kind:`flag`,label:`flag`}],vault:[{kind:`secret`,label:`secret`},{kind:`config`,label:`config`},{kind:`env`,label:`env`}],channel:[{kind:`email`,label:`email`},{kind:`sms`,label:`SMS`},{kind:`whatsapp`,label:`WA`},{kind:`push`,label:`Push`}],ai:[{kind:`model`,label:`model`},{kind:`prompt`,label:`prompt`},{kind:`embed`,label:`embed`},{kind:`agent`,label:`agent`}]};function Qe(e,t){return Ze[t].map(e=>({id:`type:${t}:${e.kind}`,label:e.label,badge:e.kind}))}function $e(e,t){return t?.kind===`rate`||e.startsWith(`rate:`)?`rate`:e.startsWith(`flag:`)?`flag`:(t?.scopes?.length??0)>0?`scope`:`policy`}function et(e){return e?.sensitive===!1?`config`:`secret`}function tt(e,t){let n=t.split(`@`)[0]??t;return e.ai?.agents?.[n]?`agent`:e.ai?.models?.[n]?`model`:`prompt`}function nt(e,t,n){let r=`type:${n}:`;switch(n){case`flow`:return[`${r}${Fe(t.trigger)}`];case`store`:{let e=new Set;for(let n of[...t.effects?.reads??[],...t.effects?.writes??[]]){let t=Xe(n);t?.badge&&e.add(t.badge)}return[...e].map(e=>`${r}${e}`)}case`signal`:{let n=[...t.trigger?.signal?[t.trigger.signal]:[],...t.effects?.emits??[]],i=new Set;for(let t of n){let n=e.signals?.[t]?.delivery;n&&i.add(n)}return[...i].map(e=>`${r}${e}`)}case`clock`:{let e=[];return t.trigger?.cron&&e.push(`${r}cron`),t.trigger?.every&&e.push(`${r}every`),e}case`gate`:return[...new Set((t.gates??[]).map(t=>$e(t,e.gates?.[t])))].map(e=>`${r}${e}`);case`vault`:return[...new Set((t.effects?.secrets??[]).map(t=>et(e.vault?.[t])))].map(e=>`${r}${e}`);case`channel`:{let n=new Set;for(let r of t.effects?.sends??[]){let t=e.channels?.[r]?.medium;t&&t!==`any`&&n.add(t)}return[...n].map(e=>`${r}${e}`)}case`ai`:return[...new Set((t.effects?.asks??[]).map(t=>tt(e,t)))].map(e=>`${r}${e}`)}}function rt(e){let t=e?.flows??{},n=new Map;for(let e of Object.keys(t).sort()){let t=L(e),r=n.get(t)??[];r.push(e),n.set(t,r)}let r=new Map,i=new Map,a=new Map;for(let[e,o]of n){let n=new Set;for(let i of o){let o=t[i];if(o)for(let t of qe(o)){n.add(t);let o=`${e}\0${t}`;r.set(o,(r.get(o)??0)+1);let s=a.get(t)??new Set;s.add(i),a.set(t,s)}}i.set(e,n)}let o=[...n.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({unit:e,flowCount:t.length,elements:z.filter(t=>i.get(e)?.has(t)),live:0,errors:0})),s=z.map(t=>({element:t,resourceCount:e?Ye(e,t).length:0,flowCount:a.get(t)?.size??0,live:0,errors:0})),c=[];for(let e of o)for(let t of e.elements)c.push({unit:e.unit,element:t,flowCount:r.get(`${e.unit}\0${t}`)??0});return{units:o,hubs:s,couplings:c}}function it(e,t){let n=new Map,r=new Map,i=new Map,a=new Map;for(let e of t){let t=e.unit??L(e.flow);n.set(t,(n.get(t)??0)+1),e.error&&r.set(t,(r.get(t)??0)+1);for(let t of Je(e))i.set(t,(i.get(t)??0)+1),e.error&&a.set(t,(a.get(t)??0)+1)}return{couplings:e.couplings,units:e.units.map(e=>({...e,live:n.get(e.unit)??0,errors:r.get(e.unit)??0})),hubs:e.hubs.map(e=>({...e,live:i.get(e.element)??0,errors:a.get(e.element)??0}))}}function at(e,t=[],n=null){if(!e||Object.keys(e.flows??{}).length===0)return{nodes:[],edges:[],units:[],hubs:[]};let r=it(rt(e),t),i=n?.element,a=r.hubs.find(e=>e.element===`flow`)?.live??0,o=r.hubs.find(e=>e.element===`flow`)?.errors??0,s=[],c=[];s.push(ot(`orbit:elements`,P.elementRing)),s.push(ot(`orbit:types`,P.typeRing)),s.push(ot(`orbit:spokes`,P.spokeRing)),s.push({id:`law:oke`,type:`law`,position:{x:P.cx-M.law.width/2,y:P.cy-M.law.height/2},data:{kind:`law`,label:e.app,refId:`oke`,badge:String(r.units.reduce((e,t)=>e+t.flowCount,0)),live:a,errors:o},selectable:!1,draggable:!1,zIndex:I.leaf,width:M.law.width,height:M.law.height,style:{width:M.law.width,height:M.law.height,overflow:`visible`}});let l=V(z.length);if(r.hubs.forEach((e,t)=>{let n=l[t]??0,r=M.hub;s.push({id:`element:${e.element}`,type:`element`,position:B(n,P.elementRing,r),data:{kind:`element`,label:j[e.element].symbol,refId:e.element,badge:String(e.resourceCount),live:e.live,errors:e.errors,dimmed:i!=null&&e.element!==i},draggable:!1,zIndex:I.leaf,width:r.width,height:r.height,style:{width:r.width,height:r.height}}),c.push(U(`element:${e.element}`,`law:oke`,e.element,1,!0))}),!i||i===`flow`){let t=M.type;r.hubs.forEach((n,r)=>{let i=l[r]??0,a=Qe(e,n.element),o=We(i,a.length);a.forEach((e,r)=>{let a=o[r]??{angle:i,radius:P.typeRing};s.push({id:e.id,type:`typeChip`,position:B(a.angle,a.radius,t),data:{kind:n.element,label:e.label,refId:e.id,...e.badge===void 0?{}:{badge:e.badge,facet:e.badge}},draggable:!1,zIndex:I.leaf,width:t.width,height:t.height,style:{width:t.width,height:t.height}}),c.push(U(e.id,`element:${n.element}`,n.element,1))})})}if(i&&i!==`flow`){let t=Ye(e,i),n=je.store,r=V(t.length);t.forEach((e,t)=>{let a=r[t]??0;s.push({id:e.id,type:i,position:B(a,P.spokeRing,n),data:{kind:i,label:e.label,refId:e.id,...e.badge===void 0?{}:{badge:e.badge,facet:e.badge}},draggable:!1,zIndex:I.leaf,width:n.width,height:n.height,style:{width:n.width,height:n.height}}),c.push(U(e.id,`element:${i}`,i,1))})}else{let t=M.unit,n=V(r.units.length);r.units.forEach((e,r)=>{let i=n[r]??0;s.push({id:`unit:${e.unit}`,type:`unitChip`,position:B(i,P.spokeRing,t),data:{kind:`unit`,label:e.unit,refId:e.unit,badge:String(e.flowCount),elements:e.elements.filter(e=>e!==`flow`),live:e.live,errors:e.errors},draggable:!1,zIndex:I.leaf,width:t.width,height:t.height,style:{width:t.width,height:t.height}})});let a=new Map;for(let t of Object.keys(e.flows??{}).sort()){let e=L(t),n=a.get(e)??[];n.push(t),a.set(e,n)}for(let t of r.units){let n=new Map,r=new Set;for(let o of a.get(t.unit)??[]){let t=e.flows?.[o];if(t)for(let a of qe(t)){if(i===`flow`&&a!==`flow`)continue;let o=nt(e,t,a);o.length===0&&r.add(a);for(let e of o)n.set(e,(n.get(e)??0)+1)}}for(let[e,r]of n){let n=e.slice(5).split(`:`)[0];!n||!(n in F)||c.push(U(`unit:${t.unit}`,e,n,r))}for(let e of r)c.push(U(`unit:${t.unit}`,`element:${e}`,e,1))}}return{nodes:s,edges:c,units:r.units,hubs:r.hubs}}function ot(e,t){let n=t*2;return{id:e,type:`orbit`,position:{x:P.cx-t,y:P.cy-t},data:{kind:`law`,label:``,refId:e},selectable:!1,draggable:!1,zIndex:I.edge,width:n,height:n,style:{width:n,height:n}}}function st(e,t){return t===`law:oke`?`trunk`:e.startsWith(`type:`)&&t.startsWith(`element:`)?`bind`:`spoke`}function ct(e){return e===`trunk`?.14:e===`bind`?.2:0}function U(e,t,n,r,i=!1){let a=i?`trunk`:st(e,t),o=a===`trunk`?1.15:1+Math.min(1.25,Math.log2(1+r)*.45);return{id:`couple:${e}->${t}`,source:e,target:t,sourceHandle:`center`,targetHandle:`center`,type:`straight`,data:{kind:`couple`},style:{stroke:Ne.couple,strokeWidth:o,opacity:ct(a)},zIndex:I.edge}}function lt(e){if(e.startsWith(`element:`)){let t=e.slice(8);return t in F?t:null}if(e.startsWith(`type:`)){let t=e.slice(5).split(`:`)[0];return t&&t in F?t:null}return null}function ut(e,t){for(let n of[t,e]){let e=lt(n);if(e)return F[e].accent}return Ne.couple}function dt(e,t){let n=new Set,r=new Set,i=(e,t)=>{r.add(`couple:${e}->${t}`)};if(!e)return{nodeIds:n,edgeIds:r};for(let r of t){let t=e.flows?.[r];if(!t)continue;let a=`unit:${L(r)}`;n.add(a);for(let r of qe(t)){let o=`element:${r}`;n.add(o),n.add(`law:oke`),i(o,`law:oke`);let s=nt(e,t,r);s.length===0&&i(a,o);for(let e of s)n.add(e),i(a,e),i(e,o)}}return{nodeIds:n,edgeIds:r}}function ft(e,t,n={}){let r=n.hoverNodeId??null,i=n.highlightedFlowIds??new Set,a=n.highlightedNodeIds??new Set,o=dt(n.manifest,i),s=o.nodeIds.size>0||a.size>0,c=r!=null,l=r==null?null:pt(r,t);return{nodes:e.map(e=>{if(e.type===`orbit`)return{...e,data:{...e.data,highlighted:!1,dimmed:!1}};let t=o.nodeIds.has(e.id)||a.has(e.id)||i.has(e.data.refId),n=l?.has(e.id)===!0;return{...e,data:{...e.data,highlighted:t||c&&e.id===r,dimmed:e.id===`law:oke`?!1:s&&!t||c&&!n}}}),edges:t.map(e=>{let t=l!=null&&l.has(e.source)&&l.has(e.target),n=s&&o.edgeIds.has(e.id),r=c?t:n,i=st(e.source,e.target),a=c||s?r?1:ct(i)*.35:ct(i);return{...e,animated:r,style:{...e.style,stroke:r?ut(e.source,e.target):Ne.couple,opacity:a,strokeWidth:r?2.25:e.style?.strokeWidth}}})}}function W(e,t){let n=[];for(let r of e)r.source===t?n.push(r.target):r.target===t&&n.push(r.source);return n}function pt(e,t){let n=new Set([e]),r=e=>n.add(e);if(e.startsWith(`unit:`)){for(let n of W(t,e)){if(r(n),n.startsWith(`type:`)){for(let e of W(t,n))if(e.startsWith(`element:`)){r(e);for(let n of W(t,e))n===`law:oke`&&r(n)}}if(n.startsWith(`element:`))for(let e of W(t,n))e===`law:oke`&&r(e)}return n}if(e.startsWith(`type:`)){for(let n of W(t,e))r(n);let i=[...n].find(e=>e.startsWith(`element:`));if(i)for(let e of W(t,i))e===`law:oke`&&r(e);return n}if(e.startsWith(`element:`)||e===`law:oke`)for(let n of W(t,e))r(n);return n}var G=C(),mt={flow:j.flow.icon,signal:j.signal.icon,store:j.store.icon,clock:j.clock.icon,gate:j.gate.icon,vault:j.vault.icon,channel:j.channel.icon,ai:j.ai.icon},ht={flow:`rounded-xl`,store:`rounded-md`,signal:`rounded-full`,clock:`rounded-lg`,gate:`rounded-md`,vault:`rounded-md`,channel:`rounded-xl`,ai:`rounded-2xl`};function K(e,t){return y(`group relative flex h-full w-full items-center gap-2.5 border-2 px-2.5 text-xs transition-[opacity,filter,box-shadow,border-color] duration-200`,ht[t],e.dimmed&&`opacity-30 saturate-[0.35]`,e.highlighted&&`z-10`,e.focused&&`z-10`)}function q(e,t){let n=F[e],r=`color-mix(in oklab, ${n.accent} 20%, var(--card))`;return t.highlighted||t.focused?{borderColor:n.accent,background:`color-mix(in oklab, ${n.accent} 26%, var(--card))`,boxShadow:`0 0 0 1px ${n.accent}, 0 0 22px ${n.glow}`}:{borderColor:`color-mix(in oklab, ${n.accent} 78%, var(--border))`,background:r,boxShadow:`inset 3px 0 0 ${n.accent}`}}function J({data:e,kind:t,className:n,style:r,children:i,...a}){let o=A(),s=F[t];return(0,G.jsx)(ne.div,{className:n,style:r,initial:!1,whileHover:o?void 0:{scale:1.04},whileTap:o?void 0:{scale:.97},animate:{scale:o?1:e.active?[1,1.08,1]:e.highlighted?1.02:1,boxShadow:e.active?`0 0 0 2px ${s.accent}, 0 0 30px ${s.glow}`:void 0},transition:e.active?{duration:.5,ease:`easeInOut`}:{type:`spring`,stiffness:400,damping:28},...a,children:i})}function gt({kind:e,size:t=`sm`}){let n=F[e];return(0,G.jsx)(`span`,{className:y(`flex shrink-0 items-center justify-center border`,t===`md`?`size-9`:`size-7`,e===`signal`?`rounded-full`:e===`store`||e===`gate`||e===`vault`?`rounded-md`:`rounded-full`),style:{color:n.accent,background:n.well,borderColor:`color-mix(in oklab, ${n.accent} 55%, transparent)`},"aria-hidden":!0,children:(0,G.jsx)(u,{icon:mt[e],size:t===`md`?17:15,strokeWidth:1.9})})}function _t({text:e}){return(0,G.jsx)(`span`,{className:`rounded border border-border/70 bg-background/50 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.16em] text-muted-foreground`,children:e})}function vt({type:e,kind:t}){let n=F[t];return(0,G.jsx)(w,{type:e,position:e===`source`?O.Right:O.Left,className:`!size-2 !border-0`,style:{background:n.accent}})}function Y({type:e}){return(0,G.jsx)(w,{id:`center`,type:e,position:e===`source`?O.Right:O.Left,isConnectable:!1,className:`oke-center-handle !top-1/2 !left-1/2 !size-px !-translate-x-1/2 !-translate-y-1/2 !border-0 !bg-transparent !opacity-0`})}function yt({live:e,errors:t}){return e<=0?null:(0,G.jsx)(`span`,{className:y(`size-2 shrink-0 rounded-full`,t>0?`bg-rose-400`:`bg-emerald-400`,e>0&&`animate-pulse`),title:t>0?`${e} live · ${t} failed`:`${e} live`})}function bt({elements:e}){return e.length===0?null:(0,G.jsx)(`span`,{className:`mt-0.5 flex items-center gap-1`,"aria-hidden":!0,children:e.map(e=>(0,G.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:F[e].accent},title:j[e].label},e))})}function xt({data:e}){return(0,G.jsx)(`div`,{className:`h-full w-full rounded-xl border border-dashed border-foreground/25 bg-muted/35 px-3 pt-1.5`,children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.2em] text-muted-foreground`,children:e.label}),e.badge?(0,G.jsx)(_t,{text:e.badge}):null]})})}function St({data:e}){let t=e.kind in F?e.kind:`flow`;return(0,G.jsxs)(J,{data:e,kind:t,className:y(K(e,t),`justify-center gap-0 rounded-full px-2`),style:q(t,e),"data-slot":`type-chip`,"data-type":e.refId,children:[(0,G.jsx)(Y,{type:`source`}),(0,G.jsx)(Y,{type:`target`}),(0,G.jsx)(`div`,{className:`min-w-0 truncate text-center text-[10px] leading-none font-medium tracking-wide text-foreground`,children:e.label})]})}function Ct({data:e}){return(0,G.jsxs)(J,{data:e,kind:`flow`,className:y(K(e,`flow`),`rounded-full px-2.5`),style:q(`flow`,e),"data-slot":`unit-chip`,"data-unit":e.refId,children:[(0,G.jsx)(Y,{type:`source`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`div`,{className:`truncate font-medium tracking-wide text-foreground uppercase`,children:e.label}),(0,G.jsx)(yt,{live:e.live??0,errors:e.errors??0})]}),(0,G.jsx)(bt,{elements:e.elements??[]})]}),e.badge?(0,G.jsx)(_t,{text:e.badge}):null]})}function wt({data:e}){let t=Ot(e.refId)??`flow`,n=F[t];return(0,G.jsxs)(J,{data:e,kind:t,className:y(K(e,t),`flex-col justify-center gap-0.5 rounded-full px-1.5 text-center`),style:{...q(t,e),boxShadow:e.highlighted?`0 0 0 1px ${n.accent}, 0 0 22px ${n.glow}`:`0 0 0 1px color-mix(in oklab, ${n.accent} 55%, transparent)`},"data-slot":`element-hub`,"data-element":t,children:[(0,G.jsx)(Y,{type:`target`}),(0,G.jsx)(Y,{type:`source`}),(0,G.jsx)(`span`,{className:`text-[18px] font-semibold tracking-tight text-foreground`,title:j[t].label,children:e.label})]})}function Tt(e){return e>=40?1.05:e>=12?1.55:2.2}function Et({data:e}){let t=A(),n=e.live??0,r=e.errors??0,[i,a]=(0,R.useState)(0),o=(0,R.useRef)(n);(0,R.useEffect)(()=>{n>o.current&&a(e=>e+1),o.current=n},[n]);let s=n>0,c=Tt(n),l=r>0?`var(--color-rose-400)`:`var(--foreground)`;return(0,G.jsxs)(`div`,{className:y(`relative flex h-full w-full items-center justify-center overflow-visible`,e.highlighted&&`z-10`),"data-slot":`law-hub`,"data-live":n,children:[(0,G.jsx)(Y,{type:`target`}),!t&&s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`oke-law-ripple`,style:{animationDuration:`${c}s`,color:l}}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`oke-law-ripple`,style:{animationDuration:`${c}s`,animationDelay:`${c/2}s`,color:l}})]}):null,i>0&&!t?(0,G.jsx)(`span`,{"aria-hidden":!0,className:`oke-law-hit`,style:{color:l}},i):null,(0,G.jsx)(ne.div,{className:`flex h-full w-full items-center justify-center rounded-full border-4 bg-card px-4 text-center`,style:{borderColor:`color-mix(in oklab, var(--foreground) 82%, var(--border))`,boxShadow:e.highlighted?`0 0 0 1px ${l}, 0 0 36px color-mix(in oklab, ${l} 28%, transparent)`:`inset 0 0 28px color-mix(in oklab, var(--foreground) 7%, transparent), 0 0 22px color-mix(in oklab, ${l} ${s?16:6}%, transparent)`},animate:t||!s?{scale:1}:{scale:[1,1.045,1]},transition:t||!s?{duration:0}:{duration:c,repeat:1/0,ease:`easeInOut`},children:(0,G.jsx)(de,{className:`h-7 w-auto text-foreground`})})]})}function Dt(){return(0,G.jsx)(`div`,{className:`pointer-events-none h-full w-full rounded-full border border-dashed border-foreground/15`,"data-slot":`orbit`})}function Ot(e){return e in F?e:null}function X({data:e,kind:t,slot:n}){return(0,G.jsxs)(J,{data:e,kind:t,className:K(e,t),style:q(t,e),"data-slot":n,"data-flow-id":t===`flow`?e.refId:void 0,"data-highlighted":e.highlighted?`true`:`false`,children:[(0,G.jsx)(vt,{type:`target`,kind:t}),(0,G.jsx)(Y,{type:`source`}),(0,G.jsx)(gt,{kind:t}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:e.label}),(0,G.jsx)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:(0,G.jsx)(_t,{text:e.badge??e.plane??e.facet??t})})]}),t===`flow`||t===`signal`?(0,G.jsx)(vt,{type:`source`,kind:t}):null]})}function kt({data:e}){return(0,G.jsx)(X,{data:e,kind:`flow`,slot:`flow-node`})}function At({data:e}){return(0,G.jsx)(X,{data:e,kind:`store`,slot:`store-node`})}function jt({data:e}){return(0,G.jsx)(X,{data:e,kind:`signal`,slot:`signal-node`})}function Mt({data:e}){return(0,G.jsx)(X,{data:e,kind:`ai`,slot:`ai-node`})}function Nt({data:e}){return(0,G.jsx)(X,{data:e,kind:`clock`,slot:`clock-node`})}function Pt({data:e}){return(0,G.jsx)(X,{data:e,kind:`gate`,slot:`gate-node`})}function Ft({data:e}){return(0,G.jsx)(X,{data:e,kind:`vault`,slot:`vault-node`})}function It({data:e}){return(0,G.jsx)(X,{data:e,kind:`channel`,slot:`channel-node`})}var Lt={unit:xt,unitChip:Ct,typeChip:St,element:wt,law:Et,orbit:Dt,flow:kt,store:At,signal:jt,ai:Mt,clock:Nt,gate:Pt,vault:Ft,channel:It};function Rt(e,t){let n=e.flows??{},r=new Set;if(t.kind===`unit`){for(let e of Object.keys(n))L(e)===t.unit&&r.add(e);let e=[];for(let t of r)for(let r of n[t]?.effects?.calls??[])N(r)||e.push(r);for(let t of e)r.add(t)}else if(t.kind===`flow`){r.add(t.flowId);let e=n[t.flowId];for(let t of e?.effects?.calls??[])N(t)||r.add(t);for(let[e,i]of Object.entries(n))i.effects?.calls?.includes(t.flowId)&&r.add(e)}else for(let[e,i]of Object.entries(n))zt(i,e,t.nodeId)&&r.add(e);let i={};for(let e of r){let t=n[e];t&&(i[e]=t)}return{...e,flows:i}}function zt(e,t,n){if(n===`flow:${t}`||n===`clock:${t}`&&(e.trigger?.cron||e.trigger?.every)||e.trigger?.signal&&n===`signal:${e.trigger.signal}`||e.gates?.some(e=>n===`gate:${e}`))return!0;let r=e.effects;return r?!!(r.reads?.some(e=>e===n)||r.writes?.some(e=>e===n)||r.emits?.some(e=>n===`signal:${e}`)||r.sends?.some(e=>n===`channel:${e}`)||r.asks?.some(e=>n===`ai:${e}`)||r.secrets?.some(e=>n===`vault:${e}`)||r.calls?.some(e=>{let t=N(e);return t?n===Ae(t.server):n===`flow:${e}`})):!1}var Bt=[`!=`,`>=`,`<=`,`=`,`>`,`<`],Vt={clauses:[]},Ht=[`flow`,`unit`,`trigger`,`plane`,`tenant`,`principal`,`cache`,`replica`,`error`,`buildVersion`,`promptVersion`,`duration`];function Ut(e){if(!e||!e.trim())return Vt;let t=e.split(/\s+AND\s+/i).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t){let t=en(e);t&&n.push(t)}return{clauses:n}}function Z(e,t){return{clauses:[...e.clauses.filter(e=>e.dimension!==t.dimension),t]}}function Wt(e,t){return{clauses:e.clauses.filter(e=>e.dimension!==t)}}function Gt(e,t){return e.dimension===t.dimension&&e.op===t.op&&e.value===t.value}function Kt(e,t){return e.clauses.some(e=>Gt(e,t))}function qt(e,t){return Kt(e,t)?Wt(e,t.dimension):Z(e,t)}function Jt(e){let t=rn(e.dimension,e.value);return`${e.dimension} ${e.op} ${t}`}function Yt(e,t){for(let n of t.clauses)if(!an(e,n))return!1;return!0}function Xt(e,t){return t.clauses.length===0?[...e]:e.filter(e=>Yt(e,t))}function Zt(e){let t=/^(-?\d+(?:\.\d+)?)\s*(ms|s|m)?$/i.exec(e.trim());if(!t)return;let n=Number(t[1]),r=(t[2]??`ms`).toLowerCase();if(r===`ms`)return n;if(r===`s`)return n*1e3;if(r===`m`)return n*6e4}function Qt(e,t){switch(t){case`flow`:return e.flow;case`unit`:return e.unit??null;case`trigger`:return e.trigger;case`plane`:return e.plane;case`tenant`:return e.tenant??null;case`principal`:return e.principal??null;case`cache`:return e.cache;case`replica`:return e.replica??null;case`replicaLagMs`:case`replica_lag_ms`:return e.replicaLagMs??null;case`error`:case`error_code`:return e.error??null;case`buildVersion`:case`build_version`:return e.buildVersion??null;case`promptVersion`:case`prompt_version`:return e.promptVersion??null;case`cost`:return e.cost??null;case`duration`:case`duration_ms`:return e.durationMs;case`gates`:return e.gates.join(`,`);default:return e.dimensions[t]}}function $t(e){let t=new Set(Ht);for(let n of e)for(let e of Object.keys(n.dimensions))t.add(e);return[...t].sort()}function en(e){let t=null,n=-1;for(let r of Bt){let i=e.indexOf(` ${r} `);if(i!==-1){t=r,n=i;break}}if(t===null||n<0)return null;let r=e.slice(0,n).trim(),i=e.slice(n+t.length+2).trim();if(!r||!i)return null;let a=tn(r,i);return a===void 0?null:{dimension:r,op:t,value:a}}function tn(e,t){return e===`duration`||e===`duration_ms`?Zt(t):t===`true`?!0:t===`false`?!1:t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):/^-?\d+(\.\d+)?$/.test(t)?Number(t):t}function nn(e,t){return rn(e,t)}function rn(e,t){if(e===`duration`||e===`duration_ms`){let e=typeof t==`number`?t:Number(t);return Number.isFinite(e)?e>=6e4&&e%6e4==0?`${e/6e4}m`:e>=1e3&&e%1e3==0?`${e/1e3}s`:`${e}ms`:String(t)}return typeof t==`string`&&/\s/.test(t)?`"${t}"`:String(t)}function an(e,t){let n=Qt(e,t.dimension);if(n==null)return t.op===`!=`;let r=t.value;if(t.op===`=`)return on(n,r);if(t.op===`!=`)return!on(n,r);let i=Q(n),a=Q(r);return i===void 0||a===void 0?!1:t.op===`>`?i>a:t.op===`<`?i<a:t.op===`>=`?i>=a:t.op===`<=`&&i<=a}function on(e,t){if(typeof e==`number`||typeof t==`number`){let n=Q(e),r=Q(t);if(n!==void 0&&r!==void 0)return n===r}return String(e)===String(t)}function Q(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`boolean`)return;let t=Number(e);return Number.isFinite(t)?t:void 0}var sn=new Set(Object.keys(j));function cn(e){if(e.startsWith(`flow:`))return{kind:`flow`,flowId:e.slice(5)};if(e.startsWith(`signal:`))return{kind:`signal`,signal:e.slice(7)};if(e.startsWith(`unit:`))return{kind:`unit`,unit:e.slice(5)};if(e.startsWith(`element:`)){let t=e.slice(8);return sn.has(t)?{kind:`element`,element:t}:null}if(e.startsWith(`type:`)){let t=e.slice(5).split(`:`)[0];return t&&sn.has(t)?{kind:`element`,element:t}:null}return e.startsWith(`sql:`)||e.startsWith(`kv:`)||e.startsWith(`files:`)||e.startsWith(`index:`)||e.startsWith(`vault:`)||e.startsWith(`channel:`)||e.startsWith(`gate:`)||e.startsWith(`clock:`)||e.startsWith(`ai:`)?{kind:`resource`,nodeId:e}:null}function ln(e){switch(e.kind){case`flow`:return e.flowId;case`signal`:return`signal:${e.signal}`;case`unit`:return e.unit;case`element`:return j[e.element].label;case`resource`:return e.nodeId}}function un(e,t){return t?.kind===`flow`?Z(e,{dimension:`flow`,op:`=`,value:t.flowId}):t?.kind===`unit`?Z(e,{dimension:`unit`,op:`=`,value:t.unit}):e}function dn(e,t,n){if(t.kind===`flow`)return Yt(e,{clauses:[{dimension:`flow`,op:`=`,value:t.flowId}]});if(t.kind===`unit`)return(e.unit??L(e.flow))===t.unit;if(t.kind===`element`)return t.element===`flow`||Je(e).includes(t.element);if(t.kind===`resource`)return fn(e,t.nodeId,n);let r=n?.flows??{};for(let[n,i]of Object.entries(r))if(n===e.flow&&(i.trigger?.signal===t.signal||i.effects?.emits?.includes(t.signal)))return!0;return!1}function fn(e,t,n){let r=t.includes(`:`)?t.slice(t.indexOf(`:`)+1):t;if(e.effects.some(e=>e.resource===t||e.resource===r)||e.gates.some(e=>t===`gate:${e}`))return!0;let i=n?.flows?.[e.flow];return!!(i&&zt(i,e.flow,t))}function pn(e,t,n){return t?e.filter(e=>dn(e,t,n)):[...e]}function mn(e){return e?e.kind===`unit`||e.kind===`flow`||e.kind===`resource`?e:e.kind===`signal`?{kind:`resource`,nodeId:`signal:${e.signal}`}:null:null}function hn({manifest:e,runs:t=[],graphFilter:n,highlightedFlowIds:r,highlightedNodeIds:i,follow:a,activeNodeId:o=null,focusedNodeId:s=null,orchestraLabel:c=null,onNodeClick:l,onPaneClick:u}){let{fitView:d}=E(),{theme:f}=ue(),[p,m]=(0,R.useState)(null),h=f===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:f,g=mn(n),_=n?.kind===`element`?n.element:null,v=g===null,y=(0,R.useMemo)(()=>at(e,t,_?{kind:`element`,element:_}:null),[e,t,_]),b=(0,R.useMemo)(()=>ze(!g||!e?e:Rt(e,g)),[e,g]),x=(0,R.useMemo)(()=>ft(y.nodes,y.edges,{hoverNodeId:p,highlightedFlowIds:r,highlightedNodeIds:i,manifest:e}),[y.nodes,y.edges,p,r,i,e]),S=(0,R.useMemo)(()=>Le(b.nodes,r,i,{activeNodeId:o,focusedNodeId:s}),[b.nodes,r,i,o,s]),C=(0,R.useMemo)(()=>Ie(b.edges,S),[b.edges,S]),w=v?x.nodes:S,O=v?x.edges:C;return(0,R.useEffect)(()=>{d({duration:280,padding:.18})},[v,n,e,d]),(0,R.useEffect)(()=>{if(!a||v||r.size===0)return;let e=[...r].map(e=>`flow:${e}`);d({nodes:e.map(e=>({id:e})),duration:300,padding:.2})},[a,v,r,d]),(0,G.jsxs)(`div`,{className:`relative h-full w-full`,children:[n?(0,G.jsxs)(`button`,{type:`button`,"data-slot":`flow-graph-map`,onClick:()=>u?.(),className:`absolute top-2 left-2 z-10 inline-flex max-w-[min(100%-1rem,20rem)] items-center gap-1.5 truncate rounded-md border border-border/70 bg-card/90 px-2 py-1 text-[10px] font-medium text-muted-foreground shadow-sm backdrop-blur-sm transition-colors hover:border-border hover:text-foreground`,children:[(0,G.jsx)(`span`,{className:`text-foreground`,children:`Map`}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,G.jsx)(`span`,{className:`truncate`,children:ln(n)})]}):(0,G.jsx)(`div`,{className:`pointer-events-none absolute top-2 left-2 z-10 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:c?(0,G.jsxs)(G.Fragment,{children:[`Orchestra `,(0,G.jsx)(`span`,{className:`text-foreground normal-case`,children:c})]}):`Hover a unit — spokes light the elements it touches`}),(0,G.jsxs)(T,{nodes:w,edges:O,nodeTypes:Lt,colorMode:h,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,proOptions:{hideAttribution:!0},minZoom:.15,maxZoom:1.6,defaultEdgeOptions:{type:`smoothstep`,zIndex:I.edge},zIndexMode:`manual`,onNodeClick:(e,t)=>l?.(t.id),onPaneClick:()=>u?.(),onNodeMouseEnter:(e,t)=>m(t.id),onNodeMouseLeave:()=>m(null),children:[(0,G.jsx)(te,{gap:24,size:1,color:`color-mix(in oklab, var(--foreground) 14%, transparent)`}),(0,G.jsx)(ee,{showInteractive:!1}),(0,G.jsx)(D,{pannable:!0,zoomable:!0,ariaLabel:`Flow graph overview`,bgColor:`var(--card)`,maskColor:`color-mix(in oklab, var(--background) 55%, transparent)`,nodeColor:gn,nodeStrokeColor:_n,nodeStrokeWidth:12,nodeBorderRadius:10})]})]})}function gn(e){if(e.type===`orbit`)return`transparent`;let t=e.data.kind;if(t===`law`)return`color-mix(in oklab, var(--foreground) 45%, transparent)`;if(t===`unit`)return`color-mix(in oklab, var(--foreground) 8%, transparent)`;if(t===`element`){let t=e.data.refId;return F[t]?.accent??`#64748B`}return t in F?F[t].accent:`#64748B`}function _n(e){return e.data.kind===`unit`?`color-mix(in oklab, var(--foreground) 32%, transparent)`:`transparent`}function vn(e){let{leading:t,...n}=e;return(0,G.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,"data-slot":`flow-graph`,children:[t?(0,G.jsxs)(`header`,{className:p,children:[t,(0,G.jsx)(`span`,{className:`w-px shrink-0 self-stretch bg-border/60`,"aria-hidden":!0})]}):null,(0,G.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,G.jsx)(k,{children:(0,G.jsx)(hn,{...n})})})]})}var yn=`orch-`;function bn(e){return e.startsWith(yn)}function xn(e,t){return e&&t}function Sn(e,t=Math.random){let n=e.filter(e=>!bn(e.id)&&e.flow.length>0);return n.length===0?null:n[Math.floor(t()*n.length)]??null}function Cn(e,t,n){let r=t-e.startedAt,i=e.flow.replaceAll(`.`,`-`);return{...e,id:`${yn}${n}-${i}`,parentId:null,startedAt:t,endedAt:t+e.durationMs,effects:e.effects.map(e=>({...e,timestamp:e.timestamp+r})),logs:e.logs.map(e=>({...e,at:e.at+r}))}}function wn(e=Math.random){return 1800+Math.floor(e()*1600)}var Tn=1400;function En(e){let t=s(),[n,r]=(0,R.useState)(null),i=(0,R.useRef)(0),a=(0,R.useRef)(null),o=(0,R.useRef)(null),c=(0,R.useRef)(e.paused);return c.current=e.paused,(0,R.useEffect)(()=>{if(!xn(!1,e.enabled))return;let n=()=>{a.current&&=(clearTimeout(a.current),null)},s=()=>{if(c.current||document.hidden)return;let e=Sn(t.getQueryData(Oe)??[]);if(!e)return;i.current+=1;let o=Cn(e,Date.now(),i.current);t.setQueryData(Oe,e=>De(e??[],o)),r({flowId:o.flow,runId:o.id}),n(),a.current=setTimeout(()=>{r(null),a.current=null},Tn)},l=e=>{o.current=setTimeout(()=>{s(),l(wn())},e)};l(700);let u=()=>{document.hidden&&(r(null),n())};return document.addEventListener(`visibilitychange`,u),()=>{document.removeEventListener(`visibilitychange`,u),o.current&&clearTimeout(o.current),n(),r(null)}},[e.enabled,t]),e.paused?null:n}function Dn(e,t){let n=new Set;if(!t)return n;let r=new Map,i=new Map;for(let t of e)r.set(t.id,t);for(let t of e){if(!t.parentId)continue;let e=i.get(t.parentId)??[];e.push(t),i.set(t.parentId,e)}let a=r.get(t);if(!a)return n;let o=a,s=new Set;for(;o&&!s.has(o.id);)s.add(o.id),n.add(o.flow),o=o.parentId?r.get(o.parentId):void 0;let c=[a];for(;c.length>0;){let e=c.shift();if(!e)break;for(let t of i.get(e.id)??[])s.has(t.id)||(s.add(t.id),n.add(t.flow),c.push(t))}return n}var On=[{id:`signal`,label:`Signal`,expr:`trigger = signal`},{id:`clock`,label:`Clock`,expr:`trigger = cron`},{id:`cache-miss`,label:`Cache miss`,expr:`cache = miss`},{id:`slow`,label:`Slow`,expr:`duration > 100ms`}],kn=`h-7 min-w-0 rounded-none border-0 bg-transparent px-0 font-mono text-[11px] text-foreground shadow-none outline-none focus-visible:ring-0 dark:bg-transparent`,$=`rounded-none border-0 bg-transparent px-1.5 py-1 text-[11px] text-foreground/70 shadow-none transition-colors hover:bg-muted/50 hover:text-foreground`,An=`grid grid-cols-[minmax(0,1fr)_1.25rem_minmax(0,1fr)_1.25rem] items-center gap-x-1`;function jn({query:e,runs:t,onChange:n}){let i=(0,R.useMemo)(()=>$t(t),[t]),a=(0,R.useMemo)(()=>[...new Set([...Ht,...i])].sort(),[i]),[o,s]=(0,R.useState)(`trigger`),[c,l]=(0,R.useState)(`=`),[u,d]=(0,R.useState)(`signal`),[f,p]=(0,R.useState)(!1),m=()=>{let t=Ut(`${o} ${c} ${u}`).clauses[0];t&&(n(Z(e,t)),p(!1))};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-border/60 px-2 py-1.5`,"data-slot":`traces-advanced-filters`,children:[e.clauses.length>0?(0,G.jsx)(`ul`,{"aria-label":`Active filters`,className:`flex flex-col gap-0.5`,children:e.clauses.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Mn,{clause:t,onRemove:()=>n(Wt(e,t.dimension))})},t.dimension))}):null,f?(0,G.jsxs)(`div`,{className:An,"data-slot":`traces-advanced-composer`,children:[(0,G.jsx)(`select`,{"aria-label":`Filter dimension`,className:kn,value:o,onChange:e=>s(e.target.value),children:a.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))}),(0,G.jsx)(`select`,{"aria-label":`Filter operator`,className:y(kn,`text-center text-foreground/70`),value:c,onChange:e=>l(e.target.value),children:[`=`,`!=`,`>`,`<`,`>=`,`<=`].map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))}),(0,G.jsx)(r,{"aria-label":`Filter value`,flat:!0,className:`h-7 px-0 font-mono text-[11px]`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,G.jsx)(`button`,{type:`button`,className:$,onClick:m,children:`Add`})]}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[On.map(t=>{let r=Ut(t.expr).clauses[0],i=r!==void 0&&Kt(e,r);return(0,G.jsx)(`button`,{type:`button`,"aria-pressed":i,disabled:r===void 0,onClick:()=>{r&&n(qt(e,r))},className:y($,i?`font-medium text-foreground`:`text-foreground/70`),children:t.label},t.id)}),(0,G.jsx)(`button`,{type:`button`,"aria-expanded":f,className:y($,`ml-auto`,f&&`text-foreground`),onClick:()=>p(e=>!e),children:f?`Cancel`:`Add clause`}),e.clauses.length>0?(0,G.jsx)(`button`,{type:`button`,className:$,onClick:()=>n(Ut(``)),children:`Clear`}):null]})]})}function Mn({clause:e,onRemove:t}){let r=Jt(e);return(0,G.jsxs)(`div`,{className:An,"data-slot":`traces-advanced-clause`,children:[(0,G.jsx)(`span`,{className:`truncate font-mono text-[11px] text-foreground/80`,children:e.dimension}),(0,G.jsx)(`span`,{className:`text-center font-mono text-[11px] text-foreground/65`,"aria-hidden":!0,children:e.op}),(0,G.jsx)(`span`,{className:`truncate font-mono text-[11px] text-foreground`,children:nn(e.dimension,e.value)}),(0,G.jsx)(`button`,{type:`button`,className:y($,`flex size-5 items-center justify-center text-foreground/55 hover:text-destructive`),"aria-label":`Remove ${r}`,onClick:t,children:(0,G.jsx)(u,{icon:n,className:`size-3`})})]})}var Nn={query:``,status:`all`,advanced:Vt};function Pn(e,t){let n=t.trim().toLowerCase();return!n||[e.flow,e.unit??``,e.trigger,e.cache,e.id,e.error??``,e.errorMessage??``].some(e=>e.toLowerCase().includes(n))}function Fn(e,t){return Xt(e.filter(e=>!(!Pn(e,t.query)||t.status===`errors`&&e.error===null)),t.advanced)}function In(e,t=Date.now()){let n=t-e;return n<1e3?`just now`:n<6e4?`${Math.floor(n/1e3)}s ago`:n<36e5?`${Math.floor(n/6e4)}m ago`:`${Math.floor(n/36e5)}h ago`}function Ln(e,t=Date.now()){let n=In(e.startedAt,t),r=e.error!==null;return{text:n,title:r?e.errorMessage?`${e.error} — ${e.errorMessage}`:e.error??n:n,failed:r}}function Rn({run:e,selected:t,onSelect:n,copyText:r=async e=>{await navigator.clipboard.writeText(e)}}){let s=Ln(e),d=s.failed,f=oe(e.trigger),p=e.cache,[m,h]=(0,R.useState)(null),g=async t=>{t.stopPropagation();try{await r(ce(e)),h(`Copied run id`)}catch{h(`Copy failed`)}};return(0,G.jsxs)(`div`,{"data-slot":`trace-row`,"data-run-id":e.id,"data-selected":t?`true`:`false`,"data-failed":d?`true`:`false`,"data-cache":e.cache,className:y(`group relative flex w-full items-stretch border-b border-border/60 text-xs transition-colors`,`hover:bg-muted/50 focus-within:bg-muted/50`,t&&`bg-muted/70`,d&&`bg-destructive/[0.04]`),children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:y(`absolute inset-y-0 left-0 w-0.5`,t&&!d&&`bg-sky-500`,d&&`bg-destructive`)}),(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>n(e.id),className:`flex min-w-0 flex-1 items-center gap-2 py-1.5 pr-1 pl-0 text-left outline-none`,children:[(0,G.jsx)(`span`,{className:y(`ml-2.5 size-1.5 shrink-0 rounded-full`,d?`bg-destructive`:`bg-emerald-500`),"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,title:f.label,"aria-hidden":!0,children:(0,G.jsx)(u,{icon:f.icon,className:`size-3.5`})}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:e.flow}),(0,G.jsx)(Ve,{cache:p,dataSlot:`trace-row-cache`}),(0,G.jsx)(`span`,{className:y(`w-10 shrink-0 text-right tabular-nums font-medium`,re(e.durationMs)),children:Ee(e.durationMs)}),(0,G.jsx)(`span`,{className:`w-14 shrink-0 truncate text-right tabular-nums text-muted-foreground`,title:s.title,"data-slot":`trace-row-meta`,children:s.text})]}),(0,G.jsx)(`div`,{className:y(`flex shrink-0 items-center gap-0.5 pr-1.5 opacity-0 transition-opacity`,`group-hover:opacity-100 group-focus-within:opacity-100`,m&&`opacity-100`),children:(0,G.jsxs)(i,{children:[(0,G.jsx)(c,{render:e=>(0,G.jsx)(l,{...e,type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Copy run ID`,"data-slot":`trace-copy-id`,onClick:t=>{e.onClick?.(t),g(t)},children:(0,G.jsx)(u,{icon:o,className:`size-3`})})}),(0,G.jsx)(a,{side:`top`,children:`Copy run ID`})]})}),m?(0,G.jsx)(`span`,{className:`sr-only`,role:`status`,children:m}):null]})}var zn=[{value:`all`,label:`All`,icon:h},{value:`errors`,label:`Errors`,icon:t}];function Bn({runs:e,selectedRunId:t,onSelect:n,liveStatus:r,manifest:o,graphFilter:s,onGraphFilterChange:l,focusEffectIndex:m,onFocusEffectChange:h,playbackKey:g,onReplayStart:S,selectedRun:C}){let[w,T]=(0,R.useState)(Nn),[E,D]=(0,R.useState)(!1);(0,R.useEffect)(()=>{(s?.kind===`flow`||s?.kind===`unit`)&&T(e=>({...e,advanced:un(e.advanced,s)}))},[s]);let O=(0,R.useMemo)(()=>pn(Fn(e,w),s,o),[e,w,s,o]),ee=(0,R.useMemo)(()=>C===void 0?t?e.find(e=>e.id===t)??null:null:C,[C,e,t]),k=w.advanced.clauses.length>0,te=e=>{T(t=>({...t,query:e}))},A=e=>{T(t=>({...t,status:e}))};return(0,G.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-slot":`traces-pane`,children:[(0,G.jsxs)(`div`,{className:`shrink-0 border-b border-border/60`,children:[(0,G.jsxs)(`div`,{className:y(b,`border-b-0`),children:[(0,G.jsx)(Ce,{value:w.query,onChange:e=>te(e.target.value),placeholder:`Search traces…`,"aria-label":`Search traces`,"data-slot":`traces-search`}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-stretch pr-0.5`,children:[e.length>0?(0,G.jsxs)(i,{children:[(0,G.jsx)(c,{render:e=>(0,G.jsxs)(`button`,{...e,type:`button`,"aria-expanded":E,"aria-controls":`traces-advanced-panel`,"aria-label":k?`Advanced filters, ${w.advanced.clauses.length} active`:`Advanced filters`,"data-slot":`traces-advanced-toggle`,onClick:t=>{e.onClick?.(t),D(e=>!e)},className:y(_,`relative`,(E||k)&&`text-foreground`),children:[(0,G.jsx)(u,{icon:f,className:`size-3`,"aria-hidden":!0}),k?(0,G.jsx)(`span`,{className:`absolute -top-0.5 -inset-e-0.5 flex size-3.5 items-center justify-center rounded-full bg-foreground text-[8px] font-medium text-background`,"aria-hidden":!0,children:w.advanced.clauses.length}):null]})}),(0,G.jsx)(a,{side:`bottom`,children:`Advanced`})]}):null,e.length>0?(0,G.jsx)(`span`,{className:`mx-0.5 h-3 w-px bg-border/60`,"aria-hidden":!0}):null,(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 pr-0.5 text-[10px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:r===`open`?`size-1.5 rounded-full bg-emerald-500`:`size-1.5 rounded-full bg-muted-foreground`,"aria-hidden":!0}),r===`open`?`live`:`polling`]})]})]}),e.length>0?(0,G.jsx)(`div`,{className:y(p,`border-t border-b-0`),"data-slot":`traces-filters`,children:(0,G.jsx)(`div`,{className:`flex shrink-0 items-stretch`,role:`group`,"aria-label":`Status filter`,children:zn.map(({value:e,label:t,icon:n})=>{let r=w.status===e;return(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>A(e),className:y(v,`font-semibold tracking-[0.08em] uppercase`,r?e===`errors`?`text-destructive`:d:x),children:[(0,G.jsx)(u,{icon:n,className:`size-3`,"aria-hidden":!0}),t]},e)})})}):null,e.length>0&&s?(0,G.jsxs)(`button`,{type:`button`,"data-slot":`traces-graph-filter`,onClick:()=>l(null),title:`Clear graph filter`,className:`mx-2 mb-1.5 inline-flex max-w-full items-center gap-1 self-start truncate rounded-md border border-sky-500/40 bg-sky-500/10 px-2 py-0.5 text-[10px] font-medium text-sky-700 transition-colors hover:bg-sky-500/20 dark:text-sky-400`,children:[(0,G.jsx)(`span`,{className:`truncate`,children:ln(s)}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`×`})]}):null]}),e.length>0?(0,G.jsx)(He,{id:`traces-advanced-panel`,role:`region`,"aria-label":`Advanced filters`,open:E,className:`shrink-0`,children:(0,G.jsx)(jn,{query:w.advanced,runs:e,onChange:e=>{T(t=>({...t,advanced:e}))}})}):null,(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:e.length===0?(0,G.jsx)(pe,{className:`border-none`,children:(0,G.jsxs)(Se,{children:[(0,G.jsx)(me,{variant:`icon`,children:(0,G.jsx)(u,{icon:j.flow.icon})}),(0,G.jsx)(ve,{children:`No traces yet`}),(0,G.jsx)(be,{children:`No runs for the flows on this graph yet. Trigger a flow to see live activity here.`})]})}):O.length===0?(0,G.jsx)(pe,{className:`border-none`,children:(0,G.jsxs)(Se,{children:[(0,G.jsx)(ve,{children:`No matching traces`}),(0,G.jsx)(be,{children:`Nothing in this list matches the current search, status, or advanced filters.`})]})}):O.map(e=>(0,G.jsx)(Rn,{run:e,selected:e.id===t,onSelect:e=>n(e===t?null:e)},e.id))}),(0,G.jsx)(le,{run:ee,onClose:()=>n(null),focusEffectIndex:m,onFocusEffectChange:h,playbackKey:g,onReplayStart:S})]})}function Vn(){let e=Te(),t=ke(),n=we(!0),{selectedRunId:r,selectedFlowId:i,follow:a,setSelectedRun:o,setSelectedFlow:s}=fe(),c=he(),l=(0,G.jsx)(ge,{open:c.open,onToggle:c.toggle,noun:`traces`,controlsId:`overview-traces`,dataSlot:`overview-traces-toggle`}),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)(null),[h,_]=(0,R.useState)(0),[v,y]=(0,R.useState)(null),b=(0,R.useRef)(null),x=(0,R.useMemo)(()=>new Set(Object.keys(e.data?.flows??{})),[e.data]),S=(0,R.useMemo)(()=>Re(t.data??[],x),[t.data,x]),C=En({enabled:!!e.data&&S.length>0,paused:r!=null||u!=null});(0,R.useEffect)(()=>{i&&d(e=>e?.kind===`flow`&&e.flowId===i?e:{kind:`flow`,flowId:i})},[i]);let w=(0,R.useCallback)(e=>{d(e),e?.kind===`flow`?s(e.flowId):s(null)},[s]),T=(0,R.useMemo)(()=>{let e=Dn(t.data??[],r);return e.size>0?e:i?new Set([i]):C?.flowId?new Set([C.flowId]):e},[t.data,r,i,C?.flowId]),E=(0,R.useMemo)(()=>{let t=new Set,n=e.data?.flows??{};for(let e of T){let r=n[e];if(r){r.trigger?.signal&&t.add(`signal:${r.trigger.signal}`),(r.trigger?.cron||r.trigger?.every)&&t.add(`clock:${e}`);for(let e of r.gates??[])t.add(`gate:${e}`);for(let e of r.effects?.reads??[])t.add(e);for(let e of r.effects?.writes??[])t.add(e);for(let e of r.effects?.emits??[])t.add(`signal:${e}`);for(let e of r.effects?.sends??[])t.add(`channel:${e}`);for(let e of r.effects?.asks??[])t.add(`ai:${e}`);for(let e of r.effects?.secrets??[])t.add(`vault:${e}`)}}return t},[T,e.data]),D=(0,R.useMemo)(()=>r?t.data?.find(e=>e.id===r)??null:null,[t.data,r]),O=(0,R.useCallback)(e=>{let t=cn(e);t&&w(u&&u.kind===t.kind&&JSON.stringify(u)===JSON.stringify(t)?null:t)},[w,u]),ee=(0,R.useCallback)(()=>{w(null)},[w]),k=(0,R.useCallback)(()=>{_(e=>e+1)},[]);return(0,R.useEffect)(()=>{if(h===0||!D)return;let n=se(Dn(t.data??[],D.id),e.data??null);if(n.length===0)return;let r=ie(D.durationMs),i=performance.now();return y(n[0]??null),b.current=setInterval(()=>{let e=Math.min(1,(performance.now()-i)/r);y(ae(n,e)),e>=1&&b.current&&(clearInterval(b.current),b.current=null,setTimeout(()=>y(null),400))},60),()=>{b.current&&=(clearInterval(b.current),null),y(null)}},[h,D,t.data,e.data]),(0,G.jsx)(`div`,{className:g,"data-slot":`flows-page`,children:(0,G.jsxs)(_e,{orientation:`horizontal`,className:`min-h-0 flex-1`,children:[(0,G.jsx)(ye,{panelRef:c.panelRef,collapsible:!0,collapsedSize:0,defaultSize:m.start.defaultSize,minSize:m.start.minSize,maxSize:`50%`,onResize:c.onResize,className:`min-h-0`,children:(0,G.jsx)(`div`,{id:`overview-traces`,className:`h-full min-h-0 overflow-hidden`,"data-slot":`overview-traces`,children:(0,G.jsx)(Bn,{runs:S,selectedRunId:r,onSelect:o,liveStatus:n,manifest:e.data??null,graphFilter:u,onGraphFilterChange:w,focusEffectIndex:f,onFocusEffectChange:p,playbackKey:h,onReplayStart:k,selectedRun:D})})}),c.open?(0,G.jsx)(xe,{withHandle:!0}):null,(0,G.jsx)(ye,{defaultSize:m.end.defaultSize,minSize:m.end.minSize,className:`min-h-0`,children:(0,G.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:(0,G.jsx)(vn,{manifest:e.data??null,runs:S,graphFilter:u,highlightedFlowIds:T,highlightedNodeIds:E,orchestraLabel:C?.flowId??null,follow:a,activeNodeId:v,onNodeClick:O,onPaneClick:ee,leading:l})})})]})})}export{Vn as FlowsPage};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Da as r,Do as i,Ta as a,To as o}from"./shortcut-keys-DO4IsVqv.js";import{r as s}from"./react-dom-Bph1y7z7.js";import{A as c}from"./xyflow-D7n4g6go.js";import{r as l,t as u}from"./preload-helper-oH4irX4C.js";var d=t(s(),1),f=500;function p(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[t,...e].slice(0,f);let r=e.slice();return r[n]=t,r}function m(e,t){let n=e;for(let e of t)n=p(n,e);return n}async function h(e,t){let n=await e();n.error||t([...n.data?.runs??[]])}function g(e){let t=e.pollMs??5e3,n=e.reconnectMs??2e3,r=e.setTimeout??setTimeout,i=e.clearTimeout??clearTimeout,a=e.setInterval??setInterval,o=e.clearInterval??clearInterval,s=null,c=null,l=null,u=!0,d=()=>{c!==null&&(o(c),c=null)},f=()=>{c===null&&(c=a(()=>{e.onPoll()},t))},p=()=>{if(u)return;l!==null&&(i(l),l=null);let t=`${e.protocol}//${e.host}/console/live`;s=new e.WebSocket(t),e.setStatus(`connecting`),s.onopen=()=>{u||(e.setStatus(`open`),d())},s.onmessage=t=>{if(!u)try{e.onMessage(JSON.parse(String(t.data)))}catch{}},s.onclose=()=>{u||(e.setStatus(`closed`),f(),l=r(()=>{l=null,u||p()},n))},s.onerror=()=>{s?.close()}};return{start(){u=!1,p()},stop(){u=!0,d(),l!==null&&(i(l),l=null),s?.close(),s=null}}}var _=[`console.manifest.get`];function v(){return o({queryKey:_,queryFn:async()=>{let e=await a();if(e.error)throw Error(e.error.code);return e.data?.manifest??null}})}var y=[`console.runs.list`];function ee(){return o({queryKey:y,queryFn:async()=>{let e=await r();if(e.error)throw Error(e.error.code);return e.data?.runs??[]}})}function te(e){let t=i(),[n,a]=(0,d.useState)(`connecting`);return(0,d.useEffect)(()=>{if(!e)return;let n=e=>{if(e.type===`manifest`){t.setQueryData(_,e.manifest);return}if(e.type===`manifest.diff`){t.setQueryData(_,e.after);return}if(e.type===`run`){t.setQueryData(y,t=>p(t??[],e.run));return}if(e.type===`runs.batch`){t.setQueryData(y,t=>m(t??[],e.runs));return}},i=window.location.protocol===`https:`?`wss:`:`ws:`,o=g({WebSocket:globalThis.WebSocket,host:window.location.host,protocol:i,setStatus:a,onMessage:n,onPoll:()=>{h(r,e=>{t.setQueryData(y,e)})}});return o.start(),()=>{o.stop()}},[e,t]),n}function ne(e){if(!Number.isFinite(e)||e<0)return`0μs`;if(e<1)return`${Math.round(e*1e3)}μs`;if(e<1e3){let t=Math.round(e*10)/10;return Number.isInteger(t)?`${t}ms`:`${t.toFixed(1)}ms`}let t=e/1e3,n=Math.round(t*10)/10;return Number.isInteger(n)?`${n}s`:`${n.toFixed(1)}s`}function re(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ie=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ae=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oe={};function se(e,t){return((t||oe).jsx?ae:ie).test(e)}var ce=/[ \t\n\f\r]/g;function le(e){return typeof e==`object`?e.type===`text`&&ue(e.value):ue(e)}function ue(e){return e.replace(ce,``)===``}var de=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};de.prototype.normal={},de.prototype.property={},de.prototype.space=void 0;function fe(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new de(n,r,t)}function pe(e){return e.toLowerCase()}var b=class{constructor(e,t){this.attribute=t,this.property=e}};b.prototype.attribute=``,b.prototype.booleanish=!1,b.prototype.boolean=!1,b.prototype.commaOrSpaceSeparated=!1,b.prototype.commaSeparated=!1,b.prototype.defined=!1,b.prototype.mustUseProperty=!1,b.prototype.number=!1,b.prototype.overloadedBoolean=!1,b.prototype.property=``,b.prototype.spaceSeparated=!1,b.prototype.space=void 0;var me=e({boolean:()=>x,booleanish:()=>S,commaOrSpaceSeparated:()=>E,commaSeparated:()=>T,number:()=>C,overloadedBoolean:()=>ge,spaceSeparated:()=>w}),he=0,x=D(),S=D(),ge=D(),C=D(),w=D(),T=D(),E=D();function D(){return 2**++he}var _e=Object.keys(me),ve=class extends b{constructor(e,t,n,r){let i=-1;if(super(e,t),ye(this,`space`,r),typeof n==`number`)for(;++i<_e.length;){let e=_e[i];ye(this,_e[i],(n&me[e])===me[e])}}};ve.prototype.defined=!0;function ye(e,t,n){n&&(e[t]=n)}function be(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ve(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[pe(r)]=r,n[pe(a.attribute)]=r}return new de(t,n,e.space)}var xe=be({properties:{ariaActiveDescendant:null,ariaAtomic:S,ariaAutoComplete:null,ariaBusy:S,ariaChecked:S,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:w,ariaCurrent:null,ariaDescribedBy:w,ariaDetails:null,ariaDisabled:S,ariaDropEffect:w,ariaErrorMessage:null,ariaExpanded:S,ariaFlowTo:w,ariaGrabbed:S,ariaHasPopup:null,ariaHidden:S,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:w,ariaLevel:C,ariaLive:null,ariaModal:S,ariaMultiLine:S,ariaMultiSelectable:S,ariaOrientation:null,ariaOwns:w,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:S,ariaReadOnly:S,ariaRelevant:null,ariaRequired:S,ariaRoleDescription:w,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:S,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Se(e,t){return t in e?e[t]:t}function Ce(e,t){return Se(e,t.toLowerCase())}var we=be({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:T,acceptCharset:w,accessKey:w,action:null,allow:null,allowFullScreen:x,allowPaymentRequest:x,allowUserMedia:x,alpha:x,alt:null,as:null,async:x,autoCapitalize:null,autoComplete:w,autoFocus:x,autoPlay:x,blocking:w,capture:null,charSet:null,checked:x,cite:null,className:w,closedBy:null,colorSpace:null,cols:C,colSpan:C,command:null,commandFor:null,content:null,contentEditable:S,controls:x,controlsList:w,coords:C|T,crossOrigin:null,data:null,dateTime:null,decoding:null,default:x,defer:x,dir:null,dirName:null,disabled:x,download:ge,draggable:S,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:x,formTarget:null,headers:w,height:C,hidden:ge,high:C,href:null,hrefLang:null,htmlFor:w,httpEquiv:w,id:null,imageSizes:null,imageSrcSet:null,inert:x,inputMode:null,integrity:null,is:null,isMap:x,itemId:null,itemProp:w,itemRef:w,itemScope:x,itemType:w,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:x,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:x,muted:x,name:null,nonce:null,noModule:x,noValidate:x,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:x,optimum:C,pattern:null,ping:w,placeholder:null,playsInline:x,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:x,referrerPolicy:null,rel:w,required:x,reversed:x,rows:C,rowSpan:C,sandbox:w,scope:null,scoped:x,seamless:x,selected:x,shadowRootClonable:x,shadowRootCustomElementRegistry:x,shadowRootDelegatesFocus:x,shadowRootMode:null,shadowRootSerializable:x,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:S,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:x,useMap:null,value:S,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:w,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:x,declare:x,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:x,noHref:x,noShade:x,noWrap:x,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:S,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:x,disablePictureInPicture:x,disableRemotePlayback:x,exportParts:T,part:w,prefix:null,property:null,results:C,security:null,unselectable:null},space:`html`,transform:Ce}),Te=be({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`,maskType:`mask-type`,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:E,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:w,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:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:x,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,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:T,g2:T,glyphName:T,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:E,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,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:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:w,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:E,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:E,rev:E,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:E,requiredFeatures:E,requiredFonts:E,requiredFormats:E,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:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:E,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:E,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:E,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Se}),Ee=be({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()}}),De=be({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Ce}),Oe=be({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ke={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`},Ae=/[A-Z]/g,je=/-[a-z]/g,Me=/^data[-\w.:]+$/i;function Ne(e,t){let n=pe(t),r=t,i=b;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Me.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(je,Fe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!je.test(e)){let n=e.replace(Ae,Pe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ve}return new i(r,t)}function Pe(e){return`-`+e.toLowerCase()}function Fe(e){return e.charAt(1).toUpperCase()}var Ie=fe([xe,we,Ee,De,Oe],`html`),Le=fe([xe,Te,Ee,De,Oe],`svg`);function Re(e){return e.join(` `).trim()}var ze=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
1
+ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{Ea as r,Eo as i,Oa as a,Oo as o}from"./shortcut-keys-CoqwEIi0.js";import{r as s}from"./react-dom-Bph1y7z7.js";import{A as c}from"./xyflow-D7n4g6go.js";import{r as l,t as u}from"./preload-helper-oH4irX4C.js";var d=t(s(),1),f=500;function p(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[t,...e].slice(0,f);let r=e.slice();return r[n]=t,r}function m(e,t){let n=e;for(let e of t)n=p(n,e);return n}async function h(e,t){let n=await e();n.error||t([...n.data?.runs??[]])}function g(e){let t=e.pollMs??5e3,n=e.reconnectMs??2e3,r=e.setTimeout??setTimeout,i=e.clearTimeout??clearTimeout,a=e.setInterval??setInterval,o=e.clearInterval??clearInterval,s=null,c=null,l=null,u=!0,d=()=>{c!==null&&(o(c),c=null)},f=()=>{c===null&&(c=a(()=>{e.onPoll()},t))},p=()=>{if(u)return;l!==null&&(i(l),l=null);let t=`${e.protocol}//${e.host}/console/live`;s=new e.WebSocket(t),e.setStatus(`connecting`),s.onopen=()=>{u||(e.setStatus(`open`),d())},s.onmessage=t=>{if(!u)try{e.onMessage(JSON.parse(String(t.data)))}catch{}},s.onclose=()=>{u||(e.setStatus(`closed`),f(),l=r(()=>{l=null,u||p()},n))},s.onerror=()=>{s?.close()}};return{start(){u=!1,p()},stop(){u=!0,d(),l!==null&&(i(l),l=null),s?.close(),s=null}}}var _=[`console.manifest.get`];function v(){return i({queryKey:_,queryFn:async()=>{let e=await r();if(e.error)throw Error(e.error.code);return e.data?.manifest??null}})}var y=[`console.runs.list`];function ee(){return i({queryKey:y,queryFn:async()=>{let e=await a();if(e.error)throw Error(e.error.code);return e.data?.runs??[]}})}function te(e){let t=o(),[n,r]=(0,d.useState)(`connecting`);return(0,d.useEffect)(()=>{if(!e)return;let n=e=>{if(e.type===`manifest`){t.setQueryData(_,e.manifest);return}if(e.type===`manifest.diff`){t.setQueryData(_,e.after);return}if(e.type===`run`){t.setQueryData(y,t=>p(t??[],e.run));return}if(e.type===`runs.batch`){t.setQueryData(y,t=>m(t??[],e.runs));return}},i=window.location.protocol===`https:`?`wss:`:`ws:`,o=g({WebSocket:globalThis.WebSocket,host:window.location.host,protocol:i,setStatus:r,onMessage:n,onPoll:()=>{h(a,e=>{t.setQueryData(y,e)})}});return o.start(),()=>{o.stop()}},[e,t]),n}function ne(e){if(!Number.isFinite(e)||e<0)return`0μs`;if(e<1)return`${Math.round(e*1e3)}μs`;if(e<1e3){let t=Math.round(e*10)/10;return Number.isInteger(t)?`${t}ms`:`${t.toFixed(1)}ms`}let t=e/1e3,n=Math.round(t*10)/10;return Number.isInteger(n)?`${n}s`:`${n.toFixed(1)}s`}function re(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ie=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ae=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oe={};function se(e,t){return((t||oe).jsx?ae:ie).test(e)}var ce=/[ \t\n\f\r]/g;function le(e){return typeof e==`object`?e.type===`text`&&ue(e.value):ue(e)}function ue(e){return e.replace(ce,``)===``}var de=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};de.prototype.normal={},de.prototype.property={},de.prototype.space=void 0;function fe(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new de(n,r,t)}function pe(e){return e.toLowerCase()}var b=class{constructor(e,t){this.attribute=t,this.property=e}};b.prototype.attribute=``,b.prototype.booleanish=!1,b.prototype.boolean=!1,b.prototype.commaOrSpaceSeparated=!1,b.prototype.commaSeparated=!1,b.prototype.defined=!1,b.prototype.mustUseProperty=!1,b.prototype.number=!1,b.prototype.overloadedBoolean=!1,b.prototype.property=``,b.prototype.spaceSeparated=!1,b.prototype.space=void 0;var me=e({boolean:()=>x,booleanish:()=>S,commaOrSpaceSeparated:()=>E,commaSeparated:()=>T,number:()=>C,overloadedBoolean:()=>ge,spaceSeparated:()=>w}),he=0,x=D(),S=D(),ge=D(),C=D(),w=D(),T=D(),E=D();function D(){return 2**++he}var _e=Object.keys(me),ve=class extends b{constructor(e,t,n,r){let i=-1;if(super(e,t),ye(this,`space`,r),typeof n==`number`)for(;++i<_e.length;){let e=_e[i];ye(this,_e[i],(n&me[e])===me[e])}}};ve.prototype.defined=!0;function ye(e,t,n){n&&(e[t]=n)}function be(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ve(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[pe(r)]=r,n[pe(a.attribute)]=r}return new de(t,n,e.space)}var xe=be({properties:{ariaActiveDescendant:null,ariaAtomic:S,ariaAutoComplete:null,ariaBusy:S,ariaChecked:S,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:w,ariaCurrent:null,ariaDescribedBy:w,ariaDetails:null,ariaDisabled:S,ariaDropEffect:w,ariaErrorMessage:null,ariaExpanded:S,ariaFlowTo:w,ariaGrabbed:S,ariaHasPopup:null,ariaHidden:S,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:w,ariaLevel:C,ariaLive:null,ariaModal:S,ariaMultiLine:S,ariaMultiSelectable:S,ariaOrientation:null,ariaOwns:w,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:S,ariaReadOnly:S,ariaRelevant:null,ariaRequired:S,ariaRoleDescription:w,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:S,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Se(e,t){return t in e?e[t]:t}function Ce(e,t){return Se(e,t.toLowerCase())}var we=be({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:T,acceptCharset:w,accessKey:w,action:null,allow:null,allowFullScreen:x,allowPaymentRequest:x,allowUserMedia:x,alpha:x,alt:null,as:null,async:x,autoCapitalize:null,autoComplete:w,autoFocus:x,autoPlay:x,blocking:w,capture:null,charSet:null,checked:x,cite:null,className:w,closedBy:null,colorSpace:null,cols:C,colSpan:C,command:null,commandFor:null,content:null,contentEditable:S,controls:x,controlsList:w,coords:C|T,crossOrigin:null,data:null,dateTime:null,decoding:null,default:x,defer:x,dir:null,dirName:null,disabled:x,download:ge,draggable:S,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:x,formTarget:null,headers:w,height:C,hidden:ge,high:C,href:null,hrefLang:null,htmlFor:w,httpEquiv:w,id:null,imageSizes:null,imageSrcSet:null,inert:x,inputMode:null,integrity:null,is:null,isMap:x,itemId:null,itemProp:w,itemRef:w,itemScope:x,itemType:w,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:x,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:x,muted:x,name:null,nonce:null,noModule:x,noValidate:x,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:x,optimum:C,pattern:null,ping:w,placeholder:null,playsInline:x,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:x,referrerPolicy:null,rel:w,required:x,reversed:x,rows:C,rowSpan:C,sandbox:w,scope:null,scoped:x,seamless:x,selected:x,shadowRootClonable:x,shadowRootCustomElementRegistry:x,shadowRootDelegatesFocus:x,shadowRootMode:null,shadowRootSerializable:x,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:S,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:x,useMap:null,value:S,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:w,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:x,declare:x,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:x,noHref:x,noShade:x,noWrap:x,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:S,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:x,disablePictureInPicture:x,disableRemotePlayback:x,exportParts:T,part:w,prefix:null,property:null,results:C,security:null,unselectable:null},space:`html`,transform:Ce}),Te=be({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`,maskType:`mask-type`,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:E,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:w,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:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:x,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,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:T,g2:T,glyphName:T,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:E,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,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:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:w,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:E,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:E,rev:E,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:E,requiredFeatures:E,requiredFonts:E,requiredFormats:E,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:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:E,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:E,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:E,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Se}),Ee=be({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()}}),De=be({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Ce}),Oe=be({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ke={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`},Ae=/[A-Z]/g,je=/-[a-z]/g,Me=/^data[-\w.:]+$/i;function Ne(e,t){let n=pe(t),r=t,i=b;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Me.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(je,Fe);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!je.test(e)){let n=e.replace(Ae,Pe);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ve}return new i(r,t)}function Pe(e){return`-`+e.toLowerCase()}function Fe(e){return e.charAt(1).toUpperCase()}var Ie=fe([xe,we,Ee,De,Oe],`html`),Le=fe([xe,Te,Ee,De,Oe],`svg`);function Re(e){return e.join(` `).trim()}var ze=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
2
2
  `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function ee(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function te(){var e=[];v(e);for(var t;t=ee();)t!==!1&&(e.push(t),v(e));return e}return _(),te()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Be=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(ze());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Ve=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),He=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Be()),r=Ve();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Ue=We(`start`);function We(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Ge(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?qe(e.position):`start`in e||`end`in e?qe(e):`line`in e||`column`in e?Ke(e):``}function Ke(e){return Je(e&&e.line)+`:`+Je(e&&e.column)}function qe(e){return Ke(e&&e.start)+`-`+Ke(e&&e.end)}function Je(e){return e&&typeof e==`number`?e:1}var O=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=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=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ge(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=a&&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}};O.prototype.file=``,O.prototype.name=``,O.prototype.reason=``,O.prototype.message=``,O.prototype.stack=``,O.prototype.column=void 0,O.prototype.line=void 0,O.prototype.ancestors=void 0,O.prototype.cause=void 0,O.prototype.fatal=void 0,O.prototype.place=void 0,O.prototype.ruleId=void 0,O.prototype.source=void 0;var Ye=t(He(),1),Xe={}.hasOwnProperty,Ze=new Map,Qe=/[A-Z]/g,$e=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),et=new Set([`td`,`th`]);function tt(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=ft(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=dt(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Le:Ie,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=nt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function nt(e,t,n){if(t.type===`element`)return rt(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return it(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ot(e,t,n);if(t.type===`mdxjsEsm`)return at(e,t);if(t.type===`root`)return st(e,t,n);if(t.type===`text`)return ct(e,t)}function rt(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Le,e.schema=i),e.ancestors.push(t);let a=vt(e,t.tagName,!1),o=pt(e,t),s=ht(e,t);return $e.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!le(e)})),lt(e,o,a,t),ut(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function it(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}yt(e,t.position)}function at(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);yt(e,t.position)}function ot(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Le,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:vt(e,t.name,!0),o=mt(e,t),s=ht(e,t);return lt(e,o,a,t),ut(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function st(e,t,n){let r={};return ut(r,ht(e,t)),e.create(t,e.Fragment,r,n)}function ct(e,t){return t.value}function lt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ut(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function dt(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function ft(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ue(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function pt(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Xe.call(t.properties,i)){let a=gt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&et.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function mt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else yt(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else yt(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function ht(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ze;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=nt(e,a,o);s!==void 0&&n.push(s)}return n}function gt(e,t,n){let r=Ne(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?re(n):Re(n)),r.property===`style`){let t=typeof n==`object`?n:_t(e,String(n));return e.stylePropertyNameCase===`css`&&(t=bt(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?ke[r.property]||r.property:r.attribute,n]}}function _t(e,t){try{return(0,Ye.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new O("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function vt(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=se(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=se(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Xe.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);yt(e)}function yt(e,t){let n=new O("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=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function bt(e){let t={},n;for(n in e)Xe.call(e,n)&&(t[xt(n)]=e[n]);return t}function xt(e){let t=e.replace(Qe,St);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function St(e){return`-`+e.toLowerCase()}var k=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Ct(e){return wt(e)}function wt(e){return Array.isArray(e)?Tt(e):e instanceof RegExp?e:typeof e==`object`?Et(e):e}function Tt(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=wt(e[n]);return t}function Et(e){let t={};for(let n in e)t[n]=wt(e[n]);return t}function Dt(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Ot(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Ot(e.substring(0,e.length-1)):e.substr(~t+1)}var kt=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,At=class{static hasCaptures(e){return e!==null&&(kt.lastIndex=0,kt.test(e))}static replaceCaptures(e,t,n){return e.replace(kt,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function jt(e,t){return e<t?-1:+(e>t)}function Mt(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=jt(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Nt(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Pt(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Ft=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},It=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Vt(e),t)}static createFromParsedTheme(e,t){return Ut(e,t)}_cachedMatchRoot=new Ft(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Rt(e.parent,t.parentScopes));return n?new Bt(n.fontStyle,n.foreground,n.background):null}},Lt=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Rt(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!zt(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function zt(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Bt=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Vt(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&Nt(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Nt(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Ht(l,u,e,o,s,c)}}return n}var Ht=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},A=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(A||{});function Ut(e,t){e.sort((e,t)=>{let n=jt(e.scope,t.scope);return n!==0||(n=Mt(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Wt(t),o=new Bt(n,a.getId(r),a.getId(i)),s=new qt(new Kt(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new It(a,o,s)}var Wt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Gt=Object.freeze([]),Kt=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Gt,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},qt=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Kt.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Mt(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Kt(e,t,n,r,i))}},Jt=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Xt(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Yt(e){return e}function Xt(e){return e}function Zt(e,t){let n=[],r=$t(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Qt(i)){let e=[];do e.push(i),i=r.next();while(Qt(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Qt(e){return!!e&&!!e.match(/[\w\.:]+/)}function $t(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function en(e){typeof e.dispose==`function`&&e.dispose()}var tn=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},nn=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},rn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},an=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new tn(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new rn;for(let n of e)on(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof tn){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function on(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof tn?cn({baseGrammar:a,selfGrammar:i},r):sn(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new tn(e))}function sn(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];ln([r],t,n)}}function cn(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&ln(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&ln(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function ln(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Dt({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&ln(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=hn(i);switch(a.kind){case 0:cn({...t,selfGrammar:t.baseGrammar},n);break;case 1:cn(t,n);break;case 2:sn(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?sn(a.ruleName,i,n):cn(i,n)}else a.kind===4?n.add(new nn(a.scopeName,a.ruleName)):n.add(new tn(a.scopeName))}}}var un=class{kind=0},dn=class{kind=1},fn=class{constructor(e){this.ruleName=e}kind=2},pn=class{constructor(e){this.scopeName=e}kind=3},mn=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function hn(e){if(e===`$base`)return new un;if(e===`$self`)return new dn;let t=e.indexOf(`#`);return t===-1?new pn(e):t===0?new fn(e.substring(1)):new mn(e.substring(0,t),e.substring(t+1))}var gn=/\\(\d+)/,_n=/\\(\d+)/g,vn=-1,yn=-2;function bn(e){return e}function xn(e){return e}var Sn=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=At.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=At.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Ot(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:At.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:At.replaceCaptures(this._contentName,e,t)}},Cn=class extends Sn{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},wn=class extends Sn{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new kn(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new An,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Tn=class extends Sn{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new An,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},En=class extends Sn{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new kn(i,this.id),this.beginCaptures=a,this._end=new kn(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new An;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Dn=class extends Sn{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new kn(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new kn(o,yn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new An;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new An,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},On=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Cn(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new wn(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Dt({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Tn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Dn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new En(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=hn(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Tn||e instanceof En||e instanceof Dn)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},kn=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&gn.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return _n.lastIndex=0,this.source.replace(_n,(e,t)=>Pt(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},An=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new jn(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new jn(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},jn=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
3
3
  `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Mn=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Nn=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Mn(e,8),this._embeddedLanguagesMatcher=new Pn(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Mn(0,0);_getBasicScopeAttributes=new Ft(e=>new Mn(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Pn=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Pt(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Fn=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function In(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Ln(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Fn(i,!0);f()}return new Fn(i,!1);function f(){let o=Rn(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===vn){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Un(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof En){let r=o;Un(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof Dn){let r=o;Un(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Un(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Ln(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof Dn&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Hn(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==yn){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Un(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Rn(e,t,n,r,i,a){let o=zn(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Bn(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function zn(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Vn(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Bn(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Vn(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Vn(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Hn(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Un(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));In(e,p,n&&d.start===0,d.start,f,i,!1,0),en(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Wn(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Wn=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Gn(e,t,n,r,i,a,o,s){return new Yn(e,t,n,r,i,a,o,s)}function Kn(e,t,n,r,i){let a=Zt(t,qn),o=On.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function qn(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Jn(t[r],e))return n=r+1,!0;return!1})}function Jn(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var Yn=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Nn(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Xn(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Zt(e,qn);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Kn(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Kn(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(bn(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[xn(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Xn(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=On.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Qn.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Jt.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Zn.createRootAndLookUpScopeName(a,r,this):Zn.createRoot(`unknown`,r),t=new Qn(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
4
4
  `;let a=this.createOnigString(e),o=a.content.length,s=new er(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=In(this,a,i,0,t,s,!0,r);return en(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Xn(e,t){return e=Ct(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Zn=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Lt.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Lt(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Lt(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Jt.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Qn=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Zn.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:xn(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Zn.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,bn(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Zn.fromExtension(r,n.contentNameScopesList))}},$n=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Zt(e,qn).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Zt(e,qn).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},er=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Jt.set(n,0,Yt(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Jt.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},tr=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,Gn(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},nr=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new tr(It.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(It.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new $n(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new an(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},rr=Qn.NULL,ir=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],ar={}.hasOwnProperty;function or(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&ar.call(t,e)){let n=String(t[e]);i=ar.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var sr=/["&'<>`]/g,cr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,lr=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,ur=/[|\\{}()[\]^$+*?.]/g,dr=new WeakMap;function fr(e,t){if(e=e.replace(t.subset?pr(t.subset):sr,r),t.subset||t.escapeOnly)return e;return e.replace(cr,n).replace(lr,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function pr(e){let t=dr.get(e);return t||(t=mr(e),dr.set(e,t)),t}function mr(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(ur,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var hr=/[\dA-Fa-f]/;function gr(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!hr.test(String.fromCharCode(t))?r:r+`;`}var _r=/\d/;function vr(e,t,n){let r=`&#`+String(e);return n&&t&&!_r.test(String.fromCharCode(t))?r:r+`;`}var yr=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),br={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},xr=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Sr={}.hasOwnProperty,Cr={},wr;for(wr in br)Sr.call(br,wr)&&(Cr[br[wr]]=wr);var Tr=/[^\dA-Za-z]/;function Er(e,t,n,r){let i=String.fromCharCode(e);if(Sr.call(Cr,i)){let e=Cr[i],a=`&`+e;return n&&yr.includes(e)&&!xr.includes(e)&&(!r||t&&t!==61&&Tr.test(String.fromCharCode(t)))?a:a+`;`}return``}function Dr(e,t,n){let r=gr(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Er(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=vr(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Or(e,t){return fr(e,Object.assign({format:Dr},t))}var kr=/^>|^->|<!--|-->|--!>|<!-$/g,Ar=[`>`],jr=[`<`,`>`];function Mr(e,t,n,r){return r.settings.bogusComments?`<?`+Or(e.value,Object.assign({},r.settings.characterReferences,{subset:Ar}))+`>`:`<!--`+e.value.replace(kr,i)+`-->`;function i(e){return Or(e,Object.assign({},r.settings.characterReferences,{subset:jr}))}}function Nr(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Pr(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var j=Lr(1),Fr=Lr(-1),Ir=[];function Lr(e){return t;function t(t,n,r){let i=t?t.children:Ir,a=(n||0)+e,o=i[a];if(!r)for(;o&&le(o);)a+=e,o=i[a];return o}}var Rr={}.hasOwnProperty;function zr(e){return t;function t(t,n,r){return Rr.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Br=zr({body:Ur,caption:Vr,colgroup:Vr,dd:qr,dt:Kr,head:Vr,html:Hr,li:Gr,optgroup:Yr,option:Xr,p:Wr,rp:Jr,rt:Jr,tbody:Qr,td:ti,tfoot:$r,th:ti,thead:Zr,tr:ei});function Vr(e,t,n){let r=j(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&le(r.value.charAt(0)))}function Hr(e,t,n){let r=j(n,t);return!r||r.type!==`comment`}function Ur(e,t,n){let r=j(n,t);return!r||r.type!==`comment`}function Wr(e,t,n){let r=j(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function Gr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Kr(e,t,n){let r=j(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function qr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function Jr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Yr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Xr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Zr(e,t,n){let r=j(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Qr(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function $r(e,t,n){return!j(n,t)}function ei(e,t,n){let r=j(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function ti(e,t,n){let r=j(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var ni=zr({body:ai,colgroup:oi,head:ii,html:ri,tbody:si});function ri(e){let t=j(e,-1);return!t||t.type!==`comment`}function ii(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function ai(e){let t=j(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&le(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function oi(e,t,n){let r=Fr(n,t),i=j(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Br(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function si(e,t,n){let r=Fr(n,t),i=j(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Br(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var ci={name:[[`