@sanity/client 4.0.0-alpha.esm.6 → 4.0.1-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +23 -16
  3. package/dist/sanityClient.browser.mjs +2806 -0
  4. package/dist/sanityClient.browser.mjs.map +7 -0
  5. package/index.js +7 -0
  6. package/lib/assets/assetsClient.js +102 -142
  7. package/lib/auth/authClient.js +20 -35
  8. package/lib/config.js +21 -43
  9. package/lib/data/dataMethods.js +42 -67
  10. package/lib/data/encodeQueryString.js +9 -15
  11. package/lib/data/listen.js +27 -56
  12. package/lib/data/patch.js +114 -167
  13. package/lib/data/transaction.js +95 -139
  14. package/lib/datasets/datasetsClient.js +31 -56
  15. package/lib/generateHelpUrl.js +11 -0
  16. package/lib/http/browserMiddleware.js +4 -3
  17. package/lib/http/errors.js +9 -15
  18. package/lib/http/nodeMiddleware.js +6 -10
  19. package/lib/http/queryString.js +4 -7
  20. package/lib/http/request.js +14 -28
  21. package/lib/http/requestOptions.js +7 -10
  22. package/lib/projects/projectsClient.js +19 -34
  23. package/lib/sanityClient.js +100 -157
  24. package/lib/users/usersClient.js +14 -27
  25. package/lib/util/defaults.js +6 -8
  26. package/lib/util/getSelection.js +3 -5
  27. package/lib/util/once.js +4 -6
  28. package/lib/util/pick.js +4 -6
  29. package/lib/validators.js +0 -26
  30. package/lib/warnings.js +9 -13
  31. package/package.json +51 -40
  32. package/sanityClient.d.ts +262 -105
  33. package/umd/sanityClient.js +5474 -146
  34. package/umd/sanityClient.min.js +14 -1
  35. package/dist/browser/sanityClient.js +0 -4165
  36. package/dist/node/sanityClient.js +0 -969
  37. package/lib/util/observable.js +0 -29
  38. package/src/assets/assetsClient.js +0 -132
  39. package/src/auth/authClient.js +0 -13
  40. package/src/config.js +0 -93
  41. package/src/data/dataMethods.js +0 -182
  42. package/src/data/encodeQueryString.js +0 -18
  43. package/src/data/listen.js +0 -159
  44. package/src/data/patch.js +0 -119
  45. package/src/data/transaction.js +0 -103
  46. package/src/datasets/datasetsClient.js +0 -28
  47. package/src/http/browserMiddleware.js +0 -1
  48. package/src/http/errors.js +0 -53
  49. package/src/http/nodeMiddleware.js +0 -11
  50. package/src/http/queryString.js +0 -10
  51. package/src/http/request.js +0 -50
  52. package/src/http/requestOptions.js +0 -29
  53. package/src/projects/projectsClient.js +0 -13
  54. package/src/sanityClient.js +0 -124
  55. package/src/users/usersClient.js +0 -9
  56. package/src/util/defaults.js +0 -9
  57. package/src/util/getSelection.js +0 -17
  58. package/src/util/observable.js +0 -6
  59. package/src/util/once.js +0 -12
  60. package/src/util/pick.js +0 -9
  61. package/src/validators.js +0 -76
  62. package/src/warnings.js +0 -25
  63. package/test/client.test.js +0 -2561
  64. package/test/encodeQueryString.test.js +0 -38
  65. package/test/fixtures/horsehead-nebula.jpg +0 -0
  66. package/test/fixtures/pdf-sample.pdf +0 -0
  67. package/test/helpers/sseServer.js +0 -27
  68. package/test/listen.test.js +0 -207
  69. package/test/warnings.test.disabled.js +0 -84
