@sanity/client 3.0.6 → 3.2.1

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.
@@ -169,7 +169,8 @@ module.exports = {
169
169
  var returnFirst = options.returnFirst;
170
170
  var timeout = options.timeout,
171
171
  token = options.token,
172
- tag = options.tag;
172
+ tag = options.tag,
173
+ headers = options.headers;
173
174
  var uri = this.getDataUrl(endpoint, stringQuery);
174
175
  var reqOptions = {
175
176
  method: useGet ? 'GET' : 'POST',
@@ -178,6 +179,7 @@ module.exports = {
178
179
  body: useGet ? undefined : body,
179
180
  query: isMutation && getMutationQuery(options),
180
181
  timeout: timeout,
182
+ headers: headers,
181
183
  token: token,
182
184
  tag: tag,
183
185
  canUseCdn: isQuery
@@ -13,12 +13,8 @@ var _require = require('../util/observable'),
13
13
 
14
14
  var polyfilledEventSource = require('@sanity/eventsource');
15
15
 
16
- var generateHelpUrl = require('@sanity/generate-help-url');
17
-
18
16
  var pick = require('../util/pick');
19
17
 
20
- var once = require('../util/once');
21
-
22
18
  var defaults = require('../util/defaults');
23
19
 
24
20
  var encodeQueryString = require('./encodeQueryString'); // Limit is 16K for a _request_, eg including headers. Have to account for an
@@ -27,15 +23,7 @@ var encodeQueryString = require('./encodeQueryString'); // Limit is 16K for a _r
27
23
 
28
24
 
29
25
  var MAX_URL_LENGTH = 16000 - 1200;
30
- var tokenWarning = ['Using token with listeners is not supported in browsers. ', "For more info, see ".concat(generateHelpUrl('js-client-listener-tokens-browser'), ".")]; // eslint-disable-next-line no-console
31
-
32
- var printTokenWarning = once(function () {
33
- return console.warn(tokenWarning.join(' '));
34
- });
35
- var isWindowEventSource = Boolean(typeof window !== 'undefined' && window.EventSource);
36
- var EventSource = isWindowEventSource ? window.EventSource // Native browser EventSource
37
- : polyfilledEventSource; // Node.js, IE etc
38
-
26
+ var EventSource = polyfilledEventSource;
39
27
  var possibleOptions = ['includePreviousRevision', 'includeResult', 'visibility', 'effectFormat', 'tag'];
40
28
  var defaultOptions = {
41
29
  includeResult: true
@@ -71,11 +59,6 @@ module.exports = function listen(query, params) {
71
59
 
72
60
  var listenFor = options.events ? options.events : ['mutation'];
73
61
  var shouldEmitReconnect = listenFor.indexOf('reconnect') !== -1;
74
-
75
- if (token && isWindowEventSource) {
76
- printTokenWarning();
77
- }
78
-
79
62
  var esOptions = {};
80
63
 
81
64
  if (token || withCredentials) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "3.0.6",
3
+ "version": "3.2.1",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "main": "lib/sanityClient.js",
6
6
  "umd": "umd/sanityClient.min.js",
@@ -26,29 +26,29 @@
26
26
  "node": ">=12"
27
27
  },
28
28
  "dependencies": {
29
- "@sanity/eventsource": "^2.23.0",
30
- "@sanity/generate-help-url": "^2.18.0",
31
- "get-it": "^6.0.0",
29
+ "@sanity/eventsource": "^3.0.2",
30
+ "@sanity/generate-help-url": "^3.0.0",
31
+ "get-it": "^6.0.1",
32
32
  "make-error": "^1.3.0",
33
33
  "object-assign": "^4.1.1",
34
34
  "rxjs": "^6.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@babel/cli": "^7.11.6",
38
- "@babel/core": "^7.11.6",
37
+ "@babel/cli": "^7.17.6",
38
+ "@babel/core": "^7.17.7",
39
39
  "@babel/preset-env": "^7.11.5",
40
40
  "browserify": "^17.0.0",
41
41
  "envify": "^4.0.0",
42
- "eslint": "^8.7.0",
43
- "eslint-config-prettier": "^8.3.0",
42
+ "eslint": "^8.11.0",
43
+ "eslint-config-prettier": "^8.5.0",
44
44
  "eslint-config-sanity": "^5.1.0",
45
- "nock": "^13.2.2",
45
+ "nock": "^13.2.4",
46
46
  "nyc": "^15.1.0",
47
- "prettier": "^2.5.1",
47
+ "prettier": "^2.6.0",
48
48
  "rimraf": "^3.0.2",
49
49
  "sse-channel": "^4.0.0",
50
- "tape": "^5.4.1",
51
- "terser": "^5.7.2",
50
+ "tape": "^5.5.2",
51
+ "terser": "^5.12.1",
52
52
  "uglifyify": "^5.0.1",
53
53
  "xtend": "4.0.2"
54
54
  },
package/sanityClient.d.ts CHANGED
@@ -503,6 +503,7 @@ export interface ClientConfig {
503
503
  requestTagPrefix?: string
504
504
  ignoreBrowserTokenWarning?: boolean
505
505
  withCredentials?: boolean
506
+ timeout?: number
506
507
 
507
508
  /**
508
509
  * @deprecated Don't use
@@ -532,6 +533,7 @@ export interface RequestOptions {
532
533
  timeout?: number
533
534
  token?: string
534
535
  tag?: string
536
+ headers?: Record<string, string>
535
537
  }
536
538
 
537
539
  type BaseMutationOptions = RequestOptions & {
@@ -2248,6 +2248,23 @@ test('will use cdn for queries even when with token specified', (t) => {
2248
2248
  client.fetch('*').then(noop).catch(t.ifError).then(t.end)
2249
2249
  })
2250
2250
 
2251
+ test('allows overriding headers', (t) => {
2252
+
2253
+ const client = sanityClient({
2254
+ projectId: 'abc123',
2255
+ dataset: 'foo',
2256
+ token: 'foo',
2257
+ })
2258
+
2259
+ const reqheaders = {foo: 'bar'}
2260
+ nock('https://abc123.api.sanity.io', {reqheaders})
2261
+ .get('/v1/data/query/foo?query=*')
2262
+ .reply(200, {result: []})
2263
+
2264
+ client.fetch('*', {}, {headers: {foo: 'bar'}}).then(noop).catch(t.ifError).then(t.end)
2265
+
2266
+ })
2267
+
2251
2268
  test('will use live API if withCredentials is set to true', (t) => {
2252
2269
  const client = sanityClient({
2253
2270
  withCredentials: true,
@@ -7,16 +7,16 @@
7
7
  },{"object-assign":46}],3:[function(require,module,exports){
8
8
  "use strict";var generateHelpUrl=require("@sanity/generate-help-url"),assign=require("object-assign"),validate=require("./validators"),warnings=require("./warnings"),defaultCdnHost="apicdn.sanity.io",defaultConfig={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,isPromiseAPI:!0},LOCALHOSTS=["localhost","127.0.0.1","0.0.0.0"],isLocal=function(e){return-1!==LOCALHOSTS.indexOf(e)};exports.defaultConfig=defaultConfig,exports.initConfig=function(e,i){var n=assign({},i,e);n.apiVersion||warnings.printNoApiVersionSpecifiedWarning();var t=assign({},defaultConfig,n),a=t.useProjectHostname;if("undefined"==typeof Promise){var o=generateHelpUrl("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(o))}if(a&&!t.projectId)throw new Error("Configuration must contain `projectId`");var r="undefined"!=typeof window&&window.location&&window.location.hostname,s=r&&isLocal(window.location.hostname);r&&s&&t.token&&!0!==t.ignoreBrowserTokenWarning?warnings.printBrowserTokenWarning():void 0===t.useCdn&&warnings.printCdnWarning(),a&&validate.projectId(t.projectId),t.dataset&&validate.dataset(t.dataset),"requestTagPrefix"in t&&(t.requestTagPrefix=t.requestTagPrefix?validate.requestTag(t.requestTagPrefix).replace(/\.+$/,""):void 0),t.apiVersion="".concat(t.apiVersion).replace(/^v/,""),t.isDefaultApi=t.apiHost===defaultConfig.apiHost,t.useCdn=Boolean(t.useCdn)&&!t.withCredentials,exports.validateApiVersion(t.apiVersion);var c=t.apiHost.split("://",2),d=c[0],l=c[1],p=t.isDefaultApi?defaultCdnHost:l;return t.useProjectHostname?(t.url="".concat(d,"://").concat(t.projectId,".").concat(l,"/v").concat(t.apiVersion),t.cdnUrl="".concat(d,"://").concat(t.projectId,".").concat(p,"/v").concat(t.apiVersion)):(t.url="".concat(t.apiHost,"/v").concat(t.apiVersion),t.cdnUrl=t.url),t},exports.validateApiVersion=function(e){if("1"!==e&&"X"!==e){var i=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&i instanceof Date&&i.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}};
9
9
 
10
- },{"./validators":23,"./warnings":24,"@sanity/generate-help-url":27,"object-assign":46}],4:[function(require,module,exports){
11
- "use strict";function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var assign=require("object-assign"),_require=require("../util/observable"),map=_require.map,filter=_require.filter,validators=require("../validators"),getSelection=require("../util/getSelection"),encodeQueryString=require("./encodeQueryString"),Transaction=require("./transaction"),Patch=require("./patch"),listen=require("./listen"),excludeFalsey=function(e,t){return!1===e?void 0:void 0===e?t:e},getMutationQuery=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _objectSpread({returnIds:!0,returnDocuments:excludeFalsey(e.returnDocuments,!0),visibility:e.visibility||"sync"},e.skipCrossDatasetReferenceValidation&&{skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation})},isResponse=function(e){return"response"===e.type},getBody=function(e){return e.body},indexBy=function(e,t){return e.reduce(function(e,r){return e[t(r)]=r,e},Object.create(null))},toPromise=function(e){return e.toPromise()},getQuerySizeLimit=11264;module.exports={listen:listen,getDataUrl:function(e,t){var r=this.clientConfig,n=validators.hasDataset(r),i="/".concat(e,"/").concat(n),o=t?"".concat(i,"/").concat(t):i;return"/data".concat(o).replace(/\/($|\?)/,"$1")},fetch:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=!1===r.filterResponse?function(e){return e}:function(e){return e.result},i=this._dataRequest("query",{query:e,params:t},r).pipe(map(n));return this.isPromiseAPI()?toPromise(i):i},getDocument:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",e),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(filter(isResponse),map(function(e){return e.body.documents&&e.body.documents[0]}));return this.isPromiseAPI()?toPromise(n):n},getDocuments:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",e.join(",")),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(filter(isResponse),map(function(t){var r=indexBy(t.body.documents||[],function(e){return e._id});return e.map(function(e){return r[e]||null})}));return this.isPromiseAPI()?toPromise(n):n},create:function(e,t){return this._create(e,"create",t)},createIfNotExists:function(e,t){return validators.requireDocumentId("createIfNotExists",e),this._create(e,"createIfNotExists",t)},createOrReplace:function(e,t){return validators.requireDocumentId("createOrReplace",e),this._create(e,"createOrReplace",t)},patch:function(e,t){return new Patch(e,t,this)},delete:function(e,t){return this.dataRequest("mutate",{mutations:[{delete:getSelection(e)}]},t)},mutate:function(e,t){var r=e instanceof Patch||e instanceof Transaction?e.serialize():e,n=Array.isArray(r)?r:[r],i=t&&t.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:i},t)},transaction:function(e){return new Transaction(e,this)},dataRequest:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._dataRequest(e,t,r);return this.isPromiseAPI()?toPromise(n):n},_dataRequest:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="mutate"===e,i="query"===e,o=!n&&encodeQueryString(t),a=!n&&o.length<getQuerySizeLimit,u=a?o:"",s=r.returnFirst,c=r.timeout,d=r.token,l=r.tag,f={method:a?"GET":"POST",uri:this.getDataUrl(e,u),json:!0,body:a?void 0:t,query:n&&getMutationQuery(r),timeout:c,token:d,tag:l,canUseCdn:i};return this._requestObservable(f).pipe(filter(isResponse),map(getBody),map(function(e){if(!n)return e;var t=e.results||[];if(r.returnDocuments)return s?t[0]&&t[0].document:t.map(function(e){return e.document});var i=s?"documentId":"documentIds",o=s?t[0]&&t[0].id:t.map(function(e){return e.id});return _defineProperty({transactionId:e.transactionId,results:t},i,o)}))},_create:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=_defineProperty({},t,e),i=assign({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},i)}};
10
+ },{"./validators":23,"./warnings":24,"@sanity/generate-help-url":26,"object-assign":46}],4:[function(require,module,exports){
11
+ "use strict";function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var assign=require("object-assign"),_require=require("../util/observable"),map=_require.map,filter=_require.filter,validators=require("../validators"),getSelection=require("../util/getSelection"),encodeQueryString=require("./encodeQueryString"),Transaction=require("./transaction"),Patch=require("./patch"),listen=require("./listen"),excludeFalsey=function(e,t){return!1===e?void 0:void 0===e?t:e},getMutationQuery=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return _objectSpread({returnIds:!0,returnDocuments:excludeFalsey(e.returnDocuments,!0),visibility:e.visibility||"sync"},e.skipCrossDatasetReferenceValidation&&{skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation})},isResponse=function(e){return"response"===e.type},getBody=function(e){return e.body},indexBy=function(e,t){return e.reduce(function(e,r){return e[t(r)]=r,e},Object.create(null))},toPromise=function(e){return e.toPromise()},getQuerySizeLimit=11264;module.exports={listen:listen,getDataUrl:function(e,t){var r=this.clientConfig,n=validators.hasDataset(r),i="/".concat(e,"/").concat(n),o=t?"".concat(i,"/").concat(t):i;return"/data".concat(o).replace(/\/($|\?)/,"$1")},fetch:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=!1===r.filterResponse?function(e){return e}:function(e){return e.result},i=this._dataRequest("query",{query:e,params:t},r).pipe(map(n));return this.isPromiseAPI()?toPromise(i):i},getDocument:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",e),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(filter(isResponse),map(function(e){return e.body.documents&&e.body.documents[0]}));return this.isPromiseAPI()?toPromise(n):n},getDocuments:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",e.join(",")),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(filter(isResponse),map(function(t){var r=indexBy(t.body.documents||[],function(e){return e._id});return e.map(function(e){return r[e]||null})}));return this.isPromiseAPI()?toPromise(n):n},create:function(e,t){return this._create(e,"create",t)},createIfNotExists:function(e,t){return validators.requireDocumentId("createIfNotExists",e),this._create(e,"createIfNotExists",t)},createOrReplace:function(e,t){return validators.requireDocumentId("createOrReplace",e),this._create(e,"createOrReplace",t)},patch:function(e,t){return new Patch(e,t,this)},delete:function(e,t){return this.dataRequest("mutate",{mutations:[{delete:getSelection(e)}]},t)},mutate:function(e,t){var r=e instanceof Patch||e instanceof Transaction?e.serialize():e,n=Array.isArray(r)?r:[r],i=t&&t.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:i},t)},transaction:function(e){return new Transaction(e,this)},dataRequest:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._dataRequest(e,t,r);return this.isPromiseAPI()?toPromise(n):n},_dataRequest:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="mutate"===e,i="query"===e,o=!n&&encodeQueryString(t),a=!n&&o.length<getQuerySizeLimit,s=a?o:"",u=r.returnFirst,c=r.timeout,d=r.token,l=r.tag,f=r.headers,p={method:a?"GET":"POST",uri:this.getDataUrl(e,s),json:!0,body:a?void 0:t,query:n&&getMutationQuery(r),timeout:c,headers:f,token:d,tag:l,canUseCdn:i};return this._requestObservable(p).pipe(filter(isResponse),map(getBody),map(function(e){if(!n)return e;var t=e.results||[];if(r.returnDocuments)return u?t[0]&&t[0].document:t.map(function(e){return e.document});var i=u?"documentId":"documentIds",o=u?t[0]&&t[0].id:t.map(function(e){return e.id});return _defineProperty({transactionId:e.transactionId,results:t},i,o)}))},_create:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=_defineProperty({},t,e),i=assign({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},i)}};
12
12
 
13
13
  },{"../util/getSelection":19,"../util/observable":20,"../validators":23,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"object-assign":46}],5:[function(require,module,exports){
14
14
  "use strict";var _excluded=["tag"];function _objectWithoutProperties(e,t){if(null==e)return{};var c,o,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)c=r[o],t.indexOf(c)>=0||Object.prototype.propertyIsEnumerable.call(e,c)&&(n[c]=e[c])}return n}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var c,o,n={},r=Object.keys(e);for(o=0;o<r.length;o++)c=r[o],t.indexOf(c)>=0||(n[c]=e[c]);return n}var enc=encodeURIComponent;module.exports=function(e){var t=e.query,c=e.params,o=void 0===c?{}:c,n=e.options,r=void 0===n?{}:n,u=r.tag,a=_objectWithoutProperties(r,_excluded),i="query=".concat(enc(t)),s=u?"?tag=".concat(enc(u),"&").concat(i):"?".concat(i),l=Object.keys(o).reduce(function(e,t){return"".concat(e,"&").concat(enc("$".concat(t)),"=").concat(enc(JSON.stringify(o[t])))},s);return Object.keys(a).reduce(function(e,t){return r[t]?"".concat(e,"&").concat(enc(t),"=").concat(enc(r[t])):e},l)};
15
15
 
16
16
  },{}],6:[function(require,module,exports){
17
- "use strict";function ownKeys(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(n),!0).forEach(function(r){_defineProperty(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _defineProperty(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var assign=require("object-assign"),_require=require("../util/observable"),Observable=_require.Observable,polyfilledEventSource=require("@sanity/eventsource"),generateHelpUrl=require("@sanity/generate-help-url"),pick=require("../util/pick"),once=require("../util/once"),defaults=require("../util/defaults"),encodeQueryString=require("./encodeQueryString"),MAX_URL_LENGTH=14800,tokenWarning=["Using token with listeners is not supported in browsers. ","For more info, see ".concat(generateHelpUrl("js-client-listener-tokens-browser"),".")],printTokenWarning=once(function(){return console.warn(tokenWarning.join(" "))}),isWindowEventSource=Boolean("undefined"!=typeof window&&window.EventSource),EventSource=isWindowEventSource?window.EventSource:polyfilledEventSource,possibleOptions=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],defaultOptions={includeResult:!0};function parseEvent(e){try{var r=e.data&&JSON.parse(e.data)||{};return assign({type:e.type},r)}catch(e){return e}}function cooerceError(e){if(e instanceof Error)return e;var r=parseEvent(e);return r instanceof Error?r:new Error(extractErrorMessage(r))}function extractErrorMessage(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"}module.exports=function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=this.clientConfig,o=t.url,i=t.token,c=t.withCredentials,s=t.requestTagPrefix,u=n.tag&&s?[s,n.tag].join("."):n.tag,a=_objectSpread(_objectSpread({},defaults(n,defaultOptions)),{},{tag:u}),l=pick(a,possibleOptions),f=encodeQueryString({query:e,params:r,options:l,tag:u}),p="".concat(o).concat(this.getDataUrl("listen",f));if(p.length>MAX_URL_LENGTH)return new Observable(function(e){return e.error(new Error("Query too large for listener"))});var d=a.events?a.events:["mutation"],v=-1!==d.indexOf("reconnect");i&&isWindowEventSource&&printTokenWarning();var g={};return(i||c)&&(g.withCredentials=!0),i&&(g.headers={Authorization:"Bearer ".concat(i)}),new Observable(function(e){var r,n=a(),t=!1;function o(){t||(v&&e.next({type:"reconnect"}),t||n.readyState===EventSource.CLOSED&&(u(),clearTimeout(r),r=setTimeout(l,100)))}function i(r){e.error(cooerceError(r))}function c(r){var n=parseEvent(r);return n instanceof Error?e.error(n):e.next(n)}function s(r){t=!0,u(),e.complete()}function u(){n.removeEventListener("error",o,!1),n.removeEventListener("channelError",i,!1),n.removeEventListener("disconnect",s,!1),d.forEach(function(e){return n.removeEventListener(e,c,!1)}),n.close()}function a(){var e=new EventSource(p,g);return e.addEventListener("error",o,!1),e.addEventListener("channelError",i,!1),e.addEventListener("disconnect",s,!1),d.forEach(function(r){return e.addEventListener(r,c,!1)}),e}function l(){n=a()}return function(){t=!0,u()}})};
17
+ "use strict";function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var assign=require("object-assign"),_require=require("../util/observable"),Observable=_require.Observable,polyfilledEventSource=require("@sanity/eventsource"),pick=require("../util/pick"),defaults=require("../util/defaults"),encodeQueryString=require("./encodeQueryString"),MAX_URL_LENGTH=14800,EventSource=polyfilledEventSource,possibleOptions=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],defaultOptions={includeResult:!0};function parseEvent(e){try{var r=e.data&&JSON.parse(e.data)||{};return assign({type:e.type},r)}catch(e){return e}}function cooerceError(e){if(e instanceof Error)return e;var r=parseEvent(e);return r instanceof Error?r:new Error(extractErrorMessage(r))}function extractErrorMessage(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"}module.exports=function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.clientConfig,o=n.url,i=n.token,c=n.withCredentials,s=n.requestTagPrefix,a=t.tag&&s?[s,t.tag].join("."):t.tag,u=_objectSpread(_objectSpread({},defaults(t,defaultOptions)),{},{tag:a}),l=pick(u,possibleOptions),f=encodeQueryString({query:e,params:r,options:l,tag:a}),p="".concat(o).concat(this.getDataUrl("listen",f));if(p.length>MAX_URL_LENGTH)return new Observable(function(e){return e.error(new Error("Query too large for listener"))});var v=u.events?u.events:["mutation"],d=-1!==v.indexOf("reconnect"),b={};return(i||c)&&(b.withCredentials=!0),i&&(b.headers={Authorization:"Bearer ".concat(i)}),new Observable(function(e){var r,t=u(),n=!1;function o(){n||(d&&e.next({type:"reconnect"}),n||t.readyState===EventSource.CLOSED&&(a(),clearTimeout(r),r=setTimeout(l,100)))}function i(r){e.error(cooerceError(r))}function c(r){var t=parseEvent(r);return t instanceof Error?e.error(t):e.next(t)}function s(r){n=!0,a(),e.complete()}function a(){t.removeEventListener("error",o,!1),t.removeEventListener("channelError",i,!1),t.removeEventListener("disconnect",s,!1),v.forEach(function(e){return t.removeEventListener(e,c,!1)}),t.close()}function u(){var e=new EventSource(p,b);return e.addEventListener("error",o,!1),e.addEventListener("channelError",i,!1),e.addEventListener("disconnect",s,!1),v.forEach(function(r){return e.addEventListener(r,c,!1)}),e}function l(){t=u()}return function(){n=!0,a()}})};
18
18
 
19
- },{"../util/defaults":18,"../util/observable":20,"../util/once":21,"../util/pick":22,"./encodeQueryString":5,"@sanity/eventsource":26,"@sanity/generate-help-url":27,"object-assign":46}],7:[function(require,module,exports){
19
+ },{"../util/defaults":18,"../util/observable":20,"../util/pick":22,"./encodeQueryString":5,"@sanity/eventsource":25,"object-assign":46}],7:[function(require,module,exports){
20
20
  "use strict";function _defineProperty(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var assign=require("object-assign"),getSelection=require("../util/getSelection"),validate=require("../validators"),validateObject=validate.validateObject,validateInsert=validate.validateInsert;function Patch(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.selection=t,this.operations=assign({},e),this.client=i}assign(Patch.prototype,{clone:function(){return new Patch(this.selection,assign({},this.operations),this.client)},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return validateObject("diffMatchPatch",t),this._assign("diffMatchPatch",t)},unset:function(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=assign({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return validateObject("replace",t),this._set("set",{$:t})},inc:function(t){return this._assign("inc",t)},dec:function(t){return this._assign("dec",t)},insert:function(t,e,i){var n;return validateInsert(t,e,i),this._assign("insert",(_defineProperty(n={},t,e),_defineProperty(n,"items",i),n))},append:function(t,e){return this.insert("after","".concat(t,"[-1]"),e)},prepend:function(t,e){return this.insert("before","".concat(t,"[0]"),e)},splice:function(t,e,i,n){var s=e<0?e-1:e,r=void 0===i||-1===i?-1:Math.max(0,e+i),a=s<0&&r>=0?"":r,o="".concat(t,"[").concat(s,":").concat(a,"]");return this.insert("replace",o,n||[])},ifRevisionId:function(t){return this.operations.ifRevisionID=t,this},serialize:function(){return assign(getSelection(this.selection),this.operations)},toJSON:function(){return this.serialize()},commit:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.client)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");var e="string"==typeof this.selection,i=assign({returnFirst:e,returnDocuments:!0},t);return this.client.mutate({patch:this.serialize()},i)},reset:function(){return this.operations={},this},_set:function(t,e){return this._assign(t,e,!1)},_assign:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return validateObject(t,e),this.operations=assign({},this.operations,_defineProperty({},t,assign({},i&&this.operations[t]||{},e))),this}}),module.exports=Patch;
21
21
 
22
22
  },{"../util/getSelection":19,"../validators":23,"object-assign":46}],8:[function(require,module,exports){
@@ -70,16 +70,14 @@
70
70
  },{}],24:[function(require,module,exports){
71
71
  "use strict";var generateHelpUrl=require("@sanity/generate-help-url"),once=require("./util/once"),createWarningPrinter=function(e){return once(function(){for(var n,r=arguments.length,t=new Array(r),i=0;i<r;i++)t[i]=arguments[i];return(n=console).warn.apply(n,[e.join(" ")].concat(t))})};exports.printCdnWarning=createWarningPrinter(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat(generateHelpUrl("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),exports.printBrowserTokenWarning=createWarningPrinter(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(generateHelpUrl("js-client-browser-token")," for more information and how to hide this warning.")]),exports.printNoApiVersionSpecifiedWarning=createWarningPrinter(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(generateHelpUrl("js-client-api-version"))]);
72
72
 
73
- },{"./util/once":21,"@sanity/generate-help-url":27}],25:[function(require,module,exports){
74
- (function (global){(function (){
75
- !function(t,e){if("function"==typeof define&&define.amd)define([],e);else if("object"==typeof module&&module.exports)module.exports=e();else{if(global.EventSource&&!global._eventSourceImportPrefix)return;t[(t._eventSourceImportPrefix||"")+"EventSource"]=e()}}("undefined"==typeof self?this:self,function(){var t=function(t,e){if(!t||"string"!=typeof t)throw new SyntaxError("Not enough arguments");this.URL=t,this.setOptions(e);var i=this;setTimeout(function(){i.poll()},0)};if(t.prototype={CONNECTING:0,OPEN:1,CLOSED:2,defaultOptions:{loggingEnabled:!1,loggingPrefix:"eventsource",interval:500,bufferSizeLimit:262144,silentTimeout:3e5,getArgs:{evs_buffer_size_limit:262144},xhrHeaders:{Accept:"text/event-stream","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}},setOptions:function(t){var e,i=this.defaultOptions;for(e in i)i.hasOwnProperty(e)&&(this[e]=i[e]);for(e in t)e in i&&t.hasOwnProperty(e)&&(this[e]=t[e]);this.getArgs&&this.bufferSizeLimit&&(this.getArgs.evs_buffer_size_limit=this.bufferSizeLimit),"undefined"!=typeof console&&void 0!==console.log||(this.loggingEnabled=!1)},log:function(t){this.loggingEnabled&&console.log("["+this.loggingPrefix+"]:"+t)},poll:function(){try{if(this.readyState==this.CLOSED)return;this.cleanup(),this.readyState=this.CONNECTING,this.cursor=0,this.cache="",this._xhr=new this.XHR(this),this.resetNoActivityTimer()}catch(t){this.log("There were errors inside the pool try-catch"),this.dispatchEvent("error",{type:"error",data:t.message})}},pollAgain:function(t){var e=this;e.readyState=e.CONNECTING,e.dispatchEvent("error",{type:"error",data:"Reconnecting "}),this._pollTimer=setTimeout(function(){e.poll()},t||0)},cleanup:function(){this.log("evs cleaning up"),this._pollTimer&&(clearInterval(this._pollTimer),this._pollTimer=null),this._noActivityTimer&&(clearInterval(this._noActivityTimer),this._noActivityTimer=null),this._xhr&&(this._xhr.abort(),this._xhr=null)},resetNoActivityTimer:function(){if(this.silentTimeout){this._noActivityTimer&&clearInterval(this._noActivityTimer);var t=this;this._noActivityTimer=setTimeout(function(){t.log("Timeout! silentTImeout:"+t.silentTimeout),t.pollAgain()},this.silentTimeout)}},close:function(){this.readyState=this.CLOSED,this.log("Closing connection. readyState: "+this.readyState),this.cleanup()},_onxhrdata:function(){var t=this._xhr;if(t.isReady()&&!t.hasError()){this.resetNoActivityTimer(),this.readyState==this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent("open",{type:"open"}));var e=t.getBuffer();e.length>this.bufferSizeLimit&&(this.log("buffer.length > this.bufferSizeLimit"),this.pollAgain()),0==this.cursor&&e.length>0&&"\ufeff"==e.substring(0,1)&&(this.cursor=1);var i=this.lastMessageIndex(e);if(i[0]>=this.cursor){var r=i[1],n=e.substring(this.cursor,r);this.parseStream(n),this.cursor=r}t.isDone()&&(this.log("request.isDone(). reopening the connection"),this.pollAgain(this.interval))}else this.readyState!==this.CLOSED&&(this.log("this.readyState !== this.CLOSED"),this.pollAgain(this.interval))},parseStream:function(t){var e,r,n,s,o,a,l=(t=this.cache+this.normalizeToLF(t)).split("\n\n");for(e=0;e<l.length-1;e++){n="message",s=[];var h=l[e].split("\n");for(r=0;r<h.length;r++)0==(o=this.trimWhiteSpace(h[r])).indexOf("event")?n=o.replace(/event:?\s*/,""):0==o.indexOf("retry")?(a=parseInt(o.replace(/retry:?\s*/,""),10),isNaN(a)||(this.interval=a)):0==o.indexOf("data")?s.push(o.replace(/data:?\s*/,"")):0==o.indexOf("id:")?this.lastEventId=o.replace(/id:?\s*/,""):0==o.indexOf("id")&&(this.lastEventId=null);if(s.length&&this.readyState!=this.CLOSED){var u=new i(n,s.join("\n"),"undefined"!=typeof window&&void 0!==window.location?window.location.origin:null,this.lastEventId);this.dispatchEvent(n,u)}}this.cache=l[l.length-1]},dispatchEvent:function(t,e){var i=this["_"+t+"Handlers"];if(i)for(var r=0;r<i.length;r++)i[r].call(this,e);this["on"+t]&&this["on"+t].call(this,e)},addEventListener:function(t,e){this["_"+t+"Handlers"]||(this["_"+t+"Handlers"]=[]),this["_"+t+"Handlers"].push(e)},removeEventListener:function(t,e){var i=this["_"+t+"Handlers"];if(i)for(var r=i.length-1;r>=0;--r)if(i[r]===e){i.splice(r,1);break}},_pollTimer:null,_noactivityTimer:null,_xhr:null,lastEventId:null,cache:"",cursor:0,onerror:null,onmessage:null,onopen:null,readyState:0,urlWithParams:function(t,e){var i=[];if(e){var r,n,s=encodeURIComponent;for(r in e)e.hasOwnProperty(r)&&(n=s(r)+"="+s(e[r]),i.push(n))}return i.length>0?-1==t.indexOf("?")?t+"?"+i.join("&"):t+"&"+i.join("&"):t},lastMessageIndex:function(t){var e=t.lastIndexOf("\n\n"),i=t.lastIndexOf("\r\r"),r=t.lastIndexOf("\r\n\r\n");return r>Math.max(e,i)?[r,r+4]:[Math.max(e,i),Math.max(e,i)+2]},trimWhiteSpace:function(t){return t.replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},Boolean("undefined"!=typeof window&&window.XDomainRequest&&window.XMLHttpRequest&&void 0===(new XMLHttpRequest).responseType)){t.isPolyfill="IE_8-9";var e=t.prototype.defaultOptions;e.xhrHeaders=null,e.getArgs.evs_preamble=2056,t.prototype.XHR=function(t){var e=new XDomainRequest;this._request=e,e.onprogress=function(){e._ready=!0,t._onxhrdata()},e.onload=function(){this._loaded=!0,t._onxhrdata()},e.onerror=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest error"})},e.ontimeout=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest timed out"})};var i={};if(t.getArgs){var r=t.getArgs;for(var n in r)r.hasOwnProperty(n)&&(i[n]=r[n]);t.lastEventId&&(i.evs_last_event_id=t.lastEventId)}e.open("GET",t.urlWithParams(t.URL,i)),e.send()},t.prototype.XHR.prototype={useXDomainRequest:!0,_request:null,_ready:!1,_loaded:!1,_failed:!1,isReady:function(){return this._request._ready},isDone:function(){return this._request._loaded},hasError:function(){return this._request._failed},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}}}else t.isPolyfill="XHR",t.prototype.XHR=function(t){var e=new XMLHttpRequest;this._request=e,t._xhr=this,e.onreadystatechange=function(){e.readyState>1&&t.readyState!=t.CLOSED&&(200==e.status||e.status>=300&&e.status<400?t._onxhrdata():(e._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"The server responded with "+e.status}),t.close()))},e.onprogress=function(){},e.open("GET",t.urlWithParams(t.URL,t.getArgs),!0);var i=t.xhrHeaders;for(var r in i)i.hasOwnProperty(r)&&e.setRequestHeader(r,i[r]);t.lastEventId&&e.setRequestHeader("Last-Event-Id",t.lastEventId),e.send()},t.prototype.XHR.prototype={useXDomainRequest:!1,_request:null,_failed:!1,isReady:function(){return this._request.readyState>=2},isDone:function(){return 4==this._request.readyState},hasError:function(){return this._failed||this._request.status>=400},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}};function i(t,e,i,r){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.data=e||null,this.origin=i||"",this.lastEventId=r||"",this.type=t||"message"}return t});
73
+ },{"./util/once":21,"@sanity/generate-help-url":26}],25:[function(require,module,exports){
74
+ var evs=require("event-source-polyfill");module.exports=evs.EventSourcePolyfill;
76
75
 
77
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
78
- },{}],26:[function(require,module,exports){
79
- var evs=require("@rexxars/eventsource-polyfill");module.exports="undefined"!=typeof window&&window.EventSource?window.EventSource:evs.EventSource;
76
+ },{"event-source-polyfill":27}],26:[function(require,module,exports){
77
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports[Symbol.toStringTag]="Module";const t="https://docs.sanity.io/help/";function r(e){return t+e}exports.generateHelpUrl=r;
80
78
 
81
- },{"@rexxars/eventsource-polyfill":25}],27:[function(require,module,exports){
82
- var baseUrl="https://docs.sanity.io/help/";module.exports=function(e){return baseUrl+e};
79
+ },{}],27:[function(require,module,exports){
80
+ !function(e){"use strict";var t=e.setTimeout,n=e.clearTimeout,r=e.XMLHttpRequest,o=e.XDomainRequest,i=e.ActiveXObject,a=e.EventSource,s=e.document,c=e.Promise,l=e.fetch,u=e.Response,d=e.TextDecoder,h=e.TextEncoder,p=e.AbortController;if("undefined"==typeof window||void 0===s||"readyState"in s||null!=s.body||(s.readyState="loading",window.addEventListener("load",function(e){s.readyState="complete"},!1)),null==r&&null!=i&&(r=function(){return new i("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==p){var f=l;l=function(e,t){var n=t.signal;return f(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then(function(e){var t=e.body.getReader();return n._reader=t,n._aborted&&n._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}})},p=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function y(){this.bitsNeeded=0,this.codePoint=0}y.prototype.decode=function(e){function t(e,t,n){if(1===n)return e>=128>>t&&e<<t<=2047;if(2===n)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===n)return e>=65536>>t&&e<<t<=1114111;throw new Error}function n(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var r="",o=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var s=e[a];0!==o&&(s<128||s>191||!t(i<<6|63&s,o-6,n(o,i)))&&(o=0,i=65533,r+=String.fromCharCode(i)),0===o?(s>=0&&s<=127?(o=0,i=s):s>=192&&s<=223?(o=6,i=31&s):s>=224&&s<=239?(o=12,i=15&s):s>=240&&s<=247?(o=18,i=7&s):(o=0,i=65533),0===o||t(i,o,n(o,i))||(o=0,i=65533)):(o-=6,i=i<<6|63&s),0===o&&(i<=65535?r+=String.fromCharCode(i):(r+=String.fromCharCode(55296+(i-65535-1>>10)),r+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=o,this.codePoint=i,r};null!=d&&null!=h&&function(){try{return"test"===(new d).decode((new h).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(d=y);var v=function(){};function g(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 b(e){for(var t=Object.create(null),n=e.split("\r\n"),r=0;r<n.length;r+=1){var o=n[r].split(": "),i=o.shift(),a=o.join(": ");t[w(i)]=a}this._map=t}function E(){}function m(e){this._headers=e}function C(){}function T(){this._listeners=Object.create(null)}function _(e){t(function(){throw e},0)}function S(e){this.type=e,this.target=void 0}function x(e,t){S.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){S.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function R(e,t){S.call(this,e),this.error=t.error}g.prototype.open=function(e,o){this._abort(!0);var i=this,a=this._xhr,s=1,c=0;this._abort=function(e){0!==i._sendTimeout&&(n(i._sendTimeout),i._sendTimeout=0),1!==s&&2!==s&&3!==s||(s=4,a.onload=v,a.onerror=v,a.onabort=v,a.onprogress=v,a.onreadystatechange=v,a.abort(),0!==c&&(n(c),c=0),e||(i.readyState=4,i.onabort(null),i.onreadystatechange())),s=0};var l=function(){if(1===s){var e=0,t="",n=void 0;if("contentType"in a)e=200,t="OK",n=a.contentType;else try{e=a.status,t=a.statusText,n=a.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(s=2,i.readyState=2,i.status=e,i.statusText=t,i._contentType=n,i.onreadystatechange())}},u=function(){if(l(),2===s||3===s){s=3;var e="";try{e=a.responseText}catch(e){}i.readyState=3,i.responseText=e,i.onprogress()}},d=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),u(),1===s||2===s||3===s){if(s=4,0!==c&&(n(c),c=0),i.readyState=4,"load"===e)i.onload(t);else if("error"===e)i.onerror(t);else{if("abort"!==e)throw new TypeError;i.onabort(t)}i.onreadystatechange()}},h=function(){c=t(function(){h()},500),3===a.readyState&&u()};"onload"in a&&(a.onload=function(e){d("load",e)}),"onerror"in a&&(a.onerror=function(e){d("error",e)}),"onabort"in a&&(a.onabort=function(e){d("abort",e)}),"onprogress"in a&&(a.onprogress=u),"onreadystatechange"in a&&(a.onreadystatechange=function(e){!function(e){null!=a&&(4===a.readyState?"onload"in a&&"onerror"in a&&"onabort"in a||d(""===a.responseText?"error":"load",e):3===a.readyState?"onprogress"in a||u():2===a.readyState&&l())}(e)}),!("contentType"in a)&&"ontimeout"in r.prototype||(o+=(-1===o.indexOf("?")?"?":"&")+"padding=true"),a.open(e,o,!0),"readyState"in a&&(c=t(function(){h()},0))},g.prototype.abort=function(){this._abort(!1)},g.prototype.getResponseHeader=function(e){return this._contentType},g.prototype.setRequestHeader=function(e,t){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,t)},g.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},g.prototype.send=function(){if("ontimeout"in r.prototype&&("sendAsBinary"in r.prototype||"mozAnon"in r.prototype)||null==s||null==s.readyState||"complete"===s.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var n=this;n._sendTimeout=t(function(){n._sendTimeout=0,n.send()},4)}},b.prototype.get=function(e){return this._map[w(e)]},null!=r&&null==r.HEADERS_RECEIVED&&(r.HEADERS_RECEIVED=2),E.prototype.open=function(e,t,n,o,i,a,s){e.open("GET",i);var c=0;for(var l in e.onprogress=function(){var t=e.responseText.slice(c);c+=t.length,n(t)},e.onerror=function(e){e.preventDefault(),o(new Error("NetworkError"))},e.onload=function(){o(null)},e.onabort=function(){o(null)},e.onreadystatechange=function(){if(e.readyState===r.HEADERS_RECEIVED){var n=e.status,o=e.statusText,i=e.getResponseHeader("Content-Type"),a=e.getAllResponseHeaders();t(n,o,i,new b(a))}},e.withCredentials=a,s)Object.prototype.hasOwnProperty.call(s,l)&&e.setRequestHeader(l,s[l]);return e.send(),e},m.prototype.get=function(e){return this._headers.get(e)},C.prototype.open=function(e,t,n,r,o,i,a){var s=null,u=new p,h=u.signal,f=new d;return l(o,{headers:a,credentials:i?"include":"same-origin",signal:h,cache:"no-store"}).then(function(e){return s=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new m(e.headers)),new c(function(e,t){var r=function(){s.read().then(function(t){if(t.done)e(void 0);else{var o=f.decode(t.value,{stream:!0});n(o),r()}}).catch(function(e){t(e)})};r()})}).catch(function(e){return"AbortError"===e.name?void 0:e}).then(function(e){r(e)}),{abort:function(){null!=s&&s.cancel(),u.abort()}}},T.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var n=t.length,r=0;r<n;r+=1){var o=t[r];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){_(e)}}},T.prototype.addEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];null==r&&(r=[],n[e]=r);for(var o=!1,i=0;i<r.length;i+=1)r[i]===t&&(o=!0);o||r.push(t)},T.prototype.removeEventListener=function(e,t){e=String(e);var n=this._listeners,r=n[e];if(null!=r){for(var o=[],i=0;i<r.length;i+=1)r[i]!==t&&o.push(r[i]);0===o.length?delete n[e]:n[e]=o}},x.prototype=Object.create(S.prototype),A.prototype=Object.create(S.prototype),R.prototype=Object.create(S.prototype);var O=-1,D=0,H=1,N=2,j=-1,I=0,P=1,L=2,M=3,q=/^text\/event\-stream(;.*)?$/i,X=function(e,t){var n=null==e?t:parseInt(e,10);return n!=n&&(n=t),G(n)},G=function(e){return Math.min(Math.max(e,1e3),18e6)},V=function(e,t,n){try{"function"==typeof t&&t.call(e,n)}catch(e){_(e)}};function B(e,i){T.call(this),i=i||{},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,i,a){i=String(i);var s=Boolean(a.withCredentials),c=a.lastEventIdQueryParameterName||"lastEventId",l=G(1e3),u=X(a.heartbeatTimeout,45e3),d="",h=l,p=!1,f=0,y=a.headers||{},v=a.Transport,w=U&&null==v?void 0:new g(null!=v?new v:null!=r&&"withCredentials"in r.prototype||null==o?new r:new o),b=null!=v&&"string"!=typeof v?new v:null==w?new C:new E,m=void 0,T=0,_=O,S="",B="",k="",z="",K=I,Q=0,Z=0,$=function(t,n,r,o){if(_===D)if(200===t&&null!=r&&q.test(r)){_=H,p=Date.now(),h=l,e.readyState=H;var i=new A("open",{status:t,statusText:n,headers:o});e.dispatchEvent(i),V(e,e.onopen,i)}else{var a="";200!==t?(n&&(n=n.replace(/\s+/g," ")),a="EventSource's response has a status "+t+" "+n+" that is not 200. Aborting the connection."):a="EventSource's response has a Content-Type specifying an unsupported type: "+(null==r?"-":r.replace(/\s+/g," "))+". Aborting the connection.",W();var i=new A("error",{status:t,statusText:n,headers:o});e.dispatchEvent(i),V(e,e.onerror,i),console.error(a)}},F=function(r){if(_===H){for(var o=-1,i=0;i<r.length;i+=1){var a=r.charCodeAt(i);a!=="\n".charCodeAt(0)&&a!=="\r".charCodeAt(0)||(o=i)}var s=(-1!==o?z:"")+r.slice(0,o+1);z=(-1===o?z:"")+r.slice(o+1),""!==r&&(p=Date.now(),f+=r.length);for(var c=0;c<s.length;c+=1){var a=s.charCodeAt(c);if(K===j&&a==="\n".charCodeAt(0))K=I;else if(K===j&&(K=I),a==="\r".charCodeAt(0)||a==="\n".charCodeAt(0)){if(K!==I){K===P&&(Z=c+1);var y=s.slice(Q,Z-1),v=s.slice(Z+(Z<c&&s.charCodeAt(Z)===" ".charCodeAt(0)?1:0),c);"data"===y?(S+="\n",S+=v):"id"===y?B=v:"event"===y?k=v:"retry"===y?(l=X(v,l),h=l):"heartbeatTimeout"===y&&(u=X(v,u),0!==T&&(n(T),T=t(function(){Y()},u)))}if(K===I){if(""!==S){d=B,""===k&&(k="message");var g=new x(k,{data:S.slice(1),lastEventId:B});if(e.dispatchEvent(g),"open"===k?V(e,e.onopen,g):"message"===k?V(e,e.onmessage,g):"error"===k&&V(e,e.onerror,g),_===N)return}S="",k=""}K=a==="\r".charCodeAt(0)?j:I}else K===I&&(Q=c,K=P),K===P?a===":".charCodeAt(0)&&(Z=c+1,K=L):K===L&&(K=M)}}},J=function(r){if(_===H||_===D){_=O,0!==T&&(n(T),T=0),T=t(function(){Y()},h),h=G(Math.min(16*l,2*h)),e.readyState=D;var o=new R("error",{error:r});e.dispatchEvent(o),V(e,e.onerror,o),null!=r&&console.error(r)}},W=function(){_=N,null!=m&&(m.abort(),m=void 0),0!==T&&(n(T),T=0),e.readyState=N},Y=function(){if(T=0,_===O){p=!1,f=0,T=t(function(){Y()},u),_=D,S="",k="",B=d,z="",Q=0,Z=0,K=I;var n=i;if("data:"!==i.slice(0,5)&&"blob:"!==i.slice(0,5)&&""!==d){var r=i.indexOf("?");n=-1===r?i:i.slice(0,r+1)+i.slice(r+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,function(e,t){return t===c?"":e}),n+=(-1===i.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(d)}var o=e.withCredentials,a={Accept:"text/event-stream"},s=e.headers;if(null!=s)for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(a[l]=s[l]);try{m=b.open(w,$,F,J,n,o,a)}catch(e){throw W(),e}}else if(p||null==m){var h=Math.max((p||Date.now())+u-Date.now(),1);p=!1,T=t(function(){Y()},h)}else J(new Error("No activity within "+u+" milliseconds. "+(_===D?"No response received.":f+" chars received.")+" Reconnecting.")),null!=m&&(m.abort(),m=void 0)};e.url=i,e.readyState=D,e.withCredentials=s,e.headers=y,e._close=W,Y()}(this,e,i)}var U=null!=l&&null!=u&&"body"in u.prototype;B.prototype=Object.create(T.prototype),B.prototype.CONNECTING=D,B.prototype.OPEN=H,B.prototype.CLOSED=N,B.prototype.close=function(){this._close()},B.CONNECTING=D,B.OPEN=H,B.CLOSED=N,B.prototype.withCredentials=void 0;var k=a;null==r||null!=a&&"withCredentials"in a.prototype||(k=B),function(t){if("object"==typeof module&&"object"==typeof module.exports){var n=t(exports);void 0!==n&&(module.exports=n)}else"function"==typeof define&&define.amd?define(["exports"],t):t(e)}(function(e){e.EventSourcePolyfill=B,e.NativeEventSource=a,e.EventSource=k})}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:this:globalThis);
83
81
 
84
82
  },{}],28:[function(require,module,exports){
85
83
  module.exports=require("./lib-node");
@@ -119,7 +117,7 @@ module.exports=require("./lib-node");
119
117
 
120
118
  },{"./node-request":37}],40:[function(require,module,exports){
121
119
  (function (global){(function (){
122
- "use strict";"undefined"!=typeof window?module.exports=window:"undefined"!=typeof global?module.exports=global:"undefined"!=typeof self?module.exports=self:module.exports={};
120
+ "use strict";"undefined"!=typeof globalThis?module.exports=globalThis:"undefined"!=typeof window?module.exports=window:"undefined"!=typeof global?module.exports=global:"undefined"!=typeof self?module.exports=self:module.exports={};
123
121
 
124
122
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
125
123
  },{}],41:[function(require,module,exports){
@@ -211,7 +209,7 @@ var trim=function(r){return r.replace(/^\s+|\s+$/g,"")},isArray=function(r){retu
211
209
 
212
210
  },{}],70:[function(require,module,exports){
213
211
  (function (global){(function (){
214
- "use strict";var required=require("requires-port"),qs=require("querystringify"),slashes=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,protocolre=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,windowsDriveLetter=/^[a-zA-Z]:/,whitespace="[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]",left=new RegExp("^"+whitespace+"+");function trimLeft(e){return(e||"").toString().replace(left,"")}var rules=[["#","hash"],["?","query"],function(e,t){return isSpecial(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],ignore={hash:1,query:1};function lolcation(e){var t,o=("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).location||{},r={},s=typeof(e=e||o);if("blob:"===e.protocol)r=new Url(unescape(e.pathname),{});else if("string"===s)for(t in r=new Url(e,{}),ignore)delete r[t];else if("object"===s){for(t in e)t in ignore||(r[t]=e[t]);void 0===r.slashes&&(r.slashes=slashes.test(e.href))}return r}function isSpecial(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function extractProtocol(e,t){e=trimLeft(e),t=t||{};var o,r=protocolre.exec(e),s=r[1]?r[1].toLowerCase():"",a=!!r[2],l=!!r[3],n=0;return a?l?(o=r[2]+r[3]+r[4],n=r[2].length+r[3].length):(o=r[2]+r[4],n=r[2].length):l?(o=r[3]+r[4],n=r[3].length):o=r[4],"file:"===s?n>=2&&(o=o.slice(2)):isSpecial(s)?o=r[4]:s?a&&(o=o.slice(2)):n>=2&&isSpecial(t.protocol)&&(o=r[4]),{protocol:s,slashes:a||isSpecial(s),slashesCount:n,rest:o}}function resolve(e,t){if(""===e)return t;for(var o=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=o.length,s=o[r-1],a=!1,l=0;r--;)"."===o[r]?o.splice(r,1):".."===o[r]?(o.splice(r,1),l++):l&&(0===r&&(a=!0),o.splice(r,1),l--);return a&&o.unshift(""),"."!==s&&".."!==s||o.push(""),o.join("/")}function Url(e,t,o){if(e=trimLeft(e),!(this instanceof Url))return new Url(e,t,o);var r,s,a,l,n,i,p=rules.slice(),c=typeof t,h=this,u=0;for("object"!==c&&"string"!==c&&(o=t,t=null),o&&"function"!=typeof o&&(o=qs.parse),r=!(s=extractProtocol(e||"",t=lolcation(t))).protocol&&!s.slashes,h.slashes=s.slashes||r&&t.slashes,h.protocol=s.protocol||t.protocol||"",e=s.rest,("file:"===s.protocol&&(2!==s.slashesCount||windowsDriveLetter.test(e))||!s.slashes&&(s.protocol||s.slashesCount<2||!isSpecial(h.protocol)))&&(p[3]=[/(.*)/,"pathname"]);u<p.length;u++)"function"!=typeof(l=p[u])?(a=l[0],i=l[1],a!=a?h[i]=e:"string"==typeof a?~(n=e.indexOf(a))&&("number"==typeof l[2]?(h[i]=e.slice(0,n),e=e.slice(n+l[2])):(h[i]=e.slice(n),e=e.slice(0,n))):(n=a.exec(e))&&(h[i]=n[1],e=e.slice(0,n.index)),h[i]=h[i]||r&&l[3]&&t[i]||"",l[4]&&(h[i]=h[i].toLowerCase())):e=l(e,h);o&&(h.query=o(h.query)),r&&t.slashes&&"/"!==h.pathname.charAt(0)&&(""!==h.pathname||""!==t.pathname)&&(h.pathname=resolve(h.pathname,t.pathname)),"/"!==h.pathname.charAt(0)&&isSpecial(h.protocol)&&(h.pathname="/"+h.pathname),required(h.port,h.protocol)||(h.host=h.hostname,h.port=""),h.username=h.password="",h.auth&&(l=h.auth.split(":"),h.username=l[0],h.password=l[1]||""),h.origin="file:"!==h.protocol&&isSpecial(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function set(e,t,o){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(o||qs.parse)(t)),r[e]=t;break;case"port":r[e]=t,required(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!o;break;case"pathname":case"hash":if(t){var s="pathname"===e?"/":"#";r[e]=t.charAt(0)!==s?s+t:t}else r[e]=t;break;case"username":case"password":r[e]=encodeURIComponent(t);break;case"auth":var a=t.split(":");r.username=a[0],r.password=2===a.length?a[1]:""}for(var l=0;l<rules.length;l++){var n=rules[l];n[4]&&(r[n[1]]=r[n[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin="file:"!==r.protocol&&isSpecial(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r}function toString(e){e&&"function"==typeof e||(e=qs.stringify);var t,o=this,r=o.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var s=r+(o.protocol&&o.slashes||isSpecial(o.protocol)?"//":"");return o.username?(s+=o.username,o.password&&(s+=":"+o.password),s+="@"):o.password&&(s+=":"+o.password,s+="@"),s+=o.host+o.pathname,(t="object"==typeof o.query?e(o.query):o.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),o.hash&&(s+=o.hash),s}Url.prototype={set:set,toString:toString},Url.extractProtocol=extractProtocol,Url.location=lolcation,Url.trimLeft=trimLeft,Url.qs=qs,module.exports=Url;
212
+ "use strict";var required=require("requires-port"),qs=require("querystringify"),controlOrWhitespace=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,CRHTLF=/[\n\r\t]/g,slashes=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,port=/:\d+$/,protocolre=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,windowsDriveLetter=/^[a-zA-Z]:/;function trimLeft(e){return(e||"").toString().replace(controlOrWhitespace,"")}var rules=[["#","hash"],["?","query"],function(e,o){return isSpecial(o.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],ignore={hash:1,query:1};function lolcation(e){var o,t=("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).location||{},r={},s=typeof(e=e||t);if("blob:"===e.protocol)r=new Url(unescape(e.pathname),{});else if("string"===s)for(o in r=new Url(e,{}),ignore)delete r[o];else if("object"===s){for(o in e)o in ignore||(r[o]=e[o]);void 0===r.slashes&&(r.slashes=slashes.test(e.href))}return r}function isSpecial(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function extractProtocol(e,o){e=(e=trimLeft(e)).replace(CRHTLF,""),o=o||{};var t,r=protocolre.exec(e),s=r[1]?r[1].toLowerCase():"",a=!!r[2],n=!!r[3],l=0;return a?n?(t=r[2]+r[3]+r[4],l=r[2].length+r[3].length):(t=r[2]+r[4],l=r[2].length):n?(t=r[3]+r[4],l=r[3].length):t=r[4],"file:"===s?l>=2&&(t=t.slice(2)):isSpecial(s)?t=r[4]:s?a&&(t=t.slice(2)):l>=2&&isSpecial(o.protocol)&&(t=r[4]),{protocol:s,slashes:a||isSpecial(s),slashesCount:l,rest:t}}function resolve(e,o){if(""===e)return o;for(var t=(o||"/").split("/").slice(0,-1).concat(e.split("/")),r=t.length,s=t[r-1],a=!1,n=0;r--;)"."===t[r]?t.splice(r,1):".."===t[r]?(t.splice(r,1),n++):n&&(0===r&&(a=!0),t.splice(r,1),n--);return a&&t.unshift(""),"."!==s&&".."!==s||t.push(""),t.join("/")}function Url(e,o,t){if(e=(e=trimLeft(e)).replace(CRHTLF,""),!(this instanceof Url))return new Url(e,o,t);var r,s,a,n,l,i,p=rules.slice(),c=typeof o,h=this,u=0;for("object"!==c&&"string"!==c&&(t=o,o=null),t&&"function"!=typeof t&&(t=qs.parse),r=!(s=extractProtocol(e||"",o=lolcation(o))).protocol&&!s.slashes,h.slashes=s.slashes||r&&o.slashes,h.protocol=s.protocol||o.protocol||"",e=s.rest,("file:"===s.protocol&&(2!==s.slashesCount||windowsDriveLetter.test(e))||!s.slashes&&(s.protocol||s.slashesCount<2||!isSpecial(h.protocol)))&&(p[3]=[/(.*)/,"pathname"]);u<p.length;u++)"function"!=typeof(n=p[u])?(a=n[0],i=n[1],a!=a?h[i]=e:"string"==typeof a?~(l="@"===a?e.lastIndexOf(a):e.indexOf(a))&&("number"==typeof n[2]?(h[i]=e.slice(0,l),e=e.slice(l+n[2])):(h[i]=e.slice(l),e=e.slice(0,l))):(l=a.exec(e))&&(h[i]=l[1],e=e.slice(0,l.index)),h[i]=h[i]||r&&n[3]&&o[i]||"",n[4]&&(h[i]=h[i].toLowerCase())):e=n(e,h);t&&(h.query=t(h.query)),r&&o.slashes&&"/"!==h.pathname.charAt(0)&&(""!==h.pathname||""!==o.pathname)&&(h.pathname=resolve(h.pathname,o.pathname)),"/"!==h.pathname.charAt(0)&&isSpecial(h.protocol)&&(h.pathname="/"+h.pathname),required(h.port,h.protocol)||(h.host=h.hostname,h.port=""),h.username=h.password="",h.auth&&(~(l=h.auth.indexOf(":"))?(h.username=h.auth.slice(0,l),h.username=encodeURIComponent(decodeURIComponent(h.username)),h.password=h.auth.slice(l+1),h.password=encodeURIComponent(decodeURIComponent(h.password))):h.username=encodeURIComponent(decodeURIComponent(h.auth)),h.auth=h.password?h.username+":"+h.password:h.username),h.origin="file:"!==h.protocol&&isSpecial(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function set(e,o,t){var r=this;switch(e){case"query":"string"==typeof o&&o.length&&(o=(t||qs.parse)(o)),r[e]=o;break;case"port":r[e]=o,required(o,r.protocol)?o&&(r.host=r.hostname+":"+o):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=o,r.port&&(o+=":"+r.port),r.host=o;break;case"host":r[e]=o,port.test(o)?(o=o.split(":"),r.port=o.pop(),r.hostname=o.join(":")):(r.hostname=o,r.port="");break;case"protocol":r.protocol=o.toLowerCase(),r.slashes=!t;break;case"pathname":case"hash":if(o){var s="pathname"===e?"/":"#";r[e]=o.charAt(0)!==s?s+o:o}else r[e]=o;break;case"username":case"password":r[e]=encodeURIComponent(o);break;case"auth":var a=o.indexOf(":");~a?(r.username=o.slice(0,a),r.username=encodeURIComponent(decodeURIComponent(r.username)),r.password=o.slice(a+1),r.password=encodeURIComponent(decodeURIComponent(r.password))):r.username=encodeURIComponent(decodeURIComponent(o))}for(var n=0;n<rules.length;n++){var l=rules[n];l[4]&&(r[l[1]]=r[l[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin="file:"!==r.protocol&&isSpecial(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r}function toString(e){e&&"function"==typeof e||(e=qs.stringify);var o,t=this,r=t.host,s=t.protocol;s&&":"!==s.charAt(s.length-1)&&(s+=":");var a=s+(t.protocol&&t.slashes||isSpecial(t.protocol)?"//":"");return t.username?(a+=t.username,t.password&&(a+=":"+t.password),a+="@"):t.password?(a+=":"+t.password,a+="@"):"file:"!==t.protocol&&isSpecial(t.protocol)&&!r&&"/"!==t.pathname&&(a+="@"),(":"===r[r.length-1]||port.test(t.hostname)&&!t.port)&&(r+=":"),a+=r+t.pathname,(o="object"==typeof t.query?e(t.query):t.query)&&(a+="?"!==o.charAt(0)?"?"+o:o),t.hash&&(a+=t.hash),a}Url.prototype={set:set,toString:toString},Url.extractProtocol=extractProtocol,Url.location=lolcation,Url.trimLeft=trimLeft,Url.qs=qs,module.exports=Url;
215
213
 
216
214
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
217
215
  },{"querystringify":48,"requires-port":49}]},{},[16])(16)
@@ -1 +1 @@
1
- !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SanityClient=t()}}((function(){return function t(e,r,n){function o(s,a){if(!r[s]){if(!e[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[s]={exports:{}};e[s][0].call(l.exports,(function(t){return o(e[s][1][t]||t)}),l,l.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(t){a=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var i=t("object-assign"),s=t("../util/observable"),a=s.map,c=s.filter,u=t("../http/queryString"),l=t("../validators");function f(t){this.client=t}function p(t,e){return"undefined"!=typeof window&&e instanceof window.File?i({filename:!1===t.preserveFilename?void 0:e.name,contentType:e.type},t):t}i(f.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};l.validateAssetType(t);var n=r.extract||void 0;n&&!n.length&&(n=["none"]);var o=l.hasDataset(this.client.clientConfig),i="image"===t?"images":"files",s=p(r,e),u=s.tag,f=s.label,h=s.title,d=s.description,b=s.creditLine,y=s.filename,v=s.source,g={label:f,title:h,description:d,filename:y,meta:n,creditLine:b};v&&(g.sourceId=v.id,g.sourceName=v.name,g.sourceUrl=v.url);var m=this.client._requestObservable({tag:u,method:"POST",timeout:s.timeout||0,uri:"/assets/".concat(i,"/").concat(o),headers:s.contentType?{"Content-Type":s.contentType}:{},query:g,body:e});return this.client.isPromiseAPI()?m.pipe(c((function(t){return"response"===t.type})),a((function(t){return t.body.document}))).toPromise():m},delete:function(t,e){console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");var r=e||"";return/^(image|file)-/.test(r)?t._id&&(r=t._id):r="".concat(t,"-").concat(r),l.hasDataset(this.client.clientConfig),this.client.delete(r)},getImageUrl:function(t,e){var r=t._ref||t;if("string"!=typeof r)throw new Error("getImageUrl() needs either an object with a _ref, or a string with an asset document ID");if(!/^image-[A-Za-z0-9_]+-\d+x\d+-[a-z]{1,5}$/.test(r))throw new Error('Unsupported asset ID "'.concat(r,'". URL generation only works for auto-generated IDs.'));var o=n(r.split("-"),4),i=o[1],s=o[2],a=o[3];l.hasDataset(this.client.clientConfig);var c=this.client.clientConfig,f=c.projectId,p=c.dataset,h=e?u(e):"";return"https://cdn.sanity.io/images/".concat(f,"/").concat(p,"/").concat(i,"-").concat(s,".").concat(a).concat(h)}}),e.exports=f},{"../http/queryString":12,"../util/observable":20,"../validators":23,"object-assign":46}],2:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout",method:"POST"})}}),e.exports=n},{"object-assign":46}],3:[function(t,e,r){"use strict";var n=t("@sanity/generate-help-url"),o=t("object-assign"),i=t("./validators"),s=t("./warnings"),a={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,isPromiseAPI:!0},c=["localhost","127.0.0.1","0.0.0.0"];r.defaultConfig=a,r.initConfig=function(t,e){var u=o({},e,t);u.apiVersion||s.printNoApiVersionSpecifiedWarning();var l=o({},a,u),f=l.useProjectHostname;if("undefined"==typeof Promise){var p=n("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(p))}if(f&&!l.projectId)throw new Error("Configuration must contain `projectId`");var h="undefined"!=typeof window&&window.location&&window.location.hostname,d=h&&function(t){return-1!==c.indexOf(t)}(window.location.hostname);h&&d&&l.token&&!0!==l.ignoreBrowserTokenWarning?s.printBrowserTokenWarning():void 0===l.useCdn&&s.printCdnWarning(),f&&i.projectId(l.projectId),l.dataset&&i.dataset(l.dataset),"requestTagPrefix"in l&&(l.requestTagPrefix=l.requestTagPrefix?i.requestTag(l.requestTagPrefix).replace(/\.+$/,""):void 0),l.apiVersion="".concat(l.apiVersion).replace(/^v/,""),l.isDefaultApi=l.apiHost===a.apiHost,l.useCdn=Boolean(l.useCdn)&&!l.withCredentials,r.validateApiVersion(l.apiVersion);var b=l.apiHost.split("://",2),y=b[0],v=b[1],g=l.isDefaultApi?"apicdn.sanity.io":v;return l.useProjectHostname?(l.url="".concat(y,"://").concat(l.projectId,".").concat(v,"/v").concat(l.apiVersion),l.cdnUrl="".concat(y,"://").concat(l.projectId,".").concat(g,"/v").concat(l.apiVersion)):(l.url="".concat(l.apiHost,"/v").concat(l.apiVersion),l.cdnUrl=l.url),l},r.validateApiVersion=function(t){if("1"!==t&&"X"!==t){var e=new Date(t);if(!(/^\d{4}-\d{2}-\d{2}$/.test(t)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}}},{"./validators":23,"./warnings":24,"@sanity/generate-help-url":27,"object-assign":46}],4:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=t("object-assign"),a=t("../util/observable"),c=a.map,u=a.filter,l=t("../validators"),f=t("../util/getSelection"),p=t("./encodeQueryString"),h=t("./transaction"),d=t("./patch"),b=t("./listen"),y=function(t,e){return!1===t?void 0:void 0===t?e:t},v=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o({returnIds:!0,returnDocuments:y(t.returnDocuments,!0),visibility:t.visibility||"sync"},t.skipCrossDatasetReferenceValidation&&{skipCrossDatasetReferenceValidation:t.skipCrossDatasetReferenceValidation})},g=function(t){return"response"===t.type},m=function(t){return t.body},w=function(t,e){return t.reduce((function(t,r){return t[e(r)]=r,t}),Object.create(null))},_=function(t){return t.toPromise()};e.exports={listen:b,getDataUrl:function(t,e){var r=this.clientConfig,n=l.hasDataset(r),o="/".concat(t,"/").concat(n),i=e?"".concat(o,"/").concat(e):o;return"/data".concat(i).replace(/\/($|\?)/,"$1")},fetch:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=!1===r.filterResponse?function(t){return t}:function(t){return t.result},o=this._dataRequest("query",{query:t,params:e},r).pipe(c(n));return this.isPromiseAPI()?_(o):o},getDocument:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",t),json:!0,tag:e.tag},n=this._requestObservable(r).pipe(u(g),c((function(t){return t.body.documents&&t.body.documents[0]})));return this.isPromiseAPI()?_(n):n},getDocuments:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",t.join(",")),json:!0,tag:e.tag},n=this._requestObservable(r).pipe(u(g),c((function(e){var r=w(e.body.documents||[],(function(t){return t._id}));return t.map((function(t){return r[t]||null}))})));return this.isPromiseAPI()?_(n):n},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return l.requireDocumentId("createIfNotExists",t),this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return l.requireDocumentId("createOrReplace",t),this._create(t,"createOrReplace",e)},patch:function(t,e){return new d(t,e,this)},delete:function(t,e){return this.dataRequest("mutate",{mutations:[{delete:f(t)}]},e)},mutate:function(t,e){var r=t instanceof d||t instanceof h?t.serialize():t,n=Array.isArray(r)?r:[r],o=e&&e.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:o},e)},transaction:function(t){return new h(t,this)},dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._dataRequest(t,e,r);return this.isPromiseAPI()?_(n):n},_dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="mutate"===t,o="query"===t,s=!n&&p(e),a=!n&&s.length<11264,l=a?s:"",f=r.returnFirst,h=r.timeout,d=r.token,b=r.tag,y={method:a?"GET":"POST",uri:this.getDataUrl(t,l),json:!0,body:a?void 0:e,query:n&&v(r),timeout:h,token:d,tag:b,canUseCdn:o};return this._requestObservable(y).pipe(u(g),c(m),c((function(t){if(!n)return t;var e=t.results||[];if(r.returnDocuments)return f?e[0]&&e[0].document:e.map((function(t){return t.document}));var o=f?"documentId":"documentIds",s=f?e[0]&&e[0].id:e.map((function(t){return t.id}));return i({transactionId:t.transactionId,results:e},o,s)})))},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i({},e,t),o=s({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},o)}}},{"../util/getSelection":19,"../util/observable":20,"../validators":23,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"object-assign":46}],5:[function(t,e,r){"use strict";var n=["tag"];function o(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var i=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,s=void 0===r?{}:r,a=t.options,c=void 0===a?{}:a,u=c.tag,l=o(c,n),f="query=".concat(i(e)),p=u?"?tag=".concat(i(u),"&").concat(f):"?".concat(f),h=Object.keys(s).reduce((function(t,e){return"".concat(t,"&").concat(i("$".concat(e)),"=").concat(i(JSON.stringify(s[e])))}),p);return Object.keys(l).reduce((function(t,e){return c[e]?"".concat(t,"&").concat(i(e),"=").concat(i(c[e])):t}),h)}},{}],6:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=t("object-assign"),a=t("../util/observable").Observable,c=t("@sanity/eventsource"),u=t("@sanity/generate-help-url"),l=t("../util/pick"),f=t("../util/once"),p=t("../util/defaults"),h=t("./encodeQueryString"),d=["Using token with listeners is not supported in browsers. ","For more info, see ".concat(u("js-client-listener-tokens-browser"),".")],b=f((function(){return console.warn(d.join(" "))})),y=Boolean("undefined"!=typeof window&&window.EventSource),v=y?window.EventSource:c,g=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],m={includeResult:!0};function w(t){try{var e=t.data&&JSON.parse(t.data)||{};return s({type:t.type},e)}catch(t){return t}}function _(t){if(t instanceof Error)return t;var e=w(t);return e instanceof Error?e:new Error(function(t){return t.error?t.error.description?t.error.description:"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2):t.message||"Unknown listener error"}(e))}e.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.clientConfig,i=n.url,s=n.token,c=n.withCredentials,u=n.requestTagPrefix,f=r.tag&&u?[u,r.tag].join("."):r.tag,d=o(o({},p(r,m)),{},{tag:f}),O=l(d,g),E=h({query:t,params:e,options:O,tag:f}),j="".concat(i).concat(this.getDataUrl("listen",E));if(j.length>14800)return new a((function(t){return t.error(new Error("Query too large for listener"))}));var x=d.events?d.events:["mutation"],S=-1!==x.indexOf("reconnect");s&&y&&b();var P={};return(s||c)&&(P.withCredentials=!0),s&&(P.headers={Authorization:"Bearer ".concat(s)}),new a((function(t){var e,r=u(),n=!1;function o(){n||(S&&t.next({type:"reconnect"}),n||r.readyState===v.CLOSED&&(c(),clearTimeout(e),e=setTimeout(l,100)))}function i(e){t.error(_(e))}function s(e){var r=w(e);return r instanceof Error?t.error(r):t.next(r)}function a(e){n=!0,c(),t.complete()}function c(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",i,!1),r.removeEventListener("disconnect",a,!1),x.forEach((function(t){return r.removeEventListener(t,s,!1)})),r.close()}function u(){var t=new v(j,P);return t.addEventListener("error",o,!1),t.addEventListener("channelError",i,!1),t.addEventListener("disconnect",a,!1),x.forEach((function(e){return t.addEventListener(e,s,!1)})),t}function l(){r=u()}return function(){n=!0,c()}}))}},{"../util/defaults":18,"../util/observable":20,"../util/once":21,"../util/pick":22,"./encodeQueryString":5,"@sanity/eventsource":26,"@sanity/generate-help-url":27,"object-assign":46}],7:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("../util/getSelection"),s=t("../validators"),a=s.validateObject,c=s.validateInsert;function u(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.selection=t,this.operations=o({},e),this.client=r}o(u.prototype,{clone:function(){return new u(this.selection,o({},this.operations),this.client)},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return a("diffMatchPatch",t),this._assign("diffMatchPatch",t)},unset:function(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=o({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return a("replace",t),this._set("set",{$:t})},inc:function(t){return this._assign("inc",t)},dec:function(t){return this._assign("dec",t)},insert:function(t,e,r){var o;return c(t,e,r),this._assign("insert",(n(o={},t,e),n(o,"items",r),o))},append:function(t,e){return this.insert("after","".concat(t,"[-1]"),e)},prepend:function(t,e){return this.insert("before","".concat(t,"[0]"),e)},splice:function(t,e,r,n){var o=e<0?e-1:e,i=void 0===r||-1===r?-1:Math.max(0,e+r),s=o<0&&i>=0?"":i,a="".concat(t,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,n||[])},ifRevisionId:function(t){return this.operations.ifRevisionID=t,this},serialize:function(){return o(i(this.selection),this.operations)},toJSON:function(){return this.serialize()},commit:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.client)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");var e="string"==typeof this.selection,r=o({returnFirst:e,returnDocuments:!0},t);return this.client.mutate({patch:this.serialize()},r)},reset:function(){return this.operations={},this},_set:function(t,e){return this._assign(t,e,!1)},_assign:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a(t,e),this.operations=o({},this.operations,n({},t,o({},r&&this.operations[t]||{},e))),this}}),e.exports=u},{"../util/getSelection":19,"../validators":23,"object-assign":46}],8:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("../validators"),s=t("./patch"),a={returnDocuments:!1};function c(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;this.trxId=r,this.operations=t,this.client=e}o(c.prototype,{clone:function(){return new c(this.operations.slice(0),this.client,this.trxId)},create:function(t){return i.validateObject("create",t),this._add({create:t})},createIfNotExists:function(t){var e="createIfNotExists";return i.validateObject(e,t),i.requireDocumentId(e,t),this._add(n({},e,t))},createOrReplace:function(t){var e="createOrReplace";return i.validateObject(e,t),i.requireDocumentId(e,t),this._add(n({},e,t))},delete:function(t){return i.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function(t,e){var r="function"==typeof e;if(t instanceof s)return this._add({patch:t.serialize()});if(r){var n=e(new s(t,{},this.client));if(!(n instanceof s))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:o({id:t},e)})},transactionId:function(t){return t?(this.trxId=t,this):this.trxId},serialize:function(){return this.operations.slice()},toJSON:function(){return this.serialize()},commit:function(t){if(!this.client)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.client.mutate(this.serialize(),o({transactionId:this.trxId},a,t||{}))},reset:function(){return this.operations=[],this},_add:function(t){return this.operations.push(t),this}}),e.exports=c},{"../validators":23,"./patch":7,"object-assign":46}],9:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("../validators");function i(t){this.request=t.request.bind(t)}n(i.prototype,{create:function(t,e){return this._modify("PUT",t,e)},edit:function(t,e){return this._modify("PATCH",t,e)},delete:function(t){return this._modify("DELETE",t)},list:function(){return this.request({uri:"/datasets"})},_modify:function(t,e,r){return o.dataset(e),this.request({method:t,uri:"/datasets/".concat(e),body:r})}}),e.exports=i},{"../validators":23,"object-assign":46}],10:[function(t,e,r){"use strict";e.exports=[]},{}],11:[function(t,e,r){"use strict";var n=t("make-error"),o=t("object-assign");function i(t){var e=a(t);i.super.call(this,e.message),o(this,e)}function s(t){var e=a(t);s.super.call(this,e.message),o(this,e)}function a(t){var e=t.body,r={response:t,statusCode:t.statusCode,responseBody:c(e,t)};return e.error&&e.message?(r.message="".concat(e.error," - ").concat(e.message),r):e.error&&e.error.description?(r.message=e.error.description,r.details=e.error,r):(r.message=e.error||e.message||function(t){var e=t.statusMessage?" ".concat(t.statusMessage):"";return"".concat(t.method,"-request to ").concat(t.url," resulted in HTTP ").concat(t.statusCode).concat(e)}(t),r)}function c(t,e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t}n(i),n(s),r.ClientError=i,r.ServerError=s},{"make-error":44,"object-assign":46}],12:[function(t,e,r){"use strict";e.exports=function(t){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(t[r])));return e.length>0?"?".concat(e.join("&")):""}},{}],13:[function(t,e,r){"use strict";var n=t("get-it"),o=t("object-assign"),i=t("get-it/lib/middleware/observable"),s=t("get-it/lib/middleware/jsonRequest"),a=t("get-it/lib/middleware/jsonResponse"),c=t("get-it/lib/middleware/progress"),u=t("../util/observable").Observable,l=t("./errors"),f=l.ClientError,p=l.ServerError,h={onResponse:function(t){if(t.statusCode>=500)throw new p(t);if(t.statusCode>=400)throw new f(t);return t}},d={onResponse:function(t){var e=t.headers["x-sanity-warning"];return(Array.isArray(e)?e:[e]).filter(Boolean).forEach((function(t){return console.warn(t)})),t}},b=n(t("./nodeMiddleware").concat([d,s(),a(),c(),h,i({implementation:u})]));function y(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:b)(o({maxRedirects:0},t))}y.defaultRequester=b,y.ClientError=f,y.ServerError=p,e.exports=y},{"../util/observable":20,"./errors":11,"./nodeMiddleware":10,"get-it":28,"get-it/lib/middleware/jsonRequest":32,"get-it/lib/middleware/jsonResponse":33,"get-it/lib/middleware/observable":34,"get-it/lib/middleware/progress":36,"object-assign":46}],14:[function(t,e,r){"use strict";var n=t("object-assign"),o="X-Sanity-Project-ID";e.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=e.token||t.token;i&&(r.Authorization="Bearer ".concat(i)),e.useGlobalApi||t.useProjectHostname||!t.projectId||(r[o]=t.projectId);var s=Boolean(void 0===e.withCredentials?t.token||t.withCredentials:e.withCredentials),a=void 0===e.timeout?t.timeout:e.timeout;return n({},e,{headers:n({},r,e.headers||{}),timeout:void 0===a?3e5:a,proxy:e.proxy||t.proxy,json:!0,withCredentials:s})}},{"object-assign":46}],15:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/".concat(t)})}}),e.exports=n},{"object-assign":46}],16:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=t("object-assign"),s=t("./util/observable"),a=s.Observable,c=s.map,u=s.filter,l=t("./data/patch"),f=t("./data/transaction"),p=t("./data/dataMethods"),h=t("./datasets/datasetsClient"),d=t("./projects/projectsClient"),b=t("./assets/assetsClient"),y=t("./users/usersClient"),v=t("./auth/authClient"),g=t("./http/request"),m=t("./http/requestOptions"),w=t("./config"),_=w.defaultConfig,O=w.initConfig,E=t("./validators");function j(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_;if(!(this instanceof j))return new j(t);if(this.config(t),this.assets=new b(this),this.datasets=new h(this),this.projects=new d(this),this.users=new y(this),this.auth=new v(this),this.clientConfig.isPromiseAPI){var e=i({},this.clientConfig,{isPromiseAPI:!1});this.observable=new j(e)}}i(j.prototype,p),i(j.prototype,{clone:function(){return new j(this.config())},config:function(t){if(void 0===t)return i({},this.clientConfig);if(this.observable){var e=i({},t,{isPromiseAPI:!1});this.observable.config(e)}return this.clientConfig=O(t,this.clientConfig||{}),this},withConfig:function(t){return this.clone().config(t)},getUrl:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.clientConfig.cdnUrl:this.clientConfig.url;return"".concat(e,"/").concat(t.replace(/^\//,""))},isPromiseAPI:function(){return this.clientConfig.isPromiseAPI},_requestObservable:function(t){var e=this,r=t.url||t.uri,s=void 0===t.canUseCdn?["GET","HEAD"].indexOf(t.method||"GET")>=0&&0===r.indexOf("/data/"):t.canUseCdn,c=this.clientConfig.useCdn&&s,u=t.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,t.tag].join("."):t.tag||this.clientConfig.requestTagPrefix;u&&(t.query=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({tag:E.requestTag(u)},t.query));var l=m(this.clientConfig,i({},t,{url:this.getUrl(r,c)}));return new a((function(t){return g(l,e.clientConfig.requester).subscribe(t)}))},request:function(t){var e=this._requestObservable(t).pipe(u((function(t){return"response"===t.type})),c((function(t){return t.body})));return this.isPromiseAPI()?function(t){return t.toPromise()}(e):e}}),j.Patch=l,j.Transaction=f,j.ClientError=g.ClientError,j.ServerError=g.ServerError,j.requester=g.defaultRequester,e.exports=j},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":13,"./http/requestOptions":14,"./projects/projectsClient":15,"./users/usersClient":17,"./util/observable":20,"./validators":23,"object-assign":46}],17:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getById:function(t){return this.client.request({uri:"/users/".concat(t)})}}),e.exports=n},{"object-assign":46}],18:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(e).concat(Object.keys(t)).reduce((function(r,n){return r[n]=void 0===t[n]?e[n]:t[n],r}),{})}},{}],19:[function(t,e,r){"use strict";e.exports=function(t){if("string"==typeof t||Array.isArray(t))return{id:t};if(t&&t.query)return"params"in t?{query:t.query,params:t.params}:{query:t.query};var e=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(e))}},{}],20:[function(t,e,r){"use strict";var n=t("rxjs/internal/Observable").Observable,o=t("rxjs/internal/operators/filter").filter,i=t("rxjs/internal/operators/map").map;e.exports={Observable:n,filter:o,map:i}},{"rxjs/internal/Observable":50,"rxjs/internal/operators/filter":55,"rxjs/internal/operators/map":56}],21:[function(t,e,r){"use strict";e.exports=function(t){var e,r=!1;return function(){return r||(e=t.apply(void 0,arguments),r=!0),e}}},{}],22:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce((function(e,r){return void 0===t[r]||(e[r]=t[r]),e}),{})}},{}],23:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=["image","file"],i=["before","after","replace"];r.dataset=function(t){if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},r.projectId=function(t){if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")},r.validateAssetType=function(t){if(-1===o.indexOf(t))throw new Error("Invalid asset type: ".concat(t,". Must be one of ").concat(o.join(", ")))},r.validateObject=function(t,e){if(null===e||"object"!==n(e)||Array.isArray(e))throw new Error("".concat(t,"() takes an object of properties"))},r.requireDocumentId=function(t,e){if(!e._id)throw new Error("".concat(t,'() requires that the document contains an ID ("_id" property)'));r.validateDocumentId(t,e._id)},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[a-z0-9_.-]+$/i.test(e))throw new Error("".concat(t,'(): "').concat(e,'" is not a valid document ID'))},r.validateInsert=function(t,e,r){var n="insert(at, selector, items)";if(-1===i.indexOf(t)){var o=i.map((function(t){return'"'.concat(t,'"')})).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(o))}if("string"!=typeof e)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))},r.hasDataset=function(t){if(!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},r.requestTag=function(t){if("string"!=typeof t||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t}},{}],24:[function(t,e,r){"use strict";var n=t("@sanity/generate-help-url"),o=t("./util/once"),i=function(t){return o((function(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=console).warn.apply(e,[t.join(" ")].concat(n))}))};r.printCdnWarning=i(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat(n("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),r.printBrowserTokenWarning=i(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(n("js-client-browser-token")," for more information and how to hide this warning.")]),r.printNoApiVersionSpecifiedWarning=i(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(n("js-client-api-version"))])},{"./util/once":21,"@sanity/generate-help-url":27}],25:[function(t,e,r){(function(t){(function(){!function(r,n){if("object"==typeof e&&e.exports)e.exports=n();else{if(t.EventSource&&!t._eventSourceImportPrefix)return;r[(r._eventSourceImportPrefix||"")+"EventSource"]=n()}}("undefined"==typeof self?this:self,(function(){var t=function(t,e){if(!t||"string"!=typeof t)throw new SyntaxError("Not enough arguments");this.URL=t,this.setOptions(e);var r=this;setTimeout((function(){r.poll()}),0)};if(t.prototype={CONNECTING:0,OPEN:1,CLOSED:2,defaultOptions:{loggingEnabled:!1,loggingPrefix:"eventsource",interval:500,bufferSizeLimit:262144,silentTimeout:3e5,getArgs:{evs_buffer_size_limit:262144},xhrHeaders:{Accept:"text/event-stream","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}},setOptions:function(t){var e,r=this.defaultOptions;for(e in r)r.hasOwnProperty(e)&&(this[e]=r[e]);for(e in t)e in r&&t.hasOwnProperty(e)&&(this[e]=t[e]);this.getArgs&&this.bufferSizeLimit&&(this.getArgs.evs_buffer_size_limit=this.bufferSizeLimit),"undefined"!=typeof console&&void 0!==console.log||(this.loggingEnabled=!1)},log:function(t){this.loggingEnabled&&console.log("["+this.loggingPrefix+"]:"+t)},poll:function(){try{if(this.readyState==this.CLOSED)return;this.cleanup(),this.readyState=this.CONNECTING,this.cursor=0,this.cache="",this._xhr=new this.XHR(this),this.resetNoActivityTimer()}catch(t){this.log("There were errors inside the pool try-catch"),this.dispatchEvent("error",{type:"error",data:t.message})}},pollAgain:function(t){var e=this;e.readyState=e.CONNECTING,e.dispatchEvent("error",{type:"error",data:"Reconnecting "}),this._pollTimer=setTimeout((function(){e.poll()}),t||0)},cleanup:function(){this.log("evs cleaning up"),this._pollTimer&&(clearInterval(this._pollTimer),this._pollTimer=null),this._noActivityTimer&&(clearInterval(this._noActivityTimer),this._noActivityTimer=null),this._xhr&&(this._xhr.abort(),this._xhr=null)},resetNoActivityTimer:function(){if(this.silentTimeout){this._noActivityTimer&&clearInterval(this._noActivityTimer);var t=this;this._noActivityTimer=setTimeout((function(){t.log("Timeout! silentTImeout:"+t.silentTimeout),t.pollAgain()}),this.silentTimeout)}},close:function(){this.readyState=this.CLOSED,this.log("Closing connection. readyState: "+this.readyState),this.cleanup()},_onxhrdata:function(){var t=this._xhr;if(t.isReady()&&!t.hasError()){this.resetNoActivityTimer(),this.readyState==this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent("open",{type:"open"}));var e=t.getBuffer();e.length>this.bufferSizeLimit&&(this.log("buffer.length > this.bufferSizeLimit"),this.pollAgain()),0==this.cursor&&e.length>0&&"\ufeff"==e.substring(0,1)&&(this.cursor=1);var r=this.lastMessageIndex(e);if(r[0]>=this.cursor){var n=r[1],o=e.substring(this.cursor,n);this.parseStream(o),this.cursor=n}t.isDone()&&(this.log("request.isDone(). reopening the connection"),this.pollAgain(this.interval))}else this.readyState!==this.CLOSED&&(this.log("this.readyState !== this.CLOSED"),this.pollAgain(this.interval))},parseStream:function(t){var e,n,o,i,s,a,c=(t=this.cache+this.normalizeToLF(t)).split("\n\n");for(e=0;e<c.length-1;e++){o="message",i=[];var u=c[e].split("\n");for(n=0;n<u.length;n++)0==(s=this.trimWhiteSpace(u[n])).indexOf("event")?o=s.replace(/event:?\s*/,""):0==s.indexOf("retry")?(a=parseInt(s.replace(/retry:?\s*/,""),10),isNaN(a)||(this.interval=a)):0==s.indexOf("data")?i.push(s.replace(/data:?\s*/,"")):0==s.indexOf("id:")?this.lastEventId=s.replace(/id:?\s*/,""):0==s.indexOf("id")&&(this.lastEventId=null);if(i.length&&this.readyState!=this.CLOSED){var l=new r(o,i.join("\n"),"undefined"!=typeof window&&void 0!==window.location?window.location.origin:null,this.lastEventId);this.dispatchEvent(o,l)}}this.cache=c[c.length-1]},dispatchEvent:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=0;n<r.length;n++)r[n].call(this,e);this["on"+t]&&this["on"+t].call(this,e)},addEventListener:function(t,e){this["_"+t+"Handlers"]||(this["_"+t+"Handlers"]=[]),this["_"+t+"Handlers"].push(e)},removeEventListener:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=r.length-1;n>=0;--n)if(r[n]===e){r.splice(n,1);break}},_pollTimer:null,_noactivityTimer:null,_xhr:null,lastEventId:null,cache:"",cursor:0,onerror:null,onmessage:null,onopen:null,readyState:0,urlWithParams:function(t,e){var r=[];if(e){var n,o,i=encodeURIComponent;for(n in e)e.hasOwnProperty(n)&&(o=i(n)+"="+i(e[n]),r.push(o))}return r.length>0?-1==t.indexOf("?")?t+"?"+r.join("&"):t+"&"+r.join("&"):t},lastMessageIndex:function(t){var e=t.lastIndexOf("\n\n"),r=t.lastIndexOf("\r\r"),n=t.lastIndexOf("\r\n\r\n");return n>Math.max(e,r)?[n,n+4]:[Math.max(e,r),Math.max(e,r)+2]},trimWhiteSpace:function(t){return t.replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},Boolean("undefined"!=typeof window&&window.XDomainRequest&&window.XMLHttpRequest&&void 0===(new XMLHttpRequest).responseType)){t.isPolyfill="IE_8-9";var e=t.prototype.defaultOptions;e.xhrHeaders=null,e.getArgs.evs_preamble=2056,t.prototype.XHR=function(t){var e=new XDomainRequest;this._request=e,e.onprogress=function(){e._ready=!0,t._onxhrdata()},e.onload=function(){this._loaded=!0,t._onxhrdata()},e.onerror=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest error"})},e.ontimeout=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest timed out"})};var r={};if(t.getArgs){var n=t.getArgs;for(var o in n)n.hasOwnProperty(o)&&(r[o]=n[o]);t.lastEventId&&(r.evs_last_event_id=t.lastEventId)}e.open("GET",t.urlWithParams(t.URL,r)),e.send()},t.prototype.XHR.prototype={useXDomainRequest:!0,_request:null,_ready:!1,_loaded:!1,_failed:!1,isReady:function(){return this._request._ready},isDone:function(){return this._request._loaded},hasError:function(){return this._request._failed},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}}}else t.isPolyfill="XHR",t.prototype.XHR=function(t){var e=new XMLHttpRequest;this._request=e,t._xhr=this,e.onreadystatechange=function(){e.readyState>1&&t.readyState!=t.CLOSED&&(200==e.status||e.status>=300&&e.status<400?t._onxhrdata():(e._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"The server responded with "+e.status}),t.close()))},e.onprogress=function(){},e.open("GET",t.urlWithParams(t.URL,t.getArgs),!0);var r=t.xhrHeaders;for(var n in r)r.hasOwnProperty(n)&&e.setRequestHeader(n,r[n]);t.lastEventId&&e.setRequestHeader("Last-Event-Id",t.lastEventId),e.send()},t.prototype.XHR.prototype={useXDomainRequest:!1,_request:null,_failed:!1,isReady:function(){return this._request.readyState>=2},isDone:function(){return 4==this._request.readyState},hasError:function(){return this._failed||this._request.status>=400},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}};function r(t,e,r,n){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.data=e||null,this.origin=r||"",this.lastEventId=n||"",this.type=t||"message"}return t}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],26:[function(t,e,r){var n=t("@rexxars/eventsource-polyfill");e.exports="undefined"!=typeof window&&window.EventSource?window.EventSource:n.EventSource},{"@rexxars/eventsource-polyfill":25}],27:[function(t,e,r){e.exports=function(t){return"https://docs.sanity.io/help/"+t}},{}],28:[function(t,e,r){e.exports=t("./lib-node")},{"./lib-node":29}],29:[function(t,e,r){"use strict";var n=t("nano-pubsub"),o=t("./util/middlewareReducer"),i=t("./middleware/defaultOptionsProcessor"),s=t("./middleware/defaultOptionsValidator"),a=t("./request"),c=["request","response","progress","error","abort"],u=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,l=[],f=u.reduce((function(t,e){return t[e]=t[e]||[],t}),{processOptions:[i],validateOptions:[s]});function p(t){var e=c.reduce((function(t,e){return t[e]=n(),t}),{}),i=o(f),s=i("processOptions",t);i("validateOptions",s);var a={options:s,channels:e,applyMiddleware:i},u=null,l=e.request.subscribe((function(t){u=r(t,(function(r,n){return function(t,r,n){var o=t,s=r;if(!o)try{s=i("onResponse",r,n)}catch(t){s=null,o=t}(o=o&&i("onError",o,n))?e.error.publish(o):s&&e.response.publish(s)}(r,n,t)}))}));e.abort.subscribe((function(){l(),u&&u.abort()}));var p=i("onReturn",e,a);return p===e&&e.request.publish(a),p}return p.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.onReturn&&f.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 u.forEach((function(e){t[e]&&f[e].push(t[e])})),l.push(t),p},p.clone=function(){return t(l)},e.forEach(p.use),p}},{"./middleware/defaultOptionsProcessor":30,"./middleware/defaultOptionsValidator":31,"./request":39,"./util/middlewareReducer":41,"nano-pubsub":45}],30:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("url-parse"),i="undefined"!=typeof navigator&&"ReactNative"===navigator.product,s=Object.prototype.hasOwnProperty,a={timeout:i?6e4:12e4};function c(t){var e=[];for(var r in t)s.call(t,r)&&n(r,t[r]);return e.length?e.join("&"):"";function n(t,r){Array.isArray(r)?r.forEach((function(e){return n(t,e)})):e.push([t,r].map(encodeURIComponent).join("="))}}function u(t){if(!1===t||0===t)return!1;if(t.connect||t.socket)return t;var e=Number(t);return isNaN(e)?u(a.timeout):{connect:e,socket:e}}e.exports=function(t){var e="string"==typeof t?n({url:t},a):n({},a,t),r=o(e.url,{},!0);return e.timeout=u(e.timeout),e.query&&(r.query=n({},r.query,function(t){var e={};for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}(e.query))),e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e.url=r.toString(c),e}},{"object-assign":46,"url-parse":70}],31:[function(t,e,r){"use strict";var n=/^https?:\/\//i;e.exports=function(t){if(!n.test(t.url))throw new Error('"'.concat(t.url,'" is not a valid URL'))}},{}],32:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=t("object-assign"),i=t("is-plain-object"),s=["boolean","string","number"];e.exports=function(){return{processOptions:function(t){var e=t.body;return e&&"function"!=typeof e.pipe&&!function(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}(e)&&(-1!==s.indexOf(n(e))||Array.isArray(e)||i(e))?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":42,"object-assign":46}],33:[function(t,e,r){"use strict";var n=t("object-assign");function o(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: ".concat(t.message),t}}e.exports=function(t){return{onResponse:function(e){var r=e.headers["content-type"]||"",i=t&&t.force||-1!==r.indexOf("application/json");return e.body&&r&&i?n({},e,{body:o(e.body)}):e},processOptions:function(t){return n({},t,{headers:n({Accept:"application/json"},t.headers)})}}}},{"object-assign":46}],34:[function(t,e,r){"use strict";var n=t("../util/global"),o=t("object-assign");e.exports=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||n.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(e,r){return new t((function(t){return e.error.subscribe((function(e){return t.error(e)})),e.progress.subscribe((function(e){return t.next(o({type:"progress"},e))})),e.response.subscribe((function(e){t.next(o({type:"response"},e)),t.complete()})),e.request.publish(r),function(){return e.abort.publish()}}))}}}},{"../util/global":40,"object-assign":46}],35:[function(t,e,r){"use strict";e.exports=function(){return{onRequest:function(t){if("xhr"===t.adapter){var e=t.request,r=t.context;"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=n("upload")),"onprogress"in e&&(e.onprogress=n("download"))}function n(t){return function(e){var n=e.lengthComputable?e.loaded/e.total*100:-1;r.channels.progress.publish({stage:t,percent:n,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}}}}},{}],36:[function(t,e,r){"use strict";e.exports=t("./node-progress")},{"./node-progress":35}],37:[function(t,e,r){"use strict";var n=t("same-origin"),o=t("parse-headers"),i=t("./browser/fetchXhr"),s="undefined"==typeof window?void 0:window,a=s?"xhr":"fetch",c="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){},u="withCredentials"in new c,l="undefined"==typeof XDomainRequest?void 0:XDomainRequest,f=u?c:l;s||(c=i,f=i),e.exports=function(t,e){var r=t.options,i=t.applyMiddleware("finalizeOptions",r),u={},l=s&&s.location&&!n(s.location.href,i.url),p=t.applyMiddleware("interceptRequest",void 0,{adapter:a,context:t});if(p){var h=setTimeout(e,0,null,p);return{abort:function(){return clearTimeout(h)}}}var d=l?new f:new c,b=s&&s.XDomainRequest&&d instanceof s.XDomainRequest,y=i.headers,v=i.timeout,g=!1,m=!1,w=!1;if(d.onerror=j,d.ontimeout=j,d.onabort=function(){E(!0),g=!0},d.onprogress=function(){},d[b?"onload":"onreadystatechange"]=function(){v&&(E(),u.socket=setTimeout((function(){return O("ESOCKETTIMEDOUT")}),v.socket)),g||4!==d.readyState&&!b||0!==d.status&&(g||m||w||(0!==d.status?(E(),m=!0,e(null,function(){var t=d.status,e=d.statusText;if(b&&void 0===t)t=200;else{if(t>12e3&&t<12156)return j();t=1223===d.status?204:d.status,e=1223===d.status?"No Content":e}return{body:d.response||d.responseText,url:i.url,method:i.method,headers:b?{}:o(d.getAllResponseHeaders()),statusCode:t,statusMessage:e}}())):j(new Error("Unknown XHR error"))))},d.open(i.method,i.url,!0),d.withCredentials=!!i.withCredentials,y&&d.setRequestHeader)for(var _ in y)y.hasOwnProperty(_)&&d.setRequestHeader(_,y[_]);else if(y&&b)throw new Error("Headers cannot be set on an XDomainRequest object");return i.rawBody&&(d.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:i,adapter:a,request:d,context:t}),d.send(i.body||null),v&&(u.connect=setTimeout((function(){return O("ETIMEDOUT")}),v.connect)),{abort:function(){g=!0,d&&d.abort()}};function O(e){w=!0,d.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to ".concat(i.url):"Connection timed out on request to ".concat(i.url));r.code=e,t.channels.error.publish(r)}function E(t){(t||g||d.readyState>=2&&u.connect)&&clearTimeout(u.connect),u.socket&&clearTimeout(u.socket)}function j(t){if(!m){E(!0),m=!0,d=null;var r=t||new Error("Network error while attempting to reach ".concat(i.url));r.isNetworkError=!0,r.request=i,e(r)}}}},{"./browser/fetchXhr":38,"parse-headers":47,"same-origin":68}],38:[function(t,e,r){"use strict";function n(){this.readyState=0}n.prototype.open=function(t,e){this._method=t,this._url=e,this._resHeaders="",this.readyState=1,this.onreadystatechange()},n.prototype.abort=function(){this._controller&&this._controller.abort()},n.prototype.getAllResponseHeaders=function(){return this._resHeaders},n.prototype.setRequestHeader=function(t,e){this._headers=this._headers||{},this._headers[t]=e},n.prototype.send=function(t){var e=this,r=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,o={method:this._method,headers:this._headers,signal:r&&r.signal,body:t};"undefined"!=typeof window&&(o.credentials=this.withCredentials?"include":"omit"),fetch(this._url,o).then((function(t){return t.headers.forEach((function(t,r){e._resHeaders+="".concat(r,": ").concat(t,"\r\n")})),e.status=t.status,e.statusText=t.statusText,e.readyState=3,n?t.text():t.arrayBuffer()})).then((function(t){n?e.responseText=t:e.response=t,e.readyState=4,e.onreadystatechange()})).catch((function(t){"AbortError"!==t.name?e.onerror(t):e.onabort()}))},e.exports=n},{}],39:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":37}],40:[function(t,e,r){(function(t){(function(){"use strict";"undefined"!=typeof window?e.exports=window:void 0!==t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],41:[function(t,e,r){"use strict";e.exports=function(t){return function(e,r){for(var n="onError"===e,o=r,i=arguments.length,s=new Array(i>2?i-2:0),a=2;a<i;a++)s[a-2]=arguments[a];for(var c=0;c<t[e].length&&(o=t[e][c].apply(void 0,[o].concat(s)),!n||o);c++);return o}}},{}],42:[function(t,e,r){"use strict";var n=t("isobject");function o(t){return!0===n(t)&&"[object Object]"===Object.prototype.toString.call(t)}e.exports=function(t){var e,r;return!1!==o(t)&&"function"==typeof(e=t.constructor)&&!1!==o(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")}},{isobject:43}],43:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}},{}],44:[function(t,e,r){"use strict";var n="undefined"!=typeof Reflect?Reflect.construct:void 0,o=Object.defineProperty,i=Error.captureStackTrace;function s(t){void 0!==t&&o(this,"message",{configurable:!0,value:t,writable:!0});var e=this.constructor.name;void 0!==e&&e!==this.name&&o(this,"name",{configurable:!0,value:e,writable:!0}),i(this,this.constructor)}void 0===i&&(i=function(t){var e=new Error;o(t,"stack",{configurable:!0,get:function(){var t=e.stack;return o(this,"stack",{configurable:!0,value:t,writable:!0}),t},set:function(e){o(t,"stack",{configurable:!0,value:e,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var a=function(){function t(t,e){return o(t,"name",{configurable:!0,value:e})}try{var e=function(){};if(t(e,"foo"),"foo"===e.name)return t}catch(t){}}();r=e.exports=function(t,e){if(null==e||e===Error)e=s;else if("function"!=typeof e)throw new TypeError("super_ should be a function");var r;if("string"==typeof t)r=t,t=void 0!==n?function(){return n(e,arguments,this.constructor)}:function(){e.apply(this,arguments)},void 0!==a&&(a(t,r),r=void 0);else if("function"!=typeof t)throw new TypeError("constructor should be either a string or a function");t.super_=t.super=e;var o={constructor:{configurable:!0,value:t,writable:!0}};return void 0!==r&&(o.name={configurable:!0,value:r,writable:!0}),t.prototype=Object.create(e.prototype,o),t},r.BaseError=s},{}],45:[function(t,e,r){e.exports=function(){var t=[];return{subscribe:function(e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}},publish:function(){for(var e=0;e<t.length;e++)t[e].apply(null,arguments)}}}},{}],46:[function(t,e,r){"use strict";var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,c=s(t),u=1;u<arguments.length;u++){for(var l in r=Object(arguments[u]))o.call(r,l)&&(c[l]=r[l]);if(n){a=n(r);for(var f=0;f<a.length;f++)i.call(r,a[f])&&(c[a[f]]=r[a[f]])}}return c}},{}],47:[function(t,e,r){var n=function(t){return t.replace(/^\s+|\s+$/g,"")},o=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};for(var e={},r=n(t).split("\n"),i=0;i<r.length;i++){var s=r[i],a=s.indexOf(":"),c=n(s.slice(0,a)).toLowerCase(),u=n(s.slice(a+1));void 0===e[c]?e[c]=u:o(e[c])?e[c].push(u):e[c]=[e[c],u]}return e}},{}],48:[function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty;function o(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}function i(t){try{return encodeURIComponent(t)}catch(t){return null}}r.stringify=function(t,e){e=e||"";var r,o,s=[];for(o in"string"!=typeof e&&(e="?"),t)if(n.call(t,o)){if((r=t[o])||null!=r&&!isNaN(r)||(r=""),o=i(o),r=i(r),null===o||null===r)continue;s.push(o+"="+r)}return s.length?e+s.join("&"):""},r.parse=function(t){for(var e,r=/([^=?#&]+)=?([^&]*)/g,n={};e=r.exec(t);){var i=o(e[1]),s=o(e[2]);null===i||null===s||i in n||(n[i]=s)}return n}},{}],49:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],50:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./util/canReportError"),o=t("./util/toSubscriber"),i=t("./symbol/observable"),s=t("./util/pipe"),a=t("./config"),c=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=o.toSubscriber(t,e,r);if(n?i.add(n.call(i,this.source)):i.add(this.source||a.config.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),a.config.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),n.canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=u(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[i.observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:s.pipeFromArray(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=u(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function u(t){if(t||(t=a.config.Promise||Promise),!t)throw new Error("no Promise impl found");return t}r.Observable=c},{"./config":54,"./symbol/observable":57,"./util/canReportError":60,"./util/pipe":66,"./util/toSubscriber":67}],51:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./config"),o=t("./util/hostReportError");r.empty={closed:!0,next:function(t){},error:function(t){if(n.config.useDeprecatedSynchronousErrorHandling)throw t;o.hostReportError(t)},complete:function(){}}},{"./config":54,"./util/hostReportError":61}],52:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("./util/isFunction"),s=t("./Observer"),a=t("./Subscription"),c=t("../internal/symbol/rxSubscriber"),u=t("./config"),l=t("./util/hostReportError"),f=function(t){function e(r,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=s.empty;break;case 1:if(!r){i.destination=s.empty;break}if("object"==typeof r){r instanceof e?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new p(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new p(i,r,n,o)}return i}return o(e,t),e.prototype[c.rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(a.Subscription);r.Subscriber=f;var p=function(t){function e(e,r,n,o){var a,c=t.call(this)||this;c._parentSubscriber=e;var u=c;return i.isFunction(r)?a=r:r&&(a=r.next,n=r.error,o=r.complete,r!==s.empty&&(u=Object.create(r),i.isFunction(u.unsubscribe)&&c.add(u.unsubscribe.bind(u)),u.unsubscribe=c.unsubscribe.bind(c))),c._context=u,c._next=a,c._error=n,c._complete=o,c}return o(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;u.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=u.config.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):l.hostReportError(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;l.hostReportError(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};u.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),u.config.useDeprecatedSynchronousErrorHandling)throw t;l.hostReportError(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!u.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return u.config.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(l.hostReportError(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(f);r.SafeSubscriber=p},{"../internal/symbol/rxSubscriber":58,"./Observer":51,"./Subscription":53,"./config":54,"./util/hostReportError":61,"./util/isFunction":64}],53:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./util/isArray"),o=t("./util/isObject"),i=t("./util/isFunction"),s=t("./util/UnsubscriptionError"),a=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var r=this._parentOrParents,a=this._ctorUnsubscribe,u=this._unsubscribe,l=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof t)r.remove(this);else if(null!==r)for(var f=0;f<r.length;++f)r[f].remove(this);if(i.isFunction(u)){a&&(this._unsubscribe=void 0);try{u.call(this)}catch(t){e=t instanceof s.UnsubscriptionError?c(t.errors):[t]}}if(n.isArray(l)){f=-1;for(var p=l.length;++f<p;){var h=l[f];if(o.isObject(h))try{h.unsubscribe()}catch(t){e=e||[],t instanceof s.UnsubscriptionError?e=e.concat(c(t.errors)):e.push(t)}}}if(e)throw new s.UnsubscriptionError(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function c(t){return t.reduce((function(t,e){return t.concat(e instanceof s.UnsubscriptionError?e.errors:e)}),[])}r.Subscription=a},{"./util/UnsubscriptionError":59,"./util/isArray":63,"./util/isFunction":64,"./util/isObject":65}],54:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=!1;r.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else n&&console.log("RxJS: Back to a better error behavior. Thank you. <3");n=t},get useDeprecatedSynchronousErrorHandling(){return n}}},{}],55:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.filter=function(t,e){return function(r){return r.lift(new s(t,e))}};var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.predicate=r,o.thisArg=n,o.count=0,o}return o(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":52}],56:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.map=function(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new s(t,e))}};var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.thisArg))},t}();r.MapOperator=s;var a=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":52}],57:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},{}],58:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.rxSubscriber="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),r.$$rxSubscriber=r.rxSubscriber},{}],59:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}();r.UnsubscriptionError=n},{}],60:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Subscriber");r.canReportError=function(t){for(;t;){var e=t,r=e.closed,o=e.destination,i=e.isStopped;if(r||i)return!1;t=o&&o instanceof n.Subscriber?o:null}return!0}},{"../Subscriber":52}],61:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hostReportError=function(t){setTimeout((function(){throw t}),0)}},{}],62:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.identity=function(t){return t}},{}],63:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],64:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFunction=function(t){return"function"==typeof t}},{}],65:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isObject=function(t){return null!==t&&"object"==typeof t}},{}],66:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./identity");function o(t){return 0===t.length?n.identity:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}r.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(t)},r.pipeFromArray=o},{"./identity":62}],67:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Subscriber"),o=t("../symbol/rxSubscriber"),i=t("../Observer");r.toSubscriber=function(t,e,r){if(t){if(t instanceof n.Subscriber)return t;if(t[o.rxSubscriber])return t[o.rxSubscriber]()}return t||e||r?new n.Subscriber(t,e,r):new n.Subscriber(i.empty)}},{"../Observer":51,"../Subscriber":52,"../symbol/rxSubscriber":58}],68:[function(t,e,r){"use strict";var n=t("url");e.exports=function(t,e,r){if(t===e)return!0;var o=n.parse(t,!1,!0),i=n.parse(e,!1,!0),s=0|o.port||("https"===o.protocol?443:80),a=0|i.port||("https"===i.protocol?443:80),c={proto:o.protocol===i.protocol,hostname:o.hostname===i.hostname,port:s===a};return c.proto&&c.hostname&&(c.port||r)}},{url:69}],69:[function(t,e,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;e.exports={regex:n,parse:function(t){var e=n.exec(t);return e?{protocol:(e[1]||"").toLowerCase()||void 0,hostname:(e[5]||"").toLowerCase()||void 0,port:e[6]||void 0}:{}}}},{}],70:[function(t,e,r){(function(r){(function(){"use strict";var n=t("requires-port"),o=t("querystringify"),i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,s=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,a=/^[a-zA-Z]:/,c=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function u(t){return(t||"").toString().replace(c,"")}var l=[["#","hash"],["?","query"],function(t,e){return h(e.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],f={hash:1,query:1};function p(t){var e,n=("undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:{}).location||{},o={},s=typeof(t=t||n);if("blob:"===t.protocol)o=new b(unescape(t.pathname),{});else if("string"===s)for(e in o=new b(t,{}),f)delete o[e];else if("object"===s){for(e in t)e in f||(o[e]=t[e]);void 0===o.slashes&&(o.slashes=i.test(t.href))}return o}function h(t){return"file:"===t||"ftp:"===t||"http:"===t||"https:"===t||"ws:"===t||"wss:"===t}function d(t,e){t=u(t),e=e||{};var r,n=s.exec(t),o=n[1]?n[1].toLowerCase():"",i=!!n[2],a=!!n[3],c=0;return i?a?(r=n[2]+n[3]+n[4],c=n[2].length+n[3].length):(r=n[2]+n[4],c=n[2].length):a?(r=n[3]+n[4],c=n[3].length):r=n[4],"file:"===o?c>=2&&(r=r.slice(2)):h(o)?r=n[4]:o?i&&(r=r.slice(2)):c>=2&&h(e.protocol)&&(r=n[4]),{protocol:o,slashes:i||h(o),slashesCount:c,rest:r}}function b(t,e,r){if(t=u(t),!(this instanceof b))return new b(t,e,r);var i,s,c,f,y,v,g=l.slice(),m=typeof e,w=this,_=0;for("object"!==m&&"string"!==m&&(r=e,e=null),r&&"function"!=typeof r&&(r=o.parse),i=!(s=d(t||"",e=p(e))).protocol&&!s.slashes,w.slashes=s.slashes||i&&e.slashes,w.protocol=s.protocol||e.protocol||"",t=s.rest,("file:"===s.protocol&&(2!==s.slashesCount||a.test(t))||!s.slashes&&(s.protocol||s.slashesCount<2||!h(w.protocol)))&&(g[3]=[/(.*)/,"pathname"]);_<g.length;_++)"function"!=typeof(f=g[_])?(c=f[0],v=f[1],c!=c?w[v]=t:"string"==typeof c?~(y=t.indexOf(c))&&("number"==typeof f[2]?(w[v]=t.slice(0,y),t=t.slice(y+f[2])):(w[v]=t.slice(y),t=t.slice(0,y))):(y=c.exec(t))&&(w[v]=y[1],t=t.slice(0,y.index)),w[v]=w[v]||i&&f[3]&&e[v]||"",f[4]&&(w[v]=w[v].toLowerCase())):t=f(t,w);r&&(w.query=r(w.query)),i&&e.slashes&&"/"!==w.pathname.charAt(0)&&(""!==w.pathname||""!==e.pathname)&&(w.pathname=function(t,e){if(""===t)return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(w.pathname,e.pathname)),"/"!==w.pathname.charAt(0)&&h(w.protocol)&&(w.pathname="/"+w.pathname),n(w.port,w.protocol)||(w.host=w.hostname,w.port=""),w.username=w.password="",w.auth&&(f=w.auth.split(":"),w.username=f[0],w.password=f[1]||""),w.origin="file:"!==w.protocol&&h(w.protocol)&&w.host?w.protocol+"//"+w.host:"null",w.href=w.toString()}b.prototype={set:function(t,e,r){var i=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||o.parse)(e)),i[t]=e;break;case"port":i[t]=e,n(e,i.protocol)?e&&(i.host=i.hostname+":"+e):(i.host=i.hostname,i[t]="");break;case"hostname":i[t]=e,i.port&&(e+=":"+i.port),i.host=e;break;case"host":i[t]=e,/:\d+$/.test(e)?(e=e.split(":"),i.port=e.pop(),i.hostname=e.join(":")):(i.hostname=e,i.port="");break;case"protocol":i.protocol=e.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(e){var s="pathname"===t?"/":"#";i[t]=e.charAt(0)!==s?s+e:e}else i[t]=e;break;case"username":case"password":i[t]=encodeURIComponent(e);break;case"auth":var a=e.split(":");i.username=a[0],i.password=2===a.length?a[1]:""}for(var c=0;c<l.length;c++){var u=l[c];u[4]&&(i[u[1]]=i[u[1]].toLowerCase())}return i.auth=i.password?i.username+":"+i.password:i.username,i.origin="file:"!==i.protocol&&h(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(t){t&&"function"==typeof t||(t=o.stringify);var e,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var i=n+(r.protocol&&r.slashes||h(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password&&(i+=":"+r.password,i+="@"),i+=r.host+r.pathname,(e="object"==typeof r.query?t(r.query):r.query)&&(i+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(i+=r.hash),i}},b.extractProtocol=d,b.location=p,b.trimLeft=u,b.qs=o,e.exports=b}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:48,"requires-port":49}]},{},[16])(16)}));
1
+ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SanityClient=t()}}((function(){return function t(e,r,n){function o(s,a){if(!r[s]){if(!e[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[s]={exports:{}};e[s][0].call(l.exports,(function(t){return o(e[s][1][t]||t)}),l,l.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(t){a=!0,o=t}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var i=t("object-assign"),s=t("../util/observable"),a=s.map,c=s.filter,u=t("../http/queryString"),l=t("../validators");function f(t){this.client=t}function p(t,e){return"undefined"!=typeof window&&e instanceof window.File?i({filename:!1===t.preserveFilename?void 0:e.name,contentType:e.type},t):t}i(f.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};l.validateAssetType(t);var n=r.extract||void 0;n&&!n.length&&(n=["none"]);var o=l.hasDataset(this.client.clientConfig),i="image"===t?"images":"files",s=p(r,e),u=s.tag,f=s.label,d=s.title,h=s.description,b=s.creditLine,y=s.filename,v=s.source,g={label:f,title:d,description:h,filename:y,meta:n,creditLine:b};v&&(g.sourceId=v.id,g.sourceName=v.name,g.sourceUrl=v.url);var m=this.client._requestObservable({tag:u,method:"POST",timeout:s.timeout||0,uri:"/assets/".concat(i,"/").concat(o),headers:s.contentType?{"Content-Type":s.contentType}:{},query:g,body:e});return this.client.isPromiseAPI()?m.pipe(c((function(t){return"response"===t.type})),a((function(t){return t.body.document}))).toPromise():m},delete:function(t,e){console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");var r=e||"";return/^(image|file)-/.test(r)?t._id&&(r=t._id):r="".concat(t,"-").concat(r),l.hasDataset(this.client.clientConfig),this.client.delete(r)},getImageUrl:function(t,e){var r=t._ref||t;if("string"!=typeof r)throw new Error("getImageUrl() needs either an object with a _ref, or a string with an asset document ID");if(!/^image-[A-Za-z0-9_]+-\d+x\d+-[a-z]{1,5}$/.test(r))throw new Error('Unsupported asset ID "'.concat(r,'". URL generation only works for auto-generated IDs.'));var o=n(r.split("-"),4),i=o[1],s=o[2],a=o[3];l.hasDataset(this.client.clientConfig);var c=this.client.clientConfig,f=c.projectId,p=c.dataset,d=e?u(e):"";return"https://cdn.sanity.io/images/".concat(f,"/").concat(p,"/").concat(i,"-").concat(s,".").concat(a).concat(d)}}),e.exports=f},{"../http/queryString":12,"../util/observable":20,"../validators":23,"object-assign":46}],2:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout",method:"POST"})}}),e.exports=n},{"object-assign":46}],3:[function(t,e,r){"use strict";var n=t("@sanity/generate-help-url"),o=t("object-assign"),i=t("./validators"),s=t("./warnings"),a={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,isPromiseAPI:!0},c=["localhost","127.0.0.1","0.0.0.0"];r.defaultConfig=a,r.initConfig=function(t,e){var u=o({},e,t);u.apiVersion||s.printNoApiVersionSpecifiedWarning();var l=o({},a,u),f=l.useProjectHostname;if("undefined"==typeof Promise){var p=n("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(p))}if(f&&!l.projectId)throw new Error("Configuration must contain `projectId`");var d="undefined"!=typeof window&&window.location&&window.location.hostname,h=d&&function(t){return-1!==c.indexOf(t)}(window.location.hostname);d&&h&&l.token&&!0!==l.ignoreBrowserTokenWarning?s.printBrowserTokenWarning():void 0===l.useCdn&&s.printCdnWarning(),f&&i.projectId(l.projectId),l.dataset&&i.dataset(l.dataset),"requestTagPrefix"in l&&(l.requestTagPrefix=l.requestTagPrefix?i.requestTag(l.requestTagPrefix).replace(/\.+$/,""):void 0),l.apiVersion="".concat(l.apiVersion).replace(/^v/,""),l.isDefaultApi=l.apiHost===a.apiHost,l.useCdn=Boolean(l.useCdn)&&!l.withCredentials,r.validateApiVersion(l.apiVersion);var b=l.apiHost.split("://",2),y=b[0],v=b[1],g=l.isDefaultApi?"apicdn.sanity.io":v;return l.useProjectHostname?(l.url="".concat(y,"://").concat(l.projectId,".").concat(v,"/v").concat(l.apiVersion),l.cdnUrl="".concat(y,"://").concat(l.projectId,".").concat(g,"/v").concat(l.apiVersion)):(l.url="".concat(l.apiHost,"/v").concat(l.apiVersion),l.cdnUrl=l.url),l},r.validateApiVersion=function(t){if("1"!==t&&"X"!==t){var e=new Date(t);if(!(/^\d{4}-\d{2}-\d{2}$/.test(t)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}}},{"./validators":23,"./warnings":24,"@sanity/generate-help-url":26,"object-assign":46}],4:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=t("object-assign"),a=t("../util/observable"),c=a.map,u=a.filter,l=t("../validators"),f=t("../util/getSelection"),p=t("./encodeQueryString"),d=t("./transaction"),h=t("./patch"),b=t("./listen"),y=function(t,e){return!1===t?void 0:void 0===t?e:t},v=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o({returnIds:!0,returnDocuments:y(t.returnDocuments,!0),visibility:t.visibility||"sync"},t.skipCrossDatasetReferenceValidation&&{skipCrossDatasetReferenceValidation:t.skipCrossDatasetReferenceValidation})},g=function(t){return"response"===t.type},m=function(t){return t.body},w=function(t,e){return t.reduce((function(t,r){return t[e(r)]=r,t}),Object.create(null))},O=function(t){return t.toPromise()};e.exports={listen:b,getDataUrl:function(t,e){var r=this.clientConfig,n=l.hasDataset(r),o="/".concat(t,"/").concat(n),i=e?"".concat(o,"/").concat(e):o;return"/data".concat(i).replace(/\/($|\?)/,"$1")},fetch:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=!1===r.filterResponse?function(t){return t}:function(t){return t.result},o=this._dataRequest("query",{query:t,params:e},r).pipe(c(n));return this.isPromiseAPI()?O(o):o},getDocument:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",t),json:!0,tag:e.tag},n=this._requestObservable(r).pipe(u(g),c((function(t){return t.body.documents&&t.body.documents[0]})));return this.isPromiseAPI()?O(n):n},getDocuments:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={uri:this.getDataUrl("doc",t.join(",")),json:!0,tag:e.tag},n=this._requestObservable(r).pipe(u(g),c((function(e){var r=w(e.body.documents||[],(function(t){return t._id}));return t.map((function(t){return r[t]||null}))})));return this.isPromiseAPI()?O(n):n},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return l.requireDocumentId("createIfNotExists",t),this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return l.requireDocumentId("createOrReplace",t),this._create(t,"createOrReplace",e)},patch:function(t,e){return new h(t,e,this)},delete:function(t,e){return this.dataRequest("mutate",{mutations:[{delete:f(t)}]},e)},mutate:function(t,e){var r=t instanceof h||t instanceof d?t.serialize():t,n=Array.isArray(r)?r:[r],o=e&&e.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:o},e)},transaction:function(t){return new d(t,this)},dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._dataRequest(t,e,r);return this.isPromiseAPI()?O(n):n},_dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="mutate"===t,o="query"===t,s=!n&&p(e),a=!n&&s.length<11264,l=a?s:"",f=r.returnFirst,d=r.timeout,h=r.token,b=r.tag,y=r.headers,w={method:a?"GET":"POST",uri:this.getDataUrl(t,l),json:!0,body:a?void 0:e,query:n&&v(r),timeout:d,headers:y,token:h,tag:b,canUseCdn:o};return this._requestObservable(w).pipe(u(g),c(m),c((function(t){if(!n)return t;var e=t.results||[];if(r.returnDocuments)return f?e[0]&&e[0].document:e.map((function(t){return t.document}));var o=f?"documentId":"documentIds",s=f?e[0]&&e[0].id:e.map((function(t){return t.id}));return i({transactionId:t.transactionId,results:e},o,s)})))},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i({},e,t),o=s({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},o)}}},{"../util/getSelection":19,"../util/observable":20,"../validators":23,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"object-assign":46}],5:[function(t,e,r){"use strict";var n=["tag"];function o(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var i=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,s=void 0===r?{}:r,a=t.options,c=void 0===a?{}:a,u=c.tag,l=o(c,n),f="query=".concat(i(e)),p=u?"?tag=".concat(i(u),"&").concat(f):"?".concat(f),d=Object.keys(s).reduce((function(t,e){return"".concat(t,"&").concat(i("$".concat(e)),"=").concat(i(JSON.stringify(s[e])))}),p);return Object.keys(l).reduce((function(t,e){return c[e]?"".concat(t,"&").concat(i(e),"=").concat(i(c[e])):t}),d)}},{}],6:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=t("object-assign"),a=t("../util/observable").Observable,c=t("@sanity/eventsource"),u=t("../util/pick"),l=t("../util/defaults"),f=t("./encodeQueryString"),p=c,d=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],h={includeResult:!0};function b(t){try{var e=t.data&&JSON.parse(t.data)||{};return s({type:t.type},e)}catch(t){return t}}function y(t){if(t instanceof Error)return t;var e=b(t);return e instanceof Error?e:new Error(function(t){return t.error?t.error.description?t.error.description:"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2):t.message||"Unknown listener error"}(e))}e.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.clientConfig,i=n.url,s=n.token,c=n.withCredentials,v=n.requestTagPrefix,g=r.tag&&v?[v,r.tag].join("."):r.tag,m=o(o({},l(r,h)),{},{tag:g}),w=u(m,d),O=f({query:t,params:e,options:w,tag:g}),_="".concat(i).concat(this.getDataUrl("listen",O));if(_.length>14800)return new a((function(t){return t.error(new Error("Query too large for listener"))}));var j=m.events?m.events:["mutation"],E=-1!==j.indexOf("reconnect"),S={};return(s||c)&&(S.withCredentials=!0),s&&(S.headers={Authorization:"Bearer ".concat(s)}),new a((function(t){var e,r=u(),n=!1;function o(){n||(E&&t.next({type:"reconnect"}),n||r.readyState===p.CLOSED&&(c(),clearTimeout(e),e=setTimeout(l,100)))}function i(e){t.error(y(e))}function s(e){var r=b(e);return r instanceof Error?t.error(r):t.next(r)}function a(e){n=!0,c(),t.complete()}function c(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",i,!1),r.removeEventListener("disconnect",a,!1),j.forEach((function(t){return r.removeEventListener(t,s,!1)})),r.close()}function u(){var t=new p(_,S);return t.addEventListener("error",o,!1),t.addEventListener("channelError",i,!1),t.addEventListener("disconnect",a,!1),j.forEach((function(e){return t.addEventListener(e,s,!1)})),t}function l(){r=u()}return function(){n=!0,c()}}))}},{"../util/defaults":18,"../util/observable":20,"../util/pick":22,"./encodeQueryString":5,"@sanity/eventsource":25,"object-assign":46}],7:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("../util/getSelection"),s=t("../validators"),a=s.validateObject,c=s.validateInsert;function u(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.selection=t,this.operations=o({},e),this.client=r}o(u.prototype,{clone:function(){return new u(this.selection,o({},this.operations),this.client)},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return a("diffMatchPatch",t),this._assign("diffMatchPatch",t)},unset:function(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=o({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return a("replace",t),this._set("set",{$:t})},inc:function(t){return this._assign("inc",t)},dec:function(t){return this._assign("dec",t)},insert:function(t,e,r){var o;return c(t,e,r),this._assign("insert",(n(o={},t,e),n(o,"items",r),o))},append:function(t,e){return this.insert("after","".concat(t,"[-1]"),e)},prepend:function(t,e){return this.insert("before","".concat(t,"[0]"),e)},splice:function(t,e,r,n){var o=e<0?e-1:e,i=void 0===r||-1===r?-1:Math.max(0,e+r),s=o<0&&i>=0?"":i,a="".concat(t,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,n||[])},ifRevisionId:function(t){return this.operations.ifRevisionID=t,this},serialize:function(){return o(i(this.selection),this.operations)},toJSON:function(){return this.serialize()},commit:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.client)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");var e="string"==typeof this.selection,r=o({returnFirst:e,returnDocuments:!0},t);return this.client.mutate({patch:this.serialize()},r)},reset:function(){return this.operations={},this},_set:function(t,e){return this._assign(t,e,!1)},_assign:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a(t,e),this.operations=o({},this.operations,n({},t,o({},r&&this.operations[t]||{},e))),this}}),e.exports=u},{"../util/getSelection":19,"../validators":23,"object-assign":46}],8:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("../validators"),s=t("./patch"),a={returnDocuments:!1};function c(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;this.trxId=r,this.operations=t,this.client=e}o(c.prototype,{clone:function(){return new c(this.operations.slice(0),this.client,this.trxId)},create:function(t){return i.validateObject("create",t),this._add({create:t})},createIfNotExists:function(t){var e="createIfNotExists";return i.validateObject(e,t),i.requireDocumentId(e,t),this._add(n({},e,t))},createOrReplace:function(t){var e="createOrReplace";return i.validateObject(e,t),i.requireDocumentId(e,t),this._add(n({},e,t))},delete:function(t){return i.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function(t,e){var r="function"==typeof e;if(t instanceof s)return this._add({patch:t.serialize()});if(r){var n=e(new s(t,{},this.client));if(!(n instanceof s))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:o({id:t},e)})},transactionId:function(t){return t?(this.trxId=t,this):this.trxId},serialize:function(){return this.operations.slice()},toJSON:function(){return this.serialize()},commit:function(t){if(!this.client)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.client.mutate(this.serialize(),o({transactionId:this.trxId},a,t||{}))},reset:function(){return this.operations=[],this},_add:function(t){return this.operations.push(t),this}}),e.exports=c},{"../validators":23,"./patch":7,"object-assign":46}],9:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("../validators");function i(t){this.request=t.request.bind(t)}n(i.prototype,{create:function(t,e){return this._modify("PUT",t,e)},edit:function(t,e){return this._modify("PATCH",t,e)},delete:function(t){return this._modify("DELETE",t)},list:function(){return this.request({uri:"/datasets"})},_modify:function(t,e,r){return o.dataset(e),this.request({method:t,uri:"/datasets/".concat(e),body:r})}}),e.exports=i},{"../validators":23,"object-assign":46}],10:[function(t,e,r){"use strict";e.exports=[]},{}],11:[function(t,e,r){"use strict";var n=t("make-error"),o=t("object-assign");function i(t){var e=a(t);i.super.call(this,e.message),o(this,e)}function s(t){var e=a(t);s.super.call(this,e.message),o(this,e)}function a(t){var e=t.body,r={response:t,statusCode:t.statusCode,responseBody:c(e,t)};return e.error&&e.message?(r.message="".concat(e.error," - ").concat(e.message),r):e.error&&e.error.description?(r.message=e.error.description,r.details=e.error,r):(r.message=e.error||e.message||function(t){var e=t.statusMessage?" ".concat(t.statusMessage):"";return"".concat(t.method,"-request to ").concat(t.url," resulted in HTTP ").concat(t.statusCode).concat(e)}(t),r)}function c(t,e){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t}n(i),n(s),r.ClientError=i,r.ServerError=s},{"make-error":44,"object-assign":46}],12:[function(t,e,r){"use strict";e.exports=function(t){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(t[r])));return e.length>0?"?".concat(e.join("&")):""}},{}],13:[function(t,e,r){"use strict";var n=t("get-it"),o=t("object-assign"),i=t("get-it/lib/middleware/observable"),s=t("get-it/lib/middleware/jsonRequest"),a=t("get-it/lib/middleware/jsonResponse"),c=t("get-it/lib/middleware/progress"),u=t("../util/observable").Observable,l=t("./errors"),f=l.ClientError,p=l.ServerError,d={onResponse:function(t){if(t.statusCode>=500)throw new p(t);if(t.statusCode>=400)throw new f(t);return t}},h={onResponse:function(t){var e=t.headers["x-sanity-warning"];return(Array.isArray(e)?e:[e]).filter(Boolean).forEach((function(t){return console.warn(t)})),t}},b=n(t("./nodeMiddleware").concat([h,s(),a(),c(),d,i({implementation:u})]));function y(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:b)(o({maxRedirects:0},t))}y.defaultRequester=b,y.ClientError=f,y.ServerError=p,e.exports=y},{"../util/observable":20,"./errors":11,"./nodeMiddleware":10,"get-it":28,"get-it/lib/middleware/jsonRequest":32,"get-it/lib/middleware/jsonResponse":33,"get-it/lib/middleware/observable":34,"get-it/lib/middleware/progress":36,"object-assign":46}],14:[function(t,e,r){"use strict";var n=t("object-assign"),o="X-Sanity-Project-ID";e.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},i=e.token||t.token;i&&(r.Authorization="Bearer ".concat(i)),e.useGlobalApi||t.useProjectHostname||!t.projectId||(r[o]=t.projectId);var s=Boolean(void 0===e.withCredentials?t.token||t.withCredentials:e.withCredentials),a=void 0===e.timeout?t.timeout:e.timeout;return n({},e,{headers:n({},r,e.headers||{}),timeout:void 0===a?3e5:a,proxy:e.proxy||t.proxy,json:!0,withCredentials:s})}},{"object-assign":46}],15:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/".concat(t)})}}),e.exports=n},{"object-assign":46}],16:[function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=t("object-assign"),s=t("./util/observable"),a=s.Observable,c=s.map,u=s.filter,l=t("./data/patch"),f=t("./data/transaction"),p=t("./data/dataMethods"),d=t("./datasets/datasetsClient"),h=t("./projects/projectsClient"),b=t("./assets/assetsClient"),y=t("./users/usersClient"),v=t("./auth/authClient"),g=t("./http/request"),m=t("./http/requestOptions"),w=t("./config"),O=w.defaultConfig,_=w.initConfig,j=t("./validators");function E(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O;if(!(this instanceof E))return new E(t);if(this.config(t),this.assets=new b(this),this.datasets=new d(this),this.projects=new h(this),this.users=new y(this),this.auth=new v(this),this.clientConfig.isPromiseAPI){var e=i({},this.clientConfig,{isPromiseAPI:!1});this.observable=new E(e)}}i(E.prototype,p),i(E.prototype,{clone:function(){return new E(this.config())},config:function(t){if(void 0===t)return i({},this.clientConfig);if(this.observable){var e=i({},t,{isPromiseAPI:!1});this.observable.config(e)}return this.clientConfig=_(t,this.clientConfig||{}),this},withConfig:function(t){return this.clone().config(t)},getUrl:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.clientConfig.cdnUrl:this.clientConfig.url;return"".concat(e,"/").concat(t.replace(/^\//,""))},isPromiseAPI:function(){return this.clientConfig.isPromiseAPI},_requestObservable:function(t){var e=this,r=t.url||t.uri,s=void 0===t.canUseCdn?["GET","HEAD"].indexOf(t.method||"GET")>=0&&0===r.indexOf("/data/"):t.canUseCdn,c=this.clientConfig.useCdn&&s,u=t.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,t.tag].join("."):t.tag||this.clientConfig.requestTagPrefix;u&&(t.query=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({tag:j.requestTag(u)},t.query));var l=m(this.clientConfig,i({},t,{url:this.getUrl(r,c)}));return new a((function(t){return g(l,e.clientConfig.requester).subscribe(t)}))},request:function(t){var e=this._requestObservable(t).pipe(u((function(t){return"response"===t.type})),c((function(t){return t.body})));return this.isPromiseAPI()?function(t){return t.toPromise()}(e):e}}),E.Patch=l,E.Transaction=f,E.ClientError=g.ClientError,E.ServerError=g.ServerError,E.requester=g.defaultRequester,e.exports=E},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":13,"./http/requestOptions":14,"./projects/projectsClient":15,"./users/usersClient":17,"./util/observable":20,"./validators":23,"object-assign":46}],17:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getById:function(t){return this.client.request({uri:"/users/".concat(t)})}}),e.exports=n},{"object-assign":46}],18:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(e).concat(Object.keys(t)).reduce((function(r,n){return r[n]=void 0===t[n]?e[n]:t[n],r}),{})}},{}],19:[function(t,e,r){"use strict";e.exports=function(t){if("string"==typeof t||Array.isArray(t))return{id:t};if(t&&t.query)return"params"in t?{query:t.query,params:t.params}:{query:t.query};var e=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(e))}},{}],20:[function(t,e,r){"use strict";var n=t("rxjs/internal/Observable").Observable,o=t("rxjs/internal/operators/filter").filter,i=t("rxjs/internal/operators/map").map;e.exports={Observable:n,filter:o,map:i}},{"rxjs/internal/Observable":50,"rxjs/internal/operators/filter":55,"rxjs/internal/operators/map":56}],21:[function(t,e,r){"use strict";e.exports=function(t){var e,r=!1;return function(){return r||(e=t.apply(void 0,arguments),r=!0),e}}},{}],22:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce((function(e,r){return void 0===t[r]||(e[r]=t[r]),e}),{})}},{}],23:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=["image","file"],i=["before","after","replace"];r.dataset=function(t){if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},r.projectId=function(t){if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")},r.validateAssetType=function(t){if(-1===o.indexOf(t))throw new Error("Invalid asset type: ".concat(t,". Must be one of ").concat(o.join(", ")))},r.validateObject=function(t,e){if(null===e||"object"!==n(e)||Array.isArray(e))throw new Error("".concat(t,"() takes an object of properties"))},r.requireDocumentId=function(t,e){if(!e._id)throw new Error("".concat(t,'() requires that the document contains an ID ("_id" property)'));r.validateDocumentId(t,e._id)},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[a-z0-9_.-]+$/i.test(e))throw new Error("".concat(t,'(): "').concat(e,'" is not a valid document ID'))},r.validateInsert=function(t,e,r){var n="insert(at, selector, items)";if(-1===i.indexOf(t)){var o=i.map((function(t){return'"'.concat(t,'"')})).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(o))}if("string"!=typeof e)throw new Error("".concat(n,' takes a "selector"-argument which must be a string'));if(!Array.isArray(r))throw new Error("".concat(n,' takes an "items"-argument which must be an array'))},r.hasDataset=function(t){if(!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},r.requestTag=function(t){if("string"!=typeof t||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t}},{}],24:[function(t,e,r){"use strict";var n=t("@sanity/generate-help-url"),o=t("./util/once"),i=function(t){return o((function(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=console).warn.apply(e,[t.join(" ")].concat(n))}))};r.printCdnWarning=i(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and","cheaper. Think about it! For more info, see ".concat(n("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),r.printBrowserTokenWarning=i(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat(n("js-client-browser-token")," for more information and how to hide this warning.")]),r.printNoApiVersionSpecifiedWarning=i(["Using the Sanity client without specifying an API version is deprecated.","See ".concat(n("js-client-api-version"))])},{"./util/once":21,"@sanity/generate-help-url":26}],25:[function(t,e,r){var n=t("event-source-polyfill");e.exports=n.EventSourcePolyfill},{"event-source-polyfill":27}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module";r.generateHelpUrl=function(t){return"https://docs.sanity.io/help/"+t}},{}],27:[function(t,e,r){!function(t){"use strict";var n=t.setTimeout,o=t.clearTimeout,i=t.XMLHttpRequest,s=t.XDomainRequest,a=t.ActiveXObject,c=t.EventSource,u=t.document,l=t.Promise,f=t.fetch,p=t.Response,d=t.TextDecoder,h=t.TextEncoder,b=t.AbortController;if("undefined"==typeof window||void 0===u||"readyState"in u||null!=u.body||(u.readyState="loading",window.addEventListener("load",(function(t){u.readyState="complete"}),!1)),null==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(t){function e(){}return e.prototype=t,new e}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==b){var y=f;f=function(t,e){var r=e.signal;return y(t,{headers:e.headers,credentials:e.credentials,cache:e.cache}).then((function(t){var e=t.body.getReader();return r._reader=e,r._aborted&&r._reader.cancel(),{status:t.status,statusText:t.statusText,headers:t.headers,body:{getReader:function(){return e}}}}))},b=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function v(){this.bitsNeeded=0,this.codePoint=0}v.prototype.decode=function(t){function e(t,e,r){if(1===r)return t>=128>>e&&t<<e<=2047;if(2===r)return t>=2048>>e&&t<<e<=55295||t>=57344>>e&&t<<e<=65535;if(3===r)return t>=65536>>e&&t<<e<=1114111;throw new Error}function r(t,e){if(6===t)return e>>6>15?3:e>31?2:1;if(12===t)return e>15?3:2;if(18===t)return 3;throw new Error}for(var n="",o=this.bitsNeeded,i=this.codePoint,s=0;s<t.length;s+=1){var a=t[s];0!==o&&(a<128||a>191||!e(i<<6|63&a,o-6,r(o,i)))&&(o=0,i=65533,n+=String.fromCharCode(i)),0===o?(a>=0&&a<=127?(o=0,i=a):a>=192&&a<=223?(o=6,i=31&a):a>=224&&a<=239?(o=12,i=15&a):a>=240&&a<=247?(o=18,i=7&a):(o=0,i=65533),0===o||e(i,o,r(o,i))||(o=0,i=65533)):(o-=6,i=i<<6|63&a),0===o&&(i<=65535?n+=String.fromCharCode(i):(n+=String.fromCharCode(55296+(i-65535-1>>10)),n+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=o,this.codePoint=i,n},null!=d&&null!=h&&function(){try{return"test"===(new d).decode((new h).encode("test"),{stream:!0})}catch(t){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+t)}return!1}()||(d=v);var g=function(){};function m(t){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=g,this.onload=g,this.onerror=g,this.onreadystatechange=g,this._contentType="",this._xhr=t,this._sendTimeout=0,this._abort=g}function w(t){return t.replace(/[A-Z]/g,(function(t){return String.fromCharCode(t.charCodeAt(0)+32)}))}function O(t){for(var e=Object.create(null),r=t.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),i=o.shift(),s=o.join(": ");e[w(i)]=s}this._map=e}function _(){}function j(t){this._headers=t}function E(){}function S(){this._listeners=Object.create(null)}function x(t){n((function(){throw t}),0)}function C(t){this.type=t,this.target=void 0}function P(t,e){C.call(this,t),this.data=e.data,this.lastEventId=e.lastEventId}function T(t,e){C.call(this,t),this.status=e.status,this.statusText=e.statusText,this.headers=e.headers}function q(t,e){C.call(this,t),this.error=e.error}m.prototype.open=function(t,e){this._abort(!0);var r=this,s=this._xhr,a=1,c=0;this._abort=function(t){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=g,s.onerror=g,s.onabort=g,s.onprogress=g,s.onreadystatechange=g,s.abort(),0!==c&&(o(c),c=0),t||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var u=function(){if(1===a){var t=0,e="",n=void 0;if("contentType"in s)t=200,e="OK",n=s.contentType;else try{t=s.status,e=s.statusText,n=s.getResponseHeader("Content-Type")}catch(r){t=0,e="",n=void 0}0!==t&&(a=2,r.readyState=2,r.status=t,r.statusText=e,r._contentType=n,r.onreadystatechange())}},l=function(){if(u(),2===a||3===a){a=3;var t="";try{t=s.responseText}catch(t){}r.readyState=3,r.responseText=t,r.onprogress()}},f=function(t,e){if(null!=e&&null!=e.preventDefault||(e={preventDefault:g}),l(),1===a||2===a||3===a){if(a=4,0!==c&&(o(c),c=0),r.readyState=4,"load"===t)r.onload(e);else if("error"===t)r.onerror(e);else{if("abort"!==t)throw new TypeError;r.onabort(e)}r.onreadystatechange()}},p=function(){c=n((function(){p()}),500),3===s.readyState&&l()};"onload"in s&&(s.onload=function(t){f("load",t)}),"onerror"in s&&(s.onerror=function(t){f("error",t)}),"onabort"in s&&(s.onabort=function(t){f("abort",t)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(t){!function(t){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||f(""===s.responseText?"error":"load",t):3===s.readyState?"onprogress"in s||l():2===s.readyState&&u())}(t)}),!("contentType"in s)&&"ontimeout"in i.prototype||(e+=(-1===e.indexOf("?")?"?":"&")+"padding=true"),s.open(t,e,!0),"readyState"in s&&(c=n((function(){p()}),0))},m.prototype.abort=function(){this._abort(!1)},m.prototype.getResponseHeader=function(t){return this._contentType},m.prototype.setRequestHeader=function(t,e){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(t,e)},m.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},m.prototype.send=function(){if("ontimeout"in i.prototype&&("sendAsBinary"in i.prototype||"mozAnon"in i.prototype)||null==u||null==u.readyState||"complete"===u.readyState){var t=this._xhr;"withCredentials"in t&&(t.withCredentials=this.withCredentials);try{t.send(void 0)}catch(t){throw t}}else{var e=this;e._sendTimeout=n((function(){e._sendTimeout=0,e.send()}),4)}},O.prototype.get=function(t){return this._map[w(t)]},null!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),_.prototype.open=function(t,e,r,n,o,s,a){t.open("GET",o);var c=0;for(var u in t.onprogress=function(){var e=t.responseText.slice(c);c+=e.length,r(e)},t.onerror=function(t){t.preventDefault(),n(new Error("NetworkError"))},t.onload=function(){n(null)},t.onabort=function(){n(null)},t.onreadystatechange=function(){if(t.readyState===i.HEADERS_RECEIVED){var r=t.status,n=t.statusText,o=t.getResponseHeader("Content-Type"),s=t.getAllResponseHeaders();e(r,n,o,new O(s))}},t.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,u)&&t.setRequestHeader(u,a[u]);return t.send(),t},j.prototype.get=function(t){return this._headers.get(t)},E.prototype.open=function(t,e,r,n,o,i,s){var a=null,c=new b,u=c.signal,p=new d;return f(o,{headers:s,credentials:i?"include":"same-origin",signal:u,cache:"no-store"}).then((function(t){return a=t.body.getReader(),e(t.status,t.statusText,t.headers.get("Content-Type"),new j(t.headers)),new l((function(t,e){var n=function(){a.read().then((function(e){if(e.done)t(void 0);else{var o=p.decode(e.value,{stream:!0});r(o),n()}})).catch((function(t){e(t)}))};n()}))})).catch((function(t){return"AbortError"===t.name?void 0:t})).then((function(t){n(t)})),{abort:function(){null!=a&&a.cancel(),c.abort()}}},S.prototype.dispatchEvent=function(t){t.target=this;var e=this._listeners[t.type];if(null!=e)for(var r=e.length,n=0;n<r;n+=1){var o=e[n];try{"function"==typeof o.handleEvent?o.handleEvent(t):o.call(this,t)}catch(t){x(t)}}},S.prototype.addEventListener=function(t,e){t=String(t);var r=this._listeners,n=r[t];null==n&&(n=[],r[t]=n);for(var o=!1,i=0;i<n.length;i+=1)n[i]===e&&(o=!0);o||n.push(e)},S.prototype.removeEventListener=function(t,e){t=String(t);var r=this._listeners,n=r[t];if(null!=n){for(var o=[],i=0;i<n.length;i+=1)n[i]!==e&&o.push(n[i]);0===o.length?delete r[t]:r[t]=o}},P.prototype=Object.create(C.prototype),T.prototype=Object.create(C.prototype),q.prototype=Object.create(C.prototype);var R=/^text\/event\-stream(;.*)?$/i,A=function(t,e){var r=null==t?e:parseInt(t,10);return r!=r&&(r=e),I(r)},I=function(t){return Math.min(Math.max(t,1e3),18e6)},D=function(t,e,r){try{"function"==typeof e&&e.call(t,r)}catch(t){x(t)}};function k(t,e){S.call(this),e=e||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(t,e,r){e=String(e);var a=Boolean(r.withCredentials),c=r.lastEventIdQueryParameterName||"lastEventId",u=I(1e3),l=A(r.heartbeatTimeout,45e3),f="",p=u,d=!1,h=0,b=r.headers||{},y=r.Transport,v=U&&null==y?void 0:new m(null!=y?new y:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),g=null!=y&&"string"!=typeof y?new y:null==v?new E:new _,w=void 0,O=0,j=-1,S="",x="",C="",k="",M=0,N=0,H=0,L=function(e,r,n,o){if(0===j)if(200===e&&null!=n&&R.test(n)){j=1,d=Date.now(),p=u,t.readyState=1;var i=new T("open",{status:e,statusText:r,headers:o});t.dispatchEvent(i),D(t,t.onopen,i)}else{var s="";200!==e?(r&&(r=r.replace(/\s+/g," ")),s="EventSource's response has a status "+e+" "+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.",B();i=new T("error",{status:e,statusText:r,headers:o});t.dispatchEvent(i),D(t,t.onerror,i),console.error(s)}},z=function(e){if(1===j){for(var r=-1,i=0;i<e.length;i+=1){(c=e.charCodeAt(i))!=="\n".charCodeAt(0)&&c!=="\r".charCodeAt(0)||(r=i)}var s=(-1!==r?k:"")+e.slice(0,r+1);k=(-1===r?k:"")+e.slice(r+1),""!==e&&(d=Date.now(),h+=e.length);for(var a=0;a<s.length;a+=1){var c=s.charCodeAt(a);if(-1===M&&c==="\n".charCodeAt(0))M=0;else if(-1===M&&(M=0),c==="\r".charCodeAt(0)||c==="\n".charCodeAt(0)){if(0!==M){1===M&&(H=a+1);var b=s.slice(N,H-1),y=s.slice(H+(H<a&&s.charCodeAt(H)===" ".charCodeAt(0)?1:0),a);"data"===b?(S+="\n",S+=y):"id"===b?x=y:"event"===b?C=y:"retry"===b?(u=A(y,u),p=u):"heartbeatTimeout"===b&&(l=A(y,l),0!==O&&(o(O),O=n((function(){F()}),l)))}if(0===M){if(""!==S){f=x,""===C&&(C="message");var v=new P(C,{data:S.slice(1),lastEventId:x});if(t.dispatchEvent(v),"open"===C?D(t,t.onopen,v):"message"===C?D(t,t.onmessage,v):"error"===C&&D(t,t.onerror,v),2===j)return}S="",C=""}M=c==="\r".charCodeAt(0)?-1:0}else 0===M&&(N=a,M=1),1===M?c===":".charCodeAt(0)&&(H=a+1,M=2):2===M&&(M=3)}}},V=function(e){if(1===j||0===j){j=-1,0!==O&&(o(O),O=0),O=n((function(){F()}),p),p=I(Math.min(16*u,2*p)),t.readyState=0;var r=new q("error",{error:e});t.dispatchEvent(r),D(t,t.onerror,r),null!=e&&console.error(e)}},B=function(){j=2,null!=w&&(w.abort(),w=void 0),0!==O&&(o(O),O=0),t.readyState=2},F=function(){if(O=0,-1===j){d=!1,h=0,O=n((function(){F()}),l),j=0,S="",C="",x=f,k="",N=0,H=0,M=0;var r=e;if("data:"!==e.slice(0,5)&&"blob:"!==e.slice(0,5)&&""!==f){var o=e.indexOf("?");r=-1===o?e:e.slice(0,o+1)+e.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(t,e){return e===c?"":t})),r+=(-1===e.indexOf("?")?"?":"&")+c+"="+encodeURIComponent(f)}var i=t.withCredentials,s={Accept:"text/event-stream"},a=t.headers;if(null!=a)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(s[u]=a[u]);try{w=g.open(v,L,z,V,r,i,s)}catch(t){throw B(),t}}else if(d||null==w){var p=Math.max((d||Date.now())+l-Date.now(),1);d=!1,O=n((function(){F()}),p)}else V(new Error("No activity within "+l+" milliseconds. "+(0===j?"No response received.":h+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};t.url=e,t.readyState=0,t.withCredentials=a,t.headers=b,t._close=B,F()}(this,t,e)}var U=null!=f&&null!=p&&"body"in p.prototype;k.prototype=Object.create(S.prototype),k.prototype.CONNECTING=0,k.prototype.OPEN=1,k.prototype.CLOSED=2,k.prototype.close=function(){this._close()},k.CONNECTING=0,k.OPEN=1,k.CLOSED=2,k.prototype.withCredentials=void 0;var M=c;null==i||null!=c&&"withCredentials"in c.prototype||(M=k),function(n){if("object"==typeof e&&"object"==typeof e.exports){var o=n(r);void 0!==o&&(e.exports=o)}else n(t)}((function(t){t.EventSourcePolyfill=k,t.NativeEventSource=c,t.EventSource=M}))}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:this:globalThis)},{}],28:[function(t,e,r){e.exports=t("./lib-node")},{"./lib-node":29}],29:[function(t,e,r){"use strict";var n=t("nano-pubsub"),o=t("./util/middlewareReducer"),i=t("./middleware/defaultOptionsProcessor"),s=t("./middleware/defaultOptionsValidator"),a=t("./request"),c=["request","response","progress","error","abort"],u=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,l=[],f=u.reduce((function(t,e){return t[e]=t[e]||[],t}),{processOptions:[i],validateOptions:[s]});function p(t){var e=c.reduce((function(t,e){return t[e]=n(),t}),{}),i=o(f),s=i("processOptions",t);i("validateOptions",s);var a={options:s,channels:e,applyMiddleware:i},u=null,l=e.request.subscribe((function(t){u=r(t,(function(r,n){return function(t,r,n){var o=t,s=r;if(!o)try{s=i("onResponse",r,n)}catch(t){s=null,o=t}(o=o&&i("onError",o,n))?e.error.publish(o):s&&e.response.publish(s)}(r,n,t)}))}));e.abort.subscribe((function(){l(),u&&u.abort()}));var p=i("onReturn",e,a);return p===e&&e.request.publish(a),p}return p.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.onReturn&&f.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 u.forEach((function(e){t[e]&&f[e].push(t[e])})),l.push(t),p},p.clone=function(){return t(l)},e.forEach(p.use),p}},{"./middleware/defaultOptionsProcessor":30,"./middleware/defaultOptionsValidator":31,"./request":39,"./util/middlewareReducer":41,"nano-pubsub":45}],30:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("url-parse"),i="undefined"!=typeof navigator&&"ReactNative"===navigator.product,s=Object.prototype.hasOwnProperty,a={timeout:i?6e4:12e4};function c(t){var e=[];for(var r in t)s.call(t,r)&&n(r,t[r]);return e.length?e.join("&"):"";function n(t,r){Array.isArray(r)?r.forEach((function(e){return n(t,e)})):e.push([t,r].map(encodeURIComponent).join("="))}}function u(t){if(!1===t||0===t)return!1;if(t.connect||t.socket)return t;var e=Number(t);return isNaN(e)?u(a.timeout):{connect:e,socket:e}}e.exports=function(t){var e="string"==typeof t?n({url:t},a):n({},a,t),r=o(e.url,{},!0);return e.timeout=u(e.timeout),e.query&&(r.query=n({},r.query,function(t){var e={};for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}(e.query))),e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e.url=r.toString(c),e}},{"object-assign":46,"url-parse":70}],31:[function(t,e,r){"use strict";var n=/^https?:\/\//i;e.exports=function(t){if(!n.test(t.url))throw new Error('"'.concat(t.url,'" is not a valid URL'))}},{}],32:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=t("object-assign"),i=t("is-plain-object"),s=["boolean","string","number"];e.exports=function(){return{processOptions:function(t){var e=t.body;return e&&"function"!=typeof e.pipe&&!function(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}(e)&&(-1!==s.indexOf(n(e))||Array.isArray(e)||i(e))?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":42,"object-assign":46}],33:[function(t,e,r){"use strict";var n=t("object-assign");function o(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: ".concat(t.message),t}}e.exports=function(t){return{onResponse:function(e){var r=e.headers["content-type"]||"",i=t&&t.force||-1!==r.indexOf("application/json");return e.body&&r&&i?n({},e,{body:o(e.body)}):e},processOptions:function(t){return n({},t,{headers:n({Accept:"application/json"},t.headers)})}}}},{"object-assign":46}],34:[function(t,e,r){"use strict";var n=t("../util/global"),o=t("object-assign");e.exports=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||n.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(e,r){return new t((function(t){return e.error.subscribe((function(e){return t.error(e)})),e.progress.subscribe((function(e){return t.next(o({type:"progress"},e))})),e.response.subscribe((function(e){t.next(o({type:"response"},e)),t.complete()})),e.request.publish(r),function(){return e.abort.publish()}}))}}}},{"../util/global":40,"object-assign":46}],35:[function(t,e,r){"use strict";e.exports=function(){return{onRequest:function(t){if("xhr"===t.adapter){var e=t.request,r=t.context;"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=n("upload")),"onprogress"in e&&(e.onprogress=n("download"))}function n(t){return function(e){var n=e.lengthComputable?e.loaded/e.total*100:-1;r.channels.progress.publish({stage:t,percent:n,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}}}}},{}],36:[function(t,e,r){"use strict";e.exports=t("./node-progress")},{"./node-progress":35}],37:[function(t,e,r){"use strict";var n=t("same-origin"),o=t("parse-headers"),i=t("./browser/fetchXhr"),s="undefined"==typeof window?void 0:window,a=s?"xhr":"fetch",c="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){},u="withCredentials"in new c,l="undefined"==typeof XDomainRequest?void 0:XDomainRequest,f=u?c:l;s||(c=i,f=i),e.exports=function(t,e){var r=t.options,i=t.applyMiddleware("finalizeOptions",r),u={},l=s&&s.location&&!n(s.location.href,i.url),p=t.applyMiddleware("interceptRequest",void 0,{adapter:a,context:t});if(p){var d=setTimeout(e,0,null,p);return{abort:function(){return clearTimeout(d)}}}var h=l?new f:new c,b=s&&s.XDomainRequest&&h instanceof s.XDomainRequest,y=i.headers,v=i.timeout,g=!1,m=!1,w=!1;if(h.onerror=E,h.ontimeout=E,h.onabort=function(){j(!0),g=!0},h.onprogress=function(){},h[b?"onload":"onreadystatechange"]=function(){v&&(j(),u.socket=setTimeout((function(){return _("ESOCKETTIMEDOUT")}),v.socket)),g||4!==h.readyState&&!b||0!==h.status&&(g||m||w||(0!==h.status?(j(),m=!0,e(null,function(){var t=h.status,e=h.statusText;if(b&&void 0===t)t=200;else{if(t>12e3&&t<12156)return E();t=1223===h.status?204:h.status,e=1223===h.status?"No Content":e}return{body:h.response||h.responseText,url:i.url,method:i.method,headers:b?{}:o(h.getAllResponseHeaders()),statusCode:t,statusMessage:e}}())):E(new Error("Unknown XHR error"))))},h.open(i.method,i.url,!0),h.withCredentials=!!i.withCredentials,y&&h.setRequestHeader)for(var O in y)y.hasOwnProperty(O)&&h.setRequestHeader(O,y[O]);else if(y&&b)throw new Error("Headers cannot be set on an XDomainRequest object");return i.rawBody&&(h.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:i,adapter:a,request:h,context:t}),h.send(i.body||null),v&&(u.connect=setTimeout((function(){return _("ETIMEDOUT")}),v.connect)),{abort:function(){g=!0,h&&h.abort()}};function _(e){w=!0,h.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to ".concat(i.url):"Connection timed out on request to ".concat(i.url));r.code=e,t.channels.error.publish(r)}function j(t){(t||g||h.readyState>=2&&u.connect)&&clearTimeout(u.connect),u.socket&&clearTimeout(u.socket)}function E(t){if(!m){j(!0),m=!0,h=null;var r=t||new Error("Network error while attempting to reach ".concat(i.url));r.isNetworkError=!0,r.request=i,e(r)}}}},{"./browser/fetchXhr":38,"parse-headers":47,"same-origin":68}],38:[function(t,e,r){"use strict";function n(){this.readyState=0}n.prototype.open=function(t,e){this._method=t,this._url=e,this._resHeaders="",this.readyState=1,this.onreadystatechange()},n.prototype.abort=function(){this._controller&&this._controller.abort()},n.prototype.getAllResponseHeaders=function(){return this._resHeaders},n.prototype.setRequestHeader=function(t,e){this._headers=this._headers||{},this._headers[t]=e},n.prototype.send=function(t){var e=this,r=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,o={method:this._method,headers:this._headers,signal:r&&r.signal,body:t};"undefined"!=typeof window&&(o.credentials=this.withCredentials?"include":"omit"),fetch(this._url,o).then((function(t){return t.headers.forEach((function(t,r){e._resHeaders+="".concat(r,": ").concat(t,"\r\n")})),e.status=t.status,e.statusText=t.statusText,e.readyState=3,n?t.text():t.arrayBuffer()})).then((function(t){n?e.responseText=t:e.response=t,e.readyState=4,e.onreadystatechange()})).catch((function(t){"AbortError"!==t.name?e.onerror(t):e.onabort()}))},e.exports=n},{}],39:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":37}],40:[function(t,e,r){(function(t){(function(){"use strict";"undefined"!=typeof globalThis?e.exports=globalThis:"undefined"!=typeof window?e.exports=window:void 0!==t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],41:[function(t,e,r){"use strict";e.exports=function(t){return function(e,r){for(var n="onError"===e,o=r,i=arguments.length,s=new Array(i>2?i-2:0),a=2;a<i;a++)s[a-2]=arguments[a];for(var c=0;c<t[e].length&&(o=t[e][c].apply(void 0,[o].concat(s)),!n||o);c++);return o}}},{}],42:[function(t,e,r){"use strict";var n=t("isobject");function o(t){return!0===n(t)&&"[object Object]"===Object.prototype.toString.call(t)}e.exports=function(t){var e,r;return!1!==o(t)&&"function"==typeof(e=t.constructor)&&!1!==o(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")}},{isobject:43}],43:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)}},{}],44:[function(t,e,r){"use strict";var n="undefined"!=typeof Reflect?Reflect.construct:void 0,o=Object.defineProperty,i=Error.captureStackTrace;function s(t){void 0!==t&&o(this,"message",{configurable:!0,value:t,writable:!0});var e=this.constructor.name;void 0!==e&&e!==this.name&&o(this,"name",{configurable:!0,value:e,writable:!0}),i(this,this.constructor)}void 0===i&&(i=function(t){var e=new Error;o(t,"stack",{configurable:!0,get:function(){var t=e.stack;return o(this,"stack",{configurable:!0,value:t,writable:!0}),t},set:function(e){o(t,"stack",{configurable:!0,value:e,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var a=function(){function t(t,e){return o(t,"name",{configurable:!0,value:e})}try{var e=function(){};if(t(e,"foo"),"foo"===e.name)return t}catch(t){}}();r=e.exports=function(t,e){if(null==e||e===Error)e=s;else if("function"!=typeof e)throw new TypeError("super_ should be a function");var r;if("string"==typeof t)r=t,t=void 0!==n?function(){return n(e,arguments,this.constructor)}:function(){e.apply(this,arguments)},void 0!==a&&(a(t,r),r=void 0);else if("function"!=typeof t)throw new TypeError("constructor should be either a string or a function");t.super_=t.super=e;var o={constructor:{configurable:!0,value:t,writable:!0}};return void 0!==r&&(o.name={configurable:!0,value:r,writable:!0}),t.prototype=Object.create(e.prototype,o),t},r.BaseError=s},{}],45:[function(t,e,r){e.exports=function(){var t=[];return{subscribe:function(e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}},publish:function(){for(var e=0;e<t.length;e++)t[e].apply(null,arguments)}}}},{}],46:[function(t,e,r){"use strict";var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,c=s(t),u=1;u<arguments.length;u++){for(var l in r=Object(arguments[u]))o.call(r,l)&&(c[l]=r[l]);if(n){a=n(r);for(var f=0;f<a.length;f++)i.call(r,a[f])&&(c[a[f]]=r[a[f]])}}return c}},{}],47:[function(t,e,r){var n=function(t){return t.replace(/^\s+|\s+$/g,"")},o=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};for(var e={},r=n(t).split("\n"),i=0;i<r.length;i++){var s=r[i],a=s.indexOf(":"),c=n(s.slice(0,a)).toLowerCase(),u=n(s.slice(a+1));void 0===e[c]?e[c]=u:o(e[c])?e[c].push(u):e[c]=[e[c],u]}return e}},{}],48:[function(t,e,r){"use strict";var n=Object.prototype.hasOwnProperty;function o(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}function i(t){try{return encodeURIComponent(t)}catch(t){return null}}r.stringify=function(t,e){e=e||"";var r,o,s=[];for(o in"string"!=typeof e&&(e="?"),t)if(n.call(t,o)){if((r=t[o])||null!=r&&!isNaN(r)||(r=""),o=i(o),r=i(r),null===o||null===r)continue;s.push(o+"="+r)}return s.length?e+s.join("&"):""},r.parse=function(t){for(var e,r=/([^=?#&]+)=?([^&]*)/g,n={};e=r.exec(t);){var i=o(e[1]),s=o(e[2]);null===i||null===s||i in n||(n[i]=s)}return n}},{}],49:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],50:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./util/canReportError"),o=t("./util/toSubscriber"),i=t("./symbol/observable"),s=t("./util/pipe"),a=t("./config"),c=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=o.toSubscriber(t,e,r);if(n?i.add(n.call(i,this.source)):i.add(this.source||a.config.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),a.config.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){a.config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),n.canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=u(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[i.observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:s.pipeFromArray(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=u(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function u(t){if(t||(t=a.config.Promise||Promise),!t)throw new Error("no Promise impl found");return t}r.Observable=c},{"./config":54,"./symbol/observable":57,"./util/canReportError":60,"./util/pipe":66,"./util/toSubscriber":67}],51:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./config"),o=t("./util/hostReportError");r.empty={closed:!0,next:function(t){},error:function(t){if(n.config.useDeprecatedSynchronousErrorHandling)throw t;o.hostReportError(t)},complete:function(){}}},{"./config":54,"./util/hostReportError":61}],52:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("./util/isFunction"),s=t("./Observer"),a=t("./Subscription"),c=t("../internal/symbol/rxSubscriber"),u=t("./config"),l=t("./util/hostReportError"),f=function(t){function e(r,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=s.empty;break;case 1:if(!r){i.destination=s.empty;break}if("object"==typeof r){r instanceof e?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new p(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new p(i,r,n,o)}return i}return o(e,t),e.prototype[c.rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(a.Subscription);r.Subscriber=f;var p=function(t){function e(e,r,n,o){var a,c=t.call(this)||this;c._parentSubscriber=e;var u=c;return i.isFunction(r)?a=r:r&&(a=r.next,n=r.error,o=r.complete,r!==s.empty&&(u=Object.create(r),i.isFunction(u.unsubscribe)&&c.add(u.unsubscribe.bind(u)),u.unsubscribe=c.unsubscribe.bind(c))),c._context=u,c._next=a,c._error=n,c._complete=o,c}return o(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;u.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=u.config.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):l.hostReportError(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;l.hostReportError(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};u.config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),u.config.useDeprecatedSynchronousErrorHandling)throw t;l.hostReportError(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!u.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return u.config.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(l.hostReportError(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(f);r.SafeSubscriber=p},{"../internal/symbol/rxSubscriber":58,"./Observer":51,"./Subscription":53,"./config":54,"./util/hostReportError":61,"./util/isFunction":64}],53:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./util/isArray"),o=t("./util/isObject"),i=t("./util/isFunction"),s=t("./util/UnsubscriptionError"),a=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var e;return t.prototype.unsubscribe=function(){var e;if(!this.closed){var r=this._parentOrParents,a=this._ctorUnsubscribe,u=this._unsubscribe,l=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof t)r.remove(this);else if(null!==r)for(var f=0;f<r.length;++f)r[f].remove(this);if(i.isFunction(u)){a&&(this._unsubscribe=void 0);try{u.call(this)}catch(t){e=t instanceof s.UnsubscriptionError?c(t.errors):[t]}}if(n.isArray(l)){f=-1;for(var p=l.length;++f<p;){var d=l[f];if(o.isObject(d))try{d.unsubscribe()}catch(t){e=e||[],t instanceof s.UnsubscriptionError?e=e.concat(c(t.errors)):e.push(t)}}}if(e)throw new s.UnsubscriptionError(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=((e=new t).closed=!0,e),t}();function c(t){return t.reduce((function(t,e){return t.concat(e instanceof s.UnsubscriptionError?e.errors:e)}),[])}r.Subscription=a},{"./util/UnsubscriptionError":59,"./util/isArray":63,"./util/isFunction":64,"./util/isObject":65}],54:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=!1;r.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else n&&console.log("RxJS: Back to a better error behavior. Thank you. <3");n=t},get useDeprecatedSynchronousErrorHandling(){return n}}},{}],55:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.filter=function(t,e){return function(r){return r.lift(new s(t,e))}};var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.predicate,this.thisArg))},t}(),a=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.predicate=r,o.thisArg=n,o.count=0,o}return o(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":52}],56:[function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=t("../Subscriber");r.map=function(t,e){return function(r){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new s(t,e))}};var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new a(t,this.project,this.thisArg))},t}();r.MapOperator=s;var a=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":52}],57:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},{}],58:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.rxSubscriber="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),r.$$rxSubscriber=r.rxSubscriber},{}],59:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}();r.UnsubscriptionError=n},{}],60:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Subscriber");r.canReportError=function(t){for(;t;){var e=t,r=e.closed,o=e.destination,i=e.isStopped;if(r||i)return!1;t=o&&o instanceof n.Subscriber?o:null}return!0}},{"../Subscriber":52}],61:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hostReportError=function(t){setTimeout((function(){throw t}),0)}},{}],62:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.identity=function(t){return t}},{}],63:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],64:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFunction=function(t){return"function"==typeof t}},{}],65:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isObject=function(t){return null!==t&&"object"==typeof t}},{}],66:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("./identity");function o(t){return 0===t.length?n.identity:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}r.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(t)},r.pipeFromArray=o},{"./identity":62}],67:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("../Subscriber"),o=t("../symbol/rxSubscriber"),i=t("../Observer");r.toSubscriber=function(t,e,r){if(t){if(t instanceof n.Subscriber)return t;if(t[o.rxSubscriber])return t[o.rxSubscriber]()}return t||e||r?new n.Subscriber(t,e,r):new n.Subscriber(i.empty)}},{"../Observer":51,"../Subscriber":52,"../symbol/rxSubscriber":58}],68:[function(t,e,r){"use strict";var n=t("url");e.exports=function(t,e,r){if(t===e)return!0;var o=n.parse(t,!1,!0),i=n.parse(e,!1,!0),s=0|o.port||("https"===o.protocol?443:80),a=0|i.port||("https"===i.protocol?443:80),c={proto:o.protocol===i.protocol,hostname:o.hostname===i.hostname,port:s===a};return c.proto&&c.hostname&&(c.port||r)}},{url:69}],69:[function(t,e,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;e.exports={regex:n,parse:function(t){var e=n.exec(t);return e?{protocol:(e[1]||"").toLowerCase()||void 0,hostname:(e[5]||"").toLowerCase()||void 0,port:e[6]||void 0}:{}}}},{}],70:[function(t,e,r){(function(r){(function(){"use strict";var n=t("requires-port"),o=t("querystringify"),i=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,s=/[\n\r\t]/g,a=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,c=/:\d+$/,u=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,l=/^[a-zA-Z]:/;function f(t){return(t||"").toString().replace(i,"")}var p=[["#","hash"],["?","query"],function(t,e){return b(e.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],d={hash:1,query:1};function h(t){var e,n=("undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:{}).location||{},o={},i=typeof(t=t||n);if("blob:"===t.protocol)o=new v(unescape(t.pathname),{});else if("string"===i)for(e in o=new v(t,{}),d)delete o[e];else if("object"===i){for(e in t)e in d||(o[e]=t[e]);void 0===o.slashes&&(o.slashes=a.test(t.href))}return o}function b(t){return"file:"===t||"ftp:"===t||"http:"===t||"https:"===t||"ws:"===t||"wss:"===t}function y(t,e){t=(t=f(t)).replace(s,""),e=e||{};var r,n=u.exec(t),o=n[1]?n[1].toLowerCase():"",i=!!n[2],a=!!n[3],c=0;return i?a?(r=n[2]+n[3]+n[4],c=n[2].length+n[3].length):(r=n[2]+n[4],c=n[2].length):a?(r=n[3]+n[4],c=n[3].length):r=n[4],"file:"===o?c>=2&&(r=r.slice(2)):b(o)?r=n[4]:o?i&&(r=r.slice(2)):c>=2&&b(e.protocol)&&(r=n[4]),{protocol:o,slashes:i||b(o),slashesCount:c,rest:r}}function v(t,e,r){if(t=(t=f(t)).replace(s,""),!(this instanceof v))return new v(t,e,r);var i,a,c,u,d,g,m=p.slice(),w=typeof e,O=this,_=0;for("object"!==w&&"string"!==w&&(r=e,e=null),r&&"function"!=typeof r&&(r=o.parse),i=!(a=y(t||"",e=h(e))).protocol&&!a.slashes,O.slashes=a.slashes||i&&e.slashes,O.protocol=a.protocol||e.protocol||"",t=a.rest,("file:"===a.protocol&&(2!==a.slashesCount||l.test(t))||!a.slashes&&(a.protocol||a.slashesCount<2||!b(O.protocol)))&&(m[3]=[/(.*)/,"pathname"]);_<m.length;_++)"function"!=typeof(u=m[_])?(c=u[0],g=u[1],c!=c?O[g]=t:"string"==typeof c?~(d="@"===c?t.lastIndexOf(c):t.indexOf(c))&&("number"==typeof u[2]?(O[g]=t.slice(0,d),t=t.slice(d+u[2])):(O[g]=t.slice(d),t=t.slice(0,d))):(d=c.exec(t))&&(O[g]=d[1],t=t.slice(0,d.index)),O[g]=O[g]||i&&u[3]&&e[g]||"",u[4]&&(O[g]=O[g].toLowerCase())):t=u(t,O);r&&(O.query=r(O.query)),i&&e.slashes&&"/"!==O.pathname.charAt(0)&&(""!==O.pathname||""!==e.pathname)&&(O.pathname=function(t,e){if(""===t)return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(O.pathname,e.pathname)),"/"!==O.pathname.charAt(0)&&b(O.protocol)&&(O.pathname="/"+O.pathname),n(O.port,O.protocol)||(O.host=O.hostname,O.port=""),O.username=O.password="",O.auth&&(~(d=O.auth.indexOf(":"))?(O.username=O.auth.slice(0,d),O.username=encodeURIComponent(decodeURIComponent(O.username)),O.password=O.auth.slice(d+1),O.password=encodeURIComponent(decodeURIComponent(O.password))):O.username=encodeURIComponent(decodeURIComponent(O.auth)),O.auth=O.password?O.username+":"+O.password:O.username),O.origin="file:"!==O.protocol&&b(O.protocol)&&O.host?O.protocol+"//"+O.host:"null",O.href=O.toString()}v.prototype={set:function(t,e,r){var i=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||o.parse)(e)),i[t]=e;break;case"port":i[t]=e,n(e,i.protocol)?e&&(i.host=i.hostname+":"+e):(i.host=i.hostname,i[t]="");break;case"hostname":i[t]=e,i.port&&(e+=":"+i.port),i.host=e;break;case"host":i[t]=e,c.test(e)?(e=e.split(":"),i.port=e.pop(),i.hostname=e.join(":")):(i.hostname=e,i.port="");break;case"protocol":i.protocol=e.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(e){var s="pathname"===t?"/":"#";i[t]=e.charAt(0)!==s?s+e:e}else i[t]=e;break;case"username":case"password":i[t]=encodeURIComponent(e);break;case"auth":var a=e.indexOf(":");~a?(i.username=e.slice(0,a),i.username=encodeURIComponent(decodeURIComponent(i.username)),i.password=e.slice(a+1),i.password=encodeURIComponent(decodeURIComponent(i.password))):i.username=encodeURIComponent(decodeURIComponent(e))}for(var u=0;u<p.length;u++){var l=p[u];l[4]&&(i[l[1]]=i[l[1]].toLowerCase())}return i.auth=i.password?i.username+":"+i.password:i.username,i.origin="file:"!==i.protocol&&b(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(t){t&&"function"==typeof t||(t=o.stringify);var e,r=this,n=r.host,i=r.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var s=i+(r.protocol&&r.slashes||b(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):"file:"!==r.protocol&&b(r.protocol)&&!n&&"/"!==r.pathname&&(s+="@"),(":"===n[n.length-1]||c.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,(e="object"==typeof r.query?t(r.query):r.query)&&(s+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(s+=r.hash),s}},v.extractProtocol=y,v.location=h,v.trimLeft=f,v.qs=o,e.exports=v}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:48,"requires-port":49}]},{},[16])(16)}));