imboclient
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -1,3 +0,3 @@ | ||
/*! imboclient v 3.0.0 2015-10-13 */ | ||
!function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Imbo=t()}}(function(){return function t(e,r,n){function i(o,u){if(!r[o]){if(!e[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);throw new Error("Cannot find module '"+o+"'")}var h=r[o]={exports:{}};e[o][0].call(h.exports,function(t){var r=e[o][1][t];return i(r?r:t)},h,h.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";r.Client=t("./lib/client"),r.Url=t("./lib/url/url"),r.ImageUrl=t("./lib/url/imageurl"),r.ShortUrl=t("./lib/url/shorturl"),r.Query=t("./lib/query"),r.Version=t("./package.json").version},{"./lib/client":9,"./lib/query":10,"./lib/url/imageurl":11,"./lib/url/shorturl":12,"./lib/url/url":13,"./package.json":19}],2:[function(t,e,r){(function(r){"use strict";var n,i=function(){if("undefined"==typeof window.Worker||"undefined"==typeof window.URL)return!1;try{new Worker(window.URL.createObjectURL(new Blob([""],{type:"text/javascript"})))}catch(t){return!1}return!0},s=t("./sha"),o=t("./md5.min"),u=t("./readers"),a="undefined"!=typeof window,h=a&&i(),c=[],f=function(){c.length>1||c.length&&n.postMessage(c[0].buffer)},l=function(t,e){h?(c.push({buffer:t,callback:e}),f()):r.nextTick(function(){e(null,o.ArrayBuffer.hash(t))})};h&&(n=new Worker(window.URL.createObjectURL(new Blob(['(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module \'"+o+"\'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n/* global self */\n\'use strict\';\nvar md5 = require(\'./md5.min\');\nself.onmessage = function(e) {\n self.postMessage(md5.ArrayBuffer.hash(e.data));\n};\n\n},{"./md5.min":2}],2:[function(require,module,exports){\n(function(r){module.exports=r()})(function(r){"use strict";var n=function(r,n){return r+n&4294967295},t=function(r,t,u,e,o,f){t=n(n(t,r),n(e,f));return n(t<<o|t>>>32-o,u)},u=function(r,n,u,e,o,f,a){return t(n&u|~n&e,r,n,o,f,a)},e=function(r,n,u,e,o,f,a){return t(n&e|u&~e,r,n,o,f,a)},o=function(r,n,u,e,o,f,a){return t(n^u^e,r,n,o,f,a)},f=function(r,n,u,e,o,f,a){return t(u^(n|~e),r,n,o,f,a)},a=function(r,t){var a=r[0],i=r[1],c=r[2],h=r[3];a=u(a,i,c,h,t[0],7,-680876936);h=u(h,a,i,c,t[1],12,-389564586);c=u(c,h,a,i,t[2],17,606105819);i=u(i,c,h,a,t[3],22,-1044525330);a=u(a,i,c,h,t[4],7,-176418897);h=u(h,a,i,c,t[5],12,1200080426);c=u(c,h,a,i,t[6],17,-1473231341);i=u(i,c,h,a,t[7],22,-45705983);a=u(a,i,c,h,t[8],7,1770035416);h=u(h,a,i,c,t[9],12,-1958414417);c=u(c,h,a,i,t[10],17,-42063);i=u(i,c,h,a,t[11],22,-1990404162);a=u(a,i,c,h,t[12],7,1804603682);h=u(h,a,i,c,t[13],12,-40341101);c=u(c,h,a,i,t[14],17,-1502002290);i=u(i,c,h,a,t[15],22,1236535329);a=e(a,i,c,h,t[1],5,-165796510);h=e(h,a,i,c,t[6],9,-1069501632);c=e(c,h,a,i,t[11],14,643717713);i=e(i,c,h,a,t[0],20,-373897302);a=e(a,i,c,h,t[5],5,-701558691);h=e(h,a,i,c,t[10],9,38016083);c=e(c,h,a,i,t[15],14,-660478335);i=e(i,c,h,a,t[4],20,-405537848);a=e(a,i,c,h,t[9],5,568446438);h=e(h,a,i,c,t[14],9,-1019803690);c=e(c,h,a,i,t[3],14,-187363961);i=e(i,c,h,a,t[8],20,1163531501);a=e(a,i,c,h,t[13],5,-1444681467);h=e(h,a,i,c,t[2],9,-51403784);c=e(c,h,a,i,t[7],14,1735328473);i=e(i,c,h,a,t[12],20,-1926607734);a=o(a,i,c,h,t[5],4,-378558);h=o(h,a,i,c,t[8],11,-2022574463);c=o(c,h,a,i,t[11],16,1839030562);i=o(i,c,h,a,t[14],23,-35309556);a=o(a,i,c,h,t[1],4,-1530992060);h=o(h,a,i,c,t[4],11,1272893353);c=o(c,h,a,i,t[7],16,-155497632);i=o(i,c,h,a,t[10],23,-1094730640);a=o(a,i,c,h,t[13],4,681279174);h=o(h,a,i,c,t[0],11,-358537222);c=o(c,h,a,i,t[3],16,-722521979);i=o(i,c,h,a,t[6],23,76029189);a=o(a,i,c,h,t[9],4,-640364487);h=o(h,a,i,c,t[12],11,-421815835);c=o(c,h,a,i,t[15],16,530742520);i=o(i,c,h,a,t[2],23,-995338651);a=f(a,i,c,h,t[0],6,-198630844);h=f(h,a,i,c,t[7],10,1126891415);c=f(c,h,a,i,t[14],15,-1416354905);i=f(i,c,h,a,t[5],21,-57434055);a=f(a,i,c,h,t[12],6,1700485571);h=f(h,a,i,c,t[3],10,-1894986606);c=f(c,h,a,i,t[10],15,-1051523);i=f(i,c,h,a,t[1],21,-2054922799);a=f(a,i,c,h,t[8],6,1873313359);h=f(h,a,i,c,t[15],10,-30611744);c=f(c,h,a,i,t[6],15,-1560198380);i=f(i,c,h,a,t[13],21,1309151649);a=f(a,i,c,h,t[4],6,-145523070);h=f(h,a,i,c,t[11],10,-1120210379);c=f(c,h,a,i,t[2],15,718787259);i=f(i,c,h,a,t[9],21,-343485551);r[0]=n(a,r[0]);r[1]=n(i,r[1]);r[2]=n(c,r[2]);r[3]=n(h,r[3])},i=function(r){var n=[],t;for(t=0;t<64;t+=4){n[t>>2]=r.charCodeAt(t)+(r.charCodeAt(t+1)<<8)+(r.charCodeAt(t+2)<<16)+(r.charCodeAt(t+3)<<24)}return n},c=function(r){var n=[],t;for(t=0;t<64;t+=4){n[t>>2]=r[t]+(r[t+1]<<8)+(r[t+2]<<16)+(r[t+3]<<24)}return n},h=function(r){var n=r.length,t=[1732584193,-271733879,-1732584194,271733878],u,e,o,f,c,h;for(u=64;u<=n;u+=64){a(t,i(r.substring(u-64,u)))}r=r.substring(u-64);e=r.length;o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(u=0;u<e;u+=1){o[u>>2]|=r.charCodeAt(u)<<(u%4<<3)}o[u>>2]|=128<<(u%4<<3);if(u>55){a(t,o);for(u=0;u<16;u+=1){o[u]=0}}f=n*8;f=f.toString(16).match(/(.*?)(.{0,8})$/);c=parseInt(f[2],16);h=parseInt(f[1],16)||0;o[14]=c;o[15]=h;a(t,o);return t},s=function(r){var n=r.length,t=[1732584193,-271733879,-1732584194,271733878],u,e,o,f,i,h;for(u=64;u<=n;u+=64){a(t,c(r.subarray(u-64,u)))}r=u-64<n?r.subarray(u-64):new Uint8Array(0);e=r.length;o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(u=0;u<e;u+=1){o[u>>2]|=r[u]<<(u%4<<3)}o[u>>2]|=128<<(u%4<<3);if(u>55){a(t,o);for(u=0;u<16;u+=1){o[u]=0}}f=n*8;f=f.toString(16).match(/(.*?)(.{0,8})$/);i=parseInt(f[2],16);h=parseInt(f[1],16)||0;o[14]=i;o[15]=h;a(t,o);return t},v=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],d=function(r){var n="",t;for(t=0;t<4;t+=1){n+=v[r>>t*8+4&15]+v[r>>t*8&15]}return n},g=function(r){var n;for(n=0;n<r.length;n+=1){r[n]=d(r[n])}return r.join("")},A=function(r){return g(h(r))};var b=function(){this.reset()};if(A("hello")!=="5d41402abc4b2a76b9719d911017c592"){n=function(r,n){var t=(r&65535)+(n&65535),u=(r>>16)+(n>>16)+(t>>16);return u<<16|t&65535}}b.ArrayBuffer=function(){};b.ArrayBuffer.hash=function(r){return g(s(new Uint8Array(r)))};return b});\n},{}]},{},[1])'],{type:"text/javascript"}))),n.addEventListener("message",function(t){var e=c.shift();e.callback(null,t.data),f()},!1)),e.exports={sha256:function(t,e){return s.sha256hmac(t,e)},md5:function(t,n,i){i&&"url"===i.type?u.getContentsFromUrl(t,function(t,r){return t?n(t):void e.exports.md5(r,n,{binary:!0})}):t instanceof window.File?u.getContentsFromFile(t,function(t,r){return t?n(t):void e.exports.md5(r,n,{binary:!0})}):r.nextTick(function(){l(t,n)})}}}).call(this,t("g5I+bs"))},{"./md5.min":4,"./readers":6,"./sha":8,"g5I+bs":18}],3:[function(t,e,r){"use strict";r.checkFeatures=function(t){if("undefined"!=typeof window||t){var e=r.getUnsupported(t);if(e.length)throw new Error("Browser does not support "+e.join(", "))}},r.getUnsupported=function(t){var e=t||window,r=[];return e.FileReader||r.push("FileReader"),e.ArrayBuffer||r.push("ArrayBuffer"),e.XMLHttpRequest?"upload"in new e.XMLHttpRequest||r.push("XMLHttpRequest2"):r.push("XMLHttpRequest"),r}},{}],4:[function(t,e,r){!function(t){e.exports=t()}(function(t){"use strict";var e=function(t,e){return t+e&4294967295},r=function(t,r,n,i,s,o){return r=e(e(r,t),e(i,o)),e(r<<s|r>>>32-s,n)},n=function(t,e,n,i,s,o,u){return r(e&n|~e&i,t,e,s,o,u)},i=function(t,e,n,i,s,o,u){return r(e&i|n&~i,t,e,s,o,u)},s=function(t,e,n,i,s,o,u){return r(e^n^i,t,e,s,o,u)},o=function(t,e,n,i,s,o,u){return r(n^(e|~i),t,e,s,o,u)},u=function(t,r){var u=t[0],a=t[1],h=t[2],c=t[3];u=n(u,a,h,c,r[0],7,-680876936),c=n(c,u,a,h,r[1],12,-389564586),h=n(h,c,u,a,r[2],17,606105819),a=n(a,h,c,u,r[3],22,-1044525330),u=n(u,a,h,c,r[4],7,-176418897),c=n(c,u,a,h,r[5],12,1200080426),h=n(h,c,u,a,r[6],17,-1473231341),a=n(a,h,c,u,r[7],22,-45705983),u=n(u,a,h,c,r[8],7,1770035416),c=n(c,u,a,h,r[9],12,-1958414417),h=n(h,c,u,a,r[10],17,-42063),a=n(a,h,c,u,r[11],22,-1990404162),u=n(u,a,h,c,r[12],7,1804603682),c=n(c,u,a,h,r[13],12,-40341101),h=n(h,c,u,a,r[14],17,-1502002290),a=n(a,h,c,u,r[15],22,1236535329),u=i(u,a,h,c,r[1],5,-165796510),c=i(c,u,a,h,r[6],9,-1069501632),h=i(h,c,u,a,r[11],14,643717713),a=i(a,h,c,u,r[0],20,-373897302),u=i(u,a,h,c,r[5],5,-701558691),c=i(c,u,a,h,r[10],9,38016083),h=i(h,c,u,a,r[15],14,-660478335),a=i(a,h,c,u,r[4],20,-405537848),u=i(u,a,h,c,r[9],5,568446438),c=i(c,u,a,h,r[14],9,-1019803690),h=i(h,c,u,a,r[3],14,-187363961),a=i(a,h,c,u,r[8],20,1163531501),u=i(u,a,h,c,r[13],5,-1444681467),c=i(c,u,a,h,r[2],9,-51403784),h=i(h,c,u,a,r[7],14,1735328473),a=i(a,h,c,u,r[12],20,-1926607734),u=s(u,a,h,c,r[5],4,-378558),c=s(c,u,a,h,r[8],11,-2022574463),h=s(h,c,u,a,r[11],16,1839030562),a=s(a,h,c,u,r[14],23,-35309556),u=s(u,a,h,c,r[1],4,-1530992060),c=s(c,u,a,h,r[4],11,1272893353),h=s(h,c,u,a,r[7],16,-155497632),a=s(a,h,c,u,r[10],23,-1094730640),u=s(u,a,h,c,r[13],4,681279174),c=s(c,u,a,h,r[0],11,-358537222),h=s(h,c,u,a,r[3],16,-722521979),a=s(a,h,c,u,r[6],23,76029189),u=s(u,a,h,c,r[9],4,-640364487),c=s(c,u,a,h,r[12],11,-421815835),h=s(h,c,u,a,r[15],16,530742520),a=s(a,h,c,u,r[2],23,-995338651),u=o(u,a,h,c,r[0],6,-198630844),c=o(c,u,a,h,r[7],10,1126891415),h=o(h,c,u,a,r[14],15,-1416354905),a=o(a,h,c,u,r[5],21,-57434055),u=o(u,a,h,c,r[12],6,1700485571),c=o(c,u,a,h,r[3],10,-1894986606),h=o(h,c,u,a,r[10],15,-1051523),a=o(a,h,c,u,r[1],21,-2054922799),u=o(u,a,h,c,r[8],6,1873313359),c=o(c,u,a,h,r[15],10,-30611744),h=o(h,c,u,a,r[6],15,-1560198380),a=o(a,h,c,u,r[13],21,1309151649),u=o(u,a,h,c,r[4],6,-145523070),c=o(c,u,a,h,r[11],10,-1120210379),h=o(h,c,u,a,r[2],15,718787259),a=o(a,h,c,u,r[9],21,-343485551),t[0]=e(u,t[0]),t[1]=e(a,t[1]),t[2]=e(h,t[2]),t[3]=e(c,t[3])},a=function(t){var e,r=[];for(e=0;64>e;e+=4)r[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return r},h=function(t){var e,r=[];for(e=0;64>e;e+=4)r[e>>2]=t[e]+(t[e+1]<<8)+(t[e+2]<<16)+(t[e+3]<<24);return r},c=function(t){var e,r,n,i,s,o,h=t.length,c=[1732584193,-271733879,-1732584194,271733878];for(e=64;h>=e;e+=64)u(c,a(t.substring(e-64,e)));for(t=t.substring(e-64),r=t.length,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;r>e;e+=1)n[e>>2]|=t.charCodeAt(e)<<(e%4<<3);if(n[e>>2]|=128<<(e%4<<3),e>55)for(u(c,n),e=0;16>e;e+=1)n[e]=0;return i=8*h,i=i.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),o=parseInt(i[1],16)||0,n[14]=s,n[15]=o,u(c,n),c},f=function(t){var e,r,n,i,s,o,a=t.length,c=[1732584193,-271733879,-1732584194,271733878];for(e=64;a>=e;e+=64)u(c,h(t.subarray(e-64,e)));for(t=a>e-64?t.subarray(e-64):new Uint8Array(0),r=t.length,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;r>e;e+=1)n[e>>2]|=t[e]<<(e%4<<3);if(n[e>>2]|=128<<(e%4<<3),e>55)for(u(c,n),e=0;16>e;e+=1)n[e]=0;return i=8*a,i=i.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),o=parseInt(i[1],16)||0,n[14]=s,n[15]=o,u(c,n),c},l=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],d=function(t){var e,r="";for(e=0;4>e;e+=1)r+=l[t>>8*e+4&15]+l[t>>8*e&15];return r},p=function(t){var e;for(e=0;e<t.length;e+=1)t[e]=d(t[e]);return t.join("")},g=function(t){return p(c(t))},m=function(){this.reset()};return"5d41402abc4b2a76b9719d911017c592"!==g("hello")&&(e=function(t,e){var r=(65535&t)+(65535&e),n=(t>>16)+(e>>16)+(r>>16);return n<<16|65535&r}),m.ArrayBuffer=function(){},m.ArrayBuffer.hash=function(t){return p(f(new Uint8Array(t)))},m})},{}],5:[function(t,e,r){"use strict";e.exports=function(t){var e=document.createElement("a");return e.href=t,{protocol:e.protocol,host:e.host,query:e.search.replace(/^\?/,""),pathname:e.pathname}}},{}],6:[function(t,e,r){"use strict";r.getContentsFromFile=function(t,e){var r=new FileReader;r.onload=function(t){return e(null,t.target.result)},r.readAsArrayBuffer(t)},r.getContentsFromUrl=function(t,e){var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onreadystatechange=function(){4===r.readyState&&e(null,r.response||r.responseText)},r.send(null)}},{}],7:[function(t,e,r){"use strict";function n(t){var e=i({},t);e.method=e.method.toUpperCase(),e.uri=e.uri.toString();var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4===r.readyState&&0!==r.status&&e.onComplete){var t=null;r.status>=400&&(t=new Error("HTTP "+r.status+" "+r.statusText),t.statusCode=r.status),e.onComplete(t,o(r),e.json?JSON.parse(r.responseText):r.responseText)}},r.onerror=function(){e.onComplete(new Error("XHR error - CORS denied?"),o(r))},e.onProgress&&r.upload.addEventListener("progress",e.onProgress,!1),r.open(e.method,e.uri,!0);for(var n in e.headers)s.indexOf(n)>-1||r.setRequestHeader(n,e.headers[n]);e.json&&(r.setRequestHeader("Accept","application/json"),"boolean"!=typeof e.json&&(r.setRequestHeader("Content-Type","application/json"),e.body=JSON.stringify(e.json))),r.send(e.body)}var i=t("../utils/extend"),s=["User-Agent","Content-Length"],o=function(t){for(var e={headers:{},statusCode:t.status},r=t.getAllResponseHeaders().split("\r\n"),n=0;n<r.length;n++){var i=r[n],s=i.indexOf(": ");if(s>0){var o=i.substring(0,s),u=i.substring(s+2);e.headers[o.toLowerCase()]=u}}return e};n["short"]=function(t,e,r){var i={method:t,uri:e,onComplete:r};"GET"===t&&(i.json=!0),n(i)},n.get=function(t,e){n["short"]("GET",t,e)},n.del=function(t,e){n["short"]("DELETE",t,e)},n.head=function(t,e){n["short"]("HEAD",t,e)},e.exports=n},{"../utils/extend":15}],8:[function(t,e,r){"use strict";var n=8,i=function(t,e){var r=(65535&t)+(65535&e),n=(t>>16)+(e>>16)+(r>>16);return n<<16|65535&r},s=function(t,e){return t>>>e|t<<32-e},o=function(t,e){return t>>>e},u=function(t,e,r){return t&e^~t&r},a=function(t,e,r){return t&e^t&r^e&r},h=function(t){return s(t,2)^s(t,13)^s(t,22)},c=function(t){return s(t,6)^s(t,11)^s(t,25)},f=function(t){return s(t,7)^s(t,18)^o(t,3)},l=function(t){return s(t,17)^s(t,19)^o(t,10)},d=function(t,e){var r,n,s,o,d,p,g,m,y,v,b,w,U=[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],x=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],I=new Array(64);for(t[e>>5]|=128<<24-e%32,t[(e+64>>9<<4)+15]=e,y=0;y<t.length;y+=16){for(r=x[0],n=x[1],s=x[2],o=x[3],d=x[4],p=x[5],g=x[6],m=x[7],v=0;64>v;v++)16>v?I[v]=t[v+y]:I[v]=i(i(i(l(I[v-2]),I[v-7]),f(I[v-15])),I[v-16]),b=i(i(i(i(m,c(d)),u(d,p,g)),U[v]),I[v]),w=i(h(r),a(r,n,s)),m=g,g=p,p=d,d=i(o,b),o=s,s=n,n=r,r=i(b,w);x[0]=i(r,x[0]),x[1]=i(n,x[1]),x[2]=i(s,x[2]),x[3]=i(o,x[3]),x[4]=i(d,x[4]),x[5]=i(p,x[5]),x[6]=i(g,x[6]),x[7]=i(m,x[7])}return x},p=function(t){for(var e=[],r=(1<<n)-1,i=0;i<t.length*n;i+=n)e[i>>5]|=(t.charCodeAt(i/n)&r)<<24-i%32;return e},g=function(t){for(var e="0123456789abcdef",r="",n=0;n<4*t.length;n++)r+=e.charAt(t[n>>2]>>8*(3-n%4)+4&15)+e.charAt(t[n>>2]>>8*(3-n%4)&15);return r},m=function(t,e){var r=p(t);r.length>16&&(r=d(r,t.length*n));for(var i=new Array(16),s=new Array(16),o=0;16>o;o++)i[o]=909522486^r[o],s[o]=1549556828^r[o];var u=d(i.concat(p(e)),512+e.length*n);return d(s.concat(u),768)};r.sha256hmac=function(t,e){return g(m(t,e))}},{}],9:[function(t,e,r){"use strict";function n(t,e,r){d.checkFeatures();var n=this.options={hosts:p(t.hosts||t),publicKey:t.publicKey||e,privateKey:t.privateKey||r,user:t.user||t.publicKey||e};["publicKey","privateKey","user"].forEach(function(t){if(!n[t]||"string"!=typeof n[t])throw new Error("`options."+t+"` must be a valid string")})}var i=t("./url/url"),s=t("./url/imageurl"),o=t("./url/shorturl"),u=t("./query"),a=t("./utils/extend"),h=t("./utils/jsonparse"),c=t("./browser/crypto"),f=t("./browser/request"),l=t("./browser/readers"),d=t("./browser/feature-support"),p=t("./utils/parse-urls"),g=t("./utils/404-handler"),m="undefined"!=typeof window;a(n.prototype,{user:function(t){return this.options.user=t,this},addImage:function(t,e){return m&&t instanceof window.File?this.addImageFromBuffer(t,e):(l.getLengthOfFile(t,function(r,n){return r?e(r):void l.createReadStream(t).pipe(f({method:"POST",uri:this.getSignedResourceUrl("POST",this.getImagesUrl()),json:!0,headers:{Accept:"application/json","User-Agent":"imboclient-js","Content-Length":n},onComplete:function(t,r,n){e(t,n?n.imageIdentifier:null,n,r)}}))}.bind(this)),this)},addImageFromBuffer:function(t,e){var r=this.getSignedResourceUrl("POST",this.getImagesUrl()),n=m&&t instanceof window.File,i=e.onComplete||e,s=e.onProgress||null;return f({method:"POST",uri:r,body:t,headers:{Accept:"application/json","User-Agent":"imboclient-js","Content-Length":n?t.size:t.length},onComplete:function(t,e,r){r=h(r),i(t,r?r.imageIdentifier:null,r,e)},onProgress:s}),this},addImageFromUrl:function(t,e){return m?this.getImageDataFromUrl(t,function(t,r){return t?e(t):void this.addImageFromBuffer(r,e)}.bind(this)):(f({uri:t}).pipe(f({method:"POST",uri:this.getSignedResourceUrl("POST",this.getImagesUrl()),json:!0,headers:{Accept:"application/json","User-Agent":"imboclient-js"},onComplete:function(t,r,n){e(t,n?n.imageIdentifier:null,n,r)}})),this)},getServerStats:function(t){return f.get(this.getStatsUrl(),function(e,r,n){t(e,n,r)}),this},getServerStatus:function(t){return f.get(this.getStatusUrl(),function(e,r,n){return e?t(e):(n=n||{},n.status=r.statusCode,n.date=new Date(n.date),void t(e,n,r))}),this},getUserInfo:function(t){return f.get(this.getUserUrl(),function(e,r,n){n&&n.lastModified&&(n.lastModified=new Date(n.lastModified)),n&&!n.user&&n.publicKey&&(n.user=n.publicKey),t(e,n,r)}),this},deleteImage:function(t,e){var r=this.getImageUrl(t,{usePrimaryHost:!0}),n=this.getSignedResourceUrl("DELETE",r);return f.del(n,e),this},getImageProperties:function(t,e){return this.headImage(t,function(t,r){if(t)return e(t);var n=r.headers,i="x-imbo-original";e(t,{width:parseInt(n[i+"width"],10),height:parseInt(n[i+"height"],10),filesize:parseInt(n[i+"filesize"],10),extension:n[i+"extension"],mimetype:n[i+"mimetype"]})}),this},editMetadata:function(t,e,r,n){var i=this.getMetadataUrl(t);return f({method:n||"POST",uri:this.getSignedResourceUrl(n||"POST",i),json:e,onComplete:function(t,e,n){r(t,n,e)}}),this},replaceMetadata:function(t,e,r){return this.editMetadata(t,e,r,"PUT")},getMetadata:function(t,e){return f.get(this.getMetadataUrl(t),function(t,r,n){e(t,n,r)}),this},deleteMetadata:function(t,e){var r=this.getMetadataUrl(t);return f.del(this.getSignedResourceUrl("DELETE",r),e),this},getImages:function(t,e){return"function"!=typeof t||e||(e=t,t=null),f.get(this.getImagesUrl(t),function(t,r,n){e(t,n&&n.images,n&&n.search,r)}),this},getStatusUrl:function(){return this.getResourceUrl({path:"/status"})},getStatsUrl:function(){return this.getResourceUrl({path:"/stats"})},getUserUrl:function(){return this.getResourceUrl({path:"/users/"+this.options.user})},getImagesUrl:function(t){var e;return t&&t.users().length?e=this.getResourceUrl({path:"/images",user:null}):(e=this.getUserUrl(),e.setPath(e.getPath()+"/images")),t&&e.setQueryString(t.toString()),e},getImageUrl:function(t,e){if("string"!=typeof t||0===t.length)throw new Error('`imageIdentifier` must be a non-empty string, was "'+t+'" ('+typeof t+")");return e=e||{},new s({baseUrl:this.getHostForImageIdentifier(t,e.usePrimaryHost),path:e.path,user:this.options.user,publicKey:this.options.publicKey,privateKey:this.options.privateKey,imageIdentifier:t})},parseImageUrl:function(t,e){return s.parse(t,e||this.options.privateKey)},getMetadataUrl:function(t){return this.getImageUrl(t,{path:"/meta",usePrimaryHost:!0})},getResourceUrl:function(t){return new i({baseUrl:this.options.hosts[0],user:"undefined"!=typeof t.user?t.user:this.options.user,publicKey:this.options.publicKey,privateKey:this.options.privateKey,queryString:t.query,path:t.path})},getShortUrl:function(t,e){var r=t.clone(),n=r.getExtension(),i=r.getImageIdentifier(),s=this.getHostForImageIdentifier(i),u={imageIdentifier:i,user:r.getUser(),publicKey:r.getPublicKey(),query:r.getQueryString()};return n&&(u.extension=n),r.reset().setPath("/shorturls"),f({method:"POST",uri:this.getSignedResourceUrl("POST",r.toString()),json:u,onComplete:function(t,r,n){return t?e(t):n&&n.id?void e(t,new o({baseUrl:s,id:n.id})):e("No ShortUrl was returned from server")}}),this},deleteAllShortUrlsForImage:function(t,e){var r=this.getImageUrl(t).setPath("/shorturls"),n=this.getSignedResourceUrl("DELETE",r);return f.del(n,e),this},deleteShortUrlForImage:function(t,e,r){var n=e instanceof o?e.getId():e,i=this.getImageUrl(t).setPath("/shorturls/"+n),s=this.getSignedResourceUrl("DELETE",i);return f.del(s,r),this},getNumImages:function(t){return this.getUserInfo(function(e,r){t(e,r&&r.numImages)}),this},imageExists:function(t,e){return this.getImageChecksum(t,function(t,r){return t?e(t):void this.imageWithChecksumExists(r,e)}.bind(this)),this},imageIdentifierExists:function(t,e){return this.headImage(t,g(e)),this},imageWithChecksumExists:function(t,e){var r=(new u).originalChecksums([t]).limit(1);return this.getImages(r,function(t,r,n){if(t)return e(t);var i=n.hits>0;e(t,i,i?r[0].imageIdentifier:t)}),this},getResourceGroups:function(t){return f.get(this.getResourceUrl({path:"/groups",user:null}),function(e,r,n){t(e,n&&n.groups,n&&n.search,r)}),this},getResourceGroup:function(t,e){return f.get(this.getResourceUrl({path:"/groups/"+t,user:null}),function(t,r,n){e(t,n&&n.resources,r)}),this},addResourceGroup:function(t,e,r){return this.resourceGroupExists(t,function(n,i){return n?r(n):i?r(new Error("Resource group `"+t+"` already exists")):void this.editResourceGroup(t,e,r)}.bind(this)),this},editResourceGroup:function(t,e,r){var n=this.getResourceUrl({path:"/groups/"+t,user:null});return f({method:"PUT",uri:this.getSignedResourceUrl("PUT",n),json:e,onComplete:function(t,e,n){r(t,n,e)}}),this},deleteResourceGroup:function(t,e){var r=this.getResourceUrl({path:"/groups/"+t,user:null});return f.del(this.getSignedResourceUrl("DELETE",r),e),this},resourceGroupExists:function(t,e){return f.head(this.getResourceUrl({path:"/groups/"+t,user:null}),g(e)),this},addPublicKey:function(t,e,r){return this.publicKeyExists(t,function(n,i){return n?r(n):i?r(new Error("Public key `"+t+"` already exists")):void this.editPublicKey(t,e,r)}.bind(this)),this},editPublicKey:function(t,e,r){if(!t||!e)throw new Error("Both public key and private key must be specified");var n=this.getResourceUrl({path:"/keys/"+t,user:null});return f({method:"PUT",uri:this.getSignedResourceUrl("PUT",n),json:{privateKey:e},onComplete:r}),this},deletePublicKey:function(t,e){var r=this.getResourceUrl({path:"/keys/"+t,user:null});return f.del(this.getSignedResourceUrl("DELETE",r),e),this},publicKeyExists:function(t,e){return f.head(this.getResourceUrl({path:"/keys/"+t,user:null}),g(e)),this},getAccessControlRules:function(t,e){return f.get(this.getResourceUrl({path:"/keys/"+t+"/access",user:null}),function(t,r,n){e(t,n,r)}),this},getAccessControlRule:function(t,e,r){return f.get(this.getResourceUrl({path:"/keys/"+t+"/access/"+e,user:null}),function(t,e,n){r(t,n,e)}),this},addAccessControlRule:function(t,e,r){if(Array.isArray(e)||(e=[e]),!t)throw new Error("Public key must be a valid string");var n=this.getResourceUrl({path:"/keys/"+t+"/access",user:null});return f({method:"POST",uri:this.getSignedResourceUrl("POST",n),json:e,onComplete:function(t,e,n){r(t,n,e)}}),this},deleteAccessControlRule:function(t,e,r){var n=this.getResourceUrl({path:"/keys/"+t+"/access/"+e,user:null});return f.del(this.getSignedResourceUrl("DELETE",n),r),this},getImageData:function(t,e){var r=this.getImageUrl(t);return this.getImageDataFromUrl(r,e),this},getImageDataFromUrl:function(t,e){return l.getContentsFromUrl(t.toString(),function(t,r){e(t,t?null:r)}),this},getHostForImageIdentifier:function(t,e){if(e)return this.options.hosts[0];var r=t.charCodeAt(t.length-1);return t.match(/^[a-f0-9]{32}$/)&&(r=parseInt(t.substr(0,2),16)),this.options.hosts[r%this.options.hosts.length]},getImageChecksum:function(t,e){return c.md5(t,e),this},getImageChecksumFromBuffer:function(t,e){return c.md5(t,e,{binary:!0,type:"string"}),this},generateSignature:function(t,e,r){var n=[t,e,this.options.publicKey,r].join("|"),i=c.sha256(this.options.privateKey,n);return i},getSignedResourceUrl:function(t,e,r){var n=(r||new Date).toISOString().replace(/\.\d+Z$/,"Z"),i=this.options.user!==this.options.publicKey,s=e.toString().indexOf("?")>-1?"&":"?",o=i?e+s+"publicKey="+this.options.publicKey:e,u=this.generateSignature(t,o.toString(),n);return s=i?"&":s,s+="signature="+encodeURIComponent(u),s+="×tamp="+encodeURIComponent(n),o+s},headImage:function(t,e){return f.head(this.getImageUrl(t,{usePrimaryHost:!0}),e),this}}),n.request=f,e.exports=n},{"./browser/crypto":2,"./browser/feature-support":3,"./browser/readers":6,"./browser/request":7,"./query":10,"./url/imageurl":11,"./url/shorturl":12,"./url/url":13,"./utils/404-handler":14,"./utils/extend":15,"./utils/jsonparse":16,"./utils/parse-urls":17}],10:[function(t,e,r){"use strict";var n=t("./utils/extend"),i=function(){this.values={},this.reset()};i.SORT_DESC="desc",i.SORT_ASC="asc",n(i.prototype,{appendValue:function(t,e){return this.values[t]=this.values[t].concat(e),this},setOrGet:function(t,e){return"undefined"==typeof e?this.values[t]:(this.values[t]=[].concat(e),this)},ids:function(t){return this.setOrGet("ids",t)},addId:function(t){return this.appendValue("ids",t)},addIds:function(t){return this.addId(t)},checksums:function(t){return this.setOrGet("checksums",t)},addChecksum:function(t){return this.appendValue("checksums",t)},addChecksums:function(t){return this.addChecksum(t)},originalChecksums:function(t){return this.setOrGet("originalChecksums",t)},addOriginalChecksum:function(t){return this.appendValue("originalChecksums",t)},addOriginalChecksums:function(t){return this.addOriginalChecksum(t)},fields:function(t){return this.setOrGet("fields",t)},addField:function(t){return this.appendValue("fields",t)},addFields:function(t){return this.addField(t)},sort:function(t,e,r){if(Array.isArray(t)||"undefined"==typeof t)return this.setOrGet("sort",t);var n=(e?[t,e]:[t]).join(":");return r?this.values.sort.push(n):this.values.sort=[n],this},addSort:function(t,e){return this.sort(t,e,!0)},addSorts:function(t){return this.appendValue("sort",t)},users:function(t){return this.setOrGet("users",t)},addUser:function(t){return this.appendValue("users",t)},addUsers:function(t){return this.addUser(t)},page:function(t){return t?(this.values.page=parseInt(t,10),this):this.values.page},limit:function(t){return t?(this.values.limit=t,this):this.values.limit},metadata:function(t){return"undefined"==typeof t?this.values.metadata:(this.values.metadata=t?1:0,this)},from:function(t){return t?(this.values.from=t instanceof Date?t:this.values.from,this):this.values.from},to:function(t){return t?(this.values.to=t instanceof Date?t:this.values.to,this):this.values.to},reset:function(){var t=this.values;return t.page=1,t.limit=20,t.metadata=0,t.from=null,t.to=null,t.ids=[],t.checksums=[],t.fields=[],t.users=[],t.sort=[],t.originalChecksums=[],this},toQueryString:function(){var t,e={};for(t in this.values)!Array.isArray(this.values[t])&&this.values[t]&&(e[t]=this.values[t]);e.from&&(e.from=Math.floor(e.from.getTime()/1e3)),e.to&&(e.to=Math.floor(e.to.getTime()/1e3));var r=[];for(t in e)r.push(t+"="+e[t]);return["ids","checksums","originalChecksums","fields","users","sort"].forEach(function(t){this[t].forEach(function(e){r.push(t+"[]="+e)})}.bind(this.values)),r.join("&")},toString:function(){return this.toQueryString()}}),e.exports=i},{"./utils/extend":15}],11:[function(t,e,r){"use strict";var n=t("./url"),i=t("../utils/extend"),s=t("../browser/parseurl"),o=function(t){return parseInt(t,10)},u=function(t){return!isNaN(t)},a=function(t){return"`"+t+"`"},h=function(t){this.transformations=t.transformations||[],this.rootUrl=t.baseUrl,this.baseUrl=t.baseUrl,this.user=t.user||t.publicKey,this.publicKey=t.publicKey,this.privateKey=t.privateKey,this.imageIdentifier=t.imageIdentifier,this.extension=t.extension,this.queryString=t.queryString,this.path=t.path||"",this.baseUrl+=["/users",this.user,"images",this.imageIdentifier].join("/")};i(h.prototype,n.prototype),i(h.prototype,{autoRotate:function(){return this.append("autoRotate")},border:function(t){t=t||{};var e=["color="+(t.color||"000000").replace(/^#/,""),"width="+o(t.width||1),"height="+o(t.height||1),"mode="+(t.mode||"outbound")];return this.append("border:"+e.join(","))},canvas:function(t){if(t=t||{},!t.width||!t.height)throw new Error("width and height must be specified");var e=["width="+o(t.width),"height="+o(t.height)];return t.mode&&e.push("mode="+t.mode),t.x&&e.push("x="+o(t.x)),t.y&&e.push("y="+o(t.y)),t.bg&&e.push("bg="+t.bg.replace(/^#/,"")),this.append("canvas:"+e.join(","))},compress:function(t){var e=(t||{}).level||t;return this.append("compress:level="+(u(e)?e:75))},convert:function(t){return this.extension=t,this},crop:function(t){var e=t||{},r=e.mode,n=e.x,i=e.y,s=e.width,a=e.height;if(!r&&(isNaN(n)||isNaN(i)))throw new Error("x and y needs to be specified without a crop mode");if("center-x"===r&&isNaN(i))throw new Error("y needs to be specified when mode is center-x");if("center-y"===r&&isNaN(n))throw new Error("x needs to be specified when mode is center-y");if(isNaN(s)||isNaN(a))throw new Error("width and height needs to be specified");var h=["width="+o(s),"height="+o(a)];return u(n)&&h.push("x="+o(n)),u(i)&&h.push("y="+o(i)),r&&h.push("mode="+r),this.append("crop:"+h.join(","))},desaturate:function(){return this.append("desaturate")},flipHorizontally:function(){return this.append("flipHorizontally")},flipVertically:function(){return this.append("flipVertically")},maxSize:function(t){var e=[];if(t.width&&e.push("width="+o(t.width)),t.height&&e.push("height="+o(t.height)),!e.length)throw new Error("width and/or height needs to be specified");return this.append("maxSize:"+e.join(","))},modulate:function(t){var e=[],r=t||{};if((u(r.brightness)||u(r.b))&&e.push("b="+(r.brightness||r.b)),(u(r.saturation)||u(r.s))&&e.push("s="+(r.saturation||r.s)),(u(r.hue)||u(r.h))&&e.push("h="+(r.hue||r.h)),!e.length)throw new Error("brightness, saturation or hue needs to be specified");return this.append("modulate:"+e.join(","))},progressive:function(){return this.append("progressive")},resize:function(t){var e=[];if(t&&t.width&&e.push("width="+o(t.width)),t&&t.height&&e.push("height="+o(t.height)),!e.length)throw new Error("width and/or height needs to be specified");return this.append("resize:"+e.join(","))},rotate:function(t){if(!t||isNaN(t.angle))throw new Error("angle needs to be specified");var e=(t.bg||"000000").replace(/^#/,"");return this.append("rotate:angle="+t.angle+",bg="+e)},sepia:function(t){var e=(t||{}).threshold||t;return this.append("sepia:threshold="+(u(e)?e:80))},sharpen:function(t){var e=[],r=t||{},n="sharpen";return r.preset&&e.push("preset="+r.preset),"undefined"!=typeof r.radius&&e.push("radius="+r.radius),"undefined"!=typeof r.sigma&&e.push("sigma="+r.sigma),"undefined"!=typeof r.gain&&e.push("gain="+r.gain),"undefined"!=typeof r.threshold&&e.push("threshold="+r.threshold),e.length&&(n+=":"+e.join(",")),this.append(n)},smartSize:function(t){var e=[],r=t||{};if(!r.width||!r.height)throw new Error("Both width and height needs to be specified"); | ||
if(r.poi){var n;if(Array.isArray(r.poi))n=r.poi.map(o).join(",");else{if("undefined"==typeof r.poi.x||"undefined"==typeof r.poi.y)throw new Error("`poi` parameter must be either an array of [x, y]-coordinates or an object with `x` and `y` properties");n=o(r.poi.x)+","+o(r.poi.y)}e.push("poi="+n)}if(r.crop){var i=["close","medium","wide"];if(-1===i.indexOf(r.crop))throw new Error("`crop` parameter must be either: "+i.map(a).join(", "));e.push("crop="+r.crop)}return this.append("smartSize:"+e.join(","))},strip:function(){return this.append("strip")},thumbnail:function(t){return t=t||{},this.append(["thumbnail:width="+(t.width||50),"height="+(t.height||50),"fit="+(t.fit||"outbound")].join(","))},transpose:function(){return this.append("transpose")},transverse:function(){return this.append("transverse")},watermark:function(t){t=t||{};var e=["position="+(t.position||"top-left"),"x="+o(t.x||0),"y="+o(t.y||0)];return t.imageIdentifier&&e.push("img="+t.imageIdentifier),t.width>0&&e.push("width="+o(t.width)),t.height>0&&e.push("height="+o(t.height)),this.append("watermark:"+e.join(","))},gif:function(){return this.convert("gif")},jpg:function(){return this.convert("jpg")},png:function(){return this.convert("png")},reset:function(){return this.extension=null,this.transformations=[],this},clone:function(){return new h({transformations:this.transformations.slice(0),baseUrl:this.rootUrl,user:this.user,publicKey:this.publicKey,privateKey:this.privateKey,imageIdentifier:this.imageIdentifier,extension:this.extension,queryString:this.queryString,path:this.path})},append:function(t){return this.transformations.push(t),this},getTransformations:function(){return this.transformations},getExtension:function(){return this.extension},getImageIdentifier:function(){return this.imageIdentifier},getQueryString:function(t){var e=this.queryString||"",r=this.transformations,n=t?"t%5B%5D=":"t[]=";return t&&(r=r.map(encodeURIComponent)),this.transformations.length&&(e+=e.length?"&":"",e+=n+r.join("&"+n)),e},getBaseUrl:function(){return this.rootUrl}}),h.parse=function(t,e){var r=s(t),n=r.pathname,i=n.replace(/(.*)\/users\/.*/,"$1"),o=n.replace(/.*\/users\/(.+?)\/.*/,"$1"),u=(r.query||"").split("&").map(decodeURIComponent),a=u.filter(function(t){return 0===t.indexOf("publicKey=")}).map(function(t){return t.substring(10)})[0],c=u.filter(function(t){return 0===t.indexOf("t[]=")}).map(function(t){return t.substr(4)});return new h({baseUrl:r.protocol+"//"+r.host+i,path:n.replace(/.*\/images\/[^\/]*/,""),user:o,publicKey:a||o,privateKey:e,transformations:c,extension:n.replace(/.*\/images\/.*?(?:\.|$)(.*)/,"$1")||null,imageIdentifier:n.replace(/.*\/images\/(.+?)(\..*|$)/,"$1"),queryString:u.filter(function(t){return-1===t.indexOf("t[]=")&&-1===t.indexOf("accessToken=")&&-1===t.indexOf("publicKey=")}).join("&")})},e.exports=h},{"../browser/parseurl":5,"../utils/extend":15,"./url":13}],12:[function(t,e,r){"use strict";var n=t("../utils/extend"),i=function(t){this.baseUrl=t.baseUrl,this.shortId=t.id};n(i.prototype,{getId:function(){return this.shortId},getUrl:function(){return this.baseUrl+"/s/"+this.shortId},toString:function(){return this.getUrl()}}),e.exports=i},{"../utils/extend":15}],13:[function(t,e,r){"use strict";var n=t("../browser/crypto"),i=t("../utils/extend"),s=function(t){this.transformations=[],this.baseUrl=t.baseUrl,this.user="undefined"==typeof t.user?t.publicKey:t.user,this.publicKey=t.publicKey,this.privateKey=t.privateKey,this.extension=t.extension,this.imageIdentifier=t.imageIdentifier||"",this.path=t.path||"",this.queryString=t.queryString};i(s.prototype,{getUser:function(){return this.user},getPublicKey:function(){return this.publicKey},getPath:function(){return this.path},setPath:function(t){return this.path=t,this},setPrivateKey:function(t){return this.privateKey=t,this},getAccessToken:function(t){return n.sha256(this.privateKey,t)},setQueryString:function(t){return this.queryString=t,this},getQueryString:function(){return this.queryString||""},getUrl:function(){var t=this.extension?"."+this.extension:"",e=this.baseUrl+t+this.path,r=e,n=this.publicKey!==this.user,i=this.getQueryString();if(i.length&&(r+="?"+this.getQueryString(!0),e+="?"+i),n){var s=(e.indexOf("?")>-1?"&":"?")+"publicKey="+this.publicKey;e+=s,r+=s}return[r,e.indexOf("?")>-1?"&":"?","accessToken="+this.getAccessToken(e,this.privateKey)].join("")},toString:function(){return this.getUrl()}}),e.exports=s},{"../browser/crypto":2,"../utils/extend":15}],14:[function(t,e,r){"use strict";function n(t){return function(e,r){var n=r&&r.statusCode?r.statusCode:null,i=e&&404!==e.statusCode?e:null;t(i,200===n)}}e.exports=n},{}],15:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r in e)t[r]=e[r];return t}},{}],16:[function(t,e,r){"use strict";e.exports=function(t){var e;try{e=JSON.parse(t)}catch(r){e=null}return e}},{}],17:[function(t,e,r){"use strict";e.exports=function(t){if("string"==typeof t)t=[t];else if(!Array.isArray(t)||!t.length)throw new Error("`options.hosts` must be a string or an array of strings");for(var e=[],r=0;r<t.length;r++)e.push(t[r].replace(/:80(\/|$)/,"$1").replace(/\/$/,""));return e}},{}],18:[function(t,e,r){function n(){}var i=e.exports={};i.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var r=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),r.length>0)){var n=r.shift();n()}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=n,i.addListener=n,i.once=n,i.off=n,i.removeListener=n,i.removeAllListeners=n,i.emit=n,i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")}},{}],19:[function(t,e,r){e.exports={name:"imboclient",description:"An Imbo client for node.js and modern browsers",version:"3.0.0",author:"Espen Hovlandsdal <espen@hovlandsdal.com>",contributors:[],repository:{type:"git",url:"http://github.com/imbo/imboclient-js"},bugs:{url:"http://github.com/imbo/imboclient-js/issues"},dependencies:{request:"^2.60.0"},devDependencies:{coveralls:"^2.11.4",del:"^2.0.2",eslint:"^1.6.0","eslint-config-vaffel":"^2.0.0",gulp:"^3.9.0","gulp-browserify":"^0.5.1","gulp-insert":"^0.5.0","gulp-istanbul":"^0.10.1","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-replace":"^0.5.4","gulp-uglify":"^1.4.2","gulp-util":"^3.0.6",nock:"^2.15.0",through:"^2.3.8",workerify:"^0.3.0"},scripts:{coveralls:"cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",lint:"eslint .",pretest:"npm run lint",test:"gulp test"},main:"index",browser:"./dist/browser-bundle.js",engines:{node:">=0.10.0"},license:"MIT"}},{}]},{},[1])(1)}); | ||
/*! imboclient v 3.0.0 2015-10-19 */ | ||
!function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Imbo=t()}}(function(){return function t(e,r,n){function i(o,u){if(!r[o]){if(!e[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);throw new Error("Cannot find module '"+o+"'")}var h=r[o]={exports:{}};e[o][0].call(h.exports,function(t){var r=e[o][1][t];return i(r?r:t)},h,h.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";r.Client=t("./lib/client"),r.Url=t("./lib/url/url"),r.ImageUrl=t("./lib/url/imageurl"),r.ShortUrl=t("./lib/url/shorturl"),r.Query=t("./lib/query"),r.Version=t("./package.json").version},{"./lib/client":9,"./lib/query":10,"./lib/url/imageurl":11,"./lib/url/shorturl":12,"./lib/url/url":13,"./package.json":19}],2:[function(t,e,r){(function(r){"use strict";var n,i=function(){if("undefined"==typeof window.Worker||"undefined"==typeof window.URL)return!1;try{new Worker(window.URL.createObjectURL(new Blob([""],{type:"text/javascript"})))}catch(t){return!1}return!0},s=t("./sha"),o=t("./md5.min"),u=t("./readers"),a="undefined"!=typeof window,h=a&&i(),c=[],f=function(){c.length>1||c.length&&n.postMessage(c[0].buffer)},l=function(t,e){h?(c.push({buffer:t,callback:e}),f()):r.nextTick(function(){e(null,o.ArrayBuffer.hash(t))})};h&&(n=new Worker(window.URL.createObjectURL(new Blob(['(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module \'"+o+"\'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n/* global self */\n\'use strict\';\nvar md5 = require(\'./md5.min\');\nself.onmessage = function(e) {\n self.postMessage(md5.ArrayBuffer.hash(e.data));\n};\n\n},{"./md5.min":2}],2:[function(require,module,exports){\n(function(r){module.exports=r()})(function(r){"use strict";var n=function(r,n){return r+n&4294967295},t=function(r,t,u,e,o,f){t=n(n(t,r),n(e,f));return n(t<<o|t>>>32-o,u)},u=function(r,n,u,e,o,f,a){return t(n&u|~n&e,r,n,o,f,a)},e=function(r,n,u,e,o,f,a){return t(n&e|u&~e,r,n,o,f,a)},o=function(r,n,u,e,o,f,a){return t(n^u^e,r,n,o,f,a)},f=function(r,n,u,e,o,f,a){return t(u^(n|~e),r,n,o,f,a)},a=function(r,t){var a=r[0],i=r[1],c=r[2],h=r[3];a=u(a,i,c,h,t[0],7,-680876936);h=u(h,a,i,c,t[1],12,-389564586);c=u(c,h,a,i,t[2],17,606105819);i=u(i,c,h,a,t[3],22,-1044525330);a=u(a,i,c,h,t[4],7,-176418897);h=u(h,a,i,c,t[5],12,1200080426);c=u(c,h,a,i,t[6],17,-1473231341);i=u(i,c,h,a,t[7],22,-45705983);a=u(a,i,c,h,t[8],7,1770035416);h=u(h,a,i,c,t[9],12,-1958414417);c=u(c,h,a,i,t[10],17,-42063);i=u(i,c,h,a,t[11],22,-1990404162);a=u(a,i,c,h,t[12],7,1804603682);h=u(h,a,i,c,t[13],12,-40341101);c=u(c,h,a,i,t[14],17,-1502002290);i=u(i,c,h,a,t[15],22,1236535329);a=e(a,i,c,h,t[1],5,-165796510);h=e(h,a,i,c,t[6],9,-1069501632);c=e(c,h,a,i,t[11],14,643717713);i=e(i,c,h,a,t[0],20,-373897302);a=e(a,i,c,h,t[5],5,-701558691);h=e(h,a,i,c,t[10],9,38016083);c=e(c,h,a,i,t[15],14,-660478335);i=e(i,c,h,a,t[4],20,-405537848);a=e(a,i,c,h,t[9],5,568446438);h=e(h,a,i,c,t[14],9,-1019803690);c=e(c,h,a,i,t[3],14,-187363961);i=e(i,c,h,a,t[8],20,1163531501);a=e(a,i,c,h,t[13],5,-1444681467);h=e(h,a,i,c,t[2],9,-51403784);c=e(c,h,a,i,t[7],14,1735328473);i=e(i,c,h,a,t[12],20,-1926607734);a=o(a,i,c,h,t[5],4,-378558);h=o(h,a,i,c,t[8],11,-2022574463);c=o(c,h,a,i,t[11],16,1839030562);i=o(i,c,h,a,t[14],23,-35309556);a=o(a,i,c,h,t[1],4,-1530992060);h=o(h,a,i,c,t[4],11,1272893353);c=o(c,h,a,i,t[7],16,-155497632);i=o(i,c,h,a,t[10],23,-1094730640);a=o(a,i,c,h,t[13],4,681279174);h=o(h,a,i,c,t[0],11,-358537222);c=o(c,h,a,i,t[3],16,-722521979);i=o(i,c,h,a,t[6],23,76029189);a=o(a,i,c,h,t[9],4,-640364487);h=o(h,a,i,c,t[12],11,-421815835);c=o(c,h,a,i,t[15],16,530742520);i=o(i,c,h,a,t[2],23,-995338651);a=f(a,i,c,h,t[0],6,-198630844);h=f(h,a,i,c,t[7],10,1126891415);c=f(c,h,a,i,t[14],15,-1416354905);i=f(i,c,h,a,t[5],21,-57434055);a=f(a,i,c,h,t[12],6,1700485571);h=f(h,a,i,c,t[3],10,-1894986606);c=f(c,h,a,i,t[10],15,-1051523);i=f(i,c,h,a,t[1],21,-2054922799);a=f(a,i,c,h,t[8],6,1873313359);h=f(h,a,i,c,t[15],10,-30611744);c=f(c,h,a,i,t[6],15,-1560198380);i=f(i,c,h,a,t[13],21,1309151649);a=f(a,i,c,h,t[4],6,-145523070);h=f(h,a,i,c,t[11],10,-1120210379);c=f(c,h,a,i,t[2],15,718787259);i=f(i,c,h,a,t[9],21,-343485551);r[0]=n(a,r[0]);r[1]=n(i,r[1]);r[2]=n(c,r[2]);r[3]=n(h,r[3])},i=function(r){var n=[],t;for(t=0;t<64;t+=4){n[t>>2]=r.charCodeAt(t)+(r.charCodeAt(t+1)<<8)+(r.charCodeAt(t+2)<<16)+(r.charCodeAt(t+3)<<24)}return n},c=function(r){var n=[],t;for(t=0;t<64;t+=4){n[t>>2]=r[t]+(r[t+1]<<8)+(r[t+2]<<16)+(r[t+3]<<24)}return n},h=function(r){var n=r.length,t=[1732584193,-271733879,-1732584194,271733878],u,e,o,f,c,h;for(u=64;u<=n;u+=64){a(t,i(r.substring(u-64,u)))}r=r.substring(u-64);e=r.length;o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(u=0;u<e;u+=1){o[u>>2]|=r.charCodeAt(u)<<(u%4<<3)}o[u>>2]|=128<<(u%4<<3);if(u>55){a(t,o);for(u=0;u<16;u+=1){o[u]=0}}f=n*8;f=f.toString(16).match(/(.*?)(.{0,8})$/);c=parseInt(f[2],16);h=parseInt(f[1],16)||0;o[14]=c;o[15]=h;a(t,o);return t},s=function(r){var n=r.length,t=[1732584193,-271733879,-1732584194,271733878],u,e,o,f,i,h;for(u=64;u<=n;u+=64){a(t,c(r.subarray(u-64,u)))}r=u-64<n?r.subarray(u-64):new Uint8Array(0);e=r.length;o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(u=0;u<e;u+=1){o[u>>2]|=r[u]<<(u%4<<3)}o[u>>2]|=128<<(u%4<<3);if(u>55){a(t,o);for(u=0;u<16;u+=1){o[u]=0}}f=n*8;f=f.toString(16).match(/(.*?)(.{0,8})$/);i=parseInt(f[2],16);h=parseInt(f[1],16)||0;o[14]=i;o[15]=h;a(t,o);return t},v=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],d=function(r){var n="",t;for(t=0;t<4;t+=1){n+=v[r>>t*8+4&15]+v[r>>t*8&15]}return n},g=function(r){var n;for(n=0;n<r.length;n+=1){r[n]=d(r[n])}return r.join("")},A=function(r){return g(h(r))};var b=function(){this.reset()};if(A("hello")!=="5d41402abc4b2a76b9719d911017c592"){n=function(r,n){var t=(r&65535)+(n&65535),u=(r>>16)+(n>>16)+(t>>16);return u<<16|t&65535}}b.ArrayBuffer=function(){};b.ArrayBuffer.hash=function(r){return g(s(new Uint8Array(r)))};return b});\n},{}]},{},[1])'],{type:"text/javascript"}))),n.addEventListener("message",function(t){var e=c.shift();e.callback(null,t.data),f()},!1)),e.exports={sha256:function(t,e){return s.sha256hmac(t,e)},md5:function(t,n,i){i&&"url"===i.type?u.getContentsFromUrl(t,function(t,r){return t?n(t):void e.exports.md5(r,n,{binary:!0})}):t instanceof window.File?u.getContentsFromFile(t,function(t,r){return t?n(t):void e.exports.md5(r,n,{binary:!0})}):r.nextTick(function(){l(t,n)})}}}).call(this,t("g5I+bs"))},{"./md5.min":4,"./readers":6,"./sha":8,"g5I+bs":18}],3:[function(t,e,r){"use strict";r.checkFeatures=function(t){if("undefined"!=typeof window||t){var e=r.getUnsupported(t);if(e.length)throw new Error("Browser does not support "+e.join(", "))}},r.getUnsupported=function(t){var e=t||window,r=[];return e.FileReader||r.push("FileReader"),e.ArrayBuffer||r.push("ArrayBuffer"),e.XMLHttpRequest?"upload"in new e.XMLHttpRequest||r.push("XMLHttpRequest2"):r.push("XMLHttpRequest"),r}},{}],4:[function(t,e,r){!function(t){e.exports=t()}(function(t){"use strict";var e=function(t,e){return t+e&4294967295},r=function(t,r,n,i,s,o){return r=e(e(r,t),e(i,o)),e(r<<s|r>>>32-s,n)},n=function(t,e,n,i,s,o,u){return r(e&n|~e&i,t,e,s,o,u)},i=function(t,e,n,i,s,o,u){return r(e&i|n&~i,t,e,s,o,u)},s=function(t,e,n,i,s,o,u){return r(e^n^i,t,e,s,o,u)},o=function(t,e,n,i,s,o,u){return r(n^(e|~i),t,e,s,o,u)},u=function(t,r){var u=t[0],a=t[1],h=t[2],c=t[3];u=n(u,a,h,c,r[0],7,-680876936),c=n(c,u,a,h,r[1],12,-389564586),h=n(h,c,u,a,r[2],17,606105819),a=n(a,h,c,u,r[3],22,-1044525330),u=n(u,a,h,c,r[4],7,-176418897),c=n(c,u,a,h,r[5],12,1200080426),h=n(h,c,u,a,r[6],17,-1473231341),a=n(a,h,c,u,r[7],22,-45705983),u=n(u,a,h,c,r[8],7,1770035416),c=n(c,u,a,h,r[9],12,-1958414417),h=n(h,c,u,a,r[10],17,-42063),a=n(a,h,c,u,r[11],22,-1990404162),u=n(u,a,h,c,r[12],7,1804603682),c=n(c,u,a,h,r[13],12,-40341101),h=n(h,c,u,a,r[14],17,-1502002290),a=n(a,h,c,u,r[15],22,1236535329),u=i(u,a,h,c,r[1],5,-165796510),c=i(c,u,a,h,r[6],9,-1069501632),h=i(h,c,u,a,r[11],14,643717713),a=i(a,h,c,u,r[0],20,-373897302),u=i(u,a,h,c,r[5],5,-701558691),c=i(c,u,a,h,r[10],9,38016083),h=i(h,c,u,a,r[15],14,-660478335),a=i(a,h,c,u,r[4],20,-405537848),u=i(u,a,h,c,r[9],5,568446438),c=i(c,u,a,h,r[14],9,-1019803690),h=i(h,c,u,a,r[3],14,-187363961),a=i(a,h,c,u,r[8],20,1163531501),u=i(u,a,h,c,r[13],5,-1444681467),c=i(c,u,a,h,r[2],9,-51403784),h=i(h,c,u,a,r[7],14,1735328473),a=i(a,h,c,u,r[12],20,-1926607734),u=s(u,a,h,c,r[5],4,-378558),c=s(c,u,a,h,r[8],11,-2022574463),h=s(h,c,u,a,r[11],16,1839030562),a=s(a,h,c,u,r[14],23,-35309556),u=s(u,a,h,c,r[1],4,-1530992060),c=s(c,u,a,h,r[4],11,1272893353),h=s(h,c,u,a,r[7],16,-155497632),a=s(a,h,c,u,r[10],23,-1094730640),u=s(u,a,h,c,r[13],4,681279174),c=s(c,u,a,h,r[0],11,-358537222),h=s(h,c,u,a,r[3],16,-722521979),a=s(a,h,c,u,r[6],23,76029189),u=s(u,a,h,c,r[9],4,-640364487),c=s(c,u,a,h,r[12],11,-421815835),h=s(h,c,u,a,r[15],16,530742520),a=s(a,h,c,u,r[2],23,-995338651),u=o(u,a,h,c,r[0],6,-198630844),c=o(c,u,a,h,r[7],10,1126891415),h=o(h,c,u,a,r[14],15,-1416354905),a=o(a,h,c,u,r[5],21,-57434055),u=o(u,a,h,c,r[12],6,1700485571),c=o(c,u,a,h,r[3],10,-1894986606),h=o(h,c,u,a,r[10],15,-1051523),a=o(a,h,c,u,r[1],21,-2054922799),u=o(u,a,h,c,r[8],6,1873313359),c=o(c,u,a,h,r[15],10,-30611744),h=o(h,c,u,a,r[6],15,-1560198380),a=o(a,h,c,u,r[13],21,1309151649),u=o(u,a,h,c,r[4],6,-145523070),c=o(c,u,a,h,r[11],10,-1120210379),h=o(h,c,u,a,r[2],15,718787259),a=o(a,h,c,u,r[9],21,-343485551),t[0]=e(u,t[0]),t[1]=e(a,t[1]),t[2]=e(h,t[2]),t[3]=e(c,t[3])},a=function(t){var e,r=[];for(e=0;64>e;e+=4)r[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return r},h=function(t){var e,r=[];for(e=0;64>e;e+=4)r[e>>2]=t[e]+(t[e+1]<<8)+(t[e+2]<<16)+(t[e+3]<<24);return r},c=function(t){var e,r,n,i,s,o,h=t.length,c=[1732584193,-271733879,-1732584194,271733878];for(e=64;h>=e;e+=64)u(c,a(t.substring(e-64,e)));for(t=t.substring(e-64),r=t.length,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;r>e;e+=1)n[e>>2]|=t.charCodeAt(e)<<(e%4<<3);if(n[e>>2]|=128<<(e%4<<3),e>55)for(u(c,n),e=0;16>e;e+=1)n[e]=0;return i=8*h,i=i.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),o=parseInt(i[1],16)||0,n[14]=s,n[15]=o,u(c,n),c},f=function(t){var e,r,n,i,s,o,a=t.length,c=[1732584193,-271733879,-1732584194,271733878];for(e=64;a>=e;e+=64)u(c,h(t.subarray(e-64,e)));for(t=a>e-64?t.subarray(e-64):new Uint8Array(0),r=t.length,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e=0;r>e;e+=1)n[e>>2]|=t[e]<<(e%4<<3);if(n[e>>2]|=128<<(e%4<<3),e>55)for(u(c,n),e=0;16>e;e+=1)n[e]=0;return i=8*a,i=i.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(i[2],16),o=parseInt(i[1],16)||0,n[14]=s,n[15]=o,u(c,n),c},l=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],d=function(t){var e,r="";for(e=0;4>e;e+=1)r+=l[t>>8*e+4&15]+l[t>>8*e&15];return r},p=function(t){var e;for(e=0;e<t.length;e+=1)t[e]=d(t[e]);return t.join("")},g=function(t){return p(c(t))},m=function(){this.reset()};return"5d41402abc4b2a76b9719d911017c592"!==g("hello")&&(e=function(t,e){var r=(65535&t)+(65535&e),n=(t>>16)+(e>>16)+(r>>16);return n<<16|65535&r}),m.ArrayBuffer=function(){},m.ArrayBuffer.hash=function(t){return p(f(new Uint8Array(t)))},m})},{}],5:[function(t,e,r){"use strict";e.exports=function(t){var e=document.createElement("a");return e.href=t,{protocol:e.protocol,host:e.host,query:e.search.replace(/^\?/,""),pathname:e.pathname}}},{}],6:[function(t,e,r){"use strict";r.getContentsFromFile=function(t,e){var r=new FileReader;r.onload=function(t){return e(null,t.target.result)},r.readAsArrayBuffer(t)},r.getContentsFromUrl=function(t,e){var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onreadystatechange=function(){4===r.readyState&&e(null,r.response||r.responseText)},r.send(null)}},{}],7:[function(t,e,r){"use strict";function n(t){var e=i({},t);e.method=e.method.toUpperCase(),e.uri=e.uri.toString();var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4===r.readyState&&0!==r.status&&e.onComplete){var t=null;r.status>=400&&(t=new Error("HTTP "+r.status+" "+r.statusText),t.statusCode=r.status),e.onComplete(t,o(r),e.json?JSON.parse(r.responseText):r.responseText)}},r.onerror=function(){e.onComplete(new Error("XHR error - CORS denied?"),o(r))},e.onProgress&&r.upload.addEventListener("progress",e.onProgress,!1),r.open(e.method,e.uri,!0);for(var n in e.headers)s.indexOf(n)>-1||r.setRequestHeader(n,e.headers[n]);e.json&&(r.setRequestHeader("Accept","application/json"),"boolean"!=typeof e.json&&(r.setRequestHeader("Content-Type","application/json"),e.body=JSON.stringify(e.json))),r.send(e.body)}var i=t("../utils/extend"),s=["User-Agent","Content-Length"],o=function(t){for(var e={headers:{},statusCode:t.status},r=t.getAllResponseHeaders().split("\r\n"),n=0;n<r.length;n++){var i=r[n],s=i.indexOf(": ");if(s>0){var o=i.substring(0,s),u=i.substring(s+2);e.headers[o.toLowerCase()]=u}}return e};n["short"]=function(t,e,r){var i={method:t,uri:e,onComplete:r};"GET"===t&&(i.json=!0),n(i)},n.get=function(t,e){n["short"]("GET",t,e)},n.del=function(t,e){n["short"]("DELETE",t,e)},n.head=function(t,e){n["short"]("HEAD",t,e)},e.exports=n},{"../utils/extend":15}],8:[function(t,e,r){"use strict";var n=8,i=function(t,e){var r=(65535&t)+(65535&e),n=(t>>16)+(e>>16)+(r>>16);return n<<16|65535&r},s=function(t,e){return t>>>e|t<<32-e},o=function(t,e){return t>>>e},u=function(t,e,r){return t&e^~t&r},a=function(t,e,r){return t&e^t&r^e&r},h=function(t){return s(t,2)^s(t,13)^s(t,22)},c=function(t){return s(t,6)^s(t,11)^s(t,25)},f=function(t){return s(t,7)^s(t,18)^o(t,3)},l=function(t){return s(t,17)^s(t,19)^o(t,10)},d=function(t,e){var r,n,s,o,d,p,g,m,y,v,b,w,U=[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],x=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],I=new Array(64);for(t[e>>5]|=128<<24-e%32,t[(e+64>>9<<4)+15]=e,y=0;y<t.length;y+=16){for(r=x[0],n=x[1],s=x[2],o=x[3],d=x[4],p=x[5],g=x[6],m=x[7],v=0;64>v;v++)16>v?I[v]=t[v+y]:I[v]=i(i(i(l(I[v-2]),I[v-7]),f(I[v-15])),I[v-16]),b=i(i(i(i(m,c(d)),u(d,p,g)),U[v]),I[v]),w=i(h(r),a(r,n,s)),m=g,g=p,p=d,d=i(o,b),o=s,s=n,n=r,r=i(b,w);x[0]=i(r,x[0]),x[1]=i(n,x[1]),x[2]=i(s,x[2]),x[3]=i(o,x[3]),x[4]=i(d,x[4]),x[5]=i(p,x[5]),x[6]=i(g,x[6]),x[7]=i(m,x[7])}return x},p=function(t){for(var e=[],r=(1<<n)-1,i=0;i<t.length*n;i+=n)e[i>>5]|=(t.charCodeAt(i/n)&r)<<24-i%32;return e},g=function(t){for(var e="0123456789abcdef",r="",n=0;n<4*t.length;n++)r+=e.charAt(t[n>>2]>>8*(3-n%4)+4&15)+e.charAt(t[n>>2]>>8*(3-n%4)&15);return r},m=function(t,e){var r=p(t);r.length>16&&(r=d(r,t.length*n));for(var i=new Array(16),s=new Array(16),o=0;16>o;o++)i[o]=909522486^r[o],s[o]=1549556828^r[o];var u=d(i.concat(p(e)),512+e.length*n);return d(s.concat(u),768)};r.sha256hmac=function(t,e){return g(m(t,e))}},{}],9:[function(t,e,r){"use strict";function n(t,e,r){d.checkFeatures();var n=this.options={hosts:p(t.hosts||t),publicKey:t.publicKey||e,privateKey:t.privateKey||r,user:t.user||t.publicKey||e};["publicKey","privateKey","user"].forEach(function(t){if(!n[t]||"string"!=typeof n[t])throw new Error("`options."+t+"` must be a valid string")})}var i=t("./url/url"),s=t("./url/imageurl"),o=t("./url/shorturl"),u=t("./query"),a=t("./utils/extend"),h=t("./utils/jsonparse"),c=t("./browser/crypto"),f=t("./browser/request"),l=t("./browser/readers"),d=t("./browser/feature-support"),p=t("./utils/parse-urls"),g=t("./utils/404-handler"),m="undefined"!=typeof window;a(n.prototype,{user:function(t){return this.options.user=t,this},addImage:function(t,e){return m&&t instanceof window.File?this.addImageFromBuffer(t,e):(l.getLengthOfFile(t,function(r,n){return r?e(r):void l.createReadStream(t).pipe(f({method:"POST",uri:this.getSignedResourceUrl("POST",this.getImagesUrl()),json:!0,headers:{Accept:"application/json","User-Agent":"imboclient-js","Content-Length":n},onComplete:function(t,r,n){e(t,n?n.imageIdentifier:null,n,r)}}))}.bind(this)),this)},addImageFromBuffer:function(t,e){var r=this.getSignedResourceUrl("POST",this.getImagesUrl()),n=m&&t instanceof window.File,i=e.onComplete||e,s=e.onProgress||null;return f({method:"POST",uri:r,body:t,headers:{Accept:"application/json","User-Agent":"imboclient-js","Content-Length":n?t.size:t.length},onComplete:function(t,e,r){r=h(r),i(t,r?r.imageIdentifier:null,r,e)},onProgress:s}),this},addImageFromUrl:function(t,e){return m?this.getImageDataFromUrl(t,function(t,r){return t?e(t):void this.addImageFromBuffer(r,e)}.bind(this)):(f({uri:t}).pipe(f({method:"POST",uri:this.getSignedResourceUrl("POST",this.getImagesUrl()),json:!0,headers:{Accept:"application/json","User-Agent":"imboclient-js"},onComplete:function(t,r,n){e(t,n?n.imageIdentifier:null,n,r)}})),this)},getServerStats:function(t){return f.get(this.getStatsUrl(),function(e,r,n){t(e,n,r)}),this},getServerStatus:function(t){return f.get(this.getStatusUrl(),function(e,r,n){return e?t(e):(n=n||{},n.status=r.statusCode,n.date=new Date(n.date),void t(e,n,r))}),this},getUserInfo:function(t){return f.get(this.getUserUrl(),function(e,r,n){n&&n.lastModified&&(n.lastModified=new Date(n.lastModified)),n&&!n.user&&n.publicKey&&(n.user=n.publicKey),t(e,n,r)}),this},deleteImage:function(t,e){var r=this.getImageUrl(t,{usePrimaryHost:!0}),n=this.getSignedResourceUrl("DELETE",r);return f.del(n,e),this},getImageProperties:function(t,e){return this.headImage(t,function(t,r){if(t)return e(t);var n=r.headers,i="x-imbo-original";e(t,{width:parseInt(n[i+"width"],10),height:parseInt(n[i+"height"],10),filesize:parseInt(n[i+"filesize"],10),extension:n[i+"extension"],mimetype:n[i+"mimetype"]})}),this},editMetadata:function(t,e,r,n){var i=this.getMetadataUrl(t);return f({method:n||"POST",uri:this.getSignedResourceUrl(n||"POST",i),json:e,onComplete:function(t,e,n){r(t,n,e)}}),this},replaceMetadata:function(t,e,r){return this.editMetadata(t,e,r,"PUT")},getMetadata:function(t,e){return f.get(this.getMetadataUrl(t),function(t,r,n){e(t,n,r)}),this},deleteMetadata:function(t,e){var r=this.getMetadataUrl(t);return f.del(this.getSignedResourceUrl("DELETE",r),e),this},getImages:function(t,e){return"function"!=typeof t||e||(e=t,t=null),f.get(this.getImagesUrl(t),function(t,r,n){e(t,n&&n.images,n&&n.search,r)}),this},getStatusUrl:function(){return this.getResourceUrl({path:"/status"})},getStatsUrl:function(){return this.getResourceUrl({path:"/stats"})},getUserUrl:function(){return this.getResourceUrl({path:"/users/"+this.options.user})},getImagesUrl:function(t){var e;return t&&t.users().length?e=this.getResourceUrl({path:"/images",user:null}):(e=this.getUserUrl(),e.setPath(e.getPath()+"/images")),t&&e.setQueryString(t.toString()),e},getImageUrl:function(t,e){if("string"!=typeof t||0===t.length)throw new Error('`imageIdentifier` must be a non-empty string, was "'+t+'" ('+typeof t+")");return e=e||{},new s({baseUrl:this.getHostForImageIdentifier(t,e.usePrimaryHost),path:e.path,user:this.options.user,publicKey:this.options.publicKey,privateKey:this.options.privateKey,imageIdentifier:t})},parseImageUrl:function(t,e){return s.parse(t,e||this.options.privateKey)},getMetadataUrl:function(t){return this.getImageUrl(t,{path:"/meta",usePrimaryHost:!0})},getResourceUrl:function(t){return new i({baseUrl:this.options.hosts[0],user:"undefined"!=typeof t.user?t.user:this.options.user,publicKey:this.options.publicKey,privateKey:this.options.privateKey,queryString:t.query,path:t.path})},getShortUrl:function(t,e){var r=t.clone(),n=r.getExtension(),i=r.getImageIdentifier(),s=this.getHostForImageIdentifier(i),u={imageIdentifier:i,user:r.getUser(),publicKey:r.getPublicKey(),query:r.getQueryString()};return n&&(u.extension=n),r.reset().setPath("/shorturls"),f({method:"POST",uri:this.getSignedResourceUrl("POST",r.toString()),json:u,onComplete:function(t,r,n){return t?e(t):n&&n.id?void e(t,new o({baseUrl:s,id:n.id})):e("No ShortUrl was returned from server")}}),this},deleteAllShortUrlsForImage:function(t,e){var r=this.getImageUrl(t).setPath("/shorturls"),n=this.getSignedResourceUrl("DELETE",r);return f.del(n,e),this},deleteShortUrlForImage:function(t,e,r){var n=e instanceof o?e.getId():e,i=this.getImageUrl(t).setPath("/shorturls/"+n),s=this.getSignedResourceUrl("DELETE",i);return f.del(s,r),this},getNumImages:function(t){return this.getUserInfo(function(e,r){t(e,r&&r.numImages)}),this},imageExists:function(t,e){return this.getImageChecksum(t,function(t,r){return t?e(t):void this.imageWithChecksumExists(r,e)}.bind(this)),this},imageIdentifierExists:function(t,e){return this.headImage(t,g(e)),this},imageWithChecksumExists:function(t,e){var r=(new u).originalChecksums([t]).limit(1);return this.getImages(r,function(t,r,n){if(t)return e(t);var i=n.hits>0;e(t,i,i?r[0].imageIdentifier:t)}),this},getResourceGroups:function(t){return f.get(this.getResourceUrl({path:"/groups",user:null}),function(e,r,n){t(e,n&&n.groups,n&&n.search,r)}),this},getResourceGroup:function(t,e){return f.get(this.getResourceUrl({path:"/groups/"+t,user:null}),function(t,r,n){e(t,n&&n.resources,r)}),this},addResourceGroup:function(t,e,r){return this.resourceGroupExists(t,function(n,i){return n?r(n):i?r(new Error("Resource group `"+t+"` already exists")):void this.editResourceGroup(t,e,r)}.bind(this)),this},editResourceGroup:function(t,e,r){var n=this.getResourceUrl({path:"/groups/"+t,user:null});return f({method:"PUT",uri:this.getSignedResourceUrl("PUT",n),json:e,onComplete:function(t,e,n){r(t,n,e)}}),this},deleteResourceGroup:function(t,e){var r=this.getResourceUrl({path:"/groups/"+t,user:null});return f.del(this.getSignedResourceUrl("DELETE",r),e),this},resourceGroupExists:function(t,e){return f.head(this.getResourceUrl({path:"/groups/"+t,user:null}),g(e)),this},addPublicKey:function(t,e,r){return this.publicKeyExists(t,function(n,i){return n?r(n):i?r(new Error("Public key `"+t+"` already exists")):void this.editPublicKey(t,e,r)}.bind(this)),this},editPublicKey:function(t,e,r){if(!t||!e)throw new Error("Both public key and private key must be specified");var n=this.getResourceUrl({path:"/keys/"+t,user:null});return f({method:"PUT",uri:this.getSignedResourceUrl("PUT",n),json:{privateKey:e},onComplete:r}),this},deletePublicKey:function(t,e){var r=this.getResourceUrl({path:"/keys/"+t,user:null});return f.del(this.getSignedResourceUrl("DELETE",r),e),this},publicKeyExists:function(t,e){return f.head(this.getResourceUrl({path:"/keys/"+t,user:null}),g(e)),this},getAccessControlRules:function(t,e){return f.get(this.getResourceUrl({path:"/keys/"+t+"/access",user:null}),function(t,r,n){e(t,n,r)}),this},getAccessControlRule:function(t,e,r){return f.get(this.getResourceUrl({path:"/keys/"+t+"/access/"+e,user:null}),function(t,e,n){r(t,n,e)}),this},addAccessControlRule:function(t,e,r){if(Array.isArray(e)||(e=[e]),!t)throw new Error("Public key must be a valid string");var n=this.getResourceUrl({path:"/keys/"+t+"/access",user:null});return f({method:"POST",uri:this.getSignedResourceUrl("POST",n),json:e,onComplete:function(t,e,n){r(t,n,e)}}),this},deleteAccessControlRule:function(t,e,r){var n=this.getResourceUrl({path:"/keys/"+t+"/access/"+e,user:null});return f.del(this.getSignedResourceUrl("DELETE",n),r),this},getImageData:function(t,e){var r=this.getImageUrl(t);return this.getImageDataFromUrl(r,e),this},getImageDataFromUrl:function(t,e){return l.getContentsFromUrl(t.toString(),function(t,r){e(t,t?null:r)}),this},getHostForImageIdentifier:function(t,e){if(e)return this.options.hosts[0];var r=t.charCodeAt(t.length-1);return t.match(/^[a-f0-9]{32}$/)&&(r=parseInt(t.substr(0,2),16)),this.options.hosts[r%this.options.hosts.length]},getImageChecksum:function(t,e){return c.md5(t,e),this},getImageChecksumFromBuffer:function(t,e){return c.md5(t,e,{binary:!0,type:"string"}),this},generateSignature:function(t,e,r){var n=[t,e,this.options.publicKey,r].join("|"),i=c.sha256(this.options.privateKey,n);return i},getSignedResourceUrl:function(t,e,r){var n=(r||new Date).toISOString().replace(/\.\d+Z$/,"Z"),i=this.options.user!==this.options.publicKey,s=e.toString().indexOf("?")>-1?"&":"?",o=i?e+s+"publicKey="+this.options.publicKey:e,u=this.generateSignature(t,o.toString(),n);return s=i?"&":s,s+="signature="+encodeURIComponent(u),s+="×tamp="+encodeURIComponent(n),o+s},headImage:function(t,e){return f.head(this.getImageUrl(t,{usePrimaryHost:!0}),e),this}}),n.request=f,e.exports=n},{"./browser/crypto":2,"./browser/feature-support":3,"./browser/readers":6,"./browser/request":7,"./query":10,"./url/imageurl":11,"./url/shorturl":12,"./url/url":13,"./utils/404-handler":14,"./utils/extend":15,"./utils/jsonparse":16,"./utils/parse-urls":17}],10:[function(t,e,r){"use strict";var n=t("./utils/extend"),i=function(){this.values={},this.reset()};i.SORT_DESC="desc",i.SORT_ASC="asc",n(i.prototype,{appendValue:function(t,e){return this.values[t]=this.values[t].concat(e),this},setOrGet:function(t,e){return"undefined"==typeof e?this.values[t]:(this.values[t]=[].concat(e),this)},ids:function(t){return this.setOrGet("ids",t)},addId:function(t){return this.appendValue("ids",t)},addIds:function(t){return this.addId(t)},checksums:function(t){return this.setOrGet("checksums",t)},addChecksum:function(t){return this.appendValue("checksums",t)},addChecksums:function(t){return this.addChecksum(t)},originalChecksums:function(t){return this.setOrGet("originalChecksums",t)},addOriginalChecksum:function(t){return this.appendValue("originalChecksums",t)},addOriginalChecksums:function(t){return this.addOriginalChecksum(t)},fields:function(t){return this.setOrGet("fields",t)},addField:function(t){return this.appendValue("fields",t)},addFields:function(t){return this.addField(t)},sort:function(t,e,r){if(Array.isArray(t)||"undefined"==typeof t)return this.setOrGet("sort",t);var n=(e?[t,e]:[t]).join(":");return r?this.values.sort.push(n):this.values.sort=[n],this},addSort:function(t,e){return this.sort(t,e,!0)},addSorts:function(t){return this.appendValue("sort",t)},users:function(t){return this.setOrGet("users",t)},addUser:function(t){return this.appendValue("users",t)},addUsers:function(t){return this.addUser(t)},page:function(t){return t?(this.values.page=parseInt(t,10),this):this.values.page},limit:function(t){return t?(this.values.limit=t,this):this.values.limit},metadata:function(t){return"undefined"==typeof t?this.values.metadata:(this.values.metadata=t?1:0,this)},from:function(t){return t?(this.values.from=t instanceof Date?t:this.values.from,this):this.values.from},to:function(t){return t?(this.values.to=t instanceof Date?t:this.values.to,this):this.values.to},reset:function(){var t=this.values;return t.page=1,t.limit=20,t.metadata=0,t.from=null,t.to=null,t.ids=[],t.checksums=[],t.fields=[],t.users=[],t.sort=[],t.originalChecksums=[],this},toQueryString:function(){var t,e={};for(t in this.values)!Array.isArray(this.values[t])&&this.values[t]&&(e[t]=this.values[t]);e.from&&(e.from=Math.floor(e.from.getTime()/1e3)),e.to&&(e.to=Math.floor(e.to.getTime()/1e3));var r=[];for(t in e)r.push(t+"="+e[t]);return["ids","checksums","originalChecksums","fields","users","sort"].forEach(function(t){this[t].forEach(function(e){r.push(t+"[]="+e)})}.bind(this.values)),r.join("&")},toString:function(){return this.toQueryString()}}),e.exports=i},{"./utils/extend":15}],11:[function(t,e,r){"use strict";var n=t("./url"),i=t("../utils/extend"),s=t("../browser/parseurl"),o=function(t){return parseInt(t,10)},u=function(t){return!isNaN(t)},a=function(t){return"`"+t+"`"},h=function(t){this.transformations=t.transformations||[],this.rootUrl=t.baseUrl,this.baseUrl=t.baseUrl,this.user=t.user||t.publicKey,this.publicKey=t.publicKey,this.privateKey=t.privateKey,this.imageIdentifier=t.imageIdentifier,this.extension=t.extension,this.queryString=t.queryString,this.path=t.path||"",this.baseUrl+=["/users",this.user,"images",this.imageIdentifier].join("/")};i(h.prototype,n.prototype),i(h.prototype,{autoRotate:function(){return this.append("autoRotate")},border:function(t){t=t||{};var e=["color="+(t.color||"000000").replace(/^#/,""),"width="+o(t.width||1),"height="+o(t.height||1),"mode="+(t.mode||"outbound")];return this.append("border:"+e.join(","))},canvas:function(t){if(t=t||{},!t.width||!t.height)throw new Error("width and height must be specified");var e=["width="+o(t.width),"height="+o(t.height)];return t.mode&&e.push("mode="+t.mode),t.x&&e.push("x="+o(t.x)),t.y&&e.push("y="+o(t.y)),t.bg&&e.push("bg="+t.bg.replace(/^#/,"")),this.append("canvas:"+e.join(","))},compress:function(t){var e=(t||{}).level||t;return this.append("compress:level="+(u(e)?e:75))},contrast:function(t){var e=[],r=t||{},n="contrast";return r.sharpen&&e.push("sharpen="+r.sharpen),e.length&&(n+=":"+e.join(",")),this.append(n)},convert:function(t){return this.extension=t,this},crop:function(t){var e=t||{},r=e.mode,n=e.x,i=e.y,s=e.width,a=e.height;if(!r&&(isNaN(n)||isNaN(i)))throw new Error("x and y needs to be specified without a crop mode");if("center-x"===r&&isNaN(i))throw new Error("y needs to be specified when mode is center-x");if("center-y"===r&&isNaN(n))throw new Error("x needs to be specified when mode is center-y");if(isNaN(s)||isNaN(a))throw new Error("width and height needs to be specified");var h=["width="+o(s),"height="+o(a)];return u(n)&&h.push("x="+o(n)),u(i)&&h.push("y="+o(i)),r&&h.push("mode="+r),this.append("crop:"+h.join(","))},desaturate:function(){return this.append("desaturate")},flipHorizontally:function(){return this.append("flipHorizontally")},flipVertically:function(){return this.append("flipVertically")},maxSize:function(t){var e=[];if(t.width&&e.push("width="+o(t.width)),t.height&&e.push("height="+o(t.height)),!e.length)throw new Error("width and/or height needs to be specified");return this.append("maxSize:"+e.join(","))},modulate:function(t){var e=[],r=t||{};if((u(r.brightness)||u(r.b))&&e.push("b="+(r.brightness||r.b)),(u(r.saturation)||u(r.s))&&e.push("s="+(r.saturation||r.s)),(u(r.hue)||u(r.h))&&e.push("h="+(r.hue||r.h)),!e.length)throw new Error("brightness, saturation or hue needs to be specified");return this.append("modulate:"+e.join(","))},progressive:function(){return this.append("progressive")},resize:function(t){var e=[];if(t&&t.width&&e.push("width="+o(t.width)),t&&t.height&&e.push("height="+o(t.height)),!e.length)throw new Error("width and/or height needs to be specified");return this.append("resize:"+e.join(","))},rotate:function(t){if(!t||isNaN(t.angle))throw new Error("angle needs to be specified");var e=(t.bg||"000000").replace(/^#/,"");return this.append("rotate:angle="+t.angle+",bg="+e)},sepia:function(t){var e=(t||{}).threshold||t;return this.append("sepia:threshold="+(u(e)?e:80))},sharpen:function(t){var e=[],r=t||{},n="sharpen";return r.preset&&e.push("preset="+r.preset),"undefined"!=typeof r.radius&&e.push("radius="+r.radius),"undefined"!=typeof r.sigma&&e.push("sigma="+r.sigma),"undefined"!=typeof r.gain&&e.push("gain="+r.gain),"undefined"!=typeof r.threshold&&e.push("threshold="+r.threshold), | ||
e.length&&(n+=":"+e.join(",")),this.append(n)},smartSize:function(t){var e=[],r=t||{};if(!r.width||!r.height)throw new Error("Both width and height needs to be specified");if(r.poi){var n;if(Array.isArray(r.poi))n=r.poi.map(o).join(",");else{if("undefined"==typeof r.poi.x||"undefined"==typeof r.poi.y)throw new Error("`poi` parameter must be either an array of [x, y]-coordinates or an object with `x` and `y` properties");n=o(r.poi.x)+","+o(r.poi.y)}e.push("poi="+n)}if(r.crop){var i=["close","medium","wide"];if(-1===i.indexOf(r.crop))throw new Error("`crop` parameter must be either: "+i.map(a).join(", "));e.push("crop="+r.crop)}return this.append("smartSize:"+e.join(","))},strip:function(){return this.append("strip")},thumbnail:function(t){return t=t||{},this.append(["thumbnail:width="+(t.width||50),"height="+(t.height||50),"fit="+(t.fit||"outbound")].join(","))},transpose:function(){return this.append("transpose")},transverse:function(){return this.append("transverse")},watermark:function(t){t=t||{};var e=["position="+(t.position||"top-left"),"x="+o(t.x||0),"y="+o(t.y||0)];return t.imageIdentifier&&e.push("img="+t.imageIdentifier),t.width>0&&e.push("width="+o(t.width)),t.height>0&&e.push("height="+o(t.height)),this.append("watermark:"+e.join(","))},gif:function(){return this.convert("gif")},jpg:function(){return this.convert("jpg")},png:function(){return this.convert("png")},reset:function(){return this.extension=null,this.transformations=[],this},clone:function(){return new h({transformations:this.transformations.slice(0),baseUrl:this.rootUrl,user:this.user,publicKey:this.publicKey,privateKey:this.privateKey,imageIdentifier:this.imageIdentifier,extension:this.extension,queryString:this.queryString,path:this.path})},append:function(t){return this.transformations.push(t),this},getTransformations:function(){return this.transformations},getExtension:function(){return this.extension},getImageIdentifier:function(){return this.imageIdentifier},getQueryString:function(t){var e=this.queryString||"",r=this.transformations,n=t?"t%5B%5D=":"t[]=";return t&&(r=r.map(encodeURIComponent)),this.transformations.length&&(e+=e.length?"&":"",e+=n+r.join("&"+n)),e},getBaseUrl:function(){return this.rootUrl}}),h.parse=function(t,e){var r=s(t),n=r.pathname,i=n.replace(/(.*)\/users\/.*/,"$1"),o=n.replace(/.*\/users\/(.+?)\/.*/,"$1"),u=(r.query||"").split("&").map(decodeURIComponent),a=u.filter(function(t){return 0===t.indexOf("publicKey=")}).map(function(t){return t.substring(10)})[0],c=u.filter(function(t){return 0===t.indexOf("t[]=")}).map(function(t){return t.substr(4)});return new h({baseUrl:r.protocol+"//"+r.host+i,path:n.replace(/.*\/images\/[^\/]*/,""),user:o,publicKey:a||o,privateKey:e,transformations:c,extension:n.replace(/.*\/images\/.*?(?:\.|$)(.*)/,"$1")||null,imageIdentifier:n.replace(/.*\/images\/(.+?)(\..*|$)/,"$1"),queryString:u.filter(function(t){return-1===t.indexOf("t[]=")&&-1===t.indexOf("accessToken=")&&-1===t.indexOf("publicKey=")}).join("&")})},e.exports=h},{"../browser/parseurl":5,"../utils/extend":15,"./url":13}],12:[function(t,e,r){"use strict";var n=t("../utils/extend"),i=function(t){this.baseUrl=t.baseUrl,this.shortId=t.id};n(i.prototype,{getId:function(){return this.shortId},getUrl:function(){return this.baseUrl+"/s/"+this.shortId},toString:function(){return this.getUrl()}}),e.exports=i},{"../utils/extend":15}],13:[function(t,e,r){"use strict";var n=t("../browser/crypto"),i=t("../utils/extend"),s=function(t){this.transformations=[],this.baseUrl=t.baseUrl,this.user="undefined"==typeof t.user?t.publicKey:t.user,this.publicKey=t.publicKey,this.privateKey=t.privateKey,this.extension=t.extension,this.imageIdentifier=t.imageIdentifier||"",this.path=t.path||"",this.queryString=t.queryString};i(s.prototype,{getUser:function(){return this.user},getPublicKey:function(){return this.publicKey},getPath:function(){return this.path},setPath:function(t){return this.path=t,this},setPrivateKey:function(t){return this.privateKey=t,this},getAccessToken:function(t){return n.sha256(this.privateKey,t)},setQueryString:function(t){return this.queryString=t,this},getQueryString:function(){return this.queryString||""},getUrl:function(){var t=this.extension?"."+this.extension:"",e=this.baseUrl+t+this.path,r=e,n=this.publicKey!==this.user,i=this.getQueryString();if(i.length&&(r+="?"+this.getQueryString(!0),e+="?"+i),n){var s=(e.indexOf("?")>-1?"&":"?")+"publicKey="+this.publicKey;e+=s,r+=s}return[r,e.indexOf("?")>-1?"&":"?","accessToken="+this.getAccessToken(e,this.privateKey)].join("")},toString:function(){return this.getUrl()}}),e.exports=s},{"../browser/crypto":2,"../utils/extend":15}],14:[function(t,e,r){"use strict";function n(t){return function(e,r){var n=r&&r.statusCode?r.statusCode:null,i=e&&404!==e.statusCode?e:null;t(i,200===n)}}e.exports=n},{}],15:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r in e)t[r]=e[r];return t}},{}],16:[function(t,e,r){"use strict";e.exports=function(t){var e;try{e=JSON.parse(t)}catch(r){e=null}return e}},{}],17:[function(t,e,r){"use strict";e.exports=function(t){if("string"==typeof t)t=[t];else if(!Array.isArray(t)||!t.length)throw new Error("`options.hosts` must be a string or an array of strings");for(var e=[],r=0;r<t.length;r++)e.push(t[r].replace(/:80(\/|$)/,"$1").replace(/\/$/,""));return e}},{}],18:[function(t,e,r){function n(){}var i=e.exports={};i.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var r=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),r.length>0)){var n=r.shift();n()}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=n,i.addListener=n,i.once=n,i.off=n,i.removeListener=n,i.removeAllListeners=n,i.emit=n,i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")}},{}],19:[function(t,e,r){e.exports={name:"imboclient",description:"An Imbo client for node.js and modern browsers",version:"3.0.0",author:"Espen Hovlandsdal <espen@hovlandsdal.com>",contributors:[],repository:{type:"git",url:"http://github.com/imbo/imboclient-js"},bugs:{url:"http://github.com/imbo/imboclient-js/issues"},dependencies:{request:"^2.60.0"},devDependencies:{coveralls:"^2.11.4",del:"^2.0.2",eslint:"^1.6.0","eslint-config-vaffel":"^2.0.0",gulp:"^3.9.0","gulp-browserify":"^0.5.1","gulp-insert":"^0.5.0","gulp-istanbul":"^0.10.1","gulp-mocha":"^2.1.3","gulp-rename":"^1.2.2","gulp-replace":"^0.5.4","gulp-uglify":"^1.4.2","gulp-util":"^3.0.6",nock:"^2.15.0",through:"^2.3.8",workerify:"^0.3.0"},scripts:{coveralls:"cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",lint:"eslint .",pretest:"npm run lint",test:"gulp test"},main:"index",browser:"./dist/browser-bundle.js",engines:{node:">=0.10.0"},license:"MIT"}},{}]},{},[1])(1)}); |
@@ -141,2 +141,26 @@ /** | ||
/** | ||
* Adjust contrast in the image | ||
* | ||
* @param {Object} [options={}] | ||
* @param {Number} [options.sharpen] Change in contrast given as number of steps up (positive | ||
* number) or down (negative number) | ||
* @return {Imbo.ImageUrl} | ||
*/ | ||
contrast: function(options) { | ||
var params = [], | ||
opts = options || {}, | ||
transform = 'contrast'; | ||
if (opts.sharpen) { | ||
params.push('sharpen=' + opts.sharpen); | ||
} | ||
if (params.length) { | ||
transform += ':' + params.join(','); | ||
} | ||
return this.append(transform); | ||
}, | ||
/** | ||
* Convert the image to the given file type | ||
@@ -143,0 +167,0 @@ * |
{ | ||
"name": "imboclient", | ||
"description": "An Imbo client for node.js and modern browsers", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"author": "Espen Hovlandsdal <espen@hovlandsdal.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [], |
Sorry, the diff of this file is too big to display
291744
6345