pixsy/includes/cropper.min.js

2 lines
24 KiB
JavaScript
Raw Normal View History

2020-11-05 09:52:14 +00:00
var Cropper=function(){"use strict";function t(t){if(!t)throw Error("Node is not passed or invalid selector.");var e=t;if("string"==typeof e&&!(e=document.querySelector(t)))throw Error("Invalid selector.");if(!(e instanceof window.HTMLElement))throw Error("Node should be instance of window.HTMLElement or valid selector string.");return e}function e(t){if(!t)throw Error("Config is not passed or invalid.");if("[object Object]"!==Object.prototype.toString.call(t))throw Error("Invalid config.")}function n(t){if(!t&&0!==t)throw Error("Dimension is not passed or invalid.");if("number"!=typeof t)throw Error("Invalid dimension.");if(!isFinite(t))throw Error("Invalid dimension.");if(t<0)throw Error("Invalid dimension.");return t}function i(t){if(void 0===t)return function(){};if(!t||"function"!=typeof t)throw Error("Invalid callback.");return t}function r(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}var o={width:560,height:340},s={cutout:{fill:"rgba(0, 0, 0, 0.3)"},pattern:{size:16,fill1:"rgb(215, 215, 215)",fill2:"rgb(250, 250, 250)"}},a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},u=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),c=function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,i)}if("value"in r)return r.value;var s=r.get;if(void 0!==s)return s.call(i)},l=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},f=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},_=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;h(this,t),this.width=e,this.height=n},d=function(){function t(e){if(h(this,t),this._node=e,!e||"string"==typeof e){if("svg"===e||"use"===e)return void(this._node=document.createElementNS("http://www.w3.org/2000/svg",e));this._node=document.createElement(e||"div")}}return u(t,[{key:"render",value:function(t){if(!t)throw Error("Parent node are not passed.");return t.appendChild(this._node),this}},{key:"setWidth",value:function(t){return this._node.width=t,this}},{key:"setHeight",value:function(t){return this._node.height=t,this}},{key:"getSize",value:function(){return new _(this._node.width,this._node.height)}},{key:"getNode",value:function(){return this._node}},{key:"getContext2d",value:function(){return this._node.getContext("2d")}},{key:"setType",value:function(t){return this._node.type=t,this}},{key:"addClass",value:function(t){return this._node.className+=this._node.className.length>1?" "+t:t,this}},{key:"setAttribute",value:function(t,e){return this._node.setAttribute(t,e),this}}]),t}(),g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},v=function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){!function(e,n){t.exports=function(){function t(t){var e=void 0===t?"undefined":a(t);return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){F=t}function i(t){W=t}function o(){return void 0!==D?function(){D(h)}:s()}function s(){var t=setTimeout;return function(){return t(h,1)}}function h(){for(var t=0;t<X;t+=2){(0,K[t])(K[t+1]),K[t]=void 0,K[t+1]=void 0}X=0}fu