okengine 0.23.2 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/AGENTS.md +5 -1
  2. package/manifest.v1.schema.json +53 -3
  3. package/package.json +2 -1
  4. package/site/content/docs/ai/mcp.mdx +1 -1
  5. package/site/content/docs/ai/skills.mdx +1 -1
  6. package/site/content/docs/elements/ai/decide.mdx +95 -417
  7. package/site/content/docs/elements/ai/deciders.mdx +154 -0
  8. package/site/content/docs/elements/ai/index.mdx +2 -1
  9. package/site/content/docs/elements/ai/meta.json +1 -1
  10. package/site/content/docs/reference/cli.mdx +2 -2
  11. package/site/content/docs/reference/configuration.mdx +2 -1
  12. package/site/content/docs/reference/fx.mdx +11 -9
  13. package/src/cli/agents-md.test.ts +8 -2
  14. package/src/cli/decide-certify.test.ts +166 -0
  15. package/src/cli/decide.ts +170 -3
  16. package/src/cli/decision-lock-watch.test.ts +4 -4
  17. package/src/cli/eval.ts +38 -59
  18. package/src/cli/mcp-from-console.ts +1 -1
  19. package/src/cli/registry.ts +45 -9
  20. package/src/compiler/decisions.extract.test.ts +86 -31
  21. package/src/compiler/effects-infer.ts +1 -0
  22. package/src/compiler/extract.ts +239 -24
  23. package/src/config/index.ts +6 -0
  24. package/src/console/server/decisions.test.ts +6 -1
  25. package/src/console/server/decisions.ts +32 -1
  26. package/src/console/ui-next/dist/assets/{access-page-zBMhZnFm.js → access-page-DX2dKLmq.js} +1 -1
  27. package/src/console/ui-next/dist/assets/{agent-disclosure-CBj9f7Ju.js → agent-disclosure-CiRvA3M9.js} +1 -1
  28. package/src/console/ui-next/dist/assets/{cache-glyph-D3MY49h3.js → cache-glyph-CC1yFJ8A.js} +1 -1
  29. package/src/console/ui-next/dist/assets/{call-pii-button-L9JxdBhp.js → call-pii-button-CLXQgIDD.js} +1 -1
  30. package/src/console/ui-next/dist/assets/{collapsible-BvFaX-Zt.js → collapsible-C0AThBZg.js} +1 -1
  31. package/src/console/ui-next/dist/assets/{decisions-page-DgB76m-X.js → decisions-page-Bf3AhTAa.js} +1 -1
  32. package/src/console/ui-next/dist/assets/{duration-tone-l1DSJ2Vz.js → duration-tone-Bptur2gX.js} +1 -1
  33. package/src/console/ui-next/dist/assets/{flows-page-Bb9t1lu6.js → flows-page-DRZVeTZU.js} +1 -1
  34. package/src/console/ui-next/dist/assets/{highlighted-json-DMvsi3Ti.js → highlighted-json-BKf0PjBK.js} +1 -1
  35. package/src/console/ui-next/dist/assets/{http-method-BwhJBTcQ.js → http-method-uhrnWrGC.js} +1 -1
  36. package/src/console/ui-next/dist/assets/{index-RhV2jT_7.js → index-Duxus_sG.js} +3 -3
  37. package/src/console/ui-next/dist/assets/{observability-page-BRfUILBq.js → observability-page-B-QM8X0O.js} +1 -1
  38. package/src/console/ui-next/dist/assets/{replica-lag-BsceAzIG.js → replica-lag-DuqHCANi.js} +1 -1
  39. package/src/console/ui-next/dist/assets/{request-meta-C6lTyCXp.js → request-meta-BTBZ3Ulc.js} +1 -1
  40. package/src/console/ui-next/dist/assets/{store-page-YmE806bJ.js → store-page-fpo7VxYb.js} +1 -1
  41. package/src/console/ui-next/dist/assets/{trace-detail-sheet-Di4irS49.js → trace-detail-sheet-DKtr1-K1.js} +1 -1
  42. package/src/console/ui-next/dist/assets/{tree-expand-toggle-DYeL6Rye.js → tree-expand-toggle-QeTceKKI.js} +1 -1
  43. package/src/console/ui-next/dist/assets/{units-page-07agasRA.js → units-page-ChCp8mOy.js} +1 -1
  44. package/src/console/ui-next/dist/assets/{vault-page-CHBck4n_.js → vault-page-CEYLXhUX.js} +1 -1
  45. package/src/console/ui-next/dist/index.html +1 -1
  46. package/src/console/ui-next/src/client.ts +8 -0
  47. package/src/console/ui-next/src/features/flows/decisions/decisions-page.tsx +16 -0
  48. package/src/elements/ai/deciders/presets.ts +182 -0
  49. package/src/elements/ai/decisions/bind.ts +6 -5
  50. package/src/elements/ai/decisions/catalog.ts +93 -0
  51. package/src/elements/ai/decisions/certificate.test.ts +47 -19
  52. package/src/elements/ai/decisions/certificate.ts +107 -24
  53. package/src/elements/ai/decisions/certify.ts +104 -9
  54. package/src/elements/ai/decisions/codec.test.ts +142 -0
  55. package/src/elements/ai/decisions/codec.ts +302 -0
  56. package/src/elements/ai/decisions/decide.test.ts +108 -31
  57. package/src/elements/ai/decisions/decider-runtime.test.ts +415 -0
  58. package/src/elements/ai/decisions/decider.types.test.ts +62 -0
  59. package/src/elements/ai/decisions/e2e.test.ts +20 -16
  60. package/src/elements/ai/decisions/http.ts +15 -7
  61. package/src/elements/ai/decisions/labels.test.ts +6 -1
  62. package/src/elements/ai/decisions/labels.ts +4 -3
  63. package/src/elements/ai/decisions/openai.live.test.ts +42 -0
  64. package/src/elements/ai/decisions/openrouter.live.test.ts +5 -1
  65. package/src/elements/ai/decisions/provider.ts +22 -1
  66. package/src/elements/ai/declare.ts +208 -51
  67. package/src/elements/ai.ts +1 -0
  68. package/src/index.ts +1 -0
  69. package/src/kernel/app.ts +8 -0
  70. package/src/kernel/decision-budget-entry.ts +11 -0
  71. package/src/kernel/element-registries.ts +3 -0
  72. package/src/kernel/fx-decide.ts +276 -88
  73. package/src/manifest/types.ts +38 -2
  74. package/src/release/measure.ts +47 -8
  75. package/src/test/create-test-app.ts +21 -1
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n}from"./xyflow-yApv7D4e.js";import{$n as r,F as i,I as a,Qn as o,R as s,er as c,i as l,l as u,o as d,s as f,u as p}from"./shortcut-keys-DTE1sjTC.js";import{C as m,D as h,O as g,S as _,Tt as v,_ as y,c as b,d as x,f as S,g as C,l as w,s as T,u as E,w as D,x as O}from"./explorer-chrome-Dslh2yE8.js";import{i as k,o as A,t as ee}from"./http-method-BwhJBTcQ.js";import{b as te,t as j}from"./element-icons-C6t8Vlml.js";import{a as M,i as ne,n as re,o as N,r as ie,s as P,t as ae}from"./collapsible-BvFaX-Zt.js";import{a as oe,c as se,i as ce,l as le,o as ue,s as de,t as fe}from"./duration-tone-l1DSJ2Vz.js";import{c as pe,f as me,i as F,t as he,u as ge}from"./highlighted-json-DMvsi3Ti.js";import{E as _e,T as ve,a as ye,b as I,c as be,d as xe,i as L,l as Se,n as Ce,p as we,r as Te,t as Ee,u as De}from"./request-meta-C6lTyCXp.js";import{n as Oe,t as ke}from"./copy-inline-button-BTjPVjRT.js";import{D as Ae,H as je,J as Me,O as R,_t as z,at as B,c as Ne,d as Pe,it as Fe,l as Ie,q as V}from"./index-RhV2jT_7.js";var H=[[`path`,{d:`M6.5 9.5C6.5 6.46243 8.96243 4 12 4C15.0376 4 17.5 6.46243 17.5 9.5V16C17.5 17.4142 17.5 18.1213 17.0607 18.5607C16.6213 19 15.9142 19 14.5 19H9.5C8.08579 19 7.37868 19 6.93934 18.5607C6.5 18.1213 6.5 17.4142 6.5 16V9.5Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20 11V17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M15 19V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M9 19V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M4 11V17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M10 4L8.5 2M14 4L15.5 2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}],[`path`,{d:`M6.5 10H17.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`6`}]],U=[[`path`,{d:`M12 5.75C12 3.75 13.5 1.75 15.5 1.75C15.5 3.75 14 5.75 12 5.75Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.5 8.09001C11.9851 8.09001 11.5867 7.92646 11.1414 7.74368C10.5776 7.51225 9.93875 7.25 8.89334 7.25C7.02235 7.25 4 8.74945 4 12.7495C4 17.4016 7.10471 22.25 9.10471 22.25C9.77426 22.25 10.3775 21.9871 10.954 21.7359C11.4815 21.5059 11.9868 21.2857 12.5 21.2857C13.0132 21.2857 13.5185 21.5059 14.046 21.7359C14.6225 21.9871 15.2257 22.25 15.8953 22.25C17.2879 22.25 18.9573 19.8992 20 16.9008C18.3793 16.2202 17.338 14.618 17.338 12.75C17.338 11.121 18.2036 10.0398 19.5 9.25C18.5 7.75 17.0134 7.25 15.9447 7.25C14.8993 7.25 14.2604 7.51225 13.6966 7.74368C13.2514 7.92646 13.0149 8.09001 12.5 8.09001Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Le=[[`path`,{d:`M13 7H11C8.19108 7 6.78661 7 5.77772 7.67412C5.34096 7.96596 4.96596 8.34096 4.67412 8.77772C4 9.78661 4 11.1911 4 14C4 16.8089 4 18.2134 4.67412 19.2223C4.96596 19.659 5.34096 20.034 5.77772 20.3259C6.78661 21 8.19108 21 11 21H13C15.8089 21 17.2134 21 18.2223 20.3259C18.659 20.034 19.034 19.659 19.3259 19.2223C20 18.2134 20 16.8089 20 14C20 11.1911 20 9.78661 19.3259 8.77772C19.034 8.34096 18.659 7.96596 18.2223 7.67412C17.2134 7 15.8089 7 13 7Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M4 14H2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M10 17H14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M22 14H20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M15 11V13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M9 11V13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}],[`path`,{d:`M12 7C12 5.11438 12 4.17157 11.4142 3.58579C10.8284 3 9.88562 3 8 3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`6`}]],W=[[`path`,{d:`M3 12C3 7.75736 3 5.63604 4.31802 4.31802C5.63604 3 7.75736 3 12 3C16.2426 3 18.364 3 19.682 4.31802C21 5.63604 21 7.75736 21 12C21 16.2426 21 18.364 19.682 19.682C18.364 21 16.2426 21 12 21C7.75736 21 5.63604 21 4.31802 19.682C3 18.364 3 16.2426 3 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 9H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],G=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M8.53448 14L4.0332 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M11.5 21.5L15.5 14`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M12 8H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`4`}]],K=[[`path`,{d:`M7.5 7.5L8.72654 8.55719C9.24218 9.00163 9.5 9.22386 9.5 9.5C9.5 9.77614 9.24218 9.99836 8.72654 10.4428L7.5 11.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.5 12.5H15.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 21C15.7497 21 17.6246 21 18.9389 20.0451C19.3634 19.7367 19.7367 19.3634 20.0451 18.9389C21 17.6246 21 15.7497 21 12C21 8.25027 21 6.3754 20.0451 5.06107C19.7367 4.6366 19.3634 4.26331 18.9389 3.95491C17.6246 3 15.7497 3 12 3C8.25027 3 6.3754 3 5.06107 3.95491C4.6366 4.26331 4.26331 4.6366 3.95491 5.06107C3 6.3754 3 8.25027 3 12C3 15.7497 3 17.6246 3.95491 18.9389C4.26331 19.3634 4.6366 19.7367 5.06107 20.0451C6.3754 21 8.25027 21 12 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],q=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 12C8 18 12 22 12 22C12 22 16 18 16 12C16 6 12 2 12 2C12 2 8 6 8 12Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M21 15H3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M21 9H3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Re=[[`path`,{d:`M20 12L4 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],ze=[[`path`,{d:`M13.5 2H10.5C8.14298 2 6.96447 2 6.23223 2.73223C5.5 3.46447 5.5 4.64298 5.5 7V17C5.5 19.357 5.5 20.5355 6.23223 21.2678C6.96447 22 8.14298 22 10.5 22H13.5C15.857 22 17.0355 22 17.7678 21.2678C18.5 20.5355 18.5 19.357 18.5 17V7C18.5 4.64298 18.5 3.46447 17.7678 2.73223C17.0355 2 15.857 2 13.5 2Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.125 19H12M12.25 19C12.25 19.1381 12.1381 19.25 12 19.25C11.8619 19.25 11.75 19.1381 11.75 19C11.75 18.8619 11.8619 18.75 12 18.75C12.1381 18.75 12.25 18.8619 12.25 19Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Be=[[`path`,{d:`M14.5 2H9.5C6.67157 2 5.25736 2 4.37868 2.87868C3.5 3.75736 3.5 5.17157 3.5 8V16C3.5 18.8284 3.5 20.2426 4.37868 21.1213C5.25736 22 6.67157 22 9.5 22H14.5C17.3284 22 18.7426 22 19.6213 21.1213C20.5 20.2426 20.5 18.8284 20.5 16V8C20.5 5.17157 20.5 3.75736 19.6213 2.87868C18.7426 2 17.3284 2 14.5 2Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.125 19H12M12.25 19C12.25 19.1381 12.1381 19.25 12 19.25C11.8619 19.25 11.75 19.1381 11.75 19C11.75 18.8619 11.8619 18.75 12 18.75C12.1381 18.75 12.25 18.8619 12.25 19Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]];function Ve(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=je(i,a,o);return t?s(r):s}var J=e(t(),1);function He(e){let t=B(()=>R(e)),{isStatic:n}=(0,J.useContext)(Pe);if(n){let[,n]=(0,J.useState)(e);(0,J.useEffect)(()=>t.on(`change`,n),[])}return t}function Ue(e,t){let n=He(t()),r=()=>n.set(t());return r(),Fe(()=>{let t=()=>Me.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),V(r)}}),n}function We(e){Ae.current=[],e();let t=Ue(Ae.current,e);return Ae.current=void 0,t}function Y(e,t,n,r){if(typeof e==`function`)return We(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return Ke(e,t,n,r);let i=typeof t==`function`?t:Ve(t,n,r),a=Array.isArray(e)?Ge(e,i):Ge([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;return o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1&&(a.accelerate={...o,times:t,keyframes:n,isTransformed:!0,...r?.ease?{ease:r.ease}:{}}),a}function Ge(e,t){let n=B(()=>[]);return Ue(e,()=>{n.length=0;let r=e.length;for(let t=0;t<r;t++)n[t]=e[t].get();return t(n)})}function Ke(e,t,n,r){let i=B(()=>Object.keys(n)),a=B(()=>({}));for(let o of i)a[o]=Y(e,t,n[o],r);return a}var X=n();function qe(e){return!Number.isFinite(e)||e<=0?900:Math.min(1600,Math.max(700,e*6))}function Je(e,t){let n=t?.flows??{},r=[...e],i=[];for(let e=0;e<r.length;e++){let t=r[e];i.push(`flow:${t}`);let a=r[e+1];if(!a)break;let o=Ye(t,a,n);o&&i.push(`signal:${o}`)}return i}function Ye(e,t,n){let r=n[e],i=n[t];if(!r||!i)return null;let a=i.trigger?.signal;return a&&r.effects?.emits?.includes(a)?a:null}function Xe(e,t){return e.length===0?null:e[Math.floor(Math.min(.999,Math.max(0,t))*e.length)]??null}var Ze={windows:`windows`,macos:`macos`,"mac os":`macos`,linux:`linux`,android:`android`,ios:`ios`,ipados:`ipados`,"chrome os":`chromeos`,chromeos:`chromeos`,cros:`chromeos`,freebsd:`freebsd`,openbsd:`openbsd`};function Qe(e){let t=Q(e,`user-agent`)?.trim()??``,n=tt($e(t),t.toLowerCase(),e),r=rt(t,n.browser,n.apiClient),i=nt(e);return{deviceType:n.deviceType===`unknown`?null:n.deviceType,platform:n.platform===`other`?null:n.platform,browser:n.browser===`other`||n.browser===`none`?null:n.browser,browserVersion:n.browser===`other`||n.browser===`none`?null:r,clientType:n.clientType===`other`?null:n.clientType,apiClient:n.apiClient===`other`||n.apiClient===`none`?null:n.apiClient,apiClientVersion:n.apiClient===`other`||n.apiClient===`none`?null:r,console:Q(e,`x-oke-client`)?.trim().toLowerCase()===`console`,ip:i,userAgent:t.length>0?t:null}}function $e(e){let t=(e??``).trim().toLowerCase(),n=`other`,r=`none`,i=`other`,a=`other`,o=`unknown`;return/\bpostmanruntime\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`postmanruntime`,browser:`none`,platform:a,deviceType:o}):/\bnewman\/\d+/.test(t)?Z({ua:t,clientType:`cli`,apiClient:`newman`,browser:`none`,platform:a,deviceType:o}):/\binsomnia\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`insomnia`,browser:`none`,platform:a,deviceType:o}):/\bhoppscotch\b/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`hoppscotch`,browser:`none`,platform:a,deviceType:o}):/\bcurl\/\d+/.test(t)?Z({ua:t,clientType:`cli`,apiClient:`curl`,browser:`none`,platform:a,deviceType:o}):/\bhttpie\/\d+/.test(t)?Z({ua:t,clientType:`cli`,apiClient:`httpie`,browser:`none`,platform:a,deviceType:o}):/\bwget\/\d+/.test(t)?Z({ua:t,clientType:`cli`,apiClient:`wget`,browser:`none`,platform:a,deviceType:o}):/\bpython-requests\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`python-requests`,browser:`none`,platform:a,deviceType:o}):/\bokhttp\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`okhttp`,browser:`none`,platform:a,deviceType:o}):/\baxios\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`axios`,browser:`none`,platform:a,deviceType:o}):/\bnode-fetch\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`node-fetch`,browser:`none`,platform:a,deviceType:o}):/\bundici\b/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`undici`,browser:`none`,platform:a,deviceType:o}):/\bbot\b|\bcrawler\b|\bspider\b/.test(t)?Z({ua:t,clientType:`bot`,apiClient:`none`,browser:`none`,platform:a,deviceType:`bot`}):(n=`browser`,r=`none`,i=/\bedg\//.test(t)?`edge`:/\barc\//.test(t)?`arc`:/\bvivaldi\//.test(t)?`vivaldi`:/\bopr\//.test(t)||/\bopera\b/.test(t)?`opera`:/\bfirefox\//.test(t)?`firefox`:/\bchrome\//.test(t)||/\bcrios\//.test(t)?`chrome`:/\bsafari\//.test(t)?`safari`:/\bbrave\//.test(t)?`brave`:`other`,Z({ua:t,clientType:n,apiClient:r,browser:i,platform:a,deviceType:o}))}function Z(e){let t=e.platform,n=e.deviceType,r=e.ua;return/\bwindows nt\b/.test(r)?t=`windows`:/\bipad\b/.test(r)?t=`ipados`:/\biphone\b|\bipod\b|\bcpu iphone os\b/.test(r)?t=`ios`:/\bandroid\b/.test(r)?t=`android`:/\bcros\b|\bchromeos\b/.test(r)?t=`chromeos`:/\bmac os x\b/.test(r)?t=`macos`:/\bfreebsd\b/.test(r)?t=`freebsd`:/\bopenbsd\b/.test(r)?t=`openbsd`:/\blinux\b/.test(r)&&(t=`linux`),n=et(t,r,n),{clientType:e.clientType,apiClient:e.apiClient,browser:e.browser,platform:t,deviceType:n}}function et(e,t,n){return n===`bot`?`bot`:e===`ipados`||/\btablet\b/.test(t)?`tablet`:e===`ios`||e===`android`||/\bmobile\b/.test(t)?`mobile`:e===`windows`||e===`macos`||e===`linux`||e===`chromeos`||e===`freebsd`||e===`openbsd`?`desktop`:n===`unknown`?`unknown`:n}function tt(e,t,n){let r=ot(Q(n,`sec-ch-ua-platform`)),i=r?Ze[r.toLowerCase()]??e.platform:e.platform,a=i===e.platform?e.deviceType:et(i,t,e.deviceType),o=ot(Q(n,`sec-ch-ua-mobile`));return a!==`bot`&&o===`?1`&&(a=`mobile`),a!==`bot`&&o===`?0`&&(a=i===`ipados`||/\btablet\b/.test(t)?`tablet`:`desktop`),{...e,platform:i,deviceType:a}}function nt(e){let t=Q(e,`cf-connecting-ip`)?.trim();if(t)return t;let n=Q(e,`x-forwarded-for`)?.split(`,`)[0]?.trim();if(n)return n;let r=Q(e,`x-real-ip`)?.trim();return r&&r.length>0?r:null}function rt(e,t,n){let r=t===`safari`?it(e,/version\/(\d+(?:\.\d+)*)/i):t===`edge`?it(e,/\bedg\/(\d+(?:\.\d+)*)/i):t===`opera`?it(e,/\b(?:opr|opera)\/(\d+(?:\.\d+)*)/i):t===`chrome`?it(e,/\b(?:chrome|crios)\/(\d+(?:\.\d+)*)/i):t!==`other`&&t!==`none`?it(e,RegExp(`\\b${t}\\/(\\d+(?:\\.\\d+)*)`,`i`)):n!==`other`&&n!==`none`?it(e,RegExp(`\\b${n}\\/(\\d+(?:\\.\\d+)*)`,`i`)):null;return r?at(r):null}function it(e,t){return t.exec(e)?.[1]??null}function at(e){let[t,n]=e.split(`.`);return t?!n||n===`0`?t:`${t}.${n}`:e}function Q(e,t){let n=e[t];if(n!==void 0)return n;let r=t.toLowerCase();for(let[t,n]of Object.entries(e))if(t.toLowerCase()===r)return n}function ot(e){if(!e)return null;let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1):t}var st={desktop:`Desktop`,mobile:`Mobile`,tablet:`Tablet`,bot:`Bot`},ct={windows:`Windows`,macos:`macOS`,linux:`Linux`,ios:`iOS`,ipados:`iPadOS`,android:`Android`,chromeos:`ChromeOS`,freebsd:`FreeBSD`,openbsd:`OpenBSD`},lt={chrome:`Chrome`,firefox:`Firefox`,safari:`Safari`,edge:`Edge`,arc:`Arc`,opera:`Opera`,brave:`Brave`,vivaldi:`Vivaldi`},ut={browser:`Browser`,api_client:`API client`,cli:`CLI`,bot:`Bot`},dt={postmanruntime:`Postman`,newman:`Newman`,insomnia:`Insomnia`,hoppscotch:`Hoppscotch`,curl:`curl`,httpie:`HTTPie`,wget:`wget`,"python-requests":`python-requests`,okhttp:`okhttp`,axios:`axios`,"node-fetch":`node-fetch`,undici:`undici`};function ft({headers:e}){let t=(0,J.useMemo)(()=>Qe(e),[e]),n=pt(t),i=ht(t),[a,s]=(0,J.useState)(!1);return n.length===0?null:(0,X.jsxs)(ae,{open:a,onOpenChange:s,"data-slot":`trace-request-client`,children:[(0,X.jsx)(`div`,{className:o(O,`border-t`),children:(0,X.jsxs)(ie,{className:o(m,`min-w-0 flex-1 justify-start gap-3`),"data-slot":`trace-request-client-toggle`,children:[(0,X.jsx)(r,{icon:N,className:o(T,!a&&`-rotate-90`)}),(0,X.jsx)(`span`,{className:`flex min-w-0 items-center gap-3 overflow-hidden`,children:n.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(r,{icon:e.icon,className:S}),(0,X.jsx)(`span`,{className:`truncate`,children:e.label})]},e.id))})]})}),(0,X.jsx)(re,{children:(0,X.jsx)(`ul`,{"data-slot":`trace-request-client-facts`,children:i.map(e=>(0,X.jsxs)(`li`,{className:o(y,`group/fact`),children:[(0,X.jsx)(r,{icon:e.icon,className:S}),(0,X.jsx)(`span`,{className:`w-[5.5rem] shrink-0 text-[11px] text-muted-foreground`,children:e.label}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground select-all`,children:e.value}),e.id===`user-agent`?(0,X.jsx)(gt,{text:e.value}):null]},e.id))})})]})}function pt(e){let t=[];e.deviceType&&e.deviceType!==`unknown`&&t.push({id:`device`,icon:vt(e.deviceType),label:st[e.deviceType]}),e.platform&&e.platform!==`other`&&t.push({id:`platform`,icon:yt(e.platform),label:ct[e.platform]});let n=mt(e);return n&&t.push(n),t}function mt(e){return e.browser&&e.browser!==`none`&&e.browser!==`other`?{id:`browser`,icon:e.browser===`chrome`?G:W,label:_t(lt[e.browser],e.browserVersion)}:e.apiClient&&e.apiClient!==`none`&&e.apiClient!==`other`?{id:`api`,icon:M,label:_t(dt[e.apiClient],e.apiClientVersion)}:e.console?{id:`console`,icon:K,label:`Console`}:e.clientType&&e.clientType!==`other`?{id:`client`,icon:bt(e.clientType),label:ut[e.clientType]}:e.ip?{id:`network`,icon:q,label:e.ip}:null}function ht(e){let t=[];return e.deviceType&&e.deviceType!==`unknown`&&t.push({id:`device`,icon:vt(e.deviceType),label:`Device`,value:st[e.deviceType]}),e.platform&&e.platform!==`other`&&t.push({id:`platform`,icon:yt(e.platform),label:`Platform`,value:ct[e.platform]}),e.browser&&e.browser!==`none`&&e.browser!==`other`&&t.push({id:`browser`,icon:e.browser===`chrome`?G:W,label:`Browser`,value:_t(lt[e.browser],e.browserVersion)}),e.console?t.push({id:`client`,icon:K,label:`Client`,value:`Console`}):e.clientType&&e.clientType!==`browser`&&e.clientType!==`other`&&t.push({id:`client`,icon:bt(e.clientType),label:`Client`,value:ut[e.clientType]}),e.apiClient&&e.apiClient!==`none`&&e.apiClient!==`other`&&t.push({id:`api`,icon:M,label:`API client`,value:_t(dt[e.apiClient],e.apiClientVersion)}),e.ip&&t.push({id:`network`,icon:q,label:`Network`,value:e.ip}),e.userAgent&&t.push({id:`user-agent`,icon:M,label:`User agent`,value:e.userAgent}),t}function gt({text:e}){let[t,n]=(0,J.useState)(!1),i=async t=>{t.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),window.setTimeout(()=>n(!1),1200)}catch{n(!1)}};return(0,X.jsx)(`button`,{type:`button`,className:o(E,`opacity-0 group-hover/fact:opacity-100`),"aria-label":t?`Copied`:`Copy user agent`,"data-slot":`trace-request-client-copy-ua`,onClick:e=>void i(e),children:(0,X.jsx)(r,{icon:t?c:te,className:`size-3.5`})})}function _t(e,t){return t?`${e} ${t}`:e}function vt(e){switch(e){case`mobile`:return ze;case`tablet`:return Be;case`bot`:return Le;default:return z}}function yt(e){switch(e){case`macos`:case`ios`:case`ipados`:return U;case`android`:return H;case`chromeos`:return G;case`linux`:case`freebsd`:case`openbsd`:return K;default:return z}}function bt(e){switch(e){case`cli`:case`api_client`:return M;case`bot`:return Le;default:return W}}var xt={200:`OK`,201:`Created`,202:`Accepted`,204:`No Content`,301:`Moved`,302:`Found`,304:`Not Modified`,400:`Bad Request`,401:`Unauthorized`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,409:`Conflict`,415:`Unsupported Media Type`,422:`Unprocessable Content`,429:`Too Many Requests`,500:`Internal Server Error`,502:`Bad Gateway`,503:`Service Unavailable`};function St(e){return xt[e]??null}function Ct(e){return e>=500?`text-destructive`:e>=400?`text-amber-700 dark:text-amber-400`:e>=300?`text-sky-700 dark:text-sky-400`:`text-emerald-700 dark:text-emerald-400`}function wt(e){return e>=500?`bg-destructive`:e>=400?`bg-amber-500`:e>=300?`bg-sky-500`:`bg-emerald-500`}function Tt(e){return Array.isArray(e)?e.length===0?null:e.map((e,t)=>Nt(String(t),e)):typeof e!=`object`||!e?null:Object.entries(e).map(([e,t])=>Nt(e,t))}function Et(e){return e==null?!1:typeof e==`string`||Array.isArray(e)?e.length>0:typeof e!=`object`||Object.keys(e).length>0}function Dt(e){if(Array.isArray(e)){let t=e.length;return`${t} ${t===1?`item`:`items`}`}if(typeof e==`object`&&e){let t=Object.keys(e).length;return`${t} ${t===1?`field`:`fields`}`}return typeof e==`string`?`${e.length} chars`:null}function Ot(e){let t=new TextEncoder().encode(e).length;return t<1024?`${t} B`:`${(t/1024).toFixed(1)} KB`}function kt(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function At(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;switch(typeof e){case`string`:return`string`;case`number`:return`number`;case`boolean`:return`boolean`;case`object`:return`object`;default:return`string`}}var jt=3,Mt=42;function Nt(e,t){return{key:e,value:t,display:Ft(t),kind:At(t),children:Pt(t)}}function Pt(e){if(Array.isArray(e))return e.length===0?null:e.map((e,t)=>Nt(String(t),e));if(typeof e==`object`&&e){let t=Object.entries(e);return t.length===0?null:t.map(([e,t])=>Nt(e,t))}return null}function Ft(e){return e===null?`null`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.length===0?`[]`:`${e.length} ${e.length===1?`item`:`items`}`:typeof e==`object`?It(e):typeof e==`bigint`?e.toString():typeof e}function It(e){let t=Object.keys(e);if(t.length===0)return`{}`;let n=[];for(let[t,r]of Object.entries(e)){if(n.length>=jt)break;if(typeof r!=`string`&&typeof r!=`number`&&typeof r!=`boolean`)continue;let e=typeof r==`string`?r:String(r);e.length===0||e.length>Mt||n.push(`${t}: ${e}`)}return n.length>0?n.join(` · `):`${t.length} ${t.length===1?`field`:`fields`}`}var $=`flex min-h-0 flex-1 flex-col`,Lt=`flex min-h-0 flex-1 overflow-auto pb-3 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`;function Rt({method:e,path:t,headline:n,input:r,output:i,http:a,error:s,errorMessage:c,inputOpen:l,onInputOpenChange:u,outputOpen:d,onOutputOpenChange:f}){let p=a?.request.method??e,m=a?.request.path??t,g=p&&m?`${p} ${m}`:n,_=a?.request.query??{},v=a?.request.headers??{},y=Object.keys(_).length>0,b=Object.keys(v).length>0,x=a?.response?.status,S=a?.response?.headers??{},C=Object.keys(S).length>0,w=s!==null,T=Et(r),E=Et(i),D=d&&!w&&E,k=l&&T&&!D;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{className:o(`border-b border-border/60 last:border-b-0`,k&&o($,`pb-3`)),"data-slot":`trace-request`,children:[(0,X.jsxs)(`div`,{className:O,children:[(0,X.jsx)(`h3`,{className:o(h,`flex items-center px-2`),children:`Request`}),g?(0,X.jsx)(`div`,{className:`ml-auto flex h-full items-stretch`,children:(0,X.jsx)(Yt,{label:`Copy endpoint`,text:g,dataSlot:`trace-request-copy-endpoint`})}):null]}),(0,X.jsx)(`div`,{"data-slot":`trace-request-frame`,className:k?$:void 0,children:(0,X.jsxs)(`div`,{className:o(`flex min-w-0`,k&&`min-h-0 flex-1`),children:[(0,X.jsx)(Ht,{method:p}),(0,X.jsxs)(`div`,{className:o(`flex min-w-0 flex-1 flex-col`,k&&`min-h-0`),children:[(0,X.jsx)(Ut,{method:p,path:m,headline:n}),b?(0,X.jsx)(ft,{headers:v}):null,y?(0,X.jsx)(Vt,{value:_,open:!0,onOpenChange:()=>void 0,label:`Query`,empty:``,copyLabel:`Copy query JSON`,copySlot:`trace-request-copy-query`,toggleSlot:`trace-request-query-toggle`,fieldsSlot:`trace-request-query`,jsonSlot:`trace-request-query-json`,localOpen:!0}):null,b?(0,X.jsx)(Vt,{value:v,open:!0,onOpenChange:()=>void 0,label:`Headers`,empty:``,copyLabel:`Copy request headers`,copySlot:`trace-request-copy-headers`,toggleSlot:`trace-request-headers-toggle`,fieldsSlot:`trace-request-headers`,jsonSlot:`trace-request-headers-json`,localOpen:!0}):null,T?(0,X.jsx)(Vt,{value:r,open:l,onOpenChange:u,label:`Body`,empty:``,copyLabel:`Copy body JSON`,copySlot:`trace-request-copy-input`,toggleSlot:`trace-input-toggle`,fieldsSlot:`trace-request-fields`,jsonSlot:`trace-input-json`,fill:k}):null]})]})})]}),(0,X.jsxs)(`section`,{className:o(`border-b border-border/60 last:border-b-0`,D&&o($,`pb-3`)),"data-slot":`trace-response`,children:[(0,X.jsxs)(`div`,{className:O,children:[(0,X.jsx)(`h3`,{className:o(h,`flex items-center px-2`),children:`Response`}),(0,X.jsxs)(`div`,{className:`ml-auto flex h-full items-stretch`,children:[!w&&E?(0,X.jsx)(Yt,{label:`Copy response JSON`,text:JSON.stringify(i,null,2),dataSlot:`trace-response-copy`}):null,w?(0,X.jsx)(Yt,{label:`Copy error`,text:[s,c].filter(Boolean).join(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n}from"./xyflow-yApv7D4e.js";import{$n as r,F as i,I as a,Qn as o,R as s,er as c,i as l,l as u,o as d,s as f,u as p}from"./shortcut-keys-DTE1sjTC.js";import{C as m,D as h,O as g,S as _,Tt as v,_ as y,c as b,d as x,f as S,g as C,l as w,s as T,u as E,w as D,x as O}from"./explorer-chrome-Dslh2yE8.js";import{i as k,o as A,t as ee}from"./http-method-uhrnWrGC.js";import{b as te,t as j}from"./element-icons-C6t8Vlml.js";import{a as M,i as ne,n as re,o as N,r as ie,s as P,t as ae}from"./collapsible-C0AThBZg.js";import{a as oe,c as se,i as ce,l as le,o as ue,s as de,t as fe}from"./duration-tone-Bptur2gX.js";import{c as pe,f as me,i as F,t as he,u as ge}from"./highlighted-json-BKf0PjBK.js";import{E as _e,T as ve,a as ye,b as I,c as be,d as xe,i as L,l as Se,n as Ce,p as we,r as Te,t as Ee,u as De}from"./request-meta-BTBZ3Ulc.js";import{n as Oe,t as ke}from"./copy-inline-button-BTjPVjRT.js";import{D as Ae,H as je,J as Me,O as R,_t as z,at as B,c as Ne,d as Pe,it as Fe,l as Ie,q as V}from"./index-Duxus_sG.js";var H=[[`path`,{d:`M6.5 9.5C6.5 6.46243 8.96243 4 12 4C15.0376 4 17.5 6.46243 17.5 9.5V16C17.5 17.4142 17.5 18.1213 17.0607 18.5607C16.6213 19 15.9142 19 14.5 19H9.5C8.08579 19 7.37868 19 6.93934 18.5607C6.5 18.1213 6.5 17.4142 6.5 16V9.5Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M20 11V17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M15 19V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M9 19V22`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M4 11V17`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M10 4L8.5 2M14 4L15.5 2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}],[`path`,{d:`M6.5 10H17.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`6`}]],U=[[`path`,{d:`M12 5.75C12 3.75 13.5 1.75 15.5 1.75C15.5 3.75 14 5.75 12 5.75Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.5 8.09001C11.9851 8.09001 11.5867 7.92646 11.1414 7.74368C10.5776 7.51225 9.93875 7.25 8.89334 7.25C7.02235 7.25 4 8.74945 4 12.7495C4 17.4016 7.10471 22.25 9.10471 22.25C9.77426 22.25 10.3775 21.9871 10.954 21.7359C11.4815 21.5059 11.9868 21.2857 12.5 21.2857C13.0132 21.2857 13.5185 21.5059 14.046 21.7359C14.6225 21.9871 15.2257 22.25 15.8953 22.25C17.2879 22.25 18.9573 19.8992 20 16.9008C18.3793 16.2202 17.338 14.618 17.338 12.75C17.338 11.121 18.2036 10.0398 19.5 9.25C18.5 7.75 17.0134 7.25 15.9447 7.25C14.8993 7.25 14.2604 7.51225 13.6966 7.74368C13.2514 7.92646 13.0149 8.09001 12.5 8.09001Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Le=[[`path`,{d:`M13 7H11C8.19108 7 6.78661 7 5.77772 7.67412C5.34096 7.96596 4.96596 8.34096 4.67412 8.77772C4 9.78661 4 11.1911 4 14C4 16.8089 4 18.2134 4.67412 19.2223C4.96596 19.659 5.34096 20.034 5.77772 20.3259C6.78661 21 8.19108 21 11 21H13C15.8089 21 17.2134 21 18.2223 20.3259C18.659 20.034 19.034 19.659 19.3259 19.2223C20 18.2134 20 16.8089 20 14C20 11.1911 20 9.78661 19.3259 8.77772C19.034 8.34096 18.659 7.96596 18.2223 7.67412C17.2134 7 15.8089 7 13 7Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M4 14H2`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M10 17H14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M22 14H20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M15 11V13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`4`}],[`path`,{d:`M9 11V13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`5`}],[`path`,{d:`M12 7C12 5.11438 12 4.17157 11.4142 3.58579C10.8284 3 9.88562 3 8 3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`6`}]],W=[[`path`,{d:`M3 12C3 7.75736 3 5.63604 4.31802 4.31802C5.63604 3 7.75736 3 12 3C16.2426 3 18.364 3 19.682 4.31802C21 5.63604 21 7.75736 21 12C21 16.2426 21 18.364 19.682 19.682C18.364 21 16.2426 21 12 21C7.75736 21 5.63604 21 4.31802 19.682C3 18.364 3 16.2426 3 12Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M3 9H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],G=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,stroke:`currentColor`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M8.53448 14L4.0332 6`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M11.5 21.5L15.5 14`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`3`}],[`path`,{d:`M12 8H21`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`4`}]],K=[[`path`,{d:`M7.5 7.5L8.72654 8.55719C9.24218 9.00163 9.5 9.22386 9.5 9.5C9.5 9.77614 9.24218 9.99836 8.72654 10.4428L7.5 11.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M11.5 12.5H15.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12 21C15.7497 21 17.6246 21 18.9389 20.0451C19.3634 19.7367 19.7367 19.3634 20.0451 18.9389C21 17.6246 21 15.7497 21 12C21 8.25027 21 6.3754 20.0451 5.06107C19.7367 4.6366 19.3634 4.26331 18.9389 3.95491C17.6246 3 15.7497 3 12 3C8.25027 3 6.3754 3 5.06107 3.95491C4.6366 4.26331 4.26331 4.6366 3.95491 5.06107C3 6.3754 3 8.25027 3 12C3 15.7497 3 17.6246 3.95491 18.9389C4.26331 19.3634 4.6366 19.7367 5.06107 20.0451C6.3754 21 8.25027 21 12 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],q=[[`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8 12C8 18 12 22 12 22C12 22 16 18 16 12C16 6 12 2 12 2C12 2 8 6 8 12Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M21 15H3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}],[`path`,{d:`M21 9H3`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`3`}]],Re=[[`path`,{d:`M20 12L4 12`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],ze=[[`path`,{d:`M13.5 2H10.5C8.14298 2 6.96447 2 6.23223 2.73223C5.5 3.46447 5.5 4.64298 5.5 7V17C5.5 19.357 5.5 20.5355 6.23223 21.2678C6.96447 22 8.14298 22 10.5 22H13.5C15.857 22 17.0355 22 17.7678 21.2678C18.5 20.5355 18.5 19.357 18.5 17V7C18.5 4.64298 18.5 3.46447 17.7678 2.73223C17.0355 2 15.857 2 13.5 2Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.125 19H12M12.25 19C12.25 19.1381 12.1381 19.25 12 19.25C11.8619 19.25 11.75 19.1381 11.75 19C11.75 18.8619 11.8619 18.75 12 18.75C12.1381 18.75 12.25 18.8619 12.25 19Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],Be=[[`path`,{d:`M14.5 2H9.5C6.67157 2 5.25736 2 4.37868 2.87868C3.5 3.75736 3.5 5.17157 3.5 8V16C3.5 18.8284 3.5 20.2426 4.37868 21.1213C5.25736 22 6.67157 22 9.5 22H14.5C17.3284 22 18.7426 22 19.6213 21.1213C20.5 20.2426 20.5 18.8284 20.5 16V8C20.5 5.17157 20.5 3.75736 19.6213 2.87868C18.7426 2 17.3284 2 14.5 2Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.125 19H12M12.25 19C12.25 19.1381 12.1381 19.25 12 19.25C11.8619 19.25 11.75 19.1381 11.75 19C11.75 18.8619 11.8619 18.75 12 18.75C12.1381 18.75 12.25 18.8619 12.25 19Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]];function Ve(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=je(i,a,o);return t?s(r):s}var J=e(t(),1);function He(e){let t=B(()=>R(e)),{isStatic:n}=(0,J.useContext)(Pe);if(n){let[,n]=(0,J.useState)(e);(0,J.useEffect)(()=>t.on(`change`,n),[])}return t}function Ue(e,t){let n=He(t()),r=()=>n.set(t());return r(),Fe(()=>{let t=()=>Me.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),V(r)}}),n}function We(e){Ae.current=[],e();let t=Ue(Ae.current,e);return Ae.current=void 0,t}function Y(e,t,n,r){if(typeof e==`function`)return We(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return Ke(e,t,n,r);let i=typeof t==`function`?t:Ve(t,n,r),a=Array.isArray(e)?Ge(e,i):Ge([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;return o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1&&(a.accelerate={...o,times:t,keyframes:n,isTransformed:!0,...r?.ease?{ease:r.ease}:{}}),a}function Ge(e,t){let n=B(()=>[]);return Ue(e,()=>{n.length=0;let r=e.length;for(let t=0;t<r;t++)n[t]=e[t].get();return t(n)})}function Ke(e,t,n,r){let i=B(()=>Object.keys(n)),a=B(()=>({}));for(let o of i)a[o]=Y(e,t,n[o],r);return a}var X=n();function qe(e){return!Number.isFinite(e)||e<=0?900:Math.min(1600,Math.max(700,e*6))}function Je(e,t){let n=t?.flows??{},r=[...e],i=[];for(let e=0;e<r.length;e++){let t=r[e];i.push(`flow:${t}`);let a=r[e+1];if(!a)break;let o=Ye(t,a,n);o&&i.push(`signal:${o}`)}return i}function Ye(e,t,n){let r=n[e],i=n[t];if(!r||!i)return null;let a=i.trigger?.signal;return a&&r.effects?.emits?.includes(a)?a:null}function Xe(e,t){return e.length===0?null:e[Math.floor(Math.min(.999,Math.max(0,t))*e.length)]??null}var Ze={windows:`windows`,macos:`macos`,"mac os":`macos`,linux:`linux`,android:`android`,ios:`ios`,ipados:`ipados`,"chrome os":`chromeos`,chromeos:`chromeos`,cros:`chromeos`,freebsd:`freebsd`,openbsd:`openbsd`};function Qe(e){let t=Q(e,`user-agent`)?.trim()??``,n=tt($e(t),t.toLowerCase(),e),r=rt(t,n.browser,n.apiClient),i=nt(e);return{deviceType:n.deviceType===`unknown`?null:n.deviceType,platform:n.platform===`other`?null:n.platform,browser:n.browser===`other`||n.browser===`none`?null:n.browser,browserVersion:n.browser===`other`||n.browser===`none`?null:r,clientType:n.clientType===`other`?null:n.clientType,apiClient:n.apiClient===`other`||n.apiClient===`none`?null:n.apiClient,apiClientVersion:n.apiClient===`other`||n.apiClient===`none`?null:r,console:Q(e,`x-oke-client`)?.trim().toLowerCase()===`console`,ip:i,userAgent:t.length>0?t:null}}function $e(e){let t=(e??``).trim().toLowerCase(),n=`other`,r=`none`,i=`other`,a=`other`,o=`unknown`;return/\bpostmanruntime\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`postmanruntime`,browser:`none`,platform:a,deviceType:o}):/\bnewman\/\d+/.test(t)?Z({ua:t,clientType:`cli`,apiClient:`newman`,browser:`none`,platform:a,deviceType:o}):/\binsomnia\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`insomnia`,browser:`none`,platform:a,deviceType:o}):/\bhoppscotch\b/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`hoppscotch`,browser:`none`,platform:a,deviceType:o}):/\bcurl\/\d+/.test(t)?Z({ua:t,clientType:`cli`,apiClient:`curl`,browser:`none`,platform:a,deviceType:o}):/\bhttpie\/\d+/.test(t)?Z({ua:t,clientType:`cli`,apiClient:`httpie`,browser:`none`,platform:a,deviceType:o}):/\bwget\/\d+/.test(t)?Z({ua:t,clientType:`cli`,apiClient:`wget`,browser:`none`,platform:a,deviceType:o}):/\bpython-requests\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`python-requests`,browser:`none`,platform:a,deviceType:o}):/\bokhttp\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`okhttp`,browser:`none`,platform:a,deviceType:o}):/\baxios\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`axios`,browser:`none`,platform:a,deviceType:o}):/\bnode-fetch\/\d+/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`node-fetch`,browser:`none`,platform:a,deviceType:o}):/\bundici\b/.test(t)?Z({ua:t,clientType:`api_client`,apiClient:`undici`,browser:`none`,platform:a,deviceType:o}):/\bbot\b|\bcrawler\b|\bspider\b/.test(t)?Z({ua:t,clientType:`bot`,apiClient:`none`,browser:`none`,platform:a,deviceType:`bot`}):(n=`browser`,r=`none`,i=/\bedg\//.test(t)?`edge`:/\barc\//.test(t)?`arc`:/\bvivaldi\//.test(t)?`vivaldi`:/\bopr\//.test(t)||/\bopera\b/.test(t)?`opera`:/\bfirefox\//.test(t)?`firefox`:/\bchrome\//.test(t)||/\bcrios\//.test(t)?`chrome`:/\bsafari\//.test(t)?`safari`:/\bbrave\//.test(t)?`brave`:`other`,Z({ua:t,clientType:n,apiClient:r,browser:i,platform:a,deviceType:o}))}function Z(e){let t=e.platform,n=e.deviceType,r=e.ua;return/\bwindows nt\b/.test(r)?t=`windows`:/\bipad\b/.test(r)?t=`ipados`:/\biphone\b|\bipod\b|\bcpu iphone os\b/.test(r)?t=`ios`:/\bandroid\b/.test(r)?t=`android`:/\bcros\b|\bchromeos\b/.test(r)?t=`chromeos`:/\bmac os x\b/.test(r)?t=`macos`:/\bfreebsd\b/.test(r)?t=`freebsd`:/\bopenbsd\b/.test(r)?t=`openbsd`:/\blinux\b/.test(r)&&(t=`linux`),n=et(t,r,n),{clientType:e.clientType,apiClient:e.apiClient,browser:e.browser,platform:t,deviceType:n}}function et(e,t,n){return n===`bot`?`bot`:e===`ipados`||/\btablet\b/.test(t)?`tablet`:e===`ios`||e===`android`||/\bmobile\b/.test(t)?`mobile`:e===`windows`||e===`macos`||e===`linux`||e===`chromeos`||e===`freebsd`||e===`openbsd`?`desktop`:n===`unknown`?`unknown`:n}function tt(e,t,n){let r=ot(Q(n,`sec-ch-ua-platform`)),i=r?Ze[r.toLowerCase()]??e.platform:e.platform,a=i===e.platform?e.deviceType:et(i,t,e.deviceType),o=ot(Q(n,`sec-ch-ua-mobile`));return a!==`bot`&&o===`?1`&&(a=`mobile`),a!==`bot`&&o===`?0`&&(a=i===`ipados`||/\btablet\b/.test(t)?`tablet`:`desktop`),{...e,platform:i,deviceType:a}}function nt(e){let t=Q(e,`cf-connecting-ip`)?.trim();if(t)return t;let n=Q(e,`x-forwarded-for`)?.split(`,`)[0]?.trim();if(n)return n;let r=Q(e,`x-real-ip`)?.trim();return r&&r.length>0?r:null}function rt(e,t,n){let r=t===`safari`?it(e,/version\/(\d+(?:\.\d+)*)/i):t===`edge`?it(e,/\bedg\/(\d+(?:\.\d+)*)/i):t===`opera`?it(e,/\b(?:opr|opera)\/(\d+(?:\.\d+)*)/i):t===`chrome`?it(e,/\b(?:chrome|crios)\/(\d+(?:\.\d+)*)/i):t!==`other`&&t!==`none`?it(e,RegExp(`\\b${t}\\/(\\d+(?:\\.\\d+)*)`,`i`)):n!==`other`&&n!==`none`?it(e,RegExp(`\\b${n}\\/(\\d+(?:\\.\\d+)*)`,`i`)):null;return r?at(r):null}function it(e,t){return t.exec(e)?.[1]??null}function at(e){let[t,n]=e.split(`.`);return t?!n||n===`0`?t:`${t}.${n}`:e}function Q(e,t){let n=e[t];if(n!==void 0)return n;let r=t.toLowerCase();for(let[t,n]of Object.entries(e))if(t.toLowerCase()===r)return n}function ot(e){if(!e)return null;let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1):t}var st={desktop:`Desktop`,mobile:`Mobile`,tablet:`Tablet`,bot:`Bot`},ct={windows:`Windows`,macos:`macOS`,linux:`Linux`,ios:`iOS`,ipados:`iPadOS`,android:`Android`,chromeos:`ChromeOS`,freebsd:`FreeBSD`,openbsd:`OpenBSD`},lt={chrome:`Chrome`,firefox:`Firefox`,safari:`Safari`,edge:`Edge`,arc:`Arc`,opera:`Opera`,brave:`Brave`,vivaldi:`Vivaldi`},ut={browser:`Browser`,api_client:`API client`,cli:`CLI`,bot:`Bot`},dt={postmanruntime:`Postman`,newman:`Newman`,insomnia:`Insomnia`,hoppscotch:`Hoppscotch`,curl:`curl`,httpie:`HTTPie`,wget:`wget`,"python-requests":`python-requests`,okhttp:`okhttp`,axios:`axios`,"node-fetch":`node-fetch`,undici:`undici`};function ft({headers:e}){let t=(0,J.useMemo)(()=>Qe(e),[e]),n=pt(t),i=ht(t),[a,s]=(0,J.useState)(!1);return n.length===0?null:(0,X.jsxs)(ae,{open:a,onOpenChange:s,"data-slot":`trace-request-client`,children:[(0,X.jsx)(`div`,{className:o(O,`border-t`),children:(0,X.jsxs)(ie,{className:o(m,`min-w-0 flex-1 justify-start gap-3`),"data-slot":`trace-request-client-toggle`,children:[(0,X.jsx)(r,{icon:N,className:o(T,!a&&`-rotate-90`)}),(0,X.jsx)(`span`,{className:`flex min-w-0 items-center gap-3 overflow-hidden`,children:n.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(r,{icon:e.icon,className:S}),(0,X.jsx)(`span`,{className:`truncate`,children:e.label})]},e.id))})]})}),(0,X.jsx)(re,{children:(0,X.jsx)(`ul`,{"data-slot":`trace-request-client-facts`,children:i.map(e=>(0,X.jsxs)(`li`,{className:o(y,`group/fact`),children:[(0,X.jsx)(r,{icon:e.icon,className:S}),(0,X.jsx)(`span`,{className:`w-[5.5rem] shrink-0 text-[11px] text-muted-foreground`,children:e.label}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground select-all`,children:e.value}),e.id===`user-agent`?(0,X.jsx)(gt,{text:e.value}):null]},e.id))})})]})}function pt(e){let t=[];e.deviceType&&e.deviceType!==`unknown`&&t.push({id:`device`,icon:vt(e.deviceType),label:st[e.deviceType]}),e.platform&&e.platform!==`other`&&t.push({id:`platform`,icon:yt(e.platform),label:ct[e.platform]});let n=mt(e);return n&&t.push(n),t}function mt(e){return e.browser&&e.browser!==`none`&&e.browser!==`other`?{id:`browser`,icon:e.browser===`chrome`?G:W,label:_t(lt[e.browser],e.browserVersion)}:e.apiClient&&e.apiClient!==`none`&&e.apiClient!==`other`?{id:`api`,icon:M,label:_t(dt[e.apiClient],e.apiClientVersion)}:e.console?{id:`console`,icon:K,label:`Console`}:e.clientType&&e.clientType!==`other`?{id:`client`,icon:bt(e.clientType),label:ut[e.clientType]}:e.ip?{id:`network`,icon:q,label:e.ip}:null}function ht(e){let t=[];return e.deviceType&&e.deviceType!==`unknown`&&t.push({id:`device`,icon:vt(e.deviceType),label:`Device`,value:st[e.deviceType]}),e.platform&&e.platform!==`other`&&t.push({id:`platform`,icon:yt(e.platform),label:`Platform`,value:ct[e.platform]}),e.browser&&e.browser!==`none`&&e.browser!==`other`&&t.push({id:`browser`,icon:e.browser===`chrome`?G:W,label:`Browser`,value:_t(lt[e.browser],e.browserVersion)}),e.console?t.push({id:`client`,icon:K,label:`Client`,value:`Console`}):e.clientType&&e.clientType!==`browser`&&e.clientType!==`other`&&t.push({id:`client`,icon:bt(e.clientType),label:`Client`,value:ut[e.clientType]}),e.apiClient&&e.apiClient!==`none`&&e.apiClient!==`other`&&t.push({id:`api`,icon:M,label:`API client`,value:_t(dt[e.apiClient],e.apiClientVersion)}),e.ip&&t.push({id:`network`,icon:q,label:`Network`,value:e.ip}),e.userAgent&&t.push({id:`user-agent`,icon:M,label:`User agent`,value:e.userAgent}),t}function gt({text:e}){let[t,n]=(0,J.useState)(!1),i=async t=>{t.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),window.setTimeout(()=>n(!1),1200)}catch{n(!1)}};return(0,X.jsx)(`button`,{type:`button`,className:o(E,`opacity-0 group-hover/fact:opacity-100`),"aria-label":t?`Copied`:`Copy user agent`,"data-slot":`trace-request-client-copy-ua`,onClick:e=>void i(e),children:(0,X.jsx)(r,{icon:t?c:te,className:`size-3.5`})})}function _t(e,t){return t?`${e} ${t}`:e}function vt(e){switch(e){case`mobile`:return ze;case`tablet`:return Be;case`bot`:return Le;default:return z}}function yt(e){switch(e){case`macos`:case`ios`:case`ipados`:return U;case`android`:return H;case`chromeos`:return G;case`linux`:case`freebsd`:case`openbsd`:return K;default:return z}}function bt(e){switch(e){case`cli`:case`api_client`:return M;case`bot`:return Le;default:return W}}var xt={200:`OK`,201:`Created`,202:`Accepted`,204:`No Content`,301:`Moved`,302:`Found`,304:`Not Modified`,400:`Bad Request`,401:`Unauthorized`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,409:`Conflict`,415:`Unsupported Media Type`,422:`Unprocessable Content`,429:`Too Many Requests`,500:`Internal Server Error`,502:`Bad Gateway`,503:`Service Unavailable`};function St(e){return xt[e]??null}function Ct(e){return e>=500?`text-destructive`:e>=400?`text-amber-700 dark:text-amber-400`:e>=300?`text-sky-700 dark:text-sky-400`:`text-emerald-700 dark:text-emerald-400`}function wt(e){return e>=500?`bg-destructive`:e>=400?`bg-amber-500`:e>=300?`bg-sky-500`:`bg-emerald-500`}function Tt(e){return Array.isArray(e)?e.length===0?null:e.map((e,t)=>Nt(String(t),e)):typeof e!=`object`||!e?null:Object.entries(e).map(([e,t])=>Nt(e,t))}function Et(e){return e==null?!1:typeof e==`string`||Array.isArray(e)?e.length>0:typeof e!=`object`||Object.keys(e).length>0}function Dt(e){if(Array.isArray(e)){let t=e.length;return`${t} ${t===1?`item`:`items`}`}if(typeof e==`object`&&e){let t=Object.keys(e).length;return`${t} ${t===1?`field`:`fields`}`}return typeof e==`string`?`${e.length} chars`:null}function Ot(e){let t=new TextEncoder().encode(e).length;return t<1024?`${t} B`:`${(t/1024).toFixed(1)} KB`}function kt(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function At(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;switch(typeof e){case`string`:return`string`;case`number`:return`number`;case`boolean`:return`boolean`;case`object`:return`object`;default:return`string`}}var jt=3,Mt=42;function Nt(e,t){return{key:e,value:t,display:Ft(t),kind:At(t),children:Pt(t)}}function Pt(e){if(Array.isArray(e))return e.length===0?null:e.map((e,t)=>Nt(String(t),e));if(typeof e==`object`&&e){let t=Object.entries(e);return t.length===0?null:t.map(([e,t])=>Nt(e,t))}return null}function Ft(e){return e===null?`null`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.length===0?`[]`:`${e.length} ${e.length===1?`item`:`items`}`:typeof e==`object`?It(e):typeof e==`bigint`?e.toString():typeof e}function It(e){let t=Object.keys(e);if(t.length===0)return`{}`;let n=[];for(let[t,r]of Object.entries(e)){if(n.length>=jt)break;if(typeof r!=`string`&&typeof r!=`number`&&typeof r!=`boolean`)continue;let e=typeof r==`string`?r:String(r);e.length===0||e.length>Mt||n.push(`${t}: ${e}`)}return n.length>0?n.join(` · `):`${t.length} ${t.length===1?`field`:`fields`}`}var $=`flex min-h-0 flex-1 flex-col`,Lt=`flex min-h-0 flex-1 overflow-auto pb-3 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`;function Rt({method:e,path:t,headline:n,input:r,output:i,http:a,error:s,errorMessage:c,inputOpen:l,onInputOpenChange:u,outputOpen:d,onOutputOpenChange:f}){let p=a?.request.method??e,m=a?.request.path??t,g=p&&m?`${p} ${m}`:n,_=a?.request.query??{},v=a?.request.headers??{},y=Object.keys(_).length>0,b=Object.keys(v).length>0,x=a?.response?.status,S=a?.response?.headers??{},C=Object.keys(S).length>0,w=s!==null,T=Et(r),E=Et(i),D=d&&!w&&E,k=l&&T&&!D;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{className:o(`border-b border-border/60 last:border-b-0`,k&&o($,`pb-3`)),"data-slot":`trace-request`,children:[(0,X.jsxs)(`div`,{className:O,children:[(0,X.jsx)(`h3`,{className:o(h,`flex items-center px-2`),children:`Request`}),g?(0,X.jsx)(`div`,{className:`ml-auto flex h-full items-stretch`,children:(0,X.jsx)(Yt,{label:`Copy endpoint`,text:g,dataSlot:`trace-request-copy-endpoint`})}):null]}),(0,X.jsx)(`div`,{"data-slot":`trace-request-frame`,className:k?$:void 0,children:(0,X.jsxs)(`div`,{className:o(`flex min-w-0`,k&&`min-h-0 flex-1`),children:[(0,X.jsx)(Ht,{method:p}),(0,X.jsxs)(`div`,{className:o(`flex min-w-0 flex-1 flex-col`,k&&`min-h-0`),children:[(0,X.jsx)(Ut,{method:p,path:m,headline:n}),b?(0,X.jsx)(ft,{headers:v}):null,y?(0,X.jsx)(Vt,{value:_,open:!0,onOpenChange:()=>void 0,label:`Query`,empty:``,copyLabel:`Copy query JSON`,copySlot:`trace-request-copy-query`,toggleSlot:`trace-request-query-toggle`,fieldsSlot:`trace-request-query`,jsonSlot:`trace-request-query-json`,localOpen:!0}):null,b?(0,X.jsx)(Vt,{value:v,open:!0,onOpenChange:()=>void 0,label:`Headers`,empty:``,copyLabel:`Copy request headers`,copySlot:`trace-request-copy-headers`,toggleSlot:`trace-request-headers-toggle`,fieldsSlot:`trace-request-headers`,jsonSlot:`trace-request-headers-json`,localOpen:!0}):null,T?(0,X.jsx)(Vt,{value:r,open:l,onOpenChange:u,label:`Body`,empty:``,copyLabel:`Copy body JSON`,copySlot:`trace-request-copy-input`,toggleSlot:`trace-input-toggle`,fieldsSlot:`trace-request-fields`,jsonSlot:`trace-input-json`,fill:k}):null]})]})})]}),(0,X.jsxs)(`section`,{className:o(`border-b border-border/60 last:border-b-0`,D&&o($,`pb-3`)),"data-slot":`trace-response`,children:[(0,X.jsxs)(`div`,{className:O,children:[(0,X.jsx)(`h3`,{className:o(h,`flex items-center px-2`),children:`Response`}),(0,X.jsxs)(`div`,{className:`ml-auto flex h-full items-stretch`,children:[!w&&E?(0,X.jsx)(Yt,{label:`Copy response JSON`,text:JSON.stringify(i,null,2),dataSlot:`trace-response-copy`}):null,w?(0,X.jsx)(Yt,{label:`Copy error`,text:[s,c].filter(Boolean).join(`
2
2
  `),dataSlot:`trace-response-copy-error`}):null]})]}),w&&x===void 0?(0,X.jsx)(Bt,{error:s,errorMessage:c}):(0,X.jsx)(`div`,{"data-slot":`trace-response-frame`,className:D?$:void 0,children:(0,X.jsxs)(`div`,{className:o(`flex min-w-0`,D&&`min-h-0 flex-1`),children:[(0,X.jsx)(`div`,{className:o(`w-1 shrink-0 self-stretch`,x===void 0?`bg-emerald-500`:wt(x)),"aria-hidden":!0,"data-slot":`trace-response-rail`}),(0,X.jsxs)(`div`,{className:o(`flex min-w-0 flex-1 flex-col`,D&&`min-h-0`),children:[x===void 0?null:(0,X.jsx)(zt,{status:x}),C?(0,X.jsx)(Vt,{value:S,open:!0,onOpenChange:()=>void 0,label:`Headers`,empty:``,copyLabel:`Copy response headers`,copySlot:`trace-response-copy-headers`,toggleSlot:`trace-response-headers-toggle`,fieldsSlot:`trace-response-headers`,jsonSlot:`trace-response-headers-json`,localOpen:!0}):null,w?(0,X.jsx)(Bt,{error:s,errorMessage:c,bare:!0}):E?(0,X.jsx)(Vt,{value:i,open:d,onOpenChange:f,label:`Body`,empty:``,copyLabel:`Copy response JSON`,copySlot:`trace-response-copy-body`,toggleSlot:`trace-response-toggle`,fieldsSlot:`trace-response-fields`,jsonSlot:`trace-response-json`,fill:D}):null]})]})})]})]})}function zt({status:e}){let t=St(e);return(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-2.5 py-2`,"data-slot":`trace-response-status`,children:[(0,X.jsx)(`span`,{className:o(`shrink-0 font-mono text-[10px] font-semibold tabular-nums`,Ct(e)),children:e}),t?(0,X.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:t}):null]})}function Bt({error:e,errorMessage:t,bare:n=!1}){let i=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 px-2.5 py-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(r,{icon:P,className:`size-3.5 shrink-0 text-destructive`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`font-mono text-xs font-semibold text-destructive`,children:e})]}),t?(0,X.jsx)(`p`,{className:`text-[11px] leading-snug text-destructive/90`,children:t}):(0,X.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Run failed with this error code — no return value was stored.`})]});return n?(0,X.jsx)(`div`,{"data-slot":`trace-response-error`,role:`alert`,className:`border-t border-border/60`,children:i}):(0,X.jsx)(`div`,{"data-slot":`trace-response-error`,role:`alert`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0`,children:[(0,X.jsx)(`div`,{className:`w-1 shrink-0 self-stretch bg-destructive`,"aria-hidden":!0,"data-slot":`trace-response-rail`}),i]})})}function Vt({value:e,open:t,onOpenChange:n,label:i,empty:a,copyLabel:s,copySlot:c,toggleSlot:l,fieldsSlot:u,jsonSlot:d,fill:f=!1,localOpen:p=!1}){let h=e!=null,g=(0,J.useMemo)(()=>h?JSON.stringify(e,null,2):``,[h,e]),_=(0,J.useMemo)(()=>h?Tt(e):null,[h,e]),v=(0,J.useMemo)(()=>h?Dt(e):null,[h,e]),y=(0,J.useMemo)(()=>h?Ot(g):null,[h,g]),[b,x]=(0,J.useState)(_?`fields`:`raw`),[S,C]=(0,J.useState)(!0),w=p?S:t,E=p?C:n;return(0,J.useEffect)(()=>{x(_?`fields`:`raw`)},[_]),h?(0,X.jsxs)(ae,{open:w,onOpenChange:E,className:f?$:`shrink-0`,children:[(0,X.jsxs)(`div`,{className:o(O,`border-t`),children:[(0,X.jsxs)(ie,{className:o(m,`min-w-0 flex-1 justify-start`),"data-slot":l,children:[(0,X.jsx)(r,{icon:N,className:o(T,!w&&`-rotate-90`)}),(0,X.jsx)(`span`,{children:i}),v?(0,X.jsxs)(`span`,{className:`truncate font-normal text-muted-foreground`,children:[`· `,v]}):null,y?(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] font-normal text-muted-foreground tabular-nums`,children:y}):null]}),_?(0,X.jsx)(Wt,{view:b,onChange:x}):null,(0,X.jsx)(Yt,{label:s,text:g,dataSlot:c})]}),(0,X.jsx)(re,{className:f?o($,`overflow-hidden`):void 0,children:(0,X.jsx)(`div`,{className:o(`border-t border-border/60`,f&&$),children:b===`fields`&&_?(0,X.jsx)(`div`,{className:f?`min-h-0 flex-1 overflow-auto pb-3`:void 0,children:(0,X.jsx)(Kt,{rows:_,dataSlot:u})}):(0,X.jsx)(he,{json:g,dataSlot:d,className:f?Lt:void 0})})})]}):(0,X.jsx)(`p`,{className:`border-t border-border/60 px-2 py-2 text-[11px] text-muted-foreground`,children:a})}function Ht({method:e}){return(0,X.jsx)(`div`,{className:o(`w-1 shrink-0 self-stretch`,e?k(e):`bg-muted-foreground/50`),"aria-hidden":!0,"data-slot":`trace-request-rail`})}function Ut({method:e,path:t,headline:n}){return e&&t?(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-2.5 py-2`,"data-slot":`trace-request-endpoint`,children:[(0,X.jsx)(`span`,{className:o(`shrink-0 font-mono text-[10px] font-semibold tracking-[0.08em] uppercase`,g(ee(e))),"data-slot":`trace-request-method`,children:e}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground select-all`,children:t})]}):(0,X.jsx)(`div`,{className:`px-2.5 py-2 font-mono text-xs text-foreground select-all`,"data-slot":`trace-request-endpoint`,children:n})}function Wt({view:e,onChange:t}){return(0,X.jsxs)(`div`,{className:`flex h-full shrink-0 items-stretch`,role:`group`,"aria-label":`Body view`,"data-slot":`trace-request-view-toggle`,children:[(0,X.jsx)(Gt,{active:e===`fields`,label:`Fields`,icon:ve,onClick:()=>t(`fields`)}),(0,X.jsx)(Gt,{active:e===`raw`,label:`Raw`,icon:M,onClick:()=>t(`raw`)})]})}function Gt({active:e,label:t,icon:n,onClick:i}){return(0,X.jsxs)(`button`,{type:`button`,className:o(m,`font-semibold tracking-[0.08em] uppercase`,e?_:D),"aria-pressed":e,"aria-label":t,onClick:i,children:[(0,X.jsx)(r,{icon:n,className:`size-3`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t})]})}function Kt({rows:e,dataSlot:t}){return(0,X.jsx)(`ul`,{"data-slot":t,children:e.map(e=>(0,X.jsx)(qt,{row:e,depth:0},e.key))})}function qt({row:e,depth:t}){let n=e.children!==null,[i,a]=(0,J.useState)(!1);return(0,X.jsxs)(`li`,{"data-slot":`trace-payload-field`,"data-depth":t,children:[(0,X.jsxs)(`div`,{className:o(y,`group/field items-start`),style:t>0?{paddingLeft:`${10+t*14}px`}:void 0,children:[n?(0,X.jsx)(`button`,{type:`button`,className:`mt-0.5 flex size-3.5 shrink-0 items-center justify-center text-muted-foreground`,"aria-expanded":i,"aria-label":`${i?`Collapse`:`Expand`} ${e.key}`,"data-slot":`trace-payload-expand`,onClick:()=>a(e=>!e),children:(0,X.jsx)(r,{icon:N,className:o(T,!i&&`-rotate-90`)})}):(0,X.jsx)(`span`,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 sm:flex-row sm:items-baseline sm:gap-3`,children:[(0,X.jsx)(`span`,{className:`w-[7.5rem] shrink-0 truncate font-mono text-[11px] font-medium text-sky-600 dark:text-sky-400`,children:e.key}),(0,X.jsx)(`span`,{className:o(`min-w-0 flex-1 break-all font-mono text-[11px] leading-snug`,Jt(e.kind)),title:e.display,children:e.display})]}),(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 font-mono text-[9px] tracking-wide text-muted-foreground uppercase opacity-70`,children:e.kind}),(0,X.jsx)(`div`,{className:`opacity-0 transition-opacity group-hover/field:opacity-100 group-focus-within/field:opacity-100`,children:(0,X.jsx)(Yt,{label:`Copy ${e.key}`,text:kt(e.value),dataSlot:`trace-payload-copy-field`,bare:!0})})]}),n&&i?(0,X.jsx)(`ul`,{"data-slot":`trace-payload-children`,children:e.children?.map(e=>(0,X.jsx)(qt,{row:e,depth:t+1},e.key))}):null]})}function Jt(e){switch(e){case`string`:return`text-teal-800/90 dark:text-teal-300/90`;case`number`:return`text-amber-800 dark:text-amber-300`;case`boolean`:return`text-violet-800 dark:text-violet-300`;case`null`:return`text-muted-foreground italic`;default:return`text-foreground/80`}}function Yt({text:e,label:t,dataSlot:n,bare:o=!1}){let[l,u]=(0,J.useState)(!1),d=async t=>{t.stopPropagation();try{await navigator.clipboard.writeText(e),u(!0),window.setTimeout(()=>u(!1),1200)}catch{u(!1)}};return(0,X.jsxs)(i,{children:[(0,X.jsx)(s,{render:e=>(0,X.jsx)(`button`,{...e,type:`button`,className:o?E:x,"aria-label":l?`Copied`:t,"data-slot":n,onClick:t=>{e.onClick?.(t),d(t)},children:(0,X.jsx)(r,{icon:l?c:te,className:`size-3.5`})})}),(0,X.jsx)(a,{side:`bottom`,className:`text-[11px]`,children:l?`Copied`:t})]})}function Xt(e){return e.effects.some(e=>e.kind===`send`||e.kind===`ask`||e.reversibility===`irreversible`)}function Zt(e){return{rootId:e.id,dryRun:Xt(e)}}async function Qt(e,t=v){return t(Zt(e))}function $t(e){return e.id}function en(e){let t=[{key:`run`,label:`Run`,value:e.id}];return e.parentId&&t.push({key:`parent`,label:`Parent`,value:e.parentId}),t}function tn(e,t){let n=e.findIndex(e=>e.id===t);if(n<0)return{index:-1,total:e.length,previousId:null,nextId:null};let r=n>0?e[n-1]:void 0,i=n<e.length-1?e[n+1]:void 0;return{index:n,total:e.length,previousId:r?.id??null,nextId:i?.id??null}}function nn(e){let t=rn(e),n=we[t];return{icon:n.icon,label:n.label}}function rn(e){switch(e){case`http`:return`http`;case`signal`:return`signal`;case`every`:return`every`;case`cron`:return`cron`;case`cdc`:return`cdc`;case`internal`:return`internal`;default:return`internal`}}function an(e){return e>24}function on(e){let t=[],n=new Map;for(let r of e){let e=`${r.kind}\0${r.resource}`,i=n.get(e);if(i){i.push(r);continue}n.set(e,[r]),t.push(e)}return t.map(e=>{let t=n.get(e),r=t[0],i=0,a=r.external;for(let e of t)i+=e.durationMs,!a&&e.external&&(a=e.external);return{key:e,kind:r.kind,resource:r.resource,bars:t,totalDurationMs:i,...a===void 0?{}:{external:a}}})}function sn(e,t,n){return!Number.isFinite(t)||!Number.isFinite(n)||n<=0?e.map((e,t)=>({index:t,kind:e.kind,resource:e.resource,startOffsetMs:0,durationMs:0,offsetRatio:0,widthRatio:0,...e.external===void 0?{}:{external:e.external}})):e.map((e,r)=>{let i=Number.isFinite(e.timestamp)?e.timestamp-t:0,a=Number.isFinite(e.duration)?Math.max(0,e.duration):0,o=Math.min(n,Math.max(0,i)),s=Math.min(n,Math.max(o,i+a))-o;return{index:r,kind:e.kind,resource:e.resource,startOffsetMs:o,durationMs:s,offsetRatio:o/n,widthRatio:s/n,...e.external===void 0?{}:{external:e.external}}})}var cn=[1,2,4,8];function ln(e,t=0){let n=Number.isFinite(e)&&e>=1?e:1,r=1/n;return{startRatio:Math.min(Number.isFinite(t)?Math.max(0,t):0,Math.max(0,1-r)),widthRatio:r,zoom:n}}function un(e,t,n){let r=e,i=e+t,a=n.startRatio+n.widthRatio;if(i<=n.startRatio||r>=a)return null;let o=Math.max(r,n.startRatio),s=Math.min(i,a);return{left:(o-n.startRatio)/n.widthRatio,width:(s-o)/n.widthRatio}}function dn(e,t=5){if(!Number.isFinite(e)||e<=0)return[0];let n=gn(e,t),r=[0];for(let t=n;t<e-n*.25;t+=n)r.push(Math.round(t*1e3)/1e3);return r[r.length-1]!==e&&r.push(e),r}function fn(e,t,n=5){if(!Number.isFinite(e)||e<=0)return[{offsetMs:0,viewRatio:0,isEnd:!0}];let r=t.startRatio*e,i=t.widthRatio*e,a=dn(i,n).map(e=>r+e),o=Math.min(e,r+i);return a[a.length-1]!==o&&(a[a.length-1]=o),a.map((e,t)=>({offsetMs:e,viewRatio:(e-r)/i,isEnd:t===a.length-1}))}function pn(e,t){if(!Number.isFinite(t)||t<=0)return[];let n=hn(e,t),r=[],i=0;for(let[e,a]of n)e>i&&r.push(mn(i,e,t)),i=Math.max(i,a);return i<t&&r.push(mn(i,t,t)),r.filter(e=>e.durationMs>0&&e.widthRatio>0)}function mn(e,t,n){let r=Math.max(0,e),i=Math.max(0,t-r);return{startOffsetMs:r,durationMs:i,offsetRatio:r/n,widthRatio:i/n}}function hn(e,t){let n=e.map(e=>{let n=Math.max(0,Math.min(t,e.startOffsetMs));return[n,Math.max(n,Math.min(t,e.startOffsetMs+e.durationMs))]}).filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]),r=[];for(let e of n){let t=r[r.length-1];!t||e[0]>t[1]?r.push([e[0],e[1]]):t[1]=Math.max(t[1],e[1])}return r}function gn(e,t){let n=e/Math.max(1,t),r=10**Math.floor(Math.log10(Math.max(n,1e-6))),i=n/r,a;return a=i<=1?1:i<=2?2:i<=5?5:10,a*r}function _n(e){return cn.find(t=>t>e)??cn[cn.length-1]}function vn(e){let t=cn[0];for(let n of cn){if(n>=e)return t;t=n}return t}function yn(e){let t=`${L(e)} · ${e.resource} · ${F(e.durationMs)} · +${F(e.startOffsetMs)}`;if(!e.external)return t;let n=[e.external.host];return e.external.provider&&n.push(e.external.provider),e.external.kind&&n.push(e.external.kind),`${t} · ↗ ${n.join(` · `)}`}var bn=`border-b border-border/60 last:border-b-0`;function xn({run:e,onClose:t,replay:n=v,focusEffectIndex:c=null,onFocusEffectChange:g,playbackKey:_=0,onReplayStart:y,navigationRuns:C,onSelectRun:w}){let E=pe(),D=Ie(),k=e?nn(e.trigger):null,A=e?Ce(e.cache):null,ee=(0,J.useMemo)(()=>e?ye(e):[],[e]),te=(0,J.useMemo)(()=>e?xe(e.gates,E.data??null):[],[e,E.data]),j=(0,J.useMemo)(()=>e?sn(e.effects,e.startedAt,e.durationMs):[],[e]),M=an(j.length),P=(0,J.useMemo)(()=>M?on(j):[],[M,j]),ue=(0,J.useMemo)(()=>e?pn(j,e.durationMs):[],[e,j]),fe=(0,J.useMemo)(()=>e?en(e):[],[e]),F=(0,J.useMemo)(()=>e&&C?tn(C,e.id):null,[e,C]),he=(0,J.useMemo)(()=>e?Ee(E.data??null,e.flow,e.trigger):{method:null,path:null,headline:``},[e,E.data]),[ge,_e]=(0,J.useState)(!1),[ve,I]=(0,J.useState)(null),[be,L]=(0,J.useState)(null),[Se,we]=(0,J.useState)(!0),[Te,Ae]=(0,J.useState)(!0),[je,Me]=(0,J.useState)(!0),[R,z]=(0,J.useState)(null),[B,Pe]=(0,J.useState)(1),[Fe,V]=(0,J.useState)(0),[H,U]=(0,J.useState)(!1),[Le,W]=(0,J.useState)(()=>new Set),G=He(0),K=He(0),q=(0,J.useMemo)(()=>ln(B,Fe),[B,Fe]),ze=(0,J.useMemo)(()=>e?fn(e.durationMs,q):[],[e,q]),Be=Y(G,e=>{let t=un(e,1e-4,q);return t?`${t.left*100}%`:`-10%`});(0,J.useEffect)(()=>{if(I(null),L(null),_e(!1),we(!0),Ae(!0),Me(!0),z(null),Pe(1),V(0),U(!1),W(new Set),G.set(0),!e)return;if(D){K.set(e.durationMs);return}K.set(0);let t=ce(K,e.durationMs,{duration:.6,ease:[.16,1,.3,1]});return()=>t.stop()},[e?.id,D]),(0,J.useEffect)(()=>{if(_===0||!e)return;if(D){G.set(1),K.set(e.durationMs),U(!1);return}U(!0),G.set(0),K.set(0);let t=ce(G,1,{duration:qe(e.durationMs)/1e3,ease:`linear`,onUpdate:t=>K.set(t*e.durationMs),onComplete:()=>{K.set(e.durationMs),U(!1)}});return()=>{t.stop(),U(!1)}},[_]),(0,J.useEffect)(()=>{if(c==null)return;let e=P.find(e=>e.bars.some(e=>e.index===c));!e||e.bars.length<2||W(t=>{if(t.has(e.key))return t;let n=new Set(t);return n.add(e.key),n})},[c,P]);let Ve=e=>{e&&w&&(g?.(null),w(e))},Ue=async t=>{if(t.stopPropagation(),e&&!ge){_e(!0),I(null),L(null);try{let t=await Qt(e,n);if(t.error){I(t.error.message??t.error.code),L(`error`);return}I(t.data?.dryRun?`Replayed (dry-run)`:`Replayed`),L(`ok`),y?.()}catch(e){I(e instanceof Error?e.message:`Replay failed`),L(`error`)}finally{_e(!1)}}};return(0,X.jsx)(l,{open:e!==null,modal:!1,disablePointerDismissal:!0,onOpenChange:e=>{e||t()},children:(0,X.jsx)(d,{side:`left`,showOverlay:!1,"data-slot":`trace-detail-sheet`,className:`inset-y-0 h-dvh w-full max-w-none gap-0 rounded-none p-0 shadow-xl md:left-12! data-[side=left]:sm:max-w-2xl`,children:e&&k?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u,{className:o(`gap-1.5 border-b border-border/60 px-2 py-2`,F&&F.index>=0&&w?`pr-28`:`pr-12`),children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(`span`,{className:`mt-0.5 text-muted-foreground`,title:k.label,"aria-hidden":!0,children:(0,X.jsx)(r,{icon:k.icon,className:S})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(p,{className:`truncate font-mono text-base font-semibold tracking-tight`,children:e.flow}),(0,X.jsxs)(f,{className:`mt-0.5 flex items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:k.label}),A?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsxs)(`span`,{className:o(`inline-flex items-center gap-1`,A.className),"data-slot":`trace-sheet-cache`,"data-cache":e.cache,title:A.label,children:[(0,X.jsx)(r,{icon:A.icon,className:`size-3`,"aria-hidden":!0}),A.label]})]}):null]}),(0,X.jsx)(`div`,{className:`mt-1 flex min-w-0 flex-col gap-0.5`,"data-slot":`trace-sheet-ids`,children:fe.map(e=>(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,"data-slot":`trace-sheet-id`,"data-id":e.key,children:[(0,X.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:e.label}),(0,X.jsx)(`code`,{className:`min-w-0 truncate font-mono text-[11px] leading-none text-foreground/80`,title:e.value,children:e.value}),(0,X.jsx)(ke,{value:e.value,label:`Copy ${e.label} ID`})]},e.key))})]}),F&&F.index>=0&&w?(0,X.jsxs)(`div`,{className:`absolute top-3 right-12 flex items-center`,"data-slot":`trace-sheet-nav`,role:`group`,"aria-label":`Trace navigation`,children:[(0,X.jsxs)(i,{children:[(0,X.jsx)(s,{render:e=>(0,X.jsx)(`button`,{...e,type:`button`,className:`inline-flex size-7 items-center justify-center text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40`,"aria-label":`Previous trace`,"data-slot":`trace-sheet-previous`,disabled:F.previousId===null,onClick:t=>{e.onClick?.(t),Ve(F.previousId)},children:(0,X.jsx)(r,{icon:de,className:`size-5`})})}),(0,X.jsx)(a,{side:`bottom`,children:`Previous trace`})]}),(0,X.jsxs)(i,{children:[(0,X.jsx)(s,{render:e=>(0,X.jsx)(`button`,{...e,type:`button`,className:`inline-flex size-7 items-center justify-center text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40`,"aria-label":`Next trace`,"data-slot":`trace-sheet-next`,disabled:F.nextId===null,onClick:t=>{e.onClick?.(t),Ve(F.nextId)},children:(0,X.jsx)(r,{icon:N,className:`size-5`})})}),(0,X.jsx)(a,{side:`bottom`,children:`Next trace`})]})]}):null]}),(0,X.jsx)(oe,{mode:`wait`,children:ve?(0,X.jsx)(Ne.div,{initial:!D&&{opacity:0,y:-4,scale:.96},animate:{opacity:1,y:0,scale:1},exit:D?void 0:{opacity:0,y:-4,scale:.96},transition:{duration:.18,ease:`easeOut`},children:(0,X.jsx)(ne,{variant:`outline`,role:`status`,className:o(`h-5 w-fit rounded-md px-1.5 text-[10px] font-medium`,be===`ok`&&`border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400`,be===`error`&&`border-destructive/40 bg-destructive/10 text-destructive`),children:ve})},ve):null})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-0 overflow-y-auto p-0`,children:[(0,X.jsx)(`section`,{className:bn,"data-slot":`trace-summary`,children:(0,X.jsx)(Dn,{chips:ee,durationMs:e.durationMs,durationValue:K})}),te.length>0?(0,X.jsx)(`section`,{className:bn,"data-slot":`trace-gates`,children:(0,X.jsx)(De,{gates:te})}):null,(0,X.jsxs)(`section`,{className:bn,"data-slot":`trace-waterfall`,children:[(0,X.jsxs)(`div`,{className:O,children:[(0,X.jsxs)(`h3`,{className:o(h,`flex items-center gap-2 px-2`),children:[`Waterfall`,M?(0,X.jsxs)(`span`,{className:b,children:[P.length,` `,P.length===1?`lane`:`lanes`]}):null]}),(0,X.jsxs)(`div`,{className:`ml-auto flex h-full items-stretch`,"data-slot":`trace-waterfall-zoom`,children:[(0,X.jsx)(`button`,{type:`button`,className:x,"aria-label":`Pan left`,disabled:B<=1||q.startRatio<=0,onClick:()=>V(e=>ln(B,Math.max(0,e-q.widthRatio*.5)).startRatio),children:(0,X.jsx)(r,{icon:le,className:`size-3.5`})}),(0,X.jsx)(`button`,{type:`button`,className:x,"aria-label":`Zoom out`,disabled:B<=1,onClick:()=>{let e=vn(B);Pe(e),V(t=>ln(e,t).startRatio)},children:(0,X.jsx)(r,{icon:Re,className:`size-3.5`})}),(0,X.jsxs)(`span`,{className:`flex min-w-8 items-center justify-center font-mono text-[10px] tabular-nums text-muted-foreground`,children:[B,`×`]}),(0,X.jsx)(`button`,{type:`button`,className:x,"aria-label":`Zoom in`,disabled:B>=8,onClick:()=>{let e=_n(B);Pe(e),V(t=>ln(e,t).startRatio)},children:(0,X.jsx)(r,{icon:Oe,className:`size-3.5`})}),(0,X.jsx)(`button`,{type:`button`,className:x,"aria-label":`Pan right`,disabled:B<=1||q.startRatio+q.widthRatio>=1,onClick:()=>V(e=>ln(B,e+q.widthRatio*.5).startRatio),children:(0,X.jsx)(r,{icon:se,className:`size-3.5`})})]})]}),j.length===0?(0,X.jsx)(`p`,{className:`px-2 py-2 text-[11px] text-muted-foreground`,children:`No effects recorded`}):(0,X.jsxs)(`div`,{className:`relative flex flex-col gap-1.5 px-2 py-2`,children:[(0,X.jsx)(jn,{ticks:ze}),(0,X.jsx)(Mn,{bars:j,gaps:ue,view:q,hoverIndex:R,onHover:z,onSelect:e=>g?.(c===e?null:e),focusIndex:c}),M?(0,X.jsx)(`div`,{className:`flex max-h-72 flex-col overflow-y-auto`,"data-slot":`trace-waterfall-lanes`,children:P.map(e=>(0,X.jsx)(Pn,{lane:e,view:q,hoverIndex:R,focusIndex:c,progress:G,playing:H,onHover:z,onSelect:e=>g?.(c===e?null:e)},e.key))}):j.map(e=>(0,X.jsx)(Fn,{bar:e,view:q,dimmed:R!==null&&R!==e.index,focused:c===e.index,progress:G,playing:H,onHover:z,onSelect:e=>g?.(c===e?null:e)},e.index)),H?(0,X.jsx)(Ne.div,{className:`pointer-events-none absolute top-4 bottom-0 w-px bg-foreground/70`,style:{left:Be},"data-slot":`trace-waterfall-playhead`,"aria-hidden":!0}):null,ue.length>0?(0,X.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Hatched spans are idle time — no effects recorded.`}):null]})]}),(0,X.jsx)(`section`,{className:bn,"data-slot":`trace-events-section`,children:(0,X.jsxs)(ae,{open:Se,onOpenChange:we,children:[(0,X.jsxs)(`div`,{className:O,children:[(0,X.jsxs)(ie,{className:o(m,`min-w-0 flex-1 justify-start`),"data-slot":`trace-events-toggle`,children:[(0,X.jsx)(r,{icon:N,className:o(T,!Se&&`-rotate-90`)}),(0,X.jsx)(`span`,{className:`truncate`,children:`Event Details`}),(0,X.jsxs)(`span`,{className:b,children:[e.effects.length,` `,e.effects.length===1?`event`:`events`]})]}),(0,X.jsxs)(`button`,{type:`button`,className:m,disabled:ge,"data-slot":`trace-sheet-replay`,onClick:e=>void Ue(e),children:[(0,X.jsx)(r,{icon:me,className:`size-3.5`}),`Replay`]})]}),(0,X.jsx)(re,{children:(0,X.jsx)(`ul`,{className:`flex flex-col`,"data-slot":`trace-events`,children:M?P.map(t=>(0,X.jsx)(Tn,{lane:t,effects:e.effects,open:Le.has(t.key),onToggle:()=>W(e=>{let n=new Set(e);return n.has(t.key)?n.delete(t.key):n.add(t.key),n}),focusIndex:c,hoverIndex:R,progress:G,playing:H,onHover:z,onSelect:e=>g?.(c===e?null:e)},t.key)):e.effects.map((e,t)=>(0,X.jsx)(wn,{effect:e,index:t,bar:j[t],focused:c===t,hovered:R===t,progress:G,playing:H,onHover:z,onSelect:e=>g?.(c===e?null:e)},`${e.kind}:${e.resource}:${t}`))})})]})}),(0,X.jsx)(Rt,{method:he.method,path:he.path,headline:he.headline,input:e.input,output:e.output,http:e.http??null,error:e.error,errorMessage:e.errorMessage,inputOpen:Te,onInputOpenChange:Ae,outputOpen:je,onOutputOpenChange:Me})]})]}):null})})}function Sn(e){return e?` · ↗ ${e.host}${e.kind?` (${e.kind})`:``}`:``}function Cn({effect:e}){let t=pe(),n=new Set(Object.keys(t.data?.ai?.agents??{})),r=Te(e,n);return r?(0,X.jsx)(`a`,{href:r,"data-slot":`trace-effect-link`,onClick:e=>e.stopPropagation(),children:e.resource}):(0,X.jsx)(X.Fragment,{children:e.resource})}function wn({effect:e,index:t,bar:n,focused:r,hovered:i,progress:a,playing:s,onHover:c,onSelect:l}){return(0,X.jsxs)(`li`,{"data-slot":`trace-event-row`,"data-index":t,"data-focused":r?`true`:`false`,"data-external":e.external?`true`:void 0,className:o(y,`cursor-pointer flex-col items-stretch gap-1 text-[11px]`,r&&`bg-muted/70 text-foreground`,i&&!r&&`bg-muted/50`),onClick:()=>l(t),onMouseEnter:()=>c(t),onMouseLeave:()=>c(null),children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:o(C,r&&`bg-sky-500`)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(En,{kind:e.kind,resource:e.resource}),(0,X.jsx)(`span`,{className:`w-[4.5rem] shrink-0 font-medium text-foreground/90`,children:L(e)}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-muted-foreground`,children:[(0,X.jsx)(Cn,{effect:e}),Sn(e.external)]}),(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:F(e.duration)})]}),n?(0,X.jsx)(`div`,{className:`relative ml-7 h-1.5 w-[calc(100%-1.75rem)] rounded-full bg-muted/70`,"data-slot":`trace-event-bar-track`,"aria-hidden":!0,children:(0,X.jsx)(In,{bar:n,left:n.offsetRatio,width:n.widthRatio,progress:a,playing:s,slot:`trace-event-bar`})}):null]})}function Tn({lane:e,effects:t,open:n,onToggle:i,focusIndex:a,hoverIndex:s,progress:c,playing:l,onHover:u,onSelect:d}){let f=e.bars.length===1?e.bars[0]:void 0;if(f){let e=t[f.index];return e?(0,X.jsx)(wn,{effect:e,index:f.index,bar:f,focused:a===f.index,hovered:s===f.index,progress:c,playing:l,onHover:u,onSelect:d}):null}let p=a!==null&&e.bars.some(e=>e.index===a);return(0,X.jsxs)(`li`,{"data-slot":`trace-event-lane`,"data-open":n?`true`:`false`,children:[(0,X.jsxs)(`button`,{type:`button`,className:o(w,p&&`bg-muted/70 text-foreground`),onClick:i,children:[(0,X.jsx)(r,{icon:N,className:o(T,!n&&`-rotate-90`)}),(0,X.jsx)(En,{kind:e.kind,resource:e.resource}),(0,X.jsx)(`span`,{className:`w-[4.5rem] shrink-0 font-medium text-foreground/90`,children:L(e)}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-muted-foreground`,children:[(0,X.jsx)(Cn,{effect:e}),Sn(e.external)]}),(0,X.jsxs)(`span`,{className:b,children:[`×`,e.bars.length]}),(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:F(e.totalDurationMs)})]}),n?(0,X.jsx)(`ul`,{className:`max-h-64 overflow-y-auto`,"data-slot":`trace-event-lane-items`,children:e.bars.map(e=>{let n=t[e.index];return n?(0,X.jsx)(wn,{effect:n,index:e.index,bar:e,focused:a===e.index,hovered:s===e.index,progress:c,playing:l,onHover:u,onSelect:d},e.index):null})}):null]})}function En({kind:e,resource:t}){let n=be(e);return(0,X.jsx)(`span`,{className:S,style:{color:n},"aria-hidden":!0,children:(0,X.jsx)(r,{icon:Se(e,t),className:`size-3.5`})})}function Dn({chips:e,durationMs:t,durationValue:n}){let c=e.find(e=>e.variant===`duration`),l=e.filter(e=>e.variant!==`duration`),u=Y(n,e=>F(Math.round(e)));return(0,X.jsxs)(`div`,{className:O,"data-slot":`trace-summary-strip`,role:`group`,"aria-label":`Run summary`,children:[c?(0,X.jsxs)(i,{children:[(0,X.jsx)(s,{render:e=>(0,X.jsxs)(`div`,{...e,className:`flex h-full shrink-0 items-center gap-1.5 px-2`,"data-slot":`trace-summary-duration`,children:[(0,X.jsx)(r,{icon:ge,className:o(`size-3.5`,fe(t)),"aria-hidden":!0}),(0,X.jsx)(Ne.span,{className:o(`font-mono text-sm font-semibold tracking-tight tabular-nums leading-none`,fe(t)),children:u})]})}),(0,X.jsx)(a,{side:`bottom`,className:`max-w-xs text-[11px]`,children:c.detail})]}):null,l.length>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`w-px shrink-0 self-stretch bg-border/60`,"aria-hidden":!0}),(0,X.jsx)(`ul`,{className:`flex h-full min-w-0 flex-1 flex-nowrap items-stretch overflow-x-auto overscroll-x-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:l.map(e=>(0,X.jsx)(`li`,{className:`list-none shrink-0`,children:(0,X.jsx)(On,{chip:e})},e.key))})]}):null]})}function On({chip:e}){let t=An(e.variant),n=kn(e.variant);return(0,X.jsxs)(i,{children:[(0,X.jsx)(s,{render:i=>(0,X.jsxs)(`span`,{...i,className:o(m,`text-foreground/90`),"data-slot":`trace-summary-chip`,"data-variant":e.variant,children:[(0,X.jsx)(`span`,{style:{color:t},"aria-hidden":!0,children:(0,X.jsx)(r,{icon:n,className:`size-3`})}),(0,X.jsx)(`span`,{className:`tabular-nums font-medium`,children:e.shortLabel}),(0,X.jsx)(`span`,{className:`sr-only`,children:e.label})]})}),(0,X.jsxs)(a,{side:`bottom`,className:`max-w-xs flex-col items-start gap-0.5 text-[11px]`,children:[(0,X.jsx)(`p`,{className:`font-medium text-background`,children:e.label}),(0,X.jsx)(`p`,{className:`text-background/70`,children:e.detail})]})]})}function kn(e){switch(e){case`duration`:return ge;case`api`:return A;case`gate`:return j.gate.icon;case`cache`:return _e;case`db`:return j.store.icon;case`logs`:return ue;default:return Se(e)}}function An(e){switch(e){case`duration`:return`currentColor`;case`api`:return`var(--foreground)`;case`gate`:return I.gate.accent;case`cache`:return`var(--color-sky-500)`;case`db`:return I.store.accent;case`logs`:return`var(--muted-foreground)`;default:return be(e)}}function jn({ticks:e}){return(0,X.jsx)(`div`,{className:`relative h-4 w-full border-b border-border/60`,"data-slot":`trace-waterfall-ruler`,children:e.map(e=>(0,X.jsxs)(`div`,{className:`absolute top-0 flex h-full flex-col items-center`,style:{left:`${e.viewRatio*100}%`,transform:e.isEnd?`translateX(-100%)`:e.viewRatio===0?`none`:`translateX(-50%)`},children:[(0,X.jsx)(`span`,{className:`font-mono text-[9px] tabular-nums text-muted-foreground`,children:F(e.offsetMs)}),(0,X.jsx)(`span`,{className:`mt-auto h-1.5 w-px bg-border`,"aria-hidden":!0})]},`${e.offsetMs}-${e.viewRatio}`))})}function Mn({bars:e,gaps:t,view:n,hoverIndex:r,onHover:c,onSelect:l,focusIndex:u}){return(0,X.jsxs)(`div`,{className:`relative h-3 w-full overflow-hidden rounded-full bg-muted/50`,"data-slot":`trace-waterfall-overview`,children:[t.map(e=>{let t=un(e.offsetRatio,e.widthRatio,n);return!t||t.width<=0?null:(0,X.jsx)(Nn,{left:t.left,width:t.width,gap:e},`gap-${e.startOffsetMs}`)}),e.map(e=>{let t=un(e.offsetRatio,e.widthRatio,n);if(!t||t.width<=0)return null;let d=u===e.index;return(0,X.jsxs)(i,{children:[(0,X.jsx)(s,{render:n=>(0,X.jsx)(`div`,{...n,className:o(`absolute inset-y-0.5 cursor-pointer rounded-full transition-opacity`,r!==null&&r!==e.index&&!d&&`opacity-35`,d&&`ring-1 ring-foreground/40`,e.external&&`outline outline-1 outline-dashed outline-foreground/50`),style:{left:`${t.left*100}%`,width:`${Math.max(t.width*100,.4)}%`,backgroundColor:be(e.kind)},"data-slot":`trace-waterfall-overview-bar`,"data-external":e.external?`true`:void 0,onClick:t=>{t.stopPropagation(),l?.(e.index)},onMouseEnter:t=>{n.onMouseEnter?.(t),c(e.index)},onMouseLeave:e=>{n.onMouseLeave?.(e),c(null)}})}),(0,X.jsx)(a,{side:`top`,className:`max-w-xs font-mono text-[11px]`,children:yn(e)})]},`ov-${e.index}`)})]})}function Nn({left:e,width:t,gap:n}){return(0,X.jsxs)(i,{children:[(0,X.jsx)(s,{render:n=>(0,X.jsx)(`div`,{...n,className:`absolute inset-y-0 overflow-hidden rounded-sm`,style:{left:`${e*100}%`,width:`${t*100}%`},"data-slot":`trace-waterfall-gap`,children:(0,X.jsx)(`div`,{className:`size-full opacity-70`,style:{backgroundImage:`repeating-linear-gradient(-45deg, color-mix(in oklab, var(--muted-foreground) 28%, transparent) 0 1px, transparent 1px 5px)`},"aria-hidden":!0})})}),(0,X.jsxs)(a,{side:`top`,className:`max-w-xs text-[11px]`,children:[`Idle · `,F(n.durationMs),` — no effects recorded`]})]})}function Pn({lane:e,view:t,hoverIndex:n,focusIndex:r,progress:c,playing:l,onHover:u,onSelect:d}){let f=n!==null&&e.bars.some(e=>e.index===n)||r!==null&&e.bars.some(e=>e.index===r);return(0,X.jsxs)(`div`,{className:o(`flex flex-col gap-1 border-b border-border/60 px-2 py-1.5 last:border-b-0`,f&&`bg-muted/50`),"data-slot":`trace-waterfall-lane`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,X.jsx)(En,{kind:e.kind,resource:e.resource}),(0,X.jsx)(`span`,{className:`w-[4.5rem] shrink-0 font-medium text-foreground/90`,children:L(e)}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-muted-foreground`,children:[(0,X.jsx)(Cn,{effect:e}),Sn(e.external)]}),(0,X.jsxs)(`span`,{className:b,children:[`×`,e.bars.length]}),(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:F(e.totalDurationMs)})]}),(0,X.jsx)(`div`,{className:`relative ml-7 h-2 w-[calc(100%-1.75rem)] rounded-full bg-muted/70`,"data-slot":`trace-waterfall-lane-track`,children:e.bars.map(e=>{let o=un(e.offsetRatio,e.widthRatio,t);if(!o||o.width<=0)return null;let f=r===e.index;return(0,X.jsxs)(i,{children:[(0,X.jsx)(s,{render:t=>(0,X.jsx)(`div`,{...t,className:`absolute inset-y-0 cursor-pointer`,style:{left:`${o.left*100}%`,width:`${Math.max(o.width*100,.4)}%`},onClick:t=>{t.stopPropagation(),d?.(e.index)},onMouseEnter:n=>{t.onMouseEnter?.(n),u(e.index)},onMouseLeave:e=>{t.onMouseLeave?.(e),u(null)},children:(0,X.jsx)(In,{bar:e,left:0,width:1,progress:c,playing:l,dimmed:n!==null&&n!==e.index&&!f,focused:f,slot:`trace-waterfall-bar`})})}),(0,X.jsx)(a,{side:`top`,className:`max-w-xs font-mono text-[11px]`,children:yn(e)})]},e.index)})})]})}function Fn({bar:e,view:t,dimmed:n,focused:r,progress:o,playing:c,onHover:l,onSelect:u}){let d=un(e.offsetRatio,e.widthRatio,t);return!d||d.width<=0?null:(0,X.jsxs)(i,{children:[(0,X.jsx)(s,{render:t=>(0,X.jsx)(`div`,{...t,className:`relative h-2.5 w-full cursor-pointer rounded-full bg-muted/70`,"data-slot":`trace-waterfall-track`,"data-index":e.index,onClick:t=>{t.stopPropagation(),u?.(e.index)},onMouseEnter:n=>{t.onMouseEnter?.(n),l(e.index)},onMouseLeave:e=>{t.onMouseLeave?.(e),l(null)},children:(0,X.jsx)(In,{bar:e,left:d.left,width:d.width,progress:o,playing:c,dimmed:n,focused:r,slot:`trace-waterfall-bar`})})}),(0,X.jsx)(a,{side:`top`,className:`max-w-xs font-mono text-[11px]`,children:yn(e)})]})}function In({bar:e,left:t,width:n,progress:r,playing:i,dimmed:a=!1,focused:s=!1,slot:c}){let l=Math.max(e.widthRatio,.02),u=Y(r,[e.offsetRatio,e.offsetRatio+l],[0,1],{clamp:!0}),d=Y(r,t=>t>=e.offsetRatio?1:.25),f=i;return(0,X.jsx)(Ne.div,{className:o(`absolute inset-y-0 rounded-full transition-opacity`,!f&&a&&!s&&`opacity-35`,s&&`ring-1 ring-foreground/40`,e.external&&`outline outline-1 outline-dashed outline-foreground/50`),style:{left:`${t*100}%`,width:`${Math.max(n*100,.5)}%`,backgroundColor:be(e.kind),transformOrigin:`left`,...f?{scaleX:u,opacity:d}:{}},"data-slot":c,"data-external":e.external?`true`:void 0})}export{qe as a,He as c,Xe as i,nn as n,Je as o,$t as r,Y as s,xn as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n,f as r}from"./xyflow-yApv7D4e.js";import{$ as i,$n as a,A as o,B as s,Bn as c,Bt as l,Ct as u,D as d,E as f,Et as p,Gn as m,H as h,Ht as g,In as _,Jn as v,Jt as y,Kn as b,Kt as x,M as S,Mn as C,N as w,O as T,On as E,Ot as D,P as O,Q as k,Qn as A,Qt as j,S as M,St as N,Tt as P,U as F,Un as I,Ut as L,V as R,Wn as z,Wt as ee,Xt as te,Yt as ne,Zn as re,Zt as B,_n as ie,bn as V,dn as ae,dt as oe,er as H,ft as se,g as ce,gn as U,ht as W,in as le,j as ue,jn as G,k as de,lt as fe,mn as pe,mt as me,nn as K,pt as he,qn as ge,qt as _e,rr as ve,st as ye,un as be,v as xe,yt as Se,z as Ce}from"./shortcut-keys-DTE1sjTC.js";import{C as we,D as Te,K as Ee,Q as De,S as Oe,W as ke,X as Ae,Z as je,_ as Me,d as Ne,g as Pe,u as Fe,w as Ie,yt as q}from"./explorer-chrome-Dslh2yE8.js";import{i as Le}from"./call-pii-button-L9JxdBhp.js";import{m as Re,s as ze}from"./element-icons-C6t8Vlml.js";import{t as Be}from"./UserIcon-DaE2PB5_.js";import{t as Ve}from"./dagre.esm-B1_XeuLP.js";import{_ as He,b as Ue,f as We,g as Ge,h as Ke,m as qe,p as Je,x as Ye,y as Xe}from"./dropdown-menu-CRGrj5JU.js";import{Mt as Ze,ht as Qe}from"./index-RhV2jT_7.js";var $e=[[`path`,{d:`M8 7H16.75C18.8567 7 19.91 7 20.6667 7.50559C20.9943 7.72447 21.2755 8.00572 21.4944 8.33329C22 9.08996 22 10.1433 22 12.25C22 15.7612 22 17.5167 21.1573 18.7779C20.7926 19.3238 20.3238 19.7926 19.7779 20.1573C18.5167 21 16.7612 21 13.25 21H12C7.28595 21 4.92893 21 3.46447 19.5355C2 18.0711 2 15.714 2 11V7.94427C2 6.1278 2 5.21956 2.38032 4.53806C2.65142 4.05227 3.05227 3.65142 3.53806 3.38032C4.21956 3 5.1278 3 6.94427 3C8.10802 3 8.6899 3 9.19926 3.19101C10.3622 3.62712 10.8418 4.68358 11.3666 5.73313L12 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}]],et=[[`path`,{d:`M18 19C18 19 13.5811 14 12 14C10.4188 14 6 19 6 19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 5.00004C18 5.00004 13.5811 9.99999 12 10C10.4188 10 6 5 6 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],tt=[[`path`,{d:`M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]];function nt(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=D(),a=Se()!=null,o=re(()=>new oe({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new k,floatingId:i,syncOnly:!1,nested:a})).current;return m(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=C(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var J=e(t(),1);function rt(e){let[t,n]=J.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var Y=n();function X(e){return e.kind===`index`||e.kind===`function`||e.kind===`trigger`||e.kind===`extension`||e.kind===`policy`?e.kind:null}function it(e){return X(e)!==null}function at(e){return e.kind===`table`&&typeof e.rls==`boolean`}function ot(e,t,n){return typeof e.rlsPolicyCount==`number`?e.rlsPolicyCount:Object.keys(t?.stores?.[n]?.tables?.[e.name]?.policies??{}).length}function st(e){let t=X(e);return t===`index`?`Indexes`:t===`function`?`Functions`:t===`trigger`?`Triggers`:t===`extension`?`Extensions`:t===`policy`?`RLS Policies`:e.name}function ct(e){let t=[],n=[];for(let r of e)it(r)?n.push(r):t.push(r);return{tables:t,catalog:n}}function lt(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var ut=[`console.store.query`];function dt(e,t,n){if(!e||!n||!t)return;let r=t[1];if(pt(r)&&r.ref===n.ref&&(r.child??``)===(n.child??``)&&(r.tenant??``)===(n.tenant??``))return e}function ft(e,t){return ve({queryKey:[...ut,e],enabled:t&&e!==null,placeholderData:(t,n)=>dt(t,n?.queryKey,e),queryFn:async()=>{if(!e)throw Error(`Missing store query input`);let t=await q(e);if(t.error)throw Error(ke(t.error));if(!t.data)throw Error(`Empty store query`);return t.data}})}function pt(e){return typeof e==`object`&&!!e&&`ref`in e&&typeof e.ref==`string`}function mt(e){let t=J.useRef(!0);t.current&&(t.current=!1,e())}var ht=J.createContext(void 0),gt=J.createContext(void 0),_t=J.createContext(void 0);function Z(){let e=J.useContext(ht);if(e===void 0)throw Error(z(60));return e}function vt(){let e=J.useContext(gt);if(e===void 0)throw Error(z(101));return e}function yt(){let e=J.useContext(_t);if(e===void 0)throw Error(z(61));return e}function bt(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var xt=(e,t)=>Object.is(e,t);function St(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ct(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!bt(e,t,(e,t)=>St(e,t,n)):e!==t}function wt(e,t,n){return e?e.some(e=>e!==void 0&&St(t,e,n)):!1}function Tt(e,t,n){return e?e.findIndex(e=>e!==void 0&&St(e,t,n)):-1}function Et(e,t){if(t!==xt)return n=>wt(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function Dt(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(Et(t,n)):Tt(e,t,n);return i===-1?null:i}function Ot(e,t,n,r,i,a){return wt(r,t,i)?a!=null&&e>a&&wt(r,n[a],i)?a:e:e===a?Dt(n,r,i,!0):a}function kt(e,t,n){return e.filter(e=>!St(t,e,n))}function At(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function jt(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function Mt(e){return jt(e?.[0])}function Nt(e){return Mt(e)?e.flatMap(e=>e.items):e}function Pt(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Mt(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Ft(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return At(e)}function It(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?At(e.value):At(e)}function Lt(e,t,n){function r(){return Ft(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=Nt(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Rt(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Y.jsx)(J.Fragment,{children:Lt(r,t,n)},i)),e),[])}var zt={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:It(t,r)!==``},hasNullItemLabel:(e,t)=>t?Pt(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>St(t,e,n)):St(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function Bt(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function Vt(e,t){return Math.max(0,e-t)}function Ht(e,t){if(t<=0)return 0;let n=Bt(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Ut(e){let{id:t,value:n,defaultValue:r=null,onValueChange:a,open:s,defaultOpen:c=!1,onOpenChange:l,name:u,form:f,autoComplete:h,disabled:_=!1,readOnly:x=!1,required:C=!1,modal:E=!0,actionsRef:D,inputRef:O,onOpenChangeComplete:k,items:A,multiple:j=!1,itemToStringLabel:M,itemToStringValue:N,isItemEqualToValue:P=xt,highlightItemOnHover:F=!0,children:I}=e,{clearErrors:R}=S(),{setDirty:z,setTouched:ee,setFocused:te,validityData:ie,setFilled:V,name:ae,disabled:oe,validation:H,validationMode:ce}=w(),U=o({id:t}),W=oe||_,ue=ae??u,[G,pe]=de({controlled:n,default:j?r??b:r,name:`Select`,state:`value`}),[K,he]=de({controlled:s,default:c,name:`Select`,state:`open`}),ve=J.useRef([]),be=J.useRef([]),xe=J.useRef(null),Se=J.useRef(null),Ce=J.useRef(0),we=J.useRef(null),Te=J.useRef([]),Ee=J.useRef(!1),De=J.useRef(null),Oe=J.useRef(null),ke=J.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Ae=J.useRef(!1),je=J.useRef(G),{mounted:Me,setMounted:Ne,transitionStatus:Pe}=fe(K),{openMethod:Fe,triggerProps:Ie}=He(K),q=re(()=>new se({id:U,labelId:void 0,modal:E,multiple:j,itemToStringLabel:M,itemToStringValue:N,isItemEqualToValue:P,value:G,open:K,mounted:Me,transitionStatus:Pe,items:A,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:ge,triggerProps:ge,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:v,setOpen:v,handleScrollArrowVisibility:v,onOpenChangeComplete:v,listRef:ve,popupRef:xe,scrollHandlerRef:Se,scrollArrowsMountedCountRef:Ce,valueRef:we,valuesRef:Te,labelsRef:be,typingRef:Ee,selectionRef:ke,firstItemTextRef:De,selectedItemTextRef:Oe,alignItemWithTriggerActiveRef:Ae,initialValueRef:je},zt)).current,Le=q.useState(`activeIndex`),Re=q.useState(`selectedIndex`),ze=q.useState(`triggerElement`),Be=q.useState(`positionerElement`),Ve=rt(Fe),We=Fe??Ve,Ge=J.useMemo(()=>j?``:It(G,N),[j,G,N]),Ke=J.useMemo(()=>j&&Array.isArray(G)?G.map(e=>It(e,N)):It(G,N),[j,G,N]),qe=y(ze),Je=_e(()=>Ke);T(qe,U,G,Je,!W,u);let Ze=j?Array.isArray(G)&&G.length>0:G!=null&&Ge!==``;m(()=>{V(Ze)},[Ze,V]),m(function(){let e=Dt(Te.current,G,P,j);e===null&&(Oe.current=null),!K&&q.set(`selectedIndex`,e)},[j,K,G,P,q]),d(G,()=>{R(ue),z(Ct(G,ie.initialValue,P)),H.change(G)});let Qe=_e((e,t)=>{l?.(e,t),!t.isCanceled&&(he(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(ee(!0),te(!1),ce===`onBlur`&&H.commit(G)))}),$e=_e(()=>{Ne(!1),q.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),k?.(!1)});ye({enabled:!D,open:K,ref:xe,onComplete(){K||$e()}}),J.useImperativeHandle(D,()=>({unmount:$e}),[$e]);let et=_e((e,t)=>{a?.(e,t),!t.isCanceled&&pe(e)}),tt=_e(e=>{let t=Vt(e.scrollHeight,e.clientHeight),n=Ht(e.scrollTop,t),r=n>0,i=n<t;q.set(`scrollUpArrowVisible`,r),q.set(`scrollDownArrowVisible`,i)}),X=nt({open:K,onOpenChange:Qe,elements:{reference:ze,floating:Be}}),it=Ye(X,{enabled:!W,event:`mousedown`}),at=me(X),ot=Ue(X,{enabled:!W,listRef:ve,activeIndex:Le,selectedIndex:Re,disabledIndices:b,onNavigate(e){(e!==null||K)&&q.set(`activeIndex`,e)},focusItemOnHover:F}),st=Xe(X,{enabled:!W&&(K||!x&&!j),listRef:be,activeIndex:Le,selectedIndex:Re,disabledIndices:e=>lt(ve.current[e]),onMatch(e){K?q.set(`activeIndex`,e):et(Te.current[e],B(le))},onTyping(e){Ee.current=e}}),ct=J.useMemo(()=>p(st.reference,ot.reference,at.reference,it.reference,Ie),[it.reference,st.reference,ot.reference,at.reference,Ie]),ut=J.useMemo(()=>p(i,st.floating,ot.floating,at.floating),[st.floating,ot.floating,at.floating]),dt=ot.item??ge;q.useContextCallback(`setValue`,et),q.useContextCallback(`setOpen`,Qe),q.useContextCallback(`handleScrollArrowVisibility`,tt),q.useContextCallback(`onOpenChangeComplete`,k),mt(()=>{q.update({popupProps:ut,triggerProps:ct})}),q.useSyncedValues({id:U,modal:E,multiple:j,value:G,open:K,mounted:Me,transitionStatus:Pe,popupProps:ut,triggerProps:ct,items:A,itemToStringLabel:M,itemToStringValue:N,isItemEqualToValue:P,openMethod:We});let ft=J.useMemo(()=>({disabled:W,readOnly:x,required:C,multiple:j,highlightItemOnHover:F,itemProps:dt}),[W,x,C,j,F,dt]),pt=ne(O,H.inputRef),Z=j?void 0:ue,vt=J.useMemo(()=>!j||!Array.isArray(G)||!ue?null:G.map(e=>{let t=It(e,N);return(0,Y.jsx)(`input`,{type:`hidden`,form:f,name:ue,value:t,disabled:W},t)}),[j,G,f,ue,N,W]);return(0,Y.jsxs)(ht.Provider,{value:q,children:[(0,Y.jsx)(gt.Provider,{value:ft,children:(0,Y.jsx)(_t.Provider,{value:X,children:I})}),(0,Y.jsx)(`input`,{...H.getValidationProps(W,{onFocus(){q.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||W||x)return;let t=e.currentTarget.value,n=B(le,e.nativeEvent);function r(){if(j)return;let e=t.toLowerCase(),r=Te.current.findIndex(t=>It(t,N).toLowerCase()===e||Ft(t,M).toLowerCase()===e);r===-1&&(r=Te.current.findIndex((t,n)=>{let r=be.current[n];return r!=null&&r.toLowerCase()===e}));let i=Te.current[r];i!=null&&et(i,n)}q.set(`forceMount`,!0),queueMicrotask(r)}}),id:U&&Z==null?`${U}-hidden-input`:void 0,form:f,name:Z,autoComplete:h,value:Ge,disabled:W,required:C&&!(j&&Ze),readOnly:x,ref:pt,style:ue?L:g,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),vt]})}function Wt(e,t){return e??t}var Gt=`data-popup-side`,Kt=400,qt={...U,...O,popupSide:e=>e?{[Gt]:e}:null,value:()=>null},Jt=J.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:s=!0,style:c,...l}=e,{setTouched:u,setFocused:d,validationMode:f,validation:m,state:h,disabled:g}=w(),{labelId:_}=ue(),v=Z(),{readOnly:b,required:x,disabled:S}=vt(),C=g||S||a,T=v.useState(`open`),D=v.useState(`mounted`),O=v.useState(`value`),k=v.useState(`triggerProps`),A=v.useState(`positionerElement`),N=v.useState(`listElement`),F=v.useState(`popupSide`),L=v.useState(`id`),R=v.useState(`labelId`),z=v.useState(`hasSelectedValue`),te=D&&A?F:null,ne=i??L,re=Wt(_,R);o({id:i});let ie=y(A),V=J.useRef(null),{getButtonProps:oe,buttonRef:H}=M({disabled:C,native:s}),se=v.useStateSetter(`triggerElement`),ce=I(),U=I(),W=I();J.useEffect(()=>{if(T)return W.start(Kt,()=>{v.context.selectionRef.current.allowUnselectedMouseUp=!0,v.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{W.clear()};v.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[T,v,U,W]);let G=p(k,{id:ne,role:`combobox`,"aria-expanded":T,"aria-haspopup":`listbox`,"aria-controls":T?N?.id??ae(A)?.id:void 0,"aria-labelledby":re,"aria-readonly":b||void 0,"aria-required":x||void 0,tabIndex:C?-1:0,onFocus(e){d(!0),T&&v.context.alignItemWithTriggerActiveRef.current&&v.context.setOpen(!1,B(le,e.nativeEvent)),ce.start(0,()=>{v.set(`forceMount`,!0)})},onBlur(e){E(A,e.relatedTarget)||(u(!0),d(!1),f===`onBlur`&&m.commit(O))},onMouseDown(e){if(T)return;let t=ee(e.currentTarget);function n(e){if(!V.current)return;let t=e.target;E(V.current,t)||E(ie.current,t)||We(e,V.current)||v.context.setOpen(!1,B(j,e))}U.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},l,oe),de=m.getValidationProps(C,G);de.role=`combobox`;let fe={...h,open:T,disabled:C,value:O,readOnly:b,popupSide:te,placeholder:!z};return P(`button`,e,{ref:[t,V,H,se],state:fe,stateAttributesMapping:qt,props:de})}),Yt={value:()=>null},Xt=J.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=Z(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?Rt(l,u,d):Lt(l,u,d)),P(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:Yt})}),Zt=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o={open:Z().useState(`open`)};return P(`span`,e,{state:o,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:ie})}),Qt=J.forwardRef(function(e,t){let n=Z(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,Y.jsx)(N,{ref:t,...e}):null}),$t=J.createContext(void 0);function en(){let e=J.useContext($t);if(!e)throw Error(z(59));return e}function tn(e,t){e&&Object.assign(e.style,t)}var nn={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},rn={position:`fixed`},an=J.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:c,sideOffset:l,alignOffset:d,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p,arrowPadding:g,sticky:_,disableAnchorTracking:v,alignItemWithTrigger:y=!0,collisionAvoidance:b=u,style:x,...S}=e,C=Z(),w=yt(),T=C.useState(`open`),E=C.useState(`mounted`),D=C.useState(`modal`),O=C.useState(`value`),k=C.useState(`openMethod`),A=C.useState(`positionerElement`),j=C.useState(`triggerElement`),M=C.useState(`isItemEqualToValue`),N=C.useState(`transitionStatus`),P=J.useRef(null),F=J.useRef(null),[I,L]=J.useState(y),R=E&&I&&k!==`touch`;!E&&I!==y&&L(y),J.useImperativeHandle(C.context.alignItemWithTriggerActiveRef,()=>R),Je((R||D)&&T,k===`touch`,A,j);let z=h({anchor:n,floatingRootContext:w,positionMethod:a,mounted:E,side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:g,collisionBoundary:f,collisionPadding:p,sticky:_,disableAnchorTracking:v??R,collisionAvoidance:b,keepMounted:!0}),ee=R?`none`:z.side,te=R?rn:z.positionerStyles,ne={open:T,side:ee,align:z.align,anchorHidden:z.anchorHidden};m(()=>{C.set(`popupSide`,z.side)},[C,z.side]);let re=C.useStateSetter(`positionerElement`),ie=s(e,ne,{styles:te,transitionStatus:N,props:S,refs:[t,re],hidden:!E,inert:!T}),V=J.useRef(0),ae=_e(e=>{if(C.context.valuesRef.current.length===0)return;let t=V.current;V.current=e.size;let n=B(le);if(t!==0&&!C.state.multiple&&O!==null&&Tt(C.context.valuesRef.current,O,M)===-1){let e=C.context.initialValueRef.current,t=e!=null&&Tt(C.context.valuesRef.current,e,M)!==-1?e:null;C.context.setValue(t,n),t===null&&(C.set(`selectedIndex`,null),C.context.selectedItemTextRef.current=null)}if(t!==0&&C.state.multiple&&Array.isArray(O)){let e=O.filter(e=>Tt(C.context.valuesRef.current,e,M)!==-1);e.length!==O.length&&(C.context.setValue(e,n),e.length===0&&(C.set(`selectedIndex`,null),C.context.selectedItemTextRef.current=null))}if(T&&R){C.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};tn(A,e),tn(C.context.popupRef.current,e)}}),oe=J.useMemo(()=>({...z,side:ee,alignItemWithTriggerActive:R,setControlledAlignItemWithTrigger:L,scrollUpArrowRef:P,scrollDownArrowRef:F}),[z,ee,R,L]);return(0,Y.jsx)(qe,{elementsRef:C.context.listRef,labelsRef:C.context.labelsRef,onMapChange:ae,children:(0,Y.jsxs)($t.Provider,{value:oe,children:[E&&D&&(0,Y.jsx)(ce,{inert:Ce(!T),cutout:j}),ie]})})}),on=`base-ui-disable-scrollbar`,sn={className:on,getElement(e){return(0,Y.jsx)(`style`,{nonce:e,href:on,precedence:`base-ui:low`,children:`.${on}{scrollbar-width:none}.${on}::-webkit-scrollbar{display:none}`})}},cn=J.createContext(void 0),ln={disableStyleElements:!1};function un(){return J.useContext(cn)??ln}var dn=`--transform-origin`,fn={...pe,...V},pn=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=Z(),{multiple:l,readOnly:u,highlightItemOnHover:d}=vt(),f=yt(),{side:p,align:h,alignItemWithTriggerActive:g,isPositioned:_,setControlledAlignItemWithTrigger:v}=en(),y=Ke(!0)!=null,b=F(),{nonce:S,disableStyleElements:C}=un(),w=s.useState(`id`),T=s.useState(`open`),E=s.useState(`openMethod`),D=s.useState(`mounted`),O=s.useState(`popupProps`),k=s.useState(`transitionStatus`),A=s.useState(`triggerElement`),j=s.useState(`positionerElement`),M=s.useState(`listElement`),N=J.useRef(!1),I=J.useRef(!1),L=J.useRef({}),z=x(),ne=_e(e=>{if(!j||!s.context.popupRef.current||!I.current)return;let t=j.style.top===`0px`,n=j.style.bottom===`0px`;if(N.current||!g||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=gn(j),i=_n(j.getBoundingClientRect().height,`y`,r),a=ee(j),o=G(j),c=o.getComputedStyle(j),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=mn(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=hn(e),h=null,_=e=>{j.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=Bt(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(N.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?h=t?1/0:0:n&&p<m&&(h=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),h!=null){let t=Bt(h,0,hn(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(N.current=!0),s.context.handleScrollArrowVisibility(e)});J.useImperativeHandle(s.context.scrollHandlerRef,()=>ne,[ne]),ye({open:T,ref:s.context.popupRef,onComplete(){T&&s.context.onOpenChangeComplete(!0)}});let re={open:T,transitionStatus:k,side:p,align:h};m(()=>{j&&s.context.popupRef.current&&!Object.keys(L.current).length&&(L.current={top:j.style.top||`0`,left:j.style.left||`0`,right:j.style.right,height:j.style.height,bottom:j.style.bottom,minHeight:j.style.minHeight,maxHeight:j.style.maxHeight,marginTop:j.style.marginTop,marginBottom:j.style.marginBottom})},[s,j]),m(()=>{T||g||(I.current=!1,N.current=!1,tn(j,L.current))},[T,g,j]),m(()=>{let e=s.context.popupRef.current;if(!T||!A||!j||!e||g&&!_||s.state.transitionStatus===`ending`)return;if(I.current=!0,e.style.removeProperty(dn),!g){z.request(()=>s.context.handleScrollArrowVisibility(M||e));return}let t=bn(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=G(j),i=r.getComputedStyle(j),a=r.getComputedStyle(e),o=ee(A),l=gn(A),u=vn(A.getBoundingClientRect(),l),f=vn(j.getBoundingClientRect(),l),p=u.height,m=M||e,h=m.scrollHeight,g=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,x=parseFloat(i.minHeight)||100,S=mn(a),C=o.documentElement.clientHeight-_-y,w=o.documentElement.clientWidth,T=C-u.bottom+p,E,D=b===`rtl`?u.right-f.width:u.left,O=0;if(t&&n){let e=vn(n.getBoundingClientRect(),l);E=vn(t.getBoundingClientRect(),l),D=f.left+(b===`rtl`?e.right-E.right:e.left-E.left);let r=e.top-u.top+e.height/2;O=E.top-f.top+E.height/2-r}let k=T+O+y+g,P=Math.min(C,k),F=C-_-y,I=k-P,R=w-5;j.style.left=`${Bt(D,5,R-f.width)}px`,j.style.height=`${P}px`,j.style.maxHeight=`none`,j.style.marginTop=`${_}px`,j.style.marginBottom=`${y}px`,e.style.height=`100%`;let z=hn(m),te=I>=z-1;te&&(P=Math.min(C,f.height)-(I-z));let ne=u.top<20||u.bottom>C-20||Math.ceil(P)+1<Math.min(h,x),re=(r.visualViewport?.scale??1)!==1&&c;if(ne||re){tn(j,L.current),v(!1);return}let B=Math.max(x,P);if(te){let e=Math.max(0,C-k);j.style.top=f.height>=F?`0`:`${e}px`,j.style.height=`${P}px`,m.scrollTop=hn(m)}else j.style.bottom=`0`,m.scrollTop=I;if(E){let t=f.top,n=f.height,r=E.top+E.height/2,i=Bt(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(dn,`50% ${i}%`)}(B===C||P>=S)&&(N.current=!0),s.context.handleScrollArrowVisibility(m),d&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,T,j,A,g,v,z,M,d,b,_]),J.useEffect(()=>{if(!g||!j||!T)return;let e=G(j);function t(e){s.context.setOpen(!1,B(be,e))}return te(e,`resize`,t)},[s,g,j,T]);let ie={...M?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":l||void 0,"aria-readonly":u||void 0,id:`${w}-list`},onKeyDown(e){y&&xe.has(e.key)&&e.stopPropagation()},onScroll(e){M||ne(e.currentTarget)},...g&&{style:M?{height:`100%`}:nn},className:!M&&g?sn.className:void 0},V=P(`div`,e,{ref:[t,s.context.popupRef],state:re,stateAttributesMapping:fn,props:[O,ie,R(k),o]});return(0,Y.jsxs)(J.Fragment,{children:[!C&&sn.getElement(S),(0,Y.jsx)(W,{context:f,modal:!1,disabled:!D,openInteractionType:E,returnFocus:a,restoreFocus:!0,children:V})]})});function mn(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function hn(e){return Vt(e.scrollHeight,e.clientHeight)}function gn(e){return he.getScale(e)}function _n(e,t,n){return e/n[t]}function vn(e,t){return l({x:_n(e.x,`x`,t),y:_n(e.y,`y`,t),width:_n(e.width,`x`,t),height:_n(e.height,`y`,t)})}var yn=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function bn(e){let{style:t}=e,n={};for(let[e,r]of yn)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of yn){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var xn=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Z(),{multiple:s,readOnly:c}=vt(),{alignItemWithTriggerActive:l}=en(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:nn},className:u&&d!==`touch`?sn.className:void 0},p=o.useStateSetter(`listElement`);return P(`div`,e,{ref:[t,p],props:[f,a]})}),Sn=J.createContext(void 0);function Cn(){let e=J.useContext(Sn);if(!e)throw Error(z(57));return e}var wn=J.memo(J.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=J.useRef(null),d=Ge({guess:!0,label:o,textRef:u}),f=Z(),{itemProps:p,multiple:h,disabled:g,readOnly:v}=vt(),y=g||s,b=f.useState(`isActive`,d.index),x=f.useState(`open`),S=f.useState(`isSelected`,a),C=f.useState(`isSelectedByFocus`,d.index),w=f.useState(`isItemEqualToValue`),T=d.index,E=J.useRef(null);m(()=>{let e=f.context.valuesRef.current;return e[T]=a,()=>{delete e[T]}},[T,a,f]),m(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;h&&Array.isArray(e)?(n=Ot(T,a,f.context.valuesRef.current,e,w,t),r=n===T,T===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&St(a,e,w),r&&(n=T)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[T,h,w,f,a]);let D=J.useRef(`mouse`),O=J.useRef(!1),{getButtonProps:k,buttonRef:A}=M({disabled:y,focusableWhenDisabled:!0,native:c,composite:!0}),j={disabled:y,selected:S,highlighted:b};function N(e){if(g||v)return;let t=f.state.value;if(h){let n=Array.isArray(t)?t:[],r=S?kt(n,a,w):[...n,a];f.context.setValue(r,B(K,e))}else f.context.setValue(a,B(K,e)),f.context.setOpen(!1,B(K,e))}function F(){f.context.selectionRef.current.dragY=0}let I={role:`option`,"aria-selected":S,tabIndex:x&&b?0:-1,onKeyDown(e){f.set(`activeIndex`,T),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=D.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&_(e.nativeEvent)&&(n!==void 0||b),i=t&&!r&&!O.current;O.current=!1,!(y||i)&&N(e.nativeEvent)},onPointerEnter(e){D.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){D.current=e.pointerType,O.current=!0,F()},onMouseUp(){if(F(),y||D.current===`touch`||O.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&S,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!S;e||t||(O.current=!0,E.current?.click(),O.current=!1)}},L=P(`div`,e,{ref:[A,t,d.ref,E],state:j,props:[p,I,l,k]}),R=J.useMemo(()=>({selected:S,index:T,textRef:u,selectedByFocus:C}),[S,T,u,C]);return(0,Y.jsx)(Sn.Provider,{value:R,children:L})})),Tn=J.forwardRef(function(e,t){let{selected:n}=Cn();return e.keepMounted||n?(0,Y.jsx)(En,{...e,ref:t}):null}),En=J.memo(J.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Cn(),c=J.useRef(null),{transitionStatus:l,setMounted:u}=fe(s),d=P(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:V});return ye({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),Dn=J.memo(J.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Cn(),a=Z(),{render:o,className:s,style:c,...l}=e,u=J.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]);return P(`div`,e,{ref:[u,t,r],props:l})})),On=J.createContext(void 0),kn=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=J.useState(),c=J.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=P(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Y.jsx)(On.Provider,{value:c,children:l})}),An=Ut;function jn({className:e,...t}){return(0,Y.jsx)(kn,{"data-slot":`select-group`,className:A(`scroll-my-1 p-1`,e),...t})}function Mn({className:e,...t}){return(0,Y.jsx)(Xt,{"data-slot":`select-value`,className:A(`flex flex-1 text-left`,e),...t})}function Nn({className:e,size:t=`default`,flat:n=!1,children:r,...i}){return(0,Y.jsxs)(Jt,{"data-slot":`select-trigger`,"data-size":t,"data-flat":n?`true`:void 0,className:A(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,n&&`rounded-none border-0 bg-transparent shadow-none hover:bg-transparent focus-visible:border-0 focus-visible:ring-0 dark:bg-transparent dark:hover:bg-transparent`,e),...i,children:[r,(0,Y.jsx)(Zt,{render:(0,Y.jsx)(a,{icon:tt,className:`pointer-events-none size-4 text-muted-foreground`,strokeWidth:1.5})})]})}function Pn({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,Y.jsx)(Qt,{children:(0,Y.jsx)(an,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,Y.jsx)(pn,{"data-slot":`select-content`,"data-align-trigger":o,className:A(`cn-menu-target cn-menu-translucent relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:(0,Y.jsx)(xn,{children:t})})})})}function Fn({className:e,children:t,...n}){return(0,Y.jsxs)(wn,{"data-slot":`select-item`,className:A(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,Y.jsx)(Dn,{className:`flex min-w-0 flex-1 items-center gap-2`,children:t}),(0,Y.jsx)(Tn,{render:(0,Y.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 right-2 flex size-4 -translate-y-1/2 items-center justify-center`}),children:(0,Y.jsx)(a,{icon:H,className:`pointer-events-none size-3.5`,strokeWidth:1.5})})]})}var In=new Set([`ALL`,`SELECT`,`INSERT`,`UPDATE`,`DELETE`]),Ln=new Set([`PERMISSIVE`,`RESTRICTIVE`]),Rn=new Set([`public`,`current_role`,`current_user`,`session_user`]),Q=`oke_app`;`${[`CREATE SCHEMA IF NOT EXISTS oke`,`SET search_path TO public, oke`,`DO $oke_search_path$
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n,f as r}from"./xyflow-yApv7D4e.js";import{$ as i,$n as a,A as o,B as s,Bn as c,Bt as l,Ct as u,D as d,E as f,Et as p,Gn as m,H as h,Ht as g,In as _,Jn as v,Jt as y,Kn as b,Kt as x,M as S,Mn as C,N as w,O as T,On as E,Ot as D,P as O,Q as k,Qn as A,Qt as j,S as M,St as N,Tt as P,U as F,Un as I,Ut as L,V as R,Wn as z,Wt as ee,Xt as te,Yt as ne,Zn as re,Zt as B,_n as ie,bn as V,dn as ae,dt as oe,er as H,ft as se,g as ce,gn as U,ht as W,in as le,j as ue,jn as G,k as de,lt as fe,mn as pe,mt as me,nn as K,pt as he,qn as ge,qt as _e,rr as ve,st as ye,un as be,v as xe,yt as Se,z as Ce}from"./shortcut-keys-DTE1sjTC.js";import{C as we,D as Te,K as Ee,Q as De,S as Oe,W as ke,X as Ae,Z as je,_ as Me,d as Ne,g as Pe,u as Fe,w as Ie,yt as q}from"./explorer-chrome-Dslh2yE8.js";import{i as Le}from"./call-pii-button-CLXQgIDD.js";import{m as Re,s as ze}from"./element-icons-C6t8Vlml.js";import{t as Be}from"./UserIcon-DaE2PB5_.js";import{t as Ve}from"./dagre.esm-B1_XeuLP.js";import{_ as He,b as Ue,f as We,g as Ge,h as Ke,m as qe,p as Je,x as Ye,y as Xe}from"./dropdown-menu-CRGrj5JU.js";import{Mt as Ze,ht as Qe}from"./index-Duxus_sG.js";var $e=[[`path`,{d:`M8 7H16.75C18.8567 7 19.91 7 20.6667 7.50559C20.9943 7.72447 21.2755 8.00572 21.4944 8.33329C22 9.08996 22 10.1433 22 12.25C22 15.7612 22 17.5167 21.1573 18.7779C20.7926 19.3238 20.3238 19.7926 19.7779 20.1573C18.5167 21 16.7612 21 13.25 21H12C7.28595 21 4.92893 21 3.46447 19.5355C2 18.0711 2 15.714 2 11V7.94427C2 6.1278 2 5.21956 2.38032 4.53806C2.65142 4.05227 3.05227 3.65142 3.53806 3.38032C4.21956 3 5.1278 3 6.94427 3C8.10802 3 8.6899 3 9.19926 3.19101C10.3622 3.62712 10.8418 4.68358 11.3666 5.73313L12 7`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}]],et=[[`path`,{d:`M18 19C18 19 13.5811 14 12 14C10.4188 14 6 19 6 19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 5.00004C18 5.00004 13.5811 9.99999 12 10C10.4188 10 6 5 6 5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],tt=[[`path`,{d:`M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]];function nt(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=D(),a=Se()!=null,o=re(()=>new oe({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new k,floatingId:i,syncOnly:!1,nested:a})).current;return m(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=C(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var J=e(t(),1);function rt(e){let[t,n]=J.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var Y=n();function X(e){return e.kind===`index`||e.kind===`function`||e.kind===`trigger`||e.kind===`extension`||e.kind===`policy`?e.kind:null}function it(e){return X(e)!==null}function at(e){return e.kind===`table`&&typeof e.rls==`boolean`}function ot(e,t,n){return typeof e.rlsPolicyCount==`number`?e.rlsPolicyCount:Object.keys(t?.stores?.[n]?.tables?.[e.name]?.policies??{}).length}function st(e){let t=X(e);return t===`index`?`Indexes`:t===`function`?`Functions`:t===`trigger`?`Triggers`:t===`extension`?`Extensions`:t===`policy`?`RLS Policies`:e.name}function ct(e){let t=[],n=[];for(let r of e)it(r)?n.push(r):t.push(r);return{tables:t,catalog:n}}function lt(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var ut=[`console.store.query`];function dt(e,t,n){if(!e||!n||!t)return;let r=t[1];if(pt(r)&&r.ref===n.ref&&(r.child??``)===(n.child??``)&&(r.tenant??``)===(n.tenant??``))return e}function ft(e,t){return ve({queryKey:[...ut,e],enabled:t&&e!==null,placeholderData:(t,n)=>dt(t,n?.queryKey,e),queryFn:async()=>{if(!e)throw Error(`Missing store query input`);let t=await q(e);if(t.error)throw Error(ke(t.error));if(!t.data)throw Error(`Empty store query`);return t.data}})}function pt(e){return typeof e==`object`&&!!e&&`ref`in e&&typeof e.ref==`string`}function mt(e){let t=J.useRef(!0);t.current&&(t.current=!1,e())}var ht=J.createContext(void 0),gt=J.createContext(void 0),_t=J.createContext(void 0);function Z(){let e=J.useContext(ht);if(e===void 0)throw Error(z(60));return e}function vt(){let e=J.useContext(gt);if(e===void 0)throw Error(z(101));return e}function yt(){let e=J.useContext(_t);if(e===void 0)throw Error(z(61));return e}function bt(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var xt=(e,t)=>Object.is(e,t);function St(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ct(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!bt(e,t,(e,t)=>St(e,t,n)):e!==t}function wt(e,t,n){return e?e.some(e=>e!==void 0&&St(t,e,n)):!1}function Tt(e,t,n){return e?e.findIndex(e=>e!==void 0&&St(e,t,n)):-1}function Et(e,t){if(t!==xt)return n=>wt(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function Dt(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(Et(t,n)):Tt(e,t,n);return i===-1?null:i}function Ot(e,t,n,r,i,a){return wt(r,t,i)?a!=null&&e>a&&wt(r,n[a],i)?a:e:e===a?Dt(n,r,i,!0):a}function kt(e,t,n){return e.filter(e=>!St(t,e,n))}function At(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function jt(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function Mt(e){return jt(e?.[0])}function Nt(e){return Mt(e)?e.flatMap(e=>e.items):e}function Pt(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Mt(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Ft(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return At(e)}function It(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?At(e.value):At(e)}function Lt(e,t,n){function r(){return Ft(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=Nt(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Rt(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Y.jsx)(J.Fragment,{children:Lt(r,t,n)},i)),e),[])}var zt={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:It(t,r)!==``},hasNullItemLabel:(e,t)=>t?Pt(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>St(t,e,n)):St(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function Bt(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function Vt(e,t){return Math.max(0,e-t)}function Ht(e,t){if(t<=0)return 0;let n=Bt(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Ut(e){let{id:t,value:n,defaultValue:r=null,onValueChange:a,open:s,defaultOpen:c=!1,onOpenChange:l,name:u,form:f,autoComplete:h,disabled:_=!1,readOnly:x=!1,required:C=!1,modal:E=!0,actionsRef:D,inputRef:O,onOpenChangeComplete:k,items:A,multiple:j=!1,itemToStringLabel:M,itemToStringValue:N,isItemEqualToValue:P=xt,highlightItemOnHover:F=!0,children:I}=e,{clearErrors:R}=S(),{setDirty:z,setTouched:ee,setFocused:te,validityData:ie,setFilled:V,name:ae,disabled:oe,validation:H,validationMode:ce}=w(),U=o({id:t}),W=oe||_,ue=ae??u,[G,pe]=de({controlled:n,default:j?r??b:r,name:`Select`,state:`value`}),[K,he]=de({controlled:s,default:c,name:`Select`,state:`open`}),ve=J.useRef([]),be=J.useRef([]),xe=J.useRef(null),Se=J.useRef(null),Ce=J.useRef(0),we=J.useRef(null),Te=J.useRef([]),Ee=J.useRef(!1),De=J.useRef(null),Oe=J.useRef(null),ke=J.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Ae=J.useRef(!1),je=J.useRef(G),{mounted:Me,setMounted:Ne,transitionStatus:Pe}=fe(K),{openMethod:Fe,triggerProps:Ie}=He(K),q=re(()=>new se({id:U,labelId:void 0,modal:E,multiple:j,itemToStringLabel:M,itemToStringValue:N,isItemEqualToValue:P,value:G,open:K,mounted:Me,transitionStatus:Pe,items:A,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:ge,triggerProps:ge,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:v,setOpen:v,handleScrollArrowVisibility:v,onOpenChangeComplete:v,listRef:ve,popupRef:xe,scrollHandlerRef:Se,scrollArrowsMountedCountRef:Ce,valueRef:we,valuesRef:Te,labelsRef:be,typingRef:Ee,selectionRef:ke,firstItemTextRef:De,selectedItemTextRef:Oe,alignItemWithTriggerActiveRef:Ae,initialValueRef:je},zt)).current,Le=q.useState(`activeIndex`),Re=q.useState(`selectedIndex`),ze=q.useState(`triggerElement`),Be=q.useState(`positionerElement`),Ve=rt(Fe),We=Fe??Ve,Ge=J.useMemo(()=>j?``:It(G,N),[j,G,N]),Ke=J.useMemo(()=>j&&Array.isArray(G)?G.map(e=>It(e,N)):It(G,N),[j,G,N]),qe=y(ze),Je=_e(()=>Ke);T(qe,U,G,Je,!W,u);let Ze=j?Array.isArray(G)&&G.length>0:G!=null&&Ge!==``;m(()=>{V(Ze)},[Ze,V]),m(function(){let e=Dt(Te.current,G,P,j);e===null&&(Oe.current=null),!K&&q.set(`selectedIndex`,e)},[j,K,G,P,q]),d(G,()=>{R(ue),z(Ct(G,ie.initialValue,P)),H.change(G)});let Qe=_e((e,t)=>{l?.(e,t),!t.isCanceled&&(he(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(ee(!0),te(!1),ce===`onBlur`&&H.commit(G)))}),$e=_e(()=>{Ne(!1),q.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),k?.(!1)});ye({enabled:!D,open:K,ref:xe,onComplete(){K||$e()}}),J.useImperativeHandle(D,()=>({unmount:$e}),[$e]);let et=_e((e,t)=>{a?.(e,t),!t.isCanceled&&pe(e)}),tt=_e(e=>{let t=Vt(e.scrollHeight,e.clientHeight),n=Ht(e.scrollTop,t),r=n>0,i=n<t;q.set(`scrollUpArrowVisible`,r),q.set(`scrollDownArrowVisible`,i)}),X=nt({open:K,onOpenChange:Qe,elements:{reference:ze,floating:Be}}),it=Ye(X,{enabled:!W,event:`mousedown`}),at=me(X),ot=Ue(X,{enabled:!W,listRef:ve,activeIndex:Le,selectedIndex:Re,disabledIndices:b,onNavigate(e){(e!==null||K)&&q.set(`activeIndex`,e)},focusItemOnHover:F}),st=Xe(X,{enabled:!W&&(K||!x&&!j),listRef:be,activeIndex:Le,selectedIndex:Re,disabledIndices:e=>lt(ve.current[e]),onMatch(e){K?q.set(`activeIndex`,e):et(Te.current[e],B(le))},onTyping(e){Ee.current=e}}),ct=J.useMemo(()=>p(st.reference,ot.reference,at.reference,it.reference,Ie),[it.reference,st.reference,ot.reference,at.reference,Ie]),ut=J.useMemo(()=>p(i,st.floating,ot.floating,at.floating),[st.floating,ot.floating,at.floating]),dt=ot.item??ge;q.useContextCallback(`setValue`,et),q.useContextCallback(`setOpen`,Qe),q.useContextCallback(`handleScrollArrowVisibility`,tt),q.useContextCallback(`onOpenChangeComplete`,k),mt(()=>{q.update({popupProps:ut,triggerProps:ct})}),q.useSyncedValues({id:U,modal:E,multiple:j,value:G,open:K,mounted:Me,transitionStatus:Pe,popupProps:ut,triggerProps:ct,items:A,itemToStringLabel:M,itemToStringValue:N,isItemEqualToValue:P,openMethod:We});let ft=J.useMemo(()=>({disabled:W,readOnly:x,required:C,multiple:j,highlightItemOnHover:F,itemProps:dt}),[W,x,C,j,F,dt]),pt=ne(O,H.inputRef),Z=j?void 0:ue,vt=J.useMemo(()=>!j||!Array.isArray(G)||!ue?null:G.map(e=>{let t=It(e,N);return(0,Y.jsx)(`input`,{type:`hidden`,form:f,name:ue,value:t,disabled:W},t)}),[j,G,f,ue,N,W]);return(0,Y.jsxs)(ht.Provider,{value:q,children:[(0,Y.jsx)(gt.Provider,{value:ft,children:(0,Y.jsx)(_t.Provider,{value:X,children:I})}),(0,Y.jsx)(`input`,{...H.getValidationProps(W,{onFocus(){q.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||W||x)return;let t=e.currentTarget.value,n=B(le,e.nativeEvent);function r(){if(j)return;let e=t.toLowerCase(),r=Te.current.findIndex(t=>It(t,N).toLowerCase()===e||Ft(t,M).toLowerCase()===e);r===-1&&(r=Te.current.findIndex((t,n)=>{let r=be.current[n];return r!=null&&r.toLowerCase()===e}));let i=Te.current[r];i!=null&&et(i,n)}q.set(`forceMount`,!0),queueMicrotask(r)}}),id:U&&Z==null?`${U}-hidden-input`:void 0,form:f,name:Z,autoComplete:h,value:Ge,disabled:W,required:C&&!(j&&Ze),readOnly:x,ref:pt,style:ue?L:g,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),vt]})}function Wt(e,t){return e??t}var Gt=`data-popup-side`,Kt=400,qt={...U,...O,popupSide:e=>e?{[Gt]:e}:null,value:()=>null},Jt=J.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:s=!0,style:c,...l}=e,{setTouched:u,setFocused:d,validationMode:f,validation:m,state:h,disabled:g}=w(),{labelId:_}=ue(),v=Z(),{readOnly:b,required:x,disabled:S}=vt(),C=g||S||a,T=v.useState(`open`),D=v.useState(`mounted`),O=v.useState(`value`),k=v.useState(`triggerProps`),A=v.useState(`positionerElement`),N=v.useState(`listElement`),F=v.useState(`popupSide`),L=v.useState(`id`),R=v.useState(`labelId`),z=v.useState(`hasSelectedValue`),te=D&&A?F:null,ne=i??L,re=Wt(_,R);o({id:i});let ie=y(A),V=J.useRef(null),{getButtonProps:oe,buttonRef:H}=M({disabled:C,native:s}),se=v.useStateSetter(`triggerElement`),ce=I(),U=I(),W=I();J.useEffect(()=>{if(T)return W.start(Kt,()=>{v.context.selectionRef.current.allowUnselectedMouseUp=!0,v.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{W.clear()};v.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[T,v,U,W]);let G=p(k,{id:ne,role:`combobox`,"aria-expanded":T,"aria-haspopup":`listbox`,"aria-controls":T?N?.id??ae(A)?.id:void 0,"aria-labelledby":re,"aria-readonly":b||void 0,"aria-required":x||void 0,tabIndex:C?-1:0,onFocus(e){d(!0),T&&v.context.alignItemWithTriggerActiveRef.current&&v.context.setOpen(!1,B(le,e.nativeEvent)),ce.start(0,()=>{v.set(`forceMount`,!0)})},onBlur(e){E(A,e.relatedTarget)||(u(!0),d(!1),f===`onBlur`&&m.commit(O))},onMouseDown(e){if(T)return;let t=ee(e.currentTarget);function n(e){if(!V.current)return;let t=e.target;E(V.current,t)||E(ie.current,t)||We(e,V.current)||v.context.setOpen(!1,B(j,e))}U.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},l,oe),de=m.getValidationProps(C,G);de.role=`combobox`;let fe={...h,open:T,disabled:C,value:O,readOnly:b,popupSide:te,placeholder:!z};return P(`button`,e,{ref:[t,V,H,se],state:fe,stateAttributesMapping:qt,props:de})}),Yt={value:()=>null},Xt=J.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=Z(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?Rt(l,u,d):Lt(l,u,d)),P(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:Yt})}),Zt=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o={open:Z().useState(`open`)};return P(`span`,e,{state:o,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:ie})}),Qt=J.forwardRef(function(e,t){let n=Z(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,Y.jsx)(N,{ref:t,...e}):null}),$t=J.createContext(void 0);function en(){let e=J.useContext($t);if(!e)throw Error(z(59));return e}function tn(e,t){e&&Object.assign(e.style,t)}var nn={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},rn={position:`fixed`},an=J.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:c,sideOffset:l,alignOffset:d,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p,arrowPadding:g,sticky:_,disableAnchorTracking:v,alignItemWithTrigger:y=!0,collisionAvoidance:b=u,style:x,...S}=e,C=Z(),w=yt(),T=C.useState(`open`),E=C.useState(`mounted`),D=C.useState(`modal`),O=C.useState(`value`),k=C.useState(`openMethod`),A=C.useState(`positionerElement`),j=C.useState(`triggerElement`),M=C.useState(`isItemEqualToValue`),N=C.useState(`transitionStatus`),P=J.useRef(null),F=J.useRef(null),[I,L]=J.useState(y),R=E&&I&&k!==`touch`;!E&&I!==y&&L(y),J.useImperativeHandle(C.context.alignItemWithTriggerActiveRef,()=>R),Je((R||D)&&T,k===`touch`,A,j);let z=h({anchor:n,floatingRootContext:w,positionMethod:a,mounted:E,side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:g,collisionBoundary:f,collisionPadding:p,sticky:_,disableAnchorTracking:v??R,collisionAvoidance:b,keepMounted:!0}),ee=R?`none`:z.side,te=R?rn:z.positionerStyles,ne={open:T,side:ee,align:z.align,anchorHidden:z.anchorHidden};m(()=>{C.set(`popupSide`,z.side)},[C,z.side]);let re=C.useStateSetter(`positionerElement`),ie=s(e,ne,{styles:te,transitionStatus:N,props:S,refs:[t,re],hidden:!E,inert:!T}),V=J.useRef(0),ae=_e(e=>{if(C.context.valuesRef.current.length===0)return;let t=V.current;V.current=e.size;let n=B(le);if(t!==0&&!C.state.multiple&&O!==null&&Tt(C.context.valuesRef.current,O,M)===-1){let e=C.context.initialValueRef.current,t=e!=null&&Tt(C.context.valuesRef.current,e,M)!==-1?e:null;C.context.setValue(t,n),t===null&&(C.set(`selectedIndex`,null),C.context.selectedItemTextRef.current=null)}if(t!==0&&C.state.multiple&&Array.isArray(O)){let e=O.filter(e=>Tt(C.context.valuesRef.current,e,M)!==-1);e.length!==O.length&&(C.context.setValue(e,n),e.length===0&&(C.set(`selectedIndex`,null),C.context.selectedItemTextRef.current=null))}if(T&&R){C.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};tn(A,e),tn(C.context.popupRef.current,e)}}),oe=J.useMemo(()=>({...z,side:ee,alignItemWithTriggerActive:R,setControlledAlignItemWithTrigger:L,scrollUpArrowRef:P,scrollDownArrowRef:F}),[z,ee,R,L]);return(0,Y.jsx)(qe,{elementsRef:C.context.listRef,labelsRef:C.context.labelsRef,onMapChange:ae,children:(0,Y.jsxs)($t.Provider,{value:oe,children:[E&&D&&(0,Y.jsx)(ce,{inert:Ce(!T),cutout:j}),ie]})})}),on=`base-ui-disable-scrollbar`,sn={className:on,getElement(e){return(0,Y.jsx)(`style`,{nonce:e,href:on,precedence:`base-ui:low`,children:`.${on}{scrollbar-width:none}.${on}::-webkit-scrollbar{display:none}`})}},cn=J.createContext(void 0),ln={disableStyleElements:!1};function un(){return J.useContext(cn)??ln}var dn=`--transform-origin`,fn={...pe,...V},pn=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=Z(),{multiple:l,readOnly:u,highlightItemOnHover:d}=vt(),f=yt(),{side:p,align:h,alignItemWithTriggerActive:g,isPositioned:_,setControlledAlignItemWithTrigger:v}=en(),y=Ke(!0)!=null,b=F(),{nonce:S,disableStyleElements:C}=un(),w=s.useState(`id`),T=s.useState(`open`),E=s.useState(`openMethod`),D=s.useState(`mounted`),O=s.useState(`popupProps`),k=s.useState(`transitionStatus`),A=s.useState(`triggerElement`),j=s.useState(`positionerElement`),M=s.useState(`listElement`),N=J.useRef(!1),I=J.useRef(!1),L=J.useRef({}),z=x(),ne=_e(e=>{if(!j||!s.context.popupRef.current||!I.current)return;let t=j.style.top===`0px`,n=j.style.bottom===`0px`;if(N.current||!g||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=gn(j),i=_n(j.getBoundingClientRect().height,`y`,r),a=ee(j),o=G(j),c=o.getComputedStyle(j),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=mn(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=hn(e),h=null,_=e=>{j.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=Bt(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(N.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?h=t?1/0:0:n&&p<m&&(h=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),h!=null){let t=Bt(h,0,hn(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(N.current=!0),s.context.handleScrollArrowVisibility(e)});J.useImperativeHandle(s.context.scrollHandlerRef,()=>ne,[ne]),ye({open:T,ref:s.context.popupRef,onComplete(){T&&s.context.onOpenChangeComplete(!0)}});let re={open:T,transitionStatus:k,side:p,align:h};m(()=>{j&&s.context.popupRef.current&&!Object.keys(L.current).length&&(L.current={top:j.style.top||`0`,left:j.style.left||`0`,right:j.style.right,height:j.style.height,bottom:j.style.bottom,minHeight:j.style.minHeight,maxHeight:j.style.maxHeight,marginTop:j.style.marginTop,marginBottom:j.style.marginBottom})},[s,j]),m(()=>{T||g||(I.current=!1,N.current=!1,tn(j,L.current))},[T,g,j]),m(()=>{let e=s.context.popupRef.current;if(!T||!A||!j||!e||g&&!_||s.state.transitionStatus===`ending`)return;if(I.current=!0,e.style.removeProperty(dn),!g){z.request(()=>s.context.handleScrollArrowVisibility(M||e));return}let t=bn(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=G(j),i=r.getComputedStyle(j),a=r.getComputedStyle(e),o=ee(A),l=gn(A),u=vn(A.getBoundingClientRect(),l),f=vn(j.getBoundingClientRect(),l),p=u.height,m=M||e,h=m.scrollHeight,g=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,x=parseFloat(i.minHeight)||100,S=mn(a),C=o.documentElement.clientHeight-_-y,w=o.documentElement.clientWidth,T=C-u.bottom+p,E,D=b===`rtl`?u.right-f.width:u.left,O=0;if(t&&n){let e=vn(n.getBoundingClientRect(),l);E=vn(t.getBoundingClientRect(),l),D=f.left+(b===`rtl`?e.right-E.right:e.left-E.left);let r=e.top-u.top+e.height/2;O=E.top-f.top+E.height/2-r}let k=T+O+y+g,P=Math.min(C,k),F=C-_-y,I=k-P,R=w-5;j.style.left=`${Bt(D,5,R-f.width)}px`,j.style.height=`${P}px`,j.style.maxHeight=`none`,j.style.marginTop=`${_}px`,j.style.marginBottom=`${y}px`,e.style.height=`100%`;let z=hn(m),te=I>=z-1;te&&(P=Math.min(C,f.height)-(I-z));let ne=u.top<20||u.bottom>C-20||Math.ceil(P)+1<Math.min(h,x),re=(r.visualViewport?.scale??1)!==1&&c;if(ne||re){tn(j,L.current),v(!1);return}let B=Math.max(x,P);if(te){let e=Math.max(0,C-k);j.style.top=f.height>=F?`0`:`${e}px`,j.style.height=`${P}px`,m.scrollTop=hn(m)}else j.style.bottom=`0`,m.scrollTop=I;if(E){let t=f.top,n=f.height,r=E.top+E.height/2,i=Bt(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(dn,`50% ${i}%`)}(B===C||P>=S)&&(N.current=!0),s.context.handleScrollArrowVisibility(m),d&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,T,j,A,g,v,z,M,d,b,_]),J.useEffect(()=>{if(!g||!j||!T)return;let e=G(j);function t(e){s.context.setOpen(!1,B(be,e))}return te(e,`resize`,t)},[s,g,j,T]);let ie={...M?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":l||void 0,"aria-readonly":u||void 0,id:`${w}-list`},onKeyDown(e){y&&xe.has(e.key)&&e.stopPropagation()},onScroll(e){M||ne(e.currentTarget)},...g&&{style:M?{height:`100%`}:nn},className:!M&&g?sn.className:void 0},V=P(`div`,e,{ref:[t,s.context.popupRef],state:re,stateAttributesMapping:fn,props:[O,ie,R(k),o]});return(0,Y.jsxs)(J.Fragment,{children:[!C&&sn.getElement(S),(0,Y.jsx)(W,{context:f,modal:!1,disabled:!D,openInteractionType:E,returnFocus:a,restoreFocus:!0,children:V})]})});function mn(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function hn(e){return Vt(e.scrollHeight,e.clientHeight)}function gn(e){return he.getScale(e)}function _n(e,t,n){return e/n[t]}function vn(e,t){return l({x:_n(e.x,`x`,t),y:_n(e.y,`y`,t),width:_n(e.width,`x`,t),height:_n(e.height,`y`,t)})}var yn=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function bn(e){let{style:t}=e,n={};for(let[e,r]of yn)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of yn){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var xn=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Z(),{multiple:s,readOnly:c}=vt(),{alignItemWithTriggerActive:l}=en(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:nn},className:u&&d!==`touch`?sn.className:void 0},p=o.useStateSetter(`listElement`);return P(`div`,e,{ref:[t,p],props:[f,a]})}),Sn=J.createContext(void 0);function Cn(){let e=J.useContext(Sn);if(!e)throw Error(z(57));return e}var wn=J.memo(J.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=J.useRef(null),d=Ge({guess:!0,label:o,textRef:u}),f=Z(),{itemProps:p,multiple:h,disabled:g,readOnly:v}=vt(),y=g||s,b=f.useState(`isActive`,d.index),x=f.useState(`open`),S=f.useState(`isSelected`,a),C=f.useState(`isSelectedByFocus`,d.index),w=f.useState(`isItemEqualToValue`),T=d.index,E=J.useRef(null);m(()=>{let e=f.context.valuesRef.current;return e[T]=a,()=>{delete e[T]}},[T,a,f]),m(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;h&&Array.isArray(e)?(n=Ot(T,a,f.context.valuesRef.current,e,w,t),r=n===T,T===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&St(a,e,w),r&&(n=T)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[T,h,w,f,a]);let D=J.useRef(`mouse`),O=J.useRef(!1),{getButtonProps:k,buttonRef:A}=M({disabled:y,focusableWhenDisabled:!0,native:c,composite:!0}),j={disabled:y,selected:S,highlighted:b};function N(e){if(g||v)return;let t=f.state.value;if(h){let n=Array.isArray(t)?t:[],r=S?kt(n,a,w):[...n,a];f.context.setValue(r,B(K,e))}else f.context.setValue(a,B(K,e)),f.context.setOpen(!1,B(K,e))}function F(){f.context.selectionRef.current.dragY=0}let I={role:`option`,"aria-selected":S,tabIndex:x&&b?0:-1,onKeyDown(e){f.set(`activeIndex`,T),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=D.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&_(e.nativeEvent)&&(n!==void 0||b),i=t&&!r&&!O.current;O.current=!1,!(y||i)&&N(e.nativeEvent)},onPointerEnter(e){D.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){D.current=e.pointerType,O.current=!0,F()},onMouseUp(){if(F(),y||D.current===`touch`||O.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&S,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!S;e||t||(O.current=!0,E.current?.click(),O.current=!1)}},L=P(`div`,e,{ref:[A,t,d.ref,E],state:j,props:[p,I,l,k]}),R=J.useMemo(()=>({selected:S,index:T,textRef:u,selectedByFocus:C}),[S,T,u,C]);return(0,Y.jsx)(Sn.Provider,{value:R,children:L})})),Tn=J.forwardRef(function(e,t){let{selected:n}=Cn();return e.keepMounted||n?(0,Y.jsx)(En,{...e,ref:t}):null}),En=J.memo(J.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Cn(),c=J.useRef(null),{transitionStatus:l,setMounted:u}=fe(s),d=P(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:V});return ye({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),Dn=J.memo(J.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Cn(),a=Z(),{render:o,className:s,style:c,...l}=e,u=J.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]);return P(`div`,e,{ref:[u,t,r],props:l})})),On=J.createContext(void 0),kn=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=J.useState(),c=J.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=P(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Y.jsx)(On.Provider,{value:c,children:l})}),An=Ut;function jn({className:e,...t}){return(0,Y.jsx)(kn,{"data-slot":`select-group`,className:A(`scroll-my-1 p-1`,e),...t})}function Mn({className:e,...t}){return(0,Y.jsx)(Xt,{"data-slot":`select-value`,className:A(`flex flex-1 text-left`,e),...t})}function Nn({className:e,size:t=`default`,flat:n=!1,children:r,...i}){return(0,Y.jsxs)(Jt,{"data-slot":`select-trigger`,"data-size":t,"data-flat":n?`true`:void 0,className:A(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,n&&`rounded-none border-0 bg-transparent shadow-none hover:bg-transparent focus-visible:border-0 focus-visible:ring-0 dark:bg-transparent dark:hover:bg-transparent`,e),...i,children:[r,(0,Y.jsx)(Zt,{render:(0,Y.jsx)(a,{icon:tt,className:`pointer-events-none size-4 text-muted-foreground`,strokeWidth:1.5})})]})}function Pn({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,Y.jsx)(Qt,{children:(0,Y.jsx)(an,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,Y.jsx)(pn,{"data-slot":`select-content`,"data-align-trigger":o,className:A(`cn-menu-target cn-menu-translucent relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:(0,Y.jsx)(xn,{children:t})})})})}function Fn({className:e,children:t,...n}){return(0,Y.jsxs)(wn,{"data-slot":`select-item`,className:A(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,Y.jsx)(Dn,{className:`flex min-w-0 flex-1 items-center gap-2`,children:t}),(0,Y.jsx)(Tn,{render:(0,Y.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 right-2 flex size-4 -translate-y-1/2 items-center justify-center`}),children:(0,Y.jsx)(a,{icon:H,className:`pointer-events-none size-3.5`,strokeWidth:1.5})})]})}var In=new Set([`ALL`,`SELECT`,`INSERT`,`UPDATE`,`DELETE`]),Ln=new Set([`PERMISSIVE`,`RESTRICTIVE`]),Rn=new Set([`public`,`current_role`,`current_user`,`session_user`]),Q=`oke_app`;`${[`CREATE SCHEMA IF NOT EXISTS oke`,`SET search_path TO public, oke`,`DO $oke_search_path$
2
2
  BEGIN
3
3
  EXECUTE 'ALTER ROLE CURRENT_USER SET search_path TO public, oke';
4
4
  EXCEPTION