@powerhousedao/workflow 6.2.3-dev.96 → 6.2.3-dev.97

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/piece-ai",
3
- "version": "6.2.3-dev.96",
3
+ "version": "6.2.3-dev.97",
4
4
  "description": "Call AI models from OpenAI, Anthropic, Google or TypeSafe, or any OpenAI-compatible server such as Ollama, vLLM or OpenRouter.",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/piece-reactor",
3
- "version": "6.2.3-dev.96",
3
+ "version": "6.2.3-dev.97",
4
4
  "displayName": "Powerhouse Reactor",
5
5
  "logoUrl": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMTQgMTE0IiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE2MTYxNiIgZD0iTTcxLjI5MTkgMEwyNC4zNDE1IDM4Ljg3NzJDMTcuNDU0OCA0NC41Nzk4IDE2Ljk1MzkgNTQuOTY1OSAyMy4yNiA2MS4zMDQ3TDM5LjUwMjggNzcuNjMxOEM0NC4yNjg0IDgyLjQyMjEgNDUuMjk5NiA4OS43ODM0IDQyLjAzMzUgOTUuNjk4OEwzMS45MjkgMTE0SDE1LjJDNi44MDUyNyAxMTQgMCAxMDcuMTk1IDAgOTguOFYxNS4yQzAgNi44MDUyNyA2LjgwNTI3IDAgMTUuMiAwSDcxLjI5MTlaTTgwLjExMSAwTDcxLjM0MTIgMTUuOTc1OEM2OC4xMDc4IDIxLjg2NiA2OS4xMjU1IDI5LjE4MDQgNzMuODQ0MSAzMy45NjQxTDkxLjA3NTEgNTEuNDMzMUM5Ny4zNjc0IDU3LjgxMjQgOTYuODA0NCA2OC4yMjI3IDg5Ljg2MDcgNzMuODg2MUw0MC42NzgyIDExNEg5OC44QzEwNy4xOTUgMTE0IDExNCAxMDcuMTk1IDExNCA5OC44VjE1LjJDMTE0IDYuODA1MjcgMTA3LjE5NSAwIDk4LjggMEg4MC4xMTFaIi8+PC9zdmc+",
