UNPKG

contentstack

Version:
9 lines 155 kB
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Contentstack=r():e.Contentstack=r()}(window,(function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=14)}([function(e,r,t){"use strict";(function(e){Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.transform=function(e){return function(){switch(this._query[e]=this._query[e]||{},arguments.length){case 1:if(Array.isArray(arguments[0])||"string"==typeof arguments[0]){var r=this._query[e].BASE||[];return r=r.concat(arguments[0]),this._query[e].BASE=r,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var t=this._query[e][arguments[0]]||[];return t=t.concat(arguments[1]),this._query[e][arguments[0]]=t,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}},r._type=function(e){var r=void 0===e?"undefined":n(e);switch(r){case"object":r,Array.isArray(e)&&(r="array");break;default:r}return r},r.mergeDeep=function(e,r){var t=this;return function e(r,n){for(var o in n)"object"==t._type(n[o])&&t._type(r[o])==t._type(n[o])?e(r[o],n[o]):"array"==t._type(n[o])&&t._type(r[o])==t._type(n[o])?r[o]=r[o].concat(n[o]):r[o]=n[o]}(e,r),e},r.merge=s,r.isBrowser=function(){return"undefined"!=typeof window&&"object"===(void 0===e?"undefined":n(e))&&"browser"===e.title},r.parseQueryFromParams=u,r.getHash=c,r.generateHash=l,r.resultWrapper=f,r.spreadResult=p,r.sendRequest=function(e,r){var t=e.environment_uid;t?e._query.environment_uid=t:(e._query||(e._query={}),e._query.environment=e.environment);var i=e,a=void 0!==i.queryCachePolicy?i.queryCachePolicy:i.cachePolicy,l=void 0!==i.tojson&&i.tojson,d=!!(i.entry_uid||i.singleEntry||i.asset_uid),h=c(u(i,d,l));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var y=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===y?"undefined":n(y))&&(y=JSON.parse(y)),delete e.requestParams.body.query,e.requestParams.body=s(e.requestParams.body,y)}var g=function(){return function(e,r){return new Promise((function(t,n){try{if(e)throw e;l||(r=f(r)),t(p(r))}catch(e){n(e)}}))}},m=function(t,n,s){t&&(0,o.default)(e.requestParams,r).then(function(r){try{i.entry_uid=i.asset_uid=i.tojson=i.queryCachePolicy=void 0;var t={},o={};if(e.singleEntry)if(e.singleEntry=!1,r.schema&&(t.schema=r.schema),r.content_type&&(t.content_type=r.content_type,delete t.schema),r.entries&&r.entries.length)t.entry=r.entries[0];else{if(!r.assets||!r.assets.length)return 2!==a||null===i.provider?s({error_code:141,error_message:"The requested entry doesn't exist."}):void i.provider.get(h,g());t.assets=r.assets[0]}else r.items?o={items:r.items,pagination_token:r.pagination_token,sync_token:r.sync_token,total_count:r.total_count}:t=r;return-1!==a&&null!==i.provider?(i.provider.set(h,t,(function(e){try{if(e)throw e;return l||(t=f(t)),n(p(t))}catch(e){return s(e)}})),n(p(t))):Object.keys(o).length?n(o):(l||(t=f(t)),n(p(t)))}catch(e){return s({message:e.message})}}.bind(i)).catch((function(e){if(2!==a||null===i.provider)return s(e);i.provider.get(h,g())}))};switch(a){case 1:return new Promise((function(e,r){null!==i.provider?i.provider.get(h,(function(t,n){try{if(!t&&n)return l||(n=f(n)),e(p(n));m(!0,e,r)}catch(e){return r(e)}})):m(!0,e,r)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,r){m(!0,e,r)}))}if(3===a){return new Promise((function(e,r){null!==i.provider&&i.provider.get(h,(function(t,n){try{t||!n?r(t):(l||(n=f(n)),e(p(n)))}catch(e){r(e)}}))})).then((function(){return new Promise((function(e,r){m(!0,e,r)}))})).catch((function(e){return new Promise((function(e,r){m(!0,e,r)}))}))}};var o=a(t(4)),i=a(t(19));a(t(5));function a(e){return e&&e.__esModule?e:{default:e}}function s(e,r){if(e&&r)for(var t in r)e[t]=r[t];return e}function u(e,r,t){if(e&&e.requestParams){var n=s({},e.requestParams.body&&e.requestParams.body.query||{});return n.environment_uid&&(delete n.environment_uid,n.environment=e.environment),n.environment=e.environment,{content_type_uid:e.content_type_uid,locale:n.locale||"en-us",query:n,entry_uid:e.entry_uid,asset_uid:e.asset_uid,single:r||"false",toJSON:t||"false",api_key:e.requestParams.headers?e.requestParams.headers.api_key:""}}}function c(e){try{var r=l(JSON.stringify(e)),t=[];return t.push(e.content_type_uid),t.push(e.locale),e.entry_uid&&t.push(e.entry_uid),e.asset_uid&&t.push(e.asset_uid),t.push(r),t.join(".")}catch(e){}}function l(e){var r,t=0,n=void 0;if(0===e.length)return t;for(n=0,r=e.length;n<r;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t<-1?-1*t:t}function f(e){if(e&&void 0!==e.entries)if(e.entries&&e.entries.length)for(var r=0,t=e.entries.length;r<t;r++)e.entries[r]=(0,i.default)(e.entries[r]);else e.entries=[];else if(e&&e.assets&&void 0!==e.assets)if(e.assets&&e.assets.length)for(var n=0,o=e.assets.length;n<o;n++)e.assets[n]=(0,i.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,i.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,i.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,i.default)(e.items).toJSON());return e}function p(e){var r=[];return e&&Object.keys(e).length&&(void 0!==e.entries&&(r.push(e.entries),e.content_type&&(r.schema=e.content_type)),void 0!==e.assets&&r.push(e.assets),void 0===e.content_type&&void 0===e.schema||r.push(e.content_type||e.schema),void 0!==e.count&&r.push(e.count),void 0!==e.entry&&(r=e.entry,e.schema&&(r.schema=e.schema),e.content_type&&(r.content_type=e.content_type)),void 0!==e.asset&&(r=e.asset),void 0!==e.items&&r.push(e)),r}Promise.prototype.spread||(Promise.prototype.spread=function(e,r){return r=r||function(e){},this.then((function(r){return e.apply(e,r)})).catch((function(e){r(e)}))})}).call(this,t(6))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}();var o=function(){function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.childNodes=[]}return n(e,[{key:"innerText",get:function(){return this.rawText}}]),e}();r.default=o},function(e,r,t){"use strict";var n;Object.defineProperty(r,"__esModule",{value:!0}),function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE"}(n||(n={})),r.default=n},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),i=p(t(5)),a=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),s=p(t(8)),u=p(t(20)),c=p(t(9)),l=p(t(4)),f=p(t(10));function p(e){return e&&e.__esModule?e:{default:e}}function d(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var h=[408,429],y=function(){function e(){d(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!h.includes(e.status)}},this.config=a.mergeDeep({},i.default);for(var r=arguments.length,t=Array(r),o=0;o<r;o++)t[o]=arguments[o];switch(t[0].region&&void 0!==t[0].region&&"us"!==t[0].region&&(this.config.host=t[0].region+"-cdn.contentstack.com"),t[0].fetchOptions&&void 0!==t[0].fetchOptions&&(this.fetchOptions=a.mergeDeep(this.fetchOptions,t[0].fetchOptions)),this.cachePolicy=f.default.policies.IGNORE_CACHE,this.provider=f.default.providers("localstorage"),t.length){case 1:if("object"===n(t[0])&&"string"==typeof t[0].api_key&&"string"==typeof t[0].delivery_token&&"string"==typeof t[0].environment)return this.headers={api_key:t[0].api_key,access_token:t[0].delivery_token},this.environment=t[0].environment,this;console.error("Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if("string"==typeof t[0]&&"string"==typeof t[1]&&"string"==typeof t[2])return this.headers={api_key:t[0],access_token:t[1]},this.environment=t[2],this;console.error("Kindly provide valid string parameters.");case 4:return"string"==typeof t[0]&&"string"==typeof t[1]&&"string"==typeof t[2]?(this.headers={api_key:t[0],access_token:t[1]},this.environment=t[2]):console.error("Kindly provide valid string parameters."),t[3]&&("string"==typeof t[3]&&void 0!==t[3]&&"us"!==t[3]?this.config.host=t[3]+"-cdn.contentstack.com":"object"===n(t[3])&&(this.fetchOptions=a.mergeDeep(this.fetchOptions,t[3]))),this;case 5:return"string"==typeof t[0]&&"string"==typeof t[1]&&"string"==typeof t[2]?(this.headers={api_key:t[0],access_token:t[1]},this.environment=t[2]):console.error("Kindly provide valid string parameters."),t[3]&&("string"==typeof t[3]&&void 0!==t[3]&&"us"!==t[3]?this.config.host=t[3]+"-cdn.contentstack.com":"object"===n(t[3])&&(this.fetchOptions=a.mergeDeep(this.fetchOptions,t[3]))),t[4]&&"object"===n(t[4])&&(this.fetchOptions=a.mergeDeep(this.fetchOptions,t[4])),this;default:console.error("Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return o(e,[{key:"setPort",value:function(e){return"number"==typeof e&&(this.config.port=e),this}},{key:"setProtocol",value:function(e){return"string"==typeof e&&~["https","http"].indexOf(e)&&(this.config.protocol=e),this}},{key:"setHost",value:function(e){return"string"==typeof e&&e&&(this.config.host=e),this}},{key:"setCachePolicy",value:function(e){return"number"==typeof e&&e>=-1&&e<4?this._query?this.queryCachePolicy=e:this.cachePolicy=e:console.error("Kindly provide the valid policy"),this}},{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":n(e))&&(this.provider=e),this}},{key:"clearByQuery",value:function(){if(this.provider&&"function"==typeof this.provider.clearByQuery)return this.provider.clearByQuery.apply(this.provider,arguments)}},{key:"clearByContentType",value:function(){if(this.provider&&"function"==typeof this.provider.clearByContentType)return this.provider.clearByContentType.apply(this.provider,arguments)}},{key:"clearAll",value:function(){if(this.provider&&"function"==typeof this.provider.clearAll)return this.provider.clearAll.apply(this.provider,arguments)}},{key:"getCacheProvider",value:function(){return this.provider}},{key:"ContentType",value:function(e){return e&&"string"==typeof e&&(this.content_type_uid=e,this.type="contentType"),this}},{key:"Entry",value:function(e){var r=new s.default;return e&&"string"==typeof e&&(r.entry_uid=e),a.merge(r,this)}},{key:"fetch",value:function(e){var r={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid,body:{_method:"GET",environment:this.environment}},t=a.mergeDeep({},this.fetchOptions,e);return(0,l.default)(r,t)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var r=new u.default;return r.asset_uid=e,a.merge(r,this)}return this}},{key:"Query",value:function(){var e=new c.default;return a.merge(e,this)}},{key:"getLastActivities",value:function(){var e={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",only_last_activity:!0,environment:this.environment}};return(0,l.default)(e,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",environment:this.environment}};if(e&&void 0!==e)for(var t in e)r.body[t]=e[t];return(0,l.default)(r,this.fetchOptions)}},{key:"sync",value:function(e,r){this._query={},this._query=a.mergeDeep(this._query,e),this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.sync,body:{_method:"GET",query:this._query}};var t=a.mergeDeep({},this.fetchOptions,r);return a.sendRequest(this,t)}},{key:"imageTransform",value:function(e,r){if(e&&"string"==typeof e&&"object"===(void 0===r?"undefined":n(r))&&void 0===r.length){var t=[];for(var o in r)t.push(o+"="+r[o]);e+=e.indexOf("?")<=-1?"?"+t.join("&"):"&"+t.join("&")}return e}}]),e}();r.default=y},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e,r){return new Promise((function(t,o){var a=void 0,c=e.url,l=e.headers;return l["Content-Type"]="application/json; charset=UTF-8",l["X-User-Agent"]="contentstack-web/3.13.3",e.body&&"object"===n(e.body)&&(delete e.body._method,"object"===n(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,a=function e(r,t){var o=[],i=void 0;if("object"===(void 0===r?"undefined":n(r))&&void 0!==r.length)for(var a=0,s=r.length;a<s;a++)o.push(t+"[]="+r[a]);else for(i in r){var u=t?t+"["+i+"]":i,c=r[i];o.push(null!==c&&"object"===(void 0===c?"undefined":n(c))&&"query"!==i?e(c,u):u+"="+encodeURIComponent("query"!==i?c:JSON.stringify(c)))}return o.join("&")}(e.body)),function e(r,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:300,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,a=arguments[4],c=arguments[5],l=arguments[6],f=i.mergeDeep({method:"GET",headers:t,timeout:3e4},a);function p(i){if(0===o)l(i);else{var s=n;o-=1;var f=a.retryLimit-o;a.retryDelayOptions&&(a.retryDelayOptions.base?s=a.retryDelayOptions.base*f:a.retryDelayOptions.customBackoff&&(s=a.retryDelayOptions.customBackoff(f,i))),u(s).then((function(){return e(r,t,n,o,a,c,l)}))}}(0,s.default)(r,f).then((function(e){var r=e.json();e.ok&&200===e.status?c(r):r.then((function(r){a.retryCondition&&a.retryCondition(e)?p(r):l(r)})).catch((function(){l({status:e.status,statusText:e.statusText})}))})).catch((function(e){l(e)}))}(c+"?"+a,l,r.retryDelay,r.retryLimit,r,t,o)}))};var o,i=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),a=t(15),s=(o=a)&&o.__esModule?o:{default:o};function u(e){return new Promise((function(r){setTimeout(r,e)}))}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.default={protocol:"https",host:"cdn.contentstack.io",port:443,version:"v3",urls:{sync:"/stacks/sync",content_types:"/content_types/",entries:"/entries/",assets:"/assets/",environments:"/environments/"}}},function(e,r,t){"use strict";var n,o,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(r){try{return n.call(null,e,0)}catch(r){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(e){o=s}}();var c,l=[],f=!1,p=-1;function d(){f&&c&&(f=!1,c.length?l=c.concat(l):p=-1,l.length&&h())}function h(){if(!f){var e=u(d);f=!0;for(var r=l.length;r;){for(c=l,l=[];++p<r;)c&&c[p].run();p=-1,r=l.length}c=null,f=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===s||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(r){try{return o.call(null,e)}catch(r){return o.call(this,e)}}}(e)}}function y(e,r){this.fun=e,this.array=r}function g(){}i.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];l.push(new y(e,r)),1!==l.length||f||u(h)},y.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,r,t){"use strict";var n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(n=window)}e.exports=n},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),a=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0)),s=t(3);(n=s)&&n.__esModule;var u=function(){function e(){return function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=a.transform("only"),this.except=a.transform("except"),this}return i(e,[{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":o(e))&&(this.provider=e),this}},{key:"setCachePolicy",value:function(e){return"number"==typeof e&&e>=-1&&e<4?this._query?this.queryCachePolicy=e:this.cachePolicy=e:console.error("Kindly provide the valid policy"),this}},{key:"includeReference",value:function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];if(Array.isArray(r)||"string"==typeof r){if(arguments.length)for(var n=0;n<arguments.length;n++)this._query.include=this._query.include||[],this._query.include=this._query.include.concat(arguments[n]);return this}console.error("Argument should be a String or an Array.")}},{key:"language",value:function(e){if(e&&"string"==typeof e)return this._query.locale=e,this;console.error("Argument should be a String.")}},{key:"addQuery",value:function(e,r){if(e&&r&&"string"==typeof e)return this._query[e]=r,this;console.error("First argument should be a String.")}},{key:"includeEmbeddedItems",value:function(){return this._query.include_embedded_items=["BASE"],this}},{key:"includeSchema",value:function(){return this._query.include_schema=!0,this}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"includeContentType",value:function(){return this._query.include_content_type=!0,this}},{key:"includeOwner",value:function(){return this._query.include_owner=!0,this}},{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,r){if(e&&r&&"string"==typeof e&&"string"==typeof r)return this._query[e]=r,this;console.error("Kindly provide valid parameters.")}},{key:"fetch",value:function(e){if(this.entry_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries+this.entry_uid,body:{_method:"GET",query:this._query}};var r=a.mergeDeep({},this.fetchOptions,e);return a.sendRequest(this,r)}console.error("Kindly provide an entry uid. e.g. .Entry('bltsomething123')")}}]),e}();r.default=u},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=(s(t(4)),function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0))),a=s(t(8));function s(e){return e&&e.__esModule?e:{default:e}}var u=function(e){return function(r,t){if(r&&t&&"string"==typeof r&&void 0!==t)return this._query.query[r]=this._query.query.file_size||{},this._query.query[r][e]=t,this;console.error("Kindly provide valid parameters.")}},c=function(e){var r=e?"$in":"$nin";return function(e,t){if(e&&t&&"string"==typeof e&&Array.isArray(t))return this._query.query[e]=this._query.query[e]||{},this._query.query[e][r]=this._query.query[e][r]||[],this._query.query[e][r]=this._query.query[e][r].concat(t),this;console.error("Kindly provide valid parameters.")}},l=function(e){return function(r){if(r&&"string"==typeof r)return this._query.query[r]=this._query.query[r]||{},this._query.query[r].$exists=e,this;console.error("Kindly provide valid parameters.")}},f=function(e){return function(){for(var r=[],t=0,n=arguments.length;t<n;t++)arguments[t]instanceof h&&arguments[t]._query.query?r.push(arguments[t]._query.query):"object"===o(arguments[t])&&r.push(arguments[t]);return this._query.query[e]?this._query.query[e]=this._query.query[e].concat(r):this._query.query[e]=r,this}},p=function(e){return function(r){if(r&&"string"==typeof r)return this._query[e]=r,this;console.error("Argument should be a string.")}},d=function(e){return function(r){if("number"==typeof r)return this._query[e]=r,this;console.error("Argument should be a number.")}},h=function(e){function r(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r);var e=function(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=u("$lt"),e.lessThanOrEqualTo=u("$lte"),e.greaterThan=u("$gt"),e.greaterThanOrEqualTo=u("$gte"),e.notEqualTo=u("$ne"),e.containedIn=c(!0),e.notContainedIn=c(!1),e.exists=l(!0),e.notExists=l(!1),e.ascending=p("asc"),e.descending=p("desc"),e.beforeUid=p("before_uid"),e.afterUid=p("after_uid"),e.skip=d("skip"),e.limit=d("limit"),e.or=f("$or"),e.and=f("$and"),e}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}(r,e),n(r,[{key:"equalTo",value:function(e,r){if(e&&"string"==typeof e)return this._query.query[e]=r,this;console.error("Kindly provide valid parameters.")}},{key:"where",value:function(e,r){if(e&&"string"==typeof e)return this._query.query[e]=r,this;console.error("Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,r=this.type&&"asset"===this.type?e+this.config.urls.assets:e+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries;return this._query.count=!0,this.requestParams={method:"POST",headers:this.headers,url:r,body:{_method:"GET",query:this._query}},this}},{key:"query",value:function(e){if("object"===(void 0===e?"undefined":o(e)))return this._query.query=i.mergeDeep(this._query.query,e),this;console.error("Kindly provide valid parameters")}},{key:"referenceIn",value:function(e,t){var n={};return t instanceof r&&t._query.query?n.$in_query=t._query.query:"object"===(void 0===t?"undefined":o(t))&&(n.$in_query=t),this._query.query[e]?this._query.query[e]=this._query.query[e].concat(n):this._query.query[e]=n,this}},{key:"referenceNotIn",value:function(e,t){var n={};return t instanceof r&&t._query.query?n.$nin_query=t._query.query:"object"===(void 0===t?"undefined":o(t))&&(n.$nin_query=t),this._query.query[e]?this._query.query[e]=this._query.query[e].concat(n):this._query.query[e]=n,this}},{key:"tags",value:function(e){if(Array.isArray(e))return this._query.tags=e,this;console.error("Kindly provide valid parameters")}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeCount",value:function(){return this._query.include_count=!0,this}},{key:"addParam",value:function(e,r){if(e&&r&&"string"==typeof e&&"string"==typeof r)return this._query[e]=r,this;console.error("Kindly provide valid parameters.")}},{key:"getQuery",value:function(){return this._query.query||{}}},{key:"regex",value:function(e,r,t){if(e&&r&&"string"==typeof e&&"string"==typeof r)return this._query.query[e]={$regex:r},t&&(this._query.query[e].$options=t),this;console.error("Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;console.error("Kindly provide valid parameters.")}},{key:"find",value:function(e){var r=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=this.type&&"asset"===this.type?r+this.config.urls.assets:r+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries;this.requestParams={method:"POST",headers:this.headers,url:t,body:{_method:"GET",query:this._query}};var n=i.mergeDeep({},this.fetchOptions,e);return i.sendRequest(this,n)}},{key:"findOne",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,r=this.type&&"asset"===this.type?e+this.config.urls.assets:e+this.config.urls.content_types+this.content_type_uid+this.config.urls.entries;this.singleEntry=!0,this._query.limit=1,this.requestParams={method:"POST",headers:this.headers,url:r,body:{_method:"GET",query:this._query}};var t=i.mergeDeep({},this.fetchOptions);return i.sendRequest(this,t)}}]),r}(a.default);r.default=h},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o=t(21),i=(n=o)&&n.__esModule?n:{default:n};var a={providers:function(e){if(e)return i.default;console.error("Kindly provide valid provider.")},policies:{IGNORE_CACHE:-1,ONLY_NETWORK:0,CACHE_ELSE_NETWORK:1,NETWORK_ELSE_CACHE:2,CACHE_THEN_NETWORK:3}};r.default=a},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),o=a(t(1)),i=a(t(2));function a(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function r(e){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r);var t=function(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t.rawText=e,t.nodeType=i.default.COMMENT_NODE,t}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}(r,e),n(r,[{key:"toString",value:function(){return"\x3c!--"+this.rawText+"--\x3e"}},{key:"text",get:function(){return this.rawText}}]),r}(o.default);r.default=s},function(e,r){(function(r){e.exports=r}).call(this,{})},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),o=i(t(2));function i(e){return e&&e.__esModule?e:{default:e}}var a=function(e){function r(e){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r);var t=function(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t.rawText=e,t.nodeType=o.default.TEXT_NODE,t}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}(r,e),n(r,[{key:"toString",value:function(){return this.text}},{key:"text",get:function(){return this.rawText}},{key:"isWhitespace",get:function(){return/^(\s|&nbsp;)*$/.test(this.rawText)}}]),r}(i(t(1)).default);r.default=a},function(e,r,t){"use strict";var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),o=s(t(3)),i=s(t(10)),a=s(t(24));function s(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.CachePolicy=i.default.policies,this.Region=a.default,this.Utils=t(25)}return n(e,[{key:"Stack",value:function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return new(Function.prototype.bind.apply(o.default,[null].concat(r)))}}]),e}();e.exports=new u},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=i(t(16)),o=i(t(17));function i(e){return e&&e.__esModule?e:{default:e}}n.default.polyfill(),r.default=o.default},function(e,r,t){"use strict";(function(n,o){var i,a,s,u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}; /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version 4.1.1 */ s=function(){function e(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,a=void 0,s=void 0,c=function(e,r){g[i]=e,g[i+1]=r,2===(i+=2)&&(s?s(m):E())},l="undefined"!=typeof window?window:void 0,f=l||{},p=f.MutationObserver||f.WebKitMutationObserver,d="undefined"==typeof self&&void 0!==n&&"[object process]"==={}.toString.call(n),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function y(){var e=setTimeout;return function(){return e(m,1)}}var g=new Array(1e3);function m(){for(var e=0;e<i;e+=2)(0,g[e])(g[e+1]),g[e]=void 0,g[e+1]=void 0;i=0}var b,v,w,q,E=void 0;function A(e,r){var t=arguments,n=this,o=new this.constructor(T);void 0===o[_]&&F(o);var i=n._state;return i?function(){var e=t[i-1];c((function(){return U(i,o,e,n._result)}))}():B(n,o,e,r),o}function D(e){if(e&&"object"===(void 0===e?"undefined":u(e))&&e.constructor===this)return e;var r=new this(T);return N(r,e),r}d?E=function(){return n.nextTick(m)}:p?(v=0,w=new p(m),q=document.createTextNode(""),w.observe(q,{characterData:!0}),E=function(){q.data=v=++v%2}):h?((b=new MessageChannel).port1.onmessage=m,E=function(){return b.port2.postMessage(0)}):E=void 0===l?function(){try{var e=t(!function(){var e=new Error("Cannot find module 'vertx'");throw e.code="MODULE_NOT_FOUND",e}());return void 0!==(a=e.runOnLoop||e.runOnContext)?function(){a(m)}:y()}catch(e){return y()}}():y();var _=Math.random().toString(36).substring(16);function T(){}var k=new P;function x(e){try{return e.then}catch(e){return k.error=e,k}}function S(r,t,n){t.constructor===r.constructor&&n===A&&t.constructor.resolve===D?function(e,r){1===r._state?L(e,r._result):2===r._state?C(e,r._result):B(r,void 0,(function(r){return N(e,r)}),(function(r){return C(e,r)}))}(r,t):n===k?(C(r,k.error),k.error=null):void 0===n?L(r,t):e(n)?function(e,r,t){c((function(e){var n=!1,o=function(e,r,t,n){try{e.call(r,t,n)}catch(e){return e}}(t,r,(function(t){n||(n=!0,r!==t?N(e,t):L(e,t))}),(function(r){n||(n=!0,C(e,r))}),e._label);!n&&o&&(n=!0,C(e,o))}),e)}(r,t,n):L(r,t)}function N(e,r){var t,n;e===r?C(e,new TypeError("You cannot resolve a promise with itself")):(n=void 0===(t=r)?"undefined":u(t),null===t||"object"!==n&&"function"!==n?L(e,r):S(e,r,x(r)))}function O(e){e._onerror&&e._onerror(e._result),R(e)}function L(e,r){void 0===e._state&&(e._result=r,e._state=1,0!==e._subscribers.length&&c(R,e))}function C(e,r){void 0===e._state&&(e._state=2,e._result=r,c(O,e))}function B(e,r,t,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=r,o[i+1]=t,o[i+2]=n,0===i&&e._state&&c(R,e)}function R(e){var r=e._subscribers,t=e._state;if(0!==r.length){for(var n=void 0,o=void 0,i=e._result,a=0;a<r.length;a+=3)n=r[a],o=r[a+t],n?U(t,n,o,i):o(i);e._subscribers.length=0}}function P(){this.error=null}var j=new P;function U(r,t,n,o){var i=e(n),a=void 0,s=void 0,u=void 0,c=void 0;if(i){if((a=function(e,r){try{return e(r)}catch(e){return j.error=e,j}}(n,o))===j?(c=!0,s=a.error,a.error=null):u=!0,t===a)return void C(t,new TypeError("A promises callback cannot return that same promise."))}else a=o,u=!0;void 0!==t._state||(i&&u?N(t,a):c?C(t,s):1===r?L(t,a):2===r&&C(t,a))}var I=0;function F(e){e[_]=I++,e._state=void 0,e._result=void 0,e._subscribers=[]}function H(e,t){this._instanceConstructor=e,this.promise=new e(T),this.promise[_]||F(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?L(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&L(this.promise,this._result))):C(this.promise,new Error("Array Methods must be provided an Array"))}function V(e){this[_]=I++,this._result=this._state=void 0,this._subscribers=[],T!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof V?function(e,r){try{r((function(r){N(e,r)}),(function(r){C(e,r)}))}catch(r){C(e,r)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return H.prototype._enumerate=function(e){for(var r=0;void 0===this._state&&r<e.length;r++)this._eachEntry(e[r],r)},H.prototype._eachEntry=function(e,r){var t=this._instanceConstructor,n=t.resolve;if(n===D){var o=x(e);if(o===A&&void 0!==e._state)this._settledAt(e._state,r,e._result);else if("function"!=typeof o)this._remaining--,this._result[r]=e;else if(t===V){var i=new t(T);S(i,e,o),this._willSettleAt(i,r)}else this._willSettleAt(new t((function(r){return r(e)})),r)}else this._willSettleAt(n(e),r)},H.prototype._settledAt=function(e,r,t){var n=this.promise;void 0===n._state&&(this._remaining--,2===e?C(n,t):this._result[r]=t),0===this._remaining&&L(n,this._result)},H.prototype._willSettleAt=function(e,r){var t=this;B(e,void 0,(function(e){return t._settledAt(1,r,e)}),(function(e){return t._settledAt(2,r,e)}))},V.all=function(e){return new H(this,e).promise},V.race=function(e){var t=this;return r(e)?new t((function(r,n){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(r,n)})):new t((function(e,r){return r(new TypeError("You must pass an array to race."))}))},V.resolve=D,V.reject=function(e){var r=new this(T);return C(r,e),r},V._setScheduler=function(e){s=e},V._setAsap=function(e){c=e},V._asap=c,V.prototype={constructor:V,then:A,catch:function(e){return this.then(null,e)}},V.polyfill=function(){var e=void 0;if(void 0!==o)e=o;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;if(r){var t=null;try{t=Object.prototype.toString.call(r.resolve())}catch(e){}if("[object Promise]"===t&&!r.cast)return}e.Promise=V},V.Promise=V,V},"object"===u(r)&&void 0!==e?e.exports=s():void 0===(a="function"==typeof(i=s)?i.call(r,t,r,e):i)||(e.exports=a)}).call(this,t(6),t(7))},function(e,r,t){"use strict";t(18),e.exports=self.fetch.bind(self)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.Headers=y,r.Request=E,r.Response=D,r.fetch=k;var o="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==o&&o,i="URLSearchParams"in o,a="Symbol"in o&&"iterator"in Symbol,s="FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch(e){return!1}}(),u="FormData"in o,c="ArrayBuffer"in o;if(c)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(e){return e&&l.indexOf(Object.prototype.toString.call(e))>-1};function p(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function h(e){var r={next:function(){var r=e.shift();return{done:void 0===r,value:r}}};return a&&(r[Symbol.iterator]=function(){return r}),r}function y(e){this.map={},e instanceof y?e.forEach((function(e,r){this.append(r,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(r){this.append(r,e[r])}),this)}function g(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function m(e){return new Promise((function(r,t){e.onload=function(){r(e.result)},e.onerror=function(){t(e.error)}}))}function b(e){var r=new FileReader,t=m(r);return r.readAsArrayBuffer(e),t}function v(e){if(e.slice)return e.slice(0);var r=new Uint8Array(e.byteLength);return r.set(new Uint8Array(e)),r.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(e){var r;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:s&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:u&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:i&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():c&&s&&((r=e)&&DataView.prototype.isPrototypeOf(r))?(this._bodyArrayBuffer=v(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(e)||f(e))?this._bodyArrayBuffer=v(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var e=g(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=g(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(b)}),this.text=function(){var e,r,t,n=g(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=new FileReader,t=m(r),r.readAsText(e),t;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var r=new Uint8Array(e),t=new Array(r.length),n=0;n<r.length;n++)t[n]=String.fromCharCode(r[n]);return t.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u&&(this.formData=function(){return this.text().then(A)}),this.json=function(){return this.text().then(JSON.parse)},this}y.prototype.append=function(e,r){e=p(e),r=d(r);var t=this.map[e];this.map[e]=t?t+", "+r:r},y.prototype.delete=function(e){delete this.map[p(e)]},y.prototype.get=function(e){return e=p(e),this.has(e)?this.map[e]:null},y.prototype.has=function(e){return this.map.hasOwnProperty(p(e))},y.prototype.set=function(e,r){this.map[p(e)]=d(r)},y.prototype.forEach=function(e,r){for(var t in this.map)this.map.hasOwnProperty(t)&&e.call(r,this.map[t],t,this)},y.prototype.keys=function(){var e=[];return this.forEach((function(r,t){e.push(t)})),h(e)},y.prototype.values=function(){var e=[];return this.forEach((function(r){e.push(r)})),h(e)},y.prototype.entries=function(){var e=[];return this.forEach((function(r,t){e.push([t,r])})),h(e)},a&&(y.prototype[Symbol.iterator]=y.prototype.entries);var q=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function E(e,r){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var t,n,o=(r=r||{}).body;if(e instanceof E){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,r.headers||(this.headers=new y(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=r.credentials||this.credentials||"same-origin",!r.headers&&this.headers||(this.headers=new y(r.headers)),this.method=(t=r.method||this.method||"GET",n=t.toUpperCase(),q.indexOf(n)>-1?n:t),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==r.cache&&"no-cache"!==r.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function A(e){var r=new FormData;return e.trim().split("&").forEach((function(e){if(e){var t=e.split("="),n=t.shift().replace(/\+/g," "),o=t.join("=").replace(/\+/g," ");r.append(decodeURIComponent(n),decodeURIComponent(o))}})),r}function D(e,r){if(!(this instanceof D))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');r||(r={}),this.type="default",this.status=void 0===r.status?200:r.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===r.statusText?"":""+r.statusText,this.headers=new y(r.headers),this.url=r.url||"",this._initBody(e)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},w.call(E.prototype),w.call(D.prototype),D.prototype.clone=function(){return new D(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},D.error=function(){var e=new D(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];D.redirect=function(e,r){if(-1===_.indexOf(r))throw new RangeError("Invalid status code");return new D(null,{status:r,headers:{location:e}})};var T=r.DOMException=o.DOMException;try{new T}catch(e){r.DOMException=T=function(e,r){this.message=e,this.name=r;var t=Error(e);this.stack=t.stack},T.prototype=Object.create(Error.prototype),T.prototype.constructor=T}function k(e,r){return new Promise((function(t,i){var a=new E(e,r);if(a.signal&&a.signal.aborted)return i(new T("Aborted","AbortError"));var u=new XMLHttpRequest;function l(){u.abort()}u.onload=function(){var e,r,n={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",r=new y,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var t=e.split(":"),n=t.shift().trim();if(n){var o=t.join(":").trim();r.append(n,o)}})),r)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var o="response"in u?u.response:u.responseText;setTimeout((function(){t(new D(o,n))}),0)},u.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},u.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},u.onabort=function(){setTimeout((function(){i(new T("Aborted","AbortError"))}),0)},u.open(a.method,function(e){try{return""===e&&o.location.href?o.location.href:e}catch(r){return e}}(a.url),!0),"include"===a.credentials?u.withCredentials=!0:"omit"===a.credentials&&(u.withCredentials=!1),"responseType"in u&&(s?u.responseType="blob":c&&a.headers.get("Content-Type")&&-1!==a.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!==n(r.headers)||r.headers instanceof y?a.headers.forEach((function(e,r){u.setRequestHeader(r,e)})):Object.getOwnPropertyNames(r.headers).forEach((function(e){u.setRequestHeader(e,d(r.headers[e]))})),a.signal&&(a.signal.addEventListener("abort",l),u.onreadystatechange=function(){4===u.readyState&&a.signal.removeEventListener("abort",l)}),u.send(void 0===a._bodyInit?null:a._bodyInit)}))}k.polyfill=!0,o.fetch||(o.fetch=k,o.Headers=y,o.Request=E,o.Response=D)},function(e,r,t){"use strict";var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),o=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0));var i=function(){function e(r){return function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),r&&(this.object=function(){return r}),this}return n(e,[{key:"toJSON",value:function(){return this.object()?o.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null}},{key:"get",value:function(e){if(this.object()&&e)return e.split(".").reduce((function(e,r){return e[r]}),this.object())}},{key:"getDownloadUrl",value:function(e){if(this.object()){var r=this.object().url?this.object().url:null;return r?r+"?disposition="+(e&&"string"==typeof e?e:"attachment"):null}}}]),e}();e.exports=function(e){return new i(e)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),o=function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}(t(0));