@powerhousedao/connect 5.0.0-staging.25 → 5.0.0-staging.26

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 (35) hide show
  1. package/dist/assets/{atlas-import.ChPe8NNj.js → atlas-import.CzW8-AP5.js} +2 -2
  2. package/dist/assets/{atlas-import.ChPe8NNj.js.map → atlas-import.CzW8-AP5.js.map} +1 -1
  3. package/dist/assets/{ccip.GTQhKzgV.js → ccip.DqmhJKD0.js} +2 -2
  4. package/dist/assets/{ccip.GTQhKzgV.js.map → ccip.DqmhJKD0.js.map} +1 -1
  5. package/dist/assets/{content.rT3-eEku.js → content.CxDClVTv.js} +2 -2
  6. package/dist/assets/{content.rT3-eEku.js.map → content.CxDClVTv.js.map} +1 -1
  7. package/dist/assets/{creators.C9agoPvT.js → creators.BVnKHfhT.js} +2 -2
  8. package/dist/assets/{creators.C9agoPvT.js.map → creators.BVnKHfhT.js.map} +1 -1
  9. package/dist/assets/{drive-icon.hoSYWHlo.js → drive-icon.BUXuX5Ex.js} +2 -2
  10. package/dist/assets/{drive-icon.hoSYWHlo.js.map → drive-icon.BUXuX5Ex.js.map} +1 -1
  11. package/dist/assets/{index.C6IW2BWM.js → index.B-dgtyfz.js} +2 -2
  12. package/dist/assets/{index.C6IW2BWM.js.map → index.B-dgtyfz.js.map} +1 -1
  13. package/dist/assets/{index.CG4NNeZN.js → index.BKnM0GnX.js} +2 -2
  14. package/dist/assets/{index.CG4NNeZN.js.map → index.BKnM0GnX.js.map} +1 -1
  15. package/dist/assets/{index.CAOhzGY5.js → index.BS7j0VZJ.js} +2 -2
  16. package/dist/assets/{index.CAOhzGY5.js.map → index.BS7j0VZJ.js.map} +1 -1
  17. package/dist/assets/{index.BxcdOLkR.js → index.Bli07gDj.js} +2 -2
  18. package/dist/assets/{index.BxcdOLkR.js.map → index.Bli07gDj.js.map} +1 -1
  19. package/dist/assets/{index.BRe5BZpi.js → index.CZ3emu5D.js} +2 -2
  20. package/dist/assets/{index.BRe5BZpi.js.map → index.CZ3emu5D.js.map} +1 -1
  21. package/dist/assets/{index.DSOzibyt.js → index.C_h1SBrG.js} +2 -2
  22. package/dist/assets/{index.DSOzibyt.js.map → index.C_h1SBrG.js.map} +1 -1
  23. package/dist/assets/{index.Lweni6H3.js → index.Vc7_nzpo.js} +2 -2
  24. package/dist/assets/{index.Lweni6H3.js.map → index.Vc7_nzpo.js.map} +1 -1
  25. package/dist/assets/{main.Dt_K5cUp.js → main.s5_GNYWM.js} +8 -8
  26. package/dist/assets/{main.Dt_K5cUp.js.map → main.s5_GNYWM.js.map} +1 -1
  27. package/dist/assets/{nodefs.Cs1YzYn0.js → nodefs.BiUz1Kbc.js} +2 -2
  28. package/dist/assets/{nodefs.Cs1YzYn0.js.map → nodefs.BiUz1Kbc.js.map} +1 -1
  29. package/dist/assets/{opfs-ahp.D1-ssDuc.js → opfs-ahp.B2bR4XKE.js} +2 -2
  30. package/dist/assets/{opfs-ahp.D1-ssDuc.js.map → opfs-ahp.B2bR4XKE.js.map} +1 -1
  31. package/dist/assets/{root.DesgsmkU.js → root.4AaIaYqm.js} +2 -2
  32. package/dist/assets/{root.DesgsmkU.js.map → root.4AaIaYqm.js.map} +1 -1
  33. package/dist/index.html +1 -1
  34. package/dist/vite-envs.sh +1 -1
  35. package/package.json +9 -9
