@w6w/ui 0.2.60 → 0.2.63

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 (50) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/AddConnectionModal.d.ts +7 -6
  3. package/dist/{CodeBlock-CPKXSNEs.js → CodeBlock-Bp0SGY1m.js} +82 -57
  4. package/dist/{CodeBlock-CPKXSNEs.js.map → CodeBlock-Bp0SGY1m.js.map} +1 -1
  5. package/dist/{CodeBlock-BSX1pi6W.cjs → CodeBlock-a2aIm-0b.cjs} +5 -5
  6. package/dist/{CodeBlock-BSX1pi6W.cjs.map → CodeBlock-a2aIm-0b.cjs.map} +1 -1
  7. package/dist/EditConnectionModal.d.ts +1 -1
  8. package/dist/code.cjs +1 -1
  9. package/dist/code.mjs +1 -1
  10. package/dist/components/CallableBindingSetup.d.ts +15 -0
  11. package/dist/components/ConnectionList.d.ts +1 -1
  12. package/dist/components/CredentialPicker.d.ts +15 -6
  13. package/dist/components/DataStoreList.d.ts +1 -1
  14. package/dist/components/DataTable.d.ts +6 -0
  15. package/dist/components/ExpressionOptions.d.ts +8 -0
  16. package/dist/components/IconButton.d.ts +4 -0
  17. package/dist/components/RunCallable.d.ts +52 -0
  18. package/dist/components/expression-authoring.d.ts +3 -2
  19. package/dist/components/expression-dom.d.ts +30 -0
  20. package/dist/components/icons.d.ts +1 -1
  21. package/dist/{connection-app-meta-CEkQSIlc.js → connection-app-meta-HBKXI0nk.js} +5682 -5100
  22. package/dist/connection-app-meta-HBKXI0nk.js.map +1 -0
  23. package/dist/connection-app-meta-pnATcKeZ.cjs +26 -0
  24. package/dist/connection-app-meta-pnATcKeZ.cjs.map +1 -0
  25. package/dist/credentialLinkContext.d.ts +8 -0
  26. package/dist/flow-loop.d.ts +7 -2
  27. package/dist/flow-types.d.ts +12 -0
  28. package/dist/flow.cjs +5 -5
  29. package/dist/flow.cjs.map +1 -1
  30. package/dist/flow.mjs +1270 -1208
  31. package/dist/flow.mjs.map +1 -1
  32. package/dist/index.cjs +2 -2
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.ts +6 -1
  35. package/dist/index.mjs +1787 -1408
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/provider.d.ts +34 -0
  38. package/dist/resolve-params.d.ts +4 -0
  39. package/dist/run-callable.d.ts +50 -0
  40. package/dist/step-preview-state.d.ts +13 -7
  41. package/dist/types.d.ts +10 -0
  42. package/package.json +2 -2
  43. package/src/styles/_connections.scss +1 -0
  44. package/src/styles/_data-stores.scss +26 -3
  45. package/src/styles/_data-table.scss +38 -1
  46. package/src/styles/_tester.scss +8 -0
  47. package/src/styles.css +84 -4
  48. package/dist/connection-app-meta-BXCIgekK.cjs +0 -24
  49. package/dist/connection-app-meta-BXCIgekK.cjs.map +0 -1
  50. package/dist/connection-app-meta-CEkQSIlc.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use client";"use strict";var Ss=Object.defineProperty;var Es=(t,s,n)=>s in t?Ss(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var je=(t,s,n)=>Es(t,typeof s!="symbol"?s+"":s,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./connection-app-meta-BXCIgekK.cjs"),e=require("react/jsx-runtime"),y=require("react"),L=require("./CodeBlock-BSX1pi6W.cjs"),Ts=require("@codemirror/lang-yaml"),$s=require("@codemirror/view"),As=require("@uiw/react-codemirror");class ce extends Error{constructor(n,a,i,r){super(i);je(this,"status");je(this,"code");je(this,"body");this.name="ApiError",this.status=n,this.code=a,this.body=r}}function Rs(t){const s=t.baseUrl.replace(/\/$/,""),n=t.fetch??globalThis.fetch,a=async()=>typeof t.token=="function"?await t.token():t.token;async function i(l,o){const c=new Headers(o==null?void 0:o.headers),d=await a();d&&c.set("authorization",`Bearer ${d}`),o!=null&&o.body&&!c.has("content-type")&&c.set("content-type","application/json");let x;try{x=await n(`${s}${l}`,{...o,headers:c})}catch(u){throw new ce(0,"network_error",`Could not reach the w6w server (${(o==null?void 0:o.method)??"GET"} ${s}${l}). It may be down or unreachable. (${u.message})`)}const f=await x.text();let g=null;if(f)try{g=JSON.parse(f)}catch{if(!x.ok)throw new ce(x.status,"bad_response",`Server returned a non-JSON ${x.status} response: ${f.slice(0,200)}`)}if(!x.ok){const u=(g==null?void 0:g.error)??{};throw new ce(x.status,u.code??"error",u.message??x.statusText,g)}return{status:x.status,data:g}}async function r(l,o){const{data:c}=await i(l,o);return c}return{listApps:async()=>{const l=async()=>{const o=[];let c;for(;;){const d=new URLSearchParams({limit:"200"});c&&d.set("cursor",c);const x=await r(`/apps?${d}`);if(o.push(...x.apps),!x.nextCursor||x.nextCursor===c)return o;c=x.nextCursor}};try{return await l()}catch(o){if(o instanceof ce&&(o.code==="snapshot_expired"||o.code==="unknown_snapshot"))return await l();throw o}},listAppsByIds:async l=>{const o=Array.from(new Set(l)),c=[];for(let d=0;d<o.length;d+=100){const f=o.slice(d,d+100).map(encodeURIComponent).join(","),g=await r(`/apps?ids=${f}`);c.push(...g.apps)}return c},getAppAuth:async l=>(await r(`/apps/${encodeURIComponent(l)}/auths`)).auths??[],createConnection:(l,o)=>r(`/apps/${encodeURIComponent(l)}/connections`,{method:"POST",body:JSON.stringify(o)}).then(c=>c.connection),updateConnection:(l,o)=>r(`/connections/${encodeURIComponent(l)}`,{method:"PATCH",body:JSON.stringify(o)}).then(c=>c.connection),listCredentials:l=>{const o=new URLSearchParams;(l==null?void 0:l.contract)!==void 0&&o.set("contract",l.contract),(l==null?void 0:l.appId)!==void 0&&o.set("appId",l.appId),(l==null?void 0:l.authKey)!==void 0&&o.set("authKey",l.authKey);const c=o.toString();return r(`/credentials${c?`?${c}`:""}`).then(d=>d.credentials??[])},createCredential:l=>r("/credentials",{method:"POST",body:JSON.stringify(l)}).then(o=>o.credential),getCredential:l=>r(`/credentials/${encodeURIComponent(l)}`).then(o=>o.credential),rotateCredential:(l,o)=>r(`/credentials/${encodeURIComponent(l)}/rotate`,{method:"POST",body:JSON.stringify(o)}).then(c=>c.credential),setCredentialStatus:(l,o)=>r(`/credentials/${encodeURIComponent(l)}/${o==="disabled"?"disable":"enable"}`,{method:"POST"}).then(c=>c.credential),testCredential:l=>r(`/credentials/${encodeURIComponent(l)}/test`,{method:"POST"}),credentialDependents:l=>r(`/credentials/${encodeURIComponent(l)}/dependents`).then(o=>o.dependents),deleteCredential:async l=>{await r(`/credentials/${encodeURIComponent(l)}`,{method:"DELETE"})},startAppOAuthFlow:(l,o,c)=>r(`/apps/${encodeURIComponent(l)}/oauth-config/${encodeURIComponent(o)}/authorize-url`,{method:"POST",body:JSON.stringify(c)}),getAppActions:l=>r(`/apps/${encodeURIComponent(l)}`).then(o=>o.actions??[]),listConnectionsForApp:l=>r(`/apps/${encodeURIComponent(l)}/connections`).then(o=>o.connections??[]),listConnections:()=>r("/connections").then(l=>l.connections??[]),invokeAction:(l,o,c,d={})=>r(`/apps/${encodeURIComponent(l)}/actions/${encodeURIComponent(o)}/invoke`,{method:"POST",body:JSON.stringify({params:c,connectionId:d.connectionId,project:d.project,state:d.state,workflowId:d.workflowId})}),listSavedTests:l=>r(`/connections/${encodeURIComponent(l)}/saved-tests`).then(o=>o.savedTests??[]),createSavedTest:(l,o)=>r(`/connections/${encodeURIComponent(l)}/saved-tests`,{method:"POST",body:JSON.stringify(o)}).then(c=>c.savedTest),updateSavedTest:(l,o,c)=>r(`/connections/${encodeURIComponent(l)}/saved-tests/${encodeURIComponent(o)}`,{method:"PATCH",body:JSON.stringify(c)}).then(d=>d.savedTest),deleteSavedTest:(l,o)=>r(`/connections/${encodeURIComponent(l)}/saved-tests/${encodeURIComponent(o)}`,{method:"DELETE"}).then(()=>{}),recordTestRun:(l,o)=>r(`/connections/${encodeURIComponent(l)}/test-runs`,{method:"POST",body:JSON.stringify(o)}).then(()=>{}),listTestRuns:l=>r(`/connections/${encodeURIComponent(l)}/test-runs`).then(o=>o.runs??[]),saveStepTest:(l,o,c)=>r(`/workflows/${encodeURIComponent(l)}/steps/${encodeURIComponent(o)}/tests`,{method:"POST",body:JSON.stringify(c)}).then(d=>d.stepTest),listStepTests:(l,o)=>r(`/workflows/${encodeURIComponent(l)}/steps/${encodeURIComponent(o)}/tests`).then(c=>c.stepTests??[]),loadNodeSamples:l=>r(`/workflows/${encodeURIComponent(l)}/node-samples`).then(o=>o.nodeSamples??[]),loadTestInputs:l=>r(`/workflows/${encodeURIComponent(l)}/test-inputs`).then(o=>o.testInputs??[]),saveTestInput:(l,o,c)=>r(`/workflows/${encodeURIComponent(l)}/nodes/${encodeURIComponent(o)}/test-input`,{method:"PUT",body:JSON.stringify({input:c})}).then(()=>{}),recordStepTestRun:(l,o,c)=>r(`/workflows/${encodeURIComponent(l)}/steps/${encodeURIComponent(o)}/test-runs`,{method:"POST",body:JSON.stringify(c)}).then(()=>{}),listFunctions:()=>r("/functions").then(l=>l.functions??[]),getFunction:l=>r(`/functions/${encodeURIComponent(l)}`).then(o=>({...o.function,valid:o.valid})),invokeFunction:(l,o)=>r(`/functions/${encodeURIComponent(l)}/invoke`,{method:"POST",body:JSON.stringify({inputs:o})}).then(c=>c.output),listWorkflows:()=>r("/workflows").then(l=>l.workflows??[]),getWorkflow:l=>r(`/workflows/${encodeURIComponent(l)}`).then(o=>o.workflow),runWorkflow:(l,o={})=>i(`/workflows/${encodeURIComponent(l)}/run?wait=true`,{method:"POST",body:JSON.stringify({variables:o.variables,input:o.input,entry:o.entry})}).then(({status:c,data:d})=>({...d??{},terminal:c===200}))}}function be({title:t,subtitle:s,icon:n,trailing:a,active:i=!1,onClick:r,href:l,ariaLabel:o}){const c=e.jsxs(e.Fragment,{children:[n!=null&&e.jsx("span",{className:"w6w-list-item-icon",children:n}),e.jsxs("span",{className:"w6w-list-item-body",children:[e.jsx("span",{className:"w6w-list-item-title",children:t}),s!=null&&e.jsx("span",{className:"w6w-list-item-subtitle",children:s})]}),a!=null&&e.jsx("span",{className:"w6w-list-item-trailing",children:a})]}),d=`w6w-list-item${i?" active":""}`;return l!==void 0?e.jsx("a",{className:d,href:l,"aria-current":i?"true":void 0,"aria-label":o,onClick:r,children:c}):r?e.jsx("button",{type:"button",className:d,"aria-pressed":i,"aria-label":o,onClick:r,children:c}):e.jsx("div",{className:d,"aria-label":o,children:c})}function De(t){const s=Date.parse(t);if(Number.isNaN(s))return"";const n=Math.max(0,Math.round((Date.now()-s)/1e3));if(n<45)return"just now";const a=Math.round(n/60);if(a<60)return`${a}m ago`;const i=Math.round(a/60);if(i<24)return`${i}h ago`;const r=Math.round(i/24);return r<7?`${r}d ago`:new Date(s).toLocaleDateString()}function xt(t){const s={};for(const n of(t==null?void 0:t.params)??[])n.key&&n.default!==void 0&&(s[n.key]=n.default);return s}function _s(t){var n,a,i;const s=t.indexOf("{");if(s>=0)try{const r=JSON.parse(t.slice(s)),l=((a=(n=r==null?void 0:r.errors)==null?void 0:n[0])==null?void 0:a.message)??(typeof(r==null?void 0:r.error)=="object"?(i=r.error)==null?void 0:i.message:r==null?void 0:r.error)??(r==null?void 0:r.message);if(typeof l=="string"&&l.trim()){const o=t.slice(0,s).replace(/[:\s]+$/,"");return o?`${o}: ${l.trim()}`:l.trim()}}catch{}return t}function _t(t){return typeof t=="object"&&t!==null&&typeof t.status=="number"&&typeof t.code=="string"}function Os(t){if(!_t(t))return{headline:(t==null?void 0:t.message)??"The action failed to run."};const s=_s(t.message??""),n=`${t.status} ${t.code} ${t.message??""}`.toLowerCase();return t.status===401||t.status===403||/\b(401|403)\b|forbidden|unauthorized|not authorized|permission|scope|access denied|invalid api key|invalid credential/.test(n)?{headline:"Permission denied by the provider — this is a credential/scope problem, not a w6w error.",hint:"The connection's API key is missing the permissions this action needs. Fix it at the provider — e.g. SendGrid → Settings → API Keys → give the key the required scopes (or Full Access), or create a new key — then update this connection's credential and try again.",detail:s}:{headline:"The action returned an error.",detail:s}}function Is(t){const s=_t(t)?t.body??t.raw:null;return(s==null?void 0:s.apiCalls)??[]}function Fe(){const[t,s]=y.useState(""),[n,a]=y.useState(void 0),[i,r]=y.useState(!1);return{text:t,value:n,invalid:i,onChange:o=>{s(o);const c=o.trim();if(c===""){r(!1);return}try{const d=JSON.parse(c);d!==null&&typeof d=="object"&&!Array.isArray(d)?(a(d),r(!1)):r(!0)}catch{r(!0)}}}}function Ps({appId:t,actions:s,connectionId:n,action:a,seedValues:i,onSavedTestsChanged:r,seedTestId:l,onDirtyChange:o,onTestSaved:c,onDeleted:d,embedded:x=!1}){var ht;const f=m.useW6WApi(),g=y.useMemo(()=>{const p=[...s];return p.sort((T,F)=>(T.title||T.key).localeCompare(F.title||F.key)),p},[s]),[u,h]=y.useState((a==null?void 0:a.key)??""),j=a??s.find(p=>p.key===u)??null,[w,C]=y.useState(!1),[b,v]=y.useState(null),[E,k]=y.useState(void 0),[$,O]=y.useState([]),U=Fe(),R=Fe(),S=Fe(),[_,W]=y.useState(""),[q,X]=y.useState(""),J=U.invalid||R.invalid||S.invalid,V=()=>{const p={};return U.text.trim()!==""&&U.value!==void 0&&(p.body=U.value),R.text.trim()!==""&&R.value!==void 0&&(p.query=R.value),S.text.trim()!==""&&S.value!==void 0&&(p.headers=S.value),_&&(p.target=_),q.trim()!==""&&(p.match=q.trim()),Object.keys(p).length>0?p:void 0},[K,Z]=y.useState("form"),[Re,ae]=y.useState(""),[_e,Q]=y.useState(!1),[N,I]=y.useState(!1),A=(j==null?void 0:j.key)??null,M=i?{...i}:xt(j),[le,P]=y.useState(()=>({key:A,values:M})),[D,ie]=y.useState(l??null),[nt,me]=y.useState(M);if(le.key!==A){const p=xt(j);P({key:A,values:p}),me(p),ie(l??null),v(null),k(void 0),O([])}const[os,cs]=y.useState(l);l!==os&&(cs(l),ie(l??null));const[at,ds]=y.useState(i);if(i!==at){const p=JSON.stringify(i??null)!==JSON.stringify(at??null);if(ds(i),i&&p){const T={...i};P({key:A,values:T}),me(T),v(null),k(void 0),O([])}}const H=le.values,lt=p=>P({key:A,values:p}),it=y.useMemo(()=>JSON.stringify(H)!==JSON.stringify(nt),[H,nt]);y.useEffect(()=>{o==null||o(it)},[it]);const us=()=>{ae(JSON.stringify(H,null,2)),Q(!1),Z("json")},ws=async p=>{if(!j||J)return;const T=j.key;C(!0),v(null),k(void 0),O([]);let F;const te=V();try{const Y=await f.invokeAction(t,T,p,{connectionId:n,...te?{overrides:te}:{}});k(Y.value),O(Y.apiCalls??[]),F={ok:!0,summary:"OK",result:Y.value}}catch(Y){const pt=Os(Y);v(pt),O(Is(Y)),F={ok:!1,summary:pt.headline}}finally{C(!1)}if(n)try{await f.recordTestRun(n,{savedTestId:D??null,actionKey:T,ok:F.ok,summary:F.summary.slice(0,200),result:F.result}),Le(),vs(),r==null||r()}catch{}},ms=()=>ws(H),[he,rt]=y.useState(null),[pe,re]=y.useState(null),[hs,ps]=y.useState(0),[xs,xe]=y.useState(!1),[Oe,Ie]=y.useState(""),[fs,Pe]=y.useState(!1),Le=()=>ps(p=>p+1);y.useEffect(()=>{if(!n){rt(null);return}let p=!1;return re(null),f.listSavedTests(n).then(T=>!p&&rt(T)).catch(T=>!p&&re(T.message)),()=>{p=!0}},[f,n,hs]);const ot=A?(he??[]).filter(p=>p.actionKey===A):[],[js,Me]=y.useState(null),[gs,ys]=y.useState(0),vs=()=>ys(p=>p+1);y.useEffect(()=>{const p=f.listTestRuns;if(!n||!p){Me(null);return}let T=!1;return p(n).then(F=>!T&&Me(F)).catch(()=>!T&&Me(null)),()=>{T=!0}},[f,n,gs]);const ct=A?(js??[]).filter(p=>p.actionKey===A).slice().sort((p,T)=>Date.parse(T.occurredAt)-Date.parse(p.occurredAt)):[],Ns=()=>{!n||!j||(Ie(""),re(null),xe(!0))},bs=()=>{!n||!j||(D?dt():Ns())},dt=async()=>{if(!(!n||!j))try{let p;if(D)p=await f.updateSavedTest(n,D,{values:H});else{const T=Oe.trim();if(!T)return;p=await f.createSavedTest(n,{actionKey:j.key,name:T,values:H}),ie(p.id)}me({...H}),xe(!1),Ie(""),Le(),r==null||r(),c==null||c(p)}catch(p){re(p.message)}},ks=p=>{const T={...p.values};P({key:A,values:T}),me(T),ie(p.id),Z("form"),v(null),k(void 0),O([])},Cs=async()=>{if(!n||!D)return;const p=D;try{await f.deleteSavedTest(n,p),ie(null),Le(),r==null||r(),d==null||d(p)}catch(T){re(T.message)}},ut=e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-1-5)"},children:[e.jsxs("div",{className:"w6w-field-labelrow",style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{className:"w6w-muted w6w-small",children:"Parameters"}),e.jsxs("div",{style:{display:"flex",gap:"var(--w6w-sp-1)"},children:[e.jsx("button",{type:"button",className:`w6w-btn w6w-btn-sm w6w-btn-ghost${K==="form"?" active":""}`,"aria-pressed":K==="form",onClick:()=>Z("form"),children:"Form"}),e.jsx("button",{type:"button",className:`w6w-btn w6w-btn-sm w6w-btn-ghost${K==="json"?" active":""}`,"aria-pressed":K==="json",onClick:us,children:"JSON"}),!x&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-sm w6w-btn-ghost","aria-pressed":N,title:N?"Collapse the params editor":"Open the params editor in a larger view","aria-label":N?"Collapse the params editor":"Open the params editor in a larger view",onClick:()=>I(p=>!p),children:N?"⤡":"⤢"})]})]}),K==="form"?e.jsx(m.ParamsForm,{params:(j==null?void 0:j.params)??[],values:H,onChange:lt,dynamic:j?{appId:t,actionKey:j.key,connectionId:n}:void 0}):e.jsxs(e.Fragment,{children:[e.jsx(m.JsonEditor,{value:Re,onChange:ae,minHeight:N?"50vh":"200px","aria-label":"Params JSON",onValidChange:p=>{p!==null&&typeof p=="object"&&!Array.isArray(p)&&lt(p)},onValidityChange:({valid:p})=>Q(!p)}),_e&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:"Invalid JSON"})]})]}),wt=e.jsxs("details",{className:"w6w-section","data-testid":"overrides-region",children:[e.jsxs("summary",{className:"w6w-section-summary",children:[e.jsx("span",{className:"w6w-section-title",children:"Overrides"}),e.jsx("span",{className:"w6w-section-subtitle",children:"Reach a vendor field this action's own params don't declare"})]}),e.jsxs("div",{className:"w6w-stack w6w-section-body",style:{gap:"var(--w6w-sp-2)"},children:[e.jsxs("div",{className:"w6w-field",children:[e.jsx("span",{children:"Body"}),e.jsx(m.JsonEditor,{value:U.text,onChange:U.onChange,minHeight:"80px","aria-label":"Overrides body (JSON)"}),U.invalid&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:"Invalid JSON"})]}),e.jsxs("div",{className:"w6w-field",children:[e.jsx("span",{children:"Query"}),e.jsx(m.JsonEditor,{value:R.text,onChange:R.onChange,minHeight:"80px","aria-label":"Overrides query (JSON)"}),R.invalid&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:"Invalid JSON"})]}),e.jsxs("div",{className:"w6w-field",children:[e.jsx("span",{children:"Headers"}),e.jsx(m.JsonEditor,{value:S.text,onChange:S.onChange,minHeight:"80px","aria-label":"Overrides headers (JSON)"}),S.invalid&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:"Invalid JSON"})]}),e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Target"}),e.jsxs("select",{"aria-label":"Overrides target",value:_,onChange:p=>W(p.target.value),children:[e.jsx("option",{value:"",children:"— default (first) —"}),e.jsx("option",{value:"first",children:"first"}),e.jsx("option",{value:"first-write",children:"first-write"}),e.jsx("option",{value:"all",children:"all"})]})]}),e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Match"}),e.jsx("input",{type:"text","aria-label":"Overrides match",value:q,placeholder:"Restrict to requests whose URL contains…",onChange:p=>X(p.target.value)})]}),e.jsx("span",{className:"w6w-hint",children:"Merged onto the outbound request at the wire, never into the params above — name a field the way the vendor's own API documents it."})]})]}),fe=n?e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-1-5)"},children:[e.jsx("div",{className:"w6w-field-labelrow",style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:e.jsx("span",{className:"w6w-muted w6w-small",children:"Saved tests"})}),pe&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:pe}),ot.length===0?e.jsx("p",{className:"w6w-muted w6w-small",children:"No saved tests for this action yet."}):e.jsx("ul",{className:"w6w-stack",style:{listStyle:"none",margin:0,padding:0,gap:"var(--w6w-sp-1-5)"},children:ot.map(p=>e.jsx("li",{children:e.jsx(be,{title:p.name,subtitle:p.lastRunAt?e.jsxs("span",{children:[e.jsx("span",{style:{color:p.lastRunOk?"var(--w6w-success)":"var(--w6w-danger)"},children:p.lastRunOk?"✓":"✗"})," ",p.lastRunSummary?`${p.lastRunSummary} · `:"",De(p.lastRunAt)]}):`saved ${De(p.updatedAt)}`,active:p.id===D,onClick:()=>ks(p)})},p.id))}),f.listTestRuns&&ct.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w6w-field-labelrow",style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:e.jsx("span",{className:"w6w-muted w6w-small",children:"Recent runs"})}),e.jsx("ul",{className:"w6w-stack",style:{listStyle:"none",margin:0,padding:0,gap:"var(--w6w-sp-1-5)"},children:ct.map(p=>e.jsx("li",{children:e.jsx(be,{title:e.jsxs("span",{children:[e.jsx("span",{style:{color:p.ok?"var(--w6w-success)":"var(--w6w-danger)"},children:p.ok?"✓":"✗"})," ",p.actionKey]}),subtitle:e.jsxs("span",{children:[p.summary?`${p.summary} · `:"",De(p.occurredAt)]})})},p.id))})]})]}):null,mt=(ht=he==null?void 0:he.find(p=>p.id===D))==null?void 0:ht.name;return e.jsxs("div",{className:`w6w-stack${x?" w6w-tester-embedded-root":""}`,children:[!a&&(s.length===0?e.jsx("p",{className:"w6w-muted w6w-small",children:"This app exposes no actions."}):e.jsxs("label",{className:"w6w-field",children:[e.jsxs("span",{children:["Action",A?"":" *"]}),e.jsx(m.Combobox,{value:u,placeholder:"— pick an action —",onChange:h,options:g.map(p=>({value:p.key,label:`${p.title??p.key} (${p.key})`}))})]})),j?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("strong",{children:[j.title??j.key," ",e.jsx("code",{className:"w6w-muted",children:j.key})]}),j.description&&e.jsx("p",{className:"w6w-muted w6w-small",style:{margin:"var(--w6w-sp-0-5) 0 0"},children:j.description})]}),(()=>{const p=b?e.jsxs("div",{className:"w6w-result w6w-error",children:[e.jsx("strong",{children:b.headline}),b.hint&&e.jsx("div",{style:{marginTop:"var(--w6w-sp-1-5)"},children:b.hint}),b.detail&&e.jsx("div",{className:"w6w-muted w6w-small",style:{marginTop:"var(--w6w-sp-1-5)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:b.detail})]}):null,T=E!==void 0?e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-1)"},children:[e.jsx("strong",{className:"w6w-small",children:"Result"}),e.jsx(m.ResultViewer,{value:E})]}):null,F=e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},children:[ut,wt,p,T,e.jsx(m.ApiCallsPanel,{calls:$})]}),te=e.jsxs("div",{className:`w6w-tester-actions${x||N?" w6w-tester-actions-footer":""}`,style:{display:"flex",gap:"var(--w6w-sp-2)"},children:[e.jsx("button",{type:"button",className:"w6w-btn",disabled:w||J,onClick:ms,children:w?"Running…":"Run action"}),n&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:bs,children:"Save test"}),n&&D&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",style:{marginLeft:"auto",color:"var(--w6w-danger)"},onClick:()=>Pe(!0),children:"Delete"})]}),Y=e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},children:[F,te]});return x?e.jsxs("div",{className:"w6w-tester-embedded",children:[e.jsx("div",{className:"w6w-tester-embedded-scroll",children:e.jsxs("div",{className:"w6w-card-stack",children:[e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-head",children:e.jsx("h3",{children:"Parameters"})}),e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},children:[ut,wt,p]})]}),(T||$.length>0)&&e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-head",children:e.jsx("h3",{children:"Result"})}),e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},children:[E!==void 0&&e.jsx(m.ResultViewer,{value:E}),e.jsx(m.ApiCallsPanel,{calls:$})]})]}),fe&&e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-head",children:e.jsx("h3",{children:"Saved tests and history"})}),fe]})]})}),te]}):N?e.jsx(m.Modal,{title:`Edit params — ${j.title??j.key}`,onClose:()=>I(!1),size:"full",children:e.jsxs("div",{className:"w6w-tester-popout",children:[e.jsx("div",{className:"w6w-tester-popout-scroll",children:fe?e.jsxs("div",{style:{display:"flex",gap:"var(--w6w-sp-4)",alignItems:"flex-start"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:F}),e.jsx("div",{style:{width:260,flexShrink:0},children:fe})]}):F}),te]})}):Y})(),xs&&e.jsx(m.Modal,{title:"Save test",onClose:()=>xe(!1),children:e.jsxs("form",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},onSubmit:p=>{p.preventDefault(),dt()},children:[e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Name this saved test"}),e.jsx("input",{type:"text",value:Oe,placeholder:"e.g. valid sender",onChange:p=>Ie(p.target.value)})]}),pe&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:pe}),e.jsxs("div",{style:{display:"flex",gap:"var(--w6w-sp-2)",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:()=>xe(!1),children:"Cancel"}),e.jsx("button",{type:"submit",className:"w6w-btn",disabled:!Oe.trim(),children:"Save"})]})]})}),fs&&e.jsx(m.ConfirmModal,{title:"Delete saved test",message:mt?`Delete "${mt}"? This cannot be undone.`:"Delete this saved test? This cannot be undone.",confirmLabel:"Delete",onConfirm:()=>{Pe(!1),Cs()},onClose:()=>Pe(!1)})]}):!a&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Pick an action above to test it."})]})}function Ls(t){const s=m.useEffectiveTheme(t.theme),{copied:n,copy:a}=L.useCopyToClipboard(t.value),i=y.useMemo(()=>[Ts.yaml(),$s.EditorView.theme(m.EDITOR_THEME_SPEC)],[]);function r(l){t.onChange(l)}return e.jsxs("div",{className:"w6w-yaml-editor","aria-label":t["aria-label"]??"YAML editor",children:[e.jsx(As,{value:t.value,onChange:r,extensions:i,placeholder:t.placeholder,readOnly:t.readOnly,editable:!t.readOnly,theme:s,height:t.height,minHeight:t.minHeight??"240px",maxHeight:t.maxHeight,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!t.readOnly,autocompletion:!0,bracketMatching:!0,closeBrackets:!0}}),t.copyable!==!1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:`w6w-icon-btn w6w-copyable-btn${n?" is-copied":""}`,"aria-label":"Copy",onClick:()=>void a(),children:n?e.jsx(L.CheckGlyph,{}):e.jsx(L.CopyGlyph,{})}),e.jsx("span",{className:"w6w-copyable-status","aria-live":"polite",children:n?"Copied":""})]})]})}const Be="…";function Ot(t,s,n="end"){if(s===void 0||s<1||s>=t.length)return t;if(n==="start")return`${Be}${t.slice(t.length-s)}`;if(n==="end")return`${t.slice(0,s)}${Be}`;const a=Math.ceil(s/2),i=s-a;return`${t.slice(0,a)}${Be}${t.slice(t.length-i)}`}function It(t){const{value:s,chars:n,crop:a="end",label:i,className:r,copiedMs:l}=t,o=Ot(s,n,a),c=["w6w-copyable--bare",r].filter(Boolean).join(" ");return e.jsx(L.Copyable,{value:s,readOnly:!0,label:i,className:c,copiedMs:l,children:e.jsx("span",{children:o})})}const Ms={ok:"Operational",degraded:"Degraded",down:"Down",unknown:"Unknown"};function Se({state:t,label:s,ariaLabel:n}){const a=s??Ms[t];return e.jsxs("span",{className:`w6w-health-pill w6w-health-pill-${t}`,"aria-label":n,children:[e.jsx("span",{className:"w6w-health-pill-dot","aria-hidden":"true"}),e.jsx("span",{className:"w6w-health-pill-label",children:a})]})}const Ds={ok:"Operational",degraded:"Degraded",down:"Down",unknown:"Unknown"};function Pt({days:t,ariaLabel:s}){return t.length===0?null:e.jsx("div",{className:"w6w-uptime-strip",role:"img","aria-label":s??`${t.length}-day status`,children:t.map((n,a)=>e.jsx("span",{className:`w6w-uptime-cell w6w-uptime-cell-${n.state}`,title:n.label??`${n.day} — ${Ds[n.state]}`},`${n.day}-${a}`))})}const Lt="—",ft=["B","KiB","MiB","GiB","TiB","PiB"];function Mt(t){if(t===null||!Number.isFinite(t))return Lt;if(t<1024)return`${Math.round(t)} B`;let s=t,n=0;for(;s>=1024&&n<ft.length-1;)s/=1024,n+=1;return`${s.toFixed(1)} ${ft[n]}`}function G(t){return t===null||!Number.isFinite(t)?Lt:`${Math.round(t*100)}%`}function ue(t){if(t===void 0||t.load1===null)return null;const s=t.cpuLimit??t.cpus;return s===null||s<=0?null:t.load1/s}function we(t){if(t===void 0)return null;const{memoryTotal:s,memoryAvailable:n}=t;return s===null||n===null||s<=0?null:(s-n)/s}function Fs(t,s,n){return t<s?s:t>n?n:t}function Bs(t,s,n,a){const i=t.length;if(i<2)return"";const r=[];for(let l=0;l<i;l++){const o=t[l];if(o===null)continue;const c=l/(i-1)*s,d=a<=0?n:n-Fs(o,0,a)/a*n;r.push(`${Number(c.toFixed(2))},${Number(d.toFixed(2))}`)}return r.join(" ")}const Us="—",jt=100,gt=24;function qe({values:t,max:s,className:n}){const a=Bs(t,jt,gt,s);return a===""?null:e.jsx("svg",{className:n,viewBox:`0 0 ${jt} ${gt}`,preserveAspectRatio:"none","aria-hidden":"true",focusable:"false",children:e.jsx("polyline",{points:a,fill:"none",stroke:"var(--w6w-accent)",strokeWidth:2,vectorEffect:"non-scaling-stroke"})})}function Ue(t){return t===null?Us:t.toFixed(2)}function ke(t){let s=1;for(const n of t)n!==null&&n>s&&(s=n);return s}function ve({label:t,value:s,values:n,max:a}){return e.jsxs("li",{className:"w6w-server-resources__row",children:[e.jsx("span",{className:"w6w-server-resources__label",children:t}),e.jsx("span",{className:"w6w-server-resources__value",children:s}),e.jsx(qe,{className:"w6w-server-resources__spark",values:n,max:a})]})}function Xe(t){const s=t[t.length-1],n=t.map(r=>ue(r)),a=t.map(r=>we(r)),i=t.map(r=>r.processRss);return{last:s,cpuValues:n,memoryValues:a,rssValues:i}}function Ks({samples:t,title:s="Server resources",intervalMs:n}){const{last:a,cpuValues:i,memoryValues:r,rssValues:l}=Xe(t);return e.jsxs("section",{className:"w6w-server-resources w6w-server-resources--card","aria-label":s,children:[e.jsx("h3",{className:"w6w-server-resources__title",children:s}),e.jsxs("ul",{className:"w6w-server-resources__rows",children:[e.jsx(ve,{label:"CPU",value:G(ue(a)),values:i,max:ke(i)}),e.jsx(ve,{label:"Memory",value:G(we(a)),values:r,max:1}),e.jsx(ve,{label:"Process",value:Mt((a==null?void 0:a.processRss)??null),values:l,max:ke(l)})]}),e.jsx("p",{className:"w6w-server-resources__meta",children:`Load ${Ue((a==null?void 0:a.load1)??null)} / ${Ue((a==null?void 0:a.load5)??null)} / ${Ue((a==null?void 0:a.load15)??null)}`}),n!==void 0&&e.jsx("p",{className:"w6w-server-resources__meta",children:`Sampled every ${n/1e3}s`})]})}function Js({samples:t,title:s="Server"}){const{last:n,cpuValues:a}=Xe(t);return e.jsxs("section",{className:"w6w-server-resources w6w-server-resources--small","aria-label":s,children:[e.jsx("h3",{className:"w6w-server-resources__title",children:s}),e.jsxs("ul",{className:"w6w-server-resources__rows",children:[e.jsx(ve,{label:"CPU",value:G(ue(n)),values:a,max:ke(a)}),e.jsxs("li",{className:"w6w-server-resources__row",children:[e.jsx("span",{className:"w6w-server-resources__label",children:"Memory"}),e.jsx("span",{className:"w6w-server-resources__value",children:G(we(n))})]})]})]})}function Vs({samples:t,onExpand:s}){const{last:n,cpuValues:a,memoryValues:i}=Xe(t);return e.jsxs("aside",{className:"w6w-server-resources w6w-server-resources--rail",children:[e.jsxs("div",{className:"w6w-server-resources__rail-row",children:[e.jsx("span",{className:"w6w-server-resources__label",children:"CPU"}),e.jsx("span",{className:"w6w-server-resources__value",children:G(ue(n))}),e.jsx(qe,{className:"w6w-server-resources__spark",values:a,max:ke(a)})]}),e.jsxs("div",{className:"w6w-server-resources__rail-row",children:[e.jsx("span",{className:"w6w-server-resources__label",children:"MEM"}),e.jsx("span",{className:"w6w-server-resources__value",children:G(we(n))}),e.jsx(qe,{className:"w6w-server-resources__spark",values:i,max:1})]}),s!==void 0&&e.jsx("button",{type:"button",className:"w6w-server-resources__expand","aria-label":"Show server resources",onClick:s,children:"Details"})]})}function Ws({samples:t}){const s=t[t.length-1],n=G(ue(s)),a=G(we(s));return e.jsx("span",{className:"w6w-server-resources w6w-server-resources--badge",children:`CPU ${n} · MEM ${a}`})}const qs=1,Hs=1440*60*1e3;function Ys(t,s,n){const a=s.startedAt??s.updatedAt;if(a===void 0)return null;const i=Date.parse(a),r=s.resolvedAt!==void 0?Date.parse(s.resolvedAt):s.startedAt!==void 0?n:i,l=Date.parse(`${t.from}T00:00:00.000Z`),o=Date.parse(`${t.to}T00:00:00.000Z`)+Hs,c=o-l;if(r<l||i>=o)return null;const d=i<l,x=r>o,f=Math.max(i,l),g=Math.min(r,o),u=(f-l)/c*100,h=(g-f)/c*100,j=Math.max(h,qs);return{leftPct:u,widthPct:j,clippedStart:d,clippedEnd:x}}const zs={ok:"Operational",degraded:"Degraded",down:"Down",unknown:"Unknown"},Gs="This vendor publishes no incident history.",Xs="No incidents in this window.";function Zs(t){const s=t.startedAt??t.updatedAt,n=[t.title];return t.components!==void 0&&t.components.length>0&&n.push(`(${t.components.join(", ")})`),s!==void 0&&n.push(t.resolvedAt!==void 0?`${s} – ${t.resolvedAt}`:`${s} – ongoing`),n.join(" ")}function Qs({window:t,days:s,incidents:n,vendorEmptyLabel:a,nowMs:i=Date.now(),ariaLabel:r}){const l=s.length,o=l>0?100/l:0,c=n===void 0?a??Gs:n.length===0?a??Xs:null;return e.jsx("div",{className:"w6w-history-timeline",role:"img","aria-label":r??`${l}-day history`,children:e.jsxs("div",{className:"w6w-history-plot",children:[e.jsx("div",{className:"w6w-history-lane w6w-history-lane-execution",children:s.map((d,x)=>e.jsx("span",{className:`w6w-history-cell w6w-history-cell-${d.state}`,style:{left:`${x*o}%`,width:`${o}%`},title:d.label??`${d.day} — ${zs[d.state]}`},`${d.day}-${x}`))}),e.jsx("div",{className:"w6w-history-lane w6w-history-lane-vendor",children:c!==null?e.jsx("span",{className:"w6w-history-empty",title:c,children:c}):n==null?void 0:n.map((d,x)=>{const f=Ys(t,d,i);if(f===null)return null;const g=[f.clippedStart?"w6w-history-bar-clip-start":"",f.clippedEnd?"w6w-history-bar-clip-end":""].filter(Boolean).join(" ");return e.jsx("span",{className:`w6w-history-bar w6w-history-bar-${d.state}${g?` ${g}`:""}`,style:{left:`${f.leftPct}%`,width:`${f.widthPct}%`},title:Zs(d)},d.id??`${d.title}-${x}`)})}),e.jsxs("div",{className:"w6w-history-axis",children:[e.jsx("span",{className:"w6w-history-tick w6w-history-tick-start",style:{left:"0%"},children:t.from}),e.jsx("span",{className:"w6w-history-tick w6w-history-tick-end",style:{left:"100%"},children:t.to})]})]})})}function en({label:t,children:s,className:n}){const[a,i]=y.useState(!1),r=y.useId();return e.jsxs("span",{className:["w6w-info-tip",n??""].filter(Boolean).join(" "),children:[e.jsx(m.IconButton,{label:t,icon:"info","aria-expanded":a,"aria-controls":r,onClick:()=>i(l=>!l)}),a&&e.jsx("span",{id:r,className:"w6w-info-tip-body w6w-muted w6w-small",children:s})]})}function Ze(t){const{label:s,onClick:n,disabled:a,className:i,...r}=t;return e.jsx(m.IconButton,{label:s,onClick:n,disabled:a,className:i,icon:"edit","data-testid":r["data-testid"]})}function tn(t){const{branch:s,shortSha:n,lastSyncLabel:a,onSyncNow:i,syncing:r,className:l,...o}=t,[c,d]=y.useState(!1),x=y.useRef(null);return y.useEffect(()=>{if(!c)return;const f=u=>{x.current&&!x.current.contains(u.target)&&d(!1)},g=u=>u.key==="Escape"&&d(!1);return document.addEventListener("mousedown",f),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",g)}},[c]),e.jsxs("div",{className:`w6w-repo-sync${l?` ${l}`:""}`,ref:x,"data-testid":o["data-testid"],children:[e.jsxs("button",{type:"button",className:"w6w-repo-sync-trigger","aria-haspopup":"menu","aria-expanded":c,"aria-busy":r,onClick:()=>d(f=>!f),children:[e.jsxs("span",{className:"w6w-repo-sync-icon",children:[e.jsx(L.Icon,{name:"github"}),r&&e.jsx(L.Icon,{name:"sync",size:10,className:"w6w-repo-sync-spin"})]}),e.jsx("span",{className:"w6w-repo-sync-branch",children:s}),n!=null&&e.jsx("code",{className:"w6w-repo-sync-sha",children:n})]}),c&&e.jsxs("div",{className:"w6w-repo-sync-menu",role:"menu",children:[e.jsxs("div",{className:"w6w-repo-sync-detail",children:[e.jsx("span",{children:s}),n!=null&&e.jsx("code",{children:n}),a!=null&&e.jsx("span",{children:a})]}),e.jsx("button",{type:"button",role:"menuitem",className:"w6w-repo-sync-item","data-testid":"repo-sync-now",disabled:r,onClick:i,children:r?"Syncing…":"Sync now"})]})]})}const sn={pending:"Pending",running:"Running",succeeded:"Succeeded",failed:"Failed",skipped:"Skipped",queued:"Queued",canceled:"Canceled"};function Ee({state:t,label:s,ariaLabel:n}){const a=s??sn[t];return e.jsxs("span",{className:`w6w-step-pill w6w-step-pill-${t}`,"aria-label":n,children:[e.jsx("span",{className:"w6w-step-pill-dot","aria-hidden":"true"}),e.jsx("span",{className:"w6w-step-pill-label",children:a})]})}const nn="—",Ke=1e3,Je=6e4;function Te(t){return t==null||!Number.isFinite(t)||t<0?nn:t<Ke?`${Math.round(t)} ms`:t<Je?`${(t/Ke).toFixed(1)} s`:`${Math.floor(t/Je)}m ${Math.round(t%Je/Ke)}s`}function de(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}const an={function:"Function",endpoint:"Endpoint",workflow:"Workflow"},ln={manual:"Manual",schedule:"Schedule",webhook:"Webhook",event:"Event",replay:"Replay"};function yt(t){if(!t.trigger)return null;const s=ln[t.trigger]??t.trigger;return t.triggerNodeId?`${s} · ${t.triggerNodeId}`:s}function rn({items:t,selectedId:s=null,onSelect:n,showCallable:a=!1,loading:i=!1,emptyLabel:r,hasPrev:l,hasNext:o,onPrev:c,onNext:d,onRerun:x,rerunningId:f=null}){const g=c||d?e.jsxs("div",{className:"w6w-execution-list-pager",children:[e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":"execution-list-prev",disabled:!l,onClick:c,children:"Previous"}),e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":"execution-list-next",disabled:!o,onClick:d,children:"Next"})]}):null;let u;return i&&t.length===0?u=e.jsx("p",{"data-testid":"execution-list-loading",children:"Loading…"}):t.length===0?u=e.jsx("p",{"data-testid":"execution-list-empty",children:r??"No executions yet."}):u=e.jsx("ul",{className:"w6w-execution-list-rows",children:t.map(h=>e.jsxs("li",{"data-testid":"execution-row","data-execution-id":h.id,children:[e.jsx(be,{icon:e.jsx(Ee,{state:h.status}),title:e.jsxs(e.Fragment,{children:[a?h.callableName:de(h.startedAt),h.rerunOf&&e.jsx("span",{className:"w6w-execution-rerun-tag","data-testid":"execution-row-rerun-tag",title:`Re-run of ${h.rerunOf}`,children:"Re-run"})]}),subtitle:e.jsxs(e.Fragment,{children:[a?`${an[h.kind]} · ${de(h.startedAt)}`:h.id,yt(h)&&e.jsx("span",{className:"w6w-execution-trigger","data-testid":"execution-row-trigger",children:` · ${yt(h)}`}),h.inputPreview&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("code",{className:"w6w-execution-input-preview","data-testid":"execution-row-input",title:h.inputPreview,children:h.inputPreview})]})]}),trailing:Te(h.durationMs),active:h.id===s,onClick:n?()=>n(h.id):void 0}),x&&e.jsx(m.IconButton,{icon:"sync",label:"Re-run",title:h.id===f?"Re-running…":"Re-run with the same input",className:"w6w-execution-list-rerun","data-testid":"execution-row-rerun",disabled:f!==null,onClick:()=>x(h.id)})]},h.id))}),e.jsxs("div",{className:"w6w-execution-list","data-testid":"execution-list",children:[u,g]})}function on(t){const s=m.internalNodeDef(t.app,t.action);return{trigger:t.trigger===!0||(s==null?void 0:s.group)==="trigger",appName:t.appName??(s==null?void 0:s.displayName)??t.app,actionName:t.actionName??(s==null?void 0:s.label)??t.action}}function Dt(t){const s=n=>{for(const a of[n.startedAt,n.finishedAt]){const i=Date.parse(a??"");if(Number.isFinite(i))return i}return Number.POSITIVE_INFINITY};return t.map(n=>({step:n,time:s(n)})).sort((n,a)=>n.time===a.time?0:n.time-a.time).map(({step:n})=>n)}function Ft({steps:t,emptyLabel:s,onDismiss:n,runError:a,stepErrors:i}){const r=n?e.jsx("div",{className:"w6w-execution-log-head",children:e.jsx(m.IconButton,{label:"Dismiss run log","data-testid":"execution-log-dismiss",onClick:n,children:"×"})}):null,l=i??[],o=a||l.length>0?e.jsxs("div",{className:"w6w-execution-log-errors w6w-stack",children:[a&&e.jsx(He,{error:a}),l.map((f,g)=>e.jsx(He,{label:f.label??f.stepId,error:f.error},`${f.stepId}:${g}`))]}):null,c=Dt(t.filter(f=>!vt(f))),d=t.filter(vt),x=d.length>0?e.jsx(dn,{steps:d}):null;return c.length===0?e.jsxs(e.Fragment,{children:[r,o,e.jsx("div",{className:"w6w-execution-log-empty",children:e.jsx("p",{className:"w6w-muted w6w-small",children:s??"No nodes have run yet."})}),x]}):e.jsxs(e.Fragment,{children:[r,o,e.jsx("ol",{className:"w6w-execution-log",children:c.map(f=>e.jsx(Bt,{step:f},f.id))}),x]})}const vt=t=>t.status==="skipped"&&t.skipReason==="not_on_path",cn={condition:"condition false",stopped:"run stopped",disabled:"disabled"};function dn({steps:t}){const s=t.length;return e.jsxs("details",{className:"w6w-execution-log-off-path","data-testid":"execution-log-off-path",children:[e.jsx("summary",{className:"w6w-muted w6w-small",children:`${s} ${s===1?"step":"steps"} on other paths, not part of this run`}),e.jsx("ul",{className:"w6w-muted w6w-small",children:t.map(n=>e.jsx("li",{children:n.label??n.id},n.id))})]})}function Bt({step:t,defaultOpen:s=!1}){var d,x;const[n,a]=y.useState(s),i=t.node?on(t.node):null,r=e.jsxs("div",{className:"w6w-execution-log-row-header",children:[e.jsx(Ee,{state:t.status}),i&&e.jsx("span",{className:`w6w-execution-log-kind${i.trigger?" w6w-execution-log-kind-trigger":""}`,"data-testid":"execution-log-kind",children:i.trigger?"Trigger":"Node"}),e.jsxs("span",{className:"w6w-execution-log-row-title",children:[e.jsx("span",{className:"w6w-execution-log-row-label",children:t.label??t.id}),i&&e.jsx("span",{className:"w6w-execution-log-row-uses","data-testid":"execution-log-uses",children:i.appName===i.actionName?i.appName:`${i.appName} · ${i.actionName}`})]}),t.status==="skipped"&&t.skipReason&&t.skipReason!=="not_on_path"&&e.jsx("span",{className:"w6w-execution-log-skip-reason","data-testid":"execution-log-skip-reason",children:cn[t.skipReason]}),e.jsx(mn,{startedAt:t.startedAt,finishedAt:t.finishedAt})]}),l=t.error?e.jsx(He,{error:t.error}):null,o=Array.isArray(t.iterations)?e.jsx(un,{step:t}):null,c=fn(t)?e.jsx(jn,{step:t}):null;return t.input===void 0&&t.output===void 0&&!t.meta&&!c&&!((d=t.logs)!=null&&d.length)?e.jsxs("li",{className:"w6w-execution-log-row",children:[e.jsx("div",{className:"w6w-section",children:r}),l,o]}):e.jsxs("li",{className:"w6w-execution-log-row",children:[e.jsxs("details",{className:"w6w-section",open:n,onToggle:f=>a(f.currentTarget.open),children:[e.jsx("summary",{className:"w6w-section-summary",children:r}),n&&e.jsxs("div",{className:"w6w-execution-log-row-body w6w-section-body w6w-stack",children:[e.jsx(pn,{input:t.input}),e.jsx(Nt,{title:"Input",value:t.input,defaultOpen:s}),e.jsx(Nt,{title:"Output",value:t.output,defaultOpen:s}),!!((x=t.logs)!=null&&x.length)&&e.jsxs("div",{className:"w6w-execution-log-json w6w-stack",children:[e.jsx("strong",{className:"w6w-small",children:"Console"}),e.jsx(L.CodeBlock,{code:t.logs.join(`
2
- `),language:"plaintext"})]}),t.meta&&e.jsxs("div",{className:"w6w-execution-log-json w6w-stack",children:[e.jsx("strong",{className:"w6w-small",children:"Metadata"}),e.jsx(L.CodeBlock,{code:JSON.stringify(t.meta,null,2),language:"json"})]}),c]})]}),l,o]})}function un({step:t}){var h,j;const s=[...t.iterations??[]].sort((w,C)=>w.index-C.index),n=t.iterationsTotal??s.length,a=t.iterationsFailed??s.filter(w=>w.status==="failed").length,i=s.find(w=>w.status==="failed"),r=(i==null?void 0:i.index)??((h=s[s.length-1])==null?void 0:h.index),[l,o]=y.useState(r),[c,d]=y.useState(!1),x=s.find(w=>w.index===l),f=[],g=new Map;for(const w of Dt(s.flatMap(C=>C.steps)))g.has(w.id)||(f.push(w.id),g.set(w.id,w.label??w.id));const u=(i==null?void 0:i.failedNodeId)??((j=i==null?void 0:i.steps.find(w=>w.status==="failed"))==null?void 0:j.id);return e.jsxs("div",{className:"w6w-execution-log-foreach w6w-stack",children:[e.jsxs("div",{className:"w6w-small","data-testid":"execution-log-foreach-summary",children:[e.jsxs("span",{children:[n===1?"1 item":`${n} items`,a>0?` · ${a} failed`:""]}),i&&u!==void 0&&e.jsxs("div",{children:[g.get(u)??u," failed in iteration ",i.index]}),t.iterationsTruncated===!0&&e.jsx("div",{className:"w6w-muted",children:`showing ${s.length} of ${n}`})]}),e.jsx("div",{className:"w6w-execution-log-iteration-chips",children:s.map(w=>e.jsxs("button",{type:"button",className:`w6w-execution-log-iteration-chip w6w-execution-log-iteration-chip-${w.status}`,"data-testid":"execution-log-iteration-chip","data-status":w.status,"aria-pressed":l===w.index,title:`Show iteration ${w.index}'s input and output`,onClick:()=>{o(w.index),d(!0)},children:[w.index," · ",w.status]},w.index))}),x&&e.jsx("div",{className:"w6w-small w6w-muted","data-testid":"execution-log-iteration-current",children:`Iteration ${x.index} · ${x.status}`}),e.jsx("ul",{className:"w6w-execution-log-subrows",children:f.map(w=>e.jsx(wn,{id:w,label:g.get(w)??w,iterations:s,selected:l,open:c,onSelect:o},w))})]})}function wn({id:t,label:s,iterations:n,selected:a,open:i,onSelect:r}){var o;const l=(o=n.find(c=>c.index===a))==null?void 0:o.steps.find(c=>c.id===t);return e.jsxs("li",{className:"w6w-execution-log-subrow w6w-stack",children:[e.jsxs("div",{className:"w6w-execution-log-subrow-head",children:[e.jsx("strong",{className:"w6w-small",children:s}),e.jsx("select",{className:"w6w-select","aria-label":`Iteration for ${s}`,"data-testid":"execution-log-iteration-select",value:a===void 0?"":String(a),onChange:c=>r(Number(c.currentTarget.value)),children:n.map(c=>e.jsx("option",{value:String(c.index),children:`iteration ${c.index} (${c.status})`},c.index))})]}),l?e.jsx("ol",{className:"w6w-execution-log",children:e.jsx(Bt,{step:l,defaultOpen:i},`${a}:${i}`)}):e.jsx("p",{className:"w6w-muted w6w-small",children:"Did not run in this iteration."})]})}function He({error:t,label:s}){return e.jsxs("div",{className:"w6w-result w6w-error",children:[s!==void 0&&e.jsx("strong",{className:"w6w-execution-log-error-label",children:s}),t.code&&e.jsx("div",{className:"w6w-small w6w-execution-log-error-code",children:e.jsx("code",{children:t.code})}),t.message]})}function mn({startedAt:t,finishedAt:s}){if(t&&s){const n=hn(t,s);return e.jsxs("span",{className:"w6w-execution-log-timing",children:[t," → ",s,n&&e.jsxs("span",{children:[" (",n,")"]})]})}return t?e.jsxs("span",{className:"w6w-execution-log-timing",children:["Started ",t]}):e.jsx("span",{className:"w6w-execution-log-timing",children:"—"})}function hn(t,s){const n=Date.parse(t),a=Date.parse(s);if(!Number.isFinite(n)||!Number.isFinite(a)||a<n)return null;const i=a-n;if(i<1e3)return`${i}ms`;const r=i/1e3;if(r<60)return`${r.toFixed(1)}s`;const l=Math.floor(r/60),o=Math.round(r%60);return`${l}m ${o}s`}function Nt({title:t,value:s,defaultOpen:n=!1}){const[a,i]=y.useState(n);return s===void 0?e.jsxs("div",{className:"w6w-execution-log-json w6w-stack",children:[e.jsx("strong",{className:"w6w-small",children:t}),e.jsx("p",{className:"w6w-muted w6w-small",children:"Not available."})]}):e.jsxs("details",{className:"w6w-execution-log-json",open:a,onToggle:r=>{r.target===r.currentTarget&&i(r.currentTarget.open)},children:[e.jsx("summary",{children:e.jsx("strong",{className:"w6w-small",children:t})}),a&&e.jsx(m.ResultViewer,{value:s,format:"json"})]})}const Ce=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function bt(t){if(!Ce(t)||!Array.isArray(t.conditions))return;const s=t.conditions.filter(n=>Ce(n)&&typeof n.op=="string"&&"result"in n);if(s.length!==0)return{rows:s,combinator:typeof t.combinator=="string"?t.combinator:void 0,result:typeof t.condition=="boolean"?t.condition:void 0}}function pn({input:t}){const s=[],n=bt(t);if(n&&s.push({trace:n}),Ce(t)&&Array.isArray(t.routes))for(const a of t.routes){const i=bt(a);!i||!Ce(a)||s.push({title:String(a.label??a.id??"Route"),trace:i})}return s.length===0?null:e.jsxs("div",{className:"w6w-execution-log-json w6w-stack","data-testid":"execution-log-conditions",children:[e.jsx("strong",{className:"w6w-small",children:"Condition"}),s.map(({title:a,trace:i},r)=>e.jsxs("div",{className:"w6w-stack",children:[a&&e.jsx("span",{className:"w6w-small w6w-muted",children:a}),(i.combinator&&i.rows.length>1||i.result!==void 0)&&e.jsxs("span",{className:"w6w-small w6w-muted","data-testid":"execution-log-condition-summary",children:[i.combinator&&i.rows.length>1&&m.conditionCombinatorLabel(i.combinator),i.combinator&&i.rows.length>1&&i.result!==void 0&&" · ",i.result!==void 0&&e.jsxs(e.Fragment,{children:["Result:"," ",e.jsx("span",{className:i.result?"w6w-execution-log-condition-true":"w6w-execution-log-condition-false",children:i.result?"true":"false"})]})]}),e.jsx("div",{className:"w6w-data-table-frame",children:e.jsxs("table",{className:"w6w-data-table w6w-execution-log-conditions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Left"}),e.jsx("th",{children:"Operator"}),e.jsx("th",{children:"Right"}),e.jsx("th",{children:"Result"})]})}),e.jsx("tbody",{children:i.rows.map((l,o)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:kt(l.left)})}),e.jsx("td",{children:m.conditionOperatorLabel(l.op)}),e.jsx("td",{children:e.jsx("code",{children:kt(l.right)})}),e.jsx("td",{className:l.result?"w6w-execution-log-condition-true":"w6w-execution-log-condition-false",children:l.result?"true":"false"})]},o))})]})})]},a??r))]})}function kt(t){return JSON.stringify(t)??"undefined"}const Ct={not_object:"Not written — the output isn't an object, so it can't be merged at the root",missing_source:"Not written — the output has no value at that field",null_append:"Not appended — the value was null",append_not_array:"Not appended — the existing value isn't a list",write_too_large:"Not written — the value is too large",run_too_large:"Not written — the run's state would grow past its size limit",too_deep:"Not written — the value is nested too deeply",key_too_long:"Not written — a key in the value is too long",forbidden_key:"Not written — the value uses a reserved key name",log_truncated:"Later state changes aren't shown — the run's state log reached its limit"};function xn(t){return Object.hasOwn(Ct,t)?Ct[t]:t}function fn(t){const s=Array.isArray(t.stateWrites)&&t.stateWrites.length>0,n=t.stateAfter;return s||typeof n=="object"&&n!==null&&Object.keys(n).length>0}const St=120;function Et(t){if(t===void 0)return"(not set)";const s=JSON.stringify(t)??String(t);return s.length>St?`${s.slice(0,St)}…`:s}function jn({step:t}){const s=Array.isArray(t.stateWrites)?t.stateWrites:[],n=t.stateAfter;return e.jsxs("div",{className:"w6w-execution-log-state w6w-stack","data-testid":"execution-log-state",children:[e.jsx("strong",{className:"w6w-small",children:"State"}),s.length>0&&e.jsx("ul",{className:"w6w-execution-log-state-writes",children:s.map((a,i)=>{const r=Array.isArray(a.path)?a.path:[],l=`state${r.length?`.${r.join(".")}`:""}${a.item!==void 0?` (item ${a.item})`:""}`;return a.warning!==void 0?e.jsx("li",{className:"w6w-execution-log-state-write w6w-execution-log-state-warning w6w-small","data-testid":"execution-log-state-write","data-warning":a.warning,children:`${l}: ${xn(a.warning)}`},i):e.jsx("li",{className:"w6w-execution-log-state-write w6w-small","data-testid":"execution-log-state-write",children:`${l}: ${Et(a.old)} → ${Et(a.new)}`},i)})}),typeof n=="object"&&n!==null&&e.jsxs("div",{className:"w6w-stack","data-testid":"execution-log-state-after",children:[e.jsx("span",{className:"w6w-small w6w-muted",children:"State after this step"}),e.jsx(L.CodeBlock,{code:JSON.stringify(n,null,2),language:"json"})]})]})}const gn={status:"",kind:"",from:"",to:"",q:""},yn=[{value:"",label:"Any status"},{value:"queued",label:"Queued"},{value:"running",label:"Running"},{value:"succeeded",label:"Succeeded"},{value:"failed",label:"Failed"},{value:"canceled",label:"Canceled"}],vn=[{value:"",label:"Any type"},{value:"function",label:"Function"},{value:"endpoint",label:"Endpoint"},{value:"workflow",label:"Workflow"}];function Nn({value:t,onChange:s,showKind:n=!1,searchPlaceholder:a="Search by id or name",disabled:i=!1}){const r=t.status!==""||t.kind!==""||t.from!==""||t.to!==""||t.q!=="";return e.jsxs("div",{className:"w6w-execution-filters","data-testid":"execution-filters",children:[e.jsx("input",{type:"search",className:"w6w-execution-filters-search","data-testid":"execution-filter-q","aria-label":"Search executions",placeholder:a,value:t.q,disabled:i,onChange:l=>s({...t,q:l.target.value})}),e.jsx("select",{className:"w6w-execution-filters-select","data-testid":"execution-filter-status","aria-label":"Status",value:t.status,disabled:i,onChange:l=>s({...t,status:l.target.value}),children:yn.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),n&&e.jsx("select",{className:"w6w-execution-filters-select","data-testid":"execution-filter-kind","aria-label":"Type",value:t.kind,disabled:i,onChange:l=>s({...t,kind:l.target.value}),children:vn.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),e.jsx("input",{type:"date",className:"w6w-execution-filters-date","data-testid":"execution-filter-from","aria-label":"From date",value:t.from,disabled:i,onChange:l=>s({...t,from:l.target.value})}),e.jsx("input",{type:"date",className:"w6w-execution-filters-date","data-testid":"execution-filter-to","aria-label":"To date",value:t.to,disabled:i,onChange:l=>s({...t,to:l.target.value})}),r&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost w6w-execution-filters-clear","data-testid":"execution-filter-clear",disabled:i,onClick:()=>s({...gn}),children:"Clear"})]})}const Ne="—";function bn({stats:t,label:s}){const n=[{testid:"execution-stat-total",label:"Executions",value:t?String(t.total):Ne},{testid:"execution-stat-success-rate",label:"Success rate",value:kn(t==null?void 0:t.successRate)},{testid:"execution-stat-failed",label:"Failed",value:t?String(t.failed):Ne},{testid:"execution-stat-avg-duration",label:"Avg duration",value:t?Te(t.avgDurationMs):Ne}];return t&&t.inFlight>0&&n.push({testid:"execution-stat-in-flight",label:"In flight",value:String(t.inFlight)}),e.jsxs("section",{className:"w6w-execution-stats","data-testid":"execution-stats",children:[s!=null&&e.jsx("p",{className:"w6w-execution-stats-label",children:s}),e.jsx("div",{className:"w6w-execution-stats-cards",children:n.map(a=>e.jsxs("div",{className:"w6w-execution-stat","data-testid":a.testid,children:[e.jsx("span",{className:"w6w-execution-stat-value","data-stat-value":a.value,children:a.value}),e.jsx("span",{className:"w6w-execution-stat-label",children:a.label})]},a.testid))})]})}function kn(t){return t==null||!Number.isFinite(t)?Ne:`${Math.round(t*100)}%`}const Cn={function:"Function",endpoint:"Endpoint",workflow:"Workflow"};function Sn(t){return JSON.stringify(t,null,2)??"null"}function En({execution:t,loading:s=!1,errorMessage:n,onClose:a,onOpenInEditor:i,onBack:r,onRerun:l,rerunning:o=!1,onOpenExecution:c}){return e.jsxs("section",{className:"w6w-execution-detail w6w-stack","data-testid":"execution-detail",children:[r&&e.jsx("div",{className:"w6w-execution-detail-back",children:e.jsxs("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":"execution-detail-back",onClick:r,children:[e.jsx("span",{"aria-hidden":"true",children:"←"})," Back"]})}),n!=null&&e.jsx("p",{role:"alert",className:"w6w-execution-detail-error-message","data-testid":"execution-detail-error-message",children:n}),t?e.jsx(Tn,{execution:t,onClose:a,onOpenInEditor:i,onRerun:l,rerunning:o,onOpenExecution:c}):s?e.jsx("p",{className:"w6w-muted","data-testid":"execution-detail-loading",children:"Loading…"}):e.jsx("p",{className:"w6w-muted","data-testid":"execution-detail-empty",children:"No execution selected."})]})}function Tn({execution:t,onClose:s,onOpenInEditor:n,onRerun:a,rerunning:i,onOpenExecution:r}){const l=t.rerunOf;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w6w-execution-detail-head",children:[e.jsxs("div",{className:"w6w-execution-detail-title",children:[e.jsx("h3",{className:"w6w-execution-detail-name",children:t.callableName}),e.jsxs("div",{className:"w6w-execution-detail-meta",children:[e.jsx(Ee,{state:t.status}),e.jsx("span",{className:"w6w-execution-detail-kind w6w-muted w6w-small",children:Cn[t.kind]})]})]}),(a||n||s)&&e.jsxs("div",{className:"w6w-execution-detail-actions",children:[a&&e.jsxs("button",{type:"button",className:"w6w-btn w6w-execution-detail-rerun","data-testid":"execution-detail-rerun",title:"Run it again with the same input",disabled:i,onClick:a,children:[e.jsx(L.Icon,{name:"sync",size:14})," ",i?"Re-running…":"Re-run"]}),n&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":"execution-detail-open-editor",onClick:n,children:"Open in visual editor"}),s&&e.jsx(m.IconButton,{label:"Close","data-testid":"execution-detail-close",onClick:s,children:"×"})]})]}),e.jsx("p",{className:"w6w-execution-detail-id-line",children:e.jsx("code",{className:"w6w-execution-detail-id","data-testid":"execution-detail-id",children:t.id})}),l&&e.jsxs("p",{className:"w6w-execution-detail-rerun-of","data-testid":"execution-detail-rerun-of",children:[e.jsx("span",{className:"w6w-execution-rerun-tag",children:"Re-run"}),e.jsx("span",{className:"w6w-muted w6w-small",children:"of"}),r?e.jsx("button",{type:"button",className:"w6w-execution-detail-rerun-of-link","data-testid":"execution-detail-rerun-of-link",onClick:()=>r(l),children:e.jsx("code",{children:l})}):e.jsx("code",{children:l})]}),e.jsxs("dl",{className:"w6w-execution-detail-timing",children:[e.jsx(Ve,{label:"Started",value:de(t.startedAt)}),e.jsx(Ve,{label:"Finished",value:t.finishedAt?de(t.finishedAt):"—"}),e.jsx(Ve,{label:"Duration",value:Te(t.durationMs)})]}),t.steps!==void 0&&e.jsxs("section",{className:"w6w-execution-detail-section w6w-stack","data-testid":"execution-detail-steps",children:[e.jsx("strong",{className:"w6w-small",children:"Nodes"}),e.jsx(Ft,{steps:t.steps,emptyLabel:"No nodes ran."})]}),t.input!==void 0&&e.jsx(We,{title:"Input",testid:"execution-detail-input",value:t.input}),t.output!==void 0&&e.jsx(We,{title:"Output",testid:"execution-detail-output",value:t.output}),t.error!=null&&e.jsx(We,{title:"Error",testid:"execution-detail-error",value:t.error})]})}function Ve({label:t,value:s}){return e.jsxs("div",{className:"w6w-execution-detail-timing-item",children:[e.jsx("dt",{children:t}),e.jsx("dd",{children:s})]})}function We({title:t,testid:s,value:n}){return e.jsxs("section",{className:"w6w-execution-detail-section w6w-stack","data-testid":s,children:[e.jsx("strong",{className:"w6w-small",children:t}),e.jsx(L.CodeBlock,{code:Sn(n),language:"json"})]})}function Ut(t){const s=[];for(const n of t)n.p95Ms!==null&&s.push({appId:n.appId,displayName:n.displayName,calls:n.calls,p95Ms:n.p95Ms,state:n.state,errorCount:n.errors.e4xx+n.errors.e429+n.errors.eAuth+n.errors.e5xx});return s}function $n(t){return t.attention==="now"||t.attention==="recent"}function Kt(t){const s={now:[],recent:[],clear:[]};for(const n of t)n.attention==="now"?s.now.push(n):n.attention==="recent"?s.recent.push(n):s.clear.push(n);return s}function Jt(t){return t.uptime.map(s=>({day:s.day,state:s.state}))}const Ye=3,Vt=5;function Wt(t,s={}){const n=s.compact??!1,{now:a,recent:i}=Kt(t),r=a.length+i.length,l=n?a.slice(0,Ye):a,o=n?i.slice(0,Math.max(0,Ye-l.length)):i,c=n?t.slice(0,s.limit??Vt):[...t];return{attentionCount:r,shownNow:l,shownRecent:o,hiddenAttentionCount:r-l.length-o.length,shownTable:c,hiddenTableCount:t.length-c.length}}const ge=640,oe=340,B={top:16,right:24,bottom:40,left:56};function Tt(t){if(t<=0)return 1;const s=10**Math.floor(Math.log10(t)),n=[1,2,5,10];for(const a of n)if(t<=a*s)return a*s;return 10*s}function $t(t,s=5){return Array.from({length:s+1},(n,a)=>Math.round(t*a/s))}function qt({services:t,getHref:s,onOpen:n}){const a=Ut(t);if(a.length===0)return e.jsx("p",{className:"w6w-muted w6w-small",children:"No timed calls in this window yet."});const i=Tt(Math.max(...a.map(w=>w.calls))),r=Tt(Math.max(...a.map(w=>w.p95Ms))),l=Math.max(1,...a.map(w=>w.errorCount)),o=ge-B.left-B.right,c=oe-B.top-B.bottom,d=w=>B.left+w/i*o,x=w=>B.top+w/r*c,f=w=>16+w/l*14,g=$t(i),u=$t(r),h=18,j=B.top+c/2;return e.jsxs("div",{className:"w6w-rel-scatter",children:[e.jsxs("svg",{viewBox:`0 0 ${ge} ${oe}`,style:{aspectRatio:`${ge} / ${oe}`},role:"img","aria-label":"API performance: calls versus p95 latency, one point per API",children:[e.jsx("rect",{x:B.left,y:B.top,width:o,height:c,className:"w6w-rel-scatter-plot-bg"}),u.map(w=>e.jsxs("g",{children:[e.jsx("line",{x1:B.left,x2:ge-B.right,y1:x(w),y2:x(w),className:"w6w-rel-scatter-grid"}),e.jsx("text",{x:B.left-8,y:x(w),className:"w6w-rel-scatter-axis-label",textAnchor:"end",children:w})]},`y-${w}`)),g.map(w=>e.jsx("text",{x:d(w),y:oe-B.bottom+18,className:"w6w-rel-scatter-axis-label",textAnchor:"middle",children:w},`x-${w}`)),e.jsx("text",{x:h,y:j,className:"w6w-rel-scatter-axis-title",textAnchor:"middle",transform:`rotate(-90, ${h}, ${j})`,children:"p95 (ms)"}),e.jsx("text",{x:B.left+o/2,y:oe-4,className:"w6w-rel-scatter-axis-title",textAnchor:"middle",children:"calls in this window"}),a.map(w=>{const C=f(w.errorCount),b=d(w.calls),v=x(w.p95Ms),E=e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:b,cy:v,r:C/2+2.5,className:`w6w-rel-scatter-ring w6w-rel-scatter-ring-${w.state}`,children:e.jsxs("title",{children:[w.displayName," — ",w.calls," calls, ",w.p95Ms," ms p95, ",w.errorCount," errors"]})}),e.jsx("circle",{cx:b,cy:v,r:C/2,className:`w6w-rel-scatter-point w6w-rel-scatter-point-${w.state}`})]});return s?e.jsx("a",{href:s(w.appId),className:"w6w-rel-scatter-point-link",onClick:n?k=>n(w.appId,k):void 0,children:E},w.appId):n?e.jsx("g",{role:"button",tabIndex:0,className:"w6w-rel-scatter-point-link",onClick:k=>n(w.appId,k),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),k.currentTarget.dispatchEvent(new MouseEvent("click",{bubbles:!0})))},children:E},w.appId):e.jsx("g",{children:E},w.appId)})]}),e.jsx("p",{className:"w6w-muted w6w-small w6w-rel-scatter-note",children:"Up is faster, right is more calls — top-right is the best outcome. Icon size is the error count in this window; ring colour is exec status."})]})}function At(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Ht({appId:t,className:s,title:n,getHref:a,onOpen:i,children:r}){return a?e.jsx("a",{className:s,href:a(t),title:n,onClick:i?l=>i(t,l):void 0,children:r}):i?e.jsx("button",{type:"button",className:s,title:n,onClick:l=>i(t,l),children:r}):e.jsx("div",{className:s,title:n,children:r})}function Yt({service:t}){return e.jsxs("span",{className:"w6w-rel-signal",children:[e.jsx(Se,{state:t.state}),t.ongoingOutageId&&e.jsx("span",{className:"w6w-rel-tag",children:"outage open"}),t.calls===0&&e.jsx("span",{className:"w6w-muted w6w-small",children:"no calls"})]})}function zt({vendor:t}){if(!t)return e.jsx("span",{className:"w6w-muted w6w-small",children:"not published"});const s=t.state==="unknown";return e.jsxs("span",{className:"w6w-rel-signal",title:t.message??void 0,children:[e.jsx(Se,{state:t.state,label:s?"Unavailable":void 0}),!s&&t.message&&e.jsx("span",{className:"w6w-rel-vendor-msg w6w-small",children:t.message})]})}function An({service:t,getHref:s,onOpen:n}){return e.jsxs(Ht,{appId:t.appId,className:"w6w-rel-issue-card",title:`${t.displayName} — open service detail`,getHref:s,onOpen:n,children:[e.jsxs("span",{className:"w6w-rel-issue-head",children:[e.jsx(m.AppIcon,{src:t.iconSrc,srcDark:t.iconSrcDark,brandColor:t.brandColor,name:t.displayName,size:24}),e.jsxs("span",{className:"w6w-rel-issue-head-text",children:[e.jsx("strong",{children:t.displayName}),t.attention==="recent"&&e.jsx("span",{className:"w6w-muted w6w-small",children:"trouble earlier in this window"})]})]}),e.jsxs("span",{className:"w6w-rel-issue-signals",children:[e.jsxs("span",{className:"w6w-rel-issue-signal",children:[e.jsx("span",{className:"w6w-muted w6w-small",children:"w6w exec"}),e.jsx(Yt,{service:t})]}),e.jsxs("span",{className:"w6w-rel-issue-signal",children:[e.jsx("span",{className:"w6w-muted w6w-small",children:"API status"}),e.jsx(zt,{vendor:t.vendorStatus})]})]})]})}function Rn({service:t,getHref:s,onOpen:n}){const a=t.calls===0;return e.jsxs("tr",{className:`w6w-rel-tr${t.attention!=="none"?" w6w-rel-attention":""}`,"data-attention":t.attention==="none"?void 0:t.attention,children:[e.jsx("td",{className:"w6w-rel-td-service",children:e.jsxs(Ht,{appId:t.appId,className:"w6w-rel-open",getHref:s,onOpen:n,children:[e.jsx(m.AppIcon,{src:t.iconSrc,srcDark:t.iconSrcDark,brandColor:t.brandColor,name:t.displayName,size:28}),e.jsxs("span",{className:"w6w-rel-td-service-text",children:[e.jsx("strong",{children:t.displayName}),e.jsx("code",{className:"w6w-muted w6w-small",children:t.appId})]})]})}),e.jsxs("td",{className:"w6w-rel-td-status",children:[e.jsxs("span",{className:"w6w-rel-status-row",children:[e.jsx("span",{className:"w6w-rel-status-label w6w-muted w6w-small",children:"Ops"}),e.jsx(Yt,{service:t})]}),e.jsxs("span",{className:"w6w-rel-status-row",children:[e.jsx("span",{className:"w6w-rel-status-label w6w-muted w6w-small",children:"API"}),e.jsx(zt,{vendor:t.vendorStatus})]})]}),e.jsx("td",{className:"w6w-rel-td-uptime",children:a?e.jsx("span",{className:"w6w-rel-idle-note",children:"No calls in this window"}):e.jsxs(e.Fragment,{children:[e.jsx(Pt,{days:Jt(t),ariaLabel:`${t.displayName}, ${t.uptime.length}-day status, oldest day first`}),e.jsxs("span",{className:"w6w-muted w6w-small",children:[t.calls," calls"]})]})}),e.jsx("td",{className:"w6w-rel-td-p95",children:t.p95Ms===null?"—":`${t.p95Ms} ms`})]})}function _n({services:t,window:s,days:n,compact:a=!1,showChart:i,limit:r,getHref:l,onOpen:o,showAllHref:c,onShowAll:d,slots:x}){const f=n??(s==null?void 0:s.days)??30,g=t.length>0&&t.every($=>$.calls>0&&$.state==="ok"),{attentionCount:u,shownNow:h,shownRecent:j,hiddenAttentionCount:w,shownTable:C,hiddenTableCount:b}=Wt(t,{compact:a,limit:r}),v=i??!a,E=c!==void 0||d!==void 0,k=$=>{const O=$.startsWith("Show")?"w6w-muted w6w-small":void 0;return c!==void 0?e.jsx("a",{href:c,className:O,onClick:d,children:$}):d?e.jsx("button",{type:"button",className:`w6w-rel-show-all${O?` ${O}`:""}`,onClick:d,children:$}):null};return e.jsxs("section",{className:"w6w-rel-section",children:[e.jsxs("h3",{className:"w6w-rel-heading",children:[e.jsxs("span",{children:[(x==null?void 0:x.header)??"Service reliability"," ",s&&e.jsxs("span",{className:"w6w-muted w6w-small",children:[At(s.from)," – ",At(s.to)," · ",s.days," days"]})]}),a&&k("Show all services →"),x==null?void 0:x.actions]}),e.jsxs("div",{className:a?"w6w-rel-card":void 0,children:[e.jsx("p",{className:"w6w-muted w6w-small w6w-rel-intro",children:"Connected services across your account. Performance for the selected project."}),g&&e.jsxs("div",{className:a?"w6w-rel-allclear":"w6w-rel-card w6w-rel-allclear",children:[e.jsx("h4",{children:"All clear"}),e.jsxs("p",{children:["Every service you called in the last ",f," days came back"," ",e.jsx(Se,{state:"ok"})," — no degraded stretches, no outages."]})]}),t.length===0&&((x==null?void 0:x.empty)??e.jsx("div",{className:a?void 0:"w6w-rel-card",children:e.jsx("p",{className:"w6w-muted",children:"No services yet — connect an integration or use a service in this project."})})),t.length>0&&e.jsxs(e.Fragment,{children:[u>0&&e.jsxs("div",{className:"w6w-rel-group",children:[e.jsxs("h4",{className:"w6w-rel-group-head",children:["Needs attention"," ",e.jsxs("span",{className:"w6w-muted w6w-small",children:[h.length+j.length," of ",u]})]}),e.jsx("div",{className:"w6w-rel-issues",children:[...h,...j].map($=>e.jsx(An,{service:$,getHref:l,onOpen:o},$.appId))}),w>0&&e.jsxs("p",{className:"w6w-muted w6w-small w6w-rel-more-note",children:[w," more ",w===1?"needs":"need"," ","attention",E&&e.jsxs(e.Fragment,{children:[" — ",k("view all →")]})]})]}),v&&e.jsxs("div",{className:"w6w-rel-group",children:[e.jsx("h4",{className:"w6w-rel-group-head",children:"Performance across your APIs"}),e.jsx(qt,{services:t,getHref:l,onOpen:o})]}),C.length>0&&e.jsxs("div",{className:"w6w-rel-group",children:[e.jsxs("h4",{className:"w6w-rel-group-head",children:[a?"Services":"All services"," ",e.jsx("span",{className:"w6w-muted w6w-small",children:a?`${C.length} of ${t.length}`:t.length})]}),e.jsx("div",{className:"w6w-rel-table-wrap",children:e.jsxs("table",{className:"w6w-rel-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Service"}),e.jsx("th",{children:"Status"}),e.jsxs("th",{children:["Last ",f," days"]}),e.jsx("th",{children:"Latency"})]})}),e.jsx("tbody",{children:C.map($=>e.jsx(Rn,{service:$,getHref:l,onOpen:o},$.appId))})]})}),b>0&&e.jsxs("p",{className:"w6w-muted w6w-small w6w-rel-more-note",children:[b," more",E&&e.jsxs(e.Fragment,{children:[" — ",k("view all →")]})]})]})]})]})]})}function On(t,s){return t.render?t.render(s):String(s[t.key]??"")}function ne(t){const{columns:s,rows:n,rowKey:a,onRowClick:i,getRowHref:r,empty:l,loading:o,className:c,testId:d}=t;return n.length===0&&!o&&l!==void 0&&l!==null?e.jsx(e.Fragment,{children:l}):e.jsx("div",{className:"w6w-data-table-frame",children:e.jsxs("table",{className:c?`w6w-data-table ${c}`:"w6w-data-table","data-testid":d,"aria-busy":o?!0:void 0,children:[e.jsx("thead",{children:e.jsx("tr",{children:s.map(x=>e.jsx("th",{style:{width:x.width,textAlign:x.align},scope:"col",children:x.header},x.key))})}),e.jsx("tbody",{children:n.map(x=>{var g;const f=r==null?void 0:r(x);return e.jsx("tr",{"data-testid":(g=t.rowTestId)==null?void 0:g.call(t,x),className:i?"w6w-data-table-row-clickable":void 0,onClick:i?u=>i(x,u):void 0,children:s.map(u=>{const h=On(u,x);return e.jsx("td",{style:{textAlign:u.align},children:f!==void 0&&u.link!==!1?e.jsx("a",{className:"w6w-data-table-link",href:f,children:h}):h},u.key)})},a(x))})})]})})}function In({rows:t,title:s,description:n,emptyCopy:a,newLabel:i="New",openRowTitle:r,testIds:l,loading:o,error:c,onCreate:d,creating:x,onImport:f,onOpen:g,getHref:u,showArchived:h,onShowArchivedChange:j,slots:w}){const[C,b]=y.useState(!1),v=h!==void 0,E=v?h:C,k=E?t:t.filter(S=>!S.archived),$=g!==void 0||u!==void 0,O=S=>{v||b(S),j==null||j(S)},U=[{key:"main",header:"Name",render:S=>{const _=e.jsxs("span",{className:"w6w-callable-list-main",title:$?r:void 0,children:[e.jsx("span",{children:S.title}),S.description!=null&&e.jsx("span",{className:"w6w-muted w6w-small w6w-callable-list-row-desc",children:S.description})]});return g&&!u?e.jsx("button",{type:"button",className:"w6w-callable-list-open",children:_}):_}},{key:"trail",header:"",align:"right",width:"1%",render:S=>S.archived||S.badges!=null||S.trailing!=null?e.jsxs("span",{className:"w6w-callable-list-trail",children:[S.badges,S.archived&&e.jsx("span",{className:"w6w-callable-list-badge","data-testid":l==null?void 0:l.archivedBadge,children:"archived"}),S.trailing]}):null}],R=t.length>0&&k.length===0;return e.jsxs("section",{className:"w6w-callable-list",children:[e.jsxs("div",{className:"w6w-callable-list-head",children:[e.jsxs("div",{className:"w6w-callable-list-heading",children:[(w==null?void 0:w.header)??e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"w6w-callable-list-title",children:s}),n!=null&&e.jsx("p",{className:"w6w-muted w6w-small w6w-callable-list-description",children:n})]}),e.jsxs("label",{className:"w6w-muted w6w-small w6w-callable-list-toggle",children:[e.jsx("input",{type:"checkbox",checked:E,"data-testid":l==null?void 0:l.showArchived,onChange:S=>O(S.target.checked)}),"Show archived"]})]}),e.jsxs("div",{className:"w6w-callable-list-actions",children:[w==null?void 0:w.actions,f&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":l==null?void 0:l.importOpen,onClick:f,children:"Import"}),d&&e.jsx("button",{type:"button",className:"w6w-btn",disabled:x,onClick:d,children:x?"Creating…":i})]})]}),c&&e.jsx("div",{className:"w6w-error",children:c}),e.jsxs("div",{className:"w6w-callable-list-body",children:[o&&e.jsx("p",{className:"w6w-muted",children:"Loading…"}),k.length===0&&!o?R?e.jsx(m.EmptyState,{testId:"w6w-callable-list-empty",action:e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:()=>O(!0),children:"Show archived"}),children:t.length===1?"The only item is archived.":`All ${t.length} items are archived.`}):e.jsx(m.EmptyState,{testId:"w6w-callable-list-empty",children:(w==null?void 0:w.empty)??a}):e.jsx(ne,{columns:U,rows:k,rowKey:S=>S.id,className:"w6w-data-table-rows",loading:o,getRowHref:u?S=>u(S.id):void 0,onRowClick:g?(S,_)=>g(S.id,_):void 0})]})]})}function Pn({connections:t,appsById:s,loading:n,error:a,onOpen:i,getHref:r,onEdit:l,onDelete:o,busy:c,slots:d}){const x=s??new Map,f=l!==void 0||o!==void 0,g=[{key:"name",header:"Name",render:u=>{const h=m.resolveConnectionAppMeta(u,x),j=u.displayName||u.id;return e.jsxs("span",{className:"w6w-connection-cell-name",children:[e.jsx(m.AppIcon,{src:h==null?void 0:h.iconSvg,srcDark:h==null?void 0:h.iconSvgDark,brandColor:h==null?void 0:h.brandColor,name:(h==null?void 0:h.displayName)??u.appId}),e.jsx("strong",{className:"w6w-connection-name",title:j,children:j})," ",e.jsx("span",{className:"w6w-muted",children:(h==null?void 0:h.displayName)??u.appId})]})}},{key:"status",header:"Status",render:u=>e.jsxs(e.Fragment,{children:["auth ",e.jsx("code",{children:u.authKey})," ·"," ",e.jsx("span",{className:`w6w-connection-tag${u.state==="connected"?"":" w6w-connection-tag-warn"}`,children:u.state}),u.lastTestOk===!1&&e.jsx("span",{className:"w6w-connection-tag w6w-connection-tag-danger",title:"Last test failed — update or re-test.",children:"invalid"})]})}];return f&&g.push({key:"actions",header:"",align:"right",link:!1,render:u=>u.builtIn===!0?null:e.jsxs("div",{className:"w6w-connection-row-actions",onClick:h=>h.stopPropagation(),children:[l&&e.jsx(Ze,{label:"Edit",onClick:()=>l(u),"data-testid":`connection-edit-${u.id}`}),o&&e.jsx(m.DeleteButton,{label:"Delete",onClick:()=>o(u),disabled:c,"data-testid":`connection-delete-${u.id}`})]})}),e.jsxs("section",{className:"w6w-connection-list",children:[((d==null?void 0:d.header)!=null||(d==null?void 0:d.actions)!=null)&&e.jsxs("div",{className:"w6w-connection-list-head",children:[e.jsx("div",{className:"w6w-connection-list-heading",children:d==null?void 0:d.header}),e.jsx("div",{className:"w6w-connection-list-actions",children:d==null?void 0:d.actions})]}),a&&e.jsx("div",{className:"w6w-error",children:a}),n&&e.jsx("p",{className:"w6w-muted",children:"Loading…"}),t.length===0&&!n?e.jsx(m.EmptyState,{testId:"w6w-connection-list-empty",children:(d==null?void 0:d.empty)??"No connections yet."}):e.jsx(ne,{columns:g,rows:t,rowKey:u=>u.id,loading:n,getRowHref:r?u=>u.builtIn===!0?void 0:r(u.id):void 0,onRowClick:i?(u,h)=>u.builtIn===!0?void 0:i(u.id,h):void 0})]})}function Ln({connection:t,onClose:s,onSaved:n}){const a=m.useW6WApi(),i=a.updateConnection,r=t.builtIn===!0,l=!r&&typeof i=="function",[o,c]=y.useState(t.displayName??""),[d,x]=y.useState(t.authKey),[f,g]=y.useState({}),[u,h]=y.useState(null),[j,w]=y.useState(null),[C,b]=y.useState(!1),[v,E]=y.useState({}),[k,$]=y.useState(null),[O,U]=y.useState(null),[R,S]=y.useState(null);y.useEffect(()=>{if(!l)return;let N=!1;return h(null),a.getAppAuth(t.appId).then(I=>!N&&h(I)).catch(I=>!N&&w(I.message)),()=>{N=!0}},[a,l,t.appId]);const _=u==null?void 0:u.find(N=>N.key===d),W=d!==t.authKey,q=(u==null?void 0:u.filter(N=>N.key===t.authKey||N.available!==!1&&!N.autoSatisfied&&["apiKey","bearer","basic","custom"].includes(N.type)))??[],X=(_==null?void 0:_.type)==="oauth2",J=X?[]:(_==null?void 0:_.fields)??[],V=t.credentialId,K=!W&&!!V&&typeof a.rotateCredential=="function"&&(O!==null?!O.startsWith("legacy:"):(_==null?void 0:_.type)==="serviceAccount")&&!X,Z=K&&(_!=null&&_.serviceAccount)?m.bindingFieldsFor(_.serviceAccount):[];y.useEffect(()=>{if(!l||W||X||!V||typeof a.getCredential!="function")return;let N=!1;return a.getCredential(V).then(I=>{N||($(I.connectionCount),U(I.contract))}).catch(()=>{}),()=>{N=!0}},[a,l,W,X,V]);function Re(){if(K){const A={};o!==(t.displayName??"")&&(A.displayName=o);const M=m.buildBinding(Z,v);return M&&(A.binding=M),A.displayName===void 0&&A.binding===void 0?null:A}const N={};for(const A of J){const M=f[A.key];M!==void 0&&M!==""&&(N[A.key]=M)}const I={};return W&&(I.authKey=d,I.credential=N),o!==(t.displayName??"")&&(I.displayName=o),Object.keys(N).length>0&&(I.credential=N),I.displayName===void 0&&I.credential===void 0?null:I}async function ae(){if(!l||!i||C)return;w(null);const N=Re(),I=Object.fromEntries(J.filter(P=>f[P.key]!==void 0&&f[P.key]!=="").map(P=>[P.key,f[P.key]])),A=Object.keys(I).length>0;if(!N&&!A){w("Nothing to update — change the name or a credential or binding field.");return}if(W||K&&A){const P=J.filter(D=>D.required&&!(D.key in I));if(P.length>0){w(`Enter the full new credential: ${P.map(D=>D.label).join(", ")}.`);return}}const M=m.parseJsonFields(J,I);if("error"in M){w(M.error);return}b(!0);let le=!1;try{K&&A&&V&&a.rotateCredential?(await a.rotateCredential(V,{source:M.values}),le=!0,g({}),S(null)):N!=null&&N.credential&&(N.credential=M.values);const P=N?await i.call(a,t.id,N):t;g({}),n(P)}catch(P){w(le?`The credential was saved, but the other changes failed. Click Save to retry them. ${P.message}`:P.message)}finally{b(!1)}}async function _e(){if(!(!V||!a.testCredential)){w(null);try{S(await a.testCredential(V))}catch(N){w(N.message)}}}const Q=m.useEnterSubmit(ae,{enabled:l&&!C});return e.jsx(m.Modal,{title:"Edit connection",onClose:s,children:e.jsxs("div",{className:"w6w-stepconfig",children:[e.jsx("div",{className:"w6w-modal-body",children:e.jsxs("div",{className:"w6w-stack",children:[r&&e.jsx("p",{className:"w6w-muted w6w-small",children:"This connection is built in — it has no stored credential to edit."}),!r&&!l&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Editing connections is not available here."}),l&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Display name"}),e.jsx("input",{type:"text",value:o,onChange:N=>c(N.target.value),placeholder:"Connection name",maxLength:80,name:"w6w-connection-label",autoComplete:"off","data-1p-ignore":"true","data-lpignore":"true","data-bwignore":"true","data-form-type":"other",...Q})]}),q.some(N=>N.key!==t.authKey)&&e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Authentication method"}),e.jsxs("select",{name:"w6w-connection-auth",value:d,disabled:C,onChange:N=>{x(N.target.value),g({}),E({}),S(null),w(null)},children:[!q.some(N=>N.key===t.authKey)&&e.jsx("option",{value:t.authKey,children:t.authKey}),q.map(N=>e.jsx("option",{value:N.key,children:N.displayName??N.key},N.key))]})]}),W&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Enter the new credential and click Save. This connection stays linked to your existing workflows."}),u===null&&!j&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Loading auth fields…"}),X&&e.jsx("p",{className:"w6w-muted w6w-small",children:q.some(N=>N.key!==t.authKey)?"This connection uses OAuth. Choose another authentication method above to use a key or token.":"This is an OAuth connection. You can rename it here; its credential is renewed by re-authorizing it."}),K&&Z.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"w6w-muted w6w-small",children:"Leave a binding field blank to keep it unchanged."}),e.jsx(m.AuthFieldsForm,{mode:"edit",fields:Z,values:v,onChange:E,enterSubmitProps:Q})]}),K&&e.jsxs("div",{className:"w6w-stack","data-w6w":"credential-section",children:[typeof a.testCredential=="function"&&e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:_e,children:"Test credential"}),R&&e.jsxs("p",{className:"w6w-small","data-w6w":"credential-health",children:["Credential health: ",R.ok?"ok":R.code??"failed"]})]}),e.jsxs("p",{className:"w6w-small","data-w6w":"app-access",children:["App access:"," ",t.lastTestOk===!0?"passed":t.lastTestOk===!1?"failed":"never tested"]}),J.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"w6w-muted w6w-small",children:["Leave the credential blank to keep it unchanged. To replace it, enter the full new credential and click Save.",k!==null&&k>1&&` This credential is used by ${k} connections; saving a new credential updates all of them.`]}),e.jsx(m.AuthFieldsForm,{mode:"edit",fields:J,values:f,onChange:g,enterSubmitProps:Q})]})]}),!K&&J.length>0&&e.jsxs(e.Fragment,{children:[!W&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Leave a field blank to keep it unchanged. Filled fields replace the stored credential."}),e.jsx(m.AuthFieldsForm,{mode:"edit",fields:J,values:f,onChange:g,enterSubmitProps:Q})]})]}),j&&e.jsx("div",{className:"w6w-result w6w-error",children:j})]})}),e.jsxs("div",{className:"w6w-modal-actions",children:[e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:s,children:"Cancel"}),l&&e.jsx("button",{type:"button",className:"w6w-btn",disabled:C,onClick:ae,children:C?"Saving…":"Save"})]})]})})}function Mn({conn:t,app:s,children:n}){return e.jsxs("div",{className:"w6w-connection-header","data-testid":"connection-header",children:[e.jsx(m.AppIcon,{src:s==null?void 0:s.iconSvg,srcDark:s==null?void 0:s.iconSvgDark,brandColor:s==null?void 0:s.brandColor,name:(s==null?void 0:s.displayName)??t.appId,size:56}),e.jsxs("div",{className:"w6w-connection-header-main",children:[e.jsx("h2",{className:"w6w-connection-header-title",children:t.displayName||t.id}),e.jsxs("p",{className:"w6w-muted w6w-small w6w-connection-header-meta",children:[e.jsx(It,{value:t.id,className:"w6w-connection-id-copy"})," · App"," ",e.jsx("code",{children:t.appId})," · Auth ",e.jsx("code",{children:t.authKey})," ·"," ",e.jsx("span",{className:`w6w-connection-tag${t.state==="connected"?"":" w6w-connection-tag-warn"}`,children:t.state}),t.lastTestOk===!1&&e.jsx("span",{className:"w6w-connection-tag w6w-connection-tag-danger",title:"Last test failed — update or re-test.",children:"invalid"})]})]}),n&&e.jsx("div",{className:"w6w-connection-header-actions",children:n})]})}const Dn=t=>String(t);function Rt(t){const s=Math.min(100,Math.max(0,t));return Number(s.toFixed(4))}function Fn({label:t,used:s,limit:n,reserved:a=0,format:i,className:r,testId:l}){const o=i??Dn,c=Number.isFinite(a)&&a>0,d=n>0?Rt(s/n*100):100,x=c&&n>0?Rt(Math.min(100-d,a/n*100)):0,f=s>=n,g=`${o(s)} / ${o(n)}`,u=["w6w-budget-meter"];return f&&u.push("w6w-budget-meter-over"),r&&u.push(r),e.jsxs("div",{role:"meter",className:u.join(" "),"aria-label":t,"aria-valuemin":0,"aria-valuenow":s,"aria-valuemax":n,"aria-valuetext":g,"data-testid":l,children:[e.jsxs("div",{className:"w6w-budget-meter-head",children:[e.jsx("span",{className:"w6w-budget-meter-label",children:t}),e.jsx("span",{className:"w6w-budget-meter-value",children:g})]}),e.jsxs("div",{className:"w6w-budget-meter-track",children:[e.jsx("div",{className:"w6w-budget-meter-used",style:{width:`${d}%`}}),c&&e.jsx("div",{className:"w6w-budget-meter-reserved",style:{width:`${x}%`}})]})]})}const Gt={kv:"Key-value",doc:"Document",table:"Table"},Bn=["kv","doc","table"],Qe=["string","number","integer","boolean","date","datetime"],Xt=5242880;function Un(t){var n;const s=(n=t.schema)==null?void 0:n.valueType;return typeof s=="string"&&Qe.includes(s)?s:"string"}function Kn(t){var a,i;if(t.kind!=="table")return null;const s=(a=t.schema)==null?void 0:a.columns;if(!Array.isArray(s))return null;const n=(i=t.schema)==null?void 0:i.key;return typeof n=="string"?{columns:s,key:n}:{columns:s}}function Jn(t,s){const n=t==null?void 0:t.match(/filename="([^"]*)"/),a=n==null?void 0:n[1];return a!==void 0&&a!==""?a:`${s}.csv`}const Zt={required:"Required.",not_a_number:"Enter a number.",not_an_integer:"Enter a whole number.",not_a_boolean:"Enter true or false.",not_a_date:"Enter a date as YYYY-MM-DD.",not_a_datetime:"Enter a date-time like 2026-01-31T09:30:00Z."},Vn=/^-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?$/,Wn=/^-?(0|[1-9]\d*)$/,qn=/^\d{4}-\d{2}-\d{2}$/,Hn=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function Yn(t,s){return s===2?t%4===0&&t%100!==0||t%400===0?29:28:[31,0,31,30,31,30,31,31,30,31,30,31][s-1]}function et(t){if(!qn.test(t))return null;const s=Number(t.slice(0,4)),n=Number(t.slice(5,7)),a=Number(t.slice(8,10));return n<1||n>12||a<1||a>Yn(s,n)?null:{year:s,month:n,day:a}}function z(t){return{ok:!1,problem:t,message:Zt[t]}}function $e(t,s,n){const a=s.trim();if(a==="")return n?z("required"):{ok:!0,value:void 0};switch(t){case"string":return{ok:!0,value:s};case"number":{if(!Vn.test(a))return z("not_a_number");const i=Number(a);return Number.isFinite(i)?{ok:!0,value:i}:z("not_a_number")}case"integer":{if(!Wn.test(a))return z("not_an_integer");const i=Number(a);return Number.isSafeInteger(i)?{ok:!0,value:i}:z("not_an_integer")}case"boolean":return a==="true"?{ok:!0,value:!0}:a==="false"?{ok:!0,value:!1}:z("not_a_boolean");case"date":return et(a)===null?z("not_a_date"):{ok:!0,value:a};case"datetime":return Qt(a)?{ok:!0,value:a}:z("not_a_datetime")}}function Qt(t){if(!Hn.test(t)||et(t.slice(0,10))===null)return!1;const s=Number(t.slice(11,13)),n=Number(t.slice(14,16)),a=Number(t.slice(17,19));if(s>23||n>59||a>59)return!1;const r=t.slice(19).match(/(Z|([+-])(\d{2}):(\d{2}))$/);return r===null||r[1]==="Z"?!0:Number(r[3])<=23&&Number(r[4])<=59}function Ae(t,s){if(s==null)return"";if((t==="string"||t==="date"||t==="datetime")&&typeof s=="string")return s;if((t==="number"||t==="integer")&&typeof s=="number"&&Number.isFinite(s))return String(s);if(t==="boolean"&&typeof s=="boolean")return s?"true":"false";const n=JSON.stringify(s);return n===void 0?"":n}function zn(t,s){switch(t){case"string":return typeof s=="string";case"number":return typeof s=="number"&&Number.isFinite(s);case"integer":return Number.isSafeInteger(s);case"boolean":return typeof s=="boolean";case"date":return typeof s=="string"&&et(s)!==null;case"datetime":return typeof s=="string"&&Qt(s)}}const se="The request failed.",es="Could not reach the server.";function ee(t){return typeof t=="string"&&t.length>0?t:void 0}function ts(t){return Number.isInteger(t)&&t>=0?t:void 0}function ss(t,s,n){const a={message:se};typeof n=="number"&&(a.status=n);const i=t!==null&&typeof t=="object"?t.error:void 0;if(i!==null&&typeof i=="object"){const r=i,l=ee(r.code);l!==void 0&&(a.code=l);const o=ee(r.field);o!==void 0&&(a.field=o);const c=ee(r.column);c!==void 0&&(a.column=c);const d=ts(r.row);d!==void 0&&(a.row=d);const x=ee(r.message);x!==void 0&&(a.message=x)}if(a.message===se)for(const r of s){const l=ee(r);if(l!==void 0){a.message=l;break}}return a}function Gn(t){try{const s=t!==null&&typeof t=="object"?t:void 0,n=s==null?void 0:s.raw,a=s==null?void 0:s.message;return ss(n,[a],s==null?void 0:s.status)}catch{return{message:se}}}function ns(t){try{if(t.status===0)return{status:0,code:"network_error",message:es};let s;try{s=JSON.parse(t.text)}catch{return{status:t.status,message:se}}return ss(s,[],t.status)}catch{return{message:se}}}function as(t){const s=ee(t.column);if(s!==void 0){const a=ts(t.row);return a===void 0?{kind:"cell",column:s}:{kind:"cell",column:s,row:a}}const n=ee(t.field);return n!==void 0?{kind:"field",field:n}:{kind:"form"}}function ze(t){return t+2}const tt="\0new",st="Changed by someone else since you loaded it.",Ge="Enter a JSON object or array.",ls="The file is larger than 5 MB.";function is(t){const s=t.value;return s!==null&&typeof s=="object"&&!Array.isArray(s)?s:{}}function Xn(t,s){const n=is(t),a={};for(const i of s)a[i.name]=Ae(i.type,n[i.name]);return{id:t.key,version:t.version,cells:a}}function Zn(t){const s={};for(const n of t)s[n.name]=n.default===void 0?"":Ae(n.type,n.default);return{id:tt,version:null,cells:s}}function Qn(t,s,n){const a=[];for(const i of n)(t.cells[i.name]??"")!==(s.cells[i.name]??"")&&a.push(i.name);return a}function ea(t,s){const n={},a={};for(const i of s){const r=$e(i.type,t.cells[i.name]??"",i.required);r.ok?r.value!==void 0&&(n[i.name]=r.value):a[i.name]=r.message}return Object.keys(a).length>0?{ok:!1,errors:a}:{ok:!0,value:n}}function ta(t,s){if(t===null)return;const n=Date.parse(t);if(!Number.isFinite(n))return;const a=Math.ceil((n-s)/1e3);return a>0?a:void 0}function sa(t,s,n){if(t.id===tt)return n===void 0?{kind:"insert",value:s}:{kind:"insert",value:s,ttlSeconds:n};const a={kind:"put",key:t.id,value:s,ifVersion:t.version??0};return n===void 0?a:{...a,ttlSeconds:n}}function na(t,s){const n=as(t);return n.kind!=="cell"||!s.some(a=>a.name===n.column)?null:{[n.column]:t.message}}function aa(t){return t.status===409&&t.code==="version_conflict"}function rs(t){let s;try{s=JSON.parse(t)}catch{return{ok:!1,message:Ge}}return s===null||typeof s!="object"?{ok:!1,message:Ge}:{ok:!0,value:s}}function la(t,s){if(t==="string")return{ok:!0,value:s};const n=$e(t,s,!0);return n.ok?{ok:!0,value:n.value}:{ok:!1,message:n.message}}function ia(t){if(t.status===200){let a=0;try{const i=JSON.parse(t.text);typeof i.imported=="number"&&Number.isFinite(i.imported)&&(a=i.imported)}catch{a=0}return{ok:!0,message:`Imported ${a} row${a===1?"":"s"}.`}}const s=ns(t);return s.row===void 0?{ok:!1,message:s.message}:{ok:!1,message:`${s.column?`Line ${ze(s.row)}, column ${s.column}`:`Line ${ze(s.row)}`}: ${s.message}`}}function ra({stores:t,loading:s,error:n,onOpen:a,getHref:i,onEdit:r,onArchive:l,busy:o,formatSize:c,slots:d}){const x=c??Mt,f=r!==void 0||l!==void 0,g=[{key:"name",header:"Name",render:u=>e.jsx("strong",{children:u.name})},{key:"kind",header:"Kind",render:u=>Gt[u.kind]},{key:"entries",header:"Entries",align:"right",render:u=>String(u.entryCount)},{key:"size",header:"Size",align:"right",render:u=>x(u.sizeBytes)},{key:"updated",header:"Updated",render:u=>new Date(u.updatedAt).toLocaleString()}];return f&&g.push({key:"actions",header:"",align:"right",link:!1,render:u=>e.jsxs("div",{className:"w6w-data-row-actions",onClick:h=>h.stopPropagation(),children:[r&&e.jsx(Ze,{label:"Edit",onClick:()=>r(u),"data-testid":`data-store-edit-${u.id}`}),l&&e.jsx(m.DeleteButton,{label:"Archive",onClick:()=>l(u),disabled:o,"data-testid":`data-store-archive-${u.id}`})]})}),e.jsxs("section",{className:"w6w-data-store-list",children:[((d==null?void 0:d.header)!=null||(d==null?void 0:d.actions)!=null)&&e.jsxs("div",{className:"w6w-data-store-list-head",children:[e.jsx("div",{className:"w6w-data-store-list-heading",children:d==null?void 0:d.header}),e.jsx("div",{className:"w6w-data-store-list-actions",children:d==null?void 0:d.actions})]}),n&&e.jsx("div",{className:"w6w-error",children:n}),s&&e.jsx("p",{className:"w6w-muted",children:"Loading…"}),t.length===0&&!s?e.jsx(m.EmptyState,{testId:"w6w-data-store-list-empty",children:(d==null?void 0:d.empty)??"No data stores yet."}):e.jsx(ne,{columns:g,rows:t,rowKey:u=>u.id,loading:s,getRowHref:i?u=>i(u.id):void 0,onRowClick:a?(u,h)=>a(u.id,h):void 0})]})}function oa(t){return t.name!==""&&t.required===!0&&(t.type==="string"||t.type==="integer")}function ca(t,s){const{default:n,...a}=t,i=$e(t.type,s,!1);return i.ok?i.value===void 0?{column:a}:{column:{...a,default:i.value}}:{column:a,error:i.message}}function da(t){const{columns:s,onChange:n,keyColumn:a,onKeyColumnChange:i,columnErrors:r}=t,[l,o]=y.useState({}),c=s.filter(oa),d=c.some(h=>h.name===a)?a:"";y.useEffect(()=>{a!==""&&d===""&&i("")},[a,d,i]);function x(){n([...s,{name:"",type:"string",required:!1}])}function f(h,j){n(s.map((w,C)=>C===h?{...w,...j}:w))}function g(h,j,w,C){const b={...s[h],...C,type:j},{column:v,error:E}=ca(b,w);o(k=>({...k,[h]:E===void 0?{text:w}:{text:w,error:E}})),n(s.map((k,$)=>$===h?v:k))}function u(h){o(j=>{const w={};for(const[C,b]of Object.entries(j)){const v=Number(C);v<h?w[v]=b:v>h&&(w[v-1]=b)}return w}),n(s.filter((j,w)=>w!==h))}return e.jsxs("div",{className:"w6w-data-columns",children:[e.jsxs("div",{className:"w6w-data-columns-head",children:[e.jsx("h3",{children:"Columns"}),e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:x,children:"+ Add column"})]}),e.jsx("p",{className:"w6w-muted w6w-small",children:"Each column has a name, a scalar type, whether it must be set, and an optional default."}),s.length===0&&e.jsx("p",{className:"w6w-muted w6w-small",children:"No columns yet."}),s.length>0&&e.jsxs("div",{className:"w6w-data-columns-row w6w-data-columns-colhead","aria-hidden":"true",children:[e.jsx("span",{children:"Name"}),e.jsx("span",{children:"Type"}),e.jsx("span",{}),e.jsx("span",{children:"Default"}),e.jsx("span",{})]}),e.jsx("ul",{className:"w6w-data-columns-list","data-testid":"data-columns",children:s.map((h,j)=>{const w=l[j],C=(w==null?void 0:w.text)??Ae(h.type,h.default);return e.jsxs("li",{className:"w6w-data-columns-row",children:[e.jsx("input",{type:"text",value:h.name,placeholder:"name","aria-label":"Column name",onChange:b=>f(j,{name:b.target.value})}),e.jsx("select",{value:h.type,"aria-label":"Column type",onChange:b=>g(j,b.target.value,C),children:Qe.map(b=>e.jsx("option",{value:b,children:b},b))}),e.jsxs("label",{className:"w6w-data-columns-required",children:[e.jsx("input",{type:"checkbox",checked:h.required,"aria-label":"Required",onChange:b=>f(j,{required:b.target.checked})}),e.jsx("span",{className:"w6w-muted w6w-small",children:"required"})]}),e.jsx("input",{type:"text",value:C,placeholder:"default","aria-label":"Column default",onChange:b=>g(j,h.type,b.target.value)}),e.jsx(m.DeleteButton,{label:`Remove column ${h.name||j+1}`,onClick:()=>u(j)}),(w==null?void 0:w.error)!==void 0&&e.jsx("div",{className:"w6w-result w6w-error w6w-data-columns-error","data-testid":`data-store-column-default-error-${j}`,children:w.error}),h.name!==""&&r[h.name]!==void 0&&e.jsx("div",{className:"w6w-result w6w-error w6w-data-columns-error","data-testid":`data-store-column-error-${h.name}`,children:r[h.name]})]},j)})}),e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Key column"}),e.jsxs("select",{value:d,onChange:h=>i(h.target.value),children:[e.jsx("option",{value:"",children:"(none — rows get generated keys)"}),c.map(h=>e.jsx("option",{value:h.name,children:h.name},h.name))]}),e.jsx("span",{className:"w6w-hint",children:"Only a required, string or integer column can name a row's key."})]})]})}function ua({result:t,busy:s,onImport:n,onRefuse:a,onExport:i}){function r(l){var d;const o=l.target,c=(d=o.files)==null?void 0:d[0];if(c!==void 0){if(o.value="",c.size>Xt){a(ls);return}n(c)}}return e.jsxs("div",{className:"w6w-data-csv-panel","data-testid":"csv-panel",children:[e.jsxs("div",{className:"w6w-data-csv-panel-actions",children:[e.jsx("input",{type:"file",accept:".csv,text/csv","data-testid":"csv-file","aria-label":"Import CSV",onChange:r}),e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"csv-export",disabled:s,onClick:i,children:"Export CSV"})]}),t!==null&&e.jsx("div",{className:t.ok?"w6w-result":"w6w-result w6w-error","data-testid":"csv-result",children:t.message})]})}function wa({rows:t,empty:s,loading:n,searchValue:a,hasMore:i,onOpen:r,onSearch:l,onNew:o,onLoadMore:c}){const[d,x]=y.useState(a??""),f=u=>{u.preventDefault(),l(d)},g=[{key:"key",header:"Key",width:"38%",render:u=>e.jsx("button",{type:"button",className:"w6w-data-entry-key",title:u.key,"data-testid":"entry-key",onClick:h=>{h.stopPropagation(),r(u.key)},children:u.key})},{key:"value",header:"Value",render:u=>u.copyText!==void 0?e.jsx(L.Copyable,{value:u.copyText,label:"Copy value",className:"w6w-copyable--bare",children:e.jsx("span",{className:"w6w-muted w6w-small w6w-data-entry-preview",children:u.preview})}):e.jsx("span",{className:"w6w-muted w6w-small w6w-data-entry-preview",children:u.preview})}];return e.jsxs("div",{children:[e.jsxs("form",{className:"w6w-data-entries-toolbar","data-testid":"entry-search",onSubmit:f,children:[e.jsx("input",{type:"search","data-testid":"entry-prefix",value:d,placeholder:"Key prefix","aria-label":"Key prefix",onChange:u=>x(u.target.value)}),e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"submit",children:"Search"}),e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"entry-new",onClick:o,children:"New entry"})]}),e.jsx(ne,{className:"w6w-data-entry-list",onRowClick:u=>r(u.key),columns:g,rows:t,rowKey:u=>u.key,empty:e.jsx("div",{className:"w6w-muted w6w-small",children:n?"Loading…":s??"No entries match this key prefix."})}),i&&e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"entries-load-more",onClick:c,children:"Load more"})]})}function ma({kind:t,isNew:s,entryKey:n,newKey:a,expiresAt:i,text:r,error:l,conflict:o,saving:c,onTextChange:d,onKeyChange:x,onDelete:f,onSave:g,onCancel:u,onReload:h}){const[j,w]=y.useState(s),[C,b]=y.useState(!1),v=y.useRef(null);y.useEffect(()=>{var R;s||(R=v.current)==null||R.focus()},[s]);const E=t==="doc"?"document":"entry",k=t==="doc"?rs(r):void 0,$=k!==void 0&&!k.ok,O=l||(C&&k&&!k.ok?k.message:null),U=e.jsxs(e.Fragment,{children:[s?e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Key"}),e.jsx("input",{"data-testid":"entry-new-key",value:a??"",placeholder:"Key","aria-label":"Key",onChange:R=>x(R.target.value)})]}):i?e.jsxs("p",{className:"w6w-muted w6w-small",children:["Expires ",i]}):null,t==="doc"?e.jsx(m.JsonEditor,{value:r,readOnly:!j,onChange:R=>{b(!1),d(R)},onFocus:()=>b(!1),onBlur:()=>b(!0),showDiagnostics:C,minHeight:"min(50vh, 400px)",maxHeight:"60vh"}):e.jsx(L.Copyable,{value:r,label:"Copy value",children:e.jsx("input",{type:"text","data-testid":"entry-value",value:r,"aria-label":"Value",readOnly:!j,onChange:R=>d(R.target.value)})}),O&&e.jsx("div",{className:"w6w-field-error",role:"alert","data-testid":"entry-value-error",children:O}),o&&e.jsxs("div",{className:"w6w-error","data-testid":"entry-conflict",children:[st," ",e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"entry-reload",onClick:h,children:"Reload"})]})]});return e.jsxs(m.Modal,{title:s?`New ${E}`:j?`Edit ${E}`:t==="doc"?"Document":"Entry",subtitle:s?void 0:n,size:t==="doc"?"wide":"default",onClose:c?()=>{}:u,children:[e.jsx("div",{className:"w6w-modal-body","data-testid":"entry-editor",children:U}),e.jsxs("div",{className:"w6w-modal-actions",children:[!s&&f&&e.jsx(m.DeleteButton,{label:"Delete entry",className:"w6w-data-entry-delete",disabled:c,onClick:f}),e.jsx("button",{ref:v,className:"w6w-btn w6w-btn-ghost",type:"button",disabled:c,onClick:u,children:j?"Cancel":"Close"}),j?e.jsx("button",{className:"w6w-btn",type:"button","data-testid":"entry-save",disabled:!!o||!!c||$||s&&!(a!=null&&a.trim()),onClick:g,children:"Save"}):e.jsx("button",{className:"w6w-btn",type:"button",disabled:c,onClick:()=>w(!0),children:"Edit"})]})]})}const ye=t=>t.isNew?"new":t.id;function ha({columns:t,keyColumn:s,rows:n,error:a,loading:i,empty:r,searchValue:l,hasMore:o,onCellChange:c,onSave:d,onDelete:x,onReload:f,onAddRow:g,onLoadMore:u,onSearch:h}){const[j,w]=y.useState(l??""),C=v=>{v.preventDefault(),h(j)},b=[...t.map(v=>({key:v.name,header:e.jsxs(e.Fragment,{children:[v.name," ",e.jsx("span",{className:"w6w-muted w6w-small",children:v.type})]}),render:E=>{var $;const k=($=E.cellErrors)==null?void 0:$[v.name];return e.jsxs("div",{className:"w6w-data-cell",children:[e.jsx("input",{"data-row":ye(E),"data-column":v.name,value:E.cells[v.name]??"",readOnly:v.name===s&&!E.isNew,"aria-label":`${v.name} (${v.type})`,onChange:O=>c(E.id,v.name,O.target.value)}),k!==void 0&&e.jsx("div",{className:"w6w-data-cell-error","data-row":ye(E),"data-column":v.name,children:k})]})}})),{key:"actions",header:"",render:v=>e.jsxs("div",{className:"w6w-data-row-actions",children:[e.jsx("span",{className:"w6w-muted w6w-small",children:v.version===null?"":`v${v.version}`}),e.jsx("button",{className:"w6w-btn",type:"button","data-row":ye(v),"data-testid":"row-save",disabled:!v.isNew&&!v.dirty||!!v.conflict,onClick:()=>d(v.id),children:"Save"}),e.jsx(m.DeleteButton,{label:"Delete entry",onClick:()=>x(v.id)}),v.conflict&&e.jsxs("div",{className:"w6w-error","data-row":ye(v),"data-testid":"row-conflict",children:[st," ",e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"row-reload",onClick:()=>f(v.id),children:"Reload"})]})]})}];return e.jsxs("div",{children:[a!=null&&a!==""&&e.jsx("div",{className:"w6w-error","data-testid":"grid-error",children:a}),e.jsxs("form",{className:"w6w-data-entries-toolbar","data-testid":"entry-search",onSubmit:C,children:[e.jsx("input",{type:"search","data-testid":"entry-prefix",value:j,placeholder:"Key prefix","aria-label":"Key prefix",onChange:v=>w(v.target.value)}),e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"submit",children:"Search"}),e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"grid-add-row",onClick:g,children:"Add row"})]}),e.jsx("div",{className:"w6w-data-grid-scroll","data-testid":"data-grid-scroll",children:e.jsx(ne,{columns:b,rows:n,rowKey:v=>v.id,empty:e.jsx("div",{className:"w6w-muted w6w-small",children:i?"Loading…":r??"No rows match this key prefix."})})}),o&&e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"entries-load-more",onClick:u,children:"Load more"})]})}exports.AddConnectionModal=m.AddConnectionModal;exports.ApiCallsPanel=m.ApiCallsPanel;exports.AppIcon=m.AppIcon;exports.AppPicker=m.AppPicker;exports.AuthFieldsForm=m.AuthFieldsForm;exports.CanvasLayer=m.CanvasLayer;exports.CodeEditor=m.CodeEditor;exports.Combobox=m.Combobox;exports.ConfirmModal=m.ConfirmModal;exports.CredentialPicker=m.CredentialPicker;exports.DeleteButton=m.DeleteButton;exports.EmptyState=m.EmptyState;exports.ExpressionEditorModal=m.ExpressionEditorModal;exports.ExpressionInput=m.ExpressionInput;exports.ExpressionOptionsProvider=m.ExpressionOptionsProvider;exports.HTML_PREVIEW_CSP=m.HTML_PREVIEW_CSP;exports.HtmlPreview=m.HtmlPreview;exports.IconButton=m.IconButton;exports.JsonEditor=m.JsonEditor;exports.LastUsedNote=m.LastUsedNote;exports.Markdown=m.Markdown;exports.Modal=m.Modal;exports.NodeConfigForm=m.NodeConfigForm;exports.ParamsForm=m.ParamsForm;exports.PropertyEntryForm=m.PropertyEntryForm;exports.RESULT_RENDER_MAX_CHARS=m.RESULT_RENDER_MAX_CHARS;exports.ResultViewer=m.ResultViewer;exports.RetryPolicyFields=m.RetryPolicyFields;exports.StepBuilderModal=m.StepBuilderModal;exports.W6WUIProvider=m.W6WUIProvider;exports.connectionAppIdsToLookUp=m.connectionAppIdsToLookUp;exports.detectResultFormat=m.detectResultFormat;exports.effectiveNodeOutput=m.effectiveNodeOutput;exports.effectiveNodeOutputs=m.effectiveNodeOutputs;exports.filterOptions=m.filterOptions;exports.findTestInput=m.findTestInput;exports.htmlPreviewSrcDoc=m.htmlPreviewSrcDoc;exports.indexNodeSamples=m.indexNodeSamples;exports.isExprValue=m.isExprValue;exports.isFormResolvedOptions=m.isFormResolvedOptions;exports.isSecretValue=m.isSecretValue;exports.isTestRequired=m.isTestRequired;exports.previewNodeOutputs=m.previewNodeOutputs;exports.rememberableInput=m.rememberableInput;exports.requiredParamsFilled=m.requiredParamsFilled;exports.resolveConnectionAppMeta=m.resolveConnectionAppMeta;exports.resultCopyText=m.resultCopyText;exports.shapeToSkeleton=m.shapeToSkeleton;exports.shouldUseCombobox=m.shouldUseCombobox;exports.splitFrontmatter=m.splitFrontmatter;exports.startOAuthPopup=m.startOAuthPopup;exports.testInputSavesSettled=m.testInputSavesSettled;exports.trackTestInputSave=m.trackTestInputSave;exports.useEnterSubmit=m.useEnterSubmit;exports.useExpressionOptions=m.useExpressionOptions;exports.useRememberedTestInput=m.useRememberedTestInput;exports.useW6WApi=m.useW6WApi;exports.CodeBlock=L.CodeBlock;exports.Copyable=L.Copyable;exports.Icon=L.Icon;exports.iconNames=L.iconNames;exports.ATTENTION_DISPLAY_CAP=Ye;exports.ActionTestForm=Ps;exports.ApiError=ce;exports.BudgetMeter=Fn;exports.CELL_PROBLEM_COPY=Zt;exports.CSV_MAX_BYTES=Xt;exports.CSV_TOO_LARGE_COPY=ls;exports.CallableList=In;exports.ColumnsEditor=da;exports.ConnectionHeader=Mn;exports.ConnectionList=Pn;exports.CopyableText=It;exports.CsvPanel=ua;exports.DATA_STORE_ERROR_FALLBACK=se;exports.DATA_STORE_KINDS=Bn;exports.DATA_STORE_KIND_LABEL=Gt;exports.DATA_STORE_NETWORK_ERROR=es;exports.DOC_VALUE_COPY=Ge;exports.DataEntryEditor=ma;exports.DataEntryList=wa;exports.DataStoreList=ra;exports.DataTable=ne;exports.DataTableGrid=ha;exports.EditButton=Ze;exports.EditConnectionModal=Ln;exports.ExecutionDetail=En;exports.ExecutionFilters=Nn;exports.ExecutionList=rn;exports.ExecutionLogPanel=Ft;exports.ExecutionStats=bn;exports.HealthStatusPill=Se;exports.HistoryTimeline=Qs;exports.InfoTip=en;exports.ListItem=be;exports.NEW_ROW_ID=tt;exports.RECENT_DISPLAY_CAP=Vt;exports.ReliabilityChart=qt;exports.ReliabilityList=_n;exports.RepoSyncIndicator=tn;exports.SCALAR_TYPES=Qe;exports.ServerResourcesBadge=Ws;exports.ServerResourcesCard=Ks;exports.ServerResourcesCardSmall=Js;exports.ServerResourcesRail=Vs;exports.StepStatusPill=Ee;exports.UptimeStrip=Pt;exports.VERSION_CONFLICT_COPY=st;exports.YamlEditor=Ls;exports.buildRowValue=ea;exports.cellErrorsOf=na;exports.createW6WApi=Rs;exports.cropText=Ot;exports.csvFilenameOf=Jn;exports.csvImportMessage=ia;exports.csvLineOf=ze;exports.dirtyColumns=Qn;exports.displayBoard=Wt;exports.draftFromEntry=Xn;exports.errorPlacement=as;exports.formatDurationMs=Te;exports.formatExecutionTime=de;exports.isCellValue=zn;exports.isVersionConflict=aa;exports.kvValueOf=la;exports.kvValueTypeOf=Un;exports.locateDataStoreError=Gn;exports.locateRawResponseError=ns;exports.needsAttention=$n;exports.newRowDraft=Zn;exports.parseCell=$e;exports.parseDocText=rs;exports.partitionBoard=Kt;exports.performancePoints=Ut;exports.remainingTtlSeconds=ta;exports.rowValueOf=is;exports.rowWriteOf=sa;exports.serializeCell=Ae;exports.tableSchemaOf=Kn;exports.uptimeDays=Jt;
1
+ "use client";"use strict";var Fs=Object.defineProperty;var Bs=(t,s,n)=>s in t?Fs(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var we=(t,s,n)=>Bs(t,typeof s!="symbol"?s+"":s,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./connection-app-meta-pnATcKeZ.cjs"),e=require("react/jsx-runtime"),g=require("react"),F=require("./CodeBlock-a2aIm-0b.cjs"),Us=require("@codemirror/lang-yaml"),Ws=require("@codemirror/view"),Js=require("@uiw/react-codemirror");class he extends Error{constructor(n,a,r,i){super(r);we(this,"status");we(this,"code");we(this,"body");this.name="ApiError",this.status=n,this.code=a,this.body=i}}function Vs(t){const s=t.baseUrl.replace(/\/$/,""),n=t.fetch??globalThis.fetch,a=async()=>typeof t.token=="function"?await t.token():t.token;async function r(l,o){const d=new Headers(o==null?void 0:o.headers),c=await a();c&&d.set("authorization",`Bearer ${c}`),o!=null&&o.body&&!d.has("content-type")&&d.set("content-type","application/json");let p;try{p=await n(`${s}${l}`,{...o,headers:d})}catch(m){throw new he(0,"network_error",`Could not reach the w6w server (${(o==null?void 0:o.method)??"GET"} ${s}${l}). It may be down or unreachable. (${m.message})`)}const x=await p.text();let y=null;if(x)try{y=JSON.parse(x)}catch{if(!p.ok)throw new he(p.status,"bad_response",`Server returned a non-JSON ${p.status} response: ${x.slice(0,200)}`)}if(!p.ok){const m=(y==null?void 0:y.error)??{};throw new he(p.status,m.code??"error",m.message??p.statusText,y)}return{status:p.status,data:y}}async function i(l,o){const{data:d}=await r(l,o);return d}return{listApps:async()=>{const l=async()=>{const o=[];let d;for(;;){const c=new URLSearchParams({limit:"200"});d&&c.set("cursor",d);const p=await i(`/apps?${c}`);if(o.push(...p.apps),!p.nextCursor||p.nextCursor===d)return o;d=p.nextCursor}};try{return await l()}catch(o){if(o instanceof he&&(o.code==="snapshot_expired"||o.code==="unknown_snapshot"))return await l();throw o}},listAppsByIds:async l=>{const o=Array.from(new Set(l)),d=[];for(let c=0;c<o.length;c+=100){const x=o.slice(c,c+100).map(encodeURIComponent).join(","),y=await i(`/apps?ids=${x}`);d.push(...y.apps)}return d},getAppAuth:async l=>(await i(`/apps/${encodeURIComponent(l)}/auths`)).auths??[],createConnection:(l,o)=>i(`/apps/${encodeURIComponent(l)}/connections`,{method:"POST",body:JSON.stringify(o)}).then(d=>d.connection),updateConnection:(l,o)=>i(`/connections/${encodeURIComponent(l)}`,{method:"PATCH",body:JSON.stringify(o)}).then(d=>d.connection),listCredentials:l=>{const o=new URLSearchParams;(l==null?void 0:l.contract)!==void 0&&o.set("contract",l.contract),(l==null?void 0:l.appId)!==void 0&&o.set("appId",l.appId),(l==null?void 0:l.authKey)!==void 0&&o.set("authKey",l.authKey);const d=o.toString();return i(`/credentials${d?`?${d}`:""}`).then(c=>c.credentials??[])},createCredential:l=>i("/credentials",{method:"POST",body:JSON.stringify(l)}).then(o=>o.credential),getCredential:l=>i(`/credentials/${encodeURIComponent(l)}`).then(o=>o.credential),rotateCredential:(l,o)=>i(`/credentials/${encodeURIComponent(l)}/rotate`,{method:"POST",body:JSON.stringify(o)}).then(d=>d.credential),setCredentialStatus:(l,o)=>i(`/credentials/${encodeURIComponent(l)}/${o==="disabled"?"disable":"enable"}`,{method:"POST"}).then(d=>d.credential),testCredential:l=>i(`/credentials/${encodeURIComponent(l)}/test`,{method:"POST"}),credentialDependents:l=>i(`/credentials/${encodeURIComponent(l)}/dependents`).then(o=>o.dependents),deleteCredential:async l=>{await i(`/credentials/${encodeURIComponent(l)}`,{method:"DELETE"})},startAppOAuthFlow:(l,o,d)=>i(`/apps/${encodeURIComponent(l)}/oauth-config/${encodeURIComponent(o)}/authorize-url`,{method:"POST",body:JSON.stringify(d)}),getAppActions:l=>i(`/apps/${encodeURIComponent(l)}`).then(o=>o.actions??[]),listConnectionsForApp:l=>i(`/apps/${encodeURIComponent(l)}/connections`).then(o=>o.connections??[]),listConnections:()=>i("/connections").then(l=>l.connections??[]),invokeAction:(l,o,d,c={})=>i(`/apps/${encodeURIComponent(l)}/actions/${encodeURIComponent(o)}/invoke`,{method:"POST",body:JSON.stringify({params:d,connectionId:c.connectionId,project:c.project,state:c.state,workflowId:c.workflowId})}),listSavedTests:l=>i(`/connections/${encodeURIComponent(l)}/saved-tests`).then(o=>o.savedTests??[]),createSavedTest:(l,o)=>i(`/connections/${encodeURIComponent(l)}/saved-tests`,{method:"POST",body:JSON.stringify(o)}).then(d=>d.savedTest),updateSavedTest:(l,o,d)=>i(`/connections/${encodeURIComponent(l)}/saved-tests/${encodeURIComponent(o)}`,{method:"PATCH",body:JSON.stringify(d)}).then(c=>c.savedTest),deleteSavedTest:(l,o)=>i(`/connections/${encodeURIComponent(l)}/saved-tests/${encodeURIComponent(o)}`,{method:"DELETE"}).then(()=>{}),recordTestRun:(l,o)=>i(`/connections/${encodeURIComponent(l)}/test-runs`,{method:"POST",body:JSON.stringify(o)}).then(()=>{}),listTestRuns:l=>i(`/connections/${encodeURIComponent(l)}/test-runs`).then(o=>o.runs??[]),saveStepTest:(l,o,d)=>i(`/workflows/${encodeURIComponent(l)}/steps/${encodeURIComponent(o)}/tests`,{method:"POST",body:JSON.stringify(d)}).then(c=>c.stepTest),listStepTests:(l,o)=>i(`/workflows/${encodeURIComponent(l)}/steps/${encodeURIComponent(o)}/tests`).then(d=>d.stepTests??[]),loadNodeSamples:l=>i(`/workflows/${encodeURIComponent(l)}/node-samples`).then(o=>o.nodeSamples??[]),loadTestInputs:l=>i(`/workflows/${encodeURIComponent(l)}/test-inputs`).then(o=>o.testInputs??[]),saveTestInput:(l,o,d)=>i(`/workflows/${encodeURIComponent(l)}/nodes/${encodeURIComponent(o)}/test-input`,{method:"PUT",body:JSON.stringify({input:d})}).then(()=>{}),recordStepTestRun:(l,o,d)=>i(`/workflows/${encodeURIComponent(l)}/steps/${encodeURIComponent(o)}/test-runs`,{method:"POST",body:JSON.stringify(d)}).then(()=>{}),listFunctions:()=>i("/functions").then(l=>l.functions??[]),getFunction:l=>i(`/functions/${encodeURIComponent(l)}`).then(o=>({...o.function,valid:o.valid})),invokeFunction:(l,o)=>i(`/functions/${encodeURIComponent(l)}/invoke`,{method:"POST",body:JSON.stringify({inputs:o})}).then(d=>d.output),listWorkflows:()=>i("/workflows").then(l=>l.workflows??[]),getWorkflow:l=>i(`/workflows/${encodeURIComponent(l)}`).then(o=>o.workflow),runWorkflow:(l,o={})=>r(`/workflows/${encodeURIComponent(l)}/run?wait=true`,{method:"POST",body:JSON.stringify({variables:o.variables,input:o.input,entry:o.entry})}).then(({status:d,data:c})=>({...c??{},terminal:d===200}))}}function Te({title:t,subtitle:s,icon:n,trailing:a,active:r=!1,onClick:i,href:l,ariaLabel:o}){const d=e.jsxs(e.Fragment,{children:[n!=null&&e.jsx("span",{className:"w6w-list-item-icon",children:n}),e.jsxs("span",{className:"w6w-list-item-body",children:[e.jsx("span",{className:"w6w-list-item-title",children:t}),s!=null&&e.jsx("span",{className:"w6w-list-item-subtitle",children:s})]}),a!=null&&e.jsx("span",{className:"w6w-list-item-trailing",children:a})]}),c=`w6w-list-item${r?" active":""}`;return l!==void 0?e.jsx("a",{className:c,href:l,"aria-current":r?"true":void 0,"aria-label":o,onClick:i,children:d}):i?e.jsx("button",{type:"button",className:c,"aria-pressed":r,"aria-label":o,onClick:i,children:d}):e.jsx("div",{className:c,"aria-label":o,children:d})}function Ue(t){const s=Date.parse(t);if(Number.isNaN(s))return"";const n=Math.max(0,Math.round((Date.now()-s)/1e3));if(n<45)return"just now";const a=Math.round(n/60);if(a<60)return`${a}m ago`;const r=Math.round(a/60);if(r<24)return`${r}h ago`;const i=Math.round(r/24);return i<7?`${i}d ago`:new Date(s).toLocaleDateString()}function Nt(t){const s={};for(const n of(t==null?void 0:t.params)??[])n.key&&n.default!==void 0&&(s[n.key]=n.default);return s}function Ks(t){var n,a,r;const s=t.indexOf("{");if(s>=0)try{const i=JSON.parse(t.slice(s)),l=((a=(n=i==null?void 0:i.errors)==null?void 0:n[0])==null?void 0:a.message)??(typeof(i==null?void 0:i.error)=="object"?(r=i.error)==null?void 0:r.message:i==null?void 0:i.error)??(i==null?void 0:i.message);if(typeof l=="string"&&l.trim()){const o=t.slice(0,s).replace(/[:\s]+$/,"");return o?`${o}: ${l.trim()}`:l.trim()}}catch{}return t}function Bt(t){return typeof t=="object"&&t!==null&&typeof t.status=="number"&&typeof t.code=="string"}function qs(t){if(!Bt(t))return{headline:(t==null?void 0:t.message)??"The action failed to run."};const s=Ks(t.message??""),n=`${t.status} ${t.code} ${t.message??""}`.toLowerCase();return t.status===401||t.status===403||/\b(401|403)\b|forbidden|unauthorized|not authorized|permission|scope|access denied|invalid api key|invalid credential/.test(n)?{headline:"Permission denied by the provider — this is a credential/scope problem, not a w6w error.",hint:"The connection's API key is missing the permissions this action needs. Fix it at the provider — e.g. SendGrid → Settings → API Keys → give the key the required scopes (or Full Access), or create a new key — then update this connection's credential and try again.",detail:s}:{headline:"The action returned an error.",detail:s}}function Hs(t){const s=Bt(t)?t.body??t.raw:null;return(s==null?void 0:s.apiCalls)??[]}function We(){const[t,s]=g.useState(""),[n,a]=g.useState(void 0),[r,i]=g.useState(!1);return{text:t,value:n,invalid:r,onChange:o=>{s(o);const d=o.trim();if(d===""){i(!1);return}try{const c=JSON.parse(d);c!==null&&typeof c=="object"&&!Array.isArray(c)?(a(c),i(!1)):i(!0)}catch{i(!0)}}}}function Ys({appId:t,actions:s,connectionId:n,action:a,seedValues:r,onSavedTestsChanged:i,seedTestId:l,onDirtyChange:o,onTestSaved:d,onDeleted:c,embedded:p=!1}){var vt;const x=w.useW6WApi(),y=g.useMemo(()=>{const f=[...s];return f.sort((O,K)=>(O.title||O.key).localeCompare(K.title||K.key)),f},[s]),[m,h]=g.useState((a==null?void 0:a.key)??""),j=a??s.find(f=>f.key===m)??null,[u,N]=g.useState(!1),[b,v]=g.useState(null),[T,S]=g.useState(void 0),[$,E]=g.useState([]),L=We(),_=We(),R=We(),[B,se]=g.useState(""),[P,H]=g.useState(""),k=L.invalid||_.invalid||R.invalid,M=()=>{const f={};return L.text.trim()!==""&&L.value!==void 0&&(f.body=L.value),_.text.trim()!==""&&_.value!==void 0&&(f.query=_.value),R.text.trim()!==""&&R.value!==void 0&&(f.headers=R.value),B&&(f.target=B),P.trim()!==""&&(f.match=P.trim()),Object.keys(f).length>0?f:void 0},[I,U]=g.useState("form"),[ce,z]=g.useState(""),[G,de]=g.useState(!1),[Y,ge]=g.useState(!1),J=(j==null?void 0:j.key)??null,je=r?{...r}:Nt(j),[ne,C]=g.useState(()=>({key:J,values:je})),[A,D]=g.useState(l??null),[V,ae]=g.useState(je);if(ne.key!==J){const f=Nt(j);C({key:J,values:f}),ae(f),D(l??null),v(null),S(void 0),E([])}const[W,re]=g.useState(l);l!==W&&(re(l),D(l??null));const[ut,Ns]=g.useState(r);if(r!==ut){const f=JSON.stringify(r??null)!==JSON.stringify(ut??null);if(Ns(r),r&&f){const O={...r};C({key:J,values:O}),ae(O),v(null),S(void 0),E([])}}const Z=ne.values,wt=f=>C({key:J,values:f}),mt=g.useMemo(()=>JSON.stringify(Z)!==JSON.stringify(V),[Z,V]);g.useEffect(()=>{o==null||o(mt)},[mt]);const ks=()=>{z(JSON.stringify(Z,null,2)),de(!1),U("json")},Cs=async f=>{if(!j||k)return;const O=j.key;N(!0),v(null),S(void 0),E([]);let K;const ie=M();try{const Q=await x.invokeAction(t,O,f,{connectionId:n,...ie?{overrides:ie}:{}});S(Q.value),E(Q.apiCalls??[]),K={ok:!0,summary:"OK",result:Q.value}}catch(Q){const bt=qs(Q);v(bt),E(Hs(Q)),K={ok:!1,summary:bt.headline}}finally{N(!1)}if(n)try{await x.recordTestRun(n,{savedTestId:A??null,actionKey:O,ok:K.ok,summary:K.summary.slice(0,200),result:K.result}),Fe(),Is(),i==null||i()}catch{}},Ss=()=>Cs(Z),[ye,ht]=g.useState(null),[ve,ue]=g.useState(null),[Es,Ts]=g.useState(0),[$s,be]=g.useState(!1),[Le,Me]=g.useState(""),[Rs,De]=g.useState(!1),Fe=()=>Ts(f=>f+1);g.useEffect(()=>{if(!n){ht(null);return}let f=!1;return ue(null),x.listSavedTests(n).then(O=>!f&&ht(O)).catch(O=>!f&&ue(O.message)),()=>{f=!0}},[x,n,Es]);const pt=J?(ye??[]).filter(f=>f.actionKey===J):[],[As,Be]=g.useState(null),[Os,_s]=g.useState(0),Is=()=>_s(f=>f+1);g.useEffect(()=>{const f=x.listTestRuns;if(!n||!f){Be(null);return}let O=!1;return f(n).then(K=>!O&&Be(K)).catch(()=>!O&&Be(null)),()=>{O=!0}},[x,n,Os]);const xt=J?(As??[]).filter(f=>f.actionKey===J).slice().sort((f,O)=>Date.parse(O.occurredAt)-Date.parse(f.occurredAt)):[],Ps=()=>{!n||!j||(Me(""),ue(null),be(!0))},Ls=()=>{!n||!j||(A?ft():Ps())},ft=async()=>{if(!(!n||!j))try{let f;if(A)f=await x.updateSavedTest(n,A,{values:Z});else{const O=Le.trim();if(!O)return;f=await x.createSavedTest(n,{actionKey:j.key,name:O,values:Z}),D(f.id)}ae({...Z}),be(!1),Me(""),Fe(),i==null||i(),d==null||d(f)}catch(f){ue(f.message)}},Ms=f=>{const O={...f.values};C({key:J,values:O}),ae(O),D(f.id),U("form"),v(null),S(void 0),E([])},Ds=async()=>{if(!n||!A)return;const f=A;try{await x.deleteSavedTest(n,f),D(null),Fe(),i==null||i(),c==null||c(f)}catch(O){ue(O.message)}},gt=e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-1-5)"},children:[e.jsxs("div",{className:"w6w-field-labelrow",style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{className:"w6w-muted w6w-small",children:"Parameters"}),e.jsxs("div",{style:{display:"flex",gap:"var(--w6w-sp-1)"},children:[e.jsx("button",{type:"button",className:`w6w-btn w6w-btn-sm w6w-btn-ghost${I==="form"?" active":""}`,"aria-pressed":I==="form",onClick:()=>U("form"),children:"Form"}),e.jsx("button",{type:"button",className:`w6w-btn w6w-btn-sm w6w-btn-ghost${I==="json"?" active":""}`,"aria-pressed":I==="json",onClick:ks,children:"JSON"}),!p&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-sm w6w-btn-ghost","aria-pressed":Y,title:Y?"Collapse the params editor":"Open the params editor in a larger view","aria-label":Y?"Collapse the params editor":"Open the params editor in a larger view",onClick:()=>ge(f=>!f),children:Y?"⤡":"⤢"})]})]}),I==="form"?e.jsx(w.ParamsForm,{params:(j==null?void 0:j.params)??[],values:Z,onChange:wt,dynamic:j?{appId:t,actionKey:j.key,connectionId:n}:void 0}):e.jsxs(e.Fragment,{children:[e.jsx(w.JsonEditor,{value:ce,onChange:z,minHeight:Y?"50vh":"200px","aria-label":"Params JSON",onValidChange:f=>{f!==null&&typeof f=="object"&&!Array.isArray(f)&&wt(f)},onValidityChange:({valid:f})=>de(!f)}),G&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:"Invalid JSON"})]})]}),jt=e.jsxs("details",{className:"w6w-section","data-testid":"overrides-region",children:[e.jsxs("summary",{className:"w6w-section-summary",children:[e.jsx("span",{className:"w6w-section-title",children:"Overrides"}),e.jsx("span",{className:"w6w-section-subtitle",children:"Reach a vendor field this action's own params don't declare"})]}),e.jsxs("div",{className:"w6w-stack w6w-section-body",style:{gap:"var(--w6w-sp-2)"},children:[e.jsxs("div",{className:"w6w-field",children:[e.jsx("span",{children:"Body"}),e.jsx(w.JsonEditor,{value:L.text,onChange:L.onChange,minHeight:"80px","aria-label":"Overrides body (JSON)"}),L.invalid&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:"Invalid JSON"})]}),e.jsxs("div",{className:"w6w-field",children:[e.jsx("span",{children:"Query"}),e.jsx(w.JsonEditor,{value:_.text,onChange:_.onChange,minHeight:"80px","aria-label":"Overrides query (JSON)"}),_.invalid&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:"Invalid JSON"})]}),e.jsxs("div",{className:"w6w-field",children:[e.jsx("span",{children:"Headers"}),e.jsx(w.JsonEditor,{value:R.text,onChange:R.onChange,minHeight:"80px","aria-label":"Overrides headers (JSON)"}),R.invalid&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:"Invalid JSON"})]}),e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Target"}),e.jsxs("select",{"aria-label":"Overrides target",value:B,onChange:f=>se(f.target.value),children:[e.jsx("option",{value:"",children:"— default (first) —"}),e.jsx("option",{value:"first",children:"first"}),e.jsx("option",{value:"first-write",children:"first-write"}),e.jsx("option",{value:"all",children:"all"})]})]}),e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Match"}),e.jsx("input",{type:"text","aria-label":"Overrides match",value:P,placeholder:"Restrict to requests whose URL contains…",onChange:f=>H(f.target.value)})]}),e.jsx("span",{className:"w6w-hint",children:"Merged onto the outbound request at the wire, never into the params above — name a field the way the vendor's own API documents it."})]})]}),Ne=n?e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-1-5)"},children:[e.jsx("div",{className:"w6w-field-labelrow",style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:e.jsx("span",{className:"w6w-muted w6w-small",children:"Saved tests"})}),ve&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:ve}),pt.length===0?e.jsx("p",{className:"w6w-muted w6w-small",children:"No saved tests for this action yet."}):e.jsx("ul",{className:"w6w-stack",style:{listStyle:"none",margin:0,padding:0,gap:"var(--w6w-sp-1-5)"},children:pt.map(f=>e.jsx("li",{children:e.jsx(Te,{title:f.name,subtitle:f.lastRunAt?e.jsxs("span",{children:[e.jsx("span",{style:{color:f.lastRunOk?"var(--w6w-success)":"var(--w6w-danger)"},children:f.lastRunOk?"✓":"✗"})," ",f.lastRunSummary?`${f.lastRunSummary} · `:"",Ue(f.lastRunAt)]}):`saved ${Ue(f.updatedAt)}`,active:f.id===A,onClick:()=>Ms(f)})},f.id))}),x.listTestRuns&&xt.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w6w-field-labelrow",style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:e.jsx("span",{className:"w6w-muted w6w-small",children:"Recent runs"})}),e.jsx("ul",{className:"w6w-stack",style:{listStyle:"none",margin:0,padding:0,gap:"var(--w6w-sp-1-5)"},children:xt.map(f=>e.jsx("li",{children:e.jsx(Te,{title:e.jsxs("span",{children:[e.jsx("span",{style:{color:f.ok?"var(--w6w-success)":"var(--w6w-danger)"},children:f.ok?"✓":"✗"})," ",f.actionKey]}),subtitle:e.jsxs("span",{children:[f.summary?`${f.summary} · `:"",Ue(f.occurredAt)]})})},f.id))})]})]}):null,yt=(vt=ye==null?void 0:ye.find(f=>f.id===A))==null?void 0:vt.name;return e.jsxs("div",{className:`w6w-stack${p?" w6w-tester-embedded-root":""}`,children:[!a&&(s.length===0?e.jsx("p",{className:"w6w-muted w6w-small",children:"This app exposes no actions."}):e.jsxs("label",{className:"w6w-field",children:[e.jsxs("span",{children:["Action",J?"":" *"]}),e.jsx(w.Combobox,{value:m,placeholder:"— pick an action —",onChange:h,options:y.map(f=>({value:f.key,label:`${f.title??f.key} (${f.key})`}))})]})),j?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("strong",{children:[j.title??j.key," ",e.jsx("code",{className:"w6w-muted",children:j.key})]}),j.description&&e.jsx("p",{className:"w6w-muted w6w-small",style:{margin:"var(--w6w-sp-0-5) 0 0"},children:j.description})]}),(()=>{const f=b?e.jsxs("div",{className:"w6w-result w6w-error",children:[e.jsx("strong",{children:b.headline}),b.hint&&e.jsx("div",{style:{marginTop:"var(--w6w-sp-1-5)"},children:b.hint}),b.detail&&e.jsx("div",{className:"w6w-muted w6w-small",style:{marginTop:"var(--w6w-sp-1-5)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:b.detail})]}):null,O=T!==void 0?e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-1)"},children:[e.jsx("strong",{className:"w6w-small",children:"Result"}),e.jsx(w.ResultViewer,{value:T})]}):null,K=e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},children:[gt,jt,f,O,e.jsx(w.ApiCallsPanel,{calls:$})]}),ie=e.jsxs("div",{className:`w6w-tester-actions${p||Y?" w6w-tester-actions-footer":""}`,style:{display:"flex",gap:"var(--w6w-sp-2)"},children:[e.jsx("button",{type:"button",className:"w6w-btn",disabled:u||k,onClick:Ss,children:u?"Running…":"Run action"}),n&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:Ls,children:"Save test"}),n&&A&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",style:{marginLeft:"auto",color:"var(--w6w-danger)"},onClick:()=>De(!0),children:"Delete"})]}),Q=e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},children:[K,ie]});return p?e.jsxs("div",{className:"w6w-tester-embedded",children:[e.jsx("div",{className:"w6w-tester-embedded-scroll",children:e.jsxs("div",{className:"w6w-card-stack",children:[e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-head",children:e.jsx("h3",{children:"Parameters"})}),e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},children:[gt,jt,f]})]}),(O||$.length>0)&&e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-head",children:e.jsx("h3",{children:"Result"})}),e.jsxs("div",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},children:[T!==void 0&&e.jsx(w.ResultViewer,{value:T}),e.jsx(w.ApiCallsPanel,{calls:$})]})]}),Ne&&e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"section-head",children:e.jsx("h3",{children:"Saved tests and history"})}),Ne]})]})}),ie]}):Y?e.jsx(w.Modal,{title:`Edit params — ${j.title??j.key}`,onClose:()=>ge(!1),size:"full",children:e.jsxs("div",{className:"w6w-tester-popout",children:[e.jsx("div",{className:"w6w-tester-popout-scroll",children:Ne?e.jsxs("div",{style:{display:"flex",gap:"var(--w6w-sp-4)",alignItems:"flex-start"},children:[e.jsx("div",{style:{flex:1,minWidth:0},children:K}),e.jsx("div",{style:{width:260,flexShrink:0},children:Ne})]}):K}),ie]})}):Q})(),$s&&e.jsx(w.Modal,{title:"Save test",onClose:()=>be(!1),children:e.jsxs("form",{className:"w6w-stack",style:{gap:"var(--w6w-sp-3)"},onSubmit:f=>{f.preventDefault(),ft()},children:[e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Name this saved test"}),e.jsx("input",{type:"text",value:Le,placeholder:"e.g. valid sender",onChange:f=>Me(f.target.value)})]}),ve&&e.jsx("span",{className:"w6w-hint",style:{color:"var(--w6w-danger)"},children:ve}),e.jsxs("div",{style:{display:"flex",gap:"var(--w6w-sp-2)",justifyContent:"flex-end"},children:[e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:()=>be(!1),children:"Cancel"}),e.jsx("button",{type:"submit",className:"w6w-btn",disabled:!Le.trim(),children:"Save"})]})]})}),Rs&&e.jsx(w.ConfirmModal,{title:"Delete saved test",message:yt?`Delete "${yt}"? This cannot be undone.`:"Delete this saved test? This cannot be undone.",confirmLabel:"Delete",onConfirm:()=>{De(!1),Ds()},onClose:()=>De(!1)})]}):!a&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Pick an action above to test it."})]})}function zs(t){const s=w.useEffectiveTheme(t.theme),{copied:n,copy:a}=F.useCopyToClipboard(t.value),r=g.useMemo(()=>[Us.yaml(),Ws.EditorView.theme(w.EDITOR_THEME_SPEC)],[]);function i(l){t.onChange(l)}return e.jsxs("div",{className:"w6w-yaml-editor","aria-label":t["aria-label"]??"YAML editor",children:[e.jsx(Js,{value:t.value,onChange:i,extensions:r,placeholder:t.placeholder,readOnly:t.readOnly,editable:!t.readOnly,theme:s,height:t.height,minHeight:t.minHeight??"240px",maxHeight:t.maxHeight,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!t.readOnly,autocompletion:!0,bracketMatching:!0,closeBrackets:!0}}),t.copyable!==!1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:`w6w-icon-btn w6w-copyable-btn${n?" is-copied":""}`,"aria-label":"Copy",onClick:()=>void a(),children:n?e.jsx(F.CheckGlyph,{}):e.jsx(F.CopyGlyph,{})}),e.jsx("span",{className:"w6w-copyable-status","aria-live":"polite",children:n?"Copied":""})]})]})}const Je="…";function Ut(t,s,n="end"){if(s===void 0||s<1||s>=t.length)return t;if(n==="start")return`${Je}${t.slice(t.length-s)}`;if(n==="end")return`${t.slice(0,s)}${Je}`;const a=Math.ceil(s/2),r=s-a;return`${t.slice(0,a)}${Je}${t.slice(t.length-r)}`}function Wt(t){const{value:s,chars:n,crop:a="end",label:r,className:i,copiedMs:l}=t,o=Ut(s,n,a),d=["w6w-copyable--bare",i].filter(Boolean).join(" ");return e.jsx(F.Copyable,{value:s,readOnly:!0,label:r,className:d,copiedMs:l,children:e.jsx("span",{children:o})})}const Gs={ok:"Operational",degraded:"Degraded",down:"Down",unknown:"Unknown"};function Ae({state:t,label:s,ariaLabel:n}){const a=s??Gs[t];return e.jsxs("span",{className:`w6w-health-pill w6w-health-pill-${t}`,"aria-label":n,children:[e.jsx("span",{className:"w6w-health-pill-dot","aria-hidden":"true"}),e.jsx("span",{className:"w6w-health-pill-label",children:a})]})}const Xs={ok:"Operational",degraded:"Degraded",down:"Down",unknown:"Unknown"};function Jt({days:t,ariaLabel:s}){return t.length===0?null:e.jsx("div",{className:"w6w-uptime-strip",role:"img","aria-label":s??`${t.length}-day status`,children:t.map((n,a)=>e.jsx("span",{className:`w6w-uptime-cell w6w-uptime-cell-${n.state}`,title:n.label??`${n.day} — ${Xs[n.state]}`},`${n.day}-${a}`))})}const Vt="—",kt=["B","KiB","MiB","GiB","TiB","PiB"];function Kt(t){if(t===null||!Number.isFinite(t))return Vt;if(t<1024)return`${Math.round(t)} B`;let s=t,n=0;for(;s>=1024&&n<kt.length-1;)s/=1024,n+=1;return`${s.toFixed(1)} ${kt[n]}`}function te(t){return t===null||!Number.isFinite(t)?Vt:`${Math.round(t*100)}%`}function xe(t){if(t===void 0||t.load1===null)return null;const s=t.cpuLimit??t.cpus;return s===null||s<=0?null:t.load1/s}function fe(t){if(t===void 0)return null;const{memoryTotal:s,memoryAvailable:n}=t;return s===null||n===null||s<=0?null:(s-n)/s}function Zs(t,s,n){return t<s?s:t>n?n:t}function Qs(t,s,n,a){const r=t.length;if(r<2)return"";const i=[];for(let l=0;l<r;l++){const o=t[l];if(o===null)continue;const d=l/(r-1)*s,c=a<=0?n:n-Zs(o,0,a)/a*n;i.push(`${Number(d.toFixed(2))},${Number(c.toFixed(2))}`)}return i.join(" ")}const en="—",Ct=100,St=24;function ze({values:t,max:s,className:n}){const a=Qs(t,Ct,St,s);return a===""?null:e.jsx("svg",{className:n,viewBox:`0 0 ${Ct} ${St}`,preserveAspectRatio:"none","aria-hidden":"true",focusable:"false",children:e.jsx("polyline",{points:a,fill:"none",stroke:"var(--w6w-accent)",strokeWidth:2,vectorEffect:"non-scaling-stroke"})})}function Ve(t){return t===null?en:t.toFixed(2)}function $e(t){let s=1;for(const n of t)n!==null&&n>s&&(s=n);return s}function Se({label:t,value:s,values:n,max:a}){return e.jsxs("li",{className:"w6w-server-resources__row",children:[e.jsx("span",{className:"w6w-server-resources__label",children:t}),e.jsx("span",{className:"w6w-server-resources__value",children:s}),e.jsx(ze,{className:"w6w-server-resources__spark",values:n,max:a})]})}function et(t){const s=t[t.length-1],n=t.map(i=>xe(i)),a=t.map(i=>fe(i)),r=t.map(i=>i.processRss);return{last:s,cpuValues:n,memoryValues:a,rssValues:r}}function tn({samples:t,title:s="Server resources",intervalMs:n}){const{last:a,cpuValues:r,memoryValues:i,rssValues:l}=et(t);return e.jsxs("section",{className:"w6w-server-resources w6w-server-resources--card","aria-label":s,children:[e.jsx("h3",{className:"w6w-server-resources__title",children:s}),e.jsxs("ul",{className:"w6w-server-resources__rows",children:[e.jsx(Se,{label:"CPU",value:te(xe(a)),values:r,max:$e(r)}),e.jsx(Se,{label:"Memory",value:te(fe(a)),values:i,max:1}),e.jsx(Se,{label:"Process",value:Kt((a==null?void 0:a.processRss)??null),values:l,max:$e(l)})]}),e.jsx("p",{className:"w6w-server-resources__meta",children:`Load ${Ve((a==null?void 0:a.load1)??null)} / ${Ve((a==null?void 0:a.load5)??null)} / ${Ve((a==null?void 0:a.load15)??null)}`}),n!==void 0&&e.jsx("p",{className:"w6w-server-resources__meta",children:`Sampled every ${n/1e3}s`})]})}function sn({samples:t,title:s="Server"}){const{last:n,cpuValues:a}=et(t);return e.jsxs("section",{className:"w6w-server-resources w6w-server-resources--small","aria-label":s,children:[e.jsx("h3",{className:"w6w-server-resources__title",children:s}),e.jsxs("ul",{className:"w6w-server-resources__rows",children:[e.jsx(Se,{label:"CPU",value:te(xe(n)),values:a,max:$e(a)}),e.jsxs("li",{className:"w6w-server-resources__row",children:[e.jsx("span",{className:"w6w-server-resources__label",children:"Memory"}),e.jsx("span",{className:"w6w-server-resources__value",children:te(fe(n))})]})]})]})}function nn({samples:t,onExpand:s}){const{last:n,cpuValues:a,memoryValues:r}=et(t);return e.jsxs("aside",{className:"w6w-server-resources w6w-server-resources--rail",children:[e.jsxs("div",{className:"w6w-server-resources__rail-row",children:[e.jsx("span",{className:"w6w-server-resources__label",children:"CPU"}),e.jsx("span",{className:"w6w-server-resources__value",children:te(xe(n))}),e.jsx(ze,{className:"w6w-server-resources__spark",values:a,max:$e(a)})]}),e.jsxs("div",{className:"w6w-server-resources__rail-row",children:[e.jsx("span",{className:"w6w-server-resources__label",children:"MEM"}),e.jsx("span",{className:"w6w-server-resources__value",children:te(fe(n))}),e.jsx(ze,{className:"w6w-server-resources__spark",values:r,max:1})]}),s!==void 0&&e.jsx("button",{type:"button",className:"w6w-server-resources__expand","aria-label":"Show server resources",onClick:s,children:"Details"})]})}function an({samples:t}){const s=t[t.length-1],n=te(xe(s)),a=te(fe(s));return e.jsx("span",{className:"w6w-server-resources w6w-server-resources--badge",children:`CPU ${n} · MEM ${a}`})}const ln=1,rn=1440*60*1e3;function on(t,s,n){const a=s.startedAt??s.updatedAt;if(a===void 0)return null;const r=Date.parse(a),i=s.resolvedAt!==void 0?Date.parse(s.resolvedAt):s.startedAt!==void 0?n:r,l=Date.parse(`${t.from}T00:00:00.000Z`),o=Date.parse(`${t.to}T00:00:00.000Z`)+rn,d=o-l;if(i<l||r>=o)return null;const c=r<l,p=i>o,x=Math.max(r,l),y=Math.min(i,o),m=(x-l)/d*100,h=(y-x)/d*100,j=Math.max(h,ln);return{leftPct:m,widthPct:j,clippedStart:c,clippedEnd:p}}const cn={ok:"Operational",degraded:"Degraded",down:"Down",unknown:"Unknown"},dn="This vendor publishes no incident history.",un="No incidents in this window.";function wn(t){const s=t.startedAt??t.updatedAt,n=[t.title];return t.components!==void 0&&t.components.length>0&&n.push(`(${t.components.join(", ")})`),s!==void 0&&n.push(t.resolvedAt!==void 0?`${s} – ${t.resolvedAt}`:`${s} – ongoing`),n.join(" ")}function mn({window:t,days:s,incidents:n,vendorEmptyLabel:a,nowMs:r=Date.now(),ariaLabel:i}){const l=s.length,o=l>0?100/l:0,d=n===void 0?a??dn:n.length===0?a??un:null;return e.jsx("div",{className:"w6w-history-timeline",role:"img","aria-label":i??`${l}-day history`,children:e.jsxs("div",{className:"w6w-history-plot",children:[e.jsx("div",{className:"w6w-history-lane w6w-history-lane-execution",children:s.map((c,p)=>e.jsx("span",{className:`w6w-history-cell w6w-history-cell-${c.state}`,style:{left:`${p*o}%`,width:`${o}%`},title:c.label??`${c.day} — ${cn[c.state]}`},`${c.day}-${p}`))}),e.jsx("div",{className:"w6w-history-lane w6w-history-lane-vendor",children:d!==null?e.jsx("span",{className:"w6w-history-empty",title:d,children:d}):n==null?void 0:n.map((c,p)=>{const x=on(t,c,r);if(x===null)return null;const y=[x.clippedStart?"w6w-history-bar-clip-start":"",x.clippedEnd?"w6w-history-bar-clip-end":""].filter(Boolean).join(" ");return e.jsx("span",{className:`w6w-history-bar w6w-history-bar-${c.state}${y?` ${y}`:""}`,style:{left:`${x.leftPct}%`,width:`${x.widthPct}%`},title:wn(c)},c.id??`${c.title}-${p}`)})}),e.jsxs("div",{className:"w6w-history-axis",children:[e.jsx("span",{className:"w6w-history-tick w6w-history-tick-start",style:{left:"0%"},children:t.from}),e.jsx("span",{className:"w6w-history-tick w6w-history-tick-end",style:{left:"100%"},children:t.to})]})]})})}function hn({label:t,children:s,className:n}){const[a,r]=g.useState(!1),i=g.useId();return e.jsxs("span",{className:["w6w-info-tip",n??""].filter(Boolean).join(" "),children:[e.jsx(w.IconButton,{label:t,icon:"info","aria-expanded":a,"aria-controls":i,onClick:()=>r(l=>!l)}),a&&e.jsx("span",{id:i,className:"w6w-info-tip-body w6w-muted w6w-small",children:s})]})}function tt(t){const{label:s,onClick:n,disabled:a,className:r,...i}=t;return e.jsx(w.IconButton,{label:s,onClick:n,disabled:a,className:r,icon:"edit","data-testid":i["data-testid"]})}function pn(t){const{branch:s,shortSha:n,lastSyncLabel:a,onSyncNow:r,syncing:i,className:l,...o}=t,[d,c]=g.useState(!1),p=g.useRef(null);return g.useEffect(()=>{if(!d)return;const x=m=>{p.current&&!p.current.contains(m.target)&&c(!1)},y=m=>m.key==="Escape"&&c(!1);return document.addEventListener("mousedown",x),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y)}},[d]),e.jsxs("div",{className:`w6w-repo-sync${l?` ${l}`:""}`,ref:p,"data-testid":o["data-testid"],children:[e.jsxs("button",{type:"button",className:"w6w-repo-sync-trigger","aria-haspopup":"menu","aria-expanded":d,"aria-busy":i,onClick:()=>c(x=>!x),children:[e.jsxs("span",{className:"w6w-repo-sync-icon",children:[e.jsx(F.Icon,{name:"github"}),i&&e.jsx(F.Icon,{name:"sync",size:10,className:"w6w-repo-sync-spin"})]}),e.jsx("span",{className:"w6w-repo-sync-branch",children:s}),n!=null&&e.jsx("code",{className:"w6w-repo-sync-sha",children:n})]}),d&&e.jsxs("div",{className:"w6w-repo-sync-menu",role:"menu",children:[e.jsxs("div",{className:"w6w-repo-sync-detail",children:[e.jsx("span",{children:s}),n!=null&&e.jsx("code",{children:n}),a!=null&&e.jsx("span",{children:a})]}),e.jsx("button",{type:"button",role:"menuitem",className:"w6w-repo-sync-item","data-testid":"repo-sync-now",disabled:i,onClick:r,children:i?"Syncing…":"Sync now"})]})]})}const xn={pending:"Pending",running:"Running",succeeded:"Succeeded",failed:"Failed",skipped:"Skipped",queued:"Queued",canceled:"Canceled"};function Oe({state:t,label:s,ariaLabel:n}){const a=s??xn[t];return e.jsxs("span",{className:`w6w-step-pill w6w-step-pill-${t}`,"aria-label":n,children:[e.jsx("span",{className:"w6w-step-pill-dot","aria-hidden":"true"}),e.jsx("span",{className:"w6w-step-pill-label",children:a})]})}const fn="—",Ke=1e3,qe=6e4;function _e(t){return t==null||!Number.isFinite(t)||t<0?fn:t<Ke?`${Math.round(t)} ms`:t<qe?`${(t/Ke).toFixed(1)} s`:`${Math.floor(t/qe)}m ${Math.round(t%qe/Ke)}s`}function pe(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}const gn={function:"Function",endpoint:"Endpoint",workflow:"Workflow"},jn={manual:"Manual",schedule:"Schedule",webhook:"Webhook",event:"Event",replay:"Replay"};function Et(t){if(!t.trigger)return null;const s=jn[t.trigger]??t.trigger;return t.triggerNodeId?`${s} · ${t.triggerNodeId}`:s}function yn({items:t,selectedId:s=null,onSelect:n,showCallable:a=!1,loading:r=!1,emptyLabel:i,hasPrev:l,hasNext:o,onPrev:d,onNext:c,onRerun:p,rerunningId:x=null}){const y=d||c?e.jsxs("div",{className:"w6w-execution-list-pager",children:[e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":"execution-list-prev",disabled:!l,onClick:d,children:"Previous"}),e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":"execution-list-next",disabled:!o,onClick:c,children:"Next"})]}):null;let m;return r&&t.length===0?m=e.jsx("p",{"data-testid":"execution-list-loading",children:"Loading…"}):t.length===0?m=e.jsx("p",{"data-testid":"execution-list-empty",children:i??"No executions yet."}):m=e.jsx("ul",{className:"w6w-execution-list-rows",children:t.map(h=>e.jsxs("li",{"data-testid":"execution-row","data-execution-id":h.id,children:[e.jsx(Te,{icon:e.jsx(Oe,{state:h.status}),title:e.jsxs(e.Fragment,{children:[a?h.callableName:pe(h.startedAt),h.rerunOf&&e.jsx("span",{className:"w6w-execution-rerun-tag","data-testid":"execution-row-rerun-tag",title:`Re-run of ${h.rerunOf}`,children:"Re-run"})]}),subtitle:e.jsxs(e.Fragment,{children:[a?`${gn[h.kind]} · ${pe(h.startedAt)}`:h.id,Et(h)&&e.jsx("span",{className:"w6w-execution-trigger","data-testid":"execution-row-trigger",children:` · ${Et(h)}`}),h.inputPreview&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("code",{className:"w6w-execution-input-preview","data-testid":"execution-row-input",title:h.inputPreview,children:h.inputPreview})]})]}),trailing:_e(h.durationMs),active:h.id===s,onClick:n?()=>n(h.id):void 0}),p&&e.jsx(w.IconButton,{icon:"sync",label:"Re-run",title:h.id===x?"Re-running…":"Re-run with the same input",className:"w6w-execution-list-rerun","data-testid":"execution-row-rerun",disabled:x!==null,onClick:()=>p(h.id)})]},h.id))}),e.jsxs("div",{className:"w6w-execution-list","data-testid":"execution-list",children:[m,y]})}function vn(t){const s=w.internalNodeDef(t.app,t.action);return{trigger:t.trigger===!0||(s==null?void 0:s.group)==="trigger",appName:t.appName??(s==null?void 0:s.displayName)??t.app,actionName:t.actionName??(s==null?void 0:s.label)??t.action}}function qt(t){const s=n=>{for(const a of[n.startedAt,n.finishedAt]){const r=Date.parse(a??"");if(Number.isFinite(r))return r}return Number.POSITIVE_INFINITY};return t.map(n=>({step:n,time:s(n)})).sort((n,a)=>n.time===a.time?0:n.time-a.time).map(({step:n})=>n)}function Ht({steps:t,emptyLabel:s,onDismiss:n,runError:a,stepErrors:r}){const i=n?e.jsx("div",{className:"w6w-execution-log-head",children:e.jsx(w.IconButton,{label:"Dismiss run log","data-testid":"execution-log-dismiss",onClick:n,children:"×"})}):null,l=r??[],o=a||l.length>0?e.jsxs("div",{className:"w6w-execution-log-errors w6w-stack",children:[a&&e.jsx(Ge,{error:a}),l.map((x,y)=>e.jsx(Ge,{label:x.label??x.stepId,error:x.error},`${x.stepId}:${y}`))]}):null,d=qt(t.filter(x=>!Tt(x))),c=t.filter(Tt),p=c.length>0?e.jsx(Nn,{steps:c}):null;return d.length===0?e.jsxs(e.Fragment,{children:[i,o,e.jsx("div",{className:"w6w-execution-log-empty",children:e.jsx("p",{className:"w6w-muted w6w-small",children:s??"No nodes have run yet."})}),p]}):e.jsxs(e.Fragment,{children:[i,o,e.jsx("ol",{className:"w6w-execution-log",children:d.map(x=>e.jsx(Yt,{step:x},x.id))}),p]})}const Tt=t=>t.status==="skipped"&&t.skipReason==="not_on_path",bn={condition:"condition false",stopped:"run stopped",disabled:"disabled"};function Nn({steps:t}){const s=t.length;return e.jsxs("details",{className:"w6w-execution-log-off-path","data-testid":"execution-log-off-path",children:[e.jsx("summary",{className:"w6w-muted w6w-small",children:`${s} ${s===1?"step":"steps"} on other paths, not part of this run`}),e.jsx("ul",{className:"w6w-muted w6w-small",children:t.map(n=>e.jsx("li",{children:n.label??n.id},n.id))})]})}function Yt({step:t,defaultOpen:s=!1}){var c,p;const[n,a]=g.useState(s),r=t.node?vn(t.node):null,i=e.jsxs("div",{className:"w6w-execution-log-row-header",children:[e.jsx(Oe,{state:t.status}),r&&e.jsx("span",{className:`w6w-execution-log-kind${r.trigger?" w6w-execution-log-kind-trigger":""}`,"data-testid":"execution-log-kind",children:r.trigger?"Trigger":"Node"}),e.jsxs("span",{className:"w6w-execution-log-row-title",children:[e.jsx("span",{className:"w6w-execution-log-row-label",children:t.label??t.id}),r&&e.jsx("span",{className:"w6w-execution-log-row-uses","data-testid":"execution-log-uses",children:r.appName===r.actionName?r.appName:`${r.appName} · ${r.actionName}`})]}),t.status==="skipped"&&t.skipReason&&t.skipReason!=="not_on_path"&&e.jsx("span",{className:"w6w-execution-log-skip-reason","data-testid":"execution-log-skip-reason",children:bn[t.skipReason]}),e.jsx(Sn,{startedAt:t.startedAt,finishedAt:t.finishedAt})]}),l=t.error?e.jsx(Ge,{error:t.error}):null,o=Array.isArray(t.iterations)?e.jsx(kn,{step:t}):null,d=Rn(t)?e.jsx(An,{step:t}):null;return t.input===void 0&&t.output===void 0&&!t.meta&&!d&&!((c=t.logs)!=null&&c.length)?e.jsxs("li",{className:"w6w-execution-log-row",children:[e.jsx("div",{className:"w6w-section",children:i}),l,o]}):e.jsxs("li",{className:"w6w-execution-log-row",children:[e.jsxs("details",{className:"w6w-section",open:n,onToggle:x=>a(x.currentTarget.open),children:[e.jsx("summary",{className:"w6w-section-summary",children:i}),n&&e.jsxs("div",{className:"w6w-execution-log-row-body w6w-section-body w6w-stack",children:[e.jsx(Tn,{input:t.input}),e.jsx($t,{title:"Input",value:t.input,defaultOpen:s}),e.jsx($t,{title:"Output",value:t.output,defaultOpen:s}),!!((p=t.logs)!=null&&p.length)&&e.jsxs("div",{className:"w6w-execution-log-json w6w-stack",children:[e.jsx("strong",{className:"w6w-small",children:"Console"}),e.jsx(F.CodeBlock,{code:t.logs.join(`
2
+ `),language:"plaintext"})]}),t.meta&&e.jsxs("div",{className:"w6w-execution-log-json w6w-stack",children:[e.jsx("strong",{className:"w6w-small",children:"Metadata"}),e.jsx(F.CodeBlock,{code:JSON.stringify(t.meta,null,2),language:"json"})]}),d]})]}),l,o]})}function kn({step:t}){var h,j;const s=[...t.iterations??[]].sort((u,N)=>u.index-N.index),n=t.iterationsTotal??s.length,a=t.iterationsFailed??s.filter(u=>u.status==="failed").length,r=s.find(u=>u.status==="failed"),i=(r==null?void 0:r.index)??((h=s[s.length-1])==null?void 0:h.index),[l,o]=g.useState(i),[d,c]=g.useState(!1),p=s.find(u=>u.index===l),x=[],y=new Map;for(const u of qt(s.flatMap(N=>N.steps)))y.has(u.id)||(x.push(u.id),y.set(u.id,u.label??u.id));const m=(r==null?void 0:r.failedNodeId)??((j=r==null?void 0:r.steps.find(u=>u.status==="failed"))==null?void 0:j.id);return e.jsxs("div",{className:"w6w-execution-log-foreach w6w-stack",children:[e.jsxs("div",{className:"w6w-small","data-testid":"execution-log-foreach-summary",children:[e.jsxs("span",{children:[n===1?"1 item":`${n} items`,a>0?` · ${a} failed`:""]}),r&&m!==void 0&&e.jsxs("div",{children:[y.get(m)??m," failed in iteration ",r.index]}),t.iterationsTruncated===!0&&e.jsx("div",{className:"w6w-muted",children:`showing ${s.length} of ${n}`})]}),e.jsx("div",{className:"w6w-execution-log-iteration-chips",children:s.map(u=>e.jsxs("button",{type:"button",className:`w6w-execution-log-iteration-chip w6w-execution-log-iteration-chip-${u.status}`,"data-testid":"execution-log-iteration-chip","data-status":u.status,"aria-pressed":l===u.index,title:`Show iteration ${u.index}'s input and output`,onClick:()=>{o(u.index),c(!0)},children:[u.index," · ",u.status]},u.index))}),p&&e.jsx("div",{className:"w6w-small w6w-muted","data-testid":"execution-log-iteration-current",children:`Iteration ${p.index} · ${p.status}`}),e.jsx("ul",{className:"w6w-execution-log-subrows",children:x.map(u=>e.jsx(Cn,{id:u,label:y.get(u)??u,iterations:s,selected:l,open:d,onSelect:o},u))})]})}function Cn({id:t,label:s,iterations:n,selected:a,open:r,onSelect:i}){var o;const l=(o=n.find(d=>d.index===a))==null?void 0:o.steps.find(d=>d.id===t);return e.jsxs("li",{className:"w6w-execution-log-subrow w6w-stack",children:[e.jsxs("div",{className:"w6w-execution-log-subrow-head",children:[e.jsx("strong",{className:"w6w-small",children:s}),e.jsx("select",{className:"w6w-select","aria-label":`Iteration for ${s}`,"data-testid":"execution-log-iteration-select",value:a===void 0?"":String(a),onChange:d=>i(Number(d.currentTarget.value)),children:n.map(d=>e.jsx("option",{value:String(d.index),children:`iteration ${d.index} (${d.status})`},d.index))})]}),l?e.jsx("ol",{className:"w6w-execution-log",children:e.jsx(Yt,{step:l,defaultOpen:r},`${a}:${r}`)}):e.jsx("p",{className:"w6w-muted w6w-small",children:"Did not run in this iteration."})]})}function Ge({error:t,label:s}){return e.jsxs("div",{className:"w6w-result w6w-error",children:[s!==void 0&&e.jsx("strong",{className:"w6w-execution-log-error-label",children:s}),t.code&&e.jsx("div",{className:"w6w-small w6w-execution-log-error-code",children:e.jsx("code",{children:t.code})}),t.message]})}function Sn({startedAt:t,finishedAt:s}){if(t&&s){const n=En(t,s);return e.jsxs("span",{className:"w6w-execution-log-timing",children:[t," → ",s,n&&e.jsxs("span",{children:[" (",n,")"]})]})}return t?e.jsxs("span",{className:"w6w-execution-log-timing",children:["Started ",t]}):e.jsx("span",{className:"w6w-execution-log-timing",children:"—"})}function En(t,s){const n=Date.parse(t),a=Date.parse(s);if(!Number.isFinite(n)||!Number.isFinite(a)||a<n)return null;const r=a-n;if(r<1e3)return`${r}ms`;const i=r/1e3;if(i<60)return`${i.toFixed(1)}s`;const l=Math.floor(i/60),o=Math.round(i%60);return`${l}m ${o}s`}function $t({title:t,value:s,defaultOpen:n=!1}){const[a,r]=g.useState(n);return s===void 0?e.jsxs("div",{className:"w6w-execution-log-json w6w-stack",children:[e.jsx("strong",{className:"w6w-small",children:t}),e.jsx("p",{className:"w6w-muted w6w-small",children:"Not available."})]}):e.jsxs("details",{className:"w6w-execution-log-json",open:a,onToggle:i=>{i.target===i.currentTarget&&r(i.currentTarget.open)},children:[e.jsx("summary",{children:e.jsx("strong",{className:"w6w-small",children:t})}),a&&e.jsx(w.ResultViewer,{value:s,format:"json"})]})}const Re=t=>typeof t=="object"&&t!==null&&!Array.isArray(t);function Rt(t){if(!Re(t)||!Array.isArray(t.conditions))return;const s=t.conditions.filter(n=>Re(n)&&typeof n.op=="string"&&"result"in n);if(s.length!==0)return{rows:s,combinator:typeof t.combinator=="string"?t.combinator:void 0,result:typeof t.condition=="boolean"?t.condition:void 0}}function Tn({input:t}){const s=[],n=Rt(t);if(n&&s.push({trace:n}),Re(t)&&Array.isArray(t.routes))for(const a of t.routes){const r=Rt(a);!r||!Re(a)||s.push({title:String(a.label??a.id??"Route"),trace:r})}return s.length===0?null:e.jsxs("div",{className:"w6w-execution-log-json w6w-stack","data-testid":"execution-log-conditions",children:[e.jsx("strong",{className:"w6w-small",children:"Condition"}),s.map(({title:a,trace:r},i)=>e.jsxs("div",{className:"w6w-stack",children:[a&&e.jsx("span",{className:"w6w-small w6w-muted",children:a}),(r.combinator&&r.rows.length>1||r.result!==void 0)&&e.jsxs("span",{className:"w6w-small w6w-muted","data-testid":"execution-log-condition-summary",children:[r.combinator&&r.rows.length>1&&w.conditionCombinatorLabel(r.combinator),r.combinator&&r.rows.length>1&&r.result!==void 0&&" · ",r.result!==void 0&&e.jsxs(e.Fragment,{children:["Result:"," ",e.jsx("span",{className:r.result?"w6w-execution-log-condition-true":"w6w-execution-log-condition-false",children:r.result?"true":"false"})]})]}),e.jsx("div",{className:"w6w-data-table-frame",children:e.jsxs("table",{className:"w6w-data-table w6w-execution-log-conditions",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Left"}),e.jsx("th",{children:"Operator"}),e.jsx("th",{children:"Right"}),e.jsx("th",{children:"Result"})]})}),e.jsx("tbody",{children:r.rows.map((l,o)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{children:At(l.left)})}),e.jsx("td",{children:w.conditionOperatorLabel(l.op)}),e.jsx("td",{children:e.jsx("code",{children:At(l.right)})}),e.jsx("td",{className:l.result?"w6w-execution-log-condition-true":"w6w-execution-log-condition-false",children:l.result?"true":"false"})]},o))})]})})]},a??i))]})}function At(t){return JSON.stringify(t)??"undefined"}const Ot={not_object:"Not written — the output isn't an object, so it can't be merged at the root",missing_source:"Not written — the output has no value at that field",null_append:"Not appended — the value was null",append_not_array:"Not appended — the existing value isn't a list",write_too_large:"Not written — the value is too large",run_too_large:"Not written — the run's state would grow past its size limit",too_deep:"Not written — the value is nested too deeply",key_too_long:"Not written — a key in the value is too long",forbidden_key:"Not written — the value uses a reserved key name",log_truncated:"Later state changes aren't shown — the run's state log reached its limit"};function $n(t){return Object.hasOwn(Ot,t)?Ot[t]:t}function Rn(t){const s=Array.isArray(t.stateWrites)&&t.stateWrites.length>0,n=t.stateAfter;return s||typeof n=="object"&&n!==null&&Object.keys(n).length>0}const _t=120;function It(t){if(t===void 0)return"(not set)";const s=JSON.stringify(t)??String(t);return s.length>_t?`${s.slice(0,_t)}…`:s}function An({step:t}){const s=Array.isArray(t.stateWrites)?t.stateWrites:[],n=t.stateAfter;return e.jsxs("div",{className:"w6w-execution-log-state w6w-stack","data-testid":"execution-log-state",children:[e.jsx("strong",{className:"w6w-small",children:"State"}),s.length>0&&e.jsx("ul",{className:"w6w-execution-log-state-writes",children:s.map((a,r)=>{const i=Array.isArray(a.path)?a.path:[],l=`state${i.length?`.${i.join(".")}`:""}${a.item!==void 0?` (item ${a.item})`:""}`;return a.warning!==void 0?e.jsx("li",{className:"w6w-execution-log-state-write w6w-execution-log-state-warning w6w-small","data-testid":"execution-log-state-write","data-warning":a.warning,children:`${l}: ${$n(a.warning)}`},r):e.jsx("li",{className:"w6w-execution-log-state-write w6w-small","data-testid":"execution-log-state-write",children:`${l}: ${It(a.old)} → ${It(a.new)}`},r)})}),typeof n=="object"&&n!==null&&e.jsxs("div",{className:"w6w-stack","data-testid":"execution-log-state-after",children:[e.jsx("span",{className:"w6w-small w6w-muted",children:"State after this step"}),e.jsx(F.CodeBlock,{code:JSON.stringify(n,null,2),language:"json"})]})]})}const On={status:"",kind:"",from:"",to:"",q:""},_n=[{value:"",label:"Any status"},{value:"queued",label:"Queued"},{value:"running",label:"Running"},{value:"succeeded",label:"Succeeded"},{value:"failed",label:"Failed"},{value:"canceled",label:"Canceled"}],In=[{value:"",label:"Any type"},{value:"function",label:"Function"},{value:"endpoint",label:"Endpoint"},{value:"workflow",label:"Workflow"}];function Pn({value:t,onChange:s,showKind:n=!1,searchPlaceholder:a="Search by id or name",disabled:r=!1}){const i=t.status!==""||t.kind!==""||t.from!==""||t.to!==""||t.q!=="";return e.jsxs("div",{className:"w6w-execution-filters","data-testid":"execution-filters",children:[e.jsx("input",{type:"search",className:"w6w-execution-filters-search","data-testid":"execution-filter-q","aria-label":"Search executions",placeholder:a,value:t.q,disabled:r,onChange:l=>s({...t,q:l.target.value})}),e.jsx("select",{className:"w6w-execution-filters-select","data-testid":"execution-filter-status","aria-label":"Status",value:t.status,disabled:r,onChange:l=>s({...t,status:l.target.value}),children:_n.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),n&&e.jsx("select",{className:"w6w-execution-filters-select","data-testid":"execution-filter-kind","aria-label":"Type",value:t.kind,disabled:r,onChange:l=>s({...t,kind:l.target.value}),children:In.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),e.jsx("input",{type:"date",className:"w6w-execution-filters-date","data-testid":"execution-filter-from","aria-label":"From date",value:t.from,disabled:r,onChange:l=>s({...t,from:l.target.value})}),e.jsx("input",{type:"date",className:"w6w-execution-filters-date","data-testid":"execution-filter-to","aria-label":"To date",value:t.to,disabled:r,onChange:l=>s({...t,to:l.target.value})}),i&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost w6w-execution-filters-clear","data-testid":"execution-filter-clear",disabled:r,onClick:()=>s({...On}),children:"Clear"})]})}const Ee="—";function Ln({stats:t,label:s}){const n=[{testid:"execution-stat-total",label:"Executions",value:t?String(t.total):Ee},{testid:"execution-stat-success-rate",label:"Success rate",value:Mn(t==null?void 0:t.successRate)},{testid:"execution-stat-failed",label:"Failed",value:t?String(t.failed):Ee},{testid:"execution-stat-avg-duration",label:"Avg duration",value:t?_e(t.avgDurationMs):Ee}];return t&&t.inFlight>0&&n.push({testid:"execution-stat-in-flight",label:"In flight",value:String(t.inFlight)}),e.jsxs("section",{className:"w6w-execution-stats","data-testid":"execution-stats",children:[s!=null&&e.jsx("p",{className:"w6w-execution-stats-label",children:s}),e.jsx("div",{className:"w6w-execution-stats-cards",children:n.map(a=>e.jsxs("div",{className:"w6w-execution-stat","data-testid":a.testid,children:[e.jsx("span",{className:"w6w-execution-stat-value","data-stat-value":a.value,children:a.value}),e.jsx("span",{className:"w6w-execution-stat-label",children:a.label})]},a.testid))})]})}function Mn(t){return t==null||!Number.isFinite(t)?Ee:`${Math.round(t*100)}%`}const Dn={function:"Function",endpoint:"Endpoint",workflow:"Workflow"};function Fn(t){return JSON.stringify(t,null,2)??"null"}function Bn({execution:t,loading:s=!1,errorMessage:n,onClose:a,onOpenInEditor:r,onBack:i,onRerun:l,rerunning:o=!1,onOpenExecution:d}){return e.jsxs("section",{className:"w6w-execution-detail w6w-stack","data-testid":"execution-detail",children:[i&&e.jsx("div",{className:"w6w-execution-detail-back",children:e.jsxs("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":"execution-detail-back",onClick:i,children:[e.jsx("span",{"aria-hidden":"true",children:"←"})," Back"]})}),n!=null&&e.jsx("p",{role:"alert",className:"w6w-execution-detail-error-message","data-testid":"execution-detail-error-message",children:n}),t?e.jsx(Un,{execution:t,onClose:a,onOpenInEditor:r,onRerun:l,rerunning:o,onOpenExecution:d}):s?e.jsx("p",{className:"w6w-muted","data-testid":"execution-detail-loading",children:"Loading…"}):e.jsx("p",{className:"w6w-muted","data-testid":"execution-detail-empty",children:"No execution selected."})]})}function Un({execution:t,onClose:s,onOpenInEditor:n,onRerun:a,rerunning:r,onOpenExecution:i}){const l=t.rerunOf;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w6w-execution-detail-head",children:[e.jsxs("div",{className:"w6w-execution-detail-title",children:[e.jsx("h3",{className:"w6w-execution-detail-name",children:t.callableName}),e.jsxs("div",{className:"w6w-execution-detail-meta",children:[e.jsx(Oe,{state:t.status}),e.jsx("span",{className:"w6w-execution-detail-kind w6w-muted w6w-small",children:Dn[t.kind]})]})]}),(a||n||s)&&e.jsxs("div",{className:"w6w-execution-detail-actions",children:[a&&e.jsxs("button",{type:"button",className:"w6w-btn w6w-execution-detail-rerun","data-testid":"execution-detail-rerun",title:"Run it again with the same input",disabled:r,onClick:a,children:[e.jsx(F.Icon,{name:"sync",size:14})," ",r?"Re-running…":"Re-run"]}),n&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":"execution-detail-open-editor",onClick:n,children:"Open in visual editor"}),s&&e.jsx(w.IconButton,{label:"Close","data-testid":"execution-detail-close",onClick:s,children:"×"})]})]}),e.jsx("p",{className:"w6w-execution-detail-id-line",children:e.jsx("code",{className:"w6w-execution-detail-id","data-testid":"execution-detail-id",children:t.id})}),l&&e.jsxs("p",{className:"w6w-execution-detail-rerun-of","data-testid":"execution-detail-rerun-of",children:[e.jsx("span",{className:"w6w-execution-rerun-tag",children:"Re-run"}),e.jsx("span",{className:"w6w-muted w6w-small",children:"of"}),i?e.jsx("button",{type:"button",className:"w6w-execution-detail-rerun-of-link","data-testid":"execution-detail-rerun-of-link",onClick:()=>i(l),children:e.jsx("code",{children:l})}):e.jsx("code",{children:l})]}),e.jsxs("dl",{className:"w6w-execution-detail-timing",children:[e.jsx(He,{label:"Started",value:pe(t.startedAt)}),e.jsx(He,{label:"Finished",value:t.finishedAt?pe(t.finishedAt):"—"}),e.jsx(He,{label:"Duration",value:_e(t.durationMs)})]}),t.steps!==void 0&&e.jsxs("section",{className:"w6w-execution-detail-section w6w-stack","data-testid":"execution-detail-steps",children:[e.jsx("strong",{className:"w6w-small",children:"Nodes"}),e.jsx(Ht,{steps:t.steps,emptyLabel:"No nodes ran."})]}),t.input!==void 0&&e.jsx(Ye,{title:"Input",testid:"execution-detail-input",value:t.input}),t.output!==void 0&&e.jsx(Ye,{title:"Output",testid:"execution-detail-output",value:t.output}),t.error!=null&&e.jsx(Ye,{title:"Error",testid:"execution-detail-error",value:t.error})]})}function He({label:t,value:s}){return e.jsxs("div",{className:"w6w-execution-detail-timing-item",children:[e.jsx("dt",{children:t}),e.jsx("dd",{children:s})]})}function Ye({title:t,testid:s,value:n}){return e.jsxs("section",{className:"w6w-execution-detail-section w6w-stack","data-testid":s,children:[e.jsx("strong",{className:"w6w-small",children:t}),e.jsx(F.CodeBlock,{code:Fn(n),language:"json"})]})}function zt(t){const s=[];for(const n of t)n.p95Ms!==null&&s.push({appId:n.appId,displayName:n.displayName,calls:n.calls,p95Ms:n.p95Ms,state:n.state,errorCount:n.errors.e4xx+n.errors.e429+n.errors.eAuth+n.errors.e5xx});return s}function Wn(t){return t.attention==="now"||t.attention==="recent"}function Gt(t){const s={now:[],recent:[],clear:[]};for(const n of t)n.attention==="now"?s.now.push(n):n.attention==="recent"?s.recent.push(n):s.clear.push(n);return s}function Xt(t){return t.uptime.map(s=>({day:s.day,state:s.state}))}const Xe=3,Zt=5;function Qt(t,s={}){const n=s.compact??!1,{now:a,recent:r}=Gt(t),i=a.length+r.length,l=n?a.slice(0,Xe):a,o=n?r.slice(0,Math.max(0,Xe-l.length)):r,d=n?t.slice(0,s.limit??Zt):[...t];return{attentionCount:i,shownNow:l,shownRecent:o,hiddenAttentionCount:i-l.length-o.length,shownTable:d,hiddenTableCount:t.length-d.length}}const ke=640,me=340,q={top:16,right:24,bottom:40,left:56};function Pt(t){if(t<=0)return 1;const s=10**Math.floor(Math.log10(t)),n=[1,2,5,10];for(const a of n)if(t<=a*s)return a*s;return 10*s}function Lt(t,s=5){return Array.from({length:s+1},(n,a)=>Math.round(t*a/s))}function es({services:t,getHref:s,onOpen:n}){const a=zt(t);if(a.length===0)return e.jsx("p",{className:"w6w-muted w6w-small",children:"No timed calls in this window yet."});const r=Pt(Math.max(...a.map(u=>u.calls))),i=Pt(Math.max(...a.map(u=>u.p95Ms))),l=Math.max(1,...a.map(u=>u.errorCount)),o=ke-q.left-q.right,d=me-q.top-q.bottom,c=u=>q.left+u/r*o,p=u=>q.top+u/i*d,x=u=>16+u/l*14,y=Lt(r),m=Lt(i),h=18,j=q.top+d/2;return e.jsxs("div",{className:"w6w-rel-scatter",children:[e.jsxs("svg",{viewBox:`0 0 ${ke} ${me}`,style:{aspectRatio:`${ke} / ${me}`},role:"img","aria-label":"API performance: calls versus p95 latency, one point per API",children:[e.jsx("rect",{x:q.left,y:q.top,width:o,height:d,className:"w6w-rel-scatter-plot-bg"}),m.map(u=>e.jsxs("g",{children:[e.jsx("line",{x1:q.left,x2:ke-q.right,y1:p(u),y2:p(u),className:"w6w-rel-scatter-grid"}),e.jsx("text",{x:q.left-8,y:p(u),className:"w6w-rel-scatter-axis-label",textAnchor:"end",children:u})]},`y-${u}`)),y.map(u=>e.jsx("text",{x:c(u),y:me-q.bottom+18,className:"w6w-rel-scatter-axis-label",textAnchor:"middle",children:u},`x-${u}`)),e.jsx("text",{x:h,y:j,className:"w6w-rel-scatter-axis-title",textAnchor:"middle",transform:`rotate(-90, ${h}, ${j})`,children:"p95 (ms)"}),e.jsx("text",{x:q.left+o/2,y:me-4,className:"w6w-rel-scatter-axis-title",textAnchor:"middle",children:"calls in this window"}),a.map(u=>{const N=x(u.errorCount),b=c(u.calls),v=p(u.p95Ms),T=e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:b,cy:v,r:N/2+2.5,className:`w6w-rel-scatter-ring w6w-rel-scatter-ring-${u.state}`,children:e.jsxs("title",{children:[u.displayName," — ",u.calls," calls, ",u.p95Ms," ms p95, ",u.errorCount," errors"]})}),e.jsx("circle",{cx:b,cy:v,r:N/2,className:`w6w-rel-scatter-point w6w-rel-scatter-point-${u.state}`})]});return s?e.jsx("a",{href:s(u.appId),className:"w6w-rel-scatter-point-link",onClick:n?S=>n(u.appId,S):void 0,children:T},u.appId):n?e.jsx("g",{role:"button",tabIndex:0,className:"w6w-rel-scatter-point-link",onClick:S=>n(u.appId,S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),S.currentTarget.dispatchEvent(new MouseEvent("click",{bubbles:!0})))},children:T},u.appId):e.jsx("g",{children:T},u.appId)})]}),e.jsx("p",{className:"w6w-muted w6w-small w6w-rel-scatter-note",children:"Up is faster, right is more calls — top-right is the best outcome. Icon size is the error count in this window; ring colour is exec status."})]})}function Mt(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ts({appId:t,className:s,title:n,getHref:a,onOpen:r,children:i}){return a?e.jsx("a",{className:s,href:a(t),title:n,onClick:r?l=>r(t,l):void 0,children:i}):r?e.jsx("button",{type:"button",className:s,title:n,onClick:l=>r(t,l),children:i}):e.jsx("div",{className:s,title:n,children:i})}function ss({service:t}){return e.jsxs("span",{className:"w6w-rel-signal",children:[e.jsx(Ae,{state:t.state}),t.ongoingOutageId&&e.jsx("span",{className:"w6w-rel-tag",children:"outage open"}),t.calls===0&&e.jsx("span",{className:"w6w-muted w6w-small",children:"no calls"})]})}function ns({vendor:t}){if(!t)return e.jsx("span",{className:"w6w-muted w6w-small",children:"not published"});const s=t.state==="unknown";return e.jsxs("span",{className:"w6w-rel-signal",title:t.message??void 0,children:[e.jsx(Ae,{state:t.state,label:s?"Unavailable":void 0}),!s&&t.message&&e.jsx("span",{className:"w6w-rel-vendor-msg w6w-small",children:t.message})]})}function Jn({service:t,getHref:s,onOpen:n}){return e.jsxs(ts,{appId:t.appId,className:"w6w-rel-issue-card",title:`${t.displayName} — open service detail`,getHref:s,onOpen:n,children:[e.jsxs("span",{className:"w6w-rel-issue-head",children:[e.jsx(w.AppIcon,{src:t.iconSrc,srcDark:t.iconSrcDark,brandColor:t.brandColor,name:t.displayName,size:24}),e.jsxs("span",{className:"w6w-rel-issue-head-text",children:[e.jsx("strong",{children:t.displayName}),t.attention==="recent"&&e.jsx("span",{className:"w6w-muted w6w-small",children:"trouble earlier in this window"})]})]}),e.jsxs("span",{className:"w6w-rel-issue-signals",children:[e.jsxs("span",{className:"w6w-rel-issue-signal",children:[e.jsx("span",{className:"w6w-muted w6w-small",children:"w6w exec"}),e.jsx(ss,{service:t})]}),e.jsxs("span",{className:"w6w-rel-issue-signal",children:[e.jsx("span",{className:"w6w-muted w6w-small",children:"API status"}),e.jsx(ns,{vendor:t.vendorStatus})]})]})]})}function Vn({service:t,getHref:s,onOpen:n}){const a=t.calls===0;return e.jsxs("tr",{className:`w6w-rel-tr${t.attention!=="none"?" w6w-rel-attention":""}`,"data-attention":t.attention==="none"?void 0:t.attention,children:[e.jsx("td",{className:"w6w-rel-td-service",children:e.jsxs(ts,{appId:t.appId,className:"w6w-rel-open",getHref:s,onOpen:n,children:[e.jsx(w.AppIcon,{src:t.iconSrc,srcDark:t.iconSrcDark,brandColor:t.brandColor,name:t.displayName,size:28}),e.jsxs("span",{className:"w6w-rel-td-service-text",children:[e.jsx("strong",{children:t.displayName}),e.jsx("code",{className:"w6w-muted w6w-small",children:t.appId})]})]})}),e.jsxs("td",{className:"w6w-rel-td-status",children:[e.jsxs("span",{className:"w6w-rel-status-row",children:[e.jsx("span",{className:"w6w-rel-status-label w6w-muted w6w-small",children:"Ops"}),e.jsx(ss,{service:t})]}),e.jsxs("span",{className:"w6w-rel-status-row",children:[e.jsx("span",{className:"w6w-rel-status-label w6w-muted w6w-small",children:"API"}),e.jsx(ns,{vendor:t.vendorStatus})]})]}),e.jsx("td",{className:"w6w-rel-td-uptime",children:a?e.jsx("span",{className:"w6w-rel-idle-note",children:"No calls in this window"}):e.jsxs(e.Fragment,{children:[e.jsx(Jt,{days:Xt(t),ariaLabel:`${t.displayName}, ${t.uptime.length}-day status, oldest day first`}),e.jsxs("span",{className:"w6w-muted w6w-small",children:[t.calls," calls"]})]})}),e.jsx("td",{className:"w6w-rel-td-p95",children:t.p95Ms===null?"—":`${t.p95Ms} ms`})]})}function Kn({services:t,window:s,days:n,compact:a=!1,showChart:r,limit:i,getHref:l,onOpen:o,showAllHref:d,onShowAll:c,slots:p}){const x=n??(s==null?void 0:s.days)??30,y=t.length>0&&t.every($=>$.calls>0&&$.state==="ok"),{attentionCount:m,shownNow:h,shownRecent:j,hiddenAttentionCount:u,shownTable:N,hiddenTableCount:b}=Qt(t,{compact:a,limit:i}),v=r??!a,T=d!==void 0||c!==void 0,S=$=>{const E=$.startsWith("Show")?"w6w-muted w6w-small":void 0;return d!==void 0?e.jsx("a",{href:d,className:E,onClick:c,children:$}):c?e.jsx("button",{type:"button",className:`w6w-rel-show-all${E?` ${E}`:""}`,onClick:c,children:$}):null};return e.jsxs("section",{className:"w6w-rel-section",children:[e.jsxs("h3",{className:"w6w-rel-heading",children:[e.jsxs("span",{children:[(p==null?void 0:p.header)??"Service reliability"," ",s&&e.jsxs("span",{className:"w6w-muted w6w-small",children:[Mt(s.from)," – ",Mt(s.to)," · ",s.days," days"]})]}),a&&S("Show all services →"),p==null?void 0:p.actions]}),e.jsxs("div",{className:a?"w6w-rel-card":void 0,children:[e.jsx("p",{className:"w6w-muted w6w-small w6w-rel-intro",children:"Connected services across your account. Performance for the selected project."}),y&&e.jsxs("div",{className:a?"w6w-rel-allclear":"w6w-rel-card w6w-rel-allclear",children:[e.jsx("h4",{children:"All clear"}),e.jsxs("p",{children:["Every service you called in the last ",x," days came back"," ",e.jsx(Ae,{state:"ok"})," — no degraded stretches, no outages."]})]}),t.length===0&&((p==null?void 0:p.empty)??e.jsx("div",{className:a?void 0:"w6w-rel-card",children:e.jsx("p",{className:"w6w-muted",children:"No services yet — connect an integration or use a service in this project."})})),t.length>0&&e.jsxs(e.Fragment,{children:[m>0&&e.jsxs("div",{className:"w6w-rel-group",children:[e.jsxs("h4",{className:"w6w-rel-group-head",children:["Needs attention"," ",e.jsxs("span",{className:"w6w-muted w6w-small",children:[h.length+j.length," of ",m]})]}),e.jsx("div",{className:"w6w-rel-issues",children:[...h,...j].map($=>e.jsx(Jn,{service:$,getHref:l,onOpen:o},$.appId))}),u>0&&e.jsxs("p",{className:"w6w-muted w6w-small w6w-rel-more-note",children:[u," more ",u===1?"needs":"need"," ","attention",T&&e.jsxs(e.Fragment,{children:[" — ",S("view all →")]})]})]}),v&&e.jsxs("div",{className:"w6w-rel-group",children:[e.jsx("h4",{className:"w6w-rel-group-head",children:"Performance across your APIs"}),e.jsx(es,{services:t,getHref:l,onOpen:o})]}),N.length>0&&e.jsxs("div",{className:"w6w-rel-group",children:[e.jsxs("h4",{className:"w6w-rel-group-head",children:[a?"Services":"All services"," ",e.jsx("span",{className:"w6w-muted w6w-small",children:a?`${N.length} of ${t.length}`:t.length})]}),e.jsx("div",{className:"w6w-rel-table-wrap",children:e.jsxs("table",{className:"w6w-rel-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Service"}),e.jsx("th",{children:"Status"}),e.jsxs("th",{children:["Last ",x," days"]}),e.jsx("th",{children:"Latency"})]})}),e.jsx("tbody",{children:N.map($=>e.jsx(Vn,{service:$,getHref:l,onOpen:o},$.appId))})]})}),b>0&&e.jsxs("p",{className:"w6w-muted w6w-small w6w-rel-more-note",children:[b," more",T&&e.jsxs(e.Fragment,{children:[" — ",S("view all →")]})]})]})]})]})]})}function qn({rows:t,title:s,description:n,emptyCopy:a,newLabel:r="New",openRowTitle:i,testIds:l,loading:o,error:d,onCreate:c,creating:p,onImport:x,onOpen:y,getHref:m,showArchived:h,onShowArchivedChange:j,slots:u}){const[N,b]=g.useState(!1),v=h!==void 0,T=v?h:N,S=T?t:t.filter(R=>!R.archived),$=y!==void 0||m!==void 0,E=R=>{v||b(R),j==null||j(R)},L=[{key:"main",header:"Name",render:R=>{const B=e.jsxs("span",{className:"w6w-callable-list-main",title:$?i:void 0,children:[e.jsx("span",{children:R.title}),R.description!=null&&e.jsx("span",{className:"w6w-muted w6w-small w6w-callable-list-row-desc",children:R.description})]});return y&&!m?e.jsx("button",{type:"button",className:"w6w-callable-list-open",children:B}):B}},{key:"trail",header:"",align:"right",width:"1%",render:R=>R.archived||R.badges!=null||R.trailing!=null?e.jsxs("span",{className:"w6w-callable-list-trail",children:[R.badges,R.archived&&e.jsx("span",{className:"w6w-callable-list-badge","data-testid":l==null?void 0:l.archivedBadge,children:"archived"}),R.trailing]}):null}],_=t.length>0&&S.length===0;return e.jsxs("section",{className:"w6w-callable-list",children:[e.jsxs("div",{className:"w6w-callable-list-head",children:[e.jsxs("div",{className:"w6w-callable-list-heading",children:[(u==null?void 0:u.header)??e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"w6w-callable-list-title",children:s}),n!=null&&e.jsx("p",{className:"w6w-muted w6w-small w6w-callable-list-description",children:n})]}),e.jsxs("label",{className:"w6w-muted w6w-small w6w-callable-list-toggle",children:[e.jsx("input",{type:"checkbox",checked:T,"data-testid":l==null?void 0:l.showArchived,onChange:R=>E(R.target.checked)}),"Show archived"]})]}),e.jsxs("div",{className:"w6w-callable-list-actions",children:[u==null?void 0:u.actions,x&&e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost","data-testid":l==null?void 0:l.importOpen,onClick:x,children:"Import"}),c&&e.jsx("button",{type:"button",className:"w6w-btn",disabled:p,onClick:c,children:p?"Creating…":r})]})]}),d&&e.jsx("div",{className:"w6w-error",children:d}),e.jsxs("div",{className:"w6w-callable-list-body",children:[o&&e.jsx("p",{className:"w6w-muted",children:"Loading…"}),S.length===0&&!o?_?e.jsx(w.EmptyState,{testId:"w6w-callable-list-empty",action:e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:()=>E(!0),children:"Show archived"}),children:t.length===1?"The only item is archived.":`All ${t.length} items are archived.`}):e.jsx(w.EmptyState,{testId:"w6w-callable-list-empty",children:(u==null?void 0:u.empty)??a}):e.jsx(w.DataTable,{columns:L,rows:S,rowKey:R=>R.id,className:"w6w-data-table-rows",loading:o,getRowHref:m?R=>m(R.id):void 0,onRowClick:y?(R,B)=>y(R.id,B):void 0})]})]})}function Hn({connections:t,appsById:s,loading:n,error:a,onOpen:r,getHref:i,onEdit:l,onDelete:o,busy:d,slots:c}){const p=s??new Map,x=l!==void 0||o!==void 0,y=[{key:"name",header:"Name",render:m=>{const h=w.resolveConnectionAppMeta(m,p),j=m.displayName||m.id;return e.jsxs("span",{className:"w6w-connection-cell-name",children:[e.jsx(w.AppIcon,{src:h==null?void 0:h.iconSvg,srcDark:h==null?void 0:h.iconSvgDark,brandColor:h==null?void 0:h.brandColor,name:(h==null?void 0:h.displayName)??m.appId}),e.jsx("strong",{className:"w6w-connection-name",title:j,children:j})," ",e.jsx("span",{className:"w6w-muted",children:(h==null?void 0:h.displayName)??m.appId}),e.jsx("span",{className:`w6w-connection-tag${m.state==="connected"?"":" w6w-connection-tag-warn"}`,children:m.state}),m.lastTestOk===!1&&e.jsx("span",{className:"w6w-connection-tag w6w-connection-tag-danger",title:"Last test failed — update or re-test.",children:"invalid"})]})}}];return x&&y.push({key:"actions",header:"",align:"right",link:!1,actions:!0,render:m=>m.builtIn===!0?null:e.jsxs("div",{className:"w6w-connection-row-actions",onClick:h=>h.stopPropagation(),children:[l&&e.jsx(tt,{label:"Edit",onClick:()=>l(m),"data-testid":`connection-edit-${m.id}`}),o&&e.jsx(w.DeleteButton,{label:"Delete",onClick:()=>o(m),disabled:d,"data-testid":`connection-delete-${m.id}`})]})}),e.jsxs("section",{className:"w6w-connection-list",children:[((c==null?void 0:c.header)!=null||(c==null?void 0:c.actions)!=null)&&e.jsxs("div",{className:"w6w-connection-list-head",children:[e.jsx("div",{className:"w6w-connection-list-heading",children:c==null?void 0:c.header}),e.jsx("div",{className:"w6w-connection-list-actions",children:c==null?void 0:c.actions})]}),a&&e.jsx("div",{className:"w6w-error",children:a}),n&&e.jsx("p",{className:"w6w-muted",children:"Loading…"}),t.length===0&&!n?e.jsx(w.EmptyState,{testId:"w6w-connection-list-empty",children:(c==null?void 0:c.empty)??"No connections yet."}):e.jsx(w.DataTable,{columns:y,rows:t,rowKey:m=>m.id,loading:n,getRowHref:i?m=>m.builtIn===!0?void 0:i(m.id):void 0,onRowClick:r?(m,h)=>m.builtIn===!0?void 0:r(m.id,h):void 0})]})}function Yn({connection:t,onClose:s,onSaved:n}){const a=w.useW6WApi(),r=a.updateConnection,i=t.builtIn===!0,l=!i&&typeof r=="function",[o,d]=g.useState(t.displayName??""),[c,p]=g.useState(t.authKey),[x,y]=g.useState({}),[m,h]=g.useState(null),[j,u]=g.useState(null),[N,b]=g.useState(!1),[v,T]=g.useState({}),[S,$]=g.useState(null),[E,L]=g.useState(null),[_,R]=g.useState(null),[B,se]=g.useState(null);g.useEffect(()=>{if(!l)return;let C=!1;return h(null),a.getAppAuth(t.appId).then(A=>!C&&h(A)).catch(A=>!C&&u(A.message)),()=>{C=!0}},[a,l,t.appId]);const P=m==null?void 0:m.find(C=>C.key===c),H=c!==t.authKey,k=(m==null?void 0:m.filter(C=>C.key===t.authKey||C.available!==!1&&!C.autoSatisfied&&["apiKey","bearer","basic","custom"].includes(C.type)))??[],M=(P==null?void 0:P.type)==="oauth2",I=M?[]:(P==null?void 0:P.fields)??[],U=t.credentialId,ce=!H&&!!U&&typeof a.rotateCredential=="function"&&(E!==null?!E.startsWith("legacy:"):(P==null?void 0:P.type)==="serviceAccount")&&_!==!0&&!M,z=ce&&_===!1&&P!==void 0&&!P.serviceAccount,G=ce&&!z,de=!H&&!M&&!!U&&typeof a.getCredential=="function"&&_===null,Y=G&&(P!=null&&P.serviceAccount)?w.bindingFieldsFor(P.serviceAccount):[];g.useEffect(()=>{if(!l||H||M||!U||typeof a.getCredential!="function")return;let C=!1;return a.getCredential(U).then(A=>{C||($(A.connectionCount),L(A.contract),R(A.private===!0))}).catch(()=>{}),()=>{C=!0}},[a,l,H,M,U]);function ge(){if(z)return o!==(t.displayName??"")?{displayName:o}:null;if(G){const D={};o!==(t.displayName??"")&&(D.displayName=o);const V=w.buildBinding(Y,v);return V&&(D.binding=V),D.displayName===void 0&&D.binding===void 0?null:D}const C={};for(const D of z?[]:I){const V=x[D.key];V!==void 0&&V!==""&&(C[D.key]=V)}const A={};return H&&(A.authKey=c,A.credential=C),o!==(t.displayName??"")&&(A.displayName=o),Object.keys(C).length>0&&(A.credential=C),A.displayName===void 0&&A.credential===void 0?null:A}async function J(){if(!l||!r||N)return;u(null);const C=ge(),A=Object.fromEntries((z?[]:I).filter(W=>x[W.key]!==void 0&&x[W.key]!=="").map(W=>[W.key,x[W.key]])),D=Object.keys(A).length>0;if(!C&&!D){u("Nothing to update — change the name or a credential or binding field.");return}if(H||G&&D){const W=I.filter(re=>re.required&&!(re.key in A));if(W.length>0){u(`Enter the full new credential: ${W.map(re=>re.label).join(", ")}.`);return}}const V=w.parseJsonFields(I,A);if("error"in V){u(V.error);return}b(!0);let ae=!1;try{G&&D&&U&&a.rotateCredential?(await a.rotateCredential(U,{source:V.values}),ae=!0,y({}),se(null)):C!=null&&C.credential&&(C.credential=V.values);const W=C?await r.call(a,t.id,C):t;y({}),n(W)}catch(W){u(ae?`The credential was saved, but the other changes failed. Click Save to retry them. ${W.message}`:W.message)}finally{b(!1)}}async function je(){if(!(!U||!a.testCredential)){u(null);try{se(await a.testCredential(U))}catch(C){u(C.message)}}}const ne=w.useEnterSubmit(J,{enabled:l&&!N});return e.jsx(w.Modal,{title:"Edit connection",onClose:s,children:e.jsxs("div",{className:"w6w-stepconfig",children:[e.jsx("div",{className:"w6w-modal-body",children:e.jsxs("div",{className:"w6w-stack",children:[i&&e.jsx("p",{className:"w6w-muted w6w-small",children:"This connection is built in — it has no stored credential to edit."}),!i&&e.jsx("p",{className:"w6w-muted w6w-small","data-w6w":"connection-ownership",children:t.accessScope==="user"?"Only me":"This account"}),!i&&!l&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Editing connections is not available here."}),l&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Display name"}),e.jsx("input",{type:"text",value:o,onChange:C=>d(C.target.value),placeholder:"Connection name",maxLength:80,name:"w6w-connection-label",autoComplete:"off","data-1p-ignore":"true","data-lpignore":"true","data-bwignore":"true","data-form-type":"other",...ne})]}),k.some(C=>C.key!==t.authKey)&&e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Authentication method"}),e.jsxs("select",{name:"w6w-connection-auth",value:c,disabled:N,onChange:C=>{p(C.target.value),y({}),T({}),se(null),u(null)},children:[!k.some(C=>C.key===t.authKey)&&e.jsx("option",{value:t.authKey,children:t.authKey}),k.map(C=>e.jsx("option",{value:C.key,children:C.displayName??C.key},C.key))]})]}),H&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Enter the new credential and click Save. This connection stays linked to your existing workflows."}),m===null&&!j&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Loading auth fields…"}),M&&e.jsx("p",{className:"w6w-muted w6w-small",children:k.some(C=>C.key!==t.authKey)?"This connection uses OAuth. Choose another authentication method above to use a key or token.":"This is an OAuth connection. You can rename it here; its credential is renewed by re-authorizing it."}),G&&Y.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"w6w-muted w6w-small",children:"Leave a binding field blank to keep it unchanged."}),e.jsx(w.AuthFieldsForm,{mode:"edit",fields:Y,values:v,onChange:T,enterSubmitProps:ne})]}),ce&&e.jsxs("div",{className:"w6w-stack","data-w6w":"credential-section",children:[typeof a.testCredential=="function"&&e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:je,children:"Test credential"}),B&&e.jsxs("p",{className:"w6w-small","data-w6w":"credential-health",children:["Credential health: ",B.ok?"ok":B.code??"failed"]})]}),e.jsxs("p",{className:"w6w-small","data-w6w":"app-access",children:["App access:"," ",t.lastTestOk===!0?"passed":t.lastTestOk===!1?"failed":"never tested"]}),G&&!de&&I.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"w6w-muted w6w-small",children:["Leave the credential blank to keep it unchanged. To replace it, enter the full new credential and click Save.",S!==null&&S>1&&` This credential is used by ${S} connections; saving a new credential updates all of them.`]}),e.jsx(w.AuthFieldsForm,{mode:"edit",fields:I,values:x,onChange:y,enterSubmitProps:ne})]}),z&&e.jsx("p",{className:"w6w-muted w6w-small","data-w6w":"shared-credential-note",children:"Uses a shared credential. Rotate it under Integrations → Shared credentials."})]}),!G&&!z&&!de&&I.length>0&&e.jsxs(e.Fragment,{children:[!H&&e.jsx("p",{className:"w6w-muted w6w-small",children:"Leave a field blank to keep it unchanged. Filled fields replace the stored credential."}),e.jsx(w.AuthFieldsForm,{mode:"edit",fields:I,values:x,onChange:y,enterSubmitProps:ne})]})]}),j&&e.jsx("div",{className:"w6w-result w6w-error",children:j})]})}),e.jsxs("div",{className:"w6w-modal-actions",children:[e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:s,children:"Cancel"}),l&&e.jsx("button",{type:"button",className:"w6w-btn",disabled:N,onClick:J,children:N?"Saving…":"Save"})]})]})})}function zn({conn:t,app:s,children:n}){return e.jsxs("div",{className:"w6w-connection-header","data-testid":"connection-header",children:[e.jsx(w.AppIcon,{src:s==null?void 0:s.iconSvg,srcDark:s==null?void 0:s.iconSvgDark,brandColor:s==null?void 0:s.brandColor,name:(s==null?void 0:s.displayName)??t.appId,size:56}),e.jsxs("div",{className:"w6w-connection-header-main",children:[e.jsx("h2",{className:"w6w-connection-header-title",children:t.displayName||t.id}),e.jsxs("p",{className:"w6w-muted w6w-small w6w-connection-header-meta",children:[e.jsx(Wt,{value:t.id,className:"w6w-connection-id-copy"})," · App"," ",e.jsx("code",{children:t.appId})," · Auth ",e.jsx("code",{children:t.authKey})," ·"," ",e.jsx("span",{className:`w6w-connection-tag${t.state==="connected"?"":" w6w-connection-tag-warn"}`,children:t.state}),t.lastTestOk===!1&&e.jsx("span",{className:"w6w-connection-tag w6w-connection-tag-danger",title:"Last test failed — update or re-test.",children:"invalid"})]})]}),n&&e.jsx("div",{className:"w6w-connection-header-actions",children:n})]})}const Gn=t=>String(t);function Dt(t){const s=Math.min(100,Math.max(0,t));return Number(s.toFixed(4))}function Xn({label:t,used:s,limit:n,reserved:a=0,format:r,className:i,testId:l}){const o=r??Gn,d=Number.isFinite(a)&&a>0,c=n>0?Dt(s/n*100):100,p=d&&n>0?Dt(Math.min(100-c,a/n*100)):0,x=s>=n,y=`${o(s)} / ${o(n)}`,m=["w6w-budget-meter"];return x&&m.push("w6w-budget-meter-over"),i&&m.push(i),e.jsxs("div",{role:"meter",className:m.join(" "),"aria-label":t,"aria-valuemin":0,"aria-valuenow":s,"aria-valuemax":n,"aria-valuetext":y,"data-testid":l,children:[e.jsxs("div",{className:"w6w-budget-meter-head",children:[e.jsx("span",{className:"w6w-budget-meter-label",children:t}),e.jsx("span",{className:"w6w-budget-meter-value",children:y})]}),e.jsxs("div",{className:"w6w-budget-meter-track",children:[e.jsx("div",{className:"w6w-budget-meter-used",style:{width:`${c}%`}}),d&&e.jsx("div",{className:"w6w-budget-meter-reserved",style:{width:`${p}%`}})]})]})}const as={kv:"Key-value",doc:"Document",table:"Table"},Zn=["kv","doc","table"],st=["string","number","integer","boolean","date","datetime"],ls=5242880;function Qn(t){var n;const s=(n=t.schema)==null?void 0:n.valueType;return typeof s=="string"&&st.includes(s)?s:"string"}function ea(t){var a,r;if(t.kind!=="table")return null;const s=(a=t.schema)==null?void 0:a.columns;if(!Array.isArray(s))return null;const n=(r=t.schema)==null?void 0:r.key;return typeof n=="string"?{columns:s,key:n}:{columns:s}}function ta(t,s){const n=t==null?void 0:t.match(/filename="([^"]*)"/),a=n==null?void 0:n[1];return a!==void 0&&a!==""?a:`${s}.csv`}const rs={required:"Required.",not_a_number:"Enter a number.",not_an_integer:"Enter a whole number.",not_a_boolean:"Enter true or false.",not_a_date:"Enter a date as YYYY-MM-DD.",not_a_datetime:"Enter a date-time like 2026-01-31T09:30:00Z."},sa=/^-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?$/,na=/^-?(0|[1-9]\d*)$/,aa=/^\d{4}-\d{2}-\d{2}$/,la=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function ra(t,s){return s===2?t%4===0&&t%100!==0||t%400===0?29:28:[31,0,31,30,31,30,31,31,30,31,30,31][s-1]}function nt(t){if(!aa.test(t))return null;const s=Number(t.slice(0,4)),n=Number(t.slice(5,7)),a=Number(t.slice(8,10));return n<1||n>12||a<1||a>ra(s,n)?null:{year:s,month:n,day:a}}function ee(t){return{ok:!1,problem:t,message:rs[t]}}function Ie(t,s,n){const a=s.trim();if(a==="")return n?ee("required"):{ok:!0,value:void 0};switch(t){case"string":return{ok:!0,value:s};case"number":{if(!sa.test(a))return ee("not_a_number");const r=Number(a);return Number.isFinite(r)?{ok:!0,value:r}:ee("not_a_number")}case"integer":{if(!na.test(a))return ee("not_an_integer");const r=Number(a);return Number.isSafeInteger(r)?{ok:!0,value:r}:ee("not_an_integer")}case"boolean":return a==="true"?{ok:!0,value:!0}:a==="false"?{ok:!0,value:!1}:ee("not_a_boolean");case"date":return nt(a)===null?ee("not_a_date"):{ok:!0,value:a};case"datetime":return is(a)?{ok:!0,value:a}:ee("not_a_datetime")}}function is(t){if(!la.test(t)||nt(t.slice(0,10))===null)return!1;const s=Number(t.slice(11,13)),n=Number(t.slice(14,16)),a=Number(t.slice(17,19));if(s>23||n>59||a>59)return!1;const i=t.slice(19).match(/(Z|([+-])(\d{2}):(\d{2}))$/);return i===null||i[1]==="Z"?!0:Number(i[3])<=23&&Number(i[4])<=59}function Pe(t,s){if(s==null)return"";if((t==="string"||t==="date"||t==="datetime")&&typeof s=="string")return s;if((t==="number"||t==="integer")&&typeof s=="number"&&Number.isFinite(s))return String(s);if(t==="boolean"&&typeof s=="boolean")return s?"true":"false";const n=JSON.stringify(s);return n===void 0?"":n}function ia(t,s){switch(t){case"string":return typeof s=="string";case"number":return typeof s=="number"&&Number.isFinite(s);case"integer":return Number.isSafeInteger(s);case"boolean":return typeof s=="boolean";case"date":return typeof s=="string"&&nt(s)!==null;case"datetime":return typeof s=="string"&&is(s)}}const oe="The request failed.",os="Could not reach the server.";function le(t){return typeof t=="string"&&t.length>0?t:void 0}function cs(t){return Number.isInteger(t)&&t>=0?t:void 0}function ds(t,s,n){const a={message:oe};typeof n=="number"&&(a.status=n);const r=t!==null&&typeof t=="object"?t.error:void 0;if(r!==null&&typeof r=="object"){const i=r,l=le(i.code);l!==void 0&&(a.code=l);const o=le(i.field);o!==void 0&&(a.field=o);const d=le(i.column);d!==void 0&&(a.column=d);const c=cs(i.row);c!==void 0&&(a.row=c);const p=le(i.message);p!==void 0&&(a.message=p)}if(a.message===oe)for(const i of s){const l=le(i);if(l!==void 0){a.message=l;break}}return a}function oa(t){try{const s=t!==null&&typeof t=="object"?t:void 0,n=s==null?void 0:s.raw,a=s==null?void 0:s.message;return ds(n,[a],s==null?void 0:s.status)}catch{return{message:oe}}}function us(t){try{if(t.status===0)return{status:0,code:"network_error",message:os};let s;try{s=JSON.parse(t.text)}catch{return{status:t.status,message:oe}}return ds(s,[],t.status)}catch{return{message:oe}}}function ws(t){const s=le(t.column);if(s!==void 0){const a=cs(t.row);return a===void 0?{kind:"cell",column:s}:{kind:"cell",column:s,row:a}}const n=le(t.field);return n!==void 0?{kind:"field",field:n}:{kind:"form"}}function Ze(t){return t+2}const at="\0new",lt="Changed by someone else since you loaded it.",Qe="Enter a JSON object or array.",ms="The file is larger than 5 MB.";function hs(t){const s=t.value;return s!==null&&typeof s=="object"&&!Array.isArray(s)?s:{}}function ca(t,s){const n=hs(t),a={};for(const r of s)a[r.name]=Pe(r.type,n[r.name]);return{id:t.key,version:t.version,cells:a}}function da(t){const s={};for(const n of t)s[n.name]=n.default===void 0?"":Pe(n.type,n.default);return{id:at,version:null,cells:s}}function ua(t,s,n){const a=[];for(const r of n)(t.cells[r.name]??"")!==(s.cells[r.name]??"")&&a.push(r.name);return a}function wa(t,s){const n={},a={};for(const r of s){const i=Ie(r.type,t.cells[r.name]??"",r.required);i.ok?i.value!==void 0&&(n[r.name]=i.value):a[r.name]=i.message}return Object.keys(a).length>0?{ok:!1,errors:a}:{ok:!0,value:n}}function ma(t,s){if(t===null)return;const n=Date.parse(t);if(!Number.isFinite(n))return;const a=Math.ceil((n-s)/1e3);return a>0?a:void 0}function ha(t,s,n){if(t.id===at)return n===void 0?{kind:"insert",value:s}:{kind:"insert",value:s,ttlSeconds:n};const a={kind:"put",key:t.id,value:s,ifVersion:t.version??0};return n===void 0?a:{...a,ttlSeconds:n}}function pa(t,s){const n=ws(t);return n.kind!=="cell"||!s.some(a=>a.name===n.column)?null:{[n.column]:t.message}}function xa(t){return t.status===409&&t.code==="version_conflict"}function ps(t){let s;try{s=JSON.parse(t)}catch{return{ok:!1,message:Qe}}return s===null||typeof s!="object"?{ok:!1,message:Qe}:{ok:!0,value:s}}function fa(t,s){if(t==="string")return{ok:!0,value:s};const n=Ie(t,s,!0);return n.ok?{ok:!0,value:n.value}:{ok:!1,message:n.message}}function ga(t){if(t.status===200){let a=0;try{const r=JSON.parse(t.text);typeof r.imported=="number"&&Number.isFinite(r.imported)&&(a=r.imported)}catch{a=0}return{ok:!0,message:`Imported ${a} row${a===1?"":"s"}.`}}const s=us(t);return s.row===void 0?{ok:!1,message:s.message}:{ok:!1,message:`${s.column?`Line ${Ze(s.row)}, column ${s.column}`:`Line ${Ze(s.row)}`}: ${s.message}`}}function ja({stores:t,loading:s,error:n,onOpen:a,getHref:r,onEdit:i,onArchive:l,busy:o,formatSize:d,slots:c}){const p=d??Kt,x=i!==void 0||l!==void 0,y=[{key:"name",header:"Name",render:m=>e.jsx("strong",{children:m.name})},{key:"kind",header:"Kind",render:m=>as[m.kind]},{key:"entries",header:"Entries",align:"right",render:m=>String(m.entryCount)},{key:"size",header:"Size",align:"right",render:m=>p(m.sizeBytes)}];return x&&y.push({key:"actions",header:"",align:"right",link:!1,actions:!0,render:m=>e.jsxs("div",{className:"w6w-data-row-actions",onClick:h=>h.stopPropagation(),children:[i&&e.jsx(tt,{label:"Edit",onClick:()=>i(m),"data-testid":`data-store-edit-${m.id}`}),l&&e.jsx(w.DeleteButton,{label:"Archive",onClick:()=>l(m),disabled:o,"data-testid":`data-store-archive-${m.id}`})]})}),e.jsxs("section",{className:"w6w-data-store-list",children:[((c==null?void 0:c.header)!=null||(c==null?void 0:c.actions)!=null)&&e.jsxs("div",{className:"w6w-data-store-list-head",children:[e.jsx("div",{className:"w6w-data-store-list-heading",children:c==null?void 0:c.header}),e.jsx("div",{className:"w6w-data-store-list-actions",children:c==null?void 0:c.actions})]}),n&&e.jsx("div",{className:"w6w-error",children:n}),s&&e.jsx("p",{className:"w6w-muted",children:"Loading…"}),t.length===0&&!s?e.jsx(w.EmptyState,{testId:"w6w-data-store-list-empty",children:(c==null?void 0:c.empty)??"No data stores yet."}):e.jsx(w.DataTable,{columns:y,rows:t,rowKey:m=>m.id,loading:s,getRowHref:r?m=>r(m.id):void 0,onRowClick:a?(m,h)=>a(m.id,h):void 0})]})}function ya(t){return t.name!==""&&t.required===!0&&(t.type==="string"||t.type==="integer")}function va(t,s){const{default:n,...a}=t,r=Ie(t.type,s,!1);return r.ok?r.value===void 0?{column:a}:{column:{...a,default:r.value}}:{column:a,error:r.message}}function ba(t){const{columns:s,onChange:n,keyColumn:a,onKeyColumnChange:r,columnErrors:i}=t,[l,o]=g.useState({}),d=s.filter(ya),c=d.some(h=>h.name===a)?a:"";g.useEffect(()=>{a!==""&&c===""&&r("")},[a,c,r]);function p(){n([...s,{name:"",type:"string",required:!1}])}function x(h,j){n(s.map((u,N)=>N===h?{...u,...j}:u))}function y(h,j,u,N){const b={...s[h],...N,type:j},{column:v,error:T}=va(b,u);o(S=>({...S,[h]:T===void 0?{text:u}:{text:u,error:T}})),n(s.map((S,$)=>$===h?v:S))}function m(h){o(j=>{const u={};for(const[N,b]of Object.entries(j)){const v=Number(N);v<h?u[v]=b:v>h&&(u[v-1]=b)}return u}),n(s.filter((j,u)=>u!==h))}return e.jsxs("div",{className:"w6w-data-columns",children:[e.jsxs("div",{className:"w6w-data-columns-head",children:[e.jsx("h3",{children:"Columns"}),e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:p,children:"+ Add column"})]}),e.jsx("p",{className:"w6w-muted w6w-small",children:"Each column has a name, a scalar type, whether it must be set, and an optional default."}),s.length===0&&e.jsx("p",{className:"w6w-muted w6w-small",children:"No columns yet."}),s.length>0&&e.jsxs("div",{className:"w6w-data-columns-row w6w-data-columns-colhead","aria-hidden":"true",children:[e.jsx("span",{children:"Name"}),e.jsx("span",{children:"Type"}),e.jsx("span",{}),e.jsx("span",{children:"Default"}),e.jsx("span",{})]}),e.jsx("ul",{className:"w6w-data-columns-list","data-testid":"data-columns",children:s.map((h,j)=>{const u=l[j],N=(u==null?void 0:u.text)??Pe(h.type,h.default);return e.jsxs("li",{className:"w6w-data-columns-row",children:[e.jsx("input",{type:"text",value:h.name,placeholder:"name","aria-label":"Column name",onChange:b=>x(j,{name:b.target.value})}),e.jsx("select",{value:h.type,"aria-label":"Column type",onChange:b=>y(j,b.target.value,N),children:st.map(b=>e.jsx("option",{value:b,children:b},b))}),e.jsxs("label",{className:"w6w-data-columns-required",children:[e.jsx("input",{type:"checkbox",checked:h.required,"aria-label":"Required",onChange:b=>x(j,{required:b.target.checked})}),e.jsx("span",{className:"w6w-muted w6w-small",children:"required"})]}),e.jsx("input",{type:"text",value:N,placeholder:"default","aria-label":"Column default",onChange:b=>y(j,h.type,b.target.value)}),e.jsx(w.DeleteButton,{label:`Remove column ${h.name||j+1}`,onClick:()=>m(j)}),(u==null?void 0:u.error)!==void 0&&e.jsx("div",{className:"w6w-result w6w-error w6w-data-columns-error","data-testid":`data-store-column-default-error-${j}`,children:u.error}),h.name!==""&&i[h.name]!==void 0&&e.jsx("div",{className:"w6w-result w6w-error w6w-data-columns-error","data-testid":`data-store-column-error-${h.name}`,children:i[h.name]})]},j)})}),e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Key column"}),e.jsxs("select",{value:c,onChange:h=>r(h.target.value),children:[e.jsx("option",{value:"",children:"(none — rows get generated keys)"}),d.map(h=>e.jsx("option",{value:h.name,children:h.name},h.name))]}),e.jsx("span",{className:"w6w-hint",children:"Only a required, string or integer column can name a row's key."})]})]})}function Na({result:t,busy:s,onImport:n,onRefuse:a,onExport:r}){function i(l){var c;const o=l.target,d=(c=o.files)==null?void 0:c[0];if(d!==void 0){if(o.value="",d.size>ls){a(ms);return}n(d)}}return e.jsxs("div",{className:"w6w-data-csv-panel","data-testid":"csv-panel",children:[e.jsxs("div",{className:"w6w-data-csv-panel-actions",children:[e.jsx("input",{type:"file",accept:".csv,text/csv","data-testid":"csv-file","aria-label":"Import CSV",onChange:i}),e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"csv-export",disabled:s,onClick:r,children:"Export CSV"})]}),t!==null&&e.jsx("div",{className:t.ok?"w6w-result":"w6w-result w6w-error","data-testid":"csv-result",children:t.message})]})}function ka({rows:t,empty:s,loading:n,searchValue:a,hasMore:r,onOpen:i,onSearch:l,onNew:o,onLoadMore:d}){const[c,p]=g.useState(a??""),x=m=>{m.preventDefault(),l(c)},y=[{key:"key",header:"Key",width:"26%",render:m=>e.jsx("button",{type:"button",className:"w6w-data-entry-key",title:m.key,"data-testid":"entry-key",onClick:h=>{h.stopPropagation(),i(m.key)},children:m.key})},{key:"value",header:"Value",render:m=>m.copyText!==void 0?e.jsx(F.Copyable,{value:m.copyText,label:"Copy value",className:"w6w-copyable--bare",children:e.jsx("span",{className:"w6w-data-entry-preview",children:m.preview})}):e.jsx("span",{className:"w6w-data-entry-preview",children:m.preview})}];return e.jsxs("div",{children:[e.jsxs("form",{className:"w6w-data-entries-toolbar","data-testid":"entry-search",onSubmit:x,children:[e.jsx("input",{type:"search","data-testid":"entry-prefix",value:c,placeholder:"Key prefix","aria-label":"Key prefix",onChange:m=>p(m.target.value)}),e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"submit",children:"Search"}),e.jsx("button",{className:"w6w-btn w6w-data-entry-new",type:"button","data-testid":"entry-new",onClick:o,children:"+ New entry"})]}),e.jsx(w.DataTable,{className:"w6w-data-entry-list",onRowClick:m=>i(m.key),columns:y,rows:t,rowKey:m=>m.key,empty:e.jsx("div",{className:"w6w-muted w6w-small",children:n?"Loading…":s??"No entries match this key prefix."})}),r&&e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"entries-load-more",onClick:d,children:"Load more"})]})}function Ca({kind:t,isNew:s,entryKey:n,newKey:a,expiresAt:r,text:i,error:l,conflict:o,saving:d,onTextChange:c,onKeyChange:p,onDelete:x,onSave:y,onCancel:m,onReload:h}){const[j,u]=g.useState(s),[N,b]=g.useState(!1),v=g.useRef(null);g.useEffect(()=>{var _;s||(_=v.current)==null||_.focus()},[s]);const T=t==="doc"?"document":"entry",S=t==="doc"?ps(i):void 0,$=S!==void 0&&!S.ok,E=l||(N&&S&&!S.ok?S.message:null),L=e.jsxs(e.Fragment,{children:[s?e.jsxs("label",{className:"w6w-field",children:[e.jsx("span",{children:"Key"}),e.jsx("input",{"data-testid":"entry-new-key",value:a??"",placeholder:"Key","aria-label":"Key",onChange:_=>p(_.target.value)})]}):r?e.jsxs("p",{className:"w6w-muted w6w-small",children:["Expires ",r]}):null,t==="doc"?e.jsx(w.JsonEditor,{value:i,readOnly:!j,onChange:_=>{b(!1),c(_)},onFocus:()=>b(!1),onBlur:()=>b(!0),showDiagnostics:N,minHeight:"min(50vh, 400px)",maxHeight:"60vh"}):e.jsx(F.Copyable,{value:i,label:"Copy value",children:e.jsx("input",{type:"text","data-testid":"entry-value",value:i,"aria-label":"Value",readOnly:!j,onChange:_=>c(_.target.value)})}),E&&e.jsx("div",{className:"w6w-field-error",role:"alert","data-testid":"entry-value-error",children:E}),o&&e.jsxs("div",{className:"w6w-error","data-testid":"entry-conflict",children:[lt," ",e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"entry-reload",onClick:h,children:"Reload"})]})]});return e.jsxs(w.Modal,{title:s?`New ${T}`:j?`Edit ${T}`:t==="doc"?"Document":"Entry",subtitle:s?void 0:n,size:t==="doc"?"wide":"default",onClose:d?()=>{}:m,children:[e.jsx("div",{className:"w6w-modal-body","data-testid":"entry-editor",children:L}),e.jsxs("div",{className:"w6w-modal-actions",children:[!s&&x&&e.jsx(w.DeleteButton,{label:"Delete entry",className:"w6w-data-entry-delete",disabled:d,onClick:x}),e.jsx("button",{ref:v,className:"w6w-btn w6w-btn-ghost",type:"button",disabled:d,onClick:m,children:j?"Cancel":"Close"}),j?e.jsx("button",{className:"w6w-btn",type:"button","data-testid":"entry-save",disabled:!!o||!!d||$||s&&!(a!=null&&a.trim()),onClick:y,children:"Save"}):e.jsx("button",{className:"w6w-btn",type:"button",disabled:d,onClick:()=>u(!0),children:"Edit"})]})]})}const Ce=t=>t.isNew?"new":t.id;function Sa({columns:t,keyColumn:s,rows:n,error:a,loading:r,empty:i,searchValue:l,hasMore:o,onCellChange:d,onSave:c,onDelete:p,onReload:x,onAddRow:y,onLoadMore:m,onSearch:h}){const[j,u]=g.useState(l??""),N=v=>{v.preventDefault(),h(j)},b=[...t.map(v=>({key:v.name,header:e.jsxs(e.Fragment,{children:[v.name," ",e.jsx("span",{className:"w6w-muted w6w-small",children:v.type})]}),render:T=>{var $;const S=($=T.cellErrors)==null?void 0:$[v.name];return e.jsxs("div",{className:"w6w-data-cell",children:[e.jsx("input",{"data-row":Ce(T),"data-column":v.name,value:T.cells[v.name]??"",readOnly:v.name===s&&!T.isNew,"aria-label":`${v.name} (${v.type})`,onChange:E=>d(T.id,v.name,E.target.value)}),S!==void 0&&e.jsx("div",{className:"w6w-data-cell-error","data-row":Ce(T),"data-column":v.name,children:S})]})}})),{key:"actions",header:"",actions:!0,render:v=>e.jsxs("div",{className:"w6w-data-row-actions",children:[e.jsx("span",{className:"w6w-muted w6w-small",children:v.version===null?"":`v${v.version}`}),e.jsx(w.IconButton,{icon:"check",label:"Save row","data-row":Ce(v),"data-testid":"row-save",disabled:!v.isNew&&!v.dirty||!!v.conflict,onClick:()=>c(v.id)}),e.jsx(w.DeleteButton,{label:"Delete entry",onClick:()=>p(v.id)}),v.conflict&&e.jsxs("div",{className:"w6w-error","data-row":Ce(v),"data-testid":"row-conflict",children:[lt," ",e.jsx(w.IconButton,{icon:"sync",label:"Reload row","data-testid":"row-reload",onClick:()=>x(v.id)})]})]})}];return e.jsxs("div",{children:[a!=null&&a!==""&&e.jsx("div",{className:"w6w-error","data-testid":"grid-error",children:a}),e.jsxs("form",{className:"w6w-data-entries-toolbar","data-testid":"entry-search",onSubmit:N,children:[e.jsx("input",{type:"search","data-testid":"entry-prefix",value:j,placeholder:"Key prefix","aria-label":"Key prefix",onChange:v=>u(v.target.value)}),e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"submit",children:"Search"}),e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"grid-add-row",onClick:y,children:"Add row"})]}),e.jsx("div",{className:"w6w-data-grid-scroll","data-testid":"data-grid-scroll",children:e.jsx(w.DataTable,{columns:b,rows:n,rowKey:v=>v.id,empty:e.jsx("div",{className:"w6w-muted w6w-small",children:r?"Loading…":i??"No rows match this key prefix."})})}),o&&e.jsx("button",{className:"w6w-btn w6w-btn-ghost",type:"button","data-testid":"entries-load-more",onClick:m,children:"Load more"})]})}class X extends Error{constructor(n,a){super(a);we(this,"code");this.name="CallableRunError",this.code=n}}function xs(t,s){const n=s==null?void 0:s.trim();if(n)return n;const a=t.split(".").filter(r=>r!=="");return a[a.length-1]??t}function fs(t,s,n="send_confirmation"){const a=`${s}.${n}`;return t.find(r=>r.tags.includes(a))??null}function rt(t){return w.callableTriggers(t).map(s=>{var n;return{id:s.id,fields:w.asFieldDefs((n=s.with)==null?void 0:n.fields)}})}function Ea(t){return"callableId"in t}function gs(t,s,n,a){if(Ea(t)){const i={kind:t.kind,id:t.callableId,input:{[t.field]:s}};return t.kind==="workflow"&&(i.entry=t.entry),i}const r={kind:t.kind,id:t.id,input:{[n]:s}};if(t.kind==="workflow"){const i=a?rt(a)[0]:void 0;if(!i)throw new X("no-trigger",`Workflow ${t.name} has no manual trigger.`);r.entry=i.id}return r}async function js(t,s){if(s.kind==="workflow"){const n=await t.runWorkflow(s.id,{entry:s.entry,input:s.input});if(n.error||n.status==="failed"||n.status==="error"){const a=n.error;throw new X("failed",typeof a=="string"?a:a?JSON.stringify(a):`Workflow ${n.status}`)}return n.output}if(s.kind==="function")return t.invokeFunction(s.id,s.input);if(!t.invokeEndpoint)throw new X("unsupported","This host does not support running endpoints.");return t.invokeEndpoint(s.id,s.input)}async function it(t,s,n,a,r){const i=s.kind==="workflow"?await t.getWorkflow(s.id):void 0,l=gs(s,n,a,i);return js(t,r?{...l,input:{...l.input,...r}}:l)}async function Ta(t,s){if(s.kind==="workflow"){let n;try{n=await t.getWorkflow(s.callableId)}catch{return`Workflow ${s.callableId} no longer exists.`}return!s.entry||!rt(n).some(a=>a.id===s.entry)?`Step ${s.entry??"(none)"} is no longer a manual trigger of ${s.callableId}.`:null}if(s.kind==="function")try{await t.getFunction(s.callableId)}catch{return`Function ${s.callableId} no longer exists.`}return null}async function ys(t,s,n){if(!t.getCallableBinding)throw new X("unsupported","This host does not support callable bindings.");const a=await t.getCallableBinding(s);if(!a)throw new X("unbound",`No callable is bound to ${s}.`);const r=await Ta(t,a);if(r)throw new X("stale",r);return js(t,gs(a,n,a.field))}function vs(t){return t instanceof Error?t:new Error(String(t))}function ot({onResult:t,onError:s}){const[n,a]=g.useState({status:"idle"}),r=g.useRef(!0);g.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]);const i=g.useRef({onResult:t,onError:s});i.current={onResult:t,onError:s};const l=g.useCallback(async o=>{var d,c,p,x;a({status:"loading"});try{const y=await o();r.current&&a({status:"success",output:y}),(c=(d=i.current).onResult)==null||c.call(d,y)}catch(y){const m=vs(y);r.current&&a({status:"error",error:m}),(x=(p=i.current).onError)==null||x.call(p,m)}},[]);return{state:n,run:l}}function bs(t){const s=w.useW6WApi(),[n,a]=g.useState({status:"loading"});return g.useEffect(()=>{let r=!0;if(!s.listCallables){a({status:"error",error:new X("unsupported","This host does not support listing callables.")});return}return a({status:"loading"}),s.listCallables({tag:t}).then(i=>r&&a({status:"ready",refs:i})).catch(i=>r&&a({status:"error",error:vs(i)})),()=>{r=!1}},[s,t]),n}function ct({error:t,onSetup:s}){const n=t instanceof X&&(t.code==="stale"||t.code==="unbound");return e.jsxs("div",{className:"w6w-error w6w-small",role:"alert",children:[t.message,n&&s&&e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:s,children:"Set up"})]})]})}function dt({callable:t,bindingKey:s,data:n,prop:a="data",onClose:r,onSetup:i,onResult:l,onError:o,title:d}){const c=w.useW6WApi(),{state:p,run:x}=ot({onResult:l,onError:o}),[y,m]=g.useState(""),[h,j]=g.useState(null),u=s||((t==null?void 0:t.name)??"callable"),N=()=>{let b;if(y.trim())try{const v=JSON.parse(y);if(!v||typeof v!="object"||Array.isArray(v))throw new Error("not an object");b=v}catch{j("Additional inputs must be a JSON object.");return}j(null),s?x(()=>ys(c,s,n)):t&&x(()=>it(c,t,n,a,b))};return e.jsxs(w.Modal,{title:d??`Run ${u}`,onClose:r,children:[e.jsx("div",{className:"w6w-modal-body",children:p.status==="success"?e.jsx(w.ResultViewer,{value:p.output}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"w6w-muted w6w-small",children:["Run ",u," with this data?"]}),e.jsx("pre",{className:"w6w-small",children:JSON.stringify(n,null,2)}),e.jsxs("label",{className:"w6w-small",children:["Additional inputs (JSON, optional)",e.jsx("textarea",{"aria-label":"Additional inputs",value:y,disabled:p.status==="loading",onChange:b=>m(b.target.value)})]}),h&&e.jsx("div",{className:"w6w-error w6w-small",children:h}),p.status==="error"&&e.jsx(ct,{error:p.error,onSetup:i})]})}),e.jsxs("div",{className:"w6w-modal-actions",children:[e.jsx("button",{type:"button",className:"w6w-btn w6w-btn-ghost",onClick:r,children:p.status==="success"?"Close":"Cancel"}),p.status!=="success"&&e.jsx("button",{type:"button",className:"w6w-btn",onClick:N,disabled:p.status==="loading",children:p.status==="loading"?"Running…":"Run"})]})]})}function $a({tag:t="",bindingKey:s,defaultAction:n,data:a,as:r,confirm:i=!1,label:l="Run",onSetup:o,onResult:d,onError:c}){const p=w.useW6WApi(),x=bs(s?"":t),{state:y,run:m}=ot({onResult:d,onError:c}),[h,j]=g.useState(!1),u=xs(t,r),N=x.status==="ready"?fs(x.refs,t,n):null;let b=y.status==="loading",v=y.status==="loading"?"Running…":l;s||(x.status==="loading"?(b=!0,v="Loading…"):x.status==="ready"&&!N?(b=!0,v="No default action"):x.status==="error"&&(b=!0));const T=()=>{if(i)return j(!0);s?m(()=>ys(p,s,a)):N&&m(()=>it(p,N,a,u))},$=(!s&&x.status==="error"?x.error:null)??(y.status==="error"?y.error:null);return e.jsxs("span",{className:"w6w-run-callable",children:[e.jsx("button",{type:"button",className:"w6w-btn",disabled:b,onClick:T,children:v}),y.status==="success"&&e.jsx("span",{className:"w6w-muted w6w-small",children:" Done"}),$&&e.jsx(ct,{error:$,onSetup:o}),h&&e.jsx(dt,{callable:N??void 0,bindingKey:s,data:a,prop:u,onSetup:o,onClose:()=>j(!1),onResult:d,onError:c})]})}function Ra({tag:t,defaultAction:s,data:n,as:a,confirm:r=!1,label:i="Run",onResult:l,onError:o}){const d=w.useW6WApi(),c=bs(t),{state:p,run:x}=ot({onResult:l,onError:o}),[y,m]=g.useState(null),[h,j]=g.useState(!1),u=xs(t,a),N=c.status==="ready"?c.refs:[],b=fs(N,t,s),v=y??(b==null?void 0:b.id)??"",T=N.find(E=>E.id===v)??null,S=()=>{if(T){if(r)return j(!0);x(()=>it(d,T,n,u))}},$=c.status==="error"?c.error:p.status==="error"?p.error:null;return e.jsxs("span",{className:"w6w-run-callables",children:[e.jsxs("select",{"aria-label":"Callable",value:v,disabled:c.status!=="ready"||p.status==="loading",onChange:E=>m(E.target.value),children:[c.status==="loading"&&e.jsx("option",{value:"",children:"Loading…"}),c.status==="ready"&&!T&&e.jsx("option",{value:"",disabled:!0,children:N.length===0?"Nothing to run":"Choose…"}),N.map(E=>e.jsx("option",{value:E.id,children:E.name},E.id))]})," ",e.jsx("button",{type:"button",className:"w6w-btn",disabled:!T||p.status==="loading",onClick:S,children:p.status==="loading"?"Running…":i}),p.status==="success"&&e.jsx("span",{className:"w6w-muted w6w-small",children:" Done"}),$&&e.jsx(ct,{error:$}),h&&T&&e.jsx(dt,{callable:T,data:n,prop:u,onClose:()=>j(!1),onResult:l,onError:o})]})}const Ft=t=>t instanceof Error?t:new Error(String(t));function Aa({hostKey:t,tag:s="",onSaved:n,onError:a}){var H;const r=w.useW6WApi(),[i,l]=g.useState(null),[o,d]=g.useState(null),[c,p]=g.useState(""),[x,y]=g.useState({status:"idle"}),[m,h]=g.useState(""),[j,u]=g.useState(""),[N,b]=g.useState(!1),[v,T]=g.useState(!1),S=g.useRef(a);S.current=a;const $=g.useRef(k=>{var I;const M=Ft(k);d(M),(I=S.current)==null||I.call(S,M)}).current;g.useEffect(()=>{let k=!0;if(!r.listCallables||!r.saveCallableBinding){$(new X("unsupported","This host does not support callable bindings."));return}return r.listCallables({tag:s}).then(M=>k&&l(M)).catch(M=>k&&$(M)),()=>{k=!1}},[r,s,$]);const E=(i==null?void 0:i.find(k=>k.id===c))??null;g.useEffect(()=>{if(h(""),u(""),T(!1),!E)return y({status:"idle"});let k=!0;return y({status:"loading"}),(async()=>{if(E.kind==="workflow"){const I=rt(await r.getWorkflow(E.id));return I.length===0?{status:"error",message:"This workflow has no manual trigger."}:{status:"ready",triggers:I,fields:[]}}if(E.kind==="function"){const I=await r.getFunction(E.id);return{status:"ready",triggers:[],fields:I.inputs.map(U=>U.key)}}return{status:"ready",triggers:[],fields:[]}})().then(I=>k&&y(I)).catch(I=>k&&y({status:"error",message:Ft(I).message})),()=>{k=!1}},[r,E]);const L=x.status==="ready"?x.triggers:[],_=L.length===1?L[0].id:m,R=(E==null?void 0:E.kind)==="workflow"?((H=L.find(k=>k.id===_))==null?void 0:H.fields.map(k=>k.key).filter(k=>!!k))??[]:x.status==="ready"?x.fields:[],B=(E==null?void 0:E.kind)==="workflow",se=!!E&&!!j&&(!B||!!_)&&!N,P=async()=>{if(!E||!r.saveCallableBinding)return;const k={kind:E.kind,callableId:E.id,field:j,...B?{entry:_}:{}};b(!0);try{await r.saveCallableBinding(t,k),T(!0),n==null||n(k)}catch(M){$(M)}finally{b(!1)}};return o&&!i?e.jsx("div",{className:"w6w-error w6w-small",role:"alert",children:o.message}):e.jsxs("div",{className:"w6w-callable-binding-setup",children:[e.jsxs("label",{className:"w6w-small",children:["Callable",e.jsxs("select",{"aria-label":"Callable",value:c,disabled:!i,onChange:k=>p(k.target.value),children:[e.jsx("option",{value:"",disabled:!0,children:i?"Choose…":"Loading…"}),(i??[]).map(k=>e.jsxs("option",{value:k.id,children:[k.name," (",k.kind,")"]},k.id))]})]}),x.status==="error"&&e.jsx("div",{className:"w6w-error w6w-small",role:"alert",children:x.message}),L.length>1&&e.jsxs("label",{className:"w6w-small",children:["Trigger",e.jsxs("select",{"aria-label":"Trigger",value:m,onChange:k=>{h(k.target.value),u("")},children:[e.jsx("option",{value:"",disabled:!0,children:"Choose…"}),L.map(k=>e.jsx("option",{value:k.id,children:k.id},k.id))]})]}),x.status==="ready"&&(!B||_)&&e.jsxs("div",{className:"w6w-small",children:["Field",R.length>0?e.jsxs("select",{"aria-label":"Field",value:j,onChange:k=>u(k.target.value),children:[e.jsx("option",{value:"",disabled:!0,children:"Choose…"}),R.map(k=>e.jsx("option",{value:k,children:k},k))]}):e.jsx("input",{"aria-label":"Field",value:j,placeholder:"input name",onChange:k=>u(k.target.value)})]}),e.jsx("button",{type:"button",className:"w6w-btn",disabled:!se,onClick:P,children:N?"Saving…":"Save binding"}),v&&e.jsx("span",{className:"w6w-muted w6w-small",children:" Saved"}),o&&i&&e.jsx("div",{className:"w6w-error w6w-small",role:"alert",children:o.message})]})}exports.AddConnectionModal=w.AddConnectionModal;exports.ApiCallsPanel=w.ApiCallsPanel;exports.AppIcon=w.AppIcon;exports.AppPicker=w.AppPicker;exports.AuthFieldsForm=w.AuthFieldsForm;exports.CanvasLayer=w.CanvasLayer;exports.CodeEditor=w.CodeEditor;exports.Combobox=w.Combobox;exports.ConfirmModal=w.ConfirmModal;exports.CreateSharedCredentialContext=w.CreateSharedCredentialContext;exports.CredentialPicker=w.CredentialPicker;exports.DataTable=w.DataTable;exports.DeleteButton=w.DeleteButton;exports.EmptyState=w.EmptyState;exports.ExpressionEditorModal=w.ExpressionEditorModal;exports.ExpressionInput=w.ExpressionInput;exports.ExpressionOptionsProvider=w.ExpressionOptionsProvider;exports.HTML_PREVIEW_CSP=w.HTML_PREVIEW_CSP;exports.HtmlPreview=w.HtmlPreview;exports.IconButton=w.IconButton;exports.JsonEditor=w.JsonEditor;exports.LastUsedNote=w.LastUsedNote;exports.Markdown=w.Markdown;exports.Modal=w.Modal;exports.NodeConfigForm=w.NodeConfigForm;exports.ParamsForm=w.ParamsForm;exports.PropertyEntryForm=w.PropertyEntryForm;exports.RESULT_RENDER_MAX_CHARS=w.RESULT_RENDER_MAX_CHARS;exports.ResultViewer=w.ResultViewer;exports.RetryPolicyFields=w.RetryPolicyFields;exports.StepBuilderModal=w.StepBuilderModal;exports.W6WUIProvider=w.W6WUIProvider;exports.connectionAppIdsToLookUp=w.connectionAppIdsToLookUp;exports.detectResultFormat=w.detectResultFormat;exports.effectiveNodeOutput=w.effectiveNodeOutput;exports.effectiveNodeOutputs=w.effectiveNodeOutputs;exports.filterOptions=w.filterOptions;exports.findTestInput=w.findTestInput;exports.htmlPreviewSrcDoc=w.htmlPreviewSrcDoc;exports.indexNodeSamples=w.indexNodeSamples;exports.isExprValue=w.isExprValue;exports.isFormResolvedOptions=w.isFormResolvedOptions;exports.isSecretValue=w.isSecretValue;exports.isTestRequired=w.isTestRequired;exports.previewNodeOutputs=w.previewNodeOutputs;exports.rememberableInput=w.rememberableInput;exports.requiredParamsFilled=w.requiredParamsFilled;exports.resolveConnectionAppMeta=w.resolveConnectionAppMeta;exports.resultCopyText=w.resultCopyText;exports.shapeToSkeleton=w.shapeToSkeleton;exports.shouldUseCombobox=w.shouldUseCombobox;exports.splitFrontmatter=w.splitFrontmatter;exports.startOAuthPopup=w.startOAuthPopup;exports.testInputSavesSettled=w.testInputSavesSettled;exports.trackTestInputSave=w.trackTestInputSave;exports.useEnterSubmit=w.useEnterSubmit;exports.useExpressionOptions=w.useExpressionOptions;exports.useRememberedTestInput=w.useRememberedTestInput;exports.useW6WApi=w.useW6WApi;exports.CodeBlock=F.CodeBlock;exports.Copyable=F.Copyable;exports.Icon=F.Icon;exports.iconNames=F.iconNames;exports.ATTENTION_DISPLAY_CAP=Xe;exports.ActionTestForm=Ys;exports.ApiError=he;exports.BudgetMeter=Xn;exports.CELL_PROBLEM_COPY=rs;exports.CSV_MAX_BYTES=ls;exports.CSV_TOO_LARGE_COPY=ms;exports.CallableBindingSetup=Aa;exports.CallableList=qn;exports.ColumnsEditor=ba;exports.ConnectionHeader=zn;exports.ConnectionList=Hn;exports.CopyableText=Wt;exports.CsvPanel=Na;exports.DATA_STORE_ERROR_FALLBACK=oe;exports.DATA_STORE_KINDS=Zn;exports.DATA_STORE_KIND_LABEL=as;exports.DATA_STORE_NETWORK_ERROR=os;exports.DOC_VALUE_COPY=Qe;exports.DataEntryEditor=Ca;exports.DataEntryList=ka;exports.DataStoreList=ja;exports.DataTableGrid=Sa;exports.EditButton=tt;exports.EditConnectionModal=Yn;exports.ExecutionDetail=Bn;exports.ExecutionFilters=Pn;exports.ExecutionList=yn;exports.ExecutionLogPanel=Ht;exports.ExecutionStats=Ln;exports.HealthStatusPill=Ae;exports.HistoryTimeline=mn;exports.InfoTip=hn;exports.ListItem=Te;exports.NEW_ROW_ID=at;exports.RECENT_DISPLAY_CAP=Zt;exports.ReliabilityChart=es;exports.ReliabilityList=Kn;exports.RepoSyncIndicator=pn;exports.RunCallableButton=$a;exports.RunCallableModal=dt;exports.RunCallables=Ra;exports.SCALAR_TYPES=st;exports.ServerResourcesBadge=an;exports.ServerResourcesCard=tn;exports.ServerResourcesCardSmall=sn;exports.ServerResourcesRail=nn;exports.StepStatusPill=Oe;exports.UptimeStrip=Jt;exports.VERSION_CONFLICT_COPY=lt;exports.YamlEditor=zs;exports.buildRowValue=wa;exports.cellErrorsOf=pa;exports.createW6WApi=Vs;exports.cropText=Ut;exports.csvFilenameOf=ta;exports.csvImportMessage=ga;exports.csvLineOf=Ze;exports.dirtyColumns=ua;exports.displayBoard=Qt;exports.draftFromEntry=ca;exports.errorPlacement=ws;exports.formatDurationMs=_e;exports.formatExecutionTime=pe;exports.isCellValue=ia;exports.isVersionConflict=xa;exports.kvValueOf=fa;exports.kvValueTypeOf=Qn;exports.locateDataStoreError=oa;exports.locateRawResponseError=us;exports.needsAttention=Wn;exports.newRowDraft=da;exports.parseCell=Ie;exports.parseDocText=ps;exports.partitionBoard=Gt;exports.performancePoints=zt;exports.remainingTtlSeconds=ma;exports.rowValueOf=hs;exports.rowWriteOf=ha;exports.serializeCell=Pe;exports.tableSchemaOf=ea;exports.uptimeDays=Xt;
3
3
  //# sourceMappingURL=index.cjs.map