6
6
  "actions": {
@@ -30,8 +30,8 @@ function $t(e,t){return/* @__PURE__ */ Ot(Qt,e??(()=>!0),t)}// @__NO_SIDE_EFFECT
30
30
  function en(e,t={}){return/* @__PURE__ */ kt(Qt,e,t)}const tn=/*@__PURE__*/ T(`ZodMiniISODateTime`,(e,t)=>{qe.init(e,t),jt.init(e,t)});// @__NO_SIDE_EFFECTS__
31
31
  function nn(e){return/* @__PURE__ */ xt(tn,e)}const U=/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),advanced:/* @__PURE__ */ H(/* @__PURE__ */ P()),width:/* @__PURE__ */ H(/* @__PURE__ */ B([`half`,`full`])),icon:/* @__PURE__ */ H(/* @__PURE__ */ M()),placeholder:/* @__PURE__ */ H(/* @__PURE__ */ M())}),W=(e,t)=>/* @__PURE__ */ L({type:/* @__PURE__ */ V(t),required:/* @__PURE__ */ P(),defaultValue:/* @__PURE__ */ H(/* @__PURE__ */ Ft())}),rn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`SHORT_TEXT`).shape}),an=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`LONG_TEXT`).shape}),on=/* @__PURE__ */ L({disabled:/* @__PURE__ */ H(/* @__PURE__ */ P()),placeholder:/* @__PURE__ */ H(/* @__PURE__ */ M()),options:/* @__PURE__ */ I(/* @__PURE__ */ L({label:/* @__PURE__ */ M(),value:/* @__PURE__ */ F(),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),icon:/* @__PURE__ */ H(/* @__PURE__ */ M())}))}),sn=/* @__PURE__ */ B([`cards`]),cn=/* @__PURE__ */ L({...U.shape,options:on,display:/* @__PURE__ */ H(sn),...W(/* @__PURE__ */ F(),`STATIC_DROPDOWN`).shape}),ln=/* @__PURE__ */ L({...U.shape,options:on,...W(/* @__PURE__ */ I(/* @__PURE__ */ F()),`STATIC_MULTI_SELECT_DROPDOWN`).shape}),un=/* @__PURE__ */ L({...U.shape,reveals:/* @__PURE__ */ H(/* @__PURE__ */ I(/* @__PURE__ */ M())),...W(/* @__PURE__ */ P(),`CHECKBOX`).shape}),dn=/* @__PURE__ */ L({...U.shape,display:/* @__PURE__ */ H(/* @__PURE__ */ B([`stepper`])),min:/* @__PURE__ */ H(/* @__PURE__ */ N()),max:/* @__PURE__ */ H(/* @__PURE__ */ N()),step:/* @__PURE__ */ H(/* @__PURE__ */ N()),...W(/* @__PURE__ */ N(),`NUMBER`).shape}),fn=/* @__PURE__ */ L({...U.shape,streaming:/* @__PURE__ */ H(/* @__PURE__ */ P()),...W(/* @__PURE__ */ F(),`FILE`).shape}),pn=/* @__PURE__ */ L({preset:/* @__PURE__ */ H(/* @__PURE__ */ B([`any_time`,`last_24_hours`,`last_7_days`,`last_30_days`,`last_90_days`,`this_month`,`custom`])),after:/* @__PURE__ */ H(/* @__PURE__ */ M()),before:/* @__PURE__ */ H(/* @__PURE__ */ M())}),mn=/* @__PURE__ */ L({...U.shape,display:/* @__PURE__ */ H(/* @__PURE__ */ B([`dropdown`])),...W(pn,`DATE_RANGE`).shape});let hn=/* @__PURE__ */ function(e){return e.BORDERLESS=`BORDERLESS`,e.INFO=`INFO`,e.WARNING=`WARNING`,e.TIP=`TIP`,e}({});function gn(e){return e==null}const _n=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ Rt(),`MARKDOWN`).shape,variant:/* @__PURE__ */ H(/* @__PURE__ */ B(hn))}),vn=/* @__PURE__ */ L({retryOnFailure:/* @__PURE__ */ L({defaultValue:/* @__PURE__ */ H(/* @__PURE__ */ P()),hide:/* @__PURE__ */ H(/* @__PURE__ */ P())}),continueOnFailure:/* @__PURE__ */ L({defaultValue:/* @__PURE__ */ H(/* @__PURE__ */ P()),hide:/* @__PURE__ */ H(/* @__PURE__ */ P())})});var yn=class{name;displayName;description;props;propertyGroups;run;test;requireAuth;errorHandlingOptions;outputSchema;audience;aiMetadata;classification;constructor(e,t,n,r,i,a,o,s,c,l,u,d,f){this.name=e,this.displayName=t,this.description=n,this.props=r,this.propertyGroups=i,this.run=a,this.test=o,this.requireAuth=s,this.errorHandlingOptions=c,this.outputSchema=l,this.audience=u,this.aiMetadata=d,this.classification=f}};const bn=e=>new yn(e.name,e.displayName,e.description,e.props,e.propertyGroups,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata,e.classification),xn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ F(),`DROPDOWN`).shape,refreshers:/* @__PURE__ */ I(/* @__PURE__ */ M())}),Sn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ I(/* @__PURE__ */ F()),`MULTI_SELECT_DROPDOWN`).shape,refreshers:/* @__PURE__ */ I(/* @__PURE__ */ M())}),Cn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ R([/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ F())]),`JSON`).shape}),wn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`COLOR`).shape}),Tn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`DATE_TIME`).shape}),En=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([rn,an,cn,Sn,ln,un,dn,fn,Cn,wn,Tn])),Dn=/* @__PURE__ */ L({...U.shape,properties:/* @__PURE__ */ H(En),...W(/* @__PURE__ */ I(/* @__PURE__ */ F()),`ARRAY`).shape}),On=/* @__PURE__ */ L({refreshers:/* @__PURE__ */ I(/* @__PURE__ */ M()),...U.shape,...W(/* @__PURE__ */ F(),`DYNAMIC`).shape}),kn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ F()),`OBJECT`).shape}),An=/* @__PURE__ */ R([rn,an,/* @__PURE__ */ L({...U.shape,formatProperty:/* @__PURE__ */ H(/* @__PURE__ */ M()),...W(/* @__PURE__ */ M(),`RICH_TEXT`).shape}),_n,un,cn,ln,xn,Sn,On,dn,Dn,kn,Cn,Tn,mn,fn,/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ F(),`CUSTOM`).shape,code:/* @__PURE__ */ M()}),wn]),jn={ShortText(e){return{...e,valueSchema:void 0,type:`SHORT_TEXT`}},Checkbox(e){return{...e,valueSchema:void 0,type:`CHECKBOX`}},LongText(e){return{...e,valueSchema:void 0,type:`LONG_TEXT`}},RichText(e){return{...e,valueSchema:void 0,type:`RICH_TEXT`}},MarkDown(e){return{displayName:`Markdown`,required:!1,description:e.value,type:`MARKDOWN`,valueSchema:void 0,variant:e.variant??`INFO`}},Number(e){return{...e,valueSchema:void 0,type:`NUMBER`}},Json(e){return{...e,valueSchema:void 0,type:`JSON`}},Array(e){return{...e,valueSchema:void 0,type:`ARRAY`}},Object(e){return{...e,valueSchema:void 0,type:`OBJECT`}},Dropdown(e){return{...e,valueSchema:void 0,type:`DROPDOWN`}},StaticDropdown(e){return{...e,valueSchema:void 0,type:`STATIC_DROPDOWN`}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:`MULTI_SELECT_DROPDOWN`}},DynamicProperties(e){return{...e,valueSchema:void 0,type:`DYNAMIC`}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:`STATIC_MULTI_SELECT_DROPDOWN`}},DateTime(e){return{...e,valueSchema:void 0,type:`DATE_TIME`}},DateRange(e){return{...e,valueSchema:void 0,type:`DATE_RANGE`}},File(e){return{...e,valueSchema:void 0,type:`FILE`}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:`CUSTOM`}},Color(e){return{...e,valueSchema:void 0,type:`COLOR`}}};let Mn=/* @__PURE__ */ function(e){return e.AUTHORIZATION_CODE=`authorization_code`,e.CLIENT_CREDENTIALS=`client_credentials`,e}({}),Nn=/* @__PURE__ */ function(e){return e.POLLING=`POLLING`,e.WEBHOOK=`WEBHOOK`,e.APP_WEBHOOK=`APP_WEBHOOK`,e.MANUAL=`MANUAL`,e}({}),Pn=/* @__PURE__ */ function(e){return e.SIMULATION=`SIMULATION`,e.TEST_FUNCTION=`TEST_FUNCTION`,e}({});const Fn=/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),hasConnectionIdentifier:/* @__PURE__ */ H(/* @__PURE__ */ P())}),In=/* @__PURE__ */ L({username:/* @__PURE__ */ M(),password:/* @__PURE__ */ M()}),Ln=/* @__PURE__ */ L({...Fn.shape,username:/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M())}),password:/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M())}),...W(In,`BASIC_AUTH`).shape}),Rn=/* @__PURE__ */ L({...Fn.shape,...W(/* @__PURE__ */ L({auth:/* @__PURE__ */ M()}),`SECRET_TEXT`).shape}),zn=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([rn,an,Rn,dn,cn,un,_n,ln])),Bn=/* @__PURE__ */ L({...Fn.shape,props:zn,...W(/* @__PURE__ */ F(),`CUSTOM_AUTH`).shape}),Vn=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([rn,an,Rn,dn,un,cn,ln,_n])),Hn=/* @__PURE__ */ L({...Fn.shape,props:Vn,...W(/* @__PURE__ */ F(),`OIDC`).shape});let Un=/* @__PURE__ */ function(e){return e.HEADER=`HEADER`,e.BODY=`BODY`,e}({});const Wn=/* @__PURE__ */ R([rn,Rn,cn]),Gn=/* @__PURE__ */ z(/* @__PURE__ */ M(),Wn),Kn=/* @__PURE__ */ L({props:/* @__PURE__ */ H(/* @__PURE__ */ z(/* @__PURE__ */ M(),Wn)),authUrl:/* @__PURE__ */ M(),tokenUrl:/* @__PURE__ */ M(),scope:/* @__PURE__ */ I(/* @__PURE__ */ M()),prompt:/* @__PURE__ */ H(/* @__PURE__ */ R([/* @__PURE__ */ V(`none`),/* @__PURE__ */ V(`consent`),/* @__PURE__ */ V(`login`),/* @__PURE__ */ V(`omit`)])),pkce:/* @__PURE__ */ H(/* @__PURE__ */ P()),pkceMethod:/* @__PURE__ */ H(/* @__PURE__ */ R([/* @__PURE__ */ V(`plain`),/* @__PURE__ */ V(`S256`)])),authorizationMethod:/* @__PURE__ */ H(/* @__PURE__ */ B(Un)),grantType:/* @__PURE__ */ H(/* @__PURE__ */ R([/* @__PURE__ */ B(Mn),/* @__PURE__ */ V(`both_client_credentials_and_authorization_code`)])),extra:/* @__PURE__ */ H(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ M())),discovery:/* @__PURE__ */ H(/* @__PURE__ */ L({serverUrlProp:/* @__PURE__ */ M(),authUrlProp:/* @__PURE__ */ M(),tokenUrlProp:/* @__PURE__ */ M(),scopesProp:/* @__PURE__ */ H(/* @__PURE__ */ M())}))}),qn=/* @__PURE__ */ L({access_token:/* @__PURE__ */ M(),props:/* @__PURE__ */ H(Gn),data:/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ Ft())}),Jn=/* @__PURE__ */ R([Ln,Bn,Hn,/* @__PURE__ */ L({...Fn.shape,...Kn.shape,...W(qn,`OAUTH2`).shape}),Rn]);let G,K,Yn=t=>{if(t<0)throw RangeError(`Wrong ID size`);try{!G||G.length<t?(G=Buffer.allocUnsafe(t*128),e.randomFillSync(G),K=0):K+t>G.length&&(e.randomFillSync(G),K=0)}catch(e){throw G=void 0,e}K+=t},Xn=e=>(Yn(e|=0),G.subarray(K-e,K)),Zn=(e,t,n)=>{let r=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*r*t/e.length);return(a=t)=>{if(a<=0)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(o+=e[t[s]&r]||``,o.length===a)return o}}},Qn=(e,t=21)=>Zn(e,t,Xn),$n=/* @__PURE__ */ function(e){return e.ARCHIVE=`ARCHIVE`,e.REGISTRY=`REGISTRY`,e}({}),er=/* @__PURE__ */ function(e){return e.CUSTOM=`CUSTOM`,e.OFFICIAL=`OFFICIAL`,e}({}),tr=/* @__PURE__ */ function(e){return e.ARTIFICIAL_INTELLIGENCE=`ARTIFICIAL_INTELLIGENCE`,e.COMMUNICATION=`COMMUNICATION`,e.COMMERCE=`COMMERCE`,e.CORE=`CORE`,e.UNIVERSAL_AI=`UNIVERSAL_AI`,e.FLOW_CONTROL=`FLOW_CONTROL`,e.BUSINESS_INTELLIGENCE=`BUSINESS_INTELLIGENCE`,e.ACCOUNTING=`ACCOUNTING`,e.PRODUCTIVITY=`PRODUCTIVITY`,e.CONTENT_AND_FILES=`CONTENT_AND_FILES`,e.DEVELOPER_TOOLS=`DEVELOPER_TOOLS`,e.CUSTOMER_SUPPORT=`CUSTOMER_SUPPORT`,e.FORMS_AND_SURVEYS=`FORMS_AND_SURVEYS`,e.HUMAN_RESOURCES=`HUMAN_RESOURCES`,e.PAYMENT_PROCESSING=`PAYMENT_PROCESSING`,e.MARKETING=`MARKETING`,e.SALES_AND_CRM=`SALES_AND_CRM`,e}({});(/* @__PURE__ */ M()).check(/* @__PURE__ */ Dt(/* @__PURE__ */ RegExp(`^[0-9a-zA-Z]{21}$`))),Qn(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,21);const nr=/* @__PURE__ */ Zt(/* @__PURE__ */ Kt(e=>e instanceof Date?e.toISOString():e),/* @__PURE__ */ M()),rr={id:/* @__PURE__ */ M(),created:nr,updated:nr},ir=e=>/* @__PURE__ */ H(/* @__PURE__ */ Yt(e));(/* @__PURE__ */ nn({offset:!0})).check(/* @__PURE__ */ en(e=>e.slice(0,4)!==`0000`));let ar=/* @__PURE__ */ function(e){return e.DUTCH=`nl`,e.ENGLISH=`en`,e.GERMAN=`de`,e.FRENCH=`fr`,e.SPANISH=`es`,e.JAPANESE=`ja`,e.CHINESE_SIMPLIFIED=`zh`,e.PORTUGUESE=`pt`,e.ARABIC=`ar`,e.CHINESE_TRADITIONAL=`zh-TW`,e}({}),or=/* @__PURE__ */ function(e){return e.IN_PROGRESS=`in-progress`,e.COMPLETED=`completed`,e}({});(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1));const sr={type:/* @__PURE__ */ V(`TOOL_CALL`),input:ir(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ F())),output:/* @__PURE__ */ H(/* @__PURE__ */ F()),toolName:/* @__PURE__ */ M(),status:/* @__PURE__ */ B(or),toolCallId:/* @__PURE__ */ M(),startTime:/* @__PURE__ */ M(),endTime:/* @__PURE__ */ H(/* @__PURE__ */ M())};({...sr}),{...sr},{...sr},{...sr},{...sr},(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ Dt(/^[a-z0-9][a-z0-9-]{0,62}$/)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ Dt(/^[a-z0-9][a-z0-9-]{0,62}$/));const cr=[`gpt-5.5`,`gpt-5.6-sol`,`gpt-5.6-terra`,`gpt-5.6-luna`,`gpt-5.4-mini`,`gpt-5.4-nano`,`gpt-4.1`,`gpt-4.1-mini`],lr=[`claude-sonnet-5-5`,`claude-opus-5-5`,`claude-haiku-5-5`],ur=[`claude-sonnet-4.6`,`claude-opus-4.7`,`claude-opus-4.8`,`claude-haiku-4.5`],dr=[`gemini-3.7-flash`,`gemini-3.1-pro-preview`,`gemini-3-flash-preview`],fr=[`gemini-2.5-pro`,`gemini-2.5-flash`],pr=[`grok-4.20`];[...ur.map(e=>`anthropic/${e}`)];const mr={openai:cr,anthropic:lr,google:dr,vertex:dr,activepieces:[...ur.map(e=>`anthropic/${e}`),...cr.map(e=>`openai/${e}`),...[...dr,...fr].map(e=>`google/${e}`),...pr.map(e=>`x-ai/${e}`)]},hr=128e3,gr={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,vertex:1048576,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function _r({provider:e}){return e?gr[e]??hr:hr}const vr={openai:[`text-embedding-3-small`,`text-embedding-3-large`],google:[`text-embedding-004`,`gemini-embedding-001`],azure:[`text-embedding-3-small`,`text-embedding-3-large`],activepieces:[`text-embedding-3-small`],openrouter:[`openai/text-embedding-3-small`,`openai/text-embedding-3-large`]},yr={anthropic:`native`,google:`native`,openrouter:`plugin`,activepieces:`plugin`},br=/* @__PURE__ */ new Set([`anthropic`,`mistral`,`xai`,`deepseek`,`zai`,`qwen`,`minimax`,`moonshot`]);function q(e){return{chatModels:mr[e],maxContextTokens:_r({provider:e}),embeddingModels:vr[e]??[],defaultEmbeddingModel:vr[e]?.[0],supportsEmbedding:(vr[e]??[]).length>0,supportsImageGeneration:!br.has(e),defaultImageModel:xr[e],webSearch:yr[e]}}const xr={activepieces:{id:`fast`,label:`Fast`,modelId:`google/gemini-3.1-flash-lite-image`}.modelId,openrouter:`google/gemini-3.1-flash-lite-image`,openai:`gpt-image-1.5`,google:`gemini-3.1-flash-image`};q(`openai`),q(`anthropic`),q(`openrouter`),q(`azure`),q(`google`),q(`cloudflare-gateway`),q(`custom`),q(`bedrock`),q(`vertex`),q(`mistral`),q(`activepieces`),q(`xai`),q(`deepseek`),q(`zai`),q(`qwen`),q(`minimax`),q(`moonshot`),{...rr},{...rr},{...rr},{...rr},{...rr};const Sr=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([An,Jn])),Cr=/* @__PURE__ */ R([/* @__PURE__ */ L({strategy:/* @__PURE__ */ V(`CRON`),cronExpression:/* @__PURE__ */ M()}),/* @__PURE__ */ L({strategy:/* @__PURE__ */ V(`NONE`)})]);var wr=class{name;displayName;description;requireAuth;props;type;handshakeConfiguration;onHandshake;renewConfiguration;onRenew;onEnable;onDisable;onStart;run;test;sampleData;testStrategy;outputSchema;aiMetadata;classification;propertyGroups;constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,ee){this.name=e,this.displayName=t,this.description=n,this.requireAuth=r,this.props=i,this.type=a,this.handshakeConfiguration=o,this.onHandshake=s,this.renewConfiguration=c,this.onRenew=l,this.onEnable=u,this.onDisable=d,this.onStart=f,this.run=p,this.test=m,this.sampleData=h,this.testStrategy=g,this.outputSchema=_,this.aiMetadata=v,this.classification=y,this.propertyGroups=ee}};const Tr=e=>{switch(e.type){case`WEBHOOK`:return new wr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:`NONE`},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:`NONE`},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?`TEST_FUNCTION`:`SIMULATION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case`POLLING`:return new wr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:`NONE`},async()=>({status:200}),{strategy:`NONE`},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,`TEST_FUNCTION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case`MANUAL`:return new wr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:`NONE`},async()=>({status:200}),{strategy:`NONE`},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,`TEST_FUNCTION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case`APP_WEBHOOK`:return new wr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:`NONE`},async()=>({status:200}),{strategy:`NONE`},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,gn(e.sampleData)&&gn(e.test)?`SIMULATION`:`TEST_FUNCTION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);default:{let{name:t,type:n,strategy:r}=e;throw Error(n===void 0&&r!==void 0?`createTrigger: trigger ${JSON.stringify(t)} sets \`strategy\`; the field is \`type\`, e.g. type: TriggerStrategy.POLLING`:`createTrigger: trigger ${JSON.stringify(t)} has \`type\` ${JSON.stringify(n)}; set type: TriggerStrategy.POLLING or TriggerStrategy.WEBHOOK`)}}},Er=`0.82.0`;var Dr=class{displayName;logoUrl;authors;events;categories;auth;minimumSupportedRelease;maximumSupportedRelease;description;deprecated;_actions={};_triggers={};getContextInfo=()=>({version:`2`});constructor(e,t,n,r,i,a,o,s,c=Er,l,u=``,d){this.displayName=e,this.logoUrl=t,this.authors=n,this.events=r,this.categories=o,this.auth=s,this.minimumSupportedRelease=c,this.maximumSupportedRelease=l,this.description=u,this.deprecated=d,(!jr(c)||Mr(c,`0.82.0`))&&(this.minimumSupportedRelease=Er),i.forEach(e=>this._actions[e.name]=e),a.forEach(e=>this._triggers[e.name]=e)}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:kr(this.auth),minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(e){return this._actions[e]}getTrigger(e){return this._triggers[e]}actions(){return this._actions}triggers(){return this._triggers}};const Or=e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((e,t,n)=>t===n.findIndex(t=>t.type===e.type)))throw Error(`Auth properties must be unique by type`);return new Dr(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description,e.deprecated)};function kr(e){if(e!==void 0)return Array.isArray(e)?e.map(Ar):Ar(e)}function Ar(e){return{...e,hasConnectionIdentifier:e.getConnectionIdentifier!==void 0}}function jr(e){return/^\d+\.\d+\.\d+$/.test(e)}function Mr(e,t){let[n,r,i]=e.split(`.`).map(Number),[a,o,s]=t.split(`.`).map(Number);return n===a?r===o?i<s:r<o:n<a}const Nr=/* @__PURE__ */ L({id:/* @__PURE__ */ H(/* @__PURE__ */ M()),name:/* @__PURE__ */ M(),displayName:/* @__PURE__ */ M(),logoUrl:/* @__PURE__ */ M(),description:/* @__PURE__ */ M(),authors:/* @__PURE__ */ I(/* @__PURE__ */ M()),platformId:/* @__PURE__ */ H(/* @__PURE__ */ M()),directoryPath:/* @__PURE__ */ H(/* @__PURE__ */ M()),auth:/* @__PURE__ */ H(/* @__PURE__ */ R([Jn,/* @__PURE__ */ I(Jn)])),version:/* @__PURE__ */ M(),categories:/* @__PURE__ */ H(/* @__PURE__ */ I(/* @__PURE__ */ B(tr))),minimumSupportedRelease:/* @__PURE__ */ H(/* @__PURE__ */ M()),maximumSupportedRelease:/* @__PURE__ */ H(/* @__PURE__ */ M()),deprecated:/* @__PURE__ */ H(/* @__PURE__ */ P()),i18n:/* @__PURE__ */ H(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ M())))}),Pr=/* @__PURE__ */ B([`human`,`ai`,`both`]),Fr=/* @__PURE__ */ L({description:/* @__PURE__ */ H(/* @__PURE__ */ M()),idempotent:/* @__PURE__ */ H(/* @__PURE__ */ P())}),Ir=/* @__PURE__ */ B([`READ`,`SEARCH`,`WRITE`,`DESTRUCTIVE`]),Lr=/* @__PURE__ */ L({key:/* @__PURE__ */ M(),display:/* @__PURE__ */ B([`tabs`,`section`,`summary`,`builder`,`footer`]),label:/* @__PURE__ */ H(/* @__PURE__ */ M()),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),icon:/* @__PURE__ */ H(/* @__PURE__ */ M()),props:/* @__PURE__ */ I(/* @__PURE__ */ M())}),Rr=/* @__PURE__ */ L({name:/* @__PURE__ */ M(),displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ M(),props:Sr,propertyGroups:/* @__PURE__ */ H(/* @__PURE__ */ I(Lr)),requireAuth:/* @__PURE__ */ P(),errorHandlingOptions:/* @__PURE__ */ H(vn),outputSchema:/* @__PURE__ */ H(/* @__PURE__ */ $t()),audience:/* @__PURE__ */ H(Pr),aiMetadata:/* @__PURE__ */ H(Fr),classification:/* @__PURE__ */ H(Ir)}),zr=/* @__PURE__ */ L({name:/* @__PURE__ */ M(),displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ M(),props:Sr,propertyGroups:/* @__PURE__ */ H(/* @__PURE__ */ I(Lr)),errorHandlingOptions:/* @__PURE__ */ H(vn),type:/* @__PURE__ */ B(Nn),sampleData:/* @__PURE__ */ F(),handshakeConfiguration:/* @__PURE__ */ H(/* @__PURE__ */ $t()),renewConfiguration:/* @__PURE__ */ H(Cr),testStrategy:/* @__PURE__ */ B(Pn),outputSchema:/* @__PURE__ */ H(/* @__PURE__ */ $t()),aiMetadata:/* @__PURE__ */ H(Fr),classification:/* @__PURE__ */ H(Ir)}),Br=/* @__PURE__ */ L({...Nr.shape,actions:/* @__PURE__ */ z(/* @__PURE__ */ M(),Rr),triggers:/* @__PURE__ */ z(/* @__PURE__ */ M(),zr)}),Vr=/* @__PURE__ */ L({...Nr.shape,actions:/* @__PURE__ */ N(),triggers:/* @__PURE__ */ N(),suggestedActions:/* @__PURE__ */ H(/* @__PURE__ */ I(Rr)),suggestedTriggers:/* @__PURE__ */ H(/* @__PURE__ */ I(zr))}),Hr=/* @__PURE__ */ L({projectUsage:/* @__PURE__ */ N(),pieceType:/* @__PURE__ */ B(er),packageType:/* @__PURE__ */ B($n),platformId:/* @__PURE__ */ H(/* @__PURE__ */ M()),archiveId:/* @__PURE__ */ H(/* @__PURE__ */ M())});({...Br.shape,...Hr.shape}),{...Vr.shape,...Hr.shape};const Ur={translatePiece:({piece:e,locale:t})=>{let n=t?e.i18n?.[t]:void 0;return n?Yr({node:e,tree:qr(e.categories)?Gr:Wr,translations:n}):e},pathsToTranslate:e=>qr(e)?[...Ur.pathsToValuesToTranslate,`displayName`]:Ur.pathsToValuesToTranslate,initializeI18n:async e=>{try{let t=Object.values(ar),n={};for(let r of t){let t=await $r(r,e);t&&(n[r]=t)}return Object.keys(n).length>0?n:void 0}catch(t){console.log(`Error initializing i18n for ${e}:`,t);return}},pathsToValuesToTranslate:[`description`,`auth.username.displayName`,`auth.username.description`,`auth.password.displayName`,`auth.password.description`,`auth.props.*.displayName`,`auth.props.*.description`,`auth.props.*.options.options.*.label`,`auth.description`,`actions.*.displayName`,`actions.*.description`,`actions.*.props.*.displayName`,`actions.*.props.*.description`,`actions.*.props.*.options.options.*.label`,`actions.*.propertyGroups.*.label`,`actions.*.propertyGroups.*.description`,`triggers.*.displayName`,`triggers.*.description`,`triggers.*.props.*.displayName`,`triggers.*.props.*.description`,`triggers.*.props.*.options.options.*.label`,`triggers.*.propertyGroups.*.label`,`triggers.*.propertyGroups.*.description`]},Wr=Kr(Ur.pathsToTranslate()),Gr=Kr(Ur.pathsToTranslate([`CORE`]));function Kr(e){return e.reduce((e,t)=>Jr({tree:e,keys:t.split(`.`)}),{})}function qr(e){return e?.includes(`CORE`)??!1}function Jr({tree:e,keys:[t,...n]}){return{...e,[t]:n.length===0?null:Jr({tree:e[t]??{},keys:n})}}function Yr({node:e,tree:t,translations:n}){if(!Zr(e))return e;let r={},i=!1;for(let[a,o]of Object.entries(t))for(let t of a===`*`?Object.keys(e):[a]){let a=e[t],s=o===null?Xr({value:a,translations:n}):Yr({node:a,tree:o,translations:n});s!==a&&(r[t]=s,i=!0)}return i?Object.assign(Array.isArray(e)?[]:{},e,r):e}function Xr({value:e,translations:t}){return typeof e==`string`&&t[e.slice(0,512)]||e}function Zr(e){return typeof e==`object`&&!!e}async function Qr(e){try{return await n.access(e),!0}catch{return!1}}const $r=async(e,r)=>{let i=t.join(r,`src`,`i18n`,`${e}.json`);if(!await Qr(i))return null;try{let t=await n.readFile(i,`utf8`),a=JSON.parse(t);if(typeof a==`object`&&a)return a;throw Error(`Invalid i18n file format for ${e} in piece ${r}`)}catch(t){return console.error(`Error reading i18n file for ${e} in piece ${r}:`,t),null}};function J(e){let{requireReactor:t,defaultTimeoutSeconds:n,defaultRetry:r,...i}=e;return ei(ni(bn(i),t),{defaultTimeoutSeconds:n,defaultRetry:r})}function ei(e,{defaultTimeoutSeconds:t,defaultRetry:n}){if(t!==void 0){if(!Number.isFinite(t)||t<=0)throw Error(`defaultTimeoutSeconds must be a positive number, got ${JSON.stringify(t)}`);Object.assign(e,{defaultTimeoutSeconds:t})}if(n!==void 0){let t=n.maxAttempts;if(!Number.isInteger(t)||t<1)throw Error(`defaultRetry.maxAttempts must be a positive integer, got ${JSON.stringify(t)}`);Object.assign(e,{defaultRetry:n})}return e}function ti(e){let{requireReactor:t,...n}=e;return ni(Tr(n),t)}function ni(e,t){if(t===void 0||t===!1)return e;if(t!==`read`&&t!==`write`)throw Error(`requireReactor must be "read", "write" or false, got ${JSON.stringify(t)}`);return Object.assign(e,{requireReactor:t})}const Y={...jn,Dropdown(e){return jn.Dropdown(e)},MultiSelectDropdown(e){return jn.MultiSelectDropdown(e)},DynamicProperties(e){return jn.DynamicProperties(e)}};function ri(e,t){let n=e.result?.actions??[],r=new Map(n.map(e=>[e.actionId,e])),i=(t?.map(e=>({id:e.id,label:e.type}))??n.map(({actionId:e})=>({id:e,label:e}))).flatMap(({id:e,label:t})=>{let n=r.get(e);return n?n.kind===`reducer-error`?[`Action ${t} failed: ${n.message}`]:n.kind===`denied`?[`Action ${t} was denied: ${n.reason}`]:[]:[`Action ${t} produced no operation`]});if(i.length>0){let e=Error(i.join(`; `));throw e.name=`ReactorActionsFailedError`,e}}function ii(e){return{documentId:e.id,documentType:e.documentType,branch:e.branch,revision:{...e.revision}}}const ai=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function oi(e={}){let t=e.now??(()=>Date.now()),n=e.random??(e=>{globalThis.crypto.getRandomValues(e)}),r=/* @__PURE__ */ new Uint8Array(16),i=-1,a=0;return()=>{let e=t();n(r);let o=(r[6]&7)<<8|r[7];e>i?(i=e,a=o):a<4095?a++:(i++,a=o);let s=i;for(let e=5;e>=0;e--)r[e]=s%256,s=Math.floor(s/256);r[6]=112|a>>8,r[7]=a&255,r[8]=128|r[8]&63;let c=``;for(let e=0;e<16;e++)(e===4||e===6||e===8||e===10)&&(c+=`-`),c+=ai[r[e]];return c}}const si=oi();let ci=0,li=0;function ui(){let e=Date.now();return li=e<ci||e>li?e:li+1,ci=e,new Date(li).toISOString()}const di=`powerhouse/document-drive`,fi=/* @__PURE__ */ new Set([di,`powerhouse/reactor-drive`]),pi=`main`,mi=`global`;function hi(e){return{header:e.header,state:e.state}}function gi(e){let t=e.state.global;return t&&typeof t==`object`?t:{}}function _i(e){let t=gi(e).name;return typeof t==`string`&&t||e.header.name||``}function vi(e,t){let n=gi(e);for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function yi(e,t){if(!t)return!0;let n=vi(e,t.path);return typeof n==`string`?n===t.value:typeof n==`number`||typeof n==`boolean`||typeof n==`bigint`?String(n)===t.value:!1}const bi={type:`SET_NAME`,module:`base`,scope:mi,inputSchema:`input SetNameInput {
32
32
  name: String!
33
- }`};function xi(e){let t=e.documentModel.global,n=t.specifications.at(-1);return{documentType:t.id,name:t.name,stateSchema:n?.state.global.schema??null,actions:[...(n?.modules??[]).flatMap(e=>e.operations.flatMap(t=>t.name?[{type:t.name,module:e.name,scope:t.scope||`global`,inputSchema:t.schema??null}]:[])),bi]}}function Si(e,t,n=mi){return{id:si(),timestampUtcMs:n===`auth`?ui():(/* @__PURE__ */ new Date()).toISOString(),type:e,input:t,scope:n}}function Ci(e){return e.toLowerCase().replace(/_+([a-z0-9])/g,(e,t)=>t.toUpperCase())}function wi(e,t,n){let r=e.actions[Ci(t)];if(r){let e=r(n);if(e.type===t)return e}return Si(t,n,xi(e).actions.find(e=>e.type===t)?.scope)}var Ti=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isObjectLike=t;function t(e){return typeof e==`object`&&!!e}})),Ei=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.invariant=t;function t(e,t){if(!e)throw Error(t??`Unexpected invariant triggered.`)}})),Di=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getLocation=r;var t=Ei();let n=/\r\n|[\n\r]/g;function r(e,r){let i=0,a=1;for(let o of e.body.matchAll(n)){if(typeof o.index==`number`||(0,t.invariant)(!1),o.index>=r)break;i=o.index+o[0].length,a+=1}return{line:a,column:r+1-i}}})),Oi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.printLocation=n,e.printSourceLocation=r;var t=Di();function n(e){return r(e.source,(0,t.getLocation)(e.source,e.start))}function r(e,t){let n=e.locationOffset.column-1,r=``.padStart(n)+e.body,a=t.line-1,o=e.locationOffset.line-1,s=t.line+o,c=t.line===1?n:0,l=t.column+c,u=`${e.name}:${s}:${l}\n`,d=r.split(/\r\n|[\n\r]/g),f=d[a];if(f.length>120){let e=Math.floor(l/80),t=l%80,n=[];for(let e=0;e<f.length;e+=80)n.push(f.slice(e,e+80));return u+i([[`${s} |`,n[0]],...n.slice(1,e+1).map(e=>[`|`,e]),[`|`,`^`.padStart(t)],[`|`,n[e+1]]])}return u+i([[`${s-1} |`,d[a-1]],[`${s} |`,f],[`|`,`^`.padStart(l)],[`${s+1} |`,d[a+1]]])}function i(e){let t=e.filter(([e,t])=>t!==void 0),n=Math.max(...t.map(([e])=>e.length));return t.map(([e,t])=>e.padStart(n)+(t?` `+t:``)).join(`
34
- `)}})),ki=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLError=void 0,e.formatError=s,e.printError=o;var t=Ti(),n=Di(),r=Oi();function i(e){let t=e[0];return t==null||`kind`in t||`length`in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}e.GraphQLError=class e extends Error{constructor(r,...o){let{nodes:s,source:c,positions:l,path:u,originalError:d,extensions:f}=i(o);super(r),this.name=`GraphQLError`,this.path=u??void 0,this.originalError=d??void 0,this.nodes=a(Array.isArray(s)?s:s?[s]:void 0);let p=a(this.nodes?.map(e=>e.loc).filter(e=>e!=null));this.source=c??p?.[0]?.source,this.positions=l??p?.map(e=>e.start),this.locations=l&&c?l.map(e=>(0,n.getLocation)(c,e)):p?.map(e=>(0,n.getLocation)(e.source,e.start));let m=(0,t.isObjectLike)(d?.extensions)?d?.extensions:void 0;
33
+ }`};function xi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Si=(e,t)=>{let n=xi(e)?e[t]:void 0;return Array.isArray(n)?n:[]};function Ci(e,t){let n=Si(e.definition,`specifications`).find(e=>xi(e)&&e.version===t);return new Map(Si(n,`modules`).flatMap(e=>Si(e,`operations`)).flatMap(e=>xi(e)&&typeof e.name==`string`&&typeof e.actionType==`string`?[[e.name,e.actionType]]:[]))}function wi(e){let t=e.documentModel.global,n=t.specifications.at(-1),r=Ci(e,n?.version);return{documentType:t.id,name:t.name,stateSchema:n?.state.global.schema??null,actions:[...(n?.modules??[]).flatMap(e=>e.operations.flatMap(t=>t.name?[{type:r.get(t.name)??t.name,module:e.name,scope:t.scope||`global`,inputSchema:t.schema??null}]:[])),bi]}}function Ti(e,t,n=mi){return{id:si(),timestampUtcMs:n===`auth`?ui():(/* @__PURE__ */ new Date()).toISOString(),type:e,input:t,scope:n}}function Ei(e){return e.toLowerCase().replace(/_+([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Di(e,t,n){let r=e.actions[Ei(t)];if(r){let e=r(n);if(e.type===t)return e}return Ti(t,n,wi(e).actions.find(e=>e.type===t)?.scope)}var Oi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isObjectLike=t;function t(e){return typeof e==`object`&&!!e}})),ki=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.invariant=t;function t(e,t){if(!e)throw Error(t??`Unexpected invariant triggered.`)}})),Ai=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getLocation=r;var t=ki();let n=/\r\n|[\n\r]/g;function r(e,r){let i=0,a=1;for(let o of e.body.matchAll(n)){if(typeof o.index==`number`||(0,t.invariant)(!1),o.index>=r)break;i=o.index+o[0].length,a+=1}return{line:a,column:r+1-i}}})),ji=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.printLocation=n,e.printSourceLocation=r;var t=Ai();function n(e){return r(e.source,(0,t.getLocation)(e.source,e.start))}function r(e,t){let n=e.locationOffset.column-1,r=``.padStart(n)+e.body,a=t.line-1,o=e.locationOffset.line-1,s=t.line+o,c=t.line===1?n:0,l=t.column+c,u=`${e.name}:${s}:${l}\n`,d=r.split(/\r\n|[\n\r]/g),f=d[a];if(f.length>120){let e=Math.floor(l/80),t=l%80,n=[];for(let e=0;e<f.length;e+=80)n.push(f.slice(e,e+80));return u+i([[`${s} |`,n[0]],...n.slice(1,e+1).map(e=>[`|`,e]),[`|`,`^`.padStart(t)],[`|`,n[e+1]]])}return u+i([[`${s-1} |`,d[a-1]],[`${s} |`,f],[`|`,`^`.padStart(l)],[`${s+1} |`,d[a+1]]])}function i(e){let t=e.filter(([e,t])=>t!==void 0),n=Math.max(...t.map(([e])=>e.length));return t.map(([e,t])=>e.padStart(n)+(t?` `+t:``)).join(`
34
+ `)}})),Mi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLError=void 0,e.formatError=s,e.printError=o;var t=Oi(),n=Ai(),r=ji();function i(e){let t=e[0];return t==null||`kind`in t||`length`in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}e.GraphQLError=class e extends Error{constructor(r,...o){let{nodes:s,source:c,positions:l,path:u,originalError:d,extensions:f}=i(o);super(r),this.name=`GraphQLError`,this.path=u??void 0,this.originalError=d??void 0,this.nodes=a(Array.isArray(s)?s:s?[s]:void 0);let p=a(this.nodes?.map(e=>e.loc).filter(e=>e!=null));this.source=c??p?.[0]?.source,this.positions=l??p?.map(e=>e.start),this.locations=l&&c?l.map(e=>(0,n.getLocation)(c,e)):p?.map(e=>(0,n.getLocation)(e.source,e.start));let m=(0,t.isObjectLike)(d?.extensions)?d?.extensions:void 0;
35
35
  /* c8 ignore start */
36
36
  this.extensions=f??m??Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),d!=null&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})
37
37
  /* c8 ignore stop */
@@ -39,11 +39,11 @@ this.extensions=f??m??Object.create(null),Object.defineProperties(this,{message:
39
39
 
40
40
  `+(0,r.printLocation)(t.loc));else if(this.source&&this.locations)for(let t of this.locations)e+=`
41
41
 
42
- `+(0,r.printSourceLocation)(this.source,t);return e}toJSON(){let e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}};function a(e){return e===void 0||e.length===0?void 0:e}function o(e){return e.toString()}function s(e){return e.toJSON()}})),Ai=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0;var t;e.Kind=t,(function(e){e.NAME=`Name`,e.DOCUMENT=`Document`,e.OPERATION_DEFINITION=`OperationDefinition`,e.VARIABLE_DEFINITION=`VariableDefinition`,e.SELECTION_SET=`SelectionSet`,e.FIELD=`Field`,e.ARGUMENT=`Argument`,e.FRAGMENT_SPREAD=`FragmentSpread`,e.INLINE_FRAGMENT=`InlineFragment`,e.FRAGMENT_DEFINITION=`FragmentDefinition`,e.VARIABLE=`Variable`,e.INT=`IntValue`,e.FLOAT=`FloatValue`,e.STRING=`StringValue`,e.BOOLEAN=`BooleanValue`,e.NULL=`NullValue`,e.ENUM=`EnumValue`,e.LIST=`ListValue`,e.OBJECT=`ObjectValue`,e.OBJECT_FIELD=`ObjectField`,e.DIRECTIVE=`Directive`,e.NAMED_TYPE=`NamedType`,e.LIST_TYPE=`ListType`,e.NON_NULL_TYPE=`NonNullType`,e.SCHEMA_DEFINITION=`SchemaDefinition`,e.OPERATION_TYPE_DEFINITION=`OperationTypeDefinition`,e.SCALAR_TYPE_DEFINITION=`ScalarTypeDefinition`,e.OBJECT_TYPE_DEFINITION=`ObjectTypeDefinition`,e.FIELD_DEFINITION=`FieldDefinition`,e.INPUT_VALUE_DEFINITION=`InputValueDefinition`,e.INTERFACE_TYPE_DEFINITION=`InterfaceTypeDefinition`,e.UNION_TYPE_DEFINITION=`UnionTypeDefinition`,e.ENUM_TYPE_DEFINITION=`EnumTypeDefinition`,e.ENUM_VALUE_DEFINITION=`EnumValueDefinition`,e.INPUT_OBJECT_TYPE_DEFINITION=`InputObjectTypeDefinition`,e.DIRECTIVE_DEFINITION=`DirectiveDefinition`,e.SCHEMA_EXTENSION=`SchemaExtension`,e.SCALAR_TYPE_EXTENSION=`ScalarTypeExtension`,e.OBJECT_TYPE_EXTENSION=`ObjectTypeExtension`,e.INTERFACE_TYPE_EXTENSION=`InterfaceTypeExtension`,e.UNION_TYPE_EXTENSION=`UnionTypeExtension`,e.ENUM_TYPE_EXTENSION=`EnumTypeExtension`,e.INPUT_OBJECT_TYPE_EXTENSION=`InputObjectTypeExtension`,e.TYPE_COORDINATE=`TypeCoordinate`,e.MEMBER_COORDINATE=`MemberCoordinate`,e.ARGUMENT_COORDINATE=`ArgumentCoordinate`,e.DIRECTIVE_COORDINATE=`DirectiveCoordinate`,e.DIRECTIVE_ARGUMENT_COORDINATE=`DirectiveArgumentCoordinate`})(t||(e.Kind=t={}))})),ji=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.syntaxError=n;var t=ki();function n(e,n,r){return new t.GraphQLError(`Syntax Error: ${r}`,{source:e,positions:[n]})}})),Mi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.QueryDocumentKeys=e.OperationTypeNode=e.Location=void 0,e.isNode=r,e.Location=class{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return`Location`}toJSON(){return{start:this.start,end:this.end}}},e.Token=class{constructor(e,t,n,r,i,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return`Token`}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}};let t={Name:[],Document:[`definitions`],OperationDefinition:[`description`,`name`,`variableDefinitions`,`directives`,`selectionSet`],VariableDefinition:[`description`,`variable`,`type`,`defaultValue`,`directives`],Variable:[`name`],SelectionSet:[`selections`],Field:[`alias`,`name`,`arguments`,`directives`,`selectionSet`],Argument:[`name`,`value`],FragmentSpread:[`name`,`directives`],InlineFragment:[`typeCondition`,`directives`,`selectionSet`],FragmentDefinition:[`description`,`name`,`variableDefinitions`,`typeCondition`,`directives`,`selectionSet`],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:[`values`],ObjectValue:[`fields`],ObjectField:[`name`,`value`],Directive:[`name`,`arguments`],NamedType:[`name`],ListType:[`type`],NonNullType:[`type`],SchemaDefinition:[`description`,`directives`,`operationTypes`],OperationTypeDefinition:[`type`],ScalarTypeDefinition:[`description`,`name`,`directives`],ObjectTypeDefinition:[`description`,`name`,`interfaces`,`directives`,`fields`],FieldDefinition:[`description`,`name`,`arguments`,`type`,`directives`],InputValueDefinition:[`description`,`name`,`type`,`defaultValue`,`directives`],InterfaceTypeDefinition:[`description`,`name`,`interfaces`,`directives`,`fields`],UnionTypeDefinition:[`description`,`name`,`directives`,`types`],EnumTypeDefinition:[`description`,`name`,`directives`,`values`],EnumValueDefinition:[`description`,`name`,`directives`],InputObjectTypeDefinition:[`description`,`name`,`directives`,`fields`],DirectiveDefinition:[`description`,`name`,`arguments`,`locations`],SchemaExtension:[`directives`,`operationTypes`],ScalarTypeExtension:[`name`,`directives`],ObjectTypeExtension:[`name`,`interfaces`,`directives`,`fields`],InterfaceTypeExtension:[`name`,`interfaces`,`directives`,`fields`],UnionTypeExtension:[`name`,`directives`,`types`],EnumTypeExtension:[`name`,`directives`,`values`],InputObjectTypeExtension:[`name`,`directives`,`fields`],TypeCoordinate:[`name`],MemberCoordinate:[`name`,`memberName`],ArgumentCoordinate:[`name`,`fieldName`,`argumentName`],DirectiveCoordinate:[`name`],DirectiveArgumentCoordinate:[`name`,`argumentName`]};e.QueryDocumentKeys=t;let n=new Set(Object.keys(t));function r(e){let t=e?.kind;return typeof t==`string`&&n.has(t)}var i;e.OperationTypeNode=i,(function(e){e.QUERY=`query`,e.MUTATION=`mutation`,e.SUBSCRIPTION=`subscription`})(i||(e.OperationTypeNode=i={}))})),Ni=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DirectiveLocation=void 0;var t;e.DirectiveLocation=t,(function(e){e.QUERY=`QUERY`,e.MUTATION=`MUTATION`,e.SUBSCRIPTION=`SUBSCRIPTION`,e.FIELD=`FIELD`,e.FRAGMENT_DEFINITION=`FRAGMENT_DEFINITION`,e.FRAGMENT_SPREAD=`FRAGMENT_SPREAD`,e.INLINE_FRAGMENT=`INLINE_FRAGMENT`,e.VARIABLE_DEFINITION=`VARIABLE_DEFINITION`,e.SCHEMA=`SCHEMA`,e.SCALAR=`SCALAR`,e.OBJECT=`OBJECT`,e.FIELD_DEFINITION=`FIELD_DEFINITION`,e.ARGUMENT_DEFINITION=`ARGUMENT_DEFINITION`,e.INTERFACE=`INTERFACE`,e.UNION=`UNION`,e.ENUM=`ENUM`,e.ENUM_VALUE=`ENUM_VALUE`,e.INPUT_OBJECT=`INPUT_OBJECT`,e.INPUT_FIELD_DEFINITION=`INPUT_FIELD_DEFINITION`})(t||(e.DirectiveLocation=t={}))})),Pi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isDigit=n,e.isLetter=r,e.isNameContinue=a,e.isNameStart=i,e.isWhiteSpace=t;function t(e){return e===9||e===32}function n(e){return e>=48&&e<=57}function r(e){return e>=97&&e<=122||e>=65&&e<=90}function i(e){return r(e)||e===95}function a(e){return r(e)||n(e)||e===95}})),Fi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringLines=n,e.isPrintableAsBlockString=i,e.printBlockString=a;var t=Pi();function n(e){let t=2**53-1,n=null,i=-1;for(let a=0;a<e.length;++a){let o=e[a],s=r(o);s!==o.length&&(n??=a,i=a,a!==0&&s<t&&(t=s))}return e.map((e,n)=>n===0?e:e.slice(t)).slice(n??0,i+1)}function r(e){let n=0;for(;n<e.length&&(0,t.isWhiteSpace)(e.charCodeAt(n));)++n;return n}function i(e){if(e===``)return!0;let t=!0,n=!1,r=!0,i=!1;for(let a=0;a<e.length;++a)switch(e.codePointAt(a)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:return!1;case 13:return!1;case 10:if(t&&!i)return!1;i=!0,t=!0,n=!1;break;case 9:case 32:n||=t;break;default:r&&=n,t=!1}return!(t||r&&i)}function a(e,n){let r=e.replace(/"""/g,`\\"""`),i=r.split(/\r\n|[\n\r]/g),a=i.length===1,o=i.length>1&&i.slice(1).every(e=>e.length===0||(0,t.isWhiteSpace)(e.charCodeAt(0))),s=r.endsWith(`\\"""`),c=e.endsWith(`"`)&&!s,l=e.endsWith(`\\`),u=c||l,d=!(n!=null&&n.minimize)&&(!a||e.length>70||u||o||s),f=``,p=a&&(0,t.isWhiteSpace)(e.charCodeAt(0));return(d&&!p||o)&&(f+=`
42
+ `+(0,r.printSourceLocation)(this.source,t);return e}toJSON(){let e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}};function a(e){return e===void 0||e.length===0?void 0:e}function o(e){return e.toString()}function s(e){return e.toJSON()}})),Ni=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0;var t;e.Kind=t,(function(e){e.NAME=`Name`,e.DOCUMENT=`Document`,e.OPERATION_DEFINITION=`OperationDefinition`,e.VARIABLE_DEFINITION=`VariableDefinition`,e.SELECTION_SET=`SelectionSet`,e.FIELD=`Field`,e.ARGUMENT=`Argument`,e.FRAGMENT_SPREAD=`FragmentSpread`,e.INLINE_FRAGMENT=`InlineFragment`,e.FRAGMENT_DEFINITION=`FragmentDefinition`,e.VARIABLE=`Variable`,e.INT=`IntValue`,e.FLOAT=`FloatValue`,e.STRING=`StringValue`,e.BOOLEAN=`BooleanValue`,e.NULL=`NullValue`,e.ENUM=`EnumValue`,e.LIST=`ListValue`,e.OBJECT=`ObjectValue`,e.OBJECT_FIELD=`ObjectField`,e.DIRECTIVE=`Directive`,e.NAMED_TYPE=`NamedType`,e.LIST_TYPE=`ListType`,e.NON_NULL_TYPE=`NonNullType`,e.SCHEMA_DEFINITION=`SchemaDefinition`,e.OPERATION_TYPE_DEFINITION=`OperationTypeDefinition`,e.SCALAR_TYPE_DEFINITION=`ScalarTypeDefinition`,e.OBJECT_TYPE_DEFINITION=`ObjectTypeDefinition`,e.FIELD_DEFINITION=`FieldDefinition`,e.INPUT_VALUE_DEFINITION=`InputValueDefinition`,e.INTERFACE_TYPE_DEFINITION=`InterfaceTypeDefinition`,e.UNION_TYPE_DEFINITION=`UnionTypeDefinition`,e.ENUM_TYPE_DEFINITION=`EnumTypeDefinition`,e.ENUM_VALUE_DEFINITION=`EnumValueDefinition`,e.INPUT_OBJECT_TYPE_DEFINITION=`InputObjectTypeDefinition`,e.DIRECTIVE_DEFINITION=`DirectiveDefinition`,e.SCHEMA_EXTENSION=`SchemaExtension`,e.SCALAR_TYPE_EXTENSION=`ScalarTypeExtension`,e.OBJECT_TYPE_EXTENSION=`ObjectTypeExtension`,e.INTERFACE_TYPE_EXTENSION=`InterfaceTypeExtension`,e.UNION_TYPE_EXTENSION=`UnionTypeExtension`,e.ENUM_TYPE_EXTENSION=`EnumTypeExtension`,e.INPUT_OBJECT_TYPE_EXTENSION=`InputObjectTypeExtension`,e.TYPE_COORDINATE=`TypeCoordinate`,e.MEMBER_COORDINATE=`MemberCoordinate`,e.ARGUMENT_COORDINATE=`ArgumentCoordinate`,e.DIRECTIVE_COORDINATE=`DirectiveCoordinate`,e.DIRECTIVE_ARGUMENT_COORDINATE=`DirectiveArgumentCoordinate`})(t||(e.Kind=t={}))})),Pi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.syntaxError=n;var t=Mi();function n(e,n,r){return new t.GraphQLError(`Syntax Error: ${r}`,{source:e,positions:[n]})}})),Fi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.QueryDocumentKeys=e.OperationTypeNode=e.Location=void 0,e.isNode=r,e.Location=class{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return`Location`}toJSON(){return{start:this.start,end:this.end}}},e.Token=class{constructor(e,t,n,r,i,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return`Token`}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}};let t={Name:[],Document:[`definitions`],OperationDefinition:[`description`,`name`,`variableDefinitions`,`directives`,`selectionSet`],VariableDefinition:[`description`,`variable`,`type`,`defaultValue`,`directives`],Variable:[`name`],SelectionSet:[`selections`],Field:[`alias`,`name`,`arguments`,`directives`,`selectionSet`],Argument:[`name`,`value`],FragmentSpread:[`name`,`directives`],InlineFragment:[`typeCondition`,`directives`,`selectionSet`],FragmentDefinition:[`description`,`name`,`variableDefinitions`,`typeCondition`,`directives`,`selectionSet`],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:[`values`],ObjectValue:[`fields`],ObjectField:[`name`,`value`],Directive:[`name`,`arguments`],NamedType:[`name`],ListType:[`type`],NonNullType:[`type`],SchemaDefinition:[`description`,`directives`,`operationTypes`],OperationTypeDefinition:[`type`],ScalarTypeDefinition:[`description`,`name`,`directives`],ObjectTypeDefinition:[`description`,`name`,`interfaces`,`directives`,`fields`],FieldDefinition:[`description`,`name`,`arguments`,`type`,`directives`],InputValueDefinition:[`description`,`name`,`type`,`defaultValue`,`directives`],InterfaceTypeDefinition:[`description`,`name`,`interfaces`,`directives`,`fields`],UnionTypeDefinition:[`description`,`name`,`directives`,`types`],EnumTypeDefinition:[`description`,`name`,`directives`,`values`],EnumValueDefinition:[`description`,`name`,`directives`],InputObjectTypeDefinition:[`description`,`name`,`directives`,`fields`],DirectiveDefinition:[`description`,`name`,`arguments`,`locations`],SchemaExtension:[`directives`,`operationTypes`],ScalarTypeExtension:[`name`,`directives`],ObjectTypeExtension:[`name`,`interfaces`,`directives`,`fields`],InterfaceTypeExtension:[`name`,`interfaces`,`directives`,`fields`],UnionTypeExtension:[`name`,`directives`,`types`],EnumTypeExtension:[`name`,`directives`,`values`],InputObjectTypeExtension:[`name`,`directives`,`fields`],TypeCoordinate:[`name`],MemberCoordinate:[`name`,`memberName`],ArgumentCoordinate:[`name`,`fieldName`,`argumentName`],DirectiveCoordinate:[`name`],DirectiveArgumentCoordinate:[`name`,`argumentName`]};e.QueryDocumentKeys=t;let n=new Set(Object.keys(t));function r(e){let t=e?.kind;return typeof t==`string`&&n.has(t)}var i;e.OperationTypeNode=i,(function(e){e.QUERY=`query`,e.MUTATION=`mutation`,e.SUBSCRIPTION=`subscription`})(i||(e.OperationTypeNode=i={}))})),Ii=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DirectiveLocation=void 0;var t;e.DirectiveLocation=t,(function(e){e.QUERY=`QUERY`,e.MUTATION=`MUTATION`,e.SUBSCRIPTION=`SUBSCRIPTION`,e.FIELD=`FIELD`,e.FRAGMENT_DEFINITION=`FRAGMENT_DEFINITION`,e.FRAGMENT_SPREAD=`FRAGMENT_SPREAD`,e.INLINE_FRAGMENT=`INLINE_FRAGMENT`,e.VARIABLE_DEFINITION=`VARIABLE_DEFINITION`,e.SCHEMA=`SCHEMA`,e.SCALAR=`SCALAR`,e.OBJECT=`OBJECT`,e.FIELD_DEFINITION=`FIELD_DEFINITION`,e.ARGUMENT_DEFINITION=`ARGUMENT_DEFINITION`,e.INTERFACE=`INTERFACE`,e.UNION=`UNION`,e.ENUM=`ENUM`,e.ENUM_VALUE=`ENUM_VALUE`,e.INPUT_OBJECT=`INPUT_OBJECT`,e.INPUT_FIELD_DEFINITION=`INPUT_FIELD_DEFINITION`})(t||(e.DirectiveLocation=t={}))})),Li=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isDigit=n,e.isLetter=r,e.isNameContinue=a,e.isNameStart=i,e.isWhiteSpace=t;function t(e){return e===9||e===32}function n(e){return e>=48&&e<=57}function r(e){return e>=97&&e<=122||e>=65&&e<=90}function i(e){return r(e)||e===95}function a(e){return r(e)||n(e)||e===95}})),Ri=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringLines=n,e.isPrintableAsBlockString=i,e.printBlockString=a;var t=Li();function n(e){let t=2**53-1,n=null,i=-1;for(let a=0;a<e.length;++a){let o=e[a],s=r(o);s!==o.length&&(n??=a,i=a,a!==0&&s<t&&(t=s))}return e.map((e,n)=>n===0?e:e.slice(t)).slice(n??0,i+1)}function r(e){let n=0;for(;n<e.length&&(0,t.isWhiteSpace)(e.charCodeAt(n));)++n;return n}function i(e){if(e===``)return!0;let t=!0,n=!1,r=!0,i=!1;for(let a=0;a<e.length;++a)switch(e.codePointAt(a)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:return!1;case 13:return!1;case 10:if(t&&!i)return!1;i=!0,t=!0,n=!1;break;case 9:case 32:n||=t;break;default:r&&=n,t=!1}return!(t||r&&i)}function a(e,n){let r=e.replace(/"""/g,`\\"""`),i=r.split(/\r\n|[\n\r]/g),a=i.length===1,o=i.length>1&&i.slice(1).every(e=>e.length===0||(0,t.isWhiteSpace)(e.charCodeAt(0))),s=r.endsWith(`\\"""`),c=e.endsWith(`"`)&&!s,l=e.endsWith(`\\`),u=c||l,d=!(n!=null&&n.minimize)&&(!a||e.length>70||u||o||s),f=``,p=a&&(0,t.isWhiteSpace)(e.charCodeAt(0));return(d&&!p||o)&&(f+=`
43
43
  `),f+=r,(d||u)&&(f+=`
44
- `),`"""`+f+`"""`}})),Ii=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TokenKind=void 0;var t;e.TokenKind=t,(function(e){e.SOF=`<SOF>`,e.EOF=`<EOF>`,e.BANG=`!`,e.DOLLAR=`$`,e.AMP=`&`,e.PAREN_L=`(`,e.PAREN_R=`)`,e.DOT=`.`,e.SPREAD=`...`,e.COLON=`:`,e.EQUALS=`=`,e.AT=`@`,e.BRACKET_L=`[`,e.BRACKET_R=`]`,e.BRACE_L=`{`,e.PIPE=`|`,e.BRACE_R=`}`,e.NAME=`Name`,e.INT=`Int`,e.FLOAT=`Float`,e.STRING=`String`,e.BLOCK_STRING=`BlockString`,e.COMMENT=`Comment`})(t||(e.TokenKind=t={}))})),Li=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=void 0,e.createToken=f,e.isPunctuatorTokenKind=o,e.printCodePointAt=d,e.readName=S;var t=ji(),n=Mi(),r=Fi(),i=Pi(),a=Ii();e.Lexer=class{constructor(e){let t=new n.Token(a.TokenKind.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return`Lexer`}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.TokenKind.EOF)do if(e.next)e=e.next;else{let t=p(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===a.TokenKind.COMMENT);return e}};function o(e){return e===a.TokenKind.BANG||e===a.TokenKind.DOLLAR||e===a.TokenKind.AMP||e===a.TokenKind.PAREN_L||e===a.TokenKind.PAREN_R||e===a.TokenKind.DOT||e===a.TokenKind.SPREAD||e===a.TokenKind.COLON||e===a.TokenKind.EQUALS||e===a.TokenKind.AT||e===a.TokenKind.BRACKET_L||e===a.TokenKind.BRACKET_R||e===a.TokenKind.BRACE_L||e===a.TokenKind.PIPE||e===a.TokenKind.BRACE_R}function s(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function c(e,t){return l(e.charCodeAt(t))&&u(e.charCodeAt(t+1))}function l(e){return e>=55296&&e<=56319}function u(e){return e>=56320&&e<=57343}function d(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return a.TokenKind.EOF;if(n>=32&&n<=126){let e=String.fromCodePoint(n);return e===`"`?`'"'`:`"${e}"`}return`U+`+n.toString(16).toUpperCase().padStart(4,`0`)}function f(e,t,r,i,a){let o=e.line,s=1+r-e.lineStart;return new n.Token(t,r,i,o,s,a)}function p(e,n){let r=e.source.body,o=r.length,l=n;for(;l<o;){let n=r.charCodeAt(l);switch(n){case 65279:case 9:case 32:case 44:++l;continue;case 10:++l,++e.line,e.lineStart=l;continue;case 13:r.charCodeAt(l+1)===10?l+=2:++l,++e.line,e.lineStart=l;continue;case 35:return m(e,l);case 33:return f(e,a.TokenKind.BANG,l,l+1);case 36:return f(e,a.TokenKind.DOLLAR,l,l+1);case 38:return f(e,a.TokenKind.AMP,l,l+1);case 40:return f(e,a.TokenKind.PAREN_L,l,l+1);case 41:return f(e,a.TokenKind.PAREN_R,l,l+1);case 46:if(r.charCodeAt(l+1)===46&&r.charCodeAt(l+2)===46)return f(e,a.TokenKind.SPREAD,l,l+3);break;case 58:return f(e,a.TokenKind.COLON,l,l+1);case 61:return f(e,a.TokenKind.EQUALS,l,l+1);case 64:return f(e,a.TokenKind.AT,l,l+1);case 91:return f(e,a.TokenKind.BRACKET_L,l,l+1);case 93:return f(e,a.TokenKind.BRACKET_R,l,l+1);case 123:return f(e,a.TokenKind.BRACE_L,l,l+1);case 124:return f(e,a.TokenKind.PIPE,l,l+1);case 125:return f(e,a.TokenKind.BRACE_R,l,l+1);case 34:return r.charCodeAt(l+1)===34&&r.charCodeAt(l+2)===34?te(e,l):_(e,l)}if((0,i.isDigit)(n)||n===45)return h(e,l,n);if((0,i.isNameStart)(n))return S(e,l);throw(0,t.syntaxError)(e.source,l,n===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:s(n)||c(r,l)?`Unexpected character: ${d(e,l)}.`:`Invalid character: ${d(e,l)}.`)}return f(e,a.TokenKind.EOF,o,o)}function m(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let e=n.charCodeAt(i);if(e===10||e===13)break;if(s(e))++i;else if(c(n,i))i+=2;else break}return f(e,a.TokenKind.COMMENT,t,i,n.slice(t+1,i))}function h(e,n,r){let o=e.source.body,s=n,c=r,l=!1;if(c===45&&(c=o.charCodeAt(++s)),c===48){if(c=o.charCodeAt(++s),(0,i.isDigit)(c))throw(0,t.syntaxError)(e.source,s,`Invalid number, unexpected digit after 0: ${d(e,s)}.`)}else s=g(e,s,c),c=o.charCodeAt(s);if(c===46&&(l=!0,c=o.charCodeAt(++s),s=g(e,s,c),c=o.charCodeAt(s)),(c===69||c===101)&&(l=!0,c=o.charCodeAt(++s),(c===43||c===45)&&(c=o.charCodeAt(++s)),s=g(e,s,c),c=o.charCodeAt(s)),c===46||(0,i.isNameStart)(c))throw(0,t.syntaxError)(e.source,s,`Invalid number, expected digit but got: ${d(e,s)}.`);return f(e,l?a.TokenKind.FLOAT:a.TokenKind.INT,n,s,o.slice(n,s))}function g(e,n,r){if(!(0,i.isDigit)(r))throw(0,t.syntaxError)(e.source,n,`Invalid number, expected digit but got: ${d(e,n)}.`);let a=e.source.body,o=n+1;for(;(0,i.isDigit)(a.charCodeAt(o));)++o;return o}function _(e,n){let r=e.source.body,i=r.length,o=n+1,l=o,u=``;for(;o<i;){let i=r.charCodeAt(o);if(i===34)return u+=r.slice(l,o),f(e,a.TokenKind.STRING,n,o+1,u);if(i===92){u+=r.slice(l,o);let t=r.charCodeAt(o+1)===117?r.charCodeAt(o+2)===123?v(e,o):y(e,o):x(e,o);u+=t.value,o+=t.size,l=o;continue}if(i===10||i===13)break;if(s(i))++o;else if(c(r,o))o+=2;else throw(0,t.syntaxError)(e.source,o,`Invalid character within String: ${d(e,o)}.`)}throw(0,t.syntaxError)(e.source,o,`Unterminated string.`)}function v(e,n){let r=e.source.body,i=0,a=3;for(;a<12;){let e=r.charCodeAt(n+a++);if(e===125){if(a<5||!s(i))break;return{value:String.fromCodePoint(i),size:a}}if(i=i<<4|b(e),i<0)break}throw(0,t.syntaxError)(e.source,n,`Invalid Unicode escape sequence: "${r.slice(n,n+a)}".`)}function y(e,n){let r=e.source.body,i=ee(r,n+2);if(s(i))return{value:String.fromCodePoint(i),size:6};if(l(i)&&r.charCodeAt(n+6)===92&&r.charCodeAt(n+7)===117){let e=ee(r,n+8);if(u(e))return{value:String.fromCodePoint(i,e),size:12}}throw(0,t.syntaxError)(e.source,n,`Invalid Unicode escape sequence: "${r.slice(n,n+6)}".`)}function ee(e,t){return b(e.charCodeAt(t))<<12|b(e.charCodeAt(t+1))<<8|b(e.charCodeAt(t+2))<<4|b(e.charCodeAt(t+3))}function b(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function x(e,n){let r=e.source.body;switch(r.charCodeAt(n+1)){case 34:return{value:`"`,size:2};case 92:return{value:`\\`,size:2};case 47:return{value:`/`,size:2};case 98:return{value:`\b`,size:2};case 102:return{value:`\f`,size:2};case 110:return{value:`
44
+ `),`"""`+f+`"""`}})),zi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TokenKind=void 0;var t;e.TokenKind=t,(function(e){e.SOF=`<SOF>`,e.EOF=`<EOF>`,e.BANG=`!`,e.DOLLAR=`$`,e.AMP=`&`,e.PAREN_L=`(`,e.PAREN_R=`)`,e.DOT=`.`,e.SPREAD=`...`,e.COLON=`:`,e.EQUALS=`=`,e.AT=`@`,e.BRACKET_L=`[`,e.BRACKET_R=`]`,e.BRACE_L=`{`,e.PIPE=`|`,e.BRACE_R=`}`,e.NAME=`Name`,e.INT=`Int`,e.FLOAT=`Float`,e.STRING=`String`,e.BLOCK_STRING=`BlockString`,e.COMMENT=`Comment`})(t||(e.TokenKind=t={}))})),Bi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=void 0,e.createToken=f,e.isPunctuatorTokenKind=o,e.printCodePointAt=d,e.readName=S;var t=Pi(),n=Fi(),r=Ri(),i=Li(),a=zi();e.Lexer=class{constructor(e){let t=new n.Token(a.TokenKind.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return`Lexer`}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.TokenKind.EOF)do if(e.next)e=e.next;else{let t=p(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===a.TokenKind.COMMENT);return e}};function o(e){return e===a.TokenKind.BANG||e===a.TokenKind.DOLLAR||e===a.TokenKind.AMP||e===a.TokenKind.PAREN_L||e===a.TokenKind.PAREN_R||e===a.TokenKind.DOT||e===a.TokenKind.SPREAD||e===a.TokenKind.COLON||e===a.TokenKind.EQUALS||e===a.TokenKind.AT||e===a.TokenKind.BRACKET_L||e===a.TokenKind.BRACKET_R||e===a.TokenKind.BRACE_L||e===a.TokenKind.PIPE||e===a.TokenKind.BRACE_R}function s(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function c(e,t){return l(e.charCodeAt(t))&&u(e.charCodeAt(t+1))}function l(e){return e>=55296&&e<=56319}function u(e){return e>=56320&&e<=57343}function d(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return a.TokenKind.EOF;if(n>=32&&n<=126){let e=String.fromCodePoint(n);return e===`"`?`'"'`:`"${e}"`}return`U+`+n.toString(16).toUpperCase().padStart(4,`0`)}function f(e,t,r,i,a){let o=e.line,s=1+r-e.lineStart;return new n.Token(t,r,i,o,s,a)}function p(e,n){let r=e.source.body,o=r.length,l=n;for(;l<o;){let n=r.charCodeAt(l);switch(n){case 65279:case 9:case 32:case 44:++l;continue;case 10:++l,++e.line,e.lineStart=l;continue;case 13:r.charCodeAt(l+1)===10?l+=2:++l,++e.line,e.lineStart=l;continue;case 35:return m(e,l);case 33:return f(e,a.TokenKind.BANG,l,l+1);case 36:return f(e,a.TokenKind.DOLLAR,l,l+1);case 38:return f(e,a.TokenKind.AMP,l,l+1);case 40:return f(e,a.TokenKind.PAREN_L,l,l+1);case 41:return f(e,a.TokenKind.PAREN_R,l,l+1);case 46:if(r.charCodeAt(l+1)===46&&r.charCodeAt(l+2)===46)return f(e,a.TokenKind.SPREAD,l,l+3);break;case 58:return f(e,a.TokenKind.COLON,l,l+1);case 61:return f(e,a.TokenKind.EQUALS,l,l+1);case 64:return f(e,a.TokenKind.AT,l,l+1);case 91:return f(e,a.TokenKind.BRACKET_L,l,l+1);case 93:return f(e,a.TokenKind.BRACKET_R,l,l+1);case 123:return f(e,a.TokenKind.BRACE_L,l,l+1);case 124:return f(e,a.TokenKind.PIPE,l,l+1);case 125:return f(e,a.TokenKind.BRACE_R,l,l+1);case 34:return r.charCodeAt(l+1)===34&&r.charCodeAt(l+2)===34?te(e,l):_(e,l)}if((0,i.isDigit)(n)||n===45)return h(e,l,n);if((0,i.isNameStart)(n))return S(e,l);throw(0,t.syntaxError)(e.source,l,n===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:s(n)||c(r,l)?`Unexpected character: ${d(e,l)}.`:`Invalid character: ${d(e,l)}.`)}return f(e,a.TokenKind.EOF,o,o)}function m(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let e=n.charCodeAt(i);if(e===10||e===13)break;if(s(e))++i;else if(c(n,i))i+=2;else break}return f(e,a.TokenKind.COMMENT,t,i,n.slice(t+1,i))}function h(e,n,r){let o=e.source.body,s=n,c=r,l=!1;if(c===45&&(c=o.charCodeAt(++s)),c===48){if(c=o.charCodeAt(++s),(0,i.isDigit)(c))throw(0,t.syntaxError)(e.source,s,`Invalid number, unexpected digit after 0: ${d(e,s)}.`)}else s=g(e,s,c),c=o.charCodeAt(s);if(c===46&&(l=!0,c=o.charCodeAt(++s),s=g(e,s,c),c=o.charCodeAt(s)),(c===69||c===101)&&(l=!0,c=o.charCodeAt(++s),(c===43||c===45)&&(c=o.charCodeAt(++s)),s=g(e,s,c),c=o.charCodeAt(s)),c===46||(0,i.isNameStart)(c))throw(0,t.syntaxError)(e.source,s,`Invalid number, expected digit but got: ${d(e,s)}.`);return f(e,l?a.TokenKind.FLOAT:a.TokenKind.INT,n,s,o.slice(n,s))}function g(e,n,r){if(!(0,i.isDigit)(r))throw(0,t.syntaxError)(e.source,n,`Invalid number, expected digit but got: ${d(e,n)}.`);let a=e.source.body,o=n+1;for(;(0,i.isDigit)(a.charCodeAt(o));)++o;return o}function _(e,n){let r=e.source.body,i=r.length,o=n+1,l=o,u=``;for(;o<i;){let i=r.charCodeAt(o);if(i===34)return u+=r.slice(l,o),f(e,a.TokenKind.STRING,n,o+1,u);if(i===92){u+=r.slice(l,o);let t=r.charCodeAt(o+1)===117?r.charCodeAt(o+2)===123?v(e,o):y(e,o):x(e,o);u+=t.value,o+=t.size,l=o;continue}if(i===10||i===13)break;if(s(i))++o;else if(c(r,o))o+=2;else throw(0,t.syntaxError)(e.source,o,`Invalid character within String: ${d(e,o)}.`)}throw(0,t.syntaxError)(e.source,o,`Unterminated string.`)}function v(e,n){let r=e.source.body,i=0,a=3;for(;a<12;){let e=r.charCodeAt(n+a++);if(e===125){if(a<5||!s(i))break;return{value:String.fromCodePoint(i),size:a}}if(i=i<<4|b(e),i<0)break}throw(0,t.syntaxError)(e.source,n,`Invalid Unicode escape sequence: "${r.slice(n,n+a)}".`)}function y(e,n){let r=e.source.body,i=ee(r,n+2);if(s(i))return{value:String.fromCodePoint(i),size:6};if(l(i)&&r.charCodeAt(n+6)===92&&r.charCodeAt(n+7)===117){let e=ee(r,n+8);if(u(e))return{value:String.fromCodePoint(i,e),size:12}}throw(0,t.syntaxError)(e.source,n,`Invalid Unicode escape sequence: "${r.slice(n,n+6)}".`)}function ee(e,t){return b(e.charCodeAt(t))<<12|b(e.charCodeAt(t+1))<<8|b(e.charCodeAt(t+2))<<4|b(e.charCodeAt(t+3))}function b(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function x(e,n){let r=e.source.body;switch(r.charCodeAt(n+1)){case 34:return{value:`"`,size:2};case 92:return{value:`\\`,size:2};case 47:return{value:`/`,size:2};case 98:return{value:`\b`,size:2};case 102:return{value:`\f`,size:2};case 110:return{value:`
45
45
  `,size:2};case 114:return{value:`\r`,size:2};case 116:return{value:` `,size:2}}throw(0,t.syntaxError)(e.source,n,`Invalid character escape sequence: "${r.slice(n,n+2)}".`)}function te(e,n){let i=e.source.body,o=i.length,l=e.lineStart,u=n+3,p=u,m=``,h=[];for(;u<o;){let o=i.charCodeAt(u);if(o===34&&i.charCodeAt(u+1)===34&&i.charCodeAt(u+2)===34){m+=i.slice(p,u),h.push(m);let t=f(e,a.TokenKind.BLOCK_STRING,n,u+3,(0,r.dedentBlockStringLines)(h).join(`
46
- `));return e.line+=h.length-1,e.lineStart=l,t}if(o===92&&i.charCodeAt(u+1)===34&&i.charCodeAt(u+2)===34&&i.charCodeAt(u+3)===34){m+=i.slice(p,u),p=u+1,u+=4;continue}if(o===10||o===13){m+=i.slice(p,u),h.push(m),o===13&&i.charCodeAt(u+1)===10?u+=2:++u,m=``,p=u,l=u;continue}if(s(o))++u;else if(c(i,u))u+=2;else throw(0,t.syntaxError)(e.source,u,`Invalid character within String: ${d(e,u)}.`)}throw(0,t.syntaxError)(e.source,u,`Unterminated string.`)}function S(e,t){let n=e.source.body,r=n.length,o=t+1;for(;o<r;){let e=n.charCodeAt(o);if((0,i.isNameContinue)(e))++o;else break}return f(e,a.TokenKind.NAME,t,o,n.slice(t,o))}})),Ri=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SchemaCoordinateLexer=void 0;var t=ji(),n=Mi(),r=Pi(),i=Li(),a=Ii();e.SchemaCoordinateLexer=class{line=1;lineStart=0;constructor(e){let t=new n.Token(a.TokenKind.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t}get[Symbol.toStringTag](){return`SchemaCoordinateLexer`}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.TokenKind.EOF){let t=o(this,e.end);e.next=t,t.prev=e,e=t}return e}};function o(e,n){let o=e.source.body,s=o.length,c=n;if(c<s){let n=o.charCodeAt(c);switch(n){case 46:return(0,i.createToken)(e,a.TokenKind.DOT,c,c+1);case 40:return(0,i.createToken)(e,a.TokenKind.PAREN_L,c,c+1);case 41:return(0,i.createToken)(e,a.TokenKind.PAREN_R,c,c+1);case 58:return(0,i.createToken)(e,a.TokenKind.COLON,c,c+1);case 64:return(0,i.createToken)(e,a.TokenKind.AT,c,c+1)}if((0,r.isNameStart)(n))return(0,i.readName)(e,c);throw(0,t.syntaxError)(e.source,c,`Invalid character: ${(0,i.printCodePointAt)(e,c)}.`)}return(0,i.createToken)(e,a.TokenKind.EOF,s,s)}})),zi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.devAssert=t;function t(e,t){if(!e)throw Error(t)}})),Bi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inspect=t;function t(e){return n(e,[])}function n(e,t){switch(typeof e){case`string`:return JSON.stringify(e);case`function`:return e.name?`[function ${e.name}]`:`[function]`;case`object`:return r(e,t);default:return String(e)}}function r(e,t){if(e===null)return`null`;if(t.includes(e))return`[Circular]`;let r=[...t,e];if(i(e)){let t=e.toJSON();if(t!==e)return typeof t==`string`?t:n(t,r)}else if(Array.isArray(e))return o(e,r);return a(e,r)}function i(e){return typeof e.toJSON==`function`}function a(e,t){let r=Object.entries(e);return r.length===0?`{}`:t.length>2?`[`+s(e)+`]`:`{ `+r.map(([e,r])=>e+`: `+n(r,t)).join(`, `)+` }`}function o(e,t){if(e.length===0)return`[]`;if(t.length>2)return`[Array]`;let r=Math.min(10,e.length),i=e.length-r,a=[];for(let i=0;i<r;++i)a.push(n(e[i],t));return i===1?a.push(`... 1 more item`):i>1&&a.push(`... ${i} more items`),`[`+a.join(`, `)+`]`}function s(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,``).replace(/]$/,``);if(t===`Object`&&typeof e.constructor==`function`){let t=e.constructor.name;if(typeof t==`string`&&t!==``)return t}return t}})),Vi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.instanceOf=void 0;var t=Bi();e.instanceOf=globalThis.process&&process.env.NODE_ENV===`production`?function(e,t){return e instanceof t}:function(e,n){if(e instanceof n)return!0;if(typeof e==`object`&&e){let r=n.prototype[Symbol.toStringTag];if(r===(Symbol.toStringTag in e?e[Symbol.toStringTag]:e.constructor?.name)){let n=(0,t.inspect)(e);throw Error(`Cannot use ${r} "${n}" from another module or realm.
46
+ `));return e.line+=h.length-1,e.lineStart=l,t}if(o===92&&i.charCodeAt(u+1)===34&&i.charCodeAt(u+2)===34&&i.charCodeAt(u+3)===34){m+=i.slice(p,u),p=u+1,u+=4;continue}if(o===10||o===13){m+=i.slice(p,u),h.push(m),o===13&&i.charCodeAt(u+1)===10?u+=2:++u,m=``,p=u,l=u;continue}if(s(o))++u;else if(c(i,u))u+=2;else throw(0,t.syntaxError)(e.source,u,`Invalid character within String: ${d(e,u)}.`)}throw(0,t.syntaxError)(e.source,u,`Unterminated string.`)}function S(e,t){let n=e.source.body,r=n.length,o=t+1;for(;o<r;){let e=n.charCodeAt(o);if((0,i.isNameContinue)(e))++o;else break}return f(e,a.TokenKind.NAME,t,o,n.slice(t,o))}})),Vi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SchemaCoordinateLexer=void 0;var t=Pi(),n=Fi(),r=Li(),i=Bi(),a=zi();e.SchemaCoordinateLexer=class{line=1;lineStart=0;constructor(e){let t=new n.Token(a.TokenKind.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t}get[Symbol.toStringTag](){return`SchemaCoordinateLexer`}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.TokenKind.EOF){let t=o(this,e.end);e.next=t,t.prev=e,e=t}return e}};function o(e,n){let o=e.source.body,s=o.length,c=n;if(c<s){let n=o.charCodeAt(c);switch(n){case 46:return(0,i.createToken)(e,a.TokenKind.DOT,c,c+1);case 40:return(0,i.createToken)(e,a.TokenKind.PAREN_L,c,c+1);case 41:return(0,i.createToken)(e,a.TokenKind.PAREN_R,c,c+1);case 58:return(0,i.createToken)(e,a.TokenKind.COLON,c,c+1);case 64:return(0,i.createToken)(e,a.TokenKind.AT,c,c+1)}if((0,r.isNameStart)(n))return(0,i.readName)(e,c);throw(0,t.syntaxError)(e.source,c,`Invalid character: ${(0,i.printCodePointAt)(e,c)}.`)}return(0,i.createToken)(e,a.TokenKind.EOF,s,s)}})),Hi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.devAssert=t;function t(e,t){if(!e)throw Error(t)}})),Ui=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inspect=t;function t(e){return n(e,[])}function n(e,t){switch(typeof e){case`string`:return JSON.stringify(e);case`function`:return e.name?`[function ${e.name}]`:`[function]`;case`object`:return r(e,t);default:return String(e)}}function r(e,t){if(e===null)return`null`;if(t.includes(e))return`[Circular]`;let r=[...t,e];if(i(e)){let t=e.toJSON();if(t!==e)return typeof t==`string`?t:n(t,r)}else if(Array.isArray(e))return o(e,r);return a(e,r)}function i(e){return typeof e.toJSON==`function`}function a(e,t){let r=Object.entries(e);return r.length===0?`{}`:t.length>2?`[`+s(e)+`]`:`{ `+r.map(([e,r])=>e+`: `+n(r,t)).join(`, `)+` }`}function o(e,t){if(e.length===0)return`[]`;if(t.length>2)return`[Array]`;let r=Math.min(10,e.length),i=e.length-r,a=[];for(let i=0;i<r;++i)a.push(n(e[i],t));return i===1?a.push(`... 1 more item`):i>1&&a.push(`... ${i} more items`),`[`+a.join(`, `)+`]`}function s(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,``).replace(/]$/,``);if(t===`Object`&&typeof e.constructor==`function`){let t=e.constructor.name;if(typeof t==`string`&&t!==``)return t}return t}})),Wi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.instanceOf=void 0;var t=Ui();e.instanceOf=globalThis.process&&process.env.NODE_ENV===`production`?function(e,t){return e instanceof t}:function(e,n){if(e instanceof n)return!0;if(typeof e==`object`&&e){let r=n.prototype[Symbol.toStringTag];if(r===(Symbol.toStringTag in e?e[Symbol.toStringTag]:e.constructor?.name)){let n=(0,t.inspect)(e);throw Error(`Cannot use ${r} "${n}" from another module or realm.
47
47
 
48
48
  Ensure that there is only one instance of "graphql" in the node_modules
49
49
  directory. If different versions of "graphql" are the dependencies of other
@@ -54,6 +54,6 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
54
54
  Duplicate "graphql" modules cannot be used at the same time since different
55
55
  versions may have different capabilities and behavior. The data from one
56
56
  version used in the function from another could produce confusing and
57
- spurious results.`)}}return!1}})),Hi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Source=void 0,e.isSource=a;var t=zi(),n=Bi(),r=Vi(),i=class{constructor(e,r=`GraphQL request`,i={line:1,column:1}){typeof e==`string`||(0,t.devAssert)(!1,`Body must be a string. Received: ${(0,n.inspect)(e)}.`),this.body=e,this.name=r,this.locationOffset=i,this.locationOffset.line>0||(0,t.devAssert)(!1,`line in locationOffset is 1-indexed and must be positive.`),this.locationOffset.column>0||(0,t.devAssert)(!1,`column in locationOffset is 1-indexed and must be positive.`)}get[Symbol.toStringTag](){return`Source`}};e.Source=i;function a(e){return(0,r.instanceOf)(e,i)}})),Ui=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0,e.parse=c;var t=ji(),n=Mi(),r=Ni(),i=Ai(),a=Li();Ri();var o=Hi(),s=Ii();function c(e,t){let n=new l(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var l=class{constructor(e,t={}){let{lexer:n,...r}=t;if(n)this._lexer=n;else{let t=(0,o.isSource)(e)?e:new o.Source(e);this._lexer=new a.Lexer(t)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let e=this.expectToken(s.TokenKind.NAME);return this.node(e,{kind:i.Kind.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:i.Kind.DOCUMENT,definitions:this.many(s.TokenKind.SOF,this.parseDefinition,s.TokenKind.EOF)})}parseDefinition(){if(this.peek(s.TokenKind.BRACE_L))return this.parseOperationDefinition();let e=this.peekDescription(),n=e?this._lexer.lookahead():this._lexer.token;if(e&&n.kind===s.TokenKind.BRACE_L)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`Unexpected description, descriptions are not supported on shorthand queries.`);if(n.kind===s.TokenKind.NAME){switch(n.value){case`schema`:return this.parseSchemaDefinition();case`scalar`:return this.parseScalarTypeDefinition();case`type`:return this.parseObjectTypeDefinition();case`interface`:return this.parseInterfaceTypeDefinition();case`union`:return this.parseUnionTypeDefinition();case`enum`:return this.parseEnumTypeDefinition();case`input`:return this.parseInputObjectTypeDefinition();case`directive`:return this.parseDirectiveDefinition()}switch(n.value){case`query`:case`mutation`:case`subscription`:return this.parseOperationDefinition();case`fragment`:return this.parseFragmentDefinition()}if(e)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`Unexpected description, only GraphQL definitions support descriptions.`);if(n.value===`extend`)return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let e=this._lexer.token;if(this.peek(s.TokenKind.BRACE_L))return this.node(e,{kind:i.Kind.OPERATION_DEFINITION,operation:n.OperationTypeNode.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let t=this.parseDescription(),r=this.parseOperationType(),a;return this.peek(s.TokenKind.NAME)&&(a=this.parseName()),this.node(e,{kind:i.Kind.OPERATION_DEFINITION,operation:r,description:t,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let e=this.expectToken(s.TokenKind.NAME);switch(e.value){case`query`:return n.OperationTypeNode.QUERY;case`mutation`:return n.OperationTypeNode.MUTATION;case`subscription`:return n.OperationTypeNode.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(s.TokenKind.PAREN_L,this.parseVariableDefinition,s.TokenKind.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:i.Kind.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(s.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(s.TokenKind.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let e=this._lexer.token;return this.expectToken(s.TokenKind.DOLLAR),this.node(e,{kind:i.Kind.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:i.Kind.SELECTION_SET,selections:this.many(s.TokenKind.BRACE_L,this.parseSelection,s.TokenKind.BRACE_R)})}parseSelection(){return this.peek(s.TokenKind.SPREAD)?this.parseFragment():this.parseField()}parseField(){let e=this._lexer.token,t=this.parseName(),n,r;return this.expectOptionalToken(s.TokenKind.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:i.Kind.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(s.TokenKind.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){let t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(s.TokenKind.PAREN_L,t,s.TokenKind.PAREN_R)}parseArgument(e=!1){let t=this._lexer.token,n=this.parseName();return this.expectToken(s.TokenKind.COLON),this.node(t,{kind:i.Kind.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let e=this._lexer.token;this.expectToken(s.TokenKind.SPREAD);let t=this.expectOptionalKeyword(`on`);return!t&&this.peek(s.TokenKind.NAME)?this.node(e,{kind:i.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:i.Kind.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let e=this._lexer.token,t=this.parseDescription();return this.expectKeyword(`fragment`),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:i.Kind.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword(`on`),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:i.Kind.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),typeCondition:(this.expectKeyword(`on`),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value===`on`)throw this.unexpected();return this.parseName()}parseValueLiteral(e){let n=this._lexer.token;switch(n.kind){case s.TokenKind.BRACKET_L:return this.parseList(e);case s.TokenKind.BRACE_L:return this.parseObject(e);case s.TokenKind.INT:return this.advanceLexer(),this.node(n,{kind:i.Kind.INT,value:n.value});case s.TokenKind.FLOAT:return this.advanceLexer(),this.node(n,{kind:i.Kind.FLOAT,value:n.value});case s.TokenKind.STRING:case s.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case s.TokenKind.NAME:switch(this.advanceLexer(),n.value){case`true`:return this.node(n,{kind:i.Kind.BOOLEAN,value:!0});case`false`:return this.node(n,{kind:i.Kind.BOOLEAN,value:!1});case`null`:return this.node(n,{kind:i.Kind.NULL});default:return this.node(n,{kind:i.Kind.ENUM,value:n.value})}case s.TokenKind.DOLLAR:if(e){if(this.expectToken(s.TokenKind.DOLLAR),this._lexer.token.kind===s.TokenKind.NAME){let e=this._lexer.token.value;throw(0,t.syntaxError)(this._lexer.source,n.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(n)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:i.Kind.STRING,value:e.value,block:e.kind===s.TokenKind.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:i.Kind.LIST,values:this.any(s.TokenKind.BRACKET_L,()=>this.parseValueLiteral(e),s.TokenKind.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:i.Kind.OBJECT,fields:this.any(s.TokenKind.BRACE_L,()=>this.parseObjectField(e),s.TokenKind.BRACE_R)})}parseObjectField(e){let t=this._lexer.token,n=this.parseName();return this.expectToken(s.TokenKind.COLON),this.node(t,{kind:i.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){let t=[];for(;this.peek(s.TokenKind.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){let t=this._lexer.token;return this.expectToken(s.TokenKind.AT),this.node(t,{kind:i.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){let e=this._lexer.token,t;if(this.expectOptionalToken(s.TokenKind.BRACKET_L)){let n=this.parseTypeReference();this.expectToken(s.TokenKind.BRACKET_R),t=this.node(e,{kind:i.Kind.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(s.TokenKind.BANG)?this.node(e,{kind:i.Kind.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:i.Kind.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(s.TokenKind.STRING)||this.peek(s.TokenKind.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`schema`);let n=this.parseConstDirectives(),r=this.many(s.TokenKind.BRACE_L,this.parseOperationTypeDefinition,s.TokenKind.BRACE_R);return this.node(e,{kind:i.Kind.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){let e=this._lexer.token,t=this.parseOperationType();this.expectToken(s.TokenKind.COLON);let n=this.parseNamedType();return this.node(e,{kind:i.Kind.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`scalar`);let n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:i.Kind.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`type`);let n=this.parseName(),r=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:i.Kind.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:a,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword(`implements`)?this.delimitedMany(s.TokenKind.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseFieldDefinition,s.TokenKind.BRACE_R)}parseFieldDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(s.TokenKind.COLON);let a=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:i.Kind.FIELD_DEFINITION,description:t,name:n,arguments:r,type:a,directives:o})}parseArgumentDefs(){return this.optionalMany(s.TokenKind.PAREN_L,this.parseInputValueDef,s.TokenKind.PAREN_R)}parseInputValueDef(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(s.TokenKind.COLON);let r=this.parseTypeReference(),a;this.expectOptionalToken(s.TokenKind.EQUALS)&&(a=this.parseConstValueLiteral());let o=this.parseConstDirectives();return this.node(e,{kind:i.Kind.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:a,directives:o})}parseInterfaceTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`interface`);let n=this.parseName(),r=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:i.Kind.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:a,fields:o})}parseUnionTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`union`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseUnionMemberTypes();return this.node(e,{kind:i.Kind.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(s.TokenKind.EQUALS)?this.delimitedMany(s.TokenKind.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`enum`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseEnumValuesDefinition();return this.node(e,{kind:i.Kind.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:a})}parseEnumValuesDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseEnumValueDefinition,s.TokenKind.BRACE_R)}parseEnumValueDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:i.Kind.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if(this._lexer.token.value===`true`||this._lexer.token.value===`false`||this._lexer.token.value===`null`)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`${u(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`input`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseInputFieldsDefinition();return this.node(e,{kind:i.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseInputValueDef,s.TokenKind.BRACE_R)}parseTypeSystemExtension(){let e=this._lexer.lookahead();if(e.kind===s.TokenKind.NAME)switch(e.value){case`schema`:return this.parseSchemaExtension();case`scalar`:return this.parseScalarTypeExtension();case`type`:return this.parseObjectTypeExtension();case`interface`:return this.parseInterfaceTypeExtension();case`union`:return this.parseUnionTypeExtension();case`enum`:return this.parseEnumTypeExtension();case`input`:return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`schema`);let t=this.parseConstDirectives(),n=this.optionalMany(s.TokenKind.BRACE_L,this.parseOperationTypeDefinition,s.TokenKind.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`scalar`);let t=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`type`);let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:a})}parseInterfaceTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`interface`);let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:a})}parseUnionTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`union`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`enum`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`input`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`directive`),this.expectToken(s.TokenKind.AT);let n=this.parseName(),r=this.parseArgumentDefs(),a=this.expectOptionalKeyword(`repeatable`);this.expectKeyword(`on`);let o=this.parseDirectiveLocations();return this.node(e,{kind:i.Kind.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:a,locations:o})}parseDirectiveLocations(){return this.delimitedMany(s.TokenKind.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(r.DirectiveLocation,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){let e=this._lexer.token,t=this.expectOptionalToken(s.TokenKind.AT),n=this.parseName(),r;!t&&this.expectOptionalToken(s.TokenKind.DOT)&&(r=this.parseName());let a;return(t||r)&&this.expectOptionalToken(s.TokenKind.PAREN_L)&&(a=this.parseName(),this.expectToken(s.TokenKind.COLON),this.expectToken(s.TokenKind.PAREN_R)),t?a?this.node(e,{kind:i.Kind.DIRECTIVE_ARGUMENT_COORDINATE,name:n,argumentName:a}):this.node(e,{kind:i.Kind.DIRECTIVE_COORDINATE,name:n}):r?a?this.node(e,{kind:i.Kind.ARGUMENT_COORDINATE,name:n,fieldName:r,argumentName:a}):this.node(e,{kind:i.Kind.MEMBER_COORDINATE,name:n,memberName:r}):this.node(e,{kind:i.Kind.TYPE_COORDINATE,name:n})}node(e,t){return this._options.noLocation!==!0&&(t.loc=new n.Location(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){let n=this._lexer.token;if(n.kind===e)return this.advanceLexer(),n;throw(0,t.syntaxError)(this._lexer.source,n.start,`Expected ${d(e)}, found ${u(n)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){let n=this._lexer.token;if(n.kind===s.TokenKind.NAME&&n.value===e)this.advanceLexer();else throw(0,t.syntaxError)(this._lexer.source,n.start,`Expected "${e}", found ${u(n)}.`)}expectOptionalKeyword(e){let t=this._lexer.token;return t.kind===s.TokenKind.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){let n=e??this._lexer.token;return(0,t.syntaxError)(this._lexer.source,n.start,`Unexpected ${u(n)}.`)}any(e,t,n){this.expectToken(e);let r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){let e=[];do e.push(t.call(this));while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);let n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){let{maxTokens:e}=this._options,n=this._lexer.advance();if(n.kind!==s.TokenKind.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw(0,t.syntaxError)(this._lexer.source,n.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};e.Parser=l;function u(e){let t=e.value;return d(e.kind)+(t==null?``:` "${t}"`)}function d(e){return(0,a.isPunctuatorTokenKind)(e)?`"${e}"`:e}})),Wi=ki(),Gi=Ai(),Ki=Ui();const qi={String:`text`,ID:`text`,OID:`text`,PHID:`text`,OLabel:`text`,URL:`text`,Date:`text`,DateTime:`text`,EmailAddress:`text`,EthereumAddress:`text`,Currency:`text`,Address:`text`,AttachmentRef:`text`,Int:`integer`,Float:`number`,Amount_Money:`number`,Amount_Percentage:`number`,Amount_Tokens:`number`,Boolean:`boolean`,Amount:`object`,Amount_Crypto:`object`,Amount_Currency:`object`,Amount_Fiat:`object`,Unknown:`json`};var Ji=class extends Error{constructor(e){super(`Invalid input SDL: ${e}`),this.name=`SdlSyntaxError`}};function Yi(e){return e.kind===Gi.Kind.NON_NULL_TYPE?{...Yi(e.type),required:!0}:e.kind===Gi.Kind.LIST_TYPE?{name:Yi(e.type).name,list:!0,required:!1}:{name:e.name.value,list:!1,required:!1}}function Xi(e){return(e.fields??[]).filter(e=>e.name.value!==`_`).map(e=>{let t=e.description?.value.replace(/\s+/g,` `);return{name:e.name.value,type:Yi(e.type),...t?{description:t}:{}}})}function Zi(e){let t;try{t=(0,Ki.parse)(e,{noLocation:!0})}catch(e){throw new Ji(e instanceof Wi.GraphQLError?e.message:String(e))}let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map;for(let e of t.definitions)e.kind===Gi.Kind.INPUT_OBJECT_TYPE_DEFINITION?n.set(e.name.value,Xi(e)):e.kind===Gi.Kind.ENUM_TYPE_DEFINITION&&r.set(e.name.value,(e.values??[]).map(e=>e.name.value));return{inputs:n,enums:r}}const Qi=e=>e.replace(/[^A-Za-z0-9]/g,``).toLowerCase();function $i(e,t){let n=`${Qi(e)}input`,r=[...t].filter(e=>Qi(e)===n);return r.length===1?r[0]:void 0}function ea(e,t){let{inputs:n,enums:r}=Zi(e),i=$i(t,n.keys()),a=i?n.get(i):void 0;return i&&a?{rootName:i,root:a,inputs:n,enums:r}:null}function ta(e,t){return t.inputs.has(e.name)?`object`:t.enums.has(e.name)?`enum`:qi[e.name]??`unsupported`}function na(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).toLowerCase().trim();return t.charAt(0).toUpperCase()+t.slice(1)}function ra(e,t){let n={displayName:na(e.name),required:e.type.required,...e.description?{description:e.description}:{}};if(e.type.list)return Y.Json({...n,description:e.description??`A JSON list`});switch(ta(e.type,t)){case`text`:return Y.ShortText(n);case`integer`:case`number`:return Y.ShortText({...n,description:e.description??`A number`});case`boolean`:return Y.StaticDropdown({...n,options:{options:[{label:`Yes`,value:!0},{label:`No`,value:!1}]}});case`enum`:return Y.StaticDropdown({...n,options:{options:(t.enums.get(e.type.name)??[]).map(e=>({label:na(e),value:e}))}});case`unsupported`:return Y.Json({...n,description:`Type ${e.type.name} is not supported by this form`});default:return Y.Json(n)}}function ia(e){let t={};for(let n of e.root)t[n.name]=ra(n,e);return t}function aa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const oa=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function sa(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?`${t.slice(0,57)}...`:t}function ca(e,t,n){let r=t=>/* @__PURE__ */ Error(`input "${e.name}" (${e.type.name}) expects ${t}; got ${sa(n)}`);if(e.type.list){if(!Array.isArray(n))throw r(`a list`);return n}switch(t){case`text`:case`enum`:if(typeof n!=`string`)throw r(`text`);return n;case`integer`:case`number`:{let e=typeof n==`number`?n:typeof n==`string`&&oa.test(n.trim())?Number(n.trim()):NaN;if(!Number.isFinite(e))throw r(`a number`);if(t===`integer`&&!Number.isInteger(e))throw r(`an integer`);return e}case`boolean`:if(typeof n==`boolean`)return n;if(n===`true`||n===`false`)return n===`true`;throw r(`true or false`);case`object`:if(!aa(n))throw r(`an object`);return n;case`json`:return n;case`unsupported`:throw Error(`input "${e.name}" has type ${e.type.name}, which this piece cannot map`)}}function la(e,t){let n=t??{};if(!aa(n))throw Error(`"input" must be an object; got ${sa(n)}`);let r={};for(let t of e.root){let i=n[t.name];i!=null&&i!==``&&(r[t.name]=ca(t,ta(t.type,e),i))}return r}const ua=[{label:`Exact`,value:`exact`},{label:`Extract from AI output`,value:`extract`}];function da(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fa(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?`${t.slice(0,57)}...`:t}function pa(e){return e.trim().replace(/^```(?:json)?\s*/i,``).replace(/```$/,``).trim()}function ma(e){let t=[],n=0,r=-1,i=!1,a=!1;for(let o=0;o<e.length;o++){let s=e[o];if(i){a?a=!1:s===`\\`?a=!0:s===`"`&&(i=!1);continue}if(s===`"`){i=!0;continue}if(s===`{`||s===`[`){n===0&&(r=o),n++;continue}if(s===`}`||s===`]`){if(n===0)continue;n--,n===0&&r>=0&&(t.push(e.slice(r,o+1)),r=-1)}}return t}function ha(e){let t=pa(e);try{return JSON.parse(t)}catch{}let n=ma(t);for(let e=n.length-1;e>=0;e--)try{return JSON.parse(n[e])}catch{}throw SyntaxError(`no JSON value found`)}const ga=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,_a=/(?<![A-Za-z0-9_-])[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/;function va(e){let t=ga.exec(e)??_a.exec(e);return t?t[0]:e.trim().replace(/^["'`]+|["'`]+$/g,``).trim()||void 0}const ya=`set "Parse" to "Extract from AI output" to read one out of text`;var ba=class e{block;mode;extractedFrom={};constructor(e,t){this.block=e,this.mode=t}static of(t,n){if(n==null||n===``)return new e(t,`exact`);if(n!==`exact`&&n!==`extract`)throw Error(`${t}: "parse" must be "exact" or "extract"`);return new e(t,n)}get extract(){return this.mode===`extract`}documentId(e,t){if(e!=null&&e!==``){if(typeof e!=`string`)throw Error(`${this.block}: "${t}" must be a document id; got ${fa(e)}`);if(this.extract){let n=va(e);return n!==void 0&&n!==e&&(this.extractedFrom[t]=e),n}if(!/^[^\s"'`]+$/.test(e))throw Error(`${this.block}: "${t}" is not a document id: ${fa(e)}; ${ya}`);return e}}json(e,t){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch(e){if(!this.extract){let n=e instanceof Error?e.message:String(e);throw Error(`${this.block}: "${t}" is not valid JSON (${n}); ${ya}`,{cause:e})}}try{let n=ha(e);return this.extractedFrom[t]=e,n}catch{throw Error(`${this.block}: "${t}" holds no JSON value`)}}output(){return Object.keys(this.extractedFrom).length?{extractedFrom:this.extractedFrom}:{}}};function xa(e,t,n){return e.map((e,r)=>{if(!da(e)||typeof e.type!=`string`)throw Error(`${t.block}: ${n}[${r}] needs a string "type"`);if(e.scope!==void 0&&typeof e.scope!=`string`)throw Error(`${t.block}: ${n}[${r}].scope must be a string`);return{type:e.type,input:e.input,scope:e.scope}})}function Sa(e,t,n=`actions`){if(e==null||e===``)return{actions:[]};let r=t.json(e,n);if(Array.isArray(r))return{actions:xa(r,t,n)};if(da(r)){if(Array.isArray(r.actions))return{documentId:t.documentId(r.documentId,`${n}.documentId`),actions:xa(r.actions,t,n)};if(t.extract&&typeof r.type==`string`)return{actions:xa([r],t,n)}}throw Error(`${t.block}: "${n}" must be a list of actions or an object with an "actions" list; got ${fa(r)}`)}function Ca(e,t,n=`actions`){return Sa(e,t,n).actions}function wa(e,t){if(e==null||e===``)return{};let n=t.json(e,`payload`);if(!da(n))throw Error(`${t.block}: "payload" must be an object; got ${fa(n)}`);for(let e of[`documentType`,`name`])if(n[e]!==void 0&&typeof n[e]!=`string`)throw Error(`${t.block}: "payload.${e}" must be a string`);return{documentType:n.documentType,name:n.name,actions:n.actions}}function Ta(e,t){if(e==null||e===``)return{};let n=t.json(e,`input`);if(!da(n))throw Error(`${t.block}: "input" must be an object; got ${fa(n)}`);return n}function Ea(e){let t=typeof e==`string`?e.split(`,`):e;return Array.isArray(t)?t.map(e=>{if(typeof e==`string`)return e;let t=e;return typeof t?.type==`string`?t.type:``}).map(e=>e.trim()).filter(Boolean):[]}function Da(e){if(typeof e!=`string`)return;let t=e.trim();if(t&&!t.includes(`{{`))return t}function Oa(e){let t=e?.nodes;return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function ka(e){let t=Oa(e).filter(e=>e.kind===`folder`),n=new Map(t.map(e=>[e.id,e])),r=e=>{let t=[],r=/* @__PURE__ */ new Set,i=e;for(;i&&!r.has(i.id);)r.add(i.id),t.unshift(i.name||`(unnamed)`),i=i.parentFolder?n.get(i.parentFolder):void 0;return t.join(` / `)};return t.map(e=>({label:r(e),value:e.id})).sort((e,t)=>e.label.localeCompare(t.label))}const Aa=/\b(?:input|enum|type)\s+(\w+)/g,ja=/* @__PURE__ */ new Set([`String`,`Int`,`Float`,`Boolean`,`ID`]);function Ma(e,t,n){return RegExp(`${t}\\s+${n}\\s*\\{[^}]*\\}`).exec(e)?.[0]??null}function Na(e,t){if(!t)return e;let n=new Set([...e.matchAll(Aa)].map(e=>e[1])),r=[...new Set([...e.matchAll(/:\s*\[?\s*(\w+)/g)].map(e=>e[1]).filter(e=>!n.has(e)&&!ja.has(e)))].map(e=>Ma(t,`enum`,e)).filter(e=>e!==null);return r.length?`${e}\n\n${r.join(`
57
+ spurious results.`)}}return!1}})),Gi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Source=void 0,e.isSource=a;var t=Hi(),n=Ui(),r=Wi(),i=class{constructor(e,r=`GraphQL request`,i={line:1,column:1}){typeof e==`string`||(0,t.devAssert)(!1,`Body must be a string. Received: ${(0,n.inspect)(e)}.`),this.body=e,this.name=r,this.locationOffset=i,this.locationOffset.line>0||(0,t.devAssert)(!1,`line in locationOffset is 1-indexed and must be positive.`),this.locationOffset.column>0||(0,t.devAssert)(!1,`column in locationOffset is 1-indexed and must be positive.`)}get[Symbol.toStringTag](){return`Source`}};e.Source=i;function a(e){return(0,r.instanceOf)(e,i)}})),Ki=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0,e.parse=c;var t=Pi(),n=Fi(),r=Ii(),i=Ni(),a=Bi();Vi();var o=Gi(),s=zi();function c(e,t){let n=new l(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var l=class{constructor(e,t={}){let{lexer:n,...r}=t;if(n)this._lexer=n;else{let t=(0,o.isSource)(e)?e:new o.Source(e);this._lexer=new a.Lexer(t)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let e=this.expectToken(s.TokenKind.NAME);return this.node(e,{kind:i.Kind.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:i.Kind.DOCUMENT,definitions:this.many(s.TokenKind.SOF,this.parseDefinition,s.TokenKind.EOF)})}parseDefinition(){if(this.peek(s.TokenKind.BRACE_L))return this.parseOperationDefinition();let e=this.peekDescription(),n=e?this._lexer.lookahead():this._lexer.token;if(e&&n.kind===s.TokenKind.BRACE_L)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`Unexpected description, descriptions are not supported on shorthand queries.`);if(n.kind===s.TokenKind.NAME){switch(n.value){case`schema`:return this.parseSchemaDefinition();case`scalar`:return this.parseScalarTypeDefinition();case`type`:return this.parseObjectTypeDefinition();case`interface`:return this.parseInterfaceTypeDefinition();case`union`:return this.parseUnionTypeDefinition();case`enum`:return this.parseEnumTypeDefinition();case`input`:return this.parseInputObjectTypeDefinition();case`directive`:return this.parseDirectiveDefinition()}switch(n.value){case`query`:case`mutation`:case`subscription`:return this.parseOperationDefinition();case`fragment`:return this.parseFragmentDefinition()}if(e)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`Unexpected description, only GraphQL definitions support descriptions.`);if(n.value===`extend`)return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let e=this._lexer.token;if(this.peek(s.TokenKind.BRACE_L))return this.node(e,{kind:i.Kind.OPERATION_DEFINITION,operation:n.OperationTypeNode.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let t=this.parseDescription(),r=this.parseOperationType(),a;return this.peek(s.TokenKind.NAME)&&(a=this.parseName()),this.node(e,{kind:i.Kind.OPERATION_DEFINITION,operation:r,description:t,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let e=this.expectToken(s.TokenKind.NAME);switch(e.value){case`query`:return n.OperationTypeNode.QUERY;case`mutation`:return n.OperationTypeNode.MUTATION;case`subscription`:return n.OperationTypeNode.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(s.TokenKind.PAREN_L,this.parseVariableDefinition,s.TokenKind.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:i.Kind.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(s.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(s.TokenKind.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let e=this._lexer.token;return this.expectToken(s.TokenKind.DOLLAR),this.node(e,{kind:i.Kind.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:i.Kind.SELECTION_SET,selections:this.many(s.TokenKind.BRACE_L,this.parseSelection,s.TokenKind.BRACE_R)})}parseSelection(){return this.peek(s.TokenKind.SPREAD)?this.parseFragment():this.parseField()}parseField(){let e=this._lexer.token,t=this.parseName(),n,r;return this.expectOptionalToken(s.TokenKind.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:i.Kind.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(s.TokenKind.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){let t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(s.TokenKind.PAREN_L,t,s.TokenKind.PAREN_R)}parseArgument(e=!1){let t=this._lexer.token,n=this.parseName();return this.expectToken(s.TokenKind.COLON),this.node(t,{kind:i.Kind.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let e=this._lexer.token;this.expectToken(s.TokenKind.SPREAD);let t=this.expectOptionalKeyword(`on`);return!t&&this.peek(s.TokenKind.NAME)?this.node(e,{kind:i.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:i.Kind.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let e=this._lexer.token,t=this.parseDescription();return this.expectKeyword(`fragment`),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:i.Kind.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword(`on`),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:i.Kind.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),typeCondition:(this.expectKeyword(`on`),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value===`on`)throw this.unexpected();return this.parseName()}parseValueLiteral(e){let n=this._lexer.token;switch(n.kind){case s.TokenKind.BRACKET_L:return this.parseList(e);case s.TokenKind.BRACE_L:return this.parseObject(e);case s.TokenKind.INT:return this.advanceLexer(),this.node(n,{kind:i.Kind.INT,value:n.value});case s.TokenKind.FLOAT:return this.advanceLexer(),this.node(n,{kind:i.Kind.FLOAT,value:n.value});case s.TokenKind.STRING:case s.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case s.TokenKind.NAME:switch(this.advanceLexer(),n.value){case`true`:return this.node(n,{kind:i.Kind.BOOLEAN,value:!0});case`false`:return this.node(n,{kind:i.Kind.BOOLEAN,value:!1});case`null`:return this.node(n,{kind:i.Kind.NULL});default:return this.node(n,{kind:i.Kind.ENUM,value:n.value})}case s.TokenKind.DOLLAR:if(e){if(this.expectToken(s.TokenKind.DOLLAR),this._lexer.token.kind===s.TokenKind.NAME){let e=this._lexer.token.value;throw(0,t.syntaxError)(this._lexer.source,n.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(n)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:i.Kind.STRING,value:e.value,block:e.kind===s.TokenKind.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:i.Kind.LIST,values:this.any(s.TokenKind.BRACKET_L,()=>this.parseValueLiteral(e),s.TokenKind.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:i.Kind.OBJECT,fields:this.any(s.TokenKind.BRACE_L,()=>this.parseObjectField(e),s.TokenKind.BRACE_R)})}parseObjectField(e){let t=this._lexer.token,n=this.parseName();return this.expectToken(s.TokenKind.COLON),this.node(t,{kind:i.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){let t=[];for(;this.peek(s.TokenKind.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){let t=this._lexer.token;return this.expectToken(s.TokenKind.AT),this.node(t,{kind:i.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){let e=this._lexer.token,t;if(this.expectOptionalToken(s.TokenKind.BRACKET_L)){let n=this.parseTypeReference();this.expectToken(s.TokenKind.BRACKET_R),t=this.node(e,{kind:i.Kind.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(s.TokenKind.BANG)?this.node(e,{kind:i.Kind.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:i.Kind.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(s.TokenKind.STRING)||this.peek(s.TokenKind.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`schema`);let n=this.parseConstDirectives(),r=this.many(s.TokenKind.BRACE_L,this.parseOperationTypeDefinition,s.TokenKind.BRACE_R);return this.node(e,{kind:i.Kind.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){let e=this._lexer.token,t=this.parseOperationType();this.expectToken(s.TokenKind.COLON);let n=this.parseNamedType();return this.node(e,{kind:i.Kind.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`scalar`);let n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:i.Kind.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`type`);let n=this.parseName(),r=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:i.Kind.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:a,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword(`implements`)?this.delimitedMany(s.TokenKind.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseFieldDefinition,s.TokenKind.BRACE_R)}parseFieldDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(s.TokenKind.COLON);let a=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:i.Kind.FIELD_DEFINITION,description:t,name:n,arguments:r,type:a,directives:o})}parseArgumentDefs(){return this.optionalMany(s.TokenKind.PAREN_L,this.parseInputValueDef,s.TokenKind.PAREN_R)}parseInputValueDef(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(s.TokenKind.COLON);let r=this.parseTypeReference(),a;this.expectOptionalToken(s.TokenKind.EQUALS)&&(a=this.parseConstValueLiteral());let o=this.parseConstDirectives();return this.node(e,{kind:i.Kind.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:a,directives:o})}parseInterfaceTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`interface`);let n=this.parseName(),r=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:i.Kind.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:a,fields:o})}parseUnionTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`union`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseUnionMemberTypes();return this.node(e,{kind:i.Kind.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(s.TokenKind.EQUALS)?this.delimitedMany(s.TokenKind.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`enum`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseEnumValuesDefinition();return this.node(e,{kind:i.Kind.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:a})}parseEnumValuesDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseEnumValueDefinition,s.TokenKind.BRACE_R)}parseEnumValueDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:i.Kind.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if(this._lexer.token.value===`true`||this._lexer.token.value===`false`||this._lexer.token.value===`null`)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`${u(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`input`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseInputFieldsDefinition();return this.node(e,{kind:i.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseInputValueDef,s.TokenKind.BRACE_R)}parseTypeSystemExtension(){let e=this._lexer.lookahead();if(e.kind===s.TokenKind.NAME)switch(e.value){case`schema`:return this.parseSchemaExtension();case`scalar`:return this.parseScalarTypeExtension();case`type`:return this.parseObjectTypeExtension();case`interface`:return this.parseInterfaceTypeExtension();case`union`:return this.parseUnionTypeExtension();case`enum`:return this.parseEnumTypeExtension();case`input`:return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`schema`);let t=this.parseConstDirectives(),n=this.optionalMany(s.TokenKind.BRACE_L,this.parseOperationTypeDefinition,s.TokenKind.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`scalar`);let t=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`type`);let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:a})}parseInterfaceTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`interface`);let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:a})}parseUnionTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`union`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`enum`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`input`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`directive`),this.expectToken(s.TokenKind.AT);let n=this.parseName(),r=this.parseArgumentDefs(),a=this.expectOptionalKeyword(`repeatable`);this.expectKeyword(`on`);let o=this.parseDirectiveLocations();return this.node(e,{kind:i.Kind.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:a,locations:o})}parseDirectiveLocations(){return this.delimitedMany(s.TokenKind.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(r.DirectiveLocation,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){let e=this._lexer.token,t=this.expectOptionalToken(s.TokenKind.AT),n=this.parseName(),r;!t&&this.expectOptionalToken(s.TokenKind.DOT)&&(r=this.parseName());let a;return(t||r)&&this.expectOptionalToken(s.TokenKind.PAREN_L)&&(a=this.parseName(),this.expectToken(s.TokenKind.COLON),this.expectToken(s.TokenKind.PAREN_R)),t?a?this.node(e,{kind:i.Kind.DIRECTIVE_ARGUMENT_COORDINATE,name:n,argumentName:a}):this.node(e,{kind:i.Kind.DIRECTIVE_COORDINATE,name:n}):r?a?this.node(e,{kind:i.Kind.ARGUMENT_COORDINATE,name:n,fieldName:r,argumentName:a}):this.node(e,{kind:i.Kind.MEMBER_COORDINATE,name:n,memberName:r}):this.node(e,{kind:i.Kind.TYPE_COORDINATE,name:n})}node(e,t){return this._options.noLocation!==!0&&(t.loc=new n.Location(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){let n=this._lexer.token;if(n.kind===e)return this.advanceLexer(),n;throw(0,t.syntaxError)(this._lexer.source,n.start,`Expected ${d(e)}, found ${u(n)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){let n=this._lexer.token;if(n.kind===s.TokenKind.NAME&&n.value===e)this.advanceLexer();else throw(0,t.syntaxError)(this._lexer.source,n.start,`Expected "${e}", found ${u(n)}.`)}expectOptionalKeyword(e){let t=this._lexer.token;return t.kind===s.TokenKind.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){let n=e??this._lexer.token;return(0,t.syntaxError)(this._lexer.source,n.start,`Unexpected ${u(n)}.`)}any(e,t,n){this.expectToken(e);let r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){let e=[];do e.push(t.call(this));while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);let n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){let{maxTokens:e}=this._options,n=this._lexer.advance();if(n.kind!==s.TokenKind.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw(0,t.syntaxError)(this._lexer.source,n.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};e.Parser=l;function u(e){let t=e.value;return d(e.kind)+(t==null?``:` "${t}"`)}function d(e){return(0,a.isPunctuatorTokenKind)(e)?`"${e}"`:e}})),qi=Mi(),Ji=Ni(),Yi=Ki();const Xi={String:`text`,ID:`text`,OID:`text`,PHID:`text`,OLabel:`text`,URL:`text`,Date:`text`,DateTime:`text`,EmailAddress:`text`,EthereumAddress:`text`,Currency:`text`,Address:`text`,AttachmentRef:`text`,Int:`integer`,Float:`number`,Amount_Money:`number`,Amount_Percentage:`number`,Amount_Tokens:`number`,Boolean:`boolean`,Amount:`object`,Amount_Crypto:`object`,Amount_Currency:`object`,Amount_Fiat:`object`,Unknown:`json`};var Zi=class extends Error{constructor(e){super(`Invalid input SDL: ${e}`),this.name=`SdlSyntaxError`}};function Qi(e){return e.kind===Ji.Kind.NON_NULL_TYPE?{...Qi(e.type),required:!0}:e.kind===Ji.Kind.LIST_TYPE?{name:Qi(e.type).name,list:!0,required:!1}:{name:e.name.value,list:!1,required:!1}}function $i(e){return(e.fields??[]).filter(e=>e.name.value!==`_`).map(e=>{let t=e.description?.value.replace(/\s+/g,` `);return{name:e.name.value,type:Qi(e.type),...t?{description:t}:{}}})}function ea(e){let t;try{t=(0,Yi.parse)(e,{noLocation:!0})}catch(e){throw new Zi(e instanceof qi.GraphQLError?e.message:String(e))}let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map;for(let e of t.definitions)e.kind===Ji.Kind.INPUT_OBJECT_TYPE_DEFINITION?n.set(e.name.value,$i(e)):e.kind===Ji.Kind.ENUM_TYPE_DEFINITION&&r.set(e.name.value,(e.values??[]).map(e=>e.name.value));return{inputs:n,enums:r}}const ta=e=>e.replace(/[^A-Za-z0-9]/g,``).toLowerCase();function na(e,t){let n=`${ta(e)}input`,r=[...t].filter(e=>ta(e)===n);return r.length===1?r[0]:void 0}function ra(e,t){let{inputs:n,enums:r}=ea(e),i=na(t,n.keys()),a=i?n.get(i):void 0;return i&&a?{rootName:i,root:a,inputs:n,enums:r}:null}function ia(e,t){return t.inputs.has(e.name)?`object`:t.enums.has(e.name)?`enum`:Xi[e.name]??`unsupported`}function aa(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).toLowerCase().trim();return t.charAt(0).toUpperCase()+t.slice(1)}function oa(e,t){let n={displayName:aa(e.name),required:e.type.required,...e.description?{description:e.description}:{}};if(e.type.list)return Y.Json({...n,description:e.description??`A JSON list`});switch(ia(e.type,t)){case`text`:return Y.ShortText(n);case`integer`:case`number`:return Y.ShortText({...n,description:e.description??`A number`});case`boolean`:return Y.StaticDropdown({...n,options:{options:[{label:`Yes`,value:!0},{label:`No`,value:!1}]}});case`enum`:return Y.StaticDropdown({...n,options:{options:(t.enums.get(e.type.name)??[]).map(e=>({label:aa(e),value:e}))}});case`unsupported`:return Y.Json({...n,description:`Type ${e.type.name} is not supported by this form`});default:return Y.Json(n)}}function sa(e){let t={};for(let n of e.root)t[n.name]=oa(n,e);return t}const ca=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function la(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?`${t.slice(0,57)}...`:t}function ua(e,t,n){let r=t=>/* @__PURE__ */ Error(`input "${e.name}" (${e.type.name}) expects ${t}; got ${la(n)}`);if(e.type.list){if(!Array.isArray(n))throw r(`a list`);return n}switch(t){case`text`:case`enum`:if(typeof n!=`string`)throw r(`text`);return n;case`integer`:case`number`:{let e=typeof n==`number`?n:typeof n==`string`&&ca.test(n.trim())?Number(n.trim()):NaN;if(!Number.isFinite(e))throw r(`a number`);if(t===`integer`&&!Number.isInteger(e))throw r(`an integer`);return e}case`boolean`:if(typeof n==`boolean`)return n;if(n===`true`||n===`false`)return n===`true`;throw r(`true or false`);case`object`:if(!xi(n))throw r(`an object`);return n;case`json`:return n;case`unsupported`:throw Error(`input "${e.name}" has type ${e.type.name}, which this piece cannot map`)}}function da(e,t){let n=t??{};if(!xi(n))throw Error(`"input" must be an object; got ${la(n)}`);let r={};for(let t of e.root){let i=n[t.name];i!=null&&i!==``&&(r[t.name]=ua(t,ia(t.type,e),i))}return r}const fa=[{label:`Exact`,value:`exact`},{label:`Extract from AI output`,value:`extract`}];function pa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ma(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?`${t.slice(0,57)}...`:t}function ha(e){return e.trim().replace(/^```(?:json)?\s*/i,``).replace(/```$/,``).trim()}function ga(e){let t=[],n=0,r=-1,i=!1,a=!1;for(let o=0;o<e.length;o++){let s=e[o];if(i){a?a=!1:s===`\\`?a=!0:s===`"`&&(i=!1);continue}if(s===`"`){i=!0;continue}if(s===`{`||s===`[`){n===0&&(r=o),n++;continue}if(s===`}`||s===`]`){if(n===0)continue;n--,n===0&&r>=0&&(t.push(e.slice(r,o+1)),r=-1)}}return t}function _a(e){let t=ha(e);try{return JSON.parse(t)}catch{}let n=ga(t);for(let e=n.length-1;e>=0;e--)try{return JSON.parse(n[e])}catch{}throw SyntaxError(`no JSON value found`)}const va=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,ya=/(?<![A-Za-z0-9_-])[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/;function ba(e){let t=va.exec(e)??ya.exec(e);return t?t[0]:e.trim().replace(/^["'`]+|["'`]+$/g,``).trim()||void 0}const xa=`set "Parse" to "Extract from AI output" to read one out of text`;var Sa=class e{block;mode;extractedFrom={};constructor(e,t){this.block=e,this.mode=t}static of(t,n){if(n==null||n===``)return new e(t,`exact`);if(n!==`exact`&&n!==`extract`)throw Error(`${t}: "parse" must be "exact" or "extract"`);return new e(t,n)}get extract(){return this.mode===`extract`}documentId(e,t){if(e!=null&&e!==``){if(typeof e!=`string`)throw Error(`${this.block}: "${t}" must be a document id; got ${ma(e)}`);if(this.extract){let n=ba(e);return n!==void 0&&n!==e&&(this.extractedFrom[t]=e),n}if(!/^[^\s"'`]+$/.test(e))throw Error(`${this.block}: "${t}" is not a document id: ${ma(e)}; ${xa}`);return e}}json(e,t){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch(e){if(!this.extract){let n=e instanceof Error?e.message:String(e);throw Error(`${this.block}: "${t}" is not valid JSON (${n}); ${xa}`,{cause:e})}}try{let n=_a(e);return this.extractedFrom[t]=e,n}catch{throw Error(`${this.block}: "${t}" holds no JSON value`)}}output(){return Object.keys(this.extractedFrom).length?{extractedFrom:this.extractedFrom}:{}}};function Ca(e,t,n){return e.map((e,r)=>{if(!pa(e)||typeof e.type!=`string`)throw Error(`${t.block}: ${n}[${r}] needs a string "type"`);if(e.scope!==void 0&&typeof e.scope!=`string`)throw Error(`${t.block}: ${n}[${r}].scope must be a string`);return{type:e.type,input:e.input,scope:e.scope}})}function wa(e,t,n=`actions`){if(e==null||e===``)return{actions:[]};let r=t.json(e,n);if(Array.isArray(r))return{actions:Ca(r,t,n)};if(pa(r)){if(Array.isArray(r.actions))return{documentId:t.documentId(r.documentId,`${n}.documentId`),actions:Ca(r.actions,t,n)};if(t.extract&&typeof r.type==`string`)return{actions:Ca([r],t,n)}}throw Error(`${t.block}: "${n}" must be a list of actions or an object with an "actions" list; got ${ma(r)}`)}function Ta(e,t,n=`actions`){return wa(e,t,n).actions}function Ea(e,t){if(e==null||e===``)return{};let n=t.json(e,`payload`);if(!pa(n))throw Error(`${t.block}: "payload" must be an object; got ${ma(n)}`);for(let e of[`documentType`,`name`])if(n[e]!==void 0&&typeof n[e]!=`string`)throw Error(`${t.block}: "payload.${e}" must be a string`);return{documentType:n.documentType,name:n.name,actions:n.actions}}function Da(e,t){if(e==null||e===``)return{};let n=t.json(e,`input`);if(!pa(n))throw Error(`${t.block}: "input" must be an object; got ${ma(n)}`);return n}function Oa(e){let t=typeof e==`string`?e.split(`,`):e;return Array.isArray(t)?t.map(e=>{if(typeof e==`string`)return e;let t=e;return typeof t?.type==`string`?t.type:``}).map(e=>e.trim()).filter(Boolean):[]}function ka(e){if(typeof e!=`string`)return;let t=e.trim();if(t&&!t.includes(`{{`))return t}function Aa(e){let t=e?.nodes;return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function ja(e){let t=Aa(e).filter(e=>e.kind===`folder`),n=new Map(t.map(e=>[e.id,e])),r=e=>{let t=[],r=/* @__PURE__ */ new Set,i=e;for(;i&&!r.has(i.id);)r.add(i.id),t.unshift(i.name||`(unnamed)`),i=i.parentFolder?n.get(i.parentFolder):void 0;return t.join(` / `)};return t.map(e=>({label:r(e),value:e.id})).sort((e,t)=>e.label.localeCompare(t.label))}const Ma=/\b(?:input|enum|type)\s+(\w+)/g,Na=/* @__PURE__ */ new Set([`String`,`Int`,`Float`,`Boolean`,`ID`]);function Pa(e,t,n){return RegExp(`${t}\\s+${n}\\s*\\{[^}]*\\}`).exec(e)?.[0]??null}function Fa(e,t){if(!t)return e;let n=new Set([...e.matchAll(Ma)].map(e=>e[1])),r=[...new Set([...e.matchAll(/:\s*\[?\s*(\w+)/g)].map(e=>e[1]).filter(e=>!n.has(e)&&!Na.has(e)))].map(e=>Pa(t,`enum`,e)).filter(e=>e!==null);return r.length?`${e}\n\n${r.join(`
58
58
 
59
- `)}`:e}function X(e){if(e.reactor)return e.reactor;let t=/* @__PURE__ */ Error(`ctx.reactor is not served to this resolver`);throw t.name=`ReactorAccessDeniedError`,t}async function Pa(e){let t=await e.getDocumentModelModules(),n=[...t.results];for(;t.next&&t.results.length>0;)t=await t.next(),n.push(...t.results);return n}async function Fa(e){let t=/* @__PURE__ */ new Map;for(let n of await Pa(e)){let e=n.documentModel.global;e.id&&!t.has(e.id)&&t.set(e.id,e.name)}return[...t].map(([e,t])=>({documentType:e,name:t})).sort((e,t)=>e.documentType.localeCompare(t.documentType))}async function Ia(e,t){let n=t?[t]:(await Fa(e)).map(e=>e.documentType),r=(await Promise.all(n.map(t=>e.find({type:t},void 0,{cursor:``,limit:100})))).flatMap(e=>e.results),i=e=>_i(e)||e.header.slug||`(unnamed)`,a=/* @__PURE__ */ new Map;for(let e of r)a.set(i(e),(a.get(i(e))??0)+1);return{options:r.map(e=>{let n=i(e),{id:r,slug:o}=e.header,s=(a.get(n)??0)>1?`${n} (${o&&o!==n?o:r.slice(0,8)})`:n;return{label:t?s:`${s} — ${e.header.documentType}`,value:r}}),placeholder:t===`powerhouse/document-drive`?`Choose a drive`:t?`Documents of type ${t}`:`All documents on this reactor`}}const Z=(e=`Document type`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[],options:async(e,t)=>({options:(await Fa(X(t))).map(e=>({label:e.name?`${e.name} (${e.documentType})`:e.documentType,value:e.documentType}))})}),La=(e=`Document id`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[`documentType`],options:(e,t)=>Ia(X(t),Da(e.documentType))}),Ra=(e,t)=>Y.Dropdown({auth:void 0,displayName:e,description:t,required:!1,refreshers:[],options:(e,t)=>Ia(X(t),di)}),za=(e,t,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:!1,refreshers:[t],options:async(e,n)=>{let r=Da(e[t]);if(!r)return{disabled:!0,options:[],placeholder:`Pick a drive first`};let i=await X(n).get(r),a=i.state,o=ka(a.global).map(e=>({label:e.label,value:{driveId:i.header.id,folderId:e.value}})),s=_i(i);return{options:o,placeholder:o.length?`Folders in ${s||`this drive`}`:`${s||`This drive`} has no folders`}}}),Ba=(e,t)=>({...Y.LongText({displayName:e,required:!1,description:t,advanced:!0}),display:`code`}),Va=()=>Y.StaticDropdown({displayName:`Parse`,description:`Exact takes ids and JSON as given. Extract reads them out of an AI step's prose, and reports what it read from in extractedFrom`,required:!1,defaultValue:`exact`,advanced:!0,options:{options:ua}});async function Ha(e,t){let n=Da(t.documentType);if(n)return e.getDocumentModelModule(n);let r=Da(t.documentId);if(!r)return;let i=await e.get(r);return e.getDocumentModelModuleForDocument(i)}const Ua=(e=`Action type`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[`documentType`,`documentId`],options:async(e,t)=>{let n=await Ha(X(t),e);if(!n)return{disabled:!0,options:[{label:`SET_NAME (base)`,value:bi.type,inputSchema:bi.inputSchema??void 0}],placeholder:`Pick a document type first`};let r=xi(n);return{options:r.actions.map(e=>({label:`${e.type} (${e.module})`,value:e.type,documentType:r.documentType,...e.inputSchema?{inputSchema:Na(e.inputSchema,r.stateSchema)}:{}})),placeholder:`Actions of ${r.documentType}`}}});function Wa(e,t){let n=xi(e),r=n.actions.find(e=>e.type===t);if(r?.inputSchema)return ea(Na(r.inputSchema,n.stateSchema),t)??void 0}const Ga=(e=`Input`)=>Y.DynamicProperties({auth:void 0,displayName:e,required:!1,refreshers:[`documentType`,`documentId`,`actionType`],props:async(e,t)=>{let n=Da(e.actionType);if(!n)return{};let r=await Ha(X(t),e),i=r&&Wa(r,n);return i?ia(i):{}}}),Ka=e=>({key:`action`,display:`section`,label:`Action`,description:`${e} Pick a type, then fill in its input: the action needs both.`,props:[`actionType`,`input`]});function qa(e,t,n){let r=Error(t,n===void 0?{}:{cause:n});return r.name=e,r}async function Ja(e,t){let n;try{n=await e.readable}catch(t){throw t instanceof Error&&t.name===`JobFailedError`?qa(`ReactorJobFailedError`,`Reactor job ${e.jobId} failed: ${t.message}`,t):t}return ri(n.job,t),n}async function Ya(e,t){return await Ja(e,t),e.document()}const Q=`document-create`;function Xa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Za(e,t){if(e==null||e===``)return;let n=typeof e==`string`&&e.trim().startsWith(`{`)?t.json(e,`folderId`):e;if(typeof n==`string`)return n.trim()||void 0;if(Xa(n)&&typeof n.driveId==`string`&&typeof n.folderId==`string`)return{driveId:n.driveId,folderId:n.folderId};throw Error(`${Q}: "folderId" must be a folder from the list, or a folder id with "parentId" set to its drive`)}async function Qa(e,t,n){if(n&&typeof n==`object`)return{kind:`drive`,...n};if(!t){if(n)throw Error(`${Q}: a folder id needs "parentId", its drive`);return{kind:`none`}}let r=await e.get(t);if(fi.has(r.header.documentType))return{kind:`drive`,driveId:r.header.id,folderId:n};if(n)throw Error(`${Q}: "parentId" names a document, not a drive`);return{kind:`parent`,parentId:r.header.id}}async function $a(e,t,n,r){let i=t.documentModel.global.id;if(n.kind!==`drive`&&!r)return Ya(await e.write.createEmpty(i,n.kind===`parent`?{parentIdentifier:n.parentId}:{}));let a=await e.newDocument(i,{parentIdentifier:n.kind===`drive`?n.driveId:n.kind===`parent`?n.parentId:void 0,name:r||void 0});if(n.kind===`drive`){let t=await Ya(await e.write.create(a,n.driveId)),r=[Si(`ADD_FILE`,{id:t.header.id,name:t.header.name||t.header.id,documentType:i,parentFolder:n.folderId})];return await Ja(await e.write.execute(n.driveId,pi,r),r),t}return Ya(await e.write.create(a,n.kind===`parent`?n.parentId:void 0))}const eo=J({name:Q,displayName:`Create document`,description:`Creates a Powerhouse document. Outputs a reference to it: id, type, branch and revision.`,requireAuth:!1,requireReactor:`write`,propertyGroups:[Ka(`Optional, sent right after the create.`)],props:{documentType:Z(),name:Y.ShortText({displayName:`Document name`,required:!1}),parentId:Ra(`Parent drive`,`A drive, or a document to create the new one under`),folderId:za(`Folder`,`parentId`,`Omit for the drive's root`),actionType:Ua(`Type`,!1),input:Ga(`Input`),actions:Ba(`Action list (JSON)`,`Several actions after the create, or a payload from an earlier step: [{ "type": …, "input": … }]`),payload:Y.ShortText({displayName:`Payload`,description:`JSON {documentType, name, actions?}, e.g. {{steps.draft.output}}`,required:!1,advanced:!0}),parse:Va()},run:async e=>{let t=e.reactor,n=e.propsValue,r=ba.of(Q,n.parse),i=wa(n.payload,r),a=typeof n.documentType==`string`&&n.documentType||i.documentType;if(!a)throw Error(`${Q}: "documentType" is required, in the config or the payload`);let o=typeof n.name==`string`&&n.name||i.name,s=await Qa(t,r.documentId(n.parentId,`parentId`),Za(n.folderId,r)),c=await t.getDocumentModelModule(a),l=(n.actions===void 0?Ca(i.actions,r,`payload.actions`):Ca(n.actions,r)).map(e=>Si(e.type,e.input,e.scope)),u=typeof n.actionType==`string`?n.actionType.trim():``;if(u){let e=Wa(c,u),t=Ta(n.input,r);l.unshift(wi(c,u,e?la(e,t):t))}let d=await $a(t,c,s,o);return{...ii((l.length?await Ya(await t.write.execute(d.header.id,pi,l),l):d).header),...r.output()}}}),to=`document-dispatch`,no=J({name:to,displayName:`Dispatch actions`,description:`Sends actions to a document. Outputs a reference to it: id, type, branch and revision.`,requireAuth:!1,requireReactor:`write`,propertyGroups:[Ka(`Sent to the document.`)],props:{documentId:La(`Document id`,!0,`e.g. {{steps.create.output.documentId}}`),documentType:Z(`Document type`,!1,`Design-time hint when the document id is an expression`),actionType:Ua(`Type`,!1),input:Ga(`Input`),actions:Ba(`Action list (JSON)`,`Several actions at once, or a payload from an earlier step: [{ "type": …, "input": …, "scope"?: "global" }]`),allowedActions:Y.ShortText({displayName:`Allowed action types`,description:`Comma-separated whitelist; enforced when set`,required:!1,advanced:!0}),branch:Y.ShortText({displayName:`Branch`,required:!1,defaultValue:pi,advanced:!0}),parse:Va()},run:async e=>{let t=e.reactor,n=e.propsValue,r=ba.of(to,n.parse),i=Sa(n.actions,r),a=r.documentId(n.documentId,`documentId`)??i.documentId;if(!a)throw Error(`${to}: "documentId" is required, in the config or the actions payload`);let o=i.actions.map(e=>Si(e.type,e.input,e.scope)),s=typeof n.actionType==`string`?n.actionType.trim():``;if(s){let e=await t.getDocumentModelModuleForDocument(await t.get(a)),i=Wa(e,s),c=Ta(n.input,r);o.unshift(wi(e,s,i?la(i,c):c))}let c=Ea(n.allowedActions),l=c.length?o.filter(e=>!c.includes(e.type)):[];if(l.length>0)throw Error(`${to}: action(s) not allowed here: ${[...new Set(l.map(e=>e.type))].join(`, `)}`);if(o.length===0)throw Error(`${to}: choose an Action, or give a non-empty "Action list (JSON)"`);let u=typeof n.branch==`string`&&n.branch.trim()||`main`;return{...ii((await Ya(await t.write.execute(a,u,o),o)).header),...r.output()}}}),ro=`document-find`;function io(e){return btoa(JSON.stringify(e))}function ao(e){if(e!=null&&e!==``){try{let t=JSON.parse(atob(typeof e==`string`?e.trim():``));if(Number.isInteger(t.q)&&typeof t.c==`string`&&Number.isInteger(t.s)&&Number.isInteger(t.l))return t}catch{}throw Error(`${ro}: "cursor" is not a nextCursor this step returned`)}}async function oo(e,t,n){let r=n?{parentId:n}:{};return t?[{type:t,...r}]:n?[r]:(await Fa(e)).map(e=>({type:e.documentType}))}const so=J({name:ro,displayName:`Find documents`,description:`Lists documents by type and name.`,requireAuth:!1,requireReactor:`read`,propertyGroups:[{key:`where`,display:`section`,label:`Which documents`,icon:`search`,props:[`documentType`,`parentId`,`name`]},{key:`match`,display:`section`,label:`Match a state field`,description:`Only documents whose state holds this value.`,icon:`braces`,props:[`matchPath`,`matchValue`]},{key:`results`,display:`section`,label:`Results`,icon:`list`,props:[`includeState`,`limit`]}],props:{documentType:Z(`Document type`,!1,`Omit for any type`),parentId:Ra(`In drive`,`Omit for the whole reactor`),name:Y.ShortText({displayName:`Name contains`,description:`Case-insensitive match`,required:!1}),matchPath:Y.ShortText({displayName:`State field`,description:`Dotted path into the document's state, e.g. "orderId" or "settlement.status". With a value below, only documents holding it are returned.`,required:!1}),matchValue:Y.ShortText({displayName:`State value`,description:`Compared as text, e.g. {{trigger.payload.orderId}}. Documents missing the field never match.`,required:!1}),includeState:Y.Checkbox({displayName:`Include state`,description:`Returns each document's state as well as its header. Off by default: a page of documents carries a page of states.`,required:!1,defaultValue:!1}),limit:Y.Number({displayName:`Max results`,description:`Defaults to 25, at most 100`,required:!1}),cursor:Y.ShortText({displayName:`Cursor`,description:`Resumes a search, e.g. {{steps.find.output.nextCursor}}; omit to start from the first page`,required:!1,advanced:!0})},run:async e=>{let{documentType:t,parentId:n,name:r,limit:i,matchPath:a,matchValue:o,includeState:s}=e.propsValue,c=Math.min(Math.max(typeof i==`number`?i:25,1),100),l=typeof a==`string`?a.trim():``,u=typeof o==`string`?o.trim():``;if(l===``!=(u===``))throw Error(`${ro}: "State field" and "State value" are set together or not at all`);let d=typeof r==`string`?r.trim().toLowerCase():``,f=l?{path:l,value:u}:void 0,p=e=>(!d||_i(e).toLowerCase().includes(d))&&yi(e,f),m=d!==``||f!==void 0,h=await oo(e.reactor,typeof t==`string`&&t.trim()?t.trim():void 0,typeof n==`string`&&n.trim()?n.trim():void 0),g=ao(e.propsValue.cursor)??{q:0,c:``,s:0,l:0},_=[],v;for(let t=0;g.q<h.length;t++){if(m&&t>=20){v=io(g);break}let n=g.l||(m?100:Math.max(c-_.length,1)),r=await e.reactor.find(h[g.q],void 0,{cursor:g.c,limit:n}),i=g.s;for(;i<r.results.length&&_.length<c;i++)p(r.results[i])&&_.push(r.results[i]);let a=i<r.results.length?{q:g.q,c:g.c,s:i,l:n}:r.nextCursor&&r.results.length>0?{q:g.q,c:r.nextCursor,s:0,l:0}:g.q+1<h.length?{q:g.q+1,c:``,s:0,l:0}:void 0;if(!a)break;if(_.length>=c){v=io(a);break}g=a}return{results:_.map(e=>s===!0?hi(e):{header:e.header}),...v?{nextCursor:v}:{}}}}),co=`document-get`,lo=J({name:co,displayName:`Get document`,description:`Reads a document's current state.`,requireAuth:!1,requireReactor:`read`,props:{documentId:La(`Document id`,!0,`e.g. {{steps.find.output.results.0.header.id}}`),documentType:Z(`Document type`,!1,`Design-time hint when the document id is an expression`),parse:Va()},run:async e=>{let t=ba.of(co,e.propsValue.parse),n=t.documentId(e.propsValue.documentId,`documentId`);if(!n)throw Error(`${co}: "documentId" is required`);return{...hi(await e.reactor.get(n)),...t.output()}}}),uo=`document-schema`,fo=J({name:uo,displayName:`Get document schema`,description:`Action and state schemas of a document type.`,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Required unless a document id is given`),documentId:La(`Document id`,!1,`Resolves the type from this document instead`),actionType:Ua(`Only this action`,!1,`Omit to list every action`),parse:Va()},run:async e=>{let t=e.reactor,{actionType:n}=e.propsValue,r=ba.of(uo,e.propsValue.parse),i=typeof e.propsValue.documentType==`string`?e.propsValue.documentType.trim():``,a=i?void 0:r.documentId(e.propsValue.documentId,`documentId`);if(!i&&!a)throw Error(`${uo}: "documentType" is required`);let o=xi(a?await t.getDocumentModelModuleForDocument(await t.get(a)):await t.getDocumentModelModule(i));return{documentType:o.documentType,name:o.name,stateSchema:o.stateSchema,actions:n?o.actions.filter(e=>e.type===n):o.actions,...r.output()}}}),po=J({name:`document-types`,displayName:`List document types`,description:`Document models installed on this reactor.`,requireAuth:!1,requireReactor:`read`,props:{},run:async e=>{let t=await Fa(e.reactor);return{count:t.length,types:t}}}),mo=`index-query`,ho=J({name:mo,displayName:`Query index`,description:`Runs a GraphQL query against one of this reactor's index subgraphs (a key index, a mail index, …) as the workflow's user. Outputs the query's data; a refused or unknown index is an error.`,requireAuth:!1,requireReactor:`read`,props:{subgraph:Y.ShortText({displayName:`Index`,description:`The subgraph's name as the switchboard registers it, e.g. "key-index".`,required:!0}),query:Y.LongText({displayName:`Query`,description:`A GraphQL query document. Mutations are refused.`,required:!0}),variables:Y.Json({displayName:`Variables`,description:`The query's variables, as JSON.`,required:!1})},run:async e=>{let t=e.propsValue,n=String(t.subgraph).trim(),r=String(t.query).trim();if(!n)throw Error(`${mo}: "Index" is required.`);if(!r)throw Error(`${mo}: "Query" is required.`);let i=await e.reactor.query({subgraph:n,query:r,variables:go(t.variables)});if(i.errors?.length)throw Error(`The index "${n}" refused the query: ${i.errors.map(e=>e.message).join(`; `)}`);return i.data??{}}});function go(e){if(e==null||e===``)return;let t=typeof e==`string`?JSON.parse(e):e;if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`${mo}: "Variables" must be a JSON object.`);return t}function $(e){return()=>Promise.reject(/* @__PURE__ */ Error(`The "${e}" trigger is fired by the reactor, not polled`))}const _o={documentId:`01234567-89ab-cdef-0123-456789abcdef`,documentType:`powerhouse/workflow`,branch:`main`,scope:`global`,action:{type:`SET_NAME`,input:{name:`Invoice`}},operation:{index:7,timestampUtcMs:`1757500000000`}},vo={documentId:`01234567-89ab-cdef-0123-456789abcdef`,documentType:`powerhouse/workflow`,name:`Invoice`,driveId:`fedcba98-7654-3210-fedc-ba9876543210`,parentId:null,operation:{index:0,timestampUtcMs:`1757500000000`}},yo=ti({name:`document-event`,displayName:`Document event`,description:`Fires when a matching document operation lands.`,type:Nn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`e.g. powerhouse/connection`),documentId:La(`Document id`,!1,`Omit to match any document`),actionType:Ua(`Action type`,!1,`Omit to match any action`)},sampleData:_o,onEnable:$(`document-event`),onDisable:$(`document-event`),run:$(`document-event`)}),bo=ti({name:`document-created`,displayName:`Document created`,description:`Fires when a document is added to a drive.`,type:Nn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Type of the created document; omit to match any`),driveId:Ra(`Drive`,`Omit to match documents outside every drive too`)},sampleData:vo,onEnable:$(`document-created`),onDisable:$(`document-created`),run:$(`document-created`)}),xo=ti({name:`document-deleted`,displayName:`Document deleted`,description:`Fires when a document is removed from a drive.`,type:Nn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Type of the deleted document; omit to match any`),driveId:Ra(`Drive`,`Omit to match documents outside every drive too`)},sampleData:vo,onEnable:$(`document-deleted`),onDisable:$(`document-deleted`),run:$(`document-deleted`)}),So=Or({displayName:`Powerhouse Reactor`,description:`Read and write Powerhouse documents on the reactor this workflow runs in: create documents, dispatch actions, read state, schemas and indexes, and fire on document events.`,logoUrl:`data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMTQgMTE0IiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE2MTYxNiIgZD0iTTcxLjI5MTkgMEwyNC4zNDE1IDM4Ljg3NzJDMTcuNDU0OCA0NC41Nzk4IDE2Ljk1MzkgNTQuOTY1OSAyMy4yNiA2MS4zMDQ3TDM5LjUwMjggNzcuNjMxOEM0NC4yNjg0IDgyLjQyMjEgNDUuMjk5NiA4OS43ODM0IDQyLjAzMzUgOTUuNjk4OEwzMS45MjkgMTE0SDE1LjJDNi44MDUyNyAxMTQgMCAxMDcuMTk1IDAgOTguOFYxNS4yQzAgNi44MDUyNyA2LjgwNTI3IDAgMTUuMiAwSDcxLjI5MTlaTTgwLjExMSAwTDcxLjM0MTIgMTUuOTc1OEM2OC4xMDc4IDIxLjg2NiA2OS4xMjU1IDI5LjE4MDQgNzMuODQ0MSAzMy45NjQxTDkxLjA3NTEgNTEuNDMzMUM5Ny4zNjc0IDU3LjgxMjQgOTYuODA0NCA2OC4yMjI3IDg5Ljg2MDcgNzMuODg2MUw0MC42NzgyIDExNEg5OC44QzEwNy4xOTUgMTE0IDExNCAxMDcuMTk1IDExNCA5OC44VjE1LjJDMTE0IDYuODA1MjcgMTA3LjE5NSAwIDk4LjggMEg4MC4xMTFaIi8+PC9zdmc+`,authors:[`powerhouse`],auth:void 0,actions:[eo,no,lo,so,fo,po,ho],triggers:[yo,bo,xo]});export{So as default,So as reactor};
59
+ `)}`:e}function X(e){if(e.reactor)return e.reactor;let t=/* @__PURE__ */ Error(`ctx.reactor is not served to this resolver`);throw t.name=`ReactorAccessDeniedError`,t}async function Ia(e){let t=await e.getDocumentModelModules(),n=[...t.results];for(;t.next&&t.results.length>0;)t=await t.next(),n.push(...t.results);return n}async function La(e){let t=/* @__PURE__ */ new Map;for(let n of await Ia(e)){let e=n.documentModel.global;e.id&&!t.has(e.id)&&t.set(e.id,e.name)}return[...t].map(([e,t])=>({documentType:e,name:t})).sort((e,t)=>e.documentType.localeCompare(t.documentType))}async function Ra(e,t){let n=t?[t]:(await La(e)).map(e=>e.documentType),r=(await Promise.all(n.map(t=>e.find({type:t},void 0,{cursor:``,limit:100})))).flatMap(e=>e.results),i=e=>_i(e)||e.header.slug||`(unnamed)`,a=/* @__PURE__ */ new Map;for(let e of r)a.set(i(e),(a.get(i(e))??0)+1);return{options:r.map(e=>{let n=i(e),{id:r,slug:o}=e.header,s=(a.get(n)??0)>1?`${n} (${o&&o!==n?o:r.slice(0,8)})`:n;return{label:t?s:`${s} — ${e.header.documentType}`,value:r}}),placeholder:t===`powerhouse/document-drive`?`Choose a drive`:t?`Documents of type ${t}`:`All documents on this reactor`}}const Z=(e=`Document type`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[],options:async(e,t)=>({options:(await La(X(t))).map(e=>({label:e.name?`${e.name} (${e.documentType})`:e.documentType,value:e.documentType}))})}),za=(e=`Document id`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[`documentType`],options:(e,t)=>Ra(X(t),ka(e.documentType))}),Ba=(e,t)=>Y.Dropdown({auth:void 0,displayName:e,description:t,required:!1,refreshers:[],options:(e,t)=>Ra(X(t),di)}),Va=(e,t,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:!1,refreshers:[t],options:async(e,n)=>{let r=ka(e[t]);if(!r)return{disabled:!0,options:[],placeholder:`Pick a drive first`};let i=await X(n).get(r),a=i.state,o=ja(a.global).map(e=>({label:e.label,value:{driveId:i.header.id,folderId:e.value}})),s=_i(i);return{options:o,placeholder:o.length?`Folders in ${s||`this drive`}`:`${s||`This drive`} has no folders`}}}),Ha=(e,t)=>({...Y.LongText({displayName:e,required:!1,description:t,advanced:!0}),display:`code`}),Ua=()=>Y.StaticDropdown({displayName:`Parse`,description:`Exact takes ids and JSON as given. Extract reads them out of an AI step's prose, and reports what it read from in extractedFrom`,required:!1,defaultValue:`exact`,advanced:!0,options:{options:fa}});async function Wa(e,t){let n=ka(t.documentType);if(n)return e.getDocumentModelModule(n);let r=ka(t.documentId);if(!r)return;let i=await e.get(r);return e.getDocumentModelModuleForDocument(i)}const Ga=(e=`Action type`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[`documentType`,`documentId`],options:async(e,t)=>{let n=await Wa(X(t),e);if(!n)return{disabled:!0,options:[{label:`SET_NAME (base)`,value:bi.type,inputSchema:bi.inputSchema??void 0}],placeholder:`Pick a document type first`};let r=wi(n);return{options:r.actions.map(e=>({label:`${e.type} (${e.module})`,value:e.type,documentType:r.documentType,...e.inputSchema?{inputSchema:Fa(e.inputSchema,r.stateSchema)}:{}})),placeholder:`Actions of ${r.documentType}`}}});function Ka(e,t){let n=wi(e),r=n.actions.find(e=>e.type===t);if(r?.inputSchema)return ra(Fa(r.inputSchema,n.stateSchema),t)??void 0}const qa=(e=`Input`)=>Y.DynamicProperties({auth:void 0,displayName:e,required:!1,refreshers:[`documentType`,`documentId`,`actionType`],props:async(e,t)=>{let n=ka(e.actionType);if(!n)return{};let r=await Wa(X(t),e),i=r&&Ka(r,n);return i?sa(i):{}}}),Ja=e=>({key:`action`,display:`section`,label:`Action`,description:`${e} Pick a type, then fill in its input: the action needs both.`,props:[`actionType`,`input`]});function Ya(e,t,n){let r=Error(t,n===void 0?{}:{cause:n});return r.name=e,r}async function Xa(e,t){let n;try{n=await e.readable}catch(t){throw t instanceof Error&&t.name===`JobFailedError`?Ya(`ReactorJobFailedError`,`Reactor job ${e.jobId} failed: ${t.message}`,t):t}return ri(n.job,t),n}async function Za(e,t){return await Xa(e,t),e.document()}const Q=`document-create`;function Qa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $a(e,t){if(e==null||e===``)return;let n=typeof e==`string`&&e.trim().startsWith(`{`)?t.json(e,`folderId`):e;if(typeof n==`string`)return n.trim()||void 0;if(Qa(n)&&typeof n.driveId==`string`&&typeof n.folderId==`string`)return{driveId:n.driveId,folderId:n.folderId};throw Error(`${Q}: "folderId" must be a folder from the list, or a folder id with "parentId" set to its drive`)}async function eo(e,t,n){if(n&&typeof n==`object`)return{kind:`drive`,...n};if(!t){if(n)throw Error(`${Q}: a folder id needs "parentId", its drive`);return{kind:`none`}}let r=await e.get(t);if(fi.has(r.header.documentType))return{kind:`drive`,driveId:r.header.id,folderId:n};if(n)throw Error(`${Q}: "parentId" names a document, not a drive`);return{kind:`parent`,parentId:r.header.id}}async function to(e,t,n,r){let i=t.documentModel.global.id;if(n.kind!==`drive`&&!r)return Za(await e.write.createEmpty(i,n.kind===`parent`?{parentIdentifier:n.parentId}:{}));let a=await e.newDocument(i,{parentIdentifier:n.kind===`drive`?n.driveId:n.kind===`parent`?n.parentId:void 0,name:r||void 0});if(n.kind===`drive`){let t=await Za(await e.write.create(a,n.driveId)),r=[Ti(`ADD_FILE`,{id:t.header.id,name:t.header.name||t.header.id,documentType:i,parentFolder:n.folderId})];return await Xa(await e.write.execute(n.driveId,pi,r),r),t}return Za(await e.write.create(a,n.kind===`parent`?n.parentId:void 0))}const no=J({name:Q,displayName:`Create document`,description:`Creates a Powerhouse document. Outputs a reference to it: id, type, branch and revision.`,requireAuth:!1,requireReactor:`write`,propertyGroups:[Ja(`Optional, sent right after the create.`)],props:{documentType:Z(),name:Y.ShortText({displayName:`Document name`,required:!1}),parentId:Ba(`Parent drive`,`A drive, or a document to create the new one under`),folderId:Va(`Folder`,`parentId`,`Omit for the drive's root`),actionType:Ga(`Type`,!1),input:qa(`Input`),actions:Ha(`Action list (JSON)`,`Several actions after the create, or a payload from an earlier step: [{ "type": …, "input": … }]`),payload:Y.ShortText({displayName:`Payload`,description:`JSON {documentType, name, actions?}, e.g. {{steps.draft.output}}`,required:!1,advanced:!0}),parse:Ua()},run:async e=>{let t=e.reactor,n=e.propsValue,r=Sa.of(Q,n.parse),i=Ea(n.payload,r),a=typeof n.documentType==`string`&&n.documentType||i.documentType;if(!a)throw Error(`${Q}: "documentType" is required, in the config or the payload`);let o=typeof n.name==`string`&&n.name||i.name,s=await eo(t,r.documentId(n.parentId,`parentId`),$a(n.folderId,r)),c=await t.getDocumentModelModule(a),l=(n.actions===void 0?Ta(i.actions,r,`payload.actions`):Ta(n.actions,r)).map(e=>Ti(e.type,e.input,e.scope)),u=typeof n.actionType==`string`?n.actionType.trim():``;if(u){let e=Ka(c,u),t=Da(n.input,r);l.unshift(Di(c,u,e?da(e,t):t))}let d=await to(t,c,s,o);return{...ii((l.length?await Za(await t.write.execute(d.header.id,pi,l),l):d).header),...r.output()}}}),ro=`document-dispatch`,io=J({name:ro,displayName:`Dispatch actions`,description:`Sends actions to a document. Outputs a reference to it: id, type, branch and revision.`,requireAuth:!1,requireReactor:`write`,propertyGroups:[Ja(`Sent to the document.`)],props:{documentId:za(`Document id`,!0,`e.g. {{steps.create.output.documentId}}`),documentType:Z(`Document type`,!1,`Design-time hint when the document id is an expression`),actionType:Ga(`Type`,!1),input:qa(`Input`),actions:Ha(`Action list (JSON)`,`Several actions at once, or a payload from an earlier step: [{ "type": …, "input": …, "scope"?: "global" }]`),allowedActions:Y.ShortText({displayName:`Allowed action types`,description:`Comma-separated whitelist; enforced when set`,required:!1,advanced:!0}),branch:Y.ShortText({displayName:`Branch`,required:!1,defaultValue:pi,advanced:!0}),parse:Ua()},run:async e=>{let t=e.reactor,n=e.propsValue,r=Sa.of(ro,n.parse),i=wa(n.actions,r),a=r.documentId(n.documentId,`documentId`)??i.documentId;if(!a)throw Error(`${ro}: "documentId" is required, in the config or the actions payload`);let o=i.actions.map(e=>Ti(e.type,e.input,e.scope)),s=typeof n.actionType==`string`?n.actionType.trim():``;if(s){let e=await t.getDocumentModelModuleForDocument(await t.get(a)),i=Ka(e,s),c=Da(n.input,r);o.unshift(Di(e,s,i?da(i,c):c))}let c=Oa(n.allowedActions),l=c.length?o.filter(e=>!c.includes(e.type)):[];if(l.length>0)throw Error(`${ro}: action(s) not allowed here: ${[...new Set(l.map(e=>e.type))].join(`, `)}`);if(o.length===0)throw Error(`${ro}: choose an Action, or give a non-empty "Action list (JSON)"`);let u=typeof n.branch==`string`&&n.branch.trim()||`main`;return{...ii((await Za(await t.write.execute(a,u,o),o)).header),...r.output()}}}),ao=`document-find`;function oo(e){return btoa(JSON.stringify(e))}function so(e){if(e!=null&&e!==``){try{let t=JSON.parse(atob(typeof e==`string`?e.trim():``));if(Number.isInteger(t.q)&&typeof t.c==`string`&&Number.isInteger(t.s)&&Number.isInteger(t.l))return t}catch{}throw Error(`${ao}: "cursor" is not a nextCursor this step returned`)}}async function co(e,t,n){let r=n?{parentId:n}:{};return t?[{type:t,...r}]:n?[r]:(await La(e)).map(e=>({type:e.documentType}))}const lo=J({name:ao,displayName:`Find documents`,description:`Lists documents by type and name.`,requireAuth:!1,requireReactor:`read`,propertyGroups:[{key:`where`,display:`section`,label:`Which documents`,icon:`search`,props:[`documentType`,`parentId`,`name`]},{key:`match`,display:`section`,label:`Match a state field`,description:`Only documents whose state holds this value.`,icon:`braces`,props:[`matchPath`,`matchValue`]},{key:`results`,display:`section`,label:`Results`,icon:`list`,props:[`includeState`,`limit`]}],props:{documentType:Z(`Document type`,!1,`Omit for any type`),parentId:Ba(`In drive`,`Omit for the whole reactor`),name:Y.ShortText({displayName:`Name contains`,description:`Case-insensitive match`,required:!1}),matchPath:Y.ShortText({displayName:`State field`,description:`Dotted path into the document's state, e.g. "orderId" or "settlement.status". With a value below, only documents holding it are returned.`,required:!1}),matchValue:Y.ShortText({displayName:`State value`,description:`Compared as text, e.g. {{trigger.payload.orderId}}. Documents missing the field never match.`,required:!1}),includeState:Y.Checkbox({displayName:`Include state`,description:`Returns each document's state as well as its header. Off by default: a page of documents carries a page of states.`,required:!1,defaultValue:!1}),limit:Y.Number({displayName:`Max results`,description:`Defaults to 25, at most 100`,required:!1}),cursor:Y.ShortText({displayName:`Cursor`,description:`Resumes a search, e.g. {{steps.find.output.nextCursor}}; omit to start from the first page`,required:!1,advanced:!0})},run:async e=>{let{documentType:t,parentId:n,name:r,limit:i,matchPath:a,matchValue:o,includeState:s}=e.propsValue,c=Math.min(Math.max(typeof i==`number`?i:25,1),100),l=typeof a==`string`?a.trim():``,u=typeof o==`string`?o.trim():``;if(l===``!=(u===``))throw Error(`${ao}: "State field" and "State value" are set together or not at all`);let d=typeof r==`string`?r.trim().toLowerCase():``,f=l?{path:l,value:u}:void 0,p=e=>(!d||_i(e).toLowerCase().includes(d))&&yi(e,f),m=d!==``||f!==void 0,h=await co(e.reactor,typeof t==`string`&&t.trim()?t.trim():void 0,typeof n==`string`&&n.trim()?n.trim():void 0),g=so(e.propsValue.cursor)??{q:0,c:``,s:0,l:0},_=[],v;for(let t=0;g.q<h.length;t++){if(m&&t>=20){v=oo(g);break}let n=g.l||(m?100:Math.max(c-_.length,1)),r=await e.reactor.find(h[g.q],void 0,{cursor:g.c,limit:n}),i=g.s;for(;i<r.results.length&&_.length<c;i++)p(r.results[i])&&_.push(r.results[i]);let a=i<r.results.length?{q:g.q,c:g.c,s:i,l:n}:r.nextCursor&&r.results.length>0?{q:g.q,c:r.nextCursor,s:0,l:0}:g.q+1<h.length?{q:g.q+1,c:``,s:0,l:0}:void 0;if(!a)break;if(_.length>=c){v=oo(a);break}g=a}return{results:_.map(e=>s===!0?hi(e):{header:e.header}),...v?{nextCursor:v}:{}}}}),uo=`document-get`,fo=J({name:uo,displayName:`Get document`,description:`Reads a document's current state.`,requireAuth:!1,requireReactor:`read`,props:{documentId:za(`Document id`,!0,`e.g. {{steps.find.output.results.0.header.id}}`),documentType:Z(`Document type`,!1,`Design-time hint when the document id is an expression`),parse:Ua()},run:async e=>{let t=Sa.of(uo,e.propsValue.parse),n=t.documentId(e.propsValue.documentId,`documentId`);if(!n)throw Error(`${uo}: "documentId" is required`);return{...hi(await e.reactor.get(n)),...t.output()}}}),po=`document-schema`,mo=J({name:po,displayName:`Get document schema`,description:`Action and state schemas of a document type.`,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Required unless a document id is given`),documentId:za(`Document id`,!1,`Resolves the type from this document instead`),actionType:Ga(`Only this action`,!1,`Omit to list every action`),parse:Ua()},run:async e=>{let t=e.reactor,{actionType:n}=e.propsValue,r=Sa.of(po,e.propsValue.parse),i=typeof e.propsValue.documentType==`string`?e.propsValue.documentType.trim():``,a=i?void 0:r.documentId(e.propsValue.documentId,`documentId`);if(!i&&!a)throw Error(`${po}: "documentType" is required`);let o=wi(a?await t.getDocumentModelModuleForDocument(await t.get(a)):await t.getDocumentModelModule(i));return{documentType:o.documentType,name:o.name,stateSchema:o.stateSchema,actions:n?o.actions.filter(e=>e.type===n):o.actions,...r.output()}}}),ho=J({name:`document-types`,displayName:`List document types`,description:`Document models installed on this reactor.`,requireAuth:!1,requireReactor:`read`,props:{},run:async e=>{let t=await La(e.reactor);return{count:t.length,types:t}}}),go=`index-query`,_o=J({name:go,displayName:`Query index`,description:`Runs a GraphQL query against one of this reactor's index subgraphs (a key index, a mail index, …) as the workflow's user. Outputs the query's data; a refused or unknown index is an error.`,requireAuth:!1,requireReactor:`read`,props:{subgraph:Y.ShortText({displayName:`Index`,description:`The subgraph's name as the switchboard registers it, e.g. "key-index".`,required:!0}),query:Y.LongText({displayName:`Query`,description:`A GraphQL query document. Mutations are refused.`,required:!0}),variables:Y.Json({displayName:`Variables`,description:`The query's variables, as JSON.`,required:!1})},run:async e=>{let t=e.propsValue,n=String(t.subgraph).trim(),r=String(t.query).trim();if(!n)throw Error(`${go}: "Index" is required.`);if(!r)throw Error(`${go}: "Query" is required.`);let i=await e.reactor.query({subgraph:n,query:r,variables:vo(t.variables)});if(i.errors?.length)throw Error(`The index "${n}" refused the query: ${i.errors.map(e=>e.message).join(`; `)}`);return i.data??{}}});function vo(e){if(e==null||e===``)return;let t=typeof e==`string`?JSON.parse(e):e;if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`${go}: "Variables" must be a JSON object.`);return t}function $(e){return()=>Promise.reject(/* @__PURE__ */ Error(`The "${e}" trigger is fired by the reactor, not polled`))}const yo={documentId:`01234567-89ab-cdef-0123-456789abcdef`,documentType:`powerhouse/workflow`,branch:`main`,scope:`global`,action:{type:`SET_NAME`,input:{name:`Invoice`}},operation:{index:7,timestampUtcMs:`1757500000000`}},bo={documentId:`01234567-89ab-cdef-0123-456789abcdef`,documentType:`powerhouse/workflow`,name:`Invoice`,driveId:`fedcba98-7654-3210-fedc-ba9876543210`,parentId:null,operation:{index:0,timestampUtcMs:`1757500000000`}},xo=ti({name:`document-event`,displayName:`Document event`,description:`Fires when a matching document operation lands.`,type:Nn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`e.g. powerhouse/connection`),documentId:za(`Document id`,!1,`Omit to match any document`),actionType:Ga(`Action type`,!1,`Omit to match any action`)},sampleData:yo,onEnable:$(`document-event`),onDisable:$(`document-event`),run:$(`document-event`)}),So=ti({name:`document-created`,displayName:`Document created`,description:`Fires when a document is added to a drive.`,type:Nn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Type of the created document; omit to match any`),driveId:Ba(`Drive`,`Omit to match documents outside every drive too`)},sampleData:bo,onEnable:$(`document-created`),onDisable:$(`document-created`),run:$(`document-created`)}),Co=ti({name:`document-deleted`,displayName:`Document deleted`,description:`Fires when a document is removed from a drive.`,type:Nn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Type of the deleted document; omit to match any`),driveId:Ba(`Drive`,`Omit to match documents outside every drive too`)},sampleData:bo,onEnable:$(`document-deleted`),onDisable:$(`document-deleted`),run:$(`document-deleted`)}),wo=Or({displayName:`Powerhouse Reactor`,description:`Read and write Powerhouse documents on the reactor this workflow runs in: create documents, dispatch actions, read state, schemas and indexes, and fire on document events.`,logoUrl:`data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMTQgMTE0IiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE2MTYxNiIgZD0iTTcxLjI5MTkgMEwyNC4zNDE1IDM4Ljg3NzJDMTcuNDU0OCA0NC41Nzk4IDE2Ljk1MzkgNTQuOTY1OSAyMy4yNiA2MS4zMDQ3TDM5LjUwMjggNzcuNjMxOEM0NC4yNjg0IDgyLjQyMjEgNDUuMjk5NiA4OS43ODM0IDQyLjAzMzUgOTUuNjk4OEwzMS45MjkgMTE0SDE1LjJDNi44MDUyNyAxMTQgMCAxMDcuMTk1IDAgOTguOFYxNS4yQzAgNi44MDUyNyA2LjgwNTI3IDAgMTUuMiAwSDcxLjI5MTlaTTgwLjExMSAwTDcxLjM0MTIgMTUuOTc1OEM2OC4xMDc4IDIxLjg2NiA2OS4xMjU1IDI5LjE4MDQgNzMuODQ0MSAzMy45NjQxTDkxLjA3NTEgNTEuNDMzMUM5Ny4zNjc0IDU3LjgxMjQgOTYuODA0NCA2OC4yMjI3IDg5Ljg2MDcgNzMuODg2MUw0MC42NzgyIDExNEg5OC44QzEwNy4xOTUgMTE0IDExNCAxMDcuMTk1IDExNCA5OC44VjE1LjJDMTE0IDYuODA1MjcgMTA3LjE5NSAwIDk4LjggMEg4MC4xMTFaIi8+PC9zdmc+`,authors:[`powerhouse`],auth:void 0,actions:[no,io,fo,lo,mo,ho,_o],triggers:[xo,So,Co]});export{wo as default,wo as reactor};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/piece-reactor",
3
- "version": "6.2.3-dev.96",
3
+ "version": "6.2.3-dev.97",
4
4
  "description": "Read and write Powerhouse documents on the reactor this workflow runs in: create documents, dispatch actions, read state, schemas and indexes, and fire on document events.",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
@@ -45,7 +45,7 @@
45
45
  {
46
46
  "id": "@powerhousedao/piece-ai",
47
47
  "name": "AI",
48
- "version": "6.2.3-dev.96",
48
+ "version": "6.2.3-dev.97",
49
49
  "description": "Call AI models from OpenAI, Anthropic, Google or TypeSafe, or any OpenAI-compatible server such as Ollama, vLLM or OpenRouter.",
50
50
  "bundle": "dist/node/pieces/ai",
51
51
  "descriptor": "dist/node/pieces/ai/descriptor.json"
@@ -53,7 +53,7 @@
53
53
  {
54
54
  "id": "@powerhousedao/piece-reactor",
55
55
  "name": "Powerhouse Reactor",
56
- "version": "6.2.3-dev.96",
56
+ "version": "6.2.3-dev.97",
57
57
  "description": "Read and write Powerhouse documents on the reactor this workflow runs in: create documents, dispatch actions, read state, schemas and indexes, and fire on document events.",
58
58
  "bundle": "dist/node/pieces/reactor",
59
59
  "descriptor": "dist/node/pieces/reactor/descriptor.json"
@@ -26,6 +26,7 @@ export interface ModelDescription {
26
26
  stateSchema: string | null;
27
27
  actions: ModelAction[];
28
28
  }
29
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
29
30
  export declare function describeModel(module: DocumentModelModule): ModelDescription;
30
31
  export declare function plainAction(type: string, input: unknown, scope?: string): Action;
31
32
  export declare function typedAction(module: DocumentModelModule, type: string, input: unknown): Action;
@@ -1 +1 @@
1
- {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../../../pieces/reactor/lib/documents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,UAAU,EACX,MAAM,sCAAsC,CAAC;AAM9C,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAC/D,eAAO,MAAM,oBAAoB,aAG/B,CAAC;AAEH,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,aAAa,WAAW,CAAC;AAGtC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC7B,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,UAAU,GAAG,cAAc,CAEnE;AAUD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAGxD;AAaD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GACjD,OAAO,CAYT;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAGD,eAAO,MAAM,eAAe,EAAE,WAK7B,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAGD,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,CAyB3E;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,MAAsB,GAC5B,MAAM,CASR;AAWD,wBAAgB,WAAW,CACzB,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,MAAM,CAYR"}
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../../../pieces/reactor/lib/documents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,UAAU,EACX,MAAM,sCAAsC,CAAC;AAM9C,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAC/D,eAAO,MAAM,oBAAoB,aAG/B,CAAC;AAEH,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,aAAa,WAAW,CAAC;AAGtC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC7B,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,UAAU,GAAG,cAAc,CAEnE;AAUD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAGxD;AAaD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GACjD,OAAO,CAYT;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAGD,eAAO,MAAM,eAAe,EAAE,WAK7B,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAkCD,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,CA0B3E;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,MAAsB,GAC5B,MAAM,CASR;AAWD,wBAAgB,WAAW,CACzB,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,MAAM,CAYR"}
@@ -1 +1 @@
1
- {"version":3,"file":"input-props.d.ts","sourceRoot":"","sources":["../../../../../pieces/reactor/lib/input-props.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAGL,KAAK,iBAAiB,EAGvB,MAAM,mBAAmB,CAAC;AAuD3B,wBAAgB,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAIvE;AAgED,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,OAAO,GACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBzB"}
1
+ {"version":3,"file":"input-props.d.ts","sourceRoot":"","sources":["../../../../../pieces/reactor/lib/input-props.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAGL,KAAK,iBAAiB,EAGvB,MAAM,mBAAmB,CAAC;AAwD3B,wBAAgB,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAIvE;AA4DD,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,OAAO,GACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/workflow",
3
- "version": "6.2.3-dev.96",
3
+ "version": "6.2.3-dev.97",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -70,13 +70,13 @@
70
70
  "./package.json": "./package.json"
71
71
  },
72
72
  "dependencies": {
73
- "@powerhousedao/pieces-framework": "6.2.3-dev.96",
74
- "@powerhousedao/reactor": "6.2.3-dev.96",
75
- "@powerhousedao/shared": "6.2.3-dev.96",
73
+ "@powerhousedao/pieces-framework": "6.2.3-dev.97",
74
+ "@powerhousedao/reactor": "6.2.3-dev.97",
75
+ "@powerhousedao/shared": "6.2.3-dev.97",
76
76
  "@tanstack/react-query": "^5.49.2",
77
77
  "@uiw/react-json-view": "2.0.0-alpha.42",
78
78
  "@xyflow/react": "12.11.6",
79
- "document-model": "6.2.3-dev.96",
79
+ "document-model": "6.2.3-dev.97",
80
80
  "graphql": "^16",
81
81
  "react": "19.2.6",
82
82
  "react-dom": "19.2.6",
@@ -91,10 +91,10 @@
91
91
  "@ai-sdk/openai-compatible": "3.0.65",
92
92
  "@ai-sdk/typesafe-ai": "3.0.15",
93
93
  "@playwright/test": "^1.60.0",
94
- "@powerhousedao/design-system": "6.2.3-dev.96",
95
- "@powerhousedao/powerhouse-vetra-packages": "6.2.3-dev.96",
96
- "@powerhousedao/reactor-browser": "6.2.3-dev.96",
97
- "@powerhousedao/reactor-mcp": "6.2.3-dev.96",
94
+ "@powerhousedao/design-system": "6.2.3-dev.97",
95
+ "@powerhousedao/powerhouse-vetra-packages": "6.2.3-dev.97",
96
+ "@powerhousedao/reactor-browser": "6.2.3-dev.97",
97
+ "@powerhousedao/reactor-mcp": "6.2.3-dev.97",
98
98
  "@tailwindcss/cli": "4.2.2",
99
99
  "@testing-library/react": "^16.0.1",
100
100
  "@types/node": "25.2.3",
@@ -122,8 +122,8 @@
122
122
  "activepieces"
123
123
  ],
124
124
  "peerDependencies": {
125
- "@powerhousedao/design-system": "6.2.3-dev.96",
126
- "@powerhousedao/reactor-browser": "6.2.3-dev.96"
125
+ "@powerhousedao/design-system": "6.2.3-dev.97",
126
+ "@powerhousedao/reactor-browser": "6.2.3-dev.97"
127
127
  },
128
128
  "peerDependenciesMeta": {
129
129
  "@powerhousedao/design-system": {