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.104.30 to 0.104.34

4

package.json
{
"name": "@sanity/client",
"version": "0.104.30",
"version": "0.104.34",
"description": "Client for retrieving data from Sanity",

@@ -33,3 +33,3 @@ "main": "lib/sanityClient.js",

"eslint": "^3.18.0",
"eslint-config-sanity": "^2.1.2",
"eslint-config-sanity": "^2.1.4",
"gzip-size": "^3.0.0",

@@ -36,0 +36,0 @@ "hard-rejection": "^1.0.0",

@@ -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||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";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}})}},{}],2:[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":1}],3:[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":22}],4:[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"}if(!t.EventSource||t._eventSourceImportPrefix){var r=(t._eventSourceImportPrefix||"")+"EventSource",n=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(n.prototype={CONNECTING:0,OPEN:1,CLOSED:2,defaultOptions:{loggingEnabled:!1,loggingPrefix:"eventsource",interval:500,bufferSizeLimit:262144,silentTimeout:3e5,getArgs:{evs_buffer_size_limit:262144},xhrHeaders:{Accept:"text/event-stream","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}},setOptions:function(t){var e,r=this.defaultOptions;for(e in r)r.hasOwnProperty(e)&&(this[e]=r[e]);for(e in t)e in r&&t.hasOwnProperty(e)&&(this[e]=t[e]);this.getArgs&&this.bufferSizeLimit&&(this.getArgs.evs_buffer_size_limit=this.bufferSizeLimit),"undefined"!=typeof console&&void 0!==console.log||(this.loggingEnabled=!1)},log:function(t){this.loggingEnabled&&console.log("["+this.loggingPrefix+"]:"+t)},poll:function(){try{if(this.readyState==this.CLOSED)return;this.cleanup(),this.readyState=this.CONNECTING,this.cursor=0,this.cache="",this._xhr=new this.XHR(this),this.resetNoActivityTimer()}catch(t){this.log("There were errors inside the pool try-catch"),this.dispatchEvent("error",{type:"error",data:t.message})}},pollAgain:function(t){var e=this;e.readyState=e.CONNECTING,e.dispatchEvent("error",{type:"error",data:"Reconnecting "}),this._pollTimer=setTimeout(function(){e.poll()},t||0)},cleanup:function(){this.log("evs cleaning up"),this._pollTimer&&(clearInterval(this._pollTimer),this._pollTimer=null),this._noActivityTimer&&(clearInterval(this._noActivityTimer),this._noActivityTimer=null),this._xhr&&(this._xhr.abort(),this._xhr=null)},resetNoActivityTimer:function(){if(this.silentTimeout){this._noActivityTimer&&clearInterval(this._noActivityTimer);var t=this;this._noActivityTimer=setTimeout(function(){t.log("Timeout! silentTImeout:"+t.silentTimeout),t.pollAgain()},this.silentTimeout)}},close:function(){this.readyState=this.CLOSED,this.log("Closing connection. readyState: "+this.readyState),this.cleanup()},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){return t.replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},function(){return!(!window.XDomainRequest||!window.XMLHttpRequest||void 0!==(new XMLHttpRequest).responseType)}()){n.isPolyfill="IE_8-9";var o=n.prototype.defaultOptions;o.xhrHeaders=null,o.getArgs.evs_preamble=2056,n.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()},n.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 n.isPolyfill="XHR",n.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()},n.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[r]=n}}(this)},{}],5:[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":21}],6:[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":7,"./request":15,"./util/middlewareReducer":18,"nano-pubsub":25}],7:[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":26,"url-parse":19}],8:[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;return e&&!u(e)&&(s.indexOf(void 0===e?"undefined":n(e))!==-1||Array.isArray(e)||i(e)||e&&"function"==typeof e.toJSON)?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":23,"object-assign":26}],9:[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":26}],10:[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":17,"object-assign":26}],11:[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"))}}}}},{}],12:[function(t,e,r){"use strict";e.exports=t("./node-progress")},{"./node-progress":11}],13:[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"===(void 0===t?"undefined":o(t))&&"function"==typeof t.pipe};(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,s)||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}}}).shouldRetry=s},{"../util/node-shouldRetry":16,"object-assign":26}],14:[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;e.exports=function(t,e){function r(){w=!0,v&&v.abort()}function i(e){j=!0,v.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to "+d.url:"Connection timed out on request to "+d.url);r.code=e,t.channels.error.publish(r)}function a(){x&&(l(),y.socket=setTimeout(function(){return i("ESOCKETTIMEDOUT")},x.socket))}function l(){(w||v.readyState>=2&&y.connect)&&clearTimeout(y.connect),y.socket&&clearTimeout(y.socket)}function f(){if(!O){l(),O=!0,v=null;var t=new Error("Network error while attempting to reach "+d.url);t.isNetworkError=!0,t.request=d,e(t)}}function p(){var t=v.status,e=v.statusText;if(m&&void 0===t)t=200;else{if(t>12e3&&t<12156)return f();t=1223===v.status?204:v.status,e=1223===v.status?"No Content":e}return{body:v.response||v.responseText,url:d.url,method:d.method,headers:m?{}:o(v.getAllResponseHeaders()),statusCode:t,statusMessage:e}}function h(){if(!(w||O||j)){if(0===v.status)return void f(new Error("Unknown XHR error"));l(),O=!0,e(null,p())}}var d=t.options,b=!n(s.location.href,d.url),y={},v=b?new c:new u,m=s.XDomainRequest&&v instanceof s.XDomainRequest,g=d.headers,w=!1,O=!1,j=!1;if(v.onerror=f,v.ontimeout=f,v.onabort=function(){w=!0},v.onprogress=function(){},v[m?"onload":"onreadystatechange"]=function(){a(),w||4!==v.readyState&&!m||0!==v.status&&h()},v.open(d.method,d.url,!0),v.withCredentials=!!d.withCredentials,g&&v.setRequestHeader)for(var _ in g)g.hasOwnProperty(_)&&v.setRequestHeader(_,g[_]);else if(g&&m)throw new Error("Headers cannot be set on an XDomainRequest object");d.rawBody&&(v.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:d,adapter:"xhr",request:v,context:t}),v.send(d.body||null);var x=d.timeout;return x&&(y.connect=setTimeout(function(){return i("ETIMEDOUT")},x.connect)),{abort:r}}},{"parse-headers":27,"same-origin":48}],15:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":14}],16:[function(t,e,r){"use strict";e.exports=function(t){return t.isNetworkError||!1}},{}],17:[function(t,e,r){(function(t){"use strict";"undefined"!=typeof window?e.exports=window:void 0!==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:{})},{}],18:[function(t,e,r){"use strict";e.exports=function(t){return 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)}}},{}],19:[function(t,e,r){"use strict";function n(t){var e=f.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 s,u,f,h,d,b,y=p.slice(),v=typeof e,m=this,g=0;for("object"!==v&&"string"!==v&&(r=e,e=null),r&&"function"!=typeof r&&(r=l.parse),e=c(e),u=n(t||""),s=!u.protocol&&!u.slashes,m.slashes=u.slashes||s&&e.slashes,m.protocol=u.protocol||e.protocol||"",t=u.rest,u.slashes||(y[2]=[/(.*)/,"pathname"]);g<y.length;g++)h=y[g],f=h[0],b=h[1],f!==f?m[b]=t:"string"==typeof f?~(d=t.indexOf(f))&&("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=f.exec(t))&&(m[b]=d[1],t=t.slice(0,d.index)),m[b]=m[b]||(s&&h[3]?e[b]||"":""),h[4]&&(m[b]=m[b].toLowerCase());r&&(m.query=r(m.query)),s&&e.slashes&&"/"!==m.pathname.charAt(0)&&(""!==m.pathname||""!==e.pathname)&&(m.pathname=o(m.pathname,e.pathname)),a(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()}function s(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||l.parse)(e)),n[t]=e;break;case"port":n[t]=e,a(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<p.length;o++){var i=p[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}function u(t){t&&"function"==typeof t||(t=l.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}var a=t("requires-port"),c=t("./lolcation"),l=t("querystringify"),f=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,p=[["#","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:s,toString:u},i.extractProtocol=n,i.location=c,i.qs=l,e.exports=i},{"./lolcation":20,querystringify:28,"requires-port":29}],20:[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:{})},{"./":19}],21:[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},{}],22:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],23:[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&&"function"==typeof(e=t.constructor)&&(r=e.prototype,n(r)!==!1&&r.hasOwnProperty("isPrototypeOf")!==!1)}},{isobject:24}],24:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}},{}],25:[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}}},{}],26:[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)}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,u,a=n(t),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var l in r)i.call(r,l)&&(a[l]=r[l]);if(o){u=o(r);for(var f=0;f<u.length;f++)s.call(r,u[f])&&(a[u[f]]=r[u[f]])}}return a}},{}],27:[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));void 0===e[o]?e[o]=s:i(e[o])?e[o].push(s):e[o]=[e[o],s]}),e}},{"for-each":5,trim:50}],28:[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},{}],29:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],30:[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":38,"./util/root":45,"./util/toSubscriber":46}],31:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],32:[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":31,"./Subscription":33,"./symbol/rxSubscriber":39,"./util/isFunction":43}],33:[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;t._parent.remove(this),e.unsubscribe()},e}(f);r.ChildSubscription=p},{"./util/UnsubscriptionError":40,"./util/errorObject":41,"./util/isArray":42,"./util/isFunction":43,"./util/isObject":44,"./util/tryCatch":47}],34:[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":32}],35:[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":32}],36:[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":32}],37:[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":45}],38:[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":45}],39:[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":45}],40:[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},{}],41:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],42:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],43:[function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.isFunction=n},{}],44:[function(t,e,r){"use strict";function n(t){return null!=t&&"object"==typeof t}r.isObject=n},{}],45:[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:{})},{}],46:[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":31,"../Subscriber":32,"../symbol/rxSubscriber":39}],47:[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":41}],48:[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:49}],49:[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}:{}}}},{}],50:[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*$/,"")}},{}],51:[function(t,e,r){"use strict";function n(t){this.client=t}function o(t){return t.filter(function(t){return"response"===t.type}).map(function(t){return t.body}).toPromise()}var i=t("object-assign"),s=t("../validators");i(n.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s.validateAssetType(t);var n=s.hasDataset(this.client.clientConfig),i="image"===t?"images":"files",u=this.client._requestObservable({method:"POST",timeout:r.timeout||0,query:r.label?{label:r.label}:{},url:"/assets/"+i+"/"+n,headers:r.contentType?{"Content-Type":r.contentType}:{},body:e});return this.client.isPromiseAPI()?o(u):u},delete:function(t,e){var r=t,n=e;t._type&&(r=t._type.replace(/(^sanity\.|Asset$)/g,""),n=t._id);var o=s.hasDataset(this.client.clientConfig);s.validateAssetType(r),s.validateDocumentId("delete",n);var i="image"===r?"images":"files";return this.client.request({method:"DELETE",url:"/assets/"+i+"/"+o+"/"+n})}}),e.exports=n},{"../validators":69,"object-assign":26}],52:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout"})}}),e.exports=n},{"object-assign":26}],53:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("./validators"),i={apiHost:"https://api.sanity.io",useProjectHostname:!0,gradientMode:!1};r.defaultConfig=i,r.initConfig=function(t,e){var r=n({},i,e,t),s=r.gradientMode,u=!s&&r.useProjectHostname;if("undefined"==typeof Promise)throw new Error("No native `Promise`-implementation found, polyfill needed");if(s&&!r.namespace)throw new Error("Configuration must contain `namespace` when running in gradient mode");if(u&&!r.projectId)throw new Error("Configuration must contain `projectId`");if(u&&o.projectId(r.projectId),!s&&r.dataset&&o.dataset(r.dataset,r.gradientMode),r.gradientMode)r.url=r.apiHost;else{var a=r.apiHost.split("://",2),c=a[0],l=a[1];r.useProjectHostname?r.url=c+"://"+r.projectId+"."+l+"/v1":r.url=r.apiHost+"/v1"}return r}},{"./validators":69,"object-assign":26}],54:[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=void 0===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=function(t){return"response"===t.type},d=function(t){return t.body},b=function(t){return t.toPromise()};e.exports={listen:l,getDataUrl:function(t,e){var r=this.clientConfig,n=r.gradientMode?r.namespace:i.hasDataset(r),o="/"+t+"/"+n,s=e?o+"/"+e:o;return(this.clientConfig.gradientMode?s:"/data"+s).replace(/\/($|\?)/,"$1")},fetch:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.filterResponse===!1?function(t){return t}:function(t){return t.result||[]},o=this._dataRequest("query",{query:t,params:e}).map(n);return this.isPromiseAPI()?b(o):o},getDocument:function(t){var e={uri:this.getDataUrl("doc",t),json:!0},r=this._requestObservable(e).filter(h).map(function(t){return t.body.documents&&t.body.documents[0]});return this.isPromiseAPI()?b(r):r},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return i.requireDocumentId("createIfNotExists",t),this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return i.requireDocumentId("createOrReplace",t),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=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._dataRequest(t,e,r);return this.isPromiseAPI()?b(n):n},_dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="mutate"===t,i=!o&&u(e),s=!o&&i.length<1948,a=s?i:"",c=r.returnFirst,l=this.getDataUrl(t,a),f={method:s?"GET":"POST",uri:l,json:!0,body:s?void 0:e,query:o&&p(r)};return this._requestObservable(f).filter(h).map(d).map(function(t){if(!o)return t;var e=t.results||[];if(r.returnDocuments)return c?e[0]&&e[0].document:e.map(function(t){return t.document});var i=c?"documentId":"documentIds",s=c?e[0]&&e[0].id:e.map(function(t){return t.id});return n({transactionId:t.transactionId,results:e},i,s)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n({},e,t),s=o({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[i]},s)}}},{"../util/getSelection":66,"../validators":69,"./encodeQueryString":55,"./listen":56,"./patch":57,"./transaction":58,"object-assign":26}],55:[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)}},{}],56:[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("../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]:{},i=l(r,d),b=c(i,h),y=a({query:t,params:e,options:b}),v=this.clientConfig,m=v.gradientMode,g=v.url,w=v.token,O={};w&&(O[m?"Authorization":"Sanity-Token"]=m?"Bearer "+w:w);var j=""+g+this.getDataUrl("listen",y),_=i.events?i.events:["mutation"],x=_.indexOf("reconnect")!==-1;return new u(function(t){function e(){l.readyState===f.CLOSED?t.complete():l.readyState===f.CONNECTING&&c()}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 u(e){t.complete(),a()}function a(){_.forEach(function(t){return p(l,t,i)}),p(l,"error",e),p(l,"channelError",r),p(l,"disconnect",u),l.close()}function c(){x&&t.next({type:"reconnect"})}var l=new f(j,s({withCredentials:!0},w?{headers:O}:{}));return l.addEventListener("error",e,!1),l.addEventListener("channelError",r,!1),l.addEventListener("disconnect",u,!1),_.forEach(function(t){return l.addEventListener(t,i,!1)}),a})}},{"../util/defaults":65,"../util/pick":68,"./encodeQueryString":55,"@sanity/eventsource":70,"@sanity/observable/minimal":72,"object-assign":26}],57:[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=void 0===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":66,"../validators":69,"deep-assign":3,"object-assign":26}],58:[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 s.validateObject("create",t),this._add({create:t})},createIfNotExists:function(t){var e="createIfNotExists";return s.validateObject(e,t),s.requireDocumentId(e,t),this._add(n({},e,t))},createOrReplace:function(t){var e="createOrReplace";return s.validateObject(e,t),s.requireDocumentId(e,t),this._add(n({},e,t))},delete:function(t){return s.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function(t,e){var r="function"==typeof e;if(t instanceof u)return this._add({patch:t.serialize()});if(r){var n=e(new u(t,{},this.client));if(!(n instanceof u))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:i({id:t},e)})},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(),i({},a,t||{}))},reset:function(){return this.operations=[],this},_add:function(t){return this.operations.push(t),this}}),e.exports=o},{"../validators":69,"./patch":57,"object-assign":26}],59:[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":69,"object-assign":26}],60:[function(t,e,r){"use strict";function n(t,e,r){return!!p.shouldRetry(t)||("HEAD"===r.method||"GET"===r.method)&&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){return(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")!==-1?JSON.stringify(t,null,2):t}function u(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:O)(c({maxRedirects:0},t))}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})],O=a(w);u.defaultRequester=O,e.exports=u},{"@sanity/observable/minimal":72,"create-error-class":2,"get-it":6,"get-it/lib/middleware/jsonRequest":8,"get-it/lib/middleware/jsonResponse":9,"get-it/lib/middleware/observable":10,"get-it/lib/middleware/progress":12,"get-it/lib/middleware/retry":13,"object-assign":26}],61:[function(t,e,r){"use strict";e.exports=function(t){var e={};return t.token&&t.gradientMode?e.Authorization="Bearer "+t.token:t.token&&(e["Sanity-Token"]=t.token),!t.useProjectHostname&&t.projectId&&(e["Sanity-Project-ID"]=t.projectId),{headers:e,timeout:"timeout"in t?t.timeout:3e4,withCredentials:!0,json:!0}}},{}],62:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/"+t})}}),e.exports=n},{"object-assign":26}],63:[function(t,e,r){"use strict";function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;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),t.isPromiseAPI&&(this.observable=new n(v(t,["isPromiseAPI"])))}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(s({},t,{isPromiseAPI:!0}))}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("./util/omit"),m=t("./config"),g=m.defaultConfig,w=m.initConfig,O=function(t){return t.toPromise()};s(n.prototype,c),s(n.prototype,{clone:function(){return new n(this.config())},config:function(t){return void 0===t?s({},this.clientConfig):(this.observable&&this.observable.config(v(t,["isPromiseAPI"])),this.clientConfig=w(t,this.clientConfig||{}),this)},getUrl:function(t){return this.clientConfig.url+"/"+t.replace(/^\//,"")},isPromiseAPI:function(){return this.clientConfig.isPromiseAPI},_requestObservable:function(t){return b(o(y(this.clientConfig),t,{url:this.getUrl(t.url||t.uri)}),this.clientConfig.requester)},request:function(t){var e=this._requestObservable(t).filter(function(t){return"response"===t.type}).map(function(t){return t.body});return this.isPromiseAPI()?O(e):e}}),i.Patch=u,i.Transaction=a,i.requester=b.defaultRequester,e.exports=i},{"./assets/assetsClient":51,"./auth/authClient":52,"./config":53,"./data/dataMethods":54,"./data/patch":57,"./data/transaction":58,"./datasets/datasetsClient":59,"./http/request":60,"./http/requestOptions":61,"./projects/projectsClient":62,"./users/usersClient":64,"./util/omit":67,"object-assign":26}],64:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getById:function(t){return this.client.request({uri:"/users/"+t})}}),e.exports=n},{"object-assign":26}],65:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(e).concat(Object.keys(t)).reduce(function(r,n){return r[n]=void 0===t[n]?e[n]:t[n],r},{})}},{}],66:[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=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n"+e)}},{}],67:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(t).reduce(function(r,n){return e.indexOf(n)!==-1?r:(r[n]=t[n],r)},{})}},{}],68:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce(function(e,r){return void 0===t[r]?e:(e[r]=t[r],e)},{})}},{}],69:[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"!==(void 0===e?"undefined":n(e))||Array.isArray(e))throw new Error(t+"() takes an object of properties")},r.requireDocumentId=function(t,e){if(!e._id)throw new Error(t+'() requires that the document contains an ID ("_id" property)');r.validateDocumentId(t,e._id)},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[a-z0-9_.-]+$/i.test(e))throw new Error(t+'(): "'+e+'" is not a valid document ID')},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||""}},{}],70:[function(t,e,r){var n=t("eventsource-polyfill/dist/eventsource");e.exports=window.EventSource||n.EventSource},{"eventsource-polyfill/dist/eventsource":4}],71:[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":26,"rxjs/Observable":30,"rxjs/operator/filter":34,"rxjs/operator/map":35,"rxjs/operator/reduce":36,"rxjs/operator/toPromise":37}],72:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":71}]},{},[63])(63)});
!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||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";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}})}},{}],2:[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":1}],3:[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":22}],4:[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"}if(!t.EventSource||t._eventSourceImportPrefix){var r=(t._eventSourceImportPrefix||"")+"EventSource",n=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(n.prototype={CONNECTING:0,OPEN:1,CLOSED:2,defaultOptions:{loggingEnabled:!1,loggingPrefix:"eventsource",interval:500,bufferSizeLimit:262144,silentTimeout:3e5,getArgs:{evs_buffer_size_limit:262144},xhrHeaders:{Accept:"text/event-stream","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}},setOptions:function(t){var e,r=this.defaultOptions;for(e in r)r.hasOwnProperty(e)&&(this[e]=r[e]);for(e in t)e in r&&t.hasOwnProperty(e)&&(this[e]=t[e]);this.getArgs&&this.bufferSizeLimit&&(this.getArgs.evs_buffer_size_limit=this.bufferSizeLimit),"undefined"!=typeof console&&void 0!==console.log||(this.loggingEnabled=!1)},log:function(t){this.loggingEnabled&&console.log("["+this.loggingPrefix+"]:"+t)},poll:function(){try{if(this.readyState==this.CLOSED)return;this.cleanup(),this.readyState=this.CONNECTING,this.cursor=0,this.cache="",this._xhr=new this.XHR(this),this.resetNoActivityTimer()}catch(t){this.log("There were errors inside the pool try-catch"),this.dispatchEvent("error",{type:"error",data:t.message})}},pollAgain:function(t){var e=this;e.readyState=e.CONNECTING,e.dispatchEvent("error",{type:"error",data:"Reconnecting "}),this._pollTimer=setTimeout(function(){e.poll()},t||0)},cleanup:function(){this.log("evs cleaning up"),this._pollTimer&&(clearInterval(this._pollTimer),this._pollTimer=null),this._noActivityTimer&&(clearInterval(this._noActivityTimer),this._noActivityTimer=null),this._xhr&&(this._xhr.abort(),this._xhr=null)},resetNoActivityTimer:function(){if(this.silentTimeout){this._noActivityTimer&&clearInterval(this._noActivityTimer);var t=this;this._noActivityTimer=setTimeout(function(){t.log("Timeout! silentTImeout:"+t.silentTimeout),t.pollAgain()},this.silentTimeout)}},close:function(){this.readyState=this.CLOSED,this.log("Closing connection. readyState: "+this.readyState),this.cleanup()},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?-1==t.indexOf("?")?t+"?"+r.join("&"):t+"&"+r.join("&"):t},lastMessageIndex:function(t){var e=t.lastIndexOf("\n\n"),r=t.lastIndexOf("\r\r"),n=t.lastIndexOf("\r\n\r\n");return n>Math.max(e,r)?[n,n+4]:[Math.max(e,r),Math.max(e,r)+2]},trimWhiteSpace:function(t){return t.replace(/^(\s|\u00A0)+|(\s|\u00A0)+$/g,"")},normalizeToLF:function(t){return t.replace(/\r\n|\r/g,"\n")}},function(){return!(!window.XDomainRequest||!window.XMLHttpRequest||void 0!==(new XMLHttpRequest).responseType)}()){n.isPolyfill="IE_8-9";var o=n.prototype.defaultOptions;o.xhrHeaders=null,o.getArgs.evs_preamble=2056,n.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()},n.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 n.isPolyfill="XHR",n.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()},n.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[r]=n}}(this)},{}],5:[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":21}],6:[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":7,"./request":15,"./util/middlewareReducer":18,"nano-pubsub":25}],7:[function(t,e,r){"use strict";function n(t){if(!1===t||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":26,"url-parse":19}],8:[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;return e&&!u(e)&&(-1!==s.indexOf(void 0===e?"undefined":n(e))||Array.isArray(e)||i(e)||e&&"function"==typeof e.toJSON)?o({},t,{body:JSON.stringify(t.body),headers:o({},t.headers,{"Content-Type":"application/json"})}):t}}}},{"is-plain-object":23,"object-assign":26}],9:[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&&-1!==e.indexOf("application/json")?o({},t,{body:n(t.body)}):t},processOptions:function(t){return o({},t,{headers:o({Accept:"application/json"},t.headers)})}}}},{"object-assign":26}],10:[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":17,"object-assign":26}],11:[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"))}}}}},{}],12:[function(t,e,r){"use strict";e.exports=t("./node-progress")},{"./node-progress":11}],13:[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"===(void 0===t?"undefined":o(t))&&"function"==typeof t.pipe};(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,s)||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}}}).shouldRetry=s},{"../util/node-shouldRetry":16,"object-assign":26}],14:[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;e.exports=function(t,e){function r(){w=!0,v&&v.abort()}function i(e){j=!0,v.abort();var r=new Error("ESOCKETTIMEDOUT"===e?"Socket timed out on request to "+d.url:"Connection timed out on request to "+d.url);r.code=e,t.channels.error.publish(r)}function a(){x&&(l(),y.socket=setTimeout(function(){return i("ESOCKETTIMEDOUT")},x.socket))}function l(){(w||v.readyState>=2&&y.connect)&&clearTimeout(y.connect),y.socket&&clearTimeout(y.socket)}function f(){if(!O){l(),O=!0,v=null;var t=new Error("Network error while attempting to reach "+d.url);t.isNetworkError=!0,t.request=d,e(t)}}function p(){var t=v.status,e=v.statusText;if(m&&void 0===t)t=200;else{if(t>12e3&&t<12156)return f();t=1223===v.status?204:v.status,e=1223===v.status?"No Content":e}return{body:v.response||v.responseText,url:d.url,method:d.method,headers:m?{}:o(v.getAllResponseHeaders()),statusCode:t,statusMessage:e}}function h(){if(!(w||O||j)){if(0===v.status)return void f(new Error("Unknown XHR error"));l(),O=!0,e(null,p())}}var d=t.options,b=!n(s.location.href,d.url),y={},v=b?new c:new u,m=s.XDomainRequest&&v instanceof s.XDomainRequest,g=d.headers,w=!1,O=!1,j=!1;if(v.onerror=f,v.ontimeout=f,v.onabort=function(){w=!0},v.onprogress=function(){},v[m?"onload":"onreadystatechange"]=function(){a(),w||4!==v.readyState&&!m||0!==v.status&&h()},v.open(d.method,d.url,!0),v.withCredentials=!!d.withCredentials,g&&v.setRequestHeader)for(var _ in g)g.hasOwnProperty(_)&&v.setRequestHeader(_,g[_]);else if(g&&m)throw new Error("Headers cannot be set on an XDomainRequest object");d.rawBody&&(v.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:d,adapter:"xhr",request:v,context:t}),v.send(d.body||null);var x=d.timeout;return x&&(y.connect=setTimeout(function(){return i("ETIMEDOUT")},x.connect)),{abort:r}}},{"parse-headers":27,"same-origin":48}],15:[function(t,e,r){"use strict";e.exports=t("./node-request")},{"./node-request":14}],16:[function(t,e,r){"use strict";e.exports=function(t){return t.isNetworkError||!1}},{}],17:[function(t,e,r){(function(t){"use strict";"undefined"!=typeof window?e.exports=window:void 0!==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:{})},{}],18:[function(t,e,r){"use strict";e.exports=function(t){return 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)}}},{}],19:[function(t,e,r){"use strict";function n(t){var e=f.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 s,u,f,h,d,b,y=p.slice(),v=typeof e,m=this,g=0;for("object"!==v&&"string"!==v&&(r=e,e=null),r&&"function"!=typeof r&&(r=l.parse),e=c(e),u=n(t||""),s=!u.protocol&&!u.slashes,m.slashes=u.slashes||s&&e.slashes,m.protocol=u.protocol||e.protocol||"",t=u.rest,u.slashes||(y[2]=[/(.*)/,"pathname"]);g<y.length;g++)h=y[g],f=h[0],b=h[1],f!==f?m[b]=t:"string"==typeof f?~(d=t.indexOf(f))&&("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=f.exec(t))&&(m[b]=d[1],t=t.slice(0,d.index)),m[b]=m[b]||(s&&h[3]?e[b]||"":""),h[4]&&(m[b]=m[b].toLowerCase());r&&(m.query=r(m.query)),s&&e.slashes&&"/"!==m.pathname.charAt(0)&&(""!==m.pathname||""!==e.pathname)&&(m.pathname=o(m.pathname,e.pathname)),a(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()}function s(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||l.parse)(e)),n[t]=e;break;case"port":n[t]=e,a(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<p.length;o++){var i=p[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}function u(t){t&&"function"==typeof t||(t=l.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}var a=t("requires-port"),c=t("./lolcation"),l=t("querystringify"),f=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,p=[["#","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:s,toString:u},i.extractProtocol=n,i.location=c,i.qs=l,e.exports=i},{"./lolcation":20,querystringify:28,"requires-port":29}],20:[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:{})},{"./":19}],21:[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},{}],22:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],23:[function(t,e,r){"use strict";function n(t){return!0===o(t)&&"[object Object]"===Object.prototype.toString.call(t)}var o=t("isobject");e.exports=function(t){var e,r;return!1!==n(t)&&"function"==typeof(e=t.constructor)&&(r=e.prototype,!1!==n(r)&&!1!==r.hasOwnProperty("isPrototypeOf"))}},{isobject:24}],24:[function(t,e,r){"use strict";e.exports=function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)}},{}],25:[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}}},{}],26:[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)}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,u,a=n(t),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var l in r)i.call(r,l)&&(a[l]=r[l]);if(o){u=o(r);for(var f=0;f<u.length;f++)s.call(r,u[f])&&(a[u[f]]=r[u[f]])}}return a}},{}],27:[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));void 0===e[o]?e[o]=s:i(e[o])?e[o].push(s):e[o]=[e[o],s]}),e}},{"for-each":5,trim:50}],28:[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},{}],29:[function(t,e,r){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}],30:[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":38,"./util/root":45,"./util/toSubscriber":46}],31:[function(t,e,r){"use strict";r.empty={closed:!0,next:function(t){},error:function(t){throw t},complete:function(){}}},{}],32:[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":31,"./Subscription":33,"./symbol/rxSubscriber":39,"./util/isFunction":43}],33:[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);-1!==n&&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;t._parent.remove(this),e.unsubscribe()},e}(f);r.ChildSubscription=p},{"./util/UnsubscriptionError":40,"./util/errorObject":41,"./util/isArray":42,"./util/isFunction":43,"./util/isObject":44,"./util/tryCatch":47}],34:[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":32}],35:[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":32}],36:[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":32}],37:[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":45}],38:[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":45}],39:[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":45}],40:[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},{}],41:[function(t,e,r){"use strict";r.errorObject={e:{}}},{}],42:[function(t,e,r){"use strict";r.isArray=Array.isArray||function(t){return t&&"number"==typeof t.length}},{}],43:[function(t,e,r){"use strict";function n(t){return"function"==typeof t}r.isFunction=n},{}],44:[function(t,e,r){"use strict";function n(t){return null!=t&&"object"==typeof t}r.isObject=n},{}],45:[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:{})},{}],46:[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":31,"../Subscriber":32,"../symbol/rxSubscriber":39}],47:[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":41}],48:[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:49}],49:[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}:{}}}},{}],50:[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*$/,"")}},{}],51:[function(t,e,r){"use strict";function n(t){this.client=t}function o(t){return t.filter(function(t){return"response"===t.type}).map(function(t){return t.body}).toPromise()}var i=t("object-assign"),s=t("../validators");i(n.prototype,{upload:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};s.validateAssetType(t);var n=s.hasDataset(this.client.clientConfig),i="image"===t?"images":"files",u=this.client._requestObservable({method:"POST",timeout:r.timeout||0,query:r.label?{label:r.label}:{},url:"/assets/"+i+"/"+n,headers:r.contentType?{"Content-Type":r.contentType}:{},body:e});return this.client.isPromiseAPI()?o(u):u},delete:function(t,e){var r=t,n=e;t._type&&(r=t._type.replace(/(^sanity\.|Asset$)/g,""),n=t._id);var o=s.hasDataset(this.client.clientConfig);s.validateAssetType(r),s.validateDocumentId("delete",n);var i="image"===r?"images":"files";return this.client.request({method:"DELETE",url:"/assets/"+i+"/"+o+"/"+n})}}),e.exports=n},{"../validators":69,"object-assign":26}],52:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getLoginProviders:function(){return this.client.request({uri:"/auth/providers"})},logout:function(){return this.client.request({uri:"/auth/logout"})}}),e.exports=n},{"object-assign":26}],53:[function(t,e,r){"use strict";var n=t("object-assign"),o=t("./validators"),i={apiHost:"https://api.sanity.io",useProjectHostname:!0,gradientMode:!1};r.defaultConfig=i,r.initConfig=function(t,e){var r=n({},i,e,t),s=r.gradientMode,u=!s&&r.useProjectHostname;if("undefined"==typeof Promise)throw new Error("No native `Promise`-implementation found, polyfill needed");if(s&&!r.namespace)throw new Error("Configuration must contain `namespace` when running in gradient mode");if(u&&!r.projectId)throw new Error("Configuration must contain `projectId`");if(u&&o.projectId(r.projectId),!s&&r.dataset&&o.dataset(r.dataset,r.gradientMode),r.gradientMode)r.url=r.apiHost;else{var a=r.apiHost.split("://",2),c=a[0],l=a[1];r.useProjectHostname?r.url=c+"://"+r.projectId+"."+l+"/v1":r.url=r.apiHost+"/v1"}return r}},{"./validators":69,"object-assign":26}],54:[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=void 0===t?e:t;return!1===t?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=function(t){return"response"===t.type},d=function(t){return t.body},b=function(t){return t.toPromise()};e.exports={listen:l,getDataUrl:function(t,e){var r=this.clientConfig,n=r.gradientMode?r.namespace:i.hasDataset(r),o="/"+t+"/"+n,s=e?o+"/"+e:o;return(this.clientConfig.gradientMode?s:"/data"+s).replace(/\/($|\?)/,"$1")},fetch:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=!1===r.filterResponse?function(t){return t}:function(t){return t.result||[]},o=this._dataRequest("query",{query:t,params:e}).map(n);return this.isPromiseAPI()?b(o):o},getDocument:function(t){var e={uri:this.getDataUrl("doc",t),json:!0},r=this._requestObservable(e).filter(h).map(function(t){return t.body.documents&&t.body.documents[0]});return this.isPromiseAPI()?b(r):r},create:function(t,e){return this._create(t,"create",e)},createIfNotExists:function(t,e){return i.requireDocumentId("createIfNotExists",t),this._create(t,"createIfNotExists",e)},createOrReplace:function(t,e){return i.requireDocumentId("createOrReplace",t),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=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._dataRequest(t,e,r);return this.isPromiseAPI()?b(n):n},_dataRequest:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="mutate"===t,i=!o&&u(e),s=!o&&i.length<1948,a=s?i:"",c=r.returnFirst,l=this.getDataUrl(t,a),f={method:s?"GET":"POST",uri:l,json:!0,body:s?void 0:e,query:o&&p(r)};return this._requestObservable(f).filter(h).map(d).map(function(t){if(!o)return t;var e=t.results||[];if(r.returnDocuments)return c?e[0]&&e[0].document:e.map(function(t){return t.document});var i=c?"documentId":"documentIds",s=c?e[0]&&e[0].id:e.map(function(t){return t.id});return n({transactionId:t.transactionId,results:e},i,s)})},_create:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n({},e,t),s=o({returnFirst:!0,returnDocuments:!0},r);return this.dataRequest("mutate",{mutations:[i]},s)}}},{"../util/getSelection":66,"../validators":69,"./encodeQueryString":55,"./listen":56,"./patch":57,"./transaction":58,"object-assign":26}],55:[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)}},{}],56:[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("../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]:{},i=l(r,d),b=c(i,h),y=a({query:t,params:e,options:b}),v=this.clientConfig,m=v.gradientMode,g=v.url,w=v.token,O={};w&&(O[m?"Authorization":"Sanity-Token"]=m?"Bearer "+w:w);var j=""+g+this.getDataUrl("listen",y),_=i.events?i.events:["mutation"],x=-1!==_.indexOf("reconnect");return new u(function(t){function e(){l.readyState===f.CLOSED?t.complete():l.readyState===f.CONNECTING&&c()}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 u(e){t.complete(),a()}function a(){_.forEach(function(t){return p(l,t,i)}),p(l,"error",e),p(l,"channelError",r),p(l,"disconnect",u),l.close()}function c(){x&&t.next({type:"reconnect"})}var l=new f(j,s({withCredentials:!0},w?{headers:O}:{}));return l.addEventListener("error",e,!1),l.addEventListener("channelError",r,!1),l.addEventListener("disconnect",u,!1),_.forEach(function(t){return l.addEventListener(t,i,!1)}),a})}},{"../util/defaults":65,"../util/pick":68,"./encodeQueryString":55,"@sanity/eventsource":70,"@sanity/observable/minimal":72,"object-assign":26}],57:[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=void 0===r||-1===r,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":66,"../validators":69,"deep-assign":3,"object-assign":26}],58:[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 s.validateObject("create",t),this._add({create:t})},createIfNotExists:function(t){var e="createIfNotExists";return s.validateObject(e,t),s.requireDocumentId(e,t),this._add(n({},e,t))},createOrReplace:function(t){var e="createOrReplace";return s.validateObject(e,t),s.requireDocumentId(e,t),this._add(n({},e,t))},delete:function(t){return s.validateDocumentId("delete",t),this._add({delete:{id:t}})},patch:function(t,e){var r="function"==typeof e;if(t instanceof u)return this._add({patch:t.serialize()});if(r){var n=e(new u(t,{},this.client));if(!(n instanceof u))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:n.serialize()})}return this._add({patch:i({id:t},e)})},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(),i({},a,t||{}))},reset:function(){return this.operations=[],this},_add:function(t){return this.operations.push(t),this}}),e.exports=o},{"../validators":69,"./patch":57,"object-assign":26}],59:[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":69,"object-assign":26}],60:[function(t,e,r){"use strict";function n(t,e,r){return!!p.shouldRetry(t)||("HEAD"===r.method||"GET"===r.method)&&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){return-1!==(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")?JSON.stringify(t,null,2):t}function u(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:O)(c({maxRedirects:0},t))}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})],O=a(w);u.defaultRequester=O,e.exports=u},{"@sanity/observable/minimal":72,"create-error-class":2,"get-it":6,"get-it/lib/middleware/jsonRequest":8,"get-it/lib/middleware/jsonResponse":9,"get-it/lib/middleware/observable":10,"get-it/lib/middleware/progress":12,"get-it/lib/middleware/retry":13,"object-assign":26}],61:[function(t,e,r){"use strict";e.exports=function(t){var e={};return t.token&&t.gradientMode?e.Authorization="Bearer "+t.token:t.token&&(e["Sanity-Token"]=t.token),!t.useProjectHostname&&t.projectId&&(e["Sanity-Project-ID"]=t.projectId),{headers:e,timeout:"timeout"in t?t.timeout:3e4,withCredentials:!0,json:!0}}},{}],62:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{list:function(){return this.client.request({uri:"/projects"})},getById:function(t){return this.client.request({uri:"/projects/"+t})}}),e.exports=n},{"object-assign":26}],63:[function(t,e,r){"use strict";function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;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),t.isPromiseAPI&&(this.observable=new n(v(t,["isPromiseAPI"])))}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(s({},t,{isPromiseAPI:!0}))}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("./util/omit"),m=t("./config"),g=m.defaultConfig,w=m.initConfig,O=function(t){return t.toPromise()};s(n.prototype,c),s(n.prototype,{clone:function(){return new n(this.config())},config:function(t){return void 0===t?s({},this.clientConfig):(this.observable&&this.observable.config(v(t,["isPromiseAPI"])),this.clientConfig=w(t,this.clientConfig||{}),this)},getUrl:function(t){return this.clientConfig.url+"/"+t.replace(/^\//,"")},isPromiseAPI:function(){return this.clientConfig.isPromiseAPI},_requestObservable:function(t){return b(o(y(this.clientConfig),t,{url:this.getUrl(t.url||t.uri)}),this.clientConfig.requester)},request:function(t){var e=this._requestObservable(t).filter(function(t){return"response"===t.type}).map(function(t){return t.body});return this.isPromiseAPI()?O(e):e}}),i.Patch=u,i.Transaction=a,i.requester=b.defaultRequester,e.exports=i},{"./assets/assetsClient":51,"./auth/authClient":52,"./config":53,"./data/dataMethods":54,"./data/patch":57,"./data/transaction":58,"./datasets/datasetsClient":59,"./http/request":60,"./http/requestOptions":61,"./projects/projectsClient":62,"./users/usersClient":64,"./util/omit":67,"object-assign":26}],64:[function(t,e,r){"use strict";function n(t){this.client=t}t("object-assign")(n.prototype,{getById:function(t){return this.client.request({uri:"/users/"+t})}}),e.exports=n},{"object-assign":26}],65:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(e).concat(Object.keys(t)).reduce(function(r,n){return r[n]=void 0===t[n]?e[n]:t[n],r},{})}},{}],66:[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=["* Document ID (<docId>)","* Array of document IDs","* Object containing `query`"].join("\n");throw new Error("Unknown selection - must be one of:\n\n"+e)}},{}],67:[function(t,e,r){"use strict";e.exports=function(t,e){return Object.keys(t).reduce(function(r,n){return-1!==e.indexOf(n)?r:(r[n]=t[n],r)},{})}},{}],68:[function(t,e,r){"use strict";e.exports=function(t,e){return e.reduce(function(e,r){return void 0===t[r]?e:(e[r]=t[r],e)},{})}},{}],69:[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(-1===o.indexOf(t))throw new Error("Invalid asset type: "+t+". Must be one of "+o.join(", "))},r.validateObject=function(t,e){if(null===e||"object"!==(void 0===e?"undefined":n(e))||Array.isArray(e))throw new Error(t+"() takes an object of properties")},r.requireDocumentId=function(t,e){if(!e._id)throw new Error(t+'() requires that the document contains an ID ("_id" property)');r.validateDocumentId(t,e._id)},r.validateDocumentId=function(t,e){if("string"!=typeof e||!/^[a-z0-9_.-]+$/i.test(e))throw new Error(t+'(): "'+e+'" is not a valid document ID')},r.validateInsert=function(t,e,r){var n="insert(at, selector, items)";if(-1===i.indexOf(t)){var o=i.map(function(t){return'"'+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||""}},{}],70:[function(t,e,r){var n=t("eventsource-polyfill/dist/eventsource");e.exports=window.EventSource||n.EventSource},{"eventsource-polyfill/dist/eventsource":4}],71:[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":26,"rxjs/Observable":30,"rxjs/operator/filter":34,"rxjs/operator/map":35,"rxjs/operator/reduce":36,"rxjs/operator/toPromise":37}],72:[function(t,e,r){e.exports=t("./lib/SanityObservableMinimal")},{"./lib/SanityObservableMinimal":71}]},{},[63])(63)});

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