"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[106],{58249:function(e,t,r){r.d(t,{C:function(){return o},N:function(){return c}});var s={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},n={0:8203,1:8204,2:8205,3:65279},i=[,,,,].fill(String.fromCodePoint(n[0])).join("");function o(e,t,r="auto"){let s;return!0===r||"auto"===r&&(!(!Number.isNaN(Number(e))||/[a-z]/i.test(e)&&!/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(e))&&Date.parse(e)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(e))?e:`${e}${s=JSON.stringify(t),`${i}${Array.from(s).map(e=>{let t=e.charCodeAt(0);if(t>255)throw Error(`Only ASCII edit info can be encoded. Error attempting to encode ${s} on character ${e} (${t})`);return Array.from(t.toString(4).padStart(4,"0")).map(e=>String.fromCodePoint(n[e])).join("")}).join("")}`}`}Object.fromEntries(Object.entries(n).map(e=>e.reverse())),Object.fromEntries(Object.entries(s).map(e=>e.reverse()));var a=`${Object.values(s).map(e=>`\\u{${e.toString(16)}}`).join("")}`,u=RegExp(`[${a}]{4,}`,"gu");function c(e){var t,r;return e&&JSON.parse({cleaned:(t=JSON.stringify(e)).replace(u,""),encoded:(null==(r=t.match(u))?void 0:r[0])||""}.cleaned)}},80106:function(e,t,r){r.d(t,{eI:function(){return to}});let s=!(typeof navigator>"u")&&"ReactNative"===navigator.product,n={timeout:s?6e4:12e4},i=function(e){let t={...n,..."string"==typeof e?{url:e}:e};if(t.timeout=function e(t){if(!1===t||0===t)return!1;if(t.connect||t.socket)return t;let r=Number(t);return isNaN(r)?e(n.timeout):{connect:r,socket:r}}(t.timeout),t.query){let{url:e,searchParams:r}=function(e){let t=e.indexOf("?");if(-1===t)return{url:e,searchParams:new URLSearchParams};let r=e.slice(0,t),n=e.slice(t+1);if(!s)return{url:r,searchParams:new URLSearchParams(n)};if("function"!=typeof decodeURIComponent)throw Error("Broken `URLSearchParams` implementation, and `decodeURIComponent` is not defined");let i=new URLSearchParams;for(let e of n.split("&")){let[t,r]=e.split("=");t&&i.append(o(t),o(r||""))}return{url:r,searchParams:i}}(t.url);for(let[s,n]of Object.entries(t.query)){if(void 0!==n){if(Array.isArray(n))for(let e of n)r.append(s,e);else r.append(s,n)}let i=r.toString();i&&(t.url=`${e}?${i}`)}}return t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t};function o(e){return decodeURIComponent(e.replace(/\+/g," "))}let a=/^https?:\/\//i,u=function(e){if(!a.test(e.url))throw Error(`"${e.url}" is not a valid URL`)};function c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}let l=["request","response","progress","error","abort"],h=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];var d=function(e){return e.replace(/^\s+|\s+$/g,"")},p=c(function(e){if(!e)return{};for(var t,r={},s=d(e).split("\n"),n=0;n<s.length;n++){var i=s[n],o=i.indexOf(":"),a=d(i.slice(0,o)).toLowerCase(),u=d(i.slice(o+1));typeof r[a]>"u"?r[a]=u:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(u):r[a]=[r[a],u])}return r});class f{onabort;onerror;onreadystatechange;ontimeout;readyState=0;response;responseText="";responseType="";status;statusText;withCredentials;#e;#t;#r;#s={};#n;#i={};#o;open(e,t,r){this.#e=e,this.#t=t,this.#r="",this.readyState=1,this.onreadystatechange?.(),this.#n=void 0}abort(){this.#n&&this.#n.abort()}getAllResponseHeaders(){return this.#r}setRequestHeader(e,t){this.#s[e]=t}setInit(e,t=!0){this.#i=e,this.#o=t}send(e){let t="arraybuffer"!==this.responseType,r={...this.#i,method:this.#e,headers:this.#s,body:e};"function"==typeof AbortController&&this.#o&&(this.#n=new AbortController,"u">typeof EventTarget&&this.#n.signal instanceof EventTarget&&(r.signal=this.#n.signal)),"u">typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(this.#t,r).then(e=>(e.headers.forEach((e,t)=>{this.#r+=`${t}: ${e}\r
`}),this.status=e.status,this.statusText=e.statusText,this.readyState=3,this.onreadystatechange?.(),t?e.text():e.arrayBuffer())).then(e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange?.()}).catch(e=>{"AbortError"!==e.name?this.onerror?.(e):this.onabort?.()})}}let g="function"==typeof XMLHttpRequest?"xhr":"fetch",y="xhr"===g?XMLHttpRequest:f,m=(e,t)=>{let r=e.options,s=e.applyMiddleware("finalizeOptions",r),n={},i=e.applyMiddleware("interceptRequest",void 0,{adapter:g,context:e});if(i){let e=setTimeout(t,0,null,i);return{abort:()=>clearTimeout(e)}}let o=new y;o instanceof f&&"object"==typeof s.fetch&&o.setInit(s.fetch,s.useAbortSignal??!0);let a=s.headers,u=s.timeout,c=!1,l=!1,h=!1;if(o.onerror=e=>{b(o instanceof f?e instanceof Error?e:Error(`Request error while attempting to reach is ${s.url}`,{cause:e}):Error(`Request error while attempting to reach is ${s.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`))},o.ontimeout=e=>{b(Error(`Request timeout while attempting to reach ${s.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`))},o.onabort=()=>{m(!0),c=!0},o.onreadystatechange=()=>{u&&(m(),n.socket=setTimeout(()=>d("ESOCKETTIMEDOUT"),u.socket)),c||4!==o.readyState||0===o.status||function(){if(!(c||l||h)){if(0===o.status)return void b(Error("Unknown XHR error"));m(),l=!0,t(null,{body:o.response||(""===o.responseType||"text"===o.responseType?o.responseText:""),url:s.url,method:s.method,headers:p(o.getAllResponseHeaders()),statusCode:o.status,statusMessage:o.statusText})}}()},o.open(s.method,s.url,!0),o.withCredentials=!!s.withCredentials,a&&o.setRequestHeader)for(let e in a)a.hasOwnProperty(e)&&o.setRequestHeader(e,a[e]);return s.rawBody&&(o.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:s,adapter:g,request:o,context:e}),o.send(s.body||null),u&&(n.connect=setTimeout(()=>d("ETIMEDOUT"),u.connect)),{abort:function(){c=!0,o&&o.abort()}};function d(t){h=!0,o.abort();let r=Error("ESOCKETTIMEDOUT"===t?`Socket timed out on request to ${s.url}`:`Connection timed out on request to ${s.url}`);r.code=t,e.channels.error.publish(r)}function m(e){(e||c||o.readyState>=2&&n.connect)&&clearTimeout(n.connect),n.socket&&clearTimeout(n.socket)}function b(e){if(l)return;m(!0),l=!0,o=null;let r=e||Error(`Network error while attempting to reach ${s.url}`);r.isNetworkError=!0,r.request=s,t(r)}},b=(e=[],t=m)=>(function e(t,r){let s=[],n=h.reduce((e,t)=>(e[t]=e[t]||[],e),{processOptions:[i],validateOptions:[u]});function o(e){let t;let s=l.reduce((e,t)=>(e[t]=function(){let e=Object.create(null),t=0;return{publish:function(t){for(let r in e)e[r](t)},subscribe:function(r){let s=t++;return e[s]=r,function(){delete e[s]}}}}(),e),{}),i=function(e,t,...r){let s="onError"===e,i=t;for(let t=0;t<n[e].length&&(i=(0,n[e][t])(i,...r),!s||i);t++);return i},o=i("processOptions",e);i("validateOptions",o);let a={options:o,channels:s,applyMiddleware:i},u=s.request.subscribe(e=>{t=r(e,(t,r)=>((e,t,r)=>{let n=e,o=t;if(!n)try{o=i("onResponse",t,r)}catch(e){o=null,n=e}(n=n&&i("onError",n,r))?s.error.publish(n):o&&s.response.publish(o)})(t,r,e))});s.abort.subscribe(()=>{u(),t&&t.abort()});let c=i("onReturn",s,a);return c===s&&s.request.publish(a),c}return o.use=function(e){if(!e)throw Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&n.onReturn.length>0)throw Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return h.forEach(t=>{e[t]&&n[t].push(e[t])}),s.push(e),o},o.clone=()=>e(s,r),t.forEach(o.use),o})(e,t);var w,C,v=r(32608),E=r(56790).lW,R={exports:{}},q=function(e){function t(e){let s,n,i,o=null;function a(...e){if(!a.enabled)return;let r=Number(new Date),n=r-(s||r);a.diff=n,a.prev=s,a.curr=r,s=r,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,s)=>{if("%%"===r)return"%";i++;let n=t.formatters[s];if("function"==typeof n){let t=e[i];r=n.call(a,t),e.splice(i,1),i--}return r}),t.formatArgs.call(a,e),(a.log||t.log).apply(a,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==t.namespaces&&(n=t.namespaces,i=t.enabled(e)),i),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){let s=t(this.namespace+(typeof r>"u"?":":r)+e);return s.log=this.log,s}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(s),...t.skips.map(s).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let s=("string"==typeof e?e:"").split(/[\s,]+/),n=s.length;for(r=0;r<n;r++)s[r]&&("-"===(e=s[r].replace(/\*/g,".*?"))[0]?t.skips.push(RegExp("^"+e.slice(1)+"$")):t.names.push(RegExp("^"+e+"$")))},t.enabled=function(e){let r,s;if("*"===e[e.length-1])return!0;for(r=0,s=t.skips.length;r<s;r++)if(t.skips[r].test(e))return!1;for(r=0,s=t.names.length;r<s;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=function(){if(C)return w;function e(e,t,r,s){return Math.round(e/r)+" "+s+(t>=1.5*r?"s":"")}return C=1,w=function(t,r){r=r||{};var s,n,i=typeof t;if("string"===i&&t.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return 864e5*r;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*r;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*r;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(t);if("number"===i&&isFinite(t))return r.long?(n=Math.abs(t))>=864e5?e(t,n,864e5,"day"):n>=36e5?e(t,n,36e5,"hour"):n>=6e4?e(t,n,6e4,"minute"):n>=1e3?e(t,n,1e3,"second"):t+" ms":(s=Math.abs(t))>=864e5?Math.round(t/864e5)+"d":s>=36e5?Math.round(t/36e5)+"h":s>=6e4?Math.round(t/6e4)+"m":s>=1e3?Math.round(t/1e3)+"s":t+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}}(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)|0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};!function(e,t){let r;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;let r="color: "+this.color;t.splice(1,0,r,"color: inherit");let s=0,n=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(s++,"%c"===e&&(n=s))}),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch{}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch{}return!e&&"u">typeof v&&"env"in v&&(e=v.env.DEBUG),e},t.useColors=function(){return!(!("u">typeof window&&window.process)||"renderer"!==window.process.type&&!window.process.__nwjs)||!("u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("u">typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"u">typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch{}}(),t.destroy=(r=!1,()=>{r||(r=!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=q(t);let{formatters:s}=e.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(R,R.exports),c(R.exports),Object.prototype.hasOwnProperty;let $=typeof E>"u"?()=>!1:e=>E.isBuffer(e);function O(e){return"[object Object]"===Object.prototype.toString.call(e)}let j=["boolean","string","number"],x={};"u">typeof globalThis?x=globalThis:"u">typeof window?x=window:"u">typeof global?x=global:"u">typeof self&&(x=self);var I=x;let T=(e={})=>{let t=e.implementation||Promise;if(!t)throw Error("`Promise` is not available in global scope, and no implementation was passed");return{onReturn:(r,s)=>new t((t,n)=>{let i=s.options.cancelToken;i&&i.promise.then(e=>{r.abort.publish(e),n(e)}),r.error.subscribe(n),r.response.subscribe(r=>{t(e.onlyBody?r.body:r)}),setTimeout(()=>{try{r.request.publish(s)}catch(e){n(e)}},0)})}};class A{__CANCEL__=!0;message;constructor(e){this.message=e}toString(){return"Cancel"+(this.message?`: ${this.message}`:"")}}class F{promise;reason;constructor(e){if("function"!=typeof e)throw TypeError("executor must be a function.");let t=null;this.promise=new Promise(e=>{t=e}),e(e=>{this.reason||(this.reason=new A(e),t(this.reason))})}static source=()=>{let e;return{token:new F(t=>{e=t}),cancel:e}}}T.Cancel=A,T.CancelToken=F,T.isCancel=e=>!(!e||!e?.__CANCEL__);var S=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function P(e){return 100*Math.pow(2,e)+100*Math.random()}let D=(e={})=>(e=>{let t=e.maxRetries||5,r=e.retryDelay||P,s=e.shouldRetry;return{onError:(e,n)=>{var i;let o=n.options,a=o.maxRetries||t,u=o.retryDelay||r,c=o.shouldRetry||s,l=o.attemptNumber||0;if(null!==(i=o.body)&&"object"==typeof i&&"function"==typeof i.pipe||!c(e,l,o)||l>=a)return e;let h=Object.assign({},n,{options:Object.assign({},o,{attemptNumber:l+1})});return setTimeout(()=>n.channels.request.publish(h),u(l)),null}}})({shouldRetry:S,...e});D.shouldRetry=S;var k=r(59677),M=r(70175),N=r(4411),U=r(58249),_=r(3434),L=r(60956),z=r(20594);class H extends Error{response;statusCode=400;responseBody;details;constructor(e){let t=J(e);super(t.message),Object.assign(this,t)}}class B extends Error{response;statusCode=500;responseBody;details;constructor(e){let t=J(e);super(t.message),Object.assign(this,t)}}function J(e){let t=e.body,r={response:e,statusCode:e.statusCode,responseBody:-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t,message:"",details:void 0};if(t.error&&t.message)return r.message=`${t.error} - ${t.message}`,r;if(V(t)&&V(t.error)&&"mutationError"===t.error.type&&"string"==typeof t.error.description||V(t)&&V(t.error)&&"actionError"===t.error.type&&"string"==typeof t.error.description){let e=t.error.items||[],s=e.slice(0,5).map(e=>e.error?.description).filter(Boolean),n=s.length?`:
- ${s.join(`
- `)}`:"";return e.length>5&&(n+=`
...and ${e.length-5} more`),r.message=`${t.error.description}${n}`,r.details=t.error,r}return t.error&&t.error.description?(r.message=t.error.description,r.details=t.error):r.message=t.error||t.message||function(e){let t=e.statusMessage?` ${e.statusMessage}`:"";return`${e.method}-request to ${e.url} resulted in HTTP ${e.statusCode}${t}`}(e),r}function V(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let G={onResponse:e=>{if(e.statusCode>=500)throw new B(e);if(e.statusCode>=400)throw new H(e);return e}},X={onResponse:e=>{let t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach(e=>console.warn(e)),e}};function Q(e,t,r){if(0===r.maxRetries)return!1;let s="GET"===r.method||"HEAD"===r.method,n=(r.uri||r.url).startsWith("/data/query"),i=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return(!!s||!!n)&&!!i||D.shouldRetry(e,t,r)}function Y(e){if("string"==typeof e)return{id:e};if(Array.isArray(e))return{query:"*[_id in $ids]",params:{ids: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};let t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join(`
`);throw Error(`Unknown selection - must be one of:

${t}`)}let K=["image","file"],W=["before","after","replace"],Z=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},ee=e=>{if(!/^[-a-z0-9]+$/i.test(e))throw Error("`projectId` can only contain only a-z, 0-9 and dashes")},et=e=>{if(-1===K.indexOf(e))throw Error(`Invalid asset type: ${e}. Must be one of ${K.join(", ")}`)},er=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw Error(`${e}() takes an object of properties`)},es=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw Error(`${e}(): "${t}" is not a valid document ID`)},en=(e,t)=>{if(!t._id)throw Error(`${e}() requires that the document contains an ID ("_id" property)`);es(e,t._id)},ei=(e,t,r)=>{let s="insert(at, selector, items)";if(-1===W.indexOf(e)){let e=W.map(e=>`"${e}"`).join(", ");throw Error(`${s} takes an "at"-argument which is one of: ${e}`)}if("string"!=typeof t)throw Error(`${s} takes a "selector"-argument which must be a string`);if(!Array.isArray(r))throw Error(`${s} takes an "items"-argument which must be an array`)},eo=e=>{if(!e.dataset)throw Error("`dataset` must be provided to perform queries");return e.dataset||""},ea=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e};class eu{selection;operations;constructor(e,t={}){this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return er("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,t,r){return ei(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after",`${e}[-1]`,t)}prepend(e,t){return this.insert("before",`${e}[0]`,t)}splice(e,t,r,s){let n=t<0?t-1:t,i=typeof r>"u"||-1===r?-1:Math.max(0,t+r),o=`${e}[${n}:${n<0&&i>=0?"":i}]`;return this.insert("replace",o,s||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...Y(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,r=!0){return er(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}class ec extends eu{#a;constructor(e,t,r){super(e,t),this.#a=r}clone(){return new ec(this.selection,{...this.operations},this.#a)}commit(e){if(!this.#a)throw Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");let t=Object.assign({returnFirst:"string"==typeof this.selection,returnDocuments:!0},e);return this.#a.mutate({patch:this.serialize()},t)}}class el extends eu{#a;constructor(e,t,r){super(e,t),this.#a=r}clone(){return new el(this.selection,{...this.operations},this.#a)}commit(e){if(!this.#a)throw Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");let t=Object.assign({returnFirst:"string"==typeof this.selection,returnDocuments:!0},e);return this.#a.mutate({patch:this.serialize()},t)}}let eh={returnDocuments:!1};class ed{operations;trxId;constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return er("create",e),this._add({create:e})}createIfNotExists(e){let t="createIfNotExists";return er(t,e),en(t,e),this._add({[t]:e})}createOrReplace(e){let t="createOrReplace";return er(t,e),en(t,e),this._add({[t]:e})}delete(e){return es("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}}class ep extends ed{#a;constructor(e,t,r){super(e,r),this.#a=t}clone(){return new ep([...this.operations],this.#a,this.trxId)}commit(e){if(!this.#a)throw Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#a.mutate(this.serialize(),Object.assign({transactionId:this.trxId},eh,e||{}))}patch(e,t){let r="function"==typeof t;if("string"!=typeof e&&e instanceof el)return this._add({patch:e.serialize()});if(r){let r=t(new el(e,{},this.#a));if(!(r instanceof el))throw Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}}class ef extends ed{#a;constructor(e,t,r){super(e,r),this.#a=t}clone(){return new ef([...this.operations],this.#a,this.trxId)}commit(e){if(!this.#a)throw Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#a.mutate(this.serialize(),Object.assign({transactionId:this.trxId},eh,e||{}))}patch(e,t){let r="function"==typeof t;if("string"!=typeof e&&e instanceof ec)return this._add({patch:e.serialize()});if(r){let r=t(new ec(e,{},this.#a));if(!(r instanceof ec))throw Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}}function eg(e){return"https://www.sanity.io/help/"+e}let ey=e=>{var t;let r,s;return t=(...t)=>console.warn(e.join(" "),...t),r=!1,(...e)=>(r||(s=t(...e),r=!0),s)},em=ey(["Because you set `withCredentials` to true, we will override your `useCdn`","setting to be false since (cookie-based) credentials are never set on the CDN"]),eb=ey(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),ew=ey(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),eC=ey(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${eg("js-client-browser-token")} for more information and how to hide this warning.`]),ev=ey(["Using the Sanity client without specifying an API version is deprecated.",`See ${eg("js-client-api-version")}`]),eE=(ey(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),{apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}}),eR=["localhost","127.0.0.1","0.0.0.0"],eq=e=>-1!==eR.indexOf(e),e$=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},eO=(e,t)=>{let r={...t,...e,stega:{..."boolean"==typeof t.stega?{enabled:t.stega}:t.stega||eE.stega,..."boolean"==typeof e.stega?{enabled:e.stega}:e.stega||{}}};r.apiVersion||ev();let s={...eE,...r},n=s.useProjectHostname;if(typeof Promise>"u"){let e=eg("js-client-promise-polyfill");throw Error(`No native Promise-implementation found, polyfill needed - see ${e}`)}if(n&&!s.projectId)throw Error("Configuration must contain `projectId`");if("string"==typeof s.perspective&&e$(s.perspective),"encodeSourceMap"in s)throw Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in s)throw Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");if("boolean"!=typeof s.stega.enabled)throw Error(`stega.enabled must be a boolean, received ${s.stega.enabled}`);if(s.stega.enabled&&void 0===s.stega.studioUrl)throw Error("stega.studioUrl must be defined when stega.enabled is true");if(s.stega.enabled&&"string"!=typeof s.stega.studioUrl&&"function"!=typeof s.stega.studioUrl)throw Error(`stega.studioUrl must be a string or a function, received ${s.stega.studioUrl}`);let i="u">typeof window&&window.location&&window.location.hostname,o=i&&eq(window.location.hostname);i&&o&&s.token&&!0!==s.ignoreBrowserTokenWarning?eC():typeof s.useCdn>"u"&&eb(),n&&ee(s.projectId),s.dataset&&Z(s.dataset),"requestTagPrefix"in s&&(s.requestTagPrefix=s.requestTagPrefix?ea(s.requestTagPrefix).replace(/\.+$/,""):void 0),s.apiVersion=`${s.apiVersion}`.replace(/^v/,""),s.isDefaultApi=s.apiHost===eE.apiHost,!0===s.useCdn&&s.withCredentials&&em(),s.useCdn=!1!==s.useCdn&&!s.withCredentials,function(e){if("1"===e||"X"===e)return;let t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(s.apiVersion);let a=s.apiHost.split("://",2),u=a[0],c=a[1],l=s.isDefaultApi?"apicdn.sanity.io":c;return s.useProjectHostname?(s.url=`${u}://${s.projectId}.${c}/v${s.apiVersion}`,s.cdnUrl=`${u}://${s.projectId}.${l}/v${s.apiVersion}`):(s.url=`${s.apiHost}/v${s.apiVersion}`,s.cdnUrl=s.url),s},ej=({query:e,params:t={},options:r={}})=>{let s=new URLSearchParams,{tag:n,includeMutations:i,returnQuery:o,...a}=r;for(let[r,i]of(n&&s.append("tag",n),s.append("query",e),Object.entries(t)))s.append(`$${r}`,JSON.stringify(i));for(let[e,t]of Object.entries(a))t&&s.append(e,`${t}`);return!1===o&&s.append("returnQuery","false"),!1===i&&s.append("includeMutations","false"),`?${s}`},ex=(e,t)=>!1===e?void 0:typeof e>"u"?t:e,eI=(e={})=>({dryRun:e.dryRun,returnIds:!0,returnDocuments:ex(e.returnDocuments,!0),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation}),eT=e=>"response"===e.type,eA=e=>e.body,eF=(e,t)=>e.reduce((e,r)=>(e[t(r)]=r,e),Object.create(null));function eS(e,t,s,n,i={},o={}){let a="stega"in o?{...s||{},..."boolean"==typeof o.stega?{enabled:o.stega}:o.stega||{}}:s,u=a.enabled?(0,U.N)(i):i,c=!1===o.filterResponse?e=>e:e=>e.result,{cache:l,next:h,...d}={useAbortSignal:"u">typeof o.signal,resultSourceMap:a.enabled?"withKeyArraySelector":o.resultSourceMap,...o,returnQuery:!1===o.filterResponse&&!1!==o.returnQuery},p=eL(e,t,"query",{query:n,params:u},"u">typeof l||"u">typeof h?{...d,fetch:{cache:l,next:h}}:d);return a.enabled?p.pipe((0,_.V)((0,M.D)(r.e(1287).then(r.bind(r,41287)).then(function(e){return e.stegaEncodeSourceMap$1}).then(({stegaEncodeSourceMap:e})=>e))),(0,L.U)(([e,t])=>{let r=t(e.result,e.resultSourceMap,a);return c({...e,result:r})})):p.pipe((0,L.U)(c))}function eP(e,t,r,s={}){let n={uri:eJ(e,"doc",r),json:!0,tag:s.tag,signal:s.signal};return eH(e,t,n).pipe((0,z.h)(eT),(0,L.U)(e=>e.body.documents&&e.body.documents[0]))}function eD(e,t,r,s={}){let n={uri:eJ(e,"doc",r.join(",")),json:!0,tag:s.tag,signal:s.signal};return eH(e,t,n).pipe((0,z.h)(eT),(0,L.U)(e=>{let t=eF(e.body.documents||[],e=>e._id);return r.map(e=>t[e]||null)}))}function ek(e,t,r,s){return en("createIfNotExists",r),ez(e,t,r,"createIfNotExists",s)}function eM(e,t,r,s){return en("createOrReplace",r),ez(e,t,r,"createOrReplace",s)}function eN(e,t,r,s){return eL(e,t,"mutate",{mutations:[{delete:Y(r)}]},s)}function eU(e,t,r,s){let n;return eL(e,t,"mutate",{mutations:Array.isArray(n=r instanceof el||r instanceof ec?{patch:r.serialize()}:r instanceof ep||r instanceof ef?r.serialize():r)?n:[n],transactionId:s&&s.transactionId||void 0},s)}function e_(e,t,r,s){let n=Array.isArray(r)?r:[r];return eL(e,t,"actions",{actions:n,transactionId:s&&s.transactionId||void 0,skipCrossDatasetReferenceValidation:s&&s.skipCrossDatasetReferenceValidation||void 0,dryRun:s&&s.dryRun||void 0},s)}function eL(e,t,r,s,n={}){let i="mutate"===r,o="actions"===r,a=i||o?"":ej(s),u=!i&&!o&&a.length<11264,c=n.returnFirst,{timeout:l,token:h,tag:d,headers:p,returnQuery:f,lastLiveEventId:g}=n,y=eJ(e,r,u?a:"");return eH(e,t,{method:u?"GET":"POST",uri:y,json:!0,body:u?void 0:s,query:i&&eI(n),timeout:l,headers:p,token:h,tag:d,returnQuery:f,perspective:n.perspective,resultSourceMap:n.resultSourceMap,lastLiveEventId:Array.isArray(g)?g[0]:g,canUseCdn:"query"===r,signal:n.signal,fetch:n.fetch,useAbortSignal:n.useAbortSignal,useCdn:n.useCdn}).pipe((0,z.h)(eT),(0,L.U)(eA),(0,L.U)(e=>{if(!i)return e;let t=e.results||[];if(n.returnDocuments)return c?t[0]&&t[0].document:t.map(e=>e.document);let r=c?t[0]&&t[0].id:t.map(e=>e.id);return{transactionId:e.transactionId,results:t,[c?"documentId":"documentIds"]:r}}))}function ez(e,t,r,s,n={}){return eL(e,t,"mutate",{mutations:[{[s]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},n))}function eH(e,t,r){var s;let n=r.url||r.uri,i=e.config(),o=typeof r.canUseCdn>"u"?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/"):r.canUseCdn,a=(r.useCdn??i.useCdn)&&o,u=r.tag&&i.requestTagPrefix?[i.requestTagPrefix,r.tag].join("."):r.tag||i.requestTagPrefix;if(u&&null!==r.tag&&(r.query={tag:ea(u),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/query/")){let e=r.resultSourceMap??i.resultSourceMap;void 0!==e&&!1!==e&&(r.query={resultSourceMap:e,...r.query});let t=r.perspective||i.perspective;"string"==typeof t&&"raw"!==t&&(e$(t),r.query={perspective:t,...r.query},"previewDrafts"===t&&a&&(a=!1,ew())),r.lastLiveEventId&&(r.query={...r.query,lastLiveEventId:r.lastLiveEventId}),!1===r.returnQuery&&(r.query={returnQuery:"false",...r.query})}let c=function(e,t={}){let r={},s=t.token||e.token;s&&(r.Authorization=`Bearer ${s}`),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r["X-Sanity-Project-ID"]=e.projectId);let n=!!(typeof t.withCredentials>"u"?e.token||e.withCredentials:t.withCredentials),i=typeof t.timeout>"u"?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:typeof i>"u"?3e5:i,proxy:t.proxy||e.proxy,json:!0,withCredentials:n,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(i,Object.assign({},r,{url:eV(e,n,a)})),l=new k.y(e=>t(c,i.requester).subscribe(e));return r.signal?l.pipe((s=r.signal,e=>new k.y(t=>{let r=()=>t.error(function(e){if(eG)return new DOMException(e?.reason??"The operation was aborted.","AbortError");let t=Error(e?.reason??"The operation was aborted.");return t.name="AbortError",t}(s));if(s&&s.aborted){r();return}let n=e.subscribe(t);return s.addEventListener("abort",r),()=>{s.removeEventListener("abort",r),n.unsubscribe()}}))):l}function eB(e,t,r){return eH(e,t,r).pipe((0,z.h)(e=>"response"===e.type),(0,L.U)(e=>e.body))}function eJ(e,t,r){let s=eo(e.config()),n=`/${t}/${s}`;return`/data${r?`${n}/${r}`:n}`.replace(/\/($|\?)/,"$1")}function eV(e,t,r=!1){let{url:s,cdnUrl:n}=e.config();return`${r?n:s}/${t.replace(/^\//,"")}`}let eG=!!globalThis.DOMException;class eX{#a;#u;constructor(e,t){this.#a=e,this.#u=t}upload(e,t,r){return eY(this.#a,this.#u,e,t,r)}}class eQ{#a;#u;constructor(e,t){this.#a=e,this.#u=t}upload(e,t,r){let s=eY(this.#a,this.#u,e,t,r);return(0,N.n)(s.pipe((0,z.h)(e=>"response"===e.type),(0,L.U)(e=>e.body.document)))}}function eY(e,t,r,s,n={}){et(r);let i=n.extract||void 0;i&&!i.length&&(i=["none"]);let o=eo(e.config()),a="image"===r?"images":"files",u=!(typeof File>"u")&&s instanceof File?Object.assign({filename:!1===n.preserveFilename?void 0:s.name,contentType:s.type},n):n,{tag:c,label:l,title:h,description:d,creditLine:p,filename:f,source:g}=u,y={label:l,title:h,description:d,filename:f,meta:i,creditLine:p};return g&&(y.sourceId=g.id,y.sourceName=g.name,y.sourceUrl=g.url),eH(e,t,{tag:c,method:"POST",timeout:u.timeout||0,uri:`/assets/${a}/${o}`,headers:u.contentType?{"Content-Type":u.contentType}:{},query:y,body:s})}var eK=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce((r,s)=>(r[s]=typeof e[s]>"u"?t[s]:e[s],r),{});let eW=(e,t)=>t.reduce((t,r)=>(typeof e[r]>"u"||(t[r]=e[r]),t),{}),eZ=["includePreviousRevision","includeResult","includeMutations","visibility","effectFormat","tag"],e0={includeResult:!0};function e1(e,t,s={}){let{url:n,token:i,withCredentials:o,requestTagPrefix:a}=this.config(),u=s.tag&&a?[a,s.tag].join("."):s.tag,c={...eK(s,e0),tag:u},l=ej({query:e,params:t,options:{tag:u,...eW(c,eZ)}}),h=`${n}${eJ(this,"listen",l)}`;if(h.length>14800)return new k.y(e=>e.error(Error("Query too large for listener")));let d=c.events?c.events:["mutation"],p=-1!==d.indexOf("reconnect"),f={};return(i||o)&&(f.withCredentials=!0),i&&(f.headers={Authorization:`Bearer ${i}`}),new k.y(e=>{let t,s,n=!1,i=!1;function o(){n||(p&&e.next({type:"reconnect"}),n||t.readyState!==t.CLOSED||(l(),clearTimeout(s),s=setTimeout(y,100)))}function a(t){e.error(function(e){if(e instanceof Error)return e;let t=e3(e);return t instanceof Error?t:Error(t.error?t.error.description?t.error.description:"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2):t.message||"Unknown listener error")}(t))}function u(t){let r=e3(t);return r instanceof Error?e.error(r):e.next(r)}function c(){n=!0,l(),e.complete()}function l(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",a),t.removeEventListener("disconnect",c),d.forEach(e=>t.removeEventListener(e,u)),t.close())}async function g(){let{default:e}=await r.e(5693).then(r.t.bind(r,75693,19));if(i)return;let t=new e(h,f);return t.addEventListener("error",o),t.addEventListener("channelError",a),t.addEventListener("disconnect",c),d.forEach(e=>t.addEventListener(e,u)),t}function y(){g().then(e=>{e&&(t=e,i&&l())}).catch(t=>{e.error(t),m()})}function m(){n=!0,l(),i=!0}return y(),m})}function e3(e){try{let t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}let e6="2021-03-26";class e9{#a;constructor(e){this.#a=e}events({includeDrafts:e=!1,tag:t}={}){let{apiVersion:s,token:n,withCredentials:i,requestTagPrefix:o}=this.#a.config(),a=s.replace(/^v/,"");if("X"!==a&&a<e6)throw Error(`The live events API requires API version ${e6} or later. The current API version is ${a}. Please update your API version to use this feature.`);if(e&&!n&&!i)throw Error("The live events API requires a token or withCredentials when 'includeDrafts: true'. Please update your client configuration. The token should have the lowest possible access role.");if(e&&"X"!==a)throw Error("The live events API requires API version X when 'includeDrafts: true'. This API is experimental and may change or even be removed.");let u=eJ(this.#a,"live/events"),c=new URL(this.#a.getUrl(u,!1)),l=t&&o?[o,t].join("."):t;l&&c.searchParams.set("tag",l),e&&c.searchParams.set("includeDrafts","true");let h=["restart","message","welcome","reconnect"],d={};return e&&n&&(d.headers={Authorization:`Bearer ${n}`}),e&&i&&(d.withCredentials=!0),new k.y(e=>{let t,s,n=!1,i=!1;function o(r){if(!n){if("data"in r){let t=e5(r);e.error(Error(t.message,{cause:t}))}t.readyState===t.CLOSED&&(u(),clearTimeout(s),s=setTimeout(p,100))}}function a(t){let r=e5(t);return r instanceof Error?e.error(r):e.next(r)}function u(){if(t){for(let e of(t.removeEventListener("error",o),h))t.removeEventListener(e,a);t.close()}}async function l(){let e=typeof EventSource>"u"||d.headers||d.withCredentials?(await r.e(5693).then(r.t.bind(r,75693,19))).default:EventSource;if(i)return;let t=new e(c.toString(),d);for(let e of(t.addEventListener("error",o),h))t.addEventListener(e,a);return t}function p(){l().then(e=>{e&&(t=e,i&&u())}).catch(t=>{e.error(t),f()})}function f(){n=!0,u(),i=!0}return p(),f})}}function e5(e){try{let t=e.data&&JSON.parse(e.data)||{};return{type:e.type,id:e.lastEventId,...t}}catch(e){return e}}class e2{#a;#u;constructor(e,t){this.#a=e,this.#u=t}create(e,t){return e8(this.#a,this.#u,"PUT",e,t)}edit(e,t){return e8(this.#a,this.#u,"PATCH",e,t)}delete(e){return e8(this.#a,this.#u,"DELETE",e)}list(){return eB(this.#a,this.#u,{uri:"/datasets",tag:null})}}class e4{#a;#u;constructor(e,t){this.#a=e,this.#u=t}create(e,t){return(0,N.n)(e8(this.#a,this.#u,"PUT",e,t))}edit(e,t){return(0,N.n)(e8(this.#a,this.#u,"PATCH",e,t))}delete(e){return(0,N.n)(e8(this.#a,this.#u,"DELETE",e))}list(){return(0,N.n)(eB(this.#a,this.#u,{uri:"/datasets",tag:null}))}}function e8(e,t,r,s,n){return Z(s),eB(e,t,{method:r,uri:`/datasets/${s}`,body:n,tag:null})}class e7{#a;#u;constructor(e,t){this.#a=e,this.#u=t}list(e){let t=e?.includeMembers===!1?"/projects?includeMembers=false":"/projects";return eB(this.#a,this.#u,{uri:t})}getById(e){return eB(this.#a,this.#u,{uri:`/projects/${e}`})}}class te{#a;#u;constructor(e,t){this.#a=e,this.#u=t}list(e){let t=e?.includeMembers===!1?"/projects?includeMembers=false":"/projects";return(0,N.n)(eB(this.#a,this.#u,{uri:t}))}getById(e){return(0,N.n)(eB(this.#a,this.#u,{uri:`/projects/${e}`}))}}class tt{#a;#u;constructor(e,t){this.#a=e,this.#u=t}getById(e){return eB(this.#a,this.#u,{uri:`/users/${e}`})}}class tr{#a;#u;constructor(e,t){this.#a=e,this.#u=t}getById(e){return(0,N.n)(eB(this.#a,this.#u,{uri:`/users/${e}`}))}}class ts{assets;datasets;live;projects;users;#c;#u;listen=e1;constructor(e,t=eE){this.config(t),this.#u=e,this.assets=new eX(this,this.#u),this.datasets=new e2(this,this.#u),this.live=new e9(this),this.projects=new e7(this,this.#u),this.users=new tt(this,this.#u)}clone(){return new ts(this.#u,this.config())}config(e){if(void 0===e)return{...this.#c};if(this.#c&&!1===this.#c.allowReconfigure)throw Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.#c=eO(e,this.#c||{}),this}withConfig(e){let t=this.config();return new ts(this.#u,{...t,...e,stega:{...t.stega||{},..."boolean"==typeof e?.stega?{enabled:e.stega}:e?.stega||{}}})}fetch(e,t,r){return eS(this,this.#u,this.#c.stega,e,t,r)}getDocument(e,t){return eP(this,this.#u,e,t)}getDocuments(e,t){return eD(this,this.#u,e,t)}create(e,t){return ez(this,this.#u,e,"create",t)}createIfNotExists(e,t){return ek(this,this.#u,e,t)}createOrReplace(e,t){return eM(this,this.#u,e,t)}delete(e,t){return eN(this,this.#u,e,t)}mutate(e,t){return eU(this,this.#u,e,t)}patch(e,t){return new ec(e,t,this)}transaction(e){return new ef(e,this)}action(e,t){return e_(this,this.#u,e,t)}request(e){return eB(this,this.#u,e)}getUrl(e,t){return eV(this,e,t)}getDataUrl(e,t){return eJ(this,e,t)}}class tn{assets;datasets;live;projects;users;observable;#c;#u;listen=e1;constructor(e,t=eE){this.config(t),this.#u=e,this.assets=new eQ(this,this.#u),this.datasets=new e4(this,this.#u),this.live=new e9(this),this.projects=new te(this,this.#u),this.users=new tr(this,this.#u),this.observable=new ts(e,t)}clone(){return new tn(this.#u,this.config())}config(e){if(void 0===e)return{...this.#c};if(this.#c&&!1===this.#c.allowReconfigure)throw Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),this.#c=eO(e,this.#c||{}),this}withConfig(e){let t=this.config();return new tn(this.#u,{...t,...e,stega:{...t.stega||{},..."boolean"==typeof e?.stega?{enabled:e.stega}:e?.stega||{}}})}fetch(e,t,r){return(0,N.n)(eS(this,this.#u,this.#c.stega,e,t,r))}getDocument(e,t){return(0,N.n)(eP(this,this.#u,e,t))}getDocuments(e,t){return(0,N.n)(eD(this,this.#u,e,t))}create(e,t){return(0,N.n)(ez(this,this.#u,e,"create",t))}createIfNotExists(e,t){return(0,N.n)(ek(this,this.#u,e,t))}createOrReplace(e,t){return(0,N.n)(eM(this,this.#u,e,t))}delete(e,t){return(0,N.n)(eN(this,this.#u,e,t))}mutate(e,t){return(0,N.n)(eU(this,this.#u,e,t))}patch(e,t){return new el(e,t,this)}transaction(e){return new ep(e,this)}action(e,t){return(0,N.n)(e_(this,this.#u,e,t))}request(e){return(0,N.n)(eB(this,this.#u,e))}dataRequest(e,t,r){return(0,N.n)(eL(this,this.#u,e,t,r))}getUrl(e,t){return eV(this,e,t)}getDataUrl(e,t){return eJ(this,e,t)}}let ti=function(e,t){var r;let s=b([D({shouldRetry:Q}),...e,X,{processOptions:e=>{let t=e.body;return!t||"function"==typeof t.pipe||$(t)||-1===j.indexOf(typeof t)&&!Array.isArray(t)&&!function(e){if(!1===O(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!(!1===O(r)||!1===r.hasOwnProperty("isPrototypeOf"))}(t)?e:Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})})}},{onResponse:e=>{let t=e.headers["content-type"]||"",s=r&&r.force||-1!==t.indexOf("application/json");return e.body&&t&&s?Object.assign({},e,{body:function(e){try{return JSON.parse(e)}catch(e){throw e.message=`Failed to parsed response body as JSON: ${e.message}`,e}}(e.body)}):e},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})},{onRequest:e=>{if("xhr"!==e.adapter)return;let t=e.request,r=e.context;function s(e){return t=>{let s=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:s,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=s("upload")),"onprogress"in t&&(t.onprogress=s("download"))}},G,function(e={}){let t=e.implementation||I.Observable;if(!t)throw Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,r)=>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(r),()=>e.abort.publish()))}}({implementation:k.y})]);return{requester:s,createClient:e=>new t((t,r)=>(r||s)({maxRedirects:0,maxRetries:e.maxRetries,retryDelay:e.retryDelay,...t}),e)}}([],tn),to=(ti.requester,ti.createClient)}}]);