{"version":3,"file":"remote-entry.js","names":["e.remote_request_property"],"sources":["../../node_modules/@sveltejs/kit/src/runtime/app/server/remote/shared.js","../../node_modules/@sveltejs/kit/src/runtime/app/server/remote/command.js","../../node_modules/@sveltejs/kit/src/runtime/app/server/remote/form.js","../../node_modules/@sveltejs/kit/src/runtime/app/server/remote/prerender.js","../../node_modules/@sveltejs/kit/src/utils/shared-iterator.js","../../node_modules/@sveltejs/kit/src/runtime/app/server/remote/query.js","../../node_modules/@sveltejs/kit/src/runtime/app/server/remote/requested.js"],"sourcesContent":["/** @import { RequestEvent } from '@sveltejs/kit' */\n/** @import { MaybePromise, RequestState, RemoteInternals, RequestStore, RemoteLiveQueryUserFunctionReturnType } from 'types' */\nimport { error } from '@sveltejs/kit';\nimport { ValidationError } from '@sveltejs/kit/internal';\nimport { with_request_store } from '@sveltejs/kit/internal/server';\nimport * as e from '../../../../messages/server-errors.js';\n\n/**\n * @param {any} validate_or_fn\n * @param {((arg?: any) => any) | undefined} [maybe_fn]\n * @returns {(arg?: any) => MaybePromise<any>}\n */\nexport function create_validator(validate_or_fn, maybe_fn) {\n\t// prevent functions without validators being called with arguments\n\tif (!maybe_fn) {\n\t\treturn (arg) => {\n\t\t\tif (arg !== undefined) {\n\t\t\t\terror(400, 'Bad Request');\n\t\t\t}\n\t\t};\n\t}\n\n\t// if 'unchecked', pass input through without validating\n\tif (validate_or_fn === 'unchecked') {\n\t\treturn (arg) => arg;\n\t}\n\n\t// use https://standardschema.dev validator if provided\n\tif ('~standard' in validate_or_fn) {\n\t\treturn async (arg) => {\n\t\t\t// access property and call method in one go to preserve potential this context\n\t\t\tconst result = await validate_or_fn['~standard'].validate(arg);\n\n\t\t\t// if the `issues` field exists, the validation failed\n\t\t\tif (result.issues) {\n\t\t\t\tthrow new ValidationError(result.issues);\n\t\t\t}\n\n\t\t\treturn result.value;\n\t\t};\n\t}\n\n\te.remote_invalid_validator();\n}\n\n/**\n * In case of a single remote function call, just returns the result.\n *\n * In case of a full page reload, returns the response for a remote function call,\n * either from the cache or by invoking the function.\n * Also saves an uneval'ed version of the result for later HTML inlining for hydration.\n *\n * @template {MaybePromise<any>} T\n * @param {RemoteInternals} internals\n * @param {string} payload — the stringified raw argument (i.e. the cache key the client will use)\n * @param {RequestState} state\n * @param {() => Promise<T>} get_result\n * @returns {Promise<T>}\n */\nexport async function get_response(internals, payload, state, get_result) {\n\t// wait a beat, in case `myQuery().set(...)` or `myQuery().refresh()` is immediately called\n\t// eslint-disable-next-line @typescript-eslint/await-thenable\n\tawait 0;\n\n\tconst cache = get_cache(internals, state);\n\n\tif (!state.is_in_remote_query) {\n\t\t// if this is a top-level (not nested) `await myQuery()`, include it in the serialized response\n\t\tget_implicit_lookup(internals, state)[payload] = get_result;\n\t}\n\n\treturn (cache[payload] ??= get_result());\n}\n\n/**\n * @param {RequestEvent} event\n * @param {RequestState} state\n * @param {boolean} allow_cookies\n * @returns {RequestStore}\n */\nfunction derive_remote_function_event(event, state, allow_cookies) {\n\t/** @type {RequestEvent} */\n\tconst derived = {\n\t\t...event,\n\t\tsetHeaders: () => {\n\t\t\te.remote_headers_forbidden();\n\t\t},\n\t\tcookies: {\n\t\t\t...event.cookies,\n\t\t\tset: (name, value, opts) => {\n\t\t\t\tif (!allow_cookies) {\n\t\t\t\t\te.remote_cookie_forbidden({ operation: 'set' });\n\t\t\t\t}\n\n\t\t\t\tif (opts?.path && !opts.path.startsWith('/')) {\n\t\t\t\t\te.remote_cookie_path_relative({ operation: 'set' });\n\t\t\t\t}\n\n\t\t\t\treturn event.cookies.set(name, value, opts);\n\t\t\t},\n\t\t\tdelete: (name, opts) => {\n\t\t\t\tif (!allow_cookies) {\n\t\t\t\t\te.remote_cookie_forbidden({ operation: 'delete' });\n\t\t\t\t}\n\n\t\t\t\tif (opts?.path && !opts.path.startsWith('/')) {\n\t\t\t\t\te.remote_cookie_path_relative({ operation: 'deleted' });\n\t\t\t\t}\n\n\t\t\t\treturn event.cookies.delete(name, opts);\n\t\t\t}\n\t\t}\n\t};\n\n\tif (state.is_in_remote_query) {\n\t\tfor (const property of ['url', 'params', 'route']) {\n\t\t\t// non-enumerable so spreading for a nested derivation doesn't invoke the getter\n\t\t\tObject.defineProperty(derived, property, {\n\t\t\t\tenumerable: false,\n\t\t\t\tget() {\n\t\t\t\t\treturn e.remote_request_property({ property });\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\treturn {\n\t\tevent: derived,\n\t\tstate: {\n\t\t\t...state,\n\t\t\tis_in_remote_function: true\n\t\t}\n\t};\n}\n\n/**\n * Like `with_event` but removes things from `event` you cannot see/call in remote functions, such as `setHeaders`.\n * @template T\n * @param {RequestEvent} event\n * @param {RequestState} state\n * @param {boolean} allow_cookies\n * @param {() => any} get_input\n * @param {(arg?: any) => T} fn\n */\nexport async function run_remote_function(event, state, allow_cookies, get_input, fn) {\n\tconst store = derive_remote_function_event(event, state, allow_cookies);\n\n\t// In two parts, each with_event, so that runtimes without async local storage can still get the event at the start of the function\n\tconst input = await with_request_store(store, get_input);\n\treturn with_request_store(store, () => fn(input));\n}\n\n/**\n * Like `with_event` but removes things from `event` you cannot see/call in remote functions, such as `setHeaders`.\n * @template T\n * @param {RequestEvent} event\n * @param {RequestState} state\n * @param {boolean} allow_cookies\n * @param {() => any} get_input\n * @param {(arg?: any) => RemoteLiveQueryUserFunctionReturnType<T>} fn\n * @param {string} name\n */\nexport async function* run_remote_generator(event, state, allow_cookies, get_input, fn, name) {\n\tconst store = derive_remote_function_event(event, state, allow_cookies);\n\n\t// In two parts, each with_event, so that runtimes without async local storage can still get the event at the start of the function / calls to next\n\tconst input = await with_request_store(store, get_input);\n\tconst source = await with_request_store(store, () => fn(input));\n\tconst iterator = to_iterator(source, name);\n\tlet done = false;\n\n\ttry {\n\t\twhile (true) {\n\t\t\t// the code of a generator function is basically chopped apart at each\n\t\t\t// yield, and each part is an invocation of `.next`. So, to provide\n\t\t\t// access to the request context in generator functions, we have to\n\t\t\t// provide it to every invocation of `.next`. (It's more obvious that\n\t\t\t// this is necessary with plain iterators.)\n\t\t\tconst result = await with_request_store(store, () => iterator.next());\n\t\t\tif (result.done) {\n\t\t\t\tdone = true;\n\t\t\t\treturn result.value;\n\t\t\t}\n\t\t\tyield result.value;\n\t\t}\n\t} finally {\n\t\tif (!done && typeof iterator.return === 'function') {\n\t\t\tawait with_request_store(store, () => iterator.return?.(undefined));\n\t\t}\n\t}\n}\n\n/**\n * @template T\n * @param {Awaited<RemoteLiveQueryUserFunctionReturnType<T>>} source\n * @param {string} name\n * @returns {Iterator<T> | AsyncIterator<T>}\n */\nfunction to_iterator(source, name) {\n\t// intentionally using `in` because these could be inherited\n\tif ('next' in source && typeof source.next === 'function') {\n\t\treturn source;\n\t}\n\n\tif (Symbol.asyncIterator in source && typeof source[Symbol.asyncIterator] === 'function') {\n\t\treturn source[Symbol.asyncIterator]();\n\t}\n\n\tif (Symbol.iterator in source && typeof source[Symbol.iterator] === 'function') {\n\t\treturn source[Symbol.iterator]();\n\t}\n\n\te.remote_query_live_not_iterable({ name });\n}\n\n/**\n * Note that `state` is deliberately not optional: resources that capture the request\n * state at creation must pass it explicitly, because reading it from the request store\n * at call time is only equivalent on runtimes with `AsyncLocalStorage` support.\n * Callers without a captured state (such as the module-level `form` instance getters)\n * should pass `get_request_store().state` themselves.\n * @param {RemoteInternals} internals\n * @param {RequestState} state\n */\nexport function get_cache(internals, state) {\n\tlet cache = state.remote.data?.get(internals);\n\n\tif (cache === undefined) {\n\t\tcache = {};\n\t\t(state.remote.data ??= new Map()).set(internals, cache);\n\t}\n\n\treturn cache;\n}\n\n/**\n * @param {RemoteInternals} internals\n * @param {RequestState} state\n */\nexport function get_implicit_lookup(internals, state) {\n\tlet cache = state.remote.implicit?.get(internals);\n\n\tif (cache === undefined) {\n\t\tcache = {};\n\t\t(state.remote.implicit ??= new Map()).set(internals, cache);\n\t}\n\n\treturn cache;\n}\n","/** @import { RemoteCommand } from '$app/server' */\n/** @import { MaybePromise, RemoteCommandInternals } from 'types' */\n/** @import { StandardSchemaV1 } from '@standard-schema/spec' */\nimport { get_request_store } from '@sveltejs/kit/internal/server';\nimport { create_validator, run_remote_function } from './shared.js';\nimport { MUTATIVE_METHODS } from '../../../../constants.js';\nimport * as e from '../../../../messages/server-errors.js';\n\n/**\n * Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.\n *\n * @template Output\n * @overload\n * @param {() => MaybePromise<Output>} fn\n * @returns {RemoteCommand<void, Output>}\n * @since 2.27\n */\n/**\n * Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.\n *\n * @template Input\n * @template Output\n * @overload\n * @param {'unchecked'} validate\n * @param {(arg: Input) => MaybePromise<Output>} fn\n * @returns {RemoteCommand<Input, Output>}\n * @since 2.27\n */\n/**\n * Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.\n *\n * @template {StandardSchemaV1} Schema\n * @template Output\n * @overload\n * @param {Schema} validate\n * @param {(arg: StandardSchemaV1.InferOutput<Schema>) => MaybePromise<Output>} fn\n * @returns {RemoteCommand<StandardSchemaV1.InferInput<Schema>, Output>}\n * @since 2.27\n */\n/**\n * @template Input\n * @template Output\n * @param {any} validate_or_fn\n * @param {(arg?: Input) => MaybePromise<Output>} [maybe_fn]\n * @returns {RemoteCommand<Input, Output>}\n * @since 2.27\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function command(validate_or_fn, maybe_fn) {\n\t/** @type {(arg?: Input) => MaybePromise<Output>} */\n\tconst fn = maybe_fn ?? validate_or_fn;\n\n\t/** @type {(arg?: any) => MaybePromise<Input>} */\n\tconst validate = create_validator(validate_or_fn, maybe_fn);\n\n\t/** @type {RemoteCommandInternals} */\n\tconst __ = { type: 'command', id: '', name: '' };\n\n\t/** @type {RemoteCommand<Input, Output> & { __: RemoteCommandInternals }} */\n\tconst wrapper = (arg) => {\n\t\tconst { event, state } = get_request_store();\n\n\t\tif (\n\t\t\t!MUTATIVE_METHODS.includes(event.request.method) ||\n\t\t\tstate.is_in_remote_query ||\n\t\t\tstate.is_in_remote_prerender\n\t\t) {\n\t\t\tif (state.is_in_remote_query || state.is_in_remote_prerender) {\n\t\t\t\te.remote_command_readonly({ name: __.name });\n\t\t\t}\n\t\t\te.remote_command_method({ name: __.name, method: event.request.method });\n\t\t}\n\n\t\tif (state.is_in_render) {\n\t\t\te.remote_command_render({ name: __.name });\n\t\t}\n\n\t\tconst promise = Promise.resolve(\n\t\t\trun_remote_function(event, state, true, () => validate(arg), fn)\n\t\t);\n\n\t\t// @ts-expect-error\n\t\tpromise.updates = () => {\n\t\t\te.server_api_unavailable({ name: `${__.name}(...).updates(...)` });\n\t\t};\n\n\t\treturn /** @type {ReturnType<RemoteCommand<Input, Output>>} */ (promise);\n\t};\n\n\tObject.defineProperty(wrapper, '__', { value: __ });\n\n\t// On the server, pending is always 0\n\tObject.defineProperty(wrapper, 'pending', {\n\t\tget: () => 0\n\t});\n\n\treturn wrapper;\n}\n","/** @import { RemoteFormInput, RemoteForm, RemoteFormInvalidField } from '$app/server' */\n/** @import { InternalRemoteFormIssue, MaybePromise, HasNonOptionalBoolean, RemoteFormInternals } from 'types' */\n/** @import { StandardSchemaV1 } from '@standard-schema/spec' */\nimport { get_request_store } from '@sveltejs/kit/internal/server';\nimport {\n\tcreate_field_proxy,\n\tsplit_path,\n\tdeep_set,\n\tnormalize_issue,\n\tflatten_issues,\n\tparse_form_key\n} from '../../../form-utils.js';\nimport { get_cache, get_implicit_lookup, run_remote_function } from './shared.js';\nimport { ActionFailure, ValidationError } from '@sveltejs/kit/internal';\nimport { DEV } from 'esm-env';\nimport * as e from '../../../../messages/server-errors.js';\n\n/**\n * Creates a form object that can be spread onto a `<form>` element.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.\n *\n * @template Output\n * @overload\n * @param {() => MaybePromise<Output>} fn\n * @returns {RemoteForm<void, Output>}\n * @since 2.27\n */\n/**\n * Creates a form object that can be spread onto a `<form>` element.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.\n *\n * @template {RemoteFormInput} Input\n * @template Output\n * @overload\n * @param {'unchecked'} validate\n * @param {(data: Input, issue: RemoteFormInvalidField<Input>) => MaybePromise<Output>} fn\n * @returns {RemoteForm<Input, Output>}\n * @since 2.27\n */\n/**\n * Creates a form object that can be spread onto a `<form>` element.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.\n *\n * @template {StandardSchemaV1<RemoteFormInput, Record<string, any>>} Schema\n * @template Output\n * @overload\n * @param {true extends HasNonOptionalBoolean<StandardSchemaV1.InferInput<Schema>> ? 'Error: All booleans in form schemas must be optional (e.g. `v.optional(v.boolean(), false)`) because checkbox inputs do not send a false value when unchecked.' : Schema} validate\n * @param {(data: StandardSchemaV1.InferOutput<Schema>, issue: RemoteFormInvalidField<StandardSchemaV1.InferInput<Schema>>) => MaybePromise<Output>} fn\n * @returns {RemoteForm<StandardSchemaV1.InferInput<Schema>, Output>}\n * @since 2.27\n */\n/**\n * @template {RemoteFormInput} Input\n * @template Output\n * @param {any} validate_or_fn\n * @param {(data_or_issue: any, issue?: any) => MaybePromise<Output>} [maybe_fn]\n * @returns {RemoteForm<Input, Output>}\n * @since 2.27\n */\n/*@__NO_SIDE_EFFECTS__*/\n// @ts-ignore we don't want to prefix `fn` with an underscore, as that will be user-visible\nexport function form(validate_or_fn, maybe_fn) {\n\t/** @type {any} */\n\tconst fn = maybe_fn ?? validate_or_fn;\n\n\t/** @type {StandardSchemaV1 | null} */\n\tconst schema =\n\t\t!maybe_fn || validate_or_fn === 'unchecked' ? null : /** @type {any} */ (validate_or_fn);\n\n\t/**\n\t * @param {string | number | boolean} [key]\n\t */\n\tfunction create_instance(key) {\n\t\tconst instance = /** @type {RemoteForm<Input, Output>} */ ({});\n\n\t\tinstance.method = 'POST';\n\n\t\tObject.defineProperty(instance, 'enhance', {\n\t\t\tvalue: () => {\n\t\t\t\treturn { action: instance.action, method: instance.method };\n\t\t\t}\n\t\t});\n\n\t\t/** @type {RemoteFormInternals} */\n\t\tconst __ = {\n\t\t\ttype: 'form',\n\t\t\tname: '',\n\t\t\tid: '',\n\t\t\tfn: async (data, meta, form_data) => {\n\t\t\t\tconst output =\n\t\t\t\t\t/** @type {{ submission: true, input?: Record<string, any>, issues?: InternalRemoteFormIssue[], result: Output }} */ ({});\n\n\t\t\t\t// make it possible to differentiate between user submission and programmatic `field.set(...)` updates\n\t\t\t\toutput.submission = true;\n\n\t\t\t\tconst { event, state } = get_request_store();\n\t\t\t\tconst validated = await schema?.['~standard'].validate(data);\n\n\t\t\t\tif (meta.validate_only) {\n\t\t\t\t\treturn validated?.issues?.map((issue) => normalize_issue(issue, true)) ?? [];\n\t\t\t\t}\n\n\t\t\t\tif (validated?.issues !== undefined) {\n\t\t\t\t\thandle_issues(output, validated.issues, form_data, __.id);\n\t\t\t\t} else {\n\t\t\t\t\tif (validated !== undefined) {\n\t\t\t\t\t\tdata = validated.value;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst issue = create_issues();\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\toutput.result = await run_remote_function(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t() => data,\n\t\t\t\t\t\t\t(data) => (!maybe_fn ? fn() : fn(data, issue))\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (DEV && output.result instanceof ActionFailure) {\n\t\t\t\t\t\t\te.remote_form_fail();\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (error instanceof ValidationError) {\n\t\t\t\t\t\t\thandle_issues(output, error.issues, form_data, __.id);\n\t\t\t\t\t\t} else if (DEV && error instanceof ActionFailure) {\n\t\t\t\t\t\t\te.remote_form_fail(undefined, { cause: error });\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We don't need to care about args or deduplicating calls, because uneval results are only relevant in full page reloads\n\t\t\t\t// where only one form submission is active at the same time\n\t\t\t\tif (!event.isRemoteRequest) {\n\t\t\t\t\tconst cache = get_cache(__, state);\n\t\t\t\t\tcache[''] ??= output;\n\n\t\t\t\t\t// register under the client-side action id so the output is serialized\n\t\t\t\t\t// into the page, allowing the hydrated client to restore `result`/`issues`/`input`\n\t\t\t\t\tget_implicit_lookup(__, state)[__.key ? `${__.id}/${__.key}` : __.id] = () => cache[''];\n\t\t\t\t}\n\n\t\t\t\treturn output;\n\t\t\t}\n\t\t};\n\n\t\tObject.defineProperty(instance, '__', { value: __ });\n\n\t\tObject.defineProperty(instance, 'action', {\n\t\t\tget: () => {\n\t\t\t\tconst { event, state } = get_request_store();\n\t\t\t\tconst search = new URLSearchParams(state.prerendering ? '' : event.url.search);\n\t\t\t\tsearch.delete('/remote');\n\n\t\t\t\tconst query = search.toString();\n\t\t\t\tconst action_id = __.key ? `${__.id}/${encodeURIComponent(__.key)}` : __.id;\n\n\t\t\t\treturn `?${query ? `${query}&` : ''}/remote=${action_id}`;\n\t\t\t},\n\t\t\tenumerable: true\n\t\t});\n\n\t\tObject.defineProperty(instance, 'fields', {\n\t\t\tget() {\n\t\t\t\t// the form instance is created once per module and shared across requests,\n\t\t\t\t// so the current request's state has to be resolved at access time\n\t\t\t\treturn create_field_proxy({\n\t\t\t\t\tform_id: __.id,\n\t\t\t\t\tget: () => get_cache(__, get_request_store().state)?.['']?.input ?? {},\n\t\t\t\t\tset: (path, value) => {\n\t\t\t\t\t\tconst cache = get_cache(__, get_request_store().state);\n\t\t\t\t\t\tconst entry = cache[''];\n\n\t\t\t\t\t\tif (entry?.submission) {\n\t\t\t\t\t\t\t// don't override a submission\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (path.length === 0) {\n\t\t\t\t\t\t\t(cache[''] ??= {}).input = value;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst input = entry?.input ?? {};\n\t\t\t\t\t\tdeep_set(input, path.map(String), value);\n\t\t\t\t\t\t(cache[''] ??= {}).input = input;\n\t\t\t\t\t},\n\t\t\t\t\tget_issues: () =>\n\t\t\t\t\t\tflatten_issues(get_cache(__, get_request_store().state)?.['']?.issues ?? []),\n\t\t\t\t\tget_touched: () => ({}),\n\t\t\t\t\tget_dirty: () => ({})\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(instance, 'result', {\n\t\t\tget() {\n\t\t\t\ttry {\n\t\t\t\t\treturn get_cache(__, get_request_store().state)?.['']?.result;\n\t\t\t\t} catch {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// On the server, pending is always 0\n\t\tObject.defineProperty(instance, 'pending', {\n\t\t\tget: () => 0\n\t\t});\n\n\t\tObject.defineProperty(instance, 'submitted', {\n\t\t\tget: () => false\n\t\t});\n\n\t\tObject.defineProperty(instance, 'preflight', {\n\t\t\t// preflight is a noop on the server\n\t\t\tvalue: () => instance\n\t\t});\n\n\t\tObject.defineProperty(instance, 'validate', {\n\t\t\tvalue: () => {\n\t\t\t\te.server_api_unavailable({ name: 'form.validate()' });\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(instance, 'submit', {\n\t\t\tvalue: () => {\n\t\t\t\te.server_api_unavailable({ name: 'form.submit()' });\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(instance, 'element', {\n\t\t\tget: () => null\n\t\t});\n\n\t\tif (key == undefined) {\n\t\t\tObject.defineProperty(instance, 'for', {\n\t\t\t\t/** @type {RemoteForm<any, any>['for']} */\n\t\t\t\tvalue: (key) => {\n\t\t\t\t\tconst { state } = get_request_store();\n\t\t\t\t\tconst cache_key = __.id + '|' + JSON.stringify(key);\n\t\t\t\t\t/** @type {RemoteForm<Input, Output> & { __: RemoteFormInternals }} */\n\t\t\t\t\tlet instance = (state.remote.forms ??= new Map()).get(cache_key);\n\n\t\t\t\t\tif (!instance) {\n\t\t\t\t\t\tinstance = /** @type {RemoteForm<Input, Output> & { __: RemoteFormInternals }} */ (\n\t\t\t\t\t\t\tcreate_instance(key)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinstance.__.id = __.id;\n\t\t\t\t\t\tinstance.__.key = JSON.stringify(key);\n\t\t\t\t\t\tinstance.__.name = __.name;\n\n\t\t\t\t\t\tstate.remote.forms.set(cache_key, instance);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn instance;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn instance;\n\t}\n\n\treturn create_instance();\n}\n\n/**\n * @param {{ issues?: InternalRemoteFormIssue[], input?: Record<string, any>, result: any }} output\n * @param {readonly StandardSchemaV1.Issue[]} issues\n * @param {FormData | null} form_data - null if the form is progressively enhanced\n * @param {string} form_id - hash/name of the form\n */\nfunction handle_issues(output, issues, form_data, form_id) {\n\toutput.issues = issues.map((issue) => normalize_issue(issue, true));\n\n\t// if it was a progressively-enhanced submission, we don't need\n\t// to return the input — it's already there\n\tif (form_data) {\n\t\toutput.input = {};\n\n\t\tfor (const field_name of form_data.keys()) {\n\t\t\tconst field = parse_form_key(form_id, field_name);\n\t\t\tconst path = split_path(field.name);\n\n\t\t\t// redact sensitive fields\n\t\t\tif (path.some((part) => part.startsWith('_'))) continue;\n\n\t\t\tconst values = form_data.getAll(field_name).filter((value) => typeof value === 'string');\n\n\t\t\tdeep_set(\n\t\t\t\t/** @type {Record<string, any>} */ (output.input),\n\t\t\t\tpath,\n\t\t\t\tfield.is_array ? values : values[0]\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Creates an invalid function that can be used to imperatively mark form fields as invalid\n * @returns {RemoteFormInvalidField<any>}\n */\nfunction create_issues() {\n\treturn /** @type {RemoteFormInvalidField<any>} */ (\n\t\tnew Proxy(\n\t\t\t/** @param {string} message */\n\t\t\t(message) => {\n\t\t\t\treturn create_issue(message);\n\t\t\t},\n\t\t\t{\n\t\t\t\tget(target, prop) {\n\t\t\t\t\tif (typeof prop === 'symbol') return /** @type {any} */ (target)[prop];\n\n\t\t\t\t\treturn create_issue_proxy(prop, []);\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t);\n\n\t/**\n\t * @param {string} message\n\t * @param {(string | number)[]} path\n\t * @returns {StandardSchemaV1.Issue}\n\t */\n\tfunction create_issue(message, path = []) {\n\t\treturn {\n\t\t\tmessage,\n\t\t\tpath\n\t\t};\n\t}\n\n\t/**\n\t * Creates a proxy that builds up a path and returns a function to create an issue\n\t * @param {string | number} key\n\t * @param {(string | number)[]} path\n\t */\n\tfunction create_issue_proxy(key, path) {\n\t\tconst new_path = [...path, key];\n\n\t\t/**\n\t\t * @param {string} message\n\t\t * @returns {StandardSchemaV1.Issue}\n\t\t */\n\t\tconst issue_func = (message) => create_issue(message, new_path);\n\n\t\treturn new Proxy(issue_func, {\n\t\t\tget(target, prop) {\n\t\t\t\tif (typeof prop === 'symbol') return /** @type {any} */ (target)[prop];\n\n\t\t\t\t// Handle array access like invalid.items[0]\n\t\t\t\tif (/^\\d+$/.test(prop)) {\n\t\t\t\t\treturn create_issue_proxy(parseInt(prop, 10), new_path);\n\t\t\t\t}\n\n\t\t\t\t// Handle property access like invalid.field.nested\n\t\t\t\treturn create_issue_proxy(prop, new_path);\n\t\t\t}\n\t\t});\n\t}\n}\n","/** @import { RemoteResource, RemotePrerenderFunction } from '$app/server' */\n/** @import { RemoteFunctionResponse, RemotePrerenderInputsGenerator, RemotePrerenderInternals, MaybePromise } from 'types' */\n/** @import { StandardSchemaV1 } from '@standard-schema/spec' */\nimport { HandledHttpError } from '@sveltejs/kit/internal';\nimport { get_request_store } from '@sveltejs/kit/internal/server';\nimport { stringify_remote_arg } from '../../../shared.js';\nimport { parse, stringify } from '#app/internal/transport';\nimport { noop } from '../../../../utils/functions.js';\nimport { app_dir, base } from '#app/paths';\nimport { create_validator, get_response, run_remote_function } from './shared.js';\n\n/**\n * Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.\n *\n * @template Output\n * @overload\n * @param {() => MaybePromise<Output>} fn\n * @param {{ inputs?: RemotePrerenderInputsGenerator<void>, dynamic?: boolean }} [options]\n * @returns {RemotePrerenderFunction<void, Output>}\n * @since 2.27\n */\n/**\n * Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.\n *\n * @template Input\n * @template Output\n * @overload\n * @param {'unchecked'} validate\n * @param {(arg: Input) => MaybePromise<Output>} fn\n * @param {{ inputs?: RemotePrerenderInputsGenerator<Input>, dynamic?: boolean }} [options]\n * @returns {RemotePrerenderFunction<Input, Output>}\n * @since 2.27\n */\n/**\n * Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.\n *\n * @template {StandardSchemaV1} Schema\n * @template Output\n * @overload\n * @param {Schema} schema\n * @param {(arg: StandardSchemaV1.InferOutput<Schema>) => MaybePromise<Output>} fn\n * @param {{ inputs?: RemotePrerenderInputsGenerator<StandardSchemaV1.InferInput<Schema>>, dynamic?: boolean }} [options]\n * @returns {RemotePrerenderFunction<StandardSchemaV1.InferInput<Schema>, Output>}\n * @since 2.27\n */\n/**\n * @template Input\n * @template Output\n * @param {any} validate_or_fn\n * @param {any} [fn_or_options]\n * @param {{ inputs?: RemotePrerenderInputsGenerator<Input>, dynamic?: boolean }} [maybe_options]\n * @returns {RemotePrerenderFunction<Input, Output>}\n * @since 2.27\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function prerender(validate_or_fn, fn_or_options, maybe_options) {\n\tconst maybe_fn = typeof fn_or_options === 'function' ? fn_or_options : undefined;\n\n\t/** @type {typeof maybe_options} */\n\tconst options = maybe_options ?? (maybe_fn ? undefined : fn_or_options);\n\n\t/** @type {(arg?: Input) => MaybePromise<Output>} */\n\tconst fn = maybe_fn ?? validate_or_fn;\n\n\t/** @type {(arg?: any) => MaybePromise<Input>} */\n\tconst validate = create_validator(validate_or_fn, maybe_fn);\n\n\t/** @type {RemotePrerenderInternals} */\n\tconst __ = {\n\t\ttype: 'prerender',\n\t\tid: '',\n\t\tname: '',\n\t\thas_arg: !!maybe_fn,\n\t\tinputs: options?.inputs,\n\t\tdynamic: options?.dynamic\n\t};\n\n\t/** @type {RemotePrerenderFunction<Input, Output> & { __: RemotePrerenderInternals }} */\n\tconst wrapper = (arg) => {\n\t\tconst { event, state } = get_request_store();\n\t\tconst payload = stringify_remote_arg(arg);\n\n\t\t// `get_response` (as opposed to bare `get_cache`) also registers the call in the\n\t\t// implicit lookup, so that the result is inlined into the page payload (`data.p`)\n\t\t// and the client doesn't need to fetch it again upon hydration\n\t\t/** @type {Promise<Output> & Partial<RemoteResource<Output>>} */\n\t\tconst promise = get_response(__, payload, state, async () => {\n\t\t\tconst id = __.id;\n\t\t\tconst url = `${base}/${app_dir}/remote/${id}${payload ? `/${payload}` : ''}`;\n\n\t\t\tif (!state.prerendering && !__SVELTEKIT_DEV__ && !event.isRemoteRequest) {\n\t\t\t\t/** @type {RemoteFunctionResponse | undefined} */\n\t\t\t\tlet prerendered;\n\n\t\t\t\ttry {\n\t\t\t\t\t// TODO adapters can provide prerendered data more efficiently than\n\t\t\t\t\t// fetching from the public internet\n\t\t\t\t\t// `request.url` rather than `event.url`, which throws inside queries\n\t\t\t\t\tconst response = await fetch(new URL(url, event.request.url).href, {\n\t\t\t\t\t\t// in the unlikely event that an attacker is able to spoof the origin,\n\t\t\t\t\t\t// this protects us against SSRF (the attacker-controlled server cannot\n\t\t\t\t\t\t// trick us into making a request to an internal resource)\n\t\t\t\t\t\tredirect: 'manual'\n\t\t\t\t\t});\n\n\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\tprerendered = /** @type {RemoteFunctionResponse} */ (await response.json());\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// not available prerendered, fallback to normal function\n\t\t\t\t}\n\n\t\t\t\tif (prerendered) {\n\t\t\t\t\tif (prerendered.type === 'error') {\n\t\t\t\t\t\tthrow new HandledHttpError(prerendered.error);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn parse(prerendered.data)._;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// during a prerender run, the same function might be invoked while rendering\n\t\t\t// multiple pages — share the result across the entire run\n\t\t\tif (state.prerendering?.remote_responses.has(url)) {\n\t\t\t\treturn /** @type {Promise<any>} */ (state.prerendering.remote_responses.get(url));\n\t\t\t}\n\n\t\t\tconst promise = run_remote_function(\n\t\t\t\tevent,\n\t\t\t\t{ ...state, is_in_remote_prerender: true },\n\t\t\t\tfalse,\n\t\t\t\t() => validate(arg),\n\t\t\t\tfn\n\t\t\t);\n\n\t\t\tif (state.prerendering) {\n\t\t\t\tstate.prerendering.remote_responses.set(url, promise);\n\t\t\t}\n\n\t\t\tconst result = await promise;\n\n\t\t\tif (state.prerendering) {\n\t\t\t\tconst body = { type: 'result', data: stringify({ _: result }) };\n\t\t\t\tstate.prerendering.dependencies.set(url, {\n\t\t\t\t\tbody: JSON.stringify(body),\n\t\t\t\t\tresponse: Response.json(body)\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// TODO this is missing error/loading/current/status\n\t\t\treturn result;\n\t\t});\n\n\t\tpromise.catch(noop);\n\n\t\treturn /** @type {RemoteResource<Output>} */ (promise);\n\t};\n\n\tObject.defineProperty(wrapper, '__', { value: __ });\n\n\treturn wrapper;\n}\n","/**\n * A pull-style async iterator that fans out a single stream of values to\n * multiple `for await (...)` consumers. Each subscriber gets its own\n * `AsyncGenerator` whose `.next()` resolves whenever a value is pushed via\n * `push(value)`. Multiple consumers see the same values without each one\n * driving an independent underlying source.\n *\n * Backpressure is **latest-wins**: if values arrive faster than a particular\n * consumer drains its iterator, only the most-recently-pushed value is kept\n * pending for that subscriber. Earlier undrained values are dropped. This is\n * appropriate for live data streams (reactive state replication), not for\n * event logs where every value must be delivered.\n *\n * Lifecycle hooks are exposed via the constructor:\n *\n *   - `start()` is called when the subscriber count transitions\n *     from 0 to 1 (e.g. to start a pump pulling from a real source).\n *   - `stop()` is called when the subscriber count transitions\n *     from non-zero back to 0 (e.g. to tear down that pump).\n *\n * Either hook may be omitted.\n *\n * The owner is responsible for calling `push(value)` to broadcast values,\n * `done()` to signal natural completion to all subscribers, and `fail(error)`\n * to broadcast a terminal error. After `done()` or `fail()`, the iterator\n * rejects further `subscribe()` calls with the terminal state appropriately.\n *\n * @template T\n */\nexport class SharedIterator {\n\t/**\n\t * @typedef {object} Subscriber\n\t * @property {{ value: any } | null} pending\n\t * @property {{ error: unknown } | null} pending_error\n\t * @property {boolean} finished\n\t * @property {((result: IteratorResult<any, void>) => void) | null} waiting_resolve\n\t * @property {((reason: unknown) => void) | null} waiting_reject\n\t */\n\n\t/** @type {Set<Subscriber>} */\n\t#subscribers = new Set();\n\n\t/** @type {((instance: SharedIterator<T>) => (() => void)) | undefined} */\n\t#start = undefined;\n\n\t/** @type {(() => void) | undefined} */\n\t#stop = undefined;\n\n\t/** Once `done()` or `fail()` has been broadcast, no new values are accepted. */\n\t#closed = false;\n\n\t/** @type {unknown} */\n\t#terminal_error = undefined;\n\n\t/** Whether `done()` or `fail()` has been broadcast. */\n\tget closed() {\n\t\treturn this.#closed;\n\t}\n\n\t/**\n\t * @param {(instance: SharedIterator<T>) => (() => void)} [start]\n\t */\n\tconstructor(start) {\n\t\tthis.#start = start;\n\t}\n\n\t/** @param {T} value */\n\tpush(value) {\n\t\tif (this.#closed) return;\n\t\tfor (const subscriber of this.#subscribers) {\n\t\t\tif (subscriber.waiting_resolve) {\n\t\t\t\tconst resolve = subscriber.waiting_resolve;\n\t\t\t\tsubscriber.waiting_resolve = null;\n\t\t\t\tsubscriber.waiting_reject = null;\n\t\t\t\tresolve({ value, done: false });\n\t\t\t} else {\n\t\t\t\tsubscriber.pending = { value };\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Signal natural completion to all current subscribers, and to any future\n\t * subscriber (which will receive an immediately-done iterator).\n\t */\n\tdone() {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tfor (const subscriber of this.#subscribers) {\n\t\t\tsubscriber.finished = true;\n\t\t\tif (subscriber.waiting_resolve) {\n\t\t\t\tconst resolve = subscriber.waiting_resolve;\n\t\t\t\tsubscriber.waiting_resolve = null;\n\t\t\t\tsubscriber.waiting_reject = null;\n\t\t\t\tresolve({ value: undefined, done: true });\n\t\t\t}\n\t\t}\n\t\tthis.#subscribers.clear();\n\t}\n\n\t/**\n\t * Broadcast a terminal error. All current subscribers will reject their\n\t * next `.next()` call with `error`. Future subscribers will also reject\n\t * their first `.next()`.\n\t *\n\t * @param {unknown} error\n\t */\n\tfail(error) {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tthis.#terminal_error = error;\n\t\tfor (const subscriber of this.#subscribers) {\n\t\t\tsubscriber.finished = true;\n\t\t\tif (subscriber.waiting_reject) {\n\t\t\t\tconst reject = subscriber.waiting_reject;\n\t\t\t\tsubscriber.waiting_resolve = null;\n\t\t\t\tsubscriber.waiting_reject = null;\n\t\t\t\treject(error);\n\t\t\t} else {\n\t\t\t\tsubscriber.pending_error = { error };\n\t\t\t}\n\t\t}\n\t\tthis.#subscribers.clear();\n\t}\n\n\t/**\n\t * Subscribe to the shared stream. Returns an `AsyncGenerator<T>` that\n\t * yields every value pushed after this call (and, if `initial_value` is\n\t * provided, that value as the first yield).\n\t *\n\t * @param {{ initial_value?: { value: T } }} [options]\n\t *   `initial_value` lets the caller seed the iterator with a synchronously-\n\t *   available current value before any new pushes arrive (e.g. the\n\t *   \"last-seen value\" of a reactive resource). Pass it wrapped in an\n\t *   object so `undefined` can be distinguished from \"no initial value\".\n\t * @returns {AsyncGenerator<T, void, void>}\n\t */\n\tsubscribe(options) {\n\t\t/** @type {Subscriber} */\n\t\tconst subscriber = {\n\t\t\tpending: options?.initial_value ? { value: options.initial_value.value } : null,\n\t\t\tpending_error:\n\t\t\t\tthis.#closed && this.#terminal_error !== undefined ? { error: this.#terminal_error } : null,\n\t\t\tfinished: this.#closed && this.#terminal_error === undefined,\n\t\t\twaiting_resolve: null,\n\t\t\twaiting_reject: null\n\t\t};\n\n\t\tif (!subscriber.finished && subscriber.pending_error === null) {\n\t\t\tthis.#subscribers.add(subscriber);\n\t\t}\n\n\t\tif (!this.#closed) {\n\t\t\tthis.#stop ??= this.#start?.(this);\n\t\t}\n\n\t\tconst unsubscribe = () => {\n\t\t\tsubscriber.finished = true;\n\t\t\tconst was_present = this.#subscribers.delete(subscriber);\n\n\t\t\tif (was_present && this.#subscribers.size === 0) {\n\t\t\t\tthis.#stop?.();\n\t\t\t}\n\t\t};\n\n\t\t/** @type {AsyncGenerator<T, void, void>} */\n\t\tconst iterator = {\n\t\t\tnext() {\n\t\t\t\tif (subscriber.pending_error) {\n\t\t\t\t\tconst { error } = subscriber.pending_error;\n\t\t\t\t\tsubscriber.pending_error = null;\n\t\t\t\t\tunsubscribe();\n\t\t\t\t\treturn Promise.reject(error);\n\t\t\t\t}\n\n\t\t\t\tif (subscriber.pending) {\n\t\t\t\t\tconst { value } = subscriber.pending;\n\t\t\t\t\tsubscriber.pending = null;\n\t\t\t\t\treturn Promise.resolve({ value, done: false });\n\t\t\t\t}\n\n\t\t\t\tif (subscriber.finished) {\n\t\t\t\t\treturn Promise.resolve({ value: undefined, done: true });\n\t\t\t\t}\n\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tsubscriber.waiting_resolve = resolve;\n\t\t\t\t\tsubscriber.waiting_reject = reject;\n\t\t\t\t});\n\t\t\t},\n\t\t\treturn(value) {\n\t\t\t\tunsubscribe();\n\t\t\t\tif (subscriber.waiting_resolve) {\n\t\t\t\t\tconst resolve = subscriber.waiting_resolve;\n\t\t\t\t\tsubscriber.waiting_resolve = null;\n\t\t\t\t\tsubscriber.waiting_reject = null;\n\t\t\t\t\tresolve({ value: undefined, done: true });\n\t\t\t\t}\n\t\t\t\treturn Promise.resolve({ value: /** @type {void} */ (value), done: true });\n\t\t\t},\n\t\t\tthrow(error) {\n\t\t\t\tunsubscribe();\n\t\t\t\tif (subscriber.waiting_reject) {\n\t\t\t\t\tconst reject = subscriber.waiting_reject;\n\t\t\t\t\tsubscriber.waiting_resolve = null;\n\t\t\t\t\tsubscriber.waiting_reject = null;\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\t\t\t\treturn Promise.reject(error);\n\t\t\t},\n\t\t\t[Symbol.asyncIterator]() {\n\t\t\t\treturn iterator;\n\t\t\t},\n\t\t\tasync [Symbol.asyncDispose]() {\n\t\t\t\t// TODO: investigate if this needs to be implemented\n\t\t\t}\n\t\t};\n\n\t\treturn iterator;\n\t}\n}\n","/** @import { RemoteLiveQuery, RemoteLiveQueryFunction, RemoteQuery, RemoteQueryFunction } from '$app/server' */\n/** @import { RequestEvent } from '@sveltejs/kit' */\n/** @import { RemoteInternals, MaybePromise, RequestState, RemoteQueryLiveInternals, RemoteQueryBatchInternals, RemoteQueryInternals, RemoteLiveQueryUserFunctionReturnType } from 'types' */\n/** @import { StandardSchemaV1 } from '@standard-schema/spec' */\nimport { get_request_store } from '@sveltejs/kit/internal/server';\nimport { create_remote_key, stringify_remote_arg } from '../../../shared.js';\nimport { prerendering } from '#app/env/server';\nimport {\n\tcreate_validator,\n\tget_cache,\n\tget_response,\n\trun_remote_function,\n\trun_remote_generator\n} from './shared.js';\nimport { noop } from '../../../../utils/functions.js';\nimport { SharedIterator } from '../../../../utils/shared-iterator.js';\nimport { handle_error_and_jsonify } from '../../../server/errors.js';\nimport * as e from '../../../../messages/server-errors.js';\n\n/**\n * Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.\n *\n * @template Output\n * @overload\n * @param {() => MaybePromise<Output>} fn\n * @returns {RemoteQueryFunction<void, Output>}\n * @since 2.27\n */\n/**\n * Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.\n *\n * @template Input\n * @template Output\n * @overload\n * @param {'unchecked'} validate\n * @param {(arg: Input) => MaybePromise<Output>} fn\n * @returns {RemoteQueryFunction<Input, Output>}\n * @since 2.27\n */\n/**\n * Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.\n *\n * @template {StandardSchemaV1} Schema\n * @template Output\n * @overload\n * @param {Schema} schema\n * @param {(arg: StandardSchemaV1.InferOutput<Schema>) => MaybePromise<Output>} fn\n * @returns {RemoteQueryFunction<StandardSchemaV1.InferInput<Schema>, Output, StandardSchemaV1.InferOutput<Schema>>}\n * @since 2.27\n */\n/**\n * @template Input\n * @template Output\n * @param {any} validate_or_fn\n * @param {(args?: Input) => MaybePromise<Output>} [maybe_fn]\n * @returns {RemoteQueryFunction<Input, Output>}\n * @since 2.27\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function query(validate_or_fn, maybe_fn) {\n\t/** @type {(arg?: Input) => Output} */\n\tconst fn = maybe_fn ?? validate_or_fn;\n\n\t/** @type {(arg?: any) => MaybePromise<Input>} */\n\tconst validate = create_validator(validate_or_fn, maybe_fn);\n\n\t/** @type {RemoteQueryInternals} */\n\tconst __ = {\n\t\ttype: 'query',\n\t\tid: '',\n\t\tname: '',\n\t\tvalidate,\n\t\tbind(payload, validated_arg) {\n\t\t\tconst { event, state } = get_request_store();\n\n\t\t\treturn create_query_resource(__, payload, event, state, () =>\n\t\t\t\trun_remote_function(\n\t\t\t\t\tevent,\n\t\t\t\t\t{ ...state, is_in_remote_query: true },\n\t\t\t\t\tfalse,\n\t\t\t\t\t() => validated_arg,\n\t\t\t\t\tfn\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t};\n\n\t/** @type {RemoteQueryFunction<Input, Output> & { __: RemoteQueryInternals }} */\n\tconst wrapper = (arg) => {\n\t\tif (prerendering) {\n\t\t\te.remote_query_prerender({ type: 'query', name: __.name });\n\t\t}\n\n\t\tconst { event, state } = get_request_store();\n\t\tconst payload = stringify_remote_arg(arg);\n\n\t\treturn create_query_resource(__, payload, event, state, () =>\n\t\t\trun_remote_function(\n\t\t\t\tevent,\n\t\t\t\t{ ...state, is_in_remote_query: true },\n\t\t\t\tfalse,\n\t\t\t\t() => validate(arg),\n\t\t\t\tfn\n\t\t\t)\n\t\t);\n\t};\n\n\tObject.defineProperty(wrapper, '__', { value: __ });\n\n\treturn wrapper;\n}\n\n/**\n * Creates a live remote query. When called from the browser, the function will be invoked on the server via a streaming `fetch` call.\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query.live) for full documentation.\n *\n * @template Output\n * @overload\n * @param {(arg: void) => RemoteLiveQueryUserFunctionReturnType<Output>} fn\n * @returns {RemoteLiveQueryFunction<void, Output>}\n */\n/**\n * @template Input\n * @template Output\n * @overload\n * @param {'unchecked'} validate\n * @param {(arg: Input) => RemoteLiveQueryUserFunctionReturnType<Output>} fn\n * @returns {RemoteLiveQueryFunction<Input, Output>}\n */\n/**\n * @template {StandardSchemaV1} Schema\n * @template Output\n * @overload\n * @param {Schema} schema\n * @param {(arg: StandardSchemaV1.InferOutput<Schema>) => RemoteLiveQueryUserFunctionReturnType<Output>} fn\n * @returns {RemoteLiveQueryFunction<StandardSchemaV1.InferInput<Schema>, Output, StandardSchemaV1.InferOutput<Schema>>}\n */\n/**\n * @template Input\n * @template Output\n * @param {any} validate_or_fn\n * @param {(args: Input) => RemoteLiveQueryUserFunctionReturnType<Output>} [maybe_fn]\n * @returns {RemoteLiveQueryFunction<Input, Output>}\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction live(validate_or_fn, maybe_fn) {\n\t/** @type {(arg: Input) => RemoteLiveQueryUserFunctionReturnType<Output>} */\n\tconst fn = maybe_fn ?? validate_or_fn;\n\n\t/** @type {(arg?: any) => MaybePromise<Input>} */\n\tconst validate = create_validator(validate_or_fn, maybe_fn);\n\n\t/**\n\t * @param {any} event\n\t * @param {any} state\n\t * @param {any} get_input\n\t */\n\tconst run = (event, state, get_input) =>\n\t\trun_remote_generator(\n\t\t\tevent,\n\t\t\t{ ...state, is_in_remote_query: true },\n\t\t\tfalse,\n\t\t\tget_input,\n\t\t\tfn,\n\t\t\t__.name\n\t\t);\n\n\t/** @type {RemoteQueryLiveInternals} */\n\tconst __ = {\n\t\ttype: 'query_live',\n\t\tid: '',\n\t\tname: '',\n\t\trun: (event, state, arg) => run(event, state, () => validate(arg)),\n\t\tvalidate,\n\t\tbind(payload, validated_arg) {\n\t\t\tconst { event, state } = get_request_store();\n\n\t\t\treturn create_live_query_resource(__, payload, event, state, () =>\n\t\t\t\trun(event, state, () => validated_arg)\n\t\t\t);\n\t\t}\n\t};\n\n\t/** @type {RemoteLiveQueryFunction<Input, Output> & { __: RemoteQueryLiveInternals }} */\n\tconst wrapper = (arg) => {\n\t\tif (prerendering) {\n\t\t\te.remote_query_prerender({ type: 'query.live', name: __.name });\n\t\t}\n\n\t\tconst { event, state } = get_request_store();\n\t\tconst payload = stringify_remote_arg(arg);\n\n\t\treturn create_live_query_resource(__, payload, event, state, () =>\n\t\t\trun(event, state, () => validate(arg))\n\t\t);\n\t};\n\n\tObject.defineProperty(wrapper, '__', { value: __ });\n\n\treturn wrapper;\n}\n\n/**\n * Creates a batch query function that collects multiple calls and executes them in a single request\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query.batch) for full documentation.\n *\n * @template Input\n * @template Output\n * @overload\n * @param {'unchecked'} validate\n * @param {(args: Input[]) => MaybePromise<(arg: Input, idx: number) => Output>} fn\n * @returns {RemoteQueryFunction<Input, Output>}\n * @since 2.35\n */\n/**\n * Creates a batch query function that collects multiple calls and executes them in a single request\n *\n * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query.batch) for full documentation.\n *\n * @template {StandardSchemaV1} Schema\n * @template Output\n * @overload\n * @param {Schema} schema\n * @param {(args: StandardSchemaV1.InferOutput<Schema>[]) => MaybePromise<(arg: StandardSchemaV1.InferOutput<Schema>, idx: number) => Output>} fn\n * @returns {RemoteQueryFunction<StandardSchemaV1.InferInput<Schema>, Output, StandardSchemaV1.InferOutput<Schema>>}\n * @since 2.35\n */\n/**\n * @template Input\n * @template Output\n * @param {any} validate_or_fn\n * @param {(args?: Input[]) => MaybePromise<(arg: Input, idx: number) => Output>} [maybe_fn]\n * @returns {RemoteQueryFunction<Input, Output>}\n * @since 2.35\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction batch(validate_or_fn, maybe_fn) {\n\t/** @type {(args?: Input[]) => MaybePromise<(arg: Input, idx: number) => Output>} */\n\tconst fn = maybe_fn ?? validate_or_fn;\n\n\t/** @type {(arg?: any) => MaybePromise<Input>} */\n\tconst validate = create_validator(validate_or_fn, maybe_fn);\n\n\t/**\n\t * Enqueues a single call into the current batch (creating one if necessary)\n\t * and returns a promise that resolves with the result for this entry.\n\t *\n\t * @param {string} payload — the stringified raw argument (cache key)\n\t * @param {() => MaybePromise<any>} get_validated — produces the validated argument for this entry\n\t * @returns {Promise<any>}\n\t */\n\tconst enqueue = (payload, get_validated) => {\n\t\tconst { event, state } = get_request_store();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst batches = (state.remote.batches ??=\n\t\t\t\t/** @type {NonNullable<typeof state.remote.batches>} */ (new Map()));\n\t\t\tlet batched = batches.get(__.id);\n\t\t\tif (!batched) {\n\t\t\t\tbatched = new Map();\n\t\t\t\tbatches.set(__.id, batched);\n\t\t\t}\n\t\t\tconst entry = batched.get(payload);\n\n\t\t\tif (entry) {\n\t\t\t\tentry.resolvers.push({ resolve, reject });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tbatched.set(payload, {\n\t\t\t\tget_validated,\n\t\t\t\tresolvers: [{ resolve, reject }]\n\t\t\t});\n\n\t\t\tif (batched.size > 1) return;\n\n\t\t\tsetTimeout(async () => {\n\t\t\t\tbatches.delete(__.id);\n\t\t\t\tconst entries = Array.from(batched.values());\n\n\t\t\t\ttry {\n\t\t\t\t\treturn await run_remote_function(\n\t\t\t\t\t\tevent,\n\t\t\t\t\t\t{ ...state, is_in_remote_query: true },\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\tasync () => Promise.all(entries.map((entry) => entry.get_validated())),\n\t\t\t\t\t\tasync (input) => {\n\t\t\t\t\t\t\tconst get_result = await fn(input);\n\n\t\t\t\t\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst result = get_result(input[i], i);\n\n\t\t\t\t\t\t\t\t\tfor (const resolver of entries[i].resolvers) {\n\t\t\t\t\t\t\t\t\t\tresolver.resolve(result);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\tfor (const resolver of entries[i].resolvers) {\n\t\t\t\t\t\t\t\t\t\tresolver.reject(error);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfor (const entry of batched.values()) {\n\t\t\t\t\t\tfor (const resolver of entry.resolvers) {\n\t\t\t\t\t\t\tresolver.reject(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, 0);\n\t\t});\n\t};\n\n\t/** @type {RemoteQueryBatchInternals} */\n\tconst __ = {\n\t\ttype: 'query_batch',\n\t\tid: '',\n\t\tname: '',\n\t\tvalidate,\n\t\trun: async (args) => {\n\t\t\tconst { event, state } = get_request_store();\n\n\t\t\treturn run_remote_function(\n\t\t\t\tevent,\n\t\t\t\t{ ...state, is_in_remote_query: true },\n\t\t\t\tfalse,\n\t\t\t\tasync () => Promise.all(args.map(validate)),\n\t\t\t\tasync (/** @type {any[]} */ input) => {\n\t\t\t\t\tconst get_result = await fn(input);\n\n\t\t\t\t\treturn Promise.all(\n\t\t\t\t\t\tinput.map(async (arg, i) => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst data = get_result(arg, i);\n\t\t\t\t\t\t\t\treturn { type: 'result', data };\n\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\tconst transformed = await handle_error_and_jsonify(event, state, error);\n\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\t\terror: transformed\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\tbind(payload, validated_arg) {\n\t\t\tconst { event, state } = get_request_store();\n\n\t\t\treturn create_query_resource(__, payload, event, state, () =>\n\t\t\t\tenqueue(payload, () => validated_arg)\n\t\t\t);\n\t\t}\n\t};\n\n\t/** @type {RemoteQueryFunction<Input, Output> & { __: RemoteQueryBatchInternals }} */\n\tconst wrapper = (arg) => {\n\t\tif (prerendering) {\n\t\t\te.remote_query_prerender({ type: 'query.batch', name: __.name });\n\t\t}\n\n\t\tconst { event, state } = get_request_store();\n\t\tconst payload = stringify_remote_arg(arg);\n\n\t\treturn create_query_resource(__, payload, event, state, () =>\n\t\t\t// Collect all the calls to the same query in the same macrotask,\n\t\t\t// then execute them as one backend request.\n\t\t\tenqueue(payload, () => validate(arg))\n\t\t);\n\t};\n\n\tObject.defineProperty(wrapper, '__', { value: __ });\n\n\treturn wrapper;\n}\n\n/**\n * Include this value in the returned payload...\n * @param {RequestEvent} event\n * @param {RequestState} state\n * @param {RemoteInternals} internals\n * @param {string} payload\n * @param {() => Promise<any>} fn\n */\nexport function refresh(event, state, internals, payload, fn) {\n\tif (!internals.id) {\n\t\t// unless this is a non-exported (i.e. private) query...\n\t\treturn;\n\t}\n\n\tif (!event.isRemoteRequest && state.is_in_remote_form_or_command) {\n\t\t// ...or this is a no-JS (native) form submission, where the page re-renders\n\t\t// anyway so there's no live client cache to apply a single-flight update to.\n\t\treturn;\n\t}\n\n\tconst key = create_remote_key(internals.id, payload);\n\n\t// `fn` is stored rather than invoked eagerly. The query is run at the end of\n\t// the request (in `collect_remote_data`), so that it observes any state\n\t// mutations that happen after `refresh()` is called. If the developer re-awaits\n\t// the query before the request finishes, the cache entry created by that await\n\t// is reused instead of re-running the query.\n\t(state.remote.explicit ??= new Map()).set(key, {\n\t\tinternals,\n\t\tfn\n\t});\n}\n\n/**\n * @param {RemoteInternals} __\n * @param {string} payload — the stringified raw argument (i.e. the cache key the client will use)\n * @param {RequestEvent} event\n * @param {RequestState} state\n * @param {() => Promise<any>} fn\n * @returns {RemoteQuery<any>}\n */\nfunction create_query_resource(__, payload, event, state, fn) {\n\t/** @type {Promise<any> | null} */\n\tlet promise = null;\n\n\tconst get_promise = () => {\n\t\treturn (promise ??= get_response(__, payload, state, fn));\n\t};\n\n\tconst populate_hydratable = () => {\n\t\t// accessing data properties needs to kick off the work\n\t\t// so that it gets seeded in the hydration cache\n\t\t// and becomes available on the client\n\t\tif (__.id && state.is_in_render) {\n\t\t\t// swallow rejections so they don't crash the server — the error is\n\t\t\t// serialized into the response and surfaced on the client instead\n\t\t\tget_promise().catch(noop);\n\t\t}\n\t};\n\n\treturn {\n\t\t/** @type {Promise<any>['catch']} */\n\t\tcatch(onrejected) {\n\t\t\treturn get_promise().catch(onrejected);\n\t\t},\n\t\tget current() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn undefined;\n\t\t},\n\t\tget error() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn undefined;\n\t\t},\n\t\t/** @type {Promise<any>['finally']} */\n\t\tfinally(onfinally) {\n\t\t\treturn get_promise().finally(onfinally);\n\t\t},\n\t\tget loading() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn true;\n\t\t},\n\t\tget ready() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn false;\n\t\t},\n\t\trefresh() {\n\t\t\tpromise = null;\n\t\t\tdelete get_cache(__, state)[payload];\n\n\t\t\trefresh(event, state, __, payload, get_promise);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t\t/** @param {any} value */\n\t\tset(value) {\n\t\t\tconst p = (promise = Promise.resolve(value));\n\t\t\tget_cache(__, state)[payload] = p;\n\n\t\t\trefresh(event, state, __, payload, () => p);\n\t\t},\n\t\t/** @type {Promise<any>['then']} */\n\t\tthen(onfulfilled, onrejected) {\n\t\t\treturn get_promise().then(onfulfilled, onrejected);\n\t\t},\n\t\twithOverride() {\n\t\t\te.server_api_unavailable({ name: `${__.name}.withOverride()` });\n\t\t},\n\t\tget [Symbol.toStringTag]() {\n\t\t\treturn 'QueryResource';\n\t\t}\n\t};\n}\n\n/**\n * @param {RemoteQueryLiveInternals} __\n * @param {string} payload — the stringified raw argument (i.e. the cache key the client will use)\n * @param {RequestEvent} event\n * @param {RequestState} state\n * @param {() => AsyncGenerator<any, void, void>} get_generator\n * @returns {RemoteLiveQuery<any>}\n */\nfunction create_live_query_resource(__, payload, event, state, get_generator) {\n\t/** @type {Promise<any> | null} */\n\tlet promise = null;\n\n\tconst get_first_value = async () => {\n\t\tfor await (const value of get_generator()) {\n\t\t\treturn value;\n\t\t}\n\t\te.remote_query_live_no_value({ name: __.name });\n\t};\n\n\tconst get_promise = () => {\n\t\treturn (promise ??= get_response(__, payload, state, get_first_value));\n\t};\n\n\tconst populate_hydratable = () => {\n\t\tif (__.id && state.is_in_render) {\n\t\t\t// swallow rejections so they don't crash the server — the error is\n\t\t\t// serialized into the response and surfaced on the client instead\n\t\t\tget_promise().catch(noop);\n\t\t}\n\t};\n\n\treturn {\n\t\t/** @type {Promise<any>['catch']} */\n\t\tcatch(onrejected) {\n\t\t\treturn get_promise().catch(onrejected);\n\t\t},\n\t\tget current() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn undefined;\n\t\t},\n\t\tget error() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn undefined;\n\t\t},\n\t\t/** @type {Promise<any>['finally']} */\n\t\tfinally(onfinally) {\n\t\t\treturn get_promise().finally(onfinally);\n\t\t},\n\t\tget done() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn false;\n\t\t},\n\t\tget loading() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn true;\n\t\t},\n\t\tget ready() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn false;\n\t\t},\n\t\tget connected() {\n\t\t\tpopulate_hydratable();\n\t\t\treturn false;\n\t\t},\n\t\treconnect() {\n\t\t\tpromise = null;\n\t\t\tdelete get_cache(__, state)[payload];\n\n\t\t\trefresh(event, state, __, payload, get_promise);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t\t/** @type {Promise<any>['then']} */\n\t\tthen(onfulfilled, onrejected) {\n\t\t\treturn get_promise().then(onfulfilled, onrejected);\n\t\t},\n\t\t[Symbol.asyncIterator]() {\n\t\t\tconst key = create_remote_key(__.id, payload);\n\t\t\tconst cache = (state.remote.live_iterators ??= new Map());\n\t\t\tlet cached = cache.get(key);\n\t\t\tif (!cached) {\n\t\t\t\tcached = create_shared_live_iterator(event.request.signal, get_generator);\n\t\t\t\tcache.set(key, cached);\n\t\t\t}\n\t\t\treturn cached.subscribe();\n\t\t},\n\t\tget [Symbol.toStringTag]() {\n\t\t\treturn 'LiveQueryResource';\n\t\t}\n\t};\n}\n\n/**\n * Wraps a lazily-created live-query generator so that multiple `for await`\n * consumers within the same request share one underlying iteration. The first\n * subscriber starts the generator; values are broadcast to all subscribers\n * via a `SharedIterator`. When the last subscriber unsubscribes, the generator\n * is closed via `generator.return(undefined)`.\n *\n * If `signal` aborts (typically because the client has disconnected), the\n * pump is torn down and any in-flight `next()` calls on consumer iterators\n * resolve with `{ done: true }`, so suspended `for await` loops unwind\n * cleanly rather than leaking.\n *\n * @param {AbortSignal} signal\n * @param {() => AsyncGenerator<any, void, void>} get_generator\n */\nfunction create_shared_live_iterator(signal, get_generator) {\n\treturn new SharedIterator((instance) => {\n\t\t// Don't bother starting the pump if the request has already been\n\t\t// aborted between cache creation and first subscription.\n\t\tif (signal.aborted) {\n\t\t\tinstance.done();\n\t\t\treturn noop;\n\t\t}\n\n\t\tconst generator = get_generator();\n\n\t\t// Set to `true` when we deliberately close the generator (because every\n\t\t// subscriber has unsubscribed, or the request was aborted). The pump's\n\t\t// `generator.next()` will reject as a result; we use this flag to swallow that\n\t\t// abort error rather than surfacing it through `instance.fail()`.\n\t\tlet aborted = false;\n\n\t\tconst close = () => {\n\t\t\taborted = true;\n\t\t\tvoid generator.return().catch(noop);\n\t\t};\n\n\t\t// On request abort, tear down the pump and notify subscribers. `done()` is\n\t\t// used (rather than `fail()`) because an aborted request is a normal\n\t\t// termination — there's no error to surface to user code that's already\n\t\t// been disconnected from the client.\n\t\tsignal.addEventListener('abort', () => (close(), instance.done()), { once: true });\n\n\t\tvoid (async () => {\n\t\t\ttry {\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst result = await generator.next();\n\t\t\t\t\tif (result.done) {\n\t\t\t\t\t\tinstance.done();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tinstance.push(result.value);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (!aborted) instance.fail(error);\n\t\t\t} finally {\n\t\t\t\tclose();\n\t\t\t}\n\t\t})();\n\n\t\treturn close;\n\t});\n}\n\n// Add batch as a property to the query function\nObject.defineProperty(query, 'batch', { value: batch, enumerable: true });\nObject.defineProperty(query, 'live', { value: live, enumerable: true });\n","/** @import { RemoteLiveQuery, RemoteLiveQueryFunction, RemoteQuery, RemoteQueryFunction, RequestedResult, RemoteQueryRequestedResult, RemoteLiveQueryRequestedResult } from '$app/server' */\n/** @import { MaybePromise, RemoteAnyQueryInternals } from 'types' */\nimport { get_request_store } from '@sveltejs/kit/internal/server';\nimport { create_remote_key, parse_remote_arg } from '../../../shared.js';\nimport { noop } from '../../../../utils/functions.js';\nimport { get_cache } from './shared.js';\nimport { refresh } from './query.js';\nimport * as e from '../../../../messages/server-errors.js';\n\n/**\n * Inside a remote `command` or `form` callback, returns an iterable\n * of `{ arg, query }` entries for the query instances the client asked to refresh, up to\n * the supplied `limit`. Each `query` is a `RemoteQuery` bound to the original\n * client-side cache key, so `refresh()` / `set()` propagate correctly even when\n * the query's schema transforms the input. `arg` is the *validated* argument,\n * i.e. the value after the schema has run (so `InferOutput<Schema>` for queries\n * declared with a Standard Schema).\n *\n * Arguments that fail validation or exceed `limit` are recorded as failures in\n * the response to the client.\n * See [Client-requested refreshes](https://svelte.dev/docs/kit/remote-functions#Single-flight-mutations-Client-requested-refreshes)\n * for usage in a remote `command` or `form`.\n *\n * @example\n * ```ts\n * import { requested } from '$app/server';\n *\n * for (const { arg, query } of requested(getPost, 5)) {\n * \t// `arg` is the validated argument; `query` is bound to the client's\n * \t// cache key. It's safe to throw away this promise -- SvelteKit will\n * \t// await it and forward any errors to the client.\n * \tvoid query.refresh();\n * }\n * ```\n *\n * As a shorthand for the above, you can also call `refreshAll` on the result:\n *\n * @example\n * ```ts\n * import { requested } from '$app/server';\n *\n * await requested(getPost, 5).refreshAll();\n * ```\n *\n * Works with `query.batch` as well — refreshes for individual entries are\n * collected into a single batched call.\n *\n * For live queries, the same applies, but with `reconnect` and `reconnectAll`.\n *\n * @template Input\n * @template Output\n * @template [Validated=Input]\n * @overload\n * @param {RemoteQueryFunction<Input, Output, Validated>} query\n * @param {number} limit\n * @returns {RemoteQueryRequestedResult<Validated, Output>}\n */\n/**\n * Inside a remote `command` or `form` callback, returns an iterable\n * of `{ arg, query }` entries for the live query instances the client asked to reconnect, up to\n * the supplied `limit`. Each `query` is a `RemoteLiveQuery` bound to the original\n * client-side cache key, so `reconnect()` propagates correctly even when\n * the query's schema transforms the input. `arg` is the *validated* argument.\n *\n * Arguments that fail validation or exceed `limit` are recorded as failures in\n * the response to the client.\n * See [Client-requested refreshes](https://svelte.dev/docs/kit/remote-functions#Single-flight-mutations-Client-requested-refreshes)\n * for usage in a remote `command` or `form`.\n *\n * @example\n * ```ts\n * import { requested } from '$app/server';\n *\n * for (const { query } of requested(getPost, 5)) {\n * \tvoid query.reconnect();\n * }\n * ```\n *\n * As a shorthand, you can also call `reconnectAll` on the result:\n *\n * @example\n * ```ts\n * import { requested } from '$app/server';\n *\n * await requested(getPost, 5).reconnectAll();\n * ```\n *\n * @template Input\n * @template Output\n * @template [Validated=Input]\n * @overload\n * @param {RemoteLiveQueryFunction<Input, Output, Validated>} query\n * @param {number} limit\n * @returns {RemoteLiveQueryRequestedResult<Validated, Output>}\n */\n/**\n * @template Input\n * @template Output\n * @template [Validated=Input]\n * @param {RemoteQueryFunction<Input, Output, Validated> | RemoteLiveQueryFunction<Input, Output, Validated>} query\n * @param {number} limit\n * @returns {RequestedResult<Validated, Output>}\n */\nexport function requested(query, limit) {\n\tconst { event, state } = get_request_store();\n\tconst internals = /** @type {RemoteAnyQueryInternals | undefined} */ (\n\t\t/** @type {any} */ (query).__\n\t);\n\n\tif (\n\t\tinternals?.type !== 'query' &&\n\t\tinternals?.type !== 'query_batch' &&\n\t\tinternals?.type !== 'query_live'\n\t) {\n\t\te.remote_requested_invalid_query();\n\t}\n\n\t// narrow-stable alias so generator closures below don't lose the narrowing\n\tconst __ = internals;\n\n\tconst requested = state.remote.requested;\n\tconst payloads = requested?.get(__.id) ?? new Set();\n\tconst ignored = (state.remote.ignored ??= new Set());\n\n\t/** @param {string} payload */\n\tconst consume = (payload) => {\n\t\tpayloads.delete(payload);\n\t\tif (payloads.size === 0) requested?.delete(__.id);\n\t};\n\n\t/** @param {string} payload */\n\tconst create_ignore = (payload) => () => {\n\t\tignored.add(create_remote_key(__.id, payload));\n\t};\n\n\t// note: don't initialize these maps here -- they will be initialized by the\n\t// command/form wrapper when we enter them, and if we initialize them here\n\t// we will enable requested(...) in contexts where it shouldn't be allowed,\n\t// such as load functions or other server functions\n\tif (!state.is_in_remote_form_or_command) {\n\t\te.remote_requested_context();\n\t}\n\tconst [selected, skipped] = split_limit([...payloads], limit);\n\n\t/**\n\t * Registers the failure exactly like `.set()` registers a value: the error record\n\t * is serialized to the client (putting the query there into a failed state), and\n\t * subsequent server-side calls of the query with the same argument reject with it.\n\t * @param {string} payload\n\t * @param {unknown} error\n\t */\n\tconst record_failure = (payload, error) => {\n\t\tconst promise = Promise.reject(error);\n\t\tpromise.catch(noop);\n\n\t\tget_cache(__, state)[payload] = promise;\n\t\trefresh(event, state, __, payload, () => promise);\n\t};\n\n\tfor (const payload of skipped) consume(payload);\n\n\tconst result = {\n\t\t*[Symbol.iterator]() {\n\t\t\tfor (const payload of selected) {\n\t\t\t\tconsume(payload);\n\t\t\t\ttry {\n\t\t\t\t\tconst parsed = parse_remote_arg(payload);\n\t\t\t\t\tconst validated = __.validate(parsed);\n\n\t\t\t\t\tif (is_thenable(validated)) {\n\t\t\t\t\t\te.remote_requested_async_validator({ name: __.name, limit: String(limit) });\n\t\t\t\t\t}\n\n\t\t\t\t\tyield {\n\t\t\t\t\t\targ: validated,\n\t\t\t\t\t\tquery: __.bind(payload, validated),\n\t\t\t\t\t\tignore: create_ignore(payload)\n\t\t\t\t\t};\n\t\t\t\t} catch (error) {\n\t\t\t\t\trecord_failure(payload, error);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tasync *[Symbol.asyncIterator]() {\n\t\t\tyield* race_all(selected, async (payload) => {\n\t\t\t\tconsume(payload);\n\t\t\t\ttry {\n\t\t\t\t\tconst parsed = parse_remote_arg(payload);\n\t\t\t\t\tconst validated = await __.validate(parsed);\n\t\t\t\t\treturn {\n\t\t\t\t\t\targ: validated,\n\t\t\t\t\t\tquery: __.bind(payload, validated),\n\t\t\t\t\t\tignore: create_ignore(payload)\n\t\t\t\t\t};\n\t\t\t\t} catch (error) {\n\t\t\t\t\trecord_failure(payload, error);\n\t\t\t\t\tthrow new Error(`Skipping ${__.name}(${payload})`, { cause: error });\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tasync refreshAll() {\n\t\t\tif (__.type === 'query_live') {\n\t\t\t\te.remote_requested_wrong_method({\n\t\t\t\t\tmethod: 'refreshAll',\n\t\t\t\t\ttype: 'live',\n\t\t\t\t\treplacement: 'reconnectAll'\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfor await (const { query } of result) {\n\t\t\t\tvoid (/** @type {RemoteQuery<Output>} */ (query).refresh());\n\t\t\t}\n\t\t},\n\t\tasync reconnectAll() {\n\t\t\tif (__.type !== 'query_live') {\n\t\t\t\te.remote_requested_wrong_method({\n\t\t\t\t\tmethod: 'reconnectAll',\n\t\t\t\t\ttype: 'regular',\n\t\t\t\t\treplacement: 'refreshAll'\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfor await (const { query } of result) {\n\t\t\t\tvoid (/** @type {RemoteLiveQuery<Output>} */ (query).reconnect());\n\t\t\t}\n\t\t},\n\t\tasync ignoreAll() {\n\t\t\tfor await (const { ignore } of result) ignore();\n\t\t}\n\t};\n\n\treturn /** @type {RequestedResult<Validated, Output>} */ (/** @type {unknown} */ (result));\n}\n\n/**\n * @template T\n * @param {Array<T>} array\n * @param {number} limit\n * @returns {[Array<T>, Array<T>]}\n */\nfunction split_limit(array, limit) {\n\tif (limit === Infinity) {\n\t\treturn [array, []];\n\t}\n\tif (!Number.isInteger(limit) || limit < 0) {\n\t\te.remote_requested_invalid_limit();\n\t}\n\treturn [array.slice(0, limit), array.slice(limit)];\n}\n\n/**\n * @param {any} value\n * @returns {value is PromiseLike<any>}\n */\nfunction is_thenable(value) {\n\treturn !!value && (typeof value === 'object' || typeof value === 'function') && 'then' in value;\n}\n\n/**\n * Runs all callbacks immediately and yields resolved values in completion order.\n * If the promise rejects, it is skipped.\n *\n * @template T\n * @template R\n * @param {Array<T>} array\n * @param {(value: T) => MaybePromise<R>} fn\n * @returns {AsyncIterable<R>}\n */\nasync function* race_all(array, fn) {\n\t/** @type {Set<Promise<{ promise: Promise<any>, value: Awaited<R> }>>} */\n\tconst pending = new Set();\n\n\tfor (const value of array) {\n\t\t/** @type {Promise<{ promise: Promise<any>, value: Awaited<R> }>} */\n\t\tconst promise = Promise.resolve(fn(value)).then((result) => ({\n\t\t\tpromise,\n\t\t\tvalue: result\n\t\t}));\n\n\t\tpromise.catch(() => pending.delete(promise));\n\t\tpending.add(promise);\n\t}\n\n\twhile (pending.size > 0) {\n\t\ttry {\n\t\t\tconst { promise, value } = await Promise.race(pending);\n\t\t\tpending.delete(promise);\n\t\t\tyield value;\n\t\t} catch {\n\t\t\t// Ignore errors, they are handled in the fn callback and result in skip\n\t\t}\n\t}\n}\n"],"ignoreList":[0,1,2,3,4,5,6],"mappings":";;;;;;;;;;;AAYA,SAAgB,iBAAiB,gBAAgB,UAAU;CAE1D,IAAI,CAAC,UACJ,QAAQ,QAAQ;EACf,IAAI,QAAQ,KAAA,GACX,MAAM,KAAK,aAAa;CAE1B;CAID,IAAI,mBAAmB,aACtB,QAAQ,QAAQ;CAIjB,IAAI,eAAe,gBAClB,OAAO,OAAO,QAAQ;EAErB,MAAM,SAAS,MAAM,eAAe,YAAY,CAAC,SAAS,GAAG;EAG7D,IAAI,OAAO,QACV,MAAM,IAAI,gBAAgB,OAAO,MAAM;EAGxC,OAAO,OAAO;CACf;CAGD,yBAA2B;AAC5B;;;;;;;;;;;;;;;AAgBA,eAAsB,aAAa,WAAW,SAAS,OAAO,YAAY;CAGzE,MAAM;CAEN,MAAM,QAAQ,UAAU,WAAW,KAAK;CAExC,IAAI,CAAC,MAAM,oBAEV,oBAAoB,WAAW,KAAK,CAAC,CAAC,WAAW;CAGlD,OAAQ,MAAM,aAAa,WAAW;AACvC;;;;;;;AAQA,SAAS,6BA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