├── .bowerrc ├── .gitignore ├── DropZone.php ├── README.md ├── assets └── DropZoneAsset.php ├── bower.json ├── bower_components └── dropzone │ ├── .bower.json │ ├── bower.json │ └── dist │ ├── basic.css │ ├── dropzone-amd-module.js │ ├── dropzone.css │ ├── dropzone.js │ ├── min │ ├── basic.min.css │ ├── dropzone-amd-module.min.js │ ├── dropzone.min.css │ └── dropzone.min.js │ └── readme.md └── composer.json /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components" 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Include your project-specific ignores in this file 2 | # Read about how to use .gitignore: https://help.github.com/articles/ignoring-files 3 | # Compiled source # 4 | ################### 5 | *.com 6 | #*.class 7 | *.dll 8 | *.exe 9 | *.o 10 | *.so 11 | 12 | # Packages # 13 | ############ 14 | # it's better to unpack these files and commit the raw source 15 | # git has its own built in compression methods 16 | *.7z 17 | *.dmg 18 | *.gz 19 | *.iso 20 | *.jar 21 | *.rar 22 | *.tar 23 | *.zip 24 | 25 | # Logs and databases # 26 | ###################### 27 | *.log 28 | *.sql 29 | *.sqlite 30 | 31 | # OS generated files # 32 | ###################### 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | ehthumbs.db 39 | Thumbs.db 40 | 41 | 42 | #Composer 43 | ######### 44 | composer.phar 45 | vendor/ 46 | composer.lock 47 | 48 | #Compass 49 | ######### 50 | .sass-cache 51 | 52 | # Node 53 | ######### 54 | lib-cov 55 | lcov.info 56 | *.seed 57 | *.log 58 | *.csv 59 | *.dat 60 | *.out 61 | *.pid 62 | *.gz 63 | 64 | pids 65 | logs 66 | results 67 | build 68 | .grunt 69 | 70 | node_modules 71 | 72 | # PHPSTORM 73 | ######### 74 | .idea -------------------------------------------------------------------------------- /DropZone.php: -------------------------------------------------------------------------------- 1 | options['url'])) $this->options['url'] = $this->uploadUrl; // Set the url 43 | if (!isset($this->options['previewsContainer'])) $this->options['previewsContainer'] = '#' . $this->previewsContainer; // Define the element that should be used as click trigger to select files. 44 | if (!isset($this->options['clickable'])) $this->options['clickable'] = true; // Define the element that should be used as click trigger to select files. 45 | $this->autoDiscover = $this->autoDiscover===false?'false':'true'; 46 | 47 | if(\Yii::$app->getRequest()->enableCsrfValidation){ 48 | $this->options['headers'][\yii\web\Request::CSRF_HEADER] = \Yii::$app->getRequest()->getCsrfToken(); 49 | $this->options['params'][\Yii::$app->getRequest()->csrfParam] = \Yii::$app->getRequest()->getCsrfToken(); 50 | } 51 | 52 | \Yii::setAlias('@dropzone', dirname(__FILE__)); 53 | $this->registerAssets(); 54 | } 55 | 56 | public function run() 57 | { 58 | return Html::tag('div', $this->renderDropzone(), ['id' => $this->dropzoneContainer, 'class' => 'dropzone']); 59 | } 60 | 61 | private function renderDropzone() 62 | { 63 | $data = Html::tag('div', '', ['id' => $this->previewsContainer,'class' => 'dropzone-previews']); 64 | 65 | return $data; 66 | } 67 | 68 | /** 69 | * Registers the needed assets 70 | */ 71 | public function registerAssets() 72 | { 73 | $view = $this->getView(); 74 | 75 | $js = 'Dropzone.autoDiscover = ' . $this->autoDiscover . '; var ' . $this->id . ' = new Dropzone("div#' . $this->dropzoneContainer . '", ' . Json::encode($this->options) . ');'; 76 | 77 | if (!empty($this->clientEvents)) { 78 | foreach ($this->clientEvents as $event => $handler) { 79 | $js .= "$this->id.on('$event', $handler);"; 80 | } 81 | } 82 | 83 | $view->registerJs($js); 84 | DropZoneAsset::register($view); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Yii2 Dropzone 2 | ============= 3 | DropzoneJs Extention for Yii2 4 | 5 | A port of [DropzoneJs](http://www.dropzonejs.com/) for Yii2 Framework 6 | 7 | Installation 8 | ------------ 9 | 10 | The preferred way to install this extension is through [composer](http://getcomposer.org/download/). 11 | 12 | Either run 13 | 14 | ``` 15 | php composer.phar require --prefer-dist perminder-klair/yii2-dropzone "dev-master" 16 | ``` 17 | 18 | or add 19 | 20 | ``` 21 | "perminder-klair/yii2-dropzone": "dev-master" 22 | ``` 23 | 24 | to the require section of your `composer.json` file. 25 | 26 | 27 | Usage 28 | ----- 29 | 30 | Once the extension is installed, simply use it in your code by to create Ajax upload area : 31 | 32 | ```php 33 | echo \kato\DropZone::widget(); 34 | ``` 35 | 36 | 37 | To pass options : (More details at [dropzonejs official docs](http://www.dropzonejs.com/#toc_6) ) 38 | 39 | ```php 40 | echo \kato\DropZone::widget([ 41 | 'options' => [ 42 | 'maxFilesize' => '2', 43 | ], 44 | 'clientEvents' => [ 45 | 'complete' => "function(file){console.log(file)}", 46 | 'removedfile' => "function(file){alert(file.name + ' is removed')}" 47 | ], 48 | ]); 49 | ``` 50 | 51 | Example of upload method : 52 | 53 | ```php 54 | public function actionUpload() 55 | { 56 | $fileName = 'file'; 57 | $uploadPath = './files'; 58 | 59 | if (isset($_FILES[$fileName])) { 60 | $file = \yii\web\UploadedFile::getInstanceByName($fileName); 61 | 62 | //Print file data 63 | //print_r($file); 64 | 65 | if ($file->saveAs($uploadPath . '/' . $file->name)) { 66 | //Now save file data to database 67 | 68 | echo \yii\helpers\Json::encode($file); 69 | } 70 | } 71 | 72 | return false; 73 | } 74 | ``` 75 | -------------------------------------------------------------------------------- /assets/DropZoneAsset.php: -------------------------------------------------------------------------------- 1 | true 28 | ]; 29 | 30 | } -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yii2-dropzone", 3 | "version": "1.0.1", 4 | "dependencies": { 5 | "dropzone": "enyo/dropzone#4.2.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /bower_components/dropzone/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dropzone", 3 | "location": "enyo/dropzone", 4 | "version": "4.2.0", 5 | "description": "Dropzone is an easy to use drag'n'drop library. It supports image previews and shows nice progress bars.", 6 | "homepage": "http://www.dropzonejs.com", 7 | "main": [ 8 | "dist/min/dropzone.min.css", 9 | "dist/min/dropzone.min.js" 10 | ], 11 | "ignore": [ 12 | "*", 13 | "!dist", 14 | "!dist/**/*" 15 | ], 16 | "_release": "4.2.0", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "v4.2.0", 20 | "commit": "1482ed0a9016e27396b0e23f72b82dbb2904b085" 21 | }, 22 | "_source": "git://github.com/enyo/dropzone.git", 23 | "_target": "4.2.0", 24 | "_originalSource": "enyo/dropzone" 25 | } -------------------------------------------------------------------------------- /bower_components/dropzone/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dropzone", 3 | "location": "enyo/dropzone", 4 | "version": "4.2.0", 5 | "description": "Dropzone is an easy to use drag'n'drop library. It supports image previews and shows nice progress bars.", 6 | "homepage": "http://www.dropzonejs.com", 7 | "main": [ 8 | "dist/min/dropzone.min.css", 9 | "dist/min/dropzone.min.js" 10 | ], 11 | "ignore": [ 12 | "*", 13 | "!dist", 14 | "!dist/**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /bower_components/dropzone/dist/basic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright (c) 2012 Matias Meno 4 | */ 5 | .dropzone, .dropzone * { 6 | box-sizing: border-box; } 7 | 8 | .dropzone { 9 | position: relative; } 10 | .dropzone .dz-preview { 11 | position: relative; 12 | display: inline-block; 13 | width: 120px; 14 | margin: 0.5em; } 15 | .dropzone .dz-preview .dz-progress { 16 | display: block; 17 | height: 15px; 18 | border: 1px solid #aaa; } 19 | .dropzone .dz-preview .dz-progress .dz-upload { 20 | display: block; 21 | height: 100%; 22 | width: 0; 23 | background: green; } 24 | .dropzone .dz-preview .dz-error-message { 25 | color: red; 26 | display: none; } 27 | .dropzone .dz-preview.dz-error .dz-error-message, .dropzone .dz-preview.dz-error .dz-error-mark { 28 | display: block; } 29 | .dropzone .dz-preview.dz-success .dz-success-mark { 30 | display: block; } 31 | .dropzone .dz-preview .dz-error-mark, .dropzone .dz-preview .dz-success-mark { 32 | position: absolute; 33 | display: none; 34 | left: 30px; 35 | top: 30px; 36 | width: 54px; 37 | height: 58px; 38 | left: 50%; 39 | margin-left: -27px; } 40 | -------------------------------------------------------------------------------- /bower_components/dropzone/dist/dropzone.css: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright (c) 2012 Matias Meno 4 | */ 5 | @-webkit-keyframes passing-through { 6 | 0% { 7 | opacity: 0; 8 | -webkit-transform: translateY(40px); 9 | -moz-transform: translateY(40px); 10 | -ms-transform: translateY(40px); 11 | -o-transform: translateY(40px); 12 | transform: translateY(40px); } 13 | 30%, 70% { 14 | opacity: 1; 15 | -webkit-transform: translateY(0px); 16 | -moz-transform: translateY(0px); 17 | -ms-transform: translateY(0px); 18 | -o-transform: translateY(0px); 19 | transform: translateY(0px); } 20 | 100% { 21 | opacity: 0; 22 | -webkit-transform: translateY(-40px); 23 | -moz-transform: translateY(-40px); 24 | -ms-transform: translateY(-40px); 25 | -o-transform: translateY(-40px); 26 | transform: translateY(-40px); } } 27 | @-moz-keyframes passing-through { 28 | 0% { 29 | opacity: 0; 30 | -webkit-transform: translateY(40px); 31 | -moz-transform: translateY(40px); 32 | -ms-transform: translateY(40px); 33 | -o-transform: translateY(40px); 34 | transform: translateY(40px); } 35 | 30%, 70% { 36 | opacity: 1; 37 | -webkit-transform: translateY(0px); 38 | -moz-transform: translateY(0px); 39 | -ms-transform: translateY(0px); 40 | -o-transform: translateY(0px); 41 | transform: translateY(0px); } 42 | 100% { 43 | opacity: 0; 44 | -webkit-transform: translateY(-40px); 45 | -moz-transform: translateY(-40px); 46 | -ms-transform: translateY(-40px); 47 | -o-transform: translateY(-40px); 48 | transform: translateY(-40px); } } 49 | @keyframes passing-through { 50 | 0% { 51 | opacity: 0; 52 | -webkit-transform: translateY(40px); 53 | -moz-transform: translateY(40px); 54 | -ms-transform: translateY(40px); 55 | -o-transform: translateY(40px); 56 | transform: translateY(40px); } 57 | 30%, 70% { 58 | opacity: 1; 59 | -webkit-transform: translateY(0px); 60 | -moz-transform: translateY(0px); 61 | -ms-transform: translateY(0px); 62 | -o-transform: translateY(0px); 63 | transform: translateY(0px); } 64 | 100% { 65 | opacity: 0; 66 | -webkit-transform: translateY(-40px); 67 | -moz-transform: translateY(-40px); 68 | -ms-transform: translateY(-40px); 69 | -o-transform: translateY(-40px); 70 | transform: translateY(-40px); } } 71 | @-webkit-keyframes slide-in { 72 | 0% { 73 | opacity: 0; 74 | -webkit-transform: translateY(40px); 75 | -moz-transform: translateY(40px); 76 | -ms-transform: translateY(40px); 77 | -o-transform: translateY(40px); 78 | transform: translateY(40px); } 79 | 30% { 80 | opacity: 1; 81 | -webkit-transform: translateY(0px); 82 | -moz-transform: translateY(0px); 83 | -ms-transform: translateY(0px); 84 | -o-transform: translateY(0px); 85 | transform: translateY(0px); } } 86 | @-moz-keyframes slide-in { 87 | 0% { 88 | opacity: 0; 89 | -webkit-transform: translateY(40px); 90 | -moz-transform: translateY(40px); 91 | -ms-transform: translateY(40px); 92 | -o-transform: translateY(40px); 93 | transform: translateY(40px); } 94 | 30% { 95 | opacity: 1; 96 | -webkit-transform: translateY(0px); 97 | -moz-transform: translateY(0px); 98 | -ms-transform: translateY(0px); 99 | -o-transform: translateY(0px); 100 | transform: translateY(0px); } } 101 | @keyframes slide-in { 102 | 0% { 103 | opacity: 0; 104 | -webkit-transform: translateY(40px); 105 | -moz-transform: translateY(40px); 106 | -ms-transform: translateY(40px); 107 | -o-transform: translateY(40px); 108 | transform: translateY(40px); } 109 | 30% { 110 | opacity: 1; 111 | -webkit-transform: translateY(0px); 112 | -moz-transform: translateY(0px); 113 | -ms-transform: translateY(0px); 114 | -o-transform: translateY(0px); 115 | transform: translateY(0px); } } 116 | @-webkit-keyframes pulse { 117 | 0% { 118 | -webkit-transform: scale(1); 119 | -moz-transform: scale(1); 120 | -ms-transform: scale(1); 121 | -o-transform: scale(1); 122 | transform: scale(1); } 123 | 10% { 124 | -webkit-transform: scale(1.1); 125 | -moz-transform: scale(1.1); 126 | -ms-transform: scale(1.1); 127 | -o-transform: scale(1.1); 128 | transform: scale(1.1); } 129 | 20% { 130 | -webkit-transform: scale(1); 131 | -moz-transform: scale(1); 132 | -ms-transform: scale(1); 133 | -o-transform: scale(1); 134 | transform: scale(1); } } 135 | @-moz-keyframes pulse { 136 | 0% { 137 | -webkit-transform: scale(1); 138 | -moz-transform: scale(1); 139 | -ms-transform: scale(1); 140 | -o-transform: scale(1); 141 | transform: scale(1); } 142 | 10% { 143 | -webkit-transform: scale(1.1); 144 | -moz-transform: scale(1.1); 145 | -ms-transform: scale(1.1); 146 | -o-transform: scale(1.1); 147 | transform: scale(1.1); } 148 | 20% { 149 | -webkit-transform: scale(1); 150 | -moz-transform: scale(1); 151 | -ms-transform: scale(1); 152 | -o-transform: scale(1); 153 | transform: scale(1); } } 154 | @keyframes pulse { 155 | 0% { 156 | -webkit-transform: scale(1); 157 | -moz-transform: scale(1); 158 | -ms-transform: scale(1); 159 | -o-transform: scale(1); 160 | transform: scale(1); } 161 | 10% { 162 | -webkit-transform: scale(1.1); 163 | -moz-transform: scale(1.1); 164 | -ms-transform: scale(1.1); 165 | -o-transform: scale(1.1); 166 | transform: scale(1.1); } 167 | 20% { 168 | -webkit-transform: scale(1); 169 | -moz-transform: scale(1); 170 | -ms-transform: scale(1); 171 | -o-transform: scale(1); 172 | transform: scale(1); } } 173 | .dropzone, .dropzone * { 174 | box-sizing: border-box; } 175 | 176 | .dropzone { 177 | min-height: 150px; 178 | border: 2px solid rgba(0, 0, 0, 0.3); 179 | background: white; 180 | padding: 20px 20px; } 181 | .dropzone.dz-clickable { 182 | cursor: pointer; } 183 | .dropzone.dz-clickable * { 184 | cursor: default; } 185 | .dropzone.dz-clickable .dz-message, .dropzone.dz-clickable .dz-message * { 186 | cursor: pointer; } 187 | .dropzone.dz-started .dz-message { 188 | display: none; } 189 | .dropzone.dz-drag-hover { 190 | border-style: solid; } 191 | .dropzone.dz-drag-hover .dz-message { 192 | opacity: 0.5; } 193 | .dropzone .dz-message { 194 | text-align: center; 195 | margin: 2em 0; } 196 | .dropzone .dz-preview { 197 | position: relative; 198 | display: inline-block; 199 | vertical-align: top; 200 | margin: 16px; 201 | min-height: 100px; } 202 | .dropzone .dz-preview:hover { 203 | z-index: 1000; } 204 | .dropzone .dz-preview:hover .dz-details { 205 | opacity: 1; } 206 | .dropzone .dz-preview.dz-file-preview .dz-image { 207 | border-radius: 20px; 208 | background: #999; 209 | background: linear-gradient(to bottom, #eee, #ddd); } 210 | .dropzone .dz-preview.dz-file-preview .dz-details { 211 | opacity: 1; } 212 | .dropzone .dz-preview.dz-image-preview { 213 | background: white; } 214 | .dropzone .dz-preview.dz-image-preview .dz-details { 215 | -webkit-transition: opacity 0.2s linear; 216 | -moz-transition: opacity 0.2s linear; 217 | -ms-transition: opacity 0.2s linear; 218 | -o-transition: opacity 0.2s linear; 219 | transition: opacity 0.2s linear; } 220 | .dropzone .dz-preview .dz-remove { 221 | font-size: 14px; 222 | text-align: center; 223 | display: block; 224 | cursor: pointer; 225 | border: none; } 226 | .dropzone .dz-preview .dz-remove:hover { 227 | text-decoration: underline; } 228 | .dropzone .dz-preview:hover .dz-details { 229 | opacity: 1; } 230 | .dropzone .dz-preview .dz-details { 231 | z-index: 20; 232 | position: absolute; 233 | top: 0; 234 | left: 0; 235 | opacity: 0; 236 | font-size: 13px; 237 | min-width: 100%; 238 | max-width: 100%; 239 | padding: 2em 1em; 240 | text-align: center; 241 | color: rgba(0, 0, 0, 0.9); 242 | line-height: 150%; } 243 | .dropzone .dz-preview .dz-details .dz-size { 244 | margin-bottom: 1em; 245 | font-size: 16px; } 246 | .dropzone .dz-preview .dz-details .dz-filename { 247 | white-space: nowrap; } 248 | .dropzone .dz-preview .dz-details .dz-filename:hover span { 249 | border: 1px solid rgba(200, 200, 200, 0.8); 250 | background-color: rgba(255, 255, 255, 0.8); } 251 | .dropzone .dz-preview .dz-details .dz-filename:not(:hover) { 252 | overflow: hidden; 253 | text-overflow: ellipsis; } 254 | .dropzone .dz-preview .dz-details .dz-filename:not(:hover) span { 255 | border: 1px solid transparent; } 256 | .dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span { 257 | background-color: rgba(255, 255, 255, 0.4); 258 | padding: 0 0.4em; 259 | border-radius: 3px; } 260 | .dropzone .dz-preview:hover .dz-image img { 261 | -webkit-transform: scale(1.05, 1.05); 262 | -moz-transform: scale(1.05, 1.05); 263 | -ms-transform: scale(1.05, 1.05); 264 | -o-transform: scale(1.05, 1.05); 265 | transform: scale(1.05, 1.05); 266 | -webkit-filter: blur(8px); 267 | filter: blur(8px); } 268 | .dropzone .dz-preview .dz-image { 269 | border-radius: 20px; 270 | overflow: hidden; 271 | width: 120px; 272 | height: 120px; 273 | position: relative; 274 | display: block; 275 | z-index: 10; } 276 | .dropzone .dz-preview .dz-image img { 277 | display: block; } 278 | .dropzone .dz-preview.dz-success .dz-success-mark { 279 | -webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); 280 | -moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); 281 | -ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); 282 | -o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); 283 | animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); } 284 | .dropzone .dz-preview.dz-error .dz-error-mark { 285 | opacity: 1; 286 | -webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); 287 | -moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); 288 | -ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); 289 | -o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); 290 | animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); } 291 | .dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark { 292 | pointer-events: none; 293 | opacity: 0; 294 | z-index: 500; 295 | position: absolute; 296 | display: block; 297 | top: 50%; 298 | left: 50%; 299 | margin-left: -27px; 300 | margin-top: -27px; } 301 | .dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg { 302 | display: block; 303 | width: 54px; 304 | height: 54px; } 305 | .dropzone .dz-preview.dz-processing .dz-progress { 306 | opacity: 1; 307 | -webkit-transition: all 0.2s linear; 308 | -moz-transition: all 0.2s linear; 309 | -ms-transition: all 0.2s linear; 310 | -o-transition: all 0.2s linear; 311 | transition: all 0.2s linear; } 312 | .dropzone .dz-preview.dz-complete .dz-progress { 313 | opacity: 0; 314 | -webkit-transition: opacity 0.4s ease-in; 315 | -moz-transition: opacity 0.4s ease-in; 316 | -ms-transition: opacity 0.4s ease-in; 317 | -o-transition: opacity 0.4s ease-in; 318 | transition: opacity 0.4s ease-in; } 319 | .dropzone .dz-preview:not(.dz-processing) .dz-progress { 320 | -webkit-animation: pulse 6s ease infinite; 321 | -moz-animation: pulse 6s ease infinite; 322 | -ms-animation: pulse 6s ease infinite; 323 | -o-animation: pulse 6s ease infinite; 324 | animation: pulse 6s ease infinite; } 325 | .dropzone .dz-preview .dz-progress { 326 | opacity: 1; 327 | z-index: 1000; 328 | pointer-events: none; 329 | position: absolute; 330 | height: 16px; 331 | left: 50%; 332 | top: 50%; 333 | margin-top: -8px; 334 | width: 80px; 335 | margin-left: -40px; 336 | background: rgba(255, 255, 255, 0.9); 337 | -webkit-transform: scale(1); 338 | border-radius: 8px; 339 | overflow: hidden; } 340 | .dropzone .dz-preview .dz-progress .dz-upload { 341 | background: #333; 342 | background: linear-gradient(to bottom, #666, #444); 343 | position: absolute; 344 | top: 0; 345 | left: 0; 346 | bottom: 0; 347 | width: 0; 348 | -webkit-transition: width 300ms ease-in-out; 349 | -moz-transition: width 300ms ease-in-out; 350 | -ms-transition: width 300ms ease-in-out; 351 | -o-transition: width 300ms ease-in-out; 352 | transition: width 300ms ease-in-out; } 353 | .dropzone .dz-preview.dz-error .dz-error-message { 354 | display: block; } 355 | .dropzone .dz-preview.dz-error:hover .dz-error-message { 356 | opacity: 1; 357 | pointer-events: auto; } 358 | .dropzone .dz-preview .dz-error-message { 359 | pointer-events: none; 360 | z-index: 1000; 361 | position: absolute; 362 | display: block; 363 | display: none; 364 | opacity: 0; 365 | -webkit-transition: opacity 0.3s ease; 366 | -moz-transition: opacity 0.3s ease; 367 | -ms-transition: opacity 0.3s ease; 368 | -o-transition: opacity 0.3s ease; 369 | transition: opacity 0.3s ease; 370 | border-radius: 8px; 371 | font-size: 13px; 372 | top: 130px; 373 | left: -10px; 374 | width: 140px; 375 | background: #be2626; 376 | background: linear-gradient(to bottom, #be2626, #a92222); 377 | padding: 0.5em 1.2em; 378 | color: white; } 379 | .dropzone .dz-preview .dz-error-message:after { 380 | content: ''; 381 | position: absolute; 382 | top: -6px; 383 | left: 64px; 384 | width: 0; 385 | height: 0; 386 | border-left: 6px solid transparent; 387 | border-right: 6px solid transparent; 388 | border-bottom: 6px solid #be2626; } 389 | -------------------------------------------------------------------------------- /bower_components/dropzone/dist/dropzone.js: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * 4 | * More info at [www.dropzonejs.com](http://www.dropzonejs.com) 5 | * 6 | * Copyright (c) 2012, Matias Meno 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | 28 | (function() { 29 | var Dropzone, Emitter, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without, 30 | __slice = [].slice, 31 | __hasProp = {}.hasOwnProperty, 32 | __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; 33 | 34 | noop = function() {}; 35 | 36 | Emitter = (function() { 37 | function Emitter() {} 38 | 39 | Emitter.prototype.addEventListener = Emitter.prototype.on; 40 | 41 | Emitter.prototype.on = function(event, fn) { 42 | this._callbacks = this._callbacks || {}; 43 | if (!this._callbacks[event]) { 44 | this._callbacks[event] = []; 45 | } 46 | this._callbacks[event].push(fn); 47 | return this; 48 | }; 49 | 50 | Emitter.prototype.emit = function() { 51 | var args, callback, callbacks, event, _i, _len; 52 | event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 53 | this._callbacks = this._callbacks || {}; 54 | callbacks = this._callbacks[event]; 55 | if (callbacks) { 56 | for (_i = 0, _len = callbacks.length; _i < _len; _i++) { 57 | callback = callbacks[_i]; 58 | callback.apply(this, args); 59 | } 60 | } 61 | return this; 62 | }; 63 | 64 | Emitter.prototype.removeListener = Emitter.prototype.off; 65 | 66 | Emitter.prototype.removeAllListeners = Emitter.prototype.off; 67 | 68 | Emitter.prototype.removeEventListener = Emitter.prototype.off; 69 | 70 | Emitter.prototype.off = function(event, fn) { 71 | var callback, callbacks, i, _i, _len; 72 | if (!this._callbacks || arguments.length === 0) { 73 | this._callbacks = {}; 74 | return this; 75 | } 76 | callbacks = this._callbacks[event]; 77 | if (!callbacks) { 78 | return this; 79 | } 80 | if (arguments.length === 1) { 81 | delete this._callbacks[event]; 82 | return this; 83 | } 84 | for (i = _i = 0, _len = callbacks.length; _i < _len; i = ++_i) { 85 | callback = callbacks[i]; 86 | if (callback === fn) { 87 | callbacks.splice(i, 1); 88 | break; 89 | } 90 | } 91 | return this; 92 | }; 93 | 94 | return Emitter; 95 | 96 | })(); 97 | 98 | Dropzone = (function(_super) { 99 | var extend, resolveOption; 100 | 101 | __extends(Dropzone, _super); 102 | 103 | Dropzone.prototype.Emitter = Emitter; 104 | 105 | 106 | /* 107 | This is a list of all available events you can register on a dropzone object. 108 | 109 | You can register an event handler like this: 110 | 111 | dropzone.on("dragEnter", function() { }); 112 | */ 113 | 114 | Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "addedfiles", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"]; 115 | 116 | Dropzone.prototype.defaultOptions = { 117 | url: null, 118 | method: "post", 119 | withCredentials: false, 120 | parallelUploads: 2, 121 | uploadMultiple: false, 122 | maxFilesize: 256, 123 | paramName: "file", 124 | createImageThumbnails: true, 125 | maxThumbnailFilesize: 10, 126 | thumbnailWidth: 120, 127 | thumbnailHeight: 120, 128 | filesizeBase: 1000, 129 | maxFiles: null, 130 | params: {}, 131 | clickable: true, 132 | ignoreHiddenFiles: true, 133 | acceptedFiles: null, 134 | acceptedMimeTypes: null, 135 | autoProcessQueue: true, 136 | autoQueue: true, 137 | addRemoveLinks: false, 138 | previewsContainer: null, 139 | hiddenInputContainer: "body", 140 | capture: null, 141 | dictDefaultMessage: "Drop files here to upload", 142 | dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.", 143 | dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.", 144 | dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.", 145 | dictInvalidFileType: "You can't upload files of this type.", 146 | dictResponseError: "Server responded with {{statusCode}} code.", 147 | dictCancelUpload: "Cancel upload", 148 | dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?", 149 | dictRemoveFile: "Remove file", 150 | dictRemoveFileConfirmation: null, 151 | dictMaxFilesExceeded: "You can not upload any more files.", 152 | accept: function(file, done) { 153 | return done(); 154 | }, 155 | init: function() { 156 | return noop; 157 | }, 158 | forceFallback: false, 159 | fallback: function() { 160 | var child, messageElement, span, _i, _len, _ref; 161 | this.element.className = "" + this.element.className + " dz-browser-not-supported"; 162 | _ref = this.element.getElementsByTagName("div"); 163 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 164 | child = _ref[_i]; 165 | if (/(^| )dz-message($| )/.test(child.className)) { 166 | messageElement = child; 167 | child.className = "dz-message"; 168 | continue; 169 | } 170 | } 171 | if (!messageElement) { 172 | messageElement = Dropzone.createElement("
"); 173 | this.element.appendChild(messageElement); 174 | } 175 | span = messageElement.getElementsByTagName("span")[0]; 176 | if (span) { 177 | if (span.textContent != null) { 178 | span.textContent = this.options.dictFallbackMessage; 179 | } else if (span.innerText != null) { 180 | span.innerText = this.options.dictFallbackMessage; 181 | } 182 | } 183 | return this.element.appendChild(this.getFallbackForm()); 184 | }, 185 | resize: function(file) { 186 | var info, srcRatio, trgRatio; 187 | info = { 188 | srcX: 0, 189 | srcY: 0, 190 | srcWidth: file.width, 191 | srcHeight: file.height 192 | }; 193 | srcRatio = file.width / file.height; 194 | info.optWidth = this.options.thumbnailWidth; 195 | info.optHeight = this.options.thumbnailHeight; 196 | if ((info.optWidth == null) && (info.optHeight == null)) { 197 | info.optWidth = info.srcWidth; 198 | info.optHeight = info.srcHeight; 199 | } else if (info.optWidth == null) { 200 | info.optWidth = srcRatio * info.optHeight; 201 | } else if (info.optHeight == null) { 202 | info.optHeight = (1 / srcRatio) * info.optWidth; 203 | } 204 | trgRatio = info.optWidth / info.optHeight; 205 | if (file.height < info.optHeight || file.width < info.optWidth) { 206 | info.trgHeight = info.srcHeight; 207 | info.trgWidth = info.srcWidth; 208 | } else { 209 | if (srcRatio > trgRatio) { 210 | info.srcHeight = file.height; 211 | info.srcWidth = info.srcHeight * trgRatio; 212 | } else { 213 | info.srcWidth = file.width; 214 | info.srcHeight = info.srcWidth / trgRatio; 215 | } 216 | } 217 | info.srcX = (file.width - info.srcWidth) / 2; 218 | info.srcY = (file.height - info.srcHeight) / 2; 219 | return info; 220 | }, 221 | 222 | /* 223 | Those functions register themselves to the events on init and handle all 224 | the user interface specific stuff. Overwriting them won't break the upload 225 | but can break the way it's displayed. 226 | You can overwrite them if you don't like the default behavior. If you just 227 | want to add an additional event handler, register it on the dropzone object 228 | and don't overwrite those options. 229 | */ 230 | drop: function(e) { 231 | return this.element.classList.remove("dz-drag-hover"); 232 | }, 233 | dragstart: noop, 234 | dragend: function(e) { 235 | return this.element.classList.remove("dz-drag-hover"); 236 | }, 237 | dragenter: function(e) { 238 | return this.element.classList.add("dz-drag-hover"); 239 | }, 240 | dragover: function(e) { 241 | return this.element.classList.add("dz-drag-hover"); 242 | }, 243 | dragleave: function(e) { 244 | return this.element.classList.remove("dz-drag-hover"); 245 | }, 246 | paste: noop, 247 | reset: function() { 248 | return this.element.classList.remove("dz-started"); 249 | }, 250 | addedfile: function(file) { 251 | var node, removeFileEvent, removeLink, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results; 252 | if (this.element === this.previewsContainer) { 253 | this.element.classList.add("dz-started"); 254 | } 255 | if (this.previewsContainer) { 256 | file.previewElement = Dropzone.createElement(this.options.previewTemplate.trim()); 257 | file.previewTemplate = file.previewElement; 258 | this.previewsContainer.appendChild(file.previewElement); 259 | _ref = file.previewElement.querySelectorAll("[data-dz-name]"); 260 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 261 | node = _ref[_i]; 262 | node.textContent = file.name; 263 | } 264 | _ref1 = file.previewElement.querySelectorAll("[data-dz-size]"); 265 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { 266 | node = _ref1[_j]; 267 | node.innerHTML = this.filesize(file.size); 268 | } 269 | if (this.options.addRemoveLinks) { 270 | file._removeLink = Dropzone.createElement("" + this.options.dictRemoveFile + ""); 271 | file.previewElement.appendChild(file._removeLink); 272 | } 273 | removeFileEvent = (function(_this) { 274 | return function(e) { 275 | e.preventDefault(); 276 | e.stopPropagation(); 277 | if (file.status === Dropzone.UPLOADING) { 278 | return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() { 279 | return _this.removeFile(file); 280 | }); 281 | } else { 282 | if (_this.options.dictRemoveFileConfirmation) { 283 | return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() { 284 | return _this.removeFile(file); 285 | }); 286 | } else { 287 | return _this.removeFile(file); 288 | } 289 | } 290 | }; 291 | })(this); 292 | _ref2 = file.previewElement.querySelectorAll("[data-dz-remove]"); 293 | _results = []; 294 | for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { 295 | removeLink = _ref2[_k]; 296 | _results.push(removeLink.addEventListener("click", removeFileEvent)); 297 | } 298 | return _results; 299 | } 300 | }, 301 | removedfile: function(file) { 302 | var _ref; 303 | if (file.previewElement) { 304 | if ((_ref = file.previewElement) != null) { 305 | _ref.parentNode.removeChild(file.previewElement); 306 | } 307 | } 308 | return this._updateMaxFilesReachedClass(); 309 | }, 310 | thumbnail: function(file, dataUrl) { 311 | var thumbnailElement, _i, _len, _ref; 312 | if (file.previewElement) { 313 | file.previewElement.classList.remove("dz-file-preview"); 314 | _ref = file.previewElement.querySelectorAll("[data-dz-thumbnail]"); 315 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 316 | thumbnailElement = _ref[_i]; 317 | thumbnailElement.alt = file.name; 318 | thumbnailElement.src = dataUrl; 319 | } 320 | return setTimeout(((function(_this) { 321 | return function() { 322 | return file.previewElement.classList.add("dz-image-preview"); 323 | }; 324 | })(this)), 1); 325 | } 326 | }, 327 | error: function(file, message) { 328 | var node, _i, _len, _ref, _results; 329 | if (file.previewElement) { 330 | file.previewElement.classList.add("dz-error"); 331 | if (typeof message !== "String" && message.error) { 332 | message = message.error; 333 | } 334 | _ref = file.previewElement.querySelectorAll("[data-dz-errormessage]"); 335 | _results = []; 336 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 337 | node = _ref[_i]; 338 | _results.push(node.textContent = message); 339 | } 340 | return _results; 341 | } 342 | }, 343 | errormultiple: noop, 344 | processing: function(file) { 345 | if (file.previewElement) { 346 | file.previewElement.classList.add("dz-processing"); 347 | if (file._removeLink) { 348 | return file._removeLink.textContent = this.options.dictCancelUpload; 349 | } 350 | } 351 | }, 352 | processingmultiple: noop, 353 | uploadprogress: function(file, progress, bytesSent) { 354 | var node, _i, _len, _ref, _results; 355 | if (file.previewElement) { 356 | _ref = file.previewElement.querySelectorAll("[data-dz-uploadprogress]"); 357 | _results = []; 358 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 359 | node = _ref[_i]; 360 | if (node.nodeName === 'PROGRESS') { 361 | _results.push(node.value = progress); 362 | } else { 363 | _results.push(node.style.width = "" + progress + "%"); 364 | } 365 | } 366 | return _results; 367 | } 368 | }, 369 | totaluploadprogress: noop, 370 | sending: noop, 371 | sendingmultiple: noop, 372 | success: function(file) { 373 | if (file.previewElement) { 374 | return file.previewElement.classList.add("dz-success"); 375 | } 376 | }, 377 | successmultiple: noop, 378 | canceled: function(file) { 379 | return this.emit("error", file, "Upload canceled."); 380 | }, 381 | canceledmultiple: noop, 382 | complete: function(file) { 383 | if (file._removeLink) { 384 | file._removeLink.textContent = this.options.dictRemoveFile; 385 | } 386 | if (file.previewElement) { 387 | return file.previewElement.classList.add("dz-complete"); 388 | } 389 | }, 390 | completemultiple: noop, 391 | maxfilesexceeded: noop, 392 | maxfilesreached: noop, 393 | queuecomplete: noop, 394 | addedfiles: noop, 395 | previewTemplate: "
\n
\n
\n
\n
\n
\n
\n
\n
\n \n Check\n \n \n \n \n \n
\n
\n \n Error\n \n \n \n \n \n \n \n
\n
" 396 | }; 397 | 398 | extend = function() { 399 | var key, object, objects, target, val, _i, _len; 400 | target = arguments[0], objects = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 401 | for (_i = 0, _len = objects.length; _i < _len; _i++) { 402 | object = objects[_i]; 403 | for (key in object) { 404 | val = object[key]; 405 | target[key] = val; 406 | } 407 | } 408 | return target; 409 | }; 410 | 411 | function Dropzone(element, options) { 412 | var elementOptions, fallback, _ref; 413 | this.element = element; 414 | this.version = Dropzone.version; 415 | this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, ""); 416 | this.clickableElements = []; 417 | this.listeners = []; 418 | this.files = []; 419 | if (typeof this.element === "string") { 420 | this.element = document.querySelector(this.element); 421 | } 422 | if (!(this.element && (this.element.nodeType != null))) { 423 | throw new Error("Invalid dropzone element."); 424 | } 425 | if (this.element.dropzone) { 426 | throw new Error("Dropzone already attached."); 427 | } 428 | Dropzone.instances.push(this); 429 | this.element.dropzone = this; 430 | elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {}; 431 | this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {}); 432 | if (this.options.forceFallback || !Dropzone.isBrowserSupported()) { 433 | return this.options.fallback.call(this); 434 | } 435 | if (this.options.url == null) { 436 | this.options.url = this.element.getAttribute("action"); 437 | } 438 | if (!this.options.url) { 439 | throw new Error("No URL provided."); 440 | } 441 | if (this.options.acceptedFiles && this.options.acceptedMimeTypes) { 442 | throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated."); 443 | } 444 | if (this.options.acceptedMimeTypes) { 445 | this.options.acceptedFiles = this.options.acceptedMimeTypes; 446 | delete this.options.acceptedMimeTypes; 447 | } 448 | this.options.method = this.options.method.toUpperCase(); 449 | if ((fallback = this.getExistingFallback()) && fallback.parentNode) { 450 | fallback.parentNode.removeChild(fallback); 451 | } 452 | if (this.options.previewsContainer !== false) { 453 | if (this.options.previewsContainer) { 454 | this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer"); 455 | } else { 456 | this.previewsContainer = this.element; 457 | } 458 | } 459 | if (this.options.clickable) { 460 | if (this.options.clickable === true) { 461 | this.clickableElements = [this.element]; 462 | } else { 463 | this.clickableElements = Dropzone.getElements(this.options.clickable, "clickable"); 464 | } 465 | } 466 | this.init(); 467 | } 468 | 469 | Dropzone.prototype.getAcceptedFiles = function() { 470 | var file, _i, _len, _ref, _results; 471 | _ref = this.files; 472 | _results = []; 473 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 474 | file = _ref[_i]; 475 | if (file.accepted) { 476 | _results.push(file); 477 | } 478 | } 479 | return _results; 480 | }; 481 | 482 | Dropzone.prototype.getRejectedFiles = function() { 483 | var file, _i, _len, _ref, _results; 484 | _ref = this.files; 485 | _results = []; 486 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 487 | file = _ref[_i]; 488 | if (!file.accepted) { 489 | _results.push(file); 490 | } 491 | } 492 | return _results; 493 | }; 494 | 495 | Dropzone.prototype.getFilesWithStatus = function(status) { 496 | var file, _i, _len, _ref, _results; 497 | _ref = this.files; 498 | _results = []; 499 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 500 | file = _ref[_i]; 501 | if (file.status === status) { 502 | _results.push(file); 503 | } 504 | } 505 | return _results; 506 | }; 507 | 508 | Dropzone.prototype.getQueuedFiles = function() { 509 | return this.getFilesWithStatus(Dropzone.QUEUED); 510 | }; 511 | 512 | Dropzone.prototype.getUploadingFiles = function() { 513 | return this.getFilesWithStatus(Dropzone.UPLOADING); 514 | }; 515 | 516 | Dropzone.prototype.getAddedFiles = function() { 517 | return this.getFilesWithStatus(Dropzone.ADDED); 518 | }; 519 | 520 | Dropzone.prototype.getActiveFiles = function() { 521 | var file, _i, _len, _ref, _results; 522 | _ref = this.files; 523 | _results = []; 524 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 525 | file = _ref[_i]; 526 | if (file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED) { 527 | _results.push(file); 528 | } 529 | } 530 | return _results; 531 | }; 532 | 533 | Dropzone.prototype.init = function() { 534 | var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1; 535 | if (this.element.tagName === "form") { 536 | this.element.setAttribute("enctype", "multipart/form-data"); 537 | } 538 | if (this.element.classList.contains("dropzone") && !this.element.querySelector(".dz-message")) { 539 | this.element.appendChild(Dropzone.createElement("
" + this.options.dictDefaultMessage + "
")); 540 | } 541 | if (this.clickableElements.length) { 542 | setupHiddenFileInput = (function(_this) { 543 | return function() { 544 | if (_this.hiddenFileInput) { 545 | _this.hiddenFileInput.parentNode.removeChild(_this.hiddenFileInput); 546 | } 547 | _this.hiddenFileInput = document.createElement("input"); 548 | _this.hiddenFileInput.setAttribute("type", "file"); 549 | if ((_this.options.maxFiles == null) || _this.options.maxFiles > 1) { 550 | _this.hiddenFileInput.setAttribute("multiple", "multiple"); 551 | } 552 | _this.hiddenFileInput.className = "dz-hidden-input"; 553 | if (_this.options.acceptedFiles != null) { 554 | _this.hiddenFileInput.setAttribute("accept", _this.options.acceptedFiles); 555 | } 556 | if (_this.options.capture != null) { 557 | _this.hiddenFileInput.setAttribute("capture", _this.options.capture); 558 | } 559 | _this.hiddenFileInput.style.visibility = "hidden"; 560 | _this.hiddenFileInput.style.position = "absolute"; 561 | _this.hiddenFileInput.style.top = "0"; 562 | _this.hiddenFileInput.style.left = "0"; 563 | _this.hiddenFileInput.style.height = "0"; 564 | _this.hiddenFileInput.style.width = "0"; 565 | document.querySelector(_this.options.hiddenInputContainer).appendChild(_this.hiddenFileInput); 566 | return _this.hiddenFileInput.addEventListener("change", function() { 567 | var file, files, _i, _len; 568 | files = _this.hiddenFileInput.files; 569 | if (files.length) { 570 | for (_i = 0, _len = files.length; _i < _len; _i++) { 571 | file = files[_i]; 572 | _this.addFile(file); 573 | } 574 | } 575 | _this.emit("addedfiles", files); 576 | return setupHiddenFileInput(); 577 | }); 578 | }; 579 | })(this); 580 | setupHiddenFileInput(); 581 | } 582 | this.URL = (_ref = window.URL) != null ? _ref : window.webkitURL; 583 | _ref1 = this.events; 584 | for (_i = 0, _len = _ref1.length; _i < _len; _i++) { 585 | eventName = _ref1[_i]; 586 | this.on(eventName, this.options[eventName]); 587 | } 588 | this.on("uploadprogress", (function(_this) { 589 | return function() { 590 | return _this.updateTotalUploadProgress(); 591 | }; 592 | })(this)); 593 | this.on("removedfile", (function(_this) { 594 | return function() { 595 | return _this.updateTotalUploadProgress(); 596 | }; 597 | })(this)); 598 | this.on("canceled", (function(_this) { 599 | return function(file) { 600 | return _this.emit("complete", file); 601 | }; 602 | })(this)); 603 | this.on("complete", (function(_this) { 604 | return function(file) { 605 | if (_this.getAddedFiles().length === 0 && _this.getUploadingFiles().length === 0 && _this.getQueuedFiles().length === 0) { 606 | return setTimeout((function() { 607 | return _this.emit("queuecomplete"); 608 | }), 0); 609 | } 610 | }; 611 | })(this)); 612 | noPropagation = function(e) { 613 | e.stopPropagation(); 614 | if (e.preventDefault) { 615 | return e.preventDefault(); 616 | } else { 617 | return e.returnValue = false; 618 | } 619 | }; 620 | this.listeners = [ 621 | { 622 | element: this.element, 623 | events: { 624 | "dragstart": (function(_this) { 625 | return function(e) { 626 | return _this.emit("dragstart", e); 627 | }; 628 | })(this), 629 | "dragenter": (function(_this) { 630 | return function(e) { 631 | noPropagation(e); 632 | return _this.emit("dragenter", e); 633 | }; 634 | })(this), 635 | "dragover": (function(_this) { 636 | return function(e) { 637 | var efct; 638 | try { 639 | efct = e.dataTransfer.effectAllowed; 640 | } catch (_error) {} 641 | e.dataTransfer.dropEffect = 'move' === efct || 'linkMove' === efct ? 'move' : 'copy'; 642 | noPropagation(e); 643 | return _this.emit("dragover", e); 644 | }; 645 | })(this), 646 | "dragleave": (function(_this) { 647 | return function(e) { 648 | return _this.emit("dragleave", e); 649 | }; 650 | })(this), 651 | "drop": (function(_this) { 652 | return function(e) { 653 | noPropagation(e); 654 | return _this.drop(e); 655 | }; 656 | })(this), 657 | "dragend": (function(_this) { 658 | return function(e) { 659 | return _this.emit("dragend", e); 660 | }; 661 | })(this) 662 | } 663 | } 664 | ]; 665 | this.clickableElements.forEach((function(_this) { 666 | return function(clickableElement) { 667 | return _this.listeners.push({ 668 | element: clickableElement, 669 | events: { 670 | "click": function(evt) { 671 | if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) { 672 | _this.hiddenFileInput.click(); 673 | } 674 | return true; 675 | } 676 | } 677 | }); 678 | }; 679 | })(this)); 680 | this.enable(); 681 | return this.options.init.call(this); 682 | }; 683 | 684 | Dropzone.prototype.destroy = function() { 685 | var _ref; 686 | this.disable(); 687 | this.removeAllFiles(true); 688 | if ((_ref = this.hiddenFileInput) != null ? _ref.parentNode : void 0) { 689 | this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput); 690 | this.hiddenFileInput = null; 691 | } 692 | delete this.element.dropzone; 693 | return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1); 694 | }; 695 | 696 | Dropzone.prototype.updateTotalUploadProgress = function() { 697 | var activeFiles, file, totalBytes, totalBytesSent, totalUploadProgress, _i, _len, _ref; 698 | totalBytesSent = 0; 699 | totalBytes = 0; 700 | activeFiles = this.getActiveFiles(); 701 | if (activeFiles.length) { 702 | _ref = this.getActiveFiles(); 703 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 704 | file = _ref[_i]; 705 | totalBytesSent += file.upload.bytesSent; 706 | totalBytes += file.upload.total; 707 | } 708 | totalUploadProgress = 100 * totalBytesSent / totalBytes; 709 | } else { 710 | totalUploadProgress = 100; 711 | } 712 | return this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent); 713 | }; 714 | 715 | Dropzone.prototype._getParamName = function(n) { 716 | if (typeof this.options.paramName === "function") { 717 | return this.options.paramName(n); 718 | } else { 719 | return "" + this.options.paramName + (this.options.uploadMultiple ? "[" + n + "]" : ""); 720 | } 721 | }; 722 | 723 | Dropzone.prototype.getFallbackForm = function() { 724 | var existingFallback, fields, fieldsString, form; 725 | if (existingFallback = this.getExistingFallback()) { 726 | return existingFallback; 727 | } 728 | fieldsString = "
"; 729 | if (this.options.dictFallbackText) { 730 | fieldsString += "

" + this.options.dictFallbackText + "

"; 731 | } 732 | fieldsString += "
"; 733 | fields = Dropzone.createElement(fieldsString); 734 | if (this.element.tagName !== "FORM") { 735 | form = Dropzone.createElement("
"); 736 | form.appendChild(fields); 737 | } else { 738 | this.element.setAttribute("enctype", "multipart/form-data"); 739 | this.element.setAttribute("method", this.options.method); 740 | } 741 | return form != null ? form : fields; 742 | }; 743 | 744 | Dropzone.prototype.getExistingFallback = function() { 745 | var fallback, getFallback, tagName, _i, _len, _ref; 746 | getFallback = function(elements) { 747 | var el, _i, _len; 748 | for (_i = 0, _len = elements.length; _i < _len; _i++) { 749 | el = elements[_i]; 750 | if (/(^| )fallback($| )/.test(el.className)) { 751 | return el; 752 | } 753 | } 754 | }; 755 | _ref = ["div", "form"]; 756 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 757 | tagName = _ref[_i]; 758 | if (fallback = getFallback(this.element.getElementsByTagName(tagName))) { 759 | return fallback; 760 | } 761 | } 762 | }; 763 | 764 | Dropzone.prototype.setupEventListeners = function() { 765 | var elementListeners, event, listener, _i, _len, _ref, _results; 766 | _ref = this.listeners; 767 | _results = []; 768 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 769 | elementListeners = _ref[_i]; 770 | _results.push((function() { 771 | var _ref1, _results1; 772 | _ref1 = elementListeners.events; 773 | _results1 = []; 774 | for (event in _ref1) { 775 | listener = _ref1[event]; 776 | _results1.push(elementListeners.element.addEventListener(event, listener, false)); 777 | } 778 | return _results1; 779 | })()); 780 | } 781 | return _results; 782 | }; 783 | 784 | Dropzone.prototype.removeEventListeners = function() { 785 | var elementListeners, event, listener, _i, _len, _ref, _results; 786 | _ref = this.listeners; 787 | _results = []; 788 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 789 | elementListeners = _ref[_i]; 790 | _results.push((function() { 791 | var _ref1, _results1; 792 | _ref1 = elementListeners.events; 793 | _results1 = []; 794 | for (event in _ref1) { 795 | listener = _ref1[event]; 796 | _results1.push(elementListeners.element.removeEventListener(event, listener, false)); 797 | } 798 | return _results1; 799 | })()); 800 | } 801 | return _results; 802 | }; 803 | 804 | Dropzone.prototype.disable = function() { 805 | var file, _i, _len, _ref, _results; 806 | this.clickableElements.forEach(function(element) { 807 | return element.classList.remove("dz-clickable"); 808 | }); 809 | this.removeEventListeners(); 810 | _ref = this.files; 811 | _results = []; 812 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 813 | file = _ref[_i]; 814 | _results.push(this.cancelUpload(file)); 815 | } 816 | return _results; 817 | }; 818 | 819 | Dropzone.prototype.enable = function() { 820 | this.clickableElements.forEach(function(element) { 821 | return element.classList.add("dz-clickable"); 822 | }); 823 | return this.setupEventListeners(); 824 | }; 825 | 826 | Dropzone.prototype.filesize = function(size) { 827 | var cutoff, i, selectedSize, selectedUnit, unit, units, _i, _len; 828 | selectedSize = 0; 829 | selectedUnit = "b"; 830 | if (size > 0) { 831 | units = ['TB', 'GB', 'MB', 'KB', 'b']; 832 | for (i = _i = 0, _len = units.length; _i < _len; i = ++_i) { 833 | unit = units[i]; 834 | cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10; 835 | if (size >= cutoff) { 836 | selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i); 837 | selectedUnit = unit; 838 | break; 839 | } 840 | } 841 | selectedSize = Math.round(10 * selectedSize) / 10; 842 | } 843 | return "" + selectedSize + " " + selectedUnit; 844 | }; 845 | 846 | Dropzone.prototype._updateMaxFilesReachedClass = function() { 847 | if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) { 848 | if (this.getAcceptedFiles().length === this.options.maxFiles) { 849 | this.emit('maxfilesreached', this.files); 850 | } 851 | return this.element.classList.add("dz-max-files-reached"); 852 | } else { 853 | return this.element.classList.remove("dz-max-files-reached"); 854 | } 855 | }; 856 | 857 | Dropzone.prototype.drop = function(e) { 858 | var files, items; 859 | if (!e.dataTransfer) { 860 | return; 861 | } 862 | this.emit("drop", e); 863 | files = e.dataTransfer.files; 864 | this.emit("addedfiles", files); 865 | if (files.length) { 866 | items = e.dataTransfer.items; 867 | if (items && items.length && (items[0].webkitGetAsEntry != null)) { 868 | this._addFilesFromItems(items); 869 | } else { 870 | this.handleFiles(files); 871 | } 872 | } 873 | }; 874 | 875 | Dropzone.prototype.paste = function(e) { 876 | var items, _ref; 877 | if ((e != null ? (_ref = e.clipboardData) != null ? _ref.items : void 0 : void 0) == null) { 878 | return; 879 | } 880 | this.emit("paste", e); 881 | items = e.clipboardData.items; 882 | if (items.length) { 883 | return this._addFilesFromItems(items); 884 | } 885 | }; 886 | 887 | Dropzone.prototype.handleFiles = function(files) { 888 | var file, _i, _len, _results; 889 | _results = []; 890 | for (_i = 0, _len = files.length; _i < _len; _i++) { 891 | file = files[_i]; 892 | _results.push(this.addFile(file)); 893 | } 894 | return _results; 895 | }; 896 | 897 | Dropzone.prototype._addFilesFromItems = function(items) { 898 | var entry, item, _i, _len, _results; 899 | _results = []; 900 | for (_i = 0, _len = items.length; _i < _len; _i++) { 901 | item = items[_i]; 902 | if ((item.webkitGetAsEntry != null) && (entry = item.webkitGetAsEntry())) { 903 | if (entry.isFile) { 904 | _results.push(this.addFile(item.getAsFile())); 905 | } else if (entry.isDirectory) { 906 | _results.push(this._addFilesFromDirectory(entry, entry.name)); 907 | } else { 908 | _results.push(void 0); 909 | } 910 | } else if (item.getAsFile != null) { 911 | if ((item.kind == null) || item.kind === "file") { 912 | _results.push(this.addFile(item.getAsFile())); 913 | } else { 914 | _results.push(void 0); 915 | } 916 | } else { 917 | _results.push(void 0); 918 | } 919 | } 920 | return _results; 921 | }; 922 | 923 | Dropzone.prototype._addFilesFromDirectory = function(directory, path) { 924 | var dirReader, entriesReader; 925 | dirReader = directory.createReader(); 926 | entriesReader = (function(_this) { 927 | return function(entries) { 928 | var entry, _i, _len; 929 | for (_i = 0, _len = entries.length; _i < _len; _i++) { 930 | entry = entries[_i]; 931 | if (entry.isFile) { 932 | entry.file(function(file) { 933 | if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') { 934 | return; 935 | } 936 | file.fullPath = "" + path + "/" + file.name; 937 | return _this.addFile(file); 938 | }); 939 | } else if (entry.isDirectory) { 940 | _this._addFilesFromDirectory(entry, "" + path + "/" + entry.name); 941 | } 942 | } 943 | }; 944 | })(this); 945 | return dirReader.readEntries(entriesReader, function(error) { 946 | return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0; 947 | }); 948 | }; 949 | 950 | Dropzone.prototype.accept = function(file, done) { 951 | if (file.size > this.options.maxFilesize * 1024 * 1024) { 952 | return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize)); 953 | } else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) { 954 | return done(this.options.dictInvalidFileType); 955 | } else if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) { 956 | done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles)); 957 | return this.emit("maxfilesexceeded", file); 958 | } else { 959 | return this.options.accept.call(this, file, done); 960 | } 961 | }; 962 | 963 | Dropzone.prototype.addFile = function(file) { 964 | file.upload = { 965 | progress: 0, 966 | total: file.size, 967 | bytesSent: 0 968 | }; 969 | this.files.push(file); 970 | file.status = Dropzone.ADDED; 971 | this.emit("addedfile", file); 972 | this._enqueueThumbnail(file); 973 | return this.accept(file, (function(_this) { 974 | return function(error) { 975 | if (error) { 976 | file.accepted = false; 977 | _this._errorProcessing([file], error); 978 | } else { 979 | file.accepted = true; 980 | if (_this.options.autoQueue) { 981 | _this.enqueueFile(file); 982 | } 983 | } 984 | return _this._updateMaxFilesReachedClass(); 985 | }; 986 | })(this)); 987 | }; 988 | 989 | Dropzone.prototype.enqueueFiles = function(files) { 990 | var file, _i, _len; 991 | for (_i = 0, _len = files.length; _i < _len; _i++) { 992 | file = files[_i]; 993 | this.enqueueFile(file); 994 | } 995 | return null; 996 | }; 997 | 998 | Dropzone.prototype.enqueueFile = function(file) { 999 | if (file.status === Dropzone.ADDED && file.accepted === true) { 1000 | file.status = Dropzone.QUEUED; 1001 | if (this.options.autoProcessQueue) { 1002 | return setTimeout(((function(_this) { 1003 | return function() { 1004 | return _this.processQueue(); 1005 | }; 1006 | })(this)), 0); 1007 | } 1008 | } else { 1009 | throw new Error("This file can't be queued because it has already been processed or was rejected."); 1010 | } 1011 | }; 1012 | 1013 | Dropzone.prototype._thumbnailQueue = []; 1014 | 1015 | Dropzone.prototype._processingThumbnail = false; 1016 | 1017 | Dropzone.prototype._enqueueThumbnail = function(file) { 1018 | if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) { 1019 | this._thumbnailQueue.push(file); 1020 | return setTimeout(((function(_this) { 1021 | return function() { 1022 | return _this._processThumbnailQueue(); 1023 | }; 1024 | })(this)), 0); 1025 | } 1026 | }; 1027 | 1028 | Dropzone.prototype._processThumbnailQueue = function() { 1029 | if (this._processingThumbnail || this._thumbnailQueue.length === 0) { 1030 | return; 1031 | } 1032 | this._processingThumbnail = true; 1033 | return this.createThumbnail(this._thumbnailQueue.shift(), (function(_this) { 1034 | return function() { 1035 | _this._processingThumbnail = false; 1036 | return _this._processThumbnailQueue(); 1037 | }; 1038 | })(this)); 1039 | }; 1040 | 1041 | Dropzone.prototype.removeFile = function(file) { 1042 | if (file.status === Dropzone.UPLOADING) { 1043 | this.cancelUpload(file); 1044 | } 1045 | this.files = without(this.files, file); 1046 | this.emit("removedfile", file); 1047 | if (this.files.length === 0) { 1048 | return this.emit("reset"); 1049 | } 1050 | }; 1051 | 1052 | Dropzone.prototype.removeAllFiles = function(cancelIfNecessary) { 1053 | var file, _i, _len, _ref; 1054 | if (cancelIfNecessary == null) { 1055 | cancelIfNecessary = false; 1056 | } 1057 | _ref = this.files.slice(); 1058 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1059 | file = _ref[_i]; 1060 | if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) { 1061 | this.removeFile(file); 1062 | } 1063 | } 1064 | return null; 1065 | }; 1066 | 1067 | Dropzone.prototype.createThumbnail = function(file, callback) { 1068 | var fileReader; 1069 | fileReader = new FileReader; 1070 | fileReader.onload = (function(_this) { 1071 | return function() { 1072 | if (file.type === "image/svg+xml") { 1073 | _this.emit("thumbnail", file, fileReader.result); 1074 | if (callback != null) { 1075 | callback(); 1076 | } 1077 | return; 1078 | } 1079 | return _this.createThumbnailFromUrl(file, fileReader.result, callback); 1080 | }; 1081 | })(this); 1082 | return fileReader.readAsDataURL(file); 1083 | }; 1084 | 1085 | Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback, crossOrigin) { 1086 | var img; 1087 | img = document.createElement("img"); 1088 | if (crossOrigin) { 1089 | img.crossOrigin = crossOrigin; 1090 | } 1091 | img.onload = (function(_this) { 1092 | return function() { 1093 | var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3; 1094 | file.width = img.width; 1095 | file.height = img.height; 1096 | resizeInfo = _this.options.resize.call(_this, file); 1097 | if (resizeInfo.trgWidth == null) { 1098 | resizeInfo.trgWidth = resizeInfo.optWidth; 1099 | } 1100 | if (resizeInfo.trgHeight == null) { 1101 | resizeInfo.trgHeight = resizeInfo.optHeight; 1102 | } 1103 | canvas = document.createElement("canvas"); 1104 | ctx = canvas.getContext("2d"); 1105 | canvas.width = resizeInfo.trgWidth; 1106 | canvas.height = resizeInfo.trgHeight; 1107 | drawImageIOSFix(ctx, img, (_ref = resizeInfo.srcX) != null ? _ref : 0, (_ref1 = resizeInfo.srcY) != null ? _ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref2 = resizeInfo.trgX) != null ? _ref2 : 0, (_ref3 = resizeInfo.trgY) != null ? _ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight); 1108 | thumbnail = canvas.toDataURL("image/png"); 1109 | _this.emit("thumbnail", file, thumbnail); 1110 | if (callback != null) { 1111 | return callback(); 1112 | } 1113 | }; 1114 | })(this); 1115 | if (callback != null) { 1116 | img.onerror = callback; 1117 | } 1118 | return img.src = imageUrl; 1119 | }; 1120 | 1121 | Dropzone.prototype.processQueue = function() { 1122 | var i, parallelUploads, processingLength, queuedFiles; 1123 | parallelUploads = this.options.parallelUploads; 1124 | processingLength = this.getUploadingFiles().length; 1125 | i = processingLength; 1126 | if (processingLength >= parallelUploads) { 1127 | return; 1128 | } 1129 | queuedFiles = this.getQueuedFiles(); 1130 | if (!(queuedFiles.length > 0)) { 1131 | return; 1132 | } 1133 | if (this.options.uploadMultiple) { 1134 | return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength)); 1135 | } else { 1136 | while (i < parallelUploads) { 1137 | if (!queuedFiles.length) { 1138 | return; 1139 | } 1140 | this.processFile(queuedFiles.shift()); 1141 | i++; 1142 | } 1143 | } 1144 | }; 1145 | 1146 | Dropzone.prototype.processFile = function(file) { 1147 | return this.processFiles([file]); 1148 | }; 1149 | 1150 | Dropzone.prototype.processFiles = function(files) { 1151 | var file, _i, _len; 1152 | for (_i = 0, _len = files.length; _i < _len; _i++) { 1153 | file = files[_i]; 1154 | file.processing = true; 1155 | file.status = Dropzone.UPLOADING; 1156 | this.emit("processing", file); 1157 | } 1158 | if (this.options.uploadMultiple) { 1159 | this.emit("processingmultiple", files); 1160 | } 1161 | return this.uploadFiles(files); 1162 | }; 1163 | 1164 | Dropzone.prototype._getFilesWithXhr = function(xhr) { 1165 | var file, files; 1166 | return files = (function() { 1167 | var _i, _len, _ref, _results; 1168 | _ref = this.files; 1169 | _results = []; 1170 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1171 | file = _ref[_i]; 1172 | if (file.xhr === xhr) { 1173 | _results.push(file); 1174 | } 1175 | } 1176 | return _results; 1177 | }).call(this); 1178 | }; 1179 | 1180 | Dropzone.prototype.cancelUpload = function(file) { 1181 | var groupedFile, groupedFiles, _i, _j, _len, _len1, _ref; 1182 | if (file.status === Dropzone.UPLOADING) { 1183 | groupedFiles = this._getFilesWithXhr(file.xhr); 1184 | for (_i = 0, _len = groupedFiles.length; _i < _len; _i++) { 1185 | groupedFile = groupedFiles[_i]; 1186 | groupedFile.status = Dropzone.CANCELED; 1187 | } 1188 | file.xhr.abort(); 1189 | for (_j = 0, _len1 = groupedFiles.length; _j < _len1; _j++) { 1190 | groupedFile = groupedFiles[_j]; 1191 | this.emit("canceled", groupedFile); 1192 | } 1193 | if (this.options.uploadMultiple) { 1194 | this.emit("canceledmultiple", groupedFiles); 1195 | } 1196 | } else if ((_ref = file.status) === Dropzone.ADDED || _ref === Dropzone.QUEUED) { 1197 | file.status = Dropzone.CANCELED; 1198 | this.emit("canceled", file); 1199 | if (this.options.uploadMultiple) { 1200 | this.emit("canceledmultiple", [file]); 1201 | } 1202 | } 1203 | if (this.options.autoProcessQueue) { 1204 | return this.processQueue(); 1205 | } 1206 | }; 1207 | 1208 | resolveOption = function() { 1209 | var args, option; 1210 | option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 1211 | if (typeof option === 'function') { 1212 | return option.apply(this, args); 1213 | } 1214 | return option; 1215 | }; 1216 | 1217 | Dropzone.prototype.uploadFile = function(file) { 1218 | return this.uploadFiles([file]); 1219 | }; 1220 | 1221 | Dropzone.prototype.uploadFiles = function(files) { 1222 | var file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, key, method, option, progressObj, response, updateProgress, url, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; 1223 | xhr = new XMLHttpRequest(); 1224 | for (_i = 0, _len = files.length; _i < _len; _i++) { 1225 | file = files[_i]; 1226 | file.xhr = xhr; 1227 | } 1228 | method = resolveOption(this.options.method, files); 1229 | url = resolveOption(this.options.url, files); 1230 | xhr.open(method, url, true); 1231 | xhr.withCredentials = !!this.options.withCredentials; 1232 | response = null; 1233 | handleError = (function(_this) { 1234 | return function() { 1235 | var _j, _len1, _results; 1236 | _results = []; 1237 | for (_j = 0, _len1 = files.length; _j < _len1; _j++) { 1238 | file = files[_j]; 1239 | _results.push(_this._errorProcessing(files, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr)); 1240 | } 1241 | return _results; 1242 | }; 1243 | })(this); 1244 | updateProgress = (function(_this) { 1245 | return function(e) { 1246 | var allFilesFinished, progress, _j, _k, _l, _len1, _len2, _len3, _results; 1247 | if (e != null) { 1248 | progress = 100 * e.loaded / e.total; 1249 | for (_j = 0, _len1 = files.length; _j < _len1; _j++) { 1250 | file = files[_j]; 1251 | file.upload = { 1252 | progress: progress, 1253 | total: e.total, 1254 | bytesSent: e.loaded 1255 | }; 1256 | } 1257 | } else { 1258 | allFilesFinished = true; 1259 | progress = 100; 1260 | for (_k = 0, _len2 = files.length; _k < _len2; _k++) { 1261 | file = files[_k]; 1262 | if (!(file.upload.progress === 100 && file.upload.bytesSent === file.upload.total)) { 1263 | allFilesFinished = false; 1264 | } 1265 | file.upload.progress = progress; 1266 | file.upload.bytesSent = file.upload.total; 1267 | } 1268 | if (allFilesFinished) { 1269 | return; 1270 | } 1271 | } 1272 | _results = []; 1273 | for (_l = 0, _len3 = files.length; _l < _len3; _l++) { 1274 | file = files[_l]; 1275 | _results.push(_this.emit("uploadprogress", file, progress, file.upload.bytesSent)); 1276 | } 1277 | return _results; 1278 | }; 1279 | })(this); 1280 | xhr.onload = (function(_this) { 1281 | return function(e) { 1282 | var _ref; 1283 | if (files[0].status === Dropzone.CANCELED) { 1284 | return; 1285 | } 1286 | if (xhr.readyState !== 4) { 1287 | return; 1288 | } 1289 | response = xhr.responseText; 1290 | if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) { 1291 | try { 1292 | response = JSON.parse(response); 1293 | } catch (_error) { 1294 | e = _error; 1295 | response = "Invalid JSON response from server."; 1296 | } 1297 | } 1298 | updateProgress(); 1299 | if (!((200 <= (_ref = xhr.status) && _ref < 300))) { 1300 | return handleError(); 1301 | } else { 1302 | return _this._finished(files, response, e); 1303 | } 1304 | }; 1305 | })(this); 1306 | xhr.onerror = (function(_this) { 1307 | return function() { 1308 | if (files[0].status === Dropzone.CANCELED) { 1309 | return; 1310 | } 1311 | return handleError(); 1312 | }; 1313 | })(this); 1314 | progressObj = (_ref = xhr.upload) != null ? _ref : xhr; 1315 | progressObj.onprogress = updateProgress; 1316 | headers = { 1317 | "Accept": "application/json", 1318 | "Cache-Control": "no-cache", 1319 | "X-Requested-With": "XMLHttpRequest" 1320 | }; 1321 | if (this.options.headers) { 1322 | extend(headers, this.options.headers); 1323 | } 1324 | for (headerName in headers) { 1325 | headerValue = headers[headerName]; 1326 | if (headerValue) { 1327 | xhr.setRequestHeader(headerName, headerValue); 1328 | } 1329 | } 1330 | formData = new FormData(); 1331 | if (this.options.params) { 1332 | _ref1 = this.options.params; 1333 | for (key in _ref1) { 1334 | value = _ref1[key]; 1335 | formData.append(key, value); 1336 | } 1337 | } 1338 | for (_j = 0, _len1 = files.length; _j < _len1; _j++) { 1339 | file = files[_j]; 1340 | this.emit("sending", file, xhr, formData); 1341 | } 1342 | if (this.options.uploadMultiple) { 1343 | this.emit("sendingmultiple", files, xhr, formData); 1344 | } 1345 | if (this.element.tagName === "FORM") { 1346 | _ref2 = this.element.querySelectorAll("input, textarea, select, button"); 1347 | for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { 1348 | input = _ref2[_k]; 1349 | inputName = input.getAttribute("name"); 1350 | inputType = input.getAttribute("type"); 1351 | if (input.tagName === "SELECT" && input.hasAttribute("multiple")) { 1352 | _ref3 = input.options; 1353 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { 1354 | option = _ref3[_l]; 1355 | if (option.selected) { 1356 | formData.append(inputName, option.value); 1357 | } 1358 | } 1359 | } else if (!inputType || ((_ref4 = inputType.toLowerCase()) !== "checkbox" && _ref4 !== "radio") || input.checked) { 1360 | formData.append(inputName, input.value); 1361 | } 1362 | } 1363 | } 1364 | for (i = _m = 0, _ref5 = files.length - 1; 0 <= _ref5 ? _m <= _ref5 : _m >= _ref5; i = 0 <= _ref5 ? ++_m : --_m) { 1365 | formData.append(this._getParamName(i), files[i], files[i].name); 1366 | } 1367 | return this.submitRequest(xhr, formData, files); 1368 | }; 1369 | 1370 | Dropzone.prototype.submitRequest = function(xhr, formData, files) { 1371 | return xhr.send(formData); 1372 | }; 1373 | 1374 | Dropzone.prototype._finished = function(files, responseText, e) { 1375 | var file, _i, _len; 1376 | for (_i = 0, _len = files.length; _i < _len; _i++) { 1377 | file = files[_i]; 1378 | file.status = Dropzone.SUCCESS; 1379 | this.emit("success", file, responseText, e); 1380 | this.emit("complete", file); 1381 | } 1382 | if (this.options.uploadMultiple) { 1383 | this.emit("successmultiple", files, responseText, e); 1384 | this.emit("completemultiple", files); 1385 | } 1386 | if (this.options.autoProcessQueue) { 1387 | return this.processQueue(); 1388 | } 1389 | }; 1390 | 1391 | Dropzone.prototype._errorProcessing = function(files, message, xhr) { 1392 | var file, _i, _len; 1393 | for (_i = 0, _len = files.length; _i < _len; _i++) { 1394 | file = files[_i]; 1395 | file.status = Dropzone.ERROR; 1396 | this.emit("error", file, message, xhr); 1397 | this.emit("complete", file); 1398 | } 1399 | if (this.options.uploadMultiple) { 1400 | this.emit("errormultiple", files, message, xhr); 1401 | this.emit("completemultiple", files); 1402 | } 1403 | if (this.options.autoProcessQueue) { 1404 | return this.processQueue(); 1405 | } 1406 | }; 1407 | 1408 | return Dropzone; 1409 | 1410 | })(Emitter); 1411 | 1412 | Dropzone.version = "4.2.0"; 1413 | 1414 | Dropzone.options = {}; 1415 | 1416 | Dropzone.optionsForElement = function(element) { 1417 | if (element.getAttribute("id")) { 1418 | return Dropzone.options[camelize(element.getAttribute("id"))]; 1419 | } else { 1420 | return void 0; 1421 | } 1422 | }; 1423 | 1424 | Dropzone.instances = []; 1425 | 1426 | Dropzone.forElement = function(element) { 1427 | if (typeof element === "string") { 1428 | element = document.querySelector(element); 1429 | } 1430 | if ((element != null ? element.dropzone : void 0) == null) { 1431 | throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone."); 1432 | } 1433 | return element.dropzone; 1434 | }; 1435 | 1436 | Dropzone.autoDiscover = true; 1437 | 1438 | Dropzone.discover = function() { 1439 | var checkElements, dropzone, dropzones, _i, _len, _results; 1440 | if (document.querySelectorAll) { 1441 | dropzones = document.querySelectorAll(".dropzone"); 1442 | } else { 1443 | dropzones = []; 1444 | checkElements = function(elements) { 1445 | var el, _i, _len, _results; 1446 | _results = []; 1447 | for (_i = 0, _len = elements.length; _i < _len; _i++) { 1448 | el = elements[_i]; 1449 | if (/(^| )dropzone($| )/.test(el.className)) { 1450 | _results.push(dropzones.push(el)); 1451 | } else { 1452 | _results.push(void 0); 1453 | } 1454 | } 1455 | return _results; 1456 | }; 1457 | checkElements(document.getElementsByTagName("div")); 1458 | checkElements(document.getElementsByTagName("form")); 1459 | } 1460 | _results = []; 1461 | for (_i = 0, _len = dropzones.length; _i < _len; _i++) { 1462 | dropzone = dropzones[_i]; 1463 | if (Dropzone.optionsForElement(dropzone) !== false) { 1464 | _results.push(new Dropzone(dropzone)); 1465 | } else { 1466 | _results.push(void 0); 1467 | } 1468 | } 1469 | return _results; 1470 | }; 1471 | 1472 | Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i]; 1473 | 1474 | Dropzone.isBrowserSupported = function() { 1475 | var capableBrowser, regex, _i, _len, _ref; 1476 | capableBrowser = true; 1477 | if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) { 1478 | if (!("classList" in document.createElement("a"))) { 1479 | capableBrowser = false; 1480 | } else { 1481 | _ref = Dropzone.blacklistedBrowsers; 1482 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { 1483 | regex = _ref[_i]; 1484 | if (regex.test(navigator.userAgent)) { 1485 | capableBrowser = false; 1486 | continue; 1487 | } 1488 | } 1489 | } 1490 | } else { 1491 | capableBrowser = false; 1492 | } 1493 | return capableBrowser; 1494 | }; 1495 | 1496 | without = function(list, rejectedItem) { 1497 | var item, _i, _len, _results; 1498 | _results = []; 1499 | for (_i = 0, _len = list.length; _i < _len; _i++) { 1500 | item = list[_i]; 1501 | if (item !== rejectedItem) { 1502 | _results.push(item); 1503 | } 1504 | } 1505 | return _results; 1506 | }; 1507 | 1508 | camelize = function(str) { 1509 | return str.replace(/[\-_](\w)/g, function(match) { 1510 | return match.charAt(1).toUpperCase(); 1511 | }); 1512 | }; 1513 | 1514 | Dropzone.createElement = function(string) { 1515 | var div; 1516 | div = document.createElement("div"); 1517 | div.innerHTML = string; 1518 | return div.childNodes[0]; 1519 | }; 1520 | 1521 | Dropzone.elementInside = function(element, container) { 1522 | if (element === container) { 1523 | return true; 1524 | } 1525 | while (element = element.parentNode) { 1526 | if (element === container) { 1527 | return true; 1528 | } 1529 | } 1530 | return false; 1531 | }; 1532 | 1533 | Dropzone.getElement = function(el, name) { 1534 | var element; 1535 | if (typeof el === "string") { 1536 | element = document.querySelector(el); 1537 | } else if (el.nodeType != null) { 1538 | element = el; 1539 | } 1540 | if (element == null) { 1541 | throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector or a plain HTML element."); 1542 | } 1543 | return element; 1544 | }; 1545 | 1546 | Dropzone.getElements = function(els, name) { 1547 | var e, el, elements, _i, _j, _len, _len1, _ref; 1548 | if (els instanceof Array) { 1549 | elements = []; 1550 | try { 1551 | for (_i = 0, _len = els.length; _i < _len; _i++) { 1552 | el = els[_i]; 1553 | elements.push(this.getElement(el, name)); 1554 | } 1555 | } catch (_error) { 1556 | e = _error; 1557 | elements = null; 1558 | } 1559 | } else if (typeof els === "string") { 1560 | elements = []; 1561 | _ref = document.querySelectorAll(els); 1562 | for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { 1563 | el = _ref[_j]; 1564 | elements.push(el); 1565 | } 1566 | } else if (els.nodeType != null) { 1567 | elements = [els]; 1568 | } 1569 | if (!((elements != null) && elements.length)) { 1570 | throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector, a plain HTML element or a list of those."); 1571 | } 1572 | return elements; 1573 | }; 1574 | 1575 | Dropzone.confirm = function(question, accepted, rejected) { 1576 | if (window.confirm(question)) { 1577 | return accepted(); 1578 | } else if (rejected != null) { 1579 | return rejected(); 1580 | } 1581 | }; 1582 | 1583 | Dropzone.isValidFile = function(file, acceptedFiles) { 1584 | var baseMimeType, mimeType, validType, _i, _len; 1585 | if (!acceptedFiles) { 1586 | return true; 1587 | } 1588 | acceptedFiles = acceptedFiles.split(","); 1589 | mimeType = file.type; 1590 | baseMimeType = mimeType.replace(/\/.*$/, ""); 1591 | for (_i = 0, _len = acceptedFiles.length; _i < _len; _i++) { 1592 | validType = acceptedFiles[_i]; 1593 | validType = validType.trim(); 1594 | if (validType.charAt(0) === ".") { 1595 | if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) { 1596 | return true; 1597 | } 1598 | } else if (/\/\*$/.test(validType)) { 1599 | if (baseMimeType === validType.replace(/\/.*$/, "")) { 1600 | return true; 1601 | } 1602 | } else { 1603 | if (mimeType === validType) { 1604 | return true; 1605 | } 1606 | } 1607 | } 1608 | return false; 1609 | }; 1610 | 1611 | if (typeof jQuery !== "undefined" && jQuery !== null) { 1612 | jQuery.fn.dropzone = function(options) { 1613 | return this.each(function() { 1614 | return new Dropzone(this, options); 1615 | }); 1616 | }; 1617 | } 1618 | 1619 | if (typeof module !== "undefined" && module !== null) { 1620 | module.exports = Dropzone; 1621 | } else { 1622 | window.Dropzone = Dropzone; 1623 | } 1624 | 1625 | Dropzone.ADDED = "added"; 1626 | 1627 | Dropzone.QUEUED = "queued"; 1628 | 1629 | Dropzone.ACCEPTED = Dropzone.QUEUED; 1630 | 1631 | Dropzone.UPLOADING = "uploading"; 1632 | 1633 | Dropzone.PROCESSING = Dropzone.UPLOADING; 1634 | 1635 | Dropzone.CANCELED = "canceled"; 1636 | 1637 | Dropzone.ERROR = "error"; 1638 | 1639 | Dropzone.SUCCESS = "success"; 1640 | 1641 | 1642 | /* 1643 | 1644 | Bugfix for iOS 6 and 7 1645 | Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios 1646 | based on the work of https://github.com/stomita/ios-imagefile-megapixel 1647 | */ 1648 | 1649 | detectVerticalSquash = function(img) { 1650 | var alpha, canvas, ctx, data, ey, ih, iw, py, ratio, sy; 1651 | iw = img.naturalWidth; 1652 | ih = img.naturalHeight; 1653 | canvas = document.createElement("canvas"); 1654 | canvas.width = 1; 1655 | canvas.height = ih; 1656 | ctx = canvas.getContext("2d"); 1657 | ctx.drawImage(img, 0, 0); 1658 | data = ctx.getImageData(0, 0, 1, ih).data; 1659 | sy = 0; 1660 | ey = ih; 1661 | py = ih; 1662 | while (py > sy) { 1663 | alpha = data[(py - 1) * 4 + 3]; 1664 | if (alpha === 0) { 1665 | ey = py; 1666 | } else { 1667 | sy = py; 1668 | } 1669 | py = (ey + sy) >> 1; 1670 | } 1671 | ratio = py / ih; 1672 | if (ratio === 0) { 1673 | return 1; 1674 | } else { 1675 | return ratio; 1676 | } 1677 | }; 1678 | 1679 | drawImageIOSFix = function(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) { 1680 | var vertSquashRatio; 1681 | vertSquashRatio = detectVerticalSquash(img); 1682 | return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio); 1683 | }; 1684 | 1685 | 1686 | /* 1687 | * contentloaded.js 1688 | * 1689 | * Author: Diego Perini (diego.perini at gmail.com) 1690 | * Summary: cross-browser wrapper for DOMContentLoaded 1691 | * Updated: 20101020 1692 | * License: MIT 1693 | * Version: 1.2 1694 | * 1695 | * URL: 1696 | * http://javascript.nwbox.com/ContentLoaded/ 1697 | * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE 1698 | */ 1699 | 1700 | contentLoaded = function(win, fn) { 1701 | var add, doc, done, init, poll, pre, rem, root, top; 1702 | done = false; 1703 | top = true; 1704 | doc = win.document; 1705 | root = doc.documentElement; 1706 | add = (doc.addEventListener ? "addEventListener" : "attachEvent"); 1707 | rem = (doc.addEventListener ? "removeEventListener" : "detachEvent"); 1708 | pre = (doc.addEventListener ? "" : "on"); 1709 | init = function(e) { 1710 | if (e.type === "readystatechange" && doc.readyState !== "complete") { 1711 | return; 1712 | } 1713 | (e.type === "load" ? win : doc)[rem](pre + e.type, init, false); 1714 | if (!done && (done = true)) { 1715 | return fn.call(win, e.type || e); 1716 | } 1717 | }; 1718 | poll = function() { 1719 | var e; 1720 | try { 1721 | root.doScroll("left"); 1722 | } catch (_error) { 1723 | e = _error; 1724 | setTimeout(poll, 50); 1725 | return; 1726 | } 1727 | return init("poll"); 1728 | }; 1729 | if (doc.readyState !== "complete") { 1730 | if (doc.createEventObject && root.doScroll) { 1731 | try { 1732 | top = !win.frameElement; 1733 | } catch (_error) {} 1734 | if (top) { 1735 | poll(); 1736 | } 1737 | } 1738 | doc[add](pre + "DOMContentLoaded", init, false); 1739 | doc[add](pre + "readystatechange", init, false); 1740 | return win[add](pre + "load", init, false); 1741 | } 1742 | }; 1743 | 1744 | Dropzone._autoDiscoverFunction = function() { 1745 | if (Dropzone.autoDiscover) { 1746 | return Dropzone.discover(); 1747 | } 1748 | }; 1749 | 1750 | contentLoaded(window, Dropzone._autoDiscoverFunction); 1751 | 1752 | }).call(this); 1753 | -------------------------------------------------------------------------------- /bower_components/dropzone/dist/min/basic.min.css: -------------------------------------------------------------------------------- 1 | .dropzone,.dropzone *{box-sizing:border-box}.dropzone{position:relative}.dropzone .dz-preview{position:relative;display:inline-block;width:120px;margin:0.5em}.dropzone .dz-preview .dz-progress{display:block;height:15px;border:1px solid #aaa}.dropzone .dz-preview .dz-progress .dz-upload{display:block;height:100%;width:0;background:green}.dropzone .dz-preview .dz-error-message{color:red;display:none}.dropzone .dz-preview.dz-error .dz-error-message,.dropzone .dz-preview.dz-error .dz-error-mark{display:block}.dropzone .dz-preview.dz-success .dz-success-mark{display:block}.dropzone .dz-preview .dz-error-mark,.dropzone .dz-preview .dz-success-mark{position:absolute;display:none;left:30px;top:30px;width:54px;height:58px;left:50%;margin-left:-27px} 2 | -------------------------------------------------------------------------------- /bower_components/dropzone/dist/min/dropzone-amd-module.min.js: -------------------------------------------------------------------------------- 1 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){var b={exports:{}};return function(){var c,d,e,f,g,h,i,j,k=[].slice,l={}.hasOwnProperty,m=function(a,b){function c(){this.constructor=a}for(var d in b)l.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};i=function(){},d=function(){function a(){}return a.prototype.addEventListener=a.prototype.on,a.prototype.on=function(a,b){return this._callbacks=this._callbacks||{},this._callbacks[a]||(this._callbacks[a]=[]),this._callbacks[a].push(b),this},a.prototype.emit=function(){var a,b,c,d,e,f;if(d=arguments[0],a=2<=arguments.length?k.call(arguments,1):[],this._callbacks=this._callbacks||{},c=this._callbacks[d])for(e=0,f=c.length;f>e;e++)b=c[e],b.apply(this,a);return this},a.prototype.removeListener=a.prototype.off,a.prototype.removeAllListeners=a.prototype.off,a.prototype.removeEventListener=a.prototype.off,a.prototype.off=function(a,b){var c,d,e,f,g;if(!this._callbacks||0===arguments.length)return this._callbacks={},this;if(d=this._callbacks[a],!d)return this;if(1===arguments.length)return delete this._callbacks[a],this;for(e=f=0,g=d.length;g>f;e=++f)if(c=d[e],c===b){d.splice(e,1);break}return this},a}(),c=function(a){function b(a,d){var e,f,g;if(this.element=a,this.version=b.version,this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,""),this.clickableElements=[],this.listeners=[],this.files=[],"string"==typeof this.element&&(this.element=document.querySelector(this.element)),!this.element||null==this.element.nodeType)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");if(b.instances.push(this),this.element.dropzone=this,e=null!=(g=b.optionsForElement(this.element))?g:{},this.options=c({},this.defaultOptions,e,null!=d?d:{}),this.options.forceFallback||!b.isBrowserSupported())return this.options.fallback.call(this);if(null==this.options.url&&(this.options.url=this.element.getAttribute("action")),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");this.options.acceptedMimeTypes&&(this.options.acceptedFiles=this.options.acceptedMimeTypes,delete this.options.acceptedMimeTypes),this.options.method=this.options.method.toUpperCase(),(f=this.getExistingFallback())&&f.parentNode&&f.parentNode.removeChild(f),this.options.previewsContainer!==!1&&(this.previewsContainer=this.options.previewsContainer?b.getElement(this.options.previewsContainer,"previewsContainer"):this.element),this.options.clickable&&(this.clickableElements=this.options.clickable===!0?[this.element]:b.getElements(this.options.clickable,"clickable")),this.init()}var c,e;return m(b,a),b.prototype.Emitter=d,b.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],b.prototype.defaultOptions={url:null,method:"post",withCredentials:!1,parallelUploads:2,uploadMultiple:!1,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,filesizeBase:1e3,maxFiles:null,params:{},clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,hiddenInputContainer:"body",capture:null,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",accept:function(a,b){return b()},init:function(){return i},forceFallback:!1,fallback:function(){var a,c,d,e,f,g;for(this.element.className=""+this.element.className+" dz-browser-not-supported",g=this.element.getElementsByTagName("div"),e=0,f=g.length;f>e;e++)a=g[e],/(^| )dz-message($| )/.test(a.className)&&(c=a,a.className="dz-message");return c||(c=b.createElement('
'),this.element.appendChild(c)),d=c.getElementsByTagName("span")[0],d&&(null!=d.textContent?d.textContent=this.options.dictFallbackMessage:null!=d.innerText&&(d.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(a){var b,c,d;return b={srcX:0,srcY:0,srcWidth:a.width,srcHeight:a.height},c=a.width/a.height,b.optWidth=this.options.thumbnailWidth,b.optHeight=this.options.thumbnailHeight,null==b.optWidth&&null==b.optHeight?(b.optWidth=b.srcWidth,b.optHeight=b.srcHeight):null==b.optWidth?b.optWidth=c*b.optHeight:null==b.optHeight&&(b.optHeight=1/c*b.optWidth),d=b.optWidth/b.optHeight,a.heightd?(b.srcHeight=a.height,b.srcWidth=b.srcHeight*d):(b.srcWidth=a.width,b.srcHeight=b.srcWidth/d),b.srcX=(a.width-b.srcWidth)/2,b.srcY=(a.height-b.srcHeight)/2,b},drop:function(){return this.element.classList.remove("dz-drag-hover")},dragstart:i,dragend:function(){return this.element.classList.remove("dz-drag-hover")},dragenter:function(){return this.element.classList.add("dz-drag-hover")},dragover:function(){return this.element.classList.add("dz-drag-hover")},dragleave:function(){return this.element.classList.remove("dz-drag-hover")},paste:i,reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(a){var c,d,e,f,g,h,i,j,k,l,m,n,o;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){for(a.previewElement=b.createElement(this.options.previewTemplate.trim()),a.previewTemplate=a.previewElement,this.previewsContainer.appendChild(a.previewElement),l=a.previewElement.querySelectorAll("[data-dz-name]"),f=0,i=l.length;i>f;f++)c=l[f],c.textContent=a.name;for(m=a.previewElement.querySelectorAll("[data-dz-size]"),g=0,j=m.length;j>g;g++)c=m[g],c.innerHTML=this.filesize(a.size);for(this.options.addRemoveLinks&&(a._removeLink=b.createElement(''+this.options.dictRemoveFile+""),a.previewElement.appendChild(a._removeLink)),d=function(c){return function(d){return d.preventDefault(),d.stopPropagation(),a.status===b.UPLOADING?b.confirm(c.options.dictCancelUploadConfirmation,function(){return c.removeFile(a)}):c.options.dictRemoveFileConfirmation?b.confirm(c.options.dictRemoveFileConfirmation,function(){return c.removeFile(a)}):c.removeFile(a)}}(this),n=a.previewElement.querySelectorAll("[data-dz-remove]"),o=[],h=0,k=n.length;k>h;h++)e=n[h],o.push(e.addEventListener("click",d));return o}},removedfile:function(a){var b;return a.previewElement&&null!=(b=a.previewElement)&&b.parentNode.removeChild(a.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(a,b){var c,d,e,f;if(a.previewElement){for(a.previewElement.classList.remove("dz-file-preview"),f=a.previewElement.querySelectorAll("[data-dz-thumbnail]"),d=0,e=f.length;e>d;d++)c=f[d],c.alt=a.name,c.src=b;return setTimeout(function(){return function(){return a.previewElement.classList.add("dz-image-preview")}}(this),1)}},error:function(a,b){var c,d,e,f,g;if(a.previewElement){for(a.previewElement.classList.add("dz-error"),"String"!=typeof b&&b.error&&(b=b.error),f=a.previewElement.querySelectorAll("[data-dz-errormessage]"),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.textContent=b);return g}},errormultiple:i,processing:function(a){return a.previewElement&&(a.previewElement.classList.add("dz-processing"),a._removeLink)?a._removeLink.textContent=this.options.dictCancelUpload:void 0},processingmultiple:i,uploadprogress:function(a,b){var c,d,e,f,g;if(a.previewElement){for(f=a.previewElement.querySelectorAll("[data-dz-uploadprogress]"),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push("PROGRESS"===c.nodeName?c.value=b:c.style.width=""+b+"%");return g}},totaluploadprogress:i,sending:i,sendingmultiple:i,success:function(a){return a.previewElement?a.previewElement.classList.add("dz-success"):void 0},successmultiple:i,canceled:function(a){return this.emit("error",a,"Upload canceled.")},canceledmultiple:i,complete:function(a){return a._removeLink&&(a._removeLink.textContent=this.options.dictRemoveFile),a.previewElement?a.previewElement.classList.add("dz-complete"):void 0},completemultiple:i,maxfilesexceeded:i,maxfilesreached:i,queuecomplete:i,addedfiles:i,previewTemplate:'
\n
\n
\n
\n
\n
\n
\n
\n
\n \n Check\n \n \n \n \n \n
\n
\n \n Error\n \n \n \n \n \n \n \n
\n
'},c=function(){var a,b,c,d,e,f,g;for(d=arguments[0],c=2<=arguments.length?k.call(arguments,1):[],f=0,g=c.length;g>f;f++){b=c[f];for(a in b)e=b[a],d[a]=e}return d},b.prototype.getAcceptedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted&&e.push(a);return e},b.prototype.getRejectedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted||e.push(a);return e},b.prototype.getFilesWithStatus=function(a){var b,c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.status===a&&f.push(b);return f},b.prototype.getQueuedFiles=function(){return this.getFilesWithStatus(b.QUEUED)},b.prototype.getUploadingFiles=function(){return this.getFilesWithStatus(b.UPLOADING)},b.prototype.getAddedFiles=function(){return this.getFilesWithStatus(b.ADDED)},b.prototype.getActiveFiles=function(){var a,c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)a=e[c],(a.status===b.UPLOADING||a.status===b.QUEUED)&&f.push(a);return f},b.prototype.init=function(){var a,c,d,e,f,g,h;for("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(b.createElement('
'+this.options.dictDefaultMessage+"
")),this.clickableElements.length&&(d=function(a){return function(){return a.hiddenFileInput&&a.hiddenFileInput.parentNode.removeChild(a.hiddenFileInput),a.hiddenFileInput=document.createElement("input"),a.hiddenFileInput.setAttribute("type","file"),(null==a.options.maxFiles||a.options.maxFiles>1)&&a.hiddenFileInput.setAttribute("multiple","multiple"),a.hiddenFileInput.className="dz-hidden-input",null!=a.options.acceptedFiles&&a.hiddenFileInput.setAttribute("accept",a.options.acceptedFiles),null!=a.options.capture&&a.hiddenFileInput.setAttribute("capture",a.options.capture),a.hiddenFileInput.style.visibility="hidden",a.hiddenFileInput.style.position="absolute",a.hiddenFileInput.style.top="0",a.hiddenFileInput.style.left="0",a.hiddenFileInput.style.height="0",a.hiddenFileInput.style.width="0",document.querySelector(a.options.hiddenInputContainer).appendChild(a.hiddenFileInput),a.hiddenFileInput.addEventListener("change",function(){var b,c,e,f;if(c=a.hiddenFileInput.files,c.length)for(e=0,f=c.length;f>e;e++)b=c[e],a.addFile(b);return a.emit("addedfiles",c),d()})}}(this))(),this.URL=null!=(g=window.URL)?g:window.webkitURL,h=this.events,e=0,f=h.length;f>e;e++)a=h[e],this.on(a,this.options[a]);return this.on("uploadprogress",function(a){return function(){return a.updateTotalUploadProgress()}}(this)),this.on("removedfile",function(a){return function(){return a.updateTotalUploadProgress()}}(this)),this.on("canceled",function(a){return function(b){return a.emit("complete",b)}}(this)),this.on("complete",function(a){return function(){return 0===a.getAddedFiles().length&&0===a.getUploadingFiles().length&&0===a.getQueuedFiles().length?setTimeout(function(){return a.emit("queuecomplete")},0):void 0}}(this)),c=function(a){return a.stopPropagation(),a.preventDefault?a.preventDefault():a.returnValue=!1},this.listeners=[{element:this.element,events:{dragstart:function(a){return function(b){return a.emit("dragstart",b)}}(this),dragenter:function(a){return function(b){return c(b),a.emit("dragenter",b)}}(this),dragover:function(a){return function(b){var d;try{d=b.dataTransfer.effectAllowed}catch(e){}return b.dataTransfer.dropEffect="move"===d||"linkMove"===d?"move":"copy",c(b),a.emit("dragover",b)}}(this),dragleave:function(a){return function(b){return a.emit("dragleave",b)}}(this),drop:function(a){return function(b){return c(b),a.drop(b)}}(this),dragend:function(a){return function(b){return a.emit("dragend",b)}}(this)}}],this.clickableElements.forEach(function(a){return function(c){return a.listeners.push({element:c,events:{click:function(d){return(c!==a.element||d.target===a.element||b.elementInside(d.target,a.element.querySelector(".dz-message")))&&a.hiddenFileInput.click(),!0}}})}}(this)),this.enable(),this.options.init.call(this)},b.prototype.destroy=function(){var a;return this.disable(),this.removeAllFiles(!0),(null!=(a=this.hiddenFileInput)?a.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,b.instances.splice(b.instances.indexOf(this),1)},b.prototype.updateTotalUploadProgress=function(){var a,b,c,d,e,f,g,h;if(d=0,c=0,a=this.getActiveFiles(),a.length){for(h=this.getActiveFiles(),f=0,g=h.length;g>f;f++)b=h[f],d+=b.upload.bytesSent,c+=b.upload.total;e=100*d/c}else e=100;return this.emit("totaluploadprogress",e,c,d)},b.prototype._getParamName=function(a){return"function"==typeof this.options.paramName?this.options.paramName(a):""+this.options.paramName+(this.options.uploadMultiple?"["+a+"]":"")},b.prototype.getFallbackForm=function(){var a,c,d,e;return(a=this.getExistingFallback())?a:(d='
',this.options.dictFallbackText&&(d+="

"+this.options.dictFallbackText+"

"),d+='
',c=b.createElement(d),"FORM"!==this.element.tagName?(e=b.createElement('
'),e.appendChild(c)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=e?e:c)},b.prototype.getExistingFallback=function(){var a,b,c,d,e,f;for(b=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c],/(^| )fallback($| )/.test(b.className))return b},f=["div","form"],d=0,e=f.length;e>d;d++)if(c=f[d],a=b(this.element.getElementsByTagName(c)))return a},b.prototype.setupEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.addEventListener(b,c,!1));return e}());return g},b.prototype.removeEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.removeEventListener(b,c,!1));return e}());return g},b.prototype.disable=function(){var a,b,c,d,e;for(this.clickableElements.forEach(function(a){return a.classList.remove("dz-clickable")}),this.removeEventListeners(),d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(this.cancelUpload(a));return e},b.prototype.enable=function(){return this.clickableElements.forEach(function(a){return a.classList.add("dz-clickable")}),this.setupEventListeners()},b.prototype.filesize=function(a){var b,c,d,e,f,g,h,i;if(d=0,e="b",a>0){for(g=["TB","GB","MB","KB","b"],c=h=0,i=g.length;i>h;c=++h)if(f=g[c],b=Math.pow(this.options.filesizeBase,4-c)/10,a>=b){d=a/Math.pow(this.options.filesizeBase,4-c),e=f;break}d=Math.round(10*d)/10}return""+d+" "+e},b.prototype._updateMaxFilesReachedClass=function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")},b.prototype.drop=function(a){var b,c;a.dataTransfer&&(this.emit("drop",a),b=a.dataTransfer.files,this.emit("addedfiles",b),b.length&&(c=a.dataTransfer.items,c&&c.length&&null!=c[0].webkitGetAsEntry?this._addFilesFromItems(c):this.handleFiles(b)))},b.prototype.paste=function(a){var b,c;if(null!=(null!=a&&null!=(c=a.clipboardData)?c.items:void 0))return this.emit("paste",a),b=a.clipboardData.items,b.length?this._addFilesFromItems(b):void 0},b.prototype.handleFiles=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addFile(b));return e},b.prototype._addFilesFromItems=function(a){var b,c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(null!=c.webkitGetAsEntry&&(b=c.webkitGetAsEntry())?b.isFile?this.addFile(c.getAsFile()):b.isDirectory?this._addFilesFromDirectory(b,b.name):void 0:null!=c.getAsFile?null==c.kind||"file"===c.kind?this.addFile(c.getAsFile()):void 0:void 0);return f},b.prototype._addFilesFromDirectory=function(a,b){var c,d;return c=a.createReader(),d=function(a){return function(c){var d,e,f;for(e=0,f=c.length;f>e;e++)d=c[e],d.isFile?d.file(function(c){return a.options.ignoreHiddenFiles&&"."===c.name.substring(0,1)?void 0:(c.fullPath=""+b+"/"+c.name,a.addFile(c))}):d.isDirectory&&a._addFilesFromDirectory(d,""+b+"/"+d.name)}}(this),c.readEntries(d,function(a){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log(a):void 0})},b.prototype.accept=function(a,c){return a.size>1024*this.options.maxFilesize*1024?c(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(a.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):b.isValidFile(a,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(c(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",a)):this.options.accept.call(this,a,c):c(this.options.dictInvalidFileType)},b.prototype.addFile=function(a){return a.upload={progress:0,total:a.size,bytesSent:0},this.files.push(a),a.status=b.ADDED,this.emit("addedfile",a),this._enqueueThumbnail(a),this.accept(a,function(b){return function(c){return c?(a.accepted=!1,b._errorProcessing([a],c)):(a.accepted=!0,b.options.autoQueue&&b.enqueueFile(a)),b._updateMaxFilesReachedClass()}}(this))},b.prototype.enqueueFiles=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)b=a[c],this.enqueueFile(b);return null},b.prototype.enqueueFile=function(a){if(a.status!==b.ADDED||a.accepted!==!0)throw new Error("This file can't be queued because it has already been processed or was rejected.");return a.status=b.QUEUED,this.options.autoProcessQueue?setTimeout(function(a){return function(){return a.processQueue()}}(this),0):void 0},b.prototype._thumbnailQueue=[],b.prototype._processingThumbnail=!1,b.prototype._enqueueThumbnail=function(a){return this.options.createImageThumbnails&&a.type.match(/image.*/)&&a.size<=1024*this.options.maxThumbnailFilesize*1024?(this._thumbnailQueue.push(a),setTimeout(function(a){return function(){return a._processThumbnailQueue()}}(this),0)):void 0},b.prototype._processThumbnailQueue=function(){return this._processingThumbnail||0===this._thumbnailQueue.length?void 0:(this._processingThumbnail=!0,this.createThumbnail(this._thumbnailQueue.shift(),function(a){return function(){return a._processingThumbnail=!1,a._processThumbnailQueue()}}(this)))},b.prototype.removeFile=function(a){return a.status===b.UPLOADING&&this.cancelUpload(a),this.files=j(this.files,a),this.emit("removedfile",a),0===this.files.length?this.emit("reset"):void 0},b.prototype.removeAllFiles=function(a){var c,d,e,f;for(null==a&&(a=!1),f=this.files.slice(),d=0,e=f.length;e>d;d++)c=f[d],(c.status!==b.UPLOADING||a)&&this.removeFile(c);return null},b.prototype.createThumbnail=function(a,b){var c;return c=new FileReader,c.onload=function(d){return function(){return"image/svg+xml"===a.type?(d.emit("thumbnail",a,c.result),void(null!=b&&b())):d.createThumbnailFromUrl(a,c.result,b)}}(this),c.readAsDataURL(a)},b.prototype.createThumbnailFromUrl=function(a,b,c,d){var e;return e=document.createElement("img"),d&&(e.crossOrigin=d),e.onload=function(b){return function(){var d,f,g,i,j,k,l,m;return a.width=e.width,a.height=e.height,g=b.options.resize.call(b,a),null==g.trgWidth&&(g.trgWidth=g.optWidth),null==g.trgHeight&&(g.trgHeight=g.optHeight),d=document.createElement("canvas"),f=d.getContext("2d"),d.width=g.trgWidth,d.height=g.trgHeight,h(f,e,null!=(j=g.srcX)?j:0,null!=(k=g.srcY)?k:0,g.srcWidth,g.srcHeight,null!=(l=g.trgX)?l:0,null!=(m=g.trgY)?m:0,g.trgWidth,g.trgHeight),i=d.toDataURL("image/png"),b.emit("thumbnail",a,i),null!=c?c():void 0}}(this),null!=c&&(e.onerror=c),e.src=b},b.prototype.processQueue=function(){var a,b,c,d;if(b=this.options.parallelUploads,c=this.getUploadingFiles().length,a=c,!(c>=b)&&(d=this.getQueuedFiles(),d.length>0)){if(this.options.uploadMultiple)return this.processFiles(d.slice(0,b-c));for(;b>a;){if(!d.length)return;this.processFile(d.shift()),a++}}},b.prototype.processFile=function(a){return this.processFiles([a])},b.prototype.processFiles=function(a){var c,d,e;for(d=0,e=a.length;e>d;d++)c=a[d],c.processing=!0,c.status=b.UPLOADING,this.emit("processing",c);return this.options.uploadMultiple&&this.emit("processingmultiple",a),this.uploadFiles(a)},b.prototype._getFilesWithXhr=function(a){var b,c;return c=function(){var c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.xhr===a&&f.push(b);return f}.call(this)},b.prototype.cancelUpload=function(a){var c,d,e,f,g,h,i;if(a.status===b.UPLOADING){for(d=this._getFilesWithXhr(a.xhr),e=0,g=d.length;g>e;e++)c=d[e],c.status=b.CANCELED;for(a.xhr.abort(),f=0,h=d.length;h>f;f++)c=d[f],this.emit("canceled",c);this.options.uploadMultiple&&this.emit("canceledmultiple",d)}else((i=a.status)===b.ADDED||i===b.QUEUED)&&(a.status=b.CANCELED,this.emit("canceled",a),this.options.uploadMultiple&&this.emit("canceledmultiple",[a]));return this.options.autoProcessQueue?this.processQueue():void 0},e=function(){var a,b;return b=arguments[0],a=2<=arguments.length?k.call(arguments,1):[],"function"==typeof b?b.apply(this,a):b},b.prototype.uploadFile=function(a){return this.uploadFiles([a])},b.prototype.uploadFiles=function(a){var d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L;for(w=new XMLHttpRequest,x=0,B=a.length;B>x;x++)d=a[x],d.xhr=w;p=e(this.options.method,a),u=e(this.options.url,a),w.open(p,u,!0),w.withCredentials=!!this.options.withCredentials,s=null,g=function(b){return function(){var c,e,f;for(f=[],c=0,e=a.length;e>c;c++)d=a[c],f.push(b._errorProcessing(a,s||b.options.dictResponseError.replace("{{statusCode}}",w.status),w));return f}}(this),t=function(b){return function(c){var e,f,g,h,i,j,k,l,m;if(null!=c)for(f=100*c.loaded/c.total,g=0,j=a.length;j>g;g++)d=a[g],d.upload={progress:f,total:c.total,bytesSent:c.loaded};else{for(e=!0,f=100,h=0,k=a.length;k>h;h++)d=a[h],(100!==d.upload.progress||d.upload.bytesSent!==d.upload.total)&&(e=!1),d.upload.progress=f,d.upload.bytesSent=d.upload.total;if(e)return}for(m=[],i=0,l=a.length;l>i;i++)d=a[i],m.push(b.emit("uploadprogress",d,f,d.upload.bytesSent));return m}}(this),w.onload=function(c){return function(d){var e;if(a[0].status!==b.CANCELED&&4===w.readyState){if(s=w.responseText,w.getResponseHeader("content-type")&&~w.getResponseHeader("content-type").indexOf("application/json"))try{s=JSON.parse(s)}catch(f){d=f,s="Invalid JSON response from server."}return t(),200<=(e=w.status)&&300>e?c._finished(a,s,d):g()}}}(this),w.onerror=function(){return function(){return a[0].status!==b.CANCELED?g():void 0}}(this),r=null!=(G=w.upload)?G:w,r.onprogress=t,j={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"},this.options.headers&&c(j,this.options.headers);for(h in j)i=j[h],i&&w.setRequestHeader(h,i);if(f=new FormData,this.options.params){H=this.options.params;for(o in H)v=H[o],f.append(o,v)}for(y=0,C=a.length;C>y;y++)d=a[y],this.emit("sending",d,w,f);if(this.options.uploadMultiple&&this.emit("sendingmultiple",a,w,f),"FORM"===this.element.tagName)for(I=this.element.querySelectorAll("input, textarea, select, button"),z=0,D=I.length;D>z;z++)if(l=I[z],m=l.getAttribute("name"),n=l.getAttribute("type"),"SELECT"===l.tagName&&l.hasAttribute("multiple"))for(J=l.options,A=0,E=J.length;E>A;A++)q=J[A],q.selected&&f.append(m,q.value);else(!n||"checkbox"!==(K=n.toLowerCase())&&"radio"!==K||l.checked)&&f.append(m,l.value);for(k=F=0,L=a.length-1;L>=0?L>=F:F>=L;k=L>=0?++F:--F)f.append(this._getParamName(k),a[k],a[k].name);return this.submitRequest(w,f,a)},b.prototype.submitRequest=function(a,b){return a.send(b)},b.prototype._finished=function(a,c,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=b.SUCCESS,this.emit("success",e,c,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("successmultiple",a,c,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},b.prototype._errorProcessing=function(a,c,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=b.ERROR,this.emit("error",e,c,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("errormultiple",a,c,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},b}(d),c.version="4.2.0",c.options={},c.optionsForElement=function(a){return a.getAttribute("id")?c.options[e(a.getAttribute("id"))]:void 0},c.instances=[],c.forElement=function(a){if("string"==typeof a&&(a=document.querySelector(a)),null==(null!=a?a.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return a.dropzone},c.autoDiscover=!0,c.discover=function(){var a,b,d,e,f,g;for(document.querySelectorAll?d=document.querySelectorAll(".dropzone"):(d=[],a=function(a){var b,c,e,f;for(f=[],c=0,e=a.length;e>c;c++)b=a[c],f.push(/(^| )dropzone($| )/.test(b.className)?d.push(b):void 0);return f},a(document.getElementsByTagName("div")),a(document.getElementsByTagName("form"))),g=[],e=0,f=d.length;f>e;e++)b=d[e],g.push(c.optionsForElement(b)!==!1?new c(b):void 0);return g},c.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i],c.isBrowserSupported=function(){var a,b,d,e,f;if(a=!0,window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(f=c.blacklistedBrowsers,d=0,e=f.length;e>d;d++)b=f[d],b.test(navigator.userAgent)&&(a=!1);else a=!1;else a=!1;return a},j=function(a,b){var c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],c!==b&&f.push(c);return f},e=function(a){return a.replace(/[\-_](\w)/g,function(a){return a.charAt(1).toUpperCase()})},c.createElement=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.childNodes[0]},c.elementInside=function(a,b){if(a===b)return!0;for(;a=a.parentNode;)if(a===b)return!0;return!1},c.getElement=function(a,b){var c;if("string"==typeof a?c=document.querySelector(a):null!=a.nodeType&&(c=a),null==c)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector or a plain HTML element.");return c},c.getElements=function(a,b){var c,d,e,f,g,h,i,j;if(a instanceof Array){e=[];try{for(f=0,h=a.length;h>f;f++)d=a[f],e.push(this.getElement(d,b))}catch(k){c=k,e=null}}else if("string"==typeof a)for(e=[],j=document.querySelectorAll(a),g=0,i=j.length;i>g;g++)d=j[g],e.push(d);else null!=a.nodeType&&(e=[a]);if(null==e||!e.length)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return e},c.confirm=function(a,b,c){return window.confirm(a)?b():null!=c?c():void 0},c.isValidFile=function(a,b){var c,d,e,f,g;if(!b)return!0;for(b=b.split(","),d=a.type,c=d.replace(/\/.*$/,""),f=0,g=b.length;g>f;f++)if(e=b[f],e=e.trim(),"."===e.charAt(0)){if(-1!==a.name.toLowerCase().indexOf(e.toLowerCase(),a.name.length-e.length))return!0}else if(/\/\*$/.test(e)){if(c===e.replace(/\/.*$/,""))return!0}else if(d===e)return!0;return!1},"undefined"!=typeof a&&null!==a&&(a.fn.dropzone=function(a){return this.each(function(){return new c(this,a) 2 | })}),"undefined"!=typeof b&&null!==b?b.exports=c:window.Dropzone=c,c.ADDED="added",c.QUEUED="queued",c.ACCEPTED=c.QUEUED,c.UPLOADING="uploading",c.PROCESSING=c.UPLOADING,c.CANCELED="canceled",c.ERROR="error",c.SUCCESS="success",g=function(a){var b,c,d,e,f,g,h,i,j,k;for(h=a.naturalWidth,g=a.naturalHeight,c=document.createElement("canvas"),c.width=1,c.height=g,d=c.getContext("2d"),d.drawImage(a,0,0),e=d.getImageData(0,0,1,g).data,k=0,f=g,i=g;i>k;)b=e[4*(i-1)+3],0===b?f=i:k=i,i=f+k>>1;return j=i/g,0===j?1:j},h=function(a,b,c,d,e,f,h,i,j,k){var l;return l=g(b),a.drawImage(b,c,d,e,f,h,i,j,k/l)},f=function(a,b){var c,d,e,f,g,h,i,j,k;if(e=!1,k=!0,d=a.document,j=d.documentElement,c=d.addEventListener?"addEventListener":"attachEvent",i=d.addEventListener?"removeEventListener":"detachEvent",h=d.addEventListener?"":"on",f=function(c){return"readystatechange"!==c.type||"complete"===d.readyState?(("load"===c.type?a:d)[i](h+c.type,f,!1),!e&&(e=!0)?b.call(a,c.type||c):void 0):void 0},g=function(){var a;try{j.doScroll("left")}catch(b){return a=b,void setTimeout(g,50)}return f("poll")},"complete"!==d.readyState){if(d.createEventObject&&j.doScroll){try{k=!a.frameElement}catch(l){}k&&g()}return d[c](h+"DOMContentLoaded",f,!1),d[c](h+"readystatechange",f,!1),a[c](h+"load",f,!1)}},c._autoDiscoverFunction=function(){return c.autoDiscover?c.discover():void 0},f(window,c._autoDiscoverFunction)}.call(this),b.exports}); -------------------------------------------------------------------------------- /bower_components/dropzone/dist/min/dropzone.min.css: -------------------------------------------------------------------------------- 1 | @-webkit-keyframes passing-through{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%, 70%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}100%{opacity:0;-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px);transform:translateY(-40px)}}@-moz-keyframes passing-through{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%, 70%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}100%{opacity:0;-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px);transform:translateY(-40px)}}@keyframes passing-through{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%, 70%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}100%{opacity:0;-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);-ms-transform:translateY(-40px);-o-transform:translateY(-40px);transform:translateY(-40px)}}@-webkit-keyframes slide-in{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}}@-moz-keyframes slide-in{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}}@keyframes slide-in{0%{opacity:0;-webkit-transform:translateY(40px);-moz-transform:translateY(40px);-ms-transform:translateY(40px);-o-transform:translateY(40px);transform:translateY(40px)}30%{opacity:1;-webkit-transform:translateY(0px);-moz-transform:translateY(0px);-ms-transform:translateY(0px);-o-transform:translateY(0px);transform:translateY(0px)}}@-webkit-keyframes pulse{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}10%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}20%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}@-moz-keyframes pulse{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}10%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}20%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}@keyframes pulse{0%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}10%{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1)}20%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}.dropzone,.dropzone *{box-sizing:border-box}.dropzone{min-height:150px;border:2px solid rgba(0,0,0,0.3);background:white;padding:20px 20px}.dropzone.dz-clickable{cursor:pointer}.dropzone.dz-clickable *{cursor:default}.dropzone.dz-clickable .dz-message,.dropzone.dz-clickable .dz-message *{cursor:pointer}.dropzone.dz-started .dz-message{display:none}.dropzone.dz-drag-hover{border-style:solid}.dropzone.dz-drag-hover .dz-message{opacity:0.5}.dropzone .dz-message{text-align:center;margin:2em 0}.dropzone .dz-preview{position:relative;display:inline-block;vertical-align:top;margin:16px;min-height:100px}.dropzone .dz-preview:hover{z-index:1000}.dropzone .dz-preview:hover .dz-details{opacity:1}.dropzone .dz-preview.dz-file-preview .dz-image{border-radius:20px;background:#999;background:linear-gradient(to bottom, #eee, #ddd)}.dropzone .dz-preview.dz-file-preview .dz-details{opacity:1}.dropzone .dz-preview.dz-image-preview{background:white}.dropzone .dz-preview.dz-image-preview .dz-details{-webkit-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;-ms-transition:opacity 0.2s linear;-o-transition:opacity 0.2s linear;transition:opacity 0.2s linear}.dropzone .dz-preview .dz-remove{font-size:14px;text-align:center;display:block;cursor:pointer;border:none}.dropzone .dz-preview .dz-remove:hover{text-decoration:underline}.dropzone .dz-preview:hover .dz-details{opacity:1}.dropzone .dz-preview .dz-details{z-index:20;position:absolute;top:0;left:0;opacity:0;font-size:13px;min-width:100%;max-width:100%;padding:2em 1em;text-align:center;color:rgba(0,0,0,0.9);line-height:150%}.dropzone .dz-preview .dz-details .dz-size{margin-bottom:1em;font-size:16px}.dropzone .dz-preview .dz-details .dz-filename{white-space:nowrap}.dropzone .dz-preview .dz-details .dz-filename:hover span{border:1px solid rgba(200,200,200,0.8);background-color:rgba(255,255,255,0.8)}.dropzone .dz-preview .dz-details .dz-filename:not(:hover){overflow:hidden;text-overflow:ellipsis}.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span{border:1px solid transparent}.dropzone .dz-preview .dz-details .dz-filename span,.dropzone .dz-preview .dz-details .dz-size span{background-color:rgba(255,255,255,0.4);padding:0 0.4em;border-radius:3px}.dropzone .dz-preview:hover .dz-image img{-webkit-transform:scale(1.05, 1.05);-moz-transform:scale(1.05, 1.05);-ms-transform:scale(1.05, 1.05);-o-transform:scale(1.05, 1.05);transform:scale(1.05, 1.05);-webkit-filter:blur(8px);filter:blur(8px)}.dropzone .dz-preview .dz-image{border-radius:20px;overflow:hidden;width:120px;height:120px;position:relative;display:block;z-index:10}.dropzone .dz-preview .dz-image img{display:block}.dropzone .dz-preview.dz-success .dz-success-mark{-webkit-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);-moz-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);-ms-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);-o-animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);animation:passing-through 3s cubic-bezier(0.77, 0, 0.175, 1)}.dropzone .dz-preview.dz-error .dz-error-mark{opacity:1;-webkit-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);-moz-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);-ms-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);-o-animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);animation:slide-in 3s cubic-bezier(0.77, 0, 0.175, 1)}.dropzone .dz-preview .dz-success-mark,.dropzone .dz-preview .dz-error-mark{pointer-events:none;opacity:0;z-index:500;position:absolute;display:block;top:50%;left:50%;margin-left:-27px;margin-top:-27px}.dropzone .dz-preview .dz-success-mark svg,.dropzone .dz-preview .dz-error-mark svg{display:block;width:54px;height:54px}.dropzone .dz-preview.dz-processing .dz-progress{opacity:1;-webkit-transition:all 0.2s linear;-moz-transition:all 0.2s linear;-ms-transition:all 0.2s linear;-o-transition:all 0.2s linear;transition:all 0.2s linear}.dropzone .dz-preview.dz-complete .dz-progress{opacity:0;-webkit-transition:opacity 0.4s ease-in;-moz-transition:opacity 0.4s ease-in;-ms-transition:opacity 0.4s ease-in;-o-transition:opacity 0.4s ease-in;transition:opacity 0.4s ease-in}.dropzone .dz-preview:not(.dz-processing) .dz-progress{-webkit-animation:pulse 6s ease infinite;-moz-animation:pulse 6s ease infinite;-ms-animation:pulse 6s ease infinite;-o-animation:pulse 6s ease infinite;animation:pulse 6s ease infinite}.dropzone .dz-preview .dz-progress{opacity:1;z-index:1000;pointer-events:none;position:absolute;height:16px;left:50%;top:50%;margin-top:-8px;width:80px;margin-left:-40px;background:rgba(255,255,255,0.9);-webkit-transform:scale(1);border-radius:8px;overflow:hidden}.dropzone .dz-preview .dz-progress .dz-upload{background:#333;background:linear-gradient(to bottom, #666, #444);position:absolute;top:0;left:0;bottom:0;width:0;-webkit-transition:width 300ms ease-in-out;-moz-transition:width 300ms ease-in-out;-ms-transition:width 300ms ease-in-out;-o-transition:width 300ms ease-in-out;transition:width 300ms ease-in-out}.dropzone .dz-preview.dz-error .dz-error-message{display:block}.dropzone .dz-preview.dz-error:hover .dz-error-message{opacity:1;pointer-events:auto}.dropzone .dz-preview .dz-error-message{pointer-events:none;z-index:1000;position:absolute;display:block;display:none;opacity:0;-webkit-transition:opacity 0.3s ease;-moz-transition:opacity 0.3s ease;-ms-transition:opacity 0.3s ease;-o-transition:opacity 0.3s ease;transition:opacity 0.3s ease;border-radius:8px;font-size:13px;top:130px;left:-10px;width:140px;background:#be2626;background:linear-gradient(to bottom, #be2626, #a92222);padding:0.5em 1.2em;color:white}.dropzone .dz-preview .dz-error-message:after{content:'';position:absolute;top:-6px;left:64px;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #be2626} 2 | -------------------------------------------------------------------------------- /bower_components/dropzone/dist/min/dropzone.min.js: -------------------------------------------------------------------------------- 1 | (function(){var a,b,c,d,e,f,g,h,i=[].slice,j={}.hasOwnProperty,k=function(a,b){function c(){this.constructor=a}for(var d in b)j.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};g=function(){},b=function(){function a(){}return a.prototype.addEventListener=a.prototype.on,a.prototype.on=function(a,b){return this._callbacks=this._callbacks||{},this._callbacks[a]||(this._callbacks[a]=[]),this._callbacks[a].push(b),this},a.prototype.emit=function(){var a,b,c,d,e,f;if(d=arguments[0],a=2<=arguments.length?i.call(arguments,1):[],this._callbacks=this._callbacks||{},c=this._callbacks[d])for(e=0,f=c.length;f>e;e++)b=c[e],b.apply(this,a);return this},a.prototype.removeListener=a.prototype.off,a.prototype.removeAllListeners=a.prototype.off,a.prototype.removeEventListener=a.prototype.off,a.prototype.off=function(a,b){var c,d,e,f,g;if(!this._callbacks||0===arguments.length)return this._callbacks={},this;if(d=this._callbacks[a],!d)return this;if(1===arguments.length)return delete this._callbacks[a],this;for(e=f=0,g=d.length;g>f;e=++f)if(c=d[e],c===b){d.splice(e,1);break}return this},a}(),a=function(a){function c(a,b){var e,f,g;if(this.element=a,this.version=c.version,this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,""),this.clickableElements=[],this.listeners=[],this.files=[],"string"==typeof this.element&&(this.element=document.querySelector(this.element)),!this.element||null==this.element.nodeType)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");if(c.instances.push(this),this.element.dropzone=this,e=null!=(g=c.optionsForElement(this.element))?g:{},this.options=d({},this.defaultOptions,e,null!=b?b:{}),this.options.forceFallback||!c.isBrowserSupported())return this.options.fallback.call(this);if(null==this.options.url&&(this.options.url=this.element.getAttribute("action")),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");this.options.acceptedMimeTypes&&(this.options.acceptedFiles=this.options.acceptedMimeTypes,delete this.options.acceptedMimeTypes),this.options.method=this.options.method.toUpperCase(),(f=this.getExistingFallback())&&f.parentNode&&f.parentNode.removeChild(f),this.options.previewsContainer!==!1&&(this.previewsContainer=this.options.previewsContainer?c.getElement(this.options.previewsContainer,"previewsContainer"):this.element),this.options.clickable&&(this.clickableElements=this.options.clickable===!0?[this.element]:c.getElements(this.options.clickable,"clickable")),this.init()}var d,e;return k(c,a),c.prototype.Emitter=b,c.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],c.prototype.defaultOptions={url:null,method:"post",withCredentials:!1,parallelUploads:2,uploadMultiple:!1,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,filesizeBase:1e3,maxFiles:null,params:{},clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,hiddenInputContainer:"body",capture:null,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",accept:function(a,b){return b()},init:function(){return g},forceFallback:!1,fallback:function(){var a,b,d,e,f,g;for(this.element.className=""+this.element.className+" dz-browser-not-supported",g=this.element.getElementsByTagName("div"),e=0,f=g.length;f>e;e++)a=g[e],/(^| )dz-message($| )/.test(a.className)&&(b=a,a.className="dz-message");return b||(b=c.createElement('
'),this.element.appendChild(b)),d=b.getElementsByTagName("span")[0],d&&(null!=d.textContent?d.textContent=this.options.dictFallbackMessage:null!=d.innerText&&(d.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(a){var b,c,d;return b={srcX:0,srcY:0,srcWidth:a.width,srcHeight:a.height},c=a.width/a.height,b.optWidth=this.options.thumbnailWidth,b.optHeight=this.options.thumbnailHeight,null==b.optWidth&&null==b.optHeight?(b.optWidth=b.srcWidth,b.optHeight=b.srcHeight):null==b.optWidth?b.optWidth=c*b.optHeight:null==b.optHeight&&(b.optHeight=1/c*b.optWidth),d=b.optWidth/b.optHeight,a.heightd?(b.srcHeight=a.height,b.srcWidth=b.srcHeight*d):(b.srcWidth=a.width,b.srcHeight=b.srcWidth/d),b.srcX=(a.width-b.srcWidth)/2,b.srcY=(a.height-b.srcHeight)/2,b},drop:function(){return this.element.classList.remove("dz-drag-hover")},dragstart:g,dragend:function(){return this.element.classList.remove("dz-drag-hover")},dragenter:function(){return this.element.classList.add("dz-drag-hover")},dragover:function(){return this.element.classList.add("dz-drag-hover")},dragleave:function(){return this.element.classList.remove("dz-drag-hover")},paste:g,reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(a){var b,d,e,f,g,h,i,j,k,l,m,n,o;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){for(a.previewElement=c.createElement(this.options.previewTemplate.trim()),a.previewTemplate=a.previewElement,this.previewsContainer.appendChild(a.previewElement),l=a.previewElement.querySelectorAll("[data-dz-name]"),f=0,i=l.length;i>f;f++)b=l[f],b.textContent=a.name;for(m=a.previewElement.querySelectorAll("[data-dz-size]"),g=0,j=m.length;j>g;g++)b=m[g],b.innerHTML=this.filesize(a.size);for(this.options.addRemoveLinks&&(a._removeLink=c.createElement(''+this.options.dictRemoveFile+""),a.previewElement.appendChild(a._removeLink)),d=function(b){return function(d){return d.preventDefault(),d.stopPropagation(),a.status===c.UPLOADING?c.confirm(b.options.dictCancelUploadConfirmation,function(){return b.removeFile(a)}):b.options.dictRemoveFileConfirmation?c.confirm(b.options.dictRemoveFileConfirmation,function(){return b.removeFile(a)}):b.removeFile(a)}}(this),n=a.previewElement.querySelectorAll("[data-dz-remove]"),o=[],h=0,k=n.length;k>h;h++)e=n[h],o.push(e.addEventListener("click",d));return o}},removedfile:function(a){var b;return a.previewElement&&null!=(b=a.previewElement)&&b.parentNode.removeChild(a.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(a,b){var c,d,e,f;if(a.previewElement){for(a.previewElement.classList.remove("dz-file-preview"),f=a.previewElement.querySelectorAll("[data-dz-thumbnail]"),d=0,e=f.length;e>d;d++)c=f[d],c.alt=a.name,c.src=b;return setTimeout(function(){return function(){return a.previewElement.classList.add("dz-image-preview")}}(this),1)}},error:function(a,b){var c,d,e,f,g;if(a.previewElement){for(a.previewElement.classList.add("dz-error"),"String"!=typeof b&&b.error&&(b=b.error),f=a.previewElement.querySelectorAll("[data-dz-errormessage]"),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.textContent=b);return g}},errormultiple:g,processing:function(a){return a.previewElement&&(a.previewElement.classList.add("dz-processing"),a._removeLink)?a._removeLink.textContent=this.options.dictCancelUpload:void 0},processingmultiple:g,uploadprogress:function(a,b){var c,d,e,f,g;if(a.previewElement){for(f=a.previewElement.querySelectorAll("[data-dz-uploadprogress]"),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push("PROGRESS"===c.nodeName?c.value=b:c.style.width=""+b+"%");return g}},totaluploadprogress:g,sending:g,sendingmultiple:g,success:function(a){return a.previewElement?a.previewElement.classList.add("dz-success"):void 0},successmultiple:g,canceled:function(a){return this.emit("error",a,"Upload canceled.")},canceledmultiple:g,complete:function(a){return a._removeLink&&(a._removeLink.textContent=this.options.dictRemoveFile),a.previewElement?a.previewElement.classList.add("dz-complete"):void 0},completemultiple:g,maxfilesexceeded:g,maxfilesreached:g,queuecomplete:g,addedfiles:g,previewTemplate:'
\n
\n
\n
\n
\n
\n
\n
\n
\n \n Check\n \n \n \n \n \n
\n
\n \n Error\n \n \n \n \n \n \n \n
\n
'},d=function(){var a,b,c,d,e,f,g;for(d=arguments[0],c=2<=arguments.length?i.call(arguments,1):[],f=0,g=c.length;g>f;f++){b=c[f];for(a in b)e=b[a],d[a]=e}return d},c.prototype.getAcceptedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted&&e.push(a);return e},c.prototype.getRejectedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted||e.push(a);return e},c.prototype.getFilesWithStatus=function(a){var b,c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.status===a&&f.push(b);return f},c.prototype.getQueuedFiles=function(){return this.getFilesWithStatus(c.QUEUED)},c.prototype.getUploadingFiles=function(){return this.getFilesWithStatus(c.UPLOADING)},c.prototype.getAddedFiles=function(){return this.getFilesWithStatus(c.ADDED)},c.prototype.getActiveFiles=function(){var a,b,d,e,f;for(e=this.files,f=[],b=0,d=e.length;d>b;b++)a=e[b],(a.status===c.UPLOADING||a.status===c.QUEUED)&&f.push(a);return f},c.prototype.init=function(){var a,b,d,e,f,g,h;for("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(c.createElement('
'+this.options.dictDefaultMessage+"
")),this.clickableElements.length&&(d=function(a){return function(){return a.hiddenFileInput&&a.hiddenFileInput.parentNode.removeChild(a.hiddenFileInput),a.hiddenFileInput=document.createElement("input"),a.hiddenFileInput.setAttribute("type","file"),(null==a.options.maxFiles||a.options.maxFiles>1)&&a.hiddenFileInput.setAttribute("multiple","multiple"),a.hiddenFileInput.className="dz-hidden-input",null!=a.options.acceptedFiles&&a.hiddenFileInput.setAttribute("accept",a.options.acceptedFiles),null!=a.options.capture&&a.hiddenFileInput.setAttribute("capture",a.options.capture),a.hiddenFileInput.style.visibility="hidden",a.hiddenFileInput.style.position="absolute",a.hiddenFileInput.style.top="0",a.hiddenFileInput.style.left="0",a.hiddenFileInput.style.height="0",a.hiddenFileInput.style.width="0",document.querySelector(a.options.hiddenInputContainer).appendChild(a.hiddenFileInput),a.hiddenFileInput.addEventListener("change",function(){var b,c,e,f;if(c=a.hiddenFileInput.files,c.length)for(e=0,f=c.length;f>e;e++)b=c[e],a.addFile(b);return a.emit("addedfiles",c),d()})}}(this))(),this.URL=null!=(g=window.URL)?g:window.webkitURL,h=this.events,e=0,f=h.length;f>e;e++)a=h[e],this.on(a,this.options[a]);return this.on("uploadprogress",function(a){return function(){return a.updateTotalUploadProgress()}}(this)),this.on("removedfile",function(a){return function(){return a.updateTotalUploadProgress()}}(this)),this.on("canceled",function(a){return function(b){return a.emit("complete",b)}}(this)),this.on("complete",function(a){return function(){return 0===a.getAddedFiles().length&&0===a.getUploadingFiles().length&&0===a.getQueuedFiles().length?setTimeout(function(){return a.emit("queuecomplete")},0):void 0}}(this)),b=function(a){return a.stopPropagation(),a.preventDefault?a.preventDefault():a.returnValue=!1},this.listeners=[{element:this.element,events:{dragstart:function(a){return function(b){return a.emit("dragstart",b)}}(this),dragenter:function(a){return function(c){return b(c),a.emit("dragenter",c)}}(this),dragover:function(a){return function(c){var d;try{d=c.dataTransfer.effectAllowed}catch(e){}return c.dataTransfer.dropEffect="move"===d||"linkMove"===d?"move":"copy",b(c),a.emit("dragover",c)}}(this),dragleave:function(a){return function(b){return a.emit("dragleave",b)}}(this),drop:function(a){return function(c){return b(c),a.drop(c)}}(this),dragend:function(a){return function(b){return a.emit("dragend",b)}}(this)}}],this.clickableElements.forEach(function(a){return function(b){return a.listeners.push({element:b,events:{click:function(d){return(b!==a.element||d.target===a.element||c.elementInside(d.target,a.element.querySelector(".dz-message")))&&a.hiddenFileInput.click(),!0}}})}}(this)),this.enable(),this.options.init.call(this)},c.prototype.destroy=function(){var a;return this.disable(),this.removeAllFiles(!0),(null!=(a=this.hiddenFileInput)?a.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,c.instances.splice(c.instances.indexOf(this),1)},c.prototype.updateTotalUploadProgress=function(){var a,b,c,d,e,f,g,h;if(d=0,c=0,a=this.getActiveFiles(),a.length){for(h=this.getActiveFiles(),f=0,g=h.length;g>f;f++)b=h[f],d+=b.upload.bytesSent,c+=b.upload.total;e=100*d/c}else e=100;return this.emit("totaluploadprogress",e,c,d)},c.prototype._getParamName=function(a){return"function"==typeof this.options.paramName?this.options.paramName(a):""+this.options.paramName+(this.options.uploadMultiple?"["+a+"]":"")},c.prototype.getFallbackForm=function(){var a,b,d,e;return(a=this.getExistingFallback())?a:(d='
',this.options.dictFallbackText&&(d+="

"+this.options.dictFallbackText+"

"),d+='
',b=c.createElement(d),"FORM"!==this.element.tagName?(e=c.createElement('
'),e.appendChild(b)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=e?e:b)},c.prototype.getExistingFallback=function(){var a,b,c,d,e,f;for(b=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c],/(^| )fallback($| )/.test(b.className))return b},f=["div","form"],d=0,e=f.length;e>d;d++)if(c=f[d],a=b(this.element.getElementsByTagName(c)))return a},c.prototype.setupEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.addEventListener(b,c,!1));return e}());return g},c.prototype.removeEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.removeEventListener(b,c,!1));return e}());return g},c.prototype.disable=function(){var a,b,c,d,e;for(this.clickableElements.forEach(function(a){return a.classList.remove("dz-clickable")}),this.removeEventListeners(),d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(this.cancelUpload(a));return e},c.prototype.enable=function(){return this.clickableElements.forEach(function(a){return a.classList.add("dz-clickable")}),this.setupEventListeners()},c.prototype.filesize=function(a){var b,c,d,e,f,g,h,i;if(d=0,e="b",a>0){for(g=["TB","GB","MB","KB","b"],c=h=0,i=g.length;i>h;c=++h)if(f=g[c],b=Math.pow(this.options.filesizeBase,4-c)/10,a>=b){d=a/Math.pow(this.options.filesizeBase,4-c),e=f;break}d=Math.round(10*d)/10}return""+d+" "+e},c.prototype._updateMaxFilesReachedClass=function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")},c.prototype.drop=function(a){var b,c;a.dataTransfer&&(this.emit("drop",a),b=a.dataTransfer.files,this.emit("addedfiles",b),b.length&&(c=a.dataTransfer.items,c&&c.length&&null!=c[0].webkitGetAsEntry?this._addFilesFromItems(c):this.handleFiles(b)))},c.prototype.paste=function(a){var b,c;if(null!=(null!=a&&null!=(c=a.clipboardData)?c.items:void 0))return this.emit("paste",a),b=a.clipboardData.items,b.length?this._addFilesFromItems(b):void 0},c.prototype.handleFiles=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addFile(b));return e},c.prototype._addFilesFromItems=function(a){var b,c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(null!=c.webkitGetAsEntry&&(b=c.webkitGetAsEntry())?b.isFile?this.addFile(c.getAsFile()):b.isDirectory?this._addFilesFromDirectory(b,b.name):void 0:null!=c.getAsFile?null==c.kind||"file"===c.kind?this.addFile(c.getAsFile()):void 0:void 0);return f},c.prototype._addFilesFromDirectory=function(a,b){var c,d;return c=a.createReader(),d=function(a){return function(c){var d,e,f;for(e=0,f=c.length;f>e;e++)d=c[e],d.isFile?d.file(function(c){return a.options.ignoreHiddenFiles&&"."===c.name.substring(0,1)?void 0:(c.fullPath=""+b+"/"+c.name,a.addFile(c))}):d.isDirectory&&a._addFilesFromDirectory(d,""+b+"/"+d.name)}}(this),c.readEntries(d,function(a){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log(a):void 0})},c.prototype.accept=function(a,b){return a.size>1024*this.options.maxFilesize*1024?b(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(a.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):c.isValidFile(a,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(b(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",a)):this.options.accept.call(this,a,b):b(this.options.dictInvalidFileType)},c.prototype.addFile=function(a){return a.upload={progress:0,total:a.size,bytesSent:0},this.files.push(a),a.status=c.ADDED,this.emit("addedfile",a),this._enqueueThumbnail(a),this.accept(a,function(b){return function(c){return c?(a.accepted=!1,b._errorProcessing([a],c)):(a.accepted=!0,b.options.autoQueue&&b.enqueueFile(a)),b._updateMaxFilesReachedClass()}}(this))},c.prototype.enqueueFiles=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)b=a[c],this.enqueueFile(b);return null},c.prototype.enqueueFile=function(a){if(a.status!==c.ADDED||a.accepted!==!0)throw new Error("This file can't be queued because it has already been processed or was rejected.");return a.status=c.QUEUED,this.options.autoProcessQueue?setTimeout(function(a){return function(){return a.processQueue()}}(this),0):void 0},c.prototype._thumbnailQueue=[],c.prototype._processingThumbnail=!1,c.prototype._enqueueThumbnail=function(a){return this.options.createImageThumbnails&&a.type.match(/image.*/)&&a.size<=1024*this.options.maxThumbnailFilesize*1024?(this._thumbnailQueue.push(a),setTimeout(function(a){return function(){return a._processThumbnailQueue()}}(this),0)):void 0},c.prototype._processThumbnailQueue=function(){return this._processingThumbnail||0===this._thumbnailQueue.length?void 0:(this._processingThumbnail=!0,this.createThumbnail(this._thumbnailQueue.shift(),function(a){return function(){return a._processingThumbnail=!1,a._processThumbnailQueue()}}(this)))},c.prototype.removeFile=function(a){return a.status===c.UPLOADING&&this.cancelUpload(a),this.files=h(this.files,a),this.emit("removedfile",a),0===this.files.length?this.emit("reset"):void 0},c.prototype.removeAllFiles=function(a){var b,d,e,f;for(null==a&&(a=!1),f=this.files.slice(),d=0,e=f.length;e>d;d++)b=f[d],(b.status!==c.UPLOADING||a)&&this.removeFile(b);return null},c.prototype.createThumbnail=function(a,b){var c;return c=new FileReader,c.onload=function(d){return function(){return"image/svg+xml"===a.type?(d.emit("thumbnail",a,c.result),void(null!=b&&b())):d.createThumbnailFromUrl(a,c.result,b)}}(this),c.readAsDataURL(a)},c.prototype.createThumbnailFromUrl=function(a,b,c,d){var e;return e=document.createElement("img"),d&&(e.crossOrigin=d),e.onload=function(b){return function(){var d,g,h,i,j,k,l,m;return a.width=e.width,a.height=e.height,h=b.options.resize.call(b,a),null==h.trgWidth&&(h.trgWidth=h.optWidth),null==h.trgHeight&&(h.trgHeight=h.optHeight),d=document.createElement("canvas"),g=d.getContext("2d"),d.width=h.trgWidth,d.height=h.trgHeight,f(g,e,null!=(j=h.srcX)?j:0,null!=(k=h.srcY)?k:0,h.srcWidth,h.srcHeight,null!=(l=h.trgX)?l:0,null!=(m=h.trgY)?m:0,h.trgWidth,h.trgHeight),i=d.toDataURL("image/png"),b.emit("thumbnail",a,i),null!=c?c():void 0}}(this),null!=c&&(e.onerror=c),e.src=b},c.prototype.processQueue=function(){var a,b,c,d;if(b=this.options.parallelUploads,c=this.getUploadingFiles().length,a=c,!(c>=b)&&(d=this.getQueuedFiles(),d.length>0)){if(this.options.uploadMultiple)return this.processFiles(d.slice(0,b-c));for(;b>a;){if(!d.length)return;this.processFile(d.shift()),a++}}},c.prototype.processFile=function(a){return this.processFiles([a])},c.prototype.processFiles=function(a){var b,d,e;for(d=0,e=a.length;e>d;d++)b=a[d],b.processing=!0,b.status=c.UPLOADING,this.emit("processing",b);return this.options.uploadMultiple&&this.emit("processingmultiple",a),this.uploadFiles(a)},c.prototype._getFilesWithXhr=function(a){var b,c;return c=function(){var c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.xhr===a&&f.push(b);return f}.call(this)},c.prototype.cancelUpload=function(a){var b,d,e,f,g,h,i;if(a.status===c.UPLOADING){for(d=this._getFilesWithXhr(a.xhr),e=0,g=d.length;g>e;e++)b=d[e],b.status=c.CANCELED;for(a.xhr.abort(),f=0,h=d.length;h>f;f++)b=d[f],this.emit("canceled",b);this.options.uploadMultiple&&this.emit("canceledmultiple",d)}else((i=a.status)===c.ADDED||i===c.QUEUED)&&(a.status=c.CANCELED,this.emit("canceled",a),this.options.uploadMultiple&&this.emit("canceledmultiple",[a]));return this.options.autoProcessQueue?this.processQueue():void 0},e=function(){var a,b;return b=arguments[0],a=2<=arguments.length?i.call(arguments,1):[],"function"==typeof b?b.apply(this,a):b},c.prototype.uploadFile=function(a){return this.uploadFiles([a])},c.prototype.uploadFiles=function(a){var b,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L;for(w=new XMLHttpRequest,x=0,B=a.length;B>x;x++)b=a[x],b.xhr=w;p=e(this.options.method,a),u=e(this.options.url,a),w.open(p,u,!0),w.withCredentials=!!this.options.withCredentials,s=null,g=function(c){return function(){var d,e,f;for(f=[],d=0,e=a.length;e>d;d++)b=a[d],f.push(c._errorProcessing(a,s||c.options.dictResponseError.replace("{{statusCode}}",w.status),w));return f}}(this),t=function(c){return function(d){var e,f,g,h,i,j,k,l,m;if(null!=d)for(f=100*d.loaded/d.total,g=0,j=a.length;j>g;g++)b=a[g],b.upload={progress:f,total:d.total,bytesSent:d.loaded};else{for(e=!0,f=100,h=0,k=a.length;k>h;h++)b=a[h],(100!==b.upload.progress||b.upload.bytesSent!==b.upload.total)&&(e=!1),b.upload.progress=f,b.upload.bytesSent=b.upload.total;if(e)return}for(m=[],i=0,l=a.length;l>i;i++)b=a[i],m.push(c.emit("uploadprogress",b,f,b.upload.bytesSent));return m}}(this),w.onload=function(b){return function(d){var e;if(a[0].status!==c.CANCELED&&4===w.readyState){if(s=w.responseText,w.getResponseHeader("content-type")&&~w.getResponseHeader("content-type").indexOf("application/json"))try{s=JSON.parse(s)}catch(f){d=f,s="Invalid JSON response from server."}return t(),200<=(e=w.status)&&300>e?b._finished(a,s,d):g()}}}(this),w.onerror=function(){return function(){return a[0].status!==c.CANCELED?g():void 0}}(this),r=null!=(G=w.upload)?G:w,r.onprogress=t,j={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"},this.options.headers&&d(j,this.options.headers);for(h in j)i=j[h],i&&w.setRequestHeader(h,i);if(f=new FormData,this.options.params){H=this.options.params;for(o in H)v=H[o],f.append(o,v)}for(y=0,C=a.length;C>y;y++)b=a[y],this.emit("sending",b,w,f);if(this.options.uploadMultiple&&this.emit("sendingmultiple",a,w,f),"FORM"===this.element.tagName)for(I=this.element.querySelectorAll("input, textarea, select, button"),z=0,D=I.length;D>z;z++)if(l=I[z],m=l.getAttribute("name"),n=l.getAttribute("type"),"SELECT"===l.tagName&&l.hasAttribute("multiple"))for(J=l.options,A=0,E=J.length;E>A;A++)q=J[A],q.selected&&f.append(m,q.value);else(!n||"checkbox"!==(K=n.toLowerCase())&&"radio"!==K||l.checked)&&f.append(m,l.value);for(k=F=0,L=a.length-1;L>=0?L>=F:F>=L;k=L>=0?++F:--F)f.append(this._getParamName(k),a[k],a[k].name);return this.submitRequest(w,f,a)},c.prototype.submitRequest=function(a,b){return a.send(b)},c.prototype._finished=function(a,b,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=c.SUCCESS,this.emit("success",e,b,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("successmultiple",a,b,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},c.prototype._errorProcessing=function(a,b,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=c.ERROR,this.emit("error",e,b,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("errormultiple",a,b,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},c}(b),a.version="4.2.0",a.options={},a.optionsForElement=function(b){return b.getAttribute("id")?a.options[c(b.getAttribute("id"))]:void 0},a.instances=[],a.forElement=function(a){if("string"==typeof a&&(a=document.querySelector(a)),null==(null!=a?a.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return a.dropzone},a.autoDiscover=!0,a.discover=function(){var b,c,d,e,f,g;for(document.querySelectorAll?d=document.querySelectorAll(".dropzone"):(d=[],b=function(a){var b,c,e,f;for(f=[],c=0,e=a.length;e>c;c++)b=a[c],f.push(/(^| )dropzone($| )/.test(b.className)?d.push(b):void 0);return f},b(document.getElementsByTagName("div")),b(document.getElementsByTagName("form"))),g=[],e=0,f=d.length;f>e;e++)c=d[e],g.push(a.optionsForElement(c)!==!1?new a(c):void 0);return g},a.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i],a.isBrowserSupported=function(){var b,c,d,e,f;if(b=!0,window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(f=a.blacklistedBrowsers,d=0,e=f.length;e>d;d++)c=f[d],c.test(navigator.userAgent)&&(b=!1);else b=!1;else b=!1;return b},h=function(a,b){var c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],c!==b&&f.push(c);return f},c=function(a){return a.replace(/[\-_](\w)/g,function(a){return a.charAt(1).toUpperCase()})},a.createElement=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.childNodes[0]},a.elementInside=function(a,b){if(a===b)return!0;for(;a=a.parentNode;)if(a===b)return!0;return!1},a.getElement=function(a,b){var c;if("string"==typeof a?c=document.querySelector(a):null!=a.nodeType&&(c=a),null==c)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector or a plain HTML element.");return c},a.getElements=function(a,b){var c,d,e,f,g,h,i,j;if(a instanceof Array){e=[];try{for(f=0,h=a.length;h>f;f++)d=a[f],e.push(this.getElement(d,b))}catch(k){c=k,e=null}}else if("string"==typeof a)for(e=[],j=document.querySelectorAll(a),g=0,i=j.length;i>g;g++)d=j[g],e.push(d);else null!=a.nodeType&&(e=[a]);if(null==e||!e.length)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return e},a.confirm=function(a,b,c){return window.confirm(a)?b():null!=c?c():void 0},a.isValidFile=function(a,b){var c,d,e,f,g;if(!b)return!0;for(b=b.split(","),d=a.type,c=d.replace(/\/.*$/,""),f=0,g=b.length;g>f;f++)if(e=b[f],e=e.trim(),"."===e.charAt(0)){if(-1!==a.name.toLowerCase().indexOf(e.toLowerCase(),a.name.length-e.length))return!0}else if(/\/\*$/.test(e)){if(c===e.replace(/\/.*$/,""))return!0}else if(d===e)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(b){return this.each(function(){return new a(this,b)})}),"undefined"!=typeof module&&null!==module?module.exports=a:window.Dropzone=a,a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success",e=function(a){var b,c,d,e,f,g,h,i,j,k; 2 | for(h=a.naturalWidth,g=a.naturalHeight,c=document.createElement("canvas"),c.width=1,c.height=g,d=c.getContext("2d"),d.drawImage(a,0,0),e=d.getImageData(0,0,1,g).data,k=0,f=g,i=g;i>k;)b=e[4*(i-1)+3],0===b?f=i:k=i,i=f+k>>1;return j=i/g,0===j?1:j},f=function(a,b,c,d,f,g,h,i,j,k){var l;return l=e(b),a.drawImage(b,c,d,f,g,h,i,j,k/l)},d=function(a,b){var c,d,e,f,g,h,i,j,k;if(e=!1,k=!0,d=a.document,j=d.documentElement,c=d.addEventListener?"addEventListener":"attachEvent",i=d.addEventListener?"removeEventListener":"detachEvent",h=d.addEventListener?"":"on",f=function(c){return"readystatechange"!==c.type||"complete"===d.readyState?(("load"===c.type?a:d)[i](h+c.type,f,!1),!e&&(e=!0)?b.call(a,c.type||c):void 0):void 0},g=function(){var a;try{j.doScroll("left")}catch(b){return a=b,void setTimeout(g,50)}return f("poll")},"complete"!==d.readyState){if(d.createEventObject&&j.doScroll){try{k=!a.frameElement}catch(l){}k&&g()}return d[c](h+"DOMContentLoaded",f,!1),d[c](h+"readystatechange",f,!1),a[c](h+"load",f,!1)}},a._autoDiscoverFunction=function(){return a.autoDiscover?a.discover():void 0},d(window,a._autoDiscoverFunction)}).call(this); -------------------------------------------------------------------------------- /bower_components/dropzone/dist/readme.md: -------------------------------------------------------------------------------- 1 | # Warning! 2 | 3 | You shouldn't pull these files from the github master branch directly! 4 | 5 | They might be outdated or not working at all since I normally only push them 6 | when I create a version release. 7 | 8 | To be sure to get a proper release, please go to the 9 | [dropzone releases section on github](https://github.com/enyo/dropzone/releases/latest). 10 | 11 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "perminder-klair/yii2-dropzone", 3 | "description": "DropzoneJs Extention for Yii2", 4 | "type": "yii2-extension", 5 | "keywords": ["yii2","extension","dropzone","upload"], 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Parminder Klair", 10 | "email": "perminder.klair@gmail.com" 11 | } 12 | ], 13 | "minimum-stability": "dev", 14 | "require": { 15 | "yiisoft/yii2": "2.0.*" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "kato\\": "" 20 | } 21 | } 22 | } 23 | --------------------------------------------------------------------------------