@sanity/client 6.14.1 → 6.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/browserMiddleware-BHXO2Lcy.cjs +1491 -0
- package/dist/_chunks/{browserMiddleware-FpdqDQ1o.cjs.map → browserMiddleware-BHXO2Lcy.cjs.map} +1 -1
- package/dist/_chunks/browserMiddleware-jPnXCUlp.js +1474 -0
- package/dist/_chunks/{browserMiddleware-DhUBf_19.js.map → browserMiddleware-jPnXCUlp.js.map} +1 -1
- package/dist/_chunks/nodeMiddleware-CrO2pNEp.js +1491 -0
- package/dist/_chunks/{nodeMiddleware-BSZoKrW0.js.map → nodeMiddleware-CrO2pNEp.js.map} +1 -1
- package/dist/_chunks/nodeMiddleware-JJNfI4Rf.cjs +1508 -0
- package/dist/_chunks/{nodeMiddleware-DmcqX3kz.cjs.map → nodeMiddleware-JJNfI4Rf.cjs.map} +1 -1
- package/dist/_chunks/resolveEditInfo-BNCwZySb.cjs +284 -0
- package/dist/_chunks/{resolveEditInfo-BB1WiUDY.cjs.map → resolveEditInfo-BNCwZySb.cjs.map} +1 -1
- package/dist/_chunks/resolveEditInfo-qA5twkfC.js +285 -0
- package/dist/_chunks/{resolveEditInfo-Cf8D1Agp.js.map → resolveEditInfo-qA5twkfC.js.map} +1 -1
- package/dist/_chunks/stegaEncodeSourceMap-B9_uz7Zb.cjs +166 -0
- package/dist/_chunks/{stegaEncodeSourceMap-8TjLXjYU.cjs.map → stegaEncodeSourceMap-B9_uz7Zb.cjs.map} +1 -1
- package/dist/_chunks/stegaEncodeSourceMap-BvBJpbrr.cjs +329 -0
- package/dist/_chunks/{stegaEncodeSourceMap-DIcuvN0P.cjs.map → stegaEncodeSourceMap-BvBJpbrr.cjs.map} +1 -1
- package/dist/_chunks/stegaEncodeSourceMap-De3F_oJN.js +330 -0
- package/dist/_chunks/{stegaEncodeSourceMap-DLon0Yls.js.map → stegaEncodeSourceMap-De3F_oJN.js.map} +1 -1
- package/dist/_chunks/stegaEncodeSourceMap-bRxIGJ-b.js +168 -0
- package/dist/_chunks/{stegaEncodeSourceMap-DU95idpa.js.map → stegaEncodeSourceMap-bRxIGJ-b.js.map} +1 -1
- package/dist/csm.cjs +22 -56
- package/dist/csm.cjs.map +1 -1
- package/dist/csm.js +36 -54
- package/dist/csm.js.map +1 -1
- package/dist/index.browser.cjs +15 -21
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +24 -15
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +15 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -15
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.cjs +12 -17
- package/dist/stega.browser.cjs.map +1 -1
- package/dist/stega.browser.js +26 -11
- package/dist/stega.browser.js.map +1 -1
- package/dist/stega.cjs +12 -17
- package/dist/stega.cjs.map +1 -1
- package/dist/stega.js +26 -11
- package/dist/stega.js.map +1 -1
- package/package.json +3 -3
- package/umd/sanityClient.js +2670 -3360
- package/umd/sanityClient.min.js +3 -3
- package/dist/_chunks/browserMiddleware-DhUBf_19.js +0 -1761
- package/dist/_chunks/browserMiddleware-FpdqDQ1o.cjs +0 -1777
- package/dist/_chunks/nodeMiddleware-BSZoKrW0.js +0 -1780
- package/dist/_chunks/nodeMiddleware-DmcqX3kz.cjs +0 -1796
- package/dist/_chunks/resolveEditInfo-BB1WiUDY.cjs +0 -422
- package/dist/_chunks/resolveEditInfo-Cf8D1Agp.js +0 -406
- package/dist/_chunks/stegaEncodeSourceMap-8TjLXjYU.cjs +0 -229
- package/dist/_chunks/stegaEncodeSourceMap-DIcuvN0P.cjs +0 -486
- package/dist/_chunks/stegaEncodeSourceMap-DLon0Yls.js +0 -482
- package/dist/_chunks/stegaEncodeSourceMap-DU95idpa.js +0 -225
package/umd/sanityClient.min.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";var t=function(e,r){return t=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])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}function o(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function i(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 s(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function a(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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 u(e){return this instanceof u?(this.v=e,this):new u(e)}function c(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||a(e,t)}))})}function a(e,t){try{(r=o[e](t)).value instanceof u?Promise.resolve(r.value.v).then(c,l):h(i[0][2],r)}catch(e){h(i[0][3],e)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function h(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function l(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=i(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function h(e){return"function"==typeof e}function f(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}"function"==typeof SuppressedError&&SuppressedError;var d=f((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 p(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var y=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var c=i(u),l=c.next();!l.done;l=c.next()){l.value.remove(this)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else u.remove(this);var f=this.initialTeardown;if(h(f))try{f()}catch(e){o=e instanceof d?e.errors:[e]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var y=i(p),g=y.next();!g.done;g=y.next()){var b=g.value;try{m(b)}catch(e){o=null!=o?o:[],e instanceof d?o=a(a([],s(o)),s(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}}if(o)throw new d(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)m(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)&&p(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&p(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function g(e){return e instanceof y||e&&"closed"in e&&h(e.remove)&&h(e.add)&&h(e.unsubscribe)}function m(e){h(e)?e():e.unsubscribe()}y.EMPTY;var b={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},v={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,a([e,t],s(r)))},clearTimeout:function(e){var t=v.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function w(e){v.setTimeout((function(){throw e}))}function C(){}var E=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,g(t)&&t.add(r)):r.destination=T,r}return r(t,e),t.create=function(e,t,r){return new _(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}(y),x=Function.prototype.bind;function S(e,t){return x.call(e,t)}var R=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){O(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){O(e)}else O(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){O(e)}},e}(),_=function(e){function t(t,r,n){var o,i,s=e.call(this)||this;h(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&b.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&S(t.next,i),error:t.error&&S(t.error,i),complete:t.complete&&S(t.complete,i)}):o=t;return s.destination=new R(o),s}return r(t,e),t}(E);function O(e){w(e)}var T={closed:!0,next:C,error:function(e){throw e},complete:C},q="function"==typeof Symbol&&Symbol.observable||"@@observable";function $(e){return e}function j(e){return 0===e.length?$:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var A=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,i=(n=e)&&n instanceof E||function(e){return e&&h(e.next)&&h(e.error)&&h(e.complete)}(n)&&g(n)?e:new _(e,t,r);return function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=I(t))((function(t,n){var o=new _({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[q]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return j(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=I(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 I(e){var t;return null!==(t=null!=e?e:b.Promise)&&void 0!==t?t:Promise}function P(e){return function(t){if(function(e){return h(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 k(e,t,r,n,o){return new D(e,t,r,n,o)}var D=function(e){function t(t,r,n,o,i,s){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=s,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 r(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}(E);var F=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function M(e){return h(null==e?void 0:e.then)}function N(e){return h(e[q])}function U(e){return Symbol.asyncIterator&&h(null==e?void 0:e[Symbol.asyncIterator])}function H(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var z="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function L(e){return h(null==e?void 0:e[z])}function B(e){return c(this,arguments,(function(){var t,r,n;return o(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,u(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,u(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,u(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function J(e){return h(null==e?void 0:e.getReader)}function G(e){if(e instanceof A)return e;if(null!=e){if(N(e))return o=e,new A((function(e){var t=o[q]();if(h(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(F(e))return n=e,new A((function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()}));if(M(e))return r=e,new A((function(e){r.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,w)}));if(U(e))return V(e);if(L(e))return t=e,new A((function(e){var r,n;try{for(var o=i(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()}));if(J(e))return V(B(e))}var t,r,n,o;throw H(e)}function V(e){return new A((function(t){(function(e,t){var r,i,s,a;return n(this,void 0,void 0,(function(){var n,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,11]),r=l(e),o.label=1;case 1:return[4,r.next()];case 2:if((i=o.sent()).done)return[3,4];if(n=i.value,t.next(n),t.closed)return[2];o.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=o.sent(),s={error:u},[3,11];case 6:return o.trys.push([6,,9,10]),i&&!i.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:o.sent(),o.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function Q(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var i=t.schedule((function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()}),n);if(e.add(i),!o)return i}function Y(e,t){return void 0===t&&(t=0),P((function(r,n){r.subscribe(k(n,(function(r){return Q(n,e,(function(){return n.next(r)}),t)}),(function(){return Q(n,e,(function(){return n.complete()}),t)}),(function(r){return Q(n,e,(function(){return n.error(r)}),t)})))}))}function W(e,t){return void 0===t&&(t=0),P((function(r,n){n.add(e.schedule((function(){return r.subscribe(n)}),t))}))}function X(e,t){if(!e)throw new Error("Iterable cannot be null");return new A((function(r){Q(r,t,(function(){var n=e[Symbol.asyncIterator]();Q(r,t,(function(){n.next().then((function(e){e.done?r.complete():r.next(e.value)}))}),0,!0)}))}))}function K(e,t){if(null!=e){if(N(e))return function(e,t){return G(e).pipe(W(t),Y(t))}(e,t);if(F(e))return function(e,t){return new A((function(r){var n=0;return t.schedule((function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())}))}))}(e,t);if(M(e))return function(e,t){return G(e).pipe(W(t),Y(t))}(e,t);if(U(e))return X(e,t);if(L(e))return function(e,t){return new A((function(r){var n;return Q(r,t,(function(){n=e[z](),Q(r,t,(function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)}),0,!0)})),function(){return h(null==n?void 0:n.return)&&n.return()}}))}(e,t);if(J(e))return function(e,t){return X(B(e),t)}(e,t)}throw H(e)}function Z(e,t){return t?K(e,t):G(e)}var ee=f((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function te(e,t){var r="object"==typeof t;return new Promise((function(n,o){var i,s=!1;e.subscribe({next:function(e){i=e,s=!0},error:o,complete:function(){s?n(i):r?n(t.defaultValue):o(new ee)}})}))}function re(e,t){return P((function(r,n){var o=0;r.subscribe(k(n,(function(r){n.next(e.call(t,r,o++))})))}))}var ne=Array.isArray;function oe(e){return re((function(t){return function(e,t){return ne(t)?e.apply(void 0,a([],s(t))):e(t)}(e,t)}))}function ie(e,t,r){e?Q(r,e,t):t()}var se=Array.isArray;function ae(e,t){return P((function(r,n){var o=0;r.subscribe(k(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}function ue(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return h((t=e)[t.length-1])?e.pop():void 0;var t}(e);return r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return j(e)}(ue.apply(void 0,a([],s(e))),oe(r)):P((function(t,r){var n,o,i;(n=a([t],s(function(e){return 1===e.length&&se(e[0])?e[0]:e}(e))),void 0===i&&(i=$),function(e){ie(o,(function(){for(var t=n.length,r=new Array(t),s=t,a=t,u=function(t){ie(o,(function(){var u=Z(n[t],o),c=!1;u.subscribe(k(e,(function(n){r[t]=n,c||(c=!0,a--),a||e.next(i(r.slice()))}),(function(){--s||e.complete()})))}),e)},c=0;c<t;c++)u(c)}),e)})(r)}))}const ce={timeout:"undefined"!=typeof navigator&&"ReactNative"===navigator.product?6e4:12e4},le=function(e){const t={...ce,..."string"==typeof e?{url:e}:e},{searchParams:r}=new URL(t.url,"http://localhost");if(t.timeout=he(t.timeout),t.query)for(const[e,n]of Object.entries(t.query))if(void 0!==n)if(Array.isArray(n))for(const t of n)r.append(e,t);else r.append(e,n);const[n]=t.url.split("?"),o=r.toString();return o&&(t.url=`${n}?${o}`),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t};function he(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const t=Number(e);return isNaN(t)?he(ce.timeout):{connect:t,socket:t}}const fe=/^https?:\/\//i,de=function(e){if(!fe.test(e.url))throw new Error(`"${e.url}" is not a valid URL`)};var pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ye(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ge=function(e){return e.replace(/^\s+|\s+$/g,"")},me=ye((function(e){if(!e)return{};for(var t,r={},n=ge(e).split("\n"),o=0;o<n.length;o++){var i=n[o],s=i.indexOf(":"),a=ge(i.slice(0,s)).toLowerCase(),u=ge(i.slice(s+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}));const be=["request","response","progress","error","abort"],ve=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function we(e,t){const r=[],n=ve.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[le],validateOptions:[de]});function o(e){const r=be.reduce(((e,t)=>(e[t]=function(){const e=Object.create(null);let t=0;return{publish:function(t){for(const r in e)e[r](t)},subscribe:function(r){const n=t++;return e[n]=r,function(){delete e[n]}}}}(),e)),{}),o=(e=>function(t,r,...n){const o="onError"===t;let i=r;for(let r=0;r<e[t].length&&(i=(0,e[t][r])(i,...n),!o||i);r++);return i})(n),i=o("processOptions",e);o("validateOptions",i);const s={options:i,channels:r,applyMiddleware:o};let a;const u=r.request.subscribe((e=>{a=t(e,((t,n)=>((e,t,n)=>{let i=e,s=t;if(!i)try{s=o("onResponse",t,n)}catch(e){s=null,i=e}i=i&&o("onError",i,n),i?r.error.publish(i):s&&r.response.publish(s)})(t,n,e)))}));r.abort.subscribe((()=>{u(),a&&a.abort()}));const c=o("onReturn",r,s);return c===r&&r.request.publish(s),c}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&&n.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return ve.forEach((t=>{e[t]&&n[t].push(e[t])})),r.push(e),o},o.clone=()=>we(r,t),e.forEach(o.use),o}class Ce{constructor(){this.readyState=0,this.responseType="",this.#e={},this.#t={}}#r;#n;#o;#e;#i;#t;#s;open(e,t,r){this.#r=e,this.#n=t,this.#o="",this.readyState=1,this.onreadystatechange(),this.#i=void 0}abort(){this.#i&&this.#i.abort()}getAllResponseHeaders(){return this.#o}setRequestHeader(e,t){this.#e[e]=t}setInit(e,t=!0){this.#t=e,this.#s=t}send(e){const t="arraybuffer"!==this.responseType,r={...this.#t,method:this.#r,headers:this.#e,body:e};"function"==typeof AbortController&&this.#s&&(this.#i=new AbortController,"undefined"!=typeof EventTarget&&this.#i.signal instanceof EventTarget&&(r.signal=this.#i.signal)),"undefined"!=typeof document&&(r.credentials=this.withCredentials?"include":"omit"),fetch(this.#n,r).then((e=>(e.headers.forEach(((e,t)=>{this.#o+=`${t}: ${e}\r\n`})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,t?e.text():e.arrayBuffer()))).then((e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{var t;"AbortError"!==e.name?null==(t=this.onerror)||t.call(this,e):this.onabort()}))}}const Ee="function"==typeof XMLHttpRequest?"xhr":"fetch",xe="xhr"===Ee?XMLHttpRequest:Ce,Se=(e,t)=>{const r=e.options,n=e.applyMiddleware("finalizeOptions",r),o={},i=e.applyMiddleware("interceptRequest",void 0,{adapter:Ee,context:e});if(i){const e=setTimeout(t,0,null,i);return{abort:()=>clearTimeout(e)}}let s=new xe;s instanceof Ce&&"object"==typeof n.fetch&&s.setInit(n.fetch,n.useAbortSignal??!0);const a=n.headers,u=n.timeout;let c=!1,l=!1,h=!1;if(s.onerror=e=>{p(new Error(`Request error while attempting to reach ${n.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`))},s.ontimeout=e=>{p(new Error(`Request timeout while attempting to reach ${n.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`))},s.onabort=()=>{d(!0),c=!0},s.onreadystatechange=()=>{!function(){if(!u)return;d(),o.socket=setTimeout((()=>f("ESOCKETTIMEDOUT")),u.socket)}(),c||4!==s.readyState||0!==s.status&&function(){if(c||l||h)return;if(0===s.status)return void p(new Error("Unknown XHR error"));d(),l=!0,t(null,{body:s.response||(""===s.responseType||"text"===s.responseType?s.responseText:""),url:n.url,method:n.method,headers:me(s.getAllResponseHeaders()),statusCode:s.status,statusMessage:s.statusText})}()},s.open(n.method,n.url,!0),s.withCredentials=!!n.withCredentials,a&&s.setRequestHeader)for(const e in a)a.hasOwnProperty(e)&&s.setRequestHeader(e,a[e]);return n.rawBody&&(s.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:n,adapter:Ee,request:s,context:e}),s.send(n.body||null),u&&(o.connect=setTimeout((()=>f("ETIMEDOUT")),u.connect)),{abort:function(){c=!0,s&&s.abort()}};function f(t){h=!0,s.abort();const r=new Error("ESOCKETTIMEDOUT"===t?`Socket timed out on request to ${n.url}`:`Connection timed out on request to ${n.url}`);r.code=t,e.channels.error.publish(r)}function d(e){(e||c||s.readyState>=2&&o.connect)&&clearTimeout(o.connect),o.socket&&clearTimeout(o.socket)}function p(e){if(l)return;d(!0),l=!0,s=null;const r=e||new Error(`Network error while attempting to reach ${n.url}`);r.isNetworkError=!0,r.request=n,t(r)}},Re=(e=[],t=Se)=>we(e,t);var _e,Oe,Te={exports:{}};function qe(){if(Oe)return _e;Oe=1;var e=1e3,t=60*e,r=60*t,n=24*r,o=7*n,i=365.25*n;function s(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}return _e=function(a,u){u=u||{};var c=typeof a;if("string"===c&&a.length>0)return function(s){if((s=String(s)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!a)return;var u=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*i;case"weeks":case"week":case"w":return u*o;case"days":case"day":case"d":return u*n;case"hours":case"hour":case"hrs":case"hr":case"h":return u*r;case"minutes":case"minute":case"mins":case"min":case"m":return u*t;case"seconds":case"second":case"secs":case"sec":case"s":return u*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(a);if("number"===c&&isFinite(a))return u.long?function(o){var i=Math.abs(o);if(i>=n)return s(o,i,n,"day");if(i>=r)return s(o,i,r,"hour");if(i>=t)return s(o,i,t,"minute");if(i>=e)return s(o,i,e,"second");return o+" ms"}(a):function(o){var i=Math.abs(o);if(i>=n)return Math.round(o/n)+"d";if(i>=r)return Math.round(o/r)+"h";if(i>=t)return Math.round(o/t)+"m";if(i>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var $e=function(e){function t(e){let n,o,i,s=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),i=o-(n||o);r.diff=i,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];n=i.call(r,t),e.splice(s,1),s--}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!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function 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=qe(),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};
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient={})}(this,(function(e){"use strict";const t={timeout:!(typeof navigator>"u")&&"ReactNative"===navigator.product?6e4:12e4},r=function(e){const r={...t,..."string"==typeof e?{url:e}:e},{searchParams:o}=new URL(r.url,"http://localhost");if(r.timeout=n(r.timeout),r.query)for(const[e,t]of Object.entries(r.query))if(void 0!==t)if(Array.isArray(t))for(const r of t)o.append(e,r);else o.append(e,t);const[i]=r.url.split("?"),s=o.toString();return s&&(r.url=`${i}?${s}`),r.method=r.body&&!r.method?"POST":(r.method||"GET").toUpperCase(),r};function n(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;const r=Number(e);return isNaN(r)?n(t.timeout):{connect:r,socket:r}}const o=/^https?:\/\//i,i=function(e){if(!o.test(e.url))throw new Error(`"${e.url}" is not a valid URL`)};var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u=function(e){return e.replace(/^\s+|\s+$/g,"")},c=a((function(e){if(!e)return{};for(var t,r={},n=u(e).split("\n"),o=0;o<n.length;o++){var i=n[o],s=i.indexOf(":"),a=u(i.slice(0,s)).toLowerCase(),c=u(i.slice(s+1));void 0===r[a]?r[a]=c:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(c):r[a]=[r[a],c])}return r}));const l=["request","response","progress","error","abort"],d=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function f(e,t){const n=[],o=d.reduce(((e,t)=>(e[t]=e[t]||[],e)),{processOptions:[r],validateOptions:[i]});function s(e){const r=l.reduce(((e,t)=>(e[t]=function(){const e=Object.create(null);let t=0;return{publish:function(t){for(const r in e)e[r](t)},subscribe:function(r){const n=t++;return e[n]=r,function(){delete e[n]}}}}(),e)),{}),n=(e=>function(t,r,...n){const o="onError"===t;let i=r;for(let r=0;r<e[t].length&&(i=(0,e[t][r])(i,...n),!o||i);r++);return i})(o),i=n("processOptions",e);n("validateOptions",i);const s={options:i,channels:r,applyMiddleware:n};let a;const u=r.request.subscribe((e=>{a=t(e,((t,o)=>((e,t,o)=>{let i=e,s=t;if(!i)try{s=n("onResponse",t,o)}catch(e){s=null,i=e}i=i&&n("onError",i,o),i?r.error.publish(i):s&&r.response.publish(s)})(t,o,e)))}));r.abort.subscribe((()=>{u(),a&&a.abort()}));const c=n("onReturn",r,s);return c===r&&r.request.publish(s),c}return s.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&o.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return d.forEach((t=>{e[t]&&o[t].push(e[t])})),n.push(e),s},s.clone=()=>f(n,t),e.forEach(s.use),s}var h,p,y,g,m,v,b,w=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},C=(e,t,r)=>(w(e,t,"read from private field"),r?r.call(e):t.get(e)),E=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},x=(e,t,r,n)=>(w(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class S{constructor(){this.readyState=0,this.responseType="",E(this,h,void 0),E(this,p,void 0),E(this,y,void 0),E(this,g,{}),E(this,m,void 0),E(this,v,{}),E(this,b,void 0)}open(e,t,r){x(this,h,e),x(this,p,t),x(this,y,""),this.readyState=1,this.onreadystatechange(),x(this,m,void 0)}abort(){C(this,m)&&C(this,m).abort()}getAllResponseHeaders(){return C(this,y)}setRequestHeader(e,t){C(this,g)[e]=t}setInit(e,t=!0){x(this,v,e),x(this,b,t)}send(e){const t="arraybuffer"!==this.responseType,r={...C(this,v),method:C(this,h),headers:C(this,g),body:e};"function"==typeof AbortController&&C(this,b)&&(x(this,m,new AbortController),typeof EventTarget<"u"&&C(this,m).signal instanceof EventTarget&&(r.signal=C(this,m).signal)),typeof document<"u"&&(r.credentials=this.withCredentials?"include":"omit"),fetch(C(this,p),r).then((e=>(e.headers.forEach(((e,t)=>{x(this,y,C(this,y)+`${t}: ${e}\r\n`)})),this.status=e.status,this.statusText=e.statusText,this.readyState=3,t?e.text():e.arrayBuffer()))).then((e=>{"string"==typeof e?this.responseText=e:this.response=e,this.readyState=4,this.onreadystatechange()})).catch((e=>{var t;"AbortError"!==e.name?null==(t=this.onerror)||t.call(this,e):this.onabort()}))}}h=new WeakMap,p=new WeakMap,y=new WeakMap,g=new WeakMap,m=new WeakMap,v=new WeakMap,b=new WeakMap;const T="function"==typeof XMLHttpRequest?"xhr":"fetch",_="xhr"===T?XMLHttpRequest:S,O=(e,t)=>{var r;const n=e.options,o=e.applyMiddleware("finalizeOptions",n),i={},s=e.applyMiddleware("interceptRequest",void 0,{adapter:T,context:e});if(s){const e=setTimeout(t,0,null,s);return{abort:()=>clearTimeout(e)}}let a=new _;a instanceof S&&"object"==typeof o.fetch&&a.setInit(o.fetch,null==(r=o.useAbortSignal)||r);const u=o.headers,l=o.timeout;let d=!1,f=!1,h=!1;if(a.onerror=e=>{g(new Error(`Request error while attempting to reach ${o.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`))},a.ontimeout=e=>{g(new Error(`Request timeout while attempting to reach ${o.url}${e.lengthComputable?`(${e.loaded} of ${e.total} bytes transferred)`:""}`))},a.onabort=()=>{y(!0),d=!0},a.onreadystatechange=()=>{l&&(y(),i.socket=setTimeout((()=>p("ESOCKETTIMEDOUT")),l.socket)),!d&&4===a.readyState&&0!==a.status&&function(){if(!(d||f||h)){if(0===a.status)return void g(new Error("Unknown XHR error"));y(),f=!0,t(null,{body:a.response||(""===a.responseType||"text"===a.responseType?a.responseText:""),url:o.url,method:o.method,headers:c(a.getAllResponseHeaders()),statusCode:a.status,statusMessage:a.statusText})}}()},a.open(o.method,o.url,!0),a.withCredentials=!!o.withCredentials,u&&a.setRequestHeader)for(const e in u)u.hasOwnProperty(e)&&a.setRequestHeader(e,u[e]);return o.rawBody&&(a.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:o,adapter:T,request:a,context:e}),a.send(o.body||null),l&&(i.connect=setTimeout((()=>p("ETIMEDOUT")),l.connect)),{abort:function(){d=!0,a&&a.abort()}};function p(t){h=!0,a.abort();const r=new Error("ESOCKETTIMEDOUT"===t?`Socket timed out on request to ${o.url}`:`Connection timed out on request to ${o.url}`);r.code=t,e.channels.error.publish(r)}function y(e){(e||d||a.readyState>=2&&i.connect)&&clearTimeout(i.connect),i.socket&&clearTimeout(i.socket)}function g(e){if(f)return;y(!0),f=!0,a=null;const r=e||new Error(`Network error while attempting to reach ${o.url}`);r.isNetworkError=!0,r.request=o,t(r)}},$=(e=[],t=O)=>f(e,t);var j,k,A={exports:{}};function I(){if(k)return j;k=1;var e=1e3,t=60*e,r=60*t,n=24*r,o=7*n,i=365.25*n;function s(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}return j=function(a,u){u=u||{};var c=typeof a;if("string"===c&&a.length>0)return function(s){if((s=String(s)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!a)return;var u=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*i;case"weeks":case"week":case"w":return u*o;case"days":case"day":case"d":return u*n;case"hours":case"hour":case"hrs":case"hr":case"h":return u*r;case"minutes":case"minute":case"mins":case"min":case"m":return u*t;case"seconds":case"second":case"secs":case"sec":case"s":return u*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(a);if("number"===c&&isFinite(a))return u.long?function(o){var i=Math.abs(o);if(i>=n)return s(o,i,n,"day");if(i>=r)return s(o,i,r,"hour");if(i>=t)return s(o,i,t,"minute");if(i>=e)return s(o,i,e,"second");return o+" ms"}(a):function(o){var i=Math.abs(o);if(i>=n)return Math.round(o/n)+"d";if(i>=r)return Math.round(o/r)+"h";if(i>=t)return Math.round(o/t)+"m";if(i>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var P=function(e){function t(e){let n,o,i,s=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),i=o-(n||o);r.diff=i,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];n=i.call(r,t),e.splice(s,1),s--}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!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function 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=I(),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};
|
|
2
2
|
/*!
|
|
3
3
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
6
|
* Released under the MIT License.
|
|
7
7
|
*/
|
|
8
|
-
function je(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},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=$e(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Te,Te.exports);const Ae="undefined"==typeof Buffer?()=>!1:e=>Buffer.isBuffer(e),Ie=["boolean","string","number"];function Pe(){return{processOptions:e=>{const t=e.body;if(!t)return e;var r,n,o;return!("function"==typeof t.pipe)&&!Ae(t)&&(-1!==Ie.indexOf(typeof t)||Array.isArray(t)||!1!==je(r=t)&&(void 0===(n=r.constructor)||!1!==je(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e}}}function ke(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},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: ${e.message}`,e}}}let De={};"undefined"!=typeof globalThis?De=globalThis:"undefined"!=typeof window?De=window:"undefined"!=typeof global?De=global:"undefined"!=typeof self&&(De=self);var Fe=De;function Me(e={}){const t=e.implementation||Fe.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())))}}class Ne{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel"+(this.message?`: ${this.message}`:"")}}const Ue=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 Ne(e),t(this.reason))}))}};Ue.source=()=>{let e;return{token:new Ue((t=>{e=t})),cancel:e}};var He=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function ze(e){return 100*Math.pow(2,e)+100*Math.random()}const Le=(e={})=>(e=>{const t=e.maxRetries||5,r=e.retryDelay||ze,n=e.shouldRetry;return{onError:(e,o)=>{const i=o.options,s=i.maxRetries||t,a=i.shouldRetry||n,u=i.attemptNumber||0;if(null!==(c=i.body)&&"object"==typeof c&&"function"==typeof c.pipe)return e;var c;if(!a(e,u,i)||u>=s)return e;const l=Object.assign({},o,{options:Object.assign({},i,{attemptNumber:u+1})});return setTimeout((()=>o.channels.request.publish(l)),r(u)),null}}})({shouldRetry:He,...e});Le.shouldRetry=He;class Be extends Error{constructor(e){const t=Ge(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class Je extends Error{constructor(e){const t=Ge(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function Ge(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:Qe(t,e),message:"",details:void 0};if(t.error&&t.message)return r.message=`${t.error} - ${t.message}`,r;if(function(e){return Ve(e)&&Ve(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],n=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=n.length?`:\n- ${n.join("\n- ")}`:"";return e.length>5&&(o+=`\n...and ${e.length-5} more`),r.message=`${t.error.description}${o}`,r.details=t.error,r}return 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 Ve(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Qe(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const Ye={onResponse:e=>{if(e.statusCode>=500)throw new Je(e);if(e.statusCode>=400)throw new Be(e);return e}},We={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function Xe(e,{maxRetries:t=5,retryDelay:r}){const n=Re([t>0?Le({retryDelay:r,maxRetries:t,shouldRetry:Ke}):{},...e,We,Pe(),ke(),{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"))}},Ye,Me({implementation:A})]);function o(e,t=n){return t({maxRedirects:0,...e})}return o.defaultRequester=n,o}function Ke(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=(r.uri||r.url).startsWith("/data/query"),i=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!i)||Le.shouldRetry(e,t,r)}function Ze(e){if("string"==typeof e)return{id:e};if(Array.isArray(e))return{query:"*[_id in $ids]",params:{ids:e}};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};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 et=["image","file"],tt=["before","after","replace"],rt=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,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error(`${e}() takes an object of properties`)},ot=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error(`${e}(): "${t}" is not a valid document ID`)},it=(e,t)=>{if(!t._id)throw new Error(`${e}() requires that the document contains an ID ("_id" property)`);ot(e,t._id)},st=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};class ut{constructor(e,t={}){this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return nt("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,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===tt.indexOf(e)){const e=tt.map((e=>`"${e}"`)).join(", ");throw new Error(`${n} takes an "at"-argument which is one of: ${e}`)}if("string"!=typeof t)throw new Error(`${n} takes a "selector"-argument which must be a string`);if(!Array.isArray(r))throw new Error(`${n} takes an "items"-argument which must be an array`)})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after",`${e}[-1]`,t)}prepend(e,t){return this.insert("before",`${e}[0]`,t)}splice(e,t,r,n){const o=t<0?t-1:t,i=void 0===r||-1===r?-1:Math.max(0,t+r),s=`${e}[${o}:${o<0&&i>=0?"":i}]`;return this.insert("replace",s,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...Ze(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,r=!0){return nt(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}class ct extends ut{#a;constructor(e,t,r){super(e,t),this.#a=r}clone(){return new ct(this.selection,{...this.operations},this.#a)}commit(e){if(!this.#a)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.#a.mutate({patch:this.serialize()},r)}}class lt extends ut{#a;constructor(e,t,r){super(e,t),this.#a=r}clone(){return new lt(this.selection,{...this.operations},this.#a)}commit(e){if(!this.#a)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.#a.mutate({patch:this.serialize()},r)}}const ht={returnDocuments:!1};class ft{constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return nt("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return nt(t,e),it(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return nt(t,e),it(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}}class dt extends ft{#a;constructor(e,t,r){super(e,r),this.#a=t}clone(){return new dt([...this.operations],this.#a,this.trxId)}commit(e){if(!this.#a)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#a.mutate(this.serialize(),Object.assign({transactionId:this.trxId},ht,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof lt)return this._add({patch:e.serialize()});if(r){const r=t(new lt(e,{},this.#a));if(!(r instanceof lt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}}class pt extends ft{#a;constructor(e,t,r){super(e,r),this.#a=t}clone(){return new pt([...this.operations],this.#a,this.trxId)}commit(e){if(!this.#a)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#a.mutate(this.serialize(),Object.assign({transactionId:this.trxId},ht,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof ct)return this._add({patch:e.serialize()});if(r){const r=t(new ct(e,{},this.#a));if(!(r instanceof ct))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}}function yt(e){return"https://www.sanity.io/help/"+e}const gt=e=>function(e){let t,r=!1;return(...n)=>(r||(t=e(...n),r=!0),t)}(((...t)=>console.warn(e.join(" "),...t))),mt=gt(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),bt=gt(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),vt=gt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${yt("js-client-browser-token")} for more information and how to hide this warning.`]),wt=gt(["Using the Sanity client without specifying an API version is deprecated.",`See ${yt("js-client-api-version")}`]),Ct=gt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),Et={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},xt=["localhost","127.0.0.1","0.0.0.0"],St=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},Rt=(e,t)=>{const r={...t,...e,stega:{..."boolean"==typeof t.stega?{enabled:t.stega}:t.stega||Et.stega,..."boolean"==typeof e.stega?{enabled:e.stega}:e.stega||{}}};r.apiVersion||wt();const n={...Et,...r},o=n.useProjectHostname;if("undefined"==typeof Promise){const e=yt("js-client-promise-polyfill");throw new Error(`No native Promise-implementation found, polyfill needed - see ${e}`)}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof n.perspective&&St(n.perspective),"encodeSourceMap"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");if("boolean"!=typeof n.stega.enabled)throw new Error(`stega.enabled must be a boolean, received ${n.stega.enabled}`);if(n.stega.enabled&&void 0===n.stega.studioUrl)throw new Error("stega.studioUrl must be defined when stega.enabled is true");if(n.stega.enabled&&"string"!=typeof n.stega.studioUrl&&"function"!=typeof n.stega.studioUrl)throw new Error(`stega.studioUrl must be a string or a function, received ${n.stega.studioUrl}`);const i="undefined"!=typeof window&&window.location&&window.location.hostname,s=i&&(e=>-1!==xt.indexOf(e))(window.location.hostname);i&&s&&n.token&&!0!==n.ignoreBrowserTokenWarning?vt():void 0===n.useCdn&&mt(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&rt(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?at(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion=`${n.apiVersion}`.replace(/^v/,""),n.isDefaultApi=n.apiHost===Et.apiHost,n.useCdn=!1!==n.useCdn&&!n.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`")}(n.apiVersion);const a=n.apiHost.split("://",2),u=a[0],c=a[1],l=n.isDefaultApi?"apicdn.sanity.io":c;return n.useProjectHostname?(n.url=`${u}://${n.projectId}.${c}/v${n.apiVersion}`,n.cdnUrl=`${u}://${n.projectId}.${l}/v${n.apiVersion}`):(n.url=`${n.apiHost}/v${n.apiVersion}`,n.cdnUrl=n.url),n},_t="X-Sanity-Project-ID";var Ot={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},Tt={0:8203,1:8204,2:8205,3:65279},qt=new Array(4).fill(String.fromCodePoint(Tt[0])).join("");function $t(e,t,r="auto"){return!0===r||"auto"===r&&(function(e){return!!Number.isNaN(Number(e))&&Boolean(Date.parse(e))}(e)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(e))?e:`${e}${function(e){let t=JSON.stringify(e);return`${qt}${Array.from(t).map((e=>{let r=e.charCodeAt(0);if(r>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${t} on character ${e} (${r})`);return Array.from(r.toString(4).padStart(4,"0")).map((e=>String.fromCodePoint(Tt[e]))).join("")})).join("")}`}(t)}`}Object.fromEntries(Object.entries(Tt).map((e=>e.reverse()))),Object.fromEntries(Object.entries(Ot).map((e=>e.reverse())));var jt=`${Object.values(Ot).map((e=>`\\u{${e.toString(16)}}`)).join("")}`,At=new RegExp(`[${jt}]{4,}`,"gu");function It(e){try{return JSON.parse(JSON.stringify(e,((e,t)=>{return"string"!=typeof t?t:(r=t,{cleaned:r.replace(At,""),encoded:(null==(n=r.match(At))?void 0:n[0])||""}).cleaned;var r,n})))}catch{return e}}const Pt=({query:e,params:t={},options:r={}})=>{const n=new URLSearchParams,{tag:o,returnQuery:i,...s}=r;o&&n.append("tag",o),n.append("query",e);for(const[e,r]of Object.entries(t))n.append(`$${e}`,JSON.stringify(r));for(const[e,t]of Object.entries(s))t&&n.append(e,`${t}`);return!1===i&&n.append("returnQuery","false"),`?${n}`},kt=(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},Dt=e=>"response"===e.type,Ft=e=>e.body,Mt=11264;function Nt(e,t,r,n,o={},i={}){const u="stega"in i?{...r||{},..."boolean"==typeof i.stega?{enabled:i.stega}:i.stega||{}}:r,c=u.enabled?It(o):o,l=!1===i.filterResponse?e=>e:e=>e.result,{cache:h,next:f,...d}={useAbortSignal:void 0!==i.signal,resultSourceMap:u.enabled?"withKeyArraySelector":i.resultSourceMap,...i,returnQuery:!1===i.filterResponse&&!1!==i.returnQuery},p=Gt(e,t,"query",{query:n,params:c},void 0!==h||void 0!==f?{...d,fetch:{cache:h,next:f}}:d);return u.enabled?p.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ue.apply(void 0,a([],s(e)))}(Z(Promise.resolve().then((function(){return Fr})).then((function(e){return e.stegaEncodeSourceMap$1})).then((({stegaEncodeSourceMap:e})=>e)))),re((([e,t])=>{const r=t(e.result,e.resultSourceMap,u);return l({...e,result:r})}))):p.pipe(re(l))}function Ut(e,t,r,n={}){return Qt(e,t,{uri:Wt(e,"doc",r),json:!0,tag:n.tag}).pipe(ae(Dt),re((e=>e.body.documents&&e.body.documents[0])))}function Ht(e,t,r,n={}){return Qt(e,t,{uri:Wt(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(ae(Dt),re((e=>{const t=(n=e.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return r.map((e=>t[e]||null))})))}function zt(e,t,r,n){return it("createIfNotExists",r),Vt(e,t,r,"createIfNotExists",n)}function Lt(e,t,r,n){return it("createOrReplace",r),Vt(e,t,r,"createOrReplace",n)}function Bt(e,t,r,n){return Gt(e,t,"mutate",{mutations:[{delete:Ze(r)}]},n)}function Jt(e,t,r,n){let o;o=r instanceof lt||r instanceof ct?{patch:r.serialize()}:r instanceof dt||r instanceof pt?r.serialize():r;return Gt(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function Gt(e,t,r,n,o={}){const i="mutate"===r,s="query"===r,a=i?"":Pt(n),u=!i&&a.length<Mt,c=u?a:"",l=o.returnFirst,{timeout:h,token:f,tag:d,headers:p,returnQuery:y}=o;return Qt(e,t,{method:u?"GET":"POST",uri:Wt(e,r,c),json:!0,body:u?void 0:n,query:i&&kt(o),timeout:h,headers:p,token:f,tag:d,returnQuery:y,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:s,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal,useCdn:o.useCdn}).pipe(ae(Dt),re(Ft),re((e=>{if(!i)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function Vt(e,t,r,n,o={}){return Gt(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function Qt(e,t,r){const n=r.url||r.uri,o=e.config(),i=void 0===r.canUseCdn?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/"):r.canUseCdn;let s=(r.useCdn??o.useCdn)&&i;const a=r.tag&&o.requestTagPrefix?[o.requestTagPrefix,r.tag].join("."):r.tag||o.requestTagPrefix;if(a&&null!==r.tag&&(r.query={tag:at(a),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===n.indexOf("/data/query/")){const e=r.resultSourceMap??o.resultSourceMap;void 0!==e&&!1!==e&&(r.query={resultSourceMap:e,...r.query});const t=r.perspective||o.perspective;"string"==typeof t&&"raw"!==t&&(St(t),r.query={perspective:t,...r.query},"previewDrafts"===t&&s&&(s=!1,bt())),!1===r.returnQuery&&(r.query={returnQuery:"false",...r.query})}const u=function(e,t={}){const r={},n=t.token||e.token;n&&(r.Authorization=`Bearer ${n}`),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[_t]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),i=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===i?3e5:i,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(o,Object.assign({},r,{url:Xt(e,n,s)})),c=new A((e=>t(u,o.requester).subscribe(e)));return r.signal?c.pipe((l=r.signal,e=>new A((t=>{const r=()=>t.error(function(e){if(Kt)return new DOMException((null==e?void 0:e.reason)??"The operation was aborted.","AbortError");const t=new Error((null==e?void 0:e.reason)??"The operation was aborted.");return t.name="AbortError",t}(l));if(l&&l.aborted)return void r();const n=e.subscribe(t);return l.addEventListener("abort",r),()=>{l.removeEventListener("abort",r),n.unsubscribe()}})))):c;var l}function Yt(e,t,r){return Qt(e,t,r).pipe(ae((e=>"response"===e.type)),re((e=>e.body)))}function Wt(e,t,r){const n=e.config(),o=`/${t}/${st(n)}`;return`/data${r?`${o}/${r}`:o}`.replace(/\/($|\?)/,"$1")}function Xt(e,t,r=!1){const{url:n,cdnUrl:o}=e.config();return`${r?o:n}/${t.replace(/^\//,"")}`}const Kt=Boolean(globalThis.DOMException);class Zt{#a;#u;constructor(e,t){this.#a=e,this.#u=t}upload(e,t,r){return tr(this.#a,this.#u,e,t,r)}}class er{#a;#u;constructor(e,t){this.#a=e,this.#u=t}upload(e,t,r){return te(tr(this.#a,this.#u,e,t,r).pipe(ae((e=>"response"===e.type)),re((e=>e.body.document))))}}function tr(e,t,r,n,o={}){(e=>{if(-1===et.indexOf(e))throw new Error(`Invalid asset type: ${e}. Must be one of ${et.join(", ")}`)})(r);let i=o.extract||void 0;i&&!i.length&&(i=["none"]);const s=st(e.config()),a="image"===r?"images":"files",u=function(e,t){if("undefined"==typeof File||!(t instanceof File))return e;return Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,n),{tag:c,label:l,title:h,description:f,creditLine:d,filename:p,source:y}=u,g={label:l,title:h,description:f,filename:p,meta:i,creditLine:d};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),Qt(e,t,{tag:c,method:"POST",timeout:u.timeout||0,uri:`/assets/${a}/${s}`,headers:u.contentType?{"Content-Type":u.contentType}:{},query:g,body:n})}var rr=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{});const nr=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],or={includeResult:!0};function ir(e,t,r={}){const{url:n,token:o,withCredentials:i,requestTagPrefix:s}=this.config(),a=r.tag&&s?[s,r.tag].join("."):r.tag,u={...rr(r,or),tag:a},c=(l=u,nr.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const h=`${n}${Wt(this,"listen",Pt({query:e,params:t,options:{tag:a,...c}}))}`;if(h.length>14800)return new A((e=>e.error(new Error("Query too large for listener"))));const f=u.events?u.events:["mutation"],d=-1!==f.indexOf("reconnect"),p={};return(o||i)&&(p.withCredentials=!0),o&&(p.headers={Authorization:`Bearer ${o}`}),new A((e=>{let t,r;c().then((e=>{t=e})).catch((t=>{e.error(t),y()}));let n=!1;function o(){n||(d&&e.next({type:"reconnect"}),n||t.readyState===t.CLOSED&&(u(),clearTimeout(r),r=setTimeout(l,100)))}function i(t){e.error(function(e){if(e instanceof Error)return e;const t=sr(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function s(t){const r=sr(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,u(),e.complete()}function u(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",i),t.removeEventListener("disconnect",a),f.forEach((e=>t.removeEventListener(e,s))),t.close())}async function c(){const{default:e}=await Promise.resolve().then((function(){return Ur})),t=new e(h,p);return t.addEventListener("error",o),t.addEventListener("channelError",i),t.addEventListener("disconnect",a),f.forEach((e=>t.addEventListener(e,s))),t}function l(){c().then((e=>{t=e})).catch((t=>{e.error(t),y()}))}function y(){n=!0,u()}return y}))}function sr(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}class ar{#a;#u;constructor(e,t){this.#a=e,this.#u=t}create(e,t){return cr(this.#a,this.#u,"PUT",e,t)}edit(e,t){return cr(this.#a,this.#u,"PATCH",e,t)}delete(e){return cr(this.#a,this.#u,"DELETE",e)}list(){return Yt(this.#a,this.#u,{uri:"/datasets",tag:null})}}class ur{#a;#u;constructor(e,t){this.#a=e,this.#u=t}create(e,t){return te(cr(this.#a,this.#u,"PUT",e,t))}edit(e,t){return te(cr(this.#a,this.#u,"PATCH",e,t))}delete(e){return te(cr(this.#a,this.#u,"DELETE",e))}list(){return te(Yt(this.#a,this.#u,{uri:"/datasets",tag:null}))}}function cr(e,t,r,n,o){return rt(n),Yt(e,t,{method:r,uri:`/datasets/${n}`,body:o,tag:null})}class lr{#a;#u;constructor(e,t){this.#a=e,this.#u=t}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Yt(this.#a,this.#u,{uri:t})}getById(e){return Yt(this.#a,this.#u,{uri:`/projects/${e}`})}}class hr{#a;#u;constructor(e,t){this.#a=e,this.#u=t}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return te(Yt(this.#a,this.#u,{uri:t}))}getById(e){return te(Yt(this.#a,this.#u,{uri:`/projects/${e}`}))}}class fr{#a;#u;constructor(e,t){this.#a=e,this.#u=t}getById(e){return Yt(this.#a,this.#u,{uri:`/users/${e}`})}}class dr{#a;#u;constructor(e,t){this.#a=e,this.#u=t}getById(e){return te(Yt(this.#a,this.#u,{uri:`/users/${e}`}))}}class pr{constructor(e,t=Et){this.listen=ir,this.config(t),this.#u=e,this.assets=new Zt(this,this.#u),this.datasets=new ar(this,this.#u),this.projects=new lr(this,this.#u),this.users=new fr(this,this.#u)}#c;#u;clone(){return new pr(this.#u,this.config())}config(e){if(void 0===e)return{...this.#c};if(this.#c&&!1===this.#c.allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.#c=Rt(e,this.#c||{}),this}withConfig(e){const t=this.config();return new pr(this.#u,{...t,...e,stega:{...t.stega||{},..."boolean"==typeof(null==e?void 0:e.stega)?{enabled:e.stega}:(null==e?void 0:e.stega)||{}}})}fetch(e,t,r){return Nt(this,this.#u,this.#c.stega,e,t,r)}getDocument(e,t){return Ut(this,this.#u,e,t)}getDocuments(e,t){return Ht(this,this.#u,e,t)}create(e,t){return Vt(this,this.#u,e,"create",t)}createIfNotExists(e,t){return zt(this,this.#u,e,t)}createOrReplace(e,t){return Lt(this,this.#u,e,t)}delete(e,t){return Bt(this,this.#u,e,t)}mutate(e,t){return Jt(this,this.#u,e,t)}patch(e,t){return new ct(e,t,this)}transaction(e){return new pt(e,this)}request(e){return Yt(this,this.#u,e)}getUrl(e,t){return Xt(this,e,t)}getDataUrl(e,t){return Wt(this,e,t)}}class yr{constructor(e,t=Et){this.listen=ir,this.config(t),this.#u=e,this.assets=new er(this,this.#u),this.datasets=new ur(this,this.#u),this.projects=new hr(this,this.#u),this.users=new dr(this,this.#u),this.observable=new pr(e,t)}#c;#u;clone(){return new yr(this.#u,this.config())}config(e){if(void 0===e)return{...this.#c};if(this.#c&&!1===this.#c.allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),this.#c=Rt(e,this.#c||{}),this}withConfig(e){const t=this.config();return new yr(this.#u,{...t,...e,stega:{...t.stega||{},..."boolean"==typeof(null==e?void 0:e.stega)?{enabled:e.stega}:(null==e?void 0:e.stega)||{}}})}fetch(e,t,r){return te(Nt(this,this.#u,this.#c.stega,e,t,r))}getDocument(e,t){return te(Ut(this,this.#u,e,t))}getDocuments(e,t){return te(Ht(this,this.#u,e,t))}create(e,t){return te(Vt(this,this.#u,e,"create",t))}createIfNotExists(e,t){return te(zt(this,this.#u,e,t))}createOrReplace(e,t){return te(Lt(this,this.#u,e,t))}delete(e,t){return te(Bt(this,this.#u,e,t))}mutate(e,t){return te(Jt(this,this.#u,e,t))}patch(e,t){return new lt(e,t,this)}transaction(e){return new dt(e,this)}request(e){return te(Yt(this,this.#u,e))}dataRequest(e,t,r){return te(Gt(this,this.#u,e,t,r))}getUrl(e,t){return Xt(this,e,t)}getDataUrl(e,t){return Wt(this,e,t)}}const gr=function(e,t){return{requester:Xe(e,{}).defaultRequester,createClient:r=>new t(Xe(e,{maxRetries:r.maxRetries,retryDelay:r.retryDelay}),r)}}([],yr),mr=gr.requester,br=gr.createClient,vr=function(e){return function(t){return Ct(),e(t)}}(br),wr=/_key\s*==\s*['"](.*)['"]/;function Cr(e){if(!Array.isArray(e))throw new Error("Path is not an array");return e.reduce(((e,t,r)=>{const n=typeof t;if("number"===n)return`${e}[${t}]`;if("string"===n){return`${e}${0===r?"":"."}${t}`}if(function(e){return"string"==typeof e?wr.test(e.trim()):"object"==typeof e&&"_key"in e}(t)&&t._key)return`${e}[_key=="${t._key}"]`;if(Array.isArray(t)){const[r,n]=t;return`${e}[${r}:${n}]`}throw new Error(`Unsupported path segment \`${JSON.stringify(t)}\``)}),"")}const Er={"\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","'":"\\'","\\":"\\\\"},xr={"\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t","\\'":"'","\\\\":"\\"};function Sr(e){const t=[],r=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;let n;for(;null!==(n=r.exec(e));)if(void 0===n[1])if(void 0===n[2])if(void 0===n[3]);else{const e=n[3].replace(/\\(\\')/g,(e=>xr[e]));t.push({_key:e,_index:-1})}else t.push(parseInt(n[2],10));else{const e=n[1].replace(/\\(\\|f|n|r|t|')/g,(e=>xr[e]));t.push(e)}return t}function Rr(e){return e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw new Error(`invalid segment:${JSON.stringify(e)}`)}))}function _r(e,t){if(!(null==t?void 0:t.mappings))return;const r=function(e){return`$${e.map((e=>"string"==typeof e?`['${e.replace(/[\f\n\r\t'\\]/g,(e=>Er[e]))}']`:"number"==typeof e?`[${e}]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,(e=>Er[e]))}')]`:`[${e._index}]`)).join("")}`}(e.map((e=>{if("string"==typeof e)return e;if("number"==typeof e)return e;if(-1!==e._index)return e._index;throw new Error(`invalid segment:${JSON.stringify(e)}`)})));if(void 0!==t.mappings[r])return{mapping:t.mappings[r],matchedPath:r,pathSuffix:""};const n=Object.entries(t.mappings).filter((([e])=>r.startsWith(e))).sort((([e],[t])=>t.length-e.length));if(0==n.length)return;const[o,i]=n[0];return{mapping:i,matchedPath:o,pathSuffix:r.substring(o.length)}}function Or(e){return"object"==typeof e&&null!==e}function Tr(e,t,r=[]){return function(e){return null!==e&&Array.isArray(e)}(e)?e.map(((e,n)=>{if(Or(e)){const o=e._key;if("string"==typeof o)return Tr(e,t,r.concat({_key:o,_index:n}))}return Tr(e,t,r.concat(n))})):Or(e)?Object.fromEntries(Object.entries(e).map((([e,n])=>[e,Tr(n,t,r.concat(e))]))):t(e,r)}function qr(e,t,r){return Tr(e,((e,n)=>{if("string"!=typeof e)return e;const o=_r(n,t);if(!o)return e;const{mapping:i,matchedPath:s}=o;if("value"!==i.type)return e;if("documentValue"!==i.source.type)return e;const a=t.documents[i.source.document],u=t.paths[i.source.path],c=Sr(s),l=Sr(u).concat(n.slice(c.length));return r({sourcePath:l,sourceDocument:a,resultPath:n,value:e})}))}const $r="drafts.";function jr(e){const{baseUrl:t,workspace:r="default",tool:n="default",id:o,type:i,path:s,projectId:a,dataset:u}=e;if(!t)throw new Error("baseUrl is required");if(!s)throw new Error("path is required");if(!o)throw new Error("id is required");if("/"!==t&&t.endsWith("/"))throw new Error("baseUrl must not end with a slash");const c="default"===r?void 0:r,l="default"===n?void 0:n,h=function(e){return e.startsWith($r)?e.slice($r.length):e}(o),f=Array.isArray(s)?Cr(Rr(s)):s,d=new URLSearchParams({baseUrl:t,id:h,type:i,path:f});c&&d.set("workspace",c),l&&d.set("tool",l),a&&d.set("projectId",a),u&&d.set("dataset",u);const p=["/"===t?"":t];c&&p.push(c);const y=["mode=presentation",`id=${h}`,`type=${i}`,`path=${encodeURIComponent(f)}`];return l&&y.push(`tool=${l}`),p.push("intent","edit",`${y.join(";")}?${d}`),p.join("/")}const Ar=({sourcePath:e,value:t})=>{if(/^\d{4}-\d{2}-\d{2}/.test(r=t)&&Boolean(Date.parse(r))||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(t))return!1;var r;const n=e.at(-1);return("slug"!==e.at(-2)||"current"!==n)&&(("string"!=typeof n||!n.startsWith("_"))&&(("number"!=typeof n||"marks"!==e.at(-2))&&(("href"!==n||"number"!=typeof e.at(-2)||"markDefs"!==e.at(-3))&&("style"!==n&&"listItem"!==n&&(!e.some((e=>"meta"===e||"metadata"===e||"openGraph"===e||"seo"===e))&&("string"!=typeof n||!Ir.has(n)))))))},Ir=new Set(["color","colour","currency","email","format","gid","hex","href","hsl","hsla","icon","id","index","key","language","layout","link","linkAction","locale","lqip","page","path","ref","rgb","rgba","route","secret","slug","status","tag","template","theme","type","unit","url","username","variant","website"]);function Pr(e,t,r){var n,o,i,s,a,u,c,l,h;const{filter:f,logger:d,enabled:p}=r;if(!p){const o="config.enabled must be true, don't call this function otherwise";throw null==(n=null==d?void 0:d.error)||n.call(d,`[@sanity/client]: ${o}`,{result:e,resultSourceMap:t,config:r}),new TypeError(o)}if(!t)return null==(o=null==d?void 0:d.error)||o.call(d,"[@sanity/client]: Missing Content Source Map from response body",{result:e,resultSourceMap:t,config:r}),e;if(!r.studioUrl){const n="config.studioUrl must be defined";throw null==(i=null==d?void 0:d.error)||i.call(d,`[@sanity/client]: ${n}`,{result:e,resultSourceMap:t,config:r}),new TypeError(n)}const y={encoded:[],skipped:[]},g=qr(e,t,(({sourcePath:e,sourceDocument:t,resultPath:n,value:o})=>{if(!1===("function"==typeof f?f({sourcePath:e,resultPath:n,filterDefault:Ar,sourceDocument:t,value:o}):Ar({sourcePath:e,resultPath:n,filterDefault:Ar,sourceDocument:t,value:o})))return d&&y.skipped.push({path:kr(e),value:`${o.slice(0,20)}${o.length>20?"...":""}`,length:o.length}),o;d&&y.encoded.push({path:kr(e),value:`${o.slice(0,20)}${o.length>20?"...":""}`,length:o.length});const{baseUrl:i,workspace:s,tool:a}=function(e){let t="string"==typeof e?e:e.baseUrl;return"/"!==t&&(t=t.replace(/\/$/,"")),"string"==typeof e?{baseUrl:t}:{...e,baseUrl:t}}("function"==typeof r.studioUrl?r.studioUrl(t):r.studioUrl);if(!i)return o;const{_id:u,_type:c,_projectId:l,_dataset:h}=t;return $t(o,{origin:"sanity.io",href:jr({baseUrl:i,workspace:s,tool:a,id:u,type:c,path:e,...!r.omitCrossDatasetReferenceData&&{dataset:h,projectId:l}})},!1)}));if(d){const e=y.skipped.length,t=y.encoded.length;if((e||t)&&(null==(s=(null==d?void 0:d.groupCollapsed)||d.log)||s("[@sanity/client]: Encoding source map into result"),null==(a=d.log)||a.call(d,`[@sanity/client]: Paths encoded: ${y.encoded.length}, skipped: ${y.skipped.length}`)),y.encoded.length>0&&(null==(u=null==d?void 0:d.log)||u.call(d,"[@sanity/client]: Table of encoded paths"),null==(c=(null==d?void 0:d.table)||d.log)||c(y.encoded)),y.skipped.length>0){const e=new Set;for(const{path:t}of y.skipped)e.add(t.replace(wr,"0").replace(/\[\d+\]/g,"[]"));null==(l=null==d?void 0:d.log)||l.call(d,"[@sanity/client]: List of skipped paths",[...e.values()])}(e||t)&&(null==(h=null==d?void 0:d.groupEnd)||h.call(d))}return g}function kr(e){return Cr(Rr(e))}var Dr=Object.freeze({__proto__:null,stegaEncodeSourceMap:Pr}),Fr=Object.freeze({__proto__:null,encodeIntoResult:qr,stegaEncodeSourceMap:Pr,stegaEncodeSourceMap$1:Dr}),Mr={exports:{}};
|
|
8
|
+
function R(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},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=P(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(A,A.exports);const M=typeof Buffer>"u"?()=>!1:e=>Buffer.isBuffer(e),D=["boolean","string","number"];function F(){return{processOptions:e=>{const t=e.body;return!t||"function"==typeof t.pipe||M(t)||-1===D.indexOf(typeof t)&&!Array.isArray(t)&&(!1===R(r=t)||void 0!==(n=r.constructor)&&(!1===R(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"})});var r,n,o}}}function q(e){return{onResponse:r=>{const n=r.headers["content-type"]||"",o=e&&e.force||-1!==n.indexOf("application/json");return r.body&&n&&o?Object.assign({},r,{body:t(r.body)}):r},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: ${e.message}`,e}}}let N={};typeof globalThis<"u"?N=globalThis:typeof window<"u"?N=window:typeof global<"u"?N=global:typeof self<"u"&&(N=self);var U=N;function W(e={}){const t=e.implementation||U.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())))}}class H{constructor(e){this.__CANCEL__=!0,this.message=e}toString(){return"Cancel"+(this.message?`: ${this.message}`:"")}}const z=class{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new H(e),t(this.reason))}))}};z.source=()=>{let e;return{token:new z((t=>{e=t})),cancel:e}};var L=(e,t,r)=>("GET"===r.method||"HEAD"===r.method)&&(e.isNetworkError||!1);function B(e){return 100*Math.pow(2,e)+100*Math.random()}const J=(e={})=>(e=>{const t=e.maxRetries||5,r=e.retryDelay||B,n=e.shouldRetry;return{onError:(e,o)=>{const i=o.options,s=i.maxRetries||t,a=i.shouldRetry||n,u=i.attemptNumber||0;if(null!==(c=i.body)&&"object"==typeof c&&"function"==typeof c.pipe||!a(e,u,i)||u>=s)return e;var c;const l=Object.assign({},o,{options:Object.assign({},i,{attemptNumber:u+1})});return setTimeout((()=>o.channels.request.publish(l)),r(u)),null}}})({shouldRetry:L,...e});J.shouldRetry=L;var G=function(e,t){return G=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])},G(e,t)};function V(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}G(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Q(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}function Y(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function X(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 K(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function Z(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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 ee(e){return this instanceof ee?(this.v=e,this):new ee(e)}function te(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||a(e,t)}))})}function a(e,t){try{(r=o[e](t)).value instanceof ee?Promise.resolve(r.value.v).then(u,c):l(i[0][2],r)}catch(e){l(i[0][3],e)}var r}function u(e){a("next",e)}function c(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function re(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=X(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function ne(e){return"function"==typeof e}function oe(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}"function"==typeof SuppressedError&&SuppressedError;var ie=oe((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 se(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ae=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 i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var s=X(i),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else i.remove(this);var u=this.initialTeardown;if(ne(u))try{u()}catch(e){o=e instanceof ie?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=X(c),d=l.next();!d.done;d=l.next()){var f=d.value;try{ce(f)}catch(e){o=null!=o?o:[],e instanceof ie?o=Z(Z([],K(o)),K(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 ie(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ce(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)&&se(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&se(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function ue(e){return e instanceof ae||e&&"closed"in e&&ne(e.remove)&&ne(e.add)&&ne(e.unsubscribe)}function ce(e){ne(e)?e():e.unsubscribe()}ae.EMPTY;var le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},de={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Z([e,t],K(r)))},clearTimeout:function(e){var t=de.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function fe(e){de.setTimeout((function(){throw e}))}function he(){}var pe=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,ue(t)&&t.add(r)):r.destination=we,r}return V(t,e),t.create=function(e,t,r){return new ve(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}(ae),ye=Function.prototype.bind;function ge(e,t){return ye.call(e,t)}var me=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){be(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){be(e)}else be(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){be(e)}},e}(),ve=function(e){function t(t,r,n){var o,i,s=e.call(this)||this;ne(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&le.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&ge(t.next,i),error:t.error&&ge(t.error,i),complete:t.complete&&ge(t.complete,i)}):o=t;return s.destination=new me(o),s}return V(t,e),t}(pe);function be(e){fe(e)}var we={closed:!0,next:he,error:function(e){throw e},complete:he},Ce="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ee(e){return e}function xe(e){return 0===e.length?Ee:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var Se=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,i=(n=e)&&n instanceof pe||function(e){return e&&ne(e.next)&&ne(e.error)&&ne(e.complete)}(n)&&ue(n)?e:new ve(e,t,r);return function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=Te(t))((function(t,n){var o=new ve({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[Ce]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Te(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 Te(e){var t;return null!==(t=null!=e?e:le.Promise)&&void 0!==t?t:Promise}function _e(e){return function(t){if(function(e){return ne(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 Oe(e,t,r,n,o){return new $e(e,t,r,n,o)}var $e=function(e){function t(t,r,n,o,i,s){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=s,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 V(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}(pe);var je=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function ke(e){return ne(null==e?void 0:e.then)}function Ae(e){return ne(e[Ce])}function Ie(e){return Symbol.asyncIterator&&ne(null==e?void 0:e[Symbol.asyncIterator])}function Pe(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Re="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Me(e){return ne(null==e?void 0:e[Re])}function De(e){return te(this,arguments,(function(){var t,r,n;return Y(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,ee(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,ee(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,ee(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function Fe(e){return ne(null==e?void 0:e.getReader)}function qe(e){if(e instanceof Se)return e;if(null!=e){if(Ae(e))return o=e,new Se((function(e){var t=o[Ce]();if(ne(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(je(e))return n=e,new Se((function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()}));if(ke(e))return r=e,new Se((function(e){r.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,fe)}));if(Ie(e))return Ne(e);if(Me(e))return t=e,new Se((function(e){var r,n;try{for(var o=X(t),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()}));if(Fe(e))return Ne(De(e))}var t,r,n,o;throw Pe(e)}function Ne(e){return new Se((function(t){(function(e,t){var r,n,o,i;return Q(this,void 0,void 0,(function(){var s,a;return Y(this,(function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=re(e),u.label=1;case 1:return[4,r.next()];case 2:if((n=u.sent()).done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),o={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function Ue(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var i=t.schedule((function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()}),n);if(e.add(i),!o)return i}function We(e,t){return void 0===t&&(t=0),_e((function(r,n){r.subscribe(Oe(n,(function(r){return Ue(n,e,(function(){return n.next(r)}),t)}),(function(){return Ue(n,e,(function(){return n.complete()}),t)}),(function(r){return Ue(n,e,(function(){return n.error(r)}),t)})))}))}function He(e,t){return void 0===t&&(t=0),_e((function(r,n){n.add(e.schedule((function(){return r.subscribe(n)}),t))}))}function ze(e,t){if(!e)throw new Error("Iterable cannot be null");return new Se((function(r){Ue(r,t,(function(){var n=e[Symbol.asyncIterator]();Ue(r,t,(function(){n.next().then((function(e){e.done?r.complete():r.next(e.value)}))}),0,!0)}))}))}function Le(e,t){if(null!=e){if(Ae(e))return function(e,t){return qe(e).pipe(He(t),We(t))}(e,t);if(je(e))return function(e,t){return new Se((function(r){var n=0;return t.schedule((function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())}))}))}(e,t);if(ke(e))return function(e,t){return qe(e).pipe(He(t),We(t))}(e,t);if(Ie(e))return ze(e,t);if(Me(e))return function(e,t){return new Se((function(r){var n;return Ue(r,t,(function(){n=e[Re](),Ue(r,t,(function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)}),0,!0)})),function(){return ne(null==n?void 0:n.return)&&n.return()}}))}(e,t);if(Fe(e))return function(e,t){return ze(De(e),t)}(e,t)}throw Pe(e)}function Be(e,t){return t?Le(e,t):qe(e)}var Je=oe((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ge(e,t){var r="object"==typeof t;return new Promise((function(n,o){var i,s=!1;e.subscribe({next:function(e){i=e,s=!0},error:o,complete:function(){s?n(i):r?n(t.defaultValue):o(new Je)}})}))}function Ve(e,t){return _e((function(r,n){var o=0;r.subscribe(Oe(n,(function(r){n.next(e.call(t,r,o++))})))}))}var Qe=Array.isArray;function Ye(e){return Ve((function(t){return function(e,t){return Qe(t)?e.apply(void 0,Z([],K(t))):e(t)}(e,t)}))}function Xe(e,t,r){e?Ue(r,e,t):t()}var Ke=Array.isArray;function Ze(e,t){return _e((function(r,n){var o=0;r.subscribe(Oe(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}function et(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return ne((t=e)[t.length-1])?e.pop():void 0;var t}(e);return r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xe(e)}(et.apply(void 0,Z([],K(e))),Ye(r)):_e((function(t,r){var n,o,i;(n=Z([t],K(function(e){return 1===e.length&&Ke(e[0])?e[0]:e}(e))),void 0===i&&(i=Ee),function(e){Xe(o,(function(){for(var t=n.length,r=new Array(t),s=t,a=t,u=function(t){Xe(o,(function(){var u=Be(n[t],o),c=!1;u.subscribe(Oe(e,(function(n){r[t]=n,c||(c=!0,a--),a||e.next(i(r.slice()))}),(function(){--s||e.complete()})))}),e)},c=0;c<t;c++)u(c)}),e)})(r)}))}class tt extends Error{constructor(e){const t=nt(e);super(t.message),this.statusCode=400,Object.assign(this,t)}}class rt extends Error{constructor(e){const t=nt(e);super(t.message),this.statusCode=500,Object.assign(this,t)}}function nt(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:it(t,e),message:"",details:void 0};if(t.error&&t.message)return r.message=`${t.error} - ${t.message}`,r;if(function(e){return ot(e)&&ot(e.error)&&"mutationError"===e.error.type&&"string"==typeof e.error.description}(t)){const e=t.error.items||[],n=e.slice(0,5).map((e=>{var t;return null==(t=e.error)?void 0:t.description})).filter(Boolean);let o=n.length?`:\n- ${n.join("\n- ")}`:"";return e.length>5&&(o+=`\n...and ${e.length-5} more`),r.message=`${t.error.description}${o}`,r.details=t.error,r}return 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 ot(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function it(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}const st={onResponse:e=>{if(e.statusCode>=500)throw new rt(e);if(e.statusCode>=400)throw new tt(e);return e}},at={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}};function ut(e,{maxRetries:t=5,retryDelay:r}){const n=$([t>0?J({retryDelay:r,maxRetries:t,shouldRetry:ct}):{},...e,at,F(),q(),{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"))}},st,W({implementation:Se})]);function o(e,t=n){return t({maxRedirects:0,...e})}return o.defaultRequester=n,o}function ct(e,t,r){const n="GET"===r.method||"HEAD"===r.method,o=(r.uri||r.url).startsWith("/data/query"),i=e.response&&(429===e.response.statusCode||502===e.response.statusCode||503===e.response.statusCode);return!(!n&&!o||!i)||J.shouldRetry(e,t,r)}function lt(e){if("string"==typeof e)return{id:e};if(Array.isArray(e))return{query:"*[_id in $ids]",params:{ids:e}};if("object"==typeof e&&null!==e&&"query"in e&&"string"==typeof e.query)return"params"in e&&"object"==typeof e.params&&null!==e.params?{query:e.query,params:e.params}:{query:e.query};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 dt=["image","file"],ft=["before","after","replace"],ht=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")},pt=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error(`${e}() takes an object of properties`)},yt=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(t)||t.includes(".."))throw new Error(`${e}(): "${t}" is not a valid document ID`)},gt=(e,t)=>{if(!t._id)throw new Error(`${e}() requires that the document contains an ID ("_id" property)`);yt(e,t._id)},mt=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},vt=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};var bt,wt=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ct=(e,t,r)=>(wt(e,t,"read from private field"),r?r.call(e):t.get(e)),Et=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},xt=(e,t,r,n)=>(wt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class St{constructor(e,t={}){this.selection=e,this.operations=t}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return pt("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,r){return((e,t,r)=>{const n="insert(at, selector, items)";if(-1===ft.indexOf(e)){const e=ft.map((e=>`"${e}"`)).join(", ");throw new Error(`${n} takes an "at"-argument which is one of: ${e}`)}if("string"!=typeof t)throw new Error(`${n} takes a "selector"-argument which must be a string`);if(!Array.isArray(r))throw new Error(`${n} takes an "items"-argument which must be an array`)})(e,t,r),this._assign("insert",{[e]:t,items:r})}append(e,t){return this.insert("after",`${e}[-1]`,t)}prepend(e,t){return this.insert("before",`${e}[0]`,t)}splice(e,t,r,n){const o=t<0?t-1:t,i=typeof r>"u"||-1===r?-1:Math.max(0,t+r),s=`${e}[${o}:${o<0&&i>=0?"":i}]`;return this.insert("replace",s,n||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...lt(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,t,r=!0){return pt(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}_set(e,t){return this._assign(e,t,!1)}}bt=new WeakMap;let Tt=class e extends St{constructor(e,t,r){super(e,t),Et(this,bt,void 0),xt(this,bt,r)}clone(){return new e(this.selection,{...this.operations},Ct(this,bt))}commit(e){if(!Ct(this,bt))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 Ct(this,bt).mutate({patch:this.serialize()},r)}};var _t;_t=new WeakMap;let Ot=class e extends St{constructor(e,t,r){super(e,t),Et(this,_t,void 0),xt(this,_t,r)}clone(){return new e(this.selection,{...this.operations},Ct(this,_t))}commit(e){if(!Ct(this,_t))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 Ct(this,_t).mutate({patch:this.serialize()},r)}};var $t=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},jt=(e,t,r)=>($t(e,t,"read from private field"),r?r.call(e):t.get(e)),kt=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},At=(e,t,r,n)=>($t(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const It={returnDocuments:!1};class Pt{constructor(e=[],t){this.operations=e,this.trxId=t}create(e){return pt("create",e),this._add({create:e})}createIfNotExists(e){const t="createIfNotExists";return pt(t,e),gt(t,e),this._add({[t]:e})}createOrReplace(e){const t="createOrReplace";return pt(t,e),gt(t,e),this._add({[t]:e})}delete(e){return yt("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}}var Rt;Rt=new WeakMap;let Mt=class e extends Pt{constructor(e,t,r){super(e,r),kt(this,Rt,void 0),At(this,Rt,t)}clone(){return new e([...this.operations],jt(this,Rt),this.trxId)}commit(e){if(!jt(this,Rt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return jt(this,Rt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},It,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Ot)return this._add({patch:e.serialize()});if(r){const r=t(new Ot(e,{},jt(this,Rt)));if(!(r instanceof Ot))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};var Dt;Dt=new WeakMap;let Ft=class e extends Pt{constructor(e,t,r){super(e,r),kt(this,Dt,void 0),At(this,Dt,t)}clone(){return new e([...this.operations],jt(this,Dt),this.trxId)}commit(e){if(!jt(this,Dt))throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return jt(this,Dt).mutate(this.serialize(),Object.assign({transactionId:this.trxId},It,e||{}))}patch(e,t){const r="function"==typeof t;if("string"!=typeof e&&e instanceof Tt)return this._add({patch:e.serialize()});if(r){const r=t(new Tt(e,{},jt(this,Dt)));if(!(r instanceof Tt))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:{id:e,...t}})}};function qt(e){return"https://www.sanity.io/help/"+e}const Nt=e=>function(e){let t,r=!1;return(...n)=>(r||(t=e(...n),r=!0),t)}(((...t)=>console.warn(e.join(" "),...t))),Ut=Nt(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),Wt=Nt(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),Ht=Nt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${qt("js-client-browser-token")} for more information and how to hide this warning.`]),zt=Nt(["Using the Sanity client without specifying an API version is deprecated.",`See ${qt("js-client-api-version")}`]),Lt=Nt(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]),Bt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},Jt=["localhost","127.0.0.1","0.0.0.0"],Gt=function(e){switch(e){case"previewDrafts":case"published":case"raw":return;default:throw new TypeError("Invalid API perspective string, expected `published`, `previewDrafts` or `raw`")}},Vt=(e,t)=>{const r={...t,...e,stega:{..."boolean"==typeof t.stega?{enabled:t.stega}:t.stega||Bt.stega,..."boolean"==typeof e.stega?{enabled:e.stega}:e.stega||{}}};r.apiVersion||zt();const n={...Bt,...r},o=n.useProjectHostname;if(typeof Promise>"u"){const e=qt("js-client-promise-polyfill");throw new Error(`No native Promise-implementation found, polyfill needed - see ${e}`)}if(o&&!n.projectId)throw new Error("Configuration must contain `projectId`");if("string"==typeof n.perspective&&Gt(n.perspective),"encodeSourceMap"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in n)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");if("boolean"!=typeof n.stega.enabled)throw new Error(`stega.enabled must be a boolean, received ${n.stega.enabled}`);if(n.stega.enabled&&void 0===n.stega.studioUrl)throw new Error("stega.studioUrl must be defined when stega.enabled is true");if(n.stega.enabled&&"string"!=typeof n.stega.studioUrl&&"function"!=typeof n.stega.studioUrl)throw new Error(`stega.studioUrl must be a string or a function, received ${n.stega.studioUrl}`);const i=typeof window<"u"&&window.location&&window.location.hostname,s=i&&(e=>-1!==Jt.indexOf(e))(window.location.hostname);i&&s&&n.token&&!0!==n.ignoreBrowserTokenWarning?Ht():typeof n.useCdn>"u"&&Ut(),o&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(n.projectId),n.dataset&&ht(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?vt(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion=`${n.apiVersion}`.replace(/^v/,""),n.isDefaultApi=n.apiHost===Bt.apiHost,n.useCdn=!1!==n.useCdn&&!n.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`")}(n.apiVersion);const a=n.apiHost.split("://",2),u=a[0],c=a[1],l=n.isDefaultApi?"apicdn.sanity.io":c;return n.useProjectHostname?(n.url=`${u}://${n.projectId}.${c}/v${n.apiVersion}`,n.cdnUrl=`${u}://${n.projectId}.${l}/v${n.apiVersion}`):(n.url=`${n.apiHost}/v${n.apiVersion}`,n.cdnUrl=n.url),n},Qt="X-Sanity-Project-ID";var Yt={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},Xt={0:8203,1:8204,2:8205,3:65279},Kt=new Array(4).fill(String.fromCodePoint(Xt[0])).join("");function Zt(e,t,r="auto"){return!0===r||"auto"===r&&(function(e){return!!Number.isNaN(Number(e))&&!!Date.parse(e)}(e)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(e))?e:`${e}${function(e){let t=JSON.stringify(e);return`${Kt}${Array.from(t).map((e=>{let r=e.charCodeAt(0);if(r>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${t} on character ${e} (${r})`);return Array.from(r.toString(4).padStart(4,"0")).map((e=>String.fromCodePoint(Xt[e]))).join("")})).join("")}`}(t)}`}Object.fromEntries(Object.entries(Xt).map((e=>e.reverse()))),Object.fromEntries(Object.entries(Yt).map((e=>e.reverse())));var er=`${Object.values(Yt).map((e=>`\\u{${e.toString(16)}}`)).join("")}`,tr=new RegExp(`[${er}]{4,}`,"gu");function rr(e){try{return JSON.parse(JSON.stringify(e,((e,t)=>{return"string"!=typeof t?t:(r=t,{cleaned:r.replace(tr,""),encoded:(null==(n=r.match(tr))?void 0:n[0])||""}).cleaned;var r,n})))}catch{return e}}const nr=({query:e,params:t={},options:r={}})=>{const n=new URLSearchParams,{tag:o,returnQuery:i,...s}=r;o&&n.append("tag",o),n.append("query",e);for(const[e,r]of Object.entries(t))n.append(`$${e}`,JSON.stringify(r));for(const[e,t]of Object.entries(s))t&&n.append(e,`${t}`);return!1===i&&n.append("returnQuery","false"),`?${n}`},or=(e={})=>{return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:typeof t>"u"?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},ir=e=>"response"===e.type,sr=e=>e.body,ar=11264;function ur(e,t,r,n,o={},i={}){const s="stega"in i?{...r||{},..."boolean"==typeof i.stega?{enabled:i.stega}:i.stega||{}}:r,a=s.enabled?rr(o):o,u=!1===i.filterResponse?e=>e:e=>e.result,{cache:c,next:l,...d}={useAbortSignal:typeof i.signal<"u",resultSourceMap:s.enabled?"withKeyArraySelector":i.resultSourceMap,...i,returnQuery:!1===i.filterResponse&&!1!==i.returnQuery},f=yr(e,t,"query",{query:n,params:a},typeof c<"u"||typeof l<"u"?{...d,fetch:{cache:c,next:l}}:d);return s.enabled?f.pipe(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return et.apply(void 0,Z([],K(e)))}(Be(Promise.resolve().then((function(){return Qn})).then((function(e){return e.stegaEncodeSourceMap$1})).then((({stegaEncodeSourceMap:e})=>e)))),Ve((([e,t])=>{const r=t(e.result,e.resultSourceMap,s);return u({...e,result:r})}))):f.pipe(Ve(u))}function cr(e,t,r,n={}){return mr(e,t,{uri:br(e,"doc",r),json:!0,tag:n.tag}).pipe(Ze(ir),Ve((e=>e.body.documents&&e.body.documents[0])))}function lr(e,t,r,n={}){return mr(e,t,{uri:br(e,"doc",r.join(",")),json:!0,tag:n.tag}).pipe(Ze(ir),Ve((e=>{const t=(n=e.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return r.map((e=>t[e]||null))})))}function dr(e,t,r,n){return gt("createIfNotExists",r),gr(e,t,r,"createIfNotExists",n)}function fr(e,t,r,n){return gt("createOrReplace",r),gr(e,t,r,"createOrReplace",n)}function hr(e,t,r,n){return yr(e,t,"mutate",{mutations:[{delete:lt(r)}]},n)}function pr(e,t,r,n){let o;o=r instanceof Ot||r instanceof Tt?{patch:r.serialize()}:r instanceof Mt||r instanceof Ft?r.serialize():r;return yr(e,t,"mutate",{mutations:Array.isArray(o)?o:[o],transactionId:n&&n.transactionId||void 0},n)}function yr(e,t,r,n,o={}){const i="mutate"===r,s="query"===r,a=i?"":nr(n),u=!i&&a.length<ar,c=u?a:"",l=o.returnFirst,{timeout:d,token:f,tag:h,headers:p,returnQuery:y}=o;return mr(e,t,{method:u?"GET":"POST",uri:br(e,r,c),json:!0,body:u?void 0:n,query:i&&or(o),timeout:d,headers:p,token:f,tag:h,returnQuery:y,perspective:o.perspective,resultSourceMap:o.resultSourceMap,canUseCdn:s,signal:o.signal,fetch:o.fetch,useAbortSignal:o.useAbortSignal,useCdn:o.useCdn}).pipe(Ze(ir),Ve(sr),Ve((e=>{if(!i)return e;const t=e.results||[];if(o.returnDocuments)return l?t[0]&&t[0].document:t.map((e=>e.document));const r=l?"documentId":"documentIds",n=l?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[r]:n}})))}function gr(e,t,r,n,o={}){return yr(e,t,"mutate",{mutations:[{[n]:r}]},Object.assign({returnFirst:!0,returnDocuments:!0},o))}function mr(e,t,r){var n,o;const i=r.url||r.uri,s=e.config(),a=typeof r.canUseCdn>"u"?["GET","HEAD"].indexOf(r.method||"GET")>=0&&0===i.indexOf("/data/"):r.canUseCdn;let u=(null!=(n=r.useCdn)?n:s.useCdn)&&a;const c=r.tag&&s.requestTagPrefix?[s.requestTagPrefix,r.tag].join("."):r.tag||s.requestTagPrefix;if(c&&null!==r.tag&&(r.query={tag:vt(c),...r.query}),["GET","HEAD","POST"].indexOf(r.method||"GET")>=0&&0===i.indexOf("/data/query/")){const e=null!=(o=r.resultSourceMap)?o:s.resultSourceMap;void 0!==e&&!1!==e&&(r.query={resultSourceMap:e,...r.query});const t=r.perspective||s.perspective;"string"==typeof t&&"raw"!==t&&(Gt(t),r.query={perspective:t,...r.query},"previewDrafts"===t&&u&&(u=!1,Wt())),!1===r.returnQuery&&(r.query={returnQuery:"false",...r.query})}const l=function(e,t={}){const r={},n=t.token||e.token;n&&(r.Authorization=`Bearer ${n}`),!t.useGlobalApi&&!e.useProjectHostname&&e.projectId&&(r[Qt]=e.projectId);const o=!!(typeof t.withCredentials>"u"?e.token||e.withCredentials:t.withCredentials),i=typeof t.timeout>"u"?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:typeof i>"u"?3e5:i,proxy:t.proxy||e.proxy,json:!0,withCredentials:o,fetch:"object"==typeof t.fetch&&"object"==typeof e.fetch?{...e.fetch,...t.fetch}:t.fetch||e.fetch})}(s,Object.assign({},r,{url:wr(e,i,u)})),d=new Se((e=>t(l,s.requester).subscribe(e)));return r.signal?d.pipe((f=r.signal,e=>new Se((t=>{const r=()=>t.error(function(e){var t,r;if(Cr)return new DOMException(null!=(t=null==e?void 0:e.reason)?t:"The operation was aborted.","AbortError");const n=new Error(null!=(r=null==e?void 0:e.reason)?r:"The operation was aborted.");return n.name="AbortError",n}(f));if(f&&f.aborted)return void r();const n=e.subscribe(t);return f.addEventListener("abort",r),()=>{f.removeEventListener("abort",r),n.unsubscribe()}})))):d;var f}function vr(e,t,r){return mr(e,t,r).pipe(Ze((e=>"response"===e.type)),Ve((e=>e.body)))}function br(e,t,r){const n=e.config(),o=`/${t}/${mt(n)}`;return`/data${r?`${o}/${r}`:o}`.replace(/\/($|\?)/,"$1")}function wr(e,t,r=!1){const{url:n,cdnUrl:o}=e.config();return`${r?o:n}/${t.replace(/^\//,"")}`}const Cr=!!globalThis.DOMException;var Er,xr,Sr,Tr,_r=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Or=(e,t,r)=>(_r(e,t,"read from private field"),r?r.call(e):t.get(e)),$r=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},jr=(e,t,r,n)=>(_r(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class kr{constructor(e,t){$r(this,Er,void 0),$r(this,xr,void 0),jr(this,Er,e),jr(this,xr,t)}upload(e,t,r){return Ir(Or(this,Er),Or(this,xr),e,t,r)}}Er=new WeakMap,xr=new WeakMap;class Ar{constructor(e,t){$r(this,Sr,void 0),$r(this,Tr,void 0),jr(this,Sr,e),jr(this,Tr,t)}upload(e,t,r){return Ge(Ir(Or(this,Sr),Or(this,Tr),e,t,r).pipe(Ze((e=>"response"===e.type)),Ve((e=>e.body.document))))}}function Ir(e,t,r,n,o={}){(e=>{if(-1===dt.indexOf(e))throw new Error(`Invalid asset type: ${e}. Must be one of ${dt.join(", ")}`)})(r);let i=o.extract||void 0;i&&!i.length&&(i=["none"]);const s=mt(e.config()),a="image"===r?"images":"files",u=function(e,t){return typeof File>"u"||!(t instanceof File)?e:Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e)}(o,n),{tag:c,label:l,title:d,description:f,creditLine:h,filename:p,source:y}=u,g={label:l,title:d,description:f,filename:p,meta:i,creditLine:h};return y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url),mr(e,t,{tag:c,method:"POST",timeout:u.timeout||0,uri:`/assets/${a}/${s}`,headers:u.contentType?{"Content-Type":u.contentType}:{},query:g,body:n})}Sr=new WeakMap,Tr=new WeakMap;const Pr=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],Rr={includeResult:!0};function Mr(e,t,r={}){const{url:n,token:o,withCredentials:i,requestTagPrefix:s}=this.config(),a=r.tag&&s?[s,r.tag].join("."):r.tag,u={...(d=r,f=Rr,Object.keys(f).concat(Object.keys(d)).reduce(((e,t)=>(e[t]=typeof d[t]>"u"?f[t]:d[t],e)),{})),tag:a},c=((e,t)=>t.reduce(((t,r)=>(typeof e[r]>"u"||(t[r]=e[r]),t)),{}))(u,Pr),l=`${n}${br(this,"listen",nr({query:e,params:t,options:{tag:a,...c}}))}`;var d,f;if(l.length>14800)return new Se((e=>e.error(new Error("Query too large for listener"))));const h=u.events?u.events:["mutation"],p=-1!==h.indexOf("reconnect"),y={};return(o||i)&&(y.withCredentials=!0),o&&(y.headers={Authorization:`Bearer ${o}`}),new Se((e=>{let t;c().then((e=>{t=e})).catch((t=>{e.error(t),f()}));let r,n=!1;function o(){n||(p&&e.next({type:"reconnect"}),!n&&t.readyState===t.CLOSED&&(u(),clearTimeout(r),r=setTimeout(d,100)))}function i(t){e.error(function(e){if(e instanceof Error)return e;const t=Dr(e);return t instanceof Error?t:new Error(function(e){return e.error?e.error.description?e.error.description:"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2):e.message||"Unknown listener error"}(t))}(t))}function s(t){const r=Dr(t);return r instanceof Error?e.error(r):e.next(r)}function a(){n=!0,u(),e.complete()}function u(){t&&(t.removeEventListener("error",o),t.removeEventListener("channelError",i),t.removeEventListener("disconnect",a),h.forEach((e=>t.removeEventListener(e,s))),t.close())}async function c(){const{default:e}=await Promise.resolve().then((function(){return Kn})),t=new e(l,y);return t.addEventListener("error",o),t.addEventListener("channelError",i),t.addEventListener("disconnect",a),h.forEach((e=>t.addEventListener(e,s))),t}function d(){c().then((e=>{t=e})).catch((t=>{e.error(t),f()}))}function f(){n=!0,u()}return f}))}function Dr(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}var Fr,qr,Nr,Ur,Wr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Hr=(e,t,r)=>(Wr(e,t,"read from private field"),r?r.call(e):t.get(e)),zr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Lr=(e,t,r,n)=>(Wr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class Br{constructor(e,t){zr(this,Fr,void 0),zr(this,qr,void 0),Lr(this,Fr,e),Lr(this,qr,t)}create(e,t){return Gr(Hr(this,Fr),Hr(this,qr),"PUT",e,t)}edit(e,t){return Gr(Hr(this,Fr),Hr(this,qr),"PATCH",e,t)}delete(e){return Gr(Hr(this,Fr),Hr(this,qr),"DELETE",e)}list(){return vr(Hr(this,Fr),Hr(this,qr),{uri:"/datasets",tag:null})}}Fr=new WeakMap,qr=new WeakMap;class Jr{constructor(e,t){zr(this,Nr,void 0),zr(this,Ur,void 0),Lr(this,Nr,e),Lr(this,Ur,t)}create(e,t){return Ge(Gr(Hr(this,Nr),Hr(this,Ur),"PUT",e,t))}edit(e,t){return Ge(Gr(Hr(this,Nr),Hr(this,Ur),"PATCH",e,t))}delete(e){return Ge(Gr(Hr(this,Nr),Hr(this,Ur),"DELETE",e))}list(){return Ge(vr(Hr(this,Nr),Hr(this,Ur),{uri:"/datasets",tag:null}))}}function Gr(e,t,r,n,o){return ht(n),vr(e,t,{method:r,uri:`/datasets/${n}`,body:o,tag:null})}Nr=new WeakMap,Ur=new WeakMap;var Vr,Qr,Yr,Xr,Kr=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Zr=(e,t,r)=>(Kr(e,t,"read from private field"),r?r.call(e):t.get(e)),en=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},tn=(e,t,r,n)=>(Kr(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class rn{constructor(e,t){en(this,Vr,void 0),en(this,Qr,void 0),tn(this,Vr,e),tn(this,Qr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return vr(Zr(this,Vr),Zr(this,Qr),{uri:t})}getById(e){return vr(Zr(this,Vr),Zr(this,Qr),{uri:`/projects/${e}`})}}Vr=new WeakMap,Qr=new WeakMap;class nn{constructor(e,t){en(this,Yr,void 0),en(this,Xr,void 0),tn(this,Yr,e),tn(this,Xr,t)}list(e){const t=!1===(null==e?void 0:e.includeMembers)?"/projects?includeMembers=false":"/projects";return Ge(vr(Zr(this,Yr),Zr(this,Xr),{uri:t}))}getById(e){return Ge(vr(Zr(this,Yr),Zr(this,Xr),{uri:`/projects/${e}`}))}}Yr=new WeakMap,Xr=new WeakMap;var on,sn,an,un,cn=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},ln=(e,t,r)=>(cn(e,t,"read from private field"),r?r.call(e):t.get(e)),dn=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},fn=(e,t,r,n)=>(cn(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);class hn{constructor(e,t){dn(this,on,void 0),dn(this,sn,void 0),fn(this,on,e),fn(this,sn,t)}getById(e){return vr(ln(this,on),ln(this,sn),{uri:`/users/${e}`})}}on=new WeakMap,sn=new WeakMap;class pn{constructor(e,t){dn(this,an,void 0),dn(this,un,void 0),fn(this,an,e),fn(this,un,t)}getById(e){return Ge(vr(ln(this,an),ln(this,un),{uri:`/users/${e}`}))}}an=new WeakMap,un=new WeakMap;var yn,gn,mn=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},vn=(e,t,r)=>(mn(e,t,"read from private field"),r?r.call(e):t.get(e)),bn=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},wn=(e,t,r,n)=>(mn(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);yn=new WeakMap,gn=new WeakMap;let Cn=class e{constructor(e,t=Bt){bn(this,yn,void 0),bn(this,gn,void 0),this.listen=Mr,this.config(t),wn(this,gn,e),this.assets=new kr(this,vn(this,gn)),this.datasets=new Br(this,vn(this,gn)),this.projects=new rn(this,vn(this,gn)),this.users=new hn(this,vn(this,gn))}clone(){return new e(vn(this,gn),this.config())}config(e){if(void 0===e)return{...vn(this,yn)};if(vn(this,yn)&&!1===vn(this,yn).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return wn(this,yn,Vt(e,vn(this,yn)||{})),this}withConfig(t){const r=this.config();return new e(vn(this,gn),{...r,...t,stega:{...r.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,r){return ur(this,vn(this,gn),vn(this,yn).stega,e,t,r)}getDocument(e,t){return cr(this,vn(this,gn),e,t)}getDocuments(e,t){return lr(this,vn(this,gn),e,t)}create(e,t){return gr(this,vn(this,gn),e,"create",t)}createIfNotExists(e,t){return dr(this,vn(this,gn),e,t)}createOrReplace(e,t){return fr(this,vn(this,gn),e,t)}delete(e,t){return hr(this,vn(this,gn),e,t)}mutate(e,t){return pr(this,vn(this,gn),e,t)}patch(e,t){return new Tt(e,t,this)}transaction(e){return new Ft(e,this)}request(e){return vr(this,vn(this,gn),e)}getUrl(e,t){return wr(this,e,t)}getDataUrl(e,t){return br(this,e,t)}};var En,xn;En=new WeakMap,xn=new WeakMap;let Sn=class e{constructor(e,t=Bt){bn(this,En,void 0),bn(this,xn,void 0),this.listen=Mr,this.config(t),wn(this,xn,e),this.assets=new Ar(this,vn(this,xn)),this.datasets=new Jr(this,vn(this,xn)),this.projects=new nn(this,vn(this,xn)),this.users=new pn(this,vn(this,xn)),this.observable=new Cn(e,t)}clone(){return new e(vn(this,xn),this.config())}config(e){if(void 0===e)return{...vn(this,En)};if(vn(this,En)&&!1===vn(this,En).allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),wn(this,En,Vt(e,vn(this,En)||{})),this}withConfig(t){const r=this.config();return new e(vn(this,xn),{...r,...t,stega:{...r.stega||{},..."boolean"==typeof(null==t?void 0:t.stega)?{enabled:t.stega}:(null==t?void 0:t.stega)||{}}})}fetch(e,t,r){return Ge(ur(this,vn(this,xn),vn(this,En).stega,e,t,r))}getDocument(e,t){return Ge(cr(this,vn(this,xn),e,t))}getDocuments(e,t){return Ge(lr(this,vn(this,xn),e,t))}create(e,t){return Ge(gr(this,vn(this,xn),e,"create",t))}createIfNotExists(e,t){return Ge(dr(this,vn(this,xn),e,t))}createOrReplace(e,t){return Ge(fr(this,vn(this,xn),e,t))}delete(e,t){return Ge(hr(this,vn(this,xn),e,t))}mutate(e,t){return Ge(pr(this,vn(this,xn),e,t))}patch(e,t){return new Ot(e,t,this)}transaction(e){return new Mt(e,this)}request(e){return Ge(vr(this,vn(this,xn),e))}dataRequest(e,t,r){return Ge(yr(this,vn(this,xn),e,t,r))}getUrl(e,t){return wr(this,e,t)}getDataUrl(e,t){return br(this,e,t)}};const Tn=(An=Sn,{requester:ut(kn=[],{}).defaultRequester,createClient:e=>new An(ut(kn,{maxRetries:e.maxRetries,retryDelay:e.retryDelay}),e)}),_n=Tn.requester,On=Tn.createClient,$n=(jn=On,function(e){return Lt(),jn(e)});var jn,kn,An;const In=/_key\s*==\s*['"](.*)['"]/;function Pn(e){if(!Array.isArray(e))throw new Error("Path is not an array");return e.reduce(((e,t,r)=>{const n=typeof t;if("number"===n)return`${e}[${t}]`;if("string"===n)return`${e}${0===r?"":"."}${t}`;if(function(e){return"string"==typeof e?In.test(e.trim()):"object"==typeof e&&"_key"in e}(t)&&t._key)return`${e}[_key=="${t._key}"]`;if(Array.isArray(t)){const[r,n]=t;return`${e}[${r}:${n}]`}throw new Error(`Unsupported path segment \`${JSON.stringify(t)}\``)}),"")}const Rn={"\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","'":"\\'","\\":"\\\\"},Mn={"\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t","\\'":"'","\\\\":"\\"};function Dn(e){const t=[],r=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;let n;for(;null!==(n=r.exec(e));)if(void 0===n[1])if(void 0===n[2])if(void 0===n[3]);else{const e=n[3].replace(/\\(\\')/g,(e=>Mn[e]));t.push({_key:e,_index:-1})}else t.push(parseInt(n[2],10));else{const e=n[1].replace(/\\(\\|f|n|r|t|')/g,(e=>Mn[e]));t.push(e)}return t}function Fn(e){return e.map((e=>{if("string"==typeof e||"number"==typeof e)return e;if(""!==e._key)return{_key:e._key};if(-1!==e._index)return e._index;throw new Error(`invalid segment:${JSON.stringify(e)}`)}))}function qn(e,t){if(null==t||!t.mappings)return;const r=function(e){return`$${e.map((e=>"string"==typeof e?`['${e.replace(/[\f\n\r\t'\\]/g,(e=>Rn[e]))}']`:"number"==typeof e?`[${e}]`:""!==e._key?`[?(@._key=='${e._key.replace(/['\\]/g,(e=>Rn[e]))}')]`:`[${e._index}]`)).join("")}`}(e.map((e=>{if("string"==typeof e||"number"==typeof e)return e;if(-1!==e._index)return e._index;throw new Error(`invalid segment:${JSON.stringify(e)}`)})));if(void 0!==t.mappings[r])return{mapping:t.mappings[r],matchedPath:r,pathSuffix:""};const n=Object.entries(t.mappings).filter((([e])=>r.startsWith(e))).sort((([e],[t])=>t.length-e.length));if(0==n.length)return;const[o,i]=n[0];return{mapping:i,matchedPath:o,pathSuffix:r.substring(o.length)}}function Nn(e){return"object"==typeof e&&null!==e}function Un(e,t,r=[]){return function(e){return null!==e&&Array.isArray(e)}(e)?e.map(((e,n)=>{if(Nn(e)){const o=e._key;if("string"==typeof o)return Un(e,t,r.concat({_key:o,_index:n}))}return Un(e,t,r.concat(n))})):Nn(e)?Object.fromEntries(Object.entries(e).map((([e,n])=>[e,Un(n,t,r.concat(e))]))):t(e,r)}function Wn(e,t,r){return Un(e,((e,n)=>{if("string"!=typeof e)return e;const o=qn(n,t);if(!o)return e;const{mapping:i,matchedPath:s}=o;if("value"!==i.type||"documentValue"!==i.source.type)return e;const a=t.documents[i.source.document],u=t.paths[i.source.path],c=Dn(s),l=Dn(u).concat(n.slice(c.length));return r({sourcePath:l,sourceDocument:a,resultPath:n,value:e})}))}const Hn="drafts.";function zn(e){const{baseUrl:t,workspace:r="default",tool:n="default",id:o,type:i,path:s,projectId:a,dataset:u}=e;if(!t)throw new Error("baseUrl is required");if(!s)throw new Error("path is required");if(!o)throw new Error("id is required");if("/"!==t&&t.endsWith("/"))throw new Error("baseUrl must not end with a slash");const c="default"===r?void 0:r,l="default"===n?void 0:n,d=function(e){return e.startsWith(Hn)?e.slice(Hn.length):e}(o),f=Array.isArray(s)?Pn(Fn(s)):s,h=new URLSearchParams({baseUrl:t,id:d,type:i,path:f});c&&h.set("workspace",c),l&&h.set("tool",l),a&&h.set("projectId",a),u&&h.set("dataset",u);const p=["/"===t?"":t];c&&p.push(c);const y=["mode=presentation",`id=${d}`,`type=${i}`,`path=${encodeURIComponent(f)}`];return l&&y.push(`tool=${l}`),p.push("intent","edit",`${y.join(";")}?${h}`),p.join("/")}const Ln=({sourcePath:e,value:t})=>{if(/^\d{4}-\d{2}-\d{2}/.test(r=t)&&Date.parse(r)||function(e){try{new URL(e,e.startsWith("/")?"https://acme.com":void 0)}catch{return!1}return!0}(t))return!1;var r;const n=e.at(-1);return!("slug"===e.at(-2)&&"current"===n||"string"==typeof n&&n.startsWith("_")||"number"==typeof n&&"marks"===e.at(-2)||"href"===n&&"number"==typeof e.at(-2)&&"markDefs"===e.at(-3)||"style"===n||"listItem"===n||e.some((e=>"meta"===e||"metadata"===e||"openGraph"===e||"seo"===e))||"string"==typeof n&&Bn.has(n))},Bn=new Set(["color","colour","currency","email","format","gid","hex","href","hsl","hsla","icon","id","index","key","language","layout","link","linkAction","locale","lqip","page","path","ref","rgb","rgba","route","secret","slug","status","tag","template","theme","type","unit","url","username","variant","website"]);function Jn(e,t,r){var n,o,i,s,a,u,c,l,d;const{filter:f,logger:h,enabled:p}=r;if(!p){const o="config.enabled must be true, don't call this function otherwise";throw null==(n=null==h?void 0:h.error)||n.call(h,`[@sanity/client]: ${o}`,{result:e,resultSourceMap:t,config:r}),new TypeError(o)}if(!t)return null==(o=null==h?void 0:h.error)||o.call(h,"[@sanity/client]: Missing Content Source Map from response body",{result:e,resultSourceMap:t,config:r}),e;if(!r.studioUrl){const n="config.studioUrl must be defined";throw null==(i=null==h?void 0:h.error)||i.call(h,`[@sanity/client]: ${n}`,{result:e,resultSourceMap:t,config:r}),new TypeError(n)}const y={encoded:[],skipped:[]},g=Wn(e,t,(({sourcePath:e,sourceDocument:t,resultPath:n,value:o})=>{if(!1===("function"==typeof f?f({sourcePath:e,resultPath:n,filterDefault:Ln,sourceDocument:t,value:o}):Ln({sourcePath:e,resultPath:n,filterDefault:Ln,sourceDocument:t,value:o})))return h&&y.skipped.push({path:Gn(e),value:`${o.slice(0,20)}${o.length>20?"...":""}`,length:o.length}),o;h&&y.encoded.push({path:Gn(e),value:`${o.slice(0,20)}${o.length>20?"...":""}`,length:o.length});const{baseUrl:i,workspace:s,tool:a}=function(e){let t="string"==typeof e?e:e.baseUrl;return"/"!==t&&(t=t.replace(/\/$/,"")),"string"==typeof e?{baseUrl:t}:{...e,baseUrl:t}}("function"==typeof r.studioUrl?r.studioUrl(t):r.studioUrl);if(!i)return o;const{_id:u,_type:c,_projectId:l,_dataset:d}=t;return Zt(o,{origin:"sanity.io",href:zn({baseUrl:i,workspace:s,tool:a,id:u,type:c,path:e,...!r.omitCrossDatasetReferenceData&&{dataset:d,projectId:l}})},!1)}));if(h){const e=y.skipped.length,t=y.encoded.length;if((e||t)&&(null==(s=(null==h?void 0:h.groupCollapsed)||h.log)||s("[@sanity/client]: Encoding source map into result"),null==(a=h.log)||a.call(h,`[@sanity/client]: Paths encoded: ${y.encoded.length}, skipped: ${y.skipped.length}`)),y.encoded.length>0&&(null==(u=null==h?void 0:h.log)||u.call(h,"[@sanity/client]: Table of encoded paths"),null==(c=(null==h?void 0:h.table)||h.log)||c(y.encoded)),y.skipped.length>0){const e=new Set;for(const{path:t}of y.skipped)e.add(t.replace(In,"0").replace(/\[\d+\]/g,"[]"));null==(l=null==h?void 0:h.log)||l.call(h,"[@sanity/client]: List of skipped paths",[...e.values()])}(e||t)&&(null==(d=null==h?void 0:h.groupEnd)||d.call(h))}return g}function Gn(e){return Pn(Fn(e))}var Vn=Object.freeze({__proto__:null,stegaEncodeSourceMap:Jn}),Qn=Object.freeze({__proto__:null,encodeIntoResult:Wn,stegaEncodeSourceMap:Jn,stegaEncodeSourceMap$1:Vn}),Yn={exports:{}};
|
|
9
9
|
/** @license
|
|
10
10
|
* eventsource.js
|
|
11
11
|
* Available under MIT License (MIT)
|
|
12
12
|
* https://github.com/Yaffle/EventSource/
|
|
13
13
|
*/
|
|
14
|
-
!function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,i=r.XMLHttpRequest,s=r.XDomainRequest,a=r.ActiveXObject,u=r.EventSource,c=r.document,l=r.Promise,h=r.fetch,f=r.Response,d=r.TextDecoder,p=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==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=h;h=function(e,t){var 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="",i=this.bitsNeeded,s=this.codePoint,a=0;a<e.length;a+=1){var u=e[a];0!==i&&(u<128||u>191||!t(s<<6|63&u,i-6,r(i,s)))&&(i=0,s=n,o+=String.fromCharCode(s)),0===i?(u>=0&&u<=127?(i=0,s=u):u>=192&&u<=223?(i=6,s=31&u):u>=224&&u<=239?(i=12,s=15&u):u>=240&&u<=247?(i=18,s=7&u):(i=0,s=n),0===i||t(s,i,r(i,s))||(i=0,s=n)):(i-=6,s=s<<6|63&u),0===i&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,o};null!=d&&null!=p&&function(){try{return"test"===(new d).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(d=m);var b=function(){};function v(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=b,this.onload=b,this.onerror=b,this.onreadystatechange=b,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=b}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(": "),i=o.shift(),s=o.join(": ");t[w(i)]=s}this._map=t}function E(){}function x(e){this._headers=e}function S(){}function R(){this._listeners=Object.create(null)}function _(e){n((function(){throw e}),0)}function O(e){this.type=e,this.target=void 0}function T(e,t){O.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function q(e,t){O.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function $(e,t){O.call(this,e),this.error=t.error}v.prototype.open=function(e,t){this._abort(!0);var r=this,s=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,s.onload=b,s.onerror=b,s.onabort=b,s.onprogress=b,s.onreadystatechange=b,s.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 s)e=200,t="OK",n=s.contentType;else try{e=s.status,t=s.statusText,n=s.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=s.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},h=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:b}),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===s.readyState&&l()};"onload"in s&&(s.onload=function(e){h("load",e)}),"onerror"in s&&(s.onerror=function(e){h("error",e)}),"onabort"in s&&(s.onabort=function(e){h("abort",e)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(e){!function(e){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||h(""===s.responseText?"error":"load",e):3===s.readyState?"onprogress"in s||l():2===s.readyState&&c())}(e)}),!("contentType"in s)&&"ontimeout"in i.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),s.open(e,t,!0),"readyState"in s&&(u=n((function(){f()}),0))},v.prototype.abort=function(){this._abort(!1)},v.prototype.getResponseHeader=function(e){return this._contentType},v.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},v.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},v.prototype.send=function(){if("ontimeout"in i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.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!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,r,n,o,s,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===i.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),s=e.getAllResponseHeaders();t(r,n,o,new C(s))}},e.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},S.prototype.open=function(e,t,r,n,o,i,s){var a=null,u=new y,c=u.signal,f=new d;return h(o,{headers:s,credentials:i?"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 x(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()}}},R.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){_(e)}}},R.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,i=0;i<n.length;i+=1)n[i]===t&&(o=!0);o||n.push(t)},R.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],i=0;i<n.length;i+=1)n[i]!==t&&o.push(n[i]);0===o.length?delete r[e]:r[e]=o}},T.prototype=Object.create(O.prototype),q.prototype=Object.create(O.prototype),$.prototype=Object.create(O.prototype);var j=-1,A=0,I=1,P=2,k=-1,D=0,F=1,M=2,N=3,U=/^text\/event\-stream(;.*)?$/i,H=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),z(r)},z=function(e){return Math.min(Math.max(e,1e3),18e6)},L=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){_(e)}};function B(e,t){R.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=z(1e3),l=H(r.heartbeatTimeout,45e3),h="",f=c,d=!1,p=0,y=r.headers||{},g=r.Transport,m=J&&null==g?void 0:new v(null!=g?new g:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),b=null!=g&&"string"!=typeof g?new g:null==m?new S:new E,w=void 0,C=0,x=j,R="",_="",O="",B="",G=D,V=0,Q=0,Y=function(t,r,n,o){if(x===A)if(200===t&&null!=n&&U.test(n)){x=I,d=Date.now(),f=c,e.readyState=I;var i=new q("open",{status:t,statusText:r,headers:o});e.dispatchEvent(i),L(e,e.onopen,i)}else{var s="";200!==t?(r&&(r=r.replace(/\s+/g," ")),s="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",K();i=new q("error",{status:t,statusText:r,headers:o});e.dispatchEvent(i),L(e,e.onerror,i),console.error(s)}},W=function(t){if(x===I){for(var r=-1,i=0;i<t.length;i+=1){(u=t.charCodeAt(i))!=="\n".charCodeAt(0)&&u!=="\r".charCodeAt(0)||(r=i)}var s=(-1!==r?B:"")+t.slice(0,r+1);B=(-1===r?B:"")+t.slice(r+1),""!==t&&(d=Date.now(),p+=t.length);for(var a=0;a<s.length;a+=1){var u=s.charCodeAt(a);if(G===k&&u==="\n".charCodeAt(0))G=D;else if(G===k&&(G=D),u==="\r".charCodeAt(0)||u==="\n".charCodeAt(0)){if(G!==D){G===F&&(Q=a+1);var y=s.slice(V,Q-1),g=s.slice(Q+(Q<a&&s.charCodeAt(Q)===" ".charCodeAt(0)?1:0),a);"data"===y?(R+="\n",R+=g):"id"===y?_=g:"event"===y?O=g:"retry"===y?(c=H(g,c),f=c):"heartbeatTimeout"===y&&(l=H(g,l),0!==C&&(o(C),C=n((function(){Z()}),l)))}if(G===D){if(""!==R){h=_,""===O&&(O="message");var m=new T(O,{data:R.slice(1),lastEventId:_});if(e.dispatchEvent(m),"open"===O?L(e,e.onopen,m):"message"===O?L(e,e.onmessage,m):"error"===O&&L(e,e.onerror,m),x===P)return}R="",O=""}G=u==="\r".charCodeAt(0)?k:D}else G===D&&(V=a,G=F),G===F?u===":".charCodeAt(0)&&(Q=a+1,G=M):G===M&&(G=N)}}},X=function(t){if(x===I||x===A){x=j,0!==C&&(o(C),C=0),C=n((function(){Z()}),f),f=z(Math.min(16*c,2*f)),e.readyState=A;var r=new $("error",{error:t});e.dispatchEvent(r),L(e,e.onerror,r),null!=t&&console.error(t)}},K=function(){x=P,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=P},Z=function(){if(C=0,x===j){d=!1,p=0,C=n((function(){Z()}),l),x=A,R="",O="",_=h,B="",V=0,Q=0,G=D;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==h){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(h)}var i=e.withCredentials,s={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(s[c]=a[c]);try{w=b.open(m,Y,W,X,r,i,s)}catch(e){throw K(),e}}else if(d||null==w){var f=Math.max((d||Date.now())+l-Date.now(),1);d=!1,C=n((function(){Z()}),f)}else X(new Error("No activity within "+l+" milliseconds. "+(x===A?"No response received.":p+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=A,e.withCredentials=a,e.headers=y,e._close=K,Z()}(this,e,t)}var J=null!=h&&null!=f&&"body"in f.prototype;B.prototype=Object.create(R.prototype),B.prototype.CONNECTING=A,B.prototype.OPEN=I,B.prototype.CLOSED=P,B.prototype.close=function(){this._close()},B.CONNECTING=A,B.OPEN=I,B.CLOSED=P,B.prototype.withCredentials=void 0;var G,V=u;null==i||null!=u&&"withCredentials"in u.prototype||(V=B),G=function(e){e.EventSourcePolyfill=B,e.NativeEventSource=u,e.EventSource=V}(t),void 0!==G&&(e.exports=G)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:pe:globalThis)}(Mr,Mr.exports);var Nr=ye(Mr.exports.EventSourcePolyfill),Ur=Object.freeze({__proto__:null,default:Nr});e.BasePatch=ut,e.BaseTransaction=ft,e.ClientError=Be,e.ObservablePatch=ct,e.ObservableSanityClient=pr,e.ObservableTransaction=pt,e.Patch=lt,e.SanityClient=yr,e.ServerError=Je,e.Transaction=dt,e.createClient=br,e.default=vr,e.requester=mr,e.unstable__adapter=Ee,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
14
|
+
!function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,i=r.XMLHttpRequest,s=r.XDomainRequest,a=r.ActiveXObject,u=r.EventSource,c=r.document,l=r.Promise,d=r.fetch,f=r.Response,h=r.TextDecoder,p=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==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=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="",i=this.bitsNeeded,s=this.codePoint,a=0;a<e.length;a+=1){var u=e[a];0!==i&&(u<128||u>191||!t(s<<6|63&u,i-6,r(i,s)))&&(i=0,s=n,o+=String.fromCharCode(s)),0===i?(u>=0&&u<=127?(i=0,s=u):u>=192&&u<=223?(i=6,s=31&u):u>=224&&u<=239?(i=12,s=15&u):u>=240&&u<=247?(i=18,s=7&u):(i=0,s=n),0===i||t(s,i,r(i,s))||(i=0,s=n)):(i-=6,s=s<<6|63&u),0===i&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=i,this.codePoint=s,o};null!=h&&null!=p&&function(){try{return"test"===(new h).decode((new p).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(h=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(": "),i=o.shift(),s=o.join(": ");t[w(i)]=s}this._map=t}function E(){}function x(e){this._headers=e}function S(){}function T(){this._listeners=Object.create(null)}function _(e){n((function(){throw e}),0)}function O(e){this.type=e,this.target=void 0}function $(e,t){O.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function j(e,t){O.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){O.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var r=this,s=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,s.onload=v,s.onerror=v,s.onabort=v,s.onprogress=v,s.onreadystatechange=v,s.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 s)e=200,t="OK",n=s.contentType;else try{e=s.status,t=s.statusText,n=s.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=s.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===s.readyState&&l()};"onload"in s&&(s.onload=function(e){d("load",e)}),"onerror"in s&&(s.onerror=function(e){d("error",e)}),"onabort"in s&&(s.onabort=function(e){d("abort",e)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(e){!function(e){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||d(""===s.responseText?"error":"load",e):3===s.readyState?"onprogress"in s||l():2===s.readyState&&c())}(e)}),!("contentType"in s)&&"ontimeout"in i.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),s.open(e,t,!0),"readyState"in s&&(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 i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.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!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,r,n,o,s,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===i.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),s=e.getAllResponseHeaders();t(r,n,o,new C(s))}},e.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},x.prototype.get=function(e){return this._headers.get(e)},S.prototype.open=function(e,t,r,n,o,i,s){var a=null,u=new y,c=u.signal,f=new h;return d(o,{headers:s,credentials:i?"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 x(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()}}},T.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){_(e)}}},T.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,i=0;i<n.length;i+=1)n[i]===t&&(o=!0);o||n.push(t)},T.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],i=0;i<n.length;i+=1)n[i]!==t&&o.push(n[i]);0===o.length?delete r[e]:r[e]=o}},$.prototype=Object.create(O.prototype),j.prototype=Object.create(O.prototype),k.prototype=Object.create(O.prototype);var A=-1,I=0,P=1,R=2,M=-1,D=0,F=1,q=2,N=3,U=/^text\/event\-stream(;.*)?$/i,W=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),H(r)},H=function(e){return Math.min(Math.max(e,1e3),18e6)},z=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){_(e)}};function L(e,t){T.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=H(1e3),l=W(r.heartbeatTimeout,45e3),d="",f=c,h=!1,p=0,y=r.headers||{},g=r.Transport,m=B&&null==g?void 0:new b(null!=g?new g:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),v=null!=g&&"string"!=typeof g?new g:null==m?new S:new E,w=void 0,C=0,x=A,T="",_="",O="",L="",J=D,G=0,V=0,Q=function(t,r,n,o){if(x===I)if(200===t&&null!=n&&U.test(n)){x=P,h=Date.now(),f=c,e.readyState=P;var i=new j("open",{status:t,statusText:r,headers:o});e.dispatchEvent(i),z(e,e.onopen,i)}else{var s="";200!==t?(r&&(r=r.replace(/\s+/g," ")),s="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",K();i=new j("error",{status:t,statusText:r,headers:o});e.dispatchEvent(i),z(e,e.onerror,i),console.error(s)}},Y=function(t){if(x===P){for(var r=-1,i=0;i<t.length;i+=1){(u=t.charCodeAt(i))!=="\n".charCodeAt(0)&&u!=="\r".charCodeAt(0)||(r=i)}var s=(-1!==r?L:"")+t.slice(0,r+1);L=(-1===r?L:"")+t.slice(r+1),""!==t&&(h=Date.now(),p+=t.length);for(var a=0;a<s.length;a+=1){var u=s.charCodeAt(a);if(J===M&&u==="\n".charCodeAt(0))J=D;else if(J===M&&(J=D),u==="\r".charCodeAt(0)||u==="\n".charCodeAt(0)){if(J!==D){J===F&&(V=a+1);var y=s.slice(G,V-1),g=s.slice(V+(V<a&&s.charCodeAt(V)===" ".charCodeAt(0)?1:0),a);"data"===y?(T+="\n",T+=g):"id"===y?_=g:"event"===y?O=g:"retry"===y?(c=W(g,c),f=c):"heartbeatTimeout"===y&&(l=W(g,l),0!==C&&(o(C),C=n((function(){Z()}),l)))}if(J===D){if(""!==T){d=_,""===O&&(O="message");var m=new $(O,{data:T.slice(1),lastEventId:_});if(e.dispatchEvent(m),"open"===O?z(e,e.onopen,m):"message"===O?z(e,e.onmessage,m):"error"===O&&z(e,e.onerror,m),x===R)return}T="",O=""}J=u==="\r".charCodeAt(0)?M:D}else J===D&&(G=a,J=F),J===F?u===":".charCodeAt(0)&&(V=a+1,J=q):J===q&&(J=N)}}},X=function(t){if(x===P||x===I){x=A,0!==C&&(o(C),C=0),C=n((function(){Z()}),f),f=H(Math.min(16*c,2*f)),e.readyState=I;var r=new k("error",{error:t});e.dispatchEvent(r),z(e,e.onerror,r),null!=t&&console.error(t)}},K=function(){x=R,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=R},Z=function(){if(C=0,x===A){h=!1,p=0,C=n((function(){Z()}),l),x=I,T="",O="",_=d,L="",G=0,V=0,J=D;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 i=e.withCredentials,s={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(s[c]=a[c]);try{w=v.open(m,Q,Y,X,r,i,s)}catch(e){throw K(),e}}else if(h||null==w){var f=Math.max((h||Date.now())+l-Date.now(),1);h=!1,C=n((function(){Z()}),f)}else X(new Error("No activity within "+l+" milliseconds. "+(x===I?"No response received.":p+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=I,e.withCredentials=a,e.headers=y,e._close=K,Z()}(this,e,t)}var B=null!=d&&null!=f&&"body"in f.prototype;L.prototype=Object.create(T.prototype),L.prototype.CONNECTING=I,L.prototype.OPEN=P,L.prototype.CLOSED=R,L.prototype.close=function(){this._close()},L.CONNECTING=I,L.OPEN=P,L.CLOSED=R,L.prototype.withCredentials=void 0;var J,G=u;null==i||null!=u&&"withCredentials"in u.prototype||(G=L),J=function(e){e.EventSourcePolyfill=L,e.NativeEventSource=u,e.EventSource=G}(t),void 0!==J&&(e.exports=J)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:s:globalThis)}(Yn,Yn.exports);var Xn=a(Yn.exports.EventSourcePolyfill),Kn=Object.freeze({__proto__:null,default:Xn});e.BasePatch=St,e.BaseTransaction=Pt,e.ClientError=tt,e.ObservablePatch=Tt,e.ObservableSanityClient=Cn,e.ObservableTransaction=Ft,e.Patch=Ot,e.SanityClient=Sn,e.ServerError=rt,e.Transaction=Mt,e.createClient=On,e.default=$n,e.requester=_n,e.unstable__adapter=T,e.unstable__environment="browser",Object.defineProperty(e,"__esModule",{value:!0})}));
|