@sanity/cli 3.32.0 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_chunks/{cli-Bg_7XTxq.js → cli-DF3zrOjo.js} +4 -4
- package/lib/_chunks/{cli-Bg_7XTxq.js.map → cli-DF3zrOjo.js.map} +1 -1
- package/lib/_chunks/{index-CSUcivnN.js → index-DMlvnCQu.js} +3 -3
- package/lib/_chunks/{index-CSUcivnN.js.map → index-DMlvnCQu.js.map} +1 -1
- package/lib/_chunks/{loadEnv-DhS32YnB.js → loadEnv-F5Jkbv17.js} +3 -3
- package/lib/_chunks/{loadEnv-DhS32YnB.js.map → loadEnv-F5Jkbv17.js.map} +1 -1
- package/lib/_chunks/{node-BtqYuHlp.js → node-D7oypQ6u.js} +2 -2
- package/lib/_chunks/{node-BtqYuHlp.js.map → node-D7oypQ6u.js.map} +1 -1
- package/lib/_chunks/{node-DgDVWBhq.js → node-Dd7W3qt3.js} +2 -2
- package/lib/_chunks/{node-DgDVWBhq.js.map → node-Dd7W3qt3.js.map} +1 -1
- package/lib/_chunks/stegaEncodeSourceMap-QOvbA7yd.js.map +1 -1
- package/lib/_chunks/stegaEncodeSourceMap-__Tf172r.js.map +1 -1
- package/lib/cli.js +2 -2
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/run.js +1 -1
- package/package.json +5 -5
- package/src/actions/init-project/templates/getStarted.ts +1 -1
- package/src/actions/init-project/templates/shopify.ts +1 -1
- package/src/actions/init-project/templates/shopifyOnline.ts +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stegaEncodeSourceMap-QOvbA7yd.js","sources":["../../../../../node_modules/.pnpm/@sanity+client@6.15.1/node_modules/@sanity/client/dist/_chunks/browserMiddleware.js","../../../../../node_modules/.pnpm/@sanity+client@6.15.1/node_modules/@sanity/client/dist/_chunks/stegaEncodeSourceMap.js"],"sourcesContent":["import { getIt } from \"get-it\";\nimport { retry, jsonRequest, jsonResponse, progress, observable } from \"get-it/middleware\";\nimport { Observable, from, lastValueFrom } from \"rxjs\";\nimport { combineLatestWith, map, filter } from \"rxjs/operators\";\nclass ClientError extends Error {\n constructor(res) {\n const props = extractErrorProps(res);\n super(props.message), this.statusCode = 400, Object.assign(this, props);\n }\n}\nclass ServerError extends Error {\n constructor(res) {\n const props = extractErrorProps(res);\n super(props.message), this.statusCode = 500, Object.assign(this, props);\n }\n}\nfunction extractErrorProps(res) {\n const body = res.body, props = {\n response: res,\n statusCode: res.statusCode,\n responseBody: stringifyBody(body, res),\n message: \"\",\n details: void 0\n };\n if (body.error && body.message)\n return props.message = `${body.error} - ${body.message}`, props;\n if (isMutationError(body)) {\n const allItems = body.error.items || [], items = allItems.slice(0, 5).map((item) => {\n var _a;\n return (_a = item.error) == null ? void 0 : _a.description;\n }).filter(Boolean);\n let itemsStr = items.length ? `:\n- ${items.join(`\n- `)}` : \"\";\n return allItems.length > 5 && (itemsStr += `\n...and ${allItems.length - 5} more`), props.message = `${body.error.description}${itemsStr}`, props.details = body.error, props;\n }\n return body.error && body.error.description ? (props.message = body.error.description, props.details = body.error, props) : (props.message = body.error || body.message || httpErrorMessage(res), props);\n}\nfunction isMutationError(body) {\n return isPlainObject(body) && isPlainObject(body.error) && body.error.type === \"mutationError\" && typeof body.error.description == \"string\";\n}\nfunction isPlainObject(obj) {\n return typeof obj == \"object\" && obj !== null && !Array.isArray(obj);\n}\nfunction httpErrorMessage(res) {\n const statusMessage = res.statusMessage ? ` ${res.statusMessage}` : \"\";\n return `${res.method}-request to ${res.url} resulted in HTTP ${res.statusCode}${statusMessage}`;\n}\nfunction stringifyBody(body, res) {\n return (res.headers[\"content-type\"] || \"\").toLowerCase().indexOf(\"application/json\") !== -1 ? JSON.stringify(body, null, 2) : body;\n}\nconst httpError = {\n onResponse: (res) => {\n if (res.statusCode >= 500)\n throw new ServerError(res);\n if (res.statusCode >= 400)\n throw new ClientError(res);\n return res;\n }\n}, printWarnings = {\n onResponse: (res) => {\n const warn = res.headers[\"x-sanity-warning\"];\n return (Array.isArray(warn) ? warn : [warn]).filter(Boolean).forEach((msg) => console.warn(msg)), res;\n }\n};\nfunction defineHttpRequest(envMiddleware2, {\n maxRetries = 5,\n retryDelay\n}) {\n const request = getIt([\n maxRetries > 0 ? retry({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n retryDelay,\n // This option is typed incorrectly in get-it.\n maxRetries,\n shouldRetry\n }) : {},\n ...envMiddleware2,\n printWarnings,\n jsonRequest(),\n jsonResponse(),\n progress(),\n httpError,\n observable({ implementation: Observable })\n ]);\n function httpRequest(options, requester = request) {\n return requester({ maxRedirects: 0, ...options });\n }\n return httpRequest.defaultRequester = request, httpRequest;\n}\nfunction shouldRetry(err, attempt, options) {\n const isSafe = options.method === \"GET\" || options.method === \"HEAD\", isQuery = (options.uri || options.url).startsWith(\"/data/query\"), isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503);\n return (isSafe || isQuery) && isRetriableResponse ? !0 : retry.shouldRetry(err, attempt, options);\n}\nfunction getSelection(sel) {\n if (typeof sel == \"string\")\n return { id: sel };\n if (Array.isArray(sel))\n return { query: \"*[_id in $ids]\", params: { ids: sel } };\n if (typeof sel == \"object\" && sel !== null && \"query\" in sel && typeof sel.query == \"string\")\n return \"params\" in sel && typeof sel.params == \"object\" && sel.params !== null ? { query: sel.query, params: sel.params } : { query: sel.query };\n const selectionOpts = [\n \"* Document ID (<docId>)\",\n \"* Array of document IDs\",\n \"* Object containing `query`\"\n ].join(`\n`);\n throw new Error(`Unknown selection - must be one of:\n\n${selectionOpts}`);\n}\nconst VALID_ASSET_TYPES = [\"image\", \"file\"], VALID_INSERT_LOCATIONS = [\"before\", \"after\", \"replace\"], dataset = (name) => {\n if (!/^(~[a-z0-9]{1}[-\\w]{0,63}|[a-z0-9]{1}[-\\w]{0,63})$/.test(name))\n throw new Error(\n \"Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters\"\n );\n}, projectId = (id) => {\n if (!/^[-a-z0-9]+$/i.test(id))\n throw new Error(\"`projectId` can only contain only a-z, 0-9 and dashes\");\n}, validateAssetType = (type) => {\n if (VALID_ASSET_TYPES.indexOf(type) === -1)\n throw new Error(`Invalid asset type: ${type}. Must be one of ${VALID_ASSET_TYPES.join(\", \")}`);\n}, validateObject = (op, val) => {\n if (val === null || typeof val != \"object\" || Array.isArray(val))\n throw new Error(`${op}() takes an object of properties`);\n}, validateDocumentId = (op, id) => {\n if (typeof id != \"string\" || !/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(id) || id.includes(\"..\"))\n throw new Error(`${op}(): \"${id}\" is not a valid document ID`);\n}, requireDocumentId = (op, doc) => {\n if (!doc._id)\n throw new Error(`${op}() requires that the document contains an ID (\"_id\" property)`);\n validateDocumentId(op, doc._id);\n}, validateInsert = (at, selector, items) => {\n const signature = \"insert(at, selector, items)\";\n if (VALID_INSERT_LOCATIONS.indexOf(at) === -1) {\n const valid = VALID_INSERT_LOCATIONS.map((loc) => `\"${loc}\"`).join(\", \");\n throw new Error(`${signature} takes an \"at\"-argument which is one of: ${valid}`);\n }\n if (typeof selector != \"string\")\n throw new Error(`${signature} takes a \"selector\"-argument which must be a string`);\n if (!Array.isArray(items))\n throw new Error(`${signature} takes an \"items\"-argument which must be an array`);\n}, hasDataset = (config) => {\n if (!config.dataset)\n throw new Error(\"`dataset` must be provided to perform queries\");\n return config.dataset || \"\";\n}, requestTag = (tag) => {\n if (typeof tag != \"string\" || !/^[a-z0-9._-]{1,75}$/i.test(tag))\n throw new Error(\n \"Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.\"\n );\n return tag;\n};\nvar __accessCheck$6 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$6 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value);\nclass BasePatch {\n constructor(selection, operations = {}) {\n this.selection = selection, this.operations = operations;\n }\n /**\n * Sets the given attributes to the document. Does NOT merge objects.\n * The operation is added to the current patch, ready to be commited by `commit()`\n *\n * @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \\{\"nested.prop\": \"value\"\\}\n */\n set(attrs) {\n return this._assign(\"set\", attrs);\n }\n /**\n * Sets the given attributes to the document if they are not currently set. Does NOT merge objects.\n * The operation is added to the current patch, ready to be commited by `commit()`\n *\n * @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \\{\"nested.prop\": \"value\"\\}\n */\n setIfMissing(attrs) {\n return this._assign(\"setIfMissing\", attrs);\n }\n /**\n * Performs a \"diff-match-patch\" operation on the string attributes provided.\n * The operation is added to the current patch, ready to be commited by `commit()`\n *\n * @param attrs - Attributes to perform operation on. To set a deep attribute, use JSONMatch, eg: \\{\"nested.prop\": \"dmp\"\\}\n */\n diffMatchPatch(attrs) {\n return validateObject(\"diffMatchPatch\", attrs), this._assign(\"diffMatchPatch\", attrs);\n }\n /**\n * Unsets the attribute paths provided.\n * The operation is added to the current patch, ready to be commited by `commit()`\n *\n * @param attrs - Attribute paths to unset.\n */\n unset(attrs) {\n if (!Array.isArray(attrs))\n throw new Error(\"unset(attrs) takes an array of attributes to unset, non-array given\");\n return this.operations = Object.assign({}, this.operations, { unset: attrs }), this;\n }\n /**\n * Increment a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.\n *\n * @param attrs - Object of attribute paths to increment, values representing the number to increment by.\n */\n inc(attrs) {\n return this._assign(\"inc\", attrs);\n }\n /**\n * Decrement a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.\n *\n * @param attrs - Object of attribute paths to decrement, values representing the number to decrement by.\n */\n dec(attrs) {\n return this._assign(\"dec\", attrs);\n }\n /**\n * Provides methods for modifying arrays, by inserting, appending and replacing elements via a JSONPath expression.\n *\n * @param at - Location to insert at, relative to the given selector, or 'replace' the matched path\n * @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key==\"abc123\"]`\n * @param items - Array of items to insert/replace\n */\n insert(at, selector, items) {\n return validateInsert(at, selector, items), this._assign(\"insert\", { [at]: selector, items });\n }\n /**\n * Append the given items to the array at the given JSONPath\n *\n * @param selector - Attribute/path to append to, eg `comments` or `person.hobbies`\n * @param items - Array of items to append to the array\n */\n append(selector, items) {\n return this.insert(\"after\", `${selector}[-1]`, items);\n }\n /**\n * Prepend the given items to the array at the given JSONPath\n *\n * @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies`\n * @param items - Array of items to prepend to the array\n */\n prepend(selector, items) {\n return this.insert(\"before\", `${selector}[0]`, items);\n }\n /**\n * Change the contents of an array by removing existing elements and/or adding new elements.\n *\n * @param selector - Attribute or JSONPath expression for array\n * @param start - Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x\n * @param deleteCount - An integer indicating the number of old array elements to remove.\n * @param items - The elements to add to the array, beginning at the start index. If you don't specify any elements, splice() will only remove elements from the array.\n */\n splice(selector, start, deleteCount, items) {\n const delAll = typeof deleteCount > \"u\" || deleteCount === -1, startIndex = start < 0 ? start - 1 : start, delCount = delAll ? -1 : Math.max(0, start + deleteCount), delRange = startIndex < 0 && delCount >= 0 ? \"\" : delCount, rangeSelector = `${selector}[${startIndex}:${delRange}]`;\n return this.insert(\"replace\", rangeSelector, items || []);\n }\n /**\n * Adds a revision clause, preventing the document from being patched if the `_rev` property does not match the given value\n *\n * @param rev - Revision to lock the patch to\n */\n ifRevisionId(rev) {\n return this.operations.ifRevisionID = rev, this;\n }\n /**\n * Return a plain JSON representation of the patch\n */\n serialize() {\n return { ...getSelection(this.selection), ...this.operations };\n }\n /**\n * Return a plain JSON representation of the patch\n */\n toJSON() {\n return this.serialize();\n }\n /**\n * Clears the patch of all operations\n */\n reset() {\n return this.operations = {}, this;\n }\n _assign(op, props, merge = !0) {\n return validateObject(op, props), this.operations = Object.assign({}, this.operations, {\n [op]: Object.assign({}, merge && this.operations[op] || {}, props)\n }), this;\n }\n _set(op, props) {\n return this._assign(op, props, !1);\n }\n}\nvar _client$5;\nconst _ObservablePatch = class _ObservablePatch2 extends BasePatch {\n constructor(selection, operations, client) {\n super(selection, operations), __privateAdd$6(this, _client$5, void 0), __privateSet$6(this, _client$5, client);\n }\n /**\n * Clones the patch\n */\n clone() {\n return new _ObservablePatch2(this.selection, { ...this.operations }, __privateGet$6(this, _client$5));\n }\n commit(options) {\n if (!__privateGet$6(this, _client$5))\n throw new Error(\n \"No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method\"\n );\n const returnFirst = typeof this.selection == \"string\", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);\n return __privateGet$6(this, _client$5).mutate({ patch: this.serialize() }, opts);\n }\n};\n_client$5 = /* @__PURE__ */ new WeakMap();\nlet ObservablePatch = _ObservablePatch;\nvar _client2$5;\nconst _Patch = class _Patch2 extends BasePatch {\n constructor(selection, operations, client) {\n super(selection, operations), __privateAdd$6(this, _client2$5, void 0), __privateSet$6(this, _client2$5, client);\n }\n /**\n * Clones the patch\n */\n clone() {\n return new _Patch2(this.selection, { ...this.operations }, __privateGet$6(this, _client2$5));\n }\n commit(options) {\n if (!__privateGet$6(this, _client2$5))\n throw new Error(\n \"No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method\"\n );\n const returnFirst = typeof this.selection == \"string\", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);\n return __privateGet$6(this, _client2$5).mutate({ patch: this.serialize() }, opts);\n }\n};\n_client2$5 = /* @__PURE__ */ new WeakMap();\nlet Patch = _Patch;\nvar __accessCheck$5 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$5 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value);\nconst defaultMutateOptions = { returnDocuments: !1 };\nclass BaseTransaction {\n constructor(operations = [], transactionId) {\n this.operations = operations, this.trxId = transactionId;\n }\n /**\n * Creates a new Sanity document. If `_id` is provided and already exists, the mutation will fail. If no `_id` is given, one will automatically be generated by the database.\n * The operation is added to the current transaction, ready to be commited by `commit()`\n *\n * @param doc - Document to create. Requires a `_type` property.\n */\n create(doc) {\n return validateObject(\"create\", doc), this._add({ create: doc });\n }\n /**\n * Creates a new Sanity document. If a document with the same `_id` already exists, the create operation will be ignored.\n * The operation is added to the current transaction, ready to be commited by `commit()`\n *\n * @param doc - Document to create if it does not already exist. Requires `_id` and `_type` properties.\n */\n createIfNotExists(doc) {\n const op = \"createIfNotExists\";\n return validateObject(op, doc), requireDocumentId(op, doc), this._add({ [op]: doc });\n }\n /**\n * Creates a new Sanity document, or replaces an existing one if the same `_id` is already used.\n * The operation is added to the current transaction, ready to be commited by `commit()`\n *\n * @param doc - Document to create or replace. Requires `_id` and `_type` properties.\n */\n createOrReplace(doc) {\n const op = \"createOrReplace\";\n return validateObject(op, doc), requireDocumentId(op, doc), this._add({ [op]: doc });\n }\n /**\n * Deletes the document with the given document ID\n * The operation is added to the current transaction, ready to be commited by `commit()`\n *\n * @param documentId - Document ID to delete\n */\n delete(documentId) {\n return validateDocumentId(\"delete\", documentId), this._add({ delete: { id: documentId } });\n }\n transactionId(id) {\n return id ? (this.trxId = id, this) : this.trxId;\n }\n /**\n * Return a plain JSON representation of the transaction\n */\n serialize() {\n return [...this.operations];\n }\n /**\n * Return a plain JSON representation of the transaction\n */\n toJSON() {\n return this.serialize();\n }\n /**\n * Clears the transaction of all operations\n */\n reset() {\n return this.operations = [], this;\n }\n _add(mut) {\n return this.operations.push(mut), this;\n }\n}\nvar _client$4;\nconst _Transaction = class _Transaction2 extends BaseTransaction {\n constructor(operations, client, transactionId) {\n super(operations, transactionId), __privateAdd$5(this, _client$4, void 0), __privateSet$5(this, _client$4, client);\n }\n /**\n * Clones the transaction\n */\n clone() {\n return new _Transaction2([...this.operations], __privateGet$5(this, _client$4), this.trxId);\n }\n commit(options) {\n if (!__privateGet$5(this, _client$4))\n throw new Error(\n \"No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method\"\n );\n return __privateGet$5(this, _client$4).mutate(\n this.serialize(),\n Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})\n );\n }\n patch(patchOrDocumentId, patchOps) {\n const isBuilder = typeof patchOps == \"function\";\n if (typeof patchOrDocumentId != \"string\" && patchOrDocumentId instanceof Patch)\n return this._add({ patch: patchOrDocumentId.serialize() });\n if (isBuilder) {\n const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$5(this, _client$4)));\n if (!(patch instanceof Patch))\n throw new Error(\"function passed to `patch()` must return the patch\");\n return this._add({ patch: patch.serialize() });\n }\n return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });\n }\n};\n_client$4 = /* @__PURE__ */ new WeakMap();\nlet Transaction = _Transaction;\nvar _client2$4;\nconst _ObservableTransaction = class _ObservableTransaction2 extends BaseTransaction {\n constructor(operations, client, transactionId) {\n super(operations, transactionId), __privateAdd$5(this, _client2$4, void 0), __privateSet$5(this, _client2$4, client);\n }\n /**\n * Clones the transaction\n */\n clone() {\n return new _ObservableTransaction2([...this.operations], __privateGet$5(this, _client2$4), this.trxId);\n }\n commit(options) {\n if (!__privateGet$5(this, _client2$4))\n throw new Error(\n \"No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method\"\n );\n return __privateGet$5(this, _client2$4).mutate(\n this.serialize(),\n Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})\n );\n }\n patch(patchOrDocumentId, patchOps) {\n const isBuilder = typeof patchOps == \"function\";\n if (typeof patchOrDocumentId != \"string\" && patchOrDocumentId instanceof ObservablePatch)\n return this._add({ patch: patchOrDocumentId.serialize() });\n if (isBuilder) {\n const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$5(this, _client2$4)));\n if (!(patch instanceof ObservablePatch))\n throw new Error(\"function passed to `patch()` must return the patch\");\n return this._add({ patch: patch.serialize() });\n }\n return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });\n }\n};\n_client2$4 = /* @__PURE__ */ new WeakMap();\nlet ObservableTransaction = _ObservableTransaction;\nconst BASE_URL = \"https://www.sanity.io/help/\";\nfunction generateHelpUrl(slug) {\n return BASE_URL + slug;\n}\nfunction once(fn) {\n let didCall = !1, returnValue;\n return (...args) => (didCall || (returnValue = fn(...args), didCall = !0), returnValue);\n}\nconst createWarningPrinter = (message) => (\n // eslint-disable-next-line no-console\n once((...args) => console.warn(message.join(\" \"), ...args))\n), printCdnWarning = createWarningPrinter([\n \"Since you haven't set a value for `useCdn`, we will deliver content using our\",\n \"global, edge-cached API-CDN. If you wish to have content delivered faster, set\",\n \"`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API.\"\n]), printCdnPreviewDraftsWarning = createWarningPrinter([\n \"The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.\",\n \"The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning.\"\n]), printBrowserTokenWarning = createWarningPrinter([\n \"You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.\",\n `See ${generateHelpUrl(\n \"js-client-browser-token\"\n )} for more information and how to hide this warning.`\n]), printNoApiVersionSpecifiedWarning = createWarningPrinter([\n \"Using the Sanity client without specifying an API version is deprecated.\",\n `See ${generateHelpUrl(\"js-client-api-version\")}`\n]), printNoDefaultExport = createWarningPrinter([\n \"The default export of @sanity/client has been deprecated. Use the named export `createClient` instead.\"\n]), defaultCdnHost = \"apicdn.sanity.io\", defaultConfig = {\n apiHost: \"https://api.sanity.io\",\n apiVersion: \"1\",\n useProjectHostname: !0,\n stega: { enabled: !1 }\n}, LOCALHOSTS = [\"localhost\", \"127.0.0.1\", \"0.0.0.0\"], isLocal = (host) => LOCALHOSTS.indexOf(host) !== -1;\nfunction validateApiVersion(apiVersion) {\n if (apiVersion === \"1\" || apiVersion === \"X\")\n return;\n const apiDate = new Date(apiVersion);\n if (!(/^\\d{4}-\\d{2}-\\d{2}$/.test(apiVersion) && apiDate instanceof Date && apiDate.getTime() > 0))\n throw new Error(\"Invalid API version string, expected `1` or date in format `YYYY-MM-DD`\");\n}\nconst validateApiPerspective = function(perspective) {\n switch (perspective) {\n case \"previewDrafts\":\n case \"published\":\n case \"raw\":\n return;\n default:\n throw new TypeError(\n \"Invalid API perspective string, expected `published`, `previewDrafts` or `raw`\"\n );\n }\n}, initConfig = (config, prevConfig) => {\n const specifiedConfig = {\n ...prevConfig,\n ...config,\n stega: {\n ...typeof prevConfig.stega == \"boolean\" ? { enabled: prevConfig.stega } : prevConfig.stega || defaultConfig.stega,\n ...typeof config.stega == \"boolean\" ? { enabled: config.stega } : config.stega || {}\n }\n };\n specifiedConfig.apiVersion || printNoApiVersionSpecifiedWarning();\n const newConfig = {\n ...defaultConfig,\n ...specifiedConfig\n }, projectBased = newConfig.useProjectHostname;\n if (typeof Promise > \"u\") {\n const helpUrl = generateHelpUrl(\"js-client-promise-polyfill\");\n throw new Error(`No native Promise-implementation found, polyfill needed - see ${helpUrl}`);\n }\n if (projectBased && !newConfig.projectId)\n throw new Error(\"Configuration must contain `projectId`\");\n if (typeof newConfig.perspective == \"string\" && validateApiPerspective(newConfig.perspective), \"encodeSourceMap\" in newConfig)\n throw new Error(\n \"It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?\"\n );\n if (\"encodeSourceMapAtPath\" in newConfig)\n throw new Error(\n \"It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?\"\n );\n if (typeof newConfig.stega.enabled != \"boolean\")\n throw new Error(`stega.enabled must be a boolean, received ${newConfig.stega.enabled}`);\n if (newConfig.stega.enabled && newConfig.stega.studioUrl === void 0)\n throw new Error(\"stega.studioUrl must be defined when stega.enabled is true\");\n if (newConfig.stega.enabled && typeof newConfig.stega.studioUrl != \"string\" && typeof newConfig.stega.studioUrl != \"function\")\n throw new Error(\n `stega.studioUrl must be a string or a function, received ${newConfig.stega.studioUrl}`\n );\n const isBrowser = typeof window < \"u\" && window.location && window.location.hostname, isLocalhost = isBrowser && isLocal(window.location.hostname);\n isBrowser && isLocalhost && newConfig.token && newConfig.ignoreBrowserTokenWarning !== !0 ? printBrowserTokenWarning() : typeof newConfig.useCdn > \"u\" && printCdnWarning(), projectBased && projectId(newConfig.projectId), newConfig.dataset && dataset(newConfig.dataset), \"requestTagPrefix\" in newConfig && (newConfig.requestTagPrefix = newConfig.requestTagPrefix ? requestTag(newConfig.requestTagPrefix).replace(/\\.+$/, \"\") : void 0), newConfig.apiVersion = `${newConfig.apiVersion}`.replace(/^v/, \"\"), newConfig.isDefaultApi = newConfig.apiHost === defaultConfig.apiHost, newConfig.useCdn = newConfig.useCdn !== !1 && !newConfig.withCredentials, validateApiVersion(newConfig.apiVersion);\n const hostParts = newConfig.apiHost.split(\"://\", 2), protocol = hostParts[0], host = hostParts[1], cdnHost = newConfig.isDefaultApi ? defaultCdnHost : host;\n return newConfig.useProjectHostname ? (newConfig.url = `${protocol}://${newConfig.projectId}.${host}/v${newConfig.apiVersion}`, newConfig.cdnUrl = `${protocol}://${newConfig.projectId}.${cdnHost}/v${newConfig.apiVersion}`) : (newConfig.url = `${newConfig.apiHost}/v${newConfig.apiVersion}`, newConfig.cdnUrl = newConfig.url), newConfig;\n}, projectHeader = \"X-Sanity-Project-ID\";\nfunction requestOptions(config, overrides = {}) {\n const headers = {}, token = overrides.token || config.token;\n token && (headers.Authorization = `Bearer ${token}`), !overrides.useGlobalApi && !config.useProjectHostname && config.projectId && (headers[projectHeader] = config.projectId);\n const withCredentials = !!(typeof overrides.withCredentials > \"u\" ? config.token || config.withCredentials : overrides.withCredentials), timeout = typeof overrides.timeout > \"u\" ? config.timeout : overrides.timeout;\n return Object.assign({}, overrides, {\n headers: Object.assign({}, headers, overrides.headers || {}),\n timeout: typeof timeout > \"u\" ? 5 * 60 * 1e3 : timeout,\n proxy: overrides.proxy || config.proxy,\n json: !0,\n withCredentials,\n fetch: typeof overrides.fetch == \"object\" && typeof config.fetch == \"object\" ? { ...config.fetch, ...overrides.fetch } : overrides.fetch || config.fetch\n });\n}\nvar s = { 0: 8203, 1: 8204, 2: 8205, 3: 8290, 4: 8291, 5: 8288, 6: 65279, 7: 8289, 8: 119155, 9: 119156, a: 119157, b: 119158, c: 119159, d: 119160, e: 119161, f: 119162 }, c = { 0: 8203, 1: 8204, 2: 8205, 3: 65279 }, d = new Array(4).fill(String.fromCodePoint(c[0])).join(\"\");\nfunction E(t) {\n let e = JSON.stringify(t);\n return `${d}${Array.from(e).map((r) => {\n let n = r.charCodeAt(0);\n if (n > 255)\n throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);\n return Array.from(n.toString(4).padStart(4, \"0\")).map((o) => String.fromCodePoint(c[o])).join(\"\");\n }).join(\"\")}`;\n}\nfunction I(t) {\n return Number.isNaN(Number(t)) ? !!Date.parse(t) : !1;\n}\nfunction x(t) {\n try {\n new URL(t, t.startsWith(\"/\") ? \"https://acme.com\" : void 0);\n } catch {\n return !1;\n }\n return !0;\n}\nfunction b(t, e, r = \"auto\") {\n return r === !0 || r === \"auto\" && (I(t) || x(t)) ? t : `${t}${E(e)}`;\n}\nObject.fromEntries(Object.entries(c).map((t) => t.reverse()));\nObject.fromEntries(Object.entries(s).map((t) => t.reverse()));\nvar S = `${Object.values(s).map((t) => `\\\\u{${t.toString(16)}}`).join(\"\")}`, f = new RegExp(`[${S}]{4,}`, \"gu\");\nfunction X(t) {\n var e;\n return { cleaned: t.replace(f, \"\"), encoded: ((e = t.match(f)) == null ? void 0 : e[0]) || \"\" };\n}\nfunction vercelStegaCleanAll(result) {\n try {\n return JSON.parse(\n JSON.stringify(result, (key, value) => typeof value != \"string\" ? value : X(value).cleaned)\n );\n } catch {\n return result;\n }\n}\nconst encodeQueryString = ({\n query,\n params = {},\n options = {}\n}) => {\n const searchParams = new URLSearchParams(), { tag, returnQuery, ...opts } = options;\n tag && searchParams.append(\"tag\", tag), searchParams.append(\"query\", query);\n for (const [key, value] of Object.entries(params))\n searchParams.append(`$${key}`, JSON.stringify(value));\n for (const [key, value] of Object.entries(opts))\n value && searchParams.append(key, `${value}`);\n return returnQuery === !1 && searchParams.append(\"returnQuery\", \"false\"), `?${searchParams}`;\n}, excludeFalsey = (param, defValue) => param === !1 ? void 0 : typeof param > \"u\" ? defValue : param, getMutationQuery = (options = {}) => ({\n dryRun: options.dryRun,\n returnIds: !0,\n returnDocuments: excludeFalsey(options.returnDocuments, !0),\n visibility: options.visibility || \"sync\",\n autoGenerateArrayKeys: options.autoGenerateArrayKeys,\n skipCrossDatasetReferenceValidation: options.skipCrossDatasetReferenceValidation\n}), isResponse = (event) => event.type === \"response\", getBody = (event) => event.body, indexBy = (docs, attr) => docs.reduce((indexed, doc) => (indexed[attr(doc)] = doc, indexed), /* @__PURE__ */ Object.create(null)), getQuerySizeLimit = 11264;\nfunction _fetch(client, httpRequest, _stega, query, _params = {}, options = {}) {\n const stega = \"stega\" in options ? {\n ..._stega || {},\n ...typeof options.stega == \"boolean\" ? { enabled: options.stega } : options.stega || {}\n } : _stega, params = stega.enabled ? vercelStegaCleanAll(_params) : _params, mapResponse = options.filterResponse === !1 ? (res) => res : (res) => res.result, { cache, next, ...opts } = {\n // Opt out of setting a `signal` on an internal `fetch` if one isn't provided.\n // This is necessary in React Server Components to avoid opting out of Request Memoization.\n useAbortSignal: typeof options.signal < \"u\",\n // Set `resultSourceMap' when stega is enabled, as it's required for encoding.\n resultSourceMap: stega.enabled ? \"withKeyArraySelector\" : options.resultSourceMap,\n ...options,\n // Default to not returning the query, unless `filterResponse` is `false`,\n // or `returnQuery` is explicitly set. `true` is the default in Content Lake, so skip if truthy\n returnQuery: options.filterResponse === !1 && options.returnQuery !== !1\n }, reqOpts = typeof cache < \"u\" || typeof next < \"u\" ? { ...opts, fetch: { cache, next } } : opts, $request = _dataRequest(client, httpRequest, \"query\", { query, params }, reqOpts);\n return stega.enabled ? $request.pipe(\n combineLatestWith(\n from(\n import(\"./stegaEncodeSourceMap.js\").then(function(n) {\n return n.a;\n }).then(\n ({ stegaEncodeSourceMap }) => stegaEncodeSourceMap\n )\n )\n ),\n map(\n ([res, stegaEncodeSourceMap]) => {\n const result = stegaEncodeSourceMap(res.result, res.resultSourceMap, stega);\n return mapResponse({ ...res, result });\n }\n )\n ) : $request.pipe(map(mapResponse));\n}\nfunction _getDocument(client, httpRequest, id, opts = {}) {\n const options = { uri: _getDataUrl(client, \"doc\", id), json: !0, tag: opts.tag };\n return _requestObservable(client, httpRequest, options).pipe(\n filter(isResponse),\n map((event) => event.body.documents && event.body.documents[0])\n );\n}\nfunction _getDocuments(client, httpRequest, ids, opts = {}) {\n const options = { uri: _getDataUrl(client, \"doc\", ids.join(\",\")), json: !0, tag: opts.tag };\n return _requestObservable(client, httpRequest, options).pipe(\n filter(isResponse),\n map((event) => {\n const indexed = indexBy(event.body.documents || [], (doc) => doc._id);\n return ids.map((id) => indexed[id] || null);\n })\n );\n}\nfunction _createIfNotExists(client, httpRequest, doc, options) {\n return requireDocumentId(\"createIfNotExists\", doc), _create(client, httpRequest, doc, \"createIfNotExists\", options);\n}\nfunction _createOrReplace(client, httpRequest, doc, options) {\n return requireDocumentId(\"createOrReplace\", doc), _create(client, httpRequest, doc, \"createOrReplace\", options);\n}\nfunction _delete(client, httpRequest, selection, options) {\n return _dataRequest(\n client,\n httpRequest,\n \"mutate\",\n { mutations: [{ delete: getSelection(selection) }] },\n options\n );\n}\nfunction _mutate(client, httpRequest, mutations, options) {\n let mut;\n mutations instanceof Patch || mutations instanceof ObservablePatch ? mut = { patch: mutations.serialize() } : mutations instanceof Transaction || mutations instanceof ObservableTransaction ? mut = mutations.serialize() : mut = mutations;\n const muts = Array.isArray(mut) ? mut : [mut], transactionId = options && options.transactionId || void 0;\n return _dataRequest(client, httpRequest, \"mutate\", { mutations: muts, transactionId }, options);\n}\nfunction _dataRequest(client, httpRequest, endpoint, body, options = {}) {\n const isMutation = endpoint === \"mutate\", isQuery = endpoint === \"query\", strQuery = isMutation ? \"\" : encodeQueryString(body), useGet = !isMutation && strQuery.length < getQuerySizeLimit, stringQuery = useGet ? strQuery : \"\", returnFirst = options.returnFirst, { timeout, token, tag, headers, returnQuery } = options, uri = _getDataUrl(client, endpoint, stringQuery), reqOptions = {\n method: useGet ? \"GET\" : \"POST\",\n uri,\n json: !0,\n body: useGet ? void 0 : body,\n query: isMutation && getMutationQuery(options),\n timeout,\n headers,\n token,\n tag,\n returnQuery,\n perspective: options.perspective,\n resultSourceMap: options.resultSourceMap,\n canUseCdn: isQuery,\n signal: options.signal,\n fetch: options.fetch,\n useAbortSignal: options.useAbortSignal,\n useCdn: options.useCdn\n };\n return _requestObservable(client, httpRequest, reqOptions).pipe(\n filter(isResponse),\n map(getBody),\n map((res) => {\n if (!isMutation)\n return res;\n const results = res.results || [];\n if (options.returnDocuments)\n return returnFirst ? results[0] && results[0].document : results.map((mut) => mut.document);\n const key = returnFirst ? \"documentId\" : \"documentIds\", ids = returnFirst ? results[0] && results[0].id : results.map((mut) => mut.id);\n return {\n transactionId: res.transactionId,\n results,\n [key]: ids\n };\n })\n );\n}\nfunction _create(client, httpRequest, doc, op, options = {}) {\n const mutation = { [op]: doc }, opts = Object.assign({ returnFirst: !0, returnDocuments: !0 }, options);\n return _dataRequest(client, httpRequest, \"mutate\", { mutations: [mutation] }, opts);\n}\nfunction _requestObservable(client, httpRequest, options) {\n var _a, _b;\n const uri = options.url || options.uri, config = client.config(), canUseCdn = typeof options.canUseCdn > \"u\" ? [\"GET\", \"HEAD\"].indexOf(options.method || \"GET\") >= 0 && uri.indexOf(\"/data/\") === 0 : options.canUseCdn;\n let useCdn = ((_a = options.useCdn) != null ? _a : config.useCdn) && canUseCdn;\n const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(\".\") : options.tag || config.requestTagPrefix;\n if (tag && options.tag !== null && (options.query = { tag: requestTag(tag), ...options.query }), [\"GET\", \"HEAD\", \"POST\"].indexOf(options.method || \"GET\") >= 0 && uri.indexOf(\"/data/query/\") === 0) {\n const resultSourceMap = (_b = options.resultSourceMap) != null ? _b : config.resultSourceMap;\n resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });\n const perspective = options.perspective || config.perspective;\n typeof perspective == \"string\" && perspective !== \"raw\" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === \"previewDrafts\" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.returnQuery === !1 && (options.query = { returnQuery: \"false\", ...options.query });\n }\n const reqOptions = requestOptions(\n config,\n Object.assign({}, options, {\n url: _getUrl(client, uri, useCdn)\n })\n ), request = new Observable(\n (subscriber) => httpRequest(reqOptions, config.requester).subscribe(subscriber)\n );\n return options.signal ? request.pipe(_withAbortSignal(options.signal)) : request;\n}\nfunction _request(client, httpRequest, options) {\n return _requestObservable(client, httpRequest, options).pipe(\n filter((event) => event.type === \"response\"),\n map((event) => event.body)\n );\n}\nfunction _getDataUrl(client, operation, path) {\n const config = client.config(), catalog = hasDataset(config), baseUri = `/${operation}/${catalog}`;\n return `/data${path ? `${baseUri}/${path}` : baseUri}`.replace(/\\/($|\\?)/, \"$1\");\n}\nfunction _getUrl(client, uri, canUseCdn = !1) {\n const { url, cdnUrl } = client.config();\n return `${canUseCdn ? cdnUrl : url}/${uri.replace(/^\\//, \"\")}`;\n}\nfunction _withAbortSignal(signal) {\n return (input) => new Observable((observer) => {\n const abort = () => observer.error(_createAbortError(signal));\n if (signal && signal.aborted) {\n abort();\n return;\n }\n const subscription = input.subscribe(observer);\n return signal.addEventListener(\"abort\", abort), () => {\n signal.removeEventListener(\"abort\", abort), subscription.unsubscribe();\n };\n });\n}\nconst isDomExceptionSupported = !!globalThis.DOMException;\nfunction _createAbortError(signal) {\n var _a, _b;\n if (isDomExceptionSupported)\n return new DOMException((_a = signal == null ? void 0 : signal.reason) != null ? _a : \"The operation was aborted.\", \"AbortError\");\n const error = new Error((_b = signal == null ? void 0 : signal.reason) != null ? _b : \"The operation was aborted.\");\n return error.name = \"AbortError\", error;\n}\nvar __accessCheck$4 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$4 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _client$3, _httpRequest$4;\nclass ObservableAssetsClient {\n constructor(client, httpRequest) {\n __privateAdd$4(this, _client$3, void 0), __privateAdd$4(this, _httpRequest$4, void 0), __privateSet$4(this, _client$3, client), __privateSet$4(this, _httpRequest$4, httpRequest);\n }\n upload(assetType, body, options) {\n return _upload(__privateGet$4(this, _client$3), __privateGet$4(this, _httpRequest$4), assetType, body, options);\n }\n}\n_client$3 = /* @__PURE__ */ new WeakMap(), _httpRequest$4 = /* @__PURE__ */ new WeakMap();\nvar _client2$3, _httpRequest2$4;\nclass AssetsClient {\n constructor(client, httpRequest) {\n __privateAdd$4(this, _client2$3, void 0), __privateAdd$4(this, _httpRequest2$4, void 0), __privateSet$4(this, _client2$3, client), __privateSet$4(this, _httpRequest2$4, httpRequest);\n }\n upload(assetType, body, options) {\n const observable2 = _upload(__privateGet$4(this, _client2$3), __privateGet$4(this, _httpRequest2$4), assetType, body, options);\n return lastValueFrom(\n observable2.pipe(\n filter((event) => event.type === \"response\"),\n map(\n (event) => event.body.document\n )\n )\n );\n }\n}\n_client2$3 = /* @__PURE__ */ new WeakMap(), _httpRequest2$4 = /* @__PURE__ */ new WeakMap();\nfunction _upload(client, httpRequest, assetType, body, opts = {}) {\n validateAssetType(assetType);\n let meta = opts.extract || void 0;\n meta && !meta.length && (meta = [\"none\"]);\n const dataset2 = hasDataset(client.config()), assetEndpoint = assetType === \"image\" ? \"images\" : \"files\", options = optionsFromFile(opts, body), { tag, label, title, description, creditLine, filename, source } = options, query = {\n label,\n title,\n description,\n filename,\n meta,\n creditLine\n };\n return source && (query.sourceId = source.id, query.sourceName = source.name, query.sourceUrl = source.url), _requestObservable(client, httpRequest, {\n tag,\n method: \"POST\",\n timeout: options.timeout || 0,\n uri: `/assets/${assetEndpoint}/${dataset2}`,\n headers: options.contentType ? { \"Content-Type\": options.contentType } : {},\n query,\n body\n });\n}\nfunction optionsFromFile(opts, file) {\n return typeof File > \"u\" || !(file instanceof File) ? opts : Object.assign(\n {\n filename: opts.preserveFilename === !1 ? void 0 : file.name,\n contentType: file.type\n },\n opts\n );\n}\nvar defaults = (obj, defaults2) => Object.keys(defaults2).concat(Object.keys(obj)).reduce((target, prop) => (target[prop] = typeof obj[prop] > \"u\" ? defaults2[prop] : obj[prop], target), {});\nconst pick = (obj, props) => props.reduce((selection, prop) => (typeof obj[prop] > \"u\" || (selection[prop] = obj[prop]), selection), {}), MAX_URL_LENGTH = 14800, possibleOptions = [\n \"includePreviousRevision\",\n \"includeResult\",\n \"visibility\",\n \"effectFormat\",\n \"tag\"\n], defaultOptions = {\n includeResult: !0\n};\nfunction _listen(query, params, opts = {}) {\n const { url, token, withCredentials, requestTagPrefix } = this.config(), tag = opts.tag && requestTagPrefix ? [requestTagPrefix, opts.tag].join(\".\") : opts.tag, options = { ...defaults(opts, defaultOptions), tag }, listenOpts = pick(options, possibleOptions), qs = encodeQueryString({ query, params, options: { tag, ...listenOpts } }), uri = `${url}${_getDataUrl(this, \"listen\", qs)}`;\n if (uri.length > MAX_URL_LENGTH)\n return new Observable((observer) => observer.error(new Error(\"Query too large for listener\")));\n const listenFor = options.events ? options.events : [\"mutation\"], shouldEmitReconnect = listenFor.indexOf(\"reconnect\") !== -1, esOptions = {};\n return (token || withCredentials) && (esOptions.withCredentials = !0), token && (esOptions.headers = {\n Authorization: `Bearer ${token}`\n }), new Observable((observer) => {\n let es;\n getEventSource().then((eventSource) => {\n es = eventSource;\n }).catch((reason) => {\n observer.error(reason), stop();\n });\n let reconnectTimer, stopped = !1;\n function onError() {\n stopped || (emitReconnect(), !stopped && es.readyState === es.CLOSED && (unsubscribe(), clearTimeout(reconnectTimer), reconnectTimer = setTimeout(open, 100)));\n }\n function onChannelError(err) {\n observer.error(cooerceError(err));\n }\n function onMessage(evt) {\n const event = parseEvent(evt);\n return event instanceof Error ? observer.error(event) : observer.next(event);\n }\n function onDisconnect() {\n stopped = !0, unsubscribe(), observer.complete();\n }\n function unsubscribe() {\n es && (es.removeEventListener(\"error\", onError), es.removeEventListener(\"channelError\", onChannelError), es.removeEventListener(\"disconnect\", onDisconnect), listenFor.forEach((type) => es.removeEventListener(type, onMessage)), es.close());\n }\n function emitReconnect() {\n shouldEmitReconnect && observer.next({ type: \"reconnect\" });\n }\n async function getEventSource() {\n const { default: EventSource } = await import(\"@sanity/eventsource\"), evs = new EventSource(uri, esOptions);\n return evs.addEventListener(\"error\", onError), evs.addEventListener(\"channelError\", onChannelError), evs.addEventListener(\"disconnect\", onDisconnect), listenFor.forEach((type) => evs.addEventListener(type, onMessage)), evs;\n }\n function open() {\n getEventSource().then((eventSource) => {\n es = eventSource;\n }).catch((reason) => {\n observer.error(reason), stop();\n });\n }\n function stop() {\n stopped = !0, unsubscribe();\n }\n return stop;\n });\n}\nfunction parseEvent(event) {\n try {\n const data = event.data && JSON.parse(event.data) || {};\n return Object.assign({ type: event.type }, data);\n } catch (err) {\n return err;\n }\n}\nfunction cooerceError(err) {\n if (err instanceof Error)\n return err;\n const evt = parseEvent(err);\n return evt instanceof Error ? evt : new Error(extractErrorMessage(evt));\n}\nfunction extractErrorMessage(err) {\n return err.error ? err.error.description ? err.error.description : typeof err.error == \"string\" ? err.error : JSON.stringify(err.error, null, 2) : err.message || \"Unknown listener error\";\n}\nvar __accessCheck$3 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$3 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _client$2, _httpRequest$3;\nclass ObservableDatasetsClient {\n constructor(client, httpRequest) {\n __privateAdd$3(this, _client$2, void 0), __privateAdd$3(this, _httpRequest$3, void 0), __privateSet$3(this, _client$2, client), __privateSet$3(this, _httpRequest$3, httpRequest);\n }\n /**\n * Create a new dataset with the given name\n *\n * @param name - Name of the dataset to create\n * @param options - Options for the dataset\n */\n create(name, options) {\n return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), \"PUT\", name, options);\n }\n /**\n * Edit a dataset with the given name\n *\n * @param name - Name of the dataset to edit\n * @param options - New options for the dataset\n */\n edit(name, options) {\n return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), \"PATCH\", name, options);\n }\n /**\n * Delete a dataset with the given name\n *\n * @param name - Name of the dataset to delete\n */\n delete(name) {\n return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), \"DELETE\", name);\n }\n /**\n * Fetch a list of datasets for the configured project\n */\n list() {\n return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {\n uri: \"/datasets\",\n tag: null\n });\n }\n}\n_client$2 = /* @__PURE__ */ new WeakMap(), _httpRequest$3 = /* @__PURE__ */ new WeakMap();\nvar _client2$2, _httpRequest2$3;\nclass DatasetsClient {\n constructor(client, httpRequest) {\n __privateAdd$3(this, _client2$2, void 0), __privateAdd$3(this, _httpRequest2$3, void 0), __privateSet$3(this, _client2$2, client), __privateSet$3(this, _httpRequest2$3, httpRequest);\n }\n /**\n * Create a new dataset with the given name\n *\n * @param name - Name of the dataset to create\n * @param options - Options for the dataset\n */\n create(name, options) {\n return lastValueFrom(\n _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), \"PUT\", name, options)\n );\n }\n /**\n * Edit a dataset with the given name\n *\n * @param name - Name of the dataset to edit\n * @param options - New options for the dataset\n */\n edit(name, options) {\n return lastValueFrom(\n _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), \"PATCH\", name, options)\n );\n }\n /**\n * Delete a dataset with the given name\n *\n * @param name - Name of the dataset to delete\n */\n delete(name) {\n return lastValueFrom(_modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), \"DELETE\", name));\n }\n /**\n * Fetch a list of datasets for the configured project\n */\n list() {\n return lastValueFrom(\n _request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), { uri: \"/datasets\", tag: null })\n );\n }\n}\n_client2$2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$3 = /* @__PURE__ */ new WeakMap();\nfunction _modify(client, httpRequest, method, name, options) {\n return dataset(name), _request(client, httpRequest, {\n method,\n uri: `/datasets/${name}`,\n body: options,\n tag: null\n });\n}\nvar __accessCheck$2 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$2 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _client$1, _httpRequest$2;\nclass ObservableProjectsClient {\n constructor(client, httpRequest) {\n __privateAdd$2(this, _client$1, void 0), __privateAdd$2(this, _httpRequest$2, void 0), __privateSet$2(this, _client$1, client), __privateSet$2(this, _httpRequest$2, httpRequest);\n }\n list(options) {\n const uri = (options == null ? void 0 : options.includeMembers) === !1 ? \"/projects?includeMembers=false\" : \"/projects\";\n return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri });\n }\n /**\n * Fetch a project by project ID\n *\n * @param projectId - ID of the project to fetch\n */\n getById(projectId2) {\n return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri: `/projects/${projectId2}` });\n }\n}\n_client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */ new WeakMap();\nvar _client2$1, _httpRequest2$2;\nclass ProjectsClient {\n constructor(client, httpRequest) {\n __privateAdd$2(this, _client2$1, void 0), __privateAdd$2(this, _httpRequest2$2, void 0), __privateSet$2(this, _client2$1, client), __privateSet$2(this, _httpRequest2$2, httpRequest);\n }\n list(options) {\n const uri = (options == null ? void 0 : options.includeMembers) === !1 ? \"/projects?includeMembers=false\" : \"/projects\";\n return lastValueFrom(_request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri }));\n }\n /**\n * Fetch a project by project ID\n *\n * @param projectId - ID of the project to fetch\n */\n getById(projectId2) {\n return lastValueFrom(\n _request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri: `/projects/${projectId2}` })\n );\n }\n}\n_client2$1 = /* @__PURE__ */ new WeakMap(), _httpRequest2$2 = /* @__PURE__ */ new WeakMap();\nvar __accessCheck$1 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$1 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _client, _httpRequest$1;\nclass ObservableUsersClient {\n constructor(client, httpRequest) {\n __privateAdd$1(this, _client, void 0), __privateAdd$1(this, _httpRequest$1, void 0), __privateSet$1(this, _client, client), __privateSet$1(this, _httpRequest$1, httpRequest);\n }\n /**\n * Fetch a user by user ID\n *\n * @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.\n */\n getById(id) {\n return _request(\n __privateGet$1(this, _client),\n __privateGet$1(this, _httpRequest$1),\n { uri: `/users/${id}` }\n );\n }\n}\n_client = /* @__PURE__ */ new WeakMap(), _httpRequest$1 = /* @__PURE__ */ new WeakMap();\nvar _client2, _httpRequest2$1;\nclass UsersClient {\n constructor(client, httpRequest) {\n __privateAdd$1(this, _client2, void 0), __privateAdd$1(this, _httpRequest2$1, void 0), __privateSet$1(this, _client2, client), __privateSet$1(this, _httpRequest2$1, httpRequest);\n }\n /**\n * Fetch a user by user ID\n *\n * @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.\n */\n getById(id) {\n return lastValueFrom(\n _request(__privateGet$1(this, _client2), __privateGet$1(this, _httpRequest2$1), {\n uri: `/users/${id}`\n })\n );\n }\n}\n_client2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$1 = /* @__PURE__ */ new WeakMap();\nvar __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _clientConfig, _httpRequest;\nconst _ObservableSanityClient = class _ObservableSanityClient2 {\n constructor(httpRequest, config = defaultConfig) {\n __privateAdd(this, _clientConfig, void 0), __privateAdd(this, _httpRequest, void 0), this.listen = _listen, this.config(config), __privateSet(this, _httpRequest, httpRequest), this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest)), this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest)), this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest)), this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));\n }\n /**\n * Clone the client - returns a new instance\n */\n clone() {\n return new _ObservableSanityClient2(__privateGet(this, _httpRequest), this.config());\n }\n config(newConfig) {\n if (newConfig === void 0)\n return { ...__privateGet(this, _clientConfig) };\n if (__privateGet(this, _clientConfig) && __privateGet(this, _clientConfig).allowReconfigure === !1)\n throw new Error(\n \"Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client\"\n );\n return __privateSet(this, _clientConfig, initConfig(newConfig, __privateGet(this, _clientConfig) || {})), this;\n }\n /**\n * Clone the client with a new (partial) configuration.\n *\n * @param newConfig - New client configuration properties, shallowly merged with existing configuration\n */\n withConfig(newConfig) {\n const thisConfig = this.config();\n return new _ObservableSanityClient2(__privateGet(this, _httpRequest), {\n ...thisConfig,\n ...newConfig,\n stega: {\n ...thisConfig.stega || {},\n ...typeof (newConfig == null ? void 0 : newConfig.stega) == \"boolean\" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}\n }\n });\n }\n fetch(query, params, options) {\n return _fetch(\n this,\n __privateGet(this, _httpRequest),\n __privateGet(this, _clientConfig).stega,\n query,\n params,\n options\n );\n }\n /**\n * Fetch a single document with the given ID.\n *\n * @param id - Document ID to fetch\n * @param options - Request options\n */\n getDocument(id, options) {\n return _getDocument(this, __privateGet(this, _httpRequest), id, options);\n }\n /**\n * Fetch multiple documents in one request.\n * Should be used sparingly - performing a query is usually a better option.\n * The order/position of documents is preserved based on the original array of IDs.\n * If any of the documents are missing, they will be replaced by a `null` entry in the returned array\n *\n * @param ids - Document IDs to fetch\n * @param options - Request options\n */\n getDocuments(ids, options) {\n return _getDocuments(this, __privateGet(this, _httpRequest), ids, options);\n }\n create(document, options) {\n return _create(this, __privateGet(this, _httpRequest), document, \"create\", options);\n }\n createIfNotExists(document, options) {\n return _createIfNotExists(this, __privateGet(this, _httpRequest), document, options);\n }\n createOrReplace(document, options) {\n return _createOrReplace(this, __privateGet(this, _httpRequest), document, options);\n }\n delete(selection, options) {\n return _delete(this, __privateGet(this, _httpRequest), selection, options);\n }\n mutate(operations, options) {\n return _mutate(this, __privateGet(this, _httpRequest), operations, options);\n }\n /**\n * Create a new buildable patch of operations to perform\n *\n * @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch\n * @param operations - Optional object of patch operations to initialize the patch instance with\n * @returns Patch instance - call `.commit()` to perform the operations defined\n */\n patch(selection, operations) {\n return new ObservablePatch(selection, operations, this);\n }\n /**\n * Create a new transaction of mutations\n *\n * @param operations - Optional array of mutation operations to initialize the transaction instance with\n */\n transaction(operations) {\n return new ObservableTransaction(operations, this);\n }\n /**\n * Perform an HTTP request against the Sanity API\n *\n * @param options - Request options\n */\n request(options) {\n return _request(this, __privateGet(this, _httpRequest), options);\n }\n /**\n * Get a Sanity API URL for the URI provided\n *\n * @param uri - URI/path to build URL for\n * @param canUseCdn - Whether or not to allow using the API CDN for this route\n */\n getUrl(uri, canUseCdn) {\n return _getUrl(this, uri, canUseCdn);\n }\n /**\n * Get a Sanity API URL for the data operation and path provided\n *\n * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)\n * @param path - Path to append after the operation\n */\n getDataUrl(operation, path) {\n return _getDataUrl(this, operation, path);\n }\n};\n_clientConfig = /* @__PURE__ */ new WeakMap(), _httpRequest = /* @__PURE__ */ new WeakMap();\nlet ObservableSanityClient = _ObservableSanityClient;\nvar _clientConfig2, _httpRequest2;\nconst _SanityClient = class _SanityClient2 {\n constructor(httpRequest, config = defaultConfig) {\n __privateAdd(this, _clientConfig2, void 0), __privateAdd(this, _httpRequest2, void 0), this.listen = _listen, this.config(config), __privateSet(this, _httpRequest2, httpRequest), this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2)), this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2)), this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2)), this.users = new UsersClient(this, __privateGet(this, _httpRequest2)), this.observable = new ObservableSanityClient(httpRequest, config);\n }\n /**\n * Clone the client - returns a new instance\n */\n clone() {\n return new _SanityClient2(__privateGet(this, _httpRequest2), this.config());\n }\n config(newConfig) {\n if (newConfig === void 0)\n return { ...__privateGet(this, _clientConfig2) };\n if (__privateGet(this, _clientConfig2) && __privateGet(this, _clientConfig2).allowReconfigure === !1)\n throw new Error(\n \"Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client\"\n );\n return this.observable && this.observable.config(newConfig), __privateSet(this, _clientConfig2, initConfig(newConfig, __privateGet(this, _clientConfig2) || {})), this;\n }\n /**\n * Clone the client with a new (partial) configuration.\n *\n * @param newConfig - New client configuration properties, shallowly merged with existing configuration\n */\n withConfig(newConfig) {\n const thisConfig = this.config();\n return new _SanityClient2(__privateGet(this, _httpRequest2), {\n ...thisConfig,\n ...newConfig,\n stega: {\n ...thisConfig.stega || {},\n ...typeof (newConfig == null ? void 0 : newConfig.stega) == \"boolean\" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}\n }\n });\n }\n fetch(query, params, options) {\n return lastValueFrom(\n _fetch(\n this,\n __privateGet(this, _httpRequest2),\n __privateGet(this, _clientConfig2).stega,\n query,\n params,\n options\n )\n );\n }\n /**\n * Fetch a single document with the given ID.\n *\n * @param id - Document ID to fetch\n * @param options - Request options\n */\n getDocument(id, options) {\n return lastValueFrom(_getDocument(this, __privateGet(this, _httpRequest2), id, options));\n }\n /**\n * Fetch multiple documents in one request.\n * Should be used sparingly - performing a query is usually a better option.\n * The order/position of documents is preserved based on the original array of IDs.\n * If any of the documents are missing, they will be replaced by a `null` entry in the returned array\n *\n * @param ids - Document IDs to fetch\n * @param options - Request options\n */\n getDocuments(ids, options) {\n return lastValueFrom(_getDocuments(this, __privateGet(this, _httpRequest2), ids, options));\n }\n create(document, options) {\n return lastValueFrom(\n _create(this, __privateGet(this, _httpRequest2), document, \"create\", options)\n );\n }\n createIfNotExists(document, options) {\n return lastValueFrom(\n _createIfNotExists(this, __privateGet(this, _httpRequest2), document, options)\n );\n }\n createOrReplace(document, options) {\n return lastValueFrom(\n _createOrReplace(this, __privateGet(this, _httpRequest2), document, options)\n );\n }\n delete(selection, options) {\n return lastValueFrom(_delete(this, __privateGet(this, _httpRequest2), selection, options));\n }\n mutate(operations, options) {\n return lastValueFrom(_mutate(this, __privateGet(this, _httpRequest2), operations, options));\n }\n /**\n * Create a new buildable patch of operations to perform\n *\n * @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch\n * @param operations - Optional object of patch operations to initialize the patch instance with\n * @returns Patch instance - call `.commit()` to perform the operations defined\n */\n patch(documentId, operations) {\n return new Patch(documentId, operations, this);\n }\n /**\n * Create a new transaction of mutations\n *\n * @param operations - Optional array of mutation operations to initialize the transaction instance with\n */\n transaction(operations) {\n return new Transaction(operations, this);\n }\n /**\n * Perform a request against the Sanity API\n * NOTE: Only use this for Sanity API endpoints, not for your own APIs!\n *\n * @param options - Request options\n * @returns Promise resolving to the response body\n */\n request(options) {\n return lastValueFrom(_request(this, __privateGet(this, _httpRequest2), options));\n }\n /**\n * Perform an HTTP request a `/data` sub-endpoint\n * NOTE: Considered internal, thus marked as deprecated. Use `request` instead.\n *\n * @deprecated - Use `request()` or your own HTTP library instead\n * @param endpoint - Endpoint to hit (mutate, query etc)\n * @param body - Request body\n * @param options - Request options\n * @internal\n */\n dataRequest(endpoint, body, options) {\n return lastValueFrom(_dataRequest(this, __privateGet(this, _httpRequest2), endpoint, body, options));\n }\n /**\n * Get a Sanity API URL for the URI provided\n *\n * @param uri - URI/path to build URL for\n * @param canUseCdn - Whether or not to allow using the API CDN for this route\n */\n getUrl(uri, canUseCdn) {\n return _getUrl(this, uri, canUseCdn);\n }\n /**\n * Get a Sanity API URL for the data operation and path provided\n *\n * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)\n * @param path - Path to append after the operation\n */\n getDataUrl(operation, path) {\n return _getDataUrl(this, operation, path);\n }\n};\n_clientConfig2 = /* @__PURE__ */ new WeakMap(), _httpRequest2 = /* @__PURE__ */ new WeakMap();\nlet SanityClient = _SanityClient;\nfunction defineCreateClientExports(envMiddleware2, ClassConstructor) {\n return { requester: defineHttpRequest(envMiddleware2, {}).defaultRequester, createClient: (config) => new ClassConstructor(\n defineHttpRequest(envMiddleware2, {\n maxRetries: config.maxRetries,\n retryDelay: config.retryDelay\n }),\n config\n ) };\n}\nvar envMiddleware = [];\nexport {\n BasePatch as B,\n ClientError as C,\n ObservablePatch as O,\n Patch as P,\n SanityClient as S,\n Transaction as T,\n ServerError as a,\n BaseTransaction as b,\n ObservableTransaction as c,\n defineCreateClientExports as d,\n envMiddleware as e,\n ObservableSanityClient as f,\n b as g,\n printNoDefaultExport as p,\n vercelStegaCleanAll as v\n};\n//# sourceMappingURL=browserMiddleware.js.map\n","import { g as b } from \"./browserMiddleware.js\";\nconst reKeySegment = /_key\\s*==\\s*['\"](.*)['\"]/;\nfunction isKeySegment(segment) {\n return typeof segment == \"string\" ? reKeySegment.test(segment.trim()) : typeof segment == \"object\" && \"_key\" in segment;\n}\nfunction toString(path) {\n if (!Array.isArray(path))\n throw new Error(\"Path is not an array\");\n return path.reduce((target, segment, i) => {\n const segmentType = typeof segment;\n if (segmentType === \"number\")\n return `${target}[${segment}]`;\n if (segmentType === \"string\")\n return `${target}${i === 0 ? \"\" : \".\"}${segment}`;\n if (isKeySegment(segment) && segment._key)\n return `${target}[_key==\"${segment._key}\"]`;\n if (Array.isArray(segment)) {\n const [from, to] = segment;\n return `${target}[${from}:${to}]`;\n }\n throw new Error(`Unsupported path segment \\`${JSON.stringify(segment)}\\``);\n }, \"\");\n}\nconst ESCAPE = {\n \"\\f\": \"\\\\f\",\n \"\\n\": \"\\\\n\",\n \"\\r\": \"\\\\r\",\n \"\t\": \"\\\\t\",\n \"'\": \"\\\\'\",\n \"\\\\\": \"\\\\\\\\\"\n}, UNESCAPE = {\n \"\\\\f\": \"\\f\",\n \"\\\\n\": `\n`,\n \"\\\\r\": \"\\r\",\n \"\\\\t\": \"\t\",\n \"\\\\'\": \"'\",\n \"\\\\\\\\\": \"\\\\\"\n};\nfunction jsonPath(path) {\n return `$${path.map((segment) => typeof segment == \"string\" ? `['${segment.replace(/[\\f\\n\\r\\t'\\\\]/g, (match) => ESCAPE[match])}']` : typeof segment == \"number\" ? `[${segment}]` : segment._key !== \"\" ? `[?(@._key=='${segment._key.replace(/['\\\\]/g, (match) => ESCAPE[match])}')]` : `[${segment._index}]`).join(\"\")}`;\n}\nfunction parseJsonPath(path) {\n const parsed = [], parseRe = /\\['(.*?)'\\]|\\[(\\d+)\\]|\\[\\?\\(@\\._key=='(.*?)'\\)\\]/g;\n let match;\n for (; (match = parseRe.exec(path)) !== null; ) {\n if (match[1] !== void 0) {\n const key = match[1].replace(/\\\\(\\\\|f|n|r|t|')/g, (m) => UNESCAPE[m]);\n parsed.push(key);\n continue;\n }\n if (match[2] !== void 0) {\n parsed.push(parseInt(match[2], 10));\n continue;\n }\n if (match[3] !== void 0) {\n const _key = match[3].replace(/\\\\(\\\\')/g, (m) => UNESCAPE[m]);\n parsed.push({\n _key,\n _index: -1\n });\n continue;\n }\n }\n return parsed;\n}\nfunction jsonPathToStudioPath(path) {\n return path.map((segment) => {\n if (typeof segment == \"string\" || typeof segment == \"number\")\n return segment;\n if (segment._key !== \"\")\n return { _key: segment._key };\n if (segment._index !== -1)\n return segment._index;\n throw new Error(`invalid segment:${JSON.stringify(segment)}`);\n });\n}\nfunction jsonPathToMappingPath(path) {\n return path.map((segment) => {\n if (typeof segment == \"string\" || typeof segment == \"number\")\n return segment;\n if (segment._index !== -1)\n return segment._index;\n throw new Error(`invalid segment:${JSON.stringify(segment)}`);\n });\n}\nfunction resolveMapping(resultPath, csm) {\n if (!(csm != null && csm.mappings))\n return;\n const resultMappingPath = jsonPath(jsonPathToMappingPath(resultPath));\n if (csm.mappings[resultMappingPath] !== void 0)\n return {\n mapping: csm.mappings[resultMappingPath],\n matchedPath: resultMappingPath,\n pathSuffix: \"\"\n };\n const mappings = Object.entries(csm.mappings).filter(([key]) => resultMappingPath.startsWith(key)).sort(([key1], [key2]) => key2.length - key1.length);\n if (mappings.length == 0)\n return;\n const [matchedPath, mapping] = mappings[0], pathSuffix = resultMappingPath.substring(matchedPath.length);\n return { mapping, matchedPath, pathSuffix };\n}\nfunction isArray(value) {\n return value !== null && Array.isArray(value);\n}\nfunction isRecord(value) {\n return typeof value == \"object\" && value !== null;\n}\nfunction walkMap(value, mappingFn, path = []) {\n return isArray(value) ? value.map((v, idx) => {\n if (isRecord(v)) {\n const _key = v._key;\n if (typeof _key == \"string\")\n return walkMap(v, mappingFn, path.concat({ _key, _index: idx }));\n }\n return walkMap(v, mappingFn, path.concat(idx));\n }) : isRecord(value) ? Object.fromEntries(\n Object.entries(value).map(([k, v]) => [k, walkMap(v, mappingFn, path.concat(k))])\n ) : mappingFn(value, path);\n}\nfunction encodeIntoResult(result, csm, encoder) {\n return walkMap(result, (value, path) => {\n if (typeof value != \"string\")\n return value;\n const resolveMappingResult = resolveMapping(path, csm);\n if (!resolveMappingResult)\n return value;\n const { mapping, matchedPath } = resolveMappingResult;\n if (mapping.type !== \"value\" || mapping.source.type !== \"documentValue\")\n return value;\n const sourceDocument = csm.documents[mapping.source.document], sourcePath = csm.paths[mapping.source.path], matchPathSegments = parseJsonPath(matchedPath), fullSourceSegments = parseJsonPath(sourcePath).concat(path.slice(matchPathSegments.length));\n return encoder({\n sourcePath: fullSourceSegments,\n sourceDocument,\n resultPath: path,\n value\n });\n });\n}\nconst DRAFTS_PREFIX = \"drafts.\";\nfunction getPublishedId(id) {\n return id.startsWith(DRAFTS_PREFIX) ? id.slice(DRAFTS_PREFIX.length) : id;\n}\nfunction createEditUrl(options) {\n const {\n baseUrl,\n workspace: _workspace = \"default\",\n tool: _tool = \"default\",\n id: _id,\n type,\n path,\n projectId,\n dataset\n } = options;\n if (!baseUrl)\n throw new Error(\"baseUrl is required\");\n if (!path)\n throw new Error(\"path is required\");\n if (!_id)\n throw new Error(\"id is required\");\n if (baseUrl !== \"/\" && baseUrl.endsWith(\"/\"))\n throw new Error(\"baseUrl must not end with a slash\");\n const workspace = _workspace === \"default\" ? void 0 : _workspace, tool = _tool === \"default\" ? void 0 : _tool, id = getPublishedId(_id), stringifiedPath = Array.isArray(path) ? toString(jsonPathToStudioPath(path)) : path, searchParams = new URLSearchParams({\n baseUrl,\n id,\n type,\n path: stringifiedPath\n });\n workspace && searchParams.set(\"workspace\", workspace), tool && searchParams.set(\"tool\", tool), projectId && searchParams.set(\"projectId\", projectId), dataset && searchParams.set(\"dataset\", dataset), _id.startsWith(DRAFTS_PREFIX) && searchParams.set(\"isDraft\", \"\");\n const segments = [baseUrl === \"/\" ? \"\" : baseUrl];\n workspace && segments.push(workspace);\n const routerParams = [\n \"mode=presentation\",\n `id=${id}`,\n `type=${type}`,\n `path=${encodeURIComponent(stringifiedPath)}`\n ];\n return tool && routerParams.push(`tool=${tool}`), segments.push(\"intent\", \"edit\", `${routerParams.join(\";\")}?${searchParams}`), segments.join(\"/\");\n}\nfunction resolveStudioBaseRoute(studioUrl) {\n let baseUrl = typeof studioUrl == \"string\" ? studioUrl : studioUrl.baseUrl;\n return baseUrl !== \"/\" && (baseUrl = baseUrl.replace(/\\/$/, \"\")), typeof studioUrl == \"string\" ? { baseUrl } : { ...studioUrl, baseUrl };\n}\nconst filterDefault = ({ sourcePath, value }) => {\n if (isValidDate(value) || isValidURL(value))\n return !1;\n const endPath = sourcePath.at(-1);\n return !(sourcePath.at(-2) === \"slug\" && endPath === \"current\" || typeof endPath == \"string\" && endPath.startsWith(\"_\") || typeof endPath == \"number\" && sourcePath.at(-2) === \"marks\" || endPath === \"href\" && typeof sourcePath.at(-2) == \"number\" && sourcePath.at(-3) === \"markDefs\" || endPath === \"style\" || endPath === \"listItem\" || sourcePath.some(\n (path) => path === \"meta\" || path === \"metadata\" || path === \"openGraph\" || path === \"seo\"\n ) || typeof endPath == \"string\" && denylist.has(endPath));\n}, denylist = /* @__PURE__ */ new Set([\n \"color\",\n \"colour\",\n \"currency\",\n \"email\",\n \"format\",\n \"gid\",\n \"hex\",\n \"href\",\n \"hsl\",\n \"hsla\",\n \"icon\",\n \"id\",\n \"index\",\n \"key\",\n \"language\",\n \"layout\",\n \"link\",\n \"linkAction\",\n \"locale\",\n \"lqip\",\n \"page\",\n \"path\",\n \"ref\",\n \"rgb\",\n \"rgba\",\n \"route\",\n \"secret\",\n \"slug\",\n \"status\",\n \"tag\",\n \"template\",\n \"theme\",\n \"type\",\n \"unit\",\n \"url\",\n \"username\",\n \"variant\",\n \"website\"\n]);\nfunction isValidDate(dateString) {\n return /^\\d{4}-\\d{2}-\\d{2}/.test(dateString) ? !!Date.parse(dateString) : !1;\n}\nfunction isValidURL(url) {\n try {\n new URL(url, url.startsWith(\"/\") ? \"https://acme.com\" : void 0);\n } catch {\n return !1;\n }\n return !0;\n}\nconst TRUNCATE_LENGTH = 20;\nfunction stegaEncodeSourceMap(result, resultSourceMap, config) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _i;\n const { filter, logger, enabled } = config;\n if (!enabled) {\n const msg = \"config.enabled must be true, don't call this function otherwise\";\n throw (_a = logger == null ? void 0 : logger.error) == null || _a.call(logger, `[@sanity/client]: ${msg}`, { result, resultSourceMap, config }), new TypeError(msg);\n }\n if (!resultSourceMap)\n return (_b = logger == null ? void 0 : logger.error) == null || _b.call(logger, \"[@sanity/client]: Missing Content Source Map from response body\", {\n result,\n resultSourceMap,\n config\n }), result;\n if (!config.studioUrl) {\n const msg = \"config.studioUrl must be defined\";\n throw (_c = logger == null ? void 0 : logger.error) == null || _c.call(logger, `[@sanity/client]: ${msg}`, { result, resultSourceMap, config }), new TypeError(msg);\n }\n const report = {\n encoded: [],\n skipped: []\n }, resultWithStega = encodeIntoResult(\n result,\n resultSourceMap,\n ({ sourcePath, sourceDocument, resultPath, value }) => {\n if ((typeof filter == \"function\" ? filter({ sourcePath, resultPath, filterDefault, sourceDocument, value }) : filterDefault({ sourcePath, resultPath, filterDefault, sourceDocument, value })) === !1)\n return logger && report.skipped.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? \"...\" : \"\"}`,\n length: value.length\n }), value;\n logger && report.encoded.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? \"...\" : \"\"}`,\n length: value.length\n });\n const { baseUrl, workspace, tool } = resolveStudioBaseRoute(\n typeof config.studioUrl == \"function\" ? config.studioUrl(sourceDocument) : config.studioUrl\n );\n if (!baseUrl)\n return value;\n const { _id: id, _type: type, _projectId: projectId, _dataset: dataset } = sourceDocument;\n return b(\n value,\n {\n origin: \"sanity.io\",\n href: createEditUrl({\n baseUrl,\n workspace,\n tool,\n id,\n type,\n path: sourcePath,\n ...!config.omitCrossDatasetReferenceData && { dataset, projectId }\n })\n },\n // We use custom logic to determine if we should skip encoding\n !1\n );\n }\n );\n if (logger) {\n const isSkipping = report.skipped.length, isEncoding = report.encoded.length;\n if ((isSkipping || isEncoding) && ((_d = (logger == null ? void 0 : logger.groupCollapsed) || logger.log) == null || _d(\"[@sanity/client]: Encoding source map into result\"), (_e = logger.log) == null || _e.call(\n logger,\n `[@sanity/client]: Paths encoded: ${report.encoded.length}, skipped: ${report.skipped.length}`\n )), report.encoded.length > 0 && ((_f = logger == null ? void 0 : logger.log) == null || _f.call(logger, \"[@sanity/client]: Table of encoded paths\"), (_g = (logger == null ? void 0 : logger.table) || logger.log) == null || _g(report.encoded)), report.skipped.length > 0) {\n const skipped = /* @__PURE__ */ new Set();\n for (const { path } of report.skipped)\n skipped.add(path.replace(reKeySegment, \"0\").replace(/\\[\\d+\\]/g, \"[]\"));\n (_h = logger == null ? void 0 : logger.log) == null || _h.call(logger, \"[@sanity/client]: List of skipped paths\", [...skipped.values()]);\n }\n (isSkipping || isEncoding) && ((_i = logger == null ? void 0 : logger.groupEnd) == null || _i.call(logger));\n }\n return resultWithStega;\n}\nfunction prettyPathForLogging(path) {\n return toString(jsonPathToStudioPath(path));\n}\nvar stegaEncodeSourceMap$1 = /* @__PURE__ */ Object.freeze({\n __proto__: null,\n stegaEncodeSourceMap\n});\nexport {\n stegaEncodeSourceMap$1 as a,\n encodeIntoResult as e,\n stegaEncodeSourceMap as s\n};\n//# sourceMappingURL=stegaEncodeSourceMap.js.map\n"],"names":["s","a","b","c","d","e","f","Array","fill","String","fromCodePoint","join","E","t","JSON","stringify","concat","from","map","r","n","charCodeAt","Error","toString","padStart","o","I","Number","isNaN","Date","parse","x","URL","startsWith","arguments","length","undefined","Object","fromEntries","entries","reverse","values","reKeySegment","isKeySegment","segment","test","trim","path","isArray","reduce","target","i","segmentType","_key","to","ESCAPE","UNESCAPE","jsonPath","replace","match","_index","parseJsonPath","parsed","parseRe","exec","key","m","push","parseInt","jsonPathToStudioPath","jsonPathToMappingPath","resolveMapping","resultPath","csm","mappings","resultMappingPath","mapping","matchedPath","pathSuffix","filter","_ref","sort","_ref2","_ref3","key1","key2","substring","value","isRecord","walkMap","mappingFn","v","idx","_ref4","k","encodeIntoResult","result","encoder","resolveMappingResult","type","source","sourceDocument","documents","document","sourcePath","paths","matchPathSegments","fullSourceSegments","slice","DRAFTS_PREFIX","getPublishedId","id","createEditUrl","options","baseUrl","workspace","_workspace","tool","_tool","_id","projectId","dataset","endsWith","stringifiedPath","searchParams","URLSearchParams","set","segments","routerParams","encodeURIComponent","resolveStudioBaseRoute","studioUrl","filterDefault","_ref5","isValidDate","isValidURL","endPath","at","some","denylist","has","Set","dateString","url","TRUNCATE_LENGTH","stegaEncodeSourceMap","resultSourceMap","config","_a","_b","_c","_d","_e","_f","_g","_h","_i","logger","enabled","msg","error","call","TypeError","report","encoded","skipped","resultWithStega","_ref6","prettyPathForLogging","_type","_projectId","_dataset","origin","href","omitCrossDatasetReferenceData","isSkipping","isEncoding","groupCollapsed","log","table","add","groupEnd","stegaEncodeSourceMap$1","freeze","__proto__"],"mappings":";;AAilBA,IAAIA,CAAC,GAAG;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,KAAK;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,MAAM;IAAE,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE;EAAQ,CAAA;EAAEH,CAAC,GAAG;IAAE,CAAC,EAAE,IAAI;IAAE,CA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AAI,GAAG,KAAK,CAAC,GAAGA,MAAM,CAACqB,GAAG,KAAK,IAAI,IAAIvB,EAAE,CAACM,IAAI,CAACJ,MAAM,EAAE,yCAAyC,EAAE,CAAC,GAAGQ,OAAO,CAAC5H,MAAM,CAAE,CAAA,CAAC,CAAC;IACzI;IACD,CAACsI,UAAU,IAAIC,UAAU,MAAM,CAACpB,EAAE,GAAGC,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAGA,MAAM,CAACwB,QAAQ,KAAK,IAAI,IAAIzB,EAAE,CAACK,IAAI,CAACJ,MAAM,CAAC,CAAC;EAC5G;EACD,OAAOS,eAAe;AACxB;AACA,SAASE,oBAAoBA,CAACzH,IAAI,EAAE;EAClC,OAAOxB,QAAQ,CAAC8C,oBAAoB,CAACtB,IAAI,CAAC,CAAC;AAC7C;AACG,IAACuI,sBAAsB,GAAA,eAAmBjJ,MAAM,CAACkJ,MAAM,CAAC;EACzDC,SAAS,EAAE,IAAI;EACfvC;AACF,CAAC,CAAA;","x_google_ignoreList":[0,1]}
|
1
|
+
{"version":3,"file":"stegaEncodeSourceMap-QOvbA7yd.js","sources":["../../../../../node_modules/.pnpm/@sanity+client@6.15.4/node_modules/@sanity/client/dist/_chunks/browserMiddleware.js","../../../../../node_modules/.pnpm/@sanity+client@6.15.4/node_modules/@sanity/client/dist/_chunks/stegaEncodeSourceMap.js"],"sourcesContent":["import { getIt } from \"get-it\";\nimport { retry, jsonRequest, jsonResponse, progress, observable } from \"get-it/middleware\";\nimport { Observable, from, lastValueFrom } from \"rxjs\";\nimport { combineLatestWith, map, filter } from \"rxjs/operators\";\nclass ClientError extends Error {\n constructor(res) {\n const props = extractErrorProps(res);\n super(props.message), this.statusCode = 400, Object.assign(this, props);\n }\n}\nclass ServerError extends Error {\n constructor(res) {\n const props = extractErrorProps(res);\n super(props.message), this.statusCode = 500, Object.assign(this, props);\n }\n}\nfunction extractErrorProps(res) {\n const body = res.body, props = {\n response: res,\n statusCode: res.statusCode,\n responseBody: stringifyBody(body, res),\n message: \"\",\n details: void 0\n };\n if (body.error && body.message)\n return props.message = `${body.error} - ${body.message}`, props;\n if (isMutationError(body)) {\n const allItems = body.error.items || [], items = allItems.slice(0, 5).map((item) => {\n var _a;\n return (_a = item.error) == null ? void 0 : _a.description;\n }).filter(Boolean);\n let itemsStr = items.length ? `:\n- ${items.join(`\n- `)}` : \"\";\n return allItems.length > 5 && (itemsStr += `\n...and ${allItems.length - 5} more`), props.message = `${body.error.description}${itemsStr}`, props.details = body.error, props;\n }\n return body.error && body.error.description ? (props.message = body.error.description, props.details = body.error, props) : (props.message = body.error || body.message || httpErrorMessage(res), props);\n}\nfunction isMutationError(body) {\n return isPlainObject(body) && isPlainObject(body.error) && body.error.type === \"mutationError\" && typeof body.error.description == \"string\";\n}\nfunction isPlainObject(obj) {\n return typeof obj == \"object\" && obj !== null && !Array.isArray(obj);\n}\nfunction httpErrorMessage(res) {\n const statusMessage = res.statusMessage ? ` ${res.statusMessage}` : \"\";\n return `${res.method}-request to ${res.url} resulted in HTTP ${res.statusCode}${statusMessage}`;\n}\nfunction stringifyBody(body, res) {\n return (res.headers[\"content-type\"] || \"\").toLowerCase().indexOf(\"application/json\") !== -1 ? JSON.stringify(body, null, 2) : body;\n}\nconst httpError = {\n onResponse: (res) => {\n if (res.statusCode >= 500)\n throw new ServerError(res);\n if (res.statusCode >= 400)\n throw new ClientError(res);\n return res;\n }\n}, printWarnings = {\n onResponse: (res) => {\n const warn = res.headers[\"x-sanity-warning\"];\n return (Array.isArray(warn) ? warn : [warn]).filter(Boolean).forEach((msg) => console.warn(msg)), res;\n }\n};\nfunction defineHttpRequest(envMiddleware2, {\n maxRetries = 5,\n retryDelay\n}) {\n const request = getIt([\n maxRetries > 0 ? retry({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n retryDelay,\n // This option is typed incorrectly in get-it.\n maxRetries,\n shouldRetry\n }) : {},\n ...envMiddleware2,\n printWarnings,\n jsonRequest(),\n jsonResponse(),\n progress(),\n httpError,\n observable({ implementation: Observable })\n ]);\n function httpRequest(options, requester = request) {\n return requester({ maxRedirects: 0, ...options });\n }\n return httpRequest.defaultRequester = request, httpRequest;\n}\nfunction shouldRetry(err, attempt, options) {\n const isSafe = options.method === \"GET\" || options.method === \"HEAD\", isQuery = (options.uri || options.url).startsWith(\"/data/query\"), isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503);\n return (isSafe || isQuery) && isRetriableResponse ? !0 : retry.shouldRetry(err, attempt, options);\n}\nfunction getSelection(sel) {\n if (typeof sel == \"string\")\n return { id: sel };\n if (Array.isArray(sel))\n return { query: \"*[_id in $ids]\", params: { ids: sel } };\n if (typeof sel == \"object\" && sel !== null && \"query\" in sel && typeof sel.query == \"string\")\n return \"params\" in sel && typeof sel.params == \"object\" && sel.params !== null ? { query: sel.query, params: sel.params } : { query: sel.query };\n const selectionOpts = [\n \"* Document ID (<docId>)\",\n \"* Array of document IDs\",\n \"* Object containing `query`\"\n ].join(`\n`);\n throw new Error(`Unknown selection - must be one of:\n\n${selectionOpts}`);\n}\nconst VALID_ASSET_TYPES = [\"image\", \"file\"], VALID_INSERT_LOCATIONS = [\"before\", \"after\", \"replace\"], dataset = (name) => {\n if (!/^(~[a-z0-9]{1}[-\\w]{0,63}|[a-z0-9]{1}[-\\w]{0,63})$/.test(name))\n throw new Error(\n \"Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters\"\n );\n}, projectId = (id) => {\n if (!/^[-a-z0-9]+$/i.test(id))\n throw new Error(\"`projectId` can only contain only a-z, 0-9 and dashes\");\n}, validateAssetType = (type) => {\n if (VALID_ASSET_TYPES.indexOf(type) === -1)\n throw new Error(`Invalid asset type: ${type}. Must be one of ${VALID_ASSET_TYPES.join(\", \")}`);\n}, validateObject = (op, val) => {\n if (val === null || typeof val != \"object\" || Array.isArray(val))\n throw new Error(`${op}() takes an object of properties`);\n}, validateDocumentId = (op, id) => {\n if (typeof id != \"string\" || !/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(id) || id.includes(\"..\"))\n throw new Error(`${op}(): \"${id}\" is not a valid document ID`);\n}, requireDocumentId = (op, doc) => {\n if (!doc._id)\n throw new Error(`${op}() requires that the document contains an ID (\"_id\" property)`);\n validateDocumentId(op, doc._id);\n}, validateInsert = (at, selector, items) => {\n const signature = \"insert(at, selector, items)\";\n if (VALID_INSERT_LOCATIONS.indexOf(at) === -1) {\n const valid = VALID_INSERT_LOCATIONS.map((loc) => `\"${loc}\"`).join(\", \");\n throw new Error(`${signature} takes an \"at\"-argument which is one of: ${valid}`);\n }\n if (typeof selector != \"string\")\n throw new Error(`${signature} takes a \"selector\"-argument which must be a string`);\n if (!Array.isArray(items))\n throw new Error(`${signature} takes an \"items\"-argument which must be an array`);\n}, hasDataset = (config) => {\n if (!config.dataset)\n throw new Error(\"`dataset` must be provided to perform queries\");\n return config.dataset || \"\";\n}, requestTag = (tag) => {\n if (typeof tag != \"string\" || !/^[a-z0-9._-]{1,75}$/i.test(tag))\n throw new Error(\n \"Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.\"\n );\n return tag;\n};\nvar __accessCheck$6 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$6 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value);\nclass BasePatch {\n constructor(selection, operations = {}) {\n this.selection = selection, this.operations = operations;\n }\n /**\n * Sets the given attributes to the document. Does NOT merge objects.\n * The operation is added to the current patch, ready to be commited by `commit()`\n *\n * @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \\{\"nested.prop\": \"value\"\\}\n */\n set(attrs) {\n return this._assign(\"set\", attrs);\n }\n /**\n * Sets the given attributes to the document if they are not currently set. Does NOT merge objects.\n * The operation is added to the current patch, ready to be commited by `commit()`\n *\n * @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \\{\"nested.prop\": \"value\"\\}\n */\n setIfMissing(attrs) {\n return this._assign(\"setIfMissing\", attrs);\n }\n /**\n * Performs a \"diff-match-patch\" operation on the string attributes provided.\n * The operation is added to the current patch, ready to be commited by `commit()`\n *\n * @param attrs - Attributes to perform operation on. To set a deep attribute, use JSONMatch, eg: \\{\"nested.prop\": \"dmp\"\\}\n */\n diffMatchPatch(attrs) {\n return validateObject(\"diffMatchPatch\", attrs), this._assign(\"diffMatchPatch\", attrs);\n }\n /**\n * Unsets the attribute paths provided.\n * The operation is added to the current patch, ready to be commited by `commit()`\n *\n * @param attrs - Attribute paths to unset.\n */\n unset(attrs) {\n if (!Array.isArray(attrs))\n throw new Error(\"unset(attrs) takes an array of attributes to unset, non-array given\");\n return this.operations = Object.assign({}, this.operations, { unset: attrs }), this;\n }\n /**\n * Increment a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.\n *\n * @param attrs - Object of attribute paths to increment, values representing the number to increment by.\n */\n inc(attrs) {\n return this._assign(\"inc\", attrs);\n }\n /**\n * Decrement a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.\n *\n * @param attrs - Object of attribute paths to decrement, values representing the number to decrement by.\n */\n dec(attrs) {\n return this._assign(\"dec\", attrs);\n }\n /**\n * Provides methods for modifying arrays, by inserting, appending and replacing elements via a JSONPath expression.\n *\n * @param at - Location to insert at, relative to the given selector, or 'replace' the matched path\n * @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key==\"abc123\"]`\n * @param items - Array of items to insert/replace\n */\n insert(at, selector, items) {\n return validateInsert(at, selector, items), this._assign(\"insert\", { [at]: selector, items });\n }\n /**\n * Append the given items to the array at the given JSONPath\n *\n * @param selector - Attribute/path to append to, eg `comments` or `person.hobbies`\n * @param items - Array of items to append to the array\n */\n append(selector, items) {\n return this.insert(\"after\", `${selector}[-1]`, items);\n }\n /**\n * Prepend the given items to the array at the given JSONPath\n *\n * @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies`\n * @param items - Array of items to prepend to the array\n */\n prepend(selector, items) {\n return this.insert(\"before\", `${selector}[0]`, items);\n }\n /**\n * Change the contents of an array by removing existing elements and/or adding new elements.\n *\n * @param selector - Attribute or JSONPath expression for array\n * @param start - Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x\n * @param deleteCount - An integer indicating the number of old array elements to remove.\n * @param items - The elements to add to the array, beginning at the start index. If you don't specify any elements, splice() will only remove elements from the array.\n */\n splice(selector, start, deleteCount, items) {\n const delAll = typeof deleteCount > \"u\" || deleteCount === -1, startIndex = start < 0 ? start - 1 : start, delCount = delAll ? -1 : Math.max(0, start + deleteCount), delRange = startIndex < 0 && delCount >= 0 ? \"\" : delCount, rangeSelector = `${selector}[${startIndex}:${delRange}]`;\n return this.insert(\"replace\", rangeSelector, items || []);\n }\n /**\n * Adds a revision clause, preventing the document from being patched if the `_rev` property does not match the given value\n *\n * @param rev - Revision to lock the patch to\n */\n ifRevisionId(rev) {\n return this.operations.ifRevisionID = rev, this;\n }\n /**\n * Return a plain JSON representation of the patch\n */\n serialize() {\n return { ...getSelection(this.selection), ...this.operations };\n }\n /**\n * Return a plain JSON representation of the patch\n */\n toJSON() {\n return this.serialize();\n }\n /**\n * Clears the patch of all operations\n */\n reset() {\n return this.operations = {}, this;\n }\n _assign(op, props, merge = !0) {\n return validateObject(op, props), this.operations = Object.assign({}, this.operations, {\n [op]: Object.assign({}, merge && this.operations[op] || {}, props)\n }), this;\n }\n _set(op, props) {\n return this._assign(op, props, !1);\n }\n}\nvar _client$5;\nconst _ObservablePatch = class _ObservablePatch2 extends BasePatch {\n constructor(selection, operations, client) {\n super(selection, operations), __privateAdd$6(this, _client$5, void 0), __privateSet$6(this, _client$5, client);\n }\n /**\n * Clones the patch\n */\n clone() {\n return new _ObservablePatch2(this.selection, { ...this.operations }, __privateGet$6(this, _client$5));\n }\n commit(options) {\n if (!__privateGet$6(this, _client$5))\n throw new Error(\n \"No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method\"\n );\n const returnFirst = typeof this.selection == \"string\", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);\n return __privateGet$6(this, _client$5).mutate({ patch: this.serialize() }, opts);\n }\n};\n_client$5 = /* @__PURE__ */ new WeakMap();\nlet ObservablePatch = _ObservablePatch;\nvar _client2$5;\nconst _Patch = class _Patch2 extends BasePatch {\n constructor(selection, operations, client) {\n super(selection, operations), __privateAdd$6(this, _client2$5, void 0), __privateSet$6(this, _client2$5, client);\n }\n /**\n * Clones the patch\n */\n clone() {\n return new _Patch2(this.selection, { ...this.operations }, __privateGet$6(this, _client2$5));\n }\n commit(options) {\n if (!__privateGet$6(this, _client2$5))\n throw new Error(\n \"No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method\"\n );\n const returnFirst = typeof this.selection == \"string\", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);\n return __privateGet$6(this, _client2$5).mutate({ patch: this.serialize() }, opts);\n }\n};\n_client2$5 = /* @__PURE__ */ new WeakMap();\nlet Patch = _Patch;\nvar __accessCheck$5 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$5 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value);\nconst defaultMutateOptions = { returnDocuments: !1 };\nclass BaseTransaction {\n constructor(operations = [], transactionId) {\n this.operations = operations, this.trxId = transactionId;\n }\n /**\n * Creates a new Sanity document. If `_id` is provided and already exists, the mutation will fail. If no `_id` is given, one will automatically be generated by the database.\n * The operation is added to the current transaction, ready to be commited by `commit()`\n *\n * @param doc - Document to create. Requires a `_type` property.\n */\n create(doc) {\n return validateObject(\"create\", doc), this._add({ create: doc });\n }\n /**\n * Creates a new Sanity document. If a document with the same `_id` already exists, the create operation will be ignored.\n * The operation is added to the current transaction, ready to be commited by `commit()`\n *\n * @param doc - Document to create if it does not already exist. Requires `_id` and `_type` properties.\n */\n createIfNotExists(doc) {\n const op = \"createIfNotExists\";\n return validateObject(op, doc), requireDocumentId(op, doc), this._add({ [op]: doc });\n }\n /**\n * Creates a new Sanity document, or replaces an existing one if the same `_id` is already used.\n * The operation is added to the current transaction, ready to be commited by `commit()`\n *\n * @param doc - Document to create or replace. Requires `_id` and `_type` properties.\n */\n createOrReplace(doc) {\n const op = \"createOrReplace\";\n return validateObject(op, doc), requireDocumentId(op, doc), this._add({ [op]: doc });\n }\n /**\n * Deletes the document with the given document ID\n * The operation is added to the current transaction, ready to be commited by `commit()`\n *\n * @param documentId - Document ID to delete\n */\n delete(documentId) {\n return validateDocumentId(\"delete\", documentId), this._add({ delete: { id: documentId } });\n }\n transactionId(id) {\n return id ? (this.trxId = id, this) : this.trxId;\n }\n /**\n * Return a plain JSON representation of the transaction\n */\n serialize() {\n return [...this.operations];\n }\n /**\n * Return a plain JSON representation of the transaction\n */\n toJSON() {\n return this.serialize();\n }\n /**\n * Clears the transaction of all operations\n */\n reset() {\n return this.operations = [], this;\n }\n _add(mut) {\n return this.operations.push(mut), this;\n }\n}\nvar _client$4;\nconst _Transaction = class _Transaction2 extends BaseTransaction {\n constructor(operations, client, transactionId) {\n super(operations, transactionId), __privateAdd$5(this, _client$4, void 0), __privateSet$5(this, _client$4, client);\n }\n /**\n * Clones the transaction\n */\n clone() {\n return new _Transaction2([...this.operations], __privateGet$5(this, _client$4), this.trxId);\n }\n commit(options) {\n if (!__privateGet$5(this, _client$4))\n throw new Error(\n \"No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method\"\n );\n return __privateGet$5(this, _client$4).mutate(\n this.serialize(),\n Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})\n );\n }\n patch(patchOrDocumentId, patchOps) {\n const isBuilder = typeof patchOps == \"function\";\n if (typeof patchOrDocumentId != \"string\" && patchOrDocumentId instanceof Patch)\n return this._add({ patch: patchOrDocumentId.serialize() });\n if (isBuilder) {\n const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$5(this, _client$4)));\n if (!(patch instanceof Patch))\n throw new Error(\"function passed to `patch()` must return the patch\");\n return this._add({ patch: patch.serialize() });\n }\n return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });\n }\n};\n_client$4 = /* @__PURE__ */ new WeakMap();\nlet Transaction = _Transaction;\nvar _client2$4;\nconst _ObservableTransaction = class _ObservableTransaction2 extends BaseTransaction {\n constructor(operations, client, transactionId) {\n super(operations, transactionId), __privateAdd$5(this, _client2$4, void 0), __privateSet$5(this, _client2$4, client);\n }\n /**\n * Clones the transaction\n */\n clone() {\n return new _ObservableTransaction2([...this.operations], __privateGet$5(this, _client2$4), this.trxId);\n }\n commit(options) {\n if (!__privateGet$5(this, _client2$4))\n throw new Error(\n \"No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method\"\n );\n return __privateGet$5(this, _client2$4).mutate(\n this.serialize(),\n Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})\n );\n }\n patch(patchOrDocumentId, patchOps) {\n const isBuilder = typeof patchOps == \"function\";\n if (typeof patchOrDocumentId != \"string\" && patchOrDocumentId instanceof ObservablePatch)\n return this._add({ patch: patchOrDocumentId.serialize() });\n if (isBuilder) {\n const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$5(this, _client2$4)));\n if (!(patch instanceof ObservablePatch))\n throw new Error(\"function passed to `patch()` must return the patch\");\n return this._add({ patch: patch.serialize() });\n }\n return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });\n }\n};\n_client2$4 = /* @__PURE__ */ new WeakMap();\nlet ObservableTransaction = _ObservableTransaction;\nconst BASE_URL = \"https://www.sanity.io/help/\";\nfunction generateHelpUrl(slug) {\n return BASE_URL + slug;\n}\nfunction once(fn) {\n let didCall = !1, returnValue;\n return (...args) => (didCall || (returnValue = fn(...args), didCall = !0), returnValue);\n}\nconst createWarningPrinter = (message) => (\n // eslint-disable-next-line no-console\n once((...args) => console.warn(message.join(\" \"), ...args))\n), printCdnWarning = createWarningPrinter([\n \"Since you haven't set a value for `useCdn`, we will deliver content using our\",\n \"global, edge-cached API-CDN. If you wish to have content delivered faster, set\",\n \"`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API.\"\n]), printCdnPreviewDraftsWarning = createWarningPrinter([\n \"The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.\",\n \"The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning.\"\n]), printBrowserTokenWarning = createWarningPrinter([\n \"You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.\",\n `See ${generateHelpUrl(\n \"js-client-browser-token\"\n )} for more information and how to hide this warning.`\n]), printNoApiVersionSpecifiedWarning = createWarningPrinter([\n \"Using the Sanity client without specifying an API version is deprecated.\",\n `See ${generateHelpUrl(\"js-client-api-version\")}`\n]), printNoDefaultExport = createWarningPrinter([\n \"The default export of @sanity/client has been deprecated. Use the named export `createClient` instead.\"\n]), defaultCdnHost = \"apicdn.sanity.io\", defaultConfig = {\n apiHost: \"https://api.sanity.io\",\n apiVersion: \"1\",\n useProjectHostname: !0,\n stega: { enabled: !1 }\n}, LOCALHOSTS = [\"localhost\", \"127.0.0.1\", \"0.0.0.0\"], isLocal = (host) => LOCALHOSTS.indexOf(host) !== -1;\nfunction validateApiVersion(apiVersion) {\n if (apiVersion === \"1\" || apiVersion === \"X\")\n return;\n const apiDate = new Date(apiVersion);\n if (!(/^\\d{4}-\\d{2}-\\d{2}$/.test(apiVersion) && apiDate instanceof Date && apiDate.getTime() > 0))\n throw new Error(\"Invalid API version string, expected `1` or date in format `YYYY-MM-DD`\");\n}\nconst validateApiPerspective = function(perspective) {\n switch (perspective) {\n case \"previewDrafts\":\n case \"published\":\n case \"raw\":\n return;\n default:\n throw new TypeError(\n \"Invalid API perspective string, expected `published`, `previewDrafts` or `raw`\"\n );\n }\n}, initConfig = (config, prevConfig) => {\n const specifiedConfig = {\n ...prevConfig,\n ...config,\n stega: {\n ...typeof prevConfig.stega == \"boolean\" ? { enabled: prevConfig.stega } : prevConfig.stega || defaultConfig.stega,\n ...typeof config.stega == \"boolean\" ? { enabled: config.stega } : config.stega || {}\n }\n };\n specifiedConfig.apiVersion || printNoApiVersionSpecifiedWarning();\n const newConfig = {\n ...defaultConfig,\n ...specifiedConfig\n }, projectBased = newConfig.useProjectHostname;\n if (typeof Promise > \"u\") {\n const helpUrl = generateHelpUrl(\"js-client-promise-polyfill\");\n throw new Error(`No native Promise-implementation found, polyfill needed - see ${helpUrl}`);\n }\n if (projectBased && !newConfig.projectId)\n throw new Error(\"Configuration must contain `projectId`\");\n if (typeof newConfig.perspective == \"string\" && validateApiPerspective(newConfig.perspective), \"encodeSourceMap\" in newConfig)\n throw new Error(\n \"It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?\"\n );\n if (\"encodeSourceMapAtPath\" in newConfig)\n throw new Error(\n \"It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?\"\n );\n if (typeof newConfig.stega.enabled != \"boolean\")\n throw new Error(`stega.enabled must be a boolean, received ${newConfig.stega.enabled}`);\n if (newConfig.stega.enabled && newConfig.stega.studioUrl === void 0)\n throw new Error(\"stega.studioUrl must be defined when stega.enabled is true\");\n if (newConfig.stega.enabled && typeof newConfig.stega.studioUrl != \"string\" && typeof newConfig.stega.studioUrl != \"function\")\n throw new Error(\n `stega.studioUrl must be a string or a function, received ${newConfig.stega.studioUrl}`\n );\n const isBrowser = typeof window < \"u\" && window.location && window.location.hostname, isLocalhost = isBrowser && isLocal(window.location.hostname);\n isBrowser && isLocalhost && newConfig.token && newConfig.ignoreBrowserTokenWarning !== !0 ? printBrowserTokenWarning() : typeof newConfig.useCdn > \"u\" && printCdnWarning(), projectBased && projectId(newConfig.projectId), newConfig.dataset && dataset(newConfig.dataset), \"requestTagPrefix\" in newConfig && (newConfig.requestTagPrefix = newConfig.requestTagPrefix ? requestTag(newConfig.requestTagPrefix).replace(/\\.+$/, \"\") : void 0), newConfig.apiVersion = `${newConfig.apiVersion}`.replace(/^v/, \"\"), newConfig.isDefaultApi = newConfig.apiHost === defaultConfig.apiHost, newConfig.useCdn = newConfig.useCdn !== !1 && !newConfig.withCredentials, validateApiVersion(newConfig.apiVersion);\n const hostParts = newConfig.apiHost.split(\"://\", 2), protocol = hostParts[0], host = hostParts[1], cdnHost = newConfig.isDefaultApi ? defaultCdnHost : host;\n return newConfig.useProjectHostname ? (newConfig.url = `${protocol}://${newConfig.projectId}.${host}/v${newConfig.apiVersion}`, newConfig.cdnUrl = `${protocol}://${newConfig.projectId}.${cdnHost}/v${newConfig.apiVersion}`) : (newConfig.url = `${newConfig.apiHost}/v${newConfig.apiVersion}`, newConfig.cdnUrl = newConfig.url), newConfig;\n}, projectHeader = \"X-Sanity-Project-ID\";\nfunction requestOptions(config, overrides = {}) {\n const headers = {}, token = overrides.token || config.token;\n token && (headers.Authorization = `Bearer ${token}`), !overrides.useGlobalApi && !config.useProjectHostname && config.projectId && (headers[projectHeader] = config.projectId);\n const withCredentials = !!(typeof overrides.withCredentials > \"u\" ? config.token || config.withCredentials : overrides.withCredentials), timeout = typeof overrides.timeout > \"u\" ? config.timeout : overrides.timeout;\n return Object.assign({}, overrides, {\n headers: Object.assign({}, headers, overrides.headers || {}),\n timeout: typeof timeout > \"u\" ? 5 * 60 * 1e3 : timeout,\n proxy: overrides.proxy || config.proxy,\n json: !0,\n withCredentials,\n fetch: typeof overrides.fetch == \"object\" && typeof config.fetch == \"object\" ? { ...config.fetch, ...overrides.fetch } : overrides.fetch || config.fetch\n });\n}\nvar s = { 0: 8203, 1: 8204, 2: 8205, 3: 8290, 4: 8291, 5: 8288, 6: 65279, 7: 8289, 8: 119155, 9: 119156, a: 119157, b: 119158, c: 119159, d: 119160, e: 119161, f: 119162 }, c = { 0: 8203, 1: 8204, 2: 8205, 3: 65279 }, d = new Array(4).fill(String.fromCodePoint(c[0])).join(\"\");\nfunction E(t) {\n let e = JSON.stringify(t);\n return `${d}${Array.from(e).map((r) => {\n let n = r.charCodeAt(0);\n if (n > 255)\n throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);\n return Array.from(n.toString(4).padStart(4, \"0\")).map((o) => String.fromCodePoint(c[o])).join(\"\");\n }).join(\"\")}`;\n}\nfunction I(t) {\n return Number.isNaN(Number(t)) ? !!Date.parse(t) : !1;\n}\nfunction x(t) {\n try {\n new URL(t, t.startsWith(\"/\") ? \"https://acme.com\" : void 0);\n } catch {\n return !1;\n }\n return !0;\n}\nfunction b(t, e, r = \"auto\") {\n return r === !0 || r === \"auto\" && (I(t) || x(t)) ? t : `${t}${E(e)}`;\n}\nObject.fromEntries(Object.entries(c).map((t) => t.reverse()));\nObject.fromEntries(Object.entries(s).map((t) => t.reverse()));\nvar S = `${Object.values(s).map((t) => `\\\\u{${t.toString(16)}}`).join(\"\")}`, f = new RegExp(`[${S}]{4,}`, \"gu\");\nfunction X(t) {\n var e;\n return { cleaned: t.replace(f, \"\"), encoded: ((e = t.match(f)) == null ? void 0 : e[0]) || \"\" };\n}\nfunction vercelStegaCleanAll(result) {\n try {\n return JSON.parse(\n JSON.stringify(result, (key, value) => typeof value != \"string\" ? value : X(value).cleaned)\n );\n } catch {\n return result;\n }\n}\nconst encodeQueryString = ({\n query,\n params = {},\n options = {}\n}) => {\n const searchParams = new URLSearchParams(), { tag, returnQuery, ...opts } = options;\n tag && searchParams.append(\"tag\", tag), searchParams.append(\"query\", query);\n for (const [key, value] of Object.entries(params))\n searchParams.append(`$${key}`, JSON.stringify(value));\n for (const [key, value] of Object.entries(opts))\n value && searchParams.append(key, `${value}`);\n return returnQuery === !1 && searchParams.append(\"returnQuery\", \"false\"), `?${searchParams}`;\n}, excludeFalsey = (param, defValue) => param === !1 ? void 0 : typeof param > \"u\" ? defValue : param, getMutationQuery = (options = {}) => ({\n dryRun: options.dryRun,\n returnIds: !0,\n returnDocuments: excludeFalsey(options.returnDocuments, !0),\n visibility: options.visibility || \"sync\",\n autoGenerateArrayKeys: options.autoGenerateArrayKeys,\n skipCrossDatasetReferenceValidation: options.skipCrossDatasetReferenceValidation\n}), isResponse = (event) => event.type === \"response\", getBody = (event) => event.body, indexBy = (docs, attr) => docs.reduce((indexed, doc) => (indexed[attr(doc)] = doc, indexed), /* @__PURE__ */ Object.create(null)), getQuerySizeLimit = 11264;\nfunction _fetch(client, httpRequest, _stega, query, _params = {}, options = {}) {\n const stega = \"stega\" in options ? {\n ..._stega || {},\n ...typeof options.stega == \"boolean\" ? { enabled: options.stega } : options.stega || {}\n } : _stega, params = stega.enabled ? vercelStegaCleanAll(_params) : _params, mapResponse = options.filterResponse === !1 ? (res) => res : (res) => res.result, { cache, next, ...opts } = {\n // Opt out of setting a `signal` on an internal `fetch` if one isn't provided.\n // This is necessary in React Server Components to avoid opting out of Request Memoization.\n useAbortSignal: typeof options.signal < \"u\",\n // Set `resultSourceMap' when stega is enabled, as it's required for encoding.\n resultSourceMap: stega.enabled ? \"withKeyArraySelector\" : options.resultSourceMap,\n ...options,\n // Default to not returning the query, unless `filterResponse` is `false`,\n // or `returnQuery` is explicitly set. `true` is the default in Content Lake, so skip if truthy\n returnQuery: options.filterResponse === !1 && options.returnQuery !== !1\n }, reqOpts = typeof cache < \"u\" || typeof next < \"u\" ? { ...opts, fetch: { cache, next } } : opts, $request = _dataRequest(client, httpRequest, \"query\", { query, params }, reqOpts);\n return stega.enabled ? $request.pipe(\n combineLatestWith(\n from(\n import(\"./stegaEncodeSourceMap.js\").then(function(n) {\n return n.a;\n }).then(\n ({ stegaEncodeSourceMap }) => stegaEncodeSourceMap\n )\n )\n ),\n map(\n ([res, stegaEncodeSourceMap]) => {\n const result = stegaEncodeSourceMap(res.result, res.resultSourceMap, stega);\n return mapResponse({ ...res, result });\n }\n )\n ) : $request.pipe(map(mapResponse));\n}\nfunction _getDocument(client, httpRequest, id, opts = {}) {\n const options = { uri: _getDataUrl(client, \"doc\", id), json: !0, tag: opts.tag };\n return _requestObservable(client, httpRequest, options).pipe(\n filter(isResponse),\n map((event) => event.body.documents && event.body.documents[0])\n );\n}\nfunction _getDocuments(client, httpRequest, ids, opts = {}) {\n const options = { uri: _getDataUrl(client, \"doc\", ids.join(\",\")), json: !0, tag: opts.tag };\n return _requestObservable(client, httpRequest, options).pipe(\n filter(isResponse),\n map((event) => {\n const indexed = indexBy(event.body.documents || [], (doc) => doc._id);\n return ids.map((id) => indexed[id] || null);\n })\n );\n}\nfunction _createIfNotExists(client, httpRequest, doc, options) {\n return requireDocumentId(\"createIfNotExists\", doc), _create(client, httpRequest, doc, \"createIfNotExists\", options);\n}\nfunction _createOrReplace(client, httpRequest, doc, options) {\n return requireDocumentId(\"createOrReplace\", doc), _create(client, httpRequest, doc, \"createOrReplace\", options);\n}\nfunction _delete(client, httpRequest, selection, options) {\n return _dataRequest(\n client,\n httpRequest,\n \"mutate\",\n { mutations: [{ delete: getSelection(selection) }] },\n options\n );\n}\nfunction _mutate(client, httpRequest, mutations, options) {\n let mut;\n mutations instanceof Patch || mutations instanceof ObservablePatch ? mut = { patch: mutations.serialize() } : mutations instanceof Transaction || mutations instanceof ObservableTransaction ? mut = mutations.serialize() : mut = mutations;\n const muts = Array.isArray(mut) ? mut : [mut], transactionId = options && options.transactionId || void 0;\n return _dataRequest(client, httpRequest, \"mutate\", { mutations: muts, transactionId }, options);\n}\nfunction _dataRequest(client, httpRequest, endpoint, body, options = {}) {\n const isMutation = endpoint === \"mutate\", isQuery = endpoint === \"query\", strQuery = isMutation ? \"\" : encodeQueryString(body), useGet = !isMutation && strQuery.length < getQuerySizeLimit, stringQuery = useGet ? strQuery : \"\", returnFirst = options.returnFirst, { timeout, token, tag, headers, returnQuery } = options, uri = _getDataUrl(client, endpoint, stringQuery), reqOptions = {\n method: useGet ? \"GET\" : \"POST\",\n uri,\n json: !0,\n body: useGet ? void 0 : body,\n query: isMutation && getMutationQuery(options),\n timeout,\n headers,\n token,\n tag,\n returnQuery,\n perspective: options.perspective,\n resultSourceMap: options.resultSourceMap,\n canUseCdn: isQuery,\n signal: options.signal,\n fetch: options.fetch,\n useAbortSignal: options.useAbortSignal,\n useCdn: options.useCdn\n };\n return _requestObservable(client, httpRequest, reqOptions).pipe(\n filter(isResponse),\n map(getBody),\n map((res) => {\n if (!isMutation)\n return res;\n const results = res.results || [];\n if (options.returnDocuments)\n return returnFirst ? results[0] && results[0].document : results.map((mut) => mut.document);\n const key = returnFirst ? \"documentId\" : \"documentIds\", ids = returnFirst ? results[0] && results[0].id : results.map((mut) => mut.id);\n return {\n transactionId: res.transactionId,\n results,\n [key]: ids\n };\n })\n );\n}\nfunction _create(client, httpRequest, doc, op, options = {}) {\n const mutation = { [op]: doc }, opts = Object.assign({ returnFirst: !0, returnDocuments: !0 }, options);\n return _dataRequest(client, httpRequest, \"mutate\", { mutations: [mutation] }, opts);\n}\nfunction _requestObservable(client, httpRequest, options) {\n var _a, _b;\n const uri = options.url || options.uri, config = client.config(), canUseCdn = typeof options.canUseCdn > \"u\" ? [\"GET\", \"HEAD\"].indexOf(options.method || \"GET\") >= 0 && uri.indexOf(\"/data/\") === 0 : options.canUseCdn;\n let useCdn = ((_a = options.useCdn) != null ? _a : config.useCdn) && canUseCdn;\n const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(\".\") : options.tag || config.requestTagPrefix;\n if (tag && options.tag !== null && (options.query = { tag: requestTag(tag), ...options.query }), [\"GET\", \"HEAD\", \"POST\"].indexOf(options.method || \"GET\") >= 0 && uri.indexOf(\"/data/query/\") === 0) {\n const resultSourceMap = (_b = options.resultSourceMap) != null ? _b : config.resultSourceMap;\n resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });\n const perspective = options.perspective || config.perspective;\n typeof perspective == \"string\" && perspective !== \"raw\" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === \"previewDrafts\" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.returnQuery === !1 && (options.query = { returnQuery: \"false\", ...options.query });\n }\n const reqOptions = requestOptions(\n config,\n Object.assign({}, options, {\n url: _getUrl(client, uri, useCdn)\n })\n ), request = new Observable(\n (subscriber) => httpRequest(reqOptions, config.requester).subscribe(subscriber)\n );\n return options.signal ? request.pipe(_withAbortSignal(options.signal)) : request;\n}\nfunction _request(client, httpRequest, options) {\n return _requestObservable(client, httpRequest, options).pipe(\n filter((event) => event.type === \"response\"),\n map((event) => event.body)\n );\n}\nfunction _getDataUrl(client, operation, path) {\n const config = client.config(), catalog = hasDataset(config), baseUri = `/${operation}/${catalog}`;\n return `/data${path ? `${baseUri}/${path}` : baseUri}`.replace(/\\/($|\\?)/, \"$1\");\n}\nfunction _getUrl(client, uri, canUseCdn = !1) {\n const { url, cdnUrl } = client.config();\n return `${canUseCdn ? cdnUrl : url}/${uri.replace(/^\\//, \"\")}`;\n}\nfunction _withAbortSignal(signal) {\n return (input) => new Observable((observer) => {\n const abort = () => observer.error(_createAbortError(signal));\n if (signal && signal.aborted) {\n abort();\n return;\n }\n const subscription = input.subscribe(observer);\n return signal.addEventListener(\"abort\", abort), () => {\n signal.removeEventListener(\"abort\", abort), subscription.unsubscribe();\n };\n });\n}\nconst isDomExceptionSupported = !!globalThis.DOMException;\nfunction _createAbortError(signal) {\n var _a, _b;\n if (isDomExceptionSupported)\n return new DOMException((_a = signal == null ? void 0 : signal.reason) != null ? _a : \"The operation was aborted.\", \"AbortError\");\n const error = new Error((_b = signal == null ? void 0 : signal.reason) != null ? _b : \"The operation was aborted.\");\n return error.name = \"AbortError\", error;\n}\nvar __accessCheck$4 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$4 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _client$3, _httpRequest$4;\nclass ObservableAssetsClient {\n constructor(client, httpRequest) {\n __privateAdd$4(this, _client$3, void 0), __privateAdd$4(this, _httpRequest$4, void 0), __privateSet$4(this, _client$3, client), __privateSet$4(this, _httpRequest$4, httpRequest);\n }\n upload(assetType, body, options) {\n return _upload(__privateGet$4(this, _client$3), __privateGet$4(this, _httpRequest$4), assetType, body, options);\n }\n}\n_client$3 = /* @__PURE__ */ new WeakMap(), _httpRequest$4 = /* @__PURE__ */ new WeakMap();\nvar _client2$3, _httpRequest2$4;\nclass AssetsClient {\n constructor(client, httpRequest) {\n __privateAdd$4(this, _client2$3, void 0), __privateAdd$4(this, _httpRequest2$4, void 0), __privateSet$4(this, _client2$3, client), __privateSet$4(this, _httpRequest2$4, httpRequest);\n }\n upload(assetType, body, options) {\n const observable2 = _upload(__privateGet$4(this, _client2$3), __privateGet$4(this, _httpRequest2$4), assetType, body, options);\n return lastValueFrom(\n observable2.pipe(\n filter((event) => event.type === \"response\"),\n map(\n (event) => event.body.document\n )\n )\n );\n }\n}\n_client2$3 = /* @__PURE__ */ new WeakMap(), _httpRequest2$4 = /* @__PURE__ */ new WeakMap();\nfunction _upload(client, httpRequest, assetType, body, opts = {}) {\n validateAssetType(assetType);\n let meta = opts.extract || void 0;\n meta && !meta.length && (meta = [\"none\"]);\n const dataset2 = hasDataset(client.config()), assetEndpoint = assetType === \"image\" ? \"images\" : \"files\", options = optionsFromFile(opts, body), { tag, label, title, description, creditLine, filename, source } = options, query = {\n label,\n title,\n description,\n filename,\n meta,\n creditLine\n };\n return source && (query.sourceId = source.id, query.sourceName = source.name, query.sourceUrl = source.url), _requestObservable(client, httpRequest, {\n tag,\n method: \"POST\",\n timeout: options.timeout || 0,\n uri: `/assets/${assetEndpoint}/${dataset2}`,\n headers: options.contentType ? { \"Content-Type\": options.contentType } : {},\n query,\n body\n });\n}\nfunction optionsFromFile(opts, file) {\n return typeof File > \"u\" || !(file instanceof File) ? opts : Object.assign(\n {\n filename: opts.preserveFilename === !1 ? void 0 : file.name,\n contentType: file.type\n },\n opts\n );\n}\nvar defaults = (obj, defaults2) => Object.keys(defaults2).concat(Object.keys(obj)).reduce((target, prop) => (target[prop] = typeof obj[prop] > \"u\" ? defaults2[prop] : obj[prop], target), {});\nconst pick = (obj, props) => props.reduce((selection, prop) => (typeof obj[prop] > \"u\" || (selection[prop] = obj[prop]), selection), {}), MAX_URL_LENGTH = 14800, possibleOptions = [\n \"includePreviousRevision\",\n \"includeResult\",\n \"visibility\",\n \"effectFormat\",\n \"tag\"\n], defaultOptions = {\n includeResult: !0\n};\nfunction _listen(query, params, opts = {}) {\n const { url, token, withCredentials, requestTagPrefix } = this.config(), tag = opts.tag && requestTagPrefix ? [requestTagPrefix, opts.tag].join(\".\") : opts.tag, options = { ...defaults(opts, defaultOptions), tag }, listenOpts = pick(options, possibleOptions), qs = encodeQueryString({ query, params, options: { tag, ...listenOpts } }), uri = `${url}${_getDataUrl(this, \"listen\", qs)}`;\n if (uri.length > MAX_URL_LENGTH)\n return new Observable((observer) => observer.error(new Error(\"Query too large for listener\")));\n const listenFor = options.events ? options.events : [\"mutation\"], shouldEmitReconnect = listenFor.indexOf(\"reconnect\") !== -1, esOptions = {};\n return (token || withCredentials) && (esOptions.withCredentials = !0), token && (esOptions.headers = {\n Authorization: `Bearer ${token}`\n }), new Observable((observer) => {\n let es;\n getEventSource().then((eventSource) => {\n es = eventSource;\n }).catch((reason) => {\n observer.error(reason), stop();\n });\n let reconnectTimer, stopped = !1;\n function onError() {\n stopped || (emitReconnect(), !stopped && es.readyState === es.CLOSED && (unsubscribe(), clearTimeout(reconnectTimer), reconnectTimer = setTimeout(open, 100)));\n }\n function onChannelError(err) {\n observer.error(cooerceError(err));\n }\n function onMessage(evt) {\n const event = parseEvent(evt);\n return event instanceof Error ? observer.error(event) : observer.next(event);\n }\n function onDisconnect() {\n stopped = !0, unsubscribe(), observer.complete();\n }\n function unsubscribe() {\n es && (es.removeEventListener(\"error\", onError), es.removeEventListener(\"channelError\", onChannelError), es.removeEventListener(\"disconnect\", onDisconnect), listenFor.forEach((type) => es.removeEventListener(type, onMessage)), es.close());\n }\n function emitReconnect() {\n shouldEmitReconnect && observer.next({ type: \"reconnect\" });\n }\n async function getEventSource() {\n const { default: EventSource } = await import(\"@sanity/eventsource\"), evs = new EventSource(uri, esOptions);\n return evs.addEventListener(\"error\", onError), evs.addEventListener(\"channelError\", onChannelError), evs.addEventListener(\"disconnect\", onDisconnect), listenFor.forEach((type) => evs.addEventListener(type, onMessage)), evs;\n }\n function open() {\n getEventSource().then((eventSource) => {\n es = eventSource;\n }).catch((reason) => {\n observer.error(reason), stop();\n });\n }\n function stop() {\n stopped = !0, unsubscribe();\n }\n return stop;\n });\n}\nfunction parseEvent(event) {\n try {\n const data = event.data && JSON.parse(event.data) || {};\n return Object.assign({ type: event.type }, data);\n } catch (err) {\n return err;\n }\n}\nfunction cooerceError(err) {\n if (err instanceof Error)\n return err;\n const evt = parseEvent(err);\n return evt instanceof Error ? evt : new Error(extractErrorMessage(evt));\n}\nfunction extractErrorMessage(err) {\n return err.error ? err.error.description ? err.error.description : typeof err.error == \"string\" ? err.error : JSON.stringify(err.error, null, 2) : err.message || \"Unknown listener error\";\n}\nvar __accessCheck$3 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$3 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _client$2, _httpRequest$3;\nclass ObservableDatasetsClient {\n constructor(client, httpRequest) {\n __privateAdd$3(this, _client$2, void 0), __privateAdd$3(this, _httpRequest$3, void 0), __privateSet$3(this, _client$2, client), __privateSet$3(this, _httpRequest$3, httpRequest);\n }\n /**\n * Create a new dataset with the given name\n *\n * @param name - Name of the dataset to create\n * @param options - Options for the dataset\n */\n create(name, options) {\n return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), \"PUT\", name, options);\n }\n /**\n * Edit a dataset with the given name\n *\n * @param name - Name of the dataset to edit\n * @param options - New options for the dataset\n */\n edit(name, options) {\n return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), \"PATCH\", name, options);\n }\n /**\n * Delete a dataset with the given name\n *\n * @param name - Name of the dataset to delete\n */\n delete(name) {\n return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), \"DELETE\", name);\n }\n /**\n * Fetch a list of datasets for the configured project\n */\n list() {\n return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {\n uri: \"/datasets\",\n tag: null\n });\n }\n}\n_client$2 = /* @__PURE__ */ new WeakMap(), _httpRequest$3 = /* @__PURE__ */ new WeakMap();\nvar _client2$2, _httpRequest2$3;\nclass DatasetsClient {\n constructor(client, httpRequest) {\n __privateAdd$3(this, _client2$2, void 0), __privateAdd$3(this, _httpRequest2$3, void 0), __privateSet$3(this, _client2$2, client), __privateSet$3(this, _httpRequest2$3, httpRequest);\n }\n /**\n * Create a new dataset with the given name\n *\n * @param name - Name of the dataset to create\n * @param options - Options for the dataset\n */\n create(name, options) {\n return lastValueFrom(\n _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), \"PUT\", name, options)\n );\n }\n /**\n * Edit a dataset with the given name\n *\n * @param name - Name of the dataset to edit\n * @param options - New options for the dataset\n */\n edit(name, options) {\n return lastValueFrom(\n _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), \"PATCH\", name, options)\n );\n }\n /**\n * Delete a dataset with the given name\n *\n * @param name - Name of the dataset to delete\n */\n delete(name) {\n return lastValueFrom(_modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), \"DELETE\", name));\n }\n /**\n * Fetch a list of datasets for the configured project\n */\n list() {\n return lastValueFrom(\n _request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), { uri: \"/datasets\", tag: null })\n );\n }\n}\n_client2$2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$3 = /* @__PURE__ */ new WeakMap();\nfunction _modify(client, httpRequest, method, name, options) {\n return dataset(name), _request(client, httpRequest, {\n method,\n uri: `/datasets/${name}`,\n body: options,\n tag: null\n });\n}\nvar __accessCheck$2 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$2 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _client$1, _httpRequest$2;\nclass ObservableProjectsClient {\n constructor(client, httpRequest) {\n __privateAdd$2(this, _client$1, void 0), __privateAdd$2(this, _httpRequest$2, void 0), __privateSet$2(this, _client$1, client), __privateSet$2(this, _httpRequest$2, httpRequest);\n }\n list(options) {\n const uri = (options == null ? void 0 : options.includeMembers) === !1 ? \"/projects?includeMembers=false\" : \"/projects\";\n return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri });\n }\n /**\n * Fetch a project by project ID\n *\n * @param projectId - ID of the project to fetch\n */\n getById(projectId2) {\n return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri: `/projects/${projectId2}` });\n }\n}\n_client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */ new WeakMap();\nvar _client2$1, _httpRequest2$2;\nclass ProjectsClient {\n constructor(client, httpRequest) {\n __privateAdd$2(this, _client2$1, void 0), __privateAdd$2(this, _httpRequest2$2, void 0), __privateSet$2(this, _client2$1, client), __privateSet$2(this, _httpRequest2$2, httpRequest);\n }\n list(options) {\n const uri = (options == null ? void 0 : options.includeMembers) === !1 ? \"/projects?includeMembers=false\" : \"/projects\";\n return lastValueFrom(_request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri }));\n }\n /**\n * Fetch a project by project ID\n *\n * @param projectId - ID of the project to fetch\n */\n getById(projectId2) {\n return lastValueFrom(\n _request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri: `/projects/${projectId2}` })\n );\n }\n}\n_client2$1 = /* @__PURE__ */ new WeakMap(), _httpRequest2$2 = /* @__PURE__ */ new WeakMap();\nvar __accessCheck$1 = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$1 = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _client, _httpRequest$1;\nclass ObservableUsersClient {\n constructor(client, httpRequest) {\n __privateAdd$1(this, _client, void 0), __privateAdd$1(this, _httpRequest$1, void 0), __privateSet$1(this, _client, client), __privateSet$1(this, _httpRequest$1, httpRequest);\n }\n /**\n * Fetch a user by user ID\n *\n * @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.\n */\n getById(id) {\n return _request(\n __privateGet$1(this, _client),\n __privateGet$1(this, _httpRequest$1),\n { uri: `/users/${id}` }\n );\n }\n}\n_client = /* @__PURE__ */ new WeakMap(), _httpRequest$1 = /* @__PURE__ */ new WeakMap();\nvar _client2, _httpRequest2$1;\nclass UsersClient {\n constructor(client, httpRequest) {\n __privateAdd$1(this, _client2, void 0), __privateAdd$1(this, _httpRequest2$1, void 0), __privateSet$1(this, _client2, client), __privateSet$1(this, _httpRequest2$1, httpRequest);\n }\n /**\n * Fetch a user by user ID\n *\n * @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.\n */\n getById(id) {\n return lastValueFrom(\n _request(__privateGet$1(this, _client2), __privateGet$1(this, _httpRequest2$1), {\n uri: `/users/${id}`\n })\n );\n }\n}\n_client2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$1 = /* @__PURE__ */ new WeakMap();\nvar __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n}, __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n}, __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value), _clientConfig, _httpRequest;\nconst _ObservableSanityClient = class _ObservableSanityClient2 {\n constructor(httpRequest, config = defaultConfig) {\n __privateAdd(this, _clientConfig, void 0), __privateAdd(this, _httpRequest, void 0), this.listen = _listen, this.config(config), __privateSet(this, _httpRequest, httpRequest), this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest)), this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest)), this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest)), this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));\n }\n /**\n * Clone the client - returns a new instance\n */\n clone() {\n return new _ObservableSanityClient2(__privateGet(this, _httpRequest), this.config());\n }\n config(newConfig) {\n if (newConfig === void 0)\n return { ...__privateGet(this, _clientConfig) };\n if (__privateGet(this, _clientConfig) && __privateGet(this, _clientConfig).allowReconfigure === !1)\n throw new Error(\n \"Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client\"\n );\n return __privateSet(this, _clientConfig, initConfig(newConfig, __privateGet(this, _clientConfig) || {})), this;\n }\n /**\n * Clone the client with a new (partial) configuration.\n *\n * @param newConfig - New client configuration properties, shallowly merged with existing configuration\n */\n withConfig(newConfig) {\n const thisConfig = this.config();\n return new _ObservableSanityClient2(__privateGet(this, _httpRequest), {\n ...thisConfig,\n ...newConfig,\n stega: {\n ...thisConfig.stega || {},\n ...typeof (newConfig == null ? void 0 : newConfig.stega) == \"boolean\" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}\n }\n });\n }\n fetch(query, params, options) {\n return _fetch(\n this,\n __privateGet(this, _httpRequest),\n __privateGet(this, _clientConfig).stega,\n query,\n params,\n options\n );\n }\n /**\n * Fetch a single document with the given ID.\n *\n * @param id - Document ID to fetch\n * @param options - Request options\n */\n getDocument(id, options) {\n return _getDocument(this, __privateGet(this, _httpRequest), id, options);\n }\n /**\n * Fetch multiple documents in one request.\n * Should be used sparingly - performing a query is usually a better option.\n * The order/position of documents is preserved based on the original array of IDs.\n * If any of the documents are missing, they will be replaced by a `null` entry in the returned array\n *\n * @param ids - Document IDs to fetch\n * @param options - Request options\n */\n getDocuments(ids, options) {\n return _getDocuments(this, __privateGet(this, _httpRequest), ids, options);\n }\n create(document, options) {\n return _create(this, __privateGet(this, _httpRequest), document, \"create\", options);\n }\n createIfNotExists(document, options) {\n return _createIfNotExists(this, __privateGet(this, _httpRequest), document, options);\n }\n createOrReplace(document, options) {\n return _createOrReplace(this, __privateGet(this, _httpRequest), document, options);\n }\n delete(selection, options) {\n return _delete(this, __privateGet(this, _httpRequest), selection, options);\n }\n mutate(operations, options) {\n return _mutate(this, __privateGet(this, _httpRequest), operations, options);\n }\n /**\n * Create a new buildable patch of operations to perform\n *\n * @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch\n * @param operations - Optional object of patch operations to initialize the patch instance with\n * @returns Patch instance - call `.commit()` to perform the operations defined\n */\n patch(selection, operations) {\n return new ObservablePatch(selection, operations, this);\n }\n /**\n * Create a new transaction of mutations\n *\n * @param operations - Optional array of mutation operations to initialize the transaction instance with\n */\n transaction(operations) {\n return new ObservableTransaction(operations, this);\n }\n /**\n * Perform an HTTP request against the Sanity API\n *\n * @param options - Request options\n */\n request(options) {\n return _request(this, __privateGet(this, _httpRequest), options);\n }\n /**\n * Get a Sanity API URL for the URI provided\n *\n * @param uri - URI/path to build URL for\n * @param canUseCdn - Whether or not to allow using the API CDN for this route\n */\n getUrl(uri, canUseCdn) {\n return _getUrl(this, uri, canUseCdn);\n }\n /**\n * Get a Sanity API URL for the data operation and path provided\n *\n * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)\n * @param path - Path to append after the operation\n */\n getDataUrl(operation, path) {\n return _getDataUrl(this, operation, path);\n }\n};\n_clientConfig = /* @__PURE__ */ new WeakMap(), _httpRequest = /* @__PURE__ */ new WeakMap();\nlet ObservableSanityClient = _ObservableSanityClient;\nvar _clientConfig2, _httpRequest2;\nconst _SanityClient = class _SanityClient2 {\n constructor(httpRequest, config = defaultConfig) {\n __privateAdd(this, _clientConfig2, void 0), __privateAdd(this, _httpRequest2, void 0), this.listen = _listen, this.config(config), __privateSet(this, _httpRequest2, httpRequest), this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2)), this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2)), this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2)), this.users = new UsersClient(this, __privateGet(this, _httpRequest2)), this.observable = new ObservableSanityClient(httpRequest, config);\n }\n /**\n * Clone the client - returns a new instance\n */\n clone() {\n return new _SanityClient2(__privateGet(this, _httpRequest2), this.config());\n }\n config(newConfig) {\n if (newConfig === void 0)\n return { ...__privateGet(this, _clientConfig2) };\n if (__privateGet(this, _clientConfig2) && __privateGet(this, _clientConfig2).allowReconfigure === !1)\n throw new Error(\n \"Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client\"\n );\n return this.observable && this.observable.config(newConfig), __privateSet(this, _clientConfig2, initConfig(newConfig, __privateGet(this, _clientConfig2) || {})), this;\n }\n /**\n * Clone the client with a new (partial) configuration.\n *\n * @param newConfig - New client configuration properties, shallowly merged with existing configuration\n */\n withConfig(newConfig) {\n const thisConfig = this.config();\n return new _SanityClient2(__privateGet(this, _httpRequest2), {\n ...thisConfig,\n ...newConfig,\n stega: {\n ...thisConfig.stega || {},\n ...typeof (newConfig == null ? void 0 : newConfig.stega) == \"boolean\" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}\n }\n });\n }\n fetch(query, params, options) {\n return lastValueFrom(\n _fetch(\n this,\n __privateGet(this, _httpRequest2),\n __privateGet(this, _clientConfig2).stega,\n query,\n params,\n options\n )\n );\n }\n /**\n * Fetch a single document with the given ID.\n *\n * @param id - Document ID to fetch\n * @param options - Request options\n */\n getDocument(id, options) {\n return lastValueFrom(_getDocument(this, __privateGet(this, _httpRequest2), id, options));\n }\n /**\n * Fetch multiple documents in one request.\n * Should be used sparingly - performing a query is usually a better option.\n * The order/position of documents is preserved based on the original array of IDs.\n * If any of the documents are missing, they will be replaced by a `null` entry in the returned array\n *\n * @param ids - Document IDs to fetch\n * @param options - Request options\n */\n getDocuments(ids, options) {\n return lastValueFrom(_getDocuments(this, __privateGet(this, _httpRequest2), ids, options));\n }\n create(document, options) {\n return lastValueFrom(\n _create(this, __privateGet(this, _httpRequest2), document, \"create\", options)\n );\n }\n createIfNotExists(document, options) {\n return lastValueFrom(\n _createIfNotExists(this, __privateGet(this, _httpRequest2), document, options)\n );\n }\n createOrReplace(document, options) {\n return lastValueFrom(\n _createOrReplace(this, __privateGet(this, _httpRequest2), document, options)\n );\n }\n delete(selection, options) {\n return lastValueFrom(_delete(this, __privateGet(this, _httpRequest2), selection, options));\n }\n mutate(operations, options) {\n return lastValueFrom(_mutate(this, __privateGet(this, _httpRequest2), operations, options));\n }\n /**\n * Create a new buildable patch of operations to perform\n *\n * @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch\n * @param operations - Optional object of patch operations to initialize the patch instance with\n * @returns Patch instance - call `.commit()` to perform the operations defined\n */\n patch(documentId, operations) {\n return new Patch(documentId, operations, this);\n }\n /**\n * Create a new transaction of mutations\n *\n * @param operations - Optional array of mutation operations to initialize the transaction instance with\n */\n transaction(operations) {\n return new Transaction(operations, this);\n }\n /**\n * Perform a request against the Sanity API\n * NOTE: Only use this for Sanity API endpoints, not for your own APIs!\n *\n * @param options - Request options\n * @returns Promise resolving to the response body\n */\n request(options) {\n return lastValueFrom(_request(this, __privateGet(this, _httpRequest2), options));\n }\n /**\n * Perform an HTTP request a `/data` sub-endpoint\n * NOTE: Considered internal, thus marked as deprecated. Use `request` instead.\n *\n * @deprecated - Use `request()` or your own HTTP library instead\n * @param endpoint - Endpoint to hit (mutate, query etc)\n * @param body - Request body\n * @param options - Request options\n * @internal\n */\n dataRequest(endpoint, body, options) {\n return lastValueFrom(_dataRequest(this, __privateGet(this, _httpRequest2), endpoint, body, options));\n }\n /**\n * Get a Sanity API URL for the URI provided\n *\n * @param uri - URI/path to build URL for\n * @param canUseCdn - Whether or not to allow using the API CDN for this route\n */\n getUrl(uri, canUseCdn) {\n return _getUrl(this, uri, canUseCdn);\n }\n /**\n * Get a Sanity API URL for the data operation and path provided\n *\n * @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)\n * @param path - Path to append after the operation\n */\n getDataUrl(operation, path) {\n return _getDataUrl(this, operation, path);\n }\n};\n_clientConfig2 = /* @__PURE__ */ new WeakMap(), _httpRequest2 = /* @__PURE__ */ new WeakMap();\nlet SanityClient = _SanityClient;\nfunction defineCreateClientExports(envMiddleware2, ClassConstructor) {\n return { requester: defineHttpRequest(envMiddleware2, {}).defaultRequester, createClient: (config) => new ClassConstructor(\n defineHttpRequest(envMiddleware2, {\n maxRetries: config.maxRetries,\n retryDelay: config.retryDelay\n }),\n config\n ) };\n}\nvar envMiddleware = [];\nexport {\n BasePatch as B,\n ClientError as C,\n ObservablePatch as O,\n Patch as P,\n SanityClient as S,\n Transaction as T,\n ServerError as a,\n BaseTransaction as b,\n ObservableTransaction as c,\n defineCreateClientExports as d,\n envMiddleware as e,\n ObservableSanityClient as f,\n b as g,\n printNoDefaultExport as p,\n vercelStegaCleanAll as v\n};\n//# sourceMappingURL=browserMiddleware.js.map\n","import { g as b } from \"./browserMiddleware.js\";\nconst reKeySegment = /_key\\s*==\\s*['\"](.*)['\"]/;\nfunction isKeySegment(segment) {\n return typeof segment == \"string\" ? reKeySegment.test(segment.trim()) : typeof segment == \"object\" && \"_key\" in segment;\n}\nfunction toString(path) {\n if (!Array.isArray(path))\n throw new Error(\"Path is not an array\");\n return path.reduce((target, segment, i) => {\n const segmentType = typeof segment;\n if (segmentType === \"number\")\n return `${target}[${segment}]`;\n if (segmentType === \"string\")\n return `${target}${i === 0 ? \"\" : \".\"}${segment}`;\n if (isKeySegment(segment) && segment._key)\n return `${target}[_key==\"${segment._key}\"]`;\n if (Array.isArray(segment)) {\n const [from, to] = segment;\n return `${target}[${from}:${to}]`;\n }\n throw new Error(`Unsupported path segment \\`${JSON.stringify(segment)}\\``);\n }, \"\");\n}\nconst ESCAPE = {\n \"\\f\": \"\\\\f\",\n \"\\n\": \"\\\\n\",\n \"\\r\": \"\\\\r\",\n \"\t\": \"\\\\t\",\n \"'\": \"\\\\'\",\n \"\\\\\": \"\\\\\\\\\"\n}, UNESCAPE = {\n \"\\\\f\": \"\\f\",\n \"\\\\n\": `\n`,\n \"\\\\r\": \"\\r\",\n \"\\\\t\": \"\t\",\n \"\\\\'\": \"'\",\n \"\\\\\\\\\": \"\\\\\"\n};\nfunction jsonPath(path) {\n return `$${path.map((segment) => typeof segment == \"string\" ? `['${segment.replace(/[\\f\\n\\r\\t'\\\\]/g, (match) => ESCAPE[match])}']` : typeof segment == \"number\" ? `[${segment}]` : segment._key !== \"\" ? `[?(@._key=='${segment._key.replace(/['\\\\]/g, (match) => ESCAPE[match])}')]` : `[${segment._index}]`).join(\"\")}`;\n}\nfunction parseJsonPath(path) {\n const parsed = [], parseRe = /\\['(.*?)'\\]|\\[(\\d+)\\]|\\[\\?\\(@\\._key=='(.*?)'\\)\\]/g;\n let match;\n for (; (match = parseRe.exec(path)) !== null; ) {\n if (match[1] !== void 0) {\n const key = match[1].replace(/\\\\(\\\\|f|n|r|t|')/g, (m) => UNESCAPE[m]);\n parsed.push(key);\n continue;\n }\n if (match[2] !== void 0) {\n parsed.push(parseInt(match[2], 10));\n continue;\n }\n if (match[3] !== void 0) {\n const _key = match[3].replace(/\\\\(\\\\')/g, (m) => UNESCAPE[m]);\n parsed.push({\n _key,\n _index: -1\n });\n continue;\n }\n }\n return parsed;\n}\nfunction jsonPathToStudioPath(path) {\n return path.map((segment) => {\n if (typeof segment == \"string\" || typeof segment == \"number\")\n return segment;\n if (segment._key !== \"\")\n return { _key: segment._key };\n if (segment._index !== -1)\n return segment._index;\n throw new Error(`invalid segment:${JSON.stringify(segment)}`);\n });\n}\nfunction jsonPathToMappingPath(path) {\n return path.map((segment) => {\n if (typeof segment == \"string\" || typeof segment == \"number\")\n return segment;\n if (segment._index !== -1)\n return segment._index;\n throw new Error(`invalid segment:${JSON.stringify(segment)}`);\n });\n}\nfunction resolveMapping(resultPath, csm) {\n if (!(csm != null && csm.mappings))\n return;\n const resultMappingPath = jsonPath(jsonPathToMappingPath(resultPath));\n if (csm.mappings[resultMappingPath] !== void 0)\n return {\n mapping: csm.mappings[resultMappingPath],\n matchedPath: resultMappingPath,\n pathSuffix: \"\"\n };\n const mappings = Object.entries(csm.mappings).filter(([key]) => resultMappingPath.startsWith(key)).sort(([key1], [key2]) => key2.length - key1.length);\n if (mappings.length == 0)\n return;\n const [matchedPath, mapping] = mappings[0], pathSuffix = resultMappingPath.substring(matchedPath.length);\n return { mapping, matchedPath, pathSuffix };\n}\nfunction isArray(value) {\n return value !== null && Array.isArray(value);\n}\nfunction isRecord(value) {\n return typeof value == \"object\" && value !== null;\n}\nfunction walkMap(value, mappingFn, path = []) {\n return isArray(value) ? value.map((v, idx) => {\n if (isRecord(v)) {\n const _key = v._key;\n if (typeof _key == \"string\")\n return walkMap(v, mappingFn, path.concat({ _key, _index: idx }));\n }\n return walkMap(v, mappingFn, path.concat(idx));\n }) : isRecord(value) ? Object.fromEntries(\n Object.entries(value).map(([k, v]) => [k, walkMap(v, mappingFn, path.concat(k))])\n ) : mappingFn(value, path);\n}\nfunction encodeIntoResult(result, csm, encoder) {\n return walkMap(result, (value, path) => {\n if (typeof value != \"string\")\n return value;\n const resolveMappingResult = resolveMapping(path, csm);\n if (!resolveMappingResult)\n return value;\n const { mapping, matchedPath } = resolveMappingResult;\n if (mapping.type !== \"value\" || mapping.source.type !== \"documentValue\")\n return value;\n const sourceDocument = csm.documents[mapping.source.document], sourcePath = csm.paths[mapping.source.path], matchPathSegments = parseJsonPath(matchedPath), fullSourceSegments = parseJsonPath(sourcePath).concat(path.slice(matchPathSegments.length));\n return encoder({\n sourcePath: fullSourceSegments,\n sourceDocument,\n resultPath: path,\n value\n });\n });\n}\nconst DRAFTS_PREFIX = \"drafts.\";\nfunction getPublishedId(id) {\n return id.startsWith(DRAFTS_PREFIX) ? id.slice(DRAFTS_PREFIX.length) : id;\n}\nfunction createEditUrl(options) {\n const {\n baseUrl,\n workspace: _workspace = \"default\",\n tool: _tool = \"default\",\n id: _id,\n type,\n path,\n projectId,\n dataset\n } = options;\n if (!baseUrl)\n throw new Error(\"baseUrl is required\");\n if (!path)\n throw new Error(\"path is required\");\n if (!_id)\n throw new Error(\"id is required\");\n if (baseUrl !== \"/\" && baseUrl.endsWith(\"/\"))\n throw new Error(\"baseUrl must not end with a slash\");\n const workspace = _workspace === \"default\" ? void 0 : _workspace, tool = _tool === \"default\" ? void 0 : _tool, id = getPublishedId(_id), stringifiedPath = Array.isArray(path) ? toString(jsonPathToStudioPath(path)) : path, searchParams = new URLSearchParams({\n baseUrl,\n id,\n type,\n path: stringifiedPath\n });\n workspace && searchParams.set(\"workspace\", workspace), tool && searchParams.set(\"tool\", tool), projectId && searchParams.set(\"projectId\", projectId), dataset && searchParams.set(\"dataset\", dataset), _id.startsWith(DRAFTS_PREFIX) && searchParams.set(\"isDraft\", \"\");\n const segments = [baseUrl === \"/\" ? \"\" : baseUrl];\n workspace && segments.push(workspace);\n const routerParams = [\n \"mode=presentation\",\n `id=${id}`,\n `type=${type}`,\n `path=${encodeURIComponent(stringifiedPath)}`\n ];\n return tool && routerParams.push(`tool=${tool}`), segments.push(\"intent\", \"edit\", `${routerParams.join(\";\")}?${searchParams}`), segments.join(\"/\");\n}\nfunction resolveStudioBaseRoute(studioUrl) {\n let baseUrl = typeof studioUrl == \"string\" ? studioUrl : studioUrl.baseUrl;\n return baseUrl !== \"/\" && (baseUrl = baseUrl.replace(/\\/$/, \"\")), typeof studioUrl == \"string\" ? { baseUrl } : { ...studioUrl, baseUrl };\n}\nconst filterDefault = ({ sourcePath, value }) => {\n if (isValidDate(value) || isValidURL(value))\n return !1;\n const endPath = sourcePath.at(-1);\n return !(sourcePath.at(-2) === \"slug\" && endPath === \"current\" || typeof endPath == \"string\" && endPath.startsWith(\"_\") || typeof endPath == \"number\" && sourcePath.at(-2) === \"marks\" || endPath === \"href\" && typeof sourcePath.at(-2) == \"number\" && sourcePath.at(-3) === \"markDefs\" || endPath === \"style\" || endPath === \"listItem\" || sourcePath.some(\n (path) => path === \"meta\" || path === \"metadata\" || path === \"openGraph\" || path === \"seo\"\n ) || typeof endPath == \"string\" && denylist.has(endPath));\n}, denylist = /* @__PURE__ */ new Set([\n \"color\",\n \"colour\",\n \"currency\",\n \"email\",\n \"format\",\n \"gid\",\n \"hex\",\n \"href\",\n \"hsl\",\n \"hsla\",\n \"icon\",\n \"id\",\n \"index\",\n \"key\",\n \"language\",\n \"layout\",\n \"link\",\n \"linkAction\",\n \"locale\",\n \"lqip\",\n \"page\",\n \"path\",\n \"ref\",\n \"rgb\",\n \"rgba\",\n \"route\",\n \"secret\",\n \"slug\",\n \"status\",\n \"tag\",\n \"template\",\n \"theme\",\n \"type\",\n \"unit\",\n \"url\",\n \"username\",\n \"variant\",\n \"website\"\n]);\nfunction isValidDate(dateString) {\n return /^\\d{4}-\\d{2}-\\d{2}/.test(dateString) ? !!Date.parse(dateString) : !1;\n}\nfunction isValidURL(url) {\n try {\n new URL(url, url.startsWith(\"/\") ? \"https://acme.com\" : void 0);\n } catch {\n return !1;\n }\n return !0;\n}\nconst TRUNCATE_LENGTH = 20;\nfunction stegaEncodeSourceMap(result, resultSourceMap, config) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _i;\n const { filter, logger, enabled } = config;\n if (!enabled) {\n const msg = \"config.enabled must be true, don't call this function otherwise\";\n throw (_a = logger == null ? void 0 : logger.error) == null || _a.call(logger, `[@sanity/client]: ${msg}`, { result, resultSourceMap, config }), new TypeError(msg);\n }\n if (!resultSourceMap)\n return (_b = logger == null ? void 0 : logger.error) == null || _b.call(logger, \"[@sanity/client]: Missing Content Source Map from response body\", {\n result,\n resultSourceMap,\n config\n }), result;\n if (!config.studioUrl) {\n const msg = \"config.studioUrl must be defined\";\n throw (_c = logger == null ? void 0 : logger.error) == null || _c.call(logger, `[@sanity/client]: ${msg}`, { result, resultSourceMap, config }), new TypeError(msg);\n }\n const report = {\n encoded: [],\n skipped: []\n }, resultWithStega = encodeIntoResult(\n result,\n resultSourceMap,\n ({ sourcePath, sourceDocument, resultPath, value }) => {\n if ((typeof filter == \"function\" ? filter({ sourcePath, resultPath, filterDefault, sourceDocument, value }) : filterDefault({ sourcePath, resultPath, filterDefault, sourceDocument, value })) === !1)\n return logger && report.skipped.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? \"...\" : \"\"}`,\n length: value.length\n }), value;\n logger && report.encoded.push({\n path: prettyPathForLogging(sourcePath),\n value: `${value.slice(0, TRUNCATE_LENGTH)}${value.length > TRUNCATE_LENGTH ? \"...\" : \"\"}`,\n length: value.length\n });\n const { baseUrl, workspace, tool } = resolveStudioBaseRoute(\n typeof config.studioUrl == \"function\" ? config.studioUrl(sourceDocument) : config.studioUrl\n );\n if (!baseUrl)\n return value;\n const { _id: id, _type: type, _projectId: projectId, _dataset: dataset } = sourceDocument;\n return b(\n value,\n {\n origin: \"sanity.io\",\n href: createEditUrl({\n baseUrl,\n workspace,\n tool,\n id,\n type,\n path: sourcePath,\n ...!config.omitCrossDatasetReferenceData && { dataset, projectId }\n })\n },\n // We use custom logic to determine if we should skip encoding\n !1\n );\n }\n );\n if (logger) {\n const isSkipping = report.skipped.length, isEncoding = report.encoded.length;\n if ((isSkipping || isEncoding) && ((_d = (logger == null ? void 0 : logger.groupCollapsed) || logger.log) == null || _d(\"[@sanity/client]: Encoding source map into result\"), (_e = logger.log) == null || _e.call(\n logger,\n `[@sanity/client]: Paths encoded: ${report.encoded.length}, skipped: ${report.skipped.length}`\n )), report.encoded.length > 0 && ((_f = logger == null ? void 0 : logger.log) == null || _f.call(logger, \"[@sanity/client]: Table of encoded paths\"), (_g = (logger == null ? void 0 : logger.table) || logger.log) == null || _g(report.encoded)), report.skipped.length > 0) {\n const skipped = /* @__PURE__ */ new Set();\n for (const { path } of report.skipped)\n skipped.add(path.replace(reKeySegment, \"0\").replace(/\\[\\d+\\]/g, \"[]\"));\n (_h = logger == null ? void 0 : logger.log) == null || _h.call(logger, \"[@sanity/client]: List of skipped paths\", [...skipped.values()]);\n }\n (isSkipping || isEncoding) && ((_i = logger == null ? void 0 : logger.groupEnd) == null || _i.call(logger));\n }\n return resultWithStega;\n}\nfunction prettyPathForLogging(path) {\n return toString(jsonPathToStudioPath(path));\n}\nvar stegaEncodeSourceMap$1 = /* @__PURE__ */ Object.freeze({\n __proto__: null,\n stegaEncodeSourceMap\n});\nexport {\n stegaEncodeSourceMap$1 as a,\n encodeIntoResult as e,\n stegaEncodeSourceMap as s\n};\n//# sourceMappingURL=stegaEncodeSourceMap.js.map\n"],"names":["s","a","b","c","d","e","f","Array","fill","String","fromCodePoint","join","E","t","JSON","stringify","concat","from","map","r","n","charCodeAt","Error","toString","padStart","o","I","Number","isNaN","Date","parse","x","URL","startsWith","arguments","length","undefined","Object","fromEntries","entries","reverse","values","reKeySegment","isKeySegment","segment","test","trim","path","isArray","reduce","target","i","segmentType","_key","to","ESCAPE","UNESCAPE","jsonPath","replace","match","_index","parseJsonPath","parsed","parseRe","exec","key","m","push","parseInt","jsonPathToStudioPath","jsonPathToMappingPath","resolveMapping","resultPath","csm","mappings","resultMappingPath","mapping","matchedPath","pathSuffix","filter","_ref","sort","_ref2","_ref3","key1","key2","substring","value","isRecord","walkMap","mappingFn","v","idx","_ref4","k","encodeIntoResult","result","encoder","resolveMappingResult","type","source","sourceDocument","documents","document","sourcePath","paths","matchPathSegments","fullSourceSegments","slice","DRAFTS_PREFIX","getPublishedId","id","createEditUrl","options","baseUrl","workspace","_workspace","tool","_tool","_id","projectId","dataset","endsWith","stringifiedPath","searchParams","URLSearchParams","set","segments","routerParams","encodeURIComponent","resolveStudioBaseRoute","studioUrl","filterDefault","_ref5","isValidDate","isValidURL","endPath","at","some","denylist","has","Set","dateString","url","TRUNCATE_LENGTH","stegaEncodeSourceMap","resultSourceMap","config","_a","_b","_c","_d","_e","_f","_g","_h","_i","logger","enabled","msg","error","call","TypeError","report","encoded","skipped","resultWithStega","_ref6","prettyPathForLogging","_type","_projectId","_dataset","origin","href","omitCrossDatasetReferenceData","isSkipping","isEncoding","groupCollapsed","log","table","add","groupEnd","stegaEncodeSourceMap$1","freeze","__proto__"],"mappings":";;AAilBA,IAAIA,CAAC,GAAG;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,KAAK;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,MAAM;IAAE,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE,MAAM;IAAEC,CAAC,EAAE;EAAQ,CAAA;EAAEH,CAAC,GAAG;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE,IAAI;IAAE,CAAC,EAAE;EAAO,CAAA;EAAEC,CAAC,GAAG,IAAIG,KAAK,CAAC,CAAC,CAAC,CAACC,IAAI,CAACC,MAAM,CAACC,aAAa,CAACP,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAACQ,IAAI,CAAC,EAAE,CAAC;AACpR,SAASC,CAACA,CAACC,CAAC,EAAE;EACZ,IAAIR,CAAC,GAAGS,IAAI,CAACC,SAAS,CAACF,CAAC,CAAC;EACzB,UAAAG,MAAA,C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