UNPKG

recombee-js-api-client-for-gatsby

Version:

Client-side js library for easy use of the Recombee recommendation API

2 lines 30.3 kB
(function(e,t){'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define('recombee',[],t):'object'==typeof exports?exports.recombee=t():e.recombee=t()})('undefined'==typeof self?this:self,function(){return function(e){function t(r){if(a[r])return a[r].exports;var i=a[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var a={};return t.m=e,t.c=a,t.d=function(e,a,r){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var a=e&&e.__esModule?function(){return e['default']}:function(){return e};return t.d(a,'a',a),a},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p='',t(t.s=4)}([function(e,t){'use strict';t.Request=class{constructor(e,t,a){this.method=e,this.path=t,this.timeout=a}}},function(e,t){'use strict';class a extends Error{constructor(e){super(e),this.name=this.constructor.name,'function'==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}}t.ApiError=a},function(e,t,a){'use strict';const r=a(1);class i extends r.ApiError{constructor(e,t,a){super(a),this.request=e,this.statusCode=t}}t.ResponseError=i},function(e,t,a){'use strict';const r=a(1);class i extends r.ApiError{constructor(e){super(`Client did not get response within ${e.timeout} ms`),this.request=e}}t.TimeoutError=i},function(e,t,a){e.exports=a(5)},function(e,t,a){'use strict';t.ApiClient=a(6).ApiClient,t.ApiError=a(1).ApiError,t.ResponseError=a(2).ResponseError,t.TimeoutError=a(3).TimeoutError,t.MergeUsers=a(10).MergeUsers,t.AddDetailView=a(11).AddDetailView,t.AddPurchase=a(12).AddPurchase,t.AddRating=a(13).AddRating,t.AddCartAddition=a(14).AddCartAddition,t.AddBookmark=a(15).AddBookmark,t.SetViewPortion=a(16).SetViewPortion,t.RecommendItemsToUser=a(17).RecommendItemsToUser,t.RecommendItemsToItem=a(18).RecommendItemsToItem},function(e,t,a){'use strict';(function(e){const r=a(8),i=a(9);t.ApiClient=class{constructor(t,a,r){this.databaseId=t,this.publicToken=a,this.options=r||{},this.baseUri=this.options.baseUri||e.env.RAPI_URI||'client-rapi.recombee.com',this.useHttps=!('useHttps'in this.options)||this.options.useHttps,this.async=!('async'in this.options)||this.options.async}send(e,t){var a=this;if(t===void 0&&window.Promise)return new Promise(function(t,r){a.send(e,function(e,a){e?r(e):t(a)})});var r=this._signUrl(e.path),n=(this.useHttps?'https://':'http://')+this.baseUri+r,s=new XMLHttpRequest;s.open('POST',n,this.async),s.setRequestHeader('Accept','application/json'),s.setRequestHeader('Content-Type','text/plain'),this.async&&(s.timeout=e.timeout),s.onreadystatechange=function(){if(4==this.readyState&&this.responseText)if(200==this.status){if(t)return t(null,JSON.parse(this.responseText));}else if(t)return t(new i.ResponseError(e,this.status,this.responseText))},s.ontimeout=function(){if(t)return t(new i.TimeoutError(e))},s.send(JSON.stringify(e.bodyParameters()))}_signUrl(e){let t='/'+this.databaseId+e;t+=(-1==e.indexOf('?')?'?':'&')+'frontend_timestamp='+parseInt(new Date().getTime()/1e3);let a=new r('SHA-1','TEXT');return a.setHMACKey(this.publicToken,'TEXT'),a.update(t),t+='&frontend_sign='+a.getHMAC('HEX'),t}}}).call(t,a(7))},function(e){function t(){throw new Error('setTimeout has not been defined')}function a(){throw new Error('clearTimeout has not been defined')}function r(e){if(c===setTimeout)return setTimeout(e,0);if((c===t||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(m===clearTimeout)return clearTimeout(e);if((m===a||!m)&&clearTimeout)return m=clearTimeout,clearTimeout(e);try{return m(e)}catch(t){try{return m.call(null,e)}catch(t){return m.call(this,e)}}}function n(){b&&u&&(b=!1,u.length?l=u.concat(l):A=-1,l.length&&s())}function s(){if(!b){var e=r(n);b=!0;for(var t=l.length;t;){for(u=l,l=[];++A<t;)u&&u[A].run();A=-1,t=l.length}u=null,b=!1,i(e)}}function o(e,t){this.fun=e,this.array=t}function d(){}var c,m,p=e.exports={};(function(){try{c='function'==typeof setTimeout?setTimeout:t}catch(a){c=t}try{m='function'==typeof clearTimeout?clearTimeout:a}catch(t){m=a}})();var u,l=[],b=!1,A=-1;p.nextTick=function(e){var t=Array(arguments.length-1);if(1<arguments.length)for(var a=1;a<arguments.length;a++)t[a-1]=arguments[a];l.push(new o(e,t)),1!==l.length||b||r(s)},o.prototype.run=function(){this.fun.apply(null,this.array)},p.title='browser',p.browser=!0,p.env={},p.argv=[],p.version='',p.versions={},p.on=d,p.addListener=d,p.once=d,p.off=d,p.removeListener=d,p.removeAllListeners=d,p.emit=d,p.prependListener=d,p.prependOnceListener=d,p.listeners=function(){return[]},p.binding=function(){throw new Error('process.binding is not supported')},p.cwd=function(){return'/'},p.chdir=function(){throw new Error('process.chdir is not supported')},p.umask=function(){return 0}},function(e,a,r){'use strict';var i;(function(n){function s(i,s,a){var o,S,l,H,T,E,f,U,r,t=0,e=[],h=0,n=!1,d=[],I=[],P=!1,y=!1,D=-1;if(a=a||{},o=a.encoding||'UTF8',r=a.numRounds||1,r!==parseInt(r,10)||1>r)throw Error('numRounds must a integer >= 1');if('SHA-1'===i)T=512,E=A,f=k,H=160,U=function(e){return e.slice()};else if(0===i.lastIndexOf('SHA-',0)){if(E=function(e,t){return g(e,t,i)},f=function(t,a,r,n){var e,s;if('SHA-224'===i||'SHA-256'===i)e=(a+65>>>9<<4)+15,s=16;else if('SHA-384'===i||'SHA-512'===i)e=(a+129>>>10<<5)+31,s=32;else throw Error('Unexpected error in SHA-2 implementation');for(;t.length<=e;)t.push(0);for(t[a>>>5]|=128<<24-a%32,a+=r,t[e]=4294967295&a,t[e-1]=0|a/4294967296,r=t.length,a=0;a<r;a+=s)n=g(t.slice(a,a+s),n,i);if('SHA-224'===i)t=[n[0],n[1],n[2],n[3],n[4],n[5],n[6]];else if('SHA-256'===i)t=n;else if('SHA-384'===i)t=[n[0].a,n[0].b,n[1].a,n[1].b,n[2].a,n[2].b,n[3].a,n[3].b,n[4].a,n[4].b,n[5].a,n[5].b];else if('SHA-512'===i)t=[n[0].a,n[0].b,n[1].a,n[1].b,n[2].a,n[2].b,n[3].a,n[3].b,n[4].a,n[4].b,n[5].a,n[5].b,n[6].a,n[6].b,n[7].a,n[7].b];else throw Error('Unexpected error in SHA-2 implementation');return t},U=function(e){return e.slice()},'SHA-224'===i)T=512,H=224;else if('SHA-256'===i)T=512,H=256;else if('SHA-384'===i)T=1024,H=384;else if('SHA-512'===i)T=1024,H=512;else throw Error('Chosen SHA variant is not supported');}else if(0===i.lastIndexOf('SHA3-',0)||0===i.lastIndexOf('SHAKE',0)){var x=6;if(E=v,U=function(t){var a,e=[];for(a=0;5>a;a+=1)e[a]=t[a].slice();return e},D=1,'SHA3-224'===i)T=1152,H=224;else if('SHA3-256'===i)T=1088,H=256;else if('SHA3-384'===i)T=832,H=384;else if('SHA3-512'===i)T=576,H=512;else if('SHAKE128'===i)T=1344,H=-1,x=31,y=!0;else if('SHAKE256'===i)T=1088,H=-1,x=31,y=!0;else throw Error('Chosen SHA variant is not supported');f=function(t,a,r,e,i){r=T;var s,o=x,c=[],m=r>>>5,n=0,p=a>>>5;for(s=0;s<p&&a>=r;s+=m)e=v(t.slice(s,s+m),e),a-=r;for(t=t.slice(s),a%=r;t.length<m;)t.push(0);for(s=a>>>3,t[s>>2]^=o<<8*(s%4),t[m-1]^=2147483648,e=v(t,e);32*c.length<i&&(t=e[n%5][0|n/5],c.push(t.b),!(32*c.length>=i));)c.push(t.a),n+=1,0==64*n%r&&v(null,e);return c}}else throw Error('Chosen SHA variant is not supported');l=R(s,o,D),S=B(i),this.setHMACKey=function(e,a,r){var s;if(!0==n)throw Error('HMAC key already set');if(!0==P)throw Error('Cannot set HMAC key after calling update');if(!0==y)throw Error('SHAKE is not supported for HMAC');if(o=(r||{}).encoding||'UTF8',a=R(a,o,D)(e),e=a.binLen,a=a.value,s=T>>>3,r=s/4-1,s<e/8){for(a=f(a,e,0,B(i),H);a.length<=r;)a.push(0);a[r]&=4294967040}else if(s>e/8){for(;a.length<=r;)a.push(0);a[r]&=4294967040}for(e=0;e<=r;e+=1)d[e]=909522486^a[e],I[e]=1549556828^a[e];S=E(d,S),t=T,n=!0},this.update=function(r){var a,i,n,s=0,o=T>>>5;for(a=l(r,e,h),r=a.binLen,i=a.value,a=r>>>5,n=0;n<a;n+=o)s+T<=r&&(S=E(i.slice(n,n+o),S),s+=T);t+=s,e=i.slice(s>>>5),h=r%T,P=!0},this.getHash=function(s,a){var o,l,b,d;if(!0==n)throw Error('Cannot call getHash after setting HMAC key');if(b=C(a),!0==y){if(-1===b.shakeLen)throw Error('shakeLen must be specified in options');H=b.shakeLen}switch(s){case'HEX':o=function(e){return c(e,H,D,b)};break;case'B64':o=function(e){return m(e,H,D,b)};break;case'BYTES':o=function(e){return p(e,H,D)};break;case'ARRAYBUFFER':try{l=new ArrayBuffer(0)}catch(e){throw Error('ARRAYBUFFER not supported by this environment')}o=function(e){return u(e,H,D)};break;default:throw Error('format must be HEX, B64, BYTES, or ARRAYBUFFER');}for(d=f(e.slice(),h,t,U(S),H),l=1;l<r;l+=1)!0==y&&0!=H%32&&(d[d.length-1]&=16777215>>>24-H%32),d=f(d,H,0,B(i),H);return o(d)},this.getHMAC=function(r,a){var s,o,l,d;if(!1==n)throw Error('Cannot call getHMAC without first setting HMAC key');switch(l=C(a),r){case'HEX':s=function(e){return c(e,H,D,l)};break;case'B64':s=function(e){return m(e,H,D,l)};break;case'BYTES':s=function(e){return p(e,H,D)};break;case'ARRAYBUFFER':try{s=new ArrayBuffer(0)}catch(e){throw Error('ARRAYBUFFER not supported by this environment')}s=function(e){return u(e,H,D)};break;default:throw Error('outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER');}return o=f(e.slice(),h,t,U(S),H),d=E(I,B(i)),d=f(o,H,T,d,H),s(d)}}function o(e,t){this.a=e,this.b=t}function c(t,r,a,i){var e='';r/=8;var s,n,o;for(o=-1===a?3:0,s=0;s<r;s+=1)n=t[s>>>2]>>>8*(o+s%4*a),e+='0123456789abcdef'.charAt(15&n>>>4)+'0123456789abcdef'.charAt(15&n);return i.outputUpper?e.toUpperCase():e}function m(t,r,a,i){var e,s,o,d,c='',m=r/8;for(d=-1===a?3:0,e=0;e<m;e+=3)for(s=e+1<m?t[e+1>>>2]:0,o=e+2<m?t[e+2>>>2]:0,o=(255&t[e>>>2]>>>8*(d+e%4*a))<<16|(255&s>>>8*(d+(e+1)%4*a))<<8|255&o>>>8*(d+(e+2)%4*a),s=0;4>s;s+=1)c+=8*e+6*s<=r?'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(63&o>>>6*(3-s)):i.b64Pad;return c}function p(t,r,a){var i='';r/=8;var e,n,s;for(s=-1===a?3:0,e=0;e<r;e+=1)n=255&t[e>>>2]>>>8*(s+e%4*a),i+=String.fromCharCode(n);return i}function u(t,r,a){r/=8;var i,e,n,s=new ArrayBuffer(r);for(n=new Uint8Array(s),e=-1===a?3:0,i=0;i<r;i+=1)n[i]=255&t[i>>>2]>>>8*(e+i%4*a);return s}function C(e){var t={outputUpper:!1,b64Pad:'=',shakeLen:-1};if(e=e||{},t.outputUpper=e.outputUpper||!1,!0===e.hasOwnProperty('b64Pad')&&(t.b64Pad=e.b64Pad),!0===e.hasOwnProperty('shakeLen')){if(0!=e.shakeLen%8)throw Error('shakeLen must be a multiple of 8');t.shakeLen=e.shakeLen}if('boolean'!=typeof t.outputUpper)throw Error('Invalid outputUpper formatting option');if('string'!=typeof t.b64Pad)throw Error('Invalid b64Pad formatting option');return t}function R(e,i,n){switch(i){case'UTF8':case'UTF16BE':case'UTF16LE':break;default:throw Error('encoding must be UTF8, UTF16BE, or UTF16LE');}switch(e){case'HEX':e=function(e,t,a){var r,i,s,o,d,m,p=e.length;if(0!=p%2)throw Error('String of HEX type must be in byte increments');for(t=t||[0],a=a||0,d=a>>>3,m=-1===n?3:0,r=0;r<p;r+=2){if(i=parseInt(e.substr(r,2),16),isNaN(i))throw Error('String of HEX type contains invalid characters');for(o=(r>>>1)+d,s=o>>>2;t.length<=s;)t.push(0);t[s]|=i<<8*(m+o%4*n)}return{value:t,binLen:4*p+a}};break;case'TEXT':e=function(e,a,s){var o,d,c,l,m,b,u,r,t=0;if(a=a||[0],s=s||0,m=s>>>3,'UTF8'===i)for(r=-1===n?3:0,c=0;c<e.length;c+=1)for(o=e.charCodeAt(c),d=[],128>o?d.push(o):2048>o?(d.push(192|o>>>6),d.push(128|63&o)):55296>o||57344<=o?d.push(224|o>>>12,128|63&o>>>6,128|63&o):(c+=1,o=65536+((1023&o)<<10|1023&e.charCodeAt(c)),d.push(240|o>>>18,128|63&o>>>12,128|63&o>>>6,128|63&o)),l=0;l<d.length;l+=1){for(u=t+m,b=u>>>2;a.length<=b;)a.push(0);a[b]|=d[l]<<8*(r+u%4*n),t+=1}else if('UTF16BE'===i||'UTF16LE'===i)for(r=-1===n?2:0,d='UTF16LE'==i&&1!==n||'UTF16LE'!=i&&1===n,c=0;c<e.length;c+=1){for(o=e.charCodeAt(c),!0===d&&(l=255&o,o=l<<8|o>>>8),u=t+m,b=u>>>2;a.length<=b;)a.push(0);a[b]|=o<<8*(r+u%4*n),t+=2}return{value:a,binLen:8*t+s}};break;case'B64':e=function(e,a,i){var s,o,d,p,m,l,u,r,t=0;if(-1===e.search(/^[a-zA-Z0-9=+\/]+$/))throw Error('Invalid character in base-64 string');if(o=e.indexOf('='),e=e.replace(/\=/g,''),-1!==o&&o<e.length)throw Error('Invalid \'=\' found in base-64 string');for(a=a||[0],i=i||0,l=i>>>3,r=-1===n?3:0,o=0;o<e.length;o+=4){for(m=e.substr(o,4),d=p=0;d<m.length;d+=1)s='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.indexOf(m[d]),p|=s<<18-6*d;for(d=0;d<m.length-1;d+=1){for(u=t+l,s=u>>>2;a.length<=s;)a.push(0);a[s]|=(255&p>>>16-8*d)<<8*(r+u%4*n),t+=1}}return{value:a,binLen:8*t+i}};break;case'BYTES':e=function(e,t,a){var r,i,s,o,d,m;for(t=t||[0],a=a||0,s=a>>>3,m=-1===n?3:0,i=0;i<e.length;i+=1)r=e.charCodeAt(i),d=i+s,o=d>>>2,t.length<=o&&t.push(0),t[o]|=r<<8*(m+d%4*n);return{value:t,binLen:8*e.length+a}};break;case'ARRAYBUFFER':try{e=new ArrayBuffer(0)}catch(t){throw Error('ARRAYBUFFER not supported by this environment')}e=function(e,t,a){var r,i,s,o,d,m;for(t=t||[0],a=a||0,i=a>>>3,d=-1===n?3:0,m=new Uint8Array(e),r=0;r<e.byteLength;r+=1)o=r+i,s=o>>>2,t.length<=s&&t.push(0),t[s]|=m[r]<<8*(d+o%4*n);return{value:t,binLen:8*e.byteLength+a}};break;default:throw Error('format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER');}return e}function h(e,t){return e<<t|e>>>32-t}function b(e,t){return 32<t?(t-=32,new o(e.b<<t|e.a>>>32-t,e.a<<t|e.b>>>32-t)):0===t?e:new o(e.a<<t|e.b>>>32-t,e.b<<t|e.a>>>32-t)}function l(e,t){return e>>>t|e<<32-t}function I(e,t){var a=null,a=new o(e.a,e.b);return a=32>=t?new o(a.a>>>t|4294967295&a.b<<32-t,a.b>>>t|4294967295&a.a<<32-t):new o(a.b>>>t-32|4294967295&a.a<<64-t,a.a>>>t-32|4294967295&a.b<<64-t)}function t(e,t){var a=null;return a=32>=t?new o(e.a>>>t,e.b>>>t|4294967295&e.a<<32-t):new o(0,e.a>>>t-32)}function S(e,t,a){return e&t^~e&a}function T(e,t,a){return new o(e.a&t.a^~e.a&a.a,e.b&t.b^~e.b&a.b)}function P(e,t,a){return e&t^e&a^t&a}function U(e,t,a){return new o(e.a&t.a^e.a&a.a^t.a&a.a,e.b&t.b^e.b&a.b^t.b&a.b)}function O(e){return l(e,2)^l(e,13)^l(e,22)}function Y(e){var t=I(e,28),a=I(e,34);return e=I(e,39),new o(t.a^a.a^e.a,t.b^a.b^e.b)}function M(e){return l(e,6)^l(e,11)^l(e,25)}function j(e){var t=I(e,14),a=I(e,18);return e=I(e,41),new o(t.a^a.a^e.a,t.b^a.b^e.b)}function _(e){return l(e,7)^l(e,18)^e>>>3}function N(e){var r=I(e,1),a=I(e,8);return e=t(e,7),new o(r.a^a.a^e.a,r.b^a.b^e.b)}function Q(e){return l(e,17)^l(e,19)^e>>>10}function $(e){var r=I(e,19),a=I(e,61);return e=t(e,6),new o(r.a^a.a^e.a,r.b^a.b^e.b)}function ee(e,t){var a=(65535&e)+(65535&t);return(65535&(e>>>16)+(t>>>16)+(a>>>16))<<16|65535&a}function G(t,r,a,i){var e=(65535&t)+(65535&r)+(65535&a)+(65535&i);return(65535&(t>>>16)+(r>>>16)+(a>>>16)+(i>>>16)+(e>>>16))<<16|65535&e}function te(t,r,a,i,e){var n=(65535&t)+(65535&r)+(65535&a)+(65535&i)+(65535&e);return(65535&(t>>>16)+(r>>>16)+(a>>>16)+(i>>>16)+(e>>>16)+(n>>>16))<<16|65535&n}function H(t,r){var a,i,e;return a=(65535&t.b)+(65535&r.b),i=(t.b>>>16)+(r.b>>>16)+(a>>>16),e=(65535&i)<<16|65535&a,a=(65535&t.a)+(65535&r.a)+(i>>>16),i=(t.a>>>16)+(r.a>>>16)+(a>>>16),new o((65535&i)<<16|65535&a,e)}function ae(t,r,a,i){var e,s,n;return e=(65535&t.b)+(65535&r.b)+(65535&a.b)+(65535&i.b),s=(t.b>>>16)+(r.b>>>16)+(a.b>>>16)+(i.b>>>16)+(e>>>16),n=(65535&s)<<16|65535&e,e=(65535&t.a)+(65535&r.a)+(65535&a.a)+(65535&i.a)+(s>>>16),s=(t.a>>>16)+(r.a>>>16)+(a.a>>>16)+(i.a>>>16)+(e>>>16),new o((65535&s)<<16|65535&e,n)}function re(t,r,a,i,e){var s,n,d;return s=(65535&t.b)+(65535&r.b)+(65535&a.b)+(65535&i.b)+(65535&e.b),n=(t.b>>>16)+(r.b>>>16)+(a.b>>>16)+(i.b>>>16)+(e.b>>>16)+(s>>>16),d=(65535&n)<<16|65535&s,s=(65535&t.a)+(65535&r.a)+(65535&a.a)+(65535&i.a)+(65535&e.a)+(n>>>16),n=(t.a>>>16)+(r.a>>>16)+(a.a>>>16)+(i.a>>>16)+(e.a>>>16)+(s>>>16),new o((65535&n)<<16|65535&s,d)}function E(e,t){return new o(e.a^t.a,e.b^t.b)}function B(e){var t,r=[];if('SHA-1'===e)r=[1732584193,4023233417,2562383102,271733878,3285377520];else if(0===e.lastIndexOf('SHA-',0))switch(r=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],t=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e){case'SHA-224':break;case'SHA-256':r=t;break;case'SHA-384':r=[new o(3418070365,r[0]),new o(1654270250,r[1]),new o(2438529370,r[2]),new o(355462360,r[3]),new o(1731405415,r[4]),new o(41048885895,r[5]),new o(3675008525,r[6]),new o(1203062813,r[7])];break;case'SHA-512':r=[new o(t[0],4089235720),new o(t[1],2227873595),new o(t[2],4271175723),new o(t[3],1595750129),new o(t[4],2917565137),new o(t[5],725511199),new o(t[6],4215389547),new o(t[7],327033209)];break;default:throw Error('Unknown SHA variant');}else if(0===e.lastIndexOf('SHA3-',0)||0===e.lastIndexOf('SHAKE',0))for(e=0;5>e;e+=1)r[e]=[new o(0,0),new o(0,0),new o(0,0),new o(0,0),new o(0,0)];else throw Error('No SHA variants supported');return r}function A(t,r){var a,e,i,n,s,o,c,m=[];for(a=r[0],e=r[1],i=r[2],n=r[3],s=r[4],c=0;80>c;c+=1)m[c]=16>c?t[c]:h(m[c-3]^m[c-8]^m[c-14]^m[c-16],1),o=20>c?te(h(a,5),e&i^~e&n,s,1518500249,m[c]):40>c?te(h(a,5),e^i^n,s,1859775393,m[c]):60>c?te(h(a,5),P(e,i,n),s,2400959708,m[c]):te(h(a,5),e^i^n,s,3395469782,m[c]),s=n,n=i,i=h(e,30),e=a,a=o;return r[0]=ee(a,r[0]),r[1]=ee(e,r[1]),r[2]=ee(i,r[2]),r[3]=ee(n,r[3]),r[4]=ee(s,r[4]),r}function k(t,r,a,i){var e;for(e=(r+65>>>9<<4)+15;t.length<=e;)t.push(0);for(t[r>>>5]|=128<<24-r%32,r+=a,t[e]=4294967295&r,t[e-1]=0|r/4294967296,r=t.length,e=0;e<r;e+=16)i=A(t.slice(e,e+16),i);return i}function g(i,s,a){var c,e,b,n,h,l,p,I,m,g,u,r,t,f,R,v,A,y,x,F,k,C,D,B=[];if('SHA-224'===a||'SHA-256'===a)g=64,r=1,C=Number,t=ee,f=G,R=te,v=_,A=Q,y=O,x=M,k=P,F=S,D=L;else if('SHA-384'===a||'SHA-512'===a)g=80,r=2,C=o,t=H,f=ae,R=re,v=N,A=$,y=Y,x=j,k=U,F=T,D=d;else throw Error('Unexpected error in SHA-2 implementation');for(a=s[0],c=s[1],e=s[2],b=s[3],n=s[4],h=s[5],l=s[6],p=s[7],u=0;u<g;u+=1)16>u?(m=u*r,I=i.length<=m?0:i[m],m=i.length<=m+1?0:i[m+1],B[u]=new C(I,m)):B[u]=f(A(B[u-2]),B[u-7],v(B[u-15]),B[u-16]),I=R(p,x(n),F(n,h,l),D[u],B[u]),m=t(y(a),k(a,c,e)),p=l,l=h,h=n,n=t(b,I),b=e,e=c,c=a,a=t(I,m);return s[0]=t(a,s[0]),s[1]=t(c,s[1]),s[2]=t(e,s[2]),s[3]=t(b,s[3]),s[4]=t(n,s[4]),s[5]=t(h,s[5]),s[6]=t(l,s[6]),s[7]=t(p,s[7]),s}function v(t,r){var a,i,e,s,n=[],d=[];if(null!==t)for(i=0;i<t.length;i+=2)r[(i>>>1)%5][0|(i>>>1)/5]=E(r[(i>>>1)%5][0|(i>>>1)/5],new o(t[i+1],t[i]));for(a=0;24>a;a+=1){for(s=B('SHA3-'),i=0;5>i;i+=1){e=r[i][0];var c=r[i][1],p=r[i][2],u=r[i][3],m=r[i][4];n[i]=new o(e.a^c.a^p.a^u.a^m.a,e.b^c.b^p.b^u.b^m.b)}for(i=0;5>i;i+=1)d[i]=E(n[(i+4)%5],b(n[(i+1)%5],1));for(i=0;5>i;i+=1)for(e=0;5>e;e+=1)r[i][e]=E(r[i][e],d[i]);for(i=0;5>i;i+=1)for(e=0;5>e;e+=1)s[e][(2*i+3*e)%5]=b(r[i][e],f[i][e]);for(i=0;5>i;i+=1)for(e=0;5>e;e+=1)r[i][e]=E(s[i][e],new o(~s[(i+1)%5][e].a&s[(i+2)%5][e].a,~s[(i+1)%5][e].b&s[(i+2)%5][e].b));r[0][0]=E(r[0][0],y[a])}return r}var L,d,f,y;L=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],d=[new o(L[0],3609767458),new o(L[1],602891725),new o(L[2],3964484399),new o(L[3],2173295548),new o(L[4],4081628472),new o(L[5],3053834265),new o(L[6],2937671579),new o(L[7],3664609560),new o(L[8],2734883394),new o(L[9],1164996542),new o(L[10],1323610764),new o(L[11],3590304994),new o(L[12],4068182383),new o(L[13],991336113),new o(L[14],633803317),new o(L[15],3479774868),new o(L[16],2666613458),new o(L[17],944711139),new o(L[18],2341262773),new o(L[19],2007800933),new o(L[20],1495990901),new o(L[21],1856431235),new o(L[22],3175218132),new o(L[23],2198950837),new o(L[24],3999719339),new o(L[25],766784016),new o(L[26],2566594879),new o(L[27],3203337956),new o(L[28],1034457026),new o(L[29],2466948901),new o(L[30],3758326383),new o(L[31],168717936),new o(L[32],1188179964),new o(L[33],1546045734),new o(L[34],1522805485),new o(L[35],2643833823),new o(L[36],2343527390),new o(L[37],1014477480),new o(L[38],1206759142),new o(L[39],344077627),new o(L[40],1290863460),new o(L[41],3158454273),new o(L[42],3505952657),new o(L[43],106217008),new o(L[44],3606008344),new o(L[45],1432725776),new o(L[46],1467031594),new o(L[47],851169720),new o(L[48],3100823752),new o(L[49],1363258195),new o(L[50],3750685593),new o(L[51],3785050280),new o(L[52],3318307427),new o(L[53],3812723403),new o(L[54],2003034995),new o(L[55],3602036899),new o(L[56],1575990012),new o(L[57],1125592928),new o(L[58],2716904306),new o(L[59],442776044),new o(L[60],593698344),new o(L[61],3733110249),new o(L[62],2999351573),new o(L[63],3815920427),new o(3391569614,3928383900),new o(3515267271,566280711),new o(3940187606,3454069534),new o(4118630271,4000239992),new o(116418474,1914138554),new o(174292421,2731055270),new o(289380356,3203993006),new o(460393269,320620315),new o(685471733,587496836),new o(852142971,1086792851),new o(1017036298,365543100),new o(1126000580,2618297676),new o(1288033470,3409855158),new o(1501505948,4234509866),new o(1607167915,987167468),new o(1816402316,1246189591)],y=[new o(0,1),new o(0,32898),new o(2147483648,32906),new o(2147483648,2147516416),new o(0,32907),new o(0,2147483649),new o(2147483648,2147516545),new o(2147483648,32777),new o(0,138),new o(0,136),new o(0,2147516425),new o(0,2147483658),new o(0,2147516555),new o(2147483648,139),new o(2147483648,32905),new o(2147483648,32771),new o(2147483648,32770),new o(2147483648,128),new o(0,32778),new o(2147483648,2147483658),new o(2147483648,2147516545),new o(2147483648,32896),new o(0,2147483649),new o(2147483648,2147516424)],f=[[0,36,3,41,18],[1,44,10,45,2],[62,6,43,15,61],[28,55,25,21,56],[27,20,39,8,14]],(i=function(){return s}.call(a,r,a,e),!(i!==void 0&&(e.exports=i)))})(this)},function(e,t,a){'use strict';t.ApiError=a(1).ApiError,t.ResponseError=a(2).ResponseError,t.TimeoutError=a(3).TimeoutError},function(e,t,a){'use strict';const r=a(0);class i extends r.Request{constructor(e,t,a){super('PUT',`/users/${encodeURIComponent(e)}/merge/${encodeURIComponent(t)}`,3e4,!1),this.targetUserId=e,this.sourceUserId=t,a=a||{},this.cascadeCreate=a.cascadeCreate}bodyParameters(){let e={cascadeCreate:!(this.cascadeCreate!==void 0)||this.cascadeCreate};return e}}t.MergeUsers=i},function(e,t,a){'use strict';const r=a(0);class i extends r.Request{constructor(e,t,a){super('POST','/detailviews/',3e3,!1),this.userId=e,this.itemId=t,a=a||{},this.timestamp=a.timestamp,this.duration=a.duration,this.cascadeCreate=a.cascadeCreate,this.recommId=a.recommId,this.additionalData=a.additionalData}bodyParameters(){let e={};return e.userId=this.userId,e.itemId=this.itemId,void 0!==this.timestamp&&(e.timestamp=this.timestamp),void 0!==this.duration&&(e.duration=this.duration),void 0!==this.cascadeCreate&&(e.cascadeCreate=this.cascadeCreate),void 0!==this.recommId&&(e.recommId=this.recommId),void 0!==this.additionalData&&(e.additionalData=this.additionalData),e.cascadeCreate=void 0===this.cascadeCreate||this.cascadeCreate,e}}t.AddDetailView=i},function(e,t,a){'use strict';const r=a(0);class i extends r.Request{constructor(e,t,a){super('POST','/purchases/',3e3,!1),this.userId=e,this.itemId=t,a=a||{},this.timestamp=a.timestamp,this.cascadeCreate=a.cascadeCreate,this.amount=a.amount,this.price=a.price,this.profit=a.profit,this.recommId=a.recommId,this.additionalData=a.additionalData}bodyParameters(){let e={};return e.userId=this.userId,e.itemId=this.itemId,void 0!==this.timestamp&&(e.timestamp=this.timestamp),void 0!==this.cascadeCreate&&(e.cascadeCreate=this.cascadeCreate),void 0!==this.amount&&(e.amount=this.amount),void 0!==this.price&&(e.price=this.price),void 0!==this.profit&&(e.profit=this.profit),void 0!==this.recommId&&(e.recommId=this.recommId),void 0!==this.additionalData&&(e.additionalData=this.additionalData),e.cascadeCreate=void 0===this.cascadeCreate||this.cascadeCreate,e}}t.AddPurchase=i},function(e,t,a){'use strict';const r=a(0);class i extends r.Request{constructor(e,t,a,r){super('POST','/ratings/',3e3,!1),this.userId=e,this.itemId=t,this.rating=a,r=r||{},this.timestamp=r.timestamp,this.cascadeCreate=r.cascadeCreate,this.recommId=r.recommId,this.additionalData=r.additionalData}bodyParameters(){let e={};return e.userId=this.userId,e.itemId=this.itemId,e.rating=this.rating,void 0!==this.timestamp&&(e.timestamp=this.timestamp),void 0!==this.cascadeCreate&&(e.cascadeCreate=this.cascadeCreate),void 0!==this.recommId&&(e.recommId=this.recommId),void 0!==this.additionalData&&(e.additionalData=this.additionalData),e.cascadeCreate=void 0===this.cascadeCreate||this.cascadeCreate,e}}t.AddRating=i},function(e,t,a){'use strict';const r=a(0);class i extends r.Request{constructor(e,t,a){super('POST','/cartadditions/',3e3,!1),this.userId=e,this.itemId=t,a=a||{},this.timestamp=a.timestamp,this.cascadeCreate=a.cascadeCreate,this.amount=a.amount,this.price=a.price,this.recommId=a.recommId,this.additionalData=a.additionalData}bodyParameters(){let e={};return e.userId=this.userId,e.itemId=this.itemId,void 0!==this.timestamp&&(e.timestamp=this.timestamp),void 0!==this.cascadeCreate&&(e.cascadeCreate=this.cascadeCreate),void 0!==this.amount&&(e.amount=this.amount),void 0!==this.price&&(e.price=this.price),void 0!==this.recommId&&(e.recommId=this.recommId),void 0!==this.additionalData&&(e.additionalData=this.additionalData),e.cascadeCreate=void 0===this.cascadeCreate||this.cascadeCreate,e}}t.AddCartAddition=i},function(e,t,a){'use strict';const r=a(0);class i extends r.Request{constructor(e,t,a){super('POST','/bookmarks/',3e3,!1),this.userId=e,this.itemId=t,a=a||{},this.timestamp=a.timestamp,this.cascadeCreate=a.cascadeCreate,this.recommId=a.recommId,this.additionalData=a.additionalData}bodyParameters(){let e={};return e.userId=this.userId,e.itemId=this.itemId,void 0!==this.timestamp&&(e.timestamp=this.timestamp),void 0!==this.cascadeCreate&&(e.cascadeCreate=this.cascadeCreate),void 0!==this.recommId&&(e.recommId=this.recommId),void 0!==this.additionalData&&(e.additionalData=this.additionalData),e.cascadeCreate=void 0===this.cascadeCreate||this.cascadeCreate,e}}t.AddBookmark=i},function(e,t,a){'use strict';const r=a(0);class i extends r.Request{constructor(e,t,a,r){super('POST','/viewportions/',3e3,!1),this.userId=e,this.itemId=t,this.portion=a,r=r||{},this.sessionId=r.sessionId,this.timestamp=r.timestamp,this.cascadeCreate=r.cascadeCreate,this.recommId=r.recommId,this.additionalData=r.additionalData}bodyParameters(){let e={};return e.userId=this.userId,e.itemId=this.itemId,e.portion=this.portion,void 0!==this.sessionId&&(e.sessionId=this.sessionId),void 0!==this.timestamp&&(e.timestamp=this.timestamp),void 0!==this.cascadeCreate&&(e.cascadeCreate=this.cascadeCreate),void 0!==this.recommId&&(e.recommId=this.recommId),void 0!==this.additionalData&&(e.additionalData=this.additionalData),e.cascadeCreate=void 0===this.cascadeCreate||this.cascadeCreate,e}}t.SetViewPortion=i},function(e,t,a){'use strict';const r=a(0);class i extends r.Request{constructor(e,t,a){super('POST',`/recomms/users/${encodeURIComponent(e)}/items/`,9e3,!1),this.userId=e,this.count=t,a=a||{},this.filter=a.filter,this.booster=a.booster,this.cascadeCreate=a.cascadeCreate,this.scenario=a.scenario,this.logic=a.logic,this.returnProperties=a.returnProperties,this.includedProperties=a.includedProperties,this.diversity=a.diversity,this.minRelevance=a.minRelevance,this.rotationRate=a.rotationRate,this.rotationTime=a.rotationTime,this.expertSettings=a.expertSettings,this.returnAbGroup=a.returnAbGroup}bodyParameters(){let e={};return e.count=this.count,void 0!==this.filter&&(e.filter=this.filter),void 0!==this.booster&&(e.booster=this.booster),void 0!==this.cascadeCreate&&(e.cascadeCreate=this.cascadeCreate),void 0!==this.scenario&&(e.scenario=this.scenario),void 0!==this.logic&&(e.logic=this.logic),void 0!==this.returnProperties&&(e.returnProperties=this.returnProperties),void 0!==this.includedProperties&&(e.includedProperties=this.includedProperties),void 0!==this.diversity&&(e.diversity=this.diversity),void 0!==this.minRelevance&&(e.minRelevance=this.minRelevance),void 0!==this.rotationRate&&(e.rotationRate=this.rotationRate),void 0!==this.rotationTime&&(e.rotationTime=this.rotationTime),void 0!==this.expertSettings&&(e.expertSettings=this.expertSettings),void 0!==this.returnAbGroup&&(e.returnAbGroup=this.returnAbGroup),e.cascadeCreate=void 0===this.cascadeCreate||this.cascadeCreate,e}}t.RecommendItemsToUser=i},function(e,t,a){'use strict';const r=a(0);class i extends r.Request{constructor(e,t,a,r){super('POST',`/recomms/items/${encodeURIComponent(e)}/items/`,9e3,!1),this.itemId=e,this.targetUserId=t,this.count=a,r=r||{},this.filter=r.filter,this.booster=r.booster,this.cascadeCreate=r.cascadeCreate,this.scenario=r.scenario,this.logic=r.logic,this.returnProperties=r.returnProperties,this.includedProperties=r.includedProperties,this.userImpact=r.userImpact,this.diversity=r.diversity,this.minRelevance=r.minRelevance,this.rotationRate=r.rotationRate,this.rotationTime=r.rotationTime,this.expertSettings=r.expertSettings,this.returnAbGroup=r.returnAbGroup}bodyParameters(){let e={};return e.targetUserId=this.targetUserId,e.count=this.count,void 0!==this.filter&&(e.filter=this.filter),void 0!==this.booster&&(e.booster=this.booster),void 0!==this.cascadeCreate&&(e.cascadeCreate=this.cascadeCreate),void 0!==this.scenario&&(e.scenario=this.scenario),void 0!==this.logic&&(e.logic=this.logic),void 0!==this.returnProperties&&(e.returnProperties=this.returnProperties),void 0!==this.includedProperties&&(e.includedProperties=this.includedProperties),void 0!==this.userImpact&&(e.userImpact=this.userImpact),void 0!==this.diversity&&(e.diversity=this.diversity),void 0!==this.minRelevance&&(e.minRelevance=this.minRelevance),void 0!==this.rotationRate&&(e.rotationRate=this.rotationRate),void 0!==this.rotationTime&&(e.rotationTime=this.rotationTime),void 0!==this.expertSettings&&(e.expertSettings=this.expertSettings),void 0!==this.returnAbGroup&&(e.returnAbGroup=this.returnAbGroup),e.cascadeCreate=void 0===this.cascadeCreate||this.cascadeCreate,e}}t.RecommendItemsToItem=i}])}); //# sourceMappingURL=recombee-api-client.min.js.map