Socket
Socket
Sign inDemoInstall

@sanity/client

Package Overview
Dependencies
Maintainers
6
Versions
986
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/client - npm Package Compare versions

Comparing version 0.101.7-next to 0.101.10-next

14

lib/data/listen.js

@@ -106,3 +106,15 @@ 'use strict';

var evt = parseEvent(err);
return evt instanceof Error ? evt : new Error(evt.error || evt.message || 'Unknown listener error');
return evt instanceof Error ? evt : new Error(extractErrorMessage(evt));
}
function extractErrorMessage(err) {
if (!err.error) {
return err.message || 'Unknown listener error';
}
if (err.error.description) {
return err.error.description;
}
return typeof err.error === 'string' ? err.error : JSON.stringify(err.error, null, 2);
}

2

package.json
{
"name": "@sanity/client",
"version": "0.101.7-next",
"version": "0.101.10-next",
"description": "Client for retrieving data from Sanity",

@@ -5,0 +5,0 @@ "main": "lib/sanityClient.js",

@@ -1,2 +0,2 @@

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.SanityClient=t()}}(function(){return function t(e,r,n){function o(s,u){if(!r[s]){if(!e[s]){var a="function"==typeof require&&require;if(!u&&a)return a(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:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return o(r?r:t)},l,l.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign"),i=t("../validators");o(n.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i.validateAssetType(t);var n=i.hasDataset(this.client.clientConfig),o="image"===t?"images":"files";return this.client.requestObservable({method:"POST",timeout:r.timeout||0,query:r.label?{label:r.label}:{},url:"/assets/"+o+"/"+n,headers:r.contentType?{"Content-Type":r.contentType}:{},body:e})},delete:function(t,e){var r=t,n=e;t._type&&(r=t._type.replace(/^(sanity\.|Asset$)/g,""),n=t._id),i.validateAssetType(r),i.validateDocumentId("delete",n);var o="image"===r?"images":"files";return this.client.request({method:"DELETE",url:"/assets/"+o+"/"+n})}}),e.exports=n},{"../validators":18,"object-assign":41}],2:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout"})}}),e.exports=n},{"object-assign":41}],3:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("./validators"),i=r.defaultConfig={apiHost:"https://api.sanity.io",useProjectHostname:!0,gradientMode:!1};r.initConfig=function(t,e){var r=n({},i,e,t),s=r.useProjectHostname;if("undefined"==typeof Promise)throw new Error("No native `Promise`-implementation found, polyfill needed");if(s&&!r.projectId)throw new Error("Configuration must contain `projectId`");if(s&&o.projectId(r.projectId),r.dataset&&o.dataset(r.dataset),r.gradientMode)r.url=r.apiHost;else{var u=r.apiHost.split("://",2),a=u[0],c=u[1];r.useProjectHostname?r.url=a+"://"+r.projectId+"."+c+"/v1":r.url=r.apiHost+"/v1"}return r}},{"./validators":18,"object-assign":41}],4:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("../validators"),s=t("../util/getSelection"),u=t("./encodeQueryString"),a=t("./transaction"),c=t("./patch"),l=t("./listen"),f=function(t,e){var r="undefined"==typeof t?e:t;return t===!1?void 0:r},p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:f(t.returnDocuments,!0),visibility:t.visibility||"sync"}},h=1948;e.exports={listen:l,getDataUrl:function(t,e){var r=this.clientConfig.projectId;return(this.clientConfig.gradientMode?"/"+t+"/"+r+"/"+e:"/data/"+t+"/"+e).replace(/\/($|\?)/,"$1")},fetch:function(t,e){return this.dataRequest("query",{query:t,params:e}).then(function(t){return t.result||[]})},getDocument:function(t){return this.request({uri:this.getDataUrl("doc",t),json:!0}).then(function(t){return t.documents&&t.documents[0]})},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return this._create(t,"createOrReplace",e)},patch:function(t,e){return new c(t,e,this)},delete:function(t,e){return this.dataRequest("mutate",{mutations:[{delete:s(t)}]},e)},mutate:function(t,e){var r=t instanceof c?t.serialize():t,n=Array.isArray(r)?r:[r];return this.dataRequest("mutate",{mutations:n},e)},transaction:function(t){return new a(t,this)},dataRequest:function(t,e){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s="mutate"===t,a=!s&&u(e),c=!s&&a.length<h,l=c?a:"",f=o.returnFirst;return i.promise.hasDataset(this.clientConfig).then(function(n){return r.request({method:c?"GET":"POST",uri:r.getDataUrl(t,""+n+l),json:!0,body:c?void 0:e,query:s&&p(o)})}).then(function(t){if(!s)return t;var e=t.results||[];if(o.returnDocuments)return f?e[0]&&e[0].document:e.map(function(t){return t.document});var r=f?"documentId":"documentIds",i=f?e[0]&&e[0].id:e.map(function(t){return t.id});return n({transactionId:t.transactionId,results:e},r,i)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=i.hasDataset(this.clientConfig),u=n({},e,o({},t,{_id:t._id||s+"."})),a=o({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[u]},a)}}},{"../util/getSelection":16,"../validators":18,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"object-assign":41}],5:[function(t,e,r){"use strict";var n=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,o=void 0===r?{}:r,i=t.options,s=void 0===i?{}:i,u=Object.keys(o).reduce(function(t,e){return t+"&"+n("$"+e)+"="+n(JSON.stringify(o[e]))},"?query="+n(e));return Object.keys(s).reduce(function(t,e){return s[e]?t+"&"+n(e)+"="+n(s[e]):t},u)}},{}],6:[function(t,e,r){"use strict";function n(t){try{var e=t.data&&JSON.parse(t.data)||{};return i({type:t.type},e)}catch(t){return t}}function o(t){if(t instanceof Error)return t;var e=n(t);return e instanceof Error?e:new Error(e.error||e.message||"Unknown listener error")}var i=t("object-assign"),s=t("@sanity/observable/minimal"),u=t("./encodeQueryString"),a=t("../validators"),c=t("../util/pick"),l=t("../util/defaults"),f="undefined"!=typeof window&&window.EventSource?window.EventSource:t("@sanity/eventsource"),p=function(t,e,r){t.removeEventListener?t.removeEventListener(e,r,!1):t.removeListener(e,r)},h=["includePreviousRevision","includeResult"],d={includeResult:!0};e.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},b=l(r,d),y=c(b,h),v=u({query:t,params:e,options:y}),m=a.hasDataset(this.clientConfig),g=""+this.clientConfig.url+this.getDataUrl("listen",""+m+v),w=this.clientConfig.token,j=b.events?b.events:["mutation"],O=j.indexOf("reconnect")!==-1,_=new f(g,i({withCredentials:!0},w?{headers:{"Sanity-Token":w}}:{}));return new s(function(t){function e(){_.readyState===f.CLOSED?t.complete():_.readyState===f.CONNECTING&&a()}function r(e){t.error(o(e))}function i(e){var r=n(e);return r instanceof Error?t.error(r):t.next(r)}function s(e){t.complete(),u()}function u(){j.forEach(function(t){return p(_,t,i)}),p(_,"error",e),p(_,"channelError",r),p(_,"disconnect",s),_.close()}function a(){O&&t.next({type:"reconnect"})}return _.addEventListener("error",e,!1),_.addEventListener("channelError",r,!1),_.addEventListener("disconnect",s,!1),j.forEach(function(t){return _.addEventListener(t,i,!1)}),u})}},{"../util/defaults":15,"../util/pick":17,"../validators":18,"./encodeQueryString":5,"@sanity/eventsource":50,"@sanity/observable/minimal":53,"object-assign":41}],7:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.selection=t,this.operations=s({},e),this.client=r}var i=t("deep-assign"),s=t("object-assign"),u=t("../util/getSelection"),a=t("../validators"),c=a.validateObject,l=a.validateInsert;s(o.prototype,{clone:function(){return new o(this.selection,s({},this.operations),this.client)},merge:function(t){return c("merge",t),this._assign("merge",i(this.operations.merge||{},t))},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return c("diffMatchPatch",t),this._assign("diffMatchPatch",t)},unset:function(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=s({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return c("replace",t),this._set("set",{$:t})},inc:function(t){return this._assign("inc",t)},dec:function(t){return this._assign("dec",t)},insert:function(t,e,r){var o;return l(t,e,r),this._assign("insert",(o={},n(o,t,e),n(o,"items",r),o))},append:function(t,e){return this.insert("after",t+"[-1]",e)},prepend:function(t,e){return this.insert("before",t+"[0]",e)},splice:function(t,e,r,n){var o="undefined"==typeof r||r===-1,i=e<0?e-1:e,s=o?-1:Math.max(0,e+r),u=i<0&&s>=0?"":s,a=t+"["+i+":"+u+"]";return this.insert("replace",a,n||[])},serialize:function(){return s(u(this.selection),this.operations)},toJSON:function(){return this.serialize()},commit:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.client)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");var e="string"==typeof this.selection,r=s({returnFirst:e,returnDocuments:!0},t);return this.client.mutate({patch:this.serialize()},r)},reset:function(){return this.operations={},this},_set:function(t,e){return this._assign(t,e,!1)},_assign:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return c(t,e),this.operations=s({},this.operations,n({},t,s({},r&&this.operations[t]||{},e))),this}}),e.exports=o},{"../util/getSelection":16,"../validators":18,"deep-assign":21,"object-assign":41}],8:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];this.operations=t,this.client=e}var i=t("object-assign"),s=t("../validators"),u=t("./patch"),a={returnDocuments:!1};i(o.prototype,{clone:function(){return new o(this.operations.slice(0),this.client)},create:function(t){return this._create(t,"create")},createIfNotExists:function(t){return this._create(t,"createIfNotExists")},createOrReplace:function(t){return this._create(t,"createOrReplace")},delete:function(t){return s.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function t(e,r){var n="function"==typeof r,o=e instanceof u;if(o)return this._add({patch:e.serialize()});if(n){var t=r(new u(e,{},this.client));if(!(t instanceof u))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:t.serialize()})}return this._add({patch:i({id:e},r)})},serialize:function(){return this.operations.slice()},toJSON:function(){return this.serialize()},commit:function(t){if(!this.client)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.client.mutate(this.serialize(),t||a)},reset:function(){return this.operations=[],this},_create:function(t,e){if(!t._id&&!this.client)throw new Error('Document needs an _id property when transaction is create outside a client scope. Pass `{_id: "<datasetName>:"}` to have Sanity generate an ID for you.');s.validateObject(e,t);var r=s.hasDataset(this.client.clientConfig),o=n({},e,i({},t,{_id:t._id||r+"."}));return this._add(o)},_add:function(t){return this.operations.push(t),this}}),e.exports=o},{"../validators":18,"./patch":7,"object-assign":41}],9:[function(t,e,r){"use strict";function n(t){this.request=t.request.bind(t)}var o=t("object-assign"),i=t("../validators");o(n.prototype,{create:function(t){return this._modify("PUT",t)},delete:function(t){return this._modify("DELETE",t)},list:function(){return this.request({uri:"/datasets"})},_modify:function(t,e){return i.dataset(e),this.request({method:t,uri:"/datasets/"+e})}}),e.exports=n},{"../validators":18,"object-assign":41}],10:[function(t,e,r){"use strict";function n(t){return!!p.shouldRetry(t)||t.response&&t.response.statusCode>=500}function o(t){var e=t.body;return this.response=t,this.statusCode=t.statusCode,this.responseBody=s(e,t),e.error&&e.message?void(this.message=e.error+" - "+e.message):e.error&&e.error.description?(this.message=e.error.description,void(this.details=e.error)):void(this.message=e.error||e.message||i(t))}function i(t){var e=t.statusMessage?" "+t.statusMessage:"";return t.method+"-request to "+t.url+" resulted in HTTP "+t.statusCode+e}function s(t,e){var r=(e.headers["content-type"]||"").toLowerCase(),n=r.indexOf("application/json")!==-1;return n?JSON.stringify(t,null,2):t}function u(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j,r=e(c({maxRedirects:0},t));return r.toPromise=function(){return new Promise(function(t,e){r.filter(function(t){return"response"===t.type}).subscribe(function(e){return t(e.body)},e)})},r}var a=t("get-it"),c=t("object-assign"),l=t("create-error-class"),f=t("get-it/lib/middleware/observable"),p=t("get-it/lib/middleware/retry"),h=t("get-it/lib/middleware/jsonRequest"),d=t("get-it/lib/middleware/jsonResponse"),b=t("@sanity/observable/minimal"),y=t("get-it/lib/middleware/progress"),v=l("ClientError",o),m=l("ServerError",o),g={onResponse:function(t){if(t.statusCode>=500)throw new m(t);if(t.statusCode>=400)throw new v(t);return t}},w=[h(),d(),y(),g,f({implementation:b}),p({maxRetries:5,shouldRetry:n})],j=a(w);u.defaultRequester=j,e.exports=u},{"@sanity/observable/minimal":53,"create-error-class":20,"get-it":23,"get-it/lib/middleware/jsonRequest":25,"get-it/lib/middleware/jsonResponse":26,"get-it/lib/middleware/observable":27,"get-it/lib/middleware/progress":29,"get-it/lib/middleware/retry":30,"object-assign":41}],11:[function(t,e,r){"use strict";var n="Sanity-Token",o="Sanity-Project-ID";e.exports=function(t){var e={};return t.token&&t.gradientMode?e.Authorization="Bearer "+t.token:t.token&&(e[n]=t.token),!t.useProjectHostname&&t.projectId&&(e[o]=t.projectId),{headers:e,timeout:"timeout"in t?t.timeout:3e4,withCredentials:!0,json:!0}}},{}],12:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/"+t})}}),e.exports=n},{"object-assign":41}],13:[function(t,e,r){"use strict";function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;this.config(t),this.assets=new p(this),this.datasets=new l(this),this.projects=new f(this),this.users=new h(this),this.auth=new d(this)}function o(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=e.reduce(function(t,e){return t||e.headers?s(t||{},e.headers||{}):null},null);return s.apply(void 0,e.concat([n?{headers:n}:{}]))}function i(t){return new n(t)}var s=t("object-assign"),u=t("./data/patch"),a=t("./data/transaction"),c=t("./data/dataMethods"),l=t("./datasets/datasetsClient"),f=t("./projects/projectsClient"),p=t("./assets/assetsClient"),h=t("./users/usersClient"),d=t("./auth/authClient"),b=t("./http/request"),y=t("./http/requestOptions"),v=t("./config"),m=v.defaultConfig,g=v.initConfig;s(n.prototype,c),s(n.prototype,{clone:function(){return new n(this.config())},config:function(t){return"undefined"==typeof t?s({},this.clientConfig):(this.clientConfig=g(t,this.clientConfig||{}),this)},getUrl:function(t){return this.clientConfig.url+"/"+t.replace(/^\//,"")},request:function(t){return this.requestObservable(t).toPromise()},requestObservable:function(t){return b(o(y(this.clientConfig),t,{url:this.getUrl(t.url||t.uri)}),this.clientConfig.requester)}}),i.Patch=u,i.Transaction=a,i.requester=b.defaultRequester,e.exports=i},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":10,"./http/requestOptions":11,"./projects/projectsClient":12,"./users/usersClient":14,"object-assign":41}],14:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{getById:function(t){return this.client.request({uri:"/users/"+t})}}),e.exports=n},{"object-assign":41}],15:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(e).concat(Object.keys(t)).reduce(function(r,n){return r[n]="undefined"==typeof t[n]?e[n]:t[n],r},{})}},{}],16:[function(t,e,r){"use strict";e.exports=function(t){if("string"==typeof t||Array.isArray(t))return{id:t};if(t&&t.query)return{query:t.query};var e=["* Dataset-prefixed document ID (<dataset.docId>)","* Array of dataset-prefixed document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n"+e)}},{}],17:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce(function(e,r){return"undefined"==typeof t[r]?e:(e[r]=t[r],e)},{})}},{}],18:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=["image","file"],i=["before","after","replace"];r.dataset=function(t){if(!/^[-\w]{1,128}$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes")},r.projectId=function(t){if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")},r.validateAssetType=function(t){if(o.indexOf(t)===-1)throw new Error("Invalid asset type: "+t+". Must be one of "+o.join(", "))},r.validateObject=function(t,e){if(null===e||"object"!==("undefined"==typeof e?"undefined":n(e))||Array.isArray(e))throw new Error(t+"() takes an object of properties")},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[-_a-z0-9]{1,128}\.[-_a-z0-9.]+$/i.test(e))throw new Error(t+"() takes a document ID in format dataset.docId")},r.validateInsert=function(t,e,r){var n="insert(at, selector, items)";if(i.indexOf(t)===-1){var o=i.map(function(t){return'"'+t+'"'}).join(", ");throw new Error(n+' takes an "at"-argument which is one of: '+o)}if("string"!=typeof e)throw new Error(n+' takes a "selector"-argument which must be a string');if(!Array.isArray(r))throw new Error(n+' takes an "items"-argument which must be an array')},r.hasDataset=function(t){if(!t.gradientMode&&!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},r.promise={hasDataset:function(t){return new Promise(function(e){return e(r.hasDataset(t))})}}},{}],19:[function(t,e,r){"use strict";e.exports=Error.captureStackTrace||function(t){var e=new Error;Object.defineProperty(t,"stack",{configurable:!0,get:function(){var t=e.stack;return Object.defineProperty(this,"stack",{value:t}),t}})}},{}],20:[function(t,e,r){"use strict";function n(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}var o=t("capture-stack-trace");e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(t))throw new Error("className contains invalid characters");e=e||function(t){this.message=t};var r=function(){Object.defineProperty(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor),e.apply(this,arguments)};return n(r,Error),r}},{"capture-stack-trace":19}],21:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}function o(t,e,r){var n=e[r];if(void 0!==n&&null!==n){if(u.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");u.call(t,r)&&s(n)?t[r]=i(Object(t[r]),e[r]):t[r]=n}}function i(t,e){if(t===e)return t;e=Object(e);for(var r in e)u.call(e,r)&&o(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),i=0;i<n.length;i++)a.call(e,n[i])&&o(t,e,n[i]);return t}var s=t("is-obj"),u=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(t){t=n(t);for(var e=1;e<arguments.length;e++)i(t,arguments[e]);return t}},{"is-obj":37}],22:[function(t,e,r){function n(t,e,r){if(!u(e))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this),"[object Array]"===a.call(t)?o(t,e,r):"string"==typeof t?i(t,e,r):s(t,e,r)}function o(t,e,r){for(var n=0,o=t.length;n<o;n++)c.call(t,n)&&e.call(r,t[n],n,t)}function i(t,e,r){for(var n=0,o=t.length;n<o;n++)e.call(r,t.charAt(n),n,t)}function s(t,e,r){for(var n in t)c.call(t,n)&&e.call(r,t[n],n,t)}var u=t("is-function");e.exports=n;var a=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":36}],23:[function(t,e,r){"use strict";var n=t("nano-pubsub"),o=t("./util/middlewareReducer"),i=t("./middleware/defaultOptionsProcessor"),s=t("./request"),u=["request","response","progress","error","abort"],a=["processOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=function t(){function e(t){function e(t,e,n){var o=t,s=e;if(!o)try{s=i("onResponse",e,n)}catch(t){s=null,o=t}o=o&&i("onError",o,n),o?r.error.publish(o):s&&r.response.publish(s)}var r=u.reduce(function(t,e){return t[e]=n(),t},{}),i=o(l),a=i("processOptions",t),c={options:a,channels:r,applyMiddleware:i},f=null,p=r.request.subscribe(function(t){f=s(t,function(r,n){return e(r,n,t)})});r.abort.subscribe(function(){p(),f&&f.abort()});var h=i("onReturn",r,c);return h===r&&r.request.publish(c),h}var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],c=[],l=a.reduce(function(t,e){return t[e]=t[e]||[],t},{processOptions:[i]});return e.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.onReturn&&l.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");a.forEach(function(e){t[e]&&l[e].push(t[e])}),c.push(t)},e.clone=function(){return t(c)},r.forEach(e.use),e}},{"./middleware/defaultOptionsProcessor":24,"./request":32,"./util/middlewareReducer":35,"nano-pubsub":40}],24:[function(t,e,r){"use strict";function n(t){if(t===!1||0===t)return!1;if(t.connect||t.socket)return t;var e=Number(t);return isNaN(e)?n(u.timeout):{connect:e,socket:e}}function o(t){var e={};for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}var i=t("object-assign"),s=t("url-parse"),u={timeout:12e4};e.exports=function(t){var e="string"==typeof t?i({url:t},u):i({},u,t),r=s(e.url,{},!0);return e.timeout=n(e.timeout),e.query&&(r.query=i({},r.query,o(e.query))),e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e.url=r.toString(),e}},{"object-assign":41,"url-parse":48}],25:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=t("object-assign"),i=t("is-plain-object"),s=["boolean","string","number"],u=function(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)};e.exports=function(){return{processOptions:function(t){var e=t.body,r=e&&!u(e)&&(s.indexOf("undefined"==typeof e?"undefined":n(e))!==-1||Array.isArray(e)||i(e)||e&&"function"==typeof e.toJSON);return r?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":38,"object-assign":41}],26:[function(t,e,r){"use strict";function n(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: "+t.message,t}}var o=t("object-assign");e.exports=function(){return{onResponse:function(t){var e=t.headers["content-type"];return t.body&&e&&e.indexOf("application/json")!==-1?o({},t,{body:n(t.body)}):t},processOptions:function(t){return o({},t,{headers:o({Accept:"application/json"},t.headers)})}}}},{"object-assign":41}],27:[function(t,e,r){"use strict";var n=t("../util/global"),o=t("object-assign");e.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.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":34,"object-assign":41}],28:[function(t,e,r){"use strict";e.exports=function(){return{onRequest:function(t){function e(t){return function(e){var r=e.lengthComputable?e.loaded/e.total*100:-1;n.channels.progress.publish({stage:t,percent:r,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}if("xhr"===t.adapter){var r=t.request,n=t.context;"upload"in r&&"onprogress"in r.upload&&(r.upload.onprogress=e("upload")),"onprogress"in r&&(r.onprogress=e("download"))}}}}},{}],29:[function(t,e,r){"use strict";e.exports=t("./node-progress")},{"./node-progress":28}],30:[function(t,e,r){"use strict";function n(t){return 100*Math.pow(2,t)+100*Math.random()}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=t("object-assign"),s=t("../util/node-shouldRetry"),u=function(t){return null!==t&&"object"===("undefined"==typeof t?"undefined":o(t))&&"function"==typeof t.pipe},a=e.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.maxRetries||5,r=t.retryDelay||n,o=t.shouldRetry||s;return{onError:function(t,n){var s=n.options,a=s.maxRetries||e,c=s.shouldRetry||o,l=s.attemptNumber||0;if(u(s.body))return t;if(!c(t,l)||l>=a)return t;var f=i({},n,{options:i({},s,{attemptNumber:l+1})});return setTimeout(function(){return n.channels.request.publish(f)},r(l)),null}}};a.shouldRetry=s},{"../util/node-shouldRetry":33,"object-assign":41}],31:[function(t,e,r){"use strict";var n=t("same-origin"),o=t("parse-headers"),i=function(){},s=window,u=s.XMLHttpRequest||i,a="withCredentials"in new u,c=a?u:s.XDomainRequest,l="xhr";e.exports=function(t,e){function r(){j=!0,m.abort()}function i(e){_=!0,m.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to "+b.url:"Connection timed out on request to "+b.url);r.code=e,t.channels.error.publish(r)}function a(){S&&(f(),v.socket=setTimeout(function(){return i("ESOCKETTIMEDOUT")},S.socket))}function f(){(j||m.readyState>=2&&v.connect)&&clearTimeout(v.connect),v.socket&&clearTimeout(v.socket)}function p(){if(!O){f(),O=!0,m=null;var t=new Error("Network error while attempting to reach "+b.url);t.isNetworkError=!0,t.request=b,e(t)}}function h(){var t=m.status,e=m.statusText;if(g&&void 0===t)t=200;else{if(t>12e3&&t<12156)return p();t=1223===m.status?204:m.status,e=1223===m.status?"No Content":e}return{body:m.response||m.responseText,url:b.url,method:b.method,headers:g?{}:o(m.getAllResponseHeaders()),statusCode:t,statusMessage:e}}function d(){if(!(j||O||_)){if(0===m.status)return void p(new Error("Unknown XHR error"));f(),O=!0,e(null,h())}}var b=t.options,y=!n(s.location.href,b.url),v={},m=y?new c:new u,g=s.XDomainRequest&&m instanceof s.XDomainRequest,w=b.headers,j=!1,O=!1,_=!1;m.onerror=p,m.ontimeout=p,m.onabort=function(){j=!0},m.onprogress=function(){};var x=g?"onload":"onreadystatechange";if(m[x]=function(){a(),j||4!==m.readyState&&!g||0!==m.status&&d()},m.open(b.method,b.url,!0),m.withCredentials=!!b.withCredentials,w&&m.setRequestHeader)for(var E in w)w.hasOwnProperty(E)&&m.setRequestHeader(E,w[E]);else if(w&&g)throw new Error("Headers cannot be set on an XDomainRequest object");b.rawBody&&(m.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:b,adapter:l,request:m,context:t}),m.send(b.body||null);var S=b.timeout;return S&&(v.connect=setTimeout(function(){return i("ETIMEDOUT")},S.connect)),{abort:r}}},{"parse-headers":42,"same-origin":45}],32:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":31}],33:[function(t,e,r){"use strict";e.exports=function(t){return t.isNetworkError||!1}},{}],34:[function(t,e,r){(function(t){"use strict";"undefined"!=typeof window?e.exports=window:"undefined"!=typeof t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],35:[function(t,e,r){"use strict";e.exports=function(t){var e=function(e,r){for(var n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return t[e].reduce(function(t,e){return e.apply(void 0,[t].concat(o))},r)};return e}},{}],36:[function(t,e,r){function n(t){var e=o.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}e.exports=n;var o=Object.prototype.toString},{}],37:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],38:[function(t,e,r){"use strict";function n(t){return o(t)===!0&&"[object Object]"===Object.prototype.toString.call(t)}var o=t("isobject");e.exports=function(t){var e,r;return n(t)!==!1&&(e=t.constructor,"function"==typeof e&&(r=e.prototype,n(r)!==!1&&r.hasOwnProperty("isPrototypeOf")!==!1))}},{isobject:39}],39:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}},{}],40:[function(t,e,r){e.exports=function(){function t(t){return r.push(t),function(){var e=r.indexOf(t);e>-1&&r.splice(e,1)}}function e(){for(var t=0;t<r.length;t++)r[t].apply(null,arguments)}var r=[];return{subscribe:t,publish:e}}},{}],41:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function o(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}var i=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(t,e){for(var r,o,a=n(t),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var l in r)s.call(r,l)&&(a[l]=r[l]);if(i){o=i(r);for(var f=0;f<o.length;f++)u.call(r,o[f])&&(a[o[f]]=r[o[f]])}}return a}},{}],42:[function(t,e,r){var n=t("trim"),o=t("for-each"),i=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};var e={};return o(n(t).split("\n"),function(t){var r=t.indexOf(":"),o=n(t.slice(0,r)).toLowerCase(),s=n(t.slice(r+1));"undefined"==typeof e[o]?e[o]=s:i(e[o])?e[o].push(s):e[o]=[e[o],s]}),e}},{"for-each":22,trim:47}],43:[function(t,e,r){"use strict";function n(t){for(var e,r=/([^=?&]+)=?([^&]*)/g,n={};e=r.exec(t);n[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return n}function o(t,e){e=e||"";var r=[];"string"!=typeof e&&(e="?");for(var n in t)i.call(t,n)&&r.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return r.length?e+r.join("&"):""}var i=Object.prototype.hasOwnProperty;r.stringify=o,r.parse=n},{}],44:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":
case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],45:[function(t,e,r){"use strict";var n=t("url");e.exports=function(t,e,r){if(t===e)return!0;var o=n.parse(t,!1,!0),i=n.parse(e,!1,!0),s=0|o.port||("https"===o.protocol?443:80),u=0|i.port||("https"===i.protocol?443:80),a={proto:o.protocol===i.protocol,hostname:o.hostname===i.hostname,port:s===u};return a.proto&&a.hostname&&(a.port||r)}},{url:46}],46:[function(t,e,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;e.exports={regex:n,parse:function(t){var e=n.exec(t);return e?{protocol:(e[1]||"").toLowerCase()||void 0,hostname:(e[5]||"").toLowerCase()||void 0,port:e[6]||void 0}:{}}}},{}],47:[function(t,e,r){function n(t){return t.replace(/^\s*|\s*$/g,"")}r=e.exports=n,r.left=function(t){return t.replace(/^\s*/,"")},r.right=function(t){return t.replace(/\s*$/,"")}},{}],48:[function(t,e,r){"use strict";function n(t){var e=c.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]}}function o(t,e){for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}function i(t,e,r){if(!(this instanceof i))return new i(t,e,r);var c,f,p,h,d,b,y=l.slice(),v=typeof e,m=this,g=0;for("object"!==v&&"string"!==v&&(r=e,e=null),r&&"function"!=typeof r&&(r=a.parse),e=u(e),f=n(t||""),c=!f.protocol&&!f.slashes,m.slashes=f.slashes||c&&e.slashes,m.protocol=f.protocol||e.protocol||"",t=f.rest,f.slashes||(y[2]=[/(.*)/,"pathname"]);g<y.length;g++)h=y[g],p=h[0],b=h[1],p!==p?m[b]=t:"string"==typeof p?~(d=t.indexOf(p))&&("number"==typeof h[2]?(m[b]=t.slice(0,d),t=t.slice(d+h[2])):(m[b]=t.slice(d),t=t.slice(0,d))):(d=p.exec(t))&&(m[b]=d[1],t=t.slice(0,d.index)),m[b]=m[b]||(c&&h[3]?e[b]||"":""),h[4]&&(m[b]=m[b].toLowerCase());r&&(m.query=r(m.query)),c&&e.slashes&&"/"!==m.pathname.charAt(0)&&(""!==m.pathname||""!==e.pathname)&&(m.pathname=o(m.pathname,e.pathname)),s(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(h=m.auth.split(":"),m.username=h[0]||"",m.password=h[1]||""),m.origin=m.protocol&&m.host&&"file:"!==m.protocol?m.protocol+"//"+m.host:"null",m.href=m.toString()}var s=t("requires-port"),u=t("./lolcation"),a=t("querystringify"),c=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]];i.prototype.set=function(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||a.parse)(e)),n[t]=e;break;case"port":n[t]=e,s(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,/:\d+$/.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":n.pathname=e.length&&"/"!==e.charAt(0)?"/"+e:e;break;default:n[t]=e}for(var o=0;o<l.length;o++){var i=l[o];i[4]&&(n[i[1]]=n[i[1]].toLowerCase())}return n.origin=n.protocol&&n.host&&"file:"!==n.protocol?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},i.prototype.toString=function(t){t&&"function"==typeof t||(t=a.stringify);var e,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var o=n+(r.slashes?"//":"");return r.username&&(o+=r.username,r.password&&(o+=":"+r.password),o+="@"),o+=r.host+r.pathname,e="object"==typeof r.query?t(r.query):r.query,e&&(o+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(o+=r.hash),o},i.extractProtocol=n,i.location=u,i.qs=a,e.exports=i},{"./lolcation":49,querystringify:43,"requires-port":44}],49:[function(t,e,r){(function(r){"use strict";var n,o=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,i={hash:1,query:1};e.exports=function(e){e=e||r.location||{},n=n||t("./");var s,u={},a=typeof e;if("blob:"===e.protocol)u=new n(unescape(e.pathname),{});else if("string"===a){u=new n(e,{});for(s in i)delete u[s]}else if("object"===a){for(s in e)s in i||(u[s]=e[s]);void 0===u.slashes&&(u.slashes=o.test(e.href))}return u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":48}],50:[function(t,e,r){var n=t("eventsource-polyfill/dist/eventsource");e.exports=window.EventSource||n.EventSource},{"eventsource-polyfill/dist/eventsource":51}],51:[function(t,e,r){!function(t){function e(t,e,r,n){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.data=e||null,this.origin=r||"",this.lastEventId=n||"",this.type=t||"message"}function r(){return!(!window.XDomainRequest||!window.XMLHttpRequest||void 0!==(new XMLHttpRequest).responseType)}if(!t.EventSource||t._eventSourceImportPrefix){var n=(t._eventSourceImportPrefix||"")+"EventSource",o=function(t,e){if(!t||"string"!=typeof t)throw new SyntaxError("Not enough arguments");this.URL=t,this.setOptions(e);var r=this;setTimeout(function(){r.poll()},0)};if(o.prototype={CONNECTING:0,OPEN:1,CLOSED:2,defaultOptions:{loggingEnabled:!1,loggingPrefix:"eventsource",interval:500,bufferSizeLimit:262144,silentTimeout:3e5,getArgs:{evs_buffer_size_limit:262144},xhrHeaders:{Accept:"text/event-stream","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}},setOptions:function(t){var e,r=this.defaultOptions;for(e in r)r.hasOwnProperty(e)&&(this[e]=r[e]);for(e in t)e in r&&t.hasOwnProperty(e)&&(this[e]=t[e]);this.getArgs&&this.bufferSizeLimit&&(this.getArgs.evs_buffer_size_limit=this.bufferSizeLimit),"undefined"!=typeof console&&"undefined"!=typeof console.log||(this.loggingEnabled=!1)},log:function(t){this.loggingEnabled&&console.log("["+this.loggingPrefix+"]:"+t)},poll:function(){try{if(this.readyState==this.CLOSED)return;this.cleanup(),this.readyState=this.CONNECTING,this.cursor=0,this.cache="",this._xhr=new this.XHR(this),this.resetNoActivityTimer()}catch(t){this.log("There were errors inside the pool try-catch"),this.dispatchEvent("error",{type:"error",data:t.message})}},pollAgain:function(t){var e=this;e.readyState=e.CONNECTING,e.dispatchEvent("error",{type:"error",data:"Reconnecting "}),this._pollTimer=setTimeout(function(){e.poll()},t||0)},cleanup:function(){this.log("evs cleaning up"),this._pollTimer&&(clearInterval(this._pollTimer),this._pollTimer=null),this._noActivityTimer&&(clearInterval(this._noActivityTimer),this._noActivityTimer=null),this._xhr&&(this._xhr.abort(),this._xhr=null)},resetNoActivityTimer:function(){if(this.silentTimeout){this._noActivityTimer&&clearInterval(this._noActivityTimer);var t=this;this._noActivityTimer=setTimeout(function(){t.log("Timeout! silentTImeout:"+t.silentTimeout),t.pollAgain()},this.silentTimeout)}},close:function(){this.readyState=this.CLOSED,this.log("Closing connection. readyState: "+this.readyState),this.cleanup()},ondata:function(){var t=this._xhr;if(t.isReady()&&!t.hasError()){this.resetNoActivityTimer(),this.readyState==this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent("open",{type:"open"}));var e=t.getBuffer();e.length>this.bufferSizeLimit&&(this.log("buffer.length > this.bufferSizeLimit"),this.pollAgain()),0==this.cursor&&e.length>0&&"\ufeff"==e.substring(0,1)&&(this.cursor=1);var r=this.lastMessageIndex(e);if(r[0]>=this.cursor){var n=r[1],o=e.substring(this.cursor,n);this.parseStream(o),this.cursor=n}t.isDone()&&(this.log("request.isDone(). reopening the connection"),this.pollAgain(this.interval))}else this.readyState!==this.CLOSED&&(this.log("this.readyState !== this.CLOSED"),this.pollAgain(this.interval))},parseStream:function(t){t=this.cache+this.normalizeToLF(t);var r,n,o,i,s,u,a=t.split("\n\n");for(r=0;r<a.length-1;r++){for(o="message",i=[],parts=a[r].split("\n"),n=0;n<parts.length;n++)s=this.trimWhiteSpace(parts[n]),0==s.indexOf("event")?o=s.replace(/event:?\s*/,""):0==s.indexOf("retry")?(u=parseInt(s.replace(/retry:?\s*/,"")),isNaN(u)||(this.interval=u)):0==s.indexOf("data")?i.push(s.replace(/data:?\s*/,"")):0==s.indexOf("id:")?this.lastEventId=s.replace(/id:?\s*/,""):0==s.indexOf("id")&&(this.lastEventId=null);if(i.length){var c=new e(o,i.join("\n"),window.location.origin,this.lastEventId);this.dispatchEvent(o,c)}}this.cache=a[a.length-1]},dispatchEvent:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=0;n<r.length;n++)r[n].call(this,e);this["on"+t]&&this["on"+t].call(this,e)},addEventListener:function(t,e){this["_"+t+"Handlers"]||(this["_"+t+"Handlers"]=[]),this["_"+t+"Handlers"].push(e)},removeEventListener:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=r.length-1;n>=0;--n)if(r[n]===e){r.splice(n,1);break}},_pollTimer:null,_noactivityTimer:null,_xhr:null,lastEventId:null,cache:"",cursor:0,onerror:null,onmessage:null,onopen:null,readyState:0,urlWithParams:function(t,e){var r=[];if(e){var n,o,i=encodeURIComponent;for(n in e)e.hasOwnProperty(n)&&(o=i(n)+"="+i(e[n]),r.push(o))}return r.length>0?t.indexOf("?")==-1?t+"?"+r.join("&"):t+"&"+r.join("&"):t},lastMessageIndex:function(t){var e=t.lastIndexOf("\n\n"),r=t.lastIndexOf("\r\r"),n=t.lastIndexOf("\r\n\r\n");return n>Math.max(e,r)?[n,n+4]:[Math.max(e,r),Math.max(e,r)+2]},trimWhiteSpace:function(t){var e=/^(\s|\u00A0)+|(\s|\u00A0)+$/g;return t.replace(e,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},r()){o.isPolyfill="IE_8-9";var i=o.prototype.defaultOptions;i.xhrHeaders=null,i.getArgs.evs_preamble=2056,o.prototype.XHR=function(t){request=new XDomainRequest,this._request=request,request.onprogress=function(){request._ready=!0,t.ondata()},request.onload=function(){this._loaded=!0,t.ondata()},request.onerror=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest error"})},request.ontimeout=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest timed out"})};var e={};if(t.getArgs){var r=t.getArgs;for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n]);t.lastEventId&&(e.evs_last_event_id=t.lastEventId)}request.open("GET",t.urlWithParams(t.URL,e)),request.send()},o.prototype.XHR.prototype={useXDomainRequest:!0,_request:null,_ready:!1,_loaded:!1,_failed:!1,isReady:function(){return this._request._ready},isDone:function(){return this._request._loaded},hasError:function(){return this._request._failed},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}}}else o.isPolyfill="XHR",o.prototype.XHR=function(t){request=new XMLHttpRequest,this._request=request,t._xhr=this,request.onreadystatechange=function(){request.readyState>1&&t.readyState!=t.CLOSED&&(200==request.status||request.status>=300&&request.status<400?t.ondata():(request._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"The server responded with "+request.status}),t.close()))},request.onprogress=function(){},request.open("GET",t.urlWithParams(t.URL,t.getArgs),!0);var e=t.xhrHeaders;for(var r in e)e.hasOwnProperty(r)&&request.setRequestHeader(r,e[r]);t.lastEventId&&request.setRequestHeader("Last-Event-Id",t.lastEventId),request.send()},o.prototype.XHR.prototype={useXDomainRequest:!1,_request:null,_failed:!1,isReady:function(){return this._request.readyState>=2},isDone:function(){return 4==this._request.readyState},hasError:function(){return this._failed||this._request.status>=400},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}};t[n]=o}}(this)},{}],52:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var o=t("rxjs/Observable"),i=o.Observable,s=t("rxjs/operator/map"),u=s.map,a=t("rxjs/operator/filter"),c=a.filter,l=t("rxjs/operator/reduce"),f=l.reduce,p=t("rxjs/operator/toPromise"),h=p.toPromise,d=t("object-assign");n.prototype=Object.create(d(Object.create(null),i.prototype)),Object.defineProperty(n.prototype,"constructor",{value:n,enumerable:!1,writable:!0,configurable:!0}),n.prototype.lift=function(t){var e=new n;return e.source=this,e.operator=t,e},n.prototype.map=u,n.prototype.filter=c,n.prototype.reduce=f,n.prototype.toPromise=h,e.exports=n},{"object-assign":54,"rxjs/Observable":55,"rxjs/operator/filter":59,"rxjs/operator/map":60,"rxjs/operator/reduce":61,"rxjs/operator/toPromise":62}],53:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":52}],54:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function o(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}var i=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(t,e){for(var r,o,a=n(t),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var l in r)s.call(r,l)&&(a[l]=r[l]);if(i){o=i(r);for(var f=0;f<o.length;f++)u.call(r,o[f])&&(a[o[f]]=r[o[f]])}}return a}},{}],55:[function(t,e,r){"use strict";var n=t("./util/root"),o=t("./util/toSubscriber"),i=t("./symbol/observable"),s=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=o.toSubscriber(t,e,r);if(n?n.call(i,this.source):i.add(this._subscribe(i)),i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype.forEach=function(t,e){var r=this;if(e||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?e=n.root.Rx.config.Promise:n.root.Promise&&(e=n.root.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var o=r.subscribe(function(e){if(o)try{t(e)}catch(t){n(t),o.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[i.$$observable]=function(){return this},t.create=function(e){return new t(e)},t}();r.Observable=s},{"./symbol/observable":63,"./util/root":70,"./util/toSubscriber":71}],56:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],57:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("./util/isFunction"),i=t("./Subscription"),s=t("./Observer"),u=t("./symbol/rxSubscriber"),a=function(t){function e(r,n,o){switch(t.call(this),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=s.empty;break;case 1:if(!r){this.destination=s.empty;break}if("object"==typeof r){r instanceof e?(this.destination=r,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new c(this,r));break}default:this.syncErrorThrowable=!0,this.destination=new c(this,r,n,o)}}return n(e,t),e.prototype[u.$$rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e}(i.Subscription);r.Subscriber=a;var c=function(t){function e(e,r,n,i){t.call(this),this._parent=e;var s,u=this;o.isFunction(r)?s=r:r&&(u=r,s=r.next,n=r.error,i=r.complete,o.isFunction(u.unsubscribe)&&this.add(u.unsubscribe.bind(u)),u.unsubscribe=this.unsubscribe.bind(this)),this._context=u,this._next=s,this._error=n,this._complete=i}return n(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parent;e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parent;if(this._error)e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else{if(!e.syncErrorThrowable)throw this.unsubscribe(),t;e.syncErrorValue=t,e.syncErrorThrown=!0,this.unsubscribe()}}},e.prototype.complete=function(){if(!this.isStopped){var t=this._parent;this._complete?t.syncErrorThrowable?(this.__tryOrSetError(t,this._complete),this.unsubscribe()):(this.__tryOrUnsub(this._complete),this.unsubscribe()):this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){throw this.unsubscribe(),t}},e.prototype.__tryOrSetError=function(t,e,r){try{e.call(this._context,r)}catch(e){return t.syncErrorValue=e,t.syncErrorThrown=!0,!0}return!1},e.prototype._unsubscribe=function(){var t=this._parent;this._context=null,this._parent=null,t.unsubscribe()},e}(a)},{"./Observer":56,"./Subscription":58,"./symbol/rxSubscriber":64,"./util/isFunction":68}],58:[function(t,e,r){"use strict";function n(t){return t.reduce(function(t,e){return t.concat(e instanceof l.UnsubscriptionError?e.errors:e)},[])}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("./util/isArray"),s=t("./util/isObject"),u=t("./util/isFunction"),a=t("./util/tryCatch"),c=t("./util/errorObject"),l=t("./util/UnsubscriptionError"),f=function(){function t(t){this.closed=!1,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){this.closed=!0;var r=this,o=r._unsubscribe,f=r._subscriptions;if(this._subscriptions=null,u.isFunction(o)){var p=a.tryCatch(o).call(this);p===c.errorObject&&(e=!0,t=t||(c.errorObject.e instanceof l.UnsubscriptionError?n(c.errorObject.e.errors):[c.errorObject.e]))}if(i.isArray(f))for(var h=-1,d=f.length;++h<d;){var b=f[h];if(s.isObject(b)){var p=a.tryCatch(b.unsubscribe).call(b);if(p===c.errorObject){e=!0,t=t||[];var y=c.errorObject.e;y instanceof l.UnsubscriptionError?t=t.concat(n(y.errors)):t.push(y)}}}if(e)throw new l.UnsubscriptionError(t)}},t.prototype.add=function(e){if(!e||e===t.EMPTY)return t.EMPTY;if(e===this)return this;var r=e;switch(typeof e){case"function":r=new t(e);case"object":if(r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var n=new p(r,this);return this._subscriptions=this._subscriptions||[],this._subscriptions.push(n),n},t.prototype.remove=function(e){if(null!=e&&e!==this&&e!==t.EMPTY){var r=this._subscriptions;if(r){var n=r.indexOf(e);n!==-1&&r.splice(n,1)}}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();r.Subscription=f;var p=function(t){function e(e,r){t.call(this),this._innerSub=e,this._parent=r}return o(e,t),e.prototype._unsubscribe=function(){var t=this,e=t._innerSub,r=t._parent;r.remove(this),e.unsubscribe()},e}(f);r.ChildSubscription=p},{"./util/UnsubscriptionError":65,"./util/errorObject":66,"./util/isArray":67,"./util/isFunction":68,"./util/isObject":69,"./util/tryCatch":72}],59:[function(t,e,r){"use strict";function n(t,e){return this.lift(new s(t,e))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.filter=n;var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.predicate,this.thisArg))},t}(),u=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return o(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":57}],60:[function(t,e,r){"use strict";function n(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new s(t,e))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.map=n;var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.thisArg))},t}();r.MapOperator=s;var u=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":57}],61:[function(t,e,r){"use strict";function n(t,e){var r=!1;return arguments.length>=2&&(r=!0),this.lift(new s(t,e,r))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.reduce=n;var s=function(){function t(t,e,r){void 0===r&&(r=!1),this.accumulator=t,this.seed=e,this.hasSeed=r}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.accumulator,this.seed,this.hasSeed))},t}();r.ReduceOperator=s;var u=function(t){function e(e,r,n,o){t.call(this,e),this.accumulator=r,this.hasSeed=o,this.hasValue=!1,this.acc=n}return o(e,t),e.prototype._next=function(t){this.hasValue||(this.hasValue=this.hasSeed)?this._tryReduce(t):(this.acc=t,this.hasValue=!0)},e.prototype._tryReduce=function(t){var e;try{e=this.accumulator(this.acc,t)}catch(t){return void this.destination.error(t)}this.acc=e},e.prototype._complete=function(){(this.hasValue||this.hasSeed)&&this.destination.next(this.acc),this.destination.complete()},e}(i.Subscriber);r.ReduceSubscriber=u},{"../Subscriber":57}],62:[function(t,e,r){"use strict";function n(t){var e=this;if(t||(o.root.Rx&&o.root.Rx.config&&o.root.Rx.config.Promise?t=o.root.Rx.config.Promise:o.root.Promise&&(t=o.root.Promise)),!t)throw new Error("no Promise impl found");return new t(function(t,r){var n;e.subscribe(function(t){return n=t},function(t){return r(t)},function(){return t(n)})})}var o=t("../util/root");r.toPromise=n},{"../util/root":70}],63:[function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var o=t("../util/root");r.getSymbolObservable=n,r.$$observable=n(o.root)},{"../util/root":70}],64:[function(t,e,r){"use strict";var n=t("../util/root"),o=n.root.Symbol;r.$$rxSubscriber="function"==typeof o&&"function"==typeof o.for?o.for("rxSubscriber"):"@@rxSubscriber"},{"../util/root":70}],65:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=function(t){function e(e){t.call(this),this.errors=e;var r=Error.call(this,e?e.length+" errors occurred during unsubscription:\n "+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"");this.name=r.name="UnsubscriptionError",this.stack=r.stack,this.message=r.message}return n(e,t),e}(Error);r.UnsubscriptionError=o},{}],66:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],67:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],68:[function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.isFunction=n},{}],69:[function(t,e,r){"use strict";function n(t){return null!=t&&"object"==typeof t}r.isObject=n},{}],70:[function(t,e,r){(function(t){"use strict";if(r.root="object"==typeof window&&window.window===window&&window||"object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t,!r.root)throw new Error("RxJS could not find any global context (window, self, global)")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],71:[function(t,e,r){"use strict";function n(t,e,r){if(t){if(t instanceof o.Subscriber)return t;if(t[i.$$rxSubscriber])return t[i.$$rxSubscriber]()}return t||e||r?new o.Subscriber(t,e,r):new o.Subscriber(s.empty)}var o=t("../Subscriber"),i=t("../symbol/rxSubscriber"),s=t("../Observer");r.toSubscriber=n},{"../Observer":56,"../Subscriber":57,"../symbol/rxSubscriber":64}],72:[function(t,e,r){"use strict";function n(){try{return i.apply(this,arguments)}catch(t){return s.errorObject.e=t,s.errorObject}}function o(t){return i=t,n}var i,s=t("./errorObject");r.tryCatch=o},{"./errorObject":66}]},{},[13])(13)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.SanityClient=t()}}(function(){return function t(e,r,n){function o(s,u){if(!r[s]){if(!e[s]){var a="function"==typeof require&&require;if(!u&&a)return a(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:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return o(r?r:t)},l,l.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign"),i=t("../validators");o(n.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i.validateAssetType(t);var n=i.hasDataset(this.client.clientConfig),o="image"===t?"images":"files";return this.client.requestObservable({method:"POST",timeout:r.timeout||0,query:r.label?{label:r.label}:{},url:"/assets/"+o+"/"+n,headers:r.contentType?{"Content-Type":r.contentType}:{},body:e})},delete:function(t,e){var r=t,n=e;t._type&&(r=t._type.replace(/^(sanity\.|Asset$)/g,""),n=t._id),i.validateAssetType(r),i.validateDocumentId("delete",n);var o="image"===r?"images":"files";return this.client.request({method:"DELETE",url:"/assets/"+o+"/"+n})}}),e.exports=n},{"../validators":18,"object-assign":41}],2:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout"})}}),e.exports=n},{"object-assign":41}],3:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("./validators"),i=r.defaultConfig={apiHost:"https://api.sanity.io",useProjectHostname:!0,gradientMode:!1};r.initConfig=function(t,e){var r=n({},i,e,t),s=r.useProjectHostname;if("undefined"==typeof Promise)throw new Error("No native `Promise`-implementation found, polyfill needed");if(s&&!r.projectId)throw new Error("Configuration must contain `projectId`");if(s&&o.projectId(r.projectId),r.dataset&&o.dataset(r.dataset),r.gradientMode)r.url=r.apiHost;else{var u=r.apiHost.split("://",2),a=u[0],c=u[1];r.useProjectHostname?r.url=a+"://"+r.projectId+"."+c+"/v1":r.url=r.apiHost+"/v1"}return r}},{"./validators":18,"object-assign":41}],4:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=t("object-assign"),i=t("../validators"),s=t("../util/getSelection"),u=t("./encodeQueryString"),a=t("./transaction"),c=t("./patch"),l=t("./listen"),f=function(t,e){var r="undefined"==typeof t?e:t;return t===!1?void 0:r},p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{returnIds:!0,returnDocuments:f(t.returnDocuments,!0),visibility:t.visibility||"sync"}},h=1948;e.exports={listen:l,getDataUrl:function(t,e){var r=this.clientConfig.projectId;return(this.clientConfig.gradientMode?"/"+t+"/"+r+"/"+e:"/data/"+t+"/"+e).replace(/\/($|\?)/,"$1")},fetch:function(t,e){return this.dataRequest("query",{query:t,params:e}).then(function(t){return t.result||[]})},getDocument:function(t){return this.request({uri:this.getDataUrl("doc",t),json:!0}).then(function(t){return t.documents&&t.documents[0]})},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return this._create(t,"createOrReplace",e)},patch:function(t,e){return new c(t,e,this)},delete:function(t,e){return this.dataRequest("mutate",{mutations:[{delete:s(t)}]},e)},mutate:function(t,e){var r=t instanceof c?t.serialize():t,n=Array.isArray(r)?r:[r];return this.dataRequest("mutate",{mutations:n},e)},transaction:function(t){return new a(t,this)},dataRequest:function(t,e){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s="mutate"===t,a=!s&&u(e),c=!s&&a.length<h,l=c?a:"",f=o.returnFirst;return i.promise.hasDataset(this.clientConfig).then(function(n){return r.request({method:c?"GET":"POST",uri:r.getDataUrl(t,""+n+l),json:!0,body:c?void 0:e,query:s&&p(o)})}).then(function(t){if(!s)return t;var e=t.results||[];if(o.returnDocuments)return f?e[0]&&e[0].document:e.map(function(t){return t.document});var r=f?"documentId":"documentIds",i=f?e[0]&&e[0].id:e.map(function(t){return t.id});return n({transactionId:t.transactionId,results:e},r,i)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=i.hasDataset(this.clientConfig),u=n({},e,o({},t,{_id:t._id||s+"."})),a=o({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[u]},a)}}},{"../util/getSelection":16,"../validators":18,"./encodeQueryString":5,"./listen":6,"./patch":7,"./transaction":8,"object-assign":41}],5:[function(t,e,r){"use strict";var n=encodeURIComponent;e.exports=function(t){var e=t.query,r=t.params,o=void 0===r?{}:r,i=t.options,s=void 0===i?{}:i,u=Object.keys(o).reduce(function(t,e){return t+"&"+n("$"+e)+"="+n(JSON.stringify(o[e]))},"?query="+n(e));return Object.keys(s).reduce(function(t,e){return s[e]?t+"&"+n(e)+"="+n(s[e]):t},u)}},{}],6:[function(t,e,r){"use strict";function n(t){try{var e=t.data&&JSON.parse(t.data)||{};return s({type:t.type},e)}catch(t){return t}}function o(t){if(t instanceof Error)return t;var e=n(t);return e instanceof Error?e:new Error(i(e))}function i(t){return t.error?t.error.description?t.error.description:"string"==typeof t.error?t.error:JSON.stringify(t.error,null,2):t.message||"Unknown listener error"}var s=t("object-assign"),u=t("@sanity/observable/minimal"),a=t("./encodeQueryString"),c=t("../validators"),l=t("../util/pick"),f=t("../util/defaults"),p="undefined"!=typeof window&&window.EventSource?window.EventSource:t("@sanity/eventsource"),h=function(t,e,r){t.removeEventListener?t.removeEventListener(e,r,!1):t.removeListener(e,r)},d=["includePreviousRevision","includeResult"],b={includeResult:!0};e.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=f(r,b),y=l(i,d),v=a({query:t,params:e,options:y}),m=c.hasDataset(this.clientConfig),g=""+this.clientConfig.url+this.getDataUrl("listen",""+m+v),w=this.clientConfig.token,_=i.events?i.events:["mutation"],j=_.indexOf("reconnect")!==-1,O=new p(g,s({withCredentials:!0},w?{headers:{"Sanity-Token":w}}:{}));return new u(function(t){function e(){O.readyState===p.CLOSED?t.complete():O.readyState===p.CONNECTING&&a()}function r(e){t.error(o(e))}function i(e){var r=n(e);return r instanceof Error?t.error(r):t.next(r)}function s(e){t.complete(),u()}function u(){_.forEach(function(t){return h(O,t,i)}),h(O,"error",e),h(O,"channelError",r),h(O,"disconnect",s),O.close()}function a(){j&&t.next({type:"reconnect"})}return O.addEventListener("error",e,!1),O.addEventListener("channelError",r,!1),O.addEventListener("disconnect",s,!1),_.forEach(function(t){return O.addEventListener(t,i,!1)}),u})}},{"../util/defaults":15,"../util/pick":17,"../validators":18,"./encodeQueryString":5,"@sanity/eventsource":50,"@sanity/observable/minimal":53,"object-assign":41}],7:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.selection=t,this.operations=s({},e),this.client=r}var i=t("deep-assign"),s=t("object-assign"),u=t("../util/getSelection"),a=t("../validators"),c=a.validateObject,l=a.validateInsert;s(o.prototype,{clone:function(){return new o(this.selection,s({},this.operations),this.client)},merge:function(t){return c("merge",t),this._assign("merge",i(this.operations.merge||{},t))},set:function(t){return this._assign("set",t)},diffMatchPatch:function(t){return c("diffMatchPatch",t),this._assign("diffMatchPatch",t)},unset:function(t){if(!Array.isArray(t))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=s({},this.operations,{unset:t}),this},setIfMissing:function(t){return this._assign("setIfMissing",t)},replace:function(t){return c("replace",t),this._set("set",{$:t})},inc:function(t){return this._assign("inc",t)},dec:function(t){return this._assign("dec",t)},insert:function(t,e,r){var o;return l(t,e,r),this._assign("insert",(o={},n(o,t,e),n(o,"items",r),o))},append:function(t,e){return this.insert("after",t+"[-1]",e)},prepend:function(t,e){return this.insert("before",t+"[0]",e)},splice:function(t,e,r,n){var o="undefined"==typeof r||r===-1,i=e<0?e-1:e,s=o?-1:Math.max(0,e+r),u=i<0&&s>=0?"":s,a=t+"["+i+":"+u+"]";return this.insert("replace",a,n||[])},serialize:function(){return s(u(this.selection),this.operations)},toJSON:function(){return this.serialize()},commit:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.client)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");var e="string"==typeof this.selection,r=s({returnFirst:e,returnDocuments:!0},t);return this.client.mutate({patch:this.serialize()},r)},reset:function(){return this.operations={},this},_set:function(t,e){return this._assign(t,e,!1)},_assign:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return c(t,e),this.operations=s({},this.operations,n({},t,s({},r&&this.operations[t]||{},e))),this}}),e.exports=o},{"../util/getSelection":16,"../validators":18,"deep-assign":21,"object-assign":41}],8:[function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];this.operations=t,this.client=e}var i=t("object-assign"),s=t("../validators"),u=t("./patch"),a={returnDocuments:!1};i(o.prototype,{clone:function(){return new o(this.operations.slice(0),this.client)},create:function(t){return this._create(t,"create")},createIfNotExists:function(t){return this._create(t,"createIfNotExists")},createOrReplace:function(t){return this._create(t,"createOrReplace")},delete:function(t){return s.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function t(e,r){var n="function"==typeof r,o=e instanceof u;if(o)return this._add({patch:e.serialize()});if(n){var t=r(new u(e,{},this.client));if(!(t instanceof u))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:t.serialize()})}return this._add({patch:i({id:e},r)})},serialize:function(){return this.operations.slice()},toJSON:function(){return this.serialize()},commit:function(t){if(!this.client)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.client.mutate(this.serialize(),t||a)},reset:function(){return this.operations=[],this},_create:function(t,e){if(!t._id&&!this.client)throw new Error('Document needs an _id property when transaction is create outside a client scope. Pass `{_id: "<datasetName>:"}` to have Sanity generate an ID for you.');s.validateObject(e,t);var r=s.hasDataset(this.client.clientConfig),o=n({},e,i({},t,{_id:t._id||r+"."}));return this._add(o)},_add:function(t){return this.operations.push(t),this}}),e.exports=o},{"../validators":18,"./patch":7,"object-assign":41}],9:[function(t,e,r){"use strict";function n(t){this.request=t.request.bind(t)}var o=t("object-assign"),i=t("../validators");o(n.prototype,{create:function(t){return this._modify("PUT",t)},delete:function(t){return this._modify("DELETE",t)},list:function(){return this.request({uri:"/datasets"})},_modify:function(t,e){return i.dataset(e),this.request({method:t,uri:"/datasets/"+e})}}),e.exports=n},{"../validators":18,"object-assign":41}],10:[function(t,e,r){"use strict";function n(t){return!!p.shouldRetry(t)||t.response&&t.response.statusCode>=500}function o(t){var e=t.body;return this.response=t,this.statusCode=t.statusCode,this.responseBody=s(e,t),e.error&&e.message?void(this.message=e.error+" - "+e.message):e.error&&e.error.description?(this.message=e.error.description,void(this.details=e.error)):void(this.message=e.error||e.message||i(t))}function i(t){var e=t.statusMessage?" "+t.statusMessage:"";return t.method+"-request to "+t.url+" resulted in HTTP "+t.statusCode+e}function s(t,e){var r=(e.headers["content-type"]||"").toLowerCase(),n=r.indexOf("application/json")!==-1;return n?JSON.stringify(t,null,2):t}function u(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_,r=e(c({maxRedirects:0},t));return r.toPromise=function(){return new Promise(function(t,e){r.filter(function(t){return"response"===t.type}).subscribe(function(e){return t(e.body)},e)})},r}var a=t("get-it"),c=t("object-assign"),l=t("create-error-class"),f=t("get-it/lib/middleware/observable"),p=t("get-it/lib/middleware/retry"),h=t("get-it/lib/middleware/jsonRequest"),d=t("get-it/lib/middleware/jsonResponse"),b=t("@sanity/observable/minimal"),y=t("get-it/lib/middleware/progress"),v=l("ClientError",o),m=l("ServerError",o),g={onResponse:function(t){if(t.statusCode>=500)throw new m(t);if(t.statusCode>=400)throw new v(t);return t}},w=[h(),d(),y(),g,f({implementation:b}),p({maxRetries:5,shouldRetry:n})],_=a(w);u.defaultRequester=_,e.exports=u},{"@sanity/observable/minimal":53,"create-error-class":20,"get-it":23,"get-it/lib/middleware/jsonRequest":25,"get-it/lib/middleware/jsonResponse":26,"get-it/lib/middleware/observable":27,"get-it/lib/middleware/progress":29,"get-it/lib/middleware/retry":30,"object-assign":41}],11:[function(t,e,r){"use strict";var n="Sanity-Token",o="Sanity-Project-ID";e.exports=function(t){var e={};return t.token&&t.gradientMode?e.Authorization="Bearer "+t.token:t.token&&(e[n]=t.token),!t.useProjectHostname&&t.projectId&&(e[o]=t.projectId),{headers:e,timeout:"timeout"in t?t.timeout:3e4,withCredentials:!0,json:!0}}},{}],12:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/"+t})}}),e.exports=n},{"object-assign":41}],13:[function(t,e,r){"use strict";function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;this.config(t),this.assets=new p(this),this.datasets=new l(this),this.projects=new f(this),this.users=new h(this),this.auth=new d(this)}function o(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=e.reduce(function(t,e){return t||e.headers?s(t||{},e.headers||{}):null},null);return s.apply(void 0,e.concat([n?{headers:n}:{}]))}function i(t){return new n(t)}var s=t("object-assign"),u=t("./data/patch"),a=t("./data/transaction"),c=t("./data/dataMethods"),l=t("./datasets/datasetsClient"),f=t("./projects/projectsClient"),p=t("./assets/assetsClient"),h=t("./users/usersClient"),d=t("./auth/authClient"),b=t("./http/request"),y=t("./http/requestOptions"),v=t("./config"),m=v.defaultConfig,g=v.initConfig;s(n.prototype,c),s(n.prototype,{clone:function(){return new n(this.config())},config:function(t){return"undefined"==typeof t?s({},this.clientConfig):(this.clientConfig=g(t,this.clientConfig||{}),this)},getUrl:function(t){return this.clientConfig.url+"/"+t.replace(/^\//,"")},request:function(t){return this.requestObservable(t).toPromise()},requestObservable:function(t){return b(o(y(this.clientConfig),t,{url:this.getUrl(t.url||t.uri)}),this.clientConfig.requester)}}),i.Patch=u,i.Transaction=a,i.requester=b.defaultRequester,e.exports=i},{"./assets/assetsClient":1,"./auth/authClient":2,"./config":3,"./data/dataMethods":4,"./data/patch":7,"./data/transaction":8,"./datasets/datasetsClient":9,"./http/request":10,"./http/requestOptions":11,"./projects/projectsClient":12,"./users/usersClient":14,"object-assign":41}],14:[function(t,e,r){"use strict";function n(t){this.client=t}var o=t("object-assign");o(n.prototype,{getById:function(t){return this.client.request({uri:"/users/"+t})}}),e.exports=n},{"object-assign":41}],15:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(e).concat(Object.keys(t)).reduce(function(r,n){return r[n]="undefined"==typeof t[n]?e[n]:t[n],r},{})}},{}],16:[function(t,e,r){"use strict";e.exports=function(t){if("string"==typeof t||Array.isArray(t))return{id:t};if(t&&t.query)return{query:t.query};var e=["* Dataset-prefixed document ID (<dataset.docId>)","* Array of dataset-prefixed document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n"+e)}},{}],17:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce(function(e,r){return"undefined"==typeof t[r]?e:(e[r]=t[r],e)},{})}},{}],18:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=["image","file"],i=["before","after","replace"];r.dataset=function(t){if(!/^[-\w]{1,128}$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes")},r.projectId=function(t){if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")},r.validateAssetType=function(t){if(o.indexOf(t)===-1)throw new Error("Invalid asset type: "+t+". Must be one of "+o.join(", "))},r.validateObject=function(t,e){if(null===e||"object"!==("undefined"==typeof e?"undefined":n(e))||Array.isArray(e))throw new Error(t+"() takes an object of properties")},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[-_a-z0-9]{1,128}\.[-_a-z0-9.]+$/i.test(e))throw new Error(t+"() takes a document ID in format dataset.docId")},r.validateInsert=function(t,e,r){var n="insert(at, selector, items)";if(i.indexOf(t)===-1){var o=i.map(function(t){return'"'+t+'"'}).join(", ");throw new Error(n+' takes an "at"-argument which is one of: '+o)}if("string"!=typeof e)throw new Error(n+' takes a "selector"-argument which must be a string');if(!Array.isArray(r))throw new Error(n+' takes an "items"-argument which must be an array')},r.hasDataset=function(t){if(!t.gradientMode&&!t.dataset)throw new Error("`dataset` must be provided to perform queries");return t.dataset||""},r.promise={hasDataset:function(t){return new Promise(function(e){return e(r.hasDataset(t))})}}},{}],19:[function(t,e,r){"use strict";e.exports=Error.captureStackTrace||function(t){var e=new Error;Object.defineProperty(t,"stack",{configurable:!0,get:function(){var t=e.stack;return Object.defineProperty(this,"stack",{value:t}),t}})}},{}],20:[function(t,e,r){"use strict";function n(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}var o=t("capture-stack-trace");e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("Expected className to be a string");if(/[^0-9a-zA-Z_$]/.test(t))throw new Error("className contains invalid characters");e=e||function(t){this.message=t};var r=function(){Object.defineProperty(this,"name",{configurable:!0,value:t,writable:!0}),o(this,this.constructor),e.apply(this,arguments)};return n(r,Error),r}},{"capture-stack-trace":19}],21:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}function o(t,e,r){var n=e[r];if(void 0!==n&&null!==n){if(u.call(t,r)&&(void 0===t[r]||null===t[r]))throw new TypeError("Cannot convert undefined or null to object ("+r+")");u.call(t,r)&&s(n)?t[r]=i(Object(t[r]),e[r]):t[r]=n}}function i(t,e){if(t===e)return t;e=Object(e);for(var r in e)u.call(e,r)&&o(t,e,r);if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),i=0;i<n.length;i++)a.call(e,n[i])&&o(t,e,n[i]);return t}var s=t("is-obj"),u=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(t){t=n(t);for(var e=1;e<arguments.length;e++)i(t,arguments[e]);return t}},{"is-obj":37}],22:[function(t,e,r){function n(t,e,r){if(!u(e))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this),"[object Array]"===a.call(t)?o(t,e,r):"string"==typeof t?i(t,e,r):s(t,e,r)}function o(t,e,r){for(var n=0,o=t.length;n<o;n++)c.call(t,n)&&e.call(r,t[n],n,t)}function i(t,e,r){for(var n=0,o=t.length;n<o;n++)e.call(r,t.charAt(n),n,t)}function s(t,e,r){for(var n in t)c.call(t,n)&&e.call(r,t[n],n,t)}var u=t("is-function");e.exports=n;var a=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":36}],23:[function(t,e,r){"use strict";var n=t("nano-pubsub"),o=t("./util/middlewareReducer"),i=t("./middleware/defaultOptionsProcessor"),s=t("./request"),u=["request","response","progress","error","abort"],a=["processOptions","onRequest","onResponse","onError","onReturn","onHeaders"];e.exports=function t(){function e(t){function e(t,e,n){var o=t,s=e;if(!o)try{s=i("onResponse",e,n)}catch(t){s=null,o=t}o=o&&i("onError",o,n),o?r.error.publish(o):s&&r.response.publish(s)}var r=u.reduce(function(t,e){return t[e]=n(),t},{}),i=o(l),a=i("processOptions",t),c={options:a,channels:r,applyMiddleware:i},f=null,p=r.request.subscribe(function(t){f=s(t,function(r,n){return e(r,n,t)})});r.abort.subscribe(function(){p(),f&&f.abort()});var h=i("onReturn",r,c);return h===r&&r.request.publish(c),h}var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],c=[],l=a.reduce(function(t,e){return t[e]=t[e]||[],t},{processOptions:[i]});return e.use=function(t){if(!t)throw new Error("Tried to add middleware that resolved to falsey value");if("function"==typeof t)throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(t.onReturn&&l.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");a.forEach(function(e){t[e]&&l[e].push(t[e])}),c.push(t)},e.clone=function(){return t(c)},r.forEach(e.use),e}},{"./middleware/defaultOptionsProcessor":24,"./request":32,"./util/middlewareReducer":35,"nano-pubsub":40}],24:[function(t,e,r){"use strict";function n(t){if(t===!1||0===t)return!1;if(t.connect||t.socket)return t;var e=Number(t);return isNaN(e)?n(u.timeout):{connect:e,socket:e}}function o(t){var e={};for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}var i=t("object-assign"),s=t("url-parse"),u={timeout:12e4};e.exports=function(t){var e="string"==typeof t?i({url:t},u):i({},u,t),r=s(e.url,{},!0);return e.timeout=n(e.timeout),e.query&&(r.query=i({},r.query,o(e.query))),e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e.url=r.toString(),e}},{"object-assign":41,"url-parse":48}],25:[function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=t("object-assign"),i=t("is-plain-object"),s=["boolean","string","number"],u=function(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)};e.exports=function(){return{processOptions:function(t){var e=t.body,r=e&&!u(e)&&(s.indexOf("undefined"==typeof e?"undefined":n(e))!==-1||Array.isArray(e)||i(e)||e&&"function"==typeof e.toJSON);return r?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":38,"object-assign":41}],26:[function(t,e,r){"use strict";function n(t){try{return JSON.parse(t)}catch(t){throw t.message="Failed to parsed response body as JSON: "+t.message,t}}var o=t("object-assign");e.exports=function(){return{onResponse:function(t){var e=t.headers["content-type"];return t.body&&e&&e.indexOf("application/json")!==-1?o({},t,{body:n(t.body)}):t},processOptions:function(t){return o({},t,{headers:o({Accept:"application/json"},t.headers)})}}}},{"object-assign":41}],27:[function(t,e,r){"use strict";var n=t("../util/global"),o=t("object-assign");e.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.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":34,"object-assign":41}],28:[function(t,e,r){"use strict";e.exports=function(){return{onRequest:function(t){function e(t){return function(e){var r=e.lengthComputable?e.loaded/e.total*100:-1;n.channels.progress.publish({stage:t,percent:r,total:e.total,loaded:e.loaded,lengthComputable:e.lengthComputable})}}if("xhr"===t.adapter){var r=t.request,n=t.context;"upload"in r&&"onprogress"in r.upload&&(r.upload.onprogress=e("upload")),"onprogress"in r&&(r.onprogress=e("download"))}}}}},{}],29:[function(t,e,r){"use strict";e.exports=t("./node-progress")},{"./node-progress":28}],30:[function(t,e,r){"use strict";function n(t){return 100*Math.pow(2,t)+100*Math.random()}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=t("object-assign"),s=t("../util/node-shouldRetry"),u=function(t){return null!==t&&"object"===("undefined"==typeof t?"undefined":o(t))&&"function"==typeof t.pipe},a=e.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.maxRetries||5,r=t.retryDelay||n,o=t.shouldRetry||s;return{onError:function(t,n){var s=n.options,a=s.maxRetries||e,c=s.shouldRetry||o,l=s.attemptNumber||0;if(u(s.body))return t;if(!c(t,l)||l>=a)return t;var f=i({},n,{options:i({},s,{attemptNumber:l+1})});return setTimeout(function(){return n.channels.request.publish(f)},r(l)),null}}};a.shouldRetry=s},{"../util/node-shouldRetry":33,"object-assign":41}],31:[function(t,e,r){"use strict";var n=t("same-origin"),o=t("parse-headers"),i=function(){},s=window,u=s.XMLHttpRequest||i,a="withCredentials"in new u,c=a?u:s.XDomainRequest,l="xhr";e.exports=function(t,e){function r(){_=!0,m.abort()}function i(e){O=!0,m.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to "+b.url:"Connection timed out on request to "+b.url);r.code=e,t.channels.error.publish(r)}function a(){E&&(f(),v.socket=setTimeout(function(){return i("ESOCKETTIMEDOUT")},E.socket))}function f(){(_||m.readyState>=2&&v.connect)&&clearTimeout(v.connect),v.socket&&clearTimeout(v.socket)}function p(){if(!j){f(),j=!0,m=null;var t=new Error("Network error while attempting to reach "+b.url);t.isNetworkError=!0,t.request=b,e(t)}}function h(){var t=m.status,e=m.statusText;if(g&&void 0===t)t=200;else{if(t>12e3&&t<12156)return p();t=1223===m.status?204:m.status,e=1223===m.status?"No Content":e}return{body:m.response||m.responseText,url:b.url,method:b.method,headers:g?{}:o(m.getAllResponseHeaders()),statusCode:t,statusMessage:e}}function d(){if(!(_||j||O)){if(0===m.status)return void p(new Error("Unknown XHR error"));f(),j=!0,e(null,h())}}var b=t.options,y=!n(s.location.href,b.url),v={},m=y?new c:new u,g=s.XDomainRequest&&m instanceof s.XDomainRequest,w=b.headers,_=!1,j=!1,O=!1;m.onerror=p,m.ontimeout=p,m.onabort=function(){_=!0},m.onprogress=function(){};var x=g?"onload":"onreadystatechange";if(m[x]=function(){a(),_||4!==m.readyState&&!g||0!==m.status&&d()},m.open(b.method,b.url,!0),m.withCredentials=!!b.withCredentials,w&&m.setRequestHeader)for(var S in w)w.hasOwnProperty(S)&&m.setRequestHeader(S,w[S]);else if(w&&g)throw new Error("Headers cannot be set on an XDomainRequest object");b.rawBody&&(m.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:b,adapter:l,request:m,context:t}),m.send(b.body||null);var E=b.timeout;return E&&(v.connect=setTimeout(function(){return i("ETIMEDOUT")},E.connect)),{abort:r}}},{"parse-headers":42,"same-origin":45}],32:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":31}],33:[function(t,e,r){"use strict";e.exports=function(t){return t.isNetworkError||!1}},{}],34:[function(t,e,r){(function(t){"use strict";"undefined"!=typeof window?e.exports=window:"undefined"!=typeof t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],35:[function(t,e,r){"use strict";e.exports=function(t){var e=function(e,r){for(var n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return t[e].reduce(function(t,e){return e.apply(void 0,[t].concat(o))},r)};return e}},{}],36:[function(t,e,r){function n(t){var e=o.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}e.exports=n;var o=Object.prototype.toString},{}],37:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],38:[function(t,e,r){"use strict";function n(t){return o(t)===!0&&"[object Object]"===Object.prototype.toString.call(t)}var o=t("isobject");e.exports=function(t){var e,r;return n(t)!==!1&&(e=t.constructor,"function"==typeof e&&(r=e.prototype,n(r)!==!1&&r.hasOwnProperty("isPrototypeOf")!==!1))}},{isobject:39}],39:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}},{}],40:[function(t,e,r){e.exports=function(){function t(t){return r.push(t),function(){var e=r.indexOf(t);e>-1&&r.splice(e,1)}}function e(){for(var t=0;t<r.length;t++)r[t].apply(null,arguments)}var r=[];return{subscribe:t,publish:e}}},{}],41:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function o(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}var i=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(t,e){for(var r,o,a=n(t),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var l in r)s.call(r,l)&&(a[l]=r[l]);if(i){o=i(r);for(var f=0;f<o.length;f++)u.call(r,o[f])&&(a[o[f]]=r[o[f]])}}return a}},{}],42:[function(t,e,r){var n=t("trim"),o=t("for-each"),i=function(t){return"[object Array]"===Object.prototype.toString.call(t)};e.exports=function(t){if(!t)return{};var e={};return o(n(t).split("\n"),function(t){var r=t.indexOf(":"),o=n(t.slice(0,r)).toLowerCase(),s=n(t.slice(r+1));"undefined"==typeof e[o]?e[o]=s:i(e[o])?e[o].push(s):e[o]=[e[o],s]}),e}},{"for-each":22,trim:47}],43:[function(t,e,r){"use strict";function n(t){for(var e,r=/([^=?&]+)=?([^&]*)/g,n={};e=r.exec(t);n[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return n}function o(t,e){e=e||"";var r=[];"string"!=typeof e&&(e="?");for(var n in t)i.call(t,n)&&r.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return r.length?e+r.join("&"):""}var i=Object.prototype.hasOwnProperty;r.stringify=o,r.parse=n},{}],44:[function(t,e,r){
"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],45:[function(t,e,r){"use strict";var n=t("url");e.exports=function(t,e,r){if(t===e)return!0;var o=n.parse(t,!1,!0),i=n.parse(e,!1,!0),s=0|o.port||("https"===o.protocol?443:80),u=0|i.port||("https"===i.protocol?443:80),a={proto:o.protocol===i.protocol,hostname:o.hostname===i.hostname,port:s===u};return a.proto&&a.hostname&&(a.port||r)}},{url:46}],46:[function(t,e,r){"use strict";var n=/^(?:(?:(?:([^:\/#\?]+:)?(?:(?:\/\/)((?:((?:[^:@\/#\?]+)(?:\:(?:[^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?/;e.exports={regex:n,parse:function(t){var e=n.exec(t);return e?{protocol:(e[1]||"").toLowerCase()||void 0,hostname:(e[5]||"").toLowerCase()||void 0,port:e[6]||void 0}:{}}}},{}],47:[function(t,e,r){function n(t){return t.replace(/^\s*|\s*$/g,"")}r=e.exports=n,r.left=function(t){return t.replace(/^\s*/,"")},r.right=function(t){return t.replace(/\s*$/,"")}},{}],48:[function(t,e,r){"use strict";function n(t){var e=c.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]}}function o(t,e){for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}function i(t,e,r){if(!(this instanceof i))return new i(t,e,r);var c,f,p,h,d,b,y=l.slice(),v=typeof e,m=this,g=0;for("object"!==v&&"string"!==v&&(r=e,e=null),r&&"function"!=typeof r&&(r=a.parse),e=u(e),f=n(t||""),c=!f.protocol&&!f.slashes,m.slashes=f.slashes||c&&e.slashes,m.protocol=f.protocol||e.protocol||"",t=f.rest,f.slashes||(y[2]=[/(.*)/,"pathname"]);g<y.length;g++)h=y[g],p=h[0],b=h[1],p!==p?m[b]=t:"string"==typeof p?~(d=t.indexOf(p))&&("number"==typeof h[2]?(m[b]=t.slice(0,d),t=t.slice(d+h[2])):(m[b]=t.slice(d),t=t.slice(0,d))):(d=p.exec(t))&&(m[b]=d[1],t=t.slice(0,d.index)),m[b]=m[b]||(c&&h[3]?e[b]||"":""),h[4]&&(m[b]=m[b].toLowerCase());r&&(m.query=r(m.query)),c&&e.slashes&&"/"!==m.pathname.charAt(0)&&(""!==m.pathname||""!==e.pathname)&&(m.pathname=o(m.pathname,e.pathname)),s(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(h=m.auth.split(":"),m.username=h[0]||"",m.password=h[1]||""),m.origin=m.protocol&&m.host&&"file:"!==m.protocol?m.protocol+"//"+m.host:"null",m.href=m.toString()}var s=t("requires-port"),u=t("./lolcation"),a=t("querystringify"),c=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]];i.prototype.set=function(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||a.parse)(e)),n[t]=e;break;case"port":n[t]=e,s(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,/:\d+$/.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":n.pathname=e.length&&"/"!==e.charAt(0)?"/"+e:e;break;default:n[t]=e}for(var o=0;o<l.length;o++){var i=l[o];i[4]&&(n[i[1]]=n[i[1]].toLowerCase())}return n.origin=n.protocol&&n.host&&"file:"!==n.protocol?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},i.prototype.toString=function(t){t&&"function"==typeof t||(t=a.stringify);var e,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var o=n+(r.slashes?"//":"");return r.username&&(o+=r.username,r.password&&(o+=":"+r.password),o+="@"),o+=r.host+r.pathname,e="object"==typeof r.query?t(r.query):r.query,e&&(o+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(o+=r.hash),o},i.extractProtocol=n,i.location=u,i.qs=a,e.exports=i},{"./lolcation":49,querystringify:43,"requires-port":44}],49:[function(t,e,r){(function(r){"use strict";var n,o=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,i={hash:1,query:1};e.exports=function(e){e=e||r.location||{},n=n||t("./");var s,u={},a=typeof e;if("blob:"===e.protocol)u=new n(unescape(e.pathname),{});else if("string"===a){u=new n(e,{});for(s in i)delete u[s]}else if("object"===a){for(s in e)s in i||(u[s]=e[s]);void 0===u.slashes&&(u.slashes=o.test(e.href))}return u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":48}],50:[function(t,e,r){var n=t("eventsource-polyfill/dist/eventsource");e.exports=window.EventSource||n.EventSource},{"eventsource-polyfill/dist/eventsource":51}],51:[function(t,e,r){!function(t){function e(t,e,r,n){this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.data=e||null,this.origin=r||"",this.lastEventId=n||"",this.type=t||"message"}function r(){return!(!window.XDomainRequest||!window.XMLHttpRequest||void 0!==(new XMLHttpRequest).responseType)}if(!t.EventSource||t._eventSourceImportPrefix){var n=(t._eventSourceImportPrefix||"")+"EventSource",o=function(t,e){if(!t||"string"!=typeof t)throw new SyntaxError("Not enough arguments");this.URL=t,this.setOptions(e);var r=this;setTimeout(function(){r.poll()},0)};if(o.prototype={CONNECTING:0,OPEN:1,CLOSED:2,defaultOptions:{loggingEnabled:!1,loggingPrefix:"eventsource",interval:500,bufferSizeLimit:262144,silentTimeout:3e5,getArgs:{evs_buffer_size_limit:262144},xhrHeaders:{Accept:"text/event-stream","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}},setOptions:function(t){var e,r=this.defaultOptions;for(e in r)r.hasOwnProperty(e)&&(this[e]=r[e]);for(e in t)e in r&&t.hasOwnProperty(e)&&(this[e]=t[e]);this.getArgs&&this.bufferSizeLimit&&(this.getArgs.evs_buffer_size_limit=this.bufferSizeLimit),"undefined"!=typeof console&&"undefined"!=typeof console.log||(this.loggingEnabled=!1)},log:function(t){this.loggingEnabled&&console.log("["+this.loggingPrefix+"]:"+t)},poll:function(){try{if(this.readyState==this.CLOSED)return;this.cleanup(),this.readyState=this.CONNECTING,this.cursor=0,this.cache="",this._xhr=new this.XHR(this),this.resetNoActivityTimer()}catch(t){this.log("There were errors inside the pool try-catch"),this.dispatchEvent("error",{type:"error",data:t.message})}},pollAgain:function(t){var e=this;e.readyState=e.CONNECTING,e.dispatchEvent("error",{type:"error",data:"Reconnecting "}),this._pollTimer=setTimeout(function(){e.poll()},t||0)},cleanup:function(){this.log("evs cleaning up"),this._pollTimer&&(clearInterval(this._pollTimer),this._pollTimer=null),this._noActivityTimer&&(clearInterval(this._noActivityTimer),this._noActivityTimer=null),this._xhr&&(this._xhr.abort(),this._xhr=null)},resetNoActivityTimer:function(){if(this.silentTimeout){this._noActivityTimer&&clearInterval(this._noActivityTimer);var t=this;this._noActivityTimer=setTimeout(function(){t.log("Timeout! silentTImeout:"+t.silentTimeout),t.pollAgain()},this.silentTimeout)}},close:function(){this.readyState=this.CLOSED,this.log("Closing connection. readyState: "+this.readyState),this.cleanup()},ondata:function(){var t=this._xhr;if(t.isReady()&&!t.hasError()){this.resetNoActivityTimer(),this.readyState==this.CONNECTING&&(this.readyState=this.OPEN,this.dispatchEvent("open",{type:"open"}));var e=t.getBuffer();e.length>this.bufferSizeLimit&&(this.log("buffer.length > this.bufferSizeLimit"),this.pollAgain()),0==this.cursor&&e.length>0&&"\ufeff"==e.substring(0,1)&&(this.cursor=1);var r=this.lastMessageIndex(e);if(r[0]>=this.cursor){var n=r[1],o=e.substring(this.cursor,n);this.parseStream(o),this.cursor=n}t.isDone()&&(this.log("request.isDone(). reopening the connection"),this.pollAgain(this.interval))}else this.readyState!==this.CLOSED&&(this.log("this.readyState !== this.CLOSED"),this.pollAgain(this.interval))},parseStream:function(t){t=this.cache+this.normalizeToLF(t);var r,n,o,i,s,u,a=t.split("\n\n");for(r=0;r<a.length-1;r++){for(o="message",i=[],parts=a[r].split("\n"),n=0;n<parts.length;n++)s=this.trimWhiteSpace(parts[n]),0==s.indexOf("event")?o=s.replace(/event:?\s*/,""):0==s.indexOf("retry")?(u=parseInt(s.replace(/retry:?\s*/,"")),isNaN(u)||(this.interval=u)):0==s.indexOf("data")?i.push(s.replace(/data:?\s*/,"")):0==s.indexOf("id:")?this.lastEventId=s.replace(/id:?\s*/,""):0==s.indexOf("id")&&(this.lastEventId=null);if(i.length){var c=new e(o,i.join("\n"),window.location.origin,this.lastEventId);this.dispatchEvent(o,c)}}this.cache=a[a.length-1]},dispatchEvent:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=0;n<r.length;n++)r[n].call(this,e);this["on"+t]&&this["on"+t].call(this,e)},addEventListener:function(t,e){this["_"+t+"Handlers"]||(this["_"+t+"Handlers"]=[]),this["_"+t+"Handlers"].push(e)},removeEventListener:function(t,e){var r=this["_"+t+"Handlers"];if(r)for(var n=r.length-1;n>=0;--n)if(r[n]===e){r.splice(n,1);break}},_pollTimer:null,_noactivityTimer:null,_xhr:null,lastEventId:null,cache:"",cursor:0,onerror:null,onmessage:null,onopen:null,readyState:0,urlWithParams:function(t,e){var r=[];if(e){var n,o,i=encodeURIComponent;for(n in e)e.hasOwnProperty(n)&&(o=i(n)+"="+i(e[n]),r.push(o))}return r.length>0?t.indexOf("?")==-1?t+"?"+r.join("&"):t+"&"+r.join("&"):t},lastMessageIndex:function(t){var e=t.lastIndexOf("\n\n"),r=t.lastIndexOf("\r\r"),n=t.lastIndexOf("\r\n\r\n");return n>Math.max(e,r)?[n,n+4]:[Math.max(e,r),Math.max(e,r)+2]},trimWhiteSpace:function(t){var e=/^(\s|\u00A0)+|(\s|\u00A0)+$/g;return t.replace(e,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},r()){o.isPolyfill="IE_8-9";var i=o.prototype.defaultOptions;i.xhrHeaders=null,i.getArgs.evs_preamble=2056,o.prototype.XHR=function(t){request=new XDomainRequest,this._request=request,request.onprogress=function(){request._ready=!0,t.ondata()},request.onload=function(){this._loaded=!0,t.ondata()},request.onerror=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest error"})},request.ontimeout=function(){this._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"XDomainRequest timed out"})};var e={};if(t.getArgs){var r=t.getArgs;for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n]);t.lastEventId&&(e.evs_last_event_id=t.lastEventId)}request.open("GET",t.urlWithParams(t.URL,e)),request.send()},o.prototype.XHR.prototype={useXDomainRequest:!0,_request:null,_ready:!1,_loaded:!1,_failed:!1,isReady:function(){return this._request._ready},isDone:function(){return this._request._loaded},hasError:function(){return this._request._failed},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}}}else o.isPolyfill="XHR",o.prototype.XHR=function(t){request=new XMLHttpRequest,this._request=request,t._xhr=this,request.onreadystatechange=function(){request.readyState>1&&t.readyState!=t.CLOSED&&(200==request.status||request.status>=300&&request.status<400?t.ondata():(request._failed=!0,t.readyState=t.CLOSED,t.dispatchEvent("error",{type:"error",data:"The server responded with "+request.status}),t.close()))},request.onprogress=function(){},request.open("GET",t.urlWithParams(t.URL,t.getArgs),!0);var e=t.xhrHeaders;for(var r in e)e.hasOwnProperty(r)&&request.setRequestHeader(r,e[r]);t.lastEventId&&request.setRequestHeader("Last-Event-Id",t.lastEventId),request.send()},o.prototype.XHR.prototype={useXDomainRequest:!1,_request:null,_failed:!1,isReady:function(){return this._request.readyState>=2},isDone:function(){return 4==this._request.readyState},hasError:function(){return this._failed||this._request.status>=400},getBuffer:function(){var t="";try{t=this._request.responseText||""}catch(t){}return t},abort:function(){this._request&&this._request.abort()}};t[n]=o}}(this)},{}],52:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var o=t("rxjs/Observable"),i=o.Observable,s=t("rxjs/operator/map"),u=s.map,a=t("rxjs/operator/filter"),c=a.filter,l=t("rxjs/operator/reduce"),f=l.reduce,p=t("rxjs/operator/toPromise"),h=p.toPromise,d=t("object-assign");n.prototype=Object.create(d(Object.create(null),i.prototype)),Object.defineProperty(n.prototype,"constructor",{value:n,enumerable:!1,writable:!0,configurable:!0}),n.prototype.lift=function(t){var e=new n;return e.source=this,e.operator=t,e},n.prototype.map=u,n.prototype.filter=c,n.prototype.reduce=f,n.prototype.toPromise=h,e.exports=n},{"object-assign":54,"rxjs/Observable":55,"rxjs/operator/filter":59,"rxjs/operator/map":60,"rxjs/operator/reduce":61,"rxjs/operator/toPromise":62}],53:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":52}],54:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function o(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}var i=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(t,e){for(var r,o,a=n(t),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var l in r)s.call(r,l)&&(a[l]=r[l]);if(i){o=i(r);for(var f=0;f<o.length;f++)u.call(r,o[f])&&(a[o[f]]=r[o[f]])}}return a}},{}],55:[function(t,e,r){"use strict";var n=t("./util/root"),o=t("./util/toSubscriber"),i=t("./symbol/observable"),s=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,i=o.toSubscriber(t,e,r);if(n?n.call(i,this.source):i.add(this._trySubscribe(i)),i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.syncErrorThrown=!0,t.syncErrorValue=e,t.error(e)}},t.prototype.forEach=function(t,e){var r=this;if(e||(n.root.Rx&&n.root.Rx.config&&n.root.Rx.config.Promise?e=n.root.Rx.config.Promise:n.root.Promise&&(e=n.root.Promise)),!e)throw new Error("no Promise impl found");return new e(function(e,n){var o=r.subscribe(function(e){if(o)try{t(e)}catch(t){n(t),o.unsubscribe()}else t(e)},n,e)})},t.prototype._subscribe=function(t){return this.source.subscribe(t)},t.prototype[i.$$observable]=function(){return this},t.create=function(e){return new t(e)},t}();r.Observable=s},{"./symbol/observable":63,"./util/root":70,"./util/toSubscriber":71}],56:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],57:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=t("./util/isFunction"),i=t("./Subscription"),s=t("./Observer"),u=t("./symbol/rxSubscriber"),a=function(t){function e(r,n,o){switch(t.call(this),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=s.empty;break;case 1:if(!r){this.destination=s.empty;break}if("object"==typeof r){r instanceof e?(this.destination=r,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new c(this,r));break}default:this.syncErrorThrowable=!0,this.destination=new c(this,r,n,o)}}return n(e,t),e.prototype[u.$$rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this,e=t._parent,r=t._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=e,this._parents=r,this},e}(i.Subscription);r.Subscriber=a;var c=function(t){function e(e,r,n,i){t.call(this),this._parentSubscriber=e;var s,u=this;o.isFunction(r)?s=r:r&&(u=r,s=r.next,n=r.error,i=r.complete,o.isFunction(u.unsubscribe)&&this.add(u.unsubscribe.bind(u)),u.unsubscribe=this.unsubscribe.bind(this)),this._context=u,this._next=s,this._error=n,this._complete=i}return n(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber;if(this._error)e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else{if(!e.syncErrorThrowable)throw this.unsubscribe(),t;e.syncErrorValue=t,e.syncErrorThrown=!0,this.unsubscribe()}}},e.prototype.complete=function(){if(!this.isStopped){var t=this._parentSubscriber;this._complete?t.syncErrorThrowable?(this.__tryOrSetError(t,this._complete),this.unsubscribe()):(this.__tryOrUnsub(this._complete),this.unsubscribe()):this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){throw this.unsubscribe(),t}},e.prototype.__tryOrSetError=function(t,e,r){try{e.call(this._context,r)}catch(e){return t.syncErrorValue=e,t.syncErrorThrown=!0,!0}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(a)},{"./Observer":56,"./Subscription":58,"./symbol/rxSubscriber":64,"./util/isFunction":68}],58:[function(t,e,r){"use strict";function n(t){return t.reduce(function(t,e){return t.concat(e instanceof c.UnsubscriptionError?e.errors:e)},[])}var o=t("./util/isArray"),i=t("./util/isObject"),s=t("./util/isFunction"),u=t("./util/tryCatch"),a=t("./util/errorObject"),c=t("./util/UnsubscriptionError"),l=function(){function t(t){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var t,e=!1;if(!this.closed){var r=this,l=r._parent,f=r._parents,p=r._unsubscribe,h=r._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var d=-1,b=f?f.length:0;l;)l.remove(this),l=++d<b&&f[d]||null;if(s.isFunction(p)){var y=u.tryCatch(p).call(this);y===a.errorObject&&(e=!0,t=t||(a.errorObject.e instanceof c.UnsubscriptionError?n(a.errorObject.e.errors):[a.errorObject.e]))}if(o.isArray(h))for(d=-1,b=h.length;++d<b;){var v=h[d];if(i.isObject(v)){var y=u.tryCatch(v.unsubscribe).call(v);if(y===a.errorObject){e=!0,t=t||[];var m=a.errorObject.e;m instanceof c.UnsubscriptionError?t=t.concat(n(m.errors)):t.push(m)}}}if(e)throw new c.UnsubscriptionError(t)}},t.prototype.add=function(e){if(!e||e===t.EMPTY)return t.EMPTY;if(e===this)return this;var r=e;switch(typeof e){case"function":r=new t(e);case"object":if(r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if("function"!=typeof r._addParent){var n=r;r=new t,r._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=this._subscriptions||(this._subscriptions=[]);return o.push(r),r._addParent(this),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);r!==-1&&e.splice(r,1)}},t.prototype._addParent=function(t){var e=this,r=e._parent,n=e._parents;r&&r!==t?n?n.indexOf(t)===-1&&n.push(t):this._parents=[t]:this._parent=t},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();r.Subscription=l},{"./util/UnsubscriptionError":65,"./util/errorObject":66,"./util/isArray":67,"./util/isFunction":68,"./util/isObject":69,"./util/tryCatch":72}],59:[function(t,e,r){"use strict";function n(t,e){return this.lift(new s(t,e))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.filter=n;var s=function(){function t(t,e){this.predicate=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.predicate,this.thisArg))},t}(),u=function(t){function e(e,r,n){t.call(this,e),this.predicate=r,this.thisArg=n,this.count=0,this.predicate=r}return o(e,t),e.prototype._next=function(t){var e;try{e=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}e&&this.destination.next(t)},e}(i.Subscriber)},{"../Subscriber":57}],60:[function(t,e,r){"use strict";function n(t,e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return this.lift(new s(t,e))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.map=n;var s=function(){function t(t,e){this.project=t,this.thisArg=e}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.project,this.thisArg))},t}();r.MapOperator=s;var u=function(t){function e(e,r,n){t.call(this,e),this.project=r,this.count=0,this.thisArg=n||this}return o(e,t),e.prototype._next=function(t){var e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(e)},e}(i.Subscriber)},{"../Subscriber":57}],61:[function(t,e,r){"use strict";function n(t,e){var r=!1;return arguments.length>=2&&(r=!0),this.lift(new s(t,e,r))}var o=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=t("../Subscriber");r.reduce=n;var s=function(){function t(t,e,r){void 0===r&&(r=!1),this.accumulator=t,this.seed=e,this.hasSeed=r}return t.prototype.call=function(t,e){return e.subscribe(new u(t,this.accumulator,this.seed,this.hasSeed))},t}();r.ReduceOperator=s;var u=function(t){function e(e,r,n,o){t.call(this,e),this.accumulator=r,this.hasSeed=o,this.index=0,this.hasValue=!1,this.acc=n,this.hasSeed||this.index++}return o(e,t),e.prototype._next=function(t){this.hasValue||(this.hasValue=this.hasSeed)?this._tryReduce(t):(this.acc=t,this.hasValue=!0)},e.prototype._tryReduce=function(t){var e;try{e=this.accumulator(this.acc,t,this.index++)}catch(t){return void this.destination.error(t)}this.acc=e},e.prototype._complete=function(){(this.hasValue||this.hasSeed)&&this.destination.next(this.acc),this.destination.complete()},e}(i.Subscriber);r.ReduceSubscriber=u},{"../Subscriber":57}],62:[function(t,e,r){"use strict";function n(t){var e=this;if(t||(o.root.Rx&&o.root.Rx.config&&o.root.Rx.config.Promise?t=o.root.Rx.config.Promise:o.root.Promise&&(t=o.root.Promise)),!t)throw new Error("no Promise impl found");return new t(function(t,r){var n;e.subscribe(function(t){return n=t},function(t){return r(t)},function(){return t(n)})})}var o=t("../util/root");r.toPromise=n},{"../util/root":70}],63:[function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var o=t("../util/root");r.getSymbolObservable=n,r.$$observable=n(o.root)},{"../util/root":70}],64:[function(t,e,r){"use strict";var n=t("../util/root"),o=n.root.Symbol;r.$$rxSubscriber="function"==typeof o&&"function"==typeof o.for?o.for("rxSubscriber"):"@@rxSubscriber"},{"../util/root":70}],65:[function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},o=function(t){function e(e){t.call(this),this.errors=e;var r=Error.call(this,e?e.length+" errors occurred during unsubscription:\n "+e.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"");this.name=r.name="UnsubscriptionError",this.stack=r.stack,this.message=r.message}return n(e,t),e}(Error);r.UnsubscriptionError=o},{}],66:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],67:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],68:[function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.isFunction=n},{}],69:[function(t,e,r){"use strict";function n(t){return null!=t&&"object"==typeof t}r.isObject=n},{}],70:[function(t,e,r){(function(t){"use strict";if(r.root="object"==typeof window&&window.window===window&&window||"object"==typeof self&&self.self===self&&self||"object"==typeof t&&t.global===t&&t,!r.root)throw new Error("RxJS could not find any global context (window, self, global)")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],71:[function(t,e,r){"use strict";function n(t,e,r){if(t){if(t instanceof o.Subscriber)return t;if(t[i.$$rxSubscriber])return t[i.$$rxSubscriber]()}return t||e||r?new o.Subscriber(t,e,r):new o.Subscriber(s.empty)}var o=t("../Subscriber"),i=t("../symbol/rxSubscriber"),s=t("../Observer");r.toSubscriber=n},{"../Observer":56,"../Subscriber":57,"../symbol/rxSubscriber":64}],72:[function(t,e,r){"use strict";function n(){try{return i.apply(this,arguments)}catch(t){return s.errorObject.e=t,s.errorObject}}function o(t){return i=t,n}var i,s=t("./errorObject");r.tryCatch=o},{"./errorObject":66}]},{},[13])(13)});

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc