@artisan-commerce/products 0.5.5 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/build/main.bundle.js +2 -2
  2. package/build/report.html +2 -2
  3. package/build/src/index.d.ts +5 -0
  4. package/build/src/lib/common.d.ts +1 -0
  5. package/build/src/lib/getProductDetails/getProductDetails.d.ts +1 -3
  6. package/build/src/lib/getProducts/getProducts.d.ts +1 -3
  7. package/build/src/lib/getStoreDetails/getStoreDetails.d.ts +1 -3
  8. package/build/src/lib/registerModifiersForm/registerModifiersForm.d.ts +3 -0
  9. package/build/src/lib/registerModifiersForm/registerModifiersForm.test.d.ts +1 -0
  10. package/build/src/lib/registerModifiersForm/registerModifiersForm.types.d.ts +34 -0
  11. package/build/src/lib/validateProduct/validateProduct.d.ts +1 -0
  12. package/build/src/lib/validateProduct/validateProduct.test.d.ts +1 -0
  13. package/build/src/lib/validateProduct/validateProduct.types.d.ts +2 -0
  14. package/build/src/types/common.types.d.ts +5 -0
  15. package/build/src/types/modifiers.types.d.ts +57 -0
  16. package/build/src/utils/assertions/assertions.utils.d.ts +2 -0
  17. package/build/src/utils/common.utils.d.ts +1 -0
  18. package/build/src/utils/http/http.utils.d.ts +1 -3
  19. package/build/src/utils/http/request.utils.d.ts +1 -0
  20. package/build/src/utils/modifiers/common.utils.d.ts +12 -0
  21. package/build/src/utils/modifiers/form.utils.d.ts +3 -0
  22. package/build/src/utils/modifiers/handleChange.utils.d.ts +1 -0
  23. package/build/src/utils/modifiers/renderer.utils.d.ts +11 -0
  24. package/build/src/utils/modifiers/rendererTraversal.utils.d.ts +4 -0
  25. package/build/src/utils/modifiers/updateRenderer.utils.d.ts +5 -0
  26. package/build/src/utils/transformers/api.transformer.d.ts +2 -4
  27. package/build/src/utils/transformers/transformers.utils.d.ts +7 -0
  28. package/build/vendors.bundle.js +1 -1
  29. package/package.json +4 -4
