import{S as e}from"./dist-rbQIUfXp.js";import{a as t,i as n}from"./subgraph-module-CU_-umq2-DldquqO4.js";import{n as r}from"./hooks-Vx4YtE1e-CANWwp8q.js";import{t as i}from"./components-tpme59UM.js";import{r as a}from"./connect-BSkeWkEI-BgLja9Zm.js";import{r as o}from"./useVetraDocument-DF0teXXM-DUMZ68tU.js";import{useCallback as s,useEffect as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=({subgraphName:e=``,status:t=`DRAFT`,onNameChange:n,onConfirm:a})=>{let[o,s]=l(e),[f,p]=l(!1);r(o,n,300),c(()=>{s(e)},[e]),c(()=>{t===`DRAFT`&&p(!1)},[t]);let m=f||t===`CONFIRMED`;return d(`div`,{className:`space-y-6 p-6`,children:[d(`div`,{className:`flex items-center justify-between`,children:[u(`h2`,{className:`text-lg font-medium text-gray-900`,children:`Subgraph Configuration`}),u(i,{status:t===`CONFIRMED`?`confirmed`:`draft`,label:t===`CONFIRMED`?`Confirmed`:`Draft`})]}),d(`div`,{children:[u(`label`,{htmlFor:`subgraph-name`,className:`mb-2 block text-sm font-medium text-gray-700`,children:`Subgraph Name`}),u(`input`,{id:`subgraph-name`,type:`text`,value:o,onChange:e=>s(e.target.value),disabled:m,className:`w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${m?`cursor-not-allowed bg-gray-100`:``}`,placeholder:`Enter subgraph name`})]}),!m&&u(`div`,{children:u(`button`,{onClick:()=>{o.trim()&&(p(!0),a?.())},disabled:!o.trim(),className:`rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300`,children:`Confirm`})})]})},p={isExternalControlsEnabled:!1};function m(){e(p);let[r,i]=o(),c=s(e=>{e!==r.state.global.name&&i(n({name:e}))},[r.state.global.name,i]),l=s(()=>{i(t({status:`CONFIRMED`}))},[i]);return d(`div`,{className:`bg-gray-50 p-6`,children:[u(a,{}),u(f,{subgraphName:r.state.global.name??``,status:r.state.global.status,onNameChange:c,onConfirm:l})]})}export{m as default};
//# sourceMappingURL=editor-Bm0GwtcN-BjT2IhE7.js.map