diff --git a/admission-server/Dockerfile b/admission-server/Dockerfile index 6ca3e45f6d..2ee155e8e0 100644 --- a/admission-server/Dockerfile +++ b/admission-server/Dockerfile @@ -23,7 +23,7 @@ FROM --platform=${BUILDPLATFORM} node:lts-slim WORKDIR /app -ENV NODE_ENV production +ENV NODE_ENV=production # Fetch built artifacts COPY --from=builder /app/pruned . diff --git a/cdn-server/Dockerfile b/cdn-server/Dockerfile index b81a54aeab..4c7f9d3182 100644 --- a/cdn-server/Dockerfile +++ b/cdn-server/Dockerfile @@ -24,7 +24,7 @@ FROM --platform=${BUILDPLATFORM} node:lts-slim WORKDIR /app -ENV NODE_ENV production +ENV NODE_ENV=production # Fetch built artifacts COPY --from=builder /app/pruned . diff --git a/composition-go/index.global.js b/composition-go/index.global.js index 685f4606e1..6f543a0773 100644 --- a/composition-go/index.global.js +++ b/composition-go/index.global.js @@ -636,7 +636,7 @@ ${t}`)}pr.getComment=RA;function w1(e){let t=e.loc;if(!t)return;let n=[],r=t.sta Existing directive: ${r} Received directive: - ${n}`)}function Mue(e,t){return t?(Uue(e,t),G(k({},e),{locations:[...t.locations,...e.locations.filter(n=>!kue(n,t.locations))]})):e}Vp.mergeDirective=Mue;function Bue(e,t,n){return e.concat(t.filter(r=>n(r,e)))}});var aR=j(Yg=>{"use strict";m();T();h();Object.defineProperty(Yg,"__esModule",{value:!0});Yg.mergeEnumValues=void 0;var Vue=Js(),jue=_o();function $ue(e,t,n,r){if(n!=null&&n.consistentEnumMerge){let o=[];e&&o.push(...e),e=t,t=o}let i=new Map;if(e)for(let o of e)i.set(o.name.value,o);if(t)for(let o of t){let u=o.name.value;if(i.has(u)){let l=i.get(u);l.description=o.description||l.description,l.directives=(0,Vue.mergeDirectives)(o.directives,l.directives,r)}else i.set(u,o)}let s=[...i.values()];return n&&n.sort&&s.sort(jue.compareNodes),s}Yg.mergeEnumValues=$ue});var uR=j(Jg=>{"use strict";m();T();h();Object.defineProperty(Jg,"__esModule",{value:!0});Jg.mergeEnum=void 0;var que=(Le(),Me(je)),Kue=Js(),Gue=aR();function Que(e,t,n,r){return t?{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="EnumTypeDefinition"||t.kind==="EnumTypeDefinition"?"EnumTypeDefinition":"EnumTypeExtension",loc:e.loc,directives:(0,Kue.mergeDirectives)(e.directives,t.directives,n,r),values:(0,Gue.mergeEnumValues)(e.values,t.values,n)}:n!=null&&n.convertExtensions?G(k({},e),{kind:que.Kind.ENUM_TYPE_DEFINITION}):e}Jg.mergeEnum=Que});var zg=j(gr=>{"use strict";m();T();h();Object.defineProperty(gr,"__esModule",{value:!0});gr.defaultStringComparator=gr.CompareVal=gr.printTypeNode=gr.isNonNullTypeNode=gr.isListTypeNode=gr.isWrappingTypeNode=gr.extractType=gr.isSourceTypes=gr.isStringTypes=void 0;var rT=(Le(),Me(je));function Yue(e){return typeof e=="string"}gr.isStringTypes=Yue;function Jue(e){return e instanceof rT.Source}gr.isSourceTypes=Jue;function zue(e){let t=e;for(;t.kind===rT.Kind.LIST_TYPE||t.kind==="NonNullType";)t=t.type;return t}gr.extractType=zue;function Hue(e){return e.kind!==rT.Kind.NAMED_TYPE}gr.isWrappingTypeNode=Hue;function H$(e){return e.kind===rT.Kind.LIST_TYPE}gr.isListTypeNode=H$;function W$(e){return e.kind===rT.Kind.NON_NULL_TYPE}gr.isNonNullTypeNode=W$;function cR(e){return H$(e)?`[${cR(e.type)}]`:W$(e)?`${cR(e.type)}!`:e.name.value}gr.printTypeNode=cR;var Kl;(function(e){e[e.A_SMALLER_THAN_B=-1]="A_SMALLER_THAN_B",e[e.A_EQUALS_B=0]="A_EQUALS_B",e[e.A_GREATER_THAN_B=1]="A_GREATER_THAN_B"})(Kl=gr.CompareVal||(gr.CompareVal={}));function Wue(e,t){return e==null&&t==null?Kl.A_EQUALS_B:e==null?Kl.A_SMALLER_THAN_B:t==null?Kl.A_GREATER_THAN_B:et?Kl.A_GREATER_THAN_B:Kl.A_EQUALS_B}gr.defaultStringComparator=Wue});var sT=j(Hg=>{"use strict";m();T();h();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.mergeFields=void 0;var Yi=zg(),Xue=Js(),Zue=_o(),ece=oR();function tce(e,t){let n=e.findIndex(r=>r.name.value===t.name.value);return[n>-1?e[n]:null,n]}function nce(e,t,n,r,i){let s=[];if(n!=null&&s.push(...n),t!=null)for(let o of t){let[u,l]=tce(s,o);if(u&&!(r!=null&&r.ignoreFieldConflicts)){let d=(r==null?void 0:r.onFieldTypeConflict)&&r.onFieldTypeConflict(u,o,e,r==null?void 0:r.throwOnConflict)||rce(e,u,o,r==null?void 0:r.throwOnConflict);d.arguments=(0,ece.mergeArguments)(o.arguments||[],u.arguments||[],r),d.directives=(0,Xue.mergeDirectives)(o.directives,u.directives,r,i),d.description=o.description||u.description,s[l]=d}else s.push(o)}if(r&&r.sort&&s.sort(Zue.compareNodes),r&&r.exclusions){let o=r.exclusions;return s.filter(u=>!o.includes(`${e.name.value}.${u.name.value}`))}return s}Hg.mergeFields=nce;function rce(e,t,n,r=!1){let i=(0,Yi.printTypeNode)(t.type),s=(0,Yi.printTypeNode)(n.type);if(i!==s){let o=(0,Yi.extractType)(t.type),u=(0,Yi.extractType)(n.type);if(o.name.value!==u.name.value)throw new Error(`Field "${n.name.value}" already defined with a different type. Declared as "${o.name.value}", but you tried to override with "${u.name.value}"`);if(!iT(t.type,n.type,!r))throw new Error(`Field '${e.name.value}.${t.name.value}' changed type from '${i}' to '${s}'`)}return(0,Yi.isNonNullTypeNode)(n.type)&&!(0,Yi.isNonNullTypeNode)(t.type)&&(t.type=n.type),t}function iT(e,t,n=!1){if(!(0,Yi.isWrappingTypeNode)(e)&&!(0,Yi.isWrappingTypeNode)(t))return e.toString()===t.toString();if((0,Yi.isNonNullTypeNode)(t)){let r=(0,Yi.isNonNullTypeNode)(e)?e.type:e;return iT(r,t.type)}return(0,Yi.isNonNullTypeNode)(e)?iT(t,e,n):(0,Yi.isListTypeNode)(e)?(0,Yi.isListTypeNode)(t)&&iT(e.type,t.type)||(0,Yi.isNonNullTypeNode)(t)&&iT(e,t.type):!1}});var lR=j(Wg=>{"use strict";m();T();h();Object.defineProperty(Wg,"__esModule",{value:!0});Wg.mergeInputType=void 0;var ice=(Le(),Me(je)),sce=sT(),oce=Js();function ace(e,t,n,r){if(t)try{return{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="InputObjectTypeDefinition"||t.kind==="InputObjectTypeDefinition"?"InputObjectTypeDefinition":"InputObjectTypeExtension",loc:e.loc,fields:(0,sce.mergeFields)(e,e.fields,t.fields,n),directives:(0,oce.mergeDirectives)(e.directives,t.directives,n,r)}}catch(i){throw new Error(`Unable to merge GraphQL input type "${e.name.value}": ${i.message}`)}return n!=null&&n.convertExtensions?G(k({},e),{kind:ice.Kind.INPUT_OBJECT_TYPE_DEFINITION}):e}Wg.mergeInputType=ace});var oT=j(Xg=>{"use strict";m();T();h();Object.defineProperty(Xg,"__esModule",{value:!0});Xg.mergeNamedTypeArray=void 0;var uce=_o();function cce(e,t){return!!e.find(n=>n.name.value===t.name.value)}function lce(e=[],t=[],n={}){let r=[...t,...e.filter(i=>!cce(t,i))];return n&&n.sort&&r.sort(uce.compareNodes),r}Xg.mergeNamedTypeArray=lce});var dR=j(Zg=>{"use strict";m();T();h();Object.defineProperty(Zg,"__esModule",{value:!0});Zg.mergeInterface=void 0;var dce=(Le(),Me(je)),pce=sT(),fce=Js(),mce=oT();function hce(e,t,n,r){if(t)try{return{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="InterfaceTypeDefinition"||t.kind==="InterfaceTypeDefinition"?"InterfaceTypeDefinition":"InterfaceTypeExtension",loc:e.loc,fields:(0,pce.mergeFields)(e,e.fields,t.fields,n),directives:(0,fce.mergeDirectives)(e.directives,t.directives,n,r),interfaces:e.interfaces?(0,mce.mergeNamedTypeArray)(e.interfaces,t.interfaces,n):void 0}}catch(i){throw new Error(`Unable to merge GraphQL interface "${e.name.value}": ${i.message}`)}return n!=null&&n.convertExtensions?G(k({},e),{kind:dce.Kind.INTERFACE_TYPE_DEFINITION}):e}Zg.mergeInterface=hce});var pR=j(eI=>{"use strict";m();T();h();Object.defineProperty(eI,"__esModule",{value:!0});eI.mergeType=void 0;var Tce=(Le(),Me(je)),yce=sT(),Nce=Js(),Ece=oT();function gce(e,t,n,r){if(t)try{return{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="ObjectTypeDefinition"||t.kind==="ObjectTypeDefinition"?"ObjectTypeDefinition":"ObjectTypeExtension",loc:e.loc,fields:(0,yce.mergeFields)(e,e.fields,t.fields,n),directives:(0,Nce.mergeDirectives)(e.directives,t.directives,n,r),interfaces:(0,Ece.mergeNamedTypeArray)(e.interfaces,t.interfaces,n)}}catch(i){throw new Error(`Unable to merge GraphQL type "${e.name.value}": ${i.message}`)}return n!=null&&n.convertExtensions?G(k({},e),{kind:Tce.Kind.OBJECT_TYPE_DEFINITION}):e}eI.mergeType=gce});var fR=j(tI=>{"use strict";m();T();h();Object.defineProperty(tI,"__esModule",{value:!0});tI.mergeScalar=void 0;var Ice=(Le(),Me(je)),vce=Js();function _ce(e,t,n,r){return t?{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="ScalarTypeDefinition"||t.kind==="ScalarTypeDefinition"?"ScalarTypeDefinition":"ScalarTypeExtension",loc:e.loc,directives:(0,vce.mergeDirectives)(e.directives,t.directives,n,r)}:n!=null&&n.convertExtensions?G(k({},e),{kind:Ice.Kind.SCALAR_TYPE_DEFINITION}):e}tI.mergeScalar=_ce});var hR=j(nI=>{"use strict";m();T();h();Object.defineProperty(nI,"__esModule",{value:!0});nI.mergeUnion=void 0;var mR=(Le(),Me(je)),bce=Js(),Oce=oT();function Sce(e,t,n,r){return t?{name:e.name,description:e.description||t.description,directives:(0,bce.mergeDirectives)(e.directives,t.directives,n,r),kind:n!=null&&n.convertExtensions||e.kind==="UnionTypeDefinition"||t.kind==="UnionTypeDefinition"?mR.Kind.UNION_TYPE_DEFINITION:mR.Kind.UNION_TYPE_EXTENSION,loc:e.loc,types:(0,Oce.mergeNamedTypeArray)(e.types,t.types,n)}:n!=null&&n.convertExtensions?G(k({},e),{kind:mR.Kind.UNION_TYPE_DEFINITION}):e}nI.mergeUnion=Sce});var TR=j(Gl=>{"use strict";m();T();h();Object.defineProperty(Gl,"__esModule",{value:!0});Gl.mergeSchemaDefs=Gl.DEFAULT_OPERATION_TYPE_NAME_MAP=void 0;var aT=(Le(),Me(je)),Dce=Js();Gl.DEFAULT_OPERATION_TYPE_NAME_MAP={query:"Query",mutation:"Mutation",subscription:"Subscription"};function Ace(e=[],t=[]){let n=[];for(let r in Gl.DEFAULT_OPERATION_TYPE_NAME_MAP){let i=e.find(s=>s.operation===r)||t.find(s=>s.operation===r);i&&n.push(i)}return n}function Rce(e,t,n,r){return t?{kind:e.kind===aT.Kind.SCHEMA_DEFINITION||t.kind===aT.Kind.SCHEMA_DEFINITION?aT.Kind.SCHEMA_DEFINITION:aT.Kind.SCHEMA_EXTENSION,description:e.description||t.description,directives:(0,Dce.mergeDirectives)(e.directives,t.directives,n,r),operationTypes:Ace(e.operationTypes,t.operationTypes)}:n!=null&&n.convertExtensions?G(k({},e),{kind:aT.Kind.SCHEMA_DEFINITION}):e}Gl.mergeSchemaDefs=Rce});var yR=j(ca=>{"use strict";m();T();h();Object.defineProperty(ca,"__esModule",{value:!0});ca.mergeGraphQLNodes=ca.isNamedDefinitionNode=ca.schemaDefSymbol=void 0;var Ri=(Le(),Me(je)),Fce=pR(),wce=uR(),Lce=fR(),Pce=hR(),kce=lR(),Cce=dR(),xce=Js(),Uce=TR(),Mce=_o();ca.schemaDefSymbol="SCHEMA_DEF_SYMBOL";function X$(e){return"name"in e}ca.isNamedDefinitionNode=X$;function Bce(e,t,n={}){var i,s,o;let r=n;for(let u of e)if(X$(u)){let l=(i=u.name)==null?void 0:i.value;if(t!=null&&t.commentDescriptions&&(0,Mce.collectComment)(u),l==null)continue;if((s=t==null?void 0:t.exclusions)!=null&&s.includes(l+".*")||(o=t==null?void 0:t.exclusions)!=null&&o.includes(l))delete r[l];else switch(u.kind){case Ri.Kind.OBJECT_TYPE_DEFINITION:case Ri.Kind.OBJECT_TYPE_EXTENSION:r[l]=(0,Fce.mergeType)(u,r[l],t,n);break;case Ri.Kind.ENUM_TYPE_DEFINITION:case Ri.Kind.ENUM_TYPE_EXTENSION:r[l]=(0,wce.mergeEnum)(u,r[l],t,n);break;case Ri.Kind.UNION_TYPE_DEFINITION:case Ri.Kind.UNION_TYPE_EXTENSION:r[l]=(0,Pce.mergeUnion)(u,r[l],t,n);break;case Ri.Kind.SCALAR_TYPE_DEFINITION:case Ri.Kind.SCALAR_TYPE_EXTENSION:r[l]=(0,Lce.mergeScalar)(u,r[l],t,n);break;case Ri.Kind.INPUT_OBJECT_TYPE_DEFINITION:case Ri.Kind.INPUT_OBJECT_TYPE_EXTENSION:r[l]=(0,kce.mergeInputType)(u,r[l],t,n);break;case Ri.Kind.INTERFACE_TYPE_DEFINITION:case Ri.Kind.INTERFACE_TYPE_EXTENSION:r[l]=(0,Cce.mergeInterface)(u,r[l],t,n);break;case Ri.Kind.DIRECTIVE_DEFINITION:r[l]=(0,xce.mergeDirective)(u,r[l]);break}}else(u.kind===Ri.Kind.SCHEMA_DEFINITION||u.kind===Ri.Kind.SCHEMA_EXTENSION)&&(r[ca.schemaDefSymbol]=(0,Uce.mergeSchemaDefs)(u,r[ca.schemaDefSymbol],t));return r}ca.mergeGraphQLNodes=Bce});var tq=j(Kp=>{"use strict";m();T();h();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.mergeGraphQLTypes=Kp.mergeTypeDefs=void 0;var zs=(Le(),Me(je)),NR=zg(),jp=yR(),qp=_o(),Z$=TR();function Vce(e,t){(0,qp.resetComments)();let n={kind:zs.Kind.DOCUMENT,definitions:eq(e,k({useSchemaDefinition:!0,forceSchemaDefinition:!1,throwOnConflict:!1,commentDescriptions:!1},t))},r;return t!=null&&t.commentDescriptions?r=(0,qp.printWithComments)(n):r=n,(0,qp.resetComments)(),r}Kp.mergeTypeDefs=Vce;function $p(e,t,n=[],r=[],i=new Set){if(e&&!i.has(e))if(i.add(e),typeof e=="function")$p(e(),t,n,r,i);else if(Array.isArray(e))for(let s of e)$p(s,t,n,r,i);else if((0,zs.isSchema)(e)){let s=(0,qp.getDocumentNodeFromSchema)(e,t);$p(s.definitions,t,n,r,i)}else if((0,NR.isStringTypes)(e)||(0,NR.isSourceTypes)(e)){let s=(0,zs.parse)(e,t);$p(s.definitions,t,n,r,i)}else if(typeof e=="object"&&(0,zs.isDefinitionNode)(e))e.kind===zs.Kind.DIRECTIVE_DEFINITION?n.push(e):r.push(e);else if((0,qp.isDocumentNode)(e))$p(e.definitions,t,n,r,i);else throw new Error(`typeDefs must contain only strings, documents, schemas, or functions, got ${typeof e}`);return{allDirectives:n,allNodes:r}}function eq(e,t){var u,l,d;(0,qp.resetComments)();let{allDirectives:n,allNodes:r}=$p(e,t),i=(0,jp.mergeGraphQLNodes)(n,t),s=(0,jp.mergeGraphQLNodes)(r,t,i);if(t!=null&&t.useSchemaDefinition){let p=s[jp.schemaDefSymbol]||{kind:zs.Kind.SCHEMA_DEFINITION,operationTypes:[]},y=p.operationTypes;for(let N in Z$.DEFAULT_OPERATION_TYPE_NAME_MAP)if(!y.find(O=>O.operation===N)){let O=Z$.DEFAULT_OPERATION_TYPE_NAME_MAP[N],x=s[O];x!=null&&x.name!=null&&y.push({kind:zs.Kind.OPERATION_TYPE_DEFINITION,type:{kind:zs.Kind.NAMED_TYPE,name:x.name},operation:N})}((u=p==null?void 0:p.operationTypes)==null?void 0:u.length)!=null&&p.operationTypes.length>0&&(s[jp.schemaDefSymbol]=p)}t!=null&&t.forceSchemaDefinition&&!((d=(l=s[jp.schemaDefSymbol])==null?void 0:l.operationTypes)!=null&&d.length)&&(s[jp.schemaDefSymbol]={kind:zs.Kind.SCHEMA_DEFINITION,operationTypes:[{kind:zs.Kind.OPERATION_TYPE_DEFINITION,operation:"query",type:{kind:zs.Kind.NAMED_TYPE,name:{kind:zs.Kind.NAME,value:"Query"}}}]});let o=Object.values(s);if(t!=null&&t.sort){let p=typeof t.sort=="function"?t.sort:NR.defaultStringComparator;o.sort((y,N)=>{var I,O;return p((I=y.name)==null?void 0:I.value,(O=N.name)==null?void 0:O.value)})}return o}Kp.mergeGraphQLTypes=eq});var nq=j(fi=>{"use strict";m();T();h();Object.defineProperty(fi,"__esModule",{value:!0});var Ji=(uA(),Me(aA));Ji.__exportStar(oR(),fi);Ji.__exportStar(Js(),fi);Ji.__exportStar(aR(),fi);Ji.__exportStar(uR(),fi);Ji.__exportStar(sT(),fi);Ji.__exportStar(lR(),fi);Ji.__exportStar(dR(),fi);Ji.__exportStar(oT(),fi);Ji.__exportStar(yR(),fi);Ji.__exportStar(tq(),fi);Ji.__exportStar(fR(),fi);Ji.__exportStar(pR(),fi);Ji.__exportStar(hR(),fi);Ji.__exportStar(zg(),fi)});var iq=j(wc=>{"use strict";m();T();h();Object.defineProperty(wc,"__esModule",{value:!0});wc.applyExtensions=wc.mergeExtensions=wc.extractExtensionsFromSchema=void 0;var rq=_o(),jce=_o();Object.defineProperty(wc,"extractExtensionsFromSchema",{enumerable:!0,get:function(){return jce.extractExtensionsFromSchema}});function $ce(e){return(0,rq.mergeDeep)(e)}wc.mergeExtensions=$ce;function Gp(e,t){e&&(e.extensions=(0,rq.mergeDeep)([e.extensions||{},t||{}]))}function qce(e,t){Gp(e,t.schemaExtensions);for(let[n,r]of Object.entries(t.types||{})){let i=e.getType(n);if(i){if(Gp(i,r.extensions),r.type==="object"||r.type==="interface")for(let[s,o]of Object.entries(r.fields)){let u=i.getFields()[s];if(u){Gp(u,o.extensions);for(let[l,d]of Object.entries(o.arguments))Gp(u.args.find(p=>p.name===l),d)}}else if(r.type==="input")for(let[s,o]of Object.entries(r.fields)){let u=i.getFields()[s];Gp(u,o.extensions)}else if(r.type==="enum")for(let[s,o]of Object.entries(r.values)){let u=i.getValue(s);Gp(u,o)}}}return e}wc.applyExtensions=qce});var rI=j(uT=>{"use strict";m();T();h();Object.defineProperty(uT,"__esModule",{value:!0});var ER=(uA(),Me(aA));ER.__exportStar(G$(),uT);ER.__exportStar(nq(),uT);ER.__exportStar(iq(),uT)});var Jp=j(ft=>{"use strict";m();T();h();Object.defineProperty(ft,"__esModule",{value:!0});ft.FieldSetDirective=ft.MergeMethod=void 0;ft.newPersistedDirectivesData=oI;ft.isNodeExternalOrShareable=uq;ft.getDefinedArgumentsForDirective=cq;ft.getDirectiveValidationErrors=lq;ft.extractDirectives=vR;ft.extractArguments=Gce;ft.isTypeRequired=_R;ft.compareAndValidateInputValueDefaultValues=Qce;ft.addEnumValueDataByNode=Yce;ft.addInheritedDirectivesToFieldData=Jce;ft.addFieldDataByNode=zce;ft.addInputValueDataByNode=bR;ft.addPersistedDirectiveDefinitionDataByNode=Hce;ft.setMutualExecutableLocations=Wce;ft.isTypeNameRootType=Xce;ft.getRenamedRootTypeName=Zce;ft.getEnumNodeByData=nle;ft.getInputObjectNodeByData=rle;ft.getCompositeOutputNodeByData=ile;ft.getScalarNodeByData=sle;ft.getSchemaNodeByData=ole;ft.getUnionNodeByData=ale;ft.removeInheritableDirectivesFromParentWithFieldsData=ule;ft.setLongestDescription=cle;ft.isParentDataRootType=pq;ft.isParentDataInterfaceType=lle;ft.setParentDataExtensionType=dle;ft.extractPersistedDirectives=mle;ft.pushAuthorizationDirectives=hle;ft.getClientPersistedDirectiveNodes=IR;ft.getNodeForRouterSchemaByData=yle;ft.getNodeWithPersistedDirectivesByFieldData=Nle;ft.getClientSchemaFieldNodeByFieldData=Ele;ft.getNodeWithPersistedDirectivesByInputValueData=DR;ft.getValidFieldArgumentNodes=gle;ft.addValidPersistedDirectiveDefinitionNodeByData=vle;ft.newInvalidFieldNames=_le;ft.validateExternalAndShareable=ble;ft.isTypeValidImplementation=iI;ft.isNodeDataInaccessible=mq;ft.isLeafKind=Ole;ft.getSubscriptionFilterValue=Sle;ft.getParentTypeName=Dle;ft.newConditionalFieldData=Ale;var wt=(Le(),Me(je)),gR=Gh(),Qp=Qa(),Hs=$i(),Cr=To(),Kt=bi(),sq=Ql(),ys=ps(),sI=Oc(),Kce=rI();function oI(){return{deprecatedReason:"",directives:new Map,isDeprecated:!1,tags:new Map}}function uq(e,t,n){var i;let r={isExternal:n.has(Kt.EXTERNAL),isShareable:t||n.has(Kt.SHAREABLE)};if(!((i=e.directives)!=null&&i.length))return r;for(let s of e.directives){let o=s.name.value;if(o===Kt.EXTERNAL){r.isExternal=!0;continue}o===Kt.SHAREABLE&&(r.isShareable=!0)}return r}function cq(e,t,n,r,i){let s=e.arguments||[],o=e.name.value,u=new Set,l=new Set,d=new Set;for(let p of s){let y=p.name.value;if(u.has(y)){l.add(y);continue}if(!t.get(y)){d.add(y);continue}u.add(y)}return l.size>0&&i.push((0,Cr.duplicateDirectiveArgumentDefinitionsErrorMessage)(o,r,[...l])),d.size>0&&i.push((0,Cr.unexpectedDirectiveArgumentErrorMessage)(o,[...d])),u}function lq(e,t,n,r,i,s,o=!1){var O,x,V;let u=e.name.value,l=r.get(u)||sI.V2_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.get(u),d=[];if(!l)return d.push((0,Cr.undefinedDirectiveErrorMessage)(u,s)),d;let p=new Map,y=new Set;if((0,sq.getDirectiveDefinitionArgumentSets)(l.arguments||[],p,y),(0,sq.areNodeKindAndDirectiveLocationCompatible)(t,l,o)||d.push((0,Cr.invalidDirectiveLocationErrorMessage)(s,o?wt.Kind.ARGUMENT:t,u)),!l.repeatable&&n.get(u)){let K=(0,ys.getValueOrDefault)(i,s,()=>new Set);K.has(u)||(K.add(u),d.push((0,Cr.invalidRepeatedDirectiveErrorMessage)(u,s)))}if(!((O=l.arguments)!=null&&O.length))return(x=e.arguments)!=null&&x.length&&d.push((0,Cr.unexpectedDirectiveArgumentsErrorMessage)(e,s)),d;if(!((V=e.arguments)!=null&&V.length))return y.size>0&&d.push((0,Cr.undefinedRequiredArgumentsErrorMessage)(u,s,[...y])),d;let N=cq(e,p,y,s,d),I=(0,ys.getEntriesNotInHashSet)(y,N);return I.length>0&&d.push((0,Cr.undefinedRequiredArgumentsErrorMessage)(u,s,[...y],I)),d}function vR(e,t,n,r,i,s,o=!1){if(!e.directives)return t;let u=new Set;for(let l of e.directives){let d=lq(l,e.kind,t,r,i,s,o),p=l.name.value;if(d.length>0){n.push((0,Cr.invalidDirectiveError)(p,s,d));continue}if(Kt.IGNORED_PARENT_DIRECTIVES.has(p))continue;if(p===Kt.KEY){let N=l.arguments[0].value.value;if(u.has(N))continue;u.add(N)}let y=t.get(p);y?y.push(l):t.set(p,[l])}return t}function Gce(e,t,n,r,i,s,o,u,l){var I;if(!((I=t.arguments)!=null&&I.length))return e;let d=t.name.value,p=`${o}.${d}`,y=`${u}.${d}`;s.add(o);let N=new Set;for(let O of t.arguments){let x=O.name.value;if(e.has(x)){N.add(x);continue}bR(e,O,r,i,`${p}(${x}: ...)`,l,n,`${y}(${x}: ...)`)}return N.size>0&&n.push((0,Cr.duplicateArgumentsError)(p,[...N])),e}function _R(e){return e.kind===wt.Kind.NON_NULL_TYPE}function dq(e,t){switch(e.kind){case wt.Kind.LIST_TYPE:return t.kind===wt.Kind.LIST||t.kind===wt.Kind.NULL;case wt.Kind.NAMED_TYPE:if(t.kind===wt.Kind.NULL)return!0;switch(e.name.value){case Kt.BOOLEAN_SCALAR:return t.kind===wt.Kind.BOOLEAN;case Kt.FLOAT_SCALAR:return t.kind===wt.Kind.INT||t.kind===wt.Kind.FLOAT;case Kt.INT_SCALAR:return t.kind===wt.Kind.INT;case Kt.STRING_SCALAR:return t.kind===wt.Kind.STRING;default:return!0}case wt.Kind.NON_NULL_TYPE:return t.kind===wt.Kind.NULL?!1:dq(e.type,t)}}function Qce(e,t,n){if(!e.defaultValue)return;if(!t.defaultValue){e.includeDefaultValue=!1;return}let r=(0,wt.print)(e.defaultValue),i=(0,wt.print)(t.defaultValue);if(r!==i){n.push((0,Cr.incompatibleInputValueDefaultValuesError)(`${e.isArgument?Kt.ARGUMENT:Kt.INPUT_FIELD} "${e.name}"`,e.originalPath,[...t.subgraphNames],r,i));return}}function Yce(e,t,n,r,i,s){let o=t.name.value;e.set(o,{appearances:1,directivesByDirectiveName:vR(t,new Map,n,r,i,`${s}.${o}`),name:o,node:(0,Qp.getMutableEnumValueNode)(t),parentTypeName:s,persistedDirectivesData:oI(),description:(0,Hs.formatDescription)(t.description)})}function Jce(e,t){for(let n of sI.INHERITABLE_DIRECTIVE_NAMES)e.get(n)&&(0,ys.getValueOrDefault)(t,n,()=>[(0,ys.generateSimpleDirective)(n)]);return t}function zce(e,t,n,r,i,s,o,u,l){let d=t.name.value,p=`${i}.${d}`,y=uq(t,!u,r),N={argumentDataByArgumentName:n,isExternalBySubgraphName:new Map([[o,y.isExternal]]),isInaccessible:r.has(Kt.INACCESSIBLE),isShareableBySubgraphName:new Map([[o,y.isShareable]]),node:(0,Qp.getMutableFieldNode)(t,p,l),name:d,namedTypeName:(0,Qp.getTypeNodeNamedTypeName)(t.type),originalParentTypeName:i,persistedDirectivesData:oI(),renamedParentTypeName:s,subgraphNames:new Set([o]),type:(0,Qp.getMutableTypeNode)(t.type,p,l),directivesByDirectiveName:r,description:(0,Hs.formatDescription)(t.description)};return e.set(d,N),N}function bR(e,t,n,r,i,s,o,u){let l=t.name.value,d=!!u;t.defaultValue&&!dq(t.type,t.defaultValue)&&o.push((0,Cr.incompatibleInputValueDefaultValueTypeError)((d?Kt.ARGUMENT:Kt.INPUT_FIELD)+` "${l}"`,i,(0,Kce.printTypeNode)(t.type),(0,wt.print)(t.defaultValue))),e.set(l,{directivesByDirectiveName:vR(t,new Map,o,n,r,i,d),includeDefaultValue:!!t.defaultValue,isArgument:d,name:l,node:(0,Qp.getMutableInputValueNode)(t,i,o),originalPath:i,persistedDirectivesData:oI(),renamedPath:u||i,requiredSubgraphNames:new Set(_R(t.type)?[s]:[]),subgraphNames:new Set([s]),type:(0,Qp.getMutableTypeNode)(t.type,i,o),defaultValue:t.defaultValue,description:(0,Hs.formatDescription)(t.description)})}function Hce(e,t,n,r,i,s,o){let u=t.name.value,l=new Map;for(let d of t.arguments||[]){let p=`@${u}(${d.name.value}: ...)`;bR(l,d,r,i,p,o,n,p)}e.set(u,{argumentDataByArgumentName:l,executableLocations:s,name:u,repeatable:t.repeatable,subgraphNames:new Set([o]),description:(0,Hs.formatDescription)(t.description)})}function Wce(e,t){let n=new Set;for(let r of t)e.executableLocations.has(r)&&n.add(r);e.executableLocations=n}function Xce(e,t){return Kt.ROOT_TYPE_NAMES.has(e)||t.has(e)}function Zce(e,t){let n=t.get(e);if(!n)return e;switch(n){case wt.OperationTypeNode.MUTATION:return Kt.MUTATION;case wt.OperationTypeNode.SUBSCRIPTION:return Kt.SUBSCRIPTION;default:return Kt.QUERY}}function ele(e,t){let n=e.get(t.originalParentTypeName);if(!n)return;let r=n.fieldAuthorizationDataByFieldName.get(t.name);if(r){if(r.requiresAuthentication){let i=(0,ys.generateSimpleDirective)(Kt.AUTHENTICATED);t.directivesByDirectiveName.set(Kt.AUTHENTICATED,[i])}if(r.requiredScopes.length>0){let i=(0,ys.generateRequiresScopesDirective)(r.requiredScopes);t.directivesByDirectiveName.set(Kt.REQUIRES_SCOPES,[i])}}}function tle(e){for(let t of e.argumentDataByArgumentName.values()){for(let n of t.directivesByDirectiveName.values())t.node.directives.push(...n);e.node.arguments.push(t.node)}}function OR(e,t){let n=[];for(let r of e.values()){if(r.node.kind===wt.Kind.FIELD_DEFINITION){let i=r;ele(t,i),tle(i)}for(let i of r.directivesByDirectiveName.values())r.node.directives.push(...i);n.push(r.node)}return n}function Yp(e,t,n,r){let i=[];for(let[s,o]of e){let u=n.get(s)||sI.V2_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.get(s);if(!u)continue;if(!u.repeatable&&o.length>1){t.push((0,Cr.invalidDirectiveError)(s,r,[(0,Cr.invalidRepeatedDirectiveErrorMessage)(s,r)]));continue}if(s!==Kt.KEY){i.push(...o);continue}let l=[],d=new Set,p=[];for(let y of o){let N=y.arguments[0].value;if(N.kind!==wt.Kind.STRING){p.push((0,Cr.invalidKeyDirectiveArgumentErrorMessage)(N.kind));continue}let I=N.value;d.has(I)||(d.add(I),i.push(y),l.push(y))}e.set(s,l),p.length>0&&t.push((0,Cr.invalidDirectiveError)(s,r,p))}return i}function nle(e,t,n,r){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node.values=OR(e.enumValueDataByValueName,r),e.node}function rle(e,t,n,r){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node.fields=OR(e.inputValueDataByValueName,r),e.node}function ile(e,t,n,r){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node.fields=OR(e.fieldDataByFieldName,r),e.node.interfaces=(0,Hs.setToNamedTypeNodeArray)(e.implementedInterfaceTypeNames),e.node}function sle(e,t,n){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node}function ole(e,t,n){return{description:e.description,directives:Yp(e.directivesByDirectiveName,t,n,e.typeName),kind:e.kind,operationTypes:(0,ys.mapToArrayOfValues)(e.operationTypes)}}function ale(e,t,n){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node.types=(0,ys.mapToArrayOfValues)(e.memberByMemberTypeName),e.node}function ule(e){for(let t of sI.INHERITABLE_DIRECTIVE_NAMES)e.directivesByDirectiveName.delete(t)}function cle(e,t){t.description&&(!e.description||e.description.value.length0&&e.persistedDirectivesData.directives.set(Kt.REQUIRES_SCOPES,[(0,ys.generateRequiresScopesDirective)(n.requiredScopes)]))}function fq(e){return{kind:wt.Kind.DIRECTIVE,name:(0,Hs.stringToNameNode)(Kt.DEPRECATED),arguments:[{kind:wt.Kind.ARGUMENT,name:(0,Hs.stringToNameNode)(Kt.REASON),value:{kind:wt.Kind.STRING,value:e||Kt.DEPRECATED_DEFAULT_ARGUMENT_VALUE}}]}}function Tle(e,t,n,r){let i=[];for(let[s,o]of e){let u=t.get(s);if(u){if(o.length<2){i.push(...o);continue}if(!u.repeatable){r.push((0,Cr.invalidRepeatedFederatedDirectiveErrorMessage)(s,n));continue}i.push(...o)}}return i}function SR(e,t,n){let r=[...e.persistedDirectivesData.tags.values()];return e.persistedDirectivesData.isDeprecated&&r.push(fq(e.persistedDirectivesData.deprecatedReason)),r.push(...Tle(e.persistedDirectivesData.directives,t,e.name,n)),r}function IR(e){let t=[];e.persistedDirectivesData.isDeprecated&&t.push(fq(e.persistedDirectivesData.deprecatedReason));for(let[n,r]of e.persistedDirectivesData.directives)Kt.PERSISTED_CLIENT_DIRECTIVES.has(n)&&t.push(r[0]);return t}function yle(e,t,n){return e.node.name=(0,Hs.stringToNameNode)(e.name),e.node.description=e.description,e.node.directives=SR(e,t,n),e.node}function Nle(e,t,n,r){return e.node.arguments=n,e.node.name=(0,Hs.stringToNameNode)(e.name),e.node.type=e.type,e.node.description=e.description,e.node.directives=SR(e,t,r),e.node}function Ele(e){let t=IR(e),n=[];for(let r of e.argumentDataByArgumentName.values())mq(r)||n.push(G(k({},r.node),{directives:IR(r)}));return G(k({},e.node),{directives:t,arguments:n})}function DR(e,t,n){return e.node.name=(0,Hs.stringToNameNode)(e.name),e.node.type=e.type,e.node.description=e.description,e.node.directives=SR(e,t,n),e.includeDefaultValue&&(e.node.defaultValue=e.defaultValue),e.node}function gle(e,t,n,r){let i=[],s=[],o=[],u=`${e.renamedParentTypeName}.${e.name}`;for(let[l,d]of e.argumentDataByArgumentName)e.subgraphNames.size===d.subgraphNames.size?(s.push(l),i.push(DR(d,t,r))):_R(d.type)&&o.push({inputValueName:l,missingSubgraphs:(0,ys.getEntriesNotInHashSet)(e.subgraphNames,d.subgraphNames),requiredSubgraphs:[...d.requiredSubgraphNames]});return o.length>0?r.push((0,Cr.invalidRequiredInputValueError)(Kt.FIELD,u,o)):s.length>0&&((0,ys.getValueOrDefault)(n,u,()=>({argumentNames:s,fieldName:e.name,typeName:e.renamedParentTypeName})).argumentNames=s),i}function Ile(e,t,n,r,i){let s=[];for(let[o,u]of t.argumentDataByArgumentName){let l=(0,ys.getEntriesNotInHashSet)(t.subgraphNames,u.subgraphNames);if(l.length>0){u.requiredSubgraphNames.size>0&&s.push({inputValueName:o,missingSubgraphs:l,requiredSubgraphs:[...u.requiredSubgraphNames]});continue}e.push(DR(u,n,r)),i&&i.add(o)}return s.length>0?(r.push((0,Cr.invalidRequiredInputValueError)(Kt.DIRECTIVE_DEFINITION,`@${t.name}`,s)),!1):!0}function vle(e,t,n,r){let i=[];Ile(i,t,n,r)&&e.push({arguments:i,kind:wt.Kind.DIRECTIVE_DEFINITION,locations:(0,Hs.setToNameNodeArray)(t.executableLocations),name:(0,Hs.stringToNameNode)(t.name),repeatable:t.repeatable,description:t.description})}function _le(){return{byShareable:new Set,subgraphNamesByExternalFieldName:new Map}}function ble(e,t){let n=e.isShareableBySubgraphName.size,r=[],i=0;for(let[s,o]of e.isShareableBySubgraphName){if(e.isExternalBySubgraphName.get(s)){r.push(s);continue}o||(i+=1)}switch(i){case 0:n===r.length&&t.subgraphNamesByExternalFieldName.set(e.name,r);return;case 1:if(n===1)return;n-r.length!==1&&t.byShareable.add(e.name);return;default:t.byShareable.add(e.name)}}var oq;(function(e){e[e.UNION=0]="UNION",e[e.INTERSECTION=1]="INTERSECTION",e[e.CONSISTENT=2]="CONSISTENT"})(oq||(ft.MergeMethod=oq={}));function iI(e,t,n){if(e.kind===wt.Kind.NON_NULL_TYPE)return t.kind!==wt.Kind.NON_NULL_TYPE?!1:iI(e.type,t.type,n);if(t.kind===wt.Kind.NON_NULL_TYPE)return iI(e,t.type,n);switch(e.kind){case wt.Kind.NAMED_TYPE:if(t.kind===wt.Kind.NAMED_TYPE){let r=e.name.value,i=t.name.value;if(r===i)return!0;let s=n.get(r);return s?s.has(i):!1}return!1;default:return t.kind===wt.Kind.LIST_TYPE?iI(e.type,t.type,n):!1}}function mq(e){return e.persistedDirectivesData.directives.has(Kt.INACCESSIBLE)||e.directivesByDirectiveName.has(Kt.INACCESSIBLE)}function Ole(e){return e===wt.Kind.SCALAR_TYPE_DEFINITION||e===wt.Kind.ENUM_TYPE_DEFINITION}function Sle(e){switch(e.kind){case wt.Kind.BOOLEAN:return e.value;case wt.Kind.ENUM:case wt.Kind.STRING:return e.value;case wt.Kind.FLOAT:case wt.Kind.INT:try{return parseFloat(e.value)}catch(t){return"NaN"}case wt.Kind.NULL:return null}}function Dle(e){return e.kind===wt.Kind.OBJECT_TYPE_DEFINITION?e.renamedTypeName:e.name}var aq;(function(e){e.PROVIDES="provides",e.REQUIRES="requires"})(aq||(ft.FieldSetDirective=aq={}));function Ale(){return{providedBy:[],requiredBy:[]}}});var cT=j(bo=>{"use strict";m();T();h();Object.defineProperty(bo,"__esModule",{value:!0});bo.Warning=void 0;bo.invalidOverrideTargetSubgraphNameWarning=Rle;bo.externalInterfaceFieldsWarning=Fle;bo.nonExternalConditionalFieldWarning=wle;bo.unimplementedInterfaceOutputTypeWarning=Lle;bo.invalidExternalFieldWarning=Ple;bo.requiresDefinedOnNonEntityFieldWarning=kle;bo.consumerInactiveThresholdInvalidValueWarning=Cle;var hq=bi(),la=class extends Error{constructor(n){super(n.message);A(this,"subgraph");this.name="Warning",this.subgraph=n.subgraph}};bo.Warning=la;function Rle(e,t,n,r){return new la({message:`The Object type "${t}" defines the directive "@override(from: "${e}")" on the following field`+(n.length>1?"s":"")+': "'+n.join(hq.QUOTATION_JOIN)+`". + ${n}`)}function Mue(e,t){return t?(Uue(e,t),G(k({},e),{locations:[...t.locations,...e.locations.filter(n=>!kue(n,t.locations))]})):e}Vp.mergeDirective=Mue;function Bue(e,t,n){return e.concat(t.filter(r=>n(r,e)))}});var aR=j(Yg=>{"use strict";m();T();h();Object.defineProperty(Yg,"__esModule",{value:!0});Yg.mergeEnumValues=void 0;var Vue=Js(),jue=_o();function $ue(e,t,n,r){if(n!=null&&n.consistentEnumMerge){let o=[];e&&o.push(...e),e=t,t=o}let i=new Map;if(e)for(let o of e)i.set(o.name.value,o);if(t)for(let o of t){let u=o.name.value;if(i.has(u)){let l=i.get(u);l.description=o.description||l.description,l.directives=(0,Vue.mergeDirectives)(o.directives,l.directives,r)}else i.set(u,o)}let s=[...i.values()];return n&&n.sort&&s.sort(jue.compareNodes),s}Yg.mergeEnumValues=$ue});var uR=j(Jg=>{"use strict";m();T();h();Object.defineProperty(Jg,"__esModule",{value:!0});Jg.mergeEnum=void 0;var que=(Le(),Me(je)),Kue=Js(),Gue=aR();function Que(e,t,n,r){return t?{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="EnumTypeDefinition"||t.kind==="EnumTypeDefinition"?"EnumTypeDefinition":"EnumTypeExtension",loc:e.loc,directives:(0,Kue.mergeDirectives)(e.directives,t.directives,n,r),values:(0,Gue.mergeEnumValues)(e.values,t.values,n)}:n!=null&&n.convertExtensions?G(k({},e),{kind:que.Kind.ENUM_TYPE_DEFINITION}):e}Jg.mergeEnum=Que});var zg=j(gr=>{"use strict";m();T();h();Object.defineProperty(gr,"__esModule",{value:!0});gr.defaultStringComparator=gr.CompareVal=gr.printTypeNode=gr.isNonNullTypeNode=gr.isListTypeNode=gr.isWrappingTypeNode=gr.extractType=gr.isSourceTypes=gr.isStringTypes=void 0;var rT=(Le(),Me(je));function Yue(e){return typeof e=="string"}gr.isStringTypes=Yue;function Jue(e){return e instanceof rT.Source}gr.isSourceTypes=Jue;function zue(e){let t=e;for(;t.kind===rT.Kind.LIST_TYPE||t.kind==="NonNullType";)t=t.type;return t}gr.extractType=zue;function Hue(e){return e.kind!==rT.Kind.NAMED_TYPE}gr.isWrappingTypeNode=Hue;function H$(e){return e.kind===rT.Kind.LIST_TYPE}gr.isListTypeNode=H$;function W$(e){return e.kind===rT.Kind.NON_NULL_TYPE}gr.isNonNullTypeNode=W$;function cR(e){return H$(e)?`[${cR(e.type)}]`:W$(e)?`${cR(e.type)}!`:e.name.value}gr.printTypeNode=cR;var Kl;(function(e){e[e.A_SMALLER_THAN_B=-1]="A_SMALLER_THAN_B",e[e.A_EQUALS_B=0]="A_EQUALS_B",e[e.A_GREATER_THAN_B=1]="A_GREATER_THAN_B"})(Kl=gr.CompareVal||(gr.CompareVal={}));function Wue(e,t){return e==null&&t==null?Kl.A_EQUALS_B:e==null?Kl.A_SMALLER_THAN_B:t==null?Kl.A_GREATER_THAN_B:et?Kl.A_GREATER_THAN_B:Kl.A_EQUALS_B}gr.defaultStringComparator=Wue});var sT=j(Hg=>{"use strict";m();T();h();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.mergeFields=void 0;var Yi=zg(),Xue=Js(),Zue=_o(),ece=oR();function tce(e,t){let n=e.findIndex(r=>r.name.value===t.name.value);return[n>-1?e[n]:null,n]}function nce(e,t,n,r,i){let s=[];if(n!=null&&s.push(...n),t!=null)for(let o of t){let[u,l]=tce(s,o);if(u&&!(r!=null&&r.ignoreFieldConflicts)){let d=(r==null?void 0:r.onFieldTypeConflict)&&r.onFieldTypeConflict(u,o,e,r==null?void 0:r.throwOnConflict)||rce(e,u,o,r==null?void 0:r.throwOnConflict);d.arguments=(0,ece.mergeArguments)(o.arguments||[],u.arguments||[],r),d.directives=(0,Xue.mergeDirectives)(o.directives,u.directives,r,i),d.description=o.description||u.description,s[l]=d}else s.push(o)}if(r&&r.sort&&s.sort(Zue.compareNodes),r&&r.exclusions){let o=r.exclusions;return s.filter(u=>!o.includes(`${e.name.value}.${u.name.value}`))}return s}Hg.mergeFields=nce;function rce(e,t,n,r=!1){let i=(0,Yi.printTypeNode)(t.type),s=(0,Yi.printTypeNode)(n.type);if(i!==s){let o=(0,Yi.extractType)(t.type),u=(0,Yi.extractType)(n.type);if(o.name.value!==u.name.value)throw new Error(`Field "${n.name.value}" already defined with a different type. Declared as "${o.name.value}", but you tried to override with "${u.name.value}"`);if(!iT(t.type,n.type,!r))throw new Error(`Field '${e.name.value}.${t.name.value}' changed type from '${i}' to '${s}'`)}return(0,Yi.isNonNullTypeNode)(n.type)&&!(0,Yi.isNonNullTypeNode)(t.type)&&(t.type=n.type),t}function iT(e,t,n=!1){if(!(0,Yi.isWrappingTypeNode)(e)&&!(0,Yi.isWrappingTypeNode)(t))return e.toString()===t.toString();if((0,Yi.isNonNullTypeNode)(t)){let r=(0,Yi.isNonNullTypeNode)(e)?e.type:e;return iT(r,t.type)}return(0,Yi.isNonNullTypeNode)(e)?iT(t,e,n):(0,Yi.isListTypeNode)(e)?(0,Yi.isListTypeNode)(t)&&iT(e.type,t.type)||(0,Yi.isNonNullTypeNode)(t)&&iT(e,t.type):!1}});var lR=j(Wg=>{"use strict";m();T();h();Object.defineProperty(Wg,"__esModule",{value:!0});Wg.mergeInputType=void 0;var ice=(Le(),Me(je)),sce=sT(),oce=Js();function ace(e,t,n,r){if(t)try{return{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="InputObjectTypeDefinition"||t.kind==="InputObjectTypeDefinition"?"InputObjectTypeDefinition":"InputObjectTypeExtension",loc:e.loc,fields:(0,sce.mergeFields)(e,e.fields,t.fields,n),directives:(0,oce.mergeDirectives)(e.directives,t.directives,n,r)}}catch(i){throw new Error(`Unable to merge GraphQL input type "${e.name.value}": ${i.message}`)}return n!=null&&n.convertExtensions?G(k({},e),{kind:ice.Kind.INPUT_OBJECT_TYPE_DEFINITION}):e}Wg.mergeInputType=ace});var oT=j(Xg=>{"use strict";m();T();h();Object.defineProperty(Xg,"__esModule",{value:!0});Xg.mergeNamedTypeArray=void 0;var uce=_o();function cce(e,t){return!!e.find(n=>n.name.value===t.name.value)}function lce(e=[],t=[],n={}){let r=[...t,...e.filter(i=>!cce(t,i))];return n&&n.sort&&r.sort(uce.compareNodes),r}Xg.mergeNamedTypeArray=lce});var dR=j(Zg=>{"use strict";m();T();h();Object.defineProperty(Zg,"__esModule",{value:!0});Zg.mergeInterface=void 0;var dce=(Le(),Me(je)),pce=sT(),fce=Js(),mce=oT();function hce(e,t,n,r){if(t)try{return{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="InterfaceTypeDefinition"||t.kind==="InterfaceTypeDefinition"?"InterfaceTypeDefinition":"InterfaceTypeExtension",loc:e.loc,fields:(0,pce.mergeFields)(e,e.fields,t.fields,n),directives:(0,fce.mergeDirectives)(e.directives,t.directives,n,r),interfaces:e.interfaces?(0,mce.mergeNamedTypeArray)(e.interfaces,t.interfaces,n):void 0}}catch(i){throw new Error(`Unable to merge GraphQL interface "${e.name.value}": ${i.message}`)}return n!=null&&n.convertExtensions?G(k({},e),{kind:dce.Kind.INTERFACE_TYPE_DEFINITION}):e}Zg.mergeInterface=hce});var pR=j(eI=>{"use strict";m();T();h();Object.defineProperty(eI,"__esModule",{value:!0});eI.mergeType=void 0;var Tce=(Le(),Me(je)),yce=sT(),Nce=Js(),Ece=oT();function gce(e,t,n,r){if(t)try{return{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="ObjectTypeDefinition"||t.kind==="ObjectTypeDefinition"?"ObjectTypeDefinition":"ObjectTypeExtension",loc:e.loc,fields:(0,yce.mergeFields)(e,e.fields,t.fields,n),directives:(0,Nce.mergeDirectives)(e.directives,t.directives,n,r),interfaces:(0,Ece.mergeNamedTypeArray)(e.interfaces,t.interfaces,n)}}catch(i){throw new Error(`Unable to merge GraphQL type "${e.name.value}": ${i.message}`)}return n!=null&&n.convertExtensions?G(k({},e),{kind:Tce.Kind.OBJECT_TYPE_DEFINITION}):e}eI.mergeType=gce});var fR=j(tI=>{"use strict";m();T();h();Object.defineProperty(tI,"__esModule",{value:!0});tI.mergeScalar=void 0;var Ice=(Le(),Me(je)),vce=Js();function _ce(e,t,n,r){return t?{name:e.name,description:e.description||t.description,kind:n!=null&&n.convertExtensions||e.kind==="ScalarTypeDefinition"||t.kind==="ScalarTypeDefinition"?"ScalarTypeDefinition":"ScalarTypeExtension",loc:e.loc,directives:(0,vce.mergeDirectives)(e.directives,t.directives,n,r)}:n!=null&&n.convertExtensions?G(k({},e),{kind:Ice.Kind.SCALAR_TYPE_DEFINITION}):e}tI.mergeScalar=_ce});var hR=j(nI=>{"use strict";m();T();h();Object.defineProperty(nI,"__esModule",{value:!0});nI.mergeUnion=void 0;var mR=(Le(),Me(je)),bce=Js(),Oce=oT();function Sce(e,t,n,r){return t?{name:e.name,description:e.description||t.description,directives:(0,bce.mergeDirectives)(e.directives,t.directives,n,r),kind:n!=null&&n.convertExtensions||e.kind==="UnionTypeDefinition"||t.kind==="UnionTypeDefinition"?mR.Kind.UNION_TYPE_DEFINITION:mR.Kind.UNION_TYPE_EXTENSION,loc:e.loc,types:(0,Oce.mergeNamedTypeArray)(e.types,t.types,n)}:n!=null&&n.convertExtensions?G(k({},e),{kind:mR.Kind.UNION_TYPE_DEFINITION}):e}nI.mergeUnion=Sce});var TR=j(Gl=>{"use strict";m();T();h();Object.defineProperty(Gl,"__esModule",{value:!0});Gl.mergeSchemaDefs=Gl.DEFAULT_OPERATION_TYPE_NAME_MAP=void 0;var aT=(Le(),Me(je)),Dce=Js();Gl.DEFAULT_OPERATION_TYPE_NAME_MAP={query:"Query",mutation:"Mutation",subscription:"Subscription"};function Ace(e=[],t=[]){let n=[];for(let r in Gl.DEFAULT_OPERATION_TYPE_NAME_MAP){let i=e.find(s=>s.operation===r)||t.find(s=>s.operation===r);i&&n.push(i)}return n}function Rce(e,t,n,r){return t?{kind:e.kind===aT.Kind.SCHEMA_DEFINITION||t.kind===aT.Kind.SCHEMA_DEFINITION?aT.Kind.SCHEMA_DEFINITION:aT.Kind.SCHEMA_EXTENSION,description:e.description||t.description,directives:(0,Dce.mergeDirectives)(e.directives,t.directives,n,r),operationTypes:Ace(e.operationTypes,t.operationTypes)}:n!=null&&n.convertExtensions?G(k({},e),{kind:aT.Kind.SCHEMA_DEFINITION}):e}Gl.mergeSchemaDefs=Rce});var yR=j(ca=>{"use strict";m();T();h();Object.defineProperty(ca,"__esModule",{value:!0});ca.mergeGraphQLNodes=ca.isNamedDefinitionNode=ca.schemaDefSymbol=void 0;var Ri=(Le(),Me(je)),Fce=pR(),wce=uR(),Lce=fR(),Pce=hR(),kce=lR(),Cce=dR(),xce=Js(),Uce=TR(),Mce=_o();ca.schemaDefSymbol="SCHEMA_DEF_SYMBOL";function X$(e){return"name"in e}ca.isNamedDefinitionNode=X$;function Bce(e,t,n={}){var i,s,o;let r=n;for(let u of e)if(X$(u)){let l=(i=u.name)==null?void 0:i.value;if(t!=null&&t.commentDescriptions&&(0,Mce.collectComment)(u),l==null)continue;if((s=t==null?void 0:t.exclusions)!=null&&s.includes(l+".*")||(o=t==null?void 0:t.exclusions)!=null&&o.includes(l))delete r[l];else switch(u.kind){case Ri.Kind.OBJECT_TYPE_DEFINITION:case Ri.Kind.OBJECT_TYPE_EXTENSION:r[l]=(0,Fce.mergeType)(u,r[l],t,n);break;case Ri.Kind.ENUM_TYPE_DEFINITION:case Ri.Kind.ENUM_TYPE_EXTENSION:r[l]=(0,wce.mergeEnum)(u,r[l],t,n);break;case Ri.Kind.UNION_TYPE_DEFINITION:case Ri.Kind.UNION_TYPE_EXTENSION:r[l]=(0,Pce.mergeUnion)(u,r[l],t,n);break;case Ri.Kind.SCALAR_TYPE_DEFINITION:case Ri.Kind.SCALAR_TYPE_EXTENSION:r[l]=(0,Lce.mergeScalar)(u,r[l],t,n);break;case Ri.Kind.INPUT_OBJECT_TYPE_DEFINITION:case Ri.Kind.INPUT_OBJECT_TYPE_EXTENSION:r[l]=(0,kce.mergeInputType)(u,r[l],t,n);break;case Ri.Kind.INTERFACE_TYPE_DEFINITION:case Ri.Kind.INTERFACE_TYPE_EXTENSION:r[l]=(0,Cce.mergeInterface)(u,r[l],t,n);break;case Ri.Kind.DIRECTIVE_DEFINITION:r[l]=(0,xce.mergeDirective)(u,r[l]);break}}else(u.kind===Ri.Kind.SCHEMA_DEFINITION||u.kind===Ri.Kind.SCHEMA_EXTENSION)&&(r[ca.schemaDefSymbol]=(0,Uce.mergeSchemaDefs)(u,r[ca.schemaDefSymbol],t));return r}ca.mergeGraphQLNodes=Bce});var tq=j(Kp=>{"use strict";m();T();h();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.mergeGraphQLTypes=Kp.mergeTypeDefs=void 0;var zs=(Le(),Me(je)),NR=zg(),jp=yR(),qp=_o(),Z$=TR();function Vce(e,t){(0,qp.resetComments)();let n={kind:zs.Kind.DOCUMENT,definitions:eq(e,k({useSchemaDefinition:!0,forceSchemaDefinition:!1,throwOnConflict:!1,commentDescriptions:!1},t))},r;return t!=null&&t.commentDescriptions?r=(0,qp.printWithComments)(n):r=n,(0,qp.resetComments)(),r}Kp.mergeTypeDefs=Vce;function $p(e,t,n=[],r=[],i=new Set){if(e&&!i.has(e))if(i.add(e),typeof e=="function")$p(e(),t,n,r,i);else if(Array.isArray(e))for(let s of e)$p(s,t,n,r,i);else if((0,zs.isSchema)(e)){let s=(0,qp.getDocumentNodeFromSchema)(e,t);$p(s.definitions,t,n,r,i)}else if((0,NR.isStringTypes)(e)||(0,NR.isSourceTypes)(e)){let s=(0,zs.parse)(e,t);$p(s.definitions,t,n,r,i)}else if(typeof e=="object"&&(0,zs.isDefinitionNode)(e))e.kind===zs.Kind.DIRECTIVE_DEFINITION?n.push(e):r.push(e);else if((0,qp.isDocumentNode)(e))$p(e.definitions,t,n,r,i);else throw new Error(`typeDefs must contain only strings, documents, schemas, or functions, got ${typeof e}`);return{allDirectives:n,allNodes:r}}function eq(e,t){var u,l,d;(0,qp.resetComments)();let{allDirectives:n,allNodes:r}=$p(e,t),i=(0,jp.mergeGraphQLNodes)(n,t),s=(0,jp.mergeGraphQLNodes)(r,t,i);if(t!=null&&t.useSchemaDefinition){let p=s[jp.schemaDefSymbol]||{kind:zs.Kind.SCHEMA_DEFINITION,operationTypes:[]},y=p.operationTypes;for(let N in Z$.DEFAULT_OPERATION_TYPE_NAME_MAP)if(!y.find(O=>O.operation===N)){let O=Z$.DEFAULT_OPERATION_TYPE_NAME_MAP[N],x=s[O];x!=null&&x.name!=null&&y.push({kind:zs.Kind.OPERATION_TYPE_DEFINITION,type:{kind:zs.Kind.NAMED_TYPE,name:x.name},operation:N})}((u=p==null?void 0:p.operationTypes)==null?void 0:u.length)!=null&&p.operationTypes.length>0&&(s[jp.schemaDefSymbol]=p)}t!=null&&t.forceSchemaDefinition&&!((d=(l=s[jp.schemaDefSymbol])==null?void 0:l.operationTypes)!=null&&d.length)&&(s[jp.schemaDefSymbol]={kind:zs.Kind.SCHEMA_DEFINITION,operationTypes:[{kind:zs.Kind.OPERATION_TYPE_DEFINITION,operation:"query",type:{kind:zs.Kind.NAMED_TYPE,name:{kind:zs.Kind.NAME,value:"Query"}}}]});let o=Object.values(s);if(t!=null&&t.sort){let p=typeof t.sort=="function"?t.sort:NR.defaultStringComparator;o.sort((y,N)=>{var I,O;return p((I=y.name)==null?void 0:I.value,(O=N.name)==null?void 0:O.value)})}return o}Kp.mergeGraphQLTypes=eq});var nq=j(fi=>{"use strict";m();T();h();Object.defineProperty(fi,"__esModule",{value:!0});var Ji=(uA(),Me(aA));Ji.__exportStar(oR(),fi);Ji.__exportStar(Js(),fi);Ji.__exportStar(aR(),fi);Ji.__exportStar(uR(),fi);Ji.__exportStar(sT(),fi);Ji.__exportStar(lR(),fi);Ji.__exportStar(dR(),fi);Ji.__exportStar(oT(),fi);Ji.__exportStar(yR(),fi);Ji.__exportStar(tq(),fi);Ji.__exportStar(fR(),fi);Ji.__exportStar(pR(),fi);Ji.__exportStar(hR(),fi);Ji.__exportStar(zg(),fi)});var iq=j(wc=>{"use strict";m();T();h();Object.defineProperty(wc,"__esModule",{value:!0});wc.applyExtensions=wc.mergeExtensions=wc.extractExtensionsFromSchema=void 0;var rq=_o(),jce=_o();Object.defineProperty(wc,"extractExtensionsFromSchema",{enumerable:!0,get:function(){return jce.extractExtensionsFromSchema}});function $ce(e){return(0,rq.mergeDeep)(e)}wc.mergeExtensions=$ce;function Gp(e,t){e&&(e.extensions=(0,rq.mergeDeep)([e.extensions||{},t||{}]))}function qce(e,t){Gp(e,t.schemaExtensions);for(let[n,r]of Object.entries(t.types||{})){let i=e.getType(n);if(i){if(Gp(i,r.extensions),r.type==="object"||r.type==="interface")for(let[s,o]of Object.entries(r.fields)){let u=i.getFields()[s];if(u){Gp(u,o.extensions);for(let[l,d]of Object.entries(o.arguments))Gp(u.args.find(p=>p.name===l),d)}}else if(r.type==="input")for(let[s,o]of Object.entries(r.fields)){let u=i.getFields()[s];Gp(u,o.extensions)}else if(r.type==="enum")for(let[s,o]of Object.entries(r.values)){let u=i.getValue(s);Gp(u,o)}}}return e}wc.applyExtensions=qce});var rI=j(uT=>{"use strict";m();T();h();Object.defineProperty(uT,"__esModule",{value:!0});var ER=(uA(),Me(aA));ER.__exportStar(G$(),uT);ER.__exportStar(nq(),uT);ER.__exportStar(iq(),uT)});var Jp=j(ft=>{"use strict";m();T();h();Object.defineProperty(ft,"__esModule",{value:!0});ft.FieldSetDirective=ft.MergeMethod=void 0;ft.newPersistedDirectivesData=oI;ft.isNodeExternalOrShareable=uq;ft.getDefinedArgumentsForDirective=cq;ft.getDirectiveValidationErrors=lq;ft.extractDirectives=vR;ft.extractArguments=Gce;ft.isTypeRequired=_R;ft.compareAndValidateInputValueDefaultValues=Qce;ft.addEnumValueDataByNode=Yce;ft.addInheritedDirectivesToFieldData=Jce;ft.addFieldDataByNode=zce;ft.addInputValueDataByNode=bR;ft.addPersistedDirectiveDefinitionDataByNode=Hce;ft.setMutualExecutableLocations=Wce;ft.isTypeNameRootType=Xce;ft.getRenamedRootTypeName=Zce;ft.getEnumNodeByData=nle;ft.getInputObjectNodeByData=rle;ft.getCompositeOutputNodeByData=ile;ft.getScalarNodeByData=sle;ft.getSchemaNodeByData=ole;ft.getUnionNodeByData=ale;ft.removeInheritableDirectivesFromParentWithFieldsData=ule;ft.setLongestDescription=cle;ft.isParentDataRootType=pq;ft.isParentDataInterfaceType=lle;ft.setParentDataExtensionType=dle;ft.extractPersistedDirectives=mle;ft.pushAuthorizationDirectives=hle;ft.getClientPersistedDirectiveNodes=IR;ft.getNodeForRouterSchemaByData=yle;ft.getNodeWithPersistedDirectivesByFieldData=Nle;ft.getClientSchemaFieldNodeByFieldData=Ele;ft.getNodeWithPersistedDirectivesByInputValueData=DR;ft.getValidFieldArgumentNodes=gle;ft.addValidPersistedDirectiveDefinitionNodeByData=vle;ft.newInvalidFieldNames=_le;ft.validateExternalAndShareable=ble;ft.isTypeValidImplementation=iI;ft.isNodeDataInaccessible=mq;ft.isLeafKind=Ole;ft.getSubscriptionFilterValue=Sle;ft.getParentTypeName=Dle;ft.newConditionalFieldData=Ale;var wt=(Le(),Me(je)),gR=Gh(),Qp=Qa(),Hs=$i(),Cr=To(),Kt=bi(),sq=Ql(),ys=ps(),sI=Oc(),Kce=rI();function oI(){return{deprecatedReason:"",directives:new Map,isDeprecated:!1,tags:new Map}}function uq(e,t,n){var i;let r={isExternal:n.has(Kt.EXTERNAL),isShareable:t||n.has(Kt.SHAREABLE)};if(!((i=e.directives)!=null&&i.length))return r;for(let s of e.directives){let o=s.name.value;if(o===Kt.EXTERNAL){r.isExternal=!0;continue}o===Kt.SHAREABLE&&(r.isShareable=!0)}return r}function cq(e,t,n,r,i){let s=e.arguments||[],o=e.name.value,u=new Set,l=new Set,d=new Set;for(let p of s){let y=p.name.value;if(u.has(y)){l.add(y);continue}if(!t.get(y)){d.add(y);continue}u.add(y)}return l.size>0&&i.push((0,Cr.duplicateDirectiveArgumentDefinitionsErrorMessage)(o,r,[...l])),d.size>0&&i.push((0,Cr.unexpectedDirectiveArgumentErrorMessage)(o,[...d])),u}function lq(e,t,n,r,i,s,o=!1){var O,x,V;let u=e.name.value,l=r.get(u)||sI.V2_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.get(u),d=[];if(!l)return d.push((0,Cr.undefinedDirectiveErrorMessage)(u,s)),d;let p=new Map,y=new Set;if((0,sq.getDirectiveDefinitionArgumentSets)(l.arguments||[],p,y),(0,sq.areNodeKindAndDirectiveLocationCompatible)(t,l,o)||d.push((0,Cr.invalidDirectiveLocationErrorMessage)(s,o?wt.Kind.ARGUMENT:t,u)),!l.repeatable&&n.get(u)){let K=(0,ys.getValueOrDefault)(i,s,()=>new Set);K.has(u)||(K.add(u),d.push((0,Cr.invalidRepeatedDirectiveErrorMessage)(u,s)))}if(!((O=l.arguments)!=null&&O.length))return(x=e.arguments)!=null&&x.length&&d.push((0,Cr.unexpectedDirectiveArgumentsErrorMessage)(e,s)),d;if(!((V=e.arguments)!=null&&V.length))return y.size>0&&d.push((0,Cr.undefinedRequiredArgumentsErrorMessage)(u,s,[...y])),d;let N=cq(e,p,y,s,d),I=(0,ys.getEntriesNotInHashSet)(y,N);return I.length>0&&d.push((0,Cr.undefinedRequiredArgumentsErrorMessage)(u,s,[...y],I)),d}function vR(e,t,n,r,i,s,o=!1){if(!e.directives)return t;let u=new Set;for(let l of e.directives){let d=lq(l,e.kind,t,r,i,s,o),p=l.name.value;if(d.length>0){n.push((0,Cr.invalidDirectiveError)(p,s,d));continue}if(Kt.IGNORED_PARENT_DIRECTIVES.has(p))continue;if(p===Kt.KEY){let N=l.arguments[0].value.value;if(u.has(N))continue;u.add(N)}let y=t.get(p);y?y.push(l):t.set(p,[l])}return t}function Gce(e,t,n,r,i,s,o,u,l){var I;if(!((I=t.arguments)!=null&&I.length))return e;let d=t.name.value,p=`${o}.${d}`,y=`${u}.${d}`;s.add(o);let N=new Set;for(let O of t.arguments){let x=O.name.value;if(e.has(x)){N.add(x);continue}bR(e,O,r,i,`${p}(${x}: ...)`,l,n,`${y}(${x}: ...)`)}return N.size>0&&n.push((0,Cr.duplicateArgumentsError)(p,[...N])),e}function _R(e){return e.kind===wt.Kind.NON_NULL_TYPE}function dq(e,t){switch(e.kind){case wt.Kind.LIST_TYPE:return t.kind===wt.Kind.LIST||t.kind===wt.Kind.NULL;case wt.Kind.NAMED_TYPE:if(t.kind===wt.Kind.NULL)return!0;switch(e.name.value){case Kt.BOOLEAN_SCALAR:return t.kind===wt.Kind.BOOLEAN;case Kt.FLOAT_SCALAR:return t.kind===wt.Kind.INT||t.kind===wt.Kind.FLOAT;case Kt.INT_SCALAR:return t.kind===wt.Kind.INT;case Kt.STRING_SCALAR:return t.kind===wt.Kind.STRING;default:return!0}case wt.Kind.NON_NULL_TYPE:return t.kind===wt.Kind.NULL?!1:dq(e.type,t)}}function Qce(e,t,n){if(!e.defaultValue)return;if(!t.defaultValue){e.includeDefaultValue=!1;return}let r=(0,wt.print)(e.defaultValue),i=(0,wt.print)(t.defaultValue);if(r!==i){n.push((0,Cr.incompatibleInputValueDefaultValuesError)(`${e.isArgument?Kt.ARGUMENT:Kt.INPUT_FIELD} "${e.name}"`,e.originalPath,[...t.subgraphNames],r,i));return}}function Yce(e,t,n,r,i,s,o){let u=t.name.value;e.set(u,{appearances:1,directivesByDirectiveName:vR(t,new Map,n,r,i,`${s}.${u}`),name:u,node:(0,Qp.getMutableEnumValueNode)(t),parentTypeName:s,persistedDirectivesData:oI(),subgraphNames:new Set([o]),description:(0,Hs.formatDescription)(t.description)})}function Jce(e,t){for(let n of sI.INHERITABLE_DIRECTIVE_NAMES)e.get(n)&&(0,ys.getValueOrDefault)(t,n,()=>[(0,ys.generateSimpleDirective)(n)]);return t}function zce(e,t,n,r,i,s,o,u,l){let d=t.name.value,p=`${i}.${d}`,y=uq(t,!u,r),N={argumentDataByArgumentName:n,isExternalBySubgraphName:new Map([[o,y.isExternal]]),isInaccessible:r.has(Kt.INACCESSIBLE),isShareableBySubgraphName:new Map([[o,y.isShareable]]),node:(0,Qp.getMutableFieldNode)(t,p,l),name:d,namedTypeName:(0,Qp.getTypeNodeNamedTypeName)(t.type),originalParentTypeName:i,persistedDirectivesData:oI(),renamedParentTypeName:s,subgraphNames:new Set([o]),type:(0,Qp.getMutableTypeNode)(t.type,p,l),directivesByDirectiveName:r,description:(0,Hs.formatDescription)(t.description)};return e.set(d,N),N}function bR(e,t,n,r,i,s,o,u){let l=t.name.value,d=!!u;t.defaultValue&&!dq(t.type,t.defaultValue)&&o.push((0,Cr.incompatibleInputValueDefaultValueTypeError)((d?Kt.ARGUMENT:Kt.INPUT_FIELD)+` "${l}"`,i,(0,Kce.printTypeNode)(t.type),(0,wt.print)(t.defaultValue))),e.set(l,{directivesByDirectiveName:vR(t,new Map,o,n,r,i,d),includeDefaultValue:!!t.defaultValue,isArgument:d,name:l,node:(0,Qp.getMutableInputValueNode)(t,i,o),originalPath:i,persistedDirectivesData:oI(),renamedPath:u||i,requiredSubgraphNames:new Set(_R(t.type)?[s]:[]),subgraphNames:new Set([s]),type:(0,Qp.getMutableTypeNode)(t.type,i,o),defaultValue:t.defaultValue,description:(0,Hs.formatDescription)(t.description)})}function Hce(e,t,n,r,i,s,o){let u=t.name.value,l=new Map;for(let d of t.arguments||[]){let p=`@${u}(${d.name.value}: ...)`;bR(l,d,r,i,p,o,n,p)}e.set(u,{argumentDataByArgumentName:l,executableLocations:s,name:u,repeatable:t.repeatable,subgraphNames:new Set([o]),description:(0,Hs.formatDescription)(t.description)})}function Wce(e,t){let n=new Set;for(let r of t)e.executableLocations.has(r)&&n.add(r);e.executableLocations=n}function Xce(e,t){return Kt.ROOT_TYPE_NAMES.has(e)||t.has(e)}function Zce(e,t){let n=t.get(e);if(!n)return e;switch(n){case wt.OperationTypeNode.MUTATION:return Kt.MUTATION;case wt.OperationTypeNode.SUBSCRIPTION:return Kt.SUBSCRIPTION;default:return Kt.QUERY}}function ele(e,t){let n=e.get(t.originalParentTypeName);if(!n)return;let r=n.fieldAuthorizationDataByFieldName.get(t.name);if(r){if(r.requiresAuthentication){let i=(0,ys.generateSimpleDirective)(Kt.AUTHENTICATED);t.directivesByDirectiveName.set(Kt.AUTHENTICATED,[i])}if(r.requiredScopes.length>0){let i=(0,ys.generateRequiresScopesDirective)(r.requiredScopes);t.directivesByDirectiveName.set(Kt.REQUIRES_SCOPES,[i])}}}function tle(e){for(let t of e.argumentDataByArgumentName.values()){for(let n of t.directivesByDirectiveName.values())t.node.directives.push(...n);e.node.arguments.push(t.node)}}function OR(e,t){let n=[];for(let r of e.values()){if(r.node.kind===wt.Kind.FIELD_DEFINITION){let i=r;ele(t,i),tle(i)}for(let i of r.directivesByDirectiveName.values())r.node.directives.push(...i);n.push(r.node)}return n}function Yp(e,t,n,r){let i=[];for(let[s,o]of e){let u=n.get(s)||sI.V2_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.get(s);if(!u)continue;if(!u.repeatable&&o.length>1){t.push((0,Cr.invalidDirectiveError)(s,r,[(0,Cr.invalidRepeatedDirectiveErrorMessage)(s,r)]));continue}if(s!==Kt.KEY){i.push(...o);continue}let l=[],d=new Set,p=[];for(let y of o){let N=y.arguments[0].value;if(N.kind!==wt.Kind.STRING){p.push((0,Cr.invalidKeyDirectiveArgumentErrorMessage)(N.kind));continue}let I=N.value;d.has(I)||(d.add(I),i.push(y),l.push(y))}e.set(s,l),p.length>0&&t.push((0,Cr.invalidDirectiveError)(s,r,p))}return i}function nle(e,t,n,r){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node.values=OR(e.enumValueDataByValueName,r),e.node}function rle(e,t,n,r){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node.fields=OR(e.inputValueDataByValueName,r),e.node}function ile(e,t,n,r){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node.fields=OR(e.fieldDataByFieldName,r),e.node.interfaces=(0,Hs.setToNamedTypeNodeArray)(e.implementedInterfaceTypeNames),e.node}function sle(e,t,n){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node}function ole(e,t,n){return{description:e.description,directives:Yp(e.directivesByDirectiveName,t,n,e.typeName),kind:e.kind,operationTypes:(0,ys.mapToArrayOfValues)(e.operationTypes)}}function ale(e,t,n){return e.node.description=e.description,e.node.directives=Yp(e.directivesByDirectiveName,t,n,e.name),e.node.types=(0,ys.mapToArrayOfValues)(e.memberByMemberTypeName),e.node}function ule(e){for(let t of sI.INHERITABLE_DIRECTIVE_NAMES)e.directivesByDirectiveName.delete(t)}function cle(e,t){t.description&&(!e.description||e.description.value.length0&&e.persistedDirectivesData.directives.set(Kt.REQUIRES_SCOPES,[(0,ys.generateRequiresScopesDirective)(n.requiredScopes)]))}function fq(e){return{kind:wt.Kind.DIRECTIVE,name:(0,Hs.stringToNameNode)(Kt.DEPRECATED),arguments:[{kind:wt.Kind.ARGUMENT,name:(0,Hs.stringToNameNode)(Kt.REASON),value:{kind:wt.Kind.STRING,value:e||Kt.DEPRECATED_DEFAULT_ARGUMENT_VALUE}}]}}function Tle(e,t,n,r){let i=[];for(let[s,o]of e){let u=t.get(s);if(u){if(o.length<2){i.push(...o);continue}if(!u.repeatable){r.push((0,Cr.invalidRepeatedFederatedDirectiveErrorMessage)(s,n));continue}i.push(...o)}}return i}function SR(e,t,n){let r=[...e.persistedDirectivesData.tags.values()];return e.persistedDirectivesData.isDeprecated&&r.push(fq(e.persistedDirectivesData.deprecatedReason)),r.push(...Tle(e.persistedDirectivesData.directives,t,e.name,n)),r}function IR(e){let t=[];e.persistedDirectivesData.isDeprecated&&t.push(fq(e.persistedDirectivesData.deprecatedReason));for(let[n,r]of e.persistedDirectivesData.directives)Kt.PERSISTED_CLIENT_DIRECTIVES.has(n)&&t.push(r[0]);return t}function yle(e,t,n){return e.node.name=(0,Hs.stringToNameNode)(e.name),e.node.description=e.description,e.node.directives=SR(e,t,n),e.node}function Nle(e,t,n,r){return e.node.arguments=n,e.node.name=(0,Hs.stringToNameNode)(e.name),e.node.type=e.type,e.node.description=e.description,e.node.directives=SR(e,t,r),e.node}function Ele(e){let t=IR(e),n=[];for(let r of e.argumentDataByArgumentName.values())mq(r)||n.push(G(k({},r.node),{directives:IR(r)}));return G(k({},e.node),{directives:t,arguments:n})}function DR(e,t,n){return e.node.name=(0,Hs.stringToNameNode)(e.name),e.node.type=e.type,e.node.description=e.description,e.node.directives=SR(e,t,n),e.includeDefaultValue&&(e.node.defaultValue=e.defaultValue),e.node}function gle(e,t,n,r){let i=[],s=[],o=[],u=`${e.renamedParentTypeName}.${e.name}`;for(let[l,d]of e.argumentDataByArgumentName)e.subgraphNames.size===d.subgraphNames.size?(s.push(l),i.push(DR(d,t,r))):_R(d.type)&&o.push({inputValueName:l,missingSubgraphs:(0,ys.getEntriesNotInHashSet)(e.subgraphNames,d.subgraphNames),requiredSubgraphs:[...d.requiredSubgraphNames]});return o.length>0?r.push((0,Cr.invalidRequiredInputValueError)(Kt.FIELD,u,o)):s.length>0&&((0,ys.getValueOrDefault)(n,u,()=>({argumentNames:s,fieldName:e.name,typeName:e.renamedParentTypeName})).argumentNames=s),i}function Ile(e,t,n,r,i){let s=[];for(let[o,u]of t.argumentDataByArgumentName){let l=(0,ys.getEntriesNotInHashSet)(t.subgraphNames,u.subgraphNames);if(l.length>0){u.requiredSubgraphNames.size>0&&s.push({inputValueName:o,missingSubgraphs:l,requiredSubgraphs:[...u.requiredSubgraphNames]});continue}e.push(DR(u,n,r)),i&&i.add(o)}return s.length>0?(r.push((0,Cr.invalidRequiredInputValueError)(Kt.DIRECTIVE_DEFINITION,`@${t.name}`,s)),!1):!0}function vle(e,t,n,r){let i=[];Ile(i,t,n,r)&&e.push({arguments:i,kind:wt.Kind.DIRECTIVE_DEFINITION,locations:(0,Hs.setToNameNodeArray)(t.executableLocations),name:(0,Hs.stringToNameNode)(t.name),repeatable:t.repeatable,description:t.description})}function _le(){return{byShareable:new Set,subgraphNamesByExternalFieldName:new Map}}function ble(e,t){let n=e.isShareableBySubgraphName.size,r=[],i=0;for(let[s,o]of e.isShareableBySubgraphName){if(e.isExternalBySubgraphName.get(s)){r.push(s);continue}o||(i+=1)}switch(i){case 0:n===r.length&&t.subgraphNamesByExternalFieldName.set(e.name,r);return;case 1:if(n===1)return;n-r.length!==1&&t.byShareable.add(e.name);return;default:t.byShareable.add(e.name)}}var oq;(function(e){e[e.UNION=0]="UNION",e[e.INTERSECTION=1]="INTERSECTION",e[e.CONSISTENT=2]="CONSISTENT"})(oq||(ft.MergeMethod=oq={}));function iI(e,t,n){if(e.kind===wt.Kind.NON_NULL_TYPE)return t.kind!==wt.Kind.NON_NULL_TYPE?!1:iI(e.type,t.type,n);if(t.kind===wt.Kind.NON_NULL_TYPE)return iI(e,t.type,n);switch(e.kind){case wt.Kind.NAMED_TYPE:if(t.kind===wt.Kind.NAMED_TYPE){let r=e.name.value,i=t.name.value;if(r===i)return!0;let s=n.get(r);return s?s.has(i):!1}return!1;default:return t.kind===wt.Kind.LIST_TYPE?iI(e.type,t.type,n):!1}}function mq(e){return e.persistedDirectivesData.directives.has(Kt.INACCESSIBLE)||e.directivesByDirectiveName.has(Kt.INACCESSIBLE)}function Ole(e){return e===wt.Kind.SCALAR_TYPE_DEFINITION||e===wt.Kind.ENUM_TYPE_DEFINITION}function Sle(e){switch(e.kind){case wt.Kind.BOOLEAN:return e.value;case wt.Kind.ENUM:case wt.Kind.STRING:return e.value;case wt.Kind.FLOAT:case wt.Kind.INT:try{return parseFloat(e.value)}catch(t){return"NaN"}case wt.Kind.NULL:return null}}function Dle(e){return e.kind===wt.Kind.OBJECT_TYPE_DEFINITION?e.renamedTypeName:e.name}var aq;(function(e){e.PROVIDES="provides",e.REQUIRES="requires"})(aq||(ft.FieldSetDirective=aq={}));function Ale(){return{providedBy:[],requiredBy:[]}}});var cT=j(bo=>{"use strict";m();T();h();Object.defineProperty(bo,"__esModule",{value:!0});bo.Warning=void 0;bo.invalidOverrideTargetSubgraphNameWarning=Rle;bo.externalInterfaceFieldsWarning=Fle;bo.nonExternalConditionalFieldWarning=wle;bo.unimplementedInterfaceOutputTypeWarning=Lle;bo.invalidExternalFieldWarning=Ple;bo.requiresDefinedOnNonEntityFieldWarning=kle;bo.consumerInactiveThresholdInvalidValueWarning=Cle;var hq=bi(),la=class extends Error{constructor(n){super(n.message);A(this,"subgraph");this.name="Warning",this.subgraph=n.subgraph}};bo.Warning=la;function Rle(e,t,n,r){return new la({message:`The Object type "${t}" defines the directive "@override(from: "${e}")" on the following field`+(n.length>1?"s":"")+': "'+n.join(hq.QUOTATION_JOIN)+`". The required "from" argument of type "String!" should be provided with an existing subgraph name. However, a subgraph by the name of "${e}" does not exist. If this subgraph has been recently deleted, remember to clean up unused "@override" directives that reference this subgraph.`,subgraph:{name:r}})}function AR(e){return`The subgraph "${e}" is currently a "version one" subgraph, but if it were updated to "version two" in its current state, composition would be unsuccessful due to the following warning that would instead propagate as an error: @@ -646,13 +646,13 @@ Interface Fields should not be declared "@external". This is because Interface F "${r}". However, neither the Field "${n}" nor any of its field set ancestors are declared @external. Consequently, "${n}" is already provided by subgraph "${t}" and should not form part of a "@${i}" directive field set.`,subgraph:{name:t}})}function Lle(e,t){return new la({message:`Subgraph "${e}": The Interface "${t}" is used as an output type without at least one Object type implementation defined in the schema.`,subgraph:{name:e}})}function Ple(e,t){return new la({message:AR(t)+` The Object Field "${e}" is invalidly declared "@external". An Object Field should only be declared "@external" if it is part of a "@key", "@provides", or "@requires" FieldSet, or the Field is necessary to satisfy an Interface implementation. In the case that none of these conditions is true, the "@external" directive should be removed.`,subgraph:{name:t}})}function kle(e,t){return new la({message:` The Object Field "${e}" defines a "@requires" directive, but the Object is not an entity. Consequently, the "@requires" FieldSet cannot be satisfied because there is no entity resolver with which to provide the required Fields.`,subgraph:{name:t}})}function Cle(e,t=""){return new la({message:'The "consumerInactiveThreshold" argument of type "Int" should be positive and smaller than 2,147,483,648.'+ +t?` -${t}`:"",subgraph:{name:e}})}});var Ql=j(Ns=>{"use strict";m();T();h();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.newKeyFieldSetData=Ule;Ns.newFieldSetData=Mle;Ns.areNodeKindAndDirectiveLocationCompatible=Ble;Ns.getDirectiveDefinitionArgumentSets=Vle;Ns.addFieldNamesToConfigurationData=jle;Ns.extractFieldSetValue=$le;Ns.getNormalizedFieldSet=FR;Ns.validateKeyFieldSets=Gle;Ns.validateAndAddConditionalFieldSetsToConfiguration=Yle;Ns.isNodeQuery=Jle;Ns.validateArgumentTemplateReferences=zle;var Pe=(Le(),Me(je)),zi=ps(),lT=$i(),Wn=bi(),jt=To(),RR=Oc(),Tq=iA(),dT=Qa(),da=Jp(),xle=cT();function Ule(){return{isUnresolvableByKeyFieldSet:new Map}}function Mle(){return{provides:new Map,requires:new Map}}function Ble(e,t,n=!1){for(let r of t.locations){let i=r.value.toUpperCase();switch(i){case Wn.ARGUMENT_DEFINITION_UPPER:if(!n)break;if(e===Pe.Kind.INPUT_VALUE_DEFINITION)return!0;break;case Wn.ENUM_UPPER:if(e===Pe.Kind.ENUM_TYPE_DEFINITION||e===Pe.Kind.ENUM_TYPE_EXTENSION)return!0;break;case Wn.ENUM_VALUE_UPPER:if(e===Pe.Kind.ENUM_VALUE_DEFINITION)return!0;break;case Wn.FIELD_UPPER:if(e===Pe.Kind.FIELD)return!0;break;case Wn.FIELD_DEFINITION_UPPER:if(e===Pe.Kind.FIELD_DEFINITION)return!0;break;case Wn.INLINE_FRAGMENT_UPPER:if(e===Pe.Kind.INLINE_FRAGMENT)return!0;break;case Wn.INPUT_FIELD_DEFINITION_UPPER:if(e===Pe.Kind.INPUT_VALUE_DEFINITION)return!0;break;case Wn.INPUT_OBJECT_UPPER:if(e===Pe.Kind.INPUT_OBJECT_TYPE_DEFINITION||e===Pe.Kind.INPUT_OBJECT_TYPE_EXTENSION)return!0;break;case Wn.INTERFACE_UPPER:if(e===Pe.Kind.INTERFACE_TYPE_DEFINITION||e===Pe.Kind.INTERFACE_TYPE_EXTENSION)return!0;break;case Wn.OBJECT_UPPER:if(e===Pe.Kind.OBJECT_TYPE_DEFINITION||e===Pe.Kind.OBJECT_TYPE_EXTENSION)return!0;break;case Wn.FRAGMENT_DEFINITION_UPPER:if(e===Pe.Kind.FRAGMENT_DEFINITION)return!0;break;case Wn.FRAGMENT_SPREAD_UPPER:if(e===Pe.Kind.FRAGMENT_SPREAD)return!0;break;case Wn.SCALAR_UPPER:if(e===Pe.Kind.SCALAR_TYPE_DEFINITION||e===Pe.Kind.SCALAR_TYPE_EXTENSION)return!0;break;case Wn.SCHEMA_UPPER:if(e===Pe.Kind.SCHEMA_DEFINITION||e===Pe.Kind.SCHEMA_EXTENSION)return!0;break;case Wn.UNION_UPPER:if(e===Pe.Kind.UNION_TYPE_DEFINITION||e===Pe.Kind.UNION_TYPE_EXTENSION)return!0;break;case Wn.VARIABLE_DEFINITION_UPPER:if(e===Pe.Kind.VARIABLE_DEFINITION)return!0;break;case Wn.QUERY_UPPER:case Wn.MUTATION_UPPER:case Wn.SUBSCRIPTION_UPPER:if(e===Pe.Kind.OPERATION_DEFINITION)return!0;break;default:throw(0,jt.unexpectedDirectiveLocationError)(i)}}return!1}function Vle(e,t,n){for(let r of e){let i=r.name.value;t.set(i,r.type),r.type.kind===Pe.Kind.NON_NULL_TYPE&&!r.defaultValue&&n.add(i)}}function jle(e,t){let n=new Set;for(let[r,i]of e)i.directivesByDirectiveName.has(Wn.EXTERNAL)?t.externalFieldNames?t.externalFieldNames.add(r):n.add(r):t.fieldNames.add(r);n.size>0&&(t.externalFieldNames=n)}function $le(e,t,n){if(!n||n.length>1)return;let r=n[0].arguments;if(!r||r.length!==1)return;let i=r[0];i.name.value!==Wn.FIELDS||i.value.kind!==Pe.Kind.STRING||t.set(e,i.value.value)}function FR(e){return(0,Pe.print)((0,lT.lexicographicallySortDocumentNode)(e)).replaceAll(/\s+/g," ").slice(2,-2)}function qle(e,t,n){switch(e){case da.FieldSetDirective.PROVIDES:return[`${t}.${n}`];default:return[]}}function Kle(e,t,n,r,i,s){let{error:o,documentNode:u}=(0,lT.safeParse)("{"+n+"}");if(o||!u)return{errorMessage:(0,jt.unparsableFieldSetErrorMessage)(n,o)};let l=[t],d=[],p=qle(i,s,r),y=[r],N=new Set,I,O=-1,x=!0,V=r;return(0,Pe.visit)(u,{Argument:{enter(){return!1}},Field:{enter(K){let re=l[O],se=re.name;if(re.kind===Pe.Kind.UNION_TYPE_DEFINITION)return I=(0,jt.invalidSelectionOnUnionErrorMessage)(n,p,se),Pe.BREAK;let fe=K.name.value,he=`${se}.${fe}`;if(e.unvalidatedExternalFieldCoords.delete(he),x)return I=(0,jt.invalidSelectionSetErrorMessage)(n,p,se,(0,zi.kindToTypeString)(re.kind)),Pe.BREAK;p.push(he),y.push(fe),V=fe;let xe=re.fieldDataByFieldName.get(fe);if(!xe)return I=(0,jt.undefinedFieldInFieldSetErrorMessage)(n,se,fe),Pe.BREAK;if(d[O].has(fe))return I=(0,jt.duplicateFieldInFieldSetErrorMessage)(n,he),Pe.BREAK;d[O].add(fe);let ht=xe.isExternalBySubgraphName.get(e.subgraphName),Ct=(0,dT.getTypeNodeNamedTypeName)(xe.node.type),B=e.parentDefinitionDataByTypeName.get(Ct);if(RR.BASE_SCALARS.has(Ct)||(B==null?void 0:B.kind)===Pe.Kind.SCALAR_TYPE_DEFINITION||(B==null?void 0:B.kind)===Pe.Kind.ENUM_TYPE_DEFINITION){if(N.size<1&&!ht){e.isSubgraphVersionTwo?e.errors.push((0,jt.nonExternalConditionalFieldError)(`${s}.${r}`,e.subgraphName,he,n,i)):e.warnings.push((0,xle.nonExternalConditionalFieldWarning)(`${s}.${r}`,e.subgraphName,he,n,i));return}let Te=(0,zi.getValueOrDefault)(e.conditionalFieldDataByCoordinates,he,da.newConditionalFieldData),nt=(0,Tq.newFieldSetConditionData)({fieldCoordinatesPath:[...p],fieldPath:[...y]});i===da.FieldSetDirective.PROVIDES?Te.providedBy.push(nt):Te.requiredBy.push(nt);return}if(!B)return I=(0,jt.unknownTypeInFieldSetErrorMessage)(n,he,Ct),Pe.BREAK;if(ht){let Te=(0,zi.getValueOrDefault)(e.conditionalFieldDataByCoordinates,he,da.newConditionalFieldData);switch(i){case da.FieldSetDirective.PROVIDES:Te.providedBy.push((0,Tq.newFieldSetConditionData)({fieldCoordinatesPath:[...p],fieldPath:[...y]}));break;default:break}N.add(he)}if(B.kind===Pe.Kind.OBJECT_TYPE_DEFINITION||B.kind===Pe.Kind.INTERFACE_TYPE_DEFINITION||B.kind===Pe.Kind.UNION_TYPE_DEFINITION){x=!0,l.push(B);return}},leave(){N.delete(p.pop()||""),y.pop()}},InlineFragment:{enter(K){let re=l[O],se=re.name,fe=p.length<1?t.name:p[p.length-1];if(!K.typeCondition)return I=(0,jt.inlineFragmentWithoutTypeConditionErrorMessage)(n,fe),Pe.BREAK;let he=K.typeCondition.name.value;if(he===se){l.push(re),x=!0;return}if(!(0,lT.isKindAbstract)(re.kind))return I=(0,jt.invalidInlineFragmentTypeErrorMessage)(n,p,he,se),Pe.BREAK;let xe=e.parentDefinitionDataByTypeName.get(he);if(!xe)return I=(0,jt.unknownInlineFragmentTypeConditionErrorMessage)(n,p,se,he),Pe.BREAK;switch(x=!0,xe.kind){case Pe.Kind.INTERFACE_TYPE_DEFINITION:{if(!xe.implementedInterfaceTypeNames.has(se))break;l.push(xe);return}case Pe.Kind.OBJECT_TYPE_DEFINITION:{let ht=e.concreteTypeNamesByAbstractTypeName.get(se);if(!ht||!ht.has(he))break;l.push(xe);return}case Pe.Kind.UNION_TYPE_DEFINITION:{l.push(xe);return}default:return I=(0,jt.invalidInlineFragmentTypeConditionTypeErrorMessage)(n,p,se,he,(0,zi.kindToTypeString)(xe.kind)),Pe.BREAK}return I=(0,jt.invalidInlineFragmentTypeConditionErrorMessage)(n,p,he,(0,zi.kindToTypeString)(re.kind),se),Pe.BREAK}},SelectionSet:{enter(){if(!x){let K=l[O];if(K.kind===Pe.Kind.UNION_TYPE_DEFINITION)return I=(0,jt.unparsableFieldSetSelectionErrorMessage)(n,V),Pe.BREAK;let re=K.fieldDataByFieldName.get(V);if(!re)return I=(0,jt.undefinedFieldInFieldSetErrorMessage)(n,K.name,V),Pe.BREAK;let se=(0,dT.getTypeNodeNamedTypeName)(re.node.type),fe=e.parentDefinitionDataByTypeName.get(se),he=fe?fe.kind:Pe.Kind.SCALAR_TYPE_DEFINITION;return I=(0,jt.invalidSelectionSetDefinitionErrorMessage)(n,p,se,(0,zi.kindToTypeString)(he)),Pe.BREAK}if(O+=1,x=!1,O<0||O>=l.length)return I=(0,jt.unparsableFieldSetSelectionErrorMessage)(n,V),Pe.BREAK;d.push(new Set)},leave(){if(x){let K=l[O+1];I=(0,jt.invalidSelectionSetErrorMessage)(n,p,K.name,(0,zi.kindToTypeString)(K.kind)),x=!1}O-=1,l.pop(),d.pop()}}}),I?{errorMessage:I}:{configuration:{fieldName:r,selectionSet:FR(u)}}}function Gle(e,t,n,r){let i=e.entityInterfaceDataByTypeName.has(t.name),s=t.name,o=[],u=[],l=new Set,d=[],p=i?void 0:e.internalGraph.addEntityDataNode(t.name),y=e.internalGraph.addOrUpdateNode(t.name);for(let[N,I]of n){let{error:O,documentNode:x}=(0,lT.safeParse)("{"+N+"}");if(O||!x){o.push((0,jt.unparsableFieldSetErrorMessage)(N,O));continue}let V=[t],K=[],re=[],se=new Set,fe=-1,he=!0,xe="";if((0,Pe.visit)(x,{Argument:{enter(Ct){return o.push((0,jt.unexpectedArgumentErrorMessage)(N,`${V[fe].name}.${xe}`,Ct.name.value)),Pe.BREAK}},Field:{enter(Ct){let B=V[fe-1],Te=V[fe],nt=Te.name,xt=Ct.name.value,rn=`${nt}.${xt}`;if(e.unvalidatedExternalFieldCoords.delete(rn),he)return o.push((0,jt.invalidSelectionSetErrorMessage)(N,[`${B.name}.${xe}`],nt,(0,zi.kindToTypeString)(Te.kind))),Pe.BREAK;xe=xt;let wn=Te.fieldDataByFieldName.get(xt);if(!wn)return o.push((0,jt.undefinedFieldInFieldSetErrorMessage)(N,nt,xt)),Pe.BREAK;if(wn.argumentDataByArgumentName.size)return o.push((0,jt.argumentsInKeyFieldSetErrorMessage)(N,rn)),Pe.BREAK;if(K[fe].has(xt))return o.push((0,jt.duplicateFieldInFieldSetErrorMessage)(N,rn)),Pe.BREAK;if(re.push(xt),wn.isShareableBySubgraphName.set(e.subgraphName,!0),K[fe].add(xt),fe===0)l.add(xt),r.add(xt);else{let mi=e.configurationDataByParentTypeName.get(nt);if(!mi)return o.push((0,jt.invalidConfigurationDataErrorMessage)(nt,xt,N)),Pe.BREAK;mi.fieldNames.add(xt)}(0,zi.getValueOrDefault)(e.keyFieldNamesByParentTypeName,nt,()=>new Set).add(xt);let vn=(0,dT.getTypeNodeNamedTypeName)(wn.node.type);if(RR.BASE_SCALARS.has(vn)){se.add(re.join(Wn.PERIOD)),re.pop();return}let _n=e.parentDefinitionDataByTypeName.get(vn);if(!_n)return o.push((0,jt.unknownTypeInFieldSetErrorMessage)(N,rn,vn)),Pe.BREAK;if(_n.kind===Pe.Kind.OBJECT_TYPE_DEFINITION){he=!0,V.push(_n);return}if((0,lT.isKindAbstract)(_n.kind))return o.push((0,jt.abstractTypeInKeyFieldSetErrorMessage)(N,rn,vn,(0,zi.kindToTypeString)(_n.kind))),Pe.BREAK;se.add(re.join(Wn.PERIOD)),re.pop()}},InlineFragment:{enter(){return o.push(jt.inlineFragmentInFieldSetErrorMessage),Pe.BREAK}},SelectionSet:{enter(){if(!he){let Ct=V[fe],Te=`${Ct.name}.${xe}`,nt=Ct.fieldDataByFieldName.get(xe);if(!nt)return o.push((0,jt.undefinedFieldInFieldSetErrorMessage)(N,Te,xe)),Pe.BREAK;let xt=(0,dT.getTypeNodeNamedTypeName)(nt.node.type),rn=e.parentDefinitionDataByTypeName.get(xt),wn=rn?rn.kind:Pe.Kind.SCALAR_TYPE_DEFINITION;return o.push((0,jt.invalidSelectionSetDefinitionErrorMessage)(N,[Te],xt,(0,zi.kindToTypeString)(wn))),Pe.BREAK}if(fe+=1,he=!1,fe<0||fe>=V.length)return o.push((0,jt.unparsableFieldSetSelectionErrorMessage)(N,xe)),Pe.BREAK;K.push(new Set)},leave(){if(he){let B=V[fe].name,Te=V[fe+1],nt=`${B}.${xe}`;o.push((0,jt.invalidSelectionSetErrorMessage)(N,[nt],Te.name,(0,zi.kindToTypeString)(Te.kind))),he=!1}fe-=1,V.pop(),K.pop()}}}),o.length>0)continue;let ht=FR(x);u.push(k({fieldName:"",selectionSet:ht},I?{disableEntityResolver:!0}:{})),y.satisfiedFieldSets.add(ht),!I&&(p==null||p.addTargetSubgraphByFieldSet(ht,e.subgraphName),d.push(se))}if(o.length){e.errors.push((0,jt.invalidKeyDirectivesError)(s,o));return}if(u.length)return u}function Qle(e,t,n,r,i){if(t!==da.FieldSetDirective.PROVIDES)return{fieldSetParentData:n};let s=(0,zi.getOrThrowError)(n.fieldDataByFieldName,r,`${i}.fieldDataByFieldName`),o=(0,dT.getTypeNodeNamedTypeName)(s.node.type),u=e.parentDefinitionDataByTypeName.get(o);return u?u.kind!==Pe.Kind.INTERFACE_TYPE_DEFINITION&&u.kind!==Pe.Kind.OBJECT_TYPE_DEFINITION?{errorString:(0,jt.incompatibleTypeWithProvidesErrorMessage)(`${i}.${r}`,o)}:{fieldSetParentData:u}:{errorString:(0,jt.unknownNamedTypeErrorMessage)(`${i}.${r}`,o)}}function yq(e,t,n,r){let i=[],s=[],o=(0,da.getParentTypeName)(t);for(let[u,l]of n){let{fieldSetParentData:d,errorString:p}=Qle(e,r,t,u,o),y=`${o}.${u}`;if(p){i.push(p);continue}if(!d)continue;let{errorMessage:N,configuration:I}=Kle(e,d,l,u,r,o);if(N){i.push(` On "${y}" \u2014`+N);continue}if(I){s.push(I);continue}throw(0,jt.invalidConfigurationResultFatalError)(y)}if(i.length>0){e.errors.push((0,jt.invalidProvidesOrRequiresDirectivesError)(r,i));return}if(s.length>0)return s}function Yle(e,t,n){let r=(0,zi.getOrThrowError)(e.configurationDataByParentTypeName,(0,da.getParentTypeName)(t),"configurationDataByParentTypeName"),i=yq(e,t,n.provides,da.FieldSetDirective.PROVIDES);i&&(r.provides=i);let s=yq(e,t,n.requires,da.FieldSetDirective.REQUIRES);s&&(r.requires=s)}function Jle(e,t){return e===Wn.QUERY||t===Pe.OperationTypeNode.QUERY}function zle(e,t,n){let r=e.matchAll(RR.EDFS_ARGS_REGEXP),i=new Set,s=new Set;for(let o of r){if(o.length<2){s.add(o[0]);continue}t.has(o[1])||i.add(o[1])}for(let o of i)n.push((0,jt.undefinedEventSubjectsArgumentErrorMessage)(o));for(let o of s)n.push((0,jt.invalidEventSubjectsArgumentErrorMessage)(o))}});var wR=j(zp=>{"use strict";m();T();h();Object.defineProperty(zp,"__esModule",{value:!0});zp.newParentTagData=ede;zp.newChildTagData=tde;zp.validateImplicitFieldSets=nde;zp.newContractTagOptionsFromArrays=rde;var Hle=ps(),Wle=Qa(),Ws=VV(),Xle=Oc(),Nq=$i(),Zle=Ql();function ede(e){return{childTagDataByChildName:new Map,tagNames:new Set,typeName:e}}function tde(e){return{name:e,tagNames:new Set,tagNamesByArgumentName:new Map}}function nde({conditionalFieldDataByCoordinates:e,configurationData:t,fieldSets:n,implicitKeys:r,objectData:i,parentDefinitionDataByTypeName:s,graphNode:o}){for(let u of n){let{error:l,documentNode:d}=(0,Nq.safeParse)("{"+u+"}");if(l||!d)continue;let p=[i],y=[],N=new Set,I=[],O=-1,x=!0,V=!0;if((0,Ws.visit)(d,{Argument:{enter(){return V=!1,Ws.BREAK}},Field:{enter(re){let se=p[O];if(x)return V=!1,Ws.BREAK;let fe=re.name.value,he=se.fieldDataByFieldName.get(fe);if(!he||he.argumentDataByArgumentName.size||y[O].has(fe))return V=!1,Ws.BREAK;let xe=e.get(`${he.renamedParentTypeName}.${fe}`);if(xe){if(xe.providedBy.length>0)I.push(...xe.providedBy);else if(xe.requiredBy.length>0)return V=!1,Ws.BREAK}y[O].add(fe),O===0&&N.add(fe);let ht=(0,Wle.getTypeNodeNamedTypeName)(he.node.type);if(Xle.BASE_SCALARS.has(ht))return;let Ct=s.get(ht);if(!Ct)return V=!1,Ws.BREAK;if(Ct.kind===Ws.Kind.OBJECT_TYPE_DEFINITION){x=!0,p.push(Ct);return}if((0,Nq.isKindAbstract)(Ct.kind))return V=!1,Ws.BREAK}},InlineFragment:{enter(){return V=!1,Ws.BREAK}},SelectionSet:{enter(){if(!x||(O+=1,x=!1,O<0||O>=p.length))return V=!1,Ws.BREAK;y.push(new Set)},leave(){if(x)return V=!1,Ws.BREAK;O-=1,p.pop(),y.pop()}}}),!V)continue;(0,Hle.addIterableValuesToSet)(N,t.fieldNames);let K=(0,Zle.getNormalizedFieldSet)(d);r.push(G(k({fieldName:"",selectionSet:K},I.length>0?{conditions:I}:{}),{disableEntityResolver:!0})),o&&o.satisfiedFieldSets.add(K)}}function rde(e,t){return{tagNamesToExclude:new Set(e),tagNamesToInclude:new Set(t)}}});var PR=j(LR=>{"use strict";m();T();h();Object.defineProperty(LR,"__esModule",{value:!0});LR.recordSubgraphName=ide;function ide(e,t,n){if(!t.has(e)){t.add(e);return}n.add(e)}});var kR=j(mT=>{"use strict";m();T();h();Object.defineProperty(mT,"__esModule",{value:!0});mT.upsertDirectiveSchemaAndEntityDefinitions=ode;mT.upsertParentsAndChildren=ade;mT.consolidateAuthorizationDirectives=ude;var nr=(Le(),Me(je)),Wa=To(),Yl=Oc(),Tn=ps(),pT=$i(),Jl=Ql(),rr=bi(),Fi=Jp(),fT=Qa(),sde=cT();function ode(e,t){let n=new Set,r=[];(0,nr.visit)(t,{Directive:{enter(i){let s=i.name.value;if(rr.EVENT_DIRECTIVE_NAMES.has(s)&&e.edfsDirectiveReferences.add(s),Yl.V2_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.has(s))return e.isSubgraphVersionTwo=!0,!1;if(Yl.BASE_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.has(s))return!1;s===rr.SUBSCRIPTION_FILTER&&e.directiveDefinitionByDirectiveName.set(rr.SUBSCRIPTION_FILTER,Yl.SUBSCRIPTION_FILTER_DEFINITION),e.referencedDirectiveNames.add(s)}},DirectiveDefinition:{enter(i){let s=i.name.value;return n.has(s)?(e.errors.push((0,Wa.duplicateDirectiveDefinitionError)(s)),!1):(n.add(s),Yl.V2_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.has(s)?(e.isSubgraphVersionTwo=!0,!1):(Yl.BASE_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.has(s)||s===rr.SUBSCRIPTION_FILTER||(e.directiveDefinitionByDirectiveName.set(s,i),e.customDirectiveDefinitions.set(s,i)),!1))}},InterfaceTypeDefinition:{enter(i){let s=i.name.value;if(e.internalGraph.addOrUpdateNode(s,{isAbstract:!0}),!(0,pT.isObjectLikeNodeEntity)(i))return;let o=(0,Tn.getValueOrDefault)(e.keyFieldSetDataByTypeName,s,Jl.newKeyFieldSetData);e.extractKeyFieldSets(i,o),(0,Tn.upsertEntityDataProperties)(e.entityDataByTypeName,k({typeName:s,keyFieldSets:o.isUnresolvableByKeyFieldSet.keys()},e.subgraphName?{subgraphNames:[e.subgraphName]}:{})),(0,Tn.getValueOrDefault)(e.entityInterfaceDataByTypeName,s,()=>({concreteTypeNames:new Set,fieldDatas:[],interfaceFieldNames:new Set,interfaceObjectFieldNames:new Set,isInterfaceObject:!1,typeName:s}))}},InterfaceTypeExtension:{enter(i){let s=i.name.value;if(e.internalGraph.addOrUpdateNode(s,{isAbstract:!0}),!(0,pT.isObjectLikeNodeEntity)(i))return;let o=(0,Tn.getValueOrDefault)(e.keyFieldSetDataByTypeName,s,Jl.newKeyFieldSetData);e.extractKeyFieldSets(i,o),(0,Tn.upsertEntityDataProperties)(e.entityDataByTypeName,k({typeName:s,keyFieldSets:o.isUnresolvableByKeyFieldSet.keys()},e.subgraphName?{subgraphNames:[e.subgraphName]}:{}))}},ObjectTypeDefinition:{enter(i){if(!(0,pT.isObjectLikeNodeEntity)(i))return;let s=i.name.value;(0,pT.isNodeInterfaceObject)(i)&&(e.entityInterfaceDataByTypeName.set(s,{fieldDatas:[],interfaceObjectFieldNames:new Set,interfaceFieldNames:new Set,isInterfaceObject:!0,typeName:s}),e.internalGraph.addOrUpdateNode(s,{isAbstract:!0}));let o=(0,Tn.getValueOrDefault)(e.keyFieldSetDataByTypeName,s,Jl.newKeyFieldSetData);e.extractKeyFieldSets(i,o),(0,Tn.upsertEntityDataProperties)(e.entityDataByTypeName,k({typeName:s,keyFieldSets:o.isUnresolvableByKeyFieldSet.keys()},e.subgraphName?{subgraphNames:[e.subgraphName]}:{}))}},ObjectTypeExtension:{enter(i){if(!(0,pT.isObjectLikeNodeEntity)(i))return;let s=i.name.value,o=(0,Tn.getValueOrDefault)(e.keyFieldSetDataByTypeName,s,Jl.newKeyFieldSetData);e.extractKeyFieldSets(i,o),(0,Tn.upsertEntityDataProperties)(e.entityDataByTypeName,k({typeName:s,keyFieldSets:o.isUnresolvableByKeyFieldSet.keys()},e.subgraphName?{subgraphNames:[e.subgraphName]}:{}))}},OperationTypeDefinition:{enter(i){let s=i.operation,o=e.schemaDefinition.operationTypes.get(s),u=(0,fT.getTypeNodeNamedTypeName)(i.type);if(o)return(0,Wa.duplicateOperationTypeDefinitionError)(s,u,(0,fT.getTypeNodeNamedTypeName)(o.type)),!1;let l=e.operationTypeNodeByTypeName.get(u);return l?(e.errors.push((0,Wa.invalidOperationTypeDefinitionError)(l,u,s)),!1):(e.operationTypeNodeByTypeName.set(u,s),e.schemaDefinition.operationTypes.set(s,i),!1)}},SchemaDefinition:{enter(i){r.push(i),e.schemaDefinition.description=i.description}},SchemaExtension:{enter(i){r.push(i)}},UnionTypeDefinition:{enter(i){i.name.value!==rr.ENTITY_UNION&&e.upsertUnionByNode(i)}},UnionTypeExtension:{enter(i){if(i.name.value===rr.ENTITY_UNION)return!1;e.upsertUnionByNode(i,!0)}}});for(let i of r)(0,Fi.extractDirectives)(i,e.schemaDefinition.directivesByDirectiveName,e.errors,e.directiveDefinitionByDirectiveName,e.handledRepeatedDirectivesByHostPath,rr.SCHEMA)}function ade(e,t){let n=!1,r;(0,nr.visit)(t,{EnumTypeDefinition:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertEnumDataByNode(i)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},EnumTypeExtension:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertEnumDataByNode(i,!0)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},EnumValueDefinition:{enter(i){e.childName=i.name.value,e.lastChildNodeKind=i.kind;let s=(0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA);if(s.kind!==nr.Kind.ENUM_TYPE_DEFINITION){e.errors.push((0,Wa.unexpectedParentKindForChildError)(e.originalParentTypeName,"enum or enum extension",(0,Tn.kindToTypeString)(s.kind),e.childName,(0,Tn.kindToTypeString)(i.kind)));return}if(s.enumValueDataByValueName.has(e.childName)){e.errors.push((0,Wa.duplicateEnumValueDefinitionError)(e.originalParentTypeName,e.childName));return}(0,Fi.addEnumValueDataByNode)(s.enumValueDataByValueName,i,e.errors,e.directiveDefinitionByDirectiveName,e.handledRepeatedDirectivesByHostPath,e.originalParentTypeName)},leave(){e.childName="",e.lastChildNodeKind=nr.Kind.NULL}},FieldDefinition:{enter(i){if(e.childName=i.name.value,n&&(e.childName===rr.SERVICE_FIELD||e.childName===rr.ENTITIES_FIELD))return!1;e.edfsDirectiveReferences.size>0&&e.validateSubscriptionFilterDirectiveLocation(i),e.lastChildNodeKind=i.kind;let s=(0,fT.getTypeNodeNamedTypeName)(i.type);r&&!r.isAbstract&&e.internalGraph.addEdge(r,e.internalGraph.addOrUpdateNode(s),e.childName),Yl.BASE_SCALARS.has(s)||e.referencedTypeNames.add(s);let o=(0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA);if(o.kind!==nr.Kind.OBJECT_TYPE_DEFINITION&&o.kind!==nr.Kind.INTERFACE_TYPE_DEFINITION){e.errors.push((0,Wa.unexpectedParentKindForChildError)(e.originalParentTypeName,'"Object" or "Interface"',(0,Tn.kindToTypeString)(o.kind),e.childName,(0,Tn.kindToTypeString)(i.kind)));return}if(o.fieldDataByFieldName.has(e.childName)){e.errors.push((0,Wa.duplicateFieldDefinitionError)((0,Tn.kindToTypeString)(o.kind),o.name,e.childName));return}let u=(0,Fi.extractArguments)(new Map,i,e.errors,e.directiveDefinitionByDirectiveName,e.handledRepeatedDirectivesByHostPath,e.parentsWithChildArguments,e.originalParentTypeName,e.renamedParentTypeName||e.originalParentTypeName,e.subgraphName),l=e.extractDirectivesAndAuthorization(i,new Map);(0,Fi.addInheritedDirectivesToFieldData)(o.directivesByDirectiveName,l);let d=(0,Fi.addFieldDataByNode)(o.fieldDataByFieldName,i,u,l,e.originalParentTypeName,e.renamedParentTypeName||e.originalParentTypeName,e.subgraphName,e.isSubgraphVersionTwo,e.errors);!(0,Fi.isParentDataInterfaceType)(o)&&l.has(rr.EXTERNAL)&&e.unvalidatedExternalFieldCoords.add(`${e.originalParentTypeName}.${i.name.value}`),n&&e.extractEventDirectivesToConfiguration(i,u);let p=d.directivesByDirectiveName.get(rr.PROVIDES),y=d.directivesByDirectiveName.get(rr.REQUIRES);if(!y&&!p)return;let N=e.entityDataByTypeName.get(e.originalParentTypeName),I=(0,Tn.getValueOrDefault)(e.fieldSetDataByTypeName,e.originalParentTypeName,Jl.newFieldSetData);N&&N.fieldNames.add(e.childName),p&&(0,Jl.extractFieldSetValue)(e.childName,I.provides,p),y&&(N||e.warnings.push((0,sde.requiresDefinedOnNonEntityFieldWarning)(`${e.originalParentTypeName}.${e.childName}`,e.subgraphName)),(0,Jl.extractFieldSetValue)(e.childName,I.requires,y))},leave(){e.childName="",e.lastChildNodeKind=nr.Kind.NULL}},InputObjectTypeDefinition:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertInputObjectByNode(i)},leave(){e.lastParentNodeKind=nr.Kind.NULL,e.originalParentTypeName=""}},InputObjectTypeExtension:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertInputObjectByNode(i,!0)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},InputValueDefinition:{enter(i){let s=i.name.value;if(e.lastParentNodeKind!==nr.Kind.INPUT_OBJECT_TYPE_DEFINITION&&e.lastParentNodeKind!==nr.Kind.INPUT_OBJECT_TYPE_EXTENSION){e.argumentName=s;return}e.childName=s,e.lastChildNodeKind=i.kind;let o=`${e.originalParentTypeName}.${s}`,u=(0,fT.getTypeNodeNamedTypeName)(i.type);Yl.BASE_SCALARS.has(u)||e.referencedTypeNames.add(u);let l=(0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA);if(l.kind!==nr.Kind.INPUT_OBJECT_TYPE_DEFINITION)return e.errors.push((0,Wa.unexpectedParentKindForChildError)(e.originalParentTypeName,"input object or input object extension",(0,Tn.kindToTypeString)(l.kind),e.childName,(0,Tn.kindToTypeString)(i.kind))),!1;if(l.inputValueDataByValueName.has(s)){e.errors.push((0,Wa.duplicateInputFieldDefinitionError)(e.originalParentTypeName,s));return}(0,Fi.addInputValueDataByNode)(l.inputValueDataByValueName,i,e.directiveDefinitionByDirectiveName,e.handledRepeatedDirectivesByHostPath,o,e.subgraphName,e.errors)},leave(){e.argumentName="",e.lastChildNodeKind===nr.Kind.INPUT_VALUE_DEFINITION&&(e.childName="",e.lastChildNodeKind=nr.Kind.NULL)}},InterfaceTypeDefinition:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertInterfaceDataByNode(i)},leave(){(0,Fi.removeInheritableDirectivesFromParentWithFieldsData)((0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA)),e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},InterfaceTypeExtension:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertInterfaceDataByNode(i,!0)},leave(){(0,Fi.removeInheritableDirectivesFromParentWithFieldsData)((0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA)),e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},ObjectTypeDefinition:{enter(i){if(i.name.value===rr.SERVICE_OBJECT)return!1;e.originalParentTypeName=i.name.value,n=(0,Fi.isTypeNameRootType)(e.originalParentTypeName,e.operationTypeNodeByTypeName),e.renamedParentTypeName=(0,Fi.getRenamedRootTypeName)(e.originalParentTypeName,e.operationTypeNodeByTypeName),e.originalTypeNameByRenamedTypeName.set(e.renamedParentTypeName,e.originalParentTypeName),r=n?e.internalGraph.getRootNode(e.renamedParentTypeName):e.internalGraph.addOrUpdateNode(e.renamedParentTypeName),e.lastParentNodeKind=i.kind,e.upsertObjectDataByNode(i)},leave(){(0,Fi.removeInheritableDirectivesFromParentWithFieldsData)((0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA)),r=void 0,n=!1,e.originalParentTypeName="",e.renamedParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},ObjectTypeExtension:{enter(i){if(i.name.value===rr.SERVICE_OBJECT)return!1;e.originalParentTypeName=i.name.value,n=(0,Fi.isTypeNameRootType)(e.originalParentTypeName,e.operationTypeNodeByTypeName),e.renamedParentTypeName=(0,Fi.getRenamedRootTypeName)(e.originalParentTypeName,e.operationTypeNodeByTypeName),e.originalTypeNameByRenamedTypeName.set(e.renamedParentTypeName,e.originalParentTypeName),r=n?e.internalGraph.getRootNode(e.renamedParentTypeName):e.internalGraph.addOrUpdateNode(e.renamedParentTypeName),e.lastParentNodeKind=i.kind,e.upsertObjectDataByNode(i,!0)},leave(){(0,Fi.removeInheritableDirectivesFromParentWithFieldsData)((0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA)),r=void 0,n=!1,e.originalParentTypeName="",e.renamedParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},ScalarTypeDefinition:{enter(i){if(i.name.value===rr.ANY_SCALAR)return!1;e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertScalarByNode(i)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},ScalarTypeExtension:{enter(i){if(i.name.value===rr.ANY_SCALAR)return!1;e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertScalarByNode(i,!0)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}}})}function ude(e,t){let n,r=!1;(0,nr.visit)(t,{FieldDefinition:{enter(i){e.childName=i.name.value;let s=(0,fT.getTypeNodeNamedTypeName)(i.type),o=e.leafTypeNamesWithAuthorizationDirectives.has(s);if((!n||!n.hasParentLevelAuthorization)&&!o)return!1;let u=e.renamedParentTypeName||e.originalParentTypeName;n||(n=(0,Tn.setAndGetValue)(e.authorizationDataByParentTypeName,u,(0,Tn.newAuthorizationData)(u)));let l=(0,Tn.getValueOrDefault)(n.fieldAuthorizationDataByFieldName,e.childName,()=>(0,Tn.newFieldAuthorizationData)(e.childName));if(!(0,Tn.mergeAuthorizationDataByAND)(n,l))return e.invalidOrScopesHostPaths.add(`${e.originalParentTypeName}.${e.childName}`),!1;if(!o)return!1;if(r)return(0,Tn.getValueOrDefault)(e.heirFieldAuthorizationDataByTypeName,s,()=>[]).push(l),!1;let d=e.authorizationDataByParentTypeName.get(s);return d&&d.hasParentLevelAuthorization&&!(0,Tn.mergeAuthorizationDataByAND)(d,l)&&e.invalidOrScopesHostPaths.add(`${e.originalParentTypeName}.${e.childName}`),!1},leave(){e.childName=""}},InterfaceTypeDefinition:{enter(i){e.originalParentTypeName=i.name.value,n=e.getAuthorizationData(i),r=!0},leave(){e.originalParentTypeName="",n=void 0,r=!1}},InterfaceTypeExtension:{enter(i){e.originalParentTypeName=i.name.value,n=e.getAuthorizationData(i),r=!0},leave(){e.originalParentTypeName="",n=void 0,r=!1}},ObjectTypeDefinition:{enter(i){let s=e.parentDefinitionDataByTypeName.get(i.name.value);if(!s)return!1;e.originalParentTypeName=s.name,e.renamedParentTypeName=s.renamedTypeName,n=e.getAuthorizationData(i)},leave(){e.originalParentTypeName="",e.renamedParentTypeName="",n=void 0}},ObjectTypeExtension:{enter(i){let s=e.parentDefinitionDataByTypeName.get(i.name.value);if(!s)return!1;e.originalParentTypeName=s.name,e.renamedParentTypeName=s.renamedTypeName,n=e.getAuthorizationData(i)},leave(){e.originalParentTypeName="",e.renamedParentTypeName="",n=void 0}}})}});var BR=j(pa=>{"use strict";m();T();h();Object.defineProperty(pa,"__esModule",{value:!0});pa.EntityDataNode=pa.RootNode=pa.GraphNode=pa.Edge=void 0;var aI=ps(),CR=class{constructor(t,n,r,i=!1){A(this,"edgeName");A(this,"id");A(this,"isAbstractEdge");A(this,"isInaccessible",!1);A(this,"node");A(this,"visitedIndices",new Set);this.edgeName=i?`... on ${r}`:r,this.id=t,this.isAbstractEdge=i,this.node=n}};pa.Edge=CR;var xR=class{constructor(t,n,r){A(this,"fieldDataByFieldName",new Map);A(this,"headToTailEdges",new Map);A(this,"entityEdges",[]);A(this,"nodeName");A(this,"hasEntitySiblings",!1);A(this,"isAbstract");A(this,"isInaccessible",!1);A(this,"isLeaf",!1);A(this,"isRootNode",!1);A(this,"satisfiedFieldSets",new Set);A(this,"subgraphName");A(this,"typeName");this.isAbstract=!!(r!=null&&r.isAbstract),this.isLeaf=!!(r!=null&&r.isLeaf),this.nodeName=`${t}.${n}`,this.subgraphName=t,this.typeName=n}handleInaccessibleEdges(){if(this.isAbstract)return;let t=(0,aI.getEntriesNotInHashSet)(this.headToTailEdges.keys(),this.fieldDataByFieldName);for(let n of t){let r=this.headToTailEdges.get(n);r&&(r.isInaccessible=!0)}}getAllAccessibleEntityNodeNames(){let t=new Set([this.nodeName]);return this.getAccessibleEntityNodeNames(this,t),t.delete(this.nodeName),t}getAccessibleEntityNodeNames(t,n){for(let r of t.entityEdges)(0,aI.add)(n,r.node.nodeName)&&this.getAccessibleEntityNodeNames(r.node,n)}};pa.GraphNode=xR;var UR=class{constructor(t){A(this,"fieldDataByFieldName",new Map);A(this,"headToShareableTailEdges",new Map);A(this,"isAbstract",!1);A(this,"isRootNode",!0);A(this,"typeName");this.typeName=t}removeInaccessibleEdges(t){for(let[n,r]of this.headToShareableTailEdges)if(!t.has(n))for(let i of r)i.isInaccessible=!0}};pa.RootNode=UR;var MR=class{constructor(t){A(this,"fieldSetsByTargetSubgraphName",new Map);A(this,"targetSubgraphNamesByFieldSet",new Map);A(this,"typeName");this.typeName=t}addTargetSubgraphByFieldSet(t,n){(0,aI.getValueOrDefault)(this.targetSubgraphNamesByFieldSet,t,()=>new Set).add(n),(0,aI.getValueOrDefault)(this.fieldSetsByTargetSubgraphName,n,()=>new Set).add(t)}};pa.EntityDataNode=MR});var jR=j(Xa=>{"use strict";m();T();h();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.NodeResolutionData=void 0;Xa.newRootFieldData=cde;Xa.generateResolvabilityErrorReasons=Iq;Xa.generateSelectionSetSegments=vq;Xa.renderSelectionSet=_q;Xa.generateResolvabilityErrors=pde;var Eq=ps(),zl=bi(),gq=To(),VR=class{constructor(t,n){A(this,"fieldDataByFieldName");A(this,"isResolved",!1);A(this,"resolvedFieldNames",new Set);A(this,"typeName");this.fieldDataByFieldName=n,this.typeName=t}add(t){if(this.resolvedFieldNames.add(t),this.resolvedFieldNames.size>this.fieldDataByFieldName.size){let n=(0,Eq.getEntriesNotInHashSet)(this.resolvedFieldNames,this.fieldDataByFieldName);throw(0,gq.unexpectedEdgeFatalError)(this.typeName,n)}return this.isResolved=this.resolvedFieldNames.size===this.fieldDataByFieldName.size,this.isResolved}};Xa.NodeResolutionData=VR;function cde(e,t,n){return{coordinate:`${e}.${t}`,message:`The root type field "${e}.${t}" is defined in the following subgraph`+(n.size>1?"s":"")+`: "${[...n].join(zl.QUOTATION_JOIN)}".`,subgraphNames:n}}function lde(e,t){return e.isLeaf?e.name+` <-- +${t}`:"",subgraph:{name:e}})}});var Ql=j(Ns=>{"use strict";m();T();h();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.newKeyFieldSetData=Ule;Ns.newFieldSetData=Mle;Ns.areNodeKindAndDirectiveLocationCompatible=Ble;Ns.getDirectiveDefinitionArgumentSets=Vle;Ns.addFieldNamesToConfigurationData=jle;Ns.extractFieldSetValue=$le;Ns.getNormalizedFieldSet=FR;Ns.validateKeyFieldSets=Gle;Ns.validateAndAddConditionalFieldSetsToConfiguration=Yle;Ns.isNodeQuery=Jle;Ns.validateArgumentTemplateReferences=zle;var Pe=(Le(),Me(je)),zi=ps(),lT=$i(),Wn=bi(),jt=To(),RR=Oc(),Tq=iA(),dT=Qa(),da=Jp(),xle=cT();function Ule(){return{isUnresolvableByKeyFieldSet:new Map}}function Mle(){return{provides:new Map,requires:new Map}}function Ble(e,t,n=!1){for(let r of t.locations){let i=r.value.toUpperCase();switch(i){case Wn.ARGUMENT_DEFINITION_UPPER:if(!n)break;if(e===Pe.Kind.INPUT_VALUE_DEFINITION)return!0;break;case Wn.ENUM_UPPER:if(e===Pe.Kind.ENUM_TYPE_DEFINITION||e===Pe.Kind.ENUM_TYPE_EXTENSION)return!0;break;case Wn.ENUM_VALUE_UPPER:if(e===Pe.Kind.ENUM_VALUE_DEFINITION)return!0;break;case Wn.FIELD_UPPER:if(e===Pe.Kind.FIELD)return!0;break;case Wn.FIELD_DEFINITION_UPPER:if(e===Pe.Kind.FIELD_DEFINITION)return!0;break;case Wn.INLINE_FRAGMENT_UPPER:if(e===Pe.Kind.INLINE_FRAGMENT)return!0;break;case Wn.INPUT_FIELD_DEFINITION_UPPER:if(e===Pe.Kind.INPUT_VALUE_DEFINITION)return!0;break;case Wn.INPUT_OBJECT_UPPER:if(e===Pe.Kind.INPUT_OBJECT_TYPE_DEFINITION||e===Pe.Kind.INPUT_OBJECT_TYPE_EXTENSION)return!0;break;case Wn.INTERFACE_UPPER:if(e===Pe.Kind.INTERFACE_TYPE_DEFINITION||e===Pe.Kind.INTERFACE_TYPE_EXTENSION)return!0;break;case Wn.OBJECT_UPPER:if(e===Pe.Kind.OBJECT_TYPE_DEFINITION||e===Pe.Kind.OBJECT_TYPE_EXTENSION)return!0;break;case Wn.FRAGMENT_DEFINITION_UPPER:if(e===Pe.Kind.FRAGMENT_DEFINITION)return!0;break;case Wn.FRAGMENT_SPREAD_UPPER:if(e===Pe.Kind.FRAGMENT_SPREAD)return!0;break;case Wn.SCALAR_UPPER:if(e===Pe.Kind.SCALAR_TYPE_DEFINITION||e===Pe.Kind.SCALAR_TYPE_EXTENSION)return!0;break;case Wn.SCHEMA_UPPER:if(e===Pe.Kind.SCHEMA_DEFINITION||e===Pe.Kind.SCHEMA_EXTENSION)return!0;break;case Wn.UNION_UPPER:if(e===Pe.Kind.UNION_TYPE_DEFINITION||e===Pe.Kind.UNION_TYPE_EXTENSION)return!0;break;case Wn.VARIABLE_DEFINITION_UPPER:if(e===Pe.Kind.VARIABLE_DEFINITION)return!0;break;case Wn.QUERY_UPPER:case Wn.MUTATION_UPPER:case Wn.SUBSCRIPTION_UPPER:if(e===Pe.Kind.OPERATION_DEFINITION)return!0;break;default:throw(0,jt.unexpectedDirectiveLocationError)(i)}}return!1}function Vle(e,t,n){for(let r of e){let i=r.name.value;t.set(i,r.type),r.type.kind===Pe.Kind.NON_NULL_TYPE&&!r.defaultValue&&n.add(i)}}function jle(e,t){let n=new Set;for(let[r,i]of e)i.directivesByDirectiveName.has(Wn.EXTERNAL)?t.externalFieldNames?t.externalFieldNames.add(r):n.add(r):t.fieldNames.add(r);n.size>0&&(t.externalFieldNames=n)}function $le(e,t,n){if(!n||n.length>1)return;let r=n[0].arguments;if(!r||r.length!==1)return;let i=r[0];i.name.value!==Wn.FIELDS||i.value.kind!==Pe.Kind.STRING||t.set(e,i.value.value)}function FR(e){return(0,Pe.print)((0,lT.lexicographicallySortDocumentNode)(e)).replaceAll(/\s+/g," ").slice(2,-2)}function qle(e,t,n){switch(e){case da.FieldSetDirective.PROVIDES:return[`${t}.${n}`];default:return[]}}function Kle(e,t,n,r,i,s){let{error:o,documentNode:u}=(0,lT.safeParse)("{"+n+"}");if(o||!u)return{errorMessage:(0,jt.unparsableFieldSetErrorMessage)(n,o)};let l=[t],d=[],p=qle(i,s,r),y=[r],N=new Set,I,O=-1,x=!0,V=r;return(0,Pe.visit)(u,{Argument:{enter(){return!1}},Field:{enter(K){let re=l[O],se=re.name;if(re.kind===Pe.Kind.UNION_TYPE_DEFINITION)return I=(0,jt.invalidSelectionOnUnionErrorMessage)(n,p,se),Pe.BREAK;let fe=K.name.value,he=`${se}.${fe}`;if(e.unvalidatedExternalFieldCoords.delete(he),x)return I=(0,jt.invalidSelectionSetErrorMessage)(n,p,se,(0,zi.kindToTypeString)(re.kind)),Pe.BREAK;p.push(he),y.push(fe),V=fe;let xe=re.fieldDataByFieldName.get(fe);if(!xe)return I=(0,jt.undefinedFieldInFieldSetErrorMessage)(n,se,fe),Pe.BREAK;if(d[O].has(fe))return I=(0,jt.duplicateFieldInFieldSetErrorMessage)(n,he),Pe.BREAK;d[O].add(fe);let ht=xe.isExternalBySubgraphName.get(e.subgraphName),Ct=(0,dT.getTypeNodeNamedTypeName)(xe.node.type),B=e.parentDefinitionDataByTypeName.get(Ct);if(RR.BASE_SCALARS.has(Ct)||(B==null?void 0:B.kind)===Pe.Kind.SCALAR_TYPE_DEFINITION||(B==null?void 0:B.kind)===Pe.Kind.ENUM_TYPE_DEFINITION){if(N.size<1&&!ht){e.isSubgraphVersionTwo?e.errors.push((0,jt.nonExternalConditionalFieldError)(`${s}.${r}`,e.subgraphName,he,n,i)):e.warnings.push((0,xle.nonExternalConditionalFieldWarning)(`${s}.${r}`,e.subgraphName,he,n,i));return}let Te=(0,zi.getValueOrDefault)(e.conditionalFieldDataByCoordinates,he,da.newConditionalFieldData),nt=(0,Tq.newFieldSetConditionData)({fieldCoordinatesPath:[...p],fieldPath:[...y]});i===da.FieldSetDirective.PROVIDES?Te.providedBy.push(nt):Te.requiredBy.push(nt);return}if(!B)return I=(0,jt.unknownTypeInFieldSetErrorMessage)(n,he,Ct),Pe.BREAK;if(ht){let Te=(0,zi.getValueOrDefault)(e.conditionalFieldDataByCoordinates,he,da.newConditionalFieldData);switch(i){case da.FieldSetDirective.PROVIDES:Te.providedBy.push((0,Tq.newFieldSetConditionData)({fieldCoordinatesPath:[...p],fieldPath:[...y]}));break;default:break}N.add(he)}if(B.kind===Pe.Kind.OBJECT_TYPE_DEFINITION||B.kind===Pe.Kind.INTERFACE_TYPE_DEFINITION||B.kind===Pe.Kind.UNION_TYPE_DEFINITION){x=!0,l.push(B);return}},leave(){N.delete(p.pop()||""),y.pop()}},InlineFragment:{enter(K){let re=l[O],se=re.name,fe=p.length<1?t.name:p[p.length-1];if(!K.typeCondition)return I=(0,jt.inlineFragmentWithoutTypeConditionErrorMessage)(n,fe),Pe.BREAK;let he=K.typeCondition.name.value;if(he===se){l.push(re),x=!0;return}if(!(0,lT.isKindAbstract)(re.kind))return I=(0,jt.invalidInlineFragmentTypeErrorMessage)(n,p,he,se),Pe.BREAK;let xe=e.parentDefinitionDataByTypeName.get(he);if(!xe)return I=(0,jt.unknownInlineFragmentTypeConditionErrorMessage)(n,p,se,he),Pe.BREAK;switch(x=!0,xe.kind){case Pe.Kind.INTERFACE_TYPE_DEFINITION:{if(!xe.implementedInterfaceTypeNames.has(se))break;l.push(xe);return}case Pe.Kind.OBJECT_TYPE_DEFINITION:{let ht=e.concreteTypeNamesByAbstractTypeName.get(se);if(!ht||!ht.has(he))break;l.push(xe);return}case Pe.Kind.UNION_TYPE_DEFINITION:{l.push(xe);return}default:return I=(0,jt.invalidInlineFragmentTypeConditionTypeErrorMessage)(n,p,se,he,(0,zi.kindToTypeString)(xe.kind)),Pe.BREAK}return I=(0,jt.invalidInlineFragmentTypeConditionErrorMessage)(n,p,he,(0,zi.kindToTypeString)(re.kind),se),Pe.BREAK}},SelectionSet:{enter(){if(!x){let K=l[O];if(K.kind===Pe.Kind.UNION_TYPE_DEFINITION)return I=(0,jt.unparsableFieldSetSelectionErrorMessage)(n,V),Pe.BREAK;let re=K.fieldDataByFieldName.get(V);if(!re)return I=(0,jt.undefinedFieldInFieldSetErrorMessage)(n,K.name,V),Pe.BREAK;let se=(0,dT.getTypeNodeNamedTypeName)(re.node.type),fe=e.parentDefinitionDataByTypeName.get(se),he=fe?fe.kind:Pe.Kind.SCALAR_TYPE_DEFINITION;return I=(0,jt.invalidSelectionSetDefinitionErrorMessage)(n,p,se,(0,zi.kindToTypeString)(he)),Pe.BREAK}if(O+=1,x=!1,O<0||O>=l.length)return I=(0,jt.unparsableFieldSetSelectionErrorMessage)(n,V),Pe.BREAK;d.push(new Set)},leave(){if(x){let K=l[O+1];I=(0,jt.invalidSelectionSetErrorMessage)(n,p,K.name,(0,zi.kindToTypeString)(K.kind)),x=!1}O-=1,l.pop(),d.pop()}}}),I?{errorMessage:I}:{configuration:{fieldName:r,selectionSet:FR(u)}}}function Gle(e,t,n,r){let i=e.entityInterfaceDataByTypeName.has(t.name),s=t.name,o=[],u=[],l=new Set,d=[],p=i?void 0:e.internalGraph.addEntityDataNode(t.name),y=e.internalGraph.addOrUpdateNode(t.name);for(let[N,I]of n){let{error:O,documentNode:x}=(0,lT.safeParse)("{"+N+"}");if(O||!x){o.push((0,jt.unparsableFieldSetErrorMessage)(N,O));continue}let V=[t],K=[],re=[],se=new Set,fe=-1,he=!0,xe="";if((0,Pe.visit)(x,{Argument:{enter(Ct){return o.push((0,jt.unexpectedArgumentErrorMessage)(N,`${V[fe].name}.${xe}`,Ct.name.value)),Pe.BREAK}},Field:{enter(Ct){let B=V[fe-1],Te=V[fe],nt=Te.name,xt=Ct.name.value,rn=`${nt}.${xt}`;if(e.unvalidatedExternalFieldCoords.delete(rn),he)return o.push((0,jt.invalidSelectionSetErrorMessage)(N,[`${B.name}.${xe}`],nt,(0,zi.kindToTypeString)(Te.kind))),Pe.BREAK;xe=xt;let wn=Te.fieldDataByFieldName.get(xt);if(!wn)return o.push((0,jt.undefinedFieldInFieldSetErrorMessage)(N,nt,xt)),Pe.BREAK;if(wn.argumentDataByArgumentName.size)return o.push((0,jt.argumentsInKeyFieldSetErrorMessage)(N,rn)),Pe.BREAK;if(K[fe].has(xt))return o.push((0,jt.duplicateFieldInFieldSetErrorMessage)(N,rn)),Pe.BREAK;if(re.push(xt),wn.isShareableBySubgraphName.set(e.subgraphName,!0),K[fe].add(xt),fe===0)l.add(xt),r.add(xt);else{let mi=e.configurationDataByParentTypeName.get(nt);if(!mi)return o.push((0,jt.invalidConfigurationDataErrorMessage)(nt,xt,N)),Pe.BREAK;mi.fieldNames.add(xt)}(0,zi.getValueOrDefault)(e.keyFieldNamesByParentTypeName,nt,()=>new Set).add(xt);let vn=(0,dT.getTypeNodeNamedTypeName)(wn.node.type);if(RR.BASE_SCALARS.has(vn)){se.add(re.join(Wn.PERIOD)),re.pop();return}let _n=e.parentDefinitionDataByTypeName.get(vn);if(!_n)return o.push((0,jt.unknownTypeInFieldSetErrorMessage)(N,rn,vn)),Pe.BREAK;if(_n.kind===Pe.Kind.OBJECT_TYPE_DEFINITION){he=!0,V.push(_n);return}if((0,lT.isKindAbstract)(_n.kind))return o.push((0,jt.abstractTypeInKeyFieldSetErrorMessage)(N,rn,vn,(0,zi.kindToTypeString)(_n.kind))),Pe.BREAK;se.add(re.join(Wn.PERIOD)),re.pop()}},InlineFragment:{enter(){return o.push(jt.inlineFragmentInFieldSetErrorMessage),Pe.BREAK}},SelectionSet:{enter(){if(!he){let Ct=V[fe],Te=`${Ct.name}.${xe}`,nt=Ct.fieldDataByFieldName.get(xe);if(!nt)return o.push((0,jt.undefinedFieldInFieldSetErrorMessage)(N,Te,xe)),Pe.BREAK;let xt=(0,dT.getTypeNodeNamedTypeName)(nt.node.type),rn=e.parentDefinitionDataByTypeName.get(xt),wn=rn?rn.kind:Pe.Kind.SCALAR_TYPE_DEFINITION;return o.push((0,jt.invalidSelectionSetDefinitionErrorMessage)(N,[Te],xt,(0,zi.kindToTypeString)(wn))),Pe.BREAK}if(fe+=1,he=!1,fe<0||fe>=V.length)return o.push((0,jt.unparsableFieldSetSelectionErrorMessage)(N,xe)),Pe.BREAK;K.push(new Set)},leave(){if(he){let B=V[fe].name,Te=V[fe+1],nt=`${B}.${xe}`;o.push((0,jt.invalidSelectionSetErrorMessage)(N,[nt],Te.name,(0,zi.kindToTypeString)(Te.kind))),he=!1}fe-=1,V.pop(),K.pop()}}}),o.length>0)continue;let ht=FR(x);u.push(k({fieldName:"",selectionSet:ht},I?{disableEntityResolver:!0}:{})),y.satisfiedFieldSets.add(ht),!I&&(p==null||p.addTargetSubgraphByFieldSet(ht,e.subgraphName),d.push(se))}if(o.length){e.errors.push((0,jt.invalidKeyDirectivesError)(s,o));return}if(u.length)return u}function Qle(e,t,n,r,i){if(t!==da.FieldSetDirective.PROVIDES)return{fieldSetParentData:n};let s=(0,zi.getOrThrowError)(n.fieldDataByFieldName,r,`${i}.fieldDataByFieldName`),o=(0,dT.getTypeNodeNamedTypeName)(s.node.type),u=e.parentDefinitionDataByTypeName.get(o);return u?u.kind!==Pe.Kind.INTERFACE_TYPE_DEFINITION&&u.kind!==Pe.Kind.OBJECT_TYPE_DEFINITION?{errorString:(0,jt.incompatibleTypeWithProvidesErrorMessage)(`${i}.${r}`,o)}:{fieldSetParentData:u}:{errorString:(0,jt.unknownNamedTypeErrorMessage)(`${i}.${r}`,o)}}function yq(e,t,n,r){let i=[],s=[],o=(0,da.getParentTypeName)(t);for(let[u,l]of n){let{fieldSetParentData:d,errorString:p}=Qle(e,r,t,u,o),y=`${o}.${u}`;if(p){i.push(p);continue}if(!d)continue;let{errorMessage:N,configuration:I}=Kle(e,d,l,u,r,o);if(N){i.push(` On "${y}" \u2014`+N);continue}if(I){s.push(I);continue}throw(0,jt.invalidConfigurationResultFatalError)(y)}if(i.length>0){e.errors.push((0,jt.invalidProvidesOrRequiresDirectivesError)(r,i));return}if(s.length>0)return s}function Yle(e,t,n){let r=(0,zi.getOrThrowError)(e.configurationDataByParentTypeName,(0,da.getParentTypeName)(t),"configurationDataByParentTypeName"),i=yq(e,t,n.provides,da.FieldSetDirective.PROVIDES);i&&(r.provides=i);let s=yq(e,t,n.requires,da.FieldSetDirective.REQUIRES);s&&(r.requires=s)}function Jle(e,t){return e===Wn.QUERY||t===Pe.OperationTypeNode.QUERY}function zle(e,t,n){let r=e.matchAll(RR.EDFS_ARGS_REGEXP),i=new Set,s=new Set;for(let o of r){if(o.length<2){s.add(o[0]);continue}t.has(o[1])||i.add(o[1])}for(let o of i)n.push((0,jt.undefinedEventSubjectsArgumentErrorMessage)(o));for(let o of s)n.push((0,jt.invalidEventSubjectsArgumentErrorMessage)(o))}});var wR=j(zp=>{"use strict";m();T();h();Object.defineProperty(zp,"__esModule",{value:!0});zp.newParentTagData=ede;zp.newChildTagData=tde;zp.validateImplicitFieldSets=nde;zp.newContractTagOptionsFromArrays=rde;var Hle=ps(),Wle=Qa(),Ws=VV(),Xle=Oc(),Nq=$i(),Zle=Ql();function ede(e){return{childTagDataByChildName:new Map,tagNames:new Set,typeName:e}}function tde(e){return{name:e,tagNames:new Set,tagNamesByArgumentName:new Map}}function nde({conditionalFieldDataByCoordinates:e,configurationData:t,fieldSets:n,implicitKeys:r,objectData:i,parentDefinitionDataByTypeName:s,graphNode:o}){for(let u of n){let{error:l,documentNode:d}=(0,Nq.safeParse)("{"+u+"}");if(l||!d)continue;let p=[i],y=[],N=new Set,I=[],O=-1,x=!0,V=!0;if((0,Ws.visit)(d,{Argument:{enter(){return V=!1,Ws.BREAK}},Field:{enter(re){let se=p[O];if(x)return V=!1,Ws.BREAK;let fe=re.name.value,he=se.fieldDataByFieldName.get(fe);if(!he||he.argumentDataByArgumentName.size||y[O].has(fe))return V=!1,Ws.BREAK;let xe=e.get(`${he.renamedParentTypeName}.${fe}`);if(xe){if(xe.providedBy.length>0)I.push(...xe.providedBy);else if(xe.requiredBy.length>0)return V=!1,Ws.BREAK}y[O].add(fe),O===0&&N.add(fe);let ht=(0,Wle.getTypeNodeNamedTypeName)(he.node.type);if(Xle.BASE_SCALARS.has(ht))return;let Ct=s.get(ht);if(!Ct)return V=!1,Ws.BREAK;if(Ct.kind===Ws.Kind.OBJECT_TYPE_DEFINITION){x=!0,p.push(Ct);return}if((0,Nq.isKindAbstract)(Ct.kind))return V=!1,Ws.BREAK}},InlineFragment:{enter(){return V=!1,Ws.BREAK}},SelectionSet:{enter(){if(!x||(O+=1,x=!1,O<0||O>=p.length))return V=!1,Ws.BREAK;y.push(new Set)},leave(){if(x)return V=!1,Ws.BREAK;O-=1,p.pop(),y.pop()}}}),!V)continue;(0,Hle.addIterableValuesToSet)(N,t.fieldNames);let K=(0,Zle.getNormalizedFieldSet)(d);r.push(G(k({fieldName:"",selectionSet:K},I.length>0?{conditions:I}:{}),{disableEntityResolver:!0})),o&&o.satisfiedFieldSets.add(K)}}function rde(e,t){return{tagNamesToExclude:new Set(e),tagNamesToInclude:new Set(t)}}});var PR=j(LR=>{"use strict";m();T();h();Object.defineProperty(LR,"__esModule",{value:!0});LR.recordSubgraphName=ide;function ide(e,t,n){if(!t.has(e)){t.add(e);return}n.add(e)}});var kR=j(mT=>{"use strict";m();T();h();Object.defineProperty(mT,"__esModule",{value:!0});mT.upsertDirectiveSchemaAndEntityDefinitions=ode;mT.upsertParentsAndChildren=ade;mT.consolidateAuthorizationDirectives=ude;var nr=(Le(),Me(je)),Wa=To(),Yl=Oc(),Tn=ps(),pT=$i(),Jl=Ql(),rr=bi(),Fi=Jp(),fT=Qa(),sde=cT();function ode(e,t){let n=new Set,r=[];(0,nr.visit)(t,{Directive:{enter(i){let s=i.name.value;if(rr.EVENT_DIRECTIVE_NAMES.has(s)&&e.edfsDirectiveReferences.add(s),Yl.V2_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.has(s))return e.isSubgraphVersionTwo=!0,!1;if(Yl.BASE_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.has(s))return!1;s===rr.SUBSCRIPTION_FILTER&&e.directiveDefinitionByDirectiveName.set(rr.SUBSCRIPTION_FILTER,Yl.SUBSCRIPTION_FILTER_DEFINITION),e.referencedDirectiveNames.add(s)}},DirectiveDefinition:{enter(i){let s=i.name.value;return n.has(s)?(e.errors.push((0,Wa.duplicateDirectiveDefinitionError)(s)),!1):(n.add(s),Yl.V2_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.has(s)?(e.isSubgraphVersionTwo=!0,!1):(Yl.BASE_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.has(s)||s===rr.SUBSCRIPTION_FILTER||(e.directiveDefinitionByDirectiveName.set(s,i),e.customDirectiveDefinitions.set(s,i)),!1))}},InterfaceTypeDefinition:{enter(i){let s=i.name.value;if(e.internalGraph.addOrUpdateNode(s,{isAbstract:!0}),!(0,pT.isObjectLikeNodeEntity)(i))return;let o=(0,Tn.getValueOrDefault)(e.keyFieldSetDataByTypeName,s,Jl.newKeyFieldSetData);e.extractKeyFieldSets(i,o),(0,Tn.upsertEntityDataProperties)(e.entityDataByTypeName,k({typeName:s,keyFieldSets:o.isUnresolvableByKeyFieldSet.keys()},e.subgraphName?{subgraphNames:[e.subgraphName]}:{})),(0,Tn.getValueOrDefault)(e.entityInterfaceDataByTypeName,s,()=>({concreteTypeNames:new Set,fieldDatas:[],interfaceFieldNames:new Set,interfaceObjectFieldNames:new Set,isInterfaceObject:!1,typeName:s}))}},InterfaceTypeExtension:{enter(i){let s=i.name.value;if(e.internalGraph.addOrUpdateNode(s,{isAbstract:!0}),!(0,pT.isObjectLikeNodeEntity)(i))return;let o=(0,Tn.getValueOrDefault)(e.keyFieldSetDataByTypeName,s,Jl.newKeyFieldSetData);e.extractKeyFieldSets(i,o),(0,Tn.upsertEntityDataProperties)(e.entityDataByTypeName,k({typeName:s,keyFieldSets:o.isUnresolvableByKeyFieldSet.keys()},e.subgraphName?{subgraphNames:[e.subgraphName]}:{}))}},ObjectTypeDefinition:{enter(i){if(!(0,pT.isObjectLikeNodeEntity)(i))return;let s=i.name.value;(0,pT.isNodeInterfaceObject)(i)&&(e.entityInterfaceDataByTypeName.set(s,{fieldDatas:[],interfaceObjectFieldNames:new Set,interfaceFieldNames:new Set,isInterfaceObject:!0,typeName:s}),e.internalGraph.addOrUpdateNode(s,{isAbstract:!0}));let o=(0,Tn.getValueOrDefault)(e.keyFieldSetDataByTypeName,s,Jl.newKeyFieldSetData);e.extractKeyFieldSets(i,o),(0,Tn.upsertEntityDataProperties)(e.entityDataByTypeName,k({typeName:s,keyFieldSets:o.isUnresolvableByKeyFieldSet.keys()},e.subgraphName?{subgraphNames:[e.subgraphName]}:{}))}},ObjectTypeExtension:{enter(i){if(!(0,pT.isObjectLikeNodeEntity)(i))return;let s=i.name.value,o=(0,Tn.getValueOrDefault)(e.keyFieldSetDataByTypeName,s,Jl.newKeyFieldSetData);e.extractKeyFieldSets(i,o),(0,Tn.upsertEntityDataProperties)(e.entityDataByTypeName,k({typeName:s,keyFieldSets:o.isUnresolvableByKeyFieldSet.keys()},e.subgraphName?{subgraphNames:[e.subgraphName]}:{}))}},OperationTypeDefinition:{enter(i){let s=i.operation,o=e.schemaDefinition.operationTypes.get(s),u=(0,fT.getTypeNodeNamedTypeName)(i.type);if(o)return(0,Wa.duplicateOperationTypeDefinitionError)(s,u,(0,fT.getTypeNodeNamedTypeName)(o.type)),!1;let l=e.operationTypeNodeByTypeName.get(u);return l?(e.errors.push((0,Wa.invalidOperationTypeDefinitionError)(l,u,s)),!1):(e.operationTypeNodeByTypeName.set(u,s),e.schemaDefinition.operationTypes.set(s,i),!1)}},SchemaDefinition:{enter(i){r.push(i),e.schemaDefinition.description=i.description}},SchemaExtension:{enter(i){r.push(i)}},UnionTypeDefinition:{enter(i){i.name.value!==rr.ENTITY_UNION&&e.upsertUnionByNode(i)}},UnionTypeExtension:{enter(i){if(i.name.value===rr.ENTITY_UNION)return!1;e.upsertUnionByNode(i,!0)}}});for(let i of r)(0,Fi.extractDirectives)(i,e.schemaDefinition.directivesByDirectiveName,e.errors,e.directiveDefinitionByDirectiveName,e.handledRepeatedDirectivesByHostPath,rr.SCHEMA)}function ade(e,t){let n=!1,r;(0,nr.visit)(t,{EnumTypeDefinition:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertEnumDataByNode(i)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},EnumTypeExtension:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertEnumDataByNode(i,!0)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},EnumValueDefinition:{enter(i){e.childName=i.name.value,e.lastChildNodeKind=i.kind;let s=(0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA);if(s.kind!==nr.Kind.ENUM_TYPE_DEFINITION){e.errors.push((0,Wa.unexpectedParentKindForChildError)(e.originalParentTypeName,"enum or enum extension",(0,Tn.kindToTypeString)(s.kind),e.childName,(0,Tn.kindToTypeString)(i.kind)));return}if(s.enumValueDataByValueName.has(e.childName)){e.errors.push((0,Wa.duplicateEnumValueDefinitionError)(e.originalParentTypeName,e.childName));return}(0,Fi.addEnumValueDataByNode)(s.enumValueDataByValueName,i,e.errors,e.directiveDefinitionByDirectiveName,e.handledRepeatedDirectivesByHostPath,e.originalParentTypeName,e.subgraphName)},leave(){e.childName="",e.lastChildNodeKind=nr.Kind.NULL}},FieldDefinition:{enter(i){if(e.childName=i.name.value,n&&(e.childName===rr.SERVICE_FIELD||e.childName===rr.ENTITIES_FIELD))return!1;e.edfsDirectiveReferences.size>0&&e.validateSubscriptionFilterDirectiveLocation(i),e.lastChildNodeKind=i.kind;let s=(0,fT.getTypeNodeNamedTypeName)(i.type);r&&!r.isAbstract&&e.internalGraph.addEdge(r,e.internalGraph.addOrUpdateNode(s),e.childName),Yl.BASE_SCALARS.has(s)||e.referencedTypeNames.add(s);let o=(0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA);if(o.kind!==nr.Kind.OBJECT_TYPE_DEFINITION&&o.kind!==nr.Kind.INTERFACE_TYPE_DEFINITION){e.errors.push((0,Wa.unexpectedParentKindForChildError)(e.originalParentTypeName,'"Object" or "Interface"',(0,Tn.kindToTypeString)(o.kind),e.childName,(0,Tn.kindToTypeString)(i.kind)));return}if(o.fieldDataByFieldName.has(e.childName)){e.errors.push((0,Wa.duplicateFieldDefinitionError)((0,Tn.kindToTypeString)(o.kind),o.name,e.childName));return}let u=(0,Fi.extractArguments)(new Map,i,e.errors,e.directiveDefinitionByDirectiveName,e.handledRepeatedDirectivesByHostPath,e.parentsWithChildArguments,e.originalParentTypeName,e.renamedParentTypeName||e.originalParentTypeName,e.subgraphName),l=e.extractDirectivesAndAuthorization(i,new Map);(0,Fi.addInheritedDirectivesToFieldData)(o.directivesByDirectiveName,l);let d=(0,Fi.addFieldDataByNode)(o.fieldDataByFieldName,i,u,l,e.originalParentTypeName,e.renamedParentTypeName||e.originalParentTypeName,e.subgraphName,e.isSubgraphVersionTwo,e.errors);!(0,Fi.isParentDataInterfaceType)(o)&&l.has(rr.EXTERNAL)&&e.unvalidatedExternalFieldCoords.add(`${e.originalParentTypeName}.${i.name.value}`),n&&e.extractEventDirectivesToConfiguration(i,u);let p=d.directivesByDirectiveName.get(rr.PROVIDES),y=d.directivesByDirectiveName.get(rr.REQUIRES);if(!y&&!p)return;let N=e.entityDataByTypeName.get(e.originalParentTypeName),I=(0,Tn.getValueOrDefault)(e.fieldSetDataByTypeName,e.originalParentTypeName,Jl.newFieldSetData);N&&N.fieldNames.add(e.childName),p&&(0,Jl.extractFieldSetValue)(e.childName,I.provides,p),y&&(N||e.warnings.push((0,sde.requiresDefinedOnNonEntityFieldWarning)(`${e.originalParentTypeName}.${e.childName}`,e.subgraphName)),(0,Jl.extractFieldSetValue)(e.childName,I.requires,y))},leave(){e.childName="",e.lastChildNodeKind=nr.Kind.NULL}},InputObjectTypeDefinition:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertInputObjectByNode(i)},leave(){e.lastParentNodeKind=nr.Kind.NULL,e.originalParentTypeName=""}},InputObjectTypeExtension:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertInputObjectByNode(i,!0)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},InputValueDefinition:{enter(i){let s=i.name.value;if(e.lastParentNodeKind!==nr.Kind.INPUT_OBJECT_TYPE_DEFINITION&&e.lastParentNodeKind!==nr.Kind.INPUT_OBJECT_TYPE_EXTENSION){e.argumentName=s;return}e.childName=s,e.lastChildNodeKind=i.kind;let o=`${e.originalParentTypeName}.${s}`,u=(0,fT.getTypeNodeNamedTypeName)(i.type);Yl.BASE_SCALARS.has(u)||e.referencedTypeNames.add(u);let l=(0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA);if(l.kind!==nr.Kind.INPUT_OBJECT_TYPE_DEFINITION)return e.errors.push((0,Wa.unexpectedParentKindForChildError)(e.originalParentTypeName,"input object or input object extension",(0,Tn.kindToTypeString)(l.kind),e.childName,(0,Tn.kindToTypeString)(i.kind))),!1;if(l.inputValueDataByValueName.has(s)){e.errors.push((0,Wa.duplicateInputFieldDefinitionError)(e.originalParentTypeName,s));return}(0,Fi.addInputValueDataByNode)(l.inputValueDataByValueName,i,e.directiveDefinitionByDirectiveName,e.handledRepeatedDirectivesByHostPath,o,e.subgraphName,e.errors)},leave(){e.argumentName="",e.lastChildNodeKind===nr.Kind.INPUT_VALUE_DEFINITION&&(e.childName="",e.lastChildNodeKind=nr.Kind.NULL)}},InterfaceTypeDefinition:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertInterfaceDataByNode(i)},leave(){(0,Fi.removeInheritableDirectivesFromParentWithFieldsData)((0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA)),e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},InterfaceTypeExtension:{enter(i){e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertInterfaceDataByNode(i,!0)},leave(){(0,Fi.removeInheritableDirectivesFromParentWithFieldsData)((0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA)),e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},ObjectTypeDefinition:{enter(i){if(i.name.value===rr.SERVICE_OBJECT)return!1;e.originalParentTypeName=i.name.value,n=(0,Fi.isTypeNameRootType)(e.originalParentTypeName,e.operationTypeNodeByTypeName),e.renamedParentTypeName=(0,Fi.getRenamedRootTypeName)(e.originalParentTypeName,e.operationTypeNodeByTypeName),e.originalTypeNameByRenamedTypeName.set(e.renamedParentTypeName,e.originalParentTypeName),r=n?e.internalGraph.getRootNode(e.renamedParentTypeName):e.internalGraph.addOrUpdateNode(e.renamedParentTypeName),e.lastParentNodeKind=i.kind,e.upsertObjectDataByNode(i)},leave(){(0,Fi.removeInheritableDirectivesFromParentWithFieldsData)((0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA)),r=void 0,n=!1,e.originalParentTypeName="",e.renamedParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},ObjectTypeExtension:{enter(i){if(i.name.value===rr.SERVICE_OBJECT)return!1;e.originalParentTypeName=i.name.value,n=(0,Fi.isTypeNameRootType)(e.originalParentTypeName,e.operationTypeNodeByTypeName),e.renamedParentTypeName=(0,Fi.getRenamedRootTypeName)(e.originalParentTypeName,e.operationTypeNodeByTypeName),e.originalTypeNameByRenamedTypeName.set(e.renamedParentTypeName,e.originalParentTypeName),r=n?e.internalGraph.getRootNode(e.renamedParentTypeName):e.internalGraph.addOrUpdateNode(e.renamedParentTypeName),e.lastParentNodeKind=i.kind,e.upsertObjectDataByNode(i,!0)},leave(){(0,Fi.removeInheritableDirectivesFromParentWithFieldsData)((0,Tn.getOrThrowError)(e.parentDefinitionDataByTypeName,e.originalParentTypeName,rr.PARENT_DEFINITION_DATA)),r=void 0,n=!1,e.originalParentTypeName="",e.renamedParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},ScalarTypeDefinition:{enter(i){if(i.name.value===rr.ANY_SCALAR)return!1;e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertScalarByNode(i)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}},ScalarTypeExtension:{enter(i){if(i.name.value===rr.ANY_SCALAR)return!1;e.originalParentTypeName=i.name.value,e.lastParentNodeKind=i.kind,e.upsertScalarByNode(i,!0)},leave(){e.originalParentTypeName="",e.lastParentNodeKind=nr.Kind.NULL}}})}function ude(e,t){let n,r=!1;(0,nr.visit)(t,{FieldDefinition:{enter(i){e.childName=i.name.value;let s=(0,fT.getTypeNodeNamedTypeName)(i.type),o=e.leafTypeNamesWithAuthorizationDirectives.has(s);if((!n||!n.hasParentLevelAuthorization)&&!o)return!1;let u=e.renamedParentTypeName||e.originalParentTypeName;n||(n=(0,Tn.setAndGetValue)(e.authorizationDataByParentTypeName,u,(0,Tn.newAuthorizationData)(u)));let l=(0,Tn.getValueOrDefault)(n.fieldAuthorizationDataByFieldName,e.childName,()=>(0,Tn.newFieldAuthorizationData)(e.childName));if(!(0,Tn.mergeAuthorizationDataByAND)(n,l))return e.invalidOrScopesHostPaths.add(`${e.originalParentTypeName}.${e.childName}`),!1;if(!o)return!1;if(r)return(0,Tn.getValueOrDefault)(e.heirFieldAuthorizationDataByTypeName,s,()=>[]).push(l),!1;let d=e.authorizationDataByParentTypeName.get(s);return d&&d.hasParentLevelAuthorization&&!(0,Tn.mergeAuthorizationDataByAND)(d,l)&&e.invalidOrScopesHostPaths.add(`${e.originalParentTypeName}.${e.childName}`),!1},leave(){e.childName=""}},InterfaceTypeDefinition:{enter(i){e.originalParentTypeName=i.name.value,n=e.getAuthorizationData(i),r=!0},leave(){e.originalParentTypeName="",n=void 0,r=!1}},InterfaceTypeExtension:{enter(i){e.originalParentTypeName=i.name.value,n=e.getAuthorizationData(i),r=!0},leave(){e.originalParentTypeName="",n=void 0,r=!1}},ObjectTypeDefinition:{enter(i){let s=e.parentDefinitionDataByTypeName.get(i.name.value);if(!s)return!1;e.originalParentTypeName=s.name,e.renamedParentTypeName=s.renamedTypeName,n=e.getAuthorizationData(i)},leave(){e.originalParentTypeName="",e.renamedParentTypeName="",n=void 0}},ObjectTypeExtension:{enter(i){let s=e.parentDefinitionDataByTypeName.get(i.name.value);if(!s)return!1;e.originalParentTypeName=s.name,e.renamedParentTypeName=s.renamedTypeName,n=e.getAuthorizationData(i)},leave(){e.originalParentTypeName="",e.renamedParentTypeName="",n=void 0}}})}});var BR=j(pa=>{"use strict";m();T();h();Object.defineProperty(pa,"__esModule",{value:!0});pa.EntityDataNode=pa.RootNode=pa.GraphNode=pa.Edge=void 0;var aI=ps(),CR=class{constructor(t,n,r,i=!1){A(this,"edgeName");A(this,"id");A(this,"isAbstractEdge");A(this,"isInaccessible",!1);A(this,"node");A(this,"visitedIndices",new Set);this.edgeName=i?`... on ${r}`:r,this.id=t,this.isAbstractEdge=i,this.node=n}};pa.Edge=CR;var xR=class{constructor(t,n,r){A(this,"fieldDataByFieldName",new Map);A(this,"headToTailEdges",new Map);A(this,"entityEdges",[]);A(this,"nodeName");A(this,"hasEntitySiblings",!1);A(this,"isAbstract");A(this,"isInaccessible",!1);A(this,"isLeaf",!1);A(this,"isRootNode",!1);A(this,"satisfiedFieldSets",new Set);A(this,"subgraphName");A(this,"typeName");this.isAbstract=!!(r!=null&&r.isAbstract),this.isLeaf=!!(r!=null&&r.isLeaf),this.nodeName=`${t}.${n}`,this.subgraphName=t,this.typeName=n}handleInaccessibleEdges(){if(this.isAbstract)return;let t=(0,aI.getEntriesNotInHashSet)(this.headToTailEdges.keys(),this.fieldDataByFieldName);for(let n of t){let r=this.headToTailEdges.get(n);r&&(r.isInaccessible=!0)}}getAllAccessibleEntityNodeNames(){let t=new Set([this.nodeName]);return this.getAccessibleEntityNodeNames(this,t),t.delete(this.nodeName),t}getAccessibleEntityNodeNames(t,n){for(let r of t.entityEdges)(0,aI.add)(n,r.node.nodeName)&&this.getAccessibleEntityNodeNames(r.node,n)}};pa.GraphNode=xR;var UR=class{constructor(t){A(this,"fieldDataByFieldName",new Map);A(this,"headToShareableTailEdges",new Map);A(this,"isAbstract",!1);A(this,"isRootNode",!0);A(this,"typeName");this.typeName=t}removeInaccessibleEdges(t){for(let[n,r]of this.headToShareableTailEdges)if(!t.has(n))for(let i of r)i.isInaccessible=!0}};pa.RootNode=UR;var MR=class{constructor(t){A(this,"fieldSetsByTargetSubgraphName",new Map);A(this,"targetSubgraphNamesByFieldSet",new Map);A(this,"typeName");this.typeName=t}addTargetSubgraphByFieldSet(t,n){(0,aI.getValueOrDefault)(this.targetSubgraphNamesByFieldSet,t,()=>new Set).add(n),(0,aI.getValueOrDefault)(this.fieldSetsByTargetSubgraphName,n,()=>new Set).add(t)}};pa.EntityDataNode=MR});var jR=j(Xa=>{"use strict";m();T();h();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.NodeResolutionData=void 0;Xa.newRootFieldData=cde;Xa.generateResolvabilityErrorReasons=Iq;Xa.generateSelectionSetSegments=vq;Xa.renderSelectionSet=_q;Xa.generateResolvabilityErrors=pde;var Eq=ps(),zl=bi(),gq=To(),VR=class{constructor(t,n){A(this,"fieldDataByFieldName");A(this,"isResolved",!1);A(this,"resolvedFieldNames",new Set);A(this,"typeName");this.fieldDataByFieldName=n,this.typeName=t}add(t){if(this.resolvedFieldNames.add(t),this.resolvedFieldNames.size>this.fieldDataByFieldName.size){let n=(0,Eq.getEntriesNotInHashSet)(this.resolvedFieldNames,this.fieldDataByFieldName);throw(0,gq.unexpectedEdgeFatalError)(this.typeName,n)}return this.isResolved=this.resolvedFieldNames.size===this.fieldDataByFieldName.size,this.isResolved}};Xa.NodeResolutionData=VR;function cde(e,t,n){return{coordinate:`${e}.${t}`,message:`The root type field "${e}.${t}" is defined in the following subgraph`+(n.size>1?"s":"")+`: "${[...n].join(zl.QUOTATION_JOIN)}".`,subgraphNames:n}}function lde(e,t){return e.isLeaf?e.name+` <-- `:e.name+` { <-- `+zl.LITERAL_SPACE.repeat(t+3)+`... `+zl.LITERAL_SPACE.repeat(t+2)+`} `}function Iq({entityAncestorData:e,rootFieldData:t,unresolvableFieldData:n}){let{fieldName:r,typeName:i,subgraphNames:s}=n,o=[t.message,`The field "${i}.${r}" is defined in the following subgraph`+(s.size>1?"s":"")+`: "${[...s].join(zl.QUOTATION_JOIN)}".`];if(e){let u=!1;for(let[l,d]of e.fieldSetsByTargetSubgraphName)if(s.has(l)){u=!0;for(let p of d)o.push(`The entity ancestor "${e.typeName}" in subgraph "${e.subgraphName}" does not satisfy the key field set "${p}" to access subgraph "${l}".`)}u||o.push(`The entity ancestor "${e.typeName}" in subgraph "${e.subgraphName}" has no accessible target entities (resolvable @key directives) in the subgraphs where "${i}.${r}" is defined.`),o.push(`The type "${i}" is not a descendent of any other entity ancestors that can provide a shared route to access "${r}".`)}else t.subgraphNames.size>1&&o.push(`None of the subgraphs that share the same root type field "${t.coordinate}" can provide a route to access "${r}".`),o.push(`The type "${i}" is not a descendent of an entity ancestor that can provide a shared route to access "${r}".`);return i!==(e==null?void 0:e.typeName)&&o.push(`The type "${i}" has no accessible target entities (resolvable @key directives) in any other subgraph, so accessing other subgraphs is not possible.`),o}function vq(e){let t=e.split(new RegExp("(?<=\\w)\\.")),n="",r="";for(let i=0;i{"use strict";m();T();h();Object.defineProperty(uI,"__esModule",{value:!0});uI.Graph=void 0;var wi=ps(),bq=bi(),Hp=BR(),Wp=jR(),$R=class{constructor(){A(this,"edgeId",-1);A(this,"entityDataNodes",new Map);A(this,"entityNodeNamesBySharedFieldPath",new Map);A(this,"nodeByNodeName",new Map);A(this,"nodesByTypeName",new Map);A(this,"rootNodeByRootTypeName",new Map);A(this,"subgraphName",bq.NOT_APPLICABLE);A(this,"resolvableFieldNamesByRelativeFieldPathByEntityNodeName",new Map);A(this,"nodeResolutionDataByFieldPath",new Map);A(this,"unresolvableFieldPaths",new Set);A(this,"failureResultByEntityNodeName",new Map);A(this,"walkerIndex",-1)}getRootNode(t){return(0,wi.getValueOrDefault)(this.rootNodeByRootTypeName,t,()=>new Hp.RootNode(t))}addOrUpdateNode(t,n){let r=`${this.subgraphName}.${t}`,i=this.nodeByNodeName.get(r);if(i)return i.isAbstract||(i.isAbstract=!!(n!=null&&n.isAbstract)),!i.isLeaf&&(n!=null&&n.isLeaf)&&(i.isLeaf=!0),i;let s=new Hp.GraphNode(this.subgraphName,t,n);return this.nodeByNodeName.set(r,s),(0,wi.getValueOrDefault)(this.nodesByTypeName,t,()=>[]).push(s),s}addEdge(t,n,r,i=!1){if(t.isRootNode){let u=new Hp.Edge(this.getNextEdgeId(),n,r);return(0,wi.getValueOrDefault)(t.headToShareableTailEdges,r,()=>[]).push(u),u}let s=t,o=new Hp.Edge(this.getNextEdgeId(),n,i?n.typeName:r,i);return s.headToTailEdges.set(r,o),o}addEntityDataNode(t){let n=this.entityDataNodes.get(t);if(n)return n;let r=new Hp.EntityDataNode(t);return this.entityDataNodes.set(t,r),r}getNextEdgeId(){return this.edgeId+=1}setNodeInaccessible(t){let n=this.nodesByTypeName.get(t);if(n)for(let r of n)r.isInaccessible=!0}initializeNode(t,n){let r=this.entityDataNodes.get(t);if(bq.ROOT_TYPE_NAMES.has(t)){let s=this.getRootNode(t);s.removeInaccessibleEdges(n),s.fieldDataByFieldName=n;return}let i=this.nodesByTypeName.get(t);if(i){for(let s of i)if(s.fieldDataByFieldName=n,s.handleInaccessibleEdges(),s.isLeaf=!1,!!r){s.hasEntitySiblings=!0;for(let o of s.satisfiedFieldSets){let u=r.targetSubgraphNamesByFieldSet.get(o);for(let l of u||[]){if(l===s.subgraphName)continue;let d=this.nodeByNodeName.get(`${l}.${s.typeName}`);d&&s.entityEdges.push(new Hp.Edge(this.getNextEdgeId(),d,""))}}}}}setSubgraphName(t){this.subgraphName=t}validateEntities(t,n){let r=new Map;for(let[i,s]of t){let o=s.size>1,u,l=o?new Map:void 0,d=new Set,p=new Map;for(let y of s){let N=this.nodeByNodeName.get(y);if(!N)throw new Error(`Fatal: Could not find entity node for "${y}".`);if(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName.get(y)){let K=this.failureResultByEntityNodeName.get(y);if(!K){u=void 0;break}if(!o)return K}let O=this.nodesByTypeName.get(N.typeName)||[],x=(0,wi.getValueOrDefault)(r,y,()=>o?p:new Map),V=new qR({interSubgraphNodes:O,entityNodeNamesBySharedFieldPath:x,originNode:N,resolvableFieldNamesByRelativeFieldPathByEntityNodeName:this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName,walkerIndex:this.walkerIndex+=1,sharedResolvableFieldNamesByRelativeFieldPath:l,unresolvableSharedFieldPaths:d});if(V.visitEntityNode(N),V.unresolvableFieldPaths.size>0){if(o&&d.size<1){u=void 0;break}u={entityAncestorData:{fieldSetsByTargetSubgraphName:(0,wi.getOrThrowError)(this.entityDataNodes,N.typeName,"entityDataNodes").fieldSetsByTargetSubgraphName,subgraphName:N.subgraphName,typeName:N.typeName},nodeName:y,parentFieldPathForEntityReference:[i],success:!1,typeName:N.typeName,unresolvableFieldPaths:o?d:V.unresolvableFieldPaths},this.failureResultByEntityNodeName.set(y,u);continue}u=void 0;break}if(u)return o&&l&&this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName.set(u.nodeName,l),u}if(r.size>0)for(let[i,s]of r){let o=this.validateEntities(s,n);if(!o.success){for(let[u,l]of t)if(l.has(i)){o.parentFieldPathForEntityReference.push(u);break}return o}}return{success:!0}}validate(){let t=[];for(let n of this.rootNodeByRootTypeName.values())e:for(let[r,i]of n.headToShareableTailEdges){for(let u of i){if(u.isInaccessible)continue e;this.walkerIndex+=1,this.visitEdge(u,`${n.typeName.toLowerCase()}`)}let s=(0,wi.getOrThrowError)(n.fieldDataByFieldName,r,"fieldDataByFieldName"),o=(0,Wp.newRootFieldData)(n.typeName,r,s.subgraphNames);if(this.unresolvableFieldPaths.size>0&&(0,Wp.generateResolvabilityErrors)({unresolvableFieldPaths:this.unresolvableFieldPaths,nodeResolutionDataByFieldPath:this.nodeResolutionDataByFieldPath,rootFieldData:o,errors:t}),this.entityNodeNamesBySharedFieldPath.size>0){let u=this.validateEntities(this.entityNodeNamesBySharedFieldPath,o);u.success||this.generateEntityResolvabilityErrors(u,o,t)}if(t.length>0)return t;this.entityNodeNamesBySharedFieldPath=new Map}return[]}visitEdge(t,n){return t.isInaccessible||t.node.isInaccessible?!1:(!(0,wi.add)(t.visitedIndices,this.walkerIndex)||t.node.isLeaf||(t.node.isAbstract?this.validateAbstractNode(t.node,`${n}.${t.edgeName}`):this.validateConcreteNode(t.node,`${n}.${t.edgeName}`)),!0)}validateConcreteNode(t,n){if(t.headToTailEdges.size<1)return;if(t.hasEntitySiblings){(0,wi.getValueOrDefault)(this.entityNodeNamesBySharedFieldPath,n,()=>new Set).add(t.nodeName);return}let r=(0,wi.getValueOrDefault)(this.nodeResolutionDataByFieldPath,n,()=>new Wp.NodeResolutionData(t.typeName,t.fieldDataByFieldName));for(let[i,s]of t.headToTailEdges)this.visitEdge(s,n)&&r.add(i);r.isResolved?this.unresolvableFieldPaths.delete(n):this.unresolvableFieldPaths.add(n)}validateAbstractNode(t,n){if(!(t.headToTailEdges.size<1))for(let r of t.headToTailEdges.values())this.visitEdge(r,n)}generateEntityResolvabilityErrors(t,n,r){let i=(0,wi.getOrThrowError)(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName,t.nodeName,"resolvableFieldNamesByRelativeFieldPathByEntityNodeName"),s="";for(let o of t.parentFieldPathForEntityReference)s=o+s;(0,Wp.generateResolvabilityErrors)({unresolvableFieldPaths:t.unresolvableFieldPaths,nodeResolutionDataByFieldPath:i,rootFieldData:n,errors:r,pathFromRoot:s,entityAncestorData:t.entityAncestorData})}};uI.Graph=$R;var qR=class{constructor({entityNodeNamesBySharedFieldPath:t,interSubgraphNodes:n,originNode:r,resolvableFieldNamesByRelativeFieldPathByEntityNodeName:i,unresolvableSharedFieldPaths:s,walkerIndex:o,sharedResolvableFieldNamesByRelativeFieldPath:u}){A(this,"entityNodeNamesBySharedFieldPath");A(this,"interSubgraphNodes");A(this,"originNode");A(this,"resolvableFieldNamesByRelativeFieldPath");A(this,"resolvableFieldNamesByRelativeFieldPathByEntityNodeName");A(this,"unresolvableFieldPaths",new Set);A(this,"unresolvableSharedFieldPaths");A(this,"walkerIndex");A(this,"sharedResolvableFieldNamesByRelativeFieldPath");this.entityNodeNamesBySharedFieldPath=t,this.interSubgraphNodes=n,this.originNode=r,this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName=i,this.resolvableFieldNamesByRelativeFieldPath=(0,wi.getValueOrDefault)(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName,r.nodeName,()=>new Map),this.unresolvableSharedFieldPaths=s,this.walkerIndex=o,this.sharedResolvableFieldNamesByRelativeFieldPath=u}visitEntityNode(t){this.validateEntityRelatedConcreteNode(t,"");let n=t.getAllAccessibleEntityNodeNames();for(let r of this.interSubgraphNodes){if(this.unresolvableFieldPaths.size<0)return;n.has(r.nodeName)&&this.validateEntityRelatedConcreteNode(r,"")}}visitEntityRelatedEdge(t,n){return t.isInaccessible||t.node.isInaccessible?!1:!(0,wi.add)(t.visitedIndices,this.walkerIndex)||t.node.isLeaf?!0:t.node.hasEntitySiblings?((0,wi.getValueOrDefault)(this.entityNodeNamesBySharedFieldPath,`${n}.${t.edgeName}`,()=>new Set).add(t.node.nodeName),!0):(t.node.isAbstract?this.validateEntityRelatedAbstractNode(t.node,`${n}.${t.edgeName}`):this.validateEntityRelatedConcreteNode(t.node,`${n}.${t.edgeName}`),!0)}validateEntityRelatedConcreteNode(t,n){if(t.headToTailEdges.size<1)return;let r=(0,wi.getValueOrDefault)(this.resolvableFieldNamesByRelativeFieldPath,n,()=>new Wp.NodeResolutionData(t.typeName,t.fieldDataByFieldName)),i=this.sharedResolvableFieldNamesByRelativeFieldPath?(0,wi.getValueOrDefault)(this.sharedResolvableFieldNamesByRelativeFieldPath,n,()=>new Wp.NodeResolutionData(t.typeName,t.fieldDataByFieldName)):void 0;for(let[s,o]of t.headToTailEdges)this.visitEntityRelatedEdge(o,n)&&(r.add(s),i==null||i.add(s));r.isResolved?this.unresolvableFieldPaths.delete(n):this.unresolvableFieldPaths.add(n),i&&(i.isResolved?this.unresolvableSharedFieldPaths.delete(n):this.unresolvableSharedFieldPaths.add(n))}validateEntityRelatedAbstractNode(t,n){if(!(t.headToTailEdges.size<1))for(let r of t.headToTailEdges.values())this.visitEntityRelatedEdge(r,n)}}});var YR=j(Wl=>{"use strict";m();T();h();Object.defineProperty(Wl,"__esModule",{value:!0});Wl.NormalizationFactory=void 0;Wl.normalizeSubgraphFromString=hde;Wl.normalizeSubgraph=Oq;Wl.batchNormalize=Tde;var Re=(Le(),Me(je)),Hi=$i(),Lc=Ql(),Li=Oc(),st=ps(),De=To(),ve=bi(),fde=nD(),fa=rI(),mde=PR(),Xp=cT(),GR=kR(),Hl=Gh(),Wr=Jp(),Za=Qa(),QR=KR(),hT=Al();function hde(e,t=!0){let{error:n,documentNode:r}=(0,Hi.safeParse)(e,t);return n||!r?{errors:[(0,De.subgraphInvalidSyntaxError)(n)],warnings:[]}:new TT(new QR.Graph).normalize(r)}function Oq(e,t,n){return new TT(n||new QR.Graph,t).normalize(e)}var TT=class{constructor(t,n){A(this,"argumentName","");A(this,"authorizationDataByParentTypeName",new Map);A(this,"childName","");A(this,"concreteTypeNamesByAbstractTypeName",new Map);A(this,"conditionalFieldDataByCoordinates",new Map);A(this,"configurationDataByParentTypeName",new Map);A(this,"customDirectiveDefinitions",new Map);A(this,"directiveDefinitionByDirectiveName",new Map);A(this,"edfsDirectiveReferences",new Set);A(this,"errors",[]);A(this,"entityDataByTypeName",new Map);A(this,"entityInterfaceDataByTypeName",new Map);A(this,"eventsConfigurations",new Map);A(this,"unvalidatedExternalFieldCoords",new Set);A(this,"interfaceTypeNamesWithAuthorizationDirectives",new Set);A(this,"internalGraph");A(this,"isCurrentParentExtension",!1);A(this,"isSubgraphEventDrivenGraph",!1);A(this,"isSubgraphVersionTwo",!1);A(this,"fieldSetDataByTypeName",new Map);A(this,"heirFieldAuthorizationDataByTypeName",new Map);A(this,"handledRepeatedDirectivesByHostPath",new Map);A(this,"lastParentNodeKind",Re.Kind.NULL);A(this,"lastChildNodeKind",Re.Kind.NULL);A(this,"leafTypeNamesWithAuthorizationDirectives",new Set);A(this,"keyFieldSetDataByTypeName",new Map);A(this,"keyFieldNamesByParentTypeName",new Map);A(this,"operationTypeNodeByTypeName",new Map);A(this,"originalParentTypeName","");A(this,"originalTypeNameByRenamedTypeName",new Map);A(this,"parentDefinitionDataByTypeName",new Map);A(this,"parentsWithChildArguments",new Set);A(this,"overridesByTargetSubgraphName",new Map);A(this,"invalidOrScopesHostPaths",new Set);A(this,"schemaDefinition");A(this,"referencedDirectiveNames",new Set);A(this,"referencedTypeNames",new Set);A(this,"renamedParentTypeName","");A(this,"subgraphName");A(this,"usesEdfsNatsStreamConfiguration",!1);A(this,"warnings",[]);for(let[r,i]of Li.BASE_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME)this.directiveDefinitionByDirectiveName.set(r,i);this.subgraphName=n||ve.NOT_APPLICABLE,this.internalGraph=t,this.internalGraph.setSubgraphName(this.subgraphName),this.schemaDefinition={directivesByDirectiveName:new Map,kind:Re.Kind.SCHEMA_DEFINITION,typeName:ve.SCHEMA,operationTypes:new Map}}validateInputNamedType(t){if(Li.BASE_SCALARS.has(t))return{hasUnhandledError:!1,typeString:""};let n=this.parentDefinitionDataByTypeName.get(t);if(!n)return this.errors.push((0,De.undefinedTypeError)(t)),{hasUnhandledError:!1,typeString:""};switch(n.kind){case Re.Kind.ENUM_TYPE_DEFINITION:case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:case Re.Kind.SCALAR_TYPE_DEFINITION:return{hasUnhandledError:!1,typeString:""};default:return{hasUnhandledError:!0,typeString:(0,st.kindToTypeString)(n.kind)}}}validateArguments(t,n){let r=[];for(let[i,s]of t.argumentDataByArgumentName){let o=(0,Za.getTypeNodeNamedTypeName)(s.type),{hasUnhandledError:u,typeString:l}=this.validateInputNamedType(o);u&&r.push({argumentName:i,namedType:o,typeString:l,typeName:(0,fa.printTypeNode)(s.type)})}r.length>0&&this.errors.push((0,De.invalidArgumentsError)(n,r))}getAuthorizationData(t){let n=this.renamedParentTypeName||this.originalParentTypeName,r=this.authorizationDataByParentTypeName.get(n);if((0,st.resetAuthorizationData)(r),!t.directives)return r;let i=!1,s=[];for(let d of t.directives){let p=d.name.value;if(p===ve.AUTHENTICATED){if(i)return;i=!0;continue}if(p===ve.REQUIRES_SCOPES){if(s.length>0)return;s.push(d)}}if(!i&&s.length<1||((0,st.isNodeKindInterface)(t.kind)&&this.interfaceTypeNamesWithAuthorizationDirectives.add(n),r||(r=(0,st.setAndGetValue)(this.authorizationDataByParentTypeName,this.renamedParentTypeName||this.originalParentTypeName,(0,st.newAuthorizationData)(n))),r.hasParentLevelAuthorization=!0,r.requiresAuthentication=i,s.length!==1))return r;let o=s[0];if(!o.arguments||o.arguments.length!==1)return;let u=o.arguments[0];if(u.name.value!==ve.SCOPES||u.value.kind!==Re.Kind.LIST)return;let l=u.value.values;if(l.length<1)return r;if(l.length>st.maxOrScopes){this.invalidOrScopesHostPaths.add(this.originalParentTypeName);return}for(let d of l){if(d.kind!==Re.Kind.LIST)return;let p=new Set;for(let y of d.values){if(y.kind!==Re.Kind.STRING)return;p.add(y.value)}p.size&&r.requiredScopes.push(p)}return r}extractDirectivesAndAuthorization(t,n){if(!t.directives)return n;let r=this.childName?`${this.originalParentTypeName}.${this.childName}`:this.originalParentTypeName,i=[];for(let l of t.directives){let d=(0,Wr.getDirectiveValidationErrors)(l,t.kind,n,this.directiveDefinitionByDirectiveName,this.handledRepeatedDirectivesByHostPath,r),p=l.name.value;if(d.length>0){this.errors.push((0,De.invalidDirectiveError)(p,r,d));continue}if(p===ve.EXTENDS)continue;if(p===ve.OVERRIDE){this.handleOverrideDeclaration(l,r,d),d.length>0&&this.errors.push((0,De.invalidDirectiveError)(p,r,d));continue}if(p===ve.AUTHENTICATED||p===ve.REQUIRES_SCOPES){i.push(l);continue}let y=n.get(p);if(y){y.push(l);continue}n.set(p,[l])}if(i.length<1)return n;let s=this.renamedParentTypeName||this.originalParentTypeName;t.kind!==Re.Kind.FIELD_DEFINITION&&this.leafTypeNamesWithAuthorizationDirectives.add(s);let o=(0,st.getValueOrDefault)(this.authorizationDataByParentTypeName,s,()=>(0,st.newAuthorizationData)(s)),u=(0,st.getAuthorizationDataToUpdate)(o,t,this.childName);for(let l of i){if(l.name.value===ve.AUTHENTICATED){u.requiresAuthentication=!0;continue}let p=l.arguments[0].value.values;if(p.length>st.maxOrScopes){this.invalidOrScopesHostPaths.add(r);continue}for(let y of p){let N=new Set;for(let I of y.values)N.add(I.value);N.size&&u.requiredScopes.push(N)}}return n}isTypeNameRootType(t){return ve.ROOT_TYPE_NAMES.has(t)||this.operationTypeNodeByTypeName.has(t)}extractDirectives(t,n,r,i=!1){if(!t.directives)return n;let s=new Set;for(let o of t.directives){let u=(0,Wr.getDirectiveValidationErrors)(o,t.kind,n,this.directiveDefinitionByDirectiveName,this.handledRepeatedDirectivesByHostPath,r,i),l=o.name.value;if(u.length>0){this.errors.push((0,De.invalidDirectiveError)(l,r,u));continue}if(ve.IGNORED_PARENT_DIRECTIVES.has(l))continue;if(l===ve.KEY){let p=o.arguments[0].value.value;if(s.has(p))continue;s.add(p)}let d=n.get(l);d?d.push(o):n.set(l,[o])}return n}getNodeExtensionType(t,n,r=!1){return t?Hl.ExtensionType.REAL:r||this.isSubgraphVersionTwo||!n.has(ve.EXTENDS)?Hl.ExtensionType.NONE:Hl.ExtensionType.EXTENDS}setParentDataExtensionType(t,n){switch(t.extensionType){case Hl.ExtensionType.EXTENDS:case Hl.ExtensionType.NONE:{if(n===Hl.ExtensionType.REAL)return;this.errors.push((0,De.duplicateTypeDefinitionError)((0,st.kindToTypeString)(t.kind),t.name));return}default:t.extensionType=n}}extractImplementedInterfaceTypeNames(t,n){if(!t.interfaces)return n;let r=t.name.value;for(let i of t.interfaces){let s=i.name.value;if(n.has(s)){this.errors.push((0,De.duplicateImplementedInterfaceError)((0,st.kindToConvertedTypeString)(t.kind),r,s));continue}n.add(s)}return n}updateCompositeOutputDataByNode(t,n,r,i){this.setParentDataExtensionType(n,i),this.extractImplementedInterfaceTypeNames(t,n.implementedInterfaceTypeNames),n.isEntity||(n.isEntity=r.has(ve.KEY)),n.isInaccessible||(n.isInaccessible=r.has(ve.INACCESSIBLE)),n.subgraphNames.add(this.subgraphName),n.description||(n.description=(0,Hi.formatDescription)("description"in t?t.description:void 0))}addConcreteTypeNamesForImplementedInterfaces(t,n){for(let r of t)(0,st.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,r,()=>new Set).add(n),this.internalGraph.addEdge(this.internalGraph.addOrUpdateNode(r,{isAbstract:!0}),this.internalGraph.addOrUpdateNode(n),n,!0)}upsertInterfaceDataByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map,r),o=this.getNodeExtensionType(n,s),u=this.entityInterfaceDataByTypeName.get(r);if(u&&t.fields)for(let l of t.fields)u.interfaceFieldNames.add(l.name.value);if(i){if(i.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.updateCompositeOutputDataByNode(t,i,s,o);return}this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:o,fieldDataByFieldName:new Map,implementedInterfaceTypeNames:this.extractImplementedInterfaceTypeNames(t,new Set),isEntity:s.has(ve.KEY),isInaccessible:s.has(ve.INACCESSIBLE),kind:Re.Kind.INTERFACE_TYPE_DEFINITION,name:r,node:(0,Za.getMutableInterfaceNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),subgraphNames:new Set([this.subgraphName]),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}getRenamedRootTypeName(t){let n=this.operationTypeNodeByTypeName.get(t);if(!n)return t;switch(n){case Re.OperationTypeNode.MUTATION:return ve.MUTATION;case Re.OperationTypeNode.SUBSCRIPTION:return ve.SUBSCRIPTION;default:return ve.QUERY}}addInterfaceObjectFieldsByNode(t){let n=t.name.value,r=this.entityInterfaceDataByTypeName.get(n);if(!(!r||!r.isInterfaceObject||!t.fields))for(let i of t.fields)r.interfaceObjectFieldNames.add(i.name.value)}upsertObjectDataByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map,r),o=this.isTypeNameRootType(r),u=this.getNodeExtensionType(n,s,o);if(this.addInterfaceObjectFieldsByNode(t),i){if(i.kind!==Re.Kind.OBJECT_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.updateCompositeOutputDataByNode(t,i,s,u),this.addConcreteTypeNamesForImplementedInterfaces(i.implementedInterfaceTypeNames,r);return}let l=this.extractImplementedInterfaceTypeNames(t,new Set);this.addConcreteTypeNamesForImplementedInterfaces(l,r),this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:u,fieldDataByFieldName:new Map,implementedInterfaceTypeNames:l,isEntity:s.has(ve.KEY),isInaccessible:s.has(ve.INACCESSIBLE),isRootType:o,kind:Re.Kind.OBJECT_TYPE_DEFINITION,name:r,node:(0,Za.getMutableObjectNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),renamedTypeName:this.getRenamedRootTypeName(r),subgraphNames:new Set([this.subgraphName]),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}upsertEnumDataByNode(t,n=!1){let r=t.name.value;this.internalGraph.addOrUpdateNode(r,{isLeaf:!0});let i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectivesAndAuthorization(t,(i==null?void 0:i.directivesByDirectiveName)||new Map),o=this.getNodeExtensionType(n,s);if(i){if(i.kind!==Re.Kind.ENUM_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),i.description||(i.description=(0,Hi.formatDescription)("description"in t?t.description:void 0));return}this.parentDefinitionDataByTypeName.set(r,{appearances:1,directivesByDirectiveName:s,extensionType:o,enumValueDataByValueName:new Map,kind:Re.Kind.ENUM_TYPE_DEFINITION,name:r,node:(0,Za.getMutableEnumNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}upsertInputObjectByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map,r),o=this.getNodeExtensionType(n,s);if(i){if(i.kind!==Re.Kind.INPUT_OBJECT_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),i.isInaccessible||(i.isInaccessible=s.has(ve.INACCESSIBLE)),i.subgraphNames.add(this.subgraphName),i.description||(i.description=(0,Hi.formatDescription)("description"in t?t.description:void 0));return}this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:o,inputValueDataByValueName:new Map,isInaccessible:s.has(ve.INACCESSIBLE),kind:Re.Kind.INPUT_OBJECT_TYPE_DEFINITION,name:r,node:(0,Za.getMutableInputObjectNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),subgraphNames:new Set([this.subgraphName]),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}upsertScalarByNode(t,n=!1){let r=t.name.value;this.internalGraph.addOrUpdateNode(r,{isLeaf:!0});let i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectivesAndAuthorization(t,(i==null?void 0:i.directivesByDirectiveName)||new Map),o=this.getNodeExtensionType(n,s);if(i){if(i.kind!==Re.Kind.SCALAR_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),i.description||(i.description=(0,Hi.formatDescription)("description"in t?t.description:void 0));return}this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:o,kind:Re.Kind.SCALAR_TYPE_DEFINITION,name:r,node:(0,Za.getMutableScalarNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}extractUnionMembers(t,n){if(!t.types)return n;let r=t.name.value;for(let i of t.types){let s=i.name.value;if(n.has(s)){this.errors.push((0,De.duplicateUnionMemberDefinitionError)(r,s));continue}(0,st.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,r,()=>new Set).add(s),Li.BASE_SCALARS.has(s)||this.referencedTypeNames.add(s),n.set(s,i)}return n}upsertUnionByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map,r),o=this.getNodeExtensionType(n,s);if(this.addConcreteTypeNamesForUnion(t),i){if(i.kind!==Re.Kind.UNION_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),this.extractUnionMembers(t,i.memberByMemberTypeName),i.description||(i.description=(0,Hi.formatDescription)("description"in t?t.description:void 0));return}this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:o,kind:Re.Kind.UNION_TYPE_DEFINITION,memberByMemberTypeName:this.extractUnionMembers(t,new Map),name:r,node:(0,Za.getMutableUnionNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}extractKeyFieldSets(t,n){var o;let r=n.isUnresolvableByKeyFieldSet,i=t.name.value;if(!((o=t.directives)!=null&&o.length)){this.errors.push((0,De.expectedEntityError)(i));return}let s=[];for(let u of t.directives){if(u.name.value!==ve.KEY)continue;if(!u.arguments||u.arguments.length<1){s.push((0,De.undefinedRequiredArgumentsErrorMessage)(ve.KEY,i,[ve.FIELDS]));continue}let l,d=!1;for(let p of u.arguments){if(p.name.value===ve.RESOLVABLE){p.value.kind===Re.Kind.BOOLEAN&&!p.value.value&&(d=!0);continue}if(p.name.value!==ve.FIELDS){l=void 0;break}if(p.value.kind!==Re.Kind.STRING){l=void 0,s.push((0,De.invalidKeyDirectiveArgumentErrorMessage)(p.value.kind));break}l=p.value.value}l!==void 0&&r.set(l,d)}s.length&&this.errors.push((0,De.invalidKeyDirectivesError)(i,s))}validateInterfaceImplementations(t){if(t.implementedInterfaceTypeNames.size<1)return;let n=t.directivesByDirectiveName.has(ve.INACCESSIBLE),r=new Map,i=new Map,s=!1;for(let o of t.implementedInterfaceTypeNames){let u=this.parentDefinitionDataByTypeName.get(o);if(!u){this.errors.push((0,De.undefinedTypeError)(o));continue}if(u.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){i.set(u.name,(0,st.kindToTypeString)(u.kind));continue}if(t.name===u.name){s=!0;continue}let l={invalidFieldImplementations:new Map,unimplementedFields:[]},d=!1;for(let[p,y]of u.fieldDataByFieldName){this.unvalidatedExternalFieldCoords.delete(`${t.name}.${p}`);let N=!1,I=t.fieldDataByFieldName.get(p);if(!I){d=!0,l.unimplementedFields.push(p);continue}let O={invalidAdditionalArguments:new Set,invalidImplementedArguments:[],isInaccessible:!1,originalResponseType:(0,fa.printTypeNode)(y.node.type),unimplementedArguments:new Set};(0,Wr.isTypeValidImplementation)(y.node.type,I.node.type,this.concreteTypeNamesByAbstractTypeName)||(d=!0,N=!0,O.implementedResponseType=(0,fa.printTypeNode)(I.node.type));let x=new Set;for(let[V,K]of y.argumentDataByArgumentName){x.add(V);let re=I.argumentDataByArgumentName.get(V);if(!re){d=!0,N=!0,O.unimplementedArguments.add(V);continue}let se=(0,fa.printTypeNode)(re.type),fe=(0,fa.printTypeNode)(K.type);fe!==se&&(d=!0,N=!0,O.invalidImplementedArguments.push({actualType:se,argumentName:V,expectedType:fe}))}for(let[V,K]of I.argumentDataByArgumentName)x.has(V)||K.type.kind===Re.Kind.NON_NULL_TYPE&&(d=!0,N=!0,O.invalidAdditionalArguments.add(V));!n&&I.isInaccessible&&!y.isInaccessible&&(d=!0,N=!0,O.isInaccessible=!0),N&&l.invalidFieldImplementations.set(p,O)}d&&r.set(o,l)}i.size>0&&this.errors.push((0,De.invalidImplementedTypeError)(t.name,i)),s&&this.errors.push((0,De.selfImplementationError)(t.name)),r.size>0&&this.errors.push((0,De.invalidInterfaceImplementationError)(t.name,(0,st.kindToTypeString)(t.kind),r))}handleOverrideDeclaration(t,n,r){let i=t.arguments[0];if(i.value.kind!==Re.Kind.STRING){r.push((0,De.invalidDirectiveArgumentTypeErrorMessage)(!0,ve.FROM,Re.Kind.STRING,i.value.kind));return}let s=i.value.value;if(s===this.subgraphName){r.push((0,De.equivalentSourceAndTargetOverrideErrorMessage)(s,n));return}let o=(0,st.getValueOrDefault)(this.overridesByTargetSubgraphName,s,()=>new Map);(0,st.getValueOrDefault)(o,this.renamedParentTypeName||this.originalParentTypeName,()=>new Set).add(this.childName)}getKafkaPublishConfiguration(t,n,r){let i=[],s=ve.DEFAULT_EDFS_PROVIDER_ID;for(let o of t.arguments||[])switch(o.name.value){case ve.TOPIC:{if(o.value.kind!==Re.Kind.STRING||o.value.value.length<1){r.push((0,De.invalidEventSubjectErrorMessage)(ve.TOPIC));continue}(0,Lc.validateArgumentTemplateReferences)(o.value.value,n,r),i.push(o.value.value);break}case ve.PROVIDER_ID:{if(o.value.kind!==Re.Kind.STRING||o.value.value.length<1){r.push(De.invalidEventProviderIdErrorMessage);continue}s=o.value.value;break}}if(!(r.length>0))return{fieldName:this.childName,providerId:s,providerType:ve.PROVIDER_TYPE_KAFKA,topics:i,type:ve.PUBLISH}}getKafkaSubscribeConfiguration(t,n,r){let i=[],s=ve.DEFAULT_EDFS_PROVIDER_ID;for(let o of t.arguments||[])switch(o.name.value){case ve.TOPICS:{if(o.value.kind!==Re.Kind.LIST){r.push((0,De.invalidEventSubjectsErrorMessage)(ve.TOPICS));continue}for(let u of o.value.values){if(u.kind!==Re.Kind.STRING||u.value.length<1){r.push((0,De.invalidEventSubjectsItemErrorMessage)(ve.TOPICS));break}(0,Lc.validateArgumentTemplateReferences)(u.value,n,r),i.push(u.value)}break}case ve.PROVIDER_ID:{if(o.value.kind!==Re.Kind.STRING||o.value.value.length<1){r.push(De.invalidEventProviderIdErrorMessage);continue}s=o.value.value;break}}if(!(r.length>0))return{fieldName:this.childName,providerId:s,providerType:ve.PROVIDER_TYPE_KAFKA,topics:i,type:ve.SUBSCRIBE}}getNatsPublishAndRequestConfiguration(t,n,r,i){let s=[],o=ve.DEFAULT_EDFS_PROVIDER_ID;for(let u of n.arguments||[])switch(u.name.value){case ve.SUBJECT:{if(u.value.kind!==Re.Kind.STRING||u.value.value.length<1){i.push((0,De.invalidEventSubjectErrorMessage)(ve.SUBJECT));continue}(0,Lc.validateArgumentTemplateReferences)(u.value.value,r,i),s.push(u.value.value);break}case ve.PROVIDER_ID:{if(u.value.kind!==Re.Kind.STRING||u.value.value.length<1){i.push(De.invalidEventProviderIdErrorMessage);continue}o=u.value.value;break}}if(!(i.length>0))return{fieldName:this.childName,providerId:o,providerType:ve.PROVIDER_TYPE_NATS,subjects:s,type:t}}getNatsSubscribeConfiguration(t,n,r){let i=[],s=ve.DEFAULT_EDFS_PROVIDER_ID,o=hT.DEFAULT_CONSUMER_INACTIVE_THRESHOLD,u="",l="";for(let d of t.arguments||[])switch(d.name.value){case ve.SUBJECTS:{if(d.value.kind!==Re.Kind.LIST){r.push((0,De.invalidEventSubjectsErrorMessage)(ve.SUBJECTS));continue}for(let p of d.value.values){if(p.kind!==Re.Kind.STRING||p.value.length<1){r.push((0,De.invalidEventSubjectsItemErrorMessage)(ve.SUBJECTS));break}(0,Lc.validateArgumentTemplateReferences)(p.value,n,r),i.push(p.value)}break}case ve.PROVIDER_ID:{if(d.value.kind!==Re.Kind.STRING||d.value.value.length<1){r.push(De.invalidEventProviderIdErrorMessage);continue}s=d.value.value;break}case ve.STREAM_CONFIGURATION:{if(this.usesEdfsNatsStreamConfiguration=!0,d.value.kind!==Re.Kind.OBJECT||d.value.fields.length<1){r.push(De.invalidNatsStreamInputErrorMessage);continue}let p=!0,y=new Set,N=new Set(ve.STREAM_CONFIGURATION_FIELD_NAMES),I=new Set([ve.CONSUMER_NAME,ve.STREAM_NAME]),O=new Set,x=new Set;for(let V of d.value.fields){let K=V.name.value;if(!ve.STREAM_CONFIGURATION_FIELD_NAMES.has(K)){y.add(K),p=!1;continue}if(N.has(K))N.delete(K);else{O.add(K),p=!1;continue}switch(I.has(K)&&I.delete(K),K){case ve.CONSUMER_NAME:if(V.value.kind!=Re.Kind.STRING||V.value.value.length<1){x.add(K),p=!1;continue}u=V.value.value;break;case ve.STREAM_NAME:if(V.value.kind!=Re.Kind.STRING||V.value.value.length<1){x.add(K),p=!1;continue}l=V.value.value;break;case ve.CONSUMER_INACTIVE_THRESHOLD:if(V.value.kind!=Re.Kind.INT){r.push((0,De.invalidArgumentValueErrorMessage)("edfs__NatsStreamConfiguration(consumerInactiveThreshold: ...)",Re.Kind.INT)),p=!1;continue}try{o=parseInt(V.value.value,10)}catch(re){r.push((0,De.invalidArgumentValueErrorMessage)("edfs__NatsStreamConfiguration(consumerInactiveThreshold: ...)",Re.Kind.INT,V.value.value)),p=!1}break}}(!p||I.size>0)&&r.push((0,De.invalidNatsStreamInputFieldsErrorMessage)([...I],[...O],[...x],[...y]))}}if(!(r.length>0))return o<0?(o=hT.DEFAULT_CONSUMER_INACTIVE_THRESHOLD,this.warnings.push((0,Xp.consumerInactiveThresholdInvalidValueWarning)(this.subgraphName,`The value has been set to ${hT.DEFAULT_CONSUMER_INACTIVE_THRESHOLD}.`))):o>hT.MAX_INT32&&(o=0,this.warnings.push((0,Xp.consumerInactiveThresholdInvalidValueWarning)(this.subgraphName,"The value has been set to 0. This means the consumer will remain indefinitely active until its manual deletion."))),k({fieldName:this.childName,providerId:s,providerType:ve.PROVIDER_TYPE_NATS,subjects:i,type:ve.SUBSCRIBE},u&&l?{streamConfiguration:{consumerInactiveThreshold:o,consumerName:u,streamName:l}}:{})}validateSubscriptionFilterDirectiveLocation(t){if(!t.directives)return;let n=this.renamedParentTypeName||this.originalParentTypeName,r=`${n}.${t.name.value}`,i=this.getOperationTypeNodeForRootTypeName(n)===Re.OperationTypeNode.SUBSCRIPTION;for(let s of t.directives)if(s.name.value===ve.SUBSCRIPTION_FILTER&&!i){this.errors.push((0,De.invalidSubscriptionFilterLocationError)(r));return}}extractEventDirectivesToConfiguration(t,n){if(!t.directives)return;let r=`${this.renamedParentTypeName||this.originalParentTypeName}.${this.childName}`;for(let i of t.directives){let s=[],o;switch(i.name.value){case ve.EDFS_KAFKA_PUBLISH:o=this.getKafkaPublishConfiguration(i,n,s);break;case ve.EDFS_KAFKA_SUBSCRIBE:o=this.getKafkaSubscribeConfiguration(i,n,s);break;case ve.EDFS_NATS_PUBLISH:{o=this.getNatsPublishAndRequestConfiguration(ve.PUBLISH,i,n,s);break}case ve.EDFS_NATS_REQUEST:{o=this.getNatsPublishAndRequestConfiguration(ve.REQUEST,i,n,s);break}case ve.EDFS_NATS_SUBSCRIBE:{o=this.getNatsSubscribeConfiguration(i,n,s);break}default:continue}if(s.length>0){this.errors.push((0,De.invalidEventDirectiveError)(i.name.value,r,s));continue}o&&(0,st.getValueOrDefault)(this.eventsConfigurations,this.renamedParentTypeName||this.originalParentTypeName,()=>[]).push(o)}}getValidEventsDirectiveNamesForOperationTypeNode(t){switch(t){case Re.OperationTypeNode.MUTATION:return new Set([ve.EDFS_KAFKA_PUBLISH,ve.EDFS_NATS_PUBLISH,ve.EDFS_NATS_REQUEST]);case Re.OperationTypeNode.QUERY:return new Set([ve.EDFS_NATS_REQUEST]);case Re.OperationTypeNode.SUBSCRIPTION:return new Set([ve.EDFS_KAFKA_SUBSCRIBE,ve.EDFS_NATS_SUBSCRIBE])}}getOperationTypeNodeForRootTypeName(t){let n=this.operationTypeNodeByTypeName.get(t);if(n)return n;switch(t){case ve.MUTATION:return Re.OperationTypeNode.MUTATION;case ve.QUERY:return Re.OperationTypeNode.QUERY;case ve.SUBSCRIPTION:return Re.OperationTypeNode.SUBSCRIPTION;default:return}}validateEventDrivenRootType(t,n,r,i){let s=this.getOperationTypeNodeForRootTypeName(t.name);if(!s){this.errors.push((0,De.invalidRootTypeError)(t.name));return}let o=this.getValidEventsDirectiveNamesForOperationTypeNode(s);for(let[u,l]of t.fieldDataByFieldName){let d=`${l.originalParentTypeName}.${u}`,p=new Set;for(let V of ve.EVENT_DIRECTIVE_NAMES)l.directivesByDirectiveName.has(V)&&p.add(V);let y=new Set;for(let V of p)o.has(V)||y.add(V);if((p.size<1||y.size>0)&&n.set(d,{definesDirectives:p.size>0,invalidDirectiveNames:[...y]}),s===Re.OperationTypeNode.MUTATION){let V=(0,fa.printTypeNode)(l.type);V!==ve.NON_NULLABLE_EDFS_PUBLISH_EVENT_RESULT&&i.set(d,V);continue}let N=(0,fa.printTypeNode)(l.type),I=l.namedTypeName+"!",O=!1,x=this.concreteTypeNamesByAbstractTypeName.get(l.namedTypeName)||new Set([l.namedTypeName]);for(let V of x)if(O||(O=this.entityDataByTypeName.has(V)),O)break;(!O||N!==I)&&r.set(d,N)}}validateEventDrivenKeyDefinition(t,n){let r=this.keyFieldSetDataByTypeName.get(t);if(r)for(let[i,s]of r.isUnresolvableByKeyFieldSet)s||(0,st.getValueOrDefault)(n,t,()=>[]).push(i)}validateEventDrivenObjectFields(t,n,r,i){for(let[s,o]of t){let u=`${o.originalParentTypeName}.${s}`;if(n.has(s)){o.isExternalBySubgraphName.get(this.subgraphName)||r.set(u,s);continue}i.set(u,s)}}isEdfsPublishResultValid(){let t=this.parentDefinitionDataByTypeName.get(ve.EDFS_PUBLISH_RESULT);if(!t)return!0;if(t.kind!==Re.Kind.OBJECT_TYPE_DEFINITION||t.fieldDataByFieldName.size!=1)return!1;for(let[n,r]of t.fieldDataByFieldName)if(r.argumentDataByArgumentName.size>0||n!==ve.SUCCESS||(0,fa.printTypeNode)(r.type)!==ve.NON_NULLABLE_BOOLEAN)return!1;return!0}isNatsStreamConfigurationInputObjectValid(t){if(t.kind!==Re.Kind.INPUT_OBJECT_TYPE_DEFINITION||t.inputValueDataByValueName.size!=3)return!1;for(let[n,r]of t.inputValueDataByValueName)switch(n){case ve.CONSUMER_INACTIVE_THRESHOLD:{if((0,fa.printTypeNode)(r.type)!==ve.NON_NULLABLE_INT||!r.defaultValue||r.defaultValue.kind!==Re.Kind.INT||r.defaultValue.value!==`${hT.DEFAULT_CONSUMER_INACTIVE_THRESHOLD}`)return!1;break}case ve.CONSUMER_NAME:case ve.STREAM_NAME:{if((0,fa.printTypeNode)(r.type)!==ve.NON_NULLABLE_STRING)return!1;break}default:return!1}return!0}validateEventDrivenSubgraph(t){let n=[],r=new Map,i=new Map,s=new Map,o=new Map,u=new Map,l=new Map,d=new Set,p=new Set;for(let[y,N]of this.parentDefinitionDataByTypeName){if(y===ve.EDFS_PUBLISH_RESULT||y===ve.EDFS_NATS_STREAM_CONFIGURATION||N.kind!==Re.Kind.OBJECT_TYPE_DEFINITION)continue;if(N.isRootType){this.validateEventDrivenRootType(N,r,i,s);continue}let I=this.keyFieldNamesByParentTypeName.get(y);if(!I){p.add(y);continue}this.validateEventDrivenKeyDefinition(y,o),this.validateEventDrivenObjectFields(N.fieldDataByFieldName,I,u,l)}if(this.isEdfsPublishResultValid()||n.push(De.invalidEdfsPublishResultObjectErrorMessage),this.edfsDirectiveReferences.has(ve.EDFS_NATS_SUBSCRIBE)){let y=this.parentDefinitionDataByTypeName.get(ve.EDFS_NATS_STREAM_CONFIGURATION);y&&this.usesEdfsNatsStreamConfiguration&&!this.isNatsStreamConfigurationInputObjectValid(y)&&n.push(De.invalidNatsStreamConfigurationDefinitionErrorMessage),this.parentDefinitionDataByTypeName.delete(ve.EDFS_NATS_STREAM_CONFIGURATION),t.push(Li.EDFS_NATS_STREAM_CONFIGURATION_DEFINITION)}r.size>0&&n.push((0,De.invalidRootTypeFieldEventsDirectivesErrorMessage)(r)),s.size>0&&n.push((0,De.invalidEventDrivenMutationResponseTypeErrorMessage)(s)),i.size>0&&n.push((0,De.invalidRootTypeFieldResponseTypesEventDrivenErrorMessage)(i)),o.size>0&&n.push((0,De.invalidKeyFieldSetsEventDrivenErrorMessage)(o)),u.size>0&&n.push((0,De.nonExternalKeyFieldNamesEventDrivenErrorMessage)(u)),l.size>0&&n.push((0,De.nonKeyFieldNamesEventDrivenErrorMessage)(l)),d.size>0&&n.push((0,De.nonEntityObjectExtensionsEventDrivenErrorMessage)([...d])),p.size>0&&n.push((0,De.nonKeyComposingObjectTypeNamesEventDrivenErrorMessage)([...p])),n.length>0&&this.errors.push((0,De.invalidEventDrivenGraphError)(n))}validateUnionMembers(t){if(t.memberByMemberTypeName.size<1){this.errors.push((0,De.noDefinedUnionMembersError)(t.name));return}let n=[];for(let r of t.memberByMemberTypeName.keys()){let i=this.parentDefinitionDataByTypeName.get(r);i&&i.kind!==Re.Kind.OBJECT_TYPE_DEFINITION&&n.push(`"${r}", which is type "${(0,st.kindToTypeString)(i.kind)}"`)}n.length>0&&this.errors.push((0,De.invalidUnionMemberTypeError)(t.name,n))}addConcreteTypeNamesForUnion(t){if(!t.types||t.types.length<1)return;let n=t.name.value;for(let r of t.types){let i=r.name.value;(0,st.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,n,()=>new Set).add(i),this.internalGraph.addEdge(this.internalGraph.addOrUpdateNode(n,{isAbstract:!0}),this.internalGraph.addOrUpdateNode(i),i,!0)}}validateAndAddKeyToConfiguration(t,n){let r=(0,st.getOrThrowError)(this.configurationDataByParentTypeName,(0,Wr.getParentTypeName)(t),"configurationDataByParentTypeName"),i=(0,Lc.validateKeyFieldSets)(this,t,n.isUnresolvableByKeyFieldSet,r.fieldNames);i&&(r.keys=i)}validateAndAddKeysToConfiguration(){for(let[t,n]of this.keyFieldSetDataByTypeName){let r=this.parentDefinitionDataByTypeName.get(t);if(!r||r.kind!==Re.Kind.OBJECT_TYPE_DEFINITION&&r.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,De.undefinedObjectLikeParentError)(t));continue}this.validateAndAddKeyToConfiguration(r,n)}}normalize(t){(0,GR.upsertDirectiveSchemaAndEntityDefinitions)(this,t),(0,GR.upsertParentsAndChildren)(this,t),(0,GR.consolidateAuthorizationDirectives)(this,t);for(let s of this.interfaceTypeNamesWithAuthorizationDirectives){let o=this.authorizationDataByParentTypeName.get(s);if(!o)continue;let u=this.concreteTypeNamesByAbstractTypeName.get(s);for(let l of u||[]){let d=(0,st.getValueOrDefault)(this.authorizationDataByParentTypeName,l,()=>(0,st.newAuthorizationData)(l));for(let[p,y]of o.fieldAuthorizationDataByFieldName)(0,st.upsertFieldAuthorizationData)(d.fieldAuthorizationDataByFieldName,y)||this.invalidOrScopesHostPaths.add(`${l}.${p}`)}}for(let[s,o]of this.heirFieldAuthorizationDataByTypeName){let u=this.authorizationDataByParentTypeName.get(s);if(u)for(let l of o)(0,st.mergeAuthorizationDataByAND)(u,l)||this.invalidOrScopesHostPaths.add(`${s}.${l.fieldName}`)}this.invalidOrScopesHostPaths.size>0&&this.errors.push((0,De.orScopesLimitError)(st.maxOrScopes,[...this.invalidOrScopesHostPaths]));let n=[];for(let s of Li.BASE_DIRECTIVE_DEFINITIONS)n.push(s);if(n.push(Li.FIELD_SET_SCALAR_DEFINITION),this.isSubgraphVersionTwo){for(let s of Li.VERSION_TWO_DIRECTIVE_DEFINITIONS)n.push(s),this.directiveDefinitionByDirectiveName.set(s.name.value,s);n.push(Li.SCOPE_SCALAR_DEFINITION)}for(let s of this.edfsDirectiveReferences){let o=Li.EVENT_DRIVEN_DIRECTIVE_DEFINITIONS_BY_DIRECTIVE_NAME.get(s);if(!o){this.errors.push((0,De.invalidEdfsDirectiveName)(s));continue}n.push(o)}this.edfsDirectiveReferences.size>0&&this.referencedDirectiveNames.has(ve.SUBSCRIPTION_FILTER)&&(this.directiveDefinitionByDirectiveName.set(ve.SUBSCRIPTION_FILTER,Li.SUBSCRIPTION_FILTER_DEFINITION),n.push(Li.SUBSCRIPTION_FILTER_DEFINITION),n.push(Li.SUBSCRIPTION_FILTER_CONDITION_DEFINITION),n.push(Li.SUBSCRIPTION_FIELD_CONDITION_DEFINITION),n.push(Li.SUBSCRIPTION_FILTER_VALUE_DEFINITION));for(let s of this.customDirectiveDefinitions.values())n.push(s);this.schemaDefinition.operationTypes.size>0&&n.push((0,Wr.getSchemaNodeByData)(this.schemaDefinition,this.errors,this.directiveDefinitionByDirectiveName));for(let[s,o]of this.parentDefinitionDataByTypeName)switch(o.kind){case Re.Kind.ENUM_TYPE_DEFINITION:if(o.enumValueDataByValueName.size<1){this.errors.push((0,De.noDefinedEnumValuesError)(s));break}n.push((0,Wr.getEnumNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName,this.authorizationDataByParentTypeName));break;case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:if(o.inputValueDataByValueName.size<1){this.errors.push((0,De.noInputValueDefinitionsError)(s));break}n.push((0,Wr.getInputObjectNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName,this.authorizationDataByParentTypeName));break;case Re.Kind.INTERFACE_TYPE_DEFINITION:case Re.Kind.OBJECT_TYPE_DEFINITION:let u=this.entityDataByTypeName.has(s),l=this.operationTypeNodeByTypeName.get(s),d=o.kind===Re.Kind.OBJECT_TYPE_DEFINITION;if(l&&(o.fieldDataByFieldName.delete(ve.SERVICE_FIELD),o.fieldDataByFieldName.delete(ve.ENTITIES_FIELD)),this.parentsWithChildArguments.has(s)||!d){let O=[];for(let[x,V]of o.fieldDataByFieldName)!d&&V.isExternalBySubgraphName.get(this.subgraphName)&&O.push(x),this.validateArguments(V,`${s}.${x}`);O.length>0&&(this.isSubgraphVersionTwo?this.errors.push((0,De.externalInterfaceFieldsError)(s,O)):this.warnings.push((0,Xp.externalInterfaceFieldsWarning)(this.subgraphName,s,O)))}let p=o.kind===Re.Kind.OBJECT_TYPE_DEFINITION&&o.renamedTypeName||s,y={fieldNames:new Set,isRootNode:u,typeName:p},N=this.entityInterfaceDataByTypeName.get(s);N&&(N.fieldDatas=(0,st.fieldDatasToSimpleFieldDatas)(o.fieldDataByFieldName.values()),N.concreteTypeNames=(0,st.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,s,()=>new Set),y.isInterfaceObject=N.isInterfaceObject,y.entityInterfaceConcreteTypeNames=N.concreteTypeNames);let I=this.eventsConfigurations.get(p);I&&(y.events=I),this.configurationDataByParentTypeName.set(p,y),(0,Lc.addFieldNamesToConfigurationData)(o.fieldDataByFieldName,y),this.validateInterfaceImplementations(o),n.push((0,Wr.getCompositeOutputNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName,this.authorizationDataByParentTypeName)),o.fieldDataByFieldName.size<1&&!(0,Lc.isNodeQuery)(s,l)&&this.errors.push((0,De.noFieldDefinitionsError)((0,st.kindToTypeString)(o.kind),s));break;case Re.Kind.SCALAR_TYPE_DEFINITION:if(o.extensionType===Hl.ExtensionType.REAL){this.errors.push((0,De.noBaseScalarDefinitionError)(s));break}n.push((0,Wr.getScalarNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName));break;case Re.Kind.UNION_TYPE_DEFINITION:n.push((0,Wr.getUnionNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName)),this.validateUnionMembers(o);break;default:throw(0,De.unexpectedKindFatalError)(s)}for(let s of Object.values(Re.OperationTypeNode)){let o=this.schemaDefinition.operationTypes.get(s),u=(0,st.getOrThrowError)(Hi.operationTypeNodeToDefaultType,s,ve.OPERATION_TO_DEFAULT),l=o?(0,Za.getTypeNodeNamedTypeName)(o.type):u;if(l!==u&&this.parentDefinitionDataByTypeName.has(u)){this.errors.push((0,De.invalidRootTypeDefinitionError)(s,l,u));continue}let d=this.parentDefinitionDataByTypeName.get(l);if(o){if(!d){this.errors.push((0,De.undefinedTypeError)(l));continue}this.operationTypeNodeByTypeName.set(l,s)}if(!d)continue;let p=this.configurationDataByParentTypeName.get(u);if(p&&(p.isRootNode=!0,p.typeName=u),d.kind!==Re.Kind.OBJECT_TYPE_DEFINITION){this.errors.push((0,De.operationDefinitionError)(l,s,d.kind));continue}for(let y of d.fieldDataByFieldName.values()){let N=(0,Za.getTypeNodeNamedTypeName)(y.node.type);!Li.BASE_SCALARS.has(N)&&!this.parentDefinitionDataByTypeName.has(N)&&this.errors.push((0,De.undefinedTypeError)(N))}}for(let s of this.referencedTypeNames){let o=this.parentDefinitionDataByTypeName.get(s);if(o){if(o.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION)continue;let u=this.concreteTypeNamesByAbstractTypeName.get(s);(!u||u.size<0)&&this.warnings.push((0,Xp.unimplementedInterfaceOutputTypeWarning)(this.subgraphName,s));continue}this.entityDataByTypeName.has(s)||this.errors.push((0,De.undefinedTypeError)(s))}this.validateAndAddKeysToConfiguration();for(let[s,o]of this.fieldSetDataByTypeName){let u=this.parentDefinitionDataByTypeName.get(s);if(!u||u.kind!==Re.Kind.OBJECT_TYPE_DEFINITION&&u.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,De.undefinedObjectLikeParentError)(s));continue}(0,Lc.validateAndAddConditionalFieldSetsToConfiguration)(this,u,o)}let r=new Map;for(let s of this.directiveDefinitionByDirectiveName.values()){let o=(0,Hi.extractExecutableDirectiveLocations)(s.locations,new Set);o.size<1||(0,Wr.addPersistedDirectiveDefinitionDataByNode)(r,s,this.errors,this.directiveDefinitionByDirectiveName,this.handledRepeatedDirectivesByHostPath,o,this.subgraphName)}this.isSubgraphEventDrivenGraph=this.edfsDirectiveReferences.size>0,this.isSubgraphEventDrivenGraph&&this.validateEventDrivenSubgraph(n);for(let s of this.unvalidatedExternalFieldCoords)this.isSubgraphVersionTwo?this.errors.push((0,De.invalidExternalDirectiveError)(s)):this.warnings.push((0,Xp.invalidExternalFieldWarning)(s,this.subgraphName));if(this.errors.length>0)return{errors:this.errors,warnings:this.warnings};let i={kind:Re.Kind.DOCUMENT,definitions:n};return{normalizationResult:{authorizationDataByParentTypeName:this.authorizationDataByParentTypeName,concreteTypeNamesByAbstractTypeName:this.concreteTypeNamesByAbstractTypeName,conditionalFieldDataByCoordinates:this.conditionalFieldDataByCoordinates,configurationDataByTypeName:this.configurationDataByParentTypeName,entityDataByTypeName:this.entityDataByTypeName,entityInterfaces:this.entityInterfaceDataByTypeName,isEventDrivenGraph:this.isSubgraphEventDrivenGraph,isVersionTwo:this.isSubgraphVersionTwo,keyFieldNamesByParentTypeName:this.keyFieldNamesByParentTypeName,operationTypes:this.operationTypeNodeByTypeName,originalTypeNameByRenamedTypeName:this.originalTypeNameByRenamedTypeName,overridesByTargetSubgraphName:this.overridesByTargetSubgraphName,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName,persistedDirectiveDefinitionDataByDirectiveName:r,subgraphAST:i,subgraphString:(0,Re.print)(i),schema:(0,fde.buildASTSchema)(i,{assumeValid:!0,assumeValidSDL:!0})},warnings:this.warnings}}};Wl.NormalizationFactory=TT;function Tde(e){let t=new Map,n=new Map,r=new Map,i=new Map,s=new Map,o=new Map,u=new Set,l=new Map,d=new Set,p=new Set,y=[],N=new Set,I=[],O=[];for(let K of e)K.name&&(0,mde.recordSubgraphName)(K.name,d,p);let x=new QR.Graph;for(let K=0;K0&&I.push(...xe),fe){O.push((0,De.subgraphValidationError)(se,fe));continue}if(!he){O.push((0,De.subgraphValidationError)(se,[De.subgraphValidationFailureError]));continue}l.set(se,he.parentDefinitionDataByTypeName);for(let ht of he.authorizationDataByParentTypeName.values())(0,st.upsertAuthorizationData)(t,ht,N);for(let[ht,Ct]of he.concreteTypeNamesByAbstractTypeName){let B=n.get(ht);if(!B){n.set(ht,new Set(Ct));continue}(0,st.addIterableValuesToSet)(Ct,B)}for(let ht of he.entityDataByTypeName.values())(0,st.upsertEntityData)(r,ht);if(re.name&&i.set(se,{conditionalFieldDataByCoordinates:he.conditionalFieldDataByCoordinates,configurationDataByTypeName:he.configurationDataByTypeName,definitions:he.subgraphAST,entityInterfaces:he.entityInterfaces,isVersionTwo:he.isVersionTwo,keyFieldNamesByParentTypeName:he.keyFieldNamesByParentTypeName,name:se,operationTypes:he.operationTypes,overriddenFieldNamesByParentTypeName:new Map,parentDefinitionDataByTypeName:he.parentDefinitionDataByTypeName,persistedDirectiveDefinitionDataByDirectiveName:he.persistedDirectiveDefinitionDataByDirectiveName,schema:he.schema,url:re.url}),!(he.overridesByTargetSubgraphName.size<1))for(let[ht,Ct]of he.overridesByTargetSubgraphName){let B=d.has(ht);for(let[Te,nt]of Ct){let xt=he.originalTypeNameByRenamedTypeName.get(Te)||Te;if(!B)I.push((0,Xp.invalidOverrideTargetSubgraphNameWarning)(ht,xt,[...nt],re.name));else{let rn=(0,st.getValueOrDefault)(s,ht,()=>new Map),wn=(0,st.getValueOrDefault)(rn,Te,()=>new Set(nt));(0,st.addIterableValuesToSet)(nt,wn)}for(let rn of nt){let wn=`${xt}.${rn}`,vn=o.get(wn);if(!vn){o.set(wn,[se]);continue}vn.push(se),u.add(wn)}}}}let V=[];if(N.size>0&&V.push((0,De.orScopesLimitError)(st.maxOrScopes,[...N])),(y.length>0||p.size>0)&&V.push((0,De.invalidSubgraphNamesError)([...p],y)),u.size>0){let K=[];for(let re of u){let se=(0,st.getOrThrowError)(o,re,"overrideSourceSubgraphNamesByFieldPath");K.push((0,De.duplicateOverriddenFieldErrorMessage)(re,se))}V.push((0,De.duplicateOverriddenFieldsError)(K))}if(V.push(...O),V.length>0)return{authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,errors:V,internalSubgraphBySubgraphName:i,internalGraph:x,warnings:I};for(let[K,re]of s){let se=(0,st.getOrThrowError)(i,K,"internalSubgraphBySubgraphName");se.overriddenFieldNamesByParentTypeName=re;for(let[fe,he]of re){let xe=se.configurationDataByTypeName.get(fe);xe&&((0,st.subtractSourceSetFromTargetSet)(he,xe.fieldNames),xe.fieldNames.size<1&&se.configurationDataByTypeName.delete(fe))}}return{authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,internalSubgraphBySubgraphName:i,internalGraph:x,warnings:I}}});var cI=j(ed=>{"use strict";m();T();h();Object.defineProperty(ed,"__esModule",{value:!0});ed.DivergentType=void 0;ed.getLeastRestrictiveMergedTypeNode=Nde;ed.getMostRestrictiveMergedTypeNode=Ede;ed.renameNamedTypeName=gde;var Xl=(Le(),Me(je)),Dq=To(),yde=Qa(),Sq=$i(),Aq=Al(),Zl;(function(e){e[e.NONE=0]="NONE",e[e.CURRENT=1]="CURRENT",e[e.OTHER=2]="OTHER"})(Zl||(ed.DivergentType=Zl={}));function Rq(e,t,n,r,i){t=(0,yde.getMutableTypeNode)(t,n,i);let s={kind:e.kind},o=Zl.NONE,u=s;for(let l=0;l{"use strict";m();T();h();Object.defineProperty(zR,"__esModule",{value:!0});zR.renameRootTypes=_de;var Ide=(Le(),Me(je)),Pc=bi(),td=ps(),JR=$i(),vde=cI();function _de(e,t){let n,r=!1,i;(0,Ide.visit)(t.definitions,{FieldDefinition:{enter(s){let o=s.name.value;if(r&&(o===Pc.SERVICE_FIELD||o===Pc.ENTITIES_FIELD))return n.fieldDataByFieldName.delete(o),!1;let u=n.name,l=(0,td.getOrThrowError)(n.fieldDataByFieldName,o,`${u}.fieldDataByFieldName`),d=t.operationTypes.get(l.namedTypeName);if(d){let p=(0,td.getOrThrowError)(JR.operationTypeNodeToDefaultType,d,Pc.OPERATION_TO_DEFAULT);l.namedTypeName!==p&&(0,vde.renameNamedTypeName)(l,p,e.errors)}return i!=null&&i.has(o)&&l.isShareableBySubgraphName.delete(t.name),!1}},InterfaceTypeDefinition:{enter(s){let o=s.name.value;if(!e.entityInterfaceFederationDataByTypeName.get(o))return!1;n=(0,td.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pc.PARENT_DEFINITION_DATA)},leave(){n=void 0}},ObjectTypeDefinition:{enter(s){let o=s.name.value,u=t.operationTypes.get(o),l=u?(0,td.getOrThrowError)(JR.operationTypeNodeToDefaultType,u,Pc.OPERATION_TO_DEFAULT):o;n=(0,td.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pc.PARENT_DEFINITION_DATA),r=n.isRootType,!e.entityInterfaceFederationDataByTypeName.get(o)&&(e.addValidPrimaryKeyTargetsToEntityData(o),i=t.overriddenFieldNamesByParentTypeName.get(l),o!==l&&(n.name=l,t.parentDefinitionDataByTypeName.set(l,n),t.parentDefinitionDataByTypeName.delete(o)))},leave(){n=void 0,r=!1,i=void 0}},ObjectTypeExtension:{enter(s){let o=s.name.value,u=t.operationTypes.get(o),l=u?(0,td.getOrThrowError)(JR.operationTypeNodeToDefaultType,u,Pc.OPERATION_TO_DEFAULT):o;n=(0,td.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pc.PARENT_DEFINITION_DATA),r=n.isRootType,e.addValidPrimaryKeyTargetsToEntityData(o),i=t.overriddenFieldNamesByParentTypeName.get(o),o!==l&&(n.name=l,t.parentDefinitionDataByTypeName.set(l,n),t.parentDefinitionDataByTypeName.delete(o))},leave(){n=void 0,r=!1,i=void 0}}})}});var Fq=j((Zp,yT)=>{"use strict";m();T();h();(function(){var e,t="4.17.21",n=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",s="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",u=500,l="__lodash_placeholder__",d=1,p=2,y=4,N=1,I=2,O=1,x=2,V=4,K=8,re=16,se=32,fe=64,he=128,xe=256,ht=512,Ct=30,B="...",Te=800,nt=16,xt=1,rn=2,wn=3,vn=1/0,_n=9007199254740991,mi=17976931348623157e292,Xr=NaN,kn=4294967295,on=kn-1,$n=kn>>>1,U=[["ary",he],["bind",O],["bindKey",x],["curry",K],["curryRight",re],["flip",ht],["partial",se],["partialRight",fe],["rearg",xe]],ae="[object Arguments]",te="[object Array]",ce="[object AsyncFunction]",Ke="[object Boolean]",Q="[object Date]",ee="[object DOMException]",Ue="[object Error]",Xe="[object Function]",$t="[object GeneratorFunction]",Je="[object Map]",Ht="[object Number]",Ta="[object Null]",ki="[object Object]",ya="[object Promise]",ud="[object Proxy]",Ao="[object RegExp]",Gr="[object Set]",Wi="[object String]",cn="[object Symbol]",Qr="[object Undefined]",Mc="[object WeakMap]",Ro="[object WeakSet]",Bc="[object ArrayBuffer]",F="[object DataView]",g="[object Float32Array]",v="[object Float64Array]",C="[object Int8Array]",J="[object Int16Array]",ie="[object Int32Array]",me="[object Uint8Array]",Rt="[object Uint8ClampedArray]",Cn="[object Uint16Array]",Dn="[object Uint32Array]",qn=/\b__p \+= '';/g,bn=/\b(__p \+=) '' \+/g,CK=/(__e\(.*?\)|\b__t\)) \+\n'';/g,LF=/&(?:amp|lt|gt|quot|#39);/g,PF=/[&<>"']/g,xK=RegExp(LF.source),UK=RegExp(PF.source),MK=/<%-([\s\S]+?)%>/g,BK=/<%([\s\S]+?)%>/g,kF=/<%=([\s\S]+?)%>/g,VK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jK=/^\w*$/,$K=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jI=/[\\^$.*+?()[\]{}|]/g,qK=RegExp(jI.source),$I=/^\s+/,KK=/\s/,GK=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,QK=/\{\n\/\* \[wrapped with (.+)\] \*/,YK=/,? & /,JK=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zK=/[()=,{}\[\]\/\s]/,HK=/\\(\\)?/g,WK=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,CF=/\w*$/,XK=/^[-+]0x[0-9a-f]+$/i,ZK=/^0b[01]+$/i,eG=/^\[object .+?Constructor\]$/,tG=/^0o[0-7]+$/i,nG=/^(?:0|[1-9]\d*)$/,rG=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xT=/($^)/,iG=/['\n\r\u2028\u2029\\]/g,UT="\\ud800-\\udfff",sG="\\u0300-\\u036f",oG="\\ufe20-\\ufe2f",aG="\\u20d0-\\u20ff",xF=sG+oG+aG,UF="\\u2700-\\u27bf",MF="a-z\\xdf-\\xf6\\xf8-\\xff",uG="\\xac\\xb1\\xd7\\xf7",cG="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",lG="\\u2000-\\u206f",dG=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",BF="A-Z\\xc0-\\xd6\\xd8-\\xde",VF="\\ufe0e\\ufe0f",jF=uG+cG+lG+dG,qI="['\u2019]",pG="["+UT+"]",$F="["+jF+"]",MT="["+xF+"]",qF="\\d+",fG="["+UF+"]",KF="["+MF+"]",GF="[^"+UT+jF+qF+UF+MF+BF+"]",KI="\\ud83c[\\udffb-\\udfff]",mG="(?:"+MT+"|"+KI+")",QF="[^"+UT+"]",GI="(?:\\ud83c[\\udde6-\\uddff]){2}",QI="[\\ud800-\\udbff][\\udc00-\\udfff]",cd="["+BF+"]",YF="\\u200d",JF="(?:"+KF+"|"+GF+")",hG="(?:"+cd+"|"+GF+")",zF="(?:"+qI+"(?:d|ll|m|re|s|t|ve))?",HF="(?:"+qI+"(?:D|LL|M|RE|S|T|VE))?",WF=mG+"?",XF="["+VF+"]?",TG="(?:"+YF+"(?:"+[QF,GI,QI].join("|")+")"+XF+WF+")*",yG="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",NG="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ZF=XF+WF+TG,EG="(?:"+[fG,GI,QI].join("|")+")"+ZF,gG="(?:"+[QF+MT+"?",MT,GI,QI,pG].join("|")+")",IG=RegExp(qI,"g"),vG=RegExp(MT,"g"),YI=RegExp(KI+"(?="+KI+")|"+gG+ZF,"g"),_G=RegExp([cd+"?"+KF+"+"+zF+"(?="+[$F,cd,"$"].join("|")+")",hG+"+"+HF+"(?="+[$F,cd+JF,"$"].join("|")+")",cd+"?"+JF+"+"+zF,cd+"+"+HF,NG,yG,qF,EG].join("|"),"g"),bG=RegExp("["+YF+UT+xF+VF+"]"),OG=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,SG=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],DG=-1,Vn={};Vn[g]=Vn[v]=Vn[C]=Vn[J]=Vn[ie]=Vn[me]=Vn[Rt]=Vn[Cn]=Vn[Dn]=!0,Vn[ae]=Vn[te]=Vn[Bc]=Vn[Ke]=Vn[F]=Vn[Q]=Vn[Ue]=Vn[Xe]=Vn[Je]=Vn[Ht]=Vn[ki]=Vn[Ao]=Vn[Gr]=Vn[Wi]=Vn[Mc]=!1;var xn={};xn[ae]=xn[te]=xn[Bc]=xn[F]=xn[Ke]=xn[Q]=xn[g]=xn[v]=xn[C]=xn[J]=xn[ie]=xn[Je]=xn[Ht]=xn[ki]=xn[Ao]=xn[Gr]=xn[Wi]=xn[cn]=xn[me]=xn[Rt]=xn[Cn]=xn[Dn]=!0,xn[Ue]=xn[Xe]=xn[Mc]=!1;var AG={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},RG={"&":"&","<":"<",">":">",'"':""","'":"'"},FG={"&":"&","<":"<",">":">",""":'"',"'":"'"},wG={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},LG=parseFloat,PG=parseInt,ew=typeof global=="object"&&global&&global.Object===Object&&global,kG=typeof self=="object"&&self&&self.Object===Object&&self,xr=ew||kG||Function("return this")(),JI=typeof Zp=="object"&&Zp&&!Zp.nodeType&&Zp,Vc=JI&&typeof yT=="object"&&yT&&!yT.nodeType&&yT,tw=Vc&&Vc.exports===JI,zI=tw&&ew.process,Es=function(){try{var W=Vc&&Vc.require&&Vc.require("util").types;return W||zI&&zI.binding&&zI.binding("util")}catch(de){}}(),nw=Es&&Es.isArrayBuffer,rw=Es&&Es.isDate,iw=Es&&Es.isMap,sw=Es&&Es.isRegExp,ow=Es&&Es.isSet,aw=Es&&Es.isTypedArray;function Xi(W,de,oe){switch(oe.length){case 0:return W.call(de);case 1:return W.call(de,oe[0]);case 2:return W.call(de,oe[0],oe[1]);case 3:return W.call(de,oe[0],oe[1],oe[2])}return W.apply(de,oe)}function CG(W,de,oe,Be){for(var _t=-1,dn=W==null?0:W.length;++_t-1}function HI(W,de,oe){for(var Be=-1,_t=W==null?0:W.length;++Be<_t;)if(oe(de,W[Be]))return!0;return!1}function Kn(W,de){for(var oe=-1,Be=W==null?0:W.length,_t=Array(Be);++oe-1;);return oe}function hw(W,de){for(var oe=W.length;oe--&&ld(de,W[oe],0)>-1;);return oe}function KG(W,de){for(var oe=W.length,Be=0;oe--;)W[oe]===de&&++Be;return Be}var GG=ev(AG),QG=ev(RG);function YG(W){return"\\"+wG[W]}function JG(W,de){return W==null?e:W[de]}function dd(W){return bG.test(W)}function zG(W){return OG.test(W)}function HG(W){for(var de,oe=[];!(de=W.next()).done;)oe.push(de.value);return oe}function iv(W){var de=-1,oe=Array(W.size);return W.forEach(function(Be,_t){oe[++de]=[_t,Be]}),oe}function Tw(W,de){return function(oe){return W(de(oe))}}function Ju(W,de){for(var oe=-1,Be=W.length,_t=0,dn=[];++oe-1}function UQ(a,c){var f=this.__data__,E=ny(f,a);return E<0?(++this.size,f.push([a,c])):f[E][1]=c,this}Na.prototype.clear=PQ,Na.prototype.delete=kQ,Na.prototype.get=CQ,Na.prototype.has=xQ,Na.prototype.set=UQ;function Ea(a){var c=-1,f=a==null?0:a.length;for(this.clear();++c=c?a:c)),a}function _s(a,c,f,E,_,L){var M,q=c&d,X=c&p,ye=c&y;if(f&&(M=_?f(a,E,_,L):f(a)),M!==e)return M;if(!Xn(a))return a;var Ne=St(a);if(Ne){if(M=j2(a),!q)return Ci(a,M)}else{var Ie=ei(a),we=Ie==Xe||Ie==$t;if(tc(a))return Xw(a,q);if(Ie==ki||Ie==ae||we&&!_){if(M=X||we?{}:yL(a),!q)return X?F2(a,ZQ(M,a)):R2(a,Aw(M,a))}else{if(!xn[Ie])return _?a:{};M=$2(a,Ie,q)}}L||(L=new to);var ze=L.get(a);if(ze)return ze;L.set(a,M),QL(a)?a.forEach(function(dt){M.add(_s(dt,c,f,dt,a,L))}):KL(a)&&a.forEach(function(dt,qt){M.set(qt,_s(dt,c,f,qt,a,L))});var lt=ye?X?Fv:Rv:X?Ui:Ur,Ut=Ne?e:lt(a);return gs(Ut||a,function(dt,qt){Ut&&(qt=dt,dt=a[qt]),Tf(M,qt,_s(dt,c,f,qt,a,L))}),M}function e2(a){var c=Ur(a);return function(f){return Rw(f,a,c)}}function Rw(a,c,f){var E=f.length;if(a==null)return!E;for(a=Ln(a);E--;){var _=f[E],L=c[_],M=a[_];if(M===e&&!(_ in a)||!L(M))return!1}return!0}function Fw(a,c,f){if(typeof a!="function")throw new Is(i);return _f(function(){a.apply(e,f)},c)}function yf(a,c,f,E){var _=-1,L=BT,M=!0,q=a.length,X=[],ye=c.length;if(!q)return X;f&&(c=Kn(c,Zi(f))),E?(L=HI,M=!1):c.length>=n&&(L=lf,M=!1,c=new qc(c));e:for(;++__?0:_+f),E=E===e||E>_?_:Lt(E),E<0&&(E+=_),E=f>E?0:JL(E);f0&&f(q)?c>1?Yr(q,c-1,f,E,_):Yu(_,q):E||(_[_.length]=q)}return _}var dv=iL(),Pw=iL(!0);function Fo(a,c){return a&&dv(a,c,Ur)}function pv(a,c){return a&&Pw(a,c,Ur)}function iy(a,c){return Qu(c,function(f){return ba(a[f])})}function Gc(a,c){c=Zu(c,a);for(var f=0,E=c.length;a!=null&&fc}function r2(a,c){return a!=null&&On.call(a,c)}function i2(a,c){return a!=null&&c in Ln(a)}function s2(a,c,f){return a>=Zr(c,f)&&a=120&&Ne.length>=120)?new qc(M&&Ne):e}Ne=a[0];var Ie=-1,we=q[0];e:for(;++Ie<_&&ye.length-1;)q!==a&&zT.call(q,X,1),zT.call(a,X,1);return a}function Kw(a,c){for(var f=a?c.length:0,E=f-1;f--;){var _=c[f];if(f==E||_!==L){var L=_;_a(_)?zT.call(a,_,1):vv(a,_)}}return a}function Ev(a,c){return a+XT(bw()*(c-a+1))}function N2(a,c,f,E){for(var _=-1,L=Ar(WT((c-a)/(f||1)),0),M=oe(L);L--;)M[E?L:++_]=a,a+=f;return M}function gv(a,c){var f="";if(!a||c<1||c>_n)return f;do c%2&&(f+=a),c=XT(c/2),c&&(a+=a);while(c);return f}function Bt(a,c){return Uv(gL(a,c,Mi),a+"")}function E2(a){return Dw(Id(a))}function g2(a,c){var f=Id(a);return hy(f,Kc(c,0,f.length))}function gf(a,c,f,E){if(!Xn(a))return a;c=Zu(c,a);for(var _=-1,L=c.length,M=L-1,q=a;q!=null&&++__?0:_+c),f=f>_?_:f,f<0&&(f+=_),_=c>f?0:f-c>>>0,c>>>=0;for(var L=oe(_);++E<_;)L[E]=a[E+c];return L}function _2(a,c){var f;return Wu(a,function(E,_,L){return f=c(E,_,L),!f}),!!f}function oy(a,c,f){var E=0,_=a==null?E:a.length;if(typeof c=="number"&&c===c&&_<=$n){for(;E<_;){var L=E+_>>>1,M=a[L];M!==null&&!ts(M)&&(f?M<=c:M=n){var ye=c?null:k2(a);if(ye)return jT(ye);M=!1,_=lf,X=new qc}else X=c?[]:q;e:for(;++E=E?a:bs(a,c,f)}var Ww=dQ||function(a){return xr.clearTimeout(a)};function Xw(a,c){if(c)return a.slice();var f=a.length,E=Ew?Ew(f):new a.constructor(f);return a.copy(E),E}function Sv(a){var c=new a.constructor(a.byteLength);return new YT(c).set(new YT(a)),c}function O2(a,c){var f=c?Sv(a.buffer):a.buffer;return new a.constructor(f,a.byteOffset,a.byteLength)}function S2(a){var c=new a.constructor(a.source,CF.exec(a));return c.lastIndex=a.lastIndex,c}function D2(a){return hf?Ln(hf.call(a)):{}}function Zw(a,c){var f=c?Sv(a.buffer):a.buffer;return new a.constructor(f,a.byteOffset,a.length)}function eL(a,c){if(a!==c){var f=a!==e,E=a===null,_=a===a,L=ts(a),M=c!==e,q=c===null,X=c===c,ye=ts(c);if(!q&&!ye&&!L&&a>c||L&&M&&X&&!q&&!ye||E&&M&&X||!f&&X||!_)return 1;if(!E&&!L&&!ye&&a=q)return X;var ye=f[E];return X*(ye=="desc"?-1:1)}}return a.index-c.index}function tL(a,c,f,E){for(var _=-1,L=a.length,M=f.length,q=-1,X=c.length,ye=Ar(L-M,0),Ne=oe(X+ye),Ie=!E;++q1?f[_-1]:e,M=_>2?f[2]:e;for(L=a.length>3&&typeof L=="function"?(_--,L):e,M&&Ti(f[0],f[1],M)&&(L=_<3?e:L,_=1),c=Ln(c);++E<_;){var q=f[E];q&&a(c,q,E,L)}return c})}function rL(a,c){return function(f,E){if(f==null)return f;if(!xi(f))return a(f,E);for(var _=f.length,L=c?_:-1,M=Ln(f);(c?L--:++L<_)&&E(M[L],L,M)!==!1;);return f}}function iL(a){return function(c,f,E){for(var _=-1,L=Ln(c),M=E(c),q=M.length;q--;){var X=M[a?q:++_];if(f(L[X],X,L)===!1)break}return c}}function w2(a,c,f){var E=c&O,_=If(a);function L(){var M=this&&this!==xr&&this instanceof L?_:a;return M.apply(E?f:this,arguments)}return L}function sL(a){return function(c){c=yn(c);var f=dd(c)?eo(c):e,E=f?f[0]:c.charAt(0),_=f?ec(f,1).join(""):c.slice(1);return E[a]()+_}}function Nd(a){return function(c){return WI(rP(nP(c).replace(IG,"")),a,"")}}function If(a){return function(){var c=arguments;switch(c.length){case 0:return new a;case 1:return new a(c[0]);case 2:return new a(c[0],c[1]);case 3:return new a(c[0],c[1],c[2]);case 4:return new a(c[0],c[1],c[2],c[3]);case 5:return new a(c[0],c[1],c[2],c[3],c[4]);case 6:return new a(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new a(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var f=Td(a.prototype),E=a.apply(f,c);return Xn(E)?E:f}}function L2(a,c,f){var E=If(a);function _(){for(var L=arguments.length,M=oe(L),q=L,X=Ed(_);q--;)M[q]=arguments[q];var ye=L<3&&M[0]!==X&&M[L-1]!==X?[]:Ju(M,X);if(L-=ye.length,L-1?_[L?c[M]:M]:e}}function aL(a){return va(function(c){var f=c.length,E=f,_=vs.prototype.thru;for(a&&c.reverse();E--;){var L=c[E];if(typeof L!="function")throw new Is(i);if(_&&!M&&fy(L)=="wrapper")var M=new vs([],!0)}for(E=M?E:f;++E1&&Wt.reverse(),Ne&&Xq))return!1;var ye=L.get(a),Ne=L.get(c);if(ye&&Ne)return ye==c&&Ne==a;var Ie=-1,we=!0,ze=f&I?new qc:e;for(L.set(a,c),L.set(c,a);++Ie1?"& ":"")+c[E],c=c.join(f>2?", ":" "),a.replace(GK,`{ +`+r;return{outputEnd:r,outputStart:n,pathNodes:t}}function _q({outputEnd:e,outputStart:t,pathNodes:n},r){return t+zl.LITERAL_SPACE.repeat(n.length+1)+lde(r,n.length)+e}function dde(e,t){return t?e?`${t}${e}`:t:e}function pde({entityAncestorData:e,errors:t,nodeResolutionDataByFieldPath:n,pathFromRoot:r,rootFieldData:i,unresolvableFieldPaths:s}){let o=[];for(let u of s){let l=(0,Eq.getOrThrowError)(n,u,"nodeResolutionDataByFieldPath"),d=new Map;for(let[N,I]of l.fieldDataByFieldName)l.resolvedFieldNames.has(N)||d.set(N,I);let p=dde(u,r),y=vq(p);for(let[N,I]of d)o.push({fieldName:N,selectionSet:_q(y,I),subgraphNames:I.subgraphNames,typeName:l.typeName})}for(let u of o)t.push((0,gq.unresolvablePathError)(u,Iq({rootFieldData:i,unresolvableFieldData:u,entityAncestorData:e})))}});var KR=j(uI=>{"use strict";m();T();h();Object.defineProperty(uI,"__esModule",{value:!0});uI.Graph=void 0;var wi=ps(),bq=bi(),Hp=BR(),Wp=jR(),$R=class{constructor(){A(this,"edgeId",-1);A(this,"entityDataNodes",new Map);A(this,"entityNodeNamesBySharedFieldPath",new Map);A(this,"nodeByNodeName",new Map);A(this,"nodesByTypeName",new Map);A(this,"rootNodeByRootTypeName",new Map);A(this,"subgraphName",bq.NOT_APPLICABLE);A(this,"resolvableFieldNamesByRelativeFieldPathByEntityNodeName",new Map);A(this,"nodeResolutionDataByFieldPath",new Map);A(this,"unresolvableFieldPaths",new Set);A(this,"failureResultByEntityNodeName",new Map);A(this,"walkerIndex",-1)}getRootNode(t){return(0,wi.getValueOrDefault)(this.rootNodeByRootTypeName,t,()=>new Hp.RootNode(t))}addOrUpdateNode(t,n){let r=`${this.subgraphName}.${t}`,i=this.nodeByNodeName.get(r);if(i)return i.isAbstract||(i.isAbstract=!!(n!=null&&n.isAbstract)),!i.isLeaf&&(n!=null&&n.isLeaf)&&(i.isLeaf=!0),i;let s=new Hp.GraphNode(this.subgraphName,t,n);return this.nodeByNodeName.set(r,s),(0,wi.getValueOrDefault)(this.nodesByTypeName,t,()=>[]).push(s),s}addEdge(t,n,r,i=!1){if(t.isRootNode){let u=new Hp.Edge(this.getNextEdgeId(),n,r);return(0,wi.getValueOrDefault)(t.headToShareableTailEdges,r,()=>[]).push(u),u}let s=t,o=new Hp.Edge(this.getNextEdgeId(),n,i?n.typeName:r,i);return s.headToTailEdges.set(r,o),o}addEntityDataNode(t){let n=this.entityDataNodes.get(t);if(n)return n;let r=new Hp.EntityDataNode(t);return this.entityDataNodes.set(t,r),r}getNextEdgeId(){return this.edgeId+=1}setNodeInaccessible(t){let n=this.nodesByTypeName.get(t);if(n)for(let r of n)r.isInaccessible=!0}initializeNode(t,n){let r=this.entityDataNodes.get(t);if(bq.ROOT_TYPE_NAMES.has(t)){let s=this.getRootNode(t);s.removeInaccessibleEdges(n),s.fieldDataByFieldName=n;return}let i=this.nodesByTypeName.get(t);if(i){for(let s of i)if(s.fieldDataByFieldName=n,s.handleInaccessibleEdges(),s.isLeaf=!1,!!r){s.hasEntitySiblings=!0;for(let o of s.satisfiedFieldSets){let u=r.targetSubgraphNamesByFieldSet.get(o);for(let l of u||[]){if(l===s.subgraphName)continue;let d=this.nodeByNodeName.get(`${l}.${s.typeName}`);d&&s.entityEdges.push(new Hp.Edge(this.getNextEdgeId(),d,""))}}}}}setSubgraphName(t){this.subgraphName=t}validateEntities(t,n){let r=new Map;for(let[i,s]of t){let o=s.size>1,u,l=o?new Map:void 0,d=new Set,p=new Map;for(let y of s){let N=this.nodeByNodeName.get(y);if(!N)throw new Error(`Fatal: Could not find entity node for "${y}".`);if(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName.get(y)){let K=this.failureResultByEntityNodeName.get(y);if(!K){u=void 0;break}if(!o)return K}let O=this.nodesByTypeName.get(N.typeName)||[],x=(0,wi.getValueOrDefault)(r,y,()=>o?p:new Map),V=new qR({interSubgraphNodes:O,entityNodeNamesBySharedFieldPath:x,originNode:N,resolvableFieldNamesByRelativeFieldPathByEntityNodeName:this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName,walkerIndex:this.walkerIndex+=1,sharedResolvableFieldNamesByRelativeFieldPath:l,unresolvableSharedFieldPaths:d});if(V.visitEntityNode(N),V.unresolvableFieldPaths.size>0){if(o&&d.size<1){u=void 0;break}u={entityAncestorData:{fieldSetsByTargetSubgraphName:(0,wi.getOrThrowError)(this.entityDataNodes,N.typeName,"entityDataNodes").fieldSetsByTargetSubgraphName,subgraphName:N.subgraphName,typeName:N.typeName},nodeName:y,parentFieldPathForEntityReference:[i],success:!1,typeName:N.typeName,unresolvableFieldPaths:o?d:V.unresolvableFieldPaths},this.failureResultByEntityNodeName.set(y,u);continue}u=void 0;break}if(u)return o&&l&&this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName.set(u.nodeName,l),u}if(r.size>0)for(let[i,s]of r){let o=this.validateEntities(s,n);if(!o.success){for(let[u,l]of t)if(l.has(i)){o.parentFieldPathForEntityReference.push(u);break}return o}}return{success:!0}}validate(){let t=[];for(let n of this.rootNodeByRootTypeName.values())e:for(let[r,i]of n.headToShareableTailEdges){for(let u of i){if(u.isInaccessible)continue e;this.walkerIndex+=1,this.visitEdge(u,`${n.typeName.toLowerCase()}`)}let s=(0,wi.getOrThrowError)(n.fieldDataByFieldName,r,"fieldDataByFieldName"),o=(0,Wp.newRootFieldData)(n.typeName,r,s.subgraphNames);if(this.unresolvableFieldPaths.size>0&&(0,Wp.generateResolvabilityErrors)({unresolvableFieldPaths:this.unresolvableFieldPaths,nodeResolutionDataByFieldPath:this.nodeResolutionDataByFieldPath,rootFieldData:o,errors:t}),this.entityNodeNamesBySharedFieldPath.size>0){let u=this.validateEntities(this.entityNodeNamesBySharedFieldPath,o);u.success||this.generateEntityResolvabilityErrors(u,o,t)}if(t.length>0)return t;this.entityNodeNamesBySharedFieldPath=new Map}return[]}visitEdge(t,n){return t.isInaccessible||t.node.isInaccessible?!1:(!(0,wi.add)(t.visitedIndices,this.walkerIndex)||t.node.isLeaf||(t.node.isAbstract?this.validateAbstractNode(t.node,`${n}.${t.edgeName}`):this.validateConcreteNode(t.node,`${n}.${t.edgeName}`)),!0)}validateConcreteNode(t,n){if(t.headToTailEdges.size<1)return;if(t.hasEntitySiblings){(0,wi.getValueOrDefault)(this.entityNodeNamesBySharedFieldPath,n,()=>new Set).add(t.nodeName);return}let r=(0,wi.getValueOrDefault)(this.nodeResolutionDataByFieldPath,n,()=>new Wp.NodeResolutionData(t.typeName,t.fieldDataByFieldName));for(let[i,s]of t.headToTailEdges)this.visitEdge(s,n)&&r.add(i);r.isResolved?this.unresolvableFieldPaths.delete(n):this.unresolvableFieldPaths.add(n)}validateAbstractNode(t,n){if(!(t.headToTailEdges.size<1))for(let r of t.headToTailEdges.values())this.visitEdge(r,n)}generateEntityResolvabilityErrors(t,n,r){let i=(0,wi.getOrThrowError)(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName,t.nodeName,"resolvableFieldNamesByRelativeFieldPathByEntityNodeName"),s="";for(let o of t.parentFieldPathForEntityReference)s=o+s;(0,Wp.generateResolvabilityErrors)({unresolvableFieldPaths:t.unresolvableFieldPaths,nodeResolutionDataByFieldPath:i,rootFieldData:n,errors:r,pathFromRoot:s,entityAncestorData:t.entityAncestorData})}};uI.Graph=$R;var qR=class{constructor({entityNodeNamesBySharedFieldPath:t,interSubgraphNodes:n,originNode:r,resolvableFieldNamesByRelativeFieldPathByEntityNodeName:i,unresolvableSharedFieldPaths:s,walkerIndex:o,sharedResolvableFieldNamesByRelativeFieldPath:u}){A(this,"entityNodeNamesBySharedFieldPath");A(this,"interSubgraphNodes");A(this,"originNode");A(this,"resolvableFieldNamesByRelativeFieldPath");A(this,"resolvableFieldNamesByRelativeFieldPathByEntityNodeName");A(this,"unresolvableFieldPaths",new Set);A(this,"unresolvableSharedFieldPaths");A(this,"walkerIndex");A(this,"sharedResolvableFieldNamesByRelativeFieldPath");this.entityNodeNamesBySharedFieldPath=t,this.interSubgraphNodes=n,this.originNode=r,this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName=i,this.resolvableFieldNamesByRelativeFieldPath=(0,wi.getValueOrDefault)(this.resolvableFieldNamesByRelativeFieldPathByEntityNodeName,r.nodeName,()=>new Map),this.unresolvableSharedFieldPaths=s,this.walkerIndex=o,this.sharedResolvableFieldNamesByRelativeFieldPath=u}visitEntityNode(t){this.validateEntityRelatedConcreteNode(t,"");let n=t.getAllAccessibleEntityNodeNames();for(let r of this.interSubgraphNodes){if(this.unresolvableFieldPaths.size<0)return;n.has(r.nodeName)&&this.validateEntityRelatedConcreteNode(r,"")}}visitEntityRelatedEdge(t,n){return t.isInaccessible||t.node.isInaccessible?!1:!(0,wi.add)(t.visitedIndices,this.walkerIndex)||t.node.isLeaf?!0:t.node.hasEntitySiblings?((0,wi.getValueOrDefault)(this.entityNodeNamesBySharedFieldPath,`${n}.${t.edgeName}`,()=>new Set).add(t.node.nodeName),!0):(t.node.isAbstract?this.validateEntityRelatedAbstractNode(t.node,`${n}.${t.edgeName}`):this.validateEntityRelatedConcreteNode(t.node,`${n}.${t.edgeName}`),!0)}validateEntityRelatedConcreteNode(t,n){if(t.headToTailEdges.size<1)return;let r=(0,wi.getValueOrDefault)(this.resolvableFieldNamesByRelativeFieldPath,n,()=>new Wp.NodeResolutionData(t.typeName,t.fieldDataByFieldName)),i=this.sharedResolvableFieldNamesByRelativeFieldPath?(0,wi.getValueOrDefault)(this.sharedResolvableFieldNamesByRelativeFieldPath,n,()=>new Wp.NodeResolutionData(t.typeName,t.fieldDataByFieldName)):void 0;for(let[s,o]of t.headToTailEdges)this.visitEntityRelatedEdge(o,n)&&(r.add(s),i==null||i.add(s));r.isResolved?this.unresolvableFieldPaths.delete(n):this.unresolvableFieldPaths.add(n),i&&(i.isResolved?this.unresolvableSharedFieldPaths.delete(n):this.unresolvableSharedFieldPaths.add(n))}validateEntityRelatedAbstractNode(t,n){if(!(t.headToTailEdges.size<1))for(let r of t.headToTailEdges.values())this.visitEntityRelatedEdge(r,n)}}});var YR=j(Wl=>{"use strict";m();T();h();Object.defineProperty(Wl,"__esModule",{value:!0});Wl.NormalizationFactory=void 0;Wl.normalizeSubgraphFromString=hde;Wl.normalizeSubgraph=Oq;Wl.batchNormalize=Tde;var Re=(Le(),Me(je)),Hi=$i(),Lc=Ql(),Li=Oc(),st=ps(),De=To(),ve=bi(),fde=nD(),fa=rI(),mde=PR(),Xp=cT(),GR=kR(),Hl=Gh(),Wr=Jp(),Za=Qa(),QR=KR(),hT=Al();function hde(e,t=!0){let{error:n,documentNode:r}=(0,Hi.safeParse)(e,t);return n||!r?{errors:[(0,De.subgraphInvalidSyntaxError)(n)],warnings:[]}:new TT(new QR.Graph).normalize(r)}function Oq(e,t,n){return new TT(n||new QR.Graph,t).normalize(e)}var TT=class{constructor(t,n){A(this,"argumentName","");A(this,"authorizationDataByParentTypeName",new Map);A(this,"childName","");A(this,"concreteTypeNamesByAbstractTypeName",new Map);A(this,"conditionalFieldDataByCoordinates",new Map);A(this,"configurationDataByParentTypeName",new Map);A(this,"customDirectiveDefinitions",new Map);A(this,"directiveDefinitionByDirectiveName",new Map);A(this,"edfsDirectiveReferences",new Set);A(this,"errors",[]);A(this,"entityDataByTypeName",new Map);A(this,"entityInterfaceDataByTypeName",new Map);A(this,"eventsConfigurations",new Map);A(this,"unvalidatedExternalFieldCoords",new Set);A(this,"interfaceTypeNamesWithAuthorizationDirectives",new Set);A(this,"internalGraph");A(this,"isCurrentParentExtension",!1);A(this,"isSubgraphEventDrivenGraph",!1);A(this,"isSubgraphVersionTwo",!1);A(this,"fieldSetDataByTypeName",new Map);A(this,"heirFieldAuthorizationDataByTypeName",new Map);A(this,"handledRepeatedDirectivesByHostPath",new Map);A(this,"lastParentNodeKind",Re.Kind.NULL);A(this,"lastChildNodeKind",Re.Kind.NULL);A(this,"leafTypeNamesWithAuthorizationDirectives",new Set);A(this,"keyFieldSetDataByTypeName",new Map);A(this,"keyFieldNamesByParentTypeName",new Map);A(this,"operationTypeNodeByTypeName",new Map);A(this,"originalParentTypeName","");A(this,"originalTypeNameByRenamedTypeName",new Map);A(this,"parentDefinitionDataByTypeName",new Map);A(this,"parentsWithChildArguments",new Set);A(this,"overridesByTargetSubgraphName",new Map);A(this,"invalidOrScopesHostPaths",new Set);A(this,"schemaDefinition");A(this,"referencedDirectiveNames",new Set);A(this,"referencedTypeNames",new Set);A(this,"renamedParentTypeName","");A(this,"subgraphName");A(this,"usesEdfsNatsStreamConfiguration",!1);A(this,"warnings",[]);for(let[r,i]of Li.BASE_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME)this.directiveDefinitionByDirectiveName.set(r,i);this.subgraphName=n||ve.NOT_APPLICABLE,this.internalGraph=t,this.internalGraph.setSubgraphName(this.subgraphName),this.schemaDefinition={directivesByDirectiveName:new Map,kind:Re.Kind.SCHEMA_DEFINITION,typeName:ve.SCHEMA,operationTypes:new Map}}validateInputNamedType(t){if(Li.BASE_SCALARS.has(t))return{hasUnhandledError:!1,typeString:""};let n=this.parentDefinitionDataByTypeName.get(t);if(!n)return this.errors.push((0,De.undefinedTypeError)(t)),{hasUnhandledError:!1,typeString:""};switch(n.kind){case Re.Kind.ENUM_TYPE_DEFINITION:case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:case Re.Kind.SCALAR_TYPE_DEFINITION:return{hasUnhandledError:!1,typeString:""};default:return{hasUnhandledError:!0,typeString:(0,st.kindToTypeString)(n.kind)}}}validateArguments(t,n){let r=[];for(let[i,s]of t.argumentDataByArgumentName){let o=(0,Za.getTypeNodeNamedTypeName)(s.type),{hasUnhandledError:u,typeString:l}=this.validateInputNamedType(o);u&&r.push({argumentName:i,namedType:o,typeString:l,typeName:(0,fa.printTypeNode)(s.type)})}r.length>0&&this.errors.push((0,De.invalidArgumentsError)(n,r))}getAuthorizationData(t){let n=this.renamedParentTypeName||this.originalParentTypeName,r=this.authorizationDataByParentTypeName.get(n);if((0,st.resetAuthorizationData)(r),!t.directives)return r;let i=!1,s=[];for(let d of t.directives){let p=d.name.value;if(p===ve.AUTHENTICATED){if(i)return;i=!0;continue}if(p===ve.REQUIRES_SCOPES){if(s.length>0)return;s.push(d)}}if(!i&&s.length<1||((0,st.isNodeKindInterface)(t.kind)&&this.interfaceTypeNamesWithAuthorizationDirectives.add(n),r||(r=(0,st.setAndGetValue)(this.authorizationDataByParentTypeName,this.renamedParentTypeName||this.originalParentTypeName,(0,st.newAuthorizationData)(n))),r.hasParentLevelAuthorization=!0,r.requiresAuthentication=i,s.length!==1))return r;let o=s[0];if(!o.arguments||o.arguments.length!==1)return;let u=o.arguments[0];if(u.name.value!==ve.SCOPES||u.value.kind!==Re.Kind.LIST)return;let l=u.value.values;if(l.length<1)return r;if(l.length>st.maxOrScopes){this.invalidOrScopesHostPaths.add(this.originalParentTypeName);return}for(let d of l){if(d.kind!==Re.Kind.LIST)return;let p=new Set;for(let y of d.values){if(y.kind!==Re.Kind.STRING)return;p.add(y.value)}p.size&&r.requiredScopes.push(p)}return r}extractDirectivesAndAuthorization(t,n){if(!t.directives)return n;let r=this.childName?`${this.originalParentTypeName}.${this.childName}`:this.originalParentTypeName,i=[];for(let l of t.directives){let d=(0,Wr.getDirectiveValidationErrors)(l,t.kind,n,this.directiveDefinitionByDirectiveName,this.handledRepeatedDirectivesByHostPath,r),p=l.name.value;if(d.length>0){this.errors.push((0,De.invalidDirectiveError)(p,r,d));continue}if(p===ve.EXTENDS)continue;if(p===ve.OVERRIDE){this.handleOverrideDeclaration(l,r,d),d.length>0&&this.errors.push((0,De.invalidDirectiveError)(p,r,d));continue}if(p===ve.AUTHENTICATED||p===ve.REQUIRES_SCOPES){i.push(l);continue}let y=n.get(p);if(y){y.push(l);continue}n.set(p,[l])}if(i.length<1)return n;let s=this.renamedParentTypeName||this.originalParentTypeName;t.kind!==Re.Kind.FIELD_DEFINITION&&this.leafTypeNamesWithAuthorizationDirectives.add(s);let o=(0,st.getValueOrDefault)(this.authorizationDataByParentTypeName,s,()=>(0,st.newAuthorizationData)(s)),u=(0,st.getAuthorizationDataToUpdate)(o,t,this.childName);for(let l of i){if(l.name.value===ve.AUTHENTICATED){u.requiresAuthentication=!0;continue}let p=l.arguments[0].value.values;if(p.length>st.maxOrScopes){this.invalidOrScopesHostPaths.add(r);continue}for(let y of p){let N=new Set;for(let I of y.values)N.add(I.value);N.size&&u.requiredScopes.push(N)}}return n}isTypeNameRootType(t){return ve.ROOT_TYPE_NAMES.has(t)||this.operationTypeNodeByTypeName.has(t)}extractDirectives(t,n,r,i=!1){if(!t.directives)return n;let s=new Set;for(let o of t.directives){let u=(0,Wr.getDirectiveValidationErrors)(o,t.kind,n,this.directiveDefinitionByDirectiveName,this.handledRepeatedDirectivesByHostPath,r,i),l=o.name.value;if(u.length>0){this.errors.push((0,De.invalidDirectiveError)(l,r,u));continue}if(ve.IGNORED_PARENT_DIRECTIVES.has(l))continue;if(l===ve.KEY){let p=o.arguments[0].value.value;if(s.has(p))continue;s.add(p)}let d=n.get(l);d?d.push(o):n.set(l,[o])}return n}getNodeExtensionType(t,n,r=!1){return t?Hl.ExtensionType.REAL:r||this.isSubgraphVersionTwo||!n.has(ve.EXTENDS)?Hl.ExtensionType.NONE:Hl.ExtensionType.EXTENDS}setParentDataExtensionType(t,n){switch(t.extensionType){case Hl.ExtensionType.EXTENDS:case Hl.ExtensionType.NONE:{if(n===Hl.ExtensionType.REAL)return;this.errors.push((0,De.duplicateTypeDefinitionError)((0,st.kindToTypeString)(t.kind),t.name));return}default:t.extensionType=n}}extractImplementedInterfaceTypeNames(t,n){if(!t.interfaces)return n;let r=t.name.value;for(let i of t.interfaces){let s=i.name.value;if(n.has(s)){this.errors.push((0,De.duplicateImplementedInterfaceError)((0,st.kindToConvertedTypeString)(t.kind),r,s));continue}n.add(s)}return n}updateCompositeOutputDataByNode(t,n,r,i){this.setParentDataExtensionType(n,i),this.extractImplementedInterfaceTypeNames(t,n.implementedInterfaceTypeNames),n.isEntity||(n.isEntity=r.has(ve.KEY)),n.isInaccessible||(n.isInaccessible=r.has(ve.INACCESSIBLE)),n.subgraphNames.add(this.subgraphName),n.description||(n.description=(0,Hi.formatDescription)("description"in t?t.description:void 0))}addConcreteTypeNamesForImplementedInterfaces(t,n){for(let r of t)(0,st.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,r,()=>new Set).add(n),this.internalGraph.addEdge(this.internalGraph.addOrUpdateNode(r,{isAbstract:!0}),this.internalGraph.addOrUpdateNode(n),n,!0)}upsertInterfaceDataByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map,r),o=this.getNodeExtensionType(n,s),u=this.entityInterfaceDataByTypeName.get(r);if(u&&t.fields)for(let l of t.fields)u.interfaceFieldNames.add(l.name.value);if(i){if(i.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.updateCompositeOutputDataByNode(t,i,s,o);return}this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:o,fieldDataByFieldName:new Map,implementedInterfaceTypeNames:this.extractImplementedInterfaceTypeNames(t,new Set),isEntity:s.has(ve.KEY),isInaccessible:s.has(ve.INACCESSIBLE),kind:Re.Kind.INTERFACE_TYPE_DEFINITION,name:r,node:(0,Za.getMutableInterfaceNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),subgraphNames:new Set([this.subgraphName]),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}getRenamedRootTypeName(t){let n=this.operationTypeNodeByTypeName.get(t);if(!n)return t;switch(n){case Re.OperationTypeNode.MUTATION:return ve.MUTATION;case Re.OperationTypeNode.SUBSCRIPTION:return ve.SUBSCRIPTION;default:return ve.QUERY}}addInterfaceObjectFieldsByNode(t){let n=t.name.value,r=this.entityInterfaceDataByTypeName.get(n);if(!(!r||!r.isInterfaceObject||!t.fields))for(let i of t.fields)r.interfaceObjectFieldNames.add(i.name.value)}upsertObjectDataByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map,r),o=this.isTypeNameRootType(r),u=this.getNodeExtensionType(n,s,o);if(this.addInterfaceObjectFieldsByNode(t),i){if(i.kind!==Re.Kind.OBJECT_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.updateCompositeOutputDataByNode(t,i,s,u),this.addConcreteTypeNamesForImplementedInterfaces(i.implementedInterfaceTypeNames,r);return}let l=this.extractImplementedInterfaceTypeNames(t,new Set);this.addConcreteTypeNamesForImplementedInterfaces(l,r),this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:u,fieldDataByFieldName:new Map,implementedInterfaceTypeNames:l,isEntity:s.has(ve.KEY),isInaccessible:s.has(ve.INACCESSIBLE),isRootType:o,kind:Re.Kind.OBJECT_TYPE_DEFINITION,name:r,node:(0,Za.getMutableObjectNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),renamedTypeName:this.getRenamedRootTypeName(r),subgraphNames:new Set([this.subgraphName]),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}upsertEnumDataByNode(t,n=!1){let r=t.name.value;this.internalGraph.addOrUpdateNode(r,{isLeaf:!0});let i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectivesAndAuthorization(t,(i==null?void 0:i.directivesByDirectiveName)||new Map),o=this.getNodeExtensionType(n,s);if(i){if(i.kind!==Re.Kind.ENUM_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),i.subgraphNames.add(this.subgraphName),i.description||(i.description=(0,Hi.formatDescription)("description"in t?t.description:void 0));return}this.parentDefinitionDataByTypeName.set(r,{appearances:1,directivesByDirectiveName:s,extensionType:o,enumValueDataByValueName:new Map,kind:Re.Kind.ENUM_TYPE_DEFINITION,name:r,node:(0,Za.getMutableEnumNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),subgraphNames:new Set([this.subgraphName]),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}upsertInputObjectByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map,r),o=this.getNodeExtensionType(n,s);if(i){if(i.kind!==Re.Kind.INPUT_OBJECT_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),i.isInaccessible||(i.isInaccessible=s.has(ve.INACCESSIBLE)),i.subgraphNames.add(this.subgraphName),i.description||(i.description=(0,Hi.formatDescription)("description"in t?t.description:void 0));return}this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:o,inputValueDataByValueName:new Map,isInaccessible:s.has(ve.INACCESSIBLE),kind:Re.Kind.INPUT_OBJECT_TYPE_DEFINITION,name:r,node:(0,Za.getMutableInputObjectNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),subgraphNames:new Set([this.subgraphName]),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}upsertScalarByNode(t,n=!1){let r=t.name.value;this.internalGraph.addOrUpdateNode(r,{isLeaf:!0});let i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectivesAndAuthorization(t,(i==null?void 0:i.directivesByDirectiveName)||new Map),o=this.getNodeExtensionType(n,s);if(i){if(i.kind!==Re.Kind.SCALAR_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),i.description||(i.description=(0,Hi.formatDescription)("description"in t?t.description:void 0));return}this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:o,kind:Re.Kind.SCALAR_TYPE_DEFINITION,name:r,node:(0,Za.getMutableScalarNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}extractUnionMembers(t,n){if(!t.types)return n;let r=t.name.value;for(let i of t.types){let s=i.name.value;if(n.has(s)){this.errors.push((0,De.duplicateUnionMemberDefinitionError)(r,s));continue}(0,st.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,r,()=>new Set).add(s),Li.BASE_SCALARS.has(s)||this.referencedTypeNames.add(s),n.set(s,i)}return n}upsertUnionByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),s=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map,r),o=this.getNodeExtensionType(n,s);if(this.addConcreteTypeNamesForUnion(t),i){if(i.kind!==Re.Kind.UNION_TYPE_DEFINITION){this.errors.push((0,De.multipleNamedTypeDefinitionError)(r,(0,st.kindToTypeString)(i.kind),(0,st.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),this.extractUnionMembers(t,i.memberByMemberTypeName),i.description||(i.description=(0,Hi.formatDescription)("description"in t?t.description:void 0));return}this.parentDefinitionDataByTypeName.set(r,{directivesByDirectiveName:s,extensionType:o,kind:Re.Kind.UNION_TYPE_DEFINITION,memberByMemberTypeName:this.extractUnionMembers(t,new Map),name:r,node:(0,Za.getMutableUnionNode)(t.name),persistedDirectivesData:(0,Wr.newPersistedDirectivesData)(),description:(0,Hi.formatDescription)("description"in t?t.description:void 0)})}extractKeyFieldSets(t,n){var o;let r=n.isUnresolvableByKeyFieldSet,i=t.name.value;if(!((o=t.directives)!=null&&o.length)){this.errors.push((0,De.expectedEntityError)(i));return}let s=[];for(let u of t.directives){if(u.name.value!==ve.KEY)continue;if(!u.arguments||u.arguments.length<1){s.push((0,De.undefinedRequiredArgumentsErrorMessage)(ve.KEY,i,[ve.FIELDS]));continue}let l,d=!1;for(let p of u.arguments){if(p.name.value===ve.RESOLVABLE){p.value.kind===Re.Kind.BOOLEAN&&!p.value.value&&(d=!0);continue}if(p.name.value!==ve.FIELDS){l=void 0;break}if(p.value.kind!==Re.Kind.STRING){l=void 0,s.push((0,De.invalidKeyDirectiveArgumentErrorMessage)(p.value.kind));break}l=p.value.value}l!==void 0&&r.set(l,d)}s.length&&this.errors.push((0,De.invalidKeyDirectivesError)(i,s))}validateInterfaceImplementations(t){if(t.implementedInterfaceTypeNames.size<1)return;let n=t.directivesByDirectiveName.has(ve.INACCESSIBLE),r=new Map,i=new Map,s=!1;for(let o of t.implementedInterfaceTypeNames){let u=this.parentDefinitionDataByTypeName.get(o);if(!u){this.errors.push((0,De.undefinedTypeError)(o));continue}if(u.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){i.set(u.name,(0,st.kindToTypeString)(u.kind));continue}if(t.name===u.name){s=!0;continue}let l={invalidFieldImplementations:new Map,unimplementedFields:[]},d=!1;for(let[p,y]of u.fieldDataByFieldName){this.unvalidatedExternalFieldCoords.delete(`${t.name}.${p}`);let N=!1,I=t.fieldDataByFieldName.get(p);if(!I){d=!0,l.unimplementedFields.push(p);continue}let O={invalidAdditionalArguments:new Set,invalidImplementedArguments:[],isInaccessible:!1,originalResponseType:(0,fa.printTypeNode)(y.node.type),unimplementedArguments:new Set};(0,Wr.isTypeValidImplementation)(y.node.type,I.node.type,this.concreteTypeNamesByAbstractTypeName)||(d=!0,N=!0,O.implementedResponseType=(0,fa.printTypeNode)(I.node.type));let x=new Set;for(let[V,K]of y.argumentDataByArgumentName){x.add(V);let re=I.argumentDataByArgumentName.get(V);if(!re){d=!0,N=!0,O.unimplementedArguments.add(V);continue}let se=(0,fa.printTypeNode)(re.type),fe=(0,fa.printTypeNode)(K.type);fe!==se&&(d=!0,N=!0,O.invalidImplementedArguments.push({actualType:se,argumentName:V,expectedType:fe}))}for(let[V,K]of I.argumentDataByArgumentName)x.has(V)||K.type.kind===Re.Kind.NON_NULL_TYPE&&(d=!0,N=!0,O.invalidAdditionalArguments.add(V));!n&&I.isInaccessible&&!y.isInaccessible&&(d=!0,N=!0,O.isInaccessible=!0),N&&l.invalidFieldImplementations.set(p,O)}d&&r.set(o,l)}i.size>0&&this.errors.push((0,De.invalidImplementedTypeError)(t.name,i)),s&&this.errors.push((0,De.selfImplementationError)(t.name)),r.size>0&&this.errors.push((0,De.invalidInterfaceImplementationError)(t.name,(0,st.kindToTypeString)(t.kind),r))}handleOverrideDeclaration(t,n,r){let i=t.arguments[0];if(i.value.kind!==Re.Kind.STRING){r.push((0,De.invalidDirectiveArgumentTypeErrorMessage)(!0,ve.FROM,Re.Kind.STRING,i.value.kind));return}let s=i.value.value;if(s===this.subgraphName){r.push((0,De.equivalentSourceAndTargetOverrideErrorMessage)(s,n));return}let o=(0,st.getValueOrDefault)(this.overridesByTargetSubgraphName,s,()=>new Map);(0,st.getValueOrDefault)(o,this.renamedParentTypeName||this.originalParentTypeName,()=>new Set).add(this.childName)}getKafkaPublishConfiguration(t,n,r){let i=[],s=ve.DEFAULT_EDFS_PROVIDER_ID;for(let o of t.arguments||[])switch(o.name.value){case ve.TOPIC:{if(o.value.kind!==Re.Kind.STRING||o.value.value.length<1){r.push((0,De.invalidEventSubjectErrorMessage)(ve.TOPIC));continue}(0,Lc.validateArgumentTemplateReferences)(o.value.value,n,r),i.push(o.value.value);break}case ve.PROVIDER_ID:{if(o.value.kind!==Re.Kind.STRING||o.value.value.length<1){r.push(De.invalidEventProviderIdErrorMessage);continue}s=o.value.value;break}}if(!(r.length>0))return{fieldName:this.childName,providerId:s,providerType:ve.PROVIDER_TYPE_KAFKA,topics:i,type:ve.PUBLISH}}getKafkaSubscribeConfiguration(t,n,r){let i=[],s=ve.DEFAULT_EDFS_PROVIDER_ID;for(let o of t.arguments||[])switch(o.name.value){case ve.TOPICS:{if(o.value.kind!==Re.Kind.LIST){r.push((0,De.invalidEventSubjectsErrorMessage)(ve.TOPICS));continue}for(let u of o.value.values){if(u.kind!==Re.Kind.STRING||u.value.length<1){r.push((0,De.invalidEventSubjectsItemErrorMessage)(ve.TOPICS));break}(0,Lc.validateArgumentTemplateReferences)(u.value,n,r),i.push(u.value)}break}case ve.PROVIDER_ID:{if(o.value.kind!==Re.Kind.STRING||o.value.value.length<1){r.push(De.invalidEventProviderIdErrorMessage);continue}s=o.value.value;break}}if(!(r.length>0))return{fieldName:this.childName,providerId:s,providerType:ve.PROVIDER_TYPE_KAFKA,topics:i,type:ve.SUBSCRIBE}}getNatsPublishAndRequestConfiguration(t,n,r,i){let s=[],o=ve.DEFAULT_EDFS_PROVIDER_ID;for(let u of n.arguments||[])switch(u.name.value){case ve.SUBJECT:{if(u.value.kind!==Re.Kind.STRING||u.value.value.length<1){i.push((0,De.invalidEventSubjectErrorMessage)(ve.SUBJECT));continue}(0,Lc.validateArgumentTemplateReferences)(u.value.value,r,i),s.push(u.value.value);break}case ve.PROVIDER_ID:{if(u.value.kind!==Re.Kind.STRING||u.value.value.length<1){i.push(De.invalidEventProviderIdErrorMessage);continue}o=u.value.value;break}}if(!(i.length>0))return{fieldName:this.childName,providerId:o,providerType:ve.PROVIDER_TYPE_NATS,subjects:s,type:t}}getNatsSubscribeConfiguration(t,n,r){let i=[],s=ve.DEFAULT_EDFS_PROVIDER_ID,o=hT.DEFAULT_CONSUMER_INACTIVE_THRESHOLD,u="",l="";for(let d of t.arguments||[])switch(d.name.value){case ve.SUBJECTS:{if(d.value.kind!==Re.Kind.LIST){r.push((0,De.invalidEventSubjectsErrorMessage)(ve.SUBJECTS));continue}for(let p of d.value.values){if(p.kind!==Re.Kind.STRING||p.value.length<1){r.push((0,De.invalidEventSubjectsItemErrorMessage)(ve.SUBJECTS));break}(0,Lc.validateArgumentTemplateReferences)(p.value,n,r),i.push(p.value)}break}case ve.PROVIDER_ID:{if(d.value.kind!==Re.Kind.STRING||d.value.value.length<1){r.push(De.invalidEventProviderIdErrorMessage);continue}s=d.value.value;break}case ve.STREAM_CONFIGURATION:{if(this.usesEdfsNatsStreamConfiguration=!0,d.value.kind!==Re.Kind.OBJECT||d.value.fields.length<1){r.push(De.invalidNatsStreamInputErrorMessage);continue}let p=!0,y=new Set,N=new Set(ve.STREAM_CONFIGURATION_FIELD_NAMES),I=new Set([ve.CONSUMER_NAME,ve.STREAM_NAME]),O=new Set,x=new Set;for(let V of d.value.fields){let K=V.name.value;if(!ve.STREAM_CONFIGURATION_FIELD_NAMES.has(K)){y.add(K),p=!1;continue}if(N.has(K))N.delete(K);else{O.add(K),p=!1;continue}switch(I.has(K)&&I.delete(K),K){case ve.CONSUMER_NAME:if(V.value.kind!=Re.Kind.STRING||V.value.value.length<1){x.add(K),p=!1;continue}u=V.value.value;break;case ve.STREAM_NAME:if(V.value.kind!=Re.Kind.STRING||V.value.value.length<1){x.add(K),p=!1;continue}l=V.value.value;break;case ve.CONSUMER_INACTIVE_THRESHOLD:if(V.value.kind!=Re.Kind.INT){r.push((0,De.invalidArgumentValueErrorMessage)("edfs__NatsStreamConfiguration(consumerInactiveThreshold: ...)",Re.Kind.INT)),p=!1;continue}try{o=parseInt(V.value.value,10)}catch(re){r.push((0,De.invalidArgumentValueErrorMessage)("edfs__NatsStreamConfiguration(consumerInactiveThreshold: ...)",Re.Kind.INT,V.value.value)),p=!1}break}}(!p||I.size>0)&&r.push((0,De.invalidNatsStreamInputFieldsErrorMessage)([...I],[...O],[...x],[...y]))}}if(!(r.length>0))return o<0?(o=hT.DEFAULT_CONSUMER_INACTIVE_THRESHOLD,this.warnings.push((0,Xp.consumerInactiveThresholdInvalidValueWarning)(this.subgraphName,`The value has been set to ${hT.DEFAULT_CONSUMER_INACTIVE_THRESHOLD}.`))):o>hT.MAX_INT32&&(o=0,this.warnings.push((0,Xp.consumerInactiveThresholdInvalidValueWarning)(this.subgraphName,"The value has been set to 0. This means the consumer will remain indefinitely active until its manual deletion."))),k({fieldName:this.childName,providerId:s,providerType:ve.PROVIDER_TYPE_NATS,subjects:i,type:ve.SUBSCRIBE},u&&l?{streamConfiguration:{consumerInactiveThreshold:o,consumerName:u,streamName:l}}:{})}validateSubscriptionFilterDirectiveLocation(t){if(!t.directives)return;let n=this.renamedParentTypeName||this.originalParentTypeName,r=`${n}.${t.name.value}`,i=this.getOperationTypeNodeForRootTypeName(n)===Re.OperationTypeNode.SUBSCRIPTION;for(let s of t.directives)if(s.name.value===ve.SUBSCRIPTION_FILTER&&!i){this.errors.push((0,De.invalidSubscriptionFilterLocationError)(r));return}}extractEventDirectivesToConfiguration(t,n){if(!t.directives)return;let r=`${this.renamedParentTypeName||this.originalParentTypeName}.${this.childName}`;for(let i of t.directives){let s=[],o;switch(i.name.value){case ve.EDFS_KAFKA_PUBLISH:o=this.getKafkaPublishConfiguration(i,n,s);break;case ve.EDFS_KAFKA_SUBSCRIBE:o=this.getKafkaSubscribeConfiguration(i,n,s);break;case ve.EDFS_NATS_PUBLISH:{o=this.getNatsPublishAndRequestConfiguration(ve.PUBLISH,i,n,s);break}case ve.EDFS_NATS_REQUEST:{o=this.getNatsPublishAndRequestConfiguration(ve.REQUEST,i,n,s);break}case ve.EDFS_NATS_SUBSCRIBE:{o=this.getNatsSubscribeConfiguration(i,n,s);break}default:continue}if(s.length>0){this.errors.push((0,De.invalidEventDirectiveError)(i.name.value,r,s));continue}o&&(0,st.getValueOrDefault)(this.eventsConfigurations,this.renamedParentTypeName||this.originalParentTypeName,()=>[]).push(o)}}getValidEventsDirectiveNamesForOperationTypeNode(t){switch(t){case Re.OperationTypeNode.MUTATION:return new Set([ve.EDFS_KAFKA_PUBLISH,ve.EDFS_NATS_PUBLISH,ve.EDFS_NATS_REQUEST]);case Re.OperationTypeNode.QUERY:return new Set([ve.EDFS_NATS_REQUEST]);case Re.OperationTypeNode.SUBSCRIPTION:return new Set([ve.EDFS_KAFKA_SUBSCRIBE,ve.EDFS_NATS_SUBSCRIBE])}}getOperationTypeNodeForRootTypeName(t){let n=this.operationTypeNodeByTypeName.get(t);if(n)return n;switch(t){case ve.MUTATION:return Re.OperationTypeNode.MUTATION;case ve.QUERY:return Re.OperationTypeNode.QUERY;case ve.SUBSCRIPTION:return Re.OperationTypeNode.SUBSCRIPTION;default:return}}validateEventDrivenRootType(t,n,r,i){let s=this.getOperationTypeNodeForRootTypeName(t.name);if(!s){this.errors.push((0,De.invalidRootTypeError)(t.name));return}let o=this.getValidEventsDirectiveNamesForOperationTypeNode(s);for(let[u,l]of t.fieldDataByFieldName){let d=`${l.originalParentTypeName}.${u}`,p=new Set;for(let V of ve.EVENT_DIRECTIVE_NAMES)l.directivesByDirectiveName.has(V)&&p.add(V);let y=new Set;for(let V of p)o.has(V)||y.add(V);if((p.size<1||y.size>0)&&n.set(d,{definesDirectives:p.size>0,invalidDirectiveNames:[...y]}),s===Re.OperationTypeNode.MUTATION){let V=(0,fa.printTypeNode)(l.type);V!==ve.NON_NULLABLE_EDFS_PUBLISH_EVENT_RESULT&&i.set(d,V);continue}let N=(0,fa.printTypeNode)(l.type),I=l.namedTypeName+"!",O=!1,x=this.concreteTypeNamesByAbstractTypeName.get(l.namedTypeName)||new Set([l.namedTypeName]);for(let V of x)if(O||(O=this.entityDataByTypeName.has(V)),O)break;(!O||N!==I)&&r.set(d,N)}}validateEventDrivenKeyDefinition(t,n){let r=this.keyFieldSetDataByTypeName.get(t);if(r)for(let[i,s]of r.isUnresolvableByKeyFieldSet)s||(0,st.getValueOrDefault)(n,t,()=>[]).push(i)}validateEventDrivenObjectFields(t,n,r,i){for(let[s,o]of t){let u=`${o.originalParentTypeName}.${s}`;if(n.has(s)){o.isExternalBySubgraphName.get(this.subgraphName)||r.set(u,s);continue}i.set(u,s)}}isEdfsPublishResultValid(){let t=this.parentDefinitionDataByTypeName.get(ve.EDFS_PUBLISH_RESULT);if(!t)return!0;if(t.kind!==Re.Kind.OBJECT_TYPE_DEFINITION||t.fieldDataByFieldName.size!=1)return!1;for(let[n,r]of t.fieldDataByFieldName)if(r.argumentDataByArgumentName.size>0||n!==ve.SUCCESS||(0,fa.printTypeNode)(r.type)!==ve.NON_NULLABLE_BOOLEAN)return!1;return!0}isNatsStreamConfigurationInputObjectValid(t){if(t.kind!==Re.Kind.INPUT_OBJECT_TYPE_DEFINITION||t.inputValueDataByValueName.size!=3)return!1;for(let[n,r]of t.inputValueDataByValueName)switch(n){case ve.CONSUMER_INACTIVE_THRESHOLD:{if((0,fa.printTypeNode)(r.type)!==ve.NON_NULLABLE_INT||!r.defaultValue||r.defaultValue.kind!==Re.Kind.INT||r.defaultValue.value!==`${hT.DEFAULT_CONSUMER_INACTIVE_THRESHOLD}`)return!1;break}case ve.CONSUMER_NAME:case ve.STREAM_NAME:{if((0,fa.printTypeNode)(r.type)!==ve.NON_NULLABLE_STRING)return!1;break}default:return!1}return!0}validateEventDrivenSubgraph(t){let n=[],r=new Map,i=new Map,s=new Map,o=new Map,u=new Map,l=new Map,d=new Set,p=new Set;for(let[y,N]of this.parentDefinitionDataByTypeName){if(y===ve.EDFS_PUBLISH_RESULT||y===ve.EDFS_NATS_STREAM_CONFIGURATION||N.kind!==Re.Kind.OBJECT_TYPE_DEFINITION)continue;if(N.isRootType){this.validateEventDrivenRootType(N,r,i,s);continue}let I=this.keyFieldNamesByParentTypeName.get(y);if(!I){p.add(y);continue}this.validateEventDrivenKeyDefinition(y,o),this.validateEventDrivenObjectFields(N.fieldDataByFieldName,I,u,l)}if(this.isEdfsPublishResultValid()||n.push(De.invalidEdfsPublishResultObjectErrorMessage),this.edfsDirectiveReferences.has(ve.EDFS_NATS_SUBSCRIBE)){let y=this.parentDefinitionDataByTypeName.get(ve.EDFS_NATS_STREAM_CONFIGURATION);y&&this.usesEdfsNatsStreamConfiguration&&!this.isNatsStreamConfigurationInputObjectValid(y)&&n.push(De.invalidNatsStreamConfigurationDefinitionErrorMessage),this.parentDefinitionDataByTypeName.delete(ve.EDFS_NATS_STREAM_CONFIGURATION),t.push(Li.EDFS_NATS_STREAM_CONFIGURATION_DEFINITION)}r.size>0&&n.push((0,De.invalidRootTypeFieldEventsDirectivesErrorMessage)(r)),s.size>0&&n.push((0,De.invalidEventDrivenMutationResponseTypeErrorMessage)(s)),i.size>0&&n.push((0,De.invalidRootTypeFieldResponseTypesEventDrivenErrorMessage)(i)),o.size>0&&n.push((0,De.invalidKeyFieldSetsEventDrivenErrorMessage)(o)),u.size>0&&n.push((0,De.nonExternalKeyFieldNamesEventDrivenErrorMessage)(u)),l.size>0&&n.push((0,De.nonKeyFieldNamesEventDrivenErrorMessage)(l)),d.size>0&&n.push((0,De.nonEntityObjectExtensionsEventDrivenErrorMessage)([...d])),p.size>0&&n.push((0,De.nonKeyComposingObjectTypeNamesEventDrivenErrorMessage)([...p])),n.length>0&&this.errors.push((0,De.invalidEventDrivenGraphError)(n))}validateUnionMembers(t){if(t.memberByMemberTypeName.size<1){this.errors.push((0,De.noDefinedUnionMembersError)(t.name));return}let n=[];for(let r of t.memberByMemberTypeName.keys()){let i=this.parentDefinitionDataByTypeName.get(r);i&&i.kind!==Re.Kind.OBJECT_TYPE_DEFINITION&&n.push(`"${r}", which is type "${(0,st.kindToTypeString)(i.kind)}"`)}n.length>0&&this.errors.push((0,De.invalidUnionMemberTypeError)(t.name,n))}addConcreteTypeNamesForUnion(t){if(!t.types||t.types.length<1)return;let n=t.name.value;for(let r of t.types){let i=r.name.value;(0,st.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,n,()=>new Set).add(i),this.internalGraph.addEdge(this.internalGraph.addOrUpdateNode(n,{isAbstract:!0}),this.internalGraph.addOrUpdateNode(i),i,!0)}}validateAndAddKeyToConfiguration(t,n){let r=(0,st.getOrThrowError)(this.configurationDataByParentTypeName,(0,Wr.getParentTypeName)(t),"configurationDataByParentTypeName"),i=(0,Lc.validateKeyFieldSets)(this,t,n.isUnresolvableByKeyFieldSet,r.fieldNames);i&&(r.keys=i)}validateAndAddKeysToConfiguration(){for(let[t,n]of this.keyFieldSetDataByTypeName){let r=this.parentDefinitionDataByTypeName.get(t);if(!r||r.kind!==Re.Kind.OBJECT_TYPE_DEFINITION&&r.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,De.undefinedObjectLikeParentError)(t));continue}this.validateAndAddKeyToConfiguration(r,n)}}normalize(t){(0,GR.upsertDirectiveSchemaAndEntityDefinitions)(this,t),(0,GR.upsertParentsAndChildren)(this,t),(0,GR.consolidateAuthorizationDirectives)(this,t);for(let s of this.interfaceTypeNamesWithAuthorizationDirectives){let o=this.authorizationDataByParentTypeName.get(s);if(!o)continue;let u=this.concreteTypeNamesByAbstractTypeName.get(s);for(let l of u||[]){let d=(0,st.getValueOrDefault)(this.authorizationDataByParentTypeName,l,()=>(0,st.newAuthorizationData)(l));for(let[p,y]of o.fieldAuthorizationDataByFieldName)(0,st.upsertFieldAuthorizationData)(d.fieldAuthorizationDataByFieldName,y)||this.invalidOrScopesHostPaths.add(`${l}.${p}`)}}for(let[s,o]of this.heirFieldAuthorizationDataByTypeName){let u=this.authorizationDataByParentTypeName.get(s);if(u)for(let l of o)(0,st.mergeAuthorizationDataByAND)(u,l)||this.invalidOrScopesHostPaths.add(`${s}.${l.fieldName}`)}this.invalidOrScopesHostPaths.size>0&&this.errors.push((0,De.orScopesLimitError)(st.maxOrScopes,[...this.invalidOrScopesHostPaths]));let n=[];for(let s of Li.BASE_DIRECTIVE_DEFINITIONS)n.push(s);if(n.push(Li.FIELD_SET_SCALAR_DEFINITION),this.isSubgraphVersionTwo){for(let s of Li.VERSION_TWO_DIRECTIVE_DEFINITIONS)n.push(s),this.directiveDefinitionByDirectiveName.set(s.name.value,s);n.push(Li.SCOPE_SCALAR_DEFINITION)}for(let s of this.edfsDirectiveReferences){let o=Li.EVENT_DRIVEN_DIRECTIVE_DEFINITIONS_BY_DIRECTIVE_NAME.get(s);if(!o){this.errors.push((0,De.invalidEdfsDirectiveName)(s));continue}n.push(o)}this.edfsDirectiveReferences.size>0&&this.referencedDirectiveNames.has(ve.SUBSCRIPTION_FILTER)&&(this.directiveDefinitionByDirectiveName.set(ve.SUBSCRIPTION_FILTER,Li.SUBSCRIPTION_FILTER_DEFINITION),n.push(Li.SUBSCRIPTION_FILTER_DEFINITION),n.push(Li.SUBSCRIPTION_FILTER_CONDITION_DEFINITION),n.push(Li.SUBSCRIPTION_FIELD_CONDITION_DEFINITION),n.push(Li.SUBSCRIPTION_FILTER_VALUE_DEFINITION));for(let s of this.customDirectiveDefinitions.values())n.push(s);this.schemaDefinition.operationTypes.size>0&&n.push((0,Wr.getSchemaNodeByData)(this.schemaDefinition,this.errors,this.directiveDefinitionByDirectiveName));for(let[s,o]of this.parentDefinitionDataByTypeName)switch(o.kind){case Re.Kind.ENUM_TYPE_DEFINITION:if(o.enumValueDataByValueName.size<1){this.errors.push((0,De.noDefinedEnumValuesError)(s));break}n.push((0,Wr.getEnumNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName,this.authorizationDataByParentTypeName));break;case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:if(o.inputValueDataByValueName.size<1){this.errors.push((0,De.noInputValueDefinitionsError)(s));break}n.push((0,Wr.getInputObjectNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName,this.authorizationDataByParentTypeName));break;case Re.Kind.INTERFACE_TYPE_DEFINITION:case Re.Kind.OBJECT_TYPE_DEFINITION:let u=this.entityDataByTypeName.has(s),l=this.operationTypeNodeByTypeName.get(s),d=o.kind===Re.Kind.OBJECT_TYPE_DEFINITION;if(l&&(o.fieldDataByFieldName.delete(ve.SERVICE_FIELD),o.fieldDataByFieldName.delete(ve.ENTITIES_FIELD)),this.parentsWithChildArguments.has(s)||!d){let O=[];for(let[x,V]of o.fieldDataByFieldName)!d&&V.isExternalBySubgraphName.get(this.subgraphName)&&O.push(x),this.validateArguments(V,`${s}.${x}`);O.length>0&&(this.isSubgraphVersionTwo?this.errors.push((0,De.externalInterfaceFieldsError)(s,O)):this.warnings.push((0,Xp.externalInterfaceFieldsWarning)(this.subgraphName,s,O)))}let p=o.kind===Re.Kind.OBJECT_TYPE_DEFINITION&&o.renamedTypeName||s,y={fieldNames:new Set,isRootNode:u,typeName:p},N=this.entityInterfaceDataByTypeName.get(s);N&&(N.fieldDatas=(0,st.fieldDatasToSimpleFieldDatas)(o.fieldDataByFieldName.values()),N.concreteTypeNames=(0,st.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,s,()=>new Set),y.isInterfaceObject=N.isInterfaceObject,y.entityInterfaceConcreteTypeNames=N.concreteTypeNames);let I=this.eventsConfigurations.get(p);I&&(y.events=I),this.configurationDataByParentTypeName.set(p,y),(0,Lc.addFieldNamesToConfigurationData)(o.fieldDataByFieldName,y),this.validateInterfaceImplementations(o),n.push((0,Wr.getCompositeOutputNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName,this.authorizationDataByParentTypeName)),o.fieldDataByFieldName.size<1&&!(0,Lc.isNodeQuery)(s,l)&&this.errors.push((0,De.noFieldDefinitionsError)((0,st.kindToTypeString)(o.kind),s));break;case Re.Kind.SCALAR_TYPE_DEFINITION:if(o.extensionType===Hl.ExtensionType.REAL){this.errors.push((0,De.noBaseScalarDefinitionError)(s));break}n.push((0,Wr.getScalarNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName));break;case Re.Kind.UNION_TYPE_DEFINITION:n.push((0,Wr.getUnionNodeByData)(o,this.errors,this.directiveDefinitionByDirectiveName)),this.validateUnionMembers(o);break;default:throw(0,De.unexpectedKindFatalError)(s)}for(let s of Object.values(Re.OperationTypeNode)){let o=this.schemaDefinition.operationTypes.get(s),u=(0,st.getOrThrowError)(Hi.operationTypeNodeToDefaultType,s,ve.OPERATION_TO_DEFAULT),l=o?(0,Za.getTypeNodeNamedTypeName)(o.type):u;if(l!==u&&this.parentDefinitionDataByTypeName.has(u)){this.errors.push((0,De.invalidRootTypeDefinitionError)(s,l,u));continue}let d=this.parentDefinitionDataByTypeName.get(l);if(o){if(!d){this.errors.push((0,De.undefinedTypeError)(l));continue}this.operationTypeNodeByTypeName.set(l,s)}if(!d)continue;let p=this.configurationDataByParentTypeName.get(u);if(p&&(p.isRootNode=!0,p.typeName=u),d.kind!==Re.Kind.OBJECT_TYPE_DEFINITION){this.errors.push((0,De.operationDefinitionError)(l,s,d.kind));continue}for(let y of d.fieldDataByFieldName.values()){let N=(0,Za.getTypeNodeNamedTypeName)(y.node.type);!Li.BASE_SCALARS.has(N)&&!this.parentDefinitionDataByTypeName.has(N)&&this.errors.push((0,De.undefinedTypeError)(N))}}for(let s of this.referencedTypeNames){let o=this.parentDefinitionDataByTypeName.get(s);if(o){if(o.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION)continue;let u=this.concreteTypeNamesByAbstractTypeName.get(s);(!u||u.size<0)&&this.warnings.push((0,Xp.unimplementedInterfaceOutputTypeWarning)(this.subgraphName,s));continue}this.entityDataByTypeName.has(s)||this.errors.push((0,De.undefinedTypeError)(s))}this.validateAndAddKeysToConfiguration();for(let[s,o]of this.fieldSetDataByTypeName){let u=this.parentDefinitionDataByTypeName.get(s);if(!u||u.kind!==Re.Kind.OBJECT_TYPE_DEFINITION&&u.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,De.undefinedObjectLikeParentError)(s));continue}(0,Lc.validateAndAddConditionalFieldSetsToConfiguration)(this,u,o)}let r=new Map;for(let s of this.directiveDefinitionByDirectiveName.values()){let o=(0,Hi.extractExecutableDirectiveLocations)(s.locations,new Set);o.size<1||(0,Wr.addPersistedDirectiveDefinitionDataByNode)(r,s,this.errors,this.directiveDefinitionByDirectiveName,this.handledRepeatedDirectivesByHostPath,o,this.subgraphName)}this.isSubgraphEventDrivenGraph=this.edfsDirectiveReferences.size>0,this.isSubgraphEventDrivenGraph&&this.validateEventDrivenSubgraph(n);for(let s of this.unvalidatedExternalFieldCoords)this.isSubgraphVersionTwo?this.errors.push((0,De.invalidExternalDirectiveError)(s)):this.warnings.push((0,Xp.invalidExternalFieldWarning)(s,this.subgraphName));if(this.errors.length>0)return{errors:this.errors,warnings:this.warnings};let i={kind:Re.Kind.DOCUMENT,definitions:n};return{normalizationResult:{authorizationDataByParentTypeName:this.authorizationDataByParentTypeName,concreteTypeNamesByAbstractTypeName:this.concreteTypeNamesByAbstractTypeName,conditionalFieldDataByCoordinates:this.conditionalFieldDataByCoordinates,configurationDataByTypeName:this.configurationDataByParentTypeName,entityDataByTypeName:this.entityDataByTypeName,entityInterfaces:this.entityInterfaceDataByTypeName,isEventDrivenGraph:this.isSubgraphEventDrivenGraph,isVersionTwo:this.isSubgraphVersionTwo,keyFieldNamesByParentTypeName:this.keyFieldNamesByParentTypeName,operationTypes:this.operationTypeNodeByTypeName,originalTypeNameByRenamedTypeName:this.originalTypeNameByRenamedTypeName,overridesByTargetSubgraphName:this.overridesByTargetSubgraphName,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName,persistedDirectiveDefinitionDataByDirectiveName:r,subgraphAST:i,subgraphString:(0,Re.print)(i),schema:(0,fde.buildASTSchema)(i,{assumeValid:!0,assumeValidSDL:!0})},warnings:this.warnings}}};Wl.NormalizationFactory=TT;function Tde(e){let t=new Map,n=new Map,r=new Map,i=new Map,s=new Map,o=new Map,u=new Set,l=new Map,d=new Set,p=new Set,y=[],N=new Set,I=[],O=[];for(let K of e)K.name&&(0,mde.recordSubgraphName)(K.name,d,p);let x=new QR.Graph;for(let K=0;K0&&I.push(...xe),fe){O.push((0,De.subgraphValidationError)(se,fe));continue}if(!he){O.push((0,De.subgraphValidationError)(se,[De.subgraphValidationFailureError]));continue}l.set(se,he.parentDefinitionDataByTypeName);for(let ht of he.authorizationDataByParentTypeName.values())(0,st.upsertAuthorizationData)(t,ht,N);for(let[ht,Ct]of he.concreteTypeNamesByAbstractTypeName){let B=n.get(ht);if(!B){n.set(ht,new Set(Ct));continue}(0,st.addIterableValuesToSet)(Ct,B)}for(let ht of he.entityDataByTypeName.values())(0,st.upsertEntityData)(r,ht);if(re.name&&i.set(se,{conditionalFieldDataByCoordinates:he.conditionalFieldDataByCoordinates,configurationDataByTypeName:he.configurationDataByTypeName,definitions:he.subgraphAST,entityInterfaces:he.entityInterfaces,isVersionTwo:he.isVersionTwo,keyFieldNamesByParentTypeName:he.keyFieldNamesByParentTypeName,name:se,operationTypes:he.operationTypes,overriddenFieldNamesByParentTypeName:new Map,parentDefinitionDataByTypeName:he.parentDefinitionDataByTypeName,persistedDirectiveDefinitionDataByDirectiveName:he.persistedDirectiveDefinitionDataByDirectiveName,schema:he.schema,url:re.url}),!(he.overridesByTargetSubgraphName.size<1))for(let[ht,Ct]of he.overridesByTargetSubgraphName){let B=d.has(ht);for(let[Te,nt]of Ct){let xt=he.originalTypeNameByRenamedTypeName.get(Te)||Te;if(!B)I.push((0,Xp.invalidOverrideTargetSubgraphNameWarning)(ht,xt,[...nt],re.name));else{let rn=(0,st.getValueOrDefault)(s,ht,()=>new Map),wn=(0,st.getValueOrDefault)(rn,Te,()=>new Set(nt));(0,st.addIterableValuesToSet)(nt,wn)}for(let rn of nt){let wn=`${xt}.${rn}`,vn=o.get(wn);if(!vn){o.set(wn,[se]);continue}vn.push(se),u.add(wn)}}}}let V=[];if(N.size>0&&V.push((0,De.orScopesLimitError)(st.maxOrScopes,[...N])),(y.length>0||p.size>0)&&V.push((0,De.invalidSubgraphNamesError)([...p],y)),u.size>0){let K=[];for(let re of u){let se=(0,st.getOrThrowError)(o,re,"overrideSourceSubgraphNamesByFieldPath");K.push((0,De.duplicateOverriddenFieldErrorMessage)(re,se))}V.push((0,De.duplicateOverriddenFieldsError)(K))}if(V.push(...O),V.length>0)return{authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,errors:V,internalSubgraphBySubgraphName:i,internalGraph:x,warnings:I};for(let[K,re]of s){let se=(0,st.getOrThrowError)(i,K,"internalSubgraphBySubgraphName");se.overriddenFieldNamesByParentTypeName=re;for(let[fe,he]of re){let xe=se.configurationDataByTypeName.get(fe);xe&&((0,st.subtractSourceSetFromTargetSet)(he,xe.fieldNames),xe.fieldNames.size<1&&se.configurationDataByTypeName.delete(fe))}}return{authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,internalSubgraphBySubgraphName:i,internalGraph:x,warnings:I}}});var cI=j(ed=>{"use strict";m();T();h();Object.defineProperty(ed,"__esModule",{value:!0});ed.DivergentType=void 0;ed.getLeastRestrictiveMergedTypeNode=Nde;ed.getMostRestrictiveMergedTypeNode=Ede;ed.renameNamedTypeName=gde;var Xl=(Le(),Me(je)),Dq=To(),yde=Qa(),Sq=$i(),Aq=Al(),Zl;(function(e){e[e.NONE=0]="NONE",e[e.CURRENT=1]="CURRENT",e[e.OTHER=2]="OTHER"})(Zl||(ed.DivergentType=Zl={}));function Rq(e,t,n,r,i){t=(0,yde.getMutableTypeNode)(t,n,i);let s={kind:e.kind},o=Zl.NONE,u=s;for(let l=0;l{"use strict";m();T();h();Object.defineProperty(zR,"__esModule",{value:!0});zR.renameRootTypes=_de;var Ide=(Le(),Me(je)),Pc=bi(),td=ps(),JR=$i(),vde=cI();function _de(e,t){let n,r=!1,i;(0,Ide.visit)(t.definitions,{FieldDefinition:{enter(s){let o=s.name.value;if(r&&(o===Pc.SERVICE_FIELD||o===Pc.ENTITIES_FIELD))return n.fieldDataByFieldName.delete(o),!1;let u=n.name,l=(0,td.getOrThrowError)(n.fieldDataByFieldName,o,`${u}.fieldDataByFieldName`),d=t.operationTypes.get(l.namedTypeName);if(d){let p=(0,td.getOrThrowError)(JR.operationTypeNodeToDefaultType,d,Pc.OPERATION_TO_DEFAULT);l.namedTypeName!==p&&(0,vde.renameNamedTypeName)(l,p,e.errors)}return i!=null&&i.has(o)&&l.isShareableBySubgraphName.delete(t.name),!1}},InterfaceTypeDefinition:{enter(s){let o=s.name.value;if(!e.entityInterfaceFederationDataByTypeName.get(o))return!1;n=(0,td.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pc.PARENT_DEFINITION_DATA)},leave(){n=void 0}},ObjectTypeDefinition:{enter(s){let o=s.name.value,u=t.operationTypes.get(o),l=u?(0,td.getOrThrowError)(JR.operationTypeNodeToDefaultType,u,Pc.OPERATION_TO_DEFAULT):o;n=(0,td.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pc.PARENT_DEFINITION_DATA),r=n.isRootType,!e.entityInterfaceFederationDataByTypeName.get(o)&&(e.addValidPrimaryKeyTargetsToEntityData(o),i=t.overriddenFieldNamesByParentTypeName.get(l),o!==l&&(n.name=l,t.parentDefinitionDataByTypeName.set(l,n),t.parentDefinitionDataByTypeName.delete(o)))},leave(){n=void 0,r=!1,i=void 0}},ObjectTypeExtension:{enter(s){let o=s.name.value,u=t.operationTypes.get(o),l=u?(0,td.getOrThrowError)(JR.operationTypeNodeToDefaultType,u,Pc.OPERATION_TO_DEFAULT):o;n=(0,td.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pc.PARENT_DEFINITION_DATA),r=n.isRootType,e.addValidPrimaryKeyTargetsToEntityData(o),i=t.overriddenFieldNamesByParentTypeName.get(o),o!==l&&(n.name=l,t.parentDefinitionDataByTypeName.set(l,n),t.parentDefinitionDataByTypeName.delete(o))},leave(){n=void 0,r=!1,i=void 0}}})}});var Fq=j((Zp,yT)=>{"use strict";m();T();h();(function(){var e,t="4.17.21",n=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",s="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",u=500,l="__lodash_placeholder__",d=1,p=2,y=4,N=1,I=2,O=1,x=2,V=4,K=8,re=16,se=32,fe=64,he=128,xe=256,ht=512,Ct=30,B="...",Te=800,nt=16,xt=1,rn=2,wn=3,vn=1/0,_n=9007199254740991,mi=17976931348623157e292,Xr=NaN,kn=4294967295,on=kn-1,$n=kn>>>1,U=[["ary",he],["bind",O],["bindKey",x],["curry",K],["curryRight",re],["flip",ht],["partial",se],["partialRight",fe],["rearg",xe]],ae="[object Arguments]",te="[object Array]",ce="[object AsyncFunction]",Ke="[object Boolean]",Q="[object Date]",ee="[object DOMException]",Ue="[object Error]",Xe="[object Function]",$t="[object GeneratorFunction]",Je="[object Map]",Ht="[object Number]",Ta="[object Null]",ki="[object Object]",ya="[object Promise]",ud="[object Proxy]",Ao="[object RegExp]",Gr="[object Set]",Wi="[object String]",cn="[object Symbol]",Qr="[object Undefined]",Mc="[object WeakMap]",Ro="[object WeakSet]",Bc="[object ArrayBuffer]",F="[object DataView]",g="[object Float32Array]",v="[object Float64Array]",C="[object Int8Array]",J="[object Int16Array]",ie="[object Int32Array]",me="[object Uint8Array]",Rt="[object Uint8ClampedArray]",Cn="[object Uint16Array]",Dn="[object Uint32Array]",qn=/\b__p \+= '';/g,bn=/\b(__p \+=) '' \+/g,CK=/(__e\(.*?\)|\b__t\)) \+\n'';/g,LF=/&(?:amp|lt|gt|quot|#39);/g,PF=/[&<>"']/g,xK=RegExp(LF.source),UK=RegExp(PF.source),MK=/<%-([\s\S]+?)%>/g,BK=/<%([\s\S]+?)%>/g,kF=/<%=([\s\S]+?)%>/g,VK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jK=/^\w*$/,$K=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jI=/[\\^$.*+?()[\]{}|]/g,qK=RegExp(jI.source),$I=/^\s+/,KK=/\s/,GK=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,QK=/\{\n\/\* \[wrapped with (.+)\] \*/,YK=/,? & /,JK=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zK=/[()=,{}\[\]\/\s]/,HK=/\\(\\)?/g,WK=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,CF=/\w*$/,XK=/^[-+]0x[0-9a-f]+$/i,ZK=/^0b[01]+$/i,eG=/^\[object .+?Constructor\]$/,tG=/^0o[0-7]+$/i,nG=/^(?:0|[1-9]\d*)$/,rG=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,xT=/($^)/,iG=/['\n\r\u2028\u2029\\]/g,UT="\\ud800-\\udfff",sG="\\u0300-\\u036f",oG="\\ufe20-\\ufe2f",aG="\\u20d0-\\u20ff",xF=sG+oG+aG,UF="\\u2700-\\u27bf",MF="a-z\\xdf-\\xf6\\xf8-\\xff",uG="\\xac\\xb1\\xd7\\xf7",cG="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",lG="\\u2000-\\u206f",dG=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",BF="A-Z\\xc0-\\xd6\\xd8-\\xde",VF="\\ufe0e\\ufe0f",jF=uG+cG+lG+dG,qI="['\u2019]",pG="["+UT+"]",$F="["+jF+"]",MT="["+xF+"]",qF="\\d+",fG="["+UF+"]",KF="["+MF+"]",GF="[^"+UT+jF+qF+UF+MF+BF+"]",KI="\\ud83c[\\udffb-\\udfff]",mG="(?:"+MT+"|"+KI+")",QF="[^"+UT+"]",GI="(?:\\ud83c[\\udde6-\\uddff]){2}",QI="[\\ud800-\\udbff][\\udc00-\\udfff]",cd="["+BF+"]",YF="\\u200d",JF="(?:"+KF+"|"+GF+")",hG="(?:"+cd+"|"+GF+")",zF="(?:"+qI+"(?:d|ll|m|re|s|t|ve))?",HF="(?:"+qI+"(?:D|LL|M|RE|S|T|VE))?",WF=mG+"?",XF="["+VF+"]?",TG="(?:"+YF+"(?:"+[QF,GI,QI].join("|")+")"+XF+WF+")*",yG="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",NG="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ZF=XF+WF+TG,EG="(?:"+[fG,GI,QI].join("|")+")"+ZF,gG="(?:"+[QF+MT+"?",MT,GI,QI,pG].join("|")+")",IG=RegExp(qI,"g"),vG=RegExp(MT,"g"),YI=RegExp(KI+"(?="+KI+")|"+gG+ZF,"g"),_G=RegExp([cd+"?"+KF+"+"+zF+"(?="+[$F,cd,"$"].join("|")+")",hG+"+"+HF+"(?="+[$F,cd+JF,"$"].join("|")+")",cd+"?"+JF+"+"+zF,cd+"+"+HF,NG,yG,qF,EG].join("|"),"g"),bG=RegExp("["+YF+UT+xF+VF+"]"),OG=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,SG=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],DG=-1,Vn={};Vn[g]=Vn[v]=Vn[C]=Vn[J]=Vn[ie]=Vn[me]=Vn[Rt]=Vn[Cn]=Vn[Dn]=!0,Vn[ae]=Vn[te]=Vn[Bc]=Vn[Ke]=Vn[F]=Vn[Q]=Vn[Ue]=Vn[Xe]=Vn[Je]=Vn[Ht]=Vn[ki]=Vn[Ao]=Vn[Gr]=Vn[Wi]=Vn[Mc]=!1;var xn={};xn[ae]=xn[te]=xn[Bc]=xn[F]=xn[Ke]=xn[Q]=xn[g]=xn[v]=xn[C]=xn[J]=xn[ie]=xn[Je]=xn[Ht]=xn[ki]=xn[Ao]=xn[Gr]=xn[Wi]=xn[cn]=xn[me]=xn[Rt]=xn[Cn]=xn[Dn]=!0,xn[Ue]=xn[Xe]=xn[Mc]=!1;var AG={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},RG={"&":"&","<":"<",">":">",'"':""","'":"'"},FG={"&":"&","<":"<",">":">",""":'"',"'":"'"},wG={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},LG=parseFloat,PG=parseInt,ew=typeof global=="object"&&global&&global.Object===Object&&global,kG=typeof self=="object"&&self&&self.Object===Object&&self,xr=ew||kG||Function("return this")(),JI=typeof Zp=="object"&&Zp&&!Zp.nodeType&&Zp,Vc=JI&&typeof yT=="object"&&yT&&!yT.nodeType&&yT,tw=Vc&&Vc.exports===JI,zI=tw&&ew.process,Es=function(){try{var W=Vc&&Vc.require&&Vc.require("util").types;return W||zI&&zI.binding&&zI.binding("util")}catch(de){}}(),nw=Es&&Es.isArrayBuffer,rw=Es&&Es.isDate,iw=Es&&Es.isMap,sw=Es&&Es.isRegExp,ow=Es&&Es.isSet,aw=Es&&Es.isTypedArray;function Xi(W,de,oe){switch(oe.length){case 0:return W.call(de);case 1:return W.call(de,oe[0]);case 2:return W.call(de,oe[0],oe[1]);case 3:return W.call(de,oe[0],oe[1],oe[2])}return W.apply(de,oe)}function CG(W,de,oe,Be){for(var _t=-1,dn=W==null?0:W.length;++_t-1}function HI(W,de,oe){for(var Be=-1,_t=W==null?0:W.length;++Be<_t;)if(oe(de,W[Be]))return!0;return!1}function Kn(W,de){for(var oe=-1,Be=W==null?0:W.length,_t=Array(Be);++oe-1;);return oe}function hw(W,de){for(var oe=W.length;oe--&&ld(de,W[oe],0)>-1;);return oe}function KG(W,de){for(var oe=W.length,Be=0;oe--;)W[oe]===de&&++Be;return Be}var GG=ev(AG),QG=ev(RG);function YG(W){return"\\"+wG[W]}function JG(W,de){return W==null?e:W[de]}function dd(W){return bG.test(W)}function zG(W){return OG.test(W)}function HG(W){for(var de,oe=[];!(de=W.next()).done;)oe.push(de.value);return oe}function iv(W){var de=-1,oe=Array(W.size);return W.forEach(function(Be,_t){oe[++de]=[_t,Be]}),oe}function Tw(W,de){return function(oe){return W(de(oe))}}function Ju(W,de){for(var oe=-1,Be=W.length,_t=0,dn=[];++oe-1}function UQ(a,c){var f=this.__data__,E=ny(f,a);return E<0?(++this.size,f.push([a,c])):f[E][1]=c,this}Na.prototype.clear=PQ,Na.prototype.delete=kQ,Na.prototype.get=CQ,Na.prototype.has=xQ,Na.prototype.set=UQ;function Ea(a){var c=-1,f=a==null?0:a.length;for(this.clear();++c=c?a:c)),a}function _s(a,c,f,E,_,L){var M,q=c&d,X=c&p,ye=c&y;if(f&&(M=_?f(a,E,_,L):f(a)),M!==e)return M;if(!Xn(a))return a;var Ne=St(a);if(Ne){if(M=j2(a),!q)return Ci(a,M)}else{var Ie=ei(a),we=Ie==Xe||Ie==$t;if(tc(a))return Xw(a,q);if(Ie==ki||Ie==ae||we&&!_){if(M=X||we?{}:yL(a),!q)return X?F2(a,ZQ(M,a)):R2(a,Aw(M,a))}else{if(!xn[Ie])return _?a:{};M=$2(a,Ie,q)}}L||(L=new to);var ze=L.get(a);if(ze)return ze;L.set(a,M),QL(a)?a.forEach(function(dt){M.add(_s(dt,c,f,dt,a,L))}):KL(a)&&a.forEach(function(dt,qt){M.set(qt,_s(dt,c,f,qt,a,L))});var lt=ye?X?Fv:Rv:X?Ui:Ur,Ut=Ne?e:lt(a);return gs(Ut||a,function(dt,qt){Ut&&(qt=dt,dt=a[qt]),Tf(M,qt,_s(dt,c,f,qt,a,L))}),M}function e2(a){var c=Ur(a);return function(f){return Rw(f,a,c)}}function Rw(a,c,f){var E=f.length;if(a==null)return!E;for(a=Ln(a);E--;){var _=f[E],L=c[_],M=a[_];if(M===e&&!(_ in a)||!L(M))return!1}return!0}function Fw(a,c,f){if(typeof a!="function")throw new Is(i);return _f(function(){a.apply(e,f)},c)}function yf(a,c,f,E){var _=-1,L=BT,M=!0,q=a.length,X=[],ye=c.length;if(!q)return X;f&&(c=Kn(c,Zi(f))),E?(L=HI,M=!1):c.length>=n&&(L=lf,M=!1,c=new qc(c));e:for(;++__?0:_+f),E=E===e||E>_?_:Lt(E),E<0&&(E+=_),E=f>E?0:JL(E);f0&&f(q)?c>1?Yr(q,c-1,f,E,_):Yu(_,q):E||(_[_.length]=q)}return _}var dv=iL(),Pw=iL(!0);function Fo(a,c){return a&&dv(a,c,Ur)}function pv(a,c){return a&&Pw(a,c,Ur)}function iy(a,c){return Qu(c,function(f){return ba(a[f])})}function Gc(a,c){c=Zu(c,a);for(var f=0,E=c.length;a!=null&&fc}function r2(a,c){return a!=null&&On.call(a,c)}function i2(a,c){return a!=null&&c in Ln(a)}function s2(a,c,f){return a>=Zr(c,f)&&a=120&&Ne.length>=120)?new qc(M&&Ne):e}Ne=a[0];var Ie=-1,we=q[0];e:for(;++Ie<_&&ye.length-1;)q!==a&&zT.call(q,X,1),zT.call(a,X,1);return a}function Kw(a,c){for(var f=a?c.length:0,E=f-1;f--;){var _=c[f];if(f==E||_!==L){var L=_;_a(_)?zT.call(a,_,1):vv(a,_)}}return a}function Ev(a,c){return a+XT(bw()*(c-a+1))}function N2(a,c,f,E){for(var _=-1,L=Ar(WT((c-a)/(f||1)),0),M=oe(L);L--;)M[E?L:++_]=a,a+=f;return M}function gv(a,c){var f="";if(!a||c<1||c>_n)return f;do c%2&&(f+=a),c=XT(c/2),c&&(a+=a);while(c);return f}function Bt(a,c){return Uv(gL(a,c,Mi),a+"")}function E2(a){return Dw(Id(a))}function g2(a,c){var f=Id(a);return hy(f,Kc(c,0,f.length))}function gf(a,c,f,E){if(!Xn(a))return a;c=Zu(c,a);for(var _=-1,L=c.length,M=L-1,q=a;q!=null&&++__?0:_+c),f=f>_?_:f,f<0&&(f+=_),_=c>f?0:f-c>>>0,c>>>=0;for(var L=oe(_);++E<_;)L[E]=a[E+c];return L}function _2(a,c){var f;return Wu(a,function(E,_,L){return f=c(E,_,L),!f}),!!f}function oy(a,c,f){var E=0,_=a==null?E:a.length;if(typeof c=="number"&&c===c&&_<=$n){for(;E<_;){var L=E+_>>>1,M=a[L];M!==null&&!ts(M)&&(f?M<=c:M=n){var ye=c?null:k2(a);if(ye)return jT(ye);M=!1,_=lf,X=new qc}else X=c?[]:q;e:for(;++E=E?a:bs(a,c,f)}var Ww=dQ||function(a){return xr.clearTimeout(a)};function Xw(a,c){if(c)return a.slice();var f=a.length,E=Ew?Ew(f):new a.constructor(f);return a.copy(E),E}function Sv(a){var c=new a.constructor(a.byteLength);return new YT(c).set(new YT(a)),c}function O2(a,c){var f=c?Sv(a.buffer):a.buffer;return new a.constructor(f,a.byteOffset,a.byteLength)}function S2(a){var c=new a.constructor(a.source,CF.exec(a));return c.lastIndex=a.lastIndex,c}function D2(a){return hf?Ln(hf.call(a)):{}}function Zw(a,c){var f=c?Sv(a.buffer):a.buffer;return new a.constructor(f,a.byteOffset,a.length)}function eL(a,c){if(a!==c){var f=a!==e,E=a===null,_=a===a,L=ts(a),M=c!==e,q=c===null,X=c===c,ye=ts(c);if(!q&&!ye&&!L&&a>c||L&&M&&X&&!q&&!ye||E&&M&&X||!f&&X||!_)return 1;if(!E&&!L&&!ye&&a=q)return X;var ye=f[E];return X*(ye=="desc"?-1:1)}}return a.index-c.index}function tL(a,c,f,E){for(var _=-1,L=a.length,M=f.length,q=-1,X=c.length,ye=Ar(L-M,0),Ne=oe(X+ye),Ie=!E;++q1?f[_-1]:e,M=_>2?f[2]:e;for(L=a.length>3&&typeof L=="function"?(_--,L):e,M&&Ti(f[0],f[1],M)&&(L=_<3?e:L,_=1),c=Ln(c);++E<_;){var q=f[E];q&&a(c,q,E,L)}return c})}function rL(a,c){return function(f,E){if(f==null)return f;if(!xi(f))return a(f,E);for(var _=f.length,L=c?_:-1,M=Ln(f);(c?L--:++L<_)&&E(M[L],L,M)!==!1;);return f}}function iL(a){return function(c,f,E){for(var _=-1,L=Ln(c),M=E(c),q=M.length;q--;){var X=M[a?q:++_];if(f(L[X],X,L)===!1)break}return c}}function w2(a,c,f){var E=c&O,_=If(a);function L(){var M=this&&this!==xr&&this instanceof L?_:a;return M.apply(E?f:this,arguments)}return L}function sL(a){return function(c){c=yn(c);var f=dd(c)?eo(c):e,E=f?f[0]:c.charAt(0),_=f?ec(f,1).join(""):c.slice(1);return E[a]()+_}}function Nd(a){return function(c){return WI(rP(nP(c).replace(IG,"")),a,"")}}function If(a){return function(){var c=arguments;switch(c.length){case 0:return new a;case 1:return new a(c[0]);case 2:return new a(c[0],c[1]);case 3:return new a(c[0],c[1],c[2]);case 4:return new a(c[0],c[1],c[2],c[3]);case 5:return new a(c[0],c[1],c[2],c[3],c[4]);case 6:return new a(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new a(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var f=Td(a.prototype),E=a.apply(f,c);return Xn(E)?E:f}}function L2(a,c,f){var E=If(a);function _(){for(var L=arguments.length,M=oe(L),q=L,X=Ed(_);q--;)M[q]=arguments[q];var ye=L<3&&M[0]!==X&&M[L-1]!==X?[]:Ju(M,X);if(L-=ye.length,L-1?_[L?c[M]:M]:e}}function aL(a){return va(function(c){var f=c.length,E=f,_=vs.prototype.thru;for(a&&c.reverse();E--;){var L=c[E];if(typeof L!="function")throw new Is(i);if(_&&!M&&fy(L)=="wrapper")var M=new vs([],!0)}for(E=M?E:f;++E1&&Wt.reverse(),Ne&&Xq))return!1;var ye=L.get(a),Ne=L.get(c);if(ye&&Ne)return ye==c&&Ne==a;var Ie=-1,we=!0,ze=f&I?new qc:e;for(L.set(a,c),L.set(c,a);++Ie1?"& ":"")+c[E],c=c.join(f>2?", ":" "),a.replace(GK,`{ /* [wrapped with `+c+`] */ `)}function K2(a){return St(a)||Jc(a)||!!(vw&&a&&a[vw])}function _a(a,c){var f=typeof a;return c=c==null?_n:c,!!c&&(f=="number"||f!="symbol"&&nG.test(a))&&a>-1&&a%1==0&&a0){if(++c>=Te)return arguments[0]}else c=0;return a.apply(e,arguments)}}function hy(a,c){var f=-1,E=a.length,_=E-1;for(c=c===e?E:c;++f1?a[c-1]:e;return f=typeof f=="function"?(a.pop(),f):e,LL(a,f)});function PL(a){var c=w(a);return c.__chain__=!0,c}function tJ(a,c){return c(a),a}function Ty(a,c){return c(a)}var nJ=va(function(a){var c=a.length,f=c?a[0]:0,E=this.__wrapped__,_=function(L){return lv(L,a)};return c>1||this.__actions__.length||!(E instanceof Gt)||!_a(f)?this.thru(_):(E=E.slice(f,+f+(c?1:0)),E.__actions__.push({func:Ty,args:[_],thisArg:e}),new vs(E,this.__chain__).thru(function(L){return c&&!L.length&&L.push(e),L}))});function rJ(){return PL(this)}function iJ(){return new vs(this.value(),this.__chain__)}function sJ(){this.__values__===e&&(this.__values__=YL(this.value()));var a=this.__index__>=this.__values__.length,c=a?e:this.__values__[this.__index__++];return{done:a,value:c}}function oJ(){return this}function aJ(a){for(var c,f=this;f instanceof ty;){var E=SL(f);E.__index__=0,E.__values__=e,c?_.__wrapped__=E:c=E;var _=E;f=f.__wrapped__}return _.__wrapped__=a,c}function uJ(){var a=this.__wrapped__;if(a instanceof Gt){var c=a;return this.__actions__.length&&(c=new Gt(this)),c=c.reverse(),c.__actions__.push({func:Ty,args:[Mv],thisArg:e}),new vs(c,this.__chain__)}return this.thru(Mv)}function cJ(){return zw(this.__wrapped__,this.__actions__)}var lJ=uy(function(a,c,f){On.call(a,f)?++a[f]:ga(a,f,1)});function dJ(a,c,f){var E=St(a)?uw:t2;return f&&Ti(a,c,f)&&(c=e),E(a,ct(c,3))}function pJ(a,c){var f=St(a)?Qu:Lw;return f(a,ct(c,3))}var fJ=oL(DL),mJ=oL(AL);function hJ(a,c){return Yr(yy(a,c),1)}function TJ(a,c){return Yr(yy(a,c),vn)}function yJ(a,c,f){return f=f===e?1:Lt(f),Yr(yy(a,c),f)}function kL(a,c){var f=St(a)?gs:Wu;return f(a,ct(c,3))}function CL(a,c){var f=St(a)?xG:ww;return f(a,ct(c,3))}var NJ=uy(function(a,c,f){On.call(a,f)?a[f].push(c):ga(a,f,[c])});function EJ(a,c,f,E){a=xi(a)?a:Id(a),f=f&&!E?Lt(f):0;var _=a.length;return f<0&&(f=Ar(_+f,0)),vy(a)?f<=_&&a.indexOf(c,f)>-1:!!_&&ld(a,c,f)>-1}var gJ=Bt(function(a,c,f){var E=-1,_=typeof c=="function",L=xi(a)?oe(a.length):[];return Wu(a,function(M){L[++E]=_?Xi(c,M,f):Nf(M,c,f)}),L}),IJ=uy(function(a,c,f){ga(a,f,c)});function yy(a,c){var f=St(a)?Kn:Mw;return f(a,ct(c,3))}function vJ(a,c,f,E){return a==null?[]:(St(c)||(c=c==null?[]:[c]),f=E?e:f,St(f)||(f=f==null?[]:[f]),$w(a,c,f))}var _J=uy(function(a,c,f){a[f?0:1].push(c)},function(){return[[],[]]});function bJ(a,c,f){var E=St(a)?WI:pw,_=arguments.length<3;return E(a,ct(c,4),f,_,Wu)}function OJ(a,c,f){var E=St(a)?UG:pw,_=arguments.length<3;return E(a,ct(c,4),f,_,ww)}function SJ(a,c){var f=St(a)?Qu:Lw;return f(a,gy(ct(c,3)))}function DJ(a){var c=St(a)?Dw:E2;return c(a)}function AJ(a,c,f){(f?Ti(a,c,f):c===e)?c=1:c=Lt(c);var E=St(a)?HQ:g2;return E(a,c)}function RJ(a){var c=St(a)?WQ:v2;return c(a)}function FJ(a){if(a==null)return 0;if(xi(a))return vy(a)?pd(a):a.length;var c=ei(a);return c==Je||c==Gr?a.size:Tv(a).length}function wJ(a,c,f){var E=St(a)?XI:_2;return f&&Ti(a,c,f)&&(c=e),E(a,ct(c,3))}var LJ=Bt(function(a,c){if(a==null)return[];var f=c.length;return f>1&&Ti(a,c[0],c[1])?c=[]:f>2&&Ti(c[0],c[1],c[2])&&(c=[c[0]]),$w(a,Yr(c,1),[])}),Ny=pQ||function(){return xr.Date.now()};function PJ(a,c){if(typeof c!="function")throw new Is(i);return a=Lt(a),function(){if(--a<1)return c.apply(this,arguments)}}function xL(a,c,f){return c=f?e:c,c=a&&c==null?a.length:c,Ia(a,he,e,e,e,e,c)}function UL(a,c){var f;if(typeof c!="function")throw new Is(i);return a=Lt(a),function(){return--a>0&&(f=c.apply(this,arguments)),a<=1&&(c=e),f}}var Vv=Bt(function(a,c,f){var E=O;if(f.length){var _=Ju(f,Ed(Vv));E|=se}return Ia(a,E,c,f,_)}),ML=Bt(function(a,c,f){var E=O|x;if(f.length){var _=Ju(f,Ed(ML));E|=se}return Ia(c,E,a,f,_)});function BL(a,c,f){c=f?e:c;var E=Ia(a,K,e,e,e,e,e,c);return E.placeholder=BL.placeholder,E}function VL(a,c,f){c=f?e:c;var E=Ia(a,re,e,e,e,e,e,c);return E.placeholder=VL.placeholder,E}function jL(a,c,f){var E,_,L,M,q,X,ye=0,Ne=!1,Ie=!1,we=!0;if(typeof a!="function")throw new Is(i);c=Ss(c)||0,Xn(f)&&(Ne=!!f.leading,Ie="maxWait"in f,L=Ie?Ar(Ss(f.maxWait)||0,c):L,we="trailing"in f?!!f.trailing:we);function ze(Tr){var ro=E,Sa=_;return E=_=e,ye=Tr,M=a.apply(Sa,ro),M}function lt(Tr){return ye=Tr,q=_f(qt,c),Ne?ze(Tr):M}function Ut(Tr){var ro=Tr-X,Sa=Tr-ye,oP=c-ro;return Ie?Zr(oP,L-Sa):oP}function dt(Tr){var ro=Tr-X,Sa=Tr-ye;return X===e||ro>=c||ro<0||Ie&&Sa>=L}function qt(){var Tr=Ny();if(dt(Tr))return Wt(Tr);q=_f(qt,Ut(Tr))}function Wt(Tr){return q=e,we&&E?ze(Tr):(E=_=e,M)}function ns(){q!==e&&Ww(q),ye=0,E=X=_=q=e}function yi(){return q===e?M:Wt(Ny())}function rs(){var Tr=Ny(),ro=dt(Tr);if(E=arguments,_=this,X=Tr,ro){if(q===e)return lt(X);if(Ie)return Ww(q),q=_f(qt,c),ze(X)}return q===e&&(q=_f(qt,c)),M}return rs.cancel=ns,rs.flush=yi,rs}var kJ=Bt(function(a,c){return Fw(a,1,c)}),CJ=Bt(function(a,c,f){return Fw(a,Ss(c)||0,f)});function xJ(a){return Ia(a,ht)}function Ey(a,c){if(typeof a!="function"||c!=null&&typeof c!="function")throw new Is(i);var f=function(){var E=arguments,_=c?c.apply(this,E):E[0],L=f.cache;if(L.has(_))return L.get(_);var M=a.apply(this,E);return f.cache=L.set(_,M)||L,M};return f.cache=new(Ey.Cache||Ea),f}Ey.Cache=Ea;function gy(a){if(typeof a!="function")throw new Is(i);return function(){var c=arguments;switch(c.length){case 0:return!a.call(this);case 1:return!a.call(this,c[0]);case 2:return!a.call(this,c[0],c[1]);case 3:return!a.call(this,c[0],c[1],c[2])}return!a.apply(this,c)}}function UJ(a){return UL(2,a)}var MJ=b2(function(a,c){c=c.length==1&&St(c[0])?Kn(c[0],Zi(ct())):Kn(Yr(c,1),Zi(ct()));var f=c.length;return Bt(function(E){for(var _=-1,L=Zr(E.length,f);++_=c}),Jc=Cw(function(){return arguments}())?Cw:function(a){return sr(a)&&On.call(a,"callee")&&!Iw.call(a,"callee")},St=oe.isArray,ZJ=nw?Zi(nw):a2;function xi(a){return a!=null&&Iy(a.length)&&!ba(a)}function hr(a){return sr(a)&&xi(a)}function e3(a){return a===!0||a===!1||sr(a)&&hi(a)==Ke}var tc=mQ||Xv,t3=rw?Zi(rw):u2;function n3(a){return sr(a)&&a.nodeType===1&&!bf(a)}function r3(a){if(a==null)return!0;if(xi(a)&&(St(a)||typeof a=="string"||typeof a.splice=="function"||tc(a)||gd(a)||Jc(a)))return!a.length;var c=ei(a);if(c==Je||c==Gr)return!a.size;if(vf(a))return!Tv(a).length;for(var f in a)if(On.call(a,f))return!1;return!0}function i3(a,c){return Ef(a,c)}function s3(a,c,f){f=typeof f=="function"?f:e;var E=f?f(a,c):e;return E===e?Ef(a,c,e,f):!!E}function $v(a){if(!sr(a))return!1;var c=hi(a);return c==Ue||c==ee||typeof a.message=="string"&&typeof a.name=="string"&&!bf(a)}function o3(a){return typeof a=="number"&&_w(a)}function ba(a){if(!Xn(a))return!1;var c=hi(a);return c==Xe||c==$t||c==ce||c==ud}function qL(a){return typeof a=="number"&&a==Lt(a)}function Iy(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=_n}function Xn(a){var c=typeof a;return a!=null&&(c=="object"||c=="function")}function sr(a){return a!=null&&typeof a=="object"}var KL=iw?Zi(iw):l2;function a3(a,c){return a===c||hv(a,c,Lv(c))}function u3(a,c,f){return f=typeof f=="function"?f:e,hv(a,c,Lv(c),f)}function c3(a){return GL(a)&&a!=+a}function l3(a){if(Y2(a))throw new _t(r);return xw(a)}function d3(a){return a===null}function p3(a){return a==null}function GL(a){return typeof a=="number"||sr(a)&&hi(a)==Ht}function bf(a){if(!sr(a)||hi(a)!=ki)return!1;var c=JT(a);if(c===null)return!0;var f=On.call(c,"constructor")&&c.constructor;return typeof f=="function"&&f instanceof f&&KT.call(f)==uQ}var qv=sw?Zi(sw):d2;function f3(a){return qL(a)&&a>=-_n&&a<=_n}var QL=ow?Zi(ow):p2;function vy(a){return typeof a=="string"||!St(a)&&sr(a)&&hi(a)==Wi}function ts(a){return typeof a=="symbol"||sr(a)&&hi(a)==cn}var gd=aw?Zi(aw):f2;function m3(a){return a===e}function h3(a){return sr(a)&&ei(a)==Mc}function T3(a){return sr(a)&&hi(a)==Ro}var y3=py(yv),N3=py(function(a,c){return a<=c});function YL(a){if(!a)return[];if(xi(a))return vy(a)?eo(a):Ci(a);if(df&&a[df])return HG(a[df]());var c=ei(a),f=c==Je?iv:c==Gr?jT:Id;return f(a)}function Oa(a){if(!a)return a===0?a:0;if(a=Ss(a),a===vn||a===-vn){var c=a<0?-1:1;return c*mi}return a===a?a:0}function Lt(a){var c=Oa(a),f=c%1;return c===c?f?c-f:c:0}function JL(a){return a?Kc(Lt(a),0,kn):0}function Ss(a){if(typeof a=="number")return a;if(ts(a))return Xr;if(Xn(a)){var c=typeof a.valueOf=="function"?a.valueOf():a;a=Xn(c)?c+"":c}if(typeof a!="string")return a===0?a:+a;a=fw(a);var f=ZK.test(a);return f||tG.test(a)?PG(a.slice(2),f?2:8):XK.test(a)?Xr:+a}function zL(a){return wo(a,Ui(a))}function E3(a){return a?Kc(Lt(a),-_n,_n):a===0?a:0}function yn(a){return a==null?"":es(a)}var g3=yd(function(a,c){if(vf(c)||xi(c)){wo(c,Ur(c),a);return}for(var f in c)On.call(c,f)&&Tf(a,f,c[f])}),HL=yd(function(a,c){wo(c,Ui(c),a)}),_y=yd(function(a,c,f,E){wo(c,Ui(c),a,E)}),I3=yd(function(a,c,f,E){wo(c,Ur(c),a,E)}),v3=va(lv);function _3(a,c){var f=Td(a);return c==null?f:Aw(f,c)}var b3=Bt(function(a,c){a=Ln(a);var f=-1,E=c.length,_=E>2?c[2]:e;for(_&&Ti(c[0],c[1],_)&&(E=1);++f1),L}),wo(a,Fv(a),f),E&&(f=_s(f,d|p|y,C2));for(var _=c.length;_--;)vv(f,c[_]);return f});function $3(a,c){return XL(a,gy(ct(c)))}var q3=va(function(a,c){return a==null?{}:T2(a,c)});function XL(a,c){if(a==null)return{};var f=Kn(Fv(a),function(E){return[E]});return c=ct(c),qw(a,f,function(E,_){return c(E,_[0])})}function K3(a,c,f){c=Zu(c,a);var E=-1,_=c.length;for(_||(_=1,a=e);++E<_;){var L=a==null?e:a[Lo(c[E])];L===e&&(E=_,L=f),a=ba(L)?L.call(a):L}return a}function G3(a,c,f){return a==null?a:gf(a,c,f)}function Q3(a,c,f,E){return E=typeof E=="function"?E:e,a==null?a:gf(a,c,f,E)}var ZL=dL(Ur),eP=dL(Ui);function Y3(a,c,f){var E=St(a),_=E||tc(a)||gd(a);if(c=ct(c,4),f==null){var L=a&&a.constructor;_?f=E?new L:[]:Xn(a)?f=ba(L)?Td(JT(a)):{}:f={}}return(_?gs:Fo)(a,function(M,q,X){return c(f,M,q,X)}),f}function J3(a,c){return a==null?!0:vv(a,c)}function z3(a,c,f){return a==null?a:Jw(a,c,Ov(f))}function H3(a,c,f,E){return E=typeof E=="function"?E:e,a==null?a:Jw(a,c,Ov(f),E)}function Id(a){return a==null?[]:rv(a,Ur(a))}function W3(a){return a==null?[]:rv(a,Ui(a))}function X3(a,c,f){return f===e&&(f=c,c=e),f!==e&&(f=Ss(f),f=f===f?f:0),c!==e&&(c=Ss(c),c=c===c?c:0),Kc(Ss(a),c,f)}function Z3(a,c,f){return c=Oa(c),f===e?(f=c,c=0):f=Oa(f),a=Ss(a),s2(a,c,f)}function ez(a,c,f){if(f&&typeof f!="boolean"&&Ti(a,c,f)&&(c=f=e),f===e&&(typeof c=="boolean"?(f=c,c=e):typeof a=="boolean"&&(f=a,a=e)),a===e&&c===e?(a=0,c=1):(a=Oa(a),c===e?(c=a,a=0):c=Oa(c)),a>c){var E=a;a=c,c=E}if(f||a%1||c%1){var _=bw();return Zr(a+_*(c-a+LG("1e-"+((_+"").length-1))),c)}return Ev(a,c)}var tz=Nd(function(a,c,f){return c=c.toLowerCase(),a+(f?tP(c):c)});function tP(a){return Qv(yn(a).toLowerCase())}function nP(a){return a=yn(a),a&&a.replace(rG,GG).replace(vG,"")}function nz(a,c,f){a=yn(a),c=es(c);var E=a.length;f=f===e?E:Kc(Lt(f),0,E);var _=f;return f-=c.length,f>=0&&a.slice(f,_)==c}function rz(a){return a=yn(a),a&&UK.test(a)?a.replace(PF,QG):a}function iz(a){return a=yn(a),a&&qK.test(a)?a.replace(jI,"\\$&"):a}var sz=Nd(function(a,c,f){return a+(f?"-":"")+c.toLowerCase()}),oz=Nd(function(a,c,f){return a+(f?" ":"")+c.toLowerCase()}),az=sL("toLowerCase");function uz(a,c,f){a=yn(a),c=Lt(c);var E=c?pd(a):0;if(!c||E>=c)return a;var _=(c-E)/2;return dy(XT(_),f)+a+dy(WT(_),f)}function cz(a,c,f){a=yn(a),c=Lt(c);var E=c?pd(a):0;return c&&E>>0,f?(a=yn(a),a&&(typeof c=="string"||c!=null&&!qv(c))&&(c=es(c),!c&&dd(a))?ec(eo(a),0,f):a.split(c,f)):[]}var Tz=Nd(function(a,c,f){return a+(f?" ":"")+Qv(c)});function yz(a,c,f){return a=yn(a),f=f==null?0:Kc(Lt(f),0,a.length),c=es(c),a.slice(f,f+c.length)==c}function Nz(a,c,f){var E=w.templateSettings;f&&Ti(a,c,f)&&(c=e),a=yn(a),c=_y({},c,E,pL);var _=_y({},c.imports,E.imports,pL),L=Ur(_),M=rv(_,L),q,X,ye=0,Ne=c.interpolate||xT,Ie="__p += '",we=sv((c.escape||xT).source+"|"+Ne.source+"|"+(Ne===kF?WK:xT).source+"|"+(c.evaluate||xT).source+"|$","g"),ze="//# sourceURL="+(On.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++DG+"]")+` `;a.replace(we,function(dt,qt,Wt,ns,yi,rs){return Wt||(Wt=ns),Ie+=a.slice(ye,rs).replace(iG,YG),qt&&(q=!0,Ie+=`' + @@ -671,10 +671,10 @@ __p += '`),Wt&&(Ie+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ie+`return __p -}`;var Ut=iP(function(){return dn(L,ze+"return "+Ie).apply(e,M)});if(Ut.source=Ie,$v(Ut))throw Ut;return Ut}function Ez(a){return yn(a).toLowerCase()}function gz(a){return yn(a).toUpperCase()}function Iz(a,c,f){if(a=yn(a),a&&(f||c===e))return fw(a);if(!a||!(c=es(c)))return a;var E=eo(a),_=eo(c),L=mw(E,_),M=hw(E,_)+1;return ec(E,L,M).join("")}function vz(a,c,f){if(a=yn(a),a&&(f||c===e))return a.slice(0,yw(a)+1);if(!a||!(c=es(c)))return a;var E=eo(a),_=hw(E,eo(c))+1;return ec(E,0,_).join("")}function _z(a,c,f){if(a=yn(a),a&&(f||c===e))return a.replace($I,"");if(!a||!(c=es(c)))return a;var E=eo(a),_=mw(E,eo(c));return ec(E,_).join("")}function bz(a,c){var f=Ct,E=B;if(Xn(c)){var _="separator"in c?c.separator:_;f="length"in c?Lt(c.length):f,E="omission"in c?es(c.omission):E}a=yn(a);var L=a.length;if(dd(a)){var M=eo(a);L=M.length}if(f>=L)return a;var q=f-pd(E);if(q<1)return E;var X=M?ec(M,0,q).join(""):a.slice(0,q);if(_===e)return X+E;if(M&&(q+=X.length-q),qv(_)){if(a.slice(q).search(_)){var ye,Ne=X;for(_.global||(_=sv(_.source,yn(CF.exec(_))+"g")),_.lastIndex=0;ye=_.exec(Ne);)var Ie=ye.index;X=X.slice(0,Ie===e?q:Ie)}}else if(a.indexOf(es(_),q)!=q){var we=X.lastIndexOf(_);we>-1&&(X=X.slice(0,we))}return X+E}function Oz(a){return a=yn(a),a&&xK.test(a)?a.replace(LF,eQ):a}var Sz=Nd(function(a,c,f){return a+(f?" ":"")+c.toUpperCase()}),Qv=sL("toUpperCase");function rP(a,c,f){return a=yn(a),c=f?e:c,c===e?zG(a)?rQ(a):VG(a):a.match(c)||[]}var iP=Bt(function(a,c){try{return Xi(a,e,c)}catch(f){return $v(f)?f:new _t(f)}}),Dz=va(function(a,c){return gs(c,function(f){f=Lo(f),ga(a,f,Vv(a[f],a))}),a});function Az(a){var c=a==null?0:a.length,f=ct();return a=c?Kn(a,function(E){if(typeof E[1]!="function")throw new Is(i);return[f(E[0]),E[1]]}):[],Bt(function(E){for(var _=-1;++__n)return[];var f=kn,E=Zr(a,kn);c=ct(c),a-=kn;for(var _=nv(E,c);++f0||c<0)?new Gt(f):(a<0?f=f.takeRight(-a):a&&(f=f.drop(a)),c!==e&&(c=Lt(c),f=c<0?f.dropRight(-c):f.take(c-a)),f)},Gt.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},Gt.prototype.toArray=function(){return this.take(kn)},Fo(Gt.prototype,function(a,c){var f=/^(?:filter|find|map|reject)|While$/.test(c),E=/^(?:head|last)$/.test(c),_=w[E?"take"+(c=="last"?"Right":""):c],L=E||/^find/.test(c);_&&(w.prototype[c]=function(){var M=this.__wrapped__,q=E?[1]:arguments,X=M instanceof Gt,ye=q[0],Ne=X||St(M),Ie=function(qt){var Wt=_.apply(w,Yu([qt],q));return E&&we?Wt[0]:Wt};Ne&&f&&typeof ye=="function"&&ye.length!=1&&(X=Ne=!1);var we=this.__chain__,ze=!!this.__actions__.length,lt=L&&!we,Ut=X&&!ze;if(!L&&Ne){M=Ut?M:new Gt(this);var dt=a.apply(M,q);return dt.__actions__.push({func:Ty,args:[Ie],thisArg:e}),new vs(dt,we)}return lt&&Ut?a.apply(this,q):(dt=this.thru(Ie),lt?E?dt.value()[0]:dt.value():dt)})}),gs(["pop","push","shift","sort","splice","unshift"],function(a){var c=$T[a],f=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",E=/^(?:pop|shift)$/.test(a);w.prototype[a]=function(){var _=arguments;if(E&&!this.__chain__){var L=this.value();return c.apply(St(L)?L:[],_)}return this[f](function(M){return c.apply(St(M)?M:[],_)})}}),Fo(Gt.prototype,function(a,c){var f=w[c];if(f){var E=f.name+"";On.call(hd,E)||(hd[E]=[]),hd[E].push({name:c,func:f})}}),hd[cy(e,x).name]=[{name:"wrapper",func:e}],Gt.prototype.clone=OQ,Gt.prototype.reverse=SQ,Gt.prototype.value=DQ,w.prototype.at=nJ,w.prototype.chain=rJ,w.prototype.commit=iJ,w.prototype.next=sJ,w.prototype.plant=aJ,w.prototype.reverse=uJ,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=cJ,w.prototype.first=w.prototype.head,df&&(w.prototype[df]=oJ),w},zu=iQ();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(xr._=zu,define(function(){return zu})):Vc?((Vc.exports=zu)._=zu,JI._=zu):xr._=zu}).call(Zp)});var Pq=j(nd=>{"use strict";m();T();h();Object.defineProperty(nd,"__esModule",{value:!0});nd.FederationFactory=void 0;nd.federateSubgraphs=Dde;nd.federateSubgraphsWithContracts=Ade;nd.federateSubgraphsContract=Rde;var ke=(Le(),Me(je)),kc=Qa(),Xs=$i(),Ce=To(),ef=wR(),Fe=bi(),_e=ps(),lI=rI(),fr=Oc(),bde=YR(),Ode=Ql(),wq=Gh(),Se=Jp(),Sde=HR(),Lq=Fq(),tf=cI(),dI=Al(),pI=class{constructor(t){A(this,"authorizationDataByParentTypeName");A(this,"concreteTypeNamesByAbstractTypeName");A(this,"clientDefinitions",[fr.DEPRECATED_DEFINITION]);A(this,"currentSubgraphName","");A(this,"subgraphNamesByNamedTypeNameByFieldCoordinates",new Map);A(this,"entityDataByTypeName");A(this,"entityInterfaceFederationDataByTypeName");A(this,"errors",[]);A(this,"fieldConfigurationByFieldPath",new Map);A(this,"inaccessiblePaths",new Set);A(this,"isMaxDepth",!1);A(this,"internalGraph");A(this,"internalSubgraphBySubgraphName");A(this,"invalidOrScopesHostPaths",new Set);A(this,"isVersionTwo",!1);A(this,"namedInputValueTypeNames",new Set);A(this,"namedOutputTypeNames",new Set);A(this,"parentDefinitionDataByTypeName",new Map);A(this,"parentTagDataByTypeName",new Map);A(this,"pathsByNamedTypeName",new Map);A(this,"persistedDirectiveDefinitionByDirectiveName",new Map([[Fe.AUTHENTICATED,fr.AUTHENTICATED_DEFINITION],[Fe.DEPRECATED,fr.DEPRECATED_DEFINITION],[Fe.INACCESSIBLE,fr.INACCESSIBLE_DEFINITION],[Fe.REQUIRES_SCOPES,fr.REQUIRES_SCOPES_DEFINITION],[Fe.TAG,fr.TAG_DEFINITION]]));A(this,"persistedDirectiveDefinitions",new Set([Fe.AUTHENTICATED,Fe.DEPRECATED,Fe.INACCESSIBLE,Fe.TAG,Fe.REQUIRES_SCOPES]));A(this,"potentialPersistedDirectiveDefinitionDataByDirectiveName",new Map);A(this,"routerDefinitions",[fr.DEPRECATED_DEFINITION,fr.TAG_DEFINITION]);A(this,"shareableErrorTypeNames",new Map);A(this,"subscriptionFilterDataByFieldPath",new Map);A(this,"tagNamesByPath",new Map);A(this,"warnings");this.authorizationDataByParentTypeName=t.authorizationDataByParentTypeName,this.concreteTypeNamesByAbstractTypeName=t.concreteTypeNamesByAbstractTypeName,this.entityDataByTypeName=t.entityDataByTypeName,this.entityInterfaceFederationDataByTypeName=t.entityInterfaceFederationDataByTypeName,this.internalSubgraphBySubgraphName=t.internalSubgraphBySubgraphName,this.internalGraph=t.internalGraph,this.warnings=t.warnings}getValidImplementedInterfaces(t){var o;let n=[];if(t.implementedInterfaceTypeNames.size<1)return n;let r=(0,Se.isNodeDataInaccessible)(t),i=new Map,s=new Map;for(let u of t.implementedInterfaceTypeNames){n.push((0,Xs.stringToNamedTypeNode)(u));let l=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,u,Fe.PARENT_DEFINITION_DATA);if(l.kind!==ke.Kind.INTERFACE_TYPE_DEFINITION){s.set(l.name,(0,_e.kindToTypeString)(l.kind));continue}let d={invalidFieldImplementations:new Map,unimplementedFields:[]},p=!1;for(let[y,N]of l.fieldDataByFieldName){let I=!1,O=t.fieldDataByFieldName.get(y);if(!O){p=!0,d.unimplementedFields.push(y);continue}let x={invalidAdditionalArguments:new Set,invalidImplementedArguments:[],isInaccessible:!1,originalResponseType:(0,lI.printTypeNode)(N.node.type),unimplementedArguments:new Set};(0,Se.isTypeValidImplementation)(N.node.type,O.node.type,this.concreteTypeNamesByAbstractTypeName)||(p=!0,I=!0,x.implementedResponseType=(0,lI.printTypeNode)(O.node.type));let V=new Set;for(let[K,re]of N.argumentDataByArgumentName){let se=re.node;V.add(K);let fe=(o=O.argumentDataByArgumentName.get(K))==null?void 0:o.node;if(!fe){p=!0,I=!0,x.unimplementedArguments.add(K);continue}let he=(0,lI.printTypeNode)(fe.type),xe=(0,lI.printTypeNode)(se.type);xe!==he&&(p=!0,I=!0,x.invalidImplementedArguments.push({actualType:he,argumentName:K,expectedType:xe}))}for(let[K,re]of O.argumentDataByArgumentName){let se=re.node;V.has(K)||se.type.kind===ke.Kind.NON_NULL_TYPE&&(p=!0,I=!0,x.invalidAdditionalArguments.add(K))}!r&&O.isInaccessible&&!N.isInaccessible&&(p=!0,I=!0,x.isInaccessible=!0),I&&d.invalidFieldImplementations.set(y,x)}p&&i.set(u,d)}return s.size>0&&this.errors.push((0,Ce.invalidImplementedTypeError)(t.name,s)),i.size&&this.errors.push((0,Ce.invalidInterfaceImplementationError)(t.node.name.value,(0,_e.kindToTypeString)(t.kind),i)),n}addValidPrimaryKeyTargetsToEntityData(t){var p;let n=this.entityDataByTypeName.get(t);if(!n)return;let r=(0,_e.getOrThrowError)(this.internalSubgraphBySubgraphName,this.currentSubgraphName,"internalSubgraphBySubgraphName"),i=r.parentDefinitionDataByTypeName,s=i.get(n.typeName);if(!s||s.kind!==ke.Kind.OBJECT_TYPE_DEFINITION)throw(0,Ce.incompatibleParentKindFatalError)(n.typeName,ke.Kind.OBJECT_TYPE_DEFINITION,(s==null?void 0:s.kind)||ke.Kind.NULL);let o=(0,_e.getOrThrowError)(r.configurationDataByTypeName,n.typeName,"internalSubgraph.configurationDataByParentTypeName"),u=[],l=this.internalGraph.nodeByNodeName.get(`${this.currentSubgraphName}.${n.typeName}`);(0,ef.validateImplicitFieldSets)({conditionalFieldDataByCoordinates:r.conditionalFieldDataByCoordinates,configurationData:o,fieldSets:n.keyFieldSets,graphNode:l,implicitKeys:u,objectData:s,parentDefinitionDataByTypeName:i});for(let[y,N]of this.entityInterfaceFederationDataByTypeName){if(!((p=N.concreteTypeNames)!=null&&p.has(n.typeName)))continue;let I=this.entityDataByTypeName.get(y);I&&(0,ef.validateImplicitFieldSets)({conditionalFieldDataByCoordinates:r.conditionalFieldDataByCoordinates,configurationData:o,fieldSets:I.keyFieldSets,implicitKeys:u,objectData:s,parentDefinitionDataByTypeName:i,graphNode:l})}if(u.length<1)return;if(!o.keys||o.keys.length<1){o.isRootNode=!0,o.keys=u;return}let d=new Set(o.keys.map(y=>y.selectionSet));for(let y of u)d.has(y.selectionSet)||(o.keys.push(y),d.add(y.selectionSet))}addValidPrimaryKeyTargetsFromInterfaceObject(t,n,r,i){let s=t.parentDefinitionDataByTypeName,o=s.get(n);if(!o||o.kind!==ke.Kind.INTERFACE_TYPE_DEFINITION)throw(0,Ce.incompatibleParentKindFatalError)(n,ke.Kind.INTERFACE_TYPE_DEFINITION,(o==null?void 0:o.kind)||ke.Kind.NULL);let u=(0,_e.getOrThrowError)(t.configurationDataByTypeName,r.typeName,"internalSubgraph.configurationDataByParentTypeName"),l=[];if((0,ef.validateImplicitFieldSets)({conditionalFieldDataByCoordinates:t.conditionalFieldDataByCoordinates,configurationData:u,fieldSets:r.keyFieldSets,implicitKeys:l,objectData:o,parentDefinitionDataByTypeName:s,graphNode:i}),l.length<1)return;if(!u.keys||u.keys.length<1){u.isRootNode=!0,u.keys=l;return}let d=new Set(u.keys.map(p=>p.selectionSet));for(let p of l)d.has(p.selectionSet)||(u.keys.push(p),d.add(p.selectionSet))}getEnumValueMergeMethod(t){return this.namedInputValueTypeNames.has(t)?this.namedOutputTypeNames.has(t)?Se.MergeMethod.CONSISTENT:Se.MergeMethod.INTERSECTION:Se.MergeMethod.UNION}generateTagData(){for(let[t,n]of this.tagNamesByPath){let r=t.split(".");if(r.length<1)continue;let i=(0,_e.getValueOrDefault)(this.parentTagDataByTypeName,r[0],()=>(0,ef.newParentTagData)(r[0]));switch(r.length){case 1:for(let l of n)i.tagNames.add(l);break;case 2:let s=(0,_e.getValueOrDefault)(i.childTagDataByChildName,r[1],()=>(0,ef.newChildTagData)(r[1]));for(let l of n)s.tagNames.add(l);break;case 3:let o=(0,_e.getValueOrDefault)(i.childTagDataByChildName,r[1],()=>(0,ef.newChildTagData)(r[1])),u=(0,_e.getValueOrDefault)(o.tagNamesByArgumentName,r[2],()=>new Set);for(let l of n)u.add(l);break;default:break}}}upsertEnumValueData(t,n,r){let i=t.get(n.name),s=i||n,o=`${n.parentTypeName}.${n.name}`;(0,Se.extractPersistedDirectives)(s.persistedDirectivesData,n.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName);let u=(0,Se.isNodeDataInaccessible)(n);if((r||u)&&this.inaccessiblePaths.add(o),this.recordTagNamesByPath(s,o),!i){n.node={directives:[],kind:n.node.kind,name:(0,Xs.stringToNameNode)(n.name)},t.set(n.name,n);return}i.appearances+=1,(0,Se.setLongestDescription)(i,n)}upsertInputValueData(t,n,r){let i=t.get(n.name),s=i||n;if((0,Se.extractPersistedDirectives)(s.persistedDirectivesData,n.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(s,r||s.renamedPath),!i){n.node={directives:[],kind:n.node.kind,name:(0,Xs.stringToNameNode)(n.name),type:n.type},t.set(n.name,n);return}(0,Se.setLongestDescription)(i,n),(0,_e.addIterableValuesToSet)(n.requiredSubgraphNames,i.requiredSubgraphNames),(0,_e.addIterableValuesToSet)(n.subgraphNames,i.subgraphNames);let{typeErrors:o,typeNode:u}=(0,tf.getMostRestrictiveMergedTypeNode)(i.type,n.type,i.originalPath,this.errors);if(u)i.type=u;else{if(!o||o.length<2)throw(0,Ce.fieldTypeMergeFatalError)(i.name);i.isArgument?this.errors.push((0,Ce.incompatibleArgumentTypesError)(i.name,i.renamedPath,o[0],o[1])):this.errors.push((0,Ce.incompatibleChildTypesError)(i.renamedPath,o[0],o[1]))}(0,Se.compareAndValidateInputValueDefaultValues)(i,n,this.errors)}handleArgumentInaccessibility(t,n,r,i){if(t){this.inaccessiblePaths.add(r);return}(0,Se.isNodeDataInaccessible)(n)&&((0,Se.isTypeRequired)(n.type)?this.errors.push((0,Ce.inaccessibleRequiredArgumentError)(n.name,r,i)):this.inaccessiblePaths.add(r))}handleSubscriptionFilterDirective(t,n,r){let i=t.directivesByDirectiveName.get(Fe.SUBSCRIPTION_FILTER);if(i){let s=(0,_e.getSingleSetEntry)(t.subgraphNames);if(s===void 0){this.errors.push((0,Ce.unknownFieldSubgraphNameError)(n));return}this.subscriptionFilterDataByFieldPath.set(n,{directive:i[0],fieldData:r||t,directiveSubgraphName:s})}}federateOutputType({current:t,other:n,hostPath:r,mostRestrictive:i}){n=(0,kc.getMutableTypeNode)(n,r,this.errors);let s={kind:t.kind},o=tf.DivergentType.NONE,u=s;for(let l=0;lnew Set))}upsertFieldData(t,n,r){let i=`${n.renamedParentTypeName}.${n.name}`;(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,n.namedTypeName,()=>new Set).add(i),this.namedOutputTypeNames.add(n.namedTypeName);let s=t.get(n.name),o=s||n;this.handleSubscriptionFilterDirective(n,i,o),(0,Se.extractPersistedDirectives)(o.persistedDirectivesData,n.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName);let u=(0,Se.isNodeDataInaccessible)(n);if((r||u)&&this.inaccessiblePaths.add(i),this.recordTagNamesByPath(o,i),!s){t.set(n.name,n),n.node={arguments:[],directives:[],kind:n.node.kind,name:(0,Xs.stringToNameNode)(n.name),type:n.type};for(let[d,p]of n.argumentDataByArgumentName){p.node={directives:[],kind:p.node.kind,name:(0,Xs.stringToNameNode)(p.name),type:p.type};let y=(0,kc.getTypeNodeNamedTypeName)(p.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,y,()=>new Set).add(p.renamedPath),this.namedInputValueTypeNames.add(y),(0,Se.extractPersistedDirectives)(p.persistedDirectivesData,p.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.handleArgumentInaccessibility(r||u,p,p.renamedPath,i),this.recordTagNamesByPath(p,`${i}.${d}`)}return}let l=this.federateOutputType({current:s.type,other:n.type,hostPath:i,mostRestrictive:!1});if(l.success)if(s.type=l.typeNode,s.namedTypeName!==n.namedTypeName){let d=(0,_e.getValueOrDefault)(this.subgraphNamesByNamedTypeNameByFieldCoordinates,`${s.renamedParentTypeName}.${s.name}`,()=>new Map),p=(0,_e.getValueOrDefault)(d,s.namedTypeName,()=>new Set);if(p.size<1)for(let y of s.subgraphNames)n.subgraphNames.has(y)||p.add(y);(0,_e.addIterableValuesToSet)(n.subgraphNames,(0,_e.getValueOrDefault)(d,n.namedTypeName,()=>new Set))}else this.addSubgraphNameToExistingFieldNamedTypeDisparity(n);for(let[d,p]of n.argumentDataByArgumentName){let y=(0,kc.getTypeNodeNamedTypeName)(p.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,y,()=>new Set).add(p.renamedPath),this.namedInputValueTypeNames.add(y),this.handleArgumentInaccessibility(r||u,p,p.renamedPath,i),this.upsertInputValueData(s.argumentDataByArgumentName,p,`${i}.${d}`)}(0,Se.setLongestDescription)(s,n),s.isInaccessible||(s.isInaccessible=n.isInaccessible),(0,_e.addMapEntries)(n.isExternalBySubgraphName,s.isExternalBySubgraphName),(0,_e.addMapEntries)(n.isShareableBySubgraphName,s.isShareableBySubgraphName),(0,_e.addIterableValuesToSet)(n.subgraphNames,s.subgraphNames)}getClientSchemaUnionMembers(t){let n=[];for(let[r,i]of t.memberByMemberTypeName)this.inaccessiblePaths.has(r)||n.push(i);return n}recordTagNamesByPath(t,n){let r=n||t.name;if(t.persistedDirectivesData.tags.size>0){let i=(0,_e.getValueOrDefault)(this.tagNamesByPath,r,()=>new Set);for(let s of t.persistedDirectivesData.tags.keys())i.add(s)}}upsertParentDefinitionData(t,n){let r=this.entityInterfaceFederationDataByTypeName.get(t.name),i=this.parentDefinitionDataByTypeName.get(t.name),s=i||t;(0,Se.extractPersistedDirectives)(s.persistedDirectivesData,t.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(s);let o=(0,Se.isNodeDataInaccessible)(s);if(o&&this.inaccessiblePaths.add(t.name),r&&r.interfaceObjectSubgraphs.has(n)&&(t.kind=ke.Kind.INTERFACE_TYPE_DEFINITION),!i)switch(t.node={kind:t.kind,name:(0,Xs.stringToNameNode)(t.name)},this.parentDefinitionDataByTypeName.set(t.name,t),t.kind){case ke.Kind.ENUM_TYPE_DEFINITION:for(let[u,l]of t.enumValueDataByValueName){let d=`${t.name}.${u}`;l.node={directives:[],kind:l.node.kind,name:(0,Xs.stringToNameNode)(l.name)},(0,Se.extractPersistedDirectives)(l.persistedDirectivesData,l.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(l,d),(0,Se.isNodeDataInaccessible)(l)&&this.inaccessiblePaths.add(d)}return;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:for(let[u,l]of t.inputValueDataByValueName){l.node={directives:[],kind:l.node.kind,name:(0,Xs.stringToNameNode)(l.name),type:l.type};let d=(0,kc.getTypeNodeNamedTypeName)(l.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,d,()=>new Set).add(l.renamedPath),this.namedInputValueTypeNames.add(d),(0,Se.extractPersistedDirectives)(l.persistedDirectivesData,l.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(l,`${t.name}.${u}`),(o||(0,Se.isNodeDataInaccessible)(l))&&this.inaccessiblePaths.add(l.renamedPath)}return;case ke.Kind.INTERFACE_TYPE_DEFINITION:case ke.Kind.OBJECT_TYPE_DEFINITION:(0,Se.isParentDataRootType)(t)&&(t.extensionType=wq.ExtensionType.NONE);for(let u of t.fieldDataByFieldName.values()){u.node={arguments:[],directives:[],kind:u.node.kind,name:(0,Xs.stringToNameNode)(u.name),type:u.type};let l=`${u.renamedParentTypeName}.${u.name}`;this.handleSubscriptionFilterDirective(u,l),(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,u.namedTypeName,()=>new Set).add(l),this.namedOutputTypeNames.add(u.namedTypeName),(0,Se.extractPersistedDirectives)(u.persistedDirectivesData,u.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(u,l);let d=(0,Se.isNodeDataInaccessible)(u);(o||d)&&this.inaccessiblePaths.add(l);for(let[p,y]of u.argumentDataByArgumentName){y.node={directives:[],kind:y.node.kind,name:(0,Xs.stringToNameNode)(y.name),type:y.type};let N=(0,kc.getTypeNodeNamedTypeName)(y.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,N,()=>new Set).add(y.renamedPath),this.namedInputValueTypeNames.add(N),(0,Se.extractPersistedDirectives)(y.persistedDirectivesData,y.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(y,`${l}.${p}`),this.handleArgumentInaccessibility(o||d,y,y.renamedPath,l)}}return;default:return}if(i.kind!==t.kind&&(!r||!r.interfaceObjectSubgraphs.has(n)||i.kind!==ke.Kind.INTERFACE_TYPE_DEFINITION||t.kind!==ke.Kind.OBJECT_TYPE_DEFINITION)){this.errors.push((0,Ce.incompatibleParentKindMergeError)(i.name,(0,_e.kindToTypeString)(i.kind),(0,_e.kindToTypeString)(t.kind)));return}switch((0,Se.setLongestDescription)(i,t),(0,Se.setParentDataExtensionType)(i,t),i.kind){case ke.Kind.ENUM_TYPE_DEFINITION:i.appearances+=1;for(let l of t.enumValueDataByValueName.values())this.upsertEnumValueData(i.enumValueDataByValueName,l,o);return;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:o&&!i.isInaccessible&&this.propagateInaccessibilityToExistingChildren(i),(0,_e.addIterableValuesToSet)(t.subgraphNames,i.subgraphNames);for(let[l,d]of t.inputValueDataByValueName){let p=`${t.name}.${l}`,y=(0,kc.getTypeNodeNamedTypeName)(d.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,y,()=>new Set).add(p),this.namedInputValueTypeNames.add(y),this.upsertInputValueData(i.inputValueDataByValueName,d),this.recordTagNamesByPath(d,p),(o||(0,Se.isNodeDataInaccessible)(d))&&this.inaccessiblePaths.add(p)}return;case ke.Kind.INTERFACE_TYPE_DEFINITION:case ke.Kind.OBJECT_TYPE_DEFINITION:o&&!i.isInaccessible&&this.propagateInaccessibilityToExistingChildren(i);let u=t;(0,_e.addIterableValuesToSet)(u.implementedInterfaceTypeNames,i.implementedInterfaceTypeNames),(0,_e.addIterableValuesToSet)(u.subgraphNames,i.subgraphNames);for(let l of u.fieldDataByFieldName.values())this.upsertFieldData(i.fieldDataByFieldName,l,o||i.isInaccessible);return;case ke.Kind.UNION_TYPE_DEFINITION:(0,_e.addMapEntries)(t.memberByMemberTypeName,i.memberByMemberTypeName);return;default:return}}propagateInaccessibilityToExistingChildren(t){switch(t.isInaccessible=!0,t.kind){case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:for(let n of t.inputValueDataByValueName.keys())this.inaccessiblePaths.add(`${t.name}.${n}`);break;default:for(let[n,r]of t.fieldDataByFieldName){let i=`${r.renamedParentTypeName}.${n}`;this.inaccessiblePaths.add(i);for(let s of r.argumentDataByArgumentName.values())this.inaccessiblePaths.add(s.renamedPath)}}}upsertPersistedDirectiveDefinitionData(t,n){let r=t.name,i=this.potentialPersistedDirectiveDefinitionDataByDirectiveName.get(r);if(!i){if(n>1)return;let s=new Map;for(let o of t.argumentDataByArgumentName.values())this.namedInputValueTypeNames.add((0,kc.getTypeNodeNamedTypeName)(o.type)),this.upsertInputValueData(s,o);this.potentialPersistedDirectiveDefinitionDataByDirectiveName.set(r,{argumentDataByArgumentName:s,executableLocations:new Set(t.executableLocations),name:r,repeatable:t.repeatable,subgraphNames:new Set(t.subgraphNames),description:t.description});return}if(i.subgraphNames.size+1!==n){this.potentialPersistedDirectiveDefinitionDataByDirectiveName.delete(r);return}if((0,Se.setMutualExecutableLocations)(i,t.executableLocations),i.executableLocations.size<1){this.potentialPersistedDirectiveDefinitionDataByDirectiveName.delete(r);return}for(let s of t.argumentDataByArgumentName.values())this.namedInputValueTypeNames.add((0,kc.getTypeNodeNamedTypeName)(s.type)),this.upsertInputValueData(i.argumentDataByArgumentName,s);(0,Se.setLongestDescription)(i,t),i.repeatable&&(i.repeatable=t.repeatable),(0,_e.addIterableValuesToSet)(t.subgraphNames,i.subgraphNames)}shouldUpdateFederatedFieldAbstractNamedType(t,n){if(!t)return!1;let r=this.concreteTypeNamesByAbstractTypeName.get(t);if(!r||r.size<1)return!1;for(let i of n)if(!r.has(i))return!1;return!0}updateTypeNodeNamedType(t,n){let r=t;for(let i=0;i1){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}break}case ke.Kind.UNION_TYPE_DEFINITION:{if(l){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}l=p;break}default:{this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));break}}}if(o.size<0&&!l){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}let d=l;if(o.size>0){if(l){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}for(let p of o.keys()){d=p;for(let[y,N]of o)if(p!==y&&!N.implementedInterfaceTypeNames.has(p)){d="";break}if(d)break}}if(!this.shouldUpdateFederatedFieldAbstractNamedType(d,u)){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}s.namedTypeName=d,this.updateTypeNodeNamedType(s.type,d)}}federateInternalSubgraphData(){let t=0,n=!1;for(let r of this.internalSubgraphBySubgraphName.values()){t+=1,this.currentSubgraphName=r.name,this.isVersionTwo||(this.isVersionTwo=r.isVersionTwo),(0,Sde.renameRootTypes)(this,r);for(let i of r.parentDefinitionDataByTypeName.values())this.upsertParentDefinitionData(i,r.name);if(!n){if(!r.persistedDirectiveDefinitionDataByDirectiveName.size){n=!0;continue}for(let i of r.persistedDirectiveDefinitionDataByDirectiveName.values())this.upsertPersistedDirectiveDefinitionData(i,t);this.potentialPersistedDirectiveDefinitionDataByDirectiveName.size<1&&(n=!0)}}this.handleDisparateFieldNamedTypes()}handleInterfaceObjectForInternalGraph({entityData:t,internalSubgraph:n,interfaceObjectData:r,interfaceObjectNode:i,resolvableKeyFieldSets:s,subgraphName:o}){let u=this.internalGraph.addOrUpdateNode(t.typeName),l=this.internalGraph.addEntityDataNode(t.typeName);for(let p of i.satisfiedFieldSets)u.satisfiedFieldSets.add(p),s.has(p)&&l.addTargetSubgraphByFieldSet(p,o);let d=r.fieldDatasBySubgraphName.get(o);for(let{name:p,namedTypeName:y}of d||[])this.internalGraph.addEdge(u,this.internalGraph.addOrUpdateNode(y),p);this.internalGraph.addEdge(i,u,t.typeName,!0),this.addValidPrimaryKeyTargetsFromInterfaceObject(n,i.typeName,t,u)}handleEntityInterfaces(){for(let[t,n]of this.entityInterfaceFederationDataByTypeName){(0,_e.subtractSourceSetFromTargetSet)(n.interfaceFieldNames,n.interfaceObjectFieldNames);let r=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,t,Fe.PARENT_DEFINITION_DATA);if(r.kind===ke.Kind.INTERFACE_TYPE_DEFINITION)for(let i of n.interfaceObjectSubgraphs){let s=(0,_e.getOrThrowError)(this.internalSubgraphBySubgraphName,i,"internalSubgraphBySubgraphName"),o=s.configurationDataByTypeName,u=this.concreteTypeNamesByAbstractTypeName.get(t);if(!u)continue;let l=(0,_e.getOrThrowError)(o,t,"configurationDataMap"),d=l.keys;if(!d)continue;l.entityInterfaceConcreteTypeNames=n.concreteTypeNames;let p=l.fieldNames,y=this.authorizationDataByParentTypeName.get(n.typeName);this.internalGraph.setSubgraphName(i);let N=this.internalGraph.addOrUpdateNode(t,{isAbstract:!0});for(let I of u){if(o.has(I))continue;if(y){let re=(0,_e.getValueOrDefault)(this.authorizationDataByParentTypeName,I,()=>(0,_e.newAuthorizationData)(I));for(let se of y.fieldAuthorizationDataByFieldName.values())(0,_e.upsertFieldAuthorizationData)(re.fieldAuthorizationDataByFieldName,se)||this.invalidOrScopesHostPaths.add(`${I}.${se.fieldName}`)}let O=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,I,Fe.PARENT_DEFINITION_DATA);if(O.kind!==ke.Kind.OBJECT_TYPE_DEFINITION)continue;let x=(0,_e.getOrThrowError)(this.entityDataByTypeName,I,"entityDataByTypeName");x.subgraphNames.add(i);let V={fieldNames:p,isRootNode:!0,keys:d,typeName:I},K=new Set;for(let re of d.filter(se=>!se.disableEntityResolver))K.add(re.selectionSet);for(let re of n.interfaceObjectFieldNames){if(O.fieldDataByFieldName.get(re))continue;let fe=(0,_e.getOrThrowError)(r.fieldDataByFieldName,re,`${t}.fieldDataByFieldName`);O.fieldDataByFieldName.set(re,k({},fe))}o.set(I,V),this.handleInterfaceObjectForInternalGraph({internalSubgraph:s,subgraphName:i,interfaceObjectData:n,interfaceObjectNode:N,resolvableKeyFieldSets:K,entityData:x})}}}}fieldDataToGraphFieldData(t){var n;return{name:t.name,namedTypeName:t.namedTypeName,isLeaf:(0,_e.isNodeLeaf)((n=this.parentDefinitionDataByTypeName.get(t.namedTypeName))==null?void 0:n.kind),subgraphNames:t.subgraphNames}}pushParentDefinitionDataToDocumentDefinitions(t){for(let[n,r]of this.parentDefinitionDataByTypeName)switch(r.extensionType!==wq.ExtensionType.NONE&&this.errors.push((0,Ce.noBaseDefinitionForExtensionError)((0,_e.kindToTypeString)(r.kind),n)),r.kind){case ke.Kind.ENUM_TYPE_DEFINITION:let i=[],s=[],o=this.getEnumValueMergeMethod(n);for(let K of r.enumValueDataByValueName.values()){let re=(0,Se.getNodeForRouterSchemaByData)(K,this.persistedDirectiveDefinitionByDirectiveName,this.errors),se=(0,Se.isNodeDataInaccessible)(K),fe=G(k({},K.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(K)});switch(o){case Se.MergeMethod.CONSISTENT:!se&&r.appearances>K.appearances&&this.errors.push((0,Ce.incompatibleSharedEnumError)(n)),i.push(re),se||s.push(fe);break;case Se.MergeMethod.INTERSECTION:r.appearances===K.appearances&&(i.push(re),se||s.push(fe));break;default:i.push(re),se||s.push(fe);break}}if(r.node.values=i,this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}if(s.length<1){this.errors.push((0,Ce.allChildDefinitionsAreInaccessibleError)((0,_e.kindToTypeString)(r.kind),n,Fe.ENUM_VALUE));break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r),values:s}));break;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:let u=[],l=[],d=[];for(let[K,re]of r.inputValueDataByValueName)if(r.subgraphNames.size===re.subgraphNames.size){if(l.push((0,Se.getNodeWithPersistedDirectivesByInputValueData)(re,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(re))continue;d.push(G(k({},re.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(re)}))}else(0,Se.isTypeRequired)(re.type)&&u.push({inputValueName:K,missingSubgraphs:(0,_e.getEntriesNotInHashSet)(r.subgraphNames,re.subgraphNames),requiredSubgraphs:[...re.requiredSubgraphNames]});if(u.length>0){this.errors.push((0,Ce.invalidRequiredInputValueError)(Fe.INPUT_OBJECT,n,u,!1));break}if(r.node.fields=l,this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r);break}if(d.length<1){this.errors.push((0,Ce.allChildDefinitionsAreInaccessibleError)((0,_e.kindToTypeString)(r.kind),n,"input field"));break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r),fields:d}));break;case ke.Kind.INTERFACE_TYPE_DEFINITION:case ke.Kind.OBJECT_TYPE_DEFINITION:let p=[],y=[],N=new Map,I=(0,Se.newInvalidFieldNames)(),O=r.kind===ke.Kind.OBJECT_TYPE_DEFINITION;for(let[K,re]of r.fieldDataByFieldName){(0,Se.pushAuthorizationDirectives)(re,this.authorizationDataByParentTypeName.get(n));let se=(0,Se.getValidFieldArgumentNodes)(re,this.persistedDirectiveDefinitionByDirectiveName,this.fieldConfigurationByFieldPath,this.errors);O&&(0,Se.validateExternalAndShareable)(re,I),p.push((0,Se.getNodeWithPersistedDirectivesByFieldData)(re,this.persistedDirectiveDefinitionByDirectiveName,se,this.errors)),!(0,Se.isNodeDataInaccessible)(re)&&(y.push((0,Se.getClientSchemaFieldNodeByFieldData)(re)),N.set(K,this.fieldDataToGraphFieldData(re)))}if(O&&(I.byShareable.size>0&&this.errors.push((0,Ce.invalidFieldShareabilityError)(r,I.byShareable)),I.subgraphNamesByExternalFieldName.size>0&&this.errors.push((0,Ce.allExternalFieldInstancesError)(n,I.subgraphNamesByExternalFieldName))),r.node.fields=p,this.internalGraph.initializeNode(n,N),r.implementedInterfaceTypeNames.size>0){t.push({data:r,clientSchemaFieldNodes:y});break}this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors));let x=(0,Ode.isNodeQuery)(n);if((0,Se.isNodeDataInaccessible)(r)){if(x){this.errors.push(Ce.inaccessibleQueryRootTypeError);break}this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}if(y.length<1){let K=x?Ce.noQueryRootTypeError:(0,Ce.allChildDefinitionsAreInaccessibleError)((0,_e.kindToTypeString)(r.kind),n,Fe.FIELD);this.errors.push(K);break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r),fields:y}));break;case ke.Kind.SCALAR_TYPE_DEFINITION:if(fr.BASE_SCALARS.has(n))break;if(this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r)}));break;case ke.Kind.UNION_TYPE_DEFINITION:if(r.node.types=(0,_e.mapToArrayOfValues)(r.memberByMemberTypeName),this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}let V=this.getClientSchemaUnionMembers(r);if(V.length<1){this.errors.push((0,Ce.allChildDefinitionsAreInaccessibleError)(Fe.UNION,n,"union member type"));break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r),types:V}));break}}federateSubgraphData(){this.federateInternalSubgraphData(),this.handleEntityInterfaces(),this.generateTagData(),this.pushVersionTwoDirectiveDefinitionsToDocumentDefinitions()}validateInterfaceImplementationsAndPushToDocumentDefinitions(t){for(let{data:n,clientSchemaFieldNodes:r}of t){if(n.node.interfaces=this.getValidImplementedInterfaces(n),this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(n,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(n)){this.validateReferencesOfInaccessibleType(n),this.internalGraph.setNodeInaccessible(n.name);continue}let i=[];for(let s of n.implementedInterfaceTypeNames)this.inaccessiblePaths.has(s)||i.push((0,Xs.stringToNamedTypeNode)(s));this.clientDefinitions.push(G(k({},n.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(n),fields:r,interfaces:i}))}}pushVersionTwoDirectiveDefinitionsToDocumentDefinitions(){this.isVersionTwo&&(this.routerDefinitions=[fr.AUTHENTICATED_DEFINITION,fr.DEPRECATED_DEFINITION,fr.INACCESSIBLE_DEFINITION,fr.REQUIRES_SCOPES_DEFINITION,fr.TAG_DEFINITION,fr.SCOPE_SCALAR_DEFINITION],this.clientDefinitions=[fr.AUTHENTICATED_DEFINITION,fr.DEPRECATED_DEFINITION,fr.REQUIRES_SCOPES_DEFINITION,fr.SCOPE_SCALAR_DEFINITION])}validatePathSegmentInaccessibility(t){if(!t)return!1;let r=t.split(Fe.LEFT_PARENTHESIS)[0].split(Fe.PERIOD),i=r[0];for(let s=0;s0&&this.errors.push((0,Ce.invalidReferencesOfInaccessibleTypeError)((0,_e.kindToTypeString)(t.kind),t.name,r))}validateQueryRootType(){let t=this.parentDefinitionDataByTypeName.get(Fe.QUERY);if(!t||t.kind!==ke.Kind.OBJECT_TYPE_DEFINITION||t.fieldDataByFieldName.size<1){this.errors.push(Ce.noQueryRootTypeError);return}for(let n of t.fieldDataByFieldName.values())if(!(0,Se.isNodeDataInaccessible)(n))return;this.errors.push(Ce.noQueryRootTypeError)}validateSubscriptionFieldConditionFieldPath(t,n,r,i,s){let o=t.split(Fe.PERIOD);if(o.length<1)return s.push((0,Ce.invalidSubscriptionFieldConditionFieldPathErrorMessage)(r,t)),[];let u=n;if(this.inaccessiblePaths.has(u.renamedTypeName))return s.push((0,Ce.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,o[0],u.renamedTypeName)),[];let l="";for(let d=0;d0?`.${p}`:p,u.kind!==ke.Kind.OBJECT_TYPE_DEFINITION)return s.push((0,Ce.invalidSubscriptionFieldConditionFieldPathParentErrorMessage)(r,t,l)),[];let y=u.fieldDataByFieldName.get(p);if(!y)return s.push((0,Ce.undefinedSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,p,u.renamedTypeName)),[];let N=`${u.renamedTypeName}.${p}`;if(!y.subgraphNames.has(i))return s.push((0,Ce.invalidSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,N,i)),[];if(this.inaccessiblePaths.has(N))return s.push((0,Ce.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,N)),[];if(fr.BASE_SCALARS.has(y.namedTypeName)){u={kind:ke.Kind.SCALAR_TYPE_DEFINITION,name:y.namedTypeName};continue}u=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,y.namedTypeName,Fe.PARENT_DEFINITION_DATA)}return(0,Se.isLeafKind)(u.kind)?o:(s.push((0,Ce.nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage)(r,t,o[o.length-1],(0,_e.kindToTypeString)(u.kind),u.name)),[])}validateSubscriptionFieldCondition(t,n,r,i,s,o,u){if(i>dI.MAX_SUBSCRIPTION_FILTER_DEPTH||this.isMaxDepth)return u.push((0,Ce.subscriptionFilterConditionDepthExceededErrorMessage)(s)),this.isMaxDepth=!0,!1;let l=!1,d=new Set([Fe.FIELD_PATH,Fe.VALUES]),p=new Set,y=new Set,N=[];for(let I of t.fields){let O=I.name.value,x=s+`.${O}`;switch(O){case Fe.FIELD_PATH:{if(d.has(Fe.FIELD_PATH))d.delete(Fe.FIELD_PATH);else{l=!0,p.add(Fe.FIELD_PATH);break}if(I.value.kind!==ke.Kind.STRING){N.push((0,Ce.invalidInputFieldTypeErrorMessage)(x,Fe.STRING,(0,_e.kindToTypeString)(I.value.kind))),l=!0;break}let V=this.validateSubscriptionFieldConditionFieldPath(I.value.value,r,x,o,N);if(V.length<1){l=!0;break}n.fieldPath=V;break}case Fe.VALUES:{if(d.has(Fe.VALUES))d.delete(Fe.VALUES);else{l=!0,p.add(Fe.VALUES);break}let V=I.value.kind;if(V==ke.Kind.NULL||V==ke.Kind.OBJECT){N.push((0,Ce.invalidInputFieldTypeErrorMessage)(x,Fe.LIST,(0,_e.kindToTypeString)(I.value.kind))),l=!0;break}if(V!==ke.Kind.LIST){n.values=[(0,Se.getSubscriptionFilterValue)(I.value)];break}let K=new Set,re=[];for(let se=0;se0){N.push((0,Ce.subscriptionFieldConditionInvalidValuesArrayErrorMessage)(x,re));continue}if(K.size<1){l=!0,N.push((0,Ce.subscriptionFieldConditionEmptyValuesArrayErrorMessage)(x));continue}n.values=[...K];break}default:l=!0,y.add(O)}}return l?(u.push((0,Ce.subscriptionFieldConditionInvalidInputFieldErrorMessage)(s,[...d],[...p],[...y],N)),!1):!0}validateSubscriptionFilterCondition(t,n,r,i,s,o,u){if(i>dI.MAX_SUBSCRIPTION_FILTER_DEPTH||this.isMaxDepth)return u.push((0,Ce.subscriptionFilterConditionDepthExceededErrorMessage)(s)),this.isMaxDepth=!0,!1;if(i+=1,t.fields.length!==1)return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldNumberErrorMessage)(s,t.fields.length)),!1;let l=t.fields[0],d=l.name.value;if(!Fe.SUBSCRIPTION_FILTER_INPUT_NAMES.has(d))return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldErrorMessage)(s,d)),!1;let p=s+`.${d}`;switch(l.value.kind){case ke.Kind.OBJECT:switch(d){case Fe.IN_UPPER:return n.in={fieldPath:[],values:[]},this.validateSubscriptionFieldCondition(l.value,n.in,r,i,s+".IN",o,u);case Fe.NOT_UPPER:return n.not={},this.validateSubscriptionFilterCondition(l.value,n.not,r,i,s+".NOT",o,u);default:return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,Fe.LIST,Fe.OBJECT)),!1}case ke.Kind.LIST:{let y=[];switch(d){case Fe.AND_UPPER:{n.and=y;break}case Fe.OR_UPPER:{n.or=y;break}default:return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,Fe.OBJECT,Fe.LIST)),!1}let N=l.value.values.length;if(N<1||N>5)return u.push((0,Ce.subscriptionFilterArrayConditionInvalidLengthErrorMessage)(p,N)),!1;let I=!0,O=[];for(let x=0;x0?(u.push((0,Ce.subscriptionFilterArrayConditionInvalidItemTypeErrorMessage)(p,O)),!1):I}default:{let y=Fe.SUBSCRIPTION_FILTER_LIST_INPUT_NAMES.has(d)?Fe.LIST:Fe.OBJECT;return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,y,(0,_e.kindToTypeString)(l.value.kind))),!1}}}validateSubscriptionFilterAndGenerateConfiguration(t,n,r,i,s,o){if(!t.arguments||t.arguments.length!==1)return;let u=t.arguments[0];if(u.value.kind!==ke.Kind.OBJECT){this.errors.push((0,Ce.invalidSubscriptionFilterDirectiveError)(r,[(0,Ce.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(Fe.CONDITION,Fe.OBJECT,(0,_e.kindToTypeString)(u.value.kind))]));return}let l={},d=[];if(!this.validateSubscriptionFilterCondition(u.value,l,n,0,Fe.CONDITION,o,d)){this.errors.push((0,Ce.invalidSubscriptionFilterDirectiveError)(r,d)),this.isMaxDepth=!1;return}(0,_e.getValueOrDefault)(this.fieldConfigurationByFieldPath,r,()=>({argumentNames:[],fieldName:i,typeName:s})).subscriptionFilterCondition=l}validateSubscriptionFiltersAndGenerateConfiguration(){for(let[t,n]of this.subscriptionFilterDataByFieldPath){if(this.inaccessiblePaths.has(t))continue;let r=this.parentDefinitionDataByTypeName.get(n.fieldData.namedTypeName);if(!r){this.errors.push((0,Ce.invalidSubscriptionFilterDirectiveError)(t,[(0,Ce.subscriptionFilterNamedTypeErrorMessage)(n.fieldData.namedTypeName)]));continue}(0,Se.isNodeDataInaccessible)(r)||r.kind===ke.Kind.OBJECT_TYPE_DEFINITION&&this.validateSubscriptionFilterAndGenerateConfiguration(n.directive,r,t,n.fieldData.name,n.fieldData.renamedParentTypeName,n.directiveSubgraphName)}}buildFederationResult(){this.subscriptionFilterDataByFieldPath.size>0&&this.validateSubscriptionFiltersAndGenerateConfiguration(),this.invalidOrScopesHostPaths.size>0&&this.errors.push((0,Ce.orScopesLimitError)(_e.maxOrScopes,[...this.invalidOrScopesHostPaths]));for(let s of this.potentialPersistedDirectiveDefinitionDataByDirectiveName.values())(0,Se.addValidPersistedDirectiveDefinitionNodeByData)(this.routerDefinitions,s,this.persistedDirectiveDefinitionByDirectiveName,this.errors);let t=[];if(this.pushParentDefinitionDataToDocumentDefinitions(t),this.validateInterfaceImplementationsAndPushToDocumentDefinitions(t),this.validateQueryRootType(),this.errors.length>0)return{errors:this.errors,warnings:this.warnings};if(this.internalSubgraphBySubgraphName.size>1){let s=this.internalGraph.validate();if(s.length>0)return{errors:s,warnings:this.warnings}}if(this.errors.length>0)return{errors:this.errors,warnings:this.warnings};let n={kind:ke.Kind.DOCUMENT,definitions:this.routerDefinitions},r=(0,ke.buildASTSchema)({kind:ke.Kind.DOCUMENT,definitions:this.clientDefinitions},{assumeValid:!0,assumeValidSDL:!0}),i=new Map;for(let s of this.internalSubgraphBySubgraphName.values())i.set(s.name,{configurationDataByTypeName:s.configurationDataByTypeName,schema:s.schema});for(let s of this.authorizationDataByParentTypeName.values())(0,_e.upsertAuthorizationConfiguration)(this.fieldConfigurationByFieldPath,s);return{federationResult:k({fieldConfigurations:Array.from(this.fieldConfigurationByFieldPath.values()),subgraphConfigBySubgraphName:i,federatedGraphAST:n,federatedGraphSchema:(0,ke.buildASTSchema)(n,{assumeValid:!0,assumeValidSDL:!0}),federatedGraphClientSchema:r},this.getClientSchemaObjectBoolean()),warnings:this.warnings}}getClientSchemaObjectBoolean(){return this.inaccessiblePaths.size<1&&this.tagNamesByPath.size<1?{}:{shouldIncludeClientSchema:!0}}handleChildTagExclusions(t,n,r,i){let s=n.size;for(let[o,u]of r){let l=(0,_e.getOrThrowError)(n,o,`${t.name}.childDataByChildName`);if((0,Se.isNodeDataInaccessible)(l)){s-=1;continue}(0,_e.doSetsIntersect)(i,u.tagNames)&&((0,_e.getValueOrDefault)(l.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(`${t.name}.${o}`),s-=1)}s<1&&(t.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(t.name))}handleChildTagInclusions(t,n,r,i){let s=n.size;for(let[o,u]of n){if((0,Se.isNodeDataInaccessible)(u)){s-=1;continue}let l=r.get(o);(!l||!(0,_e.doSetsIntersect)(i,l.tagNames))&&((0,_e.getValueOrDefault)(u.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(`${t.name}.${o}`),s-=1)}s<1&&(t.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(t.name))}buildFederationContractResult(t){if(this.isVersionTwo||this.routerDefinitions.push(fr.INACCESSIBLE_DEFINITION),t.tagNamesToExclude.size>0)for(let[o,u]of this.parentTagDataByTypeName){let l=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,o,Fe.PARENT_DEFINITION_DATA);if(!(0,Se.isNodeDataInaccessible)(l)){if((0,_e.doSetsIntersect)(t.tagNamesToExclude,u.tagNames)){l.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o);continue}if(!(u.childTagDataByChildName.size<1))switch(l.kind){case ke.Kind.SCALAR_TYPE_DEFINITION:case ke.Kind.UNION_TYPE_DEFINITION:continue;case ke.Kind.ENUM_TYPE_DEFINITION:this.handleChildTagExclusions(l,l.enumValueDataByValueName,u.childTagDataByChildName,t.tagNamesToExclude);break;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:this.handleChildTagExclusions(l,l.inputValueDataByValueName,u.childTagDataByChildName,t.tagNamesToExclude);break;default:let d=l.fieldDataByFieldName.size;for(let[p,y]of u.childTagDataByChildName){let N=(0,_e.getOrThrowError)(l.fieldDataByFieldName,p,`${o}.fieldDataByFieldName`);if((0,Se.isNodeDataInaccessible)(N)){d-=1;continue}if((0,_e.doSetsIntersect)(t.tagNamesToExclude,y.tagNames)){(0,_e.getValueOrDefault)(N.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(`${o}.${p}`),d-=1;continue}for(let[I,O]of y.tagNamesByArgumentName){let x=(0,_e.getOrThrowError)(N.argumentDataByArgumentName,I,`${p}.argumentDataByArgumentName`);(0,Se.isNodeDataInaccessible)(x)||(0,_e.doSetsIntersect)(O,O)&&((0,_e.getValueOrDefault)(x.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(x.renamedPath))}}d<1&&(l.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o))}}}else if(t.tagNamesToInclude.size>0)for(let[o,u]of this.parentDefinitionDataByTypeName){if((0,Se.isNodeDataInaccessible)(u))continue;let l=this.parentTagDataByTypeName.get(o);if(!l){u.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o);continue}if(!(0,_e.doSetsIntersect)(t.tagNamesToInclude,l.tagNames)){if(l.childTagDataByChildName.size<1){u.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o);continue}switch(u.kind){case ke.Kind.SCALAR_TYPE_DEFINITION:case ke.Kind.UNION_TYPE_DEFINITION:continue;case ke.Kind.ENUM_TYPE_DEFINITION:this.handleChildTagInclusions(u,u.enumValueDataByValueName,l.childTagDataByChildName,t.tagNamesToInclude);break;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:this.handleChildTagInclusions(u,u.inputValueDataByValueName,l.childTagDataByChildName,t.tagNamesToInclude);break;default:let d=u.fieldDataByFieldName.size;for(let[p,y]of u.fieldDataByFieldName){if((0,Se.isNodeDataInaccessible)(y)){d-=1;continue}let N=l.childTagDataByChildName.get(p);(!N||!(0,_e.doSetsIntersect)(t.tagNamesToInclude,N.tagNames))&&((0,_e.getValueOrDefault)(y.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(`${o}.${p}`),d-=1)}d<1&&(u.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o))}}}this.subscriptionFilterDataByFieldPath.size>0&&this.validateSubscriptionFiltersAndGenerateConfiguration();for(let o of this.potentialPersistedDirectiveDefinitionDataByDirectiveName.values())(0,Se.addValidPersistedDirectiveDefinitionNodeByData)(this.routerDefinitions,o,this.persistedDirectiveDefinitionByDirectiveName,this.errors);let n=[];if(this.pushParentDefinitionDataToDocumentDefinitions(n),this.validateInterfaceImplementationsAndPushToDocumentDefinitions(n),this.validateQueryRootType(),this.errors.length>0)return{errors:this.errors,warnings:this.warnings};let r={kind:ke.Kind.DOCUMENT,definitions:this.routerDefinitions},i=(0,ke.buildASTSchema)({kind:ke.Kind.DOCUMENT,definitions:this.clientDefinitions},{assumeValid:!0,assumeValidSDL:!0}),s=new Map;for(let o of this.internalSubgraphBySubgraphName.values())s.set(o.name,{configurationDataByTypeName:o.configurationDataByTypeName,schema:o.schema});for(let o of this.authorizationDataByParentTypeName.values())(0,_e.upsertAuthorizationConfiguration)(this.fieldConfigurationByFieldPath,o);return{federationResult:k({fieldConfigurations:Array.from(this.fieldConfigurationByFieldPath.values()),subgraphConfigBySubgraphName:s,federatedGraphAST:r,federatedGraphSchema:(0,ke.buildASTSchema)(r,{assumeValid:!0,assumeValidSDL:!0}),federatedGraphClientSchema:i},this.getClientSchemaObjectBoolean()),warnings:this.warnings}}federateSubgraphsInternal(){return this.federateSubgraphData(),this.buildFederationResult()}};nd.FederationFactory=pI;function WR(e){if(e.length<1)return{errors:[Ce.minimumSubgraphRequirementError],warnings:[]};let{authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,errors:i,internalSubgraphBySubgraphName:s,internalGraph:o,warnings:u}=(0,bde.batchNormalize)(e);if(i)return{errors:i,warnings:u};let l=new Map,d=new Map,p=new Set;for(let[y,N]of s)for(let[I,O]of N.entityInterfaces){(0,_e.getValueOrDefault)(d,I,()=>[]).push({subgraphName:y,concreteTypeNames:O.concreteTypeNames||new Set});let x=l.get(I);if(!x){p.add(I),l.set(I,(0,_e.newEntityInterfaceFederationData)(O,y));continue}(0,_e.upsertEntityInterfaceFederationData)(x,O,y)&&p.delete(I)}for(let y of p)d.delete(y);return d.size>0?{errors:[(0,Ce.undefinedEntityInterfaceImplementationsError)(d,l)],warnings:u}:{federationFactory:new pI({authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,entityInterfaceFederationDataByTypeName:l,internalSubgraphBySubgraphName:s,internalGraph:o,warnings:u}),warnings:u}}function Dde(e){let{errors:t,federationFactory:n,warnings:r}=WR(e);return t||!n?{errors:t||[Ce.federationFactoryInitializationFatalError],warnings:r}:n.federateSubgraphsInternal()}function Ade(e,t){let{errors:n,federationFactory:r,warnings:i}=WR(e);if(n||!r)return{errors:n||[Ce.federationFactoryInitializationFatalError],warnings:i};r.federateSubgraphData();let s=[(0,Lq.cloneDeep)(r)],{errors:o,federationResult:u,warnings:l}=r.buildFederationResult();if(o)return{errors:o,warnings:l};let d=t.size-1,p=new Map,y=0;for(let[N,I]of t){y!==d&&s.push((0,Lq.cloneDeep)(s[y]));let O=s[y].buildFederationContractResult(I);p.set(N,O),y++}return{federationResult:u,federationResultContainerByContractName:p,warnings:l}}function Rde(e,t){let{errors:n,federationFactory:r,warnings:i}=WR(e);return n||!r?{errors:n||[Ce.federationFactoryInitializationFatalError],warnings:i}:(r.federateSubgraphData(),r.buildFederationContractResult(t))}});var fI=j(Sn=>{"use strict";m();T();h();var Fde=Sn&&Sn.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),ir=Sn&&Sn.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Fde(t,e,n)};Object.defineProperty(Sn,"__esModule",{value:!0});ir($i(),Sn);ir(nD(),Sn);ir(To(),Sn);ir(ZM(),Sn);ir(Pq(),Sn);ir(wR(),Sn);ir(HR(),Sn);ir(YR(),Sn);ir(Ql(),Sn);ir(kR(),Sn);ir(iA(),Sn);ir(KR(),Sn);ir(BR(),Sn);ir(jR(),Sn);ir(Qa(),Sn);ir(Gh(),Sn);ir(cI(),Sn);ir(Jp(),Sn);ir(PR(),Sn);ir(ps(),Sn);ir(Oc(),Sn);ir(bi(),Sn);ir(cT(),Sn)});var _pe={};Sf(_pe,{buildRouterConfiguration:()=>vpe,federateSubgraphs:()=>Ipe});m();T();h();var wF=e_(fI());m();T();h();m();T();h();function XR(e){if(!e)return e;let t=new URL(e),n=t.pathname;n.endsWith("/")&&(n=n.slice(0,-1));let r=t.port?`:${t.port}`:"";return`${t.protocol}//${t.hostname}${r}${n}`}m();T();h();m();T();h();var kq={};m();T();h();function Cq(e){return e!=null}m();T();h();m();T();h();Le();m();T();h();var xq;if(typeof AggregateError=="undefined"){class e extends Error{constructor(n,r=""){super(r),this.errors=n,this.name="AggregateError",Error.captureStackTrace(this,e)}}xq=function(t,n){return new e(t,n)}}else xq=AggregateError;function Uq(e){return"errors"in e&&Array.isArray(e.errors)}var Vq=3;function jq(e){return mI(e,[])}function mI(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return wde(e,t);default:return String(e)}}function Mq(e){return e instanceof Y?e.toString():`${e.name}: ${e.message}; +}`;var Ut=iP(function(){return dn(L,ze+"return "+Ie).apply(e,M)});if(Ut.source=Ie,$v(Ut))throw Ut;return Ut}function Ez(a){return yn(a).toLowerCase()}function gz(a){return yn(a).toUpperCase()}function Iz(a,c,f){if(a=yn(a),a&&(f||c===e))return fw(a);if(!a||!(c=es(c)))return a;var E=eo(a),_=eo(c),L=mw(E,_),M=hw(E,_)+1;return ec(E,L,M).join("")}function vz(a,c,f){if(a=yn(a),a&&(f||c===e))return a.slice(0,yw(a)+1);if(!a||!(c=es(c)))return a;var E=eo(a),_=hw(E,eo(c))+1;return ec(E,0,_).join("")}function _z(a,c,f){if(a=yn(a),a&&(f||c===e))return a.replace($I,"");if(!a||!(c=es(c)))return a;var E=eo(a),_=mw(E,eo(c));return ec(E,_).join("")}function bz(a,c){var f=Ct,E=B;if(Xn(c)){var _="separator"in c?c.separator:_;f="length"in c?Lt(c.length):f,E="omission"in c?es(c.omission):E}a=yn(a);var L=a.length;if(dd(a)){var M=eo(a);L=M.length}if(f>=L)return a;var q=f-pd(E);if(q<1)return E;var X=M?ec(M,0,q).join(""):a.slice(0,q);if(_===e)return X+E;if(M&&(q+=X.length-q),qv(_)){if(a.slice(q).search(_)){var ye,Ne=X;for(_.global||(_=sv(_.source,yn(CF.exec(_))+"g")),_.lastIndex=0;ye=_.exec(Ne);)var Ie=ye.index;X=X.slice(0,Ie===e?q:Ie)}}else if(a.indexOf(es(_),q)!=q){var we=X.lastIndexOf(_);we>-1&&(X=X.slice(0,we))}return X+E}function Oz(a){return a=yn(a),a&&xK.test(a)?a.replace(LF,eQ):a}var Sz=Nd(function(a,c,f){return a+(f?" ":"")+c.toUpperCase()}),Qv=sL("toUpperCase");function rP(a,c,f){return a=yn(a),c=f?e:c,c===e?zG(a)?rQ(a):VG(a):a.match(c)||[]}var iP=Bt(function(a,c){try{return Xi(a,e,c)}catch(f){return $v(f)?f:new _t(f)}}),Dz=va(function(a,c){return gs(c,function(f){f=Lo(f),ga(a,f,Vv(a[f],a))}),a});function Az(a){var c=a==null?0:a.length,f=ct();return a=c?Kn(a,function(E){if(typeof E[1]!="function")throw new Is(i);return[f(E[0]),E[1]]}):[],Bt(function(E){for(var _=-1;++__n)return[];var f=kn,E=Zr(a,kn);c=ct(c),a-=kn;for(var _=nv(E,c);++f0||c<0)?new Gt(f):(a<0?f=f.takeRight(-a):a&&(f=f.drop(a)),c!==e&&(c=Lt(c),f=c<0?f.dropRight(-c):f.take(c-a)),f)},Gt.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},Gt.prototype.toArray=function(){return this.take(kn)},Fo(Gt.prototype,function(a,c){var f=/^(?:filter|find|map|reject)|While$/.test(c),E=/^(?:head|last)$/.test(c),_=w[E?"take"+(c=="last"?"Right":""):c],L=E||/^find/.test(c);_&&(w.prototype[c]=function(){var M=this.__wrapped__,q=E?[1]:arguments,X=M instanceof Gt,ye=q[0],Ne=X||St(M),Ie=function(qt){var Wt=_.apply(w,Yu([qt],q));return E&&we?Wt[0]:Wt};Ne&&f&&typeof ye=="function"&&ye.length!=1&&(X=Ne=!1);var we=this.__chain__,ze=!!this.__actions__.length,lt=L&&!we,Ut=X&&!ze;if(!L&&Ne){M=Ut?M:new Gt(this);var dt=a.apply(M,q);return dt.__actions__.push({func:Ty,args:[Ie],thisArg:e}),new vs(dt,we)}return lt&&Ut?a.apply(this,q):(dt=this.thru(Ie),lt?E?dt.value()[0]:dt.value():dt)})}),gs(["pop","push","shift","sort","splice","unshift"],function(a){var c=$T[a],f=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",E=/^(?:pop|shift)$/.test(a);w.prototype[a]=function(){var _=arguments;if(E&&!this.__chain__){var L=this.value();return c.apply(St(L)?L:[],_)}return this[f](function(M){return c.apply(St(M)?M:[],_)})}}),Fo(Gt.prototype,function(a,c){var f=w[c];if(f){var E=f.name+"";On.call(hd,E)||(hd[E]=[]),hd[E].push({name:c,func:f})}}),hd[cy(e,x).name]=[{name:"wrapper",func:e}],Gt.prototype.clone=OQ,Gt.prototype.reverse=SQ,Gt.prototype.value=DQ,w.prototype.at=nJ,w.prototype.chain=rJ,w.prototype.commit=iJ,w.prototype.next=sJ,w.prototype.plant=aJ,w.prototype.reverse=uJ,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=cJ,w.prototype.first=w.prototype.head,df&&(w.prototype[df]=oJ),w},zu=iQ();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(xr._=zu,define(function(){return zu})):Vc?((Vc.exports=zu)._=zu,JI._=zu):xr._=zu}).call(Zp)});var Pq=j(nd=>{"use strict";m();T();h();Object.defineProperty(nd,"__esModule",{value:!0});nd.FederationFactory=void 0;nd.federateSubgraphs=Dde;nd.federateSubgraphsWithContracts=Ade;nd.federateSubgraphsContract=Rde;var ke=(Le(),Me(je)),kc=Qa(),Xs=$i(),Ce=To(),ef=wR(),Fe=bi(),_e=ps(),lI=rI(),fr=Oc(),bde=YR(),Ode=Ql(),wq=Gh(),Se=Jp(),Sde=HR(),Lq=Fq(),tf=cI(),dI=Al(),pI=class{constructor(t){A(this,"authorizationDataByParentTypeName");A(this,"concreteTypeNamesByAbstractTypeName");A(this,"clientDefinitions",[fr.DEPRECATED_DEFINITION]);A(this,"currentSubgraphName","");A(this,"subgraphNamesByNamedTypeNameByFieldCoordinates",new Map);A(this,"entityDataByTypeName");A(this,"entityInterfaceFederationDataByTypeName");A(this,"errors",[]);A(this,"fieldConfigurationByFieldPath",new Map);A(this,"inaccessiblePaths",new Set);A(this,"isMaxDepth",!1);A(this,"internalGraph");A(this,"internalSubgraphBySubgraphName");A(this,"invalidOrScopesHostPaths",new Set);A(this,"isVersionTwo",!1);A(this,"namedInputValueTypeNames",new Set);A(this,"namedOutputTypeNames",new Set);A(this,"parentDefinitionDataByTypeName",new Map);A(this,"parentTagDataByTypeName",new Map);A(this,"pathsByNamedTypeName",new Map);A(this,"persistedDirectiveDefinitionByDirectiveName",new Map([[Fe.AUTHENTICATED,fr.AUTHENTICATED_DEFINITION],[Fe.DEPRECATED,fr.DEPRECATED_DEFINITION],[Fe.INACCESSIBLE,fr.INACCESSIBLE_DEFINITION],[Fe.REQUIRES_SCOPES,fr.REQUIRES_SCOPES_DEFINITION],[Fe.TAG,fr.TAG_DEFINITION]]));A(this,"persistedDirectiveDefinitions",new Set([Fe.AUTHENTICATED,Fe.DEPRECATED,Fe.INACCESSIBLE,Fe.TAG,Fe.REQUIRES_SCOPES]));A(this,"potentialPersistedDirectiveDefinitionDataByDirectiveName",new Map);A(this,"routerDefinitions",[fr.DEPRECATED_DEFINITION,fr.TAG_DEFINITION]);A(this,"shareableErrorTypeNames",new Map);A(this,"subscriptionFilterDataByFieldPath",new Map);A(this,"tagNamesByPath",new Map);A(this,"warnings");this.authorizationDataByParentTypeName=t.authorizationDataByParentTypeName,this.concreteTypeNamesByAbstractTypeName=t.concreteTypeNamesByAbstractTypeName,this.entityDataByTypeName=t.entityDataByTypeName,this.entityInterfaceFederationDataByTypeName=t.entityInterfaceFederationDataByTypeName,this.internalSubgraphBySubgraphName=t.internalSubgraphBySubgraphName,this.internalGraph=t.internalGraph,this.warnings=t.warnings}getValidImplementedInterfaces(t){var o;let n=[];if(t.implementedInterfaceTypeNames.size<1)return n;let r=(0,Se.isNodeDataInaccessible)(t),i=new Map,s=new Map;for(let u of t.implementedInterfaceTypeNames){n.push((0,Xs.stringToNamedTypeNode)(u));let l=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,u,Fe.PARENT_DEFINITION_DATA);if(l.kind!==ke.Kind.INTERFACE_TYPE_DEFINITION){s.set(l.name,(0,_e.kindToTypeString)(l.kind));continue}let d={invalidFieldImplementations:new Map,unimplementedFields:[]},p=!1;for(let[y,N]of l.fieldDataByFieldName){let I=!1,O=t.fieldDataByFieldName.get(y);if(!O){p=!0,d.unimplementedFields.push(y);continue}let x={invalidAdditionalArguments:new Set,invalidImplementedArguments:[],isInaccessible:!1,originalResponseType:(0,lI.printTypeNode)(N.node.type),unimplementedArguments:new Set};(0,Se.isTypeValidImplementation)(N.node.type,O.node.type,this.concreteTypeNamesByAbstractTypeName)||(p=!0,I=!0,x.implementedResponseType=(0,lI.printTypeNode)(O.node.type));let V=new Set;for(let[K,re]of N.argumentDataByArgumentName){let se=re.node;V.add(K);let fe=(o=O.argumentDataByArgumentName.get(K))==null?void 0:o.node;if(!fe){p=!0,I=!0,x.unimplementedArguments.add(K);continue}let he=(0,lI.printTypeNode)(fe.type),xe=(0,lI.printTypeNode)(se.type);xe!==he&&(p=!0,I=!0,x.invalidImplementedArguments.push({actualType:he,argumentName:K,expectedType:xe}))}for(let[K,re]of O.argumentDataByArgumentName){let se=re.node;V.has(K)||se.type.kind===ke.Kind.NON_NULL_TYPE&&(p=!0,I=!0,x.invalidAdditionalArguments.add(K))}!r&&O.isInaccessible&&!N.isInaccessible&&(p=!0,I=!0,x.isInaccessible=!0),I&&d.invalidFieldImplementations.set(y,x)}p&&i.set(u,d)}return s.size>0&&this.errors.push((0,Ce.invalidImplementedTypeError)(t.name,s)),i.size&&this.errors.push((0,Ce.invalidInterfaceImplementationError)(t.node.name.value,(0,_e.kindToTypeString)(t.kind),i)),n}addValidPrimaryKeyTargetsToEntityData(t){var p;let n=this.entityDataByTypeName.get(t);if(!n)return;let r=(0,_e.getOrThrowError)(this.internalSubgraphBySubgraphName,this.currentSubgraphName,"internalSubgraphBySubgraphName"),i=r.parentDefinitionDataByTypeName,s=i.get(n.typeName);if(!s||s.kind!==ke.Kind.OBJECT_TYPE_DEFINITION)throw(0,Ce.incompatibleParentKindFatalError)(n.typeName,ke.Kind.OBJECT_TYPE_DEFINITION,(s==null?void 0:s.kind)||ke.Kind.NULL);let o=(0,_e.getOrThrowError)(r.configurationDataByTypeName,n.typeName,"internalSubgraph.configurationDataByParentTypeName"),u=[],l=this.internalGraph.nodeByNodeName.get(`${this.currentSubgraphName}.${n.typeName}`);(0,ef.validateImplicitFieldSets)({conditionalFieldDataByCoordinates:r.conditionalFieldDataByCoordinates,configurationData:o,fieldSets:n.keyFieldSets,graphNode:l,implicitKeys:u,objectData:s,parentDefinitionDataByTypeName:i});for(let[y,N]of this.entityInterfaceFederationDataByTypeName){if(!((p=N.concreteTypeNames)!=null&&p.has(n.typeName)))continue;let I=this.entityDataByTypeName.get(y);I&&(0,ef.validateImplicitFieldSets)({conditionalFieldDataByCoordinates:r.conditionalFieldDataByCoordinates,configurationData:o,fieldSets:I.keyFieldSets,implicitKeys:u,objectData:s,parentDefinitionDataByTypeName:i,graphNode:l})}if(u.length<1)return;if(!o.keys||o.keys.length<1){o.isRootNode=!0,o.keys=u;return}let d=new Set(o.keys.map(y=>y.selectionSet));for(let y of u)d.has(y.selectionSet)||(o.keys.push(y),d.add(y.selectionSet))}addValidPrimaryKeyTargetsFromInterfaceObject(t,n,r,i){let s=t.parentDefinitionDataByTypeName,o=s.get(n);if(!o||o.kind!==ke.Kind.INTERFACE_TYPE_DEFINITION)throw(0,Ce.incompatibleParentKindFatalError)(n,ke.Kind.INTERFACE_TYPE_DEFINITION,(o==null?void 0:o.kind)||ke.Kind.NULL);let u=(0,_e.getOrThrowError)(t.configurationDataByTypeName,r.typeName,"internalSubgraph.configurationDataByParentTypeName"),l=[];if((0,ef.validateImplicitFieldSets)({conditionalFieldDataByCoordinates:t.conditionalFieldDataByCoordinates,configurationData:u,fieldSets:r.keyFieldSets,implicitKeys:l,objectData:o,parentDefinitionDataByTypeName:s,graphNode:i}),l.length<1)return;if(!u.keys||u.keys.length<1){u.isRootNode=!0,u.keys=l;return}let d=new Set(u.keys.map(p=>p.selectionSet));for(let p of l)d.has(p.selectionSet)||(u.keys.push(p),d.add(p.selectionSet))}getEnumValueMergeMethod(t){return this.namedInputValueTypeNames.has(t)?this.namedOutputTypeNames.has(t)?Se.MergeMethod.CONSISTENT:Se.MergeMethod.INTERSECTION:Se.MergeMethod.UNION}generateTagData(){for(let[t,n]of this.tagNamesByPath){let r=t.split(".");if(r.length<1)continue;let i=(0,_e.getValueOrDefault)(this.parentTagDataByTypeName,r[0],()=>(0,ef.newParentTagData)(r[0]));switch(r.length){case 1:for(let l of n)i.tagNames.add(l);break;case 2:let s=(0,_e.getValueOrDefault)(i.childTagDataByChildName,r[1],()=>(0,ef.newChildTagData)(r[1]));for(let l of n)s.tagNames.add(l);break;case 3:let o=(0,_e.getValueOrDefault)(i.childTagDataByChildName,r[1],()=>(0,ef.newChildTagData)(r[1])),u=(0,_e.getValueOrDefault)(o.tagNamesByArgumentName,r[2],()=>new Set);for(let l of n)u.add(l);break;default:break}}}upsertEnumValueData(t,n,r){let i=t.get(n.name),s=i||n,o=`${n.parentTypeName}.${n.name}`;(0,Se.extractPersistedDirectives)(s.persistedDirectivesData,n.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName);let u=(0,Se.isNodeDataInaccessible)(n);if((r||u)&&this.inaccessiblePaths.add(o),this.recordTagNamesByPath(s,o),!i){n.node={directives:[],kind:n.node.kind,name:(0,Xs.stringToNameNode)(n.name)},t.set(n.name,n);return}i.appearances+=1,(0,Se.setLongestDescription)(i,n),(0,_e.addIterableValuesToSet)(n.subgraphNames,i.subgraphNames)}upsertInputValueData(t,n,r){let i=t.get(n.name),s=i||n;if((0,Se.extractPersistedDirectives)(s.persistedDirectivesData,n.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(s,r||s.renamedPath),!i){n.node={directives:[],kind:n.node.kind,name:(0,Xs.stringToNameNode)(n.name),type:n.type},t.set(n.name,n);return}(0,Se.setLongestDescription)(i,n),(0,_e.addIterableValuesToSet)(n.requiredSubgraphNames,i.requiredSubgraphNames),(0,_e.addIterableValuesToSet)(n.subgraphNames,i.subgraphNames);let{typeErrors:o,typeNode:u}=(0,tf.getMostRestrictiveMergedTypeNode)(i.type,n.type,i.originalPath,this.errors);if(u)i.type=u;else{if(!o||o.length<2)throw(0,Ce.fieldTypeMergeFatalError)(i.name);i.isArgument?this.errors.push((0,Ce.incompatibleArgumentTypesError)(i.name,i.renamedPath,o[0],o[1])):this.errors.push((0,Ce.incompatibleChildTypesError)(i.renamedPath,o[0],o[1]))}(0,Se.compareAndValidateInputValueDefaultValues)(i,n,this.errors)}handleArgumentInaccessibility(t,n,r,i){if(t){this.inaccessiblePaths.add(r);return}(0,Se.isNodeDataInaccessible)(n)&&((0,Se.isTypeRequired)(n.type)?this.errors.push((0,Ce.inaccessibleRequiredArgumentError)(n.name,r,i)):this.inaccessiblePaths.add(r))}handleSubscriptionFilterDirective(t,n,r){let i=t.directivesByDirectiveName.get(Fe.SUBSCRIPTION_FILTER);if(i){let s=(0,_e.getSingleSetEntry)(t.subgraphNames);if(s===void 0){this.errors.push((0,Ce.unknownFieldSubgraphNameError)(n));return}this.subscriptionFilterDataByFieldPath.set(n,{directive:i[0],fieldData:r||t,directiveSubgraphName:s})}}federateOutputType({current:t,other:n,hostPath:r,mostRestrictive:i}){n=(0,kc.getMutableTypeNode)(n,r,this.errors);let s={kind:t.kind},o=tf.DivergentType.NONE,u=s;for(let l=0;lnew Set))}upsertFieldData(t,n,r){let i=`${n.renamedParentTypeName}.${n.name}`;(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,n.namedTypeName,()=>new Set).add(i),this.namedOutputTypeNames.add(n.namedTypeName);let s=t.get(n.name),o=s||n;this.handleSubscriptionFilterDirective(n,i,o),(0,Se.extractPersistedDirectives)(o.persistedDirectivesData,n.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName);let u=(0,Se.isNodeDataInaccessible)(n);if((r||u)&&this.inaccessiblePaths.add(i),this.recordTagNamesByPath(o,i),!s){t.set(n.name,n),n.node={arguments:[],directives:[],kind:n.node.kind,name:(0,Xs.stringToNameNode)(n.name),type:n.type};for(let[d,p]of n.argumentDataByArgumentName){p.node={directives:[],kind:p.node.kind,name:(0,Xs.stringToNameNode)(p.name),type:p.type};let y=(0,kc.getTypeNodeNamedTypeName)(p.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,y,()=>new Set).add(p.renamedPath),this.namedInputValueTypeNames.add(y),(0,Se.extractPersistedDirectives)(p.persistedDirectivesData,p.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.handleArgumentInaccessibility(r||u,p,p.renamedPath,i),this.recordTagNamesByPath(p,`${i}.${d}`)}return}let l=this.federateOutputType({current:s.type,other:n.type,hostPath:i,mostRestrictive:!1});if(l.success)if(s.type=l.typeNode,s.namedTypeName!==n.namedTypeName){let d=(0,_e.getValueOrDefault)(this.subgraphNamesByNamedTypeNameByFieldCoordinates,`${s.renamedParentTypeName}.${s.name}`,()=>new Map),p=(0,_e.getValueOrDefault)(d,s.namedTypeName,()=>new Set);if(p.size<1)for(let y of s.subgraphNames)n.subgraphNames.has(y)||p.add(y);(0,_e.addIterableValuesToSet)(n.subgraphNames,(0,_e.getValueOrDefault)(d,n.namedTypeName,()=>new Set))}else this.addSubgraphNameToExistingFieldNamedTypeDisparity(n);for(let[d,p]of n.argumentDataByArgumentName){let y=(0,kc.getTypeNodeNamedTypeName)(p.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,y,()=>new Set).add(p.renamedPath),this.namedInputValueTypeNames.add(y),this.handleArgumentInaccessibility(r||u,p,p.renamedPath,i),this.upsertInputValueData(s.argumentDataByArgumentName,p,`${i}.${d}`)}(0,Se.setLongestDescription)(s,n),s.isInaccessible||(s.isInaccessible=n.isInaccessible),(0,_e.addMapEntries)(n.isExternalBySubgraphName,s.isExternalBySubgraphName),(0,_e.addMapEntries)(n.isShareableBySubgraphName,s.isShareableBySubgraphName),(0,_e.addIterableValuesToSet)(n.subgraphNames,s.subgraphNames)}getClientSchemaUnionMembers(t){let n=[];for(let[r,i]of t.memberByMemberTypeName)this.inaccessiblePaths.has(r)||n.push(i);return n}recordTagNamesByPath(t,n){let r=n||t.name;if(t.persistedDirectivesData.tags.size>0){let i=(0,_e.getValueOrDefault)(this.tagNamesByPath,r,()=>new Set);for(let s of t.persistedDirectivesData.tags.keys())i.add(s)}}upsertParentDefinitionData(t,n){let r=this.entityInterfaceFederationDataByTypeName.get(t.name),i=this.parentDefinitionDataByTypeName.get(t.name),s=i||t;(0,Se.extractPersistedDirectives)(s.persistedDirectivesData,t.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(s);let o=(0,Se.isNodeDataInaccessible)(s);if(o&&this.inaccessiblePaths.add(t.name),r&&r.interfaceObjectSubgraphs.has(n)&&(t.kind=ke.Kind.INTERFACE_TYPE_DEFINITION),!i)switch(t.node={kind:t.kind,name:(0,Xs.stringToNameNode)(t.name)},this.parentDefinitionDataByTypeName.set(t.name,t),t.kind){case ke.Kind.ENUM_TYPE_DEFINITION:for(let[u,l]of t.enumValueDataByValueName){let d=`${t.name}.${u}`;l.node={directives:[],kind:l.node.kind,name:(0,Xs.stringToNameNode)(l.name)},(0,Se.extractPersistedDirectives)(l.persistedDirectivesData,l.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(l,d),(0,Se.isNodeDataInaccessible)(l)&&this.inaccessiblePaths.add(d)}return;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:for(let[u,l]of t.inputValueDataByValueName){l.node={directives:[],kind:l.node.kind,name:(0,Xs.stringToNameNode)(l.name),type:l.type};let d=(0,kc.getTypeNodeNamedTypeName)(l.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,d,()=>new Set).add(l.renamedPath),this.namedInputValueTypeNames.add(d),(0,Se.extractPersistedDirectives)(l.persistedDirectivesData,l.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(l,`${t.name}.${u}`),(o||(0,Se.isNodeDataInaccessible)(l))&&this.inaccessiblePaths.add(l.renamedPath)}return;case ke.Kind.INTERFACE_TYPE_DEFINITION:case ke.Kind.OBJECT_TYPE_DEFINITION:(0,Se.isParentDataRootType)(t)&&(t.extensionType=wq.ExtensionType.NONE);for(let u of t.fieldDataByFieldName.values()){u.node={arguments:[],directives:[],kind:u.node.kind,name:(0,Xs.stringToNameNode)(u.name),type:u.type};let l=`${u.renamedParentTypeName}.${u.name}`;this.handleSubscriptionFilterDirective(u,l),(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,u.namedTypeName,()=>new Set).add(l),this.namedOutputTypeNames.add(u.namedTypeName),(0,Se.extractPersistedDirectives)(u.persistedDirectivesData,u.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(u,l);let d=(0,Se.isNodeDataInaccessible)(u);(o||d)&&this.inaccessiblePaths.add(l);for(let[p,y]of u.argumentDataByArgumentName){y.node={directives:[],kind:y.node.kind,name:(0,Xs.stringToNameNode)(y.name),type:y.type};let N=(0,kc.getTypeNodeNamedTypeName)(y.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,N,()=>new Set).add(y.renamedPath),this.namedInputValueTypeNames.add(N),(0,Se.extractPersistedDirectives)(y.persistedDirectivesData,y.directivesByDirectiveName,this.persistedDirectiveDefinitionByDirectiveName),this.recordTagNamesByPath(y,`${l}.${p}`),this.handleArgumentInaccessibility(o||d,y,y.renamedPath,l)}}return;default:return}if(i.kind!==t.kind&&(!r||!r.interfaceObjectSubgraphs.has(n)||i.kind!==ke.Kind.INTERFACE_TYPE_DEFINITION||t.kind!==ke.Kind.OBJECT_TYPE_DEFINITION)){this.errors.push((0,Ce.incompatibleParentKindMergeError)(i.name,(0,_e.kindToTypeString)(i.kind),(0,_e.kindToTypeString)(t.kind)));return}switch((0,Se.setLongestDescription)(i,t),(0,Se.setParentDataExtensionType)(i,t),i.kind){case ke.Kind.ENUM_TYPE_DEFINITION:i.appearances+=1,(0,_e.addIterableValuesToSet)(t.subgraphNames,i.subgraphNames);for(let l of t.enumValueDataByValueName.values())this.upsertEnumValueData(i.enumValueDataByValueName,l,o);return;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:o&&!i.isInaccessible&&this.propagateInaccessibilityToExistingChildren(i),(0,_e.addIterableValuesToSet)(t.subgraphNames,i.subgraphNames);for(let[l,d]of t.inputValueDataByValueName){let p=`${t.name}.${l}`,y=(0,kc.getTypeNodeNamedTypeName)(d.type);(0,_e.getValueOrDefault)(this.pathsByNamedTypeName,y,()=>new Set).add(p),this.namedInputValueTypeNames.add(y),this.upsertInputValueData(i.inputValueDataByValueName,d),this.recordTagNamesByPath(d,p),(o||(0,Se.isNodeDataInaccessible)(d))&&this.inaccessiblePaths.add(p)}return;case ke.Kind.INTERFACE_TYPE_DEFINITION:case ke.Kind.OBJECT_TYPE_DEFINITION:o&&!i.isInaccessible&&this.propagateInaccessibilityToExistingChildren(i);let u=t;(0,_e.addIterableValuesToSet)(u.implementedInterfaceTypeNames,i.implementedInterfaceTypeNames),(0,_e.addIterableValuesToSet)(u.subgraphNames,i.subgraphNames);for(let l of u.fieldDataByFieldName.values())this.upsertFieldData(i.fieldDataByFieldName,l,o||i.isInaccessible);return;case ke.Kind.UNION_TYPE_DEFINITION:(0,_e.addMapEntries)(t.memberByMemberTypeName,i.memberByMemberTypeName);return;default:return}}propagateInaccessibilityToExistingChildren(t){switch(t.isInaccessible=!0,t.kind){case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:for(let n of t.inputValueDataByValueName.keys())this.inaccessiblePaths.add(`${t.name}.${n}`);break;default:for(let[n,r]of t.fieldDataByFieldName){let i=`${r.renamedParentTypeName}.${n}`;this.inaccessiblePaths.add(i);for(let s of r.argumentDataByArgumentName.values())this.inaccessiblePaths.add(s.renamedPath)}}}upsertPersistedDirectiveDefinitionData(t,n){let r=t.name,i=this.potentialPersistedDirectiveDefinitionDataByDirectiveName.get(r);if(!i){if(n>1)return;let s=new Map;for(let o of t.argumentDataByArgumentName.values())this.namedInputValueTypeNames.add((0,kc.getTypeNodeNamedTypeName)(o.type)),this.upsertInputValueData(s,o);this.potentialPersistedDirectiveDefinitionDataByDirectiveName.set(r,{argumentDataByArgumentName:s,executableLocations:new Set(t.executableLocations),name:r,repeatable:t.repeatable,subgraphNames:new Set(t.subgraphNames),description:t.description});return}if(i.subgraphNames.size+1!==n){this.potentialPersistedDirectiveDefinitionDataByDirectiveName.delete(r);return}if((0,Se.setMutualExecutableLocations)(i,t.executableLocations),i.executableLocations.size<1){this.potentialPersistedDirectiveDefinitionDataByDirectiveName.delete(r);return}for(let s of t.argumentDataByArgumentName.values())this.namedInputValueTypeNames.add((0,kc.getTypeNodeNamedTypeName)(s.type)),this.upsertInputValueData(i.argumentDataByArgumentName,s);(0,Se.setLongestDescription)(i,t),i.repeatable&&(i.repeatable=t.repeatable),(0,_e.addIterableValuesToSet)(t.subgraphNames,i.subgraphNames)}shouldUpdateFederatedFieldAbstractNamedType(t,n){if(!t)return!1;let r=this.concreteTypeNamesByAbstractTypeName.get(t);if(!r||r.size<1)return!1;for(let i of n)if(!r.has(i))return!1;return!0}updateTypeNodeNamedType(t,n){let r=t;for(let i=0;i1){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}break}case ke.Kind.UNION_TYPE_DEFINITION:{if(l){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}l=p;break}default:{this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));break}}}if(o.size<0&&!l){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}let d=l;if(o.size>0){if(l){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}for(let p of o.keys()){d=p;for(let[y,N]of o)if(p!==y&&!N.implementedInterfaceTypeNames.has(p)){d="";break}if(d)break}}if(!this.shouldUpdateFederatedFieldAbstractNamedType(d,u)){this.errors.push((0,Ce.incompatibleFederatedFieldNamedTypeError)(t,n));continue}s.namedTypeName=d,this.updateTypeNodeNamedType(s.type,d)}}federateInternalSubgraphData(){let t=0,n=!1;for(let r of this.internalSubgraphBySubgraphName.values()){t+=1,this.currentSubgraphName=r.name,this.isVersionTwo||(this.isVersionTwo=r.isVersionTwo),(0,Sde.renameRootTypes)(this,r);for(let i of r.parentDefinitionDataByTypeName.values())this.upsertParentDefinitionData(i,r.name);if(!n){if(!r.persistedDirectiveDefinitionDataByDirectiveName.size){n=!0;continue}for(let i of r.persistedDirectiveDefinitionDataByDirectiveName.values())this.upsertPersistedDirectiveDefinitionData(i,t);this.potentialPersistedDirectiveDefinitionDataByDirectiveName.size<1&&(n=!0)}}this.handleDisparateFieldNamedTypes()}handleInterfaceObjectForInternalGraph({entityData:t,internalSubgraph:n,interfaceObjectData:r,interfaceObjectNode:i,resolvableKeyFieldSets:s,subgraphName:o}){let u=this.internalGraph.addOrUpdateNode(t.typeName),l=this.internalGraph.addEntityDataNode(t.typeName);for(let p of i.satisfiedFieldSets)u.satisfiedFieldSets.add(p),s.has(p)&&l.addTargetSubgraphByFieldSet(p,o);let d=r.fieldDatasBySubgraphName.get(o);for(let{name:p,namedTypeName:y}of d||[])this.internalGraph.addEdge(u,this.internalGraph.addOrUpdateNode(y),p);this.internalGraph.addEdge(i,u,t.typeName,!0),this.addValidPrimaryKeyTargetsFromInterfaceObject(n,i.typeName,t,u)}handleEntityInterfaces(){for(let[t,n]of this.entityInterfaceFederationDataByTypeName){(0,_e.subtractSourceSetFromTargetSet)(n.interfaceFieldNames,n.interfaceObjectFieldNames);let r=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,t,Fe.PARENT_DEFINITION_DATA);if(r.kind===ke.Kind.INTERFACE_TYPE_DEFINITION)for(let i of n.interfaceObjectSubgraphs){let s=(0,_e.getOrThrowError)(this.internalSubgraphBySubgraphName,i,"internalSubgraphBySubgraphName"),o=s.configurationDataByTypeName,u=this.concreteTypeNamesByAbstractTypeName.get(t);if(!u)continue;let l=(0,_e.getOrThrowError)(o,t,"configurationDataMap"),d=l.keys;if(!d)continue;l.entityInterfaceConcreteTypeNames=n.concreteTypeNames;let p=l.fieldNames,y=this.authorizationDataByParentTypeName.get(n.typeName);this.internalGraph.setSubgraphName(i);let N=this.internalGraph.addOrUpdateNode(t,{isAbstract:!0});for(let I of u){if(o.has(I))continue;if(y){let re=(0,_e.getValueOrDefault)(this.authorizationDataByParentTypeName,I,()=>(0,_e.newAuthorizationData)(I));for(let se of y.fieldAuthorizationDataByFieldName.values())(0,_e.upsertFieldAuthorizationData)(re.fieldAuthorizationDataByFieldName,se)||this.invalidOrScopesHostPaths.add(`${I}.${se.fieldName}`)}let O=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,I,Fe.PARENT_DEFINITION_DATA);if(O.kind!==ke.Kind.OBJECT_TYPE_DEFINITION)continue;let x=(0,_e.getOrThrowError)(this.entityDataByTypeName,I,"entityDataByTypeName");x.subgraphNames.add(i);let V={fieldNames:p,isRootNode:!0,keys:d,typeName:I},K=new Set;for(let re of d.filter(se=>!se.disableEntityResolver))K.add(re.selectionSet);for(let re of n.interfaceObjectFieldNames){if(O.fieldDataByFieldName.get(re))continue;let fe=(0,_e.getOrThrowError)(r.fieldDataByFieldName,re,`${t}.fieldDataByFieldName`);O.fieldDataByFieldName.set(re,k({},fe))}o.set(I,V),this.handleInterfaceObjectForInternalGraph({internalSubgraph:s,subgraphName:i,interfaceObjectData:n,interfaceObjectNode:N,resolvableKeyFieldSets:K,entityData:x})}}}}fieldDataToGraphFieldData(t){var n;return{name:t.name,namedTypeName:t.namedTypeName,isLeaf:(0,_e.isNodeLeaf)((n=this.parentDefinitionDataByTypeName.get(t.namedTypeName))==null?void 0:n.kind),subgraphNames:t.subgraphNames}}pushParentDefinitionDataToDocumentDefinitions(t){for(let[n,r]of this.parentDefinitionDataByTypeName)switch(r.extensionType!==wq.ExtensionType.NONE&&this.errors.push((0,Ce.noBaseDefinitionForExtensionError)((0,_e.kindToTypeString)(r.kind),n)),r.kind){case ke.Kind.ENUM_TYPE_DEFINITION:let i=[],s=[],o=this.getEnumValueMergeMethod(n);for(let K of r.enumValueDataByValueName.values()){let re=(0,Se.getNodeForRouterSchemaByData)(K,this.persistedDirectiveDefinitionByDirectiveName,this.errors),se=(0,Se.isNodeDataInaccessible)(K),fe=G(k({},K.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(K)});switch(o){case Se.MergeMethod.CONSISTENT:!se&&r.appearances>K.appearances&&this.errors.push((0,Ce.incompatibleSharedEnumError)(n)),i.push(re),se||s.push(fe);break;case Se.MergeMethod.INTERSECTION:r.appearances===K.appearances&&(i.push(re),se||s.push(fe));break;default:i.push(re),se||s.push(fe);break}}if(r.node.values=i,this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}if(s.length<1){this.errors.push((0,Ce.allChildDefinitionsAreInaccessibleError)((0,_e.kindToTypeString)(r.kind),n,Fe.ENUM_VALUE));break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r),values:s}));break;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:let u=[],l=[],d=[];for(let[K,re]of r.inputValueDataByValueName)if(r.subgraphNames.size===re.subgraphNames.size){if(l.push((0,Se.getNodeWithPersistedDirectivesByInputValueData)(re,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(re))continue;d.push(G(k({},re.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(re)}))}else(0,Se.isTypeRequired)(re.type)&&u.push({inputValueName:K,missingSubgraphs:(0,_e.getEntriesNotInHashSet)(r.subgraphNames,re.subgraphNames),requiredSubgraphs:[...re.requiredSubgraphNames]});if(u.length>0){this.errors.push((0,Ce.invalidRequiredInputValueError)(Fe.INPUT_OBJECT,n,u,!1));break}if(r.node.fields=l,this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r);break}if(d.length<1){this.errors.push((0,Ce.allChildDefinitionsAreInaccessibleError)((0,_e.kindToTypeString)(r.kind),n,"input field"));break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r),fields:d}));break;case ke.Kind.INTERFACE_TYPE_DEFINITION:case ke.Kind.OBJECT_TYPE_DEFINITION:let p=[],y=[],N=new Map,I=(0,Se.newInvalidFieldNames)(),O=r.kind===ke.Kind.OBJECT_TYPE_DEFINITION;for(let[K,re]of r.fieldDataByFieldName){(0,Se.pushAuthorizationDirectives)(re,this.authorizationDataByParentTypeName.get(n));let se=(0,Se.getValidFieldArgumentNodes)(re,this.persistedDirectiveDefinitionByDirectiveName,this.fieldConfigurationByFieldPath,this.errors);O&&(0,Se.validateExternalAndShareable)(re,I),p.push((0,Se.getNodeWithPersistedDirectivesByFieldData)(re,this.persistedDirectiveDefinitionByDirectiveName,se,this.errors)),!(0,Se.isNodeDataInaccessible)(re)&&(y.push((0,Se.getClientSchemaFieldNodeByFieldData)(re)),N.set(K,this.fieldDataToGraphFieldData(re)))}if(O&&(I.byShareable.size>0&&this.errors.push((0,Ce.invalidFieldShareabilityError)(r,I.byShareable)),I.subgraphNamesByExternalFieldName.size>0&&this.errors.push((0,Ce.allExternalFieldInstancesError)(n,I.subgraphNamesByExternalFieldName))),r.node.fields=p,this.internalGraph.initializeNode(n,N),r.implementedInterfaceTypeNames.size>0){t.push({data:r,clientSchemaFieldNodes:y});break}this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors));let x=(0,Ode.isNodeQuery)(n);if((0,Se.isNodeDataInaccessible)(r)){if(x){this.errors.push(Ce.inaccessibleQueryRootTypeError);break}this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}if(y.length<1){let K=x?Ce.noQueryRootTypeError:(0,Ce.allChildDefinitionsAreInaccessibleError)((0,_e.kindToTypeString)(r.kind),n,Fe.FIELD);this.errors.push(K);break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r),fields:y}));break;case ke.Kind.SCALAR_TYPE_DEFINITION:if(fr.BASE_SCALARS.has(n))break;if(this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r)}));break;case ke.Kind.UNION_TYPE_DEFINITION:if(r.node.types=(0,_e.mapToArrayOfValues)(r.memberByMemberTypeName),this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(r,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}let V=this.getClientSchemaUnionMembers(r);if(V.length<1){this.errors.push((0,Ce.allChildDefinitionsAreInaccessibleError)(Fe.UNION,n,"union member type"));break}this.clientDefinitions.push(G(k({},r.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(r),types:V}));break}}federateSubgraphData(){this.federateInternalSubgraphData(),this.handleEntityInterfaces(),this.generateTagData(),this.pushVersionTwoDirectiveDefinitionsToDocumentDefinitions()}validateInterfaceImplementationsAndPushToDocumentDefinitions(t){for(let{data:n,clientSchemaFieldNodes:r}of t){if(n.node.interfaces=this.getValidImplementedInterfaces(n),this.routerDefinitions.push((0,Se.getNodeForRouterSchemaByData)(n,this.persistedDirectiveDefinitionByDirectiveName,this.errors)),(0,Se.isNodeDataInaccessible)(n)){this.validateReferencesOfInaccessibleType(n),this.internalGraph.setNodeInaccessible(n.name);continue}let i=[];for(let s of n.implementedInterfaceTypeNames)this.inaccessiblePaths.has(s)||i.push((0,Xs.stringToNamedTypeNode)(s));this.clientDefinitions.push(G(k({},n.node),{directives:(0,Se.getClientPersistedDirectiveNodes)(n),fields:r,interfaces:i}))}}pushVersionTwoDirectiveDefinitionsToDocumentDefinitions(){this.isVersionTwo&&(this.routerDefinitions=[fr.AUTHENTICATED_DEFINITION,fr.DEPRECATED_DEFINITION,fr.INACCESSIBLE_DEFINITION,fr.REQUIRES_SCOPES_DEFINITION,fr.TAG_DEFINITION,fr.SCOPE_SCALAR_DEFINITION],this.clientDefinitions=[fr.AUTHENTICATED_DEFINITION,fr.DEPRECATED_DEFINITION,fr.REQUIRES_SCOPES_DEFINITION,fr.SCOPE_SCALAR_DEFINITION])}validatePathSegmentInaccessibility(t){if(!t)return!1;let r=t.split(Fe.LEFT_PARENTHESIS)[0].split(Fe.PERIOD),i=r[0];for(let s=0;s0&&this.errors.push((0,Ce.invalidReferencesOfInaccessibleTypeError)((0,_e.kindToTypeString)(t.kind),t.name,r))}validateQueryRootType(){let t=this.parentDefinitionDataByTypeName.get(Fe.QUERY);if(!t||t.kind!==ke.Kind.OBJECT_TYPE_DEFINITION||t.fieldDataByFieldName.size<1){this.errors.push(Ce.noQueryRootTypeError);return}for(let n of t.fieldDataByFieldName.values())if(!(0,Se.isNodeDataInaccessible)(n))return;this.errors.push(Ce.noQueryRootTypeError)}validateSubscriptionFieldConditionFieldPath(t,n,r,i,s){let o=t.split(Fe.PERIOD);if(o.length<1)return s.push((0,Ce.invalidSubscriptionFieldConditionFieldPathErrorMessage)(r,t)),[];let u=n;if(this.inaccessiblePaths.has(u.renamedTypeName))return s.push((0,Ce.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,o[0],u.renamedTypeName)),[];let l="";for(let d=0;d0?`.${p}`:p,u.kind!==ke.Kind.OBJECT_TYPE_DEFINITION)return s.push((0,Ce.invalidSubscriptionFieldConditionFieldPathParentErrorMessage)(r,t,l)),[];let y=u.fieldDataByFieldName.get(p);if(!y)return s.push((0,Ce.undefinedSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,p,u.renamedTypeName)),[];let N=`${u.renamedTypeName}.${p}`;if(!y.subgraphNames.has(i))return s.push((0,Ce.invalidSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,N,i)),[];if(this.inaccessiblePaths.has(N))return s.push((0,Ce.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,N)),[];if(fr.BASE_SCALARS.has(y.namedTypeName)){u={kind:ke.Kind.SCALAR_TYPE_DEFINITION,name:y.namedTypeName};continue}u=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,y.namedTypeName,Fe.PARENT_DEFINITION_DATA)}return(0,Se.isLeafKind)(u.kind)?o:(s.push((0,Ce.nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage)(r,t,o[o.length-1],(0,_e.kindToTypeString)(u.kind),u.name)),[])}validateSubscriptionFieldCondition(t,n,r,i,s,o,u){if(i>dI.MAX_SUBSCRIPTION_FILTER_DEPTH||this.isMaxDepth)return u.push((0,Ce.subscriptionFilterConditionDepthExceededErrorMessage)(s)),this.isMaxDepth=!0,!1;let l=!1,d=new Set([Fe.FIELD_PATH,Fe.VALUES]),p=new Set,y=new Set,N=[];for(let I of t.fields){let O=I.name.value,x=s+`.${O}`;switch(O){case Fe.FIELD_PATH:{if(d.has(Fe.FIELD_PATH))d.delete(Fe.FIELD_PATH);else{l=!0,p.add(Fe.FIELD_PATH);break}if(I.value.kind!==ke.Kind.STRING){N.push((0,Ce.invalidInputFieldTypeErrorMessage)(x,Fe.STRING,(0,_e.kindToTypeString)(I.value.kind))),l=!0;break}let V=this.validateSubscriptionFieldConditionFieldPath(I.value.value,r,x,o,N);if(V.length<1){l=!0;break}n.fieldPath=V;break}case Fe.VALUES:{if(d.has(Fe.VALUES))d.delete(Fe.VALUES);else{l=!0,p.add(Fe.VALUES);break}let V=I.value.kind;if(V==ke.Kind.NULL||V==ke.Kind.OBJECT){N.push((0,Ce.invalidInputFieldTypeErrorMessage)(x,Fe.LIST,(0,_e.kindToTypeString)(I.value.kind))),l=!0;break}if(V!==ke.Kind.LIST){n.values=[(0,Se.getSubscriptionFilterValue)(I.value)];break}let K=new Set,re=[];for(let se=0;se0){N.push((0,Ce.subscriptionFieldConditionInvalidValuesArrayErrorMessage)(x,re));continue}if(K.size<1){l=!0,N.push((0,Ce.subscriptionFieldConditionEmptyValuesArrayErrorMessage)(x));continue}n.values=[...K];break}default:l=!0,y.add(O)}}return l?(u.push((0,Ce.subscriptionFieldConditionInvalidInputFieldErrorMessage)(s,[...d],[...p],[...y],N)),!1):!0}validateSubscriptionFilterCondition(t,n,r,i,s,o,u){if(i>dI.MAX_SUBSCRIPTION_FILTER_DEPTH||this.isMaxDepth)return u.push((0,Ce.subscriptionFilterConditionDepthExceededErrorMessage)(s)),this.isMaxDepth=!0,!1;if(i+=1,t.fields.length!==1)return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldNumberErrorMessage)(s,t.fields.length)),!1;let l=t.fields[0],d=l.name.value;if(!Fe.SUBSCRIPTION_FILTER_INPUT_NAMES.has(d))return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldErrorMessage)(s,d)),!1;let p=s+`.${d}`;switch(l.value.kind){case ke.Kind.OBJECT:switch(d){case Fe.IN_UPPER:return n.in={fieldPath:[],values:[]},this.validateSubscriptionFieldCondition(l.value,n.in,r,i,s+".IN",o,u);case Fe.NOT_UPPER:return n.not={},this.validateSubscriptionFilterCondition(l.value,n.not,r,i,s+".NOT",o,u);default:return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,Fe.LIST,Fe.OBJECT)),!1}case ke.Kind.LIST:{let y=[];switch(d){case Fe.AND_UPPER:{n.and=y;break}case Fe.OR_UPPER:{n.or=y;break}default:return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,Fe.OBJECT,Fe.LIST)),!1}let N=l.value.values.length;if(N<1||N>5)return u.push((0,Ce.subscriptionFilterArrayConditionInvalidLengthErrorMessage)(p,N)),!1;let I=!0,O=[];for(let x=0;x0?(u.push((0,Ce.subscriptionFilterArrayConditionInvalidItemTypeErrorMessage)(p,O)),!1):I}default:{let y=Fe.SUBSCRIPTION_FILTER_LIST_INPUT_NAMES.has(d)?Fe.LIST:Fe.OBJECT;return u.push((0,Ce.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,y,(0,_e.kindToTypeString)(l.value.kind))),!1}}}validateSubscriptionFilterAndGenerateConfiguration(t,n,r,i,s,o){if(!t.arguments||t.arguments.length!==1)return;let u=t.arguments[0];if(u.value.kind!==ke.Kind.OBJECT){this.errors.push((0,Ce.invalidSubscriptionFilterDirectiveError)(r,[(0,Ce.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(Fe.CONDITION,Fe.OBJECT,(0,_e.kindToTypeString)(u.value.kind))]));return}let l={},d=[];if(!this.validateSubscriptionFilterCondition(u.value,l,n,0,Fe.CONDITION,o,d)){this.errors.push((0,Ce.invalidSubscriptionFilterDirectiveError)(r,d)),this.isMaxDepth=!1;return}(0,_e.getValueOrDefault)(this.fieldConfigurationByFieldPath,r,()=>({argumentNames:[],fieldName:i,typeName:s})).subscriptionFilterCondition=l}validateSubscriptionFiltersAndGenerateConfiguration(){for(let[t,n]of this.subscriptionFilterDataByFieldPath){if(this.inaccessiblePaths.has(t))continue;let r=this.parentDefinitionDataByTypeName.get(n.fieldData.namedTypeName);if(!r){this.errors.push((0,Ce.invalidSubscriptionFilterDirectiveError)(t,[(0,Ce.subscriptionFilterNamedTypeErrorMessage)(n.fieldData.namedTypeName)]));continue}(0,Se.isNodeDataInaccessible)(r)||r.kind===ke.Kind.OBJECT_TYPE_DEFINITION&&this.validateSubscriptionFilterAndGenerateConfiguration(n.directive,r,t,n.fieldData.name,n.fieldData.renamedParentTypeName,n.directiveSubgraphName)}}buildFederationResult(){this.subscriptionFilterDataByFieldPath.size>0&&this.validateSubscriptionFiltersAndGenerateConfiguration(),this.invalidOrScopesHostPaths.size>0&&this.errors.push((0,Ce.orScopesLimitError)(_e.maxOrScopes,[...this.invalidOrScopesHostPaths]));for(let s of this.potentialPersistedDirectiveDefinitionDataByDirectiveName.values())(0,Se.addValidPersistedDirectiveDefinitionNodeByData)(this.routerDefinitions,s,this.persistedDirectiveDefinitionByDirectiveName,this.errors);let t=[];if(this.pushParentDefinitionDataToDocumentDefinitions(t),this.validateInterfaceImplementationsAndPushToDocumentDefinitions(t),this.validateQueryRootType(),this.errors.length>0)return{errors:this.errors,warnings:this.warnings};if(this.internalSubgraphBySubgraphName.size>1){let s=this.internalGraph.validate();if(s.length>0)return{errors:s,warnings:this.warnings}}if(this.errors.length>0)return{errors:this.errors,warnings:this.warnings};let n={kind:ke.Kind.DOCUMENT,definitions:this.routerDefinitions},r=(0,ke.buildASTSchema)({kind:ke.Kind.DOCUMENT,definitions:this.clientDefinitions},{assumeValid:!0,assumeValidSDL:!0}),i=new Map;for(let s of this.internalSubgraphBySubgraphName.values())i.set(s.name,{configurationDataByTypeName:s.configurationDataByTypeName,schema:s.schema});for(let s of this.authorizationDataByParentTypeName.values())(0,_e.upsertAuthorizationConfiguration)(this.fieldConfigurationByFieldPath,s);return{federationResult:k({fieldConfigurations:Array.from(this.fieldConfigurationByFieldPath.values()),subgraphConfigBySubgraphName:i,federatedGraphAST:n,federatedGraphSchema:(0,ke.buildASTSchema)(n,{assumeValid:!0,assumeValidSDL:!0}),federatedGraphClientSchema:r,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName},this.getClientSchemaObjectBoolean()),warnings:this.warnings}}getClientSchemaObjectBoolean(){return this.inaccessiblePaths.size<1&&this.tagNamesByPath.size<1?{}:{shouldIncludeClientSchema:!0}}handleChildTagExclusions(t,n,r,i){let s=n.size;for(let[o,u]of r){let l=(0,_e.getOrThrowError)(n,o,`${t.name}.childDataByChildName`);if((0,Se.isNodeDataInaccessible)(l)){s-=1;continue}(0,_e.doSetsIntersect)(i,u.tagNames)&&((0,_e.getValueOrDefault)(l.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(`${t.name}.${o}`),s-=1)}s<1&&(t.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(t.name))}handleChildTagInclusions(t,n,r,i){let s=n.size;for(let[o,u]of n){if((0,Se.isNodeDataInaccessible)(u)){s-=1;continue}let l=r.get(o);(!l||!(0,_e.doSetsIntersect)(i,l.tagNames))&&((0,_e.getValueOrDefault)(u.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(`${t.name}.${o}`),s-=1)}s<1&&(t.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(t.name))}buildFederationContractResult(t){if(this.isVersionTwo||this.routerDefinitions.push(fr.INACCESSIBLE_DEFINITION),t.tagNamesToExclude.size>0)for(let[o,u]of this.parentTagDataByTypeName){let l=(0,_e.getOrThrowError)(this.parentDefinitionDataByTypeName,o,Fe.PARENT_DEFINITION_DATA);if(!(0,Se.isNodeDataInaccessible)(l)){if((0,_e.doSetsIntersect)(t.tagNamesToExclude,u.tagNames)){l.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o);continue}if(!(u.childTagDataByChildName.size<1))switch(l.kind){case ke.Kind.SCALAR_TYPE_DEFINITION:case ke.Kind.UNION_TYPE_DEFINITION:continue;case ke.Kind.ENUM_TYPE_DEFINITION:this.handleChildTagExclusions(l,l.enumValueDataByValueName,u.childTagDataByChildName,t.tagNamesToExclude);break;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:this.handleChildTagExclusions(l,l.inputValueDataByValueName,u.childTagDataByChildName,t.tagNamesToExclude);break;default:let d=l.fieldDataByFieldName.size;for(let[p,y]of u.childTagDataByChildName){let N=(0,_e.getOrThrowError)(l.fieldDataByFieldName,p,`${o}.fieldDataByFieldName`);if((0,Se.isNodeDataInaccessible)(N)){d-=1;continue}if((0,_e.doSetsIntersect)(t.tagNamesToExclude,y.tagNames)){(0,_e.getValueOrDefault)(N.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(`${o}.${p}`),d-=1;continue}for(let[I,O]of y.tagNamesByArgumentName){let x=(0,_e.getOrThrowError)(N.argumentDataByArgumentName,I,`${p}.argumentDataByArgumentName`);(0,Se.isNodeDataInaccessible)(x)||(0,_e.doSetsIntersect)(O,O)&&((0,_e.getValueOrDefault)(x.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(x.renamedPath))}}d<1&&(l.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o))}}}else if(t.tagNamesToInclude.size>0)for(let[o,u]of this.parentDefinitionDataByTypeName){if((0,Se.isNodeDataInaccessible)(u))continue;let l=this.parentTagDataByTypeName.get(o);if(!l){u.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o);continue}if(!(0,_e.doSetsIntersect)(t.tagNamesToInclude,l.tagNames)){if(l.childTagDataByChildName.size<1){u.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o);continue}switch(u.kind){case ke.Kind.SCALAR_TYPE_DEFINITION:case ke.Kind.UNION_TYPE_DEFINITION:continue;case ke.Kind.ENUM_TYPE_DEFINITION:this.handleChildTagInclusions(u,u.enumValueDataByValueName,l.childTagDataByChildName,t.tagNamesToInclude);break;case ke.Kind.INPUT_OBJECT_TYPE_DEFINITION:this.handleChildTagInclusions(u,u.inputValueDataByValueName,l.childTagDataByChildName,t.tagNamesToInclude);break;default:let d=u.fieldDataByFieldName.size;for(let[p,y]of u.fieldDataByFieldName){if((0,Se.isNodeDataInaccessible)(y)){d-=1;continue}let N=l.childTagDataByChildName.get(p);(!N||!(0,_e.doSetsIntersect)(t.tagNamesToInclude,N.tagNames))&&((0,_e.getValueOrDefault)(y.persistedDirectivesData.directives,Fe.INACCESSIBLE,()=>[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(`${o}.${p}`),d-=1)}d<1&&(u.persistedDirectivesData.directives.set(Fe.INACCESSIBLE,[(0,_e.generateSimpleDirective)(Fe.INACCESSIBLE)]),this.inaccessiblePaths.add(o))}}}this.subscriptionFilterDataByFieldPath.size>0&&this.validateSubscriptionFiltersAndGenerateConfiguration();for(let o of this.potentialPersistedDirectiveDefinitionDataByDirectiveName.values())(0,Se.addValidPersistedDirectiveDefinitionNodeByData)(this.routerDefinitions,o,this.persistedDirectiveDefinitionByDirectiveName,this.errors);let n=[];if(this.pushParentDefinitionDataToDocumentDefinitions(n),this.validateInterfaceImplementationsAndPushToDocumentDefinitions(n),this.validateQueryRootType(),this.errors.length>0)return{errors:this.errors,warnings:this.warnings};let r={kind:ke.Kind.DOCUMENT,definitions:this.routerDefinitions},i=(0,ke.buildASTSchema)({kind:ke.Kind.DOCUMENT,definitions:this.clientDefinitions},{assumeValid:!0,assumeValidSDL:!0}),s=new Map;for(let o of this.internalSubgraphBySubgraphName.values())s.set(o.name,{configurationDataByTypeName:o.configurationDataByTypeName,schema:o.schema});for(let o of this.authorizationDataByParentTypeName.values())(0,_e.upsertAuthorizationConfiguration)(this.fieldConfigurationByFieldPath,o);return{federationResult:k({fieldConfigurations:Array.from(this.fieldConfigurationByFieldPath.values()),subgraphConfigBySubgraphName:s,federatedGraphAST:r,federatedGraphSchema:(0,ke.buildASTSchema)(r,{assumeValid:!0,assumeValidSDL:!0}),federatedGraphClientSchema:i,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName},this.getClientSchemaObjectBoolean()),warnings:this.warnings}}federateSubgraphsInternal(){return this.federateSubgraphData(),this.buildFederationResult()}};nd.FederationFactory=pI;function WR(e){if(e.length<1)return{errors:[Ce.minimumSubgraphRequirementError],warnings:[]};let{authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,errors:i,internalSubgraphBySubgraphName:s,internalGraph:o,warnings:u}=(0,bde.batchNormalize)(e);if(i)return{errors:i,warnings:u};let l=new Map,d=new Map,p=new Set;for(let[y,N]of s)for(let[I,O]of N.entityInterfaces){(0,_e.getValueOrDefault)(d,I,()=>[]).push({subgraphName:y,concreteTypeNames:O.concreteTypeNames||new Set});let x=l.get(I);if(!x){p.add(I),l.set(I,(0,_e.newEntityInterfaceFederationData)(O,y));continue}(0,_e.upsertEntityInterfaceFederationData)(x,O,y)&&p.delete(I)}for(let y of p)d.delete(y);return d.size>0?{errors:[(0,Ce.undefinedEntityInterfaceImplementationsError)(d,l)],warnings:u}:{federationFactory:new pI({authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,entityInterfaceFederationDataByTypeName:l,internalSubgraphBySubgraphName:s,internalGraph:o,warnings:u}),warnings:u}}function Dde(e){let{errors:t,federationFactory:n,warnings:r}=WR(e);return t||!n?{errors:t||[Ce.federationFactoryInitializationFatalError],warnings:r}:n.federateSubgraphsInternal()}function Ade(e,t){let{errors:n,federationFactory:r,warnings:i}=WR(e);if(n||!r)return{errors:n||[Ce.federationFactoryInitializationFatalError],warnings:i};r.federateSubgraphData();let s=[(0,Lq.cloneDeep)(r)],{errors:o,federationResult:u,warnings:l}=r.buildFederationResult();if(o)return{errors:o,warnings:l};let d=t.size-1,p=new Map,y=0;for(let[N,I]of t){y!==d&&s.push((0,Lq.cloneDeep)(s[y]));let O=s[y].buildFederationContractResult(I);p.set(N,O),y++}return{federationResult:u,federationResultContainerByContractName:p,warnings:l}}function Rde(e,t){let{errors:n,federationFactory:r,warnings:i}=WR(e);return n||!r?{errors:n||[Ce.federationFactoryInitializationFatalError],warnings:i}:(r.federateSubgraphData(),r.buildFederationContractResult(t))}});var fI=j(Sn=>{"use strict";m();T();h();var Fde=Sn&&Sn.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),ir=Sn&&Sn.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Fde(t,e,n)};Object.defineProperty(Sn,"__esModule",{value:!0});ir($i(),Sn);ir(nD(),Sn);ir(To(),Sn);ir(ZM(),Sn);ir(Pq(),Sn);ir(wR(),Sn);ir(HR(),Sn);ir(YR(),Sn);ir(Ql(),Sn);ir(kR(),Sn);ir(iA(),Sn);ir(KR(),Sn);ir(BR(),Sn);ir(jR(),Sn);ir(Qa(),Sn);ir(Gh(),Sn);ir(cI(),Sn);ir(Jp(),Sn);ir(PR(),Sn);ir(ps(),Sn);ir(Oc(),Sn);ir(bi(),Sn);ir(cT(),Sn)});var _pe={};Sf(_pe,{buildRouterConfiguration:()=>vpe,federateSubgraphs:()=>Ipe});m();T();h();var wF=e_(fI());m();T();h();m();T();h();function XR(e){if(!e)return e;let t=new URL(e),n=t.pathname;n.endsWith("/")&&(n=n.slice(0,-1));let r=t.port?`:${t.port}`:"";return`${t.protocol}//${t.hostname}${r}${n}`}m();T();h();m();T();h();var kq={};m();T();h();function Cq(e){return e!=null}m();T();h();m();T();h();Le();m();T();h();var xq;if(typeof AggregateError=="undefined"){class e extends Error{constructor(n,r=""){super(r),this.errors=n,this.name="AggregateError",Error.captureStackTrace(this,e)}}xq=function(t,n){return new e(t,n)}}else xq=AggregateError;function Uq(e){return"errors"in e&&Array.isArray(e.errors)}var Vq=3;function jq(e){return mI(e,[])}function mI(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return wde(e,t);default:return String(e)}}function Mq(e){return e instanceof Y?e.toString():`${e.name}: ${e.message}; ${e.stack}`}function wde(e,t){if(e===null)return"null";if(e instanceof Error)return Uq(e)?Mq(e)+` `+Bq(e.errors,t):Mq(e);if(t.includes(e))return"[Circular]";let n=[...t,e];if(Lde(e)){let r=e.toJSON();if(r!==e)return typeof r=="string"?r:mI(r,n)}else if(Array.isArray(e))return Bq(e,n);return Pde(e,n)}function Lde(e){return typeof e.toJSON=="function"}function Pde(e,t){let n=Object.entries(e);return n.length===0?"{}":t.length>Vq?"["+kde(e)+"]":"{ "+n.map(([i,s])=>i+": "+mI(s,t)).join(", ")+" }"}function Bq(e,t){if(e.length===0)return"[]";if(t.length>Vq)return"[Array]";let n=e.length,r=[];for(let i=0;in==null?n:n[r],e==null?void 0:e.extensions)}m();T();h();Le();m();T();h();Le();function ma(e){if(Qe(e)){let t=ma(e.ofType);if(t.kind===R.NON_NULL_TYPE)throw new Error(`Invalid type node ${jq(e)}. Inner type of non-null type cannot be a non-null type.`);return{kind:R.NON_NULL_TYPE,type:t}}else if(Pt(e))return{kind:R.LIST_TYPE,type:ma(e.ofType)};return{kind:R.NAMED_TYPE,name:{kind:R.NAME,value:e.name}}}m();T();h();Le();function TI(e){if(e===null)return{kind:R.NULL};if(e===void 0)return null;if(Array.isArray(e)){let t=[];for(let n of e){let r=TI(n);r!=null&&t.push(r)}return{kind:R.LIST,values:t}}if(typeof e=="object"){let t=[];for(let n in e){let r=e[n],i=TI(r);i&&t.push({kind:R.OBJECT_FIELD,name:{kind:R.NAME,value:n},value:i})}return{kind:R.OBJECT,fields:t}}if(typeof e=="boolean")return{kind:R.BOOLEAN,value:e};if(typeof e=="number"&&isFinite(e)){let t=String(e);return Cde.test(t)?{kind:R.INT,value:t}:{kind:R.FLOAT,value:t}}if(typeof e=="string")return{kind:R.STRING,value:e};throw new TypeError(`Cannot convert value to AST: ${e}.`)}var Cde=/^-?(?:0|[1-9][0-9]*)$/;m();T();h();m();T();h();function yI(e){let t=new WeakMap;return function(r){let i=t.get(r);if(i===void 0){let s=e(r);return t.set(r,s),s}return i}}var kYe=yI(function(t){let n=xde(t);return new Set([...n].map(r=>r.name))}),xde=yI(function(t){let n=ZR(t);return new Set(n.values())}),ZR=yI(function(t){let n=new Map,r=t.getQueryType();r&&n.set("query",r);let i=t.getMutationType();i&&n.set("mutation",i);let s=t.getSubscriptionType();return s&&n.set("subscription",s),n});function Ude(e,t={}){let n=t.pathToDirectivesInExtensions,r=e.getTypeMap(),i=Mde(e,n),s=i!=null?[i]:[],o=e.getDirectives();for(let u of o)dc(u)||s.push(Bde(u,e,n));for(let u in r){let l=r[u],d=uo(l),p=ui(l);if(!(d||p))if(at(l))s.push(Vde(l,e,n));else if(Nt(l))s.push(jde(l,e,n));else if(pn(l))s.push($de(l,e,n));else if(It(l))s.push(qde(l,e,n));else if(sn(l))s.push(Kde(l,e,n));else if(er(l))s.push(Gde(l,e,n));else throw new Error(`Unknown type ${l}.`)}return{kind:R.DOCUMENT,definitions:s}}function $q(e,t={}){let n=Ude(e,t);return Ft(n)}function Mde(e,t){var n,r;let i=new Map([["query",void 0],["mutation",void 0],["subscription",void 0]]),s=[];if(e.astNode!=null&&s.push(e.astNode),e.extensionASTNodes!=null)for(let p of e.extensionASTNodes)s.push(p);for(let p of s)if(p.operationTypes)for(let y of p.operationTypes)i.set(y.operation,y);let o=ZR(e);for(let[p,y]of i){let N=o.get(p);if(N!=null){let I=ma(N);y!=null?y.type=I:i.set(p,{kind:R.OPERATION_TYPE_DEFINITION,operation:p,type:I})}}let u=[...i.values()].filter(Cq),l=nf(e,e,t);if(!u.length&&!l.length)return null;let d={kind:u!=null?R.SCHEMA_DEFINITION:R.SCHEMA_EXTENSION,operationTypes:u,directives:l};return d.description=((r=(n=e.astNode)===null||n===void 0?void 0:n.description)!==null&&r!==void 0?r:e.description!=null)?{kind:R.STRING,value:e.description,block:!0}:void 0,d}function Bde(e,t,n){var r,i,s,o;return{kind:R.DIRECTIVE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description}:void 0,name:{kind:R.NAME,value:e.name},arguments:(s=e.args)===null||s===void 0?void 0:s.map(u=>qq(u,t,n)),repeatable:e.isRepeatable,locations:((o=e.locations)===null||o===void 0?void 0:o.map(u=>({kind:R.NAME,value:u})))||[]}}function nf(e,t,n){let r=hI(e,n),i=[];e.astNode!=null&&i.push(e.astNode),"extensionASTNodes"in e&&e.extensionASTNodes!=null&&(i=i.concat(e.extensionASTNodes));let s;if(r!=null)s=eF(t,r);else{s=[];for(let o of i)o.directives&&s.push(...o.directives)}return s}function EI(e,t,n){var r,i;let s=[],o=null,u=hI(e,n),l;return u!=null?l=eF(t,u):l=(r=e.astNode)===null||r===void 0?void 0:r.directives,l!=null&&(s=l.filter(d=>d.name.value!=="deprecated"),e.deprecationReason!=null&&(o=(i=l.filter(d=>d.name.value==="deprecated"))===null||i===void 0?void 0:i[0])),e.deprecationReason!=null&&o==null&&(o=Jde(e.deprecationReason)),o==null?s:[o].concat(s)}function qq(e,t,n){var r,i,s;return{kind:R.INPUT_VALUE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},type:ma(e.type),defaultValue:e.defaultValue!==void 0&&(s=Hr(e.defaultValue,e.type))!==null&&s!==void 0?s:void 0,directives:EI(e,t,n)}}function Vde(e,t,n){var r,i;return{kind:R.OBJECT_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},fields:Object.values(e.getFields()).map(s=>Kq(s,t,n)),interfaces:Object.values(e.getInterfaces()).map(s=>ma(s)),directives:nf(e,t,n)}}function jde(e,t,n){var r,i;let s={kind:R.INTERFACE_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},fields:Object.values(e.getFields()).map(o=>Kq(o,t,n)),directives:nf(e,t,n)};return"getInterfaces"in e&&(s.interfaces=Object.values(e.getInterfaces()).map(o=>ma(o))),s}function $de(e,t,n){var r,i;return{kind:R.UNION_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},directives:nf(e,t,n),types:e.getTypes().map(s=>ma(s))}}function qde(e,t,n){var r,i;return{kind:R.INPUT_OBJECT_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},fields:Object.values(e.getFields()).map(s=>Qde(s,t,n)),directives:nf(e,t,n)}}function Kde(e,t,n){var r,i;return{kind:R.ENUM_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},values:Object.values(e.getValues()).map(s=>Yde(s,t,n)),directives:nf(e,t,n)}}function Gde(e,t,n){var r,i,s;let o=hI(e,n),u=o?eF(t,o):((r=e.astNode)===null||r===void 0?void 0:r.directives)||[],l=e.specifiedByUrl||e.specifiedByURL;if(l&&!u.some(d=>d.name.value==="specifiedBy")){let d={url:l};u.push(NI("specifiedBy",d))}return{kind:R.SCALAR_TYPE_DEFINITION,description:(s=(i=e.astNode)===null||i===void 0?void 0:i.description)!==null&&s!==void 0?s:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},directives:u}}function Kq(e,t,n){var r,i;return{kind:R.FIELD_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},arguments:e.args.map(s=>qq(s,t,n)),type:ma(e.type),directives:EI(e,t,n)}}function Qde(e,t,n){var r,i,s;return{kind:R.INPUT_VALUE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},type:ma(e.type),directives:EI(e,t,n),defaultValue:(s=Hr(e.defaultValue,e.type))!==null&&s!==void 0?s:void 0}}function Yde(e,t,n){var r,i;return{kind:R.ENUM_VALUE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:R.STRING,value:e.description,block:!0}:void 0,name:{kind:R.NAME,value:e.name},directives:EI(e,t,n)}}function Jde(e){return NI("deprecated",{reason:e},Mo)}function NI(e,t,n){let r=[];if(n!=null)for(let i of n.args){let s=i.name,o=t[s];if(o!==void 0){let u=Hr(o,i.type);u&&r.push({kind:R.ARGUMENT,name:{kind:R.NAME,value:s},value:u})}}else for(let i in t){let s=t[i],o=TI(s);o&&r.push({kind:R.ARGUMENT,name:{kind:R.NAME,value:i},value:o})}return{kind:R.DIRECTIVE,name:{kind:R.NAME,value:e},arguments:r}}function eF(e,t){let n=[];for(let r in t){let i=t[r],s=e==null?void 0:e.getDirective(r);if(Array.isArray(i))for(let o of i)n.push(NI(r,o,s));else n.push(NI(r,i,s))}return n}var LK=e_(fI(),1);Le();m();T();h();m();T();h();m();T();h();m();T();h();m();T();h();m();T();h();function Fn(e,t){if(!e)throw new Error(t)}var zde=34028234663852886e22,Hde=-34028234663852886e22,Wde=4294967295,Xde=2147483647,Zde=-2147483648;function rf(e){if(typeof e!="number")throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>Xde||eWde||e<0)throw new Error("invalid uint 32: "+e)}function gI(e){if(typeof e!="number")throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>zde||e({no:i.no,name:i.name,localName:e[i.no]})),r)}function nF(e,t,n){let r=Object.create(null),i=Object.create(null),s=[];for(let o of t){let u=Jq(o);s.push(u),r[o.name]=u,i[o.no]=u}return{typeName:e,values:s,findName(o){return r[o]},findNumber(o){return i[o]}}}function Yq(e,t,n){let r={};for(let i of t){let s=Jq(i);r[s.localName]=s.no,r[s.no]=s.localName}return tF(r,e,t,n),r}function Jq(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}m();T();h();m();T();h();var mt=class{equals(t){return this.getType().runtime.util.equals(this.getType(),this,t)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(t,n){let r=this.getType(),i=r.runtime.bin,s=i.makeReadOptions(n);return i.readMessage(this,s.readerFactory(t),t.byteLength,s),this}fromJson(t,n){let r=this.getType(),i=r.runtime.json,s=i.makeReadOptions(n);return i.readMessage(r,t,s,this),this}fromJsonString(t,n){let r;try{r=JSON.parse(t)}catch(i){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${i instanceof Error?i.message:String(i)}`)}return this.fromJson(r,n)}toBinary(t){let n=this.getType(),r=n.runtime.bin,i=r.makeWriteOptions(t),s=i.writerFactory();return r.writeMessage(this,s,i),s.finish()}toJson(t){let n=this.getType(),r=n.runtime.json,i=r.makeWriteOptions(t);return r.writeMessage(this,i)}toJsonString(t){var n;let r=this.toJson(t);return JSON.stringify(r,null,(n=t==null?void 0:t.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function zq(e,t,n,r){var i;let s=(i=r==null?void 0:r.localName)!==null&&i!==void 0?i:t.substring(t.lastIndexOf(".")+1),o={[s]:function(u){e.util.initFields(this),e.util.initPartial(u,this)}}[s];return Object.setPrototypeOf(o.prototype,new mt),Object.assign(o,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(u,l){return new o().fromBinary(u,l)},fromJson(u,l){return new o().fromJson(u,l)},fromJsonString(u,l){return new o().fromJsonString(u,l)},equals(u,l){return e.util.equals(o,u,l)}}),o}m();T();h();m();T();h();m();T();h();m();T();h();function Wq(){let e=0,t=0;for(let r=0;r<28;r+=7){let i=this.buf[this.pos++];if(e|=(i&127)<>4,!(n&128))return this.assertBounds(),[e,t];for(let r=3;r<=31;r+=7){let i=this.buf[this.pos++];if(t|=(i&127)<>>s,u=!(!(o>>>7)&&t==0),l=(u?o|128:o)&255;if(n.push(l),!u)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),!!i){for(let s=3;s<31;s=s+7){let o=t>>>s,u=!!(o>>>7),l=(u?o|128:o)&255;if(n.push(l),!u)return}n.push(t>>>31&1)}}var II=4294967296;function rF(e){let t=e[0]==="-";t&&(e=e.slice(1));let n=1e6,r=0,i=0;function s(o,u){let l=Number(e.slice(o,u));i*=n,r=r*n+l,r>=II&&(i=i+(r/II|0),r=r%II)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),t?Zq(r,i):sF(r,i)}function Xq(e,t){let n=sF(e,t),r=n.hi&2147483648;r&&(n=Zq(n.lo,n.hi));let i=iF(n.lo,n.hi);return r?"-"+i:i}function iF(e,t){if({lo:e,hi:t}=epe(e,t),t<=2097151)return String(II*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,s=n+r*6777216+i*6710656,o=r+i*8147497,u=i*2,l=1e7;return s>=l&&(o+=Math.floor(s/l),s%=l),o>=l&&(u+=Math.floor(o/l),o%=l),u.toString()+Hq(o)+Hq(s)}function epe(e,t){return{lo:e>>>0,hi:t>>>0}}function sF(e,t){return{lo:e|0,hi:t|0}}function Zq(e,t){return t=~t,e?e=~e+1:t+=1,sF(e,t)}var Hq=e=>{let t=String(e);return"0000000".slice(t.length)+t};function oF(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e=e>>7;t.push(1)}}function eK(){let e=this.buf[this.pos++],t=e&127;if(!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let n=5;e&128&&n<10;n++)e=this.buf[this.pos++];if(e&128)throw new Error("invalid varint");return this.assertBounds(),t>>>0}function tpe(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(typeof b!="object"||typeof b.env!="object"||b.env.BUF_BIGINT_DISABLE!=="1")){let i=BigInt("-9223372036854775808"),s=BigInt("9223372036854775807"),o=BigInt("0"),u=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){let d=typeof l=="bigint"?l:BigInt(l);if(d>s||du||dFn(/^-?[0-9]+$/.test(i),`int64 invalid: ${i}`),r=i=>Fn(/^[0-9]+$/.test(i),`uint64 invalid: ${i}`);return{zero:"0",supported:!1,parse(i){return typeof i!="string"&&(i=i.toString()),n(i),i},uParse(i){return typeof i!="string"&&(i=i.toString()),r(i),i},enc(i){return typeof i!="string"&&(i=i.toString()),n(i),rF(i)},uEnc(i){return typeof i!="string"&&(i=i.toString()),r(i),rF(i)},dec(i,s){return Xq(i,s)},uDec(i,s){return iF(i,s)}}}var Ir=tpe();m();T();h();var Ee;(function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"})(Ee||(Ee={}));var Oo;(function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING"})(Oo||(Oo={}));function eu(e,t,n){if(t===n)return!0;if(e==Ee.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let r=0;r>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(NT(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return rf(t),oF(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let n=this.textEncoder.encode(t);return this.uint32(n.byteLength),this.raw(n)}float(t){gI(t);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,t,!0),this.raw(n)}double(t){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,t,!0),this.raw(n)}fixed32(t){NT(t);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t,!0),this.raw(n)}sfixed32(t){rf(t);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,t,!0),this.raw(n)}sint32(t){return rf(t),t=(t<<1^t>>31)>>>0,oF(t,this.buf),this}sfixed64(t){let n=new Uint8Array(8),r=new DataView(n.buffer),i=Ir.enc(t);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}fixed64(t){let n=new Uint8Array(8),r=new DataView(n.buffer),i=Ir.uEnc(t);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}int64(t){let n=Ir.enc(t);return vI(n.lo,n.hi,this.buf),this}sint64(t){let n=Ir.enc(t),r=n.hi>>31,i=n.lo<<1^r,s=(n.hi<<1|n.lo>>>31)^r;return vI(i,s,this.buf),this}uint64(t){let n=Ir.uEnc(t);return vI(n.lo,n.hi,this.buf),this}},OI=class{constructor(t,n){this.varint64=Wq,this.uint32=eK,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.textDecoder=n!=null?n:new TextDecoder}tag(){let t=this.uint32(),n=t>>>3,r=t&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(t){let n=this.pos;switch(t){case mr.Varint:for(;this.buf[this.pos++]&128;);break;case mr.Bit64:this.pos+=4;case mr.Bit32:this.pos+=4;break;case mr.LengthDelimited:let r=this.uint32();this.pos+=r;break;case mr.StartGroup:let i;for(;(i=this.tag()[1])!==mr.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Ir.dec(...this.varint64())}uint64(){return Ir.uDec(...this.varint64())}sint64(){let[t,n]=this.varint64(),r=-(t&1);return t=(t>>>1|(n&1)<<31)^r,n=n>>>1^r,Ir.dec(t,n)}bool(){let[t,n]=this.varint64();return t!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Ir.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ir.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),n=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(n,n+t)}string(){return this.textDecoder.decode(this.bytes())}};function tK(e,t,n,r){let i;return{typeName:t,extendee:n,get field(){if(!i){let s=typeof r=="function"?r():r;s.name=t.split(".").pop(),s.jsonName=`[${t}]`,i=e.util.newFieldList([s]).list()[0]}return i},runtime:e}}function SI(e){let t=e.field.localName,n=Object.create(null);return n[t]=npe(e),[n,()=>n[t]]}function npe(e){let t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return So(t.T,t.L);case"message":let n=t.T,r=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(r):r;case"map":throw"map fields are not allowed to be extensions"}}function nK(e,t){if(!t.repeated&&(t.kind=="enum"||t.kind=="scalar")){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(n=>n.no===t.no)}m();T();h();m();T();h();var tu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),DI=[];for(let e=0;e>4,o=s,i=2;break;case 2:n[r++]=(o&15)<<4|(s&60)>>2,o=s,i=3;break;case 3:n[r++]=(o&3)<<6|s,i=0;break}}if(i==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(e){let t="",n=0,r,i=0;for(let s=0;s>2],i=(r&3)<<4,n=1;break;case 1:t+=tu[i|r>>4],i=(r&15)<<2,n=2;break;case 2:t+=tu[i|r>>6],t+=tu[r&63],n=0;break}return n&&(t+=tu[i],t+="=",n==1&&(t+="=")),t}};m();T();h();function rK(e,t,n){sK(t,e);let r=t.runtime.bin.makeReadOptions(n),i=nK(e.getType().runtime.bin.listUnknownFields(e),t.field),[s,o]=SI(t);for(let u of i)t.runtime.bin.readField(s,r.readerFactory(u.data),t.field,u.wireType,r);return o()}function iK(e,t,n,r){sK(t,e);let i=t.runtime.bin.makeReadOptions(r),s=t.runtime.bin.makeWriteOptions(r);if(uF(e,t)){let d=e.getType().runtime.bin.listUnknownFields(e).filter(p=>p.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(let p of d)e.getType().runtime.bin.onUnknownField(e,p.no,p.wireType,p.data)}let o=s.writerFactory(),u=t.field;!u.opt&&!u.repeated&&(u.kind=="enum"||u.kind=="scalar")&&(u=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(u,n,o,s);let l=i.readerFactory(o.finish());for(;l.posr.no==t.field.no)}function sK(e,t){Fn(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}m();T();h();function AI(e,t){let n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?t[n]!==void 0:e.kind=="enum"?t[n]!==e.T.values[0].no:!_I(e.T,t[n]);case"message":return t[n]!==void 0;case"map":return Object.keys(t[n]).length>0}}function cF(e,t){let n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=r?e.T.values[0].no:void 0;break;case"scalar":t[n]=r?So(e.T,e.L):void 0;break;case"message":t[n]=void 0;break}}m();T();h();m();T();h();function Do(e,t){if(e===null||typeof e!="object"||!Object.getOwnPropertyNames(mt.prototype).every(r=>r in e&&typeof e[r]=="function"))return!1;let n=e.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:t===void 0?!0:n.typeName==t.typeName}function RI(e,t){return Do(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}var m3e={"google.protobuf.DoubleValue":Ee.DOUBLE,"google.protobuf.FloatValue":Ee.FLOAT,"google.protobuf.Int64Value":Ee.INT64,"google.protobuf.UInt64Value":Ee.UINT64,"google.protobuf.Int32Value":Ee.INT32,"google.protobuf.UInt32Value":Ee.UINT32,"google.protobuf.BoolValue":Ee.BOOL,"google.protobuf.StringValue":Ee.STRING,"google.protobuf.BytesValue":Ee.BYTES};var oK={ignoreUnknownFields:!1},aK={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function rpe(e){return e?Object.assign(Object.assign({},oK),e):oK}function ipe(e){return e?Object.assign(Object.assign({},aK),e):aK}var LI=Symbol(),FI=Symbol();function lK(){return{makeReadOptions:rpe,makeWriteOptions:ipe,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!="object")throw new Error(`cannot decode message ${e.typeName} from JSON: ${ha(t)}`);r=r!=null?r:new e;let i=new Map,s=n.typeRegistry;for(let[o,u]of Object.entries(t)){let l=e.fields.findJsonName(o);if(l){if(l.oneof){if(u===null&&l.kind=="scalar")continue;let d=i.get(l.oneof);if(d!==void 0)throw new Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${d}", "${o}"`);i.set(l.oneof,o)}uK(r,u,l,n,e)}else{let d=!1;if(s!=null&&s.findExtension&&o.startsWith("[")&&o.endsWith("]")){let p=s.findExtension(o.substring(1,o.length-1));if(p&&p.extendee.typeName==e.typeName){d=!0;let[y,N]=SI(p);uK(y,u,p.field,n,p),iK(r,p,N(),n)}}if(!d&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${e.typeName} from JSON: key "${o}" is unknown`)}}return r},writeMessage(e,t){let n=e.getType(),r={},i;try{for(i of n.fields.byNumber()){if(!AI(i,e)){if(i.req)throw"required field not set";if(!t.emitDefaultValues||!ope(i))continue}let o=i.oneof?e[i.oneof.localName].value:e[i.localName],u=cK(i,o,t);u!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=u)}let s=t.typeRegistry;if(s!=null&&s.findExtensionFor)for(let o of n.runtime.bin.listUnknownFields(e)){let u=s.findExtensionFor(n.typeName,o.no);if(u&&uF(e,u)){let l=rK(e,u,t),d=cK(u.field,l,t);d!==void 0&&(r[u.field.jsonName]=d)}}}catch(s){let o=i?`cannot encode field ${n.typeName}.${i.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,u=s instanceof Error?s.message:String(s);throw new Error(o+(u.length>0?`: ${u}`:""))}return r},readScalar(e,t,n){return ET(e,t,n!=null?n:Oo.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||_I(e,t)))return wI(e,t)},debug:ha}}function ha(e){if(e===null)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":`"${e.split('"').join('\\"')}"`;default:return String(e)}}function uK(e,t,n,r,i){let s=n.localName;if(n.repeated){if(Fn(n.kind!="map"),t===null)return;if(!Array.isArray(t))throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(t)}`);let o=e[s];for(let u of t){if(u===null)throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(u)}`);switch(n.kind){case"message":o.push(n.T.fromJson(u,r));break;case"enum":let l=lF(n.T,u,r.ignoreUnknownFields,!0);l!==FI&&o.push(l);break;case"scalar":try{o.push(ET(n.T,u,n.L,!0))}catch(d){let p=`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(u)}`;throw d instanceof Error&&d.message.length>0&&(p+=`: ${d.message}`),new Error(p)}break}}}else if(n.kind=="map"){if(t===null)return;if(typeof t!="object"||Array.isArray(t))throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(t)}`);let o=e[s];for(let[u,l]of Object.entries(t)){if(l===null)throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: map value null`);let d;try{d=spe(n.K,u)}catch(p){let y=`cannot decode map key for field ${i.typeName}.${n.name} from JSON: ${ha(t)}`;throw p instanceof Error&&p.message.length>0&&(y+=`: ${p.message}`),new Error(y)}switch(n.V.kind){case"message":o[d]=n.V.T.fromJson(l,r);break;case"enum":let p=lF(n.V.T,l,r.ignoreUnknownFields,!0);p!==FI&&(o[d]=p);break;case"scalar":try{o[d]=ET(n.V.T,l,Oo.BIGINT,!0)}catch(y){let N=`cannot decode map value for field ${i.typeName}.${n.name} from JSON: ${ha(t)}`;throw y instanceof Error&&y.message.length>0&&(N+=`: ${y.message}`),new Error(N)}break}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:s},s="value"),n.kind){case"message":let o=n.T;if(t===null&&o.typeName!="google.protobuf.Value")return;let u=e[s];Do(u)?u.fromJson(t,r):(e[s]=u=o.fromJson(t,r),o.fieldWrapper&&!n.oneof&&(e[s]=o.fieldWrapper.unwrapField(u)));break;case"enum":let l=lF(n.T,t,r.ignoreUnknownFields,!1);switch(l){case LI:cF(n,e);break;case FI:break;default:e[s]=l;break}break;case"scalar":try{let d=ET(n.T,t,n.L,!1);switch(d){case LI:cF(n,e);break;default:e[s]=d;break}}catch(d){let p=`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(t)}`;throw d instanceof Error&&d.message.length>0&&(p+=`: ${d.message}`),new Error(p)}break}}function spe(e,t){if(e===Ee.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1;break}return ET(e,t,Oo.BIGINT,!0).toString()}function ET(e,t,n,r){if(t===null)return r?So(e,n):LI;switch(e){case Ee.DOUBLE:case Ee.FLOAT:if(t==="NaN")return Number.NaN;if(t==="Infinity")return Number.POSITIVE_INFINITY;if(t==="-Infinity")return Number.NEGATIVE_INFINITY;if(t===""||typeof t=="string"&&t.trim().length!==t.length||typeof t!="string"&&typeof t!="number")break;let i=Number(t);if(Number.isNaN(i)||!Number.isFinite(i))break;return e==Ee.FLOAT&&gI(i),i;case Ee.INT32:case Ee.FIXED32:case Ee.SFIXED32:case Ee.SINT32:case Ee.UINT32:let s;if(typeof t=="number"?s=t:typeof t=="string"&&t.length>0&&t.trim().length===t.length&&(s=Number(t)),s===void 0)break;return e==Ee.UINT32||e==Ee.FIXED32?NT(s):rf(s),s;case Ee.INT64:case Ee.SFIXED64:case Ee.SINT64:if(typeof t!="number"&&typeof t!="string")break;let o=Ir.parse(t);return n?o.toString():o;case Ee.FIXED64:case Ee.UINT64:if(typeof t!="number"&&typeof t!="string")break;let u=Ir.uParse(t);return n?u.toString():u;case Ee.BOOL:if(typeof t!="boolean")break;return t;case Ee.STRING:if(typeof t!="string")break;try{encodeURIComponent(t)}catch(l){throw new Error("invalid UTF8")}return t;case Ee.BYTES:if(t==="")return new Uint8Array(0);if(typeof t!="string")break;return aF.dec(t)}throw new Error}function lF(e,t,n,r){if(t===null)return e.typeName=="google.protobuf.NullValue"?0:r?e.values[0].no:LI;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":let i=e.findName(t);if(i!==void 0)return i.no;if(n)return FI;break}throw new Error(`cannot decode enum ${e.typeName} from JSON: ${ha(t)}`)}function ope(e){return e.repeated||e.kind=="map"?!0:!(e.oneof||e.kind=="message"||e.opt||e.req)}function cK(e,t,n){if(e.kind=="map"){Fn(typeof t=="object"&&t!=null);let r={},i=Object.entries(t);switch(e.V.kind){case"scalar":for(let[o,u]of i)r[o.toString()]=wI(e.V.T,u);break;case"message":for(let[o,u]of i)r[o.toString()]=u.toJson(n);break;case"enum":let s=e.V.T;for(let[o,u]of i)r[o.toString()]=dF(s,u,n.enumAsInteger);break}return n.emitDefaultValues||i.length>0?r:void 0}if(e.repeated){Fn(Array.isArray(t));let r=[];switch(e.kind){case"scalar":for(let i=0;i0?r:void 0}switch(e.kind){case"scalar":return wI(e.T,t);case"enum":return dF(e.T,t,n.enumAsInteger);case"message":return RI(e.T,t).toJson(n)}}function dF(e,t,n){var r;if(Fn(typeof t=="number"),e.typeName=="google.protobuf.NullValue")return null;if(n)return t;let i=e.findNumber(t);return(r=i==null?void 0:i.name)!==null&&r!==void 0?r:t}function wI(e,t){switch(e){case Ee.INT32:case Ee.SFIXED32:case Ee.SINT32:case Ee.FIXED32:case Ee.UINT32:return Fn(typeof t=="number"),t;case Ee.FLOAT:case Ee.DOUBLE:return Fn(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case Ee.STRING:return Fn(typeof t=="string"),t;case Ee.BOOL:return Fn(typeof t=="boolean"),t;case Ee.UINT64:case Ee.FIXED64:case Ee.INT64:case Ee.SFIXED64:case Ee.SINT64:return Fn(typeof t=="bigint"||typeof t=="string"||typeof t=="number"),t.toString();case Ee.BYTES:return Fn(t instanceof Uint8Array),aF.enc(t)}}m();T();h();var sf=Symbol("@bufbuild/protobuf/unknown-fields"),dK={readUnknownFields:!0,readerFactory:e=>new OI(e)},pK={writeUnknownFields:!0,writerFactory:()=>new bI};function ape(e){return e?Object.assign(Object.assign({},dK),e):dK}function upe(e){return e?Object.assign(Object.assign({},pK),e):pK}function TK(){return{makeReadOptions:ape,makeWriteOptions:upe,listUnknownFields(e){var t;return(t=e[sf])!==null&&t!==void 0?t:[]},discardUnknownFields(e){delete e[sf]},writeUnknownFields(e,t){let r=e[sf];if(r)for(let i of r)t.tag(i.no,i.wireType).raw(i.data)},onUnknownField(e,t,n,r){let i=e;Array.isArray(i[sf])||(i[sf]=[]),i[sf].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,i){let s=e.getType(),o=i?t.len:t.pos+n,u,l;for(;t.pos0&&(l=lpe),s){let N=e[o];if(r==mr.LengthDelimited&&u!=Ee.STRING&&u!=Ee.BYTES){let O=t.uint32()+t.pos;for(;t.posDo(N,y)?N:new y(N));else{let N=o[i];y.fieldWrapper?y.typeName==="google.protobuf.BytesValue"?s[i]=IT(N):s[i]=N:s[i]=Do(N,y)?N:new y(N)}break}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(r=>{let i=t[r.localName],s=n[r.localName];if(r.repeated){if(i.length!==s.length)return!1;switch(r.kind){case"message":return i.every((o,u)=>r.T.equals(o,s[u]));case"scalar":return i.every((o,u)=>eu(r.T,o,s[u]));case"enum":return i.every((o,u)=>eu(Ee.INT32,o,s[u]))}throw new Error(`repeated cannot contain ${r.kind}`)}switch(r.kind){case"message":return r.T.equals(i,s);case"enum":return eu(Ee.INT32,i,s);case"scalar":return eu(r.T,i,s);case"oneof":if(i.case!==s.case)return!1;let o=r.findField(i.case);if(o===void 0)return!0;switch(o.kind){case"message":return o.T.equals(i.value,s.value);case"enum":return eu(Ee.INT32,i.value,s.value);case"scalar":return eu(o.T,i.value,s.value)}throw new Error(`oneof cannot contain ${o.kind}`);case"map":let u=Object.keys(i).concat(Object.keys(s));switch(r.V.kind){case"message":let l=r.V.T;return u.every(p=>l.equals(i[p],s[p]));case"enum":return u.every(p=>eu(Ee.INT32,i[p],s[p]));case"scalar":let d=r.V.T;return u.every(p=>eu(d,i[p],s[p]))}break}})},clone(e){let t=e.getType(),n=new t,r=n;for(let i of t.fields.byMember()){let s=e[i.localName],o;if(i.repeated)o=s.map(CI);else if(i.kind=="map"){o=r[i.localName];for(let[u,l]of Object.entries(s))o[u]=CI(l)}else i.kind=="oneof"?o=i.findField(s.case)?{case:s.case,value:CI(s.value)}:{case:void 0}:o=CI(s);r[i.localName]=o}for(let i of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,i.no,i.wireType,i.data);return n}}}function CI(e){if(e===void 0)return e;if(Do(e))return e.clone();if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function IT(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function EK(e,t,n){return{syntax:e,json:lK(),bin:TK(),util:Object.assign(Object.assign({},NK()),{newFieldList:t,initFields:n}),makeMessageType(r,i,s){return zq(this,r,i,s)},makeEnum:Yq,makeEnumType:nF,getEnumType:Qq,makeExtension(r,i,s){return tK(this,r,i,s)}}}m();T();h();var xI=class{constructor(t,n){this._fields=t,this._normalizer=n}findJsonName(t){if(!this.jsonNames){let n={};for(let r of this.list())n[r.jsonName]=n[r.name]=r;this.jsonNames=n}return this.jsonNames[t]}find(t){if(!this.numbers){let n={};for(let r of this.list())n[r.no]=r;this.numbers=n}return this.numbers[t]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((t,n)=>t.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];let t=this.members,n;for(let r of this.list())r.oneof?r.oneof!==n&&(n=r.oneof,t.push(n)):t.push(r)}return this.members}};m();T();h();m();T();h();m();T();h();function pF(e,t){let n=vK(e);return t?n:Tpe(hpe(n))}function gK(e){return pF(e,!1)}var IK=vK;function vK(e){let t=!1,n=[];for(let r=0;r`${e}$`,hpe=e=>mpe.has(e)?_K(e):e,Tpe=e=>fpe.has(e)?_K(e):e;var UI=class{constructor(t){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=t,this.localName=gK(t)}addField(t){Fn(t.oneof===this,`field ${t.name} not one of ${this.name}`),this.fields.push(t)}findField(t){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;nnew xI(e,t=>bK(t,!0)),e=>{for(let t of e.getType().fields.byMember()){if(t.opt)continue;let n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case"oneof":r[n]={case:void 0};break;case"enum":r[n]=0;break;case"map":r[n]={};break;case"scalar":r[n]=So(t.T,t.L);break;case"message":break}}});var of;(function(e){e[e.OK=0]="OK",e[e.ERR=1]="ERR",e[e.ERR_NOT_FOUND=2]="ERR_NOT_FOUND",e[e.ERR_ALREADY_EXISTS=3]="ERR_ALREADY_EXISTS",e[e.ERR_INVALID_SUBGRAPH_SCHEMA=4]="ERR_INVALID_SUBGRAPH_SCHEMA",e[e.ERR_SUBGRAPH_COMPOSITION_FAILED=5]="ERR_SUBGRAPH_COMPOSITION_FAILED",e[e.ERR_SUBGRAPH_CHECK_FAILED=6]="ERR_SUBGRAPH_CHECK_FAILED",e[e.ERR_INVALID_LABELS=7]="ERR_INVALID_LABELS",e[e.ERR_ANALYTICS_DISABLED=8]="ERR_ANALYTICS_DISABLED",e[e.ERROR_NOT_AUTHENTICATED=9]="ERROR_NOT_AUTHENTICATED",e[e.ERR_OPENAI_DISABLED=10]="ERR_OPENAI_DISABLED",e[e.ERR_FREE_TRIAL_EXPIRED=11]="ERR_FREE_TRIAL_EXPIRED",e[e.ERROR_NOT_AUTHORIZED=12]="ERROR_NOT_AUTHORIZED",e[e.ERR_LIMIT_REACHED=13]="ERR_LIMIT_REACHED",e[e.ERR_DEPLOYMENT_FAILED=14]="ERR_DEPLOYMENT_FAILED"})(of||(of={}));z.util.setEnumType(of,"wg.cosmo.common.EnumStatusCode",[{no:0,name:"OK"},{no:1,name:"ERR"},{no:2,name:"ERR_NOT_FOUND"},{no:3,name:"ERR_ALREADY_EXISTS"},{no:4,name:"ERR_INVALID_SUBGRAPH_SCHEMA"},{no:5,name:"ERR_SUBGRAPH_COMPOSITION_FAILED"},{no:6,name:"ERR_SUBGRAPH_CHECK_FAILED"},{no:7,name:"ERR_INVALID_LABELS"},{no:8,name:"ERR_ANALYTICS_DISABLED"},{no:9,name:"ERROR_NOT_AUTHENTICATED"},{no:10,name:"ERR_OPENAI_DISABLED"},{no:11,name:"ERR_FREE_TRIAL_EXPIRED"},{no:12,name:"ERROR_NOT_AUTHORIZED"},{no:13,name:"ERR_LIMIT_REACHED"},{no:14,name:"ERR_DEPLOYMENT_FAILED"}]);var nu;(function(e){e[e.GRAPHQL_SUBSCRIPTION_PROTOCOL_WS=0]="GRAPHQL_SUBSCRIPTION_PROTOCOL_WS",e[e.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE=1]="GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE",e[e.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST=2]="GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST"})(nu||(nu={}));z.util.setEnumType(nu,"wg.cosmo.common.GraphQLSubscriptionProtocol",[{no:0,name:"GRAPHQL_SUBSCRIPTION_PROTOCOL_WS"},{no:1,name:"GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE"},{no:2,name:"GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST"}]);var ru;(function(e){e[e.GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO=0]="GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO",e[e.GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS=1]="GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS",e[e.GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS=2]="GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS"})(ru||(ru={}));z.util.setEnumType(ru,"wg.cosmo.common.GraphQLWebsocketSubprotocol",[{no:0,name:"GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO"},{no:1,name:"GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS"},{no:2,name:"GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS"}]);m();T();h();var fF;(function(e){e[e.RENDER_ARGUMENT_DEFAULT=0]="RENDER_ARGUMENT_DEFAULT",e[e.RENDER_ARGUMENT_AS_GRAPHQL_VALUE=1]="RENDER_ARGUMENT_AS_GRAPHQL_VALUE",e[e.RENDER_ARGUMENT_AS_ARRAY_CSV=2]="RENDER_ARGUMENT_AS_ARRAY_CSV"})(fF||(fF={}));z.util.setEnumType(fF,"wg.cosmo.node.v1.ArgumentRenderConfiguration",[{no:0,name:"RENDER_ARGUMENT_DEFAULT"},{no:1,name:"RENDER_ARGUMENT_AS_GRAPHQL_VALUE"},{no:2,name:"RENDER_ARGUMENT_AS_ARRAY_CSV"}]);var id;(function(e){e[e.OBJECT_FIELD=0]="OBJECT_FIELD",e[e.FIELD_ARGUMENT=1]="FIELD_ARGUMENT"})(id||(id={}));z.util.setEnumType(id,"wg.cosmo.node.v1.ArgumentSource",[{no:0,name:"OBJECT_FIELD"},{no:1,name:"FIELD_ARGUMENT"}]);var Cc;(function(e){e[e.STATIC=0]="STATIC",e[e.GRAPHQL=1]="GRAPHQL",e[e.PUBSUB=2]="PUBSUB"})(Cc||(Cc={}));z.util.setEnumType(Cc,"wg.cosmo.node.v1.DataSourceKind",[{no:0,name:"STATIC"},{no:1,name:"GRAPHQL"},{no:2,name:"PUBSUB"}]);var Gu;(function(e){e[e.PUBLISH=0]="PUBLISH",e[e.REQUEST=1]="REQUEST",e[e.SUBSCRIBE=2]="SUBSCRIBE"})(Gu||(Gu={}));z.util.setEnumType(Gu,"wg.cosmo.node.v1.EventType",[{no:0,name:"PUBLISH"},{no:1,name:"REQUEST"},{no:2,name:"SUBSCRIBE"}]);var xc;(function(e){e[e.STATIC_CONFIGURATION_VARIABLE=0]="STATIC_CONFIGURATION_VARIABLE",e[e.ENV_CONFIGURATION_VARIABLE=1]="ENV_CONFIGURATION_VARIABLE",e[e.PLACEHOLDER_CONFIGURATION_VARIABLE=2]="PLACEHOLDER_CONFIGURATION_VARIABLE"})(xc||(xc={}));z.util.setEnumType(xc,"wg.cosmo.node.v1.ConfigurationVariableKind",[{no:0,name:"STATIC_CONFIGURATION_VARIABLE"},{no:1,name:"ENV_CONFIGURATION_VARIABLE"},{no:2,name:"PLACEHOLDER_CONFIGURATION_VARIABLE"}]);var sd;(function(e){e[e.GET=0]="GET",e[e.POST=1]="POST",e[e.PUT=2]="PUT",e[e.DELETE=3]="DELETE",e[e.OPTIONS=4]="OPTIONS"})(sd||(sd={}));z.util.setEnumType(sd,"wg.cosmo.node.v1.HTTPMethod",[{no:0,name:"GET"},{no:1,name:"POST"},{no:2,name:"PUT"},{no:3,name:"DELETE"},{no:4,name:"OPTIONS"}]);var iu=class iu extends mt{constructor(n){super();A(this,"id","");A(this,"name","");A(this,"routingUrl","");z.util.initPartial(n,this)}static fromBinary(n,r){return new iu().fromBinary(n,r)}static fromJson(n,r){return new iu().fromJson(n,r)}static fromJsonString(n,r){return new iu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(iu,n,r)}};A(iu,"runtime",z),A(iu,"typeName","wg.cosmo.node.v1.Subgraph"),A(iu,"fields",z.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"routing_url",kind:"scalar",T:9}]));var MI=iu,su=class su extends mt{constructor(n){super();A(this,"configByFeatureFlagName",{});z.util.initPartial(n,this)}static fromBinary(n,r){return new su().fromBinary(n,r)}static fromJson(n,r){return new su().fromJson(n,r)}static fromJsonString(n,r){return new su().fromJsonString(n,r)}static equals(n,r){return z.util.equals(su,n,r)}};A(su,"runtime",z),A(su,"typeName","wg.cosmo.node.v1.FeatureFlagRouterExecutionConfigs"),A(su,"fields",z.util.newFieldList(()=>[{no:1,name:"config_by_feature_flag_name",kind:"map",K:9,V:{kind:"message",T:hF}}]));var mF=su,ou=class ou extends mt{constructor(n){super();A(this,"engineConfig");A(this,"version","");A(this,"subgraphs",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new ou().fromBinary(n,r)}static fromJson(n,r){return new ou().fromJson(n,r)}static fromJsonString(n,r){return new ou().fromJsonString(n,r)}static equals(n,r){return z.util.equals(ou,n,r)}};A(ou,"runtime",z),A(ou,"typeName","wg.cosmo.node.v1.FeatureFlagRouterExecutionConfig"),A(ou,"fields",z.util.newFieldList(()=>[{no:1,name:"engine_config",kind:"message",T:af},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"subgraphs",kind:"message",T:MI,repeated:!0}]));var hF=ou,au=class au extends mt{constructor(n){super();A(this,"engineConfig");A(this,"version","");A(this,"subgraphs",[]);A(this,"featureFlagConfigs");z.util.initPartial(n,this)}static fromBinary(n,r){return new au().fromBinary(n,r)}static fromJson(n,r){return new au().fromJson(n,r)}static fromJsonString(n,r){return new au().fromJsonString(n,r)}static equals(n,r){return z.util.equals(au,n,r)}};A(au,"runtime",z),A(au,"typeName","wg.cosmo.node.v1.RouterConfig"),A(au,"fields",z.util.newFieldList(()=>[{no:1,name:"engine_config",kind:"message",T:af},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"subgraphs",kind:"message",T:MI,repeated:!0},{no:4,name:"feature_flag_configs",kind:"message",T:mF,opt:!0}]));var vT=au,uu=class uu extends mt{constructor(n){super();A(this,"code",of.OK);A(this,"details");z.util.initPartial(n,this)}static fromBinary(n,r){return new uu().fromBinary(n,r)}static fromJson(n,r){return new uu().fromJson(n,r)}static fromJsonString(n,r){return new uu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(uu,n,r)}};A(uu,"runtime",z),A(uu,"typeName","wg.cosmo.node.v1.Response"),A(uu,"fields",z.util.newFieldList(()=>[{no:1,name:"code",kind:"enum",T:z.getEnumType(of)},{no:2,name:"details",kind:"scalar",T:9,opt:!0}]));var TF=uu,cu=class cu extends mt{constructor(n){super();A(this,"code",0);A(this,"message","");z.util.initPartial(n,this)}static fromBinary(n,r){return new cu().fromBinary(n,r)}static fromJson(n,r){return new cu().fromJson(n,r)}static fromJsonString(n,r){return new cu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(cu,n,r)}};A(cu,"runtime",z),A(cu,"typeName","wg.cosmo.node.v1.ResponseStatus"),A(cu,"fields",z.util.newFieldList(()=>[{no:1,name:"code",kind:"scalar",T:5},{no:2,name:"message",kind:"scalar",T:9}]));var OK=cu,lu=class lu extends mt{constructor(n){super();A(this,"accountLimits");A(this,"graphPublicKey","");z.util.initPartial(n,this)}static fromBinary(n,r){return new lu().fromBinary(n,r)}static fromJson(n,r){return new lu().fromJson(n,r)}static fromJsonString(n,r){return new lu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(lu,n,r)}};A(lu,"runtime",z),A(lu,"typeName","wg.cosmo.node.v1.RegistrationInfo"),A(lu,"fields",z.util.newFieldList(()=>[{no:1,name:"account_limits",kind:"message",T:NF},{no:2,name:"graph_public_key",kind:"scalar",T:9}]));var yF=lu,du=class du extends mt{constructor(n){super();A(this,"traceSamplingRate",0);z.util.initPartial(n,this)}static fromBinary(n,r){return new du().fromBinary(n,r)}static fromJson(n,r){return new du().fromJson(n,r)}static fromJsonString(n,r){return new du().fromJsonString(n,r)}static equals(n,r){return z.util.equals(du,n,r)}};A(du,"runtime",z),A(du,"typeName","wg.cosmo.node.v1.AccountLimits"),A(du,"fields",z.util.newFieldList(()=>[{no:1,name:"trace_sampling_rate",kind:"scalar",T:2}]));var NF=du,pu=class pu extends mt{constructor(t){super(),z.util.initPartial(t,this)}static fromBinary(t,n){return new pu().fromBinary(t,n)}static fromJson(t,n){return new pu().fromJson(t,n)}static fromJsonString(t,n){return new pu().fromJsonString(t,n)}static equals(t,n){return z.util.equals(pu,t,n)}};A(pu,"runtime",z),A(pu,"typeName","wg.cosmo.node.v1.SelfRegisterRequest"),A(pu,"fields",z.util.newFieldList(()=>[]));var SK=pu,fu=class fu extends mt{constructor(n){super();A(this,"response");A(this,"registrationInfo");z.util.initPartial(n,this)}static fromBinary(n,r){return new fu().fromBinary(n,r)}static fromJson(n,r){return new fu().fromJson(n,r)}static fromJsonString(n,r){return new fu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(fu,n,r)}};A(fu,"runtime",z),A(fu,"typeName","wg.cosmo.node.v1.SelfRegisterResponse"),A(fu,"fields",z.util.newFieldList(()=>[{no:1,name:"response",kind:"message",T:TF},{no:2,name:"registrationInfo",kind:"message",T:yF,opt:!0}]));var DK=fu,mu=class mu extends mt{constructor(n){super();A(this,"defaultFlushInterval",Ir.zero);A(this,"datasourceConfigurations",[]);A(this,"fieldConfigurations",[]);A(this,"graphqlSchema","");A(this,"typeConfigurations",[]);A(this,"stringStorage",{});A(this,"graphqlClientSchema");z.util.initPartial(n,this)}static fromBinary(n,r){return new mu().fromBinary(n,r)}static fromJson(n,r){return new mu().fromJson(n,r)}static fromJsonString(n,r){return new mu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(mu,n,r)}};A(mu,"runtime",z),A(mu,"typeName","wg.cosmo.node.v1.EngineConfiguration"),A(mu,"fields",z.util.newFieldList(()=>[{no:1,name:"defaultFlushInterval",kind:"scalar",T:3},{no:2,name:"datasource_configurations",kind:"message",T:_T,repeated:!0},{no:3,name:"field_configurations",kind:"message",T:DT,repeated:!0},{no:4,name:"graphqlSchema",kind:"scalar",T:9},{no:5,name:"type_configurations",kind:"message",T:EF,repeated:!0},{no:6,name:"string_storage",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:7,name:"graphql_client_schema",kind:"scalar",T:9,opt:!0}]));var af=mu,hu=class hu extends mt{constructor(n){super();A(this,"kind",Cc.STATIC);A(this,"rootNodes",[]);A(this,"childNodes",[]);A(this,"overrideFieldPathFromAlias",!1);A(this,"customGraphql");A(this,"customStatic");A(this,"directives",[]);A(this,"requestTimeoutSeconds",Ir.zero);A(this,"id","");A(this,"keys",[]);A(this,"provides",[]);A(this,"requires",[]);A(this,"customEvents");A(this,"entityInterfaces",[]);A(this,"interfaceObjects",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new hu().fromBinary(n,r)}static fromJson(n,r){return new hu().fromJson(n,r)}static fromJsonString(n,r){return new hu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(hu,n,r)}};A(hu,"runtime",z),A(hu,"typeName","wg.cosmo.node.v1.DataSourceConfiguration"),A(hu,"fields",z.util.newFieldList(()=>[{no:1,name:"kind",kind:"enum",T:z.getEnumType(Cc)},{no:2,name:"root_nodes",kind:"message",T:uf,repeated:!0},{no:3,name:"child_nodes",kind:"message",T:uf,repeated:!0},{no:4,name:"override_field_path_from_alias",kind:"scalar",T:8},{no:5,name:"custom_graphql",kind:"message",T:FT},{no:6,name:"custom_static",kind:"message",T:IF},{no:7,name:"directives",kind:"message",T:vF,repeated:!0},{no:8,name:"request_timeout_seconds",kind:"scalar",T:3},{no:9,name:"id",kind:"scalar",T:9},{no:10,name:"keys",kind:"message",T:rd,repeated:!0},{no:11,name:"provides",kind:"message",T:rd,repeated:!0},{no:12,name:"requires",kind:"message",T:rd,repeated:!0},{no:13,name:"custom_events",kind:"message",T:ad},{no:14,name:"entity_interfaces",kind:"message",T:cf,repeated:!0},{no:15,name:"interface_objects",kind:"message",T:cf,repeated:!0}]));var _T=hu,Tu=class Tu extends mt{constructor(n){super();A(this,"name","");A(this,"sourceType",id.OBJECT_FIELD);z.util.initPartial(n,this)}static fromBinary(n,r){return new Tu().fromBinary(n,r)}static fromJson(n,r){return new Tu().fromJson(n,r)}static fromJsonString(n,r){return new Tu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Tu,n,r)}};A(Tu,"runtime",z),A(Tu,"typeName","wg.cosmo.node.v1.ArgumentConfiguration"),A(Tu,"fields",z.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"source_type",kind:"enum",T:z.getEnumType(id)}]));var bT=Tu,yu=class yu extends mt{constructor(n){super();A(this,"requiredAndScopes",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new yu().fromBinary(n,r)}static fromJson(n,r){return new yu().fromJson(n,r)}static fromJsonString(n,r){return new yu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(yu,n,r)}};A(yu,"runtime",z),A(yu,"typeName","wg.cosmo.node.v1.Scopes"),A(yu,"fields",z.util.newFieldList(()=>[{no:1,name:"required_and_scopes",kind:"scalar",T:9,repeated:!0}]));var OT=yu,Nu=class Nu extends mt{constructor(n){super();A(this,"requiresAuthentication",!1);A(this,"requiredOrScopes",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Nu().fromBinary(n,r)}static fromJson(n,r){return new Nu().fromJson(n,r)}static fromJsonString(n,r){return new Nu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Nu,n,r)}};A(Nu,"runtime",z),A(Nu,"typeName","wg.cosmo.node.v1.AuthorizationConfiguration"),A(Nu,"fields",z.util.newFieldList(()=>[{no:1,name:"requires_authentication",kind:"scalar",T:8},{no:2,name:"required_or_scopes",kind:"message",T:OT,repeated:!0}]));var ST=Nu,Eu=class Eu extends mt{constructor(n){super();A(this,"typeName","");A(this,"fieldName","");A(this,"argumentsConfiguration",[]);A(this,"authorizationConfiguration");A(this,"subscriptionFilterCondition");z.util.initPartial(n,this)}static fromBinary(n,r){return new Eu().fromBinary(n,r)}static fromJson(n,r){return new Eu().fromJson(n,r)}static fromJsonString(n,r){return new Eu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Eu,n,r)}};A(Eu,"runtime",z),A(Eu,"typeName","wg.cosmo.node.v1.FieldConfiguration"),A(Eu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_name",kind:"scalar",T:9},{no:3,name:"arguments_configuration",kind:"message",T:bT,repeated:!0},{no:4,name:"authorization_configuration",kind:"message",T:ST},{no:5,name:"subscription_filter_condition",kind:"message",T:Uc,opt:!0}]));var DT=Eu,gu=class gu extends mt{constructor(n){super();A(this,"typeName","");A(this,"renameTo","");z.util.initPartial(n,this)}static fromBinary(n,r){return new gu().fromBinary(n,r)}static fromJson(n,r){return new gu().fromJson(n,r)}static fromJsonString(n,r){return new gu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(gu,n,r)}};A(gu,"runtime",z),A(gu,"typeName","wg.cosmo.node.v1.TypeConfiguration"),A(gu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"rename_to",kind:"scalar",T:9}]));var EF=gu,Iu=class Iu extends mt{constructor(n){super();A(this,"typeName","");A(this,"fieldNames",[]);A(this,"externalFieldNames",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Iu().fromBinary(n,r)}static fromJson(n,r){return new Iu().fromJson(n,r)}static fromJsonString(n,r){return new Iu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Iu,n,r)}};A(Iu,"runtime",z),A(Iu,"typeName","wg.cosmo.node.v1.TypeField"),A(Iu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_names",kind:"scalar",T:9,repeated:!0},{no:3,name:"external_field_names",kind:"scalar",T:9,repeated:!0}]));var uf=Iu,vu=class vu extends mt{constructor(n){super();A(this,"fieldName","");A(this,"typeName","");z.util.initPartial(n,this)}static fromBinary(n,r){return new vu().fromBinary(n,r)}static fromJson(n,r){return new vu().fromJson(n,r)}static fromJsonString(n,r){return new vu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(vu,n,r)}};A(vu,"runtime",z),A(vu,"typeName","wg.cosmo.node.v1.FieldCoordinates"),A(vu,"fields",z.util.newFieldList(()=>[{no:1,name:"field_name",kind:"scalar",T:9},{no:2,name:"type_name",kind:"scalar",T:9}]));var AT=vu,_u=class _u extends mt{constructor(n){super();A(this,"fieldCoordinatesPath",[]);A(this,"fieldPath",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new _u().fromBinary(n,r)}static fromJson(n,r){return new _u().fromJson(n,r)}static fromJsonString(n,r){return new _u().fromJsonString(n,r)}static equals(n,r){return z.util.equals(_u,n,r)}};A(_u,"runtime",z),A(_u,"typeName","wg.cosmo.node.v1.FieldSetCondition"),A(_u,"fields",z.util.newFieldList(()=>[{no:1,name:"field_coordinates_path",kind:"message",T:AT,repeated:!0},{no:2,name:"field_path",kind:"scalar",T:9,repeated:!0}]));var RT=_u,bu=class bu extends mt{constructor(n){super();A(this,"typeName","");A(this,"fieldName","");A(this,"selectionSet","");A(this,"disableEntityResolver",!1);A(this,"conditions",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new bu().fromBinary(n,r)}static fromJson(n,r){return new bu().fromJson(n,r)}static fromJsonString(n,r){return new bu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(bu,n,r)}};A(bu,"runtime",z),A(bu,"typeName","wg.cosmo.node.v1.RequiredField"),A(bu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_name",kind:"scalar",T:9},{no:3,name:"selection_set",kind:"scalar",T:9},{no:4,name:"disable_entity_resolver",kind:"scalar",T:8},{no:5,name:"conditions",kind:"message",T:RT,repeated:!0}]));var rd=bu,Ou=class Ou extends mt{constructor(n){super();A(this,"interfaceTypeName","");A(this,"concreteTypeNames",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Ou().fromBinary(n,r)}static fromJson(n,r){return new Ou().fromJson(n,r)}static fromJsonString(n,r){return new Ou().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Ou,n,r)}};A(Ou,"runtime",z),A(Ou,"typeName","wg.cosmo.node.v1.EntityInterfaceConfiguration"),A(Ou,"fields",z.util.newFieldList(()=>[{no:1,name:"interface_type_name",kind:"scalar",T:9},{no:2,name:"concrete_type_names",kind:"scalar",T:9,repeated:!0}]));var cf=Ou,Su=class Su extends mt{constructor(n){super();A(this,"url");A(this,"method",sd.GET);A(this,"header",{});A(this,"body");A(this,"query",[]);A(this,"urlEncodeBody",!1);A(this,"mtls");A(this,"baseUrl");A(this,"path");A(this,"httpProxyUrl");z.util.initPartial(n,this)}static fromBinary(n,r){return new Su().fromBinary(n,r)}static fromJson(n,r){return new Su().fromJson(n,r)}static fromJsonString(n,r){return new Su().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Su,n,r)}};A(Su,"runtime",z),A(Su,"typeName","wg.cosmo.node.v1.FetchConfiguration"),A(Su,"fields",z.util.newFieldList(()=>[{no:1,name:"url",kind:"message",T:Pi},{no:2,name:"method",kind:"enum",T:z.getEnumType(sd)},{no:3,name:"header",kind:"map",K:9,V:{kind:"message",T:bF}},{no:4,name:"body",kind:"message",T:Pi},{no:5,name:"query",kind:"message",T:_F,repeated:!0},{no:7,name:"url_encode_body",kind:"scalar",T:8},{no:8,name:"mtls",kind:"message",T:OF},{no:9,name:"base_url",kind:"message",T:Pi},{no:10,name:"path",kind:"message",T:Pi},{no:11,name:"http_proxy_url",kind:"message",T:Pi,opt:!0}]));var gF=Su,Du=class Du extends mt{constructor(n){super();A(this,"statusCode",Ir.zero);A(this,"typeName","");A(this,"injectStatusCodeIntoBody",!1);z.util.initPartial(n,this)}static fromBinary(n,r){return new Du().fromBinary(n,r)}static fromJson(n,r){return new Du().fromJson(n,r)}static fromJsonString(n,r){return new Du().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Du,n,r)}};A(Du,"runtime",z),A(Du,"typeName","wg.cosmo.node.v1.StatusCodeTypeMapping"),A(Du,"fields",z.util.newFieldList(()=>[{no:1,name:"status_code",kind:"scalar",T:3},{no:2,name:"type_name",kind:"scalar",T:9},{no:3,name:"inject_status_code_into_body",kind:"scalar",T:8}]));var AK=Du,Au=class Au extends mt{constructor(n){super();A(this,"fetch");A(this,"subscription");A(this,"federation");A(this,"upstreamSchema");A(this,"customScalarTypeFields",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Au().fromBinary(n,r)}static fromJson(n,r){return new Au().fromJson(n,r)}static fromJsonString(n,r){return new Au().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Au,n,r)}};A(Au,"runtime",z),A(Au,"typeName","wg.cosmo.node.v1.DataSourceCustom_GraphQL"),A(Au,"fields",z.util.newFieldList(()=>[{no:1,name:"fetch",kind:"message",T:gF},{no:2,name:"subscription",kind:"message",T:SF},{no:3,name:"federation",kind:"message",T:DF},{no:4,name:"upstream_schema",kind:"message",T:kT},{no:6,name:"custom_scalar_type_fields",kind:"message",T:AF,repeated:!0}]));var FT=Au,Ru=class Ru extends mt{constructor(n){super();A(this,"consumerName","");A(this,"streamName","");A(this,"consumerInactiveThreshold",0);z.util.initPartial(n,this)}static fromBinary(n,r){return new Ru().fromBinary(n,r)}static fromJson(n,r){return new Ru().fromJson(n,r)}static fromJsonString(n,r){return new Ru().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Ru,n,r)}};A(Ru,"runtime",z),A(Ru,"typeName","wg.cosmo.node.v1.NatsStreamConfiguration"),A(Ru,"fields",z.util.newFieldList(()=>[{no:1,name:"consumer_name",kind:"scalar",T:9},{no:2,name:"stream_name",kind:"scalar",T:9},{no:3,name:"consumer_inactive_threshold",kind:"scalar",T:5}]));var wT=Ru,Fu=class Fu extends mt{constructor(n){super();A(this,"engineEventConfiguration");A(this,"subjects",[]);A(this,"streamConfiguration");z.util.initPartial(n,this)}static fromBinary(n,r){return new Fu().fromBinary(n,r)}static fromJson(n,r){return new Fu().fromJson(n,r)}static fromJsonString(n,r){return new Fu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Fu,n,r)}};A(Fu,"runtime",z),A(Fu,"typeName","wg.cosmo.node.v1.NatsEventConfiguration"),A(Fu,"fields",z.util.newFieldList(()=>[{no:1,name:"engine_event_configuration",kind:"message",T:od},{no:2,name:"subjects",kind:"scalar",T:9,repeated:!0},{no:3,name:"stream_configuration",kind:"message",T:wT}]));var LT=Fu,wu=class wu extends mt{constructor(n){super();A(this,"engineEventConfiguration");A(this,"topics",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new wu().fromBinary(n,r)}static fromJson(n,r){return new wu().fromJson(n,r)}static fromJsonString(n,r){return new wu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(wu,n,r)}};A(wu,"runtime",z),A(wu,"typeName","wg.cosmo.node.v1.KafkaEventConfiguration"),A(wu,"fields",z.util.newFieldList(()=>[{no:1,name:"engine_event_configuration",kind:"message",T:od},{no:2,name:"topics",kind:"scalar",T:9,repeated:!0}]));var PT=wu,Lu=class Lu extends mt{constructor(n){super();A(this,"providerId","");A(this,"type",Gu.PUBLISH);A(this,"typeName","");A(this,"fieldName","");z.util.initPartial(n,this)}static fromBinary(n,r){return new Lu().fromBinary(n,r)}static fromJson(n,r){return new Lu().fromJson(n,r)}static fromJsonString(n,r){return new Lu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Lu,n,r)}};A(Lu,"runtime",z),A(Lu,"typeName","wg.cosmo.node.v1.EngineEventConfiguration"),A(Lu,"fields",z.util.newFieldList(()=>[{no:1,name:"provider_id",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:z.getEnumType(Gu)},{no:3,name:"type_name",kind:"scalar",T:9},{no:4,name:"field_name",kind:"scalar",T:9}]));var od=Lu,Pu=class Pu extends mt{constructor(n){super();A(this,"nats",[]);A(this,"kafka",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Pu().fromBinary(n,r)}static fromJson(n,r){return new Pu().fromJson(n,r)}static fromJsonString(n,r){return new Pu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Pu,n,r)}};A(Pu,"runtime",z),A(Pu,"typeName","wg.cosmo.node.v1.DataSourceCustomEvents"),A(Pu,"fields",z.util.newFieldList(()=>[{no:1,name:"nats",kind:"message",T:LT,repeated:!0},{no:2,name:"kafka",kind:"message",T:PT,repeated:!0}]));var ad=Pu,ku=class ku extends mt{constructor(n){super();A(this,"data");z.util.initPartial(n,this)}static fromBinary(n,r){return new ku().fromBinary(n,r)}static fromJson(n,r){return new ku().fromJson(n,r)}static fromJsonString(n,r){return new ku().fromJsonString(n,r)}static equals(n,r){return z.util.equals(ku,n,r)}};A(ku,"runtime",z),A(ku,"typeName","wg.cosmo.node.v1.DataSourceCustom_Static"),A(ku,"fields",z.util.newFieldList(()=>[{no:1,name:"data",kind:"message",T:Pi}]));var IF=ku,Cu=class Cu extends mt{constructor(n){super();A(this,"kind",xc.STATIC_CONFIGURATION_VARIABLE);A(this,"staticVariableContent","");A(this,"environmentVariableName","");A(this,"environmentVariableDefaultValue","");A(this,"placeholderVariableName","");z.util.initPartial(n,this)}static fromBinary(n,r){return new Cu().fromBinary(n,r)}static fromJson(n,r){return new Cu().fromJson(n,r)}static fromJsonString(n,r){return new Cu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Cu,n,r)}};A(Cu,"runtime",z),A(Cu,"typeName","wg.cosmo.node.v1.ConfigurationVariable"),A(Cu,"fields",z.util.newFieldList(()=>[{no:1,name:"kind",kind:"enum",T:z.getEnumType(xc)},{no:2,name:"static_variable_content",kind:"scalar",T:9},{no:3,name:"environment_variable_name",kind:"scalar",T:9},{no:4,name:"environment_variable_default_value",kind:"scalar",T:9},{no:5,name:"placeholder_variable_name",kind:"scalar",T:9}]));var Pi=Cu,xu=class xu extends mt{constructor(n){super();A(this,"directiveName","");A(this,"renameTo","");z.util.initPartial(n,this)}static fromBinary(n,r){return new xu().fromBinary(n,r)}static fromJson(n,r){return new xu().fromJson(n,r)}static fromJsonString(n,r){return new xu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(xu,n,r)}};A(xu,"runtime",z),A(xu,"typeName","wg.cosmo.node.v1.DirectiveConfiguration"),A(xu,"fields",z.util.newFieldList(()=>[{no:1,name:"directive_name",kind:"scalar",T:9},{no:2,name:"rename_to",kind:"scalar",T:9}]));var vF=xu,Uu=class Uu extends mt{constructor(n){super();A(this,"name","");A(this,"value","");z.util.initPartial(n,this)}static fromBinary(n,r){return new Uu().fromBinary(n,r)}static fromJson(n,r){return new Uu().fromJson(n,r)}static fromJsonString(n,r){return new Uu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Uu,n,r)}};A(Uu,"runtime",z),A(Uu,"typeName","wg.cosmo.node.v1.URLQueryConfiguration"),A(Uu,"fields",z.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"value",kind:"scalar",T:9}]));var _F=Uu,Mu=class Mu extends mt{constructor(n){super();A(this,"values",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Mu().fromBinary(n,r)}static fromJson(n,r){return new Mu().fromJson(n,r)}static fromJsonString(n,r){return new Mu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Mu,n,r)}};A(Mu,"runtime",z),A(Mu,"typeName","wg.cosmo.node.v1.HTTPHeader"),A(Mu,"fields",z.util.newFieldList(()=>[{no:1,name:"values",kind:"message",T:Pi,repeated:!0}]));var bF=Mu,Bu=class Bu extends mt{constructor(n){super();A(this,"key");A(this,"cert");A(this,"insecureSkipVerify",!1);z.util.initPartial(n,this)}static fromBinary(n,r){return new Bu().fromBinary(n,r)}static fromJson(n,r){return new Bu().fromJson(n,r)}static fromJsonString(n,r){return new Bu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Bu,n,r)}};A(Bu,"runtime",z),A(Bu,"typeName","wg.cosmo.node.v1.MTLSConfiguration"),A(Bu,"fields",z.util.newFieldList(()=>[{no:1,name:"key",kind:"message",T:Pi},{no:2,name:"cert",kind:"message",T:Pi},{no:3,name:"insecureSkipVerify",kind:"scalar",T:8}]));var OF=Bu,Vu=class Vu extends mt{constructor(n){super();A(this,"enabled",!1);A(this,"url");A(this,"useSSE");A(this,"protocol");A(this,"websocketSubprotocol");z.util.initPartial(n,this)}static fromBinary(n,r){return new Vu().fromBinary(n,r)}static fromJson(n,r){return new Vu().fromJson(n,r)}static fromJsonString(n,r){return new Vu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Vu,n,r)}};A(Vu,"runtime",z),A(Vu,"typeName","wg.cosmo.node.v1.GraphQLSubscriptionConfiguration"),A(Vu,"fields",z.util.newFieldList(()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"url",kind:"message",T:Pi},{no:3,name:"useSSE",kind:"scalar",T:8,opt:!0},{no:4,name:"protocol",kind:"enum",T:z.getEnumType(nu),opt:!0},{no:5,name:"websocketSubprotocol",kind:"enum",T:z.getEnumType(ru),opt:!0}]));var SF=Vu,ju=class ju extends mt{constructor(n){super();A(this,"enabled",!1);A(this,"serviceSdl","");z.util.initPartial(n,this)}static fromBinary(n,r){return new ju().fromBinary(n,r)}static fromJson(n,r){return new ju().fromJson(n,r)}static fromJsonString(n,r){return new ju().fromJsonString(n,r)}static equals(n,r){return z.util.equals(ju,n,r)}};A(ju,"runtime",z),A(ju,"typeName","wg.cosmo.node.v1.GraphQLFederationConfiguration"),A(ju,"fields",z.util.newFieldList(()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"serviceSdl",kind:"scalar",T:9}]));var DF=ju,$u=class $u extends mt{constructor(n){super();A(this,"key","");z.util.initPartial(n,this)}static fromBinary(n,r){return new $u().fromBinary(n,r)}static fromJson(n,r){return new $u().fromJson(n,r)}static fromJsonString(n,r){return new $u().fromJsonString(n,r)}static equals(n,r){return z.util.equals($u,n,r)}};A($u,"runtime",z),A($u,"typeName","wg.cosmo.node.v1.InternedString"),A($u,"fields",z.util.newFieldList(()=>[{no:1,name:"key",kind:"scalar",T:9}]));var kT=$u,qu=class qu extends mt{constructor(n){super();A(this,"typeName","");A(this,"fieldName","");z.util.initPartial(n,this)}static fromBinary(n,r){return new qu().fromBinary(n,r)}static fromJson(n,r){return new qu().fromJson(n,r)}static fromJsonString(n,r){return new qu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(qu,n,r)}};A(qu,"runtime",z),A(qu,"typeName","wg.cosmo.node.v1.SingleTypeField"),A(qu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_name",kind:"scalar",T:9}]));var AF=qu,Ku=class Ku extends mt{constructor(n){super();A(this,"fieldPath",[]);A(this,"json","");z.util.initPartial(n,this)}static fromBinary(n,r){return new Ku().fromBinary(n,r)}static fromJson(n,r){return new Ku().fromJson(n,r)}static fromJsonString(n,r){return new Ku().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Ku,n,r)}};A(Ku,"runtime",z),A(Ku,"typeName","wg.cosmo.node.v1.SubscriptionFieldCondition"),A(Ku,"fields",z.util.newFieldList(()=>[{no:1,name:"field_path",kind:"scalar",T:9,repeated:!0},{no:2,name:"json",kind:"scalar",T:9}]));var CT=Ku,Zs=class Zs extends mt{constructor(n){super();A(this,"and",[]);A(this,"in");A(this,"not");A(this,"or",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Zs().fromBinary(n,r)}static fromJson(n,r){return new Zs().fromJson(n,r)}static fromJsonString(n,r){return new Zs().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Zs,n,r)}};A(Zs,"runtime",z),A(Zs,"typeName","wg.cosmo.node.v1.SubscriptionFilterCondition"),A(Zs,"fields",z.util.newFieldList(()=>[{no:1,name:"and",kind:"message",T:Zs,repeated:!0},{no:2,name:"in",kind:"message",T:CT,opt:!0},{no:3,name:"not",kind:"message",T:Zs,opt:!0},{no:4,name:"or",kind:"message",T:Zs,repeated:!0}]));var Uc=Zs;m();T();h();var VI=e_(fI(),1);function ype(e){if(!e.conditions)return;let t=[];for(let n of e.conditions){let r=[];for(let i of n.fieldCoordinatesPath){let s=i.split(".");if(s.length!==2)throw new Error(`fatal: malformed conditional field coordinates "${i}" for field set "${e.selectionSet}".`);r.push(new AT({fieldName:s[1],typeName:s[0]}))}t.push(new RT({fieldCoordinatesPath:r,fieldPath:n.fieldPath}))}return t}function RF(e,t,n){if(e)for(let r of e){let i=ype(r);t.push(new rd(k(k({typeName:n,fieldName:r.fieldName,selectionSet:r.selectionSet},r.disableEntityResolver?{disableEntityResolver:!0}:{}),i?{conditions:i}:{})))}}function RK(e){switch(e){case"publish":return Gu.PUBLISH;case"request":return Gu.REQUEST;case"subscribe":return Gu.SUBSCRIBE}}function FK(e){var n;let t={rootNodes:[],childNodes:[],keys:[],provides:[],events:new ad({nats:[],kafka:[]}),requires:[],entityInterfaces:[],interfaceObjects:[]};for(let r of e.values()){let i=r.typeName,s=[...r.fieldNames],o=new uf({typeName:i,fieldNames:s});if(r.externalFieldNames&&r.externalFieldNames.size>0&&(o.externalFieldNames=[...r.externalFieldNames]),r.isRootNode?t.rootNodes.push(o):t.childNodes.push(o),r.entityInterfaceConcreteTypeNames){let d=new cf({interfaceTypeName:i,concreteTypeNames:[...r.entityInterfaceConcreteTypeNames]});r.isInterfaceObject?t.interfaceObjects.push(d):t.entityInterfaces.push(d)}RF(r.keys,t.keys,i),RF(r.provides,t.provides,i),RF(r.requires,t.requires,i);let u=[],l=[];for(let d of(n=r.events)!=null?n:[])switch(d.providerType){case VI.PROVIDER_TYPE_KAFKA:{l.push(new PT({engineEventConfiguration:new od({fieldName:d.fieldName,providerId:d.providerId,type:RK(d.type),typeName:i}),topics:d.topics}));break}case VI.PROVIDER_TYPE_NATS:{u.push(new LT(k({engineEventConfiguration:new od({fieldName:d.fieldName,providerId:d.providerId,type:RK(d.type),typeName:i}),subjects:d.subjects},d.streamConfiguration?{streamConfiguration:new wT({consumerInactiveThreshold:d.streamConfiguration.consumerInactiveThreshold,consumerName:d.streamConfiguration.consumerName,streamName:d.streamConfiguration.streamName})}:{})));break}default:throw new Error("Fatal: Unknown event provider.")}t.events.nats.push(...u),t.events.kafka.push(...l)}return t}function wK(e){var n;let t=[];for(let r of e){let i=r.argumentNames.map(l=>new bT({name:l,sourceType:id.FIELD_ARGUMENT})),s=new DT({argumentsConfiguration:i,fieldName:r.fieldName,typeName:r.typeName}),o=((n=r.requiredScopes)==null?void 0:n.map(l=>new OT({requiredAndScopes:l})))||[],u=o.length>0;if((r.requiresAuthentication||u)&&(s.authorizationConfiguration=new ST({requiresAuthentication:r.requiresAuthentication||u,requiredOrScopes:o})),r.subscriptionFilterCondition){let l=new Uc;BI(l,r.subscriptionFilterCondition),s.subscriptionFilterCondition=l}t.push(s)}return t}function BI(e,t){if(t.and!==void 0){let n=[];for(let r of t.and){let i=new Uc;BI(i,r),n.push(i)}e.and=n;return}if(t.in!==void 0){e.in=new CT({fieldPath:t.in.fieldPath,json:JSON.stringify(t.in.values)});return}if(t.not!==void 0){e.not=new Uc,BI(e.not,t.not);return}if(t.or!==void 0){let n=[];for(let r of t.or){let i=new Uc;BI(i,r),n.push(i)}e.or=n;return}throw new Error("Fatal: Incoming SubscriptionCondition object was malformed.")}m();T();h();function FF(e){return new Error(`Normalization failed to return a ${e}.`)}var Npe=(e,t)=>{let n=stringHash(t);return e.stringStorage[n]=t,new kT({key:n})},Epe=e=>{switch(e){case"ws":return nu.GRAPHQL_SUBSCRIPTION_PROTOCOL_WS;case"sse":return nu.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE;case"sse_post":return nu.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST}throw new Error(`Unsupported subscription protocol '${e}'`)},gpe=e=>{switch(e){case"auto":return ru.GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO;case"graphql-ws":return ru.GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS;case"graphql-transport-ws":return ru.GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS}throw new Error(`Unsupported websocket subprotocol '${e}'`)},PK=function(e){let t=new af({defaultFlushInterval:BigInt(500),datasourceConfigurations:[],fieldConfigurations:[],graphqlSchema:"",stringStorage:{},typeConfigurations:[]});for(let n of e.subgraphs){if(!n.configurationDataByTypeName)throw FF("ConfigurationDataByTypeName");if(!n.schema)throw FF("GraphQLSchema");let r=Npe(t,$q(Qm(n.schema))),{childNodes:i,entityInterfaces:s,events:o,interfaceObjects:u,keys:l,provides:d,requires:p,rootNodes:y}=FK(n.configurationDataByTypeName),N=Epe(n.subscriptionProtocol||"ws"),I=gpe(n.websocketSubprotocol||"auto"),O,x,V;if(o.kafka.length>0||o.nats.length>0){O=Cc.PUBSUB,V=new ad({kafka:o.kafka,nats:o.nats});let re=he=>LK.ROOT_TYPE_NAMES.has(he.typeName),se=0,fe=0;for(;se({id:n.id,name:n.name,routingUrl:n.url}))})};m();T();h();Le();function kK(e){let t;try{t=io(e.schema)}catch(n){throw new Error(`could not parse schema for Graph ${e.name}: ${n}`)}return{definitions:t,name:e.name,url:e.url}}function Ipe(e){let{federationResult:t,errors:n}=(0,wF.federateSubgraphs)(e.map(kK));if(n&&n.length>0)throw new Error(`could not federate schema: ${n.map(r=>r.message).join(", ")}`);return{fieldConfigurations:t.fieldConfigurations,sdl:Ft(t.federatedGraphAST)}}function vpe(e){let t=(0,wF.federateSubgraphs)(e.map(kK));if(t.errors&&t.errors.length>0)throw new Error(`could not federate schema: ${t.errors.map(r=>r.message).join(", ")}`);if(t.federationResult===void 0)throw new Error("could not federate subgraphs");return PK({federatedClientSDL:ep(t.federationResult.federatedGraphClientSchema),federatedSDL:ep(t.federationResult.federatedGraphSchema),fieldConfigurations:t.federationResult.fieldConfigurations,schemaVersionId:"",subgraphs:e.map((r,i)=>{var l,d;let s=t.federationResult.subgraphConfigBySubgraphName.get(r.name),o=s==null?void 0:s.schema,u=s==null?void 0:s.configurationDataByTypeName;return{id:`${i}`,name:r.name,url:XR(r.url),sdl:r.schema,subscriptionUrl:XR((l=r.subscription_url)!=null?l:r.url),subscriptionProtocol:(d=r.subscription_protocol)!=null?d:"ws",websocketSubprotocol:r.subscription_protocol==="ws"?r.websocketSubprotocol||"auto":void 0,schema:o,configurationDataByTypeName:u}})}).toJsonString()}return Me(_pe);})(); +`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:o=s,i=1;break;case 1:n[r++]=o<<2|(s&48)>>4,o=s,i=2;break;case 2:n[r++]=(o&15)<<4|(s&60)>>2,o=s,i=3;break;case 3:n[r++]=(o&3)<<6|s,i=0;break}}if(i==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(e){let t="",n=0,r,i=0;for(let s=0;s>2],i=(r&3)<<4,n=1;break;case 1:t+=tu[i|r>>4],i=(r&15)<<2,n=2;break;case 2:t+=tu[i|r>>6],t+=tu[r&63],n=0;break}return n&&(t+=tu[i],t+="=",n==1&&(t+="=")),t}};m();T();h();function rK(e,t,n){sK(t,e);let r=t.runtime.bin.makeReadOptions(n),i=nK(e.getType().runtime.bin.listUnknownFields(e),t.field),[s,o]=SI(t);for(let u of i)t.runtime.bin.readField(s,r.readerFactory(u.data),t.field,u.wireType,r);return o()}function iK(e,t,n,r){sK(t,e);let i=t.runtime.bin.makeReadOptions(r),s=t.runtime.bin.makeWriteOptions(r);if(uF(e,t)){let d=e.getType().runtime.bin.listUnknownFields(e).filter(p=>p.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(let p of d)e.getType().runtime.bin.onUnknownField(e,p.no,p.wireType,p.data)}let o=s.writerFactory(),u=t.field;!u.opt&&!u.repeated&&(u.kind=="enum"||u.kind=="scalar")&&(u=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(u,n,o,s);let l=i.readerFactory(o.finish());for(;l.posr.no==t.field.no)}function sK(e,t){Fn(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}m();T();h();function AI(e,t){let n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?t[n]!==void 0:e.kind=="enum"?t[n]!==e.T.values[0].no:!_I(e.T,t[n]);case"message":return t[n]!==void 0;case"map":return Object.keys(t[n]).length>0}}function cF(e,t){let n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=r?e.T.values[0].no:void 0;break;case"scalar":t[n]=r?So(e.T,e.L):void 0;break;case"message":t[n]=void 0;break}}m();T();h();m();T();h();function Do(e,t){if(e===null||typeof e!="object"||!Object.getOwnPropertyNames(mt.prototype).every(r=>r in e&&typeof e[r]=="function"))return!1;let n=e.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:t===void 0?!0:n.typeName==t.typeName}function RI(e,t){return Do(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}var m3e={"google.protobuf.DoubleValue":Ee.DOUBLE,"google.protobuf.FloatValue":Ee.FLOAT,"google.protobuf.Int64Value":Ee.INT64,"google.protobuf.UInt64Value":Ee.UINT64,"google.protobuf.Int32Value":Ee.INT32,"google.protobuf.UInt32Value":Ee.UINT32,"google.protobuf.BoolValue":Ee.BOOL,"google.protobuf.StringValue":Ee.STRING,"google.protobuf.BytesValue":Ee.BYTES};var oK={ignoreUnknownFields:!1},aK={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function rpe(e){return e?Object.assign(Object.assign({},oK),e):oK}function ipe(e){return e?Object.assign(Object.assign({},aK),e):aK}var LI=Symbol(),FI=Symbol();function lK(){return{makeReadOptions:rpe,makeWriteOptions:ipe,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!="object")throw new Error(`cannot decode message ${e.typeName} from JSON: ${ha(t)}`);r=r!=null?r:new e;let i=new Map,s=n.typeRegistry;for(let[o,u]of Object.entries(t)){let l=e.fields.findJsonName(o);if(l){if(l.oneof){if(u===null&&l.kind=="scalar")continue;let d=i.get(l.oneof);if(d!==void 0)throw new Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${d}", "${o}"`);i.set(l.oneof,o)}uK(r,u,l,n,e)}else{let d=!1;if(s!=null&&s.findExtension&&o.startsWith("[")&&o.endsWith("]")){let p=s.findExtension(o.substring(1,o.length-1));if(p&&p.extendee.typeName==e.typeName){d=!0;let[y,N]=SI(p);uK(y,u,p.field,n,p),iK(r,p,N(),n)}}if(!d&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${e.typeName} from JSON: key "${o}" is unknown`)}}return r},writeMessage(e,t){let n=e.getType(),r={},i;try{for(i of n.fields.byNumber()){if(!AI(i,e)){if(i.req)throw"required field not set";if(!t.emitDefaultValues||!ope(i))continue}let o=i.oneof?e[i.oneof.localName].value:e[i.localName],u=cK(i,o,t);u!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=u)}let s=t.typeRegistry;if(s!=null&&s.findExtensionFor)for(let o of n.runtime.bin.listUnknownFields(e)){let u=s.findExtensionFor(n.typeName,o.no);if(u&&uF(e,u)){let l=rK(e,u,t),d=cK(u.field,l,t);d!==void 0&&(r[u.field.jsonName]=d)}}}catch(s){let o=i?`cannot encode field ${n.typeName}.${i.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,u=s instanceof Error?s.message:String(s);throw new Error(o+(u.length>0?`: ${u}`:""))}return r},readScalar(e,t,n){return ET(e,t,n!=null?n:Oo.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||_I(e,t)))return wI(e,t)},debug:ha}}function ha(e){if(e===null)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":`"${e.split('"').join('\\"')}"`;default:return String(e)}}function uK(e,t,n,r,i){let s=n.localName;if(n.repeated){if(Fn(n.kind!="map"),t===null)return;if(!Array.isArray(t))throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(t)}`);let o=e[s];for(let u of t){if(u===null)throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(u)}`);switch(n.kind){case"message":o.push(n.T.fromJson(u,r));break;case"enum":let l=lF(n.T,u,r.ignoreUnknownFields,!0);l!==FI&&o.push(l);break;case"scalar":try{o.push(ET(n.T,u,n.L,!0))}catch(d){let p=`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(u)}`;throw d instanceof Error&&d.message.length>0&&(p+=`: ${d.message}`),new Error(p)}break}}}else if(n.kind=="map"){if(t===null)return;if(typeof t!="object"||Array.isArray(t))throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(t)}`);let o=e[s];for(let[u,l]of Object.entries(t)){if(l===null)throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: map value null`);let d;try{d=spe(n.K,u)}catch(p){let y=`cannot decode map key for field ${i.typeName}.${n.name} from JSON: ${ha(t)}`;throw p instanceof Error&&p.message.length>0&&(y+=`: ${p.message}`),new Error(y)}switch(n.V.kind){case"message":o[d]=n.V.T.fromJson(l,r);break;case"enum":let p=lF(n.V.T,l,r.ignoreUnknownFields,!0);p!==FI&&(o[d]=p);break;case"scalar":try{o[d]=ET(n.V.T,l,Oo.BIGINT,!0)}catch(y){let N=`cannot decode map value for field ${i.typeName}.${n.name} from JSON: ${ha(t)}`;throw y instanceof Error&&y.message.length>0&&(N+=`: ${y.message}`),new Error(N)}break}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:s},s="value"),n.kind){case"message":let o=n.T;if(t===null&&o.typeName!="google.protobuf.Value")return;let u=e[s];Do(u)?u.fromJson(t,r):(e[s]=u=o.fromJson(t,r),o.fieldWrapper&&!n.oneof&&(e[s]=o.fieldWrapper.unwrapField(u)));break;case"enum":let l=lF(n.T,t,r.ignoreUnknownFields,!1);switch(l){case LI:cF(n,e);break;case FI:break;default:e[s]=l;break}break;case"scalar":try{let d=ET(n.T,t,n.L,!1);switch(d){case LI:cF(n,e);break;default:e[s]=d;break}}catch(d){let p=`cannot decode field ${i.typeName}.${n.name} from JSON: ${ha(t)}`;throw d instanceof Error&&d.message.length>0&&(p+=`: ${d.message}`),new Error(p)}break}}function spe(e,t){if(e===Ee.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1;break}return ET(e,t,Oo.BIGINT,!0).toString()}function ET(e,t,n,r){if(t===null)return r?So(e,n):LI;switch(e){case Ee.DOUBLE:case Ee.FLOAT:if(t==="NaN")return Number.NaN;if(t==="Infinity")return Number.POSITIVE_INFINITY;if(t==="-Infinity")return Number.NEGATIVE_INFINITY;if(t===""||typeof t=="string"&&t.trim().length!==t.length||typeof t!="string"&&typeof t!="number")break;let i=Number(t);if(Number.isNaN(i)||!Number.isFinite(i))break;return e==Ee.FLOAT&&gI(i),i;case Ee.INT32:case Ee.FIXED32:case Ee.SFIXED32:case Ee.SINT32:case Ee.UINT32:let s;if(typeof t=="number"?s=t:typeof t=="string"&&t.length>0&&t.trim().length===t.length&&(s=Number(t)),s===void 0)break;return e==Ee.UINT32||e==Ee.FIXED32?NT(s):rf(s),s;case Ee.INT64:case Ee.SFIXED64:case Ee.SINT64:if(typeof t!="number"&&typeof t!="string")break;let o=Ir.parse(t);return n?o.toString():o;case Ee.FIXED64:case Ee.UINT64:if(typeof t!="number"&&typeof t!="string")break;let u=Ir.uParse(t);return n?u.toString():u;case Ee.BOOL:if(typeof t!="boolean")break;return t;case Ee.STRING:if(typeof t!="string")break;try{encodeURIComponent(t)}catch(l){throw new Error("invalid UTF8")}return t;case Ee.BYTES:if(t==="")return new Uint8Array(0);if(typeof t!="string")break;return aF.dec(t)}throw new Error}function lF(e,t,n,r){if(t===null)return e.typeName=="google.protobuf.NullValue"?0:r?e.values[0].no:LI;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":let i=e.findName(t);if(i!==void 0)return i.no;if(n)return FI;break}throw new Error(`cannot decode enum ${e.typeName} from JSON: ${ha(t)}`)}function ope(e){return e.repeated||e.kind=="map"?!0:!(e.oneof||e.kind=="message"||e.opt||e.req)}function cK(e,t,n){if(e.kind=="map"){Fn(typeof t=="object"&&t!=null);let r={},i=Object.entries(t);switch(e.V.kind){case"scalar":for(let[o,u]of i)r[o.toString()]=wI(e.V.T,u);break;case"message":for(let[o,u]of i)r[o.toString()]=u.toJson(n);break;case"enum":let s=e.V.T;for(let[o,u]of i)r[o.toString()]=dF(s,u,n.enumAsInteger);break}return n.emitDefaultValues||i.length>0?r:void 0}if(e.repeated){Fn(Array.isArray(t));let r=[];switch(e.kind){case"scalar":for(let i=0;i0?r:void 0}switch(e.kind){case"scalar":return wI(e.T,t);case"enum":return dF(e.T,t,n.enumAsInteger);case"message":return RI(e.T,t).toJson(n)}}function dF(e,t,n){var r;if(Fn(typeof t=="number"),e.typeName=="google.protobuf.NullValue")return null;if(n)return t;let i=e.findNumber(t);return(r=i==null?void 0:i.name)!==null&&r!==void 0?r:t}function wI(e,t){switch(e){case Ee.INT32:case Ee.SFIXED32:case Ee.SINT32:case Ee.FIXED32:case Ee.UINT32:return Fn(typeof t=="number"),t;case Ee.FLOAT:case Ee.DOUBLE:return Fn(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case Ee.STRING:return Fn(typeof t=="string"),t;case Ee.BOOL:return Fn(typeof t=="boolean"),t;case Ee.UINT64:case Ee.FIXED64:case Ee.INT64:case Ee.SFIXED64:case Ee.SINT64:return Fn(typeof t=="bigint"||typeof t=="string"||typeof t=="number"),t.toString();case Ee.BYTES:return Fn(t instanceof Uint8Array),aF.enc(t)}}m();T();h();var sf=Symbol("@bufbuild/protobuf/unknown-fields"),dK={readUnknownFields:!0,readerFactory:e=>new OI(e)},pK={writeUnknownFields:!0,writerFactory:()=>new bI};function ape(e){return e?Object.assign(Object.assign({},dK),e):dK}function upe(e){return e?Object.assign(Object.assign({},pK),e):pK}function TK(){return{makeReadOptions:ape,makeWriteOptions:upe,listUnknownFields(e){var t;return(t=e[sf])!==null&&t!==void 0?t:[]},discardUnknownFields(e){delete e[sf]},writeUnknownFields(e,t){let r=e[sf];if(r)for(let i of r)t.tag(i.no,i.wireType).raw(i.data)},onUnknownField(e,t,n,r){let i=e;Array.isArray(i[sf])||(i[sf]=[]),i[sf].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,i){let s=e.getType(),o=i?t.len:t.pos+n,u,l;for(;t.pos0&&(l=lpe),s){let N=e[o];if(r==mr.LengthDelimited&&u!=Ee.STRING&&u!=Ee.BYTES){let O=t.uint32()+t.pos;for(;t.posDo(N,y)?N:new y(N));else{let N=o[i];y.fieldWrapper?y.typeName==="google.protobuf.BytesValue"?s[i]=IT(N):s[i]=N:s[i]=Do(N,y)?N:new y(N)}break}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(r=>{let i=t[r.localName],s=n[r.localName];if(r.repeated){if(i.length!==s.length)return!1;switch(r.kind){case"message":return i.every((o,u)=>r.T.equals(o,s[u]));case"scalar":return i.every((o,u)=>eu(r.T,o,s[u]));case"enum":return i.every((o,u)=>eu(Ee.INT32,o,s[u]))}throw new Error(`repeated cannot contain ${r.kind}`)}switch(r.kind){case"message":return r.T.equals(i,s);case"enum":return eu(Ee.INT32,i,s);case"scalar":return eu(r.T,i,s);case"oneof":if(i.case!==s.case)return!1;let o=r.findField(i.case);if(o===void 0)return!0;switch(o.kind){case"message":return o.T.equals(i.value,s.value);case"enum":return eu(Ee.INT32,i.value,s.value);case"scalar":return eu(o.T,i.value,s.value)}throw new Error(`oneof cannot contain ${o.kind}`);case"map":let u=Object.keys(i).concat(Object.keys(s));switch(r.V.kind){case"message":let l=r.V.T;return u.every(p=>l.equals(i[p],s[p]));case"enum":return u.every(p=>eu(Ee.INT32,i[p],s[p]));case"scalar":let d=r.V.T;return u.every(p=>eu(d,i[p],s[p]))}break}})},clone(e){let t=e.getType(),n=new t,r=n;for(let i of t.fields.byMember()){let s=e[i.localName],o;if(i.repeated)o=s.map(CI);else if(i.kind=="map"){o=r[i.localName];for(let[u,l]of Object.entries(s))o[u]=CI(l)}else i.kind=="oneof"?o=i.findField(s.case)?{case:s.case,value:CI(s.value)}:{case:void 0}:o=CI(s);r[i.localName]=o}for(let i of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,i.no,i.wireType,i.data);return n}}}function CI(e){if(e===void 0)return e;if(Do(e))return e.clone();if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function IT(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function EK(e,t,n){return{syntax:e,json:lK(),bin:TK(),util:Object.assign(Object.assign({},NK()),{newFieldList:t,initFields:n}),makeMessageType(r,i,s){return zq(this,r,i,s)},makeEnum:Yq,makeEnumType:nF,getEnumType:Qq,makeExtension(r,i,s){return tK(this,r,i,s)}}}m();T();h();var xI=class{constructor(t,n){this._fields=t,this._normalizer=n}findJsonName(t){if(!this.jsonNames){let n={};for(let r of this.list())n[r.jsonName]=n[r.name]=r;this.jsonNames=n}return this.jsonNames[t]}find(t){if(!this.numbers){let n={};for(let r of this.list())n[r.no]=r;this.numbers=n}return this.numbers[t]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((t,n)=>t.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];let t=this.members,n;for(let r of this.list())r.oneof?r.oneof!==n&&(n=r.oneof,t.push(n)):t.push(r)}return this.members}};m();T();h();m();T();h();m();T();h();function pF(e,t){let n=vK(e);return t?n:Tpe(hpe(n))}function gK(e){return pF(e,!1)}var IK=vK;function vK(e){let t=!1,n=[];for(let r=0;r`${e}$`,hpe=e=>mpe.has(e)?_K(e):e,Tpe=e=>fpe.has(e)?_K(e):e;var UI=class{constructor(t){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=t,this.localName=gK(t)}addField(t){Fn(t.oneof===this,`field ${t.name} not one of ${this.name}`),this.fields.push(t)}findField(t){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;nnew xI(e,t=>bK(t,!0)),e=>{for(let t of e.getType().fields.byMember()){if(t.opt)continue;let n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case"oneof":r[n]={case:void 0};break;case"enum":r[n]=0;break;case"map":r[n]={};break;case"scalar":r[n]=So(t.T,t.L);break;case"message":break}}});var of;(function(e){e[e.OK=0]="OK",e[e.ERR=1]="ERR",e[e.ERR_NOT_FOUND=2]="ERR_NOT_FOUND",e[e.ERR_ALREADY_EXISTS=3]="ERR_ALREADY_EXISTS",e[e.ERR_INVALID_SUBGRAPH_SCHEMA=4]="ERR_INVALID_SUBGRAPH_SCHEMA",e[e.ERR_SUBGRAPH_COMPOSITION_FAILED=5]="ERR_SUBGRAPH_COMPOSITION_FAILED",e[e.ERR_SUBGRAPH_CHECK_FAILED=6]="ERR_SUBGRAPH_CHECK_FAILED",e[e.ERR_INVALID_LABELS=7]="ERR_INVALID_LABELS",e[e.ERR_ANALYTICS_DISABLED=8]="ERR_ANALYTICS_DISABLED",e[e.ERROR_NOT_AUTHENTICATED=9]="ERROR_NOT_AUTHENTICATED",e[e.ERR_OPENAI_DISABLED=10]="ERR_OPENAI_DISABLED",e[e.ERR_FREE_TRIAL_EXPIRED=11]="ERR_FREE_TRIAL_EXPIRED",e[e.ERROR_NOT_AUTHORIZED=12]="ERROR_NOT_AUTHORIZED",e[e.ERR_LIMIT_REACHED=13]="ERR_LIMIT_REACHED",e[e.ERR_DEPLOYMENT_FAILED=14]="ERR_DEPLOYMENT_FAILED",e[e.ERR_INVALID_NAME=15]="ERR_INVALID_NAME"})(of||(of={}));z.util.setEnumType(of,"wg.cosmo.common.EnumStatusCode",[{no:0,name:"OK"},{no:1,name:"ERR"},{no:2,name:"ERR_NOT_FOUND"},{no:3,name:"ERR_ALREADY_EXISTS"},{no:4,name:"ERR_INVALID_SUBGRAPH_SCHEMA"},{no:5,name:"ERR_SUBGRAPH_COMPOSITION_FAILED"},{no:6,name:"ERR_SUBGRAPH_CHECK_FAILED"},{no:7,name:"ERR_INVALID_LABELS"},{no:8,name:"ERR_ANALYTICS_DISABLED"},{no:9,name:"ERROR_NOT_AUTHENTICATED"},{no:10,name:"ERR_OPENAI_DISABLED"},{no:11,name:"ERR_FREE_TRIAL_EXPIRED"},{no:12,name:"ERROR_NOT_AUTHORIZED"},{no:13,name:"ERR_LIMIT_REACHED"},{no:14,name:"ERR_DEPLOYMENT_FAILED"},{no:15,name:"ERR_INVALID_NAME"}]);var nu;(function(e){e[e.GRAPHQL_SUBSCRIPTION_PROTOCOL_WS=0]="GRAPHQL_SUBSCRIPTION_PROTOCOL_WS",e[e.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE=1]="GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE",e[e.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST=2]="GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST"})(nu||(nu={}));z.util.setEnumType(nu,"wg.cosmo.common.GraphQLSubscriptionProtocol",[{no:0,name:"GRAPHQL_SUBSCRIPTION_PROTOCOL_WS"},{no:1,name:"GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE"},{no:2,name:"GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST"}]);var ru;(function(e){e[e.GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO=0]="GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO",e[e.GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS=1]="GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS",e[e.GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS=2]="GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS"})(ru||(ru={}));z.util.setEnumType(ru,"wg.cosmo.common.GraphQLWebsocketSubprotocol",[{no:0,name:"GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO"},{no:1,name:"GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS"},{no:2,name:"GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS"}]);m();T();h();var fF;(function(e){e[e.RENDER_ARGUMENT_DEFAULT=0]="RENDER_ARGUMENT_DEFAULT",e[e.RENDER_ARGUMENT_AS_GRAPHQL_VALUE=1]="RENDER_ARGUMENT_AS_GRAPHQL_VALUE",e[e.RENDER_ARGUMENT_AS_ARRAY_CSV=2]="RENDER_ARGUMENT_AS_ARRAY_CSV"})(fF||(fF={}));z.util.setEnumType(fF,"wg.cosmo.node.v1.ArgumentRenderConfiguration",[{no:0,name:"RENDER_ARGUMENT_DEFAULT"},{no:1,name:"RENDER_ARGUMENT_AS_GRAPHQL_VALUE"},{no:2,name:"RENDER_ARGUMENT_AS_ARRAY_CSV"}]);var id;(function(e){e[e.OBJECT_FIELD=0]="OBJECT_FIELD",e[e.FIELD_ARGUMENT=1]="FIELD_ARGUMENT"})(id||(id={}));z.util.setEnumType(id,"wg.cosmo.node.v1.ArgumentSource",[{no:0,name:"OBJECT_FIELD"},{no:1,name:"FIELD_ARGUMENT"}]);var Cc;(function(e){e[e.STATIC=0]="STATIC",e[e.GRAPHQL=1]="GRAPHQL",e[e.PUBSUB=2]="PUBSUB"})(Cc||(Cc={}));z.util.setEnumType(Cc,"wg.cosmo.node.v1.DataSourceKind",[{no:0,name:"STATIC"},{no:1,name:"GRAPHQL"},{no:2,name:"PUBSUB"}]);var Gu;(function(e){e[e.PUBLISH=0]="PUBLISH",e[e.REQUEST=1]="REQUEST",e[e.SUBSCRIBE=2]="SUBSCRIBE"})(Gu||(Gu={}));z.util.setEnumType(Gu,"wg.cosmo.node.v1.EventType",[{no:0,name:"PUBLISH"},{no:1,name:"REQUEST"},{no:2,name:"SUBSCRIBE"}]);var xc;(function(e){e[e.STATIC_CONFIGURATION_VARIABLE=0]="STATIC_CONFIGURATION_VARIABLE",e[e.ENV_CONFIGURATION_VARIABLE=1]="ENV_CONFIGURATION_VARIABLE",e[e.PLACEHOLDER_CONFIGURATION_VARIABLE=2]="PLACEHOLDER_CONFIGURATION_VARIABLE"})(xc||(xc={}));z.util.setEnumType(xc,"wg.cosmo.node.v1.ConfigurationVariableKind",[{no:0,name:"STATIC_CONFIGURATION_VARIABLE"},{no:1,name:"ENV_CONFIGURATION_VARIABLE"},{no:2,name:"PLACEHOLDER_CONFIGURATION_VARIABLE"}]);var sd;(function(e){e[e.GET=0]="GET",e[e.POST=1]="POST",e[e.PUT=2]="PUT",e[e.DELETE=3]="DELETE",e[e.OPTIONS=4]="OPTIONS"})(sd||(sd={}));z.util.setEnumType(sd,"wg.cosmo.node.v1.HTTPMethod",[{no:0,name:"GET"},{no:1,name:"POST"},{no:2,name:"PUT"},{no:3,name:"DELETE"},{no:4,name:"OPTIONS"}]);var iu=class iu extends mt{constructor(n){super();A(this,"id","");A(this,"name","");A(this,"routingUrl","");z.util.initPartial(n,this)}static fromBinary(n,r){return new iu().fromBinary(n,r)}static fromJson(n,r){return new iu().fromJson(n,r)}static fromJsonString(n,r){return new iu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(iu,n,r)}};A(iu,"runtime",z),A(iu,"typeName","wg.cosmo.node.v1.Subgraph"),A(iu,"fields",z.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"routing_url",kind:"scalar",T:9}]));var MI=iu,su=class su extends mt{constructor(n){super();A(this,"configByFeatureFlagName",{});z.util.initPartial(n,this)}static fromBinary(n,r){return new su().fromBinary(n,r)}static fromJson(n,r){return new su().fromJson(n,r)}static fromJsonString(n,r){return new su().fromJsonString(n,r)}static equals(n,r){return z.util.equals(su,n,r)}};A(su,"runtime",z),A(su,"typeName","wg.cosmo.node.v1.FeatureFlagRouterExecutionConfigs"),A(su,"fields",z.util.newFieldList(()=>[{no:1,name:"config_by_feature_flag_name",kind:"map",K:9,V:{kind:"message",T:hF}}]));var mF=su,ou=class ou extends mt{constructor(n){super();A(this,"engineConfig");A(this,"version","");A(this,"subgraphs",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new ou().fromBinary(n,r)}static fromJson(n,r){return new ou().fromJson(n,r)}static fromJsonString(n,r){return new ou().fromJsonString(n,r)}static equals(n,r){return z.util.equals(ou,n,r)}};A(ou,"runtime",z),A(ou,"typeName","wg.cosmo.node.v1.FeatureFlagRouterExecutionConfig"),A(ou,"fields",z.util.newFieldList(()=>[{no:1,name:"engine_config",kind:"message",T:af},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"subgraphs",kind:"message",T:MI,repeated:!0}]));var hF=ou,au=class au extends mt{constructor(n){super();A(this,"engineConfig");A(this,"version","");A(this,"subgraphs",[]);A(this,"featureFlagConfigs");z.util.initPartial(n,this)}static fromBinary(n,r){return new au().fromBinary(n,r)}static fromJson(n,r){return new au().fromJson(n,r)}static fromJsonString(n,r){return new au().fromJsonString(n,r)}static equals(n,r){return z.util.equals(au,n,r)}};A(au,"runtime",z),A(au,"typeName","wg.cosmo.node.v1.RouterConfig"),A(au,"fields",z.util.newFieldList(()=>[{no:1,name:"engine_config",kind:"message",T:af},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"subgraphs",kind:"message",T:MI,repeated:!0},{no:4,name:"feature_flag_configs",kind:"message",T:mF,opt:!0}]));var vT=au,uu=class uu extends mt{constructor(n){super();A(this,"code",of.OK);A(this,"details");z.util.initPartial(n,this)}static fromBinary(n,r){return new uu().fromBinary(n,r)}static fromJson(n,r){return new uu().fromJson(n,r)}static fromJsonString(n,r){return new uu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(uu,n,r)}};A(uu,"runtime",z),A(uu,"typeName","wg.cosmo.node.v1.Response"),A(uu,"fields",z.util.newFieldList(()=>[{no:1,name:"code",kind:"enum",T:z.getEnumType(of)},{no:2,name:"details",kind:"scalar",T:9,opt:!0}]));var TF=uu,cu=class cu extends mt{constructor(n){super();A(this,"code",0);A(this,"message","");z.util.initPartial(n,this)}static fromBinary(n,r){return new cu().fromBinary(n,r)}static fromJson(n,r){return new cu().fromJson(n,r)}static fromJsonString(n,r){return new cu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(cu,n,r)}};A(cu,"runtime",z),A(cu,"typeName","wg.cosmo.node.v1.ResponseStatus"),A(cu,"fields",z.util.newFieldList(()=>[{no:1,name:"code",kind:"scalar",T:5},{no:2,name:"message",kind:"scalar",T:9}]));var OK=cu,lu=class lu extends mt{constructor(n){super();A(this,"accountLimits");A(this,"graphPublicKey","");z.util.initPartial(n,this)}static fromBinary(n,r){return new lu().fromBinary(n,r)}static fromJson(n,r){return new lu().fromJson(n,r)}static fromJsonString(n,r){return new lu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(lu,n,r)}};A(lu,"runtime",z),A(lu,"typeName","wg.cosmo.node.v1.RegistrationInfo"),A(lu,"fields",z.util.newFieldList(()=>[{no:1,name:"account_limits",kind:"message",T:NF},{no:2,name:"graph_public_key",kind:"scalar",T:9}]));var yF=lu,du=class du extends mt{constructor(n){super();A(this,"traceSamplingRate",0);z.util.initPartial(n,this)}static fromBinary(n,r){return new du().fromBinary(n,r)}static fromJson(n,r){return new du().fromJson(n,r)}static fromJsonString(n,r){return new du().fromJsonString(n,r)}static equals(n,r){return z.util.equals(du,n,r)}};A(du,"runtime",z),A(du,"typeName","wg.cosmo.node.v1.AccountLimits"),A(du,"fields",z.util.newFieldList(()=>[{no:1,name:"trace_sampling_rate",kind:"scalar",T:2}]));var NF=du,pu=class pu extends mt{constructor(t){super(),z.util.initPartial(t,this)}static fromBinary(t,n){return new pu().fromBinary(t,n)}static fromJson(t,n){return new pu().fromJson(t,n)}static fromJsonString(t,n){return new pu().fromJsonString(t,n)}static equals(t,n){return z.util.equals(pu,t,n)}};A(pu,"runtime",z),A(pu,"typeName","wg.cosmo.node.v1.SelfRegisterRequest"),A(pu,"fields",z.util.newFieldList(()=>[]));var SK=pu,fu=class fu extends mt{constructor(n){super();A(this,"response");A(this,"registrationInfo");z.util.initPartial(n,this)}static fromBinary(n,r){return new fu().fromBinary(n,r)}static fromJson(n,r){return new fu().fromJson(n,r)}static fromJsonString(n,r){return new fu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(fu,n,r)}};A(fu,"runtime",z),A(fu,"typeName","wg.cosmo.node.v1.SelfRegisterResponse"),A(fu,"fields",z.util.newFieldList(()=>[{no:1,name:"response",kind:"message",T:TF},{no:2,name:"registrationInfo",kind:"message",T:yF,opt:!0}]));var DK=fu,mu=class mu extends mt{constructor(n){super();A(this,"defaultFlushInterval",Ir.zero);A(this,"datasourceConfigurations",[]);A(this,"fieldConfigurations",[]);A(this,"graphqlSchema","");A(this,"typeConfigurations",[]);A(this,"stringStorage",{});A(this,"graphqlClientSchema");z.util.initPartial(n,this)}static fromBinary(n,r){return new mu().fromBinary(n,r)}static fromJson(n,r){return new mu().fromJson(n,r)}static fromJsonString(n,r){return new mu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(mu,n,r)}};A(mu,"runtime",z),A(mu,"typeName","wg.cosmo.node.v1.EngineConfiguration"),A(mu,"fields",z.util.newFieldList(()=>[{no:1,name:"defaultFlushInterval",kind:"scalar",T:3},{no:2,name:"datasource_configurations",kind:"message",T:_T,repeated:!0},{no:3,name:"field_configurations",kind:"message",T:DT,repeated:!0},{no:4,name:"graphqlSchema",kind:"scalar",T:9},{no:5,name:"type_configurations",kind:"message",T:EF,repeated:!0},{no:6,name:"string_storage",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:7,name:"graphql_client_schema",kind:"scalar",T:9,opt:!0}]));var af=mu,hu=class hu extends mt{constructor(n){super();A(this,"kind",Cc.STATIC);A(this,"rootNodes",[]);A(this,"childNodes",[]);A(this,"overrideFieldPathFromAlias",!1);A(this,"customGraphql");A(this,"customStatic");A(this,"directives",[]);A(this,"requestTimeoutSeconds",Ir.zero);A(this,"id","");A(this,"keys",[]);A(this,"provides",[]);A(this,"requires",[]);A(this,"customEvents");A(this,"entityInterfaces",[]);A(this,"interfaceObjects",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new hu().fromBinary(n,r)}static fromJson(n,r){return new hu().fromJson(n,r)}static fromJsonString(n,r){return new hu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(hu,n,r)}};A(hu,"runtime",z),A(hu,"typeName","wg.cosmo.node.v1.DataSourceConfiguration"),A(hu,"fields",z.util.newFieldList(()=>[{no:1,name:"kind",kind:"enum",T:z.getEnumType(Cc)},{no:2,name:"root_nodes",kind:"message",T:uf,repeated:!0},{no:3,name:"child_nodes",kind:"message",T:uf,repeated:!0},{no:4,name:"override_field_path_from_alias",kind:"scalar",T:8},{no:5,name:"custom_graphql",kind:"message",T:FT},{no:6,name:"custom_static",kind:"message",T:IF},{no:7,name:"directives",kind:"message",T:vF,repeated:!0},{no:8,name:"request_timeout_seconds",kind:"scalar",T:3},{no:9,name:"id",kind:"scalar",T:9},{no:10,name:"keys",kind:"message",T:rd,repeated:!0},{no:11,name:"provides",kind:"message",T:rd,repeated:!0},{no:12,name:"requires",kind:"message",T:rd,repeated:!0},{no:13,name:"custom_events",kind:"message",T:ad},{no:14,name:"entity_interfaces",kind:"message",T:cf,repeated:!0},{no:15,name:"interface_objects",kind:"message",T:cf,repeated:!0}]));var _T=hu,Tu=class Tu extends mt{constructor(n){super();A(this,"name","");A(this,"sourceType",id.OBJECT_FIELD);z.util.initPartial(n,this)}static fromBinary(n,r){return new Tu().fromBinary(n,r)}static fromJson(n,r){return new Tu().fromJson(n,r)}static fromJsonString(n,r){return new Tu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Tu,n,r)}};A(Tu,"runtime",z),A(Tu,"typeName","wg.cosmo.node.v1.ArgumentConfiguration"),A(Tu,"fields",z.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"source_type",kind:"enum",T:z.getEnumType(id)}]));var bT=Tu,yu=class yu extends mt{constructor(n){super();A(this,"requiredAndScopes",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new yu().fromBinary(n,r)}static fromJson(n,r){return new yu().fromJson(n,r)}static fromJsonString(n,r){return new yu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(yu,n,r)}};A(yu,"runtime",z),A(yu,"typeName","wg.cosmo.node.v1.Scopes"),A(yu,"fields",z.util.newFieldList(()=>[{no:1,name:"required_and_scopes",kind:"scalar",T:9,repeated:!0}]));var OT=yu,Nu=class Nu extends mt{constructor(n){super();A(this,"requiresAuthentication",!1);A(this,"requiredOrScopes",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Nu().fromBinary(n,r)}static fromJson(n,r){return new Nu().fromJson(n,r)}static fromJsonString(n,r){return new Nu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Nu,n,r)}};A(Nu,"runtime",z),A(Nu,"typeName","wg.cosmo.node.v1.AuthorizationConfiguration"),A(Nu,"fields",z.util.newFieldList(()=>[{no:1,name:"requires_authentication",kind:"scalar",T:8},{no:2,name:"required_or_scopes",kind:"message",T:OT,repeated:!0}]));var ST=Nu,Eu=class Eu extends mt{constructor(n){super();A(this,"typeName","");A(this,"fieldName","");A(this,"argumentsConfiguration",[]);A(this,"authorizationConfiguration");A(this,"subscriptionFilterCondition");z.util.initPartial(n,this)}static fromBinary(n,r){return new Eu().fromBinary(n,r)}static fromJson(n,r){return new Eu().fromJson(n,r)}static fromJsonString(n,r){return new Eu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Eu,n,r)}};A(Eu,"runtime",z),A(Eu,"typeName","wg.cosmo.node.v1.FieldConfiguration"),A(Eu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_name",kind:"scalar",T:9},{no:3,name:"arguments_configuration",kind:"message",T:bT,repeated:!0},{no:4,name:"authorization_configuration",kind:"message",T:ST},{no:5,name:"subscription_filter_condition",kind:"message",T:Uc,opt:!0}]));var DT=Eu,gu=class gu extends mt{constructor(n){super();A(this,"typeName","");A(this,"renameTo","");z.util.initPartial(n,this)}static fromBinary(n,r){return new gu().fromBinary(n,r)}static fromJson(n,r){return new gu().fromJson(n,r)}static fromJsonString(n,r){return new gu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(gu,n,r)}};A(gu,"runtime",z),A(gu,"typeName","wg.cosmo.node.v1.TypeConfiguration"),A(gu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"rename_to",kind:"scalar",T:9}]));var EF=gu,Iu=class Iu extends mt{constructor(n){super();A(this,"typeName","");A(this,"fieldNames",[]);A(this,"externalFieldNames",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Iu().fromBinary(n,r)}static fromJson(n,r){return new Iu().fromJson(n,r)}static fromJsonString(n,r){return new Iu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Iu,n,r)}};A(Iu,"runtime",z),A(Iu,"typeName","wg.cosmo.node.v1.TypeField"),A(Iu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_names",kind:"scalar",T:9,repeated:!0},{no:3,name:"external_field_names",kind:"scalar",T:9,repeated:!0}]));var uf=Iu,vu=class vu extends mt{constructor(n){super();A(this,"fieldName","");A(this,"typeName","");z.util.initPartial(n,this)}static fromBinary(n,r){return new vu().fromBinary(n,r)}static fromJson(n,r){return new vu().fromJson(n,r)}static fromJsonString(n,r){return new vu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(vu,n,r)}};A(vu,"runtime",z),A(vu,"typeName","wg.cosmo.node.v1.FieldCoordinates"),A(vu,"fields",z.util.newFieldList(()=>[{no:1,name:"field_name",kind:"scalar",T:9},{no:2,name:"type_name",kind:"scalar",T:9}]));var AT=vu,_u=class _u extends mt{constructor(n){super();A(this,"fieldCoordinatesPath",[]);A(this,"fieldPath",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new _u().fromBinary(n,r)}static fromJson(n,r){return new _u().fromJson(n,r)}static fromJsonString(n,r){return new _u().fromJsonString(n,r)}static equals(n,r){return z.util.equals(_u,n,r)}};A(_u,"runtime",z),A(_u,"typeName","wg.cosmo.node.v1.FieldSetCondition"),A(_u,"fields",z.util.newFieldList(()=>[{no:1,name:"field_coordinates_path",kind:"message",T:AT,repeated:!0},{no:2,name:"field_path",kind:"scalar",T:9,repeated:!0}]));var RT=_u,bu=class bu extends mt{constructor(n){super();A(this,"typeName","");A(this,"fieldName","");A(this,"selectionSet","");A(this,"disableEntityResolver",!1);A(this,"conditions",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new bu().fromBinary(n,r)}static fromJson(n,r){return new bu().fromJson(n,r)}static fromJsonString(n,r){return new bu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(bu,n,r)}};A(bu,"runtime",z),A(bu,"typeName","wg.cosmo.node.v1.RequiredField"),A(bu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_name",kind:"scalar",T:9},{no:3,name:"selection_set",kind:"scalar",T:9},{no:4,name:"disable_entity_resolver",kind:"scalar",T:8},{no:5,name:"conditions",kind:"message",T:RT,repeated:!0}]));var rd=bu,Ou=class Ou extends mt{constructor(n){super();A(this,"interfaceTypeName","");A(this,"concreteTypeNames",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Ou().fromBinary(n,r)}static fromJson(n,r){return new Ou().fromJson(n,r)}static fromJsonString(n,r){return new Ou().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Ou,n,r)}};A(Ou,"runtime",z),A(Ou,"typeName","wg.cosmo.node.v1.EntityInterfaceConfiguration"),A(Ou,"fields",z.util.newFieldList(()=>[{no:1,name:"interface_type_name",kind:"scalar",T:9},{no:2,name:"concrete_type_names",kind:"scalar",T:9,repeated:!0}]));var cf=Ou,Su=class Su extends mt{constructor(n){super();A(this,"url");A(this,"method",sd.GET);A(this,"header",{});A(this,"body");A(this,"query",[]);A(this,"urlEncodeBody",!1);A(this,"mtls");A(this,"baseUrl");A(this,"path");A(this,"httpProxyUrl");z.util.initPartial(n,this)}static fromBinary(n,r){return new Su().fromBinary(n,r)}static fromJson(n,r){return new Su().fromJson(n,r)}static fromJsonString(n,r){return new Su().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Su,n,r)}};A(Su,"runtime",z),A(Su,"typeName","wg.cosmo.node.v1.FetchConfiguration"),A(Su,"fields",z.util.newFieldList(()=>[{no:1,name:"url",kind:"message",T:Pi},{no:2,name:"method",kind:"enum",T:z.getEnumType(sd)},{no:3,name:"header",kind:"map",K:9,V:{kind:"message",T:bF}},{no:4,name:"body",kind:"message",T:Pi},{no:5,name:"query",kind:"message",T:_F,repeated:!0},{no:7,name:"url_encode_body",kind:"scalar",T:8},{no:8,name:"mtls",kind:"message",T:OF},{no:9,name:"base_url",kind:"message",T:Pi},{no:10,name:"path",kind:"message",T:Pi},{no:11,name:"http_proxy_url",kind:"message",T:Pi,opt:!0}]));var gF=Su,Du=class Du extends mt{constructor(n){super();A(this,"statusCode",Ir.zero);A(this,"typeName","");A(this,"injectStatusCodeIntoBody",!1);z.util.initPartial(n,this)}static fromBinary(n,r){return new Du().fromBinary(n,r)}static fromJson(n,r){return new Du().fromJson(n,r)}static fromJsonString(n,r){return new Du().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Du,n,r)}};A(Du,"runtime",z),A(Du,"typeName","wg.cosmo.node.v1.StatusCodeTypeMapping"),A(Du,"fields",z.util.newFieldList(()=>[{no:1,name:"status_code",kind:"scalar",T:3},{no:2,name:"type_name",kind:"scalar",T:9},{no:3,name:"inject_status_code_into_body",kind:"scalar",T:8}]));var AK=Du,Au=class Au extends mt{constructor(n){super();A(this,"fetch");A(this,"subscription");A(this,"federation");A(this,"upstreamSchema");A(this,"customScalarTypeFields",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Au().fromBinary(n,r)}static fromJson(n,r){return new Au().fromJson(n,r)}static fromJsonString(n,r){return new Au().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Au,n,r)}};A(Au,"runtime",z),A(Au,"typeName","wg.cosmo.node.v1.DataSourceCustom_GraphQL"),A(Au,"fields",z.util.newFieldList(()=>[{no:1,name:"fetch",kind:"message",T:gF},{no:2,name:"subscription",kind:"message",T:SF},{no:3,name:"federation",kind:"message",T:DF},{no:4,name:"upstream_schema",kind:"message",T:kT},{no:6,name:"custom_scalar_type_fields",kind:"message",T:AF,repeated:!0}]));var FT=Au,Ru=class Ru extends mt{constructor(n){super();A(this,"consumerName","");A(this,"streamName","");A(this,"consumerInactiveThreshold",0);z.util.initPartial(n,this)}static fromBinary(n,r){return new Ru().fromBinary(n,r)}static fromJson(n,r){return new Ru().fromJson(n,r)}static fromJsonString(n,r){return new Ru().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Ru,n,r)}};A(Ru,"runtime",z),A(Ru,"typeName","wg.cosmo.node.v1.NatsStreamConfiguration"),A(Ru,"fields",z.util.newFieldList(()=>[{no:1,name:"consumer_name",kind:"scalar",T:9},{no:2,name:"stream_name",kind:"scalar",T:9},{no:3,name:"consumer_inactive_threshold",kind:"scalar",T:5}]));var wT=Ru,Fu=class Fu extends mt{constructor(n){super();A(this,"engineEventConfiguration");A(this,"subjects",[]);A(this,"streamConfiguration");z.util.initPartial(n,this)}static fromBinary(n,r){return new Fu().fromBinary(n,r)}static fromJson(n,r){return new Fu().fromJson(n,r)}static fromJsonString(n,r){return new Fu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Fu,n,r)}};A(Fu,"runtime",z),A(Fu,"typeName","wg.cosmo.node.v1.NatsEventConfiguration"),A(Fu,"fields",z.util.newFieldList(()=>[{no:1,name:"engine_event_configuration",kind:"message",T:od},{no:2,name:"subjects",kind:"scalar",T:9,repeated:!0},{no:3,name:"stream_configuration",kind:"message",T:wT}]));var LT=Fu,wu=class wu extends mt{constructor(n){super();A(this,"engineEventConfiguration");A(this,"topics",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new wu().fromBinary(n,r)}static fromJson(n,r){return new wu().fromJson(n,r)}static fromJsonString(n,r){return new wu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(wu,n,r)}};A(wu,"runtime",z),A(wu,"typeName","wg.cosmo.node.v1.KafkaEventConfiguration"),A(wu,"fields",z.util.newFieldList(()=>[{no:1,name:"engine_event_configuration",kind:"message",T:od},{no:2,name:"topics",kind:"scalar",T:9,repeated:!0}]));var PT=wu,Lu=class Lu extends mt{constructor(n){super();A(this,"providerId","");A(this,"type",Gu.PUBLISH);A(this,"typeName","");A(this,"fieldName","");z.util.initPartial(n,this)}static fromBinary(n,r){return new Lu().fromBinary(n,r)}static fromJson(n,r){return new Lu().fromJson(n,r)}static fromJsonString(n,r){return new Lu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Lu,n,r)}};A(Lu,"runtime",z),A(Lu,"typeName","wg.cosmo.node.v1.EngineEventConfiguration"),A(Lu,"fields",z.util.newFieldList(()=>[{no:1,name:"provider_id",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:z.getEnumType(Gu)},{no:3,name:"type_name",kind:"scalar",T:9},{no:4,name:"field_name",kind:"scalar",T:9}]));var od=Lu,Pu=class Pu extends mt{constructor(n){super();A(this,"nats",[]);A(this,"kafka",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Pu().fromBinary(n,r)}static fromJson(n,r){return new Pu().fromJson(n,r)}static fromJsonString(n,r){return new Pu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Pu,n,r)}};A(Pu,"runtime",z),A(Pu,"typeName","wg.cosmo.node.v1.DataSourceCustomEvents"),A(Pu,"fields",z.util.newFieldList(()=>[{no:1,name:"nats",kind:"message",T:LT,repeated:!0},{no:2,name:"kafka",kind:"message",T:PT,repeated:!0}]));var ad=Pu,ku=class ku extends mt{constructor(n){super();A(this,"data");z.util.initPartial(n,this)}static fromBinary(n,r){return new ku().fromBinary(n,r)}static fromJson(n,r){return new ku().fromJson(n,r)}static fromJsonString(n,r){return new ku().fromJsonString(n,r)}static equals(n,r){return z.util.equals(ku,n,r)}};A(ku,"runtime",z),A(ku,"typeName","wg.cosmo.node.v1.DataSourceCustom_Static"),A(ku,"fields",z.util.newFieldList(()=>[{no:1,name:"data",kind:"message",T:Pi}]));var IF=ku,Cu=class Cu extends mt{constructor(n){super();A(this,"kind",xc.STATIC_CONFIGURATION_VARIABLE);A(this,"staticVariableContent","");A(this,"environmentVariableName","");A(this,"environmentVariableDefaultValue","");A(this,"placeholderVariableName","");z.util.initPartial(n,this)}static fromBinary(n,r){return new Cu().fromBinary(n,r)}static fromJson(n,r){return new Cu().fromJson(n,r)}static fromJsonString(n,r){return new Cu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Cu,n,r)}};A(Cu,"runtime",z),A(Cu,"typeName","wg.cosmo.node.v1.ConfigurationVariable"),A(Cu,"fields",z.util.newFieldList(()=>[{no:1,name:"kind",kind:"enum",T:z.getEnumType(xc)},{no:2,name:"static_variable_content",kind:"scalar",T:9},{no:3,name:"environment_variable_name",kind:"scalar",T:9},{no:4,name:"environment_variable_default_value",kind:"scalar",T:9},{no:5,name:"placeholder_variable_name",kind:"scalar",T:9}]));var Pi=Cu,xu=class xu extends mt{constructor(n){super();A(this,"directiveName","");A(this,"renameTo","");z.util.initPartial(n,this)}static fromBinary(n,r){return new xu().fromBinary(n,r)}static fromJson(n,r){return new xu().fromJson(n,r)}static fromJsonString(n,r){return new xu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(xu,n,r)}};A(xu,"runtime",z),A(xu,"typeName","wg.cosmo.node.v1.DirectiveConfiguration"),A(xu,"fields",z.util.newFieldList(()=>[{no:1,name:"directive_name",kind:"scalar",T:9},{no:2,name:"rename_to",kind:"scalar",T:9}]));var vF=xu,Uu=class Uu extends mt{constructor(n){super();A(this,"name","");A(this,"value","");z.util.initPartial(n,this)}static fromBinary(n,r){return new Uu().fromBinary(n,r)}static fromJson(n,r){return new Uu().fromJson(n,r)}static fromJsonString(n,r){return new Uu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Uu,n,r)}};A(Uu,"runtime",z),A(Uu,"typeName","wg.cosmo.node.v1.URLQueryConfiguration"),A(Uu,"fields",z.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"value",kind:"scalar",T:9}]));var _F=Uu,Mu=class Mu extends mt{constructor(n){super();A(this,"values",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Mu().fromBinary(n,r)}static fromJson(n,r){return new Mu().fromJson(n,r)}static fromJsonString(n,r){return new Mu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Mu,n,r)}};A(Mu,"runtime",z),A(Mu,"typeName","wg.cosmo.node.v1.HTTPHeader"),A(Mu,"fields",z.util.newFieldList(()=>[{no:1,name:"values",kind:"message",T:Pi,repeated:!0}]));var bF=Mu,Bu=class Bu extends mt{constructor(n){super();A(this,"key");A(this,"cert");A(this,"insecureSkipVerify",!1);z.util.initPartial(n,this)}static fromBinary(n,r){return new Bu().fromBinary(n,r)}static fromJson(n,r){return new Bu().fromJson(n,r)}static fromJsonString(n,r){return new Bu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Bu,n,r)}};A(Bu,"runtime",z),A(Bu,"typeName","wg.cosmo.node.v1.MTLSConfiguration"),A(Bu,"fields",z.util.newFieldList(()=>[{no:1,name:"key",kind:"message",T:Pi},{no:2,name:"cert",kind:"message",T:Pi},{no:3,name:"insecureSkipVerify",kind:"scalar",T:8}]));var OF=Bu,Vu=class Vu extends mt{constructor(n){super();A(this,"enabled",!1);A(this,"url");A(this,"useSSE");A(this,"protocol");A(this,"websocketSubprotocol");z.util.initPartial(n,this)}static fromBinary(n,r){return new Vu().fromBinary(n,r)}static fromJson(n,r){return new Vu().fromJson(n,r)}static fromJsonString(n,r){return new Vu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Vu,n,r)}};A(Vu,"runtime",z),A(Vu,"typeName","wg.cosmo.node.v1.GraphQLSubscriptionConfiguration"),A(Vu,"fields",z.util.newFieldList(()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"url",kind:"message",T:Pi},{no:3,name:"useSSE",kind:"scalar",T:8,opt:!0},{no:4,name:"protocol",kind:"enum",T:z.getEnumType(nu),opt:!0},{no:5,name:"websocketSubprotocol",kind:"enum",T:z.getEnumType(ru),opt:!0}]));var SF=Vu,ju=class ju extends mt{constructor(n){super();A(this,"enabled",!1);A(this,"serviceSdl","");z.util.initPartial(n,this)}static fromBinary(n,r){return new ju().fromBinary(n,r)}static fromJson(n,r){return new ju().fromJson(n,r)}static fromJsonString(n,r){return new ju().fromJsonString(n,r)}static equals(n,r){return z.util.equals(ju,n,r)}};A(ju,"runtime",z),A(ju,"typeName","wg.cosmo.node.v1.GraphQLFederationConfiguration"),A(ju,"fields",z.util.newFieldList(()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"serviceSdl",kind:"scalar",T:9}]));var DF=ju,$u=class $u extends mt{constructor(n){super();A(this,"key","");z.util.initPartial(n,this)}static fromBinary(n,r){return new $u().fromBinary(n,r)}static fromJson(n,r){return new $u().fromJson(n,r)}static fromJsonString(n,r){return new $u().fromJsonString(n,r)}static equals(n,r){return z.util.equals($u,n,r)}};A($u,"runtime",z),A($u,"typeName","wg.cosmo.node.v1.InternedString"),A($u,"fields",z.util.newFieldList(()=>[{no:1,name:"key",kind:"scalar",T:9}]));var kT=$u,qu=class qu extends mt{constructor(n){super();A(this,"typeName","");A(this,"fieldName","");z.util.initPartial(n,this)}static fromBinary(n,r){return new qu().fromBinary(n,r)}static fromJson(n,r){return new qu().fromJson(n,r)}static fromJsonString(n,r){return new qu().fromJsonString(n,r)}static equals(n,r){return z.util.equals(qu,n,r)}};A(qu,"runtime",z),A(qu,"typeName","wg.cosmo.node.v1.SingleTypeField"),A(qu,"fields",z.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_name",kind:"scalar",T:9}]));var AF=qu,Ku=class Ku extends mt{constructor(n){super();A(this,"fieldPath",[]);A(this,"json","");z.util.initPartial(n,this)}static fromBinary(n,r){return new Ku().fromBinary(n,r)}static fromJson(n,r){return new Ku().fromJson(n,r)}static fromJsonString(n,r){return new Ku().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Ku,n,r)}};A(Ku,"runtime",z),A(Ku,"typeName","wg.cosmo.node.v1.SubscriptionFieldCondition"),A(Ku,"fields",z.util.newFieldList(()=>[{no:1,name:"field_path",kind:"scalar",T:9,repeated:!0},{no:2,name:"json",kind:"scalar",T:9}]));var CT=Ku,Zs=class Zs extends mt{constructor(n){super();A(this,"and",[]);A(this,"in");A(this,"not");A(this,"or",[]);z.util.initPartial(n,this)}static fromBinary(n,r){return new Zs().fromBinary(n,r)}static fromJson(n,r){return new Zs().fromJson(n,r)}static fromJsonString(n,r){return new Zs().fromJsonString(n,r)}static equals(n,r){return z.util.equals(Zs,n,r)}};A(Zs,"runtime",z),A(Zs,"typeName","wg.cosmo.node.v1.SubscriptionFilterCondition"),A(Zs,"fields",z.util.newFieldList(()=>[{no:1,name:"and",kind:"message",T:Zs,repeated:!0},{no:2,name:"in",kind:"message",T:CT,opt:!0},{no:3,name:"not",kind:"message",T:Zs,opt:!0},{no:4,name:"or",kind:"message",T:Zs,repeated:!0}]));var Uc=Zs;m();T();h();var VI=e_(fI(),1);function ype(e){if(!e.conditions)return;let t=[];for(let n of e.conditions){let r=[];for(let i of n.fieldCoordinatesPath){let s=i.split(".");if(s.length!==2)throw new Error(`fatal: malformed conditional field coordinates "${i}" for field set "${e.selectionSet}".`);r.push(new AT({fieldName:s[1],typeName:s[0]}))}t.push(new RT({fieldCoordinatesPath:r,fieldPath:n.fieldPath}))}return t}function RF(e,t,n){if(e)for(let r of e){let i=ype(r);t.push(new rd(k(k({typeName:n,fieldName:r.fieldName,selectionSet:r.selectionSet},r.disableEntityResolver?{disableEntityResolver:!0}:{}),i?{conditions:i}:{})))}}function RK(e){switch(e){case"publish":return Gu.PUBLISH;case"request":return Gu.REQUEST;case"subscribe":return Gu.SUBSCRIBE}}function FK(e){var n;let t={rootNodes:[],childNodes:[],keys:[],provides:[],events:new ad({nats:[],kafka:[]}),requires:[],entityInterfaces:[],interfaceObjects:[]};for(let r of e.values()){let i=r.typeName,s=[...r.fieldNames],o=new uf({typeName:i,fieldNames:s});if(r.externalFieldNames&&r.externalFieldNames.size>0&&(o.externalFieldNames=[...r.externalFieldNames]),r.isRootNode?t.rootNodes.push(o):t.childNodes.push(o),r.entityInterfaceConcreteTypeNames){let d=new cf({interfaceTypeName:i,concreteTypeNames:[...r.entityInterfaceConcreteTypeNames]});r.isInterfaceObject?t.interfaceObjects.push(d):t.entityInterfaces.push(d)}RF(r.keys,t.keys,i),RF(r.provides,t.provides,i),RF(r.requires,t.requires,i);let u=[],l=[];for(let d of(n=r.events)!=null?n:[])switch(d.providerType){case VI.PROVIDER_TYPE_KAFKA:{l.push(new PT({engineEventConfiguration:new od({fieldName:d.fieldName,providerId:d.providerId,type:RK(d.type),typeName:i}),topics:d.topics}));break}case VI.PROVIDER_TYPE_NATS:{u.push(new LT(k({engineEventConfiguration:new od({fieldName:d.fieldName,providerId:d.providerId,type:RK(d.type),typeName:i}),subjects:d.subjects},d.streamConfiguration?{streamConfiguration:new wT({consumerInactiveThreshold:d.streamConfiguration.consumerInactiveThreshold,consumerName:d.streamConfiguration.consumerName,streamName:d.streamConfiguration.streamName})}:{})));break}default:throw new Error("Fatal: Unknown event provider.")}t.events.nats.push(...u),t.events.kafka.push(...l)}return t}function wK(e){var n;let t=[];for(let r of e){let i=r.argumentNames.map(l=>new bT({name:l,sourceType:id.FIELD_ARGUMENT})),s=new DT({argumentsConfiguration:i,fieldName:r.fieldName,typeName:r.typeName}),o=((n=r.requiredScopes)==null?void 0:n.map(l=>new OT({requiredAndScopes:l})))||[],u=o.length>0;if((r.requiresAuthentication||u)&&(s.authorizationConfiguration=new ST({requiresAuthentication:r.requiresAuthentication||u,requiredOrScopes:o})),r.subscriptionFilterCondition){let l=new Uc;BI(l,r.subscriptionFilterCondition),s.subscriptionFilterCondition=l}t.push(s)}return t}function BI(e,t){if(t.and!==void 0){let n=[];for(let r of t.and){let i=new Uc;BI(i,r),n.push(i)}e.and=n;return}if(t.in!==void 0){e.in=new CT({fieldPath:t.in.fieldPath,json:JSON.stringify(t.in.values)});return}if(t.not!==void 0){e.not=new Uc,BI(e.not,t.not);return}if(t.or!==void 0){let n=[];for(let r of t.or){let i=new Uc;BI(i,r),n.push(i)}e.or=n;return}throw new Error("Fatal: Incoming SubscriptionCondition object was malformed.")}m();T();h();function FF(e){return new Error(`Normalization failed to return a ${e}.`)}var Npe=(e,t)=>{let n=stringHash(t);return e.stringStorage[n]=t,new kT({key:n})},Epe=e=>{switch(e){case"ws":return nu.GRAPHQL_SUBSCRIPTION_PROTOCOL_WS;case"sse":return nu.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE;case"sse_post":return nu.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST}throw new Error(`Unsupported subscription protocol '${e}'`)},gpe=e=>{switch(e){case"auto":return ru.GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO;case"graphql-ws":return ru.GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS;case"graphql-transport-ws":return ru.GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS}throw new Error(`Unsupported websocket subprotocol '${e}'`)},PK=function(e){let t=new af({defaultFlushInterval:BigInt(500),datasourceConfigurations:[],fieldConfigurations:[],graphqlSchema:"",stringStorage:{},typeConfigurations:[]});for(let n of e.subgraphs){if(!n.configurationDataByTypeName)throw FF("ConfigurationDataByTypeName");if(!n.schema)throw FF("GraphQLSchema");let r=Npe(t,$q(Qm(n.schema))),{childNodes:i,entityInterfaces:s,events:o,interfaceObjects:u,keys:l,provides:d,requires:p,rootNodes:y}=FK(n.configurationDataByTypeName),N=Epe(n.subscriptionProtocol||"ws"),I=gpe(n.websocketSubprotocol||"auto"),O,x,V;if(o.kafka.length>0||o.nats.length>0){O=Cc.PUBSUB,V=new ad({kafka:o.kafka,nats:o.nats});let re=he=>LK.ROOT_TYPE_NAMES.has(he.typeName),se=0,fe=0;for(;se({id:n.id,name:n.name,routingUrl:n.url}))})};m();T();h();Le();function kK(e){let t;try{t=io(e.schema)}catch(n){throw new Error(`could not parse schema for Graph ${e.name}: ${n}`)}return{definitions:t,name:e.name,url:e.url}}function Ipe(e){let{federationResult:t,errors:n}=(0,wF.federateSubgraphs)(e.map(kK));if(n&&n.length>0)throw new Error(`could not federate schema: ${n.map(r=>r.message).join(", ")}`);return{fieldConfigurations:t.fieldConfigurations,sdl:Ft(t.federatedGraphAST)}}function vpe(e){let t=(0,wF.federateSubgraphs)(e.map(kK));if(t.errors&&t.errors.length>0)throw new Error(`could not federate schema: ${t.errors.map(r=>r.message).join(", ")}`);if(t.federationResult===void 0)throw new Error("could not federate subgraphs");return PK({federatedClientSDL:ep(t.federationResult.federatedGraphClientSchema),federatedSDL:ep(t.federationResult.federatedGraphSchema),fieldConfigurations:t.federationResult.fieldConfigurations,schemaVersionId:"",subgraphs:e.map((r,i)=>{var l,d;let s=t.federationResult.subgraphConfigBySubgraphName.get(r.name),o=s==null?void 0:s.schema,u=s==null?void 0:s.configurationDataByTypeName;return{id:`${i}`,name:r.name,url:XR(r.url),sdl:r.schema,subscriptionUrl:XR((l=r.subscription_url)!=null?l:r.url),subscriptionProtocol:(d=r.subscription_protocol)!=null?d:"ws",websocketSubprotocol:r.subscription_protocol==="ws"?r.websocketSubprotocol||"auto":void 0,schema:o,configurationDataByTypeName:u}})}).toJsonString()}return Me(_pe);})(); /*! Bundled license information: @jspm/core/nodelibs/browser/buffer.js: diff --git a/composition/src/federation/federation-factory.ts b/composition/src/federation/federation-factory.ts index 3e21f40123..22ba50b459 100644 --- a/composition/src/federation/federation-factory.ts +++ b/composition/src/federation/federation-factory.ts @@ -566,6 +566,7 @@ export class FederationFactory { } existingData.appearances += 1; setLongestDescription(existingData, incomingData); + addIterableValuesToSet(incomingData.subgraphNames, existingData.subgraphNames); } // To facilitate the splitting of tag paths, field arguments do not use the renamedPath property for tagNamesByPath @@ -1043,6 +1044,7 @@ export class FederationFactory { switch (existingData.kind) { case Kind.ENUM_TYPE_DEFINITION: existingData.appearances += 1; + addIterableValuesToSet((incomingData as EnumDefinitionData).subgraphNames, existingData.subgraphNames); for (const data of (incomingData as EnumDefinitionData).enumValueDataByValueName.values()) { this.upsertEnumValueData(existingData.enumValueDataByValueName, data, isParentInaccessible); } @@ -2388,6 +2390,7 @@ export class FederationFactory { federatedGraphAST: newRouterAST, federatedGraphSchema: buildASTSchema(newRouterAST, { assumeValid: true, assumeValidSDL: true }), federatedGraphClientSchema: newClientSchema, + parentDefinitionDataByTypeName: this.parentDefinitionDataByTypeName, ...this.getClientSchemaObjectBoolean(), }, warnings: this.warnings, @@ -2671,6 +2674,7 @@ export class FederationFactory { federatedGraphAST: newRouterAST, federatedGraphSchema: buildASTSchema(newRouterAST, { assumeValid: true, assumeValidSDL: true }), federatedGraphClientSchema: newClientSchema, + parentDefinitionDataByTypeName: this.parentDefinitionDataByTypeName, ...this.getClientSchemaObjectBoolean(), }, warnings: this.warnings, diff --git a/composition/src/federation/utils.ts b/composition/src/federation/utils.ts index 7bcfae0a5b..e9ad20d23f 100644 --- a/composition/src/federation/utils.ts +++ b/composition/src/federation/utils.ts @@ -45,6 +45,7 @@ export type FederationResult = { federatedGraphAST: DocumentNode; federatedGraphClientSchema: GraphQLSchema; federatedGraphSchema: GraphQLSchema; + parentDefinitionDataByTypeName: Map; subgraphConfigBySubgraphName: Map; shouldIncludeClientSchema?: boolean; }; diff --git a/composition/src/normalization/normalization-factory.ts b/composition/src/normalization/normalization-factory.ts index ed0800e308..cac356d8af 100644 --- a/composition/src/normalization/normalization-factory.ts +++ b/composition/src/normalization/normalization-factory.ts @@ -848,6 +848,7 @@ export class NormalizationFactory { return; } this.setParentDataExtensionType(parentData, extensionType); + parentData.subgraphNames.add(this.subgraphName); parentData.description ||= formatDescription('description' in node ? node.description : undefined); return; } @@ -860,6 +861,7 @@ export class NormalizationFactory { name: typeName, node: getMutableEnumNode(node.name), persistedDirectivesData: newPersistedDirectivesData(), + subgraphNames: new Set([this.subgraphName]), description: formatDescription('description' in node ? node.description : undefined), }); } diff --git a/composition/src/normalization/walkers.ts b/composition/src/normalization/walkers.ts index bdc842b110..1f9342c38a 100644 --- a/composition/src/normalization/walkers.ts +++ b/composition/src/normalization/walkers.ts @@ -313,6 +313,7 @@ export function upsertParentsAndChildren(nf: NormalizationFactory, document: Doc nf.directiveDefinitionByDirectiveName, nf.handledRepeatedDirectivesByHostPath, nf.originalParentTypeName, + nf.subgraphName, ); }, leave() { diff --git a/composition/src/schema-building/type-definition-data.ts b/composition/src/schema-building/type-definition-data.ts index 7a33683e3e..70ef3e5f33 100644 --- a/composition/src/schema-building/type-definition-data.ts +++ b/composition/src/schema-building/type-definition-data.ts @@ -35,6 +35,7 @@ export type EnumDefinitionData = { name: string; node: MutableEnumNode; persistedDirectivesData: PersistedDirectivesData; + subgraphNames: Set; description?: StringValueNode; }; @@ -45,6 +46,7 @@ export type EnumValueData = { node: MutableEnumValueNode; parentTypeName: string; persistedDirectivesData: PersistedDirectivesData; + subgraphNames: Set; description?: StringValueNode; }; diff --git a/composition/src/schema-building/utils.ts b/composition/src/schema-building/utils.ts index 0740c08df0..9e25c584d3 100644 --- a/composition/src/schema-building/utils.ts +++ b/composition/src/schema-building/utils.ts @@ -439,6 +439,7 @@ export function addEnumValueDataByNode( directiveDefinitionByDirectiveName: Map, handledRepeatedDirectivesByHostPath: Map>, parentTypeName: string, + subgraphName: string, ) { const name = node.name.value; enumValueDataByValueName.set(name, { @@ -455,6 +456,7 @@ export function addEnumValueDataByNode( node: getMutableEnumValueNode(node), parentTypeName, persistedDirectivesData: newPersistedDirectivesData(), + subgraphNames: new Set([subgraphName]), description: formatDescription(node.description), }); } diff --git a/composition/tests/enums.test.ts b/composition/tests/enums.test.ts index 4f53d3c6f0..e6ccb30a2d 100644 --- a/composition/tests/enums.test.ts +++ b/composition/tests/enums.test.ts @@ -1,6 +1,7 @@ import { duplicateEnumValueDefinitionError, ENUM, + EnumDefinitionData, federateSubgraphs, incompatibleSharedEnumError, noBaseDefinitionForExtensionError, @@ -521,6 +522,31 @@ describe('Enum tests', () => { ), ); }); + + test('that an Enum has subgraphs data', () => { + const { errors, federationResult } = federateSubgraphs([subgraphA, subgraphC]); + expect(errors).toBeUndefined(); + + const enumDef = federationResult?.parentDefinitionDataByTypeName.get('Instruction') as EnumDefinitionData; + + expect(enumDef.subgraphNames.size).toBe(2); + expect(enumDef.subgraphNames).toContain(subgraphA.name); + expect(enumDef.subgraphNames).toContain(subgraphC.name); + + const fightEnumVal = enumDef.enumValueDataByValueName.get('FIGHT'); + expect(fightEnumVal?.subgraphNames.size).toBe(2); + expect(fightEnumVal?.subgraphNames).toContain(subgraphA.name); + expect(fightEnumVal?.subgraphNames).toContain(subgraphC.name); + + const pokemonEnumVal = enumDef.enumValueDataByValueName.get('POKEMON'); + expect(pokemonEnumVal?.subgraphNames.size).toBe(2); + expect(pokemonEnumVal?.subgraphNames).toContain(subgraphA.name); + expect(pokemonEnumVal?.subgraphNames).toContain(subgraphC.name); + + const itemEnumVal = enumDef.enumValueDataByValueName.get('ITEM'); + expect(itemEnumVal?.subgraphNames.size).toBe(1); + expect(itemEnumVal?.subgraphNames).toContain(subgraphC.name); + }); }); }); diff --git a/controlplane/Dockerfile b/controlplane/Dockerfile index d2153187db..0ac2ee3183 100644 --- a/controlplane/Dockerfile +++ b/controlplane/Dockerfile @@ -34,7 +34,7 @@ FROM --platform=${BUILDPLATFORM} node:lts-alpine WORKDIR /app -ENV NODE_ENV production +ENV NODE_ENV=production # Fetch built artifacts COPY --from=builder /app/pruned . diff --git a/studio/Dockerfile b/studio/Dockerfile index be9ca96fa3..d42633032d 100644 --- a/studio/Dockerfile +++ b/studio/Dockerfile @@ -29,14 +29,14 @@ ARG SENTRY_PROJECT ARG SENTRY_SERVER_SAMPLE_RATE ARG SENTRY_EDGE_SAMPLE_RATE -ENV NEXT_PUBLIC_SENTRY_ENABLED $NEXT_PUBLIC_SENTRY_ENABLED -ENV NEXT_PUBLIC_SENTRY_REPLAY_ENABLED $NEXT_PUBLIC_SENTRY_REPLAY_ENABLED -ENV SENTRY_DEBUG $SENTRY_DEBUG -ENV SENTRY_AUTH_TOKEN $SENTRY_AUTH_TOKEN -ENV SENTRY_ORG $SENTRY_ORG -ENV SENTRY_PROJECT $SENTRY_PROJECT -ENV SENTRY_SERVER_SAMPLE_RATE $SENTRY_SERVER_SAMPLE_RATE -ENV SENTRY_EDGE_SAMPLE_RATE $SENTRY_EDGE_SAMPLE_RATE +ENV NEXT_PUBLIC_SENTRY_ENABLED=$NEXT_PUBLIC_SENTRY_ENABLED +ENV NEXT_PUBLIC_SENTRY_REPLAY_ENABLED=$NEXT_PUBLIC_SENTRY_REPLAY_ENABLED +ENV SENTRY_DEBUG=$SENTRY_DEBUG +ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN +ENV SENTRY_ORG=$SENTRY_ORG +ENV SENTRY_PROJECT=$SENTRY_PROJECT +ENV SENTRY_SERVER_SAMPLE_RATE=$SENTRY_SERVER_SAMPLE_RATE +ENV SENTRY_EDGE_SAMPLE_RATE=$SENTRY_EDGE_SAMPLE_RATE COPY . /app/ @@ -48,8 +48,8 @@ FROM --platform=${BUILDPLATFORM} node:lts-alpine WORKDIR /app -ENV NODE_ENV production -ENV NEXT_TELEMETRY_DISABLED 1 +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 # Fetch built artifacts COPY --from=builder /app/studio/.next/standalone ./ @@ -64,7 +64,7 @@ ENTRYPOINT ["./entrypoint.sh"] EXPOSE 3000 -ENV PORT 3000 -ENV HOSTNAME localhost +ENV PORT=3000 +ENV HOSTNAME=localhost CMD ["node", "./studio/server.js"] \ No newline at end of file