@@ -1,8 +1,8 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("products",[],e):"object"==typeof exports?exports.products=e():t.products=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=22)}([function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(3),e),o(r(4),e),o(r(5),e),o(r(6),e),o(r(7),e),o(r(8),e),o(r(9),e),o(r(10),e),o(r(11),e),o(r(12),e),o(r(13),e),o(r(14),e)},function(t,e){var r={utf8:{stringToBytes:function(t){return r.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(r.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}};t.exports=r},function(t,e,r){(function(e){var n,o,i,u;n=r(20),o=r(1).utf8,i=r(1).bin,(u=function(t,r){var u=n.wordsToBytes(function(t){t.constructor==String?t=o.stringToBytes(t):void 0!==e&&"function"==typeof e.isBuffer&&e.isBuffer(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||(t=t.toString());var r=n.bytesToWords(t),i=8*t.length,u=[],a=1732584193,s=-271733879,c=-1732584194,f=271733878,l=-1009589776;r[i>>5]|=128<<24-i%32,r[15+(i+64>>>9<<4)]=i;for(var h=0;h<r.length;h+=16){for(var p=a,d=s,y=c,g=f,v=l,b=0;b<80;b++){if(b<16)u[b]=r[h+b];else{var w=u[b-3]^u[b-8]^u[b-14]^u[b-16];u[b]=w<<1|w>>>31}var A=(a<<5|a>>>27)+l+(u[b]>>>0)+(b<20?1518500249+(s&c|~s&f):b<40?1859775393+(s^c^f):b<60?(s&c|s&f|c&f)-1894007588:(s^c^f)-899497514);l=f,f=c,c=s<<30|s>>>2,s=a,a=A}a+=p,s+=d,c+=y,f+=g,l+=v}return[a,s,c,f,l]}(t));return r&&r.asBytes?u:r&&r.asString?i.bytesToString(u):n.bytesToHex(u)})._blocksize=16,u._digestsize=20,t.exports=u}).call(this,r(15).Buffer)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.QuestionTypes=e.DayOfWeekName=e.TaxType=e.PriceCategoryType=e.ProductType=void 0,function(t){t.PRODUCT="PRODUCT",t.MODIFIER="MODIFIER"}(e.ProductType||(e.ProductType={})),function(t){t.NORMAL="NORMAL",t.POINTS="POINTS"}(e.PriceCategoryType||(e.PriceCategoryType={})),function(t){t.IVA="IVA"}(e.TaxType||(e.TaxType={})),function(t){t.MONDAY="MONDAY",t.TUESDAY="TUESDAY",t.WEDNESDAY="WEDNESDAY",t.THURSDAY="THURSDAY",t.FRIDAY="FRIDAY",t.SATURDAY="SATURDAY",t.SUNDAY="SUNDAY"}(e.DayOfWeekName||(e.DayOfWeekName={})),function(t){t.BOOLEAN="BOOLEAN",t.RADIO="RADIO",t.CHECKBOX="CHECKBOX",t.QUANTITY="QUANTITY"}(e.QuestionTypes||(e.QuestionTypes={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceStatus=e.Days=e.DeliveryTimeUnit=void 0,function(t){t.MIN="min"}(e.DeliveryTimeUnit||(e.DeliveryTimeUnit={})),function(t){t.MONDAY="MONDAY",t.TUESDAY="TUESDAY",t.WEDNESDAY="WEDNESDAY",t.THURSDAY="THURSDAY",t.FRIDAY="FRIDAY",t.SATURDAY="SATURDAY",t.SUNDAY="SUNDAY",t.SPECIAL="SPECIAL"}(e.Days||(e.Days={})),function(t){t.INACTIVE="INACTIVE",t.ACTIVE="ACTIVE"}(e.ServiceStatus||(e.ServiceStatus={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,r){"use strict";(function(t){
1
+ !function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("products",[],r):"object"==typeof exports?exports.products=r():t.products=r()}(this,(function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=23)}([function(t,r,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,r,e,n){void 0===n&&(n=e),Object.defineProperty(t,n,{enumerable:!0,get:function(){return r[e]}})}:function(t,r,e,n){void 0===n&&(n=e),t[n]=r[e]}),o=this&&this.__exportStar||function(t,r){for(var e in t)"default"===e||r.hasOwnProperty(e)||n(r,t,e)};Object.defineProperty(r,"__esModule",{value:!0}),o(e(3),r),o(e(4),r),o(e(5),r),o(e(6),r),o(e(7),r),o(e(8),r),o(e(9),r),o(e(10),r),o(e(11),r),o(e(12),r),o(e(13),r),o(e(14),r),o(e(15),r)},function(t,r){var e={utf8:{stringToBytes:function(t){return e.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(e.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var r=[],e=0;e<t.length;e++)r.push(255&t.charCodeAt(e));return r},bytesToString:function(t){for(var r=[],e=0;e<t.length;e++)r.push(String.fromCharCode(t[e]));return r.join("")}}};t.exports=e},function(t,r,e){(function(r){var n,o,i,u;n=e(21),o=e(1).utf8,i=e(1).bin,(u=function(t,e){var u=n.wordsToBytes(function(t){t.constructor==String?t=o.stringToBytes(t):void 0!==r&&"function"==typeof r.isBuffer&&r.isBuffer(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||(t=t.toString());var e=n.bytesToWords(t),i=8*t.length,u=[],a=1732584193,s=-271733879,c=-1732584194,f=271733878,l=-1009589776;e[i>>5]|=128<<24-i%32,e[15+(i+64>>>9<<4)]=i;for(var h=0;h<e.length;h+=16){for(var p=a,d=s,y=c,v=f,g=l,b=0;b<80;b++){if(b<16)u[b]=e[h+b];else{var m=u[b-3]^u[b-8]^u[b-14]^u[b-16];u[b]=m<<1|m>>>31}var w=(a<<5|a>>>27)+l+(u[b]>>>0)+(b<20?1518500249+(s&c|~s&f):b<40?1859775393+(s^c^f):b<60?(s&c|s&f|c&f)-1894007588:(s^c^f)-899497514);l=f,f=c,c=s<<30|s>>>2,s=a,a=w}a+=p,s+=d,c+=y,f+=v,l+=g}return[a,s,c,f,l]}(t));return e&&e.asBytes?u:e&&e.asString?i.bytesToString(u):n.bytesToHex(u)})._blocksize=16,u._digestsize=20,t.exports=u}).call(this,e(16).Buffer)},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.QuestionTypes=r.DayOfWeekName=r.TaxType=r.PriceCategoryType=r.ProductType=void 0,function(t){t.PRODUCT="PRODUCT",t.MODIFIER="MODIFIER"}(r.ProductType||(r.ProductType={})),function(t){t.NORMAL="NORMAL",t.POINTS="POINTS"}(r.PriceCategoryType||(r.PriceCategoryType={})),function(t){t.IVA="IVA"}(r.TaxType||(r.TaxType={})),function(t){t.MONDAY="MONDAY",t.TUESDAY="TUESDAY",t.WEDNESDAY="WEDNESDAY",t.THURSDAY="THURSDAY",t.FRIDAY="FRIDAY",t.SATURDAY="SATURDAY",t.SUNDAY="SUNDAY"}(r.DayOfWeekName||(r.DayOfWeekName={})),function(t){t.BOOLEAN="BOOLEAN",t.RADIO="RADIO",t.CHECKBOX="CHECKBOX",t.COUNTER="COUNTER"}(r.QuestionTypes||(r.QuestionTypes={}))},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ServiceStatus=r.Days=r.DeliveryTimeUnit=void 0,function(t){t.MIN="min"}(r.DeliveryTimeUnit||(r.DeliveryTimeUnit={})),function(t){t.MONDAY="MONDAY",t.TUESDAY="TUESDAY",t.WEDNESDAY="WEDNESDAY",t.THURSDAY="THURSDAY",t.FRIDAY="FRIDAY",t.SATURDAY="SATURDAY",t.SUNDAY="SUNDAY",t.SPECIAL="SPECIAL"}(r.Days||(r.Days={})),function(t){t.INACTIVE="INACTIVE",t.ACTIVE="ACTIVE"}(r.ServiceStatus||(r.ServiceStatus={}))},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0})},function(t,r,e){"use strict";(function(t){
2
2
  /*!
3
3
  * The buffer module from node.js, for the browser.
4
4
  *
5
5
  * @author Feross Aboukhadijeh <http://feross.org>
6
6
  * @license MIT
7
7
  */
8
- var n=r(17),o=r(18),i=r(19);function u(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(u()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=s.prototype:(null===t&&(t=new s(e)),t.length=e),t}function s(t,e,r){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);s.TYPED_ARRAY_SUPPORT?(t=e).__proto__=s.prototype:t=h(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!s.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=a(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(s.isBuffer(e)){var r=0|p(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):h(t,e);if("Buffer"===e.type&&i(e.data))return h(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(f(e),t=a(t,e<0?0:0|p(e)),!s.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function h(t,e){var r=e.length<0?0:0|p(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return k(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return _(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return I(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,o);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,o){var i,u=1,a=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,a/=2,s/=2,r/=2}function c(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(o){var f=-1;for(i=r;i<a;i++)if(c(t,i)===c(e,-1===f?0:i-f)){if(-1===f&&(f=i),i-f+1===s)return f*u}else-1!==f&&(i-=i-f),f=-1}else for(r+s>a&&(r=a-s),i=r;i>=0;i--){for(var l=!0,h=0;h<s;h++)if(c(t,i+h)!==c(e,h)){l=!1;break}if(l)return i}return-1}function w(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u<n;++u){var a=parseInt(e.substr(2*u,2),16);if(isNaN(a))return u;t[r+u]=a}return u}function A(t,e,r,n){return G(k(e,t.length-r),t,r,n)}function m(t,e,r,n){return G(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return m(t,e,r,n)}function T(t,e,r,n){return G(F(e),t,r,n)}function P(t,e,r,n){return G(function(t,e){for(var r,n,o,i=[],u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function I(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,u,a,s,c=t[o],f=null,l=c>239?4:c>223?3:c>191?2:1;if(o+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(i=t[o+1]))&&(s=(31&c)<<6|63&i)>127&&(f=s);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(s=(15&c)<<12|(63&i)<<6|63&u)>2047&&(s<55296||s>57343)&&(f=s);break;case 4:i=t[o+1],u=t[o+2],a=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&a)&&(s=(15&c)<<18|(63&i)<<12|(63&u)<<6|63&a)>65535&&s<1114112&&(f=s)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=s,e.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},e.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=u(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,r){return c(null,t,e,r)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,r){return function(t,e,r,n){return f(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},s.allocUnsafe=function(t){return l(null,t)},s.allocUnsafeSlow=function(t){return l(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=s.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var u=t[r];if(!s.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,o),o+=u.length}return n},s.byteLength=d,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?S(this,0,t):y.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t,e,r,n,o){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(r>>>=0)-(e>>>=0),a=Math.min(i,u),c=this.slice(n,o),f=t.slice(e,r),l=0;l<a;++l)if(c[l]!==f[l]){i=c[l],u=f[l];break}return i<u?-1:u<i?1:0},s.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return A(this,t,e,r);case"ascii":return m(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function _(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function R(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function O(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=L(t[i]);return o}function D(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function U(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function x(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function C(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function Y(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(t,e,r,n,i){return i||Y(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return i||Y(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),s.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=s.prototype;else{var o=e-t;r=new s(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},s.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},s.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||U(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){e||U(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||B(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||B(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):C(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):C(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);B(this,t,e,r,o-1,-o)}var i=0,u=1,a=0;for(this[e]=255&t;++i<r&&(u*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/u>>0)-a&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);B(this,t,e,r,o-1,-o)}var i=r-1,u=1,a=0;for(this[e+i]=255&t;--i>=0&&(u*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/u>>0)-a&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):C(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):C(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,r){return M(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return M(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var u=s.isBuffer(t)?t:k(new s(t,n).toString()),a=u.length;for(i=0;i<r-e;++i)this[i+e]=u[i%a]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function k(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],u=0;u<n;++u){if((r=t.charCodeAt(u))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(16))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),u=n[0],a=n[1],s=new i(function(t,e,r){return 3*(e+r)/4-r}(0,u,a)),f=0,l=a>0?u-4:u;for(r=0;r<l;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],s[f++]=e>>16&255,s[f++]=e>>8&255,s[f++]=255&e;2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,s[f++]=255&e);1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,s[f++]=e>>8&255,s[f++]=255&e);return s},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],u=0,a=r-o;u<a;u+=16383)i.push(f(t,u,u+16383>a?a:u+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=u.length;a<s;++a)n[a]=u[a],o[u.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,r){for(var o,i,u=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),u.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,o){var i,u,a=8*o-n-1,s=(1<<a)-1,c=s>>1,f=-7,l=r?o-1:0,h=r?-1:1,p=t[e+l];for(l+=h,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=256*i+t[e+l],l+=h,f-=8);for(u=i&(1<<-f)-1,i>>=-f,f+=n;f>0;u=256*u+t[e+l],l+=h,f-=8);if(0===i)i=1-c;else{if(i===s)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,n),i-=c}return(p?-1:1)*u*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var u,a,s,c=8*i-o-1,f=(1<<c)-1,l=f>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,u=f):(u=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-u))<1&&(u--,s*=2),(e+=u+l>=1?h/s:h*Math.pow(2,1-l))*s>=2&&(u++,s/=2),u+l>=f?(a=0,u=f):u+l>=1?(a=(e*s-1)*Math.pow(2,o),u+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[r+p]=255&a,p+=d,a/=256,o-=8);for(u=u<<o|a,c+=o;c>0;t[r+p]=255&u,p+=d,u/=256,c-=8);t[r+p-d]|=128*y}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){var r,n;r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&n.rotl(t,8)|4278255360&n.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=n.endian(t[e]);return t},randomBytes:function(t){for(var e=[];t>0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],r=0,n=0;r<t.length;r++,n+=8)e[n>>>5]|=t[r]<<24-n%32;return e},wordsToBytes:function(t){for(var e=[],r=0;r<32*t.length;r+=8)e.push(t[r>>>5]>>>24-r%32&255);return e},bytesToHex:function(t){for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},bytesToBase64:function(t){for(var e=[],n=0;n<t.length;n+=3)for(var o=t[n]<<16|t[n+1]<<8|t[n+2],i=0;i<4;i++)8*n+6*i<=8*t.length?e.push(r.charAt(o>>>6*(3-i)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],n=0,o=0;n<t.length;o=++n%4)0!=o&&e.push((r.indexOf(t.charAt(n-1))&Math.pow(2,-2*o+8)-1)<<2*o|r.indexOf(t.charAt(n))>>>6-2*o);return e}},t.exports=n},,function(t,e,r){"use strict";r.r(e),r.d(e,"getCategories",(function(){return d})),r.d(e,"getProductDetails",(function(){return rt})),r.d(e,"getProducts",(function(){return at})),r.d(e,"getRecommendedProducts",(function(){return st})),r.d(e,"getRelatedProducts",(function(){return ct})),r.d(e,"getStoreDetails",(function(){return dt})),r.d(e,"initProducts",(function(){return vt})),r.d(e,"getProductTotals",(function(){return bt})),r.d(e,"transformers",(function(){return o})),r.d(e,"assertions",(function(){return n}));var n={};r.r(n),r.d(n,"isBaseProduct",(function(){return a})),r.d(n,"isProductDetails",(function(){return s})),r.d(n,"isCartProduct",(function(){return c}));var o={};r.r(o),r.d(o,"toCartProduct",(function(){return l}));var i=r(0),u=function(t){return Object.keys(t)},a=function(t){var e=t.attributes,r=t.available,n=t.description,o=t.name,a=t.images,s=t.prices,c=t.productId,f=t.sponsored,l=t.status,h=t.type;return"boolean"==typeof e.showInMenu&&("boolean"==typeof r&&("boolean"==typeof f&&("string"==typeof n&&("string"==typeof o&&("string"==typeof c&&(!("object"!=typeof s||"object"==typeof s&&Object.keys(s).length<1)&&(!!Array.isArray(a)&&((!l||"ACTIVE"===l||"INACTIVE"===l)&&!!u(i.ProductType).includes(h)))))))))},s=function(t){if(!a(t))return!1;var e=t.isPriceVip,r=t.manufacturer,n=t.maxAmountForSale,o=t.schedule,i=t.questions;return"boolean"==typeof e&&(!!Array.isArray(r)&&("number"==typeof n&&(!!Array.isArray(o)&&!!Array.isArray(i))))},c=function(t){if(!s(t))return!1;var e=t.hash,r=t.createdAt,n=t.updatedAt,o=t.alerts,a=t.amount,c=t.priceCategory,f=t.comment,l=t.questionsAndAnswers;return"string"==typeof e&&("string"==typeof r&&("string"==typeof n&&(!!Array.isArray(o)&&("number"==typeof a&&("string"==typeof f&&(!!u(i.PriceCategoryType).includes(c)&&!!Array.isArray(l)))))))},f=function(){return(f=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},l=function(t,e){if(void 0===e&&(e={}),c(t))return f(f({},t),e);if(s(t))return h(t,e);var r=p(t);return h(r,e)},h=function(t,e){return void 0===e&&(e={}),f(f(f({},t),{questionsAndAnswers:[],amount:0,priceCategory:i.PriceCategoryType.NORMAL,comment:"",alerts:[],hash:"",createdAt:"",updatedAt:""}),e)},p=function(t,e){return void 0===e&&(e={}),f(f(f({},t),{isPriceVip:!1,manufacturer:[],maxAmountForSale:0,questions:[],schedule:[]}),e)},d=function(){console.log("Not supported yet")},y={CLIENT_NAME:"Trade S.A.",DEFAULT_REQUEST_TIMEOUT:1e4,EXCLUDED_LOGGER_STATUS_CODES:[422],INCLUDED_LOGGER_ENVS:["staging","production"],INCLUDED_INTL_LOG_ENVS:[""],COUNTRY:{NAME:"Ecuador",CODE:"593",LANGUAGE:"es"},DEFAULT_API_TIMEOUT:3e5,HEADERS:["accountId"],FILTERS:["vendorId","storeId","catalogueId","categoryId","productId"],GROUPS:["CATEGORIES","TAGS"],ORDER_FIELDS:["type","sort"],ORDER_TYPES:["ALPHABETIC","PRICE","PREDEFINED"],ORDER_SORTS:["ASC","DESC"],PAGINATION:["page","vendor","store","catalogue","category","product"],ADDITIONAL_FILTERS:["price","query","tags","manufacturerId","weight","dimensions"]},g=function(){return(g=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},v=y.DEFAULT_API_TIMEOUT,b={artisanApp:void 0,timeout:v,apiCache:{},expiresAt:(new Date).getTime()+v};Object.freeze(b);var w=g({},b);Object.seal(w);var A=function(t){w=g(g({},w),t)},m=function(){return g({},w)},E=function(t,e,r){void 0===r&&(r="");var n=e.headers.accountId,o=t.filterBy,i=o.vendorId,u=o.storeId,a=o.catalogueId;!function(t,e){void 0===e&&(e="");var r=m().accountId;if(void 0===t&&void 0===r)throw new Error("@artisan-commerce/products: AccountId must be defined. Either provide a global accountId or at the function call level. "+e)}(n,r),function(t,e){void 0===e&&(e="");var r=m().vendorId;if(!(Array.isArray(t)&&t.length||void 0!==t||void 0!==r))throw new Error("@artisan-commerce/products: vendorId must be defined. Either provide a global vendorId or at the function call level. "+e)}(i,r),function(t,e){void 0===e&&(e="");var r=m().storeId;if(!(Array.isArray(t)&&t.length||void 0!==t||void 0!==r))throw new Error("@artisan-commerce/products: storeId must be defined. Either provide a global storeId or at the function call level. "+e)}(u,r),function(t,e){void 0===e&&(e="");var r=m().catalogueId;if(!(Array.isArray(t)&&t.length||void 0!==t||void 0!==r))throw new Error("@artisan-commerce/products: catalogueId must be defined. Either provide a global catalogueId or at the function call level. "+e)}(a,r)},T=function(){return(T=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},P=function(t,e,r){var n=null==e?void 0:e.message;try{n=e?JSON.parse(e.message):e}catch(t){}return{data:t,hints:T(T({},r.headers),r.query),config:r,error:n}},I=function(){return(I=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},S=function(){return(S=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},_=y.PAGINATION,R=y.ADDITIONAL_FILTERS,O=y.ORDER_FIELDS,D=y.FILTERS,U=y.GROUPS,B=y.ORDER_SORTS,x=y.ORDER_TYPES,C=function(t){var e=m(),r=e.vendorId,n=e.storeId,o=m(),i=o.catalogueId,u=o.categoryId,a=o.productId,s=S(S({},{vendorId:r,storeId:n,catalogueId:i,categoryId:u,productId:a}),t.filterBy),c=L(s,D,"filter"),f=F(c);return S(S({},t),{filterBy:f})},Y=function(t){var e=k(t,U,"groupBy");return S({},e)},M=function(t){var e=t.orderBy,r=void 0===e?{}:e,n=L(r,O,"orderBy"),o=S({},n),i=r.sort,u=r.type;return u&&!x.includes(u)&&console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig order type "+u),x.includes(u)||(delete o.type,o.type="ALPHABETIC"),i&&!B.includes(i)&&console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig order sort "+i),B.includes(i)||(delete o.sort,o.sort="ASC"),S(S({},t),{orderBy:o})},N=function(t){var e=t.pagination,r=L(void 0===e?{}:e,_,"pagination");return S(S({},t),{pagination:r})},j=function(t){var e=t.additionalFilters,r=L(void 0===e?{}:e,R,"additionalFilters");return S(S({},t),{additionalFilters:r})},L=function(t,e,r){var n=S({},t);return Object.keys(n).forEach((function(t){void 0!==n[t]?e.includes(t)||(console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig "+r+" "+t),delete n[t]):delete n[t]})),n},k=function(t,e,r){var n=S({},t),o=t[r];return void 0===o||e.includes(o)||(console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig "+r+" "+o),delete n[r]),n},F=function(t){var e=S({},t);return Object.entries(e).forEach((function(t){var r=t[0],n=t[1];void 0===n||Array.isArray(n)&&!n.length?delete e[r]:Array.isArray(n)&&G(n[0])||G(n)||(console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig filter value: "+r+" = "+n),delete e[r])})),e},G=function(t){var e=typeof t;return"number"===e||"string"===e},H=r(2),V=r.n(H),q=function(){return(q=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},z=function(t){return Object.entries(t).reduce((function(t,e){var r,n=e[0],o=e[1],i=o;return Array.isArray(o)&&(i=o.reduce((function(t,e){return t+","+e}))),q(q({},t),"catalogueId"===n?{channelId:i}:((r={})[n]=i,r))}),{})},W=function(t,e){for(var r=t,n=0,o=Object.entries(e);n<o.length;n++){var i=o[n],u=i[0],a=i[1],s=new RegExp("/:"+u,"g");r=r.replace(s,"/"+a)}return r},Q=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}s((n=n.apply(t,e||[])).next())}))},X=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},J=function(t,e,r,n){return Q(void 0,void 0,void 0,(function(){var o,i,u,a,s,c,f;return X(this,(function(l){switch(l.label){case 0:if(e=function(t){var e=C(t),r=Y(e),n=M(r),o=N(n);return j(o)}(e),E(e,r),o=function(t,e,r){var n,o=e.filterBy,i=e.groupBy,u=z(o),a=q(q({},u),{groupBy:i});i||delete a.groupBy;var s=W(t,r.params),c=(null!==(n=m().artisanApp)&&void 0!==n?n:{}).apiURL,f=Object.entries(a).reduce((function(t,e,r){var n=e[0],o=e[1];return void 0===o?t:t+(r?"&":"")+n+"="+o}),c+"/"+s+"?");return q(q({},r),{url:f,query:a})}(t,e,r),p=o.url,i=V()(p),u=function(t){return m().apiCache[t]}(i),h=m().expiresAt,(a=(new Date).getTime()>=h)&&function(){var t=m().timeout,e=void 0===t?0:t;A({apiCache:I({},b.apiCache),expiresAt:(new Date).getTime()+e})}(),u&&!a)return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,n(o)];case 2:return s=l.sent(),f=P(s,void 0,o),function(t,e){var r,n=m().apiCache,o=I(I({},n),((r={})[t]=e,r));A({apiCache:o})}(i,f),[2,f];case 3:return c=l.sent(),[2,f=P(void 0,c,o)];case 4:return[2,u]}var h,p}))}))},K=function(t){return Q(void 0,void 0,void 0,(function(){var e,r,n,o,i,u;return X(this,(function(a){switch(a.label){case 0:e=t.url,r=t.headers,n=t.body,"{}"===(o={headers:r,body:JSON.stringify(n)}).body&&delete o.body,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,fetch(e,o).then((function(t){return t.json()}))];case 2:return i=a.sent(),[3,4];case 3:return u=a.sent(),i={code:null,status:"failed",message:u.message,stack:u.stack},[3,4];case 4:if(i.code<200||i.code>299)throw new Error(JSON.stringify({code:i.code,status:i.status,message:i.message,warnings:i.warning,stack:i.stack}));return[2,i.data]}}))}))},Z=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}s((n=n.apply(t,e||[])).next())}))},$=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},tt=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}s((n=n.apply(t,e||[])).next())}))},et=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},rt=function(t,e){return tt(void 0,void 0,void 0,(function(){return et(this,(function(r){switch(r.label){case 0:return[4,J("products/:productId",e,{headers:{},params:{productId:t},query:{},body:{}},(function(t){return tt(void 0,void 0,void 0,(function(){return et(this,(function(e){switch(e.label){case 0:return[4,(r=t,Z(void 0,void 0,void 0,(function(){return $(this,(function(t){switch(t.label){case 0:return[4,K(r)];case 1:return[2,t.sent()]}}))})))];case 1:return[2,e.sent()]}var r}))}))}))];case 1:return[2,r.sent()]}}))}))},nt=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}s((n=n.apply(t,e||[])).next())}))},ot=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},it=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}s((n=n.apply(t,e||[])).next())}))},ut=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},at=function(t){return it(void 0,void 0,void 0,(function(){return ut(this,(function(e){switch(e.label){case 0:return[4,J("products",t,{headers:{},params:{},query:{},body:{}},(function(t){return it(void 0,void 0,void 0,(function(){return ut(this,(function(e){switch(e.label){case 0:return[4,(r=t,nt(void 0,void 0,void 0,(function(){return ot(this,(function(t){switch(t.label){case 0:return[4,K(r)];case 1:return[2,t.sent()]}}))})))];case 1:return[2,e.sent()]}var r}))}))}))];case 1:return[2,e.sent()]}}))}))},st=function(){console.log("Not implemented yet")},ct=function(){console.log("not implemented yet")},ft=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}s((n=n.apply(t,e||[])).next())}))},lt=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},ht=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,a)}s((n=n.apply(t,e||[])).next())}))},pt=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},dt=function(t){return ht(void 0,void 0,void 0,(function(){return pt(this,(function(e){switch(e.label){case 0:return[4,J("stores/details",t,{headers:{},params:{},query:{},body:{}},(function(t){return ht(void 0,void 0,void 0,(function(){return pt(this,(function(e){switch(e.label){case 0:return[4,(r=t,ft(void 0,void 0,void 0,(function(){return lt(this,(function(t){switch(t.label){case 0:return[4,K(r)];case 1:return[2,t.sent()]}}))})))];case 1:return[2,e.sent()]}var r}))}))}))];case 1:return[2,e.sent()]}}))}))},yt=function(){return(yt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},gt=!1,vt=function(t,e){if(void 0===e&&(e={}),gt)console.warn("artisan-commerce/products: initProducts has been called more than once. This behaviour will very likely result in unexpected outcomes so its call was skipped. Please make sure initProducts is only called once");else{if(A(yt({artisanApp:t},e)),void 0!==e.timeout){var r=(new Date).getTime()+e.timeout;A({expiresAt:r})}"undefined"==typeof window||(gt=!0)}},bt=function(t){return{grossPrice:At(t),totalDiscounts:mt(t),totalTaxes:wt(t),netPrice:Et(t)}},wt=function(t){var e=l(t),r=e.prices,n=e.amount,o=e.priceCategory,i=r[o],u=i.taxes,a=i.grossPrice,s=Pt(u,a);return e.questionsAndAnswers.reduce((function(t,e){return t+e.answers.reduce((function(t,e){var r=e.prices,n=e.amount,i=r[o],u=i.taxes,a=i.grossPrice;return t+n*Pt(u,a)}),0)}),0)+s*n},At=function(t){return Tt(t,"grossPrice")},mt=function(t){return 0},Et=function(t){return Tt(t,"netPrice")},Tt=function(t,e){var r=l(t),n=r.prices,o=r.amount,i=r.priceCategory,u=n[i][e];return r.questionsAndAnswers.reduce((function(t,r){return t+r.answers.reduce((function(t,r){var n=r.prices;return t+r.amount*n[i][e]}),0)}),0)+u*o},Pt=function(t,e){return t.reduce((function(t,r){return t+r.percentage/100*e}),0)}}])}));
8
+ var n=e(18),o=e(19),i=e(20);function u(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,r){if(u()<r)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=s.prototype:(null===t&&(t=new s(r)),t.length=r),t}function s(t,r,e){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return c(this,t,r,e)}function c(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);s.TYPED_ARRAY_SUPPORT?(t=r).__proto__=s.prototype:t=h(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(r,e),o=(t=a(t,n)).write(r,e);o!==n&&(t=t.slice(0,o));return t}(t,r,e):function(t,r){if(s.isBuffer(r)){var e=0|p(r.length);return 0===(t=a(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?a(t,0):h(t,r);if("Buffer"===r.type&&i(r.data))return h(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,r){if(f(r),t=a(t,r<0?0:0|p(r)),!s.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function h(t,r){var e=r.length<0?0:0|p(r.length);t=a(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function p(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function d(t,r){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return F(t).length;default:if(n)return k(t).length;r=(""+r).toLowerCase(),n=!0}}function y(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return _(this,r,e);case"utf8":case"utf-8":return I(this,r,e);case"ascii":return R(this,r,e);case"latin1":case"binary":return S(this,r,e);case"base64":return O(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function g(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=s.from(r,n)),s.isBuffer(r))return 0===r.length?-1:b(t,r,e,n,o);if("number"==typeof r)return r&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):b(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,r,e,n,o){var i,u=1,a=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,a/=2,s/=2,e/=2}function c(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(o){var f=-1;for(i=e;i<a;i++)if(c(t,i)===c(r,-1===f?0:i-f)){if(-1===f&&(f=i),i-f+1===s)return f*u}else-1!==f&&(i-=i-f),f=-1}else for(e+s>a&&(e=a-s),i=e;i>=0;i--){for(var l=!0,h=0;h<s;h++)if(c(t,i+h)!==c(r,h)){l=!1;break}if(l)return i}return-1}function m(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n))>o&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u<n;++u){var a=parseInt(r.substr(2*u,2),16);if(isNaN(a))return u;t[e+u]=a}return u}function w(t,r,e,n){return q(k(r,t.length-e),t,e,n)}function A(t,r,e,n){return q(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function E(t,r,e,n){return A(t,r,e,n)}function T(t,r,e,n){return q(F(r),t,e,n)}function P(t,r,e,n){return q(function(t,r){for(var e,n,o,i=[],u=0;u<t.length&&!((r-=2)<0);++u)e=t.charCodeAt(u),n=e>>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function O(t,r,e){return 0===r&&e===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(r,e))}function I(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i,u,a,s,c=t[o],f=null,l=c>239?4:c>223?3:c>191?2:1;if(o+l<=e)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(i=t[o+1]))&&(s=(31&c)<<6|63&i)>127&&(f=s);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(s=(15&c)<<12|(63&i)<<6|63&u)>2047&&(s<55296||s>57343)&&(f=s);break;case 4:i=t[o+1],u=t[o+2],a=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&a)&&(s=(15&c)<<18|(63&i)<<12|(63&u)<<6|63&a)>65535&&s<1114112&&(f=s)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=l}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return e}(n)}r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=u(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,r,e){return c(null,t,r,e)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,r,e){return function(t,r,e,n){return f(r),r<=0?a(t,r):void 0!==e?"string"==typeof n?a(t,r).fill(e,n):a(t,r).fill(e):a(t,r)}(null,t,r,e)},s.allocUnsafe=function(t){return l(null,t)},s.allocUnsafeSlow=function(t){return l(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,r){if(!s.isBuffer(t)||!s.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,r){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=s.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var u=t[e];if(!s.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,o),o+=u.length}return n},s.byteLength=d,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)v(this,r,r+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)v(this,r,r+3),v(this,r+1,r+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)v(this,r,r+7),v(this,r+1,r+6),v(this,r+2,r+5),v(this,r+3,r+4);return this},s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?I(this,0,t):y.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t,r,e,n,o){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),a=Math.min(i,u),c=this.slice(n,o),f=t.slice(r,e),l=0;l<a;++l)if(c[l]!==f[l]){i=c[l],u=f[l];break}return i<u?-1:u<i?1:0},s.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},s.prototype.indexOf=function(t,r,e){return g(this,t,r,e,!0)},s.prototype.lastIndexOf=function(t,r,e){return g(this,t,r,e,!1)},s.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||e>o)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return m(this,t,r,e);case"utf8":case"utf-8":return w(this,t,r,e);case"ascii":return A(this,t,r,e);case"latin1":case"binary":return E(this,t,r,e);case"base64":return T(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function R(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(127&t[o]);return n}function S(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function _(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=L(t[i]);return o}function D(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function C(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function x(t,r,e,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function U(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function B(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>8*(n?o:3-o)&255}function Y(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function j(t,r,e,n,i){return i||Y(t,0,e,4),o.write(t,r,e,n,23,4),e+4}function N(t,r,e,n,i){return i||Y(t,0,e,8),o.write(t,r,e,n,52,8),e+8}s.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),s.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=s.prototype;else{var o=r-t;e=new s(o,void 0);for(var i=0;i<o;++i)e[i]=this[i+t]}return e},s.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||C(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n},s.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||C(t,r,this.length);for(var n=this[t+--r],o=1;r>0&&(o*=256);)n+=this[t+--r]*o;return n},s.prototype.readUInt8=function(t,r){return r||C(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,r){return r||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,r){return r||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,r){return r||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,r){return r||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||C(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*r)),n},s.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||C(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},s.prototype.readInt8=function(t,r){return r||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,r){r||C(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},s.prototype.readInt16BE=function(t,r){r||C(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},s.prototype.readInt32LE=function(t,r){return r||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,r){return r||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,r){return r||C(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,r){return r||C(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,r){return r||C(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,r){return r||C(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||x(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i<e&&(o*=256);)this[r+i]=t/o&255;return r+e},s.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||x(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;--o>=0&&(i*=256);)this[r+o]=t/i&255;return r+e},s.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},s.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):U(this,t,r,!0),r+2},s.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):U(this,t,r,!1),r+2},s.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):B(this,t,r,!0),r+4},s.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):B(this,t,r,!1),r+4},s.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);x(this,t,r,e,o-1,-o)}var i=0,u=1,a=0;for(this[r]=255&t;++i<e&&(u*=256);)t<0&&0===a&&0!==this[r+i-1]&&(a=1),this[r+i]=(t/u>>0)-a&255;return r+e},s.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);x(this,t,r,e,o-1,-o)}var i=e-1,u=1,a=0;for(this[r+i]=255&t;--i>=0&&(u*=256);)t<0&&0===a&&0!==this[r+i+1]&&(a=1),this[r+i]=(t/u>>0)-a&255;return r+e},s.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},s.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):U(this,t,r,!0),r+2},s.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):U(this,t,r,!1),r+2},s.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):B(this,t,r,!0),r+4},s.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||x(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):B(this,t,r,!1),r+4},s.prototype.writeFloatLE=function(t,r,e){return j(this,t,r,!0,e)},s.prototype.writeFloatBE=function(t,r,e){return j(this,t,r,!1,e)},s.prototype.writeDoubleLE=function(t,r,e){return N(this,t,r,!0,e)},s.prototype.writeDoubleBE=function(t,r,e){return N(this,t,r,!1,e)},s.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o,i=n-e;if(this===t&&e<r&&r<n)for(o=i-1;o>=0;--o)t[o+r]=this[o+e];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+r]=this[o+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+i),r);return i},s.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var i;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i<e;++i)this[i]=t;else{var u=s.isBuffer(t)?t:k(new s(t,n).toString()),a=u.length;for(i=0;i<e-r;++i)this[i+r]=u[i%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function k(t,r){var e;r=r||1/0;for(var n=t.length,o=null,i=[],u=0;u<n;++u){if((e=t.charCodeAt(u))>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}}).call(this,e(17))},function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r,e){"use strict";r.byteLength=function(t){var r=c(t),e=r[0],n=r[1];return 3*(e+n)/4-n},r.toByteArray=function(t){var r,e,n=c(t),u=n[0],a=n[1],s=new i(function(t,r,e){return 3*(r+e)/4-e}(0,u,a)),f=0,l=a>0?u-4:u;for(e=0;e<l;e+=4)r=o[t.charCodeAt(e)]<<18|o[t.charCodeAt(e+1)]<<12|o[t.charCodeAt(e+2)]<<6|o[t.charCodeAt(e+3)],s[f++]=r>>16&255,s[f++]=r>>8&255,s[f++]=255&r;2===a&&(r=o[t.charCodeAt(e)]<<2|o[t.charCodeAt(e+1)]>>4,s[f++]=255&r);1===a&&(r=o[t.charCodeAt(e)]<<10|o[t.charCodeAt(e+1)]<<4|o[t.charCodeAt(e+2)]>>2,s[f++]=r>>8&255,s[f++]=255&r);return s},r.fromByteArray=function(t){for(var r,e=t.length,o=e%3,i=[],u=0,a=e-o;u<a;u+=16383)i.push(f(t,u,u+16383>a?a:u+16383));1===o?(r=t[e-1],i.push(n[r>>2]+n[r<<4&63]+"==")):2===o&&(r=(t[e-2]<<8)+t[e-1],i.push(n[r>>10]+n[r>>4&63]+n[r<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=u.length;a<s;++a)n[a]=u[a],o[u.charCodeAt(a)]=a;function c(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function f(t,r,e){for(var o,i,u=[],a=r;a<e;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),u.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,e,n,o){var i,u,a=8*o-n-1,s=(1<<a)-1,c=s>>1,f=-7,l=e?o-1:0,h=e?-1:1,p=t[r+l];for(l+=h,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=256*i+t[r+l],l+=h,f-=8);for(u=i&(1<<-f)-1,i>>=-f,f+=n;f>0;u=256*u+t[r+l],l+=h,f-=8);if(0===i)i=1-c;else{if(i===s)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,n),i-=c}return(p?-1:1)*u*Math.pow(2,i-n)},r.write=function(t,r,e,n,o,i){var u,a,s,c=8*i-o-1,f=(1<<c)-1,l=f>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,u=f):(u=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-u))<1&&(u--,s*=2),(r+=u+l>=1?h/s:h*Math.pow(2,1-l))*s>=2&&(u++,s/=2),u+l>=f?(a=0,u=f):u+l>=1?(a=(r*s-1)*Math.pow(2,o),u+=l):(a=r*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[e+p]=255&a,p+=d,a/=256,o-=8);for(u=u<<o|a,c+=o;c>0;t[e+p]=255&u,p+=d,u/=256,c-=8);t[e+p-d]|=128*y}},function(t,r){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},function(t,r){var e,n;e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(t,r){return t<<r|t>>>32-r},rotr:function(t,r){return t<<32-r|t>>>r},endian:function(t){if(t.constructor==Number)return 16711935&n.rotl(t,8)|4278255360&n.rotl(t,24);for(var r=0;r<t.length;r++)t[r]=n.endian(t[r]);return t},randomBytes:function(t){for(var r=[];t>0;t--)r.push(Math.floor(256*Math.random()));return r},bytesToWords:function(t){for(var r=[],e=0,n=0;e<t.length;e++,n+=8)r[n>>>5]|=t[e]<<24-n%32;return r},wordsToBytes:function(t){for(var r=[],e=0;e<32*t.length;e+=8)r.push(t[e>>>5]>>>24-e%32&255);return r},bytesToHex:function(t){for(var r=[],e=0;e<t.length;e++)r.push((t[e]>>>4).toString(16)),r.push((15&t[e]).toString(16));return r.join("")},hexToBytes:function(t){for(var r=[],e=0;e<t.length;e+=2)r.push(parseInt(t.substr(e,2),16));return r},bytesToBase64:function(t){for(var r=[],n=0;n<t.length;n+=3)for(var o=t[n]<<16|t[n+1]<<8|t[n+2],i=0;i<4;i++)8*n+6*i<=8*t.length?r.push(e.charAt(o>>>6*(3-i)&63)):r.push("=");return r.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var r=[],n=0,o=0;n<t.length;o=++n%4)0!=o&&r.push((e.indexOf(t.charAt(n-1))&Math.pow(2,-2*o+8)-1)<<2*o|e.indexOf(t.charAt(n))>>>6-2*o);return r}},t.exports=n},,function(t,r,e){"use strict";e.r(r),e.d(r,"getCategories",(function(){return A})),e.d(r,"getProductDetails",(function(){return ht})),e.d(r,"getProducts",(function(){return gt})),e.d(r,"getRecommendedProducts",(function(){return bt})),e.d(r,"getRelatedProducts",(function(){return mt})),e.d(r,"getStoreDetails",(function(){return Pt})),e.d(r,"registerModifiersForm",(function(){return qt})),e.d(r,"validateProduct",(function(){return Gt})),e.d(r,"initProducts",(function(){return Wt})),e.d(r,"getProductTotals",(function(){return Xt})),e.d(r,"transformers",(function(){return o})),e.d(r,"assertions",(function(){return n}));var n={};e.r(n),e.d(n,"isBaseProduct",(function(){return a})),e.d(n,"isProductDetails",(function(){return s})),e.d(n,"isCartProduct",(function(){return c})),e.d(n,"isFormCartProduct",(function(){return f}));var o={};e.r(o),e.d(o,"toCartProduct",(function(){return d})),e.d(o,"toFormCartProduct",(function(){return g})),e.d(o,"toFormCartProductHelper",(function(){return b})),e.d(o,"toFormCartProductFromProductDetails",(function(){return m})),e.d(o,"toFormCartProductFromAnswer",(function(){return w}));var i=e(0),u=function(t){return Object.keys(t)},a=function(t){var r=t.attributes,e=t.available,n=t.description,o=t.name,a=t.images,s=t.prices,c=t.productId,f=t.sponsored,l=t.status,h=t.type;return"boolean"==typeof r.showInMenu&&("boolean"==typeof e&&("boolean"==typeof f&&("string"==typeof n&&("string"==typeof o&&("string"==typeof c&&(!("object"!=typeof s||"object"==typeof s&&Object.keys(s).length<1)&&(!!Array.isArray(a)&&((!l||"ACTIVE"===l||"INACTIVE"===l)&&!!u(i.ProductType).includes(h)))))))))},s=function(t){if(!a(t))return!1;var r=t.isPriceVip,e=t.manufacturer,n=t.maxAmountForSale,o=t.schedule,i=t.questions;return"boolean"==typeof r&&(!!Array.isArray(e)&&("number"==typeof n&&(!!Array.isArray(o)&&!!Array.isArray(i))))},c=function(t){if(!s(t))return!1;var r=t.hash,e=t.createdAt,n=t.updatedAt,o=t.alerts,a=t.amount,c=t.priceCategory,f=t.comment,l=t.questionsAndAnswers;return"string"==typeof r&&("string"==typeof e&&("string"==typeof n&&(!!Array.isArray(o)&&("number"==typeof a&&("string"==typeof f&&(!!u(i.PriceCategoryType).includes(c)&&!!Array.isArray(l)))))))},f=function(t){var r;if(!c(t))return!1;var e=t.questions;if(!Array.isArray(e))return!1;var n=null===(r=null==e?void 0:e[0])||void 0===r?void 0:r.answers;return!(null==n?void 0:n.length)||void 0!==n[0].amount},l=function(t){var r=t.min,e=t.max,n=t.type;if(n)return n;if(0===r&&1===e)return"CHECKBOX";if(1===r&&1===e)return"RADIO";if(0===r&&(0===e||e===1/0))return"COUNTER";if(e>=r)return"COUNTER";throw new Error("Modifier group bad configured. min "+r+", max "+e+", type "+n)},h=function(t,r){var e=t.max,n=t.min;return r>e?"Amount is heigher than the maximum allowed amount "+e:r<n?"Amount is lower than the minimum allowed amount "+n:""},p=function(){return(p=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},d=function(t,r){if(void 0===r&&(r={}),c(t))return p(p({},t),r);if(s(t))return y(t,r);var e=v(t);return y(e,r)},y=function(t,r){var e;return void 0===r&&(r={}),p(p(p({},t),{questionsAndAnswers:[],amount:null!==(e=t.amount)&&void 0!==e?e:0,priceCategory:i.PriceCategoryType.NORMAL,comment:"",alerts:[],hash:"",createdAt:"",updatedAt:""}),r)},v=function(t,r){return void 0===r&&(r={}),p(p(p({},t),{hasModifiers:!1,isPriceVip:!1,manufacturer:[],maxAmountForSale:0,questions:[],schedule:[]}),r)},g=function(t,r){if(void 0===r&&(r={}),f(t))return p(p({},t),r);if(s(t))return m(t,r);var e=v(t);return m(e,r)},b=function(t,r){void 0===r&&(r={});var e=t.priceCategory,n=t.productId,o=t.amount,i=t.questions.map((function(t){var r=t.answers,i=t.questionId,u=t.min,a=t.max,s={rootId:n,min:u,max:a,type:l(t),modifiersCount:r.length,amount:o,path:[]};return p(p({},t),{answers:r.map((function(t){var r=function(t){var r=t.min;return 1===t.modifiersCount?r:0}(s),n=function(t){var r=t.max,e=t.type,n=r||1/0;return"RADIO"===e||"CHECKBOX"===e?1:n}(s),o=function(t){var r=t.groupType,e=t.min,n=t.max;return"RADIO"===r||1===e&&1===n?"RADIO":0===e&&1===n?"CHECKBOX":0!==e||0!==n&&n!==1/0?n>=e?"COUNTER":r:"COUNTER"}({min:r,max:n,groupType:s.type}),u=t.questions.length;return p(p({amount:0},t),{priceCategory:e,questionId:i,min:r,max:n,renderType:o,questions:u?b(t).questions:[]})}))})}));return p(p(p({},t),{questions:i}),r)},m=function(t,r){void 0===r&&(r={});var e=y(t);return b(e,r)},w=function(t,r){return void 0===r&&(r={}),b(t,r)},A=function(){console.log("Not supported yet")},E={CLIENT_NAME:"Trade S.A.",DEFAULT_REQUEST_TIMEOUT:1e4,EXCLUDED_LOGGER_STATUS_CODES:[422],INCLUDED_LOGGER_ENVS:["staging","production"],INCLUDED_INTL_LOG_ENVS:[""],COUNTRY:{NAME:"Ecuador",CODE:"593",LANGUAGE:"es"},DEFAULT_API_TIMEOUT:3e5,HEADERS:["accountId"],FILTERS:["vendorId","storeId","catalogueId","categoryId","productId"],GROUPS:["CATEGORIES","TAGS"],ORDER_FIELDS:["type","sort"],ORDER_TYPES:["ALPHABETIC","PRICE","PREDEFINED"],ORDER_SORTS:["ASC","DESC"],PAGINATION:["page","vendor","store","catalogue","category","product"],ADDITIONAL_FILTERS:["price","query","tags","manufacturerId","weight","dimensions"]},T=function(){return(T=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},P=E.DEFAULT_API_TIMEOUT,O={artisanApp:void 0,timeout:P,apiCache:{},expiresAt:(new Date).getTime()+P,forms:{}};Object.freeze(O);var I=T({},O);Object.seal(I);var R=function(t){I=T(T({},I),t)},S=function(){return T({},I)},_=function(t,r,e){void 0===e&&(e="");var n=r.headers.accountId,o=t.filterBy,i=o.vendorId,u=o.storeId,a=o.catalogueId;!function(t,r){void 0===r&&(r="");var e=S().accountId;if(void 0===t&&void 0===e)throw new Error("@artisan-commerce/products: AccountId must be defined. Either provide a global accountId or at the function call level. "+r)}(n,e),function(t,r){void 0===r&&(r="");var e=S().vendorId;if(!(Array.isArray(t)&&t.length||void 0!==t||void 0!==e))throw new Error("@artisan-commerce/products: vendorId must be defined. Either provide a global vendorId or at the function call level. "+r)}(i,e),function(t,r){void 0===r&&(r="");var e=S().storeId;if(!(Array.isArray(t)&&t.length||void 0!==t||void 0!==e))throw new Error("@artisan-commerce/products: storeId must be defined. Either provide a global storeId or at the function call level. "+r)}(u,e),function(t,r){void 0===r&&(r="");var e=S().catalogueId;if(!(Array.isArray(t)&&t.length||void 0!==t||void 0!==e))throw new Error("@artisan-commerce/products: catalogueId must be defined. Either provide a global catalogueId or at the function call level. "+r)}(a,e)},D=E.FILTERS,C=E.HEADERS,x=function(t,r,e){var n=null==r?void 0:r.message;try{n=r?JSON.parse(r.message):r}catch(t){}return{data:t,hints:U(e),config:e,error:n}},U=function(t){var r={};return Object.entries(t.query).forEach((function(t){var e=t,n=e[0],o=e[1];D.includes(n)&&(r[n]=o)})),Object.entries(t.headers).forEach((function(t){var e=t,n=e[0],o=e[1];C.includes(n)&&(r[n]=o)})),r},B=function(){return(B=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},Y=function(){return(Y=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},j=E.PAGINATION,N=E.ADDITIONAL_FILTERS,M=E.ORDER_FIELDS,L=E.FILTERS,k=E.GROUPS,F=E.ORDER_SORTS,q=E.ORDER_TYPES,H=function(t){var r=S(),e=r.vendorId,n=r.storeId,o=S(),i=o.catalogueId,u=o.categoryId,a=o.productId,s=Y(Y({},{vendorId:e,storeId:n,catalogueId:i,categoryId:u,productId:a}),t.filterBy),c=X(s,L,"filter"),f=K(c);return Y(Y({},t),{filterBy:f})},G=function(t){var r=J(t,k,"groupBy");return Y({},r)},V=function(t){var r=t.orderBy,e=void 0===r?{}:r,n=X(e,M,"orderBy"),o=Y({},n),i=e.sort,u=e.type;return u&&!q.includes(u)&&console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig order type "+u),q.includes(u)||(delete o.type,o.type="ALPHABETIC"),i&&!F.includes(i)&&console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig order sort "+i),F.includes(i)||(delete o.sort,o.sort="ASC"),Y(Y({},t),{orderBy:o})},z=function(t){var r=t.pagination,e=X(void 0===r?{}:r,j,"pagination");return Y(Y({},t),{pagination:e})},W=function(t){var r=t.additionalFilters,e=X(void 0===r?{}:r,N,"additionalFilters");return Y(Y({},t),{additionalFilters:e})},X=function(t,r,e){var n=Y({},t);return Object.keys(n).forEach((function(t){void 0!==n[t]?r.includes(t)||(console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig "+e+" "+t),delete n[t]):delete n[t]})),n},J=function(t,r,e){var n=Y({},t),o=t[e];return void 0===o||r.includes(o)||(console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig "+e+" "+o),delete n[e]),n},K=function(t){var r=Y({},t);return Object.entries(r).forEach((function(t){var e=t[0],n=t[1];void 0===n||Array.isArray(n)&&!n.length?delete r[e]:Array.isArray(n)&&Q(n[0])||Q(n)||(console.warn("@artisan-commerce/products: Invalid ProductsHTTPConfig filter value: "+e+" = "+n),delete r[e])})),r},Q=function(t){var r=typeof t;return"number"===r||"string"===r},Z=e(2),$=e.n(Z),tt=function(){return(tt=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},rt=function(t){return Object.entries(t).reduce((function(t,r){var e,n=r[0],o=r[1],i=o;return Array.isArray(o)&&(i=o.reduce((function(t,r){return t+","+r}))),tt(tt({},t),"catalogueId"===n?{channelId:i}:((e={})[n]=i,e))}),{})},et=function(t){return void 0===t&&(t={}),Object.entries(t).reduce((function(t,r){var e,n=r[0],o=r[1];return"query"===n?tt(tt({},t),((e={})[n]=o,e)):t}),{})},nt=function(t,r){for(var e=t,n=0,o=Object.entries(r);n<o.length;n++){var i=o[n],u=i[0],a=i[1],s=new RegExp("/:"+u,"g");e=e.replace(s,"/"+a)}return e},ot=function(t,r,e,n){return new(e||(e=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(u,a)}s((n=n.apply(t,r||[])).next())}))},it=function(t,r){var e,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=r.call(t,u)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},ut=function(t,r,e,n){return ot(void 0,void 0,void 0,(function(){var o,i,u,a,s,c,f;return it(this,(function(l){switch(l.label){case 0:if(r=function(t){var r=H(t),e=G(r),n=V(e),o=z(n);return W(o)}(r),_(r,e),o=function(t,r,e){var n,o=r.filterBy,i=r.groupBy,u=r.additionalFilters,a=rt(o),s=et(u),c=tt(tt(tt({},a),{groupBy:i}),s);i||delete c.groupBy;var f=nt(t,e.params),l=(null!==(n=S().artisanApp)&&void 0!==n?n:{}).apiURL,h=Object.entries(c).reduce((function(t,r,e){var n=r[0],o=r[1];return void 0===o?t:t+(e?"&":"")+n+"="+o}),l+"/"+f+"?");return tt(tt({},e),{url:h,query:c})}(t,r,e),p=o.url,i=$()(p),u=function(t){return S().apiCache[t]}(i),h=S().expiresAt,(a=(new Date).getTime()>=h)&&function(){var t=S().timeout,r=void 0===t?0:t;R({apiCache:B({},O.apiCache),expiresAt:(new Date).getTime()+r})}(),u&&!a)return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,n(o)];case 2:return s=l.sent(),f=x(s,void 0,o),function(t,r){var e,n=S().apiCache,o=B(B({},n),((e={})[t]=r,e));R({apiCache:o})}(i,f),[2,f];case 3:return c=l.sent(),[2,f=x(void 0,c,o)];case 4:return[2,u]}var h,p}))}))},at=function(t){return ot(void 0,void 0,void 0,(function(){var r,e,n,o,i,u;return it(this,(function(a){switch(a.label){case 0:r=t.url,e=t.headers,n=t.body,"{}"===(o={headers:e,body:JSON.stringify(n)}).body&&delete o.body,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,fetch(r,o).then((function(t){return t.json()}))];case 2:return i=a.sent(),[3,4];case 3:return u=a.sent(),i={code:null,status:"failed",message:u.message,stack:u.stack},[3,4];case 4:if(i.code<200||i.code>299)throw new Error(JSON.stringify({code:i.code,status:i.status,message:i.message,warnings:i.warning,stack:i.stack}));return[2,i.data]}}))}))},st=function(t,r,e,n){return new(e||(e=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(u,a)}s((n=n.apply(t,r||[])).next())}))},ct=function(t,r){var e,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=r.call(t,u)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},ft=function(t,r,e,n){return new(e||(e=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(u,a)}s((n=n.apply(t,r||[])).next())}))},lt=function(t,r){var e,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=r.call(t,u)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},ht=function(t,r){return ft(void 0,void 0,void 0,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,ut("v1/products/:productId",r,{headers:{},params:{productId:t},query:{},body:{}},(function(t){return ft(void 0,void 0,void 0,(function(){return lt(this,(function(r){switch(r.label){case 0:return[4,(e=t,st(void 0,void 0,void 0,(function(){return ct(this,(function(t){switch(t.label){case 0:return[4,at(e)];case 1:return[2,t.sent()]}}))})))];case 1:return[2,r.sent()]}var e}))}))}))];case 1:return[2,e.sent()]}}))}))},pt=function(t,r,e,n){return new(e||(e=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(u,a)}s((n=n.apply(t,r||[])).next())}))},dt=function(t,r){var e,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=r.call(t,u)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},yt=function(t,r,e,n){return new(e||(e=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(u,a)}s((n=n.apply(t,r||[])).next())}))},vt=function(t,r){var e,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=r.call(t,u)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},gt=function(t){return yt(void 0,void 0,void 0,(function(){return vt(this,(function(r){switch(r.label){case 0:return[4,ut("v1/products",t,{headers:{},params:{},query:{},body:{}},(function(t){return yt(void 0,void 0,void 0,(function(){return vt(this,(function(r){switch(r.label){case 0:return[4,(e=t,pt(void 0,void 0,void 0,(function(){return dt(this,(function(t){switch(t.label){case 0:return[4,at(e)];case 1:return[2,t.sent()]}}))})))];case 1:return[2,r.sent()]}var e}))}))}))];case 1:return[2,r.sent()]}}))}))},bt=function(){console.log("Not implemented yet")},mt=function(){console.log("not implemented yet")},wt=function(t,r,e,n){return new(e||(e=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(u,a)}s((n=n.apply(t,r||[])).next())}))},At=function(t,r){var e,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=r.call(t,u)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},Et=function(t,r,e,n){return new(e||(e=Promise))((function(o,i){function u(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(u,a)}s((n=n.apply(t,r||[])).next())}))},Tt=function(t,r){var e,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=r.call(t,u)}catch(t){i=[6,t],n=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},Pt=function(t){return Et(void 0,void 0,void 0,(function(){return Tt(this,(function(r){switch(r.label){case 0:return[4,ut("v1/stores/details",t,{headers:{},params:{},query:{},body:{}},(function(t){return Et(void 0,void 0,void 0,(function(){return Tt(this,(function(r){switch(r.label){case 0:return[4,(e=t,wt(void 0,void 0,void 0,(function(){return At(this,(function(t){switch(t.label){case 0:return[4,at(e)];case 1:return[2,t.sent()]}}))})))];case 1:return[2,r.sent()]}var e}))}))}))];case 1:return[2,r.sent()]}}))}))},Ot=function(){return(Ot=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},It=function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),o=0;for(r=0;r<e;r++)for(var i=arguments[r],u=0,a=i.length;u<a;u++,o++)n[o]=i[u];return n},Rt=function(t,r){for(var e=It(r),n=t,o=t[0];e.length;){o=_t(n,e[0]),e=e.slice(1),n=Object.prototype.hasOwnProperty.call(o,"modifiers")?o.modifiers:o.groups}return o},St=function(t,r,e){for(var n=It(r),o=t,i=_t(o,n[0]),u=Object.prototype.hasOwnProperty.call(i,"modifiers");n.length>1;)i=_t(o,n[0]),n=n.slice(1),o=(u=Object.prototype.hasOwnProperty.call(i,"modifiers"))?i.modifiers:i.groups;var a=n[0];if(1===r.length&&(i={groups:t},u=!1),u){var s=i.modifiers.map((function(t){return t.id===a?Ot({},e):Ot({},t)}));i.modifiers=s}else{var c=i.groups.map((function(t){return t.id===a?Ot({},e):Ot({},t)}));i.groups=c}return 1===r.length?It(i.groups):It(t)},_t=function(t,r){var e=t.find((function(t){return t.id===r}));if(!e)throw new Error("Path segment "+r+" doesn't exist in segments "+JSON.stringify(t.map((function(t){return t.id}))));return e},Dt=function(){return(Dt=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},Ct=function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),o=0;for(r=0;r<e;r++)for(var i=arguments[r],u=0,a=i.length;u<a;u++,o++)n[o]=i[u];return n},xt=function(t,r,e){var n=e.slice(0,-1),o=Rt(r,n),i=Ct(o.modifiers);"RADIO"===o.type&&(i=o.modifiers.map((function(t){return"RADIO"!==t.type||t.id===e[e.length-1]?Dt({},t):Dt(Dt({},t),{amount:0,touched:!1,error:"",totals:Xt(Dt(Dt({},t.data),{amount:0})),data:Dt(Dt({},t.data),{amount:0})})}))),i=i.map((function(r){var n=w(r.data),o=Ct(e.slice(0,-1),[r.id]);return Dt(Dt({},r),{groups:Mt(n,{rootId:t,path:o})})}));var u=Dt(Dt({},o),{touched:!0,modifiers:i}),a=St(r,n,u);return n.length>1&&(a=Ut(t,a,n)),a},Ut=function(t,r,e){var n=e.slice(0,-1),o=Rt(r,n),i=o.groups.map((function(t){return Dt({},t)})),u=Dt(Dt({},o),{touched:!0,groups:i}),a=St(r,n,u);return n.length>1&&(a=xt(t,a,n)),a},Bt=function(){return(Bt=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},Yt=function(t,r,e){var n,o=Bt({},S().forms),i=o[t],u=Rt(i.renderer,r),a=function(t,r,e,n){var o=Dt(Dt({},e),{amount:n,touched:!0,error:h(e,n),totals:Xt(Dt(Dt({},e.data),{amount:n})),data:Dt(Dt({},e.data),{amount:n})});return St(t,r,o)}(i.renderer,r,u,e);a=xt(t,a,r);var s=Bt(Bt({},i),{renderer:a}),c=Bt(Bt({},o),((n={})[t]=s,n));R({forms:c});var f=Bt({},s);delete f.callback,i.callback(f)},jt=function(){return(jt=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},Nt=function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),o=0;for(r=0;r<e;r++)for(var i=arguments[r],u=0,a=i.length;u<a;u++,o++)n[o]=i[u];return n},Mt=function(t,r){var e=r.rootId,n=r.path;return t.questions.map((function(r){return Lt(r,{amount:t.amount,rootId:e,path:Nt(n)})}))},Lt=function(t,r){var e,n=t.questionId,o=t.name,i=t.description,u=t.max,a=t.min,s=t.images,c=r.amount,f=r.rootId,h=r.path,p={id:n,name:o,description:null!=i?i:"",images:null!=s?s:[],data:t,error:"",touched:!1,hidden:c<1,required:a>0,type:l(t)},d={rootId:f,max:u,min:a,type:p.type,modifiersCount:t.answers.length,amount:(e=t,e.answers.reduce((function(t,r){return t+r.amount}),0)),path:Nt(h,[n])},y=t.answers.map((function(t){return kt(t,d)}));return jt(jt({},p),{modifiers:y})},kt=function(t,r){var e=t.productId,n=t.questionId,o=t.name,i=t.images,u=t.amount,a=t.renderType,s=t.min,c=t.max,f=w(t),l=r.rootId,h=r.path,p=Nt(h,[e]);return{id:e,groupId:n,name:o,images:i,amount:u,data:t,groups:Mt(f,{rootId:l,path:p}),error:"",hidden:r.amount<1,min:s,max:c,required:s>0,touched:!1,totals:Xt(jt(jt({},t),{amount:u})),type:a,handleChange:function(t){Yt(r.rootId,p,t)}}},Ft=function(){return(Ft=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},qt=function(t,r){var e,n,o=t.productId,i=S().forms;if(!!i[o])return n="Form for product with id "+o+" has already been register. Please unsuscribe if you need to register a new form.",console.error(n),function(){};var u=function(t){var r=g(t,{amount:1});return{product:r,renderer:Mt(r,{rootId:r.productId,path:[]}),validate:Gt}}(t),a=Ft(Ft({},i),((e={})[o]=Ft(Ft({},u),{callback:r}),e));return R({forms:a}),r(u),function(){return Ht(o)}},Ht=function(t){var r=S().forms,e=Ft({},r);delete e[t],R({forms:e})},Gt=function(){},Vt=function(){return(Vt=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)},zt=!1,Wt=function(t,r){if(void 0===r&&(r={}),zt)console.warn("artisan-commerce/products: initProducts has been called more than once. This behaviour will very likely result in unexpected outcomes so its call was skipped. Please make sure initProducts is only called once");else{if(R(Vt({artisanApp:t},r)),void 0!==r.timeout){var e=(new Date).getTime()+r.timeout;R({expiresAt:e})}"undefined"==typeof window||(zt=!0)}},Xt=function(t){return{grossPrice:Kt(t),totalDiscounts:Qt(t),totalTaxes:Jt(t),netPrice:Zt(t)}},Jt=function(t){var r=d(t),e=r.prices,n=r.amount,o=r.priceCategory,i=e[o],u=i.taxes,a=i.grossPrice,s=tr(u,a);return r.questionsAndAnswers.reduce((function(t,r){return t+r.answers.reduce((function(t,r){var e=r.prices,n=r.amount,i=e[o],u=i.taxes,a=i.grossPrice;return t+n*tr(u,a)}),0)}),0)+s*n},Kt=function(t){return $t(t,"grossPrice")},Qt=function(t){return 0},Zt=function(t){return $t(t,"netPrice")},$t=function(t,r){var e=d(t),n=e.prices,o=e.amount,i=e.priceCategory,u=n[i][r];return e.questionsAndAnswers.reduce((function(t,e){return t+e.answers.reduce((function(t,e){var n=e.prices;return t+e.amount*n[i][r]}),0)}),0)+u*o},tr=function(t,r){return t.reduce((function(t,e){return t+e.percentage/100*r}),0)}}])}));
package/build/report.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>@artisan-commerce/products [4 Dec 2020 at 15:41]</title>
6
+ <title>@artisan-commerce/products [21 Dec 2020 at 15:13]</title>
7
7
  <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
