// @bun
var{defineProperty:D,getOwnPropertyNames:K,getOwnPropertyDescriptor:L}=Object,M=Object.prototype.hasOwnProperty;function N(b){return this[b]}var V=(b)=>{var j=(H??=new WeakMap).get(b),k;if(j)return j;if(j=D({},"__esModule",{value:!0}),b&&typeof b==="object"||typeof b==="function"){for(var q of K(b))if(!M.call(j,q))D(j,q,{get:N.bind(b,q),enumerable:!(k=L(b,q))||k.enumerable})}return H.set(b,j),j},H;var O=(b)=>b;function P(b,j){this[b]=O.bind(null,j)}var W=(b,j)=>{for(var k in j)D(b,k,{get:j[k],enumerable:!0,configurable:!0,set:P.bind(j,k)})};var X=(b,j)=>()=>(b&&(j=b(b=0)),j);function Z(b){return b}function I(b){return b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Q(b){let j=[],k=b.split(/(\{[^}]+\})/g).filter(Boolean).map((q)=>{let A=q.match(/^\{([^}]+)\}$/);if(!A)return I(q);let[B]=A.slice(1);if(!B)return I(q);return j.push(B),"([^/]+)"}).join("");return{regex:new RegExp(`^${k}$`),names:j}}class S{templates=[];register(b){return this.templates.push(b),this}listTemplates(){return[...this.templates]}match(b){for(let j of this.templates){let{regex:k,names:q}=Q(j.meta.uriTemplate),A=b.match(k);if(!A)continue;let B={};return q.forEach((F,J)=>{let G=A[J+1];if(F&&G)B[F]=decodeURIComponent(G)}),{tmpl:j,params:B}}return}}function _(b,j){return{kind:"resource_ref",uriTemplate:b,varName:j.varName??"id",graphQLType:j.graphQLType,many:j.many}}function $(b){let j=b;return!!j&&j.kind==="resource_ref"&&typeof j.uriTemplate==="string"}export{_ as resourceRef,$ as isResourceRef,Z as defineResourceTemplate,S as ResourceRegistry};