@@ -1,4 +1,4 @@
1
- import{jsx as B,jsxs as Me}from"react/jsx-runtime";import{dw as Qb,dx as ie,dy as Sn,dz as Nu,dA as Nn,dB as Ec,dC as Ht,dD as tn,dE as Ac,dF as Qi,dG as Fs,dH as ww,dI as _w,dJ as Iw,dK as Vb,dL as Bb,dM as xw,dN as z,F as kw,dO as Rw,dP as Ub,dQ as Cp,dR as Tr,dS as Pp,dT as Mp,dU as Lp,dV as Dw,dW as fr,dX as Mn,dY as Cw,dZ as Vi,d_ as Qs,d$ as ot,e0 as Vs,e1 as bh,e2 as qb,e3 as jb,e4 as Gb,e5 as Hb,e6 as Hf,e7 as Pw,a6 as Mr,e8 as sr,a7 as ke,e9 as Mw,ea as Wb,eb as Zb,ec as Lw,a9 as $w,ed as Fw,ee as Fu,ef as Qw,eg as Oh,eh as Sh,ei as En,ej as Yb,ek as Wf,el as Yc,em as zb,bP as Vw,en as Bw,eo as Uw,a8 as qw,ep as jw,eq as Zf,er as Gw,es as Hw,et as Ww,eu as Zw,ev as Yw,ew as zw,ex as Kb,ey as Kw,ez as Yf,eA as zf,eB as Kf,eC as bs,eD as Xw,eE as Xb,eF as Jw,eG as e_,eH as rt,eI as t_,eJ as n_,c2 as r_,eK as i_,eL as Th,eM as Qu,eN as Jb,eO as Ln,eP as eO,eQ as tO,eR as s_,eS as $p,eT as o_,eU as a_,ar as zc}from"./main.Dt_K5cUp.js";import*as ye from"react";import Xt,{useState as Bs,useEffect as nn,createContext as l_,useContext as u_,forwardRef as Eh,useRef as _t,useCallback as Be,useImperativeHandle as nO,useId as Ah,memo as rO}from"react";import{x as Fp,M as Qp,q as c_,s as f_,v as d_,u as h_,w as p_,t as m_,F as g_,k as v_,g as y_,j as b_,B as O_,J as S_,H as T_,i as E_,z as A_,e as N_,f as w_}from"./creators.C9agoPvT.js";import"react-dom/client";import"react-dom";const __=Object.freeze({major:16,minor:11,patch:0,preReleaseTag:null});function I_(n){return n instanceof Error?n:new x_(n)}class x_ extends Error{constructor(e){super("Unexpected error value: "+Qb(e)),this.name="NonErrorThrown",this.thrownValue=e}}function k_(n,e,t){var r;const i=I_(n);return R_(i)?i:new ie(i.message,{nodes:(r=i.nodes)!==null&&r!==void 0?r:e,source:i.source,positions:i.positions,path:t,originalError:i})}function R_(n){return Array.isArray(n.path)}function D_(n){return{Field(e){const t=n.getFieldDef(),r=t==null?void 0:t.deprecationReason;if(t&&r!=null){const i=n.getParentType();i!=null||Nu(!1),n.reportError(new ie(`The field ${i.name}.${t.name} is deprecated. ${r}`,{nodes:e}))}},Argument(e){const t=n.getArgument(),r=t==null?void 0:t.deprecationReason;if(t&&r!=null){const i=n.getDirective();if(i!=null)n.reportError(new ie(`Directive "@${i.name}" argument "${t.name}" is deprecated. ${r}`,{nodes:e}));else{const s=n.getParentType(),o=n.getFieldDef();s!=null&&o!=null||Nu(!1),n.reportError(new ie(`Field "${s.name}.${o.name}" argument "${t.name}" is deprecated. ${r}`,{nodes:e}))}}},ObjectField(e){const t=Sn(n.getParentInputType());if(Nn(t)){const r=t.getFields()[e.name.value],i=r==null?void 0:r.deprecationReason;i!=null&&n.reportError(new ie(`The input field ${t.name}.${r.name} is deprecated. ${i}`,{nodes:e}))}},EnumValue(e){const t=n.getEnumValue(),r=t==null?void 0:t.deprecationReason;if(t&&r!=null){const i=Sn(n.getInputType());i!=null||Nu(!1),n.reportError(new ie(`The enum value "${i.name}.${t.name}" is deprecated. ${r}`,{nodes:e}))}}}}function Nh(n){return P_(n,e=>!Vb(e),C_)}function C_(n){return!Bb(n)&&!xw(n)}function P_(n,e,t){const r=n.getDirectives().filter(e),i=Object.values(n.getTypeMap()).filter(t);return[M_(n),...r.map(s=>j_(s)),...i.map(s=>$_(s))].filter(Boolean).join(`
1
+ import{jsx as B,jsxs as Me}from"react/jsx-runtime";import{dw as Qb,dx as ie,dy as Sn,dz as Nu,dA as Nn,dB as Ec,dC as Ht,dD as tn,dE as Ac,dF as Qi,dG as Fs,dH as ww,dI as _w,dJ as Iw,dK as Vb,dL as Bb,dM as xw,dN as z,F as kw,dO as Rw,dP as Ub,dQ as Cp,dR as Tr,dS as Pp,dT as Mp,dU as Lp,dV as Dw,dW as fr,dX as Mn,dY as Cw,dZ as Vi,d_ as Qs,d$ as ot,e0 as Vs,e1 as bh,e2 as qb,e3 as jb,e4 as Gb,e5 as Hb,e6 as Hf,e7 as Pw,a6 as Mr,e8 as sr,a7 as ke,e9 as Mw,ea as Wb,eb as Zb,ec as Lw,a9 as $w,ed as Fw,ee as Fu,ef as Qw,eg as Oh,eh as Sh,ei as En,ej as Yb,ek as Wf,el as Yc,em as zb,bP as Vw,en as Bw,eo as Uw,a8 as qw,ep as jw,eq as Zf,er as Gw,es as Hw,et as Ww,eu as Zw,ev as Yw,ew as zw,ex as Kb,ey as Kw,ez as Yf,eA as zf,eB as Kf,eC as bs,eD as Xw,eE as Xb,eF as Jw,eG as e_,eH as rt,eI as t_,eJ as n_,c2 as r_,eK as i_,eL as Th,eM as Qu,eN as Jb,eO as Ln,eP as eO,eQ as tO,eR as s_,eS as $p,eT as o_,eU as a_,ar as zc}from"./main.s5_GNYWM.js";import*as ye from"react";import Xt,{useState as Bs,useEffect as nn,createContext as l_,useContext as u_,forwardRef as Eh,useRef as _t,useCallback as Be,useImperativeHandle as nO,useId as Ah,memo as rO}from"react";import{x as Fp,M as Qp,q as c_,s as f_,v as d_,u as h_,w as p_,t as m_,F as g_,k as v_,g as y_,j as b_,B as O_,J as S_,H as T_,i as E_,z as A_,e as N_,f as w_}from"./creators.BVnKHfhT.js";import"react-dom/client";import"react-dom";const __=Object.freeze({major:16,minor:11,patch:0,preReleaseTag:null});function I_(n){return n instanceof Error?n:new x_(n)}class x_ extends Error{constructor(e){super("Unexpected error value: "+Qb(e)),this.name="NonErrorThrown",this.thrownValue=e}}function k_(n,e,t){var r;const i=I_(n);return R_(i)?i:new ie(i.message,{nodes:(r=i.nodes)!==null&&r!==void 0?r:e,source:i.source,positions:i.positions,path:t,originalError:i})}function R_(n){return Array.isArray(n.path)}function D_(n){return{Field(e){const t=n.getFieldDef(),r=t==null?void 0:t.deprecationReason;if(t&&r!=null){const i=n.getParentType();i!=null||Nu(!1),n.reportError(new ie(`The field ${i.name}.${t.name} is deprecated. ${r}`,{nodes:e}))}},Argument(e){const t=n.getArgument(),r=t==null?void 0:t.deprecationReason;if(t&&r!=null){const i=n.getDirective();if(i!=null)n.reportError(new ie(`Directive "@${i.name}" argument "${t.name}" is deprecated. ${r}`,{nodes:e}));else{const s=n.getParentType(),o=n.getFieldDef();s!=null&&o!=null||Nu(!1),n.reportError(new ie(`Field "${s.name}.${o.name}" argument "${t.name}" is deprecated. ${r}`,{nodes:e}))}}},ObjectField(e){const t=Sn(n.getParentInputType());if(Nn(t)){const r=t.getFields()[e.name.value],i=r==null?void 0:r.deprecationReason;i!=null&&n.reportError(new ie(`The input field ${t.name}.${r.name} is deprecated. ${i}`,{nodes:e}))}},EnumValue(e){const t=n.getEnumValue(),r=t==null?void 0:t.deprecationReason;if(t&&r!=null){const i=Sn(n.getInputType());i!=null||Nu(!1),n.reportError(new ie(`The enum value "${i.name}.${t.name}" is deprecated. ${r}`,{nodes:e}))}}}}function Nh(n){return P_(n,e=>!Vb(e),C_)}function C_(n){return!Bb(n)&&!xw(n)}function P_(n,e,t){const r=n.getDirectives().filter(e),i=Object.values(n.getTypeMap()).filter(t);return[M_(n),...r.map(s=>j_(s)),...i.map(s=>$_(s))].filter(Boolean).join(`
2
2
 
3
3
  `)}function M_(n){if(n.description==null&&L_(n))return;const e=[],t=n.getQueryType();t&&e.push(` query: ${t.name}`);const r=n.getMutationType();r&&e.push(` mutation: ${r.name}`);const i=n.getSubscriptionType();return i&&e.push(` subscription: ${i.name}`),Wt(n)+`schema {
4
4
  ${e.join(`
@@ -111,4 +111,4 @@ In some cases, you need to provide options to alter GraphQL's execution behavior
111
111
  "errors editor"
112
112
  `,gridTemplateRows:"auto 1fr"},children:[Me("div",{className:"flex flex-col gap-2",style:{gridArea:"left"},children:[B(iT,{operation:e,onAddOperationAndInitialSchema:s,updateOperationName:o,deleteOperation:a,module:t,allOperationNames:r}),B(vQ,{operation:e,focusOnMount:e.id===i,setOperationDescription:u})]}),B("div",{className:"relative top-8",style:{gridArea:"editor"},children:B(ph,{doc:e.schema??"",updateDocumentInModel:h,customLinter:p})}),Me("div",{style:{gridArea:"errors"},children:[B("h3",{className:"my-2 text-sm font-medium text-gray-700",children:"Reducer Exceptions"}),B(yQ,{operation:e,addOperationError:f,deleteOperationError:c,setOperationErrorName:d})]})]})}function OQ({module:n,allOperations:e,shouldFocusNewOperation:t,updateOperationName:r,deleteOperation:i,addOperationAndInitialSchema:s,addOperationError:o,deleteOperationError:a,setOperationErrorName:l,updateOperationSchema:u,setOperationDescription:f}){const[c,d]=Bs(null),h=Ah(),p=e.map(g=>g.name).filter(g=>g!==null),m=Be(async(g,v)=>{const y=await s(g,v);return y&&d(y),y},[s,d]);return Me("div",{children:[n.operations.map(g=>B("div",{children:B(bQ,{operation:g,module:n,lastCreatedOperationId:c,allOperationNames:p,addOperationError:o,deleteOperationError:a,setOperationErrorName:l,onAddOperationAndInitialSchema:m,updateOperationName:r,deleteOperation:i,updateOperationSchema:u,setOperationDescription:f})},g.id)),B("div",{className:"mt-6 w-1/2 pr-6",children:B(iT,{onAddOperationAndInitialSchema:m,updateOperationName:r,deleteOperation:i,module:n,allOperationNames:p,focusOnMount:t},h)})]})}function Mb(n){const{module:e,modules:t,allOperations:r,lastCreatedModuleId:i,onAddModule:s,updateModuleName:o,deleteModule:a,updateOperationName:l,deleteOperation:u,addOperationAndInitialSchema:f,updateOperationSchema:c,setOperationDescription:d,addOperationError:h,deleteOperationError:p,setOperationErrorName:m}=n;return Me("div",{className:"relative rounded-3xl bg-gray-100 p-6",children:[Me("div",{className:"mb-2 w-1/2 pr-6",children:[B(cD,{modules:t,module:e,onAddModule:s,updateModuleName:o}),!!e&&B("button",{"aria-label":"Delete module",tabIndex:-1,className:"absolute right-1 top-1 p-2 text-gray-800 transition-colors hover:text-gray-500",onClick:()=>{a(e.id)},children:B("svg",{className:"size-6",viewBox:"0 0 24 24",fill:"currentcolor",children:B("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.9993 8.51506L15.4844 7L11.9994 10.4852L8.51497 7.00057L7 8.51562L10.4844 12.0003L7.00056 15.4843L8.51552 16.9994L11.9994 13.5153L15.4838 17L16.9988 15.4849L13.5144 12.0003L16.9993 8.51506Z"})})})]}),!!e&&B(OQ,{module:e,allOperations:r,shouldFocusNewOperation:e.id===i,updateOperationName:l,deleteOperation:u,addOperationAndInitialSchema:f,updateOperationSchema:c,setOperationDescription:d,addOperationError:h,deleteOperationError:p,setOperationErrorName:m})]})}function SQ({modules:n,allOperations:e,addModule:t,updateModuleName:r,deleteModule:i,updateOperationName:s,deleteOperation:o,addOperationAndInitialSchema:a,updateOperationSchema:l,setOperationDescription:u,addOperationError:f,deleteOperationError:c,setOperationErrorName:d}){const[h,p]=Bs(null),m=_t(null),g=Be(async v=>{var O;const y=await t(v);return y&&(p(y),(O=m.current)==null||O.focus()),y},[t,p]);return Me("div",{className:"flex flex-col gap-2",children:[n.map(v=>B(Mb,{module:v,modules:n,allOperations:e,lastCreatedModuleId:h,onAddModule:g,updateModuleName:r,deleteModule:i,updateOperationName:s,deleteOperation:o,addOperationAndInitialSchema:a,updateOperationSchema:l,setOperationDescription:u,addOperationError:f,deleteOperationError:c,setOperationErrorName:d},v.id)),B(Mb,{modules:n,allOperations:e,lastCreatedModuleId:h,onAddModule:g,updateModuleName:r,deleteModule:i,updateOperationName:s,deleteOperation:o,addOperationAndInitialSchema:a,updateOperationSchema:l,setOperationDescription:u,addOperationError:f,deleteOperationError:c,setOperationErrorName:d},"add-module"),B("div",{ref:m,tabIndex:0,className:"size-0 overflow-hidden","aria-hidden":"true"})]})}const mh=Eh((n,e)=>{const{className:t,...r}=n;return B("button",{ref:e,...r,className:Yt("h-10 whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",t)})}),TQ=ip({String:F.string,Number:F.number,"True False":F.bool,PropertyName:F.propertyName,Null:F.null,", :":F.separator,"[ ]":F.squareBracket,"{ }":F.brace}),EQ=Ds.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[TQ],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),AQ=()=>n=>{try{JSON.parse(n.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=NQ(e,n.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function NQ(n,e){let t;return(t=n.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=n.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const CN=Cs.define({name:"json",parser:EQ.configure({props:[ap.add({Object:wy({except:/^\s*\}/}),Array:wy({except:/^\s*\]/})}),up.add({"Object Array":sA})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function wQ(){return new nA(CN)}const _Q=rO(function(e){const{doc:t,readonly:r=!1,updateDocumentInModel:i}=e,{editorRef:s,viewRef:o,updateListenerCompartment:a,focusHandlerCompartment:l,pasteHandlerCompartment:u,timeoutRef:f}=_N();return nn(()=>{o.current||(o.current=new re({state:Ee.create({doc:t,extensions:[...RN,Rc.of(DN),OA,CN,wQ(),Kh(AQ()),a.current.of(_p(r,f,i)),l.current.of(Ip(r,f,i)),u.current.of(xp(r,f,i)),Ee.readOnly.of(r)]}),parent:s.current}),Di(o.current))},[]),IN(o),xN(o.current,r,f,i,{updateListener:a.current,focusHandler:l.current,pasteHandler:u.current}),kN(o.current,t),B("div",{ref:s})});function IQ(n){const e=n+"CollectionProvider",[t,r]=Th(e),[i,s]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=m=>{const{scope:g,children:v}=m,y=Xt.useRef(null),O=Xt.useRef(new Map).current;return B(i,{scope:g,itemMap:O,collectionRef:y,children:v})};o.displayName=e;const a=n+"CollectionSlot",l=Zf(a),u=Xt.forwardRef((m,g)=>{const{scope:v,children:y}=m,O=s(a,v),S=Qu(g,O.collectionRef);return B(l,{ref:S,children:y})});u.displayName=a;const f=n+"CollectionItemSlot",c="data-radix-collection-item",d=Zf(f),h=Xt.forwardRef((m,g)=>{const{scope:v,children:y,...O}=m,S=Xt.useRef(null),b=Qu(g,S),T=s(f,v);return Xt.useEffect(()=>(T.itemMap.set(S,{ref:S,...O}),()=>void T.itemMap.delete(S))),B(d,{[c]:"",ref:b,children:y})});h.displayName=f;function p(m){const g=s(n+"CollectionConsumer",m);return Xt.useCallback(()=>{const y=g.collectionRef.current;if(!y)return[];const O=Array.from(y.querySelectorAll(`[${c}]`));return Array.from(g.itemMap.values()).sort((T,N)=>O.indexOf(T.ref.current)-O.indexOf(N.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:u,ItemSlot:h},p,r]}var Gf="rovingFocusGroup.onEntryFocus",xQ={bubbles:!1,cancelable:!0},eo="RovingFocusGroup",[gh,PN,kQ]=IQ(eo),[RQ,MN]=Th(eo,[kQ]),[DQ,CQ]=RQ(eo),LN=ye.forwardRef((n,e)=>B(gh.Provider,{scope:n.__scopeRovingFocusGroup,children:B(gh.Slot,{scope:n.__scopeRovingFocusGroup,children:B(PQ,{...n,ref:e})})}));LN.displayName=eo;var PQ=ye.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...c}=n,d=ye.useRef(null),h=Qu(e,d),p=eO(s),[m,g]=tO({prop:o,defaultProp:a??null,onChange:l,caller:eo}),[v,y]=ye.useState(!1),O=s_(u),S=PN(t),b=ye.useRef(!1),[T,N]=ye.useState(0);return ye.useEffect(()=>{const R=d.current;if(R)return R.addEventListener(Gf,O),()=>R.removeEventListener(Gf,O)},[O]),B(DQ,{scope:t,orientation:r,dir:p,loop:i,currentTabStopId:m,onItemFocus:ye.useCallback(R=>g(R),[g]),onItemShiftTab:ye.useCallback(()=>y(!0),[]),onFocusableItemAdd:ye.useCallback(()=>N(R=>R+1),[]),onFocusableItemRemove:ye.useCallback(()=>N(R=>R-1),[]),children:B(Lr.div,{tabIndex:v||T===0?-1:0,"data-orientation":r,...c,ref:h,style:{outline:"none",...n.style},onMouseDown:Ln(n.onMouseDown,()=>{b.current=!0}),onFocus:Ln(n.onFocus,R=>{const C=!b.current;if(R.target===R.currentTarget&&C&&!v){const x=new CustomEvent(Gf,xQ);if(R.currentTarget.dispatchEvent(x),!x.defaultPrevented){const $=S().filter(Q=>Q.focusable),E=$.find(Q=>Q.active),w=$.find(Q=>Q.id===m),D=[E,w,...$].filter(Boolean).map(Q=>Q.ref.current);QN(D,f)}}b.current=!1}),onBlur:Ln(n.onBlur,()=>y(!1))})})}),$N="RovingFocusGroupItem",FN=ye.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=n,l=Jb(),u=s||l,f=CQ($N,t),c=f.currentTabStopId===u,d=PN(t),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:m}=f;return ye.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),B(gh.ItemSlot,{scope:t,id:u,focusable:r,active:i,children:B(Lr.span,{tabIndex:c?0:-1,"data-orientation":f.orientation,...a,ref:e,onMouseDown:Ln(n.onMouseDown,g=>{r?f.onItemFocus(u):g.preventDefault()}),onFocus:Ln(n.onFocus,()=>f.onItemFocus(u)),onKeyDown:Ln(n.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){f.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const v=$Q(g,f.orientation,f.dir);if(v!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let O=d().filter(S=>S.focusable).map(S=>S.ref.current);if(v==="last")O.reverse();else if(v==="prev"||v==="next"){v==="prev"&&O.reverse();const S=O.indexOf(g.currentTarget);O=f.loop?FQ(O,S+1):O.slice(S+1)}setTimeout(()=>QN(O))}}),children:typeof o=="function"?o({isCurrentTabStop:c,hasTabStop:m!=null}):o})})});FN.displayName=$N;var MQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function LQ(n,e){return e!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function $Q(n,e,t){const r=LQ(n.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return MQ[r]}function QN(n,e=!1){const t=document.activeElement;for(const r of n)if(r===t||(r.focus({preventScroll:e}),document.activeElement!==t))return}function FQ(n,e){return n.map((t,r)=>n[(e+r)%n.length])}var QQ=LN,VQ=FN;function BQ(n,e){return ye.useReducer((t,r)=>e[t][r]??t,n)}var VN=n=>{const{present:e,children:t}=n,r=UQ(e),i=typeof t=="function"?t({present:r.isPresent}):ye.Children.only(t),s=Qu(r.ref,qQ(i));return typeof t=="function"||r.isPresent?ye.cloneElement(i,{ref:s}):null};VN.displayName="Presence";function UQ(n){const[e,t]=ye.useState(),r=ye.useRef(null),i=ye.useRef(n),s=ye.useRef("none"),o=n?"mounted":"unmounted",[a,l]=BQ(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ye.useEffect(()=>{const u=Au(r.current);s.current=a==="mounted"?u:"none"},[a]),$p(()=>{const u=r.current,f=i.current;if(f!==n){const d=s.current,h=Au(u);n?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(f&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=n}},[n,l]),$p(()=>{if(e){let u;const f=e.ownerDocument.defaultView??window,c=h=>{const m=Au(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(l("ANIMATION_END"),!i.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",u=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},d=h=>{h.target===e&&(s.current=Au(r.current))};return e.addEventListener("animationstart",d),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{f.clearTimeout(u),e.removeEventListener("animationstart",d),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:ye.useCallback(u=>{r.current=u?getComputedStyle(u):null,t(u)},[])}}function Au(n){return(n==null?void 0:n.animationName)||"none"}function qQ(n){var r,i;let e=(r=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=(i=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Gc="Tabs",[jQ,cV]=Th(Gc,[MN]),BN=MN(),[GQ,kp]=jQ(Gc),UN=ye.forwardRef((n,e)=>{const{__scopeTabs:t,value:r,onValueChange:i,defaultValue:s,orientation:o="horizontal",dir:a,activationMode:l="automatic",...u}=n,f=eO(a),[c,d]=tO({prop:r,onChange:i,defaultProp:s??"",caller:Gc});return B(GQ,{scope:t,baseId:Jb(),value:c,onValueChange:d,orientation:o,dir:f,activationMode:l,children:B(Lr.div,{dir:f,"data-orientation":o,...u,ref:e})})});UN.displayName=Gc;var qN="TabsList",jN=ye.forwardRef((n,e)=>{const{__scopeTabs:t,loop:r=!0,...i}=n,s=kp(qN,t),o=BN(t);return B(QQ,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:r,children:B(Lr.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:e})})});jN.displayName=qN;var GN="TabsTrigger",HN=ye.forwardRef((n,e)=>{const{__scopeTabs:t,value:r,disabled:i=!1,...s}=n,o=kp(GN,t),a=BN(t),l=YN(o.baseId,r),u=zN(o.baseId,r),f=r===o.value;return B(VQ,{asChild:!0,...a,focusable:!i,active:f,children:B(Lr.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...s,ref:e,onMouseDown:Ln(n.onMouseDown,c=>{!i&&c.button===0&&c.ctrlKey===!1?o.onValueChange(r):c.preventDefault()}),onKeyDown:Ln(n.onKeyDown,c=>{[" ","Enter"].includes(c.key)&&o.onValueChange(r)}),onFocus:Ln(n.onFocus,()=>{const c=o.activationMode!=="manual";!f&&!i&&c&&o.onValueChange(r)})})})});HN.displayName=GN;var WN="TabsContent",ZN=ye.forwardRef((n,e)=>{const{__scopeTabs:t,value:r,forceMount:i,children:s,...o}=n,a=kp(WN,t),l=YN(a.baseId,r),u=zN(a.baseId,r),f=r===a.value,c=ye.useRef(f);return ye.useEffect(()=>{const d=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(d)},[]),B(VN,{present:i||f,children:({present:d})=>B(Lr.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!d,id:u,tabIndex:0,...o,ref:e,style:{...n.style,animationDuration:c.current?"0s":void 0},children:d&&s})})});ZN.displayName=WN;function YN(n,e){return`${n}-trigger-${e}`}function zN(n,e){return`${n}-content-${e}`}var HQ=UN,KN=jN,XN=HN,JN=ZN;const WQ=HQ,ew=ye.forwardRef(({className:n,...e},t)=>B(KN,{ref:t,className:Yt("flex items-center justify-center rounded-xl bg-slate-50 p-1 shadow-[inset_0px_0px_2px_rgba(255,255,255,0.50)]",n),...e}));ew.displayName=KN.displayName;const vh=ye.forwardRef(({className:n,...e},t)=>B(XN,{ref:t,className:Yt("flex w-full items-center justify-center whitespace-nowrap rounded-lg p-1 text-sm text-gray-500 transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-gray-50 data-[state=active]:text-gray-800 data-[state=active]:shadow-[0px_16px_16px_-4px_rgba(0,0,0,0.10)]",n),...e}));vh.displayName=XN.displayName;const yh=ye.forwardRef(({className:n,...e},t)=>B(JN,{ref:t,className:Yt("",n),...e}));yh.displayName=JN.displayName;function Lb({modelName:n,stateSchema:e,initialValue:t,setStateSchema:r,setInitialState:i,scope:s}){const o=pS(),[a,l]=Bs(!1),u=Be(p=>fD(p,n,s),[n,s]),f=Be(()=>{l(p=>!p)},[]),c=Be(p=>r(p,s),[r,s]),d=Be(p=>i(p,s),[i,s]),h=Be(()=>{const p=t||"{}",m=rn(o);if(!m)return;const g=rn(e);if(!g)return;const v=mS(n,s);if(!v)return;const y=g.definitions.find(S=>S.kind===z.OBJECT_TYPE_DEFINITION&&S.name.value===v);if(!y||y.kind!==z.OBJECT_TYPE_DEFINITION)return;const O=Bx({sharedSchemaDocumentNode:m,stateTypeDefinitionNode:y,existingValue:p});i(O,s)},[o,t,i,s]);return Me("div",{className:"grid grid-cols-2 gap-4",children:[Me("div",{children:[Me("h3",{className:"mb-2 text-lg capitalize",children:[s," state schema"]}),Me(mh,{onClick:f,className:"mb-2 flex w-fit items-center gap-2",children:[a?"Hide":"Show"," standard library",B("svg",{className:Yt("inline-block transition-transform",a?"rotate-180":"rotate-0"),xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:B("path",{d:"M11.9883 6.01172C11.4363 6.01172 10.9883 6.45972 10.9883 7.01172V13.0117H6.98828L11.9883 18.0117L16.9883 13.0117H12.9883V7.01172C12.9883 6.45972 12.5403 6.01172 11.9883 6.01172Z",fill:"black"})})]}),a&&B(ph,{doc:Ih,readonly:!0}),B(ph,{doc:e,updateDocumentInModel:c,customLinter:u})]}),Me("div",{children:[Me("div",{className:"flex flex-col items-end",children:[Me("h3",{className:"mb-2 text-right text-lg capitalize",children:[s," state initial value"]}),Me(mh,{onClick:h,className:"mb-2 flex w-fit items-center gap-2",children:["Sync with schema"," ",B("svg",{className:"inline-block",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:B("path",{d:"M8.00521 1.99219C6.63588 1.99219 5.32788 2.45152 4.27588 3.28419C3.98721 3.51219 3.94321 3.93285 4.17188 4.22151C4.40054 4.51018 4.82055 4.55418 5.10921 4.32552C5.92721 3.67819 6.93921 3.32552 8.00521 3.32552C10.5825 3.32552 12.6719 5.41485 12.6719 7.99218H11.3385L13.3385 10.6588L15.3385 7.99218H14.0052C14.0052 4.67818 11.3192 1.99219 8.00521 1.99219ZM2.67188 5.32552L0.671875 7.99218H2.00521C2.00521 11.3062 4.69121 13.9922 8.00521 13.9922C9.37521 13.9922 10.6825 13.5335 11.7345 12.7002C12.0232 12.4722 12.0672 12.0515 11.8385 11.7628C11.6099 11.4742 11.1899 11.4302 10.9012 11.6588C10.0825 12.3068 9.07188 12.6588 8.00521 12.6588C5.42788 12.6588 3.33854 10.5695 3.33854 7.99218H4.67188L2.67188 5.32552Z",fill:"#343839"})})]})]}),B(_Q,{doc:t,updateDocumentInModel:d})]})]})}function ZQ({modelName:n,globalStateSchema:e,localStateSchema:t,globalStateInitialValue:r,localStateInitialValue:i,setStateSchema:s,setInitialState:o}){const a=Be(()=>{const l=xh(n,"local");s(l,"local"),o("","local")},[n,s,o]);return Me(WQ,{className:"pb-8",activationMode:"manual",defaultValue:"global",children:[B("div",{className:"my-6",children:Me(ew,{className:"mx-auto flex max-w-sm",children:[B(vh,{value:"global",children:"Global"}),B(vh,{value:"local",children:"Local"})]})}),B(yh,{value:"global",tabIndex:-1,children:B(Lb,{modelName:n,stateSchema:e,initialValue:r,setStateSchema:s,setInitialState:o,scope:"global"})}),B(yh,{value:"local",tabIndex:-1,children:t?B(Lb,{modelName:n,stateSchema:t,initialValue:i,setStateSchema:s,setInitialState:o,scope:"local"}):Me("div",{className:"",children:[B("h3",{className:"mb-2 text-lg capitalize",children:"local state schema"}),B(mh,{onClick:a,children:"Add local state"})]})})]})}function YQ(){const n=o_();return a_(n,"powerhouse/document-model")}function zQ(){const[n,e]=YQ(),t=n.header.name,{name:r,id:i,extension:s,description:o,author:{name:a,website:l}}=n.state.global,{state:{global:{schema:u,initialValue:f},local:{schema:c,initialValue:d}},modules:h}=n.state.global.specifications[0],p=h.flatMap(U=>U.operations),m=_t(!r&&!!t&&p.length===0);nn(()=>{if(!m.current||!t)return;const U=OS(t),J=[Fp({name:t}),Qp({schema:U,scope:"global"})];e(J),m.current=!1},[t,e]);const g=p.flatMap(U=>U.schema??[]).join(`
113
113
  `),v=U=>{ft(U,i)||e([p_({id:U})])},y=U=>{ft(U,o)||e(h_({description:U}))},O=U=>{ft(U,s)||e(d_({extension:U}))},S=U=>{ft(U,r)||e(Fp({name:U}))},b=U=>{ft(U,a)||e(f_({authorName:U}))},T=U=>{ft(U,l??"")||e(c_({authorWebsite:U}))},N=(U,J)=>{ft(U,J==="global"?u:c)||e(Qp({schema:U,scope:J}))},R=(U,J)=>{ft(U,J==="global"?f:d)||e(m_({initialValue:U,scope:J}))},C=U=>new Promise(J=>{try{if(h.some(le=>ft(le.name,U))){J(void 0);return}const ee=zc();e(N_({id:ee,name:U})),J(ee)}catch(ee){console.error("Failed to add module:",ee),J(void 0)}}),x=(U,J)=>{h.some(ee=>ft(ee.name,J))||e(A_({id:U,name:J}))},$=U=>{e(E_({id:U}))},E=(U,J)=>new Promise(ee=>{var le;try{if((((le=h.find(et=>et.id===U))==null?void 0:le.operations.map(et=>et.name).filter(Boolean))??[]).some(et=>ft(et,J))){ee(void 0);return}const Ie=zc();e(w_({id:Ie,moduleId:U,name:J})),ee(Ie)}catch(Te){console.error("Failed to add operation:",Te),ee(void 0)}}),w=(U,J)=>{const ee=h.find(Te=>Te.operations.some(Ie=>Ie.id===U));((ee==null?void 0:ee.operations.map(Te=>Te.name).filter(Boolean))??[]).some(Te=>ft(Te,J))||e(T_({id:U,name:J}))},k=(U,J)=>{const ee=p.find(le=>le.id===U);ee!=null&&ee.schema&&ft(J,ee.schema)||e(S_({id:U,schema:J}))},D=(U,J)=>{var le;const ee=((le=p.find(Te=>Te.id===U))==null?void 0:le.description)??"";ft(ee,J)||e(O_({id:U,description:J}))},Q=U=>{e(b_({id:U}))},q=(U,J)=>new Promise(ee=>{try{const le=p.find(at=>at.id===U);if(((le==null?void 0:le.errors.map(at=>at.name).filter(Boolean))??[]).some(at=>ft(at,J))){ee(void 0);return}const Ie=zc(),et=En(J);e(y_({id:Ie,operationId:U,errorName:J,errorCode:et})),ee(Ie)}catch(le){console.error("Failed to add operation error:",le),ee(void 0)}}),X=U=>{e(v_({id:U}))},ne=(U,J,ee)=>{const le=p.find(Ie=>Ie.id===U);((le==null?void 0:le.errors.map(Ie=>Ie.name).filter(Boolean))??[]).some(Ie=>ft(Ie,ee))||e(g_({id:J,errorName:ee}))},ce=async(U,J)=>{try{const ee=await E(U,J);if(!ee)return;try{return k(ee,Qx(J)),ee}catch(le){console.error("Failed to update operation schema:",le);return}}catch(ee){console.error("Failed to add operation and schema:",ee);return}};return B("main",{className:"min-h-dvh bg-gray-50",children:B(Fx,{globalStateSchemaSdl:u,localStateSchemaSdl:c,operationSchemasSdl:g,children:Me("div",{className:"mx-auto max-w-6xl px-4 pt-8",children:[B(rD,{name:r,documentType:i,extension:s,description:o,authorName:a,authorWebsite:l??"",globalStateSchema:u,localStateSchema:c,setModelId:v,setModelDescription:y,setModelExtension:O,setModelName:S,setAuthorName:b,setAuthorWebsite:T,setStateSchema:N}),B(Vp,{}),Me("div",{children:[B(ZQ,{modelName:r,globalStateSchema:u,globalStateInitialValue:f,localStateSchema:c,localStateInitialValue:d,setStateSchema:N,setInitialState:R}),B(Vp,{}),B("h3",{className:"mb-6 text-lg",children:"Global Operations"}),B(SQ,{modules:h,allOperations:p,addModule:C,updateModuleName:x,deleteModule:$,updateOperationName:w,updateOperationSchema:k,setOperationDescription:D,deleteOperation:Q,addOperationError:q,deleteOperationError:X,setOperationErrorName:ne,addOperationAndInitialSchema:ce})]})]})})})}const fV={Component:zQ,documentTypes:["powerhouse/document-model"],config:{id:"document-model-editor-v2",disableExternalControls:!0,documentToolbarEnabled:!0,timelineEnabled:!0}};export{zQ as DocumentModelEditor,fV as documentModelEditorModule,YQ as useSelectedDocumentModelDocument};
114
- //# sourceMappingURL=index.CAOhzGY5.js.map
114
+ //# sourceMappingURL=index.BS7j0VZJ.js.map