8
8
 
9
9
  <script>
@@ -46,7 +46,7 @@
46
46
  <body>
47
47
  <div id="app"></div>
48
48
  <script>
49
- window.chartData = [{"label":"main.bundle.js","isAsset":true,"statSize":117573,"parsedSize":50750,"gzipSize":13012,"groups":[{"label":"types/build","path":"./types/build","statSize":5080,"groups":[{"id":0,"label":"index.js","path":"./types/build/index.js","statSize":1289,"parsedSize":510,"gzipSize":284},{"label":"types","path":"./types/build/types","statSize":3791,"groups":[{"id":3,"label":"app.types.js","path":"./types/build/types/app.types.js","statSize":114,"parsedSize":78,"gzipSize":97},{"id":4,"label":"account.types.js","path":"./types/build/types/account.types.js","statSize":150,"parsedSize":78,"gzipSize":97},{"id":5,"label":"category.types.js","path":"./types/build/types/category.types.js","statSize":119,"parsedSize":78,"gzipSize":97},{"id":6,"label":"channel.types.js","path":"./types/build/types/channel.types.js","statSize":150,"parsedSize":78,"gzipSize":97},{"id":7,"label":"common.types.js","path":"./types/build/types/common.types.js","statSize":162,"parsedSize":78,"gzipSize":97},{"id":8,"label":"image.types.js","path":"./types/build/types/image.types.js","statSize":146,"parsedSize":78,"gzipSize":97},{"id":9,"label":"product.types.js","path":"./types/build/types/product.types.js","statSize":1494,"parsedSize":725,"gzipSize":358},{"id":10,"label":"shippingCost.types.js","path":"./types/build/types/shippingCost.types.js","statSize":160,"parsedSize":78,"gzipSize":97},{"id":11,"label":"shoppingCart.types.js","path":"./types/build/types/shoppingCart.types.js","statSize":123,"parsedSize":78,"gzipSize":97},{"id":12,"label":"store.types.js","path":"./types/build/types/store.types.js","statSize":913,"parsedSize":485,"gzipSize":270},{"id":13,"label":"vendor.types.js","path":"./types/build/types/vendor.types.js","statSize":117,"parsedSize":78,"gzipSize":97},{"id":14,"label":"http.types.js","path":"./types/build/types/http.types.js","statSize":143,"parsedSize":78,"gzipSize":97}],"parsedSize":1990,"gzipSize":455}],"parsedSize":2500,"gzipSize":653},{"label":"node_modules","path":"./node_modules","statSize":60672,"groups":[{"label":"charenc","path":"./node_modules/charenc","statSize":850,"groups":[{"id":1,"label":"charenc.js","path":"./node_modules/charenc/charenc.js","statSize":850,"parsedSize":426,"gzipSize":231}],"parsedSize":426,"gzipSize":231},{"label":"sha1","path":"./node_modules/sha1","statSize":2124,"groups":[{"id":2,"label":"sha1.js","path":"./node_modules/sha1/sha1.js","statSize":2124,"parsedSize":947,"gzipSize":625}],"parsedSize":947,"gzipSize":625},{"label":"buffer","path":"./node_modules/buffer","statSize":48590,"groups":[{"id":15,"label":"index.js","path":"./node_modules/buffer/index.js","statSize":48590,"parsedSize":19827,"gzipSize":5834}],"parsedSize":19827,"gzipSize":5834},{"label":"base64-js","path":"./node_modules/base64-js","statSize":3944,"groups":[{"id":17,"label":"index.js","path":"./node_modules/base64-js/index.js","statSize":3944,"parsedSize":1406,"gzipSize":743}],"parsedSize":1406,"gzipSize":743},{"label":"ieee754","path":"./node_modules/ieee754","statSize":2064,"groups":[{"id":18,"label":"index.js","path":"./node_modules/ieee754/index.js","statSize":2064,"parsedSize":881,"gzipSize":496}],"parsedSize":881,"gzipSize":496},{"label":"isarray","path":"./node_modules/isarray","statSize":132,"groups":[{"id":19,"label":"index.js","path":"./node_modules/isarray/index.js","statSize":132,"parsedSize":104,"gzipSize":109}],"parsedSize":104,"gzipSize":109},{"label":"crypt","path":"./node_modules/crypt","statSize":2968,"groups":[{"id":20,"label":"crypt.js","path":"./node_modules/crypt/crypt.js","statSize":2968,"parsedSize":1273,"gzipSize":646}],"parsedSize":1273,"gzipSize":646}],"parsedSize":24864,"gzipSize":7855},{"label":"buildin","path":"./buildin","statSize":472,"groups":[{"id":16,"label":"global.js","path":"./buildin/global.js","statSize":472,"parsedSize":144,"gzipSize":129}],"parsedSize":144,"gzipSize":129},{"label":"src","path":"./src","statSize":51349,"groups":[{"id":22,"label":"index.ts + 22 modules (concatenated)","path":"./src/index.ts + 22 modules (concatenated)","statSize":51349,"parsedSize":22063,"gzipSize":4482,"concatenated":true,"groups":[{"label":"src","path":"./src/index.ts + 22 modules (concatenated)/src","statSize":51339,"groups":[{"id":null,"label":"index.ts","path":"./src/index.ts + 22 modules (concatenated)/src/index.ts","statSize":780,"parsedSize":335,"gzipSize":68,"inaccurateSizes":true},{"label":"utils","path":"./src/index.ts + 22 modules (concatenated)/src/utils","statSize":24363,"groups":[{"label":"assertions","path":"./src/index.ts + 22 modules (concatenated)/src/utils/assertions","statSize":3392,"groups":[{"id":null,"label":"assertions.utils.ts","path":"./src/index.ts + 22 modules (concatenated)/src/utils/assertions/assertions.utils.ts","statSize":3392,"parsedSize":1457,"gzipSize":296,"inaccurateSizes":true}],"parsedSize":1457,"gzipSize":296,"inaccurateSizes":true},{"label":"transformers","path":"./src/index.ts + 22 modules (concatenated)/src/utils/transformers","statSize":2540,"groups":[{"id":null,"label":"transformers.utils.ts","path":"./src/index.ts + 22 modules (concatenated)/src/utils/transformers/transformers.utils.ts","statSize":1757,"parsedSize":754,"gzipSize":153,"inaccurateSizes":true},{"id":null,"label":"api.transformer.ts","path":"./src/index.ts + 22 modules (concatenated)/src/utils/transformers/api.transformer.ts","statSize":783,"parsedSize":336,"gzipSize":68,"inaccurateSizes":true}],"parsedSize":1091,"gzipSize":221,"inaccurateSizes":true},{"label":"caculations","path":"./src/index.ts + 22 modules (concatenated)/src/utils/caculations","statSize":2900,"groups":[{"id":null,"label":"calculations.utils.ts","path":"./src/index.ts + 22 modules (concatenated)/src/utils/caculations/calculations.utils.ts","statSize":2900,"parsedSize":1246,"gzipSize":253,"inaccurateSizes":true}],"parsedSize":1246,"gzipSize":253,"inaccurateSizes":true},{"id":null,"label":"common.utils.ts","path":"./src/index.ts + 22 modules (concatenated)/src/utils/common.utils.ts","statSize":199,"parsedSize":85,"gzipSize":17,"inaccurateSizes":true},{"label":"http","path":"./src/index.ts + 22 modules (concatenated)/src/utils/http","statSize":15332,"groups":[{"id":null,"label":"http.utils.ts","path":"./src/index.ts + 22 modules (concatenated)/src/utils/http/http.utils.ts","statSize":6121,"parsedSize":2629,"gzipSize":534,"inaccurateSizes":true},{"id":null,"label":"cache.utils.ts","path":"./src/index.ts + 22 modules (concatenated)/src/utils/http/cache.utils.ts","statSize":1178,"parsedSize":506,"gzipSize":102,"inaccurateSizes":true},{"id":null,"label":"purge.utils.ts","path":"./src/index.ts + 22 modules (concatenated)/src/utils/http/purge.utils.ts","statSize":5681,"parsedSize":2440,"gzipSize":495,"inaccurateSizes":true},{"id":null,"label":"request.utils.ts","path":"./src/index.ts + 22 modules (concatenated)/src/utils/http/request.utils.ts","statSize":2352,"parsedSize":1010,"gzipSize":205,"inaccurateSizes":true}],"parsedSize":6587,"gzipSize":1338,"inaccurateSizes":true}],"parsedSize":10467,"gzipSize":2126,"inaccurateSizes":true},{"label":"lib","path":"./src/index.ts + 22 modules (concatenated)/src/lib","statSize":13724,"groups":[{"label":"getCategories","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getCategories","statSize":109,"groups":[{"id":null,"label":"getCategories.ts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getCategories/getCategories.ts","statSize":109,"parsedSize":46,"gzipSize":9,"inaccurateSizes":true}],"parsedSize":46,"gzipSize":9,"inaccurateSizes":true},{"label":"getProductDetails","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getProductDetails","statSize":3728,"groups":[{"id":null,"label":"getProductDetails.ts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getProductDetails/getProductDetails.ts","statSize":3728,"parsedSize":1601,"gzipSize":325,"inaccurateSizes":true}],"parsedSize":1601,"gzipSize":325,"inaccurateSizes":true},{"label":"getProducts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getProducts","statSize":3604,"groups":[{"id":null,"label":"getProducts.ts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getProducts/getProducts.ts","statSize":3604,"parsedSize":1548,"gzipSize":314,"inaccurateSizes":true}],"parsedSize":1548,"gzipSize":314,"inaccurateSizes":true},{"label":"getRecommendedProducts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getRecommendedProducts","statSize":129,"groups":[{"id":null,"label":"getRecommendedProducts.ts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getRecommendedProducts/getRecommendedProducts.ts","statSize":129,"parsedSize":55,"gzipSize":11,"inaccurateSizes":true}],"parsedSize":55,"gzipSize":11,"inaccurateSizes":true},{"label":"getRelatedProducts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getRelatedProducts","statSize":121,"groups":[{"id":null,"label":"getRelatedProducts.ts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getRelatedProducts/getRelatedProducts.ts","statSize":121,"parsedSize":51,"gzipSize":10,"inaccurateSizes":true}],"parsedSize":51,"gzipSize":10,"inaccurateSizes":true},{"label":"getStoreDetails","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getStoreDetails","statSize":3634,"groups":[{"id":null,"label":"getStoreDetails.ts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/getStoreDetails/getStoreDetails.ts","statSize":3634,"parsedSize":1561,"gzipSize":317,"inaccurateSizes":true}],"parsedSize":1561,"gzipSize":317,"inaccurateSizes":true},{"label":"initProducts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/initProducts","statSize":1484,"groups":[{"id":null,"label":"initProducts.ts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/initProducts/initProducts.ts","statSize":1484,"parsedSize":637,"gzipSize":129,"inaccurateSizes":true}],"parsedSize":637,"gzipSize":129,"inaccurateSizes":true},{"id":null,"label":"common.ts","path":"./src/index.ts + 22 modules (concatenated)/src/lib/common.ts","statSize":915,"parsedSize":393,"gzipSize":79,"inaccurateSizes":true}],"parsedSize":5896,"gzipSize":1197,"inaccurateSizes":true},{"label":"services","path":"./src/index.ts + 22 modules (concatenated)/src/services","statSize":8566,"groups":[{"label":"fetchProductDetails","path":"./src/index.ts + 22 modules (concatenated)/src/services/fetchProductDetails","statSize":2858,"groups":[{"id":null,"label":"fetchProductDetails.service.tsx","path":"./src/index.ts + 22 modules (concatenated)/src/services/fetchProductDetails/fetchProductDetails.service.tsx","statSize":2858,"parsedSize":1227,"gzipSize":249,"inaccurateSizes":true}],"parsedSize":1227,"gzipSize":249,"inaccurateSizes":true},{"label":"fetchProducts","path":"./src/index.ts + 22 modules (concatenated)/src/services/fetchProducts","statSize":2852,"groups":[{"id":null,"label":"fetchProducts.service.tsx","path":"./src/index.ts + 22 modules (concatenated)/src/services/fetchProducts/fetchProducts.service.tsx","statSize":2852,"parsedSize":1225,"gzipSize":248,"inaccurateSizes":true}],"parsedSize":1225,"gzipSize":248,"inaccurateSizes":true},{"label":"fetchStoreDetails","path":"./src/index.ts + 22 modules (concatenated)/src/services/fetchStoreDetails","statSize":2856,"groups":[{"id":null,"label":"fetchStoreDetails.service.tsx","path":"./src/index.ts + 22 modules (concatenated)/src/services/fetchStoreDetails/fetchStoreDetails.service.tsx","statSize":2856,"parsedSize":1227,"gzipSize":249,"inaccurateSizes":true}],"parsedSize":1227,"gzipSize":249,"inaccurateSizes":true}],"parsedSize":3680,"gzipSize":747,"inaccurateSizes":true},{"label":"config","path":"./src/index.ts + 22 modules (concatenated)/src/config","statSize":1528,"groups":[{"id":null,"label":"constants.ts","path":"./src/index.ts + 22 modules (concatenated)/src/config/constants.ts","statSize":1528,"parsedSize":656,"gzipSize":133,"inaccurateSizes":true}],"parsedSize":656,"gzipSize":133,"inaccurateSizes":true},{"label":"errors","path":"./src/index.ts + 22 modules (concatenated)/src/errors","statSize":2378,"groups":[{"id":null,"label":"api.errors.ts","path":"./src/index.ts + 22 modules (concatenated)/src/errors/api.errors.ts","statSize":2378,"parsedSize":1021,"gzipSize":207,"inaccurateSizes":true}],"parsedSize":1021,"gzipSize":207,"inaccurateSizes":true}],"parsedSize":22058,"gzipSize":4481,"inaccurateSizes":true}]}],"parsedSize":22063,"gzipSize":4482}]},{"label":"vendors.bundle.js","isAsset":true,"statSize":19,"parsedSize":1175,"gzipSize":528,"groups":[{"label":"src","path":"./src","statSize":19,"groups":[{"id":21,"label":"vendors.ts","path":"./src/vendors.ts","statSize":19,"parsedSize":15,"gzipSize":35}],"parsedSize":15,"gzipSize":35}]}];
49
+ window.chartData = [{"label":"main.bundle.js","isAsset":true,"statSize":140381,"parsedSize":58245,"gzipSize":14943,"groups":[{"label":"types/build","path":"./types/build","statSize":5253,"groups":[{"id":0,"label":"index.js","path":"./types/build/index.js","statSize":1346,"parsedSize":521,"gzipSize":287},{"label":"types","path":"./types/build/types","statSize":3907,"groups":[{"id":3,"label":"app.types.js","path":"./types/build/types/app.types.js","statSize":114,"parsedSize":78,"gzipSize":97},{"id":4,"label":"account.types.js","path":"./types/build/types/account.types.js","statSize":150,"parsedSize":78,"gzipSize":97},{"id":5,"label":"category.types.js","path":"./types/build/types/category.types.js","statSize":119,"parsedSize":78,"gzipSize":97},{"id":6,"label":"channel.types.js","path":"./types/build/types/channel.types.js","statSize":150,"parsedSize":78,"gzipSize":97},{"id":7,"label":"common.types.js","path":"./types/build/types/common.types.js","statSize":162,"parsedSize":78,"gzipSize":97},{"id":8,"label":"coupons.types.js","path":"./types/build/types/coupons.types.js","statSize":118,"parsedSize":78,"gzipSize":97},{"id":9,"label":"image.types.js","path":"./types/build/types/image.types.js","statSize":146,"parsedSize":78,"gzipSize":97},{"id":10,"label":"product.types.js","path":"./types/build/types/product.types.js","statSize":1492,"parsedSize":723,"gzipSize":357},{"id":11,"label":"shippingCost.types.js","path":"./types/build/types/shippingCost.types.js","statSize":160,"parsedSize":78,"gzipSize":97},{"id":12,"label":"shoppingCart.types.js","path":"./types/build/types/shoppingCart.types.js","statSize":123,"parsedSize":78,"gzipSize":97},{"id":13,"label":"store.types.js","path":"./types/build/types/store.types.js","statSize":913,"parsedSize":485,"gzipSize":270},{"id":14,"label":"vendor.types.js","path":"./types/build/types/vendor.types.js","statSize":117,"parsedSize":78,"gzipSize":97},{"id":15,"label":"http.types.js","path":"./types/build/types/http.types.js","statSize":143,"parsedSize":78,"gzipSize":97}],"parsedSize":2066,"gzipSize":459}],"parsedSize":2587,"gzipSize":655},{"label":"node_modules","path":"./node_modules","statSize":60672,"groups":[{"label":"charenc","path":"./node_modules/charenc","statSize":850,"groups":[{"id":1,"label":"charenc.js","path":"./node_modules/charenc/charenc.js","statSize":850,"parsedSize":426,"gzipSize":231}],"parsedSize":426,"gzipSize":231},{"label":"sha1","path":"./node_modules/sha1","statSize":2124,"groups":[{"id":2,"label":"sha1.js","path":"./node_modules/sha1/sha1.js","statSize":2124,"parsedSize":947,"gzipSize":625}],"parsedSize":947,"gzipSize":625},{"label":"buffer","path":"./node_modules/buffer","statSize":48590,"groups":[{"id":16,"label":"index.js","path":"./node_modules/buffer/index.js","statSize":48590,"parsedSize":19827,"gzipSize":5835}],"parsedSize":19827,"gzipSize":5835},{"label":"base64-js","path":"./node_modules/base64-js","statSize":3944,"groups":[{"id":18,"label":"index.js","path":"./node_modules/base64-js/index.js","statSize":3944,"parsedSize":1406,"gzipSize":743}],"parsedSize":1406,"gzipSize":743},{"label":"ieee754","path":"./node_modules/ieee754","statSize":2064,"groups":[{"id":19,"label":"index.js","path":"./node_modules/ieee754/index.js","statSize":2064,"parsedSize":881,"gzipSize":496}],"parsedSize":881,"gzipSize":496},{"label":"isarray","path":"./node_modules/isarray","statSize":132,"groups":[{"id":20,"label":"index.js","path":"./node_modules/isarray/index.js","statSize":132,"parsedSize":104,"gzipSize":109}],"parsedSize":104,"gzipSize":109},{"label":"crypt","path":"./node_modules/crypt","statSize":2968,"groups":[{"id":21,"label":"crypt.js","path":"./node_modules/crypt/crypt.js","statSize":2968,"parsedSize":1273,"gzipSize":646}],"parsedSize":1273,"gzipSize":646}],"parsedSize":24864,"gzipSize":7854},{"label":"buildin","path":"./buildin","statSize":472,"groups":[{"id":17,"label":"global.js","path":"./buildin/global.js","statSize":472,"parsedSize":144,"gzipSize":129}],"parsedSize":144,"gzipSize":129},{"label":"src","path":"./src","statSize":73984,"groups":[{"id":23,"label":"index.ts + 30 modules (concatenated)","path":"./src/index.ts + 30 modules (concatenated)","statSize":73984,"parsedSize":29470,"gzipSize":6433,"concatenated":true,"groups":[{"label":"src","path":"./src/index.ts + 30 modules (concatenated)/src","statSize":73974,"groups":[{"id":null,"label":"index.ts","path":"./src/index.ts + 30 modules (concatenated)/src/index.ts","statSize":944,"parsedSize":376,"gzipSize":82,"inaccurateSizes":true},{"label":"utils","path":"./src/index.ts + 30 modules (concatenated)/src/utils","statSize":44044,"groups":[{"label":"assertions","path":"./src/index.ts + 30 modules (concatenated)/src/utils/assertions","statSize":3979,"groups":[{"id":null,"label":"assertions.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/assertions/assertions.utils.ts","statSize":3979,"parsedSize":1584,"gzipSize":345,"inaccurateSizes":true}],"parsedSize":1584,"gzipSize":345,"inaccurateSizes":true},{"label":"transformers","path":"./src/index.ts + 30 modules (concatenated)/src/utils/transformers","statSize":5545,"groups":[{"id":null,"label":"transformers.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/transformers/transformers.utils.ts","statSize":4629,"parsedSize":1843,"gzipSize":402,"inaccurateSizes":true},{"id":null,"label":"api.transformer.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/transformers/api.transformer.ts","statSize":916,"parsedSize":364,"gzipSize":79,"inaccurateSizes":true}],"parsedSize":2208,"gzipSize":482,"inaccurateSizes":true},{"label":"caculations","path":"./src/index.ts + 30 modules (concatenated)/src/utils/caculations","statSize":2900,"groups":[{"id":null,"label":"calculations.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/caculations/calculations.utils.ts","statSize":2900,"parsedSize":1155,"gzipSize":252,"inaccurateSizes":true}],"parsedSize":1155,"gzipSize":252,"inaccurateSizes":true},{"id":null,"label":"common.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/common.utils.ts","statSize":383,"parsedSize":152,"gzipSize":33,"inaccurateSizes":true},{"label":"modifiers","path":"./src/index.ts + 30 modules (concatenated)/src/utils/modifiers","statSize":15317,"groups":[{"id":null,"label":"common.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/modifiers/common.utils.ts","statSize":2209,"parsedSize":879,"gzipSize":192,"inaccurateSizes":true},{"id":null,"label":"form.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/modifiers/form.utils.ts","statSize":611,"parsedSize":243,"gzipSize":53,"inaccurateSizes":true},{"id":null,"label":"renderer.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/modifiers/renderer.utils.ts","statSize":3772,"parsedSize":1502,"gzipSize":327,"inaccurateSizes":true},{"id":null,"label":"handleChange.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/modifiers/handleChange.utils.ts","statSize":1630,"parsedSize":649,"gzipSize":141,"inaccurateSizes":true},{"id":null,"label":"rendererTraversal.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/modifiers/rendererTraversal.utils.ts","statSize":3060,"parsedSize":1218,"gzipSize":266,"inaccurateSizes":true},{"id":null,"label":"updateRenderer.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/modifiers/updateRenderer.utils.ts","statSize":4035,"parsedSize":1607,"gzipSize":350,"inaccurateSizes":true}],"parsedSize":6101,"gzipSize":1331,"inaccurateSizes":true},{"label":"http","path":"./src/index.ts + 30 modules (concatenated)/src/utils/http","statSize":15920,"groups":[{"id":null,"label":"http.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/http/http.utils.ts","statSize":6121,"parsedSize":2438,"gzipSize":532,"inaccurateSizes":true},{"id":null,"label":"cache.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/http/cache.utils.ts","statSize":1178,"parsedSize":469,"gzipSize":102,"inaccurateSizes":true},{"id":null,"label":"purge.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/http/purge.utils.ts","statSize":5681,"parsedSize":2262,"gzipSize":493,"inaccurateSizes":true},{"id":null,"label":"request.utils.ts","path":"./src/index.ts + 30 modules (concatenated)/src/utils/http/request.utils.ts","statSize":2940,"parsedSize":1171,"gzipSize":255,"inaccurateSizes":true}],"parsedSize":6341,"gzipSize":1384,"inaccurateSizes":true}],"parsedSize":17544,"gzipSize":3829,"inaccurateSizes":true},{"label":"lib","path":"./src/index.ts + 30 modules (concatenated)/src/lib","statSize":16514,"groups":[{"label":"getCategories","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getCategories","statSize":109,"groups":[{"id":null,"label":"getCategories.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getCategories/getCategories.ts","statSize":109,"parsedSize":43,"gzipSize":9,"inaccurateSizes":true}],"parsedSize":43,"gzipSize":9,"inaccurateSizes":true},{"label":"getProductDetails","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getProductDetails","statSize":3731,"groups":[{"id":null,"label":"getProductDetails.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getProductDetails/getProductDetails.ts","statSize":3731,"parsedSize":1486,"gzipSize":324,"inaccurateSizes":true}],"parsedSize":1486,"gzipSize":324,"inaccurateSizes":true},{"label":"getProducts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getProducts","statSize":3607,"groups":[{"id":null,"label":"getProducts.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getProducts/getProducts.ts","statSize":3607,"parsedSize":1436,"gzipSize":313,"inaccurateSizes":true}],"parsedSize":1436,"gzipSize":313,"inaccurateSizes":true},{"label":"getRecommendedProducts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getRecommendedProducts","statSize":129,"groups":[{"id":null,"label":"getRecommendedProducts.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getRecommendedProducts/getRecommendedProducts.ts","statSize":129,"parsedSize":51,"gzipSize":11,"inaccurateSizes":true}],"parsedSize":51,"gzipSize":11,"inaccurateSizes":true},{"label":"getRelatedProducts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getRelatedProducts","statSize":121,"groups":[{"id":null,"label":"getRelatedProducts.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getRelatedProducts/getRelatedProducts.ts","statSize":121,"parsedSize":48,"gzipSize":10,"inaccurateSizes":true}],"parsedSize":48,"gzipSize":10,"inaccurateSizes":true},{"label":"getStoreDetails","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getStoreDetails","statSize":3637,"groups":[{"id":null,"label":"getStoreDetails.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/getStoreDetails/getStoreDetails.ts","statSize":3637,"parsedSize":1448,"gzipSize":316,"inaccurateSizes":true}],"parsedSize":1448,"gzipSize":316,"inaccurateSizes":true},{"label":"registerModifiersForm","path":"./src/index.ts + 30 modules (concatenated)/src/lib/registerModifiersForm","statSize":2691,"groups":[{"id":null,"label":"registerModifiersForm.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/registerModifiersForm/registerModifiersForm.ts","statSize":2691,"parsedSize":1071,"gzipSize":233,"inaccurateSizes":true}],"parsedSize":1071,"gzipSize":233,"inaccurateSizes":true},{"label":"validateProduct","path":"./src/index.ts + 30 modules (concatenated)/src/lib/validateProduct","statSize":75,"groups":[{"id":null,"label":"validateProduct.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/validateProduct/validateProduct.ts","statSize":75,"parsedSize":29,"gzipSize":6,"inaccurateSizes":true}],"parsedSize":29,"gzipSize":6,"inaccurateSizes":true},{"label":"initProducts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/initProducts","statSize":1484,"groups":[{"id":null,"label":"initProducts.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/initProducts/initProducts.ts","statSize":1484,"parsedSize":591,"gzipSize":129,"inaccurateSizes":true}],"parsedSize":591,"gzipSize":129,"inaccurateSizes":true},{"id":null,"label":"common.ts","path":"./src/index.ts + 30 modules (concatenated)/src/lib/common.ts","statSize":930,"parsedSize":370,"gzipSize":80,"inaccurateSizes":true}],"parsedSize":6578,"gzipSize":1435,"inaccurateSizes":true},{"label":"services","path":"./src/index.ts + 30 modules (concatenated)/src/services","statSize":8566,"groups":[{"label":"fetchProductDetails","path":"./src/index.ts + 30 modules (concatenated)/src/services/fetchProductDetails","statSize":2858,"groups":[{"id":null,"label":"fetchProductDetails.service.tsx","path":"./src/index.ts + 30 modules (concatenated)/src/services/fetchProductDetails/fetchProductDetails.service.tsx","statSize":2858,"parsedSize":1138,"gzipSize":248,"inaccurateSizes":true}],"parsedSize":1138,"gzipSize":248,"inaccurateSizes":true},{"label":"fetchProducts","path":"./src/index.ts + 30 modules (concatenated)/src/services/fetchProducts","statSize":2852,"groups":[{"id":null,"label":"fetchProducts.service.tsx","path":"./src/index.ts + 30 modules (concatenated)/src/services/fetchProducts/fetchProducts.service.tsx","statSize":2852,"parsedSize":1136,"gzipSize":247,"inaccurateSizes":true}],"parsedSize":1136,"gzipSize":247,"inaccurateSizes":true},{"label":"fetchStoreDetails","path":"./src/index.ts + 30 modules (concatenated)/src/services/fetchStoreDetails","statSize":2856,"groups":[{"id":null,"label":"fetchStoreDetails.service.tsx","path":"./src/index.ts + 30 modules (concatenated)/src/services/fetchStoreDetails/fetchStoreDetails.service.tsx","statSize":2856,"parsedSize":1137,"gzipSize":248,"inaccurateSizes":true}],"parsedSize":1137,"gzipSize":248,"inaccurateSizes":true}],"parsedSize":3412,"gzipSize":744,"inaccurateSizes":true},{"label":"config","path":"./src/index.ts + 30 modules (concatenated)/src/config","statSize":1528,"groups":[{"id":null,"label":"constants.ts","path":"./src/index.ts + 30 modules (concatenated)/src/config/constants.ts","statSize":1528,"parsedSize":608,"gzipSize":132,"inaccurateSizes":true}],"parsedSize":608,"gzipSize":132,"inaccurateSizes":true},{"label":"errors","path":"./src/index.ts + 30 modules (concatenated)/src/errors","statSize":2378,"groups":[{"id":null,"label":"api.errors.ts","path":"./src/index.ts + 30 modules (concatenated)/src/errors/api.errors.ts","statSize":2378,"parsedSize":947,"gzipSize":206,"inaccurateSizes":true}],"parsedSize":947,"gzipSize":206,"inaccurateSizes":true}],"parsedSize":29466,"gzipSize":6432,"inaccurateSizes":true}]}],"parsedSize":29470,"gzipSize":6433}]},{"label":"vendors.bundle.js","isAsset":true,"statSize":19,"parsedSize":1175,"gzipSize":528,"groups":[{"label":"src","path":"./src","statSize":19,"groups":[{"id":22,"label":"vendors.ts","path":"./src/vendors.ts","statSize":19,"parsedSize":15,"gzipSize":35}],"parsedSize":15,"gzipSize":35}]}];
50
50
  window.defaultSizes = "parsed";
