@sanity/client 6.4.8 → 6.4.9
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 +6 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +6 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/data/dataMethods.ts +7 -1
- package/src/warnings.ts +5 -0
- package/umd/sanityClient.js +6 -1
- package/umd/sanityClient.min.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/client",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.9",
|
|
4
4
|
"description": "Client for retrieving, creating and patching data from Sanity.io",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"eslint-plugin-prettier": "^5.0.0",
|
|
113
113
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
114
114
|
"faucet": "^0.0.4",
|
|
115
|
-
"happy-dom": "^10.10.
|
|
115
|
+
"happy-dom": "^10.10.4",
|
|
116
116
|
"ls-engines": "^0.9.0",
|
|
117
117
|
"nock": "^13.3.3",
|
|
118
118
|
"prettier": "^3.0.2",
|
package/src/data/dataMethods.ts
CHANGED
|
@@ -29,6 +29,7 @@ import type {
|
|
|
29
29
|
import {getSelection} from '../util/getSelection'
|
|
30
30
|
import * as validate from '../validators'
|
|
31
31
|
import * as validators from '../validators'
|
|
32
|
+
import {printCdnPreviewDraftsWarning} from '../warnings'
|
|
32
33
|
import {encodeQueryString} from './encodeQueryString'
|
|
33
34
|
import {ObservablePatch, Patch} from './patch'
|
|
34
35
|
import {ObservableTransaction, Transaction} from './transaction'
|
|
@@ -306,7 +307,7 @@ export function _requestObservable<R>(
|
|
|
306
307
|
? ['GET', 'HEAD'].indexOf(options.method || 'GET') >= 0 && uri.indexOf('/data/') === 0
|
|
307
308
|
: options.canUseCdn
|
|
308
309
|
|
|
309
|
-
|
|
310
|
+
let useCdn = config.useCdn && canUseCdn
|
|
310
311
|
|
|
311
312
|
const tag =
|
|
312
313
|
options.tag && config.requestTagPrefix
|
|
@@ -329,6 +330,11 @@ export function _requestObservable<R>(
|
|
|
329
330
|
if (typeof perspective === 'string' && perspective !== 'raw') {
|
|
330
331
|
validateApiPerspective(perspective)
|
|
331
332
|
options.query = {perspective, ...options.query}
|
|
333
|
+
// If the perspective is set to `previewDrafts` we can't use the CDN, the API will throw
|
|
334
|
+
if (perspective === 'previewDrafts' && useCdn) {
|
|
335
|
+
useCdn = false
|
|
336
|
+
printCdnPreviewDraftsWarning()
|
|
337
|
+
}
|
|
332
338
|
}
|
|
333
339
|
}
|
|
334
340
|
|
package/src/warnings.ts
CHANGED
|
@@ -12,6 +12,11 @@ export const printCdnWarning = createWarningPrinter([
|
|
|
12
12
|
`\`useCdn: false\` to use the Live API. Note: You may incur higher costs using the live API.`,
|
|
13
13
|
])
|
|
14
14
|
|
|
15
|
+
export const printCdnPreviewDraftsWarning = createWarningPrinter([
|
|
16
|
+
`The Sanity client is configured with the \`perspective\` set to \`previewDrafts\`, which doesn't support the API-CDN.`,
|
|
17
|
+
`The Live API will be used instead. Set \`useCdn: false\` in your configuration to hide this warning.`,
|
|
18
|
+
])
|
|
19
|
+
|
|
15
20
|
export const printBrowserTokenWarning = createWarningPrinter([
|
|
16
21
|
'You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.',
|
|
17
22
|
`See ${generateHelpUrl(
|
package/umd/sanityClient.js
CHANGED
|
@@ -2365,6 +2365,7 @@
|
|
|
2365
2365
|
return console.warn(message.join(" "), ...args);
|
|
2366
2366
|
});
|
|
2367
2367
|
const printCdnWarning = createWarningPrinter(["Since you haven't set a value for `useCdn`, we will deliver content using our", "global, edge-cached API-CDN. If you wish to have content delivered faster, set", "`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]);
|
|
2368
|
+
const printCdnPreviewDraftsWarning = createWarningPrinter(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.", "The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]);
|
|
2368
2369
|
const printBrowserTokenWarning = createWarningPrinter(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.", "See ".concat(generateHelpUrl("js-client-browser-token"), " for more information and how to hide this warning.")]);
|
|
2369
2370
|
const printNoApiVersionSpecifiedWarning = createWarningPrinter(["Using the Sanity client without specifying an API version is deprecated.", "See ".concat(generateHelpUrl("js-client-api-version"))]);
|
|
2370
2371
|
const printNoDefaultExport = createWarningPrinter(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]);
|
|
@@ -3145,7 +3146,7 @@
|
|
|
3145
3146
|
const uri = options.url || options.uri;
|
|
3146
3147
|
const config = client.config();
|
|
3147
3148
|
const canUseCdn = typeof options.canUseCdn === "undefined" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/") === 0 : options.canUseCdn;
|
|
3148
|
-
|
|
3149
|
+
let useCdn = config.useCdn && canUseCdn;
|
|
3149
3150
|
const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
|
|
3150
3151
|
if (tag) {
|
|
3151
3152
|
options.query = {
|
|
@@ -3167,6 +3168,10 @@
|
|
|
3167
3168
|
perspective,
|
|
3168
3169
|
...options.query
|
|
3169
3170
|
};
|
|
3171
|
+
if (perspective === "previewDrafts" && useCdn) {
|
|
3172
|
+
useCdn = false;
|
|
3173
|
+
printCdnPreviewDraftsWarning();
|
|
3174
|
+
}
|
|
3170
3175
|
}
|
|
3171
3176
|
}
|
|
3172
3177
|
const reqOptions = requestOptions(config, Object.assign({}, options, {
|
package/umd/sanityClient.min.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";const t={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4},r=function(e){const r={...t,..."string"==typeof e?{url:e}:e},{searchParams:o}=new URL(r.url,"http://localhost");if(r.timeout=n(r.timeout),r.query)for(const[e,t]of Object.entries(r.query))if(void 0!==t)if(Array.isArray(t))for(const r of t)o.append(e,r);else o.append(e,t);const[s]=r.url.split("?"),i=o.toString();return i&&(r.url="".concat(s,"?").concat(i)),r.method=r.body&&!r.method?"POST":(r.method||"GET").toUpperCase(),r};function n(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const r=Number(e);return isNaN(r)?n(t.timeout):{connect:r,socket:r}}const o=/^https?:\/\//i,s=function(e){if(!o.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))};var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c=function(e){return e.replace(/^\s+|\s+$/g,"")},u=a((function(e){if(!e)return{};for(var t,r={},n=c(e).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),a=c(s.slice(0,i)).toLowerCase(),u=c(s.slice(i+1));void 0===r[a]?r[a]=u:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(u):r[a]=[r[a],u])}return r}));const l=["request","response","progress","error","abort"],h=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function d(e,t){const n=[],o=h.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[s]});function i(e){const r=l.reduce(((e,t)=>(e[t]=function(){const e=Object.create(null);let t=0;return{publish:function(t){for(const r in e)e[r](t)},subscribe:function(r){const n=t++;return e[n]=r,function(){delete e[n]}}}}(),e)),{}),n=(e=>function(t,r){const n="onError"===t;let o=r;for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(let r=0;r<e[t].length&&(o=(0,e[t][r])(o,...i),!n||o);r++);return o})(o),s=n("processOptions",e);n("validateOptions",s);const i={options:s,channels:r,applyMiddleware:n};let a;const c=r.request.subscribe((e=>{a=t(e,((t,o)=>((e,t,o)=>{let s=e,i=t;if(!s)try{i=n("onResponse",t,o)}catch(e){i=null,s=e}s=s&&n("onError",s,o),s?r.error.publish(s):i&&r.response.publish(i)})(t,o,e)))}));r.abort.subscribe((()=>{c(),a&&a.abort()}));const u=n("onReturn",r,i);return u===r&&r.request.publish(i),u}return i.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return h.forEach((t=>{e[t]&&o[t].push(e[t])})),n.push(e),i},i.clone=()=>d(n,t),e.forEach(i.use),i}var p,f,y,v,g,m,b,w=Object.defineProperty,C=(e,t,r)=>(((e,t,r)=>{t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),E=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},x=(e,t,r)=>(E(e,t,"read from private field"),r?r.call(e):t.get(e)),T=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},O=(e,t,r,n)=>(E(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class _{constructor(){C(this,"onabort"),C(this,"onerror"),C(this,"onreadystatechange"),C(this,"ontimeout"),C(this,"readyState",0),C(this,"response"),C(this,"responseText"),C(this,"responseType",""),C(this,"status"),C(this,"statusText"),C(this,"withCredentials"),T(this,p,void 0),T(this,f,void 0),T(this,y,void 0),T(this,v,{}),T(this,g,void 0),T(this,m,{}),T(this,b,void 0)}open(e,t,r){O(this,p,e),O(this,f,t),O(this,y,""),this.readyState=1,this.onreadystatechange(),O(this,g,void 0)}abort(){x(this,g)&&x(this,g).abort()}getAllResponseHeaders(){return x(this,y)}setRequestHeader(e,t){x(this,v)[e]=t}setInit(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];O(this,m,e),O(this,b,t)}send(e){const t="arraybuffer"!==this.responseType,r={...x(this,m),method:x(this,p),headers:x(this,v),body:e};"function"==typeof AbortController&&x(this,b)&&(O(this,g,new AbortController),"undefined"!=typeof EventTarget&&x(this,g).signal instanceof EventTarget&&(r.signal=x(this,g).signal)),"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(x(this,f),r).then((e=>(e.headers.forEach(((e,t)=>{O(this,y,x(this,y)+"".concat(t,": ").concat(e,"\r\n"))})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,t?e.text():e.arrayBuffer()))).then((e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{var t;"AbortError"!==e.name?null==(t=this.onerror)||t.call(this,e):this.onabort()}))}}p=new WeakMap,f=new WeakMap,y=new WeakMap,v=new WeakMap,g=new WeakMap,m=new WeakMap,b=new WeakMap;const S="function"==typeof XMLHttpRequest?"xhr":"fetch",j="xhr"===S?XMLHttpRequest:_,A=(e,t)=>{var r;const n=e.options,o=e.applyMiddleware("finalizeOptions",n),s={},i=e.applyMiddleware("interceptRequest",void 0,{adapter:S,context:e});if(i){const e=setTimeout(t,0,null,i);return{abort:()=>clearTimeout(e)}}let a=new j;a instanceof _&&"object"==typeof o.fetch&&a.setInit(o.fetch,null==(r=o.useAbortSignal)||r);const c=o.headers,l=o.timeout;let h=!1,d=!1,p=!1;if(a.onerror=e=>{v(new Error("Request error while attempting to reach ".concat(o.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},a.ontimeout=e=>{v(new Error("Request timeout while attempting to reach ".concat(o.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},a.onabort=()=>{y(!0),h=!0},a.onreadystatechange=()=>{!function(){if(!l)return;y(),s.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),l.socket)}(),h||4!==a.readyState||0!==a.status&&function(){if(h||d||p)return;if(0===a.status)return void v(new Error("Unknown XHR error"));y(),d=!0,t(null,{body:a.response||(""===a.responseType||"text"===a.responseType?a.responseText:""),url:o.url,method:o.method,headers:u(a.getAllResponseHeaders()),statusCode:a.status,statusMessage:a.statusText})}()},a.open(o.method,o.url,!0),a.withCredentials=!!o.withCredentials,c&&a.setRequestHeader)for(const e in c)c.hasOwnProperty(e)&&a.setRequestHeader(e,c[e]);return o.rawBody&&(a.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:o,adapter:S,request:a,context:e}),a.send(o.body||null),l&&(s.connect=setTimeout((()=>f("ETIMEDOUT")),l.connect)),{abort:function(){h=!0,a&&a.abort()}};function f(t){p=!0,a.abort();const r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(o.url):"Connection timed out on request to ".concat(o.url));r.code=t,e.channels.error.publish(r)}function y(e){(e||h||a.readyState>=2&&s.connect)&&clearTimeout(s.connect),s.socket&&clearTimeout(s.socket)}function v(e){if(d)return;y(!0),d=!0,a=null;const r=e||new Error("Network error while attempting to reach ".concat(o.url));r.isNetworkError=!0,r.request=o,t(r)}};var k,R,M={exports:{}};function F(){if(R)return k;R=1;var e=1e3,t=60*e,r=60*t,n=24*r,o=7*n,s=365.25*n;function i(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}return k=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(i){if((i=String(i)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var s=Math.abs(o);if(s>=n)return i(o,s,n,"day");if(s>=r)return i(o,s,r,"hour");if(s>=t)return i(o,s,t,"minute");if(s>=e)return i(o,s,e,"second");return o+" ms"}(a):function(o){var s=Math.abs(o);if(s>=n)return Math.round(o/n)+"d";if(s>=r)return Math.round(o/r)+"h";if(s>=t)return Math.round(o/t)+"m";if(s>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var I=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=F(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";const t={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4},r=function(e){const r={...t,..."string"==typeof e?{url:e}:e},{searchParams:o}=new URL(r.url,"http://localhost");if(r.timeout=n(r.timeout),r.query)for(const[e,t]of Object.entries(r.query))if(void 0!==t)if(Array.isArray(t))for(const r of t)o.append(e,r);else o.append(e,t);const[s]=r.url.split("?"),i=o.toString();return i&&(r.url="".concat(s,"?").concat(i)),r.method=r.body&&!r.method?"POST":(r.method||"GET").toUpperCase(),r};function n(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const r=Number(e);return isNaN(r)?n(t.timeout):{connect:r,socket:r}}const o=/^https?:\/\//i,s=function(e){if(!o.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))};var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c=function(e){return e.replace(/^\s+|\s+$/g,"")},u=a((function(e){if(!e)return{};for(var t,r={},n=c(e).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),a=c(s.slice(0,i)).toLowerCase(),u=c(s.slice(i+1));void 0===r[a]?r[a]=u:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(u):r[a]=[r[a],u])}return r}));const l=["request","response","progress","error","abort"],h=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function d(e,t){const n=[],o=h.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[s]});function i(e){const r=l.reduce(((e,t)=>(e[t]=function(){const e=Object.create(null);let t=0;return{publish:function(t){for(const r in e)e[r](t)},subscribe:function(r){const n=t++;return e[n]=r,function(){delete e[n]}}}}(),e)),{}),n=(e=>function(t,r){const n="onError"===t;let o=r;for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(let r=0;r<e[t].length&&(o=(0,e[t][r])(o,...i),!n||o);r++);return o})(o),s=n("processOptions",e);n("validateOptions",s);const i={options:s,channels:r,applyMiddleware:n};let a;const c=r.request.subscribe((e=>{a=t(e,((t,o)=>((e,t,o)=>{let s=e,i=t;if(!s)try{i=n("onResponse",t,o)}catch(e){i=null,s=e}s=s&&n("onError",s,o),s?r.error.publish(s):i&&r.response.publish(i)})(t,o,e)))}));r.abort.subscribe((()=>{c(),a&&a.abort()}));const u=n("onReturn",r,i);return u===r&&r.request.publish(i),u}return i.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return h.forEach((t=>{e[t]&&o[t].push(e[t])})),n.push(e),i},i.clone=()=>d(n,t),e.forEach(i.use),i}var p,f,y,v,g,m,b,w=Object.defineProperty,C=(e,t,r)=>(((e,t,r)=>{t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),E=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},x=(e,t,r)=>(E(e,t,"read from private field"),r?r.call(e):t.get(e)),T=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},O=(e,t,r,n)=>(E(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class S{constructor(){C(this,"onabort"),C(this,"onerror"),C(this,"onreadystatechange"),C(this,"ontimeout"),C(this,"readyState",0),C(this,"response"),C(this,"responseText"),C(this,"responseType",""),C(this,"status"),C(this,"statusText"),C(this,"withCredentials"),T(this,p,void 0),T(this,f,void 0),T(this,y,void 0),T(this,v,{}),T(this,g,void 0),T(this,m,{}),T(this,b,void 0)}open(e,t,r){O(this,p,e),O(this,f,t),O(this,y,""),this.readyState=1,this.onreadystatechange(),O(this,g,void 0)}abort(){x(this,g)&&x(this,g).abort()}getAllResponseHeaders(){return x(this,y)}setRequestHeader(e,t){x(this,v)[e]=t}setInit(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];O(this,m,e),O(this,b,t)}send(e){const t="arraybuffer"!==this.responseType,r={...x(this,m),method:x(this,p),headers:x(this,v),body:e};"function"==typeof AbortController&&x(this,b)&&(O(this,g,new AbortController),"undefined"!=typeof EventTarget&&x(this,g).signal instanceof EventTarget&&(r.signal=x(this,g).signal)),"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(x(this,f),r).then((e=>(e.headers.forEach(((e,t)=>{O(this,y,x(this,y)+"".concat(t,": ").concat(e,"\r\n"))})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,t?e.text():e.arrayBuffer()))).then((e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{var t;"AbortError"!==e.name?null==(t=this.onerror)||t.call(this,e):this.onabort()}))}}p=new WeakMap,f=new WeakMap,y=new WeakMap,v=new WeakMap,g=new WeakMap,m=new WeakMap,b=new WeakMap;const _="function"==typeof XMLHttpRequest?"xhr":"fetch",j="xhr"===_?XMLHttpRequest:S,A=(e,t)=>{var r;const n=e.options,o=e.applyMiddleware("finalizeOptions",n),s={},i=e.applyMiddleware("interceptRequest",void 0,{adapter:_,context:e});if(i){const e=setTimeout(t,0,null,i);return{abort:()=>clearTimeout(e)}}let a=new j;a instanceof S&&"object"==typeof o.fetch&&a.setInit(o.fetch,null==(r=o.useAbortSignal)||r);const c=o.headers,l=o.timeout;let h=!1,d=!1,p=!1;if(a.onerror=e=>{v(new Error("Request error while attempting to reach ".concat(o.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},a.ontimeout=e=>{v(new Error("Request timeout while attempting to reach ".concat(o.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},a.onabort=()=>{y(!0),h=!0},a.onreadystatechange=()=>{!function(){if(!l)return;y(),s.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),l.socket)}(),h||4!==a.readyState||0!==a.status&&function(){if(h||d||p)return;if(0===a.status)return void v(new Error("Unknown XHR error"));y(),d=!0,t(null,{body:a.response||(""===a.responseType||"text"===a.responseType?a.responseText:""),url:o.url,method:o.method,headers:u(a.getAllResponseHeaders()),statusCode:a.status,statusMessage:a.statusText})}()},a.open(o.method,o.url,!0),a.withCredentials=!!o.withCredentials,c&&a.setRequestHeader)for(const e in c)c.hasOwnProperty(e)&&a.setRequestHeader(e,c[e]);return o.rawBody&&(a.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:o,adapter:_,request:a,context:e}),a.send(o.body||null),l&&(s.connect=setTimeout((()=>f("ETIMEDOUT")),l.connect)),{abort:function(){h=!0,a&&a.abort()}};function f(t){p=!0,a.abort();const r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(o.url):"Connection timed out on request to ".concat(o.url));r.code=t,e.channels.error.publish(r)}function y(e){(e||h||a.readyState>=2&&s.connect)&&clearTimeout(s.connect),s.socket&&clearTimeout(s.socket)}function v(e){if(d)return;y(!0),d=!0,a=null;const r=e||new Error("Network error while attempting to reach ".concat(o.url));r.isNetworkError=!0,r.request=o,t(r)}};var k,R,M={exports:{}};function F(){if(R)return k;R=1;var e=1e3,t=60*e,r=60*t,n=24*r,o=7*n,s=365.25*n;function i(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}return k=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(i){if((i=String(i)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var s=Math.abs(o);if(s>=n)return i(o,s,n,"day");if(s>=r)return i(o,s,r,"hour");if(s>=t)return i(o,s,t,"minute");if(s>=e)return i(o,s,e,"second");return o+" ms"}(a):function(o){var s=Math.abs(o);if(s>=n)return Math.round(o/n)+"d";if(s>=r)return Math.round(o/r)+"h";if(s>=t)return Math.round(o/t)+"m";if(s>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var I=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=F(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};
|
|
2
2
|
/*!
|
|
3
3
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
6
|
* Released under the MIT License.
|
|
7
7
|
*/
|
|
8
|
-
function P(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=I(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(M,M.exports);const D="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),q=["boolean","string","number"];function N(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!D(t)&&(-1!==q.indexOf(typeof t)||Array.isArray(t)||!1!==P(r=t)&&(void 0===(n=r.constructor)||!1!==P(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function H(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let W={};"undefined"!=typeof globalThis?W=globalThis:"undefined"!=typeof window?W=window:"undefined"!=typeof global?W=global:"undefined"!=typeof self&&(W=self);var z=W;function U(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||z.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,r)=>new e((e=>(t.error.subscribe((t=>e.error(t))),t.progress.subscribe((t=>e.next(Object.assign({type:"progress"},t)))),t.response.subscribe((t=>{e.next(Object.assign({type:"response"},t)),e.complete()})),t.request.publish(r),()=>t.abort.publish())))}}var L=Object.defineProperty,B=(e,t,r)=>(((e,t,r)=>{t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);class ${constructor(e){B(this,"__CANCEL__",!0),B(this,"message"),this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const G=class{constructor(e){if(B(this,"promise"),B(this,"reason"),"function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new $(e),t(this.reason))}))}};B(G,"source",(()=>{let e;return{token:new G((t=>{e=t})),cancel:e}}));var V=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function J(e){return 100*Math.pow(2,e)+100*Math.random()}const X=function(){return(e=>{const t=e.maxRetries||5,r=e.retryDelay||J,n=e.shouldRetry;return{onError:(e,o)=>{const s=o.options,i=s.maxRetries||t,a=s.shouldRetry||n,c=s.attemptNumber||0;if(null!==(u=s.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,s)||c>=i)return e;const l=Object.assign({},o,{options:Object.assign({},s,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),r(c)),null}}})({shouldRetry:V,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})};X.shouldRetry=V;var Y=function(e,t){return Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Y(e,t)};function K(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Y(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Z(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Q(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function ee(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function te(e){return"function"==typeof e}function re(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var ne=re((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function oe(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var se=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=Z(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(te(c))try{c()}catch(e){o=e instanceof ne?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=Z(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{ae(d)}catch(e){o=null!=o?o:[],e instanceof ne?o=ee(ee([],Q(o)),Q(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new ne(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ae(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&oe(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&oe(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ie(e){return e instanceof se||e&&"closed"in e&&te(e.remove)&&te(e.add)&&te(e.unsubscribe)}function ae(e){te(e)?e():e.unsubscribe()}se.EMPTY;var ce={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ue={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ue.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,ee([e,t],Q(r))):setTimeout.apply(void 0,ee([e,t],Q(r)))},clearTimeout:function(e){var t=ue.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function le(){}var he=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,ie(t)&&t.add(r)):r.destination=ge,r}return K(t,e),t.create=function(e,t,r){return new ye(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(se),de=Function.prototype.bind;function pe(e,t){return de.call(e,t)}var fe=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){ve(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ve(e)}else ve(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ve(e)}},e}(),ye=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;te(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&ce.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&pe(t.next,s),error:t.error&&pe(t.error,s),complete:t.complete&&pe(t.complete,s)}):o=t;return i.destination=new fe(o),i}return K(t,e),t}(he);function ve(e){var t;t=e,ue.setTimeout((function(){throw t}))}var ge={closed:!0,next:le,error:function(e){throw e},complete:le},me="function"==typeof Symbol&&Symbol.observable||"@@observable";function be(e){return e}var we=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof he||function(e){return e&&te(e.next)&&te(e.error)&&te(e.complete)}(n)&&ie(n)?e:new ye(e,t,r);return function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}(),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=Ce(t))((function(t,n){var o=new ye({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[me]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?be:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Ce(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function Ce(e){var t;return null!==(t=null!=e?e:ce.Promise)&&void 0!==t?t:Promise}function Ee(e){return function(t){if(function(e){return te(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function xe(e,t,r,n,o){return new Te(e,t,r,n,o)}var Te=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return K(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(he),Oe=re((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function _e(e,t){var r="object"==typeof t;return new Promise((function(n,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new Oe)}})}))}function Se(e,t){return Ee((function(r,n){var o=0;r.subscribe(xe(n,(function(r){n.next(e.call(t,r,o++))})))}))}function je(e,t){return Ee((function(r,n){var o=0;r.subscribe(xe(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}var Ae=[],ke=Object.defineProperty,Re=(e,t,r)=>(((e,t,r)=>{t in e?ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);class Me extends Error{constructor(e){const t=Ie(e);super(t.message),Re(this,"response"),Re(this,"statusCode",400),Re(this,"responseBody"),Re(this,"details"),Object.assign(this,t)}}class Fe extends Error{constructor(e){const t=Ie(e);super(t.message),Re(this,"response"),Re(this,"statusCode",500),Re(this,"responseBody"),Re(this,"details"),Object.assign(this,t)}}function Ie(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:De(t,e),message:"",details:void 0};if(t.error&&t.message)return r.message="".concat(t.error," - ").concat(t.message),r;if(function(e){return Pe(e)&&Pe(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],n=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=n.length?":\n- ".concat(n.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),r.message="".concat(t.error.description).concat(o),r.details=t.error,r}return t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),r)}function Pe(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function De(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const qe={onResponse:e=>{if(e.statusCode>=500)throw new Fe(e);if(e.statusCode>=400)throw new Me(e);return e}},Ne={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function He(e,t){let{maxRetries:r=5,retryDelay:n}=t;const o=function(){return d(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:A)}([r>0?X({retryDelay:n,maxRetries:r,shouldRetry:We}):{},...e,Ne,N(),H(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},qe,U({implementation:we})]);function s(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:o)({maxRedirects:0,...e})}return s.defaultRequester=o,s}function We(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=(r.uri||r.url).startsWith("/data/query"),s=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!s)||X.shouldRetry(e,t,r)}function ze(e){return"https://www.sanity.io/help/"+e}const Ue=["image","file"],Le=["before","after","replace"],Be=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},$e=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},Ge=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},Ve=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));Ge(e,t._id)},Je=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},Xe=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e};const Ye=e=>function(e){let t,r=!1;return function(){return r||(t=e(...arguments),r=!0),t}}((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return console.warn(e.join(" "),...r)})),Ke=Ye(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),Ze=Ye(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(ze("js-client-browser-token")," for more information and how to hide this warning.")]),Qe=Ye(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(ze("js-client-api-version"))]),et=Ye(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),tt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},rt=["localhost","127.0.0.1","0.0.0.0"],nt=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},ot=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||Qe();const n=Object.assign({},tt,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const e=ze("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof n.perspective&&nt(n.perspective),"encodeSourceMapAtPath"in n||"encodeSourceMap"in n||"studioUrl"in n||"logger"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client', such as 'encodeSourceMapAtPath', 'encodeSourceMap', 'studioUrl' and 'logger'. Make sure you're using the right import.");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==rt.indexOf(e))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?Ze():void 0===n.useCdn&&Ke(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&Be(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?Xe(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===tt.apiHost,n.useCdn=!1!==n.useCdn&&!n.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(n.apiVersion);const a=n.apiHost.split("://",2),c=a[0],u=a[1],l=n.isDefaultApi?"apicdn.sanity.io":u;return n.useProjectHostname?(n.url="".concat(c,"://").concat(n.projectId,".").concat(u,"/v").concat(n.apiVersion),n.cdnUrl="".concat(c,"://").concat(n.projectId,".").concat(l,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n},st="X-Sanity-Project-ID";function it(e){if("string"==typeof e||Array.isArray(e))return{id:e};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}const at=e=>{let{query:t,params:r={},options:n={}}=e;const o=new URLSearchParams,{tag:s,...i}=n;s&&o.append("tag",s),o.append("query",t);for(const[e,t]of Object.entries(r))o.append("$".concat(e),JSON.stringify(t));for(const[e,t]of Object.entries(i))t&&o.append(e,"".concat(t));return"?".concat(o)};var ct,ut,lt=Object.defineProperty,ht=(e,t,r)=>(((e,t,r)=>{t in e?lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),dt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},pt=(e,t,r)=>(dt(e,t,"read from private field"),r?r.call(e):t.get(e)),ft=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},yt=(e,t,r,n)=>(dt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class vt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ht(this,"selection"),ht(this,"operations"),this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return $e("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===Le.indexOf(e)){const e=Le.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,r,n){const o=t<0?t-1:t,s=void 0===r||-1===r?-1:Math.max(0,t+r),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...it(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return $e(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}ct=new WeakMap;let gt=class e extends vt{constructor(e,t,r){super(e,t),ft(this,ct,void 0),yt(this,ct,r)}clone(){return new e(this.selection,{...this.operations},pt(this,ct))}commit(e){if(!pt(this,ct))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return pt(this,ct).mutate({patch:this.serialize()},r)}};ut=new WeakMap;let mt=class e extends vt{constructor(e,t,r){super(e,t),ft(this,ut,void 0),yt(this,ut,r)}clone(){return new e(this.selection,{...this.operations},pt(this,ut))}commit(e){if(!pt(this,ut))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return pt(this,ut).mutate({patch:this.serialize()},r)}};var bt,wt,Ct=Object.defineProperty,Et=(e,t,r)=>(((e,t,r)=>{t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),xt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Tt=(e,t,r)=>(xt(e,t,"read from private field"),r?r.call(e):t.get(e)),Ot=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},_t=(e,t,r,n)=>(xt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const St={returnDocuments:!1};class jt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;Et(this,"operations"),Et(this,"trxId"),this.operations=e,this.trxId=t}create(e){return $e("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return $e(t,e),Ve(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return $e(t,e),Ve(t,e),this._add({[t]:e})}delete(e){return Ge("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}bt=new WeakMap;let At=class e extends jt{constructor(e,t,r){super(e,r),Ot(this,bt,void 0),_t(this,bt,t)}clone(){return new e([...this.operations],Tt(this,bt),this.trxId)}commit(e){if(!Tt(this,bt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Tt(this,bt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},St,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof mt)return this._add({patch:e.serialize()});if(r){const r=t(new mt(e,{},Tt(this,bt)));if(!(r instanceof mt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};wt=new WeakMap;let kt=class e extends jt{constructor(e,t,r){super(e,r),Ot(this,wt,void 0),_t(this,wt,t)}clone(){return new e([...this.operations],Tt(this,wt),this.trxId)}commit(e){if(!Tt(this,wt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Tt(this,wt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},St,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof gt)return this._add({patch:e.serialize()});if(r){const r=t(new gt(e,{},Tt(this,wt)));if(!(r instanceof gt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};const Rt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:void 0===t?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},Mt=e=>"response"===e.type,Ft=e=>e.body,It=11264;function Pt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=!1===o.filterResponse?e=>e:e=>e.result,{cache:i,next:a,...c}={useAbortSignal:void 0!==o.signal,...o};return Ut(e,t,"query",{query:r,params:n},void 0!==i||void 0!==a?{...c,fetch:{cache:i,next:a}}:c).pipe(Se(s))}function Dt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Bt(e,t,{uri:Gt(e,"doc",r),json:!0,tag:n.tag}).pipe(je(Mt),Se((e=>e.body.documents&&e.body.documents[0])))}function qt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Bt(e,t,{uri:Gt(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(je(Mt),Se((e=>{const t=(n=e.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return r.map((e=>t[e]||null))})))}function Nt(e,t,r,n){return Ve("createIfNotExists",r),Lt(e,t,r,"createIfNotExists",n)}function Ht(e,t,r,n){return Ve("createOrReplace",r),Lt(e,t,r,"createOrReplace",n)}function Wt(e,t,r,n){return Ut(e,t,"mutate",{mutations:[{delete:it(r)}]},n)}function zt(e,t,r,n){let o;o=r instanceof mt||r instanceof gt?{patch:r.serialize()}:r instanceof At||r instanceof kt?r.serialize():r;return Ut(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function Ut(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":at(n),c=!s&&a.length<It,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o;return Bt(e,t,{method:c?"GET":"POST",uri:Gt(e,r,u),json:!0,body:c?void 0:n,query:s&&Rt(o),timeout:h,headers:f,token:d,tag:p,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:i,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal}).pipe(je(Mt),Se(Ft),Se((e=>{if(!s)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function Lt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Ut(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Bt(e,t,r){var n;const o=r.url||r.uri,s=e.config(),i=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===o.indexOf("/data/"):r.canUseCdn,a=s.useCdn&&i,c=r.tag&&s.requestTagPrefix?[s.requestTagPrefix,r.tag].join("."):r.tag||s.requestTagPrefix;if(c&&(r.query={tag:Xe(c),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===o.indexOf("/data/query/")){(null!=(n=r.resultSourceMap)?n:s.resultSourceMap)&&(r.query={resultSourceMap:!0,...r.query});const e=r.perspective||s.perspective;"string"==typeof e&&"raw"!==e&&(nt(e),r.query={perspective:e,...r.query})}const u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},n=t.token||e.token;n&&(r.Authorization="Bearer ".concat(n)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[st]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(s,Object.assign({},r,{url:Vt(e,o,a)})),l=new we((e=>t(u,s.requester).subscribe(e)));return r.signal?l.pipe((h=r.signal,e=>new we((t=>{const r=()=>t.error(function(e){var t,r;if(Jt)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const n=new Error(null!=(r=null==e?void 0:e.reason)?r:"The operation was aborted.");return n.name="AbortError",n}(h));if(h&&h.aborted)return void r();const n=e.subscribe(t);return h.addEventListener("abort",r),()=>{h.removeEventListener("abort",r),n.unsubscribe()}})))):l;var h}function $t(e,t,r){return Bt(e,t,r).pipe(je((e=>"response"===e.type)),Se((e=>e.body)))}function Gt(e,t,r){const n=e.config(),o=Je(n),s="/".concat(t,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Vt(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:n,cdnUrl:o}=e.config();return"".concat(r?o:n,"/").concat(t.replace(/^\//,""))}const Jt=Boolean(globalThis.DOMException);var Xt,Yt,Kt,Zt,Qt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},er=(e,t,r)=>(Qt(e,t,"read from private field"),r?r.call(e):t.get(e)),tr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},rr=(e,t,r,n)=>(Qt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class nr{constructor(e,t){tr(this,Xt,void 0),tr(this,Yt,void 0),rr(this,Xt,e),rr(this,Yt,t)}upload(e,t,r){return sr(er(this,Xt),er(this,Yt),e,t,r)}}Xt=new WeakMap,Yt=new WeakMap;class or{constructor(e,t){tr(this,Kt,void 0),tr(this,Zt,void 0),rr(this,Kt,e),rr(this,Zt,t)}upload(e,t,r){return _e(sr(er(this,Kt),er(this,Zt),e,t,r).pipe(je((e=>"response"===e.type)),Se((e=>e.body.document))))}}function sr(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===Ue.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Ue.join(", ")))})(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=Je(e.config()),a="image"===r?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,n),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,v={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(v.sourceId=y.id,v.sourceName=y.name,v.sourceUrl=y.url),Bt(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:v,body:n})}Kt=new WeakMap,Zt=new WeakMap;var ir=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const ar=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],cr={includeResult:!0};function ur(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=r.tag&&i?[i,r.tag].join("."):r.tag,c={...ir(r,cr),tag:a},u=(l=c,ar.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=at({query:e,params:t,options:{tag:a,...u}}),d="".concat(n).concat(Gt(this,"listen",h));if(d.length>14800)return new we((e=>e.error(new Error("Query too large for listener"))));const p=c.events?c.events:["mutation"],f=-1!==p.indexOf("reconnect"),y={};return(o||s)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new we((e=>{let t,r;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let n=!1;function o(){n||(f&&e.next({type:"reconnect"}),n||t.readyState===t.CLOSED&&(c(),clearTimeout(r),r=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=lr(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function i(t){const r=lr(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",s),t.removeEventListener("disconnect",a),p.forEach((e=>t.removeEventListener(e,i))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return on})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",s),t.addEventListener("disconnect",a),p.forEach((e=>t.addEventListener(e,i))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),h()}))}function h(){n=!0,c()}return h}))}function lr(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var hr,dr,pr,fr,yr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},vr=(e,t,r)=>(yr(e,t,"read from private field"),r?r.call(e):t.get(e)),gr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},mr=(e,t,r,n)=>(yr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class br{constructor(e,t){gr(this,hr,void 0),gr(this,dr,void 0),mr(this,hr,e),mr(this,dr,t)}create(e,t){return Cr(vr(this,hr),vr(this,dr),"PUT",e,t)}edit(e,t){return Cr(vr(this,hr),vr(this,dr),"PATCH",e,t)}delete(e){return Cr(vr(this,hr),vr(this,dr),"DELETE",e)}list(){return $t(vr(this,hr),vr(this,dr),{uri:"/datasets"})}}hr=new WeakMap,dr=new WeakMap;class wr{constructor(e,t){gr(this,pr,void 0),gr(this,fr,void 0),mr(this,pr,e),mr(this,fr,t)}create(e,t){return _e(Cr(vr(this,pr),vr(this,fr),"PUT",e,t))}edit(e,t){return _e(Cr(vr(this,pr),vr(this,fr),"PATCH",e,t))}delete(e){return _e(Cr(vr(this,pr),vr(this,fr),"DELETE",e))}list(){return _e($t(vr(this,pr),vr(this,fr),{uri:"/datasets"}))}}function Cr(e,t,r,n,o){return Be(n),$t(e,t,{method:r,uri:"/datasets/".concat(n),body:o})}pr=new WeakMap,fr=new WeakMap;var Er,xr,Tr,Or,_r=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Sr=(e,t,r)=>(_r(e,t,"read from private field"),r?r.call(e):t.get(e)),jr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Ar=(e,t,r,n)=>(_r(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class kr{constructor(e,t){jr(this,Er,void 0),jr(this,xr,void 0),Ar(this,Er,e),Ar(this,xr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return $t(Sr(this,Er),Sr(this,xr),{uri:t})}getById(e){return $t(Sr(this,Er),Sr(this,xr),{uri:"/projects/".concat(e)})}}Er=new WeakMap,xr=new WeakMap;class Rr{constructor(e,t){jr(this,Tr,void 0),jr(this,Or,void 0),Ar(this,Tr,e),Ar(this,Or,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return _e($t(Sr(this,Tr),Sr(this,Or),{uri:t}))}getById(e){return _e($t(Sr(this,Tr),Sr(this,Or),{uri:"/projects/".concat(e)}))}}Tr=new WeakMap,Or=new WeakMap;var Mr,Fr,Ir,Pr,Dr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},qr=(e,t,r)=>(Dr(e,t,"read from private field"),r?r.call(e):t.get(e)),Nr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Hr=(e,t,r,n)=>(Dr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Wr{constructor(e,t){Nr(this,Mr,void 0),Nr(this,Fr,void 0),Hr(this,Mr,e),Hr(this,Fr,t)}getById(e){return $t(qr(this,Mr),qr(this,Fr),{uri:"/users/".concat(e)})}}Mr=new WeakMap,Fr=new WeakMap;class zr{constructor(e,t){Nr(this,Ir,void 0),Nr(this,Pr,void 0),Hr(this,Ir,e),Hr(this,Pr,t)}getById(e){return _e($t(qr(this,Ir),qr(this,Pr),{uri:"/users/".concat(e)}))}}Ir=new WeakMap,Pr=new WeakMap;var Ur,Lr,Br,$r,Gr=Object.defineProperty,Vr=(e,t,r)=>(((e,t,r)=>{t in e?Gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),Jr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Xr=(e,t,r)=>(Jr(e,t,"read from private field"),r?r.call(e):t.get(e)),Yr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Kr=(e,t,r,n)=>(Jr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Ur=new WeakMap,Lr=new WeakMap;let Zr=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tt;Vr(this,"assets"),Vr(this,"datasets"),Vr(this,"projects"),Vr(this,"users"),Yr(this,Ur,void 0),Yr(this,Lr,void 0),Vr(this,"listen",ur),this.config(t),Kr(this,Lr,e),this.assets=new nr(this,Xr(this,Lr)),this.datasets=new br(this,Xr(this,Lr)),this.projects=new kr(this,Xr(this,Lr)),this.users=new Wr(this,Xr(this,Lr))}clone(){return new e(Xr(this,Lr),this.config())}config(e){if(void 0===e)return{...Xr(this,Ur)};if(Xr(this,Ur)&&!1===Xr(this,Ur).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Kr(this,Ur,ot(e,Xr(this,Ur)||{})),this}withConfig(t){return new e(Xr(this,Lr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Pt(this,Xr(this,Lr),e,t,r)}getDocument(e,t){return Dt(this,Xr(this,Lr),e,t)}getDocuments(e,t){return qt(this,Xr(this,Lr),e,t)}create(e,t){return Lt(this,Xr(this,Lr),e,"create",t)}createIfNotExists(e,t){return Nt(this,Xr(this,Lr),e,t)}createOrReplace(e,t){return Ht(this,Xr(this,Lr),e,t)}delete(e,t){return Wt(this,Xr(this,Lr),e,t)}mutate(e,t){return zt(this,Xr(this,Lr),e,t)}patch(e,t){return new gt(e,t,this)}transaction(e){return new kt(e,this)}request(e){return $t(this,Xr(this,Lr),e)}getUrl(e,t){return Vt(this,e,t)}getDataUrl(e,t){return Gt(this,e,t)}};Br=new WeakMap,$r=new WeakMap;let Qr=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tt;Vr(this,"assets"),Vr(this,"datasets"),Vr(this,"projects"),Vr(this,"users"),Vr(this,"observable"),Yr(this,Br,void 0),Yr(this,$r,void 0),Vr(this,"listen",ur),this.config(t),Kr(this,$r,e),this.assets=new or(this,Xr(this,$r)),this.datasets=new wr(this,Xr(this,$r)),this.projects=new Rr(this,Xr(this,$r)),this.users=new zr(this,Xr(this,$r)),this.observable=new Zr(e,t)}clone(){return new e(Xr(this,$r),this.config())}config(e){if(void 0===e)return{...Xr(this,Br)};if(Xr(this,Br)&&!1===Xr(this,Br).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),Kr(this,Br,ot(e,Xr(this,Br)||{})),this}withConfig(t){return new e(Xr(this,$r),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return _e(Pt(this,Xr(this,$r),e,t,r))}getDocument(e,t){return _e(Dt(this,Xr(this,$r),e,t))}getDocuments(e,t){return _e(qt(this,Xr(this,$r),e,t))}create(e,t){return _e(Lt(this,Xr(this,$r),e,"create",t))}createIfNotExists(e,t){return _e(Nt(this,Xr(this,$r),e,t))}createOrReplace(e,t){return _e(Ht(this,Xr(this,$r),e,t))}delete(e,t){return _e(Wt(this,Xr(this,$r),e,t))}mutate(e,t){return _e(zt(this,Xr(this,$r),e,t))}patch(e,t){return new mt(e,t,this)}transaction(e){return new At(e,this)}request(e){return _e($t(this,Xr(this,$r),e))}dataRequest(e,t,r){return _e(Ut(this,Xr(this,$r),e,t,r))}getUrl(e,t){return Vt(this,e,t)}getDataUrl(e,t){return Gt(this,e,t)}};const en=He(Ae,{}),tn=en.defaultRequester;var rn={exports:{}};
|
|
8
|
+
function P(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=I(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(M,M.exports);const D="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),q=["boolean","string","number"];function N(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!D(t)&&(-1!==q.indexOf(typeof t)||Array.isArray(t)||!1!==P(r=t)&&(void 0===(n=r.constructor)||!1!==P(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function H(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})};function t(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}}let W={};"undefined"!=typeof globalThis?W=globalThis:"undefined"!=typeof window?W=window:"undefined"!=typeof global?W=global:"undefined"!=typeof self&&(W=self);var z=W;function U(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||z.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,r)=>new e((e=>(t.error.subscribe((t=>e.error(t))),t.progress.subscribe((t=>e.next(Object.assign({type:"progress"},t)))),t.response.subscribe((t=>{e.next(Object.assign({type:"response"},t)),e.complete()})),t.request.publish(r),()=>t.abort.publish())))}}var L=Object.defineProperty,B=(e,t,r)=>(((e,t,r)=>{t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);class ${constructor(e){B(this,"__CANCEL__",!0),B(this,"message"),this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const G=class{constructor(e){if(B(this,"promise"),B(this,"reason"),"function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new $(e),t(this.reason))}))}};B(G,"source",(()=>{let e;return{token:new G((t=>{e=t})),cancel:e}}));var V=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function J(e){return 100*Math.pow(2,e)+100*Math.random()}const X=function(){return(e=>{const t=e.maxRetries||5,r=e.retryDelay||J,n=e.shouldRetry;return{onError:(e,o)=>{const s=o.options,i=s.maxRetries||t,a=s.shouldRetry||n,c=s.attemptNumber||0;if(null!==(u=s.body)&&"object"==typeof u&&"function"==typeof u.pipe)return e;var u;if(!a(e,c,s)||c>=i)return e;const l=Object.assign({},o,{options:Object.assign({},s,{attemptNumber:c+1})});return setTimeout((()=>o.channels.request.publish(l)),r(c)),null}}})({shouldRetry:V,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})};X.shouldRetry=V;var Y=function(e,t){return Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Y(e,t)};function K(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Y(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Z(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Q(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function ee(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function te(e){return"function"==typeof e}function re(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var ne=re((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function oe(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var se=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=Z(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var c=this.initialTeardown;if(te(c))try{c()}catch(e){o=e instanceof ne?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=Z(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{ae(d)}catch(e){o=null!=o?o:[],e instanceof ne?o=ee(ee([],Q(o)),Q(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new ne(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ae(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&oe(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&oe(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ie(e){return e instanceof se||e&&"closed"in e&&te(e.remove)&&te(e.add)&&te(e.unsubscribe)}function ae(e){te(e)?e():e.unsubscribe()}se.EMPTY;var ce={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ue={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ue.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,ee([e,t],Q(r))):setTimeout.apply(void 0,ee([e,t],Q(r)))},clearTimeout:function(e){var t=ue.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function le(){}var he=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,ie(t)&&t.add(r)):r.destination=ge,r}return K(t,e),t.create=function(e,t,r){return new ye(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(se),de=Function.prototype.bind;function pe(e,t){return de.call(e,t)}var fe=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){ve(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ve(e)}else ve(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ve(e)}},e}(),ye=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;te(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&ce.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&pe(t.next,s),error:t.error&&pe(t.error,s),complete:t.complete&&pe(t.complete,s)}):o=t;return i.destination=new fe(o),i}return K(t,e),t}(he);function ve(e){var t;t=e,ue.setTimeout((function(){throw t}))}var ge={closed:!0,next:le,error:function(e){throw e},complete:le},me="function"==typeof Symbol&&Symbol.observable||"@@observable";function be(e){return e}var we=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof he||function(e){return e&&te(e.next)&&te(e.error)&&te(e.complete)}(n)&&ie(n)?e:new ye(e,t,r);return function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))}(),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=Ce(t))((function(t,n){var o=new ye({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[me]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?be:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Ce(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function Ce(e){var t;return null!==(t=null!=e?e:ce.Promise)&&void 0!==t?t:Promise}function Ee(e){return function(t){if(function(e){return te(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function xe(e,t,r,n,o){return new Te(e,t,r,n,o)}var Te=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return K(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(he),Oe=re((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Se(e,t){var r="object"==typeof t;return new Promise((function(n,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new Oe)}})}))}function _e(e,t){return Ee((function(r,n){var o=0;r.subscribe(xe(n,(function(r){n.next(e.call(t,r,o++))})))}))}function je(e,t){return Ee((function(r,n){var o=0;r.subscribe(xe(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}var Ae=[],ke=Object.defineProperty,Re=(e,t,r)=>(((e,t,r)=>{t in e?ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);class Me extends Error{constructor(e){const t=Ie(e);super(t.message),Re(this,"response"),Re(this,"statusCode",400),Re(this,"responseBody"),Re(this,"details"),Object.assign(this,t)}}class Fe extends Error{constructor(e){const t=Ie(e);super(t.message),Re(this,"response"),Re(this,"statusCode",500),Re(this,"responseBody"),Re(this,"details"),Object.assign(this,t)}}function Ie(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:De(t,e),message:"",details:void 0};if(t.error&&t.message)return r.message="".concat(t.error," - ").concat(t.message),r;if(function(e){return Pe(e)&&Pe(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],n=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=n.length?":\n- ".concat(n.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),r.message="".concat(t.error.description).concat(o),r.details=t.error,r}return t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),r)}function Pe(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function De(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const qe={onResponse:e=>{if(e.statusCode>=500)throw new Fe(e);if(e.statusCode>=400)throw new Me(e);return e}},Ne={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function He(e,t){let{maxRetries:r=5,retryDelay:n}=t;const o=function(){return d(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:A)}([r>0?X({retryDelay:n,maxRetries:r,shouldRetry:We}):{},...e,Ne,N(),H(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},qe,U({implementation:we})]);function s(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:o)({maxRedirects:0,...e})}return s.defaultRequester=o,s}function We(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=(r.uri||r.url).startsWith("/data/query"),s=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!s)||X.shouldRetry(e,t,r)}function ze(e){return"https://www.sanity.io/help/"+e}const Ue=["image","file"],Le=["before","after","replace"],Be=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},$e=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},Ge=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},Ve=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));Ge(e,t._id)},Je=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},Xe=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e};const Ye=e=>function(e){let t,r=!1;return function(){return r||(t=e(...arguments),r=!0),t}}((function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return console.warn(e.join(" "),...r)})),Ke=Ye(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),Ze=Ye(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),Qe=Ye(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(ze("js-client-browser-token")," for more information and how to hide this warning.")]),et=Ye(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(ze("js-client-api-version"))]),tt=Ye(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),rt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},nt=["localhost","127.0.0.1","0.0.0.0"],ot=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},st=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||et();const n=Object.assign({},rt,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const e=ze("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof n.perspective&&ot(n.perspective),"encodeSourceMapAtPath"in n||"encodeSourceMap"in n||"studioUrl"in n||"logger"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client', such as 'encodeSourceMapAtPath', 'encodeSourceMap', 'studioUrl' and 'logger'. Make sure you're using the right import.");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==nt.indexOf(e))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?Qe():void 0===n.useCdn&&Ke(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&Be(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?Xe(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===rt.apiHost,n.useCdn=!1!==n.useCdn&&!n.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(n.apiVersion);const a=n.apiHost.split("://",2),c=a[0],u=a[1],l=n.isDefaultApi?"apicdn.sanity.io":u;return n.useProjectHostname?(n.url="".concat(c,"://").concat(n.projectId,".").concat(u,"/v").concat(n.apiVersion),n.cdnUrl="".concat(c,"://").concat(n.projectId,".").concat(l,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n},it="X-Sanity-Project-ID";function at(e){if("string"==typeof e||Array.isArray(e))return{id:e};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}const ct=e=>{let{query:t,params:r={},options:n={}}=e;const o=new URLSearchParams,{tag:s,...i}=n;s&&o.append("tag",s),o.append("query",t);for(const[e,t]of Object.entries(r))o.append("$".concat(e),JSON.stringify(t));for(const[e,t]of Object.entries(i))t&&o.append(e,"".concat(t));return"?".concat(o)};var ut,lt,ht=Object.defineProperty,dt=(e,t,r)=>(((e,t,r)=>{t in e?ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),pt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},ft=(e,t,r)=>(pt(e,t,"read from private field"),r?r.call(e):t.get(e)),yt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},vt=(e,t,r,n)=>(pt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class gt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt(this,"selection"),dt(this,"operations"),this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return $e("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===Le.indexOf(e)){const e=Le.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,r,n){const o=t<0?t-1:t,s=void 0===r||-1===r?-1:Math.max(0,t+r),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...at(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return $e(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}ut=new WeakMap;let mt=class e extends gt{constructor(e,t,r){super(e,t),yt(this,ut,void 0),vt(this,ut,r)}clone(){return new e(this.selection,{...this.operations},ft(this,ut))}commit(e){if(!ft(this,ut))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return ft(this,ut).mutate({patch:this.serialize()},r)}};lt=new WeakMap;let bt=class e extends gt{constructor(e,t,r){super(e,t),yt(this,lt,void 0),vt(this,lt,r)}clone(){return new e(this.selection,{...this.operations},ft(this,lt))}commit(e){if(!ft(this,lt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return ft(this,lt).mutate({patch:this.serialize()},r)}};var wt,Ct,Et=Object.defineProperty,xt=(e,t,r)=>(((e,t,r)=>{t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),Tt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ot=(e,t,r)=>(Tt(e,t,"read from private field"),r?r.call(e):t.get(e)),St=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},_t=(e,t,r,n)=>(Tt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const jt={returnDocuments:!1};class At{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;xt(this,"operations"),xt(this,"trxId"),this.operations=e,this.trxId=t}create(e){return $e("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return $e(t,e),Ve(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return $e(t,e),Ve(t,e),this._add({[t]:e})}delete(e){return Ge("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}wt=new WeakMap;let kt=class e extends At{constructor(e,t,r){super(e,r),St(this,wt,void 0),_t(this,wt,t)}clone(){return new e([...this.operations],Ot(this,wt),this.trxId)}commit(e){if(!Ot(this,wt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Ot(this,wt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},jt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof bt)return this._add({patch:e.serialize()});if(r){const r=t(new bt(e,{},Ot(this,wt)));if(!(r instanceof bt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};Ct=new WeakMap;let Rt=class e extends At{constructor(e,t,r){super(e,r),St(this,Ct,void 0),_t(this,Ct,t)}clone(){return new e([...this.operations],Ot(this,Ct),this.trxId)}commit(e){if(!Ot(this,Ct))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Ot(this,Ct).mutate(this.serialize(),Object.assign({transactionId:this.trxId},jt,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof mt)return this._add({patch:e.serialize()});if(r){const r=t(new mt(e,{},Ot(this,Ct)));if(!(r instanceof mt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};const Mt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:void 0===t?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},Ft=e=>"response"===e.type,It=e=>e.body,Pt=11264;function Dt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=!1===o.filterResponse?e=>e:e=>e.result,{cache:i,next:a,...c}={useAbortSignal:void 0!==o.signal,...o};return Lt(e,t,"query",{query:r,params:n},void 0!==i||void 0!==a?{...c,fetch:{cache:i,next:a}}:c).pipe(_e(s))}function qt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return $t(e,t,{uri:Vt(e,"doc",r),json:!0,tag:n.tag}).pipe(je(Ft),_e((e=>e.body.documents&&e.body.documents[0])))}function Nt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return $t(e,t,{uri:Vt(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(je(Ft),_e((e=>{const t=(n=e.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return r.map((e=>t[e]||null))})))}function Ht(e,t,r,n){return Ve("createIfNotExists",r),Bt(e,t,r,"createIfNotExists",n)}function Wt(e,t,r,n){return Ve("createOrReplace",r),Bt(e,t,r,"createOrReplace",n)}function zt(e,t,r,n){return Lt(e,t,"mutate",{mutations:[{delete:at(r)}]},n)}function Ut(e,t,r,n){let o;o=r instanceof bt||r instanceof mt?{patch:r.serialize()}:r instanceof kt||r instanceof Rt?r.serialize():r;return Lt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function Lt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":ct(n),c=!s&&a.length<Pt,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o;return $t(e,t,{method:c?"GET":"POST",uri:Vt(e,r,u),json:!0,body:c?void 0:n,query:s&&Mt(o),timeout:h,headers:f,token:d,tag:p,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:i,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal}).pipe(je(Ft),_e(It),_e((e=>{if(!s)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function Bt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Lt(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function $t(e,t,r){var n;const o=r.url||r.uri,s=e.config(),i=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===o.indexOf("/data/"):r.canUseCdn;let a=s.useCdn&&i;const c=r.tag&&s.requestTagPrefix?[s.requestTagPrefix,r.tag].join("."):r.tag||s.requestTagPrefix;if(c&&(r.query={tag:Xe(c),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===o.indexOf("/data/query/")){(null!=(n=r.resultSourceMap)?n:s.resultSourceMap)&&(r.query={resultSourceMap:!0,...r.query});const e=r.perspective||s.perspective;"string"==typeof e&&"raw"!==e&&(ot(e),r.query={perspective:e,...r.query},"previewDrafts"===e&&a&&(a=!1,Ze()))}const u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},n=t.token||e.token;n&&(r.Authorization="Bearer ".concat(n)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[it]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(s,Object.assign({},r,{url:Jt(e,o,a)})),l=new we((e=>t(u,s.requester).subscribe(e)));return r.signal?l.pipe((h=r.signal,e=>new we((t=>{const r=()=>t.error(function(e){var t,r;if(Xt)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const n=new Error(null!=(r=null==e?void 0:e.reason)?r:"The operation was aborted.");return n.name="AbortError",n}(h));if(h&&h.aborted)return void r();const n=e.subscribe(t);return h.addEventListener("abort",r),()=>{h.removeEventListener("abort",r),n.unsubscribe()}})))):l;var h}function Gt(e,t,r){return $t(e,t,r).pipe(je((e=>"response"===e.type)),_e((e=>e.body)))}function Vt(e,t,r){const n=e.config(),o=Je(n),s="/".concat(t,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Jt(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:n,cdnUrl:o}=e.config();return"".concat(r?o:n,"/").concat(t.replace(/^\//,""))}const Xt=Boolean(globalThis.DOMException);var Yt,Kt,Zt,Qt,er=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},tr=(e,t,r)=>(er(e,t,"read from private field"),r?r.call(e):t.get(e)),rr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},nr=(e,t,r,n)=>(er(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class or{constructor(e,t){rr(this,Yt,void 0),rr(this,Kt,void 0),nr(this,Yt,e),nr(this,Kt,t)}upload(e,t,r){return ir(tr(this,Yt),tr(this,Kt),e,t,r)}}Yt=new WeakMap,Kt=new WeakMap;class sr{constructor(e,t){rr(this,Zt,void 0),rr(this,Qt,void 0),nr(this,Zt,e),nr(this,Qt,t)}upload(e,t,r){return Se(ir(tr(this,Zt),tr(this,Qt),e,t,r).pipe(je((e=>"response"===e.type)),_e((e=>e.body.document))))}}function ir(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===Ue.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Ue.join(", ")))})(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=Je(e.config()),a="image"===r?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,n),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,v={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(v.sourceId=y.id,v.sourceName=y.name,v.sourceUrl=y.url),$t(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:v,body:n})}Zt=new WeakMap,Qt=new WeakMap;var ar=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const cr=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],ur={includeResult:!0};function lr(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=r.tag&&i?[i,r.tag].join("."):r.tag,c={...ar(r,ur),tag:a},u=(l=c,cr.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=ct({query:e,params:t,options:{tag:a,...u}}),d="".concat(n).concat(Vt(this,"listen",h));if(d.length>14800)return new we((e=>e.error(new Error("Query too large for listener"))));const p=c.events?c.events:["mutation"],f=-1!==p.indexOf("reconnect"),y={};return(o||s)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new we((e=>{let t,r;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let n=!1;function o(){n||(f&&e.next({type:"reconnect"}),n||t.readyState===t.CLOSED&&(c(),clearTimeout(r),r=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=hr(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function i(t){const r=hr(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",s),t.removeEventListener("disconnect",a),p.forEach((e=>t.removeEventListener(e,i))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return sn})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",s),t.addEventListener("disconnect",a),p.forEach((e=>t.addEventListener(e,i))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),h()}))}function h(){n=!0,c()}return h}))}function hr(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var dr,pr,fr,yr,vr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},gr=(e,t,r)=>(vr(e,t,"read from private field"),r?r.call(e):t.get(e)),mr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},br=(e,t,r,n)=>(vr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class wr{constructor(e,t){mr(this,dr,void 0),mr(this,pr,void 0),br(this,dr,e),br(this,pr,t)}create(e,t){return Er(gr(this,dr),gr(this,pr),"PUT",e,t)}edit(e,t){return Er(gr(this,dr),gr(this,pr),"PATCH",e,t)}delete(e){return Er(gr(this,dr),gr(this,pr),"DELETE",e)}list(){return Gt(gr(this,dr),gr(this,pr),{uri:"/datasets"})}}dr=new WeakMap,pr=new WeakMap;class Cr{constructor(e,t){mr(this,fr,void 0),mr(this,yr,void 0),br(this,fr,e),br(this,yr,t)}create(e,t){return Se(Er(gr(this,fr),gr(this,yr),"PUT",e,t))}edit(e,t){return Se(Er(gr(this,fr),gr(this,yr),"PATCH",e,t))}delete(e){return Se(Er(gr(this,fr),gr(this,yr),"DELETE",e))}list(){return Se(Gt(gr(this,fr),gr(this,yr),{uri:"/datasets"}))}}function Er(e,t,r,n,o){return Be(n),Gt(e,t,{method:r,uri:"/datasets/".concat(n),body:o})}fr=new WeakMap,yr=new WeakMap;var xr,Tr,Or,Sr,_r=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},jr=(e,t,r)=>(_r(e,t,"read from private field"),r?r.call(e):t.get(e)),Ar=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},kr=(e,t,r,n)=>(_r(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Rr{constructor(e,t){Ar(this,xr,void 0),Ar(this,Tr,void 0),kr(this,xr,e),kr(this,Tr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Gt(jr(this,xr),jr(this,Tr),{uri:t})}getById(e){return Gt(jr(this,xr),jr(this,Tr),{uri:"/projects/".concat(e)})}}xr=new WeakMap,Tr=new WeakMap;class Mr{constructor(e,t){Ar(this,Or,void 0),Ar(this,Sr,void 0),kr(this,Or,e),kr(this,Sr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Se(Gt(jr(this,Or),jr(this,Sr),{uri:t}))}getById(e){return Se(Gt(jr(this,Or),jr(this,Sr),{uri:"/projects/".concat(e)}))}}Or=new WeakMap,Sr=new WeakMap;var Fr,Ir,Pr,Dr,qr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Nr=(e,t,r)=>(qr(e,t,"read from private field"),r?r.call(e):t.get(e)),Hr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Wr=(e,t,r,n)=>(qr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class zr{constructor(e,t){Hr(this,Fr,void 0),Hr(this,Ir,void 0),Wr(this,Fr,e),Wr(this,Ir,t)}getById(e){return Gt(Nr(this,Fr),Nr(this,Ir),{uri:"/users/".concat(e)})}}Fr=new WeakMap,Ir=new WeakMap;class Ur{constructor(e,t){Hr(this,Pr,void 0),Hr(this,Dr,void 0),Wr(this,Pr,e),Wr(this,Dr,t)}getById(e){return Se(Gt(Nr(this,Pr),Nr(this,Dr),{uri:"/users/".concat(e)}))}}Pr=new WeakMap,Dr=new WeakMap;var Lr,Br,$r,Gr,Vr=Object.defineProperty,Jr=(e,t,r)=>(((e,t,r)=>{t in e?Vr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),Xr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Yr=(e,t,r)=>(Xr(e,t,"read from private field"),r?r.call(e):t.get(e)),Kr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Zr=(e,t,r,n)=>(Xr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Lr=new WeakMap,Br=new WeakMap;let Qr=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rt;Jr(this,"assets"),Jr(this,"datasets"),Jr(this,"projects"),Jr(this,"users"),Kr(this,Lr,void 0),Kr(this,Br,void 0),Jr(this,"listen",lr),this.config(t),Zr(this,Br,e),this.assets=new or(this,Yr(this,Br)),this.datasets=new wr(this,Yr(this,Br)),this.projects=new Rr(this,Yr(this,Br)),this.users=new zr(this,Yr(this,Br))}clone(){return new e(Yr(this,Br),this.config())}config(e){if(void 0===e)return{...Yr(this,Lr)};if(Yr(this,Lr)&&!1===Yr(this,Lr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Zr(this,Lr,st(e,Yr(this,Lr)||{})),this}withConfig(t){return new e(Yr(this,Br),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Dt(this,Yr(this,Br),e,t,r)}getDocument(e,t){return qt(this,Yr(this,Br),e,t)}getDocuments(e,t){return Nt(this,Yr(this,Br),e,t)}create(e,t){return Bt(this,Yr(this,Br),e,"create",t)}createIfNotExists(e,t){return Ht(this,Yr(this,Br),e,t)}createOrReplace(e,t){return Wt(this,Yr(this,Br),e,t)}delete(e,t){return zt(this,Yr(this,Br),e,t)}mutate(e,t){return Ut(this,Yr(this,Br),e,t)}patch(e,t){return new mt(e,t,this)}transaction(e){return new Rt(e,this)}request(e){return Gt(this,Yr(this,Br),e)}getUrl(e,t){return Jt(this,e,t)}getDataUrl(e,t){return Vt(this,e,t)}};$r=new WeakMap,Gr=new WeakMap;let en=class e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rt;Jr(this,"assets"),Jr(this,"datasets"),Jr(this,"projects"),Jr(this,"users"),Jr(this,"observable"),Kr(this,$r,void 0),Kr(this,Gr,void 0),Jr(this,"listen",lr),this.config(t),Zr(this,Gr,e),this.assets=new sr(this,Yr(this,Gr)),this.datasets=new Cr(this,Yr(this,Gr)),this.projects=new Mr(this,Yr(this,Gr)),this.users=new Ur(this,Yr(this,Gr)),this.observable=new Qr(e,t)}clone(){return new e(Yr(this,Gr),this.config())}config(e){if(void 0===e)return{...Yr(this,$r)};if(Yr(this,$r)&&!1===Yr(this,$r).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),Zr(this,$r,st(e,Yr(this,$r)||{})),this}withConfig(t){return new e(Yr(this,Gr),{...this.config(),...t})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(Dt(this,Yr(this,Gr),e,t,r))}getDocument(e,t){return Se(qt(this,Yr(this,Gr),e,t))}getDocuments(e,t){return Se(Nt(this,Yr(this,Gr),e,t))}create(e,t){return Se(Bt(this,Yr(this,Gr),e,"create",t))}createIfNotExists(e,t){return Se(Ht(this,Yr(this,Gr),e,t))}createOrReplace(e,t){return Se(Wt(this,Yr(this,Gr),e,t))}delete(e,t){return Se(zt(this,Yr(this,Gr),e,t))}mutate(e,t){return Se(Ut(this,Yr(this,Gr),e,t))}patch(e,t){return new bt(e,t,this)}transaction(e){return new kt(e,this)}request(e){return Se(Gt(this,Yr(this,Gr),e))}dataRequest(e,t,r){return Se(Lt(this,Yr(this,Gr),e,t,r))}getUrl(e,t){return Jt(this,e,t)}getDataUrl(e,t){return Vt(this,e,t)}};const tn=He(Ae,{}),rn=tn.defaultRequester;var nn={exports:{}};
|
|
9
9
|
/** @license
|
|
10
10
|
* eventsource.js
|
|
11
11
|
* Available under MIT License (MIT)
|
|
12
12
|
* https://github.com/Yaffle/EventSource/
|
|
13
|
-
*/!function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,s=r.XMLHttpRequest,i=r.XDomainRequest,a=r.ActiveXObject,c=r.EventSource,u=r.document,l=r.Promise,h=r.fetch,d=r.Response,p=r.TextDecoder,f=r.TextEncoder,y=r.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var v=h;h=function(e,t){var r=t.signal;return v(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return r._reader=t,r._aborted&&r._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(e){function t(e,t,r){if(1===r)return e>=128>>t&&e<<t<=2047;if(2===r)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===r)return e>=65536>>t&&e<<t<=1114111;throw new Error}function r(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var n=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==s&&(c<128||c>191||!t(i<<6|63&c,s-6,r(s,i)))&&(s=0,i=n,o+=String.fromCharCode(i)),0===s?(c>=0&&c<=127?(s=0,i=c):c>=192&&c<=223?(s=6,i=31&c):c>=224&&c<=239?(s=12,i=15&c):c>=240&&c<=247?(s=18,i=7&c):(s=0,i=n),0===s||t(i,s,r(s,i))||(s=0,i=n)):(s-=6,i=i<<6|63&c),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o};null!=p&&null!=f&&function(){try{return"test"===(new p).decode((new f).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=g);var m=function(){};function b(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=m,this.onload=m,this.onerror=m,this.onreadystatechange=m,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=m}function w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),s=o.shift(),i=o.join(": ");t[w(s)]=i}this._map=t}function E(){}function x(e){this._headers=e}function T(){}function O(){this._listeners=Object.create(null)}function _(e){n((function(){throw e}),0)}function S(e){this.type=e,this.target=void 0}function j(e,t){S.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){S.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){S.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var r=this,i=this._xhr,a=1,c=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=m,i.onerror=m,i.onabort=m,i.onprogress=m,i.onreadystatechange=m,i.abort(),0!==c&&(o(c),c=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var u=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in i)e=200,t="OK",n=i.contentType;else try{e=i.status,t=i.statusText,n=i.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(a=2,r.readyState=2,r.status=e,r.statusText=t,r._contentType=n,r.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:m}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),r.readyState=4,"load"===e)r.onload(t);else if("error"===e)r.onerror(t);else{if("abort"!==e)throw new TypeError;r.onabort(t)}r.onreadystatechange()}},d=function(){c=n((function(){d()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(e){h("load",e)}),"onerror"in i&&(i.onerror=function(e){h("error",e)}),"onabort"in i&&(i.onabort=function(e){h("abort",e)}),"onprogress"in i&&(i.onprogress=l),"onreadystatechange"in i&&(i.onreadystatechange=function(e){!function(e){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||l():2===i.readyState&&u())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(c=n((function(){d()}),0))},b.prototype.abort=function(){this._abort(!1)},b.prototype.getResponseHeader=function(e){return this._contentType},b.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},b.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},b.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=n((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[w(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,r,n,o,i,a){e.open("GET",o);var c=0;for(var u in e.onprogress=function(){var t=e.responseText.slice(c);c+=t.length,r(t)},e.onerror=function(e){e.preventDefault(),n(new Error("NetworkError"))},e.onload=function(){n(null)},e.onabort=function(){n(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(r,n,o,new C(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,u)&&e.setRequestHeader(u,a[u]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,r,n,o,s,i){var a=null,c=new y,u=c.signal,d=new p;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new x(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});r(o),n()}})).catch((function(e){t(e)}))};n()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){n(e)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var r=t.length,n=0;n<r;n+=1){var o=t[n];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){_(e)}}},O.prototype.addEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];null==n&&(n=[],r[e]=n);for(var o=!1,s=0;s<n.length;s+=1)n[s]===t&&(o=!0);o||n.push(t)},O.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],s=0;s<n.length;s+=1)n[s]!==t&&o.push(n[s]);0===o.length?delete r[e]:r[e]=o}},j.prototype=Object.create(S.prototype),A.prototype=Object.create(S.prototype),k.prototype=Object.create(S.prototype);var R=-1,M=0,F=1,I=2,P=-1,D=0,q=1,N=2,H=3,W=/^text\/event\-stream(;.*)?$/i,z=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),U(r)},U=function(e){return Math.min(Math.max(e,1e3),18e6)},L=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){_(e)}};function B(e,t){O.call(this),t=t||{},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(e,t,r){t=String(t);var a=Boolean(r.withCredentials),c=r.lastEventIdQueryParameterName||"lastEventId",u=U(1e3),l=z(r.heartbeatTimeout,45e3),h="",d=u,p=!1,f=0,y=r.headers||{},v=r.Transport,g=$&&null==v?void 0:new b(null!=v?new v:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),m=null!=v&&"string"!=typeof v?new v:null==g?new T:new E,w=void 0,C=0,x=R,O="",_="",S="",B="",G=D,V=0,J=0,X=function(t,r,n,o){if(x===M)if(200===t&&null!=n&&W.test(n)){x=F,p=Date.now(),d=u,e.readyState=F;var s=new A("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),L(e,e.onopen,s)}else{var i="";200!==t?(r&&(r=r.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",Z();s=new A("error",{status:t,statusText:r,headers:o});e.dispatchEvent(s),L(e,e.onerror,s),console.error(i)}},Y=function(t){if(x===F){for(var r=-1,s=0;s<t.length;s+=1){(c=t.charCodeAt(s))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(r=s)}var i=(-1!==r?B:"")+t.slice(0,r+1);B=(-1===r?B:"")+t.slice(r+1),""!==t&&(p=Date.now(),f+=t.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(G===P&&c==="\n".charCodeAt(0))G=D;else if(G===P&&(G=D),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(G!==D){G===q&&(J=a+1);var y=i.slice(V,J-1),v=i.slice(J+(J<a&&i.charCodeAt(J)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=v):"id"===y?_=v:"event"===y?S=v:"retry"===y?(u=z(v,u),d=u):"heartbeatTimeout"===y&&(l=z(v,l),0!==C&&(o(C),C=n((function(){Q()}),l)))}if(G===D){if(""!==O){h=_,""===S&&(S="message");var g=new j(S,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(g),"open"===S?L(e,e.onopen,g):"message"===S?L(e,e.onmessage,g):"error"===S&&L(e,e.onerror,g),x===I)return}O="",S=""}G=c==="\r".charCodeAt(0)?P:D}else G===D&&(V=a,G=q),G===q?c===":".charCodeAt(0)&&(J=a+1,G=N):G===N&&(G=H)}}},K=function(t){if(x===F||x===M){x=R,0!==C&&(o(C),C=0),C=n((function(){Q()}),d),d=U(Math.min(16*u,2*d)),e.readyState=M;var r=new k("error",{error:t});e.dispatchEvent(r),L(e,e.onerror,r),null!=t&&console.error(t)}},Z=function(){x=I,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=I},Q=function(){if(C=0,x===R){p=!1,f=0,C=n((function(){Q()}),l),x=M,O="",S="",_=h,B="",V=0,J=0,G=D;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===c?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var s=e.withCredentials,i={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(i[u]=a[u]);try{w=m.open(g,X,Y,K,r,s,i)}catch(e){throw Z(),e}}else if(p||null==w){var d=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=n((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(x===M?"No response received.":f+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=M,e.withCredentials=a,e.headers=y,e._close=Z,Q()}(this,e,t)}var $=null!=h&&null!=d&&"body"in d.prototype;B.prototype=Object.create(O.prototype),B.prototype.CONNECTING=M,B.prototype.OPEN=F,B.prototype.CLOSED=I,B.prototype.close=function(){this._close()},B.CONNECTING=M,B.OPEN=F,B.CLOSED=I,B.prototype.withCredentials=void 0;var G,V=c;null==s||null!=c&&"withCredentials"in c.prototype||(V=B),G=function(e){e.EventSourcePolyfill=B,e.NativeEventSource=c,e.EventSource=V}(t),void 0!==G&&(e.exports=G)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:i:globalThis)}(rn,rn.exports);var nn=a(rn.exports.EventSourcePolyfill),on=Object.freeze({__proto__:null,default:nn});e.BasePatch=vt,e.BaseTransaction=jt,e.ClientError=Me,e.ObservablePatch=gt,e.ObservableSanityClient=Zr,e.ObservableTransaction=kt,e.Patch=mt,e.SanityClient=Qr,e.ServerError=Fe,e.Transaction=At,e.createClient=e=>new Qr(He(Ae,{maxRetries:e.maxRetries,retryDelay:e.retryDelay}),e),e.default=function(e){return et(),new Qr(en,e)},e.requester=tn,e.unstable__adapter=S,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
13
|
+
*/!function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,s=r.XMLHttpRequest,i=r.XDomainRequest,a=r.ActiveXObject,c=r.EventSource,u=r.document,l=r.Promise,h=r.fetch,d=r.Response,p=r.TextDecoder,f=r.TextEncoder,y=r.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var v=h;h=function(e,t){var r=t.signal;return v(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return r._reader=t,r._aborted&&r._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(e){function t(e,t,r){if(1===r)return e>=128>>t&&e<<t<=2047;if(2===r)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===r)return e>=65536>>t&&e<<t<=1114111;throw new Error}function r(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var n=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==s&&(c<128||c>191||!t(i<<6|63&c,s-6,r(s,i)))&&(s=0,i=n,o+=String.fromCharCode(i)),0===s?(c>=0&&c<=127?(s=0,i=c):c>=192&&c<=223?(s=6,i=31&c):c>=224&&c<=239?(s=12,i=15&c):c>=240&&c<=247?(s=18,i=7&c):(s=0,i=n),0===s||t(i,s,r(s,i))||(s=0,i=n)):(s-=6,i=i<<6|63&c),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o};null!=p&&null!=f&&function(){try{return"test"===(new p).decode((new f).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=g);var m=function(){};function b(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=m,this.onload=m,this.onerror=m,this.onreadystatechange=m,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=m}function w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),s=o.shift(),i=o.join(": ");t[w(s)]=i}this._map=t}function E(){}function x(e){this._headers=e}function T(){}function O(){this._listeners=Object.create(null)}function S(e){n((function(){throw e}),0)}function _(e){this.type=e,this.target=void 0}function j(e,t){_.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){_.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){_.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var r=this,i=this._xhr,a=1,c=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=m,i.onerror=m,i.onabort=m,i.onprogress=m,i.onreadystatechange=m,i.abort(),0!==c&&(o(c),c=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var u=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in i)e=200,t="OK",n=i.contentType;else try{e=i.status,t=i.statusText,n=i.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(a=2,r.readyState=2,r.status=e,r.statusText=t,r._contentType=n,r.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:m}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),r.readyState=4,"load"===e)r.onload(t);else if("error"===e)r.onerror(t);else{if("abort"!==e)throw new TypeError;r.onabort(t)}r.onreadystatechange()}},d=function(){c=n((function(){d()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(e){h("load",e)}),"onerror"in i&&(i.onerror=function(e){h("error",e)}),"onabort"in i&&(i.onabort=function(e){h("abort",e)}),"onprogress"in i&&(i.onprogress=l),"onreadystatechange"in i&&(i.onreadystatechange=function(e){!function(e){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||l():2===i.readyState&&u())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(c=n((function(){d()}),0))},b.prototype.abort=function(){this._abort(!1)},b.prototype.getResponseHeader=function(e){return this._contentType},b.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},b.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},b.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=n((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[w(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,r,n,o,i,a){e.open("GET",o);var c=0;for(var u in e.onprogress=function(){var t=e.responseText.slice(c);c+=t.length,r(t)},e.onerror=function(e){e.preventDefault(),n(new Error("NetworkError"))},e.onload=function(){n(null)},e.onabort=function(){n(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(r,n,o,new C(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,u)&&e.setRequestHeader(u,a[u]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,r,n,o,s,i){var a=null,c=new y,u=c.signal,d=new p;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new x(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});r(o),n()}})).catch((function(e){t(e)}))};n()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){n(e)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var r=t.length,n=0;n<r;n+=1){var o=t[n];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){S(e)}}},O.prototype.addEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];null==n&&(n=[],r[e]=n);for(var o=!1,s=0;s<n.length;s+=1)n[s]===t&&(o=!0);o||n.push(t)},O.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],s=0;s<n.length;s+=1)n[s]!==t&&o.push(n[s]);0===o.length?delete r[e]:r[e]=o}},j.prototype=Object.create(_.prototype),A.prototype=Object.create(_.prototype),k.prototype=Object.create(_.prototype);var R=-1,M=0,F=1,I=2,P=-1,D=0,q=1,N=2,H=3,W=/^text\/event\-stream(;.*)?$/i,z=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),U(r)},U=function(e){return Math.min(Math.max(e,1e3),18e6)},L=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){S(e)}};function B(e,t){O.call(this),t=t||{},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(e,t,r){t=String(t);var a=Boolean(r.withCredentials),c=r.lastEventIdQueryParameterName||"lastEventId",u=U(1e3),l=z(r.heartbeatTimeout,45e3),h="",d=u,p=!1,f=0,y=r.headers||{},v=r.Transport,g=$&&null==v?void 0:new b(null!=v?new v:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),m=null!=v&&"string"!=typeof v?new v:null==g?new T:new E,w=void 0,C=0,x=R,O="",S="",_="",B="",G=D,V=0,J=0,X=function(t,r,n,o){if(x===M)if(200===t&&null!=n&&W.test(n)){x=F,p=Date.now(),d=u,e.readyState=F;var s=new A("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),L(e,e.onopen,s)}else{var i="";200!==t?(r&&(r=r.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",Z();s=new A("error",{status:t,statusText:r,headers:o});e.dispatchEvent(s),L(e,e.onerror,s),console.error(i)}},Y=function(t){if(x===F){for(var r=-1,s=0;s<t.length;s+=1){(c=t.charCodeAt(s))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(r=s)}var i=(-1!==r?B:"")+t.slice(0,r+1);B=(-1===r?B:"")+t.slice(r+1),""!==t&&(p=Date.now(),f+=t.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(G===P&&c==="\n".charCodeAt(0))G=D;else if(G===P&&(G=D),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(G!==D){G===q&&(J=a+1);var y=i.slice(V,J-1),v=i.slice(J+(J<a&&i.charCodeAt(J)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=v):"id"===y?S=v:"event"===y?_=v:"retry"===y?(u=z(v,u),d=u):"heartbeatTimeout"===y&&(l=z(v,l),0!==C&&(o(C),C=n((function(){Q()}),l)))}if(G===D){if(""!==O){h=S,""===_&&(_="message");var g=new j(_,{data:O.slice(1),lastEventId:S});if(e.dispatchEvent(g),"open"===_?L(e,e.onopen,g):"message"===_?L(e,e.onmessage,g):"error"===_&&L(e,e.onerror,g),x===I)return}O="",_=""}G=c==="\r".charCodeAt(0)?P:D}else G===D&&(V=a,G=q),G===q?c===":".charCodeAt(0)&&(J=a+1,G=N):G===N&&(G=H)}}},K=function(t){if(x===F||x===M){x=R,0!==C&&(o(C),C=0),C=n((function(){Q()}),d),d=U(Math.min(16*u,2*d)),e.readyState=M;var r=new k("error",{error:t});e.dispatchEvent(r),L(e,e.onerror,r),null!=t&&console.error(t)}},Z=function(){x=I,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=I},Q=function(){if(C=0,x===R){p=!1,f=0,C=n((function(){Q()}),l),x=M,O="",_="",S=h,B="",V=0,J=0,G=D;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===c?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var s=e.withCredentials,i={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(i[u]=a[u]);try{w=m.open(g,X,Y,K,r,s,i)}catch(e){throw Z(),e}}else if(p||null==w){var d=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=n((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(x===M?"No response received.":f+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=M,e.withCredentials=a,e.headers=y,e._close=Z,Q()}(this,e,t)}var $=null!=h&&null!=d&&"body"in d.prototype;B.prototype=Object.create(O.prototype),B.prototype.CONNECTING=M,B.prototype.OPEN=F,B.prototype.CLOSED=I,B.prototype.close=function(){this._close()},B.CONNECTING=M,B.OPEN=F,B.CLOSED=I,B.prototype.withCredentials=void 0;var G,V=c;null==s||null!=c&&"withCredentials"in c.prototype||(V=B),G=function(e){e.EventSourcePolyfill=B,e.NativeEventSource=c,e.EventSource=V}(t),void 0!==G&&(e.exports=G)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:i:globalThis)}(nn,nn.exports);var on=a(nn.exports.EventSourcePolyfill),sn=Object.freeze({__proto__:null,default:on});e.BasePatch=gt,e.BaseTransaction=At,e.ClientError=Me,e.ObservablePatch=mt,e.ObservableSanityClient=Qr,e.ObservableTransaction=Rt,e.Patch=bt,e.SanityClient=en,e.ServerError=Fe,e.Transaction=kt,e.createClient=e=>new en(He(Ae,{maxRetries:e.maxRetries,retryDelay:e.retryDelay}),e),e.default=function(e){return tt(),new en(tn,e)},e.requester=rn,e.unstable__adapter=_,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|