contentstack
Advanced tools
Comparing version 3.15.1 to 3.15.2
## Change log | ||
### Version: 3.15.2 | ||
#### Date: May-03-2022 | ||
##### New Features: | ||
- Live preview with reference entry issue resolved | ||
### Version: 3.15.1 | ||
#### Date: Apr-21-2022 | ||
##### New Features: | ||
- Azure Na region and packages updates | ||
### Version: 3.15.0 | ||
@@ -3,0 +13,0 @@ #### Date: Oct-29-2021 |
@@ -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){return new Promise((function(r,i){var o=void 0,s=e.url,u=e.headers;return u["Content-Type"]="application/json; charset=UTF-8",u["X-User-Agent"]="contentstack-react-native/3.15.1",e.body&&"object"===n(e.body)&&(delete e.body._method,"object"===n(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,o=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("&")}(e.body)),a(s+"?"+o,u,t,r,i,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,y=o.mergeDeep({method:"GET",headers:t,timeout:3e4},r);function f(o){if(0===l)i(o);else{var s=c;l-=1;var y=r.retryLimit-l;r.retryDelayOptions&&(r.retryDelayOptions.base?s=r.retryDelayOptions.base*y:r.retryDelayOptions.customBackoff&&(s=r.retryDelayOptions.customBackoff(y,o))),u(s).then((function(){return a(e,t,c,l,r,n,i)})).catch((function(){return a(e,t,c,l,r,n,i)}))}}(0,s.default)(e,y).then((function(e){var t=e.json();e.ok&&200===e.status?n(t):t.then((function(t){r.retryCondition&&r.retryCondition(e)?f(t):i(t)})).catch((function(){i({status:e.status,statusText:e.statusText})}))})).catch((function(e){i(e)}))}},540:(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.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":n(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=u,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===("undefined"==typeof process?"undefined":n(process))&&"browser"===process.title},t.parseQueryFromParams=a,t.getHash=c,t.generateHash=l,t.resultWrapper=y,t.spreadResult=f,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 o=e,s=void 0!==o.queryCachePolicy?o.queryCachePolicy:o.cachePolicy,l=void 0!==o.tojson&&o.tojson,h=!!(o.entry_uid||o.singleEntry||o.asset_uid),d=c(a(o,h,l));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var p=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===p?"undefined":n(p))&&(p=JSON.parse(p)),delete e.requestParams.body.query,e.requestParams.body=u(e.requestParams.body,p),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=u(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 v=function(){return function(e,t){return new Promise((function(r,n){try{e&&n(e),l||(t=y(t)),r(f(t))}catch(e){n(e)}}))}},_=function(r,n,u){r&&(0,i.default)(e.requestParams,t).then(function(t){try{o.entry_uid=o.asset_uid=o.tojson=o.queryCachePolicy=void 0;var r={},i={};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!==o.provider?void o.provider.get(d,v()):u({error_code:141,error_message:"The requested entry doesn't exist."});r.assets=t.assets[0]}else t.items?i={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==o.provider?(o.provider.set(d,r,(function(e){try{return e&&u(e),l||(r=y(r)),n(f(r))}catch(e){return u(e)}})),n(f(r))):Object.keys(i).length?n(i):(l||(r=y(r)),n(f(r)))}catch(e){return u({message:e.message})}}.bind(o)).catch((function(e){if(2!==s||null===o.provider)return u(e);o.provider.get(d,v())}))};switch(s){case 1:return new Promise((function(e,t){null!==o.provider?o.provider.get(d,(function(r,n){try{if(!r&&n)return l||(n=y(n)),e(f(n));_(!0,e,t)}catch(e){return t(e)}})):_(!0,e,t)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){_(!0,e,t)}))}if(3===s)return new Promise((function(e,t){null!==o.provider&&o.provider.get(d,(function(r,n){try{r||!n?t(r):(l||(n=y(n)),e(f(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){_(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){_(!0,e,t)}))}))};var i=s(r(777)),o=s(r(324));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function a(e,t,r){if(e&&e.requestParams){var n=u({},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 c(e){try{var t=l(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 l(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 y(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,o.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,o.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,o.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,o.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,o.default)(e.items).toJSON());return e}function f(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}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;console.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(this,t)}console.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:console.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}console.error("Argument should be a String or an Array.")}},{key:"language",value:function(e){if(e&&"string"==typeof e)return this._query.locale=e,this;console.error("Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;console.error("First argument should be a String.")}},{key:"includeEmbeddedItems",value:function(){return this._query.include_embedded_items=["BASE"],this}},{key:"includeSchema",value:function(){return this._query.include_schema=!0,this}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"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;console.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(this,r)}console.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;console.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;console.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;console.error("Kindly provide valid parameters.")}},y=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}},f=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},h=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.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=f("asc"),e.descending=f("desc"),e.beforeUid=f("before_uid"),e.afterUid=f("after_uid"),e.skip=h("skip"),e.limit=h("limit"),e.or=y("$or"),e.and=y("$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;console.error("Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,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;console.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;console.error("Kindly provide valid parameters")}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeCount",value:function(){return this._query.include_count=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.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;console.error("Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;console.error("Kindly provide valid parameters.")}},{key:"find",value:function(e){var 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(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(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=f(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=f(r(304)),a=f(r(173)),c=f(r(566)),l=f(r(777)),y=f(r(900));function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=[408,429],p=function(){function e(){h(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!d.includes(e.status)}},this.config=s.mergeDeep({},o.default);for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];switch(r[0].region&&void 0!==r[0].region&&"us"!==r[0].region&&(this.config.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!==r[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[0].fetchOptions)),this.cachePolicy=y.default.policies.IGNORE_CACHE,this.provider=y.default.providers("localstorage"),r.length){case 1:if("object"===n(r[0])&&"string"==typeof r[0].api_key&&"string"==typeof r[0].delivery_token&&"string"==typeof r[0].environment)return this.headers={api_key:r[0].api_key,access_token:r[0].delivery_token},"object"==n(r[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,r[0].live_preview)),"string"==typeof r[0].branch&&void 0!==r[0].branch&&(this.headers.branch=r[0].branch),this.environment=r[0].environment,this;console.error("Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2])return this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2],this;console.error("Kindly provide valid string parameters.");case 4:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),this;case 5:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),r[4]&&"object"===n(r[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[4])),this;default:console.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:console.error("Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview,this.live_preview.content_type_uid=e.content_type_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){var t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid,body:{_method:"GET",environment:this.environment}},r=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(t,r)}},{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(){var e={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",only_last_activity:!0,environment:this.environment}};return(0,l.default)(e,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",environment:this.environment}};if(e)for(var r in e)t.body[r]=e[r];return(0,l.default)(t,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(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){return new Promise((function(r,i){var o=void 0,s=e.url,u=e.headers;return u["Content-Type"]="application/json; charset=UTF-8",u["X-User-Agent"]="contentstack-react-native/3.15.2",e.body&&"object"===n(e.body)&&(delete e.body._method,"object"===n(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,o=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("&")}(e.body)),a(s+"?"+o,u,t,r,i,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,y=o.mergeDeep({method:"GET",headers:t,timeout:3e4},r);function f(o){if(0===l)i(o);else{var s=c;l-=1;var y=r.retryLimit-l;r.retryDelayOptions&&(r.retryDelayOptions.base?s=r.retryDelayOptions.base*y:r.retryDelayOptions.customBackoff&&(s=r.retryDelayOptions.customBackoff(y,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)}))}}(0,s.default)(e,y).then((function(e){var t=e.json();e.ok&&200===e.status?n(t):t.then((function(t){r.retryCondition&&r.retryCondition(e)?f(t):i(t)})).catch((function(){i({status:e.status,statusText:e.statusText})}))})).catch((function(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=y,t.resultWrapper=f,t.spreadResult=h,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,y=!!(n.entry_uid||n.singleEntry||n.asset_uid),p=l(c(n,y,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=f(t)),r(h(t))}catch(e){n(e)}}))}},m=function(r,i,a){r&&(0,o.default)(e.requestParams,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=f(r)),i(h(r))}catch(e){return a(e)}})),i(h(r))):Object.keys(o).length?i(o):(u||(r=f(r)),i(h(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)m(!0,r,i);else{try{if(e._query&&Array.isArray(e._query.include)&&e._query.include.length>0){var a=(c=e._query.include,l={},c.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]||{}}),l)[r]={}}(e)})),l);y?await d(a,s.entry,e.live_preview,e.requestParams,t):s.entries.forEach((async function(r){await d(a,r,e.live_preview,e.requestParams,t)}))}}catch(e){}await n.provider.set(p,s,(function(e){try{return e&&i(e),u||(s=f(s)),r(h(s))}catch(e){return i(e)}}))}}catch(e){return i(e)}var c,l})):m(!0,r,i)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){m(!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=f(n)),e(h(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){m(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){m(!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=y(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 y(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 f(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 h(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,u){var a=r.content_type_uid,c=r.management_token;await async function e(t,u,l){if(void 0!==u)if(Array.isArray(u))await Promise.all(u.map((function(r,n){return e(t,r,(function(e){u[n]=e}))})));else if(u._content_type_uid===a)try{var y=JSON.parse(JSON.stringify(i)),f=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);y.body.include=f,y.body.live_preview=r.hash,y.body.content_type_uid=a;var h=r.host.match(/^((http[s]?):(\/\/)?)?(.+)$/),d=(h[1]||"https://")+h[4],p=u.uid,v=d+"/v3/content_types/"+u._content_type_uid+"/entries/"+p;y.url=v,y.method="GET",delete y.headers.access_token,y.headers.authorization=c;var _=await(0,o.default)(y,s);_.entry._content_type_uid=a,_.entry.uid=p,l(_.entry)}catch(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,u[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;console.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(this,t)}console.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:console.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}console.error("Argument should be a String or an Array.")}},{key:"language",value:function(e){if(e&&"string"==typeof e)return this._query.locale=e,this;console.error("Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;console.error("First argument should be a String.")}},{key:"includeEmbeddedItems",value:function(){return this._query.include_embedded_items=["BASE"],this}},{key:"includeSchema",value:function(){return this._query.include_schema=!0,this}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"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;console.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(this,r)}console.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;console.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;console.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;console.error("Kindly provide valid parameters.")}},y=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}},f=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},h=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.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=f("asc"),e.descending=f("desc"),e.beforeUid=f("before_uid"),e.afterUid=f("after_uid"),e.skip=h("skip"),e.limit=h("limit"),e.or=y("$or"),e.and=y("$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;console.error("Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,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;console.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;console.error("Kindly provide valid parameters")}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeCount",value:function(){return this._query.include_count=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.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;console.error("Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;console.error("Kindly provide valid parameters.")}},{key:"find",value:function(e){var 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(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(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=f(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=f(r(304)),a=f(r(173)),c=f(r(566)),l=f(r(777)),y=f(r(900));function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=[408,429],p=function(){function e(){h(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!d.includes(e.status)}},this.config=s.mergeDeep({},o.default);for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];switch(r[0].region&&void 0!==r[0].region&&"us"!==r[0].region&&(this.config.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!==r[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[0].fetchOptions)),this.cachePolicy=y.default.policies.IGNORE_CACHE,this.provider=y.default.providers("localstorage"),r.length){case 1:if("object"===n(r[0])&&"string"==typeof r[0].api_key&&"string"==typeof r[0].delivery_token&&"string"==typeof r[0].environment)return this.headers={api_key:r[0].api_key,access_token:r[0].delivery_token},"object"==n(r[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,r[0].live_preview)),"string"==typeof r[0].branch&&void 0!==r[0].branch&&(this.headers.branch=r[0].branch),this.environment=r[0].environment,this;console.error("Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2])return this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2],this;console.error("Kindly provide valid string parameters.");case 4:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),this;case 5:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),r[4]&&"object"===n(r[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[4])),this;default:console.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:console.error("Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview,this.live_preview.content_type_uid=e.content_type_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){var t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid,body:{_method:"GET",environment:this.environment}},r=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(t,r)}},{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(){var e={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",only_last_activity:!0,environment:this.environment}};return(0,l.default)(e,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",environment:this.environment}};if(e)for(var r in e)t.body[r]=e[r];return(0,l.default)(t,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(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})(); |
@@ -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){return new Promise((function(r,i){var o=void 0,s=e.url,u=e.headers;return u["Content-Type"]="application/json; charset=UTF-8",u["X-User-Agent"]="contentstack-nodejs/3.15.1",e.body&&"object"===n(e.body)&&(delete e.body._method,"object"===n(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,o=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("&")}(e.body)),a(s+"?"+o,u,t,r,i,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,y=o.mergeDeep({method:"GET",headers:t,timeout:3e4},r);function f(o){if(0===l)i(o);else{var s=c;l-=1;var y=r.retryLimit-l;r.retryDelayOptions&&(r.retryDelayOptions.base?s=r.retryDelayOptions.base*y:r.retryDelayOptions.customBackoff&&(s=r.retryDelayOptions.customBackoff(y,o))),u(s).then((function(){return a(e,t,c,l,r,n,i)})).catch((function(){return a(e,t,c,l,r,n,i)}))}}(0,s.default)(e,y).then((function(e){var t=e.json();e.ok&&200===e.status?n(t):t.then((function(t){r.retryCondition&&r.retryCondition(e)?f(t):i(t)})).catch((function(){i({status:e.status,statusText:e.statusText})}))})).catch((function(e){i(e)}))}},540:(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.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":n(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=u,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===("undefined"==typeof process?"undefined":n(process))&&"browser"===process.title},t.parseQueryFromParams=a,t.getHash=c,t.generateHash=l,t.resultWrapper=y,t.spreadResult=f,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 o=e,s=void 0!==o.queryCachePolicy?o.queryCachePolicy:o.cachePolicy,l=void 0!==o.tojson&&o.tojson,h=!!(o.entry_uid||o.singleEntry||o.asset_uid),d=c(a(o,h,l));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var p=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===p?"undefined":n(p))&&(p=JSON.parse(p)),delete e.requestParams.body.query,e.requestParams.body=u(e.requestParams.body,p),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=u(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 v=function(){return function(e,t){return new Promise((function(r,n){try{e&&n(e),l||(t=y(t)),r(f(t))}catch(e){n(e)}}))}},_=function(r,n,u){r&&(0,i.default)(e.requestParams,t).then(function(t){try{o.entry_uid=o.asset_uid=o.tojson=o.queryCachePolicy=void 0;var r={},i={};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!==o.provider?void o.provider.get(d,v()):u({error_code:141,error_message:"The requested entry doesn't exist."});r.assets=t.assets[0]}else t.items?i={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==o.provider?(o.provider.set(d,r,(function(e){try{return e&&u(e),l||(r=y(r)),n(f(r))}catch(e){return u(e)}})),n(f(r))):Object.keys(i).length?n(i):(l||(r=y(r)),n(f(r)))}catch(e){return u({message:e.message})}}.bind(o)).catch((function(e){if(2!==s||null===o.provider)return u(e);o.provider.get(d,v())}))};switch(s){case 1:return new Promise((function(e,t){null!==o.provider?o.provider.get(d,(function(r,n){try{if(!r&&n)return l||(n=y(n)),e(f(n));_(!0,e,t)}catch(e){return t(e)}})):_(!0,e,t)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){_(!0,e,t)}))}if(3===s)return new Promise((function(e,t){null!==o.provider&&o.provider.get(d,(function(r,n){try{r||!n?t(r):(l||(n=y(n)),e(f(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){_(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){_(!0,e,t)}))}))};var i=s(r(777)),o=s(r(324));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function a(e,t,r){if(e&&e.requestParams){var n=u({},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 c(e){try{var t=l(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 l(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 y(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,o.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,o.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,o.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,o.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,o.default)(e.items).toJSON());return e}function f(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}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;console.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(this,t)}console.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:console.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}console.error("Argument should be a String or an Array.")}},{key:"language",value:function(e){if(e&&"string"==typeof e)return this._query.locale=e,this;console.error("Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;console.error("First argument should be a String.")}},{key:"includeEmbeddedItems",value:function(){return this._query.include_embedded_items=["BASE"],this}},{key:"includeSchema",value:function(){return this._query.include_schema=!0,this}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"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;console.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(this,r)}console.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;console.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;console.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;console.error("Kindly provide valid parameters.")}},y=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}},f=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},h=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.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=f("asc"),e.descending=f("desc"),e.beforeUid=f("before_uid"),e.afterUid=f("after_uid"),e.skip=h("skip"),e.limit=h("limit"),e.or=y("$or"),e.and=y("$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;console.error("Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,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;console.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;console.error("Kindly provide valid parameters")}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeCount",value:function(){return this._query.include_count=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.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;console.error("Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;console.error("Kindly provide valid parameters.")}},{key:"find",value:function(e){var 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(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(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=f(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=f(r(304)),a=f(r(173)),c=f(r(566)),l=f(r(777)),y=f(r(900));function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=[408,429],p=function(){function e(){h(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!d.includes(e.status)}},this.config=s.mergeDeep({},o.default);for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];switch(r[0].region&&void 0!==r[0].region&&"us"!==r[0].region&&(this.config.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!==r[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[0].fetchOptions)),this.cachePolicy=y.default.policies.IGNORE_CACHE,this.provider=y.default.providers("localstorage"),r.length){case 1:if("object"===n(r[0])&&"string"==typeof r[0].api_key&&"string"==typeof r[0].delivery_token&&"string"==typeof r[0].environment)return this.headers={api_key:r[0].api_key,access_token:r[0].delivery_token},"object"==n(r[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,r[0].live_preview)),"string"==typeof r[0].branch&&void 0!==r[0].branch&&(this.headers.branch=r[0].branch),this.environment=r[0].environment,this;console.error("Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2])return this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2],this;console.error("Kindly provide valid string parameters.");case 4:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),this;case 5:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),r[4]&&"object"===n(r[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[4])),this;default:console.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:console.error("Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview,this.live_preview.content_type_uid=e.content_type_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){var t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid,body:{_method:"GET",environment:this.environment}},r=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(t,r)}},{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(){var e={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",only_last_activity:!0,environment:this.environment}};return(0,l.default)(e,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",environment:this.environment}};if(e)for(var r in e)t.body[r]=e[r];return(0,l.default)(t,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(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){return new Promise((function(r,i){var o=void 0,s=e.url,u=e.headers;return u["Content-Type"]="application/json; charset=UTF-8",u["X-User-Agent"]="contentstack-nodejs/3.15.2",e.body&&"object"===n(e.body)&&(delete e.body._method,"object"===n(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,o=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("&")}(e.body)),a(s+"?"+o,u,t,r,i,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,y=o.mergeDeep({method:"GET",headers:t,timeout:3e4},r);function f(o){if(0===l)i(o);else{var s=c;l-=1;var y=r.retryLimit-l;r.retryDelayOptions&&(r.retryDelayOptions.base?s=r.retryDelayOptions.base*y:r.retryDelayOptions.customBackoff&&(s=r.retryDelayOptions.customBackoff(y,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)}))}}(0,s.default)(e,y).then((function(e){var t=e.json();e.ok&&200===e.status?n(t):t.then((function(t){r.retryCondition&&r.retryCondition(e)?f(t):i(t)})).catch((function(){i({status:e.status,statusText:e.statusText})}))})).catch((function(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=y,t.resultWrapper=f,t.spreadResult=h,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,y=!!(n.entry_uid||n.singleEntry||n.asset_uid),p=l(c(n,y,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=f(t)),r(h(t))}catch(e){n(e)}}))}},m=function(r,i,a){r&&(0,o.default)(e.requestParams,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=f(r)),i(h(r))}catch(e){return a(e)}})),i(h(r))):Object.keys(o).length?i(o):(u||(r=f(r)),i(h(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)m(!0,r,i);else{try{if(e._query&&Array.isArray(e._query.include)&&e._query.include.length>0){var a=(c=e._query.include,l={},c.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]||{}}),l)[r]={}}(e)})),l);y?await d(a,s.entry,e.live_preview,e.requestParams,t):s.entries.forEach((async function(r){await d(a,r,e.live_preview,e.requestParams,t)}))}}catch(e){}await n.provider.set(p,s,(function(e){try{return e&&i(e),u||(s=f(s)),r(h(s))}catch(e){return i(e)}}))}}catch(e){return i(e)}var c,l})):m(!0,r,i)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){m(!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=f(n)),e(h(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){m(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){m(!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=y(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 y(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 f(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 h(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,u){var a=r.content_type_uid,c=r.management_token;await async function e(t,u,l){if(void 0!==u)if(Array.isArray(u))await Promise.all(u.map((function(r,n){return e(t,r,(function(e){u[n]=e}))})));else if(u._content_type_uid===a)try{var y=JSON.parse(JSON.stringify(i)),f=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);y.body.include=f,y.body.live_preview=r.hash,y.body.content_type_uid=a;var h=r.host.match(/^((http[s]?):(\/\/)?)?(.+)$/),d=(h[1]||"https://")+h[4],p=u.uid,v=d+"/v3/content_types/"+u._content_type_uid+"/entries/"+p;y.url=v,y.method="GET",delete y.headers.access_token,y.headers.authorization=c;var _=await(0,o.default)(y,s);_.entry._content_type_uid=a,_.entry.uid=p,l(_.entry)}catch(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,u[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;console.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(this,t)}console.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:console.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}console.error("Argument should be a String or an Array.")}},{key:"language",value:function(e){if(e&&"string"==typeof e)return this._query.locale=e,this;console.error("Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;console.error("First argument should be a String.")}},{key:"includeEmbeddedItems",value:function(){return this._query.include_embedded_items=["BASE"],this}},{key:"includeSchema",value:function(){return this._query.include_schema=!0,this}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"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;console.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(this,r)}console.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;console.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;console.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;console.error("Kindly provide valid parameters.")}},y=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}},f=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},h=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.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=f("asc"),e.descending=f("desc"),e.beforeUid=f("before_uid"),e.afterUid=f("after_uid"),e.skip=h("skip"),e.limit=h("limit"),e.or=y("$or"),e.and=y("$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;console.error("Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,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;console.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;console.error("Kindly provide valid parameters")}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeCount",value:function(){return this._query.include_count=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.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;console.error("Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;console.error("Kindly provide valid parameters.")}},{key:"find",value:function(e){var 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(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(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=f(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=f(r(304)),a=f(r(173)),c=f(r(566)),l=f(r(777)),y=f(r(900));function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=[408,429],p=function(){function e(){h(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!d.includes(e.status)}},this.config=s.mergeDeep({},o.default);for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];switch(r[0].region&&void 0!==r[0].region&&"us"!==r[0].region&&(this.config.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!==r[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[0].fetchOptions)),this.cachePolicy=y.default.policies.IGNORE_CACHE,this.provider=y.default.providers("localstorage"),r.length){case 1:if("object"===n(r[0])&&"string"==typeof r[0].api_key&&"string"==typeof r[0].delivery_token&&"string"==typeof r[0].environment)return this.headers={api_key:r[0].api_key,access_token:r[0].delivery_token},"object"==n(r[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,r[0].live_preview)),"string"==typeof r[0].branch&&void 0!==r[0].branch&&(this.headers.branch=r[0].branch),this.environment=r[0].environment,this;console.error("Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2])return this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2],this;console.error("Kindly provide valid string parameters.");case 4:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),this;case 5:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),r[4]&&"object"===n(r[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[4])),this;default:console.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:console.error("Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview,this.live_preview.content_type_uid=e.content_type_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){var t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid,body:{_method:"GET",environment:this.environment}},r=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(t,r)}},{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(){var e={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",only_last_activity:!0,environment:this.environment}};return(0,l.default)(e,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",environment:this.environment}};if(e)for(var r in e)t.body[r]=e[r];return(0,l.default)(t,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(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})(); |
@@ -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){return new Promise((function(r,i){var o=void 0,s=e.url,u=e.headers;return u["Content-Type"]="application/json; charset=UTF-8",u["X-User-Agent"]="contentstack-react-native/3.15.1",e.body&&"object"===n(e.body)&&(delete e.body._method,"object"===n(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,o=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("&")}(e.body)),c(s+"?"+o,u,t,r,i,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,y=o.mergeDeep({method:"GET",headers:t,timeout:3e4},r);function f(o){if(0===l)i(o);else{var u=s;l-=1;var y=r.retryLimit-l;r.retryDelayOptions&&(r.retryDelayOptions.base?u=r.retryDelayOptions.base*y:r.retryDelayOptions.customBackoff&&(u=r.retryDelayOptions.customBackoff(y,o))),a(u).then((function(){return c(e,t,s,l,r,n,i)})).catch((function(){return c(e,t,s,l,r,n,i)}))}}(0,u.default)(e,y).then((function(e){var t=e.json();e.ok&&200===e.status?n(t):t.then((function(t){r.retryCondition&&r.retryCondition(e)?f(t):i(t)})).catch((function(){i({status:e.status,statusText:e.statusText})}))})).catch((function(e){i(e)}))}},540:(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.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":n(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=u,t.isBrowser=function(){return"undefined"!=typeof window&&"object"===("undefined"==typeof process?"undefined":n(process))&&"browser"===process.title},t.parseQueryFromParams=a,t.getHash=c,t.generateHash=l,t.resultWrapper=y,t.spreadResult=f,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 o=e,s=void 0!==o.queryCachePolicy?o.queryCachePolicy:o.cachePolicy,l=void 0!==o.tojson&&o.tojson,h=!!(o.entry_uid||o.singleEntry||o.asset_uid),d=c(a(o,h,l));if(e&&e.requestParams&&e.requestParams.body&&e.requestParams.body.query){var p=JSON.parse(JSON.stringify(e.requestParams.body.query));"object"!==(void 0===p?"undefined":n(p))&&(p=JSON.parse(p)),delete e.requestParams.body.query,e.requestParams.body=u(e.requestParams.body,p),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=u(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 v=function(){return function(e,t){return new Promise((function(r,n){try{e&&n(e),l||(t=y(t)),r(f(t))}catch(e){n(e)}}))}},_=function(r,n,u){r&&(0,i.default)(e.requestParams,t).then(function(t){try{o.entry_uid=o.asset_uid=o.tojson=o.queryCachePolicy=void 0;var r={},i={};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!==o.provider?void o.provider.get(d,v()):u({error_code:141,error_message:"The requested entry doesn't exist."});r.assets=t.assets[0]}else t.items?i={items:t.items,pagination_token:t.pagination_token,sync_token:t.sync_token,total_count:t.total_count}:r=t;return-1!==s&&null!==o.provider?(o.provider.set(d,r,(function(e){try{return e&&u(e),l||(r=y(r)),n(f(r))}catch(e){return u(e)}})),n(f(r))):Object.keys(i).length?n(i):(l||(r=y(r)),n(f(r)))}catch(e){return u({message:e.message})}}.bind(o)).catch((function(e){if(2!==s||null===o.provider)return u(e);o.provider.get(d,v())}))};switch(s){case 1:return new Promise((function(e,t){null!==o.provider?o.provider.get(d,(function(r,n){try{if(!r&&n)return l||(n=y(n)),e(f(n));_(!0,e,t)}catch(e){return t(e)}})):_(!0,e,t)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){_(!0,e,t)}))}if(3===s){return new Promise((function(e,t){null!==o.provider&&o.provider.get(d,(function(r,n){try{r||!n?t(r):(l||(n=y(n)),e(f(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){_(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){_(!0,e,t)}))}))}};var i=s(r(777)),o=s(r(324));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(e&&t)for(var r in t)e[r]=t[r];return e}function a(e,t,r){if(e&&e.requestParams){var n=u({},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 c(e){try{var t=l(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 l(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 y(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,o.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,o.default)(e.assets[n]);else e.assets=[];else e&&void 0!==e.entry?e.entry=(0,o.default)(e.entry):e&&void 0!==e.asset?e.asset=(0,o.default)(e.asset):e&&void 0!==e.items&&(e.items=(0,o.default)(e.items).toJSON());return e}function f(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}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;console.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(this,t)}console.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:console.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}console.error("Argument should be a String or an Array.")}},{key:"language",value:function(e){if(e&&"string"==typeof e)return this._query.locale=e,this;console.error("Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;console.error("First argument should be a String.")}},{key:"includeEmbeddedItems",value:function(){return this._query.include_embedded_items=["BASE"],this}},{key:"includeSchema",value:function(){return this._query.include_schema=!0,this}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"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;console.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(this,r)}console.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;console.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;console.error("Kindly provide valid parameters.")}},y=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;console.error("Kindly provide valid parameters.")}},f=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}},h=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},d=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.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=y(!0),e.notExists=y(!1),e.ascending=h("asc"),e.descending=h("desc"),e.beforeUid=h("before_uid"),e.afterUid=h("after_uid"),e.skip=d("skip"),e.limit=d("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;console.error("Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,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;console.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;console.error("Kindly provide valid parameters")}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeCount",value:function(){return this._query.include_count=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.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;console.error("Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;console.error("Kindly provide valid parameters.")}},{key:"find",value:function(e){var 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(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(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=f(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=f(r(304)),a=f(r(173)),c=f(r(566)),l=f(r(777)),y=f(r(900));function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=[408,429],p=function(){function e(){h(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!d.includes(e.status)}},this.config=s.mergeDeep({},o.default);for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];switch(r[0].region&&void 0!==r[0].region&&"us"!==r[0].region&&(this.config.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!==r[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[0].fetchOptions)),this.cachePolicy=y.default.policies.IGNORE_CACHE,this.provider=y.default.providers("localstorage"),r.length){case 1:if("object"===n(r[0])&&"string"==typeof r[0].api_key&&"string"==typeof r[0].delivery_token&&"string"==typeof r[0].environment)return this.headers={api_key:r[0].api_key,access_token:r[0].delivery_token},"object"==n(r[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,r[0].live_preview)),"string"==typeof r[0].branch&&void 0!==r[0].branch&&(this.headers.branch=r[0].branch),this.environment=r[0].environment,this;console.error("Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2])return this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2],this;console.error("Kindly provide valid string parameters.");case 4:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),this;case 5:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),r[4]&&"object"===n(r[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[4])),this;default:console.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:console.error("Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview,this.live_preview.content_type_uid=e.content_type_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){var t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid,body:{_method:"GET",environment:this.environment}},r=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(t,r)}},{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(){var e={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",only_last_activity:!0,environment:this.environment}};return(0,l.default)(e,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",environment:this.environment}};if(e)for(var r in e)t.body[r]=e[r];return(0,l.default)(t,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(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){return new Promise((function(r,i){var o=void 0,s=e.url,u=e.headers;return u["Content-Type"]="application/json; charset=UTF-8",u["X-User-Agent"]="contentstack-react-native/3.15.2",e.body&&"object"===n(e.body)&&(delete e.body._method,"object"===n(e.body.query)&&0===Object.keys(e.body.query).length&&delete e.body.query,o=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("&")}(e.body)),c(s+"?"+o,u,t,r,i,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,y=o.mergeDeep({method:"GET",headers:t,timeout:3e4},r);function f(o){if(0===l)i(o);else{var u=s;l-=1;var y=r.retryLimit-l;r.retryDelayOptions&&(r.retryDelayOptions.base?u=r.retryDelayOptions.base*y:r.retryDelayOptions.customBackoff&&(u=r.retryDelayOptions.customBackoff(y,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)}))}}(0,u.default)(e,y).then((function(e){var t=e.json();e.ok&&200===e.status?n(t):t.then((function(t){r.retryCondition&&r.retryCondition(e)?f(t):i(t)})).catch((function(){i({status:e.status,statusText:e.statusText})}))})).catch((function(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=y,t.resultWrapper=f,t.spreadResult=h,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,y=!!(n.entry_uid||n.singleEntry||n.asset_uid),p=l(c(n,y,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=f(t)),r(h(t))}catch(e){n(e)}}))}},m=function(r,i,a){r&&(0,o.default)(e.requestParams,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=f(r)),i(h(r))}catch(e){return a(e)}})),i(h(r))):Object.keys(o).length?i(o):(u||(r=f(r)),i(h(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)m(!0,r,i);else{try{if(e._query&&Array.isArray(e._query.include)&&e._query.include.length>0){var a=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);y?await d(a,s.entry,e.live_preview,e.requestParams,t):s.entries.forEach((async function(r){await d(a,r,e.live_preview,e.requestParams,t)}))}}catch(e){}await n.provider.set(p,s,(function(e){try{return e&&i(e),u||(s=f(s)),r(h(s))}catch(e){return i(e)}}))}}catch(e){return i(e)}})):m(!0,r,i)}));case 2:case 0:case void 0:case-1:return new Promise((function(e,t){m(!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=f(n)),e(h(n)))}catch(e){t(e)}}))})).then((function(){return new Promise((function(e,t){m(!0,e,t)}))})).catch((function(e){return new Promise((function(e,t){m(!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=y(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 y(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 f(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 h(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,u){var a=r.content_type_uid,c=r.management_token;await async function e(t,u,l){if(void 0!==u)if(Array.isArray(u))await Promise.all(u.map((function(r,n){return e(t,r,(function(e){u[n]=e}))})));else if(u._content_type_uid===a)try{var y=JSON.parse(JSON.stringify(i)),f=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);y.body.include=f,y.body.live_preview=r.hash,y.body.content_type_uid=a;var h=r.host.match(/^((http[s]?):(\/\/)?)?(.+)$/),d=(h[1]||"https://")+h[4],p=u.uid,v=d+"/v3/content_types/"+u._content_type_uid+"/entries/"+p;y.url=v,y.method="GET",delete y.headers.access_token,y.headers.authorization=c;var _=await(0,o.default)(y,s);_.entry._content_type_uid=a,_.entry.uid=p,l(_.entry)}catch(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,u[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;console.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(this,t)}console.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:console.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}console.error("Argument should be a String or an Array.")}},{key:"language",value:function(e){if(e&&"string"==typeof e)return this._query.locale=e,this;console.error("Argument should be a String.")}},{key:"addQuery",value:function(e,t){if(e&&t&&"string"==typeof e)return this._query[e]=t,this;console.error("First argument should be a String.")}},{key:"includeEmbeddedItems",value:function(){return this._query.include_embedded_items=["BASE"],this}},{key:"includeSchema",value:function(){return this._query.include_schema=!0,this}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeFallback",value:function(){return this._query.include_fallback=!0,this}},{key:"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;console.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(this,r)}console.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;console.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;console.error("Kindly provide valid parameters.")}},y=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;console.error("Kindly provide valid parameters.")}},f=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}},h=function(e){return function(t){if(t&&"string"==typeof t)return this._query[e]=t,this;console.error("Argument should be a string.")}},d=function(e){return function(t){if("number"==typeof t)return this._query[e]=t,this;console.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=y(!0),e.notExists=y(!1),e.ascending=h("asc"),e.descending=h("desc"),e.beforeUid=h("before_uid"),e.afterUid=h("after_uid"),e.skip=d("skip"),e.limit=d("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;console.error("Kindly provide valid parameters.")}},{key:"where",value:function(e,t){if(e&&"string"==typeof e)return this._query.query[e]=t,this;console.error("Kindly provide valid parameters.")}},{key:"count",value:function(){var e=this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version,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;console.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;console.error("Kindly provide valid parameters")}},{key:"includeReferenceContentTypeUID",value:function(){return this._query.include_reference_content_type_uid=!0,this}},{key:"includeCount",value:function(){return this._query.include_count=!0,this}},{key:"addParam",value:function(e,t){if(e&&t&&"string"==typeof e&&"string"==typeof t)return this._query[e]=t,this;console.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;console.error("Kindly provide valid parameters.")}},{key:"search",value:function(e){if(e&&"string"==typeof e)return this._query.typeahead=e,this;console.error("Kindly provide valid parameters.")}},{key:"find",value:function(e){var 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(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(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=f(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=f(r(304)),a=f(r(173)),c=f(r(566)),l=f(r(777)),y=f(r(900));function f(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var d=[408,429],p=function(){function e(){h(this,e),this.fetchOptions={retryLimit:5,retryCondition:function(e){return!!d.includes(e.status)}},this.config=s.mergeDeep({},o.default);for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];switch(r[0].region&&void 0!==r[0].region&&"us"!==r[0].region&&(this.config.host=r[0].region+"-cdn.contentstack.com"),r[0].fetchOptions&&void 0!==r[0].fetchOptions&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[0].fetchOptions)),this.cachePolicy=y.default.policies.IGNORE_CACHE,this.provider=y.default.providers("localstorage"),r.length){case 1:if("object"===n(r[0])&&"string"==typeof r[0].api_key&&"string"==typeof r[0].delivery_token&&"string"==typeof r[0].environment)return this.headers={api_key:r[0].api_key,access_token:r[0].delivery_token},"object"==n(r[0].live_preview)&&(this.live_preview=s.mergeDeep(this.config.live_preview,r[0].live_preview)),"string"==typeof r[0].branch&&void 0!==r[0].branch&&(this.headers.branch=r[0].branch),this.environment=r[0].environment,this;console.error("Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");case 3:if(console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2])return this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2],this;console.error("Kindly provide valid string parameters.");case 4:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),this;case 5:return console.warn("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 r[0]&&"string"==typeof r[1]&&"string"==typeof r[2]?(this.headers={api_key:r[0],access_token:r[1]},this.environment=r[2]):console.error("Kindly provide valid string parameters."),r[3]&&("string"==typeof r[3]&&void 0!==r[3]&&"us"!==r[3]?this.config.host=r[3]+"-cdn.contentstack.com":"object"===n(r[3])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[3]))),r[4]&&"object"===n(r[4])&&(this.fetchOptions=s.mergeDeep(this.fetchOptions,r[4])),this;default:console.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:console.error("Kindly provide the valid policy"),this}},{key:"livePreviewQuery",value:function(e){this.live_preview&&(this.live_preview.live_preview=e.live_preview,this.live_preview.content_type_uid=e.content_type_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){var t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types+this.content_type_uid,body:{_method:"GET",environment:this.environment}},r=s.mergeDeep(this.fetchOptions,e);return(0,l.default)(t,r)}},{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(){var e={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",only_last_activity:!0,environment:this.environment}};return(0,l.default)(e,this.fetchOptions)}},{key:"getContentTypes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={method:"POST",headers:this.headers,url:this.config.protocol+"://"+this.config.host+":"+this.config.port+"/"+this.config.version+this.config.urls.content_types,body:{_method:"GET",environment:this.environment}};if(e)for(var r in e)t.body[r]=e[r];return(0,l.default)(t,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(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})(); |
{ | ||
"name": "contentstack", | ||
"version": "3.15.1", | ||
"version": "3.15.2", | ||
"description": "Contentstack Javascript SDK", | ||
@@ -17,3 +17,3 @@ "homepage": "https://www.contentstack.com/", | ||
"test": "npm run test:e2e && npm run test:typescript", | ||
"test:e2e": "istanbul cover tape test/index.js | tap-html --out ./tap-html.html", | ||
"test:e2e": "tape test/index.js | tap-html --out ./tap-html.html", | ||
"test:typescript": "jest --config jest.config.js --testPathPattern=test/typescript", | ||
@@ -79,3 +79,3 @@ "automate": "node test.js", | ||
"clean-webpack-plugin": "^4.0.0", | ||
"compression-webpack-plugin": "1.0.1", | ||
"compression-webpack-plugin": "^10.0.0", | ||
"dotenv": "^16.0.0", | ||
@@ -85,3 +85,2 @@ "es3ify-loader": "0.2.0", | ||
"http-proxy-agent": "^3.0.0", | ||
"istanbul": "^0.4.5", | ||
"jest": "^27.5.1", | ||
@@ -95,3 +94,3 @@ "jest-html-reporters": "^2.1.7", | ||
"string-replace-loader": "1.3.0", | ||
"string-replace-webpack-plugin": "0.1.3", | ||
"tap": "^16.2.0", | ||
"tap-html": "^1.0.1", | ||
@@ -98,0 +97,0 @@ "tap-json": "1.0.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
288208
36
3