51
51
  </script>
52
52
  </body>
@@ -6,6 +6,11 @@ export { getProducts } from "./lib/getProducts/getProducts";
6
6
  export { getRecommendedProducts } from "./lib/getRecommendedProducts/getRecommendedProducts";
7
7
  export { getRelatedProducts } from "./lib/getRelatedProducts/getRelatedProducts";
8
8
  export { getStoreDetails } from "./lib/getStoreDetails/getStoreDetails";
9
+ export { registerModifiersForm } from "./lib/registerModifiersForm/registerModifiersForm";
10
+ export { validateProduct } from "./lib/validateProduct/validateProduct";
9
11
  export { initProducts } from "./lib/initProducts/initProducts";
10
12
  export { getProductTotals } from "./utils/caculations/calculations.utils";
11
13
  export { transformers, assertions };
14
+ export type { ModifierGroupRenderer } from "./types/modifiers.types";
15
+ export type { ModifierRenderer } from "./types/modifiers.types";
16
+ export type { ModifiersForm } from "./lib/registerModifiersForm/registerModifiersForm.types";
@@ -5,6 +5,7 @@ export declare const getState: () => {
5
5
  artisanApp: import("../../../types/build").ArtisanApp | undefined;
6
6
  apiCache: import("../types/common.types").ApiCache;
7
7
  expiresAt: number;
8
+ forms: import("../types/common.types").ModifiersForms;
8
9
  timeout?: number | undefined;
9
10
  accountId?: string | number | undefined;
10
11
  productId?: string | number | undefined;
@@ -1,9 +1,7 @@
1
1
  import { FetchProductDetailsConfig } from "./getProductDetails.types";
2
2
  export declare const getProductDetails: (productId: number | string, config: FetchProductDetailsConfig) => Promise<import("../../../../types/build").BaseProduct | {
3
3
  data: any;
4
- hints: {
5
- [x: string]: string | number | boolean;
6
- };
4
+ hints: Partial<import("../../../../types/build").ArtisanHints>;
7
5
  config: import("../../../../types/build").ArtisanRequest;
8
6
  error: string | undefined;
9
7
  } | import("../../../../types/build").Product[]>;
@@ -1,9 +1,7 @@
1
1
  import { FetchProductsConfig } from "./getProducts.types";
2
2
  export declare const getProducts: (config: FetchProductsConfig) => Promise<import("../../../../types/build").BaseProduct | {
3
3
  data: any;
4
- hints: {
5
- [x: string]: string | number | boolean;
6
- };
4
+ hints: Partial<import("../../../../types/build").ArtisanHints>;
7
5
  config: import("../../../../types/build").ArtisanRequest;
8
6
  error: string | undefined;
9
7
  } | import("../../../../types/build").Product[]>;
@@ -1,9 +1,7 @@
1
1
  import { FetchStoreDetailsConfig } from "./getStoreDetails.types";
2
2
  export declare const getStoreDetails: (config: FetchStoreDetailsConfig) => Promise<import("../../../../types/build").BaseProduct | {
3
3
  data: any;
4
- hints: {
5
- [x: string]: string | number | boolean;
6
- };
4
+ hints: Partial<import("../../../../types/build").ArtisanHints>;
7
5
  config: import("../../../../types/build").ArtisanRequest;
8
6
  error: string | undefined;
9
7
  } | import("../../../../types/build").Product[]>;
@@ -0,0 +1,3 @@
1
+ import { RegisterModifiersForm } from "./registerModifiersForm.types";
2
+ export declare const registerModifiersForm: RegisterModifiersForm;
3
+ export declare const unsuscriber: (productId: string) => void;
@@ -0,0 +1,34 @@
1
+ import { CartProduct, Product } from "@artisan-commerce/types";
2
+ import { ValidateProduct } from "../validateProduct/validateProduct.types";
3
+ import { ModifierTypes } from "../../types/modifiers.types";
4
+ import { ModifierGroupRenderer } from "../../types/modifiers.types";
5
+ export interface ModifiersForm {
6
+ renderer: ModifierGroupRenderer[];
7
+ product: CartProduct;
8
+ validate: ValidateProduct;
9
+ }
10
+ export interface ModifiersFormInternal extends ModifiersForm {
11
+ callback: ModifiersFormCallback;
12
+ }
13
+ export declare type ModifiersFormCallback = (form: ModifiersForm) => void;
14
+ export declare type ModifiersFormUnsuscriber = () => void;
15
+ export declare type HandleChangeFunction = (amount: number) => void;
16
+ export declare type RegisterModifiersForm = (product: Product, callback: ModifiersFormCallback) => ModifiersFormUnsuscriber;
17
+ export interface BuildModifierRendererConfig {
18
+ rootId: string;
19
+ min: number;
20
+ max: number;
21
+ type: ModifierTypes;
22
+ modifiersCount: number;
23
+ amount: number;
24
+ path: string[];
25
+ }
26
+ export interface BuildModifierGroupConfig {
27
+ amount: number;
28
+ rootId: string;
29
+ path: string[];
30
+ }
31
+ export interface BuildRendererConfig {
32
+ rootId: string;
33
+ path: string[];
34
+ }
@@ -0,0 +1 @@
1
+ export declare const validateProduct: () => void;
@@ -0,0 +1,2 @@
1
+ import { CartProduct } from "@artisan-commerce/types";
2
+ export declare type ValidateProduct = (product: CartProduct) => void;
@@ -1,4 +1,5 @@
1
1
  import { ArtisanApp, ArtisanHints, Product } from "@artisan-commerce/types";
2
+ import { ModifiersFormInternal } from "../lib/registerModifiersForm/registerModifiersForm.types";
2
3
  export interface ProductHints extends Omit<ArtisanHints, "accountId"> {
3
4
  accountId?: ArtisanHints["accountId"];
4
5
  }
@@ -9,7 +10,11 @@ export interface GlobalState extends InitProductsConfig {
9
10
  artisanApp: ArtisanApp | undefined;
10
11
  apiCache: ApiCache;
11
12
  expiresAt: number;
13
+ forms: ModifiersForms;
12
14
  }
13
15
  export interface ApiCache {
14
16
  [key: string]: Product | Product[];
15
17
  }
18
+ export interface ModifiersForms {
19
+ [key: string]: ModifiersFormInternal;
20
+ }
@@ -0,0 +1,57 @@
1
+ import { CartProduct, Image } from "@artisan-commerce/types";
2
+ import { CartProductQuestion } from "@artisan-commerce/types";
3
+ import { CartProductAnswer } from "@artisan-commerce/types";
4
+ import { HandleChangeFunction } from "../lib/registerModifiersForm/registerModifiersForm.types";
5
+ import { ProductTotals } from "../utils/caculations/calculations.utils.types";
6
+ export declare type RenderTypes = "RADIO" | "CHECKBOX" | "COUNTER";
7
+ export interface ModifierGroupRenderer {
8
+ id: string;
9
+ name: string;
10
+ description: string;
11
+ images: Image[];
12
+ data: CartProductQuestion;
13
+ type: GroupTypes;
14
+ error: string;
15
+ hidden: boolean;
16
+ required: boolean;
17
+ touched: boolean;
18
+ modifiers: ModifierRenderer[];
19
+ }
20
+ export declare type GroupTypes = RenderTypes;
21
+ export interface ModifierRenderer {
22
+ id: string;
23
+ groupId: string;
24
+ name: string;
25
+ amount: number;
26
+ images: Image[];
27
+ min: number;
28
+ max: number;
29
+ groups: ModifierGroupRenderer[];
30
+ data: CartProductAnswer;
31
+ type: ModifierTypes;
32
+ error: string;
33
+ hidden: boolean;
34
+ required: boolean;
35
+ touched: boolean;
36
+ handleChange: HandleChangeFunction;
37
+ totals: ModifierTotals;
38
+ }
39
+ export declare type ModifierTypes = RenderTypes;
40
+ export interface ModifierTotals extends ProductTotals {
41
+ }
42
+ export interface FormCartProduct extends Omit<CartProduct, "questions"> {
43
+ questions: FormCartProductQuestions[];
44
+ }
45
+ export interface FormCartProductQuestions extends Omit<CartProductQuestion, "answers"> {
46
+ answers: FormCartProductAnswer[];
47
+ }
48
+ export interface FormCartProductAnswer extends CartProductAnswer {
49
+ min: number;
50
+ max: number;
51
+ renderType: ModifierTypes;
52
+ }
53
+ export interface GetModifierTypeConfig {
54
+ min: number;
55
+ max: number;
56
+ groupType: GroupTypes;
57
+ }
@@ -1,6 +1,8 @@
1
1
  import { BaseProduct } from "@artisan-commerce/types";
2
2
  import { ProductDetails } from "@artisan-commerce/types";
3
3
  import { CartProduct } from "@artisan-commerce/types";
4
+ import { FormCartProduct } from "../../types/modifiers.types";
4
5
  export declare const isBaseProduct: (product: BaseProduct) => boolean;
5
6
  export declare const isProductDetails: (product: ProductDetails) => boolean;
6
7
  export declare const isCartProduct: (product: CartProduct) => boolean;
8
+ export declare const isFormCartProduct: (product: FormCartProduct) => boolean;
@@ -1,2 +1,3 @@
1
1
  export declare const stringIsNumber: (value: string) => boolean;
2
2
  export declare const enumToArray: (enumObj: any) => string[];
3
+ export declare const logError: (message: string) => void;
@@ -2,9 +2,7 @@ import { ArtisanRequest } from "@artisan-commerce/types";
2
2
  import { ProductsHTTPConfig, RequestData } from "../../types/http.types";
3
3
  export declare const handleHTTPCall: <T extends ProductsHTTPConfig>(path: string, config: T, data: RequestData, callback: (request: ArtisanRequest) => any) => Promise<import("../../../../types/build").BaseProduct | {
4
4
  data: any;
5
- hints: {
6
- [x: string]: string | number | boolean;
7
- };
5
+ hints: Partial<import("../../../../types/build").ArtisanHints>;
8
6
  config: ArtisanRequest;
9
7
  error: string | undefined;
10
8
  } | import("../../../../types/build").Product[]>;
@@ -2,5 +2,6 @@ import { ArtisanRequest } from "@artisan-commerce/types";
2
2
  import { ProductsHTTPConfig, RequestData } from "../../types/http.types";
3
3
  export declare const buildHTTPRequest: (path: string, config: ProductsHTTPConfig, data: RequestData) => ArtisanRequest;
4
4
  export declare const filtersToQuery: (filters: ProductsHTTPConfig["filterBy"]) => {};
5
+ export declare const additionalFiltersToQuery: (filters?: ProductsHTTPConfig["additionalFilters"]) => {};
5
6
  export declare const parseRoute: (path: string, params: RequestData["params"]) => string;
6
7
  export declare const getRequestHash: (url: string) => string;
@@ -0,0 +1,12 @@
1
+ import { ProductQuestion } from "@artisan-commerce/types";
2
+ import { BuildModifierRendererConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
3
+ import { ModifierRenderer } from "../../types/modifiers.types";
4
+ import { FormCartProductQuestions } from "../../types/modifiers.types";
5
+ import { GetModifierTypeConfig } from "../../types/modifiers.types";
6
+ import { GroupTypes, ModifierTypes } from "../../types/modifiers.types";
7
+ export declare const getGroupType: (group: ProductQuestion) => GroupTypes;
8
+ export declare const getModifierType: (config: GetModifierTypeConfig) => ModifierTypes;
9
+ export declare const getModifierMin: (groupConfig: BuildModifierRendererConfig) => number;
10
+ export declare const getModifierMax: (groupConfig: BuildModifierRendererConfig) => number;
11
+ export declare const countGroupModifiersAmount: (group: FormCartProductQuestions) => number;
12
+ export declare const getModifierError: (modifier: ModifierRenderer, amount: number) => string;
@@ -0,0 +1,3 @@
1
+ import { Product } from "@artisan-commerce/types";
2
+ import { ModifiersForm } from "../..";
3
+ export declare const createForm: (product: Product) => ModifiersForm;
@@ -0,0 +1 @@
1
+ export declare const handleModifierChange: (productId: string, path: string[], amount: number) => void;
@@ -0,0 +1,11 @@
1
+ import { ModifierGroupRenderer } from "../..";
2
+ import { ModifierRenderer } from "../..";
3
+ import { BuildModifierRendererConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
4
+ import { BuildRendererConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
5
+ import { BuildModifierGroupConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
6
+ import { FormCartProduct } from "../../types/modifiers.types";
7
+ import { FormCartProductQuestions } from "../../types/modifiers.types";
8
+ import { FormCartProductAnswer } from "../../types/modifiers.types";
9
+ export declare const buildRenderer: (product: FormCartProduct, config: BuildRendererConfig) => ModifierGroupRenderer[];
10
+ export declare const buildModifierGroupRenderer: (modifierGroup: FormCartProductQuestions, parentConfig: BuildModifierGroupConfig) => ModifierGroupRenderer;
11
+ export declare const buildModifierRenderer: (modifier: FormCartProductAnswer, config: BuildModifierRendererConfig) => ModifierRenderer;
@@ -0,0 +1,4 @@
1
+ import { ModifierGroupRenderer, ModifierRenderer } from "../..";
2
+ export declare const getRendererPathNode: (groups: ModifierGroupRenderer[], path: string[]) => ModifierGroupRenderer | ModifierRenderer;
3
+ export declare const setRendererPathNode: (renderer: ModifierGroupRenderer[], path: string[], replacement: ModifierGroupRenderer | ModifierRenderer) => any[];
4
+ export declare const findNodeInPath: (segments: (ModifierGroupRenderer | ModifierRenderer)[], segmentId: string) => ModifierGroupRenderer | ModifierRenderer;
@@ -0,0 +1,5 @@
1
+ import { ModifierGroupRenderer } from "../..";
2
+ import { ModifierRenderer } from "../..";
3
+ export declare const updateModifier: (renderer: ModifierGroupRenderer[], path: string[], node: ModifierRenderer, amount: number) => any[];
4
+ export declare const updateParentGroup: (rootId: string, renderer: ModifierGroupRenderer[], path: string[]) => any[];
5
+ export declare const updateParentModifier: (rootId: string, renderer: ModifierGroupRenderer[], path: string[]) => any[];
@@ -1,9 +1,7 @@
1
- import { ArtisanRequest } from "@artisan-commerce/types";
1
+ import { ArtisanRequest, ArtisanHints } from "@artisan-commerce/types";
2
2
  export declare const transformResponse: (data: any, error: Error | undefined, req: ArtisanRequest) => {
3
3
  data: any;
4
- hints: {
5
- [x: string]: string | number | boolean;
6
- };
4
+ hints: Partial<ArtisanHints>;
7
5
  config: ArtisanRequest;
8
6
  error: string | undefined;
9
7
  };
@@ -1,2 +1,9 @@
1
+ import { ProductDetails } from "@artisan-commerce/types";
1
2
  import { Product, CartProduct } from "@artisan-commerce/types";
3
+ import { FormCartProduct } from "../../types/modifiers.types";
4
+ import { FormCartProductAnswer } from "../../types/modifiers.types";
2
5
  export declare const toCartProduct: (product: Product, overrides?: Partial<CartProduct>) => CartProduct;
6
+ export declare const toFormCartProduct: (product: Product, overrides?: Partial<FormCartProduct>) => FormCartProduct;
7
+ export declare const toFormCartProductHelper: (product: CartProduct | FormCartProductAnswer, overrides?: Partial<FormCartProduct>) => FormCartProduct;
8
+ export declare const toFormCartProductFromProductDetails: (product: ProductDetails, overrides?: Partial<FormCartProduct>) => FormCartProduct;
9
+ export declare const toFormCartProductFromAnswer: (modifier: FormCartProductAnswer, overrides?: Partial<FormCartProduct>) => FormCartProduct;
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("products",[],t):"object"==typeof exports?exports.products=t():e.products=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=21)}({21:function(e,t){}})}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("products",[],t):"object"==typeof exports?exports.products=t():e.products=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}({22:function(e,t){}})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@artisan-commerce/products",
3
3
  "description": "Artisan's product management library",
4
- "version": "0.5.5",
4
+ "version": "0.5.10",
5
5
  "main": "./build/main.bundle.js",
6
6
  "types": "./build/src/index.d.ts",
7
7
  "files": [
@@ -31,7 +31,7 @@
31
31
  "author": "Luis Eduardo Andrade",
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@artisan-commerce/builders": "^0.3.4",
34
+ "@artisan-commerce/builders": "^0.4.4",
35
35
  "@bugsnag/js": "^7.2.0",
36
36
  "axios": "^0.19.2",
37
37
  "i18next": "^19.6.2",
@@ -40,7 +40,7 @@
40
40
  "sha1": "^1.1.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@artisan-commerce/types": "^0.8.0",
43
+ "@artisan-commerce/types": "^0.8.5",
44
44
  "@babel/core": "^7.10.5",
45
45
  "@babel/preset-env": "^7.10.4",
46
46
  "@babel/preset-react": "^7.10.4",
@@ -87,5 +87,5 @@
87
87
  "webpack-dev-server": "^3.11.0",
88
88
  "webpack-merge": "^5.0.9"
89
89
  },
90
- "gitHead": "1e88dc2d5c4aba8a3793692e481cd05163b1aed6"
90
+ "gitHead": "456809f724dd424f6e707d896359f279fc6f4b06"
91
91
  }