import{G as e,J as t,K as n,Q as r,U as i,W as a,X as o,bt as s,it as c,mt as l,pt as u,q as d,tt as f,vt as p,wt as m,xt as h}from"./lz-string-CMojKG3P.js";import{t as g}from"./chunk-pbuEa-1d-DjY3kn7w.js";var _={id:`powerhouse/subgraph`,name:`Subgraph Module`,extension:`.phdm`,description:``,author:{name:`Powerhouse`,website:`https://powerhouse.inc`},specifications:[{version:1,changeLog:[],state:{global:{schema:`type SubgraphModuleState {
  name: String!
  status: StatusType!
}

enum StatusType {
  DRAFT
  CONFIRMED
}`,initialValue:`{
  "name": "",
  "status": "DRAFT"
}`,examples:[]},local:{schema:``,initialValue:``,examples:[]}},modules:[{id:`8af5bda9-6fc7-4427-bfed-1d32d76a552f`,name:`base_operations`,description:``,operations:[{id:`d7cd6b6b-01ea-42c8-97e2-288e04b50b42`,name:`SET_SUBGRAPH_NAME`,description:``,schema:`input SetSubgraphNameInput {
  name: String!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`},{id:`5a20e641-dc36-428e-8924-ecb07f3f1b94`,name:`SET_SUBGRAPH_STATUS`,description:``,schema:`input SetSubgraphStatusInput {
  status: StatusType!
}`,template:``,reducer:``,errors:[],examples:[],scope:`global`}]}]}]},v=e=>e!=null;l().refine(e=>v(e));var y=u([`CONFIRMED`,`DRAFT`]);function b(){return s({name:h()})}function x(){return s({status:y})}function S(){return s({__typename:p(`SubgraphModuleState`).optional(),name:h(),status:y})}var C=g({setSubgraphName:()=>w,setSubgraphStatus:()=>T}),w=e=>o(`SET_SUBGRAPH_NAME`,{...e},void 0,b,`global`),T=e=>o(`SET_SUBGRAPH_STATUS`,{...e},void 0,x,`global`),E=`powerhouse/subgraph`,D=i.extend({documentType:p(E)}),O=a.extend({global:S()}),k=s({header:D,state:O,initialState:O});function A(e){return O.safeParse(e).success}function j(e){O.parse(e)}function M(e){return k.safeParse(e).success}function N(e){k.parse(e)}var P={setSubgraphNameOperation(e,t,n){let r=t.input.name.trim();if(r===``)throw Error(`Subgraph name cannot be empty`);e.name=r},setSubgraphStatusOperation(e,t,n){e.status=t.input.status}},F=r((e,t,n)=>{if(c(t))return e;switch(t.type){case`SET_SUBGRAPH_NAME`:b().parse(t.input),P.setSubgraphNameOperation(e[t.scope],t,n);break;case`SET_SUBGRAPH_STATUS`:x().parse(t.input),P.setSubgraphStatusOperation(e[t.scope],t,n);break;default:return e}}),I={name:``,status:`DRAFT`},L={},R={fileExtension:`.phdm`,createState(e){return{...f(),global:{...I,...e?.global},local:{...L,...e?.local}}},createDocument(e){let t=n(R.createState,e);return t.header.documentType=E,t.header.id=m(),t},saveToFileHandle(e,n){return t(e,n)},loadFromInput(e){return d(e,F)},isStateOfType(e){return A(e)},assertIsStateOfType(e){return j(e)},isDocumentOfType(e){return M(e)},assertIsDocumentOfType(e){return N(e)}},z=g({}),B={...e,...C},V={...R,...z};export{T as a,w as i,_ as n,V as o,F as r,B as t};
//# sourceMappingURL=subgraph-module-CU_-umq2-DldquqO4.js.map