@emeryld/rrroutes-openapi 2.6.2 → 2.6.3

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 (79) hide show
  1. package/dist/index.cjs +1 -0
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.mjs +1 -0
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/public/assets/Add.js +1 -0
  6. package/dist/public/assets/Autocomplete.js +1 -0
  7. package/dist/public/assets/BaseFilterBar.js +1 -0
  8. package/dist/public/assets/BentoGrid.js +1 -0
  9. package/dist/public/assets/CacheLogsPage.js +1 -0
  10. package/dist/public/assets/DeleteOutline.js +1 -0
  11. package/dist/public/assets/DiffPage.js +7 -0
  12. package/dist/public/assets/Download.js +1 -0
  13. package/dist/public/assets/EndpointDetailPage.js +1 -0
  14. package/dist/public/assets/EndpointDetailPanel.js +1 -0
  15. package/dist/public/assets/EndpointPlaygroundPage.js +1 -0
  16. package/dist/public/assets/ExpandLess.js +1 -0
  17. package/dist/public/assets/ExportButton.js +2 -0
  18. package/dist/public/assets/FlowBuilderPage.js +20 -0
  19. package/dist/public/assets/HistoryPage.js +1 -0
  20. package/dist/public/assets/LogsPage.js +1 -0
  21. package/dist/public/assets/PageContainer.js +3 -0
  22. package/dist/public/assets/PlayArrow.js +1 -0
  23. package/dist/public/assets/PresetsPage.js +4 -0
  24. package/dist/public/assets/RoutesPage.js +1 -0
  25. package/dist/public/assets/SchedulingPage.js +1 -0
  26. package/dist/public/assets/SchemaTreeView.js +1 -0
  27. package/dist/public/assets/SettingsPage.js +1 -0
  28. package/dist/public/assets/SocketsPage.js +1 -0
  29. package/dist/public/assets/docs.css +1 -1
  30. package/dist/public/assets/docs.js +95 -177
  31. package/dist/public/assets/filterTypes.js +1 -0
  32. package/dist/public/assets/getValidReactChildren.js +1 -0
  33. package/dist/public/assets/kvRowAdapters.js +1 -0
  34. package/dist/public/assets/schemaDefaults.js +1 -0
  35. package/dist/public/assets/useEndpointOptions.js +1 -0
  36. package/dist/public/assets/useQueryState.js +1 -0
  37. package/dist/public/assets/vendor-recharts.js +99 -0
  38. package/dist/public/assets/vendor-xyflow.js +15 -0
  39. package/dist/web/v2/AppShell.d.ts +1 -3
  40. package/dist/web/v2/components/diff/DiffViewer.d.ts +7 -0
  41. package/dist/web/v2/components/diff/RequestDiffSelector.d.ts +15 -0
  42. package/dist/web/v2/components/diff/SchemaDiffViewer.d.ts +7 -0
  43. package/dist/web/v2/components/feedback/CopyAsMenu.d.ts +10 -0
  44. package/dist/web/v2/components/feedback/CopySnackbar.d.ts +1 -0
  45. package/dist/web/v2/components/flows/FlowCanvas.d.ts +13 -0
  46. package/dist/web/v2/components/flows/FlowNodeEditor.d.ts +8 -0
  47. package/dist/web/v2/components/flows/FlowRunProgress.d.ts +7 -0
  48. package/dist/web/v2/components/flows/FlowVariablePanel.d.ts +7 -0
  49. package/dist/web/v2/components/flows/nodes/ConditionNode.d.ts +7 -0
  50. package/dist/web/v2/components/flows/nodes/DelayNode.d.ts +7 -0
  51. package/dist/web/v2/components/flows/nodes/ExtractNode.d.ts +8 -0
  52. package/dist/web/v2/components/flows/nodes/RequestNode.d.ts +10 -0
  53. package/dist/web/v2/components/layout/ActivityBar.d.ts +1 -0
  54. package/dist/web/v2/components/layout/BentoGrid.d.ts +17 -0
  55. package/dist/web/v2/components/layout/ContentArea.d.ts +1 -0
  56. package/dist/web/v2/components/layout/PanelRegistry.d.ts +17 -0
  57. package/dist/web/v2/components/request/LastRunPanel.d.ts +5 -0
  58. package/dist/web/v2/components/request/TimingBreakdown.d.ts +11 -0
  59. package/dist/web/v2/components/requests/timeline/TimelinePhaseBar.d.ts +13 -0
  60. package/dist/web/v2/components/requests/timeline/TimelineWaterfall.d.ts +12 -0
  61. package/dist/web/v2/hooks/useLeafEndpoint.d.ts +2 -2
  62. package/dist/web/v2/pages/DiffPage.d.ts +1 -0
  63. package/dist/web/v2/pages/FlowBuilderPage.d.ts +1 -0
  64. package/dist/web/v2/stores/flowStore.d.ts +70 -0
  65. package/dist/web/v2/stores/layoutStore.d.ts +13 -0
  66. package/dist/web/v2/stores/playgroundSettingsStore.d.ts +10 -0
  67. package/dist/web/v2/stores/snackbarStore.d.ts +17 -0
  68. package/dist/web/v2/types/types.cacheLog.d.ts +135 -49
  69. package/dist/web/v2/types/types.endpoint.d.ts +195 -139
  70. package/dist/web/v2/types/types.log.d.ts +48 -19
  71. package/dist/web/v2/types/types.preset.d.ts +168 -84
  72. package/dist/web/v2/types/types.requestLog.d.ts +135 -90
  73. package/dist/web/v2/types/types.scheduling.d.ts +87 -37
  74. package/dist/web/v2/types/types.socket.d.ts +69 -33
  75. package/dist/web/v2/utils/codeGeneration.d.ts +12 -0
  76. package/dist/web/v2/utils/diffUtils.d.ts +11 -0
  77. package/dist/web/v2/utils/flowRunner.d.ts +17 -0
  78. package/dist/web/v2/utils/templateResolver.d.ts +4 -0
  79. package/package.json +15 -12
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-xyflow.js";import{h as o,m as yt}from"./vendor-recharts.js";import{A as qe}from"./Add.js";import{I as Ze,J as et,K as jt,L as Be,M as me,N as tt,O as Ae,P as vt,Q as st,R as re,U as Ct,V as wt,W as bt,X as Ke,S as k,A as ve,i as Ce,T as B,Y as kt,G as O,E as we,m as be,Z as It,_ as rt,$ as Pt,a0 as nt,a1 as se,a2 as Mt,a3 as _,a4 as He,a5 as Et,a6 as ot,q as Fe,a7 as _e,a8 as at,a9 as Oe,c as it,aa as lt,ab as zt,g as Pe,ac as St,ad as Bt,ae as Ot,af as Tt,ag as qt,ah as Ue,n as At}from"./docs.js";import{P as Ht}from"./PlayArrow.js";import{u as Ft,a as Rt}from"./useEndpointOptions.js";import{r as pe,D as Dt,a as Nt}from"./kvRowAdapters.js";import{D as $t}from"./DeleteOutline.js";import{u as Vt,T as ye,I as Lt,P as Jt}from"./PageContainer.js";import{s as Wt,f as ge,a as Qe,d as Gt,b as Kt}from"./schemaDefaults.js";import{A as _t}from"./Autocomplete.js";import{S as Te}from"./SchemaTreeView.js";import"./ExpandLess.js";import"./getValidReactChildren.js";function Ut(e){return Ze("PrivateSwitchBase",e)}et("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Qt=e=>{const{classes:s,checked:r,disabled:f,edge:g}=e,x={root:["root",r&&"checked",f&&"disabled",g&&`edge${me(g)}`],input:["input"]};return tt(x,Ut,s)},Yt=Ae(vt,{name:"MuiSwitchBase"})({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:e,ownerState:s})=>e==="start"&&s.size!=="small",style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:e,ownerState:s})=>e==="end"&&s.size!=="small",style:{marginRight:-12}}]}),Xt=Ae("input",{name:"MuiSwitchBase",shouldForwardProp:st})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),Zt=o.forwardRef(function(s,r){const{autoFocus:f,checked:g,checkedIcon:x,defaultChecked:d,disabled:v,disableFocusRipple:l=!1,edge:y=!1,icon:j,id:u,inputProps:h,inputRef:M,name:w,onBlur:z,onChange:b,onFocus:T,readOnly:q,required:X=!1,tabIndex:Z,type:G,value:U,slots:L={},slotProps:Q={},...c}=s,[$,le]=jt({controlled:g,default:!!d,name:"SwitchBase",state:"checked"}),R=Vt(),ne=S=>{T&&T(S),R&&R.onFocus&&R.onFocus(S)},D=S=>{z&&z(S),R&&R.onBlur&&R.onBlur(S)},ce=S=>{if(S.nativeEvent.defaultPrevented||q)return;const H=S.target.checked;le(H),b&&b(S,H)};let K=v;R&&typeof K>"u"&&(K=R.disabled);const oe=G==="checkbox"||G==="radio",ee={...s,checked:$,disabled:K,disableFocusRipple:l,edge:y},ae=Qt(ee),ie={slots:L,slotProps:{input:h,...Q}},[F,J]=Be("root",{ref:r,elementType:Yt,className:ae.root,shouldForwardComponentProp:!0,externalForwardedProps:{...ie,component:"span",...c},getSlotProps:S=>({...S,onFocus:H=>{var V;(V=S.onFocus)==null||V.call(S,H),ne(H)},onBlur:H=>{var V;(V=S.onBlur)==null||V.call(S,H),D(H)}}),ownerState:ee,additionalProps:{centerRipple:!0,focusRipple:!l,role:void 0,tabIndex:null}}),[Y,de]=Be("input",{ref:M,elementType:Xt,className:ae.input,externalForwardedProps:ie,getSlotProps:S=>({...S,onChange:H=>{var V;(V=S.onChange)==null||V.call(S,H),ce(H)}}),ownerState:ee,additionalProps:{autoFocus:f,checked:g,defaultChecked:d,disabled:K,id:oe?u:void 0,name:w,readOnly:q,required:X,tabIndex:Z,type:G,...G==="checkbox"&&U===void 0?{}:{value:U}}});return t.jsxs(F,{...J,children:[t.jsx(Y,{...de}),$?x:j]})}),es=re(t.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),ts=re(t.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),ss=re(t.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function rs(e){return Ze("MuiCheckbox",e)}const Me=et("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),ns=e=>{const{classes:s,indeterminate:r,color:f,size:g}=e,x={root:["root",r&&"indeterminate",`color${me(f)}`,`size${me(g)}`]},d=tt(x,rs,s);return{...s,...d}},os=Ae(Zt,{shouldForwardProp:e=>st(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,s)=>{const{ownerState:r}=e;return[s.root,r.indeterminate&&s.indeterminate,s[`size${me(r.size)}`],r.color!=="default"&&s[`color${me(r.color)}`]]}})(bt(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Ke()).map(([s])=>({props:{color:s,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[s].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Ke()).map(([s])=>({props:{color:s},style:{[`&.${Me.checked}, &.${Me.indeterminate}`]:{color:(e.vars||e).palette[s].main},[`&.${Me.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),as=t.jsx(ts,{}),is=t.jsx(es,{}),ls=t.jsx(ss,{}),cs=o.forwardRef(function(s,r){const f=Ct({props:s,name:"MuiCheckbox"}),{checkedIcon:g=as,color:x="primary",icon:d=is,indeterminate:v=!1,indeterminateIcon:l=ls,inputProps:y,size:j="medium",disableRipple:u=!1,className:h,slots:M={},slotProps:w={},...z}=f,b=v?l:d,T=v?l:g,q={...f,disableRipple:u,color:x,indeterminate:v,size:j},X=ns(q),Z=w.input??y,[G,U]=Be("root",{ref:r,elementType:os,className:yt(X.root,h),shouldForwardComponentProp:!0,externalForwardedProps:{slots:M,slotProps:w,...z},ownerState:q,additionalProps:{type:"checkbox",icon:o.cloneElement(b,{fontSize:b.props.fontSize??j}),checkedIcon:o.cloneElement(T,{fontSize:T.props.fontSize??j}),disableRipple:u,slots:M,slotProps:{input:wt(typeof Z=="function"?Z(q):Z,{"data-indeterminate":v})}}});return t.jsx(G,{...U,classes:X})}),ds=re(t.jsx("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"})),us=re(t.jsx("path",{d:"M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5m-1 4h-2.19l2 2H16zM2 4.27l3.11 3.11C3.29 8.12 2 9.91 2 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4L20 19.74 3.27 3z"})),hs=re(t.jsx("path",{d:"M11.07 12.85c.77-1.39 2.25-2.21 3.11-3.44.91-1.29.4-3.7-2.18-3.7-1.69 0-2.52 1.28-2.87 2.34L6.54 6.96C7.25 4.83 9.18 3 11.99 3c2.35 0 3.96 1.07 4.78 2.41.7 1.15 1.11 3.3.03 4.9-1.2 1.77-2.35 2.31-2.97 3.45-.25.46-.35.76-.35 2.24h-2.89c-.01-.78-.13-2.05.48-3.15M14 20c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2"}));function ps(e){try{const s=JSON.parse(e);if(s!==null&&typeof s=="object"&&"message"in s){const r=s;return{name:typeof r.name=="string"?r.name:void 0,message:String(r.message),stack:typeof r.stack=="string"?r.stack:void 0}}}catch{}return{message:e}}function ms(e){const s=e.toLowerCase(),r=[];return s.includes("cors")&&r.push({key:"cors",text:"This looks like a CORS error. Check that your server includes the correct Access-Control-Allow-Origin headers and that the request origin is allowed."}),(s.includes("json")||s.includes("parse")||s.includes("syntax"))&&r.push({key:"json",text:"This may be a JSON parsing issue. Verify that the request and response bodies are valid JSON and that Content-Type headers are set correctly."}),(s.includes("timeout")||s.includes("etimedout"))&&r.push({key:"timeout",text:"The request appears to have timed out. Consider increasing the timeout value or checking whether the server is under heavy load."}),(s.includes("econnrefused")||s.includes("enotfound"))&&r.push({key:"connection",text:"The server could not be reached. Verify that the server URL is correct and that the server is running."}),r}function xs({title:e="Last run",lastRun:s,runButton:r,extendable:f=!1,maxDetailsHeight:g}){const[x,d]=o.useState(!1),[v,l]=o.useState(!1);o.useEffect(()=>{s&&d(!0)},[s]);const y=o.useMemo(()=>s!=null&&s.errorMessage?ps(s.errorMessage):void 0,[s==null?void 0:s.errorMessage]),j=o.useMemo(()=>y?ms(y.message):[],[y]);return t.jsx(k,{spacing:2,display:"flex",sx:{flexGrow:1},children:t.jsxs(ve,{expanded:x,onChange:(u,h)=>d(h),sx:{bgcolor:"background.default"},children:[t.jsx(Ce,{expandIcon:t.jsx(we,{}),children:t.jsxs(k,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:{xs:"flex-start",sm:"center"},sx:{width:"100%",paddingRight:2},children:[t.jsx(B,{variant:"subtitle1",children:e}),s?t.jsxs(k,{direction:"row",spacing:2,alignItems:"center",children:[t.jsx(kt,{status:s.status}),t.jsxs(B,{variant:"body2",color:"text.secondary",children:[s.duration??"—"," ms"]}),t.jsx(B,{variant:"body2",color:"text.secondary",children:s.time})]}):t.jsx(B,{variant:"body2",color:"text.secondary",children:"No runs yet"}),t.jsx(O,{sx:{flexGrow:1}}),r]})}),t.jsx(be,{children:s?t.jsxs(k,{spacing:2,children:[y?t.jsxs(k,{spacing:1.5,children:[t.jsx(B,{color:"error",sx:{fontWeight:600},children:y.name?`${y.name}: ${y.message}`:`Error: ${y.message}`}),y.stack?t.jsxs(O,{children:[t.jsxs(B,{variant:"body2",onClick:()=>l(u=>!u),sx:{cursor:"pointer",color:"text.secondary",userSelect:"none","&:hover":{textDecoration:"underline"}},children:[v?"Hide":"Show"," stack trace"]}),t.jsx(It,{in:v,children:t.jsx(B,{component:"pre",variant:"body2",sx:{fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-all",bgcolor:"action.hover",borderRadius:1,p:1.5,mt:.5,maxHeight:300,overflow:"auto"},children:y.stack})})]}):null,s.requestSnapshot?t.jsxs(O,{sx:{bgcolor:"action.hover",borderRadius:1,p:1.5},children:[t.jsx(B,{variant:"caption",color:"text.secondary",sx:{mb:.5,display:"block"},children:"Request that caused this error"}),t.jsxs(k,{spacing:.5,children:[s.requestSnapshot.method||s.requestSnapshot.path?t.jsxs(B,{variant:"body2",sx:{fontFamily:"monospace"},children:[s.requestSnapshot.method," ",s.requestSnapshot.path]}):null,s.requestSnapshot.body?t.jsx(B,{component:"pre",variant:"body2",sx:{fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-all",m:0},children:s.requestSnapshot.body}):null]})]}):null,j.map(u=>t.jsx(rt,{severity:"info",variant:"outlined",children:u.text},u.key))]}):null,t.jsx(Pt,{value:s.response,title:"Response body"})]}):t.jsx(B,{color:"text.secondary",children:"Run the endpoint to see output."})})]})})}function fs({items:e,activeId:s,isLoading:r=!1,label:f="Requests",onSelect:g,onAdd:x,onClose:d,canClose:v,renderLabel:l,disabled:y}){const j=y?!1:(v==null?void 0:v(e.length))??e.length>1;return t.jsxs(O,{sx:{position:"sticky",top:0,zIndex:5,bgcolor:"background.paper",borderBottom:"1px solid",borderColor:"divider",boxShadow:u=>`0 4px 12px ${u.palette.common.black}11`},children:[t.jsxs(k,{direction:"row",alignItems:"center",spacing:1,sx:{px:2,py:1},children:[t.jsx(B,{variant:"subtitle2",color:"text.secondary",children:f}),r?t.jsx(nt,{size:12}):null]}),t.jsxs(O,{sx:{display:"flex",gap:1,alignItems:"center",overflow:"hidden",px:2,pb:.5},children:[e.map(u=>{const h=u.id===s,M=(l==null?void 0:l(u))??String(u.id);return t.jsxs(O,{onClick:()=>g(u.id),sx:{flex:h?"0 0 240px":"1 1 160px",minWidth:0,maxWidth:h?240:200,border:"1px solid",borderColor:h?"primary.main":"divider",bgcolor:h?"primary.main":"background.default",color:h?"primary.contrastText":"text.primary",cursor:"pointer",display:"flex",alignItems:"center",gap:.75,px:1,py:.5},children:[t.jsx(B,{variant:"subtitle2",noWrap:!0,sx:{flex:1,fontWeight:h?600:void 0},children:M}),t.jsx(k,{direction:"row",spacing:.5,alignItems:"center",children:t.jsx(se,{size:"small",onClick:w=>{w.stopPropagation(),j&&d(u.id)},disabled:!j,sx:{color:h?"primary.contrastText":"text.secondary"},children:t.jsx(Mt,{fontSize:"inherit"})})})]},u.id)}),t.jsx(se,{color:"primary",onClick:x,sx:{flexShrink:0,height:32,width:32,border:"1px solid",borderColor:"divider",alignSelf:"center"},disabled:y,children:t.jsx(qe,{fontSize:"small"})})]})]})}function je({title:e,rows:s,onChange:r,actions:f,defaultExpanded:g=!0,disableAccordion:x=!1,summaryToggleButton:d,showFieldMeta:v=!0,disabled:l}){const y=(w,z)=>{if(l)return;const b=s.map((T,q)=>q===w?{...T,...z}:T);r(b)},j=w=>{if(l)return;const z=s.filter((b,T)=>T!==w);r(z)},u=()=>{l||r([...s,He()])},h=t.jsxs(k,{spacing:1.5,children:[s.length===0&&t.jsx(B,{variant:"body2",color:"text.secondary",children:'No fields defined. Use "Add" to create one.'}),s.map((w,z)=>t.jsxs(k,{spacing:.5,children:[t.jsxs(k,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:"center",children:[t.jsx(cs,{checked:w.enabled,onChange:b=>y(z,{enabled:b.target.checked}),disabled:l}),t.jsx(ye,{label:"Key",value:w.key,onChange:b=>y(z,{key:b.target.value}),disabled:l,sx:{flexGrow:1}}),t.jsx(ye,{label:"Value",value:w.value,onChange:b=>y(z,{value:b.target.value}),disabled:l,sx:{flexGrow:2}}),t.jsx(se,{onClick:()=>j(z),disabled:l,children:t.jsx($t,{})})]}),w.typeHint||w.description?t.jsxs(B,{variant:"caption",color:"text.secondary",sx:{pl:{sm:"48px"}},children:[w.typeHint?`Type: ${w.typeHint}`:null,w.typeHint&&w.description?" — ":"",w.description??null]}):null]},w.id)),t.jsx(_,{size:"small",variant:"outlined",startIcon:t.jsx(qe,{}),onClick:u,sx:{alignSelf:"flex-start"},disabled:l,children:"Add field"})]});if(x){const w=!!(e!=null&&e.trim())||!!f;return t.jsxs(k,{spacing:1.5,children:[w?t.jsxs(k,{direction:"row",alignItems:"center",spacing:1,flexWrap:"wrap",children:[e!=null&&e.trim()?t.jsx(B,{variant:"subtitle1",sx:{flexGrow:1},children:e}):t.jsx(O,{sx:{flexGrow:1}}),f]}):null,h]})}const M=f||d?t.jsxs(k,{direction:"row",spacing:1,alignItems:"center",children:[f,d?t.jsx(O,{sx:{display:"flex",alignItems:"center"},children:d}):null]}):null;return t.jsxs(ve,{defaultExpanded:g,children:[t.jsxs(Ce,{expandIcon:t.jsx(we,{}),sx:{alignItems:"center",gap:1},children:[t.jsx(B,{variant:"subtitle1",sx:{flexGrow:1},children:e}),M]}),t.jsx(be,{children:h})]})}const gs=re(t.jsx("path",{d:"M15 21h2v-2h-2zm4-12h2V7h-2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2zm8-6h2v-2h-2zM15 5h2V3h-2zm4 8h2v-2h-2zm0 8c1.1 0 2-.9 2-2h-2z"})),ys=re(t.jsx("path",{d:"M15 15H3v2h12zm0-8H3v2h12zM3 13h18v-2H3zm0 8h18v-2H3zM3 3v2h18V3z"})),js=re(t.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}));function vs({value:e,onChange:s,placeholder:r,minRows:f=6,error:g,helperText:x,onBlur:d,disabled:v}){const[l,y]=o.useState(null),j=!!(g||l),u=l??x??"",h=o.useCallback(async()=>{try{await navigator.clipboard.writeText(e),y(null)}catch{y("Unable to copy to clipboard")}},[e]),M=o.useCallback(b=>{if(!e.trim()){s(""),y(null);return}try{const T=JSON.parse(e),q=b===void 0?JSON.stringify(T):JSON.stringify(T,null,b);s(q),y(null)}catch(T){console.error("Invalid JSON string",T),y("Invalid JSON body")}},[s,e]),w=()=>M(2),z=()=>M(void 0);return t.jsxs(O,{children:[t.jsxs(k,{direction:"row",spacing:.5,justifyContent:"flex-end",sx:{mb:1},children:[t.jsx(se,{size:"small",onClick:h,"aria-label":"Copy body",disabled:v,children:t.jsx(Et,{fontSize:"small"})}),t.jsx(se,{size:"small",onClick:w,"aria-label":"Format body",disabled:v,children:t.jsx(ys,{fontSize:"small"})}),t.jsx(se,{size:"small",onClick:z,"aria-label":"Inline body",disabled:v,children:t.jsx(js,{fontSize:"small"})})]}),t.jsx(ye,{placeholder:r,multiline:!0,fullWidth:!0,minRows:f,value:e,onChange:b=>{y(null),s(b.target.value)},onBlur:d,error:j,helperText:u,disabled:v}),j&&!u?t.jsx(B,{variant:"caption",color:"error",children:"Invalid JSON body"}):null]})}const Ee=({title:e,defaultExpanded:s=!0,summaryActions:r,schemaView:f,children:g})=>t.jsxs(ve,{defaultExpanded:s,children:[t.jsxs(Ce,{expandIcon:t.jsx(we,{}),sx:{alignItems:"center",gap:1},children:[t.jsx(B,{variant:"subtitle1",sx:{flexGrow:1},children:e}),r?t.jsx(k,{direction:"row",spacing:.5,alignItems:"center",children:r}):null]}),t.jsx(be,{children:t.jsx(k,{spacing:1,children:t.jsxs(k,{direction:{xs:"column",lg:"row"},spacing:2,alignItems:"stretch",children:[t.jsx(O,{flex:1,children:g}),f?t.jsx(O,{flexBasis:{lg:"40%"},minWidth:0,sx:{maxHeight:{lg:400},overflowY:"auto"},children:f}):null]})})})]});function Cs({method:e,path:s,queryRows:r,headerRows:f,bodyText:g,onMethodChange:x,onPathChange:d,onQueryChange:v,onHeadersChange:l,onBodyChange:y,querySection:j,headersSection:u,bodySection:h,disabled:M}){return t.jsxs(k,{spacing:2,children:[t.jsx(Ee,{title:"Query parameters",defaultExpanded:(j==null?void 0:j.defaultExpanded)??!0,summaryActions:j==null?void 0:j.summaryActions,schemaView:j==null?void 0:j.schemaView,children:t.jsx(je,{title:"",disableAccordion:!0,rows:r,onChange:v,showFieldMeta:(j==null?void 0:j.showFieldMeta)??!0,disabled:M})}),t.jsx(Ee,{title:"Headers",defaultExpanded:(u==null?void 0:u.defaultExpanded)??!1,summaryActions:u==null?void 0:u.summaryActions,schemaView:u==null?void 0:u.schemaView,children:t.jsx(je,{title:"",disableAccordion:!0,rows:f,onChange:l,actions:u==null?void 0:u.actions,disabled:M})}),t.jsx(Ee,{title:"Body",defaultExpanded:(h==null?void 0:h.defaultExpanded)??!1,summaryActions:h==null?void 0:h.summaryActions,schemaView:h==null?void 0:h.schemaView,children:t.jsx(vs,{value:g,onChange:y,error:h==null?void 0:h.error,helperText:h==null?void 0:h.helperText,minRows:8,onBlur:h==null?void 0:h.onBlur,disabled:M})})]})}function ws({requestInput:e,endpointOptions:s,isLoading:r,onEndpointSelect:f,onRequestInputChange:g,onCommit:x,onBlur:d,label:v="Method & URL",helperText:l,disabled:y}){return t.jsx(_t,{freeSolo:!0,fullWidth:!0,inputValue:e,options:s,loading:r,onChange:f,onInputChange:g,getOptionLabel:j=>typeof j=="string"?j:j.display,isOptionEqualToValue:(j,u)=>typeof j=="string"||typeof u=="string"?!1:j.value===u.value,renderInput:j=>t.jsx(ye,{...j,label:v,helperText:l,onBlur:d,onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),x==null||x())},InputProps:{...j.InputProps,endAdornment:t.jsxs(t.Fragment,{children:[r?t.jsx(nt,{size:16}):null,j.InputProps.endAdornment]}),disabled:y}})})}function bs({tab:e,onUpdateTab:s,endpointOptions:r,isOptionsLoading:f,onSearchChange:g,onEndpointSelect:x,runner:d}){var le,R,ne,D,ce,K,oe,ee,ae,ie,F,J,Y,de,S,H,V,ue;const{defaultHeaders:v,setDefaultHeaders:l}=ot(),y=(d==null?void 0:d.bodyError)??null,j=(d==null?void 0:d.setBodyError)??(()=>{}),u=o.useMemo(()=>e.route?e.route.method===e.method&&e.route.path===e.url:!1,[e]),h=o.useMemo(()=>{var m,a;return u?(a=(m=e.route)==null?void 0:m.contract)==null?void 0:a.body:void 0},[u,e.route]),M=o.useMemo(()=>`${e.method.toUpperCase()} ${e.url}`.trim(),[e.method,e.url]),[w,z]=o.useState(M),[b,T]=o.useState({params:!1,query:!1,body:!1});o.useEffect(()=>{z(M)},[M,e.id]),o.useEffect(()=>{if(!h||e.body&&e.body.trim().length>0)return;const m=Wt(h);if(m!==void 0)try{const a=JSON.stringify(m,null,2);s(P=>({...P,body:a}))}catch{}},[h,s,e.body]),o.useEffect(()=>{var P,A;if(!u)return;const m=(A=(P=e.route)==null?void 0:P.contract)==null?void 0:A.query;if(!m||e.query.length>0)return;const a=xe(m);a.length!==0&&s(te=>({...te,query:a}))},[u,s,e.query.length,e.route]);const q=o.useCallback(m=>{const a=m.trim();if(!a)return;const P=Fe(a);if(P){x(P.display);return}const[A,...te]=a.split(" ");if(te.length>0){const N=A.toLowerCase(),he=te.join(" ").trim()||"/";if(_e.includes(N)){s(ke=>({...ke,method:N,url:he}));return}}else{const N=A.toLowerCase();if(_e.includes(N)){s(he=>({...he,method:N}));return}}s(N=>({...N,url:a}))},[x,s]),X=o.useCallback(()=>{w.trim()!==M.trim()&&q(w)},[q,w,M]),Z=o.useMemo(()=>{var m;return!u||!((m=e.route)!=null&&m.contract)?!1:!!(e.route.contract.params||e.route.contract.query||e.route.contract.body)},[u,e.route]),G=o.useCallback(()=>{s(m=>{var A;let a={...m};const P=(A=m.route)==null?void 0:A.contract;if(P!=null&&P.params&&(a={...a,params:ge(a.params,P.params)}),P!=null&&P.query&&(a={...a,query:ge(a.query,P.query)}),P!=null&&P.body){let te;if(a.body&&a.body.trim().length>0)try{te=JSON.parse(a.body)}catch{return a}const N=Qe(te,P.body);try{a={...a,body:JSON.stringify(N,null,2)}}catch{}}return a})},[s]),U=o.useCallback(()=>{var a,P;const m=(P=(a=e.route)==null?void 0:a.contract)==null?void 0:P.params;m&&s(A=>({...A,params:ge(A.params,m)}))},[s,e.route]),L=o.useCallback(()=>{var a,P;const m=(P=(a=e.route)==null?void 0:a.contract)==null?void 0:P.query;m&&s(A=>({...A,query:ge(A.query,m)}))},[s,e.route]),Q=o.useCallback(()=>{if(!h)return;let m;if(e.body&&e.body.trim().length>0)try{m=JSON.parse(e.body),j(null)}catch{j("Invalid JSON body");return}const a=Qe(m,h);try{const P=JSON.stringify(a,null,2);s(A=>({...A,body:P}))}catch{}},[h,s,j,e.body]),c=o.useCallback((m,a)=>{if(a){if(typeof a=="string"){z(a),q(a);return}z(a.display),x(a),g("")}},[q,x,g]),$=o.useCallback((m,a,P)=>{z(a),P==="input"&&g(a),(P==="clear"||P==="reset"&&a==="")&&g("")},[g]);return t.jsx(k,{spacing:2,sx:{minHeight:0,flexGrow:1},children:t.jsxs(k,{spacing:2,sx:{minHeight:0},children:[t.jsxs(k,{direction:{xs:"column",md:"row"},spacing:1.5,alignItems:{xs:"stretch",md:"center"},children:[t.jsx(ws,{requestInput:w,endpointOptions:r,isLoading:f,onEndpointSelect:c,onRequestInputChange:$,onBlur:X,onCommit:X,helperText:"Type a method and path or select an endpoint"}),u&&Z?t.jsx(_,{size:"small",variant:"outlined",onClick:G,sx:{whiteSpace:"nowrap",minWidth:"auto"},children:"Fill All"}):null]}),u?null:t.jsx(rt,{severity:"info",children:"Path parameters are disabled because this tab targets a raw URL."}),u?t.jsx(Is,{title:"Path parameters",defaultExpanded:e.params.length>0,schema:(R=(le=e.route)==null?void 0:le.contract)==null?void 0:R.params,schemaTitle:"Path parameters schema",showSchema:b.params,summaryActions:t.jsxs(t.Fragment,{children:[(D=(ne=e.route)==null?void 0:ne.contract)!=null&&D.params?t.jsx(_,{size:"small",variant:"text",onClick:m=>{m.stopPropagation(),U()},children:"Fill defaults"}):null,(K=(ce=e.route)==null?void 0:ce.contract)!=null&&K.params?t.jsx(Se,{showSchema:b.params,label:"path schema",onToggle:m=>T(a=>({...a,params:m}))}):null]}),children:t.jsx(je,{title:"",disableAccordion:!0,rows:e.params,onChange:m=>s(a=>({...a,params:m})),showFieldMeta:(ee=(oe=e.route)==null?void 0:oe.contract)!=null&&ee.params?b.params:!0})}):null,t.jsx(Cs,{method:e.method,path:e.url,queryRows:e.query,headerRows:e.headers,bodyText:e.body,onMethodChange:m=>s(a=>({...a,method:m})),onPathChange:m=>s(a=>({...a,url:m})),onQueryChange:m=>s(a=>({...a,query:m})),onHeadersChange:m=>s(a=>({...a,headers:m})),onBodyChange:m=>s(a=>({...a,body:m})),querySection:{defaultExpanded:e.query.length>0,summaryActions:t.jsxs(t.Fragment,{children:[(ie=(ae=e.route)==null?void 0:ae.contract)!=null&&ie.query?t.jsx(_,{size:"small",variant:"text",onClick:m=>{m.stopPropagation(),L()},children:"Fill defaults"}):null,(J=(F=e.route)==null?void 0:F.contract)!=null&&J.query?t.jsx(Se,{showSchema:b.query,label:"query schema",onToggle:m=>T(a=>({...a,query:m}))}):null]}),schemaView:b.query&&((de=(Y=e.route)==null?void 0:Y.contract)!=null&&de.query)?t.jsx(Te,{title:"Query schema",schema:(H=(S=e.route)==null?void 0:S.contract)==null?void 0:H.query}):void 0,showFieldMeta:(ue=(V=e.route)==null?void 0:V.contract)!=null&&ue.query?b.query:!0},headersSection:{defaultExpanded:!1,actions:t.jsxs(k,{direction:"row",spacing:1,children:[t.jsx(_,{size:"small",variant:"text",onClick:m=>{m.stopPropagation(),s(a=>({...a,headers:at(v)}))},disabled:v.length===0,children:"Use defaults"}),t.jsx(_,{size:"small",variant:"text",onClick:m=>{m.stopPropagation(),l(e.headers)},disabled:e.headers.length===0,children:"Save as defaults"})]})},bodySection:{defaultExpanded:!!h||e.body.trim().length>0,summaryActions:t.jsxs(t.Fragment,{children:[h?t.jsx(_,{size:"small",variant:"text",onClick:m=>{m.stopPropagation(),Q()},children:"Use defaults"}):null,h?t.jsx(Se,{showSchema:b.body,label:"body schema",onToggle:m=>T(a=>({...a,body:m}))}):null]}),schemaView:h&&b.body?t.jsx(Te,{title:"Body schema",schema:h}):void 0,helperText:y||(u?"Leave empty for no body":"JSON payload to send with this custom request"),error:!!y}})]})})}function ze(e,s){if(!s)return e;const r=e.map(x=>{const d=s[x.key];return d==null?x:{...x,value:String(d),enabled:!0}}),f=new Set(e.map(x=>x.key)),g=Object.entries(s).filter(([x])=>!f.has(x)).map(([x,d])=>He({key:x,value:d==null?"":String(d),enabled:!0}));return[...r,...g]}function xe(e){return e?e.kind==="object"&&e.properties?Object.entries(e.properties).map(([s,r])=>He({key:s,value:Kt(r),enabled:!(r!=null&&r.optional),typeHint:Gt(r),description:r==null?void 0:r.description})):[]:[]}function ks(e,s){if(e==null)return s?JSON.stringify({},null,2):"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return s?JSON.stringify({},null,2):""}}function Is({title:e,defaultExpanded:s,schema:r,schemaTitle:f,showSchema:g,summaryActions:x,children:d}){return t.jsxs(ve,{defaultExpanded:s,children:[t.jsxs(Ce,{expandIcon:t.jsx(k,{direction:"row",spacing:.5,alignItems:"center",children:t.jsx(we,{})}),children:[t.jsx(B,{variant:"subtitle1",sx:{flexGrow:1},children:e}),x?t.jsx(k,{direction:"row",spacing:.5,alignItems:"center",children:x}):null]}),t.jsx(be,{children:t.jsx(Ps,{schema:r,schemaTitle:f,showSchema:g,children:d})})]})}function Ps({children:e,schema:s,schemaTitle:r,showSchema:f}){return t.jsx(k,{spacing:1,children:t.jsxs(k,{direction:{xs:"column",lg:"row"},spacing:2,alignItems:"stretch",sx:{width:"100%"},children:[t.jsx(O,{flex:1,children:e}),f&&s?t.jsx(O,{flexBasis:{lg:"40%"},minWidth:0,sx:{maxHeight:{lg:400},overflowY:"auto"},children:t.jsx(Te,{title:r,schema:s})}):null]})})}function Se({showSchema:e,label:s,onToggle:r}){return r?t.jsx(Oe,{title:e?`Hide ${s}`:`Show ${s}`,placement:"top",children:t.jsx(se,{size:"small",color:e?"primary":"default",onClick:f=>{f.stopPropagation(),r(!e)},"aria-pressed":e,children:t.jsx(gs,{fontSize:"small",sx:{transition:"transform 0.2s ease",transform:e?"rotateY(180deg)":"none"}})})}):null}function Ms(e,s){const{fetch:r}=it(),{addRun:f}=lt(),[g,x]=o.useState(!1),[d,v]=o.useState(null);o.useEffect(()=>{v(null),x(!1)},[e==null?void 0:e.id]);const l=o.useCallback(async()=>{var u;if(!e)return;let y;if(e.body)try{y=JSON.parse(e.body),v(null)}catch{v("Invalid JSON body");return}const j=`run-${Date.now()}`;x(!0);try{const h={params:e.params,query:e.query,headers:e.headers,body:e.body},M=await r(e.method,e.url,h,j),w=pe(e.params),z=pe(e.query),b=pe(e.headers),T={id:M.id,method:M.log.method,path:M.log.path,createdAt:M.log.createdAt,durationMs:M.log.durationMs,status:M.log.status,response:M.log.output,errorMessage:(u=M.error)==null?void 0:u.message,headers:M.log.headers,request:{params:w,query:z,body:y,headers:b}};f(T),s(q=>({...q,latestResponse:T}))}catch(h){console.error("Playground run failed",h)}finally{x(!1)}},[f,r,s,e]);return{isRunning:g,bodyError:d,setBodyError:v,run:l}}const Es={method:"get",path:"/",stability:"unknown"},Ye=120,zs=800;function Ss(e){return{method:e.method,path:e.path,summary:e.summary,contract:e.contract,stability:e.stability}}function Bs(e,s,r){var d,v,l;const f=xe((d=s==null?void 0:s.contract)==null?void 0:d.params),g=xe((v=s==null?void 0:s.contract)==null?void 0:v.query),x=(l=s==null?void 0:s.contract)!=null&&l.body?JSON.stringify({},null,2):"";return{...e,name:r,method:(s==null?void 0:s.method)??e.method,url:(s==null?void 0:s.path)??e.url,params:f,query:g,headers:e.headers,body:x,latestResponse:null,route:s}}function Os({initialRoute:e,initialLabel:s,renderLayout:r}){var Re,De,Ne,$e;const{openPanel:f}=zt(),{client:g}=it(),{consumePrefill:x,prefillVersion:d,tabsState:v,updateTabsState:l}=lt(),{defaultHeaders:y,setDefaultHeaders:j,resetDefaultHeaders:u}=ot(),[h,M]=o.useState(Ye),w=o.useRef(null),z=o.useCallback(n=>{if(!w.current)return;const p=w.current.startY-n.clientY,i=w.current.startHeight+p;M(Math.min(Math.max(i,Ye),zs))},[]),b=o.useCallback(()=>{w.current=null,document.removeEventListener("pointermove",z),document.removeEventListener("pointerup",b)},[z]),T=o.useCallback(n=>{n.preventDefault(),w.current={startY:n.clientY,startHeight:h},document.addEventListener("pointermove",z),document.addEventListener("pointerup",b)},[h,z,b]);o.useEffect(()=>()=>{document.removeEventListener("pointermove",z),document.removeEventListener("pointerup",b)},[z,b]);const[q,X]=o.useState(""),[Z,G]=o.useState(!1),U=o.useRef(null),L=v.tabs,Q=v.activeTabId,c=L.find(n=>n.id===Q)??null,$=e??Es,{options:le,isLoading:R}=Ft(q),ne=o.useMemo(()=>{const n=new Map;return le.forEach(p=>n.set(p.value,p)),L.forEach(p=>{if(!p.route)return;const{displayId:i}=Pe(p.route.method,p.route.path);!i||n.has(i)||n.set(i,{value:i,display:i,method:p.route.method,path:p.route.path})}),Array.from(n.values())},[le,L]),D=o.useMemo(()=>!c||!c.route?!1:c.route.method===c.method&&c.route.path===c.url,[c]),ce=c?D?"matched":"raw":"matched",K=o.useMemo(()=>!c||!D||!c.route?null:Pe(c.route.method,c.route.path).displayId??null,[c,D]),oe=!!K&&D,ee=ce==="matched"?((Re=c==null?void 0:c.route)==null?void 0:Re.summary)??(e==null?void 0:e.summary)??"":"Raw URL request",ae=e?`${e.method}:${e.path}`:null,ie=o.useMemo(()=>{if(!e)return null;const{displayId:n}=Pe(e.method,e.path);return n??null},[e]),F=o.useCallback((n,p=$,i)=>{var Ve,Le,Je,We,Ge;const C=xe((Ve=p.contract)==null?void 0:Ve.params),I=xe((Le=p.contract)==null?void 0:Le.query),E=at(y),W=(Je=p.contract)!=null&&Je.body?JSON.stringify({},null,2):"",fe=(i==null?void 0:i.method)??p.method,ft=(i==null?void 0:i.path)??p.path,Ie=(We=i==null?void 0:i.tabName)==null?void 0:We.trim(),gt=Ie&&Ie.length>0?Ie:n;return{id:`tab-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,name:gt,url:ft,method:fe,params:i!=null&&i.params?ze(C,i.params):C,query:i!=null&&i.query?ze(I,i.query):I,headers:i!=null&&i.headers?ze(E,i.headers):E,body:i?ks(i.body,!!((Ge=p.contract)!=null&&Ge.body)):W,latestResponse:null,route:p}},[y,$]);o.useEffect(()=>{if(L.length>0){Q||l(I=>{var E;return{...I,activeTabId:((E=I.tabs[0])==null?void 0:E.id)??null}});return}const n=e?{method:e.method,path:e.path}:void 0,p=x(n),i=(s==null?void 0:s.trim())||(e?`${e.method.toUpperCase()} ${e.path}`:"Tab 1"),C=F(i,e??$,p);l({tabs:[C],activeTabId:C.id})},[Q,x,F,$,s,e,L.length,l]),o.useEffect(()=>{!e||!ae||l(n=>{const p=n.tabs.find(E=>E.route?E.route.method===e.method&&E.route.path===e.path:E.method===e.method&&E.url===e.path);if(p)return n.activeTabId===p.id?n:{...n,activeTabId:p.id};const i=x({method:e.method,path:e.path,leafKey:ie??void 0}),C=(s==null?void 0:s.trim())||`${e.method.toUpperCase()} ${e.path}`,I=F(C,e,i);return{tabs:[...n.tabs,I],activeTabId:I.id}})},[x,F,ie,s,e,ae,l]),o.useEffect(()=>{e&&l(n=>{let p=!1;const i=n.tabs.map(C=>!C.route||C.route.method!==e.method||C.route.path!==e.path||C.route.contract&&C.route.summary?C:(p=!0,C.params.length===0&&C.query.length===0&&C.body.trim().length===0?Bs(C,e,C.name):{...C,route:e}));return p?{...n,tabs:i}:n})},[e,l]);const J=o.useCallback((n,p)=>{n&&l(i=>{let C=!1;const I=i.tabs.map(E=>{if(E.id!==n)return E;const W=p(E);return W===E?E:(C=!0,W)});return C?{...i,tabs:I}:i})},[l]),Y=o.useCallback(n=>{J(Q,n)},[Q,J]),de=o.useCallback(()=>{l(n=>{const p=F(`Tab ${n.tabs.length+1}`);return{tabs:[...n.tabs,p],activeTabId:p.id}})},[F,l]),S=o.useCallback(n=>{l(p=>({...p,activeTabId:n}))},[l]),H=o.useCallback(n=>{l(p=>{var I,E;if(p.tabs.length<=1){const W=F("Tab 1");return{tabs:[W],activeTabId:W.id}}const i=p.tabs.filter(W=>W.id!==n),C=p.activeTabId===n?((I=i[i.length-1])==null?void 0:I.id)??((E=i[0])==null?void 0:E.id)??null:p.activeTabId;return{tabs:i,activeTabId:C}})},[F,l]),V=o.useCallback(n=>{X(n)},[]),ue=o.useCallback(async n=>{var i;const p=St(n);if(!p)return null;try{const I=(i=(await g.fetch({method:"GET",path:"/__rrroutes/endpoints/:endpointId",params:{endpointId:p}})).data)==null?void 0:i.out;return I?Ss(I):null}catch(C){return console.error("Failed to load endpoint detail for playground",C),null}},[g]);o.useEffect(()=>{if(!d)return;const n=x();if(!n)return;let p=null;l(i=>{var E;const C=(E=n.tabName)!=null&&E.trim()&&n.tabName.trim().length>0?n.tabName.trim():n.method&&n.path?`${n.method.toUpperCase()} ${n.path}`:`Tab ${i.tabs.length+1}`,I=F(C,$,n);return p=I,{tabs:[...i.tabs,I],activeTabId:I.id}}),n.leafKey&&p&&ue(n.leafKey).then(i=>{!i||!p||J(p.id,C=>({...C,route:i}))})},[x,F,$,d,ue,J,l]);const m=o.useCallback(n=>{if(!n)return;const p=typeof n=="string"?Fe(n):n;if(!p)return;const i=p.method.toLowerCase(),C=p.path,I=L.find(E=>E.method.toLowerCase()===i&&E.url===C);if(I){S(I.id);return}Y(E=>({...E,method:i,url:C}))},[S,Y,L]),a=((c==null?void 0:c.method)??$.method).toUpperCase(),P=(c==null?void 0:c.url)??$.path,A=D?oe?"Route matched. Click to view endpoint.":"Route matched.":"Raw request. No matching endpoint.",te=o.useCallback(()=>{K&&f("endpoints")},[K,f]);o.useEffect(()=>{if(!c)return;const n=c.id,p=setTimeout(async()=>{const i=`${c.method.toUpperCase()} ${c.url}`.trim();if(!i)return;const C=ne.find(I=>I.value===i);if(C&&(!c.route||c.route.path!==C.path||c.route.method!==C.method)){U.current=i;const I=await ue(C.value);if(U.current!==i||!I)return;U.current=null,J(n,E=>{var W,fe;return((W=E.route)==null?void 0:W.path)===I.path&&((fe=E.route)==null?void 0:fe.method)===I.method?E:{...E,route:I}})}else!C&&c.route&&J(n,I=>I.route?{...I,route:void 0}:I)},500);return()=>{clearTimeout(p)}},[c,ne,ue,J]);const N=Ms(c??null,Y),he=o.useMemo(()=>c!=null&&c.latestResponse?{status:c.latestResponse.status,duration:c.latestResponse.durationMs,time:new Date(c.latestResponse.createdAt).toLocaleTimeString(),errorMessage:c.latestResponse.errorMessage,response:c.latestResponse.response}:null,[c==null?void 0:c.latestResponse]),ke=t.jsx(Oe,{title:"Default headers",children:t.jsx(se,{color:"inherit",onClick:()=>G(!0),"aria-label":"Default headers",size:"small",children:t.jsx(Ot,{fontSize:"small"})})}),ct=t.jsx(fs,{items:L,activeId:Q,isLoading:R,onSelect:S,onAdd:de,onClose:H,renderLabel:n=>{var p;return((p=n.name)==null?void 0:p.trim())||"Untitled Request"}}),dt=c?t.jsx(Bt,{method:c.method,url:c.url,headers:pe(c.headers),body:c.body||void 0,queryParams:pe(c.query)}):null,ut=t.jsxs(k,{direction:"row",spacing:1,alignItems:"center",children:[t.jsx(_,{variant:"contained",onClick:n=>{n.stopPropagation(),N.run()},disabled:N.isRunning,startIcon:t.jsx(Ht,{}),children:N.isRunning?"Running...":"Run"}),dt]}),ht=Math.max(h-140,180),pt=c?t.jsxs(O,{sx:{bgcolor:"background.paper",borderTop:"1px solid",borderColor:"divider",boxShadow:n=>`0 -8px 16px ${n.palette.common.black}11`,height:h,display:"flex",flexDirection:"column",overflow:"hidden"},children:[t.jsx(O,{onPointerDown:T,sx:{cursor:"row-resize",py:.5,display:"flex",justifyContent:"center",borderBottom:"1px solid",borderColor:"divider",bgcolor:"background.paper"},role:"presentation","aria-label":"Resize last run panel",children:t.jsx(O,{sx:{width:64,height:4,borderRadius:999,bgcolor:"divider"}})}),t.jsx(O,{sx:{flexGrow:1,overflow:"hidden",p:2},children:t.jsx(xs,{extendable:!0,lastRun:he,runButton:ut,maxDetailsHeight:ht})})]}):null,mt=t.jsx(k,{spacing:0,sx:{width:"100%",overflowX:"hidden",minHeight:0},children:t.jsx(O,{sx:{flexGrow:1,minHeight:0,p:{xs:2,md:3},display:"flex",overflowX:"hidden"},children:t.jsx(k,{spacing:3,flexGrow:1,sx:{minHeight:0,width:"100%"},children:c?t.jsxs(k,{spacing:3,flexGrow:1,sx:{minHeight:0},children:[t.jsxs(k,{spacing:.5,children:[t.jsxs(k,{direction:{xs:"column",sm:"row"},spacing:1.5,alignItems:{xs:"flex-start",sm:"center"},children:[t.jsx(Lt,{value:c.name,onChange:n=>Y(p=>({...p,name:n.target.value})),placeholder:"Untitled Request",sx:{fontSize:{xs:24,sm:28},fontWeight:600,px:1,py:.5,borderRadius:1,border:"1px solid",borderColor:"transparent",bgcolor:"background.paper",width:"100%",maxWidth:480,"&:hover":{borderColor:"divider"},"&:focus-within":{borderColor:"primary.main",boxShadow:n=>`0 0 0 3px ${n.palette.primary.main}22`}}}),t.jsx(Oe,{title:A,children:t.jsx("span",{children:t.jsx(se,{size:"small",onClick:oe?te:void 0,disabled:!oe,"aria-label":D?"Route matched":"Route not matched",sx:{color:D?((De=c.route)==null?void 0:De.stability)=="unknown"?"warning.main":"success.main":"error.main","&.Mui-disabled":{color:D?((Ne=c.route)==null?void 0:Ne.stability)=="unknown"?"warning.main":"success.main":"error.main",opacity:.5}},children:D?(($e=c.route)==null?void 0:$e.stability)=="unknown"?t.jsx(hs,{fontSize:"small"}):t.jsx(ds,{fontSize:"small"}):t.jsx(us,{fontSize:"small"})})})})]}),t.jsxs(B,{variant:"subtitle2",color:"text.secondary",children:[a," ",P]}),ee?t.jsx(B,{variant:"body2",color:"text.secondary",children:ee}):null]}),t.jsx(B,{variant:"body1",color:"text.secondary",children:ce==="matched"?"Execute this endpoint directly and inspect the response. Use the contract as a guide when filling params, query, and body.":"Execute a request against a custom URL. Query and body editors remain available, while route parameters are disabled."}),t.jsx(bs,{tab:c,onUpdateTab:Y,endpointOptions:ne,isOptionsLoading:R,onSearchChange:V,onEndpointSelect:m,runner:N},c.id)]}):t.jsxs(k,{spacing:2,alignItems:"center",justifyContent:"center",sx:{flexGrow:1},children:[t.jsx(B,{color:"text.secondary",children:"Get started by creating your first request."}),t.jsx(_,{variant:"contained",startIcon:t.jsx(qe,{}),onClick:de,children:"Create new Request"})]})})})}),xt=r({topOverlay:ct,bottomOverlay:pt,content:mt,settingsButton:ke});return t.jsxs(t.Fragment,{children:[xt,t.jsx(Ts,{open:Z,onClose:()=>G(!1),headers:y,onChange:j,onReset:u})]})}function Ts({open:e,onClose:s,headers:r,onChange:f,onReset:g}){return t.jsxs(Tt,{open:e,onClose:s,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Dt,{children:"Default headers"}),t.jsx(qt,{dividers:!0,children:t.jsx(je,{title:"Default headers",rows:r,onChange:f,disableAccordion:!0,actions:t.jsx(_,{size:"small",variant:"text",onClick:g,disabled:r.length===0,children:"Reset"})})}),t.jsx(Nt,{children:t.jsx(_,{onClick:s,children:"Close"})})]})}function Xe(){const e=o.useRef(null),s=o.useRef(null),[r,f]=o.useState(0),g=()=>{var d;(d=e.current)==null||d.disconnect(),e.current=null},x=o.useCallback(d=>{if(s.current===d)return;if(g(),s.current=d,!d){f(0);return}const v=()=>{f(d.getBoundingClientRect().height)};e.current=new ResizeObserver(l=>{if(!Array.isArray(l)||l.length===0)return;const y=l[0];y&&f(y.contentRect.height)}),e.current.observe(d),v()},[]);return o.useEffect(()=>()=>{g()},[]),{ref:x,height:r}}function qs({top:e,bottom:s,children:r}){const f=Xe(),g=Xe(),d={position:"fixed",left:{xs:0,sm:240},right:0,zIndex:v=>v.zIndex.drawer+2};return t.jsxs(O,{sx:{position:"relative",width:"100%"},children:[t.jsx(O,{sx:{pt:10,pb:20,minHeight:"100%"},children:r}),e?t.jsx(Ue,{children:t.jsx(O,{sx:{...d,top:v=>{var l;return((l=v.mixins.toolbar)==null?void 0:l.minHeight)??64}},children:t.jsx(O,{ref:f.ref,sx:{pointerEvents:"auto",width:"100%"},children:e})})}):null,s?t.jsx(Ue,{children:t.jsx(O,{sx:{...d,bottom:0,pb:"env(safe-area-inset-bottom)"},children:t.jsx(O,{ref:g.ref,sx:{pointerEvents:"auto",width:"100%"},children:s})})}):null]})}function Us(){const{endpointId:e}=At(),s=e?decodeURIComponent(e):"",r=o.useMemo(()=>Fe(s),[s]),f=(r==null?void 0:r.display)??s??"",{data:g}=Rt(f),x=o.useMemo(()=>{if(g)return{method:g.method,path:g.path,summary:g.summary,contract:g.contract};if(r)return{method:r.method,path:r.path}},[g,r]);return t.jsx(Jt,{children:t.jsx(Os,{initialRoute:x,initialLabel:f,renderLayout:({topOverlay:d,bottomOverlay:v,content:l,settingsButton:y})=>t.jsx(qs,{top:d,bottom:v,children:t.jsxs(k,{spacing:4,children:[t.jsxs(k,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:2,children:[t.jsxs(O,{children:[t.jsx(B,{variant:"h4",component:"h1",gutterBottom:!0,children:"Playground"}),t.jsx(B,{variant:"body1",color:"text.secondary",children:"Experiment with any endpoint using the playground."})]}),t.jsx(O,{sx:{alignSelf:{xs:"flex-end",sm:"center"}},children:y})]}),l]})})})})}export{Us as default};
@@ -0,0 +1 @@
1
+ import{j as o}from"./vendor-xyflow.js";import{R as s}from"./docs.js";const a=s(o.jsx("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}));export{a as E};
@@ -0,0 +1,2 @@
1
+ import{j as h}from"./vendor-xyflow.js";import{D as E}from"./Download.js";import{h as y}from"./vendor-recharts.js";import{a3 as C}from"./docs.js";const j="text/csv;charset=utf-8;",S=t=>t.toLowerCase().endsWith(".csv")?t:`${t}.csv`,m=t=>{if(t==null)return"";let e;if(t instanceof Date)e=t.toISOString();else if(typeof t=="object")try{e=JSON.stringify(t)}catch{e=String(t)}else e=String(t);const o=e.replace(/"/g,'""');return/[",\n\r]/.test(e)?`"${o}"`:o},v=t=>{const e=[],o=new Set;return t.forEach(r=>{Object.keys(r).forEach(s=>{o.has(s)||(o.add(s),e.push(s))})}),e};function g(t,e){if(typeof document>"u")throw new Error("exportToCsv can only be used in a browser environment.");const o=v(e),r=[];o.length&&r.push(o.map(c=>m(c)).join(",")),e.forEach(c=>{const p=o.map(i=>m(c[i]));r.push(p.join(","))});const s=r.join(`\r
2
+ `),d=new Blob([s],{type:j}),l=URL.createObjectURL(d),n=document.createElement("a");n.href=l,n.setAttribute("download",S(t)),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(l)}function D({filename:t,rows:e,getRows:o,children:r="Export CSV",disabled:s,startIcon:d,variant:l="outlined",size:n="small",color:c="secondary",...p}){const[i,f]=y.useState(!1),b=y.useCallback(async()=>{if(!i){f(!0);try{let a=[];if(typeof o=="function"){const u=await o();a=Array.isArray(u)?u:[]}else Array.isArray(e)&&(a=e);g(t,a)}catch(a){console.error("Failed to export CSV",a)}finally{f(!1)}}},[i,t,o,e]),x=s||i||!e&&!o;return h.jsx(C,{variant:l,size:n,color:c,disabled:x,onClick:b,startIcon:d??h.jsx(E,{fontSize:"small"}),...p,children:r})}export{D as E};
@@ -0,0 +1,20 @@
1
+ import{j as o,H as _,P as G,i as He,C as Le,M as We,B as Be,u as Ue,a as _e,b as Ce}from"./vendor-xyflow.js";import{A as Ge}from"./Add.js";import{R as ue,h as J,G as F,T as C,k as h,S as T,a_ as Ve,j as ne,a1 as Re,a2 as Je,g as Se,am as ce,a3 as W,a$ as Ke,a9 as Qe,b0 as Xe,b1 as Ye,b2 as Ze,b3 as et,b4 as ke,b5 as oe,b6 as tt,c as ot,al as Te,b7 as Ne,b8 as nt}from"./docs.js";import{P as st}from"./PlayArrow.js";import{h as l}from"./vendor-recharts.js";import{u as rt,a as at}from"./useEndpointOptions.js";import{d as it,b as lt,s as ct}from"./schemaDefaults.js";import{S as Ae,T as V,P as dt}from"./PageContainer.js";import{A as ut}from"./Autocomplete.js";const pt=ue(o.jsx("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"})),ft=ue(o.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),ht=ue(o.jsx("path",{d:"M6 6h12v12H6z"})),mt=ue(o.jsx("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z"})),je=120;function xt({data:e}){const t=J();return o.jsxs(F,{onClick:e.onSelect,sx:{width:je,height:je,transform:"rotate(45deg)",bgcolor:h(t.palette.background.paper,.85),border:`1px solid ${h("#ffffff",.12)}`,backdropFilter:"blur(12px)",borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",cursor:e.onSelect?"pointer":"default",transition:"box-shadow 160ms ease, border-color 160ms ease","&:hover":e.onSelect?{borderColor:h(t.palette.secondary.main,.5),boxShadow:`0 0 0 3px ${h(t.palette.secondary.main,.12)}`}:void 0},children:[o.jsx(_,{type:"target",position:G.Left,style:{width:16,height:16,background:t.palette.text.secondary,border:"none"}}),o.jsxs(F,{sx:{transform:"rotate(-45deg)",textAlign:"center",px:1,maxWidth:je*.85},children:[o.jsx(C,{variant:"caption",sx:{color:t.palette.text.secondary,fontWeight:600,fontSize:"0.6rem",textTransform:"uppercase",letterSpacing:.5,display:"block",mb:.25},children:"if"}),o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.65rem",color:t.palette.text.primary,lineHeight:1.3,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:e.expression})]}),o.jsx(_,{id:"true",type:"source",position:G.Top,style:{width:16,height:16,background:t.palette.status.success,border:"none"}}),o.jsx(_,{id:"false",type:"source",position:G.Bottom,style:{width:16,height:16,background:t.palette.status.error,border:"none"}})]})}function yt(e){if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${parseFloat(t.toFixed(1))}s`;const n=Math.floor(t/60),s=t-n*60;return s===0?`${n}m`:`${n}m ${parseFloat(s.toFixed(1))}s`}function bt({data:e}){const t=J(),n=t.palette.primary.main;return o.jsxs(F,{onClick:e.onSelect,sx:{width:140,p:1.25,borderRadius:2,bgcolor:h(t.palette.background.paper,.85),border:`1px solid ${h(n,.4)}`,backdropFilter:"blur(12px)",cursor:e.onSelect?"pointer":"default",transition:"box-shadow 160ms ease, border-color 160ms ease","&:hover":e.onSelect?{borderColor:h(n,.65),boxShadow:`0 0 0 3px ${h(n,.12)}`}:void 0},children:[o.jsx(_,{type:"target",position:G.Left,style:{width:16,height:16,background:t.palette.text.secondary,border:"none"}}),o.jsxs(T,{direction:"row",alignItems:"center",spacing:1,justifyContent:"center",children:[o.jsxs(F,{component:"svg",viewBox:"0 0 24 24",sx:{width:18,height:18,fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",flexShrink:0},children:[o.jsx("circle",{cx:"12",cy:"13",r:"8"}),o.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),o.jsx("line",{x1:"12",y1:"13",x2:"15",y2:"13"}),o.jsx("line",{x1:"9",y1:"1",x2:"15",y2:"1"}),o.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"4"})]}),o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontWeight:700,fontSize:"0.85rem",color:n},children:yt(e.durationMs)})]}),o.jsx(_,{type:"source",position:G.Right,style:{width:16,height:16,background:n,border:"none"}})]})}function gt({data:e}){const t=J(),n=t.palette.secondary.main;return o.jsxs(F,{onClick:e.onSelect,sx:{width:220,borderRadius:2,bgcolor:h(t.palette.background.paper,.85),border:`1px solid ${h(n,.4)}`,backdropFilter:"blur(12px)",overflow:"hidden",cursor:e.onSelect?"pointer":"default",transition:"box-shadow 160ms ease, border-color 160ms ease","&:hover":e.onSelect?{borderColor:h(n,.65),boxShadow:`0 0 0 3px ${h(n,.12)}`}:void 0},children:[o.jsx(_,{type:"target",position:G.Left,style:{width:16,height:16,background:t.palette.text.secondary,border:"none"}}),o.jsx(F,{sx:{px:1.5,py:.5,bgcolor:h(n,.12),borderBottom:`1px solid ${h(n,.2)}`},children:o.jsx(C,{variant:"caption",sx:{fontWeight:700,fontSize:"0.65rem",textTransform:"uppercase",letterSpacing:.5,color:n},children:"Extract"})}),o.jsx(F,{sx:{px:1.5,py:1},children:o.jsxs(T,{direction:"row",alignItems:"center",spacing:.75,children:[o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.72rem",fontWeight:600,color:t.palette.text.primary},children:e.variableName}),o.jsx(C,{variant:"body2",sx:{fontSize:"0.7rem",color:t.palette.text.secondary},children:"→"}),o.jsx(C,{noWrap:!0,variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.72rem",color:n,flex:1,minWidth:0},children:e.jsonPath})]})}),o.jsx(_,{type:"source",position:G.Right,style:{width:16,height:16,background:n,border:"none"}})]})}function jt({data:e}){const t=J(),n=e.method.toLowerCase(),s=Ve(n),a=e.headers?Object.keys(e.headers).length:0,c=!!e.body;return o.jsxs(F,{onClick:e.onSelect,sx:{width:220,p:1.5,borderRadius:2,bgcolor:h(t.palette.background.paper,.85),border:`1px solid ${h("#ffffff",.12)}`,backdropFilter:"blur(12px)",cursor:e.onSelect?"pointer":"default",transition:"box-shadow 160ms ease, border-color 160ms ease","&:hover":e.onSelect?{borderColor:h(s,.5),boxShadow:`0 0 0 3px ${h(s,.12)}`}:void 0},children:[o.jsx(_,{type:"target",position:G.Left,style:{width:16,height:16,background:t.palette.text.secondary,border:"none"}}),o.jsxs(T,{direction:"row",alignItems:"center",spacing:1,mb:.75,children:[o.jsx(ne,{label:e.method.toUpperCase(),size:"small",variant:"outlined",sx:{borderColor:s,color:s,bgcolor:h(s,.15),fontWeight:700,fontSize:"0.65rem",height:22}}),o.jsx(C,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace",fontSize:"0.75rem",color:t.palette.text.primary,flex:1,minWidth:0},children:e.path})]}),(a>0||c)&&o.jsxs(T,{direction:"row",spacing:1,children:[a>0&&o.jsxs(C,{variant:"caption",sx:{color:t.palette.text.secondary,fontSize:"0.65rem"},children:[a," header",a!==1?"s":""]}),c&&o.jsx(C,{variant:"caption",sx:{color:t.palette.text.secondary,fontSize:"0.65rem"},children:"body"})]}),o.jsx(_,{type:"source",position:G.Right,style:{width:16,height:16,background:s,border:"none"}})]})}function wt({nodes:e,edges:t,onNodesChange:n,onEdgesChange:s,onConnect:a,onNodeClick:c,onMouseMove:r}){const d=J(),p=l.useMemo(()=>({request:jt,condition:xt,extract:gt,delay:bt}),[]);return o.jsxs(He,{nodes:e,edges:t,onNodesChange:n,onEdgesChange:s,onConnect:a,onNodeClick:c,onMouseMove:r,nodeTypes:p,connectionRadius:30,fitView:!0,proOptions:{hideAttribution:!0},style:{backgroundColor:d.palette.background.default},children:[o.jsx(Le,{position:"bottom-left",style:{backgroundColor:h(d.palette.background.paper,.85),borderRadius:d.shape.borderRadius,border:`1px solid ${h("#ffffff",.1)}`,backdropFilter:"blur(12px)"}}),o.jsx(We,{nodeStrokeWidth:3,nodeColor:h(d.palette.primary.main,.6),maskColor:h(d.palette.background.default,.8),style:{backgroundColor:h(d.palette.background.paper,.72),borderRadius:d.shape.borderRadius,border:`1px solid ${h("#ffffff",.08)}`}}),o.jsx(Be,{color:h("#ffffff",.04),gap:24,size:1})]})}const vt=ue(o.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),Ct=["GET","POST","PUT","PATCH","DELETE"];function St({node:e,onUpdate:t,onClose:n}){const s=J();return e?o.jsxs(F,{sx:{width:480,flexShrink:0,borderLeft:`1px solid ${h("#ffffff",.08)}`,bgcolor:h(s.palette.background.paper,.72),backdropFilter:"blur(16px)",display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[o.jsxs(T,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{px:2,py:1.5,borderBottom:`1px solid ${h("#ffffff",.08)}`,flexShrink:0},children:[o.jsxs(C,{variant:"subtitle1",sx:{textTransform:"capitalize"},children:[e.type," Node"]}),o.jsx(Re,{size:"small",onClick:n,children:o.jsx(Je,{fontSize:"small"})})]}),o.jsxs(F,{sx:{flex:1,overflow:"auto",px:2,py:2},children:[e.type==="request"&&o.jsx(kt,{nodeId:e.id,data:e.data,onUpdate:t}),e.type==="condition"&&o.jsx(Tt,{nodeId:e.id,data:e.data,onUpdate:t}),e.type==="delay"&&o.jsx(Nt,{nodeId:e.id,data:e.data,onUpdate:t}),e.type==="extract"&&o.jsx(Et,{nodeId:e.id,data:e.data,onUpdate:t})]})]}):null}function kt({nodeId:e,data:t,onUpdate:n}){const[s,a]=l.useState(t.method),[c,r]=l.useState(t.path),[d,p]=l.useState(""),[S,w]=l.useState(()=>t.headers?Object.entries(t.headers).map(([u,f])=>({key:u,value:f})):[]),[v,y]=l.useState(()=>t.queryParams?Object.entries(t.queryParams).map(([u,f])=>({key:u,value:f})):[]),[j,E]=l.useState(t.body??""),[M,R]=l.useState(null),{options:be}=rt(d),I=s&&c&&Se(s,c).displayId||null,{data:A}=at(I);l.useEffect(()=>{var B;if(!(A!=null&&A.contract)||I===M||Se(A.method,A.path).displayId!==I)return;R(I);const f=A.contract;if(((B=f.query)==null?void 0:B.kind)==="object"&&f.query.properties){const O=f.query.properties;y(X=>{const ge=new Set(X.map(Y=>Y.key)),xe=[...X];for(const[Y,Z]of Object.entries(O))!Z||ge.has(Y)||xe.push({key:Y,value:lt(Z),typeHint:it(Z),optional:Z.optional});return xe})}const b=[];["POST","PUT","PATCH"].includes(s.toUpperCase())&&b.push({key:"Content-Type",value:"application/json"}),b.push({key:"Accept",value:"application/json"}),w(b),f.body&&["POST","PUT","PATCH"].includes(s.toUpperCase())&&E(O=>{if(O.trim().length>0&&O.trim()!==`{
2
+
3
+ }`)return O;const X=ct(f.body);try{return JSON.stringify(X,null,2)}catch{return O}})},[A,I,M,s]),l.useEffect(()=>{a(t.method),r(t.path),p(""),R(null),w(t.headers?Object.entries(t.headers).map(([u,f])=>({key:u,value:f})):[]),y(t.queryParams?Object.entries(t.queryParams).map(([u,f])=>({key:u,value:f})):[]),E(t.body??"")},[e]);const K=l.useCallback((u,f)=>{if(f){if(typeof f=="string"){r(f);return}a(f.method.toUpperCase()),r(f.path),p(""),y([]),w([]),E(""),R(null)}},[]),se=l.useCallback(()=>{const u={};for(const b of S)b.key.trim()&&(u[b.key.trim()]=b.value);const f={};for(const b of v)b.key.trim()&&(f[b.key.trim()]=b.value);n(e,{method:s,path:c,headers:Object.keys(u).length>0?u:void 0,queryParams:Object.keys(f).length>0?f:void 0,body:j.trim()||void 0})},[e,s,c,S,v,j,n]),pe=l.useCallback(()=>{w(u=>[...u,{key:"",value:""}])},[]),re=l.useCallback(u=>{w(f=>f.filter((b,D)=>D!==u))},[]),fe=l.useCallback((u,f,b)=>{w(D=>D.map((B,O)=>O===u?{...B,[f]:b}:B))},[]),ae=l.useCallback(()=>{y(u=>[...u,{key:"",value:""}])},[]),he=l.useCallback(u=>{y(f=>f.filter((b,D)=>D!==u))},[]),me=l.useCallback((u,f,b)=>{y(D=>D.map((B,O)=>O===u?{...B,[f]:b}:B))},[]),ie=["POST","PUT","PATCH"].includes(s);return o.jsxs(T,{spacing:2,children:[o.jsxs(T,{direction:"row",spacing:1,children:[o.jsx(Ae,{value:s,onChange:u=>{a(u.target.value),R(null)},size:"small",sx:{minWidth:90},children:Ct.map(u=>o.jsx(ce,{value:u,children:u},u))}),o.jsx(ut,{freeSolo:!0,options:be,getOptionLabel:u=>typeof u=="string"?u:u.display,inputValue:c,onInputChange:(u,f,b)=>{b!=="reset"&&(r(f),b==="input"&&p(f))},onChange:K,renderOption:(u,f)=>{const{key:b,...D}=u;return o.jsx("li",{...D,children:o.jsxs(T,{direction:"row",spacing:1,alignItems:"center",sx:{width:"100%"},children:[o.jsx(ne,{label:typeof f=="string"?"GET":f.method.toUpperCase(),size:"small",sx:{fontWeight:700,fontSize:"0.65rem",minWidth:48,height:20}}),o.jsx(C,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace",fontSize:"0.8rem"},children:typeof f=="string"?f:f.path})]})},b)},renderInput:u=>o.jsx(V,{...u,label:"Path",size:"small",placeholder:"/api/resource"}),sx:{flex:1}})]}),o.jsx(Ee,{label:"Query",rows:v,onAdd:ae,onRemove:he,onUpdate:me}),o.jsx(Ee,{label:"Headers",rows:S,onAdd:pe,onRemove:re,onUpdate:fe}),ie&&o.jsx(V,{label:"Body",size:"small",fullWidth:!0,multiline:!0,minRows:3,maxRows:12,value:j,onChange:u=>E(u.target.value),placeholder:'{"key": "value"}',sx:{"& textarea":{fontFamily:"monospace",fontSize:"0.8rem"}}}),o.jsx(W,{variant:"contained",size:"small",onClick:se,children:"Apply"})]})}function Ee({label:e,rows:t,onAdd:n,onRemove:s,onUpdate:a}){return o.jsxs(F,{children:[o.jsx(C,{variant:"caption",color:"text.secondary",sx:{mb:.5,display:"block"},children:e}),o.jsxs(T,{spacing:.75,children:[t.map((c,r)=>o.jsxs(F,{children:[o.jsxs(T,{direction:"row",spacing:.5,alignItems:"center",children:[o.jsx(V,{size:"small",placeholder:"Key",value:c.key,onChange:d=>a(r,"key",d.target.value),sx:{flex:1}}),o.jsx(V,{size:"small",placeholder:"Value",value:c.value,onChange:d=>a(r,"value",d.target.value),sx:{flex:1}}),o.jsx(Re,{size:"small",onClick:()=>s(r),children:o.jsx(vt,{fontSize:"small"})})]}),c.typeHint&&o.jsxs(C,{variant:"caption",color:"text.secondary",sx:{pl:.5,fontSize:"0.65rem",display:"block"},children:[c.typeHint,c.optional?"":" (required)"]})]},r)),t.length===0&&o.jsx(C,{variant:"caption",color:"text.secondary",sx:{fontSize:"0.7rem"},children:"None"}),o.jsx(W,{size:"small",variant:"outlined",onClick:n,sx:{alignSelf:"flex-start"},children:"Add"})]})]})}function Tt({nodeId:e,data:t,onUpdate:n}){const[s,a]=l.useState(t.expression);l.useEffect(()=>{a(t.expression)},[e]);const c=l.useCallback(()=>{n(e,{expression:s})},[e,s,n]);return o.jsxs(T,{spacing:2,children:[o.jsx(V,{label:"Expression",size:"small",fullWidth:!0,value:s,onChange:r=>a(r.target.value),placeholder:"{{response.status}} === 200",helperText:"Use {{variable}} syntax for template values",sx:{"& input":{fontFamily:"monospace",fontSize:"0.85rem"}}}),o.jsx(W,{variant:"contained",size:"small",onClick:c,children:"Apply"})]})}function Nt({nodeId:e,data:t,onUpdate:n}){const[s,a]=l.useState(t.durationMs);l.useEffect(()=>{a(t.durationMs)},[e]);const c=l.useCallback(()=>{n(e,{durationMs:s})},[e,s,n]);return o.jsxs(T,{spacing:2,children:[o.jsx(V,{label:"Duration (ms)",size:"small",fullWidth:!0,type:"number",value:s,onChange:r=>a(Number(r.target.value)),inputProps:{min:0,step:100},helperText:"How long to wait before proceeding to the next node"}),o.jsx(W,{variant:"contained",size:"small",onClick:c,children:"Apply"})]})}function Et({nodeId:e,data:t,onUpdate:n}){const[s,a]=l.useState(t.variableName),[c,r]=l.useState(t.jsonPath);l.useEffect(()=>{a(t.variableName),r(t.jsonPath)},[e]);const d=l.useCallback(()=>{n(e,{variableName:s,jsonPath:c})},[e,s,c,n]);return o.jsxs(T,{spacing:2,children:[o.jsx(V,{label:"Variable name",size:"small",fullWidth:!0,value:s,onChange:p=>a(p.target.value),placeholder:"userId",sx:{"& input":{fontFamily:"monospace",fontSize:"0.85rem"}}}),o.jsx(V,{label:"JSON path",size:"small",fullWidth:!0,value:c,onChange:p=>r(p.target.value),placeholder:"response.data.id",helperText:"Dot-notation path into the response object",sx:{"& input":{fontFamily:"monospace",fontSize:"0.85rem"}}}),o.jsx(W,{variant:"contained",size:"small",onClick:d,children:"Apply"})]})}const Pt=Xe`
4
+ 0% { transform: scale(1); opacity: 1; }
5
+ 50% { transform: scale(1.35); opacity: 0.7; }
6
+ 100% { transform: scale(1); opacity: 1; }
7
+ `;function It(e){if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${parseFloat(t.toFixed(1))}s`;const n=Math.floor(t/60),s=t-n*60;return s===0?`${n}m`:`${n}m ${parseFloat(s.toFixed(1))}s`}function zt(e,t){return t.errorNodeId===e?"error":t.currentNodeId===e?"current":t.completedNodeIds.includes(e)?"completed":"pending"}function Ft({runState:e,nodes:t}){const n=J(),s=l.useMemo(()=>t.find(p=>p.id===e.currentNodeId)??null,[t,e.currentNodeId]),a=e.completedNodeIds.length,c=t.length,r=c>0?a/c*100:0,d={completed:n.palette.status.success,current:n.palette.secondary.main,error:n.palette.status.error,pending:h("#ffffff",.2)};return o.jsx(F,{sx:{px:2.5,py:1.5,bgcolor:h(n.palette.background.paper,.85),borderTop:`1px solid ${h("#ffffff",.08)}`,backdropFilter:"blur(14px)"},children:o.jsxs(T,{spacing:1.25,children:[o.jsxs(T,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[o.jsxs(T,{direction:"row",alignItems:"center",spacing:1,children:[o.jsx(C,{variant:"caption",sx:{color:n.palette.text.secondary},children:e.status==="running"?"Running":e.status==="completed"?"Completed":e.status==="error"?"Error":"Idle"}),s&&o.jsx(ne,{label:`${s.type}: ${Pe(s)}`,size:"small",variant:"outlined",sx:{height:22,fontSize:"0.7rem",borderColor:h(n.palette.secondary.main,.4),color:n.palette.text.primary}})]}),o.jsx(C,{variant:"caption",sx:{fontFamily:"monospace",fontWeight:600,color:n.palette.text.secondary},children:It(e.elapsedMs)})]}),o.jsx(Ke,{variant:e.status==="running"?"buffer":"determinate",value:r,valueBuffer:e.status==="running"?r+100/Math.max(c,1):r,sx:{height:4,borderRadius:2,bgcolor:h("#ffffff",.06),"& .MuiLinearProgress-bar":{borderRadius:2,bgcolor:e.status==="error"?n.palette.status.error:n.palette.status.success},"& .MuiLinearProgress-bar2Buffer":{bgcolor:h(n.palette.secondary.main,.3)}}}),o.jsx(T,{direction:"row",spacing:.75,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:t.map(p=>{const S=zt(p.id,e),w=d[S],v=e.variables.filter(j=>j.sourceNodeId===p.id).map(j=>`${j.name} = ${JSON.stringify(j.value)}`).join(`
8
+ `),y=`${p.type}: ${Pe(p)}${v?`
9
+ `+v:""}`;return o.jsx(Qe,{title:y,arrow:!0,children:o.jsx(F,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:w,transition:"background-color 200ms ease",...S==="current"?{animation:`${Pt} 1.2s ease-in-out infinite`}:{}}})},p.id)})})]})})}function Pe(e){switch(e.type){case"request":{const t=e.data;return`${t.method} ${t.path}`}case"condition":{const t=e.data;return t.expression.length>30?t.expression.slice(0,30)+"...":t.expression}case"delay":return`${e.data.durationMs}ms`;case"extract":{const t=e.data;return`${t.variableName} <- ${t.jsonPath}`}default:return e.id}}function Rt({variables:e,nodes:t}){const n=J(),s=l.useMemo(()=>{const a=new Map;for(const c of t)a.set(c.id,Mt(c));return a},[t]);return e.length===0?o.jsx(C,{variant:"body2",color:"text.secondary",sx:{p:2},children:"No variables have been extracted yet."}):o.jsx(Ye,{elevation:0,sx:{bgcolor:h(n.palette.background.paper,.5),border:`1px solid ${h("#ffffff",.07)}`},children:o.jsxs(Ze,{size:"small",children:[o.jsx(et,{children:o.jsxs(ke,{children:[o.jsx(oe,{children:"Name"}),o.jsx(oe,{children:"Value"}),o.jsx(oe,{children:"Source Node"})]})}),o.jsx(tt,{children:e.map(a=>o.jsxs(ke,{children:[o.jsx(oe,{children:o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontWeight:600,fontSize:"0.8rem",color:n.palette.primary.main},children:a.name})}),o.jsx(oe,{children:o.jsx(C,{variant:"body2",sx:{fontFamily:"monospace",fontSize:"0.78rem",color:n.palette.text.primary,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:At(a.value)})}),o.jsx(oe,{children:o.jsx(C,{variant:"body2",sx:{fontSize:"0.78rem",color:n.palette.text.secondary},children:a.sourceNodeId?s.get(a.sourceNodeId)??a.sourceNodeId:"—"})})]},a.name))})]})})}function At(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return`"${e}"`;if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function Mt(e){switch(e.type){case"request":{const t=e.data;return`${t.method} ${t.path}`}case"condition":return`if ${e.data.expression.slice(0,20)}`;case"delay":return`delay ${e.data.durationMs}ms`;case"extract":return`extract ${e.data.variableName}`;default:return e.id}}const Me="rrroutes.flows",Ie={status:"idle",currentNodeId:null,completedNodeIds:[],errorNodeId:null,errorMessage:null,variables:[],elapsedMs:0},qe=l.createContext(null);function qt(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Me);if(!e)return[];const t=JSON.parse(e);return Dt(t)}catch(e){return console.warn("Failed to parse stored flows",e),[]}}function Dt(e){return Array.isArray(e)?e.map(t=>Ot(t)).filter(t=>!!t):[]}function Ot(e){if(!e||typeof e!="object")return null;const t=e,n=typeof t.id=="string"&&t.id.trim().length>0?t.id:void 0,s=typeof t.name=="string"?t.name:"";if(!n)return null;const a=Array.isArray(t.nodes)?t.nodes.filter(r=>!!r&&typeof r=="object"&&typeof r.id=="string"):[],c=Array.isArray(t.edges)?t.edges.filter(r=>!!r&&typeof r=="object"&&typeof r.id=="string"&&typeof r.source=="string"&&typeof r.target=="string"):[];return{id:n,name:s,nodes:a,edges:c}}function $t({children:e}){const[t,n]=l.useState(()=>qt()),[s,a]=l.useState(null),[c,r]=l.useState(Ie);l.useEffect(()=>{typeof window>"u"||window.localStorage.setItem(Me,JSON.stringify(t))},[t]);const d=l.useCallback(E=>{n(M=>[...M,E])},[]),p=l.useCallback(E=>{n(M=>M.map(R=>R.id===E.id?E:R))},[]),S=l.useCallback(E=>{n(M=>M.filter(R=>R.id!==E)),s===E&&a(null)},[s]),w=l.useCallback(E=>{a(E)},[]),v=l.useCallback(E=>{r(E)},[]),y=l.useCallback(()=>{r(Ie)},[]),j=l.useMemo(()=>({flows:t,activeFlowId:s,runState:c,addFlow:d,updateFlow:p,deleteFlow:S,setActiveFlow:w,setRunState:v,resetRunState:y}),[t,s,c,d,p,S,w,v,y]);return o.jsx(qe.Provider,{value:j,children:e})}function Ht(){const e=l.useContext(qe);if(!e)throw new Error("useFlows must be used within FlowProvider");return e}const Lt=/\{\{([^}]+)\}\}/g;function de(e,t){return e.replace(Lt,(n,s)=>{const a=Wt(t,s.trim());return a==null?n:String(a)})}function ye(e,t){if(typeof e=="string")return de(e,t);if(Array.isArray(e))return e.map(n=>ye(n,t));if(e&&typeof e=="object"){const n={};for(const[s,a]of Object.entries(e))n[s]=ye(a,t);return n}return e}function Wt(e,t){const n=t.split(".");let s=e;for(const a of n){if(s==null||typeof s!="object")return;s=s[a]}return s}async function Bt(e){const{flow:t,variables:n,fetchFn:s,onProgress:a,signal:c}=e,r={status:"running",currentNodeId:null,completedNodeIds:[],errorNodeId:null,errorMessage:null,variables:Object.entries(n).map(([v,y])=>({name:v,value:y})),elapsedMs:0},d=Date.now();a({...r});const p={...n};let S=null;const w=Ut(t.nodes,t.edges);for(const v of w){if(c!=null&&c.aborted)return r.status="error",r.errorMessage="Flow cancelled",r.elapsedMs=Date.now()-d,a({...r}),{...r};r.currentNodeId=v.id,r.elapsedMs=Date.now()-d,a({currentNodeId:r.currentNodeId,elapsedMs:r.elapsedMs});try{switch(v.type){case"request":{S=await _t(v.data,p,s),p.response=S;break}case"condition":{const y=v.data,j=Vt(y.expression,p);p["__condition_"+v.id]=j;break}case"delay":{const y=v.data;await Jt(y.durationMs,c);break}case"extract":{const y=v.data,j=Kt(S,y.jsonPath);p[y.variableName]=j,r.variables=[...r.variables.filter(E=>E.name!==y.variableName),{name:y.variableName,value:j,sourceNodeId:v.id}];break}}r.completedNodeIds=[...r.completedNodeIds,v.id],r.elapsedMs=Date.now()-d,a({completedNodeIds:[...r.completedNodeIds],variables:[...r.variables],elapsedMs:r.elapsedMs})}catch(y){return r.status="error",r.errorNodeId=v.id,r.errorMessage=y instanceof Error?y.message:String(y),r.currentNodeId=null,r.elapsedMs=Date.now()-d,a({...r}),{...r}}}return r.status="completed",r.currentNodeId=null,r.elapsedMs=Date.now()-d,a({...r}),{...r}}function Ut(e,t){const n=new Map;for(const d of e)n.set(d.id,d);const s=new Map,a=new Map;for(const d of e)s.set(d.id,0),a.set(d.id,[]);for(const d of t){const p=a.get(d.source);p&&p.push(d.target),s.set(d.target,(s.get(d.target)??0)+1)}const c=[];for(const[d,p]of s)p===0&&c.push(d);const r=[];for(;c.length>0;){const d=c.shift(),p=n.get(d);p&&r.push(p);for(const S of a.get(d)??[]){const w=(s.get(S)??1)-1;s.set(S,w),w===0&&c.push(S)}}return r}async function _t(e,t,n){const s=de(e.method,t),a=de(e.path,t),c=e.headers?ye(e.headers,t):void 0,r=e.body?de(e.body,t):void 0,d=e.queryParams?ye(e.queryParams,t):void 0;return n(s,a,{headers:c,body:r,queryParams:d})}const Gt=["===","!==",">=","<=",">","<"];function Vt(e,t){const n=de(e,t);let s=null,a=-1;for(const S of Gt){const w=n.indexOf(S);if(w!==-1){s=S,a=w;break}}if(!s||a===-1)return!!we(n.trim());const c=n.slice(0,a).trim(),r=n.slice(a+s.length).trim(),d=we(c),p=we(r);switch(s){case"===":return d===p;case"!==":return d!==p;case">":return Number(d)>Number(p);case"<":return Number(d)<Number(p);case">=":return Number(d)>=Number(p);case"<=":return Number(d)<=Number(p);default:return!1}}function we(e){if(e==="null")return null;if(e==="undefined")return;if(e==="true")return!0;if(e==="false")return!1;if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);const t=Number(e);return!Number.isNaN(t)&&e.length>0?t:e}function Jt(e,t){return new Promise((n,s)=>{if(t!=null&&t.aborted){s(new Error("Flow cancelled"));return}const a=setTimeout(()=>{r(),n()},e);function c(){clearTimeout(a),r(),s(new Error("Flow cancelled"))}function r(){t==null||t.removeEventListener("abort",c)}t==null||t.addEventListener("abort",c)})}function Kt(e,t){const n=t.split(".");let s=e;for(const a of n){if(s==null||typeof s!="object")return;s=s[a]}return s}const ze={request:()=>({method:"GET",path:"/api/"}),condition:()=>({expression:"{{response.status}} === 200"}),delay:()=>({durationMs:1e3}),extract:()=>({variableName:"value",jsonPath:"response.data"})};function Fe(e){return["POST","PUT","PATCH"].includes(e)?{method:e,path:"/api/",headers:{"Content-Type":"application/json"},body:`{
10
+
11
+ }`}:{method:e,path:"/api/"}}const Qt={q:"request",w:"condition",e:"delay",r:"extract"},Xt={request:"Q",condition:"W",delay:"E",extract:"R"};let Yt=0;function k(){return`p${++Yt}`}function N(e,t,n,s,a){return{id:e,type:t,position:{x:n,y:s},data:a}}function q(e,t,n){return{id:k(),source:e,target:t,sourceHandle:n}}const Zt=[{label:"Health Check",description:"Hit an endpoint and verify 200 status",build:()=>{const e=k(),t=k();return{name:"Health Check",nodes:[N(e,"request",100,100,{method:"GET",path:"/"}),N(t,"condition",100,280,{expression:"{{response.status}} === 200"})],edges:[q(e,t)]}}},{label:"Sequential Requests",description:"Two requests in sequence with a delay between them",build:()=>{const e=k(),t=k(),n=k();return{name:"Sequential Requests",nodes:[N(e,"request",100,80,{method:"GET",path:"/api/first"}),N(t,"delay",100,240,{durationMs:500}),N(n,"request",100,400,{method:"GET",path:"/api/second"})],edges:[q(e,t),q(t,n)]}}},{label:"Create & Verify",description:"POST to create, extract ID, GET to verify",build:()=>{const e=k(),t=k(),n=k(),s=k();return{name:"Create & Verify",nodes:[N(e,"request",100,60,{method:"POST",path:"/api/resource",body:`{
12
+ "name": "test"
13
+ }`,headers:{"Content-Type":"application/json"}}),N(t,"extract",100,230,{variableName:"resourceId",jsonPath:"response.data.id"}),N(n,"request",100,400,{method:"GET",path:"/api/resource/{{resourceId}}"}),N(s,"condition",100,570,{expression:"{{response.status}} === 200"})],edges:[q(e,t),q(t,n),q(n,s)]}}},{label:"Auth + Request",description:"Authenticate, extract token, make authorized request",build:()=>{const e=k(),t=k(),n=k();return{name:"Auth + Request",nodes:[N(e,"request",100,60,{method:"POST",path:"/api/auth/login",body:`{
14
+ "username": "admin",
15
+ "password": "password"
16
+ }`,headers:{"Content-Type":"application/json"}}),N(t,"extract",100,260,{variableName:"token",jsonPath:"response.data.token"}),N(n,"request",100,440,{method:"GET",path:"/api/protected/resource",headers:{Authorization:"Bearer {{token}}"}})],edges:[q(e,t),q(t,n)]}}},{label:"CRUD Flow",description:"Create, Read, Update, Delete a resource",build:()=>{const e=k(),t=k(),n=k(),s=k(),a=k();return{name:"CRUD Flow",nodes:[N(e,"request",100,40,{method:"POST",path:"/api/resource",body:`{
17
+ "name": "test"
18
+ }`,headers:{"Content-Type":"application/json"}}),N(t,"extract",100,200,{variableName:"id",jsonPath:"response.data.id"}),N(n,"request",100,360,{method:"GET",path:"/api/resource/{{id}}"}),N(s,"request",100,520,{method:"PUT",path:"/api/resource/{{id}}",body:`{
19
+ "name": "updated"
20
+ }`,headers:{"Content-Type":"application/json"}}),N(a,"request",100,680,{method:"DELETE",path:"/api/resource/{{id}}"})],edges:[q(e,t),q(t,n),q(n,s),q(s,a)]}}},{label:"Conditional Retry",description:"Request, check status, delay and retry on failure",build:()=>{const e=k(),t=k(),n=k(),s=k();return{name:"Conditional Retry",nodes:[N(e,"request",100,60,{method:"GET",path:"/api/resource"}),N(t,"condition",100,240,{expression:"{{response.status}} === 200"}),N(n,"delay",350,400,{durationMs:2e3}),N(s,"request",350,560,{method:"GET",path:"/api/resource"})],edges:[q(e,t),q(t,n,"false")]}}}];function uo(){return o.jsx($t,{children:o.jsx(eo,{})})}function eo(){const e=J(),{flows:t,activeFlowId:n,runState:s,addFlow:a,updateFlow:c,setActiveFlow:r,setRunState:d,resetRunState:p}=Ht(),{fetch:S}=ot(),[w,v]=l.useState(""),[y,j,E]=Ue([]),[M,R,be]=_e([]),[I,A]=l.useState(null),[K,se]=l.useState(null),[pe,re]=l.useState(null),[fe,ae]=l.useState(null),[he,me]=l.useState(null),ie=l.useRef({x:300,y:200}),u=l.useRef(null),f=l.useRef(null),b=l.useMemo(()=>t.find(i=>i.id===n)??null,[t,n]);l.useEffect(()=>{b?(v(b.name),j(b.nodes.map(i=>({id:i.id,type:i.type,position:i.position,data:i.data}))),R(b.edges.map(i=>({id:i.id,source:i.source,target:i.target,sourceHandle:i.sourceHandle??void 0}))),A(null)):(v(""),j([]),R([]),A(null))},[n]);const D=l.useCallback(i=>{R(m=>Ce(i,m))},[R]),B=l.useCallback((i,m)=>{const x={id:m.id,type:m.type,position:m.position,data:m.data};A(x)},[]),O=l.useCallback((i,m)=>{j(x=>x.map(P=>P.id===i?{...P,data:m}:P)),A(x=>x&&x.id===i?{...x,data:m}:x)},[j]),X=l.useCallback(i=>{const m=f.current;if(!m)return;const x=m.getBoundingClientRect();ie.current={x:i.clientX-x.left,y:i.clientY-x.top}},[]),ge=l.useCallback(()=>{A(null)},[]),xe=l.useCallback(()=>{const i=y.map(x=>({id:x.id,type:x.type,position:x.position,data:x.data})),m=M.map(x=>({id:x.id,source:x.source,target:x.target,sourceHandle:x.sourceHandle??void 0}));if(b)c({id:b.id,name:w||"Untitled Flow",nodes:i,edges:m});else{const x=Date.now().toString(36);a({id:x,name:w||"Untitled Flow",nodes:i,edges:m}),r(x)}},[b,w,y,M,a,c,r]),Y=l.useCallback(()=>{const i=Date.now().toString(36);a({id:i,name:"New Flow",nodes:[],edges:[]}),r(i)},[a,r]),Z=l.useCallback(i=>{const m=i.build(),x=Date.now().toString(36),P={id:x,...m};a(P),r(x),ae(null)},[a,r]),De=l.useCallback(i=>{const m=Date.now().toString(36),x=i==="request"?Fe("GET"):ze[i](),P={id:m,type:i,position:{x:300,y:200},data:x};j(U=>[...U,P]),re(null)},[j]);l.useEffect(()=>{const i=m=>{const x=m.target.tagName;if(x==="INPUT"||x==="TEXTAREA"||x==="SELECT"||m.target.isContentEditable)return;const P=m.key.toLowerCase(),U=Qt[P];if(U){m.preventDefault();const g=Date.now().toString(36),z=ie.current,$=U==="request"?Fe("GET"):ze[U](),H={id:g,type:U,position:{x:z.x-60,y:z.y-30},data:$};j(L=>[...L,H]);return}if(P==="tab"){m.preventDefault(),j(g=>{if(g.length===0)return g;const z=I?g.findIndex(Q=>Q.id===I.id):-1,$=m.shiftKey?-1:1,H=(z+$+g.length)%g.length,L=g[H];return A({id:L.id,type:L.type,position:L.position,data:L.data}),g});return}if(P==="enter"&&I){m.preventDefault(),K?K!==I.id&&(Date.now().toString(36),R(g=>Ce({source:K,target:I.id,sourceHandle:null,targetHandle:null},g)),se(null)):se(I.id);return}if(P==="escape"){K?se(null):A(null);return}if((P==="delete"||P==="backspace"||P==="x")&&I){m.preventDefault(),j(g=>g.filter(z=>z.id!==I.id)),R(g=>g.filter(z=>z.source!==I.id&&z.target!==I.id)),A(null);return}if(P==="f"){m.preventDefault();const g=ie.current;j(z=>{if(z.length===0)return z;let $=null,H=1/0;for(const L of z){const Q=L.position.x-g.x,ee=L.position.y-g.y,te=Q*Q+ee*ee;te<H&&(H=te,$=L)}return $&&A({id:$.id,type:$.type,position:$.position,data:$.data}),z});return}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[I,K,j,R]);const Oe=l.useCallback(async()=>{var U;if(s.status==="running"){(U=u.current)==null||U.abort();return}const i=y.map(g=>({id:g.id,type:g.type,position:g.position,data:g.data})),m=M.map(g=>({id:g.id,source:g.source,target:g.target,sourceHandle:g.sourceHandle??void 0})),x={id:(b==null?void 0:b.id)??"temp",name:w||"Untitled Flow",nodes:i,edges:m},P=new AbortController;u.current=P,p();try{const g=await Bt({flow:x,variables:{},fetchFn:async(z,$,H)=>{const L={query:H.queryParams?Object.entries(H.queryParams).map(([ee,te])=>({key:ee,value:te,enabled:!0})):[],params:[],headers:H.headers?Object.entries(H.headers).map(([ee,te])=>({key:ee,value:te,enabled:!0})):[],body:H.body??""},Q=await S(z.toLowerCase(),$,L,`flow-${Date.now().toString(36)}`);return{status:Q.log.status,data:Q.log.output,headers:Q.log.headers??{}}},onProgress:z=>{d({...s,...z})},signal:P.signal});d(g)}catch{}finally{u.current=null}},[s,y,M,b,w,S,p,d]),le=s.status==="running",$e=s.status!=="idle",ve=l.useMemo(()=>y.map(i=>({id:i.id,type:i.type,position:i.position,data:i.data})),[y]);return o.jsxs(dt,{title:"Flow Builder",children:[o.jsxs(T,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,sx:{mb:2},children:[o.jsx(V,{size:"small",placeholder:"Flow name",value:w,onChange:i=>v(i.target.value),sx:{minWidth:150,maxWidth:200}}),o.jsxs(Ae,{size:"small",value:n??"",onChange:i=>{const m=i.target.value;r(m||null)},displayEmpty:!0,sx:{minWidth:140},children:[o.jsx(ce,{value:"",children:o.jsx("em",{children:"Select a flow"})}),t.map(i=>o.jsx(ce,{value:i.id,children:i.name||i.id},i.id))]}),o.jsx(W,{size:"small",variant:"outlined",onClick:Y,children:"New"}),o.jsx(W,{size:"small",variant:"outlined",startIcon:o.jsx(mt,{fontSize:"small"}),onClick:i=>ae(i.currentTarget),children:"Presets"}),o.jsx(Te,{anchorEl:fe,open:!!fe,onClose:()=>ae(null),slotProps:{paper:{sx:{maxWidth:320}}},children:Zt.map(i=>o.jsx(ce,{onClick:()=>Z(i),children:o.jsx(Ne,{primary:i.label,secondary:i.description})},i.label))}),o.jsx(W,{size:"small",variant:"outlined",startIcon:o.jsx(ft,{fontSize:"small"}),onClick:xe,children:"Save"}),o.jsx(W,{size:"small",variant:"outlined",startIcon:o.jsx(Ge,{fontSize:"small"}),onClick:i=>re(i.currentTarget),children:"Add node"}),o.jsx(Te,{anchorEl:pe,open:!!pe,onClose:()=>re(null),children:["request","condition","delay","extract"].map(i=>o.jsx(ce,{onClick:()=>De(i),children:o.jsx(Ne,{primary:o.jsxs(T,{direction:"row",spacing:1,alignItems:"center",children:[o.jsx("span",{style:{textTransform:"capitalize"},children:i}),o.jsx(ne,{label:Xt[i],size:"small",variant:"outlined",sx:{height:18,fontSize:"0.65rem"}})]})})},i))}),o.jsx(W,{size:"small",variant:"contained",color:le?"error":"primary",startIcon:le?o.jsx(ht,{fontSize:"small"}):o.jsx(st,{fontSize:"small"}),onClick:Oe,children:le?"Stop":"Run"}),o.jsx(W,{size:"small",variant:"outlined",startIcon:o.jsx(pt,{fontSize:"small"}),onClick:i=>me(i.currentTarget),children:"Guide"}),o.jsxs(nt,{open:!!he,anchorEl:he,onClose:()=>me(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{sx:{maxWidth:380,p:2.5}}},children:[o.jsx(C,{variant:"subtitle2",gutterBottom:!0,children:"Keyboard shortcuts"}),o.jsx(T,{spacing:.5,sx:{mb:2},children:[["Q","Add Request node at cursor"],["W","Add Condition node at cursor"],["E","Add Delay node at cursor"],["R","Add Extract node at cursor"],["F","Select closest node to cursor"],["Tab / Shift+Tab","Cycle through nodes"],["Enter","Start connection from selected node"],["Enter (again)","Complete connection to selected node"],["X / Delete","Delete selected node"],["Esc","Cancel connection or deselect"]].map(([i,m])=>o.jsxs(T,{direction:"row",spacing:1.5,alignItems:"baseline",children:[o.jsx(ne,{label:i,size:"small",variant:"outlined",sx:{fontFamily:"monospace",fontSize:"0.7rem",height:20,minWidth:36}}),o.jsx(C,{variant:"body2",color:"text.secondary",sx:{fontSize:"0.8rem"},children:m})]},i))}),o.jsx(C,{variant:"subtitle2",gutterBottom:!0,children:"How to use"}),o.jsx(T,{spacing:.5,children:["Create a new flow or pick a preset template to start.","Add nodes with keyboard shortcuts or the Add node menu.","Connect nodes by dragging from a source handle to a target handle, or use Enter to connect via keyboard.","Click a node to edit its settings in the side panel.","POST/PUT/PATCH requests come prefilled with Content-Type and body template.","Use {{variable}} syntax in paths, headers, and conditions to reference extracted values.","Hit Run to execute the flow. Progress shows at the bottom."].map((i,m)=>o.jsxs(C,{variant:"body2",color:"text.secondary",sx:{fontSize:"0.8rem"},children:[m+1,". ",i]},m))})]}),K&&o.jsx(ne,{label:"Connecting... Tab to select target, Enter to link, Esc to cancel",size:"small",color:"info",variant:"outlined"})]}),o.jsxs(F,{ref:f,sx:{display:"flex",height:"calc(100vh - 260px)",minHeight:400,position:"relative",border:`1px solid ${h("#ffffff",.07)}`,borderRadius:2,overflow:"hidden"},children:[o.jsxs(F,{sx:{flex:1,position:"relative",minWidth:0},children:[o.jsx(wt,{nodes:y,edges:M,onNodesChange:E,onEdgesChange:be,onConnect:D,onNodeClick:B,onMouseMove:X}),$e&&o.jsx(F,{sx:{position:"absolute",bottom:0,left:0,right:0,zIndex:10},children:o.jsx(Ft,{runState:s,nodes:ve})})]}),I&&!le&&o.jsx(St,{node:I,onUpdate:O,onClose:ge}),le&&o.jsx(F,{sx:{width:340,flexShrink:0,borderLeft:`1px solid ${h("#ffffff",.08)}`,bgcolor:h(e.palette.background.paper,.72),backdropFilter:"blur(16px)",overflow:"auto",p:2},children:o.jsx(Rt,{variables:s.variables,nodes:ve})})]})]})}export{uo as default};
@@ -0,0 +1 @@
1
+ import{j as o}from"./vendor-xyflow.js";import{J as st,I as nt,aq as bt,U as rt,M as K,N as at,O as it,P as Ct,W as lt,X as vt,R as jt,h as Y,k as F,an as Bt,g as ct,a3 as Z,C as St,G as X,T as z,u as Mt,x as ut,S as E,B as Tt,D as J,y as W,ar as Rt,ab as kt,b as wt,e as $t,as as q,f as Lt,at as Et,a7 as It,H as Dt,Y as At,v as Ft,w as zt,a9 as Nt,a1 as Ot,au as Pt,av as Kt}from"./docs.js";import{u as Gt,R as Ut}from"./useQueryState.js";import{h as y,m as dt,p as Wt,B as pt,C as _,X as V,Y as Q,T as O,q as gt,A as Ht,y as _t,x as Vt,P as Qt,v as Yt,L as Zt}from"./vendor-recharts.js";import{B as Xt}from"./BaseFilterBar.js";import{g as Jt}from"./getValidReactChildren.js";import{B as qt,a as te,b as tt}from"./BentoGrid.js";import{P as ee,T as oe}from"./PageContainer.js";import{E as se}from"./ExportButton.js";import{D as ne}from"./filterTypes.js";import{A as re}from"./Autocomplete.js";import"./ExpandLess.js";import"./Download.js";function ae(t){return nt("MuiToggleButton",t)}const A=st("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),ft=y.createContext({}),ht=y.createContext(void 0);function ie(t,s){return s===void 0||t===void 0?!1:Array.isArray(s)?s.includes(t):t===s}const le=t=>{const{classes:s,fullWidth:n,selected:a,disabled:i,size:l,color:u}=t,c={root:["root",a&&"selected",i&&"disabled",n&&"fullWidth",`size${K(l)}`,u]};return at(c,ae,s)},ce=it(Ct,{name:"MuiToggleButton",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,s[`size${K(n.size)}`]]}})(lt(({theme:t})=>({...t.typography.button,borderRadius:(t.vars||t).shape.borderRadius,padding:11,border:`1px solid ${(t.vars||t).palette.divider}`,color:(t.vars||t).palette.action.active,[`&.${A.disabled}`]:{color:(t.vars||t).palette.action.disabled,border:`1px solid ${(t.vars||t).palette.action.disabledBackground}`},"&:hover":{textDecoration:"none",backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{color:"standard"},style:{[`&.${A.selected}`]:{color:(t.vars||t).palette.text.primary,backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.selectedOpacity),"&:hover":{backgroundColor:t.alpha((t.vars||t).palette.text.primary,`${(t.vars||t).palette.action.selectedOpacity} + ${(t.vars||t).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:t.alpha((t.vars||t).palette.text.primary,(t.vars||t).palette.action.selectedOpacity)}}}}},...Object.entries(t.palette).filter(vt()).map(([s])=>({props:{color:s},style:{[`&.${A.selected}`]:{color:(t.vars||t).palette[s].main,backgroundColor:t.alpha((t.vars||t).palette[s].main,(t.vars||t).palette.action.selectedOpacity),"&:hover":{backgroundColor:t.alpha((t.vars||t).palette[s].main,`${(t.vars||t).palette.action.selectedOpacity} + ${(t.vars||t).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:t.alpha((t.vars||t).palette[s].main,(t.vars||t).palette.action.selectedOpacity)}}}}})),{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{padding:7,fontSize:t.typography.pxToRem(13)}},{props:{size:"large"},style:{padding:15,fontSize:t.typography.pxToRem(15)}}]}))),N=y.forwardRef(function(s,n){const{value:a,...i}=y.useContext(ft),l=y.useContext(ht),u=bt({...i,selected:ie(s.value,a)},s),c=rt({props:u,name:"MuiToggleButton"}),{children:v,className:C,color:g="standard",disabled:j=!1,disableFocusRipple:S=!1,fullWidth:f=!1,onChange:L,onClick:R,selected:m,size:B="medium",value:k,...w}=c,$={...c,color:g,disabled:j,disableFocusRipple:S,fullWidth:f,size:B},I=le($),D=e=>{R&&(R(e,k),e.defaultPrevented)||L&&L(e,k)},M=l||"";return o.jsx(ce,{className:dt(i.className,I.root,C,M),disabled:j,focusRipple:!S,ref:n,onClick:D,onChange:L,value:k,ownerState:$,"aria-pressed":m,...w,children:v})});function ue(t){return nt("MuiToggleButtonGroup",t)}const b=st("MuiToggleButtonGroup",["root","selected","horizontal","vertical","disabled","grouped","groupedHorizontal","groupedVertical","fullWidth","firstButton","lastButton","middleButton"]),de=t=>{const{classes:s,orientation:n,fullWidth:a,disabled:i}=t,l={root:["root",n,a&&"fullWidth"],grouped:["grouped",`grouped${K(n)}`,i&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return at(l,ue,s)},pe=it("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[{[`& .${b.grouped}`]:s.grouped},{[`& .${b.grouped}`]:s[`grouped${K(n.orientation)}`]},{[`& .${b.firstButton}`]:s.firstButton},{[`& .${b.lastButton}`]:s.lastButton},{[`& .${b.middleButton}`]:s.middleButton},s.root,n.orientation==="vertical"&&s.vertical,n.fullWidth&&s.fullWidth]}})(lt(({theme:t})=>({display:"inline-flex",borderRadius:(t.vars||t).shape.borderRadius,variants:[{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${b.grouped}`]:{[`&.${b.selected} + .${b.grouped}.${b.selected}`]:{borderTop:0,marginTop:0}},[`& .${b.firstButton},& .${b.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${b.lastButton},& .${b.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${b.lastButton}.${A.disabled},& .${b.middleButton}.${A.disabled}`]:{borderTop:"1px solid transparent"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"horizontal"},style:{[`& .${b.grouped}`]:{[`&.${b.selected} + .${b.grouped}.${b.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${b.firstButton},& .${b.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${b.lastButton},& .${b.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${b.lastButton}.${A.disabled},& .${b.middleButton}.${A.disabled}`]:{borderLeft:"1px solid transparent"}}}]}))),ge=y.forwardRef(function(s,n){const a=rt({props:s,name:"MuiToggleButtonGroup"}),{children:i,className:l,color:u="standard",disabled:c=!1,exclusive:v=!1,fullWidth:C=!1,onChange:g,orientation:j="horizontal",size:S="medium",value:f,...L}=a,R={...a,disabled:c,fullWidth:C,orientation:j,size:S},m=de(R),B=y.useCallback((M,e)=>{if(!g)return;const r=f&&f.indexOf(e);let d;f&&r>=0?(d=f.slice(),d.splice(r,1)):d=f?f.concat(e):[e],g(M,d)},[g,f]),k=y.useCallback((M,e)=>{g&&g(M,f===e?null:e)},[g,f]),w=y.useMemo(()=>({className:m.grouped,onChange:v?k:B,value:f,size:S,fullWidth:C,color:u,disabled:c}),[m.grouped,v,k,B,f,S,C,u,c]),$=Jt(i),I=$.length,D=M=>{const e=M===0,r=M===I-1;return e&&r?"":e?m.firstButton:r?m.lastButton:m.middleButton};return o.jsx(pe,{role:"group",className:dt(m.root,l),ref:n,ownerState:R,...L,children:o.jsx(ft.Provider,{value:w,children:$.map((M,e)=>o.jsx(ht.Provider,{value:D(e),children:M},e))})})}),fe=jt(o.jsx("path",{d:"M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z"})),he=500,et=10;function me({requests:t,onSelectEndpoint:s}){var v;const n=Y(),{mostUsed:a,slowest:i}=y.useMemo(()=>ye(t),[t]),l=F(n.palette.primary.light,.9),u=((v=n.palette.status)==null?void 0:v.warning)??n.palette.secondary.light,c=F(u,.9);return o.jsxs(Bt,{container:!0,spacing:2,children:[o.jsx(ot,{title:"Most used requests",data:a,valueKey:"count",axisFormatter:C=>C.toLocaleString(),tooltipFormatter:C=>`${C.toLocaleString()} calls`,color:l,emptyLabel:"No request volume in the selected range yet.",onSelectEndpoint:s}),o.jsx(ot,{title:"Slowest requests",data:i,valueKey:"avgDuration",axisFormatter:C=>`${C.toLocaleString()} ms`,tooltipFormatter:C=>`${C.toLocaleString()} ms`,color:c,emptyLabel:"No duration data in the selected range yet.",onSelectEndpoint:s})]})}function ot({title:t,data:s,valueKey:n,axisFormatter:a,tooltipFormatter:i,color:l,emptyLabel:u,onSelectEndpoint:c}){const v=Y(),C=F("#ffffff",.12),[g,j]=y.useState(!1),S=s.length>et,f=g?s:s.slice(0,et),L=Math.max(f.length*38+60,260),R=S?o.jsx(Z,{size:"small",onClick:()=>j(m=>!m),children:g?"Collapse":`Show all (${s.length})`}):void 0;return o.jsx(St,{title:t,actions:R,flex:1,children:s.length?o.jsx(X,{sx:{height:L},children:o.jsx(Wt,{width:"100%",height:"100%",children:o.jsxs(pt,{data:f,layout:"vertical",margin:{left:0,right:16,top:8,bottom:8},children:[o.jsx(_,{stroke:"rgba(255,255,255,0.08)"}),o.jsx(V,{type:"number",tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:m=>{const B=typeof m=="number"?m:Number(m);return a?a(Number.isFinite(B)?B:0):(Number.isFinite(B)?B:0).toLocaleString()}}),o.jsx(Q,{dataKey:"label",type:"category",width:220,tick:{fill:"rgba(255,255,255,0.85)",fontSize:12},tickLine:!1,axisLine:!1}),o.jsx(O,{cursor:{fill:F("#ffffff",.08)},contentStyle:{backgroundColor:v.palette.background.paper,borderColor:C},formatter:m=>[i(typeof m=="number"?m:Number(m)||0),""],labelFormatter:m=>m}),o.jsx(gt,{dataKey:n,fill:l,radius:[3,3,3,3],cursor:"pointer",onClick:m=>{const B=m==null?void 0:m.payload;B!=null&&B.endpointId&&c(B.endpointId)}})]})})}):o.jsx(xe,{label:u})})}function xe({label:t}){return o.jsx(X,{sx:{py:4},children:o.jsx(z,{color:"text.secondary",align:"center",children:t})})}function ye(t){const s=t.slice(0,he),n=new Map;s.forEach(u=>{const{displayId:c}=ct(u.method,u.path);if(!c)return;const v=n.get(c)??{label:c,count:0,totalDuration:0};v.count+=1,v.totalDuration+=u.durationMs??0,n.set(c,v)});const a=Array.from(n.entries()).map(([u,c])=>({endpointId:u,label:c.label,count:c.count,avgDuration:c.count===0?0:Math.round(c.totalDuration/Math.max(c.count,1))})),i=[...a].sort((u,c)=>c.count===u.count?u.label.localeCompare(c.label):c.count-u.count),l=[...a].sort((u,c)=>c.avgDuration===u.avgDuration?u.label.localeCompare(c.label):c.avgDuration-u.avgDuration);return{mostUsed:i,slowest:l}}const H={title:"Not enough data to display",description:"Widen the filters to see insights here."};function be({requests:t}){const s=Mt(),n=Y(),a=n.palette.background.paper,i=F("#ffffff",.08),l=n.palette.primary.main,[u,c]=y.useState("all"),[v,C]=y.useState(null),[g,j]=y.useState(null),[S,f]=y.useState(null),{openBucketRequests:L}=ut(),R=v!=null,m=u!=="all"||R,B=y.useMemo(()=>Ce(t,u),[t,u]),k=y.useMemo(()=>ve(B,v),[B,v]),w=y.useMemo(()=>je(k),[k]),$=y.useMemo(()=>mt(B),[B]),I=y.useMemo(()=>$.reduce((h,p)=>Math.max(h,p.count),0),[$]),D=I>0?[0,I]:[0,"auto"],M=y.useMemo(()=>{if(g!=null&&S!=null){const h=Math.min(g,S),p=Math.max(g,S);return h===p?null:{from:h,to:p}}return v},[g,S,v]),e=h=>{if(!h)return;const p=Rt(h,{tab:"metrics"});s(p)},r=(h,p)=>{p&&(c(p),C(null),j(null),f(null))},d=()=>{C(null),j(null),f(null)},x=h=>{if((h==null?void 0:h.activeLabel)==null)return;const p=Number(h.activeLabel);Number.isFinite(p)&&(j(p),f(p))},T=h=>{if(g==null)return;const p=Number(h==null?void 0:h.activeLabel);Number.isFinite(p)&&f(p)},G=()=>{if(g==null||S==null){j(null),f(null);return}const h=Math.min(g,S),p=Math.max(g,S);j(null),f(null),!(!Number.isFinite(h)||!Number.isFinite(p)||h===p)&&C({from:h,to:p})},xt=h=>{const p=$[h.activeIndex];!p||!p.requests.length||L(p)},yt=o.jsxs(E,{direction:"row",spacing:1,alignItems:"center",children:[o.jsxs(ge,{size:"small",exclusive:!0,value:u,onChange:r,children:[o.jsx(N,{value:"15m",children:"Last 15m"}),o.jsx(N,{value:"1h",children:"Last 1h"}),o.jsx(N,{value:"24h",children:"Last 24h"}),o.jsx(N,{value:"all",children:"All"})]}),R&&o.jsx(Z,{size:"small",onClick:d,children:"Reset range"})]});return o.jsx(o.Fragment,{children:o.jsxs(E,{spacing:3,children:[o.jsx(Tt,{stats:[{label:"Total requests",value:w.totalRequests,detail:m?"Filtered":"Overall"},{label:"Error rate",value:`${w.errorRate}%`,detail:"Statuses 4xx/5xx"},{label:"Avg duration",value:`${w.avgDuration} ms`},{label:"P95 duration",value:`${w.p95Duration} ms`}]}),o.jsx(J,{charts:[{title:"Requests over time",chart:o.jsx(W,{data:$,emptyFallback:H,children:h=>o.jsxs(Ht,{data:h,margin:{left:0,right:16,top:8,bottom:8},onMouseDown:x,onMouseMove:T,onMouseUp:G,onClick:p=>xt(p),children:[o.jsx(_,{stroke:"rgba(255,255,255,0.1)"}),o.jsx(V,{dataKey:"timestamp",type:"number",tickFormatter:p=>Te(p),tick:{fill:"rgba(255,255,255,0.6)",fontSize:12},tickLine:!1,axisLine:!1,domain:["dataMin","dataMax"]}),o.jsx(Q,{tick:{fill:"rgba(255,255,255,0.6)",fontSize:12},allowDecimals:!1,tickLine:!1,axisLine:!1,domain:D}),o.jsx(O,{wrapperStyle:{pointerEvents:"none"},content:Re,contentStyle:{backgroundColor:a,borderColor:i}}),M&&o.jsx(_t,{x1:M.from,x2:M.to,strokeOpacity:0,fill:F(l,.18)}),o.jsx(Vt,{dataKey:"count",type:"monotone",stroke:l,fill:l,fillOpacity:.25})]})}),actions:yt}]}),o.jsx(J,{charts:[{title:"Requests by method",chart:o.jsx(W,{data:w.byMethod,emptyFallback:H,children:h=>o.jsxs(pt,{data:h,children:[o.jsx(_,{stroke:"rgba(255,255,255,0.1)"}),o.jsx(V,{dataKey:"method",tick:{fill:"rgba(255,255,255,0.6)"}}),o.jsx(Q,{allowDecimals:!1,tick:{fill:"rgba(255,255,255,0.6)"}}),o.jsx(O,{contentStyle:{backgroundColor:a,borderColor:i},formatter:(p,U)=>[`${p} requests`,String(U).toUpperCase()]}),o.jsx(gt,{dataKey:"count",fill:n.palette.primary.light,radius:[3,3,0,0]})]})})},{title:"Requests by status",chart:o.jsx(W,{data:w.byStatus,emptyFallback:H,children:h=>o.jsxs(Qt,{children:[o.jsx(Yt,{data:h,dataKey:"count",nameKey:"label",outerRadius:90,fill:F(n.palette.secondary.light,.85),label:!0}),o.jsx(O,{contentStyle:{backgroundColor:a,borderColor:i},formatter:(p,U)=>[`${p} requests`,String(U)]}),o.jsx(Zt,{})]})})}]}),o.jsx(me,{requests:k,onSelectEndpoint:e})]})})}function P(t){const n=new Date(t.createdAt).getTime();return Number.isFinite(n)?n:0}function Ce(t,s){if(!t.length)return[];if(s==="all")return t;const n=t.reduce((l,u)=>{const c=P(u);return c>l?c:l},0);if(!n)return t;let a=0;if(s==="15m"?a=15*6e4:s==="1h"?a=60*6e4:s==="24h"&&(a=1440*6e4),!a)return t;const i=n-a;return t.filter(l=>P(l)>=i)}function ve(t,s){if(!s)return t;const n=Math.min(s.from,s.to),a=Math.max(s.from,s.to);return t.filter(i=>{const l=P(i);return l>=n&&l<=a})}function je(t){const s=t.length,n=t.filter(g=>g.status>=400).length,a=s===0?0:Math.round(n/s*100),i=t.map(g=>g.durationMs||0),l=i.length===0?0:Math.round(i.reduce((g,j)=>g+j,0)/i.length),u=Me(i,.95),c=mt(t),v=Be(t),C=Se(t);return{totalRequests:s,errorRate:a,avgDuration:l,p95Duration:u,byTime:c,byMethod:v,byStatus:C}}function mt(t){const s=new Map;return t.forEach(n=>{const a=P(n),i=new Date(a);i.setSeconds(0,0);const l=i.getTime(),u=s.get(l)??{count:0,requests:[]};u.count+=1,u.requests.push({id:n.id,method:n.method,path:n.path,status:n.status,durationMs:n.durationMs??0,createdAt:a,requestSize:n.requestSize,responseSize:n.responseSize}),s.set(l,u)}),Array.from(s.entries()).sort(([n],[a])=>n-a).map(([n,a])=>({timestamp:n,count:a.count,label:new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),requests:a.requests.sort((i,l)=>i.createdAt-l.createdAt)}))}function Be(t){const s=new Map;return t.forEach(n=>{s.set(n.method,(s.get(n.method)??0)+1)}),Array.from(s.entries()).map(([n,a])=>({method:n,count:a}))}function Se(t){const s={"2xx":0,"3xx":0,"4xx":0,"5xx":0};return t.forEach(n=>{n.status>=500?s["5xx"]+=1:n.status>=400?s["4xx"]+=1:n.status>=300?s["3xx"]+=1:s["2xx"]+=1}),Object.entries(s).filter(([,n])=>n>0).map(([n,a])=>({label:n,count:a}))}function Me(t,s){if(!t.length)return 0;const n=[...t].sort((i,l)=>i-l),a=Math.floor(s*(n.length-1));return n[a]}function Te(t){const s=typeof t=="number"?t:Number(t);if(!Number.isFinite(s))return"";try{return new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function Re(t){var i;const{active:s,payload:n}=t;if(!s||!n||!n.length)return null;const a=(i=n[0])==null?void 0:i.payload;return a?o.jsx(X,{sx:{p:1.5,minWidth:160},children:o.jsxs(E,{spacing:.5,children:[o.jsx(z,{variant:"body2",fontWeight:600,children:a.label}),o.jsxs(z,{variant:"body2",color:"text.secondary",children:[a.count," requests"]})]})}):null}const ke={...ne,searchQuery:"",methodsInclude:[],methodsExclude:[],statusesInclude:[],statusesExclude:[],endpointKeysInclude:[],endpointKeysExclude:[]};function Ge(){const{openRequestDetail:t}=ut(),{openPanel:s}=kt(),[n,a]=y.useState([]),[i,l]=Gt("historyFilters",ke),u=y.useMemo(()=>({cursorQueryKey:"cursor",getNextPageCursor(e){return e.meta.nextCursor}}),[]),c=wt("GET /__rrroutes/requests",u),{data:v,refetch:C,isFetching:g}=c.useEndpoint({query:i}),j=$t(v,{reverse:!0}),S=q(j,e=>e.status,Pt),f=q(j,e=>({...ct(e.method,e.path),path:e.path,method:e.method}),Kt,e=>e.encodedId),L=Lt(j,e=>e.tags),R=Et(j,e=>{var r,d;return{timestamp:new Date(e.createdAt).toISOString(),method:((d=(r=e.method)==null?void 0:r.toUpperCase)==null?void 0:d.call(r))??e.method,path:e.path,status:e.status,durationMs:e.durationMs,tags:Array.isArray(e.tags)?e.tags.join(", "):"",groupId:e.groupId??"",endpointId:e.id,fullUrl:e.fullUrl??""}}),m=(e,r)=>{l(d=>{const x=new Set(d.methodsInclude),T=new Set(d.methodsExclude);return r==="include"?(x.has(e)?x.delete(e):x.add(e),T.delete(e)):(T.has(e)?T.delete(e):T.add(e),x.delete(e)),{...d,methodsInclude:Array.from(x),methodsExclude:Array.from(T)}})},B=(e,r)=>{l(d=>{const x=new Set(d.statusesInclude),T=new Set(d.statusesExclude);return r==="include"?(x.has(e)?x.delete(e):x.add(e),T.delete(e)):(T.has(e)?T.delete(e):T.add(e),x.delete(e)),{...d,statusesInclude:Array.from(x),statusesExclude:Array.from(T)}})},k=e=>{var r,d;return(r=i.methodsInclude)!=null&&r.includes(e)?"include":(d=i.methodsExclude)!=null&&d.includes(e)?"exclude":"none"},w=e=>{var r,d;return(r=i.statusesInclude)!=null&&r.includes(e)?"include":(d=i.statusesExclude)!=null&&d.includes(e)?"exclude":"none"},$=y.useMemo(()=>{var e;return(e=i.endpointKeysInclude)==null?void 0:e.map(r=>{var d;return((d=f.find(x=>x.encodedId==r))==null?void 0:d.displayId)??r})},[f,i.endpointKeysInclude]),I=y.useMemo(()=>{var e;return(e=i.endpointKeysExclude)==null?void 0:e.map(r=>{var d;return((d=f.find(x=>x.encodedId==r))==null?void 0:d.displayId)??r})},[f,i.endpointKeysExclude]);y.useCallback(e=>{a(r=>r.includes(e)?r.filter(d=>d!==e):r.length>=2?[r[1],e]:[...r,e])},[]);const D=y.useCallback(()=>{s("diff")},[s]),M=(e,r)=>{const d=e.map(x=>{var T;return((T=f.find(G=>G.encodedId==x))==null?void 0:T.encodedId)??x}).filter(x=>x.trim().length>0);l(x=>({...x,endpointKeysInclude:r==="include"?d:x.endpointKeysInclude,endpointKeysExclude:r==="exclude"?d:x.endpointKeysExclude}))};return o.jsx(ee,{title:"History",subtitle:"Review your recently executed requests.",children:o.jsxs(E,{spacing:3,children:[o.jsx(Xt,{value:i,onChange:e=>l(r=>({...r,...e})),tagOptions:L,onRefresh:()=>C(),refreshing:g,children:e=>o.jsxs(E,{spacing:2,children:[o.jsxs(E,{spacing:1,children:[o.jsx(z,{variant:"overline",color:"text.secondary",children:"Methods"}),o.jsx(E,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:It.map(r=>o.jsx(Dt,{method:r,state:k(r),onClick:()=>m(r,e)},r))})]}),o.jsxs(E,{spacing:1,children:[o.jsx(z,{variant:"overline",color:"text.secondary",children:"Statuses"}),o.jsx(E,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:S.map(r=>o.jsx(At,{status:r,state:w(r),onClick:()=>B(r,e)},r))})]}),o.jsxs(E,{spacing:1,children:[o.jsx(z,{variant:"overline",color:"text.secondary",children:"Endpoint"}),o.jsx(re,{multiple:!0,freeSolo:!0,options:f.map(r=>r.displayId),value:e==="include"?$:I,onChange:(r,d)=>{M(d,e)},ListboxProps:{sx:{maxHeight:240,overflowY:"auto"}},renderInput:r=>o.jsx(oe,{...r,onChange:d=>{l(x=>({...x,searchQuery:d.target.value}))},label:`Endpoint (${e})`,placeholder:"GET /api/example",size:"small"})})]})]})}),o.jsx(qt,{children:o.jsxs(te,{sizes:[8,4],children:[o.jsx(tt,{title:"Table",actions:o.jsxs(E,{direction:"row",spacing:1,alignItems:"center",children:[o.jsx(Nt,{title:"Refresh",children:o.jsx(Ot,{size:"small",onClick:()=>C(),disabled:g,children:o.jsx(Ut,{fontSize:"small",sx:g?{animation:"spin 1s linear infinite","@keyframes spin":{"100%":{transform:"rotate(360deg)"}}}:void 0})})}),o.jsx(Z,{variant:"outlined",size:"small",startIcon:o.jsx(fe,{}),onClick:D,children:"Compare"}),o.jsx(se,{filename:"history.csv",rows:R,title:"Exports the currently filtered history results."})]}),children:o.jsx(Ft,{items:j,columns:zt,query:i,setQuery:l,onRowClick:e=>t({requestId:e.id,allowReplay:!0})})}),o.jsx(tt,{title:"Insights",children:o.jsx(be,{requests:j})})]})})]})})}export{Ge as default};
@@ -0,0 +1 @@
1
+ import{j as s}from"./vendor-xyflow.js";import{P as F}from"./PageContainer.js";import{h as S}from"./vendor-recharts.js";import{x as A,b as I,e as b,as as C,aE as P,d as R,S as u,T,aF as w,C as _,v as D,aG as M,aH as k,aD as B}from"./docs.js";import{u as G}from"./useQueryState.js";import{D as Q}from"./filterTypes.js";import{B as z}from"./BaseFilterBar.js";import{E as N}from"./ExportButton.js";import"./Autocomplete.js";import"./Download.js";const O={...Q,searchQuery:"",levelsInclude:[],levelsExclude:[]};function q(){const[t,a]=G("logsAppFilters",O),{openLogGroupDetail:m}=A(),p=I("GET /__rrroutes/logs",{cursorQueryKey:"cursor",getNextPageCursor(e){return e.meta.nextCursor},splitPageSize:500,splitPageSizeParam:"pageSize"}).useEndpoint({query:t}),{data:g,isLoading:f,error:x,refetch:d,isFetching:y}=p,l=b(g,{reverse:!1}),L=C(l,e=>({value:e.level,color:B(e.level)}),k,e=>e.value),h=S.useMemo(()=>l.map(e=>({timestamp:P(e.createdAt),level:e.level,name:e.name??"",message:H(e),meta:c(e.meta),tags:Array.isArray(e.tags)?e.tags.join(", "):"",groupId:e.groupId??""})),[l]),E=(e,r)=>{a(o=>{const n=new Set(o.levelsInclude),i=new Set(o.levelsExclude);return r==="include"?(n.has(e)?n.delete(e):n.add(e),i.delete(e)):(i.has(e)?i.delete(e):i.add(e),n.delete(e)),{...o,levelsInclude:Array.from(n),levelsExclude:Array.from(i)}})},v=e=>{var r,o;return(r=t.levelsInclude)!=null&&r.includes(e)?"include":(o=t.levelsExclude)!=null&&o.includes(e)?"exclude":"none"},j=R(x,{messageFallback:"Failed to load application logs.",refetch:d});return s.jsx(s.Fragment,{children:s.jsxs(u,{spacing:3,sx:{mt:2},children:[s.jsx(z,{value:t,onChange:e=>a(r=>({...r,...e})),onRefresh:()=>d(),refreshing:y,children:e=>s.jsxs(u,{spacing:1,children:[s.jsx(T,{variant:"overline",color:"text.secondary",children:"Levels"}),s.jsx(u,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:L.map(r=>s.jsx(w,{color:r.color,level:r.value,state:v(r.value),onClick:()=>E(r.value,e)},r.value))})]})}),s.jsx(_,{title:"Application logs",actions:s.jsx(N,{filename:"application-logs.csv",rows:h,title:"Exports the currently filtered logs."}),children:s.jsx(D,{items:l,endpoint:p,columns:M,query:t,setQuery:a,onRowClick:e=>m({groupId:e.groupId,baseQuery:t,triggerLog:e}),stateHandler:{loading:{variant:"table"},emptyFallback:{title:"No logs",description:"Adjust filters to see additional log entries."},error:j,isLoading:f}})})]})})}function H(t){if(t.description)return t.description;if(typeof t.meta=="string")return t.meta;if(t.meta&&typeof t.meta=="object"){const a=t.meta;if(typeof a.message=="string")return a.message;if(a.message)return c(a.message)}return c(t.meta)}function c(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function se(){return s.jsx(F,{title:"Logs",subtitle:"Monitor system logs and debugging output.",children:s.jsx(q,{})})}export{se as default};
@@ -0,0 +1,3 @@
1
+ import{h as i,m as se}from"./vendor-recharts.js";import{bf as qe,bg as pt,bb as Tt,bh as Qe,bi as zt,J as Y,I as ee,U as ie,bj as ft,M as X,N as Z,O as F,W as J,bk as Bt,bl as Ft,R as Nt,bm as Ze,Q as pe,X as De,bn as Je,L as Se,K as mt,bo as At,ba as Pt,al as Et,bp as Wt,bq as jt,G as je,S as bt,T as ht}from"./docs.js";import{j as u}from"./vendor-xyflow.js";function He(e){return parseInt(e,10)||0}const Ht={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}};function Ut(e){for(const t in e)return!1;return!0}function vt(e){return Ut(e)||e.outerHeightStyle===0&&!e.overflowing}const qt=i.forwardRef(function(t,o){const{onChange:n,maxRows:s,minRows:l=1,style:r,value:d,...b}=t,{current:g}=i.useRef(d!=null),m=i.useRef(null),h=qe(o,m),v=i.useRef(null),S=i.useRef(null),y=i.useCallback(()=>{const f=m.current,p=S.current;if(!f||!p)return;const I=pt(f).getComputedStyle(f);if(I.width==="0px")return{outerHeightStyle:0,overflowing:!1};p.style.width=I.width,p.value=f.value||t.placeholder||"x",p.value.slice(-1)===`
2
+ `&&(p.value+=" ");const U=I.boxSizing,q=He(I.paddingBottom)+He(I.paddingTop),D=He(I.borderBottomWidth)+He(I.borderTopWidth),B=p.scrollHeight;p.value="x";const j=p.scrollHeight;let L=B;l&&(L=Math.max(Number(l)*j,L)),s&&(L=Math.min(Number(s)*j,L)),L=Math.max(L,j);const T=L+(U==="border-box"?q+D:0),V=Math.abs(L-B)<=1;return{outerHeightStyle:T,overflowing:V}},[s,l,t.placeholder]),C=Tt(()=>{const f=m.current,p=y();if(!f||!p||vt(p))return!1;const R=p.outerHeightStyle;return v.current!=null&&v.current!==R}),c=i.useCallback(()=>{const f=m.current,p=y();if(!f||!p||vt(p))return;const R=p.outerHeightStyle;v.current!==R&&(v.current=R,f.style.height=`${R}px`),f.style.overflow=p.overflowing?"hidden":""},[y]),x=i.useRef(-1);Qe(()=>{const f=zt(c),p=m==null?void 0:m.current;if(!p)return;const R=pt(p);R.addEventListener("resize",f);let I;return typeof ResizeObserver<"u"&&(I=new ResizeObserver(()=>{C()&&(I.unobserve(p),cancelAnimationFrame(x.current),c(),x.current=requestAnimationFrame(()=>{I.observe(p)}))}),I.observe(p)),()=>{f.clear(),cancelAnimationFrame(x.current),R.removeEventListener("resize",f),I&&I.disconnect()}},[y,c,C]),Qe(()=>{c()});const P=f=>{g||c();const p=f.target,R=p.value.length,I=p.value.endsWith(`
3
+ `),U=p.selectionStart===R;I&&U&&p.setSelectionRange(R,R),n&&n(f)};return u.jsxs(i.Fragment,{children:[u.jsx("textarea",{value:d,onChange:P,ref:h,rows:l,style:r,...b}),u.jsx("textarea",{"aria-hidden":!0,className:t.className,readOnly:!0,ref:S,tabIndex:-1,style:{...Ht.shadow,...r,paddingTop:0,paddingBottom:0}})]})});function Me({props:e,states:t,muiFormControl:o}){return t.reduce((n,s)=>(n[s]=e[s],o&&typeof e[s]>"u"&&(n[s]=o[s]),n),{})}const Ye=i.createContext(void 0);function Le(){return i.useContext(Ye)}function gt(e){return e!=null&&!(Array.isArray(e)&&e.length===0)}function Ue(e,t=!1){return e&&(gt(e.value)&&e.value!==""||t&&gt(e.defaultValue)&&e.defaultValue!=="")}function Dt(e){return e.startAdornment}function Vt(e){return ee("MuiInputBase",e)}const Oe=Y("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]);var xt;const Ve=(e,t)=>{const{ownerState:o}=e;return[t.root,o.formControl&&t.formControl,o.startAdornment&&t.adornedStart,o.endAdornment&&t.adornedEnd,o.error&&t.error,o.size==="small"&&t.sizeSmall,o.multiline&&t.multiline,o.color&&t[`color${X(o.color)}`],o.fullWidth&&t.fullWidth,o.hiddenLabel&&t.hiddenLabel]},Ke=(e,t)=>{const{ownerState:o}=e;return[t.input,o.size==="small"&&t.inputSizeSmall,o.multiline&&t.inputMultiline,o.type==="search"&&t.inputTypeSearch,o.startAdornment&&t.inputAdornedStart,o.endAdornment&&t.inputAdornedEnd,o.hiddenLabel&&t.inputHiddenLabel]},Kt=e=>{const{classes:t,color:o,disabled:n,error:s,endAdornment:l,focused:r,formControl:d,fullWidth:b,hiddenLabel:g,multiline:m,readOnly:h,size:v,startAdornment:S,type:y}=e,C={root:["root",`color${X(o)}`,n&&"disabled",s&&"error",b&&"fullWidth",r&&"focused",d&&"formControl",v&&v!=="medium"&&`size${X(v)}`,m&&"multiline",S&&"adornedStart",l&&"adornedEnd",g&&"hiddenLabel",h&&"readOnly"],input:["input",n&&"disabled",y==="search"&&"inputTypeSearch",m&&"inputMultiline",v==="small"&&"inputSizeSmall",g&&"inputHiddenLabel",S&&"inputAdornedStart",l&&"inputAdornedEnd",h&&"readOnly"]};return Z(C,Vt,t)},Xe=F("div",{name:"MuiInputBase",slot:"Root",overridesResolver:Ve})(J(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",[`&.${Oe.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:"default"},variants:[{props:({ownerState:t})=>t.multiline,style:{padding:"4px 0 5px"}},{props:({ownerState:t,size:o})=>t.multiline&&o==="small",style:{paddingTop:1}},{props:({ownerState:t})=>t.fullWidth,style:{width:"100%"}}]}))),Ge=F("input",{name:"MuiInputBase",slot:"Input",overridesResolver:Ke})(J(({theme:e})=>{const t=e.palette.mode==="light",o={color:"currentColor",...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create("opacity",{duration:e.transitions.duration.shorter})},n={opacity:"0 !important"},s=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%","&::-webkit-input-placeholder":o,"&::-moz-placeholder":o,"&::-ms-input-placeholder":o,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},[`label[data-shrink=false] + .${Oe.formControl} &`]:{"&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus::-webkit-input-placeholder":s,"&:focus::-moz-placeholder":s,"&:focus::-ms-input-placeholder":s},[`&.${Oe.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:l})=>!l.disableInjectingGlobalStyles,style:{animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&:-webkit-autofill":{animationDuration:"5000s",animationName:"mui-auto-fill"}}},{props:{size:"small"},style:{paddingTop:1}},{props:({ownerState:l})=>l.multiline,style:{height:"auto",resize:"none",padding:0,paddingTop:0}},{props:{type:"search"},style:{MozAppearance:"textfield"}}]}})),yt=Bt({"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}),et=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiInputBase"}),{"aria-describedby":s,autoComplete:l,autoFocus:r,className:d,color:b,components:g={},componentsProps:m={},defaultValue:h,disabled:v,disableInjectingGlobalStyles:S,endAdornment:y,error:C,fullWidth:c=!1,id:x,inputComponent:P="input",inputProps:f={},inputRef:p,margin:R,maxRows:I,minRows:U,multiline:q=!1,name:D,onBlur:B,onChange:j,onClick:L,onFocus:T,onKeyDown:V,onKeyUp:N,placeholder:A,readOnly:G,renderSuffix:te,rows:oe,size:Ce,slotProps:O={},slots:fe={},startAdornment:H,type:Ie="text",value:Q,..._}=n,K=f.value!=null?f.value:Q,{current:me}=i.useRef(K!=null),E=i.useRef(),le=i.useCallback(M=>{},[]),ae=qe(E,p,f.ref,le),[be,he]=i.useState(!1),w=Le(),$=Me({props:n,muiFormControl:w,states:["color","disabled","error","hiddenLabel","size","required","filled"]});$.focused=w?w.focused:be,i.useEffect(()=>{!w&&v&&be&&(he(!1),B&&B())},[w,v,be,B]);const ne=w&&w.onFilled,ve=w&&w.onEmpty,de=i.useCallback(M=>{Ue(M)?ne&&ne():ve&&ve()},[ne,ve]);Qe(()=>{me&&de({value:K})},[K,de,me]);const we=M=>{T&&T(M),f.onFocus&&f.onFocus(M),w&&w.onFocus?w.onFocus(M):he(!0)},$e=M=>{B&&B(M),f.onBlur&&f.onBlur(M),w&&w.onBlur?w.onBlur(M):he(!1)},Te=(M,...ue)=>{if(!me){const Pe=M.target||E.current;if(Pe==null)throw new Error(Ft(1));de({value:Pe.value})}f.onChange&&f.onChange(M,...ue),j&&j(M,...ue)};i.useEffect(()=>{de(E.current)},[]);const ze=M=>{E.current&&M.currentTarget===M.target&&E.current.focus(),L&&L(M)};let ge=P,z=f;q&&ge==="input"&&(oe?z={type:void 0,minRows:oe,maxRows:oe,...z}:z={type:void 0,maxRows:I,minRows:U,...z},ge=qt);const Ee=M=>{de(M.animationName==="mui-auto-fill-cancel"?E.current:{value:"x"})};i.useEffect(()=>{w&&w.setAdornedStart(!!H)},[w,H]);const ce={...n,color:$.color||"primary",disabled:$.disabled,endAdornment:y,error:$.error,focused:$.focused,formControl:w,fullWidth:c,hiddenLabel:$.hiddenLabel,multiline:q,size:$.size,startAdornment:H,type:Ie},xe=Kt(ce),We=fe.root||g.Root||Xe,Re=O.root||m.root||{},Fe=fe.input||g.Input||Ge;return z={...z,...O.input??m.input},u.jsxs(i.Fragment,{children:[!S&&typeof yt=="function"&&(xt||(xt=u.jsx(yt,{}))),u.jsxs(We,{...Re,ref:o,onClick:ze,..._,...!ft(We)&&{ownerState:{...ce,...Re.ownerState}},className:se(xe.root,Re.className,d,G&&"MuiInputBase-readOnly"),children:[H,u.jsx(Ye.Provider,{value:null,children:u.jsx(Fe,{"aria-invalid":$.error,"aria-describedby":s,autoComplete:l,autoFocus:r,defaultValue:h,disabled:$.disabled,id:x,onAnimationStart:Ee,name:D,placeholder:A,readOnly:G,required:$.required,rows:oe,value:K,onKeyDown:V,onKeyUp:N,type:Ie,...z,...!ft(Fe)&&{as:ge,ownerState:{...ce,...z.ownerState}},ref:ae,className:se(xe.input,z.className,G&&"MuiInputBase-readOnly"),onBlur:$e,onChange:Te,onFocus:we})}),y,te?te({...$,startAdornment:H}):null]})]})});function Xt(e){return ee("MuiInput",e)}const Be={...Oe,...Y("MuiInput",["root","underline","input"])};function Gt(e){return ee("MuiOutlinedInput",e)}const re={...Oe,...Y("MuiOutlinedInput",["root","notchedOutline","input"])};function _t(e){return ee("MuiFilledInput",e)}const ye={...Oe,...Y("MuiFilledInput",["root","underline","input","adornedStart","adornedEnd","sizeSmall","multiline","hiddenLabel"])},Jt=Nt(u.jsx("path",{d:"M7 10l5 5 5-5z"})),Qt=e=>{const{classes:t,disableUnderline:o,startAdornment:n,endAdornment:s,size:l,hiddenLabel:r,multiline:d}=e,b={root:["root",!o&&"underline",n&&"adornedStart",s&&"adornedEnd",l==="small"&&`size${X(l)}`,r&&"hiddenLabel",d&&"multiline"],input:["input"]},g=Z(b,_t,t);return{...t,...g}},Zt=F(Xe,{shouldForwardProp:e=>pe(e)||e==="classes",name:"MuiFilledInput",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[...Ve(e,t),!o.disableUnderline&&t.underline]}})(J(({theme:e})=>{const t=e.palette.mode==="light",o=t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",n=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",s=t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",l=t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{position:"relative",backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:s,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n}},[`&.${ye.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:n},[`&.${ye.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:l},variants:[{props:({ownerState:r})=>!r.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${ye.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${ye.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):o}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${ye.disabled}, .${ye.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${ye.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(e.palette).filter(De()).map(([r])=>{var d;return{props:{disableUnderline:!1,color:r},style:{"&::after":{borderBottom:`2px solid ${(d=(e.vars||e).palette[r])==null?void 0:d.main}`}}}}),{props:({ownerState:r})=>r.startAdornment,style:{paddingLeft:12}},{props:({ownerState:r})=>r.endAdornment,style:{paddingRight:12}},{props:({ownerState:r})=>r.multiline,style:{padding:"25px 12px 8px"}},{props:({ownerState:r,size:d})=>r.multiline&&d==="small",style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:r})=>r.multiline&&r.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:r})=>r.multiline&&r.hiddenLabel&&r.size==="small",style:{paddingTop:8,paddingBottom:9}}]}})),Yt=F(Ge,{name:"MuiFilledInput",slot:"Input",overridesResolver:Ke})(J(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode==="light"?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:e.palette.mode==="light"?null:"#fff",caretColor:e.palette.mode==="light"?null:"#fff",borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"}},...e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"},[e.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:t})=>t.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:t})=>t.startAdornment,style:{paddingLeft:0}},{props:({ownerState:t})=>t.endAdornment,style:{paddingRight:0}},{props:({ownerState:t})=>t.hiddenLabel&&t.size==="small",style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:t})=>t.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),tt=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiFilledInput"}),{disableUnderline:s=!1,components:l={},componentsProps:r,fullWidth:d=!1,hiddenLabel:b,inputComponent:g="input",multiline:m=!1,slotProps:h,slots:v={},type:S="text",...y}=n,C={...n,disableUnderline:s,fullWidth:d,inputComponent:g,multiline:m,type:S},c=Qt(n),x={root:{ownerState:C},input:{ownerState:C}},P=h??r?Ze(x,h??r):x,f=v.root??l.Root??Zt,p=v.input??l.Input??Yt;return u.jsx(et,{slots:{root:f,input:p},slotProps:P,fullWidth:d,inputComponent:g,multiline:m,ref:o,type:S,...y,classes:c})});tt.muiName="Input";function eo(e){return ee("MuiFormControl",e)}Y("MuiFormControl",["root","marginNone","marginNormal","marginDense","fullWidth","disabled"]);const to=e=>{const{classes:t,margin:o,fullWidth:n}=e,s={root:["root",o!=="none"&&`margin${X(o)}`,n&&"fullWidth"]};return Z(s,eo,t)},oo=F("div",{name:"MuiFormControl",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,t[`margin${X(o.margin)}`],o.fullWidth&&t.fullWidth]}})({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top",variants:[{props:{margin:"normal"},style:{marginTop:16,marginBottom:8}},{props:{margin:"dense"},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:"100%"}}]}),no=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiFormControl"}),{children:s,className:l,color:r="primary",component:d="div",disabled:b=!1,error:g=!1,focused:m,fullWidth:h=!1,hiddenLabel:v=!1,margin:S="none",required:y=!1,size:C="medium",variant:c="outlined",...x}=n,P={...n,color:r,component:d,disabled:b,error:g,fullWidth:h,hiddenLabel:v,margin:S,required:y,size:C,variant:c},f=to(P),[p,R]=i.useState(()=>{let N=!1;return s&&i.Children.forEach(s,A=>{if(!Je(A,["Input","Select"]))return;const G=Je(A,["Select"])?A.props.input:A;G&&Dt(G.props)&&(N=!0)}),N}),[I,U]=i.useState(()=>{let N=!1;return s&&i.Children.forEach(s,A=>{Je(A,["Input","Select"])&&(Ue(A.props,!0)||Ue(A.props.inputProps,!0))&&(N=!0)}),N}),[q,D]=i.useState(!1);b&&q&&D(!1);const B=m!==void 0&&!b?m:q;let j;i.useRef(!1);const L=i.useCallback(()=>{U(!0)},[]),T=i.useCallback(()=>{U(!1)},[]),V=i.useMemo(()=>({adornedStart:p,setAdornedStart:R,color:r,disabled:b,error:g,filled:I,focused:B,fullWidth:h,hiddenLabel:v,size:C,onBlur:()=>{D(!1)},onFocus:()=>{D(!0)},onEmpty:T,onFilled:L,registerEffect:j,required:y,variant:c}),[p,r,b,g,I,B,h,v,j,T,L,y,C,c]);return u.jsx(Ye.Provider,{value:V,children:u.jsx(oo,{as:d,ownerState:P,className:se(f.root,l),ref:o,...x,children:s})})});function ro(e){return ee("MuiFormHelperText",e)}const St=Y("MuiFormHelperText",["root","error","disabled","sizeSmall","sizeMedium","contained","focused","filled","required"]);var Ct;const so=e=>{const{classes:t,contained:o,size:n,disabled:s,error:l,filled:r,focused:d,required:b}=e,g={root:["root",s&&"disabled",l&&"error",n&&`size${X(n)}`,o&&"contained",d&&"focused",r&&"filled",b&&"required"]};return Z(g,ro,t)},io=F("p",{name:"MuiFormHelperText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,o.size&&t[`size${X(o.size)}`],o.contained&&t.contained,o.filled&&t.filled]}})(J(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:"left",marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${St.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${St.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:"small"},style:{marginTop:4}},{props:({ownerState:t})=>t.contained,style:{marginLeft:14,marginRight:14}}]}))),lo=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiFormHelperText"}),{children:s,className:l,component:r="p",disabled:d,error:b,filled:g,focused:m,margin:h,required:v,variant:S,...y}=n,C=Le(),c=Me({props:n,muiFormControl:C,states:["variant","size","disabled","error","filled","focused","required"]}),x={...n,component:r,contained:c.variant==="filled"||c.variant==="outlined",variant:c.variant,size:c.size,disabled:c.disabled,error:c.error,filled:c.filled,focused:c.focused,required:c.required};delete x.ownerState;const P=so(x);return u.jsx(io,{as:r,className:se(P.root,l),ref:o,...y,ownerState:x,children:s===" "?Ct||(Ct=u.jsx("span",{className:"notranslate","aria-hidden":!0,children:"​"})):s})});function ao(e){return ee("MuiFormLabel",e)}const Ae=Y("MuiFormLabel",["root","colorSecondary","focused","disabled","error","filled","required","asterisk"]),uo=e=>{const{classes:t,color:o,focused:n,disabled:s,error:l,filled:r,required:d}=e,b={root:["root",`color${X(o)}`,s&&"disabled",l&&"error",r&&"filled",n&&"focused",d&&"required"],asterisk:["asterisk",l&&"error"]};return Z(b,ao,t)},co=F("label",{name:"MuiFormLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,o.color==="secondary"&&t.colorSecondary,o.filled&&t.filled]}})(J(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.body1,lineHeight:"1.4375em",padding:0,position:"relative",variants:[...Object.entries(e.palette).filter(De()).map(([t])=>({props:{color:t},style:{[`&.${Ae.focused}`]:{color:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${Ae.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${Ae.error}`]:{color:(e.vars||e).palette.error.main}}}]}))),po=F("span",{name:"MuiFormLabel",slot:"Asterisk"})(J(({theme:e})=>({[`&.${Ae.error}`]:{color:(e.vars||e).palette.error.main}}))),fo=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiFormLabel"}),{children:s,className:l,color:r,component:d="label",disabled:b,error:g,filled:m,focused:h,required:v,...S}=n,y=Le(),C=Me({props:n,muiFormControl:y,states:["color","required","focused","disabled","error","filled"]}),c={...n,color:C.color||"primary",component:d,disabled:C.disabled,error:C.error,filled:C.filled,focused:C.focused,required:C.required},x=uo(c);return u.jsxs(co,{as:d,ownerState:c,className:se(x.root,l),ref:o,...S,children:[s,C.required&&u.jsxs(po,{ownerState:c,"aria-hidden":!0,className:x.asterisk,children:[" ","*"]})]})}),mo=e=>{const{classes:t,disableUnderline:o}=e,s=Z({root:["root",!o&&"underline"],input:["input"]},Xt,t);return{...t,...s}},bo=F(Xe,{shouldForwardProp:e=>pe(e)||e==="classes",name:"MuiInput",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[...Ve(e,t),!o.disableUnderline&&t.underline]}})(J(({theme:e})=>{let o=e.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(o=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:"relative",variants:[{props:({ownerState:n})=>n.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:n})=>!n.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Be.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Be.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${o}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Be.disabled}, .${Be.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${o}`}},[`&.${Be.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(e.palette).filter(De()).map(([n])=>({props:{color:n,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[n].main}`}}}))]}})),ho=F(Ge,{name:"MuiInput",slot:"Input",overridesResolver:Ke})({}),ot=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiInput"}),{disableUnderline:s=!1,components:l={},componentsProps:r,fullWidth:d=!1,inputComponent:b="input",multiline:g=!1,slotProps:m,slots:h={},type:v="text",...S}=n,y=mo(n),c={root:{ownerState:{disableUnderline:s}}},x=m??r?Ze(m??r,c):c,P=h.root??l.Root??bo,f=h.input??l.Input??ho;return u.jsx(et,{slots:{root:P,input:f},slotProps:x,fullWidth:d,inputComponent:b,multiline:g,ref:o,type:v,...S,classes:y})});ot.muiName="Input";function vo(e){return ee("MuiInputLabel",e)}Y("MuiInputLabel",["root","focused","disabled","error","required","asterisk","formControl","sizeSmall","shrink","animated","standard","filled","outlined"]);const go=e=>{const{classes:t,formControl:o,size:n,shrink:s,disableAnimation:l,variant:r,required:d}=e,b={root:["root",o&&"formControl",!l&&"animated",s&&"shrink",n&&n!=="medium"&&`size${X(n)}`,r],asterisk:[d&&"asterisk"]},g=Z(b,vo,t);return{...t,...g}},xo=F(fo,{shouldForwardProp:e=>pe(e)||e==="classes",name:"MuiInputLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[{[`& .${Ae.asterisk}`]:t.asterisk},t.root,o.formControl&&t.formControl,o.size==="small"&&t.sizeSmall,o.shrink&&t.shrink,!o.disableAnimation&&t.animated,o.focused&&t.focused,t[o.variant]]}})(J(({theme:e})=>({display:"block",transformOrigin:"top left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",variants:[{props:({ownerState:t})=>t.formControl,style:{position:"absolute",left:0,top:0,transform:"translate(0, 20px) scale(1)"}},{props:{size:"small"},style:{transform:"translate(0, 17px) scale(1)"}},{props:({ownerState:t})=>t.shrink,style:{transform:"translate(0, -1.5px) scale(0.75)",transformOrigin:"top left",maxWidth:"133%"}},{props:({ownerState:t})=>!t.disableAnimation,style:{transition:e.transitions.create(["color","transform","max-width"],{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut})}},{props:{variant:"filled"},style:{zIndex:1,pointerEvents:"none",transform:"translate(12px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"filled",size:"small"},style:{transform:"translate(12px, 13px) scale(1)"}},{props:({variant:t,ownerState:o})=>t==="filled"&&o.shrink,style:{userSelect:"none",pointerEvents:"auto",transform:"translate(12px, 7px) scale(0.75)",maxWidth:"calc(133% - 24px)"}},{props:({variant:t,ownerState:o,size:n})=>t==="filled"&&o.shrink&&n==="small",style:{transform:"translate(12px, 4px) scale(0.75)"}},{props:{variant:"outlined"},style:{zIndex:1,pointerEvents:"none",transform:"translate(14px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"outlined",size:"small"},style:{transform:"translate(14px, 9px) scale(1)"}},{props:({variant:t,ownerState:o})=>t==="outlined"&&o.shrink,style:{userSelect:"none",pointerEvents:"auto",maxWidth:"calc(133% - 32px)",transform:"translate(14px, -9px) scale(0.75)"}}]}))),yo=i.forwardRef(function(t,o){const n=ie({name:"MuiInputLabel",props:t}),{disableAnimation:s=!1,margin:l,shrink:r,variant:d,className:b,...g}=n,m=Le();let h=r;typeof h>"u"&&m&&(h=m.filled||m.focused||m.adornedStart);const v=Me({props:n,muiFormControl:m,states:["size","variant","required","focused"]}),S={...n,disableAnimation:s,formControl:m,shrink:h,size:v.size,variant:v.variant,required:v.required,focused:v.focused},y=go(S);return u.jsx(xo,{"data-shrink":h,ref:o,className:se(y.root,b),...g,ownerState:S,classes:y})});function So(e){return ee("MuiNativeSelect",e)}const nt=Y("MuiNativeSelect",["root","select","multiple","filled","outlined","standard","disabled","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]),Co=e=>{const{classes:t,variant:o,disabled:n,multiple:s,open:l,error:r}=e,d={select:["select",o,n&&"disabled",s&&"multiple",r&&"error"],icon:["icon",`icon${X(o)}`,l&&"iconOpen",n&&"disabled"]};return Z(d,So,t)},kt=F("select",{name:"MuiNativeSelect"})(({theme:e})=>({MozAppearance:"none",WebkitAppearance:"none",userSelect:"none",borderRadius:0,cursor:"pointer","&:focus":{borderRadius:0},[`&.${nt.disabled}`]:{cursor:"default"},"&[multiple]":{height:"auto"},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(e.vars||e).palette.background.paper},variants:[{props:({ownerState:t})=>t.variant!=="filled"&&t.variant!=="outlined",style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:"filled"},style:{"&&&":{paddingRight:32}}},{props:{variant:"outlined"},style:{borderRadius:(e.vars||e).shape.borderRadius,"&:focus":{borderRadius:(e.vars||e).shape.borderRadius},"&&&":{paddingRight:32}}}]})),Io=F(kt,{name:"MuiNativeSelect",slot:"Select",shouldForwardProp:pe,overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.select,t[o.variant],o.error&&t.error,{[`&.${nt.multiple}`]:t.multiple}]}})({}),Ot=F("svg",{name:"MuiNativeSelect"})(({theme:e})=>({position:"absolute",right:0,top:"calc(50% - .5em)",pointerEvents:"none",color:(e.vars||e).palette.action.active,[`&.${nt.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:t})=>t.open,style:{transform:"rotate(180deg)"}},{props:{variant:"filled"},style:{right:7}},{props:{variant:"outlined"},style:{right:7}}]})),wo=F(Ot,{name:"MuiNativeSelect",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.icon,o.variant&&t[`icon${X(o.variant)}`],o.open&&t.iconOpen]}})({}),Ro=i.forwardRef(function(t,o){const{className:n,disabled:s,error:l,IconComponent:r,inputRef:d,variant:b="standard",...g}=t,m={...t,disabled:s,variant:b,error:l},h=Co(m);return u.jsxs(i.Fragment,{children:[u.jsx(Io,{ownerState:m,className:se(h.select,n),disabled:s,ref:d||o,...g}),t.multiple?null:u.jsx(wo,{as:r,ownerState:m,className:h.icon})]})});var It;const Fo=F("fieldset",{name:"MuiNotchedOutlined",shouldForwardProp:pe})({textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%"}),Po=F("legend",{name:"MuiNotchedOutlined",shouldForwardProp:pe})(J(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:({ownerState:t})=>!t.withLabel,style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:t})=>t.withLabel,style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:({ownerState:t})=>t.withLabel&&t.notched,style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function ko(e){const{children:t,classes:o,className:n,label:s,notched:l,...r}=e,d=s!=null&&s!=="",b={...e,notched:l,withLabel:d};return u.jsx(Fo,{"aria-hidden":!0,className:n,ownerState:b,...r,children:u.jsx(Po,{ownerState:b,children:d?u.jsx("span",{children:s}):It||(It=u.jsx("span",{className:"notranslate","aria-hidden":!0,children:"​"}))})})}const Oo=e=>{const{classes:t}=e,n=Z({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},Gt,t);return{...t,...n}},Mo=F(Xe,{shouldForwardProp:e=>pe(e)||e==="classes",name:"MuiOutlinedInput",slot:"Root",overridesResolver:Ve})(J(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{position:"relative",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${re.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${re.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${re.focused} .${re.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(De()).map(([o])=>({props:{color:o},style:{[`&.${re.focused} .${re.notchedOutline}`]:{borderColor:(e.vars||e).palette[o].main}}})),{props:{},style:{[`&.${re.error} .${re.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${re.disabled} .${re.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:o})=>o.startAdornment,style:{paddingLeft:14}},{props:({ownerState:o})=>o.endAdornment,style:{paddingRight:14}},{props:({ownerState:o})=>o.multiline,style:{padding:"16.5px 14px"}},{props:({ownerState:o,size:n})=>o.multiline&&n==="small",style:{padding:"8.5px 14px"}}]}})),Lo=F(ko,{name:"MuiOutlinedInput",slot:"NotchedOutline"})(J(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),$o=F(Ge,{name:"MuiOutlinedInput",slot:"Input",overridesResolver:Ke})(J(({theme:e})=>({padding:"16.5px 14px",...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode==="light"?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:e.palette.mode==="light"?null:"#fff",caretColor:e.palette.mode==="light"?null:"#fff",borderRadius:"inherit"}},...e.vars&&{"&:-webkit-autofill":{borderRadius:"inherit"},[e.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},variants:[{props:{size:"small"},style:{padding:"8.5px 14px"}},{props:({ownerState:t})=>t.multiline,style:{padding:0}},{props:({ownerState:t})=>t.startAdornment,style:{paddingLeft:0}},{props:({ownerState:t})=>t.endAdornment,style:{paddingRight:0}}]}))),rt=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiOutlinedInput"}),{components:s={},fullWidth:l=!1,inputComponent:r="input",label:d,multiline:b=!1,notched:g,slots:m={},slotProps:h={},type:v="text",...S}=n,y=Oo(n),C=Le(),c=Me({props:n,muiFormControl:C,states:["color","disabled","error","focused","hiddenLabel","size","required"]}),x={...n,color:c.color||"primary",disabled:c.disabled,error:c.error,focused:c.focused,formControl:C,fullWidth:l,hiddenLabel:c.hiddenLabel,multiline:b,size:c.size,type:v},P=m.root??s.Root??Mo,f=m.input??s.Input??$o,[p,R]=Se("notchedOutline",{elementType:Lo,className:y.notchedOutline,shouldForwardComponentProp:!0,ownerState:x,externalForwardedProps:{slots:m,slotProps:h},additionalProps:{label:d!=null&&d!==""&&c.required?u.jsxs(i.Fragment,{children:[d," ","*"]}):d}});return u.jsx(et,{slots:{root:P,input:f},slotProps:h,renderSuffix:I=>u.jsx(p,{...R,notched:typeof g<"u"?g:!!(I.startAdornment||I.filled||I.focused)}),fullWidth:l,inputComponent:r,multiline:b,ref:o,type:v,...S,classes:{...y,notchedOutline:null}})});rt.muiName="Input";function Mt(e){return ee("MuiSelect",e)}const Ne=Y("MuiSelect",["root","select","multiple","filled","outlined","standard","disabled","focused","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]);var wt;const To=F(kt,{name:"MuiSelect",slot:"Select",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[{[`&.${Ne.select}`]:t.select},{[`&.${Ne.select}`]:t[o.variant]},{[`&.${Ne.error}`]:t.error},{[`&.${Ne.multiple}`]:t.multiple}]}})({[`&.${Ne.select}`]:{height:"auto",minHeight:"1.4375em",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}}),zo=F(Ot,{name:"MuiSelect",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.icon,o.variant&&t[`icon${X(o.variant)}`],o.open&&t.iconOpen]}})({}),Bo=F("input",{shouldForwardProp:e=>Wt(e)&&e!=="classes",name:"MuiSelect",slot:"NativeInput"})({bottom:0,left:0,position:"absolute",opacity:0,pointerEvents:"none",width:"100%",boxSizing:"border-box"});function Rt(e,t){return typeof t=="object"&&t!==null?e===t:String(e)===String(t)}function No(e){return e==null||typeof e=="string"&&!e.trim()}const Ao=e=>{const{classes:t,variant:o,disabled:n,multiple:s,open:l,error:r}=e,d={select:["select",o,n&&"disabled",s&&"multiple",r&&"error"],icon:["icon",`icon${X(o)}`,l&&"iconOpen",n&&"disabled"],nativeInput:["nativeInput"]};return Z(d,Mt,t)},Eo=i.forwardRef(function(t,o){var lt,at,dt,ut;const{"aria-describedby":n,"aria-label":s,autoFocus:l,autoWidth:r,children:d,className:b,defaultOpen:g,defaultValue:m,disabled:h,displayEmpty:v,error:S=!1,IconComponent:y,inputRef:C,labelId:c,MenuProps:x={},multiple:P,name:f,onBlur:p,onChange:R,onClose:I,onFocus:U,onKeyDown:q,onMouseDown:D,onOpen:B,open:j,readOnly:L,renderValue:T,required:V,SelectDisplayProps:N={},tabIndex:A,type:G,value:te,variant:oe="standard",...Ce}=t,[O,fe]=mt({controlled:te,default:m,name:"Select"}),[H,Ie]=mt({controlled:j,default:g,name:"Select"}),Q=i.useRef(null),_=i.useRef(null),[K,me]=i.useState(null),{current:E}=i.useRef(j!=null),[le,ae]=i.useState(),be=qe(o,C),he=i.useCallback(a=>{_.current=a,a&&me(a)},[]),w=K==null?void 0:K.parentNode;i.useImperativeHandle(be,()=>({focus:()=>{_.current.focus()},node:Q.current,value:O}),[O]);const $=K!==null&&H;i.useEffect(()=>{if(!$||!w||r||typeof ResizeObserver>"u")return;const a=new ResizeObserver(()=>{ae(w.clientWidth)});return a.observe(w),()=>{a.disconnect()}},[$,w,r]),i.useEffect(()=>{g&&H&&K&&!E&&(ae(r?null:w.clientWidth),_.current.focus())},[K,r]),i.useEffect(()=>{l&&_.current.focus()},[l]),i.useEffect(()=>{if(!c)return;const a=At(_.current).getElementById(c);if(a){const k=()=>{getSelection().isCollapsed&&_.current.focus()};return a.addEventListener("click",k),()=>{a.removeEventListener("click",k)}}},[c]);const ne=(a,k)=>{a?B&&B(k):I&&I(k),E||(ae(r?null:w.clientWidth),Ie(a))},ve=a=>{D==null||D(a),a.button===0&&(a.preventDefault(),_.current.focus(),ne(!0,a))},de=a=>{ne(!1,a)},we=i.Children.toArray(d),$e=a=>{const k=we.find(W=>W.props.value===a.target.value);k!==void 0&&(fe(k.props.value),R&&R(a,k))},Te=a=>k=>{let W;if(k.currentTarget.hasAttribute("tabindex")){if(P){W=Array.isArray(O)?O.slice():[];const ke=O.indexOf(a.props.value);ke===-1?W.push(a.props.value):W.splice(ke,1)}else W=a.props.value;if(a.props.onClick&&a.props.onClick(k),O!==W&&(fe(W),R)){const ke=k.nativeEvent||k,ct=new ke.constructor(ke.type,ke);Object.defineProperty(ct,"target",{writable:!0,value:{value:W,name:f}}),R(ct,a)}P||ne(!1,k)}},ze=a=>{L||([" ","ArrowUp","ArrowDown","Enter"].includes(a.key)&&(a.preventDefault(),ne(!0,a)),q==null||q(a))},ge=a=>{!$&&p&&(Object.defineProperty(a,"target",{writable:!0,value:{value:O,name:f}}),p(a))};delete Ce["aria-invalid"];let z,Ee;const ce=[];let xe=!1;(Ue({value:O})||v)&&(T?z=T(O):xe=!0);const We=we.map(a=>{if(!i.isValidElement(a))return null;let k;if(P){if(!Array.isArray(O))throw new Error(Ft(2));k=O.some(W=>Rt(W,a.props.value)),k&&xe&&ce.push(a.props.children)}else k=Rt(O,a.props.value),k&&xe&&(Ee=a.props.children);return i.cloneElement(a,{"aria-selected":k?"true":"false",onClick:Te(a),onKeyUp:W=>{W.key===" "&&W.preventDefault(),a.props.onKeyUp&&a.props.onKeyUp(W)},role:"option",selected:k,value:void 0,"data-value":a.props.value})});xe&&(P?ce.length===0?z=null:z=ce.reduce((a,k,W)=>(a.push(k),W<ce.length-1&&a.push(", "),a),[]):z=Ee);let Re=le;!r&&E&&K&&(Re=w.clientWidth);let Fe;typeof A<"u"?Fe=A:Fe=h?null:0;const M=N.id||(f?`mui-component-select-${f}`:void 0),ue={...t,variant:oe,value:O,open:$,error:S},Pe=Ao(ue),_e={...x.PaperProps,...typeof((lt=x.slotProps)==null?void 0:lt.paper)=="function"?x.slotProps.paper(ue):(at=x.slotProps)==null?void 0:at.paper},$t={...x.MenuListProps,...typeof((dt=x.slotProps)==null?void 0:dt.list)=="function"?x.slotProps.list(ue):(ut=x.slotProps)==null?void 0:ut.list},it=Pt();return u.jsxs(i.Fragment,{children:[u.jsx(To,{as:"div",ref:he,tabIndex:Fe,role:"combobox","aria-controls":$?it:void 0,"aria-disabled":h?"true":void 0,"aria-expanded":$?"true":"false","aria-haspopup":"listbox","aria-label":s,"aria-labelledby":[c,M].filter(Boolean).join(" ")||void 0,"aria-describedby":n,"aria-required":V?"true":void 0,"aria-invalid":S?"true":void 0,onKeyDown:ze,onMouseDown:h||L?null:ve,onBlur:ge,onFocus:U,...N,ownerState:ue,className:se(N.className,Pe.select,b),id:M,children:No(z)?wt||(wt=u.jsx("span",{className:"notranslate","aria-hidden":!0,children:"​"})):z}),u.jsx(Bo,{"aria-invalid":S,value:Array.isArray(O)?O.join(","):O,name:f,ref:Q,"aria-hidden":!0,onChange:$e,tabIndex:-1,disabled:h,className:Pe.nativeInput,autoFocus:l,required:V,...Ce,ownerState:ue}),u.jsx(zo,{as:y,className:Pe.icon,ownerState:ue}),u.jsx(Et,{id:`menu-${f||""}`,anchorEl:w,open:$,onClose:de,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},...x,slotProps:{...x.slotProps,list:{"aria-labelledby":c,role:"listbox","aria-multiselectable":P?"true":void 0,disableListWrap:!0,id:it,...$t},paper:{..._e,style:{minWidth:Re,..._e!=null?_e.style:null}}},children:We})]})}),Wo=e=>{const{classes:t}=e,n=Z({root:["root"]},Mt,t);return{...t,...n}},st={name:"MuiSelect",slot:"Root",shouldForwardProp:e=>pe(e)&&e!=="variant"},jo=F(ot,st)(""),Ho=F(rt,st)(""),Uo=F(tt,st)(""),Lt=i.forwardRef(function(t,o){const n=ie({name:"MuiSelect",props:t}),{autoWidth:s=!1,children:l,classes:r={},className:d,defaultOpen:b=!1,displayEmpty:g=!1,IconComponent:m=Jt,id:h,input:v,inputProps:S,label:y,labelId:C,MenuProps:c,multiple:x=!1,native:P=!1,onClose:f,onOpen:p,open:R,renderValue:I,SelectDisplayProps:U,variant:q="outlined",...D}=n,B=P?Ro:Eo,j=Le(),L=Me({props:n,muiFormControl:j,states:["variant","error"]}),T=L.variant||q,V={...n,variant:T,classes:r},N=Wo(V),{root:A,...G}=N,te=v||{standard:u.jsx(jo,{ownerState:V}),outlined:u.jsx(Ho,{label:y,ownerState:V}),filled:u.jsx(Uo,{ownerState:V})}[T],oe=qe(o,jt(te));return u.jsx(i.Fragment,{children:i.cloneElement(te,{inputComponent:B,inputProps:{children:l,error:L.error,IconComponent:m,variant:T,type:void 0,multiple:x,...P?{id:h}:{autoWidth:s,defaultOpen:b,displayEmpty:g,labelId:C,MenuProps:c,onClose:f,onOpen:p,open:R,renderValue:I,SelectDisplayProps:{id:h,...U}},...S,classes:S?Ze(G,S.classes):G,...v?v.props.inputProps:{}},...(x&&P||g)&&T==="outlined"?{notched:!0}:{},ref:oe,className:se(te.props.className,d,N.root),...!v&&{variant:T},...D})})});Lt.muiName="Select";function qo(e){return ee("MuiTextField",e)}Y("MuiTextField",["root"]);const Do={standard:ot,filled:tt,outlined:rt},Vo=e=>{const{classes:t}=e;return Z({root:["root"]},qo,t)},Ko=F(no,{name:"MuiTextField",slot:"Root"})({}),Jo=i.forwardRef(function(t,o){const n=ie({props:t,name:"MuiTextField"}),{autoComplete:s,autoFocus:l=!1,children:r,className:d,color:b="primary",defaultValue:g,disabled:m=!1,error:h=!1,FormHelperTextProps:v,fullWidth:S=!1,helperText:y,id:C,InputLabelProps:c,inputProps:x,InputProps:P,inputRef:f,label:p,maxRows:R,minRows:I,multiline:U=!1,name:q,onBlur:D,onChange:B,onFocus:j,placeholder:L,required:T=!1,rows:V,select:N=!1,SelectProps:A,slots:G={},slotProps:te={},type:oe,value:Ce,variant:O="outlined",...fe}=n,H={...n,autoFocus:l,color:b,disabled:m,error:h,fullWidth:S,multiline:U,required:T,select:N,variant:O},Ie=Vo(H),Q=Pt(C),_=y&&Q?`${Q}-helper-text`:void 0,K=p&&Q?`${Q}-label`:void 0,me=Do[O],E={slots:G,slotProps:{input:P,inputLabel:c,htmlInput:x,formHelperText:v,select:A,...te}},le={},ae=E.slotProps.inputLabel;O==="outlined"&&(ae&&typeof ae.shrink<"u"&&(le.notched=ae.shrink),le.label=p),N&&((!A||!A.native)&&(le.id=void 0),le["aria-describedby"]=void 0);const[be,he]=Se("root",{elementType:Ko,shouldForwardComponentProp:!0,externalForwardedProps:{...E,...fe},ownerState:H,className:se(Ie.root,d),ref:o,additionalProps:{disabled:m,error:h,fullWidth:S,required:T,color:b,variant:O}}),[w,$]=Se("input",{elementType:me,externalForwardedProps:E,additionalProps:le,ownerState:H}),[ne,ve]=Se("inputLabel",{elementType:yo,externalForwardedProps:E,ownerState:H}),[de,we]=Se("htmlInput",{elementType:"input",externalForwardedProps:E,ownerState:H}),[$e,Te]=Se("formHelperText",{elementType:lo,externalForwardedProps:E,ownerState:H}),[ze,ge]=Se("select",{elementType:Lt,externalForwardedProps:E,ownerState:H}),z=u.jsx(w,{"aria-describedby":_,autoComplete:s,autoFocus:l,defaultValue:g,fullWidth:S,multiline:U,name:q,rows:V,maxRows:R,minRows:I,type:oe,value:Ce,id:Q,inputRef:f,onBlur:D,onChange:B,onFocus:j,placeholder:L,inputProps:we,slots:{input:G.htmlInput?de:void 0},...$});return u.jsxs(be,{...he,children:[p!=null&&p!==""&&u.jsx(ne,{htmlFor:Q,id:K,...ve,children:p}),N?u.jsx(ze,{"aria-describedby":_,id:Q,labelId:K,value:Ce,input:z,...ge,children:r}):z,y&&u.jsx($e,{id:_,...Te,children:y})]})});function Qo({title:e,subtitle:t,actions:o,children:n}){const s=!!(e||t||o);return u.jsx(je,{sx:{width:"100%"},children:u.jsxs(bt,{spacing:4,children:[s&&u.jsxs(bt,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:2,children:[u.jsxs(je,{children:[e&&u.jsx(ht,{variant:"h4",component:"h1",gutterBottom:!0,children:e}),t&&u.jsx(ht,{variant:"body1",color:"text.secondary",children:t})]}),o&&u.jsx(je,{sx:{alignSelf:{xs:"stretch",sm:"center"}},children:o})]}),u.jsx(je,{children:n})]})})}export{Jt as A,Ye as F,et as I,Qo as P,Lt as S,Jo as T,Be as a,ye as f,Oe as i,re as o,Le as u};
@@ -0,0 +1 @@
1
+ import{j as o}from"./vendor-xyflow.js";import{R as r}from"./docs.js";const a=r(o.jsx("path",{d:"M8 5v14l11-7z"}));export{a as P};
@@ -0,0 +1,4 @@
1
+ import{j as e}from"./vendor-xyflow.js";import{h,m as U}from"./vendor-recharts.js";import{I as Z,J as ee,U as te,L as B,N as se,O as W,P as re,W as K,ak as oe,S as A,T as I,j as ne,R as ie,b as L,a9 as V,a1 as H,al as ae,am as q,af as ce,ag as le,a3 as O,u as de,e as ue,C as pe,F as he,an as J}from"./docs.js";import{B as fe}from"./BaseFilterBar.js";import{T as X,P as ge}from"./PageContainer.js";import{D as me}from"./Download.js";import{p as xe,D as ye,a as Ce}from"./kvRowAdapters.js";import{u as je}from"./useQueryState.js";import{D as ve}from"./filterTypes.js";import"./Autocomplete.js";function we(t){return Z("MuiCardActionArea",t)}const $=ee("MuiCardActionArea",["root","focusVisible","focusHighlight"]),be=t=>{const{classes:a}=t;return se({root:["root"],focusHighlight:["focusHighlight"]},we,a)},Se=W(re,{name:"MuiCardActionArea",slot:"Root"})(K(({theme:t})=>({display:"block",textAlign:"inherit",borderRadius:"inherit",width:"100%",[`&:hover .${$.focusHighlight}`]:{opacity:(t.vars||t).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${$.focusVisible} .${$.focusHighlight}`]:{opacity:(t.vars||t).palette.action.focusOpacity}}))),Ie=W("span",{name:"MuiCardActionArea",slot:"FocusHighlight"})(K(({theme:t})=>({overflow:"hidden",pointerEvents:"none",position:"absolute",top:0,right:0,bottom:0,left:0,borderRadius:"inherit",opacity:0,backgroundColor:"currentcolor",transition:t.transitions.create("opacity",{duration:t.transitions.duration.short})}))),Ae=h.forwardRef(function(a,s){const r=te({props:a,name:"MuiCardActionArea"}),{children:u,className:o,focusVisibleClassName:f,slots:g={},slotProps:x={},...C}=r,v=r,w=be(v),d={slots:g,slotProps:x},[m,y]=B("root",{elementType:Se,externalForwardedProps:{...d,...C},shouldForwardComponentProp:!0,ownerState:v,ref:s,className:U(w.root,o),additionalProps:{focusVisibleClassName:U(f,w.focusVisible)}}),[l,c]=B("focusHighlight",{elementType:Ie,externalForwardedProps:d,ownerState:v,className:w.focusHighlight});return e.jsxs(m,{...y,children:[u,e.jsx(l,{...c})]})});function Ee({preset:t,onClick:a}){var s;return e.jsx(oe,{variant:"outlined",sx:{height:"100%"},children:e.jsx(Ae,{onClick:a,sx:{textAlign:"left",p:2,height:"100%",alignItems:"stretch"},children:e.jsxs(A,{spacing:1.5,children:[e.jsx(I,{variant:"h6",children:t.name}),t.description&&e.jsx(I,{variant:"body2",color:"text.secondary",children:t.description}),t.groupId&&e.jsxs(I,{variant:"body2",color:"text.secondary",children:["Group: ",t.groupId]}),(s=t.tags)!=null&&s.length?e.jsx(A,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:t.tags.map(r=>e.jsx(ne,{label:r,size:"small"},r))}):null,e.jsxs(I,{variant:"body2",color:"text.secondary",children:[t.operations.length," ",t.operations.length===1?"operation":"operations"]}),t.operations.slice(0,3).map((r,u)=>e.jsxs(I,{variant:"body2",color:"text.secondary",sx:{fontStyle:r.description?"italic":"normal"},children:["• ",r.name||`${r.method.toUpperCase()} ${r.path}`,r.description?` — ${r.description}`:""]},`${r.name}-${u}`))]})})})}const _=ie(e.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"}));function Ne(t,a,s="text/csv"){const r=new Blob([a],{type:s}),u=URL.createObjectURL(r),o=document.createElement("a");o.href=u,o.download=t,o.click(),URL.revokeObjectURL(u)}const z=["presetId","presetName","presetDescription","presetGroupId","presetTags","opStepNumber","opName","opDescription","opMethod","opPath","opEndpointId","opQueryJson","opExtraHeadersJson","opBodyJson"],Re=["presetName","opStepNumber","opMethod","opPath"];function G(t){return t?t.split(";").map(a=>a.trim()).filter(Boolean):[]}function Q(t){const a=t.replace(/"/g,'""');return/[",\n\r]/.test(t)?`"${a}"`:t}function Pe(t){const a=[];let s=[],r="",u=!1,o=0;const f=()=>{s.push(r),r=""},g=()=>{s.push(r),r="",a.push(s),s=[]};for(;o<t.length;){const x=t[o],C=t[o+1];if(x==='"'){u&&C==='"'?(r+='"',o+=1):u=!u,o+=1;continue}if(!u&&x===","){f(),o+=1;continue}if(!u&&x==="\r"){g(),C===`
2
+ `?o+=2:o+=1;continue}if(!u&&x===`
3
+ `){g(),o+=1;continue}r+=x,o+=1}return(r||s.length>0)&&g(),{rows:a}}function Fe(t){const a=z.map(Q).join(","),s=[];return t.forEach(r=>{const u=Array.isArray(r.tags)?r.tags.filter(Boolean).join(";"):"";r.operations.forEach(o=>{const f={presetId:r.id,presetName:r.name,presetDescription:r.description??"",presetGroupId:r.groupId??"",presetTags:u,opStepNumber:String(o.stepNumber??""),opName:o.name??"",opDescription:o.description??"",opMethod:o.method??"",opPath:o.path??"",opEndpointId:o.endpointId??"",opQueryJson:o.query?JSON.stringify(o.query):"",opExtraHeadersJson:o.extraHeaders?JSON.stringify(o.extraHeaders):"",opBodyJson:o.body!==void 0?JSON.stringify(o.body):""};s.push(z.map(g=>Q(f[g])).join(","))})}),s.length?[a,...s].join(`
4
+ `):a}function Te(t){const{rows:a}=Pe(t),s=[];if(a.length===0)return s.push("CSV is empty"),{presets:[],errors:s};const r=a.findIndex(d=>d.some(m=>m.trim().length>0));if(r===-1)return s.push("CSV has no header row"),{presets:[],errors:s};const u=a[r].map(d=>d.trim()),o=new Map;u.forEach((d,m)=>{d&&o.set(d,m)});const f=Re.filter(d=>!o.has(d));if(f.length>0)return s.push(`Missing required columns: ${f.join(", ")}`),{presets:[],errors:s};const g=a.slice(r+1),x=new Map,C=[];if(g.forEach((d,m)=>{if(d.every(b=>b.trim()===""))return;const y=r+m+2,l=b=>{var p;const i=o.get(b);return i===void 0?"":((p=d[i])==null?void 0:p.trim())??""},c=l("presetName");if(!c){s.push(`Row ${y}: presetName is required`);return}let n=x.get(c);if(!n)n={id:l("presetId")||void 0,description:l("presetDescription")||void 0,groupId:l("presetGroupId")||void 0,tags:new Set(G(l("presetTags"))),operations:[],order:C.length},x.set(c,n),C.push(c);else{const b=l("presetId");b&&!n.id&&(n.id=b);const i=l("presetDescription");i&&!n.description&&(n.description=i);const p=l("presetGroupId");p&&!n.groupId&&(n.groupId=p),G(l("presetTags")).forEach(S=>n==null?void 0:n.tags.add(S))}const j=l("opStepNumber");if(!j){s.push(`Row ${y}: opStepNumber is required`);return}const E=Number(j);if(!Number.isFinite(E)){s.push(`Row ${y}: opStepNumber must be numeric`);return}const k=l("opMethod");if(!k){s.push(`Row ${y}: opMethod is required`);return}const M=l("opPath");if(!M){s.push(`Row ${y}: opPath is required`);return}const N=b=>{const i=l(b);if(!i)return{value:void 0};const p=xe(i);return p.error?(s.push(`Row ${y}: ${b} ${p.error}`),{error:!0}):{value:p.value}},R=N("opQueryJson");if("error"in R)return;const F=N("opExtraHeadersJson");if("error"in F)return;const T=N("opBodyJson");if("error"in T)return;const P={name:l("opName"),description:l("opDescription")||void 0,stepNumber:E,method:k.toLowerCase(),path:M,endpointId:l("opEndpointId")||void 0};R.value!==void 0&&(P.query=R.value),F.value!==void 0&&(P.extraHeaders=F.value),T.value!==void 0&&(P.body=T.value),n.operations.push(P)}),s.length>0)return{presets:[],errors:s};if(C.length===0)return s.push("CSV contains no operation rows"),{presets:[],errors:s};const v=Date.now();return{presets:C.map(d=>{const m=x.get(d),y=m.operations.map((l,c)=>({op:l,index:c})).sort((l,c)=>{const n=l.op.stepNumber??0,j=c.op.stepNumber??0;return n!==j?n-j:l.index-c.index}).map(({op:l})=>l);return{id:m.id??"",name:d,description:m.description??"",groupId:m.groupId??"",tags:Array.from(m.tags),createdAt:v,updatedAt:v,operations:y}}),errors:s}}function ke({presets:t,onImportComplete:a}){const s=h.useMemo(()=>Fe(t),[t]),[r,u]=h.useState(null),[o,f]=h.useState(!1),[g,x]=h.useState(""),[C,v]=h.useState([]),[w,d]=h.useState([]),[m,y]=h.useState(!1),l=h.useRef(null),c=L("POST /__rrroutes/presets"),n=L("PUT /__rrroutes/presets"),j=h.useMemo(()=>new Set(t.map(i=>i.id).filter(i=>!!i)),[t]),E=h.useCallback(async()=>{try{await navigator.clipboard.writeText(s)}catch(i){console.error("Copy failed",i)}finally{u(null)}},[s]),k=h.useCallback(()=>{Ne("presets.csv",s),u(null)},[s]),M=h.useCallback(()=>{x(""),d([]),v([]),f(!0)},[]),N=h.useCallback(()=>{f(!1)},[]),R=h.useCallback(()=>{if(!g.trim()){v([]),d([]);return}const i=Te(g);v(i.errors),d(i.errors.length===0?i.presets:[])},[g]),F=h.useCallback(i=>{x(i.target.value)},[]),T=h.useCallback(()=>{var i;(i=l.current)==null||i.click()},[]),P=h.useCallback(i=>{var D;const p=(D=i.target.files)==null?void 0:D[0];if(!p)return;const S=new FileReader;S.onload=()=>{const Y=typeof S.result=="string"?S.result:"";x(Y)},S.readAsText(p),i.target.value=""},[]),b=h.useCallback(async()=>{if(!w.length)return;const i=w.filter(p=>p.id&&j.has(p.id)).length;if(!(i>0&&!window.confirm(`This import will replace ${i} existing preset${i>1?"s":""}. Continue?`))){y(!0);try{for(const p of w){const S={...p,updatedAt:Date.now()};p.id&&j.has(p.id)?await n.fetch(S):await c.fetch({...S,id:""})}a==null||a(),f(!1)}catch(p){const S=p instanceof Error?p.message:"Failed to import presets.";v(D=>[...D,S])}finally{y(!1)}}},[j,a,w,c,n]);return h.useEffect(()=>{R()},[g,R]),e.jsxs(e.Fragment,{children:[e.jsxs(A,{direction:"row",spacing:1,children:[e.jsx(V,{title:"Export presets CSV",children:e.jsx(H,{onClick:i=>u(i.currentTarget),"aria-label":"Export presets CSV",children:e.jsx(me,{})})}),e.jsxs(ae,{anchorEl:r,open:!!r,onClose:()=>u(null),children:[e.jsx(q,{onClick:E,children:"Copy CSV"}),e.jsx(q,{onClick:k,children:"Download CSV"})]}),e.jsx(V,{title:"Import presets CSV",children:e.jsx(H,{onClick:M,"aria-label":"Import presets CSV",children:e.jsx(_,{})})})]}),e.jsxs(ce,{open:o,onClose:N,fullWidth:!0,maxWidth:"md",children:[e.jsx(ye,{children:"Import presets CSV"}),e.jsx(le,{children:e.jsxs(A,{spacing:2,children:[e.jsxs(A,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(I,{variant:"subtitle1",children:"Paste CSV"}),e.jsx(V,{title:"From file",children:e.jsx(H,{onClick:T,"aria-label":"Upload CSV from file",size:"small",children:e.jsx(_,{fontSize:"small"})})}),e.jsx("input",{ref:l,type:"file",accept:".csv",hidden:!0,onChange:P})]}),e.jsx(X,{multiline:!0,minRows:8,placeholder:"Paste CSV here",value:g,onChange:F,autoFocus:!0,fullWidth:!0}),e.jsxs(A,{spacing:1,children:[e.jsx(I,{variant:"subtitle2",children:"Import errors"}),C.length?C.map((i,p)=>e.jsx(I,{variant:"body2",color:"error",children:i},p)):e.jsx(I,{variant:"body2",color:"text.secondary",children:"No errors detected."})]})]})}),e.jsxs(Ce,{children:[e.jsx(O,{onClick:N,children:"Cancel"}),e.jsx(O,{variant:"contained",onClick:b,disabled:m||!w.length,children:m?"Importing...":"Apply import"})]})]})]})}const Me={...ve,searchQuery:"",nameInclude:"",nameExclude:""};function _e(){const t=de(),[a,s]=je("presetsFilters",Me),r=L("GET /__rrroutes/presets",{cursorQueryKey:"cursor",getNextPageCursor(c){return c.meta.nextCursor}}),{data:u,isLoading:o,error:f,refetch:g,isFetching:x,fetchNextPage:C,hasNextPage:v,isFetchingNextPage:w}=r.useEndpoint({query:a}),d=ue(u,{reverse:!1}),m=h.useMemo(()=>{const c=new Set;return d.forEach(n=>{var j;return(j=n.tags)==null?void 0:j.forEach(E=>c.add(E))}),Array.from(c).sort()},[d]),y=h.useMemo(()=>{const c=new Set;return d.forEach(n=>{n.groupId&&c.add(n.groupId)}),Array.from(c).sort()},[d]),l=h.useMemo(()=>{if(f==null)return null;const c=f instanceof Error?f.message:"Failed to load presets.",n=f instanceof Error?f.stack:f?String(f):void 0;return{message:c,details:n,onRetry:()=>g()}},[f]);return e.jsx(ge,{title:"Presets",subtitle:"Manage saved request presets for quick access.",actions:e.jsxs(A,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(O,{variant:"contained",onClick:()=>t("/presets/new"),children:"New preset"}),e.jsx(ke,{presets:d,onImportComplete:()=>g()})]}),children:e.jsxs(A,{spacing:3,children:[e.jsx(fe,{value:a,onChange:c=>s(n=>({...n,...c})),tagOptions:m,groupOptions:y,onRefresh:()=>g(),refreshing:x,children:c=>e.jsxs(e.Fragment,{children:[e.jsx(A,{direction:{xs:"column",sm:"row"},spacing:2,children:e.jsx(X,{label:"Name",value:c==="include"?a.nameInclude:a.nameExclude,onChange:n=>s(j=>({...j,[c==="include"?"nameInclude":"nameExclude"]:n.target.value})),size:"small",fullWidth:!0})}),e.jsx(I,{variant:"body2",color:"text.secondary",sx:{mt:2},children:"Use the base search field to match names and tags locally while the additional filters narrow the server query."})]})}),e.jsx(pe,{title:"All presets",children:e.jsx(he,{stateHandler:{loading:{variant:"full"},error:l,emptyFallback:{title:"No presets found",description:"Try adjusting your search query or create a new preset."},isLoading:o},items:d,fetchNextPage:C,hasNextPage:v,isFetchingNextPage:w,pageSize:a.pageSize,children:c=>e.jsx(J,{container:!0,spacing:2,children:c.map(n=>e.jsx(J,{component:"div",children:e.jsx(Ee,{preset:n,onClick:()=>t(`/presets/${n.id}`)})},n.id))})})})]})})}export{_e as default};
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-xyflow.js";import{u as A,a as D,b as _,c as G,l as N,d as U,e as O,f as y,g as B,S as d,C as M,F as H,T as f,h as K,A as Q,i as q,H as V,j as $,k as J,E as W,m as X}from"./docs.js";import{h as u}from"./vendor-recharts.js";import{E as Y}from"./EndpointDetailPanel.js";import{B as Z}from"./BaseFilterBar.js";import{P as ee}from"./PageContainer.js";import{u as te}from"./useQueryState.js";import{D as se}from"./filterTypes.js";import"./SchemaTreeView.js";import"./ExpandLess.js";import"./getValidReactChildren.js";import"./Autocomplete.js";const re={...se,searchQuery:"",methodsInclude:[],methodsExclude:[],stabilityInclude:[],stabilityExclude:[]};function ye(){const o=A(),[c,m]=te("routesFilters",re),[i,r]=D(),s=i.get("endpointId"),n=u.useRef({}),h=u.useMemo(()=>({cursorQueryKey:"cursor",getNextPageCursor(e){return e.meta.nextCursor}}),[]),b=_("GET /__rrroutes/endpoints",h),{client:E}=G();E.build(N.byKey["GET /__rrroutes/endpoints"],{});const{data:j,isLoading:C,error:I,refetch:x,isFetching:w,fetchNextPage:v,hasNextPage:k,isFetchingNextPage:F}=b.useEndpoint({query:c}),P=U(I,{messageFallback:"Failed to load endpoints.",refetch:x}),p=O(j,{reverse:!1}),R=y(p,e=>e.tags),S=y(p,e=>e.groupId),T=u.useCallback((e,a)=>{a?n.current[e]=a:delete n.current[e]},[]);u.useEffect(()=>{if(!s)return;const e=n.current[s];e&&e.scrollIntoView({behavior:"smooth",block:"start"})},[s]),u.useEffect(()=>{s&&!p.some(e=>e.id===s)&&r(e=>{const a=new URLSearchParams(e);return a.delete("endpointId"),a},{replace:!0})},[s,p,r]);const z=u.useCallback(e=>{r(a=>{const l=new URLSearchParams(a);return s===e?l.delete("endpointId"):l.set("endpointId",e),l})},[s,r]),L=u.useCallback(e=>{const{displayId:a}=B(e.method,e.path);a&&o(`/routes/${encodeURIComponent(a)}`)},[o]);return t.jsx(ee,{title:"Endpoints",subtitle:"Browse and filter every endpoint registered with this service.",children:t.jsxs(d,{spacing:3,children:[t.jsx(Z,{value:c,onChange:e=>m(a=>({...a,...e})),tagOptions:R,groupOptions:S,onRefresh:()=>x(),refreshing:w,searchOnly:!0}),t.jsx(M,{title:"Endpoints",children:t.jsx(H,{stateHandler:{loading:{variant:"full"},error:P,emptyFallback:{title:"No endpoints found"},isLoading:C},items:p,fetchNextPage:v,hasNextPage:k,isFetchingNextPage:F,pageSize:c.pageSize,children:e=>{const a=ne(e);return t.jsx(d,{spacing:4,children:a.map(l=>t.jsxs(d,{spacing:1.5,children:[t.jsxs(f,{variant:"subtitle2",color:"text.secondary",sx:{textTransform:"capitalize"},children:[l.title," (",l.endpoints.length,")"]}),t.jsx(d,{spacing:1,children:l.endpoints.map(g=>t.jsx(oe,{endpoint:g,expanded:s===g.id,onToggle:z,registerRef:T,onDoubleClick:L},g.id))})]},l.id))})}})})]})})}function oe({endpoint:o,expanded:c,onToggle:m,registerRef:i,onDoubleClick:r}){const s=K();return t.jsxs(Q,{expanded:c,onChange:()=>m(o.id),ref:n=>i(o.id,n),disableGutters:!0,sx:{border:"1px solid",borderColor:c?"primary.main":"divider",borderRadius:2,bgcolor:"background.default","&::before":{display:"none"},overflow:"hidden"},children:[t.jsx(q,{expandIcon:t.jsx(W,{}),sx:{cursor:"pointer",transition:"background-color 200ms ease, transform 200ms ease","&:hover, &:focus-visible":{backgroundColor:J(s.palette.primary.main,.08)}},onDoubleClick:n=>{n.stopPropagation(),r(o)},children:t.jsxs(d,{sx:{width:"100%",height:"100%"},direction:"row",justifyContent:"space-between",children:[t.jsxs(d,{justifyContent:"space-between",children:[t.jsxs(d,{direction:"row",spacing:1,children:[t.jsx(V,{method:o.method}),t.jsx(f,{sx:{fontFamily:"monospace",flexGrow:1},color:"text.primary",children:o.path})]}),o.summary&&t.jsx(f,{variant:"body2",color:"text.secondary",children:o.summary})]}),t.jsxs(d,{direction:"row",spacing:1,alignItems:"center",children:[t.jsx(f,{variant:"caption",color:"text.secondary",sx:{textTransform:"capitalize"},children:o.stability}),o.implemented===!1&&t.jsx($,{label:"Not implemented",size:"small",color:"warning",variant:"outlined"})]})]})}),t.jsx(X,{children:t.jsx(Y,{endpointId:o.id,showHeader:!1})})]})}function ne(o){const c=new Map;return o.forEach(i=>{var n,h;const r=((n=i.groupId)==null?void 0:n.trim())||"ungrouped",s=((h=i.groupId)==null?void 0:h.trim())||"Ungrouped";c.has(r)||c.set(r,{id:r,title:s,endpoints:[]}),c.get(r).endpoints.push(i)}),Array.from(c.values()).map(i=>({...i,endpoints:i.endpoints.sort((r,s)=>{const n=r.path.localeCompare(s.path);return n!==0?n:r.method.localeCompare(s.method)})})).sort((i,r)=>{const s=i.id==="ungrouped"?"zzzz":i.title.toLowerCase(),n=r.id==="ungrouped"?"zzzz":r.title.toLowerCase();return s.localeCompare(n)})}export{ye as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-xyflow.js";import{u as ue,R as K}from"./useQueryState.js";import{h as l,m as pe}from"./vendor-recharts.js";import{I as he,J as xe,aw as F,k as me,U as ye,h as ge,M as ae,N as be,O as fe,T as r,W as je,ax as X,X as ve,x as Ce,ay as we,S as i,j as E,G as Se,az as U,aA as R,aB as re,b as _,e as Y,d as Z,aC as ke,aD as V,C as B,a3 as N,v as Ae,_ as ee}from"./docs.js";import{B as De,a as Le,b as te}from"./BentoGrid.js";import{P as Me,T as $}from"./PageContainer.js";import{D as Fe}from"./filterTypes.js";import{A as Re}from"./Autocomplete.js";import"./ExpandLess.js";function Te(t){return he("MuiLink",t)}const Ie=xe("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]),Ne=({theme:t,ownerState:n})=>{const s=n.color;if("colorSpace"in t&&t.colorSpace){const o=F(t,`palette.${s}.main`)||F(t,`palette.${s}`)||n.color;return t.alpha(o,.4)}const h=F(t,`palette.${s}.main`,!1)||F(t,`palette.${s}`,!1)||n.color,g=F(t,`palette.${s}.mainChannel`)||F(t,`palette.${s}Channel`);return"vars"in t&&g?`rgba(${g} / 0.4)`:me(h,.4)},ne={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Ee=t=>{const{classes:n,component:s,focusVisible:h,underline:g}=t,o={root:["root",`underline${ae(g)}`,s==="button"&&"button",h&&"focusVisible"]};return be(o,Te,n)},Pe=fe(r,{name:"MuiLink",slot:"Root",overridesResolver:(t,n)=>{const{ownerState:s}=t;return[n.root,n[`underline${ae(s.underline)}`],s.component==="button"&&n.button]}})(je(({theme:t})=>({variants:[{props:{underline:"none"},style:{textDecoration:"none"}},{props:{underline:"hover"},style:{textDecoration:"none","&:hover":{textDecoration:"underline"}}},{props:{underline:"always"},style:{textDecoration:"underline","&:hover":{textDecorationColor:"inherit"}}},{props:({underline:n,ownerState:s})=>n==="always"&&s.color!=="inherit",style:{textDecorationColor:"var(--Link-underlineColor)"}},{props:({underline:n,ownerState:s})=>n==="always"&&s.color==="inherit",style:t.colorSpace?{textDecorationColor:t.alpha("currentColor",.4)}:null},...Object.entries(t.palette).filter(ve()).map(([n])=>({props:{underline:"always",color:n},style:{"--Link-underlineColor":t.alpha((t.vars||t).palette[n].main,.4)}})),{props:{underline:"always",color:"textPrimary"},style:{"--Link-underlineColor":t.alpha((t.vars||t).palette.text.primary,.4)}},{props:{underline:"always",color:"textSecondary"},style:{"--Link-underlineColor":t.alpha((t.vars||t).palette.text.secondary,.4)}},{props:{underline:"always",color:"textDisabled"},style:{"--Link-underlineColor":(t.vars||t).palette.text.disabled}},{props:{component:"button"},style:{position:"relative",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none","&::-moz-focus-inner":{borderStyle:"none"},[`&.${Ie.focusVisible}`]:{outline:"auto"}}}]}))),ze=l.forwardRef(function(n,s){const h=ye({props:n,name:"MuiLink"}),g=ge(),{className:o,color:p="primary",component:d="a",onBlur:m,onFocus:b,TypographyClasses:a,underline:y="always",variant:A="inherit",sx:k,...S}=h,[C,x]=l.useState(!1),j=w=>{X(w.target)||x(!1),m&&m(w)},T=w=>{X(w.target)&&x(!0),b&&b(w)},L={...h,color:p,component:d,focusVisible:C,underline:y,variant:A},I=Ee(L);return e.jsx(Pe,{color:p,className:pe(I.root,o),classes:a,component:d,onBlur:j,onFocus:T,ref:s,ownerState:L,variant:A,...S,sx:[...ne[p]===void 0?[{color:p}]:[],...Array.isArray(k)?k:[k]],style:{...S.style,...y==="always"&&p!=="inherit"&&!ne[p]&&{"--Link-underlineColor":Ne({theme:g,ownerState:L})}}})});function Be({open:t,scheduling:n,onClose:s,getStatusColor:h}){if(!n)return null;const{name:g,status:o,description:p,tags:d,groupId:m}=n,b=o??"Unknown",a=h==null?void 0:h(b),{openRequestDetail:y}=Ce(),A=l.useCallback(()=>{m&&y({requestId:m})},[m,y]),k=n.startedAt&&n.completedAt?n.completedAt-n.startedAt:n.startedAt?Math.max(0,Date.now()-n.startedAt):void 0,S=[{label:"Scheduled at",value:n.scheduledAt},{label:"Started at",value:n.startedAt},{label:"Completed at",value:n.completedAt},{label:"Created at",value:n.createdAt},{label:"Updated at",value:n.updatedAt}];return e.jsx(we,{open:t,onClose:s,title:g??n.id,scroll:"paper",children:e.jsxs(i,{spacing:2,children:[e.jsxs(i,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Status"}),e.jsx(E,{label:b,size:"small",variant:"outlined",sx:a?{borderColor:a,color:a}:void 0})]}),p?e.jsxs(Se,{children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Description"}),e.jsx(r,{variant:"body2",children:p})]}):null,e.jsx(U,{}),e.jsxs(i,{spacing:1,children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Timestamps"}),S.map(C=>e.jsxs(i,{direction:"row",justifyContent:"space-between",children:[e.jsx(r,{variant:"body2",color:"text.secondary",children:C.label}),e.jsx(r,{variant:"body2",children:R(C.value)})]},C.label)),k!=null?e.jsxs(i,{direction:"row",justifyContent:"space-between",children:[e.jsx(r,{variant:"body2",color:"text.secondary",children:"Estimated duration"}),e.jsx(r,{variant:"body2",children:re(k)})]}):null]}),e.jsx(U,{}),e.jsxs(i,{spacing:1,children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Identity"}),e.jsxs(i,{direction:"row",spacing:1,children:[e.jsx(r,{variant:"body2",color:"text.secondary",children:"ID:"}),e.jsx(r,{variant:"body2",sx:{fontFamily:"monospace"},children:n.id})]}),m?e.jsxs(i,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(r,{variant:"body2",color:"text.secondary",children:"Group:"}),e.jsx(ze,{component:"button",variant:"body2",onClick:A,sx:{fontFamily:"monospace",textTransform:"none",p:0,fontWeight:500},children:m})]}):null]}),d!=null&&d.length?e.jsxs(e.Fragment,{children:[e.jsx(U,{}),e.jsxs(i,{spacing:1,children:[e.jsx(r,{variant:"subtitle2",color:"text.secondary",children:"Tags"}),e.jsx(i,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:d.map(C=>e.jsx(E,{label:C,size:"small"},C))})]})]}):null]})})}const Oe={...Fe,orderBy:"scheduledAt",orderDirection:"desc",searchQuery:"",statusesInclude:[],statusesExclude:[]},Ue={name:{key:"name",label:"Name",width:2,render:(t,n)=>t??n.id},groupId:{key:"groupId",label:"Group",width:1.5,render:t=>t??"Ungrouped"},scheduledAt:{key:"scheduledAt",label:"Scheduled",width:1.5,render:t=>R(t)},startedAt:{key:"startedAt",label:"Started",width:1.5,render:t=>R(t)},completedAt:{key:"completedAt",label:"Completed",width:1.5,render:t=>R(t)},tags:{key:"tags",label:"Tags",render:t=>t!=null&&t.length?e.jsx(i,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:t.map(n=>e.jsx(E,{label:n,size:"small"},n))}):"—"}};function Ve(t){const n=new Map;let s=0,h=0,g=0,o,p;const d=[];for(const a of t){const y=a.status??"Unknown";n.set(y,(n.get(y)??0)+1),a.startedAt?a.startedAt&&!a.completedAt&&(h+=1):s+=1,a.completedAt&&(g+=1,(!p||(p.completedAt??0)<a.completedAt)&&(p=a)),(!o||(a.scheduledAt??0)>(o.scheduledAt??0))&&(o=a),a.startedAt&&a.completedAt&&d.push(a.completedAt-a.startedAt)}const m=d.length===0?void 0:d.reduce((a,y)=>a+y,0)/d.length,b=Array.from(n.entries()).sort((a,y)=>y[1]-a[1]);return{total:t.length,pending:s,running:h,completed:g,latestScheduled:o,latestCompleted:p,avgDurationMs:m,statusBreakdown:b}}function Ye(){var H,q;const[t,n]=ue("schedulingFilters",Oe),[s,h]=l.useState(null),g=l.useMemo(()=>({cursorQueryKey:"cursor",getNextPageCursor(u){var f;return(f=u.meta)==null?void 0:f.nextCursor}}),[]),o=_("GET /__rrroutes/schedulings",g),{data:p,error:d,refetch:m,isFetching:b,isLoading:a,fetchNextPage:y,hasNextPage:A,isFetchingNextPage:k}=o.useEndpoint({query:t}),S=Y(p,{reverse:!0}),C=Z(d,{messageFallback:"Failed to load scheduled runs.",refetch:m}),x=l.useMemo(()=>Ve(S),[S]),j=l.useMemo(()=>({cursorQueryKey:"cursor",getNextPageCursor(u){var f;return(f=u.meta)==null?void 0:f.nextCursor}}),[]),T=_("GET /__rrroutes/schedulings/handlers",j),{data:L,error:I,refetch:w,isFetching:c}=T.useEndpoint({query:{pageSize:100}}),v=Y(L),D=Z(I,{messageFallback:"Failed to load handler metadata.",refetch:w}),P=ke.useRegistry(),W=l.useMemo(()=>{const u=new Map;return P.forEach(f=>{var Q,J;const M=(Q=f.value)==null?void 0:Q.trim();if(!M)return;const z=((J=f.color)==null?void 0:J.trim())||V(M);u.set(M,z)}),u},[P]),O=l.useCallback(u=>{const f=(u??"Unknown").trim();return f?W.get(f)??V(f):V("status")},[W]),le=l.useMemo(()=>({...Ue,status:{key:"status",label:"Status",width:1,render:f=>{const M=f??"Unknown",z=O(M);return e.jsx(E,{label:M,size:"small",variant:"outlined",sx:{borderColor:z,color:z}})}}}),[O]),oe=l.useCallback(u=>{h(u)},[]),ie=l.useCallback(()=>{h(null)},[]),G=l.useCallback(()=>{m(),w()},[m,w]),ce=e.jsxs(i,{spacing:3,children:[e.jsx(B,{title:"Overview",children:e.jsxs(i,{spacing:2,children:[x.statusBreakdown.length?e.jsx(i,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:x.statusBreakdown.map(([u,f])=>e.jsx(E,{label:`${u} (${f})`,size:"small",variant:"outlined"},u))}):e.jsx(r,{variant:"body2",color:"text.secondary",children:"No runs have been scheduled yet."}),e.jsxs(i,{direction:{xs:"column",sm:"row"},spacing:2,flexWrap:"wrap",children:[e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Total runs: ",x.total]}),e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Pending: ",x.pending]}),e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Running: ",x.running]}),e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Completed: ",x.completed]})]}),e.jsxs(i,{direction:{xs:"column",sm:"row"},spacing:2,flexWrap:"wrap",children:[e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Last scheduled:"," ",R((H=x.latestScheduled)==null?void 0:H.scheduledAt)]}),e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Last completed:"," ",R((q=x.latestCompleted)==null?void 0:q.completedAt)]})]}),x.avgDurationMs!=null?e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Average duration: ",re(x.avgDurationMs)]}):null]})}),e.jsx(B,{title:"Handlers",actions:e.jsx(N,{component:"div",startIcon:e.jsx(K,{fontSize:"small"}),size:"small",onClick:()=>w(),children:"Refresh handlers"}),children:e.jsxs(i,{spacing:2,children:[e.jsxs(r,{variant:"body2",color:"text.secondary",children:[v.length," handler",v.length===1?"":"s"," registered",c?" • Updating...":""]}),D?e.jsxs(i,{spacing:1,children:[e.jsx(r,{variant:"body2",color:"error",children:D.message}),D.onRetry?e.jsx(N,{size:"small",variant:"outlined",onClick:D.onRetry,children:"Retry"}):null]}):null,!v.length&&!D?e.jsx(r,{variant:"body2",color:"text.secondary",children:"No handler metadata available yet."}):null,v.length?e.jsx(i,{spacing:2,children:v.map(u=>e.jsxs(i,{spacing:.5,children:[e.jsx(r,{variant:"subtitle2",children:u.name}),e.jsx(r,{variant:"body2",component:"pre",sx:{margin:0,whiteSpace:"pre-wrap",fontFamily:"monospace",color:"text.secondary"},children:u.payload})]},`${u.name}-${u.payload}`))}):null]})}),e.jsx(B,{title:"Scheduled runs",children:e.jsx(Ae,{columns:le,query:t,setQuery:n,endpoint:{data:p,fetchNextPage:y,hasNextPage:A,isFetchingNextPage:k},rowKey:u=>u.id,onRowClick:oe,size:"medium",stateHandler:{loading:{variant:"full"},isLoading:a||b,error:C,emptyFallback:{title:"No scheduled runs available",description:"Schedule a job to see it listed here."}}})})]}),de=e.jsx(i,{spacing:3,children:e.jsx(B,{title:"Manual scheduling",children:e.jsx($e,{handlers:v,isFetchingHandlers:c,onRefreshHandlers:w,onScheduled:G})})});return e.jsxs(Me,{title:"Scheduling",subtitle:"Review scheduled jobs, their progress, and the handlers that can run them.",actions:e.jsx(N,{startIcon:e.jsx(K,{fontSize:"small"}),onClick:G,size:"small",children:"Refresh all"}),children:[e.jsx(De,{children:e.jsxs(Le,{sizes:[8,4],children:[e.jsx(te,{title:"Live",children:ce}),e.jsx(te,{title:"Manual Schedule",children:de})]})}),e.jsx(Be,{open:!!s,scheduling:s,onClose:ie,getStatusColor:O})]})}function $e({handlers:t,isFetchingHandlers:n,onRefreshHandlers:s,onScheduled:h}){const g=_("POST /__rrroutes/schedulings/handlers"),[o,p]=l.useState(null),[d,m]=l.useState(""),[b,a]=l.useState(()=>se(new Date)),[y,A]=l.useState(!1),[k,S]=l.useState(null),[C,x]=l.useState(null),j=l.useMemo(()=>t.find(c=>c.name===o)??null,[t,o]),T=l.useMemo(()=>{const c=new Date(b);return b!==""&&!Number.isNaN(c.getTime())},[b]);l.useEffect(()=>{j&&m(j.payload??"")},[j==null?void 0:j.name,j==null?void 0:j.payload]),l.useEffect(()=>{o&&!t.some(c=>c.name===o)&&p(null)},[t,o]);const L=l.useCallback(async()=>{if(!o){S("Pick a handler before scheduling."),x(null);return}const c=new Date(b);if(Number.isNaN(c.getTime())){S("Enter a valid run time."),x(null);return}const v=!d.trim()||d.trim()===""?"":(()=>{try{return JSON.parse(d)}catch{return d}})();A(!0),S(null),x(null);try{await g.fetch({name:o,payload:v,runAt:c}),x("Handler scheduled successfully."),a(se(new Date)),h()}catch(D){const P=D instanceof Error?D.message:"Failed to schedule handler.";S(P)}finally{A(!1)}},[g,h,d,b,o]),I=l.useCallback(c=>{m(c.target.value)},[]),w=l.useCallback(c=>{a(c.target.value)},[]);return e.jsxs(i,{spacing:2,children:[e.jsxs(i,{direction:{xs:"column",sm:"row"},alignItems:"center",justifyContent:"space-between",spacing:2,children:[e.jsx(r,{variant:"subtitle1",children:"Schedule a handler manually"}),e.jsx(N,{size:"small",variant:"outlined",onClick:s,disabled:n,children:"Refresh handlers"})]}),e.jsx(Re,{options:t,getOptionLabel:c=>c.name,isOptionEqualToValue:(c,v)=>c.name===v.name,value:j,onChange:(c,v)=>p((v==null?void 0:v.name)??null),renderInput:c=>e.jsx($,{...c,label:"Handler",placeholder:t.length?"Pick a handler":"No handlers registered",helperText:t.length?"Select the handler you want to execute.":"No handlers currently available."})}),e.jsx($,{label:"Payload",multiline:!0,minRows:4,fullWidth:!0,value:d,onChange:I,helperText:"Valid JSON will be parsed; plain text is preserved."}),e.jsx($,{label:"Run at",type:"datetime-local",fullWidth:!0,value:b,onChange:w,InputLabelProps:{shrink:!0},helperText:"Schedule when the handler should run."}),k?e.jsx(ee,{severity:"error",children:k}):null,C?e.jsx(ee,{severity:"success",children:C}):null,e.jsx(N,{variant:"contained",onClick:L,disabled:!j||y||!T||!t.length,children:y?"Scheduling…":"Schedule handler"})]})}function se(t){const n=t.getTimezoneOffset();return new Date(t.getTime()-n*6e4).toISOString().slice(0,16)}export{Ye as default};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-xyflow.js";import{E}from"./ExpandLess.js";import{I as U,J as H,U as A,ai as D,aj as J,M as s,N as X,O as q,W as K,X as T,S as b,T as f,a1 as R,E as G,G as N}from"./docs.js";import{h as j,m as Q}from"./vendor-recharts.js";import{g as Y}from"./getValidReactChildren.js";function Z(t){return U("MuiButtonGroup",t)}const o=H("MuiButtonGroup",["root","contained","outlined","text","disableElevation","disabled","firstButton","fullWidth","horizontal","vertical","colorPrimary","colorSecondary","grouped","groupedHorizontal","groupedVertical","groupedText","groupedTextHorizontal","groupedTextVertical","groupedTextPrimary","groupedTextSecondary","groupedOutlined","groupedOutlinedHorizontal","groupedOutlinedVertical","groupedOutlinedPrimary","groupedOutlinedSecondary","groupedContained","groupedContainedHorizontal","groupedContainedVertical","groupedContainedPrimary","groupedContainedSecondary","lastButton","middleButton"]),_=(t,r)=>{const{ownerState:n}=t;return[{[`& .${o.grouped}`]:r.grouped},{[`& .${o.grouped}`]:r[`grouped${s(n.orientation)}`]},{[`& .${o.grouped}`]:r[`grouped${s(n.variant)}`]},{[`& .${o.grouped}`]:r[`grouped${s(n.variant)}${s(n.orientation)}`]},{[`& .${o.grouped}`]:r[`grouped${s(n.variant)}${s(n.color)}`]},{[`& .${o.firstButton}`]:r.firstButton},{[`& .${o.lastButton}`]:r.lastButton},{[`& .${o.middleButton}`]:r.middleButton},r.root,r[n.variant],n.disableElevation===!0&&r.disableElevation,n.fullWidth&&r.fullWidth,n.orientation==="vertical"&&r.vertical]},tt=t=>{const{classes:r,color:n,disabled:i,disableElevation:a,fullWidth:l,orientation:d,variant:u}=t,p={root:["root",u,d,l&&"fullWidth",a&&"disableElevation",`color${s(n)}`],grouped:["grouped",`grouped${s(d)}`,`grouped${s(u)}`,`grouped${s(u)}${s(d)}`,`grouped${s(u)}${s(n)}`,i&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return X(p,Z,r)},ot=q("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:_})(K(({theme:t})=>({display:"inline-flex",borderRadius:(t.vars||t).shape.borderRadius,variants:[{props:{variant:"contained"},style:{boxShadow:(t.vars||t).shadows[2],[`& .${o.grouped}`]:{boxShadow:"none","&:hover":{boxShadow:"none"}}}},{props:{disableElevation:!0},style:{boxShadow:"none"}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{orientation:"vertical"},style:{flexDirection:"column",[`& .${o.lastButton},& .${o.middleButton}`]:{borderTopRightRadius:0,borderTopLeftRadius:0},[`& .${o.firstButton},& .${o.middleButton}`]:{borderBottomRightRadius:0,borderBottomLeftRadius:0}}},{props:{orientation:"horizontal"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${o.lastButton},& .${o.middleButton}`]:{borderTopLeftRadius:0,borderBottomLeftRadius:0}}},{props:{variant:"text",orientation:"horizontal"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderRight:t.vars?`1px solid ${t.alpha(t.vars.palette.common.onBackground,.23)}`:`1px solid ${t.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${o.disabled}`]:{borderRight:`1px solid ${(t.vars||t).palette.action.disabled}`}}}},{props:{variant:"text",orientation:"vertical"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderBottom:t.vars?`1px solid ${t.alpha(t.vars.palette.common.onBackground,.23)}`:`1px solid ${t.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${o.disabled}`]:{borderBottom:`1px solid ${(t.vars||t).palette.action.disabled}`}}}},...Object.entries(t.palette).filter(T()).flatMap(([r])=>[{props:{variant:"text",color:r},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderColor:t.alpha((t.vars||t).palette[r].main,.5)}}}]),{props:{variant:"outlined",orientation:"horizontal"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderRightColor:"transparent","&:hover":{borderRightColor:"currentColor"}},[`& .${o.lastButton},& .${o.middleButton}`]:{marginLeft:-1}}},{props:{variant:"outlined",orientation:"vertical"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderBottomColor:"transparent","&:hover":{borderBottomColor:"currentColor"}},[`& .${o.lastButton},& .${o.middleButton}`]:{marginTop:-1}}},{props:{variant:"contained",orientation:"horizontal"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderRight:`1px solid ${(t.vars||t).palette.grey[400]}`,[`&.${o.disabled}`]:{borderRight:`1px solid ${(t.vars||t).palette.action.disabled}`}}}},{props:{variant:"contained",orientation:"vertical"},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderBottom:`1px solid ${(t.vars||t).palette.grey[400]}`,[`&.${o.disabled}`]:{borderBottom:`1px solid ${(t.vars||t).palette.action.disabled}`}}}},...Object.entries(t.palette).filter(T(["dark"])).map(([r])=>({props:{variant:"contained",color:r},style:{[`& .${o.firstButton},& .${o.middleButton}`]:{borderColor:(t.vars||t).palette[r].dark}}}))],[`& .${o.grouped}`]:{minWidth:40}}))),rt=j.forwardRef(function(r,n){const i=A({props:r,name:"MuiButtonGroup"}),{children:a,className:l,color:d="primary",component:u="div",disabled:p=!1,disableElevation:c=!1,disableFocusRipple:g=!1,disableRipple:x=!1,fullWidth:m=!1,orientation:v="horizontal",size:h="medium",variant:C="outlined",...P}=i,S={...i,color:d,component:u,disabled:p,disableElevation:c,disableFocusRipple:g,disableRipple:x,fullWidth:m,orientation:v,size:h,variant:C},B=tt(S),V=j.useMemo(()=>({className:B.grouped,color:d,disabled:p,disableElevation:c,disableFocusRipple:g,disableRipple:x,fullWidth:m,size:h,variant:C}),[d,p,c,g,x,m,h,C,B.grouped]),w=Y(a),I=w.length,F=y=>{const $=y===0,z=y===I-1;return $&&z?"":$?B.firstButton:z?B.lastButton:B.middleButton};return e.jsx(ot,{as:u,role:"group",className:Q(B.root,l),ref:n,ownerState:S,...P,children:e.jsx(D.Provider,{value:V,children:w.map((y,$)=>e.jsx(J.Provider,{value:F($),children:y},$))})})});function dt({schema:t,title:r}){const[n,i]=j.useReducer((a,l)=>{if(!t)return a;switch(l.type){case"toggle":return{...a,[l.path]:l.value!==void 0?l.value:!a[l.path]};case"setAll":{const d={},u=(p,c)=>{M(p)&&(d[c]=l.value),L(p,c).forEach(({schema:g,path:x})=>u(g,x))};return u(t,"root"),d}default:return a}},{});return t?e.jsxs(b,{spacing:1,children:[e.jsxs(b,{direction:"row",spacing:1,alignItems:"center",children:[r&&e.jsx(f,{variant:"subtitle2",color:"text.primary",children:r}),t.kind!=="unknown"&&e.jsxs(rt,{size:"small",children:[e.jsx(R,{onClick:()=>i({type:"setAll",value:!0}),title:"Collapse all",size:"small",color:"primary",children:e.jsx(E,{})}),e.jsx(R,{onClick:()=>i({type:"setAll",value:!1}),title:"Expand all",size:"small",color:"primary",children:e.jsx(G,{})})]})]}),e.jsx(et,{schema:t,collapsed:n,dispatch:i})]}):e.jsxs(b,{spacing:.5,children:[r&&e.jsx(f,{variant:"subtitle2",color:"text.primary",children:r}),e.jsx(f,{variant:"body2",color:"text.secondary",children:"No schema provided."})]})}function et({schema:t,collapsed:r,dispatch:n}){const i=(a,l)=>{n({type:"toggle",path:a,value:l})};return e.jsx(b,{spacing:1,direction:"row",children:e.jsx(W,{schema:t,path:"root",depth:0,collapsed:r,toggle:i})})}function W({schema:t,path:r,depth:n,collapsed:i,toggle:a,propertyName:l}){const d=O(t),u=t.optional||t.nullable,p=j.useMemo(()=>L(t,r),[t,r]),c=M(t),g=i[r];return e.jsx(N,{sx:{borderLeft:n?"1px solid":"none",borderColor:"rgba(255,255,255,0.08)",pl:n?2:0,ml:n?1:0,py:.75},children:e.jsxs(b,{spacing:.25,children:[e.jsxs(b,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",children:[c&&e.jsx(R,{size:"small",onClick:()=>a(r),sx:{p:.25},children:g?e.jsx(G,{fontSize:"small"}):e.jsx(E,{fontSize:"small"})}),l&&e.jsx(f,{variant:"body2",sx:{fontFamily:"monospace",color:"text.primary"},children:l}),e.jsx(f,{variant:"body2",color:"text.secondary",children:d}),u&&e.jsxs(b,{direction:"row",spacing:.5,useFlexGap:!0,flexWrap:"wrap",children:[t.optional&&e.jsx(k,{label:"optional"}),t.nullable&&e.jsx(k,{label:"nullable"})]})]}),t.description&&e.jsx(f,{variant:"caption",color:"text.secondary",children:t.description}),!g&&p.map(({schema:x,propertyName:m,path:v})=>e.jsx(W,{schema:x,propertyName:m,path:v,depth:n+1,collapsed:i,toggle:a},v))]})})}function L(t,r){var n;switch(t.kind){case"object":return t.properties?Object.entries(t.properties).map(([i,a])=>({schema:a,propertyName:i,path:`${r}.${i}`})):[];case"array":return t.element?[{schema:t.element,propertyName:"items",path:`${r}.items`}]:[];case"union":return((n=t.union)==null?void 0:n.map((i,a)=>({schema:i,propertyName:`option ${a+1}`,path:`${r}.option${a+1}`})))??[];default:return[]}}function M(t){return["object","array","union"].includes(t.kind)}function O(t){switch(t.kind){case"object":return"object";case"array":return`array<${t.element?O(t.element):"unknown"}>`;case"enum":return"enum";case"union":return"union";case"literal":return"literal";default:return t.kind}}function k({label:t}){return e.jsx(N,{component:"span",sx:{border:"1px solid",borderColor:"divider",borderRadius:1,px:.75,py:.25,fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:.5,color:"text.secondary"},children:t})}export{dt as S};
@@ -0,0 +1 @@
1
+ import{j as r}from"./vendor-xyflow.js";import{S as p,T as j,a1 as z,a3 as B,au as U,av as G,aH as M,aC as W,aZ as H,A as Z,i as _,E as Q,m as X,aD as Y}from"./docs.js";import{T as L,P as $}from"./PageContainer.js";import{A as K}from"./Add.js";import{D as ee}from"./DeleteOutline.js";import{h}from"./vendor-recharts.js";function x({registry:t,formatItem:s,parseItem:o,description:i,itemPlaceholder:c="Value",addLabel:m="Add value",addPlaceholder:g="New value",emptyMessage:D="No entries yet.",getItemKey:b}){const S=t.useRegistry(),y=h.useMemo(()=>S.map(e=>s(e)),[S,s]),[F,A]=h.useState(y),[O,J]=h.useState({}),[w,R]=h.useState(""),[N,I]=h.useState(void 0),P=h.useRef(y);h.useEffect(()=>{A(e=>{const n=y.map((a,d)=>{const f=P.current[d],u=e[d];return u==null||f!==void 0&&u===f?a:u});return e.length===n.length&&e.every((a,d)=>a===n[d])?e:n}),J(e=>{const n={};Object.keys(e).forEach(f=>{const u=Number(f);Number.isNaN(u)||u<y.length&&(n[u]=e[u])});const l=Object.keys(e),a=Object.keys(n);return l.length===a.length&&l.every(f=>e[f]===n[Number(f)])?e:n}),P.current=y},[y]);const T=(e,n)=>{J(l=>{const a={...l};return n?a[e]=n:delete a[e],a})},V=(e,n)=>{A(a=>{const d=[...a];return d[e]=n,d});const l=o(n);if("error"in l){T(e,l.error);return}T(e),t.setState(a=>{if(e>=a.length)return a;const d=[...a];return d[e]=l.value,d})},q=e=>{t.setState(n=>n.filter((l,a)=>a!==e))},k=()=>{const e=o(w);if("error"in e){I(e.error);return}I(void 0),t.setState(n=>[...n,e.value]),R("")};return r.jsxs(p,{spacing:2,children:[i?r.jsx(j,{variant:"body2",color:"text.secondary",children:i}):null,r.jsxs(p,{spacing:1.5,children:[S.length===0?r.jsx(j,{variant:"body2",color:"text.secondary",children:D}):null,S.map((e,n)=>{const l=(b==null?void 0:b(e,n))??String(n);return r.jsxs(p,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:{xs:"stretch",sm:"center"},children:[r.jsx(L,{label:c,value:F[n]??"",onChange:a=>V(n,a.target.value),size:"small",error:!!O[n],helperText:O[n]??" ",fullWidth:!0}),r.jsx(z,{onClick:()=>q(n),children:r.jsx(ee,{})})]},l)})]}),r.jsxs(p,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:{xs:"stretch",sm:"center"},children:[r.jsx(L,{label:g,value:w,onChange:e=>{R(e.target.value),N&&I(void 0)},onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),k())},size:"small",error:!!N,helperText:N??" ",fullWidth:!0}),r.jsx(B,{variant:"outlined",startIcon:r.jsx(K,{}),onClick:k,children:m})]})]})}const re=t=>String(t),te=t=>t,C=t=>JSON.stringify(t),se=t=>{const s=t.trim();return s?{value:s}:{error:"Value is required."}},ne=t=>{const s=t.trim();if(!s)return{error:"Value is required."};const o=Number(s);return!Number.isFinite(o)||!Number.isInteger(o)?{error:"Enter a whole number."}:{value:o}},E=t=>{const s=t.trim();if(!s)return{error:"Value is required."};try{return{value:JSON.parse(s)}}catch{return{error:"Invalid JSON."}}},oe=t=>{const s=E(t);if("error"in s)return s;const o=s.value;if(!o||typeof o!="object"||Array.isArray(o))return{error:"Expected a JSON object."};const{encodedId:i,path:c,method:m,displayId:g}=o;return typeof i!="string"||typeof c!="string"||typeof m!="string"||typeof g!="string"?{error:"Fields required: encodedId, path, method, displayId."}:{value:{encodedId:i.trim(),path:c.trim(),method:m.trim(),displayId:g.trim()}}},ae=t=>{const s=E(t);if("error"in s)return s;const o=s.value;if(!o||typeof o!="object"||Array.isArray(o))return{error:"Expected a JSON object."};const{color:i,value:c}=o;return typeof i!="string"||typeof c!="string"?{error:"Fields required: value, color."}:{value:{color:i.trim(),value:c.trim()}}},ie=t=>JSON.stringify(t),le=t=>{const s=E(t);if("error"in s)return s;const o=s.value;if(!o||typeof o!="object"||Array.isArray(o))return{error:"Expected a JSON object."};const{value:i,color:c}=o;if(typeof i!="string"||!i.trim())return{error:"Field required: value."};const m=i.trim(),g=typeof c=="string"&&c.trim()?c.trim():Y(m);return{value:{value:m,color:g}}};function pe(){return r.jsx($,{title:"Settings",subtitle:"Manage the saved registry values used across filters and logs.",children:r.jsxs(p,{spacing:3,children:[r.jsx(v,{title:"Status codes",description:"Status codes available in history filters.",children:r.jsx(x,{registry:U,formatItem:re,parseItem:ne,itemPlaceholder:"Status code",addPlaceholder:"New status code",addLabel:"Add status"})}),r.jsx(v,{title:"Endpoints",description:'Use JSON like {"encodedId":"GET /users","path":"/users","method":"GET","displayId":"GET /users"}',children:r.jsx(x,{registry:G,formatItem:C,parseItem:oe,itemPlaceholder:"Endpoint JSON",addPlaceholder:"New endpoint JSON",addLabel:"Add endpoint"})}),r.jsx(v,{title:"Log levels",description:'Use JSON like {"value":"info","color":"#42a5f5"}',children:r.jsx(x,{registry:M,formatItem:C,parseItem:ae,itemPlaceholder:"Level JSON",addPlaceholder:"New level JSON",addLabel:"Add level"})}),r.jsx(v,{title:"Scheduling statuses",description:'Use JSON like {"value":"running","color":"#f48fb1"} (color optional)',children:r.jsx(x,{registry:W,formatItem:ie,parseItem:le,itemPlaceholder:"Status JSON",addPlaceholder:'{"value":"running"}',addLabel:"Add status"})}),r.jsx(v,{title:"Endpoint tags",description:"Tags available in history filters.",children:r.jsx(x,{registry:H,formatItem:te,parseItem:se,itemPlaceholder:"Tag",addPlaceholder:"New tag",addLabel:"Add tag"})})]})})}function v({title:t,description:s,children:o,defaultExpanded:i=!1}){return r.jsxs(Z,{defaultExpanded:i,children:[r.jsx(_,{expandIcon:r.jsx(Q,{}),children:r.jsxs(p,{spacing:.25,children:[r.jsx(j,{variant:"subtitle1",fontWeight:600,children:t}),s?r.jsx(j,{variant:"body2",color:"text.secondary",children:s}):null]})}),r.jsx(X,{children:r.jsx(p,{spacing:2,sx:{width:"100%"},children:o})})]})}export{pe as default};