@vtex/lean-shipping-calculator
Advanced tools
Comparing version 0.1.3 to 0.2.15
105
CHANGELOG.md
@@ -10,2 +10,107 @@ # Changelog | ||
## [0.2.15] - 2022-07-05 | ||
### Changed | ||
- Remove `vtex.address-form` dependency. | ||
### Fixed | ||
- Build script not working. | ||
## [0.2.14] - 2021-09-28 | ||
### Added | ||
- Debug logs for getLeanShippingOptions function | ||
## [0.2.13] - 2021-09-21 | ||
### Fixed | ||
- Validate selected SLAs and consider different options. | ||
## [0.2.12] - 2021-07-29 | ||
### Fixed | ||
- Use consistency of SLA's through items as a tiebreaker. | ||
## [0.2.11] - 2020-11-17 | ||
### Changed | ||
- `findSlaWithChannel` now returns the cheapest SLA. | ||
## [0.2.10] - 2020-05-13 | ||
### Fixed | ||
- Pickup SLAs can not be selected when the `selectedDeliveryChannel` is `delivery`. | ||
## [0.2.9] - 2020-04-30 | ||
### Fixed | ||
- `hasItemWithMandatoryScheduledDelivery` only evaluates to `true` if all the SLAs have `delivery` as their delivery channel. | ||
## [0.2.8] - 2020-04-20 | ||
### Changed | ||
- Scheduled SLAs are no longer taken into consideration when calculating lean shipping options. | ||
## [0.2.7] - 2020-04-08 | ||
### Fixed | ||
- In Pickup channel, `setSelectedSlaFromSlaOption` only sets the SLA of items that have that SLA. | ||
## [0.2.6] - 2020-04-07 | ||
### Fixed | ||
- `setSelectedSlaFromSlaOption` only sets the SLA of items that have that SLA. | ||
## [0.2.5] - 2019-08-14 | ||
### Changed | ||
- Selecting pickup points considering if have single or multiple items | ||
## [0.2.4] - 2019-08-06 | ||
### Changed | ||
- `findSlaWithChannel` to prioritize non scheduled options to select | ||
## [0.2.3] - 2019-07-04 | ||
## [0.2.2] - 2019-07-04 | ||
### Changed | ||
- Behavior when switching between deliveryChannels. | ||
## [0.2.1] - 2019-05-28 | ||
### Fixed | ||
- Showing combined | ||
## [0.2.0] - 2019-05-28 | ||
### Added | ||
- `setSelectedSlaFromSlaOption` `changeActiveSlas` helper functions to select slas | ||
## [0.1.5] - 2019-02-04 | ||
### Fixed | ||
- Item selection from `itemId` to `itemIndex` | ||
## [0.1.4] - 2019-01-11 | ||
### Fixed | ||
- Fix selecting empty logisticsInfo | ||
## [0.1.3] - 2019-01-04 | ||
@@ -12,0 +117,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t.vtex=t.vtex||{},t.vtex.leanShippingCalculator={}))}(this,function(t){"use strict";var r=function(t,r,e){return t==t&&(void 0!==e&&(t=t<=e?t:e),void 0!==r&&(t=t>=r?t:r)),t},e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t,r){return t(r={exports:{}},r.exports),r.exports}var o="object"==typeof e&&e&&e.Object===Object&&e,a="object"==typeof self&&self&&self.Object===Object&&self,i=o||a||Function("return this")(),u=i.Symbol;var c=function(t,r){for(var e=-1,n=null==t?0:t.length,o=Array(n);++e<n;)o[e]=r(t[e],e,t);return o},f=Array.isArray,l=Object.prototype,s=l.hasOwnProperty,v=l.toString,p=u?u.toStringTag:void 0;var h=function(t){var r=s.call(t,p),e=t[p];try{t[p]=void 0;var n=!0}catch(t){}var o=v.call(t);return n&&(r?t[p]=e:delete t[p]),o},d=Object.prototype.toString;var b=function(t){return d.call(t)},y="[object Null]",g="[object Undefined]",j=u?u.toStringTag:void 0;var _=function(t){return null==t?void 0===t?g:y:j&&j in Object(t)?h(t):b(t)};var w=function(t){return null!=t&&"object"==typeof t},S="[object Symbol]";var O=function(t){return"symbol"==typeof t||w(t)&&_(t)==S},m=1/0,A=u?u.prototype:void 0,D=A?A.toString:void 0;var E=function t(r){if("string"==typeof r)return r;if(f(r))return c(r,t)+"";if(O(r))return D?D.call(r):"";var e=r+"";return"0"==e&&1/r==-m?"-0":e};var I=function(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)},x=NaN,C=/^\s+|\s+$/g,P=/^[-+]0x[0-9a-f]+$/i,z=/^0b[01]+$/i,F=/^0o[0-7]+$/i,M=parseInt;var U=function(t){if("number"==typeof t)return t;if(O(t))return x;if(I(t)){var r="function"==typeof t.valueOf?t.valueOf():t;t=I(r)?r+"":r}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(C,"");var e=z.test(t);return e||F.test(t)?M(t.slice(2),e?2:8):P.test(t)?x:+t},k=1/0,T=1.7976931348623157e308;var B=function(t){return t?(t=U(t))===k||t===-k?(t<0?-1:1)*T:t==t?t:0:0===t?t:0};var $=function(t){var r=B(t),e=r%1;return r==r?e?r-e:r:0};var N=function(t){return null==t?"":E(t)};var L=function(t,e,n){t=N(t),e=E(e);var o=t.length,a=n=void 0===n?o:r($(n),0,o);return(n-=e.length)>=0&&t.slice(n,a)==e};var R=function(t,r){for(var e=-1,n=null==t?0:t.length,o=0,a=[];++e<n;){var i=t[e];r(i,e,t)&&(a[o++]=i)}return a};var W=function(t){return function(r,e,n){for(var o=-1,a=Object(r),i=n(r),u=i.length;u--;){var c=i[t?u:++o];if(!1===e(a[c],c,a))break}return r}}();var V=function(t,r){for(var e=-1,n=Array(t);++e<t;)n[e]=r(e);return n},H="[object Arguments]";var Y=function(t){return w(t)&&_(t)==H},Q=Object.prototype,G=Q.hasOwnProperty,q=Q.propertyIsEnumerable,J=Y(function(){return arguments}())?Y:function(t){return w(t)&&G.call(t,"callee")&&!q.call(t,"callee")};var K=function(){return!1},X=n(function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,o=n&&n.exports===e?i.Buffer:void 0,a=(o?o.isBuffer:void 0)||K;t.exports=a}),Z=9007199254740991,tt=/^(?:0|[1-9]\d*)$/;var rt=function(t,r){var e=typeof t;return!!(r=null==r?Z:r)&&("number"==e||"symbol"!=e&&tt.test(t))&&t>-1&&t%1==0&&t<r},et=9007199254740991;var nt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=et},ot={};ot["[object Float32Array]"]=ot["[object Float64Array]"]=ot["[object Int8Array]"]=ot["[object Int16Array]"]=ot["[object Int32Array]"]=ot["[object Uint8Array]"]=ot["[object Uint8ClampedArray]"]=ot["[object Uint16Array]"]=ot["[object Uint32Array]"]=!0,ot["[object Arguments]"]=ot["[object Array]"]=ot["[object ArrayBuffer]"]=ot["[object Boolean]"]=ot["[object DataView]"]=ot["[object Date]"]=ot["[object Error]"]=ot["[object Function]"]=ot["[object Map]"]=ot["[object Number]"]=ot["[object Object]"]=ot["[object RegExp]"]=ot["[object Set]"]=ot["[object String]"]=ot["[object WeakMap]"]=!1;var at=function(t){return w(t)&&nt(t.length)&&!!ot[_(t)]};var it=function(t){return function(r){return t(r)}},ut=n(function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,a=n&&n.exports===e&&o.process,i=function(){try{return a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=i}),ct=ut&&ut.isTypedArray,ft=ct?it(ct):at,lt=Object.prototype.hasOwnProperty;var st=function(t,r){var e=f(t),n=!e&&J(t),o=!e&&!n&&X(t),a=!e&&!n&&!o&&ft(t),i=e||n||o||a,u=i?V(t.length,String):[],c=u.length;for(var l in t)!r&&!lt.call(t,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||rt(l,c))||u.push(l);return u},vt=Object.prototype;var pt=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||vt)};var ht=function(t,r){return function(e){return t(r(e))}},dt=ht(Object.keys,Object),bt=Object.prototype.hasOwnProperty;var yt=function(t){if(!pt(t))return dt(t);var r=[];for(var e in Object(t))bt.call(t,e)&&"constructor"!=e&&r.push(e);return r},gt="[object AsyncFunction]",jt="[object Function]",_t="[object GeneratorFunction]",wt="[object Proxy]";var St=function(t){if(!I(t))return!1;var r=_(t);return r==jt||r==_t||r==gt||r==wt};var Ot=function(t){return null!=t&&nt(t.length)&&!St(t)};var mt=function(t){return Ot(t)?st(t):yt(t)};var At=function(t,r){return function(e,n){if(null==e)return e;if(!Ot(e))return t(e,n);for(var o=e.length,a=r?o:-1,i=Object(e);(r?a--:++a<o)&&!1!==n(i[a],a,i););return e}}(function(t,r){return t&&W(t,r,mt)});var Dt=function(t,r){var e=[];return At(t,function(t,n,o){r(t,n,o)&&e.push(t)}),e};var Et=function(){this.__data__=[],this.size=0};var It=function(t,r){return t===r||t!=t&&r!=r};var xt=function(t,r){for(var e=t.length;e--;)if(It(t[e][0],r))return e;return-1},Ct=Array.prototype.splice;var Pt=function(t){var r=this.__data__,e=xt(r,t);return!(e<0||(e==r.length-1?r.pop():Ct.call(r,e,1),--this.size,0))};var zt=function(t){var r=this.__data__,e=xt(r,t);return e<0?void 0:r[e][1]};var Ft=function(t){return xt(this.__data__,t)>-1};var Mt=function(t,r){var e=this.__data__,n=xt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};function Ut(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}Ut.prototype.clear=Et,Ut.prototype.delete=Pt,Ut.prototype.get=zt,Ut.prototype.has=Ft,Ut.prototype.set=Mt;var kt=Ut;var Tt=function(){this.__data__=new kt,this.size=0};var Bt=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e};var $t=function(t){return this.__data__.get(t)};var Nt,Lt=function(t){return this.__data__.has(t)},Rt=i["__core-js_shared__"],Wt=(Nt=/[^.]+$/.exec(Rt&&Rt.keys&&Rt.keys.IE_PROTO||""))?"Symbol(src)_1."+Nt:"";var Vt=function(t){return!!Wt&&Wt in t},Ht=Function.prototype.toString;var Yt=function(t){if(null!=t){try{return Ht.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Qt=/^\[object .+?Constructor\]$/,Gt=Function.prototype,qt=Object.prototype,Jt=Gt.toString,Kt=qt.hasOwnProperty,Xt=RegExp("^"+Jt.call(Kt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Zt=function(t){return!(!I(t)||Vt(t))&&(St(t)?Xt:Qt).test(Yt(t))};var tr=function(t,r){return null==t?void 0:t[r]};var rr=function(t,r){var e=tr(t,r);return Zt(e)?e:void 0},er=rr(i,"Map"),nr=rr(Object,"create");var or=function(){this.__data__=nr?nr(null):{},this.size=0};var ar=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r},ir="__lodash_hash_undefined__",ur=Object.prototype.hasOwnProperty;var cr=function(t){var r=this.__data__;if(nr){var e=r[t];return e===ir?void 0:e}return ur.call(r,t)?r[t]:void 0},fr=Object.prototype.hasOwnProperty;var lr=function(t){var r=this.__data__;return nr?void 0!==r[t]:fr.call(r,t)},sr="__lodash_hash_undefined__";var vr=function(t,r){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=nr&&void 0===r?sr:r,this};function pr(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}pr.prototype.clear=or,pr.prototype.delete=ar,pr.prototype.get=cr,pr.prototype.has=lr,pr.prototype.set=vr;var hr=pr;var dr=function(){this.size=0,this.__data__={hash:new hr,map:new(er||kt),string:new hr}};var br=function(t){var r=typeof t;return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t};var yr=function(t,r){var e=t.__data__;return br(r)?e["string"==typeof r?"string":"hash"]:e.map};var gr=function(t){var r=yr(this,t).delete(t);return this.size-=r?1:0,r};var jr=function(t){return yr(this,t).get(t)};var _r=function(t){return yr(this,t).has(t)};var wr=function(t,r){var e=yr(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this};function Sr(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}Sr.prototype.clear=dr,Sr.prototype.delete=gr,Sr.prototype.get=jr,Sr.prototype.has=_r,Sr.prototype.set=wr;var Or=Sr,mr=200;var Ar=function(t,r){var e=this.__data__;if(e instanceof kt){var n=e.__data__;if(!er||n.length<mr-1)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Or(n)}return e.set(t,r),this.size=e.size,this};function Dr(t){var r=this.__data__=new kt(t);this.size=r.size}Dr.prototype.clear=Tt,Dr.prototype.delete=Bt,Dr.prototype.get=$t,Dr.prototype.has=Lt,Dr.prototype.set=Ar;var Er=Dr,Ir="__lodash_hash_undefined__";var xr=function(t){return this.__data__.set(t,Ir),this};var Cr=function(t){return this.__data__.has(t)};function Pr(t){var r=-1,e=null==t?0:t.length;for(this.__data__=new Or;++r<e;)this.add(t[r])}Pr.prototype.add=Pr.prototype.push=xr,Pr.prototype.has=Cr;var zr=Pr;var Fr=function(t,r){for(var e=-1,n=null==t?0:t.length;++e<n;)if(r(t[e],e,t))return!0;return!1};var Mr=function(t,r){return t.has(r)},Ur=1,kr=2;var Tr=function(t,r,e,n,o,a){var i=e&Ur,u=t.length,c=r.length;if(u!=c&&!(i&&c>u))return!1;var f=a.get(t);if(f&&a.get(r))return f==r;var l=-1,s=!0,v=e&kr?new zr:void 0;for(a.set(t,r),a.set(r,t);++l<u;){var p=t[l],h=r[l];if(n)var d=i?n(h,p,l,r,t,a):n(p,h,l,t,r,a);if(void 0!==d){if(d)continue;s=!1;break}if(v){if(!Fr(r,function(t,r){if(!Mr(v,r)&&(p===t||o(p,t,e,n,a)))return v.push(r)})){s=!1;break}}else if(p!==h&&!o(p,h,e,n,a)){s=!1;break}}return a.delete(t),a.delete(r),s},Br=i.Uint8Array;var $r=function(t){var r=-1,e=Array(t.size);return t.forEach(function(t,n){e[++r]=[n,t]}),e};var Nr=function(t){var r=-1,e=Array(t.size);return t.forEach(function(t){e[++r]=t}),e},Lr=1,Rr=2,Wr="[object Boolean]",Vr="[object Date]",Hr="[object Error]",Yr="[object Map]",Qr="[object Number]",Gr="[object RegExp]",qr="[object Set]",Jr="[object String]",Kr="[object Symbol]",Xr="[object ArrayBuffer]",Zr="[object DataView]",te=u?u.prototype:void 0,re=te?te.valueOf:void 0;var ee=function(t,r,e,n,o,a,i){switch(e){case Zr:if(t.byteLength!=r.byteLength||t.byteOffset!=r.byteOffset)return!1;t=t.buffer,r=r.buffer;case Xr:return!(t.byteLength!=r.byteLength||!a(new Br(t),new Br(r)));case Wr:case Vr:case Qr:return It(+t,+r);case Hr:return t.name==r.name&&t.message==r.message;case Gr:case Jr:return t==r+"";case Yr:var u=$r;case qr:var c=n&Lr;if(u||(u=Nr),t.size!=r.size&&!c)return!1;var f=i.get(t);if(f)return f==r;n|=Rr,i.set(t,r);var l=Tr(u(t),u(r),n,o,a,i);return i.delete(t),l;case Kr:if(re)return re.call(t)==re.call(r)}return!1};var ne=function(t,r){for(var e=-1,n=r.length,o=t.length;++e<n;)t[o+e]=r[e];return t};var oe=function(t,r,e){var n=r(t);return f(t)?n:ne(n,e(t))};var ae=function(){return[]},ie=Object.prototype.propertyIsEnumerable,ue=Object.getOwnPropertySymbols,ce=ue?function(t){return null==t?[]:(t=Object(t),R(ue(t),function(r){return ie.call(t,r)}))}:ae;var fe=function(t){return oe(t,mt,ce)},le=1,se=Object.prototype.hasOwnProperty;var ve=function(t,r,e,n,o,a){var i=e&le,u=fe(t),c=u.length;if(c!=fe(r).length&&!i)return!1;for(var f=c;f--;){var l=u[f];if(!(i?l in r:se.call(r,l)))return!1}var s=a.get(t);if(s&&a.get(r))return s==r;var v=!0;a.set(t,r),a.set(r,t);for(var p=i;++f<c;){var h=t[l=u[f]],d=r[l];if(n)var b=i?n(d,h,l,r,t,a):n(h,d,l,t,r,a);if(!(void 0===b?h===d||o(h,d,e,n,a):b)){v=!1;break}p||(p="constructor"==l)}if(v&&!p){var y=t.constructor,g=r.constructor;y!=g&&"constructor"in t&&"constructor"in r&&!("function"==typeof y&&y instanceof y&&"function"==typeof g&&g instanceof g)&&(v=!1)}return a.delete(t),a.delete(r),v},pe=rr(i,"DataView"),he=rr(i,"Promise"),de=rr(i,"Set"),be=rr(i,"WeakMap"),ye=Yt(pe),ge=Yt(er),je=Yt(he),_e=Yt(de),we=Yt(be),Se=_;(pe&&"[object DataView]"!=Se(new pe(new ArrayBuffer(1)))||er&&"[object Map]"!=Se(new er)||he&&"[object Promise]"!=Se(he.resolve())||de&&"[object Set]"!=Se(new de)||be&&"[object WeakMap]"!=Se(new be))&&(Se=function(t){var r=_(t),e="[object Object]"==r?t.constructor:void 0,n=e?Yt(e):"";if(n)switch(n){case ye:return"[object DataView]";case ge:return"[object Map]";case je:return"[object Promise]";case _e:return"[object Set]";case we:return"[object WeakMap]"}return r});var Oe=Se,me=1,Ae="[object Arguments]",De="[object Array]",Ee="[object Object]",Ie=Object.prototype.hasOwnProperty;var xe=function(t,r,e,n,o,a){var i=f(t),u=f(r),c=i?De:Oe(t),l=u?De:Oe(r),s=(c=c==Ae?Ee:c)==Ee,v=(l=l==Ae?Ee:l)==Ee,p=c==l;if(p&&X(t)){if(!X(r))return!1;i=!0,s=!1}if(p&&!s)return a||(a=new Er),i||ft(t)?Tr(t,r,e,n,o,a):ee(t,r,c,e,n,o,a);if(!(e&me)){var h=s&&Ie.call(t,"__wrapped__"),d=v&&Ie.call(r,"__wrapped__");if(h||d){var b=h?t.value():t,y=d?r.value():r;return a||(a=new Er),o(b,y,e,n,a)}}return!!p&&(a||(a=new Er),ve(t,r,e,n,o,a))};var Ce=function t(r,e,n,o,a){return r===e||(null==r||null==e||!w(r)&&!w(e)?r!=r&&e!=e:xe(r,e,n,o,t,a))},Pe=1,ze=2;var Fe=function(t,r,e,n){var o=e.length,a=o,i=!n;if(null==t)return!a;for(t=Object(t);o--;){var u=e[o];if(i&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=e[o])[0],f=t[c],l=u[1];if(i&&u[2]){if(void 0===f&&!(c in t))return!1}else{var s=new Er;if(n)var v=n(f,l,c,t,r,s);if(!(void 0===v?Ce(l,f,Pe|ze,n,s):v))return!1}}return!0};var Me=function(t){return t==t&&!I(t)};var Ue=function(t){for(var r=mt(t),e=r.length;e--;){var n=r[e],o=t[n];r[e]=[n,o,Me(o)]}return r};var ke=function(t,r){return function(e){return null!=e&&e[t]===r&&(void 0!==r||t in Object(e))}};var Te=function(t){var r=Ue(t);return 1==r.length&&r[0][2]?ke(r[0][0],r[0][1]):function(e){return e===t||Fe(e,t,r)}},Be=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$e=/^\w*$/;var Ne=function(t,r){if(f(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!O(t))||$e.test(t)||!Be.test(t)||null!=r&&t in Object(r)},Le="Expected a function";function Re(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError(Le);var e=function(){var n=arguments,o=r?r.apply(this,n):n[0],a=e.cache;if(a.has(o))return a.get(o);var i=t.apply(this,n);return e.cache=a.set(o,i)||a,i};return e.cache=new(Re.Cache||Or),e}Re.Cache=Or;var We=Re,Ve=500;var He=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ye=/\\(\\)?/g,Qe=function(t){var r=We(t,function(t){return e.size===Ve&&e.clear(),t}),e=r.cache;return r}(function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(He,function(t,e,n,o){r.push(n?o.replace(Ye,"$1"):e||t)}),r});var Ge=function(t,r){return f(t)?t:Ne(t,r)?[t]:Qe(N(t))},qe=1/0;var Je=function(t){if("string"==typeof t||O(t))return t;var r=t+"";return"0"==r&&1/t==-qe?"-0":r};var Ke=function(t,r){for(var e=0,n=(r=Ge(r,t)).length;null!=t&&e<n;)t=t[Je(r[e++])];return e&&e==n?t:void 0};var Xe=function(t,r,e){var n=null==t?void 0:Ke(t,r);return void 0===n?e:n};var Ze=function(t,r){return null!=t&&r in Object(t)};var tn=function(t,r,e){for(var n=-1,o=(r=Ge(r,t)).length,a=!1;++n<o;){var i=Je(r[n]);if(!(a=null!=t&&e(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&nt(o)&&rt(i,o)&&(f(t)||J(t))};var rn=function(t,r){return null!=t&&tn(t,r,Ze)},en=1,nn=2;var on=function(t,r){return Ne(t)&&Me(r)?ke(Je(t),r):function(e){var n=Xe(e,t);return void 0===n&&n===r?rn(e,t):Ce(r,n,en|nn)}};var an=function(t){return t};var un=function(t){return function(r){return null==r?void 0:r[t]}};var cn=function(t){return function(r){return Ke(r,t)}};var fn=function(t){return Ne(t)?un(Je(t)):cn(t)};var ln=function(t){return"function"==typeof t?t:null==t?an:"object"==typeof t?f(t)?on(t[0],t[1]):Te(t):fn(t)},sn="Expected a function";var vn=function(t){if("function"!=typeof t)throw new TypeError(sn);return function(){var r=arguments;switch(r.length){case 0:return!t.call(this);case 1:return!t.call(this,r[0]);case 2:return!t.call(this,r[0],r[1]);case 3:return!t.call(this,r[0],r[1],r[2])}return!t.apply(this,r)}};var pn=function(t,r){return(f(t)?R:Dt)(t,vn(ln(r,3)))},hn="[object Number]";var dn,bn=function(t){return"number"==typeof t||w(t)&&_(t)==hn},yn=864e5,gn=function(t){var r=new Date;return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return Math.round(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return t-r}(t,r)/yn)}(function(t,r){if(!t||!bn(r))return t;var e=function(t){var r=new Date(t.getTime());return r.setUTCHours(12,0,0,0),r}(t),n=e.getDay(),o=0;0!==n&&6!==n||(o=0===n?1:2);var a=Math.floor((r-1+(n%6||1))/5);return function(t,r){return new Date(t.getTime()+r*yn)}(e,r+o+2*a)}(r,t),r)};function jn(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var _n={BUSINESS_DAYS:"bd",DAYS:"d",HOURS:"h",MINUTES:"m"},wn=(jn(dn={},_n.BUSINESS_DAYS,86400),jn(dn,_n.DAYS,86400),jn(dn,_n.HOURS,3600),jn(dn,_n.MINUTES,60),dn);function Sn(t){return On(t,function(t){return t.price})}function On(t,r){if(!t||0===t.length)return null;var e=t[0],n=r(e);return t.forEach(function(t){var o=r(t);o<n&&(n=o,e=t)}),e}function mn(t){return pn(t,function(t){return t.pickupStoreInfo.isPickupStore})}function An(t){return On(t,function(t){return Dn(t.shippingEstimate)})}function Dn(t){if(void 0===t||null===t||""===t)return null;var r=En(t),e=function(t){var r=En(t),e=t.replace(r,"");return e?parseInt(e,10):0}(t);return"bd"===r&&(e=gn(e)),e*wn[r]}function En(t){var r="bd";return Object.keys(_n).forEach(function(e){var n=_n[e];if(L(t,n)){var o=t.replace(n,"");parseInt(o,10).toString()===o&&(r=n)}}),r}var In={getShippingEstimateQuantityInSeconds:Dn,getLatestSla:function(t){return function(t,r){if(!t||0===t.length)return null;var e=t[0],n=r(e);return t.forEach(function(t){var o=r(t);o>n&&(n=o,e=t)}),e}(t,function(t){return Dn(t.shippingEstimate)})},getFastestSla:An,getCheapestSla:Sn,selectCheapestSlaForAllItems:function(t){return t&&0!==t.length?t.map(function(t){var r=mn(t.slas);if(!r||0===r.length)return t;var e=Sn(r);return Object.assign({},t,{slas:t.slas,selectedSla:e.id,selectedDeliveryChannel:e.deliveryChannel})}):null},selectFastestSlaForAllItems:function(t){return t&&0!==t.length?t.map(function(t){var r=mn(t.slas);if(!r||0===r.length)return t;var e=An(r);return Object.assign({},t,{slas:t.slas,selectedSla:e.id,selectedDeliveryChannel:e.deliveryChannel})}):null}};var xn=function(t,r,e){for(var n=-1,o=t.length;++n<o;){var a=t[n],i=r(a);if(null!=i&&(void 0===u?i==i&&!O(i):e(i,u)))var u=i,c=a}return c};var Cn=function(t,r){return t<r};var Pn=function(t,r){return t&&t.length?xn(t,ln(r,2),Cn):void 0};var zn=function(t,r){return Ce(t,r)};var Fn=function(t,r){for(var e=-1,n=null==t?0:t.length;++e<n&&!1!==r(t[e],e,t););return t},Mn=function(){try{var t=rr(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Un=function(t,r,e){"__proto__"==r&&Mn?Mn(t,r,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[r]=e},kn=Object.prototype.hasOwnProperty;var Tn=function(t,r,e){var n=t[r];kn.call(t,r)&&It(n,e)&&(void 0!==e||r in t)||Un(t,r,e)};var Bn=function(t,r,e,n){var o=!e;e||(e={});for(var a=-1,i=r.length;++a<i;){var u=r[a],c=n?n(e[u],t[u],u,e,t):void 0;void 0===c&&(c=t[u]),o?Un(e,u,c):Tn(e,u,c)}return e};var $n=function(t,r){return t&&Bn(r,mt(r),t)};var Nn=function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r},Ln=Object.prototype.hasOwnProperty;var Rn=function(t){if(!I(t))return Nn(t);var r=pt(t),e=[];for(var n in t)("constructor"!=n||!r&&Ln.call(t,n))&&e.push(n);return e};var Wn=function(t){return Ot(t)?st(t,!0):Rn(t)};var Vn=function(t,r){return t&&Bn(r,Wn(r),t)},Hn=n(function(t,r){var e=r&&!r.nodeType&&r,n=e&&t&&!t.nodeType&&t,o=n&&n.exports===e?i.Buffer:void 0,a=o?o.allocUnsafe:void 0;t.exports=function(t,r){if(r)return t.slice();var e=t.length,n=a?a(e):new t.constructor(e);return t.copy(n),n}});var Yn=function(t,r){var e=-1,n=t.length;for(r||(r=Array(n));++e<n;)r[e]=t[e];return r};var Qn=function(t,r){return Bn(t,ce(t),r)},Gn=ht(Object.getPrototypeOf,Object),qn=Object.getOwnPropertySymbols?function(t){for(var r=[];t;)ne(r,ce(t)),t=Gn(t);return r}:ae;var Jn=function(t,r){return Bn(t,qn(t),r)};var Kn=function(t){return oe(t,Wn,qn)},Xn=Object.prototype.hasOwnProperty;var Zn=function(t){var r=t.length,e=new t.constructor(r);return r&&"string"==typeof t[0]&&Xn.call(t,"index")&&(e.index=t.index,e.input=t.input),e};var to=function(t){var r=new t.constructor(t.byteLength);return new Br(r).set(new Br(t)),r};var ro=function(t,r){var e=r?to(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)},eo=/\w*$/;var no=function(t){var r=new t.constructor(t.source,eo.exec(t));return r.lastIndex=t.lastIndex,r},oo=u?u.prototype:void 0,ao=oo?oo.valueOf:void 0;var io=function(t){return ao?Object(ao.call(t)):{}};var uo=function(t,r){var e=r?to(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)},co="[object Boolean]",fo="[object Date]",lo="[object Map]",so="[object Number]",vo="[object RegExp]",po="[object Set]",ho="[object String]",bo="[object Symbol]",yo="[object ArrayBuffer]",go="[object DataView]",jo="[object Float32Array]",_o="[object Float64Array]",wo="[object Int8Array]",So="[object Int16Array]",Oo="[object Int32Array]",mo="[object Uint8Array]",Ao="[object Uint8ClampedArray]",Do="[object Uint16Array]",Eo="[object Uint32Array]";var Io=function(t,r,e){var n=t.constructor;switch(r){case yo:return to(t);case co:case fo:return new n(+t);case go:return ro(t,e);case jo:case _o:case wo:case So:case Oo:case mo:case Ao:case Do:case Eo:return uo(t,e);case lo:return new n;case so:case ho:return new n(t);case vo:return no(t);case po:return new n;case bo:return io(t)}},xo=Object.create,Co=function(){function t(){}return function(r){if(!I(r))return{};if(xo)return xo(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();var Po=function(t){return"function"!=typeof t.constructor||pt(t)?{}:Co(Gn(t))},zo="[object Map]";var Fo=function(t){return w(t)&&Oe(t)==zo},Mo=ut&&ut.isMap,Uo=Mo?it(Mo):Fo,ko="[object Set]";var To=function(t){return w(t)&&Oe(t)==ko},Bo=ut&&ut.isSet,$o=Bo?it(Bo):To,No=1,Lo=2,Ro=4,Wo="[object Arguments]",Vo="[object Function]",Ho="[object GeneratorFunction]",Yo="[object Object]",Qo={};Qo[Wo]=Qo["[object Array]"]=Qo["[object ArrayBuffer]"]=Qo["[object DataView]"]=Qo["[object Boolean]"]=Qo["[object Date]"]=Qo["[object Float32Array]"]=Qo["[object Float64Array]"]=Qo["[object Int8Array]"]=Qo["[object Int16Array]"]=Qo["[object Int32Array]"]=Qo["[object Map]"]=Qo["[object Number]"]=Qo[Yo]=Qo["[object RegExp]"]=Qo["[object Set]"]=Qo["[object String]"]=Qo["[object Symbol]"]=Qo["[object Uint8Array]"]=Qo["[object Uint8ClampedArray]"]=Qo["[object Uint16Array]"]=Qo["[object Uint32Array]"]=!0,Qo["[object Error]"]=Qo[Vo]=Qo["[object WeakMap]"]=!1;var Go=function t(r,e,n,o,a,i){var u,c=e&No,l=e&Lo,s=e&Ro;if(n&&(u=a?n(r,o,a,i):n(r)),void 0!==u)return u;if(!I(r))return r;var v=f(r);if(v){if(u=Zn(r),!c)return Yn(r,u)}else{var p=Oe(r),h=p==Vo||p==Ho;if(X(r))return Hn(r,c);if(p==Yo||p==Wo||h&&!a){if(u=l||h?{}:Po(r),!c)return l?Jn(r,Vn(u,r)):Qn(r,$n(u,r))}else{if(!Qo[p])return a?r:{};u=Io(r,p,c)}}i||(i=new Er);var d=i.get(r);if(d)return d;if(i.set(r,u),$o(r))return r.forEach(function(o){u.add(t(o,e,n,o,r,i))}),u;if(Uo(r))return r.forEach(function(o,a){u.set(a,t(o,e,n,a,r,i))}),u;var b=s?l?Kn:fe:l?keysIn:mt,y=v?void 0:b(r);return Fn(y||r,function(o,a){y&&(o=r[a=o]),Tn(u,a,t(o,e,n,a,r,i))}),u};var qo=function(t){var r=null==t?0:t.length;return r?t[r-1]:void 0};var Jo=function(t,r,e){var n=-1,o=t.length;r<0&&(r=-r>o?0:o+r),(e=e>o?o:e)<0&&(e+=o),o=r>e?0:e-r>>>0,r>>>=0;for(var a=Array(o);++n<o;)a[n]=t[n+r];return a};var Ko=function(t,r){return r.length<2?t:Ke(t,Jo(r,0,-1))};var Xo=function(t,r){return r=Ge(r,t),null==(t=Ko(t,r))||delete t[Je(qo(r))]},Zo="[object Object]",ta=Function.prototype,ra=Object.prototype,ea=ta.toString,na=ra.hasOwnProperty,oa=ea.call(Object);var aa=function(t){if(!w(t)||_(t)!=Zo)return!1;var r=Gn(t);if(null===r)return!0;var e=na.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&ea.call(e)==oa};var ia=function(t){return aa(t)?void 0:t},ua=u?u.isConcatSpreadable:void 0;var ca=function(t){return f(t)||J(t)||!!(ua&&t&&t[ua])};var fa=function t(r,e,n,o,a){var i=-1,u=r.length;for(n||(n=ca),a||(a=[]);++i<u;){var c=r[i];e>0&&n(c)?e>1?t(c,e-1,n,o,a):ne(a,c):o||(a[a.length]=c)}return a};var la=function(t){return null!=t&&t.length?fa(t,1):[]};var sa=function(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)},va=Math.max;var pa=function(t,r,e){return r=va(void 0===r?t.length-1:r,0),function(){for(var n=arguments,o=-1,a=va(n.length-r,0),i=Array(a);++o<a;)i[o]=n[r+o];o=-1;for(var u=Array(r+1);++o<r;)u[o]=n[o];return u[r]=e(i),sa(t,this,u)}};var ha=function(t){return function(){return t}},da=Mn?function(t,r){return Mn(t,"toString",{configurable:!0,enumerable:!1,value:ha(r),writable:!0})}:an,ba=800,ya=16,ga=Date.now;var ja=function(t){var r=0,e=0;return function(){var n=ga(),o=ya-(n-e);if(e=n,o>0){if(++r>=ba)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(da);var _a=function(t){return ja(pa(t,void 0,la),t+"")}(function(t,r){var e={};if(null==t)return e;var n=!1;r=c(r,function(r){return r=Ge(r,t),n||(n=r.length>1),r}),Bn(t,Kn(t),e),n&&(e=Go(e,7,ia));for(var o=r.length;o--;)Xo(e,r[o]);return e});var wa=function(t,r){var e=-1,n=Ot(t)?Array(t.length):[];return At(t,function(t,o,a){n[++e]=r(t,o,a)}),n};var Sa=function(t,r){var e=t.length;for(t.sort(r);e--;)t[e]=t[e].value;return t};var Oa=function(t,r){if(t!==r){var e=void 0!==t,n=null===t,o=t==t,a=O(t),i=void 0!==r,u=null===r,c=r==r,f=O(r);if(!u&&!f&&!a&&t>r||a&&i&&c&&!u&&!f||n&&i&&c||!e&&c||!o)return 1;if(!n&&!a&&!f&&t<r||f&&e&&o&&!n&&!a||u&&e&&o||!i&&o||!c)return-1}return 0};var ma=function(t,r,e){for(var n=-1,o=t.criteria,a=r.criteria,i=o.length,u=e.length;++n<i;){var c=Oa(o[n],a[n]);if(c)return n>=u?c:c*("desc"==e[n]?-1:1)}return t.index-r.index};var Aa=function(t,r,e){var n=-1;r=c(r.length?r:[an],it(ln));var o=wa(t,function(t,e,o){return{criteria:c(r,function(r){return r(t)}),index:++n,value:t}});return Sa(o,function(t,r){return ma(t,r,e)})};var Da=function(t,r,e){if(!I(e))return!1;var n=typeof r;return!!("number"==n?Ot(e)&&rt(r,e.length):"string"==n&&r in e)&&It(e[r],t)};Ea=function(t,r){if(null==t)return[];var e=r.length;return e>1&&Da(t,r[0],r[1])?r=[]:e>2&&Da(r[0],r[1],r[2])&&(r=[r[0]]),Aa(t,fa(r,1),[])},ja(pa(Ea,Ia,an),Ea+"");var Ea,Ia;var xa=function(t,r,e,n){for(var o=t.length,a=e+(n?1:-1);n?a--:++a<o;)if(r(t[a],a,t))return a;return-1};var Ca=function(t){return t!=t};var Pa=function(t,r,e){for(var n=e-1,o=t.length;++n<o;)if(t[n]===r)return n;return-1};var za=function(t,r,e){return r==r?Pa(t,r,e):xa(t,Ca,e)};var Fa=function(t,r){return!(null==t||!t.length)&&za(t,r,0)>-1};var Ma=function(t,r,e){for(var n=-1,o=null==t?0:t.length;++n<o;)if(e(r,t[n]))return!0;return!1};var Ua=function(){},ka=de&&1/Nr(new de([,-0]))[1]==1/0?function(t){return new de(t)}:Ua,Ta=200;var Ba=function(t,r,e){var n=-1,o=Fa,a=t.length,i=!0,u=[],c=u;if(e)i=!1,o=Ma;else if(a>=Ta){var f=r?null:ka(t);if(f)return Nr(f);i=!1,o=Mr,c=new zr}else c=r?[]:u;t:for(;++n<a;){var l=t[n],s=r?r(l):l;if(l=e||0!==l?l:0,i&&s==s){for(var v=c.length;v--;)if(c[v]===s)continue t;r&&c.push(s),u.push(l)}else o(c,s,e)||(c!==u&&c.push(s),u.push(l))}return u};var $a=function(t){return t&&t.length?Ba(t):[]},Na="[object String]";var La=function(t){return"string"==typeof t||!f(t)&&w(t)&&_(t)==Na},Ra="CHEAPEST",Wa="FASTEST",Va="COMBINED",Ha="pickup-in-point",Ya="delivery";function Qa(t){return La(t)?t:Xe(t,"deliveryChannel")||Xe(t,"selectedDeliveryChannel")||Xe(t,"id")}function Ga(t){return Qa(t)===Ha}function qa(t){return Qa(t)===Ya}function Ja(t){return t&&t.availableDeliveryWindows.length>0}function Ka(t){return t&&t.slas?t.slas.length>0:t&&t.length>0}function Xa(t){return t.slas&&t.slas.find(function(r){return r.id===t.selectedSla})}function Za(t,r){return Qa(t)===r}function ti(t){return t.filter(function(t){return qa(t)}).reduce(function(t,r){var e,n=Xa(r);return n&&t+(e=n,Math.abs(In.getShippingEstimateQuantityInSeconds(e.shippingEstimate)))||t+0},0)}function ri(t,r){return{price:function(t){return t&&t.filter(function(t){return(!!t.selectedSla||Ka(t))&&qa(t)}).reduce(function(t,r){var e=Xa(r);return e&&e.availableDeliveryWindows&&e.availableDeliveryWindows.length>0?t:e?t+e.price:t},0)}(t),shippingEstimate:function(t){var r=In.getLatestSla(t.filter(function(t){return(!!t.selectedSla||Ka(t))&&qa(t)}).map(function(t){return Xa(t)}));return r&&r.shippingEstimate}(t),averageEstimatePerItem:(n=t,(n&&ti(n))/n.length),packagesLength:(e=t,$a(la(e.filter(function(t){return qa(t)&&(!!t.selectedSla||Ka(t))}).map(function(t){return t.selectedSla}))).length),id:r};var e,n}var ei=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t};function ni(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function oi(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}function ai(t){var r=t[Ra]&&t[Ra].length>0,e=t[Va]&&t[Va].length>0,n=t[Wa]&&t[Wa].length>0;return function(t){var r=[];return t.forEach(function(t){r.findIndex(function(r){return zn(_a(r,"id"),_a(t,"id"))})<=-1&&r.push(t)}),function(t){return t.filter(function(r,e){return!t[e+1]||r.price<t[e+1].price})}(r)}([].concat(oi(r?[ri(t[Ra],Ra)]:[]),oi(e?[ri(t[Va],Va)]:[]),oi(n?[ri(t[Wa],Wa)]:[])))}function ii(t,r){if(t)return t.filter(function(e){return function(t){return 0===t.filter(function(t){return qa(t)&&!Ja(t)}).length}(t)||r?qa(e):qa(e)&&!Ja(e)})}function ui(t,r){return t.map(function(t){return ei({},t,{price:function(t,r){return r.map(function(r){return r.slas.find(function(r){return r.id===t.id})}).reduce(function(t,r){return r?r.price+t:t},0)}(t,r),shippingEstimateInSeconds:(e=t.shippingEstimate,In.getShippingEstimateQuantityInSeconds(e))});var e})}function ci(t){var r=t.logisticsInfo,e=t.selectedSlas,n=t.activeChannel,o=t.isScheduledDeliveryActive,a=[],i=r.some(function(t){return t.slas.every(function(t){return Ja(t)})});return r.forEach(function(t,r){if(null===(u=t).selectedSla&&null===u.selectedDeliveryChannel||Ga(t)&&Ga(n))a.push(t);else{var u,c=1===t.slas.length&&t.slas.every(function(t){return Za(t,n)&&Ja(t)}),f=t.slas.find(function(t){return Za(t,n)&&Ja(t)});if((o||c)&&f||i&&f){var l=t.slas.find(function(r){return r.id===t.selectedSla}),s=!c&&l&&Ja(l);a.push(ei({},t,{selectedSla:s?l.id:f.id,selectedDeliveryChannel:s?l.deliveryChannel:f.deliveryChannel}))}else{var v=function(t,r,e){return t.find(function(t,n){return t.itemId===r.itemId&&n<e})}(a,t,r);if(v)a.push(ei({},t,{selectedSla:v.selectedSla,selectedDeliveryChannel:v.selectedDeliveryChannel}));else{var p=e&&e[r],h=p&&e[r].id,d=p&&e[r].deliveryChannel;a.push(ei({},t,{selectedSla:h||t.selectedSla,selectedDeliveryChannel:d||t.selectedDeliveryChannel}))}}}}),a}function fi(t,r){return t.map(function(t){return Pn(t,function(t){return t[r]})})}t.getOptionsDetails=ai,t.getSelectedDeliveryOption=function(t){var r=t.optionsDetails,e=void 0===r?null:r,n=t.newCombined,o=t.newFastest,a=t.newCheapest,i=t.activeDeliveryOption;e||(e=ai(ei({},a?ni({},Ra,a):{},n?ni({},Va,n):{},o?ni({},Wa,o):{})));var u=e&&!!e.find(function(t){return t.id===i});return e.length>0&&!u?e[0].id:i},t.getLeanShippingOptions=function(t){var r=t.logisticsInfo,e=t.activeChannel,n=void 0===e?Ya:e,o=t.isScheduledDeliveryActive,a=void 0!==o&&o,i=function(t,r){return t.map(function(e){var n=ii(e.slas,r);return n.length?ui(n,t):[]})}(r,a),u={cheapest:fi(i,"price"),fastest:fi(i,"shippingEstimateInSeconds")},c=ci({logisticsInfo:r,selectedSlas:u.cheapest,activeChannel:n,isScheduledDeliveryActive:a}),f=ci({logisticsInfo:r,selectedSlas:u.fastest,activeChannel:n,isScheduledDeliveryActive:a});return zn(c,f)||ci({logisticsInfo:r,selectedSlas:u.fastest,activeChannel:n,isScheduledDeliveryActive:a}),ei({},function(t,r){var e=ri(t,Ra),n=ri(r,Wa),o=e.price<n.price,a=zn(t,r),i=0===e.packagesLength;return t&&(o||i||a)}(c,f)?{cheapest:c}:{},function(t,r){var e=zn(t,r);return r&&!e}(c,f)?{fastest:f}:{})},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t.vtex=t.vtex||{},t.vtex.leanShippingCalculator=e())}(this,function(){"use strict";var t=function(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t},e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t,e){return t(e={exports:{}},e.exports),e.exports}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o="object"==(void 0===e?"undefined":r(e))&&e&&e.Object===Object&&e,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a="object"==("undefined"==typeof self?"undefined":i(self))&&self&&self.Object===Object&&self,u=o||a||Function("return this")(),c=u.Symbol;var l=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o},f=Array.isArray,s=Object.prototype,v=s.hasOwnProperty,d=s.toString,y=c?c.toStringTag:void 0;var p=function(t){var e=v.call(t,y),n=t[y];try{t[y]=void 0;var r=!0}catch(t){}var o=d.call(t);return r&&(e?t[y]=n:delete t[y]),o},h=Object.prototype.toString;var b=function(t){return h.call(t)},g="[object Null]",m="[object Undefined]",S=c?c.toStringTag:void 0;var j=function(t){return null==t?void 0===t?m:g:S&&S in Object(t)?p(t):b(t)},_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var w=function(t){return null!=t&&"object"==(void 0===t?"undefined":_(t))},I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O="[object Symbol]";var A=function(t){return"symbol"==(void 0===t?"undefined":I(t))||w(t)&&j(t)==O},C=1/0,D=c?c.prototype:void 0,E=D?D.toString:void 0;var x=function t(e){if("string"==typeof e)return e;if(f(e))return l(e,t)+"";if(A(e))return E?E.call(e):"";var n=e+"";return"0"==n&&1/e==-C?"-0":n},P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var k=function(t){var e=void 0===t?"undefined":P(t);return null!=t&&("object"==e||"function"==e)},M=NaN,F=/^\s+|\s+$/g,T=/^[-+]0x[0-9a-f]+$/i,z=/^0b[01]+$/i,L=/^0o[0-7]+$/i,U=parseInt;var N=function(t){if("number"==typeof t)return t;if(A(t))return M;if(k(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=k(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(F,"");var n=z.test(t);return n||L.test(t)?U(t.slice(2),n?2:8):T.test(t)?M:+t},B=1/0,$=1.7976931348623157e308;var R=function(t){return t?(t=N(t))===B||t===-B?(t<0?-1:1)*$:t==t?t:0:0===t?t:0};var V=function(t){var e=R(t),n=e%1;return e==e?n?e-n:e:0};var W=function(t){return null==t?"":x(t)};var H=function(e,n,r){e=W(e),n=x(n);var o=e.length,i=r=void 0===r?o:t(V(r),0,o);return(r-=n.length)>=0&&e.slice(r,i)==n};var Q=function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i};var Y=function(t){return function(e,n,r){for(var o=-1,i=Object(e),a=r(e),u=a.length;u--;){var c=a[t?u:++o];if(!1===n(i[c],c,i))break}return e}}();var q=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r},G="[object Arguments]";var J=function(t){return w(t)&&j(t)==G},K=Object.prototype,X=K.hasOwnProperty,Z=K.propertyIsEnumerable,tt=J(function(){return arguments}())?J:function(t){return w(t)&&X.call(t,"callee")&&!Z.call(t,"callee")};var et=function(){return!1},nt=n(function(t,e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r="object"==n(e)&&e&&!e.nodeType&&e,o=r&&"object"==n(t)&&t&&!t.nodeType&&t,i=o&&o.exports===r?u.Buffer:void 0,a=(i?i.isBuffer:void 0)||et;t.exports=a}),rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ot=9007199254740991,it=/^(?:0|[1-9]\d*)$/;var at=function(t,e){var n=void 0===t?"undefined":rt(t);return!!(e=null==e?ot:e)&&("number"==n||"symbol"!=n&&it.test(t))&&t>-1&&t%1==0&&t<e},ut=9007199254740991;var ct=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=ut},lt={};lt["[object Float32Array]"]=lt["[object Float64Array]"]=lt["[object Int8Array]"]=lt["[object Int16Array]"]=lt["[object Int32Array]"]=lt["[object Uint8Array]"]=lt["[object Uint8ClampedArray]"]=lt["[object Uint16Array]"]=lt["[object Uint32Array]"]=!0,lt["[object Arguments]"]=lt["[object Array]"]=lt["[object ArrayBuffer]"]=lt["[object Boolean]"]=lt["[object DataView]"]=lt["[object Date]"]=lt["[object Error]"]=lt["[object Function]"]=lt["[object Map]"]=lt["[object Number]"]=lt["[object Object]"]=lt["[object RegExp]"]=lt["[object Set]"]=lt["[object String]"]=lt["[object WeakMap]"]=!1;var ft=function(t){return w(t)&&ct(t.length)&&!!lt[j(t)]};var st=function(t){return function(e){return t(e)}},vt=n(function(t,e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r="object"==n(e)&&e&&!e.nodeType&&e,i=r&&"object"==n(t)&&t&&!t.nodeType&&t,a=i&&i.exports===r&&o.process,u=function(){try{var t=i&&i.require&&i.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=u}),dt=vt&&vt.isTypedArray,yt=dt?st(dt):ft,pt=Object.prototype.hasOwnProperty;var ht=function(t,e){var n=f(t),r=!n&&tt(t),o=!n&&!r&&nt(t),i=!n&&!r&&!o&&yt(t),a=n||r||o||i,u=a?q(t.length,String):[],c=u.length;for(var l in t)!e&&!pt.call(t,l)||a&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||at(l,c))||u.push(l);return u},bt=Object.prototype;var gt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||bt)};var mt=function(t,e){return function(n){return t(e(n))}},St=mt(Object.keys,Object),jt=Object.prototype.hasOwnProperty;var _t=function(t){if(!gt(t))return St(t);var e=[];for(var n in Object(t))jt.call(t,n)&&"constructor"!=n&&e.push(n);return e},wt="[object AsyncFunction]",It="[object Function]",Ot="[object GeneratorFunction]",At="[object Proxy]";var Ct=function(t){if(!k(t))return!1;var e=j(t);return e==It||e==Ot||e==wt||e==At};var Dt=function(t){return null!=t&&ct(t.length)&&!Ct(t)};var Et=function(t){return Dt(t)?ht(t):_t(t)};var xt=function(t,e){return function(n,r){if(null==n)return n;if(!Dt(n))return t(n,r);for(var o=n.length,i=e?o:-1,a=Object(n);(e?i--:++i<o)&&!1!==r(a[i],i,a););return n}}(function(t,e){return t&&Y(t,e,Et)});var Pt=function(t,e){var n=[];return xt(t,function(t,r,o){e(t,r,o)&&n.push(t)}),n};var kt=function(){this.__data__=[],this.size=0};var Mt=function(t,e){return t===e||t!=t&&e!=e};var Ft=function(t,e){for(var n=t.length;n--;)if(Mt(t[n][0],e))return n;return-1},Tt=Array.prototype.splice;var zt=function(t){var e=this.__data__,n=Ft(e,t);return!(n<0||(n==e.length-1?e.pop():Tt.call(e,n,1),--this.size,0))};var Lt=function(t){var e=this.__data__,n=Ft(e,t);return n<0?void 0:e[n][1]};var Ut=function(t){return Ft(this.__data__,t)>-1};var Nt=function(t,e){var n=this.__data__,r=Ft(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function Bt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Bt.prototype.clear=kt,Bt.prototype.delete=zt,Bt.prototype.get=Lt,Bt.prototype.has=Ut,Bt.prototype.set=Nt;var $t=Bt;var Rt=function(){this.__data__=new $t,this.size=0};var Vt=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var Wt=function(t){return this.__data__.get(t)};var Ht,Qt=function(t){return this.__data__.has(t)},Yt=u["__core-js_shared__"],qt=(Ht=/[^.]+$/.exec(Yt&&Yt.keys&&Yt.keys.IE_PROTO||""))?"Symbol(src)_1."+Ht:"";var Gt=function(t){return!!qt&&qt in t},Jt=Function.prototype.toString;var Kt=function(t){if(null!=t){try{return Jt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Xt=/^\[object .+?Constructor\]$/,Zt=Function.prototype,te=Object.prototype,ee=Zt.toString,ne=te.hasOwnProperty,re=RegExp("^"+ee.call(ne).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var oe=function(t){return!(!k(t)||Gt(t))&&(Ct(t)?re:Xt).test(Kt(t))};var ie=function(t,e){return null==t?void 0:t[e]};var ae=function(t,e){var n=ie(t,e);return oe(n)?n:void 0},ue=ae(u,"Map"),ce=ae(Object,"create");var le=function(){this.__data__=ce?ce(null):{},this.size=0};var fe=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},se="__lodash_hash_undefined__",ve=Object.prototype.hasOwnProperty;var de=function(t){var e=this.__data__;if(ce){var n=e[t];return n===se?void 0:n}return ve.call(e,t)?e[t]:void 0},ye=Object.prototype.hasOwnProperty;var pe=function(t){var e=this.__data__;return ce?void 0!==e[t]:ye.call(e,t)},he="__lodash_hash_undefined__";var be=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ce&&void 0===e?he:e,this};function ge(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ge.prototype.clear=le,ge.prototype.delete=fe,ge.prototype.get=de,ge.prototype.has=pe,ge.prototype.set=be;var me=ge;var Se=function(){this.size=0,this.__data__={hash:new me,map:new(ue||$t),string:new me}},je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var _e=function(t){var e=void 0===t?"undefined":je(t);return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var we=function(t,e){var n=t.__data__;return _e(e)?n["string"==typeof e?"string":"hash"]:n.map};var Ie=function(t){var e=we(this,t).delete(t);return this.size-=e?1:0,e};var Oe=function(t){return we(this,t).get(t)};var Ae=function(t){return we(this,t).has(t)};var Ce=function(t,e){var n=we(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function De(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}De.prototype.clear=Se,De.prototype.delete=Ie,De.prototype.get=Oe,De.prototype.has=Ae,De.prototype.set=Ce;var Ee=De,xe=200;var Pe=function(t,e){var n=this.__data__;if(n instanceof $t){var r=n.__data__;if(!ue||r.length<xe-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ee(r)}return n.set(t,e),this.size=n.size,this};function ke(t){var e=this.__data__=new $t(t);this.size=e.size}ke.prototype.clear=Rt,ke.prototype.delete=Vt,ke.prototype.get=Wt,ke.prototype.has=Qt,ke.prototype.set=Pe;var Me=ke,Fe="__lodash_hash_undefined__";var Te=function(t){return this.__data__.set(t,Fe),this};var ze=function(t){return this.__data__.has(t)};function Le(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Ee;++e<n;)this.add(t[e])}Le.prototype.add=Le.prototype.push=Te,Le.prototype.has=ze;var Ue=Le;var Ne=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1};var Be=function(t,e){return t.has(e)},$e=1,Re=2;var Ve=function(t,e,n,r,o,i){var a=n&$e,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var l=i.get(t);if(l&&i.get(e))return l==e;var f=-1,s=!0,v=n&Re?new Ue:void 0;for(i.set(t,e),i.set(e,t);++f<u;){var d=t[f],y=e[f];if(r)var p=a?r(y,d,f,e,t,i):r(d,y,f,t,e,i);if(void 0!==p){if(p)continue;s=!1;break}if(v){if(!Ne(e,function(t,e){if(!Be(v,e)&&(d===t||o(d,t,n,r,i)))return v.push(e)})){s=!1;break}}else if(d!==y&&!o(d,y,n,r,i)){s=!1;break}}return i.delete(t),i.delete(e),s},We=u.Uint8Array;var He=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n};var Qe=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n},Ye=1,qe=2,Ge="[object Boolean]",Je="[object Date]",Ke="[object Error]",Xe="[object Map]",Ze="[object Number]",tn="[object RegExp]",en="[object Set]",nn="[object String]",rn="[object Symbol]",on="[object ArrayBuffer]",an="[object DataView]",un=c?c.prototype:void 0,cn=un?un.valueOf:void 0;var ln=function(t,e,n,r,o,i,a){switch(n){case an:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case on:return!(t.byteLength!=e.byteLength||!i(new We(t),new We(e)));case Ge:case Je:case Ze:return Mt(+t,+e);case Ke:return t.name==e.name&&t.message==e.message;case tn:case nn:return t==e+"";case Xe:var u=He;case en:var c=r&Ye;if(u||(u=Qe),t.size!=e.size&&!c)return!1;var l=a.get(t);if(l)return l==e;r|=qe,a.set(t,e);var f=Ve(u(t),u(e),r,o,i,a);return a.delete(t),f;case rn:if(cn)return cn.call(t)==cn.call(e)}return!1};var fn=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t};var sn=function(t,e,n){var r=e(t);return f(t)?r:fn(r,n(t))};var vn=function(){return[]},dn=Object.prototype.propertyIsEnumerable,yn=Object.getOwnPropertySymbols,pn=yn?function(t){return null==t?[]:(t=Object(t),Q(yn(t),function(e){return dn.call(t,e)}))}:vn;var hn=function(t){return sn(t,Et,pn)},bn=1,gn=Object.prototype.hasOwnProperty;var mn=function(t,e,n,r,o,i){var a=n&bn,u=hn(t),c=u.length;if(c!=hn(e).length&&!a)return!1;for(var l=c;l--;){var f=u[l];if(!(a?f in e:gn.call(e,f)))return!1}var s=i.get(t);if(s&&i.get(e))return s==e;var v=!0;i.set(t,e),i.set(e,t);for(var d=a;++l<c;){var y=t[f=u[l]],p=e[f];if(r)var h=a?r(p,y,f,e,t,i):r(y,p,f,t,e,i);if(!(void 0===h?y===p||o(y,p,n,r,i):h)){v=!1;break}d||(d="constructor"==f)}if(v&&!d){var b=t.constructor,g=e.constructor;b!=g&&"constructor"in t&&"constructor"in e&&!("function"==typeof b&&b instanceof b&&"function"==typeof g&&g instanceof g)&&(v=!1)}return i.delete(t),i.delete(e),v},Sn=ae(u,"DataView"),jn=ae(u,"Promise"),_n=ae(u,"Set"),wn=ae(u,"WeakMap"),In=Kt(Sn),On=Kt(ue),An=Kt(jn),Cn=Kt(_n),Dn=Kt(wn),En=j;(Sn&&"[object DataView]"!=En(new Sn(new ArrayBuffer(1)))||ue&&"[object Map]"!=En(new ue)||jn&&"[object Promise]"!=En(jn.resolve())||_n&&"[object Set]"!=En(new _n)||wn&&"[object WeakMap]"!=En(new wn))&&(En=function(t){var e=j(t),n="[object Object]"==e?t.constructor:void 0,r=n?Kt(n):"";if(r)switch(r){case In:return"[object DataView]";case On:return"[object Map]";case An:return"[object Promise]";case Cn:return"[object Set]";case Dn:return"[object WeakMap]"}return e});var xn=En,Pn=1,kn="[object Arguments]",Mn="[object Array]",Fn="[object Object]",Tn=Object.prototype.hasOwnProperty;var zn=function(t,e,n,r,o,i){var a=f(t),u=f(e),c=a?Mn:xn(t),l=u?Mn:xn(e),s=(c=c==kn?Fn:c)==Fn,v=(l=l==kn?Fn:l)==Fn,d=c==l;if(d&&nt(t)){if(!nt(e))return!1;a=!0,s=!1}if(d&&!s)return i||(i=new Me),a||yt(t)?Ve(t,e,n,r,o,i):ln(t,e,c,n,r,o,i);if(!(n&Pn)){var y=s&&Tn.call(t,"__wrapped__"),p=v&&Tn.call(e,"__wrapped__");if(y||p){var h=y?t.value():t,b=p?e.value():e;return i||(i=new Me),o(h,b,n,r,i)}}return!!d&&(i||(i=new Me),mn(t,e,n,r,o,i))};var Ln=function t(e,n,r,o,i){return e===n||(null==e||null==n||!w(e)&&!w(n)?e!=e&&n!=n:zn(e,n,r,o,t,i))},Un=1,Nn=2;var Bn=function(t,e,n,r){var o=n.length,i=o,a=!r;if(null==t)return!i;for(t=Object(t);o--;){var u=n[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<i;){var c=(u=n[o])[0],l=t[c],f=u[1];if(a&&u[2]){if(void 0===l&&!(c in t))return!1}else{var s=new Me;if(r)var v=r(l,f,c,t,e,s);if(!(void 0===v?Ln(f,l,Un|Nn,r,s):v))return!1}}return!0};var $n=function(t){return t==t&&!k(t)};var Rn=function(t){for(var e=Et(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,$n(o)]}return e};var Vn=function(t,e){return function(n){return null!=n&&n[t]===e&&(void 0!==e||t in Object(n))}};var Wn=function(t){var e=Rn(t);return 1==e.length&&e[0][2]?Vn(e[0][0],e[0][1]):function(n){return n===t||Bn(n,t,e)}},Hn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Yn=/^\w*$/;var qn=function(t,e){if(f(t))return!1;var n=void 0===t?"undefined":Hn(t);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!A(t))||Yn.test(t)||!Qn.test(t)||null!=e&&t in Object(e)},Gn="Expected a function";function Jn(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(Gn);var n=function n(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(Jn.Cache||Ee),n}Jn.Cache=Ee;var Kn=Jn,Xn=500;var Zn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tr=/\\(\\)?/g,er=function(t){var e=Kn(t,function(t){return n.size===Xn&&n.clear(),t}),n=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Zn,function(t,n,r,o){e.push(r?o.replace(tr,"$1"):n||t)}),e});var nr=function(t,e){return f(t)?t:qn(t,e)?[t]:er(W(t))},rr=1/0;var or=function(t){if("string"==typeof t||A(t))return t;var e=t+"";return"0"==e&&1/t==-rr?"-0":e};var ir=function(t,e){for(var n=0,r=(e=nr(e,t)).length;null!=t&&n<r;)t=t[or(e[n++])];return n&&n==r?t:void 0};var ar=function(t,e,n){var r=null==t?void 0:ir(t,e);return void 0===r?n:r};var ur=function(t,e){return null!=t&&e in Object(t)};var cr=function(t,e,n){for(var r=-1,o=(e=nr(e,t)).length,i=!1;++r<o;){var a=or(e[r]);if(!(i=null!=t&&n(t,a)))break;t=t[a]}return i||++r!=o?i:!!(o=null==t?0:t.length)&&ct(o)&&at(a,o)&&(f(t)||tt(t))};var lr=function(t,e){return null!=t&&cr(t,e,ur)},fr=1,sr=2;var vr=function(t,e){return qn(t)&&$n(e)?Vn(or(t),e):function(n){var r=ar(n,t);return void 0===r&&r===e?lr(n,t):Ln(e,r,fr|sr)}};var dr=function(t){return t};var yr=function(t){return function(e){return null==e?void 0:e[t]}};var pr=function(t){return function(e){return ir(e,t)}};var hr=function(t){return qn(t)?yr(or(t)):pr(t)},br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var gr=function(t){return"function"==typeof t?t:null==t?dr:"object"==(void 0===t?"undefined":br(t))?f(t)?vr(t[0],t[1]):Wn(t):hr(t)},mr="Expected a function";var Sr=function(t){if("function"!=typeof t)throw new TypeError(mr);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}};var jr=function(t,e){return(f(t)?Q:Pt)(t,Sr(gr(e,3)))},_r="[object Number]";var wr,Ir=function(t){return"number"==typeof t||w(t)&&j(t)==_r},Or=864e5,Ar=function(t){var e=new Date;return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return Math.round(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return t-e}(t,e)/Or)}(function(t,e){if(!t||!Ir(e))return t;var n=function(t){var e=new Date(t.getTime());return e.setUTCHours(12,0,0,0),e}(t),r=n.getDay(),o=0;0!==r&&6!==r||(o=0===r?1:2);var i=Math.floor((e-1+(r%6||1))/5);return function(t,e){return new Date(t.getTime()+e*Or)}(n,e+o+2*i)}(e,t),e)};function Cr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Dr={BUSINESS_DAYS:"bd",DAYS:"d",HOURS:"h",MINUTES:"m"},Er=(Cr(wr={},Dr.BUSINESS_DAYS,86400),Cr(wr,Dr.DAYS,86400),Cr(wr,Dr.HOURS,3600),Cr(wr,Dr.MINUTES,60),wr);function xr(t){return Pr(t,function(t){return t.price})}function Pr(t,e){if(!t||0===t.length)return null;var n=t[0],r=e(n);return t.forEach(function(t){var o=e(t);o<r&&(r=o,n=t)}),n}function kr(t){return jr(t,function(t){return t.pickupStoreInfo.isPickupStore})}function Mr(t){return Pr(t,function(t){return Fr(t.shippingEstimate)})}function Fr(t){if(void 0===t||null===t||""===t)return null;var e=Tr(t),n=function(t){var e=Tr(t),n=t.replace(e,"");return n?parseInt(n,10):0}(t);return"bd"===e&&(n=Ar(n)),n*Er[e]}function Tr(t){var e="bd";return Object.keys(Dr).forEach(function(n){var r=Dr[n];if(H(t,r)){var o=t.replace(r,"");parseInt(o,10).toString()===o&&(e=r)}}),e}var zr={getShippingEstimateQuantityInSeconds:Fr,getLatestSla:function(t){return function(t,e){if(!t||0===t.length)return null;var n=t[0],r=e(n);return t.forEach(function(t){var o=e(t);o>r&&(r=o,n=t)}),n}(t,function(t){return Fr(t.shippingEstimate)})},getFastestSla:Mr,getCheapestSla:xr,selectCheapestSlaForAllItems:function(t){return t&&0!==t.length?t.map(function(t){var e=kr(t.slas);if(!e||0===e.length)return t;var n=xr(e);return Object.assign({},t,{slas:t.slas,selectedSla:n.id,selectedDeliveryChannel:n.deliveryChannel})}):null},selectFastestSlaForAllItems:function(t){return t&&0!==t.length?t.map(function(t){var e=kr(t.slas);if(!e||0===e.length)return t;var n=Mr(e);return Object.assign({},t,{slas:t.slas,selectedSla:n.id,selectedDeliveryChannel:n.deliveryChannel})}):null}},Lr=zr.getShippingEstimateQuantityInSeconds;var Ur=function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1};var Nr=function(t){return t!=t};var Br=function(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1};var $r=function(t,e,n){return e==e?Br(t,e,n):Ur(t,Nr,n)};var Rr=function(t,e){return!(null==t||!t.length)&&$r(t,e,0)>-1};var Vr=function(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1},Wr=Math.min;var Hr=function(t,e,n){for(var r=n?Vr:Rr,o=t[0].length,i=t.length,a=i,u=Array(i),c=1/0,f=[];a--;){var s=t[a];a&&e&&(s=l(s,st(e))),c=Wr(s.length,c),u[a]=!n&&(e||o>=120&&s.length>=120)?new Ue(a&&s):void 0}s=t[0];var v=-1,d=u[0];t:for(;++v<o&&f.length<c;){var y=s[v],p=e?e(y):y;if(y=n||0!==y?y:0,!(d?Be(d,p):r(f,p,n))){for(a=i;--a;){var h=u[a];if(!(h?Be(h,p):r(t[a],p,n)))continue t}d&&d.push(p),f.push(y)}}return f};var Qr=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},Yr=Math.max;var qr=function(t,e,n){return e=Yr(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Yr(r.length-e,0),a=Array(i);++o<i;)a[o]=r[e+o];o=-1;for(var u=Array(e+1);++o<e;)u[o]=r[o];return u[e]=n(a),Qr(t,this,u)}};var Gr=function(t){return function(){return t}},Jr=function(){try{var t=ae(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Kr=Jr?function(t,e){return Jr(t,"toString",{configurable:!0,enumerable:!1,value:Gr(e),writable:!0})}:dr,Xr=800,Zr=16,to=Date.now;var eo=function(t){var e=0,n=0;return function(){var r=to(),o=Zr-(r-n);if(n=r,o>0){if(++e>=Xr)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Kr);var no=function(t,e){return eo(qr(t,e,dr),t+"")};var ro=function(t){return w(t)&&Dt(t)};var oo=function(t){return ro(t)?t:[]},io=no(function(t){var e=l(t,oo);return e.length&&e[0]===t[0]?Hr(e):[]});var ao=function(t,e){return Ln(t,e)};var uo=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t};var co=function(t,e,n){"__proto__"==e&&Jr?Jr(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},lo=Object.prototype.hasOwnProperty;var fo=function(t,e,n){var r=t[e];lo.call(t,e)&&Mt(r,n)&&(void 0!==n||e in t)||co(t,e,n)};var so=function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,a=e.length;++i<a;){var u=e[i],c=r?r(n[u],t[u],u,n,t):void 0;void 0===c&&(c=t[u]),o?co(n,u,c):fo(n,u,c)}return n};var vo=function(t,e){return t&&so(e,Et(e),t)};var yo=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},po=Object.prototype.hasOwnProperty;var ho=function(t){if(!k(t))return yo(t);var e=gt(t),n=[];for(var r in t)("constructor"!=r||!e&&po.call(t,r))&&n.push(r);return n};var bo=function(t){return Dt(t)?ht(t,!0):ho(t)};var go=function(t,e){return t&&so(e,bo(e),t)},mo=n(function(t,e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r="object"==n(e)&&e&&!e.nodeType&&e,o=r&&"object"==n(t)&&t&&!t.nodeType&&t,i=o&&o.exports===r?u.Buffer:void 0,a=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}});var So=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e};var jo=function(t,e){return so(t,pn(t),e)},_o=mt(Object.getPrototypeOf,Object),wo=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)fn(e,pn(t)),t=_o(t);return e}:vn;var Io=function(t,e){return so(t,wo(t),e)};var Oo=function(t){return sn(t,bo,wo)},Ao=Object.prototype.hasOwnProperty;var Co=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Ao.call(t,"index")&&(n.index=t.index,n.input=t.input),n};var Do=function(t){var e=new t.constructor(t.byteLength);return new We(e).set(new We(t)),e};var Eo=function(t,e){var n=e?Do(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)},xo=/\w*$/;var Po=function(t){var e=new t.constructor(t.source,xo.exec(t));return e.lastIndex=t.lastIndex,e},ko=c?c.prototype:void 0,Mo=ko?ko.valueOf:void 0;var Fo=function(t){return Mo?Object(Mo.call(t)):{}};var To=function(t,e){var n=e?Do(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)},zo="[object Boolean]",Lo="[object Date]",Uo="[object Map]",No="[object Number]",Bo="[object RegExp]",$o="[object Set]",Ro="[object String]",Vo="[object Symbol]",Wo="[object ArrayBuffer]",Ho="[object DataView]",Qo="[object Float32Array]",Yo="[object Float64Array]",qo="[object Int8Array]",Go="[object Int16Array]",Jo="[object Int32Array]",Ko="[object Uint8Array]",Xo="[object Uint8ClampedArray]",Zo="[object Uint16Array]",ti="[object Uint32Array]";var ei=function(t,e,n){var r=t.constructor;switch(e){case Wo:return Do(t);case zo:case Lo:return new r(+t);case Ho:return Eo(t,n);case Qo:case Yo:case qo:case Go:case Jo:case Ko:case Xo:case Zo:case ti:return To(t,n);case Uo:return new r;case No:case Ro:return new r(t);case Bo:return Po(t);case $o:return new r;case Vo:return Fo(t)}},ni=Object.create,ri=function(){function t(){}return function(e){if(!k(e))return{};if(ni)return ni(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var oi=function(t){return"function"!=typeof t.constructor||gt(t)?{}:ri(_o(t))},ii="[object Map]";var ai=function(t){return w(t)&&xn(t)==ii},ui=vt&&vt.isMap,ci=ui?st(ui):ai,li="[object Set]";var fi=function(t){return w(t)&&xn(t)==li},si=vt&&vt.isSet,vi=si?st(si):fi,di=1,yi=2,pi=4,hi="[object Arguments]",bi="[object Function]",gi="[object GeneratorFunction]",mi="[object Object]",Si={};Si[hi]=Si["[object Array]"]=Si["[object ArrayBuffer]"]=Si["[object DataView]"]=Si["[object Boolean]"]=Si["[object Date]"]=Si["[object Float32Array]"]=Si["[object Float64Array]"]=Si["[object Int8Array]"]=Si["[object Int16Array]"]=Si["[object Int32Array]"]=Si["[object Map]"]=Si["[object Number]"]=Si[mi]=Si["[object RegExp]"]=Si["[object Set]"]=Si["[object String]"]=Si["[object Symbol]"]=Si["[object Uint8Array]"]=Si["[object Uint8ClampedArray]"]=Si["[object Uint16Array]"]=Si["[object Uint32Array]"]=!0,Si["[object Error]"]=Si[bi]=Si["[object WeakMap]"]=!1;var ji=function t(e,n,r,o,i,a){var u,c=n&di,l=n&yi,s=nπif(r&&(u=i?r(e,o,i,a):r(e)),void 0!==u)return u;if(!k(e))return e;var v=f(e);if(v){if(u=Co(e),!c)return So(e,u)}else{var d=xn(e),y=d==bi||d==gi;if(nt(e))return mo(e,c);if(d==mi||d==hi||y&&!i){if(u=l||y?{}:oi(e),!c)return l?Io(e,go(u,e)):jo(e,vo(u,e))}else{if(!Si[d])return i?e:{};u=ei(e,d,c)}}a||(a=new Me);var p=a.get(e);if(p)return p;a.set(e,u),vi(e)?e.forEach(function(o){u.add(t(o,n,r,o,e,a))}):ci(e)&&e.forEach(function(o,i){u.set(i,t(o,n,r,i,e,a))});var h=s?l?Oo:hn:l?keysIn:Et,b=v?void 0:h(e);return uo(b||e,function(o,i){b&&(o=e[i=o]),fo(u,i,t(o,n,r,i,e,a))}),u};var _i=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0};var wi=function(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=Array(o);++r<o;)i[r]=t[r+e];return i};var Ii=function(t,e){return e.length<2?t:ir(t,wi(e,0,-1))};var Oi=function(t,e){return e=nr(e,t),null==(t=Ii(t,e))||delete t[or(_i(e))]},Ai="[object Object]",Ci=Function.prototype,Di=Object.prototype,Ei=Ci.toString,xi=Di.hasOwnProperty,Pi=Ei.call(Object);var ki=function(t){if(!w(t)||j(t)!=Ai)return!1;var e=_o(t);if(null===e)return!0;var n=xi.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ei.call(n)==Pi};var Mi=function(t){return ki(t)?void 0:t},Fi=c?c.isConcatSpreadable:void 0;var Ti=function(t){return f(t)||tt(t)||!!(Fi&&t&&t[Fi])};var zi=function t(e,n,r,o,i){var a=-1,u=e.length;for(r||(r=Ti),i||(i=[]);++a<u;){var c=e[a];n>0&&r(c)?n>1?t(c,n-1,r,o,i):fn(i,c):o||(i[i.length]=c)}return i};var Li=function(t){return null!=t&&t.length?zi(t,1):[]};var Ui=function(t){return eo(qr(t,void 0,Li),t+"")}(function(t,e){var n={};if(null==t)return n;var r=!1;e=l(e,function(e){return e=nr(e,t),r||(r=e.length>1),e}),so(t,Oo(t),n),r&&(n=ji(n,7,Mi));for(var o=e.length;o--;)Oi(n,e[o]);return n});var Ni=function(t,e){var n=-1,r=Dt(t)?Array(t.length):[];return xt(t,function(t,o,i){r[++n]=e(t,o,i)}),r};var Bi=function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t};var $i=function(t,e){if(t!==e){var n=void 0!==t,r=null===t,o=t==t,i=A(t),a=void 0!==e,u=null===e,c=e==e,l=A(e);if(!u&&!l&&!i&&t>e||i&&a&&c&&!u&&!l||r&&a&&c||!n&&c||!o)return 1;if(!r&&!i&&!l&&t<e||l&&n&&o&&!r&&!i||u&&n&&o||!a&&o||!c)return-1}return 0};var Ri=function(t,e,n){for(var r=-1,o=t.criteria,i=e.criteria,a=o.length,u=n.length;++r<a;){var c=$i(o[r],i[r]);if(c)return r>=u?c:c*("desc"==n[r]?-1:1)}return t.index-e.index};var Vi=function(t,e,n){var r=-1;e=l(e.length?e:[dr],st(gr));var o=Ni(t,function(t,n,o){return{criteria:l(e,function(e){return e(t)}),index:++r,value:t}});return Bi(o,function(t,e){return Ri(t,e,n)})},Wi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var Hi=function(t,e,n){if(!k(n))return!1;var r=void 0===e?"undefined":Wi(e);return!!("number"==r?Dt(n)&&at(e,n.length):"string"==r&&e in n)&&Mt(n[e],t)},Qi=no(function(t,e){if(null==t)return[];var n=e.length;return n>1&&Hi(t,e[0],e[1])?e=[]:n>2&&Hi(e[0],e[1],e[2])&&(e=[e[0]]),Vi(t,zi(e,1),[])});var Yi=function(){},qi=_n&&1/Qe(new _n([,-0]))[1]==1/0?function(t){return new _n(t)}:Yi,Gi=200;var Ji=function(t,e,n){var r=-1,o=Rr,i=t.length,a=!0,u=[],c=u;if(n)a=!1,o=Vr;else if(i>=Gi){var l=e?null:qi(t);if(l)return Qe(l);a=!1,o=Be,c=new Ue}else c=e?[]:u;t:for(;++r<i;){var f=t[r],s=e?e(f):f;if(f=n||0!==f?f:0,a&&s==s){for(var v=c.length;v--;)if(c[v]===s)continue t;e&&c.push(s),u.push(f)}else o(c,s,n)||(c!==u&&c.push(s),u.push(f))}return u};var Ki=function(t){return t&&t.length?Ji(t):[]},Xi="[object String]";var Zi=function(t){return"string"==typeof t||!f(t)&&w(t)&&j(t)==Xi},ta="CHEAPEST",ea="FASTEST",na="COMBINED",ra="pickup-in-point",oa="delivery",ia="price",aa="shippingEstimateInSeconds",ua="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ca=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),la=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function fa(t){return Zi(t)?t:ar(t,"deliveryChannel")||ar(t,"selectedDeliveryChannel")||ar(t,"id")}function sa(t){return fa(t)===ra}function va(t){return fa(t)===oa}function da(t){return t&&t.availableDeliveryWindows&&t.availableDeliveryWindows.length>0}function ya(t){return t&&t.slas?t.slas.length>0:t&&t.length>0}function pa(t){return t.slas&&t.slas.find(function(e){return e.id===t.selectedSla})}function ha(t,e){return fa(t)===e}function ba(t){var e=t.items,n=t.li,r=t.seller,o=t.sellerId,i=Zi(o)?o:r&&r.id;return n&&e[n.itemIndex]&&e[n.itemIndex].seller===i}function ga(t,e){var n=t.find(function(t){return t.slas.find(function(t){return t.id===e})});return n&&n.slas.find(function(t){return t.id===e})}function ma(t,e){return t&&t.deliveryChannels&&t.deliveryChannels.some(function(t){return t.id===e})}function Sa(t,e){if(!t||!t.slas)return null;var n=0===t.slas.filter(function(t){return va(t)&&!da(t)}).length,r=t.slas.filter(function(t){return ha(t,e)&&(!da(t)||n)}),o=r[0];return o&&r.forEach(function(t){o=t.price<o.price?t:o}),o}function ja(t){var e=Object.entries(t).map(function(t){var e=ca(t,2),n=e[0],r=e[1];return[n,null==r.value?"object"===(void 0===r?"undefined":ua(r))?null:r:r.value]});return Object.fromEntries(e)}var _a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function wa(t){return t.filter(function(t){return va(t)}).reduce(function(t,e){var n,r=pa(e);return r&&t+(n=r,Math.abs(zr.getShippingEstimateQuantityInSeconds(n.shippingEstimate)))||t+0},0)}function Ia(t,e){var n,r,o=function(t){var e=zr.getLatestSla(t.filter(function(t){return!!t.selectedSla&&ya(t)&&va(t)}).map(function(t){return pa(t)}));return e&&e.shippingEstimate}(t);return _a({price:function(t){return t&&t.filter(function(t){return(!!t.selectedSla||ya(t))&&va(t)}).reduce(function(t,e){var n=pa(e);return n&&n.availableDeliveryWindows&&n.availableDeliveryWindows.length>0?t:n?t+n.price:t},0)}(t),shippingEstimate:o,shippingEstimateInSeconds:Lr(o),averageEstimatePerItem:(r=t,(r&&wa(r))/r.length),packagesLength:(n=t,Ki(Li(n.filter(function(t){return va(t)&&(!!t.selectedSla||ya(t))}).map(function(t){return t.selectedSla}))).length)},e?{id:e}:{})}var Oa=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Aa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Ca(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Da(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function Ea(t){var e=t[ta]&&t[ta].length>0,n=t[na]&&t[na].length>0,r=t[ea]&&t[ea].length>0;return function(t){var e=[];return t.forEach(function(t){e.findIndex(function(e){return ao(Ui(e,"id"),Ui(t,"id"))})<=-1&&e.push(t)}),function(t){return t.filter(function(e,n){return!t[n+1]||e.price<t[n+1].price})}(e)}([].concat(Da(e?[Ia(t[ta],ta)]:[]),Da(n?[Ia(t[na],na)]:[]),Da(r?[Ia(t[ea],ea)]:[])))}function xa(t,e){return t.map(function(t){return Aa({},t,{price:function(t,e){return e.map(function(e){return e.slas.find(function(e){return e.id===t.id})}).reduce(function(t,e){return e?e.price+t:t},0)}(t,e),shippingEstimateInSeconds:(n=t.shippingEstimate,zr.getShippingEstimateQuantityInSeconds(n))});var n})}function Pa(t){return t.map(function(e){var n=function(t){if(t)return t.filter(function(t){return va(t)&&!da(t)})}(e.slas);return n.length?xa(n,t):[]})}function ka(t){var e=t.logisticsInfo,n=t.selectedSlas,r=t.activeChannel,o=t.isScheduledDeliveryActive,i=[],a=e.some(function(t){return t.slas.every(function(t){return da(t)&&va(t)})});return e.forEach(function(t,e){if(null===(u=t).selectedSla&&null===u.selectedDeliveryChannel||sa(t)&&sa(r))i.push(t);else{var u,c=1===t.slas.length&&t.slas.every(function(t){return ha(t,r)&&da(t)}),l=t.slas.find(function(t){return ha(t,r)&&da(t)});if((o||c)&&l||a&&l){var f=t.slas.find(function(e){return e.id===t.selectedSla}),s=!c&&f&&da(f);i.push(Aa({},t,{selectedSla:s?f.id:l.id,selectedDeliveryChannel:s?f.deliveryChannel:l.deliveryChannel}))}else{var v=function(t,e){return t.find(function(t){return t.itemIndex===e.itemIndex})}(i,t);if(v)i.push(Aa({},t,{selectedSla:v.selectedSla,selectedDeliveryChannel:v.selectedDeliveryChannel}));else{var d=n&&n[e],y=d&&n[e].id,p=d&&n[e].deliveryChannel;i.push(Aa({},t,{selectedSla:y||t.selectedSla,selectedDeliveryChannel:p||t.selectedDeliveryChannel}))}}}}),i}function Ma(t,e,n){var r=io.apply(void 0,Da(t.map(function(t){return t.map(function(t){return t.id})}))),o=[];return n&&o.push(function(t){return!r.includes(t.id)}),o.push(function(t){return t[e]}),o.push(function(t){return t.id}),t.map(function(t){return Qi(t,o)[0]})}function Fa(t){var e=ka({logisticsInfo:t.logisticsInfo,selectedSlas:t.selectedSlas,activeChannel:t.activeChannel,isScheduledDeliveryActive:t.isScheduledDeliveryActive});return function(t){var e=t.filter(function(t){return null!==t.selectedSla}).map(function(t){return t.selectedSla});return t.every(function(t){return 1===io(t.slas.map(function(t){return t.id}),e).length})}(e)?e:null}function Ta(t){var e=t.logisticsInfo,n=t.activeChannel,r=void 0===n?oa:n,o=t.isScheduledDeliveryActive,i=void 0!==o&&o,a=t.property,u=Pa(e),c=u.map(function(t,n){return t.find(function(t){return t.id===e[n].selectedSla})}),l=Ma(u,a,!1),f=Ma(u,a,!0),s=Fa({logisticsInfo:e,selectedSlas:c,activeChannel:r,isScheduledDeliveryActive:i}),v=Fa({logisticsInfo:e,selectedSlas:l,activeChannel:r,isScheduledDeliveryActive:i}),d=Fa({logisticsInfo:e,selectedSlas:f,activeChannel:r,isScheduledDeliveryActive:i}),y=[s,v,d].filter(function(t){return t}),p=io.apply(void 0,Da(u.map(function(t){return t.map(function(t){return t.id})}))),h=ka({logisticsInfo:e,selectedSlas:l,activeChannel:r,isScheduledDeliveryActive:i}),b=Qi(y,[function(t){return Ia(t)[a]},function(t){return t.every(function(t){return!p.includes(t.selectedSla)})}])[0]||h;return[b,function(t){var e,n=t.arrayOfSlas,r=t.property,o=t.currentLogisticsInfo,i=t.bestIndividualLogisticsInfo,a=t.bestConsistentLogisticsInfo,u=t.fallback,c=[{logisticsInfo:o,method:"current"},{logisticsInfo:i,method:"individual"},{logisticsInfo:a,method:"consistent"}].filter(function(t){return t.logisticsInfo}),l=io.apply(void 0,Da(n.map(function(t){return t.map(function(t){return t.id})}))),f=Qi(c,[function(t){return Ia(t.logisticsInfo)[r]},function(t){return t.logisticsInfo.every(function(t){return!l.includes(t.selectedSla)})}])[0]||{logisticsInfo:u,method:"fallback"},s=[].concat(Da(new Set(f.logisticsInfo.map(function(t){return t.selectedSla})))),v=new Set(n.map(function(t){return t.map(function(t){return t.id})})).size,d=i?Ia(f.logisticsInfo)[r]-Ia(i)[r]:-1,y=r===ia?"cheapest":"fastest";return Ca(e={numberOfAvailableSlas:v},y+"Profit",d),Ca(e,y+"NumberOfSelectedSlas",s.length),Ca(e,y+"SelectedMethod",f.method),Ca(e,y+"CurrentMethodIsValid",null!==o),Ca(e,y+"IndividualMethodIsValid",null!==i),Ca(e,y+"ConsistentMethodIsValid",null!==a),e}({arrayOfSlas:u,property:a,currentLogisticsInfo:s,bestIndividualLogisticsInfo:v,bestConsistentLogisticsInfo:d,bestLogisticsInfo:b,fallback:h})]}function za(t){var e,n={level:"Info",type:"Debug",workflowType:"lean-shipping",workflowInstance:"get-lean-shipping-options",event:Aa({},t,{orderFormId:window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.orderFormId}),account:(e=window.vtex,e&&(e.accountName||e.vtexid&&e.vtexid.accountName)||window.__RUNTIME__&&window.__RUNTIME__.account)};Math.random()<.1&&window.logSplunk&&window.logSplunk(n)}var La,Ua=n(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),Array.prototype.findIndex||(Array.prototype.findIndex=function(t){if(null===this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,o=arguments[1],i=0;i<r;i++)if(e=n[i],t.call(o,e,i,n))return i;return-1}),Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");var e=Object(this);return e[e.findIndex(t)]}),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)});var n="pickup-in-point",r="delivery";function o(t,e){return i(t)===e}function i(t){return"string"==typeof t?t:t&&(t.deliveryChannel||t.selectedDeliveryChannel||t.id)||null}e.isCurrentChannel=o,e.getDeliveryChannel=i,e.isPickup=function(t){return o(t,n)},e.isDelivery=function(t){return o(t,r)},e.findChannelById=function(t,e){if(!t||!t.deliveryChannels||0===t.deliveryChannels.length||!e)return null;var n=i(e);return t.deliveryChannels.find(function(t){return t.id===n})||null}});(La=Ua)&&La.__esModule&&Object.prototype.hasOwnProperty.call(La,"default")&&La.default;Ua.isCurrentChannel,Ua.getDeliveryChannel;var Na=Ua.isPickup,Ba=(Ua.isDelivery,Ua.findChannelById),$a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Ra(t){var e=t.action,n=t.canEditData,r=t.channel,o=t.slaFromSlaOption,i=t.firstPickupSla,a=t.items,u=t.newLogisticsInfo,c=t.seller,l=ja(e.address),f=ja(e.searchAddress);return u.map(function(t){if(!ba({items:a,li:t,seller:c}))return t;if(Na(r)){var s=function(t){var e=t.actionAddress,n=t.actionSearchAddress,r=t.channel,o=t.canEditData,i=t.firstPickupSla,a=t.logisticsInfo,u=t.hasMultipleItems;if(i&&Ba(a,r)&&i.deliveryChannel===oa)return a;var c=i&&a.slas.some(function(t){return t.id===i.id});if(c&&Ba(a,i.deliveryChannel)&&i.deliveryChannel===oa)return $a({},a,{addressId:e.addressId,selectedDeliveryChannel:i?i.deliveryChannel:null,selectedSla:i.id});var l=a.slas.find(function(t){return i&&t.id===i.id})||Sa(a,r);if(ma(a,r)&&Na(r)&&(l&&i&&l.id!==i.id||!l)){var f=Sa(a,oa);return $a({},a,{addressId:f&&u?e.addressId:n.addressId,selectedDeliveryChannel:f&&u?oa:r,selectedSla:f&&u?f.id:null})}var s=!ao(e.geoCoordinates,n.geoCoordinates);if(ma(a,r)&&l){var v=Na(r)&&i&&(o||s);return $a({},a,{selectedDeliveryChannel:r,addressId:v?n.addressId:e.addressId,selectedSla:Na(r)&&c?i.id:l.id})}return $a({},a,{selectedDeliveryChannel:ma(a,r)?r:oa,addressId:ma(a,r)?n.addressId:e.addressId})}({action:e,actionAddress:l,actionSearchAddress:f,channel:r,canEditData:n,firstPickupSla:o||i,logisticsInfo:t,hasMultipleItems:u.length>1});if(s)return s}else{var v=function(t){var e=t.actionAddress,n=t.channel,r=t.slaFromSlaOption,o=t.logisticsInfo,i=Sa(o,n);if(!i)return $a({},o,{addressId:e.addressId,selectedDeliveryChannel:null,selectedSla:null});if(ma(o,n)&&r&&o.slas.some(function(t){return t.id===r.id}))return $a({},o,{addressId:e.addressId,selectedDeliveryChannel:n,selectedSla:r.id});var a=ga([o],o.selectedSla),u=a&&a.deliveryChannel===n;return ma(o,n)?$a({},o,{addressId:e.addressId,selectedDeliveryChannel:n,selectedSla:u?o.selectedSla:i.id}):void 0}({actionAddress:l,channel:r,slaFromSlaOption:o,logisticsInfo:t});if(v)return v}return $a({},t,{addressId:l.addressId})})}var Va=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};return{setSelectedSlaFromSlaOption:function(t){var e=t.logisticsInfo,n=t.action,r=t.items,o=t.sellers,i=t.channel,a=t.canEditData,u=t.slaOption,c=[].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(e));o.forEach(function(t){var o=e.filter(function(e){return ba({items:r,li:e,seller:t})}),l=ga(o,u),f=function(t){var e=t.logisticsInfo,n=t.seller,r=t.items;return e&&e.find(function(t){var e=!n||ba({items:r,li:t,seller:n}),o=sa(t)||Sa(t,ra);return e&&o})}({logisticsInfo:e,seller:t,items:r}),s=u?ga(o,u):f&&function(t){var e=pa(t);return e&&sa(e)?e:t&&Sa(t,ra)}(f);c=Ra({action:n,canEditData:a,channel:i,slaFromSlaOption:l,firstPickupSla:s,items:r,newLogisticsInfo:c,seller:t})});var l=ja(n.address),f=ja(n.searchAddress),s=e&&!!e.find(function(t){return ya(t)});return c&&!s&&(c=c.map(function(t){return Va({},t,{selectedDeliveryChannel:i,addressId:sa(i)?f.addressId:l.addressId})})),c},setSelectedDeliveryChannel:function(t,e){return Array.isArray(t)?t.map(function(t){return la({},t,{selectedDeliveryChannel:e})}):t&&la({},t,{selectedDeliveryChannel:e})},getOptionsDetails:Ea,getSelectedDeliveryOption:function(t){var e=t.optionsDetails,n=void 0===e?null:e,r=t.newCombined,o=t.newFastest,i=t.newCheapest,a=t.activeDeliveryOption;n||(n=Ea(Aa({},i?Ca({},ta,i):{},r?Ca({},na,r):{},o?Ca({},ea,o):{})));var u=n&&!!n.find(function(t){return t.id===a});return n.length>0&&!u?n[0].id:a},getLeanShippingOptions:function(t){var e=t.logisticsInfo,n=t.activeChannel,r=void 0===n?oa:n,o=t.isScheduledDeliveryActive,i=void 0!==o&&o,a=Ta({logisticsInfo:e,activeChannel:r,isScheduledDeliveryActive:i,property:ia}),u=Oa(a,2),c=u[0],l=u[1],f=Ta({logisticsInfo:e,activeChannel:r,isScheduledDeliveryActive:i,property:aa}),s=Oa(f,2),v=s[0],d=s[1],y=[];return ao(c,v)||(y=Ta({logisticsInfo:e,activeChannel:r,isScheduledDeliveryActive:i,property:aa})[0]),za(Aa({activeChannel:r,isScheduledDeliveryActive:i},l,d)),Aa({},function(t,e){var n=Ia(t,ta),r=Ia(e,ea),o=n.packagesLength<r.packagesLength,i=n.price<r.price,a=ao(t,e),u=0===n.packagesLength;return t&&(o||i||u||a)}(c,v)?{cheapest:c}:{},function(t,e,n){var r=Ia(t),o=Ia(e),i=Ia(n);return!ao(i,r)&&!ao(i,o)}(c,v,y)?{combined:y}:{},function(t,e){var n=Ia(t,ta),r=Ia(e,ea),o=n.packagesLength<r.packagesLength,i=ao(t,e);return e&&!i&&!o}(c,v)?{fastest:v}:{})}}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@vtex/lean-shipping-calculator", | ||
"version": "0.1.3", | ||
"version": "0.2.15", | ||
"description": "", | ||
@@ -22,6 +22,7 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@vtex/prettier-config": "^0.1.4", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"babel-eslint": "^8.2.2", | ||
"babel-jest": "^22.4.3", | ||
"babel-jest": "^23", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", | ||
@@ -34,6 +35,9 @@ "babel-plugin-transform-object-rest-spread": "6.26.0", | ||
"eslint-config-vtex-react": "^3.0.3", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jest": "^21.12.2", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-jest": "^23", | ||
"husky": "^1.2.0", | ||
"jest": "^22.3.0", | ||
"jest": "^23", | ||
"prettier": "^2.1.2", | ||
"react": "^16.8.6", | ||
"react-intl": "^2.9.0", | ||
"regexpp": "^2.0.1", | ||
@@ -57,2 +61,3 @@ "rollup": "^0.57.1", | ||
"dependencies": { | ||
"@vtex/delivery-packages": "^2.17.0", | ||
"@vtex/estimate-calculator": "1.0.7", | ||
@@ -59,0 +64,0 @@ "lodash": "^4.17.5" |
@@ -5,2 +5,4 @@ # lean-shipping-calculator | ||
[Documentation](https://docs.google.com/document/d/1tDhV1ZOhHhwRYXRGcYmsLvNjsc2pzfQGHKePV68BEKg) | ||
## Install | ||
@@ -16,3 +18,3 @@ | ||
### getLeanShippingOptions(logisticsInfo, activeChannel) | ||
### getLeanShippingOptions({ logisticsInfo, activeChannel, isScheduledDeliveryActive }) | ||
@@ -29,6 +31,12 @@ Returns lean shipping options (cheapest, fastest and combined) | ||
Type: `String` | ||
Type: `String` <br/> | ||
Default: `delivery` | ||
Active channel | ||
#### isScheduledDeliveryActive | ||
Type: `boolean` <br/> | ||
Default: `false` | ||
--- | ||
@@ -69,6 +77,6 @@ | ||
const options = leanShippingCalculator.getLeanShippingOptions( | ||
const options = leanShippingCalculator.getLeanShippingOptions({ | ||
logisticsInfo, | ||
activeChannel | ||
) | ||
activeChannel, | ||
}) | ||
@@ -75,0 +83,0 @@ console.log(options) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1352796
11241
152
3
26
1
+ Added@vtex/delivery-packages@2.18.1(transitive)
+ Added@vtex/estimate-calculator@1.1.0(transitive)