contentstack
Advanced tools
Comparing version 3.16.0 to 3.16.1
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var e={971:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.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/"},live_preview:{enable:!1,host:"api.contentstack.io"}}},900:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(128))&&n.__esModule?n:{default:n},o={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}};t.default=o},128:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(821)),i={};function o(e,t){!t&&e&&e.length&&e.push("");var r=void 0,i=n.getKeys(),o=n.getStorage();if(e&&e.length){r=e.join(".");for(var s=0,u=i.length;s<u;s++)i[s]&&0===i[s].indexOf(r)&&delete o[i[s]]}else for(var a=0,c=i.length;a<c;a++)delete o[i[a]]}i.get=function(e,t){try{t(null,n.get(e))}catch(e){t(e)}},i.set=function(e,t,r){try{e&&t&&n.set(e,t),r()}catch(e){r(e)}},i.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var e=Array.prototype.slice.call(arguments),t=e.splice(-1,1).pop(),r=[];r.push.apply(r,e),o(r),t()}}catch(e){callback(e)}},i.clearByQuery=function(e,t){try{for(var r=n.getKeys(),i=n.getStorage(),o=0,s=r.length;o<s;o++)r[o]&&~r[o].indexOf(e)&&delete i[r[o]];t()}catch(e){t(e)}},i.clearAll=function(e){try{o(),e()}catch(t){e(t)}},t.default=i},821:(e,t,r)=>{Object.defineProperty(t,"__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};t.get=function(e){var t=o.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null},t.set=function(e,t){try{"object"===(void 0===t?"undefined":n(t))?o.default.setItem(e,JSON.stringify(t)):o.default.setItem(e,t)}catch(e){}},t.getStorage=function(){return o.default||null},t.getKeys=function(){return o.default?Object.keys(o.default):[]};var i,o=(i=r(387))&&i.__esModule?i:{default:i}},32:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=u(r(533)),o=u(r(900)),s=u(r(764));function u(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.CachePolicy=o.default.policies,this.Region=s.default,this.Utils=r(464)}return n(e,[{key:"Stack",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(i.default,[null].concat(t)))}}]),e}();e.exports=new a},764:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={EU:"eu",US:"us",AZURE_NA:"azure-na"}},777:(e,t,r)=>{Object.defineProperty(t,"__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};t.default=function(e,t){var r=e.requestParams;return new Promise((function(i,o){var s=void 0;return r.headers["Content-Type"]="application/json; charset=UTF-8",r.headers["X-User-Agent"]="contentstack-react-native/3.16.0",r.body&&"object"===n(r.body)&&(delete r.body._method,"object"===n(r.body.query)&&0===Object.keys(r.body.query).length&&delete r.body.query,s=function e(t,r){var i=[];if("object"===(void 0===t?"undefined":n(t))&&void 0!==t.length)for(var o=0,s=t.length;o<s;o++)i.push(r+"[]="+t[o]);else for(var u in t){var a=r?r+"["+u+"]":u,c=t[u];i.push(null!==c&&"object"===(void 0===c?"undefined":n(c))&&"query"!==u?e(c,a):a+"="+encodeURIComponent("query"!==u?c:JSON.stringify(c)))}return i.join("&")}(r.body)),a(e,s,t,i,o,t.retryDelay,t.retryLimit)}))};var i,o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=(i=r(970))&&i.__esModule?i:{default:i};function u(e){return new Promise((function(t){setTimeout(t,e)}))}function a(e,t,r,n,i){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:300,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:5,f=e.requestParams,h=f.url+"?"+t,y=f.headers,d=o.mergeDeep({method:"GET",headers:y,timeout:3e4},r);function p(o){if(0===l)r.debug&&r.logHandler("error",o),i(o);else{var s=c;l-=1;var f=r.retryLimit-l;r.retryDelayOptions&&(r.retryDelayOptions.base?s=r.retryDelayOptions.base*f:r.retryDelayOptions.customBackoff&&(s=r.retryDelayOptions.customBackoff(f,o))),u(s).then((function(){return a(e,t,r,n,i,c,l)})).catch((function(){return a(e,t,r,n,i,c,l)}))}}r.debug&&r.logHandler("info",{url:h,option:d});var v={url:h,option:d},_=e.plugins;if(_&&void 0!==_)for(var g=0;g<_.length;g++)"function"==typeof _[g].onRequest&&(v=_[g].onRequest(e,v));(0,s.default)(v.url,v.option).then((function(t){r.debug&&r.logHandler("info",t);var o=t.json();t.ok&&200===t.status?o.then((function(r){for(var i=0;i<_.length&&"function"==typeof _[i].onResponse;i++)r=_[i].onResponse(e,v,t,r);n(r)})):o.then((function(e){r.retryCondition&&r.retryCondition(t)?p(e):(r.debug&&r.logHandler("error",e),i(e))})).catch((function(){r.debug&&r.logHandler("error",{status:t.status,statusText:t.statusText}),i({status:t.status,statusText:t.statusText})}))})).catch((function(e){r.debug&&r.logHandler("error",e),i(e)}))}},540:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.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 t=this._query[e].BASE||[];return t=t.concat(arguments[0]),this._query[e].BASE=t,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var r=this._query[e][arguments[0]]||[];return r=r.concat(arguments[1]),this._query[e][arguments[0]]=r,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}},t._type=function(e){var t=void 0===e?"undefined":i(e);return"object"===t&&Array.isArray(e)&&(t="array"),t},t.mergeDeep=function(e,t){var r=this;return function e(t,n){for(var i in n)"object"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?e(t[i],n[i]):"array"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?t[i]=t[i].concat(n[i]):t[i]=n[i]}(e,t),e},t.merge=a,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===("undefined"==typeof process?"undefined":i(process))&&"browser"===process.title},t.parseQueryFromParams=c,t.getHash=l,t.generateHash=f,t.resultWrapper=h,t.spreadResult=y,t.sendRequest=function(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:(e._query||(e._query={}),e._query.environment=e.environment);var n=e,s=void 0!==n.queryCachePolicy?n.queryCachePolicy:n.cachePolicy,u=void 0!==n.tojson&&n.tojson,f=!!(n.entry_uid||n.singleEntry||n.asset_uid),p=l(c(n,f,u));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var v=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===v?"undefined":i(v))&&(v=JSON.parse(v)),delete e.requestParams.body.query,e.requestParams.body=a(e.requestParams.body,v),e.live_preview&&!0===e.live_preview.enable&&e.live_preview.live_preview&&"init"!==e.live_preview.live_preview&&(e.live_preview.content_type_uid===e.content_type_uid?(e.requestParams.body=a(e.requestParams.body,{live_preview:e.live_preview.live_preview||"init"}),s=2,e.requestParams.body.environment&&delete e.requestParams.body.environment,e.requestParams.headers.access_token&&delete e.requestParams.headers.access_token,e.requestParams.headers.authorization=e.live_preview.management_token):e.live_preview.live_preview&&(s=1))}var _=function(){return function(e,t){return new Promise((function(r,n){try{e&&n(e),u||(t=h(t)),r(y(t))}catch(e){n(e)}}))}},g=function(r,i,a){r&&(0,o.default)(e,t).then(function(t){try{n.entry_uid=n.asset_uid=n.tojson=n.queryCachePolicy=void 0;var r={},o={};if(e.singleEntry)if(e.singleEntry=!1,t.schema&&(r.schema=t.schema),t.content_type&&(r.content_type=t.content_type,delete r.schema),t.entries&&t.entries.length)r.entry=t.entries[0];else{if(!t.assets||!t.assets.length)return 2===s&&null!==n.provider?void n.provider.get(p,_()):a({error_code:141,error_message:"The requested entry doesn't exist."});r.assets=t.assets[0]}else t.items?o={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==n.provider?(n.provider.set(p,r,(function(e){try{return e&&a(e),u||(r=h(r)),i(y(r))}catch(e){return a(e)}})),i(y(r))):Object.keys(o).length?i(o):(u||(r=h(r)),i(y(r)))}catch(e){return a({message:e.message})}}.bind(n)).catch((function(e){if(2!==s||null===n.provider)return a(e);n.provider.get(p,_())}))};switch(s){case 1:return new Promise((async function(r,i){null!==n.provider?await n.provider.get(p,(async function(o,s){try{if(o||!s)g(!0,r,i);else{var a=JSON.parse(JSON.stringify(s));try{if(e._query&&Array.isArray(e._query.include)&&e._query.include.length>0){var c=(l=e._query.include,v={},l.forEach((function(e){!function(e){var t=(e=e.replace(/[\[]/gm,".").replace(/[\]]/gm,"")).split("."),r=t.pop();t.reduce((function(e,t){return e[t]=e[t]||{}}),v)[r]={}}(e)})),v);f?await d(c,s.entry,e,t):await Promise.all(s.entries.map((async function(r){await d(c,r,e,t)})))}}catch(e){}await n.provider.set(p,a,(function(e){try{return e&&i(e),u||(s=h(s)),r(y(s))}catch(e){return i(e)}}))}}catch(e){return i(e)}var l,v})):g(!0,r,i)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){g(!0,e,t)}))}if(3===s)return new Promise((function(e,t){null!==n.provider&&n.provider.get(p,(function(r,n){try{r||!n?t(r):(u||(n=h(n)),e(y(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){g(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){g(!0,e,t)}))}))};var o=u(r(777)),s=u(r(324));function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function c(e,t,r){if(e&&e.requestParams){var n=a({},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:t||"false",toJSON:r||"false",api_key:e.requestParams.headers?e.requestParams.headers.api_key:""}}}function l(e){try{var t=f(JSON.stringify(e)),r=[];return r.push(e.content_type_uid),r.push(e.locale),e.entry_uid&&r.push(e.entry_uid),e.asset_uid&&r.push(e.asset_uid),r.push(t),r.join(".")}catch(e){}}function f(e){var t,r=0,n=void 0;if(0===e.length)return r;for(n=0,t=e.length;n<t;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return r<-1?-1*r:r}function h(e){if(e&&void 0!==e.entries)if(e.entries&&e.entries.length)for(var t=0,r=e.entries.length;t<r;t++)e.entries[t]=(0,s.default)(e.entries[t]);else e.entries=[];else if(e&&e.assets&&void 0!==e.assets)if(e.assets&&e.assets.length)for(var n=0,i=e.assets.length;n<i;n++)e.assets[n]=(0,s.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,s.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,s.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,s.default)(e.items).toJSON());return e}function y(e){var t=[];return e&&Object.keys(e).length&&(void 0!==e.entries&&(t.push(e.entries),e.content_type&&(t.schema=e.content_type)),void 0!==e.assets&&t.push(e.assets),void 0===e.content_type&&void 0===e.schema||t.push(e.content_type||e.schema),void 0!==e.count&&t.push(e.count),void 0!==e.entry&&(t=e.entry,e.schema&&(t.schema=e.schema),e.content_type&&(t.content_type=e.content_type)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}async function d(e,t,r,i,s){var u=r.live_preview,a=r.requestParams,c=u.content_type_uid,l=u.management_token;await async function e(t,s,f){if(void 0!==s)if(Array.isArray(s))await Promise.all(s.map((function(r,n){return e(t,r,(function(e){s[n]=e}))})));else if(s._content_type_uid===c)try{r.requestParams=JSON.parse(JSON.stringify(a));var h=function(e){var t=[];return function e(r,i){0===Object.keys(r).length?t.push(i.substring(1)):Object.entries(r).forEach((function(t){var r=n(t,2),o=r[0];e(r[1],[i,o].join("."))}))}(e,""),t.filter((function(e){return""!==e}))}(t);r.requestParams.body.include=h,r.requestParams.body.live_preview=u.live_preview,r.requestParams.body.content_type_uid=c;var y=u.host.match(/^((http[s]?):(\/\/)?)?(.+)$/),d=(y[1]||"https://")+y[4],p=s.uid,v=d+"/v3/content_types/"+s._content_type_uid+"/entries/"+p;r.requestParams.url=v,r.requestParams.method="GET",delete r.requestParams.headers.access_token,r.requestParams.headers.authorization=l;var _=await(0,o.default)(r,i);_.entry._content_type_uid=c,_.entry.uid=p,f(_.entry)}catch(e){console.log("errror",e)}else await Promise.all(Object.entries(t).map((async function(t){var r=n(t,2),i=r[0],o=r[1];await e(o,s[i],(function(){}))})))}(e,t,(function(){}))}Promise.prototype.spread||(Promise.prototype.spread=function(e,t){return t=t||function(e){},this.then((function(t){return e.apply(e,t)})).catch((function(e){t(e)}))})},173:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),o=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=i.transform("only"),this}return n(e,[{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&"string"==typeof e&&t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide a valid parameters.")}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"fetch",value:function(e){if(this.asset_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.assets+this.asset_uid,body:{_method:"GET",query:this._query}};var t=i.mergeDeep(this.fetchOptions,e);return i.sendRequest(i.mergeDeep({},this),t)}e.debug&&e.logHandler("error","Kindly provide an asset uid. e.g. .Assets('asset_uid')")}}]),e}();t.default=o},304:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=o.transform("only"),this.except=o.transform("except"),this}return i(e,[{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":n(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"includeReference",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Array.isArray(t)||"string"==typeof t){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}this.fetchOptions.debug&&this.fetchOptions.logHandler("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;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("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:"includeBranch",value:function(){return this._query.include_branch=!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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"fetch",value:function(e){var t=this.config.host+":"+this.config.port;if(this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host),this.entry_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+t+"/"+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=o.mergeDeep(this.fetchOptions,e);return o.sendRequest(o.mergeDeep({},this),r)}this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide an entry uid. e.g. .Entry('asset_uid')")}}]),e}();t.default=s},566:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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},s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=(n=r(304))&&n.__esModule?n:{default:n},a=function(e){return function(t,r){if(t&&r&&"string"==typeof t&&void 0!==r)return this._query.query[t]=this._query.query.file_size||{},this._query.query[t][e]=r,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},c=function(e){var t=e?"$in":"$nin";return function(e,r){if(e&&r&&"string"==typeof e&&Array.isArray(r))return this._query.query[e]=this._query.query[e]||{},this._query.query[e][t]=this._query.query[e][t]||[],this._query.query[e][t]=this._query.query[e][t].concat(r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},l=function(e){return function(t){if(t&&"string"==typeof t)return this._query.query[t]=this._query.query[t]||{},this._query.query[t].$exists=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},f=function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof d&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===o(arguments[r])&&t.push(arguments[r]);return this._query.query[e]?this._query.query[e]=this._query.query[e].concat(t):this._query.query[e]=t,this}},h=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a string.")}},y=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a number.")}},d=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=a("$lt"),e.lessThanOrEqualTo=a("$lte"),e.greaterThan=a("$gt"),e.greaterThanOrEqualTo=a("$gte"),e.notEqualTo=a("$ne"),e.containedIn=c(!0),e.notContainedIn=c(!1),e.exists=l(!0),e.notExists=l(!1),e.ascending=h("asc"),e.descending=h("desc"),e.beforeUid=h("before_uid"),e.afterUid=h("after_uid"),e.skip=y("skip"),e.limit=y("limit"),e.or=f("$or"),e.and=f("$and"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"equalTo",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=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:t,body:{_method:"GET",query:this._query}},this}},{key:"query",value:function(e){if("object"===(void 0===e?"undefined":o(e)))return this._query.query=s.mergeDeep(this._query.query,e),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters")}},{key:"referenceIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$in_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$in_query=r),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,r){var n={};return r instanceof t&&r._query.query?n.$nin_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$nin_query=r),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;this.fetchOptions.debug&&this.fetchOptions.logHandler("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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"getQuery",value:function(){return this._query.query||{}}},{key:"regex",value:function(e,t,r){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query.query[e]={$regex:t},r&&(this._query.query[e].$options=r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"find",value:function(e){var t=this.config.host+":"+this.config.port;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host);var r=this.config.protocol+"://"+t+"/"+this.config.version,n=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:n,body:{_method:"GET",query:this._query}};var i=s.mergeDeep(this.fetchOptions,e);return s.sendRequest(s.mergeDeep({},this),i)}},{key:"findOne",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(e=this.config.protocol+"://"+this.live_preview.host+"/"+this.config.version);var t=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:t,body:{_method:"GET",query:this._query}};var r=s.mergeDeep({},this.fetchOptions);return s.sendRequest(s.mergeDeep({},this),r)}}]),t}(u.default);t.default=d},324:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),o=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t&&(this.object=function(){return t}),this}return n(e,[{key:"toJSON",value:function(){return this.object()?i.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null}},{key:"get",value:function(e){if(this.object()&&e)return e.split(".").reduce((function(e,t){return e[t]}),this.object())}},{key:"getDownloadUrl",value:function(e){if(this.object()){var t=this.object().url?this.object().url:null;return t?t+"?disposition="+(e&&"string"==typeof e?e:"attachment"):null}}}]),e}();e.exports=function(e){return new o(e)}},533:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=h(r(971)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=h(r(304)),a=h(r(173)),c=h(r(566)),l=h(r(777)),f=h(r(900));function h(e){return e&&e.__esModule?e:{default:e}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=[408,429],p=function(){function e(){var t=this;y(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!d.includes(e.status)},debug:!1,logHandler:function(e,t){"error"===e&&t?console.error("[error] "+t):"warning"===e&&t?console.warn("[warning] "+t):"info"===e&&t&&console.info("[info] "+t)}},this.config=s.mergeDeep({},o.default),this.plugins=[];for(var r=arguments.length,i=Array(r),u=0;u<r;u++)i[u]=arguments[u];switch(i[0].region&&void 0!==i[0].region&&"us"!==i[0].region&&(this.config.host=i[0].region+"-cdn.contentstack.com"),i[0].fetchOptions&&void 0!==i[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[0].fetchOptions)),i[0].plugins&&void 0!==i[0].plugins&&i[0].plugins.forEach((function(e){t.plugins.push(e)})),this.cachePolicy=f.default.policies.IGNORE_CACHE,this.provider=f.default.providers("localstorage"),i.length){case 1:if("object"===n(i[0])&&"string"==typeof i[0].api_key&&"string"==typeof i[0].delivery_token&&"string"==typeof i[0].environment)return this.headers={api_key:i[0].api_key,access_token:i[0].delivery_token},"object"==n(i[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,i[0].live_preview)),"string"==typeof i[0].branch&&void 0!==i[0].branch&&(this.headers.branch=i[0].branch),this.environment=i[0].environment,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2])return this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2],this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters.");case 4:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),this;case 5:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),i[4]&&"object"===n(i[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[4])),this;default:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return i(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview||"init",this.live_preview.content_type_uid=e.content_type_uid,this.live_preview.entry_uid=e.entry_uid)}},{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 t=new u.default;return e&&"string"==typeof e&&(t.entry_uid=e),s.merge(t,this)}},{key:"fetch",value:function(e){this.requestParams={method:"POST",headers:this.headers,plugins:this.plugins,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}};var t=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(this,t)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new a.default;return t.asset_uid=e,s.merge(t,this)}return this}},{key:"Query",value:function(){var e=new c.default;return s.merge(e,this)}},{key:"getLastActivities",value:function(){return 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,body:{_method:"GET",only_last_activity:!0,environment:this.environment}},(0,l.default)(this,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(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,body:{_method:"GET",environment:this.environment}},e)for(var t in e)this.requestParams.body[t]=e[t];return(0,l.default)(this,this.fetchOptions)}},{key:"sync",value:function(e,t){this._query={},this._query=s.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 r=s.mergeDeep(this.fetchOptions,t);return s.sendRequest(s.mergeDeep({},this),r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":n(t))&&void 0===t.length){var r=[];for(var i in t)r.push(i+"="+t[i]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=p},970:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=fetch},387:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(118))&&n.__esModule?n:{default:n};t.default=i.default},464:e=>{e.exports=require("@contentstack/utils")},118:e=>{e.exports=require("localStorage")}},t={},r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}(32);module.exports=r})(); | ||
(()=>{"use strict";var e={971:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.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/"},live_preview:{enable:!1,host:"api.contentstack.io"}}},900:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(128))&&n.__esModule?n:{default:n},o={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}};t.default=o},128:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(821)),i={};function o(e,t){!t&&e&&e.length&&e.push("");var r=void 0,i=n.getKeys(),o=n.getStorage();if(e&&e.length){r=e.join(".");for(var s=0,u=i.length;s<u;s++)i[s]&&0===i[s].indexOf(r)&&delete o[i[s]]}else for(var a=0,c=i.length;a<c;a++)delete o[i[a]]}i.get=function(e,t){try{t(null,n.get(e))}catch(e){t(e)}},i.set=function(e,t,r){try{e&&t&&n.set(e,t),r()}catch(e){r(e)}},i.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var e=Array.prototype.slice.call(arguments),t=e.splice(-1,1).pop(),r=[];r.push.apply(r,e),o(r),t()}}catch(e){callback(e)}},i.clearByQuery=function(e,t){try{for(var r=n.getKeys(),i=n.getStorage(),o=0,s=r.length;o<s;o++)r[o]&&~r[o].indexOf(e)&&delete i[r[o]];t()}catch(e){t(e)}},i.clearAll=function(e){try{o(),e()}catch(t){e(t)}},t.default=i},821:(e,t,r)=>{Object.defineProperty(t,"__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};t.get=function(e){var t=o.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null},t.set=function(e,t){try{"object"===(void 0===t?"undefined":n(t))?o.default.setItem(e,JSON.stringify(t)):o.default.setItem(e,t)}catch(e){}},t.getStorage=function(){return o.default||null},t.getKeys=function(){return o.default?Object.keys(o.default):[]};var i,o=(i=r(387))&&i.__esModule?i:{default:i}},32:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=u(r(533)),o=u(r(900)),s=u(r(764));function u(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.CachePolicy=o.default.policies,this.Region=s.default,this.Utils=r(464)}return n(e,[{key:"Stack",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(i.default,[null].concat(t)))}}]),e}();e.exports=new a},764:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={EU:"eu",US:"us",AZURE_NA:"azure-na"}},777:(e,t,r)=>{Object.defineProperty(t,"__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};t.default=function(e,t){var r=e.requestParams;return new Promise((function(i,o){var s=void 0;return r.headers["Content-Type"]="application/json; charset=UTF-8",r.headers["X-User-Agent"]="contentstack-react-native/"+u,r.body&&"object"===n(r.body)&&(delete r.body._method,"object"===n(r.body.query)&&0===Object.keys(r.body.query).length&&delete r.body.query,s=function e(t,r){var i=[];if("object"===(void 0===t?"undefined":n(t))&&void 0!==t.length)for(var o=0,s=t.length;o<s;o++)i.push(r+"[]="+t[o]);else for(var u in t){var a=r?r+"["+u+"]":u,c=t[u];i.push(null!==c&&"object"===(void 0===c?"undefined":n(c))&&"query"!==u?e(c,a):a+"="+encodeURIComponent("query"!==u?c:JSON.stringify(c)))}return i.join("&")}(r.body)),a(e,s,t,i,o,t.retryDelay,t.retryLimit)}))};var i,o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=(i=r(970))&&i.__esModule?i:{default:i},u="3.16.1";function a(e,t,r,n,i){var u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:300,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:5,l=e.requestParams,f=l.url+"?"+t,h=l.headers,y=o.mergeDeep({method:"GET",headers:h,timeout:3e4},r);r.debug&&r.logHandler("info",{url:f,option:y});var d={url:f,option:y},p=e.plugins;if(p&&void 0!==p)for(var v=0;v<p.length;v++)"function"==typeof p[v].onRequest&&(d=p[v].onRequest(e,d));(0,s.default)(d.url,d.option).then((function(o){r.debug&&r.logHandler("info",o);var s=o.json();o.ok&&200===o.status?s.then((function(t){for(var r=0;r<p.length&&"function"==typeof p[r].onResponse;r++)t=p[r].onResponse(e,d,o,t);n(t)})):s.then((function(s){r.retryCondition&&r.retryCondition(o)?function(o){if(0===c)r.debug&&r.logHandler("error",o),i(o);else{var s=u;c-=1;var l=r.retryLimit-c;r.retryDelayOptions&&(r.retryDelayOptions.base?s=r.retryDelayOptions.base*l:r.retryDelayOptions.customBackoff&&(s=r.retryDelayOptions.customBackoff(l,o))),function(e){return new Promise((function(t){setTimeout(t,e)}))}(s).then((function(){return a(e,t,r,n,i,u,c)})).catch((function(){return a(e,t,r,n,i,u,c)}))}}(s):(r.debug&&r.logHandler("error",s),i(s))})).catch((function(){r.debug&&r.logHandler("error",{status:o.status,statusText:o.statusText}),i({status:o.status,statusText:o.statusText})}))})).catch((function(e){r.debug&&r.logHandler("error",e),i(e)}))}},540:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.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 t=this._query[e].BASE||[];return t=t.concat(arguments[0]),this._query[e].BASE=t,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var r=this._query[e][arguments[0]]||[];return r=r.concat(arguments[1]),this._query[e][arguments[0]]=r,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}},t._type=function(e){var t=void 0===e?"undefined":i(e);return"object"===t&&Array.isArray(e)&&(t="array"),t},t.mergeDeep=function(e,t){var r=this;return function e(t,n){for(var i in n)"object"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?e(t[i],n[i]):"array"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?t[i]=t[i].concat(n[i]):t[i]=n[i]}(e,t),e},t.merge=a,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===("undefined"==typeof process?"undefined":i(process))&&"browser"===process.title},t.parseQueryFromParams=c,t.getHash=l,t.generateHash=f,t.resultWrapper=h,t.spreadResult=y,t.sendRequest=function(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:(e._query||(e._query={}),e._query.environment=e.environment);var n=e,s=void 0!==n.queryCachePolicy?n.queryCachePolicy:n.cachePolicy,u=void 0!==n.tojson&&n.tojson,f=!!(n.entry_uid||n.singleEntry||n.asset_uid),p=l(c(n,f,u));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var v=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===v?"undefined":i(v))&&(v=JSON.parse(v)),delete e.requestParams.body.query,e.requestParams.body=a(e.requestParams.body,v),e.live_preview&&!0===e.live_preview.enable&&e.live_preview.live_preview&&"init"!==e.live_preview.live_preview&&(e.live_preview.content_type_uid===e.content_type_uid?(e.requestParams.body=a(e.requestParams.body,{live_preview:e.live_preview.live_preview||"init"}),s=2,e.requestParams.body.environment&&delete e.requestParams.body.environment,e.requestParams.headers.access_token&&delete e.requestParams.headers.access_token,e.requestParams.headers.authorization=e.live_preview.management_token):e.live_preview.live_preview&&(s=1))}var _=function(){return function(e,t){return new Promise((function(r,n){try{e&&n(e),u||(t=h(t)),r(y(t))}catch(e){n(e)}}))}},g=function(r,i,a){r&&(0,o.default)(e,t).then(function(t){try{n.entry_uid=n.asset_uid=n.tojson=n.queryCachePolicy=void 0;var r={},o={};if(e.singleEntry)if(e.singleEntry=!1,t.schema&&(r.schema=t.schema),t.content_type&&(r.content_type=t.content_type,delete r.schema),t.entries&&t.entries.length)r.entry=t.entries[0];else{if(!t.assets||!t.assets.length)return 2===s&&null!==n.provider?void n.provider.get(p,_()):a({error_code:141,error_message:"The requested entry doesn't exist."});r.assets=t.assets[0]}else t.items?o={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==n.provider?(n.provider.set(p,r,(function(e){try{return e&&a(e),u||(r=h(r)),i(y(r))}catch(e){return a(e)}})),i(y(r))):Object.keys(o).length?i(o):(u||(r=h(r)),i(y(r)))}catch(e){return a({message:e.message})}}.bind(n)).catch((function(e){if(2!==s||null===n.provider)return a(e);n.provider.get(p,_())}))};switch(s){case 1:return new Promise((async function(r,i){null!==n.provider?await n.provider.get(p,(async function(o,s){try{if(o||!s)g(!0,r,i);else{var a=JSON.parse(JSON.stringify(s));try{if(e._query&&Array.isArray(e._query.include)&&e._query.include.length>0){var c=(l=e._query.include,v={},l.forEach((function(e){!function(e){var t=(e=e.replace(/[\[]/gm,".").replace(/[\]]/gm,"")).split("."),r=t.pop();t.reduce((function(e,t){return e[t]=e[t]||{}}),v)[r]={}}(e)})),v);f?await d(c,s.entry,e,t):await Promise.all(s.entries.map((async function(r){await d(c,r,e,t)})))}}catch(e){}await n.provider.set(p,a,(function(e){try{return e&&i(e),u||(s=h(s)),r(y(s))}catch(e){return i(e)}}))}}catch(e){return i(e)}var l,v})):g(!0,r,i)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){g(!0,e,t)}))}if(3===s)return new Promise((function(e,t){null!==n.provider&&n.provider.get(p,(function(r,n){try{r||!n?t(r):(u||(n=h(n)),e(y(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){g(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){g(!0,e,t)}))}))};var o=u(r(777)),s=u(r(324));function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function c(e,t,r){if(e&&e.requestParams){var n=a({},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:t||"false",toJSON:r||"false",api_key:e.requestParams.headers?e.requestParams.headers.api_key:""}}}function l(e){try{var t=f(JSON.stringify(e)),r=[];return r.push(e.content_type_uid),r.push(e.locale),e.entry_uid&&r.push(e.entry_uid),e.asset_uid&&r.push(e.asset_uid),r.push(t),r.join(".")}catch(e){}}function f(e){var t,r=0,n=void 0;if(0===e.length)return r;for(n=0,t=e.length;n<t;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return r<-1?-1*r:r}function h(e){if(e&&void 0!==e.entries)if(e.entries&&e.entries.length)for(var t=0,r=e.entries.length;t<r;t++)e.entries[t]=(0,s.default)(e.entries[t]);else e.entries=[];else if(e&&e.assets&&void 0!==e.assets)if(e.assets&&e.assets.length)for(var n=0,i=e.assets.length;n<i;n++)e.assets[n]=(0,s.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,s.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,s.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,s.default)(e.items).toJSON());return e}function y(e){var t=[];return e&&Object.keys(e).length&&(void 0!==e.entries&&(t.push(e.entries),e.content_type&&(t.schema=e.content_type)),void 0!==e.assets&&t.push(e.assets),void 0===e.content_type&&void 0===e.schema||t.push(e.content_type||e.schema),void 0!==e.count&&t.push(e.count),void 0!==e.entry&&(t=e.entry,e.schema&&(t.schema=e.schema),e.content_type&&(t.content_type=e.content_type)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}async function d(e,t,r,i,s){var u=r.live_preview,a=r.requestParams,c=u.content_type_uid,l=u.management_token;await async function e(t,s,f){if(void 0!==s)if(Array.isArray(s))await Promise.all(s.map((function(r,n){return e(t,r,(function(e){s[n]=e}))})));else if(s._content_type_uid===c)try{r.requestParams=JSON.parse(JSON.stringify(a));var h=function(e){var t=[];return function e(r,i){0===Object.keys(r).length?t.push(i.substring(1)):Object.entries(r).forEach((function(t){var r=n(t,2),o=r[0];e(r[1],[i,o].join("."))}))}(e,""),t.filter((function(e){return""!==e}))}(t);r.requestParams.body.include=h,r.requestParams.body.live_preview=u.live_preview,r.requestParams.body.content_type_uid=c;var y=u.host.match(/^((http[s]?):(\/\/)?)?(.+)$/),d=(y[1]||"https://")+y[4],p=s.uid,v=d+"/v3/content_types/"+s._content_type_uid+"/entries/"+p;r.requestParams.url=v,r.requestParams.method="GET",delete r.requestParams.headers.access_token,r.requestParams.headers.authorization=l;var _=await(0,o.default)(r,i);_.entry._content_type_uid=c,_.entry.uid=p,f(_.entry)}catch(e){console.log("errror",e)}else await Promise.all(Object.entries(t).map((async function(t){var r=n(t,2),i=r[0],o=r[1];await e(o,s[i],(function(){}))})))}(e,t,(function(){}))}Promise.prototype.spread||(Promise.prototype.spread=function(e,t){return t=t||function(e){},this.then((function(t){return e.apply(e,t)})).catch((function(e){t(e)}))})},173:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),o=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=i.transform("only"),this}return n(e,[{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&"string"==typeof e&&t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide a valid parameters.")}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"fetch",value:function(e){if(this.asset_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.assets+this.asset_uid,body:{_method:"GET",query:this._query}};var t=i.mergeDeep(this.fetchOptions,e);return i.sendRequest(i.mergeDeep({},this),t)}e.debug&&e.logHandler("error","Kindly provide an asset uid. e.g. .Assets('asset_uid')")}}]),e}();t.default=o},304:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=o.transform("only"),this.except=o.transform("except"),this}return i(e,[{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":n(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"includeReference",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Array.isArray(t)||"string"==typeof t){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}this.fetchOptions.debug&&this.fetchOptions.logHandler("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;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("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:"includeBranch",value:function(){return this._query.include_branch=!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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"fetch",value:function(e){var t=this.config.host+":"+this.config.port;if(this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host),this.entry_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+t+"/"+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=o.mergeDeep(this.fetchOptions,e);return o.sendRequest(o.mergeDeep({},this),r)}this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide an entry uid. e.g. .Entry('asset_uid')")}}]),e}();t.default=s},566:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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},s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=(n=r(304))&&n.__esModule?n:{default:n},a={compare:function(e){return function(t,r){if(t&&r&&"string"==typeof t&&void 0!==r)return this._query.query[t]=this._query.query.file_size||{},this._query.query[t][e]=r,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},contained:function(e){var t=e?"$in":"$nin";return function(e,r){if(e&&r&&"string"==typeof e&&Array.isArray(r))return this._query.query[e]=this._query.query[e]||{},this._query.query[e][t]=this._query.query[e][t]||[],this._query.query[e][t]=this._query.query[e][t].concat(r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},exists:function(e){return function(t){if(t&&"string"==typeof t)return this._query.query[t]=this._query.query[t]||{},this._query.query[t].$exists=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},logical:function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof c&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===o(arguments[r])&&t.push(arguments[r]);return this._query.query[e]?this._query.query[e]=this._query.query[e].concat(t):this._query.query[e]=t,this}},sort:function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a string.")}},pagination:function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a number.")}}},c=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=a.compare("$lt"),e.lessThanOrEqualTo=a.compare("$lte"),e.greaterThan=a.compare("$gt"),e.greaterThanOrEqualTo=a.compare("$gte"),e.notEqualTo=a.compare("$ne"),e.containedIn=a.contained(!0),e.notContainedIn=a.contained(!1),e.exists=a.exists(!0),e.notExists=a.exists(!1),e.ascending=a.sort("asc"),e.descending=a.sort("desc"),e.beforeUid=a.sort("before_uid"),e.afterUid=a.sort("after_uid"),e.skip=a.pagination("skip"),e.limit=a.pagination("limit"),e.or=a.logical("$or"),e.and=a.logical("$and"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"equalTo",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=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:t,body:{_method:"GET",query:this._query}},this}},{key:"query",value:function(e){if("object"===(void 0===e?"undefined":o(e)))return this._query.query=s.mergeDeep(this._query.query,e),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters")}},{key:"referenceIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$in_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$in_query=r),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,r){var n={};return r instanceof t&&r._query.query?n.$nin_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$nin_query=r),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;this.fetchOptions.debug&&this.fetchOptions.logHandler("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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"getQuery",value:function(){return this._query.query||{}}},{key:"regex",value:function(e,t,r){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query.query[e]={$regex:t},r&&(this._query.query[e].$options=r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"find",value:function(e){var t=this.config.host+":"+this.config.port;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host);var r=this.config.protocol+"://"+t+"/"+this.config.version,n=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:n,body:{_method:"GET",query:this._query}};var i=s.mergeDeep(this.fetchOptions,e);return s.sendRequest(s.mergeDeep({},this),i)}},{key:"findOne",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(e=this.config.protocol+"://"+this.live_preview.host+"/"+this.config.version);var t=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:t,body:{_method:"GET",query:this._query}};var r=s.mergeDeep({},this.fetchOptions);return s.sendRequest(s.mergeDeep({},this),r)}}]),t}(u.default);t.default=c},324:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),o=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t&&(this.object=function(){return t}),this}return n(e,[{key:"toJSON",value:function(){return this.object()?i.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null}},{key:"get",value:function(e){if(this.object()&&e)return e.split(".").reduce((function(e,t){return e[t]}),this.object())}},{key:"getDownloadUrl",value:function(e){if(this.object()){var t=this.object().url?this.object().url:null;return t?t+"?disposition="+(e&&"string"==typeof e?e:"attachment"):null}}}]),e}();e.exports=function(e){return new o(e)}},533:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=h(r(971)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=h(r(304)),a=h(r(173)),c=h(r(566)),l=h(r(777)),f=h(r(900));function h(e){return e&&e.__esModule?e:{default:e}}var y=[408,429],d=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!y.includes(e.status)},debug:!1,logHandler:function(e,t){"error"===e&&t?console.error("[error] "+t):"warning"===e&&t?console.warn("[warning] "+t):"info"===e&&t&&console.info("[info] "+t)}},this.config=s.mergeDeep({},o.default),this.plugins=[];for(var r=arguments.length,i=Array(r),u=0;u<r;u++)i[u]=arguments[u];switch(i[0].region&&void 0!==i[0].region&&"us"!==i[0].region&&(this.config.host=i[0].region+"-cdn.contentstack.com"),i[0].fetchOptions&&void 0!==i[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[0].fetchOptions)),i[0].plugins&&void 0!==i[0].plugins&&i[0].plugins.forEach((function(e){t.plugins.push(e)})),this.cachePolicy=f.default.policies.IGNORE_CACHE,this.provider=f.default.providers("localstorage"),i.length){case 1:if("object"===n(i[0])&&"string"==typeof i[0].api_key&&"string"==typeof i[0].delivery_token&&"string"==typeof i[0].environment)return this.headers={api_key:i[0].api_key,access_token:i[0].delivery_token},"object"==n(i[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,i[0].live_preview)),"string"==typeof i[0].branch&&void 0!==i[0].branch&&(this.headers.branch=i[0].branch),this.environment=i[0].environment,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2])return this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2],this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters.");case 4:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),this;case 5:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),i[4]&&"object"===n(i[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[4])),this;default:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return i(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview||"init",this.live_preview.content_type_uid=e.content_type_uid,this.live_preview.entry_uid=e.entry_uid)}},{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 t=new u.default;return e&&"string"==typeof e&&(t.entry_uid=e),s.merge(t,this)}},{key:"fetch",value:function(e){this.requestParams={method:"POST",headers:this.headers,plugins:this.plugins,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}};var t=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(this,t)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new a.default;return t.asset_uid=e,s.merge(t,this)}return this}},{key:"Query",value:function(){var e=new c.default;return s.merge(e,this)}},{key:"getLastActivities",value:function(){return 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,body:{_method:"GET",only_last_activity:!0,environment:this.environment}},(0,l.default)(this,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(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,body:{_method:"GET",environment:this.environment}},e)for(var t in e)this.requestParams.body[t]=e[t];return(0,l.default)(this,this.fetchOptions)}},{key:"sync",value:function(e,t){this._query={},this._query=s.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 r=s.mergeDeep(this.fetchOptions,t);return s.sendRequest(s.mergeDeep({},this),r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":n(t))&&void 0===t.length){var r=[];for(var i in t)r.push(i+"="+t[i]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=d},970:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=fetch},387:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(118))&&n.__esModule?n:{default:n};t.default=i.default},464:e=>{e.exports=require("@contentstack/utils")},118:e=>{e.exports=require("localStorage")}},t={},r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}(32);module.exports=r})(); |
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var e={971:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.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/"},live_preview:{enable:!1,host:"api.contentstack.io"}}},900:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(128))&&n.__esModule?n:{default:n},o={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}};t.default=o},128:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(821)),i={};function o(e,t){!t&&e&&e.length&&e.push("");var r=void 0,i=n.getKeys(),o=n.getStorage();if(e&&e.length){r=e.join(".");for(var s=0,u=i.length;s<u;s++)i[s]&&0===i[s].indexOf(r)&&delete o[i[s]]}else for(var a=0,c=i.length;a<c;a++)delete o[i[a]]}i.get=function(e,t){try{t(null,n.get(e))}catch(e){t(e)}},i.set=function(e,t,r){try{e&&t&&n.set(e,t),r()}catch(e){r(e)}},i.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var e=Array.prototype.slice.call(arguments),t=e.splice(-1,1).pop(),r=[];r.push.apply(r,e),o(r),t()}}catch(e){callback(e)}},i.clearByQuery=function(e,t){try{for(var r=n.getKeys(),i=n.getStorage(),o=0,s=r.length;o<s;o++)r[o]&&~r[o].indexOf(e)&&delete i[r[o]];t()}catch(e){t(e)}},i.clearAll=function(e){try{o(),e()}catch(t){e(t)}},t.default=i},821:(e,t,r)=>{Object.defineProperty(t,"__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};t.get=function(e){var t=o.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null},t.set=function(e,t){try{"object"===(void 0===t?"undefined":n(t))?o.default.setItem(e,JSON.stringify(t)):o.default.setItem(e,t)}catch(e){}},t.getStorage=function(){return o.default||null},t.getKeys=function(){return o.default?Object.keys(o.default):[]};var i,o=(i=r(895))&&i.__esModule?i:{default:i}},32:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=u(r(533)),o=u(r(900)),s=u(r(764));function u(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.CachePolicy=o.default.policies,this.Region=s.default,this.Utils=r(464)}return n(e,[{key:"Stack",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(i.default,[null].concat(t)))}}]),e}();e.exports=new a},764:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={EU:"eu",US:"us",AZURE_NA:"azure-na"}},777:(e,t,r)=>{Object.defineProperty(t,"__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};t.default=function(e,t){var r=e.requestParams;return new Promise((function(i,o){var s=void 0;return r.headers["Content-Type"]="application/json; charset=UTF-8",r.headers["X-User-Agent"]="contentstack-nodejs/3.16.0",r.body&&"object"===n(r.body)&&(delete r.body._method,"object"===n(r.body.query)&&0===Object.keys(r.body.query).length&&delete r.body.query,s=function e(t,r){var i=[];if("object"===(void 0===t?"undefined":n(t))&&void 0!==t.length)for(var o=0,s=t.length;o<s;o++)i.push(r+"[]="+t[o]);else for(var u in t){var a=r?r+"["+u+"]":u,c=t[u];i.push(null!==c&&"object"===(void 0===c?"undefined":n(c))&&"query"!==u?e(c,a):a+"="+encodeURIComponent("query"!==u?c:JSON.stringify(c)))}return i.join("&")}(r.body)),a(e,s,t,i,o,t.retryDelay,t.retryLimit)}))};var i,o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=(i=r(289))&&i.__esModule?i:{default:i};function u(e){return new Promise((function(t){setTimeout(t,e)}))}function a(e,t,r,n,i){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:300,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:5,f=e.requestParams,h=f.url+"?"+t,y=f.headers,d=o.mergeDeep({method:"GET",headers:y,timeout:3e4},r);function p(o){if(0===l)r.debug&&r.logHandler("error",o),i(o);else{var s=c;l-=1;var f=r.retryLimit-l;r.retryDelayOptions&&(r.retryDelayOptions.base?s=r.retryDelayOptions.base*f:r.retryDelayOptions.customBackoff&&(s=r.retryDelayOptions.customBackoff(f,o))),u(s).then((function(){return a(e,t,r,n,i,c,l)})).catch((function(){return a(e,t,r,n,i,c,l)}))}}r.debug&&r.logHandler("info",{url:h,option:d});var v={url:h,option:d},_=e.plugins;if(_&&void 0!==_)for(var g=0;g<_.length;g++)"function"==typeof _[g].onRequest&&(v=_[g].onRequest(e,v));(0,s.default)(v.url,v.option).then((function(t){r.debug&&r.logHandler("info",t);var o=t.json();t.ok&&200===t.status?o.then((function(r){for(var i=0;i<_.length&&"function"==typeof _[i].onResponse;i++)r=_[i].onResponse(e,v,t,r);n(r)})):o.then((function(e){r.retryCondition&&r.retryCondition(t)?p(e):(r.debug&&r.logHandler("error",e),i(e))})).catch((function(){r.debug&&r.logHandler("error",{status:t.status,statusText:t.statusText}),i({status:t.status,statusText:t.statusText})}))})).catch((function(e){r.debug&&r.logHandler("error",e),i(e)}))}},540:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.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 t=this._query[e].BASE||[];return t=t.concat(arguments[0]),this._query[e].BASE=t,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var r=this._query[e][arguments[0]]||[];return r=r.concat(arguments[1]),this._query[e][arguments[0]]=r,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}},t._type=function(e){var t=void 0===e?"undefined":i(e);return"object"===t&&Array.isArray(e)&&(t="array"),t},t.mergeDeep=function(e,t){var r=this;return function e(t,n){for(var i in n)"object"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?e(t[i],n[i]):"array"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?t[i]=t[i].concat(n[i]):t[i]=n[i]}(e,t),e},t.merge=a,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===("undefined"==typeof process?"undefined":i(process))&&"browser"===process.title},t.parseQueryFromParams=c,t.getHash=l,t.generateHash=f,t.resultWrapper=h,t.spreadResult=y,t.sendRequest=function(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:(e._query||(e._query={}),e._query.environment=e.environment);var n=e,s=void 0!==n.queryCachePolicy?n.queryCachePolicy:n.cachePolicy,u=void 0!==n.tojson&&n.tojson,f=!!(n.entry_uid||n.singleEntry||n.asset_uid),p=l(c(n,f,u));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var v=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===v?"undefined":i(v))&&(v=JSON.parse(v)),delete e.requestParams.body.query,e.requestParams.body=a(e.requestParams.body,v),e.live_preview&&!0===e.live_preview.enable&&e.live_preview.live_preview&&"init"!==e.live_preview.live_preview&&(e.live_preview.content_type_uid===e.content_type_uid?(e.requestParams.body=a(e.requestParams.body,{live_preview:e.live_preview.live_preview||"init"}),s=2,e.requestParams.body.environment&&delete e.requestParams.body.environment,e.requestParams.headers.access_token&&delete e.requestParams.headers.access_token,e.requestParams.headers.authorization=e.live_preview.management_token):e.live_preview.live_preview&&(s=1))}var _=function(){return function(e,t){return new Promise((function(r,n){try{e&&n(e),u||(t=h(t)),r(y(t))}catch(e){n(e)}}))}},g=function(r,i,a){r&&(0,o.default)(e,t).then(function(t){try{n.entry_uid=n.asset_uid=n.tojson=n.queryCachePolicy=void 0;var r={},o={};if(e.singleEntry)if(e.singleEntry=!1,t.schema&&(r.schema=t.schema),t.content_type&&(r.content_type=t.content_type,delete r.schema),t.entries&&t.entries.length)r.entry=t.entries[0];else{if(!t.assets||!t.assets.length)return 2===s&&null!==n.provider?void n.provider.get(p,_()):a({error_code:141,error_message:"The requested entry doesn't exist."});r.assets=t.assets[0]}else t.items?o={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==n.provider?(n.provider.set(p,r,(function(e){try{return e&&a(e),u||(r=h(r)),i(y(r))}catch(e){return a(e)}})),i(y(r))):Object.keys(o).length?i(o):(u||(r=h(r)),i(y(r)))}catch(e){return a({message:e.message})}}.bind(n)).catch((function(e){if(2!==s||null===n.provider)return a(e);n.provider.get(p,_())}))};switch(s){case 1:return new Promise((async function(r,i){null!==n.provider?await n.provider.get(p,(async function(o,s){try{if(o||!s)g(!0,r,i);else{var a=JSON.parse(JSON.stringify(s));try{if(e._query&&Array.isArray(e._query.include)&&e._query.include.length>0){var c=(l=e._query.include,v={},l.forEach((function(e){!function(e){var t=(e=e.replace(/[\[]/gm,".").replace(/[\]]/gm,"")).split("."),r=t.pop();t.reduce((function(e,t){return e[t]=e[t]||{}}),v)[r]={}}(e)})),v);f?await d(c,s.entry,e,t):await Promise.all(s.entries.map((async function(r){await d(c,r,e,t)})))}}catch(e){}await n.provider.set(p,a,(function(e){try{return e&&i(e),u||(s=h(s)),r(y(s))}catch(e){return i(e)}}))}}catch(e){return i(e)}var l,v})):g(!0,r,i)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){g(!0,e,t)}))}if(3===s)return new Promise((function(e,t){null!==n.provider&&n.provider.get(p,(function(r,n){try{r||!n?t(r):(u||(n=h(n)),e(y(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){g(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){g(!0,e,t)}))}))};var o=u(r(777)),s=u(r(324));function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function c(e,t,r){if(e&&e.requestParams){var n=a({},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:t||"false",toJSON:r||"false",api_key:e.requestParams.headers?e.requestParams.headers.api_key:""}}}function l(e){try{var t=f(JSON.stringify(e)),r=[];return r.push(e.content_type_uid),r.push(e.locale),e.entry_uid&&r.push(e.entry_uid),e.asset_uid&&r.push(e.asset_uid),r.push(t),r.join(".")}catch(e){}}function f(e){var t,r=0,n=void 0;if(0===e.length)return r;for(n=0,t=e.length;n<t;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return r<-1?-1*r:r}function h(e){if(e&&void 0!==e.entries)if(e.entries&&e.entries.length)for(var t=0,r=e.entries.length;t<r;t++)e.entries[t]=(0,s.default)(e.entries[t]);else e.entries=[];else if(e&&e.assets&&void 0!==e.assets)if(e.assets&&e.assets.length)for(var n=0,i=e.assets.length;n<i;n++)e.assets[n]=(0,s.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,s.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,s.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,s.default)(e.items).toJSON());return e}function y(e){var t=[];return e&&Object.keys(e).length&&(void 0!==e.entries&&(t.push(e.entries),e.content_type&&(t.schema=e.content_type)),void 0!==e.assets&&t.push(e.assets),void 0===e.content_type&&void 0===e.schema||t.push(e.content_type||e.schema),void 0!==e.count&&t.push(e.count),void 0!==e.entry&&(t=e.entry,e.schema&&(t.schema=e.schema),e.content_type&&(t.content_type=e.content_type)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}async function d(e,t,r,i,s){var u=r.live_preview,a=r.requestParams,c=u.content_type_uid,l=u.management_token;await async function e(t,s,f){if(void 0!==s)if(Array.isArray(s))await Promise.all(s.map((function(r,n){return e(t,r,(function(e){s[n]=e}))})));else if(s._content_type_uid===c)try{r.requestParams=JSON.parse(JSON.stringify(a));var h=function(e){var t=[];return function e(r,i){0===Object.keys(r).length?t.push(i.substring(1)):Object.entries(r).forEach((function(t){var r=n(t,2),o=r[0];e(r[1],[i,o].join("."))}))}(e,""),t.filter((function(e){return""!==e}))}(t);r.requestParams.body.include=h,r.requestParams.body.live_preview=u.live_preview,r.requestParams.body.content_type_uid=c;var y=u.host.match(/^((http[s]?):(\/\/)?)?(.+)$/),d=(y[1]||"https://")+y[4],p=s.uid,v=d+"/v3/content_types/"+s._content_type_uid+"/entries/"+p;r.requestParams.url=v,r.requestParams.method="GET",delete r.requestParams.headers.access_token,r.requestParams.headers.authorization=l;var _=await(0,o.default)(r,i);_.entry._content_type_uid=c,_.entry.uid=p,f(_.entry)}catch(e){console.log("errror",e)}else await Promise.all(Object.entries(t).map((async function(t){var r=n(t,2),i=r[0],o=r[1];await e(o,s[i],(function(){}))})))}(e,t,(function(){}))}Promise.prototype.spread||(Promise.prototype.spread=function(e,t){return t=t||function(e){},this.then((function(t){return e.apply(e,t)})).catch((function(e){t(e)}))})},173:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),o=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=i.transform("only"),this}return n(e,[{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&"string"==typeof e&&t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide a valid parameters.")}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"fetch",value:function(e){if(this.asset_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.assets+this.asset_uid,body:{_method:"GET",query:this._query}};var t=i.mergeDeep(this.fetchOptions,e);return i.sendRequest(i.mergeDeep({},this),t)}e.debug&&e.logHandler("error","Kindly provide an asset uid. e.g. .Assets('asset_uid')")}}]),e}();t.default=o},304:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=o.transform("only"),this.except=o.transform("except"),this}return i(e,[{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":n(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"includeReference",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Array.isArray(t)||"string"==typeof t){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}this.fetchOptions.debug&&this.fetchOptions.logHandler("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;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("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:"includeBranch",value:function(){return this._query.include_branch=!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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"fetch",value:function(e){var t=this.config.host+":"+this.config.port;if(this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host),this.entry_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+t+"/"+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=o.mergeDeep(this.fetchOptions,e);return o.sendRequest(o.mergeDeep({},this),r)}this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide an entry uid. e.g. .Entry('asset_uid')")}}]),e}();t.default=s},566:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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},s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=(n=r(304))&&n.__esModule?n:{default:n},a=function(e){return function(t,r){if(t&&r&&"string"==typeof t&&void 0!==r)return this._query.query[t]=this._query.query.file_size||{},this._query.query[t][e]=r,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},c=function(e){var t=e?"$in":"$nin";return function(e,r){if(e&&r&&"string"==typeof e&&Array.isArray(r))return this._query.query[e]=this._query.query[e]||{},this._query.query[e][t]=this._query.query[e][t]||[],this._query.query[e][t]=this._query.query[e][t].concat(r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},l=function(e){return function(t){if(t&&"string"==typeof t)return this._query.query[t]=this._query.query[t]||{},this._query.query[t].$exists=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},f=function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof d&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===o(arguments[r])&&t.push(arguments[r]);return this._query.query[e]?this._query.query[e]=this._query.query[e].concat(t):this._query.query[e]=t,this}},h=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a string.")}},y=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a number.")}},d=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=a("$lt"),e.lessThanOrEqualTo=a("$lte"),e.greaterThan=a("$gt"),e.greaterThanOrEqualTo=a("$gte"),e.notEqualTo=a("$ne"),e.containedIn=c(!0),e.notContainedIn=c(!1),e.exists=l(!0),e.notExists=l(!1),e.ascending=h("asc"),e.descending=h("desc"),e.beforeUid=h("before_uid"),e.afterUid=h("after_uid"),e.skip=y("skip"),e.limit=y("limit"),e.or=f("$or"),e.and=f("$and"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"equalTo",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=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:t,body:{_method:"GET",query:this._query}},this}},{key:"query",value:function(e){if("object"===(void 0===e?"undefined":o(e)))return this._query.query=s.mergeDeep(this._query.query,e),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters")}},{key:"referenceIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$in_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$in_query=r),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,r){var n={};return r instanceof t&&r._query.query?n.$nin_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$nin_query=r),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;this.fetchOptions.debug&&this.fetchOptions.logHandler("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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"getQuery",value:function(){return this._query.query||{}}},{key:"regex",value:function(e,t,r){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query.query[e]={$regex:t},r&&(this._query.query[e].$options=r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"find",value:function(e){var t=this.config.host+":"+this.config.port;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host);var r=this.config.protocol+"://"+t+"/"+this.config.version,n=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:n,body:{_method:"GET",query:this._query}};var i=s.mergeDeep(this.fetchOptions,e);return s.sendRequest(s.mergeDeep({},this),i)}},{key:"findOne",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(e=this.config.protocol+"://"+this.live_preview.host+"/"+this.config.version);var t=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:t,body:{_method:"GET",query:this._query}};var r=s.mergeDeep({},this.fetchOptions);return s.sendRequest(s.mergeDeep({},this),r)}}]),t}(u.default);t.default=d},324:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),o=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t&&(this.object=function(){return t}),this}return n(e,[{key:"toJSON",value:function(){return this.object()?i.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null}},{key:"get",value:function(e){if(this.object()&&e)return e.split(".").reduce((function(e,t){return e[t]}),this.object())}},{key:"getDownloadUrl",value:function(e){if(this.object()){var t=this.object().url?this.object().url:null;return t?t+"?disposition="+(e&&"string"==typeof e?e:"attachment"):null}}}]),e}();e.exports=function(e){return new o(e)}},533:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=h(r(971)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=h(r(304)),a=h(r(173)),c=h(r(566)),l=h(r(777)),f=h(r(900));function h(e){return e&&e.__esModule?e:{default:e}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=[408,429],p=function(){function e(){var t=this;y(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!d.includes(e.status)},debug:!1,logHandler:function(e,t){"error"===e&&t?console.error("[error] "+t):"warning"===e&&t?console.warn("[warning] "+t):"info"===e&&t&&console.info("[info] "+t)}},this.config=s.mergeDeep({},o.default),this.plugins=[];for(var r=arguments.length,i=Array(r),u=0;u<r;u++)i[u]=arguments[u];switch(i[0].region&&void 0!==i[0].region&&"us"!==i[0].region&&(this.config.host=i[0].region+"-cdn.contentstack.com"),i[0].fetchOptions&&void 0!==i[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[0].fetchOptions)),i[0].plugins&&void 0!==i[0].plugins&&i[0].plugins.forEach((function(e){t.plugins.push(e)})),this.cachePolicy=f.default.policies.IGNORE_CACHE,this.provider=f.default.providers("localstorage"),i.length){case 1:if("object"===n(i[0])&&"string"==typeof i[0].api_key&&"string"==typeof i[0].delivery_token&&"string"==typeof i[0].environment)return this.headers={api_key:i[0].api_key,access_token:i[0].delivery_token},"object"==n(i[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,i[0].live_preview)),"string"==typeof i[0].branch&&void 0!==i[0].branch&&(this.headers.branch=i[0].branch),this.environment=i[0].environment,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2])return this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2],this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters.");case 4:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),this;case 5:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),i[4]&&"object"===n(i[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[4])),this;default:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return i(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview||"init",this.live_preview.content_type_uid=e.content_type_uid,this.live_preview.entry_uid=e.entry_uid)}},{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 t=new u.default;return e&&"string"==typeof e&&(t.entry_uid=e),s.merge(t,this)}},{key:"fetch",value:function(e){this.requestParams={method:"POST",headers:this.headers,plugins:this.plugins,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}};var t=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(this,t)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new a.default;return t.asset_uid=e,s.merge(t,this)}return this}},{key:"Query",value:function(){var e=new c.default;return s.merge(e,this)}},{key:"getLastActivities",value:function(){return 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,body:{_method:"GET",only_last_activity:!0,environment:this.environment}},(0,l.default)(this,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(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,body:{_method:"GET",environment:this.environment}},e)for(var t in e)this.requestParams.body[t]=e[t];return(0,l.default)(this,this.fetchOptions)}},{key:"sync",value:function(e,t){this._query={},this._query=s.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 r=s.mergeDeep(this.fetchOptions,t);return s.sendRequest(s.mergeDeep({},this),r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":n(t))&&void 0===t.length){var r=[];for(var i in t)r.push(i+"="+t[i]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=p},289:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(858)),i=o(r(809));function o(e){return e&&e.__esModule?e:{default:e}}n.default.polyfill(),t.default=i.default},895:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(118))&&n.__esModule?n:{default:n};t.default=i.default},464:e=>{e.exports=require("@contentstack/utils")},858:e=>{e.exports=require("es6-promise")},118:e=>{e.exports=require("localStorage")},809:e=>{e.exports=require("node-fetch")}},t={},r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}(32);module.exports=r})(); | ||
(()=>{"use strict";var e={971:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.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/"},live_preview:{enable:!1,host:"api.contentstack.io"}}},900:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(128))&&n.__esModule?n:{default:n},o={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}};t.default=o},128:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(821)),i={};function o(e,t){!t&&e&&e.length&&e.push("");var r=void 0,i=n.getKeys(),o=n.getStorage();if(e&&e.length){r=e.join(".");for(var s=0,u=i.length;s<u;s++)i[s]&&0===i[s].indexOf(r)&&delete o[i[s]]}else for(var a=0,c=i.length;a<c;a++)delete o[i[a]]}i.get=function(e,t){try{t(null,n.get(e))}catch(e){t(e)}},i.set=function(e,t,r){try{e&&t&&n.set(e,t),r()}catch(e){r(e)}},i.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var e=Array.prototype.slice.call(arguments),t=e.splice(-1,1).pop(),r=[];r.push.apply(r,e),o(r),t()}}catch(e){callback(e)}},i.clearByQuery=function(e,t){try{for(var r=n.getKeys(),i=n.getStorage(),o=0,s=r.length;o<s;o++)r[o]&&~r[o].indexOf(e)&&delete i[r[o]];t()}catch(e){t(e)}},i.clearAll=function(e){try{o(),e()}catch(t){e(t)}},t.default=i},821:(e,t,r)=>{Object.defineProperty(t,"__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};t.get=function(e){var t=o.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null},t.set=function(e,t){try{"object"===(void 0===t?"undefined":n(t))?o.default.setItem(e,JSON.stringify(t)):o.default.setItem(e,t)}catch(e){}},t.getStorage=function(){return o.default||null},t.getKeys=function(){return o.default?Object.keys(o.default):[]};var i,o=(i=r(895))&&i.__esModule?i:{default:i}},32:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=u(r(533)),o=u(r(900)),s=u(r(764));function u(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.CachePolicy=o.default.policies,this.Region=s.default,this.Utils=r(464)}return n(e,[{key:"Stack",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(i.default,[null].concat(t)))}}]),e}();e.exports=new a},764:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={EU:"eu",US:"us",AZURE_NA:"azure-na"}},777:(e,t,r)=>{Object.defineProperty(t,"__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};t.default=function(e,t){var r=e.requestParams;return new Promise((function(i,o){var s=void 0;return r.headers["Content-Type"]="application/json; charset=UTF-8",r.headers["X-User-Agent"]="contentstack-nodejs/"+u,r.body&&"object"===n(r.body)&&(delete r.body._method,"object"===n(r.body.query)&&0===Object.keys(r.body.query).length&&delete r.body.query,s=function e(t,r){var i=[];if("object"===(void 0===t?"undefined":n(t))&&void 0!==t.length)for(var o=0,s=t.length;o<s;o++)i.push(r+"[]="+t[o]);else for(var u in t){var a=r?r+"["+u+"]":u,c=t[u];i.push(null!==c&&"object"===(void 0===c?"undefined":n(c))&&"query"!==u?e(c,a):a+"="+encodeURIComponent("query"!==u?c:JSON.stringify(c)))}return i.join("&")}(r.body)),a(e,s,t,i,o,t.retryDelay,t.retryLimit)}))};var i,o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=(i=r(289))&&i.__esModule?i:{default:i},u="3.16.1";function a(e,t,r,n,i){var u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:300,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:5,l=e.requestParams,f=l.url+"?"+t,h=l.headers,y=o.mergeDeep({method:"GET",headers:h,timeout:3e4},r);r.debug&&r.logHandler("info",{url:f,option:y});var d={url:f,option:y},p=e.plugins;if(p&&void 0!==p)for(var v=0;v<p.length;v++)"function"==typeof p[v].onRequest&&(d=p[v].onRequest(e,d));(0,s.default)(d.url,d.option).then((function(o){r.debug&&r.logHandler("info",o);var s=o.json();o.ok&&200===o.status?s.then((function(t){for(var r=0;r<p.length&&"function"==typeof p[r].onResponse;r++)t=p[r].onResponse(e,d,o,t);n(t)})):s.then((function(s){r.retryCondition&&r.retryCondition(o)?function(o){if(0===c)r.debug&&r.logHandler("error",o),i(o);else{var s=u;c-=1;var l=r.retryLimit-c;r.retryDelayOptions&&(r.retryDelayOptions.base?s=r.retryDelayOptions.base*l:r.retryDelayOptions.customBackoff&&(s=r.retryDelayOptions.customBackoff(l,o))),function(e){return new Promise((function(t){setTimeout(t,e)}))}(s).then((function(){return a(e,t,r,n,i,u,c)})).catch((function(){return a(e,t,r,n,i,u,c)}))}}(s):(r.debug&&r.logHandler("error",s),i(s))})).catch((function(){r.debug&&r.logHandler("error",{status:o.status,statusText:o.statusText}),i({status:o.status,statusText:o.statusText})}))})).catch((function(e){r.debug&&r.logHandler("error",e),i(e)}))}},540:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.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 t=this._query[e].BASE||[];return t=t.concat(arguments[0]),this._query[e].BASE=t,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var r=this._query[e][arguments[0]]||[];return r=r.concat(arguments[1]),this._query[e][arguments[0]]=r,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}},t._type=function(e){var t=void 0===e?"undefined":i(e);return"object"===t&&Array.isArray(e)&&(t="array"),t},t.mergeDeep=function(e,t){var r=this;return function e(t,n){for(var i in n)"object"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?e(t[i],n[i]):"array"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?t[i]=t[i].concat(n[i]):t[i]=n[i]}(e,t),e},t.merge=a,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===("undefined"==typeof process?"undefined":i(process))&&"browser"===process.title},t.parseQueryFromParams=c,t.getHash=l,t.generateHash=f,t.resultWrapper=h,t.spreadResult=y,t.sendRequest=function(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:(e._query||(e._query={}),e._query.environment=e.environment);var n=e,s=void 0!==n.queryCachePolicy?n.queryCachePolicy:n.cachePolicy,u=void 0!==n.tojson&&n.tojson,f=!!(n.entry_uid||n.singleEntry||n.asset_uid),p=l(c(n,f,u));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var v=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===v?"undefined":i(v))&&(v=JSON.parse(v)),delete e.requestParams.body.query,e.requestParams.body=a(e.requestParams.body,v),e.live_preview&&!0===e.live_preview.enable&&e.live_preview.live_preview&&"init"!==e.live_preview.live_preview&&(e.live_preview.content_type_uid===e.content_type_uid?(e.requestParams.body=a(e.requestParams.body,{live_preview:e.live_preview.live_preview||"init"}),s=2,e.requestParams.body.environment&&delete e.requestParams.body.environment,e.requestParams.headers.access_token&&delete e.requestParams.headers.access_token,e.requestParams.headers.authorization=e.live_preview.management_token):e.live_preview.live_preview&&(s=1))}var _=function(){return function(e,t){return new Promise((function(r,n){try{e&&n(e),u||(t=h(t)),r(y(t))}catch(e){n(e)}}))}},g=function(r,i,a){r&&(0,o.default)(e,t).then(function(t){try{n.entry_uid=n.asset_uid=n.tojson=n.queryCachePolicy=void 0;var r={},o={};if(e.singleEntry)if(e.singleEntry=!1,t.schema&&(r.schema=t.schema),t.content_type&&(r.content_type=t.content_type,delete r.schema),t.entries&&t.entries.length)r.entry=t.entries[0];else{if(!t.assets||!t.assets.length)return 2===s&&null!==n.provider?void n.provider.get(p,_()):a({error_code:141,error_message:"The requested entry doesn't exist."});r.assets=t.assets[0]}else t.items?o={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==n.provider?(n.provider.set(p,r,(function(e){try{return e&&a(e),u||(r=h(r)),i(y(r))}catch(e){return a(e)}})),i(y(r))):Object.keys(o).length?i(o):(u||(r=h(r)),i(y(r)))}catch(e){return a({message:e.message})}}.bind(n)).catch((function(e){if(2!==s||null===n.provider)return a(e);n.provider.get(p,_())}))};switch(s){case 1:return new Promise((async function(r,i){null!==n.provider?await n.provider.get(p,(async function(o,s){try{if(o||!s)g(!0,r,i);else{var a=JSON.parse(JSON.stringify(s));try{if(e._query&&Array.isArray(e._query.include)&&e._query.include.length>0){var c=(l=e._query.include,v={},l.forEach((function(e){!function(e){var t=(e=e.replace(/[\[]/gm,".").replace(/[\]]/gm,"")).split("."),r=t.pop();t.reduce((function(e,t){return e[t]=e[t]||{}}),v)[r]={}}(e)})),v);f?await d(c,s.entry,e,t):await Promise.all(s.entries.map((async function(r){await d(c,r,e,t)})))}}catch(e){}await n.provider.set(p,a,(function(e){try{return e&&i(e),u||(s=h(s)),r(y(s))}catch(e){return i(e)}}))}}catch(e){return i(e)}var l,v})):g(!0,r,i)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){g(!0,e,t)}))}if(3===s)return new Promise((function(e,t){null!==n.provider&&n.provider.get(p,(function(r,n){try{r||!n?t(r):(u||(n=h(n)),e(y(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){g(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){g(!0,e,t)}))}))};var o=u(r(777)),s=u(r(324));function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function c(e,t,r){if(e&&e.requestParams){var n=a({},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:t||"false",toJSON:r||"false",api_key:e.requestParams.headers?e.requestParams.headers.api_key:""}}}function l(e){try{var t=f(JSON.stringify(e)),r=[];return r.push(e.content_type_uid),r.push(e.locale),e.entry_uid&&r.push(e.entry_uid),e.asset_uid&&r.push(e.asset_uid),r.push(t),r.join(".")}catch(e){}}function f(e){var t,r=0,n=void 0;if(0===e.length)return r;for(n=0,t=e.length;n<t;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return r<-1?-1*r:r}function h(e){if(e&&void 0!==e.entries)if(e.entries&&e.entries.length)for(var t=0,r=e.entries.length;t<r;t++)e.entries[t]=(0,s.default)(e.entries[t]);else e.entries=[];else if(e&&e.assets&&void 0!==e.assets)if(e.assets&&e.assets.length)for(var n=0,i=e.assets.length;n<i;n++)e.assets[n]=(0,s.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,s.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,s.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,s.default)(e.items).toJSON());return e}function y(e){var t=[];return e&&Object.keys(e).length&&(void 0!==e.entries&&(t.push(e.entries),e.content_type&&(t.schema=e.content_type)),void 0!==e.assets&&t.push(e.assets),void 0===e.content_type&&void 0===e.schema||t.push(e.content_type||e.schema),void 0!==e.count&&t.push(e.count),void 0!==e.entry&&(t=e.entry,e.schema&&(t.schema=e.schema),e.content_type&&(t.content_type=e.content_type)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}async function d(e,t,r,i,s){var u=r.live_preview,a=r.requestParams,c=u.content_type_uid,l=u.management_token;await async function e(t,s,f){if(void 0!==s)if(Array.isArray(s))await Promise.all(s.map((function(r,n){return e(t,r,(function(e){s[n]=e}))})));else if(s._content_type_uid===c)try{r.requestParams=JSON.parse(JSON.stringify(a));var h=function(e){var t=[];return function e(r,i){0===Object.keys(r).length?t.push(i.substring(1)):Object.entries(r).forEach((function(t){var r=n(t,2),o=r[0];e(r[1],[i,o].join("."))}))}(e,""),t.filter((function(e){return""!==e}))}(t);r.requestParams.body.include=h,r.requestParams.body.live_preview=u.live_preview,r.requestParams.body.content_type_uid=c;var y=u.host.match(/^((http[s]?):(\/\/)?)?(.+)$/),d=(y[1]||"https://")+y[4],p=s.uid,v=d+"/v3/content_types/"+s._content_type_uid+"/entries/"+p;r.requestParams.url=v,r.requestParams.method="GET",delete r.requestParams.headers.access_token,r.requestParams.headers.authorization=l;var _=await(0,o.default)(r,i);_.entry._content_type_uid=c,_.entry.uid=p,f(_.entry)}catch(e){console.log("errror",e)}else await Promise.all(Object.entries(t).map((async function(t){var r=n(t,2),i=r[0],o=r[1];await e(o,s[i],(function(){}))})))}(e,t,(function(){}))}Promise.prototype.spread||(Promise.prototype.spread=function(e,t){return t=t||function(e){},this.then((function(t){return e.apply(e,t)})).catch((function(e){t(e)}))})},173:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),o=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=i.transform("only"),this}return n(e,[{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&"string"==typeof e&&t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide a valid parameters.")}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"fetch",value:function(e){if(this.asset_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.assets+this.asset_uid,body:{_method:"GET",query:this._query}};var t=i.mergeDeep(this.fetchOptions,e);return i.sendRequest(i.mergeDeep({},this),t)}e.debug&&e.logHandler("error","Kindly provide an asset uid. e.g. .Assets('asset_uid')")}}]),e}();t.default=o},304:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=o.transform("only"),this.except=o.transform("except"),this}return i(e,[{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":n(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"includeReference",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Array.isArray(t)||"string"==typeof t){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}this.fetchOptions.debug&&this.fetchOptions.logHandler("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;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("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:"includeBranch",value:function(){return this._query.include_branch=!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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"fetch",value:function(e){var t=this.config.host+":"+this.config.port;if(this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host),this.entry_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+t+"/"+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=o.mergeDeep(this.fetchOptions,e);return o.sendRequest(o.mergeDeep({},this),r)}this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide an entry uid. e.g. .Entry('asset_uid')")}}]),e}();t.default=s},566:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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},s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=(n=r(304))&&n.__esModule?n:{default:n},a={compare:function(e){return function(t,r){if(t&&r&&"string"==typeof t&&void 0!==r)return this._query.query[t]=this._query.query.file_size||{},this._query.query[t][e]=r,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},contained:function(e){var t=e?"$in":"$nin";return function(e,r){if(e&&r&&"string"==typeof e&&Array.isArray(r))return this._query.query[e]=this._query.query[e]||{},this._query.query[e][t]=this._query.query[e][t]||[],this._query.query[e][t]=this._query.query[e][t].concat(r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},exists:function(e){return function(t){if(t&&"string"==typeof t)return this._query.query[t]=this._query.query[t]||{},this._query.query[t].$exists=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},logical:function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof c&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===o(arguments[r])&&t.push(arguments[r]);return this._query.query[e]?this._query.query[e]=this._query.query[e].concat(t):this._query.query[e]=t,this}},sort:function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a string.")}},pagination:function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a number.")}}},c=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=a.compare("$lt"),e.lessThanOrEqualTo=a.compare("$lte"),e.greaterThan=a.compare("$gt"),e.greaterThanOrEqualTo=a.compare("$gte"),e.notEqualTo=a.compare("$ne"),e.containedIn=a.contained(!0),e.notContainedIn=a.contained(!1),e.exists=a.exists(!0),e.notExists=a.exists(!1),e.ascending=a.sort("asc"),e.descending=a.sort("desc"),e.beforeUid=a.sort("before_uid"),e.afterUid=a.sort("after_uid"),e.skip=a.pagination("skip"),e.limit=a.pagination("limit"),e.or=a.logical("$or"),e.and=a.logical("$and"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"equalTo",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=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:t,body:{_method:"GET",query:this._query}},this}},{key:"query",value:function(e){if("object"===(void 0===e?"undefined":o(e)))return this._query.query=s.mergeDeep(this._query.query,e),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters")}},{key:"referenceIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$in_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$in_query=r),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,r){var n={};return r instanceof t&&r._query.query?n.$nin_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$nin_query=r),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;this.fetchOptions.debug&&this.fetchOptions.logHandler("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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"getQuery",value:function(){return this._query.query||{}}},{key:"regex",value:function(e,t,r){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query.query[e]={$regex:t},r&&(this._query.query[e].$options=r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"find",value:function(e){var t=this.config.host+":"+this.config.port;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host);var r=this.config.protocol+"://"+t+"/"+this.config.version,n=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:n,body:{_method:"GET",query:this._query}};var i=s.mergeDeep(this.fetchOptions,e);return s.sendRequest(s.mergeDeep({},this),i)}},{key:"findOne",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(e=this.config.protocol+"://"+this.live_preview.host+"/"+this.config.version);var t=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:t,body:{_method:"GET",query:this._query}};var r=s.mergeDeep({},this.fetchOptions);return s.sendRequest(s.mergeDeep({},this),r)}}]),t}(u.default);t.default=c},324:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),o=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t&&(this.object=function(){return t}),this}return n(e,[{key:"toJSON",value:function(){return this.object()?i.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null}},{key:"get",value:function(e){if(this.object()&&e)return e.split(".").reduce((function(e,t){return e[t]}),this.object())}},{key:"getDownloadUrl",value:function(e){if(this.object()){var t=this.object().url?this.object().url:null;return t?t+"?disposition="+(e&&"string"==typeof e?e:"attachment"):null}}}]),e}();e.exports=function(e){return new o(e)}},533:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=h(r(971)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=h(r(304)),a=h(r(173)),c=h(r(566)),l=h(r(777)),f=h(r(900));function h(e){return e&&e.__esModule?e:{default:e}}var y=[408,429],d=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!y.includes(e.status)},debug:!1,logHandler:function(e,t){"error"===e&&t?console.error("[error] "+t):"warning"===e&&t?console.warn("[warning] "+t):"info"===e&&t&&console.info("[info] "+t)}},this.config=s.mergeDeep({},o.default),this.plugins=[];for(var r=arguments.length,i=Array(r),u=0;u<r;u++)i[u]=arguments[u];switch(i[0].region&&void 0!==i[0].region&&"us"!==i[0].region&&(this.config.host=i[0].region+"-cdn.contentstack.com"),i[0].fetchOptions&&void 0!==i[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[0].fetchOptions)),i[0].plugins&&void 0!==i[0].plugins&&i[0].plugins.forEach((function(e){t.plugins.push(e)})),this.cachePolicy=f.default.policies.IGNORE_CACHE,this.provider=f.default.providers("localstorage"),i.length){case 1:if("object"===n(i[0])&&"string"==typeof i[0].api_key&&"string"==typeof i[0].delivery_token&&"string"==typeof i[0].environment)return this.headers={api_key:i[0].api_key,access_token:i[0].delivery_token},"object"==n(i[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,i[0].live_preview)),"string"==typeof i[0].branch&&void 0!==i[0].branch&&(this.headers.branch=i[0].branch),this.environment=i[0].environment,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2])return this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2],this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters.");case 4:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),this;case 5:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),i[4]&&"object"===n(i[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[4])),this;default:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return i(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview||"init",this.live_preview.content_type_uid=e.content_type_uid,this.live_preview.entry_uid=e.entry_uid)}},{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 t=new u.default;return e&&"string"==typeof e&&(t.entry_uid=e),s.merge(t,this)}},{key:"fetch",value:function(e){this.requestParams={method:"POST",headers:this.headers,plugins:this.plugins,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}};var t=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(this,t)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new a.default;return t.asset_uid=e,s.merge(t,this)}return this}},{key:"Query",value:function(){var e=new c.default;return s.merge(e,this)}},{key:"getLastActivities",value:function(){return 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,body:{_method:"GET",only_last_activity:!0,environment:this.environment}},(0,l.default)(this,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(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,body:{_method:"GET",environment:this.environment}},e)for(var t in e)this.requestParams.body[t]=e[t];return(0,l.default)(this,this.fetchOptions)}},{key:"sync",value:function(e,t){this._query={},this._query=s.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 r=s.mergeDeep(this.fetchOptions,t);return s.sendRequest(s.mergeDeep({},this),r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":n(t))&&void 0===t.length){var r=[];for(var i in t)r.push(i+"="+t[i]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=d},289:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(858)),i=o(r(809));function o(e){return e&&e.__esModule?e:{default:e}}n.default.polyfill(),t.default=i.default},895:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=r(118))&&n.__esModule?n:{default:n};t.default=i.default},464:e=>{e.exports=require("@contentstack/utils")},858:e=>{e.exports=require("es6-promise")},118:e=>{e.exports=require("localStorage")},809:e=>{e.exports=require("node-fetch")}},t={},r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}(32);module.exports=r})(); |
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var e={971:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.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/"},live_preview:{enable:!1,host:"api.contentstack.io"}}},900:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=r(128),o=(n=i)&&n.__esModule?n:{default:n};var s={providers:function(e){if(e)return o.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}};t.default=s},128:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(821));var i={};function o(e,t){!t&&e&&e.length&&e.push("");var r=void 0,i=n.getKeys(),o=n.getStorage();if(e&&e.length){r=e.join(".");for(var s=0,u=i.length;s<u;s++)i[s]&&0===i[s].indexOf(r)&&delete o[i[s]]}else for(var a=0,c=i.length;a<c;a++)delete o[i[a]]}i.get=function(e,t){try{t(null,n.get(e))}catch(e){t(e)}},i.set=function(e,t,r){try{e&&t&&n.set(e,t),r()}catch(e){r(e)}},i.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var e=Array.prototype.slice.call(arguments),t=e.splice(-1,1).pop(),r=[];r.push.apply(r,e),o(r),t()}}catch(e){callback(e)}},i.clearByQuery=function(e,t){try{for(var r=n.getKeys(),i=n.getStorage(),o=0,s=r.length;o<s;o++)r[o]&&~r[o].indexOf(e)&&delete i[r[o]];t()}catch(e){t(e)}},i.clearAll=function(e){try{o(),e()}catch(t){e(t)}},t.default=i},821:(e,t,r)=>{Object.defineProperty(t,"__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};t.get=function(e){var t=s.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null},t.set=function(e,t){try{"object"===(void 0===t?"undefined":n(t))?s.default.setItem(e,JSON.stringify(t)):s.default.setItem(e,t)}catch(e){}},t.getStorage=function(){return s.default||null},t.getKeys=function(){return s.default?Object.keys(s.default):[]};var i,o=r(555),s=(i=o)&&i.__esModule?i:{default:i}},32:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=u(r(533)),o=u(r(900)),s=u(r(764));function u(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.CachePolicy=o.default.policies,this.Region=s.default,this.Utils=r(464)}return n(e,[{key:"Stack",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(i.default,[null].concat(t)))}}]),e}();e.exports=new a},764:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default={EU:"eu",US:"us",AZURE_NA:"azure-na"}},777:(e,t,r)=>{Object.defineProperty(t,"__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};t.default=function(e,t){var r=e.requestParams;return new Promise((function(i,o){var s=void 0;return r.headers["Content-Type"]="application/json; charset=UTF-8",r.headers["X-User-Agent"]="contentstack-react-native/3.16.0",r.body&&"object"===n(r.body)&&(delete r.body._method,"object"===n(r.body.query)&&0===Object.keys(r.body.query).length&&delete r.body.query,s=function e(t,r){var i=[];if("object"===(void 0===t?"undefined":n(t))&&void 0!==t.length)for(var o=0,s=t.length;o<s;o++)i.push(r+"[]="+t[o]);else for(var u in t){var a=r?r+"["+u+"]":u,c=t[u];i.push(null!==c&&"object"===(void 0===c?"undefined":n(c))&&"query"!==u?e(c,a):a+"="+encodeURIComponent("query"!==u?c:JSON.stringify(c)))}return i.join("&")}(r.body)),c(e,s,t,i,o,t.retryDelay,t.retryLimit)}))};var i,o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=r(420),u=(i=s)&&i.__esModule?i:{default:i};function a(e){return new Promise((function(t){setTimeout(t,e)}))}function c(e,t,r,n,i){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:300,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:5,f=e.requestParams,h=f.url+"?"+t,y=f.headers,d=o.mergeDeep({method:"GET",headers:y,timeout:3e4},r);function p(o){if(0===l)r.debug&&r.logHandler("error",o),i(o);else{var u=s;l-=1;var f=r.retryLimit-l;r.retryDelayOptions&&(r.retryDelayOptions.base?u=r.retryDelayOptions.base*f:r.retryDelayOptions.customBackoff&&(u=r.retryDelayOptions.customBackoff(f,o))),a(u).then((function(){return c(e,t,r,n,i,s,l)})).catch((function(){return c(e,t,r,n,i,s,l)}))}}r.debug&&r.logHandler("info",{url:h,option:d});var v={url:h,option:d},_=e.plugins;if(_&&void 0!==_)for(var g=0;g<_.length;g++)"function"==typeof _[g].onRequest&&(v=_[g].onRequest(e,v));(0,u.default)(v.url,v.option).then((function(t){r.debug&&r.logHandler("info",t);var o=t.json();t.ok&&200===t.status?o.then((function(r){for(var i=0;i<_.length&&"function"==typeof _[i].onResponse;i++)r=_[i].onResponse(e,v,t,r);n(r)})):o.then((function(e){r.retryCondition&&r.retryCondition(t)?p(e):(r.debug&&r.logHandler("error",e),i(e))})).catch((function(){r.debug&&r.logHandler("error",{status:t.status,statusText:t.statusText}),i({status:t.status,statusText:t.statusText})}))})).catch((function(e){r.debug&&r.logHandler("error",e),i(e)}))}},540:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.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 t=this._query[e].BASE||[];return t=t.concat(arguments[0]),this._query[e].BASE=t,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var r=this._query[e][arguments[0]]||[];return r=r.concat(arguments[1]),this._query[e][arguments[0]]=r,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}},t._type=function(e){var t=void 0===e?"undefined":i(e);"object"===t?(t,Array.isArray(e)&&(t="array")):t;return t},t.mergeDeep=function(e,t){var r=this;return function e(t,n){for(var i in n)"object"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?e(t[i],n[i]):"array"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?t[i]=t[i].concat(n[i]):t[i]=n[i]}(e,t),e},t.merge=a,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===("undefined"==typeof process?"undefined":i(process))&&"browser"===process.title},t.parseQueryFromParams=c,t.getHash=l,t.generateHash=f,t.resultWrapper=h,t.spreadResult=y,t.sendRequest=function(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:(e._query||(e._query={}),e._query.environment=e.environment);var n=e,s=void 0!==n.queryCachePolicy?n.queryCachePolicy:n.cachePolicy,u=void 0!==n.tojson&&n.tojson,f=!!(n.entry_uid||n.singleEntry||n.asset_uid),p=l(c(n,f,u));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var v=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===v?"undefined":i(v))&&(v=JSON.parse(v)),delete e.requestParams.body.query,e.requestParams.body=a(e.requestParams.body,v),e.live_preview&&!0===e.live_preview.enable&&e.live_preview.live_preview&&"init"!==e.live_preview.live_preview&&(e.live_preview.content_type_uid===e.content_type_uid?(e.requestParams.body=a(e.requestParams.body,{live_preview:e.live_preview.live_preview||"init"}),s=2,e.requestParams.body.environment&&delete e.requestParams.body.environment,e.requestParams.headers.access_token&&delete e.requestParams.headers.access_token,e.requestParams.headers.authorization=e.live_preview.management_token):e.live_preview.live_preview&&(s=1))}var _=function(){return function(e,t){return new Promise((function(r,n){try{e&&n(e),u||(t=h(t)),r(y(t))}catch(e){n(e)}}))}},g=function(r,i,a){r&&(0,o.default)(e,t).then(function(t){try{n.entry_uid=n.asset_uid=n.tojson=n.queryCachePolicy=void 0;var r={},o={};if(e.singleEntry)if(e.singleEntry=!1,t.schema&&(r.schema=t.schema),t.content_type&&(r.content_type=t.content_type,delete r.schema),t.entries&&t.entries.length)r.entry=t.entries[0];else{if(!t.assets||!t.assets.length)return 2===s&&null!==n.provider?void n.provider.get(p,_()):a({error_code:141,error_message:"The requested entry doesn't exist."});r.assets=t.assets[0]}else t.items?o={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==n.provider?(n.provider.set(p,r,(function(e){try{return e&&a(e),u||(r=h(r)),i(y(r))}catch(e){return a(e)}})),i(y(r))):Object.keys(o).length?i(o):(u||(r=h(r)),i(y(r)))}catch(e){return a({message:e.message})}}.bind(n)).catch((function(e){if(2!==s||null===n.provider)return a(e);n.provider.get(p,_())}))};switch(s){case 1:return new Promise((async function(r,i){null!==n.provider?await n.provider.get(p,(async function(o,s){try{if(o||!s)g(!0,r,i);else{var a=JSON.parse(JSON.stringify(s));try{if(e._query&&Array.isArray(e._query.include)&&e._query.include.length>0){var c=function(e){var t={};function r(e){var r=(e=e.replace(/[\[]/gm,".").replace(/[\]]/gm,"")).split("."),n=r.pop();r.reduce((function(e,t){return e[t]=e[t]||{}}),t)[n]={}}return e.forEach((function(e){r(e)})),t}(e._query.include);f?await d(c,s.entry,e,t):await Promise.all(s.entries.map((async function(r){await d(c,r,e,t)})))}}catch(e){}await n.provider.set(p,a,(function(e){try{return e&&i(e),u||(s=h(s)),r(y(s))}catch(e){return i(e)}}))}}catch(e){return i(e)}})):g(!0,r,i)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){g(!0,e,t)}))}if(3===s){return new Promise((function(e,t){null!==n.provider&&n.provider.get(p,(function(r,n){try{r||!n?t(r):(u||(n=h(n)),e(y(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){g(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){g(!0,e,t)}))}))}};var o=u(r(777)),s=u(r(324));function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function c(e,t,r){if(e&&e.requestParams){var n=a({},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:t||"false",toJSON:r||"false",api_key:e.requestParams.headers?e.requestParams.headers.api_key:""}}}function l(e){try{var t=f(JSON.stringify(e)),r=[];return r.push(e.content_type_uid),r.push(e.locale),e.entry_uid&&r.push(e.entry_uid),e.asset_uid&&r.push(e.asset_uid),r.push(t),r.join(".")}catch(e){}}function f(e){var t,r=0,n=void 0;if(0===e.length)return r;for(n=0,t=e.length;n<t;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return r<-1?-1*r:r}function h(e){if(e&&void 0!==e.entries)if(e.entries&&e.entries.length)for(var t=0,r=e.entries.length;t<r;t++)e.entries[t]=(0,s.default)(e.entries[t]);else e.entries=[];else if(e&&e.assets&&void 0!==e.assets)if(e.assets&&e.assets.length)for(var n=0,i=e.assets.length;n<i;n++)e.assets[n]=(0,s.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,s.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,s.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,s.default)(e.items).toJSON());return e}function y(e){var t=[];return e&&Object.keys(e).length&&(void 0!==e.entries&&(t.push(e.entries),e.content_type&&(t.schema=e.content_type)),void 0!==e.assets&&t.push(e.assets),void 0===e.content_type&&void 0===e.schema||t.push(e.content_type||e.schema),void 0!==e.count&&t.push(e.count),void 0!==e.entry&&(t=e.entry,e.schema&&(t.schema=e.schema),e.content_type&&(t.content_type=e.content_type)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}async function d(e,t,r,i,s){var u=r.live_preview,a=r.requestParams,c=u.content_type_uid,l=u.management_token;await async function e(t,s,f){if(void 0!==s)if(Array.isArray(s))await Promise.all(s.map((function(r,n){return e(t,r,(function(e){s[n]=e}))})));else if(s._content_type_uid===c)try{r.requestParams=JSON.parse(JSON.stringify(a));var h=function(e){var t=[];function r(e,i){0===Object.keys(e).length?t.push(i.substring(1)):Object.entries(e).forEach((function(e){var t=n(e,2),o=t[0];r(t[1],[i,o].join("."))}))}return r(e,""),t.filter((function(e){return""!==e}))}(t);r.requestParams.body.include=h,r.requestParams.body.live_preview=u.live_preview,r.requestParams.body.content_type_uid=c;var y=u.host.match(/^((http[s]?):(\/\/)?)?(.+)$/),d=(y[1]||"https://")+y[4],p=s.uid,v=d+"/v3/content_types/"+s._content_type_uid+"/entries/"+p;r.requestParams.url=v,r.requestParams.method="GET",delete r.requestParams.headers.access_token,r.requestParams.headers.authorization=l;var _=await(0,o.default)(r,i);_.entry._content_type_uid=c,_.entry.uid=p,f(_.entry)}catch(e){console.log("errror",e)}else await Promise.all(Object.entries(t).map((async function(t){var r=n(t,2),i=r[0],o=r[1];await e(o,s[i],(function(){}))})))}(e,t,(function(){}))}Promise.prototype.spread||(Promise.prototype.spread=function(e,t){return t=t||function(e){},this.then((function(t){return e.apply(e,t)})).catch((function(e){t(e)}))})},173:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540));var o=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=i.transform("only"),this}return n(e,[{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&"string"==typeof e&&t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide a valid parameters.")}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"fetch",value:function(e){if(this.asset_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.assets+this.asset_uid,body:{_method:"GET",query:this._query}};var t=i.mergeDeep(this.fetchOptions,e);return i.sendRequest(i.mergeDeep({},this),t)}e.debug&&e.logHandler("error","Kindly provide an asset uid. e.g. .Assets('asset_uid')")}}]),e}();t.default=o},304:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540));var s=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=o.transform("only"),this.except=o.transform("except"),this}return i(e,[{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":n(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"includeReference",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Array.isArray(t)||"string"==typeof t){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}this.fetchOptions.debug&&this.fetchOptions.logHandler("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;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("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:"includeBranch",value:function(){return this._query.include_branch=!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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"fetch",value:function(e){var t=this.config.host+":"+this.config.port;if(this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host),this.entry_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+t+"/"+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=o.mergeDeep(this.fetchOptions,e);return o.sendRequest(o.mergeDeep({},this),r)}this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide an entry uid. e.g. .Entry('asset_uid')")}}]),e}();t.default=s},566:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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},s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=r(304),a=(n=u)&&n.__esModule?n:{default:n};var c=function(e){return function(t,r){if(t&&r&&"string"==typeof t&&void 0!==r)return this._query.query[t]=this._query.query.file_size||{},this._query.query[t][e]=r,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},l=function(e){var t=e?"$in":"$nin";return function(e,r){if(e&&r&&"string"==typeof e&&Array.isArray(r))return this._query.query[e]=this._query.query[e]||{},this._query.query[e][t]=this._query.query[e][t]||[],this._query.query[e][t]=this._query.query[e][t].concat(r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},f=function(e){return function(t){if(t&&"string"==typeof t)return this._query.query[t]=this._query.query[t]||{},this._query.query[t].$exists=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},h=function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof p&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===o(arguments[r])&&t.push(arguments[r]);return this._query.query[e]?this._query.query[e]=this._query.query[e].concat(t):this._query.query[e]=t,this}},y=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a string.")}},d=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a number.")}},p=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=c("$lt"),e.lessThanOrEqualTo=c("$lte"),e.greaterThan=c("$gt"),e.greaterThanOrEqualTo=c("$gte"),e.notEqualTo=c("$ne"),e.containedIn=l(!0),e.notContainedIn=l(!1),e.exists=f(!0),e.notExists=f(!1),e.ascending=y("asc"),e.descending=y("desc"),e.beforeUid=y("before_uid"),e.afterUid=y("after_uid"),e.skip=d("skip"),e.limit=d("limit"),e.or=h("$or"),e.and=h("$and"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"equalTo",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=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:t,body:{_method:"GET",query:this._query}},this}},{key:"query",value:function(e){if("object"===(void 0===e?"undefined":o(e)))return this._query.query=s.mergeDeep(this._query.query,e),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters")}},{key:"referenceIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$in_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$in_query=r),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,r){var n={};return r instanceof t&&r._query.query?n.$nin_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$nin_query=r),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;this.fetchOptions.debug&&this.fetchOptions.logHandler("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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"getQuery",value:function(){return this._query.query||{}}},{key:"regex",value:function(e,t,r){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query.query[e]={$regex:t},r&&(this._query.query[e].$options=r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"find",value:function(e){var t=this.config.host+":"+this.config.port;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host);var r=this.config.protocol+"://"+t+"/"+this.config.version,n=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:n,body:{_method:"GET",query:this._query}};var i=s.mergeDeep(this.fetchOptions,e);return s.sendRequest(s.mergeDeep({},this),i)}},{key:"findOne",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(e=this.config.protocol+"://"+this.live_preview.host+"/"+this.config.version);var t=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:t,body:{_method:"GET",query:this._query}};var r=s.mergeDeep({},this.fetchOptions);return s.sendRequest(s.mergeDeep({},this),r)}}]),t}(a.default);t.default=p},324:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540));var o=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t&&(this.object=function(){return t}),this}return n(e,[{key:"toJSON",value:function(){return this.object()?i.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null}},{key:"get",value:function(e){if(this.object()&&e)return e.split(".").reduce((function(e,t){return e[t]}),this.object())}},{key:"getDownloadUrl",value:function(e){if(this.object()){var t=this.object().url?this.object().url:null;return t?t+"?disposition="+(e&&"string"==typeof e?e:"attachment"):null}}}]),e}();e.exports=function(e){return new o(e)}},533:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=h(r(971)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=h(r(304)),a=h(r(173)),c=h(r(566)),l=h(r(777)),f=h(r(900));function h(e){return e&&e.__esModule?e:{default:e}}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=[408,429],p=function(){function e(){var t=this;y(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!d.includes(e.status)},debug:!1,logHandler:function(e,t){"error"===e&&t?console.error("[error] "+t):"warning"===e&&t?console.warn("[warning] "+t):"info"===e&&t&&console.info("[info] "+t)}},this.config=s.mergeDeep({},o.default),this.plugins=[];for(var r=arguments.length,i=Array(r),u=0;u<r;u++)i[u]=arguments[u];switch(i[0].region&&void 0!==i[0].region&&"us"!==i[0].region&&(this.config.host=i[0].region+"-cdn.contentstack.com"),i[0].fetchOptions&&void 0!==i[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[0].fetchOptions)),i[0].plugins&&void 0!==i[0].plugins&&i[0].plugins.forEach((function(e){t.plugins.push(e)})),this.cachePolicy=f.default.policies.IGNORE_CACHE,this.provider=f.default.providers("localstorage"),i.length){case 1:if("object"===n(i[0])&&"string"==typeof i[0].api_key&&"string"==typeof i[0].delivery_token&&"string"==typeof i[0].environment)return this.headers={api_key:i[0].api_key,access_token:i[0].delivery_token},"object"==n(i[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,i[0].live_preview)),"string"==typeof i[0].branch&&void 0!==i[0].branch&&(this.headers.branch=i[0].branch),this.environment=i[0].environment,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2])return this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2],this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters.");case 4:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),this;case 5:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),i[4]&&"object"===n(i[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[4])),this;default:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return i(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview||"init",this.live_preview.content_type_uid=e.content_type_uid,this.live_preview.entry_uid=e.entry_uid)}},{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 t=new u.default;return e&&"string"==typeof e&&(t.entry_uid=e),s.merge(t,this)}},{key:"fetch",value:function(e){this.requestParams={method:"POST",headers:this.headers,plugins:this.plugins,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}};var t=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(this,t)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new a.default;return t.asset_uid=e,s.merge(t,this)}return this}},{key:"Query",value:function(){var e=new c.default;return s.merge(e,this)}},{key:"getLastActivities",value:function(){return 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,body:{_method:"GET",only_last_activity:!0,environment:this.environment}},(0,l.default)(this,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(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,body:{_method:"GET",environment:this.environment}},e)for(var t in e)this.requestParams.body[t]=e[t];return(0,l.default)(this,this.fetchOptions)}},{key:"sync",value:function(e,t){this._query={},this._query=s.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 r=s.mergeDeep(this.fetchOptions,t);return s.sendRequest(s.mergeDeep({},this),r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":n(t))&&void 0===t.length){var r=[];for(var i in t)r.push(i+"="+t[i]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=p},420:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=fetch},555:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=r(118),o=(n=i)&&n.__esModule?n:{default:n};t.default=o.default},464:e=>{e.exports=require("@contentstack/utils")},118:e=>{e.exports=require("localStorage")}},t={};var r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}(32);module.exports=r})(); | ||
(()=>{"use strict";var e={971:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.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/"},live_preview:{enable:!1,host:"api.contentstack.io"}}},900:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=r(128),o=(n=i)&&n.__esModule?n:{default:n};var s={providers:function(e){if(e)return o.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}};t.default=s},128:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(821));var i={};function o(e,t){!t&&e&&e.length&&e.push("");var r=void 0,i=n.getKeys(),o=n.getStorage();if(e&&e.length){r=e.join(".");for(var s=0,u=i.length;s<u;s++)i[s]&&0===i[s].indexOf(r)&&delete o[i[s]]}else for(var a=0,c=i.length;a<c;a++)delete o[i[a]]}i.get=function(e,t){try{t(null,n.get(e))}catch(e){t(e)}},i.set=function(e,t,r){try{e&&t&&n.set(e,t),r()}catch(e){r(e)}},i.clearByContentType=function(){try{if(2===arguments.length||3===arguments.length){var e=Array.prototype.slice.call(arguments),t=e.splice(-1,1).pop(),r=[];r.push.apply(r,e),o(r),t()}}catch(e){callback(e)}},i.clearByQuery=function(e,t){try{for(var r=n.getKeys(),i=n.getStorage(),o=0,s=r.length;o<s;o++)r[o]&&~r[o].indexOf(e)&&delete i[r[o]];t()}catch(e){t(e)}},i.clearAll=function(e){try{o(),e()}catch(t){e(t)}},t.default=i},821:(e,t,r)=>{Object.defineProperty(t,"__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};t.get=function(e){var t=s.default.getItem(e);try{t=JSON.parse(t)}catch(e){return t}return t||null},t.set=function(e,t){try{"object"===(void 0===t?"undefined":n(t))?s.default.setItem(e,JSON.stringify(t)):s.default.setItem(e,t)}catch(e){}},t.getStorage=function(){return s.default||null},t.getKeys=function(){return s.default?Object.keys(s.default):[]};var i,o=r(555),s=(i=o)&&i.__esModule?i:{default:i}},32:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=u(r(533)),o=u(r(900)),s=u(r(764));function u(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.CachePolicy=o.default.policies,this.Region=s.default,this.Utils=r(464)}return n(e,[{key:"Stack",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(i.default,[null].concat(t)))}}]),e}();e.exports=new a},764:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default={EU:"eu",US:"us",AZURE_NA:"azure-na"}},777:(e,t,r)=>{Object.defineProperty(t,"__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};t.default=function(e,t){var r=e.requestParams;return new Promise((function(i,o){var s=void 0;return r.headers["Content-Type"]="application/json; charset=UTF-8",r.headers["X-User-Agent"]="contentstack-react-native/"+a,r.body&&"object"===n(r.body)&&(delete r.body._method,"object"===n(r.body.query)&&0===Object.keys(r.body.query).length&&delete r.body.query,s=function e(t,r){var i=[];if("object"===(void 0===t?"undefined":n(t))&&void 0!==t.length)for(var o=0,s=t.length;o<s;o++)i.push(r+"[]="+t[o]);else for(var u in t){var a=r?r+"["+u+"]":u,c=t[u];i.push(null!==c&&"object"===(void 0===c?"undefined":n(c))&&"query"!==u?e(c,a):a+"="+encodeURIComponent("query"!==u?c:JSON.stringify(c)))}return i.join("&")}(r.body)),c(e,s,t,i,o,t.retryDelay,t.retryLimit)}))};var i,o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),s=r(420),u=(i=s)&&i.__esModule?i:{default:i};var a="3.16.1";function c(e,t,r,n,i){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:300,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:5,l=e.requestParams,f=l.url+"?"+t,h=l.headers,y=o.mergeDeep({method:"GET",headers:h,timeout:3e4},r);function d(o){if(0===a)r.debug&&r.logHandler("error",o),i(o);else{var u=s;a-=1;var l=r.retryLimit-a;r.retryDelayOptions&&(r.retryDelayOptions.base?u=r.retryDelayOptions.base*l:r.retryDelayOptions.customBackoff&&(u=r.retryDelayOptions.customBackoff(l,o))),function(e){return new Promise((function(t){setTimeout(t,e)}))}(u).then((function(){return c(e,t,r,n,i,s,a)})).catch((function(){return c(e,t,r,n,i,s,a)}))}}r.debug&&r.logHandler("info",{url:f,option:y});var p={url:f,option:y},v=e.plugins;if(v&&void 0!==v)for(var _=0;_<v.length;_++)"function"==typeof v[_].onRequest&&(p=v[_].onRequest(e,p));(0,u.default)(p.url,p.option).then((function(t){r.debug&&r.logHandler("info",t);var o=t.json();t.ok&&200===t.status?o.then((function(r){for(var i=0;i<v.length&&"function"==typeof v[i].onResponse;i++)r=v[i].onResponse(e,p,t,r);n(r)})):o.then((function(e){r.retryCondition&&r.retryCondition(t)?d(e):(r.debug&&r.logHandler("error",e),i(e))})).catch((function(){r.debug&&r.logHandler("error",{status:t.status,statusText:t.statusText}),i({status:t.status,statusText:t.statusText})}))})).catch((function(e){r.debug&&r.logHandler("error",e),i(e)}))}},540:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.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 t=this._query[e].BASE||[];return t=t.concat(arguments[0]),this._query[e].BASE=t,this}console.error("Kindly provide valid parameters");break;case 2:if("string"==typeof arguments[0]&&(Array.isArray(arguments[1])||"string"==typeof arguments[1])){var r=this._query[e][arguments[0]]||[];return r=r.concat(arguments[1]),this._query[e][arguments[0]]=r,this}console.error("Kindly provide valid parameters");break;default:console.error("Kindly provide valid parameters")}}},t._type=function(e){var t=void 0===e?"undefined":i(e);"object"===t?(t,Array.isArray(e)&&(t="array")):t;return t},t.mergeDeep=function(e,t){var r=this;return function e(t,n){for(var i in n)"object"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?e(t[i],n[i]):"array"==r._type(n[i])&&r._type(t[i])==r._type(n[i])?t[i]=t[i].concat(n[i]):t[i]=n[i]}(e,t),e},t.merge=a,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===("undefined"==typeof process?"undefined":i(process))&&"browser"===process.title},t.parseQueryFromParams=c,t.getHash=l,t.generateHash=f,t.resultWrapper=h,t.spreadResult=y,t.sendRequest=function(e,t){var r=e.environment_uid;r?e._query.environment_uid=r:(e._query||(e._query={}),e._query.environment=e.environment);var n=e,s=void 0!==n.queryCachePolicy?n.queryCachePolicy:n.cachePolicy,u=void 0!==n.tojson&&n.tojson,f=!!(n.entry_uid||n.singleEntry||n.asset_uid),p=l(c(n,f,u));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var v=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===v?"undefined":i(v))&&(v=JSON.parse(v)),delete e.requestParams.body.query,e.requestParams.body=a(e.requestParams.body,v),e.live_preview&&!0===e.live_preview.enable&&e.live_preview.live_preview&&"init"!==e.live_preview.live_preview&&(e.live_preview.content_type_uid===e.content_type_uid?(e.requestParams.body=a(e.requestParams.body,{live_preview:e.live_preview.live_preview||"init"}),s=2,e.requestParams.body.environment&&delete e.requestParams.body.environment,e.requestParams.headers.access_token&&delete e.requestParams.headers.access_token,e.requestParams.headers.authorization=e.live_preview.management_token):e.live_preview.live_preview&&(s=1))}var _=function(){return function(e,t){return new Promise((function(r,n){try{e&&n(e),u||(t=h(t)),r(y(t))}catch(e){n(e)}}))}},g=function(r,i,a){r&&(0,o.default)(e,t).then(function(t){try{n.entry_uid=n.asset_uid=n.tojson=n.queryCachePolicy=void 0;var r={},o={};if(e.singleEntry)if(e.singleEntry=!1,t.schema&&(r.schema=t.schema),t.content_type&&(r.content_type=t.content_type,delete r.schema),t.entries&&t.entries.length)r.entry=t.entries[0];else{if(!t.assets||!t.assets.length)return 2===s&&null!==n.provider?void n.provider.get(p,_()):a({error_code:141,error_message:"The requested entry doesn't exist."});r.assets=t.assets[0]}else t.items?o={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==n.provider?(n.provider.set(p,r,(function(e){try{return e&&a(e),u||(r=h(r)),i(y(r))}catch(e){return a(e)}})),i(y(r))):Object.keys(o).length?i(o):(u||(r=h(r)),i(y(r)))}catch(e){return a({message:e.message})}}.bind(n)).catch((function(e){if(2!==s||null===n.provider)return a(e);n.provider.get(p,_())}))};switch(s){case 1:return new Promise((async function(r,i){null!==n.provider?await n.provider.get(p,(async function(o,s){try{if(o||!s)g(!0,r,i);else{var a=JSON.parse(JSON.stringify(s));try{if(e._query&&Array.isArray(e._query.include)&&e._query.include.length>0){var c=function(e){var t={};function r(e){var r=(e=e.replace(/[\[]/gm,".").replace(/[\]]/gm,"")).split("."),n=r.pop();r.reduce((function(e,t){return e[t]=e[t]||{}}),t)[n]={}}return e.forEach((function(e){r(e)})),t}(e._query.include);f?await d(c,s.entry,e,t):await Promise.all(s.entries.map((async function(r){await d(c,r,e,t)})))}}catch(e){}await n.provider.set(p,a,(function(e){try{return e&&i(e),u||(s=h(s)),r(y(s))}catch(e){return i(e)}}))}}catch(e){return i(e)}})):g(!0,r,i)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){g(!0,e,t)}))}if(3===s){return new Promise((function(e,t){null!==n.provider&&n.provider.get(p,(function(r,n){try{r||!n?t(r):(u||(n=h(n)),e(y(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){g(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){g(!0,e,t)}))}))}};var o=u(r(777)),s=u(r(324));function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function c(e,t,r){if(e&&e.requestParams){var n=a({},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:t||"false",toJSON:r||"false",api_key:e.requestParams.headers?e.requestParams.headers.api_key:""}}}function l(e){try{var t=f(JSON.stringify(e)),r=[];return r.push(e.content_type_uid),r.push(e.locale),e.entry_uid&&r.push(e.entry_uid),e.asset_uid&&r.push(e.asset_uid),r.push(t),r.join(".")}catch(e){}}function f(e){var t,r=0,n=void 0;if(0===e.length)return r;for(n=0,t=e.length;n<t;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return r<-1?-1*r:r}function h(e){if(e&&void 0!==e.entries)if(e.entries&&e.entries.length)for(var t=0,r=e.entries.length;t<r;t++)e.entries[t]=(0,s.default)(e.entries[t]);else e.entries=[];else if(e&&e.assets&&void 0!==e.assets)if(e.assets&&e.assets.length)for(var n=0,i=e.assets.length;n<i;n++)e.assets[n]=(0,s.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,s.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,s.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,s.default)(e.items).toJSON());return e}function y(e){var t=[];return e&&Object.keys(e).length&&(void 0!==e.entries&&(t.push(e.entries),e.content_type&&(t.schema=e.content_type)),void 0!==e.assets&&t.push(e.assets),void 0===e.content_type&&void 0===e.schema||t.push(e.content_type||e.schema),void 0!==e.count&&t.push(e.count),void 0!==e.entry&&(t=e.entry,e.schema&&(t.schema=e.schema),e.content_type&&(t.content_type=e.content_type)),void 0!==e.asset&&(t=e.asset),void 0!==e.items&&t.push(e)),t}async function d(e,t,r,i,s){var u=r.live_preview,a=r.requestParams,c=u.content_type_uid,l=u.management_token;await async function e(t,s,f){if(void 0!==s)if(Array.isArray(s))await Promise.all(s.map((function(r,n){return e(t,r,(function(e){s[n]=e}))})));else if(s._content_type_uid===c)try{r.requestParams=JSON.parse(JSON.stringify(a));var h=function(e){var t=[];function r(e,i){0===Object.keys(e).length?t.push(i.substring(1)):Object.entries(e).forEach((function(e){var t=n(e,2),o=t[0];r(t[1],[i,o].join("."))}))}return r(e,""),t.filter((function(e){return""!==e}))}(t);r.requestParams.body.include=h,r.requestParams.body.live_preview=u.live_preview,r.requestParams.body.content_type_uid=c;var y=u.host.match(/^((http[s]?):(\/\/)?)?(.+)$/),d=(y[1]||"https://")+y[4],p=s.uid,v=d+"/v3/content_types/"+s._content_type_uid+"/entries/"+p;r.requestParams.url=v,r.requestParams.method="GET",delete r.requestParams.headers.access_token,r.requestParams.headers.authorization=l;var _=await(0,o.default)(r,i);_.entry._content_type_uid=c,_.entry.uid=p,f(_.entry)}catch(e){console.log("errror",e)}else await Promise.all(Object.entries(t).map((async function(t){var r=n(t,2),i=r[0],o=r[1];await e(o,s[i],(function(){}))})))}(e,t,(function(){}))}Promise.prototype.spread||(Promise.prototype.spread=function(e,t){return t=t||function(e){},this.then((function(t){return e.apply(e,t)})).catch((function(e){t(e)}))})},173:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540));var o=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=i.transform("only"),this}return n(e,[{key:"toJSON",value:function(){return this.tojson=!0,this}},{key:"addParam",value:function(e,t){if(e&&"string"==typeof e&&t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide a valid parameters.")}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"fetch",value:function(e){if(this.asset_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.assets+this.asset_uid,body:{_method:"GET",query:this._query}};var t=i.mergeDeep(this.fetchOptions,e);return i.sendRequest(i.mergeDeep({},this),t)}e.debug&&e.logHandler("error","Kindly provide an asset uid. e.g. .Assets('asset_uid')")}}]),e}();t.default=o},304:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540));var s=function(){function e(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._query={},this.only=o.transform("only"),this.except=o.transform("except"),this}return i(e,[{key:"setCacheProvider",value:function(e){return e&&"object"===(void 0===e?"undefined":n(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"includeReference",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Array.isArray(t)||"string"==typeof t){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}this.fetchOptions.debug&&this.fetchOptions.logHandler("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;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("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:"includeBranch",value:function(){return this._query.include_branch=!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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"fetch",value:function(e){var t=this.config.host+":"+this.config.port;if(this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host),this.entry_uid){this.requestParams={method:"POST",headers:this.headers,url:this.config.protocol+"://"+t+"/"+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=o.mergeDeep(this.fetchOptions,e);return o.sendRequest(o.mergeDeep({},this),r)}this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide an entry uid. e.g. .Entry('asset_uid')")}}]),e}();t.default=s},566:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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},s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=r(304),a=(n=u)&&n.__esModule?n:{default:n};var c={compare:function(e){return function(t,r){if(t&&r&&"string"==typeof t&&void 0!==r)return this._query.query[t]=this._query.query.file_size||{},this._query.query[t][e]=r,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},contained:function(e){var t=e?"$in":"$nin";return function(e,r){if(e&&r&&"string"==typeof e&&Array.isArray(r))return this._query.query[e]=this._query.query[e]||{},this._query.query[e][t]=this._query.query[e][t]||[],this._query.query[e][t]=this._query.query[e][t].concat(r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},exists:function(e){return function(t){if(t&&"string"==typeof t)return this._query.query[t]=this._query.query[t]||{},this._query.query[t].$exists=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},logical:function(e){return function(){for(var t=[],r=0,n=arguments.length;r<n;r++)arguments[r]instanceof l&&arguments[r]._query.query?t.push(arguments[r]._query.query):"object"===o(arguments[r])&&t.push(arguments[r]);return this._query.query[e]?this._query.query[e]=this._query.query[e].concat(t):this._query.query[e]=t,this}},sort:function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a string.")}},pagination:function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Argument should be a number.")}}},l=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e._query=e._query||{},e._query.query=e._query.query||{},e.lessThan=c.compare("$lt"),e.lessThanOrEqualTo=c.compare("$lte"),e.greaterThan=c.compare("$gt"),e.greaterThanOrEqualTo=c.compare("$gte"),e.notEqualTo=c.compare("$ne"),e.containedIn=c.contained(!0),e.notContainedIn=c.contained(!1),e.exists=c.exists(!0),e.notExists=c.exists(!1),e.ascending=c.sort("asc"),e.descending=c.sort("desc"),e.beforeUid=c.sort("before_uid"),e.afterUid=c.sort("after_uid"),e.skip=c.pagination("skip"),e.limit=c.pagination("limit"),e.or=c.logical("$or"),e.and=c.logical("$and"),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"equalTo",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,t=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:t,body:{_method:"GET",query:this._query}},this}},{key:"query",value:function(e){if("object"===(void 0===e?"undefined":o(e)))return this._query.query=s.mergeDeep(this._query.query,e),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters")}},{key:"referenceIn",value:function(e,r){var n={};return r instanceof t&&r._query.query?n.$in_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$in_query=r),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,r){var n={};return r instanceof t&&r._query.query?n.$nin_query=r._query.query:"object"===(void 0===r?"undefined":o(r))&&(n.$nin_query=r),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;this.fetchOptions.debug&&this.fetchOptions.logHandler("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,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"getQuery",value:function(){return this._query.query||{}}},{key:"regex",value:function(e,t,r){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query.query[e]={$regex:t},r&&(this._query.query[e].$options=r),this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters.")}},{key:"find",value:function(e){var t=this.config.host+":"+this.config.port;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(t=this.live_preview.host);var r=this.config.protocol+"://"+t+"/"+this.config.version,n=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:n,body:{_method:"GET",query:this._query}};var i=s.mergeDeep(this.fetchOptions,e);return s.sendRequest(s.mergeDeep({},this),i)}},{key:"findOne",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version;this.type&&"asset"!==this.type&&this.live_preview&&!0===this.live_preview.enable&&this.live_preview.content_type_uid===this.content_type_uid&&(e=this.config.protocol+"://"+this.live_preview.host+"/"+this.config.version);var t=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:t,body:{_method:"GET",query:this._query}};var r=s.mergeDeep({},this.fetchOptions);return s.sendRequest(s.mergeDeep({},this),r)}}]),t}(a.default);t.default=l},324:(e,t,r)=>{var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540));var o=function(){function e(t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t&&(this.object=function(){return t}),this}return n(e,[{key:"toJSON",value:function(){return this.object()?i.mergeDeep(JSON.parse(JSON.stringify({})),this.object()):null}},{key:"get",value:function(e){if(this.object()&&e)return e.split(".").reduce((function(e,t){return e[t]}),this.object())}},{key:"getDownloadUrl",value:function(e){if(this.object()){var t=this.object().url?this.object().url:null;return t?t+"?disposition="+(e&&"string"==typeof e?e:"attachment"):null}}}]),e}();e.exports=function(e){return new o(e)}},533:(e,t,r)=>{Object.defineProperty(t,"__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},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=h(r(971)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(540)),u=h(r(304)),a=h(r(173)),c=h(r(566)),l=h(r(777)),f=h(r(900));function h(e){return e&&e.__esModule?e:{default:e}}var y=[408,429],d=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!y.includes(e.status)},debug:!1,logHandler:function(e,t){"error"===e&&t?console.error("[error] "+t):"warning"===e&&t?console.warn("[warning] "+t):"info"===e&&t&&console.info("[info] "+t)}},this.config=s.mergeDeep({},o.default),this.plugins=[];for(var r=arguments.length,i=Array(r),u=0;u<r;u++)i[u]=arguments[u];switch(i[0].region&&void 0!==i[0].region&&"us"!==i[0].region&&(this.config.host=i[0].region+"-cdn.contentstack.com"),i[0].fetchOptions&&void 0!==i[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[0].fetchOptions)),i[0].plugins&&void 0!==i[0].plugins&&i[0].plugins.forEach((function(e){t.plugins.push(e)})),this.cachePolicy=f.default.policies.IGNORE_CACHE,this.provider=f.default.providers("localstorage"),i.length){case 1:if("object"===n(i[0])&&"string"==typeof i[0].api_key&&"string"==typeof i[0].delivery_token&&"string"==typeof i[0].environment)return this.headers={api_key:i[0].api_key,access_token:i[0].delivery_token},"object"==n(i[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,i[0].live_preview)),"string"==typeof i[0].branch&&void 0!==i[0].branch&&(this.headers.branch=i[0].branch),this.environment=i[0].environment,this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2])return this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2],this;this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters.");case 4:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),this;case 5:return this.fetchOptions.debug&&this.fetchOptions.logHandler("warning","WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!"),"string"==typeof i[0]&&"string"==typeof i[1]&&"string"==typeof i[2]?(this.headers={api_key:i[0],access_token:i[1]},this.environment=i[2]):this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid string parameters."),i[3]&&("string"==typeof i[3]&&void 0!==i[3]&&"us"!==i[3]?this.config.host=i[3]+"-cdn.contentstack.com":"object"===n(i[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[3]))),i[4]&&"object"===n(i[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,i[4])),this;default:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.")}}return i(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:this.fetchOptions.debug&&this.fetchOptions.logHandler("error","Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview||"init",this.live_preview.content_type_uid=e.content_type_uid,this.live_preview.entry_uid=e.entry_uid)}},{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 t=new u.default;return e&&"string"==typeof e&&(t.entry_uid=e),s.merge(t,this)}},{key:"fetch",value:function(e){this.requestParams={method:"POST",headers:this.headers,plugins:this.plugins,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}};var t=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(this,t)}},{key:"Assets",value:function(e){if(this.type="asset",e&&"string"==typeof e){var t=new a.default;return t.asset_uid=e,s.merge(t,this)}return this}},{key:"Query",value:function(){var e=new c.default;return s.merge(e,this)}},{key:"getLastActivities",value:function(){return 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,body:{_method:"GET",only_last_activity:!0,environment:this.environment}},(0,l.default)(this,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(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,body:{_method:"GET",environment:this.environment}},e)for(var t in e)this.requestParams.body[t]=e[t];return(0,l.default)(this,this.fetchOptions)}},{key:"sync",value:function(e,t){this._query={},this._query=s.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 r=s.mergeDeep(this.fetchOptions,t);return s.sendRequest(s.mergeDeep({},this),r)}},{key:"imageTransform",value:function(e,t){if(e&&"string"==typeof e&&"object"===(void 0===t?"undefined":n(t))&&void 0===t.length){var r=[];for(var i in t)r.push(i+"="+t[i]);e+=e.indexOf("?")<=-1?"?"+r.join("&"):"&"+r.join("&")}return e}}]),e}();t.default=d},420:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=fetch},555:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n,i=r(118),o=(n=i)&&n.__esModule?n:{default:n};t.default=o.default},464:e=>{e.exports=require("@contentstack/utils")},118:e=>{e.exports=require("localStorage")}},t={};var r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}(32);module.exports=r})(); |
{ | ||
"name": "contentstack", | ||
"version": "3.16.0", | ||
"version": "3.16.1", | ||
"description": "Contentstack Javascript SDK", | ||
@@ -14,3 +14,3 @@ "homepage": "https://www.contentstack.com/", | ||
"types": "./index.d.ts", | ||
"_id": "contentstack@3.16.0", | ||
"_id": "contentstack@3.16.1", | ||
"scripts": { | ||
@@ -59,7 +59,7 @@ "test": "npm run test:e2e && npm run test:typescript", | ||
"shasum": "a328ed07240476a26b31a23261355dc929e1da63", | ||
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.16.0.tgz" | ||
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.16.1.tgz" | ||
}, | ||
"license": "MIT", | ||
"directories": {}, | ||
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.16.0.tgz", | ||
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.16.1.tgz", | ||
"_npmOperationalInternal": { | ||
@@ -81,3 +81,3 @@ "host": "packages-18-east.internal.npmjs.com", | ||
"compression-webpack-plugin": "^10.0.0", | ||
"dotenv": "^16.0.0", | ||
"dotenv": "^16.0.3", | ||
"es3ify-loader": "0.2.0", | ||
@@ -88,18 +88,19 @@ "fetch-mock-jest": "^1.3.0", | ||
"jest-html-reporters": "^2.1.7", | ||
"jsdoc": "^3.6.10", | ||
"jshint": "^2.13.4", | ||
"jsdoc": "^4.0.2", | ||
"jshint": "^2.13.6", | ||
"minami": "^1.2.3", | ||
"node-request-interceptor": "^0.6.3", | ||
"nodemailer": "^6.7.3", | ||
"nodemailer": "^6.9.1", | ||
"request": "^2.88.2", | ||
"string-replace-loader": "1.3.0", | ||
"tap": "^16.2.0", | ||
"tap": "^16.3.4", | ||
"tap-html": "^1.0.1", | ||
"tap-json": "1.0.0", | ||
"tape": "4.8.0", | ||
"terser-webpack-plugin": "^5.3.1", | ||
"ts-jest": "^27.1.4", | ||
"typescript": "^4.6.3", | ||
"terser-webpack-plugin": "^5.3.6", | ||
"ts-jest": "^27.1.5", | ||
"typescript": "^4.9.5", | ||
"uglify-js": "2.8.29", | ||
"webpack": "^5.70.0", | ||
"webpack-cli": "^4.9.2", | ||
"webpack": "^5.75.0", | ||
"webpack-cli": "^4.10.0", | ||
"webpack-md5-hash": "0.0.5", | ||
@@ -110,3 +111,3 @@ "webpack-merge": "4.1.0", | ||
"dependencies": { | ||
"@contentstack/utils": "^1.1.3", | ||
"@contentstack/utils": "^1.2.0", | ||
"es6-promise": "^4.1.1", | ||
@@ -113,0 +114,0 @@ "isomorphic-fetch": "^3.0.0", |
@@ -17,8 +17,13 @@ [![Contentstack](https://www.contentstack.com/docs/static/images/contentstack.png)](https://www.contentstack.com/) | ||
#### For JavaScript (Browser) | ||
For browsers, we recommend to download the library via npm or yarn to ensure 100% availability. | ||
To use the JavaScript SDK, download it from [here](https://contentstack.com/docs/platforms/javascript-browser/javascript_sdk_latest) and include it in the <script> tag: | ||
If you'd like to use a standalone built file you can use the following script tag or download it from [jsDelivr](https://www.jsdelivr.com/package/npm/contentstack), under the `dist` directory: | ||
```html | ||
<script type="text/javascript" src="/path/to/contentstack.min.js"></script>; | ||
<script src="https://cdn.jsdelivr.net/npm/contentstack@latest/dist/web/contentstack.min.js"></script> | ||
``` | ||
You can also specify a specific version number. | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/contentstack@3.16.0/dist/web/contentstack.min.js"></script> | ||
``` | ||
@@ -40,3 +45,3 @@ To initialize the SDK, you will need to specify the API Key, Delivery Token, and Environment Name of your stack. | ||
Node.js uses the Javascript SDK to create apps. To use the JavaScript SDK, download it from [here](https://contentstack.com/docs/platforms/javascript-browser/javascript_sdk_latest), OR install it via npm: | ||
Node.js uses the Javascript SDK to create apps. To use the JavaScript SDK, install it via npm: | ||
@@ -69,3 +74,3 @@ ```bash | ||
React Native uses the Javascript SDK to create apps. To use the JavaScript SDK, download it from [here](https://contentstack.com/docs/platforms/javascript-browser/javascript_sdk_latest), OR install ist via npm: | ||
React Native uses the Javascript SDK to create apps. To use the JavaScript SDK, install it via npm: | ||
@@ -79,3 +84,3 @@ ```bash | ||
```javascript | ||
import Contentstack from `contentstack/react-native` | ||
import Contentstack from `contentstack` | ||
``` | ||
@@ -82,0 +87,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
301
207727
37
Updated@contentstack/utils@^1.2.0