@sanity/client 4.0.1-1 → 5.0.0-esm.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs +1335 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.js +1312 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.cjs +1344 -0
- package/dist/index.cjs.js +15 -0
- package/dist/index.cjs.map +1 -0
- package/{sanityClient.d.ts → dist/index.d.ts} +991 -1117
- package/dist/index.js +1321 -0
- package/dist/index.js.map +1 -0
- package/package.json +81 -73
- package/src/SanityClient.ts +1261 -0
- package/src/assets/AssetsClient.ts +164 -0
- package/src/auth/AuthClient.ts +43 -0
- package/src/config.ts +95 -0
- package/src/data/dataMethods.ts +328 -0
- package/src/data/encodeQueryString.ts +28 -0
- package/src/data/listen.ts +195 -0
- package/src/data/patch.ts +353 -0
- package/src/data/transaction.ts +352 -0
- package/src/datasets/DatasetsClient.ts +97 -0
- package/src/generateHelpUrl.ts +5 -0
- package/src/http/browserMiddleware.ts +1 -0
- package/src/http/errors.ts +68 -0
- package/src/http/nodeMiddleware.ts +11 -0
- package/src/http/request.ts +50 -0
- package/src/http/requestOptions.ts +31 -0
- package/src/index.browser.ts +18 -0
- package/src/index.ts +57 -0
- package/src/projects/ProjectsClient.ts +45 -0
- package/src/types.ts +502 -0
- package/src/users/UsersClient.ts +46 -0
- package/src/util/defaults.ts +8 -0
- package/src/util/getSelection.ts +21 -0
- package/src/util/once.ts +12 -0
- package/src/util/pick.ts +9 -0
- package/src/validators.ts +76 -0
- package/src/warnings.ts +25 -0
- package/umd/sanityClient.js +5199 -5302
- package/umd/sanityClient.min.js +13 -13
- package/dist/sanityClient.browser.mjs +0 -2806
- package/dist/sanityClient.browser.mjs.map +0 -7
- package/index.js +0 -7
- package/lib/assets/assetsClient.js +0 -145
- package/lib/auth/authClient.js +0 -26
- package/lib/config.js +0 -88
- package/lib/data/dataMethods.js +0 -205
- package/lib/data/encodeQueryString.js +0 -31
- package/lib/data/listen.js +0 -164
- package/lib/data/patch.js +0 -121
- package/lib/data/transaction.js +0 -117
- package/lib/datasets/datasetsClient.js +0 -41
- package/lib/generateHelpUrl.js +0 -11
- package/lib/http/browserMiddleware.js +0 -9
- package/lib/http/errors.js +0 -56
- package/lib/http/nodeMiddleware.js +0 -22
- package/lib/http/queryString.js +0 -17
- package/lib/http/request.js +0 -52
- package/lib/http/requestOptions.js +0 -30
- package/lib/projects/projectsClient.js +0 -25
- package/lib/sanityClient.js +0 -118
- package/lib/users/usersClient.js +0 -20
- package/lib/util/defaults.js +0 -14
- package/lib/util/getSelection.js +0 -24
- package/lib/util/once.js +0 -20
- package/lib/util/pick.js +0 -17
- package/lib/validators.js +0 -76
- package/lib/warnings.js +0 -27
package/umd/sanityClient.min.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient=t()}(this,(function(){"use strict";function e(e){if("string"==typeof e||Array.isArray(e))return{id:e};if(e&&e.query)return"params"in e?{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${t}`)}const t=["image","file"],r=["before","after","replace"],n=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")},o=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error(`${e}() takes an object of properties`)},s=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_.-]+$/i.test(t))throw new Error(`${e}(): "${t}" is not a valid document ID`)},i=(e,t)=>{if(!t._id)throw new Error(`${e}() requires that the document contains an ID ("_id" property)`);s(e,t._id)},a=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},u=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};function c(e,t={},r=null){this.selection=e,this.operations=Object.assign({},t),this.client=r}Object.assign(c.prototype,{clone(){return new c(this.selection,Object.assign({},this.operations),this.client)},set(e){return this.assign("set",e)},diffMatchPatch(e){return o("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},setIfMissing(e){return this.assign("setIfMissing",e)},replace(e){return o("replace",e),this._set("set",{$:e})},inc(e){return this.assign("inc",e)},dec(e){return this.assign("dec",e)},insert(e,t,n){return((e,t,n)=>{const o="insert(at, selector, items)";if(-1===r.indexOf(e)){const e=r.map((e=>`"${e}"`)).join(", ");throw new Error(`${o} takes an "at"-argument which is one of: ${e}`)}if("string"!=typeof t)throw new Error(`${o} takes a "selector"-argument which must be a string`);if(!Array.isArray(n))throw new Error(`${o} 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",`${e}[-1]`,t)},prepend(e,t){return this.insert("before",`${e}[0]`,t)},splice(e,t,r,n){const o=t<0?t-1:t,s=void 0===r||-1===r?-1:Math.max(0,t+r),i=`${e}[${o}:${o<0&&s>=0?"":s}]`;return this.insert("replace",i,n||[])},ifRevisionId(e){return this.operations.ifRevisionID=e,this},serialize(){return Object.assign(e(this.selection),this.operations)},toJSON(){return this.serialize()},commit(e={}){if(!this.client)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return this.client.mutate({patch:this.serialize()},r)},reset(){return this.operations={},this},_set(e,t){return this.assign(e,t,!1)},assign(e,t,r=!0){return o(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}});const l={returnDocuments:!1};function d(e=[],t,r){this.trxId=r,this.operations=e,this.client=t}Object.assign(d.prototype,{clone(){return new d(this.operations.slice(0),this.client,this.trxId)},create(e){return o("create",e),this._add({create:e})},createIfNotExists(e){const t="createIfNotExists";return o(t,e),i(t,e),this._add({[t]:e})},createOrReplace(e){const t="createOrReplace";return o(t,e),i(t,e),this._add({[t]:e})},delete(e){return s("delete",e),this._add({delete:{id:e}})},patch(e,t){const r="function"==typeof t;if(e instanceof c)return this._add({patch:e.serialize()});if(r){const r=t(new c(e,{},this.client));if(!(r instanceof c))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:Object.assign({id:e},t)})},transactionId(e){return e?(this.trxId=e,this):this.trxId},serialize(){return this.operations.slice()},toJSON(){return this.serialize()},commit(e){if(!this.client)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.client.mutate(this.serialize(),Object.assign({transactionId:this.trxId},l,e||{}))},reset(){return this.operations=[],this},_add(e){return this.operations.push(e),this}});const f=encodeURIComponent;var p=({query:e,params:t={},options:r={}})=>{const{tag:n,...o}=r,s=`query=${f(e)}`,i=n?`?tag=${f(n)}&${s}`:`?${s}`,a=Object.keys(t).reduce(((e,r)=>`${e}&${f(`$${r}`)}=${f(JSON.stringify(t[r]))}`),i);return Object.keys(o).reduce(((e,t)=>r[t]?`${e}&${f(t)}=${f(r[t])}`:e),a)},h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function y(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function g(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];r.push.apply(r,arguments);var n=Function.bind.apply(t,r);return new n}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var m={};
|
|
2
|
-
/** @license
|
|
3
|
-
* eventsource.js
|
|
4
|
-
* Available under MIT License (MIT)
|
|
5
|
-
* https://github.com/Yaffle/EventSource/
|
|
6
|
-
*/
|
|
7
|
-
!function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,s=r.XMLHttpRequest,i=r.XDomainRequest,a=r.ActiveXObject,u=r.EventSource,c=r.document,l=r.Promise,d=r.fetch,f=r.Response,p=r.TextDecoder,h=r.TextEncoder,y=r.AbortController;if("undefined"==typeof window||void 0===c||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(e){c.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=d;d=function(e,t){var r=t.signal;return g(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return r._reader=t,r._aborted&&r._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function m(){this.bitsNeeded=0,this.codePoint=0}m.prototype.decode=function(e){function t(e,t,r){if(1===r)return e>=128>>t&&e<<t<=2047;if(2===r)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===r)return e>=65536>>t&&e<<t<=1114111;throw new Error}function r(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var n=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var u=e[a];0!==s&&(u<128||u>191||!t(i<<6|63&u,s-6,r(s,i)))&&(s=0,i=n,o+=String.fromCharCode(i)),0===s?(u>=0&&u<=127?(s=0,i=u):u>=192&&u<=223?(s=6,i=31&u):u>=224&&u<=239?(s=12,i=15&u):u>=240&&u<=247?(s=18,i=7&u):(s=0,i=n),0===s||t(i,s,r(s,i))||(s=0,i=n)):(s-=6,i=i<<6|63&u),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!=h&&function(){try{return"test"===(new p).decode((new h).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=m);var v=function(){};function b(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 w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),s=o.shift(),i=o.join(": ");t[w(s)]=i}this._map=t}function O(){}function _(e){this._headers=e}function x(){}function E(){this._listeners=Object.create(null)}function j(e){n((function(){throw e}),0)}function T(e){this.type=e,this.target=void 0}function S(e,t){T.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){T.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function P(e,t){T.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var r=this,i=this._xhr,a=1,u=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,i.abort(),0!==u&&(o(u),u=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var c=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in i)e=200,t="OK",n=i.contentType;else try{e=i.status,t=i.statusText,n=i.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(a=2,r.readyState=2,r.status=e,r.statusText=t,r._contentType=n,r.onreadystatechange())}},l=function(){if(c(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},d=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==u&&(o(u),u=0),r.readyState=4,"load"===e)r.onload(t);else if("error"===e)r.onerror(t);else{if("abort"!==e)throw new TypeError;r.onabort(t)}r.onreadystatechange()}},f=function(){u=n((function(){f()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(e){d("load",e)}),"onerror"in i&&(i.onerror=function(e){d("error",e)}),"onabort"in i&&(i.onabort=function(e){d("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||d(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||l():2===i.readyState&&c())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(u=n((function(){f()}),0))},b.prototype.abort=function(){this._abort(!1)},b.prototype.getResponseHeader=function(e){return this._contentType},b.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},b.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},b.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==c||null==c.readyState||"complete"===c.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=n((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[w(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),O.prototype.open=function(e,t,r,n,o,i,a){e.open("GET",o);var u=0;for(var c in e.onprogress=function(){var t=e.responseText.slice(u);u+=t.length,r(t)},e.onerror=function(e){e.preventDefault(),n(new Error("NetworkError"))},e.onload=function(){n(null)},e.onabort=function(){n(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(r,n,o,new C(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},_.prototype.get=function(e){return this._headers.get(e)},x.prototype.open=function(e,t,r,n,o,s,i){var a=null,u=new y,c=u.signal,f=new p;return d(o,{headers:i,credentials:s?"include":"same-origin",signal:c,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new _(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=f.decode(t.value,{stream:!0});r(o),n()}})).catch((function(e){t(e)}))};n()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){n(e)})),{abort:function(){null!=a&&a.cancel(),u.abort()}}},E.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var r=t.length,n=0;n<r;n+=1){var o=t[n];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){j(e)}}},E.prototype.addEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];null==n&&(n=[],r[e]=n);for(var o=!1,s=0;s<n.length;s+=1)n[s]===t&&(o=!0);o||n.push(t)},E.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],s=0;s<n.length;s+=1)n[s]!==t&&o.push(n[s]);0===o.length?delete r[e]:r[e]=o}},S.prototype=Object.create(T.prototype),A.prototype=Object.create(T.prototype),P.prototype=Object.create(T.prototype);var F=-1,I=-1,R=/^text\/event\-stream(;.*)?$/i,$=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),q(r)},q=function(e){return Math.min(Math.max(e,1e3),18e6)},D=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){j(e)}};function k(e,t){E.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,r){t=String(t);var a=Boolean(r.withCredentials),u=r.lastEventIdQueryParameterName||"lastEventId",c=q(1e3),l=$(r.heartbeatTimeout,45e3),d="",f=c,p=!1,h=0,y=r.headers||{},g=r.Transport,m=N&&null==g?void 0:new b(null!=g?new g:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=g&&"string"!=typeof g?new g:null==m?new x:new O,w=void 0,C=0,_=F,E="",j="",T="",k="",U=0,M=0,H=0,z=function(t,r,n,o){if(0===_)if(200===t&&null!=n&&R.test(n)){_=1,p=Date.now(),f=c,e.readyState=1;var s=new A("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),D(e,e.onopen,s)}else{var i="";200!==t?(r&&(r=r.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",V();s=new A("error",{status:t,statusText:r,headers:o});e.dispatchEvent(s),D(e,e.onerror,s),console.error(i)}},L=function(t){if(1===_){for(var r=-1,s=0;s<t.length;s+=1){(u=t.charCodeAt(s))!=="\n".charCodeAt(0)&&u!=="\r".charCodeAt(0)||(r=s)}var i=(-1!==r?k:"")+t.slice(0,r+1);k=(-1===r?k:"")+t.slice(r+1),""!==t&&(p=Date.now(),h+=t.length);for(var a=0;a<i.length;a+=1){var u=i.charCodeAt(a);if(U===I&&u==="\n".charCodeAt(0))U=0;else if(U===I&&(U=0),u==="\r".charCodeAt(0)||u==="\n".charCodeAt(0)){if(0!==U){1===U&&(H=a+1);var y=i.slice(M,H-1),g=i.slice(H+(H<a&&i.charCodeAt(H)===" ".charCodeAt(0)?1:0),a);"data"===y?(E+="\n",E+=g):"id"===y?j=g:"event"===y?T=g:"retry"===y?(c=$(g,c),f=c):"heartbeatTimeout"===y&&(l=$(g,l),0!==C&&(o(C),C=n((function(){X()}),l)))}if(0===U){if(""!==E){d=j,""===T&&(T="message");var m=new S(T,{data:E.slice(1),lastEventId:j});if(e.dispatchEvent(m),"open"===T?D(e,e.onopen,m):"message"===T?D(e,e.onmessage,m):"error"===T&&D(e,e.onerror,m),2===_)return}E="",T=""}U=u==="\r".charCodeAt(0)?I:0}else 0===U&&(M=a,U=1),1===U?u===":".charCodeAt(0)&&(H=a+1,U=2):2===U&&(U=3)}}},B=function(t){if(1===_||0===_){_=F,0!==C&&(o(C),C=0),C=n((function(){X()}),f),f=q(Math.min(16*c,2*f)),e.readyState=0;var r=new P("error",{error:t});e.dispatchEvent(r),D(e,e.onerror,r),null!=t&&console.error(t)}},V=function(){_=2,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=2},X=function(){if(C=0,_===F){p=!1,h=0,C=n((function(){X()}),l),_=0,E="",T="",j=d,k="",M=0,H=0,U=0;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==d){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===u?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+u+"="+encodeURIComponent(d)}var s=e.withCredentials,i={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(i[c]=a[c]);try{w=v.open(m,z,L,B,r,s,i)}catch(e){throw V(),e}}else if(p||null==w){var f=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=n((function(){X()}),f)}else B(new Error("No activity within "+l+" milliseconds. "+(0===_?"No response received.":h+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=V,X()}(this,e,t)}var N=null!=d&&null!=f&&"body"in f.prototype;k.prototype=Object.create(E.prototype),k.prototype.CONNECTING=0,k.prototype.OPEN=1,k.prototype.CLOSED=2,k.prototype.close=function(){this._close()},k.CONNECTING=0,k.OPEN=1,k.CLOSED=2,k.prototype.withCredentials=void 0;var U,M=u;null==s||null!=u&&"withCredentials"in u.prototype||(M=k),U=function(e){e.EventSourcePolyfill=k,e.NativeEventSource=u,e.EventSource=M}(t),void 0!==U&&(e.exports=U)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:h:globalThis)}({get exports(){return m},set exports(e){m=e}},m);var v=m.EventSourcePolyfill,b=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{}),w=function(e,t){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},w(e,t)};function C(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}w(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function O(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function x(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function E(e){return"function"==typeof e}function j(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var T=j((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function S(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var A=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=O(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 u=this.initialTeardown;if(E(u))try{u()}catch(e){o=e instanceof T?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=O(c),d=l.next();!d.done;d=l.next()){var f=d.value;try{F(f)}catch(e){o=null!=o?o:[],e instanceof T?o=x(x([],_(o)),_(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new T(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)F(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&S(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&S(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function P(e){return e instanceof A||e&&"closed"in e&&E(e.remove)&&E(e.add)&&E(e.unsubscribe)}function F(e){E(e)?e():e.unsubscribe()}A.EMPTY;var I={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},R={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=R.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,x([e,t],_(r))):setTimeout.apply(void 0,x([e,t],_(r)))},clearTimeout:function(e){var t=R.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function $(){}var q=null;var D=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,P(t)&&t.add(r)):r.destination=z,r}return C(t,e),t.create=function(e,t,r){return new M(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(A),k=Function.prototype.bind;function N(e,t){return k.call(e,t)}var U=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){H(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){H(e)}else H(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){H(e)}},e}(),M=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;E(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&I.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&N(t.next,s),error:t.error&&N(t.error,s),complete:t.complete&&N(t.complete,s)}):o=t;return i.destination=new U(o),i}return C(t,e),t}(D);function H(e){var t;t=e,R.setTimeout((function(){throw t}))}var z={closed:!0,next:$,error:function(e){throw e},complete:$},L="function"==typeof Symbol&&Symbol.observable||"@@observable";function B(e){return e}function V(e){return 0===e.length?B:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var X=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof D||function(e){return e&&E(e.next)&&E(e.error)&&E(e.complete)}(n)&&P(n)?e:new M(e,t,r);return function(e){if(I.useDeprecatedSynchronousErrorHandling){var t=!q;if(t&&(q={errorThrown:!1,error:null}),e(),t){var r=q,n=r.errorThrown,o=r.error;if(q=null,n)throw o}}else e()}((function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))})),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=J(t))((function(t,n){var o=new M({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[L]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return V(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=J(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function J(e){var t;return null!==(t=null!=e?e:I.Promise)&&void 0!==t?t:Promise}function G(e){return function(t){if(function(e){return E(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 Y(e,t,r,n,o){return new Z(e,t,r,n,o)}var Z=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return C(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(D),K=j((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Q(e,t){var r="object"==typeof t;return new Promise((function(n,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new K)}})}))}function W(e,t){return G((function(r,n){var o=0;r.subscribe(Y(n,(function(r){n.next(e.call(t,r,o++))})))}))}function ee(e,t){return G((function(r,n){var o=0;r.subscribe(Y(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}const te=v,re=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],ne={includeResult:!0};function oe(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}const se=(e={})=>{return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:void 0===t?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},ie=e=>"response"===e.type,ae=e=>e.body;var ue={listen:function(e,t,r={}){const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.clientConfig,a=r.tag&&i?[i,r.tag].join("."):r.tag,u={...b(r,ne),tag:a},c=(l=u,re.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const d=p({query:e,params:t,options:c,tag:a}),f=`${n}${this.getDataUrl("listen",d)}`;if(f.length>14800)return new X((e=>e.error(new Error("Query too large for listener"))));const h=u.events?u.events:["mutation"],y=-1!==h.indexOf("reconnect"),g={};return(o||s)&&(g.withCredentials=!0),o&&(g.headers={Authorization:`Bearer ${o}`}),new X((e=>{let t,r=c(),n=!1;function o(){n||(y&&e.next({type:"reconnect"}),n||r.readyState===te.CLOSED&&(u(),clearTimeout(t),t=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=oe(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function i(t){const r=oe(t);return r instanceof Error?e.error(r):e.next(r)}function a(t){n=!0,u(),e.complete()}function u(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",s,!1),r.removeEventListener("disconnect",a,!1),h.forEach((e=>r.removeEventListener(e,i,!1))),r.close()}function c(){const e=new te(f,g);return e.addEventListener("error",o,!1),e.addEventListener("channelError",s,!1),e.addEventListener("disconnect",a,!1),h.forEach((t=>e.addEventListener(t,i,!1))),e}function l(){r=c()}return function(){n=!0,u()}}))},getDataUrl(e,t){const r=this.clientConfig,n=`/${e}/${a(r)}`;return`/data${t?`${n}/${t}`:n}`.replace(/\/($|\?)/,"$1")},fetch(e,t,r={}){const n=!1===r.filterResponse?e=>e:e=>e.result,o=this._dataRequest("query",{query:e,params:t},r).pipe(W(n));return this.isPromiseAPI()?Q(o):o},getDocument(e,t={}){const r={uri:this.getDataUrl("doc",e),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(ee(ie),W((e=>e.body.documents&&e.body.documents[0])));return this.isPromiseAPI()?Q(n):n},getDocuments(e,t={}){const r={uri:this.getDataUrl("doc",e.join(",")),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(ee(ie),W((t=>{const r=(n=t.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return e.map((e=>r[e]||null))})));return this.isPromiseAPI()?Q(n):n},create(e,t){return this._create(e,"create",t)},createIfNotExists(e,t){return i("createIfNotExists",e),this._create(e,"createIfNotExists",t)},createOrReplace(e,t){return i("createOrReplace",e),this._create(e,"createOrReplace",t)},patch(e,t){return new c(e,t,this)},delete(t,r){return this.dataRequest("mutate",{mutations:[{delete:e(t)}]},r)},mutate(e,t){const r=e instanceof c||e instanceof d?e.serialize():e,n=Array.isArray(r)?r:[r],o=t&&t.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:o},t)},transaction(e){return new d(e,this)},dataRequest(e,t,r={}){const n=this._dataRequest(e,t,r);return this.isPromiseAPI()?Q(n):n},_dataRequest(e,t,r={}){const n="mutate"===e,o="query"===e,s=!n&&p(t),i=!n&&s.length<11264,a=i?s:"",u=r.returnFirst,{timeout:c,token:l,tag:d,headers:f}=r,h={method:i?"GET":"POST",uri:this.getDataUrl(e,a),json:!0,body:i?void 0:t,query:n&&se(r),timeout:c,headers:f,token:l,tag:d,canUseCdn:o};return this._requestObservable(h).pipe(ee(ie),W(ae),W((e=>{if(!n)return e;const t=e.results||[];if(r.returnDocuments)return u?t[0]&&t[0].document:t.map((e=>e.document));const o=u?"documentId":"documentIds",s=u?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[o]:s}})))},_create(e,t,r={}){const n={[t]:e},o=Object.assign({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},o)}};function ce(e){this.request=e.request.bind(e)}function le(e){this.client=e}Object.assign(ce.prototype,{create(e,t){return this._modify("PUT",e,t)},edit(e,t){return this._modify("PATCH",e,t)},delete(e){return this._modify("DELETE",e)},list(){return this.request({uri:"/datasets"})},_modify(e,t,r){return n(t),this.request({method:e,uri:`/datasets/${t}`,body:r})}}),Object.assign(le.prototype,{list(){return this.client.request({uri:"/projects"})},getById(e){return this.client.request({uri:`/projects/${e}`})}});function de(e){this.client=e}function fe(e){this.client=e}function pe(e){this.client=e}Object.assign(de.prototype,{upload(e,r,n={}){(e=>{if(-1===t.indexOf(e))throw new Error(`Invalid asset type: ${e}. Must be one of ${t.join(", ")}`)})(e);let o=n.extract||void 0;o&&!o.length&&(o=["none"]);const s=a(this.client.clientConfig),i="image"===e?"images":"files",u=function(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}(n,r),{tag:c,label:l,title:d,description:f,creditLine:p,filename:h,source:y}=u,g={label:l,title:d,description:f,filename:h,meta:o,creditLine:p};y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url);const m=this.client._requestObservable({tag:c,method:"POST",timeout:u.timeout||0,uri:`/assets/${i}/${s}`,headers:u.contentType?{"Content-Type":u.contentType}:{},query:g,body:r});return this.client.isPromiseAPI()?Q(m.pipe(ee((e=>"response"===e.type)),W((e=>e.body.document)))):m},delete(e,t){console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");let r=t||"";return/^(image|file)-/.test(r)?e._id&&(r=e._id):r=`${e}-${r}`,a(this.client.clientConfig),this.client.delete(r)},getImageUrl(e,t){const r=e._ref||e;if("string"!=typeof r)throw new Error("getImageUrl() needs either an object with a _ref, or a string with an asset document ID");if(!/^image-[A-Za-z0-9_]+-\d+x\d+-[a-z]{1,5}$/.test(r))throw new Error(`Unsupported asset ID "${r}". URL generation only works for auto-generated IDs.`);const[,n,o,s]=r.split("-");a(this.client.clientConfig);const{projectId:i,dataset:u}=this.client.clientConfig;return`https://cdn.sanity.io/images/${i}/${u}/${n}-${o}.${s}${t?(e=>{const t=[];for(const r in e)e.hasOwnProperty(r)&&t.push(`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`);return t.length>0?`?${t.join("&")}`:""})(t):""}`}}),Object.assign(fe.prototype,{getById(e){return this.client.request({uri:`/users/${e}`})}}),Object.assign(pe.prototype,{getLoginProviders(){return this.client.request({uri:"/auth/providers"})},logout(){return this.client.request({uri:"/auth/logout",method:"POST"})}});var he={},ye={get exports(){return he},set exports(e){he=e}};var ge=g(Object.freeze({__proto__:null,default:function(){var e=Object.create(null),t=0;return{publish:function(t){for(var r in e)e[r](t)},subscribe:function(r){var n=t++;return e[n]=r,function(){delete e[n]}}}}})),me={};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e){return function(t,r){for(var n="onError"===t,o=r,s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(var u=0;u<e[t].length;u++){var c=e[t][u];if(o=c.apply(void 0,[o].concat(i)),n&&!o)break}return o}},e.exports=t.default}({get exports(){return me},set exports(e){me=e}},me);var ve={},be={get exports(){return ve},set exports(e){ve=e}},we={},Ce=Object.prototype.hasOwnProperty;function Oe(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function _e(e){try{return encodeURIComponent(e)}catch(e){return null}}we.stringify=function(e,t){t=t||"";var r,n,o=[];for(n in"string"!=typeof t&&(t="?"),e)if(Ce.call(e,n)){if((r=e[n])||null!=r&&!isNaN(r)||(r=""),n=_e(n),r=_e(r),null===n||null===r)continue;o.push(n+"="+r)}return o.length?t+o.join("&"):""},we.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var o=Oe(t[1]),s=Oe(t[2]);null===o||null===s||o in n||(n[o]=s)}return n};var xe=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},Ee=we,je=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Te=/[\n\r\t]/g,Se=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Ae=/:\d+$/,Pe=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Fe=/^[a-zA-Z]:/;function Ie(e){return(e||"").toString().replace(je,"")}var Re=[["#","hash"],["?","query"],function(e,t){return De(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]],$e={hash:1,query:1};function qe(e){var t,r=("undefined"!=typeof window?window:void 0!==h?h:"undefined"!=typeof self?self:{}).location||{},n={},o=typeof(e=e||r);if("blob:"===e.protocol)n=new Ne(unescape(e.pathname),{});else if("string"===o)for(t in n=new Ne(e,{}),$e)delete n[t];else if("object"===o){for(t in e)t in $e||(n[t]=e[t]);void 0===n.slashes&&(n.slashes=Se.test(e.href))}return n}function De(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function ke(e,t){e=(e=Ie(e)).replace(Te,""),t=t||{};var r,n=Pe.exec(e),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)):De(o)?r=n[4]:o?s&&(r=r.slice(2)):a>=2&&De(t.protocol)&&(r=n[4]),{protocol:o,slashes:s||De(o),slashesCount:a,rest:r}}function Ne(e,t,r){if(e=(e=Ie(e)).replace(Te,""),!(this instanceof Ne))return new Ne(e,t,r);var n,o,s,i,a,u,c=Re.slice(),l=typeof t,d=this,f=0;for("object"!==l&&"string"!==l&&(r=t,t=null),r&&"function"!=typeof r&&(r=Ee.parse),n=!(o=ke(e||"",t=qe(t))).protocol&&!o.slashes,d.slashes=o.slashes||n&&t.slashes,d.protocol=o.protocol||t.protocol||"",e=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||Fe.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!De(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);f<c.length;f++)"function"!=typeof(i=c[f])?(s=i[0],u=i[1],s!=s?d[u]=e:"string"==typeof s?~(a="@"===s?e.lastIndexOf(s):e.indexOf(s))&&("number"==typeof i[2]?(d[u]=e.slice(0,a),e=e.slice(a+i[2])):(d[u]=e.slice(a),e=e.slice(0,a))):(a=s.exec(e))&&(d[u]=a[1],e=e.slice(0,a.index)),d[u]=d[u]||n&&i[3]&&t[u]||"",i[4]&&(d[u]=d[u].toLowerCase())):e=i(e,d);r&&(d.query=r(d.query)),n&&t.slashes&&"/"!==d.pathname.charAt(0)&&(""!==d.pathname||""!==t.pathname)&&(d.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.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("/")}(d.pathname,t.pathname)),"/"!==d.pathname.charAt(0)&&De(d.protocol)&&(d.pathname="/"+d.pathname),xe(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(~(a=d.auth.indexOf(":"))?(d.username=d.auth.slice(0,a),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(a+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin="file:"!==d.protocol&&De(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}Ne.prototype={set:function(e,t,r){var n=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||Ee.parse)(t)),n[e]=t;break;case"port":n[e]=t,xe(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,Ae.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var o="pathname"===e?"/":"#";n[e]=t.charAt(0)!==o?o+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var s=t.indexOf(":");~s?(n.username=t.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var i=0;i<Re.length;i++){var a=Re[i];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&De(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(e){e&&"function"==typeof e||(e=Ee.stringify);var t,r=this,n=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var s=o+(r.protocol&&r.slashes||De(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):"file:"!==r.protocol&&De(r.protocol)&&!n&&"/"!==r.pathname&&(s+="@"),(":"===n[n.length-1]||Ae.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(s+=r.hash),s}},Ne.extractProtocol=ke,Ne.location=qe,Ne.trimLeft=Ie,Ne.qs=Ee;var Ue=Ne;!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n=(r=Ue)&&r.__esModule?r:{default:r};function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}var s="undefined"!=typeof navigator&&"ReactNative"===navigator.product,i=Object.prototype.hasOwnProperty,a={timeout:s?6e4:12e4};function u(e){var t=[];for(var r in e)i.call(e,r)&&n(r,e[r]);return t.length?t.join("&"):"";function n(e,r){Array.isArray(r)?r.forEach((function(t){return n(e,t)})):t.push([e,r].map(encodeURIComponent).join("="))}}function c(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;var t=Number(e);return isNaN(t)?c(a.timeout):{connect:t,socket:t}}t.default=function(e){var t="string"==typeof e?o({url:e},a):o({},a,e),r=(0,n.default)(t.url,{},!0);return t.timeout=c(t.timeout),t.query&&(r.query=o({},r.query,function(e){var t={};for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}(t.query))),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=r.toString(u),t},e.exports=t.default}(be,ve);var Me={};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=/^https?:\/\//i;t.default=function(e){if(!r.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))},e.exports=t.default}({get exports(){return Me},set exports(e){Me=e}},Me);var He={},ze={get exports(){return He},set exports(e){He=e}},Le={},Be={get exports(){return Le},set exports(e){Le=e}},Ve=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/,Xe={regex:Ve,parse:function(e){var t=Ve.exec(e);return t?{protocol:(t[1]||"").toLowerCase()||void 0,hostname:(t[5]||"").toLowerCase()||void 0,port:t[6]||void 0}:{}}},Je=Xe,Ge=function(e,t,r){if(e===t)return!0;var n=Je.parse(e,!1,!0),o=Je.parse(t,!1,!0),s=0|n.port||("https"===n.protocol?443:80),i=0|o.port||("https"===o.protocol?443:80),a={proto:n.protocol===o.protocol,hostname:n.hostname===o.hostname,port:s===i};return a.proto&&a.hostname&&(a.port||r)},Ye=function(e){return e.replace(/^\s+|\s+$/g,"")},Ze=function(e){if(!e)return{};for(var t,r={},n=Ye(e).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),a=Ye(s.slice(0,i)).toLowerCase(),u=Ye(s.slice(i+1));void 0===r[a]?r[a]=u:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(u):r[a]=[r[a],u])}return r},Ke={};!function(e,t){function r(){this.readyState=0}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,r.prototype.open=function(e,t){this._method=e,this._url=t,this._resHeaders="",this.readyState=1,this.onreadystatechange()},r.prototype.abort=function(){this._controller&&this._controller.abort()},r.prototype.getAllResponseHeaders=function(){return this._resHeaders},r.prototype.setRequestHeader=function(e,t){this._headers=this._headers||{},this._headers[e]=t},r.prototype.send=function(e){var t=this,r=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,o={method:this._method,headers:this._headers,signal:r&&r.signal||void 0,body:e};"undefined"!=typeof document&&(o.credentials=this.withCredentials?"include":"omit"),fetch(this._url,o).then((function(e){return e.headers.forEach((function(e,r){t._resHeaders+="".concat(r,": ").concat(e,"\r\n")})),t.status=e.status,t.statusText=e.statusText,t.readyState=3,n?e.text():e.arrayBuffer()})).then((function(e){n?t.responseText=e:t.response=e,t.readyState=4,t.onreadystatechange()})).catch((function(e){"AbortError"!==e.name?t.onerror(e):t.onabort()}))};var n=r;t.default=n,e.exports=t.default}({get exports(){return Ke},set exports(e){Ke=e}},Ke),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(Ge),n=s(Ze),o=s(Ke);function s(e){return e&&e.__esModule?e:{default:e}}var i="undefined"==typeof document||"undefined"==typeof window?void 0:window,a=i?"xhr":"fetch",u="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){},c="withCredentials"in new u,l="undefined"==typeof XDomainRequest?void 0:XDomainRequest,d=c?u:l;i||(u=o.default,d=o.default);t.default=function(e,t){var o=e.options,s=e.applyMiddleware("finalizeOptions",o),c={},l=i&&i.location&&!(0,r.default)(i.location.href,s.url),f=e.applyMiddleware("interceptRequest",void 0,{adapter:a,context:e});if(f){var p=setTimeout(t,0,null,f);return{abort:function(){return clearTimeout(p)}}}var h=l?new d:new u,y=i&&i.XDomainRequest&&h instanceof i.XDomainRequest,g=s.headers,m=s.timeout,v=!1,b=!1,w=!1;if(h.onerror=x,h.ontimeout=x,h.onabort=function(){_(!0),v=!0},h.onprogress=function(){},h[y?"onload":"onreadystatechange"]=function(){!function(){if(!m)return;_(),c.socket=setTimeout((function(){return O("ESOCKETTIMEDOUT")}),m.socket)}(),v||4!==h.readyState&&!y||0!==h.status&&function(){if(v||b||w)return;if(0===h.status)return void x(new Error("Unknown XHR error"));_(),b=!0,t(null,function(){var e=h.status,t=h.statusText;if(y&&void 0===e)e=200;else{if(e>12e3&&e<12156)return x();e=1223===h.status?204:h.status,t=1223===h.status?"No Content":t}return{body:h.response||h.responseText,url:s.url,method:s.method,headers:y?{}:(0,n.default)(h.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())}()},h.open(s.method,s.url,!0),h.withCredentials=!!s.withCredentials,g&&h.setRequestHeader)for(var C in g)g.hasOwnProperty(C)&&h.setRequestHeader(C,g[C]);else if(g&&y)throw new Error("Headers cannot be set on an XDomainRequest object");return s.rawBody&&(h.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:s,adapter:a,request:h,context:e}),h.send(s.body||null),m&&(c.connect=setTimeout((function(){return O("ETIMEDOUT")}),m.connect)),{abort:function(){v=!0,h&&h.abort()}};function O(t){w=!0,h.abort();var r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(s.url):"Connection timed out on request to ".concat(s.url));r.code=t,e.channels.error.publish(r)}function _(e){(e||v||h.readyState>=2&&c.connect)&&clearTimeout(c.connect),c.socket&&clearTimeout(c.socket)}function x(e){if(!b){_(!0),b=!0,h=null;var r=e||new Error("Network error while attempting to reach ".concat(s.url));r.isNetworkError=!0,r.request=s,t(r)}}},e.exports=t.default}(Be,Le),function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=((r=Le)&&r.__esModule?r:{default:r}).default;t.default=n,e.exports=t.default}(ze,He),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.default,a=[],d=l.reduce((function(e,t){return e[t]=e[t]||[],e}),{processOptions:[o.default],validateOptions:[s.default]});function f(e){var t=c.reduce((function(e,t){return e[t]=u(),e}),{}),o=(0,n.default)(d),s=o("processOptions",e);o("validateOptions",s);var i={options:s,channels:t,applyMiddleware:o},a=null,l=t.request.subscribe((function(e){a=r(e,(function(r,n){return function(e,r,n){var s=e,i=r;if(!s)try{i=o("onResponse",r,n)}catch(e){i=null,s=e}s=s&&o("onError",s,n),s?t.error.publish(s):i&&t.response.publish(i)}(r,n,e)}))}));t.abort.subscribe((function(){l(),a&&a.abort()}));var f=o("onReturn",t,i);return f===t&&t.request.publish(i),f}return f.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&&d.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return l.forEach((function(t){e[t]&&d[t].push(e[t])})),a.push(e),f},f.clone=function(){return e(a)},t.forEach(f.use),f};var r=a(ge),n=a(me),o=a(ve),s=a(Me),i=a(He);function a(e){return e&&e.__esModule?e:{default:e}}var u="default"in r.default?r.default.default:r.default,c=["request","response","progress","error","abort"],l=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=t.default}(ye,he);var Qe=y(he);function We(e){return"[object Object]"===Object.prototype.toString.call(e)}
|
|
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 A(e){if(!S.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))}var R=function(e){return e.replace(/^\s+|\s+$/g,"")},I=function(e){if(!e)return{};for(var t,n={},r=R(e).split("\n"),o=0;o<r.length;o++){var s=r[o],i=s.indexOf(":"),a=R(s.slice(0,i)).toLowerCase(),c=R(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},q=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/,F={regex:q,parse:function(e){var t=q.exec(e);return t?{protocol:(t[1]||"").toLowerCase()||void 0,hostname:(t[5]||"").toLowerCase()||void 0,port:t[6]||void 0}:{}}},k=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:[A]});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 U(){this.readyState=0}U.prototype.open=function(e,t){this._method=e,this._url=t,this._resHeaders="",this.readyState=1,this.onreadystatechange()},U.prototype.abort=function(){this._controller&&this._controller.abort()},U.prototype.getAllResponseHeaders=function(){return this._resHeaders},U.prototype.setRequestHeader=function(e,t){this._headers=this._headers||{},this._headers[e]=t},U.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 M="undefined"==typeof document||"undefined"==typeof window?void 0:window,H=M?"xhr":"fetch";let z="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){};const L="withCredentials"in new z,B="undefined"==typeof XDomainRequest?void 0:XDomainRequest;let $=L?z:B;M||(z=U,$=U);var W=(e,t)=>{const n=e.options,r=e.applyMiddleware("finalizeOptions",n),o={},s=M&&M.location&&!function(e,t,n){if(e===t)return!0;var r=k.parse(e,!1,!0),o=k.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)}(M.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=M&&M.XDomainRequest&&a instanceof M.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?{}:I(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}})};
|
|
8
2
|
/*!
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var et=Object.create,tt=Object.defineProperty,rt=Object.getOwnPropertyDescriptor,nt=Object.getOwnPropertyNames,ot=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty,it=(e,t)=>function(){return t||(0,e[nt(e)[0]])((t={exports:{}}).exports,t),t.exports},at=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of nt(t))st.call(e,o)||o===r||tt(e,o,{get:()=>t[o],enumerable:!(n=rt(t,o))||n.enumerable});return e},ut=(e,t,r)=>(r=null!=e?et(ot(e)):{},at(!t&&e&&e.__esModule?r:tt(r,"default",{value:e,enumerable:!0}),e)),ct=it({"node_modules/form-urlencoded/dist/form-urlencoded.js"(e,t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Boolean(t.sorted),o=Boolean(t.skipIndex),s=Boolean(t.ignorenull),i=function(e){return String(e).replace(/(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,(function(e){return"%"+e.charCodeAt().toString(16).slice(-2).toUpperCase()}))},a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(e);return n?t.sort():t},u=function(e){return e.filter((function(e){return e})).join("&")},c=function(e,t){return u(a(t).map((function(r){return d(e+"["+r+"]",t[r])})))},l=function(e,t){return t.length?u(t.map((function(t,r){return d(o?e+"[]":e+"["+r+"]",t)}))):i(e+"[]")},d=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0===t?"undefined":r(t),o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return t===o?o=s?o:i(e)+"="+o:/string|number|boolean/.test(n)?o=i(e)+"="+i(t):Array.isArray(t)?o=l(e,t):"object"===n&&(o=c(e,t)),o};return e&&u(a(e).map((function(t){return d(t,e[t])})))}}}),lt=ut(ct());lt.default.default||lt.default;var dt=["boolean","string","number"];function ft(e){try{return JSON.parse(e)}catch(e){throw e.message=`Failed to parsed response body as JSON: ${e.message}`,e}}var pt,ht="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},yt={};function gt(e){this.message=e}((e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})})(yt,{default:()=>pt});var mt,vt,bt=(mt={"src/middleware/cancel/Cancel.js"(){gt.prototype.toString=function(){return"Cancel"+(this.message?`: ${this.message}`:"")},gt.prototype.__CANCEL__=!0,pt=gt}},function(){return mt&&(vt=(0,mt[nt(mt)[0]])(mt=0)),vt});bt();var wt,Ct=(bt(),wt=yt,at(tt({},"__esModule",{value:!0}),wt));function Ot(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 Ct(e),t(this.reason))}))}Ot.source=function(){let e;return{token:new Ot((t=>{e=t})),cancel:e}};var _t=it({"node_modules/ms/index.js"(e,t){var r=1e3,n=60*r,o=60*n,s=24*o,i=7*s,a=365.25*s;function u(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}t.exports=function(e,t){t=t||{};var c=typeof e;if("string"===c&&e.length>0)return function(e){if((e=String(e)).length>100)return;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)return;var u=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"weeks":case"week":case"w":return u*i;case"days":case"day":case"d":return u*s;case"hours":case"hour":case"hrs":case"hr":case"h":return u*o;case"minutes":case"minute":case"mins":case"min":case"m":return u*n;case"seconds":case"second":case"secs":case"sec":case"s":return u*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(e);if("number"===c&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=s)return u(e,t,s,"day");if(t>=o)return u(e,t,o,"hour");if(t>=n)return u(e,t,n,"minute");if(t>=r)return u(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=s)return Math.round(e/s)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=n)return Math.round(e/n)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}}),xt=it({"node_modules/debug/src/common.js"(e,t){t.exports=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=_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),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}}});ut(it({"node_modules/debug/src/browser.js"(e,t){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,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),e.splice(o,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(e){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(e){}0;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(e){}}(),e.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`."))}})(),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=xt()(e);var{formatters:r}=t.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}})());var Et=it({"node_modules/capture-stack-trace/index.js"(e,t){t.exports=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}})}}}),jt=it({"node_modules/create-error-class/index.js"(e,t){var r=Et();t.exports=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,o,s=function(){Object.defineProperty(this,"name",{configurable:!0,value:e,writable:!0}),r(this,this.constructor),t.apply(this,arguments)};return n=s,o=Error,n.super_=o,n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s}}});(0,ut(jt()).default)("HttpError",(function(e,t){const r=e.url.length>400?`${e.url.slice(0,399)}…`:e.url;let n=`${e.method}-request to ${r} resulted in `;n+=`HTTP ${e.statusCode} ${e.statusMessage}`,this.message=n.trim(),this.response=e,this.request=t.options}));var Tt={};!function(e,t){var r="undefined"!=typeof Reflect?Reflect.construct:void 0,n=Object.defineProperty,o=Error.captureStackTrace;function s(e){void 0!==e&&n(this,"message",{configurable:!0,value:e,writable:!0});var t=this.constructor.name;void 0!==t&&t!==this.name&&n(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor)}void 0===o&&(o=function(e){var t=new Error;n(e,"stack",{configurable:!0,get:function(){var e=t.stack;return n(this,"stack",{configurable:!0,value:e,writable:!0}),e},set:function(t){n(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 n(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 n;if("string"==typeof e)n=e,e=void 0!==r?function(){return r(t,arguments,this.constructor)}:function(){t.apply(this,arguments)},void 0!==i&&(i(e,n),n=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!==n&&(o.name={configurable:!0,value:n,writable:!0}),e.prototype=Object.create(t.prototype,o),e},t.BaseError=s}({get exports(){return Tt},set exports(e){Tt=e}},Tt);var St=Tt;function At(e){const t=Ft(e);At.super.call(this,t.message),Object.assign(this,t)}function Pt(e){const t=Ft(e);Pt.super.call(this,t.message),Object.assign(this,t)}function Ft(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:It(t,e)};return t.error&&t.message?(r.message=`${t.error} - ${t.message}`,r):t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?` ${e.statusMessage}`:"";return`${e.method}-request to ${e.url} resulted in HTTP ${e.statusCode}${t}`}(e),r)}function It(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}St(At),St(Pt);const Rt={onResponse:e=>{if(e.statusCode>=500)throw new Pt(e);if(e.statusCode>=400)throw new At(e);return e}},$t={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}},qt=[].concat([$t,{processOptions:e=>{const t=e.body;return t?"function"==typeof t.pipe||(s=t).constructor&&"function"==typeof s.constructor.isBuffer&&s.constructor.isBuffer(s)||!(-1!==dt.indexOf(typeof t)||Array.isArray(t)||!1!==We(r=t)&&(void 0===(n=r.constructor)||!1!==We(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?e:Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e;var r,n,o,s}},{onResponse:e=>{const t=e.headers["content-type"]||"",r=Dt&&Dt.force||-1!==t.indexOf("application/json");return e.body&&t&&r?Object.assign({},e,{body:ft(e.body)}):e},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})},{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},Rt,((e={})=>{const t=e.implementation||ht.Observable;if(!t)throw new 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:X})]);var Dt;const kt=Qe(qt);function Nt(e,t=kt){return t(Object.assign({maxRedirects:0},e))}Nt.defaultRequester=kt,Nt.ClientError=At,Nt.ServerError=Pt;function Ut(e){return"https://docs.sanity.io/help/"+e}const Mt=e=>(e=>{let t,r=!1;return(...n)=>(r||(t=e(...n),r=!0),t)})(((...t)=>console.warn(e.join(" "),...t))),Ht=Mt(["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 ${Ut("js-client-cdn-configuration")}.`,"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),zt=Mt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${Ut("js-client-browser-token")} for more information and how to hide this warning.`]),Lt=Mt(["Using the Sanity client without specifying an API version is deprecated.",`See ${Ut("js-client-api-version")}`]),Bt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,isPromiseAPI:!0},Vt=["localhost","127.0.0.1","0.0.0.0"],Xt=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||Lt();const o=Object.assign({},Bt,r),s=o.useProjectHostname;if("undefined"==typeof Promise){const e=Ut("js-client-promise-polyfill");throw new Error(`No native Promise-implementation found, polyfill needed - see ${e}`)}if(s&&!o.projectId)throw new Error("Configuration must contain `projectId`");const i="undefined"!=typeof window&&window.location&&window.location.hostname,a=i&&(e=>-1!==Vt.indexOf(e))(window.location.hostname);i&&a&&o.token&&!0!==o.ignoreBrowserTokenWarning?zt():void 0===o.useCdn&&Ht(),s&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(o.projectId),o.dataset&&n(o.dataset),"requestTagPrefix"in o&&(o.requestTagPrefix=o.requestTagPrefix?u(o.requestTagPrefix).replace(/\.+$/,""):void 0),o.apiVersion=`${o.apiVersion}`.replace(/^v/,""),o.isDefaultApi=o.apiHost===Bt.apiHost,o.useCdn=Boolean(o.useCdn)&&!o.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`")}(o.apiVersion);const c=o.apiHost.split("://",2),l=c[0],d=c[1],f=o.isDefaultApi?"apicdn.sanity.io":d;return o.useProjectHostname?(o.url=`${l}://${o.projectId}.${d}/v${o.apiVersion}`,o.cdnUrl=`${l}://${o.projectId}.${f}/v${o.apiVersion}`):(o.url=`${o.apiHost}/v${o.apiVersion}`,o.cdnUrl=o.url),o};function Jt(e=Bt){if(!(this instanceof Jt))return new Jt(e);if(this.config(e),this.assets=new de(this),this.datasets=new ce(this),this.projects=new le(this),this.users=new fe(this),this.auth=new pe(this),this.clientConfig.isPromiseAPI){const e=Object.assign({},this.clientConfig,{isPromiseAPI:!1});this.observable=new Jt(e)}}return Object.assign(Jt.prototype,ue),Object.assign(Jt.prototype,{clone(){return new Jt(this.config())},config(e){if(void 0===e)return Object.assign({},this.clientConfig);if(this.clientConfig&&!1===this.clientConfig.allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");if(this.observable){const t=Object.assign({},e,{isPromiseAPI:!1});this.observable.config(t)}return this.clientConfig=Xt(e,this.clientConfig||{}),this},withConfig(e){return new Jt({...this.config(),...e})},getUrl(e,t=!1){return`${t?this.clientConfig.cdnUrl:this.clientConfig.url}/${e.replace(/^\//,"")}`},isPromiseAPI(){return this.clientConfig.isPromiseAPI},_requestObservable(e){const t=e.url||e.uri,r=void 0===e.canUseCdn?["GET","HEAD"].indexOf(e.method||"GET")>=0&&0===t.indexOf("/data/"):e.canUseCdn,n=this.clientConfig.useCdn&&r,o=e.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,e.tag].join("."):e.tag||this.clientConfig.requestTagPrefix;o&&(e.query={tag:u(o),...e.query});const s=((e,t={})=>{const r={},n=t.token||e.token;n&&(r.Authorization=`Bearer ${n}`),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r["X-Sanity-Project-ID"]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o})})(this.clientConfig,Object.assign({},e,{url:this.getUrl(t,n)}));return new X((e=>Nt(s,this.clientConfig.requester).subscribe(e)))},request(e){const t=this._requestObservable(e).pipe(ee((e=>"response"===e.type)),W((e=>e.body)));return this.isPromiseAPI()?Q(t):t}}),Jt.Patch=c,Jt.Transaction=d,Jt.ClientError=Nt.ClientError,Jt.ServerError=Nt.ServerError,Jt.requester=Nt.defaultRequester,Jt}));
|
|
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=Ae,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 Ae={closed:!0,next:Ce,error:function(e){throw e},complete:Ce},Re="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ie(e){return e}function qe(e){return 0===e.length?Ie: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=ke(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[Re]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return qe(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=ke(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 ke(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),Ue=pe((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Me(e,t){var n="object"==typeof t;return new Promise((function(r,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?r(s):n?r(t.defaultValue):o(new Ue)}})}))}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 Be={};
|
|
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 A(e,t){j.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function R(e,t){j.call(this,e),this.error=t.error}w.prototype.open=function(e,t){this._abort(!0);var 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),A.prototype=Object.create(j.prototype),R.prototype=Object.create(j.prototype);var I=-1,q=-1,F=/^text\/event\-stream(;.*)?$/i,k=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=k(n.heartbeatTimeout,45e3),h="",d=u,p=!1,f=0,y=n.headers||{},m=n.Transport,g=U&&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=I,O="",_="",j="",N="",M=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 A("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.",W();s=new A("error",{status:t,statusText:n,headers:o});e.dispatchEvent(s),D(e,e.onerror,s),console.error(i)}},B=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(M===q&&c==="\n".charCodeAt(0))M=0;else if(M===q&&(M=0),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(0!==M){1===M&&(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=k(m,u),d=u):"heartbeatTimeout"===y&&(l=k(m,l),0!==C&&(o(C),C=r((function(){V()}),l)))}if(0===M){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=""}M=c==="\r".charCodeAt(0)?q:0}else 0===M&&(H=a,M=1),1===M?c===":".charCodeAt(0)&&(z=a+1,M=2):2===M&&(M=3)}}},$=function(t){if(1===x||0===x){x=I,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 R("error",{error:t});e.dispatchEvent(n),D(e,e.onerror,n),null!=t&&console.error(t)}},W=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===I){p=!1,f=0,C=r((function(){V()}),l),x=0,O="",j="",_=h,N="",H=0,z=0,M=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,B,$,n,s,i)}catch(e){throw W(),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=W,V()}(this,e,t)}var U=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 M,H=c;null==s||null!=c&&"withCredentials"in c.prototype||(H=N),M=function(e){e.EventSourcePolyfill=N,e.NativeEventSource=c,e.EventSource=H}(n),void 0!==M&&(e.exports=M)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:t:globalThis)}({get exports(){return Be},set exports(e){Be=e}},Be);var $e=Be.EventSourcePolyfill;class We 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 We(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 At=class extends St{constructor(e,t,n){super(e,n),Ot(this,Ct,void 0),_t(this,Ct,t)}clone(){return new At([...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 Rt=At;Ct=new WeakMap;const It=class extends St{constructor(e,t,n){super(e,n),Ot(this,Et,void 0),_t(this,Et,t)}clone(){return new It([...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 qt=It;Et=new WeakMap;const Ft=(e,t)=>!1===e?void 0:void 0===e?t:e,kt=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 Ut(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 Wt(e,t,"query",{query:n,params:r},o).pipe(He(s))}function Mt(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 Bt(e,t,n,r){return Wt(e,t,"mutate",{mutations:[{delete:Ke(n)}]},r)}function $t(e,t,n,r){const o=n instanceof bt||n instanceof vt||n instanceof Rt||n instanceof qt?n.serialize():n;return Wt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:r&&r.transactionId},r)}function Wt(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&&kt(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 Wt(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 Me(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;class cn{getLoginProviders(){return this.client.request({uri:"/auth/providers"})}logout(){return this.client.request({uri:"/auth/logout",method:"POST"})}}class un extends cn{constructor(e){super(),this.client=e}}class ln extends cn{constructor(e){super(),this.client=e}}function hn(e){return"https://docs.sanity.io/help/"+e}const dn=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)})),pn=dn(["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(hn("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),fn=dn(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(hn("js-client-browser-token")," for more information and how to hide this warning.")]),yn=dn(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(hn("js-client-api-version"))]),mn={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0},gn=["localhost","127.0.0.1","0.0.0.0"],vn=(e,t)=>{const n=Object.assign({},t,e);n.apiVersion||yn();const r=Object.assign({},mn,n),o=r.useProjectHostname;if("undefined"==typeof Promise){const e=hn("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!==gn.indexOf(e))(window.location.hostname);s&&i&&r.token&&!0!==r.ignoreBrowserTokenWarning?fn():void 0===r.useCdn&&pn(),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===mn.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 wn=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((n,r)=>(n[r]=void 0===e[r]?t[r]:e[r],n)),{}),bn=(e,t)=>t.reduce(((t,n)=>(void 0===e[n]||(t[n]=e[n]),t)),{});const Cn=$e,En=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],xn={includeResult:!0};function Tn(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={...wn(n,xn),tag:a},u=bn(c,En),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===Cn.CLOSED&&(c(),clearTimeout(t),t=setTimeout(l,100)))}function s(t){e.error(_n(t))}function i(t){const n=On(t);return n instanceof Error?e.error(n):e.next(n)}function a(){r=!0,c(),e.complete()}function c(){n.removeEventListener("error",o,!1),n.removeEventListener("channelError",s,!1),n.removeEventListener("disconnect",a,!1),d.forEach((e=>n.removeEventListener(e,i,!1))),n.close()}function u(){const e=new Cn(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 On(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}function _n(e){if(e instanceof Error)return e;const t=On(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}var jn,Sn,An=(e,t,n)=>(((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)})(e,t,"access private method"),n);class Rn{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,jn)}create(e,t){return An(this,jn,Sn).call(this,"PUT",e,t)}edit(e,t){return An(this,jn,Sn).call(this,"PATCH",e,t)}delete(e){return An(this,jn,Sn).call(this,"DELETE",e)}list(){return this.client.request({uri:"/datasets"})}}jn=new WeakSet,Sn=function(e,t,n){return tt(t),this.client.request({method:e,uri:"/datasets/".concat(t),body:n})};class In extends Rn{constructor(e){super(),this.client=e}}class qn extends Rn{constructor(e){super(),this.client=e}}class Fn{list(){return this.client.request({uri:"/projects"})}getById(e){return this.client.request({uri:"/projects/".concat(e)})}}class kn extends Fn{constructor(e){super(),this.client=e}}class Pn extends Fn{constructor(e){super(),this.client=e}}class Dn{getById(e){return this.client.request({uri:"/users/".concat(e)})}}class Nn extends Dn{constructor(e){super(),this.client=e}}class Un extends Dn{constructor(e){super(),this.client=e}}var Mn,Hn,zn,Ln=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Bn=(e,t,n)=>(Ln(e,t,"read from private field"),n?n.call(e):t.get(e)),$n=(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)},Wn=(e,t,n,r)=>(Ln(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);class Vn{constructor(e){$n(this,Mn,void 0),this.config(e)}config(e){if(void 0===e)return{...Bn(this,Mn)};if(Bn(this,Mn)&&!1===Bn(this,Mn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return Wn(this,Mn,vn(e,Bn(this,Mn)||{})),this}isPromiseAPI(){return this instanceof Yn}getUrl(e){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?Bn(this,Mn).cdnUrl:Bn(this,Mn).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")}}Mn=new WeakMap;const Xn=class extends Vn{constructor(e,t){super(t),$n(this,Hn,void 0),Wn(this,Hn,e),this.assets=new rn(this,Bn(this,Hn)),this.auth=new un(this),this.datasets=new In(this),this.projects=new kn(this),this.users=new Nn(this)}clone(){return new Xn(Bn(this,Hn),this.config())}config(e){return super.config(e)}withConfig(e){return new Xn(Bn(this,Hn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Ut(this,Bn(this,Hn),e,t,n)}getDocument(e,t){return Mt(this,Bn(this,Hn),e,t)}getDocuments(e,t){return Ht(this,Bn(this,Hn),e,t)}create(e,t){return Vt(this,Bn(this,Hn),e,"create",t)}createIfNotExists(e,t){return zt(this,Bn(this,Hn),e,t)}createOrReplace(e,t){return Lt(this,Bn(this,Hn),e,t)}delete(e,t){return Bt(this,Bn(this,Hn),e,t)}mutate(e,t){return $t(this,Bn(this,Hn),e,t)}patch(e,t){return new vt(e,t,this)}transaction(e){return new qt(e,this)}request(e){return Jt(this,Bn(this,Hn),e)}};let Jn=Xn;Hn=new WeakMap;const Gn=class extends Vn{constructor(e,t){super(t),$n(this,zn,void 0),this.listen=Tn,Wn(this,zn,e),this.assets=new on(this,Bn(this,zn)),this.auth=new ln(this),this.datasets=new qn(this),this.projects=new Pn(this),this.users=new Un(this),this.observable=new Jn(e,this.config())}clone(){return new Gn(Bn(this,zn),this.config())}config(e){return e&&this.observable.config(e),super.config(e)}withConfig(e){return new Gn(Bn(this,zn),{...this.config(),...e})}fetch(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Me(Ut(this,Bn(this,zn),e,t,n))}getDocument(e,t){return Me(Mt(this,Bn(this,zn),e,t))}getDocuments(e,t){return Me(Ht(this,Bn(this,zn),e,t))}create(e,t){return Me(Vt(this,Bn(this,zn),e,"create",t))}createIfNotExists(e,t){return Me(zt(this,Bn(this,zn),e,t))}createOrReplace(e,t){return Me(Lt(this,Bn(this,zn),e,t))}delete(e,t){return Me(Bt(this,Bn(this,zn),e,t))}mutate(e,t){return Me($t(this,Bn(this,zn),e,t))}patch(e,t){return new bt(e,t,this)}transaction(e){return new Rt(e,this)}request(e){return Me(Jt(this,Bn(this,zn),e))}dataRequest(e,t,n){return Me(Wt(this,Bn(this,zn),e,t,n))}};let Yn=Gn;zn=new WeakMap;const Zn=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]:W;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}([]),Kn=Zn.defaultRequester;e.BasePatch=mt,e.BaseSanityClient=Vn,e.BaseTransaction=St,e.ClientError=We,e.ObservablePatch=vt,e.ObservableSanityClient=Jn,e.ObservableTransaction=qt,e.Patch=bt,e.SanityClient=Yn,e.ServerError=Ve,e.Transaction=Rt,e.createClient=function(e){return new Yn(Zn,e)},e.requester=Kn}));
|