thedesk/app/node_modules/jimp/browser/lib/jimp.min.js

27 lines
469 KiB
JavaScript
Raw Normal View History

2019-09-13 00:38:13 +10:00
/*
Jimp v0.6.3
https://github.com/oliver-moran/jimp
Ported for the Web by Phil Seaton
MIT License
Copyright (c) 2018 Oliver Moran
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
if((void 0===window||!window)&&"undefined"!=typeof self)var window=self;!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{(void 0!==window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jimp=t()}}(function(){return function o(a,s,u){function f(e,t){if(!s[e]){if(!a[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(l)return l(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[e]={exports:{}};a[e][0].call(i.exports,function(t){return f(a[e][1][t]||t)},i,i.exports,o,a,s,u)}return s[e].exports}for(var l="function"==typeof require&&require,t=0;t<u.length;t++)f(u[t]);return f}({1:[function(t,e,r){var n=t("./src/converter");function i(t,e){var r=new n(t,e);return function(t){return r.convert(t)}}i.BIN="01",i.OCT="01234567",i.DEC="0123456789",i.HEX="0123456789abcdef",e.exports=i},{"./src/converter":2}],2:[function(t,e,r){"use strict";function n(t,e){if(!(t&&e&&t.length&&e.length))throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=e}n.prototype.convert=function(t){var e,r,n,i={},o=this.srcAlphabet.length,a=this.dstAlphabet.length,s=t.length,u="string"==typeof t?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(e=0;e<s;e++)i[e]=this.srcAlphabet.indexOf(t[e]);do{for(e=n=r=0;e<s;e++)a<=(r=r*o+i[e])?(i[n++]=parseInt(r/a,10),r%=a):0<n&&(i[n++]=0);s=n,u=this.dstAlphabet.slice(r,r+1).concat(u)}while(0!==n);return u},n.prototype.isValid=function(t){for(var e=0;e<t.length;++e)if(-1===this.srcAlphabet.indexOf(t[e]))return!1;return!0},e.exports=n},{}],3:[function(w,E,t){(function(e){"use strict";function o(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function a(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var l=w("util/"),n=Object.prototype.hasOwnProperty,h=Array.prototype.slice,r="foo"===function(){}.name;function s(t){return Object.prototype.toString.call(t)}function u(t){return!a(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var f=E.exports=t,i=/\s*function\s+([^\(\s]*)\s*/;function c(t){if(l.isFunction(t)){if(r)return t.name;var e=t.toString().match(i);return e&&e[1]}}function d(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function p(t){if(r||!l.isFunction(t))return l.inspect(t);var e=c(t);return"[Function"+(e?": "+e:"")+"]"}function m(t,e,r,n,i){throw new f.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function t(t,e){t||m(t,!0,e,"==",f.ok)}function b(t,e,r,n){if(t===e)return!0;if(a(t)&&a(e))return 0===o(t,e);if(l.isDate(t)&&l.isDate(e))return t.getTime()===e.getTime();if(l.isRegExp(t)&&l.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(u(t)&&u(e)&&s(t)===s(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===o(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(a(t)!==a(e))return!1;var i=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==i&&i===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(l.isPrimitive(t)||l.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=g(t),o=g(e);if(i&&!o||!i&&o)return!1;if(i)return t=h.call(t),e=h.call(e),b(t,e,r);var a,s,u=v(t),f=v(e);if(u.length!==f.length)return!1;for(u.sort(),f.sort(),s=u.length-1;0<=s;s--)if(u[s]!==f[s])return!1;for(s=u.length-1;0<=s;s--)if(a=u[s],!b(t[a],e[a],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function g(t){return"[obj