@sanity/client 6.0.0 → 6.0.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "6.0.0",
3
+ "version": "6.0.2-beta.0",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -104,7 +104,7 @@
104
104
  "@types/node": "^18.15.10",
105
105
  "@typescript-eslint/eslint-plugin": "^5.57.0",
106
106
  "@typescript-eslint/parser": "^5.57.0",
107
- "@vitest/coverage-c8": "^0.30.0",
107
+ "@vitest/coverage-c8": "^0.31.0",
108
108
  "eslint": "^8.36.0",
109
109
  "eslint-config-prettier": "^8.8.0",
110
110
  "eslint-plugin-prettier": "^4.2.1",
@@ -120,7 +120,7 @@
120
120
  "sse-channel": "^4.0.0",
121
121
  "terser": "^5.16.8",
122
122
  "typescript": "^5.0.2",
123
- "vitest": "^0.30.0",
123
+ "vitest": "^0.31.0",
124
124
  "vitest-github-actions-reporter": "^0.10.0"
125
125
  },
126
126
  "engines": {
@@ -302,8 +302,10 @@ export function _requestObservable<R>(
302
302
  options.query = {tag: validate.requestTag(tag), ...options.query}
303
303
  }
304
304
 
305
- if (config.resultSourceMap) {
306
- options.query = {resultSourceMap: true, ...options.query}
305
+ if (canUseCdn) {
306
+ if (config.resultSourceMap) {
307
+ options.query = {resultSourceMap: true, ...options.query}
308
+ }
307
309
  }
308
310
 
309
311
  const reqOptions = requestOptions(
@@ -56,6 +56,10 @@
56
56
 
57
57
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
58
58
 
59
+ function getDefaultExportFromCjs (x) {
60
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
61
+ }
62
+
59
63
  var trim = function(string) {
60
64
  return string.replace(/^\s+|\s+$/g, '');
61
65
  }
@@ -89,6 +93,8 @@
89
93
  return result
90
94
  };
91
95
 
96
+ var parseHeaders$1 = /*@__PURE__*/getDefaultExportFromCjs(parseHeaders);
97
+
92
98
  var middlewareReducer = middleware => {
93
99
  const applyMiddleware = function (hook, defaultValue) {
94
100
  const bailEarly = hook === "onError";
@@ -332,8 +338,12 @@
332
338
  let aborted = false;
333
339
  let loaded = false;
334
340
  let timedOut = false;
335
- xhr.onerror = onError;
336
- xhr.ontimeout = onError;
341
+ xhr.onerror = event => {
342
+ onError(new Error("Request error while attempting to reach ".concat(options.url).concat(event.lengthComputable ? "(".concat(event.loaded, " of ").concat(event.total, " bytes transferred)") : "")));
343
+ };
344
+ xhr.ontimeout = event => {
345
+ onError(new Error("Request timeout while attempting to reach ".concat(options.url).concat(event.lengthComputable ? "(".concat(event.loaded, " of ").concat(event.total, " bytes transferred)") : "")));
346
+ };
337
347
  xhr.onabort = () => {
338
348
  stopTimers(true);
339
349
  aborted = true;
@@ -421,7 +431,7 @@
421
431
  body: xhr.response || (xhr.responseType === "" || xhr.responseType === "text" ? xhr.responseText : ""),
422
432
  url: options.url,
423
433
  method: options.method,
424
- headers: parseHeaders(xhr.getAllResponseHeaders()),
434
+ headers: parseHeaders$1(xhr.getAllResponseHeaders()),
425
435
  statusCode: xhr.status,
426
436
  statusMessage: xhr.statusText
427
437
  };
@@ -446,11 +456,7 @@
446
456
  };
447
457
  const environment = "browser";
448
458
 
449
- var browserExports = {};
450
- var browser$2 = {
451
- get exports(){ return browserExports; },
452
- set exports(v){ browserExports = v; },
453
- };
459
+ var browser$3 = {exports: {}};
454
460
 
455
461
  /**
456
462
  * Helpers.
@@ -1166,8 +1172,8 @@
1166
1172
  } catch (error) {
1167
1173
  return '[UnexpectedJSONParseError]: ' + error.message;
1168
1174
  }
1169
- };
1170
- } (browser$2, browserExports));
1175
+ };
1176
+ } (browser$3, browser$3.exports));
1171
1177
 
1172
1178
  /*!
1173
1179
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
@@ -2910,11 +2916,13 @@
2910
2916
  ...options.query
2911
2917
  };
2912
2918
  }
2913
- if (config.resultSourceMap) {
2914
- options.query = {
2915
- resultSourceMap: true,
2916
- ...options.query
2917
- };
2919
+ if (canUseCdn) {
2920
+ if (config.resultSourceMap) {
2921
+ options.query = {
2922
+ resultSourceMap: true,
2923
+ ...options.query
2924
+ };
2925
+ }
2918
2926
  }
2919
2927
  const reqOptions = requestOptions(config, Object.assign({}, options, {
2920
2928
  url: _getUrl(client, uri, useCdn)
@@ -3268,7 +3276,7 @@
3268
3276
  async function getEventSource() {
3269
3277
  const {
3270
3278
  default: EventSource
3271
- } = await Promise.resolve().then(function () { return browser$1; });
3279
+ } = await Promise.resolve().then(function () { return browser$2; });
3272
3280
  const evs = new EventSource(uri, esOptions);
3273
3281
  evs.addEventListener("error", onError);
3274
3282
  evs.addEventListener("channelError", onChannelError);
@@ -3878,11 +3886,7 @@
3878
3886
  return new SanityClient(httpRequest, config);
3879
3887
  }
3880
3888
 
3881
- var eventsourceExports = {};
3882
- var eventsource = {
3883
- get exports(){ return eventsourceExports; },
3884
- set exports(v){ eventsourceExports = v; },
3885
- };
3889
+ var eventsource = {exports: {}};
3886
3890
 
3887
3891
  /** @license
3888
3892
  * eventsource.js
@@ -4925,14 +4929,18 @@
4925
4929
  exports.NativeEventSource = NativeEventSource;
4926
4930
  exports.EventSource = R;
4927
4931
  });
4928
- }(typeof globalThis === 'undefined' ? (typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal) : globalThis));
4929
- } (eventsource, eventsourceExports));
4932
+ }(typeof globalThis === 'undefined' ? (typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : commonjsGlobal) : globalThis));
4933
+ } (eventsource, eventsource.exports));
4934
+
4935
+ var eventsourceExports = eventsource.exports;
4930
4936
 
4931
4937
  var browser = eventsourceExports.EventSourcePolyfill;
4932
4938
 
4933
- var browser$1 = /*#__PURE__*/Object.freeze({
4939
+ var browser$1 = /*@__PURE__*/getDefaultExportFromCjs(browser);
4940
+
4941
+ var browser$2 = /*#__PURE__*/Object.freeze({
4934
4942
  __proto__: null,
4935
- default: browser
4943
+ default: browser$1
4936
4944
  });
4937
4945
 
4938
4946
  exports.BasePatch = BasePatch;
@@ -1,14 +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};function r(e){const r="string"==typeof e?Object.assign({url:e},t):Object.assign({},t,e),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.searchParams.append(e,r);else o.searchParams.append(e,t);return r.method=r.body&&!r.method?"POST":(r.method||"GET").toUpperCase(),r.url="http://localhost"===o.origin?"".concat(o.pathname,"?").concat(o.searchParams):o.toString(),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;function s(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:{},a=function(e){return e.replace(/^\s+|\s+$/g,"")},c=function(e){if(!e)return{};for(var t,r={},n=a(e).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),c=a(s.slice(0,i)).toLowerCase(),u=a(s.slice(i+1));void 0===r[c]?r[c]=u:(t=r[c],"[object Array]"===Object.prototype.toString.call(t)?r[c].push(u):r[c]=[r[c],u])}return r};const u=["request","response","progress","error","abort"],l=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function h(e,t){const n=[],o=l.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[s]});function i(e){const r=u.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=null;const c=r.request.subscribe((e=>{a=t(e,((t,o)=>function(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 l=n("onReturn",r,i);return l===r&&r.request.publish(i),l}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 l.forEach((t=>{e[t]&&o[t].push(e[t])})),n.push(e),i},i.clone=function(){return h(n,t)},e.forEach(i.use),i}var d,f,p,y,g,m=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},v=(e,t,r)=>(m(e,t,"read from private field"),r?r.call(e):t.get(e)),w=(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)},b=(e,t,r,n)=>(m(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);d=new WeakMap,f=new WeakMap,p=new WeakMap,y=new WeakMap,g=new WeakMap;const C="function"==typeof XMLHttpRequest?"xhr":"fetch",E="xhr"===C?XMLHttpRequest:class{constructor(){this.readyState=0,this.responseType="",w(this,d,void 0),w(this,f,void 0),w(this,p,void 0),w(this,y,{}),w(this,g,void 0)}open(e,t,r){b(this,d,e),b(this,f,t),b(this,p,""),this.readyState=1,this.onreadystatechange(),b(this,g,void 0)}abort(){v(this,g)&&v(this,g).abort()}getAllResponseHeaders(){return v(this,p)}setRequestHeader(e,t){v(this,y)[e]=t}send(e){const t="arraybuffer"!==this.responseType,r={method:v(this,d),headers:v(this,y),body:e};"function"==typeof AbortController&&(b(this,g,new AbortController),"undefined"!=typeof EventTarget&&v(this,g).signal instanceof EventTarget&&(r.signal=v(this,g).signal)),"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(v(this,f),r).then((e=>(e.headers.forEach(((e,t)=>{b(this,p,v(this,p)+"".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()}))}};var x=(e,t)=>{const r=e.options,n=e.applyMiddleware("finalizeOptions",r),o={},s=e.applyMiddleware("interceptRequest",void 0,{adapter:C,context:e});if(s){const e=setTimeout(t,0,null,s);return{abort:()=>clearTimeout(e)}}let i=new E;const a=n.headers,u=n.timeout;let l=!1,h=!1,d=!1;if(i.onerror=y,i.ontimeout=y,i.onabort=()=>{p(!0),l=!0},i.onreadystatechange=()=>{!function(){if(!u)return;p(),o.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),u.socket)}(),l||4!==i.readyState||0!==i.status&&function(){if(l||h||d)return;if(0===i.status)return void y(new Error("Unknown XHR error"));p(),h=!0,t(null,{body:i.response||(""===i.responseType||"text"===i.responseType?i.responseText:""),url:n.url,method:n.method,headers:c(i.getAllResponseHeaders()),statusCode:i.status,statusMessage:i.statusText})}()},i.open(n.method,n.url,!0),i.withCredentials=!!n.withCredentials,a&&i.setRequestHeader)for(const e in a)a.hasOwnProperty(e)&&i.setRequestHeader(e,a[e]);return n.rawBody&&(i.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:n,adapter:C,request:i,context:e}),i.send(n.body||null),u&&(o.connect=setTimeout((()=>f("ETIMEDOUT")),u.connect)),{abort:function(){l=!0,i&&i.abort()}};function f(t){d=!0,i.abort();const r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(n.url):"Connection timed out on request to ".concat(n.url));r.code=t,e.channels.error.publish(r)}function p(e){(e||l||i.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function y(e){if(h)return;p(!0),h=!0,i=null;const r=e||new Error("Network error while attempting to reach ".concat(n.url));r.isNetworkError=!0,r.request=n,t(r)}};var T,O,_={};function S(){if(O)return T;O=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 T=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 j=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=S(),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};function r(e){const r="string"==typeof e?Object.assign({url:e},t):Object.assign({},t,e),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.searchParams.append(e,r);else o.searchParams.append(e,t);return r.method=r.body&&!r.method?"POST":(r.method||"GET").toUpperCase(),r.url="http://localhost"===o.origin?"".concat(o.pathname,"?").concat(o.searchParams):o.toString(),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;function s(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=null;const c=r.request.subscribe((e=>{a=t(e,((t,o)=>function(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=function(){return d(n,t)},e.forEach(i.use),i}var f,p,y,m,g,v=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},w=(e,t,r)=>(v(e,t,"read from private field"),r?r.call(e):t.get(e)),b=(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)},C=(e,t,r,n)=>(v(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);f=new WeakMap,p=new WeakMap,y=new WeakMap,m=new WeakMap,g=new WeakMap;const E="function"==typeof XMLHttpRequest?"xhr":"fetch",x="xhr"===E?XMLHttpRequest:class{constructor(){this.readyState=0,this.responseType="",b(this,f,void 0),b(this,p,void 0),b(this,y,void 0),b(this,m,{}),b(this,g,void 0)}open(e,t,r){C(this,f,e),C(this,p,t),C(this,y,""),this.readyState=1,this.onreadystatechange(),C(this,g,void 0)}abort(){w(this,g)&&w(this,g).abort()}getAllResponseHeaders(){return w(this,y)}setRequestHeader(e,t){w(this,m)[e]=t}send(e){const t="arraybuffer"!==this.responseType,r={method:w(this,f),headers:w(this,m),body:e};"function"==typeof AbortController&&(C(this,g,new AbortController),"undefined"!=typeof EventTarget&&w(this,g).signal instanceof EventTarget&&(r.signal=w(this,g).signal)),"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(w(this,p),r).then((e=>(e.headers.forEach(((e,t)=>{C(this,y,w(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()}))}};var T=(e,t)=>{const r=e.options,n=e.applyMiddleware("finalizeOptions",r),o={},s=e.applyMiddleware("interceptRequest",void 0,{adapter:E,context:e});if(s){const e=setTimeout(t,0,null,s);return{abort:()=>clearTimeout(e)}}let i=new x;const a=n.headers,c=n.timeout;let l=!1,h=!1,d=!1;if(i.onerror=e=>{y(new Error("Request error while attempting to reach ".concat(n.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},i.ontimeout=e=>{y(new Error("Request timeout while attempting to reach ".concat(n.url).concat(e.lengthComputable?"(".concat(e.loaded," of ").concat(e.total," bytes transferred)"):"")))},i.onabort=()=>{p(!0),l=!0},i.onreadystatechange=()=>{!function(){if(!c)return;p(),o.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),c.socket)}(),l||4!==i.readyState||0!==i.status&&function(){if(l||h||d)return;if(0===i.status)return void y(new Error("Unknown XHR error"));p(),h=!0,t(null,{body:i.response||(""===i.responseType||"text"===i.responseType?i.responseText:""),url:n.url,method:n.method,headers:u(i.getAllResponseHeaders()),statusCode:i.status,statusMessage:i.statusText})}()},i.open(n.method,n.url,!0),i.withCredentials=!!n.withCredentials,a&&i.setRequestHeader)for(const e in a)a.hasOwnProperty(e)&&i.setRequestHeader(e,a[e]);return n.rawBody&&(i.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:n,adapter:E,request:i,context:e}),i.send(n.body||null),c&&(o.connect=setTimeout((()=>f("ETIMEDOUT")),c.connect)),{abort:function(){l=!0,i&&i.abort()}};function f(t){d=!0,i.abort();const r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(n.url):"Connection timed out on request to ".concat(n.url));r.code=t,e.channels.error.publish(r)}function p(e){(e||l||i.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function y(e){if(h)return;p(!0),h=!0,i=null;const r=e||new Error("Network error while attempting to reach ".concat(n.url));r.isNetworkError=!0,r.request=n,t(r)}};var O,_,j={exports:{}};function S(){if(_)return O;_=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 O=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 A=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=S(),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 A(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=j(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}({get exports(){return _},set exports(e){_=e}},_);const R="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),k=["boolean","string","number"];function F(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!R(t)&&(-1!==k.indexOf(typeof t)||Array.isArray(t)||!1!==A(r=t)&&(void 0===(n=r.constructor)||!1!==A(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 I(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 M;M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var P=M;function D(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||P.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())))}}class q{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const N=class{constructor(e){if("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 q(e),t(this.reason))}))}};N.source=()=>{let e;return{token:new N((t=>{e=t})),cancel:e}};var H=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function W(e){return 100*Math.pow(2,e)+100*Math.random()}const z=function(){return(e=>{const t=e.maxRetries||5,r=e.retryDelay||W,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:H,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})};z.shouldRetry=H;var L=function(e,t){return L=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])},L(e,t)};function U(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}L(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function B(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 $(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 V(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 G(e){return"function"==typeof e}function J(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}var X=J((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 Y(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var K=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=B(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(G(c))try{c()}catch(e){o=e instanceof X?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=B(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{Q(d)}catch(e){o=null!=o?o:[],e instanceof X?o=V(V([],$(o)),$(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 X(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Q(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)&&Y(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&Y(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function Z(e){return e instanceof K||e&&"closed"in e&&G(e.remove)&&G(e.add)&&G(e.unsubscribe)}function Q(e){G(e)?e():e.unsubscribe()}K.EMPTY;var ee={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},te={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=te.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,V([e,t],$(r))):setTimeout.apply(void 0,V([e,t],$(r)))},clearTimeout:function(e){var t=te.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function re(){}var ne=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,Z(t)&&t.add(r)):r.destination=ue,r}return U(t,e),t.create=function(e,t,r){return new ae(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}(K),oe=Function.prototype.bind;function se(e,t){return oe.call(e,t)}var ie=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){ce(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ce(e)}else ce(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ce(e)}},e}(),ae=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;G(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&ee.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&se(t.next,s),error:t.error&&se(t.error,s),complete:t.complete&&se(t.complete,s)}):o=t;return i.destination=new ie(o),i}return U(t,e),t}(ne);function ce(e){var t;t=e,te.setTimeout((function(){throw t}))}var ue={closed:!0,next:re,error:function(e){throw e},complete:re},le="function"==typeof Symbol&&Symbol.observable||"@@observable";function he(e){return e}var de=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 ne||function(e){return e&&G(e.next)&&G(e.error)&&G(e.complete)}(n)&&Z(n)?e:new ae(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=fe(t))((function(t,n){var o=new ae({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[le]=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?he: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=fe(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 fe(e){var t;return null!==(t=null!=e?e:ee.Promise)&&void 0!==t?t:Promise}function pe(e){return function(t){if(function(e){return G(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 ye(e,t,r,n,o){return new ge(e,t,r,n,o)}var ge=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 U(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}(ne),me=J((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function ve(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 me)}})}))}function we(e,t){return pe((function(r,n){var o=0;r.subscribe(ye(n,(function(r){n.next(e.call(t,r,o++))})))}))}function be(e,t){return pe((function(r,n){var o=0;r.subscribe(ye(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}var Ce=[];class Ee extends Error{constructor(e){const t=Te(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class xe extends Error{constructor(e){const t=Te(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function Te(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:_e(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 Oe(e)&&Oe(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 Oe(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function _e(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const Se={onResponse:e=>{if(e.statusCode>=500)throw new xe(e);if(e.statusCode>=400)throw new Ee(e);return e}},je={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function Ae(e,t){let{maxRetries:r=5,retryDelay:n}=t;const o=function(){return h(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:x)}([r>0?z({retryDelay:n,maxRetries:r,shouldRetry:Re}):{},...e,je,F(),I(),{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"))}},Se,D({implementation:de})]);function s(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:o)({maxRedirects:0,...e})}return s.defaultRequester=o,s}function Re(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=r.uri.startsWith("/data/query"),s=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!s)||z.shouldRetry(e,t,r)}const ke="X-Sanity-Project-ID";function Fe(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 Ie=["image","file"],Me=["before","after","replace"],Pe=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")},De=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},qe=(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'))},Ne=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));qe(e,t._id)},He=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},We=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},ze=e=>{let{query:t,params:r={},options:n={}}=e;const o=new URLSearchParams,{tag:s,...i}=n;s&&o.set("tag",s),o.set("query",t);for(const[e,t]of Object.entries(r))o.set("$".concat(e),JSON.stringify(t));for(const[e,t]of Object.entries(i))t&&o.set(e,"".concat(t));return"?".concat(o)};var Le,Ue,Be=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},$e=(e,t,r)=>(Be(e,t,"read from private field"),r?r.call(e):t.get(e)),Ve=(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)},Ge=(e,t,r,n)=>(Be(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Je{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return De("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===Me.indexOf(e)){const e=Me.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{...Fe(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 De(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)}}const Xe=class extends Je{constructor(e,t,r){super(e,t),Ve(this,Le,void 0),Ge(this,Le,r)}clone(){return new Xe(this.selection,{...this.operations},$e(this,Le))}commit(e){if(!$e(this,Le))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 $e(this,Le).mutate({patch:this.serialize()},r)}};let Ye=Xe;Le=new WeakMap;const Ke=class extends Je{constructor(e,t,r){super(e,t),Ve(this,Ue,void 0),Ge(this,Ue,r)}clone(){return new Ke(this.selection,{...this.operations},$e(this,Ue))}commit(e){if(!$e(this,Ue))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 $e(this,Ue).mutate({patch:this.serialize()},r)}};let Ze=Ke;Ue=new WeakMap;var Qe,et,tt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},rt=(e,t,r)=>(tt(e,t,"read from private field"),r?r.call(e):t.get(e)),nt=(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)},ot=(e,t,r,n)=>(tt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const st={returnDocuments:!1};class it{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;this.operations=e,this.trxId=t}create(e){return De("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return De(t,e),Ne(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return De(t,e),Ne(t,e),this._add({[t]:e})}delete(e){return qe("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}}const at=class extends it{constructor(e,t,r){super(e,r),nt(this,Qe,void 0),ot(this,Qe,t)}clone(){return new at([...this.operations],rt(this,Qe),this.trxId)}commit(e){if(!rt(this,Qe))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return rt(this,Qe).mutate(this.serialize(),Object.assign({transactionId:this.trxId},st,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Ze)return this._add({patch:e.serialize()});if(r){const r=t(new Ze(e,{},rt(this,Qe)));if(!(r instanceof Ze))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};let ct=at;Qe=new WeakMap;const ut=class extends it{constructor(e,t,r){super(e,r),nt(this,et,void 0),ot(this,et,t)}clone(){return new ut([...this.operations],rt(this,et),this.trxId)}commit(e){if(!rt(this,et))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return rt(this,et).mutate(this.serialize(),Object.assign({transactionId:this.trxId},st,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Ye)return this._add({patch:e.serialize()});if(r){const r=t(new Ye(e,{},rt(this,et)));if(!(r instanceof Ye))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};let lt=ut;et=new WeakMap;const ht=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},dt=e=>"response"===e.type,ft=e=>e.body,pt=11264;function yt(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;return Et(e,t,"query",{query:r,params:n},o).pipe(we(s))}function gt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Tt(e,t,{uri:_t(e,"doc",r),json:!0,tag:n.tag}).pipe(be(dt),we((e=>e.body.documents&&e.body.documents[0])))}function mt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Tt(e,t,{uri:_t(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(be(dt),we((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 vt(e,t,r,n){return Ne("createIfNotExists",r),xt(e,t,r,"createIfNotExists",n)}function wt(e,t,r,n){return Ne("createOrReplace",r),xt(e,t,r,"createOrReplace",n)}function bt(e,t,r,n){return Et(e,t,"mutate",{mutations:[{delete:Fe(r)}]},n)}function Ct(e,t,r,n){let o;o=r instanceof Ze||r instanceof Ye?{patch:r.serialize()}:r instanceof ct||r instanceof lt?r.serialize():r;return Et(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function Et(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":ze(n),c=!s&&a.length<pt,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:f,headers:p}=o;return Tt(e,t,{method:c?"GET":"POST",uri:_t(e,r,u),json:!0,body:c?void 0:n,query:s&&ht(o),timeout:h,headers:p,token:d,tag:f,canUseCdn:i,signal:o.signal}).pipe(be(dt),we(ft),we((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 xt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Et(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Tt(e,t,r){const n=r.url||r.uri,o=e.config(),s=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/"):r.canUseCdn,i=o.useCdn&&s,a=r.tag&&o.requestTagPrefix?[o.requestTagPrefix,r.tag].join("."):r.tag||o.requestTagPrefix;a&&(r.query={tag:We(a),...r.query}),o.resultSourceMap&&(r.query={resultSourceMap:!0,...r.query});const c=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[ke]=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})}(o,Object.assign({},r,{url:St(e,n,i)})),u=new de((e=>t(c,o.requester).subscribe(e)));return r.signal?u.pipe((l=r.signal,e=>new de((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}(l));if(l&&l.aborted)return void r();const n=e.subscribe(t);return l.addEventListener("abort",r),()=>{l.removeEventListener("abort",r),n.unsubscribe()}})))):u;var l}function Ot(e,t,r){return Tt(e,t,r).pipe(be((e=>"response"===e.type)),we((e=>e.body)))}function _t(e,t,r){const n=e.config(),o=He(n),s="/".concat(t,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function St(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 At,Rt,kt,Ft,It=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Mt=(e,t,r)=>(It(e,t,"read from private field"),r?r.call(e):t.get(e)),Pt=(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)},Dt=(e,t,r,n)=>(It(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class qt{constructor(e,t){Pt(this,At,void 0),Pt(this,Rt,void 0),Dt(this,At,e),Dt(this,Rt,t)}upload(e,t,r){return Ht(Mt(this,At),Mt(this,Rt),e,t,r)}}At=new WeakMap,Rt=new WeakMap;class Nt{constructor(e,t){Pt(this,kt,void 0),Pt(this,Ft,void 0),Dt(this,kt,e),Dt(this,Ft,t)}upload(e,t,r){return ve(Ht(Mt(this,kt),Mt(this,Ft),e,t,r).pipe(be((e=>"response"===e.type)),we((e=>e.body.document))))}}function Ht(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===Ie.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Ie.join(", ")))})(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=He(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:f,filename:p,source:y}=c,g={label:l,title:h,description:d,filename:p,meta:s,creditLine:f};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),Tt(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:n})}kt=new WeakMap,Ft=new WeakMap;function Wt(e){return"https://www.sanity.io/help/"+e}const zt=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)})),Lt=zt(["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."]),Ut=zt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Wt("js-client-browser-token")," for more information and how to hide this warning.")]),Bt=zt(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Wt("js-client-api-version"))]),$t=zt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),Vt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Gt=["localhost","127.0.0.1","0.0.0.0"],Jt=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||Bt();const n=Object.assign({},Vt,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const e=Wt("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`");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==Gt.indexOf(e))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?Ut():void 0===n.useCdn&&Lt(),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&&Pe(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?We(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===Vt.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};var Xt=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const Yt=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Kt={includeResult:!0};function Zt(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={...Xt(r,Kt),tag:a},u=(l=c,Yt.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=ze({query:e,params:t,options:{tag:a,...u}}),d="".concat(n).concat(_t(this,"listen",h));if(d.length>14800)return new de((e=>e.error(new Error("Query too large for listener"))));const f=c.events?c.events:["mutation"],p=-1!==f.indexOf("reconnect"),y={};return(o||s)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new de((e=>{let t,r;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let n=!1;function o(){n||(p&&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=Qt(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=Qt(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),f.forEach((e=>t.removeEventListener(e,i))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Gr})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",s),t.addEventListener("disconnect",a),f.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 Qt(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var er,tr,rr,nr,or=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},sr=(e,t,r)=>(or(e,t,"read from private field"),r?r.call(e):t.get(e)),ir=(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)=>(or(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class cr{constructor(e,t){ir(this,er,void 0),ir(this,tr,void 0),ar(this,er,e),ar(this,tr,t)}create(e,t){return lr(sr(this,er),sr(this,tr),"PUT",e,t)}edit(e,t){return lr(sr(this,er),sr(this,tr),"PATCH",e,t)}delete(e){return lr(sr(this,er),sr(this,tr),"DELETE",e)}list(){return Ot(sr(this,er),sr(this,tr),{uri:"/datasets"})}}er=new WeakMap,tr=new WeakMap;class ur{constructor(e,t){ir(this,rr,void 0),ir(this,nr,void 0),ar(this,rr,e),ar(this,nr,t)}create(e,t){return ve(lr(sr(this,rr),sr(this,nr),"PUT",e,t))}edit(e,t){return ve(lr(sr(this,rr),sr(this,nr),"PATCH",e,t))}delete(e){return ve(lr(sr(this,rr),sr(this,nr),"DELETE",e))}list(){return ve(Ot(sr(this,rr),sr(this,nr),{uri:"/datasets"}))}}function lr(e,t,r,n,o){return Pe(n),Ot(e,t,{method:r,uri:"/datasets/".concat(n),body:o})}rr=new WeakMap,nr=new WeakMap;var hr,dr,fr,pr,yr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},gr=(e,t,r)=>(yr(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)},vr=(e,t,r,n)=>(yr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class wr{constructor(e,t){mr(this,hr,void 0),mr(this,dr,void 0),vr(this,hr,e),vr(this,dr,t)}list(){return Ot(gr(this,hr),gr(this,dr),{uri:"/projects"})}getById(e){return Ot(gr(this,hr),gr(this,dr),{uri:"/projects/".concat(e)})}}hr=new WeakMap,dr=new WeakMap;class br{constructor(e,t){mr(this,fr,void 0),mr(this,pr,void 0),vr(this,fr,e),vr(this,pr,t)}list(){return ve(Ot(gr(this,fr),gr(this,pr),{uri:"/projects"}))}getById(e){return ve(Ot(gr(this,fr),gr(this,pr),{uri:"/projects/".concat(e)}))}}fr=new WeakMap,pr=new WeakMap;var Cr,Er,xr,Tr,Or=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},_r=(e,t,r)=>(Or(e,t,"read from private field"),r?r.call(e):t.get(e)),Sr=(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)},jr=(e,t,r,n)=>(Or(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Ar{constructor(e,t){Sr(this,Cr,void 0),Sr(this,Er,void 0),jr(this,Cr,e),jr(this,Er,t)}getById(e){return Ot(_r(this,Cr),_r(this,Er),{uri:"/users/".concat(e)})}}Cr=new WeakMap,Er=new WeakMap;class Rr{constructor(e,t){Sr(this,xr,void 0),Sr(this,Tr,void 0),jr(this,xr,e),jr(this,Tr,t)}getById(e){return ve(Ot(_r(this,xr),_r(this,Tr),{uri:"/users/".concat(e)}))}}xr=new WeakMap,Tr=new WeakMap;var kr,Fr,Ir,Mr,Pr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Dr=(e,t,r)=>(Pr(e,t,"read from private field"),r?r.call(e):t.get(e)),qr=(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)=>(Pr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const Hr=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vt;qr(this,kr,void 0),qr(this,Fr,void 0),this.listen=Zt,this.config(t),Nr(this,Fr,e),this.assets=new qt(this,Dr(this,Fr)),this.datasets=new cr(this,Dr(this,Fr)),this.projects=new wr(this,Dr(this,Fr)),this.users=new Ar(this,Dr(this,Fr))}clone(){return new Hr(Dr(this,Fr),this.config())}config(e){if(void 0===e)return{...Dr(this,kr)};if(Dr(this,kr)&&!1===Dr(this,kr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Nr(this,kr,Jt(e,Dr(this,kr)||{})),this}withConfig(e){return new Hr(Dr(this,Fr),{...this.config(),...e})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return yt(this,Dr(this,Fr),e,t,r)}getDocument(e,t){return gt(this,Dr(this,Fr),e,t)}getDocuments(e,t){return mt(this,Dr(this,Fr),e,t)}create(e,t){return xt(this,Dr(this,Fr),e,"create",t)}createIfNotExists(e,t){return vt(this,Dr(this,Fr),e,t)}createOrReplace(e,t){return wt(this,Dr(this,Fr),e,t)}delete(e,t){return bt(this,Dr(this,Fr),e,t)}mutate(e,t){return Ct(this,Dr(this,Fr),e,t)}patch(e,t){return new Ye(e,t,this)}transaction(e){return new lt(e,this)}request(e){return Ot(this,Dr(this,Fr),e)}getUrl(e,t){return St(this,e,t)}getDataUrl(e,t){return _t(this,e,t)}};let Wr=Hr;kr=new WeakMap,Fr=new WeakMap;const zr=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vt;qr(this,Ir,void 0),qr(this,Mr,void 0),this.listen=Zt,this.config(t),Nr(this,Mr,e),this.assets=new Nt(this,Dr(this,Mr)),this.datasets=new ur(this,Dr(this,Mr)),this.projects=new br(this,Dr(this,Mr)),this.users=new Rr(this,Dr(this,Mr)),this.observable=new Wr(e,t)}clone(){return new zr(Dr(this,Mr),this.config())}config(e){if(void 0===e)return{...Dr(this,Ir)};if(Dr(this,Ir)&&!1===Dr(this,Ir).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),Nr(this,Ir,Jt(e,Dr(this,Ir)||{})),this}withConfig(e){return new zr(Dr(this,Mr),{...this.config(),...e})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ve(yt(this,Dr(this,Mr),e,t,r))}getDocument(e,t){return ve(gt(this,Dr(this,Mr),e,t))}getDocuments(e,t){return ve(mt(this,Dr(this,Mr),e,t))}create(e,t){return ve(xt(this,Dr(this,Mr),e,"create",t))}createIfNotExists(e,t){return ve(vt(this,Dr(this,Mr),e,t))}createOrReplace(e,t){return ve(wt(this,Dr(this,Mr),e,t))}delete(e,t){return ve(bt(this,Dr(this,Mr),e,t))}mutate(e,t){return ve(Ct(this,Dr(this,Mr),e,t))}patch(e,t){return new Ze(e,t,this)}transaction(e){return new ct(e,this)}request(e){return ve(Ot(this,Dr(this,Mr),e))}dataRequest(e,t,r){return ve(Et(this,Dr(this,Mr),e,t,r))}getUrl(e,t){return St(this,e,t)}getDataUrl(e,t){return _t(this,e,t)}};let Lr=zr;Ir=new WeakMap,Mr=new WeakMap;const Ur=Ae(Ce,{}),Br=Ur.defaultRequester;var $r={};
8
+ function R(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=A(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(j,j.exports);const k="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),F=["boolean","string","number"];function I(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!k(t)&&(-1!==F.indexOf(typeof t)||Array.isArray(t)||!1!==R(r=t)&&(void 0===(n=r.constructor)||!1!==R(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 M(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 P;P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var D=P;function q(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||D.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())))}}class N{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const H=class{constructor(e){if("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 N(e),t(this.reason))}))}};H.source=()=>{let e;return{token:new H((t=>{e=t})),cancel:e}};var W=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function z(e){return 100*Math.pow(2,e)+100*Math.random()}const L=function(){return(e=>{const t=e.maxRetries||5,r=e.retryDelay||z,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:W,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}})};L.shouldRetry=W;var U=function(e,t){return U=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])},U(e,t)};function B(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}U(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function $(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 V(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 G(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 J(e){return"function"==typeof e}function X(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}var Y=X((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 K(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Z=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=$(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(J(c))try{c()}catch(e){o=e instanceof Y?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=$(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{ee(d)}catch(e){o=null!=o?o:[],e instanceof Y?o=G(G([],V(o)),V(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 Y(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ee(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)&&K(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&K(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function Q(e){return e instanceof Z||e&&"closed"in e&&J(e.remove)&&J(e.add)&&J(e.unsubscribe)}function ee(e){J(e)?e():e.unsubscribe()}Z.EMPTY;var te={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},re={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=re.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,G([e,t],V(r))):setTimeout.apply(void 0,G([e,t],V(r)))},clearTimeout:function(e){var t=re.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ne(){}var oe=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,Q(t)&&t.add(r)):r.destination=le,r}return B(t,e),t.create=function(e,t,r){return new ce(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}(Z),se=Function.prototype.bind;function ie(e,t){return se.call(e,t)}var ae=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){ue(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ue(e)}else ue(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ue(e)}},e}(),ce=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;J(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&te.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&ie(t.next,s),error:t.error&&ie(t.error,s),complete:t.complete&&ie(t.complete,s)}):o=t;return i.destination=new ae(o),i}return B(t,e),t}(oe);function ue(e){var t;t=e,re.setTimeout((function(){throw t}))}var le={closed:!0,next:ne,error:function(e){throw e},complete:ne},he="function"==typeof Symbol&&Symbol.observable||"@@observable";function de(e){return e}var fe=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 oe||function(e){return e&&J(e.next)&&J(e.error)&&J(e.complete)}(n)&&Q(n)?e:new ce(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=pe(t))((function(t,n){var o=new ce({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[he]=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?de: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=pe(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 pe(e){var t;return null!==(t=null!=e?e:te.Promise)&&void 0!==t?t:Promise}function ye(e){return function(t){if(function(e){return J(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 me(e,t,r,n,o){return new ge(e,t,r,n,o)}var ge=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 B(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}(oe),ve=X((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function we(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 ve)}})}))}function be(e,t){return ye((function(r,n){var o=0;r.subscribe(me(n,(function(r){n.next(e.call(t,r,o++))})))}))}function Ce(e,t){return ye((function(r,n){var o=0;r.subscribe(me(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}var Ee=[];class xe extends Error{constructor(e){const t=Oe(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class Te extends Error{constructor(e){const t=Oe(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function Oe(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:je(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 _e(e)&&_e(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 _e(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function je(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const Se={onResponse:e=>{if(e.statusCode>=500)throw new Te(e);if(e.statusCode>=400)throw new xe(e);return e}},Ae={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function Re(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]:T)}([r>0?L({retryDelay:n,maxRetries:r,shouldRetry:ke}):{},...e,Ae,I(),M(),{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"))}},Se,q({implementation:fe})]);function s(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:o)({maxRedirects:0,...e})}return s.defaultRequester=o,s}function ke(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=r.uri.startsWith("/data/query"),s=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!s)||L.shouldRetry(e,t,r)}const Fe="X-Sanity-Project-ID";function Ie(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 Me=["image","file"],Pe=["before","after","replace"],De=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")},qe=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},Ne=(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'))},He=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));Ne(e,t._id)},We=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},ze=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},Le=e=>{let{query:t,params:r={},options:n={}}=e;const o=new URLSearchParams,{tag:s,...i}=n;s&&o.set("tag",s),o.set("query",t);for(const[e,t]of Object.entries(r))o.set("$".concat(e),JSON.stringify(t));for(const[e,t]of Object.entries(i))t&&o.set(e,"".concat(t));return"?".concat(o)};var Ue,Be,$e=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ve=(e,t,r)=>($e(e,t,"read from private field"),r?r.call(e):t.get(e)),Ge=(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)},Je=(e,t,r,n)=>($e(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Xe{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return qe("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===Pe.indexOf(e)){const e=Pe.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{...Ie(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 qe(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)}}const Ye=class extends Xe{constructor(e,t,r){super(e,t),Ge(this,Ue,void 0),Je(this,Ue,r)}clone(){return new Ye(this.selection,{...this.operations},Ve(this,Ue))}commit(e){if(!Ve(this,Ue))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 Ve(this,Ue).mutate({patch:this.serialize()},r)}};let Ke=Ye;Ue=new WeakMap;const Ze=class extends Xe{constructor(e,t,r){super(e,t),Ge(this,Be,void 0),Je(this,Be,r)}clone(){return new Ze(this.selection,{...this.operations},Ve(this,Be))}commit(e){if(!Ve(this,Be))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 Ve(this,Be).mutate({patch:this.serialize()},r)}};let Qe=Ze;Be=new WeakMap;var et,tt,rt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},nt=(e,t,r)=>(rt(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)},st=(e,t,r,n)=>(rt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const it={returnDocuments:!1};class at{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;this.operations=e,this.trxId=t}create(e){return qe("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return qe(t,e),He(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return qe(t,e),He(t,e),this._add({[t]:e})}delete(e){return Ne("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}}const ct=class extends at{constructor(e,t,r){super(e,r),ot(this,et,void 0),st(this,et,t)}clone(){return new ct([...this.operations],nt(this,et),this.trxId)}commit(e){if(!nt(this,et))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return nt(this,et).mutate(this.serialize(),Object.assign({transactionId:this.trxId},it,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Qe)return this._add({patch:e.serialize()});if(r){const r=t(new Qe(e,{},nt(this,et)));if(!(r instanceof Qe))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};let ut=ct;et=new WeakMap;const lt=class extends at{constructor(e,t,r){super(e,r),ot(this,tt,void 0),st(this,tt,t)}clone(){return new lt([...this.operations],nt(this,tt),this.trxId)}commit(e){if(!nt(this,tt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return nt(this,tt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},it,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Ke)return this._add({patch:e.serialize()});if(r){const r=t(new Ke(e,{},nt(this,tt)));if(!(r instanceof Ke))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};let ht=lt;tt=new WeakMap;const dt=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,pt=e=>e.body,yt=11264;function mt(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;return xt(e,t,"query",{query:r,params:n},o).pipe(be(s))}function gt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Ot(e,t,{uri:jt(e,"doc",r),json:!0,tag:n.tag}).pipe(Ce(ft),be((e=>e.body.documents&&e.body.documents[0])))}function vt(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Ot(e,t,{uri:jt(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(Ce(ft),be((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 wt(e,t,r,n){return He("createIfNotExists",r),Tt(e,t,r,"createIfNotExists",n)}function bt(e,t,r,n){return He("createOrReplace",r),Tt(e,t,r,"createOrReplace",n)}function Ct(e,t,r,n){return xt(e,t,"mutate",{mutations:[{delete:Ie(r)}]},n)}function Et(e,t,r,n){let o;o=r instanceof Qe||r instanceof Ke?{patch:r.serialize()}:r instanceof ut||r instanceof ht?r.serialize():r;return xt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function xt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":Le(n),c=!s&&a.length<yt,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:f,headers:p}=o;return Ot(e,t,{method:c?"GET":"POST",uri:jt(e,r,u),json:!0,body:c?void 0:n,query:s&&dt(o),timeout:h,headers:p,token:d,tag:f,canUseCdn:i,signal:o.signal}).pipe(Ce(ft),be(pt),be((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 Tt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return xt(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Ot(e,t,r){const n=r.url||r.uri,o=e.config(),s=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/"):r.canUseCdn,i=o.useCdn&&s,a=r.tag&&o.requestTagPrefix?[o.requestTagPrefix,r.tag].join("."):r.tag||o.requestTagPrefix;a&&(r.query={tag:ze(a),...r.query}),s&&o.resultSourceMap&&(r.query={resultSourceMap:!0,...r.query});const c=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[Fe]=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})}(o,Object.assign({},r,{url:St(e,n,i)})),u=new fe((e=>t(c,o.requester).subscribe(e)));return r.signal?u.pipe((l=r.signal,e=>new fe((t=>{const r=()=>t.error(function(e){var t,r;if(At)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}(l));if(l&&l.aborted)return void r();const n=e.subscribe(t);return l.addEventListener("abort",r),()=>{l.removeEventListener("abort",r),n.unsubscribe()}})))):u;var l}function _t(e,t,r){return Ot(e,t,r).pipe(Ce((e=>"response"===e.type)),be((e=>e.body)))}function jt(e,t,r){const n=e.config(),o=We(n),s="/".concat(t,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function St(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 At=Boolean(globalThis.DOMException);var Rt,kt,Ft,It,Mt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Pt=(e,t,r)=>(Mt(e,t,"read from private field"),r?r.call(e):t.get(e)),Dt=(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)},qt=(e,t,r,n)=>(Mt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Nt{constructor(e,t){Dt(this,Rt,void 0),Dt(this,kt,void 0),qt(this,Rt,e),qt(this,kt,t)}upload(e,t,r){return Wt(Pt(this,Rt),Pt(this,kt),e,t,r)}}Rt=new WeakMap,kt=new WeakMap;class Ht{constructor(e,t){Dt(this,Ft,void 0),Dt(this,It,void 0),qt(this,Ft,e),qt(this,It,t)}upload(e,t,r){return we(Wt(Pt(this,Ft),Pt(this,It),e,t,r).pipe(Ce((e=>"response"===e.type)),be((e=>e.body.document))))}}function Wt(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===Me.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Me.join(", ")))})(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=We(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:f,filename:p,source:y}=c,m={label:l,title:h,description:d,filename:p,meta:s,creditLine:f};return y&&(m.sourceId=y.id,m.sourceName=y.name,m.sourceUrl=y.url),Ot(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:m,body:n})}Ft=new WeakMap,It=new WeakMap;function zt(e){return"https://www.sanity.io/help/"+e}const Lt=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)})),Ut=Lt(["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."]),Bt=Lt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(zt("js-client-browser-token")," for more information and how to hide this warning.")]),$t=Lt(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(zt("js-client-api-version"))]),Vt=Lt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),Gt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Jt=["localhost","127.0.0.1","0.0.0.0"],Xt=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||$t();const n=Object.assign({},Gt,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const e=zt("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`");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==Jt.indexOf(e))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?Bt():void 0===n.useCdn&&Ut(),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&&De(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?ze(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===Gt.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};var Yt=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const Kt=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Zt={includeResult:!0};function Qt(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={...Yt(r,Zt),tag:a},u=(l=c,Kt.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=Le({query:e,params:t,options:{tag:a,...u}}),d="".concat(n).concat(jt(this,"listen",h));if(d.length>14800)return new fe((e=>e.error(new Error("Query too large for listener"))));const f=c.events?c.events:["mutation"],p=-1!==f.indexOf("reconnect"),y={};return(o||s)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new fe((e=>{let t,r;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let n=!1;function o(){n||(p&&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=er(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=er(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),f.forEach((e=>t.removeEventListener(e,i))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Jr})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",s),t.addEventListener("disconnect",a),f.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 er(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var tr,rr,nr,or,sr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},ir=(e,t,r)=>(sr(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)},cr=(e,t,r,n)=>(sr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class ur{constructor(e,t){ar(this,tr,void 0),ar(this,rr,void 0),cr(this,tr,e),cr(this,rr,t)}create(e,t){return hr(ir(this,tr),ir(this,rr),"PUT",e,t)}edit(e,t){return hr(ir(this,tr),ir(this,rr),"PATCH",e,t)}delete(e){return hr(ir(this,tr),ir(this,rr),"DELETE",e)}list(){return _t(ir(this,tr),ir(this,rr),{uri:"/datasets"})}}tr=new WeakMap,rr=new WeakMap;class lr{constructor(e,t){ar(this,nr,void 0),ar(this,or,void 0),cr(this,nr,e),cr(this,or,t)}create(e,t){return we(hr(ir(this,nr),ir(this,or),"PUT",e,t))}edit(e,t){return we(hr(ir(this,nr),ir(this,or),"PATCH",e,t))}delete(e){return we(hr(ir(this,nr),ir(this,or),"DELETE",e))}list(){return we(_t(ir(this,nr),ir(this,or),{uri:"/datasets"}))}}function hr(e,t,r,n,o){return De(n),_t(e,t,{method:r,uri:"/datasets/".concat(n),body:o})}nr=new WeakMap,or=new WeakMap;var dr,fr,pr,yr,mr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},gr=(e,t,r)=>(mr(e,t,"read from private field"),r?r.call(e):t.get(e)),vr=(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)=>(mr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class br{constructor(e,t){vr(this,dr,void 0),vr(this,fr,void 0),wr(this,dr,e),wr(this,fr,t)}list(){return _t(gr(this,dr),gr(this,fr),{uri:"/projects"})}getById(e){return _t(gr(this,dr),gr(this,fr),{uri:"/projects/".concat(e)})}}dr=new WeakMap,fr=new WeakMap;class Cr{constructor(e,t){vr(this,pr,void 0),vr(this,yr,void 0),wr(this,pr,e),wr(this,yr,t)}list(){return we(_t(gr(this,pr),gr(this,yr),{uri:"/projects"}))}getById(e){return we(_t(gr(this,pr),gr(this,yr),{uri:"/projects/".concat(e)}))}}pr=new WeakMap,yr=new WeakMap;var Er,xr,Tr,Or,_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)),Sr=(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 Rr{constructor(e,t){Sr(this,Er,void 0),Sr(this,xr,void 0),Ar(this,Er,e),Ar(this,xr,t)}getById(e){return _t(jr(this,Er),jr(this,xr),{uri:"/users/".concat(e)})}}Er=new WeakMap,xr=new WeakMap;class kr{constructor(e,t){Sr(this,Tr,void 0),Sr(this,Or,void 0),Ar(this,Tr,e),Ar(this,Or,t)}getById(e){return we(_t(jr(this,Tr),jr(this,Or),{uri:"/users/".concat(e)}))}}Tr=new WeakMap,Or=new WeakMap;var Fr,Ir,Mr,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);const Wr=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gt;Nr(this,Fr,void 0),Nr(this,Ir,void 0),this.listen=Qt,this.config(t),Hr(this,Ir,e),this.assets=new Nt(this,qr(this,Ir)),this.datasets=new ur(this,qr(this,Ir)),this.projects=new br(this,qr(this,Ir)),this.users=new Rr(this,qr(this,Ir))}clone(){return new Wr(qr(this,Ir),this.config())}config(e){if(void 0===e)return{...qr(this,Fr)};if(qr(this,Fr)&&!1===qr(this,Fr).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Hr(this,Fr,Xt(e,qr(this,Fr)||{})),this}withConfig(e){return new Wr(qr(this,Ir),{...this.config(),...e})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return mt(this,qr(this,Ir),e,t,r)}getDocument(e,t){return gt(this,qr(this,Ir),e,t)}getDocuments(e,t){return vt(this,qr(this,Ir),e,t)}create(e,t){return Tt(this,qr(this,Ir),e,"create",t)}createIfNotExists(e,t){return wt(this,qr(this,Ir),e,t)}createOrReplace(e,t){return bt(this,qr(this,Ir),e,t)}delete(e,t){return Ct(this,qr(this,Ir),e,t)}mutate(e,t){return Et(this,qr(this,Ir),e,t)}patch(e,t){return new Ke(e,t,this)}transaction(e){return new ht(e,this)}request(e){return _t(this,qr(this,Ir),e)}getUrl(e,t){return St(this,e,t)}getDataUrl(e,t){return jt(this,e,t)}};let zr=Wr;Fr=new WeakMap,Ir=new WeakMap;const Lr=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gt;Nr(this,Mr,void 0),Nr(this,Pr,void 0),this.listen=Qt,this.config(t),Hr(this,Pr,e),this.assets=new Ht(this,qr(this,Pr)),this.datasets=new lr(this,qr(this,Pr)),this.projects=new Cr(this,qr(this,Pr)),this.users=new kr(this,qr(this,Pr)),this.observable=new zr(e,t)}clone(){return new Lr(qr(this,Pr),this.config())}config(e){if(void 0===e)return{...qr(this,Mr)};if(qr(this,Mr)&&!1===qr(this,Mr).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),Hr(this,Mr,Xt(e,qr(this,Mr)||{})),this}withConfig(e){return new Lr(qr(this,Pr),{...this.config(),...e})}fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return we(mt(this,qr(this,Pr),e,t,r))}getDocument(e,t){return we(gt(this,qr(this,Pr),e,t))}getDocuments(e,t){return we(vt(this,qr(this,Pr),e,t))}create(e,t){return we(Tt(this,qr(this,Pr),e,"create",t))}createIfNotExists(e,t){return we(wt(this,qr(this,Pr),e,t))}createOrReplace(e,t){return we(bt(this,qr(this,Pr),e,t))}delete(e,t){return we(Ct(this,qr(this,Pr),e,t))}mutate(e,t){return we(Et(this,qr(this,Pr),e,t))}patch(e,t){return new Qe(e,t,this)}transaction(e){return new ut(e,this)}request(e){return we(_t(this,qr(this,Pr),e))}dataRequest(e,t,r){return we(xt(this,qr(this,Pr),e,t,r))}getUrl(e,t){return St(this,e,t)}getDataUrl(e,t){return jt(this,e,t)}};let Ur=Lr;Mr=new WeakMap,Pr=new WeakMap;const Br=Re(Ee,{}),$r=Br.defaultRequester;var Vr={exports:{}};
9
9
  /** @license
10
10
  * eventsource.js
11
11
  * Available under MIT License (MIT)
12
12
  * https://github.com/Yaffle/EventSource/
13
- */
14
- !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,f=r.TextDecoder,p=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 g=h;h=function(e,t){var r=t.signal;return g(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 m(){this.bitsNeeded=0,this.codePoint=0}m.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!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(f=m);var v=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function b(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[b(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 R(e,t){S.call(this,e),this.error=t.error}w.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=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,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:v}),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))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(e){return this._contentType},w.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.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[b(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 f;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),R.prototype=Object.create(S.prototype);var k=-1,F=0,I=1,M=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),L(r)},L=function(e){return Math.min(Math.max(e,1e3),18e6)},U=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=L(1e3),l=z(r.heartbeatTimeout,45e3),h="",d=u,f=!1,p=0,y=r.headers||{},g=r.Transport,m=$&&null==g?void 0:new w(null!=g?new g:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=g&&"string"!=typeof g?new g:null==m?new T:new E,b=void 0,C=0,x=k,O="",_="",S="",B="",V=D,G=0,J=0,X=function(t,r,n,o){if(x===F)if(200===t&&null!=n&&W.test(n)){x=I,f=Date.now(),d=u,e.readyState=I;var s=new A("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),U(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),U(e,e.onerror,s),console.error(i)}},Y=function(t){if(x===I){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&&(f=Date.now(),p+=t.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(V===P&&c==="\n".charCodeAt(0))V=D;else if(V===P&&(V=D),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(V!==D){V===q&&(J=a+1);var y=i.slice(G,J-1),g=i.slice(J+(J<a&&i.charCodeAt(J)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=g):"id"===y?_=g:"event"===y?S=g:"retry"===y?(u=z(g,u),d=u):"heartbeatTimeout"===y&&(l=z(g,l),0!==C&&(o(C),C=n((function(){Q()}),l)))}if(V===D){if(""!==O){h=_,""===S&&(S="message");var m=new j(S,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(m),"open"===S?U(e,e.onopen,m):"message"===S?U(e,e.onmessage,m):"error"===S&&U(e,e.onerror,m),x===M)return}O="",S=""}V=c==="\r".charCodeAt(0)?P:D}else V===D&&(G=a,V=q),V===q?c===":".charCodeAt(0)&&(J=a+1,V=N):V===N&&(V=H)}}},K=function(t){if(x===I||x===F){x=k,0!==C&&(o(C),C=0),C=n((function(){Q()}),d),d=L(Math.min(16*u,2*d)),e.readyState=F;var r=new R("error",{error:t});e.dispatchEvent(r),U(e,e.onerror,r),null!=t&&console.error(t)}},Z=function(){x=M,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),e.readyState=M},Q=function(){if(C=0,x===k){f=!1,p=0,C=n((function(){Q()}),l),x=F,O="",S="",_=h,B="",G=0,J=0,V=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{b=v.open(m,X,Y,K,r,s,i)}catch(e){throw Z(),e}}else if(f||null==b){var d=Math.max((f||Date.now())+l-Date.now(),1);f=!1,C=n((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(x===F?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=F,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=F,B.prototype.OPEN=I,B.prototype.CLOSED=M,B.prototype.close=function(){this._close()},B.CONNECTING=F,B.OPEN=I,B.CLOSED=M,B.prototype.withCredentials=void 0;var V,G=c;null==s||null!=c&&"withCredentials"in c.prototype||(G=B),V=function(e){e.EventSourcePolyfill=B,e.NativeEventSource=c,e.EventSource=G}(t),void 0!==V&&(e.exports=V)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:i:globalThis)}({get exports(){return $r},set exports(e){$r=e}},$r);var Vr=$r.EventSourcePolyfill,Gr=Object.freeze({__proto__:null,default:Vr});e.BasePatch=Je,e.BaseTransaction=it,e.ClientError=Ee,e.ObservablePatch=Ye,e.ObservableSanityClient=Wr,e.ObservableTransaction=lt,e.Patch=Ze,e.SanityClient=Lr,e.ServerError=xe,e.Transaction=ct,e.createClient=e=>new Lr(Ae(Ce,{maxRetries:e.maxRetries,retryDelay:e.retryDelay}),e),e.default=function(e){return $t(),new Lr(Ur,e)},e.requester=Br,e.unstable__adapter=C,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,f=r.TextDecoder,p=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 m=h;h=function(e,t){var r=t.signal;return m(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!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(f=g);var v=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function b(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[b(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 j(e){this.type=e,this.target=void 0}function S(e,t){j.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){j.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function R(e,t){j.call(this,e),this.error=t.error}w.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=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,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:v}),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))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(e){return this._contentType},w.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.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[b(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 f;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}},S.prototype=Object.create(j.prototype),A.prototype=Object.create(j.prototype),R.prototype=Object.create(j.prototype);var k=-1,F=0,I=1,M=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),L(r)},L=function(e){return Math.min(Math.max(e,1e3),18e6)},U=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=L(1e3),l=z(r.heartbeatTimeout,45e3),h="",d=u,f=!1,p=0,y=r.headers||{},m=r.Transport,g=$&&null==m?void 0:new w(null!=m?new m:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=m&&"string"!=typeof m?new m:null==g?new T:new E,b=void 0,C=0,x=k,O="",_="",j="",B="",V=D,G=0,J=0,X=function(t,r,n,o){if(x===F)if(200===t&&null!=n&&W.test(n)){x=I,f=Date.now(),d=u,e.readyState=I;var s=new A("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),U(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),U(e,e.onerror,s),console.error(i)}},Y=function(t){if(x===I){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&&(f=Date.now(),p+=t.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(V===P&&c==="\n".charCodeAt(0))V=D;else if(V===P&&(V=D),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(V!==D){V===q&&(J=a+1);var y=i.slice(G,J-1),m=i.slice(J+(J<a&&i.charCodeAt(J)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=m):"id"===y?_=m:"event"===y?j=m:"retry"===y?(u=z(m,u),d=u):"heartbeatTimeout"===y&&(l=z(m,l),0!==C&&(o(C),C=n((function(){Q()}),l)))}if(V===D){if(""!==O){h=_,""===j&&(j="message");var g=new S(j,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(g),"open"===j?U(e,e.onopen,g):"message"===j?U(e,e.onmessage,g):"error"===j&&U(e,e.onerror,g),x===M)return}O="",j=""}V=c==="\r".charCodeAt(0)?P:D}else V===D&&(G=a,V=q),V===q?c===":".charCodeAt(0)&&(J=a+1,V=N):V===N&&(V=H)}}},K=function(t){if(x===I||x===F){x=k,0!==C&&(o(C),C=0),C=n((function(){Q()}),d),d=L(Math.min(16*u,2*d)),e.readyState=F;var r=new R("error",{error:t});e.dispatchEvent(r),U(e,e.onerror,r),null!=t&&console.error(t)}},Z=function(){x=M,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),e.readyState=M},Q=function(){if(C=0,x===k){f=!1,p=0,C=n((function(){Q()}),l),x=F,O="",j="",_=h,B="",G=0,J=0,V=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{b=v.open(g,X,Y,K,r,s,i)}catch(e){throw Z(),e}}else if(f||null==b){var d=Math.max((f||Date.now())+l-Date.now(),1);f=!1,C=n((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(x===F?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=F,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=F,B.prototype.OPEN=I,B.prototype.CLOSED=M,B.prototype.close=function(){this._close()},B.CONNECTING=F,B.OPEN=I,B.CLOSED=M,B.prototype.withCredentials=void 0;var V,G=c;null==s||null!=c&&"withCredentials"in c.prototype||(G=B),V=function(e){e.EventSourcePolyfill=B,e.NativeEventSource=c,e.EventSource=G}(t),void 0!==V&&(e.exports=V)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:i:globalThis)}(Vr,Vr.exports);var Gr=a(Vr.exports.EventSourcePolyfill),Jr=Object.freeze({__proto__:null,default:Gr});e.BasePatch=Xe,e.BaseTransaction=at,e.ClientError=xe,e.ObservablePatch=Ke,e.ObservableSanityClient=zr,e.ObservableTransaction=ht,e.Patch=Qe,e.SanityClient=Ur,e.ServerError=Te,e.Transaction=ut,e.createClient=e=>new Ur(Re(Ee,{maxRetries:e.maxRetries,retryDelay:e.retryDelay}),e),e.default=function(e){return Vt(),new Ur(Br,e)},e.requester=$r,e.unstable__adapter=E,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));