aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-01-24 11:17:25 +0100
committerMario Vavti <mario@mariovavti.com>2018-01-24 11:17:25 +0100
commit503b2225f03c5ffe663e4e0955b25daa1bd19cf4 (patch)
tree666488330ddaeeb02bff5bd674534972aabc69b4
parente3a6b0012e95aae8e0572a53ea96ddc915d6eb03 (diff)
parent304085606fac6ae4fd2d3e29ed44afb4b4e1bc28 (diff)
downloadvolse-hubzilla-503b2225f03c5ffe663e4e0955b25daa1bd19cf4.tar.gz
volse-hubzilla-503b2225f03c5ffe663e4e0955b25daa1bd19cf4.tar.bz2
volse-hubzilla-503b2225f03c5ffe663e4e0955b25daa1bd19cf4.zip
Merge remote-tracking branch 'mike/master' into dev
-rw-r--r--LICENSE2
-rw-r--r--Zotlabs/Module/Cover_photo.php12
-rw-r--r--Zotlabs/Module/Like.php81
-rw-r--r--Zotlabs/Module/Profile_photo.php21
-rw-r--r--Zotlabs/Module/Settings/Permcats.php4
-rw-r--r--Zotlabs/Module/Siteinfo.php1
-rwxr-xr-xboot.php1
-rw-r--r--include/network.php4
-rw-r--r--library/cropper/cropper.css182
-rw-r--r--library/cropper/cropper.html228
-rw-r--r--library/cropper/cropper.js566
-rw-r--r--library/cropper/cropper.uncompressed.js1331
-rw-r--r--library/cropper/lib/builder.js101
-rw-r--r--library/cropper/lib/controls.js815
-rw-r--r--library/cropper/lib/dragdrop.js915
-rw-r--r--library/cropper/lib/effects.js958
-rw-r--r--library/cropper/lib/prototype.js2006
-rw-r--r--library/cropper/lib/scriptaculous.js47
-rw-r--r--library/cropper/lib/slider.js283
-rw-r--r--library/cropper/lib/unittest.js383
-rw-r--r--library/cropper/licence.txt12
-rw-r--r--library/cropper/marqueeHoriz.gifbin1125 -> 0 bytes
-rw-r--r--library/cropper/marqueeVert.gifbin1141 -> 0 bytes
-rw-r--r--library/cropper/tests/castle.jpgbin34429 -> 0 bytes
-rw-r--r--library/cropper/tests/castleMed.jpgbin50584 -> 0 bytes
-rw-r--r--library/cropper/tests/example-Basic.htm106
-rw-r--r--library/cropper/tests/example-CSS-Absolute.htm162
-rw-r--r--library/cropper/tests/example-CSS-Float.htm124
-rw-r--r--library/cropper/tests/example-CSS-Relative.htm116
-rw-r--r--library/cropper/tests/example-CoordsOnLoad.htm108
-rw-r--r--library/cropper/tests/example-CoordsOnLoadWithRatio.htm109
-rw-r--r--library/cropper/tests/example-Dimensions.htm225
-rw-r--r--library/cropper/tests/example-DynamicImage.htm203
-rw-r--r--library/cropper/tests/example-FixedRatio.htm104
-rw-r--r--library/cropper/tests/example-MinimumDimensions.htm105
-rw-r--r--library/cropper/tests/example-MinimumWidth.htm105
-rw-r--r--library/cropper/tests/example-Preview.htm117
-rw-r--r--library/cropper/tests/poppy.jpgbin18338 -> 0 bytes
-rw-r--r--library/cropper/tests/staticHTMLStructure.htm236
-rw-r--r--library/cropperjs/.babelrc10
-rw-r--r--library/cropperjs/.editorconfig9
-rw-r--r--library/cropperjs/.eslintrc13
-rw-r--r--library/cropperjs/.travis.yml7
-rw-r--r--library/cropperjs/CHANGELOG.md218
-rw-r--r--library/cropperjs/CONTRIBUTING.md35
-rw-r--r--library/cropperjs/ISSUE_TEMPLATE.md21
-rw-r--r--library/cropperjs/LICENSE21
-rw-r--r--library/cropperjs/README.md1028
-rw-r--r--library/cropperjs/dist/cropper.common.js3760
-rw-r--r--library/cropperjs/dist/cropper.css306
-rw-r--r--library/cropperjs/dist/cropper.esm.js3758
-rw-r--r--library/cropperjs/dist/cropper.js3766
-rw-r--r--library/cropperjs/dist/cropper.min.css9
-rw-r--r--library/cropperjs/dist/cropper.min.js10
-rw-r--r--library/cropperjs/docs/css/cropper.css306
-rw-r--r--library/cropperjs/docs/css/main.css252
-rw-r--r--library/cropperjs/docs/images/data.jpgbin0 -> 16534 bytes
-rw-r--r--library/cropperjs/docs/images/layers.jpgbin0 -> 26921 bytes
-rw-r--r--library/cropperjs/docs/images/picture-2.jpgbin0 -> 182998 bytes
-rw-r--r--library/cropperjs/docs/images/picture-3.jpgbin0 -> 224777 bytes
-rw-r--r--library/cropperjs/docs/images/picture.jpgbin0 -> 157356 bytes
-rw-r--r--library/cropperjs/docs/index.html578
-rw-r--r--library/cropperjs/docs/js/cropper.js3766
-rw-r--r--library/cropperjs/docs/js/main.js298
-rw-r--r--library/cropperjs/examples/a-range-of-aspect-ratio.html71
-rw-r--r--library/cropperjs/examples/crop-a-round-image.html103
-rw-r--r--library/cropperjs/examples/crop-cross-origin-image.html49
-rw-r--r--library/cropperjs/examples/crop-on-canvas.html64
-rw-r--r--library/cropperjs/examples/cropper-in-modal.html76
-rw-r--r--library/cropperjs/examples/customize-preview.html123
-rw-r--r--library/cropperjs/examples/fixed-crop-box.html48
-rw-r--r--library/cropperjs/examples/full-crop-box.html48
-rw-r--r--library/cropperjs/examples/mask-an-image.html123
-rw-r--r--library/cropperjs/examples/multiple-croppers.html48
-rw-r--r--library/cropperjs/examples/responsive-container.html49
-rw-r--r--library/cropperjs/package-lock.json9111
-rw-r--r--library/cropperjs/package.json76
-rw-r--r--library/cropperjs/postcss.config.js14
-rw-r--r--library/cropperjs/rollup.config.js50
-rw-r--r--library/cropperjs/src/css/cropper.css290
-rw-r--r--library/cropperjs/src/images/bg.pngbin0 -> 168 bytes
-rw-r--r--library/cropperjs/src/js/change.js471
-rw-r--r--library/cropperjs/src/js/constants.js56
-rw-r--r--library/cropperjs/src/js/cropper.js421
-rw-r--r--library/cropperjs/src/js/defaults.js99
-rw-r--r--library/cropperjs/src/js/events.js111
-rw-r--r--library/cropperjs/src/js/handlers.js212
-rw-r--r--library/cropperjs/src/js/methods.js842
-rw-r--r--library/cropperjs/src/js/preview.js142
-rw-r--r--library/cropperjs/src/js/render.js495
-rw-r--r--library/cropperjs/src/js/template.js27
-rw-r--r--library/cropperjs/src/js/utilities.js985
-rw-r--r--library/cropperjs/test/css/main.css9
-rw-r--r--library/cropperjs/test/events/crop.js21
-rw-r--r--library/cropperjs/test/events/cropend.js24
-rw-r--r--library/cropperjs/test/events/cropmove.js24
-rw-r--r--library/cropperjs/test/events/cropstart.js56
-rw-r--r--library/cropperjs/test/events/ready.js15
-rw-r--r--library/cropperjs/test/events/zoom.js46
-rw-r--r--library/cropperjs/test/index.html90
-rw-r--r--library/cropperjs/test/js/main.js74
-rw-r--r--library/cropperjs/test/methods/clear.js29
-rw-r--r--library/cropperjs/test/methods/crop.js24
-rw-r--r--library/cropperjs/test/methods/destroy.js22
-rw-r--r--library/cropperjs/test/methods/disable.js60
-rw-r--r--library/cropperjs/test/methods/enable.js23
-rw-r--r--library/cropperjs/test/methods/getCanvasData.js23
-rw-r--r--library/cropperjs/test/methods/getContainerData.js19
-rw-r--r--library/cropperjs/test/methods/getCropBoxData.js21
-rw-r--r--library/cropperjs/test/methods/getCroppedCanvas.js33
-rw-r--r--library/cropperjs/test/methods/getData.js46
-rw-r--r--library/cropperjs/test/methods/getImageData.js31
-rw-r--r--library/cropperjs/test/methods/move.js20
-rw-r--r--library/cropperjs/test/methods/moveTo.js19
-rw-r--r--library/cropperjs/test/methods/replace.js23
-rw-r--r--library/cropperjs/test/methods/reset.js35
-rw-r--r--library/cropperjs/test/methods/rotate.js19
-rw-r--r--library/cropperjs/test/methods/rotateTo.js20
-rw-r--r--library/cropperjs/test/methods/scale.js19
-rw-r--r--library/cropperjs/test/methods/scaleX.js18
-rw-r--r--library/cropperjs/test/methods/scaleY.js18
-rw-r--r--library/cropperjs/test/methods/setAspectRatio.js20
-rw-r--r--library/cropperjs/test/methods/setCanvasData.js34
-rw-r--r--library/cropperjs/test/methods/setCropBoxData.js36
-rw-r--r--library/cropperjs/test/methods/setData.js36
-rw-r--r--library/cropperjs/test/methods/setDragMode.js27
-rw-r--r--library/cropperjs/test/methods/zoom.js20
-rw-r--r--library/cropperjs/test/methods/zoomTo.js21
-rw-r--r--library/cropperjs/test/options/aspectRatio.js39
-rw-r--r--library/cropperjs/test/options/autoCrop.js39
-rw-r--r--library/cropperjs/test/options/background.js40
-rw-r--r--library/cropperjs/test/options/center.js41
-rw-r--r--library/cropperjs/test/options/checkCrossOrigin.js67
-rw-r--r--library/cropperjs/test/options/checkOrientation.js43
-rw-r--r--library/cropperjs/test/options/crop.js21
-rw-r--r--library/cropperjs/test/options/cropBoxMovable.js41
-rw-r--r--library/cropperjs/test/options/cropBoxResizable.js65
-rw-r--r--library/cropperjs/test/options/cropend.js24
-rw-r--r--library/cropperjs/test/options/cropmove.js24
-rw-r--r--library/cropperjs/test/options/cropstart.js56
-rw-r--r--library/cropperjs/test/options/data.js35
-rw-r--r--library/cropperjs/test/options/dragMode.js60
-rw-r--r--library/cropperjs/test/options/guides.js43
-rw-r--r--library/cropperjs/test/options/highlight.js41
-rw-r--r--library/cropperjs/test/options/minCanvasHeight.js23
-rw-r--r--library/cropperjs/test/options/minCanvasWidth.js23
-rw-r--r--library/cropperjs/test/options/minContainerHeight.js21
-rw-r--r--library/cropperjs/test/options/minContainerWidth.js21
-rw-r--r--library/cropperjs/test/options/minCropBoxHeight.js23
-rw-r--r--library/cropperjs/test/options/minCropBoxWidth.js23
-rw-r--r--library/cropperjs/test/options/modal.js39
-rw-r--r--library/cropperjs/test/options/movable.js45
-rw-r--r--library/cropperjs/test/options/ready.js15
-rw-r--r--library/cropperjs/test/options/rotatable.js39
-rw-r--r--library/cropperjs/test/options/scalable.js43
-rw-r--r--library/cropperjs/test/options/toggleDragModeOnDblclick.js45
-rw-r--r--library/cropperjs/test/options/viewMode.js100
-rw-r--r--library/cropperjs/test/options/zoom.js46
-rw-r--r--library/cropperjs/test/options/zoomOnWheel.js47
-rw-r--r--library/cropperjs/test/options/zoomable.js51
-rwxr-xr-xview/tpl/cropbody.tpl43
-rwxr-xr-xview/tpl/cropcover.tpl42
-rwxr-xr-xview/tpl/crophead.tpl7
-rw-r--r--view/tpl/settings_permcats.tpl2
164 files changed, 34837 insertions, 9763 deletions
diff --git a/LICENSE b/LICENSE
index 25c4bf1a3..03d45aca6 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2017 the Hubzilla Community
+Copyright (c) 2010-2018 the Hubzilla Community
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php
index 47bce6c2b..cfb513365 100644
--- a/Zotlabs/Module/Cover_photo.php
+++ b/Zotlabs/Module/Cover_photo.php
@@ -64,12 +64,12 @@ class Cover_photo extends \Zotlabs\Web\Controller {
$image_id = substr($image_id,0,-2);
}
-
- $srcX = $_POST['xstart'];
- $srcY = $_POST['ystart'];
- $srcW = $_POST['xfinal'] - $srcX;
- $srcH = $_POST['yfinal'] - $srcY;
-
+
+
+ $srcX = intval($_POST['xstart']);
+ $srcY = intval($_POST['ystart']);
+ $srcW = intval($_POST['xfinal']) - $srcX;
+ $srcH = intval($_POST['yfinal']) - $srcY;
$r = q("select gender from profile where uid = %d and is_default = 1 limit 1",
intval(local_channel())
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index b07824363..6d9fde17c 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -9,9 +9,41 @@ require_once('include/items.php');
class Like extends \Zotlabs\Web\Controller {
- function get() {
+
+
+ private function reaction_to_activity($reaction) {
+
+ $acts = [
+ 'like' => ACTIVITY_LIKE ,
+ 'dislike' => ACTIVITY_DISLIKE ,
+ 'agree' => ACTIVITY_AGREE ,
+ 'disagree' => ACTIVITY_DISAGREE ,
+ 'abstain' => ACTIVITY_ABSTAIN ,
+ 'attendyes' => ACTIVITY_ATTEND ,
+ 'attendno' => ACTIVITY_ATTENDNO ,
+ 'attendmaybe' => ACTIVITY_ATTENDMAYBE
+ ];
+
+ // unlike (etc.) reactions are an undo of positive reactions, rather than a negative action.
+ // The activity is the same in undo actions and will have the same activity mapping
+
+ if(substr($reaction,0,2) === 'un') {
+ $reaction = substr($reaction,2);
+ }
+
+ if(array_key_exists($reaction,$acts)) {
+ return $acts[$reaction];
+ }
+
+ return EMPTY_STR;
+
+ }
+
+
+
+ public function get() {
- $o = '';
+ $o = EMPTY_STR;
$sys_channel = get_sys_channel();
$sys_channel_id = (($sys_channel) ? $sys_channel['channel_id'] : 0);
@@ -35,48 +67,17 @@ class Like extends \Zotlabs\Web\Controller {
if(! $verb)
$verb = 'like';
- switch($verb) {
- case 'like':
- case 'unlike':
- $activity = ACTIVITY_LIKE;
- break;
- case 'dislike':
- case 'undislike':
- $activity = ACTIVITY_DISLIKE;
- break;
- case 'agree':
- case 'unagree':
- $activity = ACTIVITY_AGREE;
- break;
- case 'disagree':
- case 'undisagree':
- $activity = ACTIVITY_DISAGREE;
- break;
- case 'abstain':
- case 'unabstain':
- $activity = ACTIVITY_ABSTAIN;
- break;
- case 'attendyes':
- case 'unattendyes':
- $activity = ACTIVITY_ATTEND;
- break;
- case 'attendno':
- case 'unattendno':
- $activity = ACTIVITY_ATTENDNO;
- break;
- case 'attendmaybe':
- case 'unattendmaybe':
- $activity = ACTIVITY_ATTENDMAYBE;
- break;
- default:
- return;
- break;
+ $activity = $this->reaction_to_activity($verb);
+
+ if(! $activity) {
+ return EMPTY_STR;
}
+
$extended_like = false;
$object = $target = null;
- $post_type = '';
- $objtype = '';
+ $post_type = EMPTY_STR;
+ $objtype = EMPTY_STR;
if(argc() == 3) {
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 45a606d5f..222b92721 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -1,10 +1,11 @@
<?php
namespace Zotlabs\Module;
-/* @file profile_photo.php
- @brief Module-file with functions for handling of profile-photos
-
-*/
+/*
+ * @file Profile_photo.php
+ * @brief Module-file with functions for handling of profile-photos
+ *
+ */
require_once('include/photo/photo_driver.php');
@@ -55,6 +56,10 @@ class Profile_photo extends \Zotlabs\Web\Controller {
if((array_key_exists('cropfinal',$_POST)) && (intval($_POST['cropfinal']) == 1)) {
+ // logger('crop: ' . print_r($_POST,true));
+
+
+
// phase 2 - we have finished cropping
if(argc() != 2) {
@@ -86,10 +91,10 @@ class Profile_photo extends \Zotlabs\Web\Controller {
}
- $srcX = $_POST['xstart'];
- $srcY = $_POST['ystart'];
- $srcW = $_POST['xfinal'] - $srcX;
- $srcH = $_POST['yfinal'] - $srcY;
+ $srcX = intval($_POST['xstart']);
+ $srcY = intval($_POST['ystart']);
+ $srcW = intval($_POST['xfinal']) - $srcX;
+ $srcH = intval($_POST['yfinal']) - $srcY;
$r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND imgscale = %d LIMIT 1",
dbesc($image_id),
diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Settings/Permcats.php
index 336f69653..535399083 100644
--- a/Zotlabs/Module/Settings/Permcats.php
+++ b/Zotlabs/Module/Settings/Permcats.php
@@ -49,7 +49,7 @@ class Permcats {
if(argc() > 2)
- $name = argv(2);
+ $name = hex2bin(argv(2));
if(argc() > 3 && argv(3) === 'drop') {
\Zotlabs\Lib\Permcat::delete(local_channel(),$name);
@@ -70,7 +70,7 @@ class Permcats {
if(($pc['name']) && ($name) && ($pc['name'] == $name))
$existing = $pc['perms'];
if(! $pc['system'])
- $permcats[$pc['name']] = $pc['localname'];
+ $permcats[bin2hex($pc['name'])] = $pc['localname'];
}
}
diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php
index fafd51f65..92ee78cc6 100644
--- a/Zotlabs/Module/Siteinfo.php
+++ b/Zotlabs/Module/Siteinfo.php
@@ -5,7 +5,6 @@ namespace Zotlabs\Module;
class Siteinfo extends \Zotlabs\Web\Controller {
function init() {
-logger(print_r($_REQUEST,true));
if (argv(1) === 'json' || $_REQUEST['module_format'] === 'json') {
$data = get_site_info();
json_return_and_die($data);
diff --git a/boot.php b/boot.php
index ece2150e1..39047933d 100755
--- a/boot.php
+++ b/boot.php
@@ -66,6 +66,7 @@ define ( 'PROJECT_BASE', __DIR__ );
* This can be used in HTML and JavaScript where needed a line break.
*/
define ( 'EOL', '<br>' . "\r\n" );
+define ( 'EMPTY_STR', '' );
define ( 'ATOM_TIME', 'Y-m-d\\TH:i:s\\Z' ); // aka ISO 8601 "Zulu"
define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' );
diff --git a/include/network.php b/include/network.php
index 79a8c6578..2ac430e82 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1579,6 +1579,7 @@ function get_site_info() {
$channels_active_halfyear_stat = intval(get_config('system','channels_active_halfyear_stat'));
$channels_active_monthly_stat = intval(get_config('system','channels_active_monthly_stat'));
$local_posts_stat = intval(get_config('system','local_posts_stat'));
+ $local_comments_stat = intval(get_config('system','local_comments_stat'));
$hide_in_statistics = intval(get_config('system','hide_in_statistics'));
$site_expire = intval(get_config('system', 'default_expire_days'));
@@ -1612,13 +1613,14 @@ function get_site_info() {
'default_service_restrictions' => $service_class,
'locked_features' => $locked_features,
'admin' => $admin,
- 'dbdriver' => DBA::$dba->getdriver(),
+ 'dbdriver' => DBA::$dba->getdriver() . ' ' . ((ACTIVE_DBTYPE == DBTYPE_POSTGRES) ? 'postgres' : 'mysql'),
'lastpoll' => get_config('system','lastpoll'),
'info' => (($site_info) ? $site_info : ''),
'channels_total' => $channels_total_stat,
'channels_active_halfyear' => $channels_active_halfyear_stat,
'channels_active_monthly' => $channels_active_monthly_stat,
'local_posts' => $local_posts_stat,
+ 'local_comments' => $local_comments_stat,
'hide_in_statistics' => $hide_in_statistics
];
diff --git a/library/cropper/cropper.css b/library/cropper/cropper.css
deleted file mode 100644
index c2e759818..000000000
--- a/library/cropper/cropper.css
+++ /dev/null
@@ -1,182 +0,0 @@
-.imgCrop_wrap {
- /* width: 500px; @done_in_js */
- /* height: 375px; @done_in_js */
- position: relative;
- cursor: crosshair;
-}
-
-/* an extra classname is applied for Opera < 9.0 to fix it's lack of opacity support */
-.imgCrop_wrap.opera8 .imgCrop_overlay,
-.imgCrop_wrap.opera8 .imgCrop_clickArea {
- background-color: transparent;
-}
-
-/* fix for IE displaying all boxes at line-height by default, although they are still 1 pixel high until we combine them with the pointless span */
-.imgCrop_wrap,
-.imgCrop_wrap * {
- font-size: 0;
-}
-
-.imgCrop_overlay {
- background-color: #000;
- opacity: 0.5;
- filter:alpha(opacity=50);
- position: absolute;
- width: 100%;
- height: 100%;
-}
-
-.imgCrop_selArea {
- position: absolute;
- /* @done_in_js
- top: 20px;
- left: 20px;
- width: 200px;
- height: 200px;
- background: transparent url(castle.jpg) no-repeat -210px -110px;
- */
- cursor: move;
- z-index: 2;
-}
-
-/* clickArea is all a fix for IE 5.5 & 6 to allow the user to click on the given area */
-.imgCrop_clickArea {
- width: 100%;
- height: 100%;
- background-color: #FFF;
- opacity: 0.01;
- filter:alpha(opacity=01);
-}
-
-.imgCrop_marqueeHoriz {
- position: absolute;
- width: 100%;
- height: 1px;
- background: transparent url(marqueeHoriz.gif) repeat-x 0 0;
- z-index: 3;
-}
-
-.imgCrop_marqueeVert {
- position: absolute;
- height: 100%;
- width: 1px;
- background: transparent url(marqueeVert.gif) repeat-y 0 0;
- z-index: 3;
-}
-
-/*
- * FIX MARCHING ANTS IN IE
- * As IE <6 tries to load background images we can uncomment the follwoing hack
- * to remove that issue, not as pretty - but is anything in IE?
- * And yes I do know that 'filter' is evil, but it will make it look semi decent in IE
- *
-* html .imgCrop_marqueeHoriz,
-* html .imgCrop_marqueeVert {
- background: transparent;
- filter: Invert;
-}
-* html .imgCrop_marqueeNorth { border-top: 1px dashed #000; }
-* html .imgCrop_marqueeEast { border-right: 1px dashed #000; }
-* html .imgCrop_marqueeSouth { border-bottom: 1px dashed #000; }
-* html .imgCrop_marqueeWest { border-left: 1px dashed #000; }
-*/
-
-.imgCrop_marqueeNorth { top: 0; left: 0; }
-.imgCrop_marqueeEast { top: 0; right: 0; }
-.imgCrop_marqueeSouth { bottom: 0px; left: 0; }
-.imgCrop_marqueeWest { top: 0; left: 0; }
-
-
-.imgCrop_handle {
- position: absolute;
- border: 1px solid #333;
- width: 6px;
- height: 6px;
- background: #FFF;
- opacity: 0.5;
- filter:alpha(opacity=50);
- z-index: 4;
-}
-
-/* fix IE 5 box model */
-* html .imgCrop_handle {
- width: 8px;
- height: 8px;
- wid\th: 6px;
- hei\ght: 6px;
-}
-
-.imgCrop_handleN {
- top: -3px;
- left: 0;
- /* margin-left: 49%; @done_in_js */
- cursor: n-resize;
-}
-
-.imgCrop_handleNE {
- top: -3px;
- right: -3px;
- cursor: ne-resize;
-}
-
-.imgCrop_handleE {
- top: 0;
- right: -3px;
- /* margin-top: 49%; @done_in_js */
- cursor: e-resize;
-}
-
-.imgCrop_handleSE {
- right: -3px;
- bottom: -3px;
- cursor: se-resize;
-}
-
-.imgCrop_handleS {
- right: 0;
- bottom: -3px;
- /* margin-right: 49%; @done_in_js */
- cursor: s-resize;
-}
-
-.imgCrop_handleSW {
- left: -3px;
- bottom: -3px;
- cursor: sw-resize;
-}
-
-.imgCrop_handleW {
- top: 0;
- left: -3px;
- /* margin-top: 49%; @done_in_js */
- cursor: w-resize;
-}
-
-.imgCrop_handleNW {
- top: -3px;
- left: -3px;
- cursor: nw-resize;
-}
-
-/**
- * Create an area to click & drag around on as the default browser behaviour is to let you drag the image
- */
-.imgCrop_dragArea {
- width: 100%;
- height: 100%;
- z-index: 200;
- position: absolute;
- top: 0;
- left: 0;
-}
-
-.imgCrop_previewWrap {
- /* width: 200px; @done_in_js */
- /* height: 200px; @done_in_js */
- overflow: hidden;
- position: relative;
-}
-
-.imgCrop_previewWrap img {
- position: absolute;
-} \ No newline at end of file
diff --git a/library/cropper/cropper.html b/library/cropper/cropper.html
deleted file mode 100644
index 236235247..000000000
--- a/library/cropper/cropper.html
+++ /dev/null
@@ -1,228 +0,0 @@
- 1.
- <script type="text/javascript" src="scripts/cropper/lib/prototype.js" language="javascript"></script>
- 2.
- <script type="text/javascript" src="scripts/cropper/lib/scriptaculous.js?load=builder,dragdrop" language="javascript"></script>
- 3.
- <script type="text/javascript" src="scripts/cropper/cropper.js" language="javascript"></script>
-
-Options
-
-ratioDim obj
- The pixel dimensions to apply as a restrictive ratio, with properties x & y.
-minWidth int
- The minimum width for the select area in pixels.
-minHeight int
- The mimimum height for the select area in pixels.
-maxWidth int
- The maximum width for the select areas in pixels (if both minWidth & maxWidth set to same the width of the cropper will be fixed)
-maxHeight int
- The maximum height for the select areas in pixels (if both minHeight & maxHeight set to same the height of the cropper will be fixed)
-displayOnInit int
- Whether to display the select area on initialisation, only used when providing minimum width & height or ratio.
-onEndCrop func
- The callback function to provide the crop details to on end of a crop.
-captureKeys boolean
- Whether to capture the keys for moving the select area, as these can cause some problems at the moment.
-onloadCoords obj
- A coordinates object with properties x1, y1, x2 & y2; for the coordinates of the select area to display onload
-
-The callback function
-
-The callback function is a function that allows you to capture the crop co-ordinates when the user finished a crop movement, it is passed two arguments:
-
- * coords, obj, coordinates object with properties x1, y1, x2 & y2; for the coordinates of the select area.
- * dimensions, obj, dimensions object with properities width & height; for the dimensions of the select area.
-
-An example function which outputs the crop values to form fields:
-Display code as plain text
-JavaScript:
-
- 1.
- function onEndCrop( coords, dimensions ) {
- 2.
- $( 'x1' ).value = coords.x1;
- 3.
- $( 'y1' ).value = coords.y1;
- 4.
- $( 'x2' ).value = coords.x2;
- 5.
- $( 'y2' ).value = coords.y2;
- 6.
- $( 'width' ).value = dimensions.width;
- 7.
- $( 'height' ).value = dimensions.height;
- 8.
- }
-
-Basic interface
-
-This basic example will attach the cropper UI to the test image and return crop results to the provided callback function.
-Display code as plain text
-HTML:
-
- 1.
- <img src="test.jpg" alt="Test image" id="testImage" width="500" height="333" />
- 2.
-
- 3.
- <script type="text/javascript" language="javascript">
- 4.
- Event.observe( window, 'load', function() {
- 5.
- new Cropper.Img(
- 6.
- 'testImage',
- 7.
- { onEndCrop: onEndCrop }
- 8.
- );
- 9.
- } );
- 10.
- </script>
-
-Minimum dimensions
-
-You can apply minimum dimensions to a single axis or both, this example applies minimum dimensions to both axis.
-Display code as plain text
-HTML:
-
- 1.
- <img src="test.jpg" alt="Test image" id="testImage" width="500" height="333" />
- 2.
-
- 3.
- <script type="text/javascript" language="javascript">
- 4.
- Event.observe( window, 'load', function() {
- 5.
- new Cropper.Img(
- 6.
- 'testImage',
- 7.
- {
- 8.
- minWidth: 220,
- 9.
- minHeight: 120,
- 10.
- onEndCrop: onEndCrop
- 11.
- }
- 12.
- );
- 13.
- } );
- 14.
- </script>
-
-Select area ratio
-
-You can apply a ratio to the selection area, this example applies a 4:3 ratio to the select area.
-Display code as plain text
-HTML:
-
- 1.
- <img src="test.jpg" alt="Test image" id="testImage" width="500" height="333" />
- 2.
-
- 3.
- <script type="text/javascript" language="javascript">
- 4.
- Event.observe( window, 'load', function() {
- 5.
- new Cropper.Img(
- 6.
- 'testImage',
- 7.
- {
- 8.
- ratioDim: {
- 9.
- x: 220,
- 10.
- y: 165
- 11.
- },
- 12.
- displayOnInit: true,
- 13.
- onEndCrop: onEndCrop
- 14.
- }
- 15.
- );
- 16.
- } );
- 17.
- </script>
-
-With crop preview
-
-You can display a dynamically prouced preview of the resulting crop by using the ImgWithPreview subclass, a preview can only be displayed when we have a fixed size (set via minWidth & minHeight options). Note that the displayOnInit option is not required as this is the default behaviour when displaying a crop preview.
-Display code as plain text
-HTML:
-
- 1.
- <img src="test.jpg" alt="Test image" id="testImage" width="500" height="333" />
- 2.
- <div id="previewWrap"></div>
- 3.
-
- 4.
- <script type="text/javascript" language="javascript">
- 5.
- Event.observe( window, 'load', function() {
- 6.
- new Cropper.ImgWithPreview(
- 7.
- 'testImage',
- 8.
- {
- 9.
- previewWrap: 'previewWrap',
- 10.
- minWidth: 120,
- 11.
- minHeight: 120,
- 12.
- ratioDim: { x: 200, y: 120 },
- 13.
- onEndCrop: onEndCrop
- 14.
- }
- 15.
- );
- 16.
- } );
- 17.
- </script>
-
-Known Issues
-
- * Safari animated gifs, only one of each will animate, this seems to be a known Safari issue.
- * After drawing an area and then clicking to start a new drag in IE 5.5 the rendered height appears as the last height until the user drags, this appears to be the related to another IE error (which has been fixed) where IE does not always redraw the select area properly.
- * Lack of CSS opacity support in Opera before version 9 mean we disable those style rules, if Opera 8 support is important you & you want the overlay to work then you can use the Opera rules in the CSS to apply a black PNG with 50% alpha transparency to replicate the effect.
- * Styling & borders on image, any CSS styling applied directly to the image itself (floats, borders, padding, margin, etc.) will cause problems with the cropper. The use of a wrapper element to apply these styles to is recommended.
- * overflow: auto or overflow: scroll on parent will cause cropper to burst out of parent in IE and Opera when applied (maybe Mac browsers too) I'm not sure why yet.
-
-If you use CakePHP you will notice that including this in your script will break the CSS layout. This is due to the CSS rule
-
-form div{
-vertical-align: text-top;
-margin-left: 1em;
-margin-bottom:2em;
-overflow: auto;
-}
-
-A simple workaround is to add another rule directly after this like so:
-
-form div.no_cake, form div.no_cake div {
-margin:0;
-overflow:hidden;
-}
-
-and then in your code surround the img tag with a div with the class name of no_cake.
-
-Cheers
-
diff --git a/library/cropper/cropper.js b/library/cropper/cropper.js
deleted file mode 100644
index 486a92ad9..000000000
--- a/library/cropper/cropper.js
+++ /dev/null
@@ -1,566 +0,0 @@
-/**
- * Copyright (c) 2006, David Spurr (http://www.defusion.org.uk/)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * * Neither the name of the David Spurr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.opensource.org/licenses/bsd-license.php
- *
- * See scriptaculous.js for full scriptaculous licence
- */
-
-var CropDraggable=Class.create();
-Object.extend(Object.extend(CropDraggable.prototype,Draggable.prototype),{initialize:function(_1){
-this.options=Object.extend({drawMethod:function(){
-}},arguments[1]||{});
-this.element=$(_1);
-this.handle=this.element;
-this.delta=this.currentDelta();
-this.dragging=false;
-this.eventMouseDown=this.initDrag.bindAsEventListener(this);
-Event.observe(this.handle,"mousedown",this.eventMouseDown);
-Draggables.register(this);
-},draw:function(_2){
-var _3=Position.cumulativeOffset(this.element);
-var d=this.currentDelta();
-_3[0]-=d[0];
-_3[1]-=d[1];
-var p=[0,1].map(function(i){
-return (_2[i]-_3[i]-this.offset[i]);
-}.bind(this));
-this.options.drawMethod(p);
-}});
-var Cropper={};
-Cropper.Img=Class.create();
-Cropper.Img.prototype={initialize:function(_7,_8){
-this.options=Object.extend({ratioDim:{x:0,y:0},minWidth:0,minHeight:0,displayOnInit:false,onEndCrop:Prototype.emptyFunction,captureKeys:true,onloadCoords:null,maxWidth:0,maxHeight:0},_8||{});
-this.img=$(_7);
-this.clickCoords={x:0,y:0};
-this.dragging=false;
-this.resizing=false;
-this.isWebKit=/Konqueror|Safari|KHTML/.test(navigator.userAgent);
-this.isIE=/MSIE/.test(navigator.userAgent);
-this.isOpera8=/Opera\s[1-8]/.test(navigator.userAgent);
-this.ratioX=0;
-this.ratioY=0;
-this.attached=false;
-this.fixedWidth=(this.options.maxWidth>0&&(this.options.minWidth>=this.options.maxWidth));
-this.fixedHeight=(this.options.maxHeight>0&&(this.options.minHeight>=this.options.maxHeight));
-if(typeof this.img=="undefined"){
-return;
-}
-$A(document.getElementsByTagName("script")).each(function(s){
-if(s.src.match(/cropper\.js/)){
-var _a=s.src.replace(/cropper\.js(.*)?/,"");
-var _b=document.createElement("link");
-_b.rel="stylesheet";
-_b.type="text/css";
-_b.href=_a+"cropper.css";
-_b.media="screen";
-document.getElementsByTagName("head")[0].appendChild(_b);
-}
-});
-if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){
-var _c=this.getGCD(this.options.ratioDim.x,this.options.ratioDim.y);
-this.ratioX=this.options.ratioDim.x/_c;
-this.ratioY=this.options.ratioDim.y/_c;
-}
-this.subInitialize();
-if(this.img.complete||this.isWebKit){
-this.onLoad();
-}else{
-Event.observe(this.img,"load",this.onLoad.bindAsEventListener(this));
-}
-},getGCD:function(a,b){
-if(b==0){
-return a;
-}
-return this.getGCD(b,a%b);
-},onLoad:function(){
-var _f="imgCrop_";
-var _10=this.img.parentNode;
-var _11="";
-if(this.isOpera8){
-_11=" opera8";
-}
-this.imgWrap=Builder.node("div",{"class":_f+"wrap"+_11});
-this.north=Builder.node("div",{"class":_f+"overlay "+_f+"north"},[Builder.node("span")]);
-this.east=Builder.node("div",{"class":_f+"overlay "+_f+"east"},[Builder.node("span")]);
-this.south=Builder.node("div",{"class":_f+"overlay "+_f+"south"},[Builder.node("span")]);
-this.west=Builder.node("div",{"class":_f+"overlay "+_f+"west"},[Builder.node("span")]);
-var _12=[this.north,this.east,this.south,this.west];
-this.dragArea=Builder.node("div",{"class":_f+"dragArea"},_12);
-this.handleN=Builder.node("div",{"class":_f+"handle "+_f+"handleN"});
-this.handleNE=Builder.node("div",{"class":_f+"handle "+_f+"handleNE"});
-this.handleE=Builder.node("div",{"class":_f+"handle "+_f+"handleE"});
-this.handleSE=Builder.node("div",{"class":_f+"handle "+_f+"handleSE"});
-this.handleS=Builder.node("div",{"class":_f+"handle "+_f+"handleS"});
-this.handleSW=Builder.node("div",{"class":_f+"handle "+_f+"handleSW"});
-this.handleW=Builder.node("div",{"class":_f+"handle "+_f+"handleW"});
-this.handleNW=Builder.node("div",{"class":_f+"handle "+_f+"handleNW"});
-this.selArea=Builder.node("div",{"class":_f+"selArea"},[Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeNorth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeEast"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeSouth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeWest"},[Builder.node("span")]),this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW,Builder.node("div",{"class":_f+"clickArea"})]);
-this.imgWrap.appendChild(this.img);
-this.imgWrap.appendChild(this.dragArea);
-this.dragArea.appendChild(this.selArea);
-this.dragArea.appendChild(Builder.node("div",{"class":_f+"clickArea"}));
-_10.appendChild(this.imgWrap);
-this.startDragBind=this.startDrag.bindAsEventListener(this);
-Event.observe(this.dragArea,"mousedown",this.startDragBind);
-this.onDragBind=this.onDrag.bindAsEventListener(this);
-Event.observe(document,"mousemove",this.onDragBind);
-this.endCropBind=this.endCrop.bindAsEventListener(this);
-Event.observe(document,"mouseup",this.endCropBind);
-this.resizeBind=this.startResize.bindAsEventListener(this);
-this.handles=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];
-this.registerHandles(true);
-if(this.options.captureKeys){
-this.keysBind=this.handleKeys.bindAsEventListener(this);
-Event.observe(document,"keypress",this.keysBind);
-}
-new CropDraggable(this.selArea,{drawMethod:this.moveArea.bindAsEventListener(this)});
-this.setParams();
-},registerHandles:function(_13){
-for(var i=0;i<this.handles.length;i++){
-var _15=$(this.handles[i]);
-if(_13){
-var _16=false;
-if(this.fixedWidth&&this.fixedHeight){
-_16=true;
-}else{
-if(this.fixedWidth||this.fixedHeight){
-var _17=_15.className.match(/([S|N][E|W])$/);
-var _18=_15.className.match(/(E|W)$/);
-var _19=_15.className.match(/(N|S)$/);
-if(_17){
-_16=true;
-}else{
-if(this.fixedWidth&&_18){
-_16=true;
-}else{
-if(this.fixedHeight&&_19){
-_16=true;
-}
-}
-}
-}
-}
-if(_16){
-_15.hide();
-}else{
-Event.observe(_15,"mousedown",this.resizeBind);
-}
-}else{
-_15.show();
-Event.stopObserving(_15,"mousedown",this.resizeBind);
-}
-}
-},setParams:function(){
-this.imgW=this.img.width;
-this.imgH=this.img.height;
-$(this.north).setStyle({height:0});
-$(this.east).setStyle({width:0,height:0});
-$(this.south).setStyle({height:0});
-$(this.west).setStyle({width:0,height:0});
-$(this.imgWrap).setStyle({"width":this.imgW+"px","height":this.imgH+"px"});
-$(this.selArea).hide();
-var _1a={x1:0,y1:0,x2:0,y2:0};
-var _1b=false;
-if(this.options.onloadCoords!=null){
-_1a=this.cloneCoords(this.options.onloadCoords);
-_1b=true;
-}else{
-if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){
-_1a.x1=Math.ceil((this.imgW-this.options.ratioDim.x)/2);
-_1a.y1=Math.ceil((this.imgH-this.options.ratioDim.y)/2);
-_1a.x2=_1a.x1+this.options.ratioDim.x;
-_1a.y2=_1a.y1+this.options.ratioDim.y;
-_1b=true;
-}
-}
-this.setAreaCoords(_1a,false,false,1);
-if(this.options.displayOnInit&&_1b){
-this.selArea.show();
-this.drawArea();
-this.endCrop();
-}
-this.attached=true;
-},remove:function(){
-if(this.attached){
-this.attached=false;
-this.imgWrap.parentNode.insertBefore(this.img,this.imgWrap);
-this.imgWrap.parentNode.removeChild(this.imgWrap);
-Event.stopObserving(this.dragArea,"mousedown",this.startDragBind);
-Event.stopObserving(document,"mousemove",this.onDragBind);
-Event.stopObserving(document,"mouseup",this.endCropBind);
-this.registerHandles(false);
-if(this.options.captureKeys){
-Event.stopObserving(document,"keypress",this.keysBind);
-}
-}
-},reset:function(){
-if(!this.attached){
-this.onLoad();
-}else{
-this.setParams();
-}
-this.endCrop();
-},handleKeys:function(e){
-var dir={x:0,y:0};
-if(!this.dragging){
-switch(e.keyCode){
-case (37):
-dir.x=-1;
-break;
-case (38):
-dir.y=-1;
-break;
-case (39):
-dir.x=1;
-break;
-case (40):
-dir.y=1;
-break;
-}
-if(dir.x!=0||dir.y!=0){
-if(e.shiftKey){
-dir.x*=10;
-dir.y*=10;
-}
-this.moveArea([this.areaCoords.x1+dir.x,this.areaCoords.y1+dir.y]);
-Event.stop(e);
-}
-}
-},calcW:function(){
-return (this.areaCoords.x2-this.areaCoords.x1);
-},calcH:function(){
-return (this.areaCoords.y2-this.areaCoords.y1);
-},moveArea:function(_1e){
-this.setAreaCoords({x1:_1e[0],y1:_1e[1],x2:_1e[0]+this.calcW(),y2:_1e[1]+this.calcH()},true,false);
-this.drawArea();
-},cloneCoords:function(_1f){
-return {x1:_1f.x1,y1:_1f.y1,x2:_1f.x2,y2:_1f.y2};
-},setAreaCoords:function(_20,_21,_22,_23,_24){
-if(_21){
-var _25=_20.x2-_20.x1;
-var _26=_20.y2-_20.y1;
-if(_20.x1<0){
-_20.x1=0;
-_20.x2=_25;
-}
-if(_20.y1<0){
-_20.y1=0;
-_20.y2=_26;
-}
-if(_20.x2>this.imgW){
-_20.x2=this.imgW;
-_20.x1=this.imgW-_25;
-}
-if(_20.y2>this.imgH){
-_20.y2=this.imgH;
-_20.y1=this.imgH-_26;
-}
-}else{
-if(_20.x1<0){
-_20.x1=0;
-}
-if(_20.y1<0){
-_20.y1=0;
-}
-if(_20.x2>this.imgW){
-_20.x2=this.imgW;
-}
-if(_20.y2>this.imgH){
-_20.y2=this.imgH;
-}
-if(_23!=null){
-if(this.ratioX>0){
-this.applyRatio(_20,{x:this.ratioX,y:this.ratioY},_23,_24);
-}else{
-if(_22){
-this.applyRatio(_20,{x:1,y:1},_23,_24);
-}
-}
-var _27=[this.options.minWidth,this.options.minHeight];
-var _28=[this.options.maxWidth,this.options.maxHeight];
-if(_27[0]>0||_27[1]>0||_28[0]>0||_28[1]>0){
-var _29={a1:_20.x1,a2:_20.x2};
-var _2a={a1:_20.y1,a2:_20.y2};
-var _2b={min:0,max:this.imgW};
-var _2c={min:0,max:this.imgH};
-if((_27[0]!=0||_27[1]!=0)&&_22){
-if(_27[0]>0){
-_27[1]=_27[0];
-}else{
-if(_27[1]>0){
-_27[0]=_27[1];
-}
-}
-}
-if((_28[0]!=0||_28[0]!=0)&&_22){
-if(_28[0]>0&&_28[0]<=_28[1]){
-_28[1]=_28[0];
-}else{
-if(_28[1]>0&&_28[1]<=_28[0]){
-_28[0]=_28[1];
-}
-}
-}
-if(_27[0]>0){
-this.applyDimRestriction(_29,_27[0],_23.x,_2b,"min");
-}
-if(_27[1]>1){
-this.applyDimRestriction(_2a,_27[1],_23.y,_2c,"min");
-}
-if(_28[0]>0){
-this.applyDimRestriction(_29,_28[0],_23.x,_2b,"max");
-}
-if(_28[1]>1){
-this.applyDimRestriction(_2a,_28[1],_23.y,_2c,"max");
-}
-_20={x1:_29.a1,y1:_2a.a1,x2:_29.a2,y2:_2a.a2};
-}
-}
-}
-this.areaCoords=_20;
-},applyDimRestriction:function(_2d,val,_2f,_30,_31){
-var _32;
-if(_31=="min"){
-_32=((_2d.a2-_2d.a1)<val);
-}else{
-_32=((_2d.a2-_2d.a1)>val);
-}
-if(_32){
-if(_2f==1){
-_2d.a2=_2d.a1+val;
-}else{
-_2d.a1=_2d.a2-val;
-}
-if(_2d.a1<_30.min){
-_2d.a1=_30.min;
-_2d.a2=val;
-}else{
-if(_2d.a2>_30.max){
-_2d.a1=_30.max-val;
-_2d.a2=_30.max;
-}
-}
-}
-},applyRatio:function(_33,_34,_35,_36){
-var _37;
-if(_36=="N"||_36=="S"){
-_37=this.applyRatioToAxis({a1:_33.y1,b1:_33.x1,a2:_33.y2,b2:_33.x2},{a:_34.y,b:_34.x},{a:_35.y,b:_35.x},{min:0,max:this.imgW});
-_33.x1=_37.b1;
-_33.y1=_37.a1;
-_33.x2=_37.b2;
-_33.y2=_37.a2;
-}else{
-_37=this.applyRatioToAxis({a1:_33.x1,b1:_33.y1,a2:_33.x2,b2:_33.y2},{a:_34.x,b:_34.y},{a:_35.x,b:_35.y},{min:0,max:this.imgH});
-_33.x1=_37.a1;
-_33.y1=_37.b1;
-_33.x2=_37.a2;
-_33.y2=_37.b2;
-}
-},applyRatioToAxis:function(_38,_39,_3a,_3b){
-var _3c=Object.extend(_38,{});
-var _3d=_3c.a2-_3c.a1;
-var _3e=Math.floor(_3d*_39.b/_39.a);
-var _3f;
-var _40;
-var _41=null;
-if(_3a.b==1){
-_3f=_3c.b1+_3e;
-if(_3f>_3b.max){
-_3f=_3b.max;
-_41=_3f-_3c.b1;
-}
-_3c.b2=_3f;
-}else{
-_3f=_3c.b2-_3e;
-if(_3f<_3b.min){
-_3f=_3b.min;
-_41=_3f+_3c.b2;
-}
-_3c.b1=_3f;
-}
-if(_41!=null){
-_40=Math.floor(_41*_39.a/_39.b);
-if(_3a.a==1){
-_3c.a2=_3c.a1+_40;
-}else{
-_3c.a1=_3c.a1=_3c.a2-_40;
-}
-}
-return _3c;
-},drawArea:function(){
-var _42=this.calcW();
-var _43=this.calcH();
-var px="px";
-var _45=[this.areaCoords.x1+px,this.areaCoords.y1+px,_42+px,_43+px,this.areaCoords.x2+px,this.areaCoords.y2+px,(this.img.width-this.areaCoords.x2)+px,(this.img.height-this.areaCoords.y2)+px];
-var _46=this.selArea.style;
-_46.left=_45[0];
-_46.top=_45[1];
-_46.width=_45[2];
-_46.height=_45[3];
-var _47=Math.ceil((_42-6)/2)+px;
-var _48=Math.ceil((_43-6)/2)+px;
-this.handleN.style.left=_47;
-this.handleE.style.top=_48;
-this.handleS.style.left=_47;
-this.handleW.style.top=_48;
-this.north.style.height=_45[1];
-var _49=this.east.style;
-_49.top=_45[1];
-_49.height=_45[3];
-_49.left=_45[4];
-_49.width=_45[6];
-var _4a=this.south.style;
-_4a.top=_45[5];
-_4a.height=_45[7];
-var _4b=this.west.style;
-_4b.top=_45[1];
-_4b.height=_45[3];
-_4b.width=_45[0];
-this.subDrawArea();
-this.forceReRender();
-},forceReRender:function(){
-if(this.isIE||this.isWebKit){
-var n=document.createTextNode(" ");
-var d,el,fixEL,i;
-if(this.isIE){
-fixEl=this.selArea;
-}else{
-if(this.isWebKit){
-fixEl=document.getElementsByClassName("imgCrop_marqueeSouth",this.imgWrap)[0];
-d=Builder.node("div","");
-d.style.visibility="hidden";
-var _4e=["SE","S","SW"];
-for(i=0;i<_4e.length;i++){
-el=document.getElementsByClassName("imgCrop_handle"+_4e[i],this.selArea)[0];
-if(el.childNodes.length){
-el.removeChild(el.childNodes[0]);
-}
-el.appendChild(d);
-}
-}
-}
-fixEl.appendChild(n);
-fixEl.removeChild(n);
-}
-},startResize:function(e){
-this.startCoords=this.cloneCoords(this.areaCoords);
-this.resizing=true;
-this.resizeHandle=Event.element(e).classNames().toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/,"");
-Event.stop(e);
-},startDrag:function(e){
-this.selArea.show();
-this.clickCoords=this.getCurPos(e);
-this.setAreaCoords({x1:this.clickCoords.x,y1:this.clickCoords.y,x2:this.clickCoords.x,y2:this.clickCoords.y},false,false,null);
-this.dragging=true;
-this.onDrag(e);
-Event.stop(e);
-},getCurPos:function(e){
-var el=this.imgWrap,wrapOffsets=Position.cumulativeOffset(el);
-while(el.nodeName!="BODY"){
-wrapOffsets[1]-=el.scrollTop||0;
-wrapOffsets[0]-=el.scrollLeft||0;
-el=el.parentNode;
-}
-return curPos={x:Event.pointerX(e)-wrapOffsets[0],y:Event.pointerY(e)-wrapOffsets[1]};
-},onDrag:function(e){
-if(this.dragging||this.resizing){
-var _54=null;
-var _55=this.getCurPos(e);
-var _56=this.cloneCoords(this.areaCoords);
-var _57={x:1,y:1};
-if(this.dragging){
-if(_55.x<this.clickCoords.x){
-_57.x=-1;
-}
-if(_55.y<this.clickCoords.y){
-_57.y=-1;
-}
-this.transformCoords(_55.x,this.clickCoords.x,_56,"x");
-this.transformCoords(_55.y,this.clickCoords.y,_56,"y");
-}else{
-if(this.resizing){
-_54=this.resizeHandle;
-if(_54.match(/E/)){
-this.transformCoords(_55.x,this.startCoords.x1,_56,"x");
-if(_55.x<this.startCoords.x1){
-_57.x=-1;
-}
-}else{
-if(_54.match(/W/)){
-this.transformCoords(_55.x,this.startCoords.x2,_56,"x");
-if(_55.x<this.startCoords.x2){
-_57.x=-1;
-}
-}
-}
-if(_54.match(/N/)){
-this.transformCoords(_55.y,this.startCoords.y2,_56,"y");
-if(_55.y<this.startCoords.y2){
-_57.y=-1;
-}
-}else{
-if(_54.match(/S/)){
-this.transformCoords(_55.y,this.startCoords.y1,_56,"y");
-if(_55.y<this.startCoords.y1){
-_57.y=-1;
-}
-}
-}
-}
-}
-this.setAreaCoords(_56,false,e.shiftKey,_57,_54);
-this.drawArea();
-Event.stop(e);
-}
-},transformCoords:function(_58,_59,_5a,_5b){
-var _5c=[_58,_59];
-if(_58>_59){
-_5c.reverse();
-}
-_5a[_5b+"1"]=_5c[0];
-_5a[_5b+"2"]=_5c[1];
-},endCrop:function(){
-this.dragging=false;
-this.resizing=false;
-this.options.onEndCrop(this.areaCoords,{width:this.calcW(),height:this.calcH()});
-},subInitialize:function(){
-},subDrawArea:function(){
-}};
-Cropper.ImgWithPreview=Class.create();
-Object.extend(Object.extend(Cropper.ImgWithPreview.prototype,Cropper.Img.prototype),{subInitialize:function(){
-this.hasPreviewImg=false;
-if(typeof (this.options.previewWrap)!="undefined"&&this.options.minWidth>0&&this.options.minHeight>0){
-this.previewWrap=$(this.options.previewWrap);
-this.previewImg=this.img.cloneNode(false);
-this.previewImg.id="imgCrop_"+this.previewImg.id;
-this.options.displayOnInit=true;
-this.hasPreviewImg=true;
-this.previewWrap.addClassName("imgCrop_previewWrap");
-this.previewWrap.setStyle({width:this.options.minWidth+"px",height:this.options.minHeight+"px"});
-this.previewWrap.appendChild(this.previewImg);
-}
-},subDrawArea:function(){
-if(this.hasPreviewImg){
-var _5d=this.calcW();
-var _5e=this.calcH();
-var _5f={x:this.imgW/_5d,y:this.imgH/_5e};
-var _60={x:_5d/this.options.minWidth,y:_5e/this.options.minHeight};
-var _61={w:Math.ceil(this.options.minWidth*_5f.x)+"px",h:Math.ceil(this.options.minHeight*_5f.y)+"px",x:"-"+Math.ceil(this.areaCoords.x1/_60.x)+"px",y:"-"+Math.ceil(this.areaCoords.y1/_60.y)+"px"};
-var _62=this.previewImg.style;
-_62.width=_61.w;
-_62.height=_61.h;
-_62.left=_61.x;
-_62.top=_61.y;
-}
-}});
-
diff --git a/library/cropper/cropper.uncompressed.js b/library/cropper/cropper.uncompressed.js
deleted file mode 100644
index 66185546e..000000000
--- a/library/cropper/cropper.uncompressed.js
+++ /dev/null
@@ -1,1331 +0,0 @@
-/**
- * Image Cropper (v. 1.2.0 - 2006-10-30 )
- * Copyright (c) 2006 David Spurr (http://www.defusion.org.uk/)
- *
- * The image cropper provides a way to draw a crop area on an image and capture
- * the coordinates of the drawn crop area.
- *
- * Features include:
- * - Based on Prototype and Scriptaculous
- * - Image editing package styling, the crop area functions and looks
- * like those found in popular image editing software
- * - Dynamic inclusion of required styles
- * - Drag to draw areas
- * - Shift drag to draw/resize areas as squares
- * - Selection area can be moved
- * - Seleciton area can be resized using resize handles
- * - Allows dimension ratio limited crop areas
- * - Allows minimum dimension crop areas
- * - Allows maximum dimesion crop areas
- * - If both min & max dimension options set to the same value for a single axis,then the cropper will not
- * display the resize handles as appropriate (when min & max dimensions are passed for both axes this
- * results in a 'fixed size' crop area)
- * - Allows dynamic preview of resultant crop ( if minimum width & height are provided ), this is
- * implemented as a subclass so can be excluded when not required
- * - Movement of selection area by arrow keys ( shift + arrow key will move selection area by
- * 10 pixels )
- * - All operations stay within bounds of image
- * - All functionality & display compatible with most popular browsers supported by Prototype:
- * PC: IE 7, 6 & 5.5, Firefox 1.5, Opera 8.5 (see known issues) & 9.0b
- * MAC: Camino 1.0, Firefox 1.5, Safari 2.0
- *
- * Requires:
- * - Prototype v. 1.5.0_rc0 > (as packaged with Scriptaculous 1.6.1)
- * - Scriptaculous v. 1.6.1 > modules: builder, dragdrop
- *
- * Known issues:
- * - Safari animated gifs, only one of each will animate, this seems to be a known Safari issue
- *
- * - After drawing an area and then clicking to start a new drag in IE 5.5 the rendered height
- * appears as the last height until the user drags, this appears to be the related to the error
- * that the forceReRender() method fixes for IE 6, i.e. IE 5.5 is not redrawing the box properly.
- *
- * - Lack of CSS opacity support in Opera before version 9 mean we disable those style rules, these
- * could be fixed by using PNGs with transparency if Opera 8.5 support is high priority for you
- *
- * - Marching ants keep reloading in IE <6 (not tested in IE7), it is a known issue in IE and I have
- * found no viable workarounds that can be included in the release. If this really is an issue for you
- * either try this post: http://mir.aculo.us/articles/2005/08/28/internet-explorer-and-ajax-image-caching-woes
- * or uncomment the 'FIX MARCHING ANTS IN IE' rules in the CSS file
- *
- * - Styling & borders on image, any CSS styling applied directly to the image itself (floats, borders, padding, margin, etc.) will
- * cause problems with the cropper. The use of a wrapper element to apply these styles to is recommended.
- *
- * - overflow: auto or overflow: scroll on parent will cause cropper to burst out of parent in IE and Opera (maybe Mac browsers too)
- * I'm not sure why yet.
- *
- * Usage:
- * See Cropper.Img & Cropper.ImgWithPreview for usage details
- *
- * Changelog:
- * v1.2.0 - 2006-10-30
- * + Added id to the preview image element using 'imgCrop_[originalImageID]'
- * * #00001 - Fixed bug: Doesn't account for scroll offsets
- * * #00009 - Fixed bug: Placing the cropper inside differently positioned elements causes incorrect co-ordinates and display
- * * #00013 - Fixed bug: I-bar cursor appears on drag plane
- * * #00014 - Fixed bug: If ID for image tag is not found in document script throws error
- * * Fixed bug with drag start co-ordinates if wrapper element has moved in browser (e.g. dragged to a new position)
- * * Fixed bug with drag start co-ordinates if image contained in a wrapper with scrolling - this may be buggy if image
- * has other ancestors with scrolling applied (except the body)
- * * #00015 - Fixed bug: When cropper removed and then reapplied onEndCrop callback gets called multiple times, solution suggestion from Bill Smith
- * * Various speed increases & code cleanup which meant improved performance in Mac - which allowed removal of different overlay methods for
- * IE and all other browsers, which led to a fix for:
- * * #00010 - Fixed bug: Select area doesn't adhere to image size when image resized using img attributes
- * - #00006 - Removed default behaviour of automatically setting a ratio when both min width & height passed, the ratioDimensions must be passed in
- * + #00005 - Added ability to set maximum crop dimensions, if both min & max set as the same value then we'll get a fixed cropper size on the axes as appropriate
- * and the resize handles will not be displayed as appropriate
- * * Switched keydown for keypress for moving select area with cursor keys (makes for nicer action) - doesn't appear to work in Safari
- *
- * v1.1.3 - 2006-08-21
- * * Fixed wrong cursor on western handle in CSS
- * + #00008 & #00003 - Added feature: Allow to set dimensions & position for cropper on load
- * * #00002 - Fixed bug: Pressing 'remove cropper' twice removes image in IE
- *
- * v1.1.2 - 2006-06-09
- * * Fixed bugs with ratios when GCD is low (patch submitted by Andy Skelton)
- *
- * v1.1.1 - 2006-06-03
- * * Fixed bug with rendering issues fix in IE 5.5
- * * Fixed bug with endCrop callback issues once cropper had been removed & reset in IE
- *
- * v1.1.0 - 2006-06-02
- * * Fixed bug with IE constantly trying to reload select area background image
- * * Applied more robust fix to Safari & IE rendering issues
- * + Added method to reset parameters - useful for when dynamically changing img cropper attached to
- * + Added method to remove cropper from image
- *
- * v1.0.0 - 2006-05-18
- * + Initial verison
- *
- *
- * Copyright (c) 2006, David Spurr (http://www.defusion.org.uk/)
- * All rights reserved.
- *
- *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * * Neither the name of the David Spurr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://www.opensource.org/licenses/bsd-license.php
- *
- * See scriptaculous.js for full scriptaculous licence
- */
-
-/**
- * Extend the Draggable class to allow us to pass the rendering
- * down to the Cropper object.
- */
-var CropDraggable = Class.create();
-
-Object.extend( Object.extend( CropDraggable.prototype, Draggable.prototype), {
-
- initialize: function(element) {
- this.options = Object.extend(
- {
- /**
- * The draw method to defer drawing to
- */
- drawMethod: function() {}
- },
- arguments[1] || {}
- );
-
- this.element = $(element);
-
- this.handle = this.element;
-
- this.delta = this.currentDelta();
- this.dragging = false;
-
- this.eventMouseDown = this.initDrag.bindAsEventListener(this);
- Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
- Draggables.register(this);
- },
-
- /**
- * Defers the drawing of the draggable to the supplied method
- */
- draw: function(point) {
- var pos = Position.cumulativeOffset(this.element);
- var d = this.currentDelta();
- pos[0] -= d[0];
- pos[1] -= d[1];
-
- var p = [0,1].map(function(i) {
- return (point[i]-pos[i]-this.offset[i])
- }.bind(this));
-
- this.options.drawMethod( p );
- }
-
-});
-
-
-/**
- * The Cropper object, this will attach itself to the provided image by wrapping it with
- * the generated xHTML structure required by the cropper.
- *
- * Usage:
- * @param obj Image element to attach to
- * @param obj Optional options:
- * - ratioDim obj
- * The pixel dimensions to apply as a restrictive ratio, with properties x & y
- *
- * - minWidth int
- * The minimum width for the select area in pixels
- *
- * - minHeight int
- * The mimimum height for the select area in pixels
- *
- * - maxWidth int
- * The maximum width for the select areas in pixels (if both minWidth & maxWidth set to same the width of the cropper will be fixed)
- *
- * - maxHeight int
- * The maximum height for the select areas in pixels (if both minHeight & maxHeight set to same the height of the cropper will be fixed)
- *
- * - displayOnInit int
- * Whether to display the select area on initialisation, only used when providing minimum width & height or ratio
- *
- * - onEndCrop func
- * The callback function to provide the crop details to on end of a crop (see below)
- *
- * - captureKeys boolean
- * Whether to capture the keys for moving the select area, as these can cause some problems at the moment
- *
- * - onloadCoords obj
- * A coordinates object with properties x1, y1, x2 & y2; for the coordinates of the select area to display onload
- *
- *----------------------------------------------
- *
- * The callback function provided via the onEndCrop option should accept the following parameters:
- * - coords obj
- * The coordinates object with properties x1, y1, x2 & y2; for the coordinates of the select area
- *
- * - dimensions obj
- * The dimensions object with properites width & height; for the dimensions of the select area
- *
- *
- * Example:
- * function onEndCrop( coords, dimensions ) {
- * $( 'x1' ).value = coords.x1;
- * $( 'y1' ).value = coords.y1;
- * $( 'x2' ).value = coords.x2;
- * $( 'y2' ).value = coords.y2;
- * $( 'width' ).value = dimensions.width;
- * $( 'height' ).value = dimensions.height;
- * }
- *
- */
-var Cropper = {};
-Cropper.Img = Class.create();
-Cropper.Img.prototype = {
-
- /**
- * Initialises the class
- *
- * @access public
- * @param obj Image element to attach to
- * @param obj Options
- * @return void
- */
- initialize: function(element, options) {
- this.options = Object.extend(
- {
- /**
- * @var obj
- * The pixel dimensions to apply as a restrictive ratio
- */
- ratioDim: { x: 0, y: 0 },
- /**
- * @var int
- * The minimum pixel width, also used as restrictive ratio if min height passed too
- */
- minWidth: 0,
- /**
- * @var int
- * The minimum pixel height, also used as restrictive ratio if min width passed too
- */
- minHeight: 0,
- /**
- * @var boolean
- * Whether to display the select area on initialisation, only used when providing minimum width & height or ratio
- */
- displayOnInit: false,
- /**
- * @var function
- * The call back function to pass the final values to
- */
- onEndCrop: Prototype.emptyFunction,
- /**
- * @var boolean
- * Whether to capture key presses or not
- */
- captureKeys: true,
- /**
- * @var obj Coordinate object x1, y1, x2, y2
- * The coordinates to optionally display the select area at onload
- */
- onloadCoords: null,
- /**
- * @var int
- * The maximum width for the select areas in pixels (if both minWidth & maxWidth set to same the width of the cropper will be fixed)
- */
- maxWidth: 0,
- /**
- * @var int
- * The maximum height for the select areas in pixels (if both minHeight & maxHeight set to same the height of the cropper will be fixed)
- */
- maxHeight: 0
- },
- options || {}
- );
- /**
- * @var obj
- * The img node to attach to
- */
- this.img = $( element );
- /**
- * @var obj
- * The x & y coordinates of the click point
- */
- this.clickCoords = { x: 0, y: 0 };
- /**
- * @var boolean
- * Whether the user is dragging
- */
- this.dragging = false;
- /**
- * @var boolean
- * Whether the user is resizing
- */
- this.resizing = false;
- /**
- * @var boolean
- * Whether the user is on a webKit browser
- */
- this.isWebKit = /Konqueror|Safari|KHTML/.test( navigator.userAgent );
- /**
- * @var boolean
- * Whether the user is on IE
- */
- this.isIE = /MSIE/.test( navigator.userAgent );
- /**
- * @var boolean
- * Whether the user is on Opera below version 9
- */
- this.isOpera8 = /Opera\s[1-8]/.test( navigator.userAgent );
- /**
- * @var int
- * The x ratio
- */
- this.ratioX = 0;
- /**
- * @var int
- * The y ratio
- */
- this.ratioY = 0;
- /**
- * @var boolean
- * Whether we've attached sucessfully
- */
- this.attached = false;
- /**
- * @var boolean
- * Whether we've got a fixed width (if minWidth EQ or GT maxWidth then we have a fixed width
- * in the case of minWidth > maxWidth maxWidth wins as the fixed width)
- */
- this.fixedWidth = ( this.options.maxWidth > 0 && ( this.options.minWidth >= this.options.maxWidth ) );
- /**
- * @var boolean
- * Whether we've got a fixed height (if minHeight EQ or GT maxHeight then we have a fixed height
- * in the case of minHeight > maxHeight maxHeight wins as the fixed height)
- */
- this.fixedHeight = ( this.options.maxHeight > 0 && ( this.options.minHeight >= this.options.maxHeight ) );
-
- // quit if the image element doesn't exist
- if( typeof this.img == 'undefined' ) return;
-
- // include the stylesheet
- $A( document.getElementsByTagName( 'script' ) ).each(
- function(s) {
- if( s.src.match( /cropper\.js/ ) ) {
- var path = s.src.replace( /cropper\.js(.*)?/, '' );
- // '<link rel="stylesheet" type="text/css" href="' + path + 'cropper.css" media="screen" />';
- var style = document.createElement( 'link' );
- style.rel = 'stylesheet';
- style.type = 'text/css';
- style.href = path + 'cropper.css';
- style.media = 'screen';
- document.getElementsByTagName( 'head' )[0].appendChild( style );
- }
- }
- );
-
- // calculate the ratio when neccessary
- if( this.options.ratioDim.x > 0 && this.options.ratioDim.y > 0 ) {
- var gcd = this.getGCD( this.options.ratioDim.x, this.options.ratioDim.y );
- this.ratioX = this.options.ratioDim.x / gcd;
- this.ratioY = this.options.ratioDim.y / gcd;
- // dump( 'RATIO : ' + this.ratioX + ':' + this.ratioY + '\n' );
- }
-
- // initialise sub classes
- this.subInitialize();
-
- // only load the event observers etc. once the image is loaded
- // this is done after the subInitialize() call just in case the sub class does anything
- // that will affect the result of the call to onLoad()
- if( this.img.complete || this.isWebKit ) this.onLoad(); // for some reason Safari seems to support img.complete but returns 'undefined' on the this.img object
- else Event.observe( this.img, 'load', this.onLoad.bindAsEventListener( this) );
- },
-
- /**
- * The Euclidean algorithm used to find the greatest common divisor
- *
- * @acces private
- * @param int Value 1
- * @param int Value 2
- * @return int
- */
- getGCD : function( a , b ) {
- if( b == 0 ) return a;
- return this.getGCD(b, a % b );
- },
-
- /**
- * Attaches the cropper to the image once it has loaded
- *
- * @access private
- * @return void
- */
- onLoad: function( ) {
- /*
- * Build the container and all related elements, will result in the following
- *
- * <div class="imgCrop_wrap">
- * <img ... this.img ... />
- * <div class="imgCrop_dragArea">
- * <!-- the inner spans are only required for IE to stop it making the divs 1px high/wide -->
- * <div class="imgCrop_overlay imageCrop_north"><span></span></div>
- * <div class="imgCrop_overlay imageCrop_east"><span></span></div>
- * <div class="imgCrop_overlay imageCrop_south"><span></span></div>
- * <div class="imgCrop_overlay imageCrop_west"><span></span></div>
- * <div class="imgCrop_selArea">
- * <!-- marquees -->
- * <!-- the inner spans are only required for IE to stop it making the divs 1px high/wide -->
- * <div class="imgCrop_marqueeHoriz imgCrop_marqueeNorth"><span></span></div>
- * <div class="imgCrop_marqueeVert imgCrop_marqueeEast"><span></span></div>
- * <div class="imgCrop_marqueeHoriz imgCrop_marqueeSouth"><span></span></div>
- * <div class="imgCrop_marqueeVert imgCrop_marqueeWest"><span></span></div>
- * <!-- handles -->
- * <div class="imgCrop_handle imgCrop_handleN"></div>
- * <div class="imgCrop_handle imgCrop_handleNE"></div>
- * <div class="imgCrop_handle imgCrop_handleE"></div>
- * <div class="imgCrop_handle imgCrop_handleSE"></div>
- * <div class="imgCrop_handle imgCrop_handleS"></div>
- * <div class="imgCrop_handle imgCrop_handleSW"></div>
- * <div class="imgCrop_handle imgCrop_handleW"></div>
- * <div class="imgCrop_handle imgCrop_handleNW"></div>
- * <div class="imgCrop_clickArea"></div>
- * </div>
- * <div class="imgCrop_clickArea"></div>
- * </div>
- * </div>
- */
- var cNamePrefix = 'imgCrop_';
-
- // get the point to insert the container
- var insertPoint = this.img.parentNode;
-
- // apply an extra class to the wrapper to fix Opera below version 9
- var fixOperaClass = '';
- if( this.isOpera8 ) fixOperaClass = ' opera8';
- this.imgWrap = Builder.node( 'div', { 'class': cNamePrefix + 'wrap' + fixOperaClass } );
-
- this.north = Builder.node( 'div', { 'class': cNamePrefix + 'overlay ' + cNamePrefix + 'north' }, [Builder.node( 'span' )] );
- this.east = Builder.node( 'div', { 'class': cNamePrefix + 'overlay ' + cNamePrefix + 'east' } , [Builder.node( 'span' )] );
- this.south = Builder.node( 'div', { 'class': cNamePrefix + 'overlay ' + cNamePrefix + 'south' }, [Builder.node( 'span' )] );
- this.west = Builder.node( 'div', { 'class': cNamePrefix + 'overlay ' + cNamePrefix + 'west' } , [Builder.node( 'span' )] );
-
- var overlays = [ this.north, this.east, this.south, this.west ];
-
- this.dragArea = Builder.node( 'div', { 'class': cNamePrefix + 'dragArea' }, overlays );
-
- this.handleN = Builder.node( 'div', { 'class': cNamePrefix + 'handle ' + cNamePrefix + 'handleN' } );
- this.handleNE = Builder.node( 'div', { 'class': cNamePrefix + 'handle ' + cNamePrefix + 'handleNE' } );
- this.handleE = Builder.node( 'div', { 'class': cNamePrefix + 'handle ' + cNamePrefix + 'handleE' } );
- this.handleSE = Builder.node( 'div', { 'class': cNamePrefix + 'handle ' + cNamePrefix + 'handleSE' } );
- this.handleS = Builder.node( 'div', { 'class': cNamePrefix + 'handle ' + cNamePrefix + 'handleS' } );
- this.handleSW = Builder.node( 'div', { 'class': cNamePrefix + 'handle ' + cNamePrefix + 'handleSW' } );
- this.handleW = Builder.node( 'div', { 'class': cNamePrefix + 'handle ' + cNamePrefix + 'handleW' } );
- this.handleNW = Builder.node( 'div', { 'class': cNamePrefix + 'handle ' + cNamePrefix + 'handleNW' } );
-
- this.selArea = Builder.node( 'div', { 'class': cNamePrefix + 'selArea' },
- [
- Builder.node( 'div', { 'class': cNamePrefix + 'marqueeHoriz ' + cNamePrefix + 'marqueeNorth' }, [Builder.node( 'span' )] ),
- Builder.node( 'div', { 'class': cNamePrefix + 'marqueeVert ' + cNamePrefix + 'marqueeEast' } , [Builder.node( 'span' )] ),
- Builder.node( 'div', { 'class': cNamePrefix + 'marqueeHoriz ' + cNamePrefix + 'marqueeSouth' }, [Builder.node( 'span' )] ),
- Builder.node( 'div', { 'class': cNamePrefix + 'marqueeVert ' + cNamePrefix + 'marqueeWest' } , [Builder.node( 'span' )] ),
- this.handleN,
- this.handleNE,
- this.handleE,
- this.handleSE,
- this.handleS,
- this.handleSW,
- this.handleW,
- this.handleNW,
- Builder.node( 'div', { 'class': cNamePrefix + 'clickArea' } )
- ]
- );
-
- this.imgWrap.appendChild( this.img );
- this.imgWrap.appendChild( this.dragArea );
- this.dragArea.appendChild( this.selArea );
- this.dragArea.appendChild( Builder.node( 'div', { 'class': cNamePrefix + 'clickArea' } ) );
-
- insertPoint.appendChild( this.imgWrap );
-
- // add event observers
- this.startDragBind = this.startDrag.bindAsEventListener( this );
- Event.observe( this.dragArea, 'mousedown', this.startDragBind );
-
- this.onDragBind = this.onDrag.bindAsEventListener( this );
- Event.observe( document, 'mousemove', this.onDragBind );
-
- this.endCropBind = this.endCrop.bindAsEventListener( this );
- Event.observe( document, 'mouseup', this.endCropBind );
-
- this.resizeBind = this.startResize.bindAsEventListener( this );
- this.handles = [ this.handleN, this.handleNE, this.handleE, this.handleSE, this.handleS, this.handleSW, this.handleW, this.handleNW ];
- this.registerHandles( true );
-
- if( this.options.captureKeys ) {
- this.keysBind = this.handleKeys.bindAsEventListener( this );
- Event.observe( document, 'keypress', this.keysBind );
- }
-
- // attach the dragable to the select area
- new CropDraggable( this.selArea, { drawMethod: this.moveArea.bindAsEventListener( this ) } );
-
- this.setParams();
- },
-
- /**
- * Manages adding or removing the handle event handler and hiding or displaying them as appropriate
- *
- * @access private
- * @param boolean registration true = add, false = remove
- * @return void
- */
- registerHandles: function( registration ) {
- for( var i = 0; i < this.handles.length; i++ ) {
- var handle = $( this.handles[i] );
-
- if( registration ) {
- var hideHandle = false; // whether to hide the handle
-
- // disable handles asappropriate if we've got fixed dimensions
- // if both dimensions are fixed we don't need to do much
- if( this.fixedWidth && this.fixedHeight ) hideHandle = true;
- else if( this.fixedWidth || this.fixedHeight ) {
- // if one of the dimensions is fixed then just hide those handles
- var isCornerHandle = handle.className.match( /([S|N][E|W])$/ )
- var isWidthHandle = handle.className.match( /(E|W)$/ );
- var isHeightHandle = handle.className.match( /(N|S)$/ );
- if( isCornerHandle ) hideHandle = true;
- else if( this.fixedWidth && isWidthHandle ) hideHandle = true;
- else if( this.fixedHeight && isHeightHandle ) hideHandle = true;
- }
- if( hideHandle ) handle.hide();
- else Event.observe( handle, 'mousedown', this.resizeBind );
- } else {
- handle.show();
- Event.stopObserving( handle, 'mousedown', this.resizeBind );
- }
- }
- },
-
- /**
- * Sets up all the cropper parameters, this can be used to reset the cropper when dynamically
- * changing the images
- *
- * @access private
- * @return void
- */
- setParams: function() {
- /**
- * @var int
- * The image width
- */
- this.imgW = this.img.width;
- /**
- * @var int
- * The image height
- */
- this.imgH = this.img.height;
-
- $( this.north ).setStyle( { height: 0 } );
- $( this.east ).setStyle( { width: 0, height: 0 } );
- $( this.south ).setStyle( { height: 0 } );
- $( this.west ).setStyle( { width: 0, height: 0 } );
-
- // resize the container to fit the image
- $( this.imgWrap ).setStyle( { 'width': this.imgW + 'px', 'height': this.imgH + 'px' } );
-
- // hide the select area
- $( this.selArea ).hide();
-
- // setup the starting position of the select area
- var startCoords = { x1: 0, y1: 0, x2: 0, y2: 0 };
- var validCoordsSet = false;
-
- // display the select area
- if( this.options.onloadCoords != null ) {
- // if we've being given some coordinates to
- startCoords = this.cloneCoords( this.options.onloadCoords );
- validCoordsSet = true;
- } else if( this.options.ratioDim.x > 0 && this.options.ratioDim.y > 0 ) {
- // if there is a ratio limit applied and the then set it to initial ratio
- startCoords.x1 = Math.ceil( ( this.imgW - this.options.ratioDim.x ) / 2 );
- startCoords.y1 = Math.ceil( ( this.imgH - this.options.ratioDim.y ) / 2 );
- startCoords.x2 = startCoords.x1 + this.options.ratioDim.x;
- startCoords.y2 = startCoords.y1 + this.options.ratioDim.y;
- validCoordsSet = true;
- }
-
- this.setAreaCoords( startCoords, false, false, 1 );
-
- if( this.options.displayOnInit && validCoordsSet ) {
- this.selArea.show();
- this.drawArea();
- this.endCrop();
- }
-
- this.attached = true;
- },
-
- /**
- * Removes the cropper
- *
- * @access public
- * @return void
- */
- remove: function() {
- if( this.attached ) {
- this.attached = false;
-
- // remove the elements we inserted
- this.imgWrap.parentNode.insertBefore( this.img, this.imgWrap );
- this.imgWrap.parentNode.removeChild( this.imgWrap );
-
- // remove the event observers
- Event.stopObserving( this.dragArea, 'mousedown', this.startDragBind );
- Event.stopObserving( document, 'mousemove', this.onDragBind );
- Event.stopObserving( document, 'mouseup', this.endCropBind );
- this.registerHandles( false );
- if( this.options.captureKeys ) Event.stopObserving( document, 'keypress', this.keysBind );
- }
- },
-
- /**
- * Resets the cropper, can be used either after being removed or any time you wish
- *
- * @access public
- * @return void
- */
- reset: function() {
- if( !this.attached ) this.onLoad();
- else this.setParams();
- this.endCrop();
- },
-
- /**
- * Handles the key functionality, currently just using arrow keys to move, if the user
- * presses shift then the area will move by 10 pixels
- */
- handleKeys: function( e ) {
- var dir = { x: 0, y: 0 }; // direction to move it in & the amount in pixels
- if( !this.dragging ) {
-
- // catch the arrow keys
- switch( e.keyCode ) {
- case( 37 ) : // left
- dir.x = -1;
- break;
- case( 38 ) : // up
- dir.y = -1;
- break;
- case( 39 ) : // right
- dir.x = 1;
- break
- case( 40 ) : // down
- dir.y = 1;
- break;
- }
-
- if( dir.x != 0 || dir.y != 0 ) {
- // if shift is pressed then move by 10 pixels
- if( e.shiftKey ) {
- dir.x *= 10;
- dir.y *= 10;
- }
-
- this.moveArea( [ this.areaCoords.x1 + dir.x, this.areaCoords.y1 + dir.y ] );
- Event.stop( e );
- }
- }
- },
-
- /**
- * Calculates the width from the areaCoords
- *
- * @access private
- * @return int
- */
- calcW: function() {
- return (this.areaCoords.x2 - this.areaCoords.x1)
- },
-
- /**
- * Calculates the height from the areaCoords
- *
- * @access private
- * @return int
- */
- calcH: function() {
- return (this.areaCoords.y2 - this.areaCoords.y1)
- },
-
- /**
- * Moves the select area to the supplied point (assumes the point is x1 & y1 of the select area)
- *
- * @access public
- * @param array Point for x1 & y1 to move select area to
- * @return void
- */
- moveArea: function( point ) {
- // dump( 'moveArea : ' + point[0] + ',' + point[1] + ',' + ( point[0] + ( this.areaCoords.x2 - this.areaCoords.x1 ) ) + ',' + ( point[1] + ( this.areaCoords.y2 - this.areaCoords.y1 ) ) + '\n' );
- this.setAreaCoords(
- {
- x1: point[0],
- y1: point[1],
- x2: point[0] + this.calcW(),
- y2: point[1] + this.calcH()
- },
- true,
- false
- );
- this.drawArea();
- },
-
- /**
- * Clones a co-ordinates object, stops problems with handling them by reference
- *
- * @access private
- * @param obj Coordinate object x1, y1, x2, y2
- * @return obj Coordinate object x1, y1, x2, y2
- */
- cloneCoords: function( coords ) {
- return { x1: coords.x1, y1: coords.y1, x2: coords.x2, y2: coords.y2 };
- },
-
- /**
- * Sets the select coords to those provided but ensures they don't go
- * outside the bounding box
- *
- * @access private
- * @param obj Coordinates x1, y1, x2, y2
- * @param boolean Whether this is a move
- * @param boolean Whether to apply squaring
- * @param obj Direction of mouse along both axis x, y ( -1 = negative, 1 = positive ) only required when moving etc.
- * @param string The current resize handle || null
- * @return void
- */
- setAreaCoords: function( coords, moving, square, direction, resizeHandle ) {
- // dump( 'setAreaCoords (in) : ' + coords.x1 + ',' + coords.y1 + ',' + coords.x2 + ',' + coords.y2 );
- if( moving ) {
- // if moving
- var targW = coords.x2 - coords.x1;
- var targH = coords.y2 - coords.y1;
-
- // ensure we're within the bounds
- if( coords.x1 < 0 ) {
- coords.x1 = 0;
- coords.x2 = targW;
- }
- if( coords.y1 < 0 ) {
- coords.y1 = 0;
- coords.y2 = targH;
- }
- if( coords.x2 > this.imgW ) {
- coords.x2 = this.imgW;
- coords.x1 = this.imgW - targW;
- }
- if( coords.y2 > this.imgH ) {
- coords.y2 = this.imgH;
- coords.y1 = this.imgH - targH;
- }
- } else {
- // ensure we're within the bounds
- if( coords.x1 < 0 ) coords.x1 = 0;
- if( coords.y1 < 0 ) coords.y1 = 0;
- if( coords.x2 > this.imgW ) coords.x2 = this.imgW;
- if( coords.y2 > this.imgH ) coords.y2 = this.imgH;
-
- // This is passed as null in onload
- if( direction != null ) {
-
- // apply the ratio or squaring where appropriate
- if( this.ratioX > 0 ) this.applyRatio( coords, { x: this.ratioX, y: this.ratioY }, direction, resizeHandle );
- else if( square ) this.applyRatio( coords, { x: 1, y: 1 }, direction, resizeHandle );
-
- var mins = [ this.options.minWidth, this.options.minHeight ]; // minimum dimensions [x,y]
- var maxs = [ this.options.maxWidth, this.options.maxHeight ]; // maximum dimensions [x,y]
-
- // apply dimensions where appropriate
- if( mins[0] > 0 || mins[1] > 0 || maxs[0] > 0 || maxs[1] > 0) {
-
- var coordsTransX = { a1: coords.x1, a2: coords.x2 };
- var coordsTransY = { a1: coords.y1, a2: coords.y2 };
- var boundsX = { min: 0, max: this.imgW };
- var boundsY = { min: 0, max: this.imgH };
-
- // handle squaring properly on single axis minimum dimensions
- if( (mins[0] != 0 || mins[1] != 0) && square ) {
- if( mins[0] > 0 ) mins[1] = mins[0];
- else if( mins[1] > 0 ) mins[0] = mins[1];
- }
-
- if( (maxs[0] != 0 || maxs[0] != 0) && square ) {
- // if we have a max x value & it is less than the max y value then we set the y max to the max x (so we don't go over the minimum maximum of one of the axes - if that makes sense)
- if( maxs[0] > 0 && maxs[0] <= maxs[1] ) maxs[1] = maxs[0];
- else if( maxs[1] > 0 && maxs[1] <= maxs[0] ) maxs[0] = maxs[1];
- }
-
- if( mins[0] > 0 ) this.applyDimRestriction( coordsTransX, mins[0], direction.x, boundsX, 'min' );
- if( mins[1] > 1 ) this.applyDimRestriction( coordsTransY, mins[1], direction.y, boundsY, 'min' );
-
- if( maxs[0] > 0 ) this.applyDimRestriction( coordsTransX, maxs[0], direction.x, boundsX, 'max' );
- if( maxs[1] > 1 ) this.applyDimRestriction( coordsTransY, maxs[1], direction.y, boundsY, 'max' );
-
- coords = { x1: coordsTransX.a1, y1: coordsTransY.a1, x2: coordsTransX.a2, y2: coordsTransY.a2 };
- }
-
- }
- }
-
- // dump( 'setAreaCoords (out) : ' + coords.x1 + ',' + coords.y1 + ',' + coords.x2 + ',' + coords.y2 + '\n' );
- this.areaCoords = coords;
- },
-
- /**
- * Applies the supplied dimension restriction to the supplied coordinates along a single axis
- *
- * @access private
- * @param obj Single axis coordinates, a1, a2 (e.g. for the x axis a1 = x1 & a2 = x2)
- * @param int The restriction value
- * @param int The direction ( -1 = negative, 1 = positive )
- * @param obj The bounds of the image ( for this axis )
- * @param string The dimension restriction type ( 'min' | 'max' )
- * @return void
- */
- applyDimRestriction: function( coords, val, direction, bounds, type ) {
- var check;
- if( type == 'min' ) check = ( ( coords.a2 - coords.a1 ) < val );
- else check = ( ( coords.a2 - coords.a1 ) > val );
- if( check ) {
- if( direction == 1 ) coords.a2 = coords.a1 + val;
- else coords.a1 = coords.a2 - val;
-
- // make sure we're still in the bounds (not too pretty for the user, but needed)
- if( coords.a1 < bounds.min ) {
- coords.a1 = bounds.min;
- coords.a2 = val;
- } else if( coords.a2 > bounds.max ) {
- coords.a1 = bounds.max - val;
- coords.a2 = bounds.max;
- }
- }
- },
-
- /**
- * Applies the supplied ratio to the supplied coordinates
- *
- * @access private
- * @param obj Coordinates, x1, y1, x2, y2
- * @param obj Ratio, x, y
- * @param obj Direction of mouse, x & y : -1 == negative 1 == positive
- * @param string The current resize handle || null
- * @return void
- */
- applyRatio : function( coords, ratio, direction, resizeHandle ) {
- // dump( 'direction.y : ' + direction.y + '\n');
- var newCoords;
- if( resizeHandle == 'N' || resizeHandle == 'S' ) {
- // dump( 'north south \n');
- // if moving on either the lone north & south handles apply the ratio on the y axis
- newCoords = this.applyRatioToAxis(
- { a1: coords.y1, b1: coords.x1, a2: coords.y2, b2: coords.x2 },
- { a: ratio.y, b: ratio.x },
- { a: direction.y, b: direction.x },
- { min: 0, max: this.imgW }
- );
- coords.x1 = newCoords.b1;
- coords.y1 = newCoords.a1;
- coords.x2 = newCoords.b2;
- coords.y2 = newCoords.a2;
- } else {
- // otherwise deal with it as if we're applying the ratio on the x axis
- newCoords = this.applyRatioToAxis(
- { a1: coords.x1, b1: coords.y1, a2: coords.x2, b2: coords.y2 },
- { a: ratio.x, b: ratio.y },
- { a: direction.x, b: direction.y },
- { min: 0, max: this.imgH }
- );
- coords.x1 = newCoords.a1;
- coords.y1 = newCoords.b1;
- coords.x2 = newCoords.a2;
- coords.y2 = newCoords.b2;
- }
-
- },
-
- /**
- * Applies the provided ratio to the provided coordinates based on provided direction & bounds,
- * use to encapsulate functionality to make it easy to apply to either axis. This is probably
- * quite hard to visualise so see the x axis example within applyRatio()
- *
- * Example in parameter details & comments is for requesting applying ratio to x axis.
- *
- * @access private
- * @param obj Coords object (a1, b1, a2, b2) where a = x & b = y in example
- * @param obj Ratio object (a, b) where a = x & b = y in example
- * @param obj Direction object (a, b) where a = x & b = y in example
- * @param obj Bounds (min, max)
- * @return obj Coords object (a1, b1, a2, b2) where a = x & b = y in example
- */
- applyRatioToAxis: function( coords, ratio, direction, bounds ) {
- var newCoords = Object.extend( coords, {} );
- var calcDimA = newCoords.a2 - newCoords.a1; // calculate dimension a (e.g. width)
- var targDimB = Math.floor( calcDimA * ratio.b / ratio.a ); // the target dimension b (e.g. height)
- var targB; // to hold target b (e.g. y value)
- var targDimA; // to hold target dimension a (e.g. width)
- var calcDimB = null; // to hold calculated dimension b (e.g. height)
-
- // dump( 'newCoords[0]: ' + newCoords.a1 + ',' + newCoords.b1 + ','+ newCoords.a2 + ',' + newCoords.b2 + '\n');
-
- if( direction.b == 1 ) { // if travelling in a positive direction
- // make sure we're not going out of bounds
- targB = newCoords.b1 + targDimB;
- if( targB > bounds.max ) {
- targB = bounds.max;
- calcDimB = targB - newCoords.b1; // calcuate dimension b (e.g. height)
- }
-
- newCoords.b2 = targB;
- } else { // if travelling in a negative direction
- // make sure we're not going out of bounds
- targB = newCoords.b2 - targDimB;
- if( targB < bounds.min ) {
- targB = bounds.min;
- calcDimB = targB + newCoords.b2; // calcuate dimension b (e.g. height)
- }
- newCoords.b1 = targB;
- }
-
- // dump( 'newCoords[1]: ' + newCoords.a1 + ',' + newCoords.b1 + ','+ newCoords.a2 + ',' + newCoords.b2 + '\n');
-
- // apply the calculated dimensions
- if( calcDimB != null ) {
- targDimA = Math.floor( calcDimB * ratio.a / ratio.b );
-
- if( direction.a == 1 ) newCoords.a2 = newCoords.a1 + targDimA;
- else newCoords.a1 = newCoords.a1 = newCoords.a2 - targDimA;
- }
-
- // dump( 'newCoords[2]: ' + newCoords.a1 + ',' + newCoords.b1 + ','+ newCoords.a2 + ',' + newCoords.b2 + '\n');
-
- return newCoords;
- },
-
- /**
- * Draws the select area
- *
- * @access private
- * @return void
- */
- drawArea: function( ) {
- /*
- * NOTE: I'm not using the Element.setStyle() shortcut as they make it
- * quite sluggish on Mac based browsers
- */
- // dump( 'drawArea : ' + this.areaCoords.x1 + ',' + this.areaCoords.y1 + ',' + this.areaCoords.x2 + ',' + this.areaCoords.y2 + '\n' );
- var areaWidth = this.calcW();
- var areaHeight = this.calcH();
-
- /*
- * Calculate all the style strings before we use them, allows reuse & produces quicker
- * rendering (especially noticable in Mac based browsers)
- */
- var px = 'px';
- var params = [
- this.areaCoords.x1 + px, // the left of the selArea
- this.areaCoords.y1 + px, // the top of the selArea
- areaWidth + px, // width of the selArea
- areaHeight + px, // height of the selArea
- this.areaCoords.x2 + px, // bottom of the selArea
- this.areaCoords.y2 + px, // right of the selArea
- (this.img.width - this.areaCoords.x2) + px, // right edge of selArea
- (this.img.height - this.areaCoords.y2) + px // bottom edge of selArea
- ];
-
- // do the select area
- var areaStyle = this.selArea.style;
- areaStyle.left = params[0];
- areaStyle.top = params[1];
- areaStyle.width = params[2];
- areaStyle.height = params[3];
-
- // position the north, east, south & west handles
- var horizHandlePos = Math.ceil( (areaWidth - 6) / 2 ) + px;
- var vertHandlePos = Math.ceil( (areaHeight - 6) / 2 ) + px;
-
- this.handleN.style.left = horizHandlePos;
- this.handleE.style.top = vertHandlePos;
- this.handleS.style.left = horizHandlePos;
- this.handleW.style.top = vertHandlePos;
-
- // draw the four overlays
- this.north.style.height = params[1];
-
- var eastStyle = this.east.style;
- eastStyle.top = params[1];
- eastStyle.height = params[3];
- eastStyle.left = params[4];
- eastStyle.width = params[6];
-
- var southStyle = this.south.style;
- southStyle.top = params[5];
- southStyle.height = params[7];
-
- var westStyle = this.west.style;
- westStyle.top = params[1];
- westStyle.height = params[3];
- westStyle.width = params[0];
-
- // call the draw method on sub classes
- this.subDrawArea();
-
- this.forceReRender();
- },
-
- /**
- * Force the re-rendering of the selArea element which fixes rendering issues in Safari
- * & IE PC, especially evident when re-sizing perfectly vertical using any of the south handles
- *
- * @access private
- * @return void
- */
- forceReRender: function() {
- if( this.isIE || this.isWebKit) {
- var n = document.createTextNode(' ');
- var d,el,fixEL,i;
-
- if( this.isIE ) fixEl = this.selArea;
- else if( this.isWebKit ) {
- fixEl = document.getElementsByClassName( 'imgCrop_marqueeSouth', this.imgWrap )[0];
- /* we have to be a bit more forceful for Safari, otherwise the the marquee &
- * the south handles still don't move
- */
- d = Builder.node( 'div', '' );
- d.style.visibility = 'hidden';
-
- var classList = ['SE','S','SW'];
- for( i = 0; i < classList.length; i++ ) {
- el = document.getElementsByClassName( 'imgCrop_handle' + classList[i], this.selArea )[0];
- if( el.childNodes.length ) el.removeChild( el.childNodes[0] );
- el.appendChild(d);
- }
- }
- fixEl.appendChild(n);
- fixEl.removeChild(n);
- }
- },
-
- /**
- * Starts the resize
- *
- * @access private
- * @param obj Event
- * @return void
- */
- startResize: function( e ) {
- this.startCoords = this.cloneCoords( this.areaCoords );
-
- this.resizing = true;
- this.resizeHandle = Event.element( e ).classNames().toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/, '');
- // dump( 'this.resizeHandle : ' + this.resizeHandle + '\n' );
- Event.stop( e );
- },
-
- /**
- * Starts the drag
- *
- * @access private
- * @param obj Event
- * @return void
- */
- startDrag: function( e ) {
- this.selArea.show();
- this.clickCoords = this.getCurPos( e );
-
- this.setAreaCoords( { x1: this.clickCoords.x, y1: this.clickCoords.y, x2: this.clickCoords.x, y2: this.clickCoords.y }, false, false, null );
-
- this.dragging = true;
- this.onDrag( e ); // incase the user just clicks once after already making a selection
- Event.stop( e );
- },
-
- /**
- * Gets the current cursor position relative to the image
- *
- * @access private
- * @param obj Event
- * @return obj x,y pixels of the cursor
- */
- getCurPos: function( e ) {
- // get the offsets for the wrapper within the document
- var el = this.imgWrap, wrapOffsets = Position.cumulativeOffset( el );
- // remove any scrolling that is applied to the wrapper (this may be buggy) - don't count the scroll on the body as that won't affect us
- while( el.nodeName != 'BODY' ) {
- wrapOffsets[1] -= el.scrollTop || 0;
- wrapOffsets[0] -= el.scrollLeft || 0;
- el = el.parentNode;
- }
- return curPos = {
- x: Event.pointerX(e) - wrapOffsets[0],
- y: Event.pointerY(e) - wrapOffsets[1]
- }
- },
-
- /**
- * Performs the drag for both resize & inital draw dragging
- *
- * @access private
- * @param obj Event
- * @return void
- */
- onDrag: function( e ) {
- if( this.dragging || this.resizing ) {
-
- var resizeHandle = null;
- var curPos = this.getCurPos( e );
- var newCoords = this.cloneCoords( this.areaCoords );
- var direction = { x: 1, y: 1 };
-
- if( this.dragging ) {
- if( curPos.x < this.clickCoords.x ) direction.x = -1;
- if( curPos.y < this.clickCoords.y ) direction.y = -1;
-
- this.transformCoords( curPos.x, this.clickCoords.x, newCoords, 'x' );
- this.transformCoords( curPos.y, this.clickCoords.y, newCoords, 'y' );
- } else if( this.resizing ) {
- resizeHandle = this.resizeHandle;
- // do x movements first
- if( resizeHandle.match(/E/) ) {
- // if we're moving an east handle
- this.transformCoords( curPos.x, this.startCoords.x1, newCoords, 'x' );
- if( curPos.x < this.startCoords.x1 ) direction.x = -1;
- } else if( resizeHandle.match(/W/) ) {
- // if we're moving an west handle
- this.transformCoords( curPos.x, this.startCoords.x2, newCoords, 'x' );
- if( curPos.x < this.startCoords.x2 ) direction.x = -1;
- }
-
- // do y movements second
- if( resizeHandle.match(/N/) ) {
- // if we're moving an north handle
- this.transformCoords( curPos.y, this.startCoords.y2, newCoords, 'y' );
- if( curPos.y < this.startCoords.y2 ) direction.y = -1;
- } else if( resizeHandle.match(/S/) ) {
- // if we're moving an south handle
- this.transformCoords( curPos.y, this.startCoords.y1, newCoords, 'y' );
- if( curPos.y < this.startCoords.y1 ) direction.y = -1;
- }
-
- }
-
- this.setAreaCoords( newCoords, false, e.shiftKey, direction, resizeHandle );
- this.drawArea();
- Event.stop( e ); // stop the default event (selecting images & text) in Safari & IE PC
- }
- },
-
- /**
- * Applies the appropriate transform to supplied co-ordinates, on the
- * defined axis, depending on the relationship of the supplied values
- *
- * @access private
- * @param int Current value of pointer
- * @param int Base value to compare current pointer val to
- * @param obj Coordinates to apply transformation on x1, x2, y1, y2
- * @param string Axis to apply transformation on 'x' || 'y'
- * @return void
- */
- transformCoords : function( curVal, baseVal, coords, axis ) {
- var newVals = [ curVal, baseVal ];
- if( curVal > baseVal ) newVals.reverse();
- coords[ axis + '1' ] = newVals[0];
- coords[ axis + '2' ] = newVals[1];
- },
-
- /**
- * Ends the crop & passes the values of the select area on to the appropriate
- * callback function on completion of a crop
- *
- * @access private
- * @return void
- */
- endCrop : function() {
- this.dragging = false;
- this.resizing = false;
-
- this.options.onEndCrop(
- this.areaCoords,
- {
- width: this.calcW(),
- height: this.calcH()
- }
- );
- },
-
- /**
- * Abstract method called on the end of initialization
- *
- * @access private
- * @abstract
- * @return void
- */
- subInitialize: function() {},
-
- /**
- * Abstract method called on the end of drawArea()
- *
- * @access private
- * @abstract
- * @return void
- */
- subDrawArea: function() {}
-};
-
-
-
-
-/**
- * Extend the Cropper.Img class to allow for presentation of a preview image of the resulting crop,
- * the option for displayOnInit is always overridden to true when displaying a preview image
- *
- * Usage:
- * @param obj Image element to attach to
- * @param obj Optional options:
- * - see Cropper.Img for base options
- *
- * - previewWrap obj
- * HTML element that will be used as a container for the preview image
- */
-Cropper.ImgWithPreview = Class.create();
-
-Object.extend( Object.extend( Cropper.ImgWithPreview.prototype, Cropper.Img.prototype ), {
-
- /**
- * Implements the abstract method from Cropper.Img to initialize preview image settings.
- * Will only attach a preview image is the previewWrap element is defined and the minWidth
- * & minHeight options are set.
- *
- * @see Croper.Img.subInitialize
- */
- subInitialize: function() {
- /**
- * Whether or not we've attached a preview image
- * @var boolean
- */
- this.hasPreviewImg = false;
- if( typeof(this.options.previewWrap) != 'undefined'
- && this.options.minWidth > 0
- && this.options.minHeight > 0
- ) {
- /**
- * The preview image wrapper element
- * @var obj HTML element
- */
- this.previewWrap = $( this.options.previewWrap );
- /**
- * The preview image element
- * @var obj HTML IMG element
- */
- this.previewImg = this.img.cloneNode( false );
- // set the ID of the preview image to be unique
- this.previewImg.id = 'imgCrop_' + this.previewImg.id;
-
-
- // set the displayOnInit option to true so we display the select area at the same time as the thumbnail
- this.options.displayOnInit = true;
-
- this.hasPreviewImg = true;
-
- this.previewWrap.addClassName( 'imgCrop_previewWrap' );
-
- this.previewWrap.setStyle(
- {
- width: this.options.minWidth + 'px',
- height: this.options.minHeight + 'px'
- }
- );
-
- this.previewWrap.appendChild( this.previewImg );
- }
- },
-
- /**
- * Implements the abstract method from Cropper.Img to draw the preview image
- *
- * @see Croper.Img.subDrawArea
- */
- subDrawArea: function() {
- if( this.hasPreviewImg ) {
- // get the ratio of the select area to the src image
- var calcWidth = this.calcW();
- var calcHeight = this.calcH();
- // ratios for the dimensions of the preview image
- var dimRatio = {
- x: this.imgW / calcWidth,
- y: this.imgH / calcHeight
- };
- //ratios for the positions within the preview
- var posRatio = {
- x: calcWidth / this.options.minWidth,
- y: calcHeight / this.options.minHeight
- };
-
- // setting the positions in an obj before apply styles for rendering speed increase
- var calcPos = {
- w: Math.ceil( this.options.minWidth * dimRatio.x ) + 'px',
- h: Math.ceil( this.options.minHeight * dimRatio.y ) + 'px',
- x: '-' + Math.ceil( this.areaCoords.x1 / posRatio.x ) + 'px',
- y: '-' + Math.ceil( this.areaCoords.y1 / posRatio.y ) + 'px'
- }
-
- var previewStyle = this.previewImg.style;
- previewStyle.width = calcPos.w;
- previewStyle.height = calcPos.h;
- previewStyle.left = calcPos.x;
- previewStyle.top = calcPos.y;
- }
- }
-
-});
diff --git a/library/cropper/lib/builder.js b/library/cropper/lib/builder.js
deleted file mode 100644
index 5b15ba939..000000000
--- a/library/cropper/lib/builder.js
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// See scriptaculous.js for full license.
-
-var Builder = {
- NODEMAP: {
- AREA: 'map',
- CAPTION: 'table',
- COL: 'table',
- COLGROUP: 'table',
- LEGEND: 'fieldset',
- OPTGROUP: 'select',
- OPTION: 'select',
- PARAM: 'object',
- TBODY: 'table',
- TD: 'table',
- TFOOT: 'table',
- TH: 'table',
- THEAD: 'table',
- TR: 'table'
- },
- // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
- // due to a Firefox bug
- node: function(elementName) {
- elementName = elementName.toUpperCase();
-
- // try innerHTML approach
- var parentTag = this.NODEMAP[elementName] || 'div';
- var parentElement = document.createElement(parentTag);
- try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
- parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
- } catch(e) {}
- var element = parentElement.firstChild || null;
-
- // see if browser added wrapping tags
- if(element && (element.tagName != elementName))
- element = element.getElementsByTagName(elementName)[0];
-
- // fallback to createElement approach
- if(!element) element = document.createElement(elementName);
-
- // abort if nothing could be created
- if(!element) return;
-
- // attributes (or text)
- if(arguments[1])
- if(this._isStringOrNumber(arguments[1]) ||
- (arguments[1] instanceof Array)) {
- this._children(element, arguments[1]);
- } else {
- var attrs = this._attributes(arguments[1]);
- if(attrs.length) {
- try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
- parentElement.innerHTML = "<" +elementName + " " +
- attrs + "></" + elementName + ">";
- } catch(e) {}
- element = parentElement.firstChild || null;
- // workaround firefox 1.0.X bug
- if(!element) {
- element = document.createElement(elementName);
- for(attr in arguments[1])
- element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
- }
- if(element.tagName != elementName)
- element = parentElement.getElementsByTagName(elementName)[0];
- }
- }
-
- // text, or array of children
- if(arguments[2])
- this._children(element, arguments[2]);
-
- return element;
- },
- _text: function(text) {
- return document.createTextNode(text);
- },
- _attributes: function(attributes) {
- var attrs = [];
- for(attribute in attributes)
- attrs.push((attribute=='className' ? 'class' : attribute) +
- '="' + attributes[attribute].toString().escapeHTML() + '"');
- return attrs.join(" ");
- },
- _children: function(element, children) {
- if(typeof children=='object') { // array can hold nodes and text
- children.flatten().each( function(e) {
- if(typeof e=='object')
- element.appendChild(e)
- else
- if(Builder._isStringOrNumber(e))
- element.appendChild(Builder._text(e));
- });
- } else
- if(Builder._isStringOrNumber(children))
- element.appendChild(Builder._text(children));
- },
- _isStringOrNumber: function(param) {
- return(typeof param=='string' || typeof param=='number');
- }
-} \ No newline at end of file
diff --git a/library/cropper/lib/controls.js b/library/cropper/lib/controls.js
deleted file mode 100644
index de0261ed5..000000000
--- a/library/cropper/lib/controls.js
+++ /dev/null
@@ -1,815 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
-// (c) 2005 Jon Tirsen (http://www.tirsen.com)
-// Contributors:
-// Richard Livsey
-// Rahul Bhargava
-// Rob Wills
-//
-// See scriptaculous.js for full license.
-
-// Autocompleter.Base handles all the autocompletion functionality
-// that's independent of the data source for autocompletion. This
-// includes drawing the autocompletion menu, observing keyboard
-// and mouse events, and similar.
-//
-// Specific autocompleters need to provide, at the very least,
-// a getUpdatedChoices function that will be invoked every time
-// the text inside the monitored textbox changes. This method
-// should get the text for which to provide autocompletion by
-// invoking this.getToken(), NOT by directly accessing
-// this.element.value. This is to allow incremental tokenized
-// autocompletion. Specific auto-completion logic (AJAX, etc)
-// belongs in getUpdatedChoices.
-//
-// Tokenized incremental autocompletion is enabled automatically
-// when an autocompleter is instantiated with the 'tokens' option
-// in the options parameter, e.g.:
-// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
-// will incrementally autocomplete with a comma as the token.
-// Additionally, ',' in the above example can be replaced with
-// a token array, e.g. { tokens: [',', '\n'] } which
-// enables autocompletion on multiple tokens. This is most
-// useful when one of the tokens is \n (a newline), as it
-// allows smart autocompletion after linebreaks.
-
-var Autocompleter = {}
-Autocompleter.Base = function() {};
-Autocompleter.Base.prototype = {
- baseInitialize: function(element, update, options) {
- this.element = $(element);
- this.update = $(update);
- this.hasFocus = false;
- this.changed = false;
- this.active = false;
- this.index = 0;
- this.entryCount = 0;
-
- if (this.setOptions)
- this.setOptions(options);
- else
- this.options = options || {};
-
- this.options.paramName = this.options.paramName || this.element.name;
- this.options.tokens = this.options.tokens || [];
- this.options.frequency = this.options.frequency || 0.4;
- this.options.minChars = this.options.minChars || 1;
- this.options.onShow = this.options.onShow ||
- function(element, update){
- if(!update.style.position || update.style.position=='absolute') {
- update.style.position = 'absolute';
- Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});
- }
- Effect.Appear(update,{duration:0.15});
- };
- this.options.onHide = this.options.onHide ||
- function(element, update){ new Effect.Fade(update,{duration:0.15}) };
-
- if (typeof(this.options.tokens) == 'string')
- this.options.tokens = new Array(this.options.tokens);
-
- this.observer = null;
-
- this.element.setAttribute('autocomplete','off');
-
- Element.hide(this.update);
-
- Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
- Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this));
- },
-
- show: function() {
- if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
- if(!this.iefix &&
- (navigator.appVersion.indexOf('MSIE')>0) &&
- (navigator.userAgent.indexOf('Opera')<0) &&
- (Element.getStyle(this.update, 'position')=='absolute')) {
- new Insertion.After(this.update,
- '<iframe id="' + this.update.id + '_iefix" '+
- 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
- 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
- this.iefix = $(this.update.id+'_iefix');
- }
- if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
- },
-
- fixIEOverlapping: function() {
- Position.clone(this.update, this.iefix);
- this.iefix.style.zIndex = 1;
- this.update.style.zIndex = 2;
- Element.show(this.iefix);
- },
-
- hide: function() {
- this.stopIndicator();
- if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
- if(this.iefix) Element.hide(this.iefix);
- },
-
- startIndicator: function() {
- if(this.options.indicator) Element.show(this.options.indicator);
- },
-
- stopIndicator: function() {
- if(this.options.indicator) Element.hide(this.options.indicator);
- },
-
- onKeyPress: function(event) {
- if(this.active)
- switch(event.keyCode) {
- case Event.KEY_TAB:
- case Event.KEY_RETURN:
- this.selectEntry();
- Event.stop(event);
- case Event.KEY_ESC:
- this.hide();
- this.active = false;
- Event.stop(event);
- return;
- case Event.KEY_LEFT:
- case Event.KEY_RIGHT:
- return;
- case Event.KEY_UP:
- this.markPrevious();
- this.render();
- if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
- return;
- case Event.KEY_DOWN:
- this.markNext();
- this.render();
- if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
- return;
- }
- else
- if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
- (navigator.appVersion.indexOf('AppleWebKit') > 0 && event.keyCode == 0)) return;
-
- this.changed = true;
- this.hasFocus = true;
-
- if(this.observer) clearTimeout(this.observer);
- this.observer =
- setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
- },
-
- activate: function() {
- this.changed = false;
- this.hasFocus = true;
- this.getUpdatedChoices();
- },
-
- onHover: function(event) {
- var element = Event.findElement(event, 'LI');
- if(this.index != element.autocompleteIndex)
- {
- this.index = element.autocompleteIndex;
- this.render();
- }
- Event.stop(event);
- },
-
- onClick: function(event) {
- var element = Event.findElement(event, 'LI');
- this.index = element.autocompleteIndex;
- this.selectEntry();
- this.hide();
- },
-
- onBlur: function(event) {
- // needed to make click events working
- setTimeout(this.hide.bind(this), 250);
- this.hasFocus = false;
- this.active = false;
- },
-
- render: function() {
- if(this.entryCount > 0) {
- for (var i = 0; i < this.entryCount; i++)
- this.index==i ?
- Element.addClassName(this.getEntry(i),"selected") :
- Element.removeClassName(this.getEntry(i),"selected");
-
- if(this.hasFocus) {
- this.show();
- this.active = true;
- }
- } else {
- this.active = false;
- this.hide();
- }
- },
-
- markPrevious: function() {
- if(this.index > 0) this.index--
- else this.index = this.entryCount-1;
- },
-
- markNext: function() {
- if(this.index < this.entryCount-1) this.index++
- else this.index = 0;
- },
-
- getEntry: function(index) {
- return this.update.firstChild.childNodes[index];
- },
-
- getCurrentEntry: function() {
- return this.getEntry(this.index);
- },
-
- selectEntry: function() {
- this.active = false;
- this.updateElement(this.getCurrentEntry());
- },
-
- updateElement: function(selectedElement) {
- if (this.options.updateElement) {
- this.options.updateElement(selectedElement);
- return;
- }
- var value = '';
- if (this.options.select) {
- var nodes = document.getElementsByClassName(this.options.select, selectedElement) || [];
- if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
- } else
- value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
-
- var lastTokenPos = this.findLastToken();
- if (lastTokenPos != -1) {
- var newValue = this.element.value.substr(0, lastTokenPos + 1);
- var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/);
- if (whitespace)
- newValue += whitespace[0];
- this.element.value = newValue + value;
- } else {
- this.element.value = value;
- }
- this.element.focus();
-
- if (this.options.afterUpdateElement)
- this.options.afterUpdateElement(this.element, selectedElement);
- },
-
- updateChoices: function(choices) {
- if(!this.changed && this.hasFocus) {
- this.update.innerHTML = choices;
- Element.cleanWhitespace(this.update);
- Element.cleanWhitespace(this.update.firstChild);
-
- if(this.update.firstChild && this.update.firstChild.childNodes) {
- this.entryCount =
- this.update.firstChild.childNodes.length;
- for (var i = 0; i < this.entryCount; i++) {
- var entry = this.getEntry(i);
- entry.autocompleteIndex = i;
- this.addObservers(entry);
- }
- } else {
- this.entryCount = 0;
- }
-
- this.stopIndicator();
-
- this.index = 0;
- this.render();
- }
- },
-
- addObservers: function(element) {
- Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
- Event.observe(element, "click", this.onClick.bindAsEventListener(this));
- },
-
- onObserverEvent: function() {
- this.changed = false;
- if(this.getToken().length>=this.options.minChars) {
- this.startIndicator();
- this.getUpdatedChoices();
- } else {
- this.active = false;
- this.hide();
- }
- },
-
- getToken: function() {
- var tokenPos = this.findLastToken();
- if (tokenPos != -1)
- var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,'');
- else
- var ret = this.element.value;
-
- return /\n/.test(ret) ? '' : ret;
- },
-
- findLastToken: function() {
- var lastTokenPos = -1;
-
- for (var i=0; i<this.options.tokens.length; i++) {
- var thisTokenPos = this.element.value.lastIndexOf(this.options.tokens[i]);
- if (thisTokenPos > lastTokenPos)
- lastTokenPos = thisTokenPos;
- }
- return lastTokenPos;
- }
-}
-
-Ajax.Autocompleter = Class.create();
-Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), {
- initialize: function(element, update, url, options) {
- this.baseInitialize(element, update, options);
- this.options.asynchronous = true;
- this.options.onComplete = this.onComplete.bind(this);
- this.options.defaultParams = this.options.parameters || null;
- this.url = url;
- },
-
- getUpdatedChoices: function() {
- entry = encodeURIComponent(this.options.paramName) + '=' +
- encodeURIComponent(this.getToken());
-
- this.options.parameters = this.options.callback ?
- this.options.callback(this.element, entry) : entry;
-
- if(this.options.defaultParams)
- this.options.parameters += '&' + this.options.defaultParams;
-
- new Ajax.Request(this.url, this.options);
- },
-
- onComplete: function(request) {
- this.updateChoices(request.responseText);
- }
-
-});
-
-// The local array autocompleter. Used when you'd prefer to
-// inject an array of autocompletion options into the page, rather
-// than sending out Ajax queries, which can be quite slow sometimes.
-//
-// The constructor takes four parameters. The first two are, as usual,
-// the id of the monitored textbox, and id of the autocompletion menu.
-// The third is the array you want to autocomplete from, and the fourth
-// is the options block.
-//
-// Extra local autocompletion options:
-// - choices - How many autocompletion choices to offer
-//
-// - partialSearch - If false, the autocompleter will match entered
-// text only at the beginning of strings in the
-// autocomplete array. Defaults to true, which will
-// match text at the beginning of any *word* in the
-// strings in the autocomplete array. If you want to
-// search anywhere in the string, additionally set
-// the option fullSearch to true (default: off).
-//
-// - fullSsearch - Search anywhere in autocomplete array strings.
-//
-// - partialChars - How many characters to enter before triggering
-// a partial match (unlike minChars, which defines
-// how many characters are required to do any match
-// at all). Defaults to 2.
-//
-// - ignoreCase - Whether to ignore case when autocompleting.
-// Defaults to true.
-//
-// It's possible to pass in a custom function as the 'selector'
-// option, if you prefer to write your own autocompletion logic.
-// In that case, the other options above will not apply unless
-// you support them.
-
-Autocompleter.Local = Class.create();
-Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), {
- initialize: function(element, update, array, options) {
- this.baseInitialize(element, update, options);
- this.options.array = array;
- },
-
- getUpdatedChoices: function() {
- this.updateChoices(this.options.selector(this));
- },
-
- setOptions: function(options) {
- this.options = Object.extend({
- choices: 10,
- partialSearch: true,
- partialChars: 2,
- ignoreCase: true,
- fullSearch: false,
- selector: function(instance) {
- var ret = []; // Beginning matches
- var partial = []; // Inside matches
- var entry = instance.getToken();
- var count = 0;
-
- for (var i = 0; i < instance.options.array.length &&
- ret.length < instance.options.choices ; i++) {
-
- var elem = instance.options.array[i];
- var foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase()) :
- elem.indexOf(entry);
-
- while (foundPos != -1) {
- if (foundPos == 0 && elem.length != entry.length) {
- ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
- elem.substr(entry.length) + "</li>");
- break;
- } else if (entry.length >= instance.options.partialChars &&
- instance.options.partialSearch && foundPos != -1) {
- if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
- partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
- elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
- foundPos + entry.length) + "</li>");
- break;
- }
- }
-
- foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
- elem.indexOf(entry, foundPos + 1);
-
- }
- }
- if (partial.length)
- ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
- return "<ul>" + ret.join('') + "</ul>";
- }
- }, options || {});
- }
-});
-
-// AJAX in-place editor
-//
-// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
-
-// Use this if you notice weird scrolling problems on some browsers,
-// the DOM might be a bit confused when this gets called so do this
-// waits 1 ms (with setTimeout) until it does the activation
-Field.scrollFreeActivate = function(field) {
- setTimeout(function() {
- Field.activate(field);
- }, 1);
-}
-
-Ajax.InPlaceEditor = Class.create();
-Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99";
-Ajax.InPlaceEditor.prototype = {
- initialize: function(element, url, options) {
- this.url = url;
- this.element = $(element);
-
- this.options = Object.extend({
- okButton: true,
- okText: "ok",
- cancelLink: true,
- cancelText: "cancel",
- savingText: "Saving...",
- clickToEditText: "Click to edit",
- okText: "ok",
- rows: 1,
- onComplete: function(transport, element) {
- new Effect.Highlight(element, {startcolor: this.options.highlightcolor});
- },
- onFailure: function(transport) {
- alert("Error communicating with the server: " + transport.responseText.stripTags());
- },
- callback: function(form) {
- return Form.serialize(form);
- },
- handleLineBreaks: true,
- loadingText: 'Loading...',
- savingClassName: 'inplaceeditor-saving',
- loadingClassName: 'inplaceeditor-loading',
- formClassName: 'inplaceeditor-form',
- highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor,
- highlightendcolor: "#FFFFFF",
- externalControl: null,
- submitOnBlur: false,
- ajaxOptions: {},
- evalScripts: false
- }, options || {});
-
- if(!this.options.formId && this.element.id) {
- this.options.formId = this.element.id + "-inplaceeditor";
- if ($(this.options.formId)) {
- // there's already a form with that name, don't specify an id
- this.options.formId = null;
- }
- }
-
- if (this.options.externalControl) {
- this.options.externalControl = $(this.options.externalControl);
- }
-
- this.originalBackground = Element.getStyle(this.element, 'background-color');
- if (!this.originalBackground) {
- this.originalBackground = "transparent";
- }
-
- this.element.title = this.options.clickToEditText;
-
- this.onclickListener = this.enterEditMode.bindAsEventListener(this);
- this.mouseoverListener = this.enterHover.bindAsEventListener(this);
- this.mouseoutListener = this.leaveHover.bindAsEventListener(this);
- Event.observe(this.element, 'click', this.onclickListener);
- Event.observe(this.element, 'mouseover', this.mouseoverListener);
- Event.observe(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.observe(this.options.externalControl, 'click', this.onclickListener);
- Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- },
- enterEditMode: function(evt) {
- if (this.saving) return;
- if (this.editing) return;
- this.editing = true;
- this.onEnterEditMode();
- if (this.options.externalControl) {
- Element.hide(this.options.externalControl);
- }
- Element.hide(this.element);
- this.createForm();
- this.element.parentNode.insertBefore(this.form, this.element);
- Field.scrollFreeActivate(this.editField);
- // stop the event to avoid a page refresh in Safari
- if (evt) {
- Event.stop(evt);
- }
- return false;
- },
- createForm: function() {
- this.form = document.createElement("form");
- this.form.id = this.options.formId;
- Element.addClassName(this.form, this.options.formClassName)
- this.form.onsubmit = this.onSubmit.bind(this);
-
- this.createEditField();
-
- if (this.options.textarea) {
- var br = document.createElement("br");
- this.form.appendChild(br);
- }
-
- if (this.options.okButton) {
- okButton = document.createElement("input");
- okButton.type = "submit";
- okButton.value = this.options.okText;
- okButton.className = 'editor_ok_button';
- this.form.appendChild(okButton);
- }
-
- if (this.options.cancelLink) {
- cancelLink = document.createElement("a");
- cancelLink.href = "#";
- cancelLink.appendChild(document.createTextNode(this.options.cancelText));
- cancelLink.onclick = this.onclickCancel.bind(this);
- cancelLink.className = 'editor_cancel';
- this.form.appendChild(cancelLink);
- }
- },
- hasHTMLLineBreaks: function(string) {
- if (!this.options.handleLineBreaks) return false;
- return string.match(/<br/i) || string.match(/<p>/i);
- },
- convertHTMLLineBreaks: function(string) {
- return string.replace(/<br>/gi, "\n").replace(/<br\/>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<p>/gi, "");
- },
- createEditField: function() {
- var text;
- if(this.options.loadTextURL) {
- text = this.options.loadingText;
- } else {
- text = this.getText();
- }
-
- var obj = this;
-
- if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
- this.options.textarea = false;
- var textField = document.createElement("input");
- textField.obj = this;
- textField.type = "text";
- textField.name = "value";
- textField.value = text;
- textField.style.backgroundColor = this.options.highlightcolor;
- textField.className = 'editor_field';
- var size = this.options.size || this.options.cols || 0;
- if (size != 0) textField.size = size;
- if (this.options.submitOnBlur)
- textField.onblur = this.onSubmit.bind(this);
- this.editField = textField;
- } else {
- this.options.textarea = true;
- var textArea = document.createElement("textarea");
- textArea.obj = this;
- textArea.name = "value";
- textArea.value = this.convertHTMLLineBreaks(text);
- textArea.rows = this.options.rows;
- textArea.cols = this.options.cols || 40;
- textArea.className = 'editor_field';
- if (this.options.submitOnBlur)
- textArea.onblur = this.onSubmit.bind(this);
- this.editField = textArea;
- }
-
- if(this.options.loadTextURL) {
- this.loadExternalText();
- }
- this.form.appendChild(this.editField);
- },
- getText: function() {
- return this.element.innerHTML;
- },
- loadExternalText: function() {
- Element.addClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = true;
- new Ajax.Request(
- this.options.loadTextURL,
- Object.extend({
- asynchronous: true,
- onComplete: this.onLoadedExternalText.bind(this)
- }, this.options.ajaxOptions)
- );
- },
- onLoadedExternalText: function(transport) {
- Element.removeClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = false;
- this.editField.value = transport.responseText.stripTags();
- },
- onclickCancel: function() {
- this.onComplete();
- this.leaveEditMode();
- return false;
- },
- onFailure: function(transport) {
- this.options.onFailure(transport);
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- this.oldInnerHTML = null;
- }
- return false;
- },
- onSubmit: function() {
- // onLoading resets these so we need to save them away for the Ajax call
- var form = this.form;
- var value = this.editField.value;
-
- // do this first, sometimes the ajax call returns before we get a chance to switch on Saving...
- // which means this will actually switch on Saving... *after* we've left edit mode causing Saving...
- // to be displayed indefinitely
- this.onLoading();
-
- if (this.options.evalScripts) {
- new Ajax.Request(
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this),
- asynchronous:true,
- evalScripts:true
- }, this.options.ajaxOptions));
- } else {
- new Ajax.Updater(
- { success: this.element,
- // don't update on failure (this could be an option)
- failure: null },
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this)
- }, this.options.ajaxOptions));
- }
- // stop the event to avoid a page refresh in Safari
- if (arguments.length > 1) {
- Event.stop(arguments[0]);
- }
- return false;
- },
- onLoading: function() {
- this.saving = true;
- this.removeForm();
- this.leaveHover();
- this.showSaving();
- },
- showSaving: function() {
- this.oldInnerHTML = this.element.innerHTML;
- this.element.innerHTML = this.options.savingText;
- Element.addClassName(this.element, this.options.savingClassName);
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- },
- removeForm: function() {
- if(this.form) {
- if (this.form.parentNode) Element.remove(this.form);
- this.form = null;
- }
- },
- enterHover: function() {
- if (this.saving) return;
- this.element.style.backgroundColor = this.options.highlightcolor;
- if (this.effect) {
- this.effect.cancel();
- }
- Element.addClassName(this.element, this.options.hoverClassName)
- },
- leaveHover: function() {
- if (this.options.backgroundColor) {
- this.element.style.backgroundColor = this.oldBackground;
- }
- Element.removeClassName(this.element, this.options.hoverClassName)
- if (this.saving) return;
- this.effect = new Effect.Highlight(this.element, {
- startcolor: this.options.highlightcolor,
- endcolor: this.options.highlightendcolor,
- restorecolor: this.originalBackground
- });
- },
- leaveEditMode: function() {
- Element.removeClassName(this.element, this.options.savingClassName);
- this.removeForm();
- this.leaveHover();
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- if (this.options.externalControl) {
- Element.show(this.options.externalControl);
- }
- this.editing = false;
- this.saving = false;
- this.oldInnerHTML = null;
- this.onLeaveEditMode();
- },
- onComplete: function(transport) {
- this.leaveEditMode();
- this.options.onComplete.bind(this)(transport, this.element);
- },
- onEnterEditMode: function() {},
- onLeaveEditMode: function() {},
- dispose: function() {
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- }
- this.leaveEditMode();
- Event.stopObserving(this.element, 'click', this.onclickListener);
- Event.stopObserving(this.element, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.stopObserving(this.options.externalControl, 'click', this.onclickListener);
- Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- }
-};
-
-Ajax.InPlaceCollectionEditor = Class.create();
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype);
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, {
- createEditField: function() {
- if (!this.cached_selectTag) {
- var selectTag = document.createElement("select");
- var collection = this.options.collection || [];
- var optionTag;
- collection.each(function(e,i) {
- optionTag = document.createElement("option");
- optionTag.value = (e instanceof Array) ? e[0] : e;
- if(this.options.value==optionTag.value) optionTag.selected = true;
- optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
- selectTag.appendChild(optionTag);
- }.bind(this));
- this.cached_selectTag = selectTag;
- }
-
- this.editField = this.cached_selectTag;
- if(this.options.loadTextURL) this.loadExternalText();
- this.form.appendChild(this.editField);
- this.options.callback = function(form, value) {
- return "value=" + encodeURIComponent(value);
- }
- }
-});
-
-// Delayed observer, like Form.Element.Observer,
-// but waits for delay after last key input
-// Ideal for live-search fields
-
-Form.Element.DelayedObserver = Class.create();
-Form.Element.DelayedObserver.prototype = {
- initialize: function(element, delay, callback) {
- this.delay = delay || 0.5;
- this.element = $(element);
- this.callback = callback;
- this.timer = null;
- this.lastValue = $F(this.element);
- Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
- },
- delayedListener: function(event) {
- if(this.lastValue == $F(this.element)) return;
- if(this.timer) clearTimeout(this.timer);
- this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
- this.lastValue = $F(this.element);
- },
- onTimerEvent: function() {
- this.timer = null;
- this.callback(this.element, $F(this.element));
- }
-};
diff --git a/library/cropper/lib/dragdrop.js b/library/cropper/lib/dragdrop.js
deleted file mode 100644
index be2a30f53..000000000
--- a/library/cropper/lib/dragdrop.js
+++ /dev/null
@@ -1,915 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
-//
-// See scriptaculous.js for full license.
-
-/*--------------------------------------------------------------------------*/
-
-var Droppables = {
- drops: [],
-
- remove: function(element) {
- this.drops = this.drops.reject(function(d) { return d.element==$(element) });
- },
-
- add: function(element) {
- element = $(element);
- var options = Object.extend({
- greedy: true,
- hoverclass: null,
- tree: false
- }, arguments[1] || {});
-
- // cache containers
- if(options.containment) {
- options._containers = [];
- var containment = options.containment;
- if((typeof containment == 'object') &&
- (containment.constructor == Array)) {
- containment.each( function(c) { options._containers.push($(c)) });
- } else {
- options._containers.push($(containment));
- }
- }
-
- if(options.accept) options.accept = [options.accept].flatten();
-
- Element.makePositioned(element); // fix IE
- options.element = element;
-
- this.drops.push(options);
- },
-
- findDeepestChild: function(drops) {
- deepest = drops[0];
-
- for (i = 1; i < drops.length; ++i)
- if (Element.isParent(drops[i].element, deepest.element))
- deepest = drops[i];
-
- return deepest;
- },
-
- isContained: function(element, drop) {
- var containmentNode;
- if(drop.tree) {
- containmentNode = element.treeNode;
- } else {
- containmentNode = element.parentNode;
- }
- return drop._containers.detect(function(c) { return containmentNode == c });
- },
-
- isAffected: function(point, element, drop) {
- return (
- (drop.element!=element) &&
- ((!drop._containers) ||
- this.isContained(element, drop)) &&
- ((!drop.accept) ||
- (Element.classNames(element).detect(
- function(v) { return drop.accept.include(v) } ) )) &&
- Position.within(drop.element, point[0], point[1]) );
- },
-
- deactivate: function(drop) {
- if(drop.hoverclass)
- Element.removeClassName(drop.element, drop.hoverclass);
- this.last_active = null;
- },
-
- activate: function(drop) {
- if(drop.hoverclass)
- Element.addClassName(drop.element, drop.hoverclass);
- this.last_active = drop;
- },
-
- show: function(point, element) {
- if(!this.drops.length) return;
- var affected = [];
-
- if(this.last_active) this.deactivate(this.last_active);
- this.drops.each( function(drop) {
- if(Droppables.isAffected(point, element, drop))
- affected.push(drop);
- });
-
- if(affected.length>0) {
- drop = Droppables.findDeepestChild(affected);
- Position.within(drop.element, point[0], point[1]);
- if(drop.onHover)
- drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-
- Droppables.activate(drop);
- }
- },
-
- fire: function(event, element) {
- if(!this.last_active) return;
- Position.prepare();
-
- if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
- if (this.last_active.onDrop)
- this.last_active.onDrop(element, this.last_active.element, event);
- },
-
- reset: function() {
- if(this.last_active)
- this.deactivate(this.last_active);
- }
-}
-
-var Draggables = {
- drags: [],
- observers: [],
-
- register: function(draggable) {
- if(this.drags.length == 0) {
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
- this.eventKeypress = this.keyPress.bindAsEventListener(this);
-
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
- Event.observe(document, "keypress", this.eventKeypress);
- }
- this.drags.push(draggable);
- },
-
- unregister: function(draggable) {
- this.drags = this.drags.reject(function(d) { return d==draggable });
- if(this.drags.length == 0) {
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- Event.stopObserving(document, "keypress", this.eventKeypress);
- }
- },
-
- activate: function(draggable) {
- window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
- this.activeDraggable = draggable;
- },
-
- deactivate: function() {
- this.activeDraggable = null;
- },
-
- updateDrag: function(event) {
- if(!this.activeDraggable) return;
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- // Mozilla-based browsers fire successive mousemove events with
- // the same coordinates, prevent needless redrawing (moz bug?)
- if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
- this._lastPointer = pointer;
- this.activeDraggable.updateDrag(event, pointer);
- },
-
- endDrag: function(event) {
- if(!this.activeDraggable) return;
- this._lastPointer = null;
- this.activeDraggable.endDrag(event);
- this.activeDraggable = null;
- },
-
- keyPress: function(event) {
- if(this.activeDraggable)
- this.activeDraggable.keyPress(event);
- },
-
- addObserver: function(observer) {
- this.observers.push(observer);
- this._cacheObserverCallbacks();
- },
-
- removeObserver: function(element) { // element instead of observer fixes mem leaks
- this.observers = this.observers.reject( function(o) { return o.element==element });
- this._cacheObserverCallbacks();
- },
-
- notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
- if(this[eventName+'Count'] > 0)
- this.observers.each( function(o) {
- if(o[eventName]) o[eventName](eventName, draggable, event);
- });
- },
-
- _cacheObserverCallbacks: function() {
- ['onStart','onEnd','onDrag'].each( function(eventName) {
- Draggables[eventName+'Count'] = Draggables.observers.select(
- function(o) { return o[eventName]; }
- ).length;
- });
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Draggable = Class.create();
-Draggable.prototype = {
- initialize: function(element) {
- var options = Object.extend({
- handle: false,
- starteffect: function(element) {
- element._opacity = Element.getOpacity(element);
- new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
- },
- reverteffect: function(element, top_offset, left_offset) {
- var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
- element._revert = new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur});
- },
- endeffect: function(element) {
- var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0
- new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity});
- },
- zindex: 1000,
- revert: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- snap: false // false, or xy or [x,y] or function(x,y){ return [x,y] }
- }, arguments[1] || {});
-
- this.element = $(element);
-
- if(options.handle && (typeof options.handle == 'string')) {
- var h = Element.childrenWithClassName(this.element, options.handle, true);
- if(h.length>0) this.handle = h[0];
- }
- if(!this.handle) this.handle = $(options.handle);
- if(!this.handle) this.handle = this.element;
-
- if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML)
- options.scroll = $(options.scroll);
-
- Element.makePositioned(this.element); // fix IE
-
- this.delta = this.currentDelta();
- this.options = options;
- this.dragging = false;
-
- this.eventMouseDown = this.initDrag.bindAsEventListener(this);
- Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
- Draggables.register(this);
- },
-
- destroy: function() {
- Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
- Draggables.unregister(this);
- },
-
- currentDelta: function() {
- return([
- parseInt(Element.getStyle(this.element,'left') || '0'),
- parseInt(Element.getStyle(this.element,'top') || '0')]);
- },
-
- initDrag: function(event) {
- if(Event.isLeftClick(event)) {
- // abort on form elements, fixes a Firefox issue
- var src = Event.element(event);
- if(src.tagName && (
- src.tagName=='INPUT' ||
- src.tagName=='SELECT' ||
- src.tagName=='OPTION' ||
- src.tagName=='BUTTON' ||
- src.tagName=='TEXTAREA')) return;
-
- if(this.element._revert) {
- this.element._revert.cancel();
- this.element._revert = null;
- }
-
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var pos = Position.cumulativeOffset(this.element);
- this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-
- Draggables.activate(this);
- Event.stop(event);
- }
- },
-
- startDrag: function(event) {
- this.dragging = true;
-
- if(this.options.zindex) {
- this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
- this.element.style.zIndex = this.options.zindex;
- }
-
- if(this.options.ghosting) {
- this._clone = this.element.cloneNode(true);
- Position.absolutize(this.element);
- this.element.parentNode.insertBefore(this._clone, this.element);
- }
-
- if(this.options.scroll) {
- if (this.options.scroll == window) {
- var where = this._getWindowScroll(this.options.scroll);
- this.originalScrollLeft = where.left;
- this.originalScrollTop = where.top;
- } else {
- this.originalScrollLeft = this.options.scroll.scrollLeft;
- this.originalScrollTop = this.options.scroll.scrollTop;
- }
- }
-
- Draggables.notify('onStart', this, event);
- if(this.options.starteffect) this.options.starteffect(this.element);
- },
-
- updateDrag: function(event, pointer) {
- if(!this.dragging) this.startDrag(event);
- Position.prepare();
- Droppables.show(pointer, this.element);
- Draggables.notify('onDrag', this, event);
- this.draw(pointer);
- if(this.options.change) this.options.change(this);
-
- if(this.options.scroll) {
- this.stopScrolling();
-
- var p;
- if (this.options.scroll == window) {
- with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
- } else {
- p = Position.page(this.options.scroll);
- p[0] += this.options.scroll.scrollLeft;
- p[1] += this.options.scroll.scrollTop;
- p.push(p[0]+this.options.scroll.offsetWidth);
- p.push(p[1]+this.options.scroll.offsetHeight);
- }
- var speed = [0,0];
- if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
- if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
- if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
- if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
- this.startScrolling(speed);
- }
-
- // fix AppleWebKit rendering
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
-
- Event.stop(event);
- },
-
- finishDrag: function(event, success) {
- this.dragging = false;
-
- if(this.options.ghosting) {
- Position.relativize(this.element);
- Element.remove(this._clone);
- this._clone = null;
- }
-
- if(success) Droppables.fire(event, this.element);
- Draggables.notify('onEnd', this, event);
-
- var revert = this.options.revert;
- if(revert && typeof revert == 'function') revert = revert(this.element);
-
- var d = this.currentDelta();
- if(revert && this.options.reverteffect) {
- this.options.reverteffect(this.element,
- d[1]-this.delta[1], d[0]-this.delta[0]);
- } else {
- this.delta = d;
- }
-
- if(this.options.zindex)
- this.element.style.zIndex = this.originalZ;
-
- if(this.options.endeffect)
- this.options.endeffect(this.element);
-
- Draggables.deactivate(this);
- Droppables.reset();
- },
-
- keyPress: function(event) {
- if(event.keyCode!=Event.KEY_ESC) return;
- this.finishDrag(event, false);
- Event.stop(event);
- },
-
- endDrag: function(event) {
- if(!this.dragging) return;
- this.stopScrolling();
- this.finishDrag(event, true);
- Event.stop(event);
- },
-
- draw: function(point) {
- var pos = Position.cumulativeOffset(this.element);
- var d = this.currentDelta();
- pos[0] -= d[0]; pos[1] -= d[1];
-
- if(this.options.scroll && (this.options.scroll != window)) {
- pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
- pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
- }
-
- var p = [0,1].map(function(i){
- return (point[i]-pos[i]-this.offset[i])
- }.bind(this));
-
- if(this.options.snap) {
- if(typeof this.options.snap == 'function') {
- p = this.options.snap(p[0],p[1],this);
- } else {
- if(this.options.snap instanceof Array) {
- p = p.map( function(v, i) {
- return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
- } else {
- p = p.map( function(v) {
- return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
- }
- }}
-
- var style = this.element.style;
- if((!this.options.constraint) || (this.options.constraint=='horizontal'))
- style.left = p[0] + "px";
- if((!this.options.constraint) || (this.options.constraint=='vertical'))
- style.top = p[1] + "px";
- if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
- },
-
- stopScrolling: function() {
- if(this.scrollInterval) {
- clearInterval(this.scrollInterval);
- this.scrollInterval = null;
- Draggables._lastScrollPointer = null;
- }
- },
-
- startScrolling: function(speed) {
- this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
- this.lastScrolled = new Date();
- this.scrollInterval = setInterval(this.scroll.bind(this), 10);
- },
-
- scroll: function() {
- var current = new Date();
- var delta = current - this.lastScrolled;
- this.lastScrolled = current;
- if(this.options.scroll == window) {
- with (this._getWindowScroll(this.options.scroll)) {
- if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
- var d = delta / 1000;
- this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
- }
- }
- } else {
- this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
- this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
- }
-
- Position.prepare();
- Droppables.show(Draggables._lastPointer, this.element);
- Draggables.notify('onDrag', this);
- Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
- Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
- Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
- if (Draggables._lastScrollPointer[0] < 0)
- Draggables._lastScrollPointer[0] = 0;
- if (Draggables._lastScrollPointer[1] < 0)
- Draggables._lastScrollPointer[1] = 0;
- this.draw(Draggables._lastScrollPointer);
-
- if(this.options.change) this.options.change(this);
- },
-
- _getWindowScroll: function(w) {
- var T, L, W, H;
- with (w.document) {
- if (w.document.documentElement && documentElement.scrollTop) {
- T = documentElement.scrollTop;
- L = documentElement.scrollLeft;
- } else if (w.document.body) {
- T = body.scrollTop;
- L = body.scrollLeft;
- }
- if (w.innerWidth) {
- W = w.innerWidth;
- H = w.innerHeight;
- } else if (w.document.documentElement && documentElement.clientWidth) {
- W = documentElement.clientWidth;
- H = documentElement.clientHeight;
- } else {
- W = body.offsetWidth;
- H = body.offsetHeight
- }
- }
- return { top: T, left: L, width: W, height: H };
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var SortableObserver = Class.create();
-SortableObserver.prototype = {
- initialize: function(element, observer) {
- this.element = $(element);
- this.observer = observer;
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onStart: function() {
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onEnd: function() {
- Sortable.unmark();
- if(this.lastValue != Sortable.serialize(this.element))
- this.observer(this.element)
- }
-}
-
-var Sortable = {
- sortables: {},
-
- _findRootElement: function(element) {
- while (element.tagName != "BODY") {
- if(element.id && Sortable.sortables[element.id]) return element;
- element = element.parentNode;
- }
- },
-
- options: function(element) {
- element = Sortable._findRootElement($(element));
- if(!element) return;
- return Sortable.sortables[element.id];
- },
-
- destroy: function(element){
- var s = Sortable.options(element);
-
- if(s) {
- Draggables.removeObserver(s.element);
- s.droppables.each(function(d){ Droppables.remove(d) });
- s.draggables.invoke('destroy');
-
- delete Sortable.sortables[s.element.id];
- }
- },
-
- create: function(element) {
- element = $(element);
- var options = Object.extend({
- element: element,
- tag: 'li', // assumes li children, override with tag: 'tagname'
- dropOnEmpty: false,
- tree: false,
- treeTag: 'ul',
- overlap: 'vertical', // one of 'vertical', 'horizontal'
- constraint: 'vertical', // one of 'vertical', 'horizontal', false
- containment: element, // also takes array of elements (or id's); or false
- handle: false, // or a CSS class
- only: false,
- hoverclass: null,
- ghosting: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- format: /^[^_]*_(.*)$/,
- onChange: Prototype.emptyFunction,
- onUpdate: Prototype.emptyFunction
- }, arguments[1] || {});
-
- // clear any old sortable with same element
- this.destroy(element);
-
- // build options for the draggables
- var options_for_draggable = {
- revert: true,
- scroll: options.scroll,
- scrollSpeed: options.scrollSpeed,
- scrollSensitivity: options.scrollSensitivity,
- ghosting: options.ghosting,
- constraint: options.constraint,
- handle: options.handle };
-
- if(options.starteffect)
- options_for_draggable.starteffect = options.starteffect;
-
- if(options.reverteffect)
- options_for_draggable.reverteffect = options.reverteffect;
- else
- if(options.ghosting) options_for_draggable.reverteffect = function(element) {
- element.style.top = 0;
- element.style.left = 0;
- };
-
- if(options.endeffect)
- options_for_draggable.endeffect = options.endeffect;
-
- if(options.zindex)
- options_for_draggable.zindex = options.zindex;
-
- // build options for the droppables
- var options_for_droppable = {
- overlap: options.overlap,
- containment: options.containment,
- tree: options.tree,
- hoverclass: options.hoverclass,
- onHover: Sortable.onHover
- //greedy: !options.dropOnEmpty
- }
-
- var options_for_tree = {
- onHover: Sortable.onEmptyHover,
- overlap: options.overlap,
- containment: options.containment,
- hoverclass: options.hoverclass
- }
-
- // fix for gecko engine
- Element.cleanWhitespace(element);
-
- options.draggables = [];
- options.droppables = [];
-
- // drop on empty handling
- if(options.dropOnEmpty || options.tree) {
- Droppables.add(element, options_for_tree);
- options.droppables.push(element);
- }
-
- (this.findElements(element, options) || []).each( function(e) {
- // handles are per-draggable
- var handle = options.handle ?
- Element.childrenWithClassName(e, options.handle)[0] : e;
- options.draggables.push(
- new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
- Droppables.add(e, options_for_droppable);
- if(options.tree) e.treeNode = element;
- options.droppables.push(e);
- });
-
- if(options.tree) {
- (Sortable.findTreeElements(element, options) || []).each( function(e) {
- Droppables.add(e, options_for_tree);
- e.treeNode = element;
- options.droppables.push(e);
- });
- }
-
- // keep reference
- this.sortables[element.id] = options;
-
- // for onupdate
- Draggables.addObserver(new SortableObserver(element, options.onUpdate));
-
- },
-
- // return all suitable-for-sortable elements in a guaranteed order
- findElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.tag);
- },
-
- findTreeElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.treeTag);
- },
-
- onHover: function(element, dropon, overlap) {
- if(Element.isParent(dropon, element)) return;
-
- if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
- return;
- } else if(overlap>0.5) {
- Sortable.mark(dropon, 'before');
- if(dropon.previousSibling != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, dropon);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- } else {
- Sortable.mark(dropon, 'after');
- var nextElement = dropon.nextSibling || null;
- if(nextElement != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, nextElement);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- }
- },
-
- onEmptyHover: function(element, dropon, overlap) {
- var oldParentNode = element.parentNode;
- var droponOptions = Sortable.options(dropon);
-
- if(!Element.isParent(dropon, element)) {
- var index;
-
- var children = Sortable.findElements(dropon, {tag: droponOptions.tag});
- var child = null;
-
- if(children) {
- var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-
- for (index = 0; index < children.length; index += 1) {
- if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
- offset -= Element.offsetSize (children[index], droponOptions.overlap);
- } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
- child = index + 1 < children.length ? children[index + 1] : null;
- break;
- } else {
- child = children[index];
- break;
- }
- }
- }
-
- dropon.insertBefore(element, child);
-
- Sortable.options(oldParentNode).onChange(element);
- droponOptions.onChange(element);
- }
- },
-
- unmark: function() {
- if(Sortable._marker) Element.hide(Sortable._marker);
- },
-
- mark: function(dropon, position) {
- // mark on ghosting only
- var sortable = Sortable.options(dropon.parentNode);
- if(sortable && !sortable.ghosting) return;
-
- if(!Sortable._marker) {
- Sortable._marker = $('dropmarker') || document.createElement('DIV');
- Element.hide(Sortable._marker);
- Element.addClassName(Sortable._marker, 'dropmarker');
- Sortable._marker.style.position = 'absolute';
- document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
- }
- var offsets = Position.cumulativeOffset(dropon);
- Sortable._marker.style.left = offsets[0] + 'px';
- Sortable._marker.style.top = offsets[1] + 'px';
-
- if(position=='after')
- if(sortable.overlap == 'horizontal')
- Sortable._marker.style.left = (offsets[0]+dropon.clientWidth) + 'px';
- else
- Sortable._marker.style.top = (offsets[1]+dropon.clientHeight) + 'px';
-
- Element.show(Sortable._marker);
- },
-
- _tree: function(element, options, parent) {
- var children = Sortable.findElements(element, options) || [];
-
- for (var i = 0; i < children.length; ++i) {
- var match = children[i].id.match(options.format);
-
- if (!match) continue;
-
- var child = {
- id: encodeURIComponent(match ? match[1] : null),
- element: element,
- parent: parent,
- children: new Array,
- position: parent.children.length,
- container: Sortable._findChildrenElement(children[i], options.treeTag.toUpperCase())
- }
-
- /* Get the element containing the children and recurse over it */
- if (child.container)
- this._tree(child.container, options, child)
-
- parent.children.push (child);
- }
-
- return parent;
- },
-
- /* Finds the first element of the given tag type within a parent element.
- Used for finding the first LI[ST] within a L[IST]I[TEM].*/
- _findChildrenElement: function (element, containerTag) {
- if (element && element.hasChildNodes)
- for (var i = 0; i < element.childNodes.length; ++i)
- if (element.childNodes[i].tagName == containerTag)
- return element.childNodes[i];
-
- return null;
- },
-
- tree: function(element) {
- element = $(element);
- var sortableOptions = this.options(element);
- var options = Object.extend({
- tag: sortableOptions.tag,
- treeTag: sortableOptions.treeTag,
- only: sortableOptions.only,
- name: element.id,
- format: sortableOptions.format
- }, arguments[1] || {});
-
- var root = {
- id: null,
- parent: null,
- children: new Array,
- container: element,
- position: 0
- }
-
- return Sortable._tree (element, options, root);
- },
-
- /* Construct a [i] index for a particular node */
- _constructIndex: function(node) {
- var index = '';
- do {
- if (node.id) index = '[' + node.position + ']' + index;
- } while ((node = node.parent) != null);
- return index;
- },
-
- sequence: function(element) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[1] || {});
-
- return $(this.findElements(element, options) || []).map( function(item) {
- return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
- });
- },
-
- setSequence: function(element, new_sequence) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[2] || {});
-
- var nodeMap = {};
- this.findElements(element, options).each( function(n) {
- if (n.id.match(options.format))
- nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
- n.parentNode.removeChild(n);
- });
-
- new_sequence.each(function(ident) {
- var n = nodeMap[ident];
- if (n) {
- n[1].appendChild(n[0]);
- delete nodeMap[ident];
- }
- });
- },
-
- serialize: function(element) {
- element = $(element);
- var options = Object.extend(Sortable.options(element), arguments[1] || {});
- var name = encodeURIComponent(
- (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-
- if (options.tree) {
- return Sortable.tree(element, arguments[1]).children.map( function (item) {
- return [name + Sortable._constructIndex(item) + "=" +
- encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
- }).flatten().join('&');
- } else {
- return Sortable.sequence(element, arguments[1]).map( function(item) {
- return name + "[]=" + encodeURIComponent(item);
- }).join('&');
- }
- }
-}
-
-/* Returns true if child is contained within element */
-Element.isParent = function(child, element) {
- if (!child.parentNode || child == element) return false;
-
- if (child.parentNode == element) return true;
-
- return Element.isParent(child.parentNode, element);
-}
-
-Element.findChildren = function(element, only, recursive, tagName) {
- if(!element.hasChildNodes()) return null;
- tagName = tagName.toUpperCase();
- if(only) only = [only].flatten();
- var elements = [];
- $A(element.childNodes).each( function(e) {
- if(e.tagName && e.tagName.toUpperCase()==tagName &&
- (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
- elements.push(e);
- if(recursive) {
- var grandchildren = Element.findChildren(e, only, recursive, tagName);
- if(grandchildren) elements.push(grandchildren);
- }
- });
-
- return (elements.length>0 ? elements.flatten() : []);
-}
-
-Element.offsetSize = function (element, type) {
- if (type == 'vertical' || type == 'height')
- return element.offsetHeight;
- else
- return element.offsetWidth;
-} \ No newline at end of file
diff --git a/library/cropper/lib/effects.js b/library/cropper/lib/effects.js
deleted file mode 100644
index 0864323ec..000000000
--- a/library/cropper/lib/effects.js
+++ /dev/null
@@ -1,958 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// Contributors:
-// Justin Palmer (http://encytemedia.com/)
-// Mark Pilgrim (http://diveintomark.org/)
-// Martin Bialasinki
-//
-// See scriptaculous.js for full license.
-
-// converts rgb() and #xxx to #xxxxxx format,
-// returns self (or first argument) if not convertable
-String.prototype.parseColor = function() {
- var color = '#';
- if(this.slice(0,4) == 'rgb(') {
- var cols = this.slice(4,this.length-1).split(',');
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
- } else {
- if(this.slice(0,1) == '#') {
- if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
- if(this.length==7) color = this.toLowerCase();
- }
- }
- return(color.length==7 ? color : (arguments[0] || this));
-}
-
-/*--------------------------------------------------------------------------*/
-
-Element.collectTextNodes = function(element) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
- }).flatten().join('');
-}
-
-Element.collectTextNodesIgnoreClass = function(element, className) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
- Element.collectTextNodesIgnoreClass(node, className) : ''));
- }).flatten().join('');
-}
-
-Element.setContentZoom = function(element, percent) {
- element = $(element);
- Element.setStyle(element, {fontSize: (percent/100) + 'em'});
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
-}
-
-Element.getOpacity = function(element){
- var opacity;
- if (opacity = Element.getStyle(element, 'opacity'))
- return parseFloat(opacity);
- if (opacity = (Element.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))
- if(opacity[1]) return parseFloat(opacity[1]) / 100;
- return 1.0;
-}
-
-Element.setOpacity = function(element, value){
- element= $(element);
- if (value == 1){
- Element.setStyle(element, { opacity:
- (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ?
- 0.999999 : null });
- if(/MSIE/.test(navigator.userAgent))
- Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});
- } else {
- if(value < 0.00001) value = 0;
- Element.setStyle(element, {opacity: value});
- if(/MSIE/.test(navigator.userAgent))
- Element.setStyle(element,
- { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
- 'alpha(opacity='+value*100+')' });
- }
-}
-
-Element.getInlineOpacity = function(element){
- return $(element).style.opacity || '';
-}
-
-Element.childrenWithClassName = function(element, className, findFirst) {
- var classNameRegExp = new RegExp("(^|\\s)" + className + "(\\s|$)");
- var results = $A($(element).getElementsByTagName('*'))[findFirst ? 'detect' : 'select']( function(c) {
- return (c.className && c.className.match(classNameRegExp));
- });
- if(!results) results = [];
- return results;
-}
-
-Element.forceRerendering = function(element) {
- try {
- element = $(element);
- var n = document.createTextNode(' ');
- element.appendChild(n);
- element.removeChild(n);
- } catch(e) { }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Array.prototype.call = function() {
- var args = arguments;
- this.each(function(f){ f.apply(this, args) });
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Effect = {
- tagifyText: function(element) {
- var tagifyStyle = 'position:relative';
- if(/MSIE/.test(navigator.userAgent)) tagifyStyle += ';zoom:1';
- element = $(element);
- $A(element.childNodes).each( function(child) {
- if(child.nodeType==3) {
- child.nodeValue.toArray().each( function(character) {
- element.insertBefore(
- Builder.node('span',{style: tagifyStyle},
- character == ' ' ? String.fromCharCode(160) : character),
- child);
- });
- Element.remove(child);
- }
- });
- },
- multiple: function(element, effect) {
- var elements;
- if(((typeof element == 'object') ||
- (typeof element == 'function')) &&
- (element.length))
- elements = element;
- else
- elements = $(element).childNodes;
-
- var options = Object.extend({
- speed: 0.1,
- delay: 0.0
- }, arguments[2] || {});
- var masterDelay = options.delay;
-
- $A(elements).each( function(element, index) {
- new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
- });
- },
- PAIRS: {
- 'slide': ['SlideDown','SlideUp'],
- 'blind': ['BlindDown','BlindUp'],
- 'appear': ['Appear','Fade']
- },
- toggle: function(element, effect) {
- element = $(element);
- effect = (effect || 'appear').toLowerCase();
- var options = Object.extend({
- queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
- }, arguments[2] || {});
- Effect[element.visible() ?
- Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
- }
-};
-
-var Effect2 = Effect; // deprecated
-
-/* ------------- transitions ------------- */
-
-Effect.Transitions = {}
-
-Effect.Transitions.linear = function(pos) {
- return pos;
-}
-Effect.Transitions.sinoidal = function(pos) {
- return (-Math.cos(pos*Math.PI)/2) + 0.5;
-}
-Effect.Transitions.reverse = function(pos) {
- return 1-pos;
-}
-Effect.Transitions.flicker = function(pos) {
- return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
-}
-Effect.Transitions.wobble = function(pos) {
- return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
-}
-Effect.Transitions.pulse = function(pos) {
- return (Math.floor(pos*10) % 2 == 0 ?
- (pos*10-Math.floor(pos*10)) : 1-(pos*10-Math.floor(pos*10)));
-}
-Effect.Transitions.none = function(pos) {
- return 0;
-}
-Effect.Transitions.full = function(pos) {
- return 1;
-}
-
-/* ------------- core effects ------------- */
-
-Effect.ScopedQueue = Class.create();
-Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
- initialize: function() {
- this.effects = [];
- this.interval = null;
- },
- _each: function(iterator) {
- this.effects._each(iterator);
- },
- add: function(effect) {
- var timestamp = new Date().getTime();
-
- var position = (typeof effect.options.queue == 'string') ?
- effect.options.queue : effect.options.queue.position;
-
- switch(position) {
- case 'front':
- // move unstarted effects after this effect
- this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
- e.startOn += effect.finishOn;
- e.finishOn += effect.finishOn;
- });
- break;
- case 'end':
- // start effect after last queued effect has finished
- timestamp = this.effects.pluck('finishOn').max() || timestamp;
- break;
- }
-
- effect.startOn += timestamp;
- effect.finishOn += timestamp;
-
- if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
- this.effects.push(effect);
-
- if(!this.interval)
- this.interval = setInterval(this.loop.bind(this), 40);
- },
- remove: function(effect) {
- this.effects = this.effects.reject(function(e) { return e==effect });
- if(this.effects.length == 0) {
- clearInterval(this.interval);
- this.interval = null;
- }
- },
- loop: function() {
- var timePos = new Date().getTime();
- this.effects.invoke('loop', timePos);
- }
-});
-
-Effect.Queues = {
- instances: $H(),
- get: function(queueName) {
- if(typeof queueName != 'string') return queueName;
-
- if(!this.instances[queueName])
- this.instances[queueName] = new Effect.ScopedQueue();
-
- return this.instances[queueName];
- }
-}
-Effect.Queue = Effect.Queues.get('global');
-
-Effect.DefaultOptions = {
- transition: Effect.Transitions.sinoidal,
- duration: 1.0, // seconds
- fps: 25.0, // max. 25fps due to Effect.Queue implementation
- sync: false, // true for combining
- from: 0.0,
- to: 1.0,
- delay: 0.0,
- queue: 'parallel'
-}
-
-Effect.Base = function() {};
-Effect.Base.prototype = {
- position: null,
- start: function(options) {
- this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
- this.currentFrame = 0;
- this.state = 'idle';
- this.startOn = this.options.delay*1000;
- this.finishOn = this.startOn + (this.options.duration*1000);
- this.event('beforeStart');
- if(!this.options.sync)
- Effect.Queues.get(typeof this.options.queue == 'string' ?
- 'global' : this.options.queue.scope).add(this);
- },
- loop: function(timePos) {
- if(timePos >= this.startOn) {
- if(timePos >= this.finishOn) {
- this.render(1.0);
- this.cancel();
- this.event('beforeFinish');
- if(this.finish) this.finish();
- this.event('afterFinish');
- return;
- }
- var pos = (timePos - this.startOn) / (this.finishOn - this.startOn);
- var frame = Math.round(pos * this.options.fps * this.options.duration);
- if(frame > this.currentFrame) {
- this.render(pos);
- this.currentFrame = frame;
- }
- }
- },
- render: function(pos) {
- if(this.state == 'idle') {
- this.state = 'running';
- this.event('beforeSetup');
- if(this.setup) this.setup();
- this.event('afterSetup');
- }
- if(this.state == 'running') {
- if(this.options.transition) pos = this.options.transition(pos);
- pos *= (this.options.to-this.options.from);
- pos += this.options.from;
- this.position = pos;
- this.event('beforeUpdate');
- if(this.update) this.update(pos);
- this.event('afterUpdate');
- }
- },
- cancel: function() {
- if(!this.options.sync)
- Effect.Queues.get(typeof this.options.queue == 'string' ?
- 'global' : this.options.queue.scope).remove(this);
- this.state = 'finished';
- },
- event: function(eventName) {
- if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
- if(this.options[eventName]) this.options[eventName](this);
- },
- inspect: function() {
- return '#<Effect:' + $H(this).inspect() + ',options:' + $H(this.options).inspect() + '>';
- }
-}
-
-Effect.Parallel = Class.create();
-Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), {
- initialize: function(effects) {
- this.effects = effects || [];
- this.start(arguments[1]);
- },
- update: function(position) {
- this.effects.invoke('render', position);
- },
- finish: function(position) {
- this.effects.each( function(effect) {
- effect.render(1.0);
- effect.cancel();
- effect.event('beforeFinish');
- if(effect.finish) effect.finish(position);
- effect.event('afterFinish');
- });
- }
-});
-
-Effect.Opacity = Class.create();
-Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- // make this work on IE on elements without 'layout'
- if(/MSIE/.test(navigator.userAgent) && (!this.element.hasLayout))
- this.element.setStyle({zoom: 1});
- var options = Object.extend({
- from: this.element.getOpacity() || 0.0,
- to: 1.0
- }, arguments[1] || {});
- this.start(options);
- },
- update: function(position) {
- this.element.setOpacity(position);
- }
-});
-
-Effect.Move = Class.create();
-Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- var options = Object.extend({
- x: 0,
- y: 0,
- mode: 'relative'
- }, arguments[1] || {});
- this.start(options);
- },
- setup: function() {
- // Bug in Opera: Opera returns the "real" position of a static element or
- // relative element that does not have top/left explicitly set.
- // ==> Always set top and left for position relative elements in your stylesheets
- // (to 0 if you do not need them)
- this.element.makePositioned();
- this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
- this.originalTop = parseFloat(this.element.getStyle('top') || '0');
- if(this.options.mode == 'absolute') {
- // absolute movement, so we need to calc deltaX and deltaY
- this.options.x = this.options.x - this.originalLeft;
- this.options.y = this.options.y - this.originalTop;
- }
- },
- update: function(position) {
- this.element.setStyle({
- left: this.options.x * position + this.originalLeft + 'px',
- top: this.options.y * position + this.originalTop + 'px'
- });
- }
-});
-
-// for backwards compatibility
-Effect.MoveBy = function(element, toTop, toLeft) {
- return new Effect.Move(element,
- Object.extend({ x: toLeft, y: toTop }, arguments[3] || {}));
-};
-
-Effect.Scale = Class.create();
-Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), {
- initialize: function(element, percent) {
- this.element = $(element)
- var options = Object.extend({
- scaleX: true,
- scaleY: true,
- scaleContent: true,
- scaleFromCenter: false,
- scaleMode: 'box', // 'box' or 'contents' or {} with provided values
- scaleFrom: 100.0,
- scaleTo: percent
- }, arguments[2] || {});
- this.start(options);
- },
- setup: function() {
- this.restoreAfterFinish = this.options.restoreAfterFinish || false;
- this.elementPositioning = this.element.getStyle('position');
-
- this.originalStyle = {};
- ['top','left','width','height','fontSize'].each( function(k) {
- this.originalStyle[k] = this.element.style[k];
- }.bind(this));
-
- this.originalTop = this.element.offsetTop;
- this.originalLeft = this.element.offsetLeft;
-
- var fontSize = this.element.getStyle('font-size') || '100%';
- ['em','px','%'].each( function(fontSizeType) {
- if(fontSize.indexOf(fontSizeType)>0) {
- this.fontSize = parseFloat(fontSize);
- this.fontSizeType = fontSizeType;
- }
- }.bind(this));
-
- this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
-
- this.dims = null;
- if(this.options.scaleMode=='box')
- this.dims = [this.element.offsetHeight, this.element.offsetWidth];
- if(/^content/.test(this.options.scaleMode))
- this.dims = [this.element.scrollHeight, this.element.scrollWidth];
- if(!this.dims)
- this.dims = [this.options.scaleMode.originalHeight,
- this.options.scaleMode.originalWidth];
- },
- update: function(position) {
- var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
- if(this.options.scaleContent && this.fontSize)
- this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
- this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
- },
- finish: function(position) {
- if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
- },
- setDimensions: function(height, width) {
- var d = {};
- if(this.options.scaleX) d.width = width + 'px';
- if(this.options.scaleY) d.height = height + 'px';
- if(this.options.scaleFromCenter) {
- var topd = (height - this.dims[0])/2;
- var leftd = (width - this.dims[1])/2;
- if(this.elementPositioning == 'absolute') {
- if(this.options.scaleY) d.top = this.originalTop-topd + 'px';
- if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
- } else {
- if(this.options.scaleY) d.top = -topd + 'px';
- if(this.options.scaleX) d.left = -leftd + 'px';
- }
- }
- this.element.setStyle(d);
- }
-});
-
-Effect.Highlight = Class.create();
-Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {});
- this.start(options);
- },
- setup: function() {
- // Prevent executing on elements not in the layout flow
- if(this.element.getStyle('display')=='none') { this.cancel(); return; }
- // Disable background image during the effect
- this.oldStyle = {
- backgroundImage: this.element.getStyle('background-image') };
- this.element.setStyle({backgroundImage: 'none'});
- if(!this.options.endcolor)
- this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
- if(!this.options.restorecolor)
- this.options.restorecolor = this.element.getStyle('background-color');
- // init color calculations
- this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
- this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
- },
- update: function(position) {
- this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
- return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) });
- },
- finish: function() {
- this.element.setStyle(Object.extend(this.oldStyle, {
- backgroundColor: this.options.restorecolor
- }));
- }
-});
-
-Effect.ScrollTo = Class.create();
-Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), {
- initialize: function(element) {
- this.element = $(element);
- this.start(arguments[1] || {});
- },
- setup: function() {
- Position.prepare();
- var offsets = Position.cumulativeOffset(this.element);
- if(this.options.offset) offsets[1] += this.options.offset;
- var max = window.innerHeight ?
- window.height - window.innerHeight :
- document.body.scrollHeight -
- (document.documentElement.clientHeight ?
- document.documentElement.clientHeight : document.body.clientHeight);
- this.scrollStart = Position.deltaY;
- this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart;
- },
- update: function(position) {
- Position.prepare();
- window.scrollTo(Position.deltaX,
- this.scrollStart + (position*this.delta));
- }
-});
-
-/* ------------- combination effects ------------- */
-
-Effect.Fade = function(element) {
- element = $(element);
- var oldOpacity = element.getInlineOpacity();
- var options = Object.extend({
- from: element.getOpacity() || 1.0,
- to: 0.0,
- afterFinishInternal: function(effect) {
- if(effect.options.to!=0) return;
- effect.element.hide();
- effect.element.setStyle({opacity: oldOpacity});
- }}, arguments[1] || {});
- return new Effect.Opacity(element,options);
-}
-
-Effect.Appear = function(element) {
- element = $(element);
- var options = Object.extend({
- from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
- to: 1.0,
- // force Safari to render floated elements properly
- afterFinishInternal: function(effect) {
- effect.element.forceRerendering();
- },
- beforeSetup: function(effect) {
- effect.element.setOpacity(effect.options.from);
- effect.element.show();
- }}, arguments[1] || {});
- return new Effect.Opacity(element,options);
-}
-
-Effect.Puff = function(element) {
- element = $(element);
- var oldStyle = { opacity: element.getInlineOpacity(), position: element.getStyle('position') };
- return new Effect.Parallel(
- [ new Effect.Scale(element, 200,
- { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
- Object.extend({ duration: 1.0,
- beforeSetupInternal: function(effect) {
- effect.effects[0].element.setStyle({position: 'absolute'}); },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide();
- effect.effects[0].element.setStyle(oldStyle); }
- }, arguments[1] || {})
- );
-}
-
-Effect.BlindUp = function(element) {
- element = $(element);
- element.makeClipping();
- return new Effect.Scale(element, 0,
- Object.extend({ scaleContent: false,
- scaleX: false,
- restoreAfterFinish: true,
- afterFinishInternal: function(effect) {
- effect.element.hide();
- effect.element.undoClipping();
- }
- }, arguments[1] || {})
- );
-}
-
-Effect.BlindDown = function(element) {
- element = $(element);
- var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100,
- Object.extend({ scaleContent: false,
- scaleX: false,
- scaleFrom: 0,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) {
- effect.element.makeClipping();
- effect.element.setStyle({height: '0px'});
- effect.element.show();
- },
- afterFinishInternal: function(effect) {
- effect.element.undoClipping();
- }
- }, arguments[1] || {})
- );
-}
-
-Effect.SwitchOff = function(element) {
- element = $(element);
- var oldOpacity = element.getInlineOpacity();
- return new Effect.Appear(element, {
- duration: 0.4,
- from: 0,
- transition: Effect.Transitions.flicker,
- afterFinishInternal: function(effect) {
- new Effect.Scale(effect.element, 1, {
- duration: 0.3, scaleFromCenter: true,
- scaleX: false, scaleContent: false, restoreAfterFinish: true,
- beforeSetup: function(effect) {
- effect.element.makePositioned();
- effect.element.makeClipping();
- },
- afterFinishInternal: function(effect) {
- effect.element.hide();
- effect.element.undoClipping();
- effect.element.undoPositioned();
- effect.element.setStyle({opacity: oldOpacity});
- }
- })
- }
- });
-}
-
-Effect.DropOut = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.getStyle('top'),
- left: element.getStyle('left'),
- opacity: element.getInlineOpacity() };
- return new Effect.Parallel(
- [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
- Object.extend(
- { duration: 0.5,
- beforeSetup: function(effect) {
- effect.effects[0].element.makePositioned();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide();
- effect.effects[0].element.undoPositioned();
- effect.effects[0].element.setStyle(oldStyle);
- }
- }, arguments[1] || {}));
-}
-
-Effect.Shake = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.getStyle('top'),
- left: element.getStyle('left') };
- return new Effect.Move(element,
- { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
- effect.element.undoPositioned();
- effect.element.setStyle(oldStyle);
- }}) }}) }}) }}) }}) }});
-}
-
-Effect.SlideDown = function(element) {
- element = $(element);
- element.cleanWhitespace();
- // SlideDown need to have the content of the element wrapped in a container element with fixed height!
- var oldInnerBottom = $(element.firstChild).getStyle('bottom');
- var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100, Object.extend({
- scaleContent: false,
- scaleX: false,
- scaleFrom: window.opera ? 0 : 1,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) {
- effect.element.makePositioned();
- effect.element.firstChild.makePositioned();
- if(window.opera) effect.element.setStyle({top: ''});
- effect.element.makeClipping();
- effect.element.setStyle({height: '0px'});
- effect.element.show(); },
- afterUpdateInternal: function(effect) {
- effect.element.firstChild.setStyle({bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' });
- },
- afterFinishInternal: function(effect) {
- effect.element.undoClipping();
- // IE will crash if child is undoPositioned first
- if(/MSIE/.test(navigator.userAgent)){
- effect.element.undoPositioned();
- effect.element.firstChild.undoPositioned();
- }else{
- effect.element.firstChild.undoPositioned();
- effect.element.undoPositioned();
- }
- effect.element.firstChild.setStyle({bottom: oldInnerBottom}); }
- }, arguments[1] || {})
- );
-}
-
-Effect.SlideUp = function(element) {
- element = $(element);
- element.cleanWhitespace();
- var oldInnerBottom = $(element.firstChild).getStyle('bottom');
- return new Effect.Scale(element, window.opera ? 0 : 1,
- Object.extend({ scaleContent: false,
- scaleX: false,
- scaleMode: 'box',
- scaleFrom: 100,
- restoreAfterFinish: true,
- beforeStartInternal: function(effect) {
- effect.element.makePositioned();
- effect.element.firstChild.makePositioned();
- if(window.opera) effect.element.setStyle({top: ''});
- effect.element.makeClipping();
- effect.element.show(); },
- afterUpdateInternal: function(effect) {
- effect.element.firstChild.setStyle({bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' }); },
- afterFinishInternal: function(effect) {
- effect.element.hide();
- effect.element.undoClipping();
- effect.element.firstChild.undoPositioned();
- effect.element.undoPositioned();
- effect.element.setStyle({bottom: oldInnerBottom}); }
- }, arguments[1] || {})
- );
-}
-
-// Bug in opera makes the TD containing this element expand for a instance after finish
-Effect.Squish = function(element) {
- return new Effect.Scale(element, window.opera ? 1 : 0,
- { restoreAfterFinish: true,
- beforeSetup: function(effect) {
- effect.element.makeClipping(effect.element); },
- afterFinishInternal: function(effect) {
- effect.element.hide(effect.element);
- effect.element.undoClipping(effect.element); }
- });
-}
-
-Effect.Grow = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransition: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.full
- }, arguments[1] || {});
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: element.getInlineOpacity() };
-
- var dims = element.getDimensions();
- var initialMoveX, initialMoveY;
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- initialMoveX = initialMoveY = moveX = moveY = 0;
- break;
- case 'top-right':
- initialMoveX = dims.width;
- initialMoveY = moveY = 0;
- moveX = -dims.width;
- break;
- case 'bottom-left':
- initialMoveX = moveX = 0;
- initialMoveY = dims.height;
- moveY = -dims.height;
- break;
- case 'bottom-right':
- initialMoveX = dims.width;
- initialMoveY = dims.height;
- moveX = -dims.width;
- moveY = -dims.height;
- break;
- case 'center':
- initialMoveX = dims.width / 2;
- initialMoveY = dims.height / 2;
- moveX = -dims.width / 2;
- moveY = -dims.height / 2;
- break;
- }
-
- return new Effect.Move(element, {
- x: initialMoveX,
- y: initialMoveY,
- duration: 0.01,
- beforeSetup: function(effect) {
- effect.element.hide();
- effect.element.makeClipping();
- effect.element.makePositioned();
- },
- afterFinishInternal: function(effect) {
- new Effect.Parallel(
- [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
- new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
- new Effect.Scale(effect.element, 100, {
- scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
- sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
- ], Object.extend({
- beforeSetup: function(effect) {
- effect.effects[0].element.setStyle({height: '0px'});
- effect.effects[0].element.show();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.undoClipping();
- effect.effects[0].element.undoPositioned();
- effect.effects[0].element.setStyle(oldStyle);
- }
- }, options)
- )
- }
- });
-}
-
-Effect.Shrink = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransition: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.none
- }, arguments[1] || {});
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: element.getInlineOpacity() };
-
- var dims = element.getDimensions();
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- moveX = moveY = 0;
- break;
- case 'top-right':
- moveX = dims.width;
- moveY = 0;
- break;
- case 'bottom-left':
- moveX = 0;
- moveY = dims.height;
- break;
- case 'bottom-right':
- moveX = dims.width;
- moveY = dims.height;
- break;
- case 'center':
- moveX = dims.width / 2;
- moveY = dims.height / 2;
- break;
- }
-
- return new Effect.Parallel(
- [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
- new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
- new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
- ], Object.extend({
- beforeStartInternal: function(effect) {
- effect.effects[0].element.makePositioned();
- effect.effects[0].element.makeClipping(); },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide();
- effect.effects[0].element.undoClipping();
- effect.effects[0].element.undoPositioned();
- effect.effects[0].element.setStyle(oldStyle); }
- }, options)
- );
-}
-
-Effect.Pulsate = function(element) {
- element = $(element);
- var options = arguments[1] || {};
- var oldOpacity = element.getInlineOpacity();
- var transition = options.transition || Effect.Transitions.sinoidal;
- var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos)) };
- reverser.bind(transition);
- return new Effect.Opacity(element,
- Object.extend(Object.extend({ duration: 3.0, from: 0,
- afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
- }, options), {transition: reverser}));
-}
-
-Effect.Fold = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- width: element.style.width,
- height: element.style.height };
- Element.makeClipping(element);
- return new Effect.Scale(element, 5, Object.extend({
- scaleContent: false,
- scaleX: false,
- afterFinishInternal: function(effect) {
- new Effect.Scale(element, 1, {
- scaleContent: false,
- scaleY: false,
- afterFinishInternal: function(effect) {
- effect.element.hide();
- effect.element.undoClipping();
- effect.element.setStyle(oldStyle);
- } });
- }}, arguments[1] || {}));
-};
-
-['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom',
- 'collectTextNodes','collectTextNodesIgnoreClass','childrenWithClassName'].each(
- function(f) { Element.Methods[f] = Element[f]; }
-);
-
-Element.Methods.visualEffect = function(element, effect, options) {
- s = effect.gsub(/_/, '-').camelize();
- effect_class = s.charAt(0).toUpperCase() + s.substring(1);
- new Effect[effect_class](element, options);
- return $(element);
-};
-
-Element.addMethods(); \ No newline at end of file
diff --git a/library/cropper/lib/prototype.js b/library/cropper/lib/prototype.js
deleted file mode 100644
index 0caf9cd7f..000000000
--- a/library/cropper/lib/prototype.js
+++ /dev/null
@@ -1,2006 +0,0 @@
-/* Prototype JavaScript framework, version 1.5.0_rc0
- * (c) 2005 Sam Stephenson <sam@conio.net>
- *
- * Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see the Prototype web site: http://prototype.conio.net/
- *
-/*--------------------------------------------------------------------------*/
-
-var Prototype = {
- Version: '1.5.0_rc0',
- ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',
-
- emptyFunction: function() {},
- K: function(x) {return x}
-}
-
-var Class = {
- create: function() {
- return function() {
- this.initialize.apply(this, arguments);
- }
- }
-}
-
-var Abstract = new Object();
-
-Object.extend = function(destination, source) {
- for (var property in source) {
- destination[property] = source[property];
- }
- return destination;
-}
-
-Object.inspect = function(object) {
- try {
- if (object == undefined) return 'undefined';
- if (object == null) return 'null';
- return object.inspect ? object.inspect() : object.toString();
- } catch (e) {
- if (e instanceof RangeError) return '...';
- throw e;
- }
-}
-
-Function.prototype.bind = function() {
- var __method = this, args = $A(arguments), object = args.shift();
- return function() {
- return __method.apply(object, args.concat($A(arguments)));
- }
-}
-
-Function.prototype.bindAsEventListener = function(object) {
- var __method = this;
- return function(event) {
- return __method.call(object, event || window.event);
- }
-}
-
-Object.extend(Number.prototype, {
- toColorPart: function() {
- var digits = this.toString(16);
- if (this < 16) return '0' + digits;
- return digits;
- },
-
- succ: function() {
- return this + 1;
- },
-
- times: function(iterator) {
- $R(0, this, true).each(iterator);
- return this;
- }
-});
-
-var Try = {
- these: function() {
- var returnValue;
-
- for (var i = 0; i < arguments.length; i++) {
- var lambda = arguments[i];
- try {
- returnValue = lambda();
- break;
- } catch (e) {}
- }
-
- return returnValue;
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var PeriodicalExecuter = Class.create();
-PeriodicalExecuter.prototype = {
- initialize: function(callback, frequency) {
- this.callback = callback;
- this.frequency = frequency;
- this.currentlyExecuting = false;
-
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- if (!this.currentlyExecuting) {
- try {
- this.currentlyExecuting = true;
- this.callback();
- } finally {
- this.currentlyExecuting = false;
- }
- }
- }
-}
-Object.extend(String.prototype, {
- gsub: function(pattern, replacement) {
- var result = '', source = this, match;
- replacement = arguments.callee.prepareReplacement(replacement);
-
- while (source.length > 0) {
- if (match = source.match(pattern)) {
- result += source.slice(0, match.index);
- result += (replacement(match) || '').toString();
- source = source.slice(match.index + match[0].length);
- } else {
- result += source, source = '';
- }
- }
- return result;
- },
-
- sub: function(pattern, replacement, count) {
- replacement = this.gsub.prepareReplacement(replacement);
- count = count === undefined ? 1 : count;
-
- return this.gsub(pattern, function(match) {
- if (--count < 0) return match[0];
- return replacement(match);
- });
- },
-
- scan: function(pattern, iterator) {
- this.gsub(pattern, iterator);
- return this;
- },
-
- truncate: function(length, truncation) {
- length = length || 30;
- truncation = truncation === undefined ? '...' : truncation;
- return this.length > length ?
- this.slice(0, length - truncation.length) + truncation : this;
- },
-
- strip: function() {
- return this.replace(/^\s+/, '').replace(/\s+$/, '');
- },
-
- stripTags: function() {
- return this.replace(/<\/?[^>]+>/gi, '');
- },
-
- stripScripts: function() {
- return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
- },
-
- extractScripts: function() {
- var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
- var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
- return (this.match(matchAll) || []).map(function(scriptTag) {
- return (scriptTag.match(matchOne) || ['', ''])[1];
- });
- },
-
- evalScripts: function() {
- return this.extractScripts().map(function(script) { return eval(script) });
- },
-
- escapeHTML: function() {
- var div = document.createElement('div');
- var text = document.createTextNode(this);
- div.appendChild(text);
- return div.innerHTML;
- },
-
- unescapeHTML: function() {
- var div = document.createElement('div');
- div.innerHTML = this.stripTags();
- return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
- },
-
- toQueryParams: function() {
- var pairs = this.match(/^\??(.*)$/)[1].split('&');
- return pairs.inject({}, function(params, pairString) {
- var pair = pairString.split('=');
- params[pair[0]] = pair[1];
- return params;
- });
- },
-
- toArray: function() {
- return this.split('');
- },
-
- camelize: function() {
- var oStringList = this.split('-');
- if (oStringList.length == 1) return oStringList[0];
-
- var camelizedString = this.indexOf('-') == 0
- ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
- : oStringList[0];
-
- for (var i = 1, len = oStringList.length; i < len; i++) {
- var s = oStringList[i];
- camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
- }
-
- return camelizedString;
- },
-
- inspect: function() {
- return "'" + this.replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + "'";
- }
-});
-
-String.prototype.gsub.prepareReplacement = function(replacement) {
- if (typeof replacement == 'function') return replacement;
- var template = new Template(replacement);
- return function(match) { return template.evaluate(match) };
-}
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-var Template = Class.create();
-Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
-Template.prototype = {
- initialize: function(template, pattern) {
- this.template = template.toString();
- this.pattern = pattern || Template.Pattern;
- },
-
- evaluate: function(object) {
- return this.template.gsub(this.pattern, function(match) {
- var before = match[1];
- if (before == '\\') return match[2];
- return before + (object[match[3]] || '').toString();
- });
- }
-}
-
-var $break = new Object();
-var $continue = new Object();
-
-var Enumerable = {
- each: function(iterator) {
- var index = 0;
- try {
- this._each(function(value) {
- try {
- iterator(value, index++);
- } catch (e) {
- if (e != $continue) throw e;
- }
- });
- } catch (e) {
- if (e != $break) throw e;
- }
- },
-
- all: function(iterator) {
- var result = true;
- this.each(function(value, index) {
- result = result && !!(iterator || Prototype.K)(value, index);
- if (!result) throw $break;
- });
- return result;
- },
-
- any: function(iterator) {
- var result = true;
- this.each(function(value, index) {
- if (result = !!(iterator || Prototype.K)(value, index))
- throw $break;
- });
- return result;
- },
-
- collect: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- results.push(iterator(value, index));
- });
- return results;
- },
-
- detect: function (iterator) {
- var result;
- this.each(function(value, index) {
- if (iterator(value, index)) {
- result = value;
- throw $break;
- }
- });
- return result;
- },
-
- findAll: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- if (iterator(value, index))
- results.push(value);
- });
- return results;
- },
-
- grep: function(pattern, iterator) {
- var results = [];
- this.each(function(value, index) {
- var stringValue = value.toString();
- if (stringValue.match(pattern))
- results.push((iterator || Prototype.K)(value, index));
- })
- return results;
- },
-
- include: function(object) {
- var found = false;
- this.each(function(value) {
- if (value == object) {
- found = true;
- throw $break;
- }
- });
- return found;
- },
-
- inject: function(memo, iterator) {
- this.each(function(value, index) {
- memo = iterator(memo, value, index);
- });
- return memo;
- },
-
- invoke: function(method) {
- var args = $A(arguments).slice(1);
- return this.collect(function(value) {
- return value[method].apply(value, args);
- });
- },
-
- max: function(iterator) {
- var result;
- this.each(function(value, index) {
- value = (iterator || Prototype.K)(value, index);
- if (result == undefined || value >= result)
- result = value;
- });
- return result;
- },
-
- min: function(iterator) {
- var result;
- this.each(function(value, index) {
- value = (iterator || Prototype.K)(value, index);
- if (result == undefined || value < result)
- result = value;
- });
- return result;
- },
-
- partition: function(iterator) {
- var trues = [], falses = [];
- this.each(function(value, index) {
- ((iterator || Prototype.K)(value, index) ?
- trues : falses).push(value);
- });
- return [trues, falses];
- },
-
- pluck: function(property) {
- var results = [];
- this.each(function(value, index) {
- results.push(value[property]);
- });
- return results;
- },
-
- reject: function(iterator) {
- var results = [];
- this.each(function(value, index) {
- if (!iterator(value, index))
- results.push(value);
- });
- return results;
- },
-
- sortBy: function(iterator) {
- return this.collect(function(value, index) {
- return {value: value, criteria: iterator(value, index)};
- }).sort(function(left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }).pluck('value');
- },
-
- toArray: function() {
- return this.collect(Prototype.K);
- },
-
- zip: function() {
- var iterator = Prototype.K, args = $A(arguments);
- if (typeof args.last() == 'function')
- iterator = args.pop();
-
- var collections = [this].concat(args).map($A);
- return this.map(function(value, index) {
- return iterator(collections.pluck(index));
- });
- },
-
- inspect: function() {
- return '#<Enumerable:' + this.toArray().inspect() + '>';
- }
-}
-
-Object.extend(Enumerable, {
- map: Enumerable.collect,
- find: Enumerable.detect,
- select: Enumerable.findAll,
- member: Enumerable.include,
- entries: Enumerable.toArray
-});
-var $A = Array.from = function(iterable) {
- if (!iterable) return [];
- if (iterable.toArray) {
- return iterable.toArray();
- } else {
- var results = [];
- for (var i = 0; i < iterable.length; i++)
- results.push(iterable[i]);
- return results;
- }
-}
-
-Object.extend(Array.prototype, Enumerable);
-
-if (!Array.prototype._reverse)
- Array.prototype._reverse = Array.prototype.reverse;
-
-Object.extend(Array.prototype, {
- _each: function(iterator) {
- for (var i = 0; i < this.length; i++)
- iterator(this[i]);
- },
-
- clear: function() {
- this.length = 0;
- return this;
- },
-
- first: function() {
- return this[0];
- },
-
- last: function() {
- return this[this.length - 1];
- },
-
- compact: function() {
- return this.select(function(value) {
- return value != undefined || value != null;
- });
- },
-
- flatten: function() {
- return this.inject([], function(array, value) {
- return array.concat(value && value.constructor == Array ?
- value.flatten() : [value]);
- });
- },
-
- without: function() {
- var values = $A(arguments);
- return this.select(function(value) {
- return !values.include(value);
- });
- },
-
- indexOf: function(object) {
- for (var i = 0; i < this.length; i++)
- if (this[i] == object) return i;
- return -1;
- },
-
- reverse: function(inline) {
- return (inline !== false ? this : this.toArray())._reverse();
- },
-
- inspect: function() {
- return '[' + this.map(Object.inspect).join(', ') + ']';
- }
-});
-var Hash = {
- _each: function(iterator) {
- for (var key in this) {
- var value = this[key];
- if (typeof value == 'function') continue;
-
- var pair = [key, value];
- pair.key = key;
- pair.value = value;
- iterator(pair);
- }
- },
-
- keys: function() {
- return this.pluck('key');
- },
-
- values: function() {
- return this.pluck('value');
- },
-
- merge: function(hash) {
- return $H(hash).inject($H(this), function(mergedHash, pair) {
- mergedHash[pair.key] = pair.value;
- return mergedHash;
- });
- },
-
- toQueryString: function() {
- return this.map(function(pair) {
- return pair.map(encodeURIComponent).join('=');
- }).join('&');
- },
-
- inspect: function() {
- return '#<Hash:{' + this.map(function(pair) {
- return pair.map(Object.inspect).join(': ');
- }).join(', ') + '}>';
- }
-}
-
-function $H(object) {
- var hash = Object.extend({}, object || {});
- Object.extend(hash, Enumerable);
- Object.extend(hash, Hash);
- return hash;
-}
-ObjectRange = Class.create();
-Object.extend(ObjectRange.prototype, Enumerable);
-Object.extend(ObjectRange.prototype, {
- initialize: function(start, end, exclusive) {
- this.start = start;
- this.end = end;
- this.exclusive = exclusive;
- },
-
- _each: function(iterator) {
- var value = this.start;
- do {
- iterator(value);
- value = value.succ();
- } while (this.include(value));
- },
-
- include: function(value) {
- if (value < this.start)
- return false;
- if (this.exclusive)
- return value < this.end;
- return value <= this.end;
- }
-});
-
-var $R = function(start, end, exclusive) {
- return new ObjectRange(start, end, exclusive);
-}
-
-var Ajax = {
- getTransport: function() {
- return Try.these(
- function() {return new XMLHttpRequest()},
- function() {return new ActiveXObject('Msxml2.XMLHTTP')},
- function() {return new ActiveXObject('Microsoft.XMLHTTP')}
- ) || false;
- },
-
- activeRequestCount: 0
-}
-
-Ajax.Responders = {
- responders: [],
-
- _each: function(iterator) {
- this.responders._each(iterator);
- },
-
- register: function(responderToAdd) {
- if (!this.include(responderToAdd))
- this.responders.push(responderToAdd);
- },
-
- unregister: function(responderToRemove) {
- this.responders = this.responders.without(responderToRemove);
- },
-
- dispatch: function(callback, request, transport, json) {
- this.each(function(responder) {
- if (responder[callback] && typeof responder[callback] == 'function') {
- try {
- responder[callback].apply(responder, [request, transport, json]);
- } catch (e) {}
- }
- });
- }
-};
-
-Object.extend(Ajax.Responders, Enumerable);
-
-Ajax.Responders.register({
- onCreate: function() {
- Ajax.activeRequestCount++;
- },
-
- onComplete: function() {
- Ajax.activeRequestCount--;
- }
-});
-
-Ajax.Base = function() {};
-Ajax.Base.prototype = {
- setOptions: function(options) {
- this.options = {
- method: 'post',
- asynchronous: true,
- contentType: 'application/x-www-form-urlencoded',
- parameters: ''
- }
- Object.extend(this.options, options || {});
- },
-
- responseIsSuccess: function() {
- return this.transport.status == undefined
- || this.transport.status == 0
- || (this.transport.status >= 200 && this.transport.status < 300);
- },
-
- responseIsFailure: function() {
- return !this.responseIsSuccess();
- }
-}
-
-Ajax.Request = Class.create();
-Ajax.Request.Events =
- ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
- initialize: function(url, options) {
- this.transport = Ajax.getTransport();
- this.setOptions(options);
- this.request(url);
- },
-
- request: function(url) {
- var parameters = this.options.parameters || '';
- if (parameters.length > 0) parameters += '&_=';
-
- try {
- this.url = url;
- if (this.options.method == 'get' && parameters.length > 0)
- this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
-
- Ajax.Responders.dispatch('onCreate', this, this.transport);
-
- this.transport.open(this.options.method, this.url,
- this.options.asynchronous);
-
- if (this.options.asynchronous) {
- this.transport.onreadystatechange = this.onStateChange.bind(this);
- setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
- }
-
- this.setRequestHeaders();
-
- var body = this.options.postBody ? this.options.postBody : parameters;
- this.transport.send(this.options.method == 'post' ? body : null);
-
- } catch (e) {
- this.dispatchException(e);
- }
- },
-
- setRequestHeaders: function() {
- var requestHeaders =
- ['X-Requested-With', 'XMLHttpRequest',
- 'X-Prototype-Version', Prototype.Version,
- 'Accept', 'text/javascript, text/html, application/xml, text/xml, */*'];
-
- if (this.options.method == 'post') {
- requestHeaders.push('Content-type', this.options.contentType);
-
- /* Force "Connection: close" for Mozilla browsers to work around
- * a bug where XMLHttpReqeuest sends an incorrect Content-length
- * header. See Mozilla Bugzilla #246651.
- */
- if (this.transport.overrideMimeType)
- requestHeaders.push('Connection', 'close');
- }
-
- if (this.options.requestHeaders)
- requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
-
- for (var i = 0; i < requestHeaders.length; i += 2)
- this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
- },
-
- onStateChange: function() {
- var readyState = this.transport.readyState;
- if (readyState != 1)
- this.respondToReadyState(this.transport.readyState);
- },
-
- header: function(name) {
- try {
- return this.transport.getResponseHeader(name);
- } catch (e) {}
- },
-
- evalJSON: function() {
- try {
- return eval('(' + this.header('X-JSON') + ')');
- } catch (e) {}
- },
-
- evalResponse: function() {
- try {
- return eval(this.transport.responseText);
- } catch (e) {
- this.dispatchException(e);
- }
- },
-
- respondToReadyState: function(readyState) {
- var event = Ajax.Request.Events[readyState];
- var transport = this.transport, json = this.evalJSON();
-
- if (event == 'Complete') {
- try {
- (this.options['on' + this.transport.status]
- || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
- || Prototype.emptyFunction)(transport, json);
- } catch (e) {
- this.dispatchException(e);
- }
-
- if ((this.header('Content-type') || '').match(/^text\/javascript/i))
- this.evalResponse();
- }
-
- try {
- (this.options['on' + event] || Prototype.emptyFunction)(transport, json);
- Ajax.Responders.dispatch('on' + event, this, transport, json);
- } catch (e) {
- this.dispatchException(e);
- }
-
- /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
- if (event == 'Complete')
- this.transport.onreadystatechange = Prototype.emptyFunction;
- },
-
- dispatchException: function(exception) {
- (this.options.onException || Prototype.emptyFunction)(this, exception);
- Ajax.Responders.dispatch('onException', this, exception);
- }
-});
-
-Ajax.Updater = Class.create();
-
-Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
- initialize: function(container, url, options) {
- this.containers = {
- success: container.success ? $(container.success) : $(container),
- failure: container.failure ? $(container.failure) :
- (container.success ? null : $(container))
- }
-
- this.transport = Ajax.getTransport();
- this.setOptions(options);
-
- var onComplete = this.options.onComplete || Prototype.emptyFunction;
- this.options.onComplete = (function(transport, object) {
- this.updateContent();
- onComplete(transport, object);
- }).bind(this);
-
- this.request(url);
- },
-
- updateContent: function() {
- var receiver = this.responseIsSuccess() ?
- this.containers.success : this.containers.failure;
- var response = this.transport.responseText;
-
- if (!this.options.evalScripts)
- response = response.stripScripts();
-
- if (receiver) {
- if (this.options.insertion) {
- new this.options.insertion(receiver, response);
- } else {
- Element.update(receiver, response);
- }
- }
-
- if (this.responseIsSuccess()) {
- if (this.onComplete)
- setTimeout(this.onComplete.bind(this), 10);
- }
- }
-});
-
-Ajax.PeriodicalUpdater = Class.create();
-Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
- initialize: function(container, url, options) {
- this.setOptions(options);
- this.onComplete = this.options.onComplete;
-
- this.frequency = (this.options.frequency || 2);
- this.decay = (this.options.decay || 1);
-
- this.updater = {};
- this.container = container;
- this.url = url;
-
- this.start();
- },
-
- start: function() {
- this.options.onComplete = this.updateComplete.bind(this);
- this.onTimerEvent();
- },
-
- stop: function() {
- this.updater.onComplete = undefined;
- clearTimeout(this.timer);
- (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
- },
-
- updateComplete: function(request) {
- if (this.options.decay) {
- this.decay = (request.responseText == this.lastText ?
- this.decay * this.options.decay : 1);
-
- this.lastText = request.responseText;
- }
- this.timer = setTimeout(this.onTimerEvent.bind(this),
- this.decay * this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- this.updater = new Ajax.Updater(this.container, this.url, this.options);
- }
-});
-function $() {
- var results = [], element;
- for (var i = 0; i < arguments.length; i++) {
- element = arguments[i];
- if (typeof element == 'string')
- element = document.getElementById(element);
- results.push(Element.extend(element));
- }
- return results.length < 2 ? results[0] : results;
-}
-
-document.getElementsByClassName = function(className, parentElement) {
- var children = ($(parentElement) || document.body).getElementsByTagName('*');
- return $A(children).inject([], function(elements, child) {
- if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
- elements.push(Element.extend(child));
- return elements;
- });
-}
-
-/*--------------------------------------------------------------------------*/
-
-if (!window.Element)
- var Element = new Object();
-
-Element.extend = function(element) {
- if (!element) return;
- if (_nativeExtensions) return element;
-
- if (!element._extended && element.tagName && element != window) {
- var methods = Element.Methods, cache = Element.extend.cache;
- for (property in methods) {
- var value = methods[property];
- if (typeof value == 'function')
- element[property] = cache.findOrStore(value);
- }
- }
-
- element._extended = true;
- return element;
-}
-
-Element.extend.cache = {
- findOrStore: function(value) {
- return this[value] = this[value] || function() {
- return value.apply(null, [this].concat($A(arguments)));
- }
- }
-}
-
-Element.Methods = {
- visible: function(element) {
- return $(element).style.display != 'none';
- },
-
- toggle: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- Element[Element.visible(element) ? 'hide' : 'show'](element);
- }
- },
-
- hide: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = 'none';
- }
- },
-
- show: function() {
- for (var i = 0; i < arguments.length; i++) {
- var element = $(arguments[i]);
- element.style.display = '';
- }
- },
-
- remove: function(element) {
- element = $(element);
- element.parentNode.removeChild(element);
- },
-
- update: function(element, html) {
- $(element).innerHTML = html.stripScripts();
- setTimeout(function() {html.evalScripts()}, 10);
- },
-
- replace: function(element, html) {
- element = $(element);
- if (element.outerHTML) {
- element.outerHTML = html.stripScripts();
- } else {
- var range = element.ownerDocument.createRange();
- range.selectNodeContents(element);
- element.parentNode.replaceChild(
- range.createContextualFragment(html.stripScripts()), element);
- }
- setTimeout(function() {html.evalScripts()}, 10);
- },
-
- getHeight: function(element) {
- element = $(element);
- return element.offsetHeight;
- },
-
- classNames: function(element) {
- return new Element.ClassNames(element);
- },
-
- hasClassName: function(element, className) {
- if (!(element = $(element))) return;
- return Element.classNames(element).include(className);
- },
-
- addClassName: function(element, className) {
- if (!(element = $(element))) return;
- return Element.classNames(element).add(className);
- },
-
- removeClassName: function(element, className) {
- if (!(element = $(element))) return;
- return Element.classNames(element).remove(className);
- },
-
- // removes whitespace-only text node children
- cleanWhitespace: function(element) {
- element = $(element);
- for (var i = 0; i < element.childNodes.length; i++) {
- var node = element.childNodes[i];
- if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
- Element.remove(node);
- }
- },
-
- empty: function(element) {
- return $(element).innerHTML.match(/^\s*$/);
- },
-
- childOf: function(element, ancestor) {
- element = $(element), ancestor = $(ancestor);
- while (element = element.parentNode)
- if (element == ancestor) return true;
- return false;
- },
-
- scrollTo: function(element) {
- element = $(element);
- var x = element.x ? element.x : element.offsetLeft,
- y = element.y ? element.y : element.offsetTop;
- window.scrollTo(x, y);
- },
-
- getStyle: function(element, style) {
- element = $(element);
- var value = element.style[style.camelize()];
- if (!value) {
- if (document.defaultView && document.defaultView.getComputedStyle) {
- var css = document.defaultView.getComputedStyle(element, null);
- value = css ? css.getPropertyValue(style) : null;
- } else if (element.currentStyle) {
- value = element.currentStyle[style.camelize()];
- }
- }
-
- if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
- if (Element.getStyle(element, 'position') == 'static') value = 'auto';
-
- return value == 'auto' ? null : value;
- },
-
- setStyle: function(element, style) {
- element = $(element);
- for (var name in style)
- element.style[name.camelize()] = style[name];
- },
-
- getDimensions: function(element) {
- element = $(element);
- if (Element.getStyle(element, 'display') != 'none')
- return {width: element.offsetWidth, height: element.offsetHeight};
-
- // All *Width and *Height properties give 0 on elements with display none,
- // so enable the element temporarily
- var els = element.style;
- var originalVisibility = els.visibility;
- var originalPosition = els.position;
- els.visibility = 'hidden';
- els.position = 'absolute';
- els.display = '';
- var originalWidth = element.clientWidth;
- var originalHeight = element.clientHeight;
- els.display = 'none';
- els.position = originalPosition;
- els.visibility = originalVisibility;
- return {width: originalWidth, height: originalHeight};
- },
-
- makePositioned: function(element) {
- element = $(element);
- var pos = Element.getStyle(element, 'position');
- if (pos == 'static' || !pos) {
- element._madePositioned = true;
- element.style.position = 'relative';
- // Opera returns the offset relative to the positioning context, when an
- // element is position relative but top and left have not been defined
- if (window.opera) {
- element.style.top = 0;
- element.style.left = 0;
- }
- }
- },
-
- undoPositioned: function(element) {
- element = $(element);
- if (element._madePositioned) {
- element._madePositioned = undefined;
- element.style.position =
- element.style.top =
- element.style.left =
- element.style.bottom =
- element.style.right = '';
- }
- },
-
- makeClipping: function(element) {
- element = $(element);
- if (element._overflow) return;
- element._overflow = element.style.overflow;
- if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
- element.style.overflow = 'hidden';
- },
-
- undoClipping: function(element) {
- element = $(element);
- if (element._overflow) return;
- element.style.overflow = element._overflow;
- element._overflow = undefined;
- }
-}
-
-Object.extend(Element, Element.Methods);
-
-var _nativeExtensions = false;
-
-if(!HTMLElement && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- var HTMLElement = {}
- HTMLElement.prototype = document.createElement('div').__proto__;
-}
-
-Element.addMethods = function(methods) {
- Object.extend(Element.Methods, methods || {});
-
- if(typeof HTMLElement != 'undefined') {
- var methods = Element.Methods, cache = Element.extend.cache;
- for (property in methods) {
- var value = methods[property];
- if (typeof value == 'function')
- HTMLElement.prototype[property] = cache.findOrStore(value);
- }
- _nativeExtensions = true;
- }
-}
-
-Element.addMethods();
-
-var Toggle = new Object();
-Toggle.display = Element.toggle;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.Insertion = function(adjacency) {
- this.adjacency = adjacency;
-}
-
-Abstract.Insertion.prototype = {
- initialize: function(element, content) {
- this.element = $(element);
- this.content = content.stripScripts();
-
- if (this.adjacency && this.element.insertAdjacentHTML) {
- try {
- this.element.insertAdjacentHTML(this.adjacency, this.content);
- } catch (e) {
- var tagName = this.element.tagName.toLowerCase();
- if (tagName == 'tbody' || tagName == 'tr') {
- this.insertContent(this.contentFromAnonymousTable());
- } else {
- throw e;
- }
- }
- } else {
- this.range = this.element.ownerDocument.createRange();
- if (this.initializeRange) this.initializeRange();
- this.insertContent([this.range.createContextualFragment(this.content)]);
- }
-
- setTimeout(function() {content.evalScripts()}, 10);
- },
-
- contentFromAnonymousTable: function() {
- var div = document.createElement('div');
- div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
- return $A(div.childNodes[0].childNodes[0].childNodes);
- }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
- initializeRange: function() {
- this.range.setStartBefore(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment, this.element);
- }).bind(this));
- }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(true);
- },
-
- insertContent: function(fragments) {
- fragments.reverse(false).each((function(fragment) {
- this.element.insertBefore(fragment, this.element.firstChild);
- }).bind(this));
- }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.appendChild(fragment);
- }).bind(this));
- }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
- initializeRange: function() {
- this.range.setStartAfter(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment,
- this.element.nextSibling);
- }).bind(this));
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
-
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
-
- set: function(className) {
- this.element.className = className;
- },
-
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set(this.toArray().concat(classNameToAdd).join(' '));
- },
-
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set(this.select(function(className) {
- return className != classNameToRemove;
- }).join(' '));
- },
-
- toString: function() {
- return this.toArray().join(' ');
- }
-}
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-var Selector = Class.create();
-Selector.prototype = {
- initialize: function(expression) {
- this.params = {classNames: []};
- this.expression = expression.toString().strip();
- this.parseExpression();
- this.compileMatcher();
- },
-
- parseExpression: function() {
- function abort(message) { throw 'Parse error in selector: ' + message; }
-
- if (this.expression == '') abort('empty expression');
-
- var params = this.params, expr = this.expression, match, modifier, clause, rest;
- while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
- params.attributes = params.attributes || [];
- params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
- expr = match[1];
- }
-
- if (expr == '*') return this.params.wildcard = true;
-
- while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
- modifier = match[1], clause = match[2], rest = match[3];
- switch (modifier) {
- case '#': params.id = clause; break;
- case '.': params.classNames.push(clause); break;
- case '':
- case undefined: params.tagName = clause.toUpperCase(); break;
- default: abort(expr.inspect());
- }
- expr = rest;
- }
-
- if (expr.length > 0) abort(expr.inspect());
- },
-
- buildMatchExpression: function() {
- var params = this.params, conditions = [], clause;
-
- if (params.wildcard)
- conditions.push('true');
- if (clause = params.id)
- conditions.push('element.id == ' + clause.inspect());
- if (clause = params.tagName)
- conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
- if ((clause = params.classNames).length > 0)
- for (var i = 0; i < clause.length; i++)
- conditions.push('Element.hasClassName(element, ' + clause[i].inspect() + ')');
- if (clause = params.attributes) {
- clause.each(function(attribute) {
- var value = 'element.getAttribute(' + attribute.name.inspect() + ')';
- var splitValueBy = function(delimiter) {
- return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
- }
-
- switch (attribute.operator) {
- case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break;
- case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
- case '|=': conditions.push(
- splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
- ); break;
- case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break;
- case '':
- case undefined: conditions.push(value + ' != null'); break;
- default: throw 'Unknown operator ' + attribute.operator + ' in selector';
- }
- });
- }
-
- return conditions.join(' && ');
- },
-
- compileMatcher: function() {
- this.match = new Function('element', 'if (!element.tagName) return false; \
- return ' + this.buildMatchExpression());
- },
-
- findElements: function(scope) {
- var element;
-
- if (element = $(this.params.id))
- if (this.match(element))
- if (!scope || Element.childOf(element, scope))
- return [element];
-
- scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
-
- var results = [];
- for (var i = 0; i < scope.length; i++)
- if (this.match(element = scope[i]))
- results.push(Element.extend(element));
-
- return results;
- },
-
- toString: function() {
- return this.expression;
- }
-}
-
-function $$() {
- return $A(arguments).map(function(expression) {
- return expression.strip().split(/\s+/).inject([null], function(results, expr) {
- var selector = new Selector(expr);
- return results.map(selector.findElements.bind(selector)).flatten();
- });
- }).flatten();
-}
-var Field = {
- clear: function() {
- for (var i = 0; i < arguments.length; i++)
- $(arguments[i]).value = '';
- },
-
- focus: function(element) {
- $(element).focus();
- },
-
- present: function() {
- for (var i = 0; i < arguments.length; i++)
- if ($(arguments[i]).value == '') return false;
- return true;
- },
-
- select: function(element) {
- $(element).select();
- },
-
- activate: function(element) {
- element = $(element);
- element.focus();
- if (element.select)
- element.select();
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Form = {
- serialize: function(form) {
- var elements = Form.getElements($(form));
- var queryComponents = new Array();
-
- for (var i = 0; i < elements.length; i++) {
- var queryComponent = Form.Element.serialize(elements[i]);
- if (queryComponent)
- queryComponents.push(queryComponent);
- }
-
- return queryComponents.join('&');
- },
-
- getElements: function(form) {
- form = $(form);
- var elements = new Array();
-
- for (var tagName in Form.Element.Serializers) {
- var tagElements = form.getElementsByTagName(tagName);
- for (var j = 0; j < tagElements.length; j++)
- elements.push(tagElements[j]);
- }
- return elements;
- },
-
- getInputs: function(form, typeName, name) {
- form = $(form);
- var inputs = form.getElementsByTagName('input');
-
- if (!typeName && !name)
- return inputs;
-
- var matchingInputs = new Array();
- for (var i = 0; i < inputs.length; i++) {
- var input = inputs[i];
- if ((typeName && input.type != typeName) ||
- (name && input.name != name))
- continue;
- matchingInputs.push(input);
- }
-
- return matchingInputs;
- },
-
- disable: function(form) {
- var elements = Form.getElements(form);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- element.blur();
- element.disabled = 'true';
- }
- },
-
- enable: function(form) {
- var elements = Form.getElements(form);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- element.disabled = '';
- }
- },
-
- findFirstElement: function(form) {
- return Form.getElements(form).find(function(element) {
- return element.type != 'hidden' && !element.disabled &&
- ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
- });
- },
-
- focusFirstElement: function(form) {
- Field.activate(Form.findFirstElement(form));
- },
-
- reset: function(form) {
- $(form).reset();
- }
-}
-
-Form.Element = {
- serialize: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- var parameter = Form.Element.Serializers[method](element);
-
- if (parameter) {
- var key = encodeURIComponent(parameter[0]);
- if (key.length == 0) return;
-
- if (parameter[1].constructor != Array)
- parameter[1] = [parameter[1]];
-
- return parameter[1].map(function(value) {
- return key + '=' + encodeURIComponent(value);
- }).join('&');
- }
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- var parameter = Form.Element.Serializers[method](element);
-
- if (parameter)
- return parameter[1];
- }
-}
-
-Form.Element.Serializers = {
- input: function(element) {
- switch (element.type.toLowerCase()) {
- case 'submit':
- case 'hidden':
- case 'password':
- case 'text':
- return Form.Element.Serializers.textarea(element);
- case 'checkbox':
- case 'radio':
- return Form.Element.Serializers.inputSelector(element);
- }
- return false;
- },
-
- inputSelector: function(element) {
- if (element.checked)
- return [element.name, element.value];
- },
-
- textarea: function(element) {
- return [element.name, element.value];
- },
-
- select: function(element) {
- return Form.Element.Serializers[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- },
-
- selectOne: function(element) {
- var value = '', opt, index = element.selectedIndex;
- if (index >= 0) {
- opt = element.options[index];
- value = opt.value || opt.text;
- }
- return [element.name, value];
- },
-
- selectMany: function(element) {
- var value = [];
- for (var i = 0; i < element.length; i++) {
- var opt = element.options[i];
- if (opt.selected)
- value.push(opt.value || opt.text);
- }
- return [element.name, value];
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var $F = Form.Element.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
- initialize: function(element, frequency, callback) {
- this.frequency = frequency;
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
- initialize: function(element, callback) {
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- if (this.element.tagName.toLowerCase() == 'form')
- this.registerFormCallbacks();
- else
- this.registerCallback(this.element);
- },
-
- onElementEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- },
-
- registerFormCallbacks: function() {
- var elements = Form.getElements(this.element);
- for (var i = 0; i < elements.length; i++)
- this.registerCallback(elements[i]);
- },
-
- registerCallback: function(element) {
- if (element.type) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- Event.observe(element, 'click', this.onElementEvent.bind(this));
- break;
- case 'password':
- case 'text':
- case 'textarea':
- case 'select-one':
- case 'select-multiple':
- Event.observe(element, 'change', this.onElementEvent.bind(this));
- break;
- }
- }
- }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-if (!window.Event) {
- var Event = new Object();
-}
-
-Object.extend(Event, {
- KEY_BACKSPACE: 8,
- KEY_TAB: 9,
- KEY_RETURN: 13,
- KEY_ESC: 27,
- KEY_LEFT: 37,
- KEY_UP: 38,
- KEY_RIGHT: 39,
- KEY_DOWN: 40,
- KEY_DELETE: 46,
-
- element: function(event) {
- return event.target || event.srcElement;
- },
-
- isLeftClick: function(event) {
- return (((event.which) && (event.which == 1)) ||
- ((event.button) && (event.button == 1)));
- },
-
- pointerX: function(event) {
- return event.pageX || (event.clientX +
- (document.documentElement.scrollLeft || document.body.scrollLeft));
- },
-
- pointerY: function(event) {
- return event.pageY || (event.clientY +
- (document.documentElement.scrollTop || document.body.scrollTop));
- },
-
- stop: function(event) {
- if (event.preventDefault) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.returnValue = false;
- event.cancelBubble = true;
- }
- },
-
- // find the first node with the given tagName, starting from the
- // node the event was triggered on; traverses the DOM upwards
- findElement: function(event, tagName) {
- var element = Event.element(event);
- while (element.parentNode && (!element.tagName ||
- (element.tagName.toUpperCase() != tagName.toUpperCase())))
- element = element.parentNode;
- return element;
- },
-
- observers: false,
-
- _observeAndCache: function(element, name, observer, useCapture) {
- if (!this.observers) this.observers = [];
- if (element.addEventListener) {
- this.observers.push([element, name, observer, useCapture]);
- element.addEventListener(name, observer, useCapture);
- } else if (element.attachEvent) {
- this.observers.push([element, name, observer, useCapture]);
- element.attachEvent('on' + name, observer);
- }
- },
-
- unloadCache: function() {
- if (!Event.observers) return;
- for (var i = 0; i < Event.observers.length; i++) {
- Event.stopObserving.apply(this, Event.observers[i]);
- Event.observers[i][0] = null;
- }
- Event.observers = false;
- },
-
- observe: function(element, name, observer, useCapture) {
- var element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.attachEvent))
- name = 'keydown';
-
- this._observeAndCache(element, name, observer, useCapture);
- },
-
- stopObserving: function(element, name, observer, useCapture) {
- var element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.detachEvent))
- name = 'keydown';
-
- if (element.removeEventListener) {
- element.removeEventListener(name, observer, useCapture);
- } else if (element.detachEvent) {
- element.detachEvent('on' + name, observer);
- }
- }
-});
-
-/* prevent memory leaks in IE */
-if (navigator.appVersion.match(/\bMSIE\b/))
- Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
- // set to true if needed, warning: firefox performance problems
- // NOT neeeded for page scrolling, only if draggable contained in
- // scrollable elements
- includeScrollOffsets: false,
-
- // must be called before calling withinIncludingScrolloffset, every time the
- // page is scrolled
- prepare: function() {
- this.deltaX = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- this.deltaY = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- },
-
- realOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return [valueL, valueT];
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return [valueL, valueT];
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- p = Element.getStyle(element, 'position');
- if (p == 'relative' || p == 'absolute') break;
- }
- } while (element);
- return [valueL, valueT];
- },
-
- offsetParent: function(element) {
- if (element.offsetParent) return element.offsetParent;
- if (element == document.body) return element;
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return element;
-
- return document.body;
- },
-
- // caches x/y coordinate pair to use with overlap
- within: function(element, x, y) {
- if (this.includeScrollOffsets)
- return this.withinIncludingScrolloffsets(element, x, y);
- this.xcomp = x;
- this.ycomp = y;
- this.offset = this.cumulativeOffset(element);
-
- return (y >= this.offset[1] &&
- y < this.offset[1] + element.offsetHeight &&
- x >= this.offset[0] &&
- x < this.offset[0] + element.offsetWidth);
- },
-
- withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = this.realOffset(element);
-
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = this.cumulativeOffset(element);
-
- return (this.ycomp >= this.offset[1] &&
- this.ycomp < this.offset[1] + element.offsetHeight &&
- this.xcomp >= this.offset[0] &&
- this.xcomp < this.offset[0] + element.offsetWidth);
- },
-
- // within must be called directly before
- overlap: function(mode, element) {
- if (!mode) return 0;
- if (mode == 'vertical')
- return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
- element.offsetHeight;
- if (mode == 'horizontal')
- return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
- element.offsetWidth;
- },
-
- clone: function(source, target) {
- source = $(source);
- target = $(target);
- target.style.position = 'absolute';
- var offsets = this.cumulativeOffset(source);
- target.style.top = offsets[1] + 'px';
- target.style.left = offsets[0] + 'px';
- target.style.width = source.offsetWidth + 'px';
- target.style.height = source.offsetHeight + 'px';
- },
-
- page: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent==document.body)
- if (Element.getStyle(element,'position')=='absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- } while (element = element.parentNode);
-
- return [valueL, valueT];
- },
-
- clone: function(source, target) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || {})
-
- // find page position of source
- source = $(source);
- var p = Position.page(source);
-
- // find coordinate system to use
- target = $(target);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(target,'position') == 'absolute') {
- parent = Position.offsetParent(target);
- delta = Position.page(parent);
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if(options.setWidth) target.style.width = source.offsetWidth + 'px';
- if(options.setHeight) target.style.height = source.offsetHeight + 'px';
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.style.position == 'absolute') return;
- Position.prepare();
-
- var offsets = Position.positionedOffset(element);
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';;
- element.style.left = left + 'px';;
- element.style.width = width + 'px';;
- element.style.height = height + 'px';;
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.style.position == 'relative') return;
- Position.prepare();
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned. For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- Position.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return [valueL, valueT];
- }
-} \ No newline at end of file
diff --git a/library/cropper/lib/scriptaculous.js b/library/cropper/lib/scriptaculous.js
deleted file mode 100644
index f61fc57f7..000000000
--- a/library/cropper/lib/scriptaculous.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// 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.
-
-var Scriptaculous = {
- Version: '1.6.1',
- require: function(libraryName) {
- // inserting via DOM fails in Safari 2.0, so brute force approach
- document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
- },
- load: function() {
- if((typeof Prototype=='undefined') ||
- (typeof Element == 'undefined') ||
- (typeof Element.Methods=='undefined') ||
- parseFloat(Prototype.Version.split(".")[0] + "." +
- Prototype.Version.split(".")[1]) < 1.5)
- throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
-
- $A(document.getElementsByTagName("script")).findAll( function(s) {
- return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
- }).each( function(s) {
- var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
- var includes = s.src.match(/\?.*load=([a-z,]*)/);
- (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
- function(include) { Scriptaculous.require(path+include+'.js') });
- });
- }
-}
-
-Scriptaculous.load(); \ No newline at end of file
diff --git a/library/cropper/lib/slider.js b/library/cropper/lib/slider.js
deleted file mode 100644
index c0f1fc01b..000000000
--- a/library/cropper/lib/slider.js
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright (c) 2005 Marty Haught, Thomas Fuchs
-//
-// See http://script.aculo.us for more info
-//
-// 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(!Control) var Control = {};
-Control.Slider = Class.create();
-
-// options:
-// axis: 'vertical', or 'horizontal' (default)
-//
-// callbacks:
-// onChange(value)
-// onSlide(value)
-Control.Slider.prototype = {
- initialize: function(handle, track, options) {
- var slider = this;
-
- if(handle instanceof Array) {
- this.handles = handle.collect( function(e) { return $(e) });
- } else {
- this.handles = [$(handle)];
- }
-
- this.track = $(track);
- this.options = options || {};
-
- this.axis = this.options.axis || 'horizontal';
- this.increment = this.options.increment || 1;
- this.step = parseInt(this.options.step || '1');
- this.range = this.options.range || $R(0,1);
-
- this.value = 0; // assure backwards compat
- this.values = this.handles.map( function() { return 0 });
- this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
- this.options.startSpan = $(this.options.startSpan || null);
- this.options.endSpan = $(this.options.endSpan || null);
-
- this.restricted = this.options.restricted || false;
-
- this.maximum = this.options.maximum || this.range.end;
- this.minimum = this.options.minimum || this.range.start;
-
- // Will be used to align the handle onto the track, if necessary
- this.alignX = parseInt(this.options.alignX || '0');
- this.alignY = parseInt(this.options.alignY || '0');
-
- this.trackLength = this.maximumOffset() - this.minimumOffset();
- this.handleLength = this.isVertical() ? this.handles[0].offsetHeight : this.handles[0].offsetWidth;
-
- this.active = false;
- this.dragging = false;
- this.disabled = false;
-
- if(this.options.disabled) this.setDisabled();
-
- // Allowed values array
- this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
- if(this.allowedValues) {
- this.minimum = this.allowedValues.min();
- this.maximum = this.allowedValues.max();
- }
-
- this.eventMouseDown = this.startDrag.bindAsEventListener(this);
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.update.bindAsEventListener(this);
-
- // Initialize handles in reverse (make sure first handle is active)
- this.handles.each( function(h,i) {
- i = slider.handles.length-1-i;
- slider.setValue(parseFloat(
- (slider.options.sliderValue instanceof Array ?
- slider.options.sliderValue[i] : slider.options.sliderValue) ||
- slider.range.start), i);
- Element.makePositioned(h); // fix IE
- Event.observe(h, "mousedown", slider.eventMouseDown);
- });
-
- Event.observe(this.track, "mousedown", this.eventMouseDown);
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
-
- this.initialized = true;
- },
- dispose: function() {
- var slider = this;
- Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- this.handles.each( function(h) {
- Event.stopObserving(h, "mousedown", slider.eventMouseDown);
- });
- },
- setDisabled: function(){
- this.disabled = true;
- },
- setEnabled: function(){
- this.disabled = false;
- },
- getNearestValue: function(value){
- if(this.allowedValues){
- if(value >= this.allowedValues.max()) return(this.allowedValues.max());
- if(value <= this.allowedValues.min()) return(this.allowedValues.min());
-
- var offset = Math.abs(this.allowedValues[0] - value);
- var newValue = this.allowedValues[0];
- this.allowedValues.each( function(v) {
- var currentOffset = Math.abs(v - value);
- if(currentOffset <= offset){
- newValue = v;
- offset = currentOffset;
- }
- });
- return newValue;
- }
- if(value > this.range.end) return this.range.end;
- if(value < this.range.start) return this.range.start;
- return value;
- },
- setValue: function(sliderValue, handleIdx){
- if(!this.active) {
- this.activeHandle = this.handles[handleIdx];
- this.activeHandleIdx = handleIdx;
- this.updateStyles();
- }
- handleIdx = handleIdx || this.activeHandleIdx || 0;
- if(this.initialized && this.restricted) {
- if((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
- sliderValue = this.values[handleIdx-1];
- if((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
- sliderValue = this.values[handleIdx+1];
- }
- sliderValue = this.getNearestValue(sliderValue);
- this.values[handleIdx] = sliderValue;
- this.value = this.values[0]; // assure backwards compat
-
- this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
- this.translateToPx(sliderValue);
-
- this.drawSpans();
- if(!this.dragging || !this.event) this.updateFinished();
- },
- setValueBy: function(delta, handleIdx) {
- this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
- handleIdx || this.activeHandleIdx || 0);
- },
- translateToPx: function(value) {
- return Math.round(
- ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
- (value - this.range.start)) + "px";
- },
- translateToValue: function(offset) {
- return ((offset/(this.trackLength-this.handleLength) *
- (this.range.end-this.range.start)) + this.range.start);
- },
- getRange: function(range) {
- var v = this.values.sortBy(Prototype.K);
- range = range || 0;
- return $R(v[range],v[range+1]);
- },
- minimumOffset: function(){
- return(this.isVertical() ? this.alignY : this.alignX);
- },
- maximumOffset: function(){
- return(this.isVertical() ?
- this.track.offsetHeight - this.alignY : this.track.offsetWidth - this.alignX);
- },
- isVertical: function(){
- return (this.axis == 'vertical');
- },
- drawSpans: function() {
- var slider = this;
- if(this.spans)
- $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
- if(this.options.startSpan)
- this.setSpan(this.options.startSpan,
- $R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
- if(this.options.endSpan)
- this.setSpan(this.options.endSpan,
- $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
- },
- setSpan: function(span, range) {
- if(this.isVertical()) {
- span.style.top = this.translateToPx(range.start);
- span.style.height = this.translateToPx(range.end - range.start + this.range.start);
- } else {
- span.style.left = this.translateToPx(range.start);
- span.style.width = this.translateToPx(range.end - range.start + this.range.start);
- }
- },
- updateStyles: function() {
- this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
- Element.addClassName(this.activeHandle, 'selected');
- },
- startDrag: function(event) {
- if(Event.isLeftClick(event)) {
- if(!this.disabled){
- this.active = true;
-
- var handle = Event.element(event);
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- if(handle==this.track) {
- var offsets = Position.cumulativeOffset(this.track);
- this.event = event;
- this.setValue(this.translateToValue(
- (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
- ));
- var offsets = Position.cumulativeOffset(this.activeHandle);
- this.offsetX = (pointer[0] - offsets[0]);
- this.offsetY = (pointer[1] - offsets[1]);
- } else {
- // find the handle (prevents issues with Safari)
- while((this.handles.indexOf(handle) == -1) && handle.parentNode)
- handle = handle.parentNode;
-
- this.activeHandle = handle;
- this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
- this.updateStyles();
-
- var offsets = Position.cumulativeOffset(this.activeHandle);
- this.offsetX = (pointer[0] - offsets[0]);
- this.offsetY = (pointer[1] - offsets[1]);
- }
- }
- Event.stop(event);
- }
- },
- update: function(event) {
- if(this.active) {
- if(!this.dragging) this.dragging = true;
- this.draw(event);
- // fix AppleWebKit rendering
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
- Event.stop(event);
- }
- },
- draw: function(event) {
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var offsets = Position.cumulativeOffset(this.track);
- pointer[0] -= this.offsetX + offsets[0];
- pointer[1] -= this.offsetY + offsets[1];
- this.event = event;
- this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
- if(this.initialized && this.options.onSlide)
- this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
- },
- endDrag: function(event) {
- if(this.active && this.dragging) {
- this.finishDrag(event, true);
- Event.stop(event);
- }
- this.active = false;
- this.dragging = false;
- },
- finishDrag: function(event, success) {
- this.active = false;
- this.dragging = false;
- this.updateFinished();
- },
- updateFinished: function() {
- if(this.initialized && this.options.onChange)
- this.options.onChange(this.values.length>1 ? this.values : this.value, this);
- this.event = null;
- }
-} \ No newline at end of file
diff --git a/library/cropper/lib/unittest.js b/library/cropper/lib/unittest.js
deleted file mode 100644
index d2c2d8171..000000000
--- a/library/cropper/lib/unittest.js
+++ /dev/null
@@ -1,383 +0,0 @@
-// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005 Jon Tirsen (http://www.tirsen.com)
-// (c) 2005 Michael Schuerig (http://www.schuerig.de/michael/)
-//
-// 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.
-
-
-// experimental, Firefox-only
-Event.simulateMouse = function(element, eventName) {
- var options = Object.extend({
- pointerX: 0,
- pointerY: 0,
- buttons: 0
- }, arguments[2] || {});
- var oEvent = document.createEvent("MouseEvents");
- oEvent.initMouseEvent(eventName, true, true, document.defaultView,
- options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
- false, false, false, false, 0, $(element));
-
- if(this.mark) Element.remove(this.mark);
- this.mark = document.createElement('div');
- this.mark.appendChild(document.createTextNode(" "));
- document.body.appendChild(this.mark);
- this.mark.style.position = 'absolute';
- this.mark.style.top = options.pointerY + "px";
- this.mark.style.left = options.pointerX + "px";
- this.mark.style.width = "5px";
- this.mark.style.height = "5px;";
- this.mark.style.borderTop = "1px solid red;"
- this.mark.style.borderLeft = "1px solid red;"
-
- if(this.step)
- alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
-
- $(element).dispatchEvent(oEvent);
-};
-
-// Note: Due to a fix in Firefox 1.0.5/6 that probably fixed "too much", this doesn't work in 1.0.6 or DP2.
-// You need to downgrade to 1.0.4 for now to get this working
-// See https://bugzilla.mozilla.org/show_bug.cgi?id=289940 for the fix that fixed too much
-Event.simulateKey = function(element, eventName) {
- var options = Object.extend({
- ctrlKey: false,
- altKey: false,
- shiftKey: false,
- metaKey: false,
- keyCode: 0,
- charCode: 0
- }, arguments[2] || {});
-
- var oEvent = document.createEvent("KeyEvents");
- oEvent.initKeyEvent(eventName, true, true, window,
- options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
- options.keyCode, options.charCode );
- $(element).dispatchEvent(oEvent);
-};
-
-Event.simulateKeys = function(element, command) {
- for(var i=0; i<command.length; i++) {
- Event.simulateKey(element,'keypress',{charCode:command.charCodeAt(i)});
- }
-};
-
-var Test = {}
-Test.Unit = {};
-
-// security exception workaround
-Test.Unit.inspect = Object.inspect;
-
-Test.Unit.Logger = Class.create();
-Test.Unit.Logger.prototype = {
- initialize: function(log) {
- this.log = $(log);
- if (this.log) {
- this._createLogTable();
- }
- },
- start: function(testName) {
- if (!this.log) return;
- this.testName = testName;
- this.lastLogLine = document.createElement('tr');
- this.statusCell = document.createElement('td');
- this.nameCell = document.createElement('td');
- this.nameCell.appendChild(document.createTextNode(testName));
- this.messageCell = document.createElement('td');
- this.lastLogLine.appendChild(this.statusCell);
- this.lastLogLine.appendChild(this.nameCell);
- this.lastLogLine.appendChild(this.messageCell);
- this.loglines.appendChild(this.lastLogLine);
- },
- finish: function(status, summary) {
- if (!this.log) return;
- this.lastLogLine.className = status;
- this.statusCell.innerHTML = status;
- this.messageCell.innerHTML = this._toHTML(summary);
- },
- message: function(message) {
- if (!this.log) return;
- this.messageCell.innerHTML = this._toHTML(message);
- },
- summary: function(summary) {
- if (!this.log) return;
- this.logsummary.innerHTML = this._toHTML(summary);
- },
- _createLogTable: function() {
- this.log.innerHTML =
- '<div id="logsummary"></div>' +
- '<table id="logtable">' +
- '<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' +
- '<tbody id="loglines"></tbody>' +
- '</table>';
- this.logsummary = $('logsummary')
- this.loglines = $('loglines');
- },
- _toHTML: function(txt) {
- return txt.escapeHTML().replace(/\n/g,"<br/>");
- }
-}
-
-Test.Unit.Runner = Class.create();
-Test.Unit.Runner.prototype = {
- initialize: function(testcases) {
- this.options = Object.extend({
- testLog: 'testlog'
- }, arguments[1] || {});
- this.options.resultsURL = this.parseResultsURLQueryParameter();
- if (this.options.testLog) {
- this.options.testLog = $(this.options.testLog) || null;
- }
- if(this.options.tests) {
- this.tests = [];
- for(var i = 0; i < this.options.tests.length; i++) {
- if(/^test/.test(this.options.tests[i])) {
- this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"]));
- }
- }
- } else {
- if (this.options.test) {
- this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])];
- } else {
- this.tests = [];
- for(var testcase in testcases) {
- if(/^test/.test(testcase)) {
- this.tests.push(new Test.Unit.Testcase(testcase, testcases[testcase], testcases["setup"], testcases["teardown"]));
- }
- }
- }
- }
- this.currentTest = 0;
- this.logger = new Test.Unit.Logger(this.options.testLog);
- setTimeout(this.runTests.bind(this), 1000);
- },
- parseResultsURLQueryParameter: function() {
- return window.location.search.parseQuery()["resultsURL"];
- },
- // Returns:
- // "ERROR" if there was an error,
- // "FAILURE" if there was a failure, or
- // "SUCCESS" if there was neither
- getResult: function() {
- var hasFailure = false;
- for(var i=0;i<this.tests.length;i++) {
- if (this.tests[i].errors > 0) {
- return "ERROR";
- }
- if (this.tests[i].failures > 0) {
- hasFailure = true;
- }
- }
- if (hasFailure) {
- return "FAILURE";
- } else {
- return "SUCCESS";
- }
- },
- postResults: function() {
- if (this.options.resultsURL) {
- new Ajax.Request(this.options.resultsURL,
- { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false });
- }
- },
- runTests: function() {
- var test = this.tests[this.currentTest];
- if (!test) {
- // finished!
- this.postResults();
- this.logger.summary(this.summary());
- return;
- }
- if(!test.isWaiting) {
- this.logger.start(test.name);
- }
- test.run();
- if(test.isWaiting) {
- this.logger.message("Waiting for " + test.timeToWait + "ms");
- setTimeout(this.runTests.bind(this), test.timeToWait || 1000);
- } else {
- this.logger.finish(test.status(), test.summary());
- this.currentTest++;
- // tail recursive, hopefully the browser will skip the stackframe
- this.runTests();
- }
- },
- summary: function() {
- var assertions = 0;
- var failures = 0;
- var errors = 0;
- var messages = [];
- for(var i=0;i<this.tests.length;i++) {
- assertions += this.tests[i].assertions;
- failures += this.tests[i].failures;
- errors += this.tests[i].errors;
- }
- return (
- this.tests.length + " tests, " +
- assertions + " assertions, " +
- failures + " failures, " +
- errors + " errors");
- }
-}
-
-Test.Unit.Assertions = Class.create();
-Test.Unit.Assertions.prototype = {
- initialize: function() {
- this.assertions = 0;
- this.failures = 0;
- this.errors = 0;
- this.messages = [];
- },
- summary: function() {
- return (
- this.assertions + " assertions, " +
- this.failures + " failures, " +
- this.errors + " errors" + "\n" +
- this.messages.join("\n"));
- },
- pass: function() {
- this.assertions++;
- },
- fail: function(message) {
- this.failures++;
- this.messages.push("Failure: " + message);
- },
- info: function(message) {
- this.messages.push("Info: " + message);
- },
- error: function(error) {
- this.errors++;
- this.messages.push(error.name + ": "+ error.message + "(" + Test.Unit.inspect(error) +")");
- },
- status: function() {
- if (this.failures > 0) return 'failed';
- if (this.errors > 0) return 'error';
- return 'passed';
- },
- assert: function(expression) {
- var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"';
- try { expression ? this.pass() :
- this.fail(message); }
- catch(e) { this.error(e); }
- },
- assertEqual: function(expected, actual) {
- var message = arguments[2] || "assertEqual";
- try { (expected == actual) ? this.pass() :
- this.fail(message + ': expected "' + Test.Unit.inspect(expected) +
- '", actual "' + Test.Unit.inspect(actual) + '"'); }
- catch(e) { this.error(e); }
- },
- assertEnumEqual: function(expected, actual) {
- var message = arguments[2] || "assertEnumEqual";
- try { $A(expected).length == $A(actual).length &&
- expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ?
- this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) +
- ', actual ' + Test.Unit.inspect(actual)); }
- catch(e) { this.error(e); }
- },
- assertNotEqual: function(expected, actual) {
- var message = arguments[2] || "assertNotEqual";
- try { (expected != actual) ? this.pass() :
- this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); }
- catch(e) { this.error(e); }
- },
- assertNull: function(obj) {
- var message = arguments[1] || 'assertNull'
- try { (obj==null) ? this.pass() :
- this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); }
- catch(e) { this.error(e); }
- },
- assertHidden: function(element) {
- var message = arguments[1] || 'assertHidden';
- this.assertEqual("none", element.style.display, message);
- },
- assertNotNull: function(object) {
- var message = arguments[1] || 'assertNotNull';
- this.assert(object != null, message);
- },
- assertInstanceOf: function(expected, actual) {
- var message = arguments[2] || 'assertInstanceOf';
- try {
- (actual instanceof expected) ? this.pass() :
- this.fail(message + ": object was not an instance of the expected type"); }
- catch(e) { this.error(e); }
- },
- assertNotInstanceOf: function(expected, actual) {
- var message = arguments[2] || 'assertNotInstanceOf';
- try {
- !(actual instanceof expected) ? this.pass() :
- this.fail(message + ": object was an instance of the not expected type"); }
- catch(e) { this.error(e); }
- },
- _isVisible: function(element) {
- element = $(element);
- if(!element.parentNode) return true;
- this.assertNotNull(element);
- if(element.style && Element.getStyle(element, 'display') == 'none')
- return false;
-
- return this._isVisible(element.parentNode);
- },
- assertNotVisible: function(element) {
- this.assert(!this._isVisible(element), Test.Unit.inspect(element) + " was not hidden and didn't have a hidden parent either. " + ("" || arguments[1]));
- },
- assertVisible: function(element) {
- this.assert(this._isVisible(element), Test.Unit.inspect(element) + " was not visible. " + ("" || arguments[1]));
- },
- benchmark: function(operation, iterations) {
- var startAt = new Date();
- (iterations || 1).times(operation);
- var timeTaken = ((new Date())-startAt);
- this.info((arguments[2] || 'Operation') + ' finished ' +
- iterations + ' iterations in ' + (timeTaken/1000)+'s' );
- return timeTaken;
- }
-}
-
-Test.Unit.Testcase = Class.create();
-Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), {
- initialize: function(name, test, setup, teardown) {
- Test.Unit.Assertions.prototype.initialize.bind(this)();
- this.name = name;
- this.test = test || function() {};
- this.setup = setup || function() {};
- this.teardown = teardown || function() {};
- this.isWaiting = false;
- this.timeToWait = 1000;
- },
- wait: function(time, nextPart) {
- this.isWaiting = true;
- this.test = nextPart;
- this.timeToWait = time;
- },
- run: function() {
- try {
- try {
- if (!this.isWaiting) this.setup.bind(this)();
- this.isWaiting = false;
- this.test.bind(this)();
- } finally {
- if(!this.isWaiting) {
- this.teardown.bind(this)();
- }
- }
- }
- catch(e) { this.error(e); }
- }
-});
diff --git a/library/cropper/licence.txt b/library/cropper/licence.txt
deleted file mode 100644
index b59e02917..000000000
--- a/library/cropper/licence.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Copyright (c) 2006, David Spurr (www.defusion.org.uk)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the David Spurr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-http://www.opensource.org/licenses/bsd-license.php \ No newline at end of file
diff --git a/library/cropper/marqueeHoriz.gif b/library/cropper/marqueeHoriz.gif
deleted file mode 100644
index 25317e573..000000000
--- a/library/cropper/marqueeHoriz.gif
+++ /dev/null
Binary files differ
diff --git a/library/cropper/marqueeVert.gif b/library/cropper/marqueeVert.gif
deleted file mode 100644
index 354070bb4..000000000
--- a/library/cropper/marqueeVert.gif
+++ /dev/null
Binary files differ
diff --git a/library/cropper/tests/castle.jpg b/library/cropper/tests/castle.jpg
deleted file mode 100644
index e40b7e4cb..000000000
--- a/library/cropper/tests/castle.jpg
+++ /dev/null
Binary files differ
diff --git a/library/cropper/tests/castleMed.jpg b/library/cropper/tests/castleMed.jpg
deleted file mode 100644
index c35a6f554..000000000
--- a/library/cropper/tests/castleMed.jpg
+++ /dev/null
Binary files differ
diff --git a/library/cropper/tests/example-Basic.htm b/library/cropper/tests/example-Basic.htm
deleted file mode 100644
index 391c2ecdb..000000000
--- a/library/cropper/tests/example-Basic.htm
+++ /dev/null
@@ -1,106 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>Basic cropper test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- // setup the callback function
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // basic example
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img(
- 'testImage',
- {
- onEndCrop: onEndCrop
- }
- )
- }
- );
-
-
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
-
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- html, body {
- margin: 0;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
- </style>
-</head>
-<body>
- <h2>Basic cropper test</h2>
- <p>
- Some test content before the image
- </p>
-
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-CSS-Absolute.htm b/library/cropper/tests/example-CSS-Absolute.htm
deleted file mode 100644
index 17e4c489d..000000000
--- a/library/cropper/tests/example-CSS-Absolute.htm
+++ /dev/null
@@ -1,162 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>CSS - Absolute positioned (and draggable) test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop,effects" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- // setup the callback function
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // Absolute positioned example
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img( 'testAbsImage', { onEndCrop: onEndCrop } );
- new Draggable( 'test-abs' );
- }
- );
-
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
-
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- html, body {
- margin: 0;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
-
- #test-abs {
- width: 510px;
- position: absolute;
- top: 50px;
- left: 25%;
- background-color: #dee;
- border: 3px solid #ccc;
- z-index: 10;
- }
- </style>
-</head>
-<body>
- <h2>CSS - Absolute positioned (and draggable) test</h2>
- <p>
- Some test content before the image
- </p>
- <p>
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque consequat risus cursus ipsum. Etiam libero. Integer vel mauris. Donec vulputate. In ut augue vitae nibh lobortis tempor. Aliquam hendrerit quam. Phasellus sed orci. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut sed urna. Donec nunc urna, porttitor a, feugiat pellentesque, varius id, justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Sed sollicitudin. Integer enim. Aenean sollicitudin.
- </p>
- <p>
- Integer lorem turpis, dapibus sed, vulputate nec, volutpat a, sem. Sed malesuada laoreet lorem. Duis mauris ipsum, fringilla nec, tristique vel, imperdiet vel, neque. Nulla vel purus. Fusce non lectus. Mauris pulvinar. Curabitur eget eros. Nunc ultrices, risus vitae adipiscing scelerisque, quam mi auctor lacus, non pellentesque augue sapien a magna. Etiam rutrum posuere tortor. Mauris rhoncus sagittis dolor. Donec sed quam. Vivamus vel diam id massa adipiscing bibendum. Suspendisse potenti. Integer arcu est, adipiscing sit amet, convallis eu, sollicitudin tincidunt, quam.
- </p>
- <p>
- Etiam ligula lorem, imperdiet ac, luctus eget, ultrices at, odio. Vivamus malesuada, justo eu adipiscing semper, nisi dui tempus magna, quis ultrices nunc tellus id massa. Nullam lobortis auctor sapien. Quisque non nulla. Donec lobortis pellentesque nisl. Sed lacus sapien, viverra vitae, blandit ut, fermentum quis, leo. Morbi augue turpis, hendrerit non, feugiat vel, laoreet sed, est. Nunc velit. Praesent lobortis. Integer enim. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur faucibus lacus ac ante. Donec odio odio, tincidunt a, egestas nec, scelerisque nec, dui. Cras sollicitudin. Donec lacus enim, mollis sit amet, interdum quis, euismod et, nulla. Nunc sit amet dui eu magna dapibus mollis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla facilisi.
- </p>
- <p>
- In hac habitasse platea dictumst. Nunc neque urna, dapibus ut, tristique ut, bibendum ac, felis. Donec dictum est ut dolor. Etiam accumsan, velit sit amet blandit vestibulum, turpis quam hendrerit risus, vel interdum eros orci in nunc. Curabitur tellus sapien, rutrum ac, euismod ac, malesuada nec, pede. Proin sit amet ipsum. Praesent quam nisl, adipiscing nec, tristique eget, fermentum sed, est. Praesent ac est sit amet orci facilisis placerat. Sed consequat, est sit amet consectetuer viverra, risus urna porttitor tellus, ut convallis nibh libero in lectus. Pellentesque molestie, erat non vehicula pretium, turpis nisi eleifend eros, sed scelerisque tortor odio non tellus. Nunc leo tellus, faucibus vitae, placerat a, accumsan vel, arcu. In et orci. Ut tristique euismod nibh. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Sed nulla nunc, placerat vitae, pellentesque non, interdum non, sapien. Quisque faucibus, eros sed venenatis sagittis, leo risus rhoncus risus, in pretium sem purus a lacus. Aliquam aliquam leo et diam.
-
- </p>
- <p>
- Nulla sagittis diam. Phasellus vitae enim tristique libero molestie tristique. Nam mauris sem, elementum nec, cursus in, fringilla ac, neque. Nunc metus nisi, dictum vel, vulputate quis, porttitor bibendum, tortor. Vestibulum vehicula. Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla ac magna sed purus ultricies euismod. Aliquam dictum. Sed mauris. Suspendisse justo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi purus lorem, auctor non, porta ac, vehicula vel, orci. Morbi pharetra massa nec leo. Maecenas et mauris. Aliquam porttitor tincidunt nulla. Vestibulum pede.
- </p>
- <p>
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque consequat risus cursus ipsum. Etiam libero. Integer vel mauris. Donec vulputate. In ut augue vitae nibh lobortis tempor. Aliquam hendrerit quam. Phasellus sed orci. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut sed urna. Donec nunc urna, porttitor a, feugiat pellentesque, varius id, justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Sed sollicitudin. Integer enim. Aenean sollicitudin.
- </p>
- <p>
- Integer lorem turpis, dapibus sed, vulputate nec, volutpat a, sem. Sed malesuada laoreet lorem. Duis mauris ipsum, fringilla nec, tristique vel, imperdiet vel, neque. Nulla vel purus. Fusce non lectus. Mauris pulvinar. Curabitur eget eros. Nunc ultrices, risus vitae adipiscing scelerisque, quam mi auctor lacus, non pellentesque augue sapien a magna. Etiam rutrum posuere tortor. Mauris rhoncus sagittis dolor. Donec sed quam. Vivamus vel diam id massa adipiscing bibendum. Suspendisse potenti. Integer arcu est, adipiscing sit amet, convallis eu, sollicitudin tincidunt, quam.
- </p>
- <p>
- Etiam ligula lorem, imperdiet ac, luctus eget, ultrices at, odio. Vivamus malesuada, justo eu adipiscing semper, nisi dui tempus magna, quis ultrices nunc tellus id massa. Nullam lobortis auctor sapien. Quisque non nulla. Donec lobortis pellentesque nisl. Sed lacus sapien, viverra vitae, blandit ut, fermentum quis, leo. Morbi augue turpis, hendrerit non, feugiat vel, laoreet sed, est. Nunc velit. Praesent lobortis. Integer enim. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur faucibus lacus ac ante. Donec odio odio, tincidunt a, egestas nec, scelerisque nec, dui. Cras sollicitudin. Donec lacus enim, mollis sit amet, interdum quis, euismod et, nulla. Nunc sit amet dui eu magna dapibus mollis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla facilisi.
- </p>
- <p>
- In hac habitasse platea dictumst. Nunc neque urna, dapibus ut, tristique ut, bibendum ac, felis. Donec dictum est ut dolor. Etiam accumsan, velit sit amet blandit vestibulum, turpis quam hendrerit risus, vel interdum eros orci in nunc. Curabitur tellus sapien, rutrum ac, euismod ac, malesuada nec, pede. Proin sit amet ipsum. Praesent quam nisl, adipiscing nec, tristique eget, fermentum sed, est. Praesent ac est sit amet orci facilisis placerat. Sed consequat, est sit amet consectetuer viverra, risus urna porttitor tellus, ut convallis nibh libero in lectus. Pellentesque molestie, erat non vehicula pretium, turpis nisi eleifend eros, sed scelerisque tortor odio non tellus. Nunc leo tellus, faucibus vitae, placerat a, accumsan vel, arcu. In et orci. Ut tristique euismod nibh. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Sed nulla nunc, placerat vitae, pellentesque non, interdum non, sapien. Quisque faucibus, eros sed venenatis sagittis, leo risus rhoncus risus, in pretium sem purus a lacus. Aliquam aliquam leo et diam.
-
- </p>
- <p>
- Nulla sagittis diam. Phasellus vitae enim tristique libero molestie tristique. Nam mauris sem, elementum nec, cursus in, fringilla ac, neque. Nunc metus nisi, dictum vel, vulputate quis, porttitor bibendum, tortor. Vestibulum vehicula. Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla ac magna sed purus ultricies euismod. Aliquam dictum. Sed mauris. Suspendisse justo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi purus lorem, auctor non, porta ac, vehicula vel, orci. Morbi pharetra massa nec leo. Maecenas et mauris. Aliquam porttitor tincidunt nulla. Vestibulum pede.
- </p>
- <p>
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque consequat risus cursus ipsum. Etiam libero. Integer vel mauris. Donec vulputate. In ut augue vitae nibh lobortis tempor. Aliquam hendrerit quam. Phasellus sed orci. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut sed urna. Donec nunc urna, porttitor a, feugiat pellentesque, varius id, justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Sed sollicitudin. Integer enim. Aenean sollicitudin.
- </p>
- <p>
- Integer lorem turpis, dapibus sed, vulputate nec, volutpat a, sem. Sed malesuada laoreet lorem. Duis mauris ipsum, fringilla nec, tristique vel, imperdiet vel, neque. Nulla vel purus. Fusce non lectus. Mauris pulvinar. Curabitur eget eros. Nunc ultrices, risus vitae adipiscing scelerisque, quam mi auctor lacus, non pellentesque augue sapien a magna. Etiam rutrum posuere tortor. Mauris rhoncus sagittis dolor. Donec sed quam. Vivamus vel diam id massa adipiscing bibendum. Suspendisse potenti. Integer arcu est, adipiscing sit amet, convallis eu, sollicitudin tincidunt, quam.
- </p>
- <p>
- Etiam ligula lorem, imperdiet ac, luctus eget, ultrices at, odio. Vivamus malesuada, justo eu adipiscing semper, nisi dui tempus magna, quis ultrices nunc tellus id massa. Nullam lobortis auctor sapien. Quisque non nulla. Donec lobortis pellentesque nisl. Sed lacus sapien, viverra vitae, blandit ut, fermentum quis, leo. Morbi augue turpis, hendrerit non, feugiat vel, laoreet sed, est. Nunc velit. Praesent lobortis. Integer enim. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur faucibus lacus ac ante. Donec odio odio, tincidunt a, egestas nec, scelerisque nec, dui. Cras sollicitudin. Donec lacus enim, mollis sit amet, interdum quis, euismod et, nulla. Nunc sit amet dui eu magna dapibus mollis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla facilisi.
- </p>
- <p>
- In hac habitasse platea dictumst. Nunc neque urna, dapibus ut, tristique ut, bibendum ac, felis. Donec dictum est ut dolor. Etiam accumsan, velit sit amet blandit vestibulum, turpis quam hendrerit risus, vel interdum eros orci in nunc. Curabitur tellus sapien, rutrum ac, euismod ac, malesuada nec, pede. Proin sit amet ipsum. Praesent quam nisl, adipiscing nec, tristique eget, fermentum sed, est. Praesent ac est sit amet orci facilisis placerat. Sed consequat, est sit amet consectetuer viverra, risus urna porttitor tellus, ut convallis nibh libero in lectus. Pellentesque molestie, erat non vehicula pretium, turpis nisi eleifend eros, sed scelerisque tortor odio non tellus. Nunc leo tellus, faucibus vitae, placerat a, accumsan vel, arcu. In et orci. Ut tristique euismod nibh. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Sed nulla nunc, placerat vitae, pellentesque non, interdum non, sapien. Quisque faucibus, eros sed venenatis sagittis, leo risus rhoncus risus, in pretium sem purus a lacus. Aliquam aliquam leo et diam.
-
- </p>
- <p>
- Nulla sagittis diam. Phasellus vitae enim tristique libero molestie tristique. Nam mauris sem, elementum nec, cursus in, fringilla ac, neque. Nunc metus nisi, dictum vel, vulputate quis, porttitor bibendum, tortor. Vestibulum vehicula. Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla ac magna sed purus ultricies euismod. Aliquam dictum. Sed mauris. Suspendisse justo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi purus lorem, auctor non, porta ac, vehicula vel, orci. Morbi pharetra massa nec leo. Maecenas et mauris. Aliquam porttitor tincidunt nulla. Vestibulum pede.
- </p>
-
-
-<div id="test-abs">
- <h2>Absolute test</h2>
- <div id="testAbsWrap">
- <img src="castle.jpg" alt="test image" id="testAbsImage" width="500" height="333" />
- </div>
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-</div>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-CSS-Float.htm b/library/cropper/tests/example-CSS-Float.htm
deleted file mode 100644
index 5066553fe..000000000
--- a/library/cropper/tests/example-CSS-Float.htm
+++ /dev/null
@@ -1,124 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>CSS - Float test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- // setup the callback function
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // float example
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img(
- 'testFloatImage',
- {
- onEndCrop: function( coords, dimensions ) {
- $( 'floatX1' ).value = coords.x1;
- $( 'floatY1' ).value = coords.y1;
- $( 'floatX2' ).value = coords.x2;
- $( 'floatY2' ).value = coords.y2;
- $( 'floatWidth' ).value = dimensions.width;
- $( 'floatHeight' ).value = dimensions.height;
- }
- }
- );
- }
- );
-
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
-
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- html, body {
- margin: 0;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
-
- #test-float {
- width: 600px;
- float: right;
- background-color: #eee;
- border: 3px solid #000;
- margin: 10px;
- padding: 5px;
- }
-
- </style>
-</head>
-<body>
- <h2>Test page with floating wrapper</h2>
- <p>
- Some test content before the image
- </p>
-
-<div id="test-float">
- <h2>Float test</h2>
- <div id="testFloatWrap">
- <img src="castle.jpg" alt="test image" id="testFloatImage" width="500" height="333" />
- </div>
-
- <p>
- <label for="floatX1">x1:</label>
- <input type="text" name="floatX1" id="floatX1" />
- </p>
- <p>
- <label for="floatY1">y1:</label>
- <input type="text" name="floatY1" id="floatY1" />
- </p>
- <p>
- <label for="floatX2">x2:</label>
- <input type="text" name="floatX2" id="floatX2" />
- </p>
- <p>
- <label for="floatY2">y2:</label>
- <input type="text" name="floatY2" id="floatY2" />
- </p>
- <p>
- <label for="floatWidth">width:</label>
- <input type="text" name="floatWidth" id="floatWidth" />
- </p>
- <p>
- <label for="floatHeight">height</label>
- <input type="text" name="floatHeight" id="floatHeight" />
- </p>
-</div>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-CSS-Relative.htm b/library/cropper/tests/example-CSS-Relative.htm
deleted file mode 100644
index 5894fe1f9..000000000
--- a/library/cropper/tests/example-CSS-Relative.htm
+++ /dev/null
@@ -1,116 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>CSS - Relative test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- // setup the callback function
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // relative example
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img(
- 'testImage',
- {
- onEndCrop: onEndCrop
- }
- )
- }
- );
-
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
-
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- html, body {
- margin: 0;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
-
- #test-relative {
- background-color: #ccc;
- border: 3px solid #ddd;
- position: relative;
- top: 25px;
- left: 25px;
- }
- </style>
-</head>
-<body>
- <h2>Test page with relatively positioned wrapper</h2>
- <p>
- Some test content before the image
- </p>
-
-<div id="test-relative">
- <h2>Relative test</h2>
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-</div>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-CoordsOnLoad.htm b/library/cropper/tests/example-CoordsOnLoad.htm
deleted file mode 100644
index 254a23472..000000000
--- a/library/cropper/tests/example-CoordsOnLoad.htm
+++ /dev/null
@@ -1,108 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>Loading &amp; displaying co-ordinates of crop area on attachment test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- // setup the callback function
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // basic example
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img(
- 'testImage',
- {
- onEndCrop: onEndCrop,
- displayOnInit: true,
- onloadCoords: { x1: 10, y1: 10, x2: 250, y2: 100 }
- }
- )
- }
- );
-
-
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
-
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- html, body {
- margin: 0;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
- </style>
-</head>
-<body>
- <h2>Loading &amp; displaying co-ordinates of crop area on attachment test</h2>
- <p>
- Some test content before the image
- </p>
-
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-CoordsOnLoadWithRatio.htm b/library/cropper/tests/example-CoordsOnLoadWithRatio.htm
deleted file mode 100644
index 3a696360a..000000000
--- a/library/cropper/tests/example-CoordsOnLoadWithRatio.htm
+++ /dev/null
@@ -1,109 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>Loading &amp; displaying co-ordinates (with ratio) of crop area on attachment test<</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- // setup the callback function
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // basic example
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img(
- 'testImage',
- {
- onEndCrop: onEndCrop,
- displayOnInit: true,
- onloadCoords: { x1: 10, y1: 10, x2: 210, y2: 110 },
- ratioDim: { x: 200, y: 100 }
- }
- )
- }
- );
-
-
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
-
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- html, body {
- margin: 0;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
- </style>
-</head>
-<body>
- <h2>Loading &amp; displaying co-ordinates (with ratio) of crop area on attachment test</h2>
- <p>
- Some test content before the image
- </p>
-
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-Dimensions.htm b/library/cropper/tests/example-Dimensions.htm
deleted file mode 100644
index f54f99683..000000000
--- a/library/cropper/tests/example-Dimensions.htm
+++ /dev/null
@@ -1,225 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>Different dimensions test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- /*
-
- // example with minimum dimensions
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img(
- 'testImage',
- {
- minWidth: 200,
- minHeight: 120,
- maxWidth: 200,
- //maxHeight: 120,
- displayOnInit: true,
- onEndCrop: onEndCrop
- }
- )
- }
- );
- */
-
- Event.observe( window, 'load',
- function() {
- Event.observe( 'dimensionsForm', 'submit', CropManager.attachCropper.bindAsEventListener( CropManager ) );
- CropManager.attachCropper();
- }
- );
-
- /**
- * A little manager that allows us to reset the options dynamically
- */
- var CropManager = {
- /**
- * Holds the current Cropper.Img object
- * @var obj
- */
- curCrop: null,
-
- /**
- * Gets a min/max parameter from the form
- *
- * @access private
- * @param string Form element ID
- * @return int
- */
- getParam: function( name ) {
- var val = $F( name );
- console.log( name + ' :: ' + val );
- return parseInt( val );
- },
-
- /**
- * Attaches/resets the image cropper
- *
- * @access private
- * @param obj Event object
- * @return void
- */
- attachCropper: function( e ) {
- if( this.curCrop == null ) {
- this.curCrop = new Cropper.Img(
- 'testImage',
- {
- minWidth: this.getParam( 'minWidth' ),
- minHeight: this.getParam( 'minHeight' ),
- maxWidth: this.getParam( 'maxWidth' ),
- maxHeight: this.getParam( 'maxHeight' ),
- onEndCrop: onEndCrop
- }
- );
- } else {
- this.removeCropper();
- this.curCrop.initialize(
- 'testImage',
- {
- minWidth: this.getParam( 'minWidth' ),
- minHeight: this.getParam( 'minHeight' ),
- maxWidth: this.getParam( 'maxWidth' ),
- maxHeight: this.getParam( 'maxHeight' ),
- onEndCrop: onEndCrop
- }
- );
- }
- if( e != null ) Event.stop( e );
- },
-
- /**
- * Removes the cropper
- *
- * @access public
- * @return void
- */
- removeCropper: function() {
- if( this.curCrop != null ) {
- this.curCrop.remove();
- }
- },
-
- /**
- * Resets the cropper, either re-setting or re-applying
- *
- * @access public
- * @return void
- */
- resetCropper: function() {
- this.attachCropper();
- }
- };
-
- /*
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- // Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
- */
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
-
- #dimensionsForm {
- float: right;
- width: 350px;
- }
- </style>
-</head>
-<body>
- <h2>Multiple dimensions tests</h2>
- <p>
- Test of applying different dimension restrictions to the cropper
- </p>
-
- <form action="#" id="dimensionsForm">
- <fieldset>
- Set the cropper with the following dimension restrictions:
- <p>
- <label for="minWidth">Min Width</label>
- <input type="text" size="10" maxlength="3" value="200" id="minWidth" name="minWidth" />
- </p>
- <p>
- <label for="maxWidth">Max Width</label>
- <input type="text" size="10" maxlength="3" value="200" id="maxWidth" name="maxWidth" />
- </p>
- <p>
- <label for="minHeight">Min Height</label>
- <input type="text" size="10" maxlength="3" value="120" id="minHeight" name="minHeight" />
- </p>
- <p>
- <label for="maxHeight">Max Height</label>
- <input type="text" size="10" maxlength="3" value="120" id="maxHeight" name="maxHeight" />
- </p>
- <input type="submit" value="Set Cropper" />
- </fieldset>
- </form>
-
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-DynamicImage.htm b/library/cropper/tests/example-DynamicImage.htm
deleted file mode 100644
index 898363489..000000000
--- a/library/cropper/tests/example-DynamicImage.htm
+++ /dev/null
@@ -1,203 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>Dynamic image test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- /**
- * A little manager that allows us to swap the image dynamically
- *
- */
- var CropImageManager = {
- /**
- * Holds the current Cropper.Img object
- * @var obj
- */
- curCrop: null,
-
- /**
- * Initialises the cropImageManager
- *
- * @access public
- * @return void
- */
- init: function() {
- this.attachCropper();
- },
-
- /**
- * Handles the changing of the select to change the image, the option value
- * is a pipe seperated list of imgSrc|width|height
- *
- * @access public
- * @param obj event
- * @return void
- */
- onChange: function( e ) {
- var vals = $F( Event.element( e ) ).split('|');
- this.setImage( vals[0], vals[1], vals[2] );
- },
-
- /**
- * Sets the image within the element & attaches/resets the image cropper
- *
- * @access private
- * @param string Source path of new image
- * @param int Width of new image in pixels
- * @param int Height of new image in pixels
- * @return void
- */
- setImage: function( imgSrc, w, h ) {
- $( 'testImage' ).src = imgSrc;
- $( 'testImage' ).width = w;
- $( 'testImage' ).height = h;
- this.attachCropper();
- },
-
- /**
- * Attaches/resets the image cropper
- *
- * @access private
- * @return void
- */
- attachCropper: function() {
- if( this.curCrop == null ) this.curCrop = new Cropper.Img( 'testImage', { onEndCrop: onEndCrop } );
- else this.curCrop.reset();
- },
-
- /**
- * Removes the cropper
- *
- * @access public
- * @return void
- */
- removeCropper: function() {
- if( this.curCrop != null ) {
- this.curCrop.remove();
- }
- },
-
- /**
- * Resets the cropper, either re-setting or re-applying
- *
- * @access public
- * @return void
- */
- resetCropper: function() {
- this.attachCropper();
- }
- };
-
-
- // setup the callback function
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // basic example
- Event.observe(
- window,
- 'load',
- function() {
- CropImageManager.init();
- Event.observe( $('removeCropper'), 'click', CropImageManager.removeCropper.bindAsEventListener( CropImageManager ), false );
- Event.observe( $('resetCropper'), 'click', CropImageManager.resetCropper.bindAsEventListener( CropImageManager ), false );
- Event.observe( $('imageChoice'), 'change', CropImageManager.onChange.bindAsEventListener( CropImageManager ), false );
- }
- );
-
-
- /*
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
- */
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- html, body {
- margin: 0;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
- </style>
-</head>
-<body>
- <h2>Dynamic image test</h2>
- <p>
- Test of dynamically changing images or removing & re-applying the cropper
- </p>
-
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
- <p>
- <label for="imageChoice">image:</label>
- <select name="imageChoice" id="imageChoice">
- <option value="castle.jpg|500|333">Castle</option>
- <option value="poppy.jpg|311|466">Flower</option>
- </select>
- </p>
-
- <p>
- <input type="button" id="removeCropper" value="Remove Cropper" />
- <input type="button" id="resetCropper" value="Reset Cropper" />
- </p>
-
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-FixedRatio.htm b/library/cropper/tests/example-FixedRatio.htm
deleted file mode 100644
index 973bedda9..000000000
--- a/library/cropper/tests/example-FixedRatio.htm
+++ /dev/null
@@ -1,104 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>Fixed ratio test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // with a supplied ratio
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img(
- 'testImage',
- {
- ratioDim: { x: 220, y: 124 },
- displayOnInit: true,
- onEndCrop: onEndCrop
- }
- )
- }
- );
-
- /*
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- // Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
- */
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
- </style>
-</head>
-<body>
- <h2>Fixed ratio test</h2>
- <p>
- Test of applying a fixed ratio to the cropper
- </p>
- <br />
-
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-MinimumDimensions.htm b/library/cropper/tests/example-MinimumDimensions.htm
deleted file mode 100644
index 3ae93c8e1..000000000
--- a/library/cropper/tests/example-MinimumDimensions.htm
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>Min dimensions test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // example with minimum dimensions
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img(
- 'testImage',
- {
- minWidth: 200,
- minHeight: 120,
- displayOnInit: true,
- onEndCrop: onEndCrop
- }
- )
- }
- );
-
- /*
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- // Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
- */
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
- </style>
-</head>
-<body>
- <h2>Minimum (both axes ) dimension test</h2>
- <p>
- Test of applying a minimum dimension to both axes to the cropper
- </p>
- <br />
-
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-MinimumWidth.htm b/library/cropper/tests/example-MinimumWidth.htm
deleted file mode 100644
index b0576b87f..000000000
--- a/library/cropper/tests/example-MinimumWidth.htm
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title>Min (single axis) dimensions test</title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // example with minimum dimensions
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.Img(
- 'testImage',
- {
- minWidth: 200,
- displayOnInit: true,
- onEndCrop: onEndCrop
- }
- )
- }
- );
-
- /*
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- // Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
- */
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- #testWrap {
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
- </style>
-</head>
-<body>
- <h2>Minimum (single axis) dimension test</h2>
- <p>
- Test of applying a minimum dimension to only one axis (width in this case) to the cropper
- </p>
- <br />
- <br /><br />
-
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
-
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/example-Preview.htm b/library/cropper/tests/example-Preview.htm
deleted file mode 100644
index 701670c91..000000000
--- a/library/cropper/tests/example-Preview.htm
+++ /dev/null
@@ -1,117 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title></title>
- <script src="../lib/prototype.js" type="text/javascript"></script>
- <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
- <script src="../cropper.js" type="text/javascript"></script>
-
-
- <script type="text/javascript" charset="utf-8">
-
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- // example with a preview of crop results, must have minimumm dimensions
- Event.observe(
- window,
- 'load',
- function() {
- new Cropper.ImgWithPreview(
- 'testImage',
- {
- minWidth: 200,
- minHeight: 120,
- ratioDim: { x: 200, y: 120 },
- displayOnInit: true,
- onEndCrop: onEndCrop,
- previewWrap: 'previewArea'
- }
- )
- }
- );
-
- /*
- if( typeof(dump) != 'function' ) {
- Debug.init(true, '/');
-
- function dump( msg ) {
- // Debug.raise( msg );
- };
- } else dump( '---------------------------------------\n' );
- */
-
- </script>
- <link rel="stylesheet" type="text/css" href="debug.css" media="all" />
- <style type="text/css">
- label {
- clear: left;
- margin-left: 50px;
- float: left;
- width: 5em;
- }
-
- #testWrap {
- width: 500px;
- float: left;
- margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
- }
-
- #previewArea {
- margin: 20px; 0 0 20px;
- float: left;
- }
-
- #results {
- clear: both;
- }
- </style>
-</head>
-<body>
- <br /><br />
-
- <div id="testWrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- </div>
-
- <div id="previewArea"></div>
-
- <div id="results">
- <p>
- <label for="x1">x1:</label>
- <input type="text" name="x1" id="x1" />
- </p>
- <p>
- <label for="y1">y1:</label>
- <input type="text" name="y1" id="y1" />
- </p>
- <p>
- <label for="x2">x2:</label>
- <input type="text" name="x2" id="x2" />
- </p>
- <p>
- <label for="y2">y2:</label>
- <input type="text" name="y2" id="y2" />
- </p>
- <p>
- <label for="width">width:</label>
- <input type="text" name="width" id="width" />
- </p>
- <p>
- <label for="height">height</label>
- <input type="text" name="height" id="height" />
- </p>
- </div>
-
-</body>
-</html>
-
-
diff --git a/library/cropper/tests/poppy.jpg b/library/cropper/tests/poppy.jpg
deleted file mode 100644
index 1f6498584..000000000
--- a/library/cropper/tests/poppy.jpg
+++ /dev/null
Binary files differ
diff --git a/library/cropper/tests/staticHTMLStructure.htm b/library/cropper/tests/staticHTMLStructure.htm
deleted file mode 100644
index ddb99278e..000000000
--- a/library/cropper/tests/staticHTMLStructure.htm
+++ /dev/null
@@ -1,236 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en-us" />
- <title></title>
-</head>
-<body>
- <!--
-
- This is a static test file for the HTML & CSS structure employed, tested in
- the following browsers:
-
- PC:
- IE 6: working
- IE 5.5: working
- IE 5.0: opacity issues
- FF 1.5: working
- Opera 9: working
- MAC:
- Camino 1.0: working
- FF 1.5: working
- Safari 2.0: working
-
- -->
- <style type="text/css">
- .imgCrop_wrap {
- width: 500px; /* @TODO IN JS */
- height: 333px; /* @TODO IN JS */
- position: relative;
- cursor: crosshair;
- }
-
- /* fix for IE displaying all boxes at line-height by default */
- .imgCrop_wrap,
- .imgCrop_wrap * {
- font-size: 0;
- }
-
- .imgCrop_overlay {
- background-color: #000;
- opacity: 0.5;
- filter:alpha(opacity=50);
- position: absolute;
- width: 100%;
- height: 100%;
- }
-
- .imgCrop_selArea {
- position: absolute;
- cursor: move;
- /* @TODO: rest to be done via JS when selecting areas */
- top: 110px;
- left: 210px;
- width: 200px;
- height: 200px;
- z-index: 2;
- background: transparent url(castle.jpg) no-repeat -210px -110px;
- }
-
- /* imgCrop_clickArea is all a fix for IE 5.5 & 6 to allow the user to click on the given area */
- .imgCrop_clickArea {
- width: 100%;
- height: 100%;
- background-color: #FFF;
- opacity: 0.01;
- filter:alpha(opacity=01);
- }
-
- .imgCrop_marqueeHoriz {
- position: absolute;
- width: 100%;
- height: 1px;
- background: transparent url(marqueeHoriz.gif) repeat-x 0 0;
- }
-
- .imgCrop_marqueeVert {
- position: absolute;
- height: 100%;
- width: 1px;
- background: transparent url(marqueeVert.gif) repeat-y 0 0;
- }
-
- .imgCrop_marqueeNorth { top: 0; left: 0; }
- .imgCrop_marqueeEast { top: 0; right: 0; }
- .imgCrop_marqueeSouth { bottom: 0px; left: 0; }
- .imgCrop_marqueeWest { top: 0; left: 0; }
-
-
- .imgCrop_handle {
- position: absolute;
- border: 1px solid #333;
- width: 6px;
- height: 6px;
- background: #FFF;
- opacity: 0.5;
- filter:alpha(opacity=50);
- z-index: 3;
- }
-
- .imgCrop_handleN {
- top: -3px;
- left: 0;
- margin-left: 49%; /* @TODO : in JS */
- cursor: n-resize;
- }
-
- .imgCrop_handleNE {
- top: -3px;
- right: -3px;
- cursor: ne-resize;
- }
-
- .imgCrop_handleE {
- top: 0;
- right: -3px;
- margin-top: 49%; /* @TODO : in JS */
- cursor: e-resize;
- }
-
- .imgCrop_handleSE {
- right: -3px;
- bottom: -3px;
- cursor: se-resize;
- }
-
- .imgCrop_handleS {
- right: 0;
- bottom: -3px;
- margin-right: 49%; /* @TODO : in JS */
- cursor: s-resize;
- }
-
- .imgCrop_handleSW {
- left: -3px;
- bottom: -3px;
- cursor: sw-resize;
- }
-
- .imgCrop_handleW {
- top: 0;
- left: -3px;
- margin-top: 49%; /* @TODO : in JS */
- cursor: e-resize;
- }
-
- .imgCrop_handleNW {
- top: -3px;
- left: -3px;
- cursor: nw-resize;
- }
-
- /**
- * Create an area to click & drag around on as the default browser behaviour is to let you drag the image
- */
- .imgCrop_dragArea {
- width: 100%;
- height: 100%;
- z-index: 200;
- position: absolute;
- top: 0;
- left: 0;
- }
-
-
- .imgCrop_previewWrap {
- width: 200px; /* @TODO : in JS */
- height: 200px; /* @TODO : in JS */
- overflow: hidden;
- position: relative;
- }
-
- /* @TODO : all in JS */
- .imgCrop_previewWrap img {
- position: absolute;
- width: 500px;
- height: 333px;
- left: -210px;
- top: -110px;
- }
-
- /**
- * These are just for the static test
- */
- .imgCrop_wrap {
- margin: 20px 0 0 50px;
- float: left;
- }
-
- #previewWrapper {
- float: left;
- margin-left: 20px;
- }
-
-
- </style>
-
- <br /><br />
-
- <!-- This is all attached to the image dynamically -->
- <div class="imgCrop_wrap">
- <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
- <div class="imgCrop_dragArea">
- <div class="imgCrop_overlay"></div>
- <div class="imgCrop_selArea">
- <!-- marquees -->
- <!-- the inner spans are only required for IE to stop it making the divs 1px high/wide -->
- <div class="imgCrop_marqueeHoriz imgCrop_marqueeNorth"><span></span></div>
- <div class="imgCrop_marqueeVert imgCrop_marqueeEast"><span></span></div>
- <div class="imgCrop_marqueeHoriz imgCrop_marqueeSouth"><span></span></div>
- <div class="imgCrop_marqueeVert imgCrop_marqueeWest"><span></span></div>
- <!-- handles -->
- <div class="imgCrop_handle imgCrop_handleN"></div>
- <div class="imgCrop_handle imgCrop_handleNE"></div>
- <div class="imgCrop_handle imgCrop_handleE"></div>
- <div class="imgCrop_handle imgCrop_handleSE"></div>
- <div class="imgCrop_handle imgCrop_handleS"></div>
- <div class="imgCrop_handle imgCrop_handleSW"></div>
- <div class="imgCrop_handle imgCrop_handleW"></div>
- <div class="imgCrop_handle imgCrop_handleNW"></div>
- <div class="imgCrop_clickArea"></div>
- </div>
- <div class="imgCrop_clickArea"></div>
- </div>
- </div>
-
- <div id="previewWrapper">
- <h3>Preview:</h3>
- <div class="imgCrop_previewWrap">
- <img src="castle.jpg" alt="test image" id="previewImage" />
- </div>
- </div>
-</body>
-</html>
-
-
diff --git a/library/cropperjs/.babelrc b/library/cropperjs/.babelrc
new file mode 100644
index 000000000..6909c9dc9
--- /dev/null
+++ b/library/cropperjs/.babelrc
@@ -0,0 +1,10 @@
+{
+ "presets": [
+ ["env", {
+ "modules": false,
+ "targets": {
+ "browsers": ["last 2 versions", "ie >= 9"]
+ }
+ }]
+ ]
+}
diff --git a/library/cropperjs/.editorconfig b/library/cropperjs/.editorconfig
new file mode 100644
index 000000000..0f1786729
--- /dev/null
+++ b/library/cropperjs/.editorconfig
@@ -0,0 +1,9 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
diff --git a/library/cropperjs/.eslintrc b/library/cropperjs/.eslintrc
new file mode 100644
index 000000000..8757045b6
--- /dev/null
+++ b/library/cropperjs/.eslintrc
@@ -0,0 +1,13 @@
+{
+ "extends": "airbnb-base",
+ "env": {
+ "browser": true
+ },
+ "rules": {
+ "no-param-reassign": "off",
+ "no-restricted-properties": "off",
+ "valid-jsdoc": ["error", {
+ "requireReturn": false
+ }]
+ }
+}
diff --git a/library/cropperjs/.travis.yml b/library/cropperjs/.travis.yml
new file mode 100644
index 000000000..de9b4ae30
--- /dev/null
+++ b/library/cropperjs/.travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+node_js:
+ - "node"
+script:
+ - npm run lint
+ - npm run build
+ - npm test
diff --git a/library/cropperjs/CHANGELOG.md b/library/cropperjs/CHANGELOG.md
new file mode 100644
index 000000000..f0d54cd92
--- /dev/null
+++ b/library/cropperjs/CHANGELOG.md
@@ -0,0 +1,218 @@
+# Changelog
+
+## 1.2.2 (Jan 3, 2018)
+
+- Fix incorrect image natural sizes in iOS Safari (#279).
+
+## 1.2.1 (Dec 17, 2017)
+
+- Add `style` field to `package.json`.
+- Fix size error when load SVG image (#256).
+
+## 1.2.0 (Dec 17, 2017)
+
+- Allow to set the pivot of zoom (#144).
+- Fixed a bug of rotation (#260).
+
+## 1.1.3 (Oct 21, 2017)
+
+- Fixed a bug of render when disable one of `rotatable` and `scalable` options (#241).
+
+## 1.1.2 (Oct 18, 2017)
+
+- Normalize related decimal numbers when crop an image with canvas.
+
+## 1.1.1 (Oct 11, 2017)
+
+- Supports to load in node environment (#237).
+- Fixed a bug of event binding (#238).
+
+## 1.1.0 (Oct 8, 2017)
+
+- Added 4 new options to `getCroppedCanvas` method: `minWidth`, `minHeight`, `maxWidth` and `maxHeight`.
+- Enhanced image scaling: the `scaleX` and `scaleY` values should only be `1` or `-1` before, but now they can be any numbers.
+- Improved crop box resizing behaviour in the northeast, northwest, southeast and southwest directions. (#222).
+
+## 1.0.0 (Sep 3, 2017)
+
+- Fixed a bug of zoom out after cleared the crop box in view mode 1, 2 and 3 (#209).
+- Improve crop box resizing behaviour in the east, west, south and north directions (#222).
+
+## 1.0.0-rc.3 (Jul 7, 2017)
+
+- Added two new options (`imageSmoothingEnabled` and `imageSmoothingQuality`) to `getCroppedCanvas` method.
+- Fixed a bug of RegExp using (#195 by @arusakov).
+
+## 1.0.0-rc.2 (May 30, 2017)
+
+- Fixed the issue of canvas box initialization (#179).
+
+## 1.0.0-rc.1 (Apr 30, 2017)
+
+- Change the `main` field value from `dist/cropper.js` (UMD) to `dist/cropper.common.js` (CommonJS).
+- Added `module` and `browser` fields to `package.json`.
+
+## 1.0.0-rc (Mar 25, 2017)
+
+- Fixed the bug of touch zoom (#161).
+- Fixed the bug of window resize (#162).
+- Improve the `toggleDragModeOnDblclick` option (only available when the `dragMode` option is set to `crop` or `move`)
+
+## 1.0.0-beta.2 (Feb 25, 2017)
+
+- Fixed the bug of rotate square image lead image shrink (#155).
+- Improved RegExps for DataURL processing (#156).
+
+## 1.0.0-beta.1 (Jan 21, 2017)
+
+- Use CSS3 2D Transforms instead of `left` and `top` for better performance (#138).
+- Set `withCredentials` attribute when read the image data by XMLHttpRequest (#141).
+
+## 1.0.0-beta (Jan 1, 2017)
+
+- Supports to set an element for preview (#113).
+- Improved event handler for Pointer Events (#127).
+
+## 1.0.0-alpha (Dec 4, 2016)
+
+- Built JavaScript with Rollup.
+- Build CSS with PostCSS.
+- Fixed a bug of auto crop when replace the image (#83).
+
+## 0.8.1 (Sep 3, 2016)
+
+- Fixed the bug of cropping (#80).
+- Fixed the bug of calling `ready` event twice when call `replace` method (#81).
+- Fixed the bug of `getCroppedCanvas` when set `scalable` or `rotatable` to `false` (#82).
+
+## 0.8.0 (Aug 18, 2016)
+
+- Removed `build` event.
+- Renamed `built` event to `ready`.
+- Fixed the error of orientation transform.
+- Ported code to ECMAScript 6.
+
+## 0.7.2 (Jun 8, 2016)
+
+- Fixed a bug of `data-*` attributes setting and getting.
+- Fixed the calling order of `scale` and `rotate`.
+
+## 0.7.1 (May 28, 2016)
+
+- Improved the rotate and scale transform behaviour.
+- Improved the `getCroppedCanvas` method (returns the whole canvas if it is not cropped).
+- Check cross origin setting when load image by XMLHTTPRequest.
+
+## 0.7.0 (Mar 20, 2016)
+
+- Supports 7 custom events: `build`, `built`, `cropstart`, `cropmove`, `cropend`, `crop` and `zoom`.
+- The original callback options become shortcuts of these events now.
+- IE8 is no longer supported after added these custom events.
+
+## 0.6.0 (Feb 22, 2016)
+
+- Added a new parameter to the `replace` method for applying filters.
+- Improved the image initializing for Safari.
+- Fixed incorrect size limitation of the crop box (#30).
+- Fixed incorrect cropped canvas when scaleX or scaleY great than 1.
+
+## 0.5.6 (Jan 18, 2016)
+
+- Fixed crossOriginUrl undefined error when exists the `crossOrigin` property.
+- Fixed the issue in the "destroy" method (#24).
+- Optimized tests.
+
+## 0.5.5 (Jan 1, 2016)
+
+- Fixed a dimension bug in the "getCroppedCanvas" method.
+- Added an example for cropping round image.
+
+## 0.5.4 (Dec 28, 2015)
+
+- Supports to zoom from event triggering point.
+
+## 0.5.3 (Dec 24, 2015)
+
+- Limit wheel speed to prevent zoom too fast (#21)
+- Improve the `setCropBoxData` method (#22)
+
+## 0.5.2 (Dec 15, 2015)
+
+- Fix event handlers
+
+## 0.5.1 (Dec 12, 2015)
+
+- Handle Data URL (avoid to use XMLHttpRequest to open a Data URL)
+- Handle ajax error when load ArrayBuffer
+- Not to transform the image to base64 when Orientation equals to `1`
+- Fix some typos
+
+## 0.5.0 (Dec 5, 2015)
+
+- Added a new option: `checkOrientation`
+- Added a timestamp to the url of preview image
+
+## 0.4.0 (Dec 2, 2015)
+
+- Added a new option: `restore`
+- Fixed #12: Added vendor prefixes to CSS `transform`
+
+## 0.3.3 (Nov 30, 2015)
+
+- Floor the numerical parameters for `CanvasRenderingContext2D.drawImage`
+
+## 0.3.2 (Nov 18, 2015)
+
+- Fixed #10: improve new crop box creating
+
+## 0.3.1 (Nov 11, 2015)
+
+- Fixed #7: reset the `crossOrigin` when call the `replace` method
+
+## 0.3.0 (Oct 28, 2015)
+
+- Supports four view modes
+- Supports three drag modes
+- Makes the crop box's borders and handlers visible when overflow
+- Added some examples
+- Fixed some issues
+
+### Options
+
+- Added `viewMode`
+- Added `dragMode`
+- Renamed `touchDragZoom` to `zoomOnTouch`
+- Renamed `mouseWheelZoom` to `zoomOnWheel`
+- Renamed `doubleClickToggle` to `toggleDragModeOnDblclick`
+- Renamed `checkImageOrigin` to `checkCrossOrigin`
+- Removed `strict` (supported by `viewMode: 1`)
+- Removed `dragCrop` (supported by `dragMode: 'crop'`)
+
+## 0.2.1 (Oct 28, 2015)
+
+- Fix the error jQuery reference on the `setCanvasData` method
+- Fix typo on the `destroy` method
+
+## 0.2.0 (Oct 25, 2015)
+
+- Added 5 new methods: `moveTo`, `zoomTo`, `rotateTo`, `scaleX` and `scaleY`
+- Improved 4 methods: `move`, `zoom`, `rotate` and `getCanvasData`
+- Improved cropping
+
+## 0.1.1 (Oct 10, 2015)
+
+- Improved canvas limitation
+- Improved crop box limitation
+- Improved preview for cross origin image
+
+## 0.1.0 (Sep 25, 2015)
+
+- Supports touch (mobile)
+- Supports zoom
+- Supports rotation
+- Supports scale (flip)
+- Supports canvas
+- Supports multiple croppers
+- Cross-browser support
+- Supports 37 options: `aspectRatio`, `data`, `preview`, `strict`, `responsive`, `checkImageOrigin`, `modal`, `guides`, `center`, `highlight`, `background`, `autoCrop`, `autoCropArea`, `dragCrop`, `movable`, `rotatable`, `scalable`, `zoomable`, `mouseWheelZoom`, `wheelZoomRatio`, `touchDragZoom`, `cropBoxMovable`, `cropBoxResizable`, `doubleClickToggle`, `minCanvasWidth`, `minCanvasHeight`, `minCropBoxWidth`, `minCropBoxHeight`, `minContainerWidth`, `minContainerHeight`, `build`, `built`, `cropstart`, `cropmove`, `cropend`, `crop`, `zoom`.
+- Support 22 methods: `crop`, `reset`, `clear`, `replace`, `enable`, `disable`, `destroy`, `move`, `zoom`, `rotate`, `scale`, `getData`, `setData`, `getContainerData`, `getImageData`, `getCanvasData`, `setCanvasData`, `getCropBoxData`, `setCropBoxData`, `getCroppedCanvas`, `setAspectRatio`, `setDragMode`.
diff --git a/library/cropperjs/CONTRIBUTING.md b/library/cropperjs/CONTRIBUTING.md
new file mode 100644
index 000000000..7c31d7ab0
--- /dev/null
+++ b/library/cropperjs/CONTRIBUTING.md
@@ -0,0 +1,35 @@
+# Contributing to Cropper
+
+## How to report bugs
+
+### Make sure it is a Cropper bug
+
+Most bugs reported to our bug tracker are actually bugs in user code, not in Cropper code. Keep in mind that just because your code throws an error inside of Cropper, this does *not* mean the bug is a Cropper bug.
+
+Ask for help first in a discussion forum like [Stack Overflow](http://stackoverflow.com/). You will get much quicker support, and you will help avoid tying up the Cropper team with invalid bug reports.
+
+### Disable browser extensions
+
+Make sure you have reproduced the bug with all browser extensions and add-ons disabled, as these can sometimes cause things to break in interesting and unpredictable ways. Try using incognito, stealth or anonymous browsing modes.
+
+### Try the latest version of Cropper
+
+Bugs in old versions of Cropper may have already been fixed. In order to avoid reporting known issues, make sure you are always testing against the [latest release](https://github.com/fengyuanchen/cropperjs/releases/latest). We cannot fix bugs in older released files, if a bug has been fixed in a subsequent version of Cropper the site should upgrade.
+
+### Simplify the test case
+
+When experiencing a problem, [reduce your code](http://webkit.org/quality/reduction.html) to the bare minimum required to reproduce the issue. This makes it *much* easier to isolate and fix the offending code. Bugs reported without reduced test cases take on average 9001% longer to fix than bugs that are submitted with them, so you really should try to do this if at all possible.
+
+### Search for related or duplicate issues
+
+Go to the [Cropper issue tracker](https://github.com/fengyuanchen/cropperjs/issues) and make sure the problem hasn't already been reported. If not, create a new issue there and include your test case.
+
+### Browser support
+
+Remember that Cropper supports multiple browsers and their versions; any contributed code must work in all of them. You can refer to the [browser support page](https://github.com/fengyuanchen/cropperjs/blob/master/README.md#browser-support) for the current list of supported browsers.
+
+## Notes for pull request
+
+- Run the test suites in the `test` directory first.
+- Don't modify any files in the `dist` directory.
+- Follow the same code style as the library.
diff --git a/library/cropperjs/ISSUE_TEMPLATE.md b/library/cropperjs/ISSUE_TEMPLATE.md
new file mode 100644
index 000000000..0ed98b61d
--- /dev/null
+++ b/library/cropperjs/ISSUE_TEMPLATE.md
@@ -0,0 +1,21 @@
+Before opening an issue:
+
+- [Search for duplicate or closed issues](https://github.com/fengyuanchen/cropperjs/issues?utf8=%E2%9C%93&q=is%3Aissue)
+- Prepare a [reduced test case](https://css-tricks.com/reduced-test-cases/) for any bugs
+- Read the [contributing guidelines](https://github.com/fengyuanchen/cropperjs/blob/master/CONTRIBUTING.md)
+
+When asking general "how to" questions:
+
+- Please do not open an issue here
+- Instead, ask for help on [StackOverflow](http://stackoverflow.com/)
+
+When reporting a bug, include:
+
+- Operating system and version (Windows, Mac OS X, Android, iOS, Win10 Mobile)
+- Browser and version (Chrome, Firefox, Safari, IE, MS Edge, Opera 15+, Android Browser)
+- Reduced test cases and potential fixes using [JS Bin](https://jsbin.com), [JSFiddle](https://jsfiddle.net/) or [CodePen](https://codepen.io/)
+
+When suggesting a feature, include:
+
+- As much detail as possible for what we should add and why it's important to Cropper.js
+- Relevant links to prior art, screenshots, or live demos whenever possible
diff --git a/library/cropperjs/LICENSE b/library/cropperjs/LICENSE
new file mode 100644
index 000000000..e9b8a22b3
--- /dev/null
+++ b/library/cropperjs/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-present Chen Fengyuan
+
+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.
diff --git a/library/cropperjs/README.md b/library/cropperjs/README.md
new file mode 100644
index 000000000..73e8dda30
--- /dev/null
+++ b/library/cropperjs/README.md
@@ -0,0 +1,1028 @@
+# Cropper.js
+
+[![Build Status](https://travis-ci.org/fengyuanchen/cropperjs.svg)](https://travis-ci.org/fengyuanchen/cropperjs) [![Downloads](https://img.shields.io/npm/dm/cropperjs.svg)](https://www.npmjs.com/package/cropperjs) [![Version](https://img.shields.io/npm/v/cropperjs.svg)](https://www.npmjs.com/package/cropperjs)
+
+> JavaScript image cropper.
+
+- [Website](https://fengyuanchen.github.io/cropperjs)
+- [Photo Editor](https://fengyuanchen.github.io/photo-editor) - An advanced example of Cropper.js.
+
+## Table of contents
+
+- [Features](#features)
+- [Main](#main)
+- [Getting started](#getting-started)
+- [Options](#options)
+- [Methods](#methods)
+- [Events](#events)
+- [No conflict](#no-conflict)
+- [Browser support](#browser-support)
+- [Contributing](#contributing)
+- [Versioning](#versioning)
+- [License](#license)
+
+## Features
+
+- Supports 38 [options](#options)
+- Supports 27 [methods](#methods)
+- Supports 6 [events](#events)
+- Supports touch (mobile)
+- Supports zooming
+- Supports rotating
+- Supports scaling (flipping)
+- Supports multiple croppers
+- Supports to crop on a canvas
+- Supports to crop image in the browser-side by canvas
+- Supports to translate Exif Orientation information
+- Cross-browser support
+
+## Main
+
+```text
+dist/
+├── cropper.css
+├── cropper.min.css (compressed)
+├── cropper.js (UMD)
+├── cropper.min.js (UMD, compressed)
+├── cropper.common.js (CommonJS, default)
+└── cropper.esm.js (ES Module)
+```
+
+## Getting started
+
+### Installation
+
+```shell
+npm install cropperjs
+```
+
+Include files:
+
+```html
+<link href="/path/to/cropper.css" rel="stylesheet">
+<script src="/path/to/cropper.js"></script>
+```
+
+The [cdnjs](https://github.com/cdnjs/cdnjs) provides CDN support for Cropper.js's CSS and JavaScript. You can find the links [here](https://cdnjs.com/libraries/cropperjs).
+
+### Usage
+
+Initialize with `Cropper` constructor:
+
+- Browser: `window.Cropper`
+- CommonJS: `var Cropper = require('cropperjs')`
+- ES2015: `import Cropper from 'cropperjs'`
+
+```html
+<!-- Wrap the image or canvas element with a block element (container) -->
+<div>
+ <img id="image" src="picture.jpg">
+</div>
+```
+
+```css
+/* Limit image width to avoid overflow the container */
+img {
+ max-width: 100%; /* This rule is very important, please do not ignore this! */
+}
+```
+
+```js
+var image = document.getElementById('image');
+var cropper = new Cropper(image, {
+ aspectRatio: 16 / 9,
+ crop: function(e) {
+ console.log(e.detail.x);
+ console.log(e.detail.y);
+ console.log(e.detail.width);
+ console.log(e.detail.height);
+ console.log(e.detail.rotate);
+ console.log(e.detail.scaleX);
+ console.log(e.detail.scaleY);
+ }
+});
+```
+
+#### FAQ
+
+How to crop a new area after zoom in or zoom out?
+
+> Just double click your mouse to enter crop mode.
+
+How to move the image after crop an area?
+
+> Just double click your mouse to enter move mode.
+
+How to fix aspect ratio in free ratio mode?
+
+> Just hold the `shift` key when you resize the crop box.
+
+How to crop a square area in free ratio mode?
+
+> Just hold the `shift` key when you crop on the image.
+
+#### Notes
+
+- The size of the cropper inherits from the size of the image's parent element (wrapper), so be sure to wrap the image with a **visible block element**.
+ > If you are using cropper in a modal, you should initialize the cropper after the modal shown completely. Otherwise, you will not get a correct cropper.
+
+- The outputted cropped data bases on the original image size, so you can use them to crop the image directly.
+
+- If you try to start cropper on a cross-origin image, please make sure that your browser supports HTML5 [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes), and your image server supports the `Access-Control-Allow-Origin` option (see the [HTTP access control (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS)).
+
+#### Known issues
+
+- [Known iOS resource limits](https://developer.apple.com/library/mac/documentation/AppleApplications/Reference/SafariWebContent/CreatingContentforSafarioniPhone/CreatingContentforSafarioniPhone.html): As iOS devices limit memory, the browser may crash when you are cropping a large image (iPhone camera resolution). To avoid this, you may resize the image first (preferably below 1024 pixels) before start a cropper.
+
+- Known image size increase: When export the cropped image on browser-side with the `HTMLCanvasElement.toDataURL` method, the size of the exported image may be greater than the original image's. This is because the type of the exported image is not the same as the original image's. So just pass the type the original image's as the first parameter to `toDataURL` to fix this. For example, if the original type is JPEG, then use `cropper.getCroppedCanvas().toDataURL('image/jpeg')` to export image.
+
+[⬆ back to top](#table-of-contents)
+
+## Options
+
+You may set cropper options with `new Cropper(image, options)`.
+If you want to change the global default options, You may use `Cropper.setDefaults(options)`.
+
+### viewMode
+
+- Type: `Number`
+- Default: `0`
+- Options:
+ - `0`: no restrictions
+ - `1`: restrict the crop box to not exceed the size of the canvas.
+ - `2`: restrict the minimum canvas size to fit within the container. If the proportions of the the canvas and the container differ, the minimum canvas will be surrounded by extra space in one of the dimensions.
+ - `3`: restrict the minimum canvas size to fill fit the container. If the proportions of the canvas and the container are different, the container will not be able to fit the whole canvas in one of the dimensions.
+
+Define the view mode of the cropper. If you set `viewMode` to `0`, the crop box can extend outside the canvas, while a value of `1`, `2` or `3` will restrict the crop box to the size of the canvas. A `viewMode` of `2` or `3` will additionally restrict the canvas to the container. Note that if the proportions of the canvas and the container are the same, there is no difference between `2` and `3`.
+
+### dragMode
+
+- Type: `String`
+- Default: `'crop'`
+- Options:
+ - `'crop'`: create a new crop box
+ - `'move'`: move the canvas
+ - `'none'`: do nothing
+
+Define the dragging mode of the cropper.
+
+### aspectRatio
+
+- Type: `Number`
+- Default: `NaN`
+
+Set the aspect ratio of the crop box. By default, the crop box is free ratio.
+
+### data
+
+- Type: `Object`
+- Default: `null`
+
+The previous cropped data if you had stored, will be passed to `setData` method automatically when built.
+
+### preview
+
+- Type: `Element` or `String`
+- Default: `''`
+- An element or A valid selector for [Document.querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll)
+
+Add extra elements (containers) for previewing.
+
+**Notes:**
+
+- The maximum width is the initial width of preview container.
+- The maximum height is the initial height of preview container.
+- If you set an `aspectRatio` option, be sure to set the same aspect ratio to the preview container.
+- If preview is not getting properly displayed, set `overflow: hidden` style to the preview container.
+
+### responsive
+
+- Type: `Boolean`
+- Default: `true`
+
+Re-render the cropper when resize the window.
+
+### restore
+
+- Type: `Boolean`
+- Default: `true`
+
+Restore the cropped area after resize the window.
+
+### checkCrossOrigin
+
+- Type: `Boolean`
+- Default: `true`
+
+Check if the current image is a cross-origin image.
+
+If it is, when clone the image, a `crossOrigin` attribute will be added to the cloned image element and a timestamp will be added to the `src` attribute to reload the source image to avoid browser cache error.
+
+By adding `crossOrigin` attribute to image will stop adding timestamp to image url and stop reload of image, but the request (XMLHttpRequest) to read the image data for orientation checking will require a timestamp now.
+
+If the value of the image's `crossOrigin` attribute is `"use-credentials"`, then the `withCredentials` attribute will set to `true` when read the image data by XMLHttpRequest.
+
+### checkOrientation
+
+- Type: `Boolean`
+- Default: `true`
+
+Check the current image's Exif Orientation information.
+
+More exactly, read the Orientation value for rotating or flipping the image, and then override the Orientation value with `1` (the default value) to avoid some issues ([1](https://github.com/fengyuanchen/cropper/issues/120), [2](https://github.com/fengyuanchen/cropper/issues/509)) on iOS devices.
+
+Requires to set both the `rotatable` and `scalable` options to `true` at the same time.
+
+**Note:** Don't trust this all the time as some JPG images have incorrect (not standard) Orientation values.
+
+> Requires [Typed Arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) support ([IE 10+](http://caniuse.com/typedarrays)).
+
+### modal
+
+- Type: `Boolean`
+- Default: `true`
+
+Show the black modal above the image and under the crop box.
+
+### guides
+
+- Type: `Boolean`
+- Default: `true`
+
+Show the dashed lines above the crop box.
+
+### center
+
+- Type: `Boolean`
+- Default: `true`
+
+Show the center indicator above the crop box.
+
+### highlight
+
+- Type: `Boolean`
+- Default: `true`
+
+Show the white modal above the crop box (highlight the crop box).
+
+### background
+
+- Type: `Boolean`
+- Default: `true`
+
+Show the grid background of the container.
+
+### autoCrop
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to crop the image automatically when initialize.
+
+### autoCropArea
+
+- Type: `Number`
+- Default: `0.8` (80% of the image)
+
+A number between 0 and 1. Define the automatic cropping area size (percentage).
+
+### movable
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to move the image.
+
+### rotatable
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to rotate the image.
+
+### scalable
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to scale the image.
+
+### zoomable
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to zoom the image.
+
+### zoomOnTouch
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to zoom the image by dragging touch.
+
+### zoomOnWheel
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to zoom the image by wheeling mouse.
+
+### wheelZoomRatio
+
+- Type: `Number`
+- Default: `0.1`
+
+Define zoom ratio when zoom the image by wheeling mouse.
+
+### cropBoxMovable
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to move the crop box by dragging.
+
+### cropBoxResizable
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to resize the crop box by dragging.
+
+### toggleDragModeOnDblclick
+
+- Type: `Boolean`
+- Default: `true`
+
+Enable to toggle drag mode between "crop" and "move" when click twice on the cropper.
+
+### minContainerWidth
+
+- Type: `Number`
+- Default: `200`
+
+The minimum width of the container.
+
+### minContainerHeight
+
+- Type: `Number`
+- Default: `100`
+
+The minimum height of the container.
+
+### minCanvasWidth
+
+- Type: `Number`
+- Default: `0`
+
+The minimum width of the canvas (image wrapper).
+
+### minCanvasHeight
+
+- Type: `Number`
+- Default: `0`
+
+The minimum height of the canvas (image wrapper).
+
+### minCropBoxWidth
+
+- Type: `Number`
+- Default: `0`
+
+The minimum width of the crop box.
+
+**Note:** This size is relative to the page, not the image.
+
+### minCropBoxHeight
+
+- Type: `Number`
+- Default: `0`
+
+The minimum height of the crop box.
+
+**Note:** This size is relative to the page, not the image.
+
+### ready
+
+- Type: `Function`
+- Default: `null`
+
+A shortcut of the "ready" event.
+
+### cropstart
+
+- Type: `Function`
+- Default: `null`
+
+A shortcut of the "cropstart" event.
+
+### cropmove
+
+- Type: `Function`
+- Default: `null`
+
+A shortcut of the "cropmove" event.
+
+### cropend
+
+- Type: `Function`
+- Default: `null`
+
+A shortcut of the "cropend" event.
+
+### crop
+
+- Type: `Function`
+- Default: `null`
+
+A shortcut of the "crop" event.
+
+### zoom
+
+- Type: `Function`
+- Default: `null`
+
+A shortcut of the "zoom" event.
+
+[⬆ back to top](#table-of-contents)
+
+## Methods
+
+As there is an **asynchronous** process when load the image, you **should call most of the methods after ready**, except "setAspectRatio", "replace" and "destroy".
+
+> If a method doesn't need to return any value, it will return the cropper instance (`this`) for chain composition.
+
+```js
+new Cropper(image, {
+ ready: function () {
+ // this.cropper[method](argument1, , argument2, ..., argumentN);
+ this.cropper.move(1, -1);
+
+ // Allows chain composition
+ this.cropper.move(1, -1).rotate(45).scale(1, -1);
+ }
+});
+```
+
+### crop()
+
+Show the crop box manually.
+
+```js
+new Cropper(image, {
+ autoCrop: false,
+ ready: function () {
+ // Do something here
+ // ...
+
+ // And then
+ this.cropper.crop();
+ }
+});
+```
+
+### reset()
+
+Reset the image and crop box to their initial states.
+
+### clear()
+
+Clear the crop box.
+
+### replace(url[, onlyColorChanged])
+
+- **url**:
+ - Type: `String`
+ - A new image url.
+
+- **onlyColorChanged** (optional):
+ - Type: `Boolean`
+ - If only change the color, not the size, then the cropper only need to change the srcs of all related images, not need to rebuild the cropper. This can be used for applying filters.
+ - If not present, its default value is `false`.
+
+Replace the image's src and rebuild the cropper.
+
+### enable()
+
+Enable (unfreeze) the cropper.
+
+### disable()
+
+Disable (freeze) the cropper.
+
+### destroy()
+
+Destroy the cropper and remove the instance from the image.
+
+### move(offsetX[, offsetY])
+
+- **offsetX**:
+ - Type: `Number`
+ - Moving size (px) in the horizontal direction.
+
+- **offsetY** (optional):
+ - Type: `Number`
+ - Moving size (px) in the vertical direction.
+ - If not present, its default value is `offsetX`.
+
+Move the canvas (image wrapper) with relative offsets.
+
+```js
+cropper.move(1);
+cropper.move(1, 0);
+cropper.move(0, -1);
+```
+
+### moveTo(x[, y])
+
+- **x**:
+ - Type: `Number`
+ - The `left` value of the canvas
+
+- **y** (optional):
+ - Type: `Number`
+ - The `top` value of the canvas
+ - If not present, its default value is `x`.
+
+Move the canvas (image wrapper) to an absolute point.
+
+### zoom(ratio)
+
+- **ratio**:
+ - Type: `Number`
+ - Zoom in: requires a positive number (ratio > 0)
+ - Zoom out: requires a negative number (ratio < 0)
+
+Zoom the canvas (image wrapper) with a relative ratio.
+
+```js
+cropper.zoom(0.1);
+cropper.zoom(-0.1);
+```
+
+### zoomTo(ratio[, pivot])
+
+- **ratio**:
+ - Type: `Number`
+ - Requires a positive number (ratio > 0)
+
+- **pivot** (optional):
+ - Type: `Object`
+ - Schema: `{ x: Number, y: Number }`
+ - The coordinate of the center point for zooming, base on the top left corner of the cropper container.
+
+Zoom the canvas (image wrapper) to an absolute ratio.
+
+```js
+cropper.zoomTo(1); // 1:1 (canvasData.width === canvasData.naturalWidth)
+
+const containerData = cropper.getContainerData();
+
+// Zoom to 50% from the center of the container.
+cropper.zoomTo(.5, {
+ x: containerData.width / 2,
+ y: containerData.height / 2,
+});
+```
+
+### rotate(degree)
+
+- **degree**:
+ - Type: `Number`
+ - Rotate right: requires a positive number (degree > 0)
+ - Rotate left: requires a negative number (degree < 0)
+
+Rotate the image with a relative degree.
+
+> Requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](http://caniuse.com/transforms2d)).
+
+```js
+cropper.rotate(90);
+cropper.rotate(-90);
+```
+
+### rotateTo(degree)
+
+- **degree**:
+ - Type: `Number`
+
+Rotate the image to an absolute degree.
+
+### scale(scaleX[, scaleY])
+
+- **scaleX**:
+ - Type: `Number`
+ - Default: `1`
+ - The scaling factor to apply on the abscissa of the image.
+ - When equal to `1` it does nothing.
+
+- **scaleY** (optional):
+ - Type: `Number`
+ - The scaling factor to apply on the ordinate of the image.
+ - If not present, its default value is `scaleX`.
+
+Scale the image.
+
+> Requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](http://caniuse.com/transforms2d)).
+
+```js
+cropper.scale(-1); // Flip both horizontal and vertical
+cropper.scale(-1, 1); // Flip horizontal
+cropper.scale(1, -1); // Flip vertical
+```
+
+### scaleX(scaleX)
+
+- **scaleX**:
+ - Type: `Number`
+ - Default: `1`
+ - The scaling factor to apply on the abscissa of the image.
+ - When equal to `1` it does nothing.
+
+Scale the abscissa of the image.
+
+### scaleY(scaleY)
+
+- **scaleY**:
+ - Type: `Number`
+ - Default: `1`
+ - The scaling factor to apply on the ordinate of the image.
+ - When equal to `1` it does nothing.
+
+Scale the ordinate of the image.
+
+### getData([rounded])
+
+- **rounded** (optional):
+ - Type: `Boolean`
+ - Default: `false`
+ - Set `true` to get rounded values.
+
+- (return value):
+ - Type: `Object`
+ - Properties:
+ - `x`: the offset left of the cropped area
+ - `y`: the offset top of the cropped area
+ - `width`: the width of the cropped area
+ - `height`: the height of the cropped area
+ - `rotate`: the rotated degrees of the image
+ - `scaleX`: the scaling factor to apply on the abscissa of the image
+ - `scaleY`: the scaling factor to apply on the ordinate of the image
+
+Output the final cropped area position and size data (base on the natural size of the original image).
+
+> You can send the data to server-side to crop the image directly:
+> 1. Rotate the image with the `rotate` property.
+> 1. Scale the image with the `scaleX` and `scaleY` properties.
+> 1. Crop the image with the `x`, `y`, `width` and `height` properties.
+
+![A schematic diagram for data's properties](docs/images/data.jpg)
+
+### setData(data)
+
+- **data**:
+ - Type: `Object`
+ - Properties: See the [`getData`](#getdatarounded) method.
+ - You may need to round the data properties before passing them in.
+
+Change the cropped area position and size with new data (base on the original image).
+
+> **Note:** This method only available when the `viewMode` option great than or equal to `1`.
+
+### getContainerData()
+
+- (return value):
+ - Type: `Object`
+ - Properties:
+ - `width`: the current width of the container
+ - `height`: the current height of the container
+
+Output the container size data.
+
+![A schematic diagram for cropper's layers](docs/images/layers.jpg)
+
+### getImageData()
+
+- (return value):
+ - Type: `Object`
+ - Properties:
+ - `left`: the offset left of the image
+ - `top`: the offset top of the image
+ - `width`: the width of the image
+ - `height`: the height of the image
+ - `naturalWidth`: the natural width of the image
+ - `naturalHeight`: the natural height of the image
+ - `aspectRatio`: the aspect ratio of the image
+ - `rotate`: the rotated degrees of the image if rotated
+ - `scaleX`: the scaling factor to apply on the abscissa of the image if scaled
+ - `scaleY`: the scaling factor to apply on the ordinate of the image if scaled
+
+Output the image position, size and other related data.
+
+### getCanvasData()
+
+- (return value):
+ - Type: `Object`
+ - Properties:
+ - `left`: the offset left of the canvas
+ - `top`: the offset top of the canvas
+ - `width`: the width of the canvas
+ - `height`: the height of the canvas
+ - `naturalWidth`: the natural width of the canvas (read only)
+ - `naturalHeight`: the natural height of the canvas (read only)
+
+Output the canvas (image wrapper) position and size data.
+
+```js
+var imageData = cropper.getImageData();
+var canvasData = cropper.getCanvasData();
+
+if (imageData.rotate % 180 === 0) {
+ console.log(canvasData.naturalWidth === imageData.naturalWidth); // true
+}
+```
+
+### setCanvasData(data)
+
+- **data**:
+ - Type: `Object`
+ - Properties:
+ - `left`: the new offset left of the canvas
+ - `top`: the new offset top of the canvas
+ - `width`: the new width of the canvas
+ - `height`: the new height of the canvas
+
+Change the canvas (image wrapper) position and size with new data.
+
+### getCropBoxData()
+
+- (return value):
+ - Type: `Object`
+ - Properties:
+ - `left`: the offset left of the crop box
+ - `top`: the offset top of the crop box
+ - `width`: the width of the crop box
+ - `height`: the height of the crop box
+
+Output the crop box position and size data.
+
+### setCropBoxData(data)
+
+- **data**:
+ - Type: `Object`
+ - Properties:
+ - `left`: the new offset left of the crop box
+ - `top`: the new offset top of the crop box
+ - `width`: the new width of the crop box
+ - `height`: the new height of the crop box
+
+Change the crop box position and size with new data.
+
+### getCroppedCanvas([options])
+
+- **options** (optional):
+ - Type: `Object`
+ - Properties:
+ - `width`: the destination width of the output canvas.
+ - `height`: the destination height of the output canvas.
+ - `minWidth`: the minimum destination width of the output canvas, the default value is `0`.
+ - `minHeight`: the minimum destination height of the output canvas, the default value is `0`.
+ - `maxWidth`: the maximum destination width of the output canvas, the default value is `Infinity`.
+ - `maxHeight`: the maximum destination height of the output canvas, the default value is `Infinity`.
+ - `fillColor`: a color to fill any alpha values in the output canvas, the default value is `transparent`.
+ - [`imageSmoothingEnabled`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled): set to change if images are smoothed (`true`, default) or not (`false`).
+ - [`imageSmoothingQuality`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality): set the quality of image smoothing, one of "low" (default), "medium", or "high".
+
+- (return value):
+ - Type: `HTMLCanvasElement`
+ - A canvas drawn the cropped image.
+
+- Notes:
+ - The aspect ratio of the output canvas will be fitted to aspect ratio of the crop box automatically.
+ - If you intend to get a JPEG image from the output canvas, you should set the `fillColor` option first, if not, the transparent part in the JPEG image will become black by default.
+
+- Browser support:
+ - Basic image: requires [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) support ([IE 9+](http://caniuse.com/canvas)).
+ - Rotated image: requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](http://caniuse.com/transforms2d)).
+ - Cross-origin image: requires HTML5 [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) support ([IE 11+](http://caniuse.com/cors)).
+
+Get a canvas drawn the cropped image. If it is not cropped, then returns a canvas drawn the whole image.
+
+> After then, you can display the canvas as an image directly, or use [HTMLCanvasElement.toDataURL](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL) to get a Data URL, or use [HTMLCanvasElement.toBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob) to get a blob and upload it to server with [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) if the browser supports these APIs.
+
+Avoid to get a blank output image, you might need to set the `maxWidth` and `maxHeight` properties to limited numbers, because of [the size limits of a canvas element](https://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element).
+
+```js
+cropper.getCroppedCanvas();
+
+cropper.getCroppedCanvas({
+ width: 160,
+ height: 90,
+ minWidth: 256,
+ minHeight: 256,
+ maxWidth: 4096,
+ maxHeight: 4096,
+ fillColor: '#fff',
+ imageSmoothingEnabled: false,
+ imageSmoothingQuality: 'high',
+});
+
+// Upload cropped image to server if the browser supports `HTMLCanvasElement.toBlob`
+cropper.getCroppedCanvas().toBlob(function (blob) {
+ var formData = new FormData();
+
+ formData.append('croppedImage', blob);
+
+ // Use `jQuery.ajax` method
+ $.ajax('/path/to/upload', {
+ method: "POST",
+ data: formData,
+ processData: false,
+ contentType: false,
+ success: function () {
+ console.log('Upload success');
+ },
+ error: function () {
+ console.log('Upload error');
+ }
+ });
+});
+```
+
+### setAspectRatio(aspectRatio)
+
+- **aspectRatio**:
+ - Type: `Number`
+ - Requires a positive number.
+
+Change the aspect ratio of the crop box.
+
+### setDragMode([mode])
+
+- **mode** (optional):
+ - Type: `String`
+ - Default: `'none'`
+ - Options: `'none'`, `'crop'`, `'move'`
+
+Change the drag mode.
+
+**Tips:** You can toggle the "crop" and "move" mode by double click on the cropper.
+
+[⬆ back to top](#table-of-contents)
+
+## Events
+
+### ready
+
+This event fires when the target image has been loaded and the cropper instance is ready for cropping.
+
+```js
+var cropper;
+
+image.addEventListener('ready', function () {
+ console.log(this.cropper === cropper);
+ // -> true
+});
+
+cropper = new Cropper(image);
+```
+
+### cropstart
+
+- **event.detail.originalEvent**:
+ - Type: `Event`
+ - Options: `mousedown`, `touchstart` and `pointerdown`
+
+- **event.detail.action**:
+ - Type: `String`
+ - Options:
+ - `'crop'`: create a new crop box
+ - `'move'`: move the canvas (image wrapper)
+ - `'zoom'`: zoom in / out the canvas (image wrapper) by touch.
+ - `'e'`: resize the east side of the crop box
+ - `'w'`: resize the west side of the crop box
+ - `'s'`: resize the south side of the crop box
+ - `'n'`: resize the north side of the crop box
+ - `'se'`: resize the southeast side of the crop box
+ - `'sw'`: resize the southwest side of the crop box
+ - `'ne'`: resize the northeast side of the crop box
+ - `'nw'`: resize the northwest side of the crop box
+ - `'all'`: move the crop box (all directions)
+
+This event fires when the canvas (image wrapper) or the crop box starts to change.
+
+```js
+image.addEventListener('cropstart', function (e) {
+ console.log(e.detail.originalEvent);
+ console.log(e.detail.action);
+});
+```
+
+### cropmove
+
+- **event.detail.originalEvent**:
+ - Type: `Event`
+ - Options: `mousemove`, `touchmove` and `pointermove`.
+
+- **event.detail.action**: the same as "cropstart".
+
+This event fires when the canvas (image wrapper) or the crop box is changing.
+
+### cropend
+
+- **event.detail.originalEvent**:
+ - Type: `Event`
+ - Options: `mouseup`, `touchend`, `touchcancel`, `pointerup` and `pointercancel`.
+
+- **event.detail.action**: the same as "cropstart".
+
+This event fires when the canvas (image wrapper) or the crop box stops to change.
+
+### crop
+
+- **event.detail.x**
+- **event.detail.y**
+- **event.detail.width**
+- **event.detail.height**
+- **event.detail.rotate**
+- **event.detail.scaleX**
+- **event.detail.scaleY**
+
+> About these properties, see the [`getData`](#getdatarounded) method.
+
+This event fires when the canvas (image wrapper) or the crop box changed.
+
+### zoom
+
+- **event.detail.originalEvent**:
+ - Type: `Event`
+ - Options: `wheel`, `touchmove`.
+
+- **event.detail.oldRatio**:
+ - Type: `Number`
+ - The old (current) ratio of the canvas
+
+- **event.detail.ratio**:
+ - Type: `Number`
+ - The new (next) ratio of the canvas (`canvasData.width / canvasData.naturalWidth`)
+
+This event fires when a cropper instance starts to zoom in or zoom out its canvas (image wrapper).
+
+```js
+image.addEventListener('zoom', function (e) {
+
+ // Zoom in
+ if (e.detail.ratio > e.detail.oldRatio) {
+ e.preventDefault(); // Prevent zoom in
+ }
+
+ // Zoom out
+ // ...
+});
+```
+
+[⬆ back to top](#table-of-contents)
+
+## No conflict
+
+If you have to use other cropper with the same namespace, just call the `Cropper.noConflict` static method to revert to it.
+
+```html
+<script src="other-cropper.js"></script>
+<script src="cropper.js"></script>
+<script>
+ Cropper.noConflict();
+ // Code that uses other `Cropper` can follow here.
+</script>
+```
+
+## Browser support
+
+- Chrome (latest)
+- Firefox (latest)
+- Safari (latest)
+- Opera (latest)
+- Edge (latest)
+- Internet Explorer 9+
+
+## Contributing
+
+Please read through our [contributing guidelines](CONTRIBUTING.md).
+
+## Versioning
+
+Maintained under the [Semantic Versioning guidelines](http://semver.org/).
+
+## License
+
+[MIT](http://opensource.org/licenses/MIT) © [Chen Fengyuan](http://chenfengyuan.com)
+
+## Related projects
+
+- [angular-cropperjs](https://github.com/matheusdavidson/angular-cropperjs) by @matheusdavidson
+- [ember-cropperjs](https://github.com/danielthall/ember-cropperjs) by @danielthall
+- [iron-cropper](https://www.webcomponents.org/element/safetychanger/iron-cropper) (web component) by @safetychanger
+- [react-cropper](https://github.com/roadmanfong/react-cropper) by @roadmanfong
+- [vue-cropperjs](https://github.com/Agontuk/vue-cropperjs) by @Agontuk
+
+[⬆ back to top](#table-of-contents)
diff --git a/library/cropperjs/dist/cropper.common.js b/library/cropperjs/dist/cropper.common.js
new file mode 100644
index 000000000..38c62e824
--- /dev/null
+++ b/library/cropperjs/dist/cropper.common.js
@@ -0,0 +1,3760 @@
+/*!
+ * Cropper.js v1.2.2
+ * https://github.com/fengyuanchen/cropperjs
+ *
+ * Copyright (c) 2015-2018 Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2018-01-03T13:27:18.062Z
+ */
+
+'use strict';
+
+var WINDOW = typeof window !== 'undefined' ? window : {};
+var NAMESPACE = 'cropper';
+
+// Actions
+var ACTION_ALL = 'all';
+var ACTION_CROP = 'crop';
+var ACTION_MOVE = 'move';
+var ACTION_ZOOM = 'zoom';
+var ACTION_EAST = 'e';
+var ACTION_WEST = 'w';
+var ACTION_SOUTH = 's';
+var ACTION_NORTH = 'n';
+var ACTION_NORTH_EAST = 'ne';
+var ACTION_NORTH_WEST = 'nw';
+var ACTION_SOUTH_EAST = 'se';
+var ACTION_SOUTH_WEST = 'sw';
+
+// Classes
+var CLASS_CROP = NAMESPACE + '-crop';
+var CLASS_DISABLED = NAMESPACE + '-disabled';
+var CLASS_HIDDEN = NAMESPACE + '-hidden';
+var CLASS_HIDE = NAMESPACE + '-hide';
+var CLASS_INVISIBLE = NAMESPACE + '-invisible';
+var CLASS_MODAL = NAMESPACE + '-modal';
+var CLASS_MOVE = NAMESPACE + '-move';
+
+// Data keys
+var DATA_ACTION = 'action';
+var DATA_PREVIEW = 'preview';
+
+// Drag modes
+var DRAG_MODE_CROP = 'crop';
+var DRAG_MODE_MOVE = 'move';
+var DRAG_MODE_NONE = 'none';
+
+// Events
+var EVENT_CROP = 'crop';
+var EVENT_CROP_END = 'cropend';
+var EVENT_CROP_MOVE = 'cropmove';
+var EVENT_CROP_START = 'cropstart';
+var EVENT_DBLCLICK = 'dblclick';
+var EVENT_ERROR = 'error';
+var EVENT_LOAD = 'load';
+var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
+var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove';
+var EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup';
+var EVENT_READY = 'ready';
+var EVENT_RESIZE = 'resize';
+var EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll';
+var EVENT_ZOOM = 'zoom';
+
+// RegExps
+var REGEXP_ACTIONS = /^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/;
+var REGEXP_DATA_URL = /^data:/;
+var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
+var REGEXP_TAG_NAME = /^(img|canvas)$/i;
+
+var DEFAULTS = {
+ // Define the view mode of the cropper
+ viewMode: 0, // 0, 1, 2, 3
+
+ // Define the dragging mode of the cropper
+ dragMode: DRAG_MODE_CROP, // 'crop', 'move' or 'none'
+
+ // Define the aspect ratio of the crop box
+ aspectRatio: NaN,
+
+ // An object with the previous cropping result data
+ data: null,
+
+ // A selector for adding extra containers to preview
+ preview: '',
+
+ // Re-render the cropper when resize the window
+ responsive: true,
+
+ // Restore the cropped area after resize the window
+ restore: true,
+
+ // Check if the current image is a cross-origin image
+ checkCrossOrigin: true,
+
+ // Check the current image's Exif Orientation information
+ checkOrientation: true,
+
+ // Show the black modal
+ modal: true,
+
+ // Show the dashed lines for guiding
+ guides: true,
+
+ // Show the center indicator for guiding
+ center: true,
+
+ // Show the white modal to highlight the crop box
+ highlight: true,
+
+ // Show the grid background
+ background: true,
+
+ // Enable to crop the image automatically when initialize
+ autoCrop: true,
+
+ // Define the percentage of automatic cropping area when initializes
+ autoCropArea: 0.8,
+
+ // Enable to move the image
+ movable: true,
+
+ // Enable to rotate the image
+ rotatable: true,
+
+ // Enable to scale the image
+ scalable: true,
+
+ // Enable to zoom the image
+ zoomable: true,
+
+ // Enable to zoom the image by dragging touch
+ zoomOnTouch: true,
+
+ // Enable to zoom the image by wheeling mouse
+ zoomOnWheel: true,
+
+ // Define zoom ratio when zoom the image by wheeling mouse
+ wheelZoomRatio: 0.1,
+
+ // Enable to move the crop box
+ cropBoxMovable: true,
+
+ // Enable to resize the crop box
+ cropBoxResizable: true,
+
+ // Toggle drag mode between "crop" and "move" when click twice on the cropper
+ toggleDragModeOnDblclick: true,
+
+ // Size limitation
+ minCanvasWidth: 0,
+ minCanvasHeight: 0,
+ minCropBoxWidth: 0,
+ minCropBoxHeight: 0,
+ minContainerWidth: 200,
+ minContainerHeight: 100,
+
+ // Shortcuts of events
+ ready: null,
+ cropstart: null,
+ cropmove: null,
+ cropend: null,
+ crop: null,
+ zoom: null
+};
+
+var TEMPLATE = '<div class="cropper-container">' + '<div class="cropper-wrap-box">' + '<div class="cropper-canvas"></div>' + '</div>' + '<div class="cropper-drag-box"></div>' + '<div class="cropper-crop-box">' + '<span class="cropper-view-box"></span>' + '<span class="cropper-dashed dashed-h"></span>' + '<span class="cropper-dashed dashed-v"></span>' + '<span class="cropper-center"></span>' + '<span class="cropper-face"></span>' + '<span class="cropper-line line-e" data-action="e"></span>' + '<span class="cropper-line line-n" data-action="n"></span>' + '<span class="cropper-line line-w" data-action="w"></span>' + '<span class="cropper-line line-s" data-action="s"></span>' + '<span class="cropper-point point-e" data-action="e"></span>' + '<span class="cropper-point point-n" data-action="n"></span>' + '<span class="cropper-point point-w" data-action="w"></span>' + '<span class="cropper-point point-s" data-action="s"></span>' + '<span class="cropper-point point-ne" data-action="ne"></span>' + '<span class="cropper-point point-nw" data-action="nw"></span>' + '<span class="cropper-point point-sw" data-action="sw"></span>' + '<span class="cropper-point point-se" data-action="se"></span>' + '</div>' + '</div>';
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
+ return typeof obj;
+} : function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+};
+
+
+
+
+
+
+
+
+
+
+
+var classCallCheck = function (instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+};
+
+var createClass = function () {
+ function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+
+ return function (Constructor, protoProps, staticProps) {
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) defineProperties(Constructor, staticProps);
+ return Constructor;
+ };
+}();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var toConsumableArray = function (arr) {
+ if (Array.isArray(arr)) {
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
+
+ return arr2;
+ } else {
+ return Array.from(arr);
+ }
+};
+
+/**
+ * Check if the given value is not a number.
+ */
+var isNaN = Number.isNaN || WINDOW.isNaN;
+
+/**
+ * Check if the given value is a number.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a number, else `false`.
+ */
+function isNumber(value) {
+ return typeof value === 'number' && !isNaN(value);
+}
+
+/**
+ * Check if the given value is undefined.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is undefined, else `false`.
+ */
+function isUndefined(value) {
+ return typeof value === 'undefined';
+}
+
+/**
+ * Check if the given value is an object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is an object, else `false`.
+ */
+function isObject(value) {
+ return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null;
+}
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Check if the given value is a plain object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
+ */
+
+function isPlainObject(value) {
+ if (!isObject(value)) {
+ return false;
+ }
+
+ try {
+ var _constructor = value.constructor;
+ var prototype = _constructor.prototype;
+
+
+ return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
+ } catch (e) {
+ return false;
+ }
+}
+
+/**
+ * Check if the given value is a function.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a function, else `false`.
+ */
+function isFunction(value) {
+ return typeof value === 'function';
+}
+
+/**
+ * Iterate the given data.
+ * @param {*} data - The data to iterate.
+ * @param {Function} callback - The process function for each element.
+ * @returns {*} The original data.
+ */
+function each(data, callback) {
+ if (data && isFunction(callback)) {
+ if (Array.isArray(data) || isNumber(data.length) /* array-like */) {
+ var length = data.length;
+
+ var i = void 0;
+
+ for (i = 0; i < length; i += 1) {
+ if (callback.call(data, data[i], i, data) === false) {
+ break;
+ }
+ }
+ } else if (isObject(data)) {
+ Object.keys(data).forEach(function (key) {
+ callback.call(data, data[key], key, data);
+ });
+ }
+ }
+
+ return data;
+}
+
+/**
+ * Extend the given object.
+ * @param {*} obj - The object to be extended.
+ * @param {*} args - The rest objects which will be merged to the first object.
+ * @returns {Object} The extended object.
+ */
+function extend(obj) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ if (isObject(obj) && args.length > 0) {
+ if (Object.assign) {
+ return Object.assign.apply(Object, [obj].concat(args));
+ }
+
+ args.forEach(function (arg) {
+ if (isObject(arg)) {
+ Object.keys(arg).forEach(function (key) {
+ obj[key] = arg[key];
+ });
+ }
+ });
+ }
+
+ return obj;
+}
+
+/**
+ * Takes a function and returns a new one that will always have a particular context.
+ * @param {Function} fn - The target function.
+ * @param {Object} context - The new context for the function.
+ * @returns {boolean} The new function.
+ */
+function proxy(fn, context) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
+ args[_key2 - 2] = arguments[_key2];
+ }
+
+ return function () {
+ for (var _len3 = arguments.length, args2 = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
+ args2[_key3] = arguments[_key3];
+ }
+
+ return fn.apply(context, args.concat(args2));
+ };
+}
+
+var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/i;
+
+/**
+ * Normalize decimal number.
+ * Check out {@link http://0.30000000000000004.com/ }
+ * @param {number} value - The value to normalize.
+ * @param {number} [times=100000000000] - The times for normalizing.
+ * @returns {number} Returns the normalized number.
+ */
+function normalizeDecimalNumber(value) {
+ var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;
+
+ return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;
+}
+
+var REGEXP_SUFFIX = /^(width|height|left|top|marginLeft|marginTop)$/;
+
+/**
+ * Apply styles to the given element.
+ * @param {Element} element - The target element.
+ * @param {Object} styles - The styles for applying.
+ */
+function setStyle(element, styles) {
+ var style = element.style;
+
+
+ each(styles, function (value, property) {
+ if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
+ value += 'px';
+ }
+
+ style[property] = value;
+ });
+}
+
+/**
+ * Check if the given element has a special class.
+ * @param {Element} element - The element to check.
+ * @param {string} value - The class to search.
+ * @returns {boolean} Returns `true` if the special class was found.
+ */
+function hasClass(element, value) {
+ return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;
+}
+
+/**
+ * Add classes to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be added.
+ */
+function addClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ addClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.add(value);
+ return;
+ }
+
+ var className = element.className.trim();
+
+ if (!className) {
+ element.className = value;
+ } else if (className.indexOf(value) < 0) {
+ element.className = className + ' ' + value;
+ }
+}
+
+/**
+ * Remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be removed.
+ */
+function removeClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ removeClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.remove(value);
+ return;
+ }
+
+ if (element.className.indexOf(value) >= 0) {
+ element.className = element.className.replace(value, '');
+ }
+}
+
+/**
+ * Add or remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be toggled.
+ * @param {boolean} added - Add only.
+ */
+function toggleClass(element, value, added) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ toggleClass(elem, value, added);
+ });
+ return;
+ }
+
+ // IE10-11 doesn't support the second parameter of `classList.toggle`
+ if (added) {
+ addClass(element, value);
+ } else {
+ removeClass(element, value);
+ }
+}
+
+var REGEXP_HYPHENATE = /([a-z\d])([A-Z])/g;
+
+/**
+ * Hyphenate the given value.
+ * @param {string} value - The value to hyphenate.
+ * @returns {string} The hyphenated value.
+ */
+function hyphenate(value) {
+ return value.replace(REGEXP_HYPHENATE, '$1-$2').toLowerCase();
+}
+
+/**
+ * Get data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to get.
+ * @returns {string} The data value.
+ */
+function getData(element, name) {
+ if (isObject(element[name])) {
+ return element[name];
+ } else if (element.dataset) {
+ return element.dataset[name];
+ }
+
+ return element.getAttribute('data-' + hyphenate(name));
+}
+
+/**
+ * Set data to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to set.
+ * @param {string} data - The data value.
+ */
+function setData(element, name, data) {
+ if (isObject(data)) {
+ element[name] = data;
+ } else if (element.dataset) {
+ element.dataset[name] = data;
+ } else {
+ element.setAttribute('data-' + hyphenate(name), data);
+ }
+}
+
+/**
+ * Remove data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to remove.
+ */
+function removeData(element, name) {
+ if (isObject(element[name])) {
+ try {
+ delete element[name];
+ } catch (e) {
+ element[name] = null;
+ }
+ } else if (element.dataset) {
+ // #128 Safari not allows to delete dataset property
+ try {
+ delete element.dataset[name];
+ } catch (e) {
+ element.dataset[name] = null;
+ }
+ } else {
+ element.removeAttribute('data-' + hyphenate(name));
+ }
+}
+
+var REGEXP_SPACES = /\s+/;
+
+/**
+ * Remove event listener from the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+function removeListener(element, type, listener) {
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ if (!isFunction(listener)) {
+ return;
+ }
+
+ var types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, function (t) {
+ removeListener(element, t, listener, options);
+ });
+ return;
+ }
+
+ if (element.removeEventListener) {
+ element.removeEventListener(type, listener, options);
+ } else if (element.detachEvent) {
+ element.detachEvent('on' + type, listener);
+ }
+}
+
+/**
+ * Add event listener to the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+function addListener(element, type, _listener) {
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ if (!isFunction(_listener)) {
+ return;
+ }
+
+ var types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, function (t) {
+ addListener(element, t, _listener, options);
+ });
+ return;
+ }
+
+ if (options.once) {
+ var originalListener = _listener;
+
+ _listener = function listener() {
+ for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
+ args[_key4] = arguments[_key4];
+ }
+
+ removeListener(element, type, _listener, options);
+ return originalListener.apply(element, args);
+ };
+ }
+
+ if (element.addEventListener) {
+ element.addEventListener(type, _listener, options);
+ } else if (element.attachEvent) {
+ element.attachEvent('on' + type, _listener);
+ }
+}
+
+/**
+ * Dispatch event on the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Object} data - The additional event data.
+ * @returns {boolean} Indicate if the event is default prevented or not.
+ */
+function dispatchEvent(element, type, data) {
+ if (element.dispatchEvent) {
+ var event = void 0;
+
+ // Event and CustomEvent on IE9-11 are global objects, not constructors
+ if (isFunction(Event) && isFunction(CustomEvent)) {
+ if (isUndefined(data)) {
+ event = new Event(type, {
+ bubbles: true,
+ cancelable: true
+ });
+ } else {
+ event = new CustomEvent(type, {
+ detail: data,
+ bubbles: true,
+ cancelable: true
+ });
+ }
+ } else if (isUndefined(data)) {
+ event = document.createEvent('Event');
+ event.initEvent(type, true, true);
+ } else {
+ event = document.createEvent('CustomEvent');
+ event.initCustomEvent(type, true, true, data);
+ }
+
+ // IE9+
+ return element.dispatchEvent(event);
+ } else if (element.fireEvent) {
+ // IE6-10 (native events only)
+ return element.fireEvent('on' + type);
+ }
+
+ return true;
+}
+
+/**
+ * Get the offset base on the document.
+ * @param {Element} element - The target element.
+ * @returns {Object} The offset data.
+ */
+function getOffset(element) {
+ var doc = document.documentElement;
+ var box = element.getBoundingClientRect();
+
+ return {
+ left: box.left + ((window.scrollX || doc && doc.scrollLeft || 0) - (doc && doc.clientLeft || 0)),
+ top: box.top + ((window.scrollY || doc && doc.scrollTop || 0) - (doc && doc.clientTop || 0))
+ };
+}
+
+/**
+ * Empty an element.
+ * @param {Element} element - The element to empty.
+ */
+function empty(element) {
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+
+var location = WINDOW.location;
+
+var REGEXP_ORIGINS = /^(https?:)\/\/([^:/?#]+):?(\d*)/i;
+
+/**
+ * Check if the given URL is a cross origin URL.
+ * @param {string} url - The target URL.
+ * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.
+ */
+function isCrossOriginURL(url) {
+ var parts = url.match(REGEXP_ORIGINS);
+
+ return parts && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);
+}
+
+/**
+ * Add timestamp to the given URL.
+ * @param {string} url - The target URL.
+ * @returns {string} The result URL.
+ */
+function addTimestamp(url) {
+ var timestamp = 'timestamp=' + new Date().getTime();
+
+ return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp;
+}
+
+/**
+ * Get transforms base on the given object.
+ * @param {Object} obj - The target object.
+ * @returns {string} A string contains transform values.
+ */
+function getTransforms(_ref) {
+ var rotate = _ref.rotate,
+ scaleX = _ref.scaleX,
+ scaleY = _ref.scaleY,
+ translateX = _ref.translateX,
+ translateY = _ref.translateY;
+
+ var values = [];
+
+ if (isNumber(translateX) && translateX !== 0) {
+ values.push('translateX(' + translateX + 'px)');
+ }
+
+ if (isNumber(translateY) && translateY !== 0) {
+ values.push('translateY(' + translateY + 'px)');
+ }
+
+ // Rotate should come first before scale to match orientation transform
+ if (isNumber(rotate) && rotate !== 0) {
+ values.push('rotate(' + rotate + 'deg)');
+ }
+
+ if (isNumber(scaleX) && scaleX !== 1) {
+ values.push('scaleX(' + scaleX + ')');
+ }
+
+ if (isNumber(scaleY) && scaleY !== 1) {
+ values.push('scaleY(' + scaleY + ')');
+ }
+
+ var transform = values.length ? values.join(' ') : 'none';
+
+ return {
+ WebkitTransform: transform,
+ msTransform: transform,
+ transform: transform
+ };
+}
+
+var navigator = WINDOW.navigator;
+
+var IS_SAFARI_OR_UIWEBVIEW = navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);
+
+/**
+ * Get an image's natural sizes.
+ * @param {string} image - The target image.
+ * @param {Function} callback - The callback function.
+ */
+function getImageNaturalSizes(image, callback) {
+ // Modern browsers (except Safari)
+ if (image.naturalWidth && !IS_SAFARI_OR_UIWEBVIEW) {
+ callback(image.naturalWidth, image.naturalHeight);
+ return;
+ }
+
+ var newImage = document.createElement('img');
+ var body = document.body || document.documentElement;
+
+ newImage.onload = function () {
+ callback(newImage.width, newImage.height);
+
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ body.removeChild(newImage);
+ }
+ };
+
+ newImage.src = image.src;
+
+ // iOS Safari will convert the image automatically
+ // with its orientation once append it into DOM (#279)
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ newImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';
+ body.appendChild(newImage);
+ }
+}
+
+/**
+ * Get the max ratio of a group of pointers.
+ * @param {string} pointers - The target pointers.
+ * @returns {number} The result ratio.
+ */
+function getMaxZoomRatio(pointers) {
+ var pointers2 = extend({}, pointers);
+ var ratios = [];
+
+ each(pointers, function (pointer, pointerId) {
+ delete pointers2[pointerId];
+
+ each(pointers2, function (pointer2) {
+ var x1 = Math.abs(pointer.startX - pointer2.startX);
+ var y1 = Math.abs(pointer.startY - pointer2.startY);
+ var x2 = Math.abs(pointer.endX - pointer2.endX);
+ var y2 = Math.abs(pointer.endY - pointer2.endY);
+ var z1 = Math.sqrt(x1 * x1 + y1 * y1);
+ var z2 = Math.sqrt(x2 * x2 + y2 * y2);
+ var ratio = (z2 - z1) / z1;
+
+ ratios.push(ratio);
+ });
+ });
+
+ ratios.sort(function (a, b) {
+ return Math.abs(a) < Math.abs(b);
+ });
+
+ return ratios[0];
+}
+
+/**
+ * Get a pointer from an event object.
+ * @param {Object} event - The target event object.
+ * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
+ * @returns {Object} The result pointer contains start and/or end point coordinates.
+ */
+function getPointer(_ref2, endOnly) {
+ var pageX = _ref2.pageX,
+ pageY = _ref2.pageY;
+
+ var end = {
+ endX: pageX,
+ endY: pageY
+ };
+
+ if (endOnly) {
+ return end;
+ }
+
+ return extend({
+ startX: pageX,
+ startY: pageY
+ }, end);
+}
+
+/**
+ * Get the center point coordinate of a group of pointers.
+ * @param {Object} pointers - The target pointers.
+ * @returns {Object} The center point coordinate.
+ */
+function getPointersCenter(pointers) {
+ var pageX = 0;
+ var pageY = 0;
+ var count = 0;
+
+ each(pointers, function (_ref3) {
+ var startX = _ref3.startX,
+ startY = _ref3.startY;
+
+ pageX += startX;
+ pageY += startY;
+ count += 1;
+ });
+
+ pageX /= count;
+ pageY /= count;
+
+ return {
+ pageX: pageX,
+ pageY: pageY
+ };
+}
+
+/**
+ * Check if the given value is a finite number.
+ */
+var isFinite = Number.isFinite || WINDOW.isFinite;
+
+/**
+ * Get the max sizes in a rectangle under the given aspect ratio.
+ * @param {Object} data - The original sizes.
+ * @returns {Object} The result sizes.
+ */
+function getContainSizes(_ref4) {
+ var aspectRatio = _ref4.aspectRatio,
+ height = _ref4.height,
+ width = _ref4.width;
+
+ var isValidNumber = function isValidNumber(value) {
+ return isFinite(value) && value > 0;
+ };
+
+ if (isValidNumber(width) && isValidNumber(height)) {
+ if (height * aspectRatio > width) {
+ height = width / aspectRatio;
+ } else {
+ width = height * aspectRatio;
+ }
+ } else if (isValidNumber(width)) {
+ height = width / aspectRatio;
+ } else if (isValidNumber(height)) {
+ width = height * aspectRatio;
+ }
+
+ return {
+ width: width,
+ height: height
+ };
+}
+
+/**
+ * Get the new sizes of a rectangle after rotated.
+ * @param {Object} data - The original sizes.
+ * @returns {Object} The result sizes.
+ */
+function getRotatedSizes(_ref5) {
+ var width = _ref5.width,
+ height = _ref5.height,
+ degree = _ref5.degree;
+
+ degree = Math.abs(degree) % 180;
+
+ if (degree === 90) {
+ return {
+ width: height,
+ height: width
+ };
+ }
+
+ var arc = degree % 90 * Math.PI / 180;
+ var sinArc = Math.sin(arc);
+ var cosArc = Math.cos(arc);
+ var newWidth = width * cosArc + height * sinArc;
+ var newHeight = width * sinArc + height * cosArc;
+
+ return degree > 90 ? {
+ width: newHeight,
+ height: newWidth
+ } : {
+ width: newWidth,
+ height: newHeight
+ };
+}
+
+/**
+ * Get a canvas which drew the given image.
+ * @param {HTMLImageElement} image - The image for drawing.
+ * @param {Object} imageData - The image data.
+ * @param {Object} canvasData - The canvas data.
+ * @param {Object} options - The options.
+ * @returns {HTMLCanvasElement} The result canvas.
+ */
+function getSourceCanvas(image, _ref6, _ref7, _ref8) {
+ var imageNaturalWidth = _ref6.naturalWidth,
+ imageNaturalHeight = _ref6.naturalHeight,
+ _ref6$rotate = _ref6.rotate,
+ rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
+ _ref6$scaleX = _ref6.scaleX,
+ scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
+ _ref6$scaleY = _ref6.scaleY,
+ scaleY = _ref6$scaleY === undefined ? 1 : _ref6$scaleY;
+ var aspectRatio = _ref7.aspectRatio,
+ naturalWidth = _ref7.naturalWidth,
+ naturalHeight = _ref7.naturalHeight;
+ var _ref8$fillColor = _ref8.fillColor,
+ fillColor = _ref8$fillColor === undefined ? 'transparent' : _ref8$fillColor,
+ _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled,
+ imageSmoothingEnabled = _ref8$imageSmoothingE === undefined ? true : _ref8$imageSmoothingE,
+ _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality,
+ imageSmoothingQuality = _ref8$imageSmoothingQ === undefined ? 'low' : _ref8$imageSmoothingQ,
+ _ref8$maxWidth = _ref8.maxWidth,
+ maxWidth = _ref8$maxWidth === undefined ? Infinity : _ref8$maxWidth,
+ _ref8$maxHeight = _ref8.maxHeight,
+ maxHeight = _ref8$maxHeight === undefined ? Infinity : _ref8$maxHeight,
+ _ref8$minWidth = _ref8.minWidth,
+ minWidth = _ref8$minWidth === undefined ? 0 : _ref8$minWidth,
+ _ref8$minHeight = _ref8.minHeight,
+ minHeight = _ref8$minHeight === undefined ? 0 : _ref8$minHeight;
+
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+ var maxSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: maxWidth,
+ height: maxHeight
+ });
+ var minSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: minWidth,
+ height: minHeight
+ });
+ var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
+ var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
+ var params = [-imageNaturalWidth / 2, -imageNaturalHeight / 2, imageNaturalWidth, imageNaturalHeight];
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+ context.fillStyle = fillColor;
+ context.fillRect(0, 0, width, height);
+ context.save();
+ context.translate(width / 2, height / 2);
+ context.rotate(rotate * Math.PI / 180);
+ context.scale(scaleX, scaleY);
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ context.drawImage.apply(context, [image].concat(toConsumableArray(params.map(function (param) {
+ return Math.floor(normalizeDecimalNumber(param));
+ }))));
+ context.restore();
+ return canvas;
+}
+
+var fromCharCode = String.fromCharCode;
+
+/**
+ * Get string from char code in data view.
+ * @param {DataView} dataView - The data view for read.
+ * @param {number} start - The start index.
+ * @param {number} length - The read length.
+ * @returns {string} The read result.
+ */
+
+function getStringFromCharCode(dataView, start, length) {
+ var str = '';
+ var i = void 0;
+
+ length += start;
+
+ for (i = start; i < length; i += 1) {
+ str += fromCharCode(dataView.getUint8(i));
+ }
+
+ return str;
+}
+
+var REGEXP_DATA_URL_HEAD = /^data:.*,/;
+
+/**
+ * Transform Data URL to array buffer.
+ * @param {string} dataURL - The Data URL to transform.
+ * @returns {ArrayBuffer} The result array buffer.
+ */
+function dataURLToArrayBuffer(dataURL) {
+ var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');
+ var binary = atob(base64);
+ var arrayBuffer = new ArrayBuffer(binary.length);
+ var uint8 = new Uint8Array(arrayBuffer);
+
+ each(uint8, function (value, i) {
+ uint8[i] = binary.charCodeAt(i);
+ });
+
+ return arrayBuffer;
+}
+
+/**
+ * Transform array buffer to Data URL.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.
+ * @param {string} mimeType - The mime type of the Data URL.
+ * @returns {string} The result Data URL.
+ */
+function arrayBufferToDataURL(arrayBuffer, mimeType) {
+ var uint8 = new Uint8Array(arrayBuffer);
+ var data = '';
+
+ // TypedArray.prototype.forEach is not supported in some browsers.
+ each(uint8, function (value) {
+ data += fromCharCode(value);
+ });
+
+ return 'data:' + mimeType + ';base64,' + btoa(data);
+}
+
+/**
+ * Get orientation value from given array buffer.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to read.
+ * @returns {number} The read orientation value.
+ */
+function getOrientation(arrayBuffer) {
+ var dataView = new DataView(arrayBuffer);
+ var orientation = void 0;
+ var littleEndian = void 0;
+ var app1Start = void 0;
+ var ifdStart = void 0;
+
+ // Only handle JPEG image (start by 0xFFD8)
+ if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
+ var length = dataView.byteLength;
+ var offset = 2;
+
+ while (offset < length) {
+ if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
+ app1Start = offset;
+ break;
+ }
+
+ offset += 1;
+ }
+ }
+
+ if (app1Start) {
+ var exifIDCode = app1Start + 4;
+ var tiffOffset = app1Start + 10;
+
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
+ var endianness = dataView.getUint16(tiffOffset);
+
+ littleEndian = endianness === 0x4949;
+
+ if (littleEndian || endianness === 0x4D4D /* bigEndian */) {
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
+ var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
+
+ if (firstIFDOffset >= 0x00000008) {
+ ifdStart = tiffOffset + firstIFDOffset;
+ }
+ }
+ }
+ }
+ }
+
+ if (ifdStart) {
+ var _length = dataView.getUint16(ifdStart, littleEndian);
+ var _offset = void 0;
+ var i = void 0;
+
+ for (i = 0; i < _length; i += 1) {
+ _offset = ifdStart + i * 12 + 2;
+
+ if (dataView.getUint16(_offset, littleEndian) === 0x0112 /* Orientation */) {
+ // 8 is the offset of the current tag's value
+ _offset += 8;
+
+ // Get the original orientation value
+ orientation = dataView.getUint16(_offset, littleEndian);
+
+ // Override the orientation with its default value
+ dataView.setUint16(_offset, 1, littleEndian);
+ break;
+ }
+ }
+ }
+
+ return orientation;
+}
+
+/**
+ * Parse Exif Orientation value.
+ * @param {number} orientation - The orientation to parse.
+ * @returns {Object} The parsed result.
+ */
+function parseOrientation(orientation) {
+ var rotate = 0;
+ var scaleX = 1;
+ var scaleY = 1;
+
+ switch (orientation) {
+ // Flip horizontal
+ case 2:
+ scaleX = -1;
+ break;
+
+ // Rotate left 180°
+ case 3:
+ rotate = -180;
+ break;
+
+ // Flip vertical
+ case 4:
+ scaleY = -1;
+ break;
+
+ // Flip vertical and rotate right 90°
+ case 5:
+ rotate = 90;
+ scaleY = -1;
+ break;
+
+ // Rotate right 90°
+ case 6:
+ rotate = 90;
+ break;
+
+ // Flip horizontal and rotate right 90°
+ case 7:
+ rotate = 90;
+ scaleX = -1;
+ break;
+
+ // Rotate left 90°
+ case 8:
+ rotate = -90;
+ break;
+
+ default:
+ }
+
+ return {
+ rotate: rotate,
+ scaleX: scaleX,
+ scaleY: scaleY
+ };
+}
+
+var render = {
+ render: function render() {
+ this.initContainer();
+ this.initCanvas();
+ this.initCropBox();
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ },
+ initContainer: function initContainer() {
+ var element = this.element,
+ options = this.options,
+ container = this.container,
+ cropper = this.cropper;
+
+
+ addClass(cropper, CLASS_HIDDEN);
+ removeClass(element, CLASS_HIDDEN);
+
+ var containerData = {
+ width: Math.max(container.offsetWidth, Number(options.minContainerWidth) || 200),
+ height: Math.max(container.offsetHeight, Number(options.minContainerHeight) || 100)
+ };
+
+ this.containerData = containerData;
+
+ setStyle(cropper, {
+ width: containerData.width,
+ height: containerData.height
+ });
+
+ addClass(element, CLASS_HIDDEN);
+ removeClass(cropper, CLASS_HIDDEN);
+ },
+
+
+ // Canvas (image wrapper)
+ initCanvas: function initCanvas() {
+ var containerData = this.containerData,
+ imageData = this.imageData;
+ var viewMode = this.options.viewMode;
+
+ var rotated = Math.abs(imageData.rotate) % 180 === 90;
+ var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;
+ var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;
+ var aspectRatio = naturalWidth / naturalHeight;
+ var canvasWidth = containerData.width;
+ var canvasHeight = containerData.height;
+
+ if (containerData.height * aspectRatio > containerData.width) {
+ if (viewMode === 3) {
+ canvasWidth = containerData.height * aspectRatio;
+ } else {
+ canvasHeight = containerData.width / aspectRatio;
+ }
+ } else if (viewMode === 3) {
+ canvasHeight = containerData.width / aspectRatio;
+ } else {
+ canvasWidth = containerData.height * aspectRatio;
+ }
+
+ var canvasData = {
+ aspectRatio: aspectRatio,
+ naturalWidth: naturalWidth,
+ naturalHeight: naturalHeight,
+ width: canvasWidth,
+ height: canvasHeight
+ };
+
+ canvasData.left = (containerData.width - canvasWidth) / 2;
+ canvasData.top = (containerData.height - canvasHeight) / 2;
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ this.canvasData = canvasData;
+ this.limited = viewMode === 1 || viewMode === 2;
+ this.limitCanvas(true, true);
+ this.initialImageData = extend({}, imageData);
+ this.initialCanvasData = extend({}, canvasData);
+ },
+ limitCanvas: function limitCanvas(sizeLimited, positionLimited) {
+ var options = this.options,
+ containerData = this.containerData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+ var viewMode = options.viewMode;
+ var aspectRatio = canvasData.aspectRatio;
+
+ var cropped = this.cropped && cropBoxData;
+
+ if (sizeLimited) {
+ var minCanvasWidth = Number(options.minCanvasWidth) || 0;
+ var minCanvasHeight = Number(options.minCanvasHeight) || 0;
+
+ if (viewMode > 1) {
+ minCanvasWidth = Math.max(minCanvasWidth, containerData.width);
+ minCanvasHeight = Math.max(minCanvasHeight, containerData.height);
+
+ if (viewMode === 3) {
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ } else if (viewMode > 0) {
+ if (minCanvasWidth) {
+ minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);
+ } else if (minCanvasHeight) {
+ minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);
+ } else if (cropped) {
+ minCanvasWidth = cropBoxData.width;
+ minCanvasHeight = cropBoxData.height;
+
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ }
+
+ var _getContainSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: minCanvasWidth,
+ height: minCanvasHeight
+ });
+
+ minCanvasWidth = _getContainSizes.width;
+ minCanvasHeight = _getContainSizes.height;
+
+
+ canvasData.minWidth = minCanvasWidth;
+ canvasData.minHeight = minCanvasHeight;
+ canvasData.maxWidth = Infinity;
+ canvasData.maxHeight = Infinity;
+ }
+
+ if (positionLimited) {
+ if (viewMode) {
+ var newCanvasLeft = containerData.width - canvasData.width;
+ var newCanvasTop = containerData.height - canvasData.height;
+
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+
+ if (cropped && this.limited) {
+ canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));
+ canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));
+ canvasData.maxLeft = cropBoxData.left;
+ canvasData.maxTop = cropBoxData.top;
+
+ if (viewMode === 2) {
+ if (canvasData.width >= containerData.width) {
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ }
+
+ if (canvasData.height >= containerData.height) {
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+ }
+ }
+ }
+ } else {
+ canvasData.minLeft = -canvasData.width;
+ canvasData.minTop = -canvasData.height;
+ canvasData.maxLeft = containerData.width;
+ canvasData.maxTop = containerData.height;
+ }
+ }
+ },
+ renderCanvas: function renderCanvas(changed, transformed) {
+ var canvasData = this.canvasData,
+ imageData = this.imageData;
+
+
+ if (transformed) {
+ var _getRotatedSizes = getRotatedSizes({
+ width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
+ height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
+ degree: imageData.rotate || 0
+ }),
+ naturalWidth = _getRotatedSizes.width,
+ naturalHeight = _getRotatedSizes.height;
+
+ var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);
+ var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);
+
+ canvasData.left -= (width - canvasData.width) / 2;
+ canvasData.top -= (height - canvasData.height) / 2;
+ canvasData.width = width;
+ canvasData.height = height;
+ canvasData.aspectRatio = naturalWidth / naturalHeight;
+ canvasData.naturalWidth = naturalWidth;
+ canvasData.naturalHeight = naturalHeight;
+ this.limitCanvas(true, false);
+ }
+
+ if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {
+ canvasData.left = canvasData.oldLeft;
+ }
+
+ if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {
+ canvasData.top = canvasData.oldTop;
+ }
+
+ canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);
+ canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);
+
+ this.limitCanvas(false, true);
+
+ canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);
+ canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ setStyle(this.canvas, extend({
+ width: canvasData.width,
+ height: canvasData.height
+ }, getTransforms({
+ translateX: canvasData.left,
+ translateY: canvasData.top
+ })));
+
+ this.renderImage(changed);
+
+ if (this.cropped && this.limited) {
+ this.limitCropBox(true, true);
+ }
+ },
+ renderImage: function renderImage(changed) {
+ var canvasData = this.canvasData,
+ imageData = this.imageData;
+
+ var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);
+ var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);
+
+ extend(imageData, {
+ width: width,
+ height: height,
+ left: (canvasData.width - width) / 2,
+ top: (canvasData.height - height) / 2
+ });
+ setStyle(this.image, extend({
+ width: imageData.width,
+ height: imageData.height
+ }, getTransforms(extend({
+ translateX: imageData.left,
+ translateY: imageData.top
+ }, imageData))));
+
+ if (changed) {
+ this.output();
+ }
+ },
+ initCropBox: function initCropBox() {
+ var options = this.options,
+ canvasData = this.canvasData;
+ var aspectRatio = options.aspectRatio;
+
+ var autoCropArea = Number(options.autoCropArea) || 0.8;
+ var cropBoxData = {
+ width: canvasData.width,
+ height: canvasData.height
+ };
+
+ if (aspectRatio) {
+ if (canvasData.height * aspectRatio > canvasData.width) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.cropBoxData = cropBoxData;
+ this.limitCropBox(true, true);
+
+ // Initialize auto crop area
+ cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
+ cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
+
+ // The width/height of auto crop area must large than "minWidth/Height"
+ cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);
+ cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);
+ cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;
+ cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ this.initialCropBoxData = extend({}, cropBoxData);
+ },
+ limitCropBox: function limitCropBox(sizeLimited, positionLimited) {
+ var options = this.options,
+ containerData = this.containerData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData,
+ limited = this.limited;
+ var aspectRatio = options.aspectRatio;
+
+
+ if (sizeLimited) {
+ var minCropBoxWidth = Number(options.minCropBoxWidth) || 0;
+ var minCropBoxHeight = Number(options.minCropBoxHeight) || 0;
+ var maxCropBoxWidth = Math.min(containerData.width, limited ? canvasData.width : containerData.width);
+ var maxCropBoxHeight = Math.min(containerData.height, limited ? canvasData.height : containerData.height);
+
+ // The min/maxCropBoxWidth/Height must be less than container's width/height
+ minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);
+ minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);
+
+ if (aspectRatio) {
+ if (minCropBoxWidth && minCropBoxHeight) {
+ if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+ } else if (minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else if (minCropBoxHeight) {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+
+ if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {
+ maxCropBoxHeight = maxCropBoxWidth / aspectRatio;
+ } else {
+ maxCropBoxWidth = maxCropBoxHeight * aspectRatio;
+ }
+ }
+
+ // The minWidth/Height must be less than maxWidth/Height
+ cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);
+ cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);
+ cropBoxData.maxWidth = maxCropBoxWidth;
+ cropBoxData.maxHeight = maxCropBoxHeight;
+ }
+
+ if (positionLimited) {
+ if (limited) {
+ cropBoxData.minLeft = Math.max(0, canvasData.left);
+ cropBoxData.minTop = Math.max(0, canvasData.top);
+ cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;
+ cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;
+ } else {
+ cropBoxData.minLeft = 0;
+ cropBoxData.minTop = 0;
+ cropBoxData.maxLeft = containerData.width - cropBoxData.width;
+ cropBoxData.maxTop = containerData.height - cropBoxData.height;
+ }
+ }
+ },
+ renderCropBox: function renderCropBox() {
+ var options = this.options,
+ containerData = this.containerData,
+ cropBoxData = this.cropBoxData;
+
+
+ if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {
+ cropBoxData.left = cropBoxData.oldLeft;
+ }
+
+ if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {
+ cropBoxData.top = cropBoxData.oldTop;
+ }
+
+ cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
+ cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
+
+ this.limitCropBox(false, true);
+
+ cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);
+ cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ if (options.movable && options.cropBoxMovable) {
+ // Turn to move the canvas when the crop box is equal to the container
+ setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);
+ }
+
+ setStyle(this.cropBox, extend({
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ }, getTransforms({
+ translateX: cropBoxData.left,
+ translateY: cropBoxData.top
+ })));
+
+ if (this.cropped && this.limited) {
+ this.limitCanvas(true, true);
+ }
+
+ if (!this.disabled) {
+ this.output();
+ }
+ },
+ output: function output() {
+ this.preview();
+
+ if (this.complete) {
+ dispatchEvent(this.element, EVENT_CROP, this.getData());
+ }
+ }
+};
+
+var preview = {
+ initPreview: function initPreview() {
+ var crossOrigin = this.crossOrigin;
+ var preview = this.options.preview;
+
+ var url = crossOrigin ? this.crossOriginUrl : this.url;
+ var image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = url;
+ this.viewBox.appendChild(image);
+ this.image2 = image;
+
+ if (!preview) {
+ return;
+ }
+
+ var previews = preview.querySelector ? [preview] : document.querySelectorAll(preview);
+
+ this.previews = previews;
+
+ each(previews, function (element) {
+ var img = document.createElement('img');
+
+ // Save the original size for recover
+ setData(element, DATA_PREVIEW, {
+ width: element.offsetWidth,
+ height: element.offsetHeight,
+ html: element.innerHTML
+ });
+
+ if (crossOrigin) {
+ img.crossOrigin = crossOrigin;
+ }
+
+ img.src = url;
+
+ /**
+ * Override img element styles
+ * Add `display:block` to avoid margin top issue
+ * Add `height:auto` to override `height` attribute on IE8
+ * (Occur only when margin-top <= -height)
+ */
+ img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"';
+
+ empty(element);
+ element.appendChild(img);
+ });
+ },
+ resetPreview: function resetPreview() {
+ each(this.previews, function (element) {
+ var data = getData(element, DATA_PREVIEW);
+
+ setStyle(element, {
+ width: data.width,
+ height: data.height
+ });
+
+ element.innerHTML = data.html;
+ removeData(element, DATA_PREVIEW);
+ });
+ },
+ preview: function preview() {
+ var imageData = this.imageData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+ var cropBoxWidth = cropBoxData.width,
+ cropBoxHeight = cropBoxData.height;
+ var width = imageData.width,
+ height = imageData.height;
+
+ var left = cropBoxData.left - canvasData.left - imageData.left;
+ var top = cropBoxData.top - canvasData.top - imageData.top;
+
+ if (!this.cropped || this.disabled) {
+ return;
+ }
+
+ setStyle(this.image2, extend({
+ width: width,
+ height: height
+ }, getTransforms(extend({
+ translateX: -left,
+ translateY: -top
+ }, imageData))));
+
+ each(this.previews, function (element) {
+ var data = getData(element, DATA_PREVIEW);
+ var originalWidth = data.width;
+ var originalHeight = data.height;
+ var newWidth = originalWidth;
+ var newHeight = originalHeight;
+ var ratio = 1;
+
+ if (cropBoxWidth) {
+ ratio = originalWidth / cropBoxWidth;
+ newHeight = cropBoxHeight * ratio;
+ }
+
+ if (cropBoxHeight && newHeight > originalHeight) {
+ ratio = originalHeight / cropBoxHeight;
+ newWidth = cropBoxWidth * ratio;
+ newHeight = originalHeight;
+ }
+
+ setStyle(element, {
+ width: newWidth,
+ height: newHeight
+ });
+
+ setStyle(element.getElementsByTagName('img')[0], extend({
+ width: width * ratio,
+ height: height * ratio
+ }, getTransforms(extend({
+ translateX: -left * ratio,
+ translateY: -top * ratio
+ }, imageData))));
+ });
+ }
+};
+
+var events = {
+ bind: function bind() {
+ var element = this.element,
+ options = this.options,
+ cropper = this.cropper;
+
+
+ if (isFunction(options.cropstart)) {
+ addListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ addListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ addListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ addListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ addListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = proxy(this.cropStart, this));
+
+ if (options.zoomable && options.zoomOnWheel) {
+ addListener(cropper, EVENT_WHEEL, this.onWheel = proxy(this.wheel, this));
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ addListener(cropper, EVENT_DBLCLICK, this.onDblclick = proxy(this.dblclick, this));
+ }
+
+ addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = proxy(this.cropMove, this));
+ addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = proxy(this.cropEnd, this));
+
+ if (options.responsive) {
+ addListener(window, EVENT_RESIZE, this.onResize = proxy(this.resize, this));
+ }
+ },
+ unbind: function unbind() {
+ var element = this.element,
+ options = this.options,
+ cropper = this.cropper;
+
+
+ if (isFunction(options.cropstart)) {
+ removeListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ removeListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ removeListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ removeListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ removeListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);
+
+ if (options.zoomable && options.zoomOnWheel) {
+ removeListener(cropper, EVENT_WHEEL, this.onWheel);
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);
+ }
+
+ removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);
+ removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);
+
+ if (options.responsive) {
+ removeListener(window, EVENT_RESIZE, this.onResize);
+ }
+ }
+};
+
+var handlers = {
+ resize: function resize() {
+ var options = this.options,
+ container = this.container,
+ containerData = this.containerData;
+
+ var minContainerWidth = Number(options.minContainerWidth) || 200;
+ var minContainerHeight = Number(options.minContainerHeight) || 100;
+
+ if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) {
+ return;
+ }
+
+ var ratio = container.offsetWidth / containerData.width;
+
+ // Resize when width changed or height changed
+ if (ratio !== 1 || container.offsetHeight !== containerData.height) {
+ var canvasData = void 0;
+ var cropBoxData = void 0;
+
+ if (options.restore) {
+ canvasData = this.getCanvasData();
+ cropBoxData = this.getCropBoxData();
+ }
+
+ this.render();
+
+ if (options.restore) {
+ this.setCanvasData(each(canvasData, function (n, i) {
+ canvasData[i] = n * ratio;
+ }));
+ this.setCropBoxData(each(cropBoxData, function (n, i) {
+ cropBoxData[i] = n * ratio;
+ }));
+ }
+ }
+ },
+ dblclick: function dblclick() {
+ if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {
+ return;
+ }
+
+ this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);
+ },
+ wheel: function wheel(e) {
+ var _this = this;
+
+ var ratio = Number(this.options.wheelZoomRatio) || 0.1;
+ var delta = 1;
+
+ if (this.disabled) {
+ return;
+ }
+
+ e.preventDefault();
+
+ // Limit wheel speed to prevent zoom too fast (#21)
+ if (this.wheeling) {
+ return;
+ }
+
+ this.wheeling = true;
+
+ setTimeout(function () {
+ _this.wheeling = false;
+ }, 50);
+
+ if (e.deltaY) {
+ delta = e.deltaY > 0 ? 1 : -1;
+ } else if (e.wheelDelta) {
+ delta = -e.wheelDelta / 120;
+ } else if (e.detail) {
+ delta = e.detail > 0 ? 1 : -1;
+ }
+
+ this.zoom(-delta * ratio, e);
+ },
+ cropStart: function cropStart(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ var options = this.options,
+ pointers = this.pointers;
+
+ var action = void 0;
+
+ if (e.changedTouches) {
+ // Handle touch event
+ each(e.changedTouches, function (touch) {
+ pointers[touch.identifier] = getPointer(touch);
+ });
+ } else {
+ // Handle mouse event and pointer event
+ pointers[e.pointerId || 0] = getPointer(e);
+ }
+
+ if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
+ action = ACTION_ZOOM;
+ } else {
+ action = getData(e.target, DATA_ACTION);
+ }
+
+ if (!REGEXP_ACTIONS.test(action)) {
+ return;
+ }
+
+ if (dispatchEvent(this.element, EVENT_CROP_START, {
+ originalEvent: e,
+ action: action
+ }) === false) {
+ return;
+ }
+
+ e.preventDefault();
+
+ this.action = action;
+ this.cropping = false;
+
+ if (action === ACTION_CROP) {
+ this.cropping = true;
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+ },
+ cropMove: function cropMove(e) {
+ var action = this.action;
+
+
+ if (this.disabled || !action) {
+ return;
+ }
+
+ var pointers = this.pointers;
+
+
+ e.preventDefault();
+
+ if (dispatchEvent(this.element, EVENT_CROP_MOVE, {
+ originalEvent: e,
+ action: action
+ }) === false) {
+ return;
+ }
+
+ if (e.changedTouches) {
+ each(e.changedTouches, function (touch) {
+ extend(pointers[touch.identifier], getPointer(touch, true));
+ });
+ } else {
+ extend(pointers[e.pointerId || 0], getPointer(e, true));
+ }
+
+ this.change(e);
+ },
+ cropEnd: function cropEnd(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ var action = this.action,
+ pointers = this.pointers;
+
+
+ if (e.changedTouches) {
+ each(e.changedTouches, function (touch) {
+ delete pointers[touch.identifier];
+ });
+ } else {
+ delete pointers[e.pointerId || 0];
+ }
+
+ if (!action) {
+ return;
+ }
+
+ e.preventDefault();
+
+ if (!Object.keys(pointers).length) {
+ this.action = '';
+ }
+
+ if (this.cropping) {
+ this.cropping = false;
+ toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);
+ }
+
+ dispatchEvent(this.element, EVENT_CROP_END, {
+ originalEvent: e,
+ action: action
+ });
+ }
+};
+
+var change = {
+ change: function change(e) {
+ var options = this.options,
+ canvasData = this.canvasData,
+ containerData = this.containerData,
+ cropBoxData = this.cropBoxData,
+ pointers = this.pointers;
+ var action = this.action;
+ var aspectRatio = options.aspectRatio;
+ var left = cropBoxData.left,
+ top = cropBoxData.top,
+ width = cropBoxData.width,
+ height = cropBoxData.height;
+
+ var right = left + width;
+ var bottom = top + height;
+ var minLeft = 0;
+ var minTop = 0;
+ var maxWidth = containerData.width;
+ var maxHeight = containerData.height;
+ var renderable = true;
+ var offset = void 0;
+
+ // Locking aspect ratio in "free mode" by holding shift key
+ if (!aspectRatio && e.shiftKey) {
+ aspectRatio = width && height ? width / height : 1;
+ }
+
+ if (this.limited) {
+ minLeft = cropBoxData.minLeft;
+ minTop = cropBoxData.minTop;
+
+ maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);
+ maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);
+ }
+
+ var pointer = pointers[Object.keys(pointers)[0]];
+ var range = {
+ x: pointer.endX - pointer.startX,
+ y: pointer.endY - pointer.startY
+ };
+ var check = function check(side) {
+ switch (side) {
+ case ACTION_EAST:
+ if (right + range.x > maxWidth) {
+ range.x = maxWidth - right;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (left + range.x < minLeft) {
+ range.x = minLeft - left;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (top + range.y < minTop) {
+ range.y = minTop - top;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (bottom + range.y > maxHeight) {
+ range.y = maxHeight - bottom;
+ }
+
+ break;
+
+ default:
+ }
+ };
+
+ switch (action) {
+ // Move crop box
+ case ACTION_ALL:
+ left += range.x;
+ top += range.y;
+ break;
+
+ // Resize crop box
+ case ACTION_EAST:
+ if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top -= range.x / aspectRatio / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_WEST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left += range.y * aspectRatio / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_SOUTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top += range.x / aspectRatio / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_EAST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_SOUTH);
+ height += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left -= range.y * aspectRatio / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_NORTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_EAST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_WEST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || left <= minLeft)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ left += range.y * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_WEST:
+ if (aspectRatio) {
+ if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_EAST:
+ if (aspectRatio) {
+ if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ // Move canvas
+ case ACTION_MOVE:
+ this.move(range.x, range.y);
+ renderable = false;
+ break;
+
+ // Zoom canvas
+ case ACTION_ZOOM:
+ this.zoom(getMaxZoomRatio(pointers), e);
+ renderable = false;
+ break;
+
+ // Create crop box
+ case ACTION_CROP:
+ if (!range.x || !range.y) {
+ renderable = false;
+ break;
+ }
+
+ offset = getOffset(this.cropper);
+ left = pointer.startX - offset.left;
+ top = pointer.startY - offset.top;
+ width = cropBoxData.minWidth;
+ height = cropBoxData.minHeight;
+
+ if (range.x > 0) {
+ action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;
+ } else if (range.x < 0) {
+ left -= width;
+ action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;
+ }
+
+ if (range.y < 0) {
+ top -= height;
+ }
+
+ // Show the crop box if is hidden
+ if (!this.cropped) {
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ this.cropped = true;
+
+ if (this.limited) {
+ this.limitCropBox(true, true);
+ }
+ }
+
+ break;
+
+ default:
+ }
+
+ if (renderable) {
+ cropBoxData.width = width;
+ cropBoxData.height = height;
+ cropBoxData.left = left;
+ cropBoxData.top = top;
+ this.action = action;
+ this.renderCropBox();
+ }
+
+ // Override
+ each(pointers, function (p) {
+ p.startX = p.endX;
+ p.startY = p.endY;
+ });
+ }
+};
+
+var methods = {
+ // Show the crop box manually
+ crop: function crop() {
+ if (this.ready && !this.disabled) {
+ if (!this.cropped) {
+ this.cropped = true;
+ this.limitCropBox(true, true);
+
+ if (this.options.modal) {
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ this.setCropBoxData(this.initialCropBoxData);
+ }
+
+ return this;
+ },
+
+
+ // Reset the image and crop box to their initial states
+ reset: function reset() {
+ if (this.ready && !this.disabled) {
+ this.imageData = extend({}, this.initialImageData);
+ this.canvasData = extend({}, this.initialCanvasData);
+ this.cropBoxData = extend({}, this.initialCropBoxData);
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+
+ return this;
+ },
+
+
+ // Clear the crop box
+ clear: function clear() {
+ if (this.cropped && !this.disabled) {
+ extend(this.cropBoxData, {
+ left: 0,
+ top: 0,
+ width: 0,
+ height: 0
+ });
+
+ this.cropped = false;
+ this.renderCropBox();
+ this.limitCanvas(true, true);
+
+ // Render canvas after crop box rendered
+ this.renderCanvas();
+ removeClass(this.dragBox, CLASS_MODAL);
+ addClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Replace the image's src and rebuild the cropper
+ * @param {string} url - The new URL.
+ * @param {boolean} [onlyColorChanged] - Indicate if the new image only changed color.
+ * @returns {Object} this
+ */
+ replace: function replace(url) {
+ var onlyColorChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!this.disabled && url) {
+ if (this.isImg) {
+ this.element.src = url;
+ }
+
+ if (onlyColorChanged) {
+ this.url = url;
+ this.image.src = url;
+
+ if (this.ready) {
+ this.image2.src = url;
+
+ each(this.previews, function (element) {
+ element.getElementsByTagName('img')[0].src = url;
+ });
+ }
+ } else {
+ if (this.isImg) {
+ this.replaced = true;
+ }
+
+ // Clear previous data
+ this.options.data = null;
+ this.load(url);
+ }
+ }
+
+ return this;
+ },
+
+
+ // Enable (unfreeze) the cropper
+ enable: function enable() {
+ if (this.ready) {
+ this.disabled = false;
+ removeClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+
+ // Disable (freeze) the cropper
+ disable: function disable() {
+ if (this.ready) {
+ this.disabled = true;
+ addClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+
+ // Destroy the cropper and remove the instance from the image
+ destroy: function destroy() {
+ var element = this.element,
+ image = this.image;
+
+
+ if (this.loaded) {
+ if (this.isImg && this.replaced) {
+ element.src = this.originalUrl;
+ }
+
+ this.unbuild();
+ removeClass(element, CLASS_HIDDEN);
+ } else if (this.isImg) {
+ removeListener(element, EVENT_LOAD, this.onStart);
+ } else if (image) {
+ image.parentNode.removeChild(image);
+ }
+
+ removeData(element, NAMESPACE);
+
+ return this;
+ },
+
+
+ /**
+ * Move the canvas with relative offsets
+ * @param {number} offsetX - The relative offset distance on the x-axis.
+ * @param {number} offsetY - The relative offset distance on the y-axis.
+ * @returns {Object} this
+ */
+ move: function move(offsetX, offsetY) {
+ var _canvasData = this.canvasData,
+ left = _canvasData.left,
+ top = _canvasData.top;
+
+
+ return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));
+ },
+
+
+ /**
+ * Move the canvas to an absolute point
+ * @param {number} x - The x-axis coordinate.
+ * @param {number} [y=x] - The y-axis coordinate.
+ * @returns {Object} this
+ */
+ moveTo: function moveTo(x) {
+ var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
+ var canvasData = this.canvasData;
+
+ var changed = false;
+
+ x = Number(x);
+ y = Number(y);
+
+ if (this.ready && !this.disabled && this.options.movable) {
+ if (isNumber(x)) {
+ canvasData.left = x;
+ changed = true;
+ }
+
+ if (isNumber(y)) {
+ canvasData.top = y;
+ changed = true;
+ }
+
+ if (changed) {
+ this.renderCanvas(true);
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Zoom the canvas with a relative ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoom: function zoom(ratio, _originalEvent) {
+ var canvasData = this.canvasData;
+
+
+ ratio = Number(ratio);
+
+ if (ratio < 0) {
+ ratio = 1 / (1 - ratio);
+ } else {
+ ratio = 1 + ratio;
+ }
+
+ return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);
+ },
+
+
+ /**
+ * Zoom the canvas to an absolute ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Object} pivot - The zoom pivot point coordinate.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoomTo: function zoomTo(ratio, pivot, _originalEvent) {
+ var options = this.options,
+ canvasData = this.canvasData;
+ var width = canvasData.width,
+ height = canvasData.height,
+ naturalWidth = canvasData.naturalWidth,
+ naturalHeight = canvasData.naturalHeight;
+
+
+ ratio = Number(ratio);
+
+ if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {
+ var newWidth = naturalWidth * ratio;
+ var newHeight = naturalHeight * ratio;
+
+ if (dispatchEvent(this.element, EVENT_ZOOM, {
+ originalEvent: _originalEvent,
+ oldRatio: width / naturalWidth,
+ ratio: newWidth / naturalWidth
+ }) === false) {
+ return this;
+ }
+
+ if (_originalEvent) {
+ var pointers = this.pointers;
+
+ var offset = getOffset(this.cropper);
+ var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {
+ pageX: _originalEvent.pageX,
+ pageY: _originalEvent.pageY
+ };
+
+ // Zoom from the triggering point of the event
+ canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width);
+ canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height);
+ } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {
+ canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);
+ canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);
+ } else {
+ // Zoom from the center of the canvas
+ canvasData.left -= (newWidth - width) / 2;
+ canvasData.top -= (newHeight - height) / 2;
+ }
+
+ canvasData.width = newWidth;
+ canvasData.height = newHeight;
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Rotate the canvas with a relative degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotate: function rotate(degree) {
+ return this.rotateTo((this.imageData.rotate || 0) + Number(degree));
+ },
+
+
+ /**
+ * Rotate the canvas to an absolute degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotateTo: function rotateTo(degree) {
+ degree = Number(degree);
+
+ if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {
+ this.imageData.rotate = degree % 360;
+ this.renderCanvas(true, true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Scale the image on the x-axis.
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @returns {Object} this
+ */
+ scaleX: function scaleX(_scaleX) {
+ var scaleY = this.imageData.scaleY;
+
+
+ return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1);
+ },
+
+
+ /**
+ * Scale the image on the y-axis.
+ * @param {number} scaleY - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scaleY: function scaleY(_scaleY) {
+ var scaleX = this.imageData.scaleX;
+
+
+ return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY);
+ },
+
+
+ /**
+ * Scale the image
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scale: function scale(scaleX) {
+ var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
+ var imageData = this.imageData;
+
+ var transformed = false;
+
+ scaleX = Number(scaleX);
+ scaleY = Number(scaleY);
+
+ if (this.ready && !this.disabled && this.options.scalable) {
+ if (isNumber(scaleX)) {
+ imageData.scaleX = scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(scaleY)) {
+ imageData.scaleY = scaleY;
+ transformed = true;
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the cropped area position and size data (base on the original image)
+ * @param {boolean} [rounded=false] - Indicate if round the data values or not.
+ * @returns {Object} The result cropped data.
+ */
+ getData: function getData$$1() {
+ var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var options = this.options,
+ imageData = this.imageData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+
+ var data = void 0;
+
+ if (this.ready && this.cropped) {
+ data = {
+ x: cropBoxData.left - canvasData.left,
+ y: cropBoxData.top - canvasData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ };
+
+ var ratio = imageData.width / imageData.naturalWidth;
+
+ each(data, function (n, i) {
+ n /= ratio;
+ data[i] = rounded ? Math.round(n) : n;
+ });
+ } else {
+ data = {
+ x: 0,
+ y: 0,
+ width: 0,
+ height: 0
+ };
+ }
+
+ if (options.rotatable) {
+ data.rotate = imageData.rotate || 0;
+ }
+
+ if (options.scalable) {
+ data.scaleX = imageData.scaleX || 1;
+ data.scaleY = imageData.scaleY || 1;
+ }
+
+ return data;
+ },
+
+
+ /**
+ * Set the cropped area position and size with new data
+ * @param {Object} data - The new data.
+ * @returns {Object} this
+ */
+ setData: function setData$$1(data) {
+ var options = this.options,
+ imageData = this.imageData,
+ canvasData = this.canvasData;
+
+ var cropBoxData = {};
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ var transformed = false;
+
+ if (options.rotatable) {
+ if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
+ imageData.rotate = data.rotate;
+ transformed = true;
+ }
+ }
+
+ if (options.scalable) {
+ if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
+ imageData.scaleX = data.scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
+ imageData.scaleY = data.scaleY;
+ transformed = true;
+ }
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+
+ var ratio = imageData.width / imageData.naturalWidth;
+
+ if (isNumber(data.x)) {
+ cropBoxData.left = data.x * ratio + canvasData.left;
+ }
+
+ if (isNumber(data.y)) {
+ cropBoxData.top = data.y * ratio + canvasData.top;
+ }
+
+ if (isNumber(data.width)) {
+ cropBoxData.width = data.width * ratio;
+ }
+
+ if (isNumber(data.height)) {
+ cropBoxData.height = data.height * ratio;
+ }
+
+ this.setCropBoxData(cropBoxData);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the container size data.
+ * @returns {Object} The result container data.
+ */
+ getContainerData: function getContainerData() {
+ return this.ready ? extend({}, this.containerData) : {};
+ },
+
+
+ /**
+ * Get the image position and size data.
+ * @returns {Object} The result image data.
+ */
+ getImageData: function getImageData() {
+ return this.loaded ? extend({}, this.imageData) : {};
+ },
+
+
+ /**
+ * Get the canvas position and size data.
+ * @returns {Object} The result canvas data.
+ */
+ getCanvasData: function getCanvasData() {
+ var canvasData = this.canvasData;
+
+ var data = {};
+
+ if (this.ready) {
+ each(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) {
+ data[n] = canvasData[n];
+ });
+ }
+
+ return data;
+ },
+
+
+ /**
+ * Set the canvas position and size with new data.
+ * @param {Object} data - The new canvas data.
+ * @returns {Object} this
+ */
+ setCanvasData: function setCanvasData(data) {
+ var canvasData = this.canvasData;
+ var aspectRatio = canvasData.aspectRatio;
+
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ canvasData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ canvasData.top = data.top;
+ }
+
+ if (isNumber(data.width)) {
+ canvasData.width = data.width;
+ canvasData.height = data.width / aspectRatio;
+ } else if (isNumber(data.height)) {
+ canvasData.height = data.height;
+ canvasData.width = data.height * aspectRatio;
+ }
+
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the crop box position and size data.
+ * @returns {Object} The result crop box data.
+ */
+ getCropBoxData: function getCropBoxData() {
+ var cropBoxData = this.cropBoxData;
+
+ var data = void 0;
+
+ if (this.ready && this.cropped) {
+ data = {
+ left: cropBoxData.left,
+ top: cropBoxData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ };
+ }
+
+ return data || {};
+ },
+
+
+ /**
+ * Set the crop box position and size with new data.
+ * @param {Object} data - The new crop box data.
+ * @returns {Object} this
+ */
+ setCropBoxData: function setCropBoxData(data) {
+ var cropBoxData = this.cropBoxData;
+ var aspectRatio = this.options.aspectRatio;
+
+ var widthChanged = void 0;
+ var heightChanged = void 0;
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ cropBoxData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ cropBoxData.top = data.top;
+ }
+
+ if (isNumber(data.width) && data.width !== cropBoxData.width) {
+ widthChanged = true;
+ cropBoxData.width = data.width;
+ }
+
+ if (isNumber(data.height) && data.height !== cropBoxData.height) {
+ heightChanged = true;
+ cropBoxData.height = data.height;
+ }
+
+ if (aspectRatio) {
+ if (widthChanged) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else if (heightChanged) {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.renderCropBox();
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get a canvas drawn the cropped image.
+ * @param {Object} [options={}] - The config options.
+ * @returns {HTMLCanvasElement} - The result canvas.
+ */
+ getCroppedCanvas: function getCroppedCanvas() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ if (!this.ready || !window.HTMLCanvasElement) {
+ return null;
+ }
+
+ var canvasData = this.canvasData;
+
+ var source = getSourceCanvas(this.image, this.imageData, canvasData, options);
+
+ // Returns the source canvas if it is not cropped.
+ if (!this.cropped) {
+ return source;
+ }
+
+ var _getData = this.getData(),
+ x = _getData.x,
+ y = _getData.y,
+ initialWidth = _getData.width,
+ initialHeight = _getData.height;
+
+ var aspectRatio = initialWidth / initialHeight;
+ var maxSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.maxWidth || Infinity,
+ height: options.maxHeight || Infinity
+ });
+ var minSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.minWidth || 0,
+ height: options.minHeight || 0
+ });
+
+ var _getContainSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.width || initialWidth,
+ height: options.height || initialHeight
+ }),
+ width = _getContainSizes.width,
+ height = _getContainSizes.height;
+
+ width = Math.min(maxSizes.width, Math.max(minSizes.width, width));
+ height = Math.min(maxSizes.height, Math.max(minSizes.height, height));
+
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+
+ context.fillStyle = options.fillColor || 'transparent';
+ context.fillRect(0, 0, width, height);
+
+ var _options$imageSmoothi = options.imageSmoothingEnabled,
+ imageSmoothingEnabled = _options$imageSmoothi === undefined ? true : _options$imageSmoothi,
+ imageSmoothingQuality = options.imageSmoothingQuality;
+
+
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+
+ if (imageSmoothingQuality) {
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ }
+
+ // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage
+ var sourceWidth = source.width;
+ var sourceHeight = source.height;
+
+ // Source canvas parameters
+ var srcX = x;
+ var srcY = y;
+ var srcWidth = void 0;
+ var srcHeight = void 0;
+
+ // Destination canvas parameters
+ var dstX = void 0;
+ var dstY = void 0;
+ var dstWidth = void 0;
+ var dstHeight = void 0;
+
+ if (srcX <= -initialWidth || srcX > sourceWidth) {
+ srcX = 0;
+ srcWidth = 0;
+ dstX = 0;
+ dstWidth = 0;
+ } else if (srcX <= 0) {
+ dstX = -srcX;
+ srcX = 0;
+ srcWidth = Math.min(sourceWidth, initialWidth + srcX);
+ dstWidth = srcWidth;
+ } else if (srcX <= sourceWidth) {
+ dstX = 0;
+ srcWidth = Math.min(initialWidth, sourceWidth - srcX);
+ dstWidth = srcWidth;
+ }
+
+ if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {
+ srcY = 0;
+ srcHeight = 0;
+ dstY = 0;
+ dstHeight = 0;
+ } else if (srcY <= 0) {
+ dstY = -srcY;
+ srcY = 0;
+ srcHeight = Math.min(sourceHeight, initialHeight + srcY);
+ dstHeight = srcHeight;
+ } else if (srcY <= sourceHeight) {
+ dstY = 0;
+ srcHeight = Math.min(initialHeight, sourceHeight - srcY);
+ dstHeight = srcHeight;
+ }
+
+ // All the numerical parameters should be integer for `drawImage`
+ // https://github.com/fengyuanchen/cropper/issues/476
+ var params = [srcX, srcY, srcWidth, srcHeight];
+
+ // Avoid "IndexSizeError"
+ if (dstWidth > 0 && dstHeight > 0) {
+ var scale = width / initialWidth;
+
+ params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
+ }
+
+ context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) {
+ return Math.floor(normalizeDecimalNumber(param));
+ }))));
+
+ return canvas;
+ },
+
+
+ /**
+ * Change the aspect ratio of the crop box.
+ * @param {number} aspectRatio - The new aspect ratio.
+ * @returns {Object} this
+ */
+ setAspectRatio: function setAspectRatio(aspectRatio) {
+ var options = this.options;
+
+
+ if (!this.disabled && !isUndefined(aspectRatio)) {
+ // 0 -> NaN
+ options.aspectRatio = Math.max(0, aspectRatio) || NaN;
+
+ if (this.ready) {
+ this.initCropBox();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Change the drag mode.
+ * @param {string} mode - The new drag mode.
+ * @returns {Object} this
+ */
+ setDragMode: function setDragMode(mode) {
+ var options = this.options,
+ dragBox = this.dragBox,
+ face = this.face;
+
+
+ if (this.loaded && !this.disabled) {
+ var croppable = mode === DRAG_MODE_CROP;
+ var movable = options.movable && mode === DRAG_MODE_MOVE;
+
+ mode = croppable || movable ? mode : DRAG_MODE_NONE;
+
+ setData(dragBox, DATA_ACTION, mode);
+ toggleClass(dragBox, CLASS_CROP, croppable);
+ toggleClass(dragBox, CLASS_MOVE, movable);
+
+ if (!options.cropBoxMovable) {
+ // Sync drag mode to crop box when it is not movable
+ setData(face, DATA_ACTION, mode);
+ toggleClass(face, CLASS_CROP, croppable);
+ toggleClass(face, CLASS_MOVE, movable);
+ }
+ }
+
+ return this;
+ }
+};
+
+var AnotherCropper = WINDOW.Cropper;
+
+var Cropper = function () {
+ /**
+ * Create a new Cropper.
+ * @param {Element} element - The target element for cropping.
+ * @param {Object} [options={}] - The configuration options.
+ */
+ function Cropper(element) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ classCallCheck(this, Cropper);
+
+ if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {
+ throw new Error('The first argument is required and must be an <img> or <canvas> element.');
+ }
+
+ this.element = element;
+ this.options = extend({}, DEFAULTS, isPlainObject(options) && options);
+ this.complete = false;
+ this.cropped = false;
+ this.disabled = false;
+ this.isImg = false;
+ this.limited = false;
+ this.loaded = false;
+ this.ready = false;
+ this.replaced = false;
+ this.wheeling = false;
+ this.originalUrl = '';
+ this.canvasData = null;
+ this.cropBoxData = null;
+ this.previews = null;
+ this.pointers = {};
+ this.init();
+ }
+
+ createClass(Cropper, [{
+ key: 'init',
+ value: function init() {
+ var element = this.element;
+
+ var tagName = element.tagName.toLowerCase();
+ var url = void 0;
+
+ if (getData(element, NAMESPACE)) {
+ return;
+ }
+
+ setData(element, NAMESPACE, this);
+
+ if (tagName === 'img') {
+ this.isImg = true;
+
+ // e.g.: "img/picture.jpg"
+ url = element.getAttribute('src') || '';
+ this.originalUrl = url;
+
+ // Stop when it's a blank image
+ if (!url) {
+ return;
+ }
+
+ // e.g.: "http://example.com/img/picture.jpg"
+ url = element.src;
+ } else if (tagName === 'canvas' && window.HTMLCanvasElement) {
+ url = element.toDataURL();
+ }
+
+ this.load(url);
+ }
+ }, {
+ key: 'load',
+ value: function load(url) {
+ var _this = this;
+
+ if (!url) {
+ return;
+ }
+
+ this.url = url;
+ this.imageData = {};
+
+ var element = this.element,
+ options = this.options;
+
+
+ if (!options.checkOrientation || !window.ArrayBuffer) {
+ this.clone();
+ return;
+ }
+
+ // XMLHttpRequest disallows to open a Data URL in some browsers like IE11 and Safari
+ if (REGEXP_DATA_URL.test(url)) {
+ if (REGEXP_DATA_URL_JPEG.test(url)) {
+ this.read(dataURLToArrayBuffer(url));
+ } else {
+ this.clone();
+ }
+
+ return;
+ }
+
+ var xhr = new XMLHttpRequest();
+
+ xhr.onerror = function () {
+ _this.clone();
+ };
+
+ xhr.onload = function () {
+ _this.read(xhr.response);
+ };
+
+ if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {
+ url = addTimestamp(url);
+ }
+
+ xhr.open('get', url);
+ xhr.responseType = 'arraybuffer';
+ xhr.withCredentials = element.crossOrigin === 'use-credentials';
+ xhr.send();
+ }
+ }, {
+ key: 'read',
+ value: function read(arrayBuffer) {
+ var options = this.options,
+ imageData = this.imageData;
+
+ var orientation = getOrientation(arrayBuffer);
+ var rotate = 0;
+ var scaleX = 1;
+ var scaleY = 1;
+
+ if (orientation > 1) {
+ this.url = arrayBufferToDataURL(arrayBuffer, 'image/jpeg');
+
+ var _parseOrientation = parseOrientation(orientation);
+
+ rotate = _parseOrientation.rotate;
+ scaleX = _parseOrientation.scaleX;
+ scaleY = _parseOrientation.scaleY;
+ }
+
+ if (options.rotatable) {
+ imageData.rotate = rotate;
+ }
+
+ if (options.scalable) {
+ imageData.scaleX = scaleX;
+ imageData.scaleY = scaleY;
+ }
+
+ this.clone();
+ }
+ }, {
+ key: 'clone',
+ value: function clone() {
+ var element = this.element,
+ url = this.url;
+
+ var crossOrigin = void 0;
+ var crossOriginUrl = void 0;
+
+ if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {
+ crossOrigin = element.crossOrigin;
+
+
+ if (crossOrigin) {
+ crossOriginUrl = url;
+ } else {
+ crossOrigin = 'anonymous';
+
+ // Bust cache when there is not a "crossOrigin" property
+ crossOriginUrl = addTimestamp(url);
+ }
+ }
+
+ this.crossOrigin = crossOrigin;
+ this.crossOriginUrl = crossOriginUrl;
+
+ var image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = crossOriginUrl || url;
+
+ var start = proxy(this.start, this);
+ var stop = proxy(this.stop, this);
+
+ this.image = image;
+ this.onStart = start;
+ this.onStop = stop;
+
+ if (this.isImg) {
+ if (element.complete) {
+ this.start();
+ } else {
+ addListener(element, EVENT_LOAD, start);
+ }
+ } else {
+ addListener(image, EVENT_LOAD, start);
+ addListener(image, EVENT_ERROR, stop);
+ addClass(image, CLASS_HIDE);
+ element.parentNode.insertBefore(image, element.nextSibling);
+ }
+ }
+ }, {
+ key: 'start',
+ value: function start(event) {
+ var _this2 = this;
+
+ var image = this.isImg ? this.element : this.image;
+
+ if (event) {
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ }
+
+ getImageNaturalSizes(image, function (naturalWidth, naturalHeight) {
+ extend(_this2.imageData, {
+ naturalWidth: naturalWidth,
+ naturalHeight: naturalHeight,
+ aspectRatio: naturalWidth / naturalHeight
+ });
+ _this2.loaded = true;
+ _this2.build();
+ });
+ }
+ }, {
+ key: 'stop',
+ value: function stop() {
+ var image = this.image;
+
+
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ image.parentNode.removeChild(image);
+ this.image = null;
+ }
+ }, {
+ key: 'build',
+ value: function build() {
+ var _this3 = this;
+
+ if (!this.loaded) {
+ return;
+ }
+
+ // Unbuild first when replace
+ if (this.ready) {
+ this.unbuild();
+ }
+
+ var element = this.element,
+ options = this.options,
+ image = this.image;
+
+ // Create cropper elements
+
+ var container = element.parentNode;
+ var template = document.createElement('div');
+
+ template.innerHTML = TEMPLATE;
+
+ var cropper = template.querySelector('.' + NAMESPACE + '-container');
+ var canvas = cropper.querySelector('.' + NAMESPACE + '-canvas');
+ var dragBox = cropper.querySelector('.' + NAMESPACE + '-drag-box');
+ var cropBox = cropper.querySelector('.' + NAMESPACE + '-crop-box');
+ var face = cropBox.querySelector('.' + NAMESPACE + '-face');
+
+ this.container = container;
+ this.cropper = cropper;
+ this.canvas = canvas;
+ this.dragBox = dragBox;
+ this.cropBox = cropBox;
+ this.viewBox = cropper.querySelector('.' + NAMESPACE + '-view-box');
+ this.face = face;
+
+ canvas.appendChild(image);
+
+ // Hide the original image
+ addClass(element, CLASS_HIDDEN);
+
+ // Inserts the cropper after to the current image
+ container.insertBefore(cropper, element.nextSibling);
+
+ // Show the image if is hidden
+ if (!this.isImg) {
+ removeClass(image, CLASS_HIDE);
+ }
+
+ this.initPreview();
+ this.bind();
+
+ options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;
+ options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;
+
+ this.cropped = options.autoCrop;
+
+ if (options.autoCrop) {
+ if (options.modal) {
+ addClass(dragBox, CLASS_MODAL);
+ }
+ } else {
+ addClass(cropBox, CLASS_HIDDEN);
+ }
+
+ if (!options.guides) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-dashed'), CLASS_HIDDEN);
+ }
+
+ if (!options.center) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-center'), CLASS_HIDDEN);
+ }
+
+ if (options.background) {
+ addClass(cropper, NAMESPACE + '-bg');
+ }
+
+ if (!options.highlight) {
+ addClass(face, CLASS_INVISIBLE);
+ }
+
+ if (options.cropBoxMovable) {
+ addClass(face, CLASS_MOVE);
+ setData(face, DATA_ACTION, ACTION_ALL);
+ }
+
+ if (!options.cropBoxResizable) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-line'), CLASS_HIDDEN);
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-point'), CLASS_HIDDEN);
+ }
+
+ this.setDragMode(options.dragMode);
+ this.render();
+ this.ready = true;
+ this.setData(options.data);
+
+ // Call the "ready" option asynchronously to keep "image.cropper" is defined
+ this.completing = setTimeout(function () {
+ if (isFunction(options.ready)) {
+ addListener(element, EVENT_READY, options.ready, {
+ once: true
+ });
+ }
+
+ dispatchEvent(element, EVENT_READY);
+ dispatchEvent(element, EVENT_CROP, _this3.getData());
+
+ _this3.complete = true;
+ }, 0);
+ }
+ }, {
+ key: 'unbuild',
+ value: function unbuild() {
+ if (!this.ready) {
+ return;
+ }
+
+ if (!this.complete) {
+ clearTimeout(this.completing);
+ }
+
+ this.ready = false;
+ this.complete = false;
+ this.initialImageData = null;
+
+ // Clear `initialCanvasData` is necessary when replace
+ this.initialCanvasData = null;
+ this.initialCropBoxData = null;
+ this.containerData = null;
+ this.canvasData = null;
+
+ // Clear `cropBoxData` is necessary when replace
+ this.cropBoxData = null;
+ this.unbind();
+ this.resetPreview();
+ this.previews = null;
+ this.viewBox = null;
+ this.cropBox = null;
+ this.dragBox = null;
+ this.canvas = null;
+ this.container = null;
+ this.cropper.parentNode.removeChild(this.cropper);
+ this.cropper = null;
+ }
+
+ /**
+ * Get the no conflict cropper class.
+ * @returns {Cropper} The cropper class.
+ */
+
+ }], [{
+ key: 'noConflict',
+ value: function noConflict() {
+ window.Cropper = AnotherCropper;
+ return Cropper;
+ }
+
+ /**
+ * Change the default options.
+ * @param {Object} options - The new default options.
+ */
+
+ }, {
+ key: 'setDefaults',
+ value: function setDefaults(options) {
+ extend(DEFAULTS, isPlainObject(options) && options);
+ }
+ }]);
+ return Cropper;
+}();
+
+extend(Cropper.prototype, render, preview, events, handlers, change, methods);
+
+module.exports = Cropper;
diff --git a/library/cropperjs/dist/cropper.css b/library/cropperjs/dist/cropper.css
new file mode 100644
index 000000000..dd22178fe
--- /dev/null
+++ b/library/cropperjs/dist/cropper.css
@@ -0,0 +1,306 @@
+/*!
+ * Cropper.js v1.2.2
+ * https://github.com/fengyuanchen/cropperjs
+ *
+ * Copyright (c) 2015-2018 Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2018-01-03T13:26:29.610Z
+ */
+
+.cropper-container {
+ direction: ltr;
+ font-size: 0;
+ line-height: 0;
+ position: relative;
+ -ms-touch-action: none;
+ touch-action: none;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.cropper-container img {/*Avoid margin top issue (Occur only when margin-top <= -height)
+ */
+ display: block;
+ height: 100%;
+ image-orientation: 0deg;
+ max-height: none !important;
+ max-width: none !important;
+ min-height: 0 !important;
+ min-width: 0 !important;
+ width: 100%;
+}
+
+.cropper-wrap-box,
+.cropper-canvas,
+.cropper-drag-box,
+.cropper-crop-box,
+.cropper-modal {
+ bottom: 0;
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+}
+
+.cropper-wrap-box,
+.cropper-canvas {
+ overflow: hidden;
+}
+
+.cropper-drag-box {
+ background-color: #fff;
+ opacity: 0;
+}
+
+.cropper-modal {
+ background-color: #000;
+ opacity: .5;
+}
+
+.cropper-view-box {
+ display: block;
+ height: 100%;
+ outline-color: rgba(51, 153, 255, 0.75);
+ outline: 1px solid #39f;
+ overflow: hidden;
+ width: 100%;
+}
+
+.cropper-dashed {
+ border: 0 dashed #eee;
+ display: block;
+ opacity: .5;
+ position: absolute;
+}
+
+.cropper-dashed.dashed-h {
+ border-bottom-width: 1px;
+ border-top-width: 1px;
+ height: 33.33333%;
+ left: 0;
+ top: 33.33333%;
+ width: 100%;
+}
+
+.cropper-dashed.dashed-v {
+ border-left-width: 1px;
+ border-right-width: 1px;
+ height: 100%;
+ left: 33.33333%;
+ top: 0;
+ width: 33.33333%;
+}
+
+.cropper-center {
+ display: block;
+ height: 0;
+ left: 50%;
+ opacity: .75;
+ position: absolute;
+ top: 50%;
+ width: 0;
+}
+
+.cropper-center:before,
+.cropper-center:after {
+ background-color: #eee;
+ content: ' ';
+ display: block;
+ position: absolute;
+}
+
+.cropper-center:before {
+ height: 1px;
+ left: -3px;
+ top: 0;
+ width: 7px;
+}
+
+.cropper-center:after {
+ height: 7px;
+ left: 0;
+ top: -3px;
+ width: 1px;
+}
+
+.cropper-face,
+.cropper-line,
+.cropper-point {
+ display: block;
+ height: 100%;
+ opacity: .1;
+ position: absolute;
+ width: 100%;
+}
+
+.cropper-face {
+ background-color: #fff;
+ left: 0;
+ top: 0;
+}
+
+.cropper-line {
+ background-color: #39f;
+}
+
+.cropper-line.line-e {
+ cursor: ew-resize;
+ right: -3px;
+ top: 0;
+ width: 5px;
+}
+
+.cropper-line.line-n {
+ cursor: ns-resize;
+ height: 5px;
+ left: 0;
+ top: -3px;
+}
+
+.cropper-line.line-w {
+ cursor: ew-resize;
+ left: -3px;
+ top: 0;
+ width: 5px;
+}
+
+.cropper-line.line-s {
+ bottom: -3px;
+ cursor: ns-resize;
+ height: 5px;
+ left: 0;
+}
+
+.cropper-point {
+ background-color: #39f;
+ height: 5px;
+ opacity: .75;
+ width: 5px;
+}
+
+.cropper-point.point-e {
+ cursor: ew-resize;
+ margin-top: -3px;
+ right: -3px;
+ top: 50%;
+}
+
+.cropper-point.point-n {
+ cursor: ns-resize;
+ left: 50%;
+ margin-left: -3px;
+ top: -3px;
+}
+
+.cropper-point.point-w {
+ cursor: ew-resize;
+ left: -3px;
+ margin-top: -3px;
+ top: 50%;
+}
+
+.cropper-point.point-s {
+ bottom: -3px;
+ cursor: s-resize;
+ left: 50%;
+ margin-left: -3px;
+}
+
+.cropper-point.point-ne {
+ cursor: nesw-resize;
+ right: -3px;
+ top: -3px;
+}
+
+.cropper-point.point-nw {
+ cursor: nwse-resize;
+ left: -3px;
+ top: -3px;
+}
+
+.cropper-point.point-sw {
+ bottom: -3px;
+ cursor: nesw-resize;
+ left: -3px;
+}
+
+.cropper-point.point-se {
+ bottom: -3px;
+ cursor: nwse-resize;
+ height: 20px;
+ opacity: 1;
+ right: -3px;
+ width: 20px;
+}
+
+@media (min-width: 768px) {
+ .cropper-point.point-se {
+ height: 15px;
+ width: 15px;
+ }
+}
+
+@media (min-width: 992px) {
+ .cropper-point.point-se {
+ height: 10px;
+ width: 10px;
+ }
+}
+
+@media (min-width: 1200px) {
+ .cropper-point.point-se {
+ height: 5px;
+ opacity: .75;
+ width: 5px;
+ }
+}
+
+.cropper-point.point-se:before {
+ background-color: #39f;
+ bottom: -50%;
+ content: ' ';
+ display: block;
+ height: 200%;
+ opacity: 0;
+ position: absolute;
+ right: -50%;
+ width: 200%;
+}
+
+.cropper-invisible {
+ opacity: 0;
+}
+
+.cropper-bg {
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');
+}
+
+.cropper-hide {
+ display: block;
+ height: 0;
+ position: absolute;
+ width: 0;
+}
+
+.cropper-hidden {
+ display: none !important;
+}
+
+.cropper-move {
+ cursor: move;
+}
+
+.cropper-crop {
+ cursor: crosshair;
+}
+
+.cropper-disabled .cropper-drag-box,
+.cropper-disabled .cropper-face,
+.cropper-disabled .cropper-line,
+.cropper-disabled .cropper-point {
+ cursor: not-allowed;
+}
+
diff --git a/library/cropperjs/dist/cropper.esm.js b/library/cropperjs/dist/cropper.esm.js
new file mode 100644
index 000000000..929852d8a
--- /dev/null
+++ b/library/cropperjs/dist/cropper.esm.js
@@ -0,0 +1,3758 @@
+/*!
+ * Cropper.js v1.2.2
+ * https://github.com/fengyuanchen/cropperjs
+ *
+ * Copyright (c) 2015-2018 Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2018-01-03T13:27:18.062Z
+ */
+
+var WINDOW = typeof window !== 'undefined' ? window : {};
+var NAMESPACE = 'cropper';
+
+// Actions
+var ACTION_ALL = 'all';
+var ACTION_CROP = 'crop';
+var ACTION_MOVE = 'move';
+var ACTION_ZOOM = 'zoom';
+var ACTION_EAST = 'e';
+var ACTION_WEST = 'w';
+var ACTION_SOUTH = 's';
+var ACTION_NORTH = 'n';
+var ACTION_NORTH_EAST = 'ne';
+var ACTION_NORTH_WEST = 'nw';
+var ACTION_SOUTH_EAST = 'se';
+var ACTION_SOUTH_WEST = 'sw';
+
+// Classes
+var CLASS_CROP = NAMESPACE + '-crop';
+var CLASS_DISABLED = NAMESPACE + '-disabled';
+var CLASS_HIDDEN = NAMESPACE + '-hidden';
+var CLASS_HIDE = NAMESPACE + '-hide';
+var CLASS_INVISIBLE = NAMESPACE + '-invisible';
+var CLASS_MODAL = NAMESPACE + '-modal';
+var CLASS_MOVE = NAMESPACE + '-move';
+
+// Data keys
+var DATA_ACTION = 'action';
+var DATA_PREVIEW = 'preview';
+
+// Drag modes
+var DRAG_MODE_CROP = 'crop';
+var DRAG_MODE_MOVE = 'move';
+var DRAG_MODE_NONE = 'none';
+
+// Events
+var EVENT_CROP = 'crop';
+var EVENT_CROP_END = 'cropend';
+var EVENT_CROP_MOVE = 'cropmove';
+var EVENT_CROP_START = 'cropstart';
+var EVENT_DBLCLICK = 'dblclick';
+var EVENT_ERROR = 'error';
+var EVENT_LOAD = 'load';
+var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
+var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove';
+var EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup';
+var EVENT_READY = 'ready';
+var EVENT_RESIZE = 'resize';
+var EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll';
+var EVENT_ZOOM = 'zoom';
+
+// RegExps
+var REGEXP_ACTIONS = /^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/;
+var REGEXP_DATA_URL = /^data:/;
+var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
+var REGEXP_TAG_NAME = /^(img|canvas)$/i;
+
+var DEFAULTS = {
+ // Define the view mode of the cropper
+ viewMode: 0, // 0, 1, 2, 3
+
+ // Define the dragging mode of the cropper
+ dragMode: DRAG_MODE_CROP, // 'crop', 'move' or 'none'
+
+ // Define the aspect ratio of the crop box
+ aspectRatio: NaN,
+
+ // An object with the previous cropping result data
+ data: null,
+
+ // A selector for adding extra containers to preview
+ preview: '',
+
+ // Re-render the cropper when resize the window
+ responsive: true,
+
+ // Restore the cropped area after resize the window
+ restore: true,
+
+ // Check if the current image is a cross-origin image
+ checkCrossOrigin: true,
+
+ // Check the current image's Exif Orientation information
+ checkOrientation: true,
+
+ // Show the black modal
+ modal: true,
+
+ // Show the dashed lines for guiding
+ guides: true,
+
+ // Show the center indicator for guiding
+ center: true,
+
+ // Show the white modal to highlight the crop box
+ highlight: true,
+
+ // Show the grid background
+ background: true,
+
+ // Enable to crop the image automatically when initialize
+ autoCrop: true,
+
+ // Define the percentage of automatic cropping area when initializes
+ autoCropArea: 0.8,
+
+ // Enable to move the image
+ movable: true,
+
+ // Enable to rotate the image
+ rotatable: true,
+
+ // Enable to scale the image
+ scalable: true,
+
+ // Enable to zoom the image
+ zoomable: true,
+
+ // Enable to zoom the image by dragging touch
+ zoomOnTouch: true,
+
+ // Enable to zoom the image by wheeling mouse
+ zoomOnWheel: true,
+
+ // Define zoom ratio when zoom the image by wheeling mouse
+ wheelZoomRatio: 0.1,
+
+ // Enable to move the crop box
+ cropBoxMovable: true,
+
+ // Enable to resize the crop box
+ cropBoxResizable: true,
+
+ // Toggle drag mode between "crop" and "move" when click twice on the cropper
+ toggleDragModeOnDblclick: true,
+
+ // Size limitation
+ minCanvasWidth: 0,
+ minCanvasHeight: 0,
+ minCropBoxWidth: 0,
+ minCropBoxHeight: 0,
+ minContainerWidth: 200,
+ minContainerHeight: 100,
+
+ // Shortcuts of events
+ ready: null,
+ cropstart: null,
+ cropmove: null,
+ cropend: null,
+ crop: null,
+ zoom: null
+};
+
+var TEMPLATE = '<div class="cropper-container">' + '<div class="cropper-wrap-box">' + '<div class="cropper-canvas"></div>' + '</div>' + '<div class="cropper-drag-box"></div>' + '<div class="cropper-crop-box">' + '<span class="cropper-view-box"></span>' + '<span class="cropper-dashed dashed-h"></span>' + '<span class="cropper-dashed dashed-v"></span>' + '<span class="cropper-center"></span>' + '<span class="cropper-face"></span>' + '<span class="cropper-line line-e" data-action="e"></span>' + '<span class="cropper-line line-n" data-action="n"></span>' + '<span class="cropper-line line-w" data-action="w"></span>' + '<span class="cropper-line line-s" data-action="s"></span>' + '<span class="cropper-point point-e" data-action="e"></span>' + '<span class="cropper-point point-n" data-action="n"></span>' + '<span class="cropper-point point-w" data-action="w"></span>' + '<span class="cropper-point point-s" data-action="s"></span>' + '<span class="cropper-point point-ne" data-action="ne"></span>' + '<span class="cropper-point point-nw" data-action="nw"></span>' + '<span class="cropper-point point-sw" data-action="sw"></span>' + '<span class="cropper-point point-se" data-action="se"></span>' + '</div>' + '</div>';
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
+ return typeof obj;
+} : function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+};
+
+
+
+
+
+
+
+
+
+
+
+var classCallCheck = function (instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+};
+
+var createClass = function () {
+ function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+
+ return function (Constructor, protoProps, staticProps) {
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) defineProperties(Constructor, staticProps);
+ return Constructor;
+ };
+}();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var toConsumableArray = function (arr) {
+ if (Array.isArray(arr)) {
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
+
+ return arr2;
+ } else {
+ return Array.from(arr);
+ }
+};
+
+/**
+ * Check if the given value is not a number.
+ */
+var isNaN = Number.isNaN || WINDOW.isNaN;
+
+/**
+ * Check if the given value is a number.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a number, else `false`.
+ */
+function isNumber(value) {
+ return typeof value === 'number' && !isNaN(value);
+}
+
+/**
+ * Check if the given value is undefined.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is undefined, else `false`.
+ */
+function isUndefined(value) {
+ return typeof value === 'undefined';
+}
+
+/**
+ * Check if the given value is an object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is an object, else `false`.
+ */
+function isObject(value) {
+ return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null;
+}
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Check if the given value is a plain object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
+ */
+
+function isPlainObject(value) {
+ if (!isObject(value)) {
+ return false;
+ }
+
+ try {
+ var _constructor = value.constructor;
+ var prototype = _constructor.prototype;
+
+
+ return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
+ } catch (e) {
+ return false;
+ }
+}
+
+/**
+ * Check if the given value is a function.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a function, else `false`.
+ */
+function isFunction(value) {
+ return typeof value === 'function';
+}
+
+/**
+ * Iterate the given data.
+ * @param {*} data - The data to iterate.
+ * @param {Function} callback - The process function for each element.
+ * @returns {*} The original data.
+ */
+function each(data, callback) {
+ if (data && isFunction(callback)) {
+ if (Array.isArray(data) || isNumber(data.length) /* array-like */) {
+ var length = data.length;
+
+ var i = void 0;
+
+ for (i = 0; i < length; i += 1) {
+ if (callback.call(data, data[i], i, data) === false) {
+ break;
+ }
+ }
+ } else if (isObject(data)) {
+ Object.keys(data).forEach(function (key) {
+ callback.call(data, data[key], key, data);
+ });
+ }
+ }
+
+ return data;
+}
+
+/**
+ * Extend the given object.
+ * @param {*} obj - The object to be extended.
+ * @param {*} args - The rest objects which will be merged to the first object.
+ * @returns {Object} The extended object.
+ */
+function extend(obj) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ if (isObject(obj) && args.length > 0) {
+ if (Object.assign) {
+ return Object.assign.apply(Object, [obj].concat(args));
+ }
+
+ args.forEach(function (arg) {
+ if (isObject(arg)) {
+ Object.keys(arg).forEach(function (key) {
+ obj[key] = arg[key];
+ });
+ }
+ });
+ }
+
+ return obj;
+}
+
+/**
+ * Takes a function and returns a new one that will always have a particular context.
+ * @param {Function} fn - The target function.
+ * @param {Object} context - The new context for the function.
+ * @returns {boolean} The new function.
+ */
+function proxy(fn, context) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
+ args[_key2 - 2] = arguments[_key2];
+ }
+
+ return function () {
+ for (var _len3 = arguments.length, args2 = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
+ args2[_key3] = arguments[_key3];
+ }
+
+ return fn.apply(context, args.concat(args2));
+ };
+}
+
+var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/i;
+
+/**
+ * Normalize decimal number.
+ * Check out {@link http://0.30000000000000004.com/ }
+ * @param {number} value - The value to normalize.
+ * @param {number} [times=100000000000] - The times for normalizing.
+ * @returns {number} Returns the normalized number.
+ */
+function normalizeDecimalNumber(value) {
+ var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;
+
+ return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;
+}
+
+var REGEXP_SUFFIX = /^(width|height|left|top|marginLeft|marginTop)$/;
+
+/**
+ * Apply styles to the given element.
+ * @param {Element} element - The target element.
+ * @param {Object} styles - The styles for applying.
+ */
+function setStyle(element, styles) {
+ var style = element.style;
+
+
+ each(styles, function (value, property) {
+ if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
+ value += 'px';
+ }
+
+ style[property] = value;
+ });
+}
+
+/**
+ * Check if the given element has a special class.
+ * @param {Element} element - The element to check.
+ * @param {string} value - The class to search.
+ * @returns {boolean} Returns `true` if the special class was found.
+ */
+function hasClass(element, value) {
+ return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;
+}
+
+/**
+ * Add classes to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be added.
+ */
+function addClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ addClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.add(value);
+ return;
+ }
+
+ var className = element.className.trim();
+
+ if (!className) {
+ element.className = value;
+ } else if (className.indexOf(value) < 0) {
+ element.className = className + ' ' + value;
+ }
+}
+
+/**
+ * Remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be removed.
+ */
+function removeClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ removeClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.remove(value);
+ return;
+ }
+
+ if (element.className.indexOf(value) >= 0) {
+ element.className = element.className.replace(value, '');
+ }
+}
+
+/**
+ * Add or remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be toggled.
+ * @param {boolean} added - Add only.
+ */
+function toggleClass(element, value, added) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ toggleClass(elem, value, added);
+ });
+ return;
+ }
+
+ // IE10-11 doesn't support the second parameter of `classList.toggle`
+ if (added) {
+ addClass(element, value);
+ } else {
+ removeClass(element, value);
+ }
+}
+
+var REGEXP_HYPHENATE = /([a-z\d])([A-Z])/g;
+
+/**
+ * Hyphenate the given value.
+ * @param {string} value - The value to hyphenate.
+ * @returns {string} The hyphenated value.
+ */
+function hyphenate(value) {
+ return value.replace(REGEXP_HYPHENATE, '$1-$2').toLowerCase();
+}
+
+/**
+ * Get data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to get.
+ * @returns {string} The data value.
+ */
+function getData(element, name) {
+ if (isObject(element[name])) {
+ return element[name];
+ } else if (element.dataset) {
+ return element.dataset[name];
+ }
+
+ return element.getAttribute('data-' + hyphenate(name));
+}
+
+/**
+ * Set data to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to set.
+ * @param {string} data - The data value.
+ */
+function setData(element, name, data) {
+ if (isObject(data)) {
+ element[name] = data;
+ } else if (element.dataset) {
+ element.dataset[name] = data;
+ } else {
+ element.setAttribute('data-' + hyphenate(name), data);
+ }
+}
+
+/**
+ * Remove data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to remove.
+ */
+function removeData(element, name) {
+ if (isObject(element[name])) {
+ try {
+ delete element[name];
+ } catch (e) {
+ element[name] = null;
+ }
+ } else if (element.dataset) {
+ // #128 Safari not allows to delete dataset property
+ try {
+ delete element.dataset[name];
+ } catch (e) {
+ element.dataset[name] = null;
+ }
+ } else {
+ element.removeAttribute('data-' + hyphenate(name));
+ }
+}
+
+var REGEXP_SPACES = /\s+/;
+
+/**
+ * Remove event listener from the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+function removeListener(element, type, listener) {
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ if (!isFunction(listener)) {
+ return;
+ }
+
+ var types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, function (t) {
+ removeListener(element, t, listener, options);
+ });
+ return;
+ }
+
+ if (element.removeEventListener) {
+ element.removeEventListener(type, listener, options);
+ } else if (element.detachEvent) {
+ element.detachEvent('on' + type, listener);
+ }
+}
+
+/**
+ * Add event listener to the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+function addListener(element, type, _listener) {
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ if (!isFunction(_listener)) {
+ return;
+ }
+
+ var types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, function (t) {
+ addListener(element, t, _listener, options);
+ });
+ return;
+ }
+
+ if (options.once) {
+ var originalListener = _listener;
+
+ _listener = function listener() {
+ for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
+ args[_key4] = arguments[_key4];
+ }
+
+ removeListener(element, type, _listener, options);
+ return originalListener.apply(element, args);
+ };
+ }
+
+ if (element.addEventListener) {
+ element.addEventListener(type, _listener, options);
+ } else if (element.attachEvent) {
+ element.attachEvent('on' + type, _listener);
+ }
+}
+
+/**
+ * Dispatch event on the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Object} data - The additional event data.
+ * @returns {boolean} Indicate if the event is default prevented or not.
+ */
+function dispatchEvent(element, type, data) {
+ if (element.dispatchEvent) {
+ var event = void 0;
+
+ // Event and CustomEvent on IE9-11 are global objects, not constructors
+ if (isFunction(Event) && isFunction(CustomEvent)) {
+ if (isUndefined(data)) {
+ event = new Event(type, {
+ bubbles: true,
+ cancelable: true
+ });
+ } else {
+ event = new CustomEvent(type, {
+ detail: data,
+ bubbles: true,
+ cancelable: true
+ });
+ }
+ } else if (isUndefined(data)) {
+ event = document.createEvent('Event');
+ event.initEvent(type, true, true);
+ } else {
+ event = document.createEvent('CustomEvent');
+ event.initCustomEvent(type, true, true, data);
+ }
+
+ // IE9+
+ return element.dispatchEvent(event);
+ } else if (element.fireEvent) {
+ // IE6-10 (native events only)
+ return element.fireEvent('on' + type);
+ }
+
+ return true;
+}
+
+/**
+ * Get the offset base on the document.
+ * @param {Element} element - The target element.
+ * @returns {Object} The offset data.
+ */
+function getOffset(element) {
+ var doc = document.documentElement;
+ var box = element.getBoundingClientRect();
+
+ return {
+ left: box.left + ((window.scrollX || doc && doc.scrollLeft || 0) - (doc && doc.clientLeft || 0)),
+ top: box.top + ((window.scrollY || doc && doc.scrollTop || 0) - (doc && doc.clientTop || 0))
+ };
+}
+
+/**
+ * Empty an element.
+ * @param {Element} element - The element to empty.
+ */
+function empty(element) {
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+
+var location = WINDOW.location;
+
+var REGEXP_ORIGINS = /^(https?:)\/\/([^:/?#]+):?(\d*)/i;
+
+/**
+ * Check if the given URL is a cross origin URL.
+ * @param {string} url - The target URL.
+ * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.
+ */
+function isCrossOriginURL(url) {
+ var parts = url.match(REGEXP_ORIGINS);
+
+ return parts && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);
+}
+
+/**
+ * Add timestamp to the given URL.
+ * @param {string} url - The target URL.
+ * @returns {string} The result URL.
+ */
+function addTimestamp(url) {
+ var timestamp = 'timestamp=' + new Date().getTime();
+
+ return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp;
+}
+
+/**
+ * Get transforms base on the given object.
+ * @param {Object} obj - The target object.
+ * @returns {string} A string contains transform values.
+ */
+function getTransforms(_ref) {
+ var rotate = _ref.rotate,
+ scaleX = _ref.scaleX,
+ scaleY = _ref.scaleY,
+ translateX = _ref.translateX,
+ translateY = _ref.translateY;
+
+ var values = [];
+
+ if (isNumber(translateX) && translateX !== 0) {
+ values.push('translateX(' + translateX + 'px)');
+ }
+
+ if (isNumber(translateY) && translateY !== 0) {
+ values.push('translateY(' + translateY + 'px)');
+ }
+
+ // Rotate should come first before scale to match orientation transform
+ if (isNumber(rotate) && rotate !== 0) {
+ values.push('rotate(' + rotate + 'deg)');
+ }
+
+ if (isNumber(scaleX) && scaleX !== 1) {
+ values.push('scaleX(' + scaleX + ')');
+ }
+
+ if (isNumber(scaleY) && scaleY !== 1) {
+ values.push('scaleY(' + scaleY + ')');
+ }
+
+ var transform = values.length ? values.join(' ') : 'none';
+
+ return {
+ WebkitTransform: transform,
+ msTransform: transform,
+ transform: transform
+ };
+}
+
+var navigator = WINDOW.navigator;
+
+var IS_SAFARI_OR_UIWEBVIEW = navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);
+
+/**
+ * Get an image's natural sizes.
+ * @param {string} image - The target image.
+ * @param {Function} callback - The callback function.
+ */
+function getImageNaturalSizes(image, callback) {
+ // Modern browsers (except Safari)
+ if (image.naturalWidth && !IS_SAFARI_OR_UIWEBVIEW) {
+ callback(image.naturalWidth, image.naturalHeight);
+ return;
+ }
+
+ var newImage = document.createElement('img');
+ var body = document.body || document.documentElement;
+
+ newImage.onload = function () {
+ callback(newImage.width, newImage.height);
+
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ body.removeChild(newImage);
+ }
+ };
+
+ newImage.src = image.src;
+
+ // iOS Safari will convert the image automatically
+ // with its orientation once append it into DOM (#279)
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ newImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';
+ body.appendChild(newImage);
+ }
+}
+
+/**
+ * Get the max ratio of a group of pointers.
+ * @param {string} pointers - The target pointers.
+ * @returns {number} The result ratio.
+ */
+function getMaxZoomRatio(pointers) {
+ var pointers2 = extend({}, pointers);
+ var ratios = [];
+
+ each(pointers, function (pointer, pointerId) {
+ delete pointers2[pointerId];
+
+ each(pointers2, function (pointer2) {
+ var x1 = Math.abs(pointer.startX - pointer2.startX);
+ var y1 = Math.abs(pointer.startY - pointer2.startY);
+ var x2 = Math.abs(pointer.endX - pointer2.endX);
+ var y2 = Math.abs(pointer.endY - pointer2.endY);
+ var z1 = Math.sqrt(x1 * x1 + y1 * y1);
+ var z2 = Math.sqrt(x2 * x2 + y2 * y2);
+ var ratio = (z2 - z1) / z1;
+
+ ratios.push(ratio);
+ });
+ });
+
+ ratios.sort(function (a, b) {
+ return Math.abs(a) < Math.abs(b);
+ });
+
+ return ratios[0];
+}
+
+/**
+ * Get a pointer from an event object.
+ * @param {Object} event - The target event object.
+ * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
+ * @returns {Object} The result pointer contains start and/or end point coordinates.
+ */
+function getPointer(_ref2, endOnly) {
+ var pageX = _ref2.pageX,
+ pageY = _ref2.pageY;
+
+ var end = {
+ endX: pageX,
+ endY: pageY
+ };
+
+ if (endOnly) {
+ return end;
+ }
+
+ return extend({
+ startX: pageX,
+ startY: pageY
+ }, end);
+}
+
+/**
+ * Get the center point coordinate of a group of pointers.
+ * @param {Object} pointers - The target pointers.
+ * @returns {Object} The center point coordinate.
+ */
+function getPointersCenter(pointers) {
+ var pageX = 0;
+ var pageY = 0;
+ var count = 0;
+
+ each(pointers, function (_ref3) {
+ var startX = _ref3.startX,
+ startY = _ref3.startY;
+
+ pageX += startX;
+ pageY += startY;
+ count += 1;
+ });
+
+ pageX /= count;
+ pageY /= count;
+
+ return {
+ pageX: pageX,
+ pageY: pageY
+ };
+}
+
+/**
+ * Check if the given value is a finite number.
+ */
+var isFinite = Number.isFinite || WINDOW.isFinite;
+
+/**
+ * Get the max sizes in a rectangle under the given aspect ratio.
+ * @param {Object} data - The original sizes.
+ * @returns {Object} The result sizes.
+ */
+function getContainSizes(_ref4) {
+ var aspectRatio = _ref4.aspectRatio,
+ height = _ref4.height,
+ width = _ref4.width;
+
+ var isValidNumber = function isValidNumber(value) {
+ return isFinite(value) && value > 0;
+ };
+
+ if (isValidNumber(width) && isValidNumber(height)) {
+ if (height * aspectRatio > width) {
+ height = width / aspectRatio;
+ } else {
+ width = height * aspectRatio;
+ }
+ } else if (isValidNumber(width)) {
+ height = width / aspectRatio;
+ } else if (isValidNumber(height)) {
+ width = height * aspectRatio;
+ }
+
+ return {
+ width: width,
+ height: height
+ };
+}
+
+/**
+ * Get the new sizes of a rectangle after rotated.
+ * @param {Object} data - The original sizes.
+ * @returns {Object} The result sizes.
+ */
+function getRotatedSizes(_ref5) {
+ var width = _ref5.width,
+ height = _ref5.height,
+ degree = _ref5.degree;
+
+ degree = Math.abs(degree) % 180;
+
+ if (degree === 90) {
+ return {
+ width: height,
+ height: width
+ };
+ }
+
+ var arc = degree % 90 * Math.PI / 180;
+ var sinArc = Math.sin(arc);
+ var cosArc = Math.cos(arc);
+ var newWidth = width * cosArc + height * sinArc;
+ var newHeight = width * sinArc + height * cosArc;
+
+ return degree > 90 ? {
+ width: newHeight,
+ height: newWidth
+ } : {
+ width: newWidth,
+ height: newHeight
+ };
+}
+
+/**
+ * Get a canvas which drew the given image.
+ * @param {HTMLImageElement} image - The image for drawing.
+ * @param {Object} imageData - The image data.
+ * @param {Object} canvasData - The canvas data.
+ * @param {Object} options - The options.
+ * @returns {HTMLCanvasElement} The result canvas.
+ */
+function getSourceCanvas(image, _ref6, _ref7, _ref8) {
+ var imageNaturalWidth = _ref6.naturalWidth,
+ imageNaturalHeight = _ref6.naturalHeight,
+ _ref6$rotate = _ref6.rotate,
+ rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
+ _ref6$scaleX = _ref6.scaleX,
+ scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
+ _ref6$scaleY = _ref6.scaleY,
+ scaleY = _ref6$scaleY === undefined ? 1 : _ref6$scaleY;
+ var aspectRatio = _ref7.aspectRatio,
+ naturalWidth = _ref7.naturalWidth,
+ naturalHeight = _ref7.naturalHeight;
+ var _ref8$fillColor = _ref8.fillColor,
+ fillColor = _ref8$fillColor === undefined ? 'transparent' : _ref8$fillColor,
+ _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled,
+ imageSmoothingEnabled = _ref8$imageSmoothingE === undefined ? true : _ref8$imageSmoothingE,
+ _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality,
+ imageSmoothingQuality = _ref8$imageSmoothingQ === undefined ? 'low' : _ref8$imageSmoothingQ,
+ _ref8$maxWidth = _ref8.maxWidth,
+ maxWidth = _ref8$maxWidth === undefined ? Infinity : _ref8$maxWidth,
+ _ref8$maxHeight = _ref8.maxHeight,
+ maxHeight = _ref8$maxHeight === undefined ? Infinity : _ref8$maxHeight,
+ _ref8$minWidth = _ref8.minWidth,
+ minWidth = _ref8$minWidth === undefined ? 0 : _ref8$minWidth,
+ _ref8$minHeight = _ref8.minHeight,
+ minHeight = _ref8$minHeight === undefined ? 0 : _ref8$minHeight;
+
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+ var maxSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: maxWidth,
+ height: maxHeight
+ });
+ var minSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: minWidth,
+ height: minHeight
+ });
+ var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
+ var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
+ var params = [-imageNaturalWidth / 2, -imageNaturalHeight / 2, imageNaturalWidth, imageNaturalHeight];
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+ context.fillStyle = fillColor;
+ context.fillRect(0, 0, width, height);
+ context.save();
+ context.translate(width / 2, height / 2);
+ context.rotate(rotate * Math.PI / 180);
+ context.scale(scaleX, scaleY);
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ context.drawImage.apply(context, [image].concat(toConsumableArray(params.map(function (param) {
+ return Math.floor(normalizeDecimalNumber(param));
+ }))));
+ context.restore();
+ return canvas;
+}
+
+var fromCharCode = String.fromCharCode;
+
+/**
+ * Get string from char code in data view.
+ * @param {DataView} dataView - The data view for read.
+ * @param {number} start - The start index.
+ * @param {number} length - The read length.
+ * @returns {string} The read result.
+ */
+
+function getStringFromCharCode(dataView, start, length) {
+ var str = '';
+ var i = void 0;
+
+ length += start;
+
+ for (i = start; i < length; i += 1) {
+ str += fromCharCode(dataView.getUint8(i));
+ }
+
+ return str;
+}
+
+var REGEXP_DATA_URL_HEAD = /^data:.*,/;
+
+/**
+ * Transform Data URL to array buffer.
+ * @param {string} dataURL - The Data URL to transform.
+ * @returns {ArrayBuffer} The result array buffer.
+ */
+function dataURLToArrayBuffer(dataURL) {
+ var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');
+ var binary = atob(base64);
+ var arrayBuffer = new ArrayBuffer(binary.length);
+ var uint8 = new Uint8Array(arrayBuffer);
+
+ each(uint8, function (value, i) {
+ uint8[i] = binary.charCodeAt(i);
+ });
+
+ return arrayBuffer;
+}
+
+/**
+ * Transform array buffer to Data URL.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.
+ * @param {string} mimeType - The mime type of the Data URL.
+ * @returns {string} The result Data URL.
+ */
+function arrayBufferToDataURL(arrayBuffer, mimeType) {
+ var uint8 = new Uint8Array(arrayBuffer);
+ var data = '';
+
+ // TypedArray.prototype.forEach is not supported in some browsers.
+ each(uint8, function (value) {
+ data += fromCharCode(value);
+ });
+
+ return 'data:' + mimeType + ';base64,' + btoa(data);
+}
+
+/**
+ * Get orientation value from given array buffer.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to read.
+ * @returns {number} The read orientation value.
+ */
+function getOrientation(arrayBuffer) {
+ var dataView = new DataView(arrayBuffer);
+ var orientation = void 0;
+ var littleEndian = void 0;
+ var app1Start = void 0;
+ var ifdStart = void 0;
+
+ // Only handle JPEG image (start by 0xFFD8)
+ if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
+ var length = dataView.byteLength;
+ var offset = 2;
+
+ while (offset < length) {
+ if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
+ app1Start = offset;
+ break;
+ }
+
+ offset += 1;
+ }
+ }
+
+ if (app1Start) {
+ var exifIDCode = app1Start + 4;
+ var tiffOffset = app1Start + 10;
+
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
+ var endianness = dataView.getUint16(tiffOffset);
+
+ littleEndian = endianness === 0x4949;
+
+ if (littleEndian || endianness === 0x4D4D /* bigEndian */) {
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
+ var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
+
+ if (firstIFDOffset >= 0x00000008) {
+ ifdStart = tiffOffset + firstIFDOffset;
+ }
+ }
+ }
+ }
+ }
+
+ if (ifdStart) {
+ var _length = dataView.getUint16(ifdStart, littleEndian);
+ var _offset = void 0;
+ var i = void 0;
+
+ for (i = 0; i < _length; i += 1) {
+ _offset = ifdStart + i * 12 + 2;
+
+ if (dataView.getUint16(_offset, littleEndian) === 0x0112 /* Orientation */) {
+ // 8 is the offset of the current tag's value
+ _offset += 8;
+
+ // Get the original orientation value
+ orientation = dataView.getUint16(_offset, littleEndian);
+
+ // Override the orientation with its default value
+ dataView.setUint16(_offset, 1, littleEndian);
+ break;
+ }
+ }
+ }
+
+ return orientation;
+}
+
+/**
+ * Parse Exif Orientation value.
+ * @param {number} orientation - The orientation to parse.
+ * @returns {Object} The parsed result.
+ */
+function parseOrientation(orientation) {
+ var rotate = 0;
+ var scaleX = 1;
+ var scaleY = 1;
+
+ switch (orientation) {
+ // Flip horizontal
+ case 2:
+ scaleX = -1;
+ break;
+
+ // Rotate left 180°
+ case 3:
+ rotate = -180;
+ break;
+
+ // Flip vertical
+ case 4:
+ scaleY = -1;
+ break;
+
+ // Flip vertical and rotate right 90°
+ case 5:
+ rotate = 90;
+ scaleY = -1;
+ break;
+
+ // Rotate right 90°
+ case 6:
+ rotate = 90;
+ break;
+
+ // Flip horizontal and rotate right 90°
+ case 7:
+ rotate = 90;
+ scaleX = -1;
+ break;
+
+ // Rotate left 90°
+ case 8:
+ rotate = -90;
+ break;
+
+ default:
+ }
+
+ return {
+ rotate: rotate,
+ scaleX: scaleX,
+ scaleY: scaleY
+ };
+}
+
+var render = {
+ render: function render() {
+ this.initContainer();
+ this.initCanvas();
+ this.initCropBox();
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ },
+ initContainer: function initContainer() {
+ var element = this.element,
+ options = this.options,
+ container = this.container,
+ cropper = this.cropper;
+
+
+ addClass(cropper, CLASS_HIDDEN);
+ removeClass(element, CLASS_HIDDEN);
+
+ var containerData = {
+ width: Math.max(container.offsetWidth, Number(options.minContainerWidth) || 200),
+ height: Math.max(container.offsetHeight, Number(options.minContainerHeight) || 100)
+ };
+
+ this.containerData = containerData;
+
+ setStyle(cropper, {
+ width: containerData.width,
+ height: containerData.height
+ });
+
+ addClass(element, CLASS_HIDDEN);
+ removeClass(cropper, CLASS_HIDDEN);
+ },
+
+
+ // Canvas (image wrapper)
+ initCanvas: function initCanvas() {
+ var containerData = this.containerData,
+ imageData = this.imageData;
+ var viewMode = this.options.viewMode;
+
+ var rotated = Math.abs(imageData.rotate) % 180 === 90;
+ var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;
+ var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;
+ var aspectRatio = naturalWidth / naturalHeight;
+ var canvasWidth = containerData.width;
+ var canvasHeight = containerData.height;
+
+ if (containerData.height * aspectRatio > containerData.width) {
+ if (viewMode === 3) {
+ canvasWidth = containerData.height * aspectRatio;
+ } else {
+ canvasHeight = containerData.width / aspectRatio;
+ }
+ } else if (viewMode === 3) {
+ canvasHeight = containerData.width / aspectRatio;
+ } else {
+ canvasWidth = containerData.height * aspectRatio;
+ }
+
+ var canvasData = {
+ aspectRatio: aspectRatio,
+ naturalWidth: naturalWidth,
+ naturalHeight: naturalHeight,
+ width: canvasWidth,
+ height: canvasHeight
+ };
+
+ canvasData.left = (containerData.width - canvasWidth) / 2;
+ canvasData.top = (containerData.height - canvasHeight) / 2;
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ this.canvasData = canvasData;
+ this.limited = viewMode === 1 || viewMode === 2;
+ this.limitCanvas(true, true);
+ this.initialImageData = extend({}, imageData);
+ this.initialCanvasData = extend({}, canvasData);
+ },
+ limitCanvas: function limitCanvas(sizeLimited, positionLimited) {
+ var options = this.options,
+ containerData = this.containerData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+ var viewMode = options.viewMode;
+ var aspectRatio = canvasData.aspectRatio;
+
+ var cropped = this.cropped && cropBoxData;
+
+ if (sizeLimited) {
+ var minCanvasWidth = Number(options.minCanvasWidth) || 0;
+ var minCanvasHeight = Number(options.minCanvasHeight) || 0;
+
+ if (viewMode > 1) {
+ minCanvasWidth = Math.max(minCanvasWidth, containerData.width);
+ minCanvasHeight = Math.max(minCanvasHeight, containerData.height);
+
+ if (viewMode === 3) {
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ } else if (viewMode > 0) {
+ if (minCanvasWidth) {
+ minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);
+ } else if (minCanvasHeight) {
+ minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);
+ } else if (cropped) {
+ minCanvasWidth = cropBoxData.width;
+ minCanvasHeight = cropBoxData.height;
+
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ }
+
+ var _getContainSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: minCanvasWidth,
+ height: minCanvasHeight
+ });
+
+ minCanvasWidth = _getContainSizes.width;
+ minCanvasHeight = _getContainSizes.height;
+
+
+ canvasData.minWidth = minCanvasWidth;
+ canvasData.minHeight = minCanvasHeight;
+ canvasData.maxWidth = Infinity;
+ canvasData.maxHeight = Infinity;
+ }
+
+ if (positionLimited) {
+ if (viewMode) {
+ var newCanvasLeft = containerData.width - canvasData.width;
+ var newCanvasTop = containerData.height - canvasData.height;
+
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+
+ if (cropped && this.limited) {
+ canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));
+ canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));
+ canvasData.maxLeft = cropBoxData.left;
+ canvasData.maxTop = cropBoxData.top;
+
+ if (viewMode === 2) {
+ if (canvasData.width >= containerData.width) {
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ }
+
+ if (canvasData.height >= containerData.height) {
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+ }
+ }
+ }
+ } else {
+ canvasData.minLeft = -canvasData.width;
+ canvasData.minTop = -canvasData.height;
+ canvasData.maxLeft = containerData.width;
+ canvasData.maxTop = containerData.height;
+ }
+ }
+ },
+ renderCanvas: function renderCanvas(changed, transformed) {
+ var canvasData = this.canvasData,
+ imageData = this.imageData;
+
+
+ if (transformed) {
+ var _getRotatedSizes = getRotatedSizes({
+ width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
+ height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
+ degree: imageData.rotate || 0
+ }),
+ naturalWidth = _getRotatedSizes.width,
+ naturalHeight = _getRotatedSizes.height;
+
+ var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);
+ var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);
+
+ canvasData.left -= (width - canvasData.width) / 2;
+ canvasData.top -= (height - canvasData.height) / 2;
+ canvasData.width = width;
+ canvasData.height = height;
+ canvasData.aspectRatio = naturalWidth / naturalHeight;
+ canvasData.naturalWidth = naturalWidth;
+ canvasData.naturalHeight = naturalHeight;
+ this.limitCanvas(true, false);
+ }
+
+ if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {
+ canvasData.left = canvasData.oldLeft;
+ }
+
+ if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {
+ canvasData.top = canvasData.oldTop;
+ }
+
+ canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);
+ canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);
+
+ this.limitCanvas(false, true);
+
+ canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);
+ canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ setStyle(this.canvas, extend({
+ width: canvasData.width,
+ height: canvasData.height
+ }, getTransforms({
+ translateX: canvasData.left,
+ translateY: canvasData.top
+ })));
+
+ this.renderImage(changed);
+
+ if (this.cropped && this.limited) {
+ this.limitCropBox(true, true);
+ }
+ },
+ renderImage: function renderImage(changed) {
+ var canvasData = this.canvasData,
+ imageData = this.imageData;
+
+ var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);
+ var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);
+
+ extend(imageData, {
+ width: width,
+ height: height,
+ left: (canvasData.width - width) / 2,
+ top: (canvasData.height - height) / 2
+ });
+ setStyle(this.image, extend({
+ width: imageData.width,
+ height: imageData.height
+ }, getTransforms(extend({
+ translateX: imageData.left,
+ translateY: imageData.top
+ }, imageData))));
+
+ if (changed) {
+ this.output();
+ }
+ },
+ initCropBox: function initCropBox() {
+ var options = this.options,
+ canvasData = this.canvasData;
+ var aspectRatio = options.aspectRatio;
+
+ var autoCropArea = Number(options.autoCropArea) || 0.8;
+ var cropBoxData = {
+ width: canvasData.width,
+ height: canvasData.height
+ };
+
+ if (aspectRatio) {
+ if (canvasData.height * aspectRatio > canvasData.width) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.cropBoxData = cropBoxData;
+ this.limitCropBox(true, true);
+
+ // Initialize auto crop area
+ cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
+ cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
+
+ // The width/height of auto crop area must large than "minWidth/Height"
+ cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);
+ cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);
+ cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;
+ cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ this.initialCropBoxData = extend({}, cropBoxData);
+ },
+ limitCropBox: function limitCropBox(sizeLimited, positionLimited) {
+ var options = this.options,
+ containerData = this.containerData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData,
+ limited = this.limited;
+ var aspectRatio = options.aspectRatio;
+
+
+ if (sizeLimited) {
+ var minCropBoxWidth = Number(options.minCropBoxWidth) || 0;
+ var minCropBoxHeight = Number(options.minCropBoxHeight) || 0;
+ var maxCropBoxWidth = Math.min(containerData.width, limited ? canvasData.width : containerData.width);
+ var maxCropBoxHeight = Math.min(containerData.height, limited ? canvasData.height : containerData.height);
+
+ // The min/maxCropBoxWidth/Height must be less than container's width/height
+ minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);
+ minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);
+
+ if (aspectRatio) {
+ if (minCropBoxWidth && minCropBoxHeight) {
+ if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+ } else if (minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else if (minCropBoxHeight) {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+
+ if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {
+ maxCropBoxHeight = maxCropBoxWidth / aspectRatio;
+ } else {
+ maxCropBoxWidth = maxCropBoxHeight * aspectRatio;
+ }
+ }
+
+ // The minWidth/Height must be less than maxWidth/Height
+ cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);
+ cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);
+ cropBoxData.maxWidth = maxCropBoxWidth;
+ cropBoxData.maxHeight = maxCropBoxHeight;
+ }
+
+ if (positionLimited) {
+ if (limited) {
+ cropBoxData.minLeft = Math.max(0, canvasData.left);
+ cropBoxData.minTop = Math.max(0, canvasData.top);
+ cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;
+ cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;
+ } else {
+ cropBoxData.minLeft = 0;
+ cropBoxData.minTop = 0;
+ cropBoxData.maxLeft = containerData.width - cropBoxData.width;
+ cropBoxData.maxTop = containerData.height - cropBoxData.height;
+ }
+ }
+ },
+ renderCropBox: function renderCropBox() {
+ var options = this.options,
+ containerData = this.containerData,
+ cropBoxData = this.cropBoxData;
+
+
+ if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {
+ cropBoxData.left = cropBoxData.oldLeft;
+ }
+
+ if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {
+ cropBoxData.top = cropBoxData.oldTop;
+ }
+
+ cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
+ cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
+
+ this.limitCropBox(false, true);
+
+ cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);
+ cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ if (options.movable && options.cropBoxMovable) {
+ // Turn to move the canvas when the crop box is equal to the container
+ setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);
+ }
+
+ setStyle(this.cropBox, extend({
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ }, getTransforms({
+ translateX: cropBoxData.left,
+ translateY: cropBoxData.top
+ })));
+
+ if (this.cropped && this.limited) {
+ this.limitCanvas(true, true);
+ }
+
+ if (!this.disabled) {
+ this.output();
+ }
+ },
+ output: function output() {
+ this.preview();
+
+ if (this.complete) {
+ dispatchEvent(this.element, EVENT_CROP, this.getData());
+ }
+ }
+};
+
+var preview = {
+ initPreview: function initPreview() {
+ var crossOrigin = this.crossOrigin;
+ var preview = this.options.preview;
+
+ var url = crossOrigin ? this.crossOriginUrl : this.url;
+ var image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = url;
+ this.viewBox.appendChild(image);
+ this.image2 = image;
+
+ if (!preview) {
+ return;
+ }
+
+ var previews = preview.querySelector ? [preview] : document.querySelectorAll(preview);
+
+ this.previews = previews;
+
+ each(previews, function (element) {
+ var img = document.createElement('img');
+
+ // Save the original size for recover
+ setData(element, DATA_PREVIEW, {
+ width: element.offsetWidth,
+ height: element.offsetHeight,
+ html: element.innerHTML
+ });
+
+ if (crossOrigin) {
+ img.crossOrigin = crossOrigin;
+ }
+
+ img.src = url;
+
+ /**
+ * Override img element styles
+ * Add `display:block` to avoid margin top issue
+ * Add `height:auto` to override `height` attribute on IE8
+ * (Occur only when margin-top <= -height)
+ */
+ img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"';
+
+ empty(element);
+ element.appendChild(img);
+ });
+ },
+ resetPreview: function resetPreview() {
+ each(this.previews, function (element) {
+ var data = getData(element, DATA_PREVIEW);
+
+ setStyle(element, {
+ width: data.width,
+ height: data.height
+ });
+
+ element.innerHTML = data.html;
+ removeData(element, DATA_PREVIEW);
+ });
+ },
+ preview: function preview() {
+ var imageData = this.imageData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+ var cropBoxWidth = cropBoxData.width,
+ cropBoxHeight = cropBoxData.height;
+ var width = imageData.width,
+ height = imageData.height;
+
+ var left = cropBoxData.left - canvasData.left - imageData.left;
+ var top = cropBoxData.top - canvasData.top - imageData.top;
+
+ if (!this.cropped || this.disabled) {
+ return;
+ }
+
+ setStyle(this.image2, extend({
+ width: width,
+ height: height
+ }, getTransforms(extend({
+ translateX: -left,
+ translateY: -top
+ }, imageData))));
+
+ each(this.previews, function (element) {
+ var data = getData(element, DATA_PREVIEW);
+ var originalWidth = data.width;
+ var originalHeight = data.height;
+ var newWidth = originalWidth;
+ var newHeight = originalHeight;
+ var ratio = 1;
+
+ if (cropBoxWidth) {
+ ratio = originalWidth / cropBoxWidth;
+ newHeight = cropBoxHeight * ratio;
+ }
+
+ if (cropBoxHeight && newHeight > originalHeight) {
+ ratio = originalHeight / cropBoxHeight;
+ newWidth = cropBoxWidth * ratio;
+ newHeight = originalHeight;
+ }
+
+ setStyle(element, {
+ width: newWidth,
+ height: newHeight
+ });
+
+ setStyle(element.getElementsByTagName('img')[0], extend({
+ width: width * ratio,
+ height: height * ratio
+ }, getTransforms(extend({
+ translateX: -left * ratio,
+ translateY: -top * ratio
+ }, imageData))));
+ });
+ }
+};
+
+var events = {
+ bind: function bind() {
+ var element = this.element,
+ options = this.options,
+ cropper = this.cropper;
+
+
+ if (isFunction(options.cropstart)) {
+ addListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ addListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ addListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ addListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ addListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = proxy(this.cropStart, this));
+
+ if (options.zoomable && options.zoomOnWheel) {
+ addListener(cropper, EVENT_WHEEL, this.onWheel = proxy(this.wheel, this));
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ addListener(cropper, EVENT_DBLCLICK, this.onDblclick = proxy(this.dblclick, this));
+ }
+
+ addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = proxy(this.cropMove, this));
+ addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = proxy(this.cropEnd, this));
+
+ if (options.responsive) {
+ addListener(window, EVENT_RESIZE, this.onResize = proxy(this.resize, this));
+ }
+ },
+ unbind: function unbind() {
+ var element = this.element,
+ options = this.options,
+ cropper = this.cropper;
+
+
+ if (isFunction(options.cropstart)) {
+ removeListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ removeListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ removeListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ removeListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ removeListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);
+
+ if (options.zoomable && options.zoomOnWheel) {
+ removeListener(cropper, EVENT_WHEEL, this.onWheel);
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);
+ }
+
+ removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);
+ removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);
+
+ if (options.responsive) {
+ removeListener(window, EVENT_RESIZE, this.onResize);
+ }
+ }
+};
+
+var handlers = {
+ resize: function resize() {
+ var options = this.options,
+ container = this.container,
+ containerData = this.containerData;
+
+ var minContainerWidth = Number(options.minContainerWidth) || 200;
+ var minContainerHeight = Number(options.minContainerHeight) || 100;
+
+ if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) {
+ return;
+ }
+
+ var ratio = container.offsetWidth / containerData.width;
+
+ // Resize when width changed or height changed
+ if (ratio !== 1 || container.offsetHeight !== containerData.height) {
+ var canvasData = void 0;
+ var cropBoxData = void 0;
+
+ if (options.restore) {
+ canvasData = this.getCanvasData();
+ cropBoxData = this.getCropBoxData();
+ }
+
+ this.render();
+
+ if (options.restore) {
+ this.setCanvasData(each(canvasData, function (n, i) {
+ canvasData[i] = n * ratio;
+ }));
+ this.setCropBoxData(each(cropBoxData, function (n, i) {
+ cropBoxData[i] = n * ratio;
+ }));
+ }
+ }
+ },
+ dblclick: function dblclick() {
+ if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {
+ return;
+ }
+
+ this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);
+ },
+ wheel: function wheel(e) {
+ var _this = this;
+
+ var ratio = Number(this.options.wheelZoomRatio) || 0.1;
+ var delta = 1;
+
+ if (this.disabled) {
+ return;
+ }
+
+ e.preventDefault();
+
+ // Limit wheel speed to prevent zoom too fast (#21)
+ if (this.wheeling) {
+ return;
+ }
+
+ this.wheeling = true;
+
+ setTimeout(function () {
+ _this.wheeling = false;
+ }, 50);
+
+ if (e.deltaY) {
+ delta = e.deltaY > 0 ? 1 : -1;
+ } else if (e.wheelDelta) {
+ delta = -e.wheelDelta / 120;
+ } else if (e.detail) {
+ delta = e.detail > 0 ? 1 : -1;
+ }
+
+ this.zoom(-delta * ratio, e);
+ },
+ cropStart: function cropStart(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ var options = this.options,
+ pointers = this.pointers;
+
+ var action = void 0;
+
+ if (e.changedTouches) {
+ // Handle touch event
+ each(e.changedTouches, function (touch) {
+ pointers[touch.identifier] = getPointer(touch);
+ });
+ } else {
+ // Handle mouse event and pointer event
+ pointers[e.pointerId || 0] = getPointer(e);
+ }
+
+ if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
+ action = ACTION_ZOOM;
+ } else {
+ action = getData(e.target, DATA_ACTION);
+ }
+
+ if (!REGEXP_ACTIONS.test(action)) {
+ return;
+ }
+
+ if (dispatchEvent(this.element, EVENT_CROP_START, {
+ originalEvent: e,
+ action: action
+ }) === false) {
+ return;
+ }
+
+ e.preventDefault();
+
+ this.action = action;
+ this.cropping = false;
+
+ if (action === ACTION_CROP) {
+ this.cropping = true;
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+ },
+ cropMove: function cropMove(e) {
+ var action = this.action;
+
+
+ if (this.disabled || !action) {
+ return;
+ }
+
+ var pointers = this.pointers;
+
+
+ e.preventDefault();
+
+ if (dispatchEvent(this.element, EVENT_CROP_MOVE, {
+ originalEvent: e,
+ action: action
+ }) === false) {
+ return;
+ }
+
+ if (e.changedTouches) {
+ each(e.changedTouches, function (touch) {
+ extend(pointers[touch.identifier], getPointer(touch, true));
+ });
+ } else {
+ extend(pointers[e.pointerId || 0], getPointer(e, true));
+ }
+
+ this.change(e);
+ },
+ cropEnd: function cropEnd(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ var action = this.action,
+ pointers = this.pointers;
+
+
+ if (e.changedTouches) {
+ each(e.changedTouches, function (touch) {
+ delete pointers[touch.identifier];
+ });
+ } else {
+ delete pointers[e.pointerId || 0];
+ }
+
+ if (!action) {
+ return;
+ }
+
+ e.preventDefault();
+
+ if (!Object.keys(pointers).length) {
+ this.action = '';
+ }
+
+ if (this.cropping) {
+ this.cropping = false;
+ toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);
+ }
+
+ dispatchEvent(this.element, EVENT_CROP_END, {
+ originalEvent: e,
+ action: action
+ });
+ }
+};
+
+var change = {
+ change: function change(e) {
+ var options = this.options,
+ canvasData = this.canvasData,
+ containerData = this.containerData,
+ cropBoxData = this.cropBoxData,
+ pointers = this.pointers;
+ var action = this.action;
+ var aspectRatio = options.aspectRatio;
+ var left = cropBoxData.left,
+ top = cropBoxData.top,
+ width = cropBoxData.width,
+ height = cropBoxData.height;
+
+ var right = left + width;
+ var bottom = top + height;
+ var minLeft = 0;
+ var minTop = 0;
+ var maxWidth = containerData.width;
+ var maxHeight = containerData.height;
+ var renderable = true;
+ var offset = void 0;
+
+ // Locking aspect ratio in "free mode" by holding shift key
+ if (!aspectRatio && e.shiftKey) {
+ aspectRatio = width && height ? width / height : 1;
+ }
+
+ if (this.limited) {
+ minLeft = cropBoxData.minLeft;
+ minTop = cropBoxData.minTop;
+
+ maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);
+ maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);
+ }
+
+ var pointer = pointers[Object.keys(pointers)[0]];
+ var range = {
+ x: pointer.endX - pointer.startX,
+ y: pointer.endY - pointer.startY
+ };
+ var check = function check(side) {
+ switch (side) {
+ case ACTION_EAST:
+ if (right + range.x > maxWidth) {
+ range.x = maxWidth - right;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (left + range.x < minLeft) {
+ range.x = minLeft - left;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (top + range.y < minTop) {
+ range.y = minTop - top;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (bottom + range.y > maxHeight) {
+ range.y = maxHeight - bottom;
+ }
+
+ break;
+
+ default:
+ }
+ };
+
+ switch (action) {
+ // Move crop box
+ case ACTION_ALL:
+ left += range.x;
+ top += range.y;
+ break;
+
+ // Resize crop box
+ case ACTION_EAST:
+ if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top -= range.x / aspectRatio / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_WEST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left += range.y * aspectRatio / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_SOUTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top += range.x / aspectRatio / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_EAST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_SOUTH);
+ height += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left -= range.y * aspectRatio / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_NORTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_EAST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_WEST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || left <= minLeft)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ left += range.y * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_WEST:
+ if (aspectRatio) {
+ if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_EAST:
+ if (aspectRatio) {
+ if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ // Move canvas
+ case ACTION_MOVE:
+ this.move(range.x, range.y);
+ renderable = false;
+ break;
+
+ // Zoom canvas
+ case ACTION_ZOOM:
+ this.zoom(getMaxZoomRatio(pointers), e);
+ renderable = false;
+ break;
+
+ // Create crop box
+ case ACTION_CROP:
+ if (!range.x || !range.y) {
+ renderable = false;
+ break;
+ }
+
+ offset = getOffset(this.cropper);
+ left = pointer.startX - offset.left;
+ top = pointer.startY - offset.top;
+ width = cropBoxData.minWidth;
+ height = cropBoxData.minHeight;
+
+ if (range.x > 0) {
+ action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;
+ } else if (range.x < 0) {
+ left -= width;
+ action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;
+ }
+
+ if (range.y < 0) {
+ top -= height;
+ }
+
+ // Show the crop box if is hidden
+ if (!this.cropped) {
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ this.cropped = true;
+
+ if (this.limited) {
+ this.limitCropBox(true, true);
+ }
+ }
+
+ break;
+
+ default:
+ }
+
+ if (renderable) {
+ cropBoxData.width = width;
+ cropBoxData.height = height;
+ cropBoxData.left = left;
+ cropBoxData.top = top;
+ this.action = action;
+ this.renderCropBox();
+ }
+
+ // Override
+ each(pointers, function (p) {
+ p.startX = p.endX;
+ p.startY = p.endY;
+ });
+ }
+};
+
+var methods = {
+ // Show the crop box manually
+ crop: function crop() {
+ if (this.ready && !this.disabled) {
+ if (!this.cropped) {
+ this.cropped = true;
+ this.limitCropBox(true, true);
+
+ if (this.options.modal) {
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ this.setCropBoxData(this.initialCropBoxData);
+ }
+
+ return this;
+ },
+
+
+ // Reset the image and crop box to their initial states
+ reset: function reset() {
+ if (this.ready && !this.disabled) {
+ this.imageData = extend({}, this.initialImageData);
+ this.canvasData = extend({}, this.initialCanvasData);
+ this.cropBoxData = extend({}, this.initialCropBoxData);
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+
+ return this;
+ },
+
+
+ // Clear the crop box
+ clear: function clear() {
+ if (this.cropped && !this.disabled) {
+ extend(this.cropBoxData, {
+ left: 0,
+ top: 0,
+ width: 0,
+ height: 0
+ });
+
+ this.cropped = false;
+ this.renderCropBox();
+ this.limitCanvas(true, true);
+
+ // Render canvas after crop box rendered
+ this.renderCanvas();
+ removeClass(this.dragBox, CLASS_MODAL);
+ addClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Replace the image's src and rebuild the cropper
+ * @param {string} url - The new URL.
+ * @param {boolean} [onlyColorChanged] - Indicate if the new image only changed color.
+ * @returns {Object} this
+ */
+ replace: function replace(url) {
+ var onlyColorChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!this.disabled && url) {
+ if (this.isImg) {
+ this.element.src = url;
+ }
+
+ if (onlyColorChanged) {
+ this.url = url;
+ this.image.src = url;
+
+ if (this.ready) {
+ this.image2.src = url;
+
+ each(this.previews, function (element) {
+ element.getElementsByTagName('img')[0].src = url;
+ });
+ }
+ } else {
+ if (this.isImg) {
+ this.replaced = true;
+ }
+
+ // Clear previous data
+ this.options.data = null;
+ this.load(url);
+ }
+ }
+
+ return this;
+ },
+
+
+ // Enable (unfreeze) the cropper
+ enable: function enable() {
+ if (this.ready) {
+ this.disabled = false;
+ removeClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+
+ // Disable (freeze) the cropper
+ disable: function disable() {
+ if (this.ready) {
+ this.disabled = true;
+ addClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+
+ // Destroy the cropper and remove the instance from the image
+ destroy: function destroy() {
+ var element = this.element,
+ image = this.image;
+
+
+ if (this.loaded) {
+ if (this.isImg && this.replaced) {
+ element.src = this.originalUrl;
+ }
+
+ this.unbuild();
+ removeClass(element, CLASS_HIDDEN);
+ } else if (this.isImg) {
+ removeListener(element, EVENT_LOAD, this.onStart);
+ } else if (image) {
+ image.parentNode.removeChild(image);
+ }
+
+ removeData(element, NAMESPACE);
+
+ return this;
+ },
+
+
+ /**
+ * Move the canvas with relative offsets
+ * @param {number} offsetX - The relative offset distance on the x-axis.
+ * @param {number} offsetY - The relative offset distance on the y-axis.
+ * @returns {Object} this
+ */
+ move: function move(offsetX, offsetY) {
+ var _canvasData = this.canvasData,
+ left = _canvasData.left,
+ top = _canvasData.top;
+
+
+ return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));
+ },
+
+
+ /**
+ * Move the canvas to an absolute point
+ * @param {number} x - The x-axis coordinate.
+ * @param {number} [y=x] - The y-axis coordinate.
+ * @returns {Object} this
+ */
+ moveTo: function moveTo(x) {
+ var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
+ var canvasData = this.canvasData;
+
+ var changed = false;
+
+ x = Number(x);
+ y = Number(y);
+
+ if (this.ready && !this.disabled && this.options.movable) {
+ if (isNumber(x)) {
+ canvasData.left = x;
+ changed = true;
+ }
+
+ if (isNumber(y)) {
+ canvasData.top = y;
+ changed = true;
+ }
+
+ if (changed) {
+ this.renderCanvas(true);
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Zoom the canvas with a relative ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoom: function zoom(ratio, _originalEvent) {
+ var canvasData = this.canvasData;
+
+
+ ratio = Number(ratio);
+
+ if (ratio < 0) {
+ ratio = 1 / (1 - ratio);
+ } else {
+ ratio = 1 + ratio;
+ }
+
+ return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);
+ },
+
+
+ /**
+ * Zoom the canvas to an absolute ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Object} pivot - The zoom pivot point coordinate.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoomTo: function zoomTo(ratio, pivot, _originalEvent) {
+ var options = this.options,
+ canvasData = this.canvasData;
+ var width = canvasData.width,
+ height = canvasData.height,
+ naturalWidth = canvasData.naturalWidth,
+ naturalHeight = canvasData.naturalHeight;
+
+
+ ratio = Number(ratio);
+
+ if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {
+ var newWidth = naturalWidth * ratio;
+ var newHeight = naturalHeight * ratio;
+
+ if (dispatchEvent(this.element, EVENT_ZOOM, {
+ originalEvent: _originalEvent,
+ oldRatio: width / naturalWidth,
+ ratio: newWidth / naturalWidth
+ }) === false) {
+ return this;
+ }
+
+ if (_originalEvent) {
+ var pointers = this.pointers;
+
+ var offset = getOffset(this.cropper);
+ var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {
+ pageX: _originalEvent.pageX,
+ pageY: _originalEvent.pageY
+ };
+
+ // Zoom from the triggering point of the event
+ canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width);
+ canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height);
+ } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {
+ canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);
+ canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);
+ } else {
+ // Zoom from the center of the canvas
+ canvasData.left -= (newWidth - width) / 2;
+ canvasData.top -= (newHeight - height) / 2;
+ }
+
+ canvasData.width = newWidth;
+ canvasData.height = newHeight;
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Rotate the canvas with a relative degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotate: function rotate(degree) {
+ return this.rotateTo((this.imageData.rotate || 0) + Number(degree));
+ },
+
+
+ /**
+ * Rotate the canvas to an absolute degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotateTo: function rotateTo(degree) {
+ degree = Number(degree);
+
+ if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {
+ this.imageData.rotate = degree % 360;
+ this.renderCanvas(true, true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Scale the image on the x-axis.
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @returns {Object} this
+ */
+ scaleX: function scaleX(_scaleX) {
+ var scaleY = this.imageData.scaleY;
+
+
+ return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1);
+ },
+
+
+ /**
+ * Scale the image on the y-axis.
+ * @param {number} scaleY - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scaleY: function scaleY(_scaleY) {
+ var scaleX = this.imageData.scaleX;
+
+
+ return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY);
+ },
+
+
+ /**
+ * Scale the image
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scale: function scale(scaleX) {
+ var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
+ var imageData = this.imageData;
+
+ var transformed = false;
+
+ scaleX = Number(scaleX);
+ scaleY = Number(scaleY);
+
+ if (this.ready && !this.disabled && this.options.scalable) {
+ if (isNumber(scaleX)) {
+ imageData.scaleX = scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(scaleY)) {
+ imageData.scaleY = scaleY;
+ transformed = true;
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the cropped area position and size data (base on the original image)
+ * @param {boolean} [rounded=false] - Indicate if round the data values or not.
+ * @returns {Object} The result cropped data.
+ */
+ getData: function getData$$1() {
+ var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var options = this.options,
+ imageData = this.imageData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+
+ var data = void 0;
+
+ if (this.ready && this.cropped) {
+ data = {
+ x: cropBoxData.left - canvasData.left,
+ y: cropBoxData.top - canvasData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ };
+
+ var ratio = imageData.width / imageData.naturalWidth;
+
+ each(data, function (n, i) {
+ n /= ratio;
+ data[i] = rounded ? Math.round(n) : n;
+ });
+ } else {
+ data = {
+ x: 0,
+ y: 0,
+ width: 0,
+ height: 0
+ };
+ }
+
+ if (options.rotatable) {
+ data.rotate = imageData.rotate || 0;
+ }
+
+ if (options.scalable) {
+ data.scaleX = imageData.scaleX || 1;
+ data.scaleY = imageData.scaleY || 1;
+ }
+
+ return data;
+ },
+
+
+ /**
+ * Set the cropped area position and size with new data
+ * @param {Object} data - The new data.
+ * @returns {Object} this
+ */
+ setData: function setData$$1(data) {
+ var options = this.options,
+ imageData = this.imageData,
+ canvasData = this.canvasData;
+
+ var cropBoxData = {};
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ var transformed = false;
+
+ if (options.rotatable) {
+ if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
+ imageData.rotate = data.rotate;
+ transformed = true;
+ }
+ }
+
+ if (options.scalable) {
+ if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
+ imageData.scaleX = data.scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
+ imageData.scaleY = data.scaleY;
+ transformed = true;
+ }
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+
+ var ratio = imageData.width / imageData.naturalWidth;
+
+ if (isNumber(data.x)) {
+ cropBoxData.left = data.x * ratio + canvasData.left;
+ }
+
+ if (isNumber(data.y)) {
+ cropBoxData.top = data.y * ratio + canvasData.top;
+ }
+
+ if (isNumber(data.width)) {
+ cropBoxData.width = data.width * ratio;
+ }
+
+ if (isNumber(data.height)) {
+ cropBoxData.height = data.height * ratio;
+ }
+
+ this.setCropBoxData(cropBoxData);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the container size data.
+ * @returns {Object} The result container data.
+ */
+ getContainerData: function getContainerData() {
+ return this.ready ? extend({}, this.containerData) : {};
+ },
+
+
+ /**
+ * Get the image position and size data.
+ * @returns {Object} The result image data.
+ */
+ getImageData: function getImageData() {
+ return this.loaded ? extend({}, this.imageData) : {};
+ },
+
+
+ /**
+ * Get the canvas position and size data.
+ * @returns {Object} The result canvas data.
+ */
+ getCanvasData: function getCanvasData() {
+ var canvasData = this.canvasData;
+
+ var data = {};
+
+ if (this.ready) {
+ each(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) {
+ data[n] = canvasData[n];
+ });
+ }
+
+ return data;
+ },
+
+
+ /**
+ * Set the canvas position and size with new data.
+ * @param {Object} data - The new canvas data.
+ * @returns {Object} this
+ */
+ setCanvasData: function setCanvasData(data) {
+ var canvasData = this.canvasData;
+ var aspectRatio = canvasData.aspectRatio;
+
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ canvasData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ canvasData.top = data.top;
+ }
+
+ if (isNumber(data.width)) {
+ canvasData.width = data.width;
+ canvasData.height = data.width / aspectRatio;
+ } else if (isNumber(data.height)) {
+ canvasData.height = data.height;
+ canvasData.width = data.height * aspectRatio;
+ }
+
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the crop box position and size data.
+ * @returns {Object} The result crop box data.
+ */
+ getCropBoxData: function getCropBoxData() {
+ var cropBoxData = this.cropBoxData;
+
+ var data = void 0;
+
+ if (this.ready && this.cropped) {
+ data = {
+ left: cropBoxData.left,
+ top: cropBoxData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ };
+ }
+
+ return data || {};
+ },
+
+
+ /**
+ * Set the crop box position and size with new data.
+ * @param {Object} data - The new crop box data.
+ * @returns {Object} this
+ */
+ setCropBoxData: function setCropBoxData(data) {
+ var cropBoxData = this.cropBoxData;
+ var aspectRatio = this.options.aspectRatio;
+
+ var widthChanged = void 0;
+ var heightChanged = void 0;
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ cropBoxData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ cropBoxData.top = data.top;
+ }
+
+ if (isNumber(data.width) && data.width !== cropBoxData.width) {
+ widthChanged = true;
+ cropBoxData.width = data.width;
+ }
+
+ if (isNumber(data.height) && data.height !== cropBoxData.height) {
+ heightChanged = true;
+ cropBoxData.height = data.height;
+ }
+
+ if (aspectRatio) {
+ if (widthChanged) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else if (heightChanged) {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.renderCropBox();
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get a canvas drawn the cropped image.
+ * @param {Object} [options={}] - The config options.
+ * @returns {HTMLCanvasElement} - The result canvas.
+ */
+ getCroppedCanvas: function getCroppedCanvas() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ if (!this.ready || !window.HTMLCanvasElement) {
+ return null;
+ }
+
+ var canvasData = this.canvasData;
+
+ var source = getSourceCanvas(this.image, this.imageData, canvasData, options);
+
+ // Returns the source canvas if it is not cropped.
+ if (!this.cropped) {
+ return source;
+ }
+
+ var _getData = this.getData(),
+ x = _getData.x,
+ y = _getData.y,
+ initialWidth = _getData.width,
+ initialHeight = _getData.height;
+
+ var aspectRatio = initialWidth / initialHeight;
+ var maxSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.maxWidth || Infinity,
+ height: options.maxHeight || Infinity
+ });
+ var minSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.minWidth || 0,
+ height: options.minHeight || 0
+ });
+
+ var _getContainSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.width || initialWidth,
+ height: options.height || initialHeight
+ }),
+ width = _getContainSizes.width,
+ height = _getContainSizes.height;
+
+ width = Math.min(maxSizes.width, Math.max(minSizes.width, width));
+ height = Math.min(maxSizes.height, Math.max(minSizes.height, height));
+
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+
+ context.fillStyle = options.fillColor || 'transparent';
+ context.fillRect(0, 0, width, height);
+
+ var _options$imageSmoothi = options.imageSmoothingEnabled,
+ imageSmoothingEnabled = _options$imageSmoothi === undefined ? true : _options$imageSmoothi,
+ imageSmoothingQuality = options.imageSmoothingQuality;
+
+
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+
+ if (imageSmoothingQuality) {
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ }
+
+ // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage
+ var sourceWidth = source.width;
+ var sourceHeight = source.height;
+
+ // Source canvas parameters
+ var srcX = x;
+ var srcY = y;
+ var srcWidth = void 0;
+ var srcHeight = void 0;
+
+ // Destination canvas parameters
+ var dstX = void 0;
+ var dstY = void 0;
+ var dstWidth = void 0;
+ var dstHeight = void 0;
+
+ if (srcX <= -initialWidth || srcX > sourceWidth) {
+ srcX = 0;
+ srcWidth = 0;
+ dstX = 0;
+ dstWidth = 0;
+ } else if (srcX <= 0) {
+ dstX = -srcX;
+ srcX = 0;
+ srcWidth = Math.min(sourceWidth, initialWidth + srcX);
+ dstWidth = srcWidth;
+ } else if (srcX <= sourceWidth) {
+ dstX = 0;
+ srcWidth = Math.min(initialWidth, sourceWidth - srcX);
+ dstWidth = srcWidth;
+ }
+
+ if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {
+ srcY = 0;
+ srcHeight = 0;
+ dstY = 0;
+ dstHeight = 0;
+ } else if (srcY <= 0) {
+ dstY = -srcY;
+ srcY = 0;
+ srcHeight = Math.min(sourceHeight, initialHeight + srcY);
+ dstHeight = srcHeight;
+ } else if (srcY <= sourceHeight) {
+ dstY = 0;
+ srcHeight = Math.min(initialHeight, sourceHeight - srcY);
+ dstHeight = srcHeight;
+ }
+
+ // All the numerical parameters should be integer for `drawImage`
+ // https://github.com/fengyuanchen/cropper/issues/476
+ var params = [srcX, srcY, srcWidth, srcHeight];
+
+ // Avoid "IndexSizeError"
+ if (dstWidth > 0 && dstHeight > 0) {
+ var scale = width / initialWidth;
+
+ params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
+ }
+
+ context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) {
+ return Math.floor(normalizeDecimalNumber(param));
+ }))));
+
+ return canvas;
+ },
+
+
+ /**
+ * Change the aspect ratio of the crop box.
+ * @param {number} aspectRatio - The new aspect ratio.
+ * @returns {Object} this
+ */
+ setAspectRatio: function setAspectRatio(aspectRatio) {
+ var options = this.options;
+
+
+ if (!this.disabled && !isUndefined(aspectRatio)) {
+ // 0 -> NaN
+ options.aspectRatio = Math.max(0, aspectRatio) || NaN;
+
+ if (this.ready) {
+ this.initCropBox();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Change the drag mode.
+ * @param {string} mode - The new drag mode.
+ * @returns {Object} this
+ */
+ setDragMode: function setDragMode(mode) {
+ var options = this.options,
+ dragBox = this.dragBox,
+ face = this.face;
+
+
+ if (this.loaded && !this.disabled) {
+ var croppable = mode === DRAG_MODE_CROP;
+ var movable = options.movable && mode === DRAG_MODE_MOVE;
+
+ mode = croppable || movable ? mode : DRAG_MODE_NONE;
+
+ setData(dragBox, DATA_ACTION, mode);
+ toggleClass(dragBox, CLASS_CROP, croppable);
+ toggleClass(dragBox, CLASS_MOVE, movable);
+
+ if (!options.cropBoxMovable) {
+ // Sync drag mode to crop box when it is not movable
+ setData(face, DATA_ACTION, mode);
+ toggleClass(face, CLASS_CROP, croppable);
+ toggleClass(face, CLASS_MOVE, movable);
+ }
+ }
+
+ return this;
+ }
+};
+
+var AnotherCropper = WINDOW.Cropper;
+
+var Cropper = function () {
+ /**
+ * Create a new Cropper.
+ * @param {Element} element - The target element for cropping.
+ * @param {Object} [options={}] - The configuration options.
+ */
+ function Cropper(element) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ classCallCheck(this, Cropper);
+
+ if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {
+ throw new Error('The first argument is required and must be an <img> or <canvas> element.');
+ }
+
+ this.element = element;
+ this.options = extend({}, DEFAULTS, isPlainObject(options) && options);
+ this.complete = false;
+ this.cropped = false;
+ this.disabled = false;
+ this.isImg = false;
+ this.limited = false;
+ this.loaded = false;
+ this.ready = false;
+ this.replaced = false;
+ this.wheeling = false;
+ this.originalUrl = '';
+ this.canvasData = null;
+ this.cropBoxData = null;
+ this.previews = null;
+ this.pointers = {};
+ this.init();
+ }
+
+ createClass(Cropper, [{
+ key: 'init',
+ value: function init() {
+ var element = this.element;
+
+ var tagName = element.tagName.toLowerCase();
+ var url = void 0;
+
+ if (getData(element, NAMESPACE)) {
+ return;
+ }
+
+ setData(element, NAMESPACE, this);
+
+ if (tagName === 'img') {
+ this.isImg = true;
+
+ // e.g.: "img/picture.jpg"
+ url = element.getAttribute('src') || '';
+ this.originalUrl = url;
+
+ // Stop when it's a blank image
+ if (!url) {
+ return;
+ }
+
+ // e.g.: "http://example.com/img/picture.jpg"
+ url = element.src;
+ } else if (tagName === 'canvas' && window.HTMLCanvasElement) {
+ url = element.toDataURL();
+ }
+
+ this.load(url);
+ }
+ }, {
+ key: 'load',
+ value: function load(url) {
+ var _this = this;
+
+ if (!url) {
+ return;
+ }
+
+ this.url = url;
+ this.imageData = {};
+
+ var element = this.element,
+ options = this.options;
+
+
+ if (!options.checkOrientation || !window.ArrayBuffer) {
+ this.clone();
+ return;
+ }
+
+ // XMLHttpRequest disallows to open a Data URL in some browsers like IE11 and Safari
+ if (REGEXP_DATA_URL.test(url)) {
+ if (REGEXP_DATA_URL_JPEG.test(url)) {
+ this.read(dataURLToArrayBuffer(url));
+ } else {
+ this.clone();
+ }
+
+ return;
+ }
+
+ var xhr = new XMLHttpRequest();
+
+ xhr.onerror = function () {
+ _this.clone();
+ };
+
+ xhr.onload = function () {
+ _this.read(xhr.response);
+ };
+
+ if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {
+ url = addTimestamp(url);
+ }
+
+ xhr.open('get', url);
+ xhr.responseType = 'arraybuffer';
+ xhr.withCredentials = element.crossOrigin === 'use-credentials';
+ xhr.send();
+ }
+ }, {
+ key: 'read',
+ value: function read(arrayBuffer) {
+ var options = this.options,
+ imageData = this.imageData;
+
+ var orientation = getOrientation(arrayBuffer);
+ var rotate = 0;
+ var scaleX = 1;
+ var scaleY = 1;
+
+ if (orientation > 1) {
+ this.url = arrayBufferToDataURL(arrayBuffer, 'image/jpeg');
+
+ var _parseOrientation = parseOrientation(orientation);
+
+ rotate = _parseOrientation.rotate;
+ scaleX = _parseOrientation.scaleX;
+ scaleY = _parseOrientation.scaleY;
+ }
+
+ if (options.rotatable) {
+ imageData.rotate = rotate;
+ }
+
+ if (options.scalable) {
+ imageData.scaleX = scaleX;
+ imageData.scaleY = scaleY;
+ }
+
+ this.clone();
+ }
+ }, {
+ key: 'clone',
+ value: function clone() {
+ var element = this.element,
+ url = this.url;
+
+ var crossOrigin = void 0;
+ var crossOriginUrl = void 0;
+
+ if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {
+ crossOrigin = element.crossOrigin;
+
+
+ if (crossOrigin) {
+ crossOriginUrl = url;
+ } else {
+ crossOrigin = 'anonymous';
+
+ // Bust cache when there is not a "crossOrigin" property
+ crossOriginUrl = addTimestamp(url);
+ }
+ }
+
+ this.crossOrigin = crossOrigin;
+ this.crossOriginUrl = crossOriginUrl;
+
+ var image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = crossOriginUrl || url;
+
+ var start = proxy(this.start, this);
+ var stop = proxy(this.stop, this);
+
+ this.image = image;
+ this.onStart = start;
+ this.onStop = stop;
+
+ if (this.isImg) {
+ if (element.complete) {
+ this.start();
+ } else {
+ addListener(element, EVENT_LOAD, start);
+ }
+ } else {
+ addListener(image, EVENT_LOAD, start);
+ addListener(image, EVENT_ERROR, stop);
+ addClass(image, CLASS_HIDE);
+ element.parentNode.insertBefore(image, element.nextSibling);
+ }
+ }
+ }, {
+ key: 'start',
+ value: function start(event) {
+ var _this2 = this;
+
+ var image = this.isImg ? this.element : this.image;
+
+ if (event) {
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ }
+
+ getImageNaturalSizes(image, function (naturalWidth, naturalHeight) {
+ extend(_this2.imageData, {
+ naturalWidth: naturalWidth,
+ naturalHeight: naturalHeight,
+ aspectRatio: naturalWidth / naturalHeight
+ });
+ _this2.loaded = true;
+ _this2.build();
+ });
+ }
+ }, {
+ key: 'stop',
+ value: function stop() {
+ var image = this.image;
+
+
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ image.parentNode.removeChild(image);
+ this.image = null;
+ }
+ }, {
+ key: 'build',
+ value: function build() {
+ var _this3 = this;
+
+ if (!this.loaded) {
+ return;
+ }
+
+ // Unbuild first when replace
+ if (this.ready) {
+ this.unbuild();
+ }
+
+ var element = this.element,
+ options = this.options,
+ image = this.image;
+
+ // Create cropper elements
+
+ var container = element.parentNode;
+ var template = document.createElement('div');
+
+ template.innerHTML = TEMPLATE;
+
+ var cropper = template.querySelector('.' + NAMESPACE + '-container');
+ var canvas = cropper.querySelector('.' + NAMESPACE + '-canvas');
+ var dragBox = cropper.querySelector('.' + NAMESPACE + '-drag-box');
+ var cropBox = cropper.querySelector('.' + NAMESPACE + '-crop-box');
+ var face = cropBox.querySelector('.' + NAMESPACE + '-face');
+
+ this.container = container;
+ this.cropper = cropper;
+ this.canvas = canvas;
+ this.dragBox = dragBox;
+ this.cropBox = cropBox;
+ this.viewBox = cropper.querySelector('.' + NAMESPACE + '-view-box');
+ this.face = face;
+
+ canvas.appendChild(image);
+
+ // Hide the original image
+ addClass(element, CLASS_HIDDEN);
+
+ // Inserts the cropper after to the current image
+ container.insertBefore(cropper, element.nextSibling);
+
+ // Show the image if is hidden
+ if (!this.isImg) {
+ removeClass(image, CLASS_HIDE);
+ }
+
+ this.initPreview();
+ this.bind();
+
+ options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;
+ options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;
+
+ this.cropped = options.autoCrop;
+
+ if (options.autoCrop) {
+ if (options.modal) {
+ addClass(dragBox, CLASS_MODAL);
+ }
+ } else {
+ addClass(cropBox, CLASS_HIDDEN);
+ }
+
+ if (!options.guides) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-dashed'), CLASS_HIDDEN);
+ }
+
+ if (!options.center) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-center'), CLASS_HIDDEN);
+ }
+
+ if (options.background) {
+ addClass(cropper, NAMESPACE + '-bg');
+ }
+
+ if (!options.highlight) {
+ addClass(face, CLASS_INVISIBLE);
+ }
+
+ if (options.cropBoxMovable) {
+ addClass(face, CLASS_MOVE);
+ setData(face, DATA_ACTION, ACTION_ALL);
+ }
+
+ if (!options.cropBoxResizable) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-line'), CLASS_HIDDEN);
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-point'), CLASS_HIDDEN);
+ }
+
+ this.setDragMode(options.dragMode);
+ this.render();
+ this.ready = true;
+ this.setData(options.data);
+
+ // Call the "ready" option asynchronously to keep "image.cropper" is defined
+ this.completing = setTimeout(function () {
+ if (isFunction(options.ready)) {
+ addListener(element, EVENT_READY, options.ready, {
+ once: true
+ });
+ }
+
+ dispatchEvent(element, EVENT_READY);
+ dispatchEvent(element, EVENT_CROP, _this3.getData());
+
+ _this3.complete = true;
+ }, 0);
+ }
+ }, {
+ key: 'unbuild',
+ value: function unbuild() {
+ if (!this.ready) {
+ return;
+ }
+
+ if (!this.complete) {
+ clearTimeout(this.completing);
+ }
+
+ this.ready = false;
+ this.complete = false;
+ this.initialImageData = null;
+
+ // Clear `initialCanvasData` is necessary when replace
+ this.initialCanvasData = null;
+ this.initialCropBoxData = null;
+ this.containerData = null;
+ this.canvasData = null;
+
+ // Clear `cropBoxData` is necessary when replace
+ this.cropBoxData = null;
+ this.unbind();
+ this.resetPreview();
+ this.previews = null;
+ this.viewBox = null;
+ this.cropBox = null;
+ this.dragBox = null;
+ this.canvas = null;
+ this.container = null;
+ this.cropper.parentNode.removeChild(this.cropper);
+ this.cropper = null;
+ }
+
+ /**
+ * Get the no conflict cropper class.
+ * @returns {Cropper} The cropper class.
+ */
+
+ }], [{
+ key: 'noConflict',
+ value: function noConflict() {
+ window.Cropper = AnotherCropper;
+ return Cropper;
+ }
+
+ /**
+ * Change the default options.
+ * @param {Object} options - The new default options.
+ */
+
+ }, {
+ key: 'setDefaults',
+ value: function setDefaults(options) {
+ extend(DEFAULTS, isPlainObject(options) && options);
+ }
+ }]);
+ return Cropper;
+}();
+
+extend(Cropper.prototype, render, preview, events, handlers, change, methods);
+
+export default Cropper;
diff --git a/library/cropperjs/dist/cropper.js b/library/cropperjs/dist/cropper.js
new file mode 100644
index 000000000..0e837953c
--- /dev/null
+++ b/library/cropperjs/dist/cropper.js
@@ -0,0 +1,3766 @@
+/*!
+ * Cropper.js v1.2.2
+ * https://github.com/fengyuanchen/cropperjs
+ *
+ * Copyright (c) 2015-2018 Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2018-01-03T13:27:18.062Z
+ */
+
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global.Cropper = factory());
+}(this, (function () { 'use strict';
+
+var WINDOW = typeof window !== 'undefined' ? window : {};
+var NAMESPACE = 'cropper';
+
+// Actions
+var ACTION_ALL = 'all';
+var ACTION_CROP = 'crop';
+var ACTION_MOVE = 'move';
+var ACTION_ZOOM = 'zoom';
+var ACTION_EAST = 'e';
+var ACTION_WEST = 'w';
+var ACTION_SOUTH = 's';
+var ACTION_NORTH = 'n';
+var ACTION_NORTH_EAST = 'ne';
+var ACTION_NORTH_WEST = 'nw';
+var ACTION_SOUTH_EAST = 'se';
+var ACTION_SOUTH_WEST = 'sw';
+
+// Classes
+var CLASS_CROP = NAMESPACE + '-crop';
+var CLASS_DISABLED = NAMESPACE + '-disabled';
+var CLASS_HIDDEN = NAMESPACE + '-hidden';
+var CLASS_HIDE = NAMESPACE + '-hide';
+var CLASS_INVISIBLE = NAMESPACE + '-invisible';
+var CLASS_MODAL = NAMESPACE + '-modal';
+var CLASS_MOVE = NAMESPACE + '-move';
+
+// Data keys
+var DATA_ACTION = 'action';
+var DATA_PREVIEW = 'preview';
+
+// Drag modes
+var DRAG_MODE_CROP = 'crop';
+var DRAG_MODE_MOVE = 'move';
+var DRAG_MODE_NONE = 'none';
+
+// Events
+var EVENT_CROP = 'crop';
+var EVENT_CROP_END = 'cropend';
+var EVENT_CROP_MOVE = 'cropmove';
+var EVENT_CROP_START = 'cropstart';
+var EVENT_DBLCLICK = 'dblclick';
+var EVENT_ERROR = 'error';
+var EVENT_LOAD = 'load';
+var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
+var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove';
+var EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup';
+var EVENT_READY = 'ready';
+var EVENT_RESIZE = 'resize';
+var EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll';
+var EVENT_ZOOM = 'zoom';
+
+// RegExps
+var REGEXP_ACTIONS = /^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/;
+var REGEXP_DATA_URL = /^data:/;
+var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
+var REGEXP_TAG_NAME = /^(img|canvas)$/i;
+
+var DEFAULTS = {
+ // Define the view mode of the cropper
+ viewMode: 0, // 0, 1, 2, 3
+
+ // Define the dragging mode of the cropper
+ dragMode: DRAG_MODE_CROP, // 'crop', 'move' or 'none'
+
+ // Define the aspect ratio of the crop box
+ aspectRatio: NaN,
+
+ // An object with the previous cropping result data
+ data: null,
+
+ // A selector for adding extra containers to preview
+ preview: '',
+
+ // Re-render the cropper when resize the window
+ responsive: true,
+
+ // Restore the cropped area after resize the window
+ restore: true,
+
+ // Check if the current image is a cross-origin image
+ checkCrossOrigin: true,
+
+ // Check the current image's Exif Orientation information
+ checkOrientation: true,
+
+ // Show the black modal
+ modal: true,
+
+ // Show the dashed lines for guiding
+ guides: true,
+
+ // Show the center indicator for guiding
+ center: true,
+
+ // Show the white modal to highlight the crop box
+ highlight: true,
+
+ // Show the grid background
+ background: true,
+
+ // Enable to crop the image automatically when initialize
+ autoCrop: true,
+
+ // Define the percentage of automatic cropping area when initializes
+ autoCropArea: 0.8,
+
+ // Enable to move the image
+ movable: true,
+
+ // Enable to rotate the image
+ rotatable: true,
+
+ // Enable to scale the image
+ scalable: true,
+
+ // Enable to zoom the image
+ zoomable: true,
+
+ // Enable to zoom the image by dragging touch
+ zoomOnTouch: true,
+
+ // Enable to zoom the image by wheeling mouse
+ zoomOnWheel: true,
+
+ // Define zoom ratio when zoom the image by wheeling mouse
+ wheelZoomRatio: 0.1,
+
+ // Enable to move the crop box
+ cropBoxMovable: true,
+
+ // Enable to resize the crop box
+ cropBoxResizable: true,
+
+ // Toggle drag mode between "crop" and "move" when click twice on the cropper
+ toggleDragModeOnDblclick: true,
+
+ // Size limitation
+ minCanvasWidth: 0,
+ minCanvasHeight: 0,
+ minCropBoxWidth: 0,
+ minCropBoxHeight: 0,
+ minContainerWidth: 200,
+ minContainerHeight: 100,
+
+ // Shortcuts of events
+ ready: null,
+ cropstart: null,
+ cropmove: null,
+ cropend: null,
+ crop: null,
+ zoom: null
+};
+
+var TEMPLATE = '<div class="cropper-container">' + '<div class="cropper-wrap-box">' + '<div class="cropper-canvas"></div>' + '</div>' + '<div class="cropper-drag-box"></div>' + '<div class="cropper-crop-box">' + '<span class="cropper-view-box"></span>' + '<span class="cropper-dashed dashed-h"></span>' + '<span class="cropper-dashed dashed-v"></span>' + '<span class="cropper-center"></span>' + '<span class="cropper-face"></span>' + '<span class="cropper-line line-e" data-action="e"></span>' + '<span class="cropper-line line-n" data-action="n"></span>' + '<span class="cropper-line line-w" data-action="w"></span>' + '<span class="cropper-line line-s" data-action="s"></span>' + '<span class="cropper-point point-e" data-action="e"></span>' + '<span class="cropper-point point-n" data-action="n"></span>' + '<span class="cropper-point point-w" data-action="w"></span>' + '<span class="cropper-point point-s" data-action="s"></span>' + '<span class="cropper-point point-ne" data-action="ne"></span>' + '<span class="cropper-point point-nw" data-action="nw"></span>' + '<span class="cropper-point point-sw" data-action="sw"></span>' + '<span class="cropper-point point-se" data-action="se"></span>' + '</div>' + '</div>';
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
+ return typeof obj;
+} : function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+};
+
+
+
+
+
+
+
+
+
+
+
+var classCallCheck = function (instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+};
+
+var createClass = function () {
+ function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+
+ return function (Constructor, protoProps, staticProps) {
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) defineProperties(Constructor, staticProps);
+ return Constructor;
+ };
+}();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var toConsumableArray = function (arr) {
+ if (Array.isArray(arr)) {
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
+
+ return arr2;
+ } else {
+ return Array.from(arr);
+ }
+};
+
+/**
+ * Check if the given value is not a number.
+ */
+var isNaN = Number.isNaN || WINDOW.isNaN;
+
+/**
+ * Check if the given value is a number.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a number, else `false`.
+ */
+function isNumber(value) {
+ return typeof value === 'number' && !isNaN(value);
+}
+
+/**
+ * Check if the given value is undefined.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is undefined, else `false`.
+ */
+function isUndefined(value) {
+ return typeof value === 'undefined';
+}
+
+/**
+ * Check if the given value is an object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is an object, else `false`.
+ */
+function isObject(value) {
+ return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null;
+}
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Check if the given value is a plain object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
+ */
+
+function isPlainObject(value) {
+ if (!isObject(value)) {
+ return false;
+ }
+
+ try {
+ var _constructor = value.constructor;
+ var prototype = _constructor.prototype;
+
+
+ return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
+ } catch (e) {
+ return false;
+ }
+}
+
+/**
+ * Check if the given value is a function.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a function, else `false`.
+ */
+function isFunction(value) {
+ return typeof value === 'function';
+}
+
+/**
+ * Iterate the given data.
+ * @param {*} data - The data to iterate.
+ * @param {Function} callback - The process function for each element.
+ * @returns {*} The original data.
+ */
+function each(data, callback) {
+ if (data && isFunction(callback)) {
+ if (Array.isArray(data) || isNumber(data.length) /* array-like */) {
+ var length = data.length;
+
+ var i = void 0;
+
+ for (i = 0; i < length; i += 1) {
+ if (callback.call(data, data[i], i, data) === false) {
+ break;
+ }
+ }
+ } else if (isObject(data)) {
+ Object.keys(data).forEach(function (key) {
+ callback.call(data, data[key], key, data);
+ });
+ }
+ }
+
+ return data;
+}
+
+/**
+ * Extend the given object.
+ * @param {*} obj - The object to be extended.
+ * @param {*} args - The rest objects which will be merged to the first object.
+ * @returns {Object} The extended object.
+ */
+function extend(obj) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ if (isObject(obj) && args.length > 0) {
+ if (Object.assign) {
+ return Object.assign.apply(Object, [obj].concat(args));
+ }
+
+ args.forEach(function (arg) {
+ if (isObject(arg)) {
+ Object.keys(arg).forEach(function (key) {
+ obj[key] = arg[key];
+ });
+ }
+ });
+ }
+
+ return obj;
+}
+
+/**
+ * Takes a function and returns a new one that will always have a particular context.
+ * @param {Function} fn - The target function.
+ * @param {Object} context - The new context for the function.
+ * @returns {boolean} The new function.
+ */
+function proxy(fn, context) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
+ args[_key2 - 2] = arguments[_key2];
+ }
+
+ return function () {
+ for (var _len3 = arguments.length, args2 = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
+ args2[_key3] = arguments[_key3];
+ }
+
+ return fn.apply(context, args.concat(args2));
+ };
+}
+
+var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/i;
+
+/**
+ * Normalize decimal number.
+ * Check out {@link http://0.30000000000000004.com/ }
+ * @param {number} value - The value to normalize.
+ * @param {number} [times=100000000000] - The times for normalizing.
+ * @returns {number} Returns the normalized number.
+ */
+function normalizeDecimalNumber(value) {
+ var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;
+
+ return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;
+}
+
+var REGEXP_SUFFIX = /^(width|height|left|top|marginLeft|marginTop)$/;
+
+/**
+ * Apply styles to the given element.
+ * @param {Element} element - The target element.
+ * @param {Object} styles - The styles for applying.
+ */
+function setStyle(element, styles) {
+ var style = element.style;
+
+
+ each(styles, function (value, property) {
+ if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
+ value += 'px';
+ }
+
+ style[property] = value;
+ });
+}
+
+/**
+ * Check if the given element has a special class.
+ * @param {Element} element - The element to check.
+ * @param {string} value - The class to search.
+ * @returns {boolean} Returns `true` if the special class was found.
+ */
+function hasClass(element, value) {
+ return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;
+}
+
+/**
+ * Add classes to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be added.
+ */
+function addClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ addClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.add(value);
+ return;
+ }
+
+ var className = element.className.trim();
+
+ if (!className) {
+ element.className = value;
+ } else if (className.indexOf(value) < 0) {
+ element.className = className + ' ' + value;
+ }
+}
+
+/**
+ * Remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be removed.
+ */
+function removeClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ removeClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.remove(value);
+ return;
+ }
+
+ if (element.className.indexOf(value) >= 0) {
+ element.className = element.className.replace(value, '');
+ }
+}
+
+/**
+ * Add or remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be toggled.
+ * @param {boolean} added - Add only.
+ */
+function toggleClass(element, value, added) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ toggleClass(elem, value, added);
+ });
+ return;
+ }
+
+ // IE10-11 doesn't support the second parameter of `classList.toggle`
+ if (added) {
+ addClass(element, value);
+ } else {
+ removeClass(element, value);
+ }
+}
+
+var REGEXP_HYPHENATE = /([a-z\d])([A-Z])/g;
+
+/**
+ * Hyphenate the given value.
+ * @param {string} value - The value to hyphenate.
+ * @returns {string} The hyphenated value.
+ */
+function hyphenate(value) {
+ return value.replace(REGEXP_HYPHENATE, '$1-$2').toLowerCase();
+}
+
+/**
+ * Get data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to get.
+ * @returns {string} The data value.
+ */
+function getData(element, name) {
+ if (isObject(element[name])) {
+ return element[name];
+ } else if (element.dataset) {
+ return element.dataset[name];
+ }
+
+ return element.getAttribute('data-' + hyphenate(name));
+}
+
+/**
+ * Set data to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to set.
+ * @param {string} data - The data value.
+ */
+function setData(element, name, data) {
+ if (isObject(data)) {
+ element[name] = data;
+ } else if (element.dataset) {
+ element.dataset[name] = data;
+ } else {
+ element.setAttribute('data-' + hyphenate(name), data);
+ }
+}
+
+/**
+ * Remove data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to remove.
+ */
+function removeData(element, name) {
+ if (isObject(element[name])) {
+ try {
+ delete element[name];
+ } catch (e) {
+ element[name] = null;
+ }
+ } else if (element.dataset) {
+ // #128 Safari not allows to delete dataset property
+ try {
+ delete element.dataset[name];
+ } catch (e) {
+ element.dataset[name] = null;
+ }
+ } else {
+ element.removeAttribute('data-' + hyphenate(name));
+ }
+}
+
+var REGEXP_SPACES = /\s+/;
+
+/**
+ * Remove event listener from the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+function removeListener(element, type, listener) {
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ if (!isFunction(listener)) {
+ return;
+ }
+
+ var types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, function (t) {
+ removeListener(element, t, listener, options);
+ });
+ return;
+ }
+
+ if (element.removeEventListener) {
+ element.removeEventListener(type, listener, options);
+ } else if (element.detachEvent) {
+ element.detachEvent('on' + type, listener);
+ }
+}
+
+/**
+ * Add event listener to the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+function addListener(element, type, _listener) {
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ if (!isFunction(_listener)) {
+ return;
+ }
+
+ var types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, function (t) {
+ addListener(element, t, _listener, options);
+ });
+ return;
+ }
+
+ if (options.once) {
+ var originalListener = _listener;
+
+ _listener = function listener() {
+ for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
+ args[_key4] = arguments[_key4];
+ }
+
+ removeListener(element, type, _listener, options);
+ return originalListener.apply(element, args);
+ };
+ }
+
+ if (element.addEventListener) {
+ element.addEventListener(type, _listener, options);
+ } else if (element.attachEvent) {
+ element.attachEvent('on' + type, _listener);
+ }
+}
+
+/**
+ * Dispatch event on the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Object} data - The additional event data.
+ * @returns {boolean} Indicate if the event is default prevented or not.
+ */
+function dispatchEvent(element, type, data) {
+ if (element.dispatchEvent) {
+ var event = void 0;
+
+ // Event and CustomEvent on IE9-11 are global objects, not constructors
+ if (isFunction(Event) && isFunction(CustomEvent)) {
+ if (isUndefined(data)) {
+ event = new Event(type, {
+ bubbles: true,
+ cancelable: true
+ });
+ } else {
+ event = new CustomEvent(type, {
+ detail: data,
+ bubbles: true,
+ cancelable: true
+ });
+ }
+ } else if (isUndefined(data)) {
+ event = document.createEvent('Event');
+ event.initEvent(type, true, true);
+ } else {
+ event = document.createEvent('CustomEvent');
+ event.initCustomEvent(type, true, true, data);
+ }
+
+ // IE9+
+ return element.dispatchEvent(event);
+ } else if (element.fireEvent) {
+ // IE6-10 (native events only)
+ return element.fireEvent('on' + type);
+ }
+
+ return true;
+}
+
+/**
+ * Get the offset base on the document.
+ * @param {Element} element - The target element.
+ * @returns {Object} The offset data.
+ */
+function getOffset(element) {
+ var doc = document.documentElement;
+ var box = element.getBoundingClientRect();
+
+ return {
+ left: box.left + ((window.scrollX || doc && doc.scrollLeft || 0) - (doc && doc.clientLeft || 0)),
+ top: box.top + ((window.scrollY || doc && doc.scrollTop || 0) - (doc && doc.clientTop || 0))
+ };
+}
+
+/**
+ * Empty an element.
+ * @param {Element} element - The element to empty.
+ */
+function empty(element) {
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+
+var location = WINDOW.location;
+
+var REGEXP_ORIGINS = /^(https?:)\/\/([^:/?#]+):?(\d*)/i;
+
+/**
+ * Check if the given URL is a cross origin URL.
+ * @param {string} url - The target URL.
+ * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.
+ */
+function isCrossOriginURL(url) {
+ var parts = url.match(REGEXP_ORIGINS);
+
+ return parts && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);
+}
+
+/**
+ * Add timestamp to the given URL.
+ * @param {string} url - The target URL.
+ * @returns {string} The result URL.
+ */
+function addTimestamp(url) {
+ var timestamp = 'timestamp=' + new Date().getTime();
+
+ return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp;
+}
+
+/**
+ * Get transforms base on the given object.
+ * @param {Object} obj - The target object.
+ * @returns {string} A string contains transform values.
+ */
+function getTransforms(_ref) {
+ var rotate = _ref.rotate,
+ scaleX = _ref.scaleX,
+ scaleY = _ref.scaleY,
+ translateX = _ref.translateX,
+ translateY = _ref.translateY;
+
+ var values = [];
+
+ if (isNumber(translateX) && translateX !== 0) {
+ values.push('translateX(' + translateX + 'px)');
+ }
+
+ if (isNumber(translateY) && translateY !== 0) {
+ values.push('translateY(' + translateY + 'px)');
+ }
+
+ // Rotate should come first before scale to match orientation transform
+ if (isNumber(rotate) && rotate !== 0) {
+ values.push('rotate(' + rotate + 'deg)');
+ }
+
+ if (isNumber(scaleX) && scaleX !== 1) {
+ values.push('scaleX(' + scaleX + ')');
+ }
+
+ if (isNumber(scaleY) && scaleY !== 1) {
+ values.push('scaleY(' + scaleY + ')');
+ }
+
+ var transform = values.length ? values.join(' ') : 'none';
+
+ return {
+ WebkitTransform: transform,
+ msTransform: transform,
+ transform: transform
+ };
+}
+
+var navigator = WINDOW.navigator;
+
+var IS_SAFARI_OR_UIWEBVIEW = navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);
+
+/**
+ * Get an image's natural sizes.
+ * @param {string} image - The target image.
+ * @param {Function} callback - The callback function.
+ */
+function getImageNaturalSizes(image, callback) {
+ // Modern browsers (except Safari)
+ if (image.naturalWidth && !IS_SAFARI_OR_UIWEBVIEW) {
+ callback(image.naturalWidth, image.naturalHeight);
+ return;
+ }
+
+ var newImage = document.createElement('img');
+ var body = document.body || document.documentElement;
+
+ newImage.onload = function () {
+ callback(newImage.width, newImage.height);
+
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ body.removeChild(newImage);
+ }
+ };
+
+ newImage.src = image.src;
+
+ // iOS Safari will convert the image automatically
+ // with its orientation once append it into DOM (#279)
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ newImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';
+ body.appendChild(newImage);
+ }
+}
+
+/**
+ * Get the max ratio of a group of pointers.
+ * @param {string} pointers - The target pointers.
+ * @returns {number} The result ratio.
+ */
+function getMaxZoomRatio(pointers) {
+ var pointers2 = extend({}, pointers);
+ var ratios = [];
+
+ each(pointers, function (pointer, pointerId) {
+ delete pointers2[pointerId];
+
+ each(pointers2, function (pointer2) {
+ var x1 = Math.abs(pointer.startX - pointer2.startX);
+ var y1 = Math.abs(pointer.startY - pointer2.startY);
+ var x2 = Math.abs(pointer.endX - pointer2.endX);
+ var y2 = Math.abs(pointer.endY - pointer2.endY);
+ var z1 = Math.sqrt(x1 * x1 + y1 * y1);
+ var z2 = Math.sqrt(x2 * x2 + y2 * y2);
+ var ratio = (z2 - z1) / z1;
+
+ ratios.push(ratio);
+ });
+ });
+
+ ratios.sort(function (a, b) {
+ return Math.abs(a) < Math.abs(b);
+ });
+
+ return ratios[0];
+}
+
+/**
+ * Get a pointer from an event object.
+ * @param {Object} event - The target event object.
+ * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
+ * @returns {Object} The result pointer contains start and/or end point coordinates.
+ */
+function getPointer(_ref2, endOnly) {
+ var pageX = _ref2.pageX,
+ pageY = _ref2.pageY;
+
+ var end = {
+ endX: pageX,
+ endY: pageY
+ };
+
+ if (endOnly) {
+ return end;
+ }
+
+ return extend({
+ startX: pageX,
+ startY: pageY
+ }, end);
+}
+
+/**
+ * Get the center point coordinate of a group of pointers.
+ * @param {Object} pointers - The target pointers.
+ * @returns {Object} The center point coordinate.
+ */
+function getPointersCenter(pointers) {
+ var pageX = 0;
+ var pageY = 0;
+ var count = 0;
+
+ each(pointers, function (_ref3) {
+ var startX = _ref3.startX,
+ startY = _ref3.startY;
+
+ pageX += startX;
+ pageY += startY;
+ count += 1;
+ });
+
+ pageX /= count;
+ pageY /= count;
+
+ return {
+ pageX: pageX,
+ pageY: pageY
+ };
+}
+
+/**
+ * Check if the given value is a finite number.
+ */
+var isFinite = Number.isFinite || WINDOW.isFinite;
+
+/**
+ * Get the max sizes in a rectangle under the given aspect ratio.
+ * @param {Object} data - The original sizes.
+ * @returns {Object} The result sizes.
+ */
+function getContainSizes(_ref4) {
+ var aspectRatio = _ref4.aspectRatio,
+ height = _ref4.height,
+ width = _ref4.width;
+
+ var isValidNumber = function isValidNumber(value) {
+ return isFinite(value) && value > 0;
+ };
+
+ if (isValidNumber(width) && isValidNumber(height)) {
+ if (height * aspectRatio > width) {
+ height = width / aspectRatio;
+ } else {
+ width = height * aspectRatio;
+ }
+ } else if (isValidNumber(width)) {
+ height = width / aspectRatio;
+ } else if (isValidNumber(height)) {
+ width = height * aspectRatio;
+ }
+
+ return {
+ width: width,
+ height: height
+ };
+}
+
+/**
+ * Get the new sizes of a rectangle after rotated.
+ * @param {Object} data - The original sizes.
+ * @returns {Object} The result sizes.
+ */
+function getRotatedSizes(_ref5) {
+ var width = _ref5.width,
+ height = _ref5.height,
+ degree = _ref5.degree;
+
+ degree = Math.abs(degree) % 180;
+
+ if (degree === 90) {
+ return {
+ width: height,
+ height: width
+ };
+ }
+
+ var arc = degree % 90 * Math.PI / 180;
+ var sinArc = Math.sin(arc);
+ var cosArc = Math.cos(arc);
+ var newWidth = width * cosArc + height * sinArc;
+ var newHeight = width * sinArc + height * cosArc;
+
+ return degree > 90 ? {
+ width: newHeight,
+ height: newWidth
+ } : {
+ width: newWidth,
+ height: newHeight
+ };
+}
+
+/**
+ * Get a canvas which drew the given image.
+ * @param {HTMLImageElement} image - The image for drawing.
+ * @param {Object} imageData - The image data.
+ * @param {Object} canvasData - The canvas data.
+ * @param {Object} options - The options.
+ * @returns {HTMLCanvasElement} The result canvas.
+ */
+function getSourceCanvas(image, _ref6, _ref7, _ref8) {
+ var imageNaturalWidth = _ref6.naturalWidth,
+ imageNaturalHeight = _ref6.naturalHeight,
+ _ref6$rotate = _ref6.rotate,
+ rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
+ _ref6$scaleX = _ref6.scaleX,
+ scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
+ _ref6$scaleY = _ref6.scaleY,
+ scaleY = _ref6$scaleY === undefined ? 1 : _ref6$scaleY;
+ var aspectRatio = _ref7.aspectRatio,
+ naturalWidth = _ref7.naturalWidth,
+ naturalHeight = _ref7.naturalHeight;
+ var _ref8$fillColor = _ref8.fillColor,
+ fillColor = _ref8$fillColor === undefined ? 'transparent' : _ref8$fillColor,
+ _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled,
+ imageSmoothingEnabled = _ref8$imageSmoothingE === undefined ? true : _ref8$imageSmoothingE,
+ _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality,
+ imageSmoothingQuality = _ref8$imageSmoothingQ === undefined ? 'low' : _ref8$imageSmoothingQ,
+ _ref8$maxWidth = _ref8.maxWidth,
+ maxWidth = _ref8$maxWidth === undefined ? Infinity : _ref8$maxWidth,
+ _ref8$maxHeight = _ref8.maxHeight,
+ maxHeight = _ref8$maxHeight === undefined ? Infinity : _ref8$maxHeight,
+ _ref8$minWidth = _ref8.minWidth,
+ minWidth = _ref8$minWidth === undefined ? 0 : _ref8$minWidth,
+ _ref8$minHeight = _ref8.minHeight,
+ minHeight = _ref8$minHeight === undefined ? 0 : _ref8$minHeight;
+
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+ var maxSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: maxWidth,
+ height: maxHeight
+ });
+ var minSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: minWidth,
+ height: minHeight
+ });
+ var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
+ var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
+ var params = [-imageNaturalWidth / 2, -imageNaturalHeight / 2, imageNaturalWidth, imageNaturalHeight];
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+ context.fillStyle = fillColor;
+ context.fillRect(0, 0, width, height);
+ context.save();
+ context.translate(width / 2, height / 2);
+ context.rotate(rotate * Math.PI / 180);
+ context.scale(scaleX, scaleY);
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ context.drawImage.apply(context, [image].concat(toConsumableArray(params.map(function (param) {
+ return Math.floor(normalizeDecimalNumber(param));
+ }))));
+ context.restore();
+ return canvas;
+}
+
+var fromCharCode = String.fromCharCode;
+
+/**
+ * Get string from char code in data view.
+ * @param {DataView} dataView - The data view for read.
+ * @param {number} start - The start index.
+ * @param {number} length - The read length.
+ * @returns {string} The read result.
+ */
+
+function getStringFromCharCode(dataView, start, length) {
+ var str = '';
+ var i = void 0;
+
+ length += start;
+
+ for (i = start; i < length; i += 1) {
+ str += fromCharCode(dataView.getUint8(i));
+ }
+
+ return str;
+}
+
+var REGEXP_DATA_URL_HEAD = /^data:.*,/;
+
+/**
+ * Transform Data URL to array buffer.
+ * @param {string} dataURL - The Data URL to transform.
+ * @returns {ArrayBuffer} The result array buffer.
+ */
+function dataURLToArrayBuffer(dataURL) {
+ var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');
+ var binary = atob(base64);
+ var arrayBuffer = new ArrayBuffer(binary.length);
+ var uint8 = new Uint8Array(arrayBuffer);
+
+ each(uint8, function (value, i) {
+ uint8[i] = binary.charCodeAt(i);
+ });
+
+ return arrayBuffer;
+}
+
+/**
+ * Transform array buffer to Data URL.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.
+ * @param {string} mimeType - The mime type of the Data URL.
+ * @returns {string} The result Data URL.
+ */
+function arrayBufferToDataURL(arrayBuffer, mimeType) {
+ var uint8 = new Uint8Array(arrayBuffer);
+ var data = '';
+
+ // TypedArray.prototype.forEach is not supported in some browsers.
+ each(uint8, function (value) {
+ data += fromCharCode(value);
+ });
+
+ return 'data:' + mimeType + ';base64,' + btoa(data);
+}
+
+/**
+ * Get orientation value from given array buffer.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to read.
+ * @returns {number} The read orientation value.
+ */
+function getOrientation(arrayBuffer) {
+ var dataView = new DataView(arrayBuffer);
+ var orientation = void 0;
+ var littleEndian = void 0;
+ var app1Start = void 0;
+ var ifdStart = void 0;
+
+ // Only handle JPEG image (start by 0xFFD8)
+ if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
+ var length = dataView.byteLength;
+ var offset = 2;
+
+ while (offset < length) {
+ if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
+ app1Start = offset;
+ break;
+ }
+
+ offset += 1;
+ }
+ }
+
+ if (app1Start) {
+ var exifIDCode = app1Start + 4;
+ var tiffOffset = app1Start + 10;
+
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
+ var endianness = dataView.getUint16(tiffOffset);
+
+ littleEndian = endianness === 0x4949;
+
+ if (littleEndian || endianness === 0x4D4D /* bigEndian */) {
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
+ var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
+
+ if (firstIFDOffset >= 0x00000008) {
+ ifdStart = tiffOffset + firstIFDOffset;
+ }
+ }
+ }
+ }
+ }
+
+ if (ifdStart) {
+ var _length = dataView.getUint16(ifdStart, littleEndian);
+ var _offset = void 0;
+ var i = void 0;
+
+ for (i = 0; i < _length; i += 1) {
+ _offset = ifdStart + i * 12 + 2;
+
+ if (dataView.getUint16(_offset, littleEndian) === 0x0112 /* Orientation */) {
+ // 8 is the offset of the current tag's value
+ _offset += 8;
+
+ // Get the original orientation value
+ orientation = dataView.getUint16(_offset, littleEndian);
+
+ // Override the orientation with its default value
+ dataView.setUint16(_offset, 1, littleEndian);
+ break;
+ }
+ }
+ }
+
+ return orientation;
+}
+
+/**
+ * Parse Exif Orientation value.
+ * @param {number} orientation - The orientation to parse.
+ * @returns {Object} The parsed result.
+ */
+function parseOrientation(orientation) {
+ var rotate = 0;
+ var scaleX = 1;
+ var scaleY = 1;
+
+ switch (orientation) {
+ // Flip horizontal
+ case 2:
+ scaleX = -1;
+ break;
+
+ // Rotate left 180°
+ case 3:
+ rotate = -180;
+ break;
+
+ // Flip vertical
+ case 4:
+ scaleY = -1;
+ break;
+
+ // Flip vertical and rotate right 90°
+ case 5:
+ rotate = 90;
+ scaleY = -1;
+ break;
+
+ // Rotate right 90°
+ case 6:
+ rotate = 90;
+ break;
+
+ // Flip horizontal and rotate right 90°
+ case 7:
+ rotate = 90;
+ scaleX = -1;
+ break;
+
+ // Rotate left 90°
+ case 8:
+ rotate = -90;
+ break;
+
+ default:
+ }
+
+ return {
+ rotate: rotate,
+ scaleX: scaleX,
+ scaleY: scaleY
+ };
+}
+
+var render = {
+ render: function render() {
+ this.initContainer();
+ this.initCanvas();
+ this.initCropBox();
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ },
+ initContainer: function initContainer() {
+ var element = this.element,
+ options = this.options,
+ container = this.container,
+ cropper = this.cropper;
+
+
+ addClass(cropper, CLASS_HIDDEN);
+ removeClass(element, CLASS_HIDDEN);
+
+ var containerData = {
+ width: Math.max(container.offsetWidth, Number(options.minContainerWidth) || 200),
+ height: Math.max(container.offsetHeight, Number(options.minContainerHeight) || 100)
+ };
+
+ this.containerData = containerData;
+
+ setStyle(cropper, {
+ width: containerData.width,
+ height: containerData.height
+ });
+
+ addClass(element, CLASS_HIDDEN);
+ removeClass(cropper, CLASS_HIDDEN);
+ },
+
+
+ // Canvas (image wrapper)
+ initCanvas: function initCanvas() {
+ var containerData = this.containerData,
+ imageData = this.imageData;
+ var viewMode = this.options.viewMode;
+
+ var rotated = Math.abs(imageData.rotate) % 180 === 90;
+ var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;
+ var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;
+ var aspectRatio = naturalWidth / naturalHeight;
+ var canvasWidth = containerData.width;
+ var canvasHeight = containerData.height;
+
+ if (containerData.height * aspectRatio > containerData.width) {
+ if (viewMode === 3) {
+ canvasWidth = containerData.height * aspectRatio;
+ } else {
+ canvasHeight = containerData.width / aspectRatio;
+ }
+ } else if (viewMode === 3) {
+ canvasHeight = containerData.width / aspectRatio;
+ } else {
+ canvasWidth = containerData.height * aspectRatio;
+ }
+
+ var canvasData = {
+ aspectRatio: aspectRatio,
+ naturalWidth: naturalWidth,
+ naturalHeight: naturalHeight,
+ width: canvasWidth,
+ height: canvasHeight
+ };
+
+ canvasData.left = (containerData.width - canvasWidth) / 2;
+ canvasData.top = (containerData.height - canvasHeight) / 2;
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ this.canvasData = canvasData;
+ this.limited = viewMode === 1 || viewMode === 2;
+ this.limitCanvas(true, true);
+ this.initialImageData = extend({}, imageData);
+ this.initialCanvasData = extend({}, canvasData);
+ },
+ limitCanvas: function limitCanvas(sizeLimited, positionLimited) {
+ var options = this.options,
+ containerData = this.containerData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+ var viewMode = options.viewMode;
+ var aspectRatio = canvasData.aspectRatio;
+
+ var cropped = this.cropped && cropBoxData;
+
+ if (sizeLimited) {
+ var minCanvasWidth = Number(options.minCanvasWidth) || 0;
+ var minCanvasHeight = Number(options.minCanvasHeight) || 0;
+
+ if (viewMode > 1) {
+ minCanvasWidth = Math.max(minCanvasWidth, containerData.width);
+ minCanvasHeight = Math.max(minCanvasHeight, containerData.height);
+
+ if (viewMode === 3) {
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ } else if (viewMode > 0) {
+ if (minCanvasWidth) {
+ minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);
+ } else if (minCanvasHeight) {
+ minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);
+ } else if (cropped) {
+ minCanvasWidth = cropBoxData.width;
+ minCanvasHeight = cropBoxData.height;
+
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ }
+
+ var _getContainSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: minCanvasWidth,
+ height: minCanvasHeight
+ });
+
+ minCanvasWidth = _getContainSizes.width;
+ minCanvasHeight = _getContainSizes.height;
+
+
+ canvasData.minWidth = minCanvasWidth;
+ canvasData.minHeight = minCanvasHeight;
+ canvasData.maxWidth = Infinity;
+ canvasData.maxHeight = Infinity;
+ }
+
+ if (positionLimited) {
+ if (viewMode) {
+ var newCanvasLeft = containerData.width - canvasData.width;
+ var newCanvasTop = containerData.height - canvasData.height;
+
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+
+ if (cropped && this.limited) {
+ canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));
+ canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));
+ canvasData.maxLeft = cropBoxData.left;
+ canvasData.maxTop = cropBoxData.top;
+
+ if (viewMode === 2) {
+ if (canvasData.width >= containerData.width) {
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ }
+
+ if (canvasData.height >= containerData.height) {
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+ }
+ }
+ }
+ } else {
+ canvasData.minLeft = -canvasData.width;
+ canvasData.minTop = -canvasData.height;
+ canvasData.maxLeft = containerData.width;
+ canvasData.maxTop = containerData.height;
+ }
+ }
+ },
+ renderCanvas: function renderCanvas(changed, transformed) {
+ var canvasData = this.canvasData,
+ imageData = this.imageData;
+
+
+ if (transformed) {
+ var _getRotatedSizes = getRotatedSizes({
+ width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
+ height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
+ degree: imageData.rotate || 0
+ }),
+ naturalWidth = _getRotatedSizes.width,
+ naturalHeight = _getRotatedSizes.height;
+
+ var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);
+ var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);
+
+ canvasData.left -= (width - canvasData.width) / 2;
+ canvasData.top -= (height - canvasData.height) / 2;
+ canvasData.width = width;
+ canvasData.height = height;
+ canvasData.aspectRatio = naturalWidth / naturalHeight;
+ canvasData.naturalWidth = naturalWidth;
+ canvasData.naturalHeight = naturalHeight;
+ this.limitCanvas(true, false);
+ }
+
+ if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {
+ canvasData.left = canvasData.oldLeft;
+ }
+
+ if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {
+ canvasData.top = canvasData.oldTop;
+ }
+
+ canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);
+ canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);
+
+ this.limitCanvas(false, true);
+
+ canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);
+ canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ setStyle(this.canvas, extend({
+ width: canvasData.width,
+ height: canvasData.height
+ }, getTransforms({
+ translateX: canvasData.left,
+ translateY: canvasData.top
+ })));
+
+ this.renderImage(changed);
+
+ if (this.cropped && this.limited) {
+ this.limitCropBox(true, true);
+ }
+ },
+ renderImage: function renderImage(changed) {
+ var canvasData = this.canvasData,
+ imageData = this.imageData;
+
+ var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);
+ var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);
+
+ extend(imageData, {
+ width: width,
+ height: height,
+ left: (canvasData.width - width) / 2,
+ top: (canvasData.height - height) / 2
+ });
+ setStyle(this.image, extend({
+ width: imageData.width,
+ height: imageData.height
+ }, getTransforms(extend({
+ translateX: imageData.left,
+ translateY: imageData.top
+ }, imageData))));
+
+ if (changed) {
+ this.output();
+ }
+ },
+ initCropBox: function initCropBox() {
+ var options = this.options,
+ canvasData = this.canvasData;
+ var aspectRatio = options.aspectRatio;
+
+ var autoCropArea = Number(options.autoCropArea) || 0.8;
+ var cropBoxData = {
+ width: canvasData.width,
+ height: canvasData.height
+ };
+
+ if (aspectRatio) {
+ if (canvasData.height * aspectRatio > canvasData.width) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.cropBoxData = cropBoxData;
+ this.limitCropBox(true, true);
+
+ // Initialize auto crop area
+ cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
+ cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
+
+ // The width/height of auto crop area must large than "minWidth/Height"
+ cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);
+ cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);
+ cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;
+ cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ this.initialCropBoxData = extend({}, cropBoxData);
+ },
+ limitCropBox: function limitCropBox(sizeLimited, positionLimited) {
+ var options = this.options,
+ containerData = this.containerData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData,
+ limited = this.limited;
+ var aspectRatio = options.aspectRatio;
+
+
+ if (sizeLimited) {
+ var minCropBoxWidth = Number(options.minCropBoxWidth) || 0;
+ var minCropBoxHeight = Number(options.minCropBoxHeight) || 0;
+ var maxCropBoxWidth = Math.min(containerData.width, limited ? canvasData.width : containerData.width);
+ var maxCropBoxHeight = Math.min(containerData.height, limited ? canvasData.height : containerData.height);
+
+ // The min/maxCropBoxWidth/Height must be less than container's width/height
+ minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);
+ minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);
+
+ if (aspectRatio) {
+ if (minCropBoxWidth && minCropBoxHeight) {
+ if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+ } else if (minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else if (minCropBoxHeight) {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+
+ if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {
+ maxCropBoxHeight = maxCropBoxWidth / aspectRatio;
+ } else {
+ maxCropBoxWidth = maxCropBoxHeight * aspectRatio;
+ }
+ }
+
+ // The minWidth/Height must be less than maxWidth/Height
+ cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);
+ cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);
+ cropBoxData.maxWidth = maxCropBoxWidth;
+ cropBoxData.maxHeight = maxCropBoxHeight;
+ }
+
+ if (positionLimited) {
+ if (limited) {
+ cropBoxData.minLeft = Math.max(0, canvasData.left);
+ cropBoxData.minTop = Math.max(0, canvasData.top);
+ cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;
+ cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;
+ } else {
+ cropBoxData.minLeft = 0;
+ cropBoxData.minTop = 0;
+ cropBoxData.maxLeft = containerData.width - cropBoxData.width;
+ cropBoxData.maxTop = containerData.height - cropBoxData.height;
+ }
+ }
+ },
+ renderCropBox: function renderCropBox() {
+ var options = this.options,
+ containerData = this.containerData,
+ cropBoxData = this.cropBoxData;
+
+
+ if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {
+ cropBoxData.left = cropBoxData.oldLeft;
+ }
+
+ if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {
+ cropBoxData.top = cropBoxData.oldTop;
+ }
+
+ cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
+ cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
+
+ this.limitCropBox(false, true);
+
+ cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);
+ cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ if (options.movable && options.cropBoxMovable) {
+ // Turn to move the canvas when the crop box is equal to the container
+ setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);
+ }
+
+ setStyle(this.cropBox, extend({
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ }, getTransforms({
+ translateX: cropBoxData.left,
+ translateY: cropBoxData.top
+ })));
+
+ if (this.cropped && this.limited) {
+ this.limitCanvas(true, true);
+ }
+
+ if (!this.disabled) {
+ this.output();
+ }
+ },
+ output: function output() {
+ this.preview();
+
+ if (this.complete) {
+ dispatchEvent(this.element, EVENT_CROP, this.getData());
+ }
+ }
+};
+
+var preview = {
+ initPreview: function initPreview() {
+ var crossOrigin = this.crossOrigin;
+ var preview = this.options.preview;
+
+ var url = crossOrigin ? this.crossOriginUrl : this.url;
+ var image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = url;
+ this.viewBox.appendChild(image);
+ this.image2 = image;
+
+ if (!preview) {
+ return;
+ }
+
+ var previews = preview.querySelector ? [preview] : document.querySelectorAll(preview);
+
+ this.previews = previews;
+
+ each(previews, function (element) {
+ var img = document.createElement('img');
+
+ // Save the original size for recover
+ setData(element, DATA_PREVIEW, {
+ width: element.offsetWidth,
+ height: element.offsetHeight,
+ html: element.innerHTML
+ });
+
+ if (crossOrigin) {
+ img.crossOrigin = crossOrigin;
+ }
+
+ img.src = url;
+
+ /**
+ * Override img element styles
+ * Add `display:block` to avoid margin top issue
+ * Add `height:auto` to override `height` attribute on IE8
+ * (Occur only when margin-top <= -height)
+ */
+ img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"';
+
+ empty(element);
+ element.appendChild(img);
+ });
+ },
+ resetPreview: function resetPreview() {
+ each(this.previews, function (element) {
+ var data = getData(element, DATA_PREVIEW);
+
+ setStyle(element, {
+ width: data.width,
+ height: data.height
+ });
+
+ element.innerHTML = data.html;
+ removeData(element, DATA_PREVIEW);
+ });
+ },
+ preview: function preview() {
+ var imageData = this.imageData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+ var cropBoxWidth = cropBoxData.width,
+ cropBoxHeight = cropBoxData.height;
+ var width = imageData.width,
+ height = imageData.height;
+
+ var left = cropBoxData.left - canvasData.left - imageData.left;
+ var top = cropBoxData.top - canvasData.top - imageData.top;
+
+ if (!this.cropped || this.disabled) {
+ return;
+ }
+
+ setStyle(this.image2, extend({
+ width: width,
+ height: height
+ }, getTransforms(extend({
+ translateX: -left,
+ translateY: -top
+ }, imageData))));
+
+ each(this.previews, function (element) {
+ var data = getData(element, DATA_PREVIEW);
+ var originalWidth = data.width;
+ var originalHeight = data.height;
+ var newWidth = originalWidth;
+ var newHeight = originalHeight;
+ var ratio = 1;
+
+ if (cropBoxWidth) {
+ ratio = originalWidth / cropBoxWidth;
+ newHeight = cropBoxHeight * ratio;
+ }
+
+ if (cropBoxHeight && newHeight > originalHeight) {
+ ratio = originalHeight / cropBoxHeight;
+ newWidth = cropBoxWidth * ratio;
+ newHeight = originalHeight;
+ }
+
+ setStyle(element, {
+ width: newWidth,
+ height: newHeight
+ });
+
+ setStyle(element.getElementsByTagName('img')[0], extend({
+ width: width * ratio,
+ height: height * ratio
+ }, getTransforms(extend({
+ translateX: -left * ratio,
+ translateY: -top * ratio
+ }, imageData))));
+ });
+ }
+};
+
+var events = {
+ bind: function bind() {
+ var element = this.element,
+ options = this.options,
+ cropper = this.cropper;
+
+
+ if (isFunction(options.cropstart)) {
+ addListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ addListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ addListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ addListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ addListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = proxy(this.cropStart, this));
+
+ if (options.zoomable && options.zoomOnWheel) {
+ addListener(cropper, EVENT_WHEEL, this.onWheel = proxy(this.wheel, this));
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ addListener(cropper, EVENT_DBLCLICK, this.onDblclick = proxy(this.dblclick, this));
+ }
+
+ addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = proxy(this.cropMove, this));
+ addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = proxy(this.cropEnd, this));
+
+ if (options.responsive) {
+ addListener(window, EVENT_RESIZE, this.onResize = proxy(this.resize, this));
+ }
+ },
+ unbind: function unbind() {
+ var element = this.element,
+ options = this.options,
+ cropper = this.cropper;
+
+
+ if (isFunction(options.cropstart)) {
+ removeListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ removeListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ removeListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ removeListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ removeListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);
+
+ if (options.zoomable && options.zoomOnWheel) {
+ removeListener(cropper, EVENT_WHEEL, this.onWheel);
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);
+ }
+
+ removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);
+ removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);
+
+ if (options.responsive) {
+ removeListener(window, EVENT_RESIZE, this.onResize);
+ }
+ }
+};
+
+var handlers = {
+ resize: function resize() {
+ var options = this.options,
+ container = this.container,
+ containerData = this.containerData;
+
+ var minContainerWidth = Number(options.minContainerWidth) || 200;
+ var minContainerHeight = Number(options.minContainerHeight) || 100;
+
+ if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) {
+ return;
+ }
+
+ var ratio = container.offsetWidth / containerData.width;
+
+ // Resize when width changed or height changed
+ if (ratio !== 1 || container.offsetHeight !== containerData.height) {
+ var canvasData = void 0;
+ var cropBoxData = void 0;
+
+ if (options.restore) {
+ canvasData = this.getCanvasData();
+ cropBoxData = this.getCropBoxData();
+ }
+
+ this.render();
+
+ if (options.restore) {
+ this.setCanvasData(each(canvasData, function (n, i) {
+ canvasData[i] = n * ratio;
+ }));
+ this.setCropBoxData(each(cropBoxData, function (n, i) {
+ cropBoxData[i] = n * ratio;
+ }));
+ }
+ }
+ },
+ dblclick: function dblclick() {
+ if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {
+ return;
+ }
+
+ this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);
+ },
+ wheel: function wheel(e) {
+ var _this = this;
+
+ var ratio = Number(this.options.wheelZoomRatio) || 0.1;
+ var delta = 1;
+
+ if (this.disabled) {
+ return;
+ }
+
+ e.preventDefault();
+
+ // Limit wheel speed to prevent zoom too fast (#21)
+ if (this.wheeling) {
+ return;
+ }
+
+ this.wheeling = true;
+
+ setTimeout(function () {
+ _this.wheeling = false;
+ }, 50);
+
+ if (e.deltaY) {
+ delta = e.deltaY > 0 ? 1 : -1;
+ } else if (e.wheelDelta) {
+ delta = -e.wheelDelta / 120;
+ } else if (e.detail) {
+ delta = e.detail > 0 ? 1 : -1;
+ }
+
+ this.zoom(-delta * ratio, e);
+ },
+ cropStart: function cropStart(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ var options = this.options,
+ pointers = this.pointers;
+
+ var action = void 0;
+
+ if (e.changedTouches) {
+ // Handle touch event
+ each(e.changedTouches, function (touch) {
+ pointers[touch.identifier] = getPointer(touch);
+ });
+ } else {
+ // Handle mouse event and pointer event
+ pointers[e.pointerId || 0] = getPointer(e);
+ }
+
+ if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
+ action = ACTION_ZOOM;
+ } else {
+ action = getData(e.target, DATA_ACTION);
+ }
+
+ if (!REGEXP_ACTIONS.test(action)) {
+ return;
+ }
+
+ if (dispatchEvent(this.element, EVENT_CROP_START, {
+ originalEvent: e,
+ action: action
+ }) === false) {
+ return;
+ }
+
+ e.preventDefault();
+
+ this.action = action;
+ this.cropping = false;
+
+ if (action === ACTION_CROP) {
+ this.cropping = true;
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+ },
+ cropMove: function cropMove(e) {
+ var action = this.action;
+
+
+ if (this.disabled || !action) {
+ return;
+ }
+
+ var pointers = this.pointers;
+
+
+ e.preventDefault();
+
+ if (dispatchEvent(this.element, EVENT_CROP_MOVE, {
+ originalEvent: e,
+ action: action
+ }) === false) {
+ return;
+ }
+
+ if (e.changedTouches) {
+ each(e.changedTouches, function (touch) {
+ extend(pointers[touch.identifier], getPointer(touch, true));
+ });
+ } else {
+ extend(pointers[e.pointerId || 0], getPointer(e, true));
+ }
+
+ this.change(e);
+ },
+ cropEnd: function cropEnd(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ var action = this.action,
+ pointers = this.pointers;
+
+
+ if (e.changedTouches) {
+ each(e.changedTouches, function (touch) {
+ delete pointers[touch.identifier];
+ });
+ } else {
+ delete pointers[e.pointerId || 0];
+ }
+
+ if (!action) {
+ return;
+ }
+
+ e.preventDefault();
+
+ if (!Object.keys(pointers).length) {
+ this.action = '';
+ }
+
+ if (this.cropping) {
+ this.cropping = false;
+ toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);
+ }
+
+ dispatchEvent(this.element, EVENT_CROP_END, {
+ originalEvent: e,
+ action: action
+ });
+ }
+};
+
+var change = {
+ change: function change(e) {
+ var options = this.options,
+ canvasData = this.canvasData,
+ containerData = this.containerData,
+ cropBoxData = this.cropBoxData,
+ pointers = this.pointers;
+ var action = this.action;
+ var aspectRatio = options.aspectRatio;
+ var left = cropBoxData.left,
+ top = cropBoxData.top,
+ width = cropBoxData.width,
+ height = cropBoxData.height;
+
+ var right = left + width;
+ var bottom = top + height;
+ var minLeft = 0;
+ var minTop = 0;
+ var maxWidth = containerData.width;
+ var maxHeight = containerData.height;
+ var renderable = true;
+ var offset = void 0;
+
+ // Locking aspect ratio in "free mode" by holding shift key
+ if (!aspectRatio && e.shiftKey) {
+ aspectRatio = width && height ? width / height : 1;
+ }
+
+ if (this.limited) {
+ minLeft = cropBoxData.minLeft;
+ minTop = cropBoxData.minTop;
+
+ maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);
+ maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);
+ }
+
+ var pointer = pointers[Object.keys(pointers)[0]];
+ var range = {
+ x: pointer.endX - pointer.startX,
+ y: pointer.endY - pointer.startY
+ };
+ var check = function check(side) {
+ switch (side) {
+ case ACTION_EAST:
+ if (right + range.x > maxWidth) {
+ range.x = maxWidth - right;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (left + range.x < minLeft) {
+ range.x = minLeft - left;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (top + range.y < minTop) {
+ range.y = minTop - top;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (bottom + range.y > maxHeight) {
+ range.y = maxHeight - bottom;
+ }
+
+ break;
+
+ default:
+ }
+ };
+
+ switch (action) {
+ // Move crop box
+ case ACTION_ALL:
+ left += range.x;
+ top += range.y;
+ break;
+
+ // Resize crop box
+ case ACTION_EAST:
+ if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top -= range.x / aspectRatio / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_WEST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left += range.y * aspectRatio / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_SOUTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top += range.x / aspectRatio / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_EAST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_SOUTH);
+ height += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left -= range.y * aspectRatio / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_NORTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_EAST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_WEST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || left <= minLeft)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ left += range.y * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_WEST:
+ if (aspectRatio) {
+ if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_EAST:
+ if (aspectRatio) {
+ if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ // Move canvas
+ case ACTION_MOVE:
+ this.move(range.x, range.y);
+ renderable = false;
+ break;
+
+ // Zoom canvas
+ case ACTION_ZOOM:
+ this.zoom(getMaxZoomRatio(pointers), e);
+ renderable = false;
+ break;
+
+ // Create crop box
+ case ACTION_CROP:
+ if (!range.x || !range.y) {
+ renderable = false;
+ break;
+ }
+
+ offset = getOffset(this.cropper);
+ left = pointer.startX - offset.left;
+ top = pointer.startY - offset.top;
+ width = cropBoxData.minWidth;
+ height = cropBoxData.minHeight;
+
+ if (range.x > 0) {
+ action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;
+ } else if (range.x < 0) {
+ left -= width;
+ action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;
+ }
+
+ if (range.y < 0) {
+ top -= height;
+ }
+
+ // Show the crop box if is hidden
+ if (!this.cropped) {
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ this.cropped = true;
+
+ if (this.limited) {
+ this.limitCropBox(true, true);
+ }
+ }
+
+ break;
+
+ default:
+ }
+
+ if (renderable) {
+ cropBoxData.width = width;
+ cropBoxData.height = height;
+ cropBoxData.left = left;
+ cropBoxData.top = top;
+ this.action = action;
+ this.renderCropBox();
+ }
+
+ // Override
+ each(pointers, function (p) {
+ p.startX = p.endX;
+ p.startY = p.endY;
+ });
+ }
+};
+
+var methods = {
+ // Show the crop box manually
+ crop: function crop() {
+ if (this.ready && !this.disabled) {
+ if (!this.cropped) {
+ this.cropped = true;
+ this.limitCropBox(true, true);
+
+ if (this.options.modal) {
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ this.setCropBoxData(this.initialCropBoxData);
+ }
+
+ return this;
+ },
+
+
+ // Reset the image and crop box to their initial states
+ reset: function reset() {
+ if (this.ready && !this.disabled) {
+ this.imageData = extend({}, this.initialImageData);
+ this.canvasData = extend({}, this.initialCanvasData);
+ this.cropBoxData = extend({}, this.initialCropBoxData);
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+
+ return this;
+ },
+
+
+ // Clear the crop box
+ clear: function clear() {
+ if (this.cropped && !this.disabled) {
+ extend(this.cropBoxData, {
+ left: 0,
+ top: 0,
+ width: 0,
+ height: 0
+ });
+
+ this.cropped = false;
+ this.renderCropBox();
+ this.limitCanvas(true, true);
+
+ // Render canvas after crop box rendered
+ this.renderCanvas();
+ removeClass(this.dragBox, CLASS_MODAL);
+ addClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Replace the image's src and rebuild the cropper
+ * @param {string} url - The new URL.
+ * @param {boolean} [onlyColorChanged] - Indicate if the new image only changed color.
+ * @returns {Object} this
+ */
+ replace: function replace(url) {
+ var onlyColorChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!this.disabled && url) {
+ if (this.isImg) {
+ this.element.src = url;
+ }
+
+ if (onlyColorChanged) {
+ this.url = url;
+ this.image.src = url;
+
+ if (this.ready) {
+ this.image2.src = url;
+
+ each(this.previews, function (element) {
+ element.getElementsByTagName('img')[0].src = url;
+ });
+ }
+ } else {
+ if (this.isImg) {
+ this.replaced = true;
+ }
+
+ // Clear previous data
+ this.options.data = null;
+ this.load(url);
+ }
+ }
+
+ return this;
+ },
+
+
+ // Enable (unfreeze) the cropper
+ enable: function enable() {
+ if (this.ready) {
+ this.disabled = false;
+ removeClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+
+ // Disable (freeze) the cropper
+ disable: function disable() {
+ if (this.ready) {
+ this.disabled = true;
+ addClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+
+ // Destroy the cropper and remove the instance from the image
+ destroy: function destroy() {
+ var element = this.element,
+ image = this.image;
+
+
+ if (this.loaded) {
+ if (this.isImg && this.replaced) {
+ element.src = this.originalUrl;
+ }
+
+ this.unbuild();
+ removeClass(element, CLASS_HIDDEN);
+ } else if (this.isImg) {
+ removeListener(element, EVENT_LOAD, this.onStart);
+ } else if (image) {
+ image.parentNode.removeChild(image);
+ }
+
+ removeData(element, NAMESPACE);
+
+ return this;
+ },
+
+
+ /**
+ * Move the canvas with relative offsets
+ * @param {number} offsetX - The relative offset distance on the x-axis.
+ * @param {number} offsetY - The relative offset distance on the y-axis.
+ * @returns {Object} this
+ */
+ move: function move(offsetX, offsetY) {
+ var _canvasData = this.canvasData,
+ left = _canvasData.left,
+ top = _canvasData.top;
+
+
+ return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));
+ },
+
+
+ /**
+ * Move the canvas to an absolute point
+ * @param {number} x - The x-axis coordinate.
+ * @param {number} [y=x] - The y-axis coordinate.
+ * @returns {Object} this
+ */
+ moveTo: function moveTo(x) {
+ var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
+ var canvasData = this.canvasData;
+
+ var changed = false;
+
+ x = Number(x);
+ y = Number(y);
+
+ if (this.ready && !this.disabled && this.options.movable) {
+ if (isNumber(x)) {
+ canvasData.left = x;
+ changed = true;
+ }
+
+ if (isNumber(y)) {
+ canvasData.top = y;
+ changed = true;
+ }
+
+ if (changed) {
+ this.renderCanvas(true);
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Zoom the canvas with a relative ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoom: function zoom(ratio, _originalEvent) {
+ var canvasData = this.canvasData;
+
+
+ ratio = Number(ratio);
+
+ if (ratio < 0) {
+ ratio = 1 / (1 - ratio);
+ } else {
+ ratio = 1 + ratio;
+ }
+
+ return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);
+ },
+
+
+ /**
+ * Zoom the canvas to an absolute ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Object} pivot - The zoom pivot point coordinate.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoomTo: function zoomTo(ratio, pivot, _originalEvent) {
+ var options = this.options,
+ canvasData = this.canvasData;
+ var width = canvasData.width,
+ height = canvasData.height,
+ naturalWidth = canvasData.naturalWidth,
+ naturalHeight = canvasData.naturalHeight;
+
+
+ ratio = Number(ratio);
+
+ if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {
+ var newWidth = naturalWidth * ratio;
+ var newHeight = naturalHeight * ratio;
+
+ if (dispatchEvent(this.element, EVENT_ZOOM, {
+ originalEvent: _originalEvent,
+ oldRatio: width / naturalWidth,
+ ratio: newWidth / naturalWidth
+ }) === false) {
+ return this;
+ }
+
+ if (_originalEvent) {
+ var pointers = this.pointers;
+
+ var offset = getOffset(this.cropper);
+ var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {
+ pageX: _originalEvent.pageX,
+ pageY: _originalEvent.pageY
+ };
+
+ // Zoom from the triggering point of the event
+ canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width);
+ canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height);
+ } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {
+ canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);
+ canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);
+ } else {
+ // Zoom from the center of the canvas
+ canvasData.left -= (newWidth - width) / 2;
+ canvasData.top -= (newHeight - height) / 2;
+ }
+
+ canvasData.width = newWidth;
+ canvasData.height = newHeight;
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Rotate the canvas with a relative degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotate: function rotate(degree) {
+ return this.rotateTo((this.imageData.rotate || 0) + Number(degree));
+ },
+
+
+ /**
+ * Rotate the canvas to an absolute degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotateTo: function rotateTo(degree) {
+ degree = Number(degree);
+
+ if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {
+ this.imageData.rotate = degree % 360;
+ this.renderCanvas(true, true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Scale the image on the x-axis.
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @returns {Object} this
+ */
+ scaleX: function scaleX(_scaleX) {
+ var scaleY = this.imageData.scaleY;
+
+
+ return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1);
+ },
+
+
+ /**
+ * Scale the image on the y-axis.
+ * @param {number} scaleY - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scaleY: function scaleY(_scaleY) {
+ var scaleX = this.imageData.scaleX;
+
+
+ return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY);
+ },
+
+
+ /**
+ * Scale the image
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scale: function scale(scaleX) {
+ var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
+ var imageData = this.imageData;
+
+ var transformed = false;
+
+ scaleX = Number(scaleX);
+ scaleY = Number(scaleY);
+
+ if (this.ready && !this.disabled && this.options.scalable) {
+ if (isNumber(scaleX)) {
+ imageData.scaleX = scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(scaleY)) {
+ imageData.scaleY = scaleY;
+ transformed = true;
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the cropped area position and size data (base on the original image)
+ * @param {boolean} [rounded=false] - Indicate if round the data values or not.
+ * @returns {Object} The result cropped data.
+ */
+ getData: function getData$$1() {
+ var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var options = this.options,
+ imageData = this.imageData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+
+ var data = void 0;
+
+ if (this.ready && this.cropped) {
+ data = {
+ x: cropBoxData.left - canvasData.left,
+ y: cropBoxData.top - canvasData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ };
+
+ var ratio = imageData.width / imageData.naturalWidth;
+
+ each(data, function (n, i) {
+ n /= ratio;
+ data[i] = rounded ? Math.round(n) : n;
+ });
+ } else {
+ data = {
+ x: 0,
+ y: 0,
+ width: 0,
+ height: 0
+ };
+ }
+
+ if (options.rotatable) {
+ data.rotate = imageData.rotate || 0;
+ }
+
+ if (options.scalable) {
+ data.scaleX = imageData.scaleX || 1;
+ data.scaleY = imageData.scaleY || 1;
+ }
+
+ return data;
+ },
+
+
+ /**
+ * Set the cropped area position and size with new data
+ * @param {Object} data - The new data.
+ * @returns {Object} this
+ */
+ setData: function setData$$1(data) {
+ var options = this.options,
+ imageData = this.imageData,
+ canvasData = this.canvasData;
+
+ var cropBoxData = {};
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ var transformed = false;
+
+ if (options.rotatable) {
+ if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
+ imageData.rotate = data.rotate;
+ transformed = true;
+ }
+ }
+
+ if (options.scalable) {
+ if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
+ imageData.scaleX = data.scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
+ imageData.scaleY = data.scaleY;
+ transformed = true;
+ }
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+
+ var ratio = imageData.width / imageData.naturalWidth;
+
+ if (isNumber(data.x)) {
+ cropBoxData.left = data.x * ratio + canvasData.left;
+ }
+
+ if (isNumber(data.y)) {
+ cropBoxData.top = data.y * ratio + canvasData.top;
+ }
+
+ if (isNumber(data.width)) {
+ cropBoxData.width = data.width * ratio;
+ }
+
+ if (isNumber(data.height)) {
+ cropBoxData.height = data.height * ratio;
+ }
+
+ this.setCropBoxData(cropBoxData);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the container size data.
+ * @returns {Object} The result container data.
+ */
+ getContainerData: function getContainerData() {
+ return this.ready ? extend({}, this.containerData) : {};
+ },
+
+
+ /**
+ * Get the image position and size data.
+ * @returns {Object} The result image data.
+ */
+ getImageData: function getImageData() {
+ return this.loaded ? extend({}, this.imageData) : {};
+ },
+
+
+ /**
+ * Get the canvas position and size data.
+ * @returns {Object} The result canvas data.
+ */
+ getCanvasData: function getCanvasData() {
+ var canvasData = this.canvasData;
+
+ var data = {};
+
+ if (this.ready) {
+ each(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) {
+ data[n] = canvasData[n];
+ });
+ }
+
+ return data;
+ },
+
+
+ /**
+ * Set the canvas position and size with new data.
+ * @param {Object} data - The new canvas data.
+ * @returns {Object} this
+ */
+ setCanvasData: function setCanvasData(data) {
+ var canvasData = this.canvasData;
+ var aspectRatio = canvasData.aspectRatio;
+
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ canvasData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ canvasData.top = data.top;
+ }
+
+ if (isNumber(data.width)) {
+ canvasData.width = data.width;
+ canvasData.height = data.width / aspectRatio;
+ } else if (isNumber(data.height)) {
+ canvasData.height = data.height;
+ canvasData.width = data.height * aspectRatio;
+ }
+
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the crop box position and size data.
+ * @returns {Object} The result crop box data.
+ */
+ getCropBoxData: function getCropBoxData() {
+ var cropBoxData = this.cropBoxData;
+
+ var data = void 0;
+
+ if (this.ready && this.cropped) {
+ data = {
+ left: cropBoxData.left,
+ top: cropBoxData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ };
+ }
+
+ return data || {};
+ },
+
+
+ /**
+ * Set the crop box position and size with new data.
+ * @param {Object} data - The new crop box data.
+ * @returns {Object} this
+ */
+ setCropBoxData: function setCropBoxData(data) {
+ var cropBoxData = this.cropBoxData;
+ var aspectRatio = this.options.aspectRatio;
+
+ var widthChanged = void 0;
+ var heightChanged = void 0;
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ cropBoxData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ cropBoxData.top = data.top;
+ }
+
+ if (isNumber(data.width) && data.width !== cropBoxData.width) {
+ widthChanged = true;
+ cropBoxData.width = data.width;
+ }
+
+ if (isNumber(data.height) && data.height !== cropBoxData.height) {
+ heightChanged = true;
+ cropBoxData.height = data.height;
+ }
+
+ if (aspectRatio) {
+ if (widthChanged) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else if (heightChanged) {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.renderCropBox();
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get a canvas drawn the cropped image.
+ * @param {Object} [options={}] - The config options.
+ * @returns {HTMLCanvasElement} - The result canvas.
+ */
+ getCroppedCanvas: function getCroppedCanvas() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ if (!this.ready || !window.HTMLCanvasElement) {
+ return null;
+ }
+
+ var canvasData = this.canvasData;
+
+ var source = getSourceCanvas(this.image, this.imageData, canvasData, options);
+
+ // Returns the source canvas if it is not cropped.
+ if (!this.cropped) {
+ return source;
+ }
+
+ var _getData = this.getData(),
+ x = _getData.x,
+ y = _getData.y,
+ initialWidth = _getData.width,
+ initialHeight = _getData.height;
+
+ var aspectRatio = initialWidth / initialHeight;
+ var maxSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.maxWidth || Infinity,
+ height: options.maxHeight || Infinity
+ });
+ var minSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.minWidth || 0,
+ height: options.minHeight || 0
+ });
+
+ var _getContainSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.width || initialWidth,
+ height: options.height || initialHeight
+ }),
+ width = _getContainSizes.width,
+ height = _getContainSizes.height;
+
+ width = Math.min(maxSizes.width, Math.max(minSizes.width, width));
+ height = Math.min(maxSizes.height, Math.max(minSizes.height, height));
+
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+
+ context.fillStyle = options.fillColor || 'transparent';
+ context.fillRect(0, 0, width, height);
+
+ var _options$imageSmoothi = options.imageSmoothingEnabled,
+ imageSmoothingEnabled = _options$imageSmoothi === undefined ? true : _options$imageSmoothi,
+ imageSmoothingQuality = options.imageSmoothingQuality;
+
+
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+
+ if (imageSmoothingQuality) {
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ }
+
+ // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage
+ var sourceWidth = source.width;
+ var sourceHeight = source.height;
+
+ // Source canvas parameters
+ var srcX = x;
+ var srcY = y;
+ var srcWidth = void 0;
+ var srcHeight = void 0;
+
+ // Destination canvas parameters
+ var dstX = void 0;
+ var dstY = void 0;
+ var dstWidth = void 0;
+ var dstHeight = void 0;
+
+ if (srcX <= -initialWidth || srcX > sourceWidth) {
+ srcX = 0;
+ srcWidth = 0;
+ dstX = 0;
+ dstWidth = 0;
+ } else if (srcX <= 0) {
+ dstX = -srcX;
+ srcX = 0;
+ srcWidth = Math.min(sourceWidth, initialWidth + srcX);
+ dstWidth = srcWidth;
+ } else if (srcX <= sourceWidth) {
+ dstX = 0;
+ srcWidth = Math.min(initialWidth, sourceWidth - srcX);
+ dstWidth = srcWidth;
+ }
+
+ if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {
+ srcY = 0;
+ srcHeight = 0;
+ dstY = 0;
+ dstHeight = 0;
+ } else if (srcY <= 0) {
+ dstY = -srcY;
+ srcY = 0;
+ srcHeight = Math.min(sourceHeight, initialHeight + srcY);
+ dstHeight = srcHeight;
+ } else if (srcY <= sourceHeight) {
+ dstY = 0;
+ srcHeight = Math.min(initialHeight, sourceHeight - srcY);
+ dstHeight = srcHeight;
+ }
+
+ // All the numerical parameters should be integer for `drawImage`
+ // https://github.com/fengyuanchen/cropper/issues/476
+ var params = [srcX, srcY, srcWidth, srcHeight];
+
+ // Avoid "IndexSizeError"
+ if (dstWidth > 0 && dstHeight > 0) {
+ var scale = width / initialWidth;
+
+ params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
+ }
+
+ context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) {
+ return Math.floor(normalizeDecimalNumber(param));
+ }))));
+
+ return canvas;
+ },
+
+
+ /**
+ * Change the aspect ratio of the crop box.
+ * @param {number} aspectRatio - The new aspect ratio.
+ * @returns {Object} this
+ */
+ setAspectRatio: function setAspectRatio(aspectRatio) {
+ var options = this.options;
+
+
+ if (!this.disabled && !isUndefined(aspectRatio)) {
+ // 0 -> NaN
+ options.aspectRatio = Math.max(0, aspectRatio) || NaN;
+
+ if (this.ready) {
+ this.initCropBox();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Change the drag mode.
+ * @param {string} mode - The new drag mode.
+ * @returns {Object} this
+ */
+ setDragMode: function setDragMode(mode) {
+ var options = this.options,
+ dragBox = this.dragBox,
+ face = this.face;
+
+
+ if (this.loaded && !this.disabled) {
+ var croppable = mode === DRAG_MODE_CROP;
+ var movable = options.movable && mode === DRAG_MODE_MOVE;
+
+ mode = croppable || movable ? mode : DRAG_MODE_NONE;
+
+ setData(dragBox, DATA_ACTION, mode);
+ toggleClass(dragBox, CLASS_CROP, croppable);
+ toggleClass(dragBox, CLASS_MOVE, movable);
+
+ if (!options.cropBoxMovable) {
+ // Sync drag mode to crop box when it is not movable
+ setData(face, DATA_ACTION, mode);
+ toggleClass(face, CLASS_CROP, croppable);
+ toggleClass(face, CLASS_MOVE, movable);
+ }
+ }
+
+ return this;
+ }
+};
+
+var AnotherCropper = WINDOW.Cropper;
+
+var Cropper = function () {
+ /**
+ * Create a new Cropper.
+ * @param {Element} element - The target element for cropping.
+ * @param {Object} [options={}] - The configuration options.
+ */
+ function Cropper(element) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ classCallCheck(this, Cropper);
+
+ if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {
+ throw new Error('The first argument is required and must be an <img> or <canvas> element.');
+ }
+
+ this.element = element;
+ this.options = extend({}, DEFAULTS, isPlainObject(options) && options);
+ this.complete = false;
+ this.cropped = false;
+ this.disabled = false;
+ this.isImg = false;
+ this.limited = false;
+ this.loaded = false;
+ this.ready = false;
+ this.replaced = false;
+ this.wheeling = false;
+ this.originalUrl = '';
+ this.canvasData = null;
+ this.cropBoxData = null;
+ this.previews = null;
+ this.pointers = {};
+ this.init();
+ }
+
+ createClass(Cropper, [{
+ key: 'init',
+ value: function init() {
+ var element = this.element;
+
+ var tagName = element.tagName.toLowerCase();
+ var url = void 0;
+
+ if (getData(element, NAMESPACE)) {
+ return;
+ }
+
+ setData(element, NAMESPACE, this);
+
+ if (tagName === 'img') {
+ this.isImg = true;
+
+ // e.g.: "img/picture.jpg"
+ url = element.getAttribute('src') || '';
+ this.originalUrl = url;
+
+ // Stop when it's a blank image
+ if (!url) {
+ return;
+ }
+
+ // e.g.: "http://example.com/img/picture.jpg"
+ url = element.src;
+ } else if (tagName === 'canvas' && window.HTMLCanvasElement) {
+ url = element.toDataURL();
+ }
+
+ this.load(url);
+ }
+ }, {
+ key: 'load',
+ value: function load(url) {
+ var _this = this;
+
+ if (!url) {
+ return;
+ }
+
+ this.url = url;
+ this.imageData = {};
+
+ var element = this.element,
+ options = this.options;
+
+
+ if (!options.checkOrientation || !window.ArrayBuffer) {
+ this.clone();
+ return;
+ }
+
+ // XMLHttpRequest disallows to open a Data URL in some browsers like IE11 and Safari
+ if (REGEXP_DATA_URL.test(url)) {
+ if (REGEXP_DATA_URL_JPEG.test(url)) {
+ this.read(dataURLToArrayBuffer(url));
+ } else {
+ this.clone();
+ }
+
+ return;
+ }
+
+ var xhr = new XMLHttpRequest();
+
+ xhr.onerror = function () {
+ _this.clone();
+ };
+
+ xhr.onload = function () {
+ _this.read(xhr.response);
+ };
+
+ if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {
+ url = addTimestamp(url);
+ }
+
+ xhr.open('get', url);
+ xhr.responseType = 'arraybuffer';
+ xhr.withCredentials = element.crossOrigin === 'use-credentials';
+ xhr.send();
+ }
+ }, {
+ key: 'read',
+ value: function read(arrayBuffer) {
+ var options = this.options,
+ imageData = this.imageData;
+
+ var orientation = getOrientation(arrayBuffer);
+ var rotate = 0;
+ var scaleX = 1;
+ var scaleY = 1;
+
+ if (orientation > 1) {
+ this.url = arrayBufferToDataURL(arrayBuffer, 'image/jpeg');
+
+ var _parseOrientation = parseOrientation(orientation);
+
+ rotate = _parseOrientation.rotate;
+ scaleX = _parseOrientation.scaleX;
+ scaleY = _parseOrientation.scaleY;
+ }
+
+ if (options.rotatable) {
+ imageData.rotate = rotate;
+ }
+
+ if (options.scalable) {
+ imageData.scaleX = scaleX;
+ imageData.scaleY = scaleY;
+ }
+
+ this.clone();
+ }
+ }, {
+ key: 'clone',
+ value: function clone() {
+ var element = this.element,
+ url = this.url;
+
+ var crossOrigin = void 0;
+ var crossOriginUrl = void 0;
+
+ if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {
+ crossOrigin = element.crossOrigin;
+
+
+ if (crossOrigin) {
+ crossOriginUrl = url;
+ } else {
+ crossOrigin = 'anonymous';
+
+ // Bust cache when there is not a "crossOrigin" property
+ crossOriginUrl = addTimestamp(url);
+ }
+ }
+
+ this.crossOrigin = crossOrigin;
+ this.crossOriginUrl = crossOriginUrl;
+
+ var image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = crossOriginUrl || url;
+
+ var start = proxy(this.start, this);
+ var stop = proxy(this.stop, this);
+
+ this.image = image;
+ this.onStart = start;
+ this.onStop = stop;
+
+ if (this.isImg) {
+ if (element.complete) {
+ this.start();
+ } else {
+ addListener(element, EVENT_LOAD, start);
+ }
+ } else {
+ addListener(image, EVENT_LOAD, start);
+ addListener(image, EVENT_ERROR, stop);
+ addClass(image, CLASS_HIDE);
+ element.parentNode.insertBefore(image, element.nextSibling);
+ }
+ }
+ }, {
+ key: 'start',
+ value: function start(event) {
+ var _this2 = this;
+
+ var image = this.isImg ? this.element : this.image;
+
+ if (event) {
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ }
+
+ getImageNaturalSizes(image, function (naturalWidth, naturalHeight) {
+ extend(_this2.imageData, {
+ naturalWidth: naturalWidth,
+ naturalHeight: naturalHeight,
+ aspectRatio: naturalWidth / naturalHeight
+ });
+ _this2.loaded = true;
+ _this2.build();
+ });
+ }
+ }, {
+ key: 'stop',
+ value: function stop() {
+ var image = this.image;
+
+
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ image.parentNode.removeChild(image);
+ this.image = null;
+ }
+ }, {
+ key: 'build',
+ value: function build() {
+ var _this3 = this;
+
+ if (!this.loaded) {
+ return;
+ }
+
+ // Unbuild first when replace
+ if (this.ready) {
+ this.unbuild();
+ }
+
+ var element = this.element,
+ options = this.options,
+ image = this.image;
+
+ // Create cropper elements
+
+ var container = element.parentNode;
+ var template = document.createElement('div');
+
+ template.innerHTML = TEMPLATE;
+
+ var cropper = template.querySelector('.' + NAMESPACE + '-container');
+ var canvas = cropper.querySelector('.' + NAMESPACE + '-canvas');
+ var dragBox = cropper.querySelector('.' + NAMESPACE + '-drag-box');
+ var cropBox = cropper.querySelector('.' + NAMESPACE + '-crop-box');
+ var face = cropBox.querySelector('.' + NAMESPACE + '-face');
+
+ this.container = container;
+ this.cropper = cropper;
+ this.canvas = canvas;
+ this.dragBox = dragBox;
+ this.cropBox = cropBox;
+ this.viewBox = cropper.querySelector('.' + NAMESPACE + '-view-box');
+ this.face = face;
+
+ canvas.appendChild(image);
+
+ // Hide the original image
+ addClass(element, CLASS_HIDDEN);
+
+ // Inserts the cropper after to the current image
+ container.insertBefore(cropper, element.nextSibling);
+
+ // Show the image if is hidden
+ if (!this.isImg) {
+ removeClass(image, CLASS_HIDE);
+ }
+
+ this.initPreview();
+ this.bind();
+
+ options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;
+ options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;
+
+ this.cropped = options.autoCrop;
+
+ if (options.autoCrop) {
+ if (options.modal) {
+ addClass(dragBox, CLASS_MODAL);
+ }
+ } else {
+ addClass(cropBox, CLASS_HIDDEN);
+ }
+
+ if (!options.guides) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-dashed'), CLASS_HIDDEN);
+ }
+
+ if (!options.center) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-center'), CLASS_HIDDEN);
+ }
+
+ if (options.background) {
+ addClass(cropper, NAMESPACE + '-bg');
+ }
+
+ if (!options.highlight) {
+ addClass(face, CLASS_INVISIBLE);
+ }
+
+ if (options.cropBoxMovable) {
+ addClass(face, CLASS_MOVE);
+ setData(face, DATA_ACTION, ACTION_ALL);
+ }
+
+ if (!options.cropBoxResizable) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-line'), CLASS_HIDDEN);
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-point'), CLASS_HIDDEN);
+ }
+
+ this.setDragMode(options.dragMode);
+ this.render();
+ this.ready = true;
+ this.setData(options.data);
+
+ // Call the "ready" option asynchronously to keep "image.cropper" is defined
+ this.completing = setTimeout(function () {
+ if (isFunction(options.ready)) {
+ addListener(element, EVENT_READY, options.ready, {
+ once: true
+ });
+ }
+
+ dispatchEvent(element, EVENT_READY);
+ dispatchEvent(element, EVENT_CROP, _this3.getData());
+
+ _this3.complete = true;
+ }, 0);
+ }
+ }, {
+ key: 'unbuild',
+ value: function unbuild() {
+ if (!this.ready) {
+ return;
+ }
+
+ if (!this.complete) {
+ clearTimeout(this.completing);
+ }
+
+ this.ready = false;
+ this.complete = false;
+ this.initialImageData = null;
+
+ // Clear `initialCanvasData` is necessary when replace
+ this.initialCanvasData = null;
+ this.initialCropBoxData = null;
+ this.containerData = null;
+ this.canvasData = null;
+
+ // Clear `cropBoxData` is necessary when replace
+ this.cropBoxData = null;
+ this.unbind();
+ this.resetPreview();
+ this.previews = null;
+ this.viewBox = null;
+ this.cropBox = null;
+ this.dragBox = null;
+ this.canvas = null;
+ this.container = null;
+ this.cropper.parentNode.removeChild(this.cropper);
+ this.cropper = null;
+ }
+
+ /**
+ * Get the no conflict cropper class.
+ * @returns {Cropper} The cropper class.
+ */
+
+ }], [{
+ key: 'noConflict',
+ value: function noConflict() {
+ window.Cropper = AnotherCropper;
+ return Cropper;
+ }
+
+ /**
+ * Change the default options.
+ * @param {Object} options - The new default options.
+ */
+
+ }, {
+ key: 'setDefaults',
+ value: function setDefaults(options) {
+ extend(DEFAULTS, isPlainObject(options) && options);
+ }
+ }]);
+ return Cropper;
+}();
+
+extend(Cropper.prototype, render, preview, events, handlers, change, methods);
+
+return Cropper;
+
+})));
diff --git a/library/cropperjs/dist/cropper.min.css b/library/cropperjs/dist/cropper.min.css
new file mode 100644
index 000000000..89148848a
--- /dev/null
+++ b/library/cropperjs/dist/cropper.min.css
@@ -0,0 +1,9 @@
+/*!
+ * Cropper.js v1.2.2
+ * https://github.com/fengyuanchen/cropperjs
+ *
+ * Copyright (c) 2015-2018 Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2018-01-03T13:26:29.610Z
+ */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline-color:rgba(51,153,255,.75);outline:1px solid #39f;overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width:768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width:992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width:1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC")}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed} \ No newline at end of file
diff --git a/library/cropperjs/dist/cropper.min.js b/library/cropperjs/dist/cropper.min.js
new file mode 100644
index 000000000..e213c6c41
--- /dev/null
+++ b/library/cropperjs/dist/cropper.min.js
@@ -0,0 +1,10 @@
+/*!
+ * Cropper.js v1.2.2
+ * https://github.com/fengyuanchen/cropperjs
+ *
+ * Copyright (c) 2015-2018 Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2018-01-03T13:27:18.062Z
+ */
+!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Cropper=i()}(this,function(){"use strict";var t="undefined"!=typeof window?window:{},i="cropper",e=i+"-crop",a=i+"-disabled",n=i+"-hidden",o=i+"-hide",h=i+"-modal",r=i+"-move",s="action",c="preview",l="crop",d="cropend",p="cropmove",m="cropstart",u="load",g=t.PointerEvent?"pointerdown":"touchstart mousedown",f=t.PointerEvent?"pointermove":"touchmove mousemove",v=t.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",w="wheel mousewheel DOMMouseScroll",x=/^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,b=/^data:/,y=/^data:image\/jpeg;base64,/,C=/^(img|canvas)$/i,M={viewMode:0,dragMode:"crop",aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},D="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},B=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},k=function(){function t(t,i){for(var e=0;e<i.length;e++){var a=i[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(i,e,a){return e&&t(i.prototype,e),a&&t(i,a),i}}(),E=function(t){if(Array.isArray(t)){for(var i=0,e=Array(t.length);i<t.length;i++)e[i]=t[i];return e}return Array.from(t)},T=Number.isNaN||t.isNaN;function W(t){return"number"==typeof t&&!T(t)}function N(t){return void 0===t}function H(t){return"object"===(void 0===t?"undefined":D(t))&&null!==t}var L=Object.prototype.hasOwnProperty;function Y(t){if(!H(t))return!1;try{var i=t.constructor,e=i.prototype;return i&&e&&L.call(e,"isPrototypeOf")}catch(t){return!1}}function X(t){return"function"==typeof t}function O(t,i){if(t&&X(i))if(Array.isArray(t)||W(t.length)){var e=t.length,a=void 0;for(a=0;a<e&&!1!==i.call(t,t[a],a,t);a+=1);}else H(t)&&Object.keys(t).forEach(function(e){i.call(t,t[e],e,t)});return t}function S(t){for(var i=arguments.length,e=Array(i>1?i-1:0),a=1;a<i;a++)e[a-1]=arguments[a];if(H(t)&&e.length>0){if(Object.assign)return Object.assign.apply(Object,[t].concat(e));e.forEach(function(i){H(i)&&Object.keys(i).forEach(function(e){t[e]=i[e]})})}return t}function z(t,i){for(var e=arguments.length,a=Array(e>2?e-2:0),n=2;n<e;n++)a[n-2]=arguments[n];return function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];return t.apply(i,a.concat(n))}}var R=/\.\d*(?:0|9){12}\d*$/i;function A(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return R.test(t)?Math.round(t*i)/i:t}var I=/^(width|height|left|top|marginLeft|marginTop)$/;function U(t,i){var e=t.style;O(i,function(t,i){I.test(i)&&W(t)&&(t+="px"),e[i]=t})}function j(t,i){if(i)if(W(t.length))O(t,function(t){j(t,i)});else if(t.classList)t.classList.add(i);else{var e=t.className.trim();e?e.indexOf(i)<0&&(t.className=e+" "+i):t.className=i}}function P(t,i){i&&(W(t.length)?O(t,function(t){P(t,i)}):t.classList?t.classList.remove(i):t.className.indexOf(i)>=0&&(t.className=t.className.replace(i,"")))}function q(t,i,e){i&&(W(t.length)?O(t,function(t){q(t,i,e)}):e?j(t,i):P(t,i))}var $=/([a-z\d])([A-Z])/g;function Q(t){return t.replace($,"$1-$2").toLowerCase()}function Z(t,i){return H(t[i])?t[i]:t.dataset?t.dataset[i]:t.getAttribute("data-"+Q(i))}function F(t,i,e){H(e)?t[i]=e:t.dataset?t.dataset[i]=e:t.setAttribute("data-"+Q(i),e)}function K(t,i){if(H(t[i]))try{delete t[i]}catch(e){t[i]=null}else if(t.dataset)try{delete t.dataset[i]}catch(e){t.dataset[i]=null}else t.removeAttribute("data-"+Q(i))}var V=/\s+/;function G(t,i,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(X(e)){var n=i.trim().split(V);n.length>1?O(n,function(i){G(t,i,e,a)}):t.removeEventListener?t.removeEventListener(i,e,a):t.detachEvent&&t.detachEvent("on"+i,e)}}function J(t,i,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(X(e)){var n=i.trim().split(V);if(n.length>1)O(n,function(i){J(t,i,e,a)});else{if(a.once){var o=e;e=function(){for(var n=arguments.length,h=Array(n),r=0;r<n;r++)h[r]=arguments[r];return G(t,i,e,a),o.apply(t,h)}}t.addEventListener?t.addEventListener(i,e,a):t.attachEvent&&t.attachEvent("on"+i,e)}}}function _(t,i,e){if(t.dispatchEvent){var a=void 0;return X(Event)&&X(CustomEvent)?a=N(e)?new Event(i,{bubbles:!0,cancelable:!0}):new CustomEvent(i,{detail:e,bubbles:!0,cancelable:!0}):N(e)?(a=document.createEvent("Event")).initEvent(i,!0,!0):(a=document.createEvent("CustomEvent")).initCustomEvent(i,!0,!0,e),t.dispatchEvent(a)}return!t.fireEvent||t.fireEvent("on"+i)}function tt(t){var i=document.documentElement,e=t.getBoundingClientRect();return{left:e.left+((window.scrollX||i&&i.scrollLeft||0)-(i&&i.clientLeft||0)),top:e.top+((window.scrollY||i&&i.scrollTop||0)-(i&&i.clientTop||0))}}var it=t.location,et=/^(https?:)\/\/([^:/?#]+):?(\d*)/i;function at(t){var i=t.match(et);return i&&(i[1]!==it.protocol||i[2]!==it.hostname||i[3]!==it.port)}function nt(t){var i="timestamp="+(new Date).getTime();return t+(-1===t.indexOf("?")?"?":"&")+i}function ot(t){var i=t.rotate,e=t.scaleX,a=t.scaleY,n=t.translateX,o=t.translateY,h=[];W(n)&&0!==n&&h.push("translateX("+n+"px)"),W(o)&&0!==o&&h.push("translateY("+o+"px)"),W(i)&&0!==i&&h.push("rotate("+i+"deg)"),W(e)&&1!==e&&h.push("scaleX("+e+")"),W(a)&&1!==a&&h.push("scaleY("+a+")");var r=h.length?h.join(" "):"none";return{WebkitTransform:r,msTransform:r,transform:r}}var ht=t.navigator,rt=ht&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(ht.userAgent);function st(t,i){var e=t.pageX,a=t.pageY,n={endX:e,endY:a};return i?n:S({startX:e,startY:a},n)}var ct=Number.isFinite||t.isFinite;function lt(t){var i=t.aspectRatio,e=t.height,a=t.width,n=function(t){return ct(t)&&t>0};return n(a)&&n(e)?e*i>a?e=a/i:a=e*i:n(a)?e=a/i:n(e)&&(a=e*i),{width:a,height:e}}var dt=String.fromCharCode;var pt=/^data:.*,/;function mt(t){var i=new DataView(t),e=void 0,a=void 0,n=void 0,o=void 0;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var h=i.byteLength,r=2;r<h;){if(255===i.getUint8(r)&&225===i.getUint8(r+1)){n=r;break}r+=1}if(n){var s=n+10;if("Exif"===function(t,i,e){var a="",n=void 0;for(e+=i,n=i;n<e;n+=1)a+=dt(t.getUint8(n));return a}(i,n+4,4)){var c=i.getUint16(s);if(((a=18761===c)||19789===c)&&42===i.getUint16(s+2,a)){var l=i.getUint32(s+4,a);l>=8&&(o=s+l)}}}if(o){var d=i.getUint16(o,a),p=void 0,m=void 0;for(m=0;m<d;m+=1)if(p=o+12*m+2,274===i.getUint16(p,a)){p+=8,e=i.getUint16(p,a),i.setUint16(p,1,a);break}}return e}var ut={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,i=this.options,e=this.container,a=this.cropper;j(a,n),P(t,n);var o={width:Math.max(e.offsetWidth,Number(i.minContainerWidth)||200),height:Math.max(e.offsetHeight,Number(i.minContainerHeight)||100)};this.containerData=o,U(a,{width:o.width,height:o.height}),j(t,n),P(a,n)},initCanvas:function(){var t=this.containerData,i=this.imageData,e=this.options.viewMode,a=Math.abs(i.rotate)%180==90,n=a?i.naturalHeight:i.naturalWidth,o=a?i.naturalWidth:i.naturalHeight,h=n/o,r=t.width,s=t.height;t.height*h>t.width?3===e?r=t.height*h:s=t.width/h:3===e?s=t.width/h:r=t.height*h;var c={aspectRatio:h,naturalWidth:n,naturalHeight:o,width:r,height:s};c.left=(t.width-r)/2,c.top=(t.height-s)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===e||2===e,this.limitCanvas(!0,!0),this.initialImageData=S({},i),this.initialCanvasData=S({},c)},limitCanvas:function(t,i){var e=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,h=e.viewMode,r=n.aspectRatio,s=this.cropped&&o;if(t){var c=Number(e.minCanvasWidth)||0,l=Number(e.minCanvasHeight)||0;h>1?(c=Math.max(c,a.width),l=Math.max(l,a.height),3===h&&(l*r>c?c=l*r:l=c/r)):h>0&&(c?c=Math.max(c,s?o.width:0):l?l=Math.max(l,s?o.height:0):s&&(c=o.width,(l=o.height)*r>c?c=l*r:l=c/r));var d=lt({aspectRatio:r,width:c,height:l});c=d.width,l=d.height,n.minWidth=c,n.minHeight=l,n.maxWidth=1/0,n.maxHeight=1/0}if(i)if(h){var p=a.width-n.width,m=a.height-n.height;n.minLeft=Math.min(0,p),n.minTop=Math.min(0,m),n.maxLeft=Math.max(0,p),n.maxTop=Math.max(0,m),s&&this.limited&&(n.minLeft=Math.min(o.left,o.left+(o.width-n.width)),n.minTop=Math.min(o.top,o.top+(o.height-n.height)),n.maxLeft=o.left,n.maxTop=o.top,2===h&&(n.width>=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,m),n.maxTop=Math.max(0,m))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,i){var e=this.canvasData,a=this.imageData;if(i){var n=function(t){var i=t.width,e=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:e,height:i};var n=a%90*Math.PI/180,o=Math.sin(n),h=Math.cos(n),r=i*h+e*o,s=i*o+e*h;return a>90?{width:s,height:r}:{width:r,height:s}}({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),o=n.width,h=n.height,r=e.width*(o/e.naturalWidth),s=e.height*(h/e.naturalHeight);e.left-=(r-e.width)/2,e.top-=(s-e.height)/2,e.width=r,e.height=s,e.aspectRatio=o/h,e.naturalWidth=o,e.naturalHeight=h,this.limitCanvas(!0,!1)}(e.width>e.maxWidth||e.width<e.minWidth)&&(e.left=e.oldLeft),(e.height>e.maxHeight||e.height<e.minHeight)&&(e.top=e.oldTop),e.width=Math.min(Math.max(e.width,e.minWidth),e.maxWidth),e.height=Math.min(Math.max(e.height,e.minHeight),e.maxHeight),this.limitCanvas(!1,!0),e.left=Math.min(Math.max(e.left,e.minLeft),e.maxLeft),e.top=Math.min(Math.max(e.top,e.minTop),e.maxTop),e.oldLeft=e.left,e.oldTop=e.top,U(this.canvas,S({width:e.width,height:e.height},ot({translateX:e.left,translateY:e.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var i=this.canvasData,e=this.imageData,a=e.naturalWidth*(i.width/i.naturalWidth),n=e.naturalHeight*(i.height/i.naturalHeight);S(e,{width:a,height:n,left:(i.width-a)/2,top:(i.height-n)/2}),U(this.image,S({width:e.width,height:e.height},ot(S({translateX:e.left,translateY:e.top},e)))),t&&this.output()},initCropBox:function(){var t=this.options,i=this.canvasData,e=t.aspectRatio,a=Number(t.autoCropArea)||.8,n={width:i.width,height:i.height};e&&(i.height*e>i.width?n.height=n.width/e:n.width=n.height*e),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=i.left+(i.width-n.width)/2,n.top=i.top+(i.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=S({},n)},limitCropBox:function(t,i){var e=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,h=this.limited,r=e.aspectRatio;if(t){var s=Number(e.minCropBoxWidth)||0,c=Number(e.minCropBoxHeight)||0,l=Math.min(a.width,h?n.width:a.width),d=Math.min(a.height,h?n.height:a.height);s=Math.min(s,a.width),c=Math.min(c,a.height),r&&(s&&c?c*r>s?c=s/r:s=c*r:s?c=s/r:c&&(s=c*r),d*r>l?d=l/r:l=d*r),o.minWidth=Math.min(s,l),o.minHeight=Math.min(c,d),o.maxWidth=l,o.maxHeight=d}i&&(h?(o.minLeft=Math.max(0,n.left),o.minTop=Math.max(0,n.top),o.maxLeft=Math.min(a.width,n.left+n.width)-o.width,o.maxTop=Math.min(a.height,n.top+n.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=a.width-o.width,o.maxTop=a.height-o.height))},renderCropBox:function(){var t=this.options,i=this.containerData,e=this.cropBoxData;(e.width>e.maxWidth||e.width<e.minWidth)&&(e.left=e.oldLeft),(e.height>e.maxHeight||e.height<e.minHeight)&&(e.top=e.oldTop),e.width=Math.min(Math.max(e.width,e.minWidth),e.maxWidth),e.height=Math.min(Math.max(e.height,e.minHeight),e.maxHeight),this.limitCropBox(!1,!0),e.left=Math.min(Math.max(e.left,e.minLeft),e.maxLeft),e.top=Math.min(Math.max(e.top,e.minTop),e.maxTop),e.oldLeft=e.left,e.oldTop=e.top,t.movable&&t.cropBoxMovable&&F(this.face,s,e.width>=i.width&&e.height>=i.height?"move":"all"),U(this.cropBox,S({width:e.width,height:e.height},ot({translateX:e.left,translateY:e.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),this.complete&&_(this.element,l,this.getData())}},gt={initPreview:function(){var t=this.crossOrigin,i=this.options.preview,e=t?this.crossOriginUrl:this.url,a=document.createElement("img");if(t&&(a.crossOrigin=t),a.src=e,this.viewBox.appendChild(a),this.image2=a,i){var n=i.querySelector?[i]:document.querySelectorAll(i);this.previews=n,O(n,function(i){var a=document.createElement("img");F(i,c,{width:i.offsetWidth,height:i.offsetHeight,html:i.innerHTML}),t&&(a.crossOrigin=t),a.src=e,a.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',function(t){for(;t.firstChild;)t.removeChild(t.firstChild)}(i),i.appendChild(a)})}},resetPreview:function(){O(this.previews,function(t){var i=Z(t,c);U(t,{width:i.width,height:i.height}),t.innerHTML=i.html,K(t,c)})},preview:function(){var t=this.imageData,i=this.canvasData,e=this.cropBoxData,a=e.width,n=e.height,o=t.width,h=t.height,r=e.left-i.left-t.left,s=e.top-i.top-t.top;this.cropped&&!this.disabled&&(U(this.image2,S({width:o,height:h},ot(S({translateX:-r,translateY:-s},t)))),O(this.previews,function(i){var e=Z(i,c),l=e.width,d=e.height,p=l,m=d,u=1;a&&(m=n*(u=l/a)),n&&m>d&&(p=a*(u=d/n),m=d),U(i,{width:p,height:m}),U(i.getElementsByTagName("img")[0],S({width:o*u,height:h*u},ot(S({translateX:-r*u,translateY:-s*u},t))))}))}},ft={bind:function(){var t=this.element,i=this.options,e=this.cropper;X(i.cropstart)&&J(t,m,i.cropstart),X(i.cropmove)&&J(t,p,i.cropmove),X(i.cropend)&&J(t,d,i.cropend),X(i.crop)&&J(t,l,i.crop),X(i.zoom)&&J(t,"zoom",i.zoom),J(e,g,this.onCropStart=z(this.cropStart,this)),i.zoomable&&i.zoomOnWheel&&J(e,w,this.onWheel=z(this.wheel,this)),i.toggleDragModeOnDblclick&&J(e,"dblclick",this.onDblclick=z(this.dblclick,this)),J(t.ownerDocument,f,this.onCropMove=z(this.cropMove,this)),J(t.ownerDocument,v,this.onCropEnd=z(this.cropEnd,this)),i.responsive&&J(window,"resize",this.onResize=z(this.resize,this))},unbind:function(){var t=this.element,i=this.options,e=this.cropper;X(i.cropstart)&&G(t,m,i.cropstart),X(i.cropmove)&&G(t,p,i.cropmove),X(i.cropend)&&G(t,d,i.cropend),X(i.crop)&&G(t,l,i.crop),X(i.zoom)&&G(t,"zoom",i.zoom),G(e,g,this.onCropStart),i.zoomable&&i.zoomOnWheel&&G(e,w,this.onWheel),i.toggleDragModeOnDblclick&&G(e,"dblclick",this.onDblclick),G(t.ownerDocument,f,this.onCropMove),G(t.ownerDocument,v,this.onCropEnd),i.responsive&&G(window,"resize",this.onResize)}},vt={resize:function(){var t=this.options,i=this.container,e=this.containerData,a=Number(t.minContainerWidth)||200,n=Number(t.minContainerHeight)||100;if(!(this.disabled||e.width<=a||e.height<=n)){var o=i.offsetWidth/e.width;if(1!==o||i.offsetHeight!==e.height){var h=void 0,r=void 0;t.restore&&(h=this.getCanvasData(),r=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(O(h,function(t,i){h[i]=t*o})),this.setCropBoxData(O(r,function(t,i){r[i]=t*o})))}}},dblclick:function(){if(!this.disabled&&"none"!==this.options.dragMode){this.setDragMode((t=this.dragBox,i=e,(t.classList?t.classList.contains(i):t.className.indexOf(i)>-1)?"move":"crop"));var t,i}},wheel:function(t){var i=this,e=Number(this.options.wheelZoomRatio)||.1,a=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50),t.deltaY?a=t.deltaY>0?1:-1:t.wheelDelta?a=-t.wheelDelta/120:t.detail&&(a=t.detail>0?1:-1),this.zoom(-a*e,t)))},cropStart:function(t){if(!this.disabled){var i=this.options,e=this.pointers,a=void 0;t.changedTouches?O(t.changedTouches,function(t){e[t.identifier]=st(t)}):e[t.pointerId||0]=st(t),a=Object.keys(e).length>1&&i.zoomable&&i.zoomOnTouch?"zoom":Z(t.target,s),x.test(a)&&!1!==_(this.element,m,{originalEvent:t,action:a})&&(t.preventDefault(),this.action=a,this.cropping=!1,"crop"===a&&(this.cropping=!0,j(this.dragBox,h)))}},cropMove:function(t){var i=this.action;if(!this.disabled&&i){var e=this.pointers;t.preventDefault(),!1!==_(this.element,p,{originalEvent:t,action:i})&&(t.changedTouches?O(t.changedTouches,function(t){S(e[t.identifier],st(t,!0))}):S(e[t.pointerId||0],st(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var i=this.action,e=this.pointers;t.changedTouches?O(t.changedTouches,function(t){delete e[t.identifier]}):delete e[t.pointerId||0],i&&(t.preventDefault(),Object.keys(e).length||(this.action=""),this.cropping&&(this.cropping=!1,q(this.dragBox,h,this.cropped&&this.options.modal)),_(this.element,d,{originalEvent:t,action:i}))}}},wt={change:function(t){var i=this.options,e=this.canvasData,a=this.containerData,o=this.cropBoxData,h=this.pointers,r=this.action,s=i.aspectRatio,c=o.left,l=o.top,d=o.width,p=o.height,m=c+d,u=l+p,g=0,f=0,v=a.width,w=a.height,x=!0,b=void 0;!s&&t.shiftKey&&(s=d&&p?d/p:1),this.limited&&(g=o.minLeft,f=o.minTop,v=g+Math.min(a.width,e.width,e.left+e.width),w=f+Math.min(a.height,e.height,e.top+e.height));var y=h[Object.keys(h)[0]],C={x:y.endX-y.startX,y:y.endY-y.startY},M=function(t){switch(t){case"e":m+C.x>v&&(C.x=v-m);break;case"w":c+C.x<g&&(C.x=g-c);break;case"n":l+C.y<f&&(C.y=f-l);break;case"s":u+C.y>w&&(C.y=w-u)}};switch(r){case"all":c+=C.x,l+=C.y;break;case"e":if(C.x>=0&&(m>=v||s&&(l<=f||u>=w))){x=!1;break}M("e"),d+=C.x,s&&(p=d/s,l-=C.x/s/2),d<0&&(r="w",d=0);break;case"n":if(C.y<=0&&(l<=f||s&&(c<=g||m>=v))){x=!1;break}M("n"),p-=C.y,l+=C.y,s&&(d=p*s,c+=C.y*s/2),p<0&&(r="s",p=0);break;case"w":if(C.x<=0&&(c<=g||s&&(l<=f||u>=w))){x=!1;break}M("w"),d-=C.x,c+=C.x,s&&(p=d/s,l+=C.x/s/2),d<0&&(r="e",d=0);break;case"s":if(C.y>=0&&(u>=w||s&&(c<=g||m>=v))){x=!1;break}M("s"),p+=C.y,s&&(d=p*s,c-=C.y*s/2),p<0&&(r="n",p=0);break;case"ne":if(s){if(C.y<=0&&(l<=f||m>=v)){x=!1;break}M("n"),p-=C.y,l+=C.y,d=p*s}else M("n"),M("e"),C.x>=0?m<v?d+=C.x:C.y<=0&&l<=f&&(x=!1):d+=C.x,C.y<=0?l>f&&(p-=C.y,l+=C.y):(p-=C.y,l+=C.y);d<0&&p<0?(r="sw",p=0,d=0):d<0?(r="nw",d=0):p<0&&(r="se",p=0);break;case"nw":if(s){if(C.y<=0&&(l<=f||c<=g)){x=!1;break}M("n"),p-=C.y,l+=C.y,d=p*s,c+=C.y*s}else M("n"),M("w"),C.x<=0?c>g?(d-=C.x,c+=C.x):C.y<=0&&l<=f&&(x=!1):(d-=C.x,c+=C.x),C.y<=0?l>f&&(p-=C.y,l+=C.y):(p-=C.y,l+=C.y);d<0&&p<0?(r="se",p=0,d=0):d<0?(r="ne",d=0):p<0&&(r="sw",p=0);break;case"sw":if(s){if(C.x<=0&&(c<=g||u>=w)){x=!1;break}M("w"),d-=C.x,c+=C.x,p=d/s}else M("s"),M("w"),C.x<=0?c>g?(d-=C.x,c+=C.x):C.y>=0&&u>=w&&(x=!1):(d-=C.x,c+=C.x),C.y>=0?u<w&&(p+=C.y):p+=C.y;d<0&&p<0?(r="ne",p=0,d=0):d<0?(r="se",d=0):p<0&&(r="nw",p=0);break;case"se":if(s){if(C.x>=0&&(m>=v||u>=w)){x=!1;break}M("e"),p=(d+=C.x)/s}else M("s"),M("e"),C.x>=0?m<v?d+=C.x:C.y>=0&&u>=w&&(x=!1):d+=C.x,C.y>=0?u<w&&(p+=C.y):p+=C.y;d<0&&p<0?(r="nw",p=0,d=0):d<0?(r="sw",d=0):p<0&&(r="ne",p=0);break;case"move":this.move(C.x,C.y),x=!1;break;case"zoom":this.zoom(function(t){var i=S({},t),e=[];return O(t,function(t,a){delete i[a],O(i,function(i){var a=Math.abs(t.startX-i.startX),n=Math.abs(t.startY-i.startY),o=Math.abs(t.endX-i.endX),h=Math.abs(t.endY-i.endY),r=Math.sqrt(a*a+n*n),s=(Math.sqrt(o*o+h*h)-r)/r;e.push(s)})}),e.sort(function(t,i){return Math.abs(t)<Math.abs(i)}),e[0]}(h),t),x=!1;break;case"crop":if(!C.x||!C.y){x=!1;break}b=tt(this.cropper),c=y.startX-b.left,l=y.startY-b.top,d=o.minWidth,p=o.minHeight,C.x>0?r=C.y>0?"se":"ne":C.x<0&&(c-=d,r=C.y>0?"sw":"nw"),C.y<0&&(l-=p),this.cropped||(P(this.cropBox,n),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}x&&(o.width=d,o.height=p,o.left=c,o.top=l,this.action=r,this.renderCropBox()),O(h,function(t){t.startX=t.endX,t.startY=t.endY})}},xt={crop:function(){return this.ready&&!this.disabled&&(this.cropped||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&j(this.dragBox,h),P(this.cropBox,n)),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=S({},this.initialImageData),this.canvasData=S({},this.initialCanvasData),this.cropBoxData=S({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(S(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),P(this.dragBox,h),j(this.cropBox,n)),this},replace:function(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),i?(this.url=t,this.image.src=t,this.ready&&(this.image2.src=t,O(this.previews,function(i){i.getElementsByTagName("img")[0].src=t}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.load(t))),this},enable:function(){return this.ready&&(this.disabled=!1,P(this.cropper,a)),this},disable:function(){return this.ready&&(this.disabled=!0,j(this.cropper,a)),this},destroy:function(){var t=this.element,e=this.image;return this.loaded?(this.isImg&&this.replaced&&(t.src=this.originalUrl),this.unbuild(),P(t,n)):this.isImg?G(t,u,this.onStart):e&&e.parentNode.removeChild(e),K(t,i),this},move:function(t,i){var e=this.canvasData,a=e.left,n=e.top;return this.moveTo(N(t)?t:a+Number(t),N(i)?i:n+Number(i))},moveTo:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,e=this.canvasData,a=!1;return t=Number(t),i=Number(i),this.ready&&!this.disabled&&this.options.movable&&(W(t)&&(e.left=t,a=!0),W(i)&&(e.top=i,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(t,i){var e=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(e.width*t/e.naturalWidth,null,i)},zoomTo:function(t,i,e){var a=this.options,n=this.canvasData,o=n.width,h=n.height,r=n.naturalWidth,s=n.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&a.zoomable){var c=r*t,l=s*t;if(!1===_(this.element,"zoom",{originalEvent:e,oldRatio:o/r,ratio:c/r}))return this;if(e){var d=this.pointers,p=tt(this.cropper),m=d&&Object.keys(d).length?function(t){var i=0,e=0,a=0;return O(t,function(t){var n=t.startX,o=t.startY;i+=n,e+=o,a+=1}),{pageX:i/=a,pageY:e/=a}}(d):{pageX:e.pageX,pageY:e.pageY};n.left-=(c-o)*((m.pageX-p.left-n.left)/o),n.top-=(l-h)*((m.pageY-p.top-n.top)/h)}else Y(i)&&W(i.x)&&W(i.y)?(n.left-=(c-o)*((i.x-n.left)/o),n.top-=(l-h)*((i.y-n.top)/h)):(n.left-=(c-o)/2,n.top-=(l-h)/2);n.width=c,n.height=l,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return W(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var i=this.imageData.scaleY;return this.scale(t,W(i)?i:1)},scaleY:function(t){var i=this.imageData.scaleX;return this.scale(W(i)?i:1,t)},scale:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,e=this.imageData,a=!1;return t=Number(t),i=Number(i),this.ready&&!this.disabled&&this.options.scalable&&(W(t)&&(e.scaleX=t,a=!0),W(i)&&(e.scaleY=i,a=!0),a&&this.renderCanvas(!0,!0)),this},getData:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,e=this.imageData,a=this.canvasData,n=this.cropBoxData,o=void 0;if(this.ready&&this.cropped){o={x:n.left-a.left,y:n.top-a.top,width:n.width,height:n.height};var h=e.width/e.naturalWidth;O(o,function(i,e){i/=h,o[e]=t?Math.round(i):i})}else o={x:0,y:0,width:0,height:0};return i.rotatable&&(o.rotate=e.rotate||0),i.scalable&&(o.scaleX=e.scaleX||1,o.scaleY=e.scaleY||1),o},setData:function(t){var i=this.options,e=this.imageData,a=this.canvasData,n={};if(X(t)&&(t=t.call(this.element)),this.ready&&!this.disabled&&Y(t)){var o=!1;i.rotatable&&W(t.rotate)&&t.rotate!==e.rotate&&(e.rotate=t.rotate,o=!0),i.scalable&&(W(t.scaleX)&&t.scaleX!==e.scaleX&&(e.scaleX=t.scaleX,o=!0),W(t.scaleY)&&t.scaleY!==e.scaleY&&(e.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var h=e.width/e.naturalWidth;W(t.x)&&(n.left=t.x*h+a.left),W(t.y)&&(n.top=t.y*h+a.top),W(t.width)&&(n.width=t.width*h),W(t.height)&&(n.height=t.height*h),this.setCropBoxData(n)}return this},getContainerData:function(){return this.ready?S({},this.containerData):{}},getImageData:function(){return this.loaded?S({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,i={};return this.ready&&O(["left","top","width","height","naturalWidth","naturalHeight"],function(e){i[e]=t[e]}),i},setCanvasData:function(t){var i=this.canvasData,e=i.aspectRatio;return X(t)&&(t=t.call(this.element)),this.ready&&!this.disabled&&Y(t)&&(W(t.left)&&(i.left=t.left),W(t.top)&&(i.top=t.top),W(t.width)?(i.width=t.width,i.height=t.width/e):W(t.height)&&(i.height=t.height,i.width=t.height*e),this.renderCanvas(!0)),this},getCropBoxData:function(){var t=this.cropBoxData,i=void 0;return this.ready&&this.cropped&&(i={left:t.left,top:t.top,width:t.width,height:t.height}),i||{}},setCropBoxData:function(t){var i=this.cropBoxData,e=this.options.aspectRatio,a=void 0,n=void 0;return X(t)&&(t=t.call(this.element)),this.ready&&this.cropped&&!this.disabled&&Y(t)&&(W(t.left)&&(i.left=t.left),W(t.top)&&(i.top=t.top),W(t.width)&&t.width!==i.width&&(a=!0,i.width=t.width),W(t.height)&&t.height!==i.height&&(n=!0,i.height=t.height),e&&(a?i.height=i.width/e:n&&(i.width=i.height*e)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var i=this.canvasData,e=function(t,i,e,a){var n=i.naturalWidth,o=i.naturalHeight,h=i.rotate,r=void 0===h?0:h,s=i.scaleX,c=void 0===s?1:s,l=i.scaleY,d=void 0===l?1:l,p=e.aspectRatio,m=e.naturalWidth,u=e.naturalHeight,g=a.fillColor,f=void 0===g?"transparent":g,v=a.imageSmoothingEnabled,w=void 0===v||v,x=a.imageSmoothingQuality,b=void 0===x?"low":x,y=a.maxWidth,C=void 0===y?1/0:y,M=a.maxHeight,D=void 0===M?1/0:M,B=a.minWidth,k=void 0===B?0:B,T=a.minHeight,W=void 0===T?0:T,N=document.createElement("canvas"),H=N.getContext("2d"),L=lt({aspectRatio:p,width:C,height:D}),Y=lt({aspectRatio:p,width:k,height:W}),X=Math.min(L.width,Math.max(Y.width,m)),O=Math.min(L.height,Math.max(Y.height,u)),S=[-n/2,-o/2,n,o];return N.width=A(X),N.height=A(O),H.fillStyle=f,H.fillRect(0,0,X,O),H.save(),H.translate(X/2,O/2),H.rotate(r*Math.PI/180),H.scale(c,d),H.imageSmoothingEnabled=w,H.imageSmoothingQuality=b,H.drawImage.apply(H,[t].concat(E(S.map(function(t){return Math.floor(A(t))})))),H.restore(),N}(this.image,this.imageData,i,t);if(!this.cropped)return e;var a=this.getData(),n=a.x,o=a.y,h=a.width,r=a.height,s=h/r,c=lt({aspectRatio:s,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),l=lt({aspectRatio:s,width:t.minWidth||0,height:t.minHeight||0}),d=lt({aspectRatio:s,width:t.width||h,height:t.height||r}),p=d.width,m=d.height;p=Math.min(c.width,Math.max(l.width,p)),m=Math.min(c.height,Math.max(l.height,m));var u=document.createElement("canvas"),g=u.getContext("2d");u.width=A(p),u.height=A(m),g.fillStyle=t.fillColor||"transparent",g.fillRect(0,0,p,m);var f=t.imageSmoothingEnabled,v=void 0===f||f,w=t.imageSmoothingQuality;g.imageSmoothingEnabled=v,w&&(g.imageSmoothingQuality=w);var x=e.width,b=e.height,y=n,C=o,M=void 0,D=void 0,B=void 0,k=void 0,T=void 0,W=void 0;y<=-h||y>x?(y=0,M=0,B=0,T=0):y<=0?(B=-y,y=0,T=M=Math.min(x,h+y)):y<=x&&(B=0,T=M=Math.min(h,x-y)),M<=0||C<=-r||C>b?(C=0,D=0,k=0,W=0):C<=0?(k=-C,C=0,W=D=Math.min(b,r+C)):C<=b&&(k=0,W=D=Math.min(r,b-C));var N=[y,C,M,D];if(T>0&&W>0){var H=p/h;N.push(B*H,k*H,T*H,W*H)}return g.drawImage.apply(g,[e].concat(E(N.map(function(t){return Math.floor(A(t))})))),u},setAspectRatio:function(t){var i=this.options;return this.disabled||N(t)||(i.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var i=this.options,a=this.dragBox,n=this.face;if(this.loaded&&!this.disabled){var o="crop"===t,h=i.movable&&"move"===t;F(a,s,t=o||h?t:"none"),q(a,e,o),q(a,r,h),i.cropBoxMovable||(F(n,s,t),q(n,e,o),q(n,r,h))}return this}},bt=t.Cropper,yt=function(){function t(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(B(this,t),!i||!C.test(i.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=i,this.options=S({},M,Y(e)&&e),this.complete=!1,this.cropped=!1,this.disabled=!1,this.isImg=!1,this.limited=!1,this.loaded=!1,this.ready=!1,this.replaced=!1,this.wheeling=!1,this.originalUrl="",this.canvasData=null,this.cropBoxData=null,this.previews=null,this.pointers={},this.init()}return k(t,[{key:"init",value:function(){var t=this.element,e=t.tagName.toLowerCase(),a=void 0;if(!Z(t,i)){if(F(t,i,this),"img"===e){if(this.isImg=!0,a=t.getAttribute("src")||"",this.originalUrl=a,!a)return;a=t.src}else"canvas"===e&&window.HTMLCanvasElement&&(a=t.toDataURL());this.load(a)}}},{key:"load",value:function(t){var i=this;if(t){this.url=t,this.imageData={};var e=this.element,a=this.options;if(a.checkOrientation&&window.ArrayBuffer)if(b.test(t))y.test(t)?this.read(function(t){var i=t.replace(pt,""),e=atob(i),a=new ArrayBuffer(e.length),n=new Uint8Array(a);return O(n,function(t,i){n[i]=e.charCodeAt(i)}),a}(t)):this.clone();else{var n=new XMLHttpRequest;n.onerror=function(){i.clone()},n.onload=function(){i.read(n.response)},a.checkCrossOrigin&&at(t)&&e.crossOrigin&&(t=nt(t)),n.open("get",t),n.responseType="arraybuffer",n.withCredentials="use-credentials"===e.crossOrigin,n.send()}else this.clone()}}},{key:"read",value:function(t){var i=this.options,e=this.imageData,a=mt(t),n=0,o=1,h=1;if(a>1){this.url=function(t,i){var e="";return O(new Uint8Array(t),function(t){e+=dt(t)}),"data:"+i+";base64,"+btoa(e)}(t,"image/jpeg");var r=function(t){var i=0,e=1,a=1;switch(t){case 2:e=-1;break;case 3:i=-180;break;case 4:a=-1;break;case 5:i=90,a=-1;break;case 6:i=90;break;case 7:i=90,e=-1;break;case 8:i=-90}return{rotate:i,scaleX:e,scaleY:a}}(a);n=r.rotate,o=r.scaleX,h=r.scaleY}i.rotatable&&(e.rotate=n),i.scalable&&(e.scaleX=o,e.scaleY=h),this.clone()}},{key:"clone",value:function(){var t=this.element,i=this.url,e=void 0,a=void 0;this.options.checkCrossOrigin&&at(i)&&((e=t.crossOrigin)?a=i:(e="anonymous",a=nt(i))),this.crossOrigin=e,this.crossOriginUrl=a;var n=document.createElement("img");e&&(n.crossOrigin=e),n.src=a||i;var h=z(this.start,this),r=z(this.stop,this);this.image=n,this.onStart=h,this.onStop=r,this.isImg?t.complete?this.start():J(t,u,h):(J(n,u,h),J(n,"error",r),j(n,o),t.parentNode.insertBefore(n,t.nextSibling))}},{key:"start",value:function(t){var i=this,e=this.isImg?this.element:this.image;t&&(G(e,u,this.onStart),G(e,"error",this.onStop)),function(t,i){if(!t.naturalWidth||rt){var e=document.createElement("img"),a=document.body||document.documentElement;e.onload=function(){i(e.width,e.height),rt||a.removeChild(e)},e.src=t.src,rt||(e.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",a.appendChild(e))}else i(t.naturalWidth,t.naturalHeight)}(e,function(t,e){S(i.imageData,{naturalWidth:t,naturalHeight:e,aspectRatio:t/e}),i.loaded=!0,i.build()})}},{key:"stop",value:function(){var t=this.image;G(t,u,this.onStart),G(t,"error",this.onStop),t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){var t=this;if(this.loaded){this.ready&&this.unbuild();var e=this.element,a=this.options,c=this.image,d=e.parentNode,p=document.createElement("div");p.innerHTML='<div class="cropper-container"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-action="e"></span><span class="cropper-line line-n" data-action="n"></span><span class="cropper-line line-w" data-action="w"></span><span class="cropper-line line-s" data-action="s"></span><span class="cropper-point point-e" data-action="e"></span><span class="cropper-point point-n" data-action="n"></span><span class="cropper-point point-w" data-action="w"></span><span class="cropper-point point-s" data-action="s"></span><span class="cropper-point point-ne" data-action="ne"></span><span class="cropper-point point-nw" data-action="nw"></span><span class="cropper-point point-sw" data-action="sw"></span><span class="cropper-point point-se" data-action="se"></span></div></div>';var m=p.querySelector("."+i+"-container"),u=m.querySelector("."+i+"-canvas"),g=m.querySelector("."+i+"-drag-box"),f=m.querySelector("."+i+"-crop-box"),v=f.querySelector("."+i+"-face");this.container=d,this.cropper=m,this.canvas=u,this.dragBox=g,this.cropBox=f,this.viewBox=m.querySelector("."+i+"-view-box"),this.face=v,u.appendChild(c),j(e,n),d.insertBefore(m,e.nextSibling),this.isImg||P(c,o),this.initPreview(),this.bind(),a.aspectRatio=Math.max(0,a.aspectRatio)||NaN,a.viewMode=Math.max(0,Math.min(3,Math.round(a.viewMode)))||0,this.cropped=a.autoCrop,a.autoCrop?a.modal&&j(g,h):j(f,n),a.guides||j(f.getElementsByClassName(i+"-dashed"),n),a.center||j(f.getElementsByClassName(i+"-center"),n),a.background&&j(m,i+"-bg"),a.highlight||j(v,"cropper-invisible"),a.cropBoxMovable&&(j(v,r),F(v,s,"all")),a.cropBoxResizable||(j(f.getElementsByClassName(i+"-line"),n),j(f.getElementsByClassName(i+"-point"),n)),this.setDragMode(a.dragMode),this.render(),this.ready=!0,this.setData(a.data),this.completing=setTimeout(function(){X(a.ready)&&J(e,"ready",a.ready,{once:!0}),_(e,"ready"),_(e,l,t.getData()),t.complete=!0},0)}}},{key:"unbuild",value:function(){this.ready&&(this.complete||clearTimeout(this.completing),this.ready=!1,this.complete=!1,this.initialImageData=null,this.initialCanvasData=null,this.initialCropBoxData=null,this.containerData=null,this.canvasData=null,this.cropBoxData=null,this.unbind(),this.resetPreview(),this.previews=null,this.viewBox=null,this.cropBox=null,this.dragBox=null,this.canvas=null,this.container=null,this.cropper.parentNode.removeChild(this.cropper),this.cropper=null)}}],[{key:"noConflict",value:function(){return window.Cropper=bt,t}},{key:"setDefaults",value:function(t){S(M,Y(t)&&t)}}]),t}();return S(yt.prototype,ut,gt,ft,vt,wt,xt),yt}); \ No newline at end of file
diff --git a/library/cropperjs/docs/css/cropper.css b/library/cropperjs/docs/css/cropper.css
new file mode 100644
index 000000000..dd22178fe
--- /dev/null
+++ b/library/cropperjs/docs/css/cropper.css
@@ -0,0 +1,306 @@
+/*!
+ * Cropper.js v1.2.2
+ * https://github.com/fengyuanchen/cropperjs
+ *
+ * Copyright (c) 2015-2018 Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2018-01-03T13:26:29.610Z
+ */
+
+.cropper-container {
+ direction: ltr;
+ font-size: 0;
+ line-height: 0;
+ position: relative;
+ -ms-touch-action: none;
+ touch-action: none;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.cropper-container img {/*Avoid margin top issue (Occur only when margin-top <= -height)
+ */
+ display: block;
+ height: 100%;
+ image-orientation: 0deg;
+ max-height: none !important;
+ max-width: none !important;
+ min-height: 0 !important;
+ min-width: 0 !important;
+ width: 100%;
+}
+
+.cropper-wrap-box,
+.cropper-canvas,
+.cropper-drag-box,
+.cropper-crop-box,
+.cropper-modal {
+ bottom: 0;
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+}
+
+.cropper-wrap-box,
+.cropper-canvas {
+ overflow: hidden;
+}
+
+.cropper-drag-box {
+ background-color: #fff;
+ opacity: 0;
+}
+
+.cropper-modal {
+ background-color: #000;
+ opacity: .5;
+}
+
+.cropper-view-box {
+ display: block;
+ height: 100%;
+ outline-color: rgba(51, 153, 255, 0.75);
+ outline: 1px solid #39f;
+ overflow: hidden;
+ width: 100%;
+}
+
+.cropper-dashed {
+ border: 0 dashed #eee;
+ display: block;
+ opacity: .5;
+ position: absolute;
+}
+
+.cropper-dashed.dashed-h {
+ border-bottom-width: 1px;
+ border-top-width: 1px;
+ height: 33.33333%;
+ left: 0;
+ top: 33.33333%;
+ width: 100%;
+}
+
+.cropper-dashed.dashed-v {
+ border-left-width: 1px;
+ border-right-width: 1px;
+ height: 100%;
+ left: 33.33333%;
+ top: 0;
+ width: 33.33333%;
+}
+
+.cropper-center {
+ display: block;
+ height: 0;
+ left: 50%;
+ opacity: .75;
+ position: absolute;
+ top: 50%;
+ width: 0;
+}
+
+.cropper-center:before,
+.cropper-center:after {
+ background-color: #eee;
+ content: ' ';
+ display: block;
+ position: absolute;
+}
+
+.cropper-center:before {
+ height: 1px;
+ left: -3px;
+ top: 0;
+ width: 7px;
+}
+
+.cropper-center:after {
+ height: 7px;
+ left: 0;
+ top: -3px;
+ width: 1px;
+}
+
+.cropper-face,
+.cropper-line,
+.cropper-point {
+ display: block;
+ height: 100%;
+ opacity: .1;
+ position: absolute;
+ width: 100%;
+}
+
+.cropper-face {
+ background-color: #fff;
+ left: 0;
+ top: 0;
+}
+
+.cropper-line {
+ background-color: #39f;
+}
+
+.cropper-line.line-e {
+ cursor: ew-resize;
+ right: -3px;
+ top: 0;
+ width: 5px;
+}
+
+.cropper-line.line-n {
+ cursor: ns-resize;
+ height: 5px;
+ left: 0;
+ top: -3px;
+}
+
+.cropper-line.line-w {
+ cursor: ew-resize;
+ left: -3px;
+ top: 0;
+ width: 5px;
+}
+
+.cropper-line.line-s {
+ bottom: -3px;
+ cursor: ns-resize;
+ height: 5px;
+ left: 0;
+}
+
+.cropper-point {
+ background-color: #39f;
+ height: 5px;
+ opacity: .75;
+ width: 5px;
+}
+
+.cropper-point.point-e {
+ cursor: ew-resize;
+ margin-top: -3px;
+ right: -3px;
+ top: 50%;
+}
+
+.cropper-point.point-n {
+ cursor: ns-resize;
+ left: 50%;
+ margin-left: -3px;
+ top: -3px;
+}
+
+.cropper-point.point-w {
+ cursor: ew-resize;
+ left: -3px;
+ margin-top: -3px;
+ top: 50%;
+}
+
+.cropper-point.point-s {
+ bottom: -3px;
+ cursor: s-resize;
+ left: 50%;
+ margin-left: -3px;
+}
+
+.cropper-point.point-ne {
+ cursor: nesw-resize;
+ right: -3px;
+ top: -3px;
+}
+
+.cropper-point.point-nw {
+ cursor: nwse-resize;
+ left: -3px;
+ top: -3px;
+}
+
+.cropper-point.point-sw {
+ bottom: -3px;
+ cursor: nesw-resize;
+ left: -3px;
+}
+
+.cropper-point.point-se {
+ bottom: -3px;
+ cursor: nwse-resize;
+ height: 20px;
+ opacity: 1;
+ right: -3px;
+ width: 20px;
+}
+
+@media (min-width: 768px) {
+ .cropper-point.point-se {
+ height: 15px;
+ width: 15px;
+ }
+}
+
+@media (min-width: 992px) {
+ .cropper-point.point-se {
+ height: 10px;
+ width: 10px;
+ }
+}
+
+@media (min-width: 1200px) {
+ .cropper-point.point-se {
+ height: 5px;
+ opacity: .75;
+ width: 5px;
+ }
+}
+
+.cropper-point.point-se:before {
+ background-color: #39f;
+ bottom: -50%;
+ content: ' ';
+ display: block;
+ height: 200%;
+ opacity: 0;
+ position: absolute;
+ right: -50%;
+ width: 200%;
+}
+
+.cropper-invisible {
+ opacity: 0;
+}
+
+.cropper-bg {
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');
+}
+
+.cropper-hide {
+ display: block;
+ height: 0;
+ position: absolute;
+ width: 0;
+}
+
+.cropper-hidden {
+ display: none !important;
+}
+
+.cropper-move {
+ cursor: move;
+}
+
+.cropper-crop {
+ cursor: crosshair;
+}
+
+.cropper-disabled .cropper-drag-box,
+.cropper-disabled .cropper-face,
+.cropper-disabled .cropper-line,
+.cropper-disabled .cropper-point {
+ cursor: not-allowed;
+}
+
diff --git a/library/cropperjs/docs/css/main.css b/library/cropperjs/docs/css/main.css
new file mode 100644
index 000000000..d89f82d27
--- /dev/null
+++ b/library/cropperjs/docs/css/main.css
@@ -0,0 +1,252 @@
+.btn {
+ padding-left: .75rem;
+ padding-right: .75rem;
+}
+
+label.btn {
+ margin-bottom: 0;
+}
+
+.d-flex > .btn {
+ flex: 1;
+}
+
+.carbonads {
+ border-radius: .25rem;
+ border: 1px solid #ccc;
+ font-size: .875rem;
+ overflow: hidden;
+ padding: 1rem;
+}
+
+.carbon-wrap {
+ overflow: hidden;
+}
+
+.carbon-img {
+ clear: left;
+ display: block;
+ float: left;
+}
+
+.carbon-text,
+.carbon-poweredby {
+ display: block;
+ margin-left: 140px;
+}
+
+.carbon-text,
+.carbon-text:hover,
+.carbon-text:focus {
+ color: #fff;
+ text-decoration: none;
+}
+
+.carbon-poweredby,
+.carbon-poweredby:hover,
+.carbon-poweredby:focus {
+ color: #ddd;
+ text-decoration: none;
+}
+
+@media (min-width: 768px) {
+ .carbonads {
+ float: right;
+ margin-bottom: -1rem;
+ margin-top: -1rem;
+ max-width: 360px;
+ }
+}
+
+.footer {
+ font-size: .875rem;
+}
+
+.heart {
+ color: #ddd;
+ display: block;
+ height: 2rem;
+ line-height: 2rem;
+ margin-bottom: 0;
+ margin-top: 1rem;
+ position: relative;
+ text-align: center;
+ width: 100%;
+}
+
+.heart:hover {
+ color: #ff4136;
+}
+
+.heart::before {
+ border-top: 1px solid #eee;
+ content: " ";
+ display: block;
+ height: 0;
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 50%;
+}
+
+.heart::after {
+ background-color: #fff;
+ content: "♥";
+ padding-left: .5rem;
+ padding-right: .5rem;
+ position: relative;
+ z-index: 1;
+}
+
+.img-container,
+.img-preview {
+ background-color: #f7f7f7;
+ text-align: center;
+ width: 100%;
+}
+
+.img-container {
+ margin-bottom: 1rem;
+ max-height: 497px;
+ min-height: 200px;
+}
+
+@media (min-width: 768px) {
+ .img-container {
+ min-height: 497px;
+ }
+}
+
+.img-container > img {
+ max-width: 100%;
+}
+
+.docs-preview {
+ margin-right: -1rem;
+}
+
+.img-preview {
+ float: left;
+ margin-bottom: .5rem;
+ margin-right: .5rem;
+ overflow: hidden;
+}
+
+.img-preview > img {
+ max-width: 100%;
+}
+
+.preview-lg {
+ height: 9rem;
+ width: 16rem;
+}
+
+.preview-md {
+ height: 4.5rem;
+ width: 8rem;
+}
+
+.preview-sm {
+ height: 2.25rem;
+ width: 4rem;
+}
+
+.preview-xs {
+ height: 1.125rem;
+ margin-right: 0;
+ width: 2rem;
+}
+
+.docs-data > .input-group {
+ margin-bottom: .5rem;
+}
+
+.docs-data .input-group-prepend .input-group-text {
+ min-width: 4rem;
+}
+
+.docs-data .input-group-append .input-group-text {
+ min-width: 3rem;
+}
+
+.docs-buttons > .btn,
+.docs-buttons > .btn-group,
+.docs-buttons > .form-control {
+ margin-bottom: .5rem;
+ margin-right: .25rem;
+}
+
+.docs-toggles > .btn,
+.docs-toggles > .btn-group,
+.docs-toggles > .dropdown {
+ margin-bottom: .5rem;
+}
+
+.docs-tooltip {
+ display: block;
+ margin: -.5rem -.75rem;
+ padding: .5rem .75rem;
+}
+
+.docs-tooltip > .icon {
+ margin: 0 -.25rem;
+ vertical-align: top;
+}
+
+.tooltip-inner {
+ white-space: normal;
+}
+
+.btn-upload .tooltip-inner,
+.btn-toggle .tooltip-inner {
+ white-space: nowrap;
+}
+
+.btn-toggle {
+ padding: .5rem;
+}
+
+.btn-toggle > .docs-tooltip {
+ margin: -.5rem;
+ padding: .5rem;
+}
+
+@media (max-width: 400px) {
+ .btn-group-crop {
+ margin-right: -1rem!important;
+ }
+
+ .btn-group-crop > .btn {
+ padding-left: .5rem;
+ padding-right: .5rem;
+ }
+
+ .btn-group-crop .docs-tooltip {
+ margin-left: -.5rem;
+ margin-right: -.5rem;
+ padding-left: .5rem;
+ padding-right: .5rem;
+ }
+}
+
+.docs-options .dropdown-menu {
+ width: 100%;
+}
+
+.docs-options .dropdown-menu > li {
+ font-size: .875rem;
+ padding: .125rem 1rem;
+}
+
+.docs-options .dropdown-menu .form-check-label {
+ display: block;
+}
+
+.docs-cropped .modal-body {
+ text-align: center;
+}
+
+.docs-cropped .modal-body > img,
+.docs-cropped .modal-body > canvas {
+ max-width: 100%;
+}
diff --git a/library/cropperjs/docs/images/data.jpg b/library/cropperjs/docs/images/data.jpg
new file mode 100644
index 000000000..56926a274
--- /dev/null
+++ b/library/cropperjs/docs/images/data.jpg
Binary files differ
diff --git a/library/cropperjs/docs/images/layers.jpg b/library/cropperjs/docs/images/layers.jpg
new file mode 100644
index 000000000..02b77e7b2
--- /dev/null
+++ b/library/cropperjs/docs/images/layers.jpg
Binary files differ
diff --git a/library/cropperjs/docs/images/picture-2.jpg b/library/cropperjs/docs/images/picture-2.jpg
new file mode 100644
index 000000000..05df6dc31
--- /dev/null
+++ b/library/cropperjs/docs/images/picture-2.jpg
Binary files differ
diff --git a/library/cropperjs/docs/images/picture-3.jpg b/library/cropperjs/docs/images/picture-3.jpg
new file mode 100644
index 000000000..472d721b6
--- /dev/null
+++ b/library/cropperjs/docs/images/picture-3.jpg
Binary files differ
diff --git a/library/cropperjs/docs/images/picture.jpg b/library/cropperjs/docs/images/picture.jpg
new file mode 100644
index 000000000..e4e7c488b
--- /dev/null
+++ b/library/cropperjs/docs/images/picture.jpg
Binary files differ
diff --git a/library/cropperjs/docs/index.html b/library/cropperjs/docs/index.html
new file mode 100644
index 000000000..7c3354cb1
--- /dev/null
+++ b/library/cropperjs/docs/index.html
@@ -0,0 +1,578 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <meta name="description" content="JavaScript image cropper.">
+ <meta name="keywords" content="HTML, CSS, JS, JavaScript, image cropping, cropper, cropperjs, cropper.js, front-end, web development">
+ <meta name="author" content="Chen Fengyuan">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css">
+ <link rel="stylesheet" href="css/cropper.css">
+ <link rel="stylesheet" href="css/main.css">
+</head>
+<body>
+ <!--[if lt IE 9]>
+ <div class="alert alert-warning alert-dismissible fade show m-0 rounded-0" role="alert">
+ You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ </div>
+ <![endif]-->
+
+ <!-- Header -->
+ <header class="navbar navbar-light navbar-expand-md">
+ <div class="container">
+ <a class="navbar-brand" href="./">Cropper.js</a>
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapse" aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+ <div class="collapse navbar-collapse justify-content-end" id="navbar-collapse" role="navigation">
+ <nav class="nav navbar-nav">
+ <a class="nav-link" href="https://github.com/fengyuanchen/cropperjs/blob/master/README.md" data-toggle="tooltip" title="View the documentation">Docs</a>
+ <a class="nav-link" href="https://fengyuanchen.github.io/photo-editor" data-toggle="tooltip" title="An advanced example of Cropper.js">Photo Editor</a>
+ <a class="nav-link" href="https://github.com/fengyuanchen/cropperjs" data-toggle="tooltip" title="View the GitHub project">GitHub</a>
+ <a class="nav-link" href="https://fengyuanchen.github.io" data-toggle="tooltip" title="More projects">More</a>
+ <a class="nav-link" href="http://chenfengyuan.com" data-toggle="tooltip" title="About the author">About</a>
+ </nav>
+ </div>
+ </nav>
+ </header>
+
+ <!-- Jumbotron -->
+ <div class="jumbotron bg-primary text-white rounded-0">
+ <div class="container">
+ <div class="row">
+ <div class="col-md">
+ <h1>Cropper.js <small class="h6">v1.2.2</small></h1>
+ <p class="lead">JavaScript image cropper.</p>
+ </div>
+ <div class="col-md">
+ <div class="carbonads">
+ <script id="_carbonads_js" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=fengyuanchen" async></script>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Content -->
+ <div class="container">
+ <div class="row">
+ <div class="col-md-9">
+ <!-- <h3>Demo:</h3> -->
+ <div class="img-container">
+ <img src="images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+ <div class="col-md-3">
+ <!-- <h3>Preview:</h3> -->
+ <div class="docs-preview clearfix">
+ <div class="img-preview preview-lg"></div>
+ <div class="img-preview preview-md"></div>
+ <div class="img-preview preview-sm"></div>
+ <div class="img-preview preview-xs"></div>
+ </div>
+
+ <!-- <h3>Data:</h3> -->
+ <!-- <h3>Data:</h3> -->
+ <div class="docs-data">
+ <div class="input-group input-group-sm">
+ <span class="input-group-prepend">
+ <label class="input-group-text" for="dataX">X</label>
+ </span>
+ <input type="text" class="form-control" id="dataX" placeholder="x">
+ <span class="input-group-append">
+ <span class="input-group-text">px</span>
+ </span>
+ </div>
+ <div class="input-group input-group-sm">
+ <span class="input-group-prepend">
+ <label class="input-group-text" for="dataY">Y</label>
+ </span>
+ <input type="text" class="form-control" id="dataY" placeholder="y">
+ <span class="input-group-append">
+ <span class="input-group-text">px</span>
+ </span>
+ </div>
+ <div class="input-group input-group-sm">
+ <span class="input-group-prepend">
+ <label class="input-group-text" for="dataWidth">Width</label>
+ </span>
+ <input type="text" class="form-control" id="dataWidth" placeholder="width">
+ <span class="input-group-append">
+ <span class="input-group-text">px</span>
+ </span>
+ </div>
+ <div class="input-group input-group-sm">
+ <span class="input-group-prepend">
+ <label class="input-group-text" for="dataHeight">Height</label>
+ </span>
+ <input type="text" class="form-control" id="dataHeight" placeholder="height">
+ <span class="input-group-append">
+ <span class="input-group-text">px</span>
+ </span>
+ </div>
+ <div class="input-group input-group-sm">
+ <span class="input-group-prepend">
+ <label class="input-group-text" for="dataRotate">Rotate</label>
+ </span>
+ <input type="text" class="form-control" id="dataRotate" placeholder="rotate">
+ <span class="input-group-append">
+ <span class="input-group-text">deg</span>
+ </span>
+ </div>
+ <div class="input-group input-group-sm">
+ <span class="input-group-prepend">
+ <label class="input-group-text" for="dataScaleX">ScaleX</label>
+ </span>
+ <input type="text" class="form-control" id="dataScaleX" placeholder="scaleX">
+ </div>
+ <div class="input-group input-group-sm">
+ <span class="input-group-prepend">
+ <label class="input-group-text" for="dataScaleY">ScaleY</label>
+ </span>
+ <input type="text" class="form-control" id="dataScaleY" placeholder="scaleY">
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="row" id="actions">
+ <div class="col-md-9 docs-buttons">
+ <!-- <h3>Toolbar:</h3> -->
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary" data-method="setDragMode" data-option="move" title="Move">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setDragMode(&quot;move&quot;)">
+ <span class="fa fa-arrows"></span>
+ </span>
+ </button>
+ <button type="button" class="btn btn-primary" data-method="setDragMode" data-option="crop" title="Crop">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setDragMode(&quot;crop&quot;)">
+ <span class="fa fa-crop"></span>
+ </span>
+ </button>
+ </div>
+
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary" data-method="zoom" data-option="0.1" title="Zoom In">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.zoom(0.1)">
+ <span class="fa fa-search-plus"></span>
+ </span>
+ </button>
+ <button type="button" class="btn btn-primary" data-method="zoom" data-option="-0.1" title="Zoom Out">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.zoom(-0.1)">
+ <span class="fa fa-search-minus"></span>
+ </span>
+ </button>
+ </div>
+
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary" data-method="move" data-option="-10" data-second-option="0" title="Move Left">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.move(-10, 0)">
+ <span class="fa fa-arrow-left"></span>
+ </span>
+ </button>
+ <button type="button" class="btn btn-primary" data-method="move" data-option="10" data-second-option="0" title="Move Right">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.move(10, 0)">
+ <span class="fa fa-arrow-right"></span>
+ </span>
+ </button>
+ <button type="button" class="btn btn-primary" data-method="move" data-option="0" data-second-option="-10" title="Move Up">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.move(0, -10)">
+ <span class="fa fa-arrow-up"></span>
+ </span>
+ </button>
+ <button type="button" class="btn btn-primary" data-method="move" data-option="0" data-second-option="10" title="Move Down">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.move(0, 10)">
+ <span class="fa fa-arrow-down"></span>
+ </span>
+ </button>
+ </div>
+
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary" data-method="rotate" data-option="-45" title="Rotate Left">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.rotate(-45)">
+ <span class="fa fa-rotate-left"></span>
+ </span>
+ </button>
+ <button type="button" class="btn btn-primary" data-method="rotate" data-option="45" title="Rotate Right">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.rotate(45)">
+ <span class="fa fa-rotate-right"></span>
+ </span>
+ </button>
+ </div>
+
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary" data-method="scaleX" data-option="-1" title="Flip Horizontal">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.scaleX(-1)">
+ <span class="fa fa-arrows-h"></span>
+ </span>
+ </button>
+ <button type="button" class="btn btn-primary" data-method="scaleY" data-option="-1" title="Flip Vertical">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.scaleY(-1)">
+ <span class="fa fa-arrows-v"></span>
+ </span>
+ </button>
+ </div>
+
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary" data-method="crop" title="Crop">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.crop()">
+ <span class="fa fa-check"></span>
+ </span>
+ </button>
+ <button type="button" class="btn btn-primary" data-method="clear" title="Clear">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.clear()">
+ <span class="fa fa-remove"></span>
+ </span>
+ </button>
+ </div>
+
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary" data-method="disable" title="Disable">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.disable()">
+ <span class="fa fa-lock"></span>
+ </span>
+ </button>
+ <button type="button" class="btn btn-primary" data-method="enable" title="Enable">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.enable()">
+ <span class="fa fa-unlock"></span>
+ </span>
+ </button>
+ </div>
+
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary" data-method="reset" title="Reset">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.reset()">
+ <span class="fa fa-refresh"></span>
+ </span>
+ </button>
+ <label class="btn btn-primary btn-upload" for="inputImage" title="Upload image file">
+ <input type="file" class="sr-only" id="inputImage" name="file" accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff">
+ <span class="docs-tooltip" data-toggle="tooltip" title="Import image with Blob URLs">
+ <span class="fa fa-upload"></span>
+ </span>
+ </label>
+ <button type="button" class="btn btn-primary" data-method="destroy" title="Destroy">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.destroy()">
+ <span class="fa fa-power-off"></span>
+ </span>
+ </button>
+ </div>
+
+ <div class="btn-group btn-group-crop">
+ <button type="button" class="btn btn-success" data-method="getCroppedCanvas" data-option="{ &quot;maxWidth&quot;: 4096, &quot;maxHeight&quot;: 4096 }">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getCroppedCanvas({ maxWidth: 4096, maxHeight: 4096 })">
+ Get Cropped Canvas
+ </span>
+ </button>
+ <button type="button" class="btn btn-success" data-method="getCroppedCanvas" data-option="{ &quot;width&quot;: 160, &quot;height&quot;: 90 }">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getCroppedCanvas({ width: 160, height: 90 })">
+ 160&times;90
+ </span>
+ </button>
+ <button type="button" class="btn btn-success" data-method="getCroppedCanvas" data-option="{ &quot;width&quot;: 320, &quot;height&quot;: 180 }">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getCroppedCanvas({ width: 320, height: 180 })">
+ 320&times;180
+ </span>
+ </button>
+ </div>
+
+ <!-- Show the cropped image in modal -->
+ <div class="modal fade docs-cropped" id="getCroppedCanvasModal" role="dialog" aria-hidden="true" aria-labelledby="getCroppedCanvasTitle" tabindex="-1">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title" id="getCroppedCanvasTitle">Cropped</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ </div>
+ <div class="modal-body"></div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ <a class="btn btn-primary" id="download" href="javascript:void(0);" download="cropped.jpg">Download</a>
+ </div>
+ </div>
+ </div>
+ </div><!-- /.modal -->
+
+ <button type="button" class="btn btn-secondary" data-method="getData" data-option data-target="#putData">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getData()">
+ Get Data
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="setData" data-target="#putData">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setData(data)">
+ Set Data
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="getContainerData" data-option data-target="#putData">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getContainerData()">
+ Get Container Data
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="getImageData" data-option data-target="#putData">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getImageData()">
+ Get Image Data
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="getCanvasData" data-option data-target="#putData">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getCanvasData()">
+ Get Canvas Data
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="setCanvasData" data-target="#putData">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setCanvasData(data)">
+ Set Canvas Data
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="getCropBoxData" data-option data-target="#putData">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.getCropBoxData()">
+ Get Crop Box Data
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="setCropBoxData" data-target="#putData">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.setCropBoxData(data)">
+ Set Crop Box Data
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="moveTo" data-option="0">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.moveTo(0)">
+ Move to [0,0]
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="zoomTo" data-option="1">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.zoomTo(1)">
+ Zoom to 100%
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="rotateTo" data-option="180">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.rotateTo(180)">
+ Rotate 180°
+ </span>
+ </button>
+ <button type="button" class="btn btn-secondary" data-method="scale" data-option="-2" data-second-option="-1">
+ <span class="docs-tooltip" data-toggle="tooltip" title="cropper.scale(-2, -1)">
+ Scale (-2, -1)
+ </span>
+ </button>
+ <textarea class="form-control" id="putData" rows="1" placeholder="Get data to here or set data with this value"></textarea>
+
+ </div><!-- /.docs-buttons -->
+
+ <div class="col-md-3 docs-toggles">
+ <!-- <h3>Toggles:</h3> -->
+ <div class="btn-group d-flex flex-nowrap" data-toggle="buttons">
+ <label class="btn btn-primary active">
+ <input type="radio" class="sr-only" id="aspectRatio1" name="aspectRatio" value="1.7777777777777777">
+ <span class="docs-tooltip" data-toggle="tooltip" title="aspectRatio: 16 / 9">
+ 16:9
+ </span>
+ </label>
+ <label class="btn btn-primary">
+ <input type="radio" class="sr-only" id="aspectRatio2" name="aspectRatio" value="1.3333333333333333">
+ <span class="docs-tooltip" data-toggle="tooltip" title="aspectRatio: 4 / 3">
+ 4:3
+ </span>
+ </label>
+ <label class="btn btn-primary">
+ <input type="radio" class="sr-only" id="aspectRatio3" name="aspectRatio" value="1">
+ <span class="docs-tooltip" data-toggle="tooltip" title="aspectRatio: 1 / 1">
+ 1:1
+ </span>
+ </label>
+ <label class="btn btn-primary">
+ <input type="radio" class="sr-only" id="aspectRatio4" name="aspectRatio" value="0.6666666666666666">
+ <span class="docs-tooltip" data-toggle="tooltip" title="aspectRatio: 2 / 3">
+ 2:3
+ </span>
+ </label>
+ <label class="btn btn-primary">
+ <input type="radio" class="sr-only" id="aspectRatio5" name="aspectRatio" value="NaN">
+ <span class="docs-tooltip" data-toggle="tooltip" title="aspectRatio: NaN">
+ Free
+ </span>
+ </label>
+ </div>
+
+ <div class="btn-group d-flex flex-nowrap" data-toggle="buttons">
+ <label class="btn btn-primary active">
+ <input type="radio" class="sr-only" id="viewMode0" name="viewMode" value="0" checked>
+ <span class="docs-tooltip" data-toggle="tooltip" title="View Mode 0">
+ VM0
+ </span>
+ </label>
+ <label class="btn btn-primary">
+ <input type="radio" class="sr-only" id="viewMode1" name="viewMode" value="1">
+ <span class="docs-tooltip" data-toggle="tooltip" title="View Mode 1">
+ VM1
+ </span>
+ </label>
+ <label class="btn btn-primary">
+ <input type="radio" class="sr-only" id="viewMode2" name="viewMode" value="2">
+ <span class="docs-tooltip" data-toggle="tooltip" title="View Mode 2">
+ VM2
+ </span>
+ </label>
+ <label class="btn btn-primary">
+ <input type="radio" class="sr-only" id="viewMode3" name="viewMode" value="3">
+ <span class="docs-tooltip" data-toggle="tooltip" title="View Mode 3">
+ VM3
+ </span>
+ </label>
+ </div>
+
+ <div class="dropdown dropup docs-options">
+ <button type="button" class="btn btn-primary btn-block dropdown-toggle" id="toggleOptions" data-toggle="dropdown" aria-expanded="true">
+ Toggle Options
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" role="menu" aria-labelledby="toggleOptions">
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="responsive" type="checkbox" name="responsive" checked>
+ <label class="form-check-label" for="responsive">responsive</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="restore" type="checkbox" name="restore" checked>
+ <label class="form-check-label" for="restore">restore</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="checkCrossOrigin" type="checkbox" name="checkCrossOrigin" checked>
+ <label class="form-check-label" for="checkCrossOrigin">checkCrossOrigin</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="checkOrientation" type="checkbox" name="checkOrientation" checked>
+ <label class="form-check-label" for="checkOrientation">checkOrientation</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="modal" type="checkbox" name="modal" checked>
+ <label class="form-check-label" for="modal">modal</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="guides" type="checkbox" name="guides" checked>
+ <label class="form-check-label" for="guides">guides</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="center" type="checkbox" name="center" checked>
+ <label class="form-check-label" for="center">center</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="highlight" type="checkbox" name="highlight" checked>
+ <label class="form-check-label" for="highlight">highlight</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="background" type="checkbox" name="background" checked>
+ <label class="form-check-label" for="background">background</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="autoCrop" type="checkbox" name="autoCrop" checked>
+ <label class="form-check-label" for="autoCrop">autoCrop</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="movable" type="checkbox" name="movable" checked>
+ <label class="form-check-label" for="movable">movable</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="rotatable" type="checkbox" name="rotatable" checked>
+ <label class="form-check-label" for="rotatable">rotatable</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="scalable" type="checkbox" name="scalable" checked>
+ <label class="form-check-label" for="scalable">scalable</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="zoomable" type="checkbox" name="zoomable" checked>
+ <label class="form-check-label" for="zoomable">zoomable</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="zoomOnTouch" type="checkbox" name="zoomOnTouch" checked>
+ <label class="form-check-label" for="zoomOnTouch">zoomOnTouch</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="zoomOnWheel" type="checkbox" name="zoomOnWheel" checked>
+ <label class="form-check-label" for="zoomOnWheel">zoomOnWheel</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="cropBoxMovable" type="checkbox" name="cropBoxMovable" checked>
+ <label class="form-check-label" for="cropBoxMovable">cropBoxMovable</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="cropBoxResizable" type="checkbox" name="cropBoxResizable" checked>
+ <label class="form-check-label" for="cropBoxResizable">cropBoxResizable</label>
+ </div>
+ </li>
+ <li class="dropdown-item">
+ <div class="form-check">
+ <input class="form-check-input" id="toggleDragModeOnDblclick" type="checkbox" name="toggleDragModeOnDblclick" checked>
+ <label class="form-check-label" for="toggleDragModeOnDblclick">toggleDragModeOnDblclick</label>
+ </div>
+ </li>
+ </ul>
+ </div><!-- /.dropdown -->
+
+ <a class="btn btn-success btn-block" data-toggle="tooltip" href="https://fengyuanchen.github.io/photo-editor" title="An advanced example of Cropper.js">Photo Editor</a>
+
+ </div><!-- /.docs-toggles -->
+ </div>
+ </div>
+
+ <!-- Footer -->
+ <footer class="footer">
+ <div class="container">
+ <p class="heart"></p>
+ <nav class="nav flex-wrap justify-content-center mb-3">
+ <a class="nav-link" href="https://github.com/fengyuanchen/cropperjs">GitHub</a>
+ <a class="nav-link" href="https://github.com/fengyuanchen/cropperjs/tree/master/examples">Examples</a>
+ <a class="nav-link" href="https://github.com/fengyuanchen/cropperjs/blob/master/LICENSE">License</a>
+ <a class="nav-link" href="http://chenfengyuan.com">About</a>
+ </nav>
+ </div>
+ </footer>
+
+ <!-- Scripts -->
+ <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.bundle.min.js"></script>
+ <script src="https://fengyuanchen.github.io/js/common.js"></script>
+ <script src="js/cropper.js"></script>
+ <script src="js/main.js"></script>
+</body>
+</html>
diff --git a/library/cropperjs/docs/js/cropper.js b/library/cropperjs/docs/js/cropper.js
new file mode 100644
index 000000000..0e837953c
--- /dev/null
+++ b/library/cropperjs/docs/js/cropper.js
@@ -0,0 +1,3766 @@
+/*!
+ * Cropper.js v1.2.2
+ * https://github.com/fengyuanchen/cropperjs
+ *
+ * Copyright (c) 2015-2018 Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2018-01-03T13:27:18.062Z
+ */
+
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global.Cropper = factory());
+}(this, (function () { 'use strict';
+
+var WINDOW = typeof window !== 'undefined' ? window : {};
+var NAMESPACE = 'cropper';
+
+// Actions
+var ACTION_ALL = 'all';
+var ACTION_CROP = 'crop';
+var ACTION_MOVE = 'move';
+var ACTION_ZOOM = 'zoom';
+var ACTION_EAST = 'e';
+var ACTION_WEST = 'w';
+var ACTION_SOUTH = 's';
+var ACTION_NORTH = 'n';
+var ACTION_NORTH_EAST = 'ne';
+var ACTION_NORTH_WEST = 'nw';
+var ACTION_SOUTH_EAST = 'se';
+var ACTION_SOUTH_WEST = 'sw';
+
+// Classes
+var CLASS_CROP = NAMESPACE + '-crop';
+var CLASS_DISABLED = NAMESPACE + '-disabled';
+var CLASS_HIDDEN = NAMESPACE + '-hidden';
+var CLASS_HIDE = NAMESPACE + '-hide';
+var CLASS_INVISIBLE = NAMESPACE + '-invisible';
+var CLASS_MODAL = NAMESPACE + '-modal';
+var CLASS_MOVE = NAMESPACE + '-move';
+
+// Data keys
+var DATA_ACTION = 'action';
+var DATA_PREVIEW = 'preview';
+
+// Drag modes
+var DRAG_MODE_CROP = 'crop';
+var DRAG_MODE_MOVE = 'move';
+var DRAG_MODE_NONE = 'none';
+
+// Events
+var EVENT_CROP = 'crop';
+var EVENT_CROP_END = 'cropend';
+var EVENT_CROP_MOVE = 'cropmove';
+var EVENT_CROP_START = 'cropstart';
+var EVENT_DBLCLICK = 'dblclick';
+var EVENT_ERROR = 'error';
+var EVENT_LOAD = 'load';
+var EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
+var EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove';
+var EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup';
+var EVENT_READY = 'ready';
+var EVENT_RESIZE = 'resize';
+var EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll';
+var EVENT_ZOOM = 'zoom';
+
+// RegExps
+var REGEXP_ACTIONS = /^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/;
+var REGEXP_DATA_URL = /^data:/;
+var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
+var REGEXP_TAG_NAME = /^(img|canvas)$/i;
+
+var DEFAULTS = {
+ // Define the view mode of the cropper
+ viewMode: 0, // 0, 1, 2, 3
+
+ // Define the dragging mode of the cropper
+ dragMode: DRAG_MODE_CROP, // 'crop', 'move' or 'none'
+
+ // Define the aspect ratio of the crop box
+ aspectRatio: NaN,
+
+ // An object with the previous cropping result data
+ data: null,
+
+ // A selector for adding extra containers to preview
+ preview: '',
+
+ // Re-render the cropper when resize the window
+ responsive: true,
+
+ // Restore the cropped area after resize the window
+ restore: true,
+
+ // Check if the current image is a cross-origin image
+ checkCrossOrigin: true,
+
+ // Check the current image's Exif Orientation information
+ checkOrientation: true,
+
+ // Show the black modal
+ modal: true,
+
+ // Show the dashed lines for guiding
+ guides: true,
+
+ // Show the center indicator for guiding
+ center: true,
+
+ // Show the white modal to highlight the crop box
+ highlight: true,
+
+ // Show the grid background
+ background: true,
+
+ // Enable to crop the image automatically when initialize
+ autoCrop: true,
+
+ // Define the percentage of automatic cropping area when initializes
+ autoCropArea: 0.8,
+
+ // Enable to move the image
+ movable: true,
+
+ // Enable to rotate the image
+ rotatable: true,
+
+ // Enable to scale the image
+ scalable: true,
+
+ // Enable to zoom the image
+ zoomable: true,
+
+ // Enable to zoom the image by dragging touch
+ zoomOnTouch: true,
+
+ // Enable to zoom the image by wheeling mouse
+ zoomOnWheel: true,
+
+ // Define zoom ratio when zoom the image by wheeling mouse
+ wheelZoomRatio: 0.1,
+
+ // Enable to move the crop box
+ cropBoxMovable: true,
+
+ // Enable to resize the crop box
+ cropBoxResizable: true,
+
+ // Toggle drag mode between "crop" and "move" when click twice on the cropper
+ toggleDragModeOnDblclick: true,
+
+ // Size limitation
+ minCanvasWidth: 0,
+ minCanvasHeight: 0,
+ minCropBoxWidth: 0,
+ minCropBoxHeight: 0,
+ minContainerWidth: 200,
+ minContainerHeight: 100,
+
+ // Shortcuts of events
+ ready: null,
+ cropstart: null,
+ cropmove: null,
+ cropend: null,
+ crop: null,
+ zoom: null
+};
+
+var TEMPLATE = '<div class="cropper-container">' + '<div class="cropper-wrap-box">' + '<div class="cropper-canvas"></div>' + '</div>' + '<div class="cropper-drag-box"></div>' + '<div class="cropper-crop-box">' + '<span class="cropper-view-box"></span>' + '<span class="cropper-dashed dashed-h"></span>' + '<span class="cropper-dashed dashed-v"></span>' + '<span class="cropper-center"></span>' + '<span class="cropper-face"></span>' + '<span class="cropper-line line-e" data-action="e"></span>' + '<span class="cropper-line line-n" data-action="n"></span>' + '<span class="cropper-line line-w" data-action="w"></span>' + '<span class="cropper-line line-s" data-action="s"></span>' + '<span class="cropper-point point-e" data-action="e"></span>' + '<span class="cropper-point point-n" data-action="n"></span>' + '<span class="cropper-point point-w" data-action="w"></span>' + '<span class="cropper-point point-s" data-action="s"></span>' + '<span class="cropper-point point-ne" data-action="ne"></span>' + '<span class="cropper-point point-nw" data-action="nw"></span>' + '<span class="cropper-point point-sw" data-action="sw"></span>' + '<span class="cropper-point point-se" data-action="se"></span>' + '</div>' + '</div>';
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
+ return typeof obj;
+} : function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
+};
+
+
+
+
+
+
+
+
+
+
+
+var classCallCheck = function (instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+};
+
+var createClass = function () {
+ function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+
+ return function (Constructor, protoProps, staticProps) {
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) defineProperties(Constructor, staticProps);
+ return Constructor;
+ };
+}();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var toConsumableArray = function (arr) {
+ if (Array.isArray(arr)) {
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
+
+ return arr2;
+ } else {
+ return Array.from(arr);
+ }
+};
+
+/**
+ * Check if the given value is not a number.
+ */
+var isNaN = Number.isNaN || WINDOW.isNaN;
+
+/**
+ * Check if the given value is a number.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a number, else `false`.
+ */
+function isNumber(value) {
+ return typeof value === 'number' && !isNaN(value);
+}
+
+/**
+ * Check if the given value is undefined.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is undefined, else `false`.
+ */
+function isUndefined(value) {
+ return typeof value === 'undefined';
+}
+
+/**
+ * Check if the given value is an object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is an object, else `false`.
+ */
+function isObject(value) {
+ return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null;
+}
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Check if the given value is a plain object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
+ */
+
+function isPlainObject(value) {
+ if (!isObject(value)) {
+ return false;
+ }
+
+ try {
+ var _constructor = value.constructor;
+ var prototype = _constructor.prototype;
+
+
+ return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
+ } catch (e) {
+ return false;
+ }
+}
+
+/**
+ * Check if the given value is a function.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a function, else `false`.
+ */
+function isFunction(value) {
+ return typeof value === 'function';
+}
+
+/**
+ * Iterate the given data.
+ * @param {*} data - The data to iterate.
+ * @param {Function} callback - The process function for each element.
+ * @returns {*} The original data.
+ */
+function each(data, callback) {
+ if (data && isFunction(callback)) {
+ if (Array.isArray(data) || isNumber(data.length) /* array-like */) {
+ var length = data.length;
+
+ var i = void 0;
+
+ for (i = 0; i < length; i += 1) {
+ if (callback.call(data, data[i], i, data) === false) {
+ break;
+ }
+ }
+ } else if (isObject(data)) {
+ Object.keys(data).forEach(function (key) {
+ callback.call(data, data[key], key, data);
+ });
+ }
+ }
+
+ return data;
+}
+
+/**
+ * Extend the given object.
+ * @param {*} obj - The object to be extended.
+ * @param {*} args - The rest objects which will be merged to the first object.
+ * @returns {Object} The extended object.
+ */
+function extend(obj) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ if (isObject(obj) && args.length > 0) {
+ if (Object.assign) {
+ return Object.assign.apply(Object, [obj].concat(args));
+ }
+
+ args.forEach(function (arg) {
+ if (isObject(arg)) {
+ Object.keys(arg).forEach(function (key) {
+ obj[key] = arg[key];
+ });
+ }
+ });
+ }
+
+ return obj;
+}
+
+/**
+ * Takes a function and returns a new one that will always have a particular context.
+ * @param {Function} fn - The target function.
+ * @param {Object} context - The new context for the function.
+ * @returns {boolean} The new function.
+ */
+function proxy(fn, context) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
+ args[_key2 - 2] = arguments[_key2];
+ }
+
+ return function () {
+ for (var _len3 = arguments.length, args2 = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
+ args2[_key3] = arguments[_key3];
+ }
+
+ return fn.apply(context, args.concat(args2));
+ };
+}
+
+var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/i;
+
+/**
+ * Normalize decimal number.
+ * Check out {@link http://0.30000000000000004.com/ }
+ * @param {number} value - The value to normalize.
+ * @param {number} [times=100000000000] - The times for normalizing.
+ * @returns {number} Returns the normalized number.
+ */
+function normalizeDecimalNumber(value) {
+ var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;
+
+ return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;
+}
+
+var REGEXP_SUFFIX = /^(width|height|left|top|marginLeft|marginTop)$/;
+
+/**
+ * Apply styles to the given element.
+ * @param {Element} element - The target element.
+ * @param {Object} styles - The styles for applying.
+ */
+function setStyle(element, styles) {
+ var style = element.style;
+
+
+ each(styles, function (value, property) {
+ if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
+ value += 'px';
+ }
+
+ style[property] = value;
+ });
+}
+
+/**
+ * Check if the given element has a special class.
+ * @param {Element} element - The element to check.
+ * @param {string} value - The class to search.
+ * @returns {boolean} Returns `true` if the special class was found.
+ */
+function hasClass(element, value) {
+ return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;
+}
+
+/**
+ * Add classes to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be added.
+ */
+function addClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ addClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.add(value);
+ return;
+ }
+
+ var className = element.className.trim();
+
+ if (!className) {
+ element.className = value;
+ } else if (className.indexOf(value) < 0) {
+ element.className = className + ' ' + value;
+ }
+}
+
+/**
+ * Remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be removed.
+ */
+function removeClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ removeClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.remove(value);
+ return;
+ }
+
+ if (element.className.indexOf(value) >= 0) {
+ element.className = element.className.replace(value, '');
+ }
+}
+
+/**
+ * Add or remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be toggled.
+ * @param {boolean} added - Add only.
+ */
+function toggleClass(element, value, added) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, function (elem) {
+ toggleClass(elem, value, added);
+ });
+ return;
+ }
+
+ // IE10-11 doesn't support the second parameter of `classList.toggle`
+ if (added) {
+ addClass(element, value);
+ } else {
+ removeClass(element, value);
+ }
+}
+
+var REGEXP_HYPHENATE = /([a-z\d])([A-Z])/g;
+
+/**
+ * Hyphenate the given value.
+ * @param {string} value - The value to hyphenate.
+ * @returns {string} The hyphenated value.
+ */
+function hyphenate(value) {
+ return value.replace(REGEXP_HYPHENATE, '$1-$2').toLowerCase();
+}
+
+/**
+ * Get data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to get.
+ * @returns {string} The data value.
+ */
+function getData(element, name) {
+ if (isObject(element[name])) {
+ return element[name];
+ } else if (element.dataset) {
+ return element.dataset[name];
+ }
+
+ return element.getAttribute('data-' + hyphenate(name));
+}
+
+/**
+ * Set data to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to set.
+ * @param {string} data - The data value.
+ */
+function setData(element, name, data) {
+ if (isObject(data)) {
+ element[name] = data;
+ } else if (element.dataset) {
+ element.dataset[name] = data;
+ } else {
+ element.setAttribute('data-' + hyphenate(name), data);
+ }
+}
+
+/**
+ * Remove data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to remove.
+ */
+function removeData(element, name) {
+ if (isObject(element[name])) {
+ try {
+ delete element[name];
+ } catch (e) {
+ element[name] = null;
+ }
+ } else if (element.dataset) {
+ // #128 Safari not allows to delete dataset property
+ try {
+ delete element.dataset[name];
+ } catch (e) {
+ element.dataset[name] = null;
+ }
+ } else {
+ element.removeAttribute('data-' + hyphenate(name));
+ }
+}
+
+var REGEXP_SPACES = /\s+/;
+
+/**
+ * Remove event listener from the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+function removeListener(element, type, listener) {
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ if (!isFunction(listener)) {
+ return;
+ }
+
+ var types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, function (t) {
+ removeListener(element, t, listener, options);
+ });
+ return;
+ }
+
+ if (element.removeEventListener) {
+ element.removeEventListener(type, listener, options);
+ } else if (element.detachEvent) {
+ element.detachEvent('on' + type, listener);
+ }
+}
+
+/**
+ * Add event listener to the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+function addListener(element, type, _listener) {
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
+
+ if (!isFunction(_listener)) {
+ return;
+ }
+
+ var types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, function (t) {
+ addListener(element, t, _listener, options);
+ });
+ return;
+ }
+
+ if (options.once) {
+ var originalListener = _listener;
+
+ _listener = function listener() {
+ for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
+ args[_key4] = arguments[_key4];
+ }
+
+ removeListener(element, type, _listener, options);
+ return originalListener.apply(element, args);
+ };
+ }
+
+ if (element.addEventListener) {
+ element.addEventListener(type, _listener, options);
+ } else if (element.attachEvent) {
+ element.attachEvent('on' + type, _listener);
+ }
+}
+
+/**
+ * Dispatch event on the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Object} data - The additional event data.
+ * @returns {boolean} Indicate if the event is default prevented or not.
+ */
+function dispatchEvent(element, type, data) {
+ if (element.dispatchEvent) {
+ var event = void 0;
+
+ // Event and CustomEvent on IE9-11 are global objects, not constructors
+ if (isFunction(Event) && isFunction(CustomEvent)) {
+ if (isUndefined(data)) {
+ event = new Event(type, {
+ bubbles: true,
+ cancelable: true
+ });
+ } else {
+ event = new CustomEvent(type, {
+ detail: data,
+ bubbles: true,
+ cancelable: true
+ });
+ }
+ } else if (isUndefined(data)) {
+ event = document.createEvent('Event');
+ event.initEvent(type, true, true);
+ } else {
+ event = document.createEvent('CustomEvent');
+ event.initCustomEvent(type, true, true, data);
+ }
+
+ // IE9+
+ return element.dispatchEvent(event);
+ } else if (element.fireEvent) {
+ // IE6-10 (native events only)
+ return element.fireEvent('on' + type);
+ }
+
+ return true;
+}
+
+/**
+ * Get the offset base on the document.
+ * @param {Element} element - The target element.
+ * @returns {Object} The offset data.
+ */
+function getOffset(element) {
+ var doc = document.documentElement;
+ var box = element.getBoundingClientRect();
+
+ return {
+ left: box.left + ((window.scrollX || doc && doc.scrollLeft || 0) - (doc && doc.clientLeft || 0)),
+ top: box.top + ((window.scrollY || doc && doc.scrollTop || 0) - (doc && doc.clientTop || 0))
+ };
+}
+
+/**
+ * Empty an element.
+ * @param {Element} element - The element to empty.
+ */
+function empty(element) {
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+
+var location = WINDOW.location;
+
+var REGEXP_ORIGINS = /^(https?:)\/\/([^:/?#]+):?(\d*)/i;
+
+/**
+ * Check if the given URL is a cross origin URL.
+ * @param {string} url - The target URL.
+ * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.
+ */
+function isCrossOriginURL(url) {
+ var parts = url.match(REGEXP_ORIGINS);
+
+ return parts && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);
+}
+
+/**
+ * Add timestamp to the given URL.
+ * @param {string} url - The target URL.
+ * @returns {string} The result URL.
+ */
+function addTimestamp(url) {
+ var timestamp = 'timestamp=' + new Date().getTime();
+
+ return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp;
+}
+
+/**
+ * Get transforms base on the given object.
+ * @param {Object} obj - The target object.
+ * @returns {string} A string contains transform values.
+ */
+function getTransforms(_ref) {
+ var rotate = _ref.rotate,
+ scaleX = _ref.scaleX,
+ scaleY = _ref.scaleY,
+ translateX = _ref.translateX,
+ translateY = _ref.translateY;
+
+ var values = [];
+
+ if (isNumber(translateX) && translateX !== 0) {
+ values.push('translateX(' + translateX + 'px)');
+ }
+
+ if (isNumber(translateY) && translateY !== 0) {
+ values.push('translateY(' + translateY + 'px)');
+ }
+
+ // Rotate should come first before scale to match orientation transform
+ if (isNumber(rotate) && rotate !== 0) {
+ values.push('rotate(' + rotate + 'deg)');
+ }
+
+ if (isNumber(scaleX) && scaleX !== 1) {
+ values.push('scaleX(' + scaleX + ')');
+ }
+
+ if (isNumber(scaleY) && scaleY !== 1) {
+ values.push('scaleY(' + scaleY + ')');
+ }
+
+ var transform = values.length ? values.join(' ') : 'none';
+
+ return {
+ WebkitTransform: transform,
+ msTransform: transform,
+ transform: transform
+ };
+}
+
+var navigator = WINDOW.navigator;
+
+var IS_SAFARI_OR_UIWEBVIEW = navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);
+
+/**
+ * Get an image's natural sizes.
+ * @param {string} image - The target image.
+ * @param {Function} callback - The callback function.
+ */
+function getImageNaturalSizes(image, callback) {
+ // Modern browsers (except Safari)
+ if (image.naturalWidth && !IS_SAFARI_OR_UIWEBVIEW) {
+ callback(image.naturalWidth, image.naturalHeight);
+ return;
+ }
+
+ var newImage = document.createElement('img');
+ var body = document.body || document.documentElement;
+
+ newImage.onload = function () {
+ callback(newImage.width, newImage.height);
+
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ body.removeChild(newImage);
+ }
+ };
+
+ newImage.src = image.src;
+
+ // iOS Safari will convert the image automatically
+ // with its orientation once append it into DOM (#279)
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ newImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';
+ body.appendChild(newImage);
+ }
+}
+
+/**
+ * Get the max ratio of a group of pointers.
+ * @param {string} pointers - The target pointers.
+ * @returns {number} The result ratio.
+ */
+function getMaxZoomRatio(pointers) {
+ var pointers2 = extend({}, pointers);
+ var ratios = [];
+
+ each(pointers, function (pointer, pointerId) {
+ delete pointers2[pointerId];
+
+ each(pointers2, function (pointer2) {
+ var x1 = Math.abs(pointer.startX - pointer2.startX);
+ var y1 = Math.abs(pointer.startY - pointer2.startY);
+ var x2 = Math.abs(pointer.endX - pointer2.endX);
+ var y2 = Math.abs(pointer.endY - pointer2.endY);
+ var z1 = Math.sqrt(x1 * x1 + y1 * y1);
+ var z2 = Math.sqrt(x2 * x2 + y2 * y2);
+ var ratio = (z2 - z1) / z1;
+
+ ratios.push(ratio);
+ });
+ });
+
+ ratios.sort(function (a, b) {
+ return Math.abs(a) < Math.abs(b);
+ });
+
+ return ratios[0];
+}
+
+/**
+ * Get a pointer from an event object.
+ * @param {Object} event - The target event object.
+ * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
+ * @returns {Object} The result pointer contains start and/or end point coordinates.
+ */
+function getPointer(_ref2, endOnly) {
+ var pageX = _ref2.pageX,
+ pageY = _ref2.pageY;
+
+ var end = {
+ endX: pageX,
+ endY: pageY
+ };
+
+ if (endOnly) {
+ return end;
+ }
+
+ return extend({
+ startX: pageX,
+ startY: pageY
+ }, end);
+}
+
+/**
+ * Get the center point coordinate of a group of pointers.
+ * @param {Object} pointers - The target pointers.
+ * @returns {Object} The center point coordinate.
+ */
+function getPointersCenter(pointers) {
+ var pageX = 0;
+ var pageY = 0;
+ var count = 0;
+
+ each(pointers, function (_ref3) {
+ var startX = _ref3.startX,
+ startY = _ref3.startY;
+
+ pageX += startX;
+ pageY += startY;
+ count += 1;
+ });
+
+ pageX /= count;
+ pageY /= count;
+
+ return {
+ pageX: pageX,
+ pageY: pageY
+ };
+}
+
+/**
+ * Check if the given value is a finite number.
+ */
+var isFinite = Number.isFinite || WINDOW.isFinite;
+
+/**
+ * Get the max sizes in a rectangle under the given aspect ratio.
+ * @param {Object} data - The original sizes.
+ * @returns {Object} The result sizes.
+ */
+function getContainSizes(_ref4) {
+ var aspectRatio = _ref4.aspectRatio,
+ height = _ref4.height,
+ width = _ref4.width;
+
+ var isValidNumber = function isValidNumber(value) {
+ return isFinite(value) && value > 0;
+ };
+
+ if (isValidNumber(width) && isValidNumber(height)) {
+ if (height * aspectRatio > width) {
+ height = width / aspectRatio;
+ } else {
+ width = height * aspectRatio;
+ }
+ } else if (isValidNumber(width)) {
+ height = width / aspectRatio;
+ } else if (isValidNumber(height)) {
+ width = height * aspectRatio;
+ }
+
+ return {
+ width: width,
+ height: height
+ };
+}
+
+/**
+ * Get the new sizes of a rectangle after rotated.
+ * @param {Object} data - The original sizes.
+ * @returns {Object} The result sizes.
+ */
+function getRotatedSizes(_ref5) {
+ var width = _ref5.width,
+ height = _ref5.height,
+ degree = _ref5.degree;
+
+ degree = Math.abs(degree) % 180;
+
+ if (degree === 90) {
+ return {
+ width: height,
+ height: width
+ };
+ }
+
+ var arc = degree % 90 * Math.PI / 180;
+ var sinArc = Math.sin(arc);
+ var cosArc = Math.cos(arc);
+ var newWidth = width * cosArc + height * sinArc;
+ var newHeight = width * sinArc + height * cosArc;
+
+ return degree > 90 ? {
+ width: newHeight,
+ height: newWidth
+ } : {
+ width: newWidth,
+ height: newHeight
+ };
+}
+
+/**
+ * Get a canvas which drew the given image.
+ * @param {HTMLImageElement} image - The image for drawing.
+ * @param {Object} imageData - The image data.
+ * @param {Object} canvasData - The canvas data.
+ * @param {Object} options - The options.
+ * @returns {HTMLCanvasElement} The result canvas.
+ */
+function getSourceCanvas(image, _ref6, _ref7, _ref8) {
+ var imageNaturalWidth = _ref6.naturalWidth,
+ imageNaturalHeight = _ref6.naturalHeight,
+ _ref6$rotate = _ref6.rotate,
+ rotate = _ref6$rotate === undefined ? 0 : _ref6$rotate,
+ _ref6$scaleX = _ref6.scaleX,
+ scaleX = _ref6$scaleX === undefined ? 1 : _ref6$scaleX,
+ _ref6$scaleY = _ref6.scaleY,
+ scaleY = _ref6$scaleY === undefined ? 1 : _ref6$scaleY;
+ var aspectRatio = _ref7.aspectRatio,
+ naturalWidth = _ref7.naturalWidth,
+ naturalHeight = _ref7.naturalHeight;
+ var _ref8$fillColor = _ref8.fillColor,
+ fillColor = _ref8$fillColor === undefined ? 'transparent' : _ref8$fillColor,
+ _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled,
+ imageSmoothingEnabled = _ref8$imageSmoothingE === undefined ? true : _ref8$imageSmoothingE,
+ _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality,
+ imageSmoothingQuality = _ref8$imageSmoothingQ === undefined ? 'low' : _ref8$imageSmoothingQ,
+ _ref8$maxWidth = _ref8.maxWidth,
+ maxWidth = _ref8$maxWidth === undefined ? Infinity : _ref8$maxWidth,
+ _ref8$maxHeight = _ref8.maxHeight,
+ maxHeight = _ref8$maxHeight === undefined ? Infinity : _ref8$maxHeight,
+ _ref8$minWidth = _ref8.minWidth,
+ minWidth = _ref8$minWidth === undefined ? 0 : _ref8$minWidth,
+ _ref8$minHeight = _ref8.minHeight,
+ minHeight = _ref8$minHeight === undefined ? 0 : _ref8$minHeight;
+
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+ var maxSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: maxWidth,
+ height: maxHeight
+ });
+ var minSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: minWidth,
+ height: minHeight
+ });
+ var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
+ var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
+ var params = [-imageNaturalWidth / 2, -imageNaturalHeight / 2, imageNaturalWidth, imageNaturalHeight];
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+ context.fillStyle = fillColor;
+ context.fillRect(0, 0, width, height);
+ context.save();
+ context.translate(width / 2, height / 2);
+ context.rotate(rotate * Math.PI / 180);
+ context.scale(scaleX, scaleY);
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ context.drawImage.apply(context, [image].concat(toConsumableArray(params.map(function (param) {
+ return Math.floor(normalizeDecimalNumber(param));
+ }))));
+ context.restore();
+ return canvas;
+}
+
+var fromCharCode = String.fromCharCode;
+
+/**
+ * Get string from char code in data view.
+ * @param {DataView} dataView - The data view for read.
+ * @param {number} start - The start index.
+ * @param {number} length - The read length.
+ * @returns {string} The read result.
+ */
+
+function getStringFromCharCode(dataView, start, length) {
+ var str = '';
+ var i = void 0;
+
+ length += start;
+
+ for (i = start; i < length; i += 1) {
+ str += fromCharCode(dataView.getUint8(i));
+ }
+
+ return str;
+}
+
+var REGEXP_DATA_URL_HEAD = /^data:.*,/;
+
+/**
+ * Transform Data URL to array buffer.
+ * @param {string} dataURL - The Data URL to transform.
+ * @returns {ArrayBuffer} The result array buffer.
+ */
+function dataURLToArrayBuffer(dataURL) {
+ var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');
+ var binary = atob(base64);
+ var arrayBuffer = new ArrayBuffer(binary.length);
+ var uint8 = new Uint8Array(arrayBuffer);
+
+ each(uint8, function (value, i) {
+ uint8[i] = binary.charCodeAt(i);
+ });
+
+ return arrayBuffer;
+}
+
+/**
+ * Transform array buffer to Data URL.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.
+ * @param {string} mimeType - The mime type of the Data URL.
+ * @returns {string} The result Data URL.
+ */
+function arrayBufferToDataURL(arrayBuffer, mimeType) {
+ var uint8 = new Uint8Array(arrayBuffer);
+ var data = '';
+
+ // TypedArray.prototype.forEach is not supported in some browsers.
+ each(uint8, function (value) {
+ data += fromCharCode(value);
+ });
+
+ return 'data:' + mimeType + ';base64,' + btoa(data);
+}
+
+/**
+ * Get orientation value from given array buffer.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to read.
+ * @returns {number} The read orientation value.
+ */
+function getOrientation(arrayBuffer) {
+ var dataView = new DataView(arrayBuffer);
+ var orientation = void 0;
+ var littleEndian = void 0;
+ var app1Start = void 0;
+ var ifdStart = void 0;
+
+ // Only handle JPEG image (start by 0xFFD8)
+ if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
+ var length = dataView.byteLength;
+ var offset = 2;
+
+ while (offset < length) {
+ if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
+ app1Start = offset;
+ break;
+ }
+
+ offset += 1;
+ }
+ }
+
+ if (app1Start) {
+ var exifIDCode = app1Start + 4;
+ var tiffOffset = app1Start + 10;
+
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
+ var endianness = dataView.getUint16(tiffOffset);
+
+ littleEndian = endianness === 0x4949;
+
+ if (littleEndian || endianness === 0x4D4D /* bigEndian */) {
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
+ var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
+
+ if (firstIFDOffset >= 0x00000008) {
+ ifdStart = tiffOffset + firstIFDOffset;
+ }
+ }
+ }
+ }
+ }
+
+ if (ifdStart) {
+ var _length = dataView.getUint16(ifdStart, littleEndian);
+ var _offset = void 0;
+ var i = void 0;
+
+ for (i = 0; i < _length; i += 1) {
+ _offset = ifdStart + i * 12 + 2;
+
+ if (dataView.getUint16(_offset, littleEndian) === 0x0112 /* Orientation */) {
+ // 8 is the offset of the current tag's value
+ _offset += 8;
+
+ // Get the original orientation value
+ orientation = dataView.getUint16(_offset, littleEndian);
+
+ // Override the orientation with its default value
+ dataView.setUint16(_offset, 1, littleEndian);
+ break;
+ }
+ }
+ }
+
+ return orientation;
+}
+
+/**
+ * Parse Exif Orientation value.
+ * @param {number} orientation - The orientation to parse.
+ * @returns {Object} The parsed result.
+ */
+function parseOrientation(orientation) {
+ var rotate = 0;
+ var scaleX = 1;
+ var scaleY = 1;
+
+ switch (orientation) {
+ // Flip horizontal
+ case 2:
+ scaleX = -1;
+ break;
+
+ // Rotate left 180°
+ case 3:
+ rotate = -180;
+ break;
+
+ // Flip vertical
+ case 4:
+ scaleY = -1;
+ break;
+
+ // Flip vertical and rotate right 90°
+ case 5:
+ rotate = 90;
+ scaleY = -1;
+ break;
+
+ // Rotate right 90°
+ case 6:
+ rotate = 90;
+ break;
+
+ // Flip horizontal and rotate right 90°
+ case 7:
+ rotate = 90;
+ scaleX = -1;
+ break;
+
+ // Rotate left 90°
+ case 8:
+ rotate = -90;
+ break;
+
+ default:
+ }
+
+ return {
+ rotate: rotate,
+ scaleX: scaleX,
+ scaleY: scaleY
+ };
+}
+
+var render = {
+ render: function render() {
+ this.initContainer();
+ this.initCanvas();
+ this.initCropBox();
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ },
+ initContainer: function initContainer() {
+ var element = this.element,
+ options = this.options,
+ container = this.container,
+ cropper = this.cropper;
+
+
+ addClass(cropper, CLASS_HIDDEN);
+ removeClass(element, CLASS_HIDDEN);
+
+ var containerData = {
+ width: Math.max(container.offsetWidth, Number(options.minContainerWidth) || 200),
+ height: Math.max(container.offsetHeight, Number(options.minContainerHeight) || 100)
+ };
+
+ this.containerData = containerData;
+
+ setStyle(cropper, {
+ width: containerData.width,
+ height: containerData.height
+ });
+
+ addClass(element, CLASS_HIDDEN);
+ removeClass(cropper, CLASS_HIDDEN);
+ },
+
+
+ // Canvas (image wrapper)
+ initCanvas: function initCanvas() {
+ var containerData = this.containerData,
+ imageData = this.imageData;
+ var viewMode = this.options.viewMode;
+
+ var rotated = Math.abs(imageData.rotate) % 180 === 90;
+ var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;
+ var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;
+ var aspectRatio = naturalWidth / naturalHeight;
+ var canvasWidth = containerData.width;
+ var canvasHeight = containerData.height;
+
+ if (containerData.height * aspectRatio > containerData.width) {
+ if (viewMode === 3) {
+ canvasWidth = containerData.height * aspectRatio;
+ } else {
+ canvasHeight = containerData.width / aspectRatio;
+ }
+ } else if (viewMode === 3) {
+ canvasHeight = containerData.width / aspectRatio;
+ } else {
+ canvasWidth = containerData.height * aspectRatio;
+ }
+
+ var canvasData = {
+ aspectRatio: aspectRatio,
+ naturalWidth: naturalWidth,
+ naturalHeight: naturalHeight,
+ width: canvasWidth,
+ height: canvasHeight
+ };
+
+ canvasData.left = (containerData.width - canvasWidth) / 2;
+ canvasData.top = (containerData.height - canvasHeight) / 2;
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ this.canvasData = canvasData;
+ this.limited = viewMode === 1 || viewMode === 2;
+ this.limitCanvas(true, true);
+ this.initialImageData = extend({}, imageData);
+ this.initialCanvasData = extend({}, canvasData);
+ },
+ limitCanvas: function limitCanvas(sizeLimited, positionLimited) {
+ var options = this.options,
+ containerData = this.containerData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+ var viewMode = options.viewMode;
+ var aspectRatio = canvasData.aspectRatio;
+
+ var cropped = this.cropped && cropBoxData;
+
+ if (sizeLimited) {
+ var minCanvasWidth = Number(options.minCanvasWidth) || 0;
+ var minCanvasHeight = Number(options.minCanvasHeight) || 0;
+
+ if (viewMode > 1) {
+ minCanvasWidth = Math.max(minCanvasWidth, containerData.width);
+ minCanvasHeight = Math.max(minCanvasHeight, containerData.height);
+
+ if (viewMode === 3) {
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ } else if (viewMode > 0) {
+ if (minCanvasWidth) {
+ minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);
+ } else if (minCanvasHeight) {
+ minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);
+ } else if (cropped) {
+ minCanvasWidth = cropBoxData.width;
+ minCanvasHeight = cropBoxData.height;
+
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ }
+
+ var _getContainSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: minCanvasWidth,
+ height: minCanvasHeight
+ });
+
+ minCanvasWidth = _getContainSizes.width;
+ minCanvasHeight = _getContainSizes.height;
+
+
+ canvasData.minWidth = minCanvasWidth;
+ canvasData.minHeight = minCanvasHeight;
+ canvasData.maxWidth = Infinity;
+ canvasData.maxHeight = Infinity;
+ }
+
+ if (positionLimited) {
+ if (viewMode) {
+ var newCanvasLeft = containerData.width - canvasData.width;
+ var newCanvasTop = containerData.height - canvasData.height;
+
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+
+ if (cropped && this.limited) {
+ canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));
+ canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));
+ canvasData.maxLeft = cropBoxData.left;
+ canvasData.maxTop = cropBoxData.top;
+
+ if (viewMode === 2) {
+ if (canvasData.width >= containerData.width) {
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ }
+
+ if (canvasData.height >= containerData.height) {
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+ }
+ }
+ }
+ } else {
+ canvasData.minLeft = -canvasData.width;
+ canvasData.minTop = -canvasData.height;
+ canvasData.maxLeft = containerData.width;
+ canvasData.maxTop = containerData.height;
+ }
+ }
+ },
+ renderCanvas: function renderCanvas(changed, transformed) {
+ var canvasData = this.canvasData,
+ imageData = this.imageData;
+
+
+ if (transformed) {
+ var _getRotatedSizes = getRotatedSizes({
+ width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
+ height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
+ degree: imageData.rotate || 0
+ }),
+ naturalWidth = _getRotatedSizes.width,
+ naturalHeight = _getRotatedSizes.height;
+
+ var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);
+ var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);
+
+ canvasData.left -= (width - canvasData.width) / 2;
+ canvasData.top -= (height - canvasData.height) / 2;
+ canvasData.width = width;
+ canvasData.height = height;
+ canvasData.aspectRatio = naturalWidth / naturalHeight;
+ canvasData.naturalWidth = naturalWidth;
+ canvasData.naturalHeight = naturalHeight;
+ this.limitCanvas(true, false);
+ }
+
+ if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {
+ canvasData.left = canvasData.oldLeft;
+ }
+
+ if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {
+ canvasData.top = canvasData.oldTop;
+ }
+
+ canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);
+ canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);
+
+ this.limitCanvas(false, true);
+
+ canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);
+ canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ setStyle(this.canvas, extend({
+ width: canvasData.width,
+ height: canvasData.height
+ }, getTransforms({
+ translateX: canvasData.left,
+ translateY: canvasData.top
+ })));
+
+ this.renderImage(changed);
+
+ if (this.cropped && this.limited) {
+ this.limitCropBox(true, true);
+ }
+ },
+ renderImage: function renderImage(changed) {
+ var canvasData = this.canvasData,
+ imageData = this.imageData;
+
+ var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);
+ var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);
+
+ extend(imageData, {
+ width: width,
+ height: height,
+ left: (canvasData.width - width) / 2,
+ top: (canvasData.height - height) / 2
+ });
+ setStyle(this.image, extend({
+ width: imageData.width,
+ height: imageData.height
+ }, getTransforms(extend({
+ translateX: imageData.left,
+ translateY: imageData.top
+ }, imageData))));
+
+ if (changed) {
+ this.output();
+ }
+ },
+ initCropBox: function initCropBox() {
+ var options = this.options,
+ canvasData = this.canvasData;
+ var aspectRatio = options.aspectRatio;
+
+ var autoCropArea = Number(options.autoCropArea) || 0.8;
+ var cropBoxData = {
+ width: canvasData.width,
+ height: canvasData.height
+ };
+
+ if (aspectRatio) {
+ if (canvasData.height * aspectRatio > canvasData.width) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.cropBoxData = cropBoxData;
+ this.limitCropBox(true, true);
+
+ // Initialize auto crop area
+ cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
+ cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
+
+ // The width/height of auto crop area must large than "minWidth/Height"
+ cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);
+ cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);
+ cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;
+ cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ this.initialCropBoxData = extend({}, cropBoxData);
+ },
+ limitCropBox: function limitCropBox(sizeLimited, positionLimited) {
+ var options = this.options,
+ containerData = this.containerData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData,
+ limited = this.limited;
+ var aspectRatio = options.aspectRatio;
+
+
+ if (sizeLimited) {
+ var minCropBoxWidth = Number(options.minCropBoxWidth) || 0;
+ var minCropBoxHeight = Number(options.minCropBoxHeight) || 0;
+ var maxCropBoxWidth = Math.min(containerData.width, limited ? canvasData.width : containerData.width);
+ var maxCropBoxHeight = Math.min(containerData.height, limited ? canvasData.height : containerData.height);
+
+ // The min/maxCropBoxWidth/Height must be less than container's width/height
+ minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);
+ minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);
+
+ if (aspectRatio) {
+ if (minCropBoxWidth && minCropBoxHeight) {
+ if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+ } else if (minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else if (minCropBoxHeight) {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+
+ if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {
+ maxCropBoxHeight = maxCropBoxWidth / aspectRatio;
+ } else {
+ maxCropBoxWidth = maxCropBoxHeight * aspectRatio;
+ }
+ }
+
+ // The minWidth/Height must be less than maxWidth/Height
+ cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);
+ cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);
+ cropBoxData.maxWidth = maxCropBoxWidth;
+ cropBoxData.maxHeight = maxCropBoxHeight;
+ }
+
+ if (positionLimited) {
+ if (limited) {
+ cropBoxData.minLeft = Math.max(0, canvasData.left);
+ cropBoxData.minTop = Math.max(0, canvasData.top);
+ cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;
+ cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;
+ } else {
+ cropBoxData.minLeft = 0;
+ cropBoxData.minTop = 0;
+ cropBoxData.maxLeft = containerData.width - cropBoxData.width;
+ cropBoxData.maxTop = containerData.height - cropBoxData.height;
+ }
+ }
+ },
+ renderCropBox: function renderCropBox() {
+ var options = this.options,
+ containerData = this.containerData,
+ cropBoxData = this.cropBoxData;
+
+
+ if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {
+ cropBoxData.left = cropBoxData.oldLeft;
+ }
+
+ if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {
+ cropBoxData.top = cropBoxData.oldTop;
+ }
+
+ cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
+ cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
+
+ this.limitCropBox(false, true);
+
+ cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);
+ cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ if (options.movable && options.cropBoxMovable) {
+ // Turn to move the canvas when the crop box is equal to the container
+ setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);
+ }
+
+ setStyle(this.cropBox, extend({
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ }, getTransforms({
+ translateX: cropBoxData.left,
+ translateY: cropBoxData.top
+ })));
+
+ if (this.cropped && this.limited) {
+ this.limitCanvas(true, true);
+ }
+
+ if (!this.disabled) {
+ this.output();
+ }
+ },
+ output: function output() {
+ this.preview();
+
+ if (this.complete) {
+ dispatchEvent(this.element, EVENT_CROP, this.getData());
+ }
+ }
+};
+
+var preview = {
+ initPreview: function initPreview() {
+ var crossOrigin = this.crossOrigin;
+ var preview = this.options.preview;
+
+ var url = crossOrigin ? this.crossOriginUrl : this.url;
+ var image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = url;
+ this.viewBox.appendChild(image);
+ this.image2 = image;
+
+ if (!preview) {
+ return;
+ }
+
+ var previews = preview.querySelector ? [preview] : document.querySelectorAll(preview);
+
+ this.previews = previews;
+
+ each(previews, function (element) {
+ var img = document.createElement('img');
+
+ // Save the original size for recover
+ setData(element, DATA_PREVIEW, {
+ width: element.offsetWidth,
+ height: element.offsetHeight,
+ html: element.innerHTML
+ });
+
+ if (crossOrigin) {
+ img.crossOrigin = crossOrigin;
+ }
+
+ img.src = url;
+
+ /**
+ * Override img element styles
+ * Add `display:block` to avoid margin top issue
+ * Add `height:auto` to override `height` attribute on IE8
+ * (Occur only when margin-top <= -height)
+ */
+ img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"';
+
+ empty(element);
+ element.appendChild(img);
+ });
+ },
+ resetPreview: function resetPreview() {
+ each(this.previews, function (element) {
+ var data = getData(element, DATA_PREVIEW);
+
+ setStyle(element, {
+ width: data.width,
+ height: data.height
+ });
+
+ element.innerHTML = data.html;
+ removeData(element, DATA_PREVIEW);
+ });
+ },
+ preview: function preview() {
+ var imageData = this.imageData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+ var cropBoxWidth = cropBoxData.width,
+ cropBoxHeight = cropBoxData.height;
+ var width = imageData.width,
+ height = imageData.height;
+
+ var left = cropBoxData.left - canvasData.left - imageData.left;
+ var top = cropBoxData.top - canvasData.top - imageData.top;
+
+ if (!this.cropped || this.disabled) {
+ return;
+ }
+
+ setStyle(this.image2, extend({
+ width: width,
+ height: height
+ }, getTransforms(extend({
+ translateX: -left,
+ translateY: -top
+ }, imageData))));
+
+ each(this.previews, function (element) {
+ var data = getData(element, DATA_PREVIEW);
+ var originalWidth = data.width;
+ var originalHeight = data.height;
+ var newWidth = originalWidth;
+ var newHeight = originalHeight;
+ var ratio = 1;
+
+ if (cropBoxWidth) {
+ ratio = originalWidth / cropBoxWidth;
+ newHeight = cropBoxHeight * ratio;
+ }
+
+ if (cropBoxHeight && newHeight > originalHeight) {
+ ratio = originalHeight / cropBoxHeight;
+ newWidth = cropBoxWidth * ratio;
+ newHeight = originalHeight;
+ }
+
+ setStyle(element, {
+ width: newWidth,
+ height: newHeight
+ });
+
+ setStyle(element.getElementsByTagName('img')[0], extend({
+ width: width * ratio,
+ height: height * ratio
+ }, getTransforms(extend({
+ translateX: -left * ratio,
+ translateY: -top * ratio
+ }, imageData))));
+ });
+ }
+};
+
+var events = {
+ bind: function bind() {
+ var element = this.element,
+ options = this.options,
+ cropper = this.cropper;
+
+
+ if (isFunction(options.cropstart)) {
+ addListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ addListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ addListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ addListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ addListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = proxy(this.cropStart, this));
+
+ if (options.zoomable && options.zoomOnWheel) {
+ addListener(cropper, EVENT_WHEEL, this.onWheel = proxy(this.wheel, this));
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ addListener(cropper, EVENT_DBLCLICK, this.onDblclick = proxy(this.dblclick, this));
+ }
+
+ addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = proxy(this.cropMove, this));
+ addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = proxy(this.cropEnd, this));
+
+ if (options.responsive) {
+ addListener(window, EVENT_RESIZE, this.onResize = proxy(this.resize, this));
+ }
+ },
+ unbind: function unbind() {
+ var element = this.element,
+ options = this.options,
+ cropper = this.cropper;
+
+
+ if (isFunction(options.cropstart)) {
+ removeListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ removeListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ removeListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ removeListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ removeListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);
+
+ if (options.zoomable && options.zoomOnWheel) {
+ removeListener(cropper, EVENT_WHEEL, this.onWheel);
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);
+ }
+
+ removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);
+ removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);
+
+ if (options.responsive) {
+ removeListener(window, EVENT_RESIZE, this.onResize);
+ }
+ }
+};
+
+var handlers = {
+ resize: function resize() {
+ var options = this.options,
+ container = this.container,
+ containerData = this.containerData;
+
+ var minContainerWidth = Number(options.minContainerWidth) || 200;
+ var minContainerHeight = Number(options.minContainerHeight) || 100;
+
+ if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) {
+ return;
+ }
+
+ var ratio = container.offsetWidth / containerData.width;
+
+ // Resize when width changed or height changed
+ if (ratio !== 1 || container.offsetHeight !== containerData.height) {
+ var canvasData = void 0;
+ var cropBoxData = void 0;
+
+ if (options.restore) {
+ canvasData = this.getCanvasData();
+ cropBoxData = this.getCropBoxData();
+ }
+
+ this.render();
+
+ if (options.restore) {
+ this.setCanvasData(each(canvasData, function (n, i) {
+ canvasData[i] = n * ratio;
+ }));
+ this.setCropBoxData(each(cropBoxData, function (n, i) {
+ cropBoxData[i] = n * ratio;
+ }));
+ }
+ }
+ },
+ dblclick: function dblclick() {
+ if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {
+ return;
+ }
+
+ this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);
+ },
+ wheel: function wheel(e) {
+ var _this = this;
+
+ var ratio = Number(this.options.wheelZoomRatio) || 0.1;
+ var delta = 1;
+
+ if (this.disabled) {
+ return;
+ }
+
+ e.preventDefault();
+
+ // Limit wheel speed to prevent zoom too fast (#21)
+ if (this.wheeling) {
+ return;
+ }
+
+ this.wheeling = true;
+
+ setTimeout(function () {
+ _this.wheeling = false;
+ }, 50);
+
+ if (e.deltaY) {
+ delta = e.deltaY > 0 ? 1 : -1;
+ } else if (e.wheelDelta) {
+ delta = -e.wheelDelta / 120;
+ } else if (e.detail) {
+ delta = e.detail > 0 ? 1 : -1;
+ }
+
+ this.zoom(-delta * ratio, e);
+ },
+ cropStart: function cropStart(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ var options = this.options,
+ pointers = this.pointers;
+
+ var action = void 0;
+
+ if (e.changedTouches) {
+ // Handle touch event
+ each(e.changedTouches, function (touch) {
+ pointers[touch.identifier] = getPointer(touch);
+ });
+ } else {
+ // Handle mouse event and pointer event
+ pointers[e.pointerId || 0] = getPointer(e);
+ }
+
+ if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
+ action = ACTION_ZOOM;
+ } else {
+ action = getData(e.target, DATA_ACTION);
+ }
+
+ if (!REGEXP_ACTIONS.test(action)) {
+ return;
+ }
+
+ if (dispatchEvent(this.element, EVENT_CROP_START, {
+ originalEvent: e,
+ action: action
+ }) === false) {
+ return;
+ }
+
+ e.preventDefault();
+
+ this.action = action;
+ this.cropping = false;
+
+ if (action === ACTION_CROP) {
+ this.cropping = true;
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+ },
+ cropMove: function cropMove(e) {
+ var action = this.action;
+
+
+ if (this.disabled || !action) {
+ return;
+ }
+
+ var pointers = this.pointers;
+
+
+ e.preventDefault();
+
+ if (dispatchEvent(this.element, EVENT_CROP_MOVE, {
+ originalEvent: e,
+ action: action
+ }) === false) {
+ return;
+ }
+
+ if (e.changedTouches) {
+ each(e.changedTouches, function (touch) {
+ extend(pointers[touch.identifier], getPointer(touch, true));
+ });
+ } else {
+ extend(pointers[e.pointerId || 0], getPointer(e, true));
+ }
+
+ this.change(e);
+ },
+ cropEnd: function cropEnd(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ var action = this.action,
+ pointers = this.pointers;
+
+
+ if (e.changedTouches) {
+ each(e.changedTouches, function (touch) {
+ delete pointers[touch.identifier];
+ });
+ } else {
+ delete pointers[e.pointerId || 0];
+ }
+
+ if (!action) {
+ return;
+ }
+
+ e.preventDefault();
+
+ if (!Object.keys(pointers).length) {
+ this.action = '';
+ }
+
+ if (this.cropping) {
+ this.cropping = false;
+ toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);
+ }
+
+ dispatchEvent(this.element, EVENT_CROP_END, {
+ originalEvent: e,
+ action: action
+ });
+ }
+};
+
+var change = {
+ change: function change(e) {
+ var options = this.options,
+ canvasData = this.canvasData,
+ containerData = this.containerData,
+ cropBoxData = this.cropBoxData,
+ pointers = this.pointers;
+ var action = this.action;
+ var aspectRatio = options.aspectRatio;
+ var left = cropBoxData.left,
+ top = cropBoxData.top,
+ width = cropBoxData.width,
+ height = cropBoxData.height;
+
+ var right = left + width;
+ var bottom = top + height;
+ var minLeft = 0;
+ var minTop = 0;
+ var maxWidth = containerData.width;
+ var maxHeight = containerData.height;
+ var renderable = true;
+ var offset = void 0;
+
+ // Locking aspect ratio in "free mode" by holding shift key
+ if (!aspectRatio && e.shiftKey) {
+ aspectRatio = width && height ? width / height : 1;
+ }
+
+ if (this.limited) {
+ minLeft = cropBoxData.minLeft;
+ minTop = cropBoxData.minTop;
+
+ maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);
+ maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);
+ }
+
+ var pointer = pointers[Object.keys(pointers)[0]];
+ var range = {
+ x: pointer.endX - pointer.startX,
+ y: pointer.endY - pointer.startY
+ };
+ var check = function check(side) {
+ switch (side) {
+ case ACTION_EAST:
+ if (right + range.x > maxWidth) {
+ range.x = maxWidth - right;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (left + range.x < minLeft) {
+ range.x = minLeft - left;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (top + range.y < minTop) {
+ range.y = minTop - top;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (bottom + range.y > maxHeight) {
+ range.y = maxHeight - bottom;
+ }
+
+ break;
+
+ default:
+ }
+ };
+
+ switch (action) {
+ // Move crop box
+ case ACTION_ALL:
+ left += range.x;
+ top += range.y;
+ break;
+
+ // Resize crop box
+ case ACTION_EAST:
+ if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top -= range.x / aspectRatio / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_WEST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left += range.y * aspectRatio / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_SOUTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top += range.x / aspectRatio / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_EAST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_SOUTH);
+ height += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left -= range.y * aspectRatio / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_NORTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_EAST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_WEST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || left <= minLeft)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ left += range.y * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_WEST:
+ if (aspectRatio) {
+ if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_EAST:
+ if (aspectRatio) {
+ if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ // Move canvas
+ case ACTION_MOVE:
+ this.move(range.x, range.y);
+ renderable = false;
+ break;
+
+ // Zoom canvas
+ case ACTION_ZOOM:
+ this.zoom(getMaxZoomRatio(pointers), e);
+ renderable = false;
+ break;
+
+ // Create crop box
+ case ACTION_CROP:
+ if (!range.x || !range.y) {
+ renderable = false;
+ break;
+ }
+
+ offset = getOffset(this.cropper);
+ left = pointer.startX - offset.left;
+ top = pointer.startY - offset.top;
+ width = cropBoxData.minWidth;
+ height = cropBoxData.minHeight;
+
+ if (range.x > 0) {
+ action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;
+ } else if (range.x < 0) {
+ left -= width;
+ action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;
+ }
+
+ if (range.y < 0) {
+ top -= height;
+ }
+
+ // Show the crop box if is hidden
+ if (!this.cropped) {
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ this.cropped = true;
+
+ if (this.limited) {
+ this.limitCropBox(true, true);
+ }
+ }
+
+ break;
+
+ default:
+ }
+
+ if (renderable) {
+ cropBoxData.width = width;
+ cropBoxData.height = height;
+ cropBoxData.left = left;
+ cropBoxData.top = top;
+ this.action = action;
+ this.renderCropBox();
+ }
+
+ // Override
+ each(pointers, function (p) {
+ p.startX = p.endX;
+ p.startY = p.endY;
+ });
+ }
+};
+
+var methods = {
+ // Show the crop box manually
+ crop: function crop() {
+ if (this.ready && !this.disabled) {
+ if (!this.cropped) {
+ this.cropped = true;
+ this.limitCropBox(true, true);
+
+ if (this.options.modal) {
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ this.setCropBoxData(this.initialCropBoxData);
+ }
+
+ return this;
+ },
+
+
+ // Reset the image and crop box to their initial states
+ reset: function reset() {
+ if (this.ready && !this.disabled) {
+ this.imageData = extend({}, this.initialImageData);
+ this.canvasData = extend({}, this.initialCanvasData);
+ this.cropBoxData = extend({}, this.initialCropBoxData);
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+
+ return this;
+ },
+
+
+ // Clear the crop box
+ clear: function clear() {
+ if (this.cropped && !this.disabled) {
+ extend(this.cropBoxData, {
+ left: 0,
+ top: 0,
+ width: 0,
+ height: 0
+ });
+
+ this.cropped = false;
+ this.renderCropBox();
+ this.limitCanvas(true, true);
+
+ // Render canvas after crop box rendered
+ this.renderCanvas();
+ removeClass(this.dragBox, CLASS_MODAL);
+ addClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Replace the image's src and rebuild the cropper
+ * @param {string} url - The new URL.
+ * @param {boolean} [onlyColorChanged] - Indicate if the new image only changed color.
+ * @returns {Object} this
+ */
+ replace: function replace(url) {
+ var onlyColorChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+
+ if (!this.disabled && url) {
+ if (this.isImg) {
+ this.element.src = url;
+ }
+
+ if (onlyColorChanged) {
+ this.url = url;
+ this.image.src = url;
+
+ if (this.ready) {
+ this.image2.src = url;
+
+ each(this.previews, function (element) {
+ element.getElementsByTagName('img')[0].src = url;
+ });
+ }
+ } else {
+ if (this.isImg) {
+ this.replaced = true;
+ }
+
+ // Clear previous data
+ this.options.data = null;
+ this.load(url);
+ }
+ }
+
+ return this;
+ },
+
+
+ // Enable (unfreeze) the cropper
+ enable: function enable() {
+ if (this.ready) {
+ this.disabled = false;
+ removeClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+
+ // Disable (freeze) the cropper
+ disable: function disable() {
+ if (this.ready) {
+ this.disabled = true;
+ addClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+
+ // Destroy the cropper and remove the instance from the image
+ destroy: function destroy() {
+ var element = this.element,
+ image = this.image;
+
+
+ if (this.loaded) {
+ if (this.isImg && this.replaced) {
+ element.src = this.originalUrl;
+ }
+
+ this.unbuild();
+ removeClass(element, CLASS_HIDDEN);
+ } else if (this.isImg) {
+ removeListener(element, EVENT_LOAD, this.onStart);
+ } else if (image) {
+ image.parentNode.removeChild(image);
+ }
+
+ removeData(element, NAMESPACE);
+
+ return this;
+ },
+
+
+ /**
+ * Move the canvas with relative offsets
+ * @param {number} offsetX - The relative offset distance on the x-axis.
+ * @param {number} offsetY - The relative offset distance on the y-axis.
+ * @returns {Object} this
+ */
+ move: function move(offsetX, offsetY) {
+ var _canvasData = this.canvasData,
+ left = _canvasData.left,
+ top = _canvasData.top;
+
+
+ return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));
+ },
+
+
+ /**
+ * Move the canvas to an absolute point
+ * @param {number} x - The x-axis coordinate.
+ * @param {number} [y=x] - The y-axis coordinate.
+ * @returns {Object} this
+ */
+ moveTo: function moveTo(x) {
+ var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
+ var canvasData = this.canvasData;
+
+ var changed = false;
+
+ x = Number(x);
+ y = Number(y);
+
+ if (this.ready && !this.disabled && this.options.movable) {
+ if (isNumber(x)) {
+ canvasData.left = x;
+ changed = true;
+ }
+
+ if (isNumber(y)) {
+ canvasData.top = y;
+ changed = true;
+ }
+
+ if (changed) {
+ this.renderCanvas(true);
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Zoom the canvas with a relative ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoom: function zoom(ratio, _originalEvent) {
+ var canvasData = this.canvasData;
+
+
+ ratio = Number(ratio);
+
+ if (ratio < 0) {
+ ratio = 1 / (1 - ratio);
+ } else {
+ ratio = 1 + ratio;
+ }
+
+ return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);
+ },
+
+
+ /**
+ * Zoom the canvas to an absolute ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Object} pivot - The zoom pivot point coordinate.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoomTo: function zoomTo(ratio, pivot, _originalEvent) {
+ var options = this.options,
+ canvasData = this.canvasData;
+ var width = canvasData.width,
+ height = canvasData.height,
+ naturalWidth = canvasData.naturalWidth,
+ naturalHeight = canvasData.naturalHeight;
+
+
+ ratio = Number(ratio);
+
+ if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {
+ var newWidth = naturalWidth * ratio;
+ var newHeight = naturalHeight * ratio;
+
+ if (dispatchEvent(this.element, EVENT_ZOOM, {
+ originalEvent: _originalEvent,
+ oldRatio: width / naturalWidth,
+ ratio: newWidth / naturalWidth
+ }) === false) {
+ return this;
+ }
+
+ if (_originalEvent) {
+ var pointers = this.pointers;
+
+ var offset = getOffset(this.cropper);
+ var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {
+ pageX: _originalEvent.pageX,
+ pageY: _originalEvent.pageY
+ };
+
+ // Zoom from the triggering point of the event
+ canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width);
+ canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height);
+ } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {
+ canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);
+ canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);
+ } else {
+ // Zoom from the center of the canvas
+ canvasData.left -= (newWidth - width) / 2;
+ canvasData.top -= (newHeight - height) / 2;
+ }
+
+ canvasData.width = newWidth;
+ canvasData.height = newHeight;
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Rotate the canvas with a relative degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotate: function rotate(degree) {
+ return this.rotateTo((this.imageData.rotate || 0) + Number(degree));
+ },
+
+
+ /**
+ * Rotate the canvas to an absolute degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotateTo: function rotateTo(degree) {
+ degree = Number(degree);
+
+ if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {
+ this.imageData.rotate = degree % 360;
+ this.renderCanvas(true, true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Scale the image on the x-axis.
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @returns {Object} this
+ */
+ scaleX: function scaleX(_scaleX) {
+ var scaleY = this.imageData.scaleY;
+
+
+ return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1);
+ },
+
+
+ /**
+ * Scale the image on the y-axis.
+ * @param {number} scaleY - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scaleY: function scaleY(_scaleY) {
+ var scaleX = this.imageData.scaleX;
+
+
+ return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY);
+ },
+
+
+ /**
+ * Scale the image
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scale: function scale(scaleX) {
+ var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
+ var imageData = this.imageData;
+
+ var transformed = false;
+
+ scaleX = Number(scaleX);
+ scaleY = Number(scaleY);
+
+ if (this.ready && !this.disabled && this.options.scalable) {
+ if (isNumber(scaleX)) {
+ imageData.scaleX = scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(scaleY)) {
+ imageData.scaleY = scaleY;
+ transformed = true;
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the cropped area position and size data (base on the original image)
+ * @param {boolean} [rounded=false] - Indicate if round the data values or not.
+ * @returns {Object} The result cropped data.
+ */
+ getData: function getData$$1() {
+ var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ var options = this.options,
+ imageData = this.imageData,
+ canvasData = this.canvasData,
+ cropBoxData = this.cropBoxData;
+
+ var data = void 0;
+
+ if (this.ready && this.cropped) {
+ data = {
+ x: cropBoxData.left - canvasData.left,
+ y: cropBoxData.top - canvasData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ };
+
+ var ratio = imageData.width / imageData.naturalWidth;
+
+ each(data, function (n, i) {
+ n /= ratio;
+ data[i] = rounded ? Math.round(n) : n;
+ });
+ } else {
+ data = {
+ x: 0,
+ y: 0,
+ width: 0,
+ height: 0
+ };
+ }
+
+ if (options.rotatable) {
+ data.rotate = imageData.rotate || 0;
+ }
+
+ if (options.scalable) {
+ data.scaleX = imageData.scaleX || 1;
+ data.scaleY = imageData.scaleY || 1;
+ }
+
+ return data;
+ },
+
+
+ /**
+ * Set the cropped area position and size with new data
+ * @param {Object} data - The new data.
+ * @returns {Object} this
+ */
+ setData: function setData$$1(data) {
+ var options = this.options,
+ imageData = this.imageData,
+ canvasData = this.canvasData;
+
+ var cropBoxData = {};
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ var transformed = false;
+
+ if (options.rotatable) {
+ if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
+ imageData.rotate = data.rotate;
+ transformed = true;
+ }
+ }
+
+ if (options.scalable) {
+ if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
+ imageData.scaleX = data.scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
+ imageData.scaleY = data.scaleY;
+ transformed = true;
+ }
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+
+ var ratio = imageData.width / imageData.naturalWidth;
+
+ if (isNumber(data.x)) {
+ cropBoxData.left = data.x * ratio + canvasData.left;
+ }
+
+ if (isNumber(data.y)) {
+ cropBoxData.top = data.y * ratio + canvasData.top;
+ }
+
+ if (isNumber(data.width)) {
+ cropBoxData.width = data.width * ratio;
+ }
+
+ if (isNumber(data.height)) {
+ cropBoxData.height = data.height * ratio;
+ }
+
+ this.setCropBoxData(cropBoxData);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the container size data.
+ * @returns {Object} The result container data.
+ */
+ getContainerData: function getContainerData() {
+ return this.ready ? extend({}, this.containerData) : {};
+ },
+
+
+ /**
+ * Get the image position and size data.
+ * @returns {Object} The result image data.
+ */
+ getImageData: function getImageData() {
+ return this.loaded ? extend({}, this.imageData) : {};
+ },
+
+
+ /**
+ * Get the canvas position and size data.
+ * @returns {Object} The result canvas data.
+ */
+ getCanvasData: function getCanvasData() {
+ var canvasData = this.canvasData;
+
+ var data = {};
+
+ if (this.ready) {
+ each(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) {
+ data[n] = canvasData[n];
+ });
+ }
+
+ return data;
+ },
+
+
+ /**
+ * Set the canvas position and size with new data.
+ * @param {Object} data - The new canvas data.
+ * @returns {Object} this
+ */
+ setCanvasData: function setCanvasData(data) {
+ var canvasData = this.canvasData;
+ var aspectRatio = canvasData.aspectRatio;
+
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ canvasData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ canvasData.top = data.top;
+ }
+
+ if (isNumber(data.width)) {
+ canvasData.width = data.width;
+ canvasData.height = data.width / aspectRatio;
+ } else if (isNumber(data.height)) {
+ canvasData.height = data.height;
+ canvasData.width = data.height * aspectRatio;
+ }
+
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get the crop box position and size data.
+ * @returns {Object} The result crop box data.
+ */
+ getCropBoxData: function getCropBoxData() {
+ var cropBoxData = this.cropBoxData;
+
+ var data = void 0;
+
+ if (this.ready && this.cropped) {
+ data = {
+ left: cropBoxData.left,
+ top: cropBoxData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height
+ };
+ }
+
+ return data || {};
+ },
+
+
+ /**
+ * Set the crop box position and size with new data.
+ * @param {Object} data - The new crop box data.
+ * @returns {Object} this
+ */
+ setCropBoxData: function setCropBoxData(data) {
+ var cropBoxData = this.cropBoxData;
+ var aspectRatio = this.options.aspectRatio;
+
+ var widthChanged = void 0;
+ var heightChanged = void 0;
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ cropBoxData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ cropBoxData.top = data.top;
+ }
+
+ if (isNumber(data.width) && data.width !== cropBoxData.width) {
+ widthChanged = true;
+ cropBoxData.width = data.width;
+ }
+
+ if (isNumber(data.height) && data.height !== cropBoxData.height) {
+ heightChanged = true;
+ cropBoxData.height = data.height;
+ }
+
+ if (aspectRatio) {
+ if (widthChanged) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else if (heightChanged) {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.renderCropBox();
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Get a canvas drawn the cropped image.
+ * @param {Object} [options={}] - The config options.
+ * @returns {HTMLCanvasElement} - The result canvas.
+ */
+ getCroppedCanvas: function getCroppedCanvas() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ if (!this.ready || !window.HTMLCanvasElement) {
+ return null;
+ }
+
+ var canvasData = this.canvasData;
+
+ var source = getSourceCanvas(this.image, this.imageData, canvasData, options);
+
+ // Returns the source canvas if it is not cropped.
+ if (!this.cropped) {
+ return source;
+ }
+
+ var _getData = this.getData(),
+ x = _getData.x,
+ y = _getData.y,
+ initialWidth = _getData.width,
+ initialHeight = _getData.height;
+
+ var aspectRatio = initialWidth / initialHeight;
+ var maxSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.maxWidth || Infinity,
+ height: options.maxHeight || Infinity
+ });
+ var minSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.minWidth || 0,
+ height: options.minHeight || 0
+ });
+
+ var _getContainSizes = getContainSizes({
+ aspectRatio: aspectRatio,
+ width: options.width || initialWidth,
+ height: options.height || initialHeight
+ }),
+ width = _getContainSizes.width,
+ height = _getContainSizes.height;
+
+ width = Math.min(maxSizes.width, Math.max(minSizes.width, width));
+ height = Math.min(maxSizes.height, Math.max(minSizes.height, height));
+
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+
+ context.fillStyle = options.fillColor || 'transparent';
+ context.fillRect(0, 0, width, height);
+
+ var _options$imageSmoothi = options.imageSmoothingEnabled,
+ imageSmoothingEnabled = _options$imageSmoothi === undefined ? true : _options$imageSmoothi,
+ imageSmoothingQuality = options.imageSmoothingQuality;
+
+
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+
+ if (imageSmoothingQuality) {
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ }
+
+ // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage
+ var sourceWidth = source.width;
+ var sourceHeight = source.height;
+
+ // Source canvas parameters
+ var srcX = x;
+ var srcY = y;
+ var srcWidth = void 0;
+ var srcHeight = void 0;
+
+ // Destination canvas parameters
+ var dstX = void 0;
+ var dstY = void 0;
+ var dstWidth = void 0;
+ var dstHeight = void 0;
+
+ if (srcX <= -initialWidth || srcX > sourceWidth) {
+ srcX = 0;
+ srcWidth = 0;
+ dstX = 0;
+ dstWidth = 0;
+ } else if (srcX <= 0) {
+ dstX = -srcX;
+ srcX = 0;
+ srcWidth = Math.min(sourceWidth, initialWidth + srcX);
+ dstWidth = srcWidth;
+ } else if (srcX <= sourceWidth) {
+ dstX = 0;
+ srcWidth = Math.min(initialWidth, sourceWidth - srcX);
+ dstWidth = srcWidth;
+ }
+
+ if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {
+ srcY = 0;
+ srcHeight = 0;
+ dstY = 0;
+ dstHeight = 0;
+ } else if (srcY <= 0) {
+ dstY = -srcY;
+ srcY = 0;
+ srcHeight = Math.min(sourceHeight, initialHeight + srcY);
+ dstHeight = srcHeight;
+ } else if (srcY <= sourceHeight) {
+ dstY = 0;
+ srcHeight = Math.min(initialHeight, sourceHeight - srcY);
+ dstHeight = srcHeight;
+ }
+
+ // All the numerical parameters should be integer for `drawImage`
+ // https://github.com/fengyuanchen/cropper/issues/476
+ var params = [srcX, srcY, srcWidth, srcHeight];
+
+ // Avoid "IndexSizeError"
+ if (dstWidth > 0 && dstHeight > 0) {
+ var scale = width / initialWidth;
+
+ params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
+ }
+
+ context.drawImage.apply(context, [source].concat(toConsumableArray(params.map(function (param) {
+ return Math.floor(normalizeDecimalNumber(param));
+ }))));
+
+ return canvas;
+ },
+
+
+ /**
+ * Change the aspect ratio of the crop box.
+ * @param {number} aspectRatio - The new aspect ratio.
+ * @returns {Object} this
+ */
+ setAspectRatio: function setAspectRatio(aspectRatio) {
+ var options = this.options;
+
+
+ if (!this.disabled && !isUndefined(aspectRatio)) {
+ // 0 -> NaN
+ options.aspectRatio = Math.max(0, aspectRatio) || NaN;
+
+ if (this.ready) {
+ this.initCropBox();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+ }
+
+ return this;
+ },
+
+
+ /**
+ * Change the drag mode.
+ * @param {string} mode - The new drag mode.
+ * @returns {Object} this
+ */
+ setDragMode: function setDragMode(mode) {
+ var options = this.options,
+ dragBox = this.dragBox,
+ face = this.face;
+
+
+ if (this.loaded && !this.disabled) {
+ var croppable = mode === DRAG_MODE_CROP;
+ var movable = options.movable && mode === DRAG_MODE_MOVE;
+
+ mode = croppable || movable ? mode : DRAG_MODE_NONE;
+
+ setData(dragBox, DATA_ACTION, mode);
+ toggleClass(dragBox, CLASS_CROP, croppable);
+ toggleClass(dragBox, CLASS_MOVE, movable);
+
+ if (!options.cropBoxMovable) {
+ // Sync drag mode to crop box when it is not movable
+ setData(face, DATA_ACTION, mode);
+ toggleClass(face, CLASS_CROP, croppable);
+ toggleClass(face, CLASS_MOVE, movable);
+ }
+ }
+
+ return this;
+ }
+};
+
+var AnotherCropper = WINDOW.Cropper;
+
+var Cropper = function () {
+ /**
+ * Create a new Cropper.
+ * @param {Element} element - The target element for cropping.
+ * @param {Object} [options={}] - The configuration options.
+ */
+ function Cropper(element) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ classCallCheck(this, Cropper);
+
+ if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {
+ throw new Error('The first argument is required and must be an <img> or <canvas> element.');
+ }
+
+ this.element = element;
+ this.options = extend({}, DEFAULTS, isPlainObject(options) && options);
+ this.complete = false;
+ this.cropped = false;
+ this.disabled = false;
+ this.isImg = false;
+ this.limited = false;
+ this.loaded = false;
+ this.ready = false;
+ this.replaced = false;
+ this.wheeling = false;
+ this.originalUrl = '';
+ this.canvasData = null;
+ this.cropBoxData = null;
+ this.previews = null;
+ this.pointers = {};
+ this.init();
+ }
+
+ createClass(Cropper, [{
+ key: 'init',
+ value: function init() {
+ var element = this.element;
+
+ var tagName = element.tagName.toLowerCase();
+ var url = void 0;
+
+ if (getData(element, NAMESPACE)) {
+ return;
+ }
+
+ setData(element, NAMESPACE, this);
+
+ if (tagName === 'img') {
+ this.isImg = true;
+
+ // e.g.: "img/picture.jpg"
+ url = element.getAttribute('src') || '';
+ this.originalUrl = url;
+
+ // Stop when it's a blank image
+ if (!url) {
+ return;
+ }
+
+ // e.g.: "http://example.com/img/picture.jpg"
+ url = element.src;
+ } else if (tagName === 'canvas' && window.HTMLCanvasElement) {
+ url = element.toDataURL();
+ }
+
+ this.load(url);
+ }
+ }, {
+ key: 'load',
+ value: function load(url) {
+ var _this = this;
+
+ if (!url) {
+ return;
+ }
+
+ this.url = url;
+ this.imageData = {};
+
+ var element = this.element,
+ options = this.options;
+
+
+ if (!options.checkOrientation || !window.ArrayBuffer) {
+ this.clone();
+ return;
+ }
+
+ // XMLHttpRequest disallows to open a Data URL in some browsers like IE11 and Safari
+ if (REGEXP_DATA_URL.test(url)) {
+ if (REGEXP_DATA_URL_JPEG.test(url)) {
+ this.read(dataURLToArrayBuffer(url));
+ } else {
+ this.clone();
+ }
+
+ return;
+ }
+
+ var xhr = new XMLHttpRequest();
+
+ xhr.onerror = function () {
+ _this.clone();
+ };
+
+ xhr.onload = function () {
+ _this.read(xhr.response);
+ };
+
+ if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {
+ url = addTimestamp(url);
+ }
+
+ xhr.open('get', url);
+ xhr.responseType = 'arraybuffer';
+ xhr.withCredentials = element.crossOrigin === 'use-credentials';
+ xhr.send();
+ }
+ }, {
+ key: 'read',
+ value: function read(arrayBuffer) {
+ var options = this.options,
+ imageData = this.imageData;
+
+ var orientation = getOrientation(arrayBuffer);
+ var rotate = 0;
+ var scaleX = 1;
+ var scaleY = 1;
+
+ if (orientation > 1) {
+ this.url = arrayBufferToDataURL(arrayBuffer, 'image/jpeg');
+
+ var _parseOrientation = parseOrientation(orientation);
+
+ rotate = _parseOrientation.rotate;
+ scaleX = _parseOrientation.scaleX;
+ scaleY = _parseOrientation.scaleY;
+ }
+
+ if (options.rotatable) {
+ imageData.rotate = rotate;
+ }
+
+ if (options.scalable) {
+ imageData.scaleX = scaleX;
+ imageData.scaleY = scaleY;
+ }
+
+ this.clone();
+ }
+ }, {
+ key: 'clone',
+ value: function clone() {
+ var element = this.element,
+ url = this.url;
+
+ var crossOrigin = void 0;
+ var crossOriginUrl = void 0;
+
+ if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {
+ crossOrigin = element.crossOrigin;
+
+
+ if (crossOrigin) {
+ crossOriginUrl = url;
+ } else {
+ crossOrigin = 'anonymous';
+
+ // Bust cache when there is not a "crossOrigin" property
+ crossOriginUrl = addTimestamp(url);
+ }
+ }
+
+ this.crossOrigin = crossOrigin;
+ this.crossOriginUrl = crossOriginUrl;
+
+ var image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = crossOriginUrl || url;
+
+ var start = proxy(this.start, this);
+ var stop = proxy(this.stop, this);
+
+ this.image = image;
+ this.onStart = start;
+ this.onStop = stop;
+
+ if (this.isImg) {
+ if (element.complete) {
+ this.start();
+ } else {
+ addListener(element, EVENT_LOAD, start);
+ }
+ } else {
+ addListener(image, EVENT_LOAD, start);
+ addListener(image, EVENT_ERROR, stop);
+ addClass(image, CLASS_HIDE);
+ element.parentNode.insertBefore(image, element.nextSibling);
+ }
+ }
+ }, {
+ key: 'start',
+ value: function start(event) {
+ var _this2 = this;
+
+ var image = this.isImg ? this.element : this.image;
+
+ if (event) {
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ }
+
+ getImageNaturalSizes(image, function (naturalWidth, naturalHeight) {
+ extend(_this2.imageData, {
+ naturalWidth: naturalWidth,
+ naturalHeight: naturalHeight,
+ aspectRatio: naturalWidth / naturalHeight
+ });
+ _this2.loaded = true;
+ _this2.build();
+ });
+ }
+ }, {
+ key: 'stop',
+ value: function stop() {
+ var image = this.image;
+
+
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ image.parentNode.removeChild(image);
+ this.image = null;
+ }
+ }, {
+ key: 'build',
+ value: function build() {
+ var _this3 = this;
+
+ if (!this.loaded) {
+ return;
+ }
+
+ // Unbuild first when replace
+ if (this.ready) {
+ this.unbuild();
+ }
+
+ var element = this.element,
+ options = this.options,
+ image = this.image;
+
+ // Create cropper elements
+
+ var container = element.parentNode;
+ var template = document.createElement('div');
+
+ template.innerHTML = TEMPLATE;
+
+ var cropper = template.querySelector('.' + NAMESPACE + '-container');
+ var canvas = cropper.querySelector('.' + NAMESPACE + '-canvas');
+ var dragBox = cropper.querySelector('.' + NAMESPACE + '-drag-box');
+ var cropBox = cropper.querySelector('.' + NAMESPACE + '-crop-box');
+ var face = cropBox.querySelector('.' + NAMESPACE + '-face');
+
+ this.container = container;
+ this.cropper = cropper;
+ this.canvas = canvas;
+ this.dragBox = dragBox;
+ this.cropBox = cropBox;
+ this.viewBox = cropper.querySelector('.' + NAMESPACE + '-view-box');
+ this.face = face;
+
+ canvas.appendChild(image);
+
+ // Hide the original image
+ addClass(element, CLASS_HIDDEN);
+
+ // Inserts the cropper after to the current image
+ container.insertBefore(cropper, element.nextSibling);
+
+ // Show the image if is hidden
+ if (!this.isImg) {
+ removeClass(image, CLASS_HIDE);
+ }
+
+ this.initPreview();
+ this.bind();
+
+ options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;
+ options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;
+
+ this.cropped = options.autoCrop;
+
+ if (options.autoCrop) {
+ if (options.modal) {
+ addClass(dragBox, CLASS_MODAL);
+ }
+ } else {
+ addClass(cropBox, CLASS_HIDDEN);
+ }
+
+ if (!options.guides) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-dashed'), CLASS_HIDDEN);
+ }
+
+ if (!options.center) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-center'), CLASS_HIDDEN);
+ }
+
+ if (options.background) {
+ addClass(cropper, NAMESPACE + '-bg');
+ }
+
+ if (!options.highlight) {
+ addClass(face, CLASS_INVISIBLE);
+ }
+
+ if (options.cropBoxMovable) {
+ addClass(face, CLASS_MOVE);
+ setData(face, DATA_ACTION, ACTION_ALL);
+ }
+
+ if (!options.cropBoxResizable) {
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-line'), CLASS_HIDDEN);
+ addClass(cropBox.getElementsByClassName(NAMESPACE + '-point'), CLASS_HIDDEN);
+ }
+
+ this.setDragMode(options.dragMode);
+ this.render();
+ this.ready = true;
+ this.setData(options.data);
+
+ // Call the "ready" option asynchronously to keep "image.cropper" is defined
+ this.completing = setTimeout(function () {
+ if (isFunction(options.ready)) {
+ addListener(element, EVENT_READY, options.ready, {
+ once: true
+ });
+ }
+
+ dispatchEvent(element, EVENT_READY);
+ dispatchEvent(element, EVENT_CROP, _this3.getData());
+
+ _this3.complete = true;
+ }, 0);
+ }
+ }, {
+ key: 'unbuild',
+ value: function unbuild() {
+ if (!this.ready) {
+ return;
+ }
+
+ if (!this.complete) {
+ clearTimeout(this.completing);
+ }
+
+ this.ready = false;
+ this.complete = false;
+ this.initialImageData = null;
+
+ // Clear `initialCanvasData` is necessary when replace
+ this.initialCanvasData = null;
+ this.initialCropBoxData = null;
+ this.containerData = null;
+ this.canvasData = null;
+
+ // Clear `cropBoxData` is necessary when replace
+ this.cropBoxData = null;
+ this.unbind();
+ this.resetPreview();
+ this.previews = null;
+ this.viewBox = null;
+ this.cropBox = null;
+ this.dragBox = null;
+ this.canvas = null;
+ this.container = null;
+ this.cropper.parentNode.removeChild(this.cropper);
+ this.cropper = null;
+ }
+
+ /**
+ * Get the no conflict cropper class.
+ * @returns {Cropper} The cropper class.
+ */
+
+ }], [{
+ key: 'noConflict',
+ value: function noConflict() {
+ window.Cropper = AnotherCropper;
+ return Cropper;
+ }
+
+ /**
+ * Change the default options.
+ * @param {Object} options - The new default options.
+ */
+
+ }, {
+ key: 'setDefaults',
+ value: function setDefaults(options) {
+ extend(DEFAULTS, isPlainObject(options) && options);
+ }
+ }]);
+ return Cropper;
+}();
+
+extend(Cropper.prototype, render, preview, events, handlers, change, methods);
+
+return Cropper;
+
+})));
diff --git a/library/cropperjs/docs/js/main.js b/library/cropperjs/docs/js/main.js
new file mode 100644
index 000000000..d74afbd60
--- /dev/null
+++ b/library/cropperjs/docs/js/main.js
@@ -0,0 +1,298 @@
+window.onload = function () {
+
+ 'use strict';
+
+ var Cropper = window.Cropper;
+ var URL = window.URL || window.webkitURL;
+ var container = document.querySelector('.img-container');
+ var image = container.getElementsByTagName('img').item(0);
+ var download = document.getElementById('download');
+ var actions = document.getElementById('actions');
+ var dataX = document.getElementById('dataX');
+ var dataY = document.getElementById('dataY');
+ var dataHeight = document.getElementById('dataHeight');
+ var dataWidth = document.getElementById('dataWidth');
+ var dataRotate = document.getElementById('dataRotate');
+ var dataScaleX = document.getElementById('dataScaleX');
+ var dataScaleY = document.getElementById('dataScaleY');
+ var options = {
+ aspectRatio: 16 / 9,
+ preview: '.img-preview',
+ ready: function (e) {
+ console.log(e.type);
+ },
+ cropstart: function (e) {
+ console.log(e.type, e.detail.action);
+ },
+ cropmove: function (e) {
+ console.log(e.type, e.detail.action);
+ },
+ cropend: function (e) {
+ console.log(e.type, e.detail.action);
+ },
+ crop: function (e) {
+ var data = e.detail;
+
+ console.log(e.type);
+ dataX.value = Math.round(data.x);
+ dataY.value = Math.round(data.y);
+ dataHeight.value = Math.round(data.height);
+ dataWidth.value = Math.round(data.width);
+ dataRotate.value = typeof data.rotate !== 'undefined' ? data.rotate : '';
+ dataScaleX.value = typeof data.scaleX !== 'undefined' ? data.scaleX : '';
+ dataScaleY.value = typeof data.scaleY !== 'undefined' ? data.scaleY : '';
+ },
+ zoom: function (e) {
+ console.log(e.type, e.detail.ratio);
+ }
+ };
+ var cropper = new Cropper(image, options);
+ var originalImageURL = image.src;
+ var uploadedImageType = 'image/jpeg';
+ var uploadedImageURL;
+
+ // Tooltip
+ $('[data-toggle="tooltip"]').tooltip();
+
+ // Buttons
+ if (!document.createElement('canvas').getContext) {
+ $('button[data-method="getCroppedCanvas"]').prop('disabled', true);
+ }
+
+ if (typeof document.createElement('cropper').style.transition === 'undefined') {
+ $('button[data-method="rotate"]').prop('disabled', true);
+ $('button[data-method="scale"]').prop('disabled', true);
+ }
+
+ // Download
+ if (typeof download.download === 'undefined') {
+ download.className += ' disabled';
+ }
+
+ // Options
+ actions.querySelector('.docs-toggles').onchange = function (event) {
+ var e = event || window.event;
+ var target = e.target || e.srcElement;
+ var cropBoxData;
+ var canvasData;
+ var isCheckbox;
+ var isRadio;
+
+ if (!cropper) {
+ return;
+ }
+
+ if (target.tagName.toLowerCase() === 'label') {
+ target = target.querySelector('input');
+ }
+
+ isCheckbox = target.type === 'checkbox';
+ isRadio = target.type === 'radio';
+
+ if (isCheckbox || isRadio) {
+ if (isCheckbox) {
+ options[target.name] = target.checked;
+ cropBoxData = cropper.getCropBoxData();
+ canvasData = cropper.getCanvasData();
+
+ options.ready = function () {
+ console.log('ready');
+ cropper.setCropBoxData(cropBoxData).setCanvasData(canvasData);
+ };
+ } else {
+ options[target.name] = target.value;
+ options.ready = function () {
+ console.log('ready');
+ };
+ }
+
+ // Restart
+ cropper.destroy();
+ cropper = new Cropper(image, options);
+ }
+ };
+
+ // Methods
+ actions.querySelector('.docs-buttons').onclick = function (event) {
+ var e = event || window.event;
+ var target = e.target || e.srcElement;
+ var cropped;
+ var result;
+ var input;
+ var data;
+
+ if (!cropper) {
+ return;
+ }
+
+ while (target !== this) {
+ if (target.getAttribute('data-method')) {
+ break;
+ }
+
+ target = target.parentNode;
+ }
+
+ if (target === this || target.disabled || target.className.indexOf('disabled') > -1) {
+ return;
+ }
+
+ data = {
+ method: target.getAttribute('data-method'),
+ target: target.getAttribute('data-target'),
+ option: target.getAttribute('data-option') || undefined,
+ secondOption: target.getAttribute('data-second-option') || undefined
+ };
+
+ cropped = cropper.cropped;
+
+ if (data.method) {
+ if (typeof data.target !== 'undefined') {
+ input = document.querySelector(data.target);
+
+ if (!target.hasAttribute('data-option') && data.target && input) {
+ try {
+ data.option = JSON.parse(input.value);
+ } catch (e) {
+ console.log(e.message);
+ }
+ }
+ }
+
+ switch (data.method) {
+ case 'rotate':
+ if (cropped && options.viewMode > 0) {
+ cropper.clear();
+ }
+
+ break;
+
+ case 'getCroppedCanvas':
+ try {
+ data.option = JSON.parse(data.option);
+ } catch (e) {
+ console.log(e.message);
+ }
+
+ if (uploadedImageType === 'image/jpeg') {
+ if (!data.option) {
+ data.option = {};
+ }
+
+ data.option.fillColor = '#fff';
+ }
+
+ break;
+ }
+
+ result = cropper[data.method](data.option, data.secondOption);
+
+ switch (data.method) {
+ case 'rotate':
+ if (cropped && options.viewMode > 0) {
+ cropper.crop();
+ }
+
+ break;
+
+ case 'scaleX':
+ case 'scaleY':
+ target.setAttribute('data-option', -data.option);
+ break;
+
+ case 'getCroppedCanvas':
+ if (result) {
+ // Bootstrap's Modal
+ $('#getCroppedCanvasModal').modal().find('.modal-body').html(result);
+
+ if (!download.disabled) {
+ download.href = result.toDataURL(uploadedImageType);
+ }
+ }
+
+ break;
+
+ case 'destroy':
+ cropper = null;
+
+ if (uploadedImageURL) {
+ URL.revokeObjectURL(uploadedImageURL);
+ uploadedImageURL = '';
+ image.src = originalImageURL;
+ }
+
+ break;
+ }
+
+ if (typeof result === 'object' && result !== cropper && input) {
+ try {
+ input.value = JSON.stringify(result);
+ } catch (e) {
+ console.log(e.message);
+ }
+ }
+ }
+ };
+
+ document.body.onkeydown = function (event) {
+ var e = event || window.event;
+
+ if (!cropper || this.scrollTop > 300) {
+ return;
+ }
+
+ switch (e.keyCode) {
+ case 37:
+ e.preventDefault();
+ cropper.move(-1, 0);
+ break;
+
+ case 38:
+ e.preventDefault();
+ cropper.move(0, -1);
+ break;
+
+ case 39:
+ e.preventDefault();
+ cropper.move(1, 0);
+ break;
+
+ case 40:
+ e.preventDefault();
+ cropper.move(0, 1);
+ break;
+ }
+ };
+
+ // Import image
+ var inputImage = document.getElementById('inputImage');
+
+ if (URL) {
+ inputImage.onchange = function () {
+ var files = this.files;
+ var file;
+
+ if (cropper && files && files.length) {
+ file = files[0];
+
+ if (/^image\/\w+/.test(file.type)) {
+ uploadedImageType = file.type;
+
+ if (uploadedImageURL) {
+ URL.revokeObjectURL(uploadedImageURL);
+ }
+
+ image.src = uploadedImageURL = URL.createObjectURL(file);
+ cropper.destroy();
+ cropper = new Cropper(image, options);
+ inputImage.value = null;
+ } else {
+ window.alert('Please choose an image file.');
+ }
+ }
+ };
+ } else {
+ inputImage.disabled = true;
+ inputImage.parentNode.className += ' disabled';
+ }
+};
diff --git a/library/cropperjs/examples/a-range-of-aspect-ratio.html b/library/cropperjs/examples/a-range-of-aspect-ratio.html
new file mode 100644
index 000000000..fae5cb60b
--- /dev/null
+++ b/library/cropperjs/examples/a-range-of-aspect-ratio.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper with a range of aspect ratio</h1>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var minAspectRatio = 0.5;
+ var maxAspectRatio = 1.5;
+ var cropper = new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var containerData = cropper.getContainerData();
+ var cropBoxData = cropper.getCropBoxData();
+ var aspectRatio = cropBoxData.width / cropBoxData.height;
+ var newCropBoxWidth;
+
+ if (aspectRatio < minAspectRatio || aspectRatio > maxAspectRatio) {
+ newCropBoxWidth = cropBoxData.height * ((minAspectRatio + maxAspectRatio) / 2);
+
+ cropper.setCropBoxData({
+ left: (containerData.width - newCropBoxWidth) / 2,
+ width: newCropBoxWidth
+ });
+ }
+ },
+ cropmove: function () {
+ var cropper = this.cropper;
+ var cropBoxData = cropper.getCropBoxData();
+ var aspectRatio = cropBoxData.width / cropBoxData.height;
+
+ if (aspectRatio < minAspectRatio) {
+ cropper.setCropBoxData({
+ width: cropBoxData.height * minAspectRatio
+ });
+ } else if (aspectRatio > maxAspectRatio) {
+ cropper.setCropBoxData({
+ width: cropBoxData.height * maxAspectRatio
+ });
+ }
+ }
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/crop-a-round-image.html b/library/cropperjs/examples/crop-a-round-image.html
new file mode 100644
index 000000000..da027d847
--- /dev/null
+++ b/library/cropperjs/examples/crop-a-round-image.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+
+ .cropper-view-box,
+ .cropper-face {
+ border-radius: 50%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Crop a round image</h1>
+ <h3>Image</h3>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <h3>Result</h3>
+ <p>
+ <button type="button" id="button">Crop</button>
+ </p>
+ <div id="result"></div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ (function () {
+
+ function getRoundedCanvas(sourceCanvas) {
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+ var width = sourceCanvas.width;
+ var height = sourceCanvas.height;
+
+ canvas.width = width;
+ canvas.height = height;
+
+ context.imageSmoothingEnabled = true;
+ context.drawImage(sourceCanvas, 0, 0, width, height);
+ context.globalCompositeOperation = 'destination-in';
+ context.beginPath();
+ context.arc(width / 2, height / 2, Math.min(width, height) / 2, 0, 2 * Math.PI, true);
+ context.fill();
+
+ return canvas;
+ }
+
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.getElementById('image');
+ var button = document.getElementById('button');
+ var result = document.getElementById('result');
+ var croppable = false;
+ var cropper = new Cropper(image, {
+ aspectRatio: 1,
+ viewMode: 1,
+ ready: function () {
+ croppable = true;
+ }
+ });
+
+ button.onclick = function () {
+ var croppedCanvas;
+ var roundedCanvas;
+ var roundedImage;
+
+ if (!croppable) {
+ return;
+ }
+
+ // Crop
+ croppedCanvas = cropper.getCroppedCanvas();
+
+ // Round
+ roundedCanvas = getRoundedCanvas(croppedCanvas);
+
+ // Show
+ roundedImage = document.createElement('img');
+ roundedImage.src = roundedCanvas.toDataURL()
+ result.innerHTML = '';
+ result.appendChild(roundedImage);
+ };
+
+ });
+
+ })();
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/crop-cross-origin-image.html b/library/cropperjs/examples/crop-cross-origin-image.html
new file mode 100644
index 000000000..54f08664a
--- /dev/null
+++ b/library/cropperjs/examples/crop-cross-origin-image.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Crop a cross origin image</h1>
+ <p>A cross origin image with a <code>crossorigin</code> attribute and an available <code>Access-Control-Allow-Origin</code> response header can be cropped by Cropper.</p>
+ <h3>Image</h3>
+ <div>
+ <img id="image" src="https://raw.githubusercontent.com/fengyuanchen/cropperjs/master/docs/images/picture.jpg" crossorigin>
+ </div>
+ <h3>Result</h3>
+ <div id="result"></div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var result = document.querySelector('#result');
+ var cropper = new Cropper(image, {
+ ready: function () {
+ var image = new Image();
+
+ image.src = cropper.getCroppedCanvas().toDataURL('image/jpeg');
+ result.appendChild(image);
+ },
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/crop-on-canvas.html b/library/cropperjs/examples/crop-on-canvas.html
new file mode 100644
index 000000000..228e36f75
--- /dev/null
+++ b/library/cropperjs/examples/crop-on-canvas.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Crop on canvas with Cropper</h1>
+ <h3>Image</h3>
+ <div class="img-container">
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <h3>Canvas</h3>
+ <div class="img-container">
+ <canvas id="canvas"></canvas>
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ function start() {
+ var width = this.offsetWidth;
+ var height = this.offsetHeight;
+ var cropper;
+
+ canvas.width = width;
+ canvas.height = height;
+ canvas.getContext('2d').drawImage(
+ this,
+ 0, 0, this.naturalWidth, this.naturalHeight,
+ 0, 0, width, height
+ );
+
+ cropper = new Cropper(canvas);
+ }
+
+ window.addEventListener('DOMContentLoaded', function () {
+ var canvas = document.getElementById('canvas');
+ var image = document.getElementById('image');
+
+ if (image.complete) {
+ start.call(image);
+ } else {
+ image.onload = start;
+ }
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/cropper-in-modal.html b/library/cropperjs/examples/cropper-in-modal.html
new file mode 100644
index 000000000..a9ce3e80b
--- /dev/null
+++ b/library/cropperjs/examples/cropper-in-modal.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .img-container img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper in a Bootstrap modal</h1>
+
+ <!-- Button trigger modal -->
+ <button type="button" class="btn btn-primary" data-target="#modal" data-toggle="modal">
+ Launch the demo
+ </button>
+
+ <!-- Modal -->
+ <div class="modal fade" id="modal" role="dialog" aria-labelledby="modalLabel" tabindex="-1">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title" id="modalLabel">Cropper</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <div class="img-container">
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.getElementById('image');
+ var cropBoxData;
+ var canvasData;
+ var cropper;
+
+ $('#modal').on('shown.bs.modal', function () {
+ cropper = new Cropper(image, {
+ autoCropArea: 0.5,
+ ready: function () {
+
+ // Strict mode: set crop box data first
+ cropper.setCropBoxData(cropBoxData).setCanvasData(canvasData);
+ }
+ });
+ }).on('hidden.bs.modal', function () {
+ cropBoxData = cropper.getCropBoxData();
+ canvasData = cropper.getCanvasData();
+ cropper.destroy();
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/customize-preview.html b/library/cropperjs/examples/customize-preview.html
new file mode 100644
index 000000000..ea1c24b88
--- /dev/null
+++ b/library/cropperjs/examples/customize-preview.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 960px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+
+ .row,
+ .preview {
+ overflow: hidden;
+ }
+
+ .col {
+ float: left;
+ }
+
+ .col-6 {
+ width: 50%;
+ }
+
+ .col-3 {
+ width: 25%;
+ }
+
+ .col-2 {
+ width: 16.7%;
+ }
+
+ .col-1 {
+ width: 8.3%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Customize preview for Cropper</h1>
+ <div class="row">
+ <div class="col col-6">
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <div class="col col-3">
+ <div class="preview"></div>
+ </div>
+ <div class="col col-2">
+ <div class="preview"></div>
+ </div>
+ <div class="col col-1">
+ <div class="preview"></div>
+ </div>
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ function each(arr, callback) {
+ var length = arr.length;
+ var i;
+
+ for (i = 0; i < length; i++) {
+ callback.call(arr, arr[i], i, arr);
+ }
+
+ return arr;
+ }
+
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var previews = document.querySelectorAll('.preview');
+ var cropper = new Cropper(image, {
+ ready: function () {
+ var clone = this.cloneNode();
+
+ clone.className = ''
+ clone.style.cssText = (
+ 'display: block;' +
+ 'width: 100%;' +
+ 'min-width: 0;' +
+ 'min-height: 0;' +
+ 'max-width: none;' +
+ 'max-height: none;'
+ );
+
+ each(previews, function (elem) {
+ elem.appendChild(clone.cloneNode());
+ });
+ },
+
+ crop: function (e) {
+ var data = e.detail;
+ var cropper = this.cropper;
+ var imageData = cropper.getImageData();
+ var previewAspectRatio = data.width / data.height;
+
+ each(previews, function (elem) {
+ var previewImage = elem.getElementsByTagName('img').item(0);
+ var previewWidth = elem.offsetWidth;
+ var previewHeight = previewWidth / previewAspectRatio;
+ var imageScaledRatio = data.width / previewWidth;
+
+ elem.style.height = previewHeight + 'px';
+ previewImage.style.width = imageData.naturalWidth / imageScaledRatio + 'px';
+ previewImage.style.height = imageData.naturalHeight / imageScaledRatio + 'px';
+ previewImage.style.marginLeft = -data.x / imageScaledRatio + 'px';
+ previewImage.style.marginTop = -data.y / imageScaledRatio + 'px';
+ });
+ }
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/fixed-crop-box.html b/library/cropperjs/examples/fixed-crop-box.html
new file mode 100644
index 000000000..b9f1101fb
--- /dev/null
+++ b/library/cropperjs/examples/fixed-crop-box.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper with fixed crop box</h1>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var cropper = new Cropper(image, {
+ dragMode: 'move',
+ aspectRatio: 16 / 9,
+ autoCropArea: 0.65,
+ restore: false,
+ guides: false,
+ center: false,
+ highlight: false,
+ cropBoxMovable: false,
+ cropBoxResizable: false,
+ toggleDragModeOnDblclick: false,
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/full-crop-box.html b/library/cropperjs/examples/full-crop-box.html
new file mode 100644
index 000000000..7065eab94
--- /dev/null
+++ b/library/cropperjs/examples/full-crop-box.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper with full crop box</h1>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var cropper = new Cropper(image, {
+ viewMode: 3,
+ dragMode: 'move',
+ autoCropArea: 1,
+ restore: false,
+ modal: false,
+ guides: false,
+ highlight: false,
+ cropBoxMovable: false,
+ cropBoxResizable: false,
+ toggleDragModeOnDblclick: false,
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/mask-an-image.html b/library/cropperjs/examples/mask-an-image.html
new file mode 100644
index 000000000..d821da43b
--- /dev/null
+++ b/library/cropperjs/examples/mask-an-image.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+
+ .cropper-view-box,
+ .cropper-face {
+ background-color: black;
+ opacity: 1;
+ }
+
+ </style>
+</head>
+
+<body>
+
+ <div class="container">
+ <h1>Mask an image (Redaction)</h1>
+ <h3>Image</h3>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <h3>Result</h3>
+ <p><button type="button" id="button">Mask</button></p>
+ <div id="result"></div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ (function () {
+
+ function getMaskedCanvas(sourceCanvas, sourceImage, cropper) {
+ var canvas = document.createElement('canvas');
+ var context = canvas.getContext('2d');
+
+ var maskWidth = cropper.getData().width;
+ var maskHeight = cropper.getData().height;
+ var maskTop = cropper.getData().y;
+ var maskLeft = cropper.getData().x;
+
+ var imageWidth = cropper.getImageData().naturalWidth;
+ var imageHeight = cropper.getImageData().naturalHeight;
+ var imageLeft = cropper.getImageData().left;
+ var imageTop = cropper.getImageData().top;
+ var imageAspect = cropper.getImageData().aspectRatio;
+
+ canvas.width = imageWidth;
+ canvas.height = imageHeight;
+
+ // debug
+ console.log('Image Width: ' + imageWidth + ' Image Height: ' + imageHeight + ' Image Aspect Ratio: ' + imageAspect );
+ console.log('Image Left: ' + imageLeft + ' Image Top: ' + imageTop );
+ console.log('Mask Width: ' + maskWidth + ' Mask Height: ' + maskHeight + ' Mask Left: ' + maskLeft + ' Mask Top: ' + maskTop);
+
+ context.imageSmoothingEnabled = true;
+ context.drawImage(image, 0, 0, imageWidth, imageHeight);
+ context.fillRect(maskLeft, maskTop, maskWidth, maskHeight);
+
+ return canvas;
+ }
+
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.getElementById('image');
+ var button = document.getElementById('button');
+ var result = document.getElementById('result');
+ var croppable = false;
+ var cropper = new Cropper(image, {
+ viewMode: 0,
+ guides: true,
+ center: true,
+ highlight: true,
+ cropBoxMovable: true,
+ cropBoxResizable: true,
+ ready: function () {
+ croppable = true;
+ }
+ });
+
+ button.onclick = function () {
+ var croppedCanvas;
+ var roundedCanvas;
+ var roundedImage;
+
+ if (!croppable) {
+ return;
+ }
+
+ // Crop
+ croppedCanvas = cropper.getCroppedCanvas();
+
+ // Mask
+ maskedCanvas = getMaskedCanvas(croppedCanvas, image, cropper);
+
+ // Show
+ maskedImage = document.createElement('img');
+ maskedImage.src = maskedCanvas.toDataURL()
+ result.innerHTML = '';
+ result.appendChild(maskedImage);
+
+ };
+
+ });
+
+ })();
+
+ </script>
+</body>
+
+</html>
diff --git a/library/cropperjs/examples/multiple-croppers.html b/library/cropperjs/examples/multiple-croppers.html
new file mode 100644
index 000000000..6b12e70b2
--- /dev/null
+++ b/library/cropperjs/examples/multiple-croppers.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ max-width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Multiple Croppers</h1>
+ <h3>Cropper</h3>
+ <div>
+ <img src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ <h3>Another</h3>
+ <div>
+ <img src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var images = document.querySelectorAll('img');
+ var length = images.length;
+ var croppers = [];
+ var i;
+
+ for (i = 0; i < length; i++) {
+ croppers.push(new Cropper(images[i]));
+ }
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/examples/responsive-container.html b/library/cropperjs/examples/responsive-container.html
new file mode 100644
index 000000000..c1aa7483b
--- /dev/null
+++ b/library/cropperjs/examples/responsive-container.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <style>
+ .container {
+ max-width: 640px;
+ margin: 20px auto;
+ }
+
+ img {
+ width: 100%;
+ }
+ </style>
+</head>
+<body>
+
+ <div class="container">
+ <h1>Cropper with responsive container</h1>
+ <p>
+ <button type="button" id="replace">Replace Image</button>
+ </p>
+ <div>
+ <img id="image" src="../docs/images/picture.jpg" alt="Picture">
+ </div>
+ </div>
+
+ <script src="../dist/cropper.js"></script>
+ <script>
+ window.addEventListener('DOMContentLoaded', function () {
+ var image = document.querySelector('#image');
+ var cropper = new Cropper(image, {
+ movable: false,
+ zoomable: false,
+ rotatable: false,
+ scalable: false
+ });
+
+ document.getElementById('replace').onclick = function () {
+ cropper.replace('../docs/images/picture-2.jpg');
+ };
+ });
+ </script>
+</body>
+</html>
diff --git a/library/cropperjs/package-lock.json b/library/cropperjs/package-lock.json
new file mode 100644
index 000000000..229ee70fa
--- /dev/null
+++ b/library/cropperjs/package-lock.json
@@ -0,0 +1,9111 @@
+{
+ "name": "cropperjs",
+ "version": "1.2.2",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "JSONStream": {
+ "version": "0.8.4",
+ "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
+ "integrity": "sha1-kWV9/m/4V0gwZhMrRhi2Lo9Ih70=",
+ "dev": true,
+ "requires": {
+ "jsonparse": "0.0.5",
+ "through": "2.3.8"
+ }
+ },
+ "acorn": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz",
+ "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==",
+ "dev": true
+ },
+ "acorn-jsx": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz",
+ "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=",
+ "dev": true,
+ "requires": {
+ "acorn": "3.3.0"
+ },
+ "dependencies": {
+ "acorn": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
+ "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=",
+ "dev": true
+ }
+ }
+ },
+ "ajv": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.3.tgz",
+ "integrity": "sha1-wG9Zh3jETGsWGrr+NGa4GtGBTtI=",
+ "dev": true,
+ "requires": {
+ "co": "4.6.0",
+ "fast-deep-equal": "1.0.0",
+ "json-schema-traverse": "0.3.1",
+ "json-stable-stringify": "1.0.1"
+ }
+ },
+ "ajv-keywords": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.0.tgz",
+ "integrity": "sha1-opbhf3v658HOT34N5T0pyzIWLfA=",
+ "dev": true
+ },
+ "alphanum-sort": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz",
+ "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=",
+ "dev": true
+ },
+ "amdefine": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
+ "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
+ "dev": true
+ },
+ "ansi-align": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz",
+ "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=",
+ "dev": true,
+ "requires": {
+ "string-width": "2.1.1"
+ }
+ },
+ "ansi-escapes": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz",
+ "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==",
+ "dev": true
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
+ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
+ "dev": true
+ },
+ "anymatch": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz",
+ "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==",
+ "dev": true,
+ "requires": {
+ "micromatch": "2.3.11",
+ "normalize-path": "2.1.1"
+ }
+ },
+ "argparse": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz",
+ "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=",
+ "dev": true,
+ "requires": {
+ "sprintf-js": "1.0.3"
+ }
+ },
+ "arr-diff": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz",
+ "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=",
+ "dev": true,
+ "requires": {
+ "arr-flatten": "1.1.0"
+ }
+ },
+ "arr-flatten": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
+ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
+ "dev": true
+ },
+ "array-differ": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz",
+ "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=",
+ "dev": true
+ },
+ "array-filter": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz",
+ "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=",
+ "dev": true
+ },
+ "array-find-index": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
+ "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
+ "dev": true
+ },
+ "array-map": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz",
+ "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=",
+ "dev": true
+ },
+ "array-reduce": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz",
+ "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=",
+ "dev": true
+ },
+ "array-union": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
+ "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
+ "dev": true,
+ "requires": {
+ "array-uniq": "1.0.3"
+ }
+ },
+ "array-uniq": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
+ "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=",
+ "dev": true
+ },
+ "array-unique": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
+ "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=",
+ "dev": true
+ },
+ "arrify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
+ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",
+ "dev": true
+ },
+ "asn1": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
+ "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=",
+ "dev": true
+ },
+ "assert-plus": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
+ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
+ "dev": true
+ },
+ "async-each": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz",
+ "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=",
+ "dev": true
+ },
+ "asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
+ "dev": true
+ },
+ "autoprefixer": {
+ "version": "6.7.7",
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-6.7.7.tgz",
+ "integrity": "sha1-Hb0cg1ZY41zj+ZhAmdsAWFx4IBQ=",
+ "dev": true,
+ "requires": {
+ "browserslist": "1.7.7",
+ "caniuse-db": "1.0.30000744",
+ "normalize-range": "0.1.2",
+ "num2fraction": "1.2.2",
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ },
+ "dependencies": {
+ "browserslist": {
+ "version": "1.7.7",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-1.7.7.tgz",
+ "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
+ "dev": true,
+ "requires": {
+ "caniuse-db": "1.0.30000744",
+ "electron-to-chromium": "1.3.24"
+ }
+ }
+ }
+ },
+ "aws-sign2": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
+ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
+ "dev": true
+ },
+ "aws4": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz",
+ "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=",
+ "dev": true
+ },
+ "babel-code-frame": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
+ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3",
+ "esutils": "2.0.2",
+ "js-tokens": "3.0.2"
+ }
+ },
+ "babel-core": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz",
+ "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=",
+ "dev": true,
+ "requires": {
+ "babel-code-frame": "6.26.0",
+ "babel-generator": "6.26.0",
+ "babel-helpers": "6.24.1",
+ "babel-messages": "6.23.0",
+ "babel-register": "6.26.0",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0",
+ "babylon": "6.18.0",
+ "convert-source-map": "1.5.0",
+ "debug": "2.6.9",
+ "json5": "0.5.1",
+ "lodash": "4.17.4",
+ "minimatch": "3.0.4",
+ "path-is-absolute": "1.0.1",
+ "private": "0.1.7",
+ "slash": "1.0.0",
+ "source-map": "0.5.7"
+ }
+ },
+ "babel-generator": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz",
+ "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=",
+ "dev": true,
+ "requires": {
+ "babel-messages": "6.23.0",
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0",
+ "detect-indent": "4.0.0",
+ "jsesc": "1.3.0",
+ "lodash": "4.17.4",
+ "source-map": "0.5.7",
+ "trim-right": "1.0.1"
+ }
+ },
+ "babel-helper-builder-binary-assignment-operator-visitor": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz",
+ "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=",
+ "dev": true,
+ "requires": {
+ "babel-helper-explode-assignable-expression": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-helper-call-delegate": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz",
+ "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=",
+ "dev": true,
+ "requires": {
+ "babel-helper-hoist-variables": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-helper-define-map": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz",
+ "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=",
+ "dev": true,
+ "requires": {
+ "babel-helper-function-name": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0",
+ "lodash": "4.17.4"
+ }
+ },
+ "babel-helper-explode-assignable-expression": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz",
+ "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-helper-function-name": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz",
+ "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=",
+ "dev": true,
+ "requires": {
+ "babel-helper-get-function-arity": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-helper-get-function-arity": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz",
+ "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-helper-hoist-variables": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz",
+ "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-helper-optimise-call-expression": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz",
+ "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-helper-regex": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz",
+ "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0",
+ "lodash": "4.17.4"
+ }
+ },
+ "babel-helper-remap-async-to-generator": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz",
+ "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=",
+ "dev": true,
+ "requires": {
+ "babel-helper-function-name": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-helper-replace-supers": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz",
+ "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=",
+ "dev": true,
+ "requires": {
+ "babel-helper-optimise-call-expression": "6.24.1",
+ "babel-messages": "6.23.0",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-helpers": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz",
+ "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0"
+ }
+ },
+ "babel-messages": {
+ "version": "6.23.0",
+ "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
+ "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-check-es2015-constants": {
+ "version": "6.22.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz",
+ "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-external-helpers": {
+ "version": "6.22.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-external-helpers/-/babel-plugin-external-helpers-6.22.0.tgz",
+ "integrity": "sha1-IoX0iwK9Xe3oUXXK+MYuhq3M76E=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-syntax-async-functions": {
+ "version": "6.13.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz",
+ "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=",
+ "dev": true
+ },
+ "babel-plugin-syntax-exponentiation-operator": {
+ "version": "6.13.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz",
+ "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=",
+ "dev": true
+ },
+ "babel-plugin-syntax-trailing-function-commas": {
+ "version": "6.22.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz",
+ "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=",
+ "dev": true
+ },
+ "babel-plugin-transform-async-to-generator": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz",
+ "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=",
+ "dev": true,
+ "requires": {
+ "babel-helper-remap-async-to-generator": "6.24.1",
+ "babel-plugin-syntax-async-functions": "6.13.0",
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-arrow-functions": {
+ "version": "6.22.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz",
+ "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-block-scoped-functions": {
+ "version": "6.22.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz",
+ "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-block-scoping": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz",
+ "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0",
+ "lodash": "4.17.4"
+ }
+ },
+ "babel-plugin-transform-es2015-classes": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz",
+ "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=",
+ "dev": true,
+ "requires": {
+ "babel-helper-define-map": "6.26.0",
+ "babel-helper-function-name": "6.24.1",
+ "babel-helper-optimise-call-expression": "6.24.1",
+ "babel-helper-replace-supers": "6.24.1",
+ "babel-messages": "6.23.0",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-computed-properties": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz",
+ "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-destructuring": {
+ "version": "6.23.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz",
+ "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-duplicate-keys": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz",
+ "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-for-of": {
+ "version": "6.23.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz",
+ "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-function-name": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz",
+ "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=",
+ "dev": true,
+ "requires": {
+ "babel-helper-function-name": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-literals": {
+ "version": "6.22.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz",
+ "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-modules-amd": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz",
+ "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=",
+ "dev": true,
+ "requires": {
+ "babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-modules-commonjs": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz",
+ "integrity": "sha1-DYOUApt9xqvhqX7xgeAHWN0uXYo=",
+ "dev": true,
+ "requires": {
+ "babel-plugin-transform-strict-mode": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-modules-systemjs": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz",
+ "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=",
+ "dev": true,
+ "requires": {
+ "babel-helper-hoist-variables": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-modules-umd": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz",
+ "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=",
+ "dev": true,
+ "requires": {
+ "babel-plugin-transform-es2015-modules-amd": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-object-super": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz",
+ "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=",
+ "dev": true,
+ "requires": {
+ "babel-helper-replace-supers": "6.24.1",
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-parameters": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz",
+ "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=",
+ "dev": true,
+ "requires": {
+ "babel-helper-call-delegate": "6.24.1",
+ "babel-helper-get-function-arity": "6.24.1",
+ "babel-runtime": "6.26.0",
+ "babel-template": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-shorthand-properties": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz",
+ "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-spread": {
+ "version": "6.22.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz",
+ "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-sticky-regex": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz",
+ "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=",
+ "dev": true,
+ "requires": {
+ "babel-helper-regex": "6.26.0",
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-template-literals": {
+ "version": "6.22.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz",
+ "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-typeof-symbol": {
+ "version": "6.23.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz",
+ "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-es2015-unicode-regex": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz",
+ "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=",
+ "dev": true,
+ "requires": {
+ "babel-helper-regex": "6.26.0",
+ "babel-runtime": "6.26.0",
+ "regexpu-core": "2.0.0"
+ }
+ },
+ "babel-plugin-transform-exponentiation-operator": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz",
+ "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=",
+ "dev": true,
+ "requires": {
+ "babel-helper-builder-binary-assignment-operator-visitor": "6.24.1",
+ "babel-plugin-syntax-exponentiation-operator": "6.13.0",
+ "babel-runtime": "6.26.0"
+ }
+ },
+ "babel-plugin-transform-regenerator": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz",
+ "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=",
+ "dev": true,
+ "requires": {
+ "regenerator-transform": "0.10.1"
+ }
+ },
+ "babel-plugin-transform-strict-mode": {
+ "version": "6.24.1",
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz",
+ "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0"
+ }
+ },
+ "babel-preset-env": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz",
+ "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==",
+ "dev": true,
+ "requires": {
+ "babel-plugin-check-es2015-constants": "6.22.0",
+ "babel-plugin-syntax-trailing-function-commas": "6.22.0",
+ "babel-plugin-transform-async-to-generator": "6.24.1",
+ "babel-plugin-transform-es2015-arrow-functions": "6.22.0",
+ "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0",
+ "babel-plugin-transform-es2015-block-scoping": "6.26.0",
+ "babel-plugin-transform-es2015-classes": "6.24.1",
+ "babel-plugin-transform-es2015-computed-properties": "6.24.1",
+ "babel-plugin-transform-es2015-destructuring": "6.23.0",
+ "babel-plugin-transform-es2015-duplicate-keys": "6.24.1",
+ "babel-plugin-transform-es2015-for-of": "6.23.0",
+ "babel-plugin-transform-es2015-function-name": "6.24.1",
+ "babel-plugin-transform-es2015-literals": "6.22.0",
+ "babel-plugin-transform-es2015-modules-amd": "6.24.1",
+ "babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
+ "babel-plugin-transform-es2015-modules-systemjs": "6.24.1",
+ "babel-plugin-transform-es2015-modules-umd": "6.24.1",
+ "babel-plugin-transform-es2015-object-super": "6.24.1",
+ "babel-plugin-transform-es2015-parameters": "6.24.1",
+ "babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
+ "babel-plugin-transform-es2015-spread": "6.22.0",
+ "babel-plugin-transform-es2015-sticky-regex": "6.24.1",
+ "babel-plugin-transform-es2015-template-literals": "6.22.0",
+ "babel-plugin-transform-es2015-typeof-symbol": "6.23.0",
+ "babel-plugin-transform-es2015-unicode-regex": "6.24.1",
+ "babel-plugin-transform-exponentiation-operator": "6.24.1",
+ "babel-plugin-transform-regenerator": "6.26.0",
+ "browserslist": "2.5.0",
+ "invariant": "2.2.2",
+ "semver": "5.4.1"
+ }
+ },
+ "babel-register": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
+ "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=",
+ "dev": true,
+ "requires": {
+ "babel-core": "6.26.0",
+ "babel-runtime": "6.26.0",
+ "core-js": "2.5.1",
+ "home-or-tmp": "2.0.0",
+ "lodash": "4.17.4",
+ "mkdirp": "0.5.1",
+ "source-map-support": "0.4.18"
+ }
+ },
+ "babel-runtime": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
+ "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
+ "dev": true,
+ "requires": {
+ "core-js": "2.5.1",
+ "regenerator-runtime": "0.11.0"
+ }
+ },
+ "babel-template": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz",
+ "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-traverse": "6.26.0",
+ "babel-types": "6.26.0",
+ "babylon": "6.18.0",
+ "lodash": "4.17.4"
+ }
+ },
+ "babel-traverse": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz",
+ "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=",
+ "dev": true,
+ "requires": {
+ "babel-code-frame": "6.26.0",
+ "babel-messages": "6.23.0",
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0",
+ "babylon": "6.18.0",
+ "debug": "2.6.9",
+ "globals": "9.18.0",
+ "invariant": "2.2.2",
+ "lodash": "4.17.4"
+ }
+ },
+ "babel-types": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz",
+ "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "esutils": "2.0.2",
+ "lodash": "4.17.4",
+ "to-fast-properties": "1.0.3"
+ }
+ },
+ "babylon": {
+ "version": "6.18.0",
+ "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
+ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==",
+ "dev": true
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "dev": true
+ },
+ "bcrypt-pbkdf": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
+ "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "tweetnacl": "0.14.5"
+ }
+ },
+ "binary-extensions": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.10.0.tgz",
+ "integrity": "sha1-muuabF6IY4qtFx4Wf1kAq+JINdA=",
+ "dev": true
+ },
+ "bluebird": {
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
+ "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==",
+ "dev": true
+ },
+ "boom": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz",
+ "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=",
+ "dev": true,
+ "requires": {
+ "hoek": "4.2.0"
+ }
+ },
+ "boxen": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.2.tgz",
+ "integrity": "sha1-Px1AMsMP/qnUsCwyLq8up0HcvOU=",
+ "dev": true,
+ "requires": {
+ "ansi-align": "2.0.0",
+ "camelcase": "4.1.0",
+ "chalk": "2.3.0",
+ "cli-boxes": "1.0.0",
+ "string-width": "2.1.1",
+ "term-size": "1.2.0",
+ "widest-line": "1.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "camelcase": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
+ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
+ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.5.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
+ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "brace-expansion": {
+ "version": "1.1.8",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
+ "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
+ "dev": true,
+ "requires": {
+ "balanced-match": "1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "braces": {
+ "version": "1.8.5",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz",
+ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=",
+ "dev": true,
+ "requires": {
+ "expand-range": "1.8.2",
+ "preserve": "0.2.0",
+ "repeat-element": "1.1.2"
+ }
+ },
+ "browserslist": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.0.tgz",
+ "integrity": "sha512-6Vw1LIigGw8zCK0gxczksUMZlO+oPUwBazAztMmFL/F8D5wB0qCuxRJGYgYM3JzaO0v2ZMRIg+nnnOgNsPGHeA==",
+ "dev": true,
+ "requires": {
+ "caniuse-lite": "1.0.30000744",
+ "electron-to-chromium": "1.3.24"
+ }
+ },
+ "builtin-modules": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
+ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
+ "dev": true
+ },
+ "caller-path": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz",
+ "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=",
+ "dev": true,
+ "requires": {
+ "callsites": "0.2.0"
+ }
+ },
+ "callsites": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz",
+ "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=",
+ "dev": true
+ },
+ "camelcase": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz",
+ "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=",
+ "dev": true
+ },
+ "camelcase-keys": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
+ "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=",
+ "dev": true,
+ "requires": {
+ "camelcase": "2.1.1",
+ "map-obj": "1.0.1"
+ }
+ },
+ "caniuse-api": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-1.6.1.tgz",
+ "integrity": "sha1-tTTnxzTE+B7F++isoq0kNUuWLGw=",
+ "dev": true,
+ "requires": {
+ "browserslist": "1.7.7",
+ "caniuse-db": "1.0.30000744",
+ "lodash.memoize": "4.1.2",
+ "lodash.uniq": "4.5.0"
+ },
+ "dependencies": {
+ "browserslist": {
+ "version": "1.7.7",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-1.7.7.tgz",
+ "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
+ "dev": true,
+ "requires": {
+ "caniuse-db": "1.0.30000744",
+ "electron-to-chromium": "1.3.24"
+ }
+ }
+ }
+ },
+ "caniuse-db": {
+ "version": "1.0.30000744",
+ "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000744.tgz",
+ "integrity": "sha1-AHWP991fcTjTShVgjcz3Glllb/4=",
+ "dev": true
+ },
+ "caniuse-lite": {
+ "version": "1.0.30000744",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000744.tgz",
+ "integrity": "sha1-hg+lyDujT+YZOX1gfzC7R0ghZxs=",
+ "dev": true
+ },
+ "capture-stack-trace": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz",
+ "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=",
+ "dev": true
+ },
+ "caseless": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
+ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "2.2.1",
+ "escape-string-regexp": "1.0.5",
+ "has-ansi": "2.0.0",
+ "strip-ansi": "3.0.1",
+ "supports-color": "2.0.0"
+ }
+ },
+ "chardet": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz",
+ "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=",
+ "dev": true
+ },
+ "chokidar": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz",
+ "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=",
+ "dev": true,
+ "requires": {
+ "anymatch": "1.3.2",
+ "async-each": "1.0.1",
+ "glob-parent": "2.0.0",
+ "inherits": "2.0.3",
+ "is-binary-path": "1.0.1",
+ "is-glob": "2.0.1",
+ "path-is-absolute": "1.0.1",
+ "readdirp": "2.1.0"
+ }
+ },
+ "circular-json": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",
+ "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==",
+ "dev": true
+ },
+ "clap": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/clap/-/clap-1.2.3.tgz",
+ "integrity": "sha512-4CoL/A3hf90V3VIEjeuhSvlGFEHKzOz+Wfc2IVZc+FaUgU0ZQafJTP49fvnULipOPcAfqhyI2duwQyns6xqjYA==",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3"
+ }
+ },
+ "cli-boxes": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz",
+ "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=",
+ "dev": true
+ },
+ "cli-cursor": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
+ "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
+ "dev": true,
+ "requires": {
+ "restore-cursor": "2.0.0"
+ }
+ },
+ "cli-spinners": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-1.1.0.tgz",
+ "integrity": "sha1-8YR7FohE2RemceudFH499JfJDQY=",
+ "dev": true
+ },
+ "cli-width": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
+ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",
+ "dev": true
+ },
+ "cliui": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
+ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
+ "dev": true,
+ "requires": {
+ "string-width": "1.0.2",
+ "strip-ansi": "3.0.1",
+ "wrap-ansi": "2.1.0"
+ },
+ "dependencies": {
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "dev": true,
+ "requires": {
+ "number-is-nan": "1.0.1"
+ }
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "dev": true,
+ "requires": {
+ "code-point-at": "1.1.0",
+ "is-fullwidth-code-point": "1.0.0",
+ "strip-ansi": "3.0.1"
+ }
+ }
+ }
+ },
+ "clone": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz",
+ "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=",
+ "dev": true
+ },
+ "clone-regexp": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-1.0.0.tgz",
+ "integrity": "sha1-6uCiQT9VwJQvgYwin+/OhF1/Oxw=",
+ "dev": true,
+ "requires": {
+ "is-regexp": "1.0.0",
+ "is-supported-regexp-flag": "1.0.0"
+ }
+ },
+ "co": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
+ "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
+ "dev": true
+ },
+ "coa": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/coa/-/coa-1.0.4.tgz",
+ "integrity": "sha1-qe8VNmDWqGqL3sAomlxoTSF0Mv0=",
+ "dev": true,
+ "requires": {
+ "q": "1.5.0"
+ }
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+ "dev": true
+ },
+ "color": {
+ "version": "0.11.4",
+ "resolved": "https://registry.npmjs.org/color/-/color-0.11.4.tgz",
+ "integrity": "sha1-bXtcdPtl6EHNSHkq0e1eB7kE12Q=",
+ "dev": true,
+ "requires": {
+ "clone": "1.0.2",
+ "color-convert": "1.9.0",
+ "color-string": "0.3.0"
+ }
+ },
+ "color-convert": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz",
+ "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-diff": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/color-diff/-/color-diff-0.1.7.tgz",
+ "integrity": "sha1-bbeM2UgqjkWdQIIer0tQMoPcuOI=",
+ "dev": true
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
+ "dev": true
+ },
+ "color-string": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-0.3.0.tgz",
+ "integrity": "sha1-J9RvtnAlxcL6JZk7+/V55HhBuZE=",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "colorguard": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/colorguard/-/colorguard-1.2.0.tgz",
+ "integrity": "sha1-8/rK9cquuk71RlPZ+yW7cxd8DYQ=",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3",
+ "color-diff": "0.1.7",
+ "log-symbols": "1.0.2",
+ "object-assign": "4.1.1",
+ "pipetteur": "2.0.3",
+ "plur": "2.1.2",
+ "postcss": "5.2.18",
+ "postcss-reporter": "1.4.1",
+ "text-table": "0.2.0",
+ "yargs": "1.3.3"
+ },
+ "dependencies": {
+ "postcss-reporter": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-1.4.1.tgz",
+ "integrity": "sha1-wTbwpbFhkV83ndN2XGEHX357mvI=",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3",
+ "lodash": "4.17.4",
+ "log-symbols": "1.0.2",
+ "postcss": "5.2.18"
+ }
+ },
+ "yargs": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-1.3.3.tgz",
+ "integrity": "sha1-BU3oth8i7v23IHBZ6u+da4P7kxo=",
+ "dev": true
+ }
+ }
+ },
+ "colormin": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/colormin/-/colormin-1.1.2.tgz",
+ "integrity": "sha1-6i90IKcrlogaOKrlnsEkpvcpgTM=",
+ "dev": true,
+ "requires": {
+ "color": "0.11.4",
+ "css-color-names": "0.0.4",
+ "has": "1.0.1"
+ }
+ },
+ "colors": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz",
+ "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=",
+ "dev": true
+ },
+ "combined-stream": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz",
+ "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=",
+ "dev": true,
+ "requires": {
+ "delayed-stream": "1.0.0"
+ }
+ },
+ "commander": {
+ "version": "2.11.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
+ "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==",
+ "dev": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+ "dev": true
+ },
+ "concat-stream": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz",
+ "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=",
+ "dev": true,
+ "requires": {
+ "inherits": "2.0.3",
+ "readable-stream": "2.3.3",
+ "typedarray": "0.0.6"
+ }
+ },
+ "configstore": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz",
+ "integrity": "sha512-5oNkD/L++l0O6xGXxb1EWS7SivtjfGQlRyxJsYgE0Z495/L81e2h4/d3r969hoPXuFItzNOKMtsXgYG4c7dYvw==",
+ "dev": true,
+ "requires": {
+ "dot-prop": "4.2.0",
+ "graceful-fs": "4.1.11",
+ "make-dir": "1.1.0",
+ "unique-string": "1.0.0",
+ "write-file-atomic": "2.3.0",
+ "xdg-basedir": "3.0.0"
+ }
+ },
+ "contains-path": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz",
+ "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=",
+ "dev": true
+ },
+ "convert-source-map": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz",
+ "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=",
+ "dev": true
+ },
+ "core-js": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
+ "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=",
+ "dev": true
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
+ "dev": true
+ },
+ "cosmiconfig": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-2.2.2.tgz",
+ "integrity": "sha512-GiNXLwAFPYHy25XmTPpafYvn3CLAkJ8FLsscq78MQd1Kh0OU6Yzhn4eV2MVF4G9WEQZoWEGltatdR+ntGPMl5A==",
+ "dev": true,
+ "requires": {
+ "is-directory": "0.3.1",
+ "js-yaml": "3.7.0",
+ "minimist": "1.2.0",
+ "object-assign": "4.1.1",
+ "os-homedir": "1.0.2",
+ "parse-json": "2.2.0",
+ "require-from-string": "1.2.1"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ }
+ }
+ },
+ "cp-file": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-3.2.0.tgz",
+ "integrity": "sha1-b4NhYlRiTwrViqSqjQdvAmvn4Yg=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "mkdirp": "0.5.1",
+ "nested-error-stacks": "1.0.2",
+ "object-assign": "4.1.1",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1",
+ "readable-stream": "2.3.3"
+ }
+ },
+ "cpy": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/cpy/-/cpy-4.0.1.tgz",
+ "integrity": "sha1-tnJn66LzlgugalphrJQDNCKDNCQ=",
+ "dev": true,
+ "requires": {
+ "cp-file": "3.2.0",
+ "globby": "4.1.0",
+ "meow": "3.7.0",
+ "nested-error-stacks": "1.0.2",
+ "object-assign": "4.1.1",
+ "pinkie-promise": "2.0.1"
+ }
+ },
+ "cpy-cli": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/cpy-cli/-/cpy-cli-1.0.1.tgz",
+ "integrity": "sha1-Z/taSi3sKMqKv/N13kuecfanVhw=",
+ "dev": true,
+ "requires": {
+ "cpy": "4.0.1",
+ "meow": "3.7.0"
+ }
+ },
+ "create-error-class": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz",
+ "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=",
+ "dev": true,
+ "requires": {
+ "capture-stack-trace": "1.0.0"
+ }
+ },
+ "cross-spawn": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
+ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
+ "dev": true,
+ "requires": {
+ "lru-cache": "4.1.1",
+ "shebang-command": "1.2.0",
+ "which": "1.3.0"
+ }
+ },
+ "cryptiles": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz",
+ "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=",
+ "dev": true,
+ "requires": {
+ "boom": "5.2.0"
+ },
+ "dependencies": {
+ "boom": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz",
+ "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==",
+ "dev": true,
+ "requires": {
+ "hoek": "4.2.0"
+ }
+ }
+ }
+ },
+ "crypto-random-string": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz",
+ "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=",
+ "dev": true
+ },
+ "css-color-function": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/css-color-function/-/css-color-function-1.3.3.tgz",
+ "integrity": "sha1-jtJMLAIFBzM5+voAS8jBQfzLKC4=",
+ "dev": true,
+ "requires": {
+ "balanced-match": "0.1.0",
+ "color": "0.11.4",
+ "debug": "3.1.0",
+ "rgb": "0.1.0"
+ },
+ "dependencies": {
+ "balanced-match": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.1.0.tgz",
+ "integrity": "sha1-tQS9BYabOSWd0MXvw12EMXbczEo=",
+ "dev": true
+ },
+ "debug": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ }
+ }
+ },
+ "css-color-list": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/css-color-list/-/css-color-list-0.0.1.tgz",
+ "integrity": "sha1-hxjoaVrnosyHh76HFfHACKfyixU=",
+ "dev": true,
+ "requires": {
+ "css-color-names": "0.0.1"
+ },
+ "dependencies": {
+ "css-color-names": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.1.tgz",
+ "integrity": "sha1-XQVI+iVkVu3kqaDCrHqxnT6xrYE=",
+ "dev": true
+ }
+ }
+ },
+ "css-color-names": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
+ "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=",
+ "dev": true
+ },
+ "css-rule-stream": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/css-rule-stream/-/css-rule-stream-1.1.0.tgz",
+ "integrity": "sha1-N4bnGYmD2WWibjGVfgkHjLt3BaI=",
+ "dev": true,
+ "requires": {
+ "css-tokenize": "1.0.1",
+ "duplexer2": "0.0.2",
+ "ldjson-stream": "1.2.1",
+ "through2": "0.6.5"
+ }
+ },
+ "css-tokenize": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/css-tokenize/-/css-tokenize-1.0.1.tgz",
+ "integrity": "sha1-RiXLHtohwUOFi3+B1oA8HSb8FL4=",
+ "dev": true,
+ "requires": {
+ "inherits": "2.0.3",
+ "readable-stream": "1.1.14"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "1.1.14",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
+ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
+ "dev": true,
+ "requires": {
+ "core-util-is": "1.0.2",
+ "inherits": "2.0.3",
+ "isarray": "0.0.1",
+ "string_decoder": "0.10.31"
+ }
+ },
+ "string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
+ "dev": true
+ }
+ }
+ },
+ "css-unit-converter": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.1.tgz",
+ "integrity": "sha1-2bkoGtz9jO2TW9urqDeGiX9k6ZY=",
+ "dev": true
+ },
+ "cssnano": {
+ "version": "3.10.0",
+ "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-3.10.0.tgz",
+ "integrity": "sha1-Tzj2zqK5sX+gFJDyPx3GjqZcHDg=",
+ "dev": true,
+ "requires": {
+ "autoprefixer": "6.7.7",
+ "decamelize": "1.2.0",
+ "defined": "1.0.0",
+ "has": "1.0.1",
+ "object-assign": "4.1.1",
+ "postcss": "5.2.18",
+ "postcss-calc": "5.3.1",
+ "postcss-colormin": "2.2.2",
+ "postcss-convert-values": "2.6.1",
+ "postcss-discard-comments": "2.0.4",
+ "postcss-discard-duplicates": "2.1.0",
+ "postcss-discard-empty": "2.1.0",
+ "postcss-discard-overridden": "0.1.1",
+ "postcss-discard-unused": "2.2.3",
+ "postcss-filter-plugins": "2.0.2",
+ "postcss-merge-idents": "2.1.7",
+ "postcss-merge-longhand": "2.0.2",
+ "postcss-merge-rules": "2.1.2",
+ "postcss-minify-font-values": "1.0.5",
+ "postcss-minify-gradients": "1.0.5",
+ "postcss-minify-params": "1.2.2",
+ "postcss-minify-selectors": "2.1.1",
+ "postcss-normalize-charset": "1.1.1",
+ "postcss-normalize-url": "3.0.8",
+ "postcss-ordered-values": "2.2.3",
+ "postcss-reduce-idents": "2.4.0",
+ "postcss-reduce-initial": "1.0.1",
+ "postcss-reduce-transforms": "1.0.4",
+ "postcss-svgo": "2.1.6",
+ "postcss-unique-selectors": "2.0.2",
+ "postcss-value-parser": "3.3.0",
+ "postcss-zindex": "2.2.0"
+ }
+ },
+ "csso": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/csso/-/csso-2.3.2.tgz",
+ "integrity": "sha1-3dUsWHAz9J6Utx/FVWnyUuj/X4U=",
+ "dev": true,
+ "requires": {
+ "clap": "1.2.3",
+ "source-map": "0.5.7"
+ }
+ },
+ "cuint": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz",
+ "integrity": "sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs=",
+ "dev": true
+ },
+ "currently-unhandled": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
+ "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=",
+ "dev": true,
+ "requires": {
+ "array-find-index": "1.0.2"
+ }
+ },
+ "dashdash": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
+ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "1.0.0"
+ }
+ },
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
+ "dev": true
+ },
+ "deep-extend": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz",
+ "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=",
+ "dev": true
+ },
+ "deep-is": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
+ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
+ "dev": true
+ },
+ "define-properties": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz",
+ "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=",
+ "dev": true,
+ "requires": {
+ "foreach": "2.0.5",
+ "object-keys": "1.0.11"
+ }
+ },
+ "defined": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz",
+ "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=",
+ "dev": true
+ },
+ "del": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz",
+ "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=",
+ "dev": true,
+ "requires": {
+ "globby": "5.0.0",
+ "is-path-cwd": "1.0.0",
+ "is-path-in-cwd": "1.0.0",
+ "object-assign": "4.1.1",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1",
+ "rimraf": "2.6.2"
+ },
+ "dependencies": {
+ "glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "1.0.0",
+ "inflight": "1.0.6",
+ "inherits": "2.0.3",
+ "minimatch": "3.0.4",
+ "once": "1.4.0",
+ "path-is-absolute": "1.0.1"
+ }
+ },
+ "globby": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz",
+ "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=",
+ "dev": true,
+ "requires": {
+ "array-union": "1.0.2",
+ "arrify": "1.0.1",
+ "glob": "7.1.2",
+ "object-assign": "4.1.1",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1"
+ }
+ }
+ }
+ },
+ "del-cli": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/del-cli/-/del-cli-1.1.0.tgz",
+ "integrity": "sha1-J1V9aaC335ncuqHjSgnmrGWR0sQ=",
+ "dev": true,
+ "requires": {
+ "del": "3.0.0",
+ "meow": "3.7.0",
+ "update-notifier": "2.3.0"
+ },
+ "dependencies": {
+ "del": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz",
+ "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=",
+ "dev": true,
+ "requires": {
+ "globby": "6.1.0",
+ "is-path-cwd": "1.0.0",
+ "is-path-in-cwd": "1.0.0",
+ "p-map": "1.2.0",
+ "pify": "3.0.0",
+ "rimraf": "2.6.2"
+ }
+ },
+ "glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "1.0.0",
+ "inflight": "1.0.6",
+ "inherits": "2.0.3",
+ "minimatch": "3.0.4",
+ "once": "1.4.0",
+ "path-is-absolute": "1.0.1"
+ }
+ },
+ "globby": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
+ "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
+ "dev": true,
+ "requires": {
+ "array-union": "1.0.2",
+ "glob": "7.1.2",
+ "object-assign": "4.1.1",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ }
+ }
+ },
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true
+ }
+ }
+ },
+ "delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
+ "dev": true
+ },
+ "dependency-graph": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.5.1.tgz",
+ "integrity": "sha512-nk3OjiI68T3876/tsm4Hm57ye7zc4Kl87hkcALBMCuSrN1q1NvuY5HCnSSkoJjGdrMo5gmu0WTN2cV/D76q/mw==",
+ "dev": true
+ },
+ "detect-indent": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz",
+ "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=",
+ "dev": true,
+ "requires": {
+ "repeating": "2.0.1"
+ }
+ },
+ "diff": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz",
+ "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==",
+ "dev": true
+ },
+ "doctrine": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.2.tgz",
+ "integrity": "sha512-y0tm5Pq6ywp3qSTZ1vPgVdAnbDEoeoc5wlOHXoY1c4Wug/a7JvqHIl7BTvwodaHmejWkK/9dSb3sCYfyo/om8A==",
+ "dev": true,
+ "requires": {
+ "esutils": "2.0.2"
+ }
+ },
+ "doiuse": {
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/doiuse/-/doiuse-2.6.0.tgz",
+ "integrity": "sha1-GJLRC2Gpo1at2/K2FJM+gfi7ODQ=",
+ "dev": true,
+ "requires": {
+ "browserslist": "1.7.7",
+ "caniuse-db": "1.0.30000744",
+ "css-rule-stream": "1.1.0",
+ "duplexer2": "0.0.2",
+ "jsonfilter": "1.1.2",
+ "ldjson-stream": "1.2.1",
+ "lodash": "4.17.4",
+ "multimatch": "2.1.0",
+ "postcss": "5.2.18",
+ "source-map": "0.4.4",
+ "through2": "0.6.5",
+ "yargs": "3.32.0"
+ },
+ "dependencies": {
+ "browserslist": {
+ "version": "1.7.7",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-1.7.7.tgz",
+ "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
+ "dev": true,
+ "requires": {
+ "caniuse-db": "1.0.30000744",
+ "electron-to-chromium": "1.3.24"
+ }
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "dev": true,
+ "requires": {
+ "number-is-nan": "1.0.1"
+ }
+ },
+ "os-locale": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
+ "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
+ "dev": true,
+ "requires": {
+ "lcid": "1.0.0"
+ }
+ },
+ "source-map": {
+ "version": "0.4.4",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
+ "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=",
+ "dev": true,
+ "requires": {
+ "amdefine": "1.0.1"
+ }
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "dev": true,
+ "requires": {
+ "code-point-at": "1.1.0",
+ "is-fullwidth-code-point": "1.0.0",
+ "strip-ansi": "3.0.1"
+ }
+ },
+ "yargs": {
+ "version": "3.32.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz",
+ "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=",
+ "dev": true,
+ "requires": {
+ "camelcase": "2.1.1",
+ "cliui": "3.2.0",
+ "decamelize": "1.2.0",
+ "os-locale": "1.4.0",
+ "string-width": "1.0.2",
+ "window-size": "0.1.4",
+ "y18n": "3.2.1"
+ }
+ }
+ }
+ },
+ "dot-prop": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz",
+ "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==",
+ "dev": true,
+ "requires": {
+ "is-obj": "1.0.1"
+ }
+ },
+ "duplexer": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
+ "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
+ "dev": true
+ },
+ "duplexer2": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz",
+ "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=",
+ "dev": true,
+ "requires": {
+ "readable-stream": "1.1.14"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "1.1.14",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
+ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
+ "dev": true,
+ "requires": {
+ "core-util-is": "1.0.2",
+ "inherits": "2.0.3",
+ "isarray": "0.0.1",
+ "string_decoder": "0.10.31"
+ }
+ },
+ "string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
+ "dev": true
+ }
+ }
+ },
+ "duplexer3": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
+ "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=",
+ "dev": true
+ },
+ "ecc-jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
+ "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "jsbn": "0.1.1"
+ }
+ },
+ "editorconfig": {
+ "version": "0.13.3",
+ "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.13.3.tgz",
+ "integrity": "sha512-WkjsUNVCu+ITKDj73QDvi0trvpdDWdkDyHybDGSXPfekLCqwmpD7CP7iPbvBgosNuLcI96XTDwNa75JyFl7tEQ==",
+ "dev": true,
+ "requires": {
+ "bluebird": "3.5.1",
+ "commander": "2.11.0",
+ "lru-cache": "3.2.0",
+ "semver": "5.4.1",
+ "sigmund": "1.0.1"
+ },
+ "dependencies": {
+ "lru-cache": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz",
+ "integrity": "sha1-cXibO39Tmb7IVl3aOKow0qCX7+4=",
+ "dev": true,
+ "requires": {
+ "pseudomap": "1.0.2"
+ }
+ }
+ }
+ },
+ "electron-to-chromium": {
+ "version": "1.3.24",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.24.tgz",
+ "integrity": "sha1-m3uIuwXOufoBahd4M8wt3jiPIbY=",
+ "dev": true
+ },
+ "error-ex": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz",
+ "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "0.2.1"
+ }
+ },
+ "es-abstract": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.9.0.tgz",
+ "integrity": "sha512-kk3IJoKo7A3pWJc0OV8yZ/VEX2oSUytfekrJiqoxBlKJMFAJVJVpGdHClCCTdv+Fn2zHfpDHHIelMFhZVfef3Q==",
+ "dev": true,
+ "requires": {
+ "es-to-primitive": "1.1.1",
+ "function-bind": "1.1.1",
+ "has": "1.0.1",
+ "is-callable": "1.1.3",
+ "is-regex": "1.0.4"
+ }
+ },
+ "es-to-primitive": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz",
+ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=",
+ "dev": true,
+ "requires": {
+ "is-callable": "1.1.3",
+ "is-date-object": "1.0.1",
+ "is-symbol": "1.0.1"
+ }
+ },
+ "es6-promise": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz",
+ "integrity": "sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng==",
+ "dev": true
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true
+ },
+ "eslint": {
+ "version": "4.14.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.14.0.tgz",
+ "integrity": "sha512-Ul6CSGRjKscEyg0X/EeNs7o2XdnbTEOD1OM8cTjmx85RPcBJQrEhZLevhuJZNAE/vS2iVl5Uhgiqf3h5uLMCJQ==",
+ "dev": true,
+ "requires": {
+ "ajv": "5.5.2",
+ "babel-code-frame": "6.26.0",
+ "chalk": "2.3.0",
+ "concat-stream": "1.6.0",
+ "cross-spawn": "5.1.0",
+ "debug": "3.1.0",
+ "doctrine": "2.0.2",
+ "eslint-scope": "3.7.1",
+ "eslint-visitor-keys": "1.0.0",
+ "espree": "3.5.2",
+ "esquery": "1.0.0",
+ "esutils": "2.0.2",
+ "file-entry-cache": "2.0.0",
+ "functional-red-black-tree": "1.0.1",
+ "glob": "7.1.2",
+ "globals": "11.1.0",
+ "ignore": "3.3.5",
+ "imurmurhash": "0.1.4",
+ "inquirer": "3.3.0",
+ "is-resolvable": "1.0.1",
+ "js-yaml": "3.10.0",
+ "json-stable-stringify-without-jsonify": "1.0.1",
+ "levn": "0.3.0",
+ "lodash": "4.17.4",
+ "minimatch": "3.0.4",
+ "mkdirp": "0.5.1",
+ "natural-compare": "1.4.0",
+ "optionator": "0.8.2",
+ "path-is-inside": "1.0.2",
+ "pluralize": "7.0.0",
+ "progress": "2.0.0",
+ "require-uncached": "1.0.3",
+ "semver": "5.4.1",
+ "strip-ansi": "4.0.0",
+ "strip-json-comments": "2.0.1",
+ "table": "4.0.2",
+ "text-table": "0.2.0"
+ },
+ "dependencies": {
+ "ajv": {
+ "version": "5.5.2",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
+ "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
+ "dev": true,
+ "requires": {
+ "co": "4.6.0",
+ "fast-deep-equal": "1.0.0",
+ "fast-json-stable-stringify": "2.0.0",
+ "json-schema-traverse": "0.3.1"
+ }
+ },
+ "ansi-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
+ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
+ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.5.0"
+ }
+ },
+ "debug": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "esprima": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
+ "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
+ "dev": true
+ },
+ "glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "1.0.0",
+ "inflight": "1.0.6",
+ "inherits": "2.0.3",
+ "minimatch": "3.0.4",
+ "once": "1.4.0",
+ "path-is-absolute": "1.0.1"
+ }
+ },
+ "globals": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.1.0.tgz",
+ "integrity": "sha512-uEuWt9mqTlPDwSqi+sHjD4nWU/1N+q0fiWI9T1mZpD2UENqX20CFD5T/ziLZvztPaBKl7ZylUi1q6Qfm7E2CiQ==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "js-yaml": {
+ "version": "3.10.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz",
+ "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==",
+ "dev": true,
+ "requires": {
+ "argparse": "1.0.9",
+ "esprima": "4.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
+ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "3.0.0"
+ }
+ },
+ "supports-color": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
+ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "eslint-config-airbnb-base": {
+ "version": "12.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-12.1.0.tgz",
+ "integrity": "sha512-/vjm0Px5ZCpmJqnjIzcFb9TKZrKWz0gnuG/7Gfkt0Db1ELJR51xkZth+t14rYdqWgX836XbuxtArbIHlVhbLBA==",
+ "dev": true,
+ "requires": {
+ "eslint-restricted-globals": "0.1.1"
+ }
+ },
+ "eslint-import-resolver-node": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz",
+ "integrity": "sha512-yUtXS15gIcij68NmXmP9Ni77AQuCN0itXbCc/jWd8C6/yKZaSNXicpC8cgvjnxVdmfsosIXrjpzFq7GcDryb6A==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "resolve": "1.4.0"
+ }
+ },
+ "eslint-module-utils": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz",
+ "integrity": "sha512-jDI/X5l/6D1rRD/3T43q8Qgbls2nq5km5KSqiwlyUbGo5+04fXhMKdCPhjwbqAa6HXWaMxj8Q4hQDIh7IadJQw==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "pkg-dir": "1.0.0"
+ }
+ },
+ "eslint-plugin-import": {
+ "version": "2.8.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz",
+ "integrity": "sha512-Rf7dfKJxZ16QuTgVv1OYNxkZcsu/hULFnC+e+w0Gzi6jMC3guQoWQgxYxc54IDRinlb6/0v5z/PxxIKmVctN+g==",
+ "dev": true,
+ "requires": {
+ "builtin-modules": "1.1.1",
+ "contains-path": "0.1.0",
+ "debug": "2.6.9",
+ "doctrine": "1.5.0",
+ "eslint-import-resolver-node": "0.3.1",
+ "eslint-module-utils": "2.1.1",
+ "has": "1.0.1",
+ "lodash.cond": "4.5.2",
+ "minimatch": "3.0.4",
+ "read-pkg-up": "2.0.0"
+ },
+ "dependencies": {
+ "doctrine": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz",
+ "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=",
+ "dev": true,
+ "requires": {
+ "esutils": "2.0.2",
+ "isarray": "1.0.0"
+ }
+ },
+ "find-up": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
+ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
+ "dev": true,
+ "requires": {
+ "locate-path": "2.0.0"
+ }
+ },
+ "load-json-file": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
+ "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "parse-json": "2.2.0",
+ "pify": "2.3.0",
+ "strip-bom": "3.0.0"
+ }
+ },
+ "path-type": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
+ "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
+ "dev": true,
+ "requires": {
+ "pify": "2.3.0"
+ }
+ },
+ "read-pkg": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
+ "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "2.0.0",
+ "normalize-package-data": "2.4.0",
+ "path-type": "2.0.0"
+ }
+ },
+ "read-pkg-up": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
+ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
+ "dev": true,
+ "requires": {
+ "find-up": "2.1.0",
+ "read-pkg": "2.0.0"
+ }
+ },
+ "strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
+ "dev": true
+ }
+ }
+ },
+ "eslint-restricted-globals": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz",
+ "integrity": "sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc=",
+ "dev": true
+ },
+ "eslint-scope": {
+ "version": "3.7.1",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz",
+ "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=",
+ "dev": true,
+ "requires": {
+ "esrecurse": "4.2.0",
+ "estraverse": "4.2.0"
+ }
+ },
+ "eslint-visitor-keys": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
+ "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==",
+ "dev": true
+ },
+ "espree": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.2.tgz",
+ "integrity": "sha512-sadKeYwaR/aJ3stC2CdvgXu1T16TdYN+qwCpcWbMnGJ8s0zNWemzrvb2GbD4OhmJ/fwpJjudThAlLobGbWZbCQ==",
+ "dev": true,
+ "requires": {
+ "acorn": "5.3.0",
+ "acorn-jsx": "3.0.1"
+ }
+ },
+ "esprima": {
+ "version": "2.7.3",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz",
+ "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=",
+ "dev": true
+ },
+ "esquery": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz",
+ "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=",
+ "dev": true,
+ "requires": {
+ "estraverse": "4.2.0"
+ }
+ },
+ "esrecurse": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz",
+ "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=",
+ "dev": true,
+ "requires": {
+ "estraverse": "4.2.0",
+ "object-assign": "4.1.1"
+ }
+ },
+ "estraverse": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",
+ "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=",
+ "dev": true
+ },
+ "estree-walker": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.2.1.tgz",
+ "integrity": "sha1-va/oCVOD2EFNXcLs9MkXO225QS4=",
+ "dev": true
+ },
+ "esutils": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
+ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
+ "dev": true
+ },
+ "event-stream": {
+ "version": "3.3.4",
+ "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",
+ "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=",
+ "dev": true,
+ "requires": {
+ "duplexer": "0.1.1",
+ "from": "0.1.7",
+ "map-stream": "0.1.0",
+ "pause-stream": "0.0.11",
+ "split": "0.3.3",
+ "stream-combiner": "0.0.4",
+ "through": "2.3.8"
+ }
+ },
+ "execa": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",
+ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=",
+ "dev": true,
+ "requires": {
+ "cross-spawn": "5.1.0",
+ "get-stream": "3.0.0",
+ "is-stream": "1.1.0",
+ "npm-run-path": "2.0.2",
+ "p-finally": "1.0.0",
+ "signal-exit": "3.0.2",
+ "strip-eof": "1.0.0"
+ }
+ },
+ "execall": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/execall/-/execall-1.0.0.tgz",
+ "integrity": "sha1-c9CQTjlbPKsGWLCNCewlMH8pu3M=",
+ "dev": true,
+ "requires": {
+ "clone-regexp": "1.0.0"
+ }
+ },
+ "expand-brackets": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz",
+ "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=",
+ "dev": true,
+ "requires": {
+ "is-posix-bracket": "0.1.1"
+ }
+ },
+ "expand-range": {
+ "version": "1.8.2",
+ "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz",
+ "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=",
+ "dev": true,
+ "requires": {
+ "fill-range": "2.2.3"
+ }
+ },
+ "extend": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
+ "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=",
+ "dev": true
+ },
+ "external-editor": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.1.0.tgz",
+ "integrity": "sha512-E44iT5QVOUJBKij4IIV3uvxuNlbKS38Tw1HiupxEIHPv9qtC2PrDYohbXV5U+1jnfIXttny8gUhj+oZvflFlzA==",
+ "dev": true,
+ "requires": {
+ "chardet": "0.4.2",
+ "iconv-lite": "0.4.19",
+ "tmp": "0.0.33"
+ }
+ },
+ "extglob": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz",
+ "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=",
+ "dev": true,
+ "requires": {
+ "is-extglob": "1.0.0"
+ }
+ },
+ "extract-zip": {
+ "version": "1.6.6",
+ "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz",
+ "integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=",
+ "dev": true,
+ "requires": {
+ "concat-stream": "1.6.0",
+ "debug": "2.6.9",
+ "mkdirp": "0.5.0",
+ "yauzl": "2.4.1"
+ },
+ "dependencies": {
+ "mkdirp": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz",
+ "integrity": "sha1-HXMHam35hs2TROFecfzAWkyavxI=",
+ "dev": true,
+ "requires": {
+ "minimist": "0.0.8"
+ }
+ }
+ }
+ },
+ "extsprintf": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
+ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
+ "dev": true
+ },
+ "fast-deep-equal": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
+ "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=",
+ "dev": true
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
+ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
+ "dev": true
+ },
+ "fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
+ "dev": true
+ },
+ "fd-slicer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz",
+ "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=",
+ "dev": true,
+ "requires": {
+ "pend": "1.2.0"
+ }
+ },
+ "figures": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
+ "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
+ "dev": true,
+ "requires": {
+ "escape-string-regexp": "1.0.5"
+ }
+ },
+ "file-entry-cache": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",
+ "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=",
+ "dev": true,
+ "requires": {
+ "flat-cache": "1.3.0",
+ "object-assign": "4.1.1"
+ }
+ },
+ "filename-regex": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz",
+ "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=",
+ "dev": true
+ },
+ "fill-range": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz",
+ "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=",
+ "dev": true,
+ "requires": {
+ "is-number": "2.1.0",
+ "isobject": "2.1.0",
+ "randomatic": "1.1.7",
+ "repeat-element": "1.1.2",
+ "repeat-string": "1.6.1"
+ }
+ },
+ "find-up": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
+ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
+ "dev": true,
+ "requires": {
+ "path-exists": "2.1.0",
+ "pinkie-promise": "2.0.1"
+ }
+ },
+ "flat-cache": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz",
+ "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=",
+ "dev": true,
+ "requires": {
+ "circular-json": "0.3.3",
+ "del": "2.2.2",
+ "graceful-fs": "4.1.11",
+ "write": "0.2.1"
+ }
+ },
+ "flatten": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz",
+ "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=",
+ "dev": true
+ },
+ "for-in": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
+ "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=",
+ "dev": true
+ },
+ "for-own": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz",
+ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=",
+ "dev": true,
+ "requires": {
+ "for-in": "1.0.2"
+ }
+ },
+ "foreach": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
+ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=",
+ "dev": true
+ },
+ "forever-agent": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
+ "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
+ "dev": true
+ },
+ "form-data": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz",
+ "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=",
+ "dev": true,
+ "requires": {
+ "asynckit": "0.4.0",
+ "combined-stream": "1.0.5",
+ "mime-types": "2.1.17"
+ }
+ },
+ "from": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
+ "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
+ "dev": true
+ },
+ "fs-extra": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
+ "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "jsonfile": "2.4.0",
+ "klaw": "1.3.1"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+ "dev": true
+ },
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
+ "dev": true
+ },
+ "functional-red-black-tree": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
+ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
+ "dev": true
+ },
+ "gather-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/gather-stream/-/gather-stream-1.0.0.tgz",
+ "integrity": "sha1-szmUr0V6gRVwDUEPMXczy+egkEs=",
+ "dev": true
+ },
+ "get-caller-file": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz",
+ "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=",
+ "dev": true
+ },
+ "get-stdin": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
+ "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=",
+ "dev": true
+ },
+ "get-stream": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
+ "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
+ "dev": true
+ },
+ "getpass": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
+ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "1.0.0"
+ }
+ },
+ "glob": {
+ "version": "6.0.4",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
+ "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
+ "dev": true,
+ "requires": {
+ "inflight": "1.0.6",
+ "inherits": "2.0.3",
+ "minimatch": "3.0.4",
+ "once": "1.4.0",
+ "path-is-absolute": "1.0.1"
+ }
+ },
+ "glob-base": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz",
+ "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=",
+ "dev": true,
+ "requires": {
+ "glob-parent": "2.0.0",
+ "is-glob": "2.0.1"
+ }
+ },
+ "glob-parent": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz",
+ "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=",
+ "dev": true,
+ "requires": {
+ "is-glob": "2.0.1"
+ }
+ },
+ "global-dirs": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.0.tgz",
+ "integrity": "sha1-ENNAOeDfBCcuJizyQiT3IJQ0308=",
+ "dev": true,
+ "requires": {
+ "ini": "1.3.4"
+ }
+ },
+ "globals": {
+ "version": "9.18.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
+ "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==",
+ "dev": true
+ },
+ "globby": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-4.1.0.tgz",
+ "integrity": "sha1-CA9UVJ7BuCpsYOYx/ILhIR2+lfg=",
+ "dev": true,
+ "requires": {
+ "array-union": "1.0.2",
+ "arrify": "1.0.1",
+ "glob": "6.0.4",
+ "object-assign": "4.1.1",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1"
+ }
+ },
+ "globjoin": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/globjoin/-/globjoin-0.1.4.tgz",
+ "integrity": "sha1-L0SUrIkZ43Z8XLtpHp9GMyQoXUM=",
+ "dev": true
+ },
+ "got": {
+ "version": "6.7.1",
+ "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz",
+ "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=",
+ "dev": true,
+ "requires": {
+ "create-error-class": "3.0.2",
+ "duplexer3": "0.1.4",
+ "get-stream": "3.0.0",
+ "is-redirect": "1.0.0",
+ "is-retry-allowed": "1.1.0",
+ "is-stream": "1.1.0",
+ "lowercase-keys": "1.0.0",
+ "safe-buffer": "5.1.1",
+ "timed-out": "4.0.1",
+ "unzip-response": "2.0.1",
+ "url-parse-lax": "1.0.0"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.1.11",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
+ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=",
+ "dev": true
+ },
+ "har-schema": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
+ "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
+ "dev": true
+ },
+ "har-validator": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
+ "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
+ "dev": true,
+ "requires": {
+ "ajv": "5.2.3",
+ "har-schema": "2.0.0"
+ }
+ },
+ "has": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz",
+ "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=",
+ "dev": true,
+ "requires": {
+ "function-bind": "1.1.1"
+ }
+ },
+ "has-ansi": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
+ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "2.1.1"
+ }
+ },
+ "has-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz",
+ "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=",
+ "dev": true
+ },
+ "hasha": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz",
+ "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=",
+ "dev": true,
+ "requires": {
+ "is-stream": "1.1.0",
+ "pinkie-promise": "2.0.1"
+ }
+ },
+ "hawk": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz",
+ "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==",
+ "dev": true,
+ "requires": {
+ "boom": "4.3.1",
+ "cryptiles": "3.1.2",
+ "hoek": "4.2.0",
+ "sntp": "2.1.0"
+ }
+ },
+ "hoek": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz",
+ "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==",
+ "dev": true
+ },
+ "home-or-tmp": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz",
+ "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=",
+ "dev": true,
+ "requires": {
+ "os-homedir": "1.0.2",
+ "os-tmpdir": "1.0.2"
+ }
+ },
+ "hosted-git-info": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz",
+ "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==",
+ "dev": true
+ },
+ "html-comment-regex": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.1.tgz",
+ "integrity": "sha1-ZouTd26q5V696POtRkswekljYl4=",
+ "dev": true
+ },
+ "html-tags": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-2.0.0.tgz",
+ "integrity": "sha1-ELMKOGCF9Dzt41PMj6fLDe7qZos=",
+ "dev": true
+ },
+ "http-signature": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
+ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "1.0.0",
+ "jsprim": "1.4.1",
+ "sshpk": "1.13.1"
+ }
+ },
+ "iconv-lite": {
+ "version": "0.4.19",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
+ "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==",
+ "dev": true
+ },
+ "ignore": {
+ "version": "3.3.5",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.5.tgz",
+ "integrity": "sha512-JLH93mL8amZQhh/p6mfQgVBH3M6epNq3DfsXsTSuSrInVjwyYlFE1nv2AgfRCC8PoOhM0jwQ5v8s9LgbK7yGDw==",
+ "dev": true
+ },
+ "import-lazy": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz",
+ "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=",
+ "dev": true
+ },
+ "imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=",
+ "dev": true
+ },
+ "indent-string": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz",
+ "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=",
+ "dev": true,
+ "requires": {
+ "repeating": "2.0.1"
+ }
+ },
+ "indexes-of": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
+ "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=",
+ "dev": true
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "dev": true,
+ "requires": {
+ "once": "1.4.0",
+ "wrappy": "1.0.2"
+ }
+ },
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "dev": true
+ },
+ "ini": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz",
+ "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=",
+ "dev": true
+ },
+ "inquirer": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz",
+ "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==",
+ "dev": true,
+ "requires": {
+ "ansi-escapes": "3.0.0",
+ "chalk": "2.3.0",
+ "cli-cursor": "2.1.0",
+ "cli-width": "2.2.0",
+ "external-editor": "2.1.0",
+ "figures": "2.0.0",
+ "lodash": "4.17.4",
+ "mute-stream": "0.0.7",
+ "run-async": "2.3.0",
+ "rx-lite": "4.0.8",
+ "rx-lite-aggregates": "4.0.8",
+ "string-width": "2.1.1",
+ "strip-ansi": "4.0.0",
+ "through": "2.3.8"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
+ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
+ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.5.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
+ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "3.0.0"
+ }
+ },
+ "supports-color": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
+ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "invariant": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz",
+ "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=",
+ "dev": true,
+ "requires": {
+ "loose-envify": "1.3.1"
+ }
+ },
+ "invert-kv": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
+ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
+ "dev": true
+ },
+ "irregular-plurals": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-1.3.0.tgz",
+ "integrity": "sha512-njf5A+Mxb3kojuHd1DzISjjIl+XhyzovXEOyPPSzdQozq/Lf2tN27mOrAAsxEPZxpn6I4MGzs1oo9TxXxPFpaA==",
+ "dev": true
+ },
+ "is-absolute-url": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz",
+ "integrity": "sha1-UFMN+4T8yap9vnhS6Do3uTufKqY=",
+ "dev": true
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
+ "dev": true
+ },
+ "is-binary-path": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz",
+ "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=",
+ "dev": true,
+ "requires": {
+ "binary-extensions": "1.10.0"
+ }
+ },
+ "is-buffer": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz",
+ "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=",
+ "dev": true
+ },
+ "is-builtin-module": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
+ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
+ "dev": true,
+ "requires": {
+ "builtin-modules": "1.1.1"
+ }
+ },
+ "is-callable": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz",
+ "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=",
+ "dev": true
+ },
+ "is-date-object": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
+ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
+ "dev": true
+ },
+ "is-directory": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz",
+ "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=",
+ "dev": true
+ },
+ "is-dotfile": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz",
+ "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=",
+ "dev": true
+ },
+ "is-equal-shallow": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz",
+ "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=",
+ "dev": true,
+ "requires": {
+ "is-primitive": "2.0.0"
+ }
+ },
+ "is-extendable": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
+ "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=",
+ "dev": true
+ },
+ "is-extglob": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz",
+ "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=",
+ "dev": true
+ },
+ "is-finite": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz",
+ "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=",
+ "dev": true,
+ "requires": {
+ "number-is-nan": "1.0.1"
+ }
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "dev": true
+ },
+ "is-glob": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz",
+ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=",
+ "dev": true,
+ "requires": {
+ "is-extglob": "1.0.0"
+ }
+ },
+ "is-installed-globally": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz",
+ "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=",
+ "dev": true,
+ "requires": {
+ "global-dirs": "0.1.0",
+ "is-path-inside": "1.0.0"
+ }
+ },
+ "is-npm": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz",
+ "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=",
+ "dev": true
+ },
+ "is-number": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz",
+ "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=",
+ "dev": true,
+ "requires": {
+ "kind-of": "3.2.2"
+ }
+ },
+ "is-obj": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
+ "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
+ "dev": true
+ },
+ "is-path-cwd": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",
+ "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=",
+ "dev": true
+ },
+ "is-path-in-cwd": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz",
+ "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=",
+ "dev": true,
+ "requires": {
+ "is-path-inside": "1.0.0"
+ }
+ },
+ "is-path-inside": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz",
+ "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=",
+ "dev": true,
+ "requires": {
+ "path-is-inside": "1.0.2"
+ }
+ },
+ "is-plain-obj": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
+ "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=",
+ "dev": true
+ },
+ "is-posix-bracket": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz",
+ "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=",
+ "dev": true
+ },
+ "is-primitive": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz",
+ "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=",
+ "dev": true
+ },
+ "is-promise": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
+ "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",
+ "dev": true
+ },
+ "is-redirect": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz",
+ "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=",
+ "dev": true
+ },
+ "is-regex": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
+ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
+ "dev": true,
+ "requires": {
+ "has": "1.0.1"
+ }
+ },
+ "is-regexp": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz",
+ "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=",
+ "dev": true
+ },
+ "is-resolvable": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.1.tgz",
+ "integrity": "sha512-y5CXYbzvB3jTnWAZH1Nl7ykUWb6T3BcTs56HUruwBf8MhF56n1HWqhDWnVFo8GHrUPDgvUUNVhrc2U8W7iqz5g==",
+ "dev": true
+ },
+ "is-retry-allowed": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz",
+ "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=",
+ "dev": true
+ },
+ "is-stream": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
+ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
+ "dev": true
+ },
+ "is-supported-regexp-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-supported-regexp-flag/-/is-supported-regexp-flag-1.0.0.tgz",
+ "integrity": "sha1-i1IMhfrnolM4LUsCZS4EVXbhO7g=",
+ "dev": true
+ },
+ "is-svg": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-2.1.0.tgz",
+ "integrity": "sha1-z2EJDaDZ77yrhyLeum8DIgjbsOk=",
+ "dev": true,
+ "requires": {
+ "html-comment-regex": "1.1.1"
+ }
+ },
+ "is-symbol": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz",
+ "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=",
+ "dev": true
+ },
+ "is-typedarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
+ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
+ "dev": true
+ },
+ "is-utf8": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
+ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
+ "dev": true
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
+ "dev": true
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
+ },
+ "isnumeric": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/isnumeric/-/isnumeric-0.2.0.tgz",
+ "integrity": "sha1-ojR7o2DeGeM9D/1ZD933dVy/LmQ=",
+ "dev": true
+ },
+ "isobject": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
+ "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
+ "dev": true,
+ "requires": {
+ "isarray": "1.0.0"
+ }
+ },
+ "isstream": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
+ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
+ "dev": true
+ },
+ "js-base64": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.3.2.tgz",
+ "integrity": "sha512-Y2/+DnfJJXT1/FCwUebUhLWb3QihxiSC42+ctHLGogmW2jPY6LCapMdFZXRvVP2z6qyKW7s6qncE/9gSqZiArw==",
+ "dev": true
+ },
+ "js-tokens": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
+ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
+ "dev": true
+ },
+ "js-yaml": {
+ "version": "3.7.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.7.0.tgz",
+ "integrity": "sha1-XJZ93YN6m/3KXy3oQlOr6KHAO4A=",
+ "dev": true,
+ "requires": {
+ "argparse": "1.0.9",
+ "esprima": "2.7.3"
+ }
+ },
+ "jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
+ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
+ "dev": true,
+ "optional": true
+ },
+ "jsesc": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz",
+ "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=",
+ "dev": true
+ },
+ "json-parse-better-errors": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz",
+ "integrity": "sha512-xyQpxeWWMKyJps9CuGJYeng6ssI5bpqS9ltQpdVQ90t4ql6NdnxFKh95JcRt2cun/DjMVNrdjniLPuMA69xmCw==",
+ "dev": true
+ },
+ "json-schema": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
+ "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
+ "dev": true
+ },
+ "json-schema-traverse": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
+ "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=",
+ "dev": true
+ },
+ "json-stable-stringify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
+ "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=",
+ "dev": true,
+ "requires": {
+ "jsonify": "0.0.0"
+ }
+ },
+ "json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
+ "dev": true
+ },
+ "json-stringify-safe": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
+ "dev": true
+ },
+ "json5": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
+ "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",
+ "dev": true
+ },
+ "jsonfile": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
+ "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11"
+ }
+ },
+ "jsonfilter": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/jsonfilter/-/jsonfilter-1.1.2.tgz",
+ "integrity": "sha1-Ie987cdRk4E8dZMulqmL4gW6WhE=",
+ "dev": true,
+ "requires": {
+ "JSONStream": "0.8.4",
+ "minimist": "1.2.0",
+ "stream-combiner": "0.2.2",
+ "through2": "0.6.5"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ },
+ "stream-combiner": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
+ "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=",
+ "dev": true,
+ "requires": {
+ "duplexer": "0.1.1",
+ "through": "2.3.8"
+ }
+ }
+ }
+ },
+ "jsonify": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
+ "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=",
+ "dev": true
+ },
+ "jsonparse": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz",
+ "integrity": "sha1-MwVCrT8KZUZlt3jz6y2an6UHrGQ=",
+ "dev": true
+ },
+ "jsprim": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
+ "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "1.0.0",
+ "extsprintf": "1.3.0",
+ "json-schema": "0.2.3",
+ "verror": "1.10.0"
+ }
+ },
+ "kew": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz",
+ "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=",
+ "dev": true
+ },
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "1.1.5"
+ }
+ },
+ "klaw": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz",
+ "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11"
+ }
+ },
+ "known-css-properties": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.2.0.tgz",
+ "integrity": "sha512-UTCzU28rRI9wkb8qSGoZa9pgWvxr4LjP2MEhi9XHb/1XMOJy0uTnIxaxzj8My/PORG+kQG6VzAcGvRw66eIOfA==",
+ "dev": true
+ },
+ "latest-version": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz",
+ "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=",
+ "dev": true,
+ "requires": {
+ "package-json": "4.0.1"
+ }
+ },
+ "lcid": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
+ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
+ "dev": true,
+ "requires": {
+ "invert-kv": "1.0.0"
+ }
+ },
+ "ldjson-stream": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ldjson-stream/-/ldjson-stream-1.2.1.tgz",
+ "integrity": "sha1-kb7O2lrE7SsX5kn7d356v6AYnCs=",
+ "dev": true,
+ "requires": {
+ "split2": "0.2.1",
+ "through2": "0.6.5"
+ }
+ },
+ "levn": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "1.1.2",
+ "type-check": "0.3.2"
+ }
+ },
+ "load-json-file": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
+ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "parse-json": "2.2.0",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1",
+ "strip-bom": "2.0.0"
+ }
+ },
+ "locate-path": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
+ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
+ "dev": true,
+ "requires": {
+ "p-locate": "2.0.0",
+ "path-exists": "3.0.0"
+ },
+ "dependencies": {
+ "path-exists": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
+ "dev": true
+ }
+ }
+ },
+ "lodash": {
+ "version": "4.17.4",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
+ "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=",
+ "dev": true
+ },
+ "lodash._reinterpolate": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz",
+ "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=",
+ "dev": true
+ },
+ "lodash.cond": {
+ "version": "4.5.2",
+ "resolved": "https://registry.npmjs.org/lodash.cond/-/lodash.cond-4.5.2.tgz",
+ "integrity": "sha1-9HGh2khr5g9quVXRcRVSPdHSVdU=",
+ "dev": true
+ },
+ "lodash.memoize": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
+ "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
+ "dev": true
+ },
+ "lodash.template": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz",
+ "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=",
+ "dev": true,
+ "requires": {
+ "lodash._reinterpolate": "3.0.0",
+ "lodash.templatesettings": "4.1.0"
+ }
+ },
+ "lodash.templatesettings": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz",
+ "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=",
+ "dev": true,
+ "requires": {
+ "lodash._reinterpolate": "3.0.0"
+ }
+ },
+ "lodash.uniq": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
+ "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=",
+ "dev": true
+ },
+ "log-symbols": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz",
+ "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3"
+ }
+ },
+ "loose-envify": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz",
+ "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=",
+ "dev": true,
+ "requires": {
+ "js-tokens": "3.0.2"
+ }
+ },
+ "loud-rejection": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz",
+ "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=",
+ "dev": true,
+ "requires": {
+ "currently-unhandled": "0.4.1",
+ "signal-exit": "3.0.2"
+ }
+ },
+ "lowercase-keys": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz",
+ "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=",
+ "dev": true
+ },
+ "lru-cache": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz",
+ "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==",
+ "dev": true,
+ "requires": {
+ "pseudomap": "1.0.2",
+ "yallist": "2.1.2"
+ }
+ },
+ "macaddress": {
+ "version": "0.2.8",
+ "resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.2.8.tgz",
+ "integrity": "sha1-WQTcU3w57G2+/q6QIycTX6hRHxI=",
+ "dev": true
+ },
+ "make-dir": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.1.0.tgz",
+ "integrity": "sha512-0Pkui4wLJ7rxvmfUvs87skoEaxmu0hCUApF8nonzpl7q//FWp9zu8W61Scz4sd/kUiqDxvUhtoam2efDyiBzcA==",
+ "dev": true,
+ "requires": {
+ "pify": "3.0.0"
+ },
+ "dependencies": {
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true
+ }
+ }
+ },
+ "map-obj": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
+ "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
+ "dev": true
+ },
+ "map-stream": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz",
+ "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=",
+ "dev": true
+ },
+ "math-expression-evaluator": {
+ "version": "1.2.17",
+ "resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz",
+ "integrity": "sha1-3oGf282E3M2PrlnGrreWFbnSZqw=",
+ "dev": true
+ },
+ "mathml-tag-names": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.0.1.tgz",
+ "integrity": "sha1-jUEmgWi/htEQK5gQnijlMeejRXg=",
+ "dev": true
+ },
+ "mem": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz",
+ "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=",
+ "dev": true,
+ "requires": {
+ "mimic-fn": "1.1.0"
+ }
+ },
+ "memorystream": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
+ "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=",
+ "dev": true
+ },
+ "meow": {
+ "version": "3.7.0",
+ "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
+ "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=",
+ "dev": true,
+ "requires": {
+ "camelcase-keys": "2.1.0",
+ "decamelize": "1.2.0",
+ "loud-rejection": "1.6.0",
+ "map-obj": "1.0.1",
+ "minimist": "1.2.0",
+ "normalize-package-data": "2.4.0",
+ "object-assign": "4.1.1",
+ "read-pkg-up": "1.0.1",
+ "redent": "1.0.0",
+ "trim-newlines": "1.0.0"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ }
+ }
+ },
+ "micromatch": {
+ "version": "2.3.11",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz",
+ "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=",
+ "dev": true,
+ "requires": {
+ "arr-diff": "2.0.0",
+ "array-unique": "0.2.1",
+ "braces": "1.8.5",
+ "expand-brackets": "0.1.5",
+ "extglob": "0.3.2",
+ "filename-regex": "2.0.1",
+ "is-extglob": "1.0.0",
+ "is-glob": "2.0.1",
+ "kind-of": "3.2.2",
+ "normalize-path": "2.1.1",
+ "object.omit": "2.0.1",
+ "parse-glob": "3.0.4",
+ "regex-cache": "0.4.4"
+ }
+ },
+ "mime": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
+ "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==",
+ "dev": true
+ },
+ "mime-db": {
+ "version": "1.30.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz",
+ "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=",
+ "dev": true
+ },
+ "mime-types": {
+ "version": "2.1.17",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz",
+ "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=",
+ "dev": true,
+ "requires": {
+ "mime-db": "1.30.0"
+ }
+ },
+ "mimic-fn": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz",
+ "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=",
+ "dev": true
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "1.1.8"
+ }
+ },
+ "minimist": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
+ "dev": true
+ },
+ "mkdirp": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
+ "dev": true,
+ "requires": {
+ "minimist": "0.0.8"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "multimatch": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz",
+ "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=",
+ "dev": true,
+ "requires": {
+ "array-differ": "1.0.0",
+ "array-union": "1.0.2",
+ "arrify": "1.0.1",
+ "minimatch": "3.0.4"
+ }
+ },
+ "mute-stream": {
+ "version": "0.0.7",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
+ "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
+ "dev": true
+ },
+ "natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
+ "dev": true
+ },
+ "nested-error-stacks": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-1.0.2.tgz",
+ "integrity": "sha1-GfYZWRUZ8JZ2mlupqG5u7sgjw88=",
+ "dev": true,
+ "requires": {
+ "inherits": "2.0.3"
+ }
+ },
+ "node-qunit-phantomjs": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/node-qunit-phantomjs/-/node-qunit-phantomjs-2.0.0.tgz",
+ "integrity": "sha512-xZV0J8fBbe8h04IkBxLtwvGVbP0ViUhkJzjFx/tb7uWT02w6iMt5X6HDmdTZuQXBMsgahyaIGjW30l3HSlj2yA==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.3.0",
+ "minimist": "1.2.0",
+ "phantomjs-prebuilt": "2.1.16",
+ "qunit-phantomjs-runner": "2.3.1"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
+ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.5.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ },
+ "qunit-phantomjs-runner": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/qunit-phantomjs-runner/-/qunit-phantomjs-runner-2.3.1.tgz",
+ "integrity": "sha512-RLg51606zm6/HwZi29NciAMAqifyJE1oGg77tEuk05vEa7kuqEaI0Mkjw976Ynnq7GXurATnbFd+471c024tBQ==",
+ "dev": true,
+ "requires": {
+ "qunit-reporter-junit": "1.1.1"
+ }
+ },
+ "supports-color": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
+ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "normalize-package-data": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
+ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
+ "dev": true,
+ "requires": {
+ "hosted-git-info": "2.5.0",
+ "is-builtin-module": "1.0.0",
+ "semver": "5.4.1",
+ "validate-npm-package-license": "3.0.1"
+ }
+ },
+ "normalize-path": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
+ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
+ "dev": true,
+ "requires": {
+ "remove-trailing-separator": "1.1.0"
+ }
+ },
+ "normalize-range": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
+ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=",
+ "dev": true
+ },
+ "normalize-selector": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/normalize-selector/-/normalize-selector-0.2.0.tgz",
+ "integrity": "sha1-0LFF62kRicY6eNIB3E/bEpPvDAM=",
+ "dev": true
+ },
+ "normalize-url": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz",
+ "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=",
+ "dev": true,
+ "requires": {
+ "object-assign": "4.1.1",
+ "prepend-http": "1.0.4",
+ "query-string": "4.3.4",
+ "sort-keys": "1.1.2"
+ }
+ },
+ "npm-run-all": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.2.tgz",
+ "integrity": "sha512-Z2aRlajMK4SQ8u19ZA75NZZu7wupfCNQWdYosIi8S6FgBdGf/8Y6Hgyjdc8zU2cYmIRVCx1nM80tJPkdEd+UYg==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "chalk": "2.3.0",
+ "cross-spawn": "5.1.0",
+ "memorystream": "0.3.1",
+ "minimatch": "3.0.4",
+ "ps-tree": "1.1.0",
+ "read-pkg": "3.0.0",
+ "shell-quote": "1.6.1",
+ "string.prototype.padend": "3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
+ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.5.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "load-json-file": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
+ "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "parse-json": "4.0.0",
+ "pify": "3.0.0",
+ "strip-bom": "3.0.0"
+ }
+ },
+ "parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
+ "dev": true,
+ "requires": {
+ "error-ex": "1.3.1",
+ "json-parse-better-errors": "1.0.1"
+ }
+ },
+ "path-type": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
+ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
+ "dev": true,
+ "requires": {
+ "pify": "3.0.0"
+ }
+ },
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
+ "dev": true
+ },
+ "read-pkg": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
+ "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "4.0.0",
+ "normalize-package-data": "2.4.0",
+ "path-type": "3.0.0"
+ }
+ },
+ "strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
+ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "npm-run-path": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
+ "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
+ "dev": true,
+ "requires": {
+ "path-key": "2.0.1"
+ }
+ },
+ "num2fraction": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz",
+ "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=",
+ "dev": true
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
+ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
+ "dev": true
+ },
+ "oauth-sign": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
+ "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=",
+ "dev": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
+ "dev": true
+ },
+ "object-keys": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz",
+ "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=",
+ "dev": true
+ },
+ "object.omit": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz",
+ "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=",
+ "dev": true,
+ "requires": {
+ "for-own": "0.1.5",
+ "is-extendable": "0.1.1"
+ }
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "requires": {
+ "wrappy": "1.0.2"
+ }
+ },
+ "onecolor": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/onecolor/-/onecolor-3.0.4.tgz",
+ "integrity": "sha1-daRvgNpseqpbTarhekcZi9llJJQ=",
+ "dev": true
+ },
+ "onetime": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
+ "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
+ "dev": true,
+ "requires": {
+ "mimic-fn": "1.1.0"
+ }
+ },
+ "optionator": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
+ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=",
+ "dev": true,
+ "requires": {
+ "deep-is": "0.1.3",
+ "fast-levenshtein": "2.0.6",
+ "levn": "0.3.0",
+ "prelude-ls": "1.1.2",
+ "type-check": "0.3.2",
+ "wordwrap": "1.0.0"
+ }
+ },
+ "ora": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/ora/-/ora-1.3.0.tgz",
+ "integrity": "sha1-gAeN0rkqk0r2ajrXKluRBpTt5Ro=",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3",
+ "cli-cursor": "2.1.0",
+ "cli-spinners": "1.1.0",
+ "log-symbols": "1.0.2"
+ }
+ },
+ "os-homedir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
+ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
+ "dev": true
+ },
+ "os-locale": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz",
+ "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==",
+ "dev": true,
+ "requires": {
+ "execa": "0.7.0",
+ "lcid": "1.0.0",
+ "mem": "1.1.0"
+ }
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
+ "dev": true
+ },
+ "p-finally": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
+ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
+ "dev": true
+ },
+ "p-limit": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz",
+ "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=",
+ "dev": true
+ },
+ "p-locate": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
+ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
+ "dev": true,
+ "requires": {
+ "p-limit": "1.1.0"
+ }
+ },
+ "p-map": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz",
+ "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==",
+ "dev": true
+ },
+ "package-json": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz",
+ "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=",
+ "dev": true,
+ "requires": {
+ "got": "6.7.1",
+ "registry-auth-token": "3.3.1",
+ "registry-url": "3.1.0",
+ "semver": "5.4.1"
+ }
+ },
+ "parse-glob": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz",
+ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=",
+ "dev": true,
+ "requires": {
+ "glob-base": "0.3.0",
+ "is-dotfile": "1.0.3",
+ "is-extglob": "1.0.0",
+ "is-glob": "2.0.1"
+ }
+ },
+ "parse-json": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
+ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
+ "dev": true,
+ "requires": {
+ "error-ex": "1.3.1"
+ }
+ },
+ "path-exists": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
+ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
+ "dev": true,
+ "requires": {
+ "pinkie-promise": "2.0.1"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "dev": true
+ },
+ "path-is-inside": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
+ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",
+ "dev": true
+ },
+ "path-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
+ "dev": true
+ },
+ "path-parse": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz",
+ "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=",
+ "dev": true
+ },
+ "path-type": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
+ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1"
+ }
+ },
+ "pause-stream": {
+ "version": "0.0.11",
+ "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
+ "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=",
+ "dev": true,
+ "requires": {
+ "through": "2.3.8"
+ }
+ },
+ "pend": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
+ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
+ "dev": true
+ },
+ "performance-now": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
+ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
+ "dev": true
+ },
+ "phantomjs-prebuilt": {
+ "version": "2.1.16",
+ "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz",
+ "integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=",
+ "dev": true,
+ "requires": {
+ "es6-promise": "4.1.1",
+ "extract-zip": "1.6.6",
+ "fs-extra": "1.0.0",
+ "hasha": "2.2.0",
+ "kew": "0.7.0",
+ "progress": "1.1.8",
+ "request": "2.83.0",
+ "request-progress": "2.0.1",
+ "which": "1.3.0"
+ },
+ "dependencies": {
+ "progress": {
+ "version": "1.1.8",
+ "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz",
+ "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=",
+ "dev": true
+ }
+ }
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ },
+ "pinkie": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
+ "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
+ "dev": true
+ },
+ "pinkie-promise": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
+ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
+ "dev": true,
+ "requires": {
+ "pinkie": "2.0.4"
+ }
+ },
+ "pipetteur": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pipetteur/-/pipetteur-2.0.3.tgz",
+ "integrity": "sha1-GVV2CVno0aEcsqUOyD7sRwYz5J8=",
+ "dev": true,
+ "requires": {
+ "onecolor": "3.0.4",
+ "synesthesia": "1.0.1"
+ }
+ },
+ "pixrem": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/pixrem/-/pixrem-4.0.1.tgz",
+ "integrity": "sha1-LaSh3m7EQjxfw3lOkwuB1EkOxoY=",
+ "dev": true,
+ "requires": {
+ "browserslist": "2.5.0",
+ "postcss": "6.0.13",
+ "reduce-css-calc": "1.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "pkg-dir": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz",
+ "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=",
+ "dev": true,
+ "requires": {
+ "find-up": "1.1.2"
+ }
+ },
+ "pleeease-filters": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/pleeease-filters/-/pleeease-filters-4.0.0.tgz",
+ "integrity": "sha1-ZjKy+wVkjSdY2GU4T7zteeHMrsc=",
+ "dev": true,
+ "requires": {
+ "onecolor": "3.0.4",
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "plur": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/plur/-/plur-2.1.2.tgz",
+ "integrity": "sha1-dIJFLBoPUI4+NE6uwxLJHCncZVo=",
+ "dev": true,
+ "requires": {
+ "irregular-plurals": "1.3.0"
+ }
+ },
+ "pluralize": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz",
+ "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==",
+ "dev": true
+ },
+ "postcss": {
+ "version": "5.2.18",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-5.2.18.tgz",
+ "integrity": "sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3",
+ "js-base64": "2.3.2",
+ "source-map": "0.5.7",
+ "supports-color": "3.2.3"
+ },
+ "dependencies": {
+ "supports-color": {
+ "version": "3.2.3",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz",
+ "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=",
+ "dev": true,
+ "requires": {
+ "has-flag": "1.0.0"
+ }
+ }
+ }
+ },
+ "postcss-apply": {
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/postcss-apply/-/postcss-apply-0.8.0.tgz",
+ "integrity": "sha1-FOVEu7XLbxweBIhXll15rgZrE0M=",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "balanced-match": "0.4.2",
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "balanced-match": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz",
+ "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-attribute-case-insensitive": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-attribute-case-insensitive/-/postcss-attribute-case-insensitive-2.0.0.tgz",
+ "integrity": "sha1-lNxCLI+QmX8WvTOjZUu77AhJY7Q=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13",
+ "postcss-selector-parser": "2.2.3"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-calc": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-5.3.1.tgz",
+ "integrity": "sha1-d7rnypKK2FcW4v2kLyYb98HWW14=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18",
+ "postcss-message-helpers": "2.0.0",
+ "reduce-css-calc": "1.3.0"
+ }
+ },
+ "postcss-cli": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/postcss-cli/-/postcss-cli-4.1.1.tgz",
+ "integrity": "sha1-uUvY//u3rB9i8mB+ePyTl/f2Ol0=",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "chokidar": "1.7.0",
+ "dependency-graph": "0.5.1",
+ "fs-extra": "4.0.2",
+ "get-stdin": "5.0.1",
+ "globby": "6.1.0",
+ "ora": "1.3.0",
+ "postcss": "6.0.13",
+ "postcss-load-config": "1.2.0",
+ "postcss-reporter": "5.0.0",
+ "pretty-hrtime": "1.0.3",
+ "read-cache": "1.0.0",
+ "yargs": "8.0.2"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "fs-extra": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz",
+ "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "jsonfile": "4.0.0",
+ "universalify": "0.1.1"
+ }
+ },
+ "get-stdin": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz",
+ "integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=",
+ "dev": true
+ },
+ "glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "1.0.0",
+ "inflight": "1.0.6",
+ "inherits": "2.0.3",
+ "minimatch": "3.0.4",
+ "once": "1.4.0",
+ "path-is-absolute": "1.0.1"
+ }
+ },
+ "globby": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
+ "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
+ "dev": true,
+ "requires": {
+ "array-union": "1.0.2",
+ "glob": "7.1.2",
+ "object-assign": "4.1.1",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
+ "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11"
+ }
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-color-function": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-color-function/-/postcss-color-function-4.0.0.tgz",
+ "integrity": "sha1-fgEG9Pah7LGtWzqFU6zl6Ciq4Yc=",
+ "dev": true,
+ "requires": {
+ "css-color-function": "1.3.3",
+ "postcss": "6.0.13",
+ "postcss-message-helpers": "2.0.0",
+ "postcss-value-parser": "3.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-color-gray": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-color-gray/-/postcss-color-gray-4.0.0.tgz",
+ "integrity": "sha1-aBvzBQl91mv+8OHmKC1dmbWsyV0=",
+ "dev": true,
+ "requires": {
+ "color": "1.0.3",
+ "postcss": "6.0.13",
+ "postcss-message-helpers": "2.0.0",
+ "reduce-function-call": "1.0.2"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "color": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/color/-/color-1.0.3.tgz",
+ "integrity": "sha1-5I6DLYXxTvaU+0aIEcLVz+cptV0=",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0",
+ "color-string": "1.5.2"
+ }
+ },
+ "color-string": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.2.tgz",
+ "integrity": "sha1-JuRYFLw8mny9Z1FkikFDRRSnc6k=",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3",
+ "simple-swizzle": "0.2.2"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-color-hex-alpha": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-color-hex-alpha/-/postcss-color-hex-alpha-3.0.0.tgz",
+ "integrity": "sha1-HlPmyKyyN5Vej9CLfs2xuLgwn5U=",
+ "dev": true,
+ "requires": {
+ "color": "1.0.3",
+ "postcss": "6.0.13",
+ "postcss-message-helpers": "2.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "color": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/color/-/color-1.0.3.tgz",
+ "integrity": "sha1-5I6DLYXxTvaU+0aIEcLVz+cptV0=",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0",
+ "color-string": "1.5.2"
+ }
+ },
+ "color-string": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.2.tgz",
+ "integrity": "sha1-JuRYFLw8mny9Z1FkikFDRRSnc6k=",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3",
+ "simple-swizzle": "0.2.2"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-color-hsl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-color-hsl/-/postcss-color-hsl-2.0.0.tgz",
+ "integrity": "sha1-EnA2ZvoxBDDj8wpFTawThjF9WEQ=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13",
+ "postcss-value-parser": "3.3.0",
+ "units-css": "0.4.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-color-hwb": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-color-hwb/-/postcss-color-hwb-3.0.0.tgz",
+ "integrity": "sha1-NAKxnvTYSXVAwftQcr6YY8qVVx4=",
+ "dev": true,
+ "requires": {
+ "color": "1.0.3",
+ "postcss": "6.0.13",
+ "postcss-message-helpers": "2.0.0",
+ "reduce-function-call": "1.0.2"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "color": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/color/-/color-1.0.3.tgz",
+ "integrity": "sha1-5I6DLYXxTvaU+0aIEcLVz+cptV0=",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0",
+ "color-string": "1.5.2"
+ }
+ },
+ "color-string": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.2.tgz",
+ "integrity": "sha1-JuRYFLw8mny9Z1FkikFDRRSnc6k=",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3",
+ "simple-swizzle": "0.2.2"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-color-rebeccapurple": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-color-rebeccapurple/-/postcss-color-rebeccapurple-3.0.0.tgz",
+ "integrity": "sha1-7rrwPTY7QwC5Z5K9MIHBntZlE9M=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13",
+ "postcss-value-parser": "3.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-color-rgb": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-color-rgb/-/postcss-color-rgb-2.0.0.tgz",
+ "integrity": "sha1-FFOcinExSUtILg3RzCZf9lFLUmM=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13",
+ "postcss-value-parser": "3.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-color-rgba-fallback": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-color-rgba-fallback/-/postcss-color-rgba-fallback-3.0.0.tgz",
+ "integrity": "sha1-N9XJNToHoJJwkSqCYGu0Kg1wLAQ=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13",
+ "postcss-value-parser": "3.3.0",
+ "rgb-hex": "2.1.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-colormin": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-2.2.2.tgz",
+ "integrity": "sha1-ZjFBfV8OkJo9fsJrJMio0eT5bks=",
+ "dev": true,
+ "requires": {
+ "colormin": "1.1.2",
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "postcss-convert-values": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-2.6.1.tgz",
+ "integrity": "sha1-u9hZPFwf0uPRwyK7kl3K6Nrk1i0=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "postcss-cssnext": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-cssnext/-/postcss-cssnext-3.0.2.tgz",
+ "integrity": "sha512-jA6kGdcUMZqLUgw6MdpyNWGFhk0LIITVhC/jTnLRZLoXSTR88qT2cFOn3LbY06udt1PVdTCHDG3plBjxVKf8BQ==",
+ "dev": true,
+ "requires": {
+ "autoprefixer": "7.1.5",
+ "caniuse-api": "2.0.0",
+ "chalk": "2.1.0",
+ "pixrem": "4.0.1",
+ "pleeease-filters": "4.0.0",
+ "postcss": "6.0.13",
+ "postcss-apply": "0.8.0",
+ "postcss-attribute-case-insensitive": "2.0.0",
+ "postcss-calc": "6.0.0",
+ "postcss-color-function": "4.0.0",
+ "postcss-color-gray": "4.0.0",
+ "postcss-color-hex-alpha": "3.0.0",
+ "postcss-color-hsl": "2.0.0",
+ "postcss-color-hwb": "3.0.0",
+ "postcss-color-rebeccapurple": "3.0.0",
+ "postcss-color-rgb": "2.0.0",
+ "postcss-color-rgba-fallback": "3.0.0",
+ "postcss-custom-media": "6.0.0",
+ "postcss-custom-properties": "6.2.0",
+ "postcss-custom-selectors": "4.0.1",
+ "postcss-font-family-system-ui": "2.0.1",
+ "postcss-font-variant": "3.0.0",
+ "postcss-image-set-polyfill": "0.3.5",
+ "postcss-initial": "2.0.0",
+ "postcss-media-minmax": "3.0.0",
+ "postcss-nesting": "4.2.1",
+ "postcss-pseudo-class-any-link": "4.0.0",
+ "postcss-pseudoelements": "5.0.0",
+ "postcss-replace-overflow-wrap": "2.0.0",
+ "postcss-selector-matches": "3.0.1",
+ "postcss-selector-not": "3.0.1"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "autoprefixer": {
+ "version": "7.1.5",
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-7.1.5.tgz",
+ "integrity": "sha512-sMN453qIm8Z+tunzYWW+Y490wWkICHhCYm/VohLjjl+N7ARSFuF5au7E6tr7oEbeeXj8mNjpSw2kxjJaO6YCOw==",
+ "dev": true,
+ "requires": {
+ "browserslist": "2.5.0",
+ "caniuse-lite": "1.0.30000744",
+ "normalize-range": "0.1.2",
+ "num2fraction": "1.2.2",
+ "postcss": "6.0.13",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "caniuse-api": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-2.0.0.tgz",
+ "integrity": "sha1-sd21pZZrFvSNxJmERNS7xsfZ2DQ=",
+ "dev": true,
+ "requires": {
+ "browserslist": "2.5.0",
+ "caniuse-lite": "1.0.30000744",
+ "lodash.memoize": "4.1.2",
+ "lodash.uniq": "4.5.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "postcss-calc": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-6.0.0.tgz",
+ "integrity": "sha1-toGyecbST74OM+2QRYA3BURdYTs=",
+ "dev": true,
+ "requires": {
+ "css-unit-converter": "1.1.1",
+ "postcss": "6.0.13",
+ "postcss-selector-parser": "2.2.3",
+ "reduce-css-calc": "2.0.5"
+ }
+ },
+ "reduce-css-calc": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-2.0.5.tgz",
+ "integrity": "sha1-M8l4OMXUxxGlwU74XOT95BSD970=",
+ "dev": true,
+ "requires": {
+ "css-unit-converter": "1.1.1",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-custom-media": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-custom-media/-/postcss-custom-media-6.0.0.tgz",
+ "integrity": "sha1-vlMnhBEOyylQRPtTlaGABushpzc=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-custom-properties": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/postcss-custom-properties/-/postcss-custom-properties-6.2.0.tgz",
+ "integrity": "sha512-eNR2h9T9ciKMoQEORrPjH33XeN/nuvVuxArOKmHtsFbGbNss631tgTrKou3/pmjAZbA4QQkhLIkPQkIk3WW+8w==",
+ "dev": true,
+ "requires": {
+ "balanced-match": "1.0.0",
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-custom-selectors": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-custom-selectors/-/postcss-custom-selectors-4.0.1.tgz",
+ "integrity": "sha1-eBOC+UxS5yfvXKR3bqKt9JphE4I=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13",
+ "postcss-selector-matches": "3.0.1"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-discard-comments": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-2.0.4.tgz",
+ "integrity": "sha1-vv6J+v1bPazlzM5Rt2uBUUvgDj0=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "postcss-discard-duplicates": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-2.1.0.tgz",
+ "integrity": "sha1-uavye4isGIFYpesSq8riAmO5GTI=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "postcss-discard-empty": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-2.1.0.tgz",
+ "integrity": "sha1-0rS9nVztXr2Nyt52QMfXzX9PkrU=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "postcss-discard-overridden": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-0.1.1.tgz",
+ "integrity": "sha1-ix6vVU9ob7KIzYdMVWZ7CqNmjVg=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "postcss-discard-unused": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/postcss-discard-unused/-/postcss-discard-unused-2.2.3.tgz",
+ "integrity": "sha1-vOMLLMWR/8Y0Mitfs0ZLbZNPRDM=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18",
+ "uniqs": "2.0.0"
+ }
+ },
+ "postcss-filter-plugins": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-filter-plugins/-/postcss-filter-plugins-2.0.2.tgz",
+ "integrity": "sha1-bYWGJTTXNaxCDkqFgG4fXUKG2Ew=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18",
+ "uniqid": "4.1.1"
+ }
+ },
+ "postcss-font-family-system-ui": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-font-family-system-ui/-/postcss-font-family-system-ui-2.0.1.tgz",
+ "integrity": "sha1-MYoHX9y4S4ZKqCOlGTXvClhy6RE=",
+ "dev": true,
+ "requires": {
+ "lodash": "4.17.4",
+ "postcss": "6.0.13",
+ "postcss-value-parser": "3.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-font-variant": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-font-variant/-/postcss-font-variant-3.0.0.tgz",
+ "integrity": "sha1-CMzIj2BQuoLtjvLMdsDGprQfGD4=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-header": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-header/-/postcss-header-1.0.0.tgz",
+ "integrity": "sha512-YUcU2oHQNsNVUDPdQg6/TXBWvI7dBGf2bsLQdVlLiLM5kiGLGCcszYDlVTaicmXpKANdS1T7bxpJtCacrMButw==",
+ "dev": true,
+ "requires": {
+ "babel-register": "6.26.0",
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-image-set-polyfill": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/postcss-image-set-polyfill/-/postcss-image-set-polyfill-0.3.5.tgz",
+ "integrity": "sha1-Dxk0E3AM8fgr05Bm7wFtZaShgYE=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13",
+ "postcss-media-query-parser": "0.2.3"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-initial": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-initial/-/postcss-initial-2.0.0.tgz",
+ "integrity": "sha1-cnFfczbgu3k1HZnuZcSiU6hEG6Q=",
+ "dev": true,
+ "requires": {
+ "lodash.template": "4.4.0",
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-less": {
+ "version": "0.14.0",
+ "resolved": "https://registry.npmjs.org/postcss-less/-/postcss-less-0.14.0.tgz",
+ "integrity": "sha1-xjGwicbM5CK5oQ86lY0r7dOBkyQ=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "postcss-load-config": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-1.2.0.tgz",
+ "integrity": "sha1-U56a/J3chiASHr+djDZz4M5Q0oo=",
+ "dev": true,
+ "requires": {
+ "cosmiconfig": "2.2.2",
+ "object-assign": "4.1.1",
+ "postcss-load-options": "1.2.0",
+ "postcss-load-plugins": "2.3.0"
+ }
+ },
+ "postcss-load-options": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/postcss-load-options/-/postcss-load-options-1.2.0.tgz",
+ "integrity": "sha1-sJixVZ3awt8EvAuzdfmaXP4rbYw=",
+ "dev": true,
+ "requires": {
+ "cosmiconfig": "2.2.2",
+ "object-assign": "4.1.1"
+ }
+ },
+ "postcss-load-plugins": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/postcss-load-plugins/-/postcss-load-plugins-2.3.0.tgz",
+ "integrity": "sha1-dFdoEWWZrKLwCfrUJrABdQSdjZI=",
+ "dev": true,
+ "requires": {
+ "cosmiconfig": "2.2.2",
+ "object-assign": "4.1.1"
+ }
+ },
+ "postcss-media-minmax": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-media-minmax/-/postcss-media-minmax-3.0.0.tgz",
+ "integrity": "sha1-Z1JWA3pD70C8Twdgv9BtTcadSNI=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-media-query-parser": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz",
+ "integrity": "sha1-J7Ocb02U+Bsac7j3Y1HGCeXO8kQ=",
+ "dev": true
+ },
+ "postcss-merge-idents": {
+ "version": "2.1.7",
+ "resolved": "https://registry.npmjs.org/postcss-merge-idents/-/postcss-merge-idents-2.1.7.tgz",
+ "integrity": "sha1-TFUwMTwI4dWzu/PSu8dH4njuonA=",
+ "dev": true,
+ "requires": {
+ "has": "1.0.1",
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "postcss-merge-longhand": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-2.0.2.tgz",
+ "integrity": "sha1-I9kM0Sewp3mUkVMyc5A0oaTz1lg=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "postcss-merge-rules": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-2.1.2.tgz",
+ "integrity": "sha1-0d9d+qexrMO+VT8OnhDofGG19yE=",
+ "dev": true,
+ "requires": {
+ "browserslist": "1.7.7",
+ "caniuse-api": "1.6.1",
+ "postcss": "5.2.18",
+ "postcss-selector-parser": "2.2.3",
+ "vendors": "1.0.1"
+ },
+ "dependencies": {
+ "browserslist": {
+ "version": "1.7.7",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-1.7.7.tgz",
+ "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
+ "dev": true,
+ "requires": {
+ "caniuse-db": "1.0.30000744",
+ "electron-to-chromium": "1.3.24"
+ }
+ }
+ }
+ },
+ "postcss-message-helpers": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-message-helpers/-/postcss-message-helpers-2.0.0.tgz",
+ "integrity": "sha1-pPL0+rbk/gAvCu0ABHjN9S+bpg4=",
+ "dev": true
+ },
+ "postcss-minify-font-values": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-1.0.5.tgz",
+ "integrity": "sha1-S1jttWZB66fIR0qzUmyv17vey2k=",
+ "dev": true,
+ "requires": {
+ "object-assign": "4.1.1",
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "postcss-minify-gradients": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-1.0.5.tgz",
+ "integrity": "sha1-Xb2hE3NwP4PPtKPqOIHY11/15uE=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "postcss-minify-params": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-1.2.2.tgz",
+ "integrity": "sha1-rSzgcTc7lDs9kwo/pZo1jCjW8fM=",
+ "dev": true,
+ "requires": {
+ "alphanum-sort": "1.0.2",
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0",
+ "uniqs": "2.0.0"
+ }
+ },
+ "postcss-minify-selectors": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-2.1.1.tgz",
+ "integrity": "sha1-ssapjAByz5G5MtGkllCBFDEXNb8=",
+ "dev": true,
+ "requires": {
+ "alphanum-sort": "1.0.2",
+ "has": "1.0.1",
+ "postcss": "5.2.18",
+ "postcss-selector-parser": "2.2.3"
+ }
+ },
+ "postcss-nesting": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/postcss-nesting/-/postcss-nesting-4.2.1.tgz",
+ "integrity": "sha512-IkyWXICwagCnlaviRexi7qOdwPw3+xVVjgFfGsxmztvRVaNxAlrypOIKqDE5mxY+BVxnId1rnUKBRQoNE2VDaA==",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-normalize-charset": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-1.1.1.tgz",
+ "integrity": "sha1-757nEhLX/nWceO0WL2HtYrXLk/E=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "postcss-normalize-url": {
+ "version": "3.0.8",
+ "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-3.0.8.tgz",
+ "integrity": "sha1-EI90s/L82viRov+j6kWSJ5/HgiI=",
+ "dev": true,
+ "requires": {
+ "is-absolute-url": "2.1.0",
+ "normalize-url": "1.9.1",
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "postcss-ordered-values": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-2.2.3.tgz",
+ "integrity": "sha1-7sbCpntsQSqNsgQud/6NpD+VwR0=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "postcss-pseudo-class-any-link": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-pseudo-class-any-link/-/postcss-pseudo-class-any-link-4.0.0.tgz",
+ "integrity": "sha1-kVKgYT00UHIFE+iJKFS65C0O5o4=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13",
+ "postcss-selector-parser": "2.2.3"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-pseudoelements": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-pseudoelements/-/postcss-pseudoelements-5.0.0.tgz",
+ "integrity": "sha1-7vGU6NUkZFylIKlJ6V5RjoEkAss=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-reduce-idents": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/postcss-reduce-idents/-/postcss-reduce-idents-2.4.0.tgz",
+ "integrity": "sha1-wsbSDMlYKE9qv75j92Cb9AkFmtM=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "postcss-reduce-initial": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-1.0.1.tgz",
+ "integrity": "sha1-aPgGlfBF0IJjqHmtJA343WT2ROo=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "postcss-reduce-transforms": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-1.0.4.tgz",
+ "integrity": "sha1-/3b02CEkN7McKYpC0uFEQCV3GuE=",
+ "dev": true,
+ "requires": {
+ "has": "1.0.1",
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0"
+ }
+ },
+ "postcss-replace-overflow-wrap": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-replace-overflow-wrap/-/postcss-replace-overflow-wrap-2.0.0.tgz",
+ "integrity": "sha1-eU22+qVPjbEAhUOSqTr0V2i04ls=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-reporter": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-5.0.0.tgz",
+ "integrity": "sha512-rBkDbaHAu5uywbCR2XE8a25tats3xSOsGNx6mppK6Q9kSFGKc/FyAzfci+fWM2l+K402p1D0pNcfDGxeje5IKg==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "lodash": "4.17.4",
+ "log-symbols": "2.1.0",
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "log-symbols": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.1.0.tgz",
+ "integrity": "sha512-zLeLrzMA1A2vRF1e/0Mo+LNINzi6jzBylHj5WqvQ/WK/5WCZt8si9SyN4p9llr/HRYvVR1AoXHRHl4WTHyQAzQ==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0"
+ }
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-resolve-nested-selector": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.1.tgz",
+ "integrity": "sha1-Kcy8fDfe36wwTp//C/FZaz9qDk4=",
+ "dev": true
+ },
+ "postcss-scss": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-1.0.2.tgz",
+ "integrity": "sha1-/0XPM1S4ee6JpOtoaA9GrJuxT5Q=",
+ "dev": true,
+ "requires": {
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-selector-matches": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-selector-matches/-/postcss-selector-matches-3.0.1.tgz",
+ "integrity": "sha1-5WNAEeE5UIgYYbvdWMLQER/8lqs=",
+ "dev": true,
+ "requires": {
+ "balanced-match": "0.4.2",
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "balanced-match": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz",
+ "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-selector-not": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-selector-not/-/postcss-selector-not-3.0.1.tgz",
+ "integrity": "sha1-Lk2y8JZTNsAefOx9tsYN/3ZzNdk=",
+ "dev": true,
+ "requires": {
+ "balanced-match": "0.4.2",
+ "postcss": "6.0.13"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "balanced-match": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz",
+ "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-selector-parser": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-2.2.3.tgz",
+ "integrity": "sha1-+UN3iGBsPJrO4W/+jYsWKX8nu5A=",
+ "dev": true,
+ "requires": {
+ "flatten": "1.0.2",
+ "indexes-of": "1.0.1",
+ "uniq": "1.0.1"
+ }
+ },
+ "postcss-sorting": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-sorting/-/postcss-sorting-2.1.0.tgz",
+ "integrity": "sha1-MrHpr6kTuyJaatB21QPY+YO7SoI=",
+ "dev": true,
+ "requires": {
+ "lodash": "4.17.4",
+ "postcss": "5.2.18"
+ }
+ },
+ "postcss-svgo": {
+ "version": "2.1.6",
+ "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.6.tgz",
+ "integrity": "sha1-tt8YqmE7Zm4TPwittSGcJoSsEI0=",
+ "dev": true,
+ "requires": {
+ "is-svg": "2.1.0",
+ "postcss": "5.2.18",
+ "postcss-value-parser": "3.3.0",
+ "svgo": "0.7.2"
+ }
+ },
+ "postcss-unique-selectors": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-2.0.2.tgz",
+ "integrity": "sha1-mB1X0p3csz57Hf4f1DuGSfkzyh0=",
+ "dev": true,
+ "requires": {
+ "alphanum-sort": "1.0.2",
+ "postcss": "5.2.18",
+ "uniqs": "2.0.0"
+ }
+ },
+ "postcss-url": {
+ "version": "7.3.0",
+ "resolved": "https://registry.npmjs.org/postcss-url/-/postcss-url-7.3.0.tgz",
+ "integrity": "sha512-VBP6uf6iL3AZra23nkPkOEkS/5azj1xf/toRrjfkolfFEgg9Gyzg9UhJZeIsz12EGKZTNVeGbPa2XtaZm/iZvg==",
+ "dev": true,
+ "requires": {
+ "mime": "1.4.1",
+ "minimatch": "3.0.4",
+ "mkdirp": "0.5.1",
+ "postcss": "6.0.14",
+ "xxhashjs": "0.2.1"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
+ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.5.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.14",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.14.tgz",
+ "integrity": "sha512-NJ1z0f+1offCgadPhz+DvGm5Mkci+mmV5BqD13S992o0Xk9eElxUfPPF+t2ksH5R/17gz4xVK8KWocUQ5o3Rog==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.3.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.5.0"
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
+ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "postcss-value-parser": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz",
+ "integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU=",
+ "dev": true
+ },
+ "postcss-zindex": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/postcss-zindex/-/postcss-zindex-2.2.0.tgz",
+ "integrity": "sha1-0hCd3AVbka9n/EyzsCWUZjnSryI=",
+ "dev": true,
+ "requires": {
+ "has": "1.0.1",
+ "postcss": "5.2.18",
+ "uniqs": "2.0.0"
+ }
+ },
+ "prelude-ls": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
+ "dev": true
+ },
+ "prepend-http": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz",
+ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
+ "dev": true
+ },
+ "preserve": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz",
+ "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=",
+ "dev": true
+ },
+ "pretty-hrtime": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz",
+ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=",
+ "dev": true
+ },
+ "private": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz",
+ "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=",
+ "dev": true
+ },
+ "process-nextick-args": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
+ "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=",
+ "dev": true
+ },
+ "progress": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz",
+ "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=",
+ "dev": true
+ },
+ "ps-tree": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.1.0.tgz",
+ "integrity": "sha1-tCGyQUDWID8e08dplrRCewjowBQ=",
+ "dev": true,
+ "requires": {
+ "event-stream": "3.3.4"
+ }
+ },
+ "pseudomap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
+ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
+ "dev": true
+ },
+ "punycode": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
+ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
+ "dev": true
+ },
+ "q": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/q/-/q-1.5.0.tgz",
+ "integrity": "sha1-3QG6ydBtMObyGa7LglPunr3DCPE=",
+ "dev": true
+ },
+ "qs": {
+ "version": "6.5.1",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
+ "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==",
+ "dev": true
+ },
+ "query-string": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz",
+ "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=",
+ "dev": true,
+ "requires": {
+ "object-assign": "4.1.1",
+ "strict-uri-encode": "1.1.0"
+ }
+ },
+ "qunit-reporter-junit": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/qunit-reporter-junit/-/qunit-reporter-junit-1.1.1.tgz",
+ "integrity": "sha1-7rYiZFeJaZPnlaEZQPGK9q+lebQ=",
+ "dev": true
+ },
+ "randomatic": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz",
+ "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==",
+ "dev": true,
+ "requires": {
+ "is-number": "3.0.0",
+ "kind-of": "4.0.0"
+ },
+ "dependencies": {
+ "is-number": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
+ "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
+ "dev": true,
+ "requires": {
+ "kind-of": "3.2.2"
+ },
+ "dependencies": {
+ "kind-of": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
+ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "1.1.5"
+ }
+ }
+ }
+ },
+ "kind-of": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
+ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=",
+ "dev": true,
+ "requires": {
+ "is-buffer": "1.1.5"
+ }
+ }
+ }
+ },
+ "rc": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.2.tgz",
+ "integrity": "sha1-2M6ctX6NZNnHut2YdsfDTL48cHc=",
+ "dev": true,
+ "requires": {
+ "deep-extend": "0.4.2",
+ "ini": "1.3.4",
+ "minimist": "1.2.0",
+ "strip-json-comments": "2.0.1"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ }
+ }
+ },
+ "read-cache": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
+ "integrity": "sha1-5mTvMRYRZsl1HNvo28+GtftY93Q=",
+ "dev": true,
+ "requires": {
+ "pify": "2.3.0"
+ }
+ },
+ "read-file-stdin": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/read-file-stdin/-/read-file-stdin-0.2.1.tgz",
+ "integrity": "sha1-JezP86FTtoCa+ssj7hU4fbng7mE=",
+ "dev": true,
+ "requires": {
+ "gather-stream": "1.0.0"
+ }
+ },
+ "read-pkg": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
+ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "1.1.0",
+ "normalize-package-data": "2.4.0",
+ "path-type": "1.1.0"
+ }
+ },
+ "read-pkg-up": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
+ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
+ "dev": true,
+ "requires": {
+ "find-up": "1.1.2",
+ "read-pkg": "1.1.0"
+ }
+ },
+ "readable-stream": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
+ "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
+ "dev": true,
+ "requires": {
+ "core-util-is": "1.0.2",
+ "inherits": "2.0.3",
+ "isarray": "1.0.0",
+ "process-nextick-args": "1.0.7",
+ "safe-buffer": "5.1.1",
+ "string_decoder": "1.0.3",
+ "util-deprecate": "1.0.2"
+ }
+ },
+ "readdirp": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz",
+ "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "minimatch": "3.0.4",
+ "readable-stream": "2.3.3",
+ "set-immediate-shim": "1.0.1"
+ }
+ },
+ "redent": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz",
+ "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=",
+ "dev": true,
+ "requires": {
+ "indent-string": "2.1.0",
+ "strip-indent": "1.0.1"
+ }
+ },
+ "reduce-css-calc": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz",
+ "integrity": "sha1-dHyRTgSWFKTJz7umKYca0dKSdxY=",
+ "dev": true,
+ "requires": {
+ "balanced-match": "0.4.2",
+ "math-expression-evaluator": "1.2.17",
+ "reduce-function-call": "1.0.2"
+ },
+ "dependencies": {
+ "balanced-match": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz",
+ "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=",
+ "dev": true
+ }
+ }
+ },
+ "reduce-function-call": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/reduce-function-call/-/reduce-function-call-1.0.2.tgz",
+ "integrity": "sha1-WiAL+S4ON3UXUv5FsKszD9S2vpk=",
+ "dev": true,
+ "requires": {
+ "balanced-match": "0.4.2"
+ },
+ "dependencies": {
+ "balanced-match": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz",
+ "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=",
+ "dev": true
+ }
+ }
+ },
+ "regenerate": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz",
+ "integrity": "sha512-jVpo1GadrDAK59t/0jRx5VxYWQEDkkEKi6+HjE3joFVLfDOh9Xrdh0dF1eSq+BI/SwvTQ44gSscJ8N5zYL61sg==",
+ "dev": true
+ },
+ "regenerator-runtime": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz",
+ "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==",
+ "dev": true
+ },
+ "regenerator-transform": {
+ "version": "0.10.1",
+ "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz",
+ "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==",
+ "dev": true,
+ "requires": {
+ "babel-runtime": "6.26.0",
+ "babel-types": "6.26.0",
+ "private": "0.1.7"
+ }
+ },
+ "regex-cache": {
+ "version": "0.4.4",
+ "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz",
+ "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==",
+ "dev": true,
+ "requires": {
+ "is-equal-shallow": "0.1.3"
+ }
+ },
+ "regexpu-core": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz",
+ "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=",
+ "dev": true,
+ "requires": {
+ "regenerate": "1.3.3",
+ "regjsgen": "0.2.0",
+ "regjsparser": "0.1.5"
+ }
+ },
+ "registry-auth-token": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.1.tgz",
+ "integrity": "sha1-+w0yie4Nmtosu1KvXf5mywcNMAY=",
+ "dev": true,
+ "requires": {
+ "rc": "1.2.2",
+ "safe-buffer": "5.1.1"
+ }
+ },
+ "registry-url": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz",
+ "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=",
+ "dev": true,
+ "requires": {
+ "rc": "1.2.2"
+ }
+ },
+ "regjsgen": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz",
+ "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=",
+ "dev": true
+ },
+ "regjsparser": {
+ "version": "0.1.5",
+ "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz",
+ "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=",
+ "dev": true,
+ "requires": {
+ "jsesc": "0.5.0"
+ },
+ "dependencies": {
+ "jsesc": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
+ "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
+ "dev": true
+ }
+ }
+ },
+ "remove-trailing-separator": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
+ "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=",
+ "dev": true
+ },
+ "repeat-element": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz",
+ "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=",
+ "dev": true
+ },
+ "repeat-string": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
+ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
+ "dev": true
+ },
+ "repeating": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz",
+ "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=",
+ "dev": true,
+ "requires": {
+ "is-finite": "1.0.2"
+ }
+ },
+ "request": {
+ "version": "2.83.0",
+ "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz",
+ "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==",
+ "dev": true,
+ "requires": {
+ "aws-sign2": "0.7.0",
+ "aws4": "1.6.0",
+ "caseless": "0.12.0",
+ "combined-stream": "1.0.5",
+ "extend": "3.0.1",
+ "forever-agent": "0.6.1",
+ "form-data": "2.3.1",
+ "har-validator": "5.0.3",
+ "hawk": "6.0.2",
+ "http-signature": "1.2.0",
+ "is-typedarray": "1.0.0",
+ "isstream": "0.1.2",
+ "json-stringify-safe": "5.0.1",
+ "mime-types": "2.1.17",
+ "oauth-sign": "0.8.2",
+ "performance-now": "2.1.0",
+ "qs": "6.5.1",
+ "safe-buffer": "5.1.1",
+ "stringstream": "0.0.5",
+ "tough-cookie": "2.3.3",
+ "tunnel-agent": "0.6.0",
+ "uuid": "3.1.0"
+ }
+ },
+ "request-progress": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz",
+ "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=",
+ "dev": true,
+ "requires": {
+ "throttleit": "1.0.0"
+ }
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "dev": true
+ },
+ "require-from-string": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz",
+ "integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=",
+ "dev": true
+ },
+ "require-main-filename": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
+ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
+ "dev": true
+ },
+ "require-relative": {
+ "version": "0.8.7",
+ "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz",
+ "integrity": "sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4=",
+ "dev": true
+ },
+ "require-uncached": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",
+ "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=",
+ "dev": true,
+ "requires": {
+ "caller-path": "0.1.0",
+ "resolve-from": "1.0.1"
+ }
+ },
+ "resolve": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz",
+ "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==",
+ "dev": true,
+ "requires": {
+ "path-parse": "1.0.5"
+ }
+ },
+ "resolve-from": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz",
+ "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=",
+ "dev": true
+ },
+ "restore-cursor": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
+ "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
+ "dev": true,
+ "requires": {
+ "onetime": "2.0.1",
+ "signal-exit": "3.0.2"
+ }
+ },
+ "rgb": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/rgb/-/rgb-0.1.0.tgz",
+ "integrity": "sha1-vieykej+/+rBvZlylyG/pA/AN7U=",
+ "dev": true
+ },
+ "rgb-hex": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/rgb-hex/-/rgb-hex-2.1.0.tgz",
+ "integrity": "sha1-x3PF/iJoolV42SU5qCp6XOU77aY=",
+ "dev": true
+ },
+ "rimraf": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
+ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
+ "dev": true,
+ "requires": {
+ "glob": "7.1.2"
+ },
+ "dependencies": {
+ "glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "1.0.0",
+ "inflight": "1.0.6",
+ "inherits": "2.0.3",
+ "minimatch": "3.0.4",
+ "once": "1.4.0",
+ "path-is-absolute": "1.0.1"
+ }
+ }
+ }
+ },
+ "rollup": {
+ "version": "0.53.3",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.53.3.tgz",
+ "integrity": "sha512-MADFV0jpoh1QDB6U0U6YamGihGetxHEYgwTcGsc7map6JFIydPEfGNshK+ozxv1RKeUOQKn1vRb85IAcdjL22Q==",
+ "dev": true
+ },
+ "rollup-plugin-babel": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-3.0.3.tgz",
+ "integrity": "sha512-5kzM/Rr4jQSRPLc2eN5NuD+CI/6AAy7S1O18Ogu4U3nq1Q42VJn0C9EMtqnvxtfwf1XrezOtdA9ro1VZI5B0mA==",
+ "dev": true,
+ "requires": {
+ "rollup-pluginutils": "1.5.2"
+ }
+ },
+ "rollup-pluginutils": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz",
+ "integrity": "sha1-HhVud4+UtyVb+hs9AXi+j1xVJAg=",
+ "dev": true,
+ "requires": {
+ "estree-walker": "0.2.1",
+ "minimatch": "3.0.4"
+ }
+ },
+ "rollup-watch": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/rollup-watch/-/rollup-watch-4.3.1.tgz",
+ "integrity": "sha512-6yjnIwfjpSrqA8IafyIu7fsEyeImNR4aDjA1bQ7KWeVuiA+Clfsx8+PGQkyABWIQzmauQ//tIJ5wAxLXsXs8qQ==",
+ "dev": true,
+ "requires": {
+ "chokidar": "1.7.0",
+ "require-relative": "0.8.7",
+ "rollup-pluginutils": "2.0.1"
+ },
+ "dependencies": {
+ "estree-walker": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.3.1.tgz",
+ "integrity": "sha1-5rGlHPcpJSTnI3wxLl/mZgwc4ao=",
+ "dev": true
+ },
+ "rollup-pluginutils": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz",
+ "integrity": "sha1-fslbNXP2VDpGpkYb2afFRFJdD8A=",
+ "dev": true,
+ "requires": {
+ "estree-walker": "0.3.1",
+ "micromatch": "2.3.11"
+ }
+ }
+ }
+ },
+ "run-async": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
+ "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=",
+ "dev": true,
+ "requires": {
+ "is-promise": "2.1.0"
+ }
+ },
+ "rx-lite": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz",
+ "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=",
+ "dev": true
+ },
+ "rx-lite-aggregates": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz",
+ "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=",
+ "dev": true,
+ "requires": {
+ "rx-lite": "4.0.8"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
+ "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
+ "dev": true
+ },
+ "sax": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
+ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
+ "dev": true
+ },
+ "semver": {
+ "version": "5.4.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
+ "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==",
+ "dev": true
+ },
+ "semver-diff": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz",
+ "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=",
+ "dev": true,
+ "requires": {
+ "semver": "5.4.1"
+ }
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
+ "dev": true
+ },
+ "set-immediate-shim": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz",
+ "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=",
+ "dev": true
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
+ "dev": true
+ },
+ "shell-quote": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz",
+ "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=",
+ "dev": true,
+ "requires": {
+ "array-filter": "0.0.1",
+ "array-map": "0.0.0",
+ "array-reduce": "0.0.0",
+ "jsonify": "0.0.0"
+ }
+ },
+ "sigmund": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
+ "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=",
+ "dev": true
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
+ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
+ "dev": true
+ },
+ "simple-swizzle": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
+ "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "0.3.1"
+ },
+ "dependencies": {
+ "is-arrayish": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.1.tgz",
+ "integrity": "sha1-wt/DhquqDD4zxI2z/ocFnmkGXv0=",
+ "dev": true
+ }
+ }
+ },
+ "slash": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
+ "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=",
+ "dev": true
+ },
+ "slice-ansi": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz",
+ "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==",
+ "dev": true,
+ "requires": {
+ "is-fullwidth-code-point": "2.0.0"
+ }
+ },
+ "sntp": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz",
+ "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==",
+ "dev": true,
+ "requires": {
+ "hoek": "4.2.0"
+ }
+ },
+ "sort-keys": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz",
+ "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=",
+ "dev": true,
+ "requires": {
+ "is-plain-obj": "1.1.0"
+ }
+ },
+ "source-map": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
+ "dev": true
+ },
+ "source-map-support": {
+ "version": "0.4.18",
+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
+ "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
+ "dev": true,
+ "requires": {
+ "source-map": "0.5.7"
+ }
+ },
+ "spdx-correct": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz",
+ "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=",
+ "dev": true,
+ "requires": {
+ "spdx-license-ids": "1.2.2"
+ }
+ },
+ "spdx-expression-parse": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz",
+ "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=",
+ "dev": true
+ },
+ "spdx-license-ids": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz",
+ "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=",
+ "dev": true
+ },
+ "specificity": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/specificity/-/specificity-0.3.2.tgz",
+ "integrity": "sha512-Nc/QN/A425Qog7j9aHmwOrlwX2e7pNI47ciwxwy4jOlvbbMHkNNJchit+FX+UjF3IAdiaaV5BKeWuDUnws6G1A==",
+ "dev": true
+ },
+ "split": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz",
+ "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=",
+ "dev": true,
+ "requires": {
+ "through": "2.3.8"
+ }
+ },
+ "split2": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/split2/-/split2-0.2.1.tgz",
+ "integrity": "sha1-At2smtwD7Au3jBKC7Aecpuha6QA=",
+ "dev": true,
+ "requires": {
+ "through2": "0.6.5"
+ }
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "dev": true
+ },
+ "sshpk": {
+ "version": "1.13.1",
+ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz",
+ "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=",
+ "dev": true,
+ "requires": {
+ "asn1": "0.2.3",
+ "assert-plus": "1.0.0",
+ "bcrypt-pbkdf": "1.0.1",
+ "dashdash": "1.14.1",
+ "ecc-jsbn": "0.1.1",
+ "getpass": "0.1.7",
+ "jsbn": "0.1.1",
+ "tweetnacl": "0.14.5"
+ }
+ },
+ "stdin": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/stdin/-/stdin-0.0.1.tgz",
+ "integrity": "sha1-0wQZgarsPf28d6GzjWNy449ftx4=",
+ "dev": true
+ },
+ "stream-combiner": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
+ "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=",
+ "dev": true,
+ "requires": {
+ "duplexer": "0.1.1"
+ }
+ },
+ "strict-uri-encode": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
+ "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
+ "dev": true
+ },
+ "string-width": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
+ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
+ "dev": true,
+ "requires": {
+ "is-fullwidth-code-point": "2.0.0",
+ "strip-ansi": "4.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
+ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
+ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "3.0.0"
+ }
+ }
+ }
+ },
+ "string.prototype.padend": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz",
+ "integrity": "sha1-86rvfBcZ8XDF6rHDK/eA2W4h8vA=",
+ "dev": true,
+ "requires": {
+ "define-properties": "1.1.2",
+ "es-abstract": "1.9.0",
+ "function-bind": "1.1.1"
+ }
+ },
+ "string_decoder": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
+ "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "5.1.1"
+ }
+ },
+ "stringstream": {
+ "version": "0.0.5",
+ "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
+ "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=",
+ "dev": true
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "2.1.1"
+ }
+ },
+ "strip-bom": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
+ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
+ "dev": true,
+ "requires": {
+ "is-utf8": "0.2.1"
+ }
+ },
+ "strip-eof": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
+ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
+ "dev": true
+ },
+ "strip-indent": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz",
+ "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=",
+ "dev": true,
+ "requires": {
+ "get-stdin": "4.0.1"
+ }
+ },
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
+ "dev": true
+ },
+ "style-search": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/style-search/-/style-search-0.1.0.tgz",
+ "integrity": "sha1-eVjHk+R+MuB9K1yv5cC/jhLneQI=",
+ "dev": true
+ },
+ "stylefmt": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/stylefmt/-/stylefmt-6.0.0.tgz",
+ "integrity": "sha1-yFHpwteLiplQL3S6PYY7MBY+7JM=",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3",
+ "css-color-list": "0.0.1",
+ "diff": "3.4.0",
+ "editorconfig": "0.13.3",
+ "globby": "6.1.0",
+ "minimist": "1.2.0",
+ "postcss": "6.0.13",
+ "postcss-scss": "1.0.2",
+ "postcss-sorting": "2.1.0",
+ "postcss-value-parser": "3.3.0",
+ "stdin": "0.0.1",
+ "stylelint": "7.13.0",
+ "stylelint-order": "0.4.4"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "1.0.0",
+ "inflight": "1.0.6",
+ "inherits": "2.0.3",
+ "minimatch": "3.0.4",
+ "once": "1.4.0",
+ "path-is-absolute": "1.0.1"
+ }
+ },
+ "globby": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
+ "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
+ "dev": true,
+ "requires": {
+ "array-union": "1.0.2",
+ "glob": "7.1.2",
+ "object-assign": "4.1.1",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ },
+ "postcss": {
+ "version": "6.0.13",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz",
+ "integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==",
+ "dev": true,
+ "requires": {
+ "chalk": "2.1.0",
+ "source-map": "0.6.1",
+ "supports-color": "4.4.0"
+ },
+ "dependencies": {
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ }
+ }
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "stylehacks": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-2.3.2.tgz",
+ "integrity": "sha1-ZMg+BDimjJ7fRJ6MVSp9mrYAmws=",
+ "dev": true,
+ "requires": {
+ "browserslist": "1.7.7",
+ "chalk": "1.1.3",
+ "log-symbols": "1.0.2",
+ "minimist": "1.2.0",
+ "plur": "2.1.2",
+ "postcss": "5.2.18",
+ "postcss-reporter": "1.4.1",
+ "postcss-selector-parser": "2.2.3",
+ "read-file-stdin": "0.2.1",
+ "text-table": "0.2.0",
+ "write-file-stdout": "0.0.2"
+ },
+ "dependencies": {
+ "browserslist": {
+ "version": "1.7.7",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-1.7.7.tgz",
+ "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
+ "dev": true,
+ "requires": {
+ "caniuse-db": "1.0.30000744",
+ "electron-to-chromium": "1.3.24"
+ }
+ },
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ },
+ "postcss-reporter": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-1.4.1.tgz",
+ "integrity": "sha1-wTbwpbFhkV83ndN2XGEHX357mvI=",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3",
+ "lodash": "4.17.4",
+ "log-symbols": "1.0.2",
+ "postcss": "5.2.18"
+ }
+ }
+ }
+ },
+ "stylelint": {
+ "version": "7.13.0",
+ "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-7.13.0.tgz",
+ "integrity": "sha1-ER+Xttpy53XICADWu29fhpmXeF0=",
+ "dev": true,
+ "requires": {
+ "autoprefixer": "6.7.7",
+ "balanced-match": "0.4.2",
+ "chalk": "2.1.0",
+ "colorguard": "1.2.0",
+ "cosmiconfig": "2.2.2",
+ "debug": "2.6.9",
+ "doiuse": "2.6.0",
+ "execall": "1.0.0",
+ "file-entry-cache": "2.0.0",
+ "get-stdin": "5.0.1",
+ "globby": "6.1.0",
+ "globjoin": "0.1.4",
+ "html-tags": "2.0.0",
+ "ignore": "3.3.5",
+ "imurmurhash": "0.1.4",
+ "known-css-properties": "0.2.0",
+ "lodash": "4.17.4",
+ "log-symbols": "1.0.2",
+ "mathml-tag-names": "2.0.1",
+ "meow": "3.7.0",
+ "micromatch": "2.3.11",
+ "normalize-selector": "0.2.0",
+ "pify": "2.3.0",
+ "postcss": "5.2.18",
+ "postcss-less": "0.14.0",
+ "postcss-media-query-parser": "0.2.3",
+ "postcss-reporter": "3.0.0",
+ "postcss-resolve-nested-selector": "0.1.1",
+ "postcss-scss": "0.4.1",
+ "postcss-selector-parser": "2.2.3",
+ "postcss-value-parser": "3.3.0",
+ "resolve-from": "3.0.0",
+ "specificity": "0.3.2",
+ "string-width": "2.1.1",
+ "style-search": "0.1.0",
+ "stylehacks": "2.3.2",
+ "sugarss": "0.2.0",
+ "svg-tags": "1.0.0",
+ "table": "4.0.2"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "balanced-match": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz",
+ "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "get-stdin": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz",
+ "integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=",
+ "dev": true
+ },
+ "glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "1.0.0",
+ "inflight": "1.0.6",
+ "inherits": "2.0.3",
+ "minimatch": "3.0.4",
+ "once": "1.4.0",
+ "path-is-absolute": "1.0.1"
+ }
+ },
+ "globby": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
+ "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
+ "dev": true,
+ "requires": {
+ "array-union": "1.0.2",
+ "glob": "7.1.2",
+ "object-assign": "4.1.1",
+ "pify": "2.3.0",
+ "pinkie-promise": "2.0.1"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "postcss-reporter": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-3.0.0.tgz",
+ "integrity": "sha1-CeoPN6RExWk4eGBuCbAY6+/3z48=",
+ "dev": true,
+ "requires": {
+ "chalk": "1.1.3",
+ "lodash": "4.17.4",
+ "log-symbols": "1.0.2",
+ "postcss": "5.2.18"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
+ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "2.2.1",
+ "escape-string-regexp": "1.0.5",
+ "has-ansi": "2.0.0",
+ "strip-ansi": "3.0.1",
+ "supports-color": "2.0.0"
+ }
+ },
+ "supports-color": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
+ "dev": true
+ }
+ }
+ },
+ "postcss-scss": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-0.4.1.tgz",
+ "integrity": "sha1-rXcbgfD3L19IRdCKpg+TVXZT1Uw=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "resolve-from": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
+ "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "stylelint-order": {
+ "version": "0.4.4",
+ "resolved": "https://registry.npmjs.org/stylelint-order/-/stylelint-order-0.4.4.tgz",
+ "integrity": "sha1-2338oFQbUGIBDH4uIedFeR/AiKw=",
+ "dev": true,
+ "requires": {
+ "lodash": "4.17.4",
+ "postcss": "5.2.18",
+ "stylelint": "7.13.0"
+ }
+ },
+ "sugarss": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/sugarss/-/sugarss-0.2.0.tgz",
+ "integrity": "sha1-rDQjdWMyfG/4l7ZHQr9q7BkK054=",
+ "dev": true,
+ "requires": {
+ "postcss": "5.2.18"
+ }
+ },
+ "supports-color": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
+ "dev": true
+ },
+ "svg-tags": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz",
+ "integrity": "sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q=",
+ "dev": true
+ },
+ "svgo": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/svgo/-/svgo-0.7.2.tgz",
+ "integrity": "sha1-n1dyQTlSE1xv779Ar+ak+qiLS7U=",
+ "dev": true,
+ "requires": {
+ "coa": "1.0.4",
+ "colors": "1.1.2",
+ "csso": "2.3.2",
+ "js-yaml": "3.7.0",
+ "mkdirp": "0.5.1",
+ "sax": "1.2.4",
+ "whet.extend": "0.9.9"
+ }
+ },
+ "synesthesia": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/synesthesia/-/synesthesia-1.0.1.tgz",
+ "integrity": "sha1-XvlepUjA1cbm+btLDQcx3/hkp3c=",
+ "dev": true,
+ "requires": {
+ "css-color-names": "0.0.3"
+ },
+ "dependencies": {
+ "css-color-names": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.3.tgz",
+ "integrity": "sha1-3gzvFvTYqoIioyDVttfpu62nufY=",
+ "dev": true
+ }
+ }
+ },
+ "table": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz",
+ "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==",
+ "dev": true,
+ "requires": {
+ "ajv": "5.2.3",
+ "ajv-keywords": "2.1.0",
+ "chalk": "2.1.0",
+ "lodash": "4.17.4",
+ "slice-ansi": "1.0.0",
+ "string-width": "2.1.1"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz",
+ "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.4.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "term-size": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz",
+ "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=",
+ "dev": true,
+ "requires": {
+ "execa": "0.7.0"
+ }
+ },
+ "text-table": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
+ "dev": true
+ },
+ "throttleit": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz",
+ "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=",
+ "dev": true
+ },
+ "through": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
+ "dev": true
+ },
+ "through2": {
+ "version": "0.6.5",
+ "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz",
+ "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=",
+ "dev": true,
+ "requires": {
+ "readable-stream": "1.0.34",
+ "xtend": "4.0.1"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "1.0.34",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
+ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
+ "dev": true,
+ "requires": {
+ "core-util-is": "1.0.2",
+ "inherits": "2.0.3",
+ "isarray": "0.0.1",
+ "string_decoder": "0.10.31"
+ }
+ },
+ "string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
+ "dev": true
+ }
+ }
+ },
+ "timed-out": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
+ "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=",
+ "dev": true
+ },
+ "tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "dev": true,
+ "requires": {
+ "os-tmpdir": "1.0.2"
+ }
+ },
+ "to-fast-properties": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
+ "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=",
+ "dev": true
+ },
+ "tough-cookie": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz",
+ "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=",
+ "dev": true,
+ "requires": {
+ "punycode": "1.4.1"
+ }
+ },
+ "trim-newlines": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
+ "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=",
+ "dev": true
+ },
+ "trim-right": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
+ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=",
+ "dev": true
+ },
+ "tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "5.1.1"
+ }
+ },
+ "tweetnacl": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
+ "dev": true,
+ "optional": true
+ },
+ "type-check": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
+ "dev": true,
+ "requires": {
+ "prelude-ls": "1.1.2"
+ }
+ },
+ "typedarray": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
+ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
+ "dev": true
+ },
+ "uglify-js": {
+ "version": "3.3.4",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.4.tgz",
+ "integrity": "sha512-hfIwuAQI5dlXP30UtdmWoYF9k+ypVqBXIdmd6ZKBiaNHHvA8ty7ZloMe3+7S5AEKVkxHbjByl4DfRHQ7QpZquw==",
+ "dev": true,
+ "requires": {
+ "commander": "2.12.2",
+ "source-map": "0.6.1"
+ },
+ "dependencies": {
+ "commander": {
+ "version": "2.12.2",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz",
+ "integrity": "sha512-BFnaq5ZOGcDN7FlrtBT4xxkgIToalIIxwjxLWVJ8bGTpe1LroqMiqQXdA7ygc7CRvaYS+9zfPGFnJqFSayx+AA==",
+ "dev": true
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true
+ }
+ }
+ },
+ "uniq": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz",
+ "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=",
+ "dev": true
+ },
+ "uniqid": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/uniqid/-/uniqid-4.1.1.tgz",
+ "integrity": "sha1-iSIN32t1GuUrX3JISGNShZa7hME=",
+ "dev": true,
+ "requires": {
+ "macaddress": "0.2.8"
+ }
+ },
+ "uniqs": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz",
+ "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=",
+ "dev": true
+ },
+ "unique-string": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz",
+ "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=",
+ "dev": true,
+ "requires": {
+ "crypto-random-string": "1.0.0"
+ }
+ },
+ "units-css": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/units-css/-/units-css-0.4.0.tgz",
+ "integrity": "sha1-1iKGU6UZg9fBb/KPi53Dsf/tOgc=",
+ "dev": true,
+ "requires": {
+ "isnumeric": "0.2.0",
+ "viewport-dimensions": "0.2.0"
+ }
+ },
+ "universalify": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz",
+ "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=",
+ "dev": true
+ },
+ "unzip-response": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz",
+ "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=",
+ "dev": true
+ },
+ "update-notifier": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.3.0.tgz",
+ "integrity": "sha1-TognpruRUUCrCTVZ1wFOPruDdFE=",
+ "dev": true,
+ "requires": {
+ "boxen": "1.2.2",
+ "chalk": "2.3.0",
+ "configstore": "3.1.1",
+ "import-lazy": "2.1.0",
+ "is-installed-globally": "0.1.0",
+ "is-npm": "1.0.0",
+ "latest-version": "3.1.0",
+ "semver-diff": "2.1.0",
+ "xdg-basedir": "3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
+ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==",
+ "dev": true,
+ "requires": {
+ "color-convert": "1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
+ "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "3.2.0",
+ "escape-string-regexp": "1.0.5",
+ "supports-color": "4.5.0"
+ }
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
+ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
+ }
+ },
+ "url-parse-lax": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz",
+ "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=",
+ "dev": true,
+ "requires": {
+ "prepend-http": "1.0.4"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
+ "dev": true
+ },
+ "uuid": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz",
+ "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==",
+ "dev": true
+ },
+ "validate-npm-package-license": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz",
+ "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=",
+ "dev": true,
+ "requires": {
+ "spdx-correct": "1.0.2",
+ "spdx-expression-parse": "1.0.4"
+ }
+ },
+ "vendors": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.1.tgz",
+ "integrity": "sha1-N61zyO5Bf7PVgOeFMSMH0nSEfyI=",
+ "dev": true
+ },
+ "verror": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
+ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
+ "dev": true,
+ "requires": {
+ "assert-plus": "1.0.0",
+ "core-util-is": "1.0.2",
+ "extsprintf": "1.3.0"
+ }
+ },
+ "viewport-dimensions": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/viewport-dimensions/-/viewport-dimensions-0.2.0.tgz",
+ "integrity": "sha1-3nQHR9tTh/0XJfUXXpG6x2r982w=",
+ "dev": true
+ },
+ "whet.extend": {
+ "version": "0.9.9",
+ "resolved": "https://registry.npmjs.org/whet.extend/-/whet.extend-0.9.9.tgz",
+ "integrity": "sha1-+HfVv2SMl+WqVC+twW1qJZucEaE=",
+ "dev": true
+ },
+ "which": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz",
+ "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==",
+ "dev": true,
+ "requires": {
+ "isexe": "2.0.0"
+ }
+ },
+ "which-module": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
+ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
+ "dev": true
+ },
+ "widest-line": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz",
+ "integrity": "sha1-DAnIXCqUaD0Nfq+O4JfVZL8OEFw=",
+ "dev": true,
+ "requires": {
+ "string-width": "1.0.2"
+ },
+ "dependencies": {
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "dev": true,
+ "requires": {
+ "number-is-nan": "1.0.1"
+ }
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "dev": true,
+ "requires": {
+ "code-point-at": "1.1.0",
+ "is-fullwidth-code-point": "1.0.0",
+ "strip-ansi": "3.0.1"
+ }
+ }
+ }
+ },
+ "window-size": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz",
+ "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=",
+ "dev": true
+ },
+ "wordwrap": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
+ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
+ "dev": true,
+ "requires": {
+ "string-width": "1.0.2",
+ "strip-ansi": "3.0.1"
+ },
+ "dependencies": {
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "dev": true,
+ "requires": {
+ "number-is-nan": "1.0.1"
+ }
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "dev": true,
+ "requires": {
+ "code-point-at": "1.1.0",
+ "is-fullwidth-code-point": "1.0.0",
+ "strip-ansi": "3.0.1"
+ }
+ }
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ },
+ "write": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz",
+ "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=",
+ "dev": true,
+ "requires": {
+ "mkdirp": "0.5.1"
+ }
+ },
+ "write-file-atomic": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz",
+ "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "imurmurhash": "0.1.4",
+ "signal-exit": "3.0.2"
+ }
+ },
+ "write-file-stdout": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/write-file-stdout/-/write-file-stdout-0.0.2.tgz",
+ "integrity": "sha1-wlLXx8WxtAKJdjDjRTx7/mkNnKE=",
+ "dev": true
+ },
+ "xdg-basedir": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz",
+ "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=",
+ "dev": true
+ },
+ "xtend": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
+ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
+ "dev": true
+ },
+ "xxhashjs": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/xxhashjs/-/xxhashjs-0.2.1.tgz",
+ "integrity": "sha1-m76b6JYUKXbfo0wGGy0GjEPTDeA=",
+ "dev": true,
+ "requires": {
+ "cuint": "0.2.2"
+ }
+ },
+ "y18n": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
+ "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=",
+ "dev": true
+ },
+ "yallist": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
+ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
+ "dev": true
+ },
+ "yargs": {
+ "version": "8.0.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz",
+ "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=",
+ "dev": true,
+ "requires": {
+ "camelcase": "4.1.0",
+ "cliui": "3.2.0",
+ "decamelize": "1.2.0",
+ "get-caller-file": "1.0.2",
+ "os-locale": "2.1.0",
+ "read-pkg-up": "2.0.0",
+ "require-directory": "2.1.1",
+ "require-main-filename": "1.0.1",
+ "set-blocking": "2.0.0",
+ "string-width": "2.1.1",
+ "which-module": "2.0.0",
+ "y18n": "3.2.1",
+ "yargs-parser": "7.0.0"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
+ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
+ "dev": true
+ },
+ "find-up": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
+ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
+ "dev": true,
+ "requires": {
+ "locate-path": "2.0.0"
+ }
+ },
+ "load-json-file": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
+ "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "4.1.11",
+ "parse-json": "2.2.0",
+ "pify": "2.3.0",
+ "strip-bom": "3.0.0"
+ }
+ },
+ "path-type": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
+ "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
+ "dev": true,
+ "requires": {
+ "pify": "2.3.0"
+ }
+ },
+ "read-pkg": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
+ "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "2.0.0",
+ "normalize-package-data": "2.4.0",
+ "path-type": "2.0.0"
+ }
+ },
+ "read-pkg-up": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
+ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
+ "dev": true,
+ "requires": {
+ "find-up": "2.1.0",
+ "read-pkg": "2.0.0"
+ }
+ },
+ "strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
+ "dev": true
+ }
+ }
+ },
+ "yargs-parser": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz",
+ "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=",
+ "dev": true,
+ "requires": {
+ "camelcase": "4.1.0"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
+ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
+ "dev": true
+ }
+ }
+ },
+ "yauzl": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz",
+ "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=",
+ "dev": true,
+ "requires": {
+ "fd-slicer": "1.0.1"
+ }
+ }
+ }
+}
diff --git a/library/cropperjs/package.json b/library/cropperjs/package.json
new file mode 100644
index 000000000..f94100981
--- /dev/null
+++ b/library/cropperjs/package.json
@@ -0,0 +1,76 @@
+{
+ "name": "cropperjs",
+ "description": "JavaScript image cropper.",
+ "version": "1.2.2",
+ "main": "dist/cropper.common.js",
+ "module": "dist/cropper.esm.js",
+ "browser": "dist/cropper.js",
+ "style": "dist/cropper.css",
+ "repository": "fengyuanchen/cropperjs",
+ "homepage": "https://fengyuanchen.github.io/cropperjs",
+ "license": "MIT",
+ "author": {
+ "name": "Chen Fengyuan",
+ "url": "http://chenfengyuan.com"
+ },
+ "files": [
+ "src",
+ "dist"
+ ],
+ "keywords": [
+ "image",
+ "crop",
+ "cropping",
+ "move",
+ "zoom",
+ "rotate",
+ "scale",
+ "cropper",
+ "cropperjs",
+ "cropper.js",
+ "html",
+ "css",
+ "javascript",
+ "front-end",
+ "web",
+ "development"
+ ],
+ "scripts": {
+ "build": "npm run build:css && npm run build:js",
+ "build:css": "postcss src/css/cropper.css -o dist/cropper.css --no-map",
+ "build:js": "rollup -c",
+ "clear": "del-cli dist",
+ "compress": "npm run compress:css && npm run compress:js",
+ "compress:css": "postcss dist/cropper.css -u cssnano -o dist/cropper.min.css --no-map",
+ "compress:js": "uglifyjs dist/cropper.js -o dist/cropper.min.js -c -m --comments /^!/",
+ "copy": "cpy dist/cropper.css docs/css",
+ "lint": "eslint src/js --fix",
+ "release": "npm run clear && npm run lint && npm run build && npm run compress && npm run copy && npm test",
+ "start": "npm-run-all --parallel watch:*",
+ "test": "node-qunit-phantomjs test/index.html --timeout 10",
+ "watch:css": "postcss src/css/cropper.css -o docs/css/cropper.css -m -w",
+ "watch:js": "rollup -c -m -w"
+ },
+ "devDependencies": {
+ "babel-core": "^6.26.0",
+ "babel-plugin-external-helpers": "^6.22.0",
+ "babel-preset-env": "^1.6.1",
+ "cpy-cli": "^1.0.1",
+ "cssnano": "^3.10.0",
+ "del-cli": "^1.1.0",
+ "eslint": "^4.14.0",
+ "eslint-config-airbnb-base": "^12.1.0",
+ "eslint-plugin-import": "^2.8.0",
+ "node-qunit-phantomjs": "^2.0.0",
+ "npm-run-all": "^4.1.2",
+ "postcss-cli": "^4.1.1",
+ "postcss-cssnext": "^3.0.2",
+ "postcss-header": "^1.0.0",
+ "postcss-url": "^7.3.0",
+ "rollup": "^0.53.3",
+ "rollup-plugin-babel": "^3.0.3",
+ "rollup-watch": "^4.3.1",
+ "stylefmt": "^6.0.0",
+ "uglify-js": "^3.3.4"
+ }
+}
diff --git a/library/cropperjs/postcss.config.js b/library/cropperjs/postcss.config.js
new file mode 100644
index 000000000..af7ec6024
--- /dev/null
+++ b/library/cropperjs/postcss.config.js
@@ -0,0 +1,14 @@
+const rollupConfig = require('./rollup.config');
+
+module.exports = {
+ plugins: {
+ 'postcss-cssnext': {},
+ 'postcss-url': {
+ url: 'inline',
+ },
+ 'postcss-header': {
+ header: rollupConfig.banner,
+ },
+ stylefmt: {},
+ },
+};
diff --git a/library/cropperjs/rollup.config.js b/library/cropperjs/rollup.config.js
new file mode 100644
index 000000000..b792a79a7
--- /dev/null
+++ b/library/cropperjs/rollup.config.js
@@ -0,0 +1,50 @@
+const babel = require('rollup-plugin-babel');
+const pkg = require('./package');
+
+const now = new Date();
+const banner = `/*!
+ * Cropper.js v${pkg.version}
+ * https://github.com/${pkg.repository}
+ *
+ * Copyright (c) 2015-${now.getFullYear()} ${pkg.author.name}
+ * Released under the ${pkg.license} license
+ *
+ * Date: ${now.toISOString()}
+ */
+`;
+
+module.exports = {
+ // Export banner for PostCSS
+ banner,
+ input: 'src/js/cropper.js',
+ output: [
+ {
+ banner,
+ file: 'dist/cropper.js',
+ format: 'umd',
+ name: 'Cropper',
+ },
+ {
+ banner,
+ file: 'dist/cropper.common.js',
+ format: 'cjs',
+ },
+ {
+ banner,
+ file: 'dist/cropper.esm.js',
+ format: 'es',
+ },
+ {
+ banner,
+ file: 'docs/js/cropper.js',
+ format: 'umd',
+ name: 'Cropper',
+ },
+ ],
+ plugins: [
+ babel({
+ exclude: 'node_modules/**',
+ plugins: ['external-helpers'],
+ }),
+ ],
+};
diff --git a/library/cropperjs/src/css/cropper.css b/library/cropperjs/src/css/cropper.css
new file mode 100644
index 000000000..d09c4f182
--- /dev/null
+++ b/library/cropperjs/src/css/cropper.css
@@ -0,0 +1,290 @@
+:root {
+ --blue: #39f;
+}
+
+.cropper-container {
+ direction: ltr;
+ font-size: 0;
+ line-height: 0;
+ position: relative;
+ touch-action: none;
+ user-select: none;
+
+ & img {
+ /* Avoid margin top issue (Occur only when margin-top <= -height) */
+ display: block;
+ height: 100%;
+ image-orientation: 0deg;
+ max-height: none !important;
+ max-width: none !important;
+ min-height: 0 !important;
+ min-width: 0 !important;
+ width: 100%;
+ }
+}
+
+.cropper-wrap-box,
+.cropper-canvas,
+.cropper-drag-box,
+.cropper-crop-box,
+.cropper-modal {
+ bottom: 0;
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+}
+
+.cropper-wrap-box,
+.cropper-canvas {
+ overflow: hidden;
+}
+
+.cropper-drag-box {
+ background-color: #fff;
+ opacity: 0;
+}
+
+.cropper-modal {
+ background-color: #000;
+ opacity: .5;
+}
+
+.cropper-view-box {
+ display: block;
+ height: 100%;
+ outline-color: color(var(--blue) alpha(75%));
+ outline: 1px solid var(--blue);
+ overflow: hidden;
+ width: 100%;
+}
+
+.cropper-dashed {
+ border: 0 dashed #eee;
+ display: block;
+ opacity: .5;
+ position: absolute;
+
+ &.dashed-h {
+ border-bottom-width: 1px;
+ border-top-width: 1px;
+ height: calc(100 / 3)%;
+ left: 0;
+ top: calc(100 / 3)%;
+ width: 100%;
+ }
+
+ &.dashed-v {
+ border-left-width: 1px;
+ border-right-width: 1px;
+ height: 100%;
+ left: calc(100 / 3)%;
+ top: 0;
+ width: calc(100 / 3)%;
+ }
+}
+
+.cropper-center {
+ display: block;
+ height: 0;
+ left: 50%;
+ opacity: .75;
+ position: absolute;
+ top: 50%;
+ width: 0;
+
+ &:before,
+ &:after {
+ background-color: #eee;
+ content: ' ';
+ display: block;
+ position: absolute;
+ }
+
+ &:before {
+ height: 1px;
+ left: -3px;
+ top: 0;
+ width: 7px;
+ }
+
+ &:after {
+ height: 7px;
+ left: 0;
+ top: -3px;
+ width: 1px;
+ }
+}
+
+.cropper-face,
+.cropper-line,
+.cropper-point {
+ display: block;
+ height: 100%;
+ opacity: .1;
+ position: absolute;
+ width: 100%;
+}
+
+.cropper-face {
+ background-color: #fff;
+ left: 0;
+ top: 0;
+}
+
+.cropper-line {
+ background-color: var(--blue);
+
+ &.line-e {
+ cursor: ew-resize;
+ right: -3px;
+ top: 0;
+ width: 5px;
+ }
+
+ &.line-n {
+ cursor: ns-resize;
+ height: 5px;
+ left: 0;
+ top: -3px;
+ }
+
+ &.line-w {
+ cursor: ew-resize;
+ left: -3px;
+ top: 0;
+ width: 5px;
+ }
+
+ &.line-s {
+ bottom: -3px;
+ cursor: ns-resize;
+ height: 5px;
+ left: 0;
+ }
+}
+
+.cropper-point {
+ background-color: var(--blue);
+ height: 5px;
+ opacity: .75;
+ width: 5px;
+
+ &.point-e {
+ cursor: ew-resize;
+ margin-top: -3px;
+ right: -3px;
+ top: 50%;
+ }
+
+ &.point-n {
+ cursor: ns-resize;
+ left: 50%;
+ margin-left: -3px;
+ top: -3px;
+ }
+
+ &.point-w {
+ cursor: ew-resize;
+ left: -3px;
+ margin-top: -3px;
+ top: 50%;
+ }
+
+ &.point-s {
+ bottom: -3px;
+ cursor: s-resize;
+ left: 50%;
+ margin-left: -3px;
+ }
+
+ &.point-ne {
+ cursor: nesw-resize;
+ right: -3px;
+ top: -3px;
+ }
+
+ &.point-nw {
+ cursor: nwse-resize;
+ left: -3px;
+ top: -3px;
+ }
+
+ &.point-sw {
+ bottom: -3px;
+ cursor: nesw-resize;
+ left: -3px;
+ }
+
+ &.point-se {
+ bottom: -3px;
+ cursor: nwse-resize;
+ height: 20px;
+ opacity: 1;
+ right: -3px;
+ width: 20px;
+
+ @media (min-width: 768px) {
+ height: 15px;
+ width: 15px;
+ }
+
+ @media (min-width: 992px) {
+ height: 10px;
+ width: 10px;
+ }
+
+ @media (min-width: 1200px) {
+ height: 5px;
+ opacity: .75;
+ width: 5px;
+ }
+ }
+
+ &.point-se:before {
+ background-color: var(--blue);
+ bottom: -50%;
+ content: ' ';
+ display: block;
+ height: 200%;
+ opacity: 0;
+ position: absolute;
+ right: -50%;
+ width: 200%;
+ }
+}
+
+.cropper-invisible {
+ opacity: 0;
+}
+
+.cropper-bg {
+ background-image: url('../images/bg.png');
+}
+
+.cropper-hide {
+ display: block;
+ height: 0;
+ position: absolute;
+ width: 0;
+}
+
+.cropper-hidden {
+ display: none !important;
+}
+
+.cropper-move {
+ cursor: move;
+}
+
+.cropper-crop {
+ cursor: crosshair;
+}
+
+.cropper-disabled .cropper-drag-box,
+.cropper-disabled .cropper-face,
+.cropper-disabled .cropper-line,
+.cropper-disabled .cropper-point {
+ cursor: not-allowed;
+}
+
diff --git a/library/cropperjs/src/images/bg.png b/library/cropperjs/src/images/bg.png
new file mode 100644
index 000000000..3c7056b19
--- /dev/null
+++ b/library/cropperjs/src/images/bg.png
Binary files differ
diff --git a/library/cropperjs/src/js/change.js b/library/cropperjs/src/js/change.js
new file mode 100644
index 000000000..014222ef0
--- /dev/null
+++ b/library/cropperjs/src/js/change.js
@@ -0,0 +1,471 @@
+import {
+ ACTION_ALL,
+ ACTION_CROP,
+ ACTION_EAST,
+ ACTION_MOVE,
+ ACTION_NORTH,
+ ACTION_NORTH_EAST,
+ ACTION_NORTH_WEST,
+ ACTION_SOUTH,
+ ACTION_SOUTH_EAST,
+ ACTION_SOUTH_WEST,
+ ACTION_WEST,
+ ACTION_ZOOM,
+ CLASS_HIDDEN,
+} from './constants';
+import {
+ each,
+ getMaxZoomRatio,
+ getOffset,
+ removeClass,
+} from './utilities';
+
+export default {
+ change(e) {
+ const {
+ options,
+ canvasData,
+ containerData,
+ cropBoxData,
+ pointers,
+ } = this;
+ let { action } = this;
+ let { aspectRatio } = options;
+ let {
+ left,
+ top,
+ width,
+ height,
+ } = cropBoxData;
+ const right = left + width;
+ const bottom = top + height;
+ let minLeft = 0;
+ let minTop = 0;
+ let maxWidth = containerData.width;
+ let maxHeight = containerData.height;
+ let renderable = true;
+ let offset;
+
+ // Locking aspect ratio in "free mode" by holding shift key
+ if (!aspectRatio && e.shiftKey) {
+ aspectRatio = width && height ? width / height : 1;
+ }
+
+ if (this.limited) {
+ ({ minLeft, minTop } = cropBoxData);
+ maxWidth = minLeft + Math.min(
+ containerData.width,
+ canvasData.width,
+ canvasData.left + canvasData.width,
+ );
+ maxHeight = minTop + Math.min(
+ containerData.height,
+ canvasData.height,
+ canvasData.top + canvasData.height,
+ );
+ }
+
+ const pointer = pointers[Object.keys(pointers)[0]];
+ const range = {
+ x: pointer.endX - pointer.startX,
+ y: pointer.endY - pointer.startY,
+ };
+ const check = (side) => {
+ switch (side) {
+ case ACTION_EAST:
+ if (right + range.x > maxWidth) {
+ range.x = maxWidth - right;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (left + range.x < minLeft) {
+ range.x = minLeft - left;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (top + range.y < minTop) {
+ range.y = minTop - top;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (bottom + range.y > maxHeight) {
+ range.y = maxHeight - bottom;
+ }
+
+ break;
+
+ default:
+ }
+ };
+
+ switch (action) {
+ // Move crop box
+ case ACTION_ALL:
+ left += range.x;
+ top += range.y;
+ break;
+
+ // Resize crop box
+ case ACTION_EAST:
+ if (range.x >= 0 && (right >= maxWidth || (aspectRatio &&
+ (top <= minTop || bottom >= maxHeight)))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top -= (range.x / aspectRatio) / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_WEST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH:
+ if (range.y <= 0 && (top <= minTop || (aspectRatio &&
+ (left <= minLeft || right >= maxWidth)))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left += (range.y * aspectRatio) / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_SOUTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_WEST:
+ if (range.x <= 0 && (left <= minLeft || (aspectRatio &&
+ (top <= minTop || bottom >= maxHeight)))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+
+ if (aspectRatio) {
+ height = width / aspectRatio;
+ top += (range.x / aspectRatio) / 2;
+ }
+
+ if (width < 0) {
+ action = ACTION_EAST;
+ width = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH:
+ if (range.y >= 0 && (bottom >= maxHeight || (aspectRatio &&
+ (left <= minLeft || right >= maxWidth)))) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_SOUTH);
+ height += range.y;
+
+ if (aspectRatio) {
+ width = height * aspectRatio;
+ left -= (range.y * aspectRatio) / 2;
+ }
+
+ if (height < 0) {
+ action = ACTION_NORTH;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_EAST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_NORTH_WEST:
+ if (aspectRatio) {
+ if (range.y <= 0 && (top <= minTop || left <= minLeft)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_NORTH);
+ height -= range.y;
+ top += range.y;
+ width = height * aspectRatio;
+ left += range.y * aspectRatio;
+ } else {
+ check(ACTION_NORTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y <= 0 && top <= minTop) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y <= 0) {
+ if (top > minTop) {
+ height -= range.y;
+ top += range.y;
+ }
+ } else {
+ height -= range.y;
+ top += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_SOUTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_NORTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_SOUTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_WEST:
+ if (aspectRatio) {
+ if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_WEST);
+ width -= range.x;
+ left += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_WEST);
+
+ if (range.x <= 0) {
+ if (left > minLeft) {
+ width -= range.x;
+ left += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width -= range.x;
+ left += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_EAST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ }
+
+ break;
+
+ case ACTION_SOUTH_EAST:
+ if (aspectRatio) {
+ if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {
+ renderable = false;
+ break;
+ }
+
+ check(ACTION_EAST);
+ width += range.x;
+ height = width / aspectRatio;
+ } else {
+ check(ACTION_SOUTH);
+ check(ACTION_EAST);
+
+ if (range.x >= 0) {
+ if (right < maxWidth) {
+ width += range.x;
+ } else if (range.y >= 0 && bottom >= maxHeight) {
+ renderable = false;
+ }
+ } else {
+ width += range.x;
+ }
+
+ if (range.y >= 0) {
+ if (bottom < maxHeight) {
+ height += range.y;
+ }
+ } else {
+ height += range.y;
+ }
+ }
+
+ if (width < 0 && height < 0) {
+ action = ACTION_NORTH_WEST;
+ height = 0;
+ width = 0;
+ } else if (width < 0) {
+ action = ACTION_SOUTH_WEST;
+ width = 0;
+ } else if (height < 0) {
+ action = ACTION_NORTH_EAST;
+ height = 0;
+ }
+
+ break;
+
+ // Move canvas
+ case ACTION_MOVE:
+ this.move(range.x, range.y);
+ renderable = false;
+ break;
+
+ // Zoom canvas
+ case ACTION_ZOOM:
+ this.zoom(getMaxZoomRatio(pointers), e);
+ renderable = false;
+ break;
+
+ // Create crop box
+ case ACTION_CROP:
+ if (!range.x || !range.y) {
+ renderable = false;
+ break;
+ }
+
+ offset = getOffset(this.cropper);
+ left = pointer.startX - offset.left;
+ top = pointer.startY - offset.top;
+ width = cropBoxData.minWidth;
+ height = cropBoxData.minHeight;
+
+ if (range.x > 0) {
+ action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;
+ } else if (range.x < 0) {
+ left -= width;
+ action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;
+ }
+
+ if (range.y < 0) {
+ top -= height;
+ }
+
+ // Show the crop box if is hidden
+ if (!this.cropped) {
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ this.cropped = true;
+
+ if (this.limited) {
+ this.limitCropBox(true, true);
+ }
+ }
+
+ break;
+
+ default:
+ }
+
+ if (renderable) {
+ cropBoxData.width = width;
+ cropBoxData.height = height;
+ cropBoxData.left = left;
+ cropBoxData.top = top;
+ this.action = action;
+ this.renderCropBox();
+ }
+
+ // Override
+ each(pointers, (p) => {
+ p.startX = p.endX;
+ p.startY = p.endY;
+ });
+ },
+};
diff --git a/library/cropperjs/src/js/constants.js b/library/cropperjs/src/js/constants.js
new file mode 100644
index 000000000..c675d4d1c
--- /dev/null
+++ b/library/cropperjs/src/js/constants.js
@@ -0,0 +1,56 @@
+export const WINDOW = typeof window !== 'undefined' ? window : {};
+export const NAMESPACE = 'cropper';
+
+// Actions
+export const ACTION_ALL = 'all';
+export const ACTION_CROP = 'crop';
+export const ACTION_MOVE = 'move';
+export const ACTION_ZOOM = 'zoom';
+export const ACTION_EAST = 'e';
+export const ACTION_WEST = 'w';
+export const ACTION_SOUTH = 's';
+export const ACTION_NORTH = 'n';
+export const ACTION_NORTH_EAST = 'ne';
+export const ACTION_NORTH_WEST = 'nw';
+export const ACTION_SOUTH_EAST = 'se';
+export const ACTION_SOUTH_WEST = 'sw';
+
+// Classes
+export const CLASS_CROP = `${NAMESPACE}-crop`;
+export const CLASS_DISABLED = `${NAMESPACE}-disabled`;
+export const CLASS_HIDDEN = `${NAMESPACE}-hidden`;
+export const CLASS_HIDE = `${NAMESPACE}-hide`;
+export const CLASS_INVISIBLE = `${NAMESPACE}-invisible`;
+export const CLASS_MODAL = `${NAMESPACE}-modal`;
+export const CLASS_MOVE = `${NAMESPACE}-move`;
+
+// Data keys
+export const DATA_ACTION = 'action';
+export const DATA_PREVIEW = 'preview';
+
+// Drag modes
+export const DRAG_MODE_CROP = 'crop';
+export const DRAG_MODE_MOVE = 'move';
+export const DRAG_MODE_NONE = 'none';
+
+// Events
+export const EVENT_CROP = 'crop';
+export const EVENT_CROP_END = 'cropend';
+export const EVENT_CROP_MOVE = 'cropmove';
+export const EVENT_CROP_START = 'cropstart';
+export const EVENT_DBLCLICK = 'dblclick';
+export const EVENT_ERROR = 'error';
+export const EVENT_LOAD = 'load';
+export const EVENT_POINTER_DOWN = WINDOW.PointerEvent ? 'pointerdown' : 'touchstart mousedown';
+export const EVENT_POINTER_MOVE = WINDOW.PointerEvent ? 'pointermove' : 'touchmove mousemove';
+export const EVENT_POINTER_UP = WINDOW.PointerEvent ? 'pointerup pointercancel' : 'touchend touchcancel mouseup';
+export const EVENT_READY = 'ready';
+export const EVENT_RESIZE = 'resize';
+export const EVENT_WHEEL = 'wheel mousewheel DOMMouseScroll';
+export const EVENT_ZOOM = 'zoom';
+
+// RegExps
+export const REGEXP_ACTIONS = /^(?:e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/;
+export const REGEXP_DATA_URL = /^data:/;
+export const REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
+export const REGEXP_TAG_NAME = /^(?:img|canvas)$/i;
diff --git a/library/cropperjs/src/js/cropper.js b/library/cropperjs/src/js/cropper.js
new file mode 100644
index 000000000..97f3511df
--- /dev/null
+++ b/library/cropperjs/src/js/cropper.js
@@ -0,0 +1,421 @@
+import DEFAULTS from './defaults';
+import TEMPLATE from './template';
+import render from './render';
+import preview from './preview';
+import events from './events';
+import handlers from './handlers';
+import change from './change';
+import methods from './methods';
+import {
+ ACTION_ALL,
+ CLASS_HIDDEN,
+ CLASS_HIDE,
+ CLASS_INVISIBLE,
+ CLASS_MODAL,
+ CLASS_MOVE,
+ DATA_ACTION,
+ EVENT_CROP,
+ EVENT_ERROR,
+ EVENT_LOAD,
+ EVENT_READY,
+ NAMESPACE,
+ REGEXP_DATA_URL,
+ REGEXP_DATA_URL_JPEG,
+ REGEXP_TAG_NAME,
+ WINDOW,
+} from './constants';
+import {
+ addClass,
+ addListener,
+ addTimestamp,
+ arrayBufferToDataURL,
+ dataURLToArrayBuffer,
+ dispatchEvent,
+ extend,
+ getData,
+ getImageNaturalSizes,
+ getOrientation,
+ isCrossOriginURL,
+ isFunction,
+ isPlainObject,
+ parseOrientation,
+ proxy,
+ removeClass,
+ removeListener,
+ setData,
+} from './utilities';
+
+const AnotherCropper = WINDOW.Cropper;
+
+class Cropper {
+ /**
+ * Create a new Cropper.
+ * @param {Element} element - The target element for cropping.
+ * @param {Object} [options={}] - The configuration options.
+ */
+ constructor(element, options = {}) {
+ if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {
+ throw new Error('The first argument is required and must be an <img> or <canvas> element.');
+ }
+
+ this.element = element;
+ this.options = extend({}, DEFAULTS, isPlainObject(options) && options);
+ this.complete = false;
+ this.cropped = false;
+ this.disabled = false;
+ this.isImg = false;
+ this.limited = false;
+ this.loaded = false;
+ this.ready = false;
+ this.replaced = false;
+ this.wheeling = false;
+ this.originalUrl = '';
+ this.canvasData = null;
+ this.cropBoxData = null;
+ this.previews = null;
+ this.pointers = {};
+ this.init();
+ }
+
+ init() {
+ const { element } = this;
+ const tagName = element.tagName.toLowerCase();
+ let url;
+
+ if (getData(element, NAMESPACE)) {
+ return;
+ }
+
+ setData(element, NAMESPACE, this);
+
+ if (tagName === 'img') {
+ this.isImg = true;
+
+ // e.g.: "img/picture.jpg"
+ url = element.getAttribute('src') || '';
+ this.originalUrl = url;
+
+ // Stop when it's a blank image
+ if (!url) {
+ return;
+ }
+
+ // e.g.: "http://example.com/img/picture.jpg"
+ url = element.src;
+ } else if (tagName === 'canvas' && window.HTMLCanvasElement) {
+ url = element.toDataURL();
+ }
+
+ this.load(url);
+ }
+
+ load(url) {
+ if (!url) {
+ return;
+ }
+
+ this.url = url;
+ this.imageData = {};
+
+ const { element, options } = this;
+
+ if (!options.checkOrientation || !window.ArrayBuffer) {
+ this.clone();
+ return;
+ }
+
+ // XMLHttpRequest disallows to open a Data URL in some browsers like IE11 and Safari
+ if (REGEXP_DATA_URL.test(url)) {
+ if (REGEXP_DATA_URL_JPEG.test(url)) {
+ this.read(dataURLToArrayBuffer(url));
+ } else {
+ this.clone();
+ }
+
+ return;
+ }
+
+ const xhr = new XMLHttpRequest();
+
+ xhr.onerror = () => {
+ this.clone();
+ };
+
+ xhr.onload = () => {
+ this.read(xhr.response);
+ };
+
+ // Bust cache when there is a "crossOrigin" property
+ if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {
+ url = addTimestamp(url);
+ }
+
+ xhr.open('get', url);
+ xhr.responseType = 'arraybuffer';
+ xhr.withCredentials = element.crossOrigin === 'use-credentials';
+ xhr.send();
+ }
+
+ read(arrayBuffer) {
+ const { options, imageData } = this;
+ const orientation = getOrientation(arrayBuffer);
+ let rotate = 0;
+ let scaleX = 1;
+ let scaleY = 1;
+
+ if (orientation > 1) {
+ this.url = arrayBufferToDataURL(arrayBuffer, 'image/jpeg');
+ ({ rotate, scaleX, scaleY } = parseOrientation(orientation));
+ }
+
+ if (options.rotatable) {
+ imageData.rotate = rotate;
+ }
+
+ if (options.scalable) {
+ imageData.scaleX = scaleX;
+ imageData.scaleY = scaleY;
+ }
+
+ this.clone();
+ }
+
+ clone() {
+ const { element, url } = this;
+ let crossOrigin;
+ let crossOriginUrl;
+
+ if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {
+ ({ crossOrigin } = element);
+
+ if (crossOrigin) {
+ crossOriginUrl = url;
+ } else {
+ crossOrigin = 'anonymous';
+
+ // Bust cache when there is not a "crossOrigin" property
+ crossOriginUrl = addTimestamp(url);
+ }
+ }
+
+ this.crossOrigin = crossOrigin;
+ this.crossOriginUrl = crossOriginUrl;
+
+ const image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = crossOriginUrl || url;
+
+ const start = proxy(this.start, this);
+ const stop = proxy(this.stop, this);
+
+ this.image = image;
+ this.onStart = start;
+ this.onStop = stop;
+
+ if (this.isImg) {
+ if (element.complete) {
+ this.start();
+ } else {
+ addListener(element, EVENT_LOAD, start);
+ }
+ } else {
+ addListener(image, EVENT_LOAD, start);
+ addListener(image, EVENT_ERROR, stop);
+ addClass(image, CLASS_HIDE);
+ element.parentNode.insertBefore(image, element.nextSibling);
+ }
+ }
+
+ start(event) {
+ const image = this.isImg ? this.element : this.image;
+
+ if (event) {
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ }
+
+ getImageNaturalSizes(image, (naturalWidth, naturalHeight) => {
+ extend(this.imageData, {
+ naturalWidth,
+ naturalHeight,
+ aspectRatio: naturalWidth / naturalHeight,
+ });
+ this.loaded = true;
+ this.build();
+ });
+ }
+
+ stop() {
+ const { image } = this;
+
+ removeListener(image, EVENT_LOAD, this.onStart);
+ removeListener(image, EVENT_ERROR, this.onStop);
+ image.parentNode.removeChild(image);
+ this.image = null;
+ }
+
+ build() {
+ if (!this.loaded) {
+ return;
+ }
+
+ // Unbuild first when replace
+ if (this.ready) {
+ this.unbuild();
+ }
+
+ const { element, options, image } = this;
+
+ // Create cropper elements
+ const container = element.parentNode;
+ const template = document.createElement('div');
+
+ template.innerHTML = TEMPLATE;
+
+ const cropper = template.querySelector(`.${NAMESPACE}-container`);
+ const canvas = cropper.querySelector(`.${NAMESPACE}-canvas`);
+ const dragBox = cropper.querySelector(`.${NAMESPACE}-drag-box`);
+ const cropBox = cropper.querySelector(`.${NAMESPACE}-crop-box`);
+ const face = cropBox.querySelector(`.${NAMESPACE}-face`);
+
+ this.container = container;
+ this.cropper = cropper;
+ this.canvas = canvas;
+ this.dragBox = dragBox;
+ this.cropBox = cropBox;
+ this.viewBox = cropper.querySelector(`.${NAMESPACE}-view-box`);
+ this.face = face;
+
+ canvas.appendChild(image);
+
+ // Hide the original image
+ addClass(element, CLASS_HIDDEN);
+
+ // Inserts the cropper after to the current image
+ container.insertBefore(cropper, element.nextSibling);
+
+ // Show the image if is hidden
+ if (!this.isImg) {
+ removeClass(image, CLASS_HIDE);
+ }
+
+ this.initPreview();
+ this.bind();
+
+ options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;
+ options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;
+
+ this.cropped = options.autoCrop;
+
+ if (options.autoCrop) {
+ if (options.modal) {
+ addClass(dragBox, CLASS_MODAL);
+ }
+ } else {
+ addClass(cropBox, CLASS_HIDDEN);
+ }
+
+ if (!options.guides) {
+ addClass(cropBox.getElementsByClassName(`${NAMESPACE}-dashed`), CLASS_HIDDEN);
+ }
+
+ if (!options.center) {
+ addClass(cropBox.getElementsByClassName(`${NAMESPACE}-center`), CLASS_HIDDEN);
+ }
+
+ if (options.background) {
+ addClass(cropper, `${NAMESPACE}-bg`);
+ }
+
+ if (!options.highlight) {
+ addClass(face, CLASS_INVISIBLE);
+ }
+
+ if (options.cropBoxMovable) {
+ addClass(face, CLASS_MOVE);
+ setData(face, DATA_ACTION, ACTION_ALL);
+ }
+
+ if (!options.cropBoxResizable) {
+ addClass(cropBox.getElementsByClassName(`${NAMESPACE}-line`), CLASS_HIDDEN);
+ addClass(cropBox.getElementsByClassName(`${NAMESPACE}-point`), CLASS_HIDDEN);
+ }
+
+ this.setDragMode(options.dragMode);
+ this.render();
+ this.ready = true;
+ this.setData(options.data);
+
+ // Call the "ready" option asynchronously to keep "image.cropper" is defined
+ this.completing = setTimeout(() => {
+ if (isFunction(options.ready)) {
+ addListener(element, EVENT_READY, options.ready, {
+ once: true,
+ });
+ }
+
+ dispatchEvent(element, EVENT_READY);
+ dispatchEvent(element, EVENT_CROP, this.getData());
+
+ this.complete = true;
+ }, 0);
+ }
+
+ unbuild() {
+ if (!this.ready) {
+ return;
+ }
+
+ if (!this.complete) {
+ clearTimeout(this.completing);
+ }
+
+ this.ready = false;
+ this.complete = false;
+ this.initialImageData = null;
+
+ // Clear `initialCanvasData` is necessary when replace
+ this.initialCanvasData = null;
+ this.initialCropBoxData = null;
+ this.containerData = null;
+ this.canvasData = null;
+
+ // Clear `cropBoxData` is necessary when replace
+ this.cropBoxData = null;
+ this.unbind();
+ this.resetPreview();
+ this.previews = null;
+ this.viewBox = null;
+ this.cropBox = null;
+ this.dragBox = null;
+ this.canvas = null;
+ this.container = null;
+ this.cropper.parentNode.removeChild(this.cropper);
+ this.cropper = null;
+ }
+
+ /**
+ * Get the no conflict cropper class.
+ * @returns {Cropper} The cropper class.
+ */
+ static noConflict() {
+ window.Cropper = AnotherCropper;
+ return Cropper;
+ }
+
+ /**
+ * Change the default options.
+ * @param {Object} options - The new default options.
+ */
+ static setDefaults(options) {
+ extend(DEFAULTS, isPlainObject(options) && options);
+ }
+}
+
+extend(Cropper.prototype, render, preview, events, handlers, change, methods);
+
+export default Cropper;
diff --git a/library/cropperjs/src/js/defaults.js b/library/cropperjs/src/js/defaults.js
new file mode 100644
index 000000000..aa469e73a
--- /dev/null
+++ b/library/cropperjs/src/js/defaults.js
@@ -0,0 +1,99 @@
+import {
+ DRAG_MODE_CROP,
+} from './constants';
+
+export default {
+ // Define the view mode of the cropper
+ viewMode: 0, // 0, 1, 2, 3
+
+ // Define the dragging mode of the cropper
+ dragMode: DRAG_MODE_CROP, // 'crop', 'move' or 'none'
+
+ // Define the aspect ratio of the crop box
+ aspectRatio: NaN,
+
+ // An object with the previous cropping result data
+ data: null,
+
+ // A selector for adding extra containers to preview
+ preview: '',
+
+ // Re-render the cropper when resize the window
+ responsive: true,
+
+ // Restore the cropped area after resize the window
+ restore: true,
+
+ // Check if the current image is a cross-origin image
+ checkCrossOrigin: true,
+
+ // Check the current image's Exif Orientation information
+ checkOrientation: true,
+
+ // Show the black modal
+ modal: true,
+
+ // Show the dashed lines for guiding
+ guides: true,
+
+ // Show the center indicator for guiding
+ center: true,
+
+ // Show the white modal to highlight the crop box
+ highlight: true,
+
+ // Show the grid background
+ background: true,
+
+ // Enable to crop the image automatically when initialize
+ autoCrop: true,
+
+ // Define the percentage of automatic cropping area when initializes
+ autoCropArea: 0.8,
+
+ // Enable to move the image
+ movable: true,
+
+ // Enable to rotate the image
+ rotatable: true,
+
+ // Enable to scale the image
+ scalable: true,
+
+ // Enable to zoom the image
+ zoomable: true,
+
+ // Enable to zoom the image by dragging touch
+ zoomOnTouch: true,
+
+ // Enable to zoom the image by wheeling mouse
+ zoomOnWheel: true,
+
+ // Define zoom ratio when zoom the image by wheeling mouse
+ wheelZoomRatio: 0.1,
+
+ // Enable to move the crop box
+ cropBoxMovable: true,
+
+ // Enable to resize the crop box
+ cropBoxResizable: true,
+
+ // Toggle drag mode between "crop" and "move" when click twice on the cropper
+ toggleDragModeOnDblclick: true,
+
+ // Size limitation
+ minCanvasWidth: 0,
+ minCanvasHeight: 0,
+ minCropBoxWidth: 0,
+ minCropBoxHeight: 0,
+ minContainerWidth: 200,
+ minContainerHeight: 100,
+
+ // Shortcuts of events
+ ready: null,
+ cropstart: null,
+ cropmove: null,
+ cropend: null,
+ crop: null,
+ zoom: null,
+};
diff --git a/library/cropperjs/src/js/events.js b/library/cropperjs/src/js/events.js
new file mode 100644
index 000000000..3753db022
--- /dev/null
+++ b/library/cropperjs/src/js/events.js
@@ -0,0 +1,111 @@
+import {
+ EVENT_CROP,
+ EVENT_CROP_END,
+ EVENT_CROP_MOVE,
+ EVENT_CROP_START,
+ EVENT_DBLCLICK,
+ EVENT_POINTER_DOWN,
+ EVENT_POINTER_MOVE,
+ EVENT_POINTER_UP,
+ EVENT_RESIZE,
+ EVENT_WHEEL,
+ EVENT_ZOOM,
+} from './constants';
+import {
+ addListener,
+ isFunction,
+ proxy,
+ removeListener,
+} from './utilities';
+
+export default {
+ bind() {
+ const { element, options, cropper } = this;
+
+ if (isFunction(options.cropstart)) {
+ addListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ addListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ addListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ addListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ addListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ addListener(cropper, EVENT_POINTER_DOWN, (this.onCropStart = proxy(this.cropStart, this)));
+
+ if (options.zoomable && options.zoomOnWheel) {
+ addListener(cropper, EVENT_WHEEL, (this.onWheel = proxy(this.wheel, this)));
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ addListener(cropper, EVENT_DBLCLICK, (this.onDblclick = proxy(this.dblclick, this)));
+ }
+
+ addListener(
+ element.ownerDocument,
+ EVENT_POINTER_MOVE,
+ (this.onCropMove = proxy(this.cropMove, this)),
+ );
+ addListener(
+ element.ownerDocument,
+ EVENT_POINTER_UP,
+ (this.onCropEnd = proxy(this.cropEnd, this)),
+ );
+
+ if (options.responsive) {
+ addListener(window, EVENT_RESIZE, (this.onResize = proxy(this.resize, this)));
+ }
+ },
+
+ unbind() {
+ const { element, options, cropper } = this;
+
+ if (isFunction(options.cropstart)) {
+ removeListener(element, EVENT_CROP_START, options.cropstart);
+ }
+
+ if (isFunction(options.cropmove)) {
+ removeListener(element, EVENT_CROP_MOVE, options.cropmove);
+ }
+
+ if (isFunction(options.cropend)) {
+ removeListener(element, EVENT_CROP_END, options.cropend);
+ }
+
+ if (isFunction(options.crop)) {
+ removeListener(element, EVENT_CROP, options.crop);
+ }
+
+ if (isFunction(options.zoom)) {
+ removeListener(element, EVENT_ZOOM, options.zoom);
+ }
+
+ removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);
+
+ if (options.zoomable && options.zoomOnWheel) {
+ removeListener(cropper, EVENT_WHEEL, this.onWheel);
+ }
+
+ if (options.toggleDragModeOnDblclick) {
+ removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);
+ }
+
+ removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);
+ removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);
+
+ if (options.responsive) {
+ removeListener(window, EVENT_RESIZE, this.onResize);
+ }
+ },
+};
diff --git a/library/cropperjs/src/js/handlers.js b/library/cropperjs/src/js/handlers.js
new file mode 100644
index 000000000..7b7b2469a
--- /dev/null
+++ b/library/cropperjs/src/js/handlers.js
@@ -0,0 +1,212 @@
+import {
+ ACTION_CROP,
+ ACTION_ZOOM,
+ CLASS_CROP,
+ CLASS_MODAL,
+ DATA_ACTION,
+ DRAG_MODE_CROP,
+ DRAG_MODE_MOVE,
+ DRAG_MODE_NONE,
+ EVENT_CROP_END,
+ EVENT_CROP_MOVE,
+ EVENT_CROP_START,
+ REGEXP_ACTIONS,
+} from './constants';
+import {
+ addClass,
+ dispatchEvent,
+ each,
+ extend,
+ getData,
+ getPointer,
+ hasClass,
+ toggleClass,
+} from './utilities';
+
+export default {
+ resize() {
+ const { options, container, containerData } = this;
+ const minContainerWidth = Number(options.minContainerWidth) || 200;
+ const minContainerHeight = Number(options.minContainerHeight) || 100;
+
+ if (this.disabled || containerData.width <= minContainerWidth ||
+ containerData.height <= minContainerHeight) {
+ return;
+ }
+
+ const ratio = container.offsetWidth / containerData.width;
+
+ // Resize when width changed or height changed
+ if (ratio !== 1 || container.offsetHeight !== containerData.height) {
+ let canvasData;
+ let cropBoxData;
+
+ if (options.restore) {
+ canvasData = this.getCanvasData();
+ cropBoxData = this.getCropBoxData();
+ }
+
+ this.render();
+
+ if (options.restore) {
+ this.setCanvasData(each(canvasData, (n, i) => {
+ canvasData[i] = n * ratio;
+ }));
+ this.setCropBoxData(each(cropBoxData, (n, i) => {
+ cropBoxData[i] = n * ratio;
+ }));
+ }
+ }
+ },
+
+ dblclick() {
+ if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {
+ return;
+ }
+
+ this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);
+ },
+
+ wheel(e) {
+ const ratio = Number(this.options.wheelZoomRatio) || 0.1;
+ let delta = 1;
+
+ if (this.disabled) {
+ return;
+ }
+
+ e.preventDefault();
+
+ // Limit wheel speed to prevent zoom too fast (#21)
+ if (this.wheeling) {
+ return;
+ }
+
+ this.wheeling = true;
+
+ setTimeout(() => {
+ this.wheeling = false;
+ }, 50);
+
+ if (e.deltaY) {
+ delta = e.deltaY > 0 ? 1 : -1;
+ } else if (e.wheelDelta) {
+ delta = -e.wheelDelta / 120;
+ } else if (e.detail) {
+ delta = e.detail > 0 ? 1 : -1;
+ }
+
+ this.zoom(-delta * ratio, e);
+ },
+
+ cropStart(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ const { options, pointers } = this;
+ let action;
+
+ if (e.changedTouches) {
+ // Handle touch event
+ each(e.changedTouches, (touch) => {
+ pointers[touch.identifier] = getPointer(touch);
+ });
+ } else {
+ // Handle mouse event and pointer event
+ pointers[e.pointerId || 0] = getPointer(e);
+ }
+
+ if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
+ action = ACTION_ZOOM;
+ } else {
+ action = getData(e.target, DATA_ACTION);
+ }
+
+ if (!REGEXP_ACTIONS.test(action)) {
+ return;
+ }
+
+ if (dispatchEvent(this.element, EVENT_CROP_START, {
+ originalEvent: e,
+ action,
+ }) === false) {
+ return;
+ }
+
+ e.preventDefault();
+
+ this.action = action;
+ this.cropping = false;
+
+ if (action === ACTION_CROP) {
+ this.cropping = true;
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+ },
+
+ cropMove(e) {
+ const { action } = this;
+
+ if (this.disabled || !action) {
+ return;
+ }
+
+ const { pointers } = this;
+
+ e.preventDefault();
+
+ if (dispatchEvent(this.element, EVENT_CROP_MOVE, {
+ originalEvent: e,
+ action,
+ }) === false) {
+ return;
+ }
+
+ if (e.changedTouches) {
+ each(e.changedTouches, (touch) => {
+ extend(pointers[touch.identifier], getPointer(touch, true));
+ });
+ } else {
+ extend(pointers[e.pointerId || 0], getPointer(e, true));
+ }
+
+ this.change(e);
+ },
+
+ cropEnd(e) {
+ if (this.disabled) {
+ return;
+ }
+
+ const { action, pointers } = this;
+
+ if (e.changedTouches) {
+ each(e.changedTouches, (touch) => {
+ delete pointers[touch.identifier];
+ });
+ } else {
+ delete pointers[e.pointerId || 0];
+ }
+
+ if (!action) {
+ return;
+ }
+
+ e.preventDefault();
+
+ if (!Object.keys(pointers).length) {
+ this.action = '';
+ }
+
+ if (this.cropping) {
+ this.cropping = false;
+ toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);
+ }
+
+ dispatchEvent(this.element, EVENT_CROP_END, {
+ originalEvent: e,
+ action,
+ });
+ },
+};
diff --git a/library/cropperjs/src/js/methods.js b/library/cropperjs/src/js/methods.js
new file mode 100644
index 000000000..3627d2bd1
--- /dev/null
+++ b/library/cropperjs/src/js/methods.js
@@ -0,0 +1,842 @@
+import {
+ CLASS_CROP,
+ CLASS_DISABLED,
+ CLASS_HIDDEN,
+ CLASS_MODAL,
+ CLASS_MOVE,
+ DATA_ACTION,
+ DRAG_MODE_CROP,
+ DRAG_MODE_MOVE,
+ DRAG_MODE_NONE,
+ EVENT_LOAD,
+ EVENT_ZOOM,
+ NAMESPACE,
+} from './constants';
+import {
+ addClass,
+ dispatchEvent,
+ each,
+ extend,
+ getAdjustedSizes,
+ getOffset,
+ getPointersCenter,
+ getSourceCanvas,
+ isFunction,
+ isNumber,
+ isPlainObject,
+ isUndefined,
+ normalizeDecimalNumber,
+ removeClass,
+ removeData,
+ removeListener,
+ setData,
+ toggleClass,
+} from './utilities';
+
+export default {
+ // Show the crop box manually
+ crop() {
+ if (this.ready && !this.disabled) {
+ if (!this.cropped) {
+ this.cropped = true;
+ this.limitCropBox(true, true);
+
+ if (this.options.modal) {
+ addClass(this.dragBox, CLASS_MODAL);
+ }
+
+ removeClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ this.setCropBoxData(this.initialCropBoxData);
+ }
+
+ return this;
+ },
+
+ // Reset the image and crop box to their initial states
+ reset() {
+ if (this.ready && !this.disabled) {
+ this.imageData = extend({}, this.initialImageData);
+ this.canvasData = extend({}, this.initialCanvasData);
+ this.cropBoxData = extend({}, this.initialCropBoxData);
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+
+ return this;
+ },
+
+ // Clear the crop box
+ clear() {
+ if (this.cropped && !this.disabled) {
+ extend(this.cropBoxData, {
+ left: 0,
+ top: 0,
+ width: 0,
+ height: 0,
+ });
+
+ this.cropped = false;
+ this.renderCropBox();
+ this.limitCanvas(true, true);
+
+ // Render canvas after crop box rendered
+ this.renderCanvas();
+ removeClass(this.dragBox, CLASS_MODAL);
+ addClass(this.cropBox, CLASS_HIDDEN);
+ }
+
+ return this;
+ },
+
+ /**
+ * Replace the image's src and rebuild the cropper
+ * @param {string} url - The new URL.
+ * @param {boolean} [onlyColorChanged] - Indicate if the new image only changed color.
+ * @returns {Object} this
+ */
+ replace(url, onlyColorChanged = false) {
+ if (!this.disabled && url) {
+ if (this.isImg) {
+ this.element.src = url;
+ }
+
+ if (onlyColorChanged) {
+ this.url = url;
+ this.image.src = url;
+
+ if (this.ready) {
+ this.image2.src = url;
+
+ each(this.previews, (element) => {
+ element.getElementsByTagName('img')[0].src = url;
+ });
+ }
+ } else {
+ if (this.isImg) {
+ this.replaced = true;
+ }
+
+ // Clear previous data
+ this.options.data = null;
+ this.load(url);
+ }
+ }
+
+ return this;
+ },
+
+ // Enable (unfreeze) the cropper
+ enable() {
+ if (this.ready) {
+ this.disabled = false;
+ removeClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+ // Disable (freeze) the cropper
+ disable() {
+ if (this.ready) {
+ this.disabled = true;
+ addClass(this.cropper, CLASS_DISABLED);
+ }
+
+ return this;
+ },
+
+ // Destroy the cropper and remove the instance from the image
+ destroy() {
+ const { element, image } = this;
+
+ if (this.loaded) {
+ if (this.isImg && this.replaced) {
+ element.src = this.originalUrl;
+ }
+
+ this.unbuild();
+ removeClass(element, CLASS_HIDDEN);
+ } else if (this.isImg) {
+ removeListener(element, EVENT_LOAD, this.onStart);
+ } else if (image) {
+ image.parentNode.removeChild(image);
+ }
+
+ removeData(element, NAMESPACE);
+
+ return this;
+ },
+
+ /**
+ * Move the canvas with relative offsets
+ * @param {number} offsetX - The relative offset distance on the x-axis.
+ * @param {number} offsetY - The relative offset distance on the y-axis.
+ * @returns {Object} this
+ */
+ move(offsetX, offsetY) {
+ const { left, top } = this.canvasData;
+
+ return this.moveTo(
+ isUndefined(offsetX) ? offsetX : (left + Number(offsetX)),
+ isUndefined(offsetY) ? offsetY : (top + Number(offsetY)),
+ );
+ },
+
+ /**
+ * Move the canvas to an absolute point
+ * @param {number} x - The x-axis coordinate.
+ * @param {number} [y=x] - The y-axis coordinate.
+ * @returns {Object} this
+ */
+ moveTo(x, y = x) {
+ const { canvasData } = this;
+ let changed = false;
+
+ x = Number(x);
+ y = Number(y);
+
+ if (this.ready && !this.disabled && this.options.movable) {
+ if (isNumber(x)) {
+ canvasData.left = x;
+ changed = true;
+ }
+
+ if (isNumber(y)) {
+ canvasData.top = y;
+ changed = true;
+ }
+
+ if (changed) {
+ this.renderCanvas(true);
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Zoom the canvas with a relative ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoom(ratio, _originalEvent) {
+ const { canvasData } = this;
+
+ ratio = Number(ratio);
+
+ if (ratio < 0) {
+ ratio = 1 / (1 - ratio);
+ } else {
+ ratio = 1 + ratio;
+ }
+
+ return this.zoomTo((canvasData.width * ratio) / canvasData.naturalWidth, null, _originalEvent);
+ },
+
+ /**
+ * Zoom the canvas to an absolute ratio
+ * @param {number} ratio - The target ratio.
+ * @param {Object} pivot - The zoom pivot point coordinate.
+ * @param {Event} _originalEvent - The original event if any.
+ * @returns {Object} this
+ */
+ zoomTo(ratio, pivot, _originalEvent) {
+ const { options, canvasData } = this;
+ const {
+ width,
+ height,
+ naturalWidth,
+ naturalHeight,
+ } = canvasData;
+
+ ratio = Number(ratio);
+
+ if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {
+ const newWidth = naturalWidth * ratio;
+ const newHeight = naturalHeight * ratio;
+
+ if (dispatchEvent(this.element, EVENT_ZOOM, {
+ originalEvent: _originalEvent,
+ oldRatio: width / naturalWidth,
+ ratio: newWidth / naturalWidth,
+ }) === false) {
+ return this;
+ }
+
+ if (_originalEvent) {
+ const { pointers } = this;
+ const offset = getOffset(this.cropper);
+ const center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {
+ pageX: _originalEvent.pageX,
+ pageY: _originalEvent.pageY,
+ };
+
+ // Zoom from the triggering point of the event
+ canvasData.left -= (newWidth - width) * (
+ ((center.pageX - offset.left) - canvasData.left) / width
+ );
+ canvasData.top -= (newHeight - height) * (
+ ((center.pageY - offset.top) - canvasData.top) / height
+ );
+ } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {
+ canvasData.left -= (newWidth - width) * (
+ (pivot.x - canvasData.left) / width
+ );
+ canvasData.top -= (newHeight - height) * (
+ (pivot.y - canvasData.top) / height
+ );
+ } else {
+ // Zoom from the center of the canvas
+ canvasData.left -= (newWidth - width) / 2;
+ canvasData.top -= (newHeight - height) / 2;
+ }
+
+ canvasData.width = newWidth;
+ canvasData.height = newHeight;
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+ /**
+ * Rotate the canvas with a relative degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotate(degree) {
+ return this.rotateTo((this.imageData.rotate || 0) + Number(degree));
+ },
+
+ /**
+ * Rotate the canvas to an absolute degree
+ * @param {number} degree - The rotate degree.
+ * @returns {Object} this
+ */
+ rotateTo(degree) {
+ degree = Number(degree);
+
+ if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {
+ this.imageData.rotate = degree % 360;
+ this.renderCanvas(true, true);
+ }
+
+ return this;
+ },
+
+ /**
+ * Scale the image on the x-axis.
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @returns {Object} this
+ */
+ scaleX(scaleX) {
+ const { scaleY } = this.imageData;
+
+ return this.scale(scaleX, isNumber(scaleY) ? scaleY : 1);
+ },
+
+ /**
+ * Scale the image on the y-axis.
+ * @param {number} scaleY - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scaleY(scaleY) {
+ const { scaleX } = this.imageData;
+
+ return this.scale(isNumber(scaleX) ? scaleX : 1, scaleY);
+ },
+
+ /**
+ * Scale the image
+ * @param {number} scaleX - The scale ratio on the x-axis.
+ * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
+ * @returns {Object} this
+ */
+ scale(scaleX, scaleY = scaleX) {
+ const { imageData } = this;
+ let transformed = false;
+
+ scaleX = Number(scaleX);
+ scaleY = Number(scaleY);
+
+ if (this.ready && !this.disabled && this.options.scalable) {
+ if (isNumber(scaleX)) {
+ imageData.scaleX = scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(scaleY)) {
+ imageData.scaleY = scaleY;
+ transformed = true;
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Get the cropped area position and size data (base on the original image)
+ * @param {boolean} [rounded=false] - Indicate if round the data values or not.
+ * @returns {Object} The result cropped data.
+ */
+ getData(rounded = false) {
+ const {
+ options,
+ imageData,
+ canvasData,
+ cropBoxData,
+ } = this;
+ let data;
+
+ if (this.ready && this.cropped) {
+ data = {
+ x: cropBoxData.left - canvasData.left,
+ y: cropBoxData.top - canvasData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height,
+ };
+
+ const ratio = imageData.width / imageData.naturalWidth;
+
+ each(data, (n, i) => {
+ n /= ratio;
+ data[i] = rounded ? Math.round(n) : n;
+ });
+ } else {
+ data = {
+ x: 0,
+ y: 0,
+ width: 0,
+ height: 0,
+ };
+ }
+
+ if (options.rotatable) {
+ data.rotate = imageData.rotate || 0;
+ }
+
+ if (options.scalable) {
+ data.scaleX = imageData.scaleX || 1;
+ data.scaleY = imageData.scaleY || 1;
+ }
+
+ return data;
+ },
+
+ /**
+ * Set the cropped area position and size with new data
+ * @param {Object} data - The new data.
+ * @returns {Object} this
+ */
+ setData(data) {
+ const { options, imageData, canvasData } = this;
+ const cropBoxData = {};
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ let transformed = false;
+
+ if (options.rotatable) {
+ if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
+ imageData.rotate = data.rotate;
+ transformed = true;
+ }
+ }
+
+ if (options.scalable) {
+ if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
+ imageData.scaleX = data.scaleX;
+ transformed = true;
+ }
+
+ if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
+ imageData.scaleY = data.scaleY;
+ transformed = true;
+ }
+ }
+
+ if (transformed) {
+ this.renderCanvas(true, true);
+ }
+
+ const ratio = imageData.width / imageData.naturalWidth;
+
+ if (isNumber(data.x)) {
+ cropBoxData.left = (data.x * ratio) + canvasData.left;
+ }
+
+ if (isNumber(data.y)) {
+ cropBoxData.top = (data.y * ratio) + canvasData.top;
+ }
+
+ if (isNumber(data.width)) {
+ cropBoxData.width = data.width * ratio;
+ }
+
+ if (isNumber(data.height)) {
+ cropBoxData.height = data.height * ratio;
+ }
+
+ this.setCropBoxData(cropBoxData);
+ }
+
+ return this;
+ },
+
+ /**
+ * Get the container size data.
+ * @returns {Object} The result container data.
+ */
+ getContainerData() {
+ return this.ready ? extend({}, this.containerData) : {};
+ },
+
+ /**
+ * Get the image position and size data.
+ * @returns {Object} The result image data.
+ */
+ getImageData() {
+ return this.loaded ? extend({}, this.imageData) : {};
+ },
+
+ /**
+ * Get the canvas position and size data.
+ * @returns {Object} The result canvas data.
+ */
+ getCanvasData() {
+ const { canvasData } = this;
+ const data = {};
+
+ if (this.ready) {
+ each([
+ 'left',
+ 'top',
+ 'width',
+ 'height',
+ 'naturalWidth',
+ 'naturalHeight',
+ ], (n) => {
+ data[n] = canvasData[n];
+ });
+ }
+
+ return data;
+ },
+
+ /**
+ * Set the canvas position and size with new data.
+ * @param {Object} data - The new canvas data.
+ * @returns {Object} this
+ */
+ setCanvasData(data) {
+ const { canvasData } = this;
+ const { aspectRatio } = canvasData;
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ canvasData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ canvasData.top = data.top;
+ }
+
+ if (isNumber(data.width)) {
+ canvasData.width = data.width;
+ canvasData.height = data.width / aspectRatio;
+ } else if (isNumber(data.height)) {
+ canvasData.height = data.height;
+ canvasData.width = data.height * aspectRatio;
+ }
+
+ this.renderCanvas(true);
+ }
+
+ return this;
+ },
+
+ /**
+ * Get the crop box position and size data.
+ * @returns {Object} The result crop box data.
+ */
+ getCropBoxData() {
+ const { cropBoxData } = this;
+ let data;
+
+ if (this.ready && this.cropped) {
+ data = {
+ left: cropBoxData.left,
+ top: cropBoxData.top,
+ width: cropBoxData.width,
+ height: cropBoxData.height,
+ };
+ }
+
+ return data || {};
+ },
+
+ /**
+ * Set the crop box position and size with new data.
+ * @param {Object} data - The new crop box data.
+ * @returns {Object} this
+ */
+ setCropBoxData(data) {
+ const { cropBoxData } = this;
+ const { aspectRatio } = this.options;
+ let widthChanged;
+ let heightChanged;
+
+ if (isFunction(data)) {
+ data = data.call(this.element);
+ }
+
+ if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
+ if (isNumber(data.left)) {
+ cropBoxData.left = data.left;
+ }
+
+ if (isNumber(data.top)) {
+ cropBoxData.top = data.top;
+ }
+
+ if (isNumber(data.width) && data.width !== cropBoxData.width) {
+ widthChanged = true;
+ cropBoxData.width = data.width;
+ }
+
+ if (isNumber(data.height) && data.height !== cropBoxData.height) {
+ heightChanged = true;
+ cropBoxData.height = data.height;
+ }
+
+ if (aspectRatio) {
+ if (widthChanged) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else if (heightChanged) {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.renderCropBox();
+ }
+
+ return this;
+ },
+
+ /**
+ * Get a canvas drawn the cropped image.
+ * @param {Object} [options={}] - The config options.
+ * @returns {HTMLCanvasElement} - The result canvas.
+ */
+ getCroppedCanvas(options = {}) {
+ if (!this.ready || !window.HTMLCanvasElement) {
+ return null;
+ }
+
+ const { canvasData } = this;
+ const source = getSourceCanvas(this.image, this.imageData, canvasData, options);
+
+ // Returns the source canvas if it is not cropped.
+ if (!this.cropped) {
+ return source;
+ }
+
+ let {
+ x: initialX,
+ y: initialY,
+ width: initialWidth,
+ height: initialHeight,
+ } = this.getData();
+ const ratio = source.width / Math.floor(canvasData.naturalWidth);
+
+ if (ratio !== 1) {
+ initialX *= ratio;
+ initialY *= ratio;
+ initialWidth *= ratio;
+ initialHeight *= ratio;
+ }
+
+ const aspectRatio = initialWidth / initialHeight;
+ const maxSizes = getAdjustedSizes({
+ aspectRatio,
+ width: options.maxWidth || Infinity,
+ height: options.maxHeight || Infinity,
+ });
+ const minSizes = getAdjustedSizes({
+ aspectRatio,
+ width: options.minWidth || 0,
+ height: options.minHeight || 0,
+ }, 'cover');
+ let {
+ width,
+ height,
+ } = getAdjustedSizes({
+ aspectRatio,
+ width: options.width || (ratio !== 1 ? source.width : initialWidth),
+ height: options.height || (ratio !== 1 ? source.height : initialHeight),
+ });
+
+ width = Math.min(maxSizes.width, Math.max(minSizes.width, width));
+ height = Math.min(maxSizes.height, Math.max(minSizes.height, height));
+
+ const canvas = document.createElement('canvas');
+ const context = canvas.getContext('2d');
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+
+ context.fillStyle = options.fillColor || 'transparent';
+ context.fillRect(0, 0, width, height);
+
+ const { imageSmoothingEnabled = true, imageSmoothingQuality } = options;
+
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+
+ if (imageSmoothingQuality) {
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ }
+
+ // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage
+ const sourceWidth = source.width;
+ const sourceHeight = source.height;
+
+ // Source canvas parameters
+ let srcX = initialX;
+ let srcY = initialY;
+ let srcWidth;
+ let srcHeight;
+
+ // Destination canvas parameters
+ let dstX;
+ let dstY;
+ let dstWidth;
+ let dstHeight;
+
+ if (srcX <= -initialWidth || srcX > sourceWidth) {
+ srcX = 0;
+ srcWidth = 0;
+ dstX = 0;
+ dstWidth = 0;
+ } else if (srcX <= 0) {
+ dstX = -srcX;
+ srcX = 0;
+ srcWidth = Math.min(sourceWidth, initialWidth + srcX);
+ dstWidth = srcWidth;
+ } else if (srcX <= sourceWidth) {
+ dstX = 0;
+ srcWidth = Math.min(initialWidth, sourceWidth - srcX);
+ dstWidth = srcWidth;
+ }
+
+ if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {
+ srcY = 0;
+ srcHeight = 0;
+ dstY = 0;
+ dstHeight = 0;
+ } else if (srcY <= 0) {
+ dstY = -srcY;
+ srcY = 0;
+ srcHeight = Math.min(sourceHeight, initialHeight + srcY);
+ dstHeight = srcHeight;
+ } else if (srcY <= sourceHeight) {
+ dstY = 0;
+ srcHeight = Math.min(initialHeight, sourceHeight - srcY);
+ dstHeight = srcHeight;
+ }
+
+ // All the numerical parameters should be integer for `drawImage`
+ // https://github.com/fengyuanchen/cropper/issues/476
+ const params = [
+ srcX,
+ srcY,
+ srcWidth,
+ srcHeight,
+ ];
+
+ // Avoid "IndexSizeError"
+ if (dstWidth > 0 && dstHeight > 0) {
+ const scale = width / initialWidth;
+
+ params.push(
+ dstX * scale,
+ dstY * scale,
+ dstWidth * scale,
+ dstHeight * scale,
+ );
+ }
+
+ context.drawImage(source, ...params.map(param => Math.floor(normalizeDecimalNumber(param))));
+
+ return canvas;
+ },
+
+ /**
+ * Change the aspect ratio of the crop box.
+ * @param {number} aspectRatio - The new aspect ratio.
+ * @returns {Object} this
+ */
+ setAspectRatio(aspectRatio) {
+ const { options } = this;
+
+ if (!this.disabled && !isUndefined(aspectRatio)) {
+ // 0 -> NaN
+ options.aspectRatio = Math.max(0, aspectRatio) || NaN;
+
+ if (this.ready) {
+ this.initCropBox();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Change the drag mode.
+ * @param {string} mode - The new drag mode.
+ * @returns {Object} this
+ */
+ setDragMode(mode) {
+ const { options, dragBox, face } = this;
+
+ if (this.loaded && !this.disabled) {
+ const croppable = mode === DRAG_MODE_CROP;
+ const movable = options.movable && mode === DRAG_MODE_MOVE;
+
+ mode = (croppable || movable) ? mode : DRAG_MODE_NONE;
+
+ setData(dragBox, DATA_ACTION, mode);
+ toggleClass(dragBox, CLASS_CROP, croppable);
+ toggleClass(dragBox, CLASS_MOVE, movable);
+
+ if (!options.cropBoxMovable) {
+ // Sync drag mode to crop box when it is not movable
+ setData(face, DATA_ACTION, mode);
+ toggleClass(face, CLASS_CROP, croppable);
+ toggleClass(face, CLASS_MOVE, movable);
+ }
+ }
+
+ return this;
+ },
+};
diff --git a/library/cropperjs/src/js/preview.js b/library/cropperjs/src/js/preview.js
new file mode 100644
index 000000000..c47d03f4b
--- /dev/null
+++ b/library/cropperjs/src/js/preview.js
@@ -0,0 +1,142 @@
+import {
+ DATA_PREVIEW,
+} from './constants';
+import {
+ each,
+ empty,
+ extend,
+ getData,
+ getTransforms,
+ removeData,
+ setData,
+ setStyle,
+} from './utilities';
+
+export default {
+ initPreview() {
+ const { crossOrigin } = this;
+ const { preview } = this.options;
+ const url = crossOrigin ? this.crossOriginUrl : this.url;
+ const image = document.createElement('img');
+
+ if (crossOrigin) {
+ image.crossOrigin = crossOrigin;
+ }
+
+ image.src = url;
+ this.viewBox.appendChild(image);
+ this.image2 = image;
+
+ if (!preview) {
+ return;
+ }
+
+ const previews = preview.querySelector ? [preview] : document.querySelectorAll(preview);
+
+ this.previews = previews;
+
+ each(previews, (element) => {
+ const img = document.createElement('img');
+
+ // Save the original size for recover
+ setData(element, DATA_PREVIEW, {
+ width: element.offsetWidth,
+ height: element.offsetHeight,
+ html: element.innerHTML,
+ });
+
+ if (crossOrigin) {
+ img.crossOrigin = crossOrigin;
+ }
+
+ img.src = url;
+
+ /**
+ * Override img element styles
+ * Add `display:block` to avoid margin top issue
+ * Add `height:auto` to override `height` attribute on IE8
+ * (Occur only when margin-top <= -height)
+ */
+ img.style.cssText = (
+ 'display:block;' +
+ 'width:100%;' +
+ 'height:auto;' +
+ 'min-width:0!important;' +
+ 'min-height:0!important;' +
+ 'max-width:none!important;' +
+ 'max-height:none!important;' +
+ 'image-orientation:0deg!important;"'
+ );
+
+ empty(element);
+ element.appendChild(img);
+ });
+ },
+
+ resetPreview() {
+ each(this.previews, (element) => {
+ const data = getData(element, DATA_PREVIEW);
+
+ setStyle(element, {
+ width: data.width,
+ height: data.height,
+ });
+
+ element.innerHTML = data.html;
+ removeData(element, DATA_PREVIEW);
+ });
+ },
+
+ preview() {
+ const { imageData, canvasData, cropBoxData } = this;
+ const { width: cropBoxWidth, height: cropBoxHeight } = cropBoxData;
+ const { width, height } = imageData;
+ const left = cropBoxData.left - canvasData.left - imageData.left;
+ const top = cropBoxData.top - canvasData.top - imageData.top;
+
+ if (!this.cropped || this.disabled) {
+ return;
+ }
+
+ setStyle(this.image2, extend({
+ width,
+ height,
+ }, getTransforms(extend({
+ translateX: -left,
+ translateY: -top,
+ }, imageData))));
+
+ each(this.previews, (element) => {
+ const data = getData(element, DATA_PREVIEW);
+ const originalWidth = data.width;
+ const originalHeight = data.height;
+ let newWidth = originalWidth;
+ let newHeight = originalHeight;
+ let ratio = 1;
+
+ if (cropBoxWidth) {
+ ratio = originalWidth / cropBoxWidth;
+ newHeight = cropBoxHeight * ratio;
+ }
+
+ if (cropBoxHeight && newHeight > originalHeight) {
+ ratio = originalHeight / cropBoxHeight;
+ newWidth = cropBoxWidth * ratio;
+ newHeight = originalHeight;
+ }
+
+ setStyle(element, {
+ width: newWidth,
+ height: newHeight,
+ });
+
+ setStyle(element.getElementsByTagName('img')[0], extend({
+ width: width * ratio,
+ height: height * ratio,
+ }, getTransforms(extend({
+ translateX: -left * ratio,
+ translateY: -top * ratio,
+ }, imageData))));
+ });
+ },
+};
diff --git a/library/cropperjs/src/js/render.js b/library/cropperjs/src/js/render.js
new file mode 100644
index 000000000..09085ce41
--- /dev/null
+++ b/library/cropperjs/src/js/render.js
@@ -0,0 +1,495 @@
+import {
+ ACTION_ALL,
+ ACTION_MOVE,
+ CLASS_HIDDEN,
+ DATA_ACTION,
+ EVENT_CROP,
+} from './constants';
+import {
+ addClass,
+ dispatchEvent,
+ extend,
+ getAdjustedSizes,
+ getRotatedSizes,
+ getTransforms,
+ removeClass,
+ setData,
+ setStyle,
+} from './utilities';
+
+export default {
+ render() {
+ this.initContainer();
+ this.initCanvas();
+ this.initCropBox();
+ this.renderCanvas();
+
+ if (this.cropped) {
+ this.renderCropBox();
+ }
+ },
+
+ initContainer() {
+ const {
+ element,
+ options,
+ container,
+ cropper,
+ } = this;
+
+ addClass(cropper, CLASS_HIDDEN);
+ removeClass(element, CLASS_HIDDEN);
+
+ const containerData = {
+ width: Math.max(
+ container.offsetWidth,
+ Number(options.minContainerWidth) || 200,
+ ),
+ height: Math.max(
+ container.offsetHeight,
+ Number(options.minContainerHeight) || 100,
+ ),
+ };
+
+ this.containerData = containerData;
+
+ setStyle(cropper, {
+ width: containerData.width,
+ height: containerData.height,
+ });
+
+ addClass(element, CLASS_HIDDEN);
+ removeClass(cropper, CLASS_HIDDEN);
+ },
+
+ // Canvas (image wrapper)
+ initCanvas() {
+ const { containerData, imageData } = this;
+ const { viewMode } = this.options;
+ const rotated = Math.abs(imageData.rotate) % 180 === 90;
+ const naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;
+ const naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;
+ const aspectRatio = naturalWidth / naturalHeight;
+ let canvasWidth = containerData.width;
+ let canvasHeight = containerData.height;
+
+ if (containerData.height * aspectRatio > containerData.width) {
+ if (viewMode === 3) {
+ canvasWidth = containerData.height * aspectRatio;
+ } else {
+ canvasHeight = containerData.width / aspectRatio;
+ }
+ } else if (viewMode === 3) {
+ canvasHeight = containerData.width / aspectRatio;
+ } else {
+ canvasWidth = containerData.height * aspectRatio;
+ }
+
+ const canvasData = {
+ aspectRatio,
+ naturalWidth,
+ naturalHeight,
+ width: canvasWidth,
+ height: canvasHeight,
+ };
+
+ canvasData.left = (containerData.width - canvasWidth) / 2;
+ canvasData.top = (containerData.height - canvasHeight) / 2;
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ this.canvasData = canvasData;
+ this.limited = (viewMode === 1 || viewMode === 2);
+ this.limitCanvas(true, true);
+ this.initialImageData = extend({}, imageData);
+ this.initialCanvasData = extend({}, canvasData);
+ },
+
+ limitCanvas(sizeLimited, positionLimited) {
+ const {
+ options,
+ containerData,
+ canvasData,
+ cropBoxData,
+ } = this;
+ const { viewMode } = options;
+ const { aspectRatio } = canvasData;
+ const cropped = this.cropped && cropBoxData;
+
+ if (sizeLimited) {
+ let minCanvasWidth = Number(options.minCanvasWidth) || 0;
+ let minCanvasHeight = Number(options.minCanvasHeight) || 0;
+
+ if (viewMode > 1) {
+ minCanvasWidth = Math.max(minCanvasWidth, containerData.width);
+ minCanvasHeight = Math.max(minCanvasHeight, containerData.height);
+
+ if (viewMode === 3) {
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ } else if (viewMode > 0) {
+ if (minCanvasWidth) {
+ minCanvasWidth = Math.max(
+ minCanvasWidth,
+ cropped ? cropBoxData.width : 0,
+ );
+ } else if (minCanvasHeight) {
+ minCanvasHeight = Math.max(
+ minCanvasHeight,
+ cropped ? cropBoxData.height : 0,
+ );
+ } else if (cropped) {
+ minCanvasWidth = cropBoxData.width;
+ minCanvasHeight = cropBoxData.height;
+
+ if (minCanvasHeight * aspectRatio > minCanvasWidth) {
+ minCanvasWidth = minCanvasHeight * aspectRatio;
+ } else {
+ minCanvasHeight = minCanvasWidth / aspectRatio;
+ }
+ }
+ }
+
+ ({ width: minCanvasWidth, height: minCanvasHeight } = getAdjustedSizes({
+ aspectRatio,
+ width: minCanvasWidth,
+ height: minCanvasHeight,
+ }, 'cover'));
+
+ canvasData.minWidth = minCanvasWidth;
+ canvasData.minHeight = minCanvasHeight;
+ canvasData.maxWidth = Infinity;
+ canvasData.maxHeight = Infinity;
+ }
+
+ if (positionLimited) {
+ if (viewMode) {
+ const newCanvasLeft = containerData.width - canvasData.width;
+ const newCanvasTop = containerData.height - canvasData.height;
+
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+
+ if (cropped && this.limited) {
+ canvasData.minLeft = Math.min(
+ cropBoxData.left,
+ cropBoxData.left + (cropBoxData.width - canvasData.width),
+ );
+ canvasData.minTop = Math.min(
+ cropBoxData.top,
+ cropBoxData.top + (cropBoxData.height - canvasData.height),
+ );
+ canvasData.maxLeft = cropBoxData.left;
+ canvasData.maxTop = cropBoxData.top;
+
+ if (viewMode === 2) {
+ if (canvasData.width >= containerData.width) {
+ canvasData.minLeft = Math.min(0, newCanvasLeft);
+ canvasData.maxLeft = Math.max(0, newCanvasLeft);
+ }
+
+ if (canvasData.height >= containerData.height) {
+ canvasData.minTop = Math.min(0, newCanvasTop);
+ canvasData.maxTop = Math.max(0, newCanvasTop);
+ }
+ }
+ }
+ } else {
+ canvasData.minLeft = -canvasData.width;
+ canvasData.minTop = -canvasData.height;
+ canvasData.maxLeft = containerData.width;
+ canvasData.maxTop = containerData.height;
+ }
+ }
+ },
+
+ renderCanvas(changed, transformed) {
+ const { canvasData, imageData } = this;
+
+ if (transformed) {
+ const { width: naturalWidth, height: naturalHeight } = getRotatedSizes({
+ width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
+ height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
+ degree: imageData.rotate || 0,
+ });
+ const width = canvasData.width * (naturalWidth / canvasData.naturalWidth);
+ const height = canvasData.height * (naturalHeight / canvasData.naturalHeight);
+
+ canvasData.left -= (width - canvasData.width) / 2;
+ canvasData.top -= (height - canvasData.height) / 2;
+ canvasData.width = width;
+ canvasData.height = height;
+ canvasData.aspectRatio = naturalWidth / naturalHeight;
+ canvasData.naturalWidth = naturalWidth;
+ canvasData.naturalHeight = naturalHeight;
+ this.limitCanvas(true, false);
+ }
+
+ if (canvasData.width > canvasData.maxWidth ||
+ canvasData.width < canvasData.minWidth) {
+ canvasData.left = canvasData.oldLeft;
+ }
+
+ if (canvasData.height > canvasData.maxHeight ||
+ canvasData.height < canvasData.minHeight) {
+ canvasData.top = canvasData.oldTop;
+ }
+
+ canvasData.width = Math.min(
+ Math.max(canvasData.width, canvasData.minWidth),
+ canvasData.maxWidth,
+ );
+ canvasData.height = Math.min(
+ Math.max(canvasData.height, canvasData.minHeight),
+ canvasData.maxHeight,
+ );
+
+ this.limitCanvas(false, true);
+
+ canvasData.left = Math.min(
+ Math.max(canvasData.left, canvasData.minLeft),
+ canvasData.maxLeft,
+ );
+ canvasData.top = Math.min(
+ Math.max(canvasData.top, canvasData.minTop),
+ canvasData.maxTop,
+ );
+ canvasData.oldLeft = canvasData.left;
+ canvasData.oldTop = canvasData.top;
+
+ setStyle(this.canvas, extend({
+ width: canvasData.width,
+ height: canvasData.height,
+ }, getTransforms({
+ translateX: canvasData.left,
+ translateY: canvasData.top,
+ })));
+
+ this.renderImage(changed);
+
+ if (this.cropped && this.limited) {
+ this.limitCropBox(true, true);
+ }
+ },
+
+ renderImage(changed) {
+ const { canvasData, imageData } = this;
+ const width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);
+ const height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);
+
+ extend(imageData, {
+ width,
+ height,
+ left: (canvasData.width - width) / 2,
+ top: (canvasData.height - height) / 2,
+ });
+ setStyle(this.image, extend({
+ width: imageData.width,
+ height: imageData.height,
+ }, getTransforms(extend({
+ translateX: imageData.left,
+ translateY: imageData.top,
+ }, imageData))));
+
+ if (changed) {
+ this.output();
+ }
+ },
+
+ initCropBox() {
+ const { options, canvasData } = this;
+ const { aspectRatio } = options;
+ const autoCropArea = Number(options.autoCropArea) || 0.8;
+ const cropBoxData = {
+ width: canvasData.width,
+ height: canvasData.height,
+ };
+
+ if (aspectRatio) {
+ if (canvasData.height * aspectRatio > canvasData.width) {
+ cropBoxData.height = cropBoxData.width / aspectRatio;
+ } else {
+ cropBoxData.width = cropBoxData.height * aspectRatio;
+ }
+ }
+
+ this.cropBoxData = cropBoxData;
+ this.limitCropBox(true, true);
+
+ // Initialize auto crop area
+ cropBoxData.width = Math.min(
+ Math.max(cropBoxData.width, cropBoxData.minWidth),
+ cropBoxData.maxWidth,
+ );
+ cropBoxData.height = Math.min(
+ Math.max(cropBoxData.height, cropBoxData.minHeight),
+ cropBoxData.maxHeight,
+ );
+
+ // The width/height of auto crop area must large than "minWidth/Height"
+ cropBoxData.width = Math.max(
+ cropBoxData.minWidth,
+ cropBoxData.width * autoCropArea,
+ );
+ cropBoxData.height = Math.max(
+ cropBoxData.minHeight,
+ cropBoxData.height * autoCropArea,
+ );
+ cropBoxData.left = (
+ canvasData.left + ((canvasData.width - cropBoxData.width) / 2)
+ );
+ cropBoxData.top = (
+ canvasData.top + ((canvasData.height - cropBoxData.height) / 2)
+ );
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ this.initialCropBoxData = extend({}, cropBoxData);
+ },
+
+ limitCropBox(sizeLimited, positionLimited) {
+ const {
+ options,
+ containerData,
+ canvasData,
+ cropBoxData,
+ limited,
+ } = this;
+ const { aspectRatio } = options;
+
+ if (sizeLimited) {
+ let minCropBoxWidth = Number(options.minCropBoxWidth) || 0;
+ let minCropBoxHeight = Number(options.minCropBoxHeight) || 0;
+ let maxCropBoxWidth = Math.min(
+ containerData.width,
+ limited ? canvasData.width : containerData.width,
+ );
+ let maxCropBoxHeight = Math.min(
+ containerData.height,
+ limited ? canvasData.height : containerData.height,
+ );
+
+ // The min/maxCropBoxWidth/Height must be less than container's width/height
+ minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);
+ minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);
+
+ if (aspectRatio) {
+ if (minCropBoxWidth && minCropBoxHeight) {
+ if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+ } else if (minCropBoxWidth) {
+ minCropBoxHeight = minCropBoxWidth / aspectRatio;
+ } else if (minCropBoxHeight) {
+ minCropBoxWidth = minCropBoxHeight * aspectRatio;
+ }
+
+ if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {
+ maxCropBoxHeight = maxCropBoxWidth / aspectRatio;
+ } else {
+ maxCropBoxWidth = maxCropBoxHeight * aspectRatio;
+ }
+ }
+
+ // The minWidth/Height must be less than maxWidth/Height
+ cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);
+ cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);
+ cropBoxData.maxWidth = maxCropBoxWidth;
+ cropBoxData.maxHeight = maxCropBoxHeight;
+ }
+
+ if (positionLimited) {
+ if (limited) {
+ cropBoxData.minLeft = Math.max(0, canvasData.left);
+ cropBoxData.minTop = Math.max(0, canvasData.top);
+ cropBoxData.maxLeft = Math.min(
+ containerData.width,
+ canvasData.left + canvasData.width,
+ ) - cropBoxData.width;
+ cropBoxData.maxTop = Math.min(
+ containerData.height,
+ canvasData.top + canvasData.height,
+ ) - cropBoxData.height;
+ } else {
+ cropBoxData.minLeft = 0;
+ cropBoxData.minTop = 0;
+ cropBoxData.maxLeft = containerData.width - cropBoxData.width;
+ cropBoxData.maxTop = containerData.height - cropBoxData.height;
+ }
+ }
+ },
+
+ renderCropBox() {
+ const { options, containerData, cropBoxData } = this;
+
+ if (cropBoxData.width > cropBoxData.maxWidth ||
+ cropBoxData.width < cropBoxData.minWidth) {
+ cropBoxData.left = cropBoxData.oldLeft;
+ }
+
+ if (cropBoxData.height > cropBoxData.maxHeight ||
+ cropBoxData.height < cropBoxData.minHeight) {
+ cropBoxData.top = cropBoxData.oldTop;
+ }
+
+ cropBoxData.width = Math.min(
+ Math.max(cropBoxData.width, cropBoxData.minWidth),
+ cropBoxData.maxWidth,
+ );
+ cropBoxData.height = Math.min(
+ Math.max(cropBoxData.height, cropBoxData.minHeight),
+ cropBoxData.maxHeight,
+ );
+
+ this.limitCropBox(false, true);
+
+ cropBoxData.left = Math.min(
+ Math.max(cropBoxData.left, cropBoxData.minLeft),
+ cropBoxData.maxLeft,
+ );
+ cropBoxData.top = Math.min(
+ Math.max(cropBoxData.top, cropBoxData.minTop),
+ cropBoxData.maxTop,
+ );
+ cropBoxData.oldLeft = cropBoxData.left;
+ cropBoxData.oldTop = cropBoxData.top;
+
+ if (options.movable && options.cropBoxMovable) {
+ // Turn to move the canvas when the crop box is equal to the container
+ setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width &&
+ cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);
+ }
+
+ setStyle(this.cropBox, extend({
+ width: cropBoxData.width,
+ height: cropBoxData.height,
+ }, getTransforms({
+ translateX: cropBoxData.left,
+ translateY: cropBoxData.top,
+ })));
+
+ if (this.cropped && this.limited) {
+ this.limitCanvas(true, true);
+ }
+
+ if (!this.disabled) {
+ this.output();
+ }
+ },
+
+ output() {
+ this.preview();
+
+ if (this.complete) {
+ dispatchEvent(this.element, EVENT_CROP, this.getData());
+ }
+ },
+};
diff --git a/library/cropperjs/src/js/template.js b/library/cropperjs/src/js/template.js
new file mode 100644
index 000000000..589b46a78
--- /dev/null
+++ b/library/cropperjs/src/js/template.js
@@ -0,0 +1,27 @@
+export default (
+ '<div class="cropper-container">' +
+ '<div class="cropper-wrap-box">' +
+ '<div class="cropper-canvas"></div>' +
+ '</div>' +
+ '<div class="cropper-drag-box"></div>' +
+ '<div class="cropper-crop-box">' +
+ '<span class="cropper-view-box"></span>' +
+ '<span class="cropper-dashed dashed-h"></span>' +
+ '<span class="cropper-dashed dashed-v"></span>' +
+ '<span class="cropper-center"></span>' +
+ '<span class="cropper-face"></span>' +
+ '<span class="cropper-line line-e" data-action="e"></span>' +
+ '<span class="cropper-line line-n" data-action="n"></span>' +
+ '<span class="cropper-line line-w" data-action="w"></span>' +
+ '<span class="cropper-line line-s" data-action="s"></span>' +
+ '<span class="cropper-point point-e" data-action="e"></span>' +
+ '<span class="cropper-point point-n" data-action="n"></span>' +
+ '<span class="cropper-point point-w" data-action="w"></span>' +
+ '<span class="cropper-point point-s" data-action="s"></span>' +
+ '<span class="cropper-point point-ne" data-action="ne"></span>' +
+ '<span class="cropper-point point-nw" data-action="nw"></span>' +
+ '<span class="cropper-point point-sw" data-action="sw"></span>' +
+ '<span class="cropper-point point-se" data-action="se"></span>' +
+ '</div>' +
+ '</div>'
+);
diff --git a/library/cropperjs/src/js/utilities.js b/library/cropperjs/src/js/utilities.js
new file mode 100644
index 000000000..50b586a76
--- /dev/null
+++ b/library/cropperjs/src/js/utilities.js
@@ -0,0 +1,985 @@
+import {
+ WINDOW,
+} from './constants';
+
+/**
+ * Check if the given value is not a number.
+ */
+export const isNaN = Number.isNaN || WINDOW.isNaN;
+
+/**
+ * Check if the given value is a number.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a number, else `false`.
+ */
+export function isNumber(value) {
+ return typeof value === 'number' && !isNaN(value);
+}
+
+/**
+ * Check if the given value is undefined.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is undefined, else `false`.
+ */
+export function isUndefined(value) {
+ return typeof value === 'undefined';
+}
+
+/**
+ * Check if the given value is an object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is an object, else `false`.
+ */
+export function isObject(value) {
+ return typeof value === 'object' && value !== null;
+}
+
+const { hasOwnProperty } = Object.prototype;
+
+/**
+ * Check if the given value is a plain object.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
+ */
+export function isPlainObject(value) {
+ if (!isObject(value)) {
+ return false;
+ }
+
+ try {
+ const { constructor } = value;
+ const { prototype } = constructor;
+
+ return constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
+ } catch (e) {
+ return false;
+ }
+}
+
+/**
+ * Check if the given value is a function.
+ * @param {*} value - The value to check.
+ * @returns {boolean} Returns `true` if the given value is a function, else `false`.
+ */
+export function isFunction(value) {
+ return typeof value === 'function';
+}
+
+/**
+ * Iterate the given data.
+ * @param {*} data - The data to iterate.
+ * @param {Function} callback - The process function for each element.
+ * @returns {*} The original data.
+ */
+export function each(data, callback) {
+ if (data && isFunction(callback)) {
+ if (Array.isArray(data) || isNumber(data.length)/* array-like */) {
+ const { length } = data;
+ let i;
+
+ for (i = 0; i < length; i += 1) {
+ if (callback.call(data, data[i], i, data) === false) {
+ break;
+ }
+ }
+ } else if (isObject(data)) {
+ Object.keys(data).forEach((key) => {
+ callback.call(data, data[key], key, data);
+ });
+ }
+ }
+
+ return data;
+}
+
+/**
+ * Extend the given object.
+ * @param {*} obj - The object to be extended.
+ * @param {*} args - The rest objects which will be merged to the first object.
+ * @returns {Object} The extended object.
+ */
+export function extend(obj, ...args) {
+ if (isObject(obj) && args.length > 0) {
+ if (Object.assign) {
+ return Object.assign(obj, ...args);
+ }
+
+ args.forEach((arg) => {
+ if (isObject(arg)) {
+ Object.keys(arg).forEach((key) => {
+ obj[key] = arg[key];
+ });
+ }
+ });
+ }
+
+ return obj;
+}
+
+/**
+ * Takes a function and returns a new one that will always have a particular context.
+ * @param {Function} fn - The target function.
+ * @param {Object} context - The new context for the function.
+ * @returns {boolean} The new function.
+ */
+export function proxy(fn, context, ...args) {
+ return (...args2) => fn.apply(context, args.concat(args2));
+}
+
+const REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/i;
+
+/**
+ * Normalize decimal number.
+ * Check out {@link http://0.30000000000000004.com/ }
+ * @param {number} value - The value to normalize.
+ * @param {number} [times=100000000000] - The times for normalizing.
+ * @returns {number} Returns the normalized number.
+ */
+export function normalizeDecimalNumber(value, times = 100000000000) {
+ return REGEXP_DECIMALS.test(value) ? (Math.round(value * times) / times) : value;
+}
+
+const REGEXP_SUFFIX = /^(?:width|height|left|top|marginLeft|marginTop)$/;
+
+/**
+ * Apply styles to the given element.
+ * @param {Element} element - The target element.
+ * @param {Object} styles - The styles for applying.
+ */
+export function setStyle(element, styles) {
+ const { style } = element;
+
+ each(styles, (value, property) => {
+ if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
+ value += 'px';
+ }
+
+ style[property] = value;
+ });
+}
+
+/**
+ * Check if the given element has a special class.
+ * @param {Element} element - The element to check.
+ * @param {string} value - The class to search.
+ * @returns {boolean} Returns `true` if the special class was found.
+ */
+export function hasClass(element, value) {
+ return element.classList ?
+ element.classList.contains(value) :
+ element.className.indexOf(value) > -1;
+}
+
+/**
+ * Add classes to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be added.
+ */
+export function addClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, (elem) => {
+ addClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.add(value);
+ return;
+ }
+
+ const className = element.className.trim();
+
+ if (!className) {
+ element.className = value;
+ } else if (className.indexOf(value) < 0) {
+ element.className = `${className} ${value}`;
+ }
+}
+
+/**
+ * Remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be removed.
+ */
+export function removeClass(element, value) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, (elem) => {
+ removeClass(elem, value);
+ });
+ return;
+ }
+
+ if (element.classList) {
+ element.classList.remove(value);
+ return;
+ }
+
+ if (element.className.indexOf(value) >= 0) {
+ element.className = element.className.replace(value, '');
+ }
+}
+
+/**
+ * Add or remove classes from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} value - The classes to be toggled.
+ * @param {boolean} added - Add only.
+ */
+export function toggleClass(element, value, added) {
+ if (!value) {
+ return;
+ }
+
+ if (isNumber(element.length)) {
+ each(element, (elem) => {
+ toggleClass(elem, value, added);
+ });
+ return;
+ }
+
+ // IE10-11 doesn't support the second parameter of `classList.toggle`
+ if (added) {
+ addClass(element, value);
+ } else {
+ removeClass(element, value);
+ }
+}
+
+const REGEXP_HYPHENATE = /([a-z\d])([A-Z])/g;
+
+/**
+ * Hyphenate the given value.
+ * @param {string} value - The value to hyphenate.
+ * @returns {string} The hyphenated value.
+ */
+export function hyphenate(value) {
+ return value.replace(REGEXP_HYPHENATE, '$1-$2').toLowerCase();
+}
+
+/**
+ * Get data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to get.
+ * @returns {string} The data value.
+ */
+export function getData(element, name) {
+ if (isObject(element[name])) {
+ return element[name];
+ } else if (element.dataset) {
+ return element.dataset[name];
+ }
+
+ return element.getAttribute(`data-${hyphenate(name)}`);
+}
+
+/**
+ * Set data to the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to set.
+ * @param {string} data - The data value.
+ */
+export function setData(element, name, data) {
+ if (isObject(data)) {
+ element[name] = data;
+ } else if (element.dataset) {
+ element.dataset[name] = data;
+ } else {
+ element.setAttribute(`data-${hyphenate(name)}`, data);
+ }
+}
+
+/**
+ * Remove data from the given element.
+ * @param {Element} element - The target element.
+ * @param {string} name - The data key to remove.
+ */
+export function removeData(element, name) {
+ if (isObject(element[name])) {
+ try {
+ delete element[name];
+ } catch (e) {
+ element[name] = null;
+ }
+ } else if (element.dataset) {
+ // #128 Safari not allows to delete dataset property
+ try {
+ delete element.dataset[name];
+ } catch (e) {
+ element.dataset[name] = null;
+ }
+ } else {
+ element.removeAttribute(`data-${hyphenate(name)}`);
+ }
+}
+
+const REGEXP_SPACES = /\s\s*/;
+
+/**
+ * Remove event listener from the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+export function removeListener(element, type, listener, options = {}) {
+ if (!isFunction(listener)) {
+ return;
+ }
+
+ const types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, (t) => {
+ removeListener(element, t, listener, options);
+ });
+ return;
+ }
+
+ if (element.removeEventListener) {
+ element.removeEventListener(type, listener, options);
+ } else if (element.detachEvent) {
+ element.detachEvent(`on${type}`, listener);
+ }
+}
+
+/**
+ * Add event listener to the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Function} listener - The event listener.
+ * @param {Object} options - The event options.
+ */
+export function addListener(element, type, listener, options = {}) {
+ if (!isFunction(listener)) {
+ return;
+ }
+
+ const types = type.trim().split(REGEXP_SPACES);
+
+ if (types.length > 1) {
+ each(types, (t) => {
+ addListener(element, t, listener, options);
+ });
+ return;
+ }
+
+ if (options.once) {
+ const originalListener = listener;
+
+ listener = (...args) => {
+ removeListener(element, type, listener, options);
+ return originalListener.apply(element, args);
+ };
+ }
+
+ if (element.addEventListener) {
+ element.addEventListener(type, listener, options);
+ } else if (element.attachEvent) {
+ element.attachEvent(`on${type}`, listener);
+ }
+}
+
+/**
+ * Dispatch event on the target element.
+ * @param {Element} element - The event target.
+ * @param {string} type - The event type(s).
+ * @param {Object} data - The additional event data.
+ * @returns {boolean} Indicate if the event is default prevented or not.
+ */
+export function dispatchEvent(element, type, data) {
+ if (element.dispatchEvent) {
+ let event;
+
+ // Event and CustomEvent on IE9-11 are global objects, not constructors
+ if (isFunction(Event) && isFunction(CustomEvent)) {
+ if (isUndefined(data)) {
+ event = new Event(type, {
+ bubbles: true,
+ cancelable: true,
+ });
+ } else {
+ event = new CustomEvent(type, {
+ detail: data,
+ bubbles: true,
+ cancelable: true,
+ });
+ }
+ } else if (isUndefined(data)) {
+ event = document.createEvent('Event');
+ event.initEvent(type, true, true);
+ } else {
+ event = document.createEvent('CustomEvent');
+ event.initCustomEvent(type, true, true, data);
+ }
+
+ // IE9+
+ return element.dispatchEvent(event);
+ } else if (element.fireEvent) {
+ // IE6-10 (native events only)
+ return element.fireEvent(`on${type}`);
+ }
+
+ return true;
+}
+
+/**
+ * Get the offset base on the document.
+ * @param {Element} element - The target element.
+ * @returns {Object} The offset data.
+ */
+export function getOffset(element) {
+ const doc = document.documentElement;
+ const box = element.getBoundingClientRect();
+
+ return {
+ left: box.left + (
+ (window.scrollX || (doc && doc.scrollLeft) || 0) - ((doc && doc.clientLeft) || 0)
+ ),
+ top: box.top + (
+ (window.scrollY || (doc && doc.scrollTop) || 0) - ((doc && doc.clientTop) || 0)
+ ),
+ };
+}
+
+/**
+ * Empty an element.
+ * @param {Element} element - The element to empty.
+ */
+export function empty(element) {
+ while (element.firstChild) {
+ element.removeChild(element.firstChild);
+ }
+}
+
+const { location } = WINDOW;
+const REGEXP_ORIGINS = /^(https?:)\/\/([^:/?#]+):?(\d*)/i;
+
+/**
+ * Check if the given URL is a cross origin URL.
+ * @param {string} url - The target URL.
+ * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.
+ */
+export function isCrossOriginURL(url) {
+ const parts = url.match(REGEXP_ORIGINS);
+
+ return parts && (
+ parts[1] !== location.protocol ||
+ parts[2] !== location.hostname ||
+ parts[3] !== location.port
+ );
+}
+
+/**
+ * Add timestamp to the given URL.
+ * @param {string} url - The target URL.
+ * @returns {string} The result URL.
+ */
+export function addTimestamp(url) {
+ const timestamp = `timestamp=${(new Date()).getTime()}`;
+
+ return (url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp);
+}
+
+/**
+ * Get transforms base on the given object.
+ * @param {Object} obj - The target object.
+ * @returns {string} A string contains transform values.
+ */
+export function getTransforms({
+ rotate,
+ scaleX,
+ scaleY,
+ translateX,
+ translateY,
+}) {
+ const values = [];
+
+ if (isNumber(translateX) && translateX !== 0) {
+ values.push(`translateX(${translateX}px)`);
+ }
+
+ if (isNumber(translateY) && translateY !== 0) {
+ values.push(`translateY(${translateY}px)`);
+ }
+
+ // Rotate should come first before scale to match orientation transform
+ if (isNumber(rotate) && rotate !== 0) {
+ values.push(`rotate(${rotate}deg)`);
+ }
+
+ if (isNumber(scaleX) && scaleX !== 1) {
+ values.push(`scaleX(${scaleX})`);
+ }
+
+ if (isNumber(scaleY) && scaleY !== 1) {
+ values.push(`scaleY(${scaleY})`);
+ }
+
+ const transform = values.length ? values.join(' ') : 'none';
+
+ return {
+ WebkitTransform: transform,
+ msTransform: transform,
+ transform,
+ };
+}
+
+const { navigator } = WINDOW;
+const IS_SAFARI_OR_UIWEBVIEW = navigator && /(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);
+
+/**
+ * Get an image's natural sizes.
+ * @param {string} image - The target image.
+ * @param {Function} callback - The callback function.
+ */
+export function getImageNaturalSizes(image, callback) {
+ // Modern browsers (except Safari)
+ if (image.naturalWidth && !IS_SAFARI_OR_UIWEBVIEW) {
+ callback(image.naturalWidth, image.naturalHeight);
+ return;
+ }
+
+ const newImage = document.createElement('img');
+ const body = document.body || document.documentElement;
+
+ newImage.onload = () => {
+ callback(newImage.width, newImage.height);
+
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ body.removeChild(newImage);
+ }
+ };
+
+ newImage.src = image.src;
+
+ // iOS Safari will convert the image automatically
+ // with its orientation once append it into DOM (#279)
+ if (!IS_SAFARI_OR_UIWEBVIEW) {
+ newImage.style.cssText = (
+ 'left:0;' +
+ 'max-height:none!important;' +
+ 'max-width:none!important;' +
+ 'min-height:0!important;' +
+ 'min-width:0!important;' +
+ 'opacity:0;' +
+ 'position:absolute;' +
+ 'top:0;' +
+ 'z-index:-1;'
+ );
+ body.appendChild(newImage);
+ }
+}
+
+/**
+ * Get the max ratio of a group of pointers.
+ * @param {string} pointers - The target pointers.
+ * @returns {number} The result ratio.
+ */
+export function getMaxZoomRatio(pointers) {
+ const pointers2 = extend({}, pointers);
+ const ratios = [];
+
+ each(pointers, (pointer, pointerId) => {
+ delete pointers2[pointerId];
+
+ each(pointers2, (pointer2) => {
+ const x1 = Math.abs(pointer.startX - pointer2.startX);
+ const y1 = Math.abs(pointer.startY - pointer2.startY);
+ const x2 = Math.abs(pointer.endX - pointer2.endX);
+ const y2 = Math.abs(pointer.endY - pointer2.endY);
+ const z1 = Math.sqrt((x1 * x1) + (y1 * y1));
+ const z2 = Math.sqrt((x2 * x2) + (y2 * y2));
+ const ratio = (z2 - z1) / z1;
+
+ ratios.push(ratio);
+ });
+ });
+
+ ratios.sort((a, b) => Math.abs(a) < Math.abs(b));
+
+ return ratios[0];
+}
+
+/**
+ * Get a pointer from an event object.
+ * @param {Object} event - The target event object.
+ * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
+ * @returns {Object} The result pointer contains start and/or end point coordinates.
+ */
+export function getPointer({ pageX, pageY }, endOnly) {
+ const end = {
+ endX: pageX,
+ endY: pageY,
+ };
+
+ if (endOnly) {
+ return end;
+ }
+
+ return extend({
+ startX: pageX,
+ startY: pageY,
+ }, end);
+}
+
+/**
+ * Get the center point coordinate of a group of pointers.
+ * @param {Object} pointers - The target pointers.
+ * @returns {Object} The center point coordinate.
+ */
+export function getPointersCenter(pointers) {
+ let pageX = 0;
+ let pageY = 0;
+ let count = 0;
+
+ each(pointers, ({ startX, startY }) => {
+ pageX += startX;
+ pageY += startY;
+ count += 1;
+ });
+
+ pageX /= count;
+ pageY /= count;
+
+ return {
+ pageX,
+ pageY,
+ };
+}
+
+/**
+ * Check if the given value is a finite number.
+ */
+export const isFinite = Number.isFinite || WINDOW.isFinite;
+
+/**
+ * Get the max sizes in a rectangle under the given aspect ratio.
+ * @param {Object} data - The original sizes.
+ * @param {string} [type='contain'] - The adjust type.
+ * @returns {Object} The result sizes.
+ */
+export function getAdjustedSizes(
+ {
+ aspectRatio,
+ height,
+ width,
+ },
+ type = 'contain', // or 'cover'
+) {
+ const isValidNumber = value => isFinite(value) && value > 0;
+
+ if (isValidNumber(width) && isValidNumber(height)) {
+ const adjustedWidth = height * aspectRatio;
+
+ if ((type === 'contain' && adjustedWidth > width) || (type === 'cover' && adjustedWidth < width)) {
+ height = width / aspectRatio;
+ } else {
+ width = height * aspectRatio;
+ }
+ } else if (isValidNumber(width)) {
+ height = width / aspectRatio;
+ } else if (isValidNumber(height)) {
+ width = height * aspectRatio;
+ }
+
+ return {
+ width,
+ height,
+ };
+}
+
+/**
+ * Get the new sizes of a rectangle after rotated.
+ * @param {Object} data - The original sizes.
+ * @returns {Object} The result sizes.
+ */
+export function getRotatedSizes({ width, height, degree }) {
+ degree = Math.abs(degree) % 180;
+
+ if (degree === 90) {
+ return {
+ width: height,
+ height: width,
+ };
+ }
+
+ const arc = ((degree % 90) * Math.PI) / 180;
+ const sinArc = Math.sin(arc);
+ const cosArc = Math.cos(arc);
+ const newWidth = (width * cosArc) + (height * sinArc);
+ const newHeight = (width * sinArc) + (height * cosArc);
+
+ return degree > 90 ? {
+ width: newHeight,
+ height: newWidth,
+ } : {
+ width: newWidth,
+ height: newHeight,
+ };
+}
+
+/**
+ * Get a canvas which drew the given image.
+ * @param {HTMLImageElement} image - The image for drawing.
+ * @param {Object} imageData - The image data.
+ * @param {Object} canvasData - The canvas data.
+ * @param {Object} options - The options.
+ * @returns {HTMLCanvasElement} The result canvas.
+ */
+export function getSourceCanvas(
+ image,
+ {
+ rotate = 0,
+ scaleX = 1,
+ scaleY = 1,
+ },
+ {
+ aspectRatio,
+ naturalWidth,
+ naturalHeight,
+ },
+ {
+ fillColor = 'transparent',
+ imageSmoothingEnabled = true,
+ imageSmoothingQuality = 'low',
+ maxWidth = Infinity,
+ maxHeight = Infinity,
+ minWidth = 0,
+ minHeight = 0,
+ },
+) {
+ const canvas = document.createElement('canvas');
+ const context = canvas.getContext('2d');
+ const maxSizes = getAdjustedSizes({
+ aspectRatio,
+ width: maxWidth,
+ height: maxHeight,
+ });
+ const minSizes = getAdjustedSizes({
+ aspectRatio,
+ width: minWidth,
+ height: minHeight,
+ }, 'cover');
+ const width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
+ const height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight));
+ const params = [
+ -width / 2,
+ -height / 2,
+ width,
+ height,
+ ];
+
+ canvas.width = normalizeDecimalNumber(width);
+ canvas.height = normalizeDecimalNumber(height);
+ context.fillStyle = fillColor;
+ context.fillRect(0, 0, width, height);
+ context.save();
+ context.translate(width / 2, height / 2);
+ context.rotate((rotate * Math.PI) / 180);
+ context.scale(scaleX, scaleY);
+ context.imageSmoothingEnabled = imageSmoothingEnabled;
+ context.imageSmoothingQuality = imageSmoothingQuality;
+ context.drawImage(image, ...params.map(param => Math.floor(normalizeDecimalNumber(param))));
+ context.restore();
+ return canvas;
+}
+
+const { fromCharCode } = String;
+
+/**
+ * Get string from char code in data view.
+ * @param {DataView} dataView - The data view for read.
+ * @param {number} start - The start index.
+ * @param {number} length - The read length.
+ * @returns {string} The read result.
+ */
+export function getStringFromCharCode(dataView, start, length) {
+ let str = '';
+ let i;
+
+ length += start;
+
+ for (i = start; i < length; i += 1) {
+ str += fromCharCode(dataView.getUint8(i));
+ }
+
+ return str;
+}
+
+const REGEXP_DATA_URL_HEAD = /^data:.*,/;
+
+/**
+ * Transform Data URL to array buffer.
+ * @param {string} dataURL - The Data URL to transform.
+ * @returns {ArrayBuffer} The result array buffer.
+ */
+export function dataURLToArrayBuffer(dataURL) {
+ const base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');
+ const binary = atob(base64);
+ const arrayBuffer = new ArrayBuffer(binary.length);
+ const uint8 = new Uint8Array(arrayBuffer);
+
+ each(uint8, (value, i) => {
+ uint8[i] = binary.charCodeAt(i);
+ });
+
+ return arrayBuffer;
+}
+
+/**
+ * Transform array buffer to Data URL.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.
+ * @param {string} mimeType - The mime type of the Data URL.
+ * @returns {string} The result Data URL.
+ */
+export function arrayBufferToDataURL(arrayBuffer, mimeType) {
+ const uint8 = new Uint8Array(arrayBuffer);
+ let data = '';
+
+ // TypedArray.prototype.forEach is not supported in some browsers.
+ each(uint8, (value) => {
+ data += fromCharCode(value);
+ });
+
+ return `data:${mimeType};base64,${btoa(data)}`;
+}
+
+/**
+ * Get orientation value from given array buffer.
+ * @param {ArrayBuffer} arrayBuffer - The array buffer to read.
+ * @returns {number} The read orientation value.
+ */
+export function getOrientation(arrayBuffer) {
+ const dataView = new DataView(arrayBuffer);
+ let orientation;
+ let littleEndian;
+ let app1Start;
+ let ifdStart;
+
+ // Only handle JPEG image (start by 0xFFD8)
+ if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
+ const length = dataView.byteLength;
+ let offset = 2;
+
+ while (offset < length) {
+ if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
+ app1Start = offset;
+ break;
+ }
+
+ offset += 1;
+ }
+ }
+
+ if (app1Start) {
+ const exifIDCode = app1Start + 4;
+ const tiffOffset = app1Start + 10;
+
+ if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
+ const endianness = dataView.getUint16(tiffOffset);
+
+ littleEndian = endianness === 0x4949;
+
+ if (littleEndian || endianness === 0x4D4D /* bigEndian */) {
+ if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
+ const firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
+
+ if (firstIFDOffset >= 0x00000008) {
+ ifdStart = tiffOffset + firstIFDOffset;
+ }
+ }
+ }
+ }
+ }
+
+ if (ifdStart) {
+ const length = dataView.getUint16(ifdStart, littleEndian);
+ let offset;
+ let i;
+
+ for (i = 0; i < length; i += 1) {
+ offset = ifdStart + (i * 12) + 2;
+
+ if (dataView.getUint16(offset, littleEndian) === 0x0112 /* Orientation */) {
+ // 8 is the offset of the current tag's value
+ offset += 8;
+
+ // Get the original orientation value
+ orientation = dataView.getUint16(offset, littleEndian);
+
+ // Override the orientation with its default value
+ dataView.setUint16(offset, 1, littleEndian);
+ break;
+ }
+ }
+ }
+
+ return orientation;
+}
+
+/**
+ * Parse Exif Orientation value.
+ * @param {number} orientation - The orientation to parse.
+ * @returns {Object} The parsed result.
+ */
+export function parseOrientation(orientation) {
+ let rotate = 0;
+ let scaleX = 1;
+ let scaleY = 1;
+
+ switch (orientation) {
+ // Flip horizontal
+ case 2:
+ scaleX = -1;
+ break;
+
+ // Rotate left 180°
+ case 3:
+ rotate = -180;
+ break;
+
+ // Flip vertical
+ case 4:
+ scaleY = -1;
+ break;
+
+ // Flip vertical and rotate right 90°
+ case 5:
+ rotate = 90;
+ scaleY = -1;
+ break;
+
+ // Rotate right 90°
+ case 6:
+ rotate = 90;
+ break;
+
+ // Flip horizontal and rotate right 90°
+ case 7:
+ rotate = 90;
+ scaleX = -1;
+ break;
+
+ // Rotate left 90°
+ case 8:
+ rotate = -90;
+ break;
+
+ default:
+ }
+
+ return {
+ rotate,
+ scaleX,
+ scaleY,
+ };
+}
diff --git a/library/cropperjs/test/css/main.css b/library/cropperjs/test/css/main.css
new file mode 100644
index 000000000..6a86d123c
--- /dev/null
+++ b/library/cropperjs/test/css/main.css
@@ -0,0 +1,9 @@
+.container {
+ max-width: 640px;
+ max-height: 360px;
+ margin: 20px auto;
+}
+
+.container > img {
+ max-width: 100%;
+}
diff --git a/library/cropperjs/test/events/crop.js b/library/cropperjs/test/events/crop.js
new file mode 100644
index 000000000..1f769cf60
--- /dev/null
+++ b/library/cropperjs/test/events/crop.js
@@ -0,0 +1,21 @@
+QUnit.test('events#crop', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(7);
+
+ image.addEventListener('crop', function (e) {
+ assert.ok(util.isNumber(e.detail.x));
+ assert.ok(util.isNumber(e.detail.y));
+ assert.ok(util.isNumber(e.detail.width));
+ assert.ok(util.isNumber(e.detail.height));
+ assert.ok(util.isNumber(e.detail.rotate));
+ assert.ok(util.isNumber(e.detail.scaleX));
+ assert.ok(util.isNumber(e.detail.scaleY));
+
+ done();
+ });
+
+ return new Cropper(image);
+});
diff --git a/library/cropperjs/test/events/cropend.js b/library/cropperjs/test/events/cropend.js
new file mode 100644
index 000000000..1f18fb435
--- /dev/null
+++ b/library/cropperjs/test/events/cropend.js
@@ -0,0 +1,24 @@
+QUnit.test('events#cropend', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ image.addEventListener('ready', function () {
+ var PointerEvent = window.PointerEvent;
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointermove' : 'mousemove');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup');
+
+ done();
+ });
+
+ image.addEventListener('cropend', function (e) {
+ assert.strictEqual(e.detail.action, 'crop');
+ });
+
+ return new Cropper(image);
+});
diff --git a/library/cropperjs/test/events/cropmove.js b/library/cropperjs/test/events/cropmove.js
new file mode 100644
index 000000000..c695b7fdd
--- /dev/null
+++ b/library/cropperjs/test/events/cropmove.js
@@ -0,0 +1,24 @@
+QUnit.test('events#cropmove', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ image.addEventListener('ready', function () {
+ var PointerEvent = window.PointerEvent;
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointermove' : 'mousemove');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup');
+
+ done();
+ });
+
+ image.addEventListener('cropmove', function (e) {
+ assert.strictEqual(e.detail.action, 'crop');
+ });
+
+ return new Cropper(image);
+});
diff --git a/library/cropperjs/test/events/cropstart.js b/library/cropperjs/test/events/cropstart.js
new file mode 100644
index 000000000..7d9b597a0
--- /dev/null
+++ b/library/cropperjs/test/events/cropstart.js
@@ -0,0 +1,56 @@
+QUnit.test('events#cropstart', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ image.addEventListener('ready', function () {
+ var PointerEvent = window.PointerEvent;
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup');
+
+ done();
+ });
+
+ image.addEventListener('cropstart', function (e) {
+ assert.strictEqual(e.detail.action, 'crop');
+ });
+
+ return new Cropper(image);
+});
+
+QUnit.test('events#cropstart: default prevented', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(0);
+
+ image.addEventListener('ready', function () {
+ var PointerEvent = window.PointerEvent;
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointermove' : 'mousemove');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup');
+
+ done();
+ });
+
+ image.addEventListener('cropstart', function (e) {
+ e.preventDefault();
+ });
+
+ image.addEventListener('cropmove', function () {
+ assert.ok(false);
+ });
+
+ image.addEventListener('cropend', function () {
+ assert.ok(false);
+ });
+
+ return new Cropper(image);
+});
diff --git a/library/cropperjs/test/events/ready.js b/library/cropperjs/test/events/ready.js
new file mode 100644
index 000000000..fbec2ff0c
--- /dev/null
+++ b/library/cropperjs/test/events/ready.js
@@ -0,0 +1,15 @@
+QUnit.test('events#ready', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ image.addEventListener('ready', function () {
+ assert.ok(true);
+
+ done();
+ });
+
+ return new Cropper(image);
+});
diff --git a/library/cropperjs/test/events/zoom.js b/library/cropperjs/test/events/zoom.js
new file mode 100644
index 000000000..99fda34b5
--- /dev/null
+++ b/library/cropperjs/test/events/zoom.js
@@ -0,0 +1,46 @@
+QUnit.test('events#zoom', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(3);
+
+ image.addEventListener('ready', function () {
+ var cropper = this.cropper;
+
+ cropper.zoom(0.1);
+
+ done();
+ });
+
+ image.addEventListener('zoom', function (e) {
+ assert.ok(e.detail.ratio > 0);
+ assert.ok(e.detail.oldRatio > 0);
+ assert.ok(e.detail.ratio > e.detail.oldRatio);
+ });
+
+ return new Cropper(image);
+});
+
+QUnit.test('events#zoom: default prevented', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ image.addEventListener('ready', function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+
+ assert.deepEqual(cropper.zoom(0.1).getCanvasData(), canvasData);
+
+ done();
+ });
+
+ image.addEventListener('zoom', function (e) {
+ e.preventDefault();
+ });
+
+ return new Cropper(image);
+});
diff --git a/library/cropperjs/test/index.html b/library/cropperjs/test/index.html
new file mode 100644
index 000000000..bdcaf6b21
--- /dev/null
+++ b/library/cropperjs/test/index.html
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Cropper.js</title>
+ <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.4.0.css">
+ <link rel="stylesheet" href="../dist/cropper.css">
+ <link rel="stylesheet" href="css/main.css">
+</head>
+<body>
+ <div id="qunit"></div>
+ <div id="qunit-fixture"></div>
+ <script src="https://code.jquery.com/qunit/qunit-2.4.0.js"></script>
+ <script src="../dist/cropper.js"></script>
+ <script src="js/main.js"></script>
+
+ <!-- Options -->
+ <script src="options/viewMode.js"></script>
+ <script src="options/dragMode.js"></script>
+ <script src="options/aspectRatio.js"></script>
+ <script src="options/data.js"></script>
+ <!-- <script src="options/checkCrossOrigin.js"></script> -->
+ <script src="options/checkOrientation.js"></script>
+ <script src="options/modal.js"></script>
+ <script src="options/guides.js"></script>
+ <script src="options/center.js"></script>
+ <script src="options/highlight.js"></script>
+ <script src="options/background.js"></script>
+ <script src="options/autoCrop.js"></script>
+ <script src="options/movable.js"></script>
+ <script src="options/rotatable.js"></script>
+ <script src="options/scalable.js"></script>
+ <script src="options/zoomable.js"></script>
+ <script src="options/zoomOnWheel.js"></script>
+ <script src="options/cropBoxMovable.js"></script>
+ <script src="options/cropBoxResizable.js"></script>
+ <script src="options/toggleDragModeOnDblclick.js"></script>
+ <script src="options/minCanvasWidth.js"></script>
+ <script src="options/minCanvasHeight.js"></script>
+ <script src="options/minCropBoxWidth.js"></script>
+ <script src="options/minCropBoxHeight.js"></script>
+ <script src="options/minContainerWidth.js"></script>
+ <script src="options/minContainerHeight.js"></script>
+ <script src="options/ready.js"></script>
+ <script src="options/cropstart.js"></script>
+ <script src="options/cropmove.js"></script>
+ <script src="options/cropend.js"></script>
+ <script src="options/crop.js"></script>
+ <script src="options/zoom.js"></script>
+
+ <!-- Methods -->
+ <script src="methods/crop.js"></script>
+ <script src="methods/reset.js"></script>
+ <script src="methods/clear.js"></script>
+ <script src="methods/replace.js"></script>
+ <script src="methods/enable.js"></script>
+ <script src="methods/disable.js"></script>
+ <script src="methods/destroy.js"></script>
+ <script src="methods/move.js"></script>
+ <script src="methods/moveTo.js"></script>
+ <script src="methods/zoom.js"></script>
+ <script src="methods/zoomTo.js"></script>
+ <script src="methods/rotate.js"></script>
+ <script src="methods/rotateTo.js"></script>
+ <script src="methods/scale.js"></script>
+ <script src="methods/scaleX.js"></script>
+ <script src="methods/scaleY.js"></script>
+ <script src="methods/getData.js"></script>
+ <script src="methods/setData.js"></script>
+ <script src="methods/getContainerData.js"></script>
+ <script src="methods/getImageData.js"></script>
+ <script src="methods/getCanvasData.js"></script>
+ <script src="methods/setCanvasData.js"></script>
+ <script src="methods/getCropBoxData.js"></script>
+ <script src="methods/setCropBoxData.js"></script>
+ <script src="methods/getCroppedCanvas.js"></script>
+ <script src="methods/setAspectRatio.js"></script>
+ <script src="methods/setDragMode.js"></script>
+
+ <!-- Events -->
+ <script src="events/ready.js"></script>
+ <script src="events/cropstart.js"></script>
+ <script src="events/cropmove.js"></script>
+ <script src="events/cropend.js"></script>
+ <script src="events/crop.js"></script>
+ <script src="events/zoom.js"></script>
+</body>
+</html>
diff --git a/library/cropperjs/test/js/main.js b/library/cropperjs/test/js/main.js
new file mode 100644
index 000000000..79fda799f
--- /dev/null
+++ b/library/cropperjs/test/js/main.js
@@ -0,0 +1,74 @@
+window.Util = {
+ isNumber: function (n) {
+ return typeof n === 'number' && !isNaN(n);
+ },
+ isFunction: function (fn) {
+ return typeof fn === 'function';
+ },
+ hasClass: function (element, className) {
+ return element.classList.contains(className);
+ },
+ getByClass: function (element, className) {
+ return element.getElementsByClassName ?
+ element.getElementsByClassName(className) :
+ element.querySelectorAll('.' + className);
+ },
+ createImage: function (attrs) {
+ var container = document.createElement('div');
+ var image = new Image();
+ var attr;
+
+ if (typeof attrs !== 'object') {
+ attrs = {};
+ }
+
+ if (!attrs.src) {
+ attrs.src = '../docs/images/picture.jpg';
+ }
+
+ for (attr in attrs) {
+ if (attrs.hasOwnProperty(attr)) {
+ image[attr] = attrs[attr];
+ }
+ }
+
+ container.className = 'container';
+ container.appendChild(image);
+ document.body.appendChild(container);
+
+ return image;
+ },
+ dispatchEvent: function (element, type, data) {
+ var event;
+
+ if (element.dispatchEvent) {
+ // Event and CustomEvent on IE9-11 are global objects, not constructors
+ if (typeof Event === 'function' && typeof CustomEvent === 'function') {
+ if (!data) {
+ event = new Event(type, {
+ bubbles: true,
+ cancelable: true
+ });
+ } else {
+ event = new CustomEvent(type, {
+ detail: data,
+ bubbles: true,
+ cancelable: true
+ });
+ }
+ } else if (!data) {
+ event = document.createEvent('Event');
+ event.initEvent(type, true, true);
+ } else {
+ event = document.createEvent('CustomEvent');
+ event.initCustomEvent(type, true, true, data);
+ }
+
+ // IE9+
+ return element.dispatchEvent(event);
+ } else if (element.fireEvent) {
+ // IE6-10 (native events only)
+ return element.fireEvent('on' + type);
+ }
+ }
+};
diff --git a/library/cropperjs/test/methods/clear.js b/library/cropperjs/test/methods/clear.js
new file mode 100644
index 000000000..6510ebad2
--- /dev/null
+++ b/library/cropperjs/test/methods/clear.js
@@ -0,0 +1,29 @@
+QUnit.test('methods#clear', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+
+ cropper.clear();
+ assert.notOk(cropper.cropped);
+ assert.deepEqual(cropper.getData(), {
+ x: 0,
+ y: 0,
+ width: 0,
+ height: 0,
+ rotate: 0,
+ scaleX: 1,
+ scaleY: 1
+ });
+ assert.deepEqual(cropper.getCropBoxData(), {});
+ assert.ok(util.hasClass(cropper.cropBox, 'cropper-hidden'));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/crop.js b/library/cropperjs/test/methods/crop.js
new file mode 100644
index 000000000..e4ae679f1
--- /dev/null
+++ b/library/cropperjs/test/methods/crop.js
@@ -0,0 +1,24 @@
+QUnit.test('methods#crop', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ autoCrop: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.notOk(cropper.cropped);
+ assert.ok(util.hasClass(cropper.cropBox, 'cropper-hidden'));
+
+ cropper.crop();
+ assert.ok(cropper.cropped);
+ assert.notOk(util.hasClass(cropper.cropBox, 'cropper-hidden'));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/destroy.js b/library/cropperjs/test/methods/destroy.js
new file mode 100644
index 000000000..cb65e0696
--- /dev/null
+++ b/library/cropperjs/test/methods/destroy.js
@@ -0,0 +1,22 @@
+QUnit.test('methods#destroy', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.ok(typeof cropper === 'object');
+ assert.ok(util.hasClass(image, 'cropper-hidden'));
+
+ cropper.destroy();
+ assert.ok(typeof this.cropper === 'undefined');
+ assert.notOk(util.hasClass(image, 'cropper-hidden'));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/disable.js b/library/cropperjs/test/methods/disable.js
new file mode 100644
index 000000000..c87f7aa91
--- /dev/null
+++ b/library/cropperjs/test/methods/disable.js
@@ -0,0 +1,60 @@
+QUnit.test('methods#disable', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(11);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var options = cropper.options;
+ var cropBoxData;
+ var canvasData;
+ var imageData;
+ var action;
+
+ cropper.disable();
+ assert.ok(cropper.disabled);
+ assert.ok(util.hasClass(cropper.cropper, 'cropper-disabled'));
+
+ cropBoxData = cropper.getCropBoxData();
+ cropper.clear();
+ assert.deepEqual(cropper.getCropBoxData(), cropBoxData);
+
+ imageData = cropper.getImageData();
+ cropper.move(10, 10);
+ assert.deepEqual(cropper.getImageData(), imageData);
+
+ cropper.zoom(0.5);
+ assert.strictEqual(cropper.getImageData().ratio, imageData.ratio);
+
+ cropper.rotate(15);
+ assert.strictEqual(cropper.getImageData().rotate, imageData.rotate);
+
+ cropper.scale(-1);
+ assert.strictEqual(cropper.getImageData().scaleX, imageData.scaleX);
+
+ canvasData = cropper.getCanvasData();
+ cropper.setCanvasData({
+ width: canvasData.width - 160
+ });
+ assert.deepEqual(cropper.getCanvasData(), canvasData);
+
+ cropBoxData = cropper.getCropBoxData();
+ cropper.setCropBoxData({
+ height: cropBoxData.height - 90
+ });
+ assert.deepEqual(cropper.getCropBoxData(), cropBoxData);
+
+ cropper.setAspectRatio(0.618);
+ assert.ok(isNaN(options.aspectRatio));
+
+ action = cropper.dragBox.dataset.action;
+ cropper.setDragMode('none');
+ assert.strictEqual(cropper.dragBox.dataset.action, action);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/enable.js b/library/cropperjs/test/methods/enable.js
new file mode 100644
index 000000000..ebd5b9529
--- /dev/null
+++ b/library/cropperjs/test/methods/enable.js
@@ -0,0 +1,23 @@
+QUnit.test('methods#enable', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+
+ cropper.disable();
+ assert.ok(cropper.disabled);
+ assert.ok(util.hasClass(cropper.cropper, 'cropper-disabled'));
+
+ cropper.enable();
+ assert.notOk(cropper.disabled);
+ assert.notOk(util.hasClass(cropper.cropper, 'cropper-disabled'));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/getCanvasData.js b/library/cropperjs/test/methods/getCanvasData.js
new file mode 100644
index 000000000..60d96af4e
--- /dev/null
+++ b/library/cropperjs/test/methods/getCanvasData.js
@@ -0,0 +1,23 @@
+QUnit.test('methods#getCanvasData', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(6);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+
+ assert.ok(util.isNumber(canvasData.left));
+ assert.ok(util.isNumber(canvasData.top));
+ assert.ok(util.isNumber(canvasData.width));
+ assert.ok(util.isNumber(canvasData.height));
+ assert.ok(util.isNumber(canvasData.naturalWidth));
+ assert.ok(util.isNumber(canvasData.naturalHeight));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/getContainerData.js b/library/cropperjs/test/methods/getContainerData.js
new file mode 100644
index 000000000..094421ba0
--- /dev/null
+++ b/library/cropperjs/test/methods/getContainerData.js
@@ -0,0 +1,19 @@
+QUnit.test('methods#getContainerData', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var containerData = cropper.getContainerData();
+
+ assert.ok(util.isNumber(containerData.width));
+ assert.ok(util.isNumber(containerData.height));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/getCropBoxData.js b/library/cropperjs/test/methods/getCropBoxData.js
new file mode 100644
index 000000000..844c7953e
--- /dev/null
+++ b/library/cropperjs/test/methods/getCropBoxData.js
@@ -0,0 +1,21 @@
+QUnit.test('methods#getCropBoxData', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var cropBoxData = cropper.getCropBoxData();
+
+ assert.ok(util.isNumber(cropBoxData.left));
+ assert.ok(util.isNumber(cropBoxData.top));
+ assert.ok(util.isNumber(cropBoxData.width));
+ assert.ok(util.isNumber(cropBoxData.height));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/getCroppedCanvas.js b/library/cropperjs/test/methods/getCroppedCanvas.js
new file mode 100644
index 000000000..4117497a5
--- /dev/null
+++ b/library/cropperjs/test/methods/getCroppedCanvas.js
@@ -0,0 +1,33 @@
+QUnit.test('methods#getCroppedCanvas', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(7);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var canvas = cropper.getCroppedCanvas({
+ width: 160,
+ height: 90
+ });
+ var pixelData;
+
+ assert.ok(canvas instanceof HTMLCanvasElement);
+ assert.strictEqual(canvas.width, 160);
+ assert.strictEqual(canvas.height, 90);
+
+ canvas = cropper.rotate(90).getCroppedCanvas({
+ fillColor: '#010101'
+ });
+ pixelData = canvas.getContext('2d').getImageData(0, 0, 1, 1).data;
+ assert.strictEqual(pixelData[0], 1, 'red is 1');
+ assert.strictEqual(pixelData[1], 1, 'green is 1');
+ assert.strictEqual(pixelData[2], 1, 'blue is 1');
+ assert.strictEqual(pixelData[3], 255, 'color is opaque');
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/getData.js b/library/cropperjs/test/methods/getData.js
new file mode 100644
index 000000000..9c519eb7f
--- /dev/null
+++ b/library/cropperjs/test/methods/getData.js
@@ -0,0 +1,46 @@
+QUnit.test('methods#getData', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(7);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var data = cropper.getData();
+
+ assert.ok(util.isNumber(data.x));
+ assert.ok(util.isNumber(data.y));
+ assert.ok(util.isNumber(data.width));
+ assert.ok(util.isNumber(data.height));
+ assert.ok(util.isNumber(data.rotate));
+ assert.ok(util.isNumber(data.scaleX));
+ assert.ok(util.isNumber(data.scaleY));
+
+ done();
+ }
+ });
+});
+
+QUnit.test('methods#getData: rounded', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var data = cropper.getData(true);
+
+ assert.ok(data.x % 1 === 0);
+ assert.ok(data.y % 1 === 0);
+ assert.ok(data.width % 1 === 0);
+ assert.ok(data.height % 1 === 0);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/getImageData.js b/library/cropperjs/test/methods/getImageData.js
new file mode 100644
index 000000000..bd6e1941d
--- /dev/null
+++ b/library/cropperjs/test/methods/getImageData.js
@@ -0,0 +1,31 @@
+QUnit.test('methods#getImageData', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(10);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var imageData = cropper.getImageData();
+
+ assert.ok(util.isNumber(imageData.naturalWidth));
+ assert.ok(util.isNumber(imageData.naturalHeight));
+ assert.ok(util.isNumber(imageData.aspectRatio));
+ assert.ok(util.isNumber(imageData.left));
+ assert.ok(util.isNumber(imageData.top));
+ assert.ok(util.isNumber(imageData.width));
+ assert.ok(util.isNumber(imageData.height));
+
+ imageData = cropper.rotateTo(45).getImageData();
+ assert.strictEqual(imageData.rotate, 45);
+
+ imageData = cropper.scale(-1, -1).getImageData();
+ assert.strictEqual(imageData.scaleX, -1);
+ assert.strictEqual(imageData.scaleY, -1);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/move.js b/library/cropperjs/test/methods/move.js
new file mode 100644
index 000000000..c2ead8412
--- /dev/null
+++ b/library/cropperjs/test/methods/move.js
@@ -0,0 +1,20 @@
+QUnit.test('methods#move', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+ var changedCanvasData = cropper.move(1, 1).getCanvasData();
+
+ assert.strictEqual(changedCanvasData.left, canvasData.left + 1);
+ assert.strictEqual(changedCanvasData.top, canvasData.top + 1);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/moveTo.js b/library/cropperjs/test/methods/moveTo.js
new file mode 100644
index 000000000..e8bf0eebd
--- /dev/null
+++ b/library/cropperjs/test/methods/moveTo.js
@@ -0,0 +1,19 @@
+QUnit.test('methods#moveTo', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.moveTo(0, 0).getCanvasData();
+
+ assert.strictEqual(canvasData.left, 0);
+ assert.strictEqual(canvasData.top, 0);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/replace.js b/library/cropperjs/test/methods/replace.js
new file mode 100644
index 000000000..3fc8fe0b6
--- /dev/null
+++ b/library/cropperjs/test/methods/replace.js
@@ -0,0 +1,23 @@
+QUnit.test('methods#replace', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+
+ cropper.options.ready = function () {
+ assert.notOk(cropper.cropped);
+ cropper.crop();
+ assert.ok(cropper.cropped);
+ done();
+ };
+
+ cropper.options.autoCrop = false;
+ cropper.replace('../docs/images/picture-2.jpg');
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/reset.js b/library/cropperjs/test/methods/reset.js
new file mode 100644
index 000000000..3e047394c
--- /dev/null
+++ b/library/cropperjs/test/methods/reset.js
@@ -0,0 +1,35 @@
+QUnit.test('methods#reset', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+ var cropBoxData = cropper.getCropBoxData();
+
+ cropper.setCanvasData({
+ top: canvasData.top + 10,
+ width: canvasData.width - 10
+ });
+
+ assert.notDeepEqual(cropper.getCanvasData(), canvasData);
+
+ cropper.setCropBoxData({
+ left: cropBoxData.left + 10,
+ height: cropBoxData.height - 10
+ });
+
+ assert.notDeepEqual(cropper.getCropBoxData(), cropBoxData);
+
+ cropper.reset();
+ assert.deepEqual(cropper.getCanvasData(), canvasData);
+ assert.deepEqual(cropper.getCropBoxData(), cropBoxData);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/rotate.js b/library/cropperjs/test/methods/rotate.js
new file mode 100644
index 000000000..749096f0b
--- /dev/null
+++ b/library/cropperjs/test/methods/rotate.js
@@ -0,0 +1,19 @@
+QUnit.test('methods#rotate', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(3);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.rotate(360).getImageData().rotate, 0);
+ assert.strictEqual(cropper.rotate(90).getImageData().rotate, 90);
+ assert.strictEqual(cropper.rotate(-180).getImageData().rotate, -90);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/rotateTo.js b/library/cropperjs/test/methods/rotateTo.js
new file mode 100644
index 000000000..323431e76
--- /dev/null
+++ b/library/cropperjs/test/methods/rotateTo.js
@@ -0,0 +1,20 @@
+QUnit.test('methods#rotateTo', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.rotateTo(360).getImageData().rotate, 0);
+ assert.strictEqual(cropper.rotateTo(90).getImageData().rotate, 90);
+ assert.strictEqual(cropper.rotateTo(0).getImageData().rotate, 0);
+ assert.strictEqual(cropper.rotateTo(-180).getImageData().rotate, -180);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/scale.js b/library/cropperjs/test/methods/scale.js
new file mode 100644
index 000000000..be1caa589
--- /dev/null
+++ b/library/cropperjs/test/methods/scale.js
@@ -0,0 +1,19 @@
+QUnit.test('methods#scale', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var imageData = cropper.scale(-1, -1).getImageData();
+
+ assert.strictEqual(imageData.scaleX, -1);
+ assert.strictEqual(imageData.scaleY, -1);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/scaleX.js b/library/cropperjs/test/methods/scaleX.js
new file mode 100644
index 000000000..c799df58d
--- /dev/null
+++ b/library/cropperjs/test/methods/scaleX.js
@@ -0,0 +1,18 @@
+QUnit.test('methods#scaleX', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var imageData = cropper.scaleX(-1).getImageData();
+
+ assert.strictEqual(imageData.scaleX, -1);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/scaleY.js b/library/cropperjs/test/methods/scaleY.js
new file mode 100644
index 000000000..026b93a1f
--- /dev/null
+++ b/library/cropperjs/test/methods/scaleY.js
@@ -0,0 +1,18 @@
+QUnit.test('methods#scaleY', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var imageData = cropper.scaleY(-1).getImageData();
+
+ assert.strictEqual(imageData.scaleY, -1);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/setAspectRatio.js b/library/cropperjs/test/methods/setAspectRatio.js
new file mode 100644
index 000000000..ddf46798d
--- /dev/null
+++ b/library/cropperjs/test/methods/setAspectRatio.js
@@ -0,0 +1,20 @@
+QUnit.test('methods#setAspectRatio', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var options = cropper.options;
+
+ assert.ok(isNaN(options.aspectRatio));
+ cropper.setAspectRatio(1);
+ assert.strictEqual(options.aspectRatio, 1);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/setCanvasData.js b/library/cropperjs/test/methods/setCanvasData.js
new file mode 100644
index 000000000..e8f6511dc
--- /dev/null
+++ b/library/cropperjs/test/methods/setCanvasData.js
@@ -0,0 +1,34 @@
+QUnit.test('methods#setCanvasData', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(6);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+ var changedCanvasData = cropper.setCanvasData({
+ left: 16,
+ top: 9
+ }).getCanvasData();
+
+ assert.notStrictEqual(changedCanvasData.left, canvasData.left);
+ assert.notStrictEqual(changedCanvasData.top, canvasData.top);
+ assert.strictEqual(changedCanvasData.width, canvasData.width);
+ assert.strictEqual(changedCanvasData.height, canvasData.height);
+
+ canvasData = cropper.getCanvasData();
+ changedCanvasData = cropper.setCanvasData({
+ width: 320,
+ height: 180
+ }).getCanvasData();
+
+ assert.notStrictEqual(changedCanvasData.width, canvasData.width);
+ assert.notStrictEqual(changedCanvasData.height, canvasData.height);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/setCropBoxData.js b/library/cropperjs/test/methods/setCropBoxData.js
new file mode 100644
index 000000000..e78767cfc
--- /dev/null
+++ b/library/cropperjs/test/methods/setCropBoxData.js
@@ -0,0 +1,36 @@
+QUnit.test('methods#setCropBoxData', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(8);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var cropBoxData = cropper.getCropBoxData();
+ var changedCropBoxData = cropper.setCropBoxData({
+ left: 16,
+ top: 9
+ }).getCropBoxData();
+
+ assert.notStrictEqual(changedCropBoxData.left, cropBoxData.left);
+ assert.notStrictEqual(changedCropBoxData.top, cropBoxData.top);
+ assert.strictEqual(changedCropBoxData.width, cropBoxData.width);
+ assert.strictEqual(changedCropBoxData.height, cropBoxData.height);
+
+ cropBoxData = cropper.getCropBoxData();
+ changedCropBoxData = cropper.setCropBoxData({
+ width: 320,
+ height: 180
+ }).getCropBoxData();
+
+ assert.strictEqual(changedCropBoxData.left, cropBoxData.left);
+ assert.strictEqual(changedCropBoxData.top, cropBoxData.top);
+ assert.notStrictEqual(changedCropBoxData.width, cropBoxData.width);
+ assert.notStrictEqual(changedCropBoxData.height, cropBoxData.height);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/setData.js b/library/cropperjs/test/methods/setData.js
new file mode 100644
index 000000000..4e1360f09
--- /dev/null
+++ b/library/cropperjs/test/methods/setData.js
@@ -0,0 +1,36 @@
+QUnit.test('methods#setData', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(8);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var data = cropper.getData();
+ var changedData = cropper.setData({
+ x: 16,
+ y: 9
+ }).getData();
+
+ assert.notStrictEqual(changedData.x, data.x);
+ assert.notStrictEqual(changedData.y, data.y);
+ assert.strictEqual(changedData.width, data.width);
+ assert.strictEqual(changedData.height, data.height);
+
+ data = cropper.getData();
+ changedData = cropper.setData({
+ width: 320,
+ height: 180
+ }).getData();
+
+ assert.strictEqual(changedData.x, data.x);
+ assert.strictEqual(changedData.y, data.y);
+ assert.notStrictEqual(changedData.width, data.width);
+ assert.notStrictEqual(changedData.height, data.height);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/setDragMode.js b/library/cropperjs/test/methods/setDragMode.js
new file mode 100644
index 000000000..1b611af9b
--- /dev/null
+++ b/library/cropperjs/test/methods/setDragMode.js
@@ -0,0 +1,27 @@
+QUnit.test('methods#setDragMode', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var dragBox = cropper.dragBox;
+
+ assert.strictEqual(dragBox.dataset.action, 'crop');
+
+ cropper.setDragMode('move');
+ assert.strictEqual(dragBox.dataset.action, 'move');
+
+ cropper.setDragMode('crop');
+ assert.strictEqual(dragBox.dataset.action, 'crop');
+
+ cropper.setDragMode('none');
+ assert.strictEqual(dragBox.dataset.action, 'none');
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/zoom.js b/library/cropperjs/test/methods/zoom.js
new file mode 100644
index 000000000..70a1a763a
--- /dev/null
+++ b/library/cropperjs/test/methods/zoom.js
@@ -0,0 +1,20 @@
+QUnit.test('methods#zoom', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+ var changedCanvasData = cropper.zoom(0.1).getCanvasData();
+
+ assert.ok(changedCanvasData.width > canvasData.width);
+ assert.ok(changedCanvasData.height > canvasData.height);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/methods/zoomTo.js b/library/cropperjs/test/methods/zoomTo.js
new file mode 100644
index 000000000..dd9e81760
--- /dev/null
+++ b/library/cropperjs/test/methods/zoomTo.js
@@ -0,0 +1,21 @@
+QUnit.test('methods#zoomTo', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(3);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var imageData = cropper.zoomTo(1).getImageData();
+ var canvasData = cropper.getCanvasData();
+
+ assert.strictEqual(imageData.width, imageData.naturalWidth);
+ assert.strictEqual(canvasData.width, canvasData.naturalWidth);
+ assert.strictEqual(canvasData.naturalWidth, imageData.naturalWidth);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/aspectRatio.js b/library/cropperjs/test/options/aspectRatio.js
new file mode 100644
index 000000000..d7ba89401
--- /dev/null
+++ b/library/cropperjs/test/options/aspectRatio.js
@@ -0,0 +1,39 @@
+QUnit.test('options#aspectRatio: NaN', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // aspectRatio: NaN,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.ok(isNaN(cropper.options.aspectRatio));
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#aspectRatio: 1', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ aspectRatio: 1,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.options.aspectRatio, 1);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/autoCrop.js b/library/cropperjs/test/options/autoCrop.js
new file mode 100644
index 000000000..f010966eb
--- /dev/null
+++ b/library/cropperjs/test/options/autoCrop.js
@@ -0,0 +1,39 @@
+QUnit.test('options#autoCrop: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // autoCrop: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.ok(cropper.cropped);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#autoCrop: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ autoCrop: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.notOk(cropper.cropped);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/background.js b/library/cropperjs/test/options/background.js
new file mode 100644
index 000000000..21dbb8b12
--- /dev/null
+++ b/library/cropperjs/test/options/background.js
@@ -0,0 +1,40 @@
+QUnit.test('options#background: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // background: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.ok(util.hasClass(cropper.cropper, 'cropper-bg'));
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#background: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ background: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.notOk(util.hasClass(cropper.cropper, 'cropper-bg'));
+
+ done();
+ }
+ });
+
+});
diff --git a/library/cropperjs/test/options/center.js b/library/cropperjs/test/options/center.js
new file mode 100644
index 000000000..5d45eb021
--- /dev/null
+++ b/library/cropperjs/test/options/center.js
@@ -0,0 +1,41 @@
+QUnit.test('options#center: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // center: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var center = util.getByClass(cropper.cropBox, 'cropper-center');
+
+ assert.notOk(util.hasClass(center[0], 'cropper-hidden'));
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#center: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ center: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var center = util.getByClass(cropper.cropBox, 'cropper-center');
+
+ assert.ok(util.hasClass(center[0], 'cropper-hidden'));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/checkCrossOrigin.js b/library/cropperjs/test/options/checkCrossOrigin.js
new file mode 100644
index 000000000..86fde8f6f
--- /dev/null
+++ b/library/cropperjs/test/options/checkCrossOrigin.js
@@ -0,0 +1,67 @@
+QUnit.test('options#checkCrossOrigin: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage({
+ src: 'https://fengyuanchen.github.io/cropperjs/images/picture.jpg'
+ });
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ // checkCrossOrigin: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.image.crossOrigin, 'anonymous');
+ assert.ok(cropper.image.src.indexOf('timestamp') >= 0);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#checkCrossOrigin: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage({
+ src: 'https://fengyuanchen.github.io/cropperjs/images/picture.jpg'
+ });
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ checkCrossOrigin: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.notStrictEqual(cropper.image.crossOrigin, 'anonymous');
+ assert.ok(cropper.image.src.indexOf('timestamp') < 0);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#checkCrossOrigin: exists crossOrigin attribute', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage({
+ src: 'https://fengyuanchen.github.io/cropperjs/images/picture.jpg',
+ crossOrigin: 'anonymous'
+ });
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.image.crossOrigin, 'anonymous');
+ assert.ok(cropper.image.src.indexOf('timestamp') < 0);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/checkOrientation.js b/library/cropperjs/test/options/checkOrientation.js
new file mode 100644
index 000000000..0fe548404
--- /dev/null
+++ b/library/cropperjs/test/options/checkOrientation.js
@@ -0,0 +1,43 @@
+QUnit.test('options#checkOrientation: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage({
+ src: '../docs/images/picture-3.jpg'
+ });
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // checkOrientation: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.notStrictEqual(cropper.getData().rotate, 0);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#checkOrientation: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage({
+ src: '../docs/images/picture-3.jpg'
+ });
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ checkOrientation: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.getData().rotate, 0);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/crop.js b/library/cropperjs/test/options/crop.js
new file mode 100644
index 000000000..a4b48585e
--- /dev/null
+++ b/library/cropperjs/test/options/crop.js
@@ -0,0 +1,21 @@
+QUnit.test('options#crop', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(7);
+
+ return new Cropper(image, {
+ crop: function (e) {
+ assert.ok(util.isNumber(e.detail.x));
+ assert.ok(util.isNumber(e.detail.y));
+ assert.ok(util.isNumber(e.detail.width));
+ assert.ok(util.isNumber(e.detail.height));
+ assert.ok(util.isNumber(e.detail.rotate));
+ assert.ok(util.isNumber(e.detail.scaleX));
+ assert.ok(util.isNumber(e.detail.scaleY));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/cropBoxMovable.js b/library/cropperjs/test/options/cropBoxMovable.js
new file mode 100644
index 000000000..d5d3e1d7d
--- /dev/null
+++ b/library/cropperjs/test/options/cropBoxMovable.js
@@ -0,0 +1,41 @@
+QUnit.test('options#cropBoxMovable: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // cropBoxMovable: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var face = util.getByClass(cropper.cropBox, 'cropper-face');
+
+ assert.strictEqual(face[0].dataset.action, 'all');
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#cropBoxMovable: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ cropBoxMovable: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var face = util.getByClass(cropper.cropBox, 'cropper-face');
+
+ assert.strictEqual(face[0].dataset.action, cropper.options.dragMode);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/cropBoxResizable.js b/library/cropperjs/test/options/cropBoxResizable.js
new file mode 100644
index 000000000..37093642b
--- /dev/null
+++ b/library/cropperjs/test/options/cropBoxResizable.js
@@ -0,0 +1,65 @@
+QUnit.test('options#cropBoxResizable: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(12);
+
+ return new Cropper(image, {
+ // cropBoxResizable: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var line = util.getByClass(cropper.cropBox, 'cropper-line');
+ var point = util.getByClass(cropper.cropBox, 'cropper-point');
+
+ assert.notOk(util.hasClass(line[0], 'cropper-hidden'));
+ assert.notOk(util.hasClass(line[1], 'cropper-hidden'));
+ assert.notOk(util.hasClass(line[2], 'cropper-hidden'));
+ assert.notOk(util.hasClass(line[3], 'cropper-hidden'));
+ assert.notOk(util.hasClass(point[0], 'cropper-hidden'));
+ assert.notOk(util.hasClass(point[1], 'cropper-hidden'));
+ assert.notOk(util.hasClass(point[2], 'cropper-hidden'));
+ assert.notOk(util.hasClass(point[3], 'cropper-hidden'));
+ assert.notOk(util.hasClass(point[4], 'cropper-hidden'));
+ assert.notOk(util.hasClass(point[5], 'cropper-hidden'));
+ assert.notOk(util.hasClass(point[6], 'cropper-hidden'));
+ assert.notOk(util.hasClass(point[7], 'cropper-hidden'));
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#cropBoxResizable: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(12);
+
+ return new Cropper(image, {
+ cropBoxResizable: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var line = util.getByClass(cropper.cropBox, 'cropper-line');
+ var point = util.getByClass(cropper.cropBox, 'cropper-point');
+
+ assert.ok(util.hasClass(line[0], 'cropper-hidden'));
+ assert.ok(util.hasClass(line[1], 'cropper-hidden'));
+ assert.ok(util.hasClass(line[2], 'cropper-hidden'));
+ assert.ok(util.hasClass(line[3], 'cropper-hidden'));
+ assert.ok(util.hasClass(point[0], 'cropper-hidden'));
+ assert.ok(util.hasClass(point[1], 'cropper-hidden'));
+ assert.ok(util.hasClass(point[2], 'cropper-hidden'));
+ assert.ok(util.hasClass(point[3], 'cropper-hidden'));
+ assert.ok(util.hasClass(point[4], 'cropper-hidden'));
+ assert.ok(util.hasClass(point[5], 'cropper-hidden'));
+ assert.ok(util.hasClass(point[6], 'cropper-hidden'));
+ assert.ok(util.hasClass(point[7], 'cropper-hidden'));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/cropend.js b/library/cropperjs/test/options/cropend.js
new file mode 100644
index 000000000..abfe815c0
--- /dev/null
+++ b/library/cropperjs/test/options/cropend.js
@@ -0,0 +1,24 @@
+QUnit.test('options#cropend', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ ready: function () {
+ var PointerEvent = window.PointerEvent;
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointermove' : 'mousemove');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup');
+
+ done();
+ },
+
+ cropend: function (e) {
+ assert.strictEqual(e.detail.action, 'crop');
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/cropmove.js b/library/cropperjs/test/options/cropmove.js
new file mode 100644
index 000000000..fa20f4011
--- /dev/null
+++ b/library/cropperjs/test/options/cropmove.js
@@ -0,0 +1,24 @@
+QUnit.test('options#cropmove', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ ready: function () {
+ var PointerEvent = window.PointerEvent;
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointermove' : 'mousemove');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup');
+
+ done();
+ },
+
+ cropmove: function (e) {
+ assert.strictEqual(e.detail.action, 'crop');
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/cropstart.js b/library/cropperjs/test/options/cropstart.js
new file mode 100644
index 000000000..f547269cd
--- /dev/null
+++ b/library/cropperjs/test/options/cropstart.js
@@ -0,0 +1,56 @@
+QUnit.test('options#cropstart', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ ready: function () {
+ var PointerEvent = window.PointerEvent;
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup');
+
+ done();
+ },
+
+ cropstart: function (e) {
+ assert.strictEqual(e.detail.action, 'crop');
+ }
+ });
+});
+
+QUnit.test('options#cropstart: default prevented', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(0);
+
+ return new Cropper(image, {
+ ready: function () {
+ var PointerEvent = window.PointerEvent;
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointermove' : 'mousemove');
+ util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup');
+
+ done();
+ },
+
+ cropstart: function (e) {
+ e.preventDefault();
+ },
+
+ cropmove: function () {
+ assert.ok(false);
+ },
+
+ cropend: function () {
+ assert.ok(false);
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/data.js b/library/cropperjs/test/options/data.js
new file mode 100644
index 000000000..e9da6a4dd
--- /dev/null
+++ b/library/cropperjs/test/options/data.js
@@ -0,0 +1,35 @@
+QUnit.test('options#data', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+ var initialData = {
+ x: 360,
+ y: 450,
+ width: 640,
+ height: 360,
+ rotate: 45,
+ scaleX: -1,
+ scaleY: -1
+ };
+
+ assert.expect(7);
+
+ return new Cropper(image, {
+ data: initialData,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var data = cropper.getData(true);
+
+ assert.strictEqual(data.x, initialData.x);
+ assert.strictEqual(data.y, initialData.y);
+ assert.strictEqual(data.width, initialData.width);
+ assert.strictEqual(data.height, initialData.height);
+ assert.strictEqual(data.rotate, initialData.rotate);
+ assert.strictEqual(data.scaleX, initialData.scaleX);
+ assert.strictEqual(data.scaleY, initialData.scaleY);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/dragMode.js b/library/cropperjs/test/options/dragMode.js
new file mode 100644
index 000000000..57f31ff13
--- /dev/null
+++ b/library/cropperjs/test/options/dragMode.js
@@ -0,0 +1,60 @@
+QUnit.test('options#dragMode: crop', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // dragMode: 'crop',
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.dragBox.dataset.action, 'crop');
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#dragMode: move', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ dragMode: 'move',
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.dragBox.dataset.action, 'move');
+
+ done();
+ }
+ });
+});
+
+
+QUnit.test('options#dragMode: none', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ dragMode: 'none',
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.dragBox.dataset.action, 'none');
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/guides.js b/library/cropperjs/test/options/guides.js
new file mode 100644
index 000000000..298c3ad3a
--- /dev/null
+++ b/library/cropperjs/test/options/guides.js
@@ -0,0 +1,43 @@
+QUnit.test('options#guides: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ // guides: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var dashed = util.getByClass(cropper.cropBox, 'cropper-dashed');
+
+ assert.notOk(util.hasClass(dashed[0], 'cropper-hidden'));
+ assert.notOk(util.hasClass(dashed[1], 'cropper-hidden'));
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#guides: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ guides: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var dashed = util.getByClass(cropper.cropBox, 'cropper-dashed');
+
+ assert.ok(util.hasClass(dashed[0], 'cropper-hidden'));
+ assert.ok(util.hasClass(dashed[1], 'cropper-hidden'));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/highlight.js b/library/cropperjs/test/options/highlight.js
new file mode 100644
index 000000000..a1db4687f
--- /dev/null
+++ b/library/cropperjs/test/options/highlight.js
@@ -0,0 +1,41 @@
+QUnit.test('options#highlight: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // highlight: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var face = util.getByClass(cropper.cropBox, 'cropper-face');
+
+ assert.notOk(util.hasClass(face[0], 'cropper-invisible'));
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#highlight: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ highlight: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var face = util.getByClass(cropper.cropBox, 'cropper-face');
+
+ assert.ok(util.hasClass(face[0], 'cropper-invisible'));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/minCanvasHeight.js b/library/cropperjs/test/options/minCanvasHeight.js
new file mode 100644
index 000000000..c9745a9b1
--- /dev/null
+++ b/library/cropperjs/test/options/minCanvasHeight.js
@@ -0,0 +1,23 @@
+QUnit.test('options#minCanvasHeight', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+ var minCanvasHeight = 270;
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ minCanvasHeight: minCanvasHeight,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.setCanvasData({
+ height: 180
+ }).getCanvasData();
+
+ assert.strictEqual(Math.round(canvasData.height), minCanvasHeight);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/minCanvasWidth.js b/library/cropperjs/test/options/minCanvasWidth.js
new file mode 100644
index 000000000..61601e4f9
--- /dev/null
+++ b/library/cropperjs/test/options/minCanvasWidth.js
@@ -0,0 +1,23 @@
+QUnit.test('options#minCanvasWidth', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+ var minCanvasWidth = 480;
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ minCanvasWidth: minCanvasWidth,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.setCanvasData({
+ width: 320
+ }).getCanvasData();
+
+ assert.strictEqual(Math.round(canvasData.width), minCanvasWidth);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/minContainerHeight.js b/library/cropperjs/test/options/minContainerHeight.js
new file mode 100644
index 000000000..85d7a70ef
--- /dev/null
+++ b/library/cropperjs/test/options/minContainerHeight.js
@@ -0,0 +1,21 @@
+QUnit.test('options#minContainerHeight', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+ var minContainerHeight = 361;
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ minContainerHeight: minContainerHeight,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var containerData = cropper.getContainerData();
+
+ assert.strictEqual(Math.round(containerData.height), minContainerHeight);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/minContainerWidth.js b/library/cropperjs/test/options/minContainerWidth.js
new file mode 100644
index 000000000..2119cc96e
--- /dev/null
+++ b/library/cropperjs/test/options/minContainerWidth.js
@@ -0,0 +1,21 @@
+QUnit.test('options#minContainerWidth', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+ var minContainerWidth = 641;
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ minContainerWidth: minContainerWidth,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var containerData = cropper.getContainerData();
+
+ assert.strictEqual(Math.round(containerData.width), minContainerWidth);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/minCropBoxHeight.js b/library/cropperjs/test/options/minCropBoxHeight.js
new file mode 100644
index 000000000..ccf50aefe
--- /dev/null
+++ b/library/cropperjs/test/options/minCropBoxHeight.js
@@ -0,0 +1,23 @@
+QUnit.test('options#minCropBoxHeight', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+ var minCropBoxHeight = 150;
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ minCropBoxHeight: minCropBoxHeight,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var cropBoxData = cropper.setCropBoxData({
+ height: 100
+ }).getCropBoxData();
+
+ assert.strictEqual(Math.round(cropBoxData.height), minCropBoxHeight);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/minCropBoxWidth.js b/library/cropperjs/test/options/minCropBoxWidth.js
new file mode 100644
index 000000000..acde5c366
--- /dev/null
+++ b/library/cropperjs/test/options/minCropBoxWidth.js
@@ -0,0 +1,23 @@
+QUnit.test('options#minCropBoxWidth', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+ var minCropBoxWidth = 300;
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ minCropBoxWidth: minCropBoxWidth,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var cropBoxData = cropper.setCropBoxData({
+ width: 200
+ }).getCropBoxData();
+
+ assert.strictEqual(Math.round(cropBoxData.width), minCropBoxWidth);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/modal.js b/library/cropperjs/test/options/modal.js
new file mode 100644
index 000000000..7284cb264
--- /dev/null
+++ b/library/cropperjs/test/options/modal.js
@@ -0,0 +1,39 @@
+QUnit.test('options#modal: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // modal: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.ok(util.hasClass(cropper.dragBox, 'cropper-modal'));
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#modal: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ modal: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.notOk(util.hasClass(cropper.dragBox, 'cropper-modal'));
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/movable.js b/library/cropperjs/test/options/movable.js
new file mode 100644
index 000000000..0e2c53506
--- /dev/null
+++ b/library/cropperjs/test/options/movable.js
@@ -0,0 +1,45 @@
+QUnit.test('options#movable: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ // movable: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+ var changedCanvasData = cropper.move(10, 10).getCanvasData();
+
+ assert.strictEqual(changedCanvasData.left, canvasData.left + 10);
+ assert.strictEqual(changedCanvasData.top, canvasData.top + 10);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#movable: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ movable: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+ var changedCanvasData = cropper.move(10, 10).getCanvasData();
+
+ assert.strictEqual(changedCanvasData.left, canvasData.left);
+ assert.strictEqual(changedCanvasData.top, canvasData.top);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/ready.js b/library/cropperjs/test/options/ready.js
new file mode 100644
index 000000000..e09e8369c
--- /dev/null
+++ b/library/cropperjs/test/options/ready.js
@@ -0,0 +1,15 @@
+QUnit.test('options#ready', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ ready: function () {
+ assert.ok(true);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/rotatable.js b/library/cropperjs/test/options/rotatable.js
new file mode 100644
index 000000000..992e9362f
--- /dev/null
+++ b/library/cropperjs/test/options/rotatable.js
@@ -0,0 +1,39 @@
+QUnit.test('options#rotatable: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // rotatable: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.rotate(90).getImageData().rotate, 90);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#rotatable: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ rotatable: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ assert.strictEqual(cropper.rotate(90).getImageData().rotate, undefined);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/scalable.js b/library/cropperjs/test/options/scalable.js
new file mode 100644
index 000000000..c523eaf63
--- /dev/null
+++ b/library/cropperjs/test/options/scalable.js
@@ -0,0 +1,43 @@
+QUnit.test('options#scalable: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ // scalable: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var imageData = cropper.scale(-1, -1).getImageData();
+
+ assert.strictEqual(imageData.scaleX, -1);
+ assert.strictEqual(imageData.scaleY, -1);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#scalable: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ scalable: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var imageData = cropper.scale(-1, -1).getImageData();
+
+ assert.strictEqual(imageData.scaleX, undefined);
+ assert.strictEqual(imageData.scaleY, undefined);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/toggleDragModeOnDblclick.js b/library/cropperjs/test/options/toggleDragModeOnDblclick.js
new file mode 100644
index 000000000..df64327b2
--- /dev/null
+++ b/library/cropperjs/test/options/toggleDragModeOnDblclick.js
@@ -0,0 +1,45 @@
+QUnit.test('options#toggleDragModeOnDblclick: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ // toggleDragModeOnDblclick: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var dragBox = cropper.dragBox;
+
+ util.dispatchEvent(dragBox, 'dblclick');
+ assert.ok(util.hasClass(dragBox, 'cropper-move'));
+ assert.strictEqual(dragBox.dataset.action, 'move');
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#toggleDragModeOnDblclick: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ toggleDragModeOnDblclick: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var dragBox = cropper.dragBox;
+
+ util.dispatchEvent(dragBox, 'dblclick');
+ assert.ok(util.hasClass(dragBox, 'cropper-crop'));
+ assert.strictEqual(dragBox.dataset.action, 'crop');
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/viewMode.js b/library/cropperjs/test/options/viewMode.js
new file mode 100644
index 000000000..e39ec5fc1
--- /dev/null
+++ b/library/cropperjs/test/options/viewMode.js
@@ -0,0 +1,100 @@
+QUnit.test('options#viewMode: 0', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ // viewMode: 0,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = {
+ left: 100,
+ top: 100,
+ width: 160,
+ height: 90
+ };
+ var changedCanvasData = cropper.setCanvasData(canvasData).getCanvasData();
+
+ assert.strictEqual(changedCanvasData.left, canvasData.left);
+ assert.strictEqual(changedCanvasData.top, canvasData.top);
+ assert.strictEqual(changedCanvasData.width, canvasData.width);
+ assert.strictEqual(changedCanvasData.height, canvasData.height);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#viewMode: 1', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ viewMode: 1,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.zoom(-0.5).getCanvasData(); // Zoom out
+ var cropBoxData = cropper.getCropBoxData();
+
+ assert.ok(canvasData.width >= cropBoxData.width);
+ assert.ok(canvasData.height >= cropBoxData.height);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#viewMode: 2', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ viewMode: 2,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.zoom(-0.5).getCanvasData(); // Zoom out
+ var containerData = cropper.getContainerData();
+
+ assert.ok(canvasData.width >= containerData.width ||
+ canvasData.height >= containerData.height);
+
+ done();
+ }
+ });
+});
+
+QUnit.test('options#viewMode: 3', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(4);
+
+ return new Cropper(image, {
+ viewMode: 3,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.zoom(-0.5).getCanvasData(); // Zoom out
+ var containerData = cropper.getContainerData();
+
+ assert.ok(canvasData.left <= 0);
+ assert.ok(canvasData.top <= 0);
+ assert.ok(canvasData.width >= containerData.width);
+ assert.ok(canvasData.height >= containerData.height);
+
+ done();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/zoom.js b/library/cropperjs/test/options/zoom.js
new file mode 100644
index 000000000..51ebc76ad
--- /dev/null
+++ b/library/cropperjs/test/options/zoom.js
@@ -0,0 +1,46 @@
+QUnit.test('options#zoom', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(3);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+
+ cropper.zoom(0.1);
+
+ done();
+ },
+
+ zoom: function (e) {
+ assert.ok(e.detail.ratio > 0);
+ assert.ok(e.detail.oldRatio > 0);
+ assert.ok(e.detail.ratio > e.detail.oldRatio);
+ }
+ });
+});
+
+QUnit.test('options#zoom: default prevented', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+
+ assert.deepEqual(cropper.zoom(0.1).getCanvasData(), canvasData);
+
+ done();
+ },
+
+ zoom: function (e) {
+ e.preventDefault();
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/zoomOnWheel.js b/library/cropperjs/test/options/zoomOnWheel.js
new file mode 100644
index 000000000..1a1bf6dce
--- /dev/null
+++ b/library/cropperjs/test/options/zoomOnWheel.js
@@ -0,0 +1,47 @@
+QUnit.test('options#zoomOnWheel: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(1);
+
+ return new Cropper(image, {
+ // zoomOnWheel: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.cropper, 'wheel');
+
+ done();
+ },
+
+ zoom: function () {
+ assert.ok(true);
+ }
+ });
+});
+
+QUnit.test('options#zoomOnWheel: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(0);
+
+ return new Cropper(image, {
+ zoomOnWheel: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+
+ util.dispatchEvent(cropper.cropper, 'wheel');
+
+ done();
+ },
+
+ zoom: function () {
+ assert.ok(false);
+ }
+ });
+});
diff --git a/library/cropperjs/test/options/zoomable.js b/library/cropperjs/test/options/zoomable.js
new file mode 100644
index 000000000..9f8ec6fce
--- /dev/null
+++ b/library/cropperjs/test/options/zoomable.js
@@ -0,0 +1,51 @@
+QUnit.test('options#zoomable: true', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(3);
+
+ return new Cropper(image, {
+ // zoomable: true,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+ var changedCanvasData = cropper.zoom(0.1).getCanvasData();
+
+ assert.ok(changedCanvasData.width > canvasData.width);
+ assert.ok(changedCanvasData.height > canvasData.height);
+
+ done();
+ },
+ zoom: function () {
+ assert.ok(true);
+ }
+ });
+});
+
+QUnit.test('options#zoomable: false', function (assert) {
+ var done = assert.async();
+ var util = window.Util;
+ var image = util.createImage();
+
+ assert.expect(2);
+
+ return new Cropper(image, {
+ zoomable: false,
+
+ ready: function () {
+ var cropper = this.cropper;
+ var canvasData = cropper.getCanvasData();
+ var changedCanvasData = cropper.zoom(0.1).getCanvasData();
+
+ assert.ok(changedCanvasData.width === canvasData.width);
+ assert.ok(changedCanvasData.height === canvasData.height);
+
+ done();
+ },
+ zoom: function () {
+ assert.ok(false);
+ }
+ });
+});
diff --git a/view/tpl/cropbody.tpl b/view/tpl/cropbody.tpl
index 01d9a24a0..d35546ec6 100755
--- a/view/tpl/cropbody.tpl
+++ b/view/tpl/cropbody.tpl
@@ -6,36 +6,27 @@
<img src="{{$image_url}}" id="croppa" class="imgCrop" alt="{{$title}}" />
</div>
<div id="cropimage-preview-wrapper" >
-<div id="previewWrap" ></div>
+<div id="previewWrap" class="crop-preview" style="height: 300px; width: 300px; max-width: 300px; max-height: 300px; overflow: hidden;"></div>
</div>
<script type="text/javascript" language="javascript">
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- Event.observe( window, 'load', function() {
- new Cropper.ImgWithPreview(
- 'croppa',
- {
- previewWrap: 'previewWrap',
- minWidth: 300,
- minHeight: 300,
- maxWidth: 1024,
- maxHeight: 1024,
- ratioDim: { x: 100, y:100 },
- displayOnInit: true,
- onEndCrop: onEndCrop
- }
- );
- }
- );
+
+var image = document.getElementById('croppa');
+var cropper = new Cropper(image, {
+ aspectRatio: 1 / 1,
+ viewMode: 1,
+ preview: '.crop-preview',
+ crop: function(e) {
+ $( 'x1' ).value = e.detail.x;
+ $( 'y1' ).value = e.detail.y;
+ $( 'x2' ).value = e.detail.x + e.detail.width;
+ $( 'y2' ).value = e.detail.y + e.detail.height;
+ $( 'width' ).value = e.detail.scaleX;
+ $( 'height' ).value = e.detail.scaleY;
+
+ }
+});
</script>
diff --git a/view/tpl/cropcover.tpl b/view/tpl/cropcover.tpl
index 04b96a603..8888a967a 100755
--- a/view/tpl/cropcover.tpl
+++ b/view/tpl/cropcover.tpl
@@ -6,36 +6,26 @@
<img src="{{$image_url}}" id="croppa" class="imgCrop" alt="{{$title}}" />
</div>
<div id="cropimage-preview-wrapper" >
-<div id="previewWrap" ></div>
+<div id="previewWrap" class="crop-preview" style="width: 320px; height: 116px; max-width: 320px; max-height: 116px; overflow: hidden"></div>
</div>
<script type="text/javascript" language="javascript">
- function onEndCrop( coords, dimensions ) {
- $( 'x1' ).value = coords.x1;
- $( 'y1' ).value = coords.y1;
- $( 'x2' ).value = coords.x2;
- $( 'y2' ).value = coords.y2;
- $( 'width' ).value = dimensions.width;
- $( 'height' ).value = dimensions.height;
- }
-
- Event.observe( window, 'load', function() {
- new Cropper.ImgWithPreview(
- 'croppa',
- {
- previewWrap: 'previewWrap',
- minWidth: 240,
- minHeight: 87,
- maxWidth: 320,
- maxHeight: 116,
- ratioDim: { x: 100, y:36 },
- displayOnInit: true,
- onEndCrop: onEndCrop
- }
- );
- }
- );
+var image = document.getElementById('croppa');
+var cropper = new Cropper(image, {
+ aspectRatio: 2.75 / 1,
+ viewMode: 1,
+ preview: '.crop-preview',
+ crop: function(e) {
+ $( 'x1' ).value = e.detail.x;
+ $( 'y1' ).value = e.detail.y;
+ $( 'x2' ).value = e.detail.x + e.detail.width;
+ $( 'y2' ).value = e.detail.y + e.detail.height;
+ $( 'width' ).value = e.detail.scaleX;
+ $( 'height' ).value = e.detail.scaleY;
+
+ }
+});
</script>
diff --git a/view/tpl/crophead.tpl b/view/tpl/crophead.tpl
index 48f375426..a5a80c187 100755
--- a/view/tpl/crophead.tpl
+++ b/view/tpl/crophead.tpl
@@ -1,4 +1,3 @@
- <script type="text/javascript" src="library/cropper/lib/prototype.js" language="javascript"></script>
- <script type="text/javascript" src="library/cropper/lib/scriptaculous.js?load=effects,builder,dragdrop" language="javascript"></script>
- <script type="text/javascript" src="library/cropper/cropper.js" language="javascript"></script>
- <link rel="stylesheet" href="library/cropper/cropper.css" type="text/css" />
+<script type="text/javascript" src="library/cropperjs/dist/cropper.js" language="javascript"></script>
+<link rel="stylesheet" href="library/cropperjs/dist/cropper.css" type="text/css" />
+
diff --git a/view/tpl/settings_permcats.tpl b/view/tpl/settings_permcats.tpl
index f6bb9b036..bbbd41669 100644
--- a/view/tpl/settings_permcats.tpl
+++ b/view/tpl/settings_permcats.tpl
@@ -50,7 +50,7 @@
<table id="permcat-index">
{{foreach $permcats as $k => $v}}
<tr class="permcat-row-{{$k}}">
- <td width="99%"><a href="settings/permcats/{{$k}}">{{$k}}</a></td>
+ <td width="99%"><a href="settings/permcats/{{$k}}">{{$v}}</a></td>
<td width="1%"><i class="fa fa-trash-o drop-icons" onClick="dropItem('/settings/permcats/{{$k}}/drop', '.permcat-row-{{$k}}')"></i></td>
</tr>
{{/foreach}}