@sanity/client 5.4.1 → 5.4.2-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -12
- package/dist/index.browser.cjs +6 -0
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +6 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +51 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/data/dataMethods.ts +4 -0
- package/src/types.ts +53 -0
- package/umd/sanityClient.js +6 -0
- package/umd/sanityClient.min.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/client",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.2-dev.0",
|
|
4
4
|
"description": "Client for retrieving, creating and patching data from Sanity.io",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"import": "./dist/index.browser.js"
|
|
34
34
|
},
|
|
35
35
|
"deno": "./dist/index.browser.js",
|
|
36
|
+
"edge": "./dist/index.browser.js",
|
|
36
37
|
"edge-light": "./dist/index.browser.js",
|
|
37
38
|
"worker": "./dist/index.browser.js",
|
|
38
39
|
"source": "./src/index.ts",
|
package/src/data/dataMethods.ts
CHANGED
|
@@ -301,6 +301,10 @@ export function _requestObservable<R>(
|
|
|
301
301
|
options.query = {tag: validate.requestTag(tag), ...options.query}
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
+
if (config.resultSourceMap) {
|
|
305
|
+
options.query = {resultSourceMap: true, ...options.query}
|
|
306
|
+
}
|
|
307
|
+
|
|
304
308
|
const reqOptions = requestOptions(
|
|
305
309
|
config,
|
|
306
310
|
Object.assign({}, options, {
|
package/src/types.ts
CHANGED
|
@@ -51,6 +51,8 @@ export interface ClientConfig {
|
|
|
51
51
|
* @deprecated Don't use
|
|
52
52
|
*/
|
|
53
53
|
requester?: Requester
|
|
54
|
+
|
|
55
|
+
resultSourceMap?: boolean
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
/** @public */
|
|
@@ -461,16 +463,67 @@ export type FilteredResponseQueryOptions = RequestOptions & {
|
|
|
461
463
|
filterResponse?: true
|
|
462
464
|
}
|
|
463
465
|
|
|
466
|
+
/**
|
|
467
|
+
* DocumentValueSource is a path to a value within a document
|
|
468
|
+
* @internal
|
|
469
|
+
*/
|
|
470
|
+
export type DocumentValueSource = {
|
|
471
|
+
type: 'documentValue'
|
|
472
|
+
|
|
473
|
+
// index location of the document
|
|
474
|
+
document: number
|
|
475
|
+
// index location of the path
|
|
476
|
+
path: number
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* When a value is not from a source, its a literal
|
|
480
|
+
* @internal
|
|
481
|
+
*/
|
|
482
|
+
export type LiteralSource = {
|
|
483
|
+
type: 'literal'
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* When a field source is unknown
|
|
487
|
+
* @internal
|
|
488
|
+
*/
|
|
489
|
+
export type UnknownSource = {
|
|
490
|
+
type: 'unknown'
|
|
491
|
+
}
|
|
492
|
+
/** @internal */
|
|
493
|
+
export type Source = DocumentValueSource | LiteralSource | UnknownSource
|
|
494
|
+
/**
|
|
495
|
+
* ValueMapping is a mapping when for value that is from a single source value
|
|
496
|
+
* It may refer to a field within a document or a literal value
|
|
497
|
+
* @internal
|
|
498
|
+
*/
|
|
499
|
+
export type ValueMapping = {
|
|
500
|
+
type: 'value'
|
|
501
|
+
|
|
502
|
+
// source of the value
|
|
503
|
+
source: Source
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/** @internal */
|
|
507
|
+
export type Mapping = ValueMapping
|
|
508
|
+
|
|
464
509
|
/** @internal */
|
|
465
510
|
export type UnfilteredResponseQueryOptions = RequestOptions & {
|
|
466
511
|
filterResponse: false
|
|
467
512
|
}
|
|
468
513
|
|
|
514
|
+
/** @internal */
|
|
515
|
+
export type ContentSourceMapping = {
|
|
516
|
+
mappings: Record<string, Mapping>
|
|
517
|
+
documents: Array<SanityDocument>
|
|
518
|
+
paths: Array<string>
|
|
519
|
+
}
|
|
520
|
+
|
|
469
521
|
/** @internal */
|
|
470
522
|
export interface RawQueryResponse<R> {
|
|
471
523
|
q: string
|
|
472
524
|
ms: number
|
|
473
525
|
result: R
|
|
526
|
+
resultSourceMap: ContentSourceMapping
|
|
474
527
|
}
|
|
475
528
|
|
|
476
529
|
/** @internal */
|
package/umd/sanityClient.js
CHANGED
|
@@ -2855,6 +2855,12 @@
|
|
|
2855
2855
|
...options.query
|
|
2856
2856
|
};
|
|
2857
2857
|
}
|
|
2858
|
+
if (config.resultSourceMap) {
|
|
2859
|
+
options.query = {
|
|
2860
|
+
resultSourceMap: true,
|
|
2861
|
+
...options.query
|
|
2862
|
+
};
|
|
2863
|
+
}
|
|
2858
2864
|
const reqOptions = requestOptions(config, Object.assign({}, options, {
|
|
2859
2865
|
url: _getUrl(client, uri, useCdn)
|
|
2860
2866
|
}));
|
package/umd/sanityClient.min.js
CHANGED
|
@@ -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";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}const n={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4};function r(e){const t="string"==typeof e?Object.assign({url:e},n):Object.assign({},n,e),r=new URL(t.url,"http://localhost");if(t.timeout=o(t.timeout),t.query)for(const[e,n]of Object.entries(t.query))if(void 0!==n)if(Array.isArray(n))for(const t of n)r.searchParams.append(e,t);else r.searchParams.append(e,n);return t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url="http://localhost"===r.origin?"".concat(r.pathname,"?").concat(r.searchParams):r.toString(),t}function o(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const t=Number(e);return isNaN(t)?o(n.timeout):{connect:t,socket:t}}const i=/^https?:\/\//i;function s(e){if(!i.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c=function(e){return e.replace(/^\s+|\s+$/g,"")},u=function(e){if(!e)return{};for(var t,n={},r=c(e).split("\n"),o=0;o<r.length;o++){var i=r[o],s=i.indexOf(":"),a=c(i.slice(0,s)).toLowerCase(),u=c(i.slice(s+1));void 0===n[a]?n[a]=u:(t=n[a],"[object Array]"===Object.prototype.toString.call(t)?n[a].push(u):n[a]=[n[a],u])}return n};const l=["request","response","progress","error","abort"],h=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function d(e,t){const n=[],o=h.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[s]});function i(e){const 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=(e=>function(t,n){const r="onError"===t;let o=n;for(var i=arguments.length,s=new Array(i>2?i-2:0),a=2;a<i;a++)s[a-2]=arguments[a];for(let n=0;n<e[t].length&&(o=(0,e[t][n])(o,...s),!r||o);n++);return o})(o),i=r("processOptions",e);r("validateOptions",i);const s={options:i,channels:n,applyMiddleware:r};let a=null;const c=n.request.subscribe((e=>{a=t(e,((t,o)=>function(e,t,o){let i=e,s=t;if(!i)try{s=r("onResponse",t,o)}catch(e){s=null,i=e}i=i&&r("onError",i,o),i?n.error.publish(i):s&&n.response.publish(s)}(t,o,e)))}));n.abort.subscribe((()=>{c(),a&&a.abort()}));const u=r("onReturn",n,s);return u===n&&n.request.publish(s),u}return i.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return h.forEach((t=>{e[t]&&o[t].push(e[t])})),n.push(e),i},i.clone=function(){return d(n,t)},e.forEach(i.use),i}var f,p,y,g,m,v=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},w=(e,t,n)=>(v(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)=>(v(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,m=new WeakMap;const E="function"==typeof XMLHttpRequest?"xhr":"fetch",T="xhr"===E?XMLHttpRequest:class{constructor(){this.readyState=0,this.responseType="",b(this,f,void 0),b(this,p,void 0),b(this,y,void 0),b(this,g,{}),b(this,m,void 0)}open(e,t,n){C(this,f,e),C(this,p,t),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(e,t){w(this,g)[e]=t}send(e){const t="arraybuffer"!==this.responseType,n={method:w(this,f),headers:w(this,g),body:e};"function"==typeof AbortController&&(C(this,m,new AbortController),"undefined"!=typeof EventTarget&&w(this,m).signal instanceof EventTarget&&(n.signal=w(this,m).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={},i=e.applyMiddleware("interceptRequest",void 0,{adapter:E,context:e});if(i){const e=setTimeout(t,0,null,i);return{abort:()=>clearTimeout(e)}}let s=new T;const a=r.headers,c=r.timeout;let l=!1,h=!1,d=!1;if(s.onerror=y,s.ontimeout=y,s.onabort=()=>{p(!0),l=!0},s.onreadystatechange=()=>{!function(){if(!c)return;p(),o.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),c.socket)}(),l||4!==s.readyState||0!==s.status&&function(){if(l||h||d)return;if(0===s.status)return void y(new Error("Unknown XHR error"));p(),h=!0,t(null,{body:s.response||(""===s.responseType||"text"===s.responseType?s.responseText:""),url:r.url,method:r.method,headers:u(s.getAllResponseHeaders()),statusCode:s.status,statusMessage:s.statusText})}()},s.open(r.method,r.url,!0),s.withCredentials=!!r.withCredentials,a&&s.setRequestHeader)for(const e in a)a.hasOwnProperty(e)&&s.setRequestHeader(e,a[e]);return r.rawBody&&(s.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:r,adapter:E,request:s,context:e}),s.send(r.body||null),c&&(o.connect=setTimeout((()=>f("ETIMEDOUT")),c.connect)),{abort:function(){l=!0,s&&s.abort()}};function f(t){d=!0,s.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||s.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function y(e){if(h)return;p(!0),h=!0,s=null;const n=e||new Error("Network error while attempting to reach ".concat(r.url));n.isNetworkError=!0,n.request=r,t(n)}};var O,_,j={};function S(){if(_)return O;_=1;var e=1e3,t=60*e,n=60*t,r=24*n,o=7*r,i=365.25*r;function s(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}return O=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(s){if((s=String(s)).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(s);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*i;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 i=Math.abs(o);if(i>=r)return s(o,i,r,"day");if(i>=n)return s(o,i,n,"hour");if(i>=t)return s(o,i,t,"minute");if(i>=e)return s(o,i,e,"second");return o+" ms"}(a):function(o){var i=Math.abs(o);if(i>=r)return Math.round(o/r)+"d";if(i>=n)return Math.round(o/n)+"h";if(i>=t)return Math.round(o/t)+"m";if(i>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var A=function(e){function t(e){let r,o,i,s=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),i=o-(r||o);n.diff=i,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,o)=>{if("%%"===r)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];r=i.call(n,t),e.splice(s,1),s--}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!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=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=S(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((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(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";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}const n={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4};function r(e){const t="string"==typeof e?Object.assign({url:e},n):Object.assign({},n,e),r=new URL(t.url,"http://localhost");if(t.timeout=o(t.timeout),t.query)for(const[e,n]of Object.entries(t.query))if(void 0!==n)if(Array.isArray(n))for(const t of n)r.searchParams.append(e,t);else r.searchParams.append(e,n);return t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url="http://localhost"===r.origin?"".concat(r.pathname,"?").concat(r.searchParams):r.toString(),t}function o(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const t=Number(e);return isNaN(t)?o(n.timeout):{connect:t,socket:t}}const s=/^https?:\/\//i;function i(e){if(!s.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c=function(e){return e.replace(/^\s+|\s+$/g,"")},u=function(e){if(!e)return{};for(var t,n={},r=c(e).split("\n"),o=0;o<r.length;o++){var s=r[o],i=s.indexOf(":"),a=c(s.slice(0,i)).toLowerCase(),u=c(s.slice(i+1));void 0===n[a]?n[a]=u:(t=n[a],"[object Array]"===Object.prototype.toString.call(t)?n[a].push(u):n[a]=[n[a],u])}return n};const l=["request","response","progress","error","abort"],h=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function d(e,t){const n=[],o=h.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[i]});function s(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=(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&&(o=(0,e[t][n])(o,...i),!r||o);n++);return o})(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 u=r("onReturn",n,i);return u===n&&n.request.publish(i),u}return s.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return h.forEach((t=>{e[t]&&o[t].push(e[t])})),n.push(e),s},s.clone=function(){return d(n,t)},e.forEach(s.use),s}var f,p,y,g,m,v=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},w=(e,t,n)=>(v(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)=>(v(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,m=new WeakMap;const E="function"==typeof XMLHttpRequest?"xhr":"fetch",T="xhr"===E?XMLHttpRequest:class{constructor(){this.readyState=0,this.responseType="",b(this,f,void 0),b(this,p,void 0),b(this,y,void 0),b(this,g,{}),b(this,m,void 0)}open(e,t,n){C(this,f,e),C(this,p,t),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(e,t){w(this,g)[e]=t}send(e){const t="arraybuffer"!==this.responseType,n={method:w(this,f),headers:w(this,g),body:e};"function"==typeof AbortController&&(C(this,m,new AbortController),"undefined"!=typeof EventTarget&&w(this,m).signal instanceof EventTarget&&(n.signal=w(this,m).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,c=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(!c)return;p(),o.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),c.socket)}(),l||4!==i.readyState||0!==i.status&&function(){if(l||h||d)return;if(0===i.status)return void y(new Error("Unknown XHR error"));p(),h=!0,t(null,{body:i.response||(""===i.responseType||"text"===i.responseType?i.responseText:""),url:r.url,method:r.method,headers:u(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),c&&(o.connect=setTimeout((()=>f("ETIMEDOUT")),c.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)}};var O,_,j={};function S(){if(_)return O;_=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 O=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(i){if((i=String(i)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*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 A=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=S(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((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};
|
|
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 k(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=A(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 F="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),R=["boolean","string","number"];function I(){return{processOptions:e=>{const t=e.body;if(!t)return e;var n,r,o;return!("function"==typeof t.pipe)&&!F(t)&&(-1!==R.indexOf(typeof t)||Array.isArray(t)||!1!==k(n=t)&&(void 0===(r=n.constructor)||!1!==k(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 M;M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var D=M;function q(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||D.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,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 N{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const H=class{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new N(e),t(this.reason))}))}};H.source=()=>{let e;return{token:new H((t=>{e=t})),cancel:e}};var W=function(e,t){return W=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])},W(e,t)};function z(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}W(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function U(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 L(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function B(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;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 $(e){return"function"==typeof e}function V(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 J=V((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 G(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var X=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 i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var s=U(i),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else i.remove(this);var c=this.initialTeardown;if($(c))try{c()}catch(e){o=e instanceof J?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=U(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{K(d)}catch(e){o=null!=o?o:[],e instanceof J?o=B(B([],L(o)),L(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 J(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)K(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)&&G(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&G(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function Y(e){return e instanceof X||e&&"closed"in e&&$(e.remove)&&$(e.add)&&$(e.unsubscribe)}function K(e){$(e)?e():e.unsubscribe()}X.EMPTY;var Z={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Q={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=Q.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,B([e,t],L(n))):setTimeout.apply(void 0,B([e,t],L(n)))},clearTimeout:function(e){var t=Q.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ee(){}var te=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Y(t)&&t.add(n)):n.destination=ae,n}return z(t,e),t.create=function(e,t,n){return new ie(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}(X),ne=Function.prototype.bind;function re(e,t){return ne.call(e,t)}var oe=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){se(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){se(e)}else se(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){se(e)}},e}(),ie=function(e){function t(t,n,r){var o,i,s=e.call(this)||this;$(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&Z.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&re(t.next,i),error:t.error&&re(t.error,i),complete:t.complete&&re(t.complete,i)}):o=t;return s.destination=new oe(o),s}return z(t,e),t}(te);function se(e){var t;t=e,Q.setTimeout((function(){throw t}))}var ae={closed:!0,next:ee,error:function(e){throw e},complete:ee},ce="function"==typeof Symbol&&Symbol.observable||"@@observable";function ue(e){return e}var le=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,i=(r=e)&&r instanceof te||function(e){return e&&$(e.next)&&$(e.error)&&$(e.complete)}(r)&&Y(r)?e:new ie(e,t,n);return function(){var e=o,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?o._subscribe(i):o._trySubscribe(i))}(),i},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=he(t))((function(t,r){var o=new ie({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[ce]=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?ue: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=he(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 he(e){var t;return null!==(t=null!=e?e:Z.Promise)&&void 0!==t?t:Promise}function de(e){return function(t){if(function(e){return $(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 fe(e,t,n,r,o){return new pe(e,t,n,r,o)}var pe=function(e){function t(t,n,r,o,i,s){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=s,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 z(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}(te),ye=V((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function ge(e,t){var n="object"==typeof t;return new Promise((function(r,o){var i,s=!1;e.subscribe({next:function(e){i=e,s=!0},error:o,complete:function(){s?r(i):n?r(t.defaultValue):o(new ye)}})}))}function me(e,t){return de((function(n,r){var o=0;n.subscribe(fe(r,(function(n){r.next(e.call(t,n,o++))})))}))}function ve(e,t){return de((function(n,r){var o=0;n.subscribe(fe(r,(function(n){return e.call(t,n,o++)&&r.next(n)})))}))}class we extends Error{constructor(e){const t=Ce(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class be extends Error{constructor(e){const t=Ce(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function Ce(e){const t=e.body,n={response:e,statusCode:e.statusCode,responseBody:Te(t,e),message:"",details:void 0};if(t.error&&t.message)return n.message="".concat(t.error," - ").concat(t.message),n;if(function(e){return Ee(e)&&Ee(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],r=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=r.length?":\n- ".concat(r.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),n.message="".concat(t.error.description).concat(o),n.details=t.error,n}return 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 Ee(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Te(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const xe={onResponse:e=>{if(e.statusCode>=500)throw new be(e);if(e.statusCode>=400)throw new we(e);return e}},Oe={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};const _e="X-Sanity-Project-ID";function je(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 Se=["image","file"],Ae=["before","after","replace"],ke=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")},Fe=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},Re=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},Ie=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));Re(e,t._id)},Pe=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},Me=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},De=e=>{let{query:t,params:n={},options:r={}}=e;const o=new URLSearchParams,{tag:i,...s}=r;i&&o.set("tag",i),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(s))t&&o.set(e,"".concat(t));return"?".concat(o)};var qe,Ne,He=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},We=(e,t,n)=>(He(e,t,"read from private field"),n?n.call(e):t.get(e)),ze=(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)},Ue=(e,t,n,r)=>(He(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Le{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 Fe("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===Ae.indexOf(e)){const e=Ae.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,i=void 0===n||-1===n?-1:Math.max(0,t+n),s=o<0&&i>=0?"":i,a="".concat(e,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,r||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...je(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 Fe(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 Be=class extends Le{constructor(e,t,n){super(e,t),ze(this,qe,void 0),Ue(this,qe,n)}clone(){return new Be(this.selection,{...this.operations},We(this,qe))}commit(e){if(!We(this,qe))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 We(this,qe).mutate({patch:this.serialize()},n)}};let $e=Be;qe=new WeakMap;const Ve=class extends Le{constructor(e,t,n){super(e,t),ze(this,Ne,void 0),Ue(this,Ne,n)}clone(){return new Ve(this.selection,{...this.operations},We(this,Ne))}commit(e){if(!We(this,Ne))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 We(this,Ne).mutate({patch:this.serialize()},n)}};let Je=Ve;Ne=new WeakMap;var Ge,Xe,Ye=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ke=(e,t,n)=>(Ye(e,t,"read from private field"),n?n.call(e):t.get(e)),Ze=(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)},Qe=(e,t,n,r)=>(Ye(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const et={returnDocuments:!1};class tt{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 Fe("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return Fe(t,e),Ie(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return Fe(t,e),Ie(t,e),this._add({[t]:e})}delete(e){return Re("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 nt=class extends tt{constructor(e,t,n){super(e,n),Ze(this,Ge,void 0),Qe(this,Ge,t)}clone(){return new nt([...this.operations],Ke(this,Ge),this.trxId)}commit(e){if(!Ke(this,Ge))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Ke(this,Ge).mutate(this.serialize(),Object.assign({transactionId:this.trxId},et,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof Je)return this._add({patch:e.serialize()});if(n){const n=t(new Je(e,{},Ke(this,Ge)));if(!(n instanceof Je))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 rt=nt;Ge=new WeakMap;const ot=class extends tt{constructor(e,t,n){super(e,n),Ze(this,Xe,void 0),Qe(this,Xe,t)}clone(){return new ot([...this.operations],Ke(this,Xe),this.trxId)}commit(e){if(!Ke(this,Xe))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Ke(this,Xe).mutate(this.serialize(),Object.assign({transactionId:this.trxId},et,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof $e)return this._add({patch:e.serialize()});if(n){const n=t(new $e(e,{},Ke(this,Xe)));if(!(n instanceof $e))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 it=ot;Xe=new WeakMap;const st=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,n=!0,!1===t?void 0:void 0===t?n:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,n},at=e=>"response"===e.type,ct=e=>e.body,ut=11264;function lt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const i=!1===o.filterResponse?e=>e:e=>e.result;return mt(e,t,"query",{query:n,params:r},o).pipe(me(i))}function ht(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return wt(e,t,{uri:Ct(e,"doc",n),json:!0,tag:r.tag}).pipe(ve(at),me((e=>e.body.documents&&e.body.documents[0])))}function dt(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return wt(e,t,{uri:Ct(e,"doc",n.join(",")),json:!0,tag:r.tag}).pipe(ve(at),me((e=>{const t=(r=e.body.documents||[],o=e=>e._id,r.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var r,o;return n.map((e=>t[e]||null))})))}function ft(e,t,n,r){return Ie("createIfNotExists",n),vt(e,t,n,"createIfNotExists",r)}function pt(e,t,n,r){return Ie("createOrReplace",n),vt(e,t,n,"createOrReplace",r)}function yt(e,t,n,r){return mt(e,t,"mutate",{mutations:[{delete:je(n)}]},r)}function gt(e,t,n,r){const o=n instanceof Je||n instanceof $e||n instanceof rt||n instanceof it?n.serialize():n;return mt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId},r)}function mt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const i="mutate"===n,s="query"===n,a=i?"":De(r),c=!i&&a.length<ut,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:f,headers:p}=o;return wt(e,t,{method:c?"GET":"POST",uri:Ct(e,n,u),json:!0,body:c?void 0:r,query:i&&st(o),timeout:h,headers:p,token:d,tag:f,canUseCdn:s,signal:o.signal}).pipe(ve(at),me(ct),me((e=>{if(!i)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 vt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return mt(e,t,"mutate",{mutations:[{[r]:n}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function wt(e,t,n){const r=n.url||n.uri,o=e.config(),i=void 0===n.canUseCdn?["GET","HEAD"].indexOf(n.method||"GET")>=0&&0===r.indexOf("/data/"):n.canUseCdn,s=o.useCdn&&i,a=n.tag&&o.requestTagPrefix?[o.requestTagPrefix,n.tag].join("."):n.tag||o.requestTagPrefix;a&&(n.query={tag:Me(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[_e]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),i=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},n,t.headers||{}),timeout:void 0===i?3e5:i,proxy:t.proxy||e.proxy,json:!0,withCredentials:o})}(o,Object.assign({},n,{url:Et(e,r,s)})),u=new le((e=>t(c,o.requester).subscribe(e)));return n.signal?u.pipe((l=n.signal,e=>new le((t=>{const n=()=>t.error(function(e){var t,n;if(Tt)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 bt(e,t,n){return wt(e,t,n).pipe(ve((e=>"response"===e.type)),me((e=>e.body)))}function Ct(e,t,n){const r=e.config(),o=Pe(r),i="/".concat(t,"/").concat(o),s=n?"".concat(i,"/").concat(n):i;return"/data".concat(s).replace(/\/($|\?)/,"$1")}function Et(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 Tt=Boolean(globalThis.DOMException);var xt,Ot,_t,jt,St=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},At=(e,t,n)=>(St(e,t,"read from private field"),n?n.call(e):t.get(e)),kt=(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)},Ft=(e,t,n,r)=>(St(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Rt{constructor(e,t){kt(this,xt,void 0),kt(this,Ot,void 0),Ft(this,xt,e),Ft(this,Ot,t)}upload(e,t,n){return Pt(At(this,xt),At(this,Ot),e,t,n)}}xt=new WeakMap,Ot=new WeakMap;class It{constructor(e,t){kt(this,_t,void 0),kt(this,jt,void 0),Ft(this,_t,e),Ft(this,jt,t)}upload(e,t,n){return ge(Pt(At(this,_t),At(this,jt),e,t,n).pipe(ve((e=>"response"===e.type)),me((e=>e.body.document))))}}function Pt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===Se.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Se.join(", ")))})(n);let i=o.extract||void 0;i&&!i.length&&(i=["none"]);const s=Pe(e.config()),a="image"===n?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,r),{tag:u,label:l,title:h,description:d,creditLine:f,filename:p,source:y}=c,g={label:l,title:h,description:d,filename:p,meta:i,creditLine:f};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),wt(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(s),headers:c.contentType?{"Content-Type":c.contentType}:{},query:g,body:r})}_t=new WeakMap,jt=new WeakMap;function Mt(e){return"https://www.sanity.io/help/"+e}const Dt=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)})),qt=Dt(["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(Mt("js-client-cdn-configuration")," "),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),Nt=Dt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Mt("js-client-browser-token")," for more information and how to hide this warning.")]),Ht=Dt(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Mt("js-client-api-version"))]),Wt=Dt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead"]),zt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Ut=["localhost","127.0.0.1","0.0.0.0"],Lt=(e,t)=>{const n=Object.assign({},t,e);n.apiVersion||Ht();const r=Object.assign({},zt,n),o=r.useProjectHostname;if("undefined"==typeof Promise){const e=Mt("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 i="undefined"!=typeof window&&window.location&&window.location.hostname,s=i&&(e=>-1!==Ut.indexOf(e))(window.location.hostname);i&&s&&r.token&&!0!==r.ignoreBrowserTokenWarning?Nt():void 0===r.useCdn&&qt(),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&&ke(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?Me(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===zt.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 Bt=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(n[r]=void 0===e[r]?t[r]:e[r],n)),{});const $t=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Vt={includeResult:!0};function Jt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:r,token:o,withCredentials:i,requestTagPrefix:s}=this.config(),a=n.tag&&s?[s,n.tag].join("."):n.tag,c={...Bt(n,Vt),tag:a},u=(l=c,$t.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=De({query:e,params:t,options:{tag:a,...u}}),d="".concat(r).concat(Ct(this,"listen",h));if(d.length>14800)return new le((e=>e.error(new Error("Query too large for listener"))));const f=c.events?c.events:["mutation"],p=-1!==f.indexOf("reconnect"),y={};return(o||i)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new le((e=>{let t,n;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let r=!1;function o(){r||(p&&e.next({type:"reconnect"}),r||t.readyState===t.CLOSED&&(c(),clearTimeout(n),n=setTimeout(l,100)))}function i(t){e.error(function(e){if(e instanceof Error)return e;const t=Gt(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 s(t){const n=Gt(t);return n instanceof Error?e.error(n):e.next(n)}function a(){r=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",i),t.removeEventListener("disconnect",a),f.forEach((e=>t.removeEventListener(e,s))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Ln})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",i),t.addEventListener("disconnect",a),f.forEach((e=>t.addEventListener(e,s))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),h()}))}function h(){r=!0,c()}return h}))}function Gt(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var Xt,Yt,Kt,Zt,Qt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},en=(e,t,n)=>(Qt(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)},nn=(e,t,n,r)=>(Qt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class rn{constructor(e,t){tn(this,Xt,void 0),tn(this,Yt,void 0),nn(this,Xt,e),nn(this,Yt,t)}create(e,t){return sn(en(this,Xt),en(this,Yt),"PUT",e,t)}edit(e,t){return sn(en(this,Xt),en(this,Yt),"PATCH",e,t)}delete(e){return sn(en(this,Xt),en(this,Yt),"DELETE",e)}list(){return bt(en(this,Xt),en(this,Yt),{uri:"/datasets"})}}Xt=new WeakMap,Yt=new WeakMap;class on{constructor(e,t){tn(this,Kt,void 0),tn(this,Zt,void 0),nn(this,Kt,e),nn(this,Zt,t)}create(e,t){return ge(sn(en(this,Kt),en(this,Zt),"PUT",e,t))}edit(e,t){return ge(sn(en(this,Kt),en(this,Zt),"PATCH",e,t))}delete(e){return ge(sn(en(this,Kt),en(this,Zt),"DELETE",e))}list(){return ge(bt(en(this,Kt),en(this,Zt),{uri:"/datasets"}))}}function sn(e,t,n,r,o){return ke(r),bt(e,t,{method:n,uri:"/datasets/".concat(r),body:o})}Kt=new WeakMap,Zt=new WeakMap;var an,cn,un,ln,hn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},dn=(e,t,n)=>(hn(e,t,"read from private field"),n?n.call(e):t.get(e)),fn=(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)},pn=(e,t,n,r)=>(hn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class yn{constructor(e,t){fn(this,an,void 0),fn(this,cn,void 0),pn(this,an,e),pn(this,cn,t)}list(){return bt(dn(this,an),dn(this,cn),{uri:"/projects"})}getById(e){return bt(dn(this,an),dn(this,cn),{uri:"/projects/".concat(e)})}}an=new WeakMap,cn=new WeakMap;class gn{constructor(e,t){fn(this,un,void 0),fn(this,ln,void 0),pn(this,un,e),pn(this,ln,t)}list(){return ge(bt(dn(this,un),dn(this,ln),{uri:"/projects"}))}getById(e){return ge(bt(dn(this,un),dn(this,ln),{uri:"/projects/".concat(e)}))}}un=new WeakMap,ln=new WeakMap;var mn,vn,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,mn,void 0),Tn(this,vn,void 0),xn(this,mn,e),xn(this,vn,t)}getById(e){return bt(En(this,mn),En(this,vn),{uri:"/users/".concat(e)})}}mn=new WeakMap,vn=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)}getById(e){return ge(bt(En(this,wn),En(this,bn),{uri:"/users/".concat(e)}))}}wn=new WeakMap,bn=new WeakMap;var jn,Sn,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)},Pn=(e,t,n,r)=>(Fn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const Mn=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zt;In(this,jn,void 0),In(this,Sn,void 0),this.listen=Jt,this.config(t),Pn(this,Sn,e),this.assets=new Rt(this,Rn(this,Sn)),this.datasets=new rn(this,Rn(this,Sn)),this.projects=new yn(this,Rn(this,Sn)),this.users=new On(this,Rn(this,Sn))}clone(){return new Mn(Rn(this,Sn),this.config())}config(e){if(void 0===e)return{...Rn(this,jn)};if(Rn(this,jn)&&!1===Rn(this,jn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Pn(this,jn,Lt(e,Rn(this,jn)||{})),this}withConfig(e){return new Mn(Rn(this,Sn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return lt(this,Rn(this,Sn),e,t,n)}getDocument(e,t){return ht(this,Rn(this,Sn),e,t)}getDocuments(e,t){return dt(this,Rn(this,Sn),e,t)}create(e,t){return vt(this,Rn(this,Sn),e,"create",t)}createIfNotExists(e,t){return ft(this,Rn(this,Sn),e,t)}createOrReplace(e,t){return pt(this,Rn(this,Sn),e,t)}delete(e,t){return yt(this,Rn(this,Sn),e,t)}mutate(e,t){return gt(this,Rn(this,Sn),e,t)}patch(e,t){return new $e(e,t,this)}transaction(e){return new it(e,this)}request(e){return bt(this,Rn(this,Sn),e)}getUrl(e,t){return Et(this,e,t)}getDataUrl(e,t){return Ct(this,e,t)}};let Dn=Mn;jn=new WeakMap,Sn=new WeakMap;const qn=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zt;In(this,An,void 0),In(this,kn,void 0),this.listen=Jt,this.config(t),Pn(this,kn,e),this.assets=new It(this,Rn(this,kn)),this.datasets=new on(this,Rn(this,kn)),this.projects=new gn(this,Rn(this,kn)),this.users=new _n(this,Rn(this,kn)),this.observable=new Dn(e,t)}clone(){return new qn(Rn(this,kn),this.config())}config(e){if(void 0===e)return{...Rn(this,An)};if(Rn(this,An)&&!1===Rn(this,An).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),Pn(this,An,Lt(e,Rn(this,An)||{})),this}withConfig(e){return new qn(Rn(this,kn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ge(lt(this,Rn(this,kn),e,t,n))}getDocument(e,t){return ge(ht(this,Rn(this,kn),e,t))}getDocuments(e,t){return ge(dt(this,Rn(this,kn),e,t))}create(e,t){return ge(vt(this,Rn(this,kn),e,"create",t))}createIfNotExists(e,t){return ge(ft(this,Rn(this,kn),e,t))}createOrReplace(e,t){return ge(pt(this,Rn(this,kn),e,t))}delete(e,t){return ge(yt(this,Rn(this,kn),e,t))}mutate(e,t){return ge(gt(this,Rn(this,kn),e,t))}patch(e,t){return new Je(e,t,this)}transaction(e){return new rt(e,this)}request(e){return ge(bt(this,Rn(this,kn),e))}dataRequest(e,t,n){return ge(mt(this,Rn(this,kn),e,t,n))}getUrl(e,t){return Et(this,e,t)}getDataUrl(e,t){return Ct(this,e,t)}};let Nn=qn;An=new WeakMap,kn=new WeakMap;const Hn=function(e){const t=function(){return d(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:x)}([...e,Oe,I(),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"))}},xe,q({implementation:le})]);function n(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:t)({maxRedirects:0,...e})}return n.defaultRequester=t,n}([]),Wn=Hn.defaultRequester;var zn={};
|
|
8
|
+
function k(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=A(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 F="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),R=["boolean","string","number"];function I(){return{processOptions:e=>{const t=e.body;if(!t)return e;var n,r,o;return!("function"==typeof t.pipe)&&!F(t)&&(-1!==R.indexOf(typeof t)||Array.isArray(t)||!1!==k(n=t)&&(void 0===(r=n.constructor)||!1!==k(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 M;M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var D=M;function q(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||D.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,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 N{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const H=class{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new N(e),t(this.reason))}))}};H.source=()=>{let e;return{token:new H((t=>{e=t})),cancel:e}};var W=function(e,t){return W=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])},W(e,t)};function z(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}W(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function U(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 L(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 B(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 $(e){return"function"==typeof e}function V(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 J=V((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 G(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var X=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=U(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($(c))try{c()}catch(e){o=e instanceof J?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=U(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{K(d)}catch(e){o=null!=o?o:[],e instanceof J?o=B(B([],L(o)),L(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 J(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)K(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)&&G(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&G(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function Y(e){return e instanceof X||e&&"closed"in e&&$(e.remove)&&$(e.add)&&$(e.unsubscribe)}function K(e){$(e)?e():e.unsubscribe()}X.EMPTY;var Z={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Q={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=Q.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,B([e,t],L(n))):setTimeout.apply(void 0,B([e,t],L(n)))},clearTimeout:function(e){var t=Q.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ee(){}var te=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Y(t)&&t.add(n)):n.destination=ae,n}return z(t,e),t.create=function(e,t,n){return new se(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}(X),ne=Function.prototype.bind;function re(e,t){return ne.call(e,t)}var oe=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){ie(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ie(e)}else ie(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ie(e)}},e}(),se=function(e){function t(t,n,r){var o,s,i=e.call(this)||this;$(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:i&&Z.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&re(t.next,s),error:t.error&&re(t.error,s),complete:t.complete&&re(t.complete,s)}):o=t;return i.destination=new oe(o),i}return z(t,e),t}(te);function ie(e){var t;t=e,Q.setTimeout((function(){throw t}))}var ae={closed:!0,next:ee,error:function(e){throw e},complete:ee},ce="function"==typeof Symbol&&Symbol.observable||"@@observable";function ue(e){return e}var le=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 te||function(e){return e&&$(e.next)&&$(e.error)&&$(e.complete)}(r)&&Y(r)?e:new se(e,t,n);return 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=he(t))((function(t,r){var o=new se({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[ce]=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?ue: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=he(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 he(e){var t;return null!==(t=null!=e?e:Z.Promise)&&void 0!==t?t:Promise}function de(e){return function(t){if(function(e){return $(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 fe(e,t,n,r,o){return new pe(e,t,n,r,o)}var pe=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 z(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}(te),ye=V((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function ge(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 ye)}})}))}function me(e,t){return de((function(n,r){var o=0;n.subscribe(fe(r,(function(n){r.next(e.call(t,n,o++))})))}))}function ve(e,t){return de((function(n,r){var o=0;n.subscribe(fe(r,(function(n){return e.call(t,n,o++)&&r.next(n)})))}))}class we extends Error{constructor(e){const t=Ce(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class be extends Error{constructor(e){const t=Ce(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function Ce(e){const t=e.body,n={response:e,statusCode:e.statusCode,responseBody:Te(t,e),message:"",details:void 0};if(t.error&&t.message)return n.message="".concat(t.error," - ").concat(t.message),n;if(function(e){return Ee(e)&&Ee(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],r=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=r.length?":\n- ".concat(r.join("\n- ")):"";return e.length>5&&(o+="\n...and ".concat(e.length-5," more")),n.message="".concat(t.error.description).concat(o),n.details=t.error,n}return 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 Ee(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Te(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const xe={onResponse:e=>{if(e.statusCode>=500)throw new be(e);if(e.statusCode>=400)throw new we(e);return e}},Oe={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};const _e="X-Sanity-Project-ID";function je(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 Se=["image","file"],Ae=["before","after","replace"],ke=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")},Fe=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},Re=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},Ie=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));Re(e,t._id)},Pe=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},Me=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},De=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 qe,Ne,He=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},We=(e,t,n)=>(He(e,t,"read from private field"),n?n.call(e):t.get(e)),ze=(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)},Ue=(e,t,n,r)=>(He(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Le{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 Fe("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===Ae.indexOf(e)){const e=Ae.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{...je(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 Fe(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 Be=class extends Le{constructor(e,t,n){super(e,t),ze(this,qe,void 0),Ue(this,qe,n)}clone(){return new Be(this.selection,{...this.operations},We(this,qe))}commit(e){if(!We(this,qe))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 We(this,qe).mutate({patch:this.serialize()},n)}};let $e=Be;qe=new WeakMap;const Ve=class extends Le{constructor(e,t,n){super(e,t),ze(this,Ne,void 0),Ue(this,Ne,n)}clone(){return new Ve(this.selection,{...this.operations},We(this,Ne))}commit(e){if(!We(this,Ne))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 We(this,Ne).mutate({patch:this.serialize()},n)}};let Je=Ve;Ne=new WeakMap;var Ge,Xe,Ye=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ke=(e,t,n)=>(Ye(e,t,"read from private field"),n?n.call(e):t.get(e)),Ze=(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)},Qe=(e,t,n,r)=>(Ye(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const et={returnDocuments:!1};class tt{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 Fe("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return Fe(t,e),Ie(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return Fe(t,e),Ie(t,e),this._add({[t]:e})}delete(e){return Re("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 nt=class extends tt{constructor(e,t,n){super(e,n),Ze(this,Ge,void 0),Qe(this,Ge,t)}clone(){return new nt([...this.operations],Ke(this,Ge),this.trxId)}commit(e){if(!Ke(this,Ge))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Ke(this,Ge).mutate(this.serialize(),Object.assign({transactionId:this.trxId},et,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof Je)return this._add({patch:e.serialize()});if(n){const n=t(new Je(e,{},Ke(this,Ge)));if(!(n instanceof Je))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 rt=nt;Ge=new WeakMap;const ot=class extends tt{constructor(e,t,n){super(e,n),Ze(this,Xe,void 0),Qe(this,Xe,t)}clone(){return new ot([...this.operations],Ke(this,Xe),this.trxId)}commit(e){if(!Ke(this,Xe))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Ke(this,Xe).mutate(this.serialize(),Object.assign({transactionId:this.trxId},et,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof $e)return this._add({patch:e.serialize()});if(n){const n=t(new $e(e,{},Ke(this,Xe)));if(!(n instanceof $e))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 st=ot;Xe=new WeakMap;const it=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,n=!0,!1===t?void 0:void 0===t?n:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,n},at=e=>"response"===e.type,ct=e=>e.body,ut=11264;function lt(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 mt(e,t,"query",{query:n,params:r},o).pipe(me(s))}function ht(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return wt(e,t,{uri:Ct(e,"doc",n),json:!0,tag:r.tag}).pipe(ve(at),me((e=>e.body.documents&&e.body.documents[0])))}function dt(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return wt(e,t,{uri:Ct(e,"doc",n.join(",")),json:!0,tag:r.tag}).pipe(ve(at),me((e=>{const t=(r=e.body.documents||[],o=e=>e._id,r.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var r,o;return n.map((e=>t[e]||null))})))}function ft(e,t,n,r){return Ie("createIfNotExists",n),vt(e,t,n,"createIfNotExists",r)}function pt(e,t,n,r){return Ie("createOrReplace",n),vt(e,t,n,"createOrReplace",r)}function yt(e,t,n,r){return mt(e,t,"mutate",{mutations:[{delete:je(n)}]},r)}function gt(e,t,n,r){const o=n instanceof Je||n instanceof $e||n instanceof rt||n instanceof st?n.serialize():n;return mt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId},r)}function mt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===n,i="query"===n,a=s?"":De(r),c=!s&&a.length<ut,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:f,headers:p}=o;return wt(e,t,{method:c?"GET":"POST",uri:Ct(e,n,u),json:!0,body:c?void 0:r,query:s&&it(o),timeout:h,headers:p,token:d,tag:f,canUseCdn:i,signal:o.signal}).pipe(ve(at),me(ct),me((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 vt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return mt(e,t,"mutate",{mutations:[{[r]:n}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function wt(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:Me(a),...n.query}),o.resultSourceMap&&(n.query={resultSourceMap:!0,...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[_e]=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:Et(e,r,i)})),u=new le((e=>t(c,o.requester).subscribe(e)));return n.signal?u.pipe((l=n.signal,e=>new le((t=>{const n=()=>t.error(function(e){var t,n;if(Tt)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 bt(e,t,n){return wt(e,t,n).pipe(ve((e=>"response"===e.type)),me((e=>e.body)))}function Ct(e,t,n){const r=e.config(),o=Pe(r),s="/".concat(t,"/").concat(o),i=n?"".concat(s,"/").concat(n):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Et(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 Tt=Boolean(globalThis.DOMException);var xt,Ot,_t,jt,St=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},At=(e,t,n)=>(St(e,t,"read from private field"),n?n.call(e):t.get(e)),kt=(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)},Ft=(e,t,n,r)=>(St(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Rt{constructor(e,t){kt(this,xt,void 0),kt(this,Ot,void 0),Ft(this,xt,e),Ft(this,Ot,t)}upload(e,t,n){return Pt(At(this,xt),At(this,Ot),e,t,n)}}xt=new WeakMap,Ot=new WeakMap;class It{constructor(e,t){kt(this,_t,void 0),kt(this,jt,void 0),Ft(this,_t,e),Ft(this,jt,t)}upload(e,t,n){return ge(Pt(At(this,_t),At(this,jt),e,t,n).pipe(ve((e=>"response"===e.type)),me((e=>e.body.document))))}}function Pt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};(e=>{if(-1===Se.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Se.join(", ")))})(n);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=Pe(e.config()),a="image"===n?"images":"files",c=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,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),wt(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})}_t=new WeakMap,jt=new WeakMap;function Mt(e){return"https://www.sanity.io/help/"+e}const Dt=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)})),qt=Dt(["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(Mt("js-client-cdn-configuration")," "),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),Nt=Dt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(Mt("js-client-browser-token")," for more information and how to hide this warning.")]),Ht=Dt(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(Mt("js-client-api-version"))]),Wt=Dt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead"]),zt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Ut=["localhost","127.0.0.1","0.0.0.0"],Lt=(e,t)=>{const n=Object.assign({},t,e);n.apiVersion||Ht();const r=Object.assign({},zt,n),o=r.useProjectHostname;if("undefined"==typeof Promise){const e=Mt("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!==Ut.indexOf(e))(window.location.hostname);s&&i&&r.token&&!0!==r.ignoreBrowserTokenWarning?Nt():void 0===r.useCdn&&qt(),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&&ke(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?Me(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===zt.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 Bt=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(n[r]=void 0===e[r]?t[r]:e[r],n)),{});const $t=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Vt={includeResult:!0};function Jt(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={...Bt(n,Vt),tag:a},u=(l=c,$t.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=De({query:e,params:t,options:{tag:a,...u}}),d="".concat(r).concat(Ct(this,"listen",h));if(d.length>14800)return new le((e=>e.error(new Error("Query too large for listener"))));const f=c.events?c.events:["mutation"],p=-1!==f.indexOf("reconnect"),y={};return(o||s)&&(y.withCredentials=!0),o&&(y.headers={Authorization:"Bearer ".concat(o)}),new le((e=>{let t,n;u().then((e=>{t=e})).catch((t=>{e.error(t),h()}));let r=!1;function o(){r||(p&&e.next({type:"reconnect"}),r||t.readyState===t.CLOSED&&(c(),clearTimeout(n),n=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=Gt(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=Gt(t);return n instanceof Error?e.error(n):e.next(n)}function a(){r=!0,c(),e.complete()}function c(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",s),t.removeEventListener("disconnect",a),f.forEach((e=>t.removeEventListener(e,i))),t.close())}async function u(){const{default:e}=await Promise.resolve().then((function(){return Ln})),t=new e(d,y);return t.addEventListener("error",o),t.addEventListener("channelError",s),t.addEventListener("disconnect",a),f.forEach((e=>t.addEventListener(e,i))),t}function l(){u().then((e=>{t=e})).catch((t=>{e.error(t),h()}))}function h(){r=!0,c()}return h}))}function Gt(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var Xt,Yt,Kt,Zt,Qt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},en=(e,t,n)=>(Qt(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)},nn=(e,t,n,r)=>(Qt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class rn{constructor(e,t){tn(this,Xt,void 0),tn(this,Yt,void 0),nn(this,Xt,e),nn(this,Yt,t)}create(e,t){return sn(en(this,Xt),en(this,Yt),"PUT",e,t)}edit(e,t){return sn(en(this,Xt),en(this,Yt),"PATCH",e,t)}delete(e){return sn(en(this,Xt),en(this,Yt),"DELETE",e)}list(){return bt(en(this,Xt),en(this,Yt),{uri:"/datasets"})}}Xt=new WeakMap,Yt=new WeakMap;class on{constructor(e,t){tn(this,Kt,void 0),tn(this,Zt,void 0),nn(this,Kt,e),nn(this,Zt,t)}create(e,t){return ge(sn(en(this,Kt),en(this,Zt),"PUT",e,t))}edit(e,t){return ge(sn(en(this,Kt),en(this,Zt),"PATCH",e,t))}delete(e){return ge(sn(en(this,Kt),en(this,Zt),"DELETE",e))}list(){return ge(bt(en(this,Kt),en(this,Zt),{uri:"/datasets"}))}}function sn(e,t,n,r,o){return ke(r),bt(e,t,{method:n,uri:"/datasets/".concat(r),body:o})}Kt=new WeakMap,Zt=new WeakMap;var an,cn,un,ln,hn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},dn=(e,t,n)=>(hn(e,t,"read from private field"),n?n.call(e):t.get(e)),fn=(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)},pn=(e,t,n,r)=>(hn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class yn{constructor(e,t){fn(this,an,void 0),fn(this,cn,void 0),pn(this,an,e),pn(this,cn,t)}list(){return bt(dn(this,an),dn(this,cn),{uri:"/projects"})}getById(e){return bt(dn(this,an),dn(this,cn),{uri:"/projects/".concat(e)})}}an=new WeakMap,cn=new WeakMap;class gn{constructor(e,t){fn(this,un,void 0),fn(this,ln,void 0),pn(this,un,e),pn(this,ln,t)}list(){return ge(bt(dn(this,un),dn(this,ln),{uri:"/projects"}))}getById(e){return ge(bt(dn(this,un),dn(this,ln),{uri:"/projects/".concat(e)}))}}un=new WeakMap,ln=new WeakMap;var mn,vn,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,mn,void 0),Tn(this,vn,void 0),xn(this,mn,e),xn(this,vn,t)}getById(e){return bt(En(this,mn),En(this,vn),{uri:"/users/".concat(e)})}}mn=new WeakMap,vn=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)}getById(e){return ge(bt(En(this,wn),En(this,bn),{uri:"/users/".concat(e)}))}}wn=new WeakMap,bn=new WeakMap;var jn,Sn,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)},Pn=(e,t,n,r)=>(Fn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const Mn=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zt;In(this,jn,void 0),In(this,Sn,void 0),this.listen=Jt,this.config(t),Pn(this,Sn,e),this.assets=new Rt(this,Rn(this,Sn)),this.datasets=new rn(this,Rn(this,Sn)),this.projects=new yn(this,Rn(this,Sn)),this.users=new On(this,Rn(this,Sn))}clone(){return new Mn(Rn(this,Sn),this.config())}config(e){if(void 0===e)return{...Rn(this,jn)};if(Rn(this,jn)&&!1===Rn(this,jn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Pn(this,jn,Lt(e,Rn(this,jn)||{})),this}withConfig(e){return new Mn(Rn(this,Sn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return lt(this,Rn(this,Sn),e,t,n)}getDocument(e,t){return ht(this,Rn(this,Sn),e,t)}getDocuments(e,t){return dt(this,Rn(this,Sn),e,t)}create(e,t){return vt(this,Rn(this,Sn),e,"create",t)}createIfNotExists(e,t){return ft(this,Rn(this,Sn),e,t)}createOrReplace(e,t){return pt(this,Rn(this,Sn),e,t)}delete(e,t){return yt(this,Rn(this,Sn),e,t)}mutate(e,t){return gt(this,Rn(this,Sn),e,t)}patch(e,t){return new $e(e,t,this)}transaction(e){return new st(e,this)}request(e){return bt(this,Rn(this,Sn),e)}getUrl(e,t){return Et(this,e,t)}getDataUrl(e,t){return Ct(this,e,t)}};let Dn=Mn;jn=new WeakMap,Sn=new WeakMap;const qn=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zt;In(this,An,void 0),In(this,kn,void 0),this.listen=Jt,this.config(t),Pn(this,kn,e),this.assets=new It(this,Rn(this,kn)),this.datasets=new on(this,Rn(this,kn)),this.projects=new gn(this,Rn(this,kn)),this.users=new _n(this,Rn(this,kn)),this.observable=new Dn(e,t)}clone(){return new qn(Rn(this,kn),this.config())}config(e){if(void 0===e)return{...Rn(this,An)};if(Rn(this,An)&&!1===Rn(this,An).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),Pn(this,An,Lt(e,Rn(this,An)||{})),this}withConfig(e){return new qn(Rn(this,kn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ge(lt(this,Rn(this,kn),e,t,n))}getDocument(e,t){return ge(ht(this,Rn(this,kn),e,t))}getDocuments(e,t){return ge(dt(this,Rn(this,kn),e,t))}create(e,t){return ge(vt(this,Rn(this,kn),e,"create",t))}createIfNotExists(e,t){return ge(ft(this,Rn(this,kn),e,t))}createOrReplace(e,t){return ge(pt(this,Rn(this,kn),e,t))}delete(e,t){return ge(yt(this,Rn(this,kn),e,t))}mutate(e,t){return ge(gt(this,Rn(this,kn),e,t))}patch(e,t){return new Je(e,t,this)}transaction(e){return new rt(e,this)}request(e){return ge(bt(this,Rn(this,kn),e))}dataRequest(e,t,n){return ge(mt(this,Rn(this,kn),e,t,n))}getUrl(e,t){return Et(this,e,t)}getDataUrl(e,t){return Ct(this,e,t)}};let Nn=qn;An=new WeakMap,kn=new WeakMap;const Hn=function(e){const t=function(){return d(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:x)}([...e,Oe,I(),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"))}},xe,q({implementation:le})]);function n(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:t)({maxRedirects:0,...e})}return n.defaultRequester=t,n}([]),Wn=Hn.defaultRequester;var zn={};
|
|
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,i=n.XMLHttpRequest,s=n.XDomainRequest,a=n.ActiveXObject,c=n.EventSource,u=n.document,l=n.Promise,h=n.fetch,d=n.Response,f=n.TextDecoder,p=n.TextEncoder,y=n.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==i&&null!=a&&(i=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 m(){this.bitsNeeded=0,this.codePoint=0}m.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="",i=this.bitsNeeded,s=this.codePoint,a=0;a<e.length;a+=1){var c=e[a];0!==i&&(c<128||c>191||!t(s<<6|63&c,i-6,n(i,s)))&&(i=0,s=r,o+=String.fromCharCode(s)),0===i?(c>=0&&c<=127?(i=0,s=c):c>=192&&c<=223?(i=6,s=31&c):c>=224&&c<=239?(i=12,s=15&c):c>=240&&c<=247?(i=18,s=7&c):(i=0,s=r),0===i||t(s,i,n(i,s))||(i=0,s=r)):(i-=6,s=s<<6|63&c),0===i&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,o};null!=f&&null!=p&&function(){try{return"test"===(new f).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(f=m);var v=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function b(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),i=o.shift(),s=o.join(": ");t[b(i)]=s}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 j(e){this.type=e,this.target=void 0}function S(e,t){j.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){j.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){j.call(this,e),this.error=t.error}w.prototype.open=function(e,t){this._abort(!0);var n=this,s=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,s.onload=v,s.onerror=v,s.onabort=v,s.onprogress=v,s.onreadystatechange=v,s.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 s)e=200,t="OK",r=s.contentType;else try{e=s.status,t=s.statusText,r=s.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=s.responseText}catch(e){}n.readyState=3,n.responseText=e,n.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),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===s.readyState&&l()};"onload"in s&&(s.onload=function(e){h("load",e)}),"onerror"in s&&(s.onerror=function(e){h("error",e)}),"onabort"in s&&(s.onabort=function(e){h("abort",e)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(e){!function(e){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||h(""===s.responseText?"error":"load",e):3===s.readyState?"onprogress"in s||l():2===s.readyState&&u())}(e)}),!("contentType"in s)&&"ontimeout"in i.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),s.open(e,t,!0),"readyState"in s&&(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 i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.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!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,n,r,o,s,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===i.HEADERS_RECEIVED){var n=e.status,r=e.statusText,o=e.getResponseHeader("Content-Type"),s=e.getAllResponseHeaders();t(n,r,o,new C(s))}},e.withCredentials=s,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,i,s){var a=null,c=new y,u=c.signal,d=new f;return h(o,{headers:s,credentials:i?"include":"same-origin",signal:u,cache:"no-store"}).then((function(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,i=0;i<r.length;i+=1)r[i]===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=[],i=0;i<r.length;i+=1)r[i]!==t&&o.push(r[i]);0===o.length?delete n[e]:n[e]=o}},S.prototype=Object.create(j.prototype),A.prototype=Object.create(j.prototype),k.prototype=Object.create(j.prototype);var F=-1,R=0,I=1,P=2,M=-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,m=$&&null==g?void 0:new w(null!=g?new g:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),v=null!=g&&"string"!=typeof g?new g:null==m?new x:new E,b=void 0,C=0,T=F,O="",_="",j="",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 i=new A("open",{status:t,statusText:n,headers:o});e.dispatchEvent(i),L(e,e.onopen,i)}else{var s="";200!==t?(n&&(n=n.replace(/\s+/g," ")),s="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",Z();i=new A("error",{status:t,statusText:n,headers:o});e.dispatchEvent(i),L(e,e.onerror,i),console.error(s)}},Y=function(t){if(T===I){for(var n=-1,i=0;i<t.length;i+=1){(c=t.charCodeAt(i))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(n=i)}var s=(-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<s.length;a+=1){var c=s.charCodeAt(a);if(V===M&&c==="\n".charCodeAt(0))V=D;else if(V===M&&(V=D),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(V!==D){V===q&&(G=a+1);var y=s.slice(J,G-1),g=s.slice(G+(G<a&&s.charCodeAt(G)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=g):"id"===y?_=g:"event"===y?j=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=_,""===j&&(j="message");var m=new S(j,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(m),"open"===j?L(e,e.onopen,m):"message"===j?L(e,e.onmessage,m):"error"===j&&L(e,e.onerror,m),T===P)return}O="",j=""}V=c==="\r".charCodeAt(0)?M: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=P,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),e.readyState=P},Q=function(){if(C=0,T===F){f=!1,p=0,C=r((function(){Q()}),l),T=R,O="",j="",_=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 i=e.withCredentials,s={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u]);try{b=v.open(m,X,Y,K,n,i,s)}catch(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=P,B.prototype.close=function(){this._close()},B.CONNECTING=R,B.OPEN=I,B.CLOSED=P,B.prototype.withCredentials=void 0;var V,J=c;null==i||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:a:globalThis)}({get exports(){return zn},set exports(e){zn=e}},zn);var Un=zn.EventSourcePolyfill,Ln=t({__proto__:null,default:Un},[Un]);e.BasePatch=Le,e.BaseTransaction=tt,e.ClientError=we,e.ObservablePatch=$e,e.ObservableSanityClient=Dn,e.ObservableTransaction=it,e.Patch=Je,e.SanityClient=Nn,e.ServerError=be,e.Transaction=rt,e.createClient=e=>new Nn(Hn,e),e.default=function(e){return Wt(),new Nn(Hn,e)},e.requester=Wn,e.unstable__adapter=E,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
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 m(){this.bitsNeeded=0,this.codePoint=0}m.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=m);var v=function(){};function w(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function b(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),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 j(e){this.type=e,this.target=void 0}function S(e,t){j.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){j.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){j.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=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,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:v}),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}},S.prototype=Object.create(j.prototype),A.prototype=Object.create(j.prototype),k.prototype=Object.create(j.prototype);var F=-1,R=0,I=1,P=2,M=-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,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="",_="",j="",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===M&&c==="\n".charCodeAt(0))V=D;else if(V===M&&(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?j=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=_,""===j&&(j="message");var m=new S(j,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(m),"open"===j?L(e,e.onopen,m):"message"===j?L(e,e.onmessage,m):"error"===j&&L(e,e.onerror,m),T===P)return}O="",j=""}V=c==="\r".charCodeAt(0)?M: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=P,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),e.readyState=P},Q=function(){if(C=0,T===F){f=!1,p=0,C=r((function(){Q()}),l),T=R,O="",j="",_=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=v.open(m,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=P,B.prototype.close=function(){this._close()},B.CONNECTING=R,B.OPEN=I,B.CLOSED=P,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:a:globalThis)}({get exports(){return zn},set exports(e){zn=e}},zn);var Un=zn.EventSourcePolyfill,Ln=t({__proto__:null,default:Un},[Un]);e.BasePatch=Le,e.BaseTransaction=tt,e.ClientError=we,e.ObservablePatch=$e,e.ObservableSanityClient=Dn,e.ObservableTransaction=st,e.Patch=Je,e.SanityClient=Nn,e.ServerError=be,e.Transaction=rt,e.createClient=e=>new Nn(Hn,e),e.default=function(e){return Wt(),new Nn(Hn,e)},e.requester=Wn,e.unstable__adapter=E,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|