@sanity/client 5.2.1 → 5.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -99,24 +99,24 @@
99
99
  "@rollup/plugin-node-resolve": "^15.0.1",
100
100
  "@sanity/pkg-utils": "^2.2.5",
101
101
  "@sanity/semantic-release-preset": "^4.0.0",
102
- "@types/node": "^18.13.0",
103
- "@typescript-eslint/eslint-plugin": "^5.52.0",
104
- "@typescript-eslint/parser": "^5.52.0",
102
+ "@types/node": "^18.14.0",
103
+ "@typescript-eslint/eslint-plugin": "^5.53.0",
104
+ "@typescript-eslint/parser": "^5.53.0",
105
105
  "@vitest/coverage-c8": "^0.28.5",
106
106
  "eslint": "^8.34.0",
107
107
  "eslint-config-prettier": "^8.6.0",
108
108
  "eslint-plugin-prettier": "^4.2.1",
109
109
  "eslint-plugin-simple-import-sort": "^10.0.0",
110
110
  "faucet": "^0.0.4",
111
- "happy-dom": "^8.4.0",
111
+ "happy-dom": "^8.6.0",
112
112
  "ls-engines": "^0.9.0",
113
113
  "nock": "^13.3.0",
114
114
  "prettier": "^2.8.4",
115
115
  "prettier-plugin-packagejson": "^2.4.3",
116
116
  "rimraf": "^4.1.2",
117
- "rollup": "^3.15.0",
117
+ "rollup": "^3.17.2",
118
118
  "sse-channel": "^4.0.0",
119
- "terser": "^5.16.3",
119
+ "terser": "^5.16.4",
120
120
  "typescript": "^4.9.5",
121
121
  "vitest": "^0.28.5",
122
122
  "vitest-github-actions-reporter": "^0.9.0"
@@ -1631,23 +1631,8 @@
1631
1631
 
1632
1632
  function noop() { }
1633
1633
 
