@sanity/client 5.3.0 → 5.3.2
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/dist/index.browser.cjs +8 -8
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +8 -8
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
- package/src/assets/AssetsClient.ts +10 -9
- package/src/data/listen.ts +8 -8
- package/src/types.ts +9 -0
- package/umd/sanityClient.js +11 -13
- package/umd/sanityClient.min.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/client",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.2",
|
|
4
4
|
"description": "Client for retrieving, creating and patching data from Sanity.io",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -88,37 +88,37 @@
|
|
|
88
88
|
"singleQuote": true
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@sanity/eventsource": "
|
|
92
|
-
"get-it": "
|
|
93
|
-
"rxjs": "
|
|
91
|
+
"@sanity/eventsource": "5",
|
|
92
|
+
"get-it": "8",
|
|
93
|
+
"rxjs": "7"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@edge-runtime/types": "^2.0.8",
|
|
97
97
|
"@edge-runtime/vm": "^2.1.2",
|
|
98
98
|
"@rollup/plugin-commonjs": "^24.0.1",
|
|
99
99
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
100
|
-
"@sanity/pkg-utils": "^2.2.
|
|
101
|
-
"@sanity/semantic-release-preset": "^4.0.
|
|
102
|
-
"@types/node": "^18.15.
|
|
103
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
104
|
-
"@typescript-eslint/parser": "^5.
|
|
105
|
-
"@vitest/coverage-c8": "^0.29.
|
|
100
|
+
"@sanity/pkg-utils": "^2.2.13",
|
|
101
|
+
"@sanity/semantic-release-preset": "^4.0.1",
|
|
102
|
+
"@types/node": "^18.15.3",
|
|
103
|
+
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
|
104
|
+
"@typescript-eslint/parser": "^5.56.0",
|
|
105
|
+
"@vitest/coverage-c8": "^0.29.5",
|
|
106
106
|
"eslint": "^8.36.0",
|
|
107
|
-
"eslint-config-prettier": "^8.
|
|
107
|
+
"eslint-config-prettier": "^8.8.0",
|
|
108
108
|
"eslint-plugin-prettier": "^4.2.1",
|
|
109
109
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
110
110
|
"faucet": "^0.0.4",
|
|
111
111
|
"happy-dom": "^8.9.0",
|
|
112
112
|
"ls-engines": "^0.9.0",
|
|
113
113
|
"nock": "^13.3.0",
|
|
114
|
-
"prettier": "^2.8.
|
|
114
|
+
"prettier": "^2.8.5",
|
|
115
115
|
"prettier-plugin-packagejson": "^2.4.3",
|
|
116
116
|
"rimraf": "^4.4.0",
|
|
117
|
-
"rollup": "^3.
|
|
117
|
+
"rollup": "^3.20.0",
|
|
118
118
|
"sse-channel": "^4.0.0",
|
|
119
119
|
"terser": "^5.16.6",
|
|
120
|
-
"typescript": "^
|
|
121
|
-
"vitest": "^0.29.
|
|
120
|
+
"typescript": "^5.0.2",
|
|
121
|
+
"vitest": "^0.29.6",
|
|
122
122
|
"vitest-github-actions-reporter": "^0.10.0"
|
|
123
123
|
},
|
|
124
124
|
"engines": {
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
ResponseEvent,
|
|
11
11
|
SanityAssetDocument,
|
|
12
12
|
SanityImageAssetDocument,
|
|
13
|
+
UploadBody,
|
|
13
14
|
UploadClientConfig,
|
|
14
15
|
} from '../types'
|
|
15
16
|
import * as validators from '../validators'
|
|
@@ -32,7 +33,7 @@ export class ObservableAssetsClient {
|
|
|
32
33
|
*/
|
|
33
34
|
upload(
|
|
34
35
|
assetType: 'file',
|
|
35
|
-
body:
|
|
36
|
+
body: UploadBody,
|
|
36
37
|
options?: UploadClientConfig
|
|
37
38
|
): Observable<HttpRequestEvent<{document: SanityAssetDocument}>>
|
|
38
39
|
|
|
@@ -45,7 +46,7 @@ export class ObservableAssetsClient {
|
|
|
45
46
|
*/
|
|
46
47
|
upload(
|
|
47
48
|
assetType: 'image',
|
|
48
|
-
body:
|
|
49
|
+
body: UploadBody,
|
|
49
50
|
options?: UploadClientConfig
|
|
50
51
|
): Observable<HttpRequestEvent<{document: SanityImageAssetDocument}>>
|
|
51
52
|
/**
|
|
@@ -57,12 +58,12 @@ export class ObservableAssetsClient {
|
|
|
57
58
|
*/
|
|
58
59
|
upload(
|
|
59
60
|
assetType: 'file' | 'image',
|
|
60
|
-
body:
|
|
61
|
+
body: UploadBody,
|
|
61
62
|
options?: UploadClientConfig
|
|
62
63
|
): Observable<HttpRequestEvent<{document: SanityAssetDocument | SanityImageAssetDocument}>>
|
|
63
64
|
upload(
|
|
64
65
|
assetType: 'file' | 'image',
|
|
65
|
-
body:
|
|
66
|
+
body: UploadBody,
|
|
66
67
|
options?: UploadClientConfig
|
|
67
68
|
): Observable<HttpRequestEvent<{document: SanityAssetDocument | SanityImageAssetDocument}>> {
|
|
68
69
|
return _upload(this.#client, this.#httpRequest, assetType, body, options)
|
|
@@ -87,7 +88,7 @@ export class AssetsClient {
|
|
|
87
88
|
*/
|
|
88
89
|
upload(
|
|
89
90
|
assetType: 'file',
|
|
90
|
-
body:
|
|
91
|
+
body: UploadBody,
|
|
91
92
|
options?: UploadClientConfig
|
|
92
93
|
): Promise<SanityAssetDocument>
|
|
93
94
|
/**
|
|
@@ -99,7 +100,7 @@ export class AssetsClient {
|
|
|
99
100
|
*/
|
|
100
101
|
upload(
|
|
101
102
|
assetType: 'image',
|
|
102
|
-
body:
|
|
103
|
+
body: UploadBody,
|
|
103
104
|
options?: UploadClientConfig
|
|
104
105
|
): Promise<SanityImageAssetDocument>
|
|
105
106
|
/**
|
|
@@ -111,12 +112,12 @@ export class AssetsClient {
|
|
|
111
112
|
*/
|
|
112
113
|
upload(
|
|
113
114
|
assetType: 'file' | 'image',
|
|
114
|
-
body:
|
|
115
|
+
body: UploadBody,
|
|
115
116
|
options?: UploadClientConfig
|
|
116
117
|
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
117
118
|
upload(
|
|
118
119
|
assetType: 'file' | 'image',
|
|
119
|
-
body:
|
|
120
|
+
body: UploadBody,
|
|
120
121
|
options?: UploadClientConfig
|
|
121
122
|
): Promise<SanityAssetDocument | SanityImageAssetDocument> {
|
|
122
123
|
const observable = _upload(this.#client, this.#httpRequest, assetType, body, options)
|
|
@@ -137,7 +138,7 @@ function _upload(
|
|
|
137
138
|
client: SanityClient | ObservableSanityClient,
|
|
138
139
|
httpRequest: HttpRequest,
|
|
139
140
|
assetType: 'image' | 'file',
|
|
140
|
-
body:
|
|
141
|
+
body: UploadBody,
|
|
141
142
|
opts: UploadClientConfig = {}
|
|
142
143
|
): Observable<HttpRequestEvent<{document: SanityAssetDocument | SanityImageAssetDocument}>> {
|
|
143
144
|
validators.validateAssetType(assetType)
|
package/src/data/listen.ts
CHANGED
|
@@ -130,10 +130,10 @@ export function _listen<R extends Record<string, Any> = Record<string, Any>>(
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
function unsubscribe() {
|
|
133
|
-
es.removeEventListener('error', onError
|
|
134
|
-
es.removeEventListener('channelError', onChannelError
|
|
135
|
-
es.removeEventListener('disconnect', onDisconnect
|
|
136
|
-
listenFor.forEach((type: string) => es.removeEventListener(type, onMessage
|
|
133
|
+
es.removeEventListener('error', onError)
|
|
134
|
+
es.removeEventListener('channelError', onChannelError)
|
|
135
|
+
es.removeEventListener('disconnect', onDisconnect)
|
|
136
|
+
listenFor.forEach((type: string) => es.removeEventListener(type, onMessage))
|
|
137
137
|
es.close()
|
|
138
138
|
}
|
|
139
139
|
|
|
@@ -145,10 +145,10 @@ export function _listen<R extends Record<string, Any> = Record<string, Any>>(
|
|
|
145
145
|
|
|
146
146
|
function getEventSource() {
|
|
147
147
|
const evs = new EventSource(uri, esOptions)
|
|
148
|
-
evs.addEventListener('error', onError
|
|
149
|
-
evs.addEventListener('channelError', onChannelError
|
|
150
|
-
evs.addEventListener('disconnect', onDisconnect
|
|
151
|
-
listenFor.forEach((type: string) => evs.addEventListener(type, onMessage
|
|
148
|
+
evs.addEventListener('error', onError)
|
|
149
|
+
evs.addEventListener('channelError', onChannelError)
|
|
150
|
+
evs.addEventListener('disconnect', onDisconnect)
|
|
151
|
+
listenFor.forEach((type: string) => evs.addEventListener(type, onMessage))
|
|
152
152
|
return evs
|
|
153
153
|
}
|
|
154
154
|
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// deno-lint-ignore-file no-empty-interface
|
|
1
2
|
import type {Requester} from 'get-it'
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -6,6 +7,14 @@ import type {Requester} from 'get-it'
|
|
|
6
7
|
*/
|
|
7
8
|
export type Any = any // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
8
9
|
|
|
10
|
+
declare global {
|
|
11
|
+
// Declare empty stub interfaces for environments where "dom" lib is not included
|
|
12
|
+
interface File {}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** @public */
|
|
16
|
+
export type UploadBody = File | Blob | Buffer | NodeJS.ReadableStream
|
|
17
|
+
|
|
9
18
|
/** @public */
|
|
10
19
|
export interface RequestOptions {
|
|
11
20
|
timeout?: number
|
package/umd/sanityClient.js
CHANGED
|
@@ -3084,11 +3084,9 @@
|
|
|
3084
3084
|
}(typeof globalThis === 'undefined' ? (typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal) : globalThis));
|
|
3085
3085
|
} (eventsource, eventsourceExports));
|
|
3086
3086
|
|
|
3087
|
-
|
|
3087
|
+
var browser = eventsourceExports.EventSourcePolyfill;
|
|
3088
3088
|
|
|
3089
|
-
var
|
|
3090
|
-
|
|
3091
|
-
var browser = evs.EventSourcePolyfill;
|
|
3089
|
+
var polyfilledEventSource = browser;
|
|
3092
3090
|
|
|
3093
3091
|
var envMiddleware = [];
|
|
3094
3092
|
const MAX_ITEMS_IN_ERROR_MESSAGE = 5;
|
|
@@ -4148,7 +4146,7 @@
|
|
|
4148
4146
|
return selection;
|
|
4149
4147
|
}, {});
|
|
4150
4148
|
const MAX_URL_LENGTH = 16e3 - 1200;
|
|
4151
|
-
const EventSource =
|
|
4149
|
+
const EventSource = polyfilledEventSource;
|
|
4152
4150
|
const possibleOptions = ["includePreviousRevision", "includeResult", "visibility", "effectFormat", "tag"];
|
|
4153
4151
|
const defaultOptions = {
|
|
4154
4152
|
includeResult: true
|
|
@@ -4221,10 +4219,10 @@
|
|
|
4221
4219
|
observer.complete();
|
|
4222
4220
|
}
|
|
4223
4221
|
function unsubscribe() {
|
|
4224
|
-
es.removeEventListener("error", onError
|
|
4225
|
-
es.removeEventListener("channelError", onChannelError
|
|
4226
|
-
es.removeEventListener("disconnect", onDisconnect
|
|
4227
|
-
listenFor.forEach(type => es.removeEventListener(type, onMessage
|
|
4222
|
+
es.removeEventListener("error", onError);
|
|
4223
|
+
es.removeEventListener("channelError", onChannelError);
|
|
4224
|
+
es.removeEventListener("disconnect", onDisconnect);
|
|
4225
|
+
listenFor.forEach(type => es.removeEventListener(type, onMessage));
|
|
4228
4226
|
es.close();
|
|
4229
4227
|
}
|
|
4230
4228
|
function emitReconnect() {
|
|
@@ -4236,10 +4234,10 @@
|
|
|
4236
4234
|
}
|
|
4237
4235
|
function getEventSource() {
|
|
4238
4236
|
const evs = new EventSource(uri, esOptions);
|
|
4239
|
-
evs.addEventListener("error", onError
|
|
4240
|
-
evs.addEventListener("channelError", onChannelError
|
|
4241
|
-
evs.addEventListener("disconnect", onDisconnect
|
|
4242
|
-
listenFor.forEach(type => evs.addEventListener(type, onMessage
|
|
4237
|
+
evs.addEventListener("error", onError);
|
|
4238
|
+
evs.addEventListener("channelError", onChannelError);
|
|
4239
|
+
evs.addEventListener("disconnect", onDisconnect);
|
|
4240
|
+
listenFor.forEach(type => evs.addEventListener(type, onMessage));
|
|
4243
4241
|
return evs;
|
|
4244
4242
|
}
|
|
4245
4243
|
function open() {
|
package/umd/sanityClient.min.js
CHANGED
|
@@ -11,4 +11,4 @@ function F(t){return"[object Object]"===Object.prototype.toString.call(t)}!funct
|
|
|
11
11
|
* Available under MIT License (MIT)
|
|
12
12
|
* https://github.com/Yaffle/EventSource/
|
|
13
13
|
*/
|
|
14
|
-
!function(t,e){!function(n){var r=n.setTimeout,o=n.clearTimeout,i=n.XMLHttpRequest,s=n.XDomainRequest,a=n.ActiveXObject,c=n.EventSource,u=n.document,l=n.Promise,h=n.fetch,d=n.Response,f=n.TextDecoder,p=n.TextEncoder,y=n.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(t){u.readyState="complete"}),!1)),null==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(t){function e(){}return e.prototype=t,new e}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=h;h=function(t,e){var n=e.signal;return g(t,{headers:e.headers,credentials:e.credentials,cache:e.cache}).then((function(t){var e=t.body.getReader();return n._reader=e,n._aborted&&n._reader.cancel(),{status:t.status,statusText:t.statusText,headers:t.headers,body:{getReader:function(){return e}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function m(){this.bitsNeeded=0,this.codePoint=0}m.prototype.decode=function(t){function e(t,e,n){if(1===n)return t>=128>>e&&t<<e<=2047;if(2===n)return t>=2048>>e&&t<<e<=55295||t>=57344>>e&&t<<e<=65535;if(3===n)return t>=65536>>e&&t<<e<=1114111;throw new Error}function n(t,e){if(6===t)return e>>6>15?3:e>31?2:1;if(12===t)return e>15?3:2;if(18===t)return 3;throw new Error}for(var r=65533,o="",i=this.bitsNeeded,s=this.codePoint,a=0;a<t.length;a+=1){var c=t[a];0!==i&&(c<128||c>191||!e(s<<6|63&c,i-6,n(i,s)))&&(i=0,s=r,o+=String.fromCharCode(s)),0===i?(c>=0&&c<=127?(i=0,s=c):c>=192&&c<=223?(i=6,s=31&c):c>=224&&c<=239?(i=12,s=15&c):c>=240&&c<=247?(i=18,s=7&c):(i=0,s=r),0===i||e(s,i,n(i,s))||(i=0,s=r)):(i-=6,s=s<<6|63&c),0===i&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,o};null!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(t){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+t)}return!1}()||(f=m);var v=function(){};function w(t){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=t,this._sendTimeout=0,this._abort=v}function b(t){return t.replace(/[A-Z]/g,(function(t){return String.fromCharCode(t.charCodeAt(0)+32)}))}function C(t){for(var e=Object.create(null),n=t.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),i=o.shift(),s=o.join(": ");e[b(i)]=s}this._map=e}function E(){}function T(t){this._headers=t}function x(){}function O(){this._listeners=Object.create(null)}function _(t){r((function(){throw t}),0)}function S(t){this.type=t,this.target=void 0}function j(t,e){S.call(this,t),this.data=e.data,this.lastEventId=e.lastEventId}function A(t,e){S.call(this,t),this.status=e.status,this.statusText=e.statusText,this.headers=e.headers}function k(t,e){S.call(this,t),this.error=e.error}w.prototype.open=function(t,e){this._abort(!0);var n=this,s=this._xhr,a=1,c=0;this._abort=function(t){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=v,s.onerror=v,s.onabort=v,s.onprogress=v,s.onreadystatechange=v,s.abort(),0!==c&&(o(c),c=0),t||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var u=function(){if(1===a){var t=0,e="",r=void 0;if("contentType"in s)t=200,e="OK",r=s.contentType;else try{t=s.status,e=s.statusText,r=s.getResponseHeader("Content-Type")}catch(n){t=0,e="",r=void 0}0!==t&&(a=2,n.readyState=2,n.status=t,n.statusText=e,n._contentType=r,n.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var t="";try{t=s.responseText}catch(t){}n.readyState=3,n.responseText=t,n.onprogress()}},h=function(t,e){if(null!=e&&null!=e.preventDefault||(e={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),n.readyState=4,"load"===t)n.onload(e);else if("error"===t)n.onerror(e);else{if("abort"!==t)throw new TypeError;n.onabort(e)}n.onreadystatechange()}},d=function(){c=r((function(){d()}),500),3===s.readyState&&l()};"onload"in s&&(s.onload=function(t){h("load",t)}),"onerror"in s&&(s.onerror=function(t){h("error",t)}),"onabort"in s&&(s.onabort=function(t){h("abort",t)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(t){!function(t){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||h(""===s.responseText?"error":"load",t):3===s.readyState?"onprogress"in s||l():2===s.readyState&&u())}(t)}),!("contentType"in s)&&"ontimeout"in i.prototype||(e+=(-1===e.indexOf("?")?"?":"&")+"padding=true"),s.open(t,e,!0),"readyState"in s&&(c=r((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(t){return this._contentType},w.prototype.setRequestHeader=function(t,e){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(t,e)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var t=this._xhr;"withCredentials"in t&&(t.withCredentials=this.withCredentials);try{t.send(void 0)}catch(t){throw t}}else{var e=this;e._sendTimeout=r((function(){e._sendTimeout=0,e.send()}),4)}},C.prototype.get=function(t){return this._map[b(t)]},null!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),E.prototype.open=function(t,e,n,r,o,s,a){t.open("GET",o);var c=0;for(var u in t.onprogress=function(){var e=t.responseText.slice(c);c+=e.length,n(e)},t.onerror=function(t){t.preventDefault(),r(new Error("NetworkError"))},t.onload=function(){r(null)},t.onabort=function(){r(null)},t.onreadystatechange=function(){if(t.readyState===i.HEADERS_RECEIVED){var n=t.status,r=t.statusText,o=t.getResponseHeader("Content-Type"),s=t.getAllResponseHeaders();e(n,r,o,new C(s))}},t.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,u)&&t.setRequestHeader(u,a[u]);return t.send(),t},T.prototype.get=function(t){return this._headers.get(t)},x.prototype.open=function(t,e,n,r,o,i,s){var a=null,c=new y,u=c.signal,d=new f;return h(o,{headers:s,credentials:i?"include":"same-origin",signal:u,cache:"no-store"}).then((function(t){return a=t.body.getReader(),e(t.status,t.statusText,t.headers.get("Content-Type"),new T(t.headers)),new l((function(t,e){var r=function(){a.read().then((function(e){if(e.done)t(void 0);else{var o=d.decode(e.value,{stream:!0});n(o),r()}})).catch((function(t){e(t)}))};r()}))})).catch((function(t){return"AbortError"===t.name?void 0:t})).then((function(t){r(t)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(t){t.target=this;var e=this._listeners[t.type];if(null!=e)for(var n=e.length,r=0;r<n;r+=1){var o=e[r];try{"function"==typeof o.handleEvent?o.handleEvent(t):o.call(this,t)}catch(t){_(t)}}},O.prototype.addEventListener=function(t,e){t=String(t);var n=this._listeners,r=n[t];null==r&&(r=[],n[t]=r);for(var o=!1,i=0;i<r.length;i+=1)r[i]===e&&(o=!0);o||r.push(e)},O.prototype.removeEventListener=function(t,e){t=String(t);var n=this._listeners,r=n[t];if(null!=r){for(var o=[],i=0;i<r.length;i+=1)r[i]!==e&&o.push(r[i]);0===o.length?delete n[t]:n[t]=o}},j.prototype=Object.create(S.prototype),A.prototype=Object.create(S.prototype),k.prototype=Object.create(S.prototype);var F=-1,R=0,I=1,M=2,P=-1,D=0,q=1,N=2,H=3,W=/^text\/event\-stream(;.*)?$/i,z=function(t,e){var n=null==t?e:parseInt(t,10);return n!=n&&(n=e),U(n)},U=function(t){return Math.min(Math.max(t,1e3),18e6)},L=function(t,e,n){try{"function"==typeof e&&e.call(t,n)}catch(t){_(t)}};function B(t,e){O.call(this),e=e||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(t,e,n){e=String(e);var a=Boolean(n.withCredentials),c=n.lastEventIdQueryParameterName||"lastEventId",u=U(1e3),l=z(n.heartbeatTimeout,45e3),h="",d=u,f=!1,p=0,y=n.headers||{},g=n.Transport,m=$&&null==g?void 0:new w(null!=g?new g:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),v=null!=g&&"string"!=typeof g?new g:null==m?new x:new E,b=void 0,C=0,T=F,O="",_="",S="",B="",V=D,J=0,G=0,X=function(e,n,r,o){if(T===R)if(200===e&&null!=r&&W.test(r)){T=I,f=Date.now(),d=u,t.readyState=I;var i=new A("open",{status:e,statusText:n,headers:o});t.dispatchEvent(i),L(t,t.onopen,i)}else{var s="";200!==e?(n&&(n=n.replace(/\s+/g," ")),s="EventSource's response has a status "+e+" "+n+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",Z();i=new A("error",{status:e,statusText:n,headers:o});t.dispatchEvent(i),L(t,t.onerror,i),console.error(s)}},Y=function(e){if(T===I){for(var n=-1,i=0;i<e.length;i+=1){(c=e.charCodeAt(i))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(n=i)}var s=(-1!==n?B:"")+e.slice(0,n+1);B=(-1===n?B:"")+e.slice(n+1),""!==e&&(f=Date.now(),p+=e.length);for(var a=0;a<s.length;a+=1){var c=s.charCodeAt(a);if(V===P&&c==="\n".charCodeAt(0))V=D;else if(V===P&&(V=D),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(V!==D){V===q&&(G=a+1);var y=s.slice(J,G-1),g=s.slice(G+(G<a&&s.charCodeAt(G)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=g):"id"===y?_=g:"event"===y?S=g:"retry"===y?(u=z(g,u),d=u):"heartbeatTimeout"===y&&(l=z(g,l),0!==C&&(o(C),C=r((function(){Q()}),l)))}if(V===D){if(""!==O){h=_,""===S&&(S="message");var m=new j(S,{data:O.slice(1),lastEventId:_});if(t.dispatchEvent(m),"open"===S?L(t,t.onopen,m):"message"===S?L(t,t.onmessage,m):"error"===S&&L(t,t.onerror,m),T===M)return}O="",S=""}V=c==="\r".charCodeAt(0)?P:D}else V===D&&(J=a,V=q),V===q?c===":".charCodeAt(0)&&(G=a+1,V=N):V===N&&(V=H)}}},K=function(e){if(T===I||T===R){T=F,0!==C&&(o(C),C=0),C=r((function(){Q()}),d),d=U(Math.min(16*u,2*d)),t.readyState=R;var n=new k("error",{error:e});t.dispatchEvent(n),L(t,t.onerror,n),null!=e&&console.error(e)}},Z=function(){T=M,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),t.readyState=M},Q=function(){if(C=0,T===F){f=!1,p=0,C=r((function(){Q()}),l),T=R,O="",S="",_=h,B="",J=0,G=0,V=D;var n=e;if("data:"!==e.slice(0,5)&&"blob:"!==e.slice(0,5)&&""!==h){var o=e.indexOf("?");n=-1===o?e:e.slice(0,o+1)+e.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(t,e){return e===c?"":t})),n+=(-1===e.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var i=t.withCredentials,s={Accept:"text/event-stream"},a=t.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u]);try{b=v.open(m,X,Y,K,n,i,s)}catch(t){throw Z(),t}}else if(f||null==b){var d=Math.max((f||Date.now())+l-Date.now(),1);f=!1,C=r((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(T===R?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};t.url=e,t.readyState=R,t.withCredentials=a,t.headers=y,t._close=Z,Q()}(this,t,e)}var $=null!=h&&null!=d&&"body"in d.prototype;B.prototype=Object.create(O.prototype),B.prototype.CONNECTING=R,B.prototype.OPEN=I,B.prototype.CLOSED=M,B.prototype.close=function(){this._close()},B.CONNECTING=R,B.OPEN=I,B.CLOSED=M,B.prototype.withCredentials=void 0;var V,J=c;null==i||null!=c&&"withCredentials"in c.prototype||(J=B),V=function(t){t.EventSourcePolyfill=B,t.NativeEventSource=c,t.EventSource=J}(e),void 0!==V&&(t.exports=V)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:s:globalThis)}({get exports(){return bt},set exports(t){bt=t}},bt);var Ct=bt.EventSourcePolyfill;const Et=5;class Tt extends Error{constructor(t){const e=Ot(t);super(e.message),this.statusCode=400,Object.assign(this,e)}}class xt extends Error{constructor(t){const e=Ot(t);super(e.message),this.statusCode=500,Object.assign(this,e)}}function Ot(t){const e=t.body,n={response:t,statusCode:t.statusCode,responseBody:St(e,t),message:"",details:void 0};if(e.error&&e.message)return n.message="".concat(e.error," - ").concat(e.message),n;if(function(t){return _t(t)&&_t(t.error)&&"mutationError"===t.error.type&&"string"==typeof t.error.description}(e)){const t=e.error.items||[],r=t.slice(0,Et).map((t=>{var e;return null==(e=t.error)?void 0:e.description})).filter(Boolean);let o=r.length?":\n- ".concat(r.join("\n- ")):"";return t.length>Et&&(o+="\n...and ".concat(t.length-Et," more")),n.message="".concat(e.error.description).concat(o),n.details=e.error,n}return e.error&&e.error.description?(n.message=e.error.description,n.details=e.error,n):(n.message=e.error||e.message||function(t){const e=t.statusMessage?" ".concat(t.statusMessage):"";return"".concat(t.method,"-request to ").concat(t.url," resulted in HTTP ").concat(t.statusCode).concat(e)}(t),n)}function _t(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function St(t,e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t}const jt={onResponse:t=>{if(t.statusCode>=500)throw new xt(t);if(t.statusCode>=400)throw new Tt(t);return t}},At={onResponse:t=>{const e=t.headers["x-sanity-warning"];return(Array.isArray(e)?e:[e]).filter(Boolean).forEach((t=>console.warn(t))),t}};const kt="X-Sanity-Project-ID";function Ft(t){if("string"==typeof t||Array.isArray(t))return{id:t};if("object"==typeof t&&null!==t&&"query"in t&&"string"==typeof t.query)return"params"in t&&"object"==typeof t.params&&null!==t.params?{query:t.query,params:t.params}:{query:t.query};const e=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(e))}const Rt=["image","file"],It=["before","after","replace"],Mt=t=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},Pt=t=>{if(-1===Rt.indexOf(t))throw new Error("Invalid asset type: ".concat(t,". Must be one of ").concat(Rt.join(", ")))},Dt=(t,e)=>{if(null===e||"object"!=typeof e||Array.isArray(e))throw new Error("".concat(t,"() takes an object of properties"))},qt=(t,e)=>{if("string"!=typeof e||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(e)||e.includes(".."))throw new Error("".concat(t,'(): "').concat(e,'" is not a valid document ID'))},Nt=(t,e)=>{if(!e._id)throw new Error("".concat(t,'() requires that the document contains an ID ("_id" property)'));qt(t,e._id)},Ht=t=>{if(!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},Wt=t=>{if("string"!=typeof t||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t},zt=t=>{let{query:e,params:n={},options:r={}}=t;const o=new URLSearchParams,{tag:i,...s}=r;i&&o.set("tag",i),o.set("query",e);for(const[t,e]of Object.entries(n))o.set("$".concat(t),JSON.stringify(e));for(const[t,e]of Object.entries(s))e&&o.set(t,"".concat(e));return"?".concat(o)};var Ut,Lt,Bt=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},$t=(t,e,n)=>(Bt(t,e,"read from private field"),n?n.call(t):e.get(t)),Vt=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Jt=(t,e,n,r)=>(Bt(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class Gt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=t,this.operations=e}set(t){return this._assign("set",t)}setIfMissing(t){return this._assign("setIfMissing",t)}diffMatchPatch(t){return Dt("diffMatchPatch",t),this._assign("diffMatchPatch",t)}unset(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:t}),this}inc(t){return this._assign("inc",t)}dec(t){return this._assign("dec",t)}insert(t,e,n){return((t,e,n)=>{const r="insert(at, selector, items)";if(-1===It.indexOf(t)){const t=It.map((t=>'"'.concat(t,'"'))).join(", ");throw new Error("".concat(r,' takes an "at"-argument which is one of: ').concat(t))}if("string"!=typeof e)throw new Error("".concat(r,' takes a "selector"-argument which must be a string'));if(!Array.isArray(n))throw new Error("".concat(r,' takes an "items"-argument which must be an array'))})(t,e,n),this._assign("insert",{[t]:e,items:n})}append(t,e){return this.insert("after","".concat(t,"[-1]"),e)}prepend(t,e){return this.insert("before","".concat(t,"[0]"),e)}splice(t,e,n,r){const o=e<0?e-1:e,i=void 0===n||-1===n?-1:Math.max(0,e+n),s=o<0&&i>=0?"":i,a="".concat(t,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,r||[])}ifRevisionId(t){return this.operations.ifRevisionID=t,this}serialize(){return{...Ft(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return Dt(t,e),this.operations=Object.assign({},this.operations,{[t]:Object.assign({},n&&this.operations[t]||{},e)}),this}_set(t,e){return this._assign(t,e,!1)}}const Xt=class extends Gt{constructor(t,e,n){super(t,e),Vt(this,Ut,void 0),Jt(this,Ut,n)}clone(){return new Xt(this.selection,{...this.operations},$t(this,Ut))}commit(t){if(!$t(this,Ut))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const e="string"==typeof this.selection,n=Object.assign({returnFirst:e,returnDocuments:!0},t);return $t(this,Ut).mutate({patch:this.serialize()},n)}};let Yt=Xt;Ut=new WeakMap;const Kt=class extends Gt{constructor(t,e,n){super(t,e),Vt(this,Lt,void 0),Jt(this,Lt,n)}clone(){return new Kt(this.selection,{...this.operations},$t(this,Lt))}commit(t){if(!$t(this,Lt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const e="string"==typeof this.selection,n=Object.assign({returnFirst:e,returnDocuments:!0},t);return $t(this,Lt).mutate({patch:this.serialize()},n)}};let Zt=Kt;Lt=new WeakMap;var Qt,te,ee=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},ne=(t,e,n)=>(ee(t,e,"read from private field"),n?n.call(t):e.get(t)),re=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},oe=(t,e,n,r)=>(ee(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);const ie={returnDocuments:!1};class se{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;this.operations=t,this.trxId=e}create(t){return Dt("create",t),this._add({create:t})}createIfNotExists(t){const e="createIfNotExists";return Dt(e,t),Nt(e,t),this._add({[e]:t})}createOrReplace(t){const e="createOrReplace";return Dt(e,t),Nt(e,t),this._add({[e]:t})}delete(t){return qt("delete",t),this._add({delete:{id:t}})}transactionId(t){return t?(this.trxId=t,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(t){return this.operations.push(t),this}}const ae=class extends se{constructor(t,e,n){super(t,n),re(this,Qt,void 0),oe(this,Qt,e)}clone(){return new ae([...this.operations],ne(this,Qt),this.trxId)}commit(t){if(!ne(this,Qt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return ne(this,Qt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},ie,t||{}))}patch(t,e){const n="function"==typeof e;if("string"!=typeof t&&t instanceof Zt)return this._add({patch:t.serialize()});if(n){const n=e(new Zt(t,{},ne(this,Qt)));if(!(n instanceof Zt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:t,...e}})}};let ce=ae;Qt=new WeakMap;const ue=class extends se{constructor(t,e,n){super(t,n),re(this,te,void 0),oe(this,te,e)}clone(){return new ue([...this.operations],ne(this,te),this.trxId)}commit(t){if(!ne(this,te))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return ne(this,te).mutate(this.serialize(),Object.assign({transactionId:this.trxId},ie,t||{}))}patch(t,e){const n="function"==typeof e;if("string"!=typeof t&&t instanceof Yt)return this._add({patch:t.serialize()});if(n){const n=e(new Yt(t,{},ne(this,te)));if(!(n instanceof Yt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:t,...e}})}};let le=ue;te=new WeakMap;const he=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:t.dryRun,returnIds:!0,returnDocuments:(e=t.returnDocuments,n=!0,!1===e?void 0:void 0===e?n:e),visibility:t.visibility||"sync",autoGenerateArrayKeys:t.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:t.skipCrossDatasetReferenceValidation};var e,n},de=t=>"response"===t.type,fe=t=>t.body,pe=(t,e)=>t.reduce(((t,n)=>(t[e(n)]=n,t)),Object.create(null)),ye=11264;function ge(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const i=!1===o.filterResponse?t=>t:t=>t.result;return Te(t,e,"query",{query:n,params:r},o).pipe(vt(i))}function me(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Oe(t,e,{uri:Se(t,"doc",n),json:!0,tag:r.tag}).pipe(wt(de),vt((t=>t.body.documents&&t.body.documents[0])))}function ve(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Oe(t,e,{uri:Se(t,"doc",n.join(",")),json:!0,tag:r.tag}).pipe(wt(de),vt((t=>{const e=pe(t.body.documents||[],(t=>t._id));return n.map((t=>e[t]||null))})))}function we(t,e,n,r){return Nt("createIfNotExists",n),xe(t,e,n,"createIfNotExists",r)}function be(t,e,n,r){return Nt("createOrReplace",n),xe(t,e,n,"createOrReplace",r)}function Ce(t,e,n,r){return Te(t,e,"mutate",{mutations:[{delete:Ft(n)}]},r)}function Ee(t,e,n,r){const o=n instanceof Zt||n instanceof Yt||n instanceof ce||n instanceof le?n.serialize():n;return Te(t,e,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId},r)}function Te(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const i="mutate"===n,s="query"===n,a=i?"":zt(r),c=!i&&a.length<ye,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:f,headers:p}=o;return Oe(t,e,{method:c?"GET":"POST",uri:Se(t,n,u),json:!0,body:c?void 0:r,query:i&&he(o),timeout:h,headers:p,token:d,tag:f,canUseCdn:s,signal:o.signal}).pipe(wt(de),vt(fe),vt((t=>{if(!i)return t;const e=t.results||[];if(o.returnDocuments)return l?e[0]&&e[0].document:e.map((t=>t.document));const n=l?"documentId":"documentIds",r=l?e[0]&&e[0].id:e.map((t=>t.id));return{transactionId:t.transactionId,results:e,[n]:r}})))}function xe(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Te(t,e,"mutate",{mutations:[{[r]:n}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Oe(t,e,n){const r=n.url||n.uri,o=t.config(),i=void 0===n.canUseCdn?["GET","HEAD"].indexOf(n.method||"GET")>=0&&0===r.indexOf("/data/"):n.canUseCdn,s=o.useCdn&&i,a=n.tag&&o.requestTagPrefix?[o.requestTagPrefix,n.tag].join("."):n.tag||o.requestTagPrefix;a&&(n.query={tag:Wt(a),...n.query});const c=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={},r=e.token||t.token;r&&(n.Authorization="Bearer ".concat(r)),e.useGlobalApi||t.useProjectHostname||!t.projectId||(n[kt]=t.projectId);const o=Boolean(void 0===e.withCredentials?t.token||t.withCredentials:e.withCredentials),i=void 0===e.timeout?t.timeout:e.timeout;return Object.assign({},e,{headers:Object.assign({},n,e.headers||{}),timeout:void 0===i?3e5:i,proxy:e.proxy||t.proxy,json:!0,withCredentials:o})}(o,Object.assign({},n,{url:je(t,r,s)})),u=new ht((t=>e(c,o.requester).subscribe(t)));return n.signal?u.pipe((l=n.signal,t=>new ht((e=>{const n=()=>e.error(function(t){var e,n;if(Ae)return new DOMException(null!=(e=null==t?void 0:t.reason)?e:"The operation was aborted.","AbortError");const r=new Error(null!=(n=null==t?void 0:t.reason)?n:"The operation was aborted.");return r.name="AbortError",r}(l));if(l&&l.aborted)return void n();const r=t.subscribe(e);return l.addEventListener("abort",n),()=>{l.removeEventListener("abort",n),r.unsubscribe()}})))):u;var l}function _e(t,e,n){return Oe(t,e,n).pipe(wt((t=>"response"===t.type)),vt((t=>t.body)))}function Se(t,e,n){const r=t.config(),o=Ht(r),i="/".concat(e,"/").concat(o),s=n?"".concat(i,"/").concat(n):i;return"/data".concat(s).replace(/\/($|\?)/,"$1")}function je(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:r,cdnUrl:o}=t.config();return"".concat(n?o:r,"/").concat(e.replace(/^\//,""))}const Ae=Boolean(globalThis.DOMException);var ke,Fe,Re,Ie,Me=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Pe=(t,e,n)=>(Me(t,e,"read from private field"),n?n.call(t):e.get(t)),De=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},qe=(t,e,n,r)=>(Me(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class Ne{constructor(t,e){De(this,ke,void 0),De(this,Fe,void 0),qe(this,ke,t),qe(this,Fe,e)}upload(t,e,n){return We(Pe(this,ke),Pe(this,Fe),t,e,n)}}ke=new WeakMap,Fe=new WeakMap;class He{constructor(t,e){De(this,Re,void 0),De(this,Ie,void 0),qe(this,Re,t),qe(this,Ie,e)}upload(t,e,n){return mt(We(Pe(this,Re),Pe(this,Ie),t,e,n).pipe(wt((t=>"response"===t.type)),vt((t=>t.body.document))))}}function We(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Pt(n);let i=o.extract||void 0;i&&!i.length&&(i=["none"]);const s=Ht(t.config()),a="image"===n?"images":"files",c=function(t,e){if("undefined"==typeof window||!(e instanceof window.File))return t;return Object.assign({filename:!1===t.preserveFilename?void 0:e.name,contentType:e.type},t)}(o,r),{tag:u,label:l,title:h,description:d,creditLine:f,filename:p,source:y}=c,g={label:l,title:h,description:d,filename:p,meta:i,creditLine:f};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),Oe(t,e,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(s),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:r})}Re=new WeakMap,Ie=new WeakMap;const ze="https://www.sanity.io/help/";function Ue(t){return ze+t}const Le=t=>function(t){let e,n=!1;return function(){return n||(e=t(...arguments),n=!0),e}}((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return console.warn(t.join(" "),...n)})),Be=Le(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat(Ue("js-client-cdn-configuration")," "),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),$e=Le(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Ue("js-client-browser-token")," for more information and how to hide this warning.")]),Ve=Le(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Ue("js-client-api-version"))]),Je=Le(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead"]),Ge={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Xe=["localhost","127.0.0.1","0.0.0.0"],Ye=(t,e)=>{const n=Object.assign({},e,t);n.apiVersion||Ve();const r=Object.assign({},Ge,n),o=r.useProjectHostname;if("undefined"==typeof Promise){const t=Ue("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(t))}if(o&&!r.projectId)throw new Error("Configuration must contain `projectId`");const i="undefined"!=typeof window&&window.location&&window.location.hostname,s=i&&(t=>-1!==Xe.indexOf(t))(window.location.hostname);i&&s&&r.token&&!0!==r.ignoreBrowserTokenWarning?$e():void 0===r.useCdn&&Be(),o&&(t=>{if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(r.projectId),r.dataset&&Mt(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?Wt(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===Ge.apiHost,r.useCdn=Boolean(r.useCdn)&&!r.withCredentials,function(t){if("1"===t||"X"===t)return;const e=new Date(t);if(!(/^\d{4}-\d{2}-\d{2}$/.test(t)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(r.apiVersion);const a=r.apiHost.split("://",2),c=a[0],u=a[1],l=r.isDefaultApi?"apicdn.sanity.io":u;return r.useProjectHostname?(r.url="".concat(c,"://").concat(r.projectId,".").concat(u,"/v").concat(r.apiVersion),r.cdnUrl="".concat(c,"://").concat(r.projectId,".").concat(l,"/v").concat(r.apiVersion)):(r.url="".concat(r.apiHost,"/v").concat(r.apiVersion),r.cdnUrl=r.url),r};var Ke=(t,e)=>Object.keys(e).concat(Object.keys(t)).reduce(((n,r)=>(n[r]=void 0===t[r]?e[r]:t[r],n)),{});const Ze=(t,e)=>e.reduce(((e,n)=>(void 0===t[n]||(e[n]=t[n]),e)),{}),Qe=14800,tn=Ct,en=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],nn={includeResult:!0};function rn(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:r,token:o,withCredentials:i,requestTagPrefix:s}=this.config(),a=n.tag&&s?[s,n.tag].join("."):n.tag,c={...Ke(n,nn),tag:a},u=Ze(c,en),l=zt({query:t,params:e,options:{tag:a,...u}}),h="".concat(r).concat(Se(this,"listen",l));if(h.length>Qe)return new ht((t=>t.error(new Error("Query too large for listener"))));const d=c.events?c.events:["mutation"],f=-1!==d.indexOf("reconnect"),p={};return(o||i)&&(p.withCredentials=!0),o&&(p.headers={Authorization:"Bearer ".concat(o)}),new ht((t=>{let e,n=u(),r=!1;function o(){r||(f&&t.next({type:"reconnect"}),r||n.readyState===tn.CLOSED&&(c(),clearTimeout(e),e=setTimeout(l,100)))}function i(e){t.error(function(t){if(t instanceof Error)return t;const e=on(t);return e instanceof Error?e:new Error(function(t){if(!t.error)return t.message||"Unknown listener error";if(t.error.description)return t.error.description;return"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2)}(e))}(e))}function s(e){const n=on(e);return n instanceof Error?t.error(n):t.next(n)}function a(){r=!0,c(),t.complete()}function c(){n.removeEventListener("error",o,!1),n.removeEventListener("channelError",i,!1),n.removeEventListener("disconnect",a,!1),d.forEach((t=>n.removeEventListener(t,s,!1))),n.close()}function u(){const t=new tn(h,p);return t.addEventListener("error",o,!1),t.addEventListener("channelError",i,!1),t.addEventListener("disconnect",a,!1),d.forEach((e=>t.addEventListener(e,s,!1))),t}function l(){n=u()}return function(){r=!0,c()}}))}function on(t){try{const e=t.data&&JSON.parse(t.data)||{};return Object.assign({type:t.type},e)}catch(t){return t}}var sn,an,cn,un,ln=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},hn=(t,e,n)=>(ln(t,e,"read from private field"),n?n.call(t):e.get(t)),dn=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},fn=(t,e,n,r)=>(ln(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class pn{constructor(t,e){dn(this,sn,void 0),dn(this,an,void 0),fn(this,sn,t),fn(this,an,e)}create(t,e){return gn(hn(this,sn),hn(this,an),"PUT",t,e)}edit(t,e){return gn(hn(this,sn),hn(this,an),"PATCH",t,e)}delete(t){return gn(hn(this,sn),hn(this,an),"DELETE",t)}list(){return _e(hn(this,sn),hn(this,an),{uri:"/datasets"})}}sn=new WeakMap,an=new WeakMap;class yn{constructor(t,e){dn(this,cn,void 0),dn(this,un,void 0),fn(this,cn,t),fn(this,un,e)}create(t,e){return mt(gn(hn(this,cn),hn(this,un),"PUT",t,e))}edit(t,e){return mt(gn(hn(this,cn),hn(this,un),"PATCH",t,e))}delete(t){return mt(gn(hn(this,cn),hn(this,un),"DELETE",t))}list(){return mt(_e(hn(this,cn),hn(this,un),{uri:"/datasets"}))}}function gn(t,e,n,r,o){return Mt(r),_e(t,e,{method:n,uri:"/datasets/".concat(r),body:o})}cn=new WeakMap,un=new WeakMap;var mn,vn,wn,bn,Cn=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},En=(t,e,n)=>(Cn(t,e,"read from private field"),n?n.call(t):e.get(t)),Tn=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},xn=(t,e,n,r)=>(Cn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class On{constructor(t,e){Tn(this,mn,void 0),Tn(this,vn,void 0),xn(this,mn,t),xn(this,vn,e)}list(){return _e(En(this,mn),En(this,vn),{uri:"/projects"})}getById(t){return _e(En(this,mn),En(this,vn),{uri:"/projects/".concat(t)})}}mn=new WeakMap,vn=new WeakMap;class _n{constructor(t,e){Tn(this,wn,void 0),Tn(this,bn,void 0),xn(this,wn,t),xn(this,bn,e)}list(){return mt(_e(En(this,wn),En(this,bn),{uri:"/projects"}))}getById(t){return mt(_e(En(this,wn),En(this,bn),{uri:"/projects/".concat(t)}))}}wn=new WeakMap,bn=new WeakMap;var Sn,jn,An,kn,Fn=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Rn=(t,e,n)=>(Fn(t,e,"read from private field"),n?n.call(t):e.get(t)),In=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Mn=(t,e,n,r)=>(Fn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class Pn{constructor(t,e){In(this,Sn,void 0),In(this,jn,void 0),Mn(this,Sn,t),Mn(this,jn,e)}getById(t){return _e(Rn(this,Sn),Rn(this,jn),{uri:"/users/".concat(t)})}}Sn=new WeakMap,jn=new WeakMap;class Dn{constructor(t,e){In(this,An,void 0),In(this,kn,void 0),Mn(this,An,t),Mn(this,kn,e)}getById(t){return mt(_e(Rn(this,An),Rn(this,kn),{uri:"/users/".concat(t)}))}}An=new WeakMap,kn=new WeakMap;var qn,Nn,Hn,Wn,zn=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Un=(t,e,n)=>(zn(t,e,"read from private field"),n?n.call(t):e.get(t)),Ln=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Bn=(t,e,n,r)=>(zn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);const $n=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ge;Ln(this,qn,void 0),Ln(this,Nn,void 0),this.listen=rn,this.config(e),Bn(this,Nn,t),this.assets=new Ne(this,Un(this,Nn)),this.datasets=new pn(this,Un(this,Nn)),this.projects=new On(this,Un(this,Nn)),this.users=new Pn(this,Un(this,Nn))}clone(){return new $n(Un(this,Nn),this.config())}config(t){if(void 0===t)return{...Un(this,qn)};if(Un(this,qn)&&!1===Un(this,qn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Bn(this,qn,Ye(t,Un(this,qn)||{})),this}withConfig(t){return new $n(Un(this,Nn),{...this.config(),...t})}fetch(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ge(this,Un(this,Nn),t,e,n)}getDocument(t,e){return me(this,Un(this,Nn),t,e)}getDocuments(t,e){return ve(this,Un(this,Nn),t,e)}create(t,e){return xe(this,Un(this,Nn),t,"create",e)}createIfNotExists(t,e){return we(this,Un(this,Nn),t,e)}createOrReplace(t,e){return be(this,Un(this,Nn),t,e)}delete(t,e){return Ce(this,Un(this,Nn),t,e)}mutate(t,e){return Ee(this,Un(this,Nn),t,e)}patch(t,e){return new Yt(t,e,this)}transaction(t){return new le(t,this)}request(t){return _e(this,Un(this,Nn),t)}getUrl(t,e){return je(this,t,e)}getDataUrl(t,e){return Se(this,t,e)}};let Vn=$n;qn=new WeakMap,Nn=new WeakMap;const Jn=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ge;Ln(this,Hn,void 0),Ln(this,Wn,void 0),this.listen=rn,this.config(e),Bn(this,Wn,t),this.assets=new He(this,Un(this,Wn)),this.datasets=new yn(this,Un(this,Wn)),this.projects=new _n(this,Un(this,Wn)),this.users=new Dn(this,Un(this,Wn)),this.observable=new Vn(t,e)}clone(){return new Jn(Un(this,Wn),this.config())}config(t){if(void 0===t)return{...Un(this,Hn)};if(Un(this,Hn)&&!1===Un(this,Hn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(t),Bn(this,Hn,Ye(t,Un(this,Hn)||{})),this}withConfig(t){return new Jn(Un(this,Wn),{...this.config(),...t})}fetch(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return mt(ge(this,Un(this,Wn),t,e,n))}getDocument(t,e){return mt(me(this,Un(this,Wn),t,e))}getDocuments(t,e){return mt(ve(this,Un(this,Wn),t,e))}create(t,e){return mt(xe(this,Un(this,Wn),t,"create",e))}createIfNotExists(t,e){return mt(we(this,Un(this,Wn),t,e))}createOrReplace(t,e){return mt(be(this,Un(this,Wn),t,e))}delete(t,e){return mt(Ce(this,Un(this,Wn),t,e))}mutate(t,e){return mt(Ee(this,Un(this,Wn),t,e))}patch(t,e){return new Zt(t,e,this)}transaction(t){return new ce(t,this)}request(t){return mt(_e(this,Un(this,Wn),t))}dataRequest(t,e,n){return mt(Te(this,Un(this,Wn),t,e,n))}getUrl(t,e){return je(this,t,e)}getDataUrl(t,e){return Se(this,t,e)}};let Gn=Jn;Hn=new WeakMap,Wn=new WeakMap;const Xn=function(t){const e=O([...t,At,M(),P(),{onRequest:t=>{if("xhr"!==t.adapter)return;const e=t.request,n=t.context;function r(t){return e=>{const r=e.lengthComputable?e.loaded/e.total*100:-1;n.channels.progress.publish({stage:t,percent:r,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=r("upload")),"onprogress"in e&&(e.onprogress=r("download"))}},jt,N({implementation:ht})]);function n(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:e)({maxRedirects:0,...t})}return n.defaultRequester=e,n}([]),Yn=Xn.defaultRequester;t.BasePatch=Gt,t.BaseTransaction=se,t.ClientError=Tt,t.ObservablePatch=Yt,t.ObservableSanityClient=Vn,t.ObservableTransaction=le,t.Patch=Zt,t.SanityClient=Gn,t.ServerError=xt,t.Transaction=ce,t.createClient=t=>new Gn(Xn,t),t.default=function(t){return Je(),new Gn(Xn,t)},t.requester=Yn,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
14
|
+
!function(t,e){!function(n){var r=n.setTimeout,o=n.clearTimeout,i=n.XMLHttpRequest,s=n.XDomainRequest,a=n.ActiveXObject,c=n.EventSource,u=n.document,l=n.Promise,h=n.fetch,d=n.Response,f=n.TextDecoder,p=n.TextEncoder,y=n.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(t){u.readyState="complete"}),!1)),null==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(t){function e(){}return e.prototype=t,new e}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=h;h=function(t,e){var n=e.signal;return g(t,{headers:e.headers,credentials:e.credentials,cache:e.cache}).then((function(t){var e=t.body.getReader();return n._reader=e,n._aborted&&n._reader.cancel(),{status:t.status,statusText:t.statusText,headers:t.headers,body:{getReader:function(){return e}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function m(){this.bitsNeeded=0,this.codePoint=0}m.prototype.decode=function(t){function e(t,e,n){if(1===n)return t>=128>>e&&t<<e<=2047;if(2===n)return t>=2048>>e&&t<<e<=55295||t>=57344>>e&&t<<e<=65535;if(3===n)return t>=65536>>e&&t<<e<=1114111;throw new Error}function n(t,e){if(6===t)return e>>6>15?3:e>31?2:1;if(12===t)return e>15?3:2;if(18===t)return 3;throw new Error}for(var r=65533,o="",i=this.bitsNeeded,s=this.codePoint,a=0;a<t.length;a+=1){var c=t[a];0!==i&&(c<128||c>191||!e(s<<6|63&c,i-6,n(i,s)))&&(i=0,s=r,o+=String.fromCharCode(s)),0===i?(c>=0&&c<=127?(i=0,s=c):c>=192&&c<=223?(i=6,s=31&c):c>=224&&c<=239?(i=12,s=15&c):c>=240&&c<=247?(i=18,s=7&c):(i=0,s=r),0===i||e(s,i,n(i,s))||(i=0,s=r)):(i-=6,s=s<<6|63&c),0===i&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,o};null!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(t){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+t)}return!1}()||(f=m);var v=function(){};function w(t){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=t,this._sendTimeout=0,this._abort=v}function b(t){return t.replace(/[A-Z]/g,(function(t){return String.fromCharCode(t.charCodeAt(0)+32)}))}function C(t){for(var e=Object.create(null),n=t.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),i=o.shift(),s=o.join(": ");e[b(i)]=s}this._map=e}function E(){}function T(t){this._headers=t}function x(){}function O(){this._listeners=Object.create(null)}function _(t){r((function(){throw t}),0)}function S(t){this.type=t,this.target=void 0}function j(t,e){S.call(this,t),this.data=e.data,this.lastEventId=e.lastEventId}function A(t,e){S.call(this,t),this.status=e.status,this.statusText=e.statusText,this.headers=e.headers}function k(t,e){S.call(this,t),this.error=e.error}w.prototype.open=function(t,e){this._abort(!0);var n=this,s=this._xhr,a=1,c=0;this._abort=function(t){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=v,s.onerror=v,s.onabort=v,s.onprogress=v,s.onreadystatechange=v,s.abort(),0!==c&&(o(c),c=0),t||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var u=function(){if(1===a){var t=0,e="",r=void 0;if("contentType"in s)t=200,e="OK",r=s.contentType;else try{t=s.status,e=s.statusText,r=s.getResponseHeader("Content-Type")}catch(n){t=0,e="",r=void 0}0!==t&&(a=2,n.readyState=2,n.status=t,n.statusText=e,n._contentType=r,n.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var t="";try{t=s.responseText}catch(t){}n.readyState=3,n.responseText=t,n.onprogress()}},h=function(t,e){if(null!=e&&null!=e.preventDefault||(e={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),n.readyState=4,"load"===t)n.onload(e);else if("error"===t)n.onerror(e);else{if("abort"!==t)throw new TypeError;n.onabort(e)}n.onreadystatechange()}},d=function(){c=r((function(){d()}),500),3===s.readyState&&l()};"onload"in s&&(s.onload=function(t){h("load",t)}),"onerror"in s&&(s.onerror=function(t){h("error",t)}),"onabort"in s&&(s.onabort=function(t){h("abort",t)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(t){!function(t){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||h(""===s.responseText?"error":"load",t):3===s.readyState?"onprogress"in s||l():2===s.readyState&&u())}(t)}),!("contentType"in s)&&"ontimeout"in i.prototype||(e+=(-1===e.indexOf("?")?"?":"&")+"padding=true"),s.open(t,e,!0),"readyState"in s&&(c=r((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(t){return this._contentType},w.prototype.setRequestHeader=function(t,e){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(t,e)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var t=this._xhr;"withCredentials"in t&&(t.withCredentials=this.withCredentials);try{t.send(void 0)}catch(t){throw t}}else{var e=this;e._sendTimeout=r((function(){e._sendTimeout=0,e.send()}),4)}},C.prototype.get=function(t){return this._map[b(t)]},null!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),E.prototype.open=function(t,e,n,r,o,s,a){t.open("GET",o);var c=0;for(var u in t.onprogress=function(){var e=t.responseText.slice(c);c+=e.length,n(e)},t.onerror=function(t){t.preventDefault(),r(new Error("NetworkError"))},t.onload=function(){r(null)},t.onabort=function(){r(null)},t.onreadystatechange=function(){if(t.readyState===i.HEADERS_RECEIVED){var n=t.status,r=t.statusText,o=t.getResponseHeader("Content-Type"),s=t.getAllResponseHeaders();e(n,r,o,new C(s))}},t.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,u)&&t.setRequestHeader(u,a[u]);return t.send(),t},T.prototype.get=function(t){return this._headers.get(t)},x.prototype.open=function(t,e,n,r,o,i,s){var a=null,c=new y,u=c.signal,d=new f;return h(o,{headers:s,credentials:i?"include":"same-origin",signal:u,cache:"no-store"}).then((function(t){return a=t.body.getReader(),e(t.status,t.statusText,t.headers.get("Content-Type"),new T(t.headers)),new l((function(t,e){var r=function(){a.read().then((function(e){if(e.done)t(void 0);else{var o=d.decode(e.value,{stream:!0});n(o),r()}})).catch((function(t){e(t)}))};r()}))})).catch((function(t){return"AbortError"===t.name?void 0:t})).then((function(t){r(t)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(t){t.target=this;var e=this._listeners[t.type];if(null!=e)for(var n=e.length,r=0;r<n;r+=1){var o=e[r];try{"function"==typeof o.handleEvent?o.handleEvent(t):o.call(this,t)}catch(t){_(t)}}},O.prototype.addEventListener=function(t,e){t=String(t);var n=this._listeners,r=n[t];null==r&&(r=[],n[t]=r);for(var o=!1,i=0;i<r.length;i+=1)r[i]===e&&(o=!0);o||r.push(e)},O.prototype.removeEventListener=function(t,e){t=String(t);var n=this._listeners,r=n[t];if(null!=r){for(var o=[],i=0;i<r.length;i+=1)r[i]!==e&&o.push(r[i]);0===o.length?delete n[t]:n[t]=o}},j.prototype=Object.create(S.prototype),A.prototype=Object.create(S.prototype),k.prototype=Object.create(S.prototype);var F=-1,R=0,I=1,M=2,P=-1,D=0,q=1,N=2,H=3,W=/^text\/event\-stream(;.*)?$/i,z=function(t,e){var n=null==t?e:parseInt(t,10);return n!=n&&(n=e),U(n)},U=function(t){return Math.min(Math.max(t,1e3),18e6)},L=function(t,e,n){try{"function"==typeof e&&e.call(t,n)}catch(t){_(t)}};function B(t,e){O.call(this),e=e||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(t,e,n){e=String(e);var a=Boolean(n.withCredentials),c=n.lastEventIdQueryParameterName||"lastEventId",u=U(1e3),l=z(n.heartbeatTimeout,45e3),h="",d=u,f=!1,p=0,y=n.headers||{},g=n.Transport,m=$&&null==g?void 0:new w(null!=g?new g:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),v=null!=g&&"string"!=typeof g?new g:null==m?new x:new E,b=void 0,C=0,T=F,O="",_="",S="",B="",V=D,J=0,G=0,X=function(e,n,r,o){if(T===R)if(200===e&&null!=r&&W.test(r)){T=I,f=Date.now(),d=u,t.readyState=I;var i=new A("open",{status:e,statusText:n,headers:o});t.dispatchEvent(i),L(t,t.onopen,i)}else{var s="";200!==e?(n&&(n=n.replace(/\s+/g," ")),s="EventSource's response has a status "+e+" "+n+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",Z();i=new A("error",{status:e,statusText:n,headers:o});t.dispatchEvent(i),L(t,t.onerror,i),console.error(s)}},Y=function(e){if(T===I){for(var n=-1,i=0;i<e.length;i+=1){(c=e.charCodeAt(i))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(n=i)}var s=(-1!==n?B:"")+e.slice(0,n+1);B=(-1===n?B:"")+e.slice(n+1),""!==e&&(f=Date.now(),p+=e.length);for(var a=0;a<s.length;a+=1){var c=s.charCodeAt(a);if(V===P&&c==="\n".charCodeAt(0))V=D;else if(V===P&&(V=D),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(V!==D){V===q&&(G=a+1);var y=s.slice(J,G-1),g=s.slice(G+(G<a&&s.charCodeAt(G)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=g):"id"===y?_=g:"event"===y?S=g:"retry"===y?(u=z(g,u),d=u):"heartbeatTimeout"===y&&(l=z(g,l),0!==C&&(o(C),C=r((function(){Q()}),l)))}if(V===D){if(""!==O){h=_,""===S&&(S="message");var m=new j(S,{data:O.slice(1),lastEventId:_});if(t.dispatchEvent(m),"open"===S?L(t,t.onopen,m):"message"===S?L(t,t.onmessage,m):"error"===S&&L(t,t.onerror,m),T===M)return}O="",S=""}V=c==="\r".charCodeAt(0)?P:D}else V===D&&(J=a,V=q),V===q?c===":".charCodeAt(0)&&(G=a+1,V=N):V===N&&(V=H)}}},K=function(e){if(T===I||T===R){T=F,0!==C&&(o(C),C=0),C=r((function(){Q()}),d),d=U(Math.min(16*u,2*d)),t.readyState=R;var n=new k("error",{error:e});t.dispatchEvent(n),L(t,t.onerror,n),null!=e&&console.error(e)}},Z=function(){T=M,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),t.readyState=M},Q=function(){if(C=0,T===F){f=!1,p=0,C=r((function(){Q()}),l),T=R,O="",S="",_=h,B="",J=0,G=0,V=D;var n=e;if("data:"!==e.slice(0,5)&&"blob:"!==e.slice(0,5)&&""!==h){var o=e.indexOf("?");n=-1===o?e:e.slice(0,o+1)+e.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(t,e){return e===c?"":t})),n+=(-1===e.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var i=t.withCredentials,s={Accept:"text/event-stream"},a=t.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u]);try{b=v.open(m,X,Y,K,n,i,s)}catch(t){throw Z(),t}}else if(f||null==b){var d=Math.max((f||Date.now())+l-Date.now(),1);f=!1,C=r((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(T===R?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};t.url=e,t.readyState=R,t.withCredentials=a,t.headers=y,t._close=Z,Q()}(this,t,e)}var $=null!=h&&null!=d&&"body"in d.prototype;B.prototype=Object.create(O.prototype),B.prototype.CONNECTING=R,B.prototype.OPEN=I,B.prototype.CLOSED=M,B.prototype.close=function(){this._close()},B.CONNECTING=R,B.OPEN=I,B.CLOSED=M,B.prototype.withCredentials=void 0;var V,J=c;null==i||null!=c&&"withCredentials"in c.prototype||(J=B),V=function(t){t.EventSourcePolyfill=B,t.NativeEventSource=c,t.EventSource=J}(e),void 0!==V&&(t.exports=V)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:s:globalThis)}({get exports(){return bt},set exports(t){bt=t}},bt);var Ct=bt.EventSourcePolyfill;const Et=5;class Tt extends Error{constructor(t){const e=Ot(t);super(e.message),this.statusCode=400,Object.assign(this,e)}}class xt extends Error{constructor(t){const e=Ot(t);super(e.message),this.statusCode=500,Object.assign(this,e)}}function Ot(t){const e=t.body,n={response:t,statusCode:t.statusCode,responseBody:St(e,t),message:"",details:void 0};if(e.error&&e.message)return n.message="".concat(e.error," - ").concat(e.message),n;if(function(t){return _t(t)&&_t(t.error)&&"mutationError"===t.error.type&&"string"==typeof t.error.description}(e)){const t=e.error.items||[],r=t.slice(0,Et).map((t=>{var e;return null==(e=t.error)?void 0:e.description})).filter(Boolean);let o=r.length?":\n- ".concat(r.join("\n- ")):"";return t.length>Et&&(o+="\n...and ".concat(t.length-Et," more")),n.message="".concat(e.error.description).concat(o),n.details=e.error,n}return e.error&&e.error.description?(n.message=e.error.description,n.details=e.error,n):(n.message=e.error||e.message||function(t){const e=t.statusMessage?" ".concat(t.statusMessage):"";return"".concat(t.method,"-request to ").concat(t.url," resulted in HTTP ").concat(t.statusCode).concat(e)}(t),n)}function _t(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function St(t,e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t}const jt={onResponse:t=>{if(t.statusCode>=500)throw new xt(t);if(t.statusCode>=400)throw new Tt(t);return t}},At={onResponse:t=>{const e=t.headers["x-sanity-warning"];return(Array.isArray(e)?e:[e]).filter(Boolean).forEach((t=>console.warn(t))),t}};const kt="X-Sanity-Project-ID";function Ft(t){if("string"==typeof t||Array.isArray(t))return{id:t};if("object"==typeof t&&null!==t&&"query"in t&&"string"==typeof t.query)return"params"in t&&"object"==typeof t.params&&null!==t.params?{query:t.query,params:t.params}:{query:t.query};const e=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(e))}const Rt=["image","file"],It=["before","after","replace"],Mt=t=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},Pt=t=>{if(-1===Rt.indexOf(t))throw new Error("Invalid asset type: ".concat(t,". Must be one of ").concat(Rt.join(", ")))},Dt=(t,e)=>{if(null===e||"object"!=typeof e||Array.isArray(e))throw new Error("".concat(t,"() takes an object of properties"))},qt=(t,e)=>{if("string"!=typeof e||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(e)||e.includes(".."))throw new Error("".concat(t,'(): "').concat(e,'" is not a valid document ID'))},Nt=(t,e)=>{if(!e._id)throw new Error("".concat(t,'() requires that the document contains an ID ("_id" property)'));qt(t,e._id)},Ht=t=>{if(!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},Wt=t=>{if("string"!=typeof t||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t},zt=t=>{let{query:e,params:n={},options:r={}}=t;const o=new URLSearchParams,{tag:i,...s}=r;i&&o.set("tag",i),o.set("query",e);for(const[t,e]of Object.entries(n))o.set("$".concat(t),JSON.stringify(e));for(const[t,e]of Object.entries(s))e&&o.set(t,"".concat(e));return"?".concat(o)};var Ut,Lt,Bt=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},$t=(t,e,n)=>(Bt(t,e,"read from private field"),n?n.call(t):e.get(t)),Vt=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Jt=(t,e,n,r)=>(Bt(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class Gt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=t,this.operations=e}set(t){return this._assign("set",t)}setIfMissing(t){return this._assign("setIfMissing",t)}diffMatchPatch(t){return Dt("diffMatchPatch",t),this._assign("diffMatchPatch",t)}unset(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:t}),this}inc(t){return this._assign("inc",t)}dec(t){return this._assign("dec",t)}insert(t,e,n){return((t,e,n)=>{const r="insert(at, selector, items)";if(-1===It.indexOf(t)){const t=It.map((t=>'"'.concat(t,'"'))).join(", ");throw new Error("".concat(r,' takes an "at"-argument which is one of: ').concat(t))}if("string"!=typeof e)throw new Error("".concat(r,' takes a "selector"-argument which must be a string'));if(!Array.isArray(n))throw new Error("".concat(r,' takes an "items"-argument which must be an array'))})(t,e,n),this._assign("insert",{[t]:e,items:n})}append(t,e){return this.insert("after","".concat(t,"[-1]"),e)}prepend(t,e){return this.insert("before","".concat(t,"[0]"),e)}splice(t,e,n,r){const o=e<0?e-1:e,i=void 0===n||-1===n?-1:Math.max(0,e+n),s=o<0&&i>=0?"":i,a="".concat(t,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,r||[])}ifRevisionId(t){return this.operations.ifRevisionID=t,this}serialize(){return{...Ft(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return Dt(t,e),this.operations=Object.assign({},this.operations,{[t]:Object.assign({},n&&this.operations[t]||{},e)}),this}_set(t,e){return this._assign(t,e,!1)}}const Xt=class extends Gt{constructor(t,e,n){super(t,e),Vt(this,Ut,void 0),Jt(this,Ut,n)}clone(){return new Xt(this.selection,{...this.operations},$t(this,Ut))}commit(t){if(!$t(this,Ut))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const e="string"==typeof this.selection,n=Object.assign({returnFirst:e,returnDocuments:!0},t);return $t(this,Ut).mutate({patch:this.serialize()},n)}};let Yt=Xt;Ut=new WeakMap;const Kt=class extends Gt{constructor(t,e,n){super(t,e),Vt(this,Lt,void 0),Jt(this,Lt,n)}clone(){return new Kt(this.selection,{...this.operations},$t(this,Lt))}commit(t){if(!$t(this,Lt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const e="string"==typeof this.selection,n=Object.assign({returnFirst:e,returnDocuments:!0},t);return $t(this,Lt).mutate({patch:this.serialize()},n)}};let Zt=Kt;Lt=new WeakMap;var Qt,te,ee=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},ne=(t,e,n)=>(ee(t,e,"read from private field"),n?n.call(t):e.get(t)),re=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},oe=(t,e,n,r)=>(ee(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);const ie={returnDocuments:!1};class se{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;this.operations=t,this.trxId=e}create(t){return Dt("create",t),this._add({create:t})}createIfNotExists(t){const e="createIfNotExists";return Dt(e,t),Nt(e,t),this._add({[e]:t})}createOrReplace(t){const e="createOrReplace";return Dt(e,t),Nt(e,t),this._add({[e]:t})}delete(t){return qt("delete",t),this._add({delete:{id:t}})}transactionId(t){return t?(this.trxId=t,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(t){return this.operations.push(t),this}}const ae=class extends se{constructor(t,e,n){super(t,n),re(this,Qt,void 0),oe(this,Qt,e)}clone(){return new ae([...this.operations],ne(this,Qt),this.trxId)}commit(t){if(!ne(this,Qt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return ne(this,Qt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},ie,t||{}))}patch(t,e){const n="function"==typeof e;if("string"!=typeof t&&t instanceof Zt)return this._add({patch:t.serialize()});if(n){const n=e(new Zt(t,{},ne(this,Qt)));if(!(n instanceof Zt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:t,...e}})}};let ce=ae;Qt=new WeakMap;const ue=class extends se{constructor(t,e,n){super(t,n),re(this,te,void 0),oe(this,te,e)}clone(){return new ue([...this.operations],ne(this,te),this.trxId)}commit(t){if(!ne(this,te))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return ne(this,te).mutate(this.serialize(),Object.assign({transactionId:this.trxId},ie,t||{}))}patch(t,e){const n="function"==typeof e;if("string"!=typeof t&&t instanceof Yt)return this._add({patch:t.serialize()});if(n){const n=e(new Yt(t,{},ne(this,te)));if(!(n instanceof Yt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:t,...e}})}};let le=ue;te=new WeakMap;const he=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:t.dryRun,returnIds:!0,returnDocuments:(e=t.returnDocuments,n=!0,!1===e?void 0:void 0===e?n:e),visibility:t.visibility||"sync",autoGenerateArrayKeys:t.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:t.skipCrossDatasetReferenceValidation};var e,n},de=t=>"response"===t.type,fe=t=>t.body,pe=(t,e)=>t.reduce(((t,n)=>(t[e(n)]=n,t)),Object.create(null)),ye=11264;function ge(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const i=!1===o.filterResponse?t=>t:t=>t.result;return Te(t,e,"query",{query:n,params:r},o).pipe(vt(i))}function me(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Oe(t,e,{uri:Se(t,"doc",n),json:!0,tag:r.tag}).pipe(wt(de),vt((t=>t.body.documents&&t.body.documents[0])))}function ve(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Oe(t,e,{uri:Se(t,"doc",n.join(",")),json:!0,tag:r.tag}).pipe(wt(de),vt((t=>{const e=pe(t.body.documents||[],(t=>t._id));return n.map((t=>e[t]||null))})))}function we(t,e,n,r){return Nt("createIfNotExists",n),xe(t,e,n,"createIfNotExists",r)}function be(t,e,n,r){return Nt("createOrReplace",n),xe(t,e,n,"createOrReplace",r)}function Ce(t,e,n,r){return Te(t,e,"mutate",{mutations:[{delete:Ft(n)}]},r)}function Ee(t,e,n,r){const o=n instanceof Zt||n instanceof Yt||n instanceof ce||n instanceof le?n.serialize():n;return Te(t,e,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId},r)}function Te(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const i="mutate"===n,s="query"===n,a=i?"":zt(r),c=!i&&a.length<ye,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:f,headers:p}=o;return Oe(t,e,{method:c?"GET":"POST",uri:Se(t,n,u),json:!0,body:c?void 0:r,query:i&&he(o),timeout:h,headers:p,token:d,tag:f,canUseCdn:s,signal:o.signal}).pipe(wt(de),vt(fe),vt((t=>{if(!i)return t;const e=t.results||[];if(o.returnDocuments)return l?e[0]&&e[0].document:e.map((t=>t.document));const n=l?"documentId":"documentIds",r=l?e[0]&&e[0].id:e.map((t=>t.id));return{transactionId:t.transactionId,results:e,[n]:r}})))}function xe(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Te(t,e,"mutate",{mutations:[{[r]:n}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Oe(t,e,n){const r=n.url||n.uri,o=t.config(),i=void 0===n.canUseCdn?["GET","HEAD"].indexOf(n.method||"GET")>=0&&0===r.indexOf("/data/"):n.canUseCdn,s=o.useCdn&&i,a=n.tag&&o.requestTagPrefix?[o.requestTagPrefix,n.tag].join("."):n.tag||o.requestTagPrefix;a&&(n.query={tag:Wt(a),...n.query});const c=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={},r=e.token||t.token;r&&(n.Authorization="Bearer ".concat(r)),e.useGlobalApi||t.useProjectHostname||!t.projectId||(n[kt]=t.projectId);const o=Boolean(void 0===e.withCredentials?t.token||t.withCredentials:e.withCredentials),i=void 0===e.timeout?t.timeout:e.timeout;return Object.assign({},e,{headers:Object.assign({},n,e.headers||{}),timeout:void 0===i?3e5:i,proxy:e.proxy||t.proxy,json:!0,withCredentials:o})}(o,Object.assign({},n,{url:je(t,r,s)})),u=new ht((t=>e(c,o.requester).subscribe(t)));return n.signal?u.pipe((l=n.signal,t=>new ht((e=>{const n=()=>e.error(function(t){var e,n;if(Ae)return new DOMException(null!=(e=null==t?void 0:t.reason)?e:"The operation was aborted.","AbortError");const r=new Error(null!=(n=null==t?void 0:t.reason)?n:"The operation was aborted.");return r.name="AbortError",r}(l));if(l&&l.aborted)return void n();const r=t.subscribe(e);return l.addEventListener("abort",n),()=>{l.removeEventListener("abort",n),r.unsubscribe()}})))):u;var l}function _e(t,e,n){return Oe(t,e,n).pipe(wt((t=>"response"===t.type)),vt((t=>t.body)))}function Se(t,e,n){const r=t.config(),o=Ht(r),i="/".concat(e,"/").concat(o),s=n?"".concat(i,"/").concat(n):i;return"/data".concat(s).replace(/\/($|\?)/,"$1")}function je(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:r,cdnUrl:o}=t.config();return"".concat(n?o:r,"/").concat(e.replace(/^\//,""))}const Ae=Boolean(globalThis.DOMException);var ke,Fe,Re,Ie,Me=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Pe=(t,e,n)=>(Me(t,e,"read from private field"),n?n.call(t):e.get(t)),De=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},qe=(t,e,n,r)=>(Me(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class Ne{constructor(t,e){De(this,ke,void 0),De(this,Fe,void 0),qe(this,ke,t),qe(this,Fe,e)}upload(t,e,n){return We(Pe(this,ke),Pe(this,Fe),t,e,n)}}ke=new WeakMap,Fe=new WeakMap;class He{constructor(t,e){De(this,Re,void 0),De(this,Ie,void 0),qe(this,Re,t),qe(this,Ie,e)}upload(t,e,n){return mt(We(Pe(this,Re),Pe(this,Ie),t,e,n).pipe(wt((t=>"response"===t.type)),vt((t=>t.body.document))))}}function We(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Pt(n);let i=o.extract||void 0;i&&!i.length&&(i=["none"]);const s=Ht(t.config()),a="image"===n?"images":"files",c=function(t,e){if("undefined"==typeof window||!(e instanceof window.File))return t;return Object.assign({filename:!1===t.preserveFilename?void 0:e.name,contentType:e.type},t)}(o,r),{tag:u,label:l,title:h,description:d,creditLine:f,filename:p,source:y}=c,g={label:l,title:h,description:d,filename:p,meta:i,creditLine:f};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),Oe(t,e,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(s),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:r})}Re=new WeakMap,Ie=new WeakMap;const ze="https://www.sanity.io/help/";function Ue(t){return ze+t}const Le=t=>function(t){let e,n=!1;return function(){return n||(e=t(...arguments),n=!0),e}}((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return console.warn(t.join(" "),...n)})),Be=Le(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat(Ue("js-client-cdn-configuration")," "),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),$e=Le(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Ue("js-client-browser-token")," for more information and how to hide this warning.")]),Ve=Le(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Ue("js-client-api-version"))]),Je=Le(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead"]),Ge={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Xe=["localhost","127.0.0.1","0.0.0.0"],Ye=(t,e)=>{const n=Object.assign({},e,t);n.apiVersion||Ve();const r=Object.assign({},Ge,n),o=r.useProjectHostname;if("undefined"==typeof Promise){const t=Ue("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(t))}if(o&&!r.projectId)throw new Error("Configuration must contain `projectId`");const i="undefined"!=typeof window&&window.location&&window.location.hostname,s=i&&(t=>-1!==Xe.indexOf(t))(window.location.hostname);i&&s&&r.token&&!0!==r.ignoreBrowserTokenWarning?$e():void 0===r.useCdn&&Be(),o&&(t=>{if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(r.projectId),r.dataset&&Mt(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?Wt(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===Ge.apiHost,r.useCdn=Boolean(r.useCdn)&&!r.withCredentials,function(t){if("1"===t||"X"===t)return;const e=new Date(t);if(!(/^\d{4}-\d{2}-\d{2}$/.test(t)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(r.apiVersion);const a=r.apiHost.split("://",2),c=a[0],u=a[1],l=r.isDefaultApi?"apicdn.sanity.io":u;return r.useProjectHostname?(r.url="".concat(c,"://").concat(r.projectId,".").concat(u,"/v").concat(r.apiVersion),r.cdnUrl="".concat(c,"://").concat(r.projectId,".").concat(l,"/v").concat(r.apiVersion)):(r.url="".concat(r.apiHost,"/v").concat(r.apiVersion),r.cdnUrl=r.url),r};var Ke=(t,e)=>Object.keys(e).concat(Object.keys(t)).reduce(((n,r)=>(n[r]=void 0===t[r]?e[r]:t[r],n)),{});const Ze=(t,e)=>e.reduce(((e,n)=>(void 0===t[n]||(e[n]=t[n]),e)),{}),Qe=14800,tn=Ct,en=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],nn={includeResult:!0};function rn(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:r,token:o,withCredentials:i,requestTagPrefix:s}=this.config(),a=n.tag&&s?[s,n.tag].join("."):n.tag,c={...Ke(n,nn),tag:a},u=Ze(c,en),l=zt({query:t,params:e,options:{tag:a,...u}}),h="".concat(r).concat(Se(this,"listen",l));if(h.length>Qe)return new ht((t=>t.error(new Error("Query too large for listener"))));const d=c.events?c.events:["mutation"],f=-1!==d.indexOf("reconnect"),p={};return(o||i)&&(p.withCredentials=!0),o&&(p.headers={Authorization:"Bearer ".concat(o)}),new ht((t=>{let e,n=u(),r=!1;function o(){r||(f&&t.next({type:"reconnect"}),r||n.readyState===tn.CLOSED&&(c(),clearTimeout(e),e=setTimeout(l,100)))}function i(e){t.error(function(t){if(t instanceof Error)return t;const e=on(t);return e instanceof Error?e:new Error(function(t){if(!t.error)return t.message||"Unknown listener error";if(t.error.description)return t.error.description;return"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2)}(e))}(e))}function s(e){const n=on(e);return n instanceof Error?t.error(n):t.next(n)}function a(){r=!0,c(),t.complete()}function c(){n.removeEventListener("error",o),n.removeEventListener("channelError",i),n.removeEventListener("disconnect",a),d.forEach((t=>n.removeEventListener(t,s))),n.close()}function u(){const t=new tn(h,p);return t.addEventListener("error",o),t.addEventListener("channelError",i),t.addEventListener("disconnect",a),d.forEach((e=>t.addEventListener(e,s))),t}function l(){n=u()}return function(){r=!0,c()}}))}function on(t){try{const e=t.data&&JSON.parse(t.data)||{};return Object.assign({type:t.type},e)}catch(t){return t}}var sn,an,cn,un,ln=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},hn=(t,e,n)=>(ln(t,e,"read from private field"),n?n.call(t):e.get(t)),dn=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},fn=(t,e,n,r)=>(ln(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class pn{constructor(t,e){dn(this,sn,void 0),dn(this,an,void 0),fn(this,sn,t),fn(this,an,e)}create(t,e){return gn(hn(this,sn),hn(this,an),"PUT",t,e)}edit(t,e){return gn(hn(this,sn),hn(this,an),"PATCH",t,e)}delete(t){return gn(hn(this,sn),hn(this,an),"DELETE",t)}list(){return _e(hn(this,sn),hn(this,an),{uri:"/datasets"})}}sn=new WeakMap,an=new WeakMap;class yn{constructor(t,e){dn(this,cn,void 0),dn(this,un,void 0),fn(this,cn,t),fn(this,un,e)}create(t,e){return mt(gn(hn(this,cn),hn(this,un),"PUT",t,e))}edit(t,e){return mt(gn(hn(this,cn),hn(this,un),"PATCH",t,e))}delete(t){return mt(gn(hn(this,cn),hn(this,un),"DELETE",t))}list(){return mt(_e(hn(this,cn),hn(this,un),{uri:"/datasets"}))}}function gn(t,e,n,r,o){return Mt(r),_e(t,e,{method:n,uri:"/datasets/".concat(r),body:o})}cn=new WeakMap,un=new WeakMap;var mn,vn,wn,bn,Cn=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},En=(t,e,n)=>(Cn(t,e,"read from private field"),n?n.call(t):e.get(t)),Tn=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},xn=(t,e,n,r)=>(Cn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class On{constructor(t,e){Tn(this,mn,void 0),Tn(this,vn,void 0),xn(this,mn,t),xn(this,vn,e)}list(){return _e(En(this,mn),En(this,vn),{uri:"/projects"})}getById(t){return _e(En(this,mn),En(this,vn),{uri:"/projects/".concat(t)})}}mn=new WeakMap,vn=new WeakMap;class _n{constructor(t,e){Tn(this,wn,void 0),Tn(this,bn,void 0),xn(this,wn,t),xn(this,bn,e)}list(){return mt(_e(En(this,wn),En(this,bn),{uri:"/projects"}))}getById(t){return mt(_e(En(this,wn),En(this,bn),{uri:"/projects/".concat(t)}))}}wn=new WeakMap,bn=new WeakMap;var Sn,jn,An,kn,Fn=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Rn=(t,e,n)=>(Fn(t,e,"read from private field"),n?n.call(t):e.get(t)),In=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Mn=(t,e,n,r)=>(Fn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class Pn{constructor(t,e){In(this,Sn,void 0),In(this,jn,void 0),Mn(this,Sn,t),Mn(this,jn,e)}getById(t){return _e(Rn(this,Sn),Rn(this,jn),{uri:"/users/".concat(t)})}}Sn=new WeakMap,jn=new WeakMap;class Dn{constructor(t,e){In(this,An,void 0),In(this,kn,void 0),Mn(this,An,t),Mn(this,kn,e)}getById(t){return mt(_e(Rn(this,An),Rn(this,kn),{uri:"/users/".concat(t)}))}}An=new WeakMap,kn=new WeakMap;var qn,Nn,Hn,Wn,zn=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Un=(t,e,n)=>(zn(t,e,"read from private field"),n?n.call(t):e.get(t)),Ln=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Bn=(t,e,n,r)=>(zn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);const $n=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ge;Ln(this,qn,void 0),Ln(this,Nn,void 0),this.listen=rn,this.config(e),Bn(this,Nn,t),this.assets=new Ne(this,Un(this,Nn)),this.datasets=new pn(this,Un(this,Nn)),this.projects=new On(this,Un(this,Nn)),this.users=new Pn(this,Un(this,Nn))}clone(){return new $n(Un(this,Nn),this.config())}config(t){if(void 0===t)return{...Un(this,qn)};if(Un(this,qn)&&!1===Un(this,qn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Bn(this,qn,Ye(t,Un(this,qn)||{})),this}withConfig(t){return new $n(Un(this,Nn),{...this.config(),...t})}fetch(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ge(this,Un(this,Nn),t,e,n)}getDocument(t,e){return me(this,Un(this,Nn),t,e)}getDocuments(t,e){return ve(this,Un(this,Nn),t,e)}create(t,e){return xe(this,Un(this,Nn),t,"create",e)}createIfNotExists(t,e){return we(this,Un(this,Nn),t,e)}createOrReplace(t,e){return be(this,Un(this,Nn),t,e)}delete(t,e){return Ce(this,Un(this,Nn),t,e)}mutate(t,e){return Ee(this,Un(this,Nn),t,e)}patch(t,e){return new Yt(t,e,this)}transaction(t){return new le(t,this)}request(t){return _e(this,Un(this,Nn),t)}getUrl(t,e){return je(this,t,e)}getDataUrl(t,e){return Se(this,t,e)}};let Vn=$n;qn=new WeakMap,Nn=new WeakMap;const Jn=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ge;Ln(this,Hn,void 0),Ln(this,Wn,void 0),this.listen=rn,this.config(e),Bn(this,Wn,t),this.assets=new He(this,Un(this,Wn)),this.datasets=new yn(this,Un(this,Wn)),this.projects=new _n(this,Un(this,Wn)),this.users=new Dn(this,Un(this,Wn)),this.observable=new Vn(t,e)}clone(){return new Jn(Un(this,Wn),this.config())}config(t){if(void 0===t)return{...Un(this,Hn)};if(Un(this,Hn)&&!1===Un(this,Hn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(t),Bn(this,Hn,Ye(t,Un(this,Hn)||{})),this}withConfig(t){return new Jn(Un(this,Wn),{...this.config(),...t})}fetch(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return mt(ge(this,Un(this,Wn),t,e,n))}getDocument(t,e){return mt(me(this,Un(this,Wn),t,e))}getDocuments(t,e){return mt(ve(this,Un(this,Wn),t,e))}create(t,e){return mt(xe(this,Un(this,Wn),t,"create",e))}createIfNotExists(t,e){return mt(we(this,Un(this,Wn),t,e))}createOrReplace(t,e){return mt(be(this,Un(this,Wn),t,e))}delete(t,e){return mt(Ce(this,Un(this,Wn),t,e))}mutate(t,e){return mt(Ee(this,Un(this,Wn),t,e))}patch(t,e){return new Zt(t,e,this)}transaction(t){return new ce(t,this)}request(t){return mt(_e(this,Un(this,Wn),t))}dataRequest(t,e,n){return mt(Te(this,Un(this,Wn),t,e,n))}getUrl(t,e){return je(this,t,e)}getDataUrl(t,e){return Se(this,t,e)}};let Gn=Jn;Hn=new WeakMap,Wn=new WeakMap;const Xn=function(t){const e=O([...t,At,M(),P(),{onRequest:t=>{if("xhr"!==t.adapter)return;const e=t.request,n=t.context;function r(t){return e=>{const r=e.lengthComputable?e.loaded/e.total*100:-1;n.channels.progress.publish({stage:t,percent:r,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=r("upload")),"onprogress"in e&&(e.onprogress=r("download"))}},jt,N({implementation:ht})]);function n(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:e)({maxRedirects:0,...t})}return n.defaultRequester=e,n}([]),Yn=Xn.defaultRequester;t.BasePatch=Gt,t.BaseTransaction=se,t.ClientError=Tt,t.ObservablePatch=Yt,t.ObservableSanityClient=Vn,t.ObservableTransaction=le,t.Patch=Zt,t.SanityClient=Gn,t.ServerError=xt,t.Transaction=ce,t.createClient=t=>new Gn(Xn,t),t.default=function(t){return Je(),new Gn(Xn,t)},t.requester=Yn,Object.defineProperty(t,"__esModule",{value:!0})}));
|