@@ -1 +1,14 @@
1
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SanityClient=e()}}((function(){return function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,(function(e){return o(t[s][1][e]||e)}),l,l.exports,e,t,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(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.AssetsClient=void 0;var o=e("../util/observable"),i=e("../http/queryString"),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var u=i?Object.getOwnPropertyDescriptor(e,s):null;u&&(u.get||u.set)?Object.defineProperty(o,s,u):o[s]=e[s]}return o.default=e,r&&r.set(e,o),o}(e("../validators"));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:t})(e)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],s=!0,a=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(e,t)||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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var f=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.client=t}return function(e,t,r){t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"upload",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s.validateAssetType(e);var n=r.extract||void 0;n&&!n.length&&(n=["none"]);var i=s.hasDataset(this.client.clientConfig),a="image"===e?"images":"files",u=p(r,t),c=u.tag,l=u.label,f=u.title,d=u.description,h=u.creditLine,y=u.filename,b=u.source,v={label:l,title:f,description:d,filename:y,meta:n,creditLine:h};b&&(v.sourceId=b.id,v.sourceName=b.name,v.sourceUrl=b.url);var g=this.client._requestObservable({tag:c,method:"POST",timeout:u.timeout||0,uri:"/assets/".concat(a,"/").concat(i),headers:u.contentType?{"Content-Type":u.contentType}:{},query:v,body:t});return this.client.isPromiseAPI()?g.pipe((0,o.filter)((function(e){return"response"===e.type})),(0,o.map)((function(e){return e.body.document}))).toPromise():g}},{key:"delete",value:function(e,t){console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");var r=t||"";return/^(image|file)-/.test(r)?e._id&&(r=e._id):r="".concat(e,"-").concat(r),s.hasDataset(this.client.clientConfig),this.client.delete(r)}},{key:"getImageUrl",value:function(e,t){var r=e._ref||e;if("string"!=typeof r)throw new Error("getImageUrl() needs either an object with a _ref, or a string with an asset document ID");if(!/^image-[A-Za-z0-9_]+-\d+x\d+-[a-z]{1,5}$/.test(r))throw new Error('Unsupported asset ID "'.concat(r,'". URL generation only works for auto-generated IDs.'));var n=u(r.split("-"),4),o=n[1],a=n[2],c=n[3];s.hasDataset(this.client.clientConfig);var l=this.client.clientConfig,f=l.projectId,p=l.dataset,d=t?(0,i.queryString)(t):"";return"https://cdn.sanity.io/images/".concat(f,"/").concat(p,"/").concat(o,"-").concat(a,".").concat(c).concat(d)}}]),e}();function p(e,t){return"undefined"!=typeof window&&t instanceof window.File?Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e):e}r.AssetsClient=f},{"../http/queryString":12,"../util/observable":20,"../validators":23}],2:[function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.AuthClient=void 0;var o=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.client=t}return function(e,t,r){t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"getLoginProviders",value:function(){return this.client.request({uri:"/auth/providers"})}},{key:"logout",value:function(){return this.client.request({uri:"/auth/logout",method:"POST"})}}]),e}();r.AuthClient=o},{}],3:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.initConfig=r.defaultConfig=void 0,r.validateApiVersion=f;var o=e("@sanity/generate-help-url"),i=u(e("./validators")),s=u(e("./warnings"));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=a(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var u=i?Object.getOwnPropertyDescriptor(e,s):null;u&&(u.get||u.set)?Object.defineProperty(o,s,u):o[s]=e[s]}return o.default=e,r&&r.set(e,o),o}var c={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,isPromiseAPI:!0};r.defaultConfig=c;var l=["localhost","127.0.0.1","0.0.0.0"];function f(e){if("1"!==e&&"X"!==e){var t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}}r.initConfig=function(e,t){var r=Object.assign({},t,e);r.apiVersion||s.printNoApiVersionSpecifiedWarning();var n=Object.assign({},c,r),a=n.useProjectHostname;if("undefined"==typeof Promise){var u=(0,o.generateHelpUrl)("js-client-promise-polyfill");throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(u))}if(a&&!n.projectId)throw new Error("Configuration must contain `projectId`");var p="undefined"!=typeof window&&window.location&&window.location.hostname,d=p&&function(e){return-1!==l.indexOf(e)}(window.location.hostname);p&&d&&n.token&&!0!==n.ignoreBrowserTokenWarning?s.printBrowserTokenWarning():void 0===n.useCdn&&s.printCdnWarning(),a&&i.projectId(n.projectId),n.dataset&&i.dataset(n.dataset),"requestTagPrefix"in n&&(n.requestTagPrefix=n.requestTagPrefix?i.requestTag(n.requestTagPrefix).replace(/\.+$/,""):void 0),n.apiVersion="".concat(n.apiVersion).replace(/^v/,""),n.isDefaultApi=n.apiHost===c.apiHost,n.useCdn=Boolean(n.useCdn)&&!n.withCredentials,f(n.apiVersion);var h=n.apiHost.split("://",2),y=h[0],b=h[1],v=n.isDefaultApi?"apicdn.sanity.io":b;return n.useProjectHostname?(n.url="".concat(y,"://").concat(n.projectId,".").concat(b,"/v").concat(n.apiVersion),n.cdnUrl="".concat(y,"://").concat(n.projectId,".").concat(v,"/v").concat(n.apiVersion)):(n.url="".concat(n.apiHost,"/v").concat(n.apiVersion),n.cdnUrl=n.url),n}},{"./validators":23,"./warnings":24,"@sanity/generate-help-url":26}],4:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.dataMethods=void 0;var o=e("../util/observable"),i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=f(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(o,s,a):o[s]=e[s]}return o.default=e,r&&r.set(e,o),o}(e("../validators")),s=e("../util/getSelection"),a=e("./encodeQueryString"),u=e("./transaction"),c=e("./patch"),l=e("./listen");function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(f=function(e){return e?r:t})(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var d=function(e,t){return!1===e?void 0:void 0===e?t:e},h=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{dryRun:e.dryRun,returnIds:!0,returnDocuments:d(e.returnDocuments,!0),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation}},y=function(e){return"response"===e.type},b=function(e){return e.body},v=function(e,t){return e.reduce((function(e,r){return e[t(r)]=r,e}),Object.create(null))},g=function(e){return e.toPromise()},m={listen:l.listen,getDataUrl:function(e,t){var r=this.clientConfig,n=i.hasDataset(r),o="/".concat(e,"/").concat(n),s=t?"".concat(o,"/").concat(t):o;return"/data".concat(s).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((0,o.map)(n));return this.isPromiseAPI()?g(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((0,o.filter)(y),(0,o.map)((function(e){return e.body.documents&&e.body.documents[0]})));return this.isPromiseAPI()?g(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((0,o.filter)(y),(0,o.map)((function(t){var r=v(t.body.documents||[],(function(e){return e._id}));return e.map((function(e){return r[e]||null}))})));return this.isPromiseAPI()?g(n):n},create:function(e,t){return this._create(e,"create",t)},createIfNotExists:function(e,t){return i.requireDocumentId("createIfNotExists",e),this._create(e,"createIfNotExists",t)},createOrReplace:function(e,t){return i.requireDocumentId("createOrReplace",e),this._create(e,"createOrReplace",t)},patch:function(e,t){return new c.Patch(e,t,this)},delete:function(e,t){return this.dataRequest("mutate",{mutations:[{delete:(0,s.getSelection)(e)}]},t)},mutate:function(e,t){var r=e instanceof c.Patch||e instanceof u.Transaction?e.serialize():e,n=Array.isArray(r)?r:[r],o=t&&t.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:o},t)},transaction:function(e){return new u.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()?g(n):n},_dataRequest:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="mutate"===e,i="query"===e,s=!n&&(0,a.encodeQueryString)(t),u=!n&&s.length<11264,c=u?s:"",l=r.returnFirst,f=r.timeout,d=r.token,v=r.tag,g=r.headers,m={method:u?"GET":"POST",uri:this.getDataUrl(e,c),json:!0,body:u?void 0:t,query:n&&h(r),timeout:f,headers:g,token:d,tag:v,canUseCdn:i};return this._requestObservable(m).pipe((0,o.filter)(y),(0,o.map)(b),(0,o.map)((function(e){if(!n)return e;var t=e.results||[];if(r.returnDocuments)return l?t[0]&&t[0].document:t.map((function(e){return e.document}));var o=l?"documentId":"documentIds",i=l?t[0]&&t[0].id:t.map((function(e){return e.id}));return p({transactionId:e.transactionId,results:t},o,i)})))},_create:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=p({},t,e),o=Object.assign({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},o)}};r.dataMethods=m},{"../util/getSelection":19,"../util/observable":20,"../validators":23,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8}],5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.encodeQueryString=void 0;var n=["tag"];function o(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=encodeURIComponent;r.encodeQueryString=function(e){var t=e.query,r=e.params,s=void 0===r?{}:r,a=e.options,u=void 0===a?{}:a,c=u.tag,l=o(u,n),f="query=".concat(i(t)),p=c?"?tag=".concat(i(c),"&").concat(f):"?".concat(f),d=Object.keys(s).reduce((function(e,t){return"".concat(e,"&").concat(i("$".concat(t)),"=").concat(i(JSON.stringify(s[t])))}),p);return Object.keys(l).reduce((function(e,t){return u[t]?"".concat(e,"&").concat(i(t),"=").concat(i(u[t])):e}),d)}},{}],6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.listen=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.clientConfig,i=n.url,c=n.token,f=n.withCredentials,v=n.requestTagPrefix,g=r.tag&&v?[v,r.tag].join("."):r.tag,m=l(l({},(0,a.defaults)(r,h)),{},{tag:g}),w=(0,s.pick)(m,d),O=(0,u.encodeQueryString)({query:e,params:t,options:w,tag:g}),_="".concat(i).concat(this.getDataUrl("listen",O));if(_.length>14800)return new o.Observable((function(e){return e.error(new Error("Query too large for listener"))}));var j=m.events?m.events:["mutation"],S=-1!==j.indexOf("reconnect"),E={};return(c||f)&&(E.withCredentials=!0),c&&(E.headers={Authorization:"Bearer ".concat(c)}),new o.Observable((function(e){var t,r=c(),n=!1;function o(){n||(S&&e.next({type:"reconnect"}),n||r.readyState===p.CLOSED&&(u(),clearTimeout(t),t=setTimeout(l,100)))}function i(t){e.error(b(t))}function s(t){var r=y(t);return r instanceof Error?e.error(r):e.next(r)}function a(t){n=!0,u(),e.complete()}function u(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",i,!1),r.removeEventListener("disconnect",a,!1),j.forEach((function(e){return r.removeEventListener(e,s,!1)})),r.close()}function c(){var e=new p(_,E);return e.addEventListener("error",o,!1),e.addEventListener("channelError",i,!1),e.addEventListener("disconnect",a,!1),j.forEach((function(t){return e.addEventListener(t,s,!1)})),e}function l(){r=c()}return function(){n=!0,u()}}))};var n,o=e("../util/observable"),i=(n=e("@sanity/eventsource"))&&n.__esModule?n:{default:n},s=e("../util/pick"),a=e("../util/defaults"),u=e("./encodeQueryString");function c(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 l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var p=i.default,d=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],h={includeResult:!0};function y(e){try{var t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}function b(e){if(e instanceof Error)return e;var t=y(e);return t instanceof Error?t:new Error(function(e){return e.error?e.error.description?e.error.description:"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2):e.message||"Unknown listener error"}(t))}},{"../util/defaults":18,"../util/observable":20,"../util/pick":22,"./encodeQueryString":5,"@sanity/eventsource":25}],7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Patch=void 0;var n=e("../util/getSelection"),o=e("../validators");function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var u=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;s(this,e),this.selection=t,this.operations=Object.assign({},r),this.client=n}return function(e,t,r){t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"clone",value:function(){return new e(this.selection,Object.assign({},this.operations),this.client)}},{key:"set",value:function(e){return this._assign("set",e)}},{key:"diffMatchPatch",value:function(e){return(0,o.validateObject)("diffMatchPatch",e),this._assign("diffMatchPatch",e)}},{key:"unset",value:function(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}},{key:"setIfMissing",value:function(e){return this._assign("setIfMissing",e)}},{key:"replace",value:function(e){return(0,o.validateObject)("replace",e),this._set("set",{$:e})}},{key:"inc",value:function(e){return this._assign("inc",e)}},{key:"dec",value:function(e){return this._assign("dec",e)}},{key:"insert",value:function(e,t,r){var n;return(0,o.validateInsert)(e,t,r),this._assign("insert",(i(n={},e,t),i(n,"items",r),n))}},{key:"append",value:function(e,t){return this.insert("after","".concat(e,"[-1]"),t)}},{key:"prepend",value:function(e,t){return this.insert("before","".concat(e,"[0]"),t)}},{key:"splice",value:function(e,t,r,n){var o=t<0?t-1:t,i=void 0===r||-1===r?-1:Math.max(0,t+r),s=o<0&&i>=0?"":i,a="".concat(e,"[").concat(o,":").concat(s,"]");return this.insert("replace",a,n||[])}},{key:"ifRevisionId",value:function(e){return this.operations.ifRevisionID=e,this}},{key:"serialize",value:function(){return Object.assign((0,n.getSelection)(this.selection),this.operations)}},{key:"toJSON",value:function(){return this.serialize()}},{key:"commit",value:function(){var e=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 t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return this.client.mutate({patch:this.serialize()},r)}},{key:"reset",value:function(){return this.operations={},this}},{key:"_set",value:function(e,t){return this._assign(e,t,!1)}},{key:"_assign",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(0,o.validateObject)(e,t),this.operations=Object.assign({},this.operations,i({},e,Object.assign({},r&&this.operations[e]||{},t))),this}}]),e}();r.Patch=u},{"../util/getSelection":19,"../validators":23}],8:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.Transaction=void 0;var o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=s(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var u=i?Object.getOwnPropertyDescriptor(e,a):null;u&&(u.get||u.set)?Object.defineProperty(o,a,u):o[a]=e[a]}return o.default=e,r&&r.set(e,o),o}(e("../validators")),i=e("./patch");function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(s=function(e){return e?r:t})(e)}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l={returnDocuments:!1},f=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;u(this,e),this.trxId=n,this.operations=t,this.client=r}return function(e,t,r){t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"clone",value:function(){return new e(this.operations.slice(0),this.client,this.trxId)}},{key:"create",value:function(e){return o.validateObject("create",e),this._add({create:e})}},{key:"createIfNotExists",value:function(e){var t="createIfNotExists";return o.validateObject(t,e),o.requireDocumentId(t,e),this._add(a({},t,e))}},{key:"createOrReplace",value:function(e){var t="createOrReplace";return o.validateObject(t,e),o.requireDocumentId(t,e),this._add(a({},t,e))}},{key:"delete",value:function(e){return o.validateDocumentId("delete",e),this._add({delete:{id:e}})}},{key:"patch",value:function(e,t){var r="function"==typeof t;if(e instanceof i.Patch)return this._add({patch:e.serialize()});if(r){var n=t(new i.Patch(e,{},this.client));if(!(n instanceof i.Patch))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:Object.assign({id:e},t)})}},{key:"transactionId",value:function(e){return e?(this.trxId=e,this):this.trxId}},{key:"serialize",value:function(){return this.operations.slice()}},{key:"toJSON",value:function(){return this.serialize()}},{key:"commit",value:function(e){if(!this.client)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.client.mutate(this.serialize(),Object.assign({transactionId:this.trxId},l,e||{}))}},{key:"reset",value:function(){return this.operations=[],this}},{key:"_add",value:function(e){return this.operations.push(e),this}}]),e}();r.Transaction=f},{"../validators":23,"./patch":7}],9:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.DatasetsClient=void 0;var o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var u=s?Object.getOwnPropertyDescriptor(e,a):null;u&&(u.get||u.set)?Object.defineProperty(o,a,u):o[a]=e[a]}return o.default=e,r&&r.set(e,o),o}(e("../validators"));function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.request=t.request.bind(t)}return function(e,t,r){t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"create",value:function(e,t){return this._modify("PUT",e,t)}},{key:"edit",value:function(e,t){return this._modify("PATCH",e,t)}},{key:"delete",value:function(e){return this._modify("DELETE",e)}},{key:"list",value:function(){return this.request({uri:"/datasets"})}},{key:"_modify",value:function(e,t,r){return o.dataset(t),this.request({method:e,uri:"/datasets/".concat(t),body:r})}}]),e}();r.DatasetsClient=a},{"../validators":23}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.middleware=void 0;r.middleware=[]},{}],11:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ClientError=i,r.ServerError=s;var n,o=(n=e("make-error"))&&n.__esModule?n:{default:n};function i(e){var t=a(e);i.super.call(this,t.message),Object.assign(this,t)}function s(e){var t=a(e);s.super.call(this,t.message),Object.assign(this,t)}function a(e){var t=e.body,r={response:e,statusCode:e.statusCode,responseBody:u(t,e)};return t.error&&t.message?(r.message="".concat(t.error," - ").concat(t.message),r):t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){var t=e.statusMessage?" ".concat(e.statusMessage):"";return"".concat(e.method,"-request to ").concat(e.url," resulted in HTTP ").concat(e.statusCode).concat(t)}(e),r)}function u(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}(0,o.default)(i),(0,o.default)(s)},{"make-error":44}],12:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.queryString=void 0;r.queryString=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(e[r])));return t.length>0?"?".concat(t.join("&")):""}},{}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.httpRequest=y;var n=l(e("get-it")),o=l(e("get-it/lib/middleware/observable")),i=l(e("get-it/lib/middleware/jsonRequest")),s=l(e("get-it/lib/middleware/jsonResponse")),a=l(e("get-it/lib/middleware/progress")),u=e("../util/observable"),c=e("./errors");function l(e){return e&&e.__esModule?e:{default:e}}var f={onResponse:function(e){if(e.statusCode>=500)throw new c.ServerError(e);if(e.statusCode>=400)throw new c.ClientError(e);return e}},p={onResponse:function(e){var t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((function(e){return console.warn(e)})),e}},d=e("./nodeMiddleware").middleware.concat([p,(0,i.default)(),(0,s.default)(),(0,a.default)(),f,(0,o.default)({implementation:u.Observable})]),h=(0,n.default)(d);function y(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:h)(Object.assign({maxRedirects:0},e))}y.defaultRequester=h,y.ClientError=c.ClientError,y.ServerError=c.ServerError},{"../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}],14:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.requestOptions=void 0;var n="X-Sanity-Project-ID";r.requestOptions=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},o=t.token||e.token;o&&(r.Authorization="Bearer ".concat(o)),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r[n]=e.projectId);var i=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:i})}},{}],15:[function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.ProjectsClient=void 0;var o=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.client=t}return function(e,t,r){t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"list",value:function(){return this.client.request({uri:"/projects"})}},{key:"getById",value:function(e){return this.client.request({uri:"/projects/".concat(e)})}}]),e}();r.ProjectsClient=o},{}],16:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.SanityClient=void 0,r.createClient=j;var o=e("./util/observable"),i=e("./data/patch"),s=e("./data/transaction"),a=e("./data/dataMethods"),u=e("./datasets/datasetsClient"),c=e("./projects/projectsClient"),l=e("./assets/assetsClient"),f=e("./users/usersClient"),p=e("./auth/authClient"),d=e("./http/request"),h=e("./http/requestOptions"),y=e("./config"),b=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=v(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(o,s,a):o[s]=e[s]}return o.default=e,r&&r.set(e,o),o}(e("./validators"));function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(v=function(e){return e?r:t})(e)}function g(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 m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var _=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y.defaultConfig;if(w(this,e),this.config(t),this.assets=new l.AssetsClient(this),this.datasets=new u.DatasetsClient(this),this.projects=new c.ProjectsClient(this),this.users=new f.UsersClient(this),this.auth=new p.AuthClient(this),this.clientConfig.isPromiseAPI){var r=Object.assign({},this.clientConfig,{isPromiseAPI:!1});this.observable=new e(r)}}return function(e,t,r){t&&O(e.prototype,t),r&&O(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"clone",value:function(){return new e(this.config())}},{key:"config",value:function(e){if(void 0===e)return Object.assign({},this.clientConfig);if(this.observable){var t=Object.assign({},e,{isPromiseAPI:!1});this.observable.config(t)}return this.clientConfig=(0,y.initConfig)(e,this.clientConfig||{}),this}},{key:"withConfig",value:function(e){return this.clone().config(e)}},{key:"getUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.clientConfig.cdnUrl:this.clientConfig.url;return"".concat(t,"/").concat(e.replace(/^\//,""))}},{key:"isPromiseAPI",value:function(){return this.clientConfig.isPromiseAPI}},{key:"_requestObservable",value:function(e){var t=this,r=e.url||e.uri,n=void 0===e.canUseCdn?["GET","HEAD"].indexOf(e.method||"GET")>=0&&0===r.indexOf("/data/"):e.canUseCdn,i=this.clientConfig.useCdn&&n,s=e.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,e.tag].join("."):e.tag||this.clientConfig.requestTagPrefix;s&&(e.query=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){m(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({tag:b.requestTag(s)},e.query));var a=(0,h.requestOptions)(this.clientConfig,Object.assign({},e,{url:this.getUrl(r,i)}));return new o.Observable((function(e){return(0,d.httpRequest)(a,t.clientConfig.requester).subscribe(e)}))}},{key:"request",value:function(e){var t=this._requestObservable(e).pipe((0,o.filter)((function(e){return"response"===e.type})),(0,o.map)((function(e){return e.body})));return this.isPromiseAPI()?function(e){return e.toPromise()}(t):t}}]),e}();function j(e){return new _(e)}r.SanityClient=_,Object.assign(_.prototype,a.dataMethods),_.Patch=i.Patch,_.Transaction=s.Transaction,_.ClientError=d.httpRequest.ClientError,_.ServerError=d.httpRequest.ServerError,_.requester=d.httpRequest.defaultRequester,j.Patch=i.Patch,j.Transaction=s.Transaction,j.ClientError=d.httpRequest.ClientError,j.ServerError=d.httpRequest.ServerError,j.requester=d.httpRequest.defaultRequester},{"./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}],17:[function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.UsersClient=void 0;var o=function(){function e(t){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.client=t}return function(e,t,r){t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"getById",value:function(e){return this.client.request({uri:"/users/".concat(e)})}}]),e}();r.UsersClient=o},{}],18:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.defaults=void 0;r.defaults=function(e,t){return Object.keys(t).concat(Object.keys(e)).reduce((function(r,n){return r[n]=void 0===e[n]?t[n]:e[n],r}),{})}},{}],19:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getSelection=function(e){if("string"==typeof e||Array.isArray(e))return{id:e};if(e&&e.query)return"params"in e?{query:e.query,params:e.params}:{query:e.query};var t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n".concat(t))}},{}],20:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"Observable",{enumerable:!0,get:function(){return n.Observable}}),Object.defineProperty(r,"filter",{enumerable:!0,get:function(){return o.filter}}),Object.defineProperty(r,"map",{enumerable:!0,get:function(){return i.map}});var n=e("rxjs/internal/Observable"),o=e("rxjs/internal/operators/filter"),i=e("rxjs/internal/operators/map")},{"rxjs/internal/Observable":50,"rxjs/internal/operators/filter":55,"rxjs/internal/operators/map":56}],21:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.once=void 0;r.once=function(e){var t,r=!1;return function(){return r||(t=e.apply(void 0,arguments),r=!0),t}}},{}],22:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.pick=void 0;r.pick=function(e,t){return t.reduce((function(t,r){return void 0===e[r]||(t[r]=e[r]),t}),{})}},{}],23:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.validateObject=r.validateInsert=r.validateDocumentId=r.validateAssetType=r.requireDocumentId=r.requestTag=r.projectId=r.hasDataset=r.dataset=void 0;var o=["image","file"],i=["before","after","replace"];r.dataset=function(e){if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")};r.projectId=function(e){if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")};r.validateAssetType=function(e){if(-1===o.indexOf(e))throw new Error("Invalid asset type: ".concat(e,". Must be one of ").concat(o.join(", ")))};r.validateObject=function(e,t){if(null===t||"object"!==n(t)||Array.isArray(t))throw new Error("".concat(e,"() takes an object of properties"))};var s=function(e,t){if("string"!=typeof t||!/^[a-z0-9_.-]+$/i.test(t))throw new Error("".concat(e,'(): "').concat(t,'" is not a valid document ID'))};r.validateDocumentId=s;r.requireDocumentId=function(e,t){if(!t._id)throw new Error("".concat(e,'() requires that the document contains an ID ("_id" property)'));s(e,t._id)};r.validateInsert=function(e,t,r){var n="insert(at, selector, items)";if(-1===i.indexOf(e)){var o=i.map((function(e){return'"'.concat(e,'"')})).join(", ");throw new Error("".concat(n,' takes an "at"-argument which is one of: ').concat(o))}if("string"!=typeof t)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(e){if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""};r.requestTag=function(e){if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e}},{}],24:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.printNoApiVersionSpecifiedWarning=r.printCdnWarning=r.printBrowserTokenWarning=void 0;var n=e("@sanity/generate-help-url"),o=e("./util/once"),i=function(e){return(0,o.once)((function(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=console).warn.apply(t,[e.join(" ")].concat(n))}))},s=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((0,n.generateHelpUrl)("js-client-cdn-configuration"),"."),"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]);r.printCdnWarning=s;var a=i(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.","See ".concat((0,n.generateHelpUrl)("js-client-browser-token")," for more information and how to hide this warning.")]);r.printBrowserTokenWarning=a;var u=i(["Using the Sanity client without specifying an API version is deprecated.","See ".concat((0,n.generateHelpUrl)("js-client-api-version"))]);r.printNoApiVersionSpecifiedWarning=u},{"./util/once":21,"@sanity/generate-help-url":26}],25:[function(e,t,r){var n=e("event-source-polyfill");t.exports=n.EventSourcePolyfill},{"event-source-polyfill":27}],26:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module";r.generateHelpUrl=function(e){return"https://docs.sanity.io/help/"+e}},{}],27:[function(e,t,r){!function(e){"use strict";var n=e.setTimeout,o=e.clearTimeout,i=e.XMLHttpRequest,s=e.XDomainRequest,a=e.ActiveXObject,u=e.EventSource,c=e.document,l=e.Promise,f=e.fetch,p=e.Response,d=e.TextDecoder,h=e.TextEncoder,y=e.AbortController;if("undefined"==typeof window||void 0===c||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(e){c.readyState="complete"}),!1)),null==i&&null!=a&&(i=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var b=f;f=function(e,t){var r=t.signal;return b(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return r._reader=t,r._aborted&&r._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function v(){this.bitsNeeded=0,this.codePoint=0}v.prototype.decode=function(e){function t(e,t,r){if(1===r)return e>=128>>t&&e<<t<=2047;if(2===r)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===r)return e>=65536>>t&&e<<t<=1114111;throw new Error}function r(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var n="",o=this.bitsNeeded,i=this.codePoint,s=0;s<e.length;s+=1){var a=e[s];0!==o&&(a<128||a>191||!t(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||t(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(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(d=v);var g=function(){};function m(e){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=e,this._sendTimeout=0,this._abort=g}function w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function O(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),i=o.shift(),s=o.join(": ");t[w(i)]=s}this._map=t}function _(){}function j(e){this._headers=e}function S(){}function E(){this._listeners=Object.create(null)}function P(e){n((function(){throw e}),0)}function C(e){this.type=e,this.target=void 0}function x(e,t){C.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function T(e,t){C.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function k(e,t){C.call(this,e),this.error=t.error}m.prototype.open=function(e,t){this._abort(!0);var r=this,s=this._xhr,a=1,u=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,s.onload=g,s.onerror=g,s.onabort=g,s.onprogress=g,s.onreadystatechange=g,s.abort(),0!==u&&(o(u),u=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var c=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in s)e=200,t="OK",n=s.contentType;else try{e=s.status,t=s.statusText,n=s.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(a=2,r.readyState=2,r.status=e,r.statusText=t,r._contentType=n,r.onreadystatechange())}},l=function(){if(c(),2===a||3===a){a=3;var e="";try{e=s.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},f=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:g}),l(),1===a||2===a||3===a){if(a=4,0!==u&&(o(u),u=0),r.readyState=4,"load"===e)r.onload(t);else if("error"===e)r.onerror(t);else{if("abort"!==e)throw new TypeError;r.onabort(t)}r.onreadystatechange()}},p=function(){u=n((function(){p()}),500),3===s.readyState&&l()};"onload"in s&&(s.onload=function(e){f("load",e)}),"onerror"in s&&(s.onerror=function(e){f("error",e)}),"onabort"in s&&(s.onabort=function(e){f("abort",e)}),"onprogress"in s&&(s.onprogress=l),"onreadystatechange"in s&&(s.onreadystatechange=function(e){!function(e){null!=s&&(4===s.readyState?"onload"in s&&"onerror"in s&&"onabort"in s||f(""===s.responseText?"error":"load",e):3===s.readyState?"onprogress"in s||l():2===s.readyState&&c())}(e)}),!("contentType"in s)&&"ontimeout"in i.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),s.open(e,t,!0),"readyState"in s&&(u=n((function(){p()}),0))},m.prototype.abort=function(){this._abort(!1)},m.prototype.getResponseHeader=function(e){return this._contentType},m.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},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==c||null==c.readyState||"complete"===c.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=n((function(){t._sendTimeout=0,t.send()}),4)}},O.prototype.get=function(e){return this._map[w(e)]},null!=i&&null==i.HEADERS_RECEIVED&&(i.HEADERS_RECEIVED=2),_.prototype.open=function(e,t,r,n,o,s,a){e.open("GET",o);var u=0;for(var c in e.onprogress=function(){var t=e.responseText.slice(u);u+=t.length,r(t)},e.onerror=function(e){e.preventDefault(),n(new Error("NetworkError"))},e.onload=function(){n(null)},e.onabort=function(){n(null)},e.onreadystatechange=function(){if(e.readyState===i.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),s=e.getAllResponseHeaders();t(r,n,o,new O(s))}},e.withCredentials=s,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},j.prototype.get=function(e){return this._headers.get(e)},S.prototype.open=function(e,t,r,n,o,i,s){var a=null,u=new y,c=u.signal,p=new d;return f(o,{headers:s,credentials:i?"include":"same-origin",signal:c,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new j(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=p.decode(t.value,{stream:!0});r(o),n()}})).catch((function(e){t(e)}))};n()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){n(e)})),{abort:function(){null!=a&&a.cancel(),u.abort()}}},E.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var r=t.length,n=0;n<r;n+=1){var o=t[n];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){P(e)}}},E.prototype.addEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];null==n&&(n=[],r[e]=n);for(var o=!1,i=0;i<n.length;i+=1)n[i]===t&&(o=!0);o||n.push(t)},E.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],i=0;i<n.length;i+=1)n[i]!==t&&o.push(n[i]);0===o.length?delete r[e]:r[e]=o}},x.prototype=Object.create(C.prototype),T.prototype=Object.create(C.prototype),k.prototype=Object.create(C.prototype);var q=/^text\/event\-stream(;.*)?$/i,R=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),A(r)},A=function(e){return Math.min(Math.max(e,1e3),18e6)},D=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){P(e)}};function I(e,t){E.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,r){t=String(t);var a=Boolean(r.withCredentials),u=r.lastEventIdQueryParameterName||"lastEventId",c=A(1e3),l=R(r.heartbeatTimeout,45e3),f="",p=c,d=!1,h=0,y=r.headers||{},b=r.Transport,v=M&&null==b?void 0:new m(null!=b?new b:null!=i&&"withCredentials"in i.prototype||null==s?new i:new s),g=null!=b&&"string"!=typeof b?new b:null==v?new S:new _,w=void 0,O=0,j=-1,E="",P="",C="",I="",U=0,H=0,N=0,L=function(t,r,n,o){if(0===j)if(200===t&&null!=n&&q.test(n)){j=1,d=Date.now(),p=c,e.readyState=1;var i=new T("open",{status:t,statusText:r,headers:o});e.dispatchEvent(i),D(e,e.onopen,i)}else{var s="";200!==t?(r&&(r=r.replace(/\s+/g," ")),s="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):s="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",V();i=new T("error",{status:t,statusText:r,headers:o});e.dispatchEvent(i),D(e,e.onerror,i),console.error(s)}},z=function(t){if(1===j){for(var r=-1,i=0;i<t.length;i+=1){(u=t.charCodeAt(i))!=="\n".charCodeAt(0)&&u!=="\r".charCodeAt(0)||(r=i)}var s=(-1!==r?I:"")+t.slice(0,r+1);I=(-1===r?I:"")+t.slice(r+1),""!==t&&(d=Date.now(),h+=t.length);for(var a=0;a<s.length;a+=1){var u=s.charCodeAt(a);if(-1===U&&u==="\n".charCodeAt(0))U=0;else if(-1===U&&(U=0),u==="\r".charCodeAt(0)||u==="\n".charCodeAt(0)){if(0!==U){1===U&&(N=a+1);var y=s.slice(H,N-1),b=s.slice(N+(N<a&&s.charCodeAt(N)===" ".charCodeAt(0)?1:0),a);"data"===y?(E+="\n",E+=b):"id"===y?P=b:"event"===y?C=b:"retry"===y?(c=R(b,c),p=c):"heartbeatTimeout"===y&&(l=R(b,l),0!==O&&(o(O),O=n((function(){B()}),l)))}if(0===U){if(""!==E){f=P,""===C&&(C="message");var v=new x(C,{data:E.slice(1),lastEventId:P});if(e.dispatchEvent(v),"open"===C?D(e,e.onopen,v):"message"===C?D(e,e.onmessage,v):"error"===C&&D(e,e.onerror,v),2===j)return}E="",C=""}U=u==="\r".charCodeAt(0)?-1:0}else 0===U&&(H=a,U=1),1===U?u===":".charCodeAt(0)&&(N=a+1,U=2):2===U&&(U=3)}}},W=function(t){if(1===j||0===j){j=-1,0!==O&&(o(O),O=0),O=n((function(){B()}),p),p=A(Math.min(16*c,2*p)),e.readyState=0;var r=new k("error",{error:t});e.dispatchEvent(r),D(e,e.onerror,r),null!=t&&console.error(t)}},V=function(){j=2,null!=w&&(w.abort(),w=void 0),0!==O&&(o(O),O=0),e.readyState=2},B=function(){if(O=0,-1===j){d=!1,h=0,O=n((function(){B()}),l),j=0,E="",C="",P=f,I="",H=0,N=0,U=0;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==f){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===u?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+u+"="+encodeURIComponent(f)}var i=e.withCredentials,s={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(s[c]=a[c]);try{w=g.open(v,L,z,W,r,i,s)}catch(e){throw V(),e}}else if(d||null==w){var p=Math.max((d||Date.now())+l-Date.now(),1);d=!1,O=n((function(){B()}),p)}else W(new Error("No activity within "+l+" milliseconds. "+(0===j?"No response received.":h+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=V,B()}(this,e,t)}var M=null!=f&&null!=p&&"body"in p.prototype;I.prototype=Object.create(E.prototype),I.prototype.CONNECTING=0,I.prototype.OPEN=1,I.prototype.CLOSED=2,I.prototype.close=function(){this._close()},I.CONNECTING=0,I.OPEN=1,I.CLOSED=2,I.prototype.withCredentials=void 0;var U=u;null==i||null!=u&&"withCredentials"in u.prototype||(U=I),function(n){if("object"==typeof t&&"object"==typeof t.exports){var o=n(r);void 0!==o&&(t.exports=o)}else n(e)}((function(e){e.EventSourcePolyfill=I,e.NativeEventSource=u,e.EventSource=U}))}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:this:globalThis)},{}],28:[function(e,t,r){t.exports=e("./lib-node")},{"./lib-node":29}],29:[function(e,t,r){"use strict";var n=e("nano-pubsub"),o=e("./util/middlewareReducer"),i=e("./middleware/defaultOptionsProcessor"),s=e("./middleware/defaultOptionsValidator"),a=e("./request"),u=["request","response","progress","error","abort"],c=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];t.exports=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,l=[],f=c.reduce((function(e,t){return e[t]=e[t]||[],e}),{processOptions:[i],validateOptions:[s]});function p(e){var t=u.reduce((function(e,t){return e[t]=n(),e}),{}),i=o(f),s=i("processOptions",e);i("validateOptions",s);var a={options:s,channels:t,applyMiddleware:i},c=null,l=t.request.subscribe((function(e){c=r(e,(function(r,n){return function(e,r,n){var o=e,s=r;if(!o)try{s=i("onResponse",r,n)}catch(e){s=null,o=e}(o=o&&i("onError",o,n))?t.error.publish(o):s&&t.response.publish(s)}(r,n,e)}))}));t.abort.subscribe((function(){l(),c&&c.abort()}));var p=i("onReturn",t,a);return p===t&&t.request.publish(a),p}return p.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&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 c.forEach((function(t){e[t]&&f[t].push(e[t])})),l.push(e),p},p.clone=function(){return e(l)},t.forEach(p.use),p}},{"./middleware/defaultOptionsProcessor":30,"./middleware/defaultOptionsValidator":31,"./request":39,"./util/middlewareReducer":41,"nano-pubsub":45}],30:[function(e,t,r){"use strict";var n=e("object-assign"),o=e("url-parse"),i="undefined"!=typeof navigator&&"ReactNative"===navigator.product,s=Object.prototype.hasOwnProperty,a={timeout:i?6e4:12e4};function u(e){var t=[];for(var r in e)s.call(e,r)&&n(r,e[r]);return t.length?t.join("&"):"";function n(e,r){Array.isArray(r)?r.forEach((function(t){return n(e,t)})):t.push([e,r].map(encodeURIComponent).join("="))}}function c(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;var t=Number(e);return isNaN(t)?c(a.timeout):{connect:t,socket:t}}t.exports=function(e){var t="string"==typeof e?n({url:e},a):n({},a,e),r=o(t.url,{},!0);return t.timeout=c(t.timeout),t.query&&(r.query=n({},r.query,function(e){var t={};for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}(t.query))),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=r.toString(u),t}},{"object-assign":46,"url-parse":70}],31:[function(e,t,r){"use strict";var n=/^https?:\/\//i;t.exports=function(e){if(!n.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))}},{}],32:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=e("object-assign"),i=e("is-plain-object"),s=["boolean","string","number"];t.exports=function(){return{processOptions:function(e){var t=e.body;return t&&"function"!=typeof t.pipe&&!function(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}(t)&&(-1!==s.indexOf(n(t))||Array.isArray(t)||i(t))?o({},e,{body:JSON.stringify(e.body),headers:o({},e.headers,{"Content-Type":"application/json"})}):e}}}},{"is-plain-object":42,"object-assign":46}],33:[function(e,t,r){"use strict";var n=e("object-assign");function o(e){try{return JSON.parse(e)}catch(e){throw e.message="Failed to parsed response body as JSON: ".concat(e.message),e}}t.exports=function(e){return{onResponse:function(t){var r=t.headers["content-type"]||"",i=e&&e.force||-1!==r.indexOf("application/json");return t.body&&r&&i?n({},t,{body:o(t.body)}):t},processOptions:function(e){return n({},e,{headers:n({Accept:"application/json"},e.headers)})}}}},{"object-assign":46}],34:[function(e,t,r){"use strict";var n=e("../util/global"),o=e("object-assign");t.exports=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).implementation||n.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:function(t,r){return new e((function(e){return t.error.subscribe((function(t){return e.error(t)})),t.progress.subscribe((function(t){return e.next(o({type:"progress"},t))})),t.response.subscribe((function(t){e.next(o({type:"response"},t)),e.complete()})),t.request.publish(r),function(){return t.abort.publish()}}))}}}},{"../util/global":40,"object-assign":46}],35:[function(e,t,r){"use strict";t.exports=function(){return{onRequest:function(e){if("xhr"===e.adapter){var t=e.request,r=e.context;"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}function n(e){return function(t){var n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}}}}},{}],36:[function(e,t,r){"use strict";t.exports=e("./node-progress")},{"./node-progress":35}],37:[function(e,t,r){"use strict";var n=e("same-origin"),o=e("parse-headers"),i=e("./browser/fetchXhr"),s="undefined"==typeof window?void 0:window,a=s?"xhr":"fetch",u="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){},c="withCredentials"in new u,l="undefined"==typeof XDomainRequest?void 0:XDomainRequest,f=c?u:l;s||(u=i,f=i),t.exports=function(e,t){var r=e.options,i=e.applyMiddleware("finalizeOptions",r),c={},l=s&&s.location&&!n(s.location.href,i.url),p=e.applyMiddleware("interceptRequest",void 0,{adapter:a,context:e});if(p){var d=setTimeout(t,0,null,p);return{abort:function(){return clearTimeout(d)}}}var h=l?new f:new u,y=s&&s.XDomainRequest&&h instanceof s.XDomainRequest,b=i.headers,v=i.timeout,g=!1,m=!1,w=!1;if(h.onerror=S,h.ontimeout=S,h.onabort=function(){j(!0),g=!0},h.onprogress=function(){},h[y?"onload":"onreadystatechange"]=function(){v&&(j(),c.socket=setTimeout((function(){return _("ESOCKETTIMEDOUT")}),v.socket)),g||4!==h.readyState&&!y||0!==h.status&&(g||m||w||(0!==h.status?(j(),m=!0,t(null,function(){var e=h.status,t=h.statusText;if(y&&void 0===e)e=200;else{if(e>12e3&&e<12156)return S();e=1223===h.status?204:h.status,t=1223===h.status?"No Content":t}return{body:h.response||h.responseText,url:i.url,method:i.method,headers:y?{}:o(h.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())):S(new Error("Unknown XHR error"))))},h.open(i.method,i.url,!0),h.withCredentials=!!i.withCredentials,b&&h.setRequestHeader)for(var O in b)b.hasOwnProperty(O)&&h.setRequestHeader(O,b[O]);else if(b&&y)throw new Error("Headers cannot be set on an XDomainRequest object");return i.rawBody&&(h.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:i,adapter:a,request:h,context:e}),h.send(i.body||null),v&&(c.connect=setTimeout((function(){return _("ETIMEDOUT")}),v.connect)),{abort:function(){g=!0,h&&h.abort()}};function _(t){w=!0,h.abort();var r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(i.url):"Connection timed out on request to ".concat(i.url));r.code=t,e.channels.error.publish(r)}function j(e){(e||g||h.readyState>=2&&c.connect)&&clearTimeout(c.connect),c.socket&&clearTimeout(c.socket)}function S(e){if(!m){j(!0),m=!0,h=null;var r=e||new Error("Network error while attempting to reach ".concat(i.url));r.isNetworkError=!0,r.request=i,t(r)}}}},{"./browser/fetchXhr":38,"parse-headers":47,"same-origin":68}],38:[function(e,t,r){"use strict";function n(){this.readyState=0}n.prototype.open=function(e,t){this._method=e,this._url=t,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(e,t){this._headers=this._headers||{},this._headers[e]=t},n.prototype.send=function(e){var t=this,r=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,o={method:this._method,headers:this._headers,signal:r&&r.signal,body:e};"undefined"!=typeof window&&(o.credentials=this.withCredentials?"include":"omit"),fetch(this._url,o).then((function(e){return e.headers.forEach((function(e,r){t._resHeaders+="".concat(r,": ").concat(e,"\r\n")})),t.status=e.status,t.statusText=e.statusText,t.readyState=3,n?e.text():e.arrayBuffer()})).then((function(e){n?t.responseText=e:t.response=e,t.readyState=4,t.onreadystatechange()})).catch((function(e){"AbortError"!==e.name?t.onerror(e):t.onabort()}))},t.exports=n},{}],39:[function(e,t,r){"use strict";t.exports=e("./node-request")},{"./node-request":37}],40:[function(e,t,r){(function(e){(function(){"use strict";"undefined"!=typeof globalThis?t.exports=globalThis:"undefined"!=typeof window?t.exports=window:void 0!==e?t.exports=e:"undefined"!=typeof self?t.exports=self:t.exports={}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],41:[function(e,t,r){"use strict";t.exports=function(e){return function(t,r){for(var n="onError"===t,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 u=0;u<e[t].length&&(o=e[t][u].apply(void 0,[o].concat(s)),!n||o);u++);return o}}},{}],42:[function(e,t,r){"use strict";var n=e("isobject");function o(e){return!0===n(e)&&"[object Object]"===Object.prototype.toString.call(e)}t.exports=function(e){var t,r;return!1!==o(e)&&"function"==typeof(t=e.constructor)&&!1!==o(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")}},{isobject:43}],43:[function(e,t,r){"use strict";t.exports=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}},{}],44:[function(e,t,r){"use strict";var n="undefined"!=typeof Reflect?Reflect.construct:void 0,o=Object.defineProperty,i=Error.captureStackTrace;function s(e){void 0!==e&&o(this,"message",{configurable:!0,value:e,writable:!0});var t=this.constructor.name;void 0!==t&&t!==this.name&&o(this,"name",{configurable:!0,value:t,writable:!0}),i(this,this.constructor)}void 0===i&&(i=function(e){var t=new Error;o(e,"stack",{configurable:!0,get:function(){var e=t.stack;return o(this,"stack",{configurable:!0,value:e,writable:!0}),e},set:function(t){o(e,"stack",{configurable:!0,value:t,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var a=function(){function e(e,t){return o(e,"name",{configurable:!0,value:t})}try{var t=function(){};if(e(t,"foo"),"foo"===t.name)return e}catch(e){}}();r=t.exports=function(e,t){if(null==t||t===Error)t=s;else if("function"!=typeof t)throw new TypeError("super_ should be a function");var r;if("string"==typeof e)r=e,e=void 0!==n?function(){return n(t,arguments,this.constructor)}:function(){t.apply(this,arguments)},void 0!==a&&(a(e,r),r=void 0);else if("function"!=typeof e)throw new TypeError("constructor should be either a string or a function");e.super_=e.super=t;var o={constructor:{configurable:!0,value:e,writable:!0}};return void 0!==r&&(o.name={configurable:!0,value:r,writable:!0}),e.prototype=Object.create(t.prototype,o),e},r.BaseError=s},{}],45:[function(e,t,r){t.exports=function(){var e=[];return{subscribe:function(t){return e.push(t),function(){var r=e.indexOf(t);r>-1&&e.splice(r,1)}},publish:function(){for(var t=0;t<e.length;t++)e[t].apply(null,arguments)}}}},{}],46:[function(e,t,r){"use strict";var n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,a,u=s(e),c=1;c<arguments.length;c++){for(var l in r=Object(arguments[c]))o.call(r,l)&&(u[l]=r[l]);if(n){a=n(r);for(var f=0;f<a.length;f++)i.call(r,a[f])&&(u[a[f]]=r[a[f]])}}return u}},{}],47:[function(e,t,r){var n=function(e){return e.replace(/^\s+|\s+$/g,"")},o=function(e){return"[object Array]"===Object.prototype.toString.call(e)};t.exports=function(e){if(!e)return{};for(var t={},r=n(e).split("\n"),i=0;i<r.length;i++){var s=r[i],a=s.indexOf(":"),u=n(s.slice(0,a)).toLowerCase(),c=n(s.slice(a+1));void 0===t[u]?t[u]=c:o(t[u])?t[u].push(c):t[u]=[t[u],c]}return t}},{}],48:[function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty;function o(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function i(e){try{return encodeURIComponent(e)}catch(e){return null}}r.stringify=function(e,t){t=t||"";var r,o,s=[];for(o in"string"!=typeof t&&(t="?"),e)if(n.call(e,o)){if((r=e[o])||null!=r&&!isNaN(r)||(r=""),o=i(o),r=i(r),null===o||null===r)continue;s.push(o+"="+r)}return s.length?t+s.join("&"):""},r.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var i=o(t[1]),s=o(t[2]);null===i||null===s||i in n||(n[i]=s)}return n}},{}],49:[function(e,t,r){"use strict";t.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},{}],50:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./util/canReportError"),o=e("./util/toSubscriber"),i=e("./symbol/observable"),s=e("./util/pipe"),a=e("./config"),u=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n=this.operator,i=o.toSubscriber(e,t,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},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){a.config.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),n.canReportError(e)?e.error(t):console.warn(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=c(t))((function(t,n){var o;o=r.subscribe((function(t){try{e(t)}catch(e){n(e),o&&o.unsubscribe()}}),n,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[i.observable]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:s.pipeFromArray(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=c(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function c(e){if(e||(e=a.config.Promise||Promise),!e)throw new Error("no Promise impl found");return e}r.Observable=u},{"./config":54,"./symbol/observable":57,"./util/canReportError":60,"./util/pipe":66,"./util/toSubscriber":67}],51:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./config"),o=e("./util/hostReportError");r.empty={closed:!0,next:function(e){},error:function(e){if(n.config.useDeprecatedSynchronousErrorHandling)throw e;o.hostReportError(e)},complete:function(){}}},{"./config":54,"./util/hostReportError":61}],52:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("./util/isFunction"),s=e("./Observer"),a=e("./Subscription"),u=e("../internal/symbol/rxSubscriber"),c=e("./config"),l=e("./util/hostReportError"),f=function(e){function t(r,n,o){var i=e.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 t?(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(t,e),t.prototype[u.rxSubscriber]=function(){return this},t.create=function(e,r,n){var o=new t(e,r,n);return o.syncErrorThrowable=!1,o},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this))},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this},t}(a.Subscription);r.Subscriber=f;var p=function(e){function t(t,r,n,o){var a,u=e.call(this)||this;u._parentSubscriber=t;var c=u;return i.isFunction(r)?a=r:r&&(a=r.next,n=r.error,o=r.complete,r!==s.empty&&(c=Object.create(r),i.isFunction(c.unsubscribe)&&u.add(c.unsubscribe.bind(c)),c.unsubscribe=u.unsubscribe.bind(u))),u._context=c,u._next=a,u._error=n,u._complete=o,u}return o(t,e),t.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;c.config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},t.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,r=c.config.useDeprecatedSynchronousErrorHandling;if(this._error)r&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)r?(t.syncErrorValue=e,t.syncErrorThrown=!0):l.hostReportError(e),this.unsubscribe();else{if(this.unsubscribe(),r)throw e;l.hostReportError(e)}}},t.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var r=function(){return e._complete.call(e._context)};c.config.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),c.config.useDeprecatedSynchronousErrorHandling)throw e;l.hostReportError(e)}},t.prototype.__tryOrSetError=function(e,t,r){if(!c.config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,r)}catch(t){return c.config.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(l.hostReportError(t),!0)}return!1},t.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},t}(f);r.SafeSubscriber=p},{"../internal/symbol/rxSubscriber":58,"./Observer":51,"./Subscription":53,"./config":54,"./util/hostReportError":61,"./util/isFunction":64}],53:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./util/isArray"),o=e("./util/isObject"),i=e("./util/isFunction"),s=e("./util/UnsubscriptionError"),a=function(){function e(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}var t;return e.prototype.unsubscribe=function(){var t;if(!this.closed){var r=this._parentOrParents,a=this._ctorUnsubscribe,c=this._unsubscribe,l=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof e)r.remove(this);else if(null!==r)for(var f=0;f<r.length;++f)r[f].remove(this);if(i.isFunction(c)){a&&(this._unsubscribe=void 0);try{c.call(this)}catch(e){t=e instanceof s.UnsubscriptionError?u(e.errors):[e]}}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(e){t=t||[],e instanceof s.UnsubscriptionError?t=t.concat(u(e.errors)):t.push(e)}}}if(t)throw new s.UnsubscriptionError(t)}},e.prototype.add=function(t){var r=t;if(!t)return e.EMPTY;switch(typeof t){case"function":r=new e(t);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof e)){var n=r;(r=new e)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof e){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},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var r=t.indexOf(e);-1!==r&&t.splice(r,1)}},e.EMPTY=((t=new e).closed=!0,t),e}();function u(e){return e.reduce((function(e,t){return e.concat(t instanceof s.UnsubscriptionError?t.errors:t)}),[])}r.Subscription=a},{"./util/UnsubscriptionError":59,"./util/isArray":63,"./util/isFunction":64,"./util/isObject":65}],54:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=!1;r.config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){if(e){var t=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+t.stack)}else n&&console.log("RxJS: Back to a better error behavior. Thank you. <3");n=e},get useDeprecatedSynchronousErrorHandling(){return n}}},{}],55:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber");r.filter=function(e,t){return function(r){return r.lift(new s(e,t))}};var s=function(){function e(e,t){this.predicate=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.predicate,this.thisArg))},e}(),a=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.predicate=r,o.thisArg=n,o.count=0,o}return o(t,e),t.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},t}(i.Subscriber)},{"../Subscriber":52}],56:[function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Subscriber");r.map=function(e,t){return function(r){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new s(e,t))}};var s=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new a(e,this.project,this.thisArg))},e}();r.MapOperator=s;var a=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.project=r,o.count=0,o.thisArg=n||o,o}return o(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(i.Subscriber)},{"../Subscriber":52}],57:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.observable="function"==typeof Symbol&&Symbol.observable||"@@observable"},{}],58:[function(e,t,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(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}return e.prototype=Object.create(Error.prototype),e}();r.UnsubscriptionError=n},{}],60:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Subscriber");r.canReportError=function(e){for(;e;){var t=e,r=t.closed,o=t.destination,i=t.isStopped;if(r||i)return!1;e=o&&o instanceof n.Subscriber?o:null}return!0}},{"../Subscriber":52}],61:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.hostReportError=function(e){setTimeout((function(){throw e}),0)}},{}],62:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.identity=function(e){return e}},{}],63:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isArray=Array.isArray||function(e){return e&&"number"==typeof e.length}},{}],64:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isFunction=function(e){return"function"==typeof e}},{}],65:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isObject=function(e){return null!==e&&"object"==typeof e}},{}],66:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./identity");function o(e){return 0===e.length?n.identity:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}r.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o(e)},r.pipeFromArray=o},{"./identity":62}],67:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("../Subscriber"),o=e("../symbol/rxSubscriber"),i=e("../Observer");r.toSubscriber=function(e,t,r){if(e){if(e instanceof n.Subscriber)return e;if(e[o.rxSubscriber])return e[o.rxSubscriber]()}return e||t||r?new n.Subscriber(e,t,r):new n.Subscriber(i.empty)}},{"../Observer":51,"../Subscriber":52,"../symbol/rxSubscriber":58}],68:[function(e,t,r){"use strict";var n=e("url");t.exports=function(e,t,r){if(e===t)return!0;var o=n.parse(e,!1,!0),i=n.parse(t,!1,!0),s=0|o.port||("https"===o.protocol?443:80),a=0|i.port||("https"===i.protocol?443:80),u={proto:o.protocol===i.protocol,hostname:o.hostname===i.hostname,port:s===a};return u.proto&&u.hostname&&(u.port||r)}},{url:69}],69:[function(e,t,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;t.exports={regex:n,parse:function(e){var t=n.exec(e);return t?{protocol:(t[1]||"").toLowerCase()||void 0,hostname:(t[5]||"").toLowerCase()||void 0,port:t[6]||void 0}:{}}}},{}],70:[function(e,t,r){(function(r){(function(){"use strict";var n=e("requires-port"),o=e("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+-.]*:\/\//,u=/:\d+$/,c=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,l=/^[a-zA-Z]:/;function f(e){return(e||"").toString().replace(i,"")}var p=[["#","hash"],["?","query"],function(e,t){return y(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]],d={hash:1,query:1};function h(e){var t,n=("undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:{}).location||{},o={},i=typeof(e=e||n);if("blob:"===e.protocol)o=new v(unescape(e.pathname),{});else if("string"===i)for(t in o=new v(e,{}),d)delete o[t];else if("object"===i){for(t in e)t in d||(o[t]=e[t]);void 0===o.slashes&&(o.slashes=a.test(e.href))}return o}function y(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function b(e,t){e=(e=f(e)).replace(s,""),t=t||{};var r,n=c.exec(e),o=n[1]?n[1].toLowerCase():"",i=!!n[2],a=!!n[3],u=0;return i?a?(r=n[2]+n[3]+n[4],u=n[2].length+n[3].length):(r=n[2]+n[4],u=n[2].length):a?(r=n[3]+n[4],u=n[3].length):r=n[4],"file:"===o?u>=2&&(r=r.slice(2)):y(o)?r=n[4]:o?i&&(r=r.slice(2)):u>=2&&y(t.protocol)&&(r=n[4]),{protocol:o,slashes:i||y(o),slashesCount:u,rest:r}}function v(e,t,r){if(e=(e=f(e)).replace(s,""),!(this instanceof v))return new v(e,t,r);var i,a,u,c,d,g,m=p.slice(),w=typeof t,O=this,_=0;for("object"!==w&&"string"!==w&&(r=t,t=null),r&&"function"!=typeof r&&(r=o.parse),i=!(a=b(e||"",t=h(t))).protocol&&!a.slashes,O.slashes=a.slashes||i&&t.slashes,O.protocol=a.protocol||t.protocol||"",e=a.rest,("file:"===a.protocol&&(2!==a.slashesCount||l.test(e))||!a.slashes&&(a.protocol||a.slashesCount<2||!y(O.protocol)))&&(m[3]=[/(.*)/,"pathname"]);_<m.length;_++)"function"!=typeof(c=m[_])?(u=c[0],g=c[1],u!=u?O[g]=e:"string"==typeof u?~(d="@"===u?e.lastIndexOf(u):e.indexOf(u))&&("number"==typeof c[2]?(O[g]=e.slice(0,d),e=e.slice(d+c[2])):(O[g]=e.slice(d),e=e.slice(0,d))):(d=u.exec(e))&&(O[g]=d[1],e=e.slice(0,d.index)),O[g]=O[g]||i&&c[3]&&t[g]||"",c[4]&&(O[g]=O[g].toLowerCase())):e=c(e,O);r&&(O.query=r(O.query)),i&&t.slashes&&"/"!==O.pathname.charAt(0)&&(""!==O.pathname||""!==t.pathname)&&(O.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],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,t.pathname)),"/"!==O.pathname.charAt(0)&&y(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&&y(O.protocol)&&O.host?O.protocol+"//"+O.host:"null",O.href=O.toString()}v.prototype={set:function(e,t,r){var i=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||o.parse)(t)),i[e]=t;break;case"port":i[e]=t,n(t,i.protocol)?t&&(i.host=i.hostname+":"+t):(i.host=i.hostname,i[e]="");break;case"hostname":i[e]=t,i.port&&(t+=":"+i.port),i.host=t;break;case"host":i[e]=t,u.test(t)?(t=t.split(":"),i.port=t.pop(),i.hostname=t.join(":")):(i.hostname=t,i.port="");break;case"protocol":i.protocol=t.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(t){var s="pathname"===e?"/":"#";i[e]=t.charAt(0)!==s?s+t:t}else i[e]=t;break;case"username":case"password":i[e]=encodeURIComponent(t);break;case"auth":var a=t.indexOf(":");~a?(i.username=t.slice(0,a),i.username=encodeURIComponent(decodeURIComponent(i.username)),i.password=t.slice(a+1),i.password=encodeURIComponent(decodeURIComponent(i.password))):i.username=encodeURIComponent(decodeURIComponent(t))}for(var c=0;c<p.length;c++){var l=p[c];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&&y(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(e){e&&"function"==typeof e||(e=o.stringify);var t,r=this,n=r.host,i=r.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var s=i+(r.protocol&&r.slashes||y(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):"file:"!==r.protocol&&y(r.protocol)&&!n&&"/"!==r.pathname&&(s+="@"),(":"===n[n.length-1]||u.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(s+=r.hash),s}},v.extractProtocol=b,v.location=h,v.trimLeft=f,v.qs=o,t.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)}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SanityClient=t()}(this,(function(){"use strict";function e(e){if("string"==typeof e||Array.isArray(e))return{id:e};if(e&&e.query)return"params"in e?{query:e.query,params:e.params}:{query:e.query};const t=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error(`Unknown selection - must be one of:\n\n${t}`)}const t=["image","file"],r=["before","after","replace"],n=e=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(e))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},o=(e,t)=>{if(null===t||"object"!=typeof t||Array.isArray(t))throw new Error(`${e}() takes an object of properties`)},s=(e,t)=>{if("string"!=typeof t||!/^[a-z0-9_.-]+$/i.test(t))throw new Error(`${e}(): "${t}" is not a valid document ID`)},i=(e,t)=>{if(!t._id)throw new Error(`${e}() requires that the document contains an ID ("_id" property)`);s(e,t._id)},a=e=>{if(!e.dataset)throw new Error("`dataset` must be provided to perform queries");return e.dataset||""},u=e=>{if("string"!=typeof e||!/^[a-z0-9._-]{1,75}$/i.test(e))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return e};function c(e,t={},r=null){this.selection=e,this.operations=Object.assign({},t),this.client=r}Object.assign(c.prototype,{clone(){return new c(this.selection,Object.assign({},this.operations),this.client)},set(e){return this.assign("set",e)},diffMatchPatch(e){return o("diffMatchPatch",e),this.assign("diffMatchPatch",e)},unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this},setIfMissing(e){return this.assign("setIfMissing",e)},replace(e){return o("replace",e),this._set("set",{$:e})},inc(e){return this.assign("inc",e)},dec(e){return this.assign("dec",e)},insert(e,t,n){return((e,t,n)=>{const o="insert(at, selector, items)";if(-1===r.indexOf(e)){const e=r.map((e=>`"${e}"`)).join(", ");throw new Error(`${o} takes an "at"-argument which is one of: ${e}`)}if("string"!=typeof t)throw new Error(`${o} takes a "selector"-argument which must be a string`);if(!Array.isArray(n))throw new Error(`${o} takes an "items"-argument which must be an array`)})(e,t,n),this.assign("insert",{[e]:t,items:n})},append(e,t){return this.insert("after",`${e}[-1]`,t)},prepend(e,t){return this.insert("before",`${e}[0]`,t)},splice(e,t,r,n){const o=t<0?t-1:t,s=void 0===r||-1===r?-1:Math.max(0,t+r),i=`${e}[${o}:${o<0&&s>=0?"":s}]`;return this.insert("replace",i,n||[])},ifRevisionId(e){return this.operations.ifRevisionID=e,this},serialize(){return Object.assign(e(this.selection),this.operations)},toJSON(){return this.serialize()},commit(e={}){if(!this.client)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const t="string"==typeof this.selection,r=Object.assign({returnFirst:t,returnDocuments:!0},e);return this.client.mutate({patch:this.serialize()},r)},reset(){return this.operations={},this},_set(e,t){return this.assign(e,t,!1)},assign(e,t,r=!0){return o(e,t),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},t)}),this}});const l={returnDocuments:!1};function d(e=[],t,r){this.trxId=r,this.operations=e,this.client=t}Object.assign(d.prototype,{clone(){return new d(this.operations.slice(0),this.client,this.trxId)},create(e){return o("create",e),this._add({create:e})},createIfNotExists(e){const t="createIfNotExists";return o(t,e),i(t,e),this._add({[t]:e})},createOrReplace(e){const t="createOrReplace";return o(t,e),i(t,e),this._add({[t]:e})},delete(e){return s("delete",e),this._add({delete:{id:e}})},patch(e,t){const r="function"==typeof t;if(e instanceof c)return this._add({patch:e.serialize()});if(r){const r=t(new c(e,{},this.client));if(!(r instanceof c))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:r.serialize()})}return this._add({patch:Object.assign({id:e},t)})},transactionId(e){return e?(this.trxId=e,this):this.trxId},serialize(){return this.operations.slice()},toJSON(){return this.serialize()},commit(e){if(!this.client)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.client.mutate(this.serialize(),Object.assign({transactionId:this.trxId},l,e||{}))},reset(){return this.operations=[],this},_add(e){return this.operations.push(e),this}});const f=encodeURIComponent;var p=({query:e,params:t={},options:r={}})=>{const{tag:n,...o}=r,s=`query=${f(e)}`,i=n?`?tag=${f(n)}&${s}`:`?${s}`,a=Object.keys(t).reduce(((e,r)=>`${e}&${f(`$${r}`)}=${f(JSON.stringify(t[r]))}`),i);return Object.keys(o).reduce(((e,t)=>r[t]?`${e}&${f(t)}=${f(r[t])}`:e),a)},h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function y(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function g(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];r.push.apply(r,arguments);var n=Function.bind.apply(t,r);return new n}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var m={};
2
+ /** @license
3
+ * eventsource.js
4
+ * Available under MIT License (MIT)
5
+ * https://github.com/Yaffle/EventSource/
6
+ */
7
+ !function(e,t){!function(r){var n=r.setTimeout,o=r.clearTimeout,s=r.XMLHttpRequest,i=r.XDomainRequest,a=r.ActiveXObject,u=r.EventSource,c=r.document,l=r.Promise,d=r.fetch,f=r.Response,p=r.TextDecoder,h=r.TextEncoder,y=r.AbortController;if("undefined"==typeof window||void 0===c||"readyState"in c||null!=c.body||(c.readyState="loading",window.addEventListener("load",(function(e){c.readyState="complete"}),!1)),null==s&&null!=a&&(s=function(){return new a("Microsoft.XMLHTTP")}),null==Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Date.now||(Date.now=function(){return(new Date).getTime()}),null==y){var g=d;d=function(e,t){var r=t.signal;return g(e,{headers:t.headers,credentials:t.credentials,cache:t.cache}).then((function(e){var t=e.body.getReader();return r._reader=t,r._aborted&&r._reader.cancel(),{status:e.status,statusText:e.statusText,headers:e.headers,body:{getReader:function(){return t}}}}))},y=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){null!=this.signal._reader&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function m(){this.bitsNeeded=0,this.codePoint=0}m.prototype.decode=function(e){function t(e,t,r){if(1===r)return e>=128>>t&&e<<t<=2047;if(2===r)return e>=2048>>t&&e<<t<=55295||e>=57344>>t&&e<<t<=65535;if(3===r)return e>=65536>>t&&e<<t<=1114111;throw new Error}function r(e,t){if(6===e)return t>>6>15?3:t>31?2:1;if(12===e)return t>15?3:2;if(18===e)return 3;throw new Error}for(var n=65533,o="",s=this.bitsNeeded,i=this.codePoint,a=0;a<e.length;a+=1){var u=e[a];0!==s&&(u<128||u>191||!t(i<<6|63&u,s-6,r(s,i)))&&(s=0,i=n,o+=String.fromCharCode(i)),0===s?(u>=0&&u<=127?(s=0,i=u):u>=192&&u<=223?(s=6,i=31&u):u>=224&&u<=239?(s=12,i=15&u):u>=240&&u<=247?(s=18,i=7&u):(s=0,i=n),0===s||t(i,s,r(s,i))||(s=0,i=n)):(s-=6,i=i<<6|63&u),0===s&&(i<=65535?o+=String.fromCharCode(i):(o+=String.fromCharCode(55296+(i-65535-1>>10)),o+=String.fromCharCode(56320+(i-65535-1&1023))))}return this.bitsNeeded=s,this.codePoint=i,o};null!=p&&null!=h&&function(){try{return"test"===(new p).decode((new h).encode("test"),{stream:!0})}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1}()||(p=m);var v=function(){};function b(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=v,this.onload=v,this.onerror=v,this.onreadystatechange=v,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=v}function w(e){return e.replace(/[A-Z]/g,(function(e){return String.fromCharCode(e.charCodeAt(0)+32)}))}function C(e){for(var t=Object.create(null),r=e.split("\r\n"),n=0;n<r.length;n+=1){var o=r[n].split(": "),s=o.shift(),i=o.join(": ");t[w(s)]=i}this._map=t}function O(){}function _(e){this._headers=e}function x(){}function E(){this._listeners=Object.create(null)}function j(e){n((function(){throw e}),0)}function T(e){this.type=e,this.target=void 0}function S(e,t){T.call(this,e),this.data=t.data,this.lastEventId=t.lastEventId}function A(e,t){T.call(this,e),this.status=t.status,this.statusText=t.statusText,this.headers=t.headers}function P(e,t){T.call(this,e),this.error=t.error}b.prototype.open=function(e,t){this._abort(!0);var r=this,i=this._xhr,a=1,u=0;this._abort=function(e){0!==r._sendTimeout&&(o(r._sendTimeout),r._sendTimeout=0),1!==a&&2!==a&&3!==a||(a=4,i.onload=v,i.onerror=v,i.onabort=v,i.onprogress=v,i.onreadystatechange=v,i.abort(),0!==u&&(o(u),u=0),e||(r.readyState=4,r.onabort(null),r.onreadystatechange())),a=0};var c=function(){if(1===a){var e=0,t="",n=void 0;if("contentType"in i)e=200,t="OK",n=i.contentType;else try{e=i.status,t=i.statusText,n=i.getResponseHeader("Content-Type")}catch(r){e=0,t="",n=void 0}0!==e&&(a=2,r.readyState=2,r.status=e,r.statusText=t,r._contentType=n,r.onreadystatechange())}},l=function(){if(c(),2===a||3===a){a=3;var e="";try{e=i.responseText}catch(e){}r.readyState=3,r.responseText=e,r.onprogress()}},d=function(e,t){if(null!=t&&null!=t.preventDefault||(t={preventDefault:v}),l(),1===a||2===a||3===a){if(a=4,0!==u&&(o(u),u=0),r.readyState=4,"load"===e)r.onload(t);else if("error"===e)r.onerror(t);else{if("abort"!==e)throw new TypeError;r.onabort(t)}r.onreadystatechange()}},f=function(){u=n((function(){f()}),500),3===i.readyState&&l()};"onload"in i&&(i.onload=function(e){d("load",e)}),"onerror"in i&&(i.onerror=function(e){d("error",e)}),"onabort"in i&&(i.onabort=function(e){d("abort",e)}),"onprogress"in i&&(i.onprogress=l),"onreadystatechange"in i&&(i.onreadystatechange=function(e){!function(e){null!=i&&(4===i.readyState?"onload"in i&&"onerror"in i&&"onabort"in i||d(""===i.responseText?"error":"load",e):3===i.readyState?"onprogress"in i||l():2===i.readyState&&c())}(e)}),!("contentType"in i)&&"ontimeout"in s.prototype||(t+=(-1===t.indexOf("?")?"?":"&")+"padding=true"),i.open(e,t,!0),"readyState"in i&&(u=n((function(){f()}),0))},b.prototype.abort=function(){this._abort(!1)},b.prototype.getResponseHeader=function(e){return this._contentType},b.prototype.setRequestHeader=function(e,t){var r=this._xhr;"setRequestHeader"in r&&r.setRequestHeader(e,t)},b.prototype.getAllResponseHeaders=function(){return null!=this._xhr.getAllResponseHeaders&&this._xhr.getAllResponseHeaders()||""},b.prototype.send=function(){if("ontimeout"in s.prototype&&("sendAsBinary"in s.prototype||"mozAnon"in s.prototype)||null==c||null==c.readyState||"complete"===c.readyState){var e=this._xhr;"withCredentials"in e&&(e.withCredentials=this.withCredentials);try{e.send(void 0)}catch(e){throw e}}else{var t=this;t._sendTimeout=n((function(){t._sendTimeout=0,t.send()}),4)}},C.prototype.get=function(e){return this._map[w(e)]},null!=s&&null==s.HEADERS_RECEIVED&&(s.HEADERS_RECEIVED=2),O.prototype.open=function(e,t,r,n,o,i,a){e.open("GET",o);var u=0;for(var c in e.onprogress=function(){var t=e.responseText.slice(u);u+=t.length,r(t)},e.onerror=function(e){e.preventDefault(),n(new Error("NetworkError"))},e.onload=function(){n(null)},e.onabort=function(){n(null)},e.onreadystatechange=function(){if(e.readyState===s.HEADERS_RECEIVED){var r=e.status,n=e.statusText,o=e.getResponseHeader("Content-Type"),i=e.getAllResponseHeaders();t(r,n,o,new C(i))}},e.withCredentials=i,a)Object.prototype.hasOwnProperty.call(a,c)&&e.setRequestHeader(c,a[c]);return e.send(),e},_.prototype.get=function(e){return this._headers.get(e)},x.prototype.open=function(e,t,r,n,o,s,i){var a=null,u=new y,c=u.signal,f=new p;return d(o,{headers:i,credentials:s?"include":"same-origin",signal:c,cache:"no-store"}).then((function(e){return a=e.body.getReader(),t(e.status,e.statusText,e.headers.get("Content-Type"),new _(e.headers)),new l((function(e,t){var n=function(){a.read().then((function(t){if(t.done)e(void 0);else{var o=f.decode(t.value,{stream:!0});r(o),n()}})).catch((function(e){t(e)}))};n()}))})).catch((function(e){return"AbortError"===e.name?void 0:e})).then((function(e){n(e)})),{abort:function(){null!=a&&a.cancel(),u.abort()}}},E.prototype.dispatchEvent=function(e){e.target=this;var t=this._listeners[e.type];if(null!=t)for(var r=t.length,n=0;n<r;n+=1){var o=t[n];try{"function"==typeof o.handleEvent?o.handleEvent(e):o.call(this,e)}catch(e){j(e)}}},E.prototype.addEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];null==n&&(n=[],r[e]=n);for(var o=!1,s=0;s<n.length;s+=1)n[s]===t&&(o=!0);o||n.push(t)},E.prototype.removeEventListener=function(e,t){e=String(e);var r=this._listeners,n=r[e];if(null!=n){for(var o=[],s=0;s<n.length;s+=1)n[s]!==t&&o.push(n[s]);0===o.length?delete r[e]:r[e]=o}},S.prototype=Object.create(T.prototype),A.prototype=Object.create(T.prototype),P.prototype=Object.create(T.prototype);var F=-1,I=-1,R=/^text\/event\-stream(;.*)?$/i,$=function(e,t){var r=null==e?t:parseInt(e,10);return r!=r&&(r=t),q(r)},q=function(e){return Math.min(Math.max(e,1e3),18e6)},D=function(e,t,r){try{"function"==typeof t&&t.call(e,r)}catch(e){j(e)}};function k(e,t){E.call(this),t=t||{},this.onopen=void 0,this.onmessage=void 0,this.onerror=void 0,this.url=void 0,this.readyState=void 0,this.withCredentials=void 0,this.headers=void 0,this._close=void 0,function(e,t,r){t=String(t);var a=Boolean(r.withCredentials),u=r.lastEventIdQueryParameterName||"lastEventId",c=q(1e3),l=$(r.heartbeatTimeout,45e3),d="",f=c,p=!1,h=0,y=r.headers||{},g=r.Transport,m=N&&null==g?void 0:new b(null!=g?new g:null!=s&&"withCredentials"in s.prototype||null==i?new s:new i),v=null!=g&&"string"!=typeof g?new g:null==m?new x:new O,w=void 0,C=0,_=F,E="",j="",T="",k="",U=0,M=0,H=0,z=function(t,r,n,o){if(0===_)if(200===t&&null!=n&&R.test(n)){_=1,p=Date.now(),f=c,e.readyState=1;var s=new A("open",{status:t,statusText:r,headers:o});e.dispatchEvent(s),D(e,e.onopen,s)}else{var i="";200!==t?(r&&(r=r.replace(/\s+/g," ")),i="EventSource's response has a status "+t+" "+r+" that is not 200. Aborting the connection."):i="EventSource's response has a Content-Type specifying an unsupported type: "+(null==n?"-":n.replace(/\s+/g," "))+". Aborting the connection.",V();s=new A("error",{status:t,statusText:r,headers:o});e.dispatchEvent(s),D(e,e.onerror,s),console.error(i)}},L=function(t){if(1===_){for(var r=-1,s=0;s<t.length;s+=1){(u=t.charCodeAt(s))!=="\n".charCodeAt(0)&&u!=="\r".charCodeAt(0)||(r=s)}var i=(-1!==r?k:"")+t.slice(0,r+1);k=(-1===r?k:"")+t.slice(r+1),""!==t&&(p=Date.now(),h+=t.length);for(var a=0;a<i.length;a+=1){var u=i.charCodeAt(a);if(U===I&&u==="\n".charCodeAt(0))U=0;else if(U===I&&(U=0),u==="\r".charCodeAt(0)||u==="\n".charCodeAt(0)){if(0!==U){1===U&&(H=a+1);var y=i.slice(M,H-1),g=i.slice(H+(H<a&&i.charCodeAt(H)===" ".charCodeAt(0)?1:0),a);"data"===y?(E+="\n",E+=g):"id"===y?j=g:"event"===y?T=g:"retry"===y?(c=$(g,c),f=c):"heartbeatTimeout"===y&&(l=$(g,l),0!==C&&(o(C),C=n((function(){X()}),l)))}if(0===U){if(""!==E){d=j,""===T&&(T="message");var m=new S(T,{data:E.slice(1),lastEventId:j});if(e.dispatchEvent(m),"open"===T?D(e,e.onopen,m):"message"===T?D(e,e.onmessage,m):"error"===T&&D(e,e.onerror,m),2===_)return}E="",T=""}U=u==="\r".charCodeAt(0)?I:0}else 0===U&&(M=a,U=1),1===U?u===":".charCodeAt(0)&&(H=a+1,U=2):2===U&&(U=3)}}},B=function(t){if(1===_||0===_){_=F,0!==C&&(o(C),C=0),C=n((function(){X()}),f),f=q(Math.min(16*c,2*f)),e.readyState=0;var r=new P("error",{error:t});e.dispatchEvent(r),D(e,e.onerror,r),null!=t&&console.error(t)}},V=function(){_=2,null!=w&&(w.abort(),w=void 0),0!==C&&(o(C),C=0),e.readyState=2},X=function(){if(C=0,_===F){p=!1,h=0,C=n((function(){X()}),l),_=0,E="",T="",j=d,k="",M=0,H=0,U=0;var r=t;if("data:"!==t.slice(0,5)&&"blob:"!==t.slice(0,5)&&""!==d){var o=t.indexOf("?");r=-1===o?t:t.slice(0,o+1)+t.slice(o+1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g,(function(e,t){return t===u?"":e})),r+=(-1===t.indexOf("?")?"?":"&")+u+"="+encodeURIComponent(d)}var s=e.withCredentials,i={Accept:"text/event-stream"},a=e.headers;if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(i[c]=a[c]);try{w=v.open(m,z,L,B,r,s,i)}catch(e){throw V(),e}}else if(p||null==w){var f=Math.max((p||Date.now())+l-Date.now(),1);p=!1,C=n((function(){X()}),f)}else B(new Error("No activity within "+l+" milliseconds. "+(0===_?"No response received.":h+" chars received.")+" Reconnecting.")),null!=w&&(w.abort(),w=void 0)};e.url=t,e.readyState=0,e.withCredentials=a,e.headers=y,e._close=V,X()}(this,e,t)}var N=null!=d&&null!=f&&"body"in f.prototype;k.prototype=Object.create(E.prototype),k.prototype.CONNECTING=0,k.prototype.OPEN=1,k.prototype.CLOSED=2,k.prototype.close=function(){this._close()},k.CONNECTING=0,k.OPEN=1,k.CLOSED=2,k.prototype.withCredentials=void 0;var U,M=u;null==s||null!=u&&"withCredentials"in u.prototype||(M=k),U=function(e){e.EventSourcePolyfill=k,e.NativeEventSource=u,e.EventSource=M}(t),void 0!==U&&(e.exports=U)}("undefined"==typeof globalThis?"undefined"!=typeof window?window:"undefined"!=typeof self?self:h:globalThis)}({get exports(){return m},set exports(e){m=e}},m);var v=m.EventSourcePolyfill,b=(e,t)=>Object.keys(t).concat(Object.keys(e)).reduce(((r,n)=>(r[n]=void 0===e[n]?t[n]:e[n],r)),{}),w=function(e,t){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},w(e,t)};function C(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}w(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function O(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}function x(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function E(e){return"function"==typeof e}function j(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var T=j((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function S(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var A=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var i=O(s),a=i.next();!a.done;a=i.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(E(u))try{u()}catch(e){o=e instanceof T?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var l=O(c),d=l.next();!d.done;d=l.next()){var f=d.value;try{F(f)}catch(e){o=null!=o?o:[],e instanceof T?o=x(x([],_(o)),_(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new T(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)F(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&S(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&S(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();function P(e){return e instanceof A||e&&"closed"in e&&E(e.remove)&&E(e.add)&&E(e.unsubscribe)}function F(e){E(e)?e():e.unsubscribe()}A.EMPTY;var I={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},R={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=R.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,x([e,t],_(r))):setTimeout.apply(void 0,x([e,t],_(r)))},clearTimeout:function(e){var t=R.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function $(){}var q=null;var D=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,P(t)&&t.add(r)):r.destination=z,r}return C(t,e),t.create=function(e,t,r){return new M(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(A),k=Function.prototype.bind;function N(e,t){return k.call(e,t)}var U=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){H(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){H(e)}else H(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){H(e)}},e}(),M=function(e){function t(t,r,n){var o,s,i=e.call(this)||this;E(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:i&&I.useDeprecatedNextContext?((s=Object.create(t)).unsubscribe=function(){return i.unsubscribe()},o={next:t.next&&N(t.next,s),error:t.error&&N(t.error,s),complete:t.complete&&N(t.complete,s)}):o=t;return i.destination=new U(o),i}return C(t,e),t}(D);function H(e){var t;t=e,R.setTimeout((function(){throw t}))}var z={closed:!0,next:$,error:function(e){throw e},complete:$},L="function"==typeof Symbol&&Symbol.observable||"@@observable";function B(e){return e}function V(e){return 0===e.length?B:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var X=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,s=(n=e)&&n instanceof D||function(e){return e&&E(e.next)&&E(e.error)&&E(e.complete)}(n)&&P(n)?e:new M(e,t,r);return function(e){if(I.useDeprecatedSynchronousErrorHandling){var t=!q;if(t&&(q={errorThrown:!1,error:null}),e(),t){var r=q,n=r.errorThrown,o=r.error;if(q=null,n)throw o}}else e()}((function(){var e=o,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?o._subscribe(s):o._trySubscribe(s))})),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=J(t))((function(t,n){var o=new M({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[L]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return V(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=J(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function J(e){var t;return null!==(t=null!=e?e:I.Promise)&&void 0!==t?t:Promise}function G(e){return function(t){if(function(e){return E(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Y(e,t,r,n,o){return new Z(e,t,r,n,o)}var Z=function(e){function t(t,r,n,o,s,i){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=i,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return C(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(D),K=j((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Q(e,t){var r="object"==typeof t;return new Promise((function(n,o){var s,i=!1;e.subscribe({next:function(e){s=e,i=!0},error:o,complete:function(){i?n(s):r?n(t.defaultValue):o(new K)}})}))}function W(e,t){return G((function(r,n){var o=0;r.subscribe(Y(n,(function(r){n.next(e.call(t,r,o++))})))}))}function ee(e,t){return G((function(r,n){var o=0;r.subscribe(Y(n,(function(r){return e.call(t,r,o++)&&n.next(r)})))}))}const te=v,re=["includePreviousRevision","includeResult","visibility","effectFormat","tag"],ne={includeResult:!0};function oe(e){try{const t=e.data&&JSON.parse(e.data)||{};return Object.assign({type:e.type},t)}catch(e){return e}}const se=(e={})=>{return{dryRun:e.dryRun,returnIds:!0,returnDocuments:(t=e.returnDocuments,r=!0,!1===t?void 0:void 0===t?r:t),visibility:e.visibility||"sync",autoGenerateArrayKeys:e.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:e.skipCrossDatasetReferenceValidation};var t,r},ie=e=>"response"===e.type,ae=e=>e.body;var ue={listen:function(e,t,r={}){const{url:n,token:o,withCredentials:s,requestTagPrefix:i}=this.clientConfig,a=r.tag&&i?[i,r.tag].join("."):r.tag,u={...b(r,ne),tag:a},c=(l=u,re.reduce(((e,t)=>(void 0===l[t]||(e[t]=l[t]),e)),{}));var l;const d=p({query:e,params:t,options:c,tag:a}),f=`${n}${this.getDataUrl("listen",d)}`;if(f.length>14800)return new X((e=>e.error(new Error("Query too large for listener"))));const h=u.events?u.events:["mutation"],y=-1!==h.indexOf("reconnect"),g={};return(o||s)&&(g.withCredentials=!0),o&&(g.headers={Authorization:`Bearer ${o}`}),new X((e=>{let t,r=c(),n=!1;function o(){n||(y&&e.next({type:"reconnect"}),n||r.readyState===te.CLOSED&&(u(),clearTimeout(t),t=setTimeout(l,100)))}function s(t){e.error(function(e){if(e instanceof Error)return e;const t=oe(e);return t instanceof Error?t:new Error(function(e){if(!e.error)return e.message||"Unknown listener error";if(e.error.description)return e.error.description;return"string"==typeof e.error?e.error:JSON.stringify(e.error,null,2)}(t))}(t))}function i(t){const r=oe(t);return r instanceof Error?e.error(r):e.next(r)}function a(t){n=!0,u(),e.complete()}function u(){r.removeEventListener("error",o,!1),r.removeEventListener("channelError",s,!1),r.removeEventListener("disconnect",a,!1),h.forEach((e=>r.removeEventListener(e,i,!1))),r.close()}function c(){const e=new te(f,g);return e.addEventListener("error",o,!1),e.addEventListener("channelError",s,!1),e.addEventListener("disconnect",a,!1),h.forEach((t=>e.addEventListener(t,i,!1))),e}function l(){r=c()}return function(){n=!0,u()}}))},getDataUrl(e,t){const r=this.clientConfig,n=`/${e}/${a(r)}`;return`/data${t?`${n}/${t}`:n}`.replace(/\/($|\?)/,"$1")},fetch(e,t,r={}){const n=!1===r.filterResponse?e=>e:e=>e.result,o=this._dataRequest("query",{query:e,params:t},r).pipe(W(n));return this.isPromiseAPI()?Q(o):o},getDocument(e,t={}){const r={uri:this.getDataUrl("doc",e),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(ee(ie),W((e=>e.body.documents&&e.body.documents[0])));return this.isPromiseAPI()?Q(n):n},getDocuments(e,t={}){const r={uri:this.getDataUrl("doc",e.join(",")),json:!0,tag:t.tag},n=this._requestObservable(r).pipe(ee(ie),W((t=>{const r=(n=t.body.documents||[],o=e=>e._id,n.reduce(((e,t)=>(e[o(t)]=t,e)),Object.create(null)));var n,o;return e.map((e=>r[e]||null))})));return this.isPromiseAPI()?Q(n):n},create(e,t){return this._create(e,"create",t)},createIfNotExists(e,t){return i("createIfNotExists",e),this._create(e,"createIfNotExists",t)},createOrReplace(e,t){return i("createOrReplace",e),this._create(e,"createOrReplace",t)},patch(e,t){return new c(e,t,this)},delete(t,r){return this.dataRequest("mutate",{mutations:[{delete:e(t)}]},r)},mutate(e,t){const r=e instanceof c||e instanceof d?e.serialize():e,n=Array.isArray(r)?r:[r],o=t&&t.transactionId;return this.dataRequest("mutate",{mutations:n,transactionId:o},t)},transaction(e){return new d(e,this)},dataRequest(e,t,r={}){const n=this._dataRequest(e,t,r);return this.isPromiseAPI()?Q(n):n},_dataRequest(e,t,r={}){const n="mutate"===e,o="query"===e,s=!n&&p(t),i=!n&&s.length<11264,a=i?s:"",u=r.returnFirst,{timeout:c,token:l,tag:d,headers:f}=r,h={method:i?"GET":"POST",uri:this.getDataUrl(e,a),json:!0,body:i?void 0:t,query:n&&se(r),timeout:c,headers:f,token:l,tag:d,canUseCdn:o};return this._requestObservable(h).pipe(ee(ie),W(ae),W((e=>{if(!n)return e;const t=e.results||[];if(r.returnDocuments)return u?t[0]&&t[0].document:t.map((e=>e.document));const o=u?"documentId":"documentIds",s=u?t[0]&&t[0].id:t.map((e=>e.id));return{transactionId:e.transactionId,results:t,[o]:s}})))},_create(e,t,r={}){const n={[t]:e},o=Object.assign({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[n]},o)}};function ce(e){this.request=e.request.bind(e)}function le(e){this.client=e}Object.assign(ce.prototype,{create(e,t){return this._modify("PUT",e,t)},edit(e,t){return this._modify("PATCH",e,t)},delete(e){return this._modify("DELETE",e)},list(){return this.request({uri:"/datasets"})},_modify(e,t,r){return n(t),this.request({method:e,uri:`/datasets/${t}`,body:r})}}),Object.assign(le.prototype,{list(){return this.client.request({uri:"/projects"})},getById(e){return this.client.request({uri:`/projects/${e}`})}});function de(e){this.client=e}function fe(e){this.client=e}function pe(e){this.client=e}Object.assign(de.prototype,{upload(e,r,n={}){(e=>{if(-1===t.indexOf(e))throw new Error(`Invalid asset type: ${e}. Must be one of ${t.join(", ")}`)})(e);let o=n.extract||void 0;o&&!o.length&&(o=["none"]);const s=a(this.client.clientConfig),i="image"===e?"images":"files",u=function(e,t){return"undefined"!=typeof window&&t instanceof window.File?Object.assign({filename:!1===e.preserveFilename?void 0:t.name,contentType:t.type},e):e}(n,r),{tag:c,label:l,title:d,description:f,creditLine:p,filename:h,source:y}=u,g={label:l,title:d,description:f,filename:h,meta:o,creditLine:p};y&&(g.sourceId=y.id,g.sourceName=y.name,g.sourceUrl=y.url);const m=this.client._requestObservable({tag:c,method:"POST",timeout:u.timeout||0,uri:`/assets/${i}/${s}`,headers:u.contentType?{"Content-Type":u.contentType}:{},query:g,body:r});return this.client.isPromiseAPI()?Q(m.pipe(ee((e=>"response"===e.type)),W((e=>e.body.document)))):m},delete(e,t){console.warn("client.assets.delete() is deprecated, please use client.delete(<document-id>)");let r=t||"";return/^(image|file)-/.test(r)?e._id&&(r=e._id):r=`${e}-${r}`,a(this.client.clientConfig),this.client.delete(r)},getImageUrl(e,t){const r=e._ref||e;if("string"!=typeof r)throw new Error("getImageUrl() needs either an object with a _ref, or a string with an asset document ID");if(!/^image-[A-Za-z0-9_]+-\d+x\d+-[a-z]{1,5}$/.test(r))throw new Error(`Unsupported asset ID "${r}". URL generation only works for auto-generated IDs.`);const[,n,o,s]=r.split("-");a(this.client.clientConfig);const{projectId:i,dataset:u}=this.client.clientConfig;return`https://cdn.sanity.io/images/${i}/${u}/${n}-${o}.${s}${t?(e=>{const t=[];for(const r in e)e.hasOwnProperty(r)&&t.push(`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`);return t.length>0?`?${t.join("&")}`:""})(t):""}`}}),Object.assign(fe.prototype,{getById(e){return this.client.request({uri:`/users/${e}`})}}),Object.assign(pe.prototype,{getLoginProviders(){return this.client.request({uri:"/auth/providers"})},logout(){return this.client.request({uri:"/auth/logout",method:"POST"})}});var he={},ye={get exports(){return he},set exports(e){he=e}};var ge=g(Object.freeze({__proto__:null,default:function(){var e=Object.create(null),t=0;return{publish:function(t){for(var r in e)e[r](t)},subscribe:function(r){var n=t++;return e[n]=r,function(){delete e[n]}}}}})),me={};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e){return function(t,r){for(var n="onError"===t,o=r,s=arguments.length,i=new Array(s>2?s-2:0),a=2;a<s;a++)i[a-2]=arguments[a];for(var u=0;u<e[t].length;u++){var c=e[t][u];if(o=c.apply(void 0,[o].concat(i)),n&&!o)break}return o}},e.exports=t.default}({get exports(){return me},set exports(e){me=e}},me);var ve={},be={get exports(){return ve},set exports(e){ve=e}},we={},Ce=Object.prototype.hasOwnProperty;function Oe(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function _e(e){try{return encodeURIComponent(e)}catch(e){return null}}we.stringify=function(e,t){t=t||"";var r,n,o=[];for(n in"string"!=typeof t&&(t="?"),e)if(Ce.call(e,n)){if((r=e[n])||null!=r&&!isNaN(r)||(r=""),n=_e(n),r=_e(r),null===n||null===r)continue;o.push(n+"="+r)}return o.length?t+o.join("&"):""},we.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var o=Oe(t[1]),s=Oe(t[2]);null===o||null===s||o in n||(n[o]=s)}return n};var xe=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e},Ee=we,je=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Te=/[\n\r\t]/g,Se=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Ae=/:\d+$/,Pe=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Fe=/^[a-zA-Z]:/;function Ie(e){return(e||"").toString().replace(je,"")}var Re=[["#","hash"],["?","query"],function(e,t){return De(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],$e={hash:1,query:1};function qe(e){var t,r=("undefined"!=typeof window?window:void 0!==h?h:"undefined"!=typeof self?self:{}).location||{},n={},o=typeof(e=e||r);if("blob:"===e.protocol)n=new Ne(unescape(e.pathname),{});else if("string"===o)for(t in n=new Ne(e,{}),$e)delete n[t];else if("object"===o){for(t in e)t in $e||(n[t]=e[t]);void 0===n.slashes&&(n.slashes=Se.test(e.href))}return n}function De(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function ke(e,t){e=(e=Ie(e)).replace(Te,""),t=t||{};var r,n=Pe.exec(e),o=n[1]?n[1].toLowerCase():"",s=!!n[2],i=!!n[3],a=0;return s?i?(r=n[2]+n[3]+n[4],a=n[2].length+n[3].length):(r=n[2]+n[4],a=n[2].length):i?(r=n[3]+n[4],a=n[3].length):r=n[4],"file:"===o?a>=2&&(r=r.slice(2)):De(o)?r=n[4]:o?s&&(r=r.slice(2)):a>=2&&De(t.protocol)&&(r=n[4]),{protocol:o,slashes:s||De(o),slashesCount:a,rest:r}}function Ne(e,t,r){if(e=(e=Ie(e)).replace(Te,""),!(this instanceof Ne))return new Ne(e,t,r);var n,o,s,i,a,u,c=Re.slice(),l=typeof t,d=this,f=0;for("object"!==l&&"string"!==l&&(r=t,t=null),r&&"function"!=typeof r&&(r=Ee.parse),n=!(o=ke(e||"",t=qe(t))).protocol&&!o.slashes,d.slashes=o.slashes||n&&t.slashes,d.protocol=o.protocol||t.protocol||"",e=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||Fe.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!De(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);f<c.length;f++)"function"!=typeof(i=c[f])?(s=i[0],u=i[1],s!=s?d[u]=e:"string"==typeof s?~(a="@"===s?e.lastIndexOf(s):e.indexOf(s))&&("number"==typeof i[2]?(d[u]=e.slice(0,a),e=e.slice(a+i[2])):(d[u]=e.slice(a),e=e.slice(0,a))):(a=s.exec(e))&&(d[u]=a[1],e=e.slice(0,a.index)),d[u]=d[u]||n&&i[3]&&t[u]||"",i[4]&&(d[u]=d[u].toLowerCase())):e=i(e,d);r&&(d.query=r(d.query)),n&&t.slashes&&"/"!==d.pathname.charAt(0)&&(""!==d.pathname||""!==t.pathname)&&(d.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],s=!1,i=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),i++):i&&(0===n&&(s=!0),r.splice(n,1),i--);return s&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(d.pathname,t.pathname)),"/"!==d.pathname.charAt(0)&&De(d.protocol)&&(d.pathname="/"+d.pathname),xe(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(~(a=d.auth.indexOf(":"))?(d.username=d.auth.slice(0,a),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(a+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin="file:"!==d.protocol&&De(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}Ne.prototype={set:function(e,t,r){var n=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||Ee.parse)(t)),n[e]=t;break;case"port":n[e]=t,xe(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,Ae.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var o="pathname"===e?"/":"#";n[e]=t.charAt(0)!==o?o+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var s=t.indexOf(":");~s?(n.username=t.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var i=0;i<Re.length;i++){var a=Re[i];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&De(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(e){e&&"function"==typeof e||(e=Ee.stringify);var t,r=this,n=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var s=o+(r.protocol&&r.slashes||De(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):"file:"!==r.protocol&&De(r.protocol)&&!n&&"/"!==r.pathname&&(s+="@"),(":"===n[n.length-1]||Ae.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(s+=r.hash),s}},Ne.extractProtocol=ke,Ne.location=qe,Ne.trimLeft=Ie,Ne.qs=Ee;var Ue=Ne;!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n=(r=Ue)&&r.__esModule?r:{default:r};function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}var s="undefined"!=typeof navigator&&"ReactNative"===navigator.product,i=Object.prototype.hasOwnProperty,a={timeout:s?6e4:12e4};function u(e){var t=[];for(var r in e)i.call(e,r)&&n(r,e[r]);return t.length?t.join("&"):"";function n(e,r){Array.isArray(r)?r.forEach((function(t){return n(e,t)})):t.push([e,r].map(encodeURIComponent).join("="))}}function c(e){if(!1===e||0===e)return!1;if(e.connect||e.socket)return e;var t=Number(e);return isNaN(t)?c(a.timeout):{connect:t,socket:t}}t.default=function(e){var t="string"==typeof e?o({url:e},a):o({},a,e),r=(0,n.default)(t.url,{},!0);return t.timeout=c(t.timeout),t.query&&(r.query=o({},r.query,function(e){var t={};for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}(t.query))),t.method=t.body&&!t.method?"POST":(t.method||"GET").toUpperCase(),t.url=r.toString(u),t},e.exports=t.default}(be,ve);var Me={};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=/^https?:\/\//i;t.default=function(e){if(!r.test(e.url))throw new Error('"'.concat(e.url,'" is not a valid URL'))},e.exports=t.default}({get exports(){return Me},set exports(e){Me=e}},Me);var He={},ze={get exports(){return He},set exports(e){He=e}},Le={},Be={get exports(){return Le},set exports(e){Le=e}},Ve=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/,Xe={regex:Ve,parse:function(e){var t=Ve.exec(e);return t?{protocol:(t[1]||"").toLowerCase()||void 0,hostname:(t[5]||"").toLowerCase()||void 0,port:t[6]||void 0}:{}}},Je=Xe,Ge=function(e,t,r){if(e===t)return!0;var n=Je.parse(e,!1,!0),o=Je.parse(t,!1,!0),s=0|n.port||("https"===n.protocol?443:80),i=0|o.port||("https"===o.protocol?443:80),a={proto:n.protocol===o.protocol,hostname:n.hostname===o.hostname,port:s===i};return a.proto&&a.hostname&&(a.port||r)},Ye=function(e){return e.replace(/^\s+|\s+$/g,"")},Ze=function(e){if(!e)return{};for(var t,r={},n=Ye(e).split("\n"),o=0;o<n.length;o++){var s=n[o],i=s.indexOf(":"),a=Ye(s.slice(0,i)).toLowerCase(),u=Ye(s.slice(i+1));void 0===r[a]?r[a]=u:(t=r[a],"[object Array]"===Object.prototype.toString.call(t)?r[a].push(u):r[a]=[r[a],u])}return r},Ke={};!function(e,t){function r(){this.readyState=0}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,r.prototype.open=function(e,t){this._method=e,this._url=t,this._resHeaders="",this.readyState=1,this.onreadystatechange()},r.prototype.abort=function(){this._controller&&this._controller.abort()},r.prototype.getAllResponseHeaders=function(){return this._resHeaders},r.prototype.setRequestHeader=function(e,t){this._headers=this._headers||{},this._headers[e]=t},r.prototype.send=function(e){var t=this,r=this._controller="function"==typeof AbortController&&new AbortController,n="arraybuffer"!==this.responseType,o={method:this._method,headers:this._headers,signal:r&&r.signal||void 0,body:e};"undefined"!=typeof document&&(o.credentials=this.withCredentials?"include":"omit"),fetch(this._url,o).then((function(e){return e.headers.forEach((function(e,r){t._resHeaders+="".concat(r,": ").concat(e,"\r\n")})),t.status=e.status,t.statusText=e.statusText,t.readyState=3,n?e.text():e.arrayBuffer()})).then((function(e){n?t.responseText=e:t.response=e,t.readyState=4,t.onreadystatechange()})).catch((function(e){"AbortError"!==e.name?t.onerror(e):t.onabort()}))};var n=r;t.default=n,e.exports=t.default}({get exports(){return Ke},set exports(e){Ke=e}},Ke),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(Ge),n=s(Ze),o=s(Ke);function s(e){return e&&e.__esModule?e:{default:e}}var i="undefined"==typeof document||"undefined"==typeof window?void 0:window,a=i?"xhr":"fetch",u="function"==typeof XMLHttpRequest?XMLHttpRequest:function(){},c="withCredentials"in new u,l="undefined"==typeof XDomainRequest?void 0:XDomainRequest,d=c?u:l;i||(u=o.default,d=o.default);t.default=function(e,t){var o=e.options,s=e.applyMiddleware("finalizeOptions",o),c={},l=i&&i.location&&!(0,r.default)(i.location.href,s.url),f=e.applyMiddleware("interceptRequest",void 0,{adapter:a,context:e});if(f){var p=setTimeout(t,0,null,f);return{abort:function(){return clearTimeout(p)}}}var h=l?new d:new u,y=i&&i.XDomainRequest&&h instanceof i.XDomainRequest,g=s.headers,m=s.timeout,v=!1,b=!1,w=!1;if(h.onerror=x,h.ontimeout=x,h.onabort=function(){_(!0),v=!0},h.onprogress=function(){},h[y?"onload":"onreadystatechange"]=function(){!function(){if(!m)return;_(),c.socket=setTimeout((function(){return O("ESOCKETTIMEDOUT")}),m.socket)}(),v||4!==h.readyState&&!y||0!==h.status&&function(){if(v||b||w)return;if(0===h.status)return void x(new Error("Unknown XHR error"));_(),b=!0,t(null,function(){var e=h.status,t=h.statusText;if(y&&void 0===e)e=200;else{if(e>12e3&&e<12156)return x();e=1223===h.status?204:h.status,t=1223===h.status?"No Content":t}return{body:h.response||h.responseText,url:s.url,method:s.method,headers:y?{}:(0,n.default)(h.getAllResponseHeaders()),statusCode:e,statusMessage:t}}())}()},h.open(s.method,s.url,!0),h.withCredentials=!!s.withCredentials,g&&h.setRequestHeader)for(var C in g)g.hasOwnProperty(C)&&h.setRequestHeader(C,g[C]);else if(g&&y)throw new Error("Headers cannot be set on an XDomainRequest object");return s.rawBody&&(h.responseType="arraybuffer"),e.applyMiddleware("onRequest",{options:s,adapter:a,request:h,context:e}),h.send(s.body||null),m&&(c.connect=setTimeout((function(){return O("ETIMEDOUT")}),m.connect)),{abort:function(){v=!0,h&&h.abort()}};function O(t){w=!0,h.abort();var r=new Error("ESOCKETTIMEDOUT"===t?"Socket timed out on request to ".concat(s.url):"Connection timed out on request to ".concat(s.url));r.code=t,e.channels.error.publish(r)}function _(e){(e||v||h.readyState>=2&&c.connect)&&clearTimeout(c.connect),c.socket&&clearTimeout(c.socket)}function x(e){if(!b){_(!0),b=!0,h=null;var r=e||new Error("Network error while attempting to reach ".concat(s.url));r.isNetworkError=!0,r.request=s,t(r)}}},e.exports=t.default}(Be,Le),function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=((r=Le)&&r.__esModule?r:{default:r}).default;t.default=n,e.exports=t.default}(ze,He),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.default,a=[],d=l.reduce((function(e,t){return e[t]=e[t]||[],e}),{processOptions:[o.default],validateOptions:[s.default]});function f(e){var t=c.reduce((function(e,t){return e[t]=u(),e}),{}),o=(0,n.default)(d),s=o("processOptions",e);o("validateOptions",s);var i={options:s,channels:t,applyMiddleware:o},a=null,l=t.request.subscribe((function(e){a=r(e,(function(r,n){return function(e,r,n){var s=e,i=r;if(!s)try{i=o("onResponse",r,n)}catch(e){i=null,s=e}s=s&&o("onError",s,n),s?t.error.publish(s):i&&t.response.publish(i)}(r,n,e)}))}));t.abort.subscribe((function(){l(),a&&a.abort()}));var f=o("onReturn",t,i);return f===t&&t.request.publish(i),f}return f.use=function(e){if(!e)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof e)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(e.onReturn&&d.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return l.forEach((function(t){e[t]&&d[t].push(e[t])})),a.push(e),f},f.clone=function(){return e(a)},t.forEach(f.use),f};var r=a(ge),n=a(me),o=a(ve),s=a(Me),i=a(He);function a(e){return e&&e.__esModule?e:{default:e}}var u="default"in r.default?r.default.default:r.default,c=["request","response","progress","error","abort"],l=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=t.default}(ye,he);var Qe=y(he);function We(e){return"[object Object]"===Object.prototype.toString.call(e)}
8
+ /*!
9
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
10
+ *
11
+ * Copyright (c) 2014-2017, Jon Schlinkert.
12
+ * Released under the MIT License.
13
+ */
14
+ var et=Object.create,tt=Object.defineProperty,rt=Object.getOwnPropertyDescriptor,nt=Object.getOwnPropertyNames,ot=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty,it=(e,t)=>function(){return t||(0,e[nt(e)[0]])((t={exports:{}}).exports,t),t.exports},at=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of nt(t))st.call(e,o)||o===r||tt(e,o,{get:()=>t[o],enumerable:!(n=rt(t,o))||n.enumerable});return e},ut=(e,t,r)=>(r=null!=e?et(ot(e)):{},at(!t&&e&&e.__esModule?r:tt(r,"default",{value:e,enumerable:!0}),e)),ct=it({"node_modules/form-urlencoded/dist/form-urlencoded.js"(e,t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Boolean(t.sorted),o=Boolean(t.skipIndex),s=Boolean(t.ignorenull),i=function(e){return String(e).replace(/(?:[\0-\x1F"-&\+-\}\x7F-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,(function(e){return"%"+e.charCodeAt().toString(16).slice(-2).toUpperCase()}))},a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(e);return n?t.sort():t},u=function(e){return e.filter((function(e){return e})).join("&")},c=function(e,t){return u(a(t).map((function(r){return d(e+"["+r+"]",t[r])})))},l=function(e,t){return t.length?u(t.map((function(t,r){return d(o?e+"[]":e+"["+r+"]",t)}))):i(e+"[]")},d=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0===t?"undefined":r(t),o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return t===o?o=s?o:i(e)+"="+o:/string|number|boolean/.test(n)?o=i(e)+"="+i(t):Array.isArray(t)?o=l(e,t):"object"===n&&(o=c(e,t)),o};return e&&u(a(e).map((function(t){return d(t,e[t])})))}}}),lt=ut(ct());lt.default.default||lt.default;var dt=["boolean","string","number"];function ft(e){try{return JSON.parse(e)}catch(e){throw e.message=`Failed to parsed response body as JSON: ${e.message}`,e}}var pt,ht="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},yt={};function gt(e){this.message=e}((e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})})(yt,{default:()=>pt});var mt,vt,bt=(mt={"src/middleware/cancel/Cancel.js"(){gt.prototype.toString=function(){return"Cancel"+(this.message?`: ${this.message}`:"")},gt.prototype.__CANCEL__=!0,pt=gt}},function(){return mt&&(vt=(0,mt[nt(mt)[0]])(mt=0)),vt});bt();var wt,Ct=(bt(),wt=yt,at(tt({},"__esModule",{value:!0}),wt));function Ot(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t=null;this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=new Ct(e),t(this.reason))}))}Ot.source=function(){let e;return{token:new Ot((t=>{e=t})),cancel:e}};var _t=it({"node_modules/ms/index.js"(e,t){var r=1e3,n=60*r,o=60*n,s=24*o,i=7*s,a=365.25*s;function u(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}t.exports=function(e,t){t=t||{};var c=typeof e;if("string"===c&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var u=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*a;case"weeks":case"week":case"w":return u*i;case"days":case"day":case"d":return u*s;case"hours":case"hour":case"hrs":case"hr":case"h":return u*o;case"minutes":case"minute":case"mins":case"min":case"m":return u*n;case"seconds":case"second":case"secs":case"sec":case"s":return u*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(e);if("number"===c&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=s)return u(e,t,s,"day");if(t>=o)return u(e,t,o,"hour");if(t>=n)return u(e,t,n,"minute");if(t>=r)return u(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=s)return Math.round(e/s)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=n)return Math.round(e/n)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}}),xt=it({"node_modules/debug/src/common.js"(e,t){t.exports=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=_t(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}}});ut(it({"node_modules/debug/src/browser.js"(e,t){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),e.splice(o,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(e){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(e){}0;return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(e){}}(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=xt()(e);var{formatters:r}=t.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}})());var Et=it({"node_modules/capture-stack-trace/index.js"(e,t){t.exports=Error.captureStackTrace||function(e){var t=new Error;Object.defineProperty(e,"stack",{configurable:!0,get:function(){var e=t.stack;return Object.defineProperty(this,"stack",{value:e}),e}})}}}),jt=it({"node_modules/create-error-class/index.js"(e,t){var r=Et();t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(e))throw new Error("className contains invalid characters");t=t||function(e){this.message=e};var n,o,s=function(){Object.defineProperty(this,"name",{configurable:!0,value:e,writable:!0}),r(this,this.constructor),t.apply(this,arguments)};return n=s,o=Error,n.super_=o,n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s}}});(0,ut(jt()).default)("HttpError",(function(e,t){const r=e.url.length>400?`${e.url.slice(0,399)}…`:e.url;let n=`${e.method}-request to ${r} resulted in `;n+=`HTTP ${e.statusCode} ${e.statusMessage}`,this.message=n.trim(),this.response=e,this.request=t.options}));var Tt={};!function(e,t){var r="undefined"!=typeof Reflect?Reflect.construct:void 0,n=Object.defineProperty,o=Error.captureStackTrace;function s(e){void 0!==e&&n(this,"message",{configurable:!0,value:e,writable:!0});var t=this.constructor.name;void 0!==t&&t!==this.name&&n(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor)}void 0===o&&(o=function(e){var t=new Error;n(e,"stack",{configurable:!0,get:function(){var e=t.stack;return n(this,"stack",{configurable:!0,value:e,writable:!0}),e},set:function(t){n(e,"stack",{configurable:!0,value:t,writable:!0})}})}),s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var i=function(){function e(e,t){return n(e,"name",{configurable:!0,value:t})}try{var t=function(){};if(e(t,"foo"),"foo"===t.name)return e}catch(e){}}();t=e.exports=function(e,t){if(null==t||t===Error)t=s;else if("function"!=typeof t)throw new TypeError("super_ should be a function");var n;if("string"==typeof e)n=e,e=void 0!==r?function(){return r(t,arguments,this.constructor)}:function(){t.apply(this,arguments)},void 0!==i&&(i(e,n),n=void 0);else if("function"!=typeof e)throw new TypeError("constructor should be either a string or a function");e.super_=e.super=t;var o={constructor:{configurable:!0,value:e,writable:!0}};return void 0!==n&&(o.name={configurable:!0,value:n,writable:!0}),e.prototype=Object.create(t.prototype,o),e},t.BaseError=s}({get exports(){return Tt},set exports(e){Tt=e}},Tt);var St=Tt;function At(e){const t=Ft(e);At.super.call(this,t.message),Object.assign(this,t)}function Pt(e){const t=Ft(e);Pt.super.call(this,t.message),Object.assign(this,t)}function Ft(e){const t=e.body,r={response:e,statusCode:e.statusCode,responseBody:It(t,e)};return t.error&&t.message?(r.message=`${t.error} - ${t.message}`,r):t.error&&t.error.description?(r.message=t.error.description,r.details=t.error,r):(r.message=t.error||t.message||function(e){const t=e.statusMessage?` ${e.statusMessage}`:"";return`${e.method}-request to ${e.url} resulted in HTTP ${e.statusCode}${t}`}(e),r)}function It(e,t){return-1!==(t.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(e,null,2):e}St(At),St(Pt);const Rt={onResponse:e=>{if(e.statusCode>=500)throw new Pt(e);if(e.statusCode>=400)throw new At(e);return e}},$t={onResponse:e=>{const t=e.headers["x-sanity-warning"];return(Array.isArray(t)?t:[t]).filter(Boolean).forEach((e=>console.warn(e))),e}},qt=[].concat([$t,{processOptions:e=>{const t=e.body;return t?"function"==typeof t.pipe||(s=t).constructor&&"function"==typeof s.constructor.isBuffer&&s.constructor.isBuffer(s)||!(-1!==dt.indexOf(typeof t)||Array.isArray(t)||!1!==We(r=t)&&(void 0===(n=r.constructor)||!1!==We(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf")))?e:Object.assign({},e,{body:JSON.stringify(e.body),headers:Object.assign({},e.headers,{"Content-Type":"application/json"})}):e;var r,n,o,s}},{onResponse:e=>{const t=e.headers["content-type"]||"",r=Dt&&Dt.force||-1!==t.indexOf("application/json");return e.body&&t&&r?Object.assign({},e,{body:ft(e.body)}):e},processOptions:e=>Object.assign({},e,{headers:Object.assign({Accept:"application/json"},e.headers)})},{onRequest:e=>{if("xhr"!==e.adapter)return;const t=e.request,r=e.context;function n(e){return t=>{const n=t.lengthComputable?t.loaded/t.total*100:-1;r.channels.progress.publish({stage:e,percent:n,total:t.total,loaded:t.loaded,lengthComputable:t.lengthComputable})}}"upload"in t&&"onprogress"in t.upload&&(t.upload.onprogress=n("upload")),"onprogress"in t&&(t.onprogress=n("download"))}},Rt,((e={})=>{const t=e.implementation||ht.Observable;if(!t)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(e,r)=>new t((t=>(e.error.subscribe((e=>t.error(e))),e.progress.subscribe((e=>t.next(Object.assign({type:"progress"},e)))),e.response.subscribe((e=>{t.next(Object.assign({type:"response"},e)),t.complete()})),e.request.publish(r),()=>e.abort.publish())))}})({implementation:X})]);var Dt;const kt=Qe(qt);function Nt(e,t=kt){return t(Object.assign({maxRedirects:0},e))}Nt.defaultRequester=kt,Nt.ClientError=At,Nt.ServerError=Pt;function Ut(e){return"https://docs.sanity.io/help/"+e}const Mt=e=>(e=>{let t,r=!1;return(...n)=>(r||(t=e(...n),r=!0),t)})(((...t)=>console.warn(e.join(" "),...t))),Ht=Mt(["You are not using the Sanity CDN. That means your data is always fresh, but the CDN is faster and",`cheaper. Think about it! For more info, see ${Ut("js-client-cdn-configuration")}.`,"To hide this warning, please set the `useCdn` option to either `true` or `false` when creating","the client."]),zt=Mt(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${Ut("js-client-browser-token")} for more information and how to hide this warning.`]),Lt=Mt(["Using the Sanity client without specifying an API version is deprecated.",`See ${Ut("js-client-api-version")}`]),Bt={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,isPromiseAPI:!0},Vt=["localhost","127.0.0.1","0.0.0.0"],Xt=(e,t)=>{const r=Object.assign({},t,e);r.apiVersion||Lt();const o=Object.assign({},Bt,r),s=o.useProjectHostname;if("undefined"==typeof Promise){const e=Ut("js-client-promise-polyfill");throw new Error(`No native Promise-implementation found, polyfill needed - see ${e}`)}if(s&&!o.projectId)throw new Error("Configuration must contain `projectId`");const i="undefined"!=typeof window&&window.location&&window.location.hostname,a=i&&(e=>-1!==Vt.indexOf(e))(window.location.hostname);i&&a&&o.token&&!0!==o.ignoreBrowserTokenWarning?zt():void 0===o.useCdn&&Ht(),s&&(e=>{if(!/^[-a-z0-9]+$/i.test(e))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")})(o.projectId),o.dataset&&n(o.dataset),"requestTagPrefix"in o&&(o.requestTagPrefix=o.requestTagPrefix?u(o.requestTagPrefix).replace(/\.+$/,""):void 0),o.apiVersion=`${o.apiVersion}`.replace(/^v/,""),o.isDefaultApi=o.apiHost===Bt.apiHost,o.useCdn=Boolean(o.useCdn)&&!o.withCredentials,function(e){if("1"===e||"X"===e)return;const t=new Date(e);if(!(/^\d{4}-\d{2}-\d{2}$/.test(e)&&t instanceof Date&&t.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}(o.apiVersion);const c=o.apiHost.split("://",2),l=c[0],d=c[1],f=o.isDefaultApi?"apicdn.sanity.io":d;return o.useProjectHostname?(o.url=`${l}://${o.projectId}.${d}/v${o.apiVersion}`,o.cdnUrl=`${l}://${o.projectId}.${f}/v${o.apiVersion}`):(o.url=`${o.apiHost}/v${o.apiVersion}`,o.cdnUrl=o.url),o};function Jt(e=Bt){if(!(this instanceof Jt))return new Jt(e);if(this.config(e),this.assets=new de(this),this.datasets=new ce(this),this.projects=new le(this),this.users=new fe(this),this.auth=new pe(this),this.clientConfig.isPromiseAPI){const e=Object.assign({},this.clientConfig,{isPromiseAPI:!1});this.observable=new Jt(e)}}return Object.assign(Jt.prototype,ue),Object.assign(Jt.prototype,{clone(){return new Jt(this.config())},config(e){if(void 0===e)return Object.assign({},this.clientConfig);if(this.clientConfig&&!1===this.clientConfig.allowReconfigure)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");if(this.observable){const t=Object.assign({},e,{isPromiseAPI:!1});this.observable.config(t)}return this.clientConfig=Xt(e,this.clientConfig||{}),this},withConfig(e){return new Jt({...this.config(),...e})},getUrl(e,t=!1){return`${t?this.clientConfig.cdnUrl:this.clientConfig.url}/${e.replace(/^\//,"")}`},isPromiseAPI(){return this.clientConfig.isPromiseAPI},_requestObservable(e){const t=e.url||e.uri,r=void 0===e.canUseCdn?["GET","HEAD"].indexOf(e.method||"GET")>=0&&0===t.indexOf("/data/"):e.canUseCdn,n=this.clientConfig.useCdn&&r,o=e.tag&&this.clientConfig.requestTagPrefix?[this.clientConfig.requestTagPrefix,e.tag].join("."):e.tag||this.clientConfig.requestTagPrefix;o&&(e.query={tag:u(o),...e.query});const s=((e,t={})=>{const r={},n=t.token||e.token;n&&(r.Authorization=`Bearer ${n}`),t.useGlobalApi||e.useProjectHostname||!e.projectId||(r["X-Sanity-Project-ID"]=e.projectId);const o=Boolean(void 0===t.withCredentials?e.token||e.withCredentials:t.withCredentials),s=void 0===t.timeout?e.timeout:t.timeout;return Object.assign({},t,{headers:Object.assign({},r,t.headers||{}),timeout:void 0===s?3e5:s,proxy:t.proxy||e.proxy,json:!0,withCredentials:o})})(this.clientConfig,Object.assign({},e,{url:this.getUrl(t,n)}));return new X((e=>Nt(s,this.clientConfig.requester).subscribe(e)))},request(e){const t=this._requestObservable(e).pipe(ee((e=>"response"===e.type)),W((e=>e.body)));return this.isPromiseAPI()?Q(t):t}}),Jt.Patch=c,Jt.Transaction=d,Jt.ClientError=Nt.ClientError,Jt.ServerError=Nt.ServerError,Jt.requester=Nt.defaultRequester,Jt}));