UNPKG

ruru

Version:

Grafast-flavoured GraphiQL distribution

2 lines 5.79 kB
export const __webpack_id__=6611;export const __webpack_ids__=[6611];export const __webpack_modules__={16611:(n,t,e)=>{e.d(t,{YW:()=>S,qg:()=>V});var r=e(30325),s=e(80041),l=e(27735),a=e(60942),u=e(69958),o=e(60891);const c="**",i="/",f="[/\\\\]",h="[^/\\\\]",p=/\//g;function g(n,t){switch(n){case 0:return"";case 1:return`${h}*?`;default:return`(?:${f}|${h}+${f}${t?`|${f}${h}+`:""})*?`}}function m(n,t){if(!n)return[];const e=[];let r=!1,s=!1,l="";for(const a of n){switch(a){case t:if(!r&&!s){e.push(l),l="";continue}break;case"{":r=!0;break;case"}":r=!1;break;case"[":s=!0;break;case"]":s=!1}l+=a}return l&&e.push(l),e}function b(n){if(!n)return"";let t="";const e=m(n,i);if(e.every(n=>n===c))t=".*";else{let n=!1;e.forEach((r,s)=>{if(r===c){if(n)return;t+=g(2,s===e.length-1)}else{let n=!1,l="",a=!1,u="";for(const e of r)if("}"!==e&&n)l+=e;else if(!a||"]"===e&&u)switch(e){case"{":n=!0;continue;case"[":a=!0;continue;case"}":{const e=`(?:${m(l,",").map(n=>b(n)).join("|")})`;t+=e,n=!1,l="";break}case"]":t+="["+u+"]",a=!1,u="";break;case"?":t+=h;continue;case"*":t+=g(1);continue;default:t+=(0,o.bm)(e)}else{let n;n="-"===e?e:"^"!==e&&"!"!==e||u?e===i?"":(0,o.bm)(e):"^",u+=n}s<e.length-1&&(e[s+1]!==c||s+2<e.length)&&(t+=f)}n=r===c})}return t}const d=/^\*\*\/\*\.[\w\.-]+$/,y=/^\*\*\/([\w\.-]+)\/?$/,w=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,$=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,B=/^\*\*((\/[\w\.-]+)+)\/?$/,P=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,_=new l.qK(1e4),x=function(){return!1},k=function(){return null};function W(n,t){if(!n)return k;let e;e="string"!=typeof n?n.pattern:n,e=e.trim();const r=`${e}_${!!t.trimForExclusions}`;let l,c=_.get(r);return c||(c=d.test(e)?function(n,t){return function(e,r){return"string"==typeof e&&e.endsWith(n)?t:null}}(e.substr(4),e):(l=y.exec(q(e,t)))?function(n,t){const e=`/${n}`,r=`\\${n}`,s=function(s,l){return"string"!=typeof s?null:l?l===n?t:null:s===n||s.endsWith(e)||s.endsWith(r)?t:null},l=[n];return s.basenames=l,s.patterns=[t],s.allBasenames=l,s}(l[1],e):(t.trimForExclusions?$:w).test(e)?function(n,t){const e=j(n.slice(1,-1).split(",").map(n=>W(n,t)).filter(n=>n!==k),n),r=e.length;if(!r)return k;if(1===r)return e[0];const s=function(t,r){for(let s=0,l=e.length;s<l;s++)if(e[s](t,r))return n;return null},l=e.find(n=>!!n.allBasenames);l&&(s.allBasenames=l.allBasenames);const a=e.reduce((n,t)=>t.allPaths?n.concat(t.allPaths):n,[]);return a.length&&(s.allPaths=a),s}(e,t):(l=B.exec(q(e,t)))?E(l[1].substr(1),e,!0):(l=P.exec(q(e,t)))?E(l[1],e,!1):function(n){try{const t=new RegExp(`^${b(n)}$`);return function(e){return t.lastIndex=0,"string"==typeof e&&t.test(e)?n:null}}catch(n){return k}}(e),_.set(r,c)),function(n,t){if("string"==typeof t)return n;const e=function(e,r){return(0,s._1)(e,t.base,!u.j9)?n((0,o.NB)(e.substr(t.base.length),a.Vn),r):null};return e.allBasenames=n.allBasenames,e.allPaths=n.allPaths,e.basenames=n.basenames,e.patterns=n.patterns,e}(c,n)}function q(n,t){return t.trimForExclusions&&n.endsWith("/**")?n.substr(0,n.length-2):n}function E(n,t,e){const r=a.Vn===a.SA.sep,s=r?n:n.replace(p,a.Vn),l=a.Vn+s,u=a.SA.sep+n;let o;return o=e?function(e,a){return"string"!=typeof e||e!==s&&!e.endsWith(l)&&(r||e!==n&&!e.endsWith(u))?null:t}:function(e,l){return"string"!=typeof e||e!==s&&(r||e!==n)?null:t},o.allPaths=[(e?"*/":"./")+n],o}function S(n,t,e){return!(!n||"string"!=typeof t)&&V(n)(t,void 0,e)}function V(n,t={}){if(!n)return x;if("string"==typeof n||function(n){const t=n;return!!t&&("string"==typeof t.base&&"string"==typeof t.pattern)}(n)){const e=W(n,t);if(e===k)return x;const r=function(n,t){return!!e(n,t)};return e.allBasenames&&(r.allBasenames=e.allBasenames),e.allPaths&&(r.allPaths=e.allPaths),r}return function(n,t){const e=j(Object.getOwnPropertyNames(n).map(e=>function(n,t,e){if(!1===t)return k;const s=W(n,e);if(s===k)return k;if("boolean"==typeof t)return s;if(t){const e=t.when;if("string"==typeof e){const t=(t,l,a,u)=>{if(!u||!s(t,l))return null;const o=u(e.replace("$(basename)",()=>a));return(0,r.Qg)(o)?o.then(t=>t?n:null):o?n:null};return t.requiresSiblings=!0,t}}return s}(e,n[e],t)).filter(n=>n!==k)),s=e.length;if(!s)return k;if(!e.some(n=>!!n.requiresSiblings)){if(1===s)return e[0];const n=function(n,t){let s;for(let l=0,a=e.length;l<a;l++){const a=e[l](n,t);if("string"==typeof a)return a;(0,r.Qg)(a)&&(s||(s=[]),s.push(a))}return s?(async()=>{for(const n of s){const t=await n;if("string"==typeof t)return t}return null})():null},t=e.find(n=>!!n.allBasenames);t&&(n.allBasenames=t.allBasenames);const l=e.reduce((n,t)=>t.allPaths?n.concat(t.allPaths):n,[]);return l.length&&(n.allPaths=l),n}const l=function(n,t,s){let l,u;for(let o=0,c=e.length;o<c;o++){const c=e[o];c.requiresSiblings&&s&&(t||(t=(0,a.P8)(n)),l||(l=t.substr(0,t.length-(0,a.LC)(n).length)));const i=c(n,t,l,s);if("string"==typeof i)return i;(0,r.Qg)(i)&&(u||(u=[]),u.push(i))}return u?(async()=>{for(const n of u){const t=await n;if("string"==typeof t)return t}return null})():null},u=e.find(n=>!!n.allBasenames);u&&(l.allBasenames=u.allBasenames);const o=e.reduce((n,t)=>t.allPaths?n.concat(t.allPaths):n,[]);return o.length&&(l.allPaths=o),l}(n,t)}function j(n,t){const e=n.filter(n=>!!n.basenames);if(e.length<2)return n;const r=e.reduce((n,t)=>{const e=t.basenames;return e?n.concat(e):n},[]);let s;if(t){s=[];for(let n=0,e=r.length;n<e;n++)s.push(t)}else s=e.reduce((n,t)=>{const e=t.patterns;return e?n.concat(e):n},[]);const l=function(n,t){if("string"!=typeof n)return null;if(!t){let e;for(e=n.length;e>0;e--){const t=n.charCodeAt(e-1);if(47===t||92===t)break}t=n.substr(e)}const e=r.indexOf(t);return-1!==e?s[e]:null};l.basenames=r,l.patterns=s,l.allBasenames=r;const a=n.filter(n=>!n.basenames);return a.push(l),a}}}; //# sourceMappingURL=6611.js.map