@sanity/client 5.0.0-esm.2 → 5.0.0-esm.4

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.
@@ -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";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r=Object.prototype.hasOwnProperty;function o(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function s(e){try{return encodeURIComponent(e)}catch(e){return null}}n.stringify=function(e,t){t=t||"";var n,o,i=[];for(o in"string"!=typeof t&&(t="?"),e)if(r.call(e,o)){if((n=e[o])||null!=n&&!isNaN(n)||(n=""),o=s(o),n=s(n),null===o||null===n)continue;i.push(o+"="+n)}return i.length?t+i.join("&"):""},n.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var s=o(t[1]),i=o(t[2]);null===s||null===i||s in r||(r[s]=i)}return r};var i=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e},a=n,c=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,u=/[\n\r\t]/g,l=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,h=/:\d+$/,d=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,p=/^[a-zA-Z]:/;function f(e){return(e||"").toString().replace(c,"")}var y=[["#","hash"],["?","query"],function(e,t){return v(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],m={hash:1,query:1};function g(e){var n,r=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(e=e||r);if("blob:"===e.protocol)o=new b(unescape(e.pathname),{});else if("string"===s)for(n in o=new b(e,{}),m)delete o[n];else if("object"===s){for(n in e)n in m||(o[n]=e[n]);void 0===o.slashes&&(o.slashes=l.test(e.href))}return o}function v(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function w(e,t){e=(e=f(e)).replace(u,""),t=t||{};var n,r=d.exec(e),o=r[1]?r[1].toLowerCase():"",s=!!r[2],i=!!r[3],a=0;return s?i?(n=r[2]+r[3]+r[4],a=r[2].length+r[3].length):(n=r[2]+r[4],a=r[2].length):i?(n=r[3]+r[4],a=r[3].length):n=r[4],"file:"===o?a>=2&&(n=n.slice(2)):v(o)?n=r[4]:o?s&&(n=n.slice(2)):a>=2&&v(t.protocol)&&(n=r[4]),{protocol:o,slashes:s||v(o),slashesCount:a,rest:n}}function b(e,t,n){if(e=(e=f(e)).replace(u,""),!(this instanceof b))return new b(e,t,n);var r,o,s,c,l,h,d=y.slice(),m=typeof t,C=this,E=0;for("object"!==m&&"string"!==m&&(n=t,t=null),n&&"function"!=typeof n&&(n=a.parse),r=!(o=w(e||"",t=g(t))).protocol&&!o.slashes,C.slashes=o.slashes||r&&t.slashes,C.protocol=o.protocol||t.protocol||"",e=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||p.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!v(C.protocol)))&&(d[3]=[/(.*)/,"pathname"]);E<d.length;E++)"function"!=typeof(c=d[E])?(s=c[0],h=c[1],s!=s?C[h]=e:"string"==typeof s?~(l="@"===s?e.lastIndexOf(s):e.indexOf(s))&&("number"==typeof c[2]?(C[h]=e.slice(0,l),e=e.slice(l+c[2])):(C[h]=e.slice(l),e=e.slice(0,l))):(l=s.exec(e))&&(C[h]=l[1],e=e.slice(0,l.index)),C[h]=C[h]||r&&c[3]&&t[h]||"",c[4]&&(C[h]=C[h].toLowerCase())):e=c(e,C);n&&(C.query=n(C.query)),r&&t.slashes&&"/"!==C.pathname.charAt(0)&&(""!==C.pathname||""!==t.pathname)&&(C.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,o=n[r-1],s=!1,i=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),i++):i&&(0===r&&(s=!0),n.splice(r,1),i--);return s&&n.unshift(""),"."!==o&&".."!==o||n.push(""),n.join("/")}(C.pathname,t.pathname)),"/"!==C.pathname.charAt(0)&&v(C.protocol)&&(C.pathname="/"+C.pathname),i(C.port,C.protocol)||(C.host=C.hostname,C.port=""),C.username=C.password="",C.auth&&(~(l=C.auth.indexOf(":"))?(C.username=C.auth.slice(0,l),C.username=encodeURIComponent(decodeURIComponent(C.username)),C.password=C.auth.slice(l+1),C.password=encodeURIComponent(decodeURIComponent(C.password))):C.username=encodeURIComponent(decodeURIComponent(C.auth)),C.auth=C.password?C.username+":"+C.password:C.username),C.origin="file:"!==C.protocol&&v(C.protocol)&&C.host?C.protocol+"//"+C.host:"null",C.href=C.toString()}b.prototype={set:function(e,t,n){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||a.parse)(t)),r[e]=t;break;case"port":r[e]=t,i(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,h.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!n;break;case"pathname":case"hash":if(t){var o="pathname"===e?"/":"#";r[e]=t.charAt(0)!==o?o+t:t}else r[e]=t;break;case"username":case"password":r[e]=encodeURIComponent(t);break;case"auth":var s=t.indexOf(":");~s?(r.username=t.slice(0,s),r.username=encodeURIComponent(decodeURIComponent(r.username)),r.password=t.slice(s+1),r.password=encodeURIComponent(decodeURIComponent(r.password))):r.username=encodeURIComponent(decodeURIComponent(t))}for(var c=0;c<y.length;c++){var u=y[c];u[4]&&(r[u[1]]=r[u[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin="file:"!==r.protocol&&v(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=a.stringify);var t,n=this,r=n.host,o=n.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var s=o+(n.protocol&&n.slashes||v(n.protocol)?"//":"");return n.username?(s+=n.username,n.password&&(s+=":"+n.password),s+="@"):n.password?(s+=":"+n.password,s+="@"):"file:"!==n.protocol&&v(n.protocol)&&!r&&"/"!==n.pathname&&(s+="@"),(":"===r[r.length-1]||h.test(n.hostname)&&!n.port)&&(r+=":"),s+=r+n.pathname,(t="object"==typeof n.query?e(n.query):n.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),n.hash&&(s+=n.hash),s}},b.extractProtocol=w,b.location=g,b.trimLeft=f,b.qs=a;var C=b;const E="undefined"!=typeof navigator&&"ReactNative"===navigator.product,x=Object.prototype.hasOwnProperty,T={timeout:E?6e4:12e4};function O(e){const t="string"==typeof e?Object.assign({url:e},T):Object.assign({},T,e),n=C(t.url,{},!0);return t.timeout=j(t.timeout),t.query&&Object.assign(n.query,function(e){const t={};for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}(t.query)),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=n.toString(_),t}function _(e){const t=[];for(const t in e)x.call(e,t)&&n(t,e[t]);return t.length?t.join("&"):"";function n(e,r){Array.isArray(r)?r.forEach((t=>n(e,t))):t.push([e,r].map(encodeURIComponent).join("="))}}function j(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const t=Number(e);return isNaN(t)?j(T.timeout):{connect:t,socket:t}}const S=/^https?:\/\//i;function R(e){if(!S.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))}var A=function(e){return e.replace(/^\s+|\s+$/g,"")},k=function(e){if(!e)return{};for(var t,n={},r=A(e).split("\n"),o=0;o<r.length;o++){var s=r[o],i=s.indexOf(":"),a=A(s.slice(0,i)).toLowerCase(),c=A(s.slice(i+1));void 0===n[a]?n[a]=c:(t=n[a],"[object Array]"===Object.prototype.toString.call(t)?n[a].push(c):n[a]=[n[a],c])}return n},I=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/,F={regex:I,parse:function(e){var t=I.exec(e);return t?{protocol:(t[1]||"").toLowerCase()||void 0,hostname:(t[5]||"").toLowerCase()||void 0,port:t[6]||void 0}:{}}},q=F;const P=["request","response","progress","error","abort"],D=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function N(e,t){const n=[],r=D.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[O],validateOptions:[R]});function o(e){const n=P.reduce(((e,t)=>{var n,r;return e[t]=(n=Object.create(null),r=0,{publish:function(e){for(var t in n)n[t](e)},subscribe:function(e){var t=r++;return n[t]=e,function(){delete n[t]}}}),e}),{}),o=(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})(r),s=o("processOptions",e);o("validateOptions",s);const i={options:s,channels:n,applyMiddleware:o};let a=null;const c=n.request.subscribe((e=>{a=t(e,((t,r)=>function(e,t,r){let s=e,i=t;if(!s)try{i=o("onResponse",t,r)}catch(e){i=null,s=e}s=s&&o("onError",s,r),s?n.error.publish(s):i&&n.response.publish(i)}(t,r,e)))}));n.abort.subscribe((()=>{c(),a&&a.abort()}));const u=o("onReturn",n,i);return u===n&&n.request.publish(i),u}return o.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&&r.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 D.forEach((t=>{e[t]&&r[t].push(e[t])})),n.push(e),o},o.clone=function(){return N(n,t)},e.forEach(o.use),o}function M(){this.readyState=0}M.prototype.open=function(e,t){this._method=e,this._url=t,this._resHeaders="",this.readyState=1,this.onreadystatechange()},M.prototype.abort=function(){this._controller&&this._controller.abort()},M.prototype.getAllResponseHeaders=function(){return this._resHeaders},M.prototype.setRequestHeader=function(e,t){this._headers=this._headers||{},this._headers[e]=t},M.prototype.send=function(e){const t=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,r={method:this._method,headers:this._headers,signal:t&&t.signal||void 0,body:e};"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(this._url,r).then((e=>(e.headers.forEach(((e,t)=>{this._resHeaders+="".concat(t,": ").concat(e,"\r\n")})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,n?e.text():e.arrayBuffer()))).then((e=>{n?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{"AbortError"!==e.name?this.onerror(e):this.onabort()}))};const U="undefined"==typeof document||"undefined"==typeof window?void 0:window,H=U?"xhr":"fetch";let z="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){};const L="withCredentials"in new z,W="undefined"==typeof XDomainRequest?void 0:XDomainRequest;let $=L?z:W;U||(z=M,$=M);var B=(e,t)=>{const n=e.options,r=e.applyMiddleware("finalizeOptions",n),o={},s=U&&U.location&&!function(e,t,n){if(e===t)return!0;var r=q.parse(e,!1,!0),o=q.parse(t,!1,!0),s=0|r.port||("https"===r.protocol?443:80),i=0|o.port||("https"===o.protocol?443:80),a={proto:r.protocol===o.protocol,hostname:r.hostname===o.hostname,port:s===i};return a.proto&&a.hostname&&(a.port||n)}(U.location.href,r.url),i=e.applyMiddleware("interceptRequest",void 0,{adapter:H,context:e});if(i){const e=setTimeout(t,0,null,i);return{abort:()=>clearTimeout(e)}}let a=s?new $:new z;const c=U&&U.XDomainRequest&&a instanceof U.XDomainRequest,u=r.headers,l=r.timeout;let h=!1,d=!1,p=!1;a.onerror=m,a.ontimeout=m,a.onabort=()=>{y(!0),h=!0},a.onprogress=()=>{};if(a[c?"onload":"onreadystatechange"]=()=>{!function(){if(!l)return;y(),o.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),l.socket)}(),h||4!==a.readyState&&!c||0!==a.status&&function(){if(h||d||p)return;if(0===a.status)return void m(new Error("Unknown XHR error"));y(),d=!0,t(null,function(){let e=a.status,t=a.statusText;if(c&&void 0===e)e=200;else{if(e>12e3&&e<12156)return m();e=1223===a.status?204:a.status,t=1223===a.status?"No Content":t}return{body:a.response||a.responseText,url:r.url,method:r.method,headers:c?{}:k(a.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())}()},a.open(r.method,r.url,!0),a.withCredentials=!!r.withCredentials,u&&a.setRequestHeader)for(const e in u)u.hasOwnProperty(e)&&a.setRequestHeader(e,u[e]);else if(u&&c)throw new Error("Headers cannot be set on an XDomainRequest object");return r.rawBody&&(a.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:r,adapter:H,request:a,context:e}),a.send(r.body||null),l&&(o.connect=setTimeout((()=>f("ETIMEDOUT")),l.connect)),{abort:function(){h=!0,a&&a.abort()}};function f(t){p=!0,a.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 y(e){(e||h||a.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function m(e){if(d)return;y(!0),d=!0,a=null;const n=e||new Error("Network error while attempting to reach ".concat(r.url));n.isNetworkError=!0,n.request=r,t(n)}};var V,X,J={};function G(){if(X)return V;X=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 V=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 Y=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=G(),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};!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=Y(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);var Z=Error.captureStackTrace||function(e){var t=new Error;Object.defineProperty(e,"stack",{configurable:!0,get:function(){var e=t.stack;return Object.defineProperty(this,"stack",{value:e}),e}})};
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).SanityClient={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={},n=Object.prototype.hasOwnProperty;function o(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}function s(t){try{return encodeURIComponent(t)}catch(t){return null}}r.stringify=function(t,e){e=e||"";var r,o,i=[];for(o in"string"!=typeof e&&(e="?"),t)if(n.call(t,o)){if((r=t[o])||null!=r&&!isNaN(r)||(r=""),o=s(o),r=s(r),null===o||null===r)continue;i.push(o+"="+r)}return i.length?e+i.join("&"):""},r.parse=function(t){for(var e,r=/([^=?#&]+)=?([^&]*)/g,n={};e=r.exec(t);){var s=o(e[1]),i=o(e[2]);null===s||null===i||s in n||(n[s]=i)}return n};var i=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t},a=r,c=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,u=/[\n\r\t]/g,l=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,h=/:\d+$/,d=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,p=/^[a-zA-Z]:/;function f(t){return(t||"").toString().replace(c,"")}var y=[["#","hash"],["?","query"],function(t,e){return v(e.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],m={hash:1,query:1};function g(t){var r,n=("undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(t=t||n);if("blob:"===t.protocol)o=new b(unescape(t.pathname),{});else if("string"===s)for(r in o=new b(t,{}),m)delete o[r];else if("object"===s){for(r in t)r in m||(o[r]=t[r]);void 0===o.slashes&&(o.slashes=l.test(t.href))}return o}function v(t){return"file:"===t||"ftp:"===t||"http:"===t||"https:"===t||"ws:"===t||"wss:"===t}function w(t,e){t=(t=f(t)).replace(u,""),e=e||{};var r,n=d.exec(t),o=n[1]?n[1].toLowerCase():"",s=!!n[2],i=!!n[3],a=0;return s?i?(r=n[2]+n[3]+n[4],a=n[2].length+n[3].length):(r=n[2]+n[4],a=n[2].length):i?(r=n[3]+n[4],a=n[3].length):r=n[4],"file:"===o?a>=2&&(r=r.slice(2)):v(o)?r=n[4]:o?s&&(r=r.slice(2)):a>=2&&v(e.protocol)&&(r=n[4]),{protocol:o,slashes:s||v(o),slashesCount:a,rest:r}}function b(t,e,r){if(t=(t=f(t)).replace(u,""),!(this instanceof b))return new b(t,e,r);var n,o,s,c,l,h,d=y.slice(),m=typeof e,C=this,E=0;for("object"!==m&&"string"!==m&&(r=e,e=null),r&&"function"!=typeof r&&(r=a.parse),n=!(o=w(t||"",e=g(e))).protocol&&!o.slashes,C.slashes=o.slashes||n&&e.slashes,C.protocol=o.protocol||e.protocol||"",t=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||p.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!v(C.protocol)))&&(d[3]=[/(.*)/,"pathname"]);E<d.length;E++)"function"!=typeof(c=d[E])?(s=c[0],h=c[1],s!=s?C[h]=t:"string"==typeof s?~(l="@"===s?t.lastIndexOf(s):t.indexOf(s))&&("number"==typeof c[2]?(C[h]=t.slice(0,l),t=t.slice(l+c[2])):(C[h]=t.slice(l),t=t.slice(0,l))):(l=s.exec(t))&&(C[h]=l[1],t=t.slice(0,l.index)),C[h]=C[h]||n&&c[3]&&e[h]||"",c[4]&&(C[h]=C[h].toLowerCase())):t=c(t,C);r&&(C.query=r(C.query)),n&&e.slashes&&"/"!==C.pathname.charAt(0)&&(""!==C.pathname||""!==e.pathname)&&(C.pathname=function(t,e){if(""===t)return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],s=!1,i=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),i++):i&&(0===n&&(s=!0),r.splice(n,1),i--);return s&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(C.pathname,e.pathname)),"/"!==C.pathname.charAt(0)&&v(C.protocol)&&(C.pathname="/"+C.pathname),i(C.port,C.protocol)||(C.host=C.hostname,C.port=""),C.username=C.password="",C.auth&&(~(l=C.auth.indexOf(":"))?(C.username=C.auth.slice(0,l),C.username=encodeURIComponent(decodeURIComponent(C.username)),C.password=C.auth.slice(l+1),C.password=encodeURIComponent(decodeURIComponent(C.password))):C.username=encodeURIComponent(decodeURIComponent(C.auth)),C.auth=C.password?C.username+":"+C.password:C.username),C.origin="file:"!==C.protocol&&v(C.protocol)&&C.host?C.protocol+"//"+C.host:"null",C.href=C.toString()}b.prototype={set:function(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||a.parse)(e)),n[t]=e;break;case"port":n[t]=e,i(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,h.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(e){var o="pathname"===t?"/":"#";n[t]=e.charAt(0)!==o?o+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var s=e.indexOf(":");~s?(n.username=e.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var c=0;c<y.length;c++){var u=y[c];u[4]&&(n[u[1]]=n[u[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&v(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(t){t&&"function"==typeof t||(t=a.stringify);var e,r=this,n=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var s=o+(r.protocol&&r.slashes||v(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):"file:"!==r.protocol&&v(r.protocol)&&!n&&"/"!==r.pathname&&(s+="@"),(":"===n[n.length-1]||h.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,(e="object"==typeof r.query?t(r.query):r.query)&&(s+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(s+=r.hash),s}},b.extractProtocol=w,b.location=g,b.trimLeft=f,b.qs=a;var C=b;const E="undefined"!=typeof navigator&&"ReactNative"===navigator.product,x=Object.prototype.hasOwnProperty,T={timeout:E?6e4:12e4};function O(t){const e="string"==typeof t?Object.assign({url:t},T):Object.assign({},T,t),r=C(e.url,{},!0);return e.timeout=S(e.timeout),e.query&&Object.assign(r.query,function(t){const e={};for(const r in t)void 0!==t[r]&&(e[r]=t[r]);return e}(e.query)),e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e.url=r.toString(j),e}function j(t){const e=[];for(const e in t)x.call(t,e)&&r(e,t[e]);return e.length?e.join("&"):"";function r(t,n){Array.isArray(n)?n.forEach((e=>r(t,e))):e.push([t,n].map(encodeURIComponent).join("="))}}function S(t){if(!1===t||0===t)return!1;if(t.connect||t.socket)return t;const e=Number(t);return isNaN(e)?S(T.timeout):{connect:e,socket:e}}const _=/^https?:\/\//i;function k(t){if(!_.test(t.url))throw new Error('"'.concat(t.url,'" is not a valid URL'))}var A=function(t){return t.replace(/^\s+|\s+$/g,"")},R=function(t){if(!t)return{};for(var e,r={},n=A(t).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),a=A(s.slice(0,i)).toLowerCase(),c=A(s.slice(i+1));void 0===r[a]?r[a]=c:(e=r[a],"[object Array]"===Object.prototype.toString.call(e)?r[a].push(c):r[a]=[r[a],c])}return r};const I=["request","response","progress","error","abort"],F=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function P(t,e){const r=[],n=F.reduce(((t,e)=>(t[e]=t[e]||[],t)),{processOptions:[O],validateOptions:[k]});function o(t){const r=I.reduce(((t,e)=>(t[e]=function(){const t=Object.create(null);let e=0;return{publish:function(e){for(const r in t)t[r](e)},subscribe:function(r){const n=e++;return t[n]=r,function(){delete t[n]}}}}(),t)),{}),o=(t=>function(e,r){const n="onError"===e;let o=r;for(var s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(let r=0;r<t[e].length&&(o=(0,t[e][r])(o,...i),!n||o);r++);return o})(n),s=o("processOptions",t);o("validateOptions",s);const i={options:s,channels:r,applyMiddleware:o};let a=null;const c=r.request.subscribe((t=>{a=e(t,((e,n)=>function(t,e,n){let s=t,i=e;if(!s)try{i=o("onResponse",e,n)}catch(t){i=null,s=t}s=s&&o("onError",s,n),s?r.error.publish(s):i&&r.response.publish(i)}(e,n,t)))}));r.abort.subscribe((()=>{c(),a&&a.abort()}));const u=o("onReturn",r,i);return u===r&&r.request.publish(i),u}return o.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.onReturn&&n.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 F.forEach((e=>{t[e]&&n[e].push(t[e])})),r.push(t),o},o.clone=function(){return P(r,e)},t.forEach(o.use),o}var q,M,D,N,U,W=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},z=(t,e,r)=>(W(t,e,"read from private field"),r?r.call(t):e.get(t)),H=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},L=(t,e,r,n)=>(W(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);q=new WeakMap,M=new WeakMap,D=new WeakMap,N=new WeakMap,U=new WeakMap;const B="function"==typeof XMLHttpRequest?"xhr":"fetch",$="xhr"===B?XMLHttpRequest:class{constructor(){this.readyState=0,H(this,q,void 0),H(this,M,void 0),H(this,D,void 0),H(this,N,{}),H(this,U,void 0)}open(t,e,r){L(this,q,t),L(this,M,e),L(this,D,""),this.readyState=1,this.onreadystatechange(),L(this,U,void 0)}abort(){z(this,U)&&z(this,U).abort()}getAllResponseHeaders(){return z(this,D)}setRequestHeader(t,e){z(this,N)[t]=e}send(t){const e="arraybuffer"!==this.responseType,r={method:z(this,q),headers:z(this,N),signal:null,body:t};"function"==typeof AbortController&&(L(this,U,new AbortController),r.signal=z(this,U).signal),"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(z(this,M),r).then((t=>(t.headers.forEach(((t,e)=>{L(this,D,z(this,D)+"".concat(e,": ").concat(t,"\r\n"))})),this.status=t.status,this.statusText=t.statusText,this.readyState=3,e?t.text():t.arrayBuffer()))).then((t=>{"string"==typeof t?this.responseText=t:this.response=t,this.readyState=4,this.onreadystatechange()})).catch((t=>{var e;"AbortError"!==t.name?null==(e=this.onerror)||e.call(this,t):this.onabort()}))}};var V=(t,e)=>{const r=t.options,n=t.applyMiddleware("finalizeOptions",r),o={},s=t.applyMiddleware("interceptRequest",void 0,{adapter:B,context:t});if(s){const t=setTimeout(e,0,null,s);return{abort:()=>clearTimeout(t)}}let i=new $;const a=n.headers,c=n.timeout;let u=!1,l=!1,h=!1;if(i.onerror=f,i.ontimeout=f,i.onabort=()=>{p(!0),u=!0},i.onreadystatechange=()=>{!function(){if(!c)return;p(),o.socket=setTimeout((()=>d("ESOCKETTIMEDOUT")),c.socket)}(),u||4!==i.readyState||0!==i.status&&function(){if(u||l||h)return;if(0===i.status)return void f(new Error("Unknown XHR error"));p(),l=!0,e(null,{body:i.response||i.responseText,url:n.url,method:n.method,headers:R(i.getAllResponseHeaders()),statusCode:i.status,statusMessage:i.statusText})}()},i.open(n.method,n.url,!0),i.withCredentials=!!n.withCredentials,a&&i.setRequestHeader)for(const t in a)a.hasOwnProperty(t)&&i.setRequestHeader(t,a[t]);return n.rawBody&&(i.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:n,adapter:B,request:i,context:t}),i.send(n.body||null),c&&(o.connect=setTimeout((()=>d("ETIMEDOUT")),c.connect)),{abort:function(){u=!0,i&&i.abort()}};function d(e){h=!0,i.abort();const r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to ".concat(n.url):"Connection timed out on request to ".concat(n.url));r.code=e,t.channels.error.publish(r)}function p(t){(t||u||i.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function f(t){if(l)return;p(!0),l=!0,i=null;const r=t||new Error("Network error while attempting to reach ".concat(n.url));r.isNetworkError=!0,r.request=n,e(r)}};var J,G,X={};function Y(){if(G)return J;G=1;var t=1e3,e=60*t,r=60*e,n=24*r,o=7*n,s=365.25*n;function i(t,e,r,n){var o=e>=1.5*r;return Math.round(t/r)+" "+n+(o?"s":"")}return J=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(i){if((i=String(i)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*e;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var s=Math.abs(o);if(s>=n)return i(o,s,n,"day");if(s>=r)return i(o,s,r,"hour");if(s>=e)return i(o,s,e,"minute");if(s>=t)return i(o,s,t,"second");return o+" ms"}(a):function(o){var s=Math.abs(o);if(s>=n)return Math.round(o/n)+"d";if(s>=r)return Math.round(o/r)+"h";if(s>=e)return Math.round(o/e)+"m";if(s>=t)return Math.round(o/t)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var Z=function(t){function e(t){let n,o,s,i=null;function a(...t){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let i=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=e.formatters[o];if("function"==typeof s){const e=t[i];n=s.call(r,e),t.splice(i,1),i--}return n})),e.formatArgs.call(r,t);(r.log||e.log).apply(r,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=r,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==e.namespaces&&(o=e.namespaces,s=e.enabled(t)),s),set:t=>{i=t}}),"function"==typeof e.init&&e.init(a),a}function r(t,r){const n=e(this.namespace+(void 0===r?":":r)+t);return n.log=this.log,n}function n(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},e.disable=function(){const t=[...e.names.map(n),...e.skips.map(n).map((t=>"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){let r;e.save(t),e.namespaces=t,e.names=[],e.skips=[];const n=("string"==typeof t?t:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(t=n[r].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.slice(1)+"$")):e.names.push(new RegExp("^"+t+"$")))},e.enabled=function(t){if("*"===t[t.length-1])return!0;let r,n;for(r=0,n=e.skips.length;r<n;r++)if(e.skips[r].test(t))return!1;for(r=0,n=e.names.length;r<n;r++)if(e.names[r].test(t))return!0;return!1},e.humanize=Y(),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((r=>{e[r]=t[r]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let r=0;for(let e=0;e<t.length;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return e.colors[Math.abs(r)%e.colors.length]},e.enable(e.load()),e};!function(t,e){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(n++,"%c"===t&&(o=n))})),e.splice(o,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=Z(e);const{formatters:r}=t.exports;r.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}({get exports(){return X},set exports(t){X=t}},X);var K=Error.captureStackTrace||function(t){var e=new Error;Object.defineProperty(t,"stack",{configurable:!0,get:function(){var t=e.stack;return Object.defineProperty(this,"stack",{value:t}),t}})};
2
2
  /*!
3
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
4
- *
5
- * Copyright (c) 2014-2017, Jon Schlinkert.
6
- * Released under the MIT License.
7
- */
8
- function K(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){if("string"!=typeof e)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(e))throw new Error("className contains invalid characters");t=t||function(e){this.message=e};var n,r,o=function(){Object.defineProperty(this,"name",{configurable:!0,value:e,writable:!0}),Z(this,this.constructor),t.apply(this,arguments)};n=o,r=Error,n.super_=r,n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}})}("HttpError",(function(e,t){const n=e.url.length>400?"".concat(e.url.slice(0,399),"…"):e.url;let r="".concat(e.method,"-request to ").concat(n," resulted in ");r+="HTTP ".concat(e.statusCode," ").concat(e.statusMessage),this.message=r.trim(),this.response=e,this.request=t.options}));const Q=["boolean","string","number"];function ee(){return{processOptions:e=>{const t=e.body;if(!t)return e;var n,r,o,s;return!("function"==typeof t.pipe)&&!((s=t).constructor&&"function"==typeof s.constructor.isBuffer&&s.constructor.isBuffer(s))&&(-1!==Q.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 te(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 ne;ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var re=ne;function oe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e.implementation||re.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,n)=>new t((t=>(e.error.subscribe((e=>t.error(e))),e.progress.subscribe((e=>t.next(Object.assign({type:"progress"},e)))),e.response.subscribe((e=>{t.next(Object.assign({type:"response"},e)),t.complete()})),e.request.publish(n),()=>e.abort.publish())))}}class se{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const ie=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 se(e),t(this.reason))}))}};ie.source=()=>{let e;return{token:new ie((t=>{e=t})),cancel:e}};var ae=function(e,t){return ae=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])},ae(e,t)};function ce(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}ae(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function ue(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 le(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 he(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 de(e){return"function"==typeof e}function pe(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 fe=pe((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 ye(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var me=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=ue(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(de(c))try{c()}catch(e){o=e instanceof fe?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=ue(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{ve(d)}catch(e){o=null!=o?o:[],e instanceof fe?o=he(he([],le(o)),le(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 fe(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)ve(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)&&ye(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&ye(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ge(e){return e instanceof me||e&&"closed"in e&&de(e.remove)&&de(e.add)&&de(e.unsubscribe)}function ve(e){de(e)?e():e.unsubscribe()}me.EMPTY;var we={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},be={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=be.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,he([e,t],le(n))):setTimeout.apply(void 0,he([e,t],le(n)))},clearTimeout:function(e){var t=be.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Ce(){}var Ee=null;var xe=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,ge(t)&&t.add(n)):n.destination=Re,n}return ce(t,e),t.create=function(e,t,n){return new je(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}(me),Te=Function.prototype.bind;function Oe(e,t){return Te.call(e,t)}var _e=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}(),je=function(e){function t(t,n,r){var o,s,i=e.call(this)||this;de(t)||!t?o={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:i&&we.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&Oe(t.next,s),error:t.error&&Oe(t.error,s),complete:t.complete&&Oe(t.complete,s)}):o=t;return i.destination=new _e(o),i}return ce(t,e),t}(xe);function Se(e){var t;t=e,be.setTimeout((function(){throw t}))}var Re={closed:!0,next:Ce,error:function(e){throw e},complete:Ce},Ae="function"==typeof Symbol&&Symbol.observable||"@@observable";function ke(e){return e}function Ie(e){return 0===e.length?ke:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Fe=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 xe||function(e){return e&&de(e.next)&&de(e.error)&&de(e.complete)}(r)&&ge(r)?e:new je(e,t,n);return function(e){if(we.useDeprecatedSynchronousErrorHandling){var t=!Ee;if(t&&(Ee={errorThrown:!1,error:null}),e(),t){var n=Ee,r=n.errorThrown,o=n.error;if(Ee=null,r)throw o}}else e()}((function(){var e=o,t=e.operator,n=e.source;s.add(t?t.call(s,n):n?o._subscribe(s):o._trySubscribe(s))})),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=qe(t))((function(t,r){var o=new je({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[Ae]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ie(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=qe(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 qe(e){var t;return null!==(t=null!=e?e:we.Promise)&&void 0!==t?t:Promise}function Pe(e){return function(t){if(function(e){return de(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 De(e,t,n,r,o){return new Ne(e,t,n,r,o)}var Ne=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 ce(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}(xe),Me=pe((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ue(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 Me)}})}))}function He(e,t){return Pe((function(n,r){var o=0;n.subscribe(De(r,(function(n){r.next(e.call(t,n,o++))})))}))}function ze(e,t){return Pe((function(n,r){var o=0;n.subscribe(De(r,(function(n){return e.call(t,n,o++)&&r.next(n)})))}))}var Le={};!function(e,t){var n="undefined"!=typeof Reflect?Reflect.construct:void 0,r=Object.defineProperty,o=Error.captureStackTrace;function s(e){void 0!==e&&r(this,"message",{configurable:!0,value:e,writable:!0});var t=this.constructor.name;void 0!==t&&t!==this.name&&r(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor)}void 0===o&&(o=function(e){var t=new Error;r(e,"stack",{configurable:!0,get:function(){var e=t.stack;return r(this,"stack",{configurable:!0,value:e,writable:!0}),e},set:function(t){r(e,"stack",{configurable:!0,value:t,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var i=function(){function e(e,t){return r(e,"name",{configurable:!0,value:t})}try{var t=function(){};if(e(t,"foo"),"foo"===t.name)return e}catch(e){}}();t=e.exports=function(e,t){if(null==t||t===Error)t=s;else if("function"!=typeof t)throw new TypeError("super_ should be a function");var r;if("string"==typeof e)r=e,e=void 0!==n?function(){return n(t,arguments,this.constructor)}:function(){t.apply(this,arguments)},void 0!==i&&(i(e,r),r=void 0);else if("function"!=typeof e)throw new TypeError("constructor should be either a string or a function");e.super_=e.super=t;var o={constructor:{configurable:!0,value:e,writable:!0}};return void 0!==r&&(o.name={configurable:!0,value:r,writable:!0}),e.prototype=Object.create(t.prototype,o),e},t.BaseError=s}({get exports(){return Le},set exports(e){Le=e}},Le);var We={};
3
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
4
+ *
5
+ * Copyright (c) 2014-2017, Jon Schlinkert.
6
+ * Released under the MIT License.
7
+ */
8
+ function Q(t){return"[object Object]"===Object.prototype.toString.call(t)}!function(t,e){if("string"!=typeof t)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(t))throw new Error("className contains invalid characters");e=e||function(t){this.message=t};var r,n,o=function(){Object.defineProperty(this,"name",{configurable:!0,value:t,writable:!0}),K(this,this.constructor),e.apply(this,arguments)};r=o,n=Error,r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}})}("HttpError",(function(t,e){const r=t.url.length>400?"".concat(t.url.slice(0,399),"…"):t.url;let n="".concat(t.method,"-request to ").concat(r," resulted in ");n+="HTTP ".concat(t.statusCode," ").concat(t.statusMessage),this.message=n.trim(),this.response=t,this.request=e.options}));const tt=["boolean","string","number"];function et(){return{processOptions:t=>{const e=t.body;if(!e)return t;var r,n,o,s;return!("function"==typeof e.pipe)&&!((s=e).constructor&&"function"==typeof s.constructor.isBuffer&&s.constructor.isBuffer(s))&&(-1!==tt.indexOf(typeof e)||Array.isArray(e)||!1!==Q(r=e)&&(void 0===(n=r.constructor)||!1!==Q(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},t,{body:JSON.stringify(t.body),headers:Object.assign({},t.headers,{"Content-Type":"application/json"})}):t}}}function rt(t){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=t&&t.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:e(r.body)}):r},processOptions:t=>Object.assign({},t,{headers:Object.assign({Accept:"application/json"},t.headers)})};function e(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: ".concat(t.message),t}}}let nt;nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var ot=nt;function st(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=t.implementation||ot.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(t,r)=>new e((e=>(t.error.subscribe((t=>e.error(t))),t.progress.subscribe((t=>e.next(Object.assign({type:"progress"},t)))),t.response.subscribe((t=>{e.next(Object.assign({type:"response"},t)),e.complete()})),t.request.publish(r),()=>t.abort.publish())))}}class it{constructor(t){this.__CANCEL__=!0,this.message=t}toString(){return"Cancel".concat(this.message?": ".concat(this.message):"")}}const at=class{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e=null;this.promise=new Promise((t=>{e=t})),t((t=>{this.reason||(this.reason=new it(t),e(this.reason))}))}};at.source=()=>{let t;return{token:new at((e=>{t=e})),cancel:t}};var ct=function(t,e){return ct=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},ct(t,e)};function ut(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}ct(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function lt(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ht(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,s=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function dt(t,e,r){if(r||2===arguments.length)for(var n,o=0,s=e.length;o<s;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}function pt(t){return"function"==typeof t}function ft(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var yt=ft((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function mt(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var gt=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=lt(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}else s.remove(this);var c=this.initialTeardown;if(pt(c))try{c()}catch(t){o=t instanceof yt?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=lt(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{wt(d)}catch(t){o=null!=o?o:[],t instanceof yt?o=dt(dt([],ht(o)),ht(t.errors)):o.push(t)}}}catch(t){r={error:t}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new yt(o)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)wt(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&mt(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&mt(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}();function vt(t){return t instanceof gt||t&&"closed"in t&&pt(t.remove)&&pt(t.add)&&pt(t.unsubscribe)}function wt(t){pt(t)?t():t.unsubscribe()}gt.EMPTY;var bt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Ct={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Ct.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,dt([t,e],ht(r))):setTimeout.apply(void 0,dt([t,e],ht(r)))},clearTimeout:function(t){var e=Ct.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Et(){}var xt=null;var Tt=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,vt(e)&&e.add(r)):r.destination=At,r}return ut(e,t),e.create=function(t,e,r){return new _t(t,e,r)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(gt),Ot=Function.prototype.bind;function jt(t,e){return Ot.call(t,e)}var St=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){kt(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){kt(t)}else kt(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){kt(t)}},t}(),_t=function(t){function e(e,r,n){var o,s,i=t.call(this)||this;pt(e)||!e?o={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&bt.useDeprecatedNextContext?((s=Object.create(e)).unsubscribe=function(){return i.unsubscribe()},o={next:e.next&&jt(e.next,s),error:e.error&&jt(e.error,s),complete:e.complete&&jt(e.complete,s)}):o=e;return i.destination=new St(o),i}return ut(e,t),e}(Tt);function kt(t){var e;e=t,Ct.setTimeout((function(){throw e}))}var At={closed:!0,next:Et,error:function(t){throw t},complete:Et},Rt="function"==typeof Symbol&&Symbol.observable||"@@observable";function It(t){return t}function Ft(t){return 0===t.length?It:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var Pt=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n,o=this,s=(n=t)&&n instanceof Tt||function(t){return t&&pt(t.next)&&pt(t.error)&&pt(t.complete)}(n)&&vt(n)?t:new _t(t,e,r);return function(t){if(bt.useDeprecatedSynchronousErrorHandling){var e=!xt;if(e&&(xt={errorThrown:!1,error:null}),t(),e){var r=xt,n=r.errorThrown,o=r.error;if(xt=null,n)throw o}}else t()}((function(){var t=o,e=t.operator,r=t.source;s.add(e?e.call(s,r):r?o._subscribe(s):o._trySubscribe(s))})),s},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=qt(e))((function(e,n){var o=new _t({next:function(e){try{t(e)}catch(t){n(t),o.unsubscribe()}},error:n,complete:e});r.subscribe(o)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[Rt]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Ft(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=qt(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function qt(t){var e;return null!==(e=null!=t?t:bt.Promise)&&void 0!==e?e:Promise}function Mt(t){return function(e){if(function(t){return pt(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Dt(t,e,r,n,o){return new Nt(t,e,r,n,o)}var Nt=function(t){function e(e,r,n,o,s,i){var a=t.call(this,e)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=o?function(t){try{o(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return ut(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(Tt),Ut=ft((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Wt(t,e){var r="object"==typeof e;return new Promise((function(n,o){var s,i=!1;t.subscribe({next:function(t){s=t,i=!0},error:o,complete:function(){i?n(s):r?n(e.defaultValue):o(new Ut)}})}))}function zt(t,e){return Mt((function(r,n){var o=0;r.subscribe(Dt(n,(function(r){n.next(t.call(e,r,o++))})))}))}function Ht(t,e){return Mt((function(r,n){var o=0;r.subscribe(Dt(n,(function(r){return t.call(e,r,o++)&&n.next(r)})))}))}var Lt={};!function(t,e){var r="undefined"!=typeof Reflect?Reflect.construct:void 0,n=Object.defineProperty,o=Error.captureStackTrace;function s(t){void 0!==t&&n(this,"message",{configurable:!0,value:t,writable:!0});var e=this.constructor.name;void 0!==e&&e!==this.name&&n(this,"name",{configurable:!0,value:e,writable:!0}),o(this,this.constructor)}void 0===o&&(o=function(t){var e=new Error;n(t,"stack",{configurable:!0,get:function(){var t=e.stack;return n(this,"stack",{configurable:!0,value:t,writable:!0}),t},set:function(e){n(t,"stack",{configurable:!0,value:e,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var i=function(){function t(t,e){return n(t,"name",{configurable:!0,value:e})}try{var e=function(){};if(t(e,"foo"),"foo"===e.name)return t}catch(t){}}();e=t.exports=function(t,e){if(null==e||e===Error)e=s;else if("function"!=typeof e)throw new TypeError("super_ should be a function");var n;if("string"==typeof t)n=t,t=void 0!==r?function(){return r(e,arguments,this.constructor)}:function(){e.apply(this,arguments)},void 0!==i&&(i(t,n),n=void 0);else if("function"!=typeof t)throw new TypeError("constructor should be either a string or a function");t.super_=t.super=e;var o={constructor:{configurable:!0,value:t,writable:!0}};return void 0!==n&&(o.name={configurable:!0,value:n,writable:!0}),t.prototype=Object.create(e.prototype,o),t},e.BaseError=s}({get exports(){return Lt},set exports(t){Lt=t}},Lt);var Bt={};
9
9
  /** @license
10
- * eventsource.js
11
- * Available under MIT License (MIT)
12
- * https://github.com/Yaffle/EventSource/
13
- */
14
- !function(e,n){!function(t){var r=t.setTimeout,o=t.clearTimeout,s=t.XMLHttpRequest,i=t.XDomainRequest,a=t.ActiveXObject,c=t.EventSource,u=t.document,l=t.Promise,h=t.fetch,d=t.Response,p=t.TextDecoder,f=t.TextEncoder,y=t.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(e){u.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var m=h;h=function(e,t){var n=t.signal;return m(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 g(){this.bitsNeeded=0,this.codePoint=0}g.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!=p&&null!=f&&function(){try{return"test"===(new p).decode((new f).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=g);var 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 x(e){this._headers=e}function T(){}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 R(e,t){j.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function A(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},x.prototype.get=function(e){return this._headers.get(e)},T.prototype.open=function(e,t,n,r,o,s,i){var a=null,c=new y,u=c.signal,d=new p;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:u,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new x(e.headers)),new l((function(e,t){var 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),R.prototype=Object.create(j.prototype),A.prototype=Object.create(j.prototype);var k=-1,I=-1,F=/^text\/event\-stream(;.*)?$/i,q=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),P(n)},P=function(e){return Math.min(Math.max(e,1e3),18e6)},D=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){_(e)}};function N(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=P(1e3),l=q(n.heartbeatTimeout,45e3),h="",d=u,p=!1,f=0,y=n.headers||{},m=n.Transport,g=M&&null==m?void 0:new w(null!=m?new m:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=m&&"string"!=typeof m?new m:null==g?new T:new E,b=void 0,C=0,x=k,O="",_="",j="",N="",U=0,H=0,z=0,L=function(t,n,r,o){if(0===x)if(200===t&&null!=r&&F.test(r)){x=1,p=Date.now(),d=u,e.readyState=1;var s=new R("open",{status:t,statusText:n,headers:o});e.dispatchEvent(s),D(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.",B();s=new R("error",{status:t,statusText:n,headers:o});e.dispatchEvent(s),D(e,e.onerror,s),console.error(i)}},W=function(t){if(1===x){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?N:"")+t.slice(0,n+1);N=(-1===n?N:"")+t.slice(n+1),""!==t&&(p=Date.now(),f+=t.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(U===I&&c==="\n".charCodeAt(0))U=0;else if(U===I&&(U=0),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(0!==U){1===U&&(z=a+1);var y=i.slice(H,z-1),m=i.slice(z+(z<a&&i.charCodeAt(z)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=m):"id"===y?_=m:"event"===y?j=m:"retry"===y?(u=q(m,u),d=u):"heartbeatTimeout"===y&&(l=q(m,l),0!==C&&(o(C),C=r((function(){V()}),l)))}if(0===U){if(""!==O){h=_,""===j&&(j="message");var g=new S(j,{data:O.slice(1),lastEventId:_});if(e.dispatchEvent(g),"open"===j?D(e,e.onopen,g):"message"===j?D(e,e.onmessage,g):"error"===j&&D(e,e.onerror,g),2===x)return}O="",j=""}U=c==="\r".charCodeAt(0)?I:0}else 0===U&&(H=a,U=1),1===U?c===":".charCodeAt(0)&&(z=a+1,U=2):2===U&&(U=3)}}},$=function(t){if(1===x||0===x){x=k,0!==C&&(o(C),C=0),C=r((function(){V()}),d),d=P(Math.min(16*u,2*d)),e.readyState=0;var n=new A("error",{error:t});e.dispatchEvent(n),D(e,e.onerror,n),null!=t&&console.error(t)}},B=function(){x=2,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),e.readyState=2},V=function(){if(C=0,x===k){p=!1,f=0,C=r((function(){V()}),l),x=0,O="",j="",_=h,N="",H=0,z=0,U=0;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(g,L,W,$,n,s,i)}catch(e){throw B(),e}}else if(p||null==b){var d=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=r((function(){V()}),d)}else $(new Error("No activity within "+l+" milliseconds. "+(0===x?"No response received.":f+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=B,V()}(this,e,t)}var M=null!=h&&null!=d&&"body"in d.prototype;N.prototype=Object.create(O.prototype),N.prototype.CONNECTING=0,N.prototype.OPEN=1,N.prototype.CLOSED=2,N.prototype.close=function(){this._close()},N.CONNECTING=0,N.OPEN=1,N.CLOSED=2,N.prototype.withCredentials=void 0;var U,H=c;null==s||null!=c&&"withCredentials"in c.prototype||(H=N),U=function(e){e.EventSourcePolyfill=N,e.NativeEventSource=c,e.EventSource=H}(n),void 0!==U&&(e.exports=U)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:t:globalThis)}({get exports(){return We},set exports(e){We=e}},We);var $e=We.EventSourcePolyfill;class Be extends Le.BaseError{constructor(e){const t=Xe(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class Ve extends Le.BaseError{constructor(e){const t=Xe(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function Xe(e){const t=e.body,n={response:e,statusCode:e.statusCode,responseBody:Je(t,e),message:"",details:void 0};return t.error&&t.message?(n.message="".concat(t.error," - ").concat(t.message),n):t.error&&t.error.description?(n.message=t.error.description,n.details=t.error,n):(n.message=t.error||t.message||function(e){const t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),n)}function Je(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const Ge={onResponse:e=>{if(e.statusCode>=500)throw new Ve(e);if(e.statusCode>=400)throw new Be(e);return e}},Ye={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};const Ze="X-Sanity-Project-ID";function Ke(e){if("string"==typeof e||Array.isArray(e))return{id:e};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}const Qe=["image","file"],et=["before","after","replace"],tt=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")},nt=e=>{if(-1===Qe.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(Qe.join(", ")))},rt=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))},ot=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_.-]+$/i.test(t))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))},st=(e,t)=>{if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));ot(e,t._id)},it=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},at=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},ct=encodeURIComponent;var ut,lt,ht=e=>{let{query:t,params:n={},options:r={}}=e;const{tag:o,...s}=r,i="query=".concat(ct(t)),a=o?"?tag=".concat(ct(o),"&").concat(i):"?".concat(i),c=Object.keys(n).reduce(((e,t)=>"".concat(e,"&").concat(ct("$".concat(t)),"=").concat(ct(JSON.stringify(n[t])))),a);return Object.keys(s).reduce(((e,t)=>r[t]?"".concat(e,"&").concat(ct(t),"=").concat(ct(r[t])):e),c)},dt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},pt=(e,t,n)=>(dt(e,t,"read from private field"),n?n.call(e):t.get(e)),ft=(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)},yt=(e,t,n,r)=>(dt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class mt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=e,this.operations=t}replace(e){return rt("replace",e),this._set("set",{$:e})}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return rt("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===et.indexOf(e)){const e=et.map((e=>'"'.concat(e,'"'))).join(", ");throw new Error("".concat(r,' takes an "at"-argument which is one of: ').concat(e))}if("string"!=typeof t)throw new Error("".concat(r,' takes a "selector"-argument which must be a string'));if(!Array.isArray(n))throw new Error("".concat(r,' takes an "items"-argument which must be an array'))})(e,t,n),this._assign("insert",{[e]:t,items:n})}append(e,t){return this.insert("after","".concat(e,"[-1]"),t)}prepend(e,t){return this.insert("before","".concat(e,"[0]"),t)}splice(e,t,n,r){const o=t<0?t-1:t,s=void 0===n||-1===n?-1:Math.max(0,t+n),i=o<0&&s>=0?"":s,a="".concat(e,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,r||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...Ke(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return rt(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 gt=class extends mt{constructor(e,t,n){super(e,t),ft(this,ut,void 0),yt(this,ut,n)}clone(){return new gt(this.selection,{...this.operations},pt(this,ut))}commit(e){if(!pt(this,ut))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,n=Object.assign({returnFirst:t,returnDocuments:!0},e);return pt(this,ut).mutate({patch:this.serialize()},n)}};let vt=gt;ut=new WeakMap;const wt=class extends mt{constructor(e,t,n){super(e,t),ft(this,lt,void 0),yt(this,lt,n)}clone(){return new wt(this.selection,{...this.operations},pt(this,lt))}commit(e){if(!pt(this,lt))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,n=Object.assign({returnFirst:t,returnDocuments:!0},e);return pt(this,lt).mutate({patch:this.serialize()},n)}};let bt=wt;lt=new WeakMap;var Ct,Et,xt=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Tt=(e,t,n)=>(xt(e,t,"read from private field"),n?n.call(e):t.get(e)),Ot=(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)},_t=(e,t,n,r)=>(xt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const jt={returnDocuments:!1};class St{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;this.operations=e,this.trxId=t}create(e){return rt("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return rt(t,e),st(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return rt(t,e),st(t,e),this._add({[t]:e})}delete(e){return ot("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 Rt=class extends St{constructor(e,t,n){super(e,n),Ot(this,Ct,void 0),_t(this,Ct,t)}clone(){return new Rt([...this.operations],Tt(this,Ct),this.trxId)}commit(e){if(!Tt(this,Ct))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Tt(this,Ct).mutate(this.serialize(),Object.assign({transactionId:this.trxId},jt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof bt)return this._add({patch:e.serialize()});if(n){const n=t(new bt(e,{},Tt(this,Ct)));if(!(n instanceof bt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:{id:e,...t}})}};let At=Rt;Ct=new WeakMap;const kt=class extends St{constructor(e,t,n){super(e,n),Ot(this,Et,void 0),_t(this,Et,t)}clone(){return new kt([...this.operations],Tt(this,Et),this.trxId)}commit(e){if(!Tt(this,Et))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Tt(this,Et).mutate(this.serialize(),Object.assign({transactionId:this.trxId},jt,e||{}))}patch(e,t){const n="function"==typeof t;if("string"!=typeof e&&e instanceof vt)return this._add({patch:e.serialize()});if(n){const n=t(new vt(e,{},Tt(this,Et)));if(!(n instanceof vt))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=kt;Et=new WeakMap;const Ft=(e,t)=>!1===e?void 0:void 0===e?t:e,qt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:Ft(e.returnDocuments,!0),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation}},Pt=e=>"response"===e.type,Dt=e=>e.body,Nt=(e,t)=>e.reduce(((e,n)=>(e[t(n)]=n,e)),Object.create(null));function Mt(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 Bt(e,t,"query",{query:n,params:r},o).pipe(He(s))}function Ut(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={uri:e.getDataUrl("doc",n),json:!0,tag:r.tag};return Xt(e,t,o).pipe(ze(Pt),He((e=>e.body.documents&&e.body.documents[0])))}function Ht(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={uri:e.getDataUrl("doc",n.join(",")),json:!0,tag:r.tag};return Xt(e,t,o).pipe(ze(Pt),He((e=>{const t=Nt(e.body.documents||[],(e=>e._id));return n.map((e=>t[e]||null))})))}function zt(e,t,n,r){return st("createIfNotExists",n),Vt(e,t,n,"createIfNotExists",r)}function Lt(e,t,n,r){return st("createOrReplace",n),Vt(e,t,n,"createOrReplace",r)}function Wt(e,t,n,r){return Bt(e,t,"mutate",{mutations:[{delete:Ke(n)}]},r)}function $t(e,t,n,r){const o=n instanceof bt||n instanceof vt||n instanceof At||n instanceof It?n.serialize():n;return Bt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId},r)}function Bt(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===n,i="query"===n,a=s?"":ht(r),c=!s&&a.length<11264,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o,y=e.getDataUrl(n,u),m={method:c?"GET":"POST",uri:y,json:!0,body:c?void 0:r,query:s&&qt(o),timeout:h,headers:f,token:d,tag:p,canUseCdn:i};return Xt(e,t,m).pipe(ze(Pt),He(Dt),He((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]:{};const s={[r]:n},i=Object.assign({returnFirst:!0,returnDocuments:!0},o);return Bt(e,t,"mutate",{mutations:[s]},i)}function Xt(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:at(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[Ze]=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:e.getUrl(r,i)}));return new Fe((e=>t(c,o.requester).subscribe(e)))}function Jt(e,t,n){return Xt(e,t,n).pipe(ze((e=>"response"===e.type)),He((e=>e.body)))}var Gt,Yt,Zt,Kt,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,Gt,void 0),tn(this,Yt,void 0),nn(this,Gt,e),nn(this,Yt,t)}upload(e,t,n){return sn(en(this,Gt),en(this,Yt),e,t,n)}}Gt=new WeakMap,Yt=new WeakMap;class on{constructor(e,t){tn(this,Zt,void 0),tn(this,Kt,void 0),nn(this,Zt,e),nn(this,Kt,t)}upload(e,t,n){return Ue(sn(en(this,Zt),en(this,Kt),e,t,n).pipe(ze((e=>"response"===e.type)),He((e=>e.body.document))))}}function sn(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};nt(n);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=it(e.config()),a="image"===n?"images":"files",c=an(o,r),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,m={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(m.sourceId=y.id,m.sourceName=y.name,m.sourceUrl=y.url),Xt(e,t,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:m,body:r})}function an(e,t){return"undefined"!=typeof window&&t instanceof window.File?Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e):e}Zt=new WeakMap,Kt=new WeakMap;var cn,un,ln,hn,dn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},pn=(e,t,n)=>(dn(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)},yn=(e,t,n,r)=>(dn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class mn{constructor(e,t){fn(this,cn,void 0),fn(this,un,void 0),yn(this,cn,e),yn(this,un,t)}getLoginProviders(){return Jt(pn(this,cn),pn(this,un),{uri:"/auth/providers"})}logout(){return Jt(pn(this,cn),pn(this,un),{uri:"/auth/logout",method:"POST"})}}cn=new WeakMap,un=new WeakMap;class gn{constructor(e,t){fn(this,ln,void 0),fn(this,hn,void 0),yn(this,ln,e),yn(this,hn,t)}getLoginProviders(){return Ue(Jt(pn(this,ln),pn(this,hn),{uri:"/auth/providers"}))}logout(){return Ue(Jt(pn(this,ln),pn(this,hn),{uri:"/auth/logout",method:"POST"}))}}ln=new WeakMap,hn=new WeakMap;function vn(e){return"https://docs.sanity.io/help/"+e}const wn=e=>(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)})),bn=wn(["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(vn("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),Cn=wn(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(vn("js-client-browser-token")," for more information and how to hide this warning.")]),En=wn(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(vn("js-client-api-version"))]),xn={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},Tn=["localhost","127.0.0.1","0.0.0.0"],On=(e,t)=>{const n=Object.assign({},t,e);n.apiVersion||En();const r=Object.assign({},xn,n),o=r.useProjectHostname;if("undefined"==typeof Promise){const e=vn("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!==Tn.indexOf(e))(window.location.hostname);s&&i&&r.token&&!0!==r.ignoreBrowserTokenWarning?Cn():void 0===r.useCdn&&bn(),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&&tt(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?at(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion="".concat(r.apiVersion).replace(/^v/,""),r.isDefaultApi=r.apiHost===xn.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 _n=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(n[r]=void 0===e[r]?t[r]:e[r],n)),{}),jn=(e,t)=>t.reduce(((t,n)=>(void 0===e[n]||(t[n]=e[n]),t)),{});const Sn=$e,Rn=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],An={includeResult:!0};function kn(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={..._n(n,An),tag:a},u=jn(c,Rn),l=ht({query:e,params:t,options:{tag:a,...u}}),h="".concat(r).concat(this.getDataUrl("listen",l));if(h.length>14800)return new Fe((e=>e.error(new Error("Query too large for listener"))));const d=c.events?c.events:["mutation"],p=-1!==d.indexOf("reconnect"),f={};return(o||s)&&(f.withCredentials=!0),o&&(f.headers={Authorization:"Bearer ".concat(o)}),new Fe((e=>{let t,n=u(),r=!1;function o(){r||(p&&e.next({type:"reconnect"}),r||n.readyState===Sn.CLOSED&&(c(),clearTimeout(t),t=setTimeout(l,100)))}function s(t){e.error(Fn(t))}function i(t){const n=In(t);return n instanceof Error?e.error(n):e.next(n)}function a(){r=!0,c(),e.complete()}function c(){n.removeEventListener("error",o,!1),n.removeEventListener("channelError",s,!1),n.removeEventListener("disconnect",a,!1),d.forEach((e=>n.removeEventListener(e,i,!1))),n.close()}function u(){const e=new Sn(h,f);return e.addEventListener("error",o,!1),e.addEventListener("channelError",s,!1),e.addEventListener("disconnect",a,!1),d.forEach((t=>e.addEventListener(t,i,!1))),e}function l(){n=u()}return function(){r=!0,c()}}))}function In(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}function Fn(e){if(e instanceof Error)return e;const t=In(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))}var qn,Pn,Dn=(e,t,n)=>(((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)})(e,t,"access private method"),n);class Nn{constructor(){((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)})(this,qn)}create(e,t){return Dn(this,qn,Pn).call(this,"PUT",e,t)}edit(e,t){return Dn(this,qn,Pn).call(this,"PATCH",e,t)}delete(e){return Dn(this,qn,Pn).call(this,"DELETE",e)}list(){return this.client.request({uri:"/datasets"})}}qn=new WeakSet,Pn=function(e,t,n){return tt(t),this.client.request({method:e,uri:"/datasets/".concat(t),body:n})};class Mn extends Nn{constructor(e){super(),this.client=e}}class Un extends Nn{constructor(e){super(),this.client=e}}class Hn{list(){return this.client.request({uri:"/projects"})}getById(e){return this.client.request({uri:"/projects/".concat(e)})}}class zn extends Hn{constructor(e){super(),this.client=e}}class Ln extends Hn{constructor(e){super(),this.client=e}}class Wn{getById(e){return this.client.request({uri:"/users/".concat(e)})}}class $n extends Wn{constructor(e){super(),this.client=e}}class Bn extends Wn{constructor(e){super(),this.client=e}}var Vn,Xn,Jn,Gn,Yn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Zn=(e,t,n)=>(Yn(e,t,"read from private field"),n?n.call(e):t.get(e)),Kn=(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)},Qn=(e,t,n,r)=>(Yn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);const er=class{constructor(e,t){Kn(this,Vn,void 0),Kn(this,Xn,void 0),this.config(t),Qn(this,Xn,e),this.assets=new rn(this,Zn(this,Xn)),this.auth=new mn(this,Zn(this,Xn)),this.datasets=new Mn(this),this.projects=new zn(this),this.users=new $n(this)}clone(){return new er(Zn(this,Xn),this.config())}config(e){if(void 0===e)return{...Zn(this,Vn)};if(Zn(this,Vn)&&!1===Zn(this,Vn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Qn(this,Vn,On(e,Zn(this,Vn)||{})),this}withConfig(e){return new er(Zn(this,Xn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Mt(this,Zn(this,Xn),e,t,n)}getDocument(e,t){return Ut(this,Zn(this,Xn),e,t)}getDocuments(e,t){return Ht(this,Zn(this,Xn),e,t)}create(e,t){return Vt(this,Zn(this,Xn),e,"create",t)}createIfNotExists(e,t){return zt(this,Zn(this,Xn),e,t)}createOrReplace(e,t){return Lt(this,Zn(this,Xn),e,t)}delete(e,t){return Wt(this,Zn(this,Xn),e,t)}mutate(e,t){return $t(this,Zn(this,Xn),e,t)}patch(e,t){return new vt(e,t,this)}transaction(e){return new It(e,this)}request(e){return Jt(this,Zn(this,Xn),e)}getUrl(e){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?Zn(this,Vn).cdnUrl:Zn(this,Vn).url;return"".concat(t,"/").concat(e.replace(/^\//,""))}getDataUrl(e,t){const n=this.config(),r=it(n),o="/".concat(e,"/").concat(r),s=t?"".concat(o,"/").concat(t):o;return"/data".concat(s).replace(/\/($|\?)/,"$1")}};let tr=er;Vn=new WeakMap,Xn=new WeakMap;const nr=class{constructor(e,t){Kn(this,Jn,void 0),Kn(this,Gn,void 0),this.listen=kn,this.observable=new tr(e,t),this.config(t),Qn(this,Gn,e),this.assets=new on(this,Zn(this,Gn)),this.auth=new gn(this,Zn(this,Gn)),this.datasets=new Un(this),this.projects=new Ln(this),this.users=new Bn(this)}clone(){return new nr(Zn(this,Gn),this.config())}config(e){if(void 0===e)return{...Zn(this,Jn)};if(Zn(this,Jn)&&!1===Zn(this,Jn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable.config(e),Qn(this,Jn,On(e,Zn(this,Jn)||{})),this}withConfig(e){return new nr(Zn(this,Gn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Ue(Mt(this,Zn(this,Gn),e,t,n))}getDocument(e,t){return Ue(Ut(this,Zn(this,Gn),e,t))}getDocuments(e,t){return Ue(Ht(this,Zn(this,Gn),e,t))}create(e,t){return Ue(Vt(this,Zn(this,Gn),e,"create",t))}createIfNotExists(e,t){return Ue(zt(this,Zn(this,Gn),e,t))}createOrReplace(e,t){return Ue(Lt(this,Zn(this,Gn),e,t))}delete(e,t){return Ue(Wt(this,Zn(this,Gn),e,t))}mutate(e,t){return Ue($t(this,Zn(this,Gn),e,t))}patch(e,t){return new bt(e,t,this)}transaction(e){return new At(e,this)}request(e){return Ue(Jt(this,Zn(this,Gn),e))}dataRequest(e,t,n){return Ue(Bt(this,Zn(this,Gn),e,t,n))}getUrl(e){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?Zn(this,Jn).cdnUrl:Zn(this,Jn).url;return"".concat(t,"/").concat(e.replace(/^\//,""))}getDataUrl(e,t){const n=this.config(),r=it(n),o="/".concat(e,"/").concat(r),s=t?"".concat(o,"/").concat(t):o;return"/data".concat(s).replace(/\/($|\?)/,"$1")}};let rr=nr;Jn=new WeakMap,Gn=new WeakMap;const or=function(e){const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:B;return N(e,t)}([...e,Ye,ee(),te(),{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"))}},Ge,oe({implementation:Fe})]);function n(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return n({maxRedirects:0,...e})}return n.defaultRequester=t,n}([]),sr=or.defaultRequester;e.BasePatch=mt,e.BaseTransaction=St,e.ClientError=Be,e.ObservablePatch=vt,e.ObservableSanityClient=tr,e.ObservableTransaction=It,e.Patch=bt,e.SanityClient=rr,e.ServerError=Ve,e.Transaction=At,e.createClient=function(e){return new rr(or,e)},e.requester=sr}));
10
+ * eventsource.js
11
+ * Available under MIT License (MIT)
12
+ * https://github.com/Yaffle/EventSource/
13
+ */
14
+ !function(t,r){!function(e){var n=e.setTimeout,o=e.clearTimeout,s=e.XMLHttpRequest,i=e.XDomainRequest,a=e.ActiveXObject,c=e.EventSource,u=e.document,l=e.Promise,h=e.fetch,d=e.Response,p=e.TextDecoder,f=e.TextEncoder,y=e.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(t){u.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(t){function e(){}return e.prototype=t,new e}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var m=h;h=function(t,e){var r=e.signal;return m(t,{headers:e.headers,credentials:e.credentials,cache:e.cache}).then((function(t){var e=t.body.getReader();return r._reader=e,r._aborted&&r._reader.cancel(),{status:t.status,statusText:t.statusText,headers:t.headers,body:{getReader:function(){return e}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function g(){this.bitsNeeded=0,this.codePoint=0}g.prototype.decode=function(t){function e(t,e,r){if(1===r)return t>=128>>e&&t<<e<=2047;if(2===r)return t>=2048>>e&&t<<e<=55295||t>=57344>>e&&t<<e<=65535;if(3===r)return t>=65536>>e&&t<<e<=1114111;throw new Error}function r(t,e){if(6===t)return e>>6>15?3:e>31?2:1;if(12===t)return e>15?3:2;if(18===t)return 3;throw new Error}for(var n=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<t.length;a+=1){var c=t[a];0!==s&&(c<128||c>191||!e(i<<6|63&c,s-6,r(s,i)))&&(s=0,i=n,o+=String.fromCharCode(i)),0===s?(c>=0&&c<=127?(s=0,i=c):c>=192&&c<=223?(s=6,i=31&c):c>=224&&c<=239?(s=12,i=15&c):c>=240&&c<=247?(s=18,i=7&c):(s=0,i=n),0===s||e(i,s,r(s,i))||(s=0,i=n)):(s-=6,i=i<<6|63&c),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o};null!=p&&null!=f&&function(){try{return"test"===(new p).decode((new f).encode("test"),{stream:!0})}catch(t){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+t)}return!1}()||(p=g);var v=function(){};function w(t){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=t,this._sendTimeout=0,this._abort=v}function b(t){return t.replace(/[A-Z]/g,(function(t){return String.fromCharCode(t.charCodeAt(0)+32)}))}function C(t){for(var e=Object.create(null),r=t.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),s=o.shift(),i=o.join(": ");e[b(s)]=i}this._map=e}function E(){}function x(t){this._headers=t}function T(){}function O(){this._listeners=Object.create(null)}function j(t){n((function(){throw t}),0)}function S(t){this.type=t,this.target=void 0}function _(t,e){S.call(this,t),this.data=e.data,this.lastEventId=e.lastEventId}function k(t,e){S.call(this,t),this.status=e.status,this.statusText=e.statusText,this.headers=e.headers}function A(t,e){S.call(this,t),this.error=e.error}w.prototype.open=function(t,e){this._abort(!0);var r=this,i=this._xhr,a=1,c=0;this._abort=function(t){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,i.abort(),0!==c&&(o(c),c=0),t||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var u=function(){if(1===a){var t=0,e="",n=void 0;if("contentType"in i)t=200,e="OK",n=i.contentType;else try{t=i.status,e=i.statusText,n=i.getResponseHeader("Content-Type")}catch(r){t=0,e="",n=void 0}0!==t&&(a=2,r.readyState=2,r.status=t,r.statusText=e,r._contentType=n,r.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var t="";try{t=i.responseText}catch(t){}r.readyState=3,r.responseText=t,r.onprogress()}},h=function(t,e){if(null!=e&&null!=e.preventDefault||(e={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),r.readyState=4,"load"===t)r.onload(e);else if("error"===t)r.onerror(e);else{if("abort"!==t)throw new TypeError;r.onabort(e)}r.onreadystatechange()}},d=function(){c=n((function(){d()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(t){h("load",t)}),"onerror"in i&&(i.onerror=function(t){h("error",t)}),"onabort"in i&&(i.onabort=function(t){h("abort",t)}),"onprogress"in i&&(i.onprogress=l),"onreadystatechange"in i&&(i.onreadystatechange=function(t){!function(t){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||h(""===i.responseText?"error":"load",t):3===i.readyState?"onprogress"in i||l():2===i.readyState&&u())}(t)}),!("contentType"in i)&&"ontimeout"in s.prototype||(e+=(-1===e.indexOf("?")?"?":"&")+"padding=true"),i.open(t,e,!0),"readyState"in i&&(c=n((function(){d()}),0))},w.prototype.abort=function(){this._abort(!1)},w.prototype.getResponseHeader=function(t){return this._contentType},w.prototype.setRequestHeader=function(t,e){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(t,e)},w.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},w.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var t=this._xhr;"withCredentials"in t&&(t.withCredentials=this.withCredentials);try{t.send(void 0)}catch(t){throw t}}else{var e=this;e._sendTimeout=n((function(){e._sendTimeout=0,e.send()}),4)}},C.prototype.get=function(t){return this._map[b(t)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),E.prototype.open=function(t,e,r,n,o,i,a){t.open("GET",o);var c=0;for(var u in t.onprogress=function(){var e=t.responseText.slice(c);c+=e.length,r(e)},t.onerror=function(t){t.preventDefault(),n(new Error("NetworkError"))},t.onload=function(){n(null)},t.onabort=function(){n(null)},t.onreadystatechange=function(){if(t.readyState===s.HEADERS_RECEIVED){var r=t.status,n=t.statusText,o=t.getResponseHeader("Content-Type"),i=t.getAllResponseHeaders();e(r,n,o,new C(i))}},t.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,u)&&t.setRequestHeader(u,a[u]);return t.send(),t},x.prototype.get=function(t){return this._headers.get(t)},T.prototype.open=function(t,e,r,n,o,s,i){var a=null,c=new y,u=c.signal,d=new p;return h(o,{headers:i,credentials:s?"include":"same-origin",signal:u,cache:"no-store"}).then((function(t){return a=t.body.getReader(),e(t.status,t.statusText,t.headers.get("Content-Type"),new x(t.headers)),new l((function(t,e){var n=function(){a.read().then((function(e){if(e.done)t(void 0);else{var o=d.decode(e.value,{stream:!0});r(o),n()}})).catch((function(t){e(t)}))};n()}))})).catch((function(t){return"AbortError"===t.name?void 0:t})).then((function(t){n(t)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},O.prototype.dispatchEvent=function(t){t.target=this;var e=this._listeners[t.type];if(null!=e)for(var r=e.length,n=0;n<r;n+=1){var o=e[n];try{"function"==typeof o.handleEvent?o.handleEvent(t):o.call(this,t)}catch(t){j(t)}}},O.prototype.addEventListener=function(t,e){t=String(t);var r=this._listeners,n=r[t];null==n&&(n=[],r[t]=n);for(var o=!1,s=0;s<n.length;s+=1)n[s]===e&&(o=!0);o||n.push(e)},O.prototype.removeEventListener=function(t,e){t=String(t);var r=this._listeners,n=r[t];if(null!=n){for(var o=[],s=0;s<n.length;s+=1)n[s]!==e&&o.push(n[s]);0===o.length?delete r[t]:r[t]=o}},_.prototype=Object.create(S.prototype),k.prototype=Object.create(S.prototype),A.prototype=Object.create(S.prototype);var R=-1,I=-1,F=/^text\/event\-stream(;.*)?$/i,P=function(t,e){var r=null==t?e:parseInt(t,10);return r!=r&&(r=e),q(r)},q=function(t){return Math.min(Math.max(t,1e3),18e6)},M=function(t,e,r){try{"function"==typeof e&&e.call(t,r)}catch(t){j(t)}};function D(t,e){O.call(this),e=e||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(t,e,r){e=String(e);var a=Boolean(r.withCredentials),c=r.lastEventIdQueryParameterName||"lastEventId",u=q(1e3),l=P(r.heartbeatTimeout,45e3),h="",d=u,p=!1,f=0,y=r.headers||{},m=r.Transport,g=N&&null==m?void 0:new w(null!=m?new m:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=m&&"string"!=typeof m?new m:null==g?new T:new E,b=void 0,C=0,x=R,O="",j="",S="",D="",U=0,W=0,z=0,H=function(e,r,n,o){if(0===x)if(200===e&&null!=n&&F.test(n)){x=1,p=Date.now(),d=u,t.readyState=1;var s=new k("open",{status:e,statusText:r,headers:o});t.dispatchEvent(s),M(t,t.onopen,s)}else{var i="";200!==e?(r&&(r=r.replace(/\s+/g," ")),i="EventSource's response has a status "+e+" "+r+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",$();s=new k("error",{status:e,statusText:r,headers:o});t.dispatchEvent(s),M(t,t.onerror,s),console.error(i)}},L=function(e){if(1===x){for(var r=-1,s=0;s<e.length;s+=1){(c=e.charCodeAt(s))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(r=s)}var i=(-1!==r?D:"")+e.slice(0,r+1);D=(-1===r?D:"")+e.slice(r+1),""!==e&&(p=Date.now(),f+=e.length);for(var a=0;a<i.length;a+=1){var c=i.charCodeAt(a);if(U===I&&c==="\n".charCodeAt(0))U=0;else if(U===I&&(U=0),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(0!==U){1===U&&(z=a+1);var y=i.slice(W,z-1),m=i.slice(z+(z<a&&i.charCodeAt(z)===" ".charCodeAt(0)?1:0),a);"data"===y?(O+="\n",O+=m):"id"===y?j=m:"event"===y?S=m:"retry"===y?(u=P(m,u),d=u):"heartbeatTimeout"===y&&(l=P(m,l),0!==C&&(o(C),C=n((function(){V()}),l)))}if(0===U){if(""!==O){h=j,""===S&&(S="message");var g=new _(S,{data:O.slice(1),lastEventId:j});if(t.dispatchEvent(g),"open"===S?M(t,t.onopen,g):"message"===S?M(t,t.onmessage,g):"error"===S&&M(t,t.onerror,g),2===x)return}O="",S=""}U=c==="\r".charCodeAt(0)?I:0}else 0===U&&(W=a,U=1),1===U?c===":".charCodeAt(0)&&(z=a+1,U=2):2===U&&(U=3)}}},B=function(e){if(1===x||0===x){x=R,0!==C&&(o(C),C=0),C=n((function(){V()}),d),d=q(Math.min(16*u,2*d)),t.readyState=0;var r=new A("error",{error:e});t.dispatchEvent(r),M(t,t.onerror,r),null!=e&&console.error(e)}},$=function(){x=2,null!=b&&(b.abort(),b=void 0),0!==C&&(o(C),C=0),t.readyState=2},V=function(){if(C=0,x===R){p=!1,f=0,C=n((function(){V()}),l),x=0,O="",S="",j=h,D="",W=0,z=0,U=0;var r=e;if("data:"!==e.slice(0,5)&&"blob:"!==e.slice(0,5)&&""!==h){var o=e.indexOf("?");r=-1===o?e:e.slice(0,o+1)+e.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(t,e){return e===c?"":t})),r+=(-1===e.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(h)}var s=t.withCredentials,i={Accept:"text/event-stream"},a=t.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(i[u]=a[u]);try{b=v.open(g,H,L,B,r,s,i)}catch(t){throw $(),t}}else if(p||null==b){var d=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=n((function(){V()}),d)}else B(new Error("No activity within "+l+" milliseconds. "+(0===x?"No response received.":f+" chars received.")+" Reconnecting.")),null!=b&&(b.abort(),b=void 0)};t.url=e,t.readyState=0,t.withCredentials=a,t.headers=y,t._close=$,V()}(this,t,e)}var N=null!=h&&null!=d&&"body"in d.prototype;D.prototype=Object.create(O.prototype),D.prototype.CONNECTING=0,D.prototype.OPEN=1,D.prototype.CLOSED=2,D.prototype.close=function(){this._close()},D.CONNECTING=0,D.OPEN=1,D.CLOSED=2,D.prototype.withCredentials=void 0;var U,W=c;null==s||null!=c&&"withCredentials"in c.prototype||(W=D),U=function(t){t.EventSourcePolyfill=D,t.NativeEventSource=c,t.EventSource=W}(r),void 0!==U&&(t.exports=U)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:e:globalThis)}({get exports(){return Bt},set exports(t){Bt=t}},Bt);var $t=Bt.EventSourcePolyfill;class Vt extends Lt.BaseError{constructor(t){const e=Gt(t);super(e.message),this.statusCode=400,Object.assign(this,e)}}class Jt extends Lt.BaseError{constructor(t){const e=Gt(t);super(e.message),this.statusCode=500,Object.assign(this,e)}}function Gt(t){const e=t.body,r={response:t,statusCode:t.statusCode,responseBody:Xt(e,t),message:"",details:void 0};return e.error&&e.message?(r.message="".concat(e.error," - ").concat(e.message),r):e.error&&e.error.description?(r.message=e.error.description,r.details=e.error,r):(r.message=e.error||e.message||function(t){const e=t.statusMessage?" ".concat(t.statusMessage):"";return"".concat(t.method,"-request to ").concat(t.url," resulted in HTTP ").concat(t.statusCode).concat(e)}(t),r)}function Xt(t,e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t}const Yt={onResponse:t=>{if(t.statusCode>=500)throw new Jt(t);if(t.statusCode>=400)throw new Vt(t);return t}},Zt={onResponse:t=>{const e=t.headers["x-sanity-warning"];return(Array.isArray(e)?e:[e]).filter(Boolean).forEach((t=>console.warn(t))),t}};const Kt="X-Sanity-Project-ID";function Qt(t){if("string"==typeof t||Array.isArray(t))return{id:t};if("object"==typeof t&&null!==t&&"query"in t&&"string"==typeof t.query)return"params"in t&&"object"==typeof t.params&&null!==t.params?{query:t.query,params:t.params}:{query:t.query};const e=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(e))}const te=["image","file"],ee=["before","after","replace"],re=t=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},ne=t=>{if(-1===te.indexOf(t))throw new Error("Invalid asset type: ".concat(t,". Must be one of ").concat(te.join(", ")))},oe=(t,e)=>{if(null===e||"object"!=typeof e||Array.isArray(e))throw new Error("".concat(t,"() takes an object of properties"))},se=(t,e)=>{if("string"!=typeof e||!/^[a-z0-9_.-]+$/i.test(e))throw new Error("".concat(t,'(): "').concat(e,'" is not a valid document ID'))},ie=(t,e)=>{if(!e._id)throw new Error("".concat(t,'() requires that the document contains an ID ("_id" property)'));se(t,e._id)},ae=t=>{if(!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},ce=t=>{if("string"!=typeof t||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t},ue=encodeURIComponent;var le,he,de=t=>{let{query:e,params:r={},options:n={}}=t;const{tag:o,...s}=n,i="query=".concat(ue(e)),a=o?"?tag=".concat(ue(o),"&").concat(i):"?".concat(i),c=Object.keys(r).reduce(((t,e)=>"".concat(t,"&").concat(ue("$".concat(e)),"=").concat(ue(JSON.stringify(r[e])))),a);return Object.keys(s).reduce(((t,e)=>n[e]?"".concat(t,"&").concat(ue(e),"=").concat(ue(n[e])):t),c)},pe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},fe=(t,e,r)=>(pe(t,e,"read from private field"),r?r.call(t):e.get(t)),ye=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},me=(t,e,r,n)=>(pe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);class ge{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.selection=t,this.operations=e}replace(t){return oe("replace",t),this._set("set",{$:t})}set(t){return this._assign("set",t)}setIfMissing(t){return this._assign("setIfMissing",t)}diffMatchPatch(t){return oe("diffMatchPatch",t),this._assign("diffMatchPatch",t)}unset(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:t}),this}inc(t){return this._assign("inc",t)}dec(t){return this._assign("dec",t)}insert(t,e,r){return((t,e,r)=>{const n="insert(at, selector, items)";if(-1===ee.indexOf(t)){const t=ee.map((t=>'"'.concat(t,'"'))).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(t))}if("string"!=typeof e)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))})(t,e,r),this._assign("insert",{[t]:e,items:r})}append(t,e){return this.insert("after","".concat(t,"[-1]"),e)}prepend(t,e){return this.insert("before","".concat(t,"[0]"),e)}splice(t,e,r,n){const o=e<0?e-1:e,s=void 0===r||-1===r?-1:Math.max(0,e+r),i=o<0&&s>=0?"":s,a="".concat(t,"[").concat(o,":").concat(i,"]");return this.insert("replace",a,n||[])}ifRevisionId(t){return this.operations.ifRevisionID=t,this}serialize(){return{...Qt(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(t,e){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return oe(t,e),this.operations=Object.assign({},this.operations,{[t]:Object.assign({},r&&this.operations[t]||{},e)}),this}_set(t,e){return this._assign(t,e,!1)}}const ve=class extends ge{constructor(t,e,r){super(t,e),ye(this,le,void 0),me(this,le,r)}clone(){return new ve(this.selection,{...this.operations},fe(this,le))}commit(t){if(!fe(this,le))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const e="string"==typeof this.selection,r=Object.assign({returnFirst:e,returnDocuments:!0},t);return fe(this,le).mutate({patch:this.serialize()},r)}};let we=ve;le=new WeakMap;const be=class extends ge{constructor(t,e,r){super(t,e),ye(this,he,void 0),me(this,he,r)}clone(){return new be(this.selection,{...this.operations},fe(this,he))}commit(t){if(!fe(this,he))throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const e="string"==typeof this.selection,r=Object.assign({returnFirst:e,returnDocuments:!0},t);return fe(this,he).mutate({patch:this.serialize()},r)}};let Ce=be;he=new WeakMap;var Ee,xe,Te=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Oe=(t,e,r)=>(Te(t,e,"read from private field"),r?r.call(t):e.get(t)),je=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Se=(t,e,r,n)=>(Te(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);const _e={returnDocuments:!1};class ke{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;this.operations=t,this.trxId=e}create(t){return oe("create",t),this._add({create:t})}createIfNotExists(t){const e="createIfNotExists";return oe(e,t),ie(e,t),this._add({[e]:t})}createOrReplace(t){const e="createOrReplace";return oe(e,t),ie(e,t),this._add({[e]:t})}delete(t){return se("delete",t),this._add({delete:{id:t}})}transactionId(t){return t?(this.trxId=t,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(t){return this.operations.push(t),this}}const Ae=class extends ke{constructor(t,e,r){super(t,r),je(this,Ee,void 0),Se(this,Ee,e)}clone(){return new Ae([...this.operations],Oe(this,Ee),this.trxId)}commit(t){if(!Oe(this,Ee))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Oe(this,Ee).mutate(this.serialize(),Object.assign({transactionId:this.trxId},_e,t||{}))}patch(t,e){const r="function"==typeof e;if("string"!=typeof t&&t instanceof Ce)return this._add({patch:t.serialize()});if(r){const r=e(new Ce(t,{},Oe(this,Ee)));if(!(r instanceof Ce))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:t,...e}})}};let Re=Ae;Ee=new WeakMap;const Ie=class extends ke{constructor(t,e,r){super(t,r),je(this,xe,void 0),Se(this,xe,e)}clone(){return new Ie([...this.operations],Oe(this,xe),this.trxId)}commit(t){if(!Oe(this,xe))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return Oe(this,xe).mutate(this.serialize(),Object.assign({transactionId:this.trxId},_e,t||{}))}patch(t,e){const r="function"==typeof e;if("string"!=typeof t&&t instanceof we)return this._add({patch:t.serialize()});if(r){const r=e(new we(t,{},Oe(this,xe)));if(!(r instanceof we))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:t,...e}})}};let Fe=Ie;xe=new WeakMap;const Pe=(t,e)=>!1===t?void 0:void 0===t?e:t,qe=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:t.dryRun,returnIds:!0,returnDocuments:Pe(t.returnDocuments,!0),visibility:t.visibility||"sync",autoGenerateArrayKeys:t.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:t.skipCrossDatasetReferenceValidation}},Me=t=>"response"===t.type,De=t=>t.body,Ne=(t,e)=>t.reduce(((t,r)=>(t[e(r)]=r,t)),Object.create(null));function Ue(t,e,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s=!1===o.filterResponse?t=>t:t=>t.result;return Ve(t,e,"query",{query:r,params:n},o).pipe(zt(s))}function We(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={uri:Ye(t,"doc",r),json:!0,tag:n.tag};return Ge(t,e,o).pipe(Ht(Me),zt((t=>t.body.documents&&t.body.documents[0])))}function ze(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={uri:Ye(t,"doc",r.join(",")),json:!0,tag:n.tag};return Ge(t,e,o).pipe(Ht(Me),zt((t=>{const e=Ne(t.body.documents||[],(t=>t._id));return r.map((t=>e[t]||null))})))}function He(t,e,r,n){return ie("createIfNotExists",r),Je(t,e,r,"createIfNotExists",n)}function Le(t,e,r,n){return ie("createOrReplace",r),Je(t,e,r,"createOrReplace",n)}function Be(t,e,r,n){return Ve(t,e,"mutate",{mutations:[{delete:Qt(r)}]},n)}function $e(t,e,r,n){const o=r instanceof Ce||r instanceof we||r instanceof Re||r instanceof Fe?r.serialize():r;return Ve(t,e,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId},n)}function Ve(t,e,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s="mutate"===r,i="query"===r,a=s?"":de(n),c=!s&&a.length<11264,u=c?a:"",l=o.returnFirst,{timeout:h,token:d,tag:p,headers:f}=o,y=Ye(t,r,u),m={method:c?"GET":"POST",uri:y,json:!0,body:c?void 0:n,query:s&&qe(o),timeout:h,headers:f,token:d,tag:p,canUseCdn:i};return Ge(t,e,m).pipe(Ht(Me),zt(De),zt((t=>{if(!s)return t;const e=t.results||[];if(o.returnDocuments)return l?e[0]&&e[0].document:e.map((t=>t.document));const r=l?"documentId":"documentIds",n=l?e[0]&&e[0].id:e.map((t=>t.id));return{transactionId:t.transactionId,results:e,[r]:n}})))}function Je(t,e,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const s={[n]:r},i=Object.assign({returnFirst:!0,returnDocuments:!0},o);return Ve(t,e,"mutate",{mutations:[s]},i)}function Ge(t,e,r){const n=r.url||r.uri,o=t.config(),s=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/"):r.canUseCdn,i=o.useCdn&&s,a=r.tag&&o.requestTagPrefix?[o.requestTagPrefix,r.tag].join("."):r.tag||o.requestTagPrefix;a&&(r.query={tag:ce(a),...r.query});const c=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={},n=e.token||t.token;n&&(r.Authorization="Bearer ".concat(n)),e.useGlobalApi||t.useProjectHostname||!t.projectId||(r[Kt]=t.projectId);const o=Boolean(void 0===e.withCredentials?t.token||t.withCredentials:e.withCredentials),s=void 0===e.timeout?t.timeout:e.timeout;return Object.assign({},e,{headers:Object.assign({},r,e.headers||{}),timeout:void 0===s?3e5:s,proxy:e.proxy||t.proxy,json:!0,withCredentials:o})}(o,Object.assign({},r,{url:Ze(t,n,i)}));return new Pt((t=>e(c,o.requester).subscribe(t)))}function Xe(t,e,r){return Ge(t,e,r).pipe(Ht((t=>"response"===t.type)),zt((t=>t.body)))}function Ye(t,e,r){const n=t.config(),o=ae(n),s="/".concat(e,"/").concat(o),i=r?"".concat(s,"/").concat(r):s;return"/data".concat(i).replace(/\/($|\?)/,"$1")}function Ze(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{url:n,cdnUrl:o}=t.config(),s=r?o:n;return"".concat(s,"/").concat(e.replace(/^\//,""))}var Ke,Qe,tr,er,rr=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},nr=(t,e,r)=>(rr(t,e,"read from private field"),r?r.call(t):e.get(t)),or=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},sr=(t,e,r,n)=>(rr(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);class ir{constructor(t,e){or(this,Ke,void 0),or(this,Qe,void 0),sr(this,Ke,t),sr(this,Qe,e)}upload(t,e,r){return cr(nr(this,Ke),nr(this,Qe),t,e,r)}}Ke=new WeakMap,Qe=new WeakMap;class ar{constructor(t,e){or(this,tr,void 0),or(this,er,void 0),sr(this,tr,t),sr(this,er,e)}upload(t,e,r){return Wt(cr(nr(this,tr),nr(this,er),t,e,r).pipe(Ht((t=>"response"===t.type)),zt((t=>t.body.document))))}}function cr(t,e,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};ne(r);let s=o.extract||void 0;s&&!s.length&&(s=["none"]);const i=ae(t.config()),a="image"===r?"images":"files",c=ur(o,n),{tag:u,label:l,title:h,description:d,creditLine:p,filename:f,source:y}=c,m={label:l,title:h,description:d,filename:f,meta:s,creditLine:p};return y&&(m.sourceId=y.id,m.sourceName=y.name,m.sourceUrl=y.url),Ge(t,e,{tag:u,method:"POST",timeout:c.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:c.contentType?{"Content-Type":c.contentType}:{},query:m,body:n})}function ur(t,e){return"undefined"!=typeof window&&e instanceof window.File?Object.assign({filename:!1===t.preserveFilename?void 0:e.name,contentType:e.type},t):t}tr=new WeakMap,er=new WeakMap;var lr,hr,dr,pr,fr=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},yr=(t,e,r)=>(fr(t,e,"read from private field"),r?r.call(t):e.get(t)),mr=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},gr=(t,e,r,n)=>(fr(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);class vr{constructor(t,e){mr(this,lr,void 0),mr(this,hr,void 0),gr(this,lr,t),gr(this,hr,e)}getLoginProviders(){return Xe(yr(this,lr),yr(this,hr),{uri:"/auth/providers"})}logout(){return Xe(yr(this,lr),yr(this,hr),{uri:"/auth/logout",method:"POST"})}}lr=new WeakMap,hr=new WeakMap;class wr{constructor(t,e){mr(this,dr,void 0),mr(this,pr,void 0),gr(this,dr,t),gr(this,pr,e)}getLoginProviders(){return Wt(Xe(yr(this,dr),yr(this,pr),{uri:"/auth/providers"}))}logout(){return Wt(Xe(yr(this,dr),yr(this,pr),{uri:"/auth/logout",method:"POST"}))}}dr=new WeakMap,pr=new WeakMap;function br(t){return"https://docs.sanity.io/help/"+t}const Cr=t=>(t=>{let e,r=!1;return function(){return r||(e=t(...arguments),r=!0),e}})((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return console.warn(t.join(" "),...r)})),Er=Cr(["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(br("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),xr=Cr(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(br("js-client-browser-token")," for more information and how to hide this warning.")]),Tr=Cr(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(br("js-client-api-version"))]),Or={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},jr=["localhost","127.0.0.1","0.0.0.0"],Sr=(t,e)=>{const r=Object.assign({},e,t);r.apiVersion||Tr();const n=Object.assign({},Or,r),o=n.useProjectHostname;if("undefined"==typeof Promise){const t=br("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(t))}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");const s="undefined"!=typeof window&&window.location&&window.location.hostname,i=s&&(t=>-1!==jr.indexOf(t))(window.location.hostname);s&&i&&n.token&&!0!==n.ignoreBrowserTokenWarning?xr():void 0===n.useCdn&&Er(),o&&(t=>{if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&re(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?ce(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===Or.apiHost,n.useCdn=Boolean(n.useCdn)&&!n.withCredentials,function(t){if("1"===t||"X"===t)return;const e=new Date(t);if(!(/^\d{4}-\d{2}-\d{2}$/.test(t)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(n.apiVersion);const a=n.apiHost.split("://",2),c=a[0],u=a[1],l=n.isDefaultApi?"apicdn.sanity.io":u;return n.useProjectHostname?(n.url="".concat(c,"://").concat(n.projectId,".").concat(u,"/v").concat(n.apiVersion),n.cdnUrl="".concat(c,"://").concat(n.projectId,".").concat(l,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n};var _r=(t,e)=>Object.keys(e).concat(Object.keys(t)).reduce(((r,n)=>(r[n]=void 0===t[n]?e[n]:t[n],r)),{}),kr=(t,e)=>e.reduce(((e,r)=>(void 0===t[r]||(e[r]=t[r]),e)),{});const Ar=$t,Rr=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Ir={includeResult:!0};function Fr(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.config(),a=r.tag&&i?[i,r.tag].join("."):r.tag,c={..._r(r,Ir),tag:a},u=kr(c,Rr),l=de({query:t,params:e,options:{tag:a,...u}}),h="".concat(n).concat(Ye(this,"listen",l));if(h.length>14800)return new Pt((t=>t.error(new Error("Query too large for listener"))));const d=c.events?c.events:["mutation"],p=-1!==d.indexOf("reconnect"),f={};return(o||s)&&(f.withCredentials=!0),o&&(f.headers={Authorization:"Bearer ".concat(o)}),new Pt((t=>{let e,r=u(),n=!1;function o(){n||(p&&t.next({type:"reconnect"}),n||r.readyState===Ar.CLOSED&&(c(),clearTimeout(e),e=setTimeout(l,100)))}function s(e){t.error(qr(e))}function i(e){const r=Pr(e);return r instanceof Error?t.error(r):t.next(r)}function a(){n=!0,c(),t.complete()}function c(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",s,!1),r.removeEventListener("disconnect",a,!1),d.forEach((t=>r.removeEventListener(t,i,!1))),r.close()}function u(){const t=new Ar(h,f);return t.addEventListener("error",o,!1),t.addEventListener("channelError",s,!1),t.addEventListener("disconnect",a,!1),d.forEach((e=>t.addEventListener(e,i,!1))),t}function l(){r=u()}return function(){n=!0,c()}}))}function Pr(t){try{const e=t.data&&JSON.parse(t.data)||{};return Object.assign({type:t.type},e)}catch(t){return t}}function qr(t){if(t instanceof Error)return t;const e=Pr(t);return e instanceof Error?e:new Error(function(t){if(!t.error)return t.message||"Unknown listener error";if(t.error.description)return t.error.description;return"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2)}(e))}var Mr,Dr,Nr,Ur,Wr=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},zr=(t,e,r)=>(Wr(t,e,"read from private field"),r?r.call(t):e.get(t)),Hr=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Lr=(t,e,r,n)=>(Wr(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);class Br{constructor(t,e){Hr(this,Mr,void 0),Hr(this,Dr,void 0),Lr(this,Mr,t),Lr(this,Dr,e)}create(t,e){return Vr(zr(this,Mr),zr(this,Dr),"PUT",t,e)}edit(t,e){return Vr(zr(this,Mr),zr(this,Dr),"PATCH",t,e)}delete(t){return Vr(zr(this,Mr),zr(this,Dr),"DELETE",t)}list(){return Xe(zr(this,Mr),zr(this,Dr),{uri:"/datasets"})}}Mr=new WeakMap,Dr=new WeakMap;class $r{constructor(t,e){Hr(this,Nr,void 0),Hr(this,Ur,void 0),Lr(this,Nr,t),Lr(this,Ur,e)}create(t,e){return Wt(Vr(zr(this,Nr),zr(this,Ur),"PUT",t,e))}edit(t,e){return Wt(Vr(zr(this,Nr),zr(this,Ur),"PATCH",t,e))}delete(t){return Wt(Vr(zr(this,Nr),zr(this,Ur),"DELETE",t))}list(){return Wt(Xe(zr(this,Nr),zr(this,Ur),{uri:"/datasets"}))}}function Vr(t,e,r,n,o){return re(n),Xe(t,e,{method:r,uri:"/datasets/".concat(n),body:o})}Nr=new WeakMap,Ur=new WeakMap;var Jr,Gr,Xr,Yr,Zr=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Kr=(t,e,r)=>(Zr(t,e,"read from private field"),r?r.call(t):e.get(t)),Qr=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},tn=(t,e,r,n)=>(Zr(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);class en{constructor(t,e){Qr(this,Jr,void 0),Qr(this,Gr,void 0),tn(this,Jr,t),tn(this,Gr,e)}list(){return Xe(Kr(this,Jr),Kr(this,Gr),{uri:"/projects"})}getById(t){return Xe(Kr(this,Jr),Kr(this,Gr),{uri:"/projects/".concat(t)})}}Jr=new WeakMap,Gr=new WeakMap;class rn{constructor(t,e){Qr(this,Xr,void 0),Qr(this,Yr,void 0),tn(this,Xr,t),tn(this,Yr,e)}list(){return Wt(Xe(Kr(this,Xr),Kr(this,Yr),{uri:"/projects"}))}getById(t){return Wt(Xe(Kr(this,Xr),Kr(this,Yr),{uri:"/projects/".concat(t)}))}}Xr=new WeakMap,Yr=new WeakMap;var nn,on,sn,an,cn=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},un=(t,e,r)=>(cn(t,e,"read from private field"),r?r.call(t):e.get(t)),ln=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},hn=(t,e,r,n)=>(cn(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);class dn{constructor(t,e){ln(this,nn,void 0),ln(this,on,void 0),hn(this,nn,t),hn(this,on,e)}getById(t){return Xe(un(this,nn),un(this,on),{uri:"/users/".concat(t)})}}nn=new WeakMap,on=new WeakMap;class pn{constructor(t,e){ln(this,sn,void 0),ln(this,an,void 0),hn(this,sn,t),hn(this,an,e)}getById(t){return Wt(Xe(un(this,sn),un(this,an),{uri:"/users/".concat(t)}))}}sn=new WeakMap,an=new WeakMap;var fn,yn,mn,gn,vn=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},wn=(t,e,r)=>(vn(t,e,"read from private field"),r?r.call(t):e.get(t)),bn=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Cn=(t,e,r,n)=>(vn(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);const En=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Or;bn(this,fn,void 0),bn(this,yn,void 0),this.config(e),Cn(this,yn,t),this.assets=new ir(this,wn(this,yn)),this.auth=new vr(this,wn(this,yn)),this.datasets=new Br(this,wn(this,yn)),this.projects=new en(this,wn(this,yn)),this.users=new dn(this,wn(this,yn))}clone(){return new En(wn(this,yn),this.config())}config(t){if(void 0===t)return{...wn(this,fn)};if(wn(this,fn)&&!1===wn(this,fn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Cn(this,fn,Sr(t,wn(this,fn)||{})),this}withConfig(t){return new En(wn(this,yn),{...this.config(),...t})}fetch(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Ue(this,wn(this,yn),t,e,r)}getDocument(t,e){return We(this,wn(this,yn),t,e)}getDocuments(t,e){return ze(this,wn(this,yn),t,e)}create(t,e){return Je(this,wn(this,yn),t,"create",e)}createIfNotExists(t,e){return He(this,wn(this,yn),t,e)}createOrReplace(t,e){return Le(this,wn(this,yn),t,e)}delete(t,e){return Be(this,wn(this,yn),t,e)}mutate(t,e){return $e(this,wn(this,yn),t,e)}patch(t,e){return new we(t,e,this)}transaction(t){return new Fe(t,this)}request(t){return Xe(this,wn(this,yn),t)}};let xn=En;fn=new WeakMap,yn=new WeakMap;const Tn=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Or;bn(this,mn,void 0),bn(this,gn,void 0),this.listen=Fr,this.config(e),Cn(this,gn,t),this.assets=new ar(this,wn(this,gn)),this.auth=new wr(this,wn(this,gn)),this.datasets=new $r(this,wn(this,gn)),this.projects=new rn(this,wn(this,gn)),this.users=new pn(this,wn(this,gn)),this.observable=new xn(t,e)}clone(){return new Tn(wn(this,gn),this.config())}config(t){if(void 0===t)return{...wn(this,mn)};if(wn(this,mn)&&!1===wn(this,mn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(t),Cn(this,mn,Sr(t,wn(this,mn)||{})),this}withConfig(t){return new Tn(wn(this,gn),{...this.config(),...t})}fetch(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Wt(Ue(this,wn(this,gn),t,e,r))}getDocument(t,e){return Wt(We(this,wn(this,gn),t,e))}getDocuments(t,e){return Wt(ze(this,wn(this,gn),t,e))}create(t,e){return Wt(Je(this,wn(this,gn),t,"create",e))}createIfNotExists(t,e){return Wt(He(this,wn(this,gn),t,e))}createOrReplace(t,e){return Wt(Le(this,wn(this,gn),t,e))}delete(t,e){return Wt(Be(this,wn(this,gn),t,e))}mutate(t,e){return Wt($e(this,wn(this,gn),t,e))}patch(t,e){return new Ce(t,e,this)}transaction(t){return new Re(t,this)}request(t){return Wt(Xe(this,wn(this,gn),t))}dataRequest(t,e,r){return Wt(Ve(this,wn(this,gn),t,e,r))}};let On=Tn;mn=new WeakMap,gn=new WeakMap;const jn=function(t){const e=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:V;return P(t,e)}([...t,Zt,et(),rt(),{onRequest:t=>{if("xhr"!==t.adapter)return;const e=t.request,r=t.context;function n(t){return e=>{const n=e.lengthComputable?e.loaded/e.total*100:-1;r.channels.progress.publish({stage:t,percent:n,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=n("upload")),"onprogress"in e&&(e.onprogress=n("download"))}},Yt,st({implementation:Pt})]);function r(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return r({maxRedirects:0,...t})}return r.defaultRequester=e,r}([]),Sn=jn.defaultRequester;t.BasePatch=ge,t.BaseTransaction=ke,t.ClientError=Vt,t.ObservablePatch=we,t.ObservableSanityClient=xn,t.ObservableTransaction=Fe,t.Patch=Ce,t.SanityClient=On,t.ServerError=Jt,t.Transaction=Re,t.createClient=t=>new On(jn,t),t.requester=Sn}));