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EAAQ,iBAC1D,eAAe,EAAU,GAEtB,EAAQ,KAAO,QAAQ,wBAAwB,GAAY,CACtE,CACA,SAAS,eAAe,EAAQ,GAC5B,MAAM,EAAe,GACrB,IAAK,MAAM,KAAU,EACb,EAAO,OACP,EAAa,KAAK,IAAI,QAAQ,OAAO,EAAO,OAAQ,EAAO,WAEtD,EAAO,UACZ,EAAa,KAAK,IAAI,QAAQ,OAAO,QAAQ,MAAM,EAAO,UAAW,EAAO,WAGpF,EAAO,WAAa,IACb,EAAO,WACV,QAAS,EACT,gBAAiB,EAEzB,CACA,SAAS,0BAA0B,GAC/B,MAAM,EAAU,GACV,EAAW,GACjB,IAAK,MAAM,KAAU,EACb,EAAO,OACP,EAAQ,KAAK,EAAO,QAEf,EAAO,UACZ,EAAS,KAAK,EAAO,UAG7B,MAAO,CACH,UACA,WAER,CAEA,QAAQ,oBAAsB,oBAC9B,QAAQ,gBAAkB,gBAC1B,QAAQ,WAAa,WACrB,QAAQ,cAAgB,cACxB,QAAQ,kBAAoB,kBAC5B,QAAQ,WAAa,WACrB,QAAQ,eAAiB,eACzB,QAAQ,aAAe,aACvB,QAAQ,iBAAmB","file":"/npm/@graphql-tools/load@7.5.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@graphql-tools/load@7.5.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }\n\nfunction _interopNamespace(e) {\n    if (e && e.__esModule) { return e; } else {\n        var n = {};\n        if (e) {\n            Object.keys(e).forEach(function (k) {\n                var d = Object.getOwnPropertyDescriptor(e, k);\n                Object.defineProperty(n, k, d.get ? d : {\n                    enumerable: true,\n                    get: function () {\n                        return e[k];\n                    }\n                });\n            });\n        }\n        n['default'] = e;\n        return n;\n    }\n}\n\nconst utils = require('@graphql-tools/utils');\nconst process = require('process');\nconst graphql = require('graphql');\nconst pLimit = _interopDefault(require('p-limit'));\nconst module$1 = require('module');\nconst path = require('path');\nconst schema = require('@graphql-tools/schema');\n\nfunction normalizePointers(unnormalizedPointerOrPointers) {\n    const ignore = [];\n    const pointerOptionMap = {};\n    const handlePointer = (rawPointer, options = {}) => {\n        if (rawPointer.startsWith('!')) {\n            ignore.push(rawPointer.replace('!', ''));\n        }\n        else {\n            pointerOptionMap[rawPointer] = options;\n        }\n    };\n    for (const rawPointer of utils.asArray(unnormalizedPointerOrPointers)) {\n        if (typeof rawPointer === 'string') {\n            handlePointer(rawPointer);\n        }\n        else if (typeof rawPointer === 'object') {\n            for (const [path, options] of Object.entries(rawPointer)) {\n                handlePointer(path, options);\n            }\n        }\n        else {\n            throw new Error(`Invalid pointer '${rawPointer}'.`);\n        }\n    }\n    return { ignore, pointerOptionMap };\n}\n\nfunction applyDefaultOptions(options) {\n    options.cache = options.cache || {};\n    options.cwd = options.cwd || process.cwd();\n    options.sort = 'sort' in options ? options.sort : true;\n}\n\nasync function loadFile(pointer, options) {\n    var _a;\n    let results = (_a = options.cache) === null || _a === void 0 ? void 0 : _a[pointer];\n    if (!results) {\n        results = [];\n        const errors = [];\n        await Promise.all(options.loaders.map(async (loader) => {\n            try {\n                const loaderResults = await loader.load(pointer, options);\n                loaderResults === null || loaderResults === void 0 ? void 0 : loaderResults.forEach(result => results.push(result));\n            }\n            catch (error) {\n                if (process.env['DEBUG']) {\n                    console.error(error);\n                }\n                if (error instanceof utils.AggregateError) {\n                    for (const errorElement of error.errors) {\n                        errors.push(errorElement);\n                    }\n                }\n                else {\n                    errors.push(error);\n                }\n            }\n        }));\n        if (results.length === 0 && errors.length > 0) {\n            if (errors.length === 1) {\n                throw errors[0];\n            }\n            throw new utils.AggregateError(errors, `Failed to find any GraphQL type definitions in: ${pointer};\\n - ${errors\n                .map(error => error.message)\n                .join('\\n  - ')}`);\n        }\n        if (options.cache) {\n            options.cache[pointer] = results;\n        }\n    }\n    return results;\n}\nfunction loadFileSync(pointer, options) {\n    var _a;\n    let results = (_a = options.cache) === null || _a === void 0 ? void 0 : _a[pointer];\n    if (!results) {\n        results = [];\n        const errors = [];\n        for (const loader of options.loaders) {\n            try {\n                // We check for the existence so it is okay to force non null\n                const loaderResults = loader.loadSync(pointer, options);\n                loaderResults === null || loaderResults === void 0 ? void 0 : loaderResults.forEach(result => results.push(result));\n            }\n            catch (error) {\n                if (process.env['DEBUG']) {\n                    console.error(error);\n                }\n                if (error instanceof utils.AggregateError) {\n                    for (const errorElement of error.errors) {\n                        errors.push(errorElement);\n                    }\n                }\n                else {\n                    errors.push(error);\n                }\n            }\n        }\n        if (results.length === 0 && errors.length > 0) {\n            if (errors.length === 1) {\n                throw errors[0];\n            }\n            throw new utils.AggregateError(errors, `Failed to find any GraphQL type definitions in: ${pointer};\\n - ${errors\n                .map(error => error.message)\n                .join('\\n  - ')}`);\n        }\n        if (options.cache) {\n            options.cache[pointer] = results;\n        }\n    }\n    return results;\n}\n\n/**\n * Converts a string to 32bit integer\n */\nfunction stringToHash(str) {\n    let hash = 0;\n    if (str.length === 0) {\n        return hash;\n    }\n    let char;\n    for (let i = 0; i < str.length; i++) {\n        char = str.charCodeAt(i);\n        // tslint:disable-next-line: no-bitwise\n        hash = (hash << 5) - hash + char;\n        // tslint:disable-next-line: no-bitwise\n        hash = hash & hash;\n    }\n    return hash;\n}\nfunction useStack(...fns) {\n    return (input) => {\n        function createNext(i) {\n            if (i >= fns.length) {\n                return () => { };\n            }\n            return function next() {\n                fns[i](input, createNext(i + 1));\n            };\n        }\n        fns[0](input, createNext(1));\n    };\n}\nfunction useLimit(concurrency) {\n    return pLimit(concurrency);\n}\n\nfunction getCustomLoaderByPath(path$1, cwd) {\n    try {\n        const requireFn = module$1.createRequire(path.join(cwd, 'noop.js'));\n        const requiredModule = requireFn(path$1);\n        if (requiredModule) {\n            if (requiredModule.default && typeof requiredModule.default === 'function') {\n                return requiredModule.default;\n            }\n            if (typeof requiredModule === 'function') {\n                return requiredModule;\n            }\n        }\n    }\n    catch (e) { }\n    return null;\n}\nasync function useCustomLoader(loaderPointer, cwd) {\n    let loader;\n    if (typeof loaderPointer === 'string') {\n        loader = await getCustomLoaderByPath(loaderPointer, cwd);\n    }\n    else if (typeof loaderPointer === 'function') {\n        loader = loaderPointer;\n    }\n    if (typeof loader !== 'function') {\n        throw new Error(`Failed to load custom loader: ${loaderPointer}`);\n    }\n    return loader;\n}\nfunction useCustomLoaderSync(loaderPointer, cwd) {\n    let loader;\n    if (typeof loaderPointer === 'string') {\n        loader = getCustomLoaderByPath(loaderPointer, cwd);\n    }\n    else if (typeof loaderPointer === 'function') {\n        loader = loaderPointer;\n    }\n    if (typeof loader !== 'function') {\n        throw new Error(`Failed to load custom loader: ${loaderPointer}`);\n    }\n    return loader;\n}\n\nfunction useQueue(options) {\n    const queue = [];\n    const limit = (options === null || options === void 0 ? void 0 : options.concurrency) ? pLimit(options.concurrency) : async (fn) => fn();\n    return {\n        add(fn) {\n            queue.push(() => limit(fn));\n        },\n        runAll() {\n            return Promise.all(queue.map(fn => fn()));\n        },\n    };\n}\nfunction useSyncQueue() {\n    const queue = [];\n    return {\n        add(fn) {\n            queue.push(fn);\n        },\n        runAll() {\n            for (const fn of queue) {\n                fn();\n            }\n        },\n    };\n}\n\nconst CONCURRENCY_LIMIT = 50;\nasync function collectSources({ pointerOptionMap, options, }) {\n    const sources = [];\n    const queue = useQueue({ concurrency: CONCURRENCY_LIMIT });\n    const { addSource, collect } = createHelpers({\n        sources,\n        stack: [collectDocumentString, collectCustomLoader, collectFallback],\n    });\n    for (const pointer in pointerOptionMap) {\n        const pointerOptions = pointerOptionMap[pointer];\n        collect({\n            pointer,\n            pointerOptions,\n            pointerOptionMap,\n            options,\n            addSource,\n            queue: queue.add,\n        });\n    }\n    await queue.runAll();\n    return sources;\n}\nfunction collectSourcesSync({ pointerOptionMap, options, }) {\n    const sources = [];\n    const queue = useSyncQueue();\n    const { addSource, collect } = createHelpers({\n        sources,\n        stack: [collectDocumentString, collectCustomLoaderSync, collectFallbackSync],\n    });\n    for (const pointer in pointerOptionMap) {\n        const pointerOptions = pointerOptionMap[pointer];\n        collect({\n            pointer,\n            pointerOptions,\n            pointerOptionMap,\n            options,\n            addSource,\n            queue: queue.add,\n        });\n    }\n    queue.runAll();\n    return sources;\n}\nfunction createHelpers({ sources, stack }) {\n    const addSource = ({ source }) => {\n        sources.push(source);\n    };\n    const collect = useStack(...stack);\n    return {\n        addSource,\n        collect,\n    };\n}\nfunction addResultOfCustomLoader({ pointer, result, addSource, }) {\n    if (graphql.isSchema(result)) {\n        addSource({\n            source: {\n                location: pointer,\n                schema: result,\n                document: utils.getDocumentNodeFromSchema(result),\n            },\n            pointer,\n            noCache: true,\n        });\n    }\n    else if (result.kind && result.kind === graphql.Kind.DOCUMENT) {\n        addSource({\n            source: {\n                document: result,\n                location: pointer,\n            },\n            pointer,\n        });\n    }\n    else if (result.document) {\n        addSource({\n            source: {\n                location: pointer,\n                ...result,\n            },\n            pointer,\n        });\n    }\n}\nfunction collectDocumentString({ pointer, pointerOptions, options, addSource, queue }, next) {\n    if (utils.isDocumentString(pointer)) {\n        return queue(() => {\n            const source = utils.parseGraphQLSDL(`${stringToHash(pointer)}.graphql`, pointer, {\n                ...options,\n                ...pointerOptions,\n            });\n            addSource({\n                source,\n                pointer,\n            });\n        });\n    }\n    next();\n}\nfunction collectCustomLoader({ pointer, pointerOptions, queue, addSource, options, pointerOptionMap }, next) {\n    if (pointerOptions.loader) {\n        return queue(async () => {\n            await Promise.all(utils.asArray(pointerOptions.require).map(m => new Promise(function (resolve) { resolve(_interopNamespace(require(m))); })));\n            // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n            // @ts-ignore TODO options.cwd is possibly undefined, but it seems like no test covers this path\n            const loader = await useCustomLoader(pointerOptions.loader, options.cwd);\n            const result = await loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap);\n            if (!result) {\n                return;\n            }\n            addResultOfCustomLoader({ pointer, result, addSource });\n        });\n    }\n    next();\n}\nfunction collectCustomLoaderSync({ pointer, pointerOptions, queue, addSource, options, pointerOptionMap }, next) {\n    if (pointerOptions.loader) {\n        return queue(() => {\n            const cwdRequire = module$1.createRequire(options.cwd || process.cwd());\n            for (const m of utils.asArray(pointerOptions.require)) {\n                cwdRequire(m);\n            }\n            // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n            // @ts-ignore TODO options.cwd is possibly undefined, but it seems like no test covers this path\n            const loader = useCustomLoaderSync(pointerOptions.loader, options.cwd);\n            const result = loader(pointer, { ...options, ...pointerOptions }, pointerOptionMap);\n            if (result) {\n                addResultOfCustomLoader({ pointer, result, addSource });\n            }\n        });\n    }\n    next();\n}\nfunction collectFallback({ queue, pointer, options, pointerOptions, addSource }) {\n    return queue(async () => {\n        const sources = await loadFile(pointer, {\n            ...options,\n            ...pointerOptions,\n        });\n        if (sources) {\n            for (const source of sources) {\n                addSource({ source, pointer });\n            }\n        }\n    });\n}\nfunction collectFallbackSync({ queue, pointer, options, pointerOptions, addSource }) {\n    return queue(() => {\n        const sources = loadFileSync(pointer, {\n            ...options,\n            ...pointerOptions,\n        });\n        if (sources) {\n            for (const source of sources) {\n                addSource({ source, pointer });\n            }\n        }\n    });\n}\n\n/**\n * @internal\n */\nconst filterKind = (content, filterKinds) => {\n    if (content && content.definitions && content.definitions.length && filterKinds && filterKinds.length > 0) {\n        const invalidDefinitions = [];\n        const validDefinitions = [];\n        for (const definitionNode of content.definitions) {\n            if (filterKinds.includes(definitionNode.kind)) {\n                invalidDefinitions.push(definitionNode);\n            }\n            else {\n                validDefinitions.push(definitionNode);\n            }\n        }\n        if (invalidDefinitions.length > 0) {\n            if (process.env['DEBUG']) {\n                for (const d of invalidDefinitions) {\n                    console.log(`Filtered document of kind ${d.kind} due to filter policy (${filterKinds.join(', ')})`);\n                }\n            }\n        }\n        return {\n            kind: graphql.Kind.DOCUMENT,\n            definitions: validDefinitions,\n        };\n    }\n    return content;\n};\n\nfunction parseSource({ partialSource, options, pointerOptionMap, addValidSource }) {\n    if (partialSource) {\n        const input = prepareInput({\n            source: partialSource,\n            options,\n            pointerOptionMap,\n        });\n        parseSchema(input);\n        parseRawSDL(input);\n        if (input.source.document) {\n            useKindsFilter(input);\n            useComments(input);\n            collectValidSources(input, addValidSource);\n        }\n    }\n}\n//\nfunction prepareInput({ source, options, pointerOptionMap, }) {\n    let specificOptions = {\n        ...options,\n    };\n    if (source.location) {\n        specificOptions = {\n            ...specificOptions,\n            ...pointerOptionMap[source.location],\n        };\n    }\n    return { source: { ...source }, options: specificOptions };\n}\nfunction parseSchema(input) {\n    if (input.source.schema) {\n        input.source.rawSDL = utils.printSchemaWithDirectives(input.source.schema, input.options);\n    }\n}\nfunction parseRawSDL(input) {\n    if (input.source.rawSDL) {\n        input.source.document = utils.parseGraphQLSDL(input.source.location, input.source.rawSDL, input.options).document;\n    }\n}\nfunction useKindsFilter(input) {\n    if (input.options.filterKinds) {\n        input.source.document = filterKind(input.source.document, input.options.filterKinds);\n    }\n}\nfunction useComments(input) {\n    if (!input.source.rawSDL && input.source.document) {\n        input.source.rawSDL = utils.printWithComments(input.source.document);\n        utils.resetComments();\n    }\n}\nfunction collectValidSources(input, addValidSource) {\n    var _a;\n    if (((_a = input.source.document) === null || _a === void 0 ? void 0 : _a.definitions) && input.source.document.definitions.length > 0) {\n        addValidSource(input.source);\n    }\n}\n\nconst CONCURRENCY_LIMIT$1 = 100;\n/**\n * Asynchronously loads any GraphQL documents (i.e. executable documents like\n * operations and fragments as well as type system definitions) from the\n * provided pointers.\n * @param pointerOrPointers Pointers to the sources to load the documents from\n * @param options Additional options\n */\nasync function loadTypedefs(pointerOrPointers, options) {\n    const { ignore, pointerOptionMap } = normalizePointers(pointerOrPointers);\n    options.ignore = utils.asArray(options.ignore || []);\n    options.ignore.push(...ignore);\n    applyDefaultOptions(options);\n    const sources = await collectSources({\n        pointerOptionMap,\n        options,\n    });\n    const validSources = [];\n    // If we have few k of files it may be an issue\n    const limit = useLimit(CONCURRENCY_LIMIT$1);\n    await Promise.all(sources.map(partialSource => limit(() => parseSource({\n        partialSource,\n        options,\n        pointerOptionMap,\n        addValidSource(source) {\n            validSources.push(source);\n        },\n    }))));\n    return prepareResult({ options, pointerOptionMap, validSources });\n}\n/**\n * Synchronously loads any GraphQL documents (i.e. executable documents like\n * operations and fragments as well as type system definitions) from the\n * provided pointers.\n * @param pointerOrPointers Pointers to the sources to load the documents from\n * @param options Additional options\n */\nfunction loadTypedefsSync(pointerOrPointers, options) {\n    const { ignore, pointerOptionMap } = normalizePointers(pointerOrPointers);\n    options.ignore = utils.asArray(options.ignore || []).concat(ignore);\n    applyDefaultOptions(options);\n    const sources = collectSourcesSync({\n        pointerOptionMap,\n        options,\n    });\n    const validSources = [];\n    for (const partialSource of sources) {\n        parseSource({\n            partialSource,\n            options,\n            pointerOptionMap,\n            addValidSource(source) {\n                validSources.push(source);\n            },\n        });\n    }\n    return prepareResult({ options, pointerOptionMap, validSources });\n}\n//\nfunction prepareResult({ options, pointerOptionMap, validSources, }) {\n    const pointerList = Object.keys(pointerOptionMap);\n    if (pointerList.length > 0 && validSources.length === 0) {\n        throw new Error(`\n      Unable to find any GraphQL type definitions for the following pointers:\n        ${pointerList.map(p => `\n          - ${p}\n          `)}`);\n    }\n    return options.sort\n        ? validSources.sort((left, right) => utils.compareStrings(left.location, right.location))\n        : validSources;\n}\n\n/**\n * Kinds of AST nodes that are included in executable documents\n */\nconst OPERATION_KINDS = [graphql.Kind.OPERATION_DEFINITION, graphql.Kind.FRAGMENT_DEFINITION];\n/**\n * Kinds of AST nodes that are included in type system definition documents\n */\nconst NON_OPERATION_KINDS = Object.keys(graphql.Kind)\n    .reduce((prev, v) => [...prev, graphql.Kind[v]], [])\n    .filter(v => !OPERATION_KINDS.includes(v));\n/**\n * Asynchronously loads executable documents (i.e. operations and fragments) from\n * the provided pointers. The pointers may be individual files or a glob pattern.\n * The files themselves may be `.graphql` files or `.js` and `.ts` (in which\n * case they will be parsed using graphql-tag-pluck).\n * @param pointerOrPointers Pointers to the files to load the documents from\n * @param options Additional options\n */\nfunction loadDocuments(pointerOrPointers, options) {\n    return loadTypedefs(pointerOrPointers, { noRequire: true, filterKinds: NON_OPERATION_KINDS, ...options });\n}\n/**\n * Synchronously loads executable documents (i.e. operations and fragments) from\n * the provided pointers. The pointers may be individual files or a glob pattern.\n * The files themselves may be `.graphql` files or `.js` and `.ts` (in which\n * case they will be parsed using graphql-tag-pluck).\n * @param pointerOrPointers Pointers to the files to load the documents from\n * @param options Additional options\n */\nfunction loadDocumentsSync(pointerOrPointers, options) {\n    return loadTypedefsSync(pointerOrPointers, { noRequire: true, filterKinds: NON_OPERATION_KINDS, ...options });\n}\n\n/**\n * Asynchronously loads a schema from the provided pointers.\n * @param schemaPointers Pointers to the sources to load the schema from\n * @param options Additional options\n */\nasync function loadSchema(schemaPointers, options) {\n    var _a;\n    const sources = await loadTypedefs(schemaPointers, {\n        ...options,\n        filterKinds: OPERATION_KINDS,\n    });\n    const { schemas, typeDefs } = collectSchemasAndTypeDefs(sources);\n    const mergeSchemasOptions = {\n        ...options,\n        schemas: schemas.concat((_a = options.schemas) !== null && _a !== void 0 ? _a : []),\n        typeDefs,\n    };\n    const schema$1 = schema.mergeSchemas(mergeSchemasOptions);\n    if (options === null || options === void 0 ? void 0 : options.includeSources) {\n        includeSources(schema$1, sources);\n    }\n    return options.sort ? graphql.lexicographicSortSchema(schema$1) : schema$1;\n}\n/**\n * Synchronously loads a schema from the provided pointers.\n * @param schemaPointers Pointers to the sources to load the schema from\n * @param options Additional options\n */\nfunction loadSchemaSync(schemaPointers, options) {\n    const sources = loadTypedefsSync(schemaPointers, {\n        filterKinds: OPERATION_KINDS,\n        ...options,\n    });\n    const { schemas, typeDefs } = collectSchemasAndTypeDefs(sources);\n    const schema$1 = schema.mergeSchemas({\n        schemas,\n        typeDefs,\n        ...options,\n    });\n    if (options === null || options === void 0 ? void 0 : options.includeSources) {\n        includeSources(schema$1, sources);\n    }\n    return options.sort ? graphql.lexicographicSortSchema(schema$1) : schema$1;\n}\nfunction includeSources(schema, sources) {\n    const finalSources = [];\n    for (const source of sources) {\n        if (source.rawSDL) {\n            finalSources.push(new graphql.Source(source.rawSDL, source.location));\n        }\n        else if (source.document) {\n            finalSources.push(new graphql.Source(graphql.print(source.document), source.location));\n        }\n    }\n    schema.extensions = {\n        ...schema.extensions,\n        sources: finalSources,\n        extendedSources: sources,\n    };\n}\nfunction collectSchemasAndTypeDefs(sources) {\n    const schemas = [];\n    const typeDefs = [];\n    for (const source of sources) {\n        if (source.schema) {\n            schemas.push(source.schema);\n        }\n        else if (source.document) {\n            typeDefs.push(source.document);\n        }\n    }\n    return {\n        schemas,\n        typeDefs,\n    };\n}\n\nexports.NON_OPERATION_KINDS = NON_OPERATION_KINDS;\nexports.OPERATION_KINDS = OPERATION_KINDS;\nexports.filterKind = filterKind;\nexports.loadDocuments = loadDocuments;\nexports.loadDocumentsSync = loadDocumentsSync;\nexports.loadSchema = loadSchema;\nexports.loadSchemaSync = loadSchemaSync;\nexports.loadTypedefs = loadTypedefs;\nexports.loadTypedefsSync = loadTypedefsSync;\n"]}