1634
- var context = null;
1635
1634
  function errorContext(cb) {
1636
- if (config.useDeprecatedSynchronousErrorHandling) {
1637
- var isRoot = !context;
1638
- if (isRoot) {
1639
- context = { errorThrown: false, error: null };
1640
- }
1641
- cb();
1642
- if (isRoot) {
1643
- var _a = context, errorThrown = _a.errorThrown, error = _a.error;
1644
- context = null;
1645
- if (errorThrown) {
1646
- throw error;
1647
- }
1648
- }
1649
- }
1650
- else {
1635
+ {
1651
1636
  cb();
1652
1637
  }
1653
1638
  }
@@ -1,14 +1,14 @@
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 n(e){const n="string"==typeof e?Object.assign({url:e},t):Object.assign({},t,e),o=new URL(n.url,"http://localhost");if(n.timeout=r(n.timeout),n.query)for(const[e,t]of Object.entries(n.query))if(void 0!==t)if(Array.isArray(t))for(const n of t)o.searchParams.append(e,n);else o.searchParams.append(e,t);return n.method=n.body&&!n.method?"POST":(n.method||"GET").toUpperCase(),n.url="http://localhost"===o.origin?"".concat(o.pathname,"?").concat(o.searchParams):o.toString(),n}function r(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const n=Number(e);return isNaN(n)?r(t.timeout):{connect:n,socket:n}}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,n={},r=a(e).split("\n"),o=0;o<r.length;o++){var s=r[o],i=s.indexOf(":"),c=a(s.slice(0,i)).toLowerCase(),u=a(s.slice(i+1));void 0===n[c]?n[c]=u:(t=n[c],"[object Array]"===Object.prototype.toString.call(t)?n[c].push(u):n[c]=[n[c],u])}return n},u=e=>function(t,n){const r="onError"===t;let o=n;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 n=0;n<e[t].length;n++){if(o=(0,e[t][n])(o,...i),r&&!o)break}return o};const l=["request","response","progress","error","abort"],h=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function d(e,t){const r=[],o=h.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[n],validateOptions:[s]});function i(e){const n=l.reduce(((e,t)=>(e[t]=function(){const e=Object.create(null);let t=0;return{publish:function(t){for(const n in e)e[n](t)},subscribe:function(n){const r=t++;return e[r]=n,function(){delete e[r]}}}}(),e)),{}),r=u(o),s=r("processOptions",e);r("validateOptions",s);const i={options:s,channels:n,applyMiddleware:r};let a=null;const c=n.request.subscribe((e=>{a=t(e,((t,o)=>function(e,t,o){let s=e,i=t;if(!s)try{i=r("onResponse",t,o)}catch(e){i=null,s=e}s=s&&r("onError",s,o),s?n.error.publish(s):i&&n.response.publish(i)}(t,o,e)))}));n.abort.subscribe((()=>{c(),a&&a.abort()}));const h=r("onReturn",n,i);return h===n&&n.request.publish(i),h}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])})),r.push(e),i},i.clone=function(){return d(r,t)},e.forEach(i.use),i}var f,p,y,g,v,m=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},w=(e,t,n)=>(m(e,t,"read from private field"),n?n.call(e):t.get(e)),b=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},C=(e,t,n,r)=>(m(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);f=new WeakMap,p=new WeakMap,y=new WeakMap,g=new WeakMap,v=new WeakMap;const E="function"==typeof XMLHttpRequest?"xhr":"fetch",T="xhr"===E?XMLHttpRequest:class{constructor(){this.readyState=0,b(this,f,void 0),b(this,p,void 0),b(this,y,void 0),b(this,g,{}),b(this,v,void 0)}open(e,t,n){C(this,f,e),C(this,p,t),C(this,y,""),this.readyState=1,this.onreadystatechange(),C(this,v,void 0)}abort(){w(this,v)&&w(this,v).abort()}getAllResponseHeaders(){return w(this,y)}setRequestHeader(e,t){w(this,g)[e]=t}send(e){const t="arraybuffer"!==this.responseType,n={method:w(this,f),headers:w(this,g),signal:null,body:e};"function"==typeof AbortController&&(C(this,v,new AbortController),n.signal=w(this,v).signal),"undefined"!=typeof document&&(n.credentials=this.withCredentials?"include":"omit"),fetch(w(this,p),n).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 x=(e,t)=>{const n=e.options,r=e.applyMiddleware("finalizeOptions",n),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 T;const a=r.headers,u=r.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.responseText,url:r.url,method:r.method,headers:c(i.getAllResponseHeaders()),statusCode:i.status,statusMessage:i.statusText})}()},i.open(r.method,r.url,!0),i.withCredentials=!!r.withCredentials,a&&i.setRequestHeader)for(const e in a)a.hasOwnProperty(e)&&i.setRequestHeader(e,a[e]);return r.rawBody&&(i.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:r,adapter:E,request:i,context:e}),i.send(r.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 n=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(r.url):"Connection timed out on request to ".concat(r.url));n.code=t,e.channels.error.publish(n)}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 n=e||new Error("Network error while attempting to reach ".concat(r.url));n.isNetworkError=!0,n.request=r,t(n)}};const O=function(){return d(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:x)};var _,S,j={};function A(){if(S)return _;S=1;var e=1e3,t=60*e,n=60*t,r=24*n,o=7*r,s=365.25*r;function i(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}return _=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*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;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>=r)return i(o,s,r,"day");if(s>=n)return i(o,s,n,"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>=r)return Math.round(o/r)+"d";if(s>=n)return Math.round(o/n)+"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 k=function(e){function t(e){let r,o,s,i=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),s=o-(r||o);n.diff=s,n.prev=r,n.curr=o,r=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,((r,o)=>{if("%%"===r)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];r=s.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,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 n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(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(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].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 n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=A(),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((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t};
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).SanityClient={})}(this,(function(t){"use strict";const e={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4};function n(t){const n="string"==typeof t?Object.assign({url:t},e):Object.assign({},e,t),o=new URL(n.url,"http://localhost");if(n.timeout=r(n.timeout),n.query)for(const[t,e]of Object.entries(n.query))if(void 0!==e)if(Array.isArray(e))for(const n of e)o.searchParams.append(t,n);else o.searchParams.append(t,e);return n.method=n.body&&!n.method?"POST":(n.method||"GET").toUpperCase(),n.url="http://localhost"===o.origin?"".concat(o.pathname,"?").concat(o.searchParams):o.toString(),n}function r(t){if(!1===t||0===t)return!1;if(t.connect||t.socket)return t;const n=Number(t);return isNaN(n)?r(e.timeout):{connect:n,socket:n}}const o=/^https?:\/\//i;function s(t){if(!o.test(t.url))throw new Error('"'.concat(t.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(t){return t.replace(/^\s+|\s+$/g,"")},c=function(t){if(!t)return{};for(var e,n={},r=a(t).split("\n"),o=0;o<r.length;o++){var s=r[o],i=s.indexOf(":"),c=a(s.slice(0,i)).toLowerCase(),u=a(s.slice(i+1));void 0===n[c]?n[c]=u:(e=n[c],"[object Array]"===Object.prototype.toString.call(e)?n[c].push(u):n[c]=[n[c],u])}return n},u=t=>function(e,n){const r="onError"===e;let o=n;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 n=0;n<t[e].length;n++){if(o=(0,t[e][n])(o,...i),r&&!o)break}return o};const l=["request","response","progress","error","abort"],h=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function d(t,e){const r=[],o=h.reduce(((t,e)=>(t[e]=t[e]||[],t)),{processOptions:[n],validateOptions:[s]});function i(t){const n=l.reduce(((t,e)=>(t[e]=function(){const t=Object.create(null);let e=0;return{publish:function(e){for(const n in t)t[n](e)},subscribe:function(n){const r=e++;return t[r]=n,function(){delete t[r]}}}}(),t)),{}),r=u(o),s=r("processOptions",t);r("validateOptions",s);const i={options:s,channels:n,applyMiddleware:r};let a=null;const c=n.request.subscribe((t=>{a=e(t,((e,o)=>function(t,e,o){let s=t,i=e;if(!s)try{i=r("onResponse",e,o)}catch(t){i=null,s=t}s=s&&r("onError",s,o),s?n.error.publish(s):i&&n.response.publish(i)}(e,o,t)))}));n.abort.subscribe((()=>{c(),a&&a.abort()}));const h=r("onReturn",n,i);return h===n&&n.request.publish(i),h}return i.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.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((e=>{t[e]&&o[e].push(t[e])})),r.push(t),i},i.clone=function(){return d(r,e)},t.forEach(i.use),i}var f,p,y,g,m,v=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},w=(t,e,n)=>(v(t,e,"read from private field"),n?n.call(t):e.get(t)),b=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},C=(t,e,n,r)=>(v(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);f=new WeakMap,p=new WeakMap,y=new WeakMap,g=new WeakMap,m=new WeakMap;const E="function"==typeof XMLHttpRequest?"xhr":"fetch",T="xhr"===E?XMLHttpRequest:class{constructor(){this.readyState=0,b(this,f,void 0),b(this,p,void 0),b(this,y,void 0),b(this,g,{}),b(this,m,void 0)}open(t,e,n){C(this,f,t),C(this,p,e),C(this,y,""),this.readyState=1,this.onreadystatechange(),C(this,m,void 0)}abort(){w(this,m)&&w(this,m).abort()}getAllResponseHeaders(){return w(this,y)}setRequestHeader(t,e){w(this,g)[t]=e}send(t){const e="arraybuffer"!==this.responseType,n={method:w(this,f),headers:w(this,g),signal:null,body:t};"function"==typeof AbortController&&(C(this,m,new AbortController),n.signal=w(this,m).signal),"undefined"!=typeof document&&(n.credentials=this.withCredentials?"include":"omit"),fetch(w(this,p),n).then((t=>(t.headers.forEach(((t,e)=>{C(this,y,w(this,y)+"".concat(e,": ").concat(t,"\r\n"))})),this.status=t.status,this.statusText=t.statusText,this.readyState=3,e?t.text():t.arrayBuffer()))).then((t=>{"string"==typeof t?this.responseText=t:this.response=t,this.readyState=4,this.onreadystatechange()})).catch((t=>{var e;"AbortError"!==t.name?null==(e=this.onerror)||e.call(this,t):this.onabort()}))}};var x=(t,e)=>{const n=t.options,r=t.applyMiddleware("finalizeOptions",n),o={},s=t.applyMiddleware("interceptRequest",void 0,{adapter:E,context:t});if(s){const t=setTimeout(e,0,null,s);return{abort:()=>clearTimeout(t)}}let i=new T;const a=r.headers,u=r.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,e(null,{body:i.response||i.responseText,url:r.url,method:r.method,headers:c(i.getAllResponseHeaders()),statusCode:i.status,statusMessage:i.statusText})}()},i.open(r.method,r.url,!0),i.withCredentials=!!r.withCredentials,a&&i.setRequestHeader)for(const t in a)a.hasOwnProperty(t)&&i.setRequestHeader(t,a[t]);return r.rawBody&&(i.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:r,adapter:E,request:i,context:t}),i.send(r.body||null),u&&(o.connect=setTimeout((()=>f("ETIMEDOUT")),u.connect)),{abort:function(){l=!0,i&&i.abort()}};function f(e){d=!0,i.abort();const n=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to ".concat(r.url):"Connection timed out on request to ".concat(r.url));n.code=e,t.channels.error.publish(n)}function p(t){(t||l||i.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function y(t){if(h)return;p(!0),h=!0,i=null;const n=t||new Error("Network error while attempting to reach ".concat(r.url));n.isNetworkError=!0,n.request=r,e(n)}};const O=function(){return d(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:x)};var _,S,j={};function A(){if(S)return _;S=1;var t=1e3,e=60*t,n=60*e,r=24*n,o=7*r,s=365.25*r;function i(t,e,n,r){var o=e>=1.5*n;return Math.round(t/n)+" "+r+(o?"s":"")}return _=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*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*e;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;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>=r)return i(o,s,r,"day");if(s>=n)return i(o,s,n,"hour");if(s>=e)return i(o,s,e,"minute");if(s>=t)return i(o,s,t,"second");return o+" ms"}(a):function(o){var s=Math.abs(o);if(s>=r)return Math.round(o/r)+"d";if(s>=n)return Math.round(o/n)+"h";if(s>=e)return Math.round(o/e)+"m";if(s>=t)return Math.round(o/t)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var k=function(t){function e(t){let r,o,s,i=null;function a(...t){if(!a.enabled)return;const n=a,o=Number(new Date),s=o-(r||o);n.diff=s,n.prev=r,n.curr=o,r=o,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let i=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((r,o)=>{if("%%"===r)return"%";i++;const s=e.formatters[o];if("function"==typeof s){const e=t[i];r=s.call(n,e),t.splice(i,1),i--}return r})),e.formatArgs.call(n,t);(n.log||e.log).apply(n,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=n,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==e.namespaces&&(o=e.namespaces,s=e.enabled(t)),s),set:t=>{i=t}}),"function"==typeof e.init&&e.init(a),a}function n(t,n){const r=e(this.namespace+(void 0===n?":":n)+t);return r.log=this.log,r}function r(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},e.disable=function(){const t=[...e.names.map(r),...e.skips.map(r).map((t=>"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){let n;e.save(t),e.namespaces=t,e.names=[],e.skips=[];const r=("string"==typeof t?t:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(t=r[n].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.slice(1)+"$")):e.names.push(new RegExp("^"+t+"$")))},e.enabled=function(t){if("*"===t[t.length-1])return!0;let n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1},e.humanize=A(),e.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(t).forEach((n=>{e[n]=t[n]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e.colors[Math.abs(n)%e.colors.length]},e.enable(e.load()),e};
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 F(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 n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(o=r))})),t.splice(o,0,n)},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=k(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}({get exports(){return j},set exports(e){j=e}},j);const R="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),I=["boolean","string","number"];function M(){return{processOptions:e=>{const t=e.body;if(!t)return e;var n,r,o;return!("function"==typeof t.pipe)&&!R(t)&&(-1!==I.indexOf(typeof t)||Array.isArray(t)||!1!==F(n=t)&&(void 0===(r=n.constructor)||!1!==F(o=r.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function P(e){return{onResponse:n=>{const r=n.headers["content-type"]||"",o=e&&e.force||-1!==r.indexOf("application/json");return n.body&&r&&o?Object.assign({},n,{body:t(n.body)}):n},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 D;D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var q=D;function N(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||q.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,n)=>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(n),()=>t.abort.publish())))}}class H{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const W=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 H(e),t(this.reason))}))}};W.source=()=>{let e;return{token:new W((t=>{e=t})),cancel:e}};var z=function(e,t){return z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},z(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 n(){this.constructor=e}z(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function L(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function B(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}function $(e,t,n){if(n||2===arguments.length)for(var r,o=0,s=t.length;o<s;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function V(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 G=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 X(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Y=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,n,r,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=L(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(V(c))try{c()}catch(e){o=e instanceof G?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=L(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{Z(d)}catch(e){o=null!=o?o:[],e instanceof G?o=$($([],B(o)),B(e.errors)):o.push(e)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(o)throw new G(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Z(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).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)&&X(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&X(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function K(e){return e instanceof Y||e&&"closed"in e&&V(e.remove)&&V(e.add)&&V(e.unsubscribe)}function Z(e){V(e)?e():e.unsubscribe()}Y.EMPTY;var Q={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ee={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=ee.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,$([e,t],B(n))):setTimeout.apply(void 0,$([e,t],B(n)))},clearTimeout:function(e){var t=ee.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function te(){}var ne=null;var re=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,K(t)&&t.add(n)):n.destination=ue,n}return U(t,e),t.create=function(e,t,n){return new ae(e,t,n)},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}(Y),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,n,r){var o,s,i=e.call(this)||this;V(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:i&&Q.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}(re);function ce(e){var t;t=e,ee.setTimeout((function(){throw t}))}var ue={closed:!0,next:te,error:function(e){throw e},complete:te},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 n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,o=this,s=(r=e)&&r instanceof re||function(e){return e&&V(e.next)&&V(e.error)&&V(e.complete)}(r)&&K(r)?e:new ae(e,t,n);return function(e){if(Q.useDeprecatedSynchronousErrorHandling){var t=!ne;if(t&&(ne={errorThrown:!1,error:null}),e(),t){var n=ne,r=n.errorThrown,o=n.error;if(ne=null,r)throw o}}else e()}((function(){var e=o,t=e.operator,n=e.source;s.add(t?t.call(s,n):n?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 n=this;return new(t=fe(t))((function(t,r){var o=new ae({next:function(t){try{e(t)}catch(e){r(e),o.unsubscribe()}},error:r,complete:t});n.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=[],n=0;n<arguments.length;n++)t[n]=arguments[n];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,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function fe(e){var t;return null!==(t=null!=e?e:Q.Promise)&&void 0!==t?t:Promise}function pe(e){return function(t){if(function(e){return V(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,n,r,o){return new ge(e,t,n,r,o)}var ge=function(e){function t(t,n,r,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=n?function(e){try{n(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=r?function(){try{r()}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 n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(re),ve=J((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function me(e,t){var n="object"==typeof t;return new Promise((function(r,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?r(s):n?r(t.defaultValue):o(new ve)}})}))}function we(e,t){return pe((function(n,r){var o=0;n.subscribe(ye(r,(function(n){r.next(e.call(t,n,o++))})))}))}function be(e,t){return pe((function(n,r){var o=0;n.subscribe(ye(r,(function(n){return e.call(t,n,o++)&&r.next(n)})))}))}var Ce={};
8
+ function F(t){return"[object Object]"===Object.prototype.toString.call(t)}!function(t,e){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(r++,"%c"===t&&(o=r))})),e.splice(o,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.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+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})(),e.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"],e.log=console.debug||console.log||(()=>{}),t.exports=k(e);const{formatters:n}=t.exports;n.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}({get exports(){return j},set exports(t){j=t}},j);const R="undefined"==typeof Buffer?()=>!1:t=>Buffer.isBuffer(t),I=["boolean","string","number"];function M(){return{processOptions:t=>{const e=t.body;if(!e)return t;var n,r,o;return!("function"==typeof e.pipe)&&!R(e)&&(-1!==I.indexOf(typeof e)||Array.isArray(e)||!1!==F(n=e)&&(void 0===(r=n.constructor)||!1!==F(o=r.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},t,{body:JSON.stringify(t.body),headers:Object.assign({},t.headers,{"Content-Type":"application/json"})}):t}}}function P(t){return{onResponse:n=>{const r=n.headers["content-type"]||"",o=t&&t.force||-1!==r.indexOf("application/json");return n.body&&r&&o?Object.assign({},n,{body:e(n.body)}):n},processOptions:t=>Object.assign({},t,{headers:Object.assign({Accept:"application/json"},t.headers)})};function e(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: ".concat(t.message),t}}}let D;D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var q=D;function N(){const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||q.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,n)=>new t((t=>(e.error.subscribe((e=>t.error(e))),e.progress.subscribe((e=>t.next(Object.assign({type:"progress"},e)))),e.response.subscribe((e=>{t.next(Object.assign({type:"response"},e)),t.complete()})),e.request.publish(n),()=>e.abort.publish())))}}class H{constructor(t){this.__CANCEL__=!0,this.message=t}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const W=class{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e=null;this.promise=new Promise((t=>{e=t})),t((t=>{this.reason||(this.reason=new H(t),e(this.reason))}))}};W.source=()=>{let t;return{token:new W((e=>{t=e})),cancel:t}};var z=function(t,e){return z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},z(t,e)};function U(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}z(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function L(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function B(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,s=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}function $(t,e,n){if(n||2===arguments.length)for(var r,o=0,s=e.length;o<s;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function V(t){return"function"==typeof t}function J(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var G=J((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function X(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Y=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,n,r,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=L(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}else s.remove(this);var c=this.initialTeardown;if(V(c))try{c()}catch(t){o=t instanceof G?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=L(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{Z(d)}catch(t){o=null!=o?o:[],t instanceof G?o=$($([],B(o)),B(t.errors)):o.push(t)}}}catch(t){n={error:t}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(o)throw new G(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Z(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&X(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&X(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}();function K(t){return t instanceof Y||t&&"closed"in t&&V(t.remove)&&V(t.add)&&V(t.unsubscribe)}function Z(t){V(t)?t():t.unsubscribe()}Y.EMPTY;var Q={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},tt={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=tt.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,$([t,e],B(n))):setTimeout.apply(void 0,$([t,e],B(n)))},clearTimeout:function(t){var e=tt.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function et(){}var nt=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,K(e)&&e.add(n)):n.destination=ct,n}return U(e,t),e.create=function(t,e,n){return new it(t,e,n)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Y),rt=Function.prototype.bind;function ot(t,e){return rt.call(t,e)}var st=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){at(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){at(t)}else at(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){at(t)}},t}(),it=function(t){function e(e,n,r){var o,s,i=t.call(this)||this;V(e)||!e?o={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:i&&Q.useDeprecatedNextContext?((s=Object.create(e)).unsubscribe=function(){return i.unsubscribe()},o={next:e.next&&ot(e.next,s),error:e.error&&ot(e.error,s),complete:e.complete&&ot(e.complete,s)}):o=e;return i.destination=new st(o),i}return U(e,t),e}(nt);function at(t){var e;e=t,tt.setTimeout((function(){throw e}))}var ct={closed:!0,next:et,error:function(t){throw t},complete:et},ut="function"==typeof Symbol&&Symbol.observable||"@@observable";function lt(t){return t}var ht=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,o=this,s=(r=t)&&r instanceof nt||function(t){return t&&V(t.next)&&V(t.error)&&V(t.complete)}(r)&&K(r)?t:new it(t,e,n);return function(){var t=o,e=t.operator,n=t.source;s.add(e?e.call(s,n):n?o._subscribe(s):o._trySubscribe(s))}(),s},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=dt(e))((function(e,r){var o=new it({next:function(e){try{t(e)}catch(t){r(t),o.unsubscribe()}},error:r,complete:e});n.subscribe(o)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[ut]=function(){return this},t.prototype.pipe=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return(0===(t=e).length?lt:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)})(this)},t.prototype.toPromise=function(t){var e=this;return new(t=dt(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function dt(t){var e;return null!==(e=null!=t?t:Q.Promise)&&void 0!==e?e:Promise}function ft(t){return function(e){if(function(t){return V(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function pt(t,e,n,r,o){return new yt(t,e,n,r,o)}var yt=function(t){function e(e,n,r,o,s,i){var a=t.call(this,e)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=o?function(t){try{o(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return U(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(nt),gt=J((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}}));function mt(t,e){var n="object"==typeof e;return new Promise((function(r,o){var s,i=!1;t.subscribe({next:function(t){s=t,i=!0},error:o,complete:function(){i?r(s):n?r(e.defaultValue):o(new gt)}})}))}function vt(t,e){return ft((function(n,r){var o=0;n.subscribe(pt(r,(function(n){r.next(t.call(e,n,o++))})))}))}function wt(t,e){return ft((function(n,r){var o=0;n.subscribe(pt(r,(function(n){return t.call(e,n,o++)&&r.next(n)})))}))}var bt={};
9
9
  /** @license
10
10
  * eventsource.js
11
11
  * Available under MIT License (MIT)
12
12
  * https://github.com/Yaffle/EventSource/
13
13
  */
14
- !function(e,t){!function(n){var r=n.setTimeout,o=n.clearTimeout,s=n.XMLHttpRequest,i=n.XDomainRequest,a=n.ActiveXObject,c=n.EventSource,u=n.document,l=n.Promise,h=n.fetch,d=n.Response,f=n.TextDecoder,p=n.TextEncoder,y=n.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(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 n=t.signal;return g(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._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 v(){this.bitsNeeded=0,this.codePoint=0}v.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(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 r=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,n(s,i)))&&(s=0,i=r,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=r),0===s||t(i,s,n(s,i))||(s=0,i=r)):(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=v);var m=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=m,this.onload=m,this.onerror=m,this.onreadystatechange=m,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=m}function 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),n=e.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),s=o.shift(),i=o.join(": ");t[b(s)]=i}this._map=t}function E(){}function T(e){this._headers=e}function x(){}function O(){this._listeners=Object.create(null)}function _(e){r((function(){throw e}),0)}function S(e){this.type=e,this.target=void 0}function j(e,t){S.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){S.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){S.call(this,e),this.error=t.error}w.prototype.open=function(e,t){this._abort(!0);var n=this,i=this._xhr,a=1,c=0;this._abort=function(e){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=m,i.onerror=m,i.onabort=m,i.onprogress=m,i.onreadystatechange=m,i.abort(),0!==c&&(o(c),c=0),e||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var u=function(){if(1===a){var e=0,t="",r=void 0;if("contentType"in i)e=200,t="OK",r=i.contentType;else try{e=i.status,t=i.statusText,r=i.getResponseHeader("Content-Type")}catch(n){e=0,t="",r=void 0}0!==e&&(a=2,n.readyState=2,n.status=e,n.statusText=t,n._contentType=r,n.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:m}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),n.readyState=4,"load"===e)n.onload(t);else if("error"===e)n.onerror(t);else{if("abort"!==e)throw new TypeError;n.onabort(t)}n.onreadystatechange()}},d=function(){c=r((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=r((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 n=this._xhr;"setRequestHeader"in n&&n.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=r((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,n,r,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,n(t)},e.onerror=function(e){e.preventDefault(),r(new Error("NetworkError"))},e.onload=function(){r(null)},e.onabort=function(){r(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var n=e.status,r=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(n,r,o,new C(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,u)&&e.setRequestHeader(u,a[u]);return e.send(),e},T.prototype.get=function(e){return this._headers.get(e)},x.prototype.open=function(e,t,n,r,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 T(e.headers)),new l((function(e,t){var r=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=d.decode(t.value,{stream:!0});n(o),r()}})).catch((function(e){t(e)}))};r()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){r(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 n=t.length,r=0;r<n;r+=1){var o=t[r];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 n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var o=!1,s=0;s<r.length;s+=1)r[s]===t&&(o=!0);o||r.push(t)},O.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var o=[],s=0;s<r.length;s+=1)r[s]!==t&&o.push(r[s]);0===o.length?delete n[e]:n[e]=o}},j.prototype=Object.create(S.prototype),A.prototype=Object.create(S.prototype),k.prototype=Object.create(S.prototype);var F=-1,R=0,I=1,M=2,P=-1,D=0,q=1,N=2,H=3,W=/^text\/event\-stream(;.*)?$/i,z=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),U(n)},U=function(e){return Math.min(Math.max(e,1e3),18e6)},L=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}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,n){t=String(t);var a=Boolean(n.withCredentials),c=n.lastEventIdQueryParameterName||"lastEventId",u=U(1e3),l=z(n.heartbeatTimeout,45e3),h="",d=u,f=!1,p=0,y=n.headers||{},g=n.Transport,v=$&&null==g?void 0:new w(null!=g?new g:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),m=null!=g&&"string"!=typeof g?new g:null==v?new x:new E,b=void 0,C=0,T=F,O="",_="",S="",B="",V=D,J=0,G=0,X=function(t,n,r,o){if(T===R)if(200===t&&null!=r&&W.test(r)){T=I,f=Date.now(),d=u,e.readyState=I;var s=new A("open",{status:t,statusText:n,headers:o});e.dispatchEvent(s),L(e,e.onopen,s)}else{var i="";200!==t?(n&&(n=n.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",Z();s=new A("error",{status:t,statusText:n,headers:o});e.dispatchEvent(s),L(e,e.onerror,s),console.error(i)}},Y=function(t){if(T===I){for(var n=-1,s=0;s<t.length;s+=1){(c=t.charCodeAt(s))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(n=s)}var i=(-1!==n?B:"")+t.slice(0,n+1);B=(-1===n?B:"")+t.slice(n+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&&(G=a+1);var y=i.slice(J,G-1),g=i.slice(G+(G<a&&i.charCodeAt(G)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=g):"id"===y?_=g:"event"===y?S=g:"retry"===y?(u=z(g,u),d=u):"heartbeatTimeout"===y&&(l=z(g,l),0!==C&&(o(C),C=r((function(){Q()}),l)))}if(V===D){if(""!==O){h=_,""===S&&(S="message");var v=new j(S,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(v),"open"===S?L(e,e.onopen,v):"message"===S?L(e,e.onmessage,v):"error"===S&&L(e,e.onerror,v),T===M)return}O="",S=""}V=c==="\r".charCodeAt(0)?P:D}else V===D&&(J=a,V=q),V===q?c===":".charCodeAt(0)&&(G=a+1,V=N):V===N&&(V=H)}}},K=function(t){if(T===I||T===R){T=F,0!==C&&(o(C),C=0),C=r((function(){Q()}),d),d=U(Math.min(16*u,2*d)),e.readyState=R;var n=new k("error",{error:t});e.dispatchEvent(n),L(e,e.onerror,n),null!=t&&console.error(t)}},Z=function(){T=M,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),e.readyState=M},Q=function(){if(C=0,T===F){f=!1,p=0,C=r((function(){Q()}),l),T=R,O="",S="",_=h,B="",J=0,G=0,V=D;var n=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){var o=t.indexOf("?");n=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===c?"":e})),n+=(-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=m.open(v,X,Y,K,n,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=r((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(T===R?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=R,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=R,B.prototype.OPEN=I,B.prototype.CLOSED=M,B.prototype.close=function(){this._close()},B.CONNECTING=R,B.OPEN=I,B.CLOSED=M,B.prototype.withCredentials=void 0;var V,J=c;null==s||null!=c&&"withCredentials"in c.prototype||(J=B),V=function(e){e.EventSourcePolyfill=B,e.NativeEventSource=c,e.EventSource=J}(t),void 0!==V&&(e.exports=V)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:i:globalThis)}({get exports(){return Ce},set exports(e){Ce=e}},Ce);var Ee=Ce.EventSourcePolyfill;class Te extends Error{constructor(e){const t=Oe(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class xe 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,n={response:e,statusCode:e.statusCode,responseBody:_e(t,e),message:"",details:void 0};return t.error&&t.message?(n.message="".concat(t.error," - ").concat(t.message),n):t.error&&t.error.description?(n.message=t.error.description,n.details=t.error,n):(n.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),n)}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 Te(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}};const Ae="X-Sanity-Project-ID";function ke(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 Fe=["image","file"],Re=["before","after","replace"],Ie=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")},Me=e=>{if(-1===Fe.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Fe.join(", ")))},Pe=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},De=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_.-]+$/i.test(t))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},qe=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));De(e,t._id)},Ne=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},He=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},We=e=>{let{query:t,params:n={},options:r={}}=e;const o=new URLSearchParams,{tag:s,...i}=r;s&&o.set("tag",s),o.set("query",t);for(const[e,t]of Object.entries(n))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 ze,Ue,Le=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Be=(e,t,n)=>(Le(e,t,"read from private field"),n?n.call(e):t.get(e)),$e=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Ve=(e,t,n,r)=>(Le(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);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 Pe("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,n){return((e,t,n)=>{const r="insert(at, selector, items)";if(-1===Re.indexOf(e)){const e=Re.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(r,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(r,' takes a "selector"-argument which must be a string'));if(!Array.isArray(n))throw new Error("".concat(r,' takes an "items"-argument which must be an array'))})(e,t,n),this._assign("insert",{[e]:t,items:n})}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,n,r){const o=t<0?t-1:t,s=void 0===n||-1===n?-1:Math.max(0,t+n),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,r||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...ke(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return Pe(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},n&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}const Ge=class extends Je{constructor(e,t,n){super(e,t),$e(this,ze,void 0),Ve(this,ze,n)}clone(){return new Ge(this.selection,{...this.operations},Be(this,ze))}commit(e){if(!Be(this,ze))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,n=Object.assign({returnFirst:t,returnDocuments:!0},e);return Be(this,ze).mutate({patch:this.serialize()},n)}};let Xe=Ge;ze=new WeakMap;const Ye=class extends Je{constructor(e,t,n){super(e,t),$e(this,Ue,void 0),Ve(this,Ue,n)}clone(){return new Ye(this.selection,{...this.operations},Be(this,Ue))}commit(e){if(!Be(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,n=Object.assign({returnFirst:t,returnDocuments:!0},e);return Be(this,Ue).mutate({patch:this.serialize()},n)}};let Ke=Ye;Ue=new WeakMap;var Ze,Qe,et=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},tt=(e,t,n)=>(et(e,t,"read from private field"),n?n.call(e):t.get(e)),nt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},rt=(e,t,n,r)=>(et(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const ot={returnDocuments:!1};class st{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 Pe("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return Pe(t,e),qe(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return Pe(t,e),qe(t,e),this._add({[t]:e})}delete(e){return De("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 it=class extends st{constructor(e,t,n){super(e,n),nt(this,Ze,void 0),rt(this,Ze,t)}clone(){return new it([...this.operations],tt(this,Ze),this.trxId)}commit(e){if(!tt(this,Ze))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return tt(this,Ze).mutate(this.serialize(),Object.assign({transactionId:this.trxId},ot,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof Ke)return this._add({patch:e.serialize()});if(n){const n=t(new Ke(e,{},tt(this,Ze)));if(!(n instanceof Ke))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};let at=it;Ze=new WeakMap;const ct=class extends st{constructor(e,t,n){super(e,n),nt(this,Qe,void 0),rt(this,Qe,t)}clone(){return new ct([...this.operations],tt(this,Qe),this.trxId)}commit(e){if(!tt(this,Qe))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return tt(this,Qe).mutate(this.serialize(),Object.assign({transactionId:this.trxId},ot,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof Xe)return this._add({patch:e.serialize()});if(n){const n=t(new Xe(e,{},tt(this,Qe)));if(!(n instanceof Xe))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};let ut=ct;Qe=new WeakMap;const lt=(e,t)=>!1===e?void 0:void 0===e?t:e,ht=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:lt(e.returnDocuments,!0),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation}},dt=e=>"response"===e.type,ft=e=>e.body,pt=(e,t)=>e.reduce(((e,n)=>(e[t(n)]=n,e)),Object.create(null)),yt=11264;function gt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=!1===o.filterResponse?e=>e:e=>e.result;return Tt(e,t,"query",{query:n,params:r},o).pipe(we(s))}function vt(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Ot(e,t,{uri:St(e,"doc",n),json:!0,tag:r.tag}).pipe(be(dt),we((e=>e.body.documents&&e.body.documents[0])))}function mt(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Ot(e,t,{uri:St(e,"doc",n.join(",")),json:!0,tag:r.tag}).pipe(be(dt),we((e=>{const t=pt(e.body.documents||[],(e=>e._id));return n.map((e=>t[e]||null))})))}function wt(e,t,n,r){return qe("createIfNotExists",n),xt(e,t,n,"createIfNotExists",r)}function bt(e,t,n,r){return qe("createOrReplace",n),xt(e,t,n,"createOrReplace",r)}function Ct(e,t,n,r){return Tt(e,t,"mutate",{mutations:[{delete:ke(n)}]},r)}function Et(e,t,n,r){const o=n instanceof Ke||n instanceof Xe||n instanceof at||n instanceof ut?n.serialize():n;return Tt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId},r)}function Tt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===n,i="query"===n,a=s?"":We(r),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:St(e,n,u),json:!0,body:c?void 0:r,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 n=l?"documentId":"documentIds",r=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[n]:r}})))}function xt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Tt(e,t,"mutate",{mutations:[{[r]:n}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Ot(e,t,n){const r=n.url||n.uri,o=e.config(),s=void 0===n.canUseCdn?["GET","HEAD"].indexOf(n.method||"GET")>=0&&0===r.indexOf("/data/"):n.canUseCdn,i=o.useCdn&&s,a=n.tag&&o.requestTagPrefix?[o.requestTagPrefix,n.tag].join("."):n.tag||o.requestTagPrefix;a&&(n.query={tag:He(a),...n.query});const c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={},r=t.token||e.token;r&&(n.Authorization="Bearer ".concat(r)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(n[Ae]=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({},n,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o})}(o,Object.assign({},n,{url:jt(e,r,i)})),u=new de((e=>t(c,o.requester).subscribe(e)));return n.signal?u.pipe((l=n.signal,e=>new de((t=>{const n=()=>t.error(function(e){var t,n;if(At)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const r=new Error(null!=(n=null==e?void 0:e.reason)?n:"The operation was aborted.");return r.name="AbortError",r}(l));if(l&&l.aborted)return void n();const r=e.subscribe(t);return l.addEventListener("abort",n),()=>{l.removeEventListener("abort",n),r.unsubscribe()}})))):u;var l}function _t(e,t,n){return Ot(e,t,n).pipe(be((e=>"response"===e.type)),we((e=>e.body)))}function St(e,t,n){const r=e.config(),o=Ne(r),s="/".concat(t,"/").concat(o),i=n?"".concat(s,"/").concat(n):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function jt(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:r,cdnUrl:o}=e.config();return"".concat(n?o:r,"/").concat(t.replace(/^\//,""))}const At=Boolean(globalThis.DOMException);var kt,Ft,Rt,It,Mt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Pt=(e,t,n)=>(Mt(e,t,"read from private field"),n?n.call(e):t.get(e)),Dt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},qt=(e,t,n,r)=>(Mt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Nt{constructor(e,t){Dt(this,kt,void 0),Dt(this,Ft,void 0),qt(this,kt,e),qt(this,Ft,t)}upload(e,t,n){return Wt(Pt(this,kt),Pt(this,Ft),e,t,n)}}kt=new WeakMap,Ft=new WeakMap;class Ht{constructor(e,t){Dt(this,Rt,void 0),Dt(this,It,void 0),qt(this,Rt,e),qt(this,It,t)}upload(e,t,n){return me(Wt(Pt(this,Rt),Pt(this,It),e,t,n).pipe(be((e=>"response"===e.type)),we((e=>e.body.document))))}}function Wt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Me(n);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=Ne(e.config()),a="image"===n?"images":"files",c=function(e,t){if("undefined"==typeof window||!(t instanceof window.File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,r),{tag:u,label:l,title:h,description:d,creditLine:f,filename:p,source:y}=c,g={label:l,title:h,description:d,filename:p,meta:s,creditLine:f};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.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:g,body:r})}Rt=new WeakMap,It=new WeakMap;const zt="https://www.sanity.io/help/";function Ut(e){return zt+e}const Lt=e=>function(e){let t,n=!1;return function(){return n||(t=e(...arguments),n=!0),t}}((function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return console.warn(e.join(" "),...n)})),Bt=Lt(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat(Ut("js-client-cdn-configuration")," "),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),$t=Lt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Ut("js-client-browser-token")," for more information and how to hide this warning.")]),Vt=Lt(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Ut("js-client-api-version"))]),Jt=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},Xt=["localhost","127.0.0.1","0.0.0.0"],Yt=(e,t)=>{const n=Object.assign({},t,e);n.apiVersion||Vt();const r=Object.assign({},Gt,n),o=r.useProjectHostname;if("undefined"==typeof Promise){const e=Ut("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(e))}if(o&&!r.projectId)throw new Error("Configuration must contain `projectId`");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(e=>-1!==Xt.indexOf(e))(window.location.hostname);s&&i&&r.token&&!0!==r.ignoreBrowserTokenWarning?$t():void 0===r.useCdn&&Bt(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(r.projectId),r.dataset&&Ie(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?He(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===Gt.apiHost,r.useCdn=Boolean(r.useCdn)&&!r.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`")}(r.apiVersion);const a=r.apiHost.split("://",2),c=a[0],u=a[1],l=r.isDefaultApi?"apicdn.sanity.io":u;return r.useProjectHostname?(r.url="".concat(c,"://").concat(r.projectId,".").concat(u,"/v").concat(r.apiVersion),r.cdnUrl="".concat(c,"://").concat(r.projectId,".").concat(l,"/v").concat(r.apiVersion)):(r.url="".concat(r.apiHost,"/v").concat(r.apiVersion),r.cdnUrl=r.url),r};var Kt=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(n[r]=void 0===e[r]?t[r]:e[r],n)),{});const Zt=(e,t)=>t.reduce(((t,n)=>(void 0===e[n]||(t[n]=e[n]),t)),{}),Qt=14800,en=Ee,tn=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],nn={includeResult:!0};function rn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:r,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=n.tag&&i?[i,n.tag].join("."):n.tag,c={...Kt(n,nn),tag:a},u=Zt(c,tn),l=We({query:e,params:t,options:{tag:a,...u}}),h="".concat(r).concat(St(this,"listen",l));if(h.length>Qt)return new de((e=>e.error(new Error("Query too large for listener"))));const d=c.events?c.events:["mutation"],f=-1!==d.indexOf("reconnect"),p={};return(o||s)&&(p.withCredentials=!0),o&&(p.headers={Authorization:"Bearer ".concat(o)}),new de((e=>{let t,n=u(),r=!1;function o(){r||(f&&e.next({type:"reconnect"}),r||n.readyState===en.CLOSED&&(c(),clearTimeout(t),t=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=on(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 n=on(t);return n instanceof Error?e.error(n):e.next(n)}function a(){r=!0,c(),e.complete()}function c(){n.removeEventListener("error",o,!1),n.removeEventListener("channelError",s,!1),n.removeEventListener("disconnect",a,!1),d.forEach((e=>n.removeEventListener(e,i,!1))),n.close()}function u(){const e=new en(h,p);return e.addEventListener("error",o,!1),e.addEventListener("channelError",s,!1),e.addEventListener("disconnect",a,!1),d.forEach((t=>e.addEventListener(t,i,!1))),e}function l(){n=u()}return function(){r=!0,c()}}))}function on(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var sn,an,cn,un,ln=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},hn=(e,t,n)=>(ln(e,t,"read from private field"),n?n.call(e):t.get(e)),dn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},fn=(e,t,n,r)=>(ln(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class pn{constructor(e,t){dn(this,sn,void 0),dn(this,an,void 0),fn(this,sn,e),fn(this,an,t)}create(e,t){return gn(hn(this,sn),hn(this,an),"PUT",e,t)}edit(e,t){return gn(hn(this,sn),hn(this,an),"PATCH",e,t)}delete(e){return gn(hn(this,sn),hn(this,an),"DELETE",e)}list(){return _t(hn(this,sn),hn(this,an),{uri:"/datasets"})}}sn=new WeakMap,an=new WeakMap;class yn{constructor(e,t){dn(this,cn,void 0),dn(this,un,void 0),fn(this,cn,e),fn(this,un,t)}create(e,t){return me(gn(hn(this,cn),hn(this,un),"PUT",e,t))}edit(e,t){return me(gn(hn(this,cn),hn(this,un),"PATCH",e,t))}delete(e){return me(gn(hn(this,cn),hn(this,un),"DELETE",e))}list(){return me(_t(hn(this,cn),hn(this,un),{uri:"/datasets"}))}}function gn(e,t,n,r,o){return Ie(r),_t(e,t,{method:n,uri:"/datasets/".concat(r),body:o})}cn=new WeakMap,un=new WeakMap;var vn,mn,wn,bn,Cn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},En=(e,t,n)=>(Cn(e,t,"read from private field"),n?n.call(e):t.get(e)),Tn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},xn=(e,t,n,r)=>(Cn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class On{constructor(e,t){Tn(this,vn,void 0),Tn(this,mn,void 0),xn(this,vn,e),xn(this,mn,t)}list(){return _t(En(this,vn),En(this,mn),{uri:"/projects"})}getById(e){return _t(En(this,vn),En(this,mn),{uri:"/projects/".concat(e)})}}vn=new WeakMap,mn=new WeakMap;class _n{constructor(e,t){Tn(this,wn,void 0),Tn(this,bn,void 0),xn(this,wn,e),xn(this,bn,t)}list(){return me(_t(En(this,wn),En(this,bn),{uri:"/projects"}))}getById(e){return me(_t(En(this,wn),En(this,bn),{uri:"/projects/".concat(e)}))}}wn=new WeakMap,bn=new WeakMap;var Sn,jn,An,kn,Fn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Rn=(e,t,n)=>(Fn(e,t,"read from private field"),n?n.call(e):t.get(e)),In=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Mn=(e,t,n,r)=>(Fn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Pn{constructor(e,t){In(this,Sn,void 0),In(this,jn,void 0),Mn(this,Sn,e),Mn(this,jn,t)}getById(e){return _t(Rn(this,Sn),Rn(this,jn),{uri:"/users/".concat(e)})}}Sn=new WeakMap,jn=new WeakMap;class Dn{constructor(e,t){In(this,An,void 0),In(this,kn,void 0),Mn(this,An,e),Mn(this,kn,t)}getById(e){return me(_t(Rn(this,An),Rn(this,kn),{uri:"/users/".concat(e)}))}}An=new WeakMap,kn=new WeakMap;var qn,Nn,Hn,Wn,zn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Un=(e,t,n)=>(zn(e,t,"read from private field"),n?n.call(e):t.get(e)),Ln=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Bn=(e,t,n,r)=>(zn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const $n=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gt;Ln(this,qn,void 0),Ln(this,Nn,void 0),this.listen=rn,this.config(t),Bn(this,Nn,e),this.assets=new Nt(this,Un(this,Nn)),this.datasets=new pn(this,Un(this,Nn)),this.projects=new On(this,Un(this,Nn)),this.users=new Pn(this,Un(this,Nn))}clone(){return new $n(Un(this,Nn),this.config())}config(e){if(void 0===e)return{...Un(this,qn)};if(Un(this,qn)&&!1===Un(this,qn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Bn(this,qn,Yt(e,Un(this,qn)||{})),this}withConfig(e){return new $n(Un(this,Nn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return gt(this,Un(this,Nn),e,t,n)}getDocument(e,t){return vt(this,Un(this,Nn),e,t)}getDocuments(e,t){return mt(this,Un(this,Nn),e,t)}create(e,t){return xt(this,Un(this,Nn),e,"create",t)}createIfNotExists(e,t){return wt(this,Un(this,Nn),e,t)}createOrReplace(e,t){return bt(this,Un(this,Nn),e,t)}delete(e,t){return Ct(this,Un(this,Nn),e,t)}mutate(e,t){return Et(this,Un(this,Nn),e,t)}patch(e,t){return new Xe(e,t,this)}transaction(e){return new ut(e,this)}request(e){return _t(this,Un(this,Nn),e)}getUrl(e,t){return jt(this,e,t)}getDataUrl(e,t){return St(this,e,t)}};let Vn=$n;qn=new WeakMap,Nn=new WeakMap;const Jn=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gt;Ln(this,Hn,void 0),Ln(this,Wn,void 0),this.listen=rn,this.config(t),Bn(this,Wn,e),this.assets=new Ht(this,Un(this,Wn)),this.datasets=new yn(this,Un(this,Wn)),this.projects=new _n(this,Un(this,Wn)),this.users=new Dn(this,Un(this,Wn)),this.observable=new Vn(e,t)}clone(){return new Jn(Un(this,Wn),this.config())}config(e){if(void 0===e)return{...Un(this,Hn)};if(Un(this,Hn)&&!1===Un(this,Hn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),Bn(this,Hn,Yt(e,Un(this,Hn)||{})),this}withConfig(e){return new Jn(Un(this,Wn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return me(gt(this,Un(this,Wn),e,t,n))}getDocument(e,t){return me(vt(this,Un(this,Wn),e,t))}getDocuments(e,t){return me(mt(this,Un(this,Wn),e,t))}create(e,t){return me(xt(this,Un(this,Wn),e,"create",t))}createIfNotExists(e,t){return me(wt(this,Un(this,Wn),e,t))}createOrReplace(e,t){return me(bt(this,Un(this,Wn),e,t))}delete(e,t){return me(Ct(this,Un(this,Wn),e,t))}mutate(e,t){return me(Et(this,Un(this,Wn),e,t))}patch(e,t){return new Ke(e,t,this)}transaction(e){return new at(e,this)}request(e){return me(_t(this,Un(this,Wn),e))}dataRequest(e,t,n){return me(Tt(this,Un(this,Wn),e,t,n))}getUrl(e,t){return jt(this,e,t)}getDataUrl(e,t){return St(this,e,t)}};let Gn=Jn;Hn=new WeakMap,Wn=new WeakMap;const Xn=function(e){const t=O([...e,je,M(),P(),{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,n=e.context;function r(e){return t=>{const r=t.lengthComputable?t.loaded/t.total*100:-1;n.channels.progress.publish({stage:e,percent:r,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=r("upload")),"onprogress"in t&&(t.onprogress=r("download"))}},Se,N({implementation:de})]);function n(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:t)({maxRedirects:0,...e})}return n.defaultRequester=t,n}([]),Yn=Xn.defaultRequester;e.BasePatch=Je,e.BaseTransaction=st,e.ClientError=Te,e.ObservablePatch=Xe,e.ObservableSanityClient=Vn,e.ObservableTransaction=ut,e.Patch=Ke,e.SanityClient=Gn,e.ServerError=xe,e.Transaction=at,e.createClient=e=>new Gn(Xn,e),e.default=function(e){return Jt(),new Gn(Xn,e)},e.requester=Yn,Object.defineProperty(e,"__esModule",{value:!0})}));
14
+ !function(t,e){!function(n){var r=n.setTimeout,o=n.clearTimeout,s=n.XMLHttpRequest,i=n.XDomainRequest,a=n.ActiveXObject,c=n.EventSource,u=n.document,l=n.Promise,h=n.fetch,d=n.Response,f=n.TextDecoder,p=n.TextEncoder,y=n.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(t){u.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(t){function e(){}return e.prototype=t,new e}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=h;h=function(t,e){var n=e.signal;return g(t,{headers:e.headers,credentials:e.credentials,cache:e.cache}).then((function(t){var e=t.body.getReader();return n._reader=e,n._aborted&&n._reader.cancel(),{status:t.status,statusText:t.statusText,headers:t.headers,body:{getReader:function(){return e}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function m(){this.bitsNeeded=0,this.codePoint=0}m.prototype.decode=function(t){function e(t,e,n){if(1===n)return t>=128>>e&&t<<e<=2047;if(2===n)return t>=2048>>e&&t<<e<=55295||t>=57344>>e&&t<<e<=65535;if(3===n)return t>=65536>>e&&t<<e<=1114111;throw new Error}function n(t,e){if(6===t)return e>>6>15?3:e>31?2:1;if(12===t)return e>15?3:2;if(18===t)return 3;throw new Error}for(var r=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<t.length;a+=1){var c=t[a];0!==s&&(c<128||c>191||!e(i<<6|63&c,s-6,n(s,i)))&&(s=0,i=r,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=r),0===s||e(i,s,n(s,i))||(s=0,i=r)):(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(t){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+t)}return!1}()||(f=m);var v=function(){};function w(t){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=t,this._sendTimeout=0,this._abort=v}function b(t){return t.replace(/[A-Z]/g,(function(t){return String.fromCharCode(t.charCodeAt(0)+32)}))}function C(t){for(var e=Object.create(null),n=t.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),s=o.shift(),i=o.join(": ");e[b(s)]=i}this._map=e}function E(){}function T(t){this._headers=t}function x(){}function O(){this._listeners=Object.create(null)}function _(t){r((function(){throw t}),0)}function S(t){this.type=t,this.target=void 0}function j(t,e){S.call(this,t),this.data=e.data,this.lastEventId=e.lastEventId}function A(t,e){S.call(this,t),this.status=e.status,this.statusText=e.statusText,this.headers=e.headers}function k(t,e){S.call(this,t),this.error=e.error}w.prototype.open=function(t,e){this._abort(!0);var n=this,i=this._xhr,a=1,c=0;this._abort=function(t){0!==n._sendTimeout&&(o(n._sendTimeout),n._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,i.abort(),0!==c&&(o(c),c=0),t||(n.readyState=4,n.onabort(null),n.onreadystatechange())),a=0};var u=function(){if(1===a){var t=0,e="",r=void 0;if("contentType"in i)t=200,e="OK",r=i.contentType;else try{t=i.status,e=i.statusText,r=i.getResponseHeader("Content-Type")}catch(n){t=0,e="",r=void 0}0!==t&&(a=2,n.readyState=2,n.status=t,n.statusText=e,n._contentType=r,n.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var t="";try{t=i.responseText}catch(t){}n.readyState=3,n.responseText=t,n.onprogress()}},h=function(t,e){if(null!=e&&null!=e.preventDefault||(e={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),n.readyState=4,"load"===t)n.onload(e);else if("error"===t)n.onerror(e);else{if("abort"!==t)throw new TypeError;n.onabort(e)}n.onreadystatechange()}},d=function(){c=r((function(){d()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(t){h("load",t)}),"onerror"in i&&(i.onerror=function(t){h("error",t)}),"onabort"in i&&(i.onabort=function(t){h("abort",t)}),"onprogress"in i&&(i.onprogress=l),"onreadystatechange"in i&&(i.onreadystatechange=function(t){!function(t){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",t):3===i.readyState?"onprogress"in i||l():2===i.readyState&&u())}(t)}),!("contentType"in i)&&"ontimeout"in s.prototype||(e+=(-1===e.indexOf("?")?"?":"&")+"padding=true"),i.open(t,e,!0),"readyState"in i&&(c=r((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(t){return this._contentType},w.prototype.setRequestHeader=function(t,e){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(t,e)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var t=this._xhr;"withCredentials"in t&&(t.withCredentials=this.withCredentials);try{t.send(void 0)}catch(t){throw t}}else{var e=this;e._sendTimeout=r((function(){e._sendTimeout=0,e.send()}),4)}},C.prototype.get=function(t){return this._map[b(t)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),E.prototype.open=function(t,e,n,r,o,i,a){t.open("GET",o);var c=0;for(var u in t.onprogress=function(){var e=t.responseText.slice(c);c+=e.length,n(e)},t.onerror=function(t){t.preventDefault(),r(new Error("NetworkError"))},t.onload=function(){r(null)},t.onabort=function(){r(null)},t.onreadystatechange=function(){if(t.readyState===s.HEADERS_RECEIVED){var n=t.status,r=t.statusText,o=t.getResponseHeader("Content-Type"),i=t.getAllResponseHeaders();e(n,r,o,new C(i))}},t.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,u)&&t.setRequestHeader(u,a[u]);return t.send(),t},T.prototype.get=function(t){return this._headers.get(t)},x.prototype.open=function(t,e,n,r,o,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(t){return a=t.body.getReader(),e(t.status,t.statusText,t.headers.get("Content-Type"),new T(t.headers)),new l((function(t,e){var r=function(){a.read().then((function(e){if(e.done)t(void 0);else{var o=d.decode(e.value,{stream:!0});n(o),r()}})).catch((function(t){e(t)}))};r()}))})).catch((function(t){return"AbortError"===t.name?void 0:t})).then((function(t){r(t)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(t){t.target=this;var e=this._listeners[t.type];if(null!=e)for(var n=e.length,r=0;r<n;r+=1){var o=e[r];try{"function"==typeof o.handleEvent?o.handleEvent(t):o.call(this,t)}catch(t){_(t)}}},O.prototype.addEventListener=function(t,e){t=String(t);var n=this._listeners,r=n[t];null==r&&(r=[],n[t]=r);for(var o=!1,s=0;s<r.length;s+=1)r[s]===e&&(o=!0);o||r.push(e)},O.prototype.removeEventListener=function(t,e){t=String(t);var n=this._listeners,r=n[t];if(null!=r){for(var o=[],s=0;s<r.length;s+=1)r[s]!==e&&o.push(r[s]);0===o.length?delete n[t]:n[t]=o}},j.prototype=Object.create(S.prototype),A.prototype=Object.create(S.prototype),k.prototype=Object.create(S.prototype);var F=-1,R=0,I=1,M=2,P=-1,D=0,q=1,N=2,H=3,W=/^text\/event\-stream(;.*)?$/i,z=function(t,e){var n=null==t?e:parseInt(t,10);return n!=n&&(n=e),U(n)},U=function(t){return Math.min(Math.max(t,1e3),18e6)},L=function(t,e,n){try{"function"==typeof e&&e.call(t,n)}catch(t){_(t)}};function B(t,e){O.call(this),e=e||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(t,e,n){e=String(e);var a=Boolean(n.withCredentials),c=n.lastEventIdQueryParameterName||"lastEventId",u=U(1e3),l=z(n.heartbeatTimeout,45e3),h="",d=u,f=!1,p=0,y=n.headers||{},g=n.Transport,m=$&&null==g?void 0:new w(null!=g?new g:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=g&&"string"!=typeof g?new g:null==m?new x:new E,b=void 0,C=0,T=F,O="",_="",S="",B="",V=D,J=0,G=0,X=function(e,n,r,o){if(T===R)if(200===e&&null!=r&&W.test(r)){T=I,f=Date.now(),d=u,t.readyState=I;var s=new A("open",{status:e,statusText:n,headers:o});t.dispatchEvent(s),L(t,t.onopen,s)}else{var i="";200!==e?(n&&(n=n.replace(/\s+/g," ")),i="EventSource's response has a status "+e+" "+n+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",Z();s=new A("error",{status:e,statusText:n,headers:o});t.dispatchEvent(s),L(t,t.onerror,s),console.error(i)}},Y=function(e){if(T===I){for(var n=-1,s=0;s<e.length;s+=1){(c=e.charCodeAt(s))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(n=s)}var i=(-1!==n?B:"")+e.slice(0,n+1);B=(-1===n?B:"")+e.slice(n+1),""!==e&&(f=Date.now(),p+=e.length);for(var a=0;a<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&&(G=a+1);var y=i.slice(J,G-1),g=i.slice(G+(G<a&&i.charCodeAt(G)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=g):"id"===y?_=g:"event"===y?S=g:"retry"===y?(u=z(g,u),d=u):"heartbeatTimeout"===y&&(l=z(g,l),0!==C&&(o(C),C=r((function(){Q()}),l)))}if(V===D){if(""!==O){h=_,""===S&&(S="message");var m=new j(S,{data:O.slice(1),lastEventId:_});if(t.dispatchEvent(m),"open"===S?L(t,t.onopen,m):"message"===S?L(t,t.onmessage,m):"error"===S&&L(t,t.onerror,m),T===M)return}O="",S=""}V=c==="\r".charCodeAt(0)?P:D}else V===D&&(J=a,V=q),V===q?c===":".charCodeAt(0)&&(G=a+1,V=N):V===N&&(V=H)}}},K=function(e){if(T===I||T===R){T=F,0!==C&&(o(C),C=0),C=r((function(){Q()}),d),d=U(Math.min(16*u,2*d)),t.readyState=R;var n=new k("error",{error:e});t.dispatchEvent(n),L(t,t.onerror,n),null!=e&&console.error(e)}},Z=function(){T=M,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),t.readyState=M},Q=function(){if(C=0,T===F){f=!1,p=0,C=r((function(){Q()}),l),T=R,O="",S="",_=h,B="",J=0,G=0,V=D;var n=e;if("data:"!==e.slice(0,5)&&"blob:"!==e.slice(0,5)&&""!==h){var o=e.indexOf("?");n=-1===o?e:e.slice(0,o+1)+e.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(t,e){return e===c?"":t})),n+=(-1===e.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var s=t.withCredentials,i={Accept:"text/event-stream"},a=t.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,n,s,i)}catch(t){throw Z(),t}}else if(f||null==b){var d=Math.max((f||Date.now())+l-Date.now(),1);f=!1,C=r((function(){Q()}),d)}else K(new Error("No activity within "+l+" milliseconds. "+(T===R?"No response received.":p+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};t.url=e,t.readyState=R,t.withCredentials=a,t.headers=y,t._close=Z,Q()}(this,t,e)}var $=null!=h&&null!=d&&"body"in d.prototype;B.prototype=Object.create(O.prototype),B.prototype.CONNECTING=R,B.prototype.OPEN=I,B.prototype.CLOSED=M,B.prototype.close=function(){this._close()},B.CONNECTING=R,B.OPEN=I,B.CLOSED=M,B.prototype.withCredentials=void 0;var V,J=c;null==s||null!=c&&"withCredentials"in c.prototype||(J=B),V=function(t){t.EventSourcePolyfill=B,t.NativeEventSource=c,t.EventSource=J}(e),void 0!==V&&(t.exports=V)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:i:globalThis)}({get exports(){return bt},set exports(t){bt=t}},bt);var Ct=bt.EventSourcePolyfill;class Et extends Error{constructor(t){const e=xt(t);super(e.message),this.statusCode=400,Object.assign(this,e)}}class Tt extends Error{constructor(t){const e=xt(t);super(e.message),this.statusCode=500,Object.assign(this,e)}}function xt(t){const e=t.body,n={response:t,statusCode:t.statusCode,responseBody:Ot(e,t),message:"",details:void 0};return e.error&&e.message?(n.message="".concat(e.error," - ").concat(e.message),n):e.error&&e.error.description?(n.message=e.error.description,n.details=e.error,n):(n.message=e.error||e.message||function(t){const e=t.statusMessage?" ".concat(t.statusMessage):"";return"".concat(t.method,"-request to ").concat(t.url," resulted in HTTP ").concat(t.statusCode).concat(e)}(t),n)}function Ot(t,e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t}const _t={onResponse:t=>{if(t.statusCode>=500)throw new Tt(t);if(t.statusCode>=400)throw new Et(t);return t}},St={onResponse:t=>{const e=t.headers["x-sanity-warning"];return(Array.isArray(e)?e:[e]).filter(Boolean).forEach((t=>console.warn(t))),t}};const jt="X-Sanity-Project-ID";function At(t){if("string"==typeof t||Array.isArray(t))return{id:t};if("object"==typeof t&&null!==t&&"query"in t&&"string"==typeof t.query)return"params"in t&&"object"==typeof t.params&&null!==t.params?{query:t.query,params:t.params}:{query:t.query};const e=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(e))}const kt=["image","file"],Ft=["before","after","replace"],Rt=t=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},It=t=>{if(-1===kt.indexOf(t))throw new Error("Invalid asset type: ".concat(t,". Must be one of ").concat(kt.join(", ")))},Mt=(t,e)=>{if(null===e||"object"!=typeof e||Array.isArray(e))throw new Error("".concat(t,"() takes an object of properties"))},Pt=(t,e)=>{if("string"!=typeof e||!/^[a-z0-9_.-]+$/i.test(e))throw new Error("".concat(t,'(): "').concat(e,'" is not a valid document ID'))},Dt=(t,e)=>{if(!e._id)throw new Error("".concat(t,'() requires that the document contains an ID ("_id" property)'));Pt(t,e._id)},qt=t=>{if(!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},Nt=t=>{if("string"!=typeof t||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t},Ht=t=>{let{query:e,params:n={},options:r={}}=t;const o=new URLSearchParams,{tag:s,...i}=r;s&&o.set("tag",s),o.set("query",e);for(const[t,e]of Object.entries(n))o.set("$".concat(t),JSON.stringify(e));for(const[t,e]of Object.entries(i))e&&o.set(t,"".concat(e));return"?".concat(o)};var Wt,zt,Ut=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Lt=(t,e,n)=>(Ut(t,e,"read from private field"),n?n.call(t):e.get(t)),Bt=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},$t=(t,e,n,r)=>(Ut(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class Vt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=t,this.operations=e}set(t){return this._assign("set",t)}setIfMissing(t){return this._assign("setIfMissing",t)}diffMatchPatch(t){return Mt("diffMatchPatch",t),this._assign("diffMatchPatch",t)}unset(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:t}),this}inc(t){return this._assign("inc",t)}dec(t){return this._assign("dec",t)}insert(t,e,n){return((t,e,n)=>{const r="insert(at, selector, items)";if(-1===Ft.indexOf(t)){const t=Ft.map((t=>'"'.concat(t,'"'))).join(", ");throw new Error("".concat(r,' takes an "at"-argument which is one of: ').concat(t))}if("string"!=typeof e)throw new Error("".concat(r,' takes a "selector"-argument which must be a string'));if(!Array.isArray(n))throw new Error("".concat(r,' takes an "items"-argument which must be an array'))})(t,e,n),this._assign("insert",{[t]:e,items:n})}append(t,e){return this.insert("after","".concat(t,"[-1]"),e)}prepend(t,e){return this.insert("before","".concat(t,"[0]"),e)}splice(t,e,n,r){const o=e<0?e-1:e,s=void 0===n||-1===n?-1:Math.max(0,e+n),i=o<0&&s>=0?"":s,a="".concat(t,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,r||[])}ifRevisionId(t){return this.operations.ifRevisionID=t,this}serialize(){return{...At(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return Mt(t,e),this.operations=Object.assign({},this.operations,{[t]:Object.assign({},n&&this.operations[t]||{},e)}),this}_set(t,e){return this._assign(t,e,!1)}}const Jt=class extends Vt{constructor(t,e,n){super(t,e),Bt(this,Wt,void 0),$t(this,Wt,n)}clone(){return new Jt(this.selection,{...this.operations},Lt(this,Wt))}commit(t){if(!Lt(this,Wt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const e="string"==typeof this.selection,n=Object.assign({returnFirst:e,returnDocuments:!0},t);return Lt(this,Wt).mutate({patch:this.serialize()},n)}};let Gt=Jt;Wt=new WeakMap;const Xt=class extends Vt{constructor(t,e,n){super(t,e),Bt(this,zt,void 0),$t(this,zt,n)}clone(){return new Xt(this.selection,{...this.operations},Lt(this,zt))}commit(t){if(!Lt(this,zt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const e="string"==typeof this.selection,n=Object.assign({returnFirst:e,returnDocuments:!0},t);return Lt(this,zt).mutate({patch:this.serialize()},n)}};let Yt=Xt;zt=new WeakMap;var Kt,Zt,Qt=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},te=(t,e,n)=>(Qt(t,e,"read from private field"),n?n.call(t):e.get(t)),ee=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ne=(t,e,n,r)=>(Qt(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);const re={returnDocuments:!1};class oe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;this.operations=t,this.trxId=e}create(t){return Mt("create",t),this._add({create:t})}createIfNotExists(t){const e="createIfNotExists";return Mt(e,t),Dt(e,t),this._add({[e]:t})}createOrReplace(t){const e="createOrReplace";return Mt(e,t),Dt(e,t),this._add({[e]:t})}delete(t){return Pt("delete",t),this._add({delete:{id:t}})}transactionId(t){return t?(this.trxId=t,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(t){return this.operations.push(t),this}}const se=class extends oe{constructor(t,e,n){super(t,n),ee(this,Kt,void 0),ne(this,Kt,e)}clone(){return new se([...this.operations],te(this,Kt),this.trxId)}commit(t){if(!te(this,Kt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return te(this,Kt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},re,t||{}))}patch(t,e){const n="function"==typeof e;if("string"!=typeof t&&t instanceof Yt)return this._add({patch:t.serialize()});if(n){const n=e(new Yt(t,{},te(this,Kt)));if(!(n instanceof Yt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:t,...e}})}};let ie=se;Kt=new WeakMap;const ae=class extends oe{constructor(t,e,n){super(t,n),ee(this,Zt,void 0),ne(this,Zt,e)}clone(){return new ae([...this.operations],te(this,Zt),this.trxId)}commit(t){if(!te(this,Zt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return te(this,Zt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},re,t||{}))}patch(t,e){const n="function"==typeof e;if("string"!=typeof t&&t instanceof Gt)return this._add({patch:t.serialize()});if(n){const n=e(new Gt(t,{},te(this,Zt)));if(!(n instanceof Gt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:t,...e}})}};let ce=ae;Zt=new WeakMap;const ue=(t,e)=>!1===t?void 0:void 0===t?e:t,le=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:t.dryRun,returnIds:!0,returnDocuments:ue(t.returnDocuments,!0),visibility:t.visibility||"sync",autoGenerateArrayKeys:t.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:t.skipCrossDatasetReferenceValidation}},he=t=>"response"===t.type,de=t=>t.body,fe=(t,e)=>t.reduce(((t,n)=>(t[e(n)]=n,t)),Object.create(null)),pe=11264;function ye(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=!1===o.filterResponse?t=>t:t=>t.result;return Ee(t,e,"query",{query:n,params:r},o).pipe(vt(s))}function ge(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return xe(t,e,{uri:_e(t,"doc",n),json:!0,tag:r.tag}).pipe(wt(he),vt((t=>t.body.documents&&t.body.documents[0])))}function me(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return xe(t,e,{uri:_e(t,"doc",n.join(",")),json:!0,tag:r.tag}).pipe(wt(he),vt((t=>{const e=fe(t.body.documents||[],(t=>t._id));return n.map((t=>e[t]||null))})))}function ve(t,e,n,r){return Dt("createIfNotExists",n),Te(t,e,n,"createIfNotExists",r)}function we(t,e,n,r){return Dt("createOrReplace",n),Te(t,e,n,"createOrReplace",r)}function be(t,e,n,r){return Ee(t,e,"mutate",{mutations:[{delete:At(n)}]},r)}function Ce(t,e,n,r){const o=n instanceof Yt||n instanceof Gt||n instanceof ie||n instanceof ce?n.serialize():n;return Ee(t,e,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId},r)}function Ee(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===n,i="query"===n,a=s?"":Ht(r),c=!s&&a.length<pe,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:f,headers:p}=o;return xe(t,e,{method:c?"GET":"POST",uri:_e(t,n,u),json:!0,body:c?void 0:r,query:s&&le(o),timeout:h,headers:p,token:d,tag:f,canUseCdn:i,signal:o.signal}).pipe(wt(he),vt(de),vt((t=>{if(!s)return t;const e=t.results||[];if(o.returnDocuments)return l?e[0]&&e[0].document:e.map((t=>t.document));const n=l?"documentId":"documentIds",r=l?e[0]&&e[0].id:e.map((t=>t.id));return{transactionId:t.transactionId,results:e,[n]:r}})))}function Te(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return Ee(t,e,"mutate",{mutations:[{[r]:n}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function xe(t,e,n){const r=n.url||n.uri,o=t.config(),s=void 0===n.canUseCdn?["GET","HEAD"].indexOf(n.method||"GET")>=0&&0===r.indexOf("/data/"):n.canUseCdn,i=o.useCdn&&s,a=n.tag&&o.requestTagPrefix?[o.requestTagPrefix,n.tag].join("."):n.tag||o.requestTagPrefix;a&&(n.query={tag:Nt(a),...n.query});const c=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={},r=e.token||t.token;r&&(n.Authorization="Bearer ".concat(r)),e.useGlobalApi||t.useProjectHostname||!t.projectId||(n[jt]=t.projectId);const o=Boolean(void 0===e.withCredentials?t.token||t.withCredentials:e.withCredentials),s=void 0===e.timeout?t.timeout:e.timeout;return Object.assign({},e,{headers:Object.assign({},n,e.headers||{}),timeout:void 0===s?3e5:s,proxy:e.proxy||t.proxy,json:!0,withCredentials:o})}(o,Object.assign({},n,{url:Se(t,r,i)})),u=new ht((t=>e(c,o.requester).subscribe(t)));return n.signal?u.pipe((l=n.signal,t=>new ht((e=>{const n=()=>e.error(function(t){var e,n;if(je)return new DOMException(null!=(e=null==t?void 0:t.reason)?e:"The operation was aborted.","AbortError");const r=new Error(null!=(n=null==t?void 0:t.reason)?n:"The operation was aborted.");return r.name="AbortError",r}(l));if(l&&l.aborted)return void n();const r=t.subscribe(e);return l.addEventListener("abort",n),()=>{l.removeEventListener("abort",n),r.unsubscribe()}})))):u;var l}function Oe(t,e,n){return xe(t,e,n).pipe(wt((t=>"response"===t.type)),vt((t=>t.body)))}function _e(t,e,n){const r=t.config(),o=qt(r),s="/".concat(e,"/").concat(o),i=n?"".concat(s,"/").concat(n):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Se(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:r,cdnUrl:o}=t.config();return"".concat(n?o:r,"/").concat(e.replace(/^\//,""))}const je=Boolean(globalThis.DOMException);var Ae,ke,Fe,Re,Ie=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Me=(t,e,n)=>(Ie(t,e,"read from private field"),n?n.call(t):e.get(t)),Pe=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},De=(t,e,n,r)=>(Ie(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class qe{constructor(t,e){Pe(this,Ae,void 0),Pe(this,ke,void 0),De(this,Ae,t),De(this,ke,e)}upload(t,e,n){return He(Me(this,Ae),Me(this,ke),t,e,n)}}Ae=new WeakMap,ke=new WeakMap;class Ne{constructor(t,e){Pe(this,Fe,void 0),Pe(this,Re,void 0),De(this,Fe,t),De(this,Re,e)}upload(t,e,n){return mt(He(Me(this,Fe),Me(this,Re),t,e,n).pipe(wt((t=>"response"===t.type)),vt((t=>t.body.document))))}}function He(t,e,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};It(n);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=qt(t.config()),a="image"===n?"images":"files",c=function(t,e){if("undefined"==typeof window||!(e instanceof window.File))return t;return Object.assign({filename:!1===t.preserveFilename?void 0:e.name,contentType:e.type},t)}(o,r),{tag:u,label:l,title:h,description:d,creditLine:f,filename:p,source:y}=c,g={label:l,title:h,description:d,filename:p,meta:s,creditLine:f};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),xe(t,e,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:r})}Fe=new WeakMap,Re=new WeakMap;const We="https://www.sanity.io/help/";function ze(t){return We+t}const Ue=t=>function(t){let e,n=!1;return function(){return n||(e=t(...arguments),n=!0),e}}((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return console.warn(t.join(" "),...n)})),Le=Ue(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat(ze("js-client-cdn-configuration")," "),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),Be=Ue(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(ze("js-client-browser-token")," for more information and how to hide this warning.")]),$e=Ue(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(ze("js-client-api-version"))]),Ve=Ue(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead"]),Je={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Ge=["localhost","127.0.0.1","0.0.0.0"],Xe=(t,e)=>{const n=Object.assign({},e,t);n.apiVersion||$e();const r=Object.assign({},Je,n),o=r.useProjectHostname;if("undefined"==typeof Promise){const t=ze("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(t))}if(o&&!r.projectId)throw new Error("Configuration must contain `projectId`");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(t=>-1!==Ge.indexOf(t))(window.location.hostname);s&&i&&r.token&&!0!==r.ignoreBrowserTokenWarning?Be():void 0===r.useCdn&&Le(),o&&(t=>{if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(r.projectId),r.dataset&&Rt(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?Nt(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===Je.apiHost,r.useCdn=Boolean(r.useCdn)&&!r.withCredentials,function(t){if("1"===t||"X"===t)return;const e=new Date(t);if(!(/^\d{4}-\d{2}-\d{2}$/.test(t)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(r.apiVersion);const a=r.apiHost.split("://",2),c=a[0],u=a[1],l=r.isDefaultApi?"apicdn.sanity.io":u;return r.useProjectHostname?(r.url="".concat(c,"://").concat(r.projectId,".").concat(u,"/v").concat(r.apiVersion),r.cdnUrl="".concat(c,"://").concat(r.projectId,".").concat(l,"/v").concat(r.apiVersion)):(r.url="".concat(r.apiHost,"/v").concat(r.apiVersion),r.cdnUrl=r.url),r};var Ye=(t,e)=>Object.keys(e).concat(Object.keys(t)).reduce(((n,r)=>(n[r]=void 0===t[r]?e[r]:t[r],n)),{});const Ke=(t,e)=>e.reduce(((e,n)=>(void 0===t[n]||(e[n]=t[n]),e)),{}),Ze=14800,Qe=Ct,tn=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],en={includeResult:!0};function nn(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:r,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=n.tag&&i?[i,n.tag].join("."):n.tag,c={...Ye(n,en),tag:a},u=Ke(c,tn),l=Ht({query:t,params:e,options:{tag:a,...u}}),h="".concat(r).concat(_e(this,"listen",l));if(h.length>Ze)return new ht((t=>t.error(new Error("Query too large for listener"))));const d=c.events?c.events:["mutation"],f=-1!==d.indexOf("reconnect"),p={};return(o||s)&&(p.withCredentials=!0),o&&(p.headers={Authorization:"Bearer ".concat(o)}),new ht((t=>{let e,n=u(),r=!1;function o(){r||(f&&t.next({type:"reconnect"}),r||n.readyState===Qe.CLOSED&&(c(),clearTimeout(e),e=setTimeout(l,100)))}function s(e){t.error(function(t){if(t instanceof Error)return t;const e=rn(t);return e instanceof Error?e:new Error(function(t){if(!t.error)return t.message||"Unknown listener error";if(t.error.description)return t.error.description;return"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2)}(e))}(e))}function i(e){const n=rn(e);return n instanceof Error?t.error(n):t.next(n)}function a(){r=!0,c(),t.complete()}function c(){n.removeEventListener("error",o,!1),n.removeEventListener("channelError",s,!1),n.removeEventListener("disconnect",a,!1),d.forEach((t=>n.removeEventListener(t,i,!1))),n.close()}function u(){const t=new Qe(h,p);return t.addEventListener("error",o,!1),t.addEventListener("channelError",s,!1),t.addEventListener("disconnect",a,!1),d.forEach((e=>t.addEventListener(e,i,!1))),t}function l(){n=u()}return function(){r=!0,c()}}))}function rn(t){try{const e=t.data&&JSON.parse(t.data)||{};return Object.assign({type:t.type},e)}catch(t){return t}}var on,sn,an,cn,un=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},ln=(t,e,n)=>(un(t,e,"read from private field"),n?n.call(t):e.get(t)),hn=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},dn=(t,e,n,r)=>(un(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class fn{constructor(t,e){hn(this,on,void 0),hn(this,sn,void 0),dn(this,on,t),dn(this,sn,e)}create(t,e){return yn(ln(this,on),ln(this,sn),"PUT",t,e)}edit(t,e){return yn(ln(this,on),ln(this,sn),"PATCH",t,e)}delete(t){return yn(ln(this,on),ln(this,sn),"DELETE",t)}list(){return Oe(ln(this,on),ln(this,sn),{uri:"/datasets"})}}on=new WeakMap,sn=new WeakMap;class pn{constructor(t,e){hn(this,an,void 0),hn(this,cn,void 0),dn(this,an,t),dn(this,cn,e)}create(t,e){return mt(yn(ln(this,an),ln(this,cn),"PUT",t,e))}edit(t,e){return mt(yn(ln(this,an),ln(this,cn),"PATCH",t,e))}delete(t){return mt(yn(ln(this,an),ln(this,cn),"DELETE",t))}list(){return mt(Oe(ln(this,an),ln(this,cn),{uri:"/datasets"}))}}function yn(t,e,n,r,o){return Rt(r),Oe(t,e,{method:n,uri:"/datasets/".concat(r),body:o})}an=new WeakMap,cn=new WeakMap;var gn,mn,vn,wn,bn=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Cn=(t,e,n)=>(bn(t,e,"read from private field"),n?n.call(t):e.get(t)),En=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Tn=(t,e,n,r)=>(bn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class xn{constructor(t,e){En(this,gn,void 0),En(this,mn,void 0),Tn(this,gn,t),Tn(this,mn,e)}list(){return Oe(Cn(this,gn),Cn(this,mn),{uri:"/projects"})}getById(t){return Oe(Cn(this,gn),Cn(this,mn),{uri:"/projects/".concat(t)})}}gn=new WeakMap,mn=new WeakMap;class On{constructor(t,e){En(this,vn,void 0),En(this,wn,void 0),Tn(this,vn,t),Tn(this,wn,e)}list(){return mt(Oe(Cn(this,vn),Cn(this,wn),{uri:"/projects"}))}getById(t){return mt(Oe(Cn(this,vn),Cn(this,wn),{uri:"/projects/".concat(t)}))}}vn=new WeakMap,wn=new WeakMap;var _n,Sn,jn,An,kn=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Fn=(t,e,n)=>(kn(t,e,"read from private field"),n?n.call(t):e.get(t)),Rn=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},In=(t,e,n,r)=>(kn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);class Mn{constructor(t,e){Rn(this,_n,void 0),Rn(this,Sn,void 0),In(this,_n,t),In(this,Sn,e)}getById(t){return Oe(Fn(this,_n),Fn(this,Sn),{uri:"/users/".concat(t)})}}_n=new WeakMap,Sn=new WeakMap;class Pn{constructor(t,e){Rn(this,jn,void 0),Rn(this,An,void 0),In(this,jn,t),In(this,An,e)}getById(t){return mt(Oe(Fn(this,jn),Fn(this,An),{uri:"/users/".concat(t)}))}}jn=new WeakMap,An=new WeakMap;var Dn,qn,Nn,Hn,Wn=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},zn=(t,e,n)=>(Wn(t,e,"read from private field"),n?n.call(t):e.get(t)),Un=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Ln=(t,e,n,r)=>(Wn(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);const Bn=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Je;Un(this,Dn,void 0),Un(this,qn,void 0),this.listen=nn,this.config(e),Ln(this,qn,t),this.assets=new qe(this,zn(this,qn)),this.datasets=new fn(this,zn(this,qn)),this.projects=new xn(this,zn(this,qn)),this.users=new Mn(this,zn(this,qn))}clone(){return new Bn(zn(this,qn),this.config())}config(t){if(void 0===t)return{...zn(this,Dn)};if(zn(this,Dn)&&!1===zn(this,Dn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Ln(this,Dn,Xe(t,zn(this,Dn)||{})),this}withConfig(t){return new Bn(zn(this,qn),{...this.config(),...t})}fetch(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ye(this,zn(this,qn),t,e,n)}getDocument(t,e){return ge(this,zn(this,qn),t,e)}getDocuments(t,e){return me(this,zn(this,qn),t,e)}create(t,e){return Te(this,zn(this,qn),t,"create",e)}createIfNotExists(t,e){return ve(this,zn(this,qn),t,e)}createOrReplace(t,e){return we(this,zn(this,qn),t,e)}delete(t,e){return be(this,zn(this,qn),t,e)}mutate(t,e){return Ce(this,zn(this,qn),t,e)}patch(t,e){return new Gt(t,e,this)}transaction(t){return new ce(t,this)}request(t){return Oe(this,zn(this,qn),t)}getUrl(t,e){return Se(this,t,e)}getDataUrl(t,e){return _e(this,t,e)}};let $n=Bn;Dn=new WeakMap,qn=new WeakMap;const Vn=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Je;Un(this,Nn,void 0),Un(this,Hn,void 0),this.listen=nn,this.config(e),Ln(this,Hn,t),this.assets=new Ne(this,zn(this,Hn)),this.datasets=new pn(this,zn(this,Hn)),this.projects=new On(this,zn(this,Hn)),this.users=new Pn(this,zn(this,Hn)),this.observable=new $n(t,e)}clone(){return new Vn(zn(this,Hn),this.config())}config(t){if(void 0===t)return{...zn(this,Nn)};if(zn(this,Nn)&&!1===zn(this,Nn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(t),Ln(this,Nn,Xe(t,zn(this,Nn)||{})),this}withConfig(t){return new Vn(zn(this,Hn),{...this.config(),...t})}fetch(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return mt(ye(this,zn(this,Hn),t,e,n))}getDocument(t,e){return mt(ge(this,zn(this,Hn),t,e))}getDocuments(t,e){return mt(me(this,zn(this,Hn),t,e))}create(t,e){return mt(Te(this,zn(this,Hn),t,"create",e))}createIfNotExists(t,e){return mt(ve(this,zn(this,Hn),t,e))}createOrReplace(t,e){return mt(we(this,zn(this,Hn),t,e))}delete(t,e){return mt(be(this,zn(this,Hn),t,e))}mutate(t,e){return mt(Ce(this,zn(this,Hn),t,e))}patch(t,e){return new Yt(t,e,this)}transaction(t){return new ie(t,this)}request(t){return mt(Oe(this,zn(this,Hn),t))}dataRequest(t,e,n){return mt(Ee(this,zn(this,Hn),t,e,n))}getUrl(t,e){return Se(this,t,e)}getDataUrl(t,e){return _e(this,t,e)}};let Jn=Vn;Nn=new WeakMap,Hn=new WeakMap;const Gn=function(t){const e=O([...t,St,M(),P(),{onRequest:t=>{if("xhr"!==t.adapter)return;const e=t.request,n=t.context;function r(t){return e=>{const r=e.lengthComputable?e.loaded/e.total*100:-1;n.channels.progress.publish({stage:t,percent:r,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=r("upload")),"onprogress"in e&&(e.onprogress=r("download"))}},_t,N({implementation:ht})]);function n(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:e)({maxRedirects:0,...t})}return n.defaultRequester=e,n}([]),Xn=Gn.defaultRequester;t.BasePatch=Vt,t.BaseTransaction=oe,t.ClientError=Et,t.ObservablePatch=Gt,t.ObservableSanityClient=$n,t.ObservableTransaction=ce,t.Patch=Yt,t.SanityClient=Jn,t.ServerError=Tt,t.Transaction=ie,t.createClient=t=>new Jn(Gn,t),t.default=function(t){return Ve(),new Jn(Gn,t)},t.requester=Xn,Object.defineProperty(t,"__esModule",{value:!0})}));