Comparing version 0.13.5 to 0.13.6
{ | ||
"name": "sajari", | ||
"version": "0.13.5", | ||
"version": "0.13.6", | ||
"description": "JavaScript SDK for the Sajari search API", | ||
@@ -41,3 +41,3 @@ "scripts": { | ||
"dependencies": { | ||
"js-cookie": "2.1.3" | ||
"sajari-website": "^0.7.4" | ||
}, | ||
@@ -44,0 +44,0 @@ "devDependencies": { |
@@ -22,3 +22,3 @@ # Sajari Javascript SDK | ||
`sajari` is 3KB gzipped. | ||
`sajari` is 11KB gzipped. | ||
@@ -25,0 +25,0 @@ ### NPM, Browserify, webpack |
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){return{text:e,weight:t||1}}function o(e,t,n){return[e,{metric:{field:t,type:n}}]}function u(e,t){return[e,{count:{field:t}}]}function s(e,t){return{name:e,filter:t}}function a(e,t){return[e,{bucket:{buckets:t}}]}function c(e){return e instanceof Array?{repeated:{values:e.map(String)}}:null===e?value={null:!0}:{single:String(e)}}function l(e){switch(e){case"=":return"EQUAL_TO";case"!=":return"NOT_EQUAL_TO";case">":return"GREATER_THAN";case">=":return"GREATER_THAN_OR_EQUAL_TO";case"<":return"LESS_THAN";case"<=":return"LESS_THAN_OR_EQUAL_TO";case"~":return"CONTAINS";case"!~":return"DOES_NOT_CONTAIN";case"^":return"HAS_PREFIX";case"$":return"HAS_SUFFIX";default:throw"invalid operator: "+e}}function f(e,t,n){return{field:{field:e,value:c(n),operator:l(t)}}}function d(e,t,n,r,i,o){return{geo:{field_lat:e,field_lng:t,lat:n,lng:r,radius:i,region:o}}}function h(e,t){return{combinator:{filters:e,operator:t}}}function _(e){return h(e,"ALL")}function v(e){return h(e,"ANY")}function p(e){return h(e,"ONE")}function g(e){return h(e,"NONE")}function y(e,t){return{field:{field:e,value:t}}}function E(e,t){return{score:{threshold:e,minCount:t}}}function k(e,t){return{filter:{filter:e,value:t}}}function I(e,t){return{point:e,value:t}}function O(e,t){return{interval:{field:e,points:t}}}function T(e,t){return{element:{field:e,elts:t}}}function m(e,t){return{text:{field:e,text:t}}}function S(e,t){return{field_boost:e,value:t}}function A(e){return"-"===e[0]?{field:e.slice(1),order:"DESC"}:{field:e,order:"ASC"}}function C(e){return{identifier:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Query=t.FeatureQuery=t.IndexQuery=t.GEO_FIELD_BOOST_REGION_OUTSIDE=t.GEO_FIELD_BOOST_REGION_INSIDE=t.METRIC_TYPE_SUM=t.METRIC_TYPE_AVG=t.METRIC_TYPE_MIN=t.METRIC_TYPE_MAX=t.Client=void 0;var N=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();/** | ||
module.exports=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="/",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){return{text:t,weight:e||1}}function u(t,e,r){return[t,{metric:{field:e,type:r}}]}function a(t,e){return[t,{count:{field:e}}]}function s(t,e){return{name:t,filter:e}}function f(t,e){return[t,{bucket:{buckets:e}}]}function h(t){return t instanceof Array?{repeated:{values:t.map(String)}}:null===t?value={null:!0}:{single:String(t)}}function c(t){switch(t){case"=":return"EQUAL_TO";case"!=":return"NOT_EQUAL_TO";case">":return"GREATER_THAN";case">=":return"GREATER_THAN_OR_EQUAL_TO";case"<":return"LESS_THAN";case"<=":return"LESS_THAN_OR_EQUAL_TO";case"~":return"CONTAINS";case"!~":return"DOES_NOT_CONTAIN";case"^":return"HAS_PREFIX";case"$":return"HAS_SUFFIX";default:throw"invalid operator: "+t}}function l(t,e,r){return{field:{field:t,value:h(r),operator:c(e)}}}function p(t,e,r,n,i,o){return{geo:{field_lat:t,field_lng:e,lat:r,lng:n,radius:i,region:o}}}function g(t,e){return{combinator:{filters:t,operator:e}}}function d(t){return g(t,"ALL")}function y(t){return g(t,"ANY")}function v(t){return g(t,"ONE")}function w(t){return g(t,"NONE")}function m(t,e){return{field:{field:t,value:e}}}function A(t,e){return{score:{threshold:t,minCount:e}}}function E(t,e){return{filter:{filter:t,value:e}}}function _(t,e){return{point:t,value:e}}function b(t,e){return{interval:{field:t,points:e}}}function R(t,e){return{element:{field:t,elts:e}}}function S(t,e){return{text:{field:t,text:e}}}function I(t,e){return{field_boost:t,value:e}}function T(t){return"-"===t[0]?{field:t.slice(1),order:"DESC"}:{field:t,order:"ASC"}}function B(t){return{identifier:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.Query=e.FeatureQuery=e.IndexQuery=e.GEO_FIELD_BOOST_REGION_OUTSIDE=e.GEO_FIELD_BOOST_REGION_INSIDE=e.METRIC_TYPE_SUM=e.METRIC_TYPE_AVG=e.METRIC_TYPE_MIN=e.METRIC_TYPE_MAX=e.Client=void 0;var P=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();/** | ||
* @fileOverview Exports the Sajari javascript api. | ||
@@ -8,2 +8,15 @@ * @name sajari.js | ||
*/ | ||
t.body=i,t.metricAggregate=o,t.countAggregate=u,t.bucket=s,t.bucketAggregate=a,t.fieldFilter=f,t.geoFilter=d,t.allFilters=_,t.anyFilters=v,t.oneOfFilters=p,t.noneOfFilters=g,t.fieldInstanceBoost=y,t.scoreInstanceBoost=E,t.filterFieldBoost=k,t.pointValue=I,t.intervalFieldBoost=O,t.elementFieldBoost=T,t.textFieldBoost=m,t.featureFieldBoost=S,t.sort=A,t.transform=C;var R=n(1),x=(t.Client=function(){function e(t,n,i){r(this,e),this.p=t,this.c=n,this.a=i||"https://jsonapi.sajari.com"}return N(e,[{key:"search",value:function(e,t){return fetch(this.a+"/sajari.api.query.v1.Query/Search",{method:"POST",body:JSON.stringify({request:{searchRequest:e.q,tracking:{type:e.generate_tokens,field:e.token_key_field,sequence:e.s++,query_id:e.i,data:e.data}},metadata:{project:[this.p],collection:[this.c]}})}).then(function(e){e.ok?e.json().then(function(e){var n=e.searchResponse.results;if(n)for(var r=0;r<n.length;r++){for(var i in n[r].values)n[r].values[i]=void 0!==n[r].values[i].single?n[r].values[i].single:n[r].values[i].repeated.values;e.tokens&&(n[r].tokens=e.tokens[r])}else e.searchResponse={results:[],time:e.searchResponse.time,totalResults:"0",reads:"0"};t(null,e)}):e.text().then(function(e){return t(e,null)})}).catch(function(e){return t("Error during fetch: "+e.message,null)})}}]),e}(),t.METRIC_TYPE_MAX="MAX",t.METRIC_TYPE_MIN="MIN",t.METRIC_TYPE_AVG="AVG",t.METRIC_TYPE_SUM="SUM",t.GEO_FIELD_BOOST_REGION_INSIDE="INSIDE",t.GEO_FIELD_BOOST_REGION_OUTSIDE="OUTSIDE",t.IndexQuery=function(){function e(){r(this,e)}return N(e,[{key:"body",value:function(e){this.body=e}},{key:"instanceBoosts",value:function(e){this.instance_boosts=e}},{key:"fieldBoosts",value:function(e){this.field_boosts=e}}]),e}(),t.FeatureQuery=function(){function e(){r(this,e)}return N(e,[{key:"fieldBoosts",value:function(e){this.field_boosts=e}}]),e}(),function(){function e(){r(this,e),this.resetID(),this.q={limit:10},this.data={};var t=(0,R.getGAID)();t&&this.tracking("gaID",t)}return N(e,[{key:"filter",value:function(e){this.q.filter=e}},{key:"indexQuery",value:function(e){this.q.index_query=e}},{key:"featureQuery",value:function(e){this.q.feature_query=e}},{key:"offset",value:function(e){this.q.offset=e}},{key:"limit",value:function(e){this.q.limit=e}},{key:"fields",value:function(e){this.q.fields=e}},{key:"sort",value:function(e){this.q.sort=e}},{key:"aggregates",value:function(e){for(var t={},n=0;n<e.length;n++)t[e[n][0]]=e[n][1];this.q.aggregates=t}},{key:"transforms",value:function(e){this.q.transforms=e}},{key:"resetID",value:function(){this.i="",this.s=0;for(var e=0;e<16;e++)this.i+="abcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(36*Math.random()))}},{key:"posNegTracking",value:function(e){this.generate_tokens="POS_NEG",this.token_key_field=e}},{key:"clickTracking",value:function(e){this.generate_tokens="CLICK",this.token_key_field=e}},{key:"tracking",value:function(e,t){this.data[e]=t}}]),e}());t.Query=x},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e="",t=u.default.get("_ga");if(void 0!==t){var n=t.split(".");n.length>2&&(e=n[2])}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.getGAID=i;var o=n(2),u=r(o)},function(e,t,n){var r,i;!function(o){var u=!1;if(r=o,i="function"==typeof r?r.call(t,n,t,e):r,!(void 0!==i&&(e.exports=i)),u=!0,e.exports=o(),u=!0,!u){var s=window.Cookies,a=window.Cookies=o();a.noConflict=function(){return window.Cookies=s,a}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(n){function r(t,i,o){var u;if("undefined"!=typeof document){if(arguments.length>1){if(o=e({path:"/"},r.defaults,o),"number"==typeof o.expires){var s=new Date;s.setMilliseconds(s.getMilliseconds()+864e5*o.expires),o.expires=s}try{u=JSON.stringify(i),/^[\{\[]/.test(u)&&(i=u)}catch(e){}return i=n.write?n.write(i,t):encodeURIComponent(String(i)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)),t=t.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),t=t.replace(/[\(\)]/g,escape),document.cookie=[t,"=",i,o.expires?"; expires="+o.expires.toUTCString():"",o.path?"; path="+o.path:"",o.domain?"; domain="+o.domain:"",o.secure?"; secure":""].join("")}t||(u={});for(var a=document.cookie?document.cookie.split("; "):[],c=/(%[0-9A-Z]{2})+/g,l=0;l<a.length;l++){var f=a[l].split("="),d=f.slice(1).join("=");'"'===d.charAt(0)&&(d=d.slice(1,-1));try{var h=f[0].replace(c,decodeURIComponent);if(d=n.read?n.read(d,h):n(d,h)||d.replace(c,decodeURIComponent),this.json)try{d=JSON.parse(d)}catch(e){}if(t===h){u=d;break}t||(u[h]=d)}catch(e){}}return u}}return r.set=r,r.get=function(e){return r.call(r,e)},r.getJSON=function(){return r.apply({json:!0},[].slice.call(arguments))},r.defaults={},r.remove=function(t,n){r(t,"",e(n,{expires:-1}))},r.withConverter=t,r}return t(function(){})})}]); | ||
e.body=o,e.metricAggregate=u,e.countAggregate=a,e.bucket=s,e.bucketAggregate=f,e.fieldFilter=l,e.geoFilter=p,e.allFilters=d,e.anyFilters=y,e.oneOfFilters=v,e.noneOfFilters=w,e.fieldInstanceBoost=m,e.scoreInstanceBoost=A,e.filterFieldBoost=E,e.pointValue=_,e.intervalFieldBoost=b,e.elementFieldBoost=R,e.textFieldBoost=S,e.featureFieldBoost=I,e.sort=T,e.transform=B;var C=r(6),O=n(C),U=(e.Client=function(){function t(e,r,n){i(this,t),this.p=e,this.c=r,this.a=n||"https://jsonapi.sajari.com"}return P(t,[{key:"search",value:function(t,e){return fetch(this.a+"/sajari.api.query.v1.Query/Search",{method:"POST",body:JSON.stringify({request:{searchRequest:t.q,tracking:{type:t.generate_tokens,field:t.token_key_field,sequence:t.s++,query_id:t.i,data:t.data}},metadata:{project:[this.p],collection:[this.c],"user-agent":["sajari-sdk-js 0.13.6"]}})}).then(function(t){t.ok?t.json().then(function(t){var r=t.searchResponse.results;if(r)for(var n=0;n<r.length;n++){for(var i in r[n].values)r[n].values[i]=void 0!==r[n].values[i].single?r[n].values[i].single:r[n].values[i].repeated.values;t.tokens&&(r[n].tokens=t.tokens[n])}else t.searchResponse={results:[],time:t.searchResponse.time,totalResults:"0",reads:"0"};e(null,t)}):t.text().then(function(t){return e(t,null)})}).catch(function(t){return e("Error during fetch: "+t.message,null)})}}]),t}(),e.METRIC_TYPE_MAX="MAX",e.METRIC_TYPE_MIN="MIN",e.METRIC_TYPE_AVG="AVG",e.METRIC_TYPE_SUM="SUM",e.GEO_FIELD_BOOST_REGION_INSIDE="INSIDE",e.GEO_FIELD_BOOST_REGION_OUTSIDE="OUTSIDE",e.IndexQuery=function(){function t(){i(this,t)}return P(t,[{key:"body",value:function(t){this.body=t}},{key:"instanceBoosts",value:function(t){this.instance_boosts=t}},{key:"fieldBoosts",value:function(t){this.field_boosts=t}}]),t}(),e.FeatureQuery=function(){function t(){i(this,t)}return P(t,[{key:"fieldBoosts",value:function(t){this.field_boosts=t}}]),t}(),function(){function t(){i(this,t),this.resetID(),this.q={limit:10},this.data={};var e=new O.default,r=e.gaId,n=e.visitorId;r&&this.tracking("gaID",r),n&&this.tracking("sjID",n)}return P(t,[{key:"filter",value:function(t){this.q.filter=t}},{key:"indexQuery",value:function(t){this.q.index_query=t}},{key:"featureQuery",value:function(t){this.q.feature_query=t}},{key:"offset",value:function(t){this.q.offset=t}},{key:"limit",value:function(t){this.q.limit=t}},{key:"fields",value:function(t){this.q.fields=t}},{key:"sort",value:function(t){this.q.sort=t}},{key:"aggregates",value:function(t){for(var e={},r=0;r<t.length;r++)e[t[r][0]]=t[r][1];this.q.aggregates=e}},{key:"transforms",value:function(t){this.q.transforms=t}},{key:"resetID",value:function(){this.i="",this.s=0;for(var t=0;t<16;t++)this.i+="abcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(36*Math.random()))}},{key:"posNegTracking",value:function(t){this.generate_tokens="POS_NEG",this.token_key_field=t}},{key:"clickTracking",value:function(t){this.generate_tokens="CLICK",this.token_key_field=t}},{key:"tracking",value:function(t,e){this.data[t]=e}}]),t}());e.Query=U},function(t,e,r){(function(t,n){/*! | ||
* The buffer module from node.js, for the browser. | ||
* | ||
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> | ||
* @license MIT | ||
*/ | ||
"use strict";function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function o(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,r){if(o()<r)throw new RangeError("Invalid typed array length");return t.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(r),e.__proto__=t.prototype):(null===e&&(e=new t(r)),e.length=r),e}function t(e,r,n){if(!(t.TYPED_ARRAY_SUPPORT||this instanceof t))return new t(e,r,n);if("number"==typeof e){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return a(this,e,r,n)}function a(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?p(t,e,r,n):"string"==typeof e?c(t,e,r):g(t,e)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e,r,n){return s(e),e<=0?u(t,e):void 0!==r?"string"==typeof n?u(t,e).fill(r,n):u(t,e).fill(r):u(t,e)}function h(e,r){if(s(r),e=u(e,r<0?0:0|d(r)),!t.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)e[n]=0;return e}function c(e,r,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|v(r,n);e=u(e,i);var o=e.write(r,n);return o!==i&&(e=e.slice(0,o)),e}function l(t,e){var r=e.length<0?0:0|d(e.length);t=u(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(e,r,n,i){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");return r=void 0===n&&void 0===i?new Uint8Array(r):void 0===i?new Uint8Array(r,n):new Uint8Array(r,n,i),t.TYPED_ARRAY_SUPPORT?(e=r,e.__proto__=t.prototype):e=l(e,r),e}function g(e,r){if(t.isBuffer(r)){var n=0|d(r.length);return e=u(e,n),0===e.length?e:(r.copy(e,0,0,n),e)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||Z(r.length)?u(e,0):l(e,r);if("Buffer"===r.type&&$(r.data))return l(e,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function d(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function y(e){return+e!=e&&(e=0),t.alloc(+e)}function v(e,r){if(t.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(e).length;default:if(i)return z(e).length;r=(""+r).toLowerCase(),i=!0}}function w(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return P(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function A(e,r,n,i,o){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof r&&(r=t.from(r,i)),t.isBuffer(r))return 0===r.length?-1:E(e,r,n,i,o);if("number"==typeof r)return r&=255,t.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):E(e,[r],n,i,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,i){function o(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}var u=1,a=t.length,s=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,a/=2,s/=2,r/=2}var f;if(i){var h=-1;for(f=r;f<a;f++)if(o(t,f)===o(e,h===-1?0:f-h)){if(h===-1&&(h=f),f-h+1===s)return h*u}else h!==-1&&(f-=f-h),h=-1}else for(r+s>a&&(r=a-s),f=r;f>=0;f--){for(var c=!0,l=0;l<s;l++)if(o(t,f+l)!==o(e,l)){c=!1;break}if(c)return f}return-1}function _(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u<n;++u){var a=parseInt(e.substr(2*u,2),16);if(isNaN(a))return u;t[r+u]=a}return u}function b(t,e,r,n){return H(z(e,t.length-r),t,r,n)}function R(t,e,r,n){return H(J(e),t,r,n)}function S(t,e,r,n){return R(t,e,r,n)}function I(t,e,r,n){return H(X(e),t,r,n)}function T(t,e,r,n){return H(V(e,t.length-r),t,r,n)}function B(t,e,r){return 0===e&&r===t.length?K.fromByteArray(t):K.fromByteArray(t.slice(e,r))}function P(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],u=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){var s,f,h,c;switch(a){case 1:o<128&&(u=o);break;case 2:s=t[i+1],128===(192&s)&&(c=(31&o)<<6|63&s,c>127&&(u=c));break;case 3:s=t[i+1],f=t[i+2],128===(192&s)&&128===(192&f)&&(c=(15&o)<<12|(63&s)<<6|63&f,c>2047&&(c<55296||c>57343)&&(u=c));break;case 4:s=t[i+1],f=t[i+2],h=t[i+3],128===(192&s)&&128===(192&f)&&128===(192&h)&&(c=(15&o)<<18|(63&s)<<12|(63&f)<<6|63&h,c>65535&&c<1114112&&(u=c))}}null===u?(u=65533,a=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=a}return C(n)}function C(t){var e=t.length;if(e<=tt)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=tt));return r}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function k(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Q(t[o]);return i}function x(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function M(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function Y(e,r,n,i,o,u){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<u)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function D(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function N(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function L(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,i){return i||L(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,i){return i||L(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function q(t){if(t=G(t).replace(et,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function G(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Q(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],u=0;u<n;++u){if(r=t.charCodeAt(u),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function J(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function V(t,e){for(var r,n,i,o=[],u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function X(t){return K.toByteArray(q(t))}function H(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Z(t){return t!==t}var K=r(2),W=r(3),$=r(4);e.Buffer=t,e.SlowBuffer=y,e.INSPECT_MAX_BYTES=50,t.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:i(),e.kMaxLength=o(),t.poolSize=8192,t._augment=function(e){return e.__proto__=t.prototype,e},t.from=function(t,e,r){return a(null,t,e,r)},t.TYPED_ARRAY_SUPPORT&&(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0})),t.alloc=function(t,e,r){return f(null,t,e,r)},t.allocUnsafe=function(t){return h(null,t)},t.allocUnsafeSlow=function(t){return h(null,t)},t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,o=0,u=Math.min(n,i);o<u;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0},t.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,r){if(!$(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return t.alloc(0);var n;if(void 0===r)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var i=t.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){var u=e[n];if(!t.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(i,o),o+=u.length}return i},t.byteLength=v,t.prototype._isBuffer=!0,t.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},t.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},t.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},t.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?P(this,0,t):w.apply(this,arguments)},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},t.prototype.compare=function(e,r,n,i,o){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var u=o-i,a=n-r,s=Math.min(u,a),f=this.slice(i,o),h=e.slice(r,n),c=0;c<s;++c)if(f[c]!==h[c]){u=f[c],a=h[c];break}return u<a?-1:a<u?1:0},t.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1},t.prototype.indexOf=function(t,e,r){return A(this,t,e,r,!0)},t.prototype.lastIndexOf=function(t,e,r){return A(this,t,e,r,!1)},t.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return R(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return I(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var i;if(t.TYPED_ARRAY_SUPPORT)i=this.subarray(e,r),i.__proto__=t.prototype;else{var o=r-e;i=new t(o,void 0);for(var u=0;u<o;++u)i[u]=this[u+e]}return i},t.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||M(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},t.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||M(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},t.prototype.readUInt8=function(t,e){return e||M(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||M(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||M(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||M(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||M(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},t.prototype.readInt8=function(t,e){return e||M(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,e){e||M(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){e||M(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return e||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||M(t,4,this.length),W.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||M(t,4,this.length),W.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||M(t,8,this.length),W.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||M(t,8,this.length),W.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;Y(this,t,e,r,i,0)}var o=1,u=0;for(this[e]=255&t;++u<r&&(o*=256);)this[e+u]=t/o&255;return e+r},t.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var i=Math.pow(2,8*r)-1;Y(this,t,e,r,i,0)}var o=r-1,u=1;for(this[e+o]=255&t;--o>=0&&(u*=256);)this[e+o]=t/u&255;return e+r},t.prototype.writeUInt8=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},t.prototype.writeUInt16LE=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):D(this,e,r,!0),r+2},t.prototype.writeUInt16BE=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):D(this,e,r,!1),r+2},t.prototype.writeUInt32LE=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):N(this,e,r,!0),r+4},t.prototype.writeUInt32BE=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):N(this,e,r,!1),r+4},t.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);Y(this,t,e,r,i-1,-i)}var o=0,u=1,a=0;for(this[e]=255&t;++o<r&&(u*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/u>>0)-a&255;return e+r},t.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);Y(this,t,e,r,i-1,-i)}var o=r-1,u=1,a=0;for(this[e+o]=255&t;--o>=0&&(u*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/u>>0)-a&255;return e+r},t.prototype.writeInt8=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=255&e,r+1},t.prototype.writeInt16LE=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):D(this,e,r,!0),r+2},t.prototype.writeInt16BE=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):D(this,e,r,!1),r+2},t.prototype.writeInt32LE=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):N(this,e,r,!0),r+4},t.prototype.writeInt32BE=function(e,r,n){return e=+e,r|=0,n||Y(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):N(this,e,r,!1),r+4},t.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},t.prototype.copy=function(e,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);var o,u=i-n;if(this===e&&n<r&&r<i)for(o=u-1;o>=0;--o)e[o+r]=this[o+n];else if(u<1e3||!t.TYPED_ARRAY_SUPPORT)for(o=0;o<u;++o)e[o+r]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+u),r);return u},t.prototype.fill=function(e,r,n,i){if("string"==typeof e){if("string"==typeof r?(i=r,r=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var u;if("number"==typeof e)for(u=r;u<n;++u)this[u]=e;else{var a=t.isBuffer(e)?e:z(new t(e,i).toString()),s=a.length;for(u=0;u<n-r;++u)this[u+r]=a[u%s]}return this};var et=/[^+\/0-9A-Za-z-_]/g}).call(e,r(1).Buffer,function(){return this}())},function(t,e){"use strict";function r(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function n(t){return 3*t.length/4-r(t)}function i(t){var e,n,i,o,u,a,s=t.length;u=r(t),a=new h(3*s/4-u),i=u>0?s-4:s;var c=0;for(e=0,n=0;e<i;e+=4,n+=3)o=f[t.charCodeAt(e)]<<18|f[t.charCodeAt(e+1)]<<12|f[t.charCodeAt(e+2)]<<6|f[t.charCodeAt(e+3)],a[c++]=o>>16&255,a[c++]=o>>8&255,a[c++]=255&o;return 2===u?(o=f[t.charCodeAt(e)]<<2|f[t.charCodeAt(e+1)]>>4,a[c++]=255&o):1===u&&(o=f[t.charCodeAt(e)]<<10|f[t.charCodeAt(e+1)]<<4|f[t.charCodeAt(e+2)]>>2,a[c++]=o>>8&255,a[c++]=255&o),a}function o(t){return s[t>>18&63]+s[t>>12&63]+s[t>>6&63]+s[63&t]}function u(t,e,r){for(var n,i=[],u=e;u<r;u+=3)n=(t[u]<<16)+(t[u+1]<<8)+t[u+2],i.push(o(n));return i.join("")}function a(t){for(var e,r=t.length,n=r%3,i="",o=[],a=16383,f=0,h=r-n;f<h;f+=a)o.push(u(t,f,f+a>h?h:f+a));return 1===n?(e=t[r-1],i+=s[e>>2],i+=s[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=s[e>>10],i+=s[e>>4&63],i+=s[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=n,e.toByteArray=i,e.fromByteArray=a;for(var s=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=c.length;l<p;++l)s[l]=c[l],f[c.charCodeAt(l)]=l;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,u,a=8*i-n-1,s=(1<<a)-1,f=s>>1,h=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=l,h-=8);for(u=o&(1<<-h)-1,o>>=-h,h+=n;h>0;u=256*u+t[e+c],c+=l,h-=8);if(0===o)o=1-f;else{if(o===s)return u?NaN:(p?-1:1)*(1/0);u+=Math.pow(2,n),o-=f}return(p?-1:1)*u*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var u,a,s,f=8*o-i-1,h=(1<<f)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,g=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,u=h):(u=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-u))<1&&(u--,s*=2),e+=u+c>=1?l/s:l*Math.pow(2,1-c),e*s>=2&&(u++,s/=2),u+c>=h?(a=0,u=h):u+c>=1?(a=(e*s-1)*Math.pow(2,i),u+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),u=0));i>=8;t[r+p]=255&a,p+=g,a/=256,i-=8);for(u=u<<i|a,f+=i;f>0;t[r+p]=255&u,p+=g,u/=256,f-=8);t[r+p-g]|=128*d}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){!function(e){"use strict";var n,i=e.Base64,o="2.1.9";if("undefined"!=typeof t&&t.exports)try{n=r(1).Buffer}catch(t){}var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=function(t){for(var e={},r=0,n=t.length;r<n;r++)e[t.charAt(r)]=r;return e}(u),s=String.fromCharCode,f=function(t){if(t.length<2){var e=t.charCodeAt(0);return e<128?t:e<2048?s(192|e>>>6)+s(128|63&e):s(224|e>>>12&15)+s(128|e>>>6&63)+s(128|63&e)}var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return s(240|e>>>18&7)+s(128|e>>>12&63)+s(128|e>>>6&63)+s(128|63&e)},h=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,c=function(t){return t.replace(h,f)},l=function(t){var e=[0,2,1][t.length%3],r=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0),n=[u.charAt(r>>>18),u.charAt(r>>>12&63),e>=2?"=":u.charAt(r>>>6&63),e>=1?"=":u.charAt(63&r)];return n.join("")},p=e.btoa?function(t){return e.btoa(t)}:function(t){return t.replace(/[\s\S]{1,3}/g,l)},g=n?function(t){return(t.constructor===n.constructor?t:new n(t)).toString("base64")}:function(t){return p(c(t))},d=function(t,e){return e?g(String(t)).replace(/[+\/]/g,function(t){return"+"==t?"-":"_"}).replace(/=/g,""):g(String(t))},y=function(t){return d(t,!0)},v=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),w=function(t){switch(t.length){case 4:var e=(7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3),r=e-65536;return s((r>>>10)+55296)+s((1023&r)+56320);case 3:return s((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return s((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},m=function(t){return t.replace(v,w)},A=function(t){var e=t.length,r=e%4,n=(e>0?a[t.charAt(0)]<<18:0)|(e>1?a[t.charAt(1)]<<12:0)|(e>2?a[t.charAt(2)]<<6:0)|(e>3?a[t.charAt(3)]:0),i=[s(n>>>16),s(n>>>8&255),s(255&n)];return i.length-=[0,0,2,1][r],i.join("")},E=e.atob?function(t){return e.atob(t)}:function(t){return t.replace(/[\s\S]{1,4}/g,A)},_=n?function(t){return(t.constructor===n.constructor?t:new n(t,"base64")).toString()}:function(t){return m(E(t))},b=function(t){return _(String(t).replace(/[-_]/g,function(t){return"-"==t?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},R=function(){var t=e.Base64;return e.Base64=i,t};if(e.Base64={VERSION:o,atob:E,btoa:p,fromBase64:b,toBase64:d,utob:c,encode:d,encodeURI:y,btou:m,decode:b,noConflict:R},"function"==typeof Object.defineProperty){var S=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}};e.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",S(function(){return b(this)})),Object.defineProperty(String.prototype,"toBase64",S(function(t){return d(this,t)})),Object.defineProperty(String.prototype,"toBase64URI",S(function(){return d(this,!0)}))}}e.Meteor&&(Base64=e.Base64)}(this)},function(t,e,r){function n(t){t=t||{};for(var e in t)this[e]=t[e];void 0===t.data&&(this.data={meta:{},weighted:[]}),void 0===this.data.meta&&(this.data.meta={}),void 0===this.data.weighted&&(this.data.weighted=[]),this.gaId=i(),void 0===this.visitorId&&(this.visitorId=c.get(y.cname),void 0===this.visitorId&&(this.visitorId=(new Date).getTime()+"."+Math.floor(1e6*Math.random()))),this.sequence=o(),this.load()}function i(){var t="",e=c.get("_ga");if(void 0!==e){var r=e.split(".");r.length>2&&(t=r[2])}return t}function o(){var t=c.get(y.sname);return void 0===t&&(t=0),t++,c.set(y.sname,t,{path:"/",domain:y.domain}),t}function u(t,e){if("undefined"!=typeof Storage){var r=g.encode(e);return localStorage.setItem(t,r),!0}}function a(t){if("undefined"!=typeof Storage){var e=localStorage.getItem(t);if(e)return g.decode(e)}}function s(t,e){if("undefined"!=typeof Storage){var r=g.encode(e);return sessionStorage.setItem(t,r),!0}}function f(t){if("undefined"!=typeof Storage){var e=sessionStorage.getItem(t);if(e)return g.decode(e)}}function h(t){if("undefined"!=typeof Storage){var e=sessionStorage.getItem(t);if(e)return JSON.parse(e)}}var c=r(7),l=r(8),p=r(9),g=new l,d=r(10),y={cname:"sjID",pname:"sjPR",ename:"sjPE",sname:"sjSE",clicked:"sjCL",expires:365,maxStrings:10,maxURLs:10,weight:.05,session:!1,domain:window.location.hostname.toLowerCase().replace(/^www(.)/,"")};n.prototype={load:function(){var t=h(y.pname);t&&(this.data.meta=t,this.save());var e;return y.session?(e=f(y.ename),void(e&&(this.data=e))):(e=a(y.ename),void(e&&(this.data=e)))},save:function(){return y.session?void s(y.ename,this.data):void u(y.ename,this.data)},option:function(t,e){t&&e&&(y[t]=e)},set:function(t,e){if(e){for(var r in e)this.data.meta[r]=e[r];this.save()}t&&(this.data.weighted.push(t),this.data.weighted=p(this.data.weighted),this.data.weighted.length>this.maxStrings&&this.data.weighted.shift(),this.save())},get:function(){return this.data},addClickedUrl:function(t){var e=t.split("?"),r=f(y.clicked);r||(r=[]);for(var n=0;n<r.length;n++)if(r[n]===e[0])return;r.push(e[0]),r.length>this.maxURLs&&r.shift(),s(y.clicked,r)},getClickedUrls:function(t){var e=f(y.clicked);return e?e.slice(Math.max(e.length-t,1)):[]},toArgs:function(t){void 0===t&&(t={});for(var e in this.data.meta){var r=this.data.meta[e];d(r)?r=r.join(";"):"object"==typeof r&&(r=JSON.stringify(r)),t["meta["+e+"]"]=r}for(var n=this.data.weighted.length,i=0;i<n;i++){var o=((i+1)/(n/.05)).toFixed(4);t["q["+o+"]"]=this.data.weighted[i]}return t.mimetype="text/plain+weighted",t},setVisitorId:function(t){return void 0!==t&&(this.visitorId=t+"",c.set(y.cname,this.visitorId,{path:"/",expires:y.expires,domain:y.domain})),this.visitorId}},t.exports=n},function(t,e){/*! | ||
* JavaScript Cookie v2.1.0 | ||
* https://github.com/js-cookie/js-cookie | ||
* | ||
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack | ||
* Released under the MIT license | ||
*/ | ||
function r(){for(var t=0,e={};t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}function n(t){function e(n,i,o){var u;if(arguments.length>1){if(o=r({path:"/"},e.defaults,o),"number"==typeof o.expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*o.expires),o.expires=a}try{u=JSON.stringify(i),/^[\{\[]/.test(u)&&(i=u)}catch(t){}return i=t.write?t.write(i,n):encodeURIComponent(String(i)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=encodeURIComponent(String(n)),n=n.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),n=n.replace(/[\(\)]/g,escape),document.cookie=[n,"=",i,o.expires&&"; expires="+o.expires.toUTCString(),o.path&&"; path="+o.path,o.domain&&"; domain="+o.domain,o.secure?"; secure":""].join("")}n||(u={});for(var s=document.cookie?document.cookie.split("; "):[],f=/(%[0-9A-Z]{2})+/g,h=0;h<s.length;h++){var c=s[h].split("="),l=c[0].replace(f,decodeURIComponent),p=c.slice(1).join("=");'"'===p.charAt(0)&&(p=p.slice(1,-1));try{if(p=t.read?t.read(p,l):t(p,l)||p.replace(f,decodeURIComponent),this.json)try{p=JSON.parse(p)}catch(t){}if(n===l){u=p;break}n||(u[l]=p)}catch(t){}}return u}return e.get=e.set=e,e.getJSON=function(){return e.apply({json:!0},[].slice.call(arguments))},e.defaults={},e.remove=function(t,n){e(t,"",r(n,{expires:-1}))},e.withConverter=n,e}t.exports=n(function(){})},function(t,e,r){function n(t){t=t||{};for(var e in t)this[e]=t[e]}var i=r(5).Base64;n.prototype={encode:function(t){var e=JSON.stringify(t),r=i.encode(e);return r},decode:function(t){var e=i.decode(t),r=JSON.parse(e);return r}},t.exports=n},function(t,e){function r(t){for(var e={},r=[],n=t.length,i=n-1;i>0;i--){var o=t[i];1!==e[o]&&(e[o]=1,r.unshift(o))}return r}t.exports=r},function(t,e){function r(t){return"[object Array]"===Object.prototype.toString.call(t)}t.exports=r}]); |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import { getGAID } from './utils' | ||
import profile from 'sajari-website/src/js/profile' | ||
@@ -55,2 +55,3 @@ /** Class representing an instance of the Client. Handles the searching of queries and keeping track of query id and sequence */ | ||
collection: [this.c], | ||
"user-agent": ['sajari-sdk-js ' + VERSION], | ||
} | ||
@@ -481,6 +482,11 @@ }) | ||
this.data = {} // tracking data | ||
const gaID = getGAID() | ||
const p = new profile() | ||
const gaID = p.gaId | ||
const visitorID = p.visitorId | ||
if (gaID) { | ||
this.tracking('gaID', gaID) | ||
} | ||
if (visitorID) { | ||
this.tracking('sjID', visitorID) | ||
} | ||
} | ||
@@ -487,0 +493,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61678
691
5
+ Addedsajari-website@^0.7.4
+ Addedasync@1.5.2(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcomponent-emitter@1.2.1(transitive)
+ Addedcookiejar@2.0.6(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddot@1.0.1(transitive)
+ Addedextend@3.0.0(transitive)
+ Addedform-data@1.0.0-rc3(transitive)
+ Addedformidable@1.0.17(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedjs-base64@2.6.4(transitive)
+ Addedjs-cookie@2.2.1(transitive)
+ Addedmethods@1.1.2(transitive)
+ Addedmime@1.3.4(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedms@2.0.0(transitive)
+ Addedqs@2.3.3(transitive)
+ Addedreadability-hash@1.1.4(transitive)
+ Addedreadable-stream@1.0.27-1(transitive)
+ Addedreduce-component@1.0.1(transitive)
+ Addedsajari@0.9.5(transitive)
+ Addedsajari-website@0.7.10(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedsuperagent@1.8.5(transitive)
+ Addedsuperagent-jsonp@0.0.6(transitive)
- Removedjs-cookie@2.1.3
- Removedjs-cookie@2.1.3(transitive)