Merge ~corey.bryant/ubuntu/+source/horizon:master into ~ubuntu-openstack-dev/ubuntu/+source/horizon:master

Proposed by Corey Bryant
Status: Merged
Merged at revision: 9c40e211d7515ab9dc6174dca77d631c07d0230d
Proposed branch: ~corey.bryant/ubuntu/+source/horizon:master
Merge into: ~ubuntu-openstack-dev/ubuntu/+source/horizon:master
Diff against target: 23523 lines (+13652/-4788)
18 files modified
debian/changelog (+7/-0)
xstatic/pkg/angular_fileupload/__init__.py (+3/-3)
xstatic/pkg/angular_fileupload/data/FileAPI.min.js (+1/-1)
xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js (+316/-219)
xstatic/pkg/angular_fileupload/data/ng-file-upload-all.min.js (+3/-4)
xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js (+2/-2)
xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.min.js (+1/-1)
xstatic/pkg/angular_fileupload/data/ng-file-upload.js (+314/-217)
xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js (+3/-3)
xstatic/pkg/angular_lrdragndrop/__init__.py (+1/-1)
xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js (+13/-3)
xstatic/pkg/jquery/__init__.py (+13/-1)
xstatic/pkg/jquery/data/jquery.js (+4192/-4328)
xstatic/pkg/jquery/data/jquery.min.js (+2/-5)
xstatic/pkg/jquery/data/jquery.min.map (+1/-0)
xstatic/pkg/jquery/data/jquery.slim.js (+8777/-0)
xstatic/pkg/jquery/data/jquery.slim.min.js (+2/-0)
xstatic/pkg/jquery/data/jquery.slim.min.map (+1/-0)
Reviewer Review Type Date Requested Status
Ubuntu OpenStack uploaders Pending
Review via email: mp+450668@code.launchpad.net

Commit message

New upstream snapshot for OpenStack Bobcat.

Description of the change

This is an automated merge proposal.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 23ac026..070e696 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+horizon (4:23.2.0+git2023090509.7896fd8c-0ubuntu1) mantic; urgency=medium
7+
8+ * New upstream snapshot for OpenStack Bobcat.
9+ * Refresh xstatic assets.
10+
11+ -- Corey Bryant <corey.bryant@canonical.com> Tue, 05 Sep 2023 09:20:32 -0400
12+
13 horizon (4:23.2.0+git2023071214.e6f39871-0ubuntu1) mantic; urgency=medium
14
15 * d/gbp.conf, .launchpad.yaml: Sync from cloud-archive-tools for
16diff --git a/xstatic/pkg/angular_fileupload/__init__.py b/xstatic/pkg/angular_fileupload/__init__.py
17index 43c9db9..b812f41 100644
18--- a/xstatic/pkg/angular_fileupload/__init__.py
19+++ b/xstatic/pkg/angular_fileupload/__init__.py
20@@ -11,7 +11,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
21 # please use a all-lowercase valid python
22 # package name
23
24-VERSION = '12.0.4' # version of the packaged files, please use the upstream
25+VERSION = '12.2.13' # version of the packaged files, please use the upstream
26 # version number
27 BUILD = '0' # our package build number, so we can release new builds
28 # with fixes for xstatic stuff.
29@@ -24,8 +24,8 @@ CLASSIFIERS = []
30 KEYWORDS = '%s xstatic' % NAME
31
32 # XStatic-* package maintainer:
33-MAINTAINER = 'Rob Cresswell'
34-MAINTAINER_EMAIL = 'robert.cresswell@outlook.com'
35+MAINTAINER = 'Radomir Dopieralski'
36+MAINTAINER_EMAIL = 'openstack@sheep.art.pl'
37
38 # this refers to the project homepage of the stuff we packaged:
39 HOMEPAGE = 'https://github.com/danialfarid/angular-file-upload'
40diff --git a/xstatic/pkg/angular_fileupload/data/FileAPI.min.js b/xstatic/pkg/angular_fileupload/data/FileAPI.min.js
41index c7b0266..2afb71e 100644
42--- a/xstatic/pkg/angular_fileupload/data/FileAPI.min.js
43+++ b/xstatic/pkg/angular_fileupload/data/FileAPI.min.js
44@@ -1,4 +1,4 @@
45-/*! 12.0.4 */
46+/*! 12.2.13 */
47 /*! FileAPI 2.0.7 - BSD | git://github.com/mailru/FileAPI.git
48 * FileAPI — a set of javascript tools for working with files. Multiupload, drag'n'drop and chunked file upload. Images: crop, resize and auto orientation by EXIF.
49 */
50diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js
51index fca2e64..e342351 100644
52--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js
53+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js
54@@ -1,9 +1,9 @@
55 /**!
56- * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
57+ * AngularJS file upload directives and services. Supports: file upload/drop/paste, resume, cancel/abort,
58 * progress, resize, thumbnail, preview, validation and CORS
59 * FileAPI Flash shim for old browsers not supporting FormData
60 * @author Danial <danial.farid@gmail.com>
61- * @version 12.0.4
62+ * @version 12.2.13
63 */
64
65 (function () {
66@@ -424,7 +424,7 @@ if (!window.FileReader) {
67 * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
68 * progress, resize, thumbnail, preview, validation and CORS
69 * @author Danial <danial.farid@gmail.com>
70- * @version 12.0.4
71+ * @version 12.2.13
72 */
73
74 if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
75@@ -445,7 +445,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
76
77 var ngFileUpload = angular.module('ngFileUpload', []);
78
79-ngFileUpload.version = '12.0.4';
80+ngFileUpload.version = '12.2.13';
81
82 ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
83 var upload = this;
84@@ -512,10 +512,12 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
85 function uploadWithAngular() {
86 $http(config).then(function (r) {
87 if (resumeSupported && config._chunkSize && !config._finished && config._file) {
88+ var fileSize = config._file && config._file.size || 0;
89 notifyProgress({
90- loaded: config._end,
91- total: config._file && config._file.size,
92- config: config, type: 'progress'
93+ loaded: Math.min(config._end, fileSize),
94+ total: fileSize,
95+ config: config,
96+ type: 'progress'
97 }
98 );
99 upload.upload(config, true);
100@@ -554,6 +556,9 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
101 } else if (config.resumeSize) {
102 config.resumeSize().then(function (size) {
103 config._start = size;
104+ if (config._chunkSize) {
105+ config._end = config._start + config._chunkSize;
106+ }
107 uploadWithAngular();
108 }, function (e) {
109 throw e;
110@@ -607,9 +612,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
111 };
112
113 upload.promisesCount++;
114- promise['finally'](function () {
115- upload.promisesCount--;
116- });
117+ if (promise['finally'] && promise['finally'] instanceof Function) {
118+ promise['finally'](function () {
119+ upload.promisesCount--;
120+ });
121+ }
122 return promise;
123 }
124
125@@ -793,9 +800,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
126 var arrayBufferView = new Uint8Array(resp.data);
127 var type = resp.headers('content-type') || 'image/WebP';
128 var blob = new window.Blob([arrayBufferView], {type: type});
129+ var matches = url.match(/.*\/(.+?)(\?.*)?$/);
130+ if (matches.length > 1) {
131+ blob.name = matches[1];
132+ }
133 defer.resolve(blob);
134- //var split = type.split('[/;]');
135- //blob.name = url.substring(0, 150).replace(/\W+/g, '') + '.' + (split.length > 1 ? split[1] : 'jpg');
136 }, function (e) {
137 defer.reject(e);
138 });
139@@ -843,7 +852,7 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
140 };
141
142 upload.shouldUpdateOn = function (type, attr, scope) {
143- var modelOptions = upload.attrGetter('ngModelOptions', attr, scope);
144+ var modelOptions = upload.attrGetter('ngfModelOptions', attr, scope);
145 if (modelOptions && modelOptions.updateOn) {
146 return modelOptions.updateOn.split(' ').indexOf(type) > -1;
147 }
148@@ -893,13 +902,13 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
149 return $q.all(promises);
150 }
151
152- function resize(files, attr, scope) {
153+ function resizeFile(files, attr, scope, ngModel) {
154 var resizeVal = upload.attrGetter('ngfResize', attr, scope);
155 if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise();
156 if (resizeVal instanceof Function) {
157 var defer = $q.defer();
158- resizeVal(files).then(function (p) {
159- resizeWithParams(p, files, attr, scope).then(function (r) {
160+ return resizeVal(files).then(function (p) {
161+ resizeWithParams(p, files, attr, scope, ngModel).then(function (r) {
162 defer.resolve(r);
163 }, function (e) {
164 defer.reject(e);
165@@ -908,27 +917,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
166 defer.reject(e);
167 });
168 } else {
169- return resizeWithParams(resizeVal, files, attr, scope);
170+ return resizeWithParams(resizeVal, files, attr, scope, ngModel);
171 }
172 }
173
174- function resizeWithParams(param, files, attr, scope) {
175+ function resizeWithParams(params, files, attr, scope, ngModel) {
176 var promises = [upload.emptyPromise()];
177
178 function handleFile(f, i) {
179 if (f.type.indexOf('image') === 0) {
180- if (param.pattern && !upload.validatePattern(f, param.pattern)) return;
181- var promise = upload.resize(f, param.width, param.height, param.quality,
182- param.type, param.ratio, param.centerCrop, function (width, height) {
183- return upload.attrGetter('ngfResizeIf', attr, scope,
184- {$width: width, $height: height, $file: f});
185- }, param.restoreExif !== false);
186+ if (params.pattern && !upload.validatePattern(f, params.pattern)) return;
187+ params.resizeIf = function (width, height) {
188+ return upload.attrGetter('ngfResizeIf', attr, scope,
189+ {$width: width, $height: height, $file: f});
190+ };
191+ var promise = upload.resize(f, params);
192 promises.push(promise);
193 promise.then(function (resizedFile) {
194 files.splice(i, 1, resizedFile);
195 }, function (e) {
196 f.$error = 'resize';
197+ (f.$errorMessages = (f.$errorMessages || {})).resize = true;
198 f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name);
199+ ngModel.$ngfValidations.push({name: 'resize', valid: false});
200+ upload.applyModelValidation(ngModel, files);
201 });
202 }
203 }
204@@ -1015,18 +1027,6 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
205 return angular.isArray(v) ? v : [v];
206 }
207
208- function separateInvalids() {
209- valids = [];
210- invalids = [];
211- angular.forEach(allNewFiles, function (file) {
212- if (file.$error) {
213- invalids.push(file);
214- } else {
215- valids.push(file);
216- }
217- });
218- }
219-
220 function resizeAndUpdate() {
221 function updateModel() {
222 $timeout(function () {
223@@ -1036,17 +1036,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
224 }, options && options.debounce ? options.debounce.change || options.debounce : 0);
225 }
226
227- resize(validateAfterResize ? allNewFiles : valids, attr, scope).then(function () {
228+ var resizingFiles = validateAfterResize ? allNewFiles : valids;
229+ resizeFile(resizingFiles, attr, scope, ngModel).then(function () {
230 if (validateAfterResize) {
231- upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () {
232- separateInvalids();
233- updateModel();
234- });
235+ upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
236+ .then(function (validationResult) {
237+ valids = validationResult.validsFiles;
238+ invalids = validationResult.invalidsFiles;
239+ updateModel();
240+ });
241 } else {
242 updateModel();
243 }
244- }, function (e) {
245- throw 'Could not resize files ' + e;
246+ }, function () {
247+ for (var i = 0; i < resizingFiles.length; i++) {
248+ var f = resizingFiles[i];
249+ if (f.$error === 'resize') {
250+ var index = valids.indexOf(f);
251+ if (index > -1) {
252+ valids.splice(index, 1);
253+ invalids.push(f);
254+ }
255+ updateModel();
256+ }
257+ }
258 });
259 }
260
261@@ -1076,13 +1089,15 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
262
263 var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope);
264
265- var options = upload.attrGetter('ngModelOptions', attr, scope);
266- upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () {
267+ var options = upload.attrGetter('ngfModelOptions', attr, scope);
268+ upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
269+ .then(function (validationResult) {
270 if (noDelay) {
271 update(allNewFiles, [], files, dupFiles, isSingleModel);
272 } else {
273 if ((!options || !options.allowInvalid) && !validateAfterResize) {
274- separateInvalids();
275+ valids = validationResult.validFiles;
276+ invalids = validationResult.invalidFiles;
277 } else {
278 valids = allNewFiles;
279 }
280@@ -1119,7 +1134,7 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
281 /** @namespace attr.ngfSelect */
282 /** @namespace attr.ngfChange */
283 /** @namespace attr.ngModel */
284- /** @namespace attr.ngModelOptions */
285+ /** @namespace attr.ngfModelOptions */
286 /** @namespace attr.ngfMultiple */
287 /** @namespace attr.ngfCapture */
288 /** @namespace attr.ngfValidate */
289@@ -1139,6 +1154,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
290 function changeFn(evt) {
291 if (upload.shouldUpdateOn('change', attr, scope)) {
292 var fileList = evt.__files_ || (evt.target && evt.target.files), files = [];
293+ /* Handle duplicate call in IE11 */
294+ if (!fileList) return;
295 for (var i = 0; i < fileList.length; i++) {
296 files.push(fileList[i]);
297 }
298@@ -1150,31 +1167,39 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
299 upload.registerModelChangeValidator(ngModel, attr, scope);
300
301 var unwatches = [];
302- unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () {
303- fileElem.attr('multiple', attrGetter('ngfMultiple', scope));
304- }));
305- unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () {
306- fileElem.attr('capture', attrGetter('ngfCapture', scope));
307- }));
308- unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () {
309- fileElem.attr('accept', attrGetter('ngfAccept', scope));
310- }));
311- attr.$observe('accept', function () {
312+ if (attrGetter('ngfMultiple')) {
313+ unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () {
314+ fileElem.attr('multiple', attrGetter('ngfMultiple', scope));
315+ }));
316+ }
317+ if (attrGetter('ngfCapture')) {
318+ unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () {
319+ fileElem.attr('capture', attrGetter('ngfCapture', scope));
320+ }));
321+ }
322+ if (attrGetter('ngfAccept')) {
323+ unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () {
324+ fileElem.attr('accept', attrGetter('ngfAccept', scope));
325+ }));
326+ }
327+ unwatches.push(attr.$observe('accept', function () {
328 fileElem.attr('accept', attrGetter('accept'));
329- });
330- unwatches.push(function () {
331- if (attr.$$observers) delete attr.$$observers.accept;
332- });
333- function bindAttrToFileInput(fileElem) {
334- if (elem !== fileElem) {
335- for (var i = 0; i < elem[0].attributes.length; i++) {
336- var attribute = elem[0].attributes[i];
337- if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') {
338- if (attribute.value == null || attribute.value === '') {
339- if (attribute.name === 'required') attribute.value = 'required';
340- if (attribute.name === 'multiple') attribute.value = 'multiple';
341- }
342- fileElem.attr(attribute.name, attribute.name === 'id' ? 'ngf-' + attribute.value : attribute.value);
343+ }));
344+ function bindAttrToFileInput(fileElem, label) {
345+ function updateId(val) {
346+ fileElem.attr('id', 'ngf-' + val);
347+ label.attr('id', 'ngf-label-' + val);
348+ }
349+
350+ for (var i = 0; i < elem[0].attributes.length; i++) {
351+ var attribute = elem[0].attributes[i];
352+ if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') {
353+ if (attribute.name === 'id') {
354+ updateId(attribute.value);
355+ unwatches.push(attr.$observe('id', updateId));
356+ } else {
357+ fileElem.attr(attribute.name, (!attribute.value && (attribute.name === 'required' ||
358+ attribute.name === 'multiple')) ? attribute.name : attribute.value);
359 }
360 }
361 }
362@@ -1187,12 +1212,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
363
364 var fileElem = angular.element('<input type="file">');
365
366- bindAttrToFileInput(fileElem);
367-
368 var label = angular.element('<label>upload</label>');
369 label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden')
370 .css('width', '0px').css('height', '0px').css('border', 'none')
371 .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1');
372+ bindAttrToFileInput(fileElem, label);
373+
374 generatedElems.push({el: elem, ref: label});
375
376 document.body.appendChild(label.append(fileElem)[0]);
377@@ -1200,13 +1225,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
378 return fileElem;
379 }
380
381- var initialTouchStartY = 0;
382-
383 function clickHandler(evt) {
384 if (elem.attr('disabled')) return false;
385 if (attrGetter('ngfSelectDisabled', scope)) return;
386
387- var r = handleTouch(evt);
388+ var r = detectSwipe(evt);
389+ // prevent the click if it is a swipe
390 if (r != null) return r;
391
392 resetModel(evt);
393@@ -1218,7 +1242,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
394 document.body.appendChild(fileElem.parent()[0]);
395 fileElem.bind('change', changeFn);
396 }
397- } catch(e){/*ignore*/}
398+ } catch (e) {/*ignore*/
399+ }
400
401 if (isDelayedClickSupported(navigator.userAgent)) {
402 setTimeout(function () {
403@@ -1231,19 +1256,30 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
404 return false;
405 }
406
407- function handleTouch(evt) {
408- var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches);
409- if (evt.type === 'touchstart') {
410- initialTouchStartY = touches ? touches[0].clientY : 0;
411- return true; // don't block event default
412- } else {
413- evt.stopPropagation();
414- evt.preventDefault();
415
416- // prevent scroll from triggering event
417- if (evt.type === 'touchend') {
418- var currentLocation = touches ? touches[0].clientY : 0;
419- if (Math.abs(currentLocation - initialTouchStartY) > 20) return false;
420+ var initialTouchStartY = 0;
421+ var initialTouchStartX = 0;
422+
423+ function detectSwipe(evt) {
424+ var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches);
425+ if (touches) {
426+ if (evt.type === 'touchstart') {
427+ initialTouchStartX = touches[0].clientX;
428+ initialTouchStartY = touches[0].clientY;
429+ return true; // don't block event default
430+ } else {
431+ // prevent scroll from triggering event
432+ if (evt.type === 'touchend') {
433+ var currentX = touches[0].clientX;
434+ var currentY = touches[0].clientY;
435+ if ((Math.abs(currentX - initialTouchStartX) > 20) ||
436+ (Math.abs(currentY - initialTouchStartY) > 20)) {
437+ evt.stopPropagation();
438+ evt.preventDefault();
439+ return false;
440+ }
441+ }
442+ return true;
443 }
444 }
445 }
446@@ -1474,14 +1510,19 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
447 var size = resizeParams;
448 if (directiveName === 'ngfThumbnail') {
449 if (!size) {
450- size = {width: elem[0].clientWidth, height: elem[0].clientHeight};
451+ size = {
452+ width: elem[0].naturalWidth || elem[0].clientWidth,
453+ height: elem[0].naturalHeight || elem[0].clientHeight
454+ };
455 }
456 if (size.width === 0 && window.getComputedStyle) {
457 var style = getComputedStyle(elem[0]);
458- size = {
459- width: parseInt(style.width.slice(0, -2)),
460- height: parseInt(style.height.slice(0, -2))
461- };
462+ if (style.width && style.width.indexOf('px') > -1 && style.height && style.height.indexOf('px') > -1) {
463+ size = {
464+ width: parseInt(style.width.slice(0, -2)),
465+ height: parseInt(style.height.slice(0, -2))
466+ };
467+ }
468 }
469 }
470
471@@ -1496,7 +1537,11 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
472 if (file && file.type && file.type.search(getTagType(elem[0])) === 0 &&
473 (!isBackground || file.type.indexOf('image') === 0)) {
474 if (size && Upload.isResizeSupported()) {
475- Upload.resize(file, size.width, size.height, size.quality).then(
476+ size.resizeIf = function (width, height) {
477+ return Upload.attrGetter('ngfResizeIf', attr, scope,
478+ {$width: width, $height: height, $file: file});
479+ };
480+ Upload.resize(file, size).then(
481 function (f) {
482 constructDataUrl(f);
483 }, function (e) {
484@@ -1558,8 +1603,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
485 }]);
486
487 ngFileUpload.config(['$compileProvider', function ($compileProvider) {
488- if ($compileProvider.imgSrcSanitizationWhitelist) $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/);
489- if ($compileProvider.aHrefSanitizationWhitelist) $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/);
490+ if ($compileProvider.imgSrcSanitizationWhitelist) $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
491+ if ($compileProvider.aHrefSanitizationWhitelist) $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
492 }]);
493
494 ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) {
495@@ -1651,13 +1696,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
496 if (ngModel) {
497 ngModel.$formatters.push(function (files) {
498 if (ngModel.$dirty) {
499+ var filesArray = files;
500 if (files && !angular.isArray(files)) {
501- files = [files];
502+ filesArray = [files];
503 }
504- upload.validate(files, 0, ngModel, attr, scope).then(function () {
505- upload.applyModelValidation(ngModel, files);
506+ upload.validate(filesArray, 0, ngModel, attr, scope).then(function () {
507+ upload.applyModelValidation(ngModel, filesArray);
508 });
509 }
510+ return files;
511 });
512 }
513 };
514@@ -1707,11 +1754,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
515 return upload.attrGetter(name, attr, scope, params);
516 };
517
518+ var ignoredErrors = (upload.attrGetter('ngfIgnoreInvalid', attr, scope) || '').split(' ');
519+ var runAllValidation = upload.attrGetter('ngfRunAllValidations', attr, scope);
520+
521 if (files == null || files.length === 0) {
522- return upload.emptyPromise(ngModel);
523+ return upload.emptyPromise({'validFiles': files, 'invalidFiles': []});
524 }
525
526 files = files.length === undefined ? [files] : files.slice(0);
527+ var invalidFiles = [];
528
529 function validateSync(name, validationName, fn) {
530 if (files) {
531@@ -1722,11 +1773,20 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
532 var val = upload.getValidationAttr(attr, scope, name, validationName, file);
533 if (val != null) {
534 if (!fn(file, val, i)) {
535- file.$error = name;
536- (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
537- file.$errorParam = val;
538- files.splice(i, 1);
539- valid = false;
540+ if (ignoredErrors.indexOf(name) === -1) {
541+ file.$error = name;
542+ (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
543+ file.$errorParam = val;
544+ if (invalidFiles.indexOf(file) === -1) {
545+ invalidFiles.push(file);
546+ }
547+ if (!runAllValidation) {
548+ files.splice(i, 1);
549+ }
550+ valid = false;
551+ } else {
552+ files.splice(i, 1);
553+ }
554 }
555 }
556 }
557@@ -1737,9 +1797,6 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
558 }
559 }
560
561- validateSync('maxFiles', null, function (file, val, i) {
562- return prevLength + i < val;
563- });
564 validateSync('pattern', null, upload.validatePattern);
565 validateSync('minSize', 'size.min', function (file, val) {
566 return file.size + 0.1 >= upload.translateScalars(val);
567@@ -1762,44 +1819,58 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
568 });
569
570 if (!files.length) {
571- return upload.emptyPromise(ngModel, ngModel.$ngfValidations);
572+ return upload.emptyPromise({'validFiles': [], 'invalidFiles': invalidFiles});
573 }
574
575 function validateAsync(name, validationName, type, asyncFn, fn) {
576 function resolveResult(defer, file, val) {
577- if (val != null) {
578- asyncFn(file, val).then(function (d) {
579- if (!fn(d, val)) {
580+ function resolveInternal(fn) {
581+ if (fn()) {
582+ if (ignoredErrors.indexOf(name) === -1) {
583 file.$error = name;
584 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
585 file.$errorParam = val;
586- defer.reject();
587+ if (invalidFiles.indexOf(file) === -1) {
588+ invalidFiles.push(file);
589+ }
590+ if (!runAllValidation) {
591+ var i = files.indexOf(file);
592+ if (i > -1) files.splice(i, 1);
593+ }
594+ defer.resolve(false);
595 } else {
596- defer.resolve();
597+ var j = files.indexOf(file);
598+ if (j > -1) files.splice(j, 1);
599+ defer.resolve(true);
600 }
601+ } else {
602+ defer.resolve(true);
603+ }
604+ }
605+
606+ if (val != null) {
607+ asyncFn(file, val).then(function (d) {
608+ resolveInternal(function () {
609+ return !fn(d, val);
610+ });
611 }, function () {
612- if (attrGetter('ngfValidateForce', {$file: file})) {
613- file.$error = name;
614- (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
615- file.$errorParam = val;
616- defer.reject();
617- } else {
618- defer.resolve();
619- }
620+ resolveInternal(function () {
621+ return attrGetter('ngfValidateForce', {$file: file});
622+ });
623 });
624 } else {
625- defer.resolve();
626+ defer.resolve(true);
627 }
628 }
629
630- var promises = [upload.emptyPromise()];
631+ var promises = [upload.emptyPromise(true)];
632 if (files) {
633 files = files.length === undefined ? [files] : files;
634 angular.forEach(files, function (file) {
635 var defer = $q.defer();
636 promises.push(defer.promise);
637 if (type && (file.type == null || file.type.search(type) !== 0)) {
638- defer.resolve();
639+ defer.resolve(true);
640 return;
641 }
642 if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) {
643@@ -1807,96 +1878,120 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
644 resolveResult(defer, file,
645 attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height}));
646 }, function () {
647- defer.reject();
648+ defer.resolve(false);
649 });
650 } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) {
651 upload.mediaDuration(file).then(function (d) {
652 resolveResult(defer, file,
653 attrGetter('ngfDuration', {$file: file, $duration: d}));
654 }, function () {
655- defer.reject();
656+ defer.resolve(false);
657 });
658 } else {
659 resolveResult(defer, file,
660 upload.getValidationAttr(attr, scope, name, validationName, file));
661 }
662 });
663- return $q.all(promises).then(function () {
664- ngModel.$ngfValidations.push({name: name, valid: true});
665- }, function () {
666- ngModel.$ngfValidations.push({name: name, valid: false});
667- });
668 }
669+ var deffer = $q.defer();
670+ $q.all(promises).then(function (values) {
671+ var isValid = true;
672+ for (var i = 0; i < values.length; i++) {
673+ if (!values[i]) {
674+ isValid = false;
675+ break;
676+ }
677+ }
678+ ngModel.$ngfValidations.push({name: name, valid: isValid});
679+ deffer.resolve(isValid);
680+ });
681+ return deffer.promise;
682 }
683
684 var deffer = $q.defer();
685 var promises = [];
686
687- promises.push(upload.happyPromise(validateAsync('maxHeight', 'height.max', /image/,
688+ promises.push(validateAsync('maxHeight', 'height.max', /image/,
689 this.imageDimensions, function (d, val) {
690 return d.height <= val;
691- })));
692- promises.push(upload.happyPromise(validateAsync('minHeight', 'height.min', /image/,
693+ }));
694+ promises.push(validateAsync('minHeight', 'height.min', /image/,
695 this.imageDimensions, function (d, val) {
696 return d.height >= val;
697- })));
698- promises.push(upload.happyPromise(validateAsync('maxWidth', 'width.max', /image/,
699+ }));
700+ promises.push(validateAsync('maxWidth', 'width.max', /image/,
701 this.imageDimensions, function (d, val) {
702 return d.width <= val;
703- })));
704- promises.push(upload.happyPromise(validateAsync('minWidth', 'width.min', /image/,
705+ }));
706+ promises.push(validateAsync('minWidth', 'width.min', /image/,
707 this.imageDimensions, function (d, val) {
708 return d.width >= val;
709- })));
710- promises.push(upload.happyPromise(validateAsync('dimensions', null, /image/,
711+ }));
712+ promises.push(validateAsync('dimensions', null, /image/,
713 function (file, val) {
714 return upload.emptyPromise(val);
715 }, function (r) {
716 return r;
717- })));
718- promises.push(upload.happyPromise(validateAsync('ratio', null, /image/,
719+ }));
720+ promises.push(validateAsync('ratio', null, /image/,
721 this.imageDimensions, function (d, val) {
722 var split = val.toString().split(','), valid = false;
723 for (var i = 0; i < split.length; i++) {
724- if (Math.abs((d.width / d.height) - upload.ratioToFloat(split[i])) < 0.0001) {
725+ if (Math.abs((d.width / d.height) - upload.ratioToFloat(split[i])) < 0.01) {
726 valid = true;
727 }
728 }
729 return valid;
730- })));
731- promises.push(upload.happyPromise(validateAsync('maxRatio', 'ratio.max', /image/,
732+ }));
733+ promises.push(validateAsync('maxRatio', 'ratio.max', /image/,
734 this.imageDimensions, function (d, val) {
735 return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001;
736- })));
737- promises.push(upload.happyPromise(validateAsync('minRatio', 'ratio.min', /image/,
738+ }));
739+ promises.push(validateAsync('minRatio', 'ratio.min', /image/,
740 this.imageDimensions, function (d, val) {
741 return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001;
742- })));
743- promises.push(upload.happyPromise(validateAsync('maxDuration', 'duration.max', /audio|video/,
744+ }));
745+ promises.push(validateAsync('maxDuration', 'duration.max', /audio|video/,
746 this.mediaDuration, function (d, val) {
747 return d <= upload.translateScalars(val);
748- })));
749- promises.push(upload.happyPromise(validateAsync('minDuration', 'duration.min', /audio|video/,
750+ }));
751+ promises.push(validateAsync('minDuration', 'duration.min', /audio|video/,
752 this.mediaDuration, function (d, val) {
753 return d >= upload.translateScalars(val);
754- })));
755- promises.push(upload.happyPromise(validateAsync('duration', null, /audio|video/,
756+ }));
757+ promises.push(validateAsync('duration', null, /audio|video/,
758 function (file, val) {
759 return upload.emptyPromise(val);
760 }, function (r) {
761 return r;
762- })));
763+ }));
764
765- promises.push(upload.happyPromise(validateAsync('validateAsyncFn', null, null,
766+ promises.push(validateAsync('validateAsyncFn', null, null,
767 function (file, val) {
768 return val;
769 }, function (r) {
770 return r === true || r === null || r === '';
771- })));
772+ }));
773
774- return $q.all(promises).then(function () {
775- deffer.resolve(ngModel, ngModel.$ngfValidations);
776+ $q.all(promises).then(function () {
777+
778+ if (runAllValidation) {
779+ for (var i = 0; i < files.length; i++) {
780+ var file = files[i];
781+ if (file.$error) {
782+ files.splice(i--, 1);
783+ }
784+ }
785+ }
786+
787+ runAllValidation = false;
788+ validateSync('maxFiles', null, function (file, val, i) {
789+ return prevLength + i < val;
790+ });
791+
792+ deffer.resolve({'validFiles': files, 'invalidFiles': invalidFiles});
793 });
794+ return deffer.promise;
795 };
796
797 upload.imageDimensions = function (file) {
798@@ -1921,8 +2016,8 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
799 .css('max-width', 'none !important').css('max-height', 'none !important');
800
801 function success() {
802- var width = img[0].clientWidth;
803- var height = img[0].clientHeight;
804+ var width = img[0].naturalWidth || img[0].clientWidth;
805+ var height = img[0].naturalHeight || img[0].clientHeight;
806 img.remove();
807 file.$ngfWidth = width;
808 file.$ngfHeight = height;
809@@ -1936,23 +2031,23 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
810
811 img.on('load', success);
812 img.on('error', error);
813- var count = 0;
814
815- function checkLoadError() {
816+ var secondsCounter = 0;
817+ function checkLoadErrorInCaseOfNoCallback() {
818 $timeout(function () {
819 if (img[0].parentNode) {
820 if (img[0].clientWidth) {
821 success();
822- } else if (count > 10) {
823+ } else if (secondsCounter++ > 10) {
824 error();
825 } else {
826- checkLoadError();
827+ checkLoadErrorInCaseOfNoCallback();
828 }
829 }
830 }, 1000);
831 }
832
833- checkLoadError();
834+ checkLoadErrorInCaseOfNoCallback();
835
836 angular.element(document.getElementsByTagName('body')[0]).append(img);
837 }, function () {
838@@ -2063,31 +2158,35 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
839 var deferred = $q.defer();
840 var canvasElement = document.createElement('canvas');
841 var imageElement = document.createElement('img');
842+ imageElement.setAttribute('style', 'visibility:hidden;position:fixed;z-index:-100000');
843+ document.body.appendChild(imageElement);
844
845 imageElement.onload = function () {
846- if (resizeIf != null && resizeIf(imageElement.width, imageElement.height) === false) {
847+ var imgWidth = imageElement.width, imgHeight = imageElement.height;
848+ imageElement.parentNode.removeChild(imageElement);
849+ if (resizeIf != null && resizeIf(imgWidth, imgHeight) === false) {
850 deferred.reject('resizeIf');
851 return;
852 }
853 try {
854 if (ratio) {
855 var ratioFloat = upload.ratioToFloat(ratio);
856- var imgRatio = imageElement.width / imageElement.height;
857+ var imgRatio = imgWidth / imgHeight;
858 if (imgRatio < ratioFloat) {
859- width = imageElement.width;
860+ width = imgWidth;
861 height = width / ratioFloat;
862 } else {
863- height = imageElement.height;
864+ height = imgHeight;
865 width = height * ratioFloat;
866 }
867 }
868 if (!width) {
869- width = imageElement.width;
870+ width = imgWidth;
871 }
872 if (!height) {
873- height = imageElement.height;
874+ height = imgHeight;
875 }
876- var dimensions = calculateAspectRatioFit(imageElement.width, imageElement.height, width, height, centerCrop);
877+ var dimensions = calculateAspectRatioFit(imgWidth, imgHeight, width, height, centerCrop);
878 canvasElement.width = Math.min(dimensions.width, width);
879 canvasElement.height = Math.min(dimensions.height, height);
880 var context = canvasElement.getContext('2d');
881@@ -2100,6 +2199,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
882 }
883 };
884 imageElement.onerror = function () {
885+ imageElement.parentNode.removeChild(imageElement);
886 deferred.reject();
887 };
888 imageElement.src = imagen;
889@@ -2136,14 +2236,15 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
890 });
891 }
892
893- upload.resize = function (file, width, height, quality, type, ratio, centerCrop, resizeIf, restoreExif) {
894+ upload.resize = function (file, options) {
895 if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file);
896
897 var deferred = $q.defer();
898 upload.dataUrl(file, true).then(function (url) {
899- resize(url, width, height, quality, type || file.type, ratio, centerCrop, resizeIf)
900+ resize(url, options.width, options.height, options.quality, options.type || file.type,
901+ options.ratio, options.centerCrop, options.resizeIf)
902 .then(function (dataUrl) {
903- if (file.type === 'image/jpeg' && restoreExif) {
904+ if (file.type === 'image/jpeg' && options.restoreExif !== false) {
905 try {
906 dataUrl = upload.restoreExif(url, dataUrl);
907 } catch (e) {
908@@ -2172,13 +2273,13 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
909 }]);
910
911 (function () {
912- ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$location', 'Upload', '$http', '$q',
913- function ($parse, $timeout, $location, Upload, $http, $q) {
914+ ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$window', 'Upload', '$http', '$q',
915+ function ($parse, $timeout, $window, Upload, $http, $q) {
916 return {
917 restrict: 'AEC',
918 require: '?ngModel',
919 link: function (scope, elem, attr, ngModel) {
920- linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, Upload, $http, $q);
921+ linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, Upload, $http, $q);
922 }
923 };
924 }]);
925@@ -2203,7 +2304,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
926 };
927 }]);
928
929- function linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, upload, $http, $q) {
930+ function linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, upload, $http, $q) {
931 var available = dropAvailable();
932
933 var attrGetter = function (name, scope, params) {
934@@ -2279,23 +2380,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
935 if (stopPropagation(scope)) evt.stopPropagation();
936 if (actualDragOverClass) elem.removeClass(actualDragOverClass);
937 actualDragOverClass = null;
938- var items = evt.dataTransfer.items;
939- var html;
940- try {
941- html = evt.dataTransfer && evt.dataTransfer.getData && evt.dataTransfer.getData('text/html');
942- } catch (e) {/* Fix IE11 that throw error calling getData */
943- }
944-
945- extractFiles(items, evt.dataTransfer.files, attrGetter('ngfAllowDir', scope) !== false,
946- attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) {
947- if (files.length) {
948- updateModel(files, evt);
949- } else {
950- extractFilesFromHtml('dropUrl', html).then(function (files) {
951- updateModel(files, evt);
952- });
953- }
954- });
955+ extractFilesAndUpdateModel(evt.dataTransfer, evt, 'dropUrl');
956 }, false);
957 elem[0].addEventListener('paste', function (evt) {
958 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
959@@ -2303,22 +2388,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
960 evt.preventDefault();
961 }
962 if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return;
963- var files = [];
964- var clipboard = evt.clipboardData || evt.originalEvent.clipboardData;
965- if (clipboard && clipboard.items) {
966- for (var k = 0; k < clipboard.items.length; k++) {
967- if (clipboard.items[k].type.indexOf('image') !== -1) {
968- files.push(clipboard.items[k].getAsFile());
969- }
970- }
971- }
972- if (files.length) {
973- updateModel(files, evt);
974- } else {
975- extractFilesFromHtml('pasteUrl', clipboard).then(function (files) {
976- updateModel(files, evt);
977- });
978- }
979+ extractFilesAndUpdateModel(evt.clipboardData || evt.originalEvent.clipboardData, evt, 'pasteUrl');
980 }, false);
981
982 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
983@@ -2331,12 +2401,33 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
984 });
985 }
986
987+ function extractFilesAndUpdateModel(source, evt, updateOnType) {
988+ if (!source) return;
989+ // html needs to be calculated on the same process otherwise the data will be wiped
990+ // after promise resolve or setTimeout.
991+ var html;
992+ try {
993+ html = source && source.getData && source.getData('text/html');
994+ } catch (e) {/* Fix IE11 that throw error calling getData */
995+ }
996+ extractFiles(source.items, source.files, attrGetter('ngfAllowDir', scope) !== false,
997+ attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) {
998+ if (files.length) {
999+ updateModel(files, evt);
1000+ } else {
1001+ extractFilesFromHtml(updateOnType, html).then(function (files) {
1002+ updateModel(files, evt);
1003+ });
1004+ }
1005+ });
1006+ }
1007+
1008 function updateModel(files, evt) {
1009 upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt);
1010 }
1011
1012 function extractFilesFromHtml(updateOn, html) {
1013- if (!upload.shouldUpdateOn(updateOn, attr, scope) || !html) return upload.rejectPromise([]);
1014+ if (!upload.shouldUpdateOn(updateOn, attr, scope) || typeof html !== 'string') return upload.rejectPromise([]);
1015 var urls = [];
1016 html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) {
1017 urls.push(src);
1018@@ -2387,8 +2478,14 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1019 }
1020
1021 function extractFiles(items, fileList, allowDir, multiple) {
1022- var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles') || Number.MAX_VALUE;
1023- var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize') || Number.MAX_VALUE;
1024+ var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles');
1025+ if (maxFiles == null) {
1026+ maxFiles = Number.MAX_VALUE;
1027+ }
1028+ var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize');
1029+ if (maxTotalSize == null) {
1030+ maxTotalSize = Number.MAX_VALUE;
1031+ }
1032 var includeDir = attrGetter('ngfIncludeDir', scope);
1033 var files = [], totalSize = 0;
1034
1035@@ -2399,7 +2496,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1036 var promises = [upload.emptyPromise()];
1037 if (includeDir) {
1038 var file = {type: 'directory'};
1039- file.name = file.path = (path || '') + entry.name + entry.name;
1040+ file.name = file.path = (path || '') + entry.name;
1041 files.push(file);
1042 }
1043 var dirReader = entry.createReader();
1044@@ -2453,7 +2550,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1045
1046 var promises = [upload.emptyPromise()];
1047
1048- if (items && items.length > 0 && $location.protocol() !== 'file') {
1049+ if (items && items.length > 0 && $window.location.protocol !== 'file:') {
1050 for (var i = 0; i < items.length; i++) {
1051 if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) {
1052 var entry = items[i].webkitGetAsEntry();
1053diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.min.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.min.js
1054index f8c5ce8..4362546 100644
1055--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.min.js
1056+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.min.js
1057@@ -1,4 +1,3 @@
1058-/*! 12.0.4 */
1059-!function(){function a(a,b){window.XMLHttpRequest.prototype[a]=b(window.XMLHttpRequest.prototype[a])}function b(a,b,c){try{Object.defineProperty(a,b,{get:c})}catch(d){}}if(window.FileAPI||(window.FileAPI={}),!window.XMLHttpRequest)throw"AJAX is not supported. XMLHttpRequest is not defined.";if(FileAPI.shouldLoad=!window.FormData||FileAPI.forceLoad,FileAPI.shouldLoad){var c=function(a){if(!a.__listeners){a.upload||(a.upload={}),a.__listeners=[];var b=a.upload.addEventListener;a.upload.addEventListener=function(c,d){a.__listeners[c]=d,b&&b.apply(this,arguments)}}};a("open",function(a){return function(b,d,e){c(this),this.__url=d;try{a.apply(this,[b,d,e])}catch(f){f.message.indexOf("Access is denied")>-1&&(this.__origError=f,a.apply(this,[b,"_fix_for_ie_crossdomain__",e]))}}}),a("getResponseHeader",function(a){return function(b){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(b):null==a?null:a.apply(this,[b])}}),a("getAllResponseHeaders",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==a?null:a.apply(this)}}),a("abort",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==a?null:a.apply(this)}}),a("setRequestHeader",function(a){return function(b,d){if("__setXHR_"===b){c(this);var e=d(this);e instanceof Function&&e(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[b]=d,a.apply(this,arguments)}}),a("send",function(a){return function(){var c=this;if(arguments[0]&&arguments[0].__isFileAPIShim){var d=arguments[0],e={url:c.__url,jsonp:!1,cache:!0,complete:function(a,d){a&&angular.isString(a)&&-1!==a.indexOf("#2174")&&(a=null),c.__completed=!0,!a&&c.__listeners.load&&c.__listeners.load({type:"load",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),!a&&c.__listeners.loadend&&c.__listeners.loadend({type:"loadend",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),"abort"===a&&c.__listeners.abort&&c.__listeners.abort({type:"abort",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),void 0!==d.status&&b(c,"status",function(){return 0===d.status&&a&&"abort"!==a?500:d.status}),void 0!==d.statusText&&b(c,"statusText",function(){return d.statusText}),b(c,"readyState",function(){return 4}),void 0!==d.response&&b(c,"response",function(){return d.response});var e=d.responseText||(a&&0===d.status&&"abort"!==a?a:void 0);b(c,"responseText",function(){return e}),b(c,"response",function(){return e}),a&&b(c,"err",function(){return a}),c.__fileApiXHR=d,c.onreadystatechange&&c.onreadystatechange(),c.onload&&c.onload()},progress:function(a){if(a.target=c,c.__listeners.progress&&c.__listeners.progress(a),c.__total=a.total,c.__loaded=a.loaded,a.total===a.loaded){var b=this;setTimeout(function(){c.__completed||(c.getAllResponseHeaders=function(){},b.complete(null,{status:204,statusText:"No Content"}))},FileAPI.noContentTimeout||1e4)}},headers:c.__requestHeaders};e.data={},e.files={};for(var f=0;f<d.data.length;f++){var g=d.data[f];null!=g.val&&null!=g.val.name&&null!=g.val.size&&null!=g.val.type?e.files[g.key]=g.val:e.data[g.key]=g.val}setTimeout(function(){if(!FileAPI.hasFlash)throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';c.__fileApiXHR=FileAPI.upload(e)},1)}else{if(this.__origError)throw this.__origError;a.apply(c,arguments)}}}),window.XMLHttpRequest.__isFileAPIShim=!0,window.FormData=FormData=function(){return{append:function(a,b,c){b.__isFileAPIBlobShim&&(b=b.data[0]),this.data.push({key:a,val:b,name:c})},data:[],__isFileAPIShim:!0}},window.Blob=Blob=function(a){return{data:a,__isFileAPIBlobShim:!0}}}}(),function(){function a(a){return"input"===a[0].tagName.toLowerCase()&&a.attr("type")&&"file"===a.attr("type").toLowerCase()}function b(){try{var a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(a)return!0}catch(b){if(void 0!==navigator.mimeTypes["application/x-shockwave-flash"])return!0}return!1}function c(a){var b=0,c=0;if(window.jQuery)return jQuery(a).offset();if(a.offsetParent)do b+=a.offsetLeft-a.scrollLeft,c+=a.offsetTop-a.scrollTop,a=a.offsetParent;while(a);return{left:b,top:c}}if(FileAPI.shouldLoad){if(FileAPI.hasFlash=b(),FileAPI.forceLoad&&(FileAPI.html5=!1),!FileAPI.upload){var d,e,f,g,h,i=document.createElement("script"),j=document.getElementsByTagName("script");if(window.FileAPI.jsUrl)d=window.FileAPI.jsUrl;else if(window.FileAPI.jsPath)e=window.FileAPI.jsPath;else for(f=0;f<j.length;f++)if(h=j[f].src,g=h.search(/\/ng\-file\-upload[\-a-zA-z0-9\.]*\.js/),g>-1){e=h.substring(0,g+1);break}null==FileAPI.staticPath&&(FileAPI.staticPath=e),i.setAttribute("src",d||e+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(i)}FileAPI.ngfFixIE=function(d,e,f){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var g=function(){var b=e.parent();d.attr("disabled")?b&&b.removeClass("js-fileapi-wrapper"):(e.attr("__ngf_flash_")||(e.unbind("change"),e.unbind("click"),e.bind("change",function(a){h.apply(this,[a]),f.apply(this,[a])}),e.attr("__ngf_flash_","true")),b.addClass("js-fileapi-wrapper"),a(d)||(b.css("position","absolute").css("top",c(d[0]).top+"px").css("left",c(d[0]).left+"px").css("width",d[0].offsetWidth+"px").css("height",d[0].offsetHeight+"px").css("filter","alpha(opacity=0)").css("display",d.css("display")).css("overflow","hidden").css("z-index","900000").css("visibility","visible"),e.css("width",d[0].offsetWidth+"px").css("height",d[0].offsetHeight+"px").css("position","absolute").css("top","0px").css("left","0px")))};d.bind("mouseenter",g);var h=function(a){for(var b=FileAPI.getFiles(a),c=0;c<b.length;c++)void 0===b[c].size&&(b[c].size=0),void 0===b[c].name&&(b[c].name="file"),void 0===b[c].type&&(b[c].type="undefined");a.target||(a.target={}),a.target.files=b,a.target.files!==b&&(a.__files_=b),(a.__files_||a.target.files).item=function(b){return(a.__files_||a.target.files)[b]||null}}},FileAPI.disableFileInput=function(a,b){b?a.removeClass("js-fileapi-wrapper"):a.addClass("js-fileapi-wrapper")}}}(),window.FileReader||(window.FileReader=function(){var a=this,b=!1;this.listeners={},this.addEventListener=function(b,c){a.listeners[b]=a.listeners[b]||[],a.listeners[b].push(c)},this.removeEventListener=function(b,c){a.listeners[b]&&a.listeners[b].splice(a.listeners[b].indexOf(c),1)},this.dispatchEvent=function(b){var c=a.listeners[b.type];if(c)for(var d=0;d<c.length;d++)c[d].call(a,b)},this.onabort=this.onerror=this.onload=this.onloadstart=this.onloadend=this.onprogress=null;var c=function(b,c){var d={type:b,target:a,loaded:c.loaded,total:c.total,error:c.error};return null!=c.result&&(d.target.result=c.result),d},d=function(d){b||(b=!0,a.onloadstart&&a.onloadstart(c("loadstart",d)));var e;"load"===d.type?(a.onloadend&&a.onloadend(c("loadend",d)),e=c("load",d),a.onload&&a.onload(e),a.dispatchEvent(e)):"progress"===d.type?(e=c("progress",d),a.onprogress&&a.onprogress(e),a.dispatchEvent(e)):(e=c("error",d),a.onerror&&a.onerror(e),a.dispatchEvent(e))};this.readAsDataURL=function(a){FileAPI.readAsDataURL(a,d)},this.readAsText=function(a){FileAPI.readAsText(a,d)}}),!window.XMLHttpRequest||window.FileAPI&&FileAPI.shouldLoad||(window.XMLHttpRequest.prototype.setRequestHeader=function(a){return function(b,c){if("__setXHR_"===b){var d=c(this);d instanceof Function&&d(this)}else a.apply(this,arguments)}}(window.XMLHttpRequest.prototype.setRequestHeader));var ngFileUpload=angular.module("ngFileUpload",[]);ngFileUpload.version="12.0.4",ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){function e(a){j.notify&&j.notify(a),k.progressFunc&&c(function(){k.progressFunc(a)})}function h(a){return null!=d._start&&g?{loaded:a.loaded+d._start,total:d._file&&d._file.size||a.total,type:a.type,config:d,lengthComputable:!0,target:a.target}:a}function i(){a(d).then(function(a){g&&d._chunkSize&&!d._finished&&d._file?(e({loaded:d._end,total:d._file&&d._file.size,config:d,type:"progress"}),f.upload(d,!0)):(d._finished&&delete d._finished,j.resolve(a))},function(a){j.reject(a)},function(a){j.notify(a)})}d.method=d.method||"POST",d.headers=d.headers||{};var j=d._deferred=d._deferred||b.defer(),k=j.promise;return d.disableProgress||(d.headers.__setXHR_=function(){return function(a){a&&a.upload&&a.upload.addEventListener&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e(h(a))},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e(h(a)))},!1))}}),g?d._chunkSize&&d._end&&!d._finished?(d._start=d._end,d._end+=d._chunkSize,i()):d.resumeSizeUrl?a.get(d.resumeSizeUrl).then(function(a){d._start=d.resumeSizeResponseReader?d.resumeSizeResponseReader(a.data):parseInt((null==a.data.size?a.data:a.data.size).toString()),d._chunkSize&&(d._end=d._start+d._chunkSize),i()},function(a){throw a}):d.resumeSize?d.resumeSize().then(function(a){d._start=a,i()},function(a){throw a}):(d._chunkSize&&(d._start=0,d._end=d._start+d._chunkSize),i()):i(),k.success=function(a){return k.then(function(b){a(b.data,b.status,b.headers,d)}),k},k.error=function(a){return k.then(null,function(b){a(b.data,b.status,b.headers,d)}),k},k.progress=function(a){return k.progressFunc=a,k.then(null,null,function(b){a(b)}),k},k.abort=k.pause=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),k},k.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(k,arguments),a.apply(k,arguments)}}(d.xhrFn),k},f.promisesCount++,k["finally"](function(){f.promisesCount--}),k}function e(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}var f=this;f.promisesCount=0,this.isResumeSupported=function(){return window.Blob&&window.Blob.prototype.slice};var g=this.isResumeSupported();this.isUploadInProgress=function(){return f.promisesCount>0},this.rename=function(a,b){return a.ngfName=b,a},this.jsonBlob=function(a){null==a||angular.isString(a)||(a=JSON.stringify(a));var b=new window.Blob([a],{type:"application/json"});return b._ngfBlob=!0,b},this.json=function(a){return angular.toJson(a)},this.isFile=function(a){return null!=a&&(a instanceof window.Blob||a.flashId&&a.name&&a.size)},this.upload=function(a,b){function c(b,c){if(b._ngfBlob)return b;if(a._file=a._file||b,null!=a._start&&g){a._end&&a._end>=b.size&&(a._finished=!0,a._end=b.size);var d=b.slice(a._start,a._end||b.size);return d.name=b.name,d.ngfName=b.ngfName,a._chunkSize&&(c.append("_chunkSize",a._chunkSize),c.append("_currentChunkSize",a._end-a._start),c.append("_chunkNumber",Math.floor(a._start/a._chunkSize)),c.append("_totalSize",a._file.size)),d}return b}function h(b,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))b.append(e,d);else if(f.isFile(d)){var g=c(d,b),i=e.split(",");i[1]&&(g.ngfName=i[1].replace(/^\s+|\s+$/g,""),e=i[0]),a._fileKey=a._fileKey||e,b.append(e,g,g.ngfName||g.name)}else if(angular.isObject(d)){if(d.$$ngfCircularDetection)throw"ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: "+e;d.$$ngfCircularDetection=!0;try{for(var j in d)if(d.hasOwnProperty(j)&&"$$ngfCircularDetection"!==j){var k=null==a.objectKey?"[i]":a.objectKey;d.length&&parseInt(j)>-1&&(k=null==a.arrayKey?k:a.arrayKey),h(b,d[j],e+k.replace(/[ik]/g,j))}}finally{delete d.$$ngfCircularDetection}}else b.append(e,d)}function i(){a._chunkSize=f.translateScalars(a.resumeChunkSize),a._chunkSize=a._chunkSize?parseInt(a._chunkSize.toString()):null,a.headers=a.headers||{},a.headers["Content-Type"]=void 0,a.transformRequest=a.transformRequest?angular.isArray(a.transformRequest)?a.transformRequest:[a.transformRequest]:[],a.transformRequest.push(function(b){var c,d=new window.FormData;b=b||a.fields||{},a.file&&(b.file=a.file);for(c in b)if(b.hasOwnProperty(c)){var e=b[c];a.formDataAppender?a.formDataAppender(d,c,e):h(d,e,c)}return d})}return b||(a=e(a)),a._isDigested||(a._isDigested=!0,i()),d(a)},this.http=function(b){return b=e(b),b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof window.Blob?b:a.defaults.transformRequest[0].apply(this,arguments)},b._chunkSize=f.translateScalars(b.resumeChunkSize),b._chunkSize=b._chunkSize?parseInt(b._chunkSize.toString()):null,d(b)},this.translateScalars=function(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1024*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1048576*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1073741824*a.substring(0,a.length-2));if(a.search(/b/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/s/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/m/i)===a.length-1)return parseFloat(60*a.substring(0,a.length-1));if(a.search(/h/i)===a.length-1)return parseFloat(3600*a.substring(0,a.length-1))}return a},this.urlToBlob=function(c){var d=b.defer();return a({url:c,method:"get",responseType:"arraybuffer"}).then(function(a){var b=new Uint8Array(a.data),c=a.headers("content-type")||"image/WebP",e=new window.Blob([b],{type:c});d.resolve(e)},function(a){d.reject(a)}),d.promise},this.setDefaults=function(a){this.defaults=a||{}},this.defaults={},this.version=ngFileUpload.version}]),ngFileUpload.service("Upload",["$parse","$timeout","$compile","$q","UploadExif",function(a,b,c,d,e){function f(a,b,c){var e=[i.emptyPromise()];return angular.forEach(a,function(d,f){0===d.type.indexOf("image/jpeg")&&i.attrGetter("ngfFixOrientation",b,c,{$file:d})&&e.push(i.happyPromise(i.applyExifRotation(d),d).then(function(b){a.splice(f,1,b)}))}),d.all(e)}function g(a,b,c){var e=i.attrGetter("ngfResize",b,c);if(!e||!i.isResizeSupported()||!a.length)return i.emptyPromise();if(!(e instanceof Function))return h(e,a,b,c);var f=d.defer();e(a).then(function(d){h(d,a,b,c).then(function(a){f.resolve(a)},function(a){f.reject(a)})},function(a){f.reject(a)})}function h(a,b,c,e){function f(d,f){if(0===d.type.indexOf("image")){if(a.pattern&&!i.validatePattern(d,a.pattern))return;var h=i.resize(d,a.width,a.height,a.quality,a.type,a.ratio,a.centerCrop,function(a,b){return i.attrGetter("ngfResizeIf",c,e,{$width:a,$height:b,$file:d})},a.restoreExif!==!1);g.push(h),h.then(function(a){b.splice(f,1,a)},function(a){d.$error="resize",d.$errorParam=(a?(a.message?a.message:a)+": ":"")+(d&&d.name)})}}for(var g=[i.emptyPromise()],h=0;h<b.length;h++)f(b[h],h);return d.all(g)}var i=e;return i.getAttrWithDefaults=function(a,b){if(null!=a[b])return a[b];var c=i.defaults[b];return null==c?c:angular.isString(c)?c:JSON.stringify(c)},i.attrGetter=function(b,c,d,e){var f=this.getAttrWithDefaults(c,b);if(!d)return f;try{return e?a(f)(d,e):a(f)(d)}catch(g){if(b.search(/min|max|pattern/i))return f;throw g}},i.shouldUpdateOn=function(a,b,c){var d=i.attrGetter("ngModelOptions",b,c);return d&&d.updateOn?d.updateOn.split(" ").indexOf(a)>-1:!0},i.emptyPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.resolve.apply(a,c)}),a.promise},i.rejectPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.reject.apply(a,c)}),a.promise},i.happyPromise=function(a,c){var e=d.defer();return a.then(function(a){e.resolve(a)},function(a){b(function(){throw a}),e.resolve(c)}),e.promise},i.updateModel=function(c,d,e,h,j,k,l){function m(f,g,j,l,m){d.$$ngfPrevValidFiles=f,d.$$ngfPrevInvalidFiles=g;var n=f&&f.length?f[0]:null,o=g&&g.length?g[0]:null;c&&(i.applyModelValidation(c,f),c.$setViewValue(m?n:f)),h&&a(h)(e,{$files:f,$file:n,$newFiles:j,$duplicateFiles:l,$invalidFiles:g,$invalidFile:o,$event:k});var p=i.attrGetter("ngfModelInvalid",d);p&&b(function(){a(p).assign(e,m?o:g)}),b(function(){})}function n(){function a(a,b){return a.name===b.name&&(a.$ngfOrigSize||a.size)===(b.$ngfOrigSize||b.size)&&a.type===b.type}function b(b){var c;for(c=0;c<s.length;c++)if(a(b,s[c]))return!0;for(c=0;c<t.length;c++)if(a(b,t[c]))return!0;return!1}if(j){r=[],u=[];for(var c=0;c<j.length;c++)b(j[c])?u.push(j[c]):r.push(j[c])}}function o(a){return angular.isArray(a)?a:[a]}function p(){w=[],v=[],angular.forEach(r,function(a){a.$error?v.push(a):w.push(a)})}function q(){function a(){b(function(){m(x?s.concat(w):w,x?t.concat(v):v,j,u,y)},A&&A.debounce?A.debounce.change||A.debounce:0)}g(z?r:w,d,e).then(function(){z?i.validate(r,s.length,c,d,e).then(function(){p(),a()}):a()},function(a){throw"Could not resize files "+a})}var r,s,t,u=[],v=[],w=[];s=d.$$ngfPrevValidFiles||[],t=d.$$ngfPrevInvalidFiles||[],c&&c.$modelValue&&(s=o(c.$modelValue));var x=i.attrGetter("ngfKeep",d,e);r=(j||[]).slice(0),("distinct"===x||i.attrGetter("ngfKeepDistinct",d,e)===!0)&&n(d,e);var y=!x&&!i.attrGetter("ngfMultiple",d,e)&&!i.attrGetter("multiple",d);if(!x||r.length){i.attrGetter("ngfBeforeModelChange",d,e,{$files:j,$file:j&&j.length?j[0]:null,$newFiles:r,$duplicateFiles:u,$event:k});var z=i.attrGetter("ngfValidateAfterResize",d,e),A=i.attrGetter("ngModelOptions",d,e);i.validate(r,s.length,c,d,e).then(function(){l?m(r,[],j,u,y):(A&&A.allowInvalid||z?w=r:p(),i.attrGetter("ngfFixOrientation",d,e)&&i.isExifSupported()?f(w,d,e).then(function(){q()}):q())})}},i}]),ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(a,b,c,d){function e(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=d.defaults.androidFixMinorVersion||4;return parseInt(b[1])<4||parseInt(b[1])===c&&parseInt(b[2])<c}return-1===a.indexOf("Chrome")&&/.*Windows.*Safari.*/.test(a)}function f(a,b,c,d,f,h,i,j){function k(){return"input"===b[0].tagName.toLowerCase()&&c.type&&"file"===c.type.toLowerCase()}function l(){return t("ngfChange")||t("ngfSelect")}function m(b){if(j.shouldUpdateOn("change",c,a)){for(var e=b.__files_||b.target&&b.target.files,f=[],g=0;g<e.length;g++)f.push(e[g]);j.updateModel(d,c,a,l(),f.length?f:null,b)}}function n(a){if(b!==a)for(var c=0;c<b[0].attributes.length;c++){var d=b[0].attributes[c];"type"!==d.name&&"class"!==d.name&&"style"!==d.name&&((null==d.value||""===d.value)&&("required"===d.name&&(d.value="required"),"multiple"===d.name&&(d.value="multiple")),a.attr(d.name,"id"===d.name?"ngf-"+d.value:d.value))}}function o(){if(k())return b;var a=angular.element('<input type="file">');n(a);var c=angular.element("<label>upload</label>");return c.css("visibility","hidden").css("position","absolute").css("overflow","hidden").css("width","0px").css("height","0px").css("border","none").css("margin","0px").css("padding","0px").attr("tabindex","-1"),g.push({el:b,ref:c}),document.body.appendChild(c.append(a)[0]),a}function p(c){if(b.attr("disabled"))return!1;if(!t("ngfSelectDisabled",a)){var d=q(c);if(null!=d)return d;r(c);try{k()||document.body.contains(w[0])||(g.push({el:b,ref:w.parent()}),document.body.appendChild(w.parent()[0]),w.bind("change",m))}catch(f){}return e(navigator.userAgent)?setTimeout(function(){w[0].click()},0):w[0].click(),!1}}function q(a){var b=a.changedTouches||a.originalEvent&&a.originalEvent.changedTouches;if("touchstart"===a.type)return v=b?b[0].clientY:0,!0;if(a.stopPropagation(),a.preventDefault(),"touchend"===a.type){var c=b?b[0].clientY:0;if(Math.abs(c-v)>20)return!1}}function r(b){j.shouldUpdateOn("click",c,a)&&w.val()&&(w.val(null),j.updateModel(d,c,a,l(),null,b,!0))}function s(a){if(w&&!w.attr("__ngf_ie10_Fix_")){if(!w[0].parentNode)return void(w=null);a.preventDefault(),a.stopPropagation(),w.unbind("click");var b=w.clone();return w.replaceWith(b),w=b,w.attr("__ngf_ie10_Fix_","true"),w.bind("change",m),w.bind("click",s),w[0].click(),!1}w.removeAttr("__ngf_ie10_Fix_")}var t=function(a,b){return j.attrGetter(a,c,b)};j.registerModelChangeValidator(d,c,a);var u=[];u.push(a.$watch(t("ngfMultiple"),function(){w.attr("multiple",t("ngfMultiple",a))})),u.push(a.$watch(t("ngfCapture"),function(){w.attr("capture",t("ngfCapture",a))})),u.push(a.$watch(t("ngfAccept"),function(){w.attr("accept",t("ngfAccept",a))})),c.$observe("accept",function(){w.attr("accept",t("accept"))}),u.push(function(){c.$$observers&&delete c.$$observers.accept});var v=0,w=b;k()||(w=o()),w.bind("change",m),k()?b.bind("click",r):b.bind("click touchstart touchend",p),-1!==navigator.appVersion.indexOf("MSIE 10")&&w.bind("click",s),d&&d.$formatters.push(function(a){return(null==a||0===a.length)&&w.val()&&w.val(null),a}),a.$on("$destroy",function(){k()||w.parent().remove(),angular.forEach(u,function(a){a()})}),h(function(){for(var a=0;a<g.length;a++){var b=g[a];document.body.contains(b.el[0])||(g.splice(a,1),b.ref.remove())}}),window.FileAPI&&window.FileAPI.ngfFixIE&&window.FileAPI.ngfFixIE(b,w,m)}var g=[];return{restrict:"AEC",require:"?ngModel",link:function(e,g,h,i){f(e,g,h,i,a,b,c,d)}}}]),function(){function a(a){return"img"===a.tagName.toLowerCase()?"image":"audio"===a.tagName.toLowerCase()?"audio":"video"===a.tagName.toLowerCase()?"video":/./}function b(b,c,d,e,f,g,h,i){function j(a){var g=b.attrGetter("ngfNoObjectUrl",f,d);b.dataUrl(a,g)["finally"](function(){c(function(){var b=(g?a.$ngfDataUrl:a.$ngfBlobUrl)||a.$ngfDataUrl;i?e.css("background-image","url('"+(b||"")+"')"):e.attr("src",b),b?e.removeClass("ng-hide"):e.addClass("ng-hide")})})}c(function(){var c=d.$watch(f[g],function(c){var d=h;if("ngfThumbnail"===g&&(d||(d={width:e[0].clientWidth,height:e[0].clientHeight}),0===d.width&&window.getComputedStyle)){var f=getComputedStyle(e[0]);d={width:parseInt(f.width.slice(0,-2)),height:parseInt(f.height.slice(0,-2))}}return angular.isString(c)?(e.removeClass("ng-hide"),i?e.css("background-image","url('"+c+"')"):e.attr("src",c)):void(!c||!c.type||0!==c.type.search(a(e[0]))||i&&0!==c.type.indexOf("image")?e.addClass("ng-hide"):d&&b.isResizeSupported()?b.resize(c,d.width,d.height,d.quality).then(function(a){j(a)},function(a){throw a}):j(c))});d.$on("$destroy",function(){c()})})}ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout","$q",function(a,b,c){var d=a;return d.base64DataUrl=function(a){if(angular.isArray(a)){var b=c.defer(),e=0;return angular.forEach(a,function(c){d.dataUrl(c,!0)["finally"](function(){if(e++,e===a.length){var c=[];angular.forEach(a,function(a){c.push(a.$ngfDataUrl)}),b.resolve(c,a)}})}),b.promise}return d.dataUrl(a,!0)},d.dataUrl=function(a,e){if(!a)return d.emptyPromise(a,a);if(e&&null!=a.$ngfDataUrl||!e&&null!=a.$ngfBlobUrl)return d.emptyPromise(e?a.$ngfDataUrl:a.$ngfBlobUrl,a);var f=e?a.$$ngfDataUrlPromise:a.$$ngfBlobUrlPromise;if(f)return f;var g=c.defer();return b(function(){if(window.FileReader&&a&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 8")||a.size<2e4)&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 9")||a.size<4e6)){var c=window.URL||window.webkitURL;if(c&&c.createObjectURL&&!e){var f;try{f=c.createObjectURL(a)}catch(h){return void b(function(){a.$ngfBlobUrl="",g.reject()})}b(function(){if(a.$ngfBlobUrl=f,f){g.resolve(f,a),d.blobUrls=d.blobUrls||[],d.blobUrlsTotalSize=d.blobUrlsTotalSize||0,d.blobUrls.push({url:f,size:a.size}),d.blobUrlsTotalSize+=a.size||0;for(var b=d.defaults.blobUrlsMaxMemory||268435456,e=d.defaults.blobUrlsMaxQueueSize||200;(d.blobUrlsTotalSize>b||d.blobUrls.length>e)&&d.blobUrls.length>1;){var h=d.blobUrls.splice(0,1)[0];c.revokeObjectURL(h.url),d.blobUrlsTotalSize-=h.size}}})}else{var i=new FileReader;i.onload=function(c){b(function(){a.$ngfDataUrl=c.target.result,g.resolve(c.target.result,a),b(function(){delete a.$ngfDataUrl},1e3)})},i.onerror=function(){b(function(){a.$ngfDataUrl="",g.reject()})},i.readAsDataURL(a)}}else b(function(){a[e?"$ngfDataUrl":"$ngfBlobUrl"]="",g.reject()})}),f=e?a.$$ngfDataUrlPromise=g.promise:a.$$ngfBlobUrlPromise=g.promise,f["finally"](function(){delete a[e?"$$ngfDataUrlPromise":"$$ngfBlobUrlPromise"]}),f},d}]),ngFileUpload.directive("ngfSrc",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfSrc",a.attrGetter("ngfResize",f,d),!1)}}}]),ngFileUpload.directive("ngfBackground",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfBackground",a.attrGetter("ngfResize",f,d),!0)}}}]),ngFileUpload.directive("ngfThumbnail",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){var g=a.attrGetter("ngfSize",f,d);b(a,c,d,e,f,"ngfThumbnail",g,a.attrGetter("ngfAsBackground",f,d))}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist&&a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/),a.aHrefSanitizationWhitelist&&a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d,e){if(angular.isString(c))return b.trustAsResourceUrl(c);var f=c&&((d?c.$ngfDataUrl:c.$ngfBlobUrl)||c.$ngfDataUrl);return c&&!f?(!c.$ngfDataUrlFilterInProgress&&angular.isObject(c)&&(c.$ngfDataUrlFilterInProgress=!0,a.dataUrl(c,d)),""):(c&&delete c.$ngfDataUrlFilterInProgress,(c&&f?e?b.trustAsResourceUrl(f):f:c)||"")}}])}(),ngFileUpload.service("UploadValidate",["UploadDataUrl","$q","$timeout",function(a,b,c){function d(a){var b="",c=[];if(a.length>2&&"/"===a[0]&&"/"===a[a.length-1])b=a.substring(1,a.length-1);else{var e=a.split(",");if(e.length>1)for(var f=0;f<e.length;f++){var g=d(e[f]);g.regexp?(b+="("+g.regexp+")",f<e.length-1&&(b+="|")):c=c.concat(g.excludes)}else 0===a.indexOf("!")?c.push("^((?!"+d(a.substring(1)).regexp+").)*$"):(0===a.indexOf(".")&&(a="*"+a),b="^"+a.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",b=b.replace(/\\\*/g,".*").replace(/\\\?/g,"."))}return{regexp:b,excludes:c}}function e(a,b){null==b||a.$dirty||(a.$setDirty?a.$setDirty():a.$dirty=!0)}var f=a;return f.validatePattern=function(a,b){if(!b)return!0;var c=d(b),e=!0;if(c.regexp&&c.regexp.length){var f=new RegExp(c.regexp,"i");e=null!=a.type&&f.test(a.type)||null!=a.name&&f.test(a.name)}for(var g=c.excludes.length;g--;){var h=new RegExp(c.excludes[g],"i");e=e&&(null==a.type||h.test(a.type))&&(null==a.name||h.test(a.name))}return e},f.ratioToFloat=function(a){var b=a.toString(),c=b.search(/[x:]/i);return b=c>-1?parseFloat(b.substring(0,c))/parseFloat(b.substring(c+1)):parseFloat(b)},f.registerModelChangeValidator=function(a,b,c){a&&a.$formatters.push(function(d){a.$dirty&&(d&&!angular.isArray(d)&&(d=[d]),f.validate(d,0,a,b,c).then(function(){f.applyModelValidation(a,d)}))})},f.applyModelValidation=function(a,b){e(a,b),angular.forEach(a.$ngfValidations,function(b){a.$setValidity(b.name,b.valid)})},f.getValidationAttr=function(a,b,c,d,e){var g="ngf"+c[0].toUpperCase()+c.substr(1),h=f.attrGetter(g,a,b,{$file:e});if(null==h&&(h=f.attrGetter("ngfValidate",a,b,{$file:e}))){var i=(d||c).split(".");h=h[i[0]],i.length>1&&(h=h&&h[i[1]])}return h},f.validate=function(a,c,d,e,g){function h(b,c,h){if(a){for(var i=a.length,j=null;i--;){var k=a[i];if(k){var l=f.getValidationAttr(e,g,b,c,k);null!=l&&(h(k,l,i)||(k.$error=b,(k.$errorMessages=k.$errorMessages||{})[b]=!0,k.$errorParam=l,a.splice(i,1),j=!1))}}null!==j&&d.$ngfValidations.push({name:b,valid:j})}}function i(c,h,i,k,l){function m(a,b,d){null!=d?k(b,d).then(function(e){l(e,d)?a.resolve():(b.$error=c,(b.$errorMessages=b.$errorMessages||{})[c]=!0,b.$errorParam=d,a.reject())},function(){j("ngfValidateForce",{$file:b})?(b.$error=c,(b.$errorMessages=b.$errorMessages||{})[c]=!0,b.$errorParam=d,a.reject()):a.resolve()}):a.resolve()}var n=[f.emptyPromise()];return a?(a=void 0===a.length?[a]:a,angular.forEach(a,function(a){var d=b.defer();return n.push(d.promise),!i||null!=a.type&&0===a.type.search(i)?void("dimensions"===c&&null!=f.attrGetter("ngfDimensions",e)?f.imageDimensions(a).then(function(b){m(d,a,j("ngfDimensions",{$file:a,$width:b.width,$height:b.height}))},function(){d.reject()}):"duration"===c&&null!=f.attrGetter("ngfDuration",e)?f.mediaDuration(a).then(function(b){m(d,a,j("ngfDuration",{$file:a,$duration:b}))},function(){d.reject()}):m(d,a,f.getValidationAttr(e,g,c,h,a))):void d.resolve()}),b.all(n).then(function(){d.$ngfValidations.push({name:c,valid:!0})},function(){d.$ngfValidations.push({name:c,valid:!1})})):void 0}d=d||{},d.$ngfValidations=d.$ngfValidations||[],angular.forEach(d.$ngfValidations,function(a){a.valid=!0});var j=function(a,b){return f.attrGetter(a,e,g,b)};if(null==a||0===a.length)return f.emptyPromise(d);a=void 0===a.length?[a]:a.slice(0),h("maxFiles",null,function(a,b,d){return b>c+d}),h("pattern",null,f.validatePattern),h("minSize","size.min",function(a,b){return a.size+.1>=f.translateScalars(b)}),h("maxSize","size.max",function(a,b){return a.size-.1<=f.translateScalars(b)});var k=0;if(h("maxTotalSize",null,function(b,c){return k+=b.size,k>f.translateScalars(c)?(a.splice(0,a.length),!1):!0}),h("validateFn",null,function(a,b){return b===!0||null===b||""===b}),!a.length)return f.emptyPromise(d,d.$ngfValidations);var l=b.defer(),m=[];return m.push(f.happyPromise(i("maxHeight","height.max",/image/,this.imageDimensions,function(a,b){return a.height<=b}))),m.push(f.happyPromise(i("minHeight","height.min",/image/,this.imageDimensions,function(a,b){return a.height>=b}))),m.push(f.happyPromise(i("maxWidth","width.max",/image/,this.imageDimensions,function(a,b){return a.width<=b}))),m.push(f.happyPromise(i("minWidth","width.min",/image/,this.imageDimensions,function(a,b){return a.width>=b}))),m.push(f.happyPromise(i("dimensions",null,/image/,function(a,b){return f.emptyPromise(b)},function(a){return a}))),m.push(f.happyPromise(i("ratio",null,/image/,this.imageDimensions,function(a,b){for(var c=b.toString().split(","),d=!1,e=0;e<c.length;e++)Math.abs(a.width/a.height-f.ratioToFloat(c[e]))<1e-4&&(d=!0);return d}))),m.push(f.happyPromise(i("maxRatio","ratio.max",/image/,this.imageDimensions,function(a,b){return a.width/a.height-f.ratioToFloat(b)<1e-4}))),m.push(f.happyPromise(i("minRatio","ratio.min",/image/,this.imageDimensions,function(a,b){return a.width/a.height-f.ratioToFloat(b)>-1e-4}))),m.push(f.happyPromise(i("maxDuration","duration.max",/audio|video/,this.mediaDuration,function(a,b){return a<=f.translateScalars(b)}))),m.push(f.happyPromise(i("minDuration","duration.min",/audio|video/,this.mediaDuration,function(a,b){return a>=f.translateScalars(b)}))),m.push(f.happyPromise(i("duration",null,/audio|video/,function(a,b){return f.emptyPromise(b)},function(a){return a}))),m.push(f.happyPromise(i("validateAsyncFn",null,null,function(a,b){return b},function(a){return a===!0||null===a||""===a}))),b.all(m).then(function(){l.resolve(d,d.$ngfValidations)})},f.imageDimensions=function(a){if(a.$ngfWidth&&a.$ngfHeight){var d=b.defer();return c(function(){d.resolve({width:a.$ngfWidth,height:a.$ngfHeight})}),d.promise}if(a.$ngfDimensionPromise)return a.$ngfDimensionPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("image")?void e.reject("not image"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].clientWidth,c=h[0].clientHeight;h.remove(),a.$ngfWidth=b,a.$ngfHeight=c,e.resolve({width:b,height:c})}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].clientWidth?d():i>10?f():g())},1e3)}var h=angular.element("<img>").attr("src",b).css("visibility","hidden").css("position","fixed").css("max-width","none !important").css("max-height","none !important");h.on("load",d),h.on("error",f);var i=0;g(),angular.element(document.getElementsByTagName("body")[0]).append(h)},function(){e.reject("load error")})}),a.$ngfDimensionPromise=e.promise,a.$ngfDimensionPromise["finally"](function(){delete a.$ngfDimensionPromise}),a.$ngfDimensionPromise},f.mediaDuration=function(a){if(a.$ngfDuration){var d=b.defer();return c(function(){d.resolve(a.$ngfDuration)}),d.promise}if(a.$ngfDurationPromise)return a.$ngfDurationPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?void e.reject("not media"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].duration;a.$ngfDuration=b,h.remove(),e.resolve(b);
1060-
1061-}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].duration?d():i>10?f():g())},1e3)}var h=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",b).css("visibility","none").css("position","fixed");h.on("loadedmetadata",d),h.on("error",f);var i=0;g(),angular.element(document.body).append(h)},function(){e.reject("load error")})}),a.$ngfDurationPromise=e.promise,a.$ngfDurationPromise["finally"](function(){delete a.$ngfDurationPromise}),a.$ngfDurationPromise},f}]),ngFileUpload.service("UploadResize",["UploadValidate","$q",function(a,b){var c=a,d=function(a,b,c,d,e){var f=e?Math.max(c/a,d/b):Math.min(c/a,d/b);return{width:a*f,height:b*f,marginX:a*f-c,marginY:b*f-d}},e=function(a,e,f,g,h,i,j,k){var l=b.defer(),m=document.createElement("canvas"),n=document.createElement("img");return n.onload=function(){if(null!=k&&k(n.width,n.height)===!1)return void l.reject("resizeIf");try{if(i){var a=c.ratioToFloat(i),b=n.width/n.height;a>b?(e=n.width,f=e/a):(f=n.height,e=f*a)}e||(e=n.width),f||(f=n.height);var o=d(n.width,n.height,e,f,j);m.width=Math.min(o.width,e),m.height=Math.min(o.height,f);var p=m.getContext("2d");p.drawImage(n,Math.min(0,-o.marginX/2),Math.min(0,-o.marginY/2),o.width,o.height),l.resolve(m.toDataURL(h||"image/WebP",g||.934))}catch(q){l.reject(q)}},n.onerror=function(){l.reject()},n.src=a,l.promise};return c.dataUrltoBlob=function(a,b,c){for(var d=a.split(","),e=d[0].match(/:(.*?);/)[1],f=atob(d[1]),g=f.length,h=new Uint8Array(g);g--;)h[g]=f.charCodeAt(g);var i=new window.Blob([h],{type:e});return i.name=b,i.$ngfOrigSize=c,i},c.isResizeSupported=function(){var a=document.createElement("canvas");return window.atob&&a.getContext&&a.getContext("2d")&&window.Blob},c.isResizeSupported()&&Object.defineProperty(window.Blob.prototype,"name",{get:function(){return this.$ngfName},set:function(a){this.$ngfName=a},configurable:!0}),c.resize=function(a,d,f,g,h,i,j,k,l){if(0!==a.type.indexOf("image"))return c.emptyPromise(a);var m=b.defer();return c.dataUrl(a,!0).then(function(b){e(b,d,f,g,h||a.type,i,j,k).then(function(d){if("image/jpeg"===a.type&&l)try{d=c.restoreExif(b,d)}catch(e){setTimeout(function(){throw e},1)}try{var f=c.dataUrltoBlob(d,a.name,a.size);m.resolve(f)}catch(e){m.reject(e)}},function(b){"resizeIf"===b&&m.resolve(a),m.reject(b)})},function(a){m.reject(a)}),m.promise},c}]),function(){function a(a,c,d,e,f,g,h,i,j,k){function l(){return c.attr("disabled")||r("ngfDropDisabled",a)}function m(b,c){i.updateModel(e,d,a,r("ngfChange")||r("ngfDrop"),b,c)}function n(b,c){if(!i.shouldUpdateOn(b,d,a)||!c)return i.rejectPromise([]);var e=[];c.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi,function(a,b,c){e.push(c)});var f=[],g=[];if(e.length){angular.forEach(e,function(a){f.push(i.urlToBlob(a).then(function(a){g.push(a)}))});var h=k.defer();return k.all(f).then(function(){h.resolve(g)},function(a){h.reject(a)}),h.promise}return i.emptyPromise()}function o(a,b,c,d){var e=r("ngfDragOverClass",a,{$event:c}),f="dragover";if(angular.isString(e))f=e;else if(e&&(e.delay&&(v=e.delay),e.accept||e.reject)){var g=c.dataTransfer.items;if(null!=g&&g.length)for(var h=e.pattern||r("ngfPattern",a,{$event:c}),j=g.length;j--;){if(!i.validatePattern(g[j],h)){f=e.reject;break}f=e.accept}else f=e.accept}d(f)}function p(b,c,e,f){function g(a,b){var c=k.defer();if(null!=a)if(a.isDirectory){var d=[i.emptyPromise()];if(m){var e={type:"directory"};e.name=e.path=(b||"")+a.name+a.name,n.push(e)}var f=a.createReader(),h=[],p=function(){f.readEntries(function(e){try{e.length?(h=h.concat(Array.prototype.slice.call(e||[],0)),p()):(angular.forEach(h.slice(0),function(c){n.length<=j&&l>=o&&d.push(g(c,(b?b:"")+a.name+"/"))}),k.all(d).then(function(){c.resolve()},function(a){c.reject(a)}))}catch(f){c.reject(f)}},function(a){c.reject(a)})};p()}else a.file(function(a){try{a.path=(b?b:"")+a.name,m&&(a=i.rename(a,a.path)),n.push(a),o+=a.size,c.resolve()}catch(d){c.reject(d)}},function(a){c.reject(a)});return c.promise}var j=i.getValidationAttr(d,a,"maxFiles")||Number.MAX_VALUE,l=i.getValidationAttr(d,a,"maxTotalSize")||Number.MAX_VALUE,m=r("ngfIncludeDir",a),n=[],o=0,p=[i.emptyPromise()];if(b&&b.length>0&&"file"!==h.protocol())for(var q=0;q<b.length;q++){if(b[q].webkitGetAsEntry&&b[q].webkitGetAsEntry()&&b[q].webkitGetAsEntry().isDirectory){var s=b[q].webkitGetAsEntry();if(s.isDirectory&&!e)continue;null!=s&&p.push(g(s))}else{var t=b[q].getAsFile();null!=t&&(n.push(t),o+=t.size)}if(n.length>j||o>l||!f&&n.length>0)break}else if(null!=c)for(var u=0;u<c.length;u++){var v=c.item(u);if((v.type||v.size>0)&&(n.push(v),o+=v.size),n.length>j||o>l||!f&&n.length>0)break}var w=k.defer();return k.all(p).then(function(){if(f||m||!n.length)w.resolve(n);else{for(var a=0;n[a]&&"directory"===n[a].type;)a++;w.resolve([n[a]])}},function(a){w.reject(a)}),w.promise}var q=b(),r=function(a,b,c){return i.attrGetter(a,d,b,c)};if(r("dropAvailable")&&g(function(){a[r("dropAvailable")]?a[r("dropAvailable")].value=q:a[r("dropAvailable")]=q}),!q)return void(r("ngfHideOnDropNotAvailable",a)===!0&&c.css("display","none"));null==r("ngfSelect")&&i.registerModelChangeValidator(e,d,a);var s,t=null,u=f(r("ngfStopPropagation")),v=1;c[0].addEventListener("dragover",function(b){if(!l()&&i.shouldUpdateOn("drop",d,a)){if(b.preventDefault(),u(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var e=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===e||"linkMove"===e?"move":"copy"}g.cancel(t),s||(s="C",o(a,d,b,function(d){s=d,c.addClass(s),r("ngfDrag",a,{$isDragging:!0,$class:s,$event:b})}))}},!1),c[0].addEventListener("dragenter",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),u(a)&&b.stopPropagation())},!1),c[0].addEventListener("dragleave",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),u(a)&&b.stopPropagation(),t=g(function(){s&&c.removeClass(s),s=null,r("ngfDrag",a,{$isDragging:!1,$event:b})},v||100))},!1),c[0].addEventListener("drop",function(b){if(!l()&&i.shouldUpdateOn("drop",d,a)){b.preventDefault(),u(a)&&b.stopPropagation(),s&&c.removeClass(s),s=null;var e,f=b.dataTransfer.items;try{e=b.dataTransfer&&b.dataTransfer.getData&&b.dataTransfer.getData("text/html")}catch(g){}p(f,b.dataTransfer.files,r("ngfAllowDir",a)!==!1,r("multiple")||r("ngfMultiple",a)).then(function(a){a.length?m(a,b):n("dropUrl",e).then(function(a){m(a,b)})})}},!1),c[0].addEventListener("paste",function(b){if(navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&r("ngfEnableFirefoxPaste",a)&&b.preventDefault(),!l()&&i.shouldUpdateOn("paste",d,a)){var c=[],e=b.clipboardData||b.originalEvent.clipboardData;if(e&&e.items)for(var f=0;f<e.items.length;f++)-1!==e.items[f].type.indexOf("image")&&c.push(e.items[f].getAsFile());c.length?m(c,b):n("pasteUrl",e).then(function(a){m(a,b)})}},!1),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&r("ngfEnableFirefoxPaste",a)&&(c.attr("contenteditable",!0),c.on("keypress",function(a){a.metaKey||a.ctrlKey||a.preventDefault()}))}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a&&!/Edge\/12./i.test(navigator.userAgent)}ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload","$http","$q",function(b,c,d,e,f,g){return{restrict:"AEC",require:"?ngModel",link:function(h,i,j,k){a(h,i,j,k,b,c,d,e,f,g)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(a,c,d){return function(e,f,g){if(b()){var h=a(d.attrGetter("ngfDropAvailable",g));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(),ngFileUpload.service("UploadExif",["UploadResize","$q",function(a,b){function c(a,b,c,d){switch(b){case 2:return a.transform(-1,0,0,1,c,0);case 3:return a.transform(-1,0,0,-1,c,d);case 4:return a.transform(1,0,0,-1,0,d);case 5:return a.transform(0,1,1,0,0,0);case 6:return a.transform(0,1,-1,0,d,0);case 7:return a.transform(0,-1,-1,0,d,c);case 8:return a.transform(0,-1,1,0,0,c)}}function d(a){for(var b="",c=new Uint8Array(a),d=c.byteLength,e=0;d>e;e++)b+=String.fromCharCode(c[e]);return window.btoa(b)}var e=a;return e.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&e.isResizeSupported()},e.readOrientation=function(a){var c=b.defer(),d=new FileReader,e=a.slice?a.slice(0,65536):a;return d.readAsArrayBuffer(e),d.onerror=function(a){return c.reject(a)},d.onload=function(a){var b={orientation:1},d=new DataView(this.result);if(65496!==d.getUint16(0,!1))return c.resolve(b);for(var e=d.byteLength,f=2;e>f;){var g=d.getUint16(f,!1);if(f+=2,65505===g){if(1165519206!==d.getUint32(f+=2,!1))return c.resolve(b);var h=18761===d.getUint16(f+=6,!1);f+=d.getUint32(f+4,h);var i=d.getUint16(f,h);f+=2;for(var j=0;i>j;j++)if(274===d.getUint16(f+12*j,h)){var k=d.getUint16(f+12*j+8,h);return k>=2&&8>=k&&(d.setUint16(f+12*j+8,1,h),b.fixedArrayBuffer=a.target.result),b.orientation=k,c.resolve(b)}}else{if(65280!==(65280&g))break;f+=d.getUint16(f,!1)}}return c.resolve(b)},c.promise},e.applyExifRotation=function(a){if(0!==a.type.indexOf("image/jpeg"))return e.emptyPromise(a);var f=b.defer();return e.readOrientation(a).then(function(b){return b.orientation<2||b.orientation>8?f.resolve(a):void e.dataUrl(a,!0).then(function(g){var h=document.createElement("canvas"),i=document.createElement("img");i.onload=function(){try{h.width=b.orientation>4?i.height:i.width,h.height=b.orientation>4?i.width:i.height;var g=h.getContext("2d");c(g,b.orientation,i.width,i.height),g.drawImage(i,0,0);var j=h.toDataURL(a.type||"image/WebP",.934);j=e.restoreExif(d(b.fixedArrayBuffer),j);var k=e.dataUrltoBlob(j,a.name);f.resolve(k)}catch(l){return f.reject(l)}},i.onerror=function(){f.reject()},i.src=g},function(a){f.reject(a)})},function(a){f.reject(a)}),f.promise},e.restoreExif=function(a,b){var c={};return c.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c.encode64=function(a){var b,c,d,e,f,g="",h="",i="",j=0;do b=a[j++],c=a[j++],h=a[j++],d=b>>2,e=(3&b)<<4|c>>4,f=(15&c)<<2|h>>6,i=63&h,isNaN(c)?f=i=64:isNaN(h)&&(i=64),g=g+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(e)+this.KEY_STR.charAt(f)+this.KEY_STR.charAt(i),b=c=h="",d=e=f=i="";while(j<a.length);return g},c.restore=function(a,b){a.match("data:image/jpeg;base64,")&&(a=a.replace("data:image/jpeg;base64,",""));var c=this.decode64(a),d=this.slice2Segments(c),e=this.exifManipulation(b,d);return"data:image/jpeg;base64,"+this.encode64(e)},c.exifManipulation=function(a,b){var c=this.getExifArray(b),d=this.insertExif(a,c);return new Uint8Array(d)},c.getExifArray=function(a){for(var b,c=0;c<a.length;c++)if(b=a[c],255===b[0]&225===b[1])return b;return[]},c.insertExif=function(a,b){var c=a.replace("data:image/jpeg;base64,",""),d=this.decode64(c),e=d.indexOf(255,3),f=d.slice(0,e),g=d.slice(e),h=f;return h=h.concat(b),h=h.concat(g)},c.slice2Segments=function(a){for(var b=0,c=[];;){if(255===a[b]&218===a[b+1])break;if(255===a[b]&216===a[b+1])b+=2;else{var d=256*a[b+2]+a[b+3],e=b+d+2,f=a.slice(b,e);c.push(f),b=e}if(b>a.length)break}return c},c.decode64=function(a){var b,c,d,e,f,g="",h="",i=0,j=[],k=/[^A-Za-z0-9\+\/\=]/g;k.exec(a)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."),a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do d=this.KEY_STR.indexOf(a.charAt(i++)),e=this.KEY_STR.indexOf(a.charAt(i++)),f=this.KEY_STR.indexOf(a.charAt(i++)),h=this.KEY_STR.indexOf(a.charAt(i++)),b=d<<2|e>>4,c=(15&e)<<4|f>>2,g=(3&f)<<6|h,j.push(b),64!==f&&j.push(c),64!==h&&j.push(g),b=c=g="",d=e=f=h="";while(i<a.length);return j},c.restore(a,b)},e}]);
1062\ No newline at end of file
1063+/*! 12.2.13 */
1064+!function(){function a(a,b){window.XMLHttpRequest.prototype[a]=b(window.XMLHttpRequest.prototype[a])}function b(a,b,c){try{Object.defineProperty(a,b,{get:c})}catch(d){}}if(window.FileAPI||(window.FileAPI={}),!window.XMLHttpRequest)throw"AJAX is not supported. XMLHttpRequest is not defined.";if(FileAPI.shouldLoad=!window.FormData||FileAPI.forceLoad,FileAPI.shouldLoad){var c=function(a){if(!a.__listeners){a.upload||(a.upload={}),a.__listeners=[];var b=a.upload.addEventListener;a.upload.addEventListener=function(c,d){a.__listeners[c]=d,b&&b.apply(this,arguments)}}};a("open",function(a){return function(b,d,e){c(this),this.__url=d;try{a.apply(this,[b,d,e])}catch(f){f.message.indexOf("Access is denied")>-1&&(this.__origError=f,a.apply(this,[b,"_fix_for_ie_crossdomain__",e]))}}}),a("getResponseHeader",function(a){return function(b){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(b):null==a?null:a.apply(this,[b])}}),a("getAllResponseHeaders",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==a?null:a.apply(this)}}),a("abort",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==a?null:a.apply(this)}}),a("setRequestHeader",function(a){return function(b,d){if("__setXHR_"===b){c(this);var e=d(this);e instanceof Function&&e(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[b]=d,a.apply(this,arguments)}}),a("send",function(a){return function(){var c=this;if(arguments[0]&&arguments[0].__isFileAPIShim){var d=arguments[0],e={url:c.__url,jsonp:!1,cache:!0,complete:function(a,d){a&&angular.isString(a)&&-1!==a.indexOf("#2174")&&(a=null),c.__completed=!0,!a&&c.__listeners.load&&c.__listeners.load({type:"load",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),!a&&c.__listeners.loadend&&c.__listeners.loadend({type:"loadend",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),"abort"===a&&c.__listeners.abort&&c.__listeners.abort({type:"abort",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),void 0!==d.status&&b(c,"status",function(){return 0===d.status&&a&&"abort"!==a?500:d.status}),void 0!==d.statusText&&b(c,"statusText",function(){return d.statusText}),b(c,"readyState",function(){return 4}),void 0!==d.response&&b(c,"response",function(){return d.response});var e=d.responseText||(a&&0===d.status&&"abort"!==a?a:void 0);b(c,"responseText",function(){return e}),b(c,"response",function(){return e}),a&&b(c,"err",function(){return a}),c.__fileApiXHR=d,c.onreadystatechange&&c.onreadystatechange(),c.onload&&c.onload()},progress:function(a){if(a.target=c,c.__listeners.progress&&c.__listeners.progress(a),c.__total=a.total,c.__loaded=a.loaded,a.total===a.loaded){var b=this;setTimeout(function(){c.__completed||(c.getAllResponseHeaders=function(){},b.complete(null,{status:204,statusText:"No Content"}))},FileAPI.noContentTimeout||1e4)}},headers:c.__requestHeaders};e.data={},e.files={};for(var f=0;f<d.data.length;f++){var g=d.data[f];null!=g.val&&null!=g.val.name&&null!=g.val.size&&null!=g.val.type?e.files[g.key]=g.val:e.data[g.key]=g.val}setTimeout(function(){if(!FileAPI.hasFlash)throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';c.__fileApiXHR=FileAPI.upload(e)},1)}else{if(this.__origError)throw this.__origError;a.apply(c,arguments)}}}),window.XMLHttpRequest.__isFileAPIShim=!0,window.FormData=FormData=function(){return{append:function(a,b,c){b.__isFileAPIBlobShim&&(b=b.data[0]),this.data.push({key:a,val:b,name:c})},data:[],__isFileAPIShim:!0}},window.Blob=Blob=function(a){return{data:a,__isFileAPIBlobShim:!0}}}}(),function(){function a(a){return"input"===a[0].tagName.toLowerCase()&&a.attr("type")&&"file"===a.attr("type").toLowerCase()}function b(){try{var a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(a)return!0}catch(b){if(void 0!==navigator.mimeTypes["application/x-shockwave-flash"])return!0}return!1}function c(a){var b=0,c=0;if(window.jQuery)return jQuery(a).offset();if(a.offsetParent)do b+=a.offsetLeft-a.scrollLeft,c+=a.offsetTop-a.scrollTop,a=a.offsetParent;while(a);return{left:b,top:c}}if(FileAPI.shouldLoad){if(FileAPI.hasFlash=b(),FileAPI.forceLoad&&(FileAPI.html5=!1),!FileAPI.upload){var d,e,f,g,h,i=document.createElement("script"),j=document.getElementsByTagName("script");if(window.FileAPI.jsUrl)d=window.FileAPI.jsUrl;else if(window.FileAPI.jsPath)e=window.FileAPI.jsPath;else for(f=0;f<j.length;f++)if(h=j[f].src,g=h.search(/\/ng\-file\-upload[\-a-zA-z0-9\.]*\.js/),g>-1){e=h.substring(0,g+1);break}null==FileAPI.staticPath&&(FileAPI.staticPath=e),i.setAttribute("src",d||e+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(i)}FileAPI.ngfFixIE=function(d,e,f){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var g=function(){var b=e.parent();d.attr("disabled")?b&&b.removeClass("js-fileapi-wrapper"):(e.attr("__ngf_flash_")||(e.unbind("change"),e.unbind("click"),e.bind("change",function(a){h.apply(this,[a]),f.apply(this,[a])}),e.attr("__ngf_flash_","true")),b.addClass("js-fileapi-wrapper"),a(d)||(b.css("position","absolute").css("top",c(d[0]).top+"px").css("left",c(d[0]).left+"px").css("width",d[0].offsetWidth+"px").css("height",d[0].offsetHeight+"px").css("filter","alpha(opacity=0)").css("display",d.css("display")).css("overflow","hidden").css("z-index","900000").css("visibility","visible"),e.css("width",d[0].offsetWidth+"px").css("height",d[0].offsetHeight+"px").css("position","absolute").css("top","0px").css("left","0px")))};d.bind("mouseenter",g);var h=function(a){for(var b=FileAPI.getFiles(a),c=0;c<b.length;c++)void 0===b[c].size&&(b[c].size=0),void 0===b[c].name&&(b[c].name="file"),void 0===b[c].type&&(b[c].type="undefined");a.target||(a.target={}),a.target.files=b,a.target.files!==b&&(a.__files_=b),(a.__files_||a.target.files).item=function(b){return(a.__files_||a.target.files)[b]||null}}},FileAPI.disableFileInput=function(a,b){b?a.removeClass("js-fileapi-wrapper"):a.addClass("js-fileapi-wrapper")}}}(),window.FileReader||(window.FileReader=function(){var a=this,b=!1;this.listeners={},this.addEventListener=function(b,c){a.listeners[b]=a.listeners[b]||[],a.listeners[b].push(c)},this.removeEventListener=function(b,c){a.listeners[b]&&a.listeners[b].splice(a.listeners[b].indexOf(c),1)},this.dispatchEvent=function(b){var c=a.listeners[b.type];if(c)for(var d=0;d<c.length;d++)c[d].call(a,b)},this.onabort=this.onerror=this.onload=this.onloadstart=this.onloadend=this.onprogress=null;var c=function(b,c){var d={type:b,target:a,loaded:c.loaded,total:c.total,error:c.error};return null!=c.result&&(d.target.result=c.result),d},d=function(d){b||(b=!0,a.onloadstart&&a.onloadstart(c("loadstart",d)));var e;"load"===d.type?(a.onloadend&&a.onloadend(c("loadend",d)),e=c("load",d),a.onload&&a.onload(e),a.dispatchEvent(e)):"progress"===d.type?(e=c("progress",d),a.onprogress&&a.onprogress(e),a.dispatchEvent(e)):(e=c("error",d),a.onerror&&a.onerror(e),a.dispatchEvent(e))};this.readAsDataURL=function(a){FileAPI.readAsDataURL(a,d)},this.readAsText=function(a){FileAPI.readAsText(a,d)}}),!window.XMLHttpRequest||window.FileAPI&&FileAPI.shouldLoad||(window.XMLHttpRequest.prototype.setRequestHeader=function(a){return function(b,c){if("__setXHR_"===b){var d=c(this);d instanceof Function&&d(this)}else a.apply(this,arguments)}}(window.XMLHttpRequest.prototype.setRequestHeader));var ngFileUpload=angular.module("ngFileUpload",[]);ngFileUpload.version="12.2.13",ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){function e(a){j.notify&&j.notify(a),k.progressFunc&&c(function(){k.progressFunc(a)})}function h(a){return null!=d._start&&g?{loaded:a.loaded+d._start,total:d._file&&d._file.size||a.total,type:a.type,config:d,lengthComputable:!0,target:a.target}:a}function i(){a(d).then(function(a){if(g&&d._chunkSize&&!d._finished&&d._file){var b=d._file&&d._file.size||0;e({loaded:Math.min(d._end,b),total:b,config:d,type:"progress"}),f.upload(d,!0)}else d._finished&&delete d._finished,j.resolve(a)},function(a){j.reject(a)},function(a){j.notify(a)})}d.method=d.method||"POST",d.headers=d.headers||{};var j=d._deferred=d._deferred||b.defer(),k=j.promise;return d.disableProgress||(d.headers.__setXHR_=function(){return function(a){a&&a.upload&&a.upload.addEventListener&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e(h(a))},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e(h(a)))},!1))}}),g?d._chunkSize&&d._end&&!d._finished?(d._start=d._end,d._end+=d._chunkSize,i()):d.resumeSizeUrl?a.get(d.resumeSizeUrl).then(function(a){d._start=d.resumeSizeResponseReader?d.resumeSizeResponseReader(a.data):parseInt((null==a.data.size?a.data:a.data.size).toString()),d._chunkSize&&(d._end=d._start+d._chunkSize),i()},function(a){throw a}):d.resumeSize?d.resumeSize().then(function(a){d._start=a,d._chunkSize&&(d._end=d._start+d._chunkSize),i()},function(a){throw a}):(d._chunkSize&&(d._start=0,d._end=d._start+d._chunkSize),i()):i(),k.success=function(a){return k.then(function(b){a(b.data,b.status,b.headers,d)}),k},k.error=function(a){return k.then(null,function(b){a(b.data,b.status,b.headers,d)}),k},k.progress=function(a){return k.progressFunc=a,k.then(null,null,function(b){a(b)}),k},k.abort=k.pause=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),k},k.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(k,arguments),a.apply(k,arguments)}}(d.xhrFn),k},f.promisesCount++,k["finally"]&&k["finally"]instanceof Function&&k["finally"](function(){f.promisesCount--}),k}function e(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}var f=this;f.promisesCount=0,this.isResumeSupported=function(){return window.Blob&&window.Blob.prototype.slice};var g=this.isResumeSupported();this.isUploadInProgress=function(){return f.promisesCount>0},this.rename=function(a,b){return a.ngfName=b,a},this.jsonBlob=function(a){null==a||angular.isString(a)||(a=JSON.stringify(a));var b=new window.Blob([a],{type:"application/json"});return b._ngfBlob=!0,b},this.json=function(a){return angular.toJson(a)},this.isFile=function(a){return null!=a&&(a instanceof window.Blob||a.flashId&&a.name&&a.size)},this.upload=function(a,b){function c(b,c){if(b._ngfBlob)return b;if(a._file=a._file||b,null!=a._start&&g){a._end&&a._end>=b.size&&(a._finished=!0,a._end=b.size);var d=b.slice(a._start,a._end||b.size);return d.name=b.name,d.ngfName=b.ngfName,a._chunkSize&&(c.append("_chunkSize",a._chunkSize),c.append("_currentChunkSize",a._end-a._start),c.append("_chunkNumber",Math.floor(a._start/a._chunkSize)),c.append("_totalSize",a._file.size)),d}return b}function h(b,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))b.append(e,d);else if(f.isFile(d)){var g=c(d,b),i=e.split(",");i[1]&&(g.ngfName=i[1].replace(/^\s+|\s+$/g,""),e=i[0]),a._fileKey=a._fileKey||e,b.append(e,g,g.ngfName||g.name)}else if(angular.isObject(d)){if(d.$$ngfCircularDetection)throw"ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: "+e;d.$$ngfCircularDetection=!0;try{for(var j in d)if(d.hasOwnProperty(j)&&"$$ngfCircularDetection"!==j){var k=null==a.objectKey?"[i]":a.objectKey;d.length&&parseInt(j)>-1&&(k=null==a.arrayKey?k:a.arrayKey),h(b,d[j],e+k.replace(/[ik]/g,j))}}finally{delete d.$$ngfCircularDetection}}else b.append(e,d)}function i(){a._chunkSize=f.translateScalars(a.resumeChunkSize),a._chunkSize=a._chunkSize?parseInt(a._chunkSize.toString()):null,a.headers=a.headers||{},a.headers["Content-Type"]=void 0,a.transformRequest=a.transformRequest?angular.isArray(a.transformRequest)?a.transformRequest:[a.transformRequest]:[],a.transformRequest.push(function(b){var c,d=new window.FormData;b=b||a.fields||{},a.file&&(b.file=a.file);for(c in b)if(b.hasOwnProperty(c)){var e=b[c];a.formDataAppender?a.formDataAppender(d,c,e):h(d,e,c)}return d})}return b||(a=e(a)),a._isDigested||(a._isDigested=!0,i()),d(a)},this.http=function(b){return b=e(b),b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof window.Blob?b:a.defaults.transformRequest[0].apply(this,arguments)},b._chunkSize=f.translateScalars(b.resumeChunkSize),b._chunkSize=b._chunkSize?parseInt(b._chunkSize.toString()):null,d(b)},this.translateScalars=function(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1024*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1048576*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1073741824*a.substring(0,a.length-2));if(a.search(/b/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/s/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/m/i)===a.length-1)return parseFloat(60*a.substring(0,a.length-1));if(a.search(/h/i)===a.length-1)return parseFloat(3600*a.substring(0,a.length-1))}return a},this.urlToBlob=function(c){var d=b.defer();return a({url:c,method:"get",responseType:"arraybuffer"}).then(function(a){var b=new Uint8Array(a.data),e=a.headers("content-type")||"image/WebP",f=new window.Blob([b],{type:e}),g=c.match(/.*\/(.+?)(\?.*)?$/);g.length>1&&(f.name=g[1]),d.resolve(f)},function(a){d.reject(a)}),d.promise},this.setDefaults=function(a){this.defaults=a||{}},this.defaults={},this.version=ngFileUpload.version}]),ngFileUpload.service("Upload",["$parse","$timeout","$compile","$q","UploadExif",function(a,b,c,d,e){function f(a,b,c){var e=[i.emptyPromise()];return angular.forEach(a,function(d,f){0===d.type.indexOf("image/jpeg")&&i.attrGetter("ngfFixOrientation",b,c,{$file:d})&&e.push(i.happyPromise(i.applyExifRotation(d),d).then(function(b){a.splice(f,1,b)}))}),d.all(e)}function g(a,b,c,e){var f=i.attrGetter("ngfResize",b,c);if(!f||!i.isResizeSupported()||!a.length)return i.emptyPromise();if(f instanceof Function){var g=d.defer();return f(a).then(function(d){h(d,a,b,c,e).then(function(a){g.resolve(a)},function(a){g.reject(a)})},function(a){g.reject(a)})}return h(f,a,b,c,e)}function h(a,b,c,e,f){function g(d,g){if(0===d.type.indexOf("image")){if(a.pattern&&!i.validatePattern(d,a.pattern))return;a.resizeIf=function(a,b){return i.attrGetter("ngfResizeIf",c,e,{$width:a,$height:b,$file:d})};var j=i.resize(d,a);h.push(j),j.then(function(a){b.splice(g,1,a)},function(a){d.$error="resize",(d.$errorMessages=d.$errorMessages||{}).resize=!0,d.$errorParam=(a?(a.message?a.message:a)+": ":"")+(d&&d.name),f.$ngfValidations.push({name:"resize",valid:!1}),i.applyModelValidation(f,b)})}}for(var h=[i.emptyPromise()],j=0;j<b.length;j++)g(b[j],j);return d.all(h)}var i=e;return i.getAttrWithDefaults=function(a,b){if(null!=a[b])return a[b];var c=i.defaults[b];return null==c?c:angular.isString(c)?c:JSON.stringify(c)},i.attrGetter=function(b,c,d,e){var f=this.getAttrWithDefaults(c,b);if(!d)return f;try{return e?a(f)(d,e):a(f)(d)}catch(g){if(b.search(/min|max|pattern/i))return f;throw g}},i.shouldUpdateOn=function(a,b,c){var d=i.attrGetter("ngfModelOptions",b,c);return d&&d.updateOn?d.updateOn.split(" ").indexOf(a)>-1:!0},i.emptyPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.resolve.apply(a,c)}),a.promise},i.rejectPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.reject.apply(a,c)}),a.promise},i.happyPromise=function(a,c){var e=d.defer();return a.then(function(a){e.resolve(a)},function(a){b(function(){throw a}),e.resolve(c)}),e.promise},i.updateModel=function(c,d,e,h,j,k,l){function m(f,g,j,l,m){d.$$ngfPrevValidFiles=f,d.$$ngfPrevInvalidFiles=g;var n=f&&f.length?f[0]:null,o=g&&g.length?g[0]:null;c&&(i.applyModelValidation(c,f),c.$setViewValue(m?n:f)),h&&a(h)(e,{$files:f,$file:n,$newFiles:j,$duplicateFiles:l,$invalidFiles:g,$invalidFile:o,$event:k});var p=i.attrGetter("ngfModelInvalid",d);p&&b(function(){a(p).assign(e,m?o:g)}),b(function(){})}function n(){function a(a,b){return a.name===b.name&&(a.$ngfOrigSize||a.size)===(b.$ngfOrigSize||b.size)&&a.type===b.type}function b(b){var c;for(c=0;c<r.length;c++)if(a(b,r[c]))return!0;for(c=0;c<s.length;c++)if(a(b,s[c]))return!0;return!1}if(j){q=[],t=[];for(var c=0;c<j.length;c++)b(j[c])?t.push(j[c]):q.push(j[c])}}function o(a){return angular.isArray(a)?a:[a]}function p(){function a(){b(function(){m(w?r.concat(v):v,w?s.concat(u):u,j,t,x)},z&&z.debounce?z.debounce.change||z.debounce:0)}var f=y?q:v;g(f,d,e,c).then(function(){y?i.validate(q,w?r.length:0,c,d,e).then(function(b){v=b.validsFiles,u=b.invalidsFiles,a()}):a()},function(){for(var b=0;b<f.length;b++){var c=f[b];if("resize"===c.$error){var d=v.indexOf(c);d>-1&&(v.splice(d,1),u.push(c)),a()}}})}var q,r,s,t=[],u=[],v=[];r=d.$$ngfPrevValidFiles||[],s=d.$$ngfPrevInvalidFiles||[],c&&c.$modelValue&&(r=o(c.$modelValue));var w=i.attrGetter("ngfKeep",d,e);q=(j||[]).slice(0),("distinct"===w||i.attrGetter("ngfKeepDistinct",d,e)===!0)&&n(d,e);var x=!w&&!i.attrGetter("ngfMultiple",d,e)&&!i.attrGetter("multiple",d);if(!w||q.length){i.attrGetter("ngfBeforeModelChange",d,e,{$files:j,$file:j&&j.length?j[0]:null,$newFiles:q,$duplicateFiles:t,$event:k});var y=i.attrGetter("ngfValidateAfterResize",d,e),z=i.attrGetter("ngfModelOptions",d,e);i.validate(q,w?r.length:0,c,d,e).then(function(a){l?m(q,[],j,t,x):(z&&z.allowInvalid||y?v=q:(v=a.validFiles,u=a.invalidFiles),i.attrGetter("ngfFixOrientation",d,e)&&i.isExifSupported()?f(v,d,e).then(function(){p()}):p())})}},i}]),ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(a,b,c,d){function e(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=d.defaults.androidFixMinorVersion||4;return parseInt(b[1])<4||parseInt(b[1])===c&&parseInt(b[2])<c}return-1===a.indexOf("Chrome")&&/.*Windows.*Safari.*/.test(a)}function f(a,b,c,d,f,h,i,j){function k(){return"input"===b[0].tagName.toLowerCase()&&c.type&&"file"===c.type.toLowerCase()}function l(){return t("ngfChange")||t("ngfSelect")}function m(b){if(j.shouldUpdateOn("change",c,a)){var e=b.__files_||b.target&&b.target.files,f=[];if(!e)return;for(var g=0;g<e.length;g++)f.push(e[g]);j.updateModel(d,c,a,l(),f.length?f:null,b)}}function n(a,d){function e(b){a.attr("id","ngf-"+b),d.attr("id","ngf-label-"+b)}for(var f=0;f<b[0].attributes.length;f++){var g=b[0].attributes[f];"type"!==g.name&&"class"!==g.name&&"style"!==g.name&&("id"===g.name?(e(g.value),u.push(c.$observe("id",e))):a.attr(g.name,g.value||"required"!==g.name&&"multiple"!==g.name?g.value:g.name))}}function o(){if(k())return b;var a=angular.element('<input type="file">'),c=angular.element("<label>upload</label>");return c.css("visibility","hidden").css("position","absolute").css("overflow","hidden").css("width","0px").css("height","0px").css("border","none").css("margin","0px").css("padding","0px").attr("tabindex","-1"),n(a,c),g.push({el:b,ref:c}),document.body.appendChild(c.append(a)[0]),a}function p(c){if(b.attr("disabled"))return!1;if(!t("ngfSelectDisabled",a)){var d=q(c);if(null!=d)return d;r(c);try{k()||document.body.contains(x[0])||(g.push({el:b,ref:x.parent()}),document.body.appendChild(x.parent()[0]),x.bind("change",m))}catch(f){}return e(navigator.userAgent)?setTimeout(function(){x[0].click()},0):x[0].click(),!1}}function q(a){var b=a.changedTouches||a.originalEvent&&a.originalEvent.changedTouches;if(b){if("touchstart"===a.type)return w=b[0].clientX,v=b[0].clientY,!0;if("touchend"===a.type){var c=b[0].clientX,d=b[0].clientY;if(Math.abs(c-w)>20||Math.abs(d-v)>20)return a.stopPropagation(),a.preventDefault(),!1}return!0}}function r(b){j.shouldUpdateOn("click",c,a)&&x.val()&&(x.val(null),j.updateModel(d,c,a,l(),null,b,!0))}function s(a){if(x&&!x.attr("__ngf_ie10_Fix_")){if(!x[0].parentNode)return void(x=null);a.preventDefault(),a.stopPropagation(),x.unbind("click");var b=x.clone();return x.replaceWith(b),x=b,x.attr("__ngf_ie10_Fix_","true"),x.bind("change",m),x.bind("click",s),x[0].click(),!1}x.removeAttr("__ngf_ie10_Fix_")}var t=function(a,b){return j.attrGetter(a,c,b)};j.registerModelChangeValidator(d,c,a);var u=[];t("ngfMultiple")&&u.push(a.$watch(t("ngfMultiple"),function(){x.attr("multiple",t("ngfMultiple",a))})),t("ngfCapture")&&u.push(a.$watch(t("ngfCapture"),function(){x.attr("capture",t("ngfCapture",a))})),t("ngfAccept")&&u.push(a.$watch(t("ngfAccept"),function(){x.attr("accept",t("ngfAccept",a))})),u.push(c.$observe("accept",function(){x.attr("accept",t("accept"))}));var v=0,w=0,x=b;k()||(x=o()),x.bind("change",m),k()?b.bind("click",r):b.bind("click touchstart touchend",p),-1!==navigator.appVersion.indexOf("MSIE 10")&&x.bind("click",s),d&&d.$formatters.push(function(a){return(null==a||0===a.length)&&x.val()&&x.val(null),a}),a.$on("$destroy",function(){k()||x.parent().remove(),angular.forEach(u,function(a){a()})}),h(function(){for(var a=0;a<g.length;a++){var b=g[a];document.body.contains(b.el[0])||(g.splice(a,1),b.ref.remove())}}),window.FileAPI&&window.FileAPI.ngfFixIE&&window.FileAPI.ngfFixIE(b,x,m)}var g=[];return{restrict:"AEC",require:"?ngModel",link:function(e,g,h,i){f(e,g,h,i,a,b,c,d)}}}]),function(){function a(a){return"img"===a.tagName.toLowerCase()?"image":"audio"===a.tagName.toLowerCase()?"audio":"video"===a.tagName.toLowerCase()?"video":/./}function b(b,c,d,e,f,g,h,i){function j(a){var g=b.attrGetter("ngfNoObjectUrl",f,d);b.dataUrl(a,g)["finally"](function(){c(function(){var b=(g?a.$ngfDataUrl:a.$ngfBlobUrl)||a.$ngfDataUrl;i?e.css("background-image","url('"+(b||"")+"')"):e.attr("src",b),b?e.removeClass("ng-hide"):e.addClass("ng-hide")})})}c(function(){var c=d.$watch(f[g],function(c){var k=h;if("ngfThumbnail"===g&&(k||(k={width:e[0].naturalWidth||e[0].clientWidth,height:e[0].naturalHeight||e[0].clientHeight}),0===k.width&&window.getComputedStyle)){var l=getComputedStyle(e[0]);l.width&&l.width.indexOf("px")>-1&&l.height&&l.height.indexOf("px")>-1&&(k={width:parseInt(l.width.slice(0,-2)),height:parseInt(l.height.slice(0,-2))})}return angular.isString(c)?(e.removeClass("ng-hide"),i?e.css("background-image","url('"+c+"')"):e.attr("src",c)):void(!c||!c.type||0!==c.type.search(a(e[0]))||i&&0!==c.type.indexOf("image")?e.addClass("ng-hide"):k&&b.isResizeSupported()?(k.resizeIf=function(a,e){return b.attrGetter("ngfResizeIf",f,d,{$width:a,$height:e,$file:c})},b.resize(c,k).then(function(a){j(a)},function(a){throw a})):j(c))});d.$on("$destroy",function(){c()})})}ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout","$q",function(a,b,c){var d=a;return d.base64DataUrl=function(a){if(angular.isArray(a)){var b=c.defer(),e=0;return angular.forEach(a,function(c){d.dataUrl(c,!0)["finally"](function(){if(e++,e===a.length){var c=[];angular.forEach(a,function(a){c.push(a.$ngfDataUrl)}),b.resolve(c,a)}})}),b.promise}return d.dataUrl(a,!0)},d.dataUrl=function(a,e){if(!a)return d.emptyPromise(a,a);if(e&&null!=a.$ngfDataUrl||!e&&null!=a.$ngfBlobUrl)return d.emptyPromise(e?a.$ngfDataUrl:a.$ngfBlobUrl,a);var f=e?a.$$ngfDataUrlPromise:a.$$ngfBlobUrlPromise;if(f)return f;var g=c.defer();return b(function(){if(window.FileReader&&a&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 8")||a.size<2e4)&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 9")||a.size<4e6)){var c=window.URL||window.webkitURL;if(c&&c.createObjectURL&&!e){var f;try{f=c.createObjectURL(a)}catch(h){return void b(function(){a.$ngfBlobUrl="",g.reject()})}b(function(){if(a.$ngfBlobUrl=f,f){g.resolve(f,a),d.blobUrls=d.blobUrls||[],d.blobUrlsTotalSize=d.blobUrlsTotalSize||0,d.blobUrls.push({url:f,size:a.size}),d.blobUrlsTotalSize+=a.size||0;for(var b=d.defaults.blobUrlsMaxMemory||268435456,e=d.defaults.blobUrlsMaxQueueSize||200;(d.blobUrlsTotalSize>b||d.blobUrls.length>e)&&d.blobUrls.length>1;){var h=d.blobUrls.splice(0,1)[0];c.revokeObjectURL(h.url),d.blobUrlsTotalSize-=h.size}}})}else{var i=new FileReader;i.onload=function(c){b(function(){a.$ngfDataUrl=c.target.result,g.resolve(c.target.result,a),b(function(){delete a.$ngfDataUrl},1e3)})},i.onerror=function(){b(function(){a.$ngfDataUrl="",g.reject()})},i.readAsDataURL(a)}}else b(function(){a[e?"$ngfDataUrl":"$ngfBlobUrl"]="",g.reject()})}),f=e?a.$$ngfDataUrlPromise=g.promise:a.$$ngfBlobUrlPromise=g.promise,f["finally"](function(){delete a[e?"$$ngfDataUrlPromise":"$$ngfBlobUrlPromise"]}),f},d}]),ngFileUpload.directive("ngfSrc",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfSrc",a.attrGetter("ngfResize",f,d),!1)}}}]),ngFileUpload.directive("ngfBackground",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfBackground",a.attrGetter("ngfResize",f,d),!0)}}}]),ngFileUpload.directive("ngfThumbnail",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){var g=a.attrGetter("ngfSize",f,d);b(a,c,d,e,f,"ngfThumbnail",g,a.attrGetter("ngfAsBackground",f,d))}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist&&a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/),a.aHrefSanitizationWhitelist&&a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d,e){if(angular.isString(c))return b.trustAsResourceUrl(c);var f=c&&((d?c.$ngfDataUrl:c.$ngfBlobUrl)||c.$ngfDataUrl);return c&&!f?(!c.$ngfDataUrlFilterInProgress&&angular.isObject(c)&&(c.$ngfDataUrlFilterInProgress=!0,a.dataUrl(c,d)),""):(c&&delete c.$ngfDataUrlFilterInProgress,(c&&f?e?b.trustAsResourceUrl(f):f:c)||"")}}])}(),ngFileUpload.service("UploadValidate",["UploadDataUrl","$q","$timeout",function(a,b,c){function d(a){var b="",c=[];if(a.length>2&&"/"===a[0]&&"/"===a[a.length-1])b=a.substring(1,a.length-1);else{var e=a.split(",");if(e.length>1)for(var f=0;f<e.length;f++){var g=d(e[f]);g.regexp?(b+="("+g.regexp+")",f<e.length-1&&(b+="|")):c=c.concat(g.excludes)}else 0===a.indexOf("!")?c.push("^((?!"+d(a.substring(1)).regexp+").)*$"):(0===a.indexOf(".")&&(a="*"+a),b="^"+a.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",b=b.replace(/\\\*/g,".*").replace(/\\\?/g,"."))}return{regexp:b,excludes:c}}function e(a,b){null==b||a.$dirty||(a.$setDirty?a.$setDirty():a.$dirty=!0)}var f=a;return f.validatePattern=function(a,b){if(!b)return!0;var c=d(b),e=!0;if(c.regexp&&c.regexp.length){var f=new RegExp(c.regexp,"i");e=null!=a.type&&f.test(a.type)||null!=a.name&&f.test(a.name)}for(var g=c.excludes.length;g--;){var h=new RegExp(c.excludes[g],"i");e=e&&(null==a.type||h.test(a.type))&&(null==a.name||h.test(a.name))}return e},f.ratioToFloat=function(a){var b=a.toString(),c=b.search(/[x:]/i);return b=c>-1?parseFloat(b.substring(0,c))/parseFloat(b.substring(c+1)):parseFloat(b)},f.registerModelChangeValidator=function(a,b,c){a&&a.$formatters.push(function(d){if(a.$dirty){var e=d;d&&!angular.isArray(d)&&(e=[d]),f.validate(e,0,a,b,c).then(function(){f.applyModelValidation(a,e)})}return d})},f.applyModelValidation=function(a,b){e(a,b),angular.forEach(a.$ngfValidations,function(b){a.$setValidity(b.name,b.valid)})},f.getValidationAttr=function(a,b,c,d,e){var g="ngf"+c[0].toUpperCase()+c.substr(1),h=f.attrGetter(g,a,b,{$file:e});if(null==h&&(h=f.attrGetter("ngfValidate",a,b,{$file:e}))){var i=(d||c).split(".");h=h[i[0]],i.length>1&&(h=h&&h[i[1]])}return h},f.validate=function(a,c,d,e,g){function h(b,c,h){if(a){for(var i=a.length,j=null;i--;){var n=a[i];if(n){var o=f.getValidationAttr(e,g,b,c,n);null!=o&&(h(n,o,i)||(-1===k.indexOf(b)?(n.$error=b,(n.$errorMessages=n.$errorMessages||{})[b]=!0,n.$errorParam=o,-1===m.indexOf(n)&&m.push(n),l||a.splice(i,1),j=!1):a.splice(i,1)))}}null!==j&&d.$ngfValidations.push({name:b,valid:j})}}function i(c,h,i,n,o){function p(b,d,e){function f(f){if(f())if(-1===k.indexOf(c)){if(d.$error=c,(d.$errorMessages=d.$errorMessages||{})[c]=!0,d.$errorParam=e,-1===m.indexOf(d)&&m.push(d),!l){var g=a.indexOf(d);g>-1&&a.splice(g,1)}b.resolve(!1)}else{var h=a.indexOf(d);h>-1&&a.splice(h,1),b.resolve(!0)}else b.resolve(!0)}null!=e?n(d,e).then(function(a){f(function(){return!o(a,e)})},function(){f(function(){return j("ngfValidateForce",{$file:d})})}):b.resolve(!0)}var q=[f.emptyPromise(!0)];a&&(a=void 0===a.length?[a]:a,angular.forEach(a,function(a){var d=b.defer();return q.push(d.promise),!i||null!=a.type&&0===a.type.search(i)?void("dimensions"===c&&null!=f.attrGetter("ngfDimensions",e)?f.imageDimensions(a).then(function(b){p(d,a,j("ngfDimensions",{$file:a,$width:b.width,$height:b.height}))},function(){d.resolve(!1)}):"duration"===c&&null!=f.attrGetter("ngfDuration",e)?f.mediaDuration(a).then(function(b){p(d,a,j("ngfDuration",{$file:a,$duration:b}))},function(){d.resolve(!1)}):p(d,a,f.getValidationAttr(e,g,c,h,a))):void d.resolve(!0)}));var r=b.defer();return b.all(q).then(function(a){for(var b=!0,e=0;e<a.length;e++)if(!a[e]){b=!1;break}d.$ngfValidations.push({name:c,valid:b}),r.resolve(b)}),r.promise}d=d||{},d.$ngfValidations=d.$ngfValidations||[],angular.forEach(d.$ngfValidations,function(a){a.valid=!0});var j=function(a,b){return f.attrGetter(a,e,g,b)},k=(f.attrGetter("ngfIgnoreInvalid",e,g)||"").split(" "),l=f.attrGetter("ngfRunAllValidations",e,g);if(null==a||0===a.length)return f.emptyPromise({validFiles:a,invalidFiles:[]});a=void 0===a.length?[a]:a.slice(0);var m=[];h("pattern",null,f.validatePattern),h("minSize","size.min",function(a,b){return a.size+.1>=f.translateScalars(b)}),h("maxSize","size.max",function(a,b){return a.size-.1<=f.translateScalars(b)});var n=0;if(h("maxTotalSize",null,function(b,c){return n+=b.size,n>f.translateScalars(c)?(a.splice(0,a.length),!1):!0}),h("validateFn",null,function(a,b){return b===!0||null===b||""===b}),!a.length)return f.emptyPromise({validFiles:[],invalidFiles:m});var o=b.defer(),p=[];return p.push(i("maxHeight","height.max",/image/,this.imageDimensions,function(a,b){return a.height<=b})),p.push(i("minHeight","height.min",/image/,this.imageDimensions,function(a,b){return a.height>=b})),p.push(i("maxWidth","width.max",/image/,this.imageDimensions,function(a,b){return a.width<=b})),p.push(i("minWidth","width.min",/image/,this.imageDimensions,function(a,b){return a.width>=b})),p.push(i("dimensions",null,/image/,function(a,b){return f.emptyPromise(b)},function(a){return a})),p.push(i("ratio",null,/image/,this.imageDimensions,function(a,b){for(var c=b.toString().split(","),d=!1,e=0;e<c.length;e++)Math.abs(a.width/a.height-f.ratioToFloat(c[e]))<.01&&(d=!0);return d})),p.push(i("maxRatio","ratio.max",/image/,this.imageDimensions,function(a,b){return a.width/a.height-f.ratioToFloat(b)<1e-4})),p.push(i("minRatio","ratio.min",/image/,this.imageDimensions,function(a,b){return a.width/a.height-f.ratioToFloat(b)>-1e-4})),p.push(i("maxDuration","duration.max",/audio|video/,this.mediaDuration,function(a,b){return a<=f.translateScalars(b)})),p.push(i("minDuration","duration.min",/audio|video/,this.mediaDuration,function(a,b){return a>=f.translateScalars(b)})),p.push(i("duration",null,/audio|video/,function(a,b){return f.emptyPromise(b)},function(a){return a})),p.push(i("validateAsyncFn",null,null,function(a,b){return b},function(a){return a===!0||null===a||""===a})),b.all(p).then(function(){if(l)for(var b=0;b<a.length;b++){var d=a[b];d.$error&&a.splice(b--,1)}l=!1,h("maxFiles",null,function(a,b,d){return b>c+d}),o.resolve({validFiles:a,invalidFiles:m})}),o.promise},f.imageDimensions=function(a){if(a.$ngfWidth&&a.$ngfHeight){var d=b.defer();return c(function(){d.resolve({width:a.$ngfWidth,height:a.$ngfHeight})}),d.promise}if(a.$ngfDimensionPromise)return a.$ngfDimensionPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("image")?void e.reject("not image"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].naturalWidth||h[0].clientWidth,c=h[0].naturalHeight||h[0].clientHeight;h.remove(),a.$ngfWidth=b,a.$ngfHeight=c,e.resolve({width:b,height:c})}function f(){
1065+h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].clientWidth?d():i++>10?f():g())},1e3)}var h=angular.element("<img>").attr("src",b).css("visibility","hidden").css("position","fixed").css("max-width","none !important").css("max-height","none !important");h.on("load",d),h.on("error",f);var i=0;g(),angular.element(document.getElementsByTagName("body")[0]).append(h)},function(){e.reject("load error")})}),a.$ngfDimensionPromise=e.promise,a.$ngfDimensionPromise["finally"](function(){delete a.$ngfDimensionPromise}),a.$ngfDimensionPromise},f.mediaDuration=function(a){if(a.$ngfDuration){var d=b.defer();return c(function(){d.resolve(a.$ngfDuration)}),d.promise}if(a.$ngfDurationPromise)return a.$ngfDurationPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?void e.reject("not media"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].duration;a.$ngfDuration=b,h.remove(),e.resolve(b)}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].duration?d():i>10?f():g())},1e3)}var h=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",b).css("visibility","none").css("position","fixed");h.on("loadedmetadata",d),h.on("error",f);var i=0;g(),angular.element(document.body).append(h)},function(){e.reject("load error")})}),a.$ngfDurationPromise=e.promise,a.$ngfDurationPromise["finally"](function(){delete a.$ngfDurationPromise}),a.$ngfDurationPromise},f}]),ngFileUpload.service("UploadResize",["UploadValidate","$q",function(a,b){var c=a,d=function(a,b,c,d,e){var f=e?Math.max(c/a,d/b):Math.min(c/a,d/b);return{width:a*f,height:b*f,marginX:a*f-c,marginY:b*f-d}},e=function(a,e,f,g,h,i,j,k){var l=b.defer(),m=document.createElement("canvas"),n=document.createElement("img");return n.setAttribute("style","visibility:hidden;position:fixed;z-index:-100000"),document.body.appendChild(n),n.onload=function(){var a=n.width,b=n.height;if(n.parentNode.removeChild(n),null!=k&&k(a,b)===!1)return void l.reject("resizeIf");try{if(i){var o=c.ratioToFloat(i),p=a/b;o>p?(e=a,f=e/o):(f=b,e=f*o)}e||(e=a),f||(f=b);var q=d(a,b,e,f,j);m.width=Math.min(q.width,e),m.height=Math.min(q.height,f);var r=m.getContext("2d");r.drawImage(n,Math.min(0,-q.marginX/2),Math.min(0,-q.marginY/2),q.width,q.height),l.resolve(m.toDataURL(h||"image/WebP",g||.934))}catch(s){l.reject(s)}},n.onerror=function(){n.parentNode.removeChild(n),l.reject()},n.src=a,l.promise};return c.dataUrltoBlob=function(a,b,c){for(var d=a.split(","),e=d[0].match(/:(.*?);/)[1],f=atob(d[1]),g=f.length,h=new Uint8Array(g);g--;)h[g]=f.charCodeAt(g);var i=new window.Blob([h],{type:e});return i.name=b,i.$ngfOrigSize=c,i},c.isResizeSupported=function(){var a=document.createElement("canvas");return window.atob&&a.getContext&&a.getContext("2d")&&window.Blob},c.isResizeSupported()&&Object.defineProperty(window.Blob.prototype,"name",{get:function(){return this.$ngfName},set:function(a){this.$ngfName=a},configurable:!0}),c.resize=function(a,d){if(0!==a.type.indexOf("image"))return c.emptyPromise(a);var f=b.defer();return c.dataUrl(a,!0).then(function(b){e(b,d.width,d.height,d.quality,d.type||a.type,d.ratio,d.centerCrop,d.resizeIf).then(function(e){if("image/jpeg"===a.type&&d.restoreExif!==!1)try{e=c.restoreExif(b,e)}catch(g){setTimeout(function(){throw g},1)}try{var h=c.dataUrltoBlob(e,a.name,a.size);f.resolve(h)}catch(g){f.reject(g)}},function(b){"resizeIf"===b&&f.resolve(a),f.reject(b)})},function(a){f.reject(a)}),f.promise},c}]),function(){function a(a,c,d,e,f,g,h,i,j,k){function l(){return c.attr("disabled")||s("ngfDropDisabled",a)}function m(b,c,d){if(b){var e;try{e=b&&b.getData&&b.getData("text/html")}catch(f){}q(b.items,b.files,s("ngfAllowDir",a)!==!1,s("multiple")||s("ngfMultiple",a)).then(function(a){a.length?n(a,c):o(d,e).then(function(a){n(a,c)})})}}function n(b,c){i.updateModel(e,d,a,s("ngfChange")||s("ngfDrop"),b,c)}function o(b,c){if(!i.shouldUpdateOn(b,d,a)||"string"!=typeof c)return i.rejectPromise([]);var e=[];c.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi,function(a,b,c){e.push(c)});var f=[],g=[];if(e.length){angular.forEach(e,function(a){f.push(i.urlToBlob(a).then(function(a){g.push(a)}))});var h=k.defer();return k.all(f).then(function(){h.resolve(g)},function(a){h.reject(a)}),h.promise}return i.emptyPromise()}function p(a,b,c,d){var e=s("ngfDragOverClass",a,{$event:c}),f="dragover";if(angular.isString(e))f=e;else if(e&&(e.delay&&(w=e.delay),e.accept||e.reject)){var g=c.dataTransfer.items;if(null!=g&&g.length)for(var h=e.pattern||s("ngfPattern",a,{$event:c}),j=g.length;j--;){if(!i.validatePattern(g[j],h)){f=e.reject;break}f=e.accept}else f=e.accept}d(f)}function q(b,c,e,f){function g(a,b){var c=k.defer();if(null!=a)if(a.isDirectory){var d=[i.emptyPromise()];if(m){var e={type:"directory"};e.name=e.path=(b||"")+a.name,n.push(e)}var f=a.createReader(),h=[],p=function(){f.readEntries(function(e){try{e.length?(h=h.concat(Array.prototype.slice.call(e||[],0)),p()):(angular.forEach(h.slice(0),function(c){n.length<=j&&l>=o&&d.push(g(c,(b?b:"")+a.name+"/"))}),k.all(d).then(function(){c.resolve()},function(a){c.reject(a)}))}catch(f){c.reject(f)}},function(a){c.reject(a)})};p()}else a.file(function(a){try{a.path=(b?b:"")+a.name,m&&(a=i.rename(a,a.path)),n.push(a),o+=a.size,c.resolve()}catch(d){c.reject(d)}},function(a){c.reject(a)});return c.promise}var j=i.getValidationAttr(d,a,"maxFiles");null==j&&(j=Number.MAX_VALUE);var l=i.getValidationAttr(d,a,"maxTotalSize");null==l&&(l=Number.MAX_VALUE);var m=s("ngfIncludeDir",a),n=[],o=0,p=[i.emptyPromise()];if(b&&b.length>0&&"file:"!==h.location.protocol)for(var q=0;q<b.length;q++){if(b[q].webkitGetAsEntry&&b[q].webkitGetAsEntry()&&b[q].webkitGetAsEntry().isDirectory){var r=b[q].webkitGetAsEntry();if(r.isDirectory&&!e)continue;null!=r&&p.push(g(r))}else{var t=b[q].getAsFile();null!=t&&(n.push(t),o+=t.size)}if(n.length>j||o>l||!f&&n.length>0)break}else if(null!=c)for(var u=0;u<c.length;u++){var v=c.item(u);if((v.type||v.size>0)&&(n.push(v),o+=v.size),n.length>j||o>l||!f&&n.length>0)break}var w=k.defer();return k.all(p).then(function(){if(f||m||!n.length)w.resolve(n);else{for(var a=0;n[a]&&"directory"===n[a].type;)a++;w.resolve([n[a]])}},function(a){w.reject(a)}),w.promise}var r=b(),s=function(a,b,c){return i.attrGetter(a,d,b,c)};if(s("dropAvailable")&&g(function(){a[s("dropAvailable")]?a[s("dropAvailable")].value=r:a[s("dropAvailable")]=r}),!r)return void(s("ngfHideOnDropNotAvailable",a)===!0&&c.css("display","none"));null==s("ngfSelect")&&i.registerModelChangeValidator(e,d,a);var t,u=null,v=f(s("ngfStopPropagation")),w=1;c[0].addEventListener("dragover",function(b){if(!l()&&i.shouldUpdateOn("drop",d,a)){if(b.preventDefault(),v(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var e=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===e||"linkMove"===e?"move":"copy"}g.cancel(u),t||(t="C",p(a,d,b,function(d){t=d,c.addClass(t),s("ngfDrag",a,{$isDragging:!0,$class:t,$event:b})}))}},!1),c[0].addEventListener("dragenter",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),v(a)&&b.stopPropagation())},!1),c[0].addEventListener("dragleave",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),v(a)&&b.stopPropagation(),u=g(function(){t&&c.removeClass(t),t=null,s("ngfDrag",a,{$isDragging:!1,$event:b})},w||100))},!1),c[0].addEventListener("drop",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),v(a)&&b.stopPropagation(),t&&c.removeClass(t),t=null,m(b.dataTransfer,b,"dropUrl"))},!1),c[0].addEventListener("paste",function(b){navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&s("ngfEnableFirefoxPaste",a)&&b.preventDefault(),!l()&&i.shouldUpdateOn("paste",d,a)&&m(b.clipboardData||b.originalEvent.clipboardData,b,"pasteUrl")},!1),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&s("ngfEnableFirefoxPaste",a)&&(c.attr("contenteditable",!0),c.on("keypress",function(a){a.metaKey||a.ctrlKey||a.preventDefault()}))}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a&&!/Edge\/12./i.test(navigator.userAgent)}ngFileUpload.directive("ngfDrop",["$parse","$timeout","$window","Upload","$http","$q",function(b,c,d,e,f,g){return{restrict:"AEC",require:"?ngModel",link:function(h,i,j,k){a(h,i,j,k,b,c,d,e,f,g)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(a,c,d){return function(e,f,g){if(b()){var h=a(d.attrGetter("ngfDropAvailable",g));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(),ngFileUpload.service("UploadExif",["UploadResize","$q",function(a,b){function c(a,b,c,d){switch(b){case 2:return a.transform(-1,0,0,1,c,0);case 3:return a.transform(-1,0,0,-1,c,d);case 4:return a.transform(1,0,0,-1,0,d);case 5:return a.transform(0,1,1,0,0,0);case 6:return a.transform(0,1,-1,0,d,0);case 7:return a.transform(0,-1,-1,0,d,c);case 8:return a.transform(0,-1,1,0,0,c)}}function d(a){for(var b="",c=new Uint8Array(a),d=c.byteLength,e=0;d>e;e++)b+=String.fromCharCode(c[e]);return window.btoa(b)}var e=a;return e.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&e.isResizeSupported()},e.readOrientation=function(a){var c=b.defer(),d=new FileReader,e=a.slice?a.slice(0,65536):a;return d.readAsArrayBuffer(e),d.onerror=function(a){return c.reject(a)},d.onload=function(a){var b={orientation:1},d=new DataView(this.result);if(65496!==d.getUint16(0,!1))return c.resolve(b);for(var e=d.byteLength,f=2;e>f;){var g=d.getUint16(f,!1);if(f+=2,65505===g){if(1165519206!==d.getUint32(f+=2,!1))return c.resolve(b);var h=18761===d.getUint16(f+=6,!1);f+=d.getUint32(f+4,h);var i=d.getUint16(f,h);f+=2;for(var j=0;i>j;j++)if(274===d.getUint16(f+12*j,h)){var k=d.getUint16(f+12*j+8,h);return k>=2&&8>=k&&(d.setUint16(f+12*j+8,1,h),b.fixedArrayBuffer=a.target.result),b.orientation=k,c.resolve(b)}}else{if(65280!==(65280&g))break;f+=d.getUint16(f,!1)}}return c.resolve(b)},c.promise},e.applyExifRotation=function(a){if(0!==a.type.indexOf("image/jpeg"))return e.emptyPromise(a);var f=b.defer();return e.readOrientation(a).then(function(b){return b.orientation<2||b.orientation>8?f.resolve(a):void e.dataUrl(a,!0).then(function(g){var h=document.createElement("canvas"),i=document.createElement("img");i.onload=function(){try{h.width=b.orientation>4?i.height:i.width,h.height=b.orientation>4?i.width:i.height;var g=h.getContext("2d");c(g,b.orientation,i.width,i.height),g.drawImage(i,0,0);var j=h.toDataURL(a.type||"image/WebP",.934);j=e.restoreExif(d(b.fixedArrayBuffer),j);var k=e.dataUrltoBlob(j,a.name);f.resolve(k)}catch(l){return f.reject(l)}},i.onerror=function(){f.reject()},i.src=g},function(a){f.reject(a)})},function(a){f.reject(a)}),f.promise},e.restoreExif=function(a,b){var c={};return c.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c.encode64=function(a){var b,c,d,e,f,g="",h="",i="",j=0;do b=a[j++],c=a[j++],h=a[j++],d=b>>2,e=(3&b)<<4|c>>4,f=(15&c)<<2|h>>6,i=63&h,isNaN(c)?f=i=64:isNaN(h)&&(i=64),g=g+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(e)+this.KEY_STR.charAt(f)+this.KEY_STR.charAt(i),b=c=h="",d=e=f=i="";while(j<a.length);return g},c.restore=function(a,b){a.match("data:image/jpeg;base64,")&&(a=a.replace("data:image/jpeg;base64,",""));var c=this.decode64(a),d=this.slice2Segments(c),e=this.exifManipulation(b,d);return"data:image/jpeg;base64,"+this.encode64(e)},c.exifManipulation=function(a,b){var c=this.getExifArray(b),d=this.insertExif(a,c);return new Uint8Array(d)},c.getExifArray=function(a){for(var b,c=0;c<a.length;c++)if(b=a[c],255===b[0]&225===b[1])return b;return[]},c.insertExif=function(a,b){var c=a.replace("data:image/jpeg;base64,",""),d=this.decode64(c),e=d.indexOf(255,3),f=d.slice(0,e),g=d.slice(e),h=f;return h=h.concat(b),h=h.concat(g)},c.slice2Segments=function(a){for(var b=0,c=[];;){if(255===a[b]&218===a[b+1])break;if(255===a[b]&216===a[b+1])b+=2;else{var d=256*a[b+2]+a[b+3],e=b+d+2,f=a.slice(b,e);c.push(f),b=e}if(b>a.length)break}return c},c.decode64=function(a){var b,c,d,e,f,g="",h="",i=0,j=[],k=/[^A-Za-z0-9\+\/\=]/g;k.exec(a)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."),a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do d=this.KEY_STR.indexOf(a.charAt(i++)),e=this.KEY_STR.indexOf(a.charAt(i++)),f=this.KEY_STR.indexOf(a.charAt(i++)),h=this.KEY_STR.indexOf(a.charAt(i++)),b=d<<2|e>>4,c=(15&e)<<4|f>>2,g=(3&f)<<6|h,j.push(b),64!==f&&j.push(c),64!==h&&j.push(g),b=c=g="",d=e=f=h="";while(i<a.length);return j},c.restore(a,b)},e}]);
1066\ No newline at end of file
1067diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js
1068index b6192af..f1d033a 100644
1069--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js
1070+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js
1071@@ -1,9 +1,9 @@
1072 /**!
1073- * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
1074+ * AngularJS file upload directives and services. Supports: file upload/drop/paste, resume, cancel/abort,
1075 * progress, resize, thumbnail, preview, validation and CORS
1076 * FileAPI Flash shim for old browsers not supporting FormData
1077 * @author Danial <danial.farid@gmail.com>
1078- * @version 12.0.4
1079+ * @version 12.2.13
1080 */
1081
1082 (function () {
1083diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.min.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.min.js
1084index b87b39d..9928c83 100644
1085--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.min.js
1086+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.min.js
1087@@ -1,2 +1,2 @@
1088-/*! 12.0.4 */
1089+/*! 12.2.13 */
1090 !function(){function a(a,b){window.XMLHttpRequest.prototype[a]=b(window.XMLHttpRequest.prototype[a])}function b(a,b,c){try{Object.defineProperty(a,b,{get:c})}catch(d){}}if(window.FileAPI||(window.FileAPI={}),!window.XMLHttpRequest)throw"AJAX is not supported. XMLHttpRequest is not defined.";if(FileAPI.shouldLoad=!window.FormData||FileAPI.forceLoad,FileAPI.shouldLoad){var c=function(a){if(!a.__listeners){a.upload||(a.upload={}),a.__listeners=[];var b=a.upload.addEventListener;a.upload.addEventListener=function(c,d){a.__listeners[c]=d,b&&b.apply(this,arguments)}}};a("open",function(a){return function(b,d,e){c(this),this.__url=d;try{a.apply(this,[b,d,e])}catch(f){f.message.indexOf("Access is denied")>-1&&(this.__origError=f,a.apply(this,[b,"_fix_for_ie_crossdomain__",e]))}}}),a("getResponseHeader",function(a){return function(b){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(b):null==a?null:a.apply(this,[b])}}),a("getAllResponseHeaders",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==a?null:a.apply(this)}}),a("abort",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==a?null:a.apply(this)}}),a("setRequestHeader",function(a){return function(b,d){if("__setXHR_"===b){c(this);var e=d(this);e instanceof Function&&e(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[b]=d,a.apply(this,arguments)}}),a("send",function(a){return function(){var c=this;if(arguments[0]&&arguments[0].__isFileAPIShim){var d=arguments[0],e={url:c.__url,jsonp:!1,cache:!0,complete:function(a,d){a&&angular.isString(a)&&-1!==a.indexOf("#2174")&&(a=null),c.__completed=!0,!a&&c.__listeners.load&&c.__listeners.load({type:"load",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),!a&&c.__listeners.loadend&&c.__listeners.loadend({type:"loadend",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),"abort"===a&&c.__listeners.abort&&c.__listeners.abort({type:"abort",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),void 0!==d.status&&b(c,"status",function(){return 0===d.status&&a&&"abort"!==a?500:d.status}),void 0!==d.statusText&&b(c,"statusText",function(){return d.statusText}),b(c,"readyState",function(){return 4}),void 0!==d.response&&b(c,"response",function(){return d.response});var e=d.responseText||(a&&0===d.status&&"abort"!==a?a:void 0);b(c,"responseText",function(){return e}),b(c,"response",function(){return e}),a&&b(c,"err",function(){return a}),c.__fileApiXHR=d,c.onreadystatechange&&c.onreadystatechange(),c.onload&&c.onload()},progress:function(a){if(a.target=c,c.__listeners.progress&&c.__listeners.progress(a),c.__total=a.total,c.__loaded=a.loaded,a.total===a.loaded){var b=this;setTimeout(function(){c.__completed||(c.getAllResponseHeaders=function(){},b.complete(null,{status:204,statusText:"No Content"}))},FileAPI.noContentTimeout||1e4)}},headers:c.__requestHeaders};e.data={},e.files={};for(var f=0;f<d.data.length;f++){var g=d.data[f];null!=g.val&&null!=g.val.name&&null!=g.val.size&&null!=g.val.type?e.files[g.key]=g.val:e.data[g.key]=g.val}setTimeout(function(){if(!FileAPI.hasFlash)throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';c.__fileApiXHR=FileAPI.upload(e)},1)}else{if(this.__origError)throw this.__origError;a.apply(c,arguments)}}}),window.XMLHttpRequest.__isFileAPIShim=!0,window.FormData=FormData=function(){return{append:function(a,b,c){b.__isFileAPIBlobShim&&(b=b.data[0]),this.data.push({key:a,val:b,name:c})},data:[],__isFileAPIShim:!0}},window.Blob=Blob=function(a){return{data:a,__isFileAPIBlobShim:!0}}}}(),function(){function a(a){return"input"===a[0].tagName.toLowerCase()&&a.attr("type")&&"file"===a.attr("type").toLowerCase()}function b(){try{var a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(a)return!0}catch(b){if(void 0!==navigator.mimeTypes["application/x-shockwave-flash"])return!0}return!1}function c(a){var b=0,c=0;if(window.jQuery)return jQuery(a).offset();if(a.offsetParent)do b+=a.offsetLeft-a.scrollLeft,c+=a.offsetTop-a.scrollTop,a=a.offsetParent;while(a);return{left:b,top:c}}if(FileAPI.shouldLoad){if(FileAPI.hasFlash=b(),FileAPI.forceLoad&&(FileAPI.html5=!1),!FileAPI.upload){var d,e,f,g,h,i=document.createElement("script"),j=document.getElementsByTagName("script");if(window.FileAPI.jsUrl)d=window.FileAPI.jsUrl;else if(window.FileAPI.jsPath)e=window.FileAPI.jsPath;else for(f=0;f<j.length;f++)if(h=j[f].src,g=h.search(/\/ng\-file\-upload[\-a-zA-z0-9\.]*\.js/),g>-1){e=h.substring(0,g+1);break}null==FileAPI.staticPath&&(FileAPI.staticPath=e),i.setAttribute("src",d||e+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(i)}FileAPI.ngfFixIE=function(d,e,f){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var g=function(){var b=e.parent();d.attr("disabled")?b&&b.removeClass("js-fileapi-wrapper"):(e.attr("__ngf_flash_")||(e.unbind("change"),e.unbind("click"),e.bind("change",function(a){h.apply(this,[a]),f.apply(this,[a])}),e.attr("__ngf_flash_","true")),b.addClass("js-fileapi-wrapper"),a(d)||(b.css("position","absolute").css("top",c(d[0]).top+"px").css("left",c(d[0]).left+"px").css("width",d[0].offsetWidth+"px").css("height",d[0].offsetHeight+"px").css("filter","alpha(opacity=0)").css("display",d.css("display")).css("overflow","hidden").css("z-index","900000").css("visibility","visible"),e.css("width",d[0].offsetWidth+"px").css("height",d[0].offsetHeight+"px").css("position","absolute").css("top","0px").css("left","0px")))};d.bind("mouseenter",g);var h=function(a){for(var b=FileAPI.getFiles(a),c=0;c<b.length;c++)void 0===b[c].size&&(b[c].size=0),void 0===b[c].name&&(b[c].name="file"),void 0===b[c].type&&(b[c].type="undefined");a.target||(a.target={}),a.target.files=b,a.target.files!==b&&(a.__files_=b),(a.__files_||a.target.files).item=function(b){return(a.__files_||a.target.files)[b]||null}}},FileAPI.disableFileInput=function(a,b){b?a.removeClass("js-fileapi-wrapper"):a.addClass("js-fileapi-wrapper")}}}(),window.FileReader||(window.FileReader=function(){var a=this,b=!1;this.listeners={},this.addEventListener=function(b,c){a.listeners[b]=a.listeners[b]||[],a.listeners[b].push(c)},this.removeEventListener=function(b,c){a.listeners[b]&&a.listeners[b].splice(a.listeners[b].indexOf(c),1)},this.dispatchEvent=function(b){var c=a.listeners[b.type];if(c)for(var d=0;d<c.length;d++)c[d].call(a,b)},this.onabort=this.onerror=this.onload=this.onloadstart=this.onloadend=this.onprogress=null;var c=function(b,c){var d={type:b,target:a,loaded:c.loaded,total:c.total,error:c.error};return null!=c.result&&(d.target.result=c.result),d},d=function(d){b||(b=!0,a.onloadstart&&a.onloadstart(c("loadstart",d)));var e;"load"===d.type?(a.onloadend&&a.onloadend(c("loadend",d)),e=c("load",d),a.onload&&a.onload(e),a.dispatchEvent(e)):"progress"===d.type?(e=c("progress",d),a.onprogress&&a.onprogress(e),a.dispatchEvent(e)):(e=c("error",d),a.onerror&&a.onerror(e),a.dispatchEvent(e))};this.readAsDataURL=function(a){FileAPI.readAsDataURL(a,d)},this.readAsText=function(a){FileAPI.readAsText(a,d)}});
1091\ No newline at end of file
1092diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload.js
1093index 6b5547a..c6a9c43 100644
1094--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload.js
1095+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload.js
1096@@ -2,7 +2,7 @@
1097 * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
1098 * progress, resize, thumbnail, preview, validation and CORS
1099 * @author Danial <danial.farid@gmail.com>
1100- * @version 12.0.4
1101+ * @version 12.2.13
1102 */
1103
1104 if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
1105@@ -23,7 +23,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
1106
1107 var ngFileUpload = angular.module('ngFileUpload', []);
1108
1109-ngFileUpload.version = '12.0.4';
1110+ngFileUpload.version = '12.2.13';
1111
1112 ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
1113 var upload = this;
1114@@ -90,10 +90,12 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
1115 function uploadWithAngular() {
1116 $http(config).then(function (r) {
1117 if (resumeSupported && config._chunkSize && !config._finished && config._file) {
1118+ var fileSize = config._file && config._file.size || 0;
1119 notifyProgress({
1120- loaded: config._end,
1121- total: config._file && config._file.size,
1122- config: config, type: 'progress'
1123+ loaded: Math.min(config._end, fileSize),
1124+ total: fileSize,
1125+ config: config,
1126+ type: 'progress'
1127 }
1128 );
1129 upload.upload(config, true);
1130@@ -132,6 +134,9 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
1131 } else if (config.resumeSize) {
1132 config.resumeSize().then(function (size) {
1133 config._start = size;
1134+ if (config._chunkSize) {
1135+ config._end = config._start + config._chunkSize;
1136+ }
1137 uploadWithAngular();
1138 }, function (e) {
1139 throw e;
1140@@ -185,9 +190,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
1141 };
1142
1143 upload.promisesCount++;
1144- promise['finally'](function () {
1145- upload.promisesCount--;
1146- });
1147+ if (promise['finally'] && promise['finally'] instanceof Function) {
1148+ promise['finally'](function () {
1149+ upload.promisesCount--;
1150+ });
1151+ }
1152 return promise;
1153 }
1154
1155@@ -371,9 +378,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
1156 var arrayBufferView = new Uint8Array(resp.data);
1157 var type = resp.headers('content-type') || 'image/WebP';
1158 var blob = new window.Blob([arrayBufferView], {type: type});
1159+ var matches = url.match(/.*\/(.+?)(\?.*)?$/);
1160+ if (matches.length > 1) {
1161+ blob.name = matches[1];
1162+ }
1163 defer.resolve(blob);
1164- //var split = type.split('[/;]');
1165- //blob.name = url.substring(0, 150).replace(/\W+/g, '') + '.' + (split.length > 1 ? split[1] : 'jpg');
1166 }, function (e) {
1167 defer.reject(e);
1168 });
1169@@ -421,7 +430,7 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
1170 };
1171
1172 upload.shouldUpdateOn = function (type, attr, scope) {
1173- var modelOptions = upload.attrGetter('ngModelOptions', attr, scope);
1174+ var modelOptions = upload.attrGetter('ngfModelOptions', attr, scope);
1175 if (modelOptions && modelOptions.updateOn) {
1176 return modelOptions.updateOn.split(' ').indexOf(type) > -1;
1177 }
1178@@ -471,13 +480,13 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
1179 return $q.all(promises);
1180 }
1181
1182- function resize(files, attr, scope) {
1183+ function resizeFile(files, attr, scope, ngModel) {
1184 var resizeVal = upload.attrGetter('ngfResize', attr, scope);
1185 if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise();
1186 if (resizeVal instanceof Function) {
1187 var defer = $q.defer();
1188- resizeVal(files).then(function (p) {
1189- resizeWithParams(p, files, attr, scope).then(function (r) {
1190+ return resizeVal(files).then(function (p) {
1191+ resizeWithParams(p, files, attr, scope, ngModel).then(function (r) {
1192 defer.resolve(r);
1193 }, function (e) {
1194 defer.reject(e);
1195@@ -486,27 +495,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
1196 defer.reject(e);
1197 });
1198 } else {
1199- return resizeWithParams(resizeVal, files, attr, scope);
1200+ return resizeWithParams(resizeVal, files, attr, scope, ngModel);
1201 }
1202 }
1203
1204- function resizeWithParams(param, files, attr, scope) {
1205+ function resizeWithParams(params, files, attr, scope, ngModel) {
1206 var promises = [upload.emptyPromise()];
1207
1208 function handleFile(f, i) {
1209 if (f.type.indexOf('image') === 0) {
1210- if (param.pattern && !upload.validatePattern(f, param.pattern)) return;
1211- var promise = upload.resize(f, param.width, param.height, param.quality,
1212- param.type, param.ratio, param.centerCrop, function (width, height) {
1213- return upload.attrGetter('ngfResizeIf', attr, scope,
1214- {$width: width, $height: height, $file: f});
1215- }, param.restoreExif !== false);
1216+ if (params.pattern && !upload.validatePattern(f, params.pattern)) return;
1217+ params.resizeIf = function (width, height) {
1218+ return upload.attrGetter('ngfResizeIf', attr, scope,
1219+ {$width: width, $height: height, $file: f});
1220+ };
1221+ var promise = upload.resize(f, params);
1222 promises.push(promise);
1223 promise.then(function (resizedFile) {
1224 files.splice(i, 1, resizedFile);
1225 }, function (e) {
1226 f.$error = 'resize';
1227+ (f.$errorMessages = (f.$errorMessages || {})).resize = true;
1228 f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name);
1229+ ngModel.$ngfValidations.push({name: 'resize', valid: false});
1230+ upload.applyModelValidation(ngModel, files);
1231 });
1232 }
1233 }
1234@@ -593,18 +605,6 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
1235 return angular.isArray(v) ? v : [v];
1236 }
1237
1238- function separateInvalids() {
1239- valids = [];
1240- invalids = [];
1241- angular.forEach(allNewFiles, function (file) {
1242- if (file.$error) {
1243- invalids.push(file);
1244- } else {
1245- valids.push(file);
1246- }
1247- });
1248- }
1249-
1250 function resizeAndUpdate() {
1251 function updateModel() {
1252 $timeout(function () {
1253@@ -614,17 +614,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
1254 }, options && options.debounce ? options.debounce.change || options.debounce : 0);
1255 }
1256
1257- resize(validateAfterResize ? allNewFiles : valids, attr, scope).then(function () {
1258+ var resizingFiles = validateAfterResize ? allNewFiles : valids;
1259+ resizeFile(resizingFiles, attr, scope, ngModel).then(function () {
1260 if (validateAfterResize) {
1261- upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () {
1262- separateInvalids();
1263- updateModel();
1264- });
1265+ upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
1266+ .then(function (validationResult) {
1267+ valids = validationResult.validsFiles;
1268+ invalids = validationResult.invalidsFiles;
1269+ updateModel();
1270+ });
1271 } else {
1272 updateModel();
1273 }
1274- }, function (e) {
1275- throw 'Could not resize files ' + e;
1276+ }, function () {
1277+ for (var i = 0; i < resizingFiles.length; i++) {
1278+ var f = resizingFiles[i];
1279+ if (f.$error === 'resize') {
1280+ var index = valids.indexOf(f);
1281+ if (index > -1) {
1282+ valids.splice(index, 1);
1283+ invalids.push(f);
1284+ }
1285+ updateModel();
1286+ }
1287+ }
1288 });
1289 }
1290
1291@@ -654,13 +667,15 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
1292
1293 var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope);
1294
1295- var options = upload.attrGetter('ngModelOptions', attr, scope);
1296- upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () {
1297+ var options = upload.attrGetter('ngfModelOptions', attr, scope);
1298+ upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
1299+ .then(function (validationResult) {
1300 if (noDelay) {
1301 update(allNewFiles, [], files, dupFiles, isSingleModel);
1302 } else {
1303 if ((!options || !options.allowInvalid) && !validateAfterResize) {
1304- separateInvalids();
1305+ valids = validationResult.validFiles;
1306+ invalids = validationResult.invalidFiles;
1307 } else {
1308 valids = allNewFiles;
1309 }
1310@@ -697,7 +712,7 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1311 /** @namespace attr.ngfSelect */
1312 /** @namespace attr.ngfChange */
1313 /** @namespace attr.ngModel */
1314- /** @namespace attr.ngModelOptions */
1315+ /** @namespace attr.ngfModelOptions */
1316 /** @namespace attr.ngfMultiple */
1317 /** @namespace attr.ngfCapture */
1318 /** @namespace attr.ngfValidate */
1319@@ -717,6 +732,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1320 function changeFn(evt) {
1321 if (upload.shouldUpdateOn('change', attr, scope)) {
1322 var fileList = evt.__files_ || (evt.target && evt.target.files), files = [];
1323+ /* Handle duplicate call in IE11 */
1324+ if (!fileList) return;
1325 for (var i = 0; i < fileList.length; i++) {
1326 files.push(fileList[i]);
1327 }
1328@@ -728,31 +745,39 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1329 upload.registerModelChangeValidator(ngModel, attr, scope);
1330
1331 var unwatches = [];
1332- unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () {
1333- fileElem.attr('multiple', attrGetter('ngfMultiple', scope));
1334- }));
1335- unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () {
1336- fileElem.attr('capture', attrGetter('ngfCapture', scope));
1337- }));
1338- unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () {
1339- fileElem.attr('accept', attrGetter('ngfAccept', scope));
1340- }));
1341- attr.$observe('accept', function () {
1342+ if (attrGetter('ngfMultiple')) {
1343+ unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () {
1344+ fileElem.attr('multiple', attrGetter('ngfMultiple', scope));
1345+ }));
1346+ }
1347+ if (attrGetter('ngfCapture')) {
1348+ unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () {
1349+ fileElem.attr('capture', attrGetter('ngfCapture', scope));
1350+ }));
1351+ }
1352+ if (attrGetter('ngfAccept')) {
1353+ unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () {
1354+ fileElem.attr('accept', attrGetter('ngfAccept', scope));
1355+ }));
1356+ }
1357+ unwatches.push(attr.$observe('accept', function () {
1358 fileElem.attr('accept', attrGetter('accept'));
1359- });
1360- unwatches.push(function () {
1361- if (attr.$$observers) delete attr.$$observers.accept;
1362- });
1363- function bindAttrToFileInput(fileElem) {
1364- if (elem !== fileElem) {
1365- for (var i = 0; i < elem[0].attributes.length; i++) {
1366- var attribute = elem[0].attributes[i];
1367- if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') {
1368- if (attribute.value == null || attribute.value === '') {
1369- if (attribute.name === 'required') attribute.value = 'required';
1370- if (attribute.name === 'multiple') attribute.value = 'multiple';
1371- }
1372- fileElem.attr(attribute.name, attribute.name === 'id' ? 'ngf-' + attribute.value : attribute.value);
1373+ }));
1374+ function bindAttrToFileInput(fileElem, label) {
1375+ function updateId(val) {
1376+ fileElem.attr('id', 'ngf-' + val);
1377+ label.attr('id', 'ngf-label-' + val);
1378+ }
1379+
1380+ for (var i = 0; i < elem[0].attributes.length; i++) {
1381+ var attribute = elem[0].attributes[i];
1382+ if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') {
1383+ if (attribute.name === 'id') {
1384+ updateId(attribute.value);
1385+ unwatches.push(attr.$observe('id', updateId));
1386+ } else {
1387+ fileElem.attr(attribute.name, (!attribute.value && (attribute.name === 'required' ||
1388+ attribute.name === 'multiple')) ? attribute.name : attribute.value);
1389 }
1390 }
1391 }
1392@@ -765,12 +790,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1393
1394 var fileElem = angular.element('<input type="file">');
1395
1396- bindAttrToFileInput(fileElem);
1397-
1398 var label = angular.element('<label>upload</label>');
1399 label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden')
1400 .css('width', '0px').css('height', '0px').css('border', 'none')
1401 .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1');
1402+ bindAttrToFileInput(fileElem, label);
1403+
1404 generatedElems.push({el: elem, ref: label});
1405
1406 document.body.appendChild(label.append(fileElem)[0]);
1407@@ -778,13 +803,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1408 return fileElem;
1409 }
1410
1411- var initialTouchStartY = 0;
1412-
1413 function clickHandler(evt) {
1414 if (elem.attr('disabled')) return false;
1415 if (attrGetter('ngfSelectDisabled', scope)) return;
1416
1417- var r = handleTouch(evt);
1418+ var r = detectSwipe(evt);
1419+ // prevent the click if it is a swipe
1420 if (r != null) return r;
1421
1422 resetModel(evt);
1423@@ -796,7 +820,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1424 document.body.appendChild(fileElem.parent()[0]);
1425 fileElem.bind('change', changeFn);
1426 }
1427- } catch(e){/*ignore*/}
1428+ } catch (e) {/*ignore*/
1429+ }
1430
1431 if (isDelayedClickSupported(navigator.userAgent)) {
1432 setTimeout(function () {
1433@@ -809,19 +834,30 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1434 return false;
1435 }
1436
1437- function handleTouch(evt) {
1438- var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches);
1439- if (evt.type === 'touchstart') {
1440- initialTouchStartY = touches ? touches[0].clientY : 0;
1441- return true; // don't block event default
1442- } else {
1443- evt.stopPropagation();
1444- evt.preventDefault();
1445
1446- // prevent scroll from triggering event
1447- if (evt.type === 'touchend') {
1448- var currentLocation = touches ? touches[0].clientY : 0;
1449- if (Math.abs(currentLocation - initialTouchStartY) > 20) return false;
1450+ var initialTouchStartY = 0;
1451+ var initialTouchStartX = 0;
1452+
1453+ function detectSwipe(evt) {
1454+ var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches);
1455+ if (touches) {
1456+ if (evt.type === 'touchstart') {
1457+ initialTouchStartX = touches[0].clientX;
1458+ initialTouchStartY = touches[0].clientY;
1459+ return true; // don't block event default
1460+ } else {
1461+ // prevent scroll from triggering event
1462+ if (evt.type === 'touchend') {
1463+ var currentX = touches[0].clientX;
1464+ var currentY = touches[0].clientY;
1465+ if ((Math.abs(currentX - initialTouchStartX) > 20) ||
1466+ (Math.abs(currentY - initialTouchStartY) > 20)) {
1467+ evt.stopPropagation();
1468+ evt.preventDefault();
1469+ return false;
1470+ }
1471+ }
1472+ return true;
1473 }
1474 }
1475 }
1476@@ -1052,14 +1088,19 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1477 var size = resizeParams;
1478 if (directiveName === 'ngfThumbnail') {
1479 if (!size) {
1480- size = {width: elem[0].clientWidth, height: elem[0].clientHeight};
1481+ size = {
1482+ width: elem[0].naturalWidth || elem[0].clientWidth,
1483+ height: elem[0].naturalHeight || elem[0].clientHeight
1484+ };
1485 }
1486 if (size.width === 0 && window.getComputedStyle) {
1487 var style = getComputedStyle(elem[0]);
1488- size = {
1489- width: parseInt(style.width.slice(0, -2)),
1490- height: parseInt(style.height.slice(0, -2))
1491- };
1492+ if (style.width && style.width.indexOf('px') > -1 && style.height && style.height.indexOf('px') > -1) {
1493+ size = {
1494+ width: parseInt(style.width.slice(0, -2)),
1495+ height: parseInt(style.height.slice(0, -2))
1496+ };
1497+ }
1498 }
1499 }
1500
1501@@ -1074,7 +1115,11 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1502 if (file && file.type && file.type.search(getTagType(elem[0])) === 0 &&
1503 (!isBackground || file.type.indexOf('image') === 0)) {
1504 if (size && Upload.isResizeSupported()) {
1505- Upload.resize(file, size.width, size.height, size.quality).then(
1506+ size.resizeIf = function (width, height) {
1507+ return Upload.attrGetter('ngfResizeIf', attr, scope,
1508+ {$width: width, $height: height, $file: file});
1509+ };
1510+ Upload.resize(file, size).then(
1511 function (f) {
1512 constructDataUrl(f);
1513 }, function (e) {
1514@@ -1136,8 +1181,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1515 }]);
1516
1517 ngFileUpload.config(['$compileProvider', function ($compileProvider) {
1518- if ($compileProvider.imgSrcSanitizationWhitelist) $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/);
1519- if ($compileProvider.aHrefSanitizationWhitelist) $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/);
1520+ if ($compileProvider.imgSrcSanitizationWhitelist) $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
1521+ if ($compileProvider.aHrefSanitizationWhitelist) $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
1522 }]);
1523
1524 ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) {
1525@@ -1229,13 +1274,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1526 if (ngModel) {
1527 ngModel.$formatters.push(function (files) {
1528 if (ngModel.$dirty) {
1529+ var filesArray = files;
1530 if (files && !angular.isArray(files)) {
1531- files = [files];
1532+ filesArray = [files];
1533 }
1534- upload.validate(files, 0, ngModel, attr, scope).then(function () {
1535- upload.applyModelValidation(ngModel, files);
1536+ upload.validate(filesArray, 0, ngModel, attr, scope).then(function () {
1537+ upload.applyModelValidation(ngModel, filesArray);
1538 });
1539 }
1540+ return files;
1541 });
1542 }
1543 };
1544@@ -1285,11 +1332,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1545 return upload.attrGetter(name, attr, scope, params);
1546 };
1547
1548+ var ignoredErrors = (upload.attrGetter('ngfIgnoreInvalid', attr, scope) || '').split(' ');
1549+ var runAllValidation = upload.attrGetter('ngfRunAllValidations', attr, scope);
1550+
1551 if (files == null || files.length === 0) {
1552- return upload.emptyPromise(ngModel);
1553+ return upload.emptyPromise({'validFiles': files, 'invalidFiles': []});
1554 }
1555
1556 files = files.length === undefined ? [files] : files.slice(0);
1557+ var invalidFiles = [];
1558
1559 function validateSync(name, validationName, fn) {
1560 if (files) {
1561@@ -1300,11 +1351,20 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1562 var val = upload.getValidationAttr(attr, scope, name, validationName, file);
1563 if (val != null) {
1564 if (!fn(file, val, i)) {
1565- file.$error = name;
1566- (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
1567- file.$errorParam = val;
1568- files.splice(i, 1);
1569- valid = false;
1570+ if (ignoredErrors.indexOf(name) === -1) {
1571+ file.$error = name;
1572+ (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
1573+ file.$errorParam = val;
1574+ if (invalidFiles.indexOf(file) === -1) {
1575+ invalidFiles.push(file);
1576+ }
1577+ if (!runAllValidation) {
1578+ files.splice(i, 1);
1579+ }
1580+ valid = false;
1581+ } else {
1582+ files.splice(i, 1);
1583+ }
1584 }
1585 }
1586 }
1587@@ -1315,9 +1375,6 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1588 }
1589 }
1590
1591- validateSync('maxFiles', null, function (file, val, i) {
1592- return prevLength + i < val;
1593- });
1594 validateSync('pattern', null, upload.validatePattern);
1595 validateSync('minSize', 'size.min', function (file, val) {
1596 return file.size + 0.1 >= upload.translateScalars(val);
1597@@ -1340,44 +1397,58 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1598 });
1599
1600 if (!files.length) {
1601- return upload.emptyPromise(ngModel, ngModel.$ngfValidations);
1602+ return upload.emptyPromise({'validFiles': [], 'invalidFiles': invalidFiles});
1603 }
1604
1605 function validateAsync(name, validationName, type, asyncFn, fn) {
1606 function resolveResult(defer, file, val) {
1607- if (val != null) {
1608- asyncFn(file, val).then(function (d) {
1609- if (!fn(d, val)) {
1610+ function resolveInternal(fn) {
1611+ if (fn()) {
1612+ if (ignoredErrors.indexOf(name) === -1) {
1613 file.$error = name;
1614 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
1615 file.$errorParam = val;
1616- defer.reject();
1617+ if (invalidFiles.indexOf(file) === -1) {
1618+ invalidFiles.push(file);
1619+ }
1620+ if (!runAllValidation) {
1621+ var i = files.indexOf(file);
1622+ if (i > -1) files.splice(i, 1);
1623+ }
1624+ defer.resolve(false);
1625 } else {
1626- defer.resolve();
1627+ var j = files.indexOf(file);
1628+ if (j > -1) files.splice(j, 1);
1629+ defer.resolve(true);
1630 }
1631+ } else {
1632+ defer.resolve(true);
1633+ }
1634+ }
1635+
1636+ if (val != null) {
1637+ asyncFn(file, val).then(function (d) {
1638+ resolveInternal(function () {
1639+ return !fn(d, val);
1640+ });
1641 }, function () {
1642- if (attrGetter('ngfValidateForce', {$file: file})) {
1643- file.$error = name;
1644- (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
1645- file.$errorParam = val;
1646- defer.reject();
1647- } else {
1648- defer.resolve();
1649- }
1650+ resolveInternal(function () {
1651+ return attrGetter('ngfValidateForce', {$file: file});
1652+ });
1653 });
1654 } else {
1655- defer.resolve();
1656+ defer.resolve(true);
1657 }
1658 }
1659
1660- var promises = [upload.emptyPromise()];
1661+ var promises = [upload.emptyPromise(true)];
1662 if (files) {
1663 files = files.length === undefined ? [files] : files;
1664 angular.forEach(files, function (file) {
1665 var defer = $q.defer();
1666 promises.push(defer.promise);
1667 if (type && (file.type == null || file.type.search(type) !== 0)) {
1668- defer.resolve();
1669+ defer.resolve(true);
1670 return;
1671 }
1672 if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) {
1673@@ -1385,96 +1456,120 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1674 resolveResult(defer, file,
1675 attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height}));
1676 }, function () {
1677- defer.reject();
1678+ defer.resolve(false);
1679 });
1680 } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) {
1681 upload.mediaDuration(file).then(function (d) {
1682 resolveResult(defer, file,
1683 attrGetter('ngfDuration', {$file: file, $duration: d}));
1684 }, function () {
1685- defer.reject();
1686+ defer.resolve(false);
1687 });
1688 } else {
1689 resolveResult(defer, file,
1690 upload.getValidationAttr(attr, scope, name, validationName, file));
1691 }
1692 });
1693- return $q.all(promises).then(function () {
1694- ngModel.$ngfValidations.push({name: name, valid: true});
1695- }, function () {
1696- ngModel.$ngfValidations.push({name: name, valid: false});
1697- });
1698 }
1699+ var deffer = $q.defer();
1700+ $q.all(promises).then(function (values) {
1701+ var isValid = true;
1702+ for (var i = 0; i < values.length; i++) {
1703+ if (!values[i]) {
1704+ isValid = false;
1705+ break;
1706+ }
1707+ }
1708+ ngModel.$ngfValidations.push({name: name, valid: isValid});
1709+ deffer.resolve(isValid);
1710+ });
1711+ return deffer.promise;
1712 }
1713
1714 var deffer = $q.defer();
1715 var promises = [];
1716
1717- promises.push(upload.happyPromise(validateAsync('maxHeight', 'height.max', /image/,
1718+ promises.push(validateAsync('maxHeight', 'height.max', /image/,
1719 this.imageDimensions, function (d, val) {
1720 return d.height <= val;
1721- })));
1722- promises.push(upload.happyPromise(validateAsync('minHeight', 'height.min', /image/,
1723+ }));
1724+ promises.push(validateAsync('minHeight', 'height.min', /image/,
1725 this.imageDimensions, function (d, val) {
1726 return d.height >= val;
1727- })));
1728- promises.push(upload.happyPromise(validateAsync('maxWidth', 'width.max', /image/,
1729+ }));
1730+ promises.push(validateAsync('maxWidth', 'width.max', /image/,
1731 this.imageDimensions, function (d, val) {
1732 return d.width <= val;
1733- })));
1734- promises.push(upload.happyPromise(validateAsync('minWidth', 'width.min', /image/,
1735+ }));
1736+ promises.push(validateAsync('minWidth', 'width.min', /image/,
1737 this.imageDimensions, function (d, val) {
1738 return d.width >= val;
1739- })));
1740- promises.push(upload.happyPromise(validateAsync('dimensions', null, /image/,
1741+ }));
1742+ promises.push(validateAsync('dimensions', null, /image/,
1743 function (file, val) {
1744 return upload.emptyPromise(val);
1745 }, function (r) {
1746 return r;
1747- })));
1748- promises.push(upload.happyPromise(validateAsync('ratio', null, /image/,
1749+ }));
1750+ promises.push(validateAsync('ratio', null, /image/,
1751 this.imageDimensions, function (d, val) {
1752 var split = val.toString().split(','), valid = false;
1753 for (var i = 0; i < split.length; i++) {
1754- if (Math.abs((d.width / d.height) - upload.ratioToFloat(split[i])) < 0.0001) {
1755+ if (Math.abs((d.width / d.height) - upload.ratioToFloat(split[i])) < 0.01) {
1756 valid = true;
1757 }
1758 }
1759 return valid;
1760- })));
1761- promises.push(upload.happyPromise(validateAsync('maxRatio', 'ratio.max', /image/,
1762+ }));
1763+ promises.push(validateAsync('maxRatio', 'ratio.max', /image/,
1764 this.imageDimensions, function (d, val) {
1765 return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001;
1766- })));
1767- promises.push(upload.happyPromise(validateAsync('minRatio', 'ratio.min', /image/,
1768+ }));
1769+ promises.push(validateAsync('minRatio', 'ratio.min', /image/,
1770 this.imageDimensions, function (d, val) {
1771 return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001;
1772- })));
1773- promises.push(upload.happyPromise(validateAsync('maxDuration', 'duration.max', /audio|video/,
1774+ }));
1775+ promises.push(validateAsync('maxDuration', 'duration.max', /audio|video/,
1776 this.mediaDuration, function (d, val) {
1777 return d <= upload.translateScalars(val);
1778- })));
1779- promises.push(upload.happyPromise(validateAsync('minDuration', 'duration.min', /audio|video/,
1780+ }));
1781+ promises.push(validateAsync('minDuration', 'duration.min', /audio|video/,
1782 this.mediaDuration, function (d, val) {
1783 return d >= upload.translateScalars(val);
1784- })));
1785- promises.push(upload.happyPromise(validateAsync('duration', null, /audio|video/,
1786+ }));
1787+ promises.push(validateAsync('duration', null, /audio|video/,
1788 function (file, val) {
1789 return upload.emptyPromise(val);
1790 }, function (r) {
1791 return r;
1792- })));
1793+ }));
1794
1795- promises.push(upload.happyPromise(validateAsync('validateAsyncFn', null, null,
1796+ promises.push(validateAsync('validateAsyncFn', null, null,
1797 function (file, val) {
1798 return val;
1799 }, function (r) {
1800 return r === true || r === null || r === '';
1801- })));
1802+ }));
1803+
1804+ $q.all(promises).then(function () {
1805+
1806+ if (runAllValidation) {
1807+ for (var i = 0; i < files.length; i++) {
1808+ var file = files[i];
1809+ if (file.$error) {
1810+ files.splice(i--, 1);
1811+ }
1812+ }
1813+ }
1814+
1815+ runAllValidation = false;
1816+ validateSync('maxFiles', null, function (file, val, i) {
1817+ return prevLength + i < val;
1818+ });
1819
1820- return $q.all(promises).then(function () {
1821- deffer.resolve(ngModel, ngModel.$ngfValidations);
1822+ deffer.resolve({'validFiles': files, 'invalidFiles': invalidFiles});
1823 });
1824+ return deffer.promise;
1825 };
1826
1827 upload.imageDimensions = function (file) {
1828@@ -1499,8 +1594,8 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1829 .css('max-width', 'none !important').css('max-height', 'none !important');
1830
1831 function success() {
1832- var width = img[0].clientWidth;
1833- var height = img[0].clientHeight;
1834+ var width = img[0].naturalWidth || img[0].clientWidth;
1835+ var height = img[0].naturalHeight || img[0].clientHeight;
1836 img.remove();
1837 file.$ngfWidth = width;
1838 file.$ngfHeight = height;
1839@@ -1514,23 +1609,23 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1840
1841 img.on('load', success);
1842 img.on('error', error);
1843- var count = 0;
1844
1845- function checkLoadError() {
1846+ var secondsCounter = 0;
1847+ function checkLoadErrorInCaseOfNoCallback() {
1848 $timeout(function () {
1849 if (img[0].parentNode) {
1850 if (img[0].clientWidth) {
1851 success();
1852- } else if (count > 10) {
1853+ } else if (secondsCounter++ > 10) {
1854 error();
1855 } else {
1856- checkLoadError();
1857+ checkLoadErrorInCaseOfNoCallback();
1858 }
1859 }
1860 }, 1000);
1861 }
1862
1863- checkLoadError();
1864+ checkLoadErrorInCaseOfNoCallback();
1865
1866 angular.element(document.getElementsByTagName('body')[0]).append(img);
1867 }, function () {
1868@@ -1641,31 +1736,35 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1869 var deferred = $q.defer();
1870 var canvasElement = document.createElement('canvas');
1871 var imageElement = document.createElement('img');
1872+ imageElement.setAttribute('style', 'visibility:hidden;position:fixed;z-index:-100000');
1873+ document.body.appendChild(imageElement);
1874
1875 imageElement.onload = function () {
1876- if (resizeIf != null && resizeIf(imageElement.width, imageElement.height) === false) {
1877+ var imgWidth = imageElement.width, imgHeight = imageElement.height;
1878+ imageElement.parentNode.removeChild(imageElement);
1879+ if (resizeIf != null && resizeIf(imgWidth, imgHeight) === false) {
1880 deferred.reject('resizeIf');
1881 return;
1882 }
1883 try {
1884 if (ratio) {
1885 var ratioFloat = upload.ratioToFloat(ratio);
1886- var imgRatio = imageElement.width / imageElement.height;
1887+ var imgRatio = imgWidth / imgHeight;
1888 if (imgRatio < ratioFloat) {
1889- width = imageElement.width;
1890+ width = imgWidth;
1891 height = width / ratioFloat;
1892 } else {
1893- height = imageElement.height;
1894+ height = imgHeight;
1895 width = height * ratioFloat;
1896 }
1897 }
1898 if (!width) {
1899- width = imageElement.width;
1900+ width = imgWidth;
1901 }
1902 if (!height) {
1903- height = imageElement.height;
1904+ height = imgHeight;
1905 }
1906- var dimensions = calculateAspectRatioFit(imageElement.width, imageElement.height, width, height, centerCrop);
1907+ var dimensions = calculateAspectRatioFit(imgWidth, imgHeight, width, height, centerCrop);
1908 canvasElement.width = Math.min(dimensions.width, width);
1909 canvasElement.height = Math.min(dimensions.height, height);
1910 var context = canvasElement.getContext('2d');
1911@@ -1678,6 +1777,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1912 }
1913 };
1914 imageElement.onerror = function () {
1915+ imageElement.parentNode.removeChild(imageElement);
1916 deferred.reject();
1917 };
1918 imageElement.src = imagen;
1919@@ -1714,14 +1814,15 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1920 });
1921 }
1922
1923- upload.resize = function (file, width, height, quality, type, ratio, centerCrop, resizeIf, restoreExif) {
1924+ upload.resize = function (file, options) {
1925 if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file);
1926
1927 var deferred = $q.defer();
1928 upload.dataUrl(file, true).then(function (url) {
1929- resize(url, width, height, quality, type || file.type, ratio, centerCrop, resizeIf)
1930+ resize(url, options.width, options.height, options.quality, options.type || file.type,
1931+ options.ratio, options.centerCrop, options.resizeIf)
1932 .then(function (dataUrl) {
1933- if (file.type === 'image/jpeg' && restoreExif) {
1934+ if (file.type === 'image/jpeg' && options.restoreExif !== false) {
1935 try {
1936 dataUrl = upload.restoreExif(url, dataUrl);
1937 } catch (e) {
1938@@ -1750,13 +1851,13 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1939 }]);
1940
1941 (function () {
1942- ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$location', 'Upload', '$http', '$q',
1943- function ($parse, $timeout, $location, Upload, $http, $q) {
1944+ ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$window', 'Upload', '$http', '$q',
1945+ function ($parse, $timeout, $window, Upload, $http, $q) {
1946 return {
1947 restrict: 'AEC',
1948 require: '?ngModel',
1949 link: function (scope, elem, attr, ngModel) {
1950- linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, Upload, $http, $q);
1951+ linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, Upload, $http, $q);
1952 }
1953 };
1954 }]);
1955@@ -1781,7 +1882,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1956 };
1957 }]);
1958
1959- function linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, upload, $http, $q) {
1960+ function linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, upload, $http, $q) {
1961 var available = dropAvailable();
1962
1963 var attrGetter = function (name, scope, params) {
1964@@ -1857,23 +1958,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1965 if (stopPropagation(scope)) evt.stopPropagation();
1966 if (actualDragOverClass) elem.removeClass(actualDragOverClass);
1967 actualDragOverClass = null;
1968- var items = evt.dataTransfer.items;
1969- var html;
1970- try {
1971- html = evt.dataTransfer && evt.dataTransfer.getData && evt.dataTransfer.getData('text/html');
1972- } catch (e) {/* Fix IE11 that throw error calling getData */
1973- }
1974-
1975- extractFiles(items, evt.dataTransfer.files, attrGetter('ngfAllowDir', scope) !== false,
1976- attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) {
1977- if (files.length) {
1978- updateModel(files, evt);
1979- } else {
1980- extractFilesFromHtml('dropUrl', html).then(function (files) {
1981- updateModel(files, evt);
1982- });
1983- }
1984- });
1985+ extractFilesAndUpdateModel(evt.dataTransfer, evt, 'dropUrl');
1986 }, false);
1987 elem[0].addEventListener('paste', function (evt) {
1988 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
1989@@ -1881,22 +1966,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1990 evt.preventDefault();
1991 }
1992 if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return;
1993- var files = [];
1994- var clipboard = evt.clipboardData || evt.originalEvent.clipboardData;
1995- if (clipboard && clipboard.items) {
1996- for (var k = 0; k < clipboard.items.length; k++) {
1997- if (clipboard.items[k].type.indexOf('image') !== -1) {
1998- files.push(clipboard.items[k].getAsFile());
1999- }
2000- }
2001- }
2002- if (files.length) {
2003- updateModel(files, evt);
2004- } else {
2005- extractFilesFromHtml('pasteUrl', clipboard).then(function (files) {
2006- updateModel(files, evt);
2007- });
2008- }
2009+ extractFilesAndUpdateModel(evt.clipboardData || evt.originalEvent.clipboardData, evt, 'pasteUrl');
2010 }, false);
2011
2012 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
2013@@ -1909,12 +1979,33 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2014 });
2015 }
2016
2017+ function extractFilesAndUpdateModel(source, evt, updateOnType) {
2018+ if (!source) return;
2019+ // html needs to be calculated on the same process otherwise the data will be wiped
2020+ // after promise resolve or setTimeout.
2021+ var html;
2022+ try {
2023+ html = source && source.getData && source.getData('text/html');
2024+ } catch (e) {/* Fix IE11 that throw error calling getData */
2025+ }
2026+ extractFiles(source.items, source.files, attrGetter('ngfAllowDir', scope) !== false,
2027+ attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) {
2028+ if (files.length) {
2029+ updateModel(files, evt);
2030+ } else {
2031+ extractFilesFromHtml(updateOnType, html).then(function (files) {
2032+ updateModel(files, evt);
2033+ });
2034+ }
2035+ });
2036+ }
2037+
2038 function updateModel(files, evt) {
2039 upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt);
2040 }
2041
2042 function extractFilesFromHtml(updateOn, html) {
2043- if (!upload.shouldUpdateOn(updateOn, attr, scope) || !html) return upload.rejectPromise([]);
2044+ if (!upload.shouldUpdateOn(updateOn, attr, scope) || typeof html !== 'string') return upload.rejectPromise([]);
2045 var urls = [];
2046 html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) {
2047 urls.push(src);
2048@@ -1965,8 +2056,14 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2049 }
2050
2051 function extractFiles(items, fileList, allowDir, multiple) {
2052- var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles') || Number.MAX_VALUE;
2053- var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize') || Number.MAX_VALUE;
2054+ var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles');
2055+ if (maxFiles == null) {
2056+ maxFiles = Number.MAX_VALUE;
2057+ }
2058+ var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize');
2059+ if (maxTotalSize == null) {
2060+ maxTotalSize = Number.MAX_VALUE;
2061+ }
2062 var includeDir = attrGetter('ngfIncludeDir', scope);
2063 var files = [], totalSize = 0;
2064
2065@@ -1977,7 +2074,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2066 var promises = [upload.emptyPromise()];
2067 if (includeDir) {
2068 var file = {type: 'directory'};
2069- file.name = file.path = (path || '') + entry.name + entry.name;
2070+ file.name = file.path = (path || '') + entry.name;
2071 files.push(file);
2072 }
2073 var dirReader = entry.createReader();
2074@@ -2031,7 +2128,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2075
2076 var promises = [upload.emptyPromise()];
2077
2078- if (items && items.length > 0 && $location.protocol() !== 'file') {
2079+ if (items && items.length > 0 && $window.location.protocol !== 'file:') {
2080 for (var i = 0; i < items.length; i++) {
2081 if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) {
2082 var entry = items[i].webkitGetAsEntry();
2083diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js
2084index e87a65e..4bfe942 100644
2085--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js
2086+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js
2087@@ -1,3 +1,3 @@
2088-/*! 12.0.4 */
2089-!window.XMLHttpRequest||window.FileAPI&&FileAPI.shouldLoad||(window.XMLHttpRequest.prototype.setRequestHeader=function(a){return function(b,c){if("__setXHR_"===b){var d=c(this);d instanceof Function&&d(this)}else a.apply(this,arguments)}}(window.XMLHttpRequest.prototype.setRequestHeader));var ngFileUpload=angular.module("ngFileUpload",[]);ngFileUpload.version="12.0.4",ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){function e(a){j.notify&&j.notify(a),k.progressFunc&&c(function(){k.progressFunc(a)})}function h(a){return null!=d._start&&g?{loaded:a.loaded+d._start,total:d._file&&d._file.size||a.total,type:a.type,config:d,lengthComputable:!0,target:a.target}:a}function i(){a(d).then(function(a){g&&d._chunkSize&&!d._finished&&d._file?(e({loaded:d._end,total:d._file&&d._file.size,config:d,type:"progress"}),f.upload(d,!0)):(d._finished&&delete d._finished,j.resolve(a))},function(a){j.reject(a)},function(a){j.notify(a)})}d.method=d.method||"POST",d.headers=d.headers||{};var j=d._deferred=d._deferred||b.defer(),k=j.promise;return d.disableProgress||(d.headers.__setXHR_=function(){return function(a){a&&a.upload&&a.upload.addEventListener&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e(h(a))},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e(h(a)))},!1))}}),g?d._chunkSize&&d._end&&!d._finished?(d._start=d._end,d._end+=d._chunkSize,i()):d.resumeSizeUrl?a.get(d.resumeSizeUrl).then(function(a){d._start=d.resumeSizeResponseReader?d.resumeSizeResponseReader(a.data):parseInt((null==a.data.size?a.data:a.data.size).toString()),d._chunkSize&&(d._end=d._start+d._chunkSize),i()},function(a){throw a}):d.resumeSize?d.resumeSize().then(function(a){d._start=a,i()},function(a){throw a}):(d._chunkSize&&(d._start=0,d._end=d._start+d._chunkSize),i()):i(),k.success=function(a){return k.then(function(b){a(b.data,b.status,b.headers,d)}),k},k.error=function(a){return k.then(null,function(b){a(b.data,b.status,b.headers,d)}),k},k.progress=function(a){return k.progressFunc=a,k.then(null,null,function(b){a(b)}),k},k.abort=k.pause=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),k},k.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(k,arguments),a.apply(k,arguments)}}(d.xhrFn),k},f.promisesCount++,k["finally"](function(){f.promisesCount--}),k}function e(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}var f=this;f.promisesCount=0,this.isResumeSupported=function(){return window.Blob&&window.Blob.prototype.slice};var g=this.isResumeSupported();this.isUploadInProgress=function(){return f.promisesCount>0},this.rename=function(a,b){return a.ngfName=b,a},this.jsonBlob=function(a){null==a||angular.isString(a)||(a=JSON.stringify(a));var b=new window.Blob([a],{type:"application/json"});return b._ngfBlob=!0,b},this.json=function(a){return angular.toJson(a)},this.isFile=function(a){return null!=a&&(a instanceof window.Blob||a.flashId&&a.name&&a.size)},this.upload=function(a,b){function c(b,c){if(b._ngfBlob)return b;if(a._file=a._file||b,null!=a._start&&g){a._end&&a._end>=b.size&&(a._finished=!0,a._end=b.size);var d=b.slice(a._start,a._end||b.size);return d.name=b.name,d.ngfName=b.ngfName,a._chunkSize&&(c.append("_chunkSize",a._chunkSize),c.append("_currentChunkSize",a._end-a._start),c.append("_chunkNumber",Math.floor(a._start/a._chunkSize)),c.append("_totalSize",a._file.size)),d}return b}function h(b,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))b.append(e,d);else if(f.isFile(d)){var g=c(d,b),i=e.split(",");i[1]&&(g.ngfName=i[1].replace(/^\s+|\s+$/g,""),e=i[0]),a._fileKey=a._fileKey||e,b.append(e,g,g.ngfName||g.name)}else if(angular.isObject(d)){if(d.$$ngfCircularDetection)throw"ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: "+e;d.$$ngfCircularDetection=!0;try{for(var j in d)if(d.hasOwnProperty(j)&&"$$ngfCircularDetection"!==j){var k=null==a.objectKey?"[i]":a.objectKey;d.length&&parseInt(j)>-1&&(k=null==a.arrayKey?k:a.arrayKey),h(b,d[j],e+k.replace(/[ik]/g,j))}}finally{delete d.$$ngfCircularDetection}}else b.append(e,d)}function i(){a._chunkSize=f.translateScalars(a.resumeChunkSize),a._chunkSize=a._chunkSize?parseInt(a._chunkSize.toString()):null,a.headers=a.headers||{},a.headers["Content-Type"]=void 0,a.transformRequest=a.transformRequest?angular.isArray(a.transformRequest)?a.transformRequest:[a.transformRequest]:[],a.transformRequest.push(function(b){var c,d=new window.FormData;b=b||a.fields||{},a.file&&(b.file=a.file);for(c in b)if(b.hasOwnProperty(c)){var e=b[c];a.formDataAppender?a.formDataAppender(d,c,e):h(d,e,c)}return d})}return b||(a=e(a)),a._isDigested||(a._isDigested=!0,i()),d(a)},this.http=function(b){return b=e(b),b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof window.Blob?b:a.defaults.transformRequest[0].apply(this,arguments)},b._chunkSize=f.translateScalars(b.resumeChunkSize),b._chunkSize=b._chunkSize?parseInt(b._chunkSize.toString()):null,d(b)},this.translateScalars=function(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1024*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1048576*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1073741824*a.substring(0,a.length-2));if(a.search(/b/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/s/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/m/i)===a.length-1)return parseFloat(60*a.substring(0,a.length-1));if(a.search(/h/i)===a.length-1)return parseFloat(3600*a.substring(0,a.length-1))}return a},this.urlToBlob=function(c){var d=b.defer();return a({url:c,method:"get",responseType:"arraybuffer"}).then(function(a){var b=new Uint8Array(a.data),c=a.headers("content-type")||"image/WebP",e=new window.Blob([b],{type:c});d.resolve(e)},function(a){d.reject(a)}),d.promise},this.setDefaults=function(a){this.defaults=a||{}},this.defaults={},this.version=ngFileUpload.version}]),ngFileUpload.service("Upload",["$parse","$timeout","$compile","$q","UploadExif",function(a,b,c,d,e){function f(a,b,c){var e=[i.emptyPromise()];return angular.forEach(a,function(d,f){0===d.type.indexOf("image/jpeg")&&i.attrGetter("ngfFixOrientation",b,c,{$file:d})&&e.push(i.happyPromise(i.applyExifRotation(d),d).then(function(b){a.splice(f,1,b)}))}),d.all(e)}function g(a,b,c){var e=i.attrGetter("ngfResize",b,c);if(!e||!i.isResizeSupported()||!a.length)return i.emptyPromise();if(!(e instanceof Function))return h(e,a,b,c);var f=d.defer();e(a).then(function(d){h(d,a,b,c).then(function(a){f.resolve(a)},function(a){f.reject(a)})},function(a){f.reject(a)})}function h(a,b,c,e){function f(d,f){if(0===d.type.indexOf("image")){if(a.pattern&&!i.validatePattern(d,a.pattern))return;var h=i.resize(d,a.width,a.height,a.quality,a.type,a.ratio,a.centerCrop,function(a,b){return i.attrGetter("ngfResizeIf",c,e,{$width:a,$height:b,$file:d})},a.restoreExif!==!1);g.push(h),h.then(function(a){b.splice(f,1,a)},function(a){d.$error="resize",d.$errorParam=(a?(a.message?a.message:a)+": ":"")+(d&&d.name)})}}for(var g=[i.emptyPromise()],h=0;h<b.length;h++)f(b[h],h);return d.all(g)}var i=e;return i.getAttrWithDefaults=function(a,b){if(null!=a[b])return a[b];var c=i.defaults[b];return null==c?c:angular.isString(c)?c:JSON.stringify(c)},i.attrGetter=function(b,c,d,e){var f=this.getAttrWithDefaults(c,b);if(!d)return f;try{return e?a(f)(d,e):a(f)(d)}catch(g){if(b.search(/min|max|pattern/i))return f;throw g}},i.shouldUpdateOn=function(a,b,c){var d=i.attrGetter("ngModelOptions",b,c);return d&&d.updateOn?d.updateOn.split(" ").indexOf(a)>-1:!0},i.emptyPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.resolve.apply(a,c)}),a.promise},i.rejectPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.reject.apply(a,c)}),a.promise},i.happyPromise=function(a,c){var e=d.defer();return a.then(function(a){e.resolve(a)},function(a){b(function(){throw a}),e.resolve(c)}),e.promise},i.updateModel=function(c,d,e,h,j,k,l){function m(f,g,j,l,m){d.$$ngfPrevValidFiles=f,d.$$ngfPrevInvalidFiles=g;var n=f&&f.length?f[0]:null,o=g&&g.length?g[0]:null;c&&(i.applyModelValidation(c,f),c.$setViewValue(m?n:f)),h&&a(h)(e,{$files:f,$file:n,$newFiles:j,$duplicateFiles:l,$invalidFiles:g,$invalidFile:o,$event:k});var p=i.attrGetter("ngfModelInvalid",d);p&&b(function(){a(p).assign(e,m?o:g)}),b(function(){})}function n(){function a(a,b){return a.name===b.name&&(a.$ngfOrigSize||a.size)===(b.$ngfOrigSize||b.size)&&a.type===b.type}function b(b){var c;for(c=0;c<s.length;c++)if(a(b,s[c]))return!0;for(c=0;c<t.length;c++)if(a(b,t[c]))return!0;return!1}if(j){r=[],u=[];for(var c=0;c<j.length;c++)b(j[c])?u.push(j[c]):r.push(j[c])}}function o(a){return angular.isArray(a)?a:[a]}function p(){w=[],v=[],angular.forEach(r,function(a){a.$error?v.push(a):w.push(a)})}function q(){function a(){b(function(){m(x?s.concat(w):w,x?t.concat(v):v,j,u,y)},A&&A.debounce?A.debounce.change||A.debounce:0)}g(z?r:w,d,e).then(function(){z?i.validate(r,s.length,c,d,e).then(function(){p(),a()}):a()},function(a){throw"Could not resize files "+a})}var r,s,t,u=[],v=[],w=[];s=d.$$ngfPrevValidFiles||[],t=d.$$ngfPrevInvalidFiles||[],c&&c.$modelValue&&(s=o(c.$modelValue));var x=i.attrGetter("ngfKeep",d,e);r=(j||[]).slice(0),("distinct"===x||i.attrGetter("ngfKeepDistinct",d,e)===!0)&&n(d,e);var y=!x&&!i.attrGetter("ngfMultiple",d,e)&&!i.attrGetter("multiple",d);if(!x||r.length){i.attrGetter("ngfBeforeModelChange",d,e,{$files:j,$file:j&&j.length?j[0]:null,$newFiles:r,$duplicateFiles:u,$event:k});var z=i.attrGetter("ngfValidateAfterResize",d,e),A=i.attrGetter("ngModelOptions",d,e);i.validate(r,s.length,c,d,e).then(function(){l?m(r,[],j,u,y):(A&&A.allowInvalid||z?w=r:p(),i.attrGetter("ngfFixOrientation",d,e)&&i.isExifSupported()?f(w,d,e).then(function(){q()}):q())})}},i}]),ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(a,b,c,d){function e(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=d.defaults.androidFixMinorVersion||4;return parseInt(b[1])<4||parseInt(b[1])===c&&parseInt(b[2])<c}return-1===a.indexOf("Chrome")&&/.*Windows.*Safari.*/.test(a)}function f(a,b,c,d,f,h,i,j){function k(){return"input"===b[0].tagName.toLowerCase()&&c.type&&"file"===c.type.toLowerCase()}function l(){return t("ngfChange")||t("ngfSelect")}function m(b){if(j.shouldUpdateOn("change",c,a)){for(var e=b.__files_||b.target&&b.target.files,f=[],g=0;g<e.length;g++)f.push(e[g]);j.updateModel(d,c,a,l(),f.length?f:null,b)}}function n(a){if(b!==a)for(var c=0;c<b[0].attributes.length;c++){var d=b[0].attributes[c];"type"!==d.name&&"class"!==d.name&&"style"!==d.name&&((null==d.value||""===d.value)&&("required"===d.name&&(d.value="required"),"multiple"===d.name&&(d.value="multiple")),a.attr(d.name,"id"===d.name?"ngf-"+d.value:d.value))}}function o(){if(k())return b;var a=angular.element('<input type="file">');n(a);var c=angular.element("<label>upload</label>");return c.css("visibility","hidden").css("position","absolute").css("overflow","hidden").css("width","0px").css("height","0px").css("border","none").css("margin","0px").css("padding","0px").attr("tabindex","-1"),g.push({el:b,ref:c}),document.body.appendChild(c.append(a)[0]),a}function p(c){if(b.attr("disabled"))return!1;if(!t("ngfSelectDisabled",a)){var d=q(c);if(null!=d)return d;r(c);try{k()||document.body.contains(w[0])||(g.push({el:b,ref:w.parent()}),document.body.appendChild(w.parent()[0]),w.bind("change",m))}catch(f){}return e(navigator.userAgent)?setTimeout(function(){w[0].click()},0):w[0].click(),!1}}function q(a){var b=a.changedTouches||a.originalEvent&&a.originalEvent.changedTouches;if("touchstart"===a.type)return v=b?b[0].clientY:0,!0;if(a.stopPropagation(),a.preventDefault(),"touchend"===a.type){var c=b?b[0].clientY:0;if(Math.abs(c-v)>20)return!1}}function r(b){j.shouldUpdateOn("click",c,a)&&w.val()&&(w.val(null),j.updateModel(d,c,a,l(),null,b,!0))}function s(a){if(w&&!w.attr("__ngf_ie10_Fix_")){if(!w[0].parentNode)return void(w=null);a.preventDefault(),a.stopPropagation(),w.unbind("click");var b=w.clone();return w.replaceWith(b),w=b,w.attr("__ngf_ie10_Fix_","true"),w.bind("change",m),w.bind("click",s),w[0].click(),!1}w.removeAttr("__ngf_ie10_Fix_")}var t=function(a,b){return j.attrGetter(a,c,b)};j.registerModelChangeValidator(d,c,a);var u=[];u.push(a.$watch(t("ngfMultiple"),function(){w.attr("multiple",t("ngfMultiple",a))})),u.push(a.$watch(t("ngfCapture"),function(){w.attr("capture",t("ngfCapture",a))})),u.push(a.$watch(t("ngfAccept"),function(){w.attr("accept",t("ngfAccept",a))})),c.$observe("accept",function(){w.attr("accept",t("accept"))}),u.push(function(){c.$$observers&&delete c.$$observers.accept});var v=0,w=b;k()||(w=o()),w.bind("change",m),k()?b.bind("click",r):b.bind("click touchstart touchend",p),-1!==navigator.appVersion.indexOf("MSIE 10")&&w.bind("click",s),d&&d.$formatters.push(function(a){return(null==a||0===a.length)&&w.val()&&w.val(null),a}),a.$on("$destroy",function(){k()||w.parent().remove(),angular.forEach(u,function(a){a()})}),h(function(){for(var a=0;a<g.length;a++){var b=g[a];document.body.contains(b.el[0])||(g.splice(a,1),b.ref.remove())}}),window.FileAPI&&window.FileAPI.ngfFixIE&&window.FileAPI.ngfFixIE(b,w,m)}var g=[];return{restrict:"AEC",require:"?ngModel",link:function(e,g,h,i){f(e,g,h,i,a,b,c,d)}}}]),function(){function a(a){return"img"===a.tagName.toLowerCase()?"image":"audio"===a.tagName.toLowerCase()?"audio":"video"===a.tagName.toLowerCase()?"video":/./}function b(b,c,d,e,f,g,h,i){function j(a){var g=b.attrGetter("ngfNoObjectUrl",f,d);b.dataUrl(a,g)["finally"](function(){c(function(){var b=(g?a.$ngfDataUrl:a.$ngfBlobUrl)||a.$ngfDataUrl;i?e.css("background-image","url('"+(b||"")+"')"):e.attr("src",b),b?e.removeClass("ng-hide"):e.addClass("ng-hide")})})}c(function(){var c=d.$watch(f[g],function(c){var d=h;if("ngfThumbnail"===g&&(d||(d={width:e[0].clientWidth,height:e[0].clientHeight}),0===d.width&&window.getComputedStyle)){var f=getComputedStyle(e[0]);d={width:parseInt(f.width.slice(0,-2)),height:parseInt(f.height.slice(0,-2))}}return angular.isString(c)?(e.removeClass("ng-hide"),i?e.css("background-image","url('"+c+"')"):e.attr("src",c)):void(!c||!c.type||0!==c.type.search(a(e[0]))||i&&0!==c.type.indexOf("image")?e.addClass("ng-hide"):d&&b.isResizeSupported()?b.resize(c,d.width,d.height,d.quality).then(function(a){j(a)},function(a){throw a}):j(c))});d.$on("$destroy",function(){c()})})}ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout","$q",function(a,b,c){var d=a;return d.base64DataUrl=function(a){if(angular.isArray(a)){var b=c.defer(),e=0;return angular.forEach(a,function(c){d.dataUrl(c,!0)["finally"](function(){if(e++,e===a.length){var c=[];angular.forEach(a,function(a){c.push(a.$ngfDataUrl)}),b.resolve(c,a)}})}),b.promise}return d.dataUrl(a,!0)},d.dataUrl=function(a,e){if(!a)return d.emptyPromise(a,a);if(e&&null!=a.$ngfDataUrl||!e&&null!=a.$ngfBlobUrl)return d.emptyPromise(e?a.$ngfDataUrl:a.$ngfBlobUrl,a);var f=e?a.$$ngfDataUrlPromise:a.$$ngfBlobUrlPromise;if(f)return f;var g=c.defer();return b(function(){if(window.FileReader&&a&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 8")||a.size<2e4)&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 9")||a.size<4e6)){var c=window.URL||window.webkitURL;if(c&&c.createObjectURL&&!e){var f;try{f=c.createObjectURL(a)}catch(h){return void b(function(){a.$ngfBlobUrl="",g.reject()})}b(function(){if(a.$ngfBlobUrl=f,f){g.resolve(f,a),d.blobUrls=d.blobUrls||[],d.blobUrlsTotalSize=d.blobUrlsTotalSize||0,d.blobUrls.push({url:f,size:a.size}),d.blobUrlsTotalSize+=a.size||0;for(var b=d.defaults.blobUrlsMaxMemory||268435456,e=d.defaults.blobUrlsMaxQueueSize||200;(d.blobUrlsTotalSize>b||d.blobUrls.length>e)&&d.blobUrls.length>1;){var h=d.blobUrls.splice(0,1)[0];c.revokeObjectURL(h.url),d.blobUrlsTotalSize-=h.size}}})}else{var i=new FileReader;i.onload=function(c){b(function(){a.$ngfDataUrl=c.target.result,g.resolve(c.target.result,a),b(function(){delete a.$ngfDataUrl},1e3)})},i.onerror=function(){b(function(){a.$ngfDataUrl="",g.reject()})},i.readAsDataURL(a)}}else b(function(){a[e?"$ngfDataUrl":"$ngfBlobUrl"]="",g.reject()})}),f=e?a.$$ngfDataUrlPromise=g.promise:a.$$ngfBlobUrlPromise=g.promise,f["finally"](function(){delete a[e?"$$ngfDataUrlPromise":"$$ngfBlobUrlPromise"]}),f},d}]),ngFileUpload.directive("ngfSrc",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfSrc",a.attrGetter("ngfResize",f,d),!1)}}}]),ngFileUpload.directive("ngfBackground",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfBackground",a.attrGetter("ngfResize",f,d),!0)}}}]),ngFileUpload.directive("ngfThumbnail",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){var g=a.attrGetter("ngfSize",f,d);b(a,c,d,e,f,"ngfThumbnail",g,a.attrGetter("ngfAsBackground",f,d))}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist&&a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/),a.aHrefSanitizationWhitelist&&a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d,e){if(angular.isString(c))return b.trustAsResourceUrl(c);var f=c&&((d?c.$ngfDataUrl:c.$ngfBlobUrl)||c.$ngfDataUrl);return c&&!f?(!c.$ngfDataUrlFilterInProgress&&angular.isObject(c)&&(c.$ngfDataUrlFilterInProgress=!0,a.dataUrl(c,d)),""):(c&&delete c.$ngfDataUrlFilterInProgress,(c&&f?e?b.trustAsResourceUrl(f):f:c)||"")}}])}(),ngFileUpload.service("UploadValidate",["UploadDataUrl","$q","$timeout",function(a,b,c){function d(a){var b="",c=[];if(a.length>2&&"/"===a[0]&&"/"===a[a.length-1])b=a.substring(1,a.length-1);else{var e=a.split(",");if(e.length>1)for(var f=0;f<e.length;f++){var g=d(e[f]);g.regexp?(b+="("+g.regexp+")",f<e.length-1&&(b+="|")):c=c.concat(g.excludes)}else 0===a.indexOf("!")?c.push("^((?!"+d(a.substring(1)).regexp+").)*$"):(0===a.indexOf(".")&&(a="*"+a),b="^"+a.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",b=b.replace(/\\\*/g,".*").replace(/\\\?/g,"."))}return{regexp:b,excludes:c}}function e(a,b){null==b||a.$dirty||(a.$setDirty?a.$setDirty():a.$dirty=!0)}var f=a;return f.validatePattern=function(a,b){if(!b)return!0;var c=d(b),e=!0;if(c.regexp&&c.regexp.length){var f=new RegExp(c.regexp,"i");e=null!=a.type&&f.test(a.type)||null!=a.name&&f.test(a.name)}for(var g=c.excludes.length;g--;){var h=new RegExp(c.excludes[g],"i");e=e&&(null==a.type||h.test(a.type))&&(null==a.name||h.test(a.name))}return e},f.ratioToFloat=function(a){var b=a.toString(),c=b.search(/[x:]/i);return b=c>-1?parseFloat(b.substring(0,c))/parseFloat(b.substring(c+1)):parseFloat(b)},f.registerModelChangeValidator=function(a,b,c){a&&a.$formatters.push(function(d){a.$dirty&&(d&&!angular.isArray(d)&&(d=[d]),f.validate(d,0,a,b,c).then(function(){f.applyModelValidation(a,d)}))})},f.applyModelValidation=function(a,b){e(a,b),angular.forEach(a.$ngfValidations,function(b){a.$setValidity(b.name,b.valid)})},f.getValidationAttr=function(a,b,c,d,e){var g="ngf"+c[0].toUpperCase()+c.substr(1),h=f.attrGetter(g,a,b,{$file:e});if(null==h&&(h=f.attrGetter("ngfValidate",a,b,{$file:e}))){var i=(d||c).split(".");h=h[i[0]],i.length>1&&(h=h&&h[i[1]])}return h},f.validate=function(a,c,d,e,g){function h(b,c,h){if(a){for(var i=a.length,j=null;i--;){var k=a[i];if(k){var l=f.getValidationAttr(e,g,b,c,k);null!=l&&(h(k,l,i)||(k.$error=b,(k.$errorMessages=k.$errorMessages||{})[b]=!0,k.$errorParam=l,a.splice(i,1),j=!1))}}null!==j&&d.$ngfValidations.push({name:b,valid:j})}}function i(c,h,i,k,l){function m(a,b,d){null!=d?k(b,d).then(function(e){l(e,d)?a.resolve():(b.$error=c,(b.$errorMessages=b.$errorMessages||{})[c]=!0,b.$errorParam=d,a.reject())},function(){j("ngfValidateForce",{$file:b})?(b.$error=c,(b.$errorMessages=b.$errorMessages||{})[c]=!0,b.$errorParam=d,a.reject()):a.resolve()}):a.resolve()}var n=[f.emptyPromise()];return a?(a=void 0===a.length?[a]:a,angular.forEach(a,function(a){var d=b.defer();return n.push(d.promise),!i||null!=a.type&&0===a.type.search(i)?void("dimensions"===c&&null!=f.attrGetter("ngfDimensions",e)?f.imageDimensions(a).then(function(b){m(d,a,j("ngfDimensions",{$file:a,$width:b.width,$height:b.height}))},function(){d.reject()}):"duration"===c&&null!=f.attrGetter("ngfDuration",e)?f.mediaDuration(a).then(function(b){m(d,a,j("ngfDuration",{$file:a,$duration:b}))},function(){d.reject()}):m(d,a,f.getValidationAttr(e,g,c,h,a))):void d.resolve()}),b.all(n).then(function(){d.$ngfValidations.push({name:c,valid:!0})},function(){d.$ngfValidations.push({name:c,valid:!1})})):void 0}d=d||{},d.$ngfValidations=d.$ngfValidations||[],angular.forEach(d.$ngfValidations,function(a){a.valid=!0});var j=function(a,b){return f.attrGetter(a,e,g,b)};if(null==a||0===a.length)return f.emptyPromise(d);a=void 0===a.length?[a]:a.slice(0),h("maxFiles",null,function(a,b,d){return b>c+d}),h("pattern",null,f.validatePattern),h("minSize","size.min",function(a,b){return a.size+.1>=f.translateScalars(b)}),h("maxSize","size.max",function(a,b){return a.size-.1<=f.translateScalars(b)});var k=0;if(h("maxTotalSize",null,function(b,c){return k+=b.size,k>f.translateScalars(c)?(a.splice(0,a.length),!1):!0}),h("validateFn",null,function(a,b){return b===!0||null===b||""===b}),!a.length)return f.emptyPromise(d,d.$ngfValidations);var l=b.defer(),m=[];return m.push(f.happyPromise(i("maxHeight","height.max",/image/,this.imageDimensions,function(a,b){return a.height<=b}))),m.push(f.happyPromise(i("minHeight","height.min",/image/,this.imageDimensions,function(a,b){return a.height>=b}))),m.push(f.happyPromise(i("maxWidth","width.max",/image/,this.imageDimensions,function(a,b){return a.width<=b}))),m.push(f.happyPromise(i("minWidth","width.min",/image/,this.imageDimensions,function(a,b){return a.width>=b}))),m.push(f.happyPromise(i("dimensions",null,/image/,function(a,b){return f.emptyPromise(b)},function(a){return a}))),m.push(f.happyPromise(i("ratio",null,/image/,this.imageDimensions,function(a,b){for(var c=b.toString().split(","),d=!1,e=0;e<c.length;e++)Math.abs(a.width/a.height-f.ratioToFloat(c[e]))<1e-4&&(d=!0);return d}))),m.push(f.happyPromise(i("maxRatio","ratio.max",/image/,this.imageDimensions,function(a,b){return a.width/a.height-f.ratioToFloat(b)<1e-4}))),m.push(f.happyPromise(i("minRatio","ratio.min",/image/,this.imageDimensions,function(a,b){return a.width/a.height-f.ratioToFloat(b)>-1e-4}))),m.push(f.happyPromise(i("maxDuration","duration.max",/audio|video/,this.mediaDuration,function(a,b){return a<=f.translateScalars(b)}))),m.push(f.happyPromise(i("minDuration","duration.min",/audio|video/,this.mediaDuration,function(a,b){return a>=f.translateScalars(b)}))),m.push(f.happyPromise(i("duration",null,/audio|video/,function(a,b){return f.emptyPromise(b)},function(a){return a}))),m.push(f.happyPromise(i("validateAsyncFn",null,null,function(a,b){return b},function(a){return a===!0||null===a||""===a}))),b.all(m).then(function(){l.resolve(d,d.$ngfValidations)})},f.imageDimensions=function(a){if(a.$ngfWidth&&a.$ngfHeight){var d=b.defer();return c(function(){d.resolve({width:a.$ngfWidth,height:a.$ngfHeight})}),d.promise}if(a.$ngfDimensionPromise)return a.$ngfDimensionPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("image")?void e.reject("not image"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].clientWidth,c=h[0].clientHeight;h.remove(),a.$ngfWidth=b,a.$ngfHeight=c,e.resolve({width:b,height:c})}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].clientWidth?d():i>10?f():g())},1e3)}var h=angular.element("<img>").attr("src",b).css("visibility","hidden").css("position","fixed").css("max-width","none !important").css("max-height","none !important");h.on("load",d),h.on("error",f);var i=0;g(),angular.element(document.getElementsByTagName("body")[0]).append(h)},function(){e.reject("load error")})}),a.$ngfDimensionPromise=e.promise,a.$ngfDimensionPromise["finally"](function(){delete a.$ngfDimensionPromise}),a.$ngfDimensionPromise},f.mediaDuration=function(a){if(a.$ngfDuration){var d=b.defer();return c(function(){d.resolve(a.$ngfDuration)}),d.promise}if(a.$ngfDurationPromise)return a.$ngfDurationPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?void e.reject("not media"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].duration;a.$ngfDuration=b,h.remove(),e.resolve(b)}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].duration?d():i>10?f():g())},1e3)}var h=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",b).css("visibility","none").css("position","fixed");h.on("loadedmetadata",d),h.on("error",f);var i=0;g(),angular.element(document.body).append(h)},function(){e.reject("load error")})}),a.$ngfDurationPromise=e.promise,a.$ngfDurationPromise["finally"](function(){delete a.$ngfDurationPromise}),a.$ngfDurationPromise},f}]),ngFileUpload.service("UploadResize",["UploadValidate","$q",function(a,b){var c=a,d=function(a,b,c,d,e){var f=e?Math.max(c/a,d/b):Math.min(c/a,d/b);return{width:a*f,height:b*f,marginX:a*f-c,marginY:b*f-d}},e=function(a,e,f,g,h,i,j,k){var l=b.defer(),m=document.createElement("canvas"),n=document.createElement("img");return n.onload=function(){if(null!=k&&k(n.width,n.height)===!1)return void l.reject("resizeIf");try{if(i){var a=c.ratioToFloat(i),b=n.width/n.height;a>b?(e=n.width,f=e/a):(f=n.height,e=f*a)}e||(e=n.width),f||(f=n.height);var o=d(n.width,n.height,e,f,j);m.width=Math.min(o.width,e),m.height=Math.min(o.height,f);var p=m.getContext("2d");p.drawImage(n,Math.min(0,-o.marginX/2),Math.min(0,-o.marginY/2),o.width,o.height),l.resolve(m.toDataURL(h||"image/WebP",g||.934))}catch(q){l.reject(q)}},n.onerror=function(){l.reject()},n.src=a,l.promise};return c.dataUrltoBlob=function(a,b,c){for(var d=a.split(","),e=d[0].match(/:(.*?);/)[1],f=atob(d[1]),g=f.length,h=new Uint8Array(g);g--;)h[g]=f.charCodeAt(g);var i=new window.Blob([h],{type:e});return i.name=b,i.$ngfOrigSize=c,i},c.isResizeSupported=function(){var a=document.createElement("canvas");return window.atob&&a.getContext&&a.getContext("2d")&&window.Blob},c.isResizeSupported()&&Object.defineProperty(window.Blob.prototype,"name",{get:function(){return this.$ngfName},set:function(a){this.$ngfName=a},configurable:!0}),c.resize=function(a,d,f,g,h,i,j,k,l){if(0!==a.type.indexOf("image"))return c.emptyPromise(a);var m=b.defer();return c.dataUrl(a,!0).then(function(b){e(b,d,f,g,h||a.type,i,j,k).then(function(d){if("image/jpeg"===a.type&&l)try{d=c.restoreExif(b,d)}catch(e){setTimeout(function(){throw e},1)}try{var f=c.dataUrltoBlob(d,a.name,a.size);m.resolve(f)}catch(e){m.reject(e)}},function(b){"resizeIf"===b&&m.resolve(a),m.reject(b)})},function(a){m.reject(a)}),m.promise},c}]),function(){function a(a,c,d,e,f,g,h,i,j,k){function l(){return c.attr("disabled")||r("ngfDropDisabled",a)}function m(b,c){i.updateModel(e,d,a,r("ngfChange")||r("ngfDrop"),b,c)}function n(b,c){if(!i.shouldUpdateOn(b,d,a)||!c)return i.rejectPromise([]);var e=[];c.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi,function(a,b,c){e.push(c)});var f=[],g=[];if(e.length){angular.forEach(e,function(a){f.push(i.urlToBlob(a).then(function(a){g.push(a)}))});var h=k.defer();return k.all(f).then(function(){h.resolve(g)},function(a){h.reject(a)}),h.promise}return i.emptyPromise()}function o(a,b,c,d){var e=r("ngfDragOverClass",a,{$event:c}),f="dragover";if(angular.isString(e))f=e;else if(e&&(e.delay&&(v=e.delay),e.accept||e.reject)){var g=c.dataTransfer.items;if(null!=g&&g.length)for(var h=e.pattern||r("ngfPattern",a,{$event:c}),j=g.length;j--;){if(!i.validatePattern(g[j],h)){f=e.reject;break}f=e.accept}else f=e.accept}d(f)}function p(b,c,e,f){function g(a,b){var c=k.defer();if(null!=a)if(a.isDirectory){var d=[i.emptyPromise()];if(m){var e={type:"directory"};e.name=e.path=(b||"")+a.name+a.name,n.push(e)}var f=a.createReader(),h=[],p=function(){f.readEntries(function(e){try{e.length?(h=h.concat(Array.prototype.slice.call(e||[],0)),p()):(angular.forEach(h.slice(0),function(c){n.length<=j&&l>=o&&d.push(g(c,(b?b:"")+a.name+"/"))}),k.all(d).then(function(){c.resolve()},function(a){c.reject(a)}))}catch(f){c.reject(f)}},function(a){c.reject(a)})};p()}else a.file(function(a){try{a.path=(b?b:"")+a.name,m&&(a=i.rename(a,a.path)),n.push(a),o+=a.size,c.resolve()}catch(d){c.reject(d)}},function(a){c.reject(a)});return c.promise}var j=i.getValidationAttr(d,a,"maxFiles")||Number.MAX_VALUE,l=i.getValidationAttr(d,a,"maxTotalSize")||Number.MAX_VALUE,m=r("ngfIncludeDir",a),n=[],o=0,p=[i.emptyPromise()];if(b&&b.length>0&&"file"!==h.protocol())for(var q=0;q<b.length;q++){if(b[q].webkitGetAsEntry&&b[q].webkitGetAsEntry()&&b[q].webkitGetAsEntry().isDirectory){var s=b[q].webkitGetAsEntry();if(s.isDirectory&&!e)continue;null!=s&&p.push(g(s))}else{var t=b[q].getAsFile();null!=t&&(n.push(t),o+=t.size)}if(n.length>j||o>l||!f&&n.length>0)break}else if(null!=c)for(var u=0;u<c.length;u++){var v=c.item(u);if((v.type||v.size>0)&&(n.push(v),o+=v.size),n.length>j||o>l||!f&&n.length>0)break}var w=k.defer();return k.all(p).then(function(){if(f||m||!n.length)w.resolve(n);else{for(var a=0;n[a]&&"directory"===n[a].type;)a++;w.resolve([n[a]])}},function(a){w.reject(a)}),w.promise}var q=b(),r=function(a,b,c){return i.attrGetter(a,d,b,c)};if(r("dropAvailable")&&g(function(){a[r("dropAvailable")]?a[r("dropAvailable")].value=q:a[r("dropAvailable")]=q}),!q)return void(r("ngfHideOnDropNotAvailable",a)===!0&&c.css("display","none"));null==r("ngfSelect")&&i.registerModelChangeValidator(e,d,a);var s,t=null,u=f(r("ngfStopPropagation")),v=1;c[0].addEventListener("dragover",function(b){if(!l()&&i.shouldUpdateOn("drop",d,a)){if(b.preventDefault(),u(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var e=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===e||"linkMove"===e?"move":"copy"}g.cancel(t),s||(s="C",o(a,d,b,function(d){s=d,c.addClass(s),r("ngfDrag",a,{$isDragging:!0,$class:s,$event:b})}))}},!1),c[0].addEventListener("dragenter",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),u(a)&&b.stopPropagation())},!1),c[0].addEventListener("dragleave",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),u(a)&&b.stopPropagation(),t=g(function(){s&&c.removeClass(s),s=null,r("ngfDrag",a,{$isDragging:!1,$event:b})},v||100))},!1),c[0].addEventListener("drop",function(b){if(!l()&&i.shouldUpdateOn("drop",d,a)){b.preventDefault(),u(a)&&b.stopPropagation(),s&&c.removeClass(s),s=null;var e,f=b.dataTransfer.items;try{e=b.dataTransfer&&b.dataTransfer.getData&&b.dataTransfer.getData("text/html")}catch(g){}p(f,b.dataTransfer.files,r("ngfAllowDir",a)!==!1,r("multiple")||r("ngfMultiple",a)).then(function(a){a.length?m(a,b):n("dropUrl",e).then(function(a){m(a,b)})})}},!1),c[0].addEventListener("paste",function(b){if(navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&r("ngfEnableFirefoxPaste",a)&&b.preventDefault(),!l()&&i.shouldUpdateOn("paste",d,a)){var c=[],e=b.clipboardData||b.originalEvent.clipboardData;if(e&&e.items)for(var f=0;f<e.items.length;f++)-1!==e.items[f].type.indexOf("image")&&c.push(e.items[f].getAsFile());c.length?m(c,b):n("pasteUrl",e).then(function(a){m(a,b)})}},!1),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&r("ngfEnableFirefoxPaste",a)&&(c.attr("contenteditable",!0),c.on("keypress",function(a){a.metaKey||a.ctrlKey||a.preventDefault()}))}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a&&!/Edge\/12./i.test(navigator.userAgent)}ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload","$http","$q",function(b,c,d,e,f,g){
2090-return{restrict:"AEC",require:"?ngModel",link:function(h,i,j,k){a(h,i,j,k,b,c,d,e,f,g)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(a,c,d){return function(e,f,g){if(b()){var h=a(d.attrGetter("ngfDropAvailable",g));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(),ngFileUpload.service("UploadExif",["UploadResize","$q",function(a,b){function c(a,b,c,d){switch(b){case 2:return a.transform(-1,0,0,1,c,0);case 3:return a.transform(-1,0,0,-1,c,d);case 4:return a.transform(1,0,0,-1,0,d);case 5:return a.transform(0,1,1,0,0,0);case 6:return a.transform(0,1,-1,0,d,0);case 7:return a.transform(0,-1,-1,0,d,c);case 8:return a.transform(0,-1,1,0,0,c)}}function d(a){for(var b="",c=new Uint8Array(a),d=c.byteLength,e=0;d>e;e++)b+=String.fromCharCode(c[e]);return window.btoa(b)}var e=a;return e.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&e.isResizeSupported()},e.readOrientation=function(a){var c=b.defer(),d=new FileReader,e=a.slice?a.slice(0,65536):a;return d.readAsArrayBuffer(e),d.onerror=function(a){return c.reject(a)},d.onload=function(a){var b={orientation:1},d=new DataView(this.result);if(65496!==d.getUint16(0,!1))return c.resolve(b);for(var e=d.byteLength,f=2;e>f;){var g=d.getUint16(f,!1);if(f+=2,65505===g){if(1165519206!==d.getUint32(f+=2,!1))return c.resolve(b);var h=18761===d.getUint16(f+=6,!1);f+=d.getUint32(f+4,h);var i=d.getUint16(f,h);f+=2;for(var j=0;i>j;j++)if(274===d.getUint16(f+12*j,h)){var k=d.getUint16(f+12*j+8,h);return k>=2&&8>=k&&(d.setUint16(f+12*j+8,1,h),b.fixedArrayBuffer=a.target.result),b.orientation=k,c.resolve(b)}}else{if(65280!==(65280&g))break;f+=d.getUint16(f,!1)}}return c.resolve(b)},c.promise},e.applyExifRotation=function(a){if(0!==a.type.indexOf("image/jpeg"))return e.emptyPromise(a);var f=b.defer();return e.readOrientation(a).then(function(b){return b.orientation<2||b.orientation>8?f.resolve(a):void e.dataUrl(a,!0).then(function(g){var h=document.createElement("canvas"),i=document.createElement("img");i.onload=function(){try{h.width=b.orientation>4?i.height:i.width,h.height=b.orientation>4?i.width:i.height;var g=h.getContext("2d");c(g,b.orientation,i.width,i.height),g.drawImage(i,0,0);var j=h.toDataURL(a.type||"image/WebP",.934);j=e.restoreExif(d(b.fixedArrayBuffer),j);var k=e.dataUrltoBlob(j,a.name);f.resolve(k)}catch(l){return f.reject(l)}},i.onerror=function(){f.reject()},i.src=g},function(a){f.reject(a)})},function(a){f.reject(a)}),f.promise},e.restoreExif=function(a,b){var c={};return c.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c.encode64=function(a){var b,c,d,e,f,g="",h="",i="",j=0;do b=a[j++],c=a[j++],h=a[j++],d=b>>2,e=(3&b)<<4|c>>4,f=(15&c)<<2|h>>6,i=63&h,isNaN(c)?f=i=64:isNaN(h)&&(i=64),g=g+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(e)+this.KEY_STR.charAt(f)+this.KEY_STR.charAt(i),b=c=h="",d=e=f=i="";while(j<a.length);return g},c.restore=function(a,b){a.match("data:image/jpeg;base64,")&&(a=a.replace("data:image/jpeg;base64,",""));var c=this.decode64(a),d=this.slice2Segments(c),e=this.exifManipulation(b,d);return"data:image/jpeg;base64,"+this.encode64(e)},c.exifManipulation=function(a,b){var c=this.getExifArray(b),d=this.insertExif(a,c);return new Uint8Array(d)},c.getExifArray=function(a){for(var b,c=0;c<a.length;c++)if(b=a[c],255===b[0]&225===b[1])return b;return[]},c.insertExif=function(a,b){var c=a.replace("data:image/jpeg;base64,",""),d=this.decode64(c),e=d.indexOf(255,3),f=d.slice(0,e),g=d.slice(e),h=f;return h=h.concat(b),h=h.concat(g)},c.slice2Segments=function(a){for(var b=0,c=[];;){if(255===a[b]&218===a[b+1])break;if(255===a[b]&216===a[b+1])b+=2;else{var d=256*a[b+2]+a[b+3],e=b+d+2,f=a.slice(b,e);c.push(f),b=e}if(b>a.length)break}return c},c.decode64=function(a){var b,c,d,e,f,g="",h="",i=0,j=[],k=/[^A-Za-z0-9\+\/\=]/g;k.exec(a)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."),a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do d=this.KEY_STR.indexOf(a.charAt(i++)),e=this.KEY_STR.indexOf(a.charAt(i++)),f=this.KEY_STR.indexOf(a.charAt(i++)),h=this.KEY_STR.indexOf(a.charAt(i++)),b=d<<2|e>>4,c=(15&e)<<4|f>>2,g=(3&f)<<6|h,j.push(b),64!==f&&j.push(c),64!==h&&j.push(g),b=c=g="",d=e=f=h="";while(i<a.length);return j},c.restore(a,b)},e}]);
2091\ No newline at end of file
2092+/*! 12.2.13 */
2093+!window.XMLHttpRequest||window.FileAPI&&FileAPI.shouldLoad||(window.XMLHttpRequest.prototype.setRequestHeader=function(a){return function(b,c){if("__setXHR_"===b){var d=c(this);d instanceof Function&&d(this)}else a.apply(this,arguments)}}(window.XMLHttpRequest.prototype.setRequestHeader));var ngFileUpload=angular.module("ngFileUpload",[]);ngFileUpload.version="12.2.13",ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){function e(a){j.notify&&j.notify(a),k.progressFunc&&c(function(){k.progressFunc(a)})}function h(a){return null!=d._start&&g?{loaded:a.loaded+d._start,total:d._file&&d._file.size||a.total,type:a.type,config:d,lengthComputable:!0,target:a.target}:a}function i(){a(d).then(function(a){if(g&&d._chunkSize&&!d._finished&&d._file){var b=d._file&&d._file.size||0;e({loaded:Math.min(d._end,b),total:b,config:d,type:"progress"}),f.upload(d,!0)}else d._finished&&delete d._finished,j.resolve(a)},function(a){j.reject(a)},function(a){j.notify(a)})}d.method=d.method||"POST",d.headers=d.headers||{};var j=d._deferred=d._deferred||b.defer(),k=j.promise;return d.disableProgress||(d.headers.__setXHR_=function(){return function(a){a&&a.upload&&a.upload.addEventListener&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e(h(a))},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e(h(a)))},!1))}}),g?d._chunkSize&&d._end&&!d._finished?(d._start=d._end,d._end+=d._chunkSize,i()):d.resumeSizeUrl?a.get(d.resumeSizeUrl).then(function(a){d._start=d.resumeSizeResponseReader?d.resumeSizeResponseReader(a.data):parseInt((null==a.data.size?a.data:a.data.size).toString()),d._chunkSize&&(d._end=d._start+d._chunkSize),i()},function(a){throw a}):d.resumeSize?d.resumeSize().then(function(a){d._start=a,d._chunkSize&&(d._end=d._start+d._chunkSize),i()},function(a){throw a}):(d._chunkSize&&(d._start=0,d._end=d._start+d._chunkSize),i()):i(),k.success=function(a){return k.then(function(b){a(b.data,b.status,b.headers,d)}),k},k.error=function(a){return k.then(null,function(b){a(b.data,b.status,b.headers,d)}),k},k.progress=function(a){return k.progressFunc=a,k.then(null,null,function(b){a(b)}),k},k.abort=k.pause=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),k},k.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(k,arguments),a.apply(k,arguments)}}(d.xhrFn),k},f.promisesCount++,k["finally"]&&k["finally"]instanceof Function&&k["finally"](function(){f.promisesCount--}),k}function e(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}var f=this;f.promisesCount=0,this.isResumeSupported=function(){return window.Blob&&window.Blob.prototype.slice};var g=this.isResumeSupported();this.isUploadInProgress=function(){return f.promisesCount>0},this.rename=function(a,b){return a.ngfName=b,a},this.jsonBlob=function(a){null==a||angular.isString(a)||(a=JSON.stringify(a));var b=new window.Blob([a],{type:"application/json"});return b._ngfBlob=!0,b},this.json=function(a){return angular.toJson(a)},this.isFile=function(a){return null!=a&&(a instanceof window.Blob||a.flashId&&a.name&&a.size)},this.upload=function(a,b){function c(b,c){if(b._ngfBlob)return b;if(a._file=a._file||b,null!=a._start&&g){a._end&&a._end>=b.size&&(a._finished=!0,a._end=b.size);var d=b.slice(a._start,a._end||b.size);return d.name=b.name,d.ngfName=b.ngfName,a._chunkSize&&(c.append("_chunkSize",a._chunkSize),c.append("_currentChunkSize",a._end-a._start),c.append("_chunkNumber",Math.floor(a._start/a._chunkSize)),c.append("_totalSize",a._file.size)),d}return b}function h(b,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))b.append(e,d);else if(f.isFile(d)){var g=c(d,b),i=e.split(",");i[1]&&(g.ngfName=i[1].replace(/^\s+|\s+$/g,""),e=i[0]),a._fileKey=a._fileKey||e,b.append(e,g,g.ngfName||g.name)}else if(angular.isObject(d)){if(d.$$ngfCircularDetection)throw"ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: "+e;d.$$ngfCircularDetection=!0;try{for(var j in d)if(d.hasOwnProperty(j)&&"$$ngfCircularDetection"!==j){var k=null==a.objectKey?"[i]":a.objectKey;d.length&&parseInt(j)>-1&&(k=null==a.arrayKey?k:a.arrayKey),h(b,d[j],e+k.replace(/[ik]/g,j))}}finally{delete d.$$ngfCircularDetection}}else b.append(e,d)}function i(){a._chunkSize=f.translateScalars(a.resumeChunkSize),a._chunkSize=a._chunkSize?parseInt(a._chunkSize.toString()):null,a.headers=a.headers||{},a.headers["Content-Type"]=void 0,a.transformRequest=a.transformRequest?angular.isArray(a.transformRequest)?a.transformRequest:[a.transformRequest]:[],a.transformRequest.push(function(b){var c,d=new window.FormData;b=b||a.fields||{},a.file&&(b.file=a.file);for(c in b)if(b.hasOwnProperty(c)){var e=b[c];a.formDataAppender?a.formDataAppender(d,c,e):h(d,e,c)}return d})}return b||(a=e(a)),a._isDigested||(a._isDigested=!0,i()),d(a)},this.http=function(b){return b=e(b),b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof window.Blob?b:a.defaults.transformRequest[0].apply(this,arguments)},b._chunkSize=f.translateScalars(b.resumeChunkSize),b._chunkSize=b._chunkSize?parseInt(b._chunkSize.toString()):null,d(b)},this.translateScalars=function(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1024*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1048576*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1073741824*a.substring(0,a.length-2));if(a.search(/b/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/s/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/m/i)===a.length-1)return parseFloat(60*a.substring(0,a.length-1));if(a.search(/h/i)===a.length-1)return parseFloat(3600*a.substring(0,a.length-1))}return a},this.urlToBlob=function(c){var d=b.defer();return a({url:c,method:"get",responseType:"arraybuffer"}).then(function(a){var b=new Uint8Array(a.data),e=a.headers("content-type")||"image/WebP",f=new window.Blob([b],{type:e}),g=c.match(/.*\/(.+?)(\?.*)?$/);g.length>1&&(f.name=g[1]),d.resolve(f)},function(a){d.reject(a)}),d.promise},this.setDefaults=function(a){this.defaults=a||{}},this.defaults={},this.version=ngFileUpload.version}]),ngFileUpload.service("Upload",["$parse","$timeout","$compile","$q","UploadExif",function(a,b,c,d,e){function f(a,b,c){var e=[i.emptyPromise()];return angular.forEach(a,function(d,f){0===d.type.indexOf("image/jpeg")&&i.attrGetter("ngfFixOrientation",b,c,{$file:d})&&e.push(i.happyPromise(i.applyExifRotation(d),d).then(function(b){a.splice(f,1,b)}))}),d.all(e)}function g(a,b,c,e){var f=i.attrGetter("ngfResize",b,c);if(!f||!i.isResizeSupported()||!a.length)return i.emptyPromise();if(f instanceof Function){var g=d.defer();return f(a).then(function(d){h(d,a,b,c,e).then(function(a){g.resolve(a)},function(a){g.reject(a)})},function(a){g.reject(a)})}return h(f,a,b,c,e)}function h(a,b,c,e,f){function g(d,g){if(0===d.type.indexOf("image")){if(a.pattern&&!i.validatePattern(d,a.pattern))return;a.resizeIf=function(a,b){return i.attrGetter("ngfResizeIf",c,e,{$width:a,$height:b,$file:d})};var j=i.resize(d,a);h.push(j),j.then(function(a){b.splice(g,1,a)},function(a){d.$error="resize",(d.$errorMessages=d.$errorMessages||{}).resize=!0,d.$errorParam=(a?(a.message?a.message:a)+": ":"")+(d&&d.name),f.$ngfValidations.push({name:"resize",valid:!1}),i.applyModelValidation(f,b)})}}for(var h=[i.emptyPromise()],j=0;j<b.length;j++)g(b[j],j);return d.all(h)}var i=e;return i.getAttrWithDefaults=function(a,b){if(null!=a[b])return a[b];var c=i.defaults[b];return null==c?c:angular.isString(c)?c:JSON.stringify(c)},i.attrGetter=function(b,c,d,e){var f=this.getAttrWithDefaults(c,b);if(!d)return f;try{return e?a(f)(d,e):a(f)(d)}catch(g){if(b.search(/min|max|pattern/i))return f;throw g}},i.shouldUpdateOn=function(a,b,c){var d=i.attrGetter("ngfModelOptions",b,c);return d&&d.updateOn?d.updateOn.split(" ").indexOf(a)>-1:!0},i.emptyPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.resolve.apply(a,c)}),a.promise},i.rejectPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.reject.apply(a,c)}),a.promise},i.happyPromise=function(a,c){var e=d.defer();return a.then(function(a){e.resolve(a)},function(a){b(function(){throw a}),e.resolve(c)}),e.promise},i.updateModel=function(c,d,e,h,j,k,l){function m(f,g,j,l,m){d.$$ngfPrevValidFiles=f,d.$$ngfPrevInvalidFiles=g;var n=f&&f.length?f[0]:null,o=g&&g.length?g[0]:null;c&&(i.applyModelValidation(c,f),c.$setViewValue(m?n:f)),h&&a(h)(e,{$files:f,$file:n,$newFiles:j,$duplicateFiles:l,$invalidFiles:g,$invalidFile:o,$event:k});var p=i.attrGetter("ngfModelInvalid",d);p&&b(function(){a(p).assign(e,m?o:g)}),b(function(){})}function n(){function a(a,b){return a.name===b.name&&(a.$ngfOrigSize||a.size)===(b.$ngfOrigSize||b.size)&&a.type===b.type}function b(b){var c;for(c=0;c<r.length;c++)if(a(b,r[c]))return!0;for(c=0;c<s.length;c++)if(a(b,s[c]))return!0;return!1}if(j){q=[],t=[];for(var c=0;c<j.length;c++)b(j[c])?t.push(j[c]):q.push(j[c])}}function o(a){return angular.isArray(a)?a:[a]}function p(){function a(){b(function(){m(w?r.concat(v):v,w?s.concat(u):u,j,t,x)},z&&z.debounce?z.debounce.change||z.debounce:0)}var f=y?q:v;g(f,d,e,c).then(function(){y?i.validate(q,w?r.length:0,c,d,e).then(function(b){v=b.validsFiles,u=b.invalidsFiles,a()}):a()},function(){for(var b=0;b<f.length;b++){var c=f[b];if("resize"===c.$error){var d=v.indexOf(c);d>-1&&(v.splice(d,1),u.push(c)),a()}}})}var q,r,s,t=[],u=[],v=[];r=d.$$ngfPrevValidFiles||[],s=d.$$ngfPrevInvalidFiles||[],c&&c.$modelValue&&(r=o(c.$modelValue));var w=i.attrGetter("ngfKeep",d,e);q=(j||[]).slice(0),("distinct"===w||i.attrGetter("ngfKeepDistinct",d,e)===!0)&&n(d,e);var x=!w&&!i.attrGetter("ngfMultiple",d,e)&&!i.attrGetter("multiple",d);if(!w||q.length){i.attrGetter("ngfBeforeModelChange",d,e,{$files:j,$file:j&&j.length?j[0]:null,$newFiles:q,$duplicateFiles:t,$event:k});var y=i.attrGetter("ngfValidateAfterResize",d,e),z=i.attrGetter("ngfModelOptions",d,e);i.validate(q,w?r.length:0,c,d,e).then(function(a){l?m(q,[],j,t,x):(z&&z.allowInvalid||y?v=q:(v=a.validFiles,u=a.invalidFiles),i.attrGetter("ngfFixOrientation",d,e)&&i.isExifSupported()?f(v,d,e).then(function(){p()}):p())})}},i}]),ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(a,b,c,d){function e(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=d.defaults.androidFixMinorVersion||4;return parseInt(b[1])<4||parseInt(b[1])===c&&parseInt(b[2])<c}return-1===a.indexOf("Chrome")&&/.*Windows.*Safari.*/.test(a)}function f(a,b,c,d,f,h,i,j){function k(){return"input"===b[0].tagName.toLowerCase()&&c.type&&"file"===c.type.toLowerCase()}function l(){return t("ngfChange")||t("ngfSelect")}function m(b){if(j.shouldUpdateOn("change",c,a)){var e=b.__files_||b.target&&b.target.files,f=[];if(!e)return;for(var g=0;g<e.length;g++)f.push(e[g]);j.updateModel(d,c,a,l(),f.length?f:null,b)}}function n(a,d){function e(b){a.attr("id","ngf-"+b),d.attr("id","ngf-label-"+b)}for(var f=0;f<b[0].attributes.length;f++){var g=b[0].attributes[f];"type"!==g.name&&"class"!==g.name&&"style"!==g.name&&("id"===g.name?(e(g.value),u.push(c.$observe("id",e))):a.attr(g.name,g.value||"required"!==g.name&&"multiple"!==g.name?g.value:g.name))}}function o(){if(k())return b;var a=angular.element('<input type="file">'),c=angular.element("<label>upload</label>");return c.css("visibility","hidden").css("position","absolute").css("overflow","hidden").css("width","0px").css("height","0px").css("border","none").css("margin","0px").css("padding","0px").attr("tabindex","-1"),n(a,c),g.push({el:b,ref:c}),document.body.appendChild(c.append(a)[0]),a}function p(c){if(b.attr("disabled"))return!1;if(!t("ngfSelectDisabled",a)){var d=q(c);if(null!=d)return d;r(c);try{k()||document.body.contains(x[0])||(g.push({el:b,ref:x.parent()}),document.body.appendChild(x.parent()[0]),x.bind("change",m))}catch(f){}return e(navigator.userAgent)?setTimeout(function(){x[0].click()},0):x[0].click(),!1}}function q(a){var b=a.changedTouches||a.originalEvent&&a.originalEvent.changedTouches;if(b){if("touchstart"===a.type)return w=b[0].clientX,v=b[0].clientY,!0;if("touchend"===a.type){var c=b[0].clientX,d=b[0].clientY;if(Math.abs(c-w)>20||Math.abs(d-v)>20)return a.stopPropagation(),a.preventDefault(),!1}return!0}}function r(b){j.shouldUpdateOn("click",c,a)&&x.val()&&(x.val(null),j.updateModel(d,c,a,l(),null,b,!0))}function s(a){if(x&&!x.attr("__ngf_ie10_Fix_")){if(!x[0].parentNode)return void(x=null);a.preventDefault(),a.stopPropagation(),x.unbind("click");var b=x.clone();return x.replaceWith(b),x=b,x.attr("__ngf_ie10_Fix_","true"),x.bind("change",m),x.bind("click",s),x[0].click(),!1}x.removeAttr("__ngf_ie10_Fix_")}var t=function(a,b){return j.attrGetter(a,c,b)};j.registerModelChangeValidator(d,c,a);var u=[];t("ngfMultiple")&&u.push(a.$watch(t("ngfMultiple"),function(){x.attr("multiple",t("ngfMultiple",a))})),t("ngfCapture")&&u.push(a.$watch(t("ngfCapture"),function(){x.attr("capture",t("ngfCapture",a))})),t("ngfAccept")&&u.push(a.$watch(t("ngfAccept"),function(){x.attr("accept",t("ngfAccept",a))})),u.push(c.$observe("accept",function(){x.attr("accept",t("accept"))}));var v=0,w=0,x=b;k()||(x=o()),x.bind("change",m),k()?b.bind("click",r):b.bind("click touchstart touchend",p),-1!==navigator.appVersion.indexOf("MSIE 10")&&x.bind("click",s),d&&d.$formatters.push(function(a){return(null==a||0===a.length)&&x.val()&&x.val(null),a}),a.$on("$destroy",function(){k()||x.parent().remove(),angular.forEach(u,function(a){a()})}),h(function(){for(var a=0;a<g.length;a++){var b=g[a];document.body.contains(b.el[0])||(g.splice(a,1),b.ref.remove())}}),window.FileAPI&&window.FileAPI.ngfFixIE&&window.FileAPI.ngfFixIE(b,x,m)}var g=[];return{restrict:"AEC",require:"?ngModel",link:function(e,g,h,i){f(e,g,h,i,a,b,c,d)}}}]),function(){function a(a){return"img"===a.tagName.toLowerCase()?"image":"audio"===a.tagName.toLowerCase()?"audio":"video"===a.tagName.toLowerCase()?"video":/./}function b(b,c,d,e,f,g,h,i){function j(a){var g=b.attrGetter("ngfNoObjectUrl",f,d);b.dataUrl(a,g)["finally"](function(){c(function(){var b=(g?a.$ngfDataUrl:a.$ngfBlobUrl)||a.$ngfDataUrl;i?e.css("background-image","url('"+(b||"")+"')"):e.attr("src",b),b?e.removeClass("ng-hide"):e.addClass("ng-hide")})})}c(function(){var c=d.$watch(f[g],function(c){var k=h;if("ngfThumbnail"===g&&(k||(k={width:e[0].naturalWidth||e[0].clientWidth,height:e[0].naturalHeight||e[0].clientHeight}),0===k.width&&window.getComputedStyle)){var l=getComputedStyle(e[0]);l.width&&l.width.indexOf("px")>-1&&l.height&&l.height.indexOf("px")>-1&&(k={width:parseInt(l.width.slice(0,-2)),height:parseInt(l.height.slice(0,-2))})}return angular.isString(c)?(e.removeClass("ng-hide"),i?e.css("background-image","url('"+c+"')"):e.attr("src",c)):void(!c||!c.type||0!==c.type.search(a(e[0]))||i&&0!==c.type.indexOf("image")?e.addClass("ng-hide"):k&&b.isResizeSupported()?(k.resizeIf=function(a,e){return b.attrGetter("ngfResizeIf",f,d,{$width:a,$height:e,$file:c})},b.resize(c,k).then(function(a){j(a)},function(a){throw a})):j(c))});d.$on("$destroy",function(){c()})})}ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout","$q",function(a,b,c){var d=a;return d.base64DataUrl=function(a){if(angular.isArray(a)){var b=c.defer(),e=0;return angular.forEach(a,function(c){d.dataUrl(c,!0)["finally"](function(){if(e++,e===a.length){var c=[];angular.forEach(a,function(a){c.push(a.$ngfDataUrl)}),b.resolve(c,a)}})}),b.promise}return d.dataUrl(a,!0)},d.dataUrl=function(a,e){if(!a)return d.emptyPromise(a,a);if(e&&null!=a.$ngfDataUrl||!e&&null!=a.$ngfBlobUrl)return d.emptyPromise(e?a.$ngfDataUrl:a.$ngfBlobUrl,a);var f=e?a.$$ngfDataUrlPromise:a.$$ngfBlobUrlPromise;if(f)return f;var g=c.defer();return b(function(){if(window.FileReader&&a&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 8")||a.size<2e4)&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 9")||a.size<4e6)){var c=window.URL||window.webkitURL;if(c&&c.createObjectURL&&!e){var f;try{f=c.createObjectURL(a)}catch(h){return void b(function(){a.$ngfBlobUrl="",g.reject()})}b(function(){if(a.$ngfBlobUrl=f,f){g.resolve(f,a),d.blobUrls=d.blobUrls||[],d.blobUrlsTotalSize=d.blobUrlsTotalSize||0,d.blobUrls.push({url:f,size:a.size}),d.blobUrlsTotalSize+=a.size||0;for(var b=d.defaults.blobUrlsMaxMemory||268435456,e=d.defaults.blobUrlsMaxQueueSize||200;(d.blobUrlsTotalSize>b||d.blobUrls.length>e)&&d.blobUrls.length>1;){var h=d.blobUrls.splice(0,1)[0];c.revokeObjectURL(h.url),d.blobUrlsTotalSize-=h.size}}})}else{var i=new FileReader;i.onload=function(c){b(function(){a.$ngfDataUrl=c.target.result,g.resolve(c.target.result,a),b(function(){delete a.$ngfDataUrl},1e3)})},i.onerror=function(){b(function(){a.$ngfDataUrl="",g.reject()})},i.readAsDataURL(a)}}else b(function(){a[e?"$ngfDataUrl":"$ngfBlobUrl"]="",g.reject()})}),f=e?a.$$ngfDataUrlPromise=g.promise:a.$$ngfBlobUrlPromise=g.promise,f["finally"](function(){delete a[e?"$$ngfDataUrlPromise":"$$ngfBlobUrlPromise"]}),f},d}]),ngFileUpload.directive("ngfSrc",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfSrc",a.attrGetter("ngfResize",f,d),!1)}}}]),ngFileUpload.directive("ngfBackground",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfBackground",a.attrGetter("ngfResize",f,d),!0)}}}]),ngFileUpload.directive("ngfThumbnail",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){var g=a.attrGetter("ngfSize",f,d);b(a,c,d,e,f,"ngfThumbnail",g,a.attrGetter("ngfAsBackground",f,d))}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist&&a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/),a.aHrefSanitizationWhitelist&&a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d,e){if(angular.isString(c))return b.trustAsResourceUrl(c);var f=c&&((d?c.$ngfDataUrl:c.$ngfBlobUrl)||c.$ngfDataUrl);return c&&!f?(!c.$ngfDataUrlFilterInProgress&&angular.isObject(c)&&(c.$ngfDataUrlFilterInProgress=!0,a.dataUrl(c,d)),""):(c&&delete c.$ngfDataUrlFilterInProgress,(c&&f?e?b.trustAsResourceUrl(f):f:c)||"")}}])}(),ngFileUpload.service("UploadValidate",["UploadDataUrl","$q","$timeout",function(a,b,c){function d(a){var b="",c=[];if(a.length>2&&"/"===a[0]&&"/"===a[a.length-1])b=a.substring(1,a.length-1);else{var e=a.split(",");if(e.length>1)for(var f=0;f<e.length;f++){var g=d(e[f]);g.regexp?(b+="("+g.regexp+")",f<e.length-1&&(b+="|")):c=c.concat(g.excludes)}else 0===a.indexOf("!")?c.push("^((?!"+d(a.substring(1)).regexp+").)*$"):(0===a.indexOf(".")&&(a="*"+a),b="^"+a.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",b=b.replace(/\\\*/g,".*").replace(/\\\?/g,"."))}return{regexp:b,excludes:c}}function e(a,b){null==b||a.$dirty||(a.$setDirty?a.$setDirty():a.$dirty=!0)}var f=a;return f.validatePattern=function(a,b){if(!b)return!0;var c=d(b),e=!0;if(c.regexp&&c.regexp.length){var f=new RegExp(c.regexp,"i");e=null!=a.type&&f.test(a.type)||null!=a.name&&f.test(a.name)}for(var g=c.excludes.length;g--;){var h=new RegExp(c.excludes[g],"i");e=e&&(null==a.type||h.test(a.type))&&(null==a.name||h.test(a.name))}return e},f.ratioToFloat=function(a){var b=a.toString(),c=b.search(/[x:]/i);return b=c>-1?parseFloat(b.substring(0,c))/parseFloat(b.substring(c+1)):parseFloat(b)},f.registerModelChangeValidator=function(a,b,c){a&&a.$formatters.push(function(d){if(a.$dirty){var e=d;d&&!angular.isArray(d)&&(e=[d]),f.validate(e,0,a,b,c).then(function(){f.applyModelValidation(a,e)})}return d})},f.applyModelValidation=function(a,b){e(a,b),angular.forEach(a.$ngfValidations,function(b){a.$setValidity(b.name,b.valid)})},f.getValidationAttr=function(a,b,c,d,e){var g="ngf"+c[0].toUpperCase()+c.substr(1),h=f.attrGetter(g,a,b,{$file:e});if(null==h&&(h=f.attrGetter("ngfValidate",a,b,{$file:e}))){var i=(d||c).split(".");h=h[i[0]],i.length>1&&(h=h&&h[i[1]])}return h},f.validate=function(a,c,d,e,g){function h(b,c,h){if(a){for(var i=a.length,j=null;i--;){var n=a[i];if(n){var o=f.getValidationAttr(e,g,b,c,n);null!=o&&(h(n,o,i)||(-1===k.indexOf(b)?(n.$error=b,(n.$errorMessages=n.$errorMessages||{})[b]=!0,n.$errorParam=o,-1===m.indexOf(n)&&m.push(n),l||a.splice(i,1),j=!1):a.splice(i,1)))}}null!==j&&d.$ngfValidations.push({name:b,valid:j})}}function i(c,h,i,n,o){function p(b,d,e){function f(f){if(f())if(-1===k.indexOf(c)){if(d.$error=c,(d.$errorMessages=d.$errorMessages||{})[c]=!0,d.$errorParam=e,-1===m.indexOf(d)&&m.push(d),!l){var g=a.indexOf(d);g>-1&&a.splice(g,1)}b.resolve(!1)}else{var h=a.indexOf(d);h>-1&&a.splice(h,1),b.resolve(!0)}else b.resolve(!0)}null!=e?n(d,e).then(function(a){f(function(){return!o(a,e)})},function(){f(function(){return j("ngfValidateForce",{$file:d})})}):b.resolve(!0)}var q=[f.emptyPromise(!0)];a&&(a=void 0===a.length?[a]:a,angular.forEach(a,function(a){var d=b.defer();return q.push(d.promise),!i||null!=a.type&&0===a.type.search(i)?void("dimensions"===c&&null!=f.attrGetter("ngfDimensions",e)?f.imageDimensions(a).then(function(b){p(d,a,j("ngfDimensions",{$file:a,$width:b.width,$height:b.height}))},function(){d.resolve(!1)}):"duration"===c&&null!=f.attrGetter("ngfDuration",e)?f.mediaDuration(a).then(function(b){p(d,a,j("ngfDuration",{$file:a,$duration:b}))},function(){d.resolve(!1)}):p(d,a,f.getValidationAttr(e,g,c,h,a))):void d.resolve(!0)}));var r=b.defer();return b.all(q).then(function(a){for(var b=!0,e=0;e<a.length;e++)if(!a[e]){b=!1;break}d.$ngfValidations.push({name:c,valid:b}),r.resolve(b)}),r.promise}d=d||{},d.$ngfValidations=d.$ngfValidations||[],angular.forEach(d.$ngfValidations,function(a){a.valid=!0});var j=function(a,b){return f.attrGetter(a,e,g,b)},k=(f.attrGetter("ngfIgnoreInvalid",e,g)||"").split(" "),l=f.attrGetter("ngfRunAllValidations",e,g);if(null==a||0===a.length)return f.emptyPromise({validFiles:a,invalidFiles:[]});a=void 0===a.length?[a]:a.slice(0);var m=[];h("pattern",null,f.validatePattern),h("minSize","size.min",function(a,b){return a.size+.1>=f.translateScalars(b)}),h("maxSize","size.max",function(a,b){return a.size-.1<=f.translateScalars(b)});var n=0;if(h("maxTotalSize",null,function(b,c){return n+=b.size,n>f.translateScalars(c)?(a.splice(0,a.length),!1):!0}),h("validateFn",null,function(a,b){return b===!0||null===b||""===b}),!a.length)return f.emptyPromise({validFiles:[],invalidFiles:m});var o=b.defer(),p=[];return p.push(i("maxHeight","height.max",/image/,this.imageDimensions,function(a,b){return a.height<=b})),p.push(i("minHeight","height.min",/image/,this.imageDimensions,function(a,b){return a.height>=b})),p.push(i("maxWidth","width.max",/image/,this.imageDimensions,function(a,b){return a.width<=b})),p.push(i("minWidth","width.min",/image/,this.imageDimensions,function(a,b){return a.width>=b})),p.push(i("dimensions",null,/image/,function(a,b){return f.emptyPromise(b)},function(a){return a})),p.push(i("ratio",null,/image/,this.imageDimensions,function(a,b){for(var c=b.toString().split(","),d=!1,e=0;e<c.length;e++)Math.abs(a.width/a.height-f.ratioToFloat(c[e]))<.01&&(d=!0);return d})),p.push(i("maxRatio","ratio.max",/image/,this.imageDimensions,function(a,b){return a.width/a.height-f.ratioToFloat(b)<1e-4})),p.push(i("minRatio","ratio.min",/image/,this.imageDimensions,function(a,b){return a.width/a.height-f.ratioToFloat(b)>-1e-4})),p.push(i("maxDuration","duration.max",/audio|video/,this.mediaDuration,function(a,b){return a<=f.translateScalars(b)})),p.push(i("minDuration","duration.min",/audio|video/,this.mediaDuration,function(a,b){return a>=f.translateScalars(b)})),p.push(i("duration",null,/audio|video/,function(a,b){return f.emptyPromise(b)},function(a){return a})),p.push(i("validateAsyncFn",null,null,function(a,b){return b},function(a){return a===!0||null===a||""===a})),b.all(p).then(function(){if(l)for(var b=0;b<a.length;b++){var d=a[b];d.$error&&a.splice(b--,1)}l=!1,h("maxFiles",null,function(a,b,d){return b>c+d}),o.resolve({validFiles:a,invalidFiles:m})}),o.promise},f.imageDimensions=function(a){if(a.$ngfWidth&&a.$ngfHeight){var d=b.defer();return c(function(){d.resolve({width:a.$ngfWidth,height:a.$ngfHeight})}),d.promise}if(a.$ngfDimensionPromise)return a.$ngfDimensionPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("image")?void e.reject("not image"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].naturalWidth||h[0].clientWidth,c=h[0].naturalHeight||h[0].clientHeight;h.remove(),a.$ngfWidth=b,a.$ngfHeight=c,e.resolve({width:b,height:c})}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].clientWidth?d():i++>10?f():g())},1e3)}var h=angular.element("<img>").attr("src",b).css("visibility","hidden").css("position","fixed").css("max-width","none !important").css("max-height","none !important");h.on("load",d),h.on("error",f);var i=0;g(),angular.element(document.getElementsByTagName("body")[0]).append(h)},function(){e.reject("load error")})}),a.$ngfDimensionPromise=e.promise,a.$ngfDimensionPromise["finally"](function(){delete a.$ngfDimensionPromise}),a.$ngfDimensionPromise},f.mediaDuration=function(a){if(a.$ngfDuration){var d=b.defer();return c(function(){d.resolve(a.$ngfDuration)}),d.promise}if(a.$ngfDurationPromise)return a.$ngfDurationPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?void e.reject("not media"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].duration;a.$ngfDuration=b,h.remove(),e.resolve(b)}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].duration?d():i>10?f():g())},1e3)}var h=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",b).css("visibility","none").css("position","fixed");h.on("loadedmetadata",d),h.on("error",f);var i=0;g(),angular.element(document.body).append(h)},function(){e.reject("load error")})}),a.$ngfDurationPromise=e.promise,a.$ngfDurationPromise["finally"](function(){delete a.$ngfDurationPromise}),a.$ngfDurationPromise},f}]),ngFileUpload.service("UploadResize",["UploadValidate","$q",function(a,b){var c=a,d=function(a,b,c,d,e){var f=e?Math.max(c/a,d/b):Math.min(c/a,d/b);return{width:a*f,height:b*f,marginX:a*f-c,marginY:b*f-d}},e=function(a,e,f,g,h,i,j,k){var l=b.defer(),m=document.createElement("canvas"),n=document.createElement("img");return n.setAttribute("style","visibility:hidden;position:fixed;z-index:-100000"),document.body.appendChild(n),n.onload=function(){var a=n.width,b=n.height;if(n.parentNode.removeChild(n),null!=k&&k(a,b)===!1)return void l.reject("resizeIf");try{if(i){var o=c.ratioToFloat(i),p=a/b;o>p?(e=a,f=e/o):(f=b,e=f*o)}e||(e=a),f||(f=b);var q=d(a,b,e,f,j);m.width=Math.min(q.width,e),m.height=Math.min(q.height,f);var r=m.getContext("2d");r.drawImage(n,Math.min(0,-q.marginX/2),Math.min(0,-q.marginY/2),q.width,q.height),l.resolve(m.toDataURL(h||"image/WebP",g||.934))}catch(s){l.reject(s)}},n.onerror=function(){n.parentNode.removeChild(n),l.reject()},n.src=a,l.promise};return c.dataUrltoBlob=function(a,b,c){for(var d=a.split(","),e=d[0].match(/:(.*?);/)[1],f=atob(d[1]),g=f.length,h=new Uint8Array(g);g--;)h[g]=f.charCodeAt(g);var i=new window.Blob([h],{type:e});return i.name=b,i.$ngfOrigSize=c,i},c.isResizeSupported=function(){var a=document.createElement("canvas");return window.atob&&a.getContext&&a.getContext("2d")&&window.Blob},c.isResizeSupported()&&Object.defineProperty(window.Blob.prototype,"name",{get:function(){return this.$ngfName},set:function(a){this.$ngfName=a},configurable:!0}),c.resize=function(a,d){if(0!==a.type.indexOf("image"))return c.emptyPromise(a);var f=b.defer();return c.dataUrl(a,!0).then(function(b){e(b,d.width,d.height,d.quality,d.type||a.type,d.ratio,d.centerCrop,d.resizeIf).then(function(e){if("image/jpeg"===a.type&&d.restoreExif!==!1)try{e=c.restoreExif(b,e)}catch(g){setTimeout(function(){throw g},1)}try{var h=c.dataUrltoBlob(e,a.name,a.size);f.resolve(h)}catch(g){f.reject(g)}},function(b){"resizeIf"===b&&f.resolve(a),f.reject(b)})},function(a){f.reject(a)}),f.promise},c}]),function(){function a(a,c,d,e,f,g,h,i,j,k){function l(){return c.attr("disabled")||s("ngfDropDisabled",a)}function m(b,c,d){if(b){var e;try{e=b&&b.getData&&b.getData("text/html")}catch(f){}q(b.items,b.files,s("ngfAllowDir",a)!==!1,s("multiple")||s("ngfMultiple",a)).then(function(a){a.length?n(a,c):o(d,e).then(function(a){n(a,c)})})}}function n(b,c){i.updateModel(e,d,a,s("ngfChange")||s("ngfDrop"),b,c)}function o(b,c){if(!i.shouldUpdateOn(b,d,a)||"string"!=typeof c)return i.rejectPromise([]);var e=[];c.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi,function(a,b,c){e.push(c)});var f=[],g=[];if(e.length){angular.forEach(e,function(a){f.push(i.urlToBlob(a).then(function(a){g.push(a)}))});var h=k.defer();return k.all(f).then(function(){h.resolve(g)},function(a){h.reject(a)}),h.promise}return i.emptyPromise()}function p(a,b,c,d){var e=s("ngfDragOverClass",a,{$event:c}),f="dragover";if(angular.isString(e))f=e;else if(e&&(e.delay&&(w=e.delay),e.accept||e.reject)){var g=c.dataTransfer.items;if(null!=g&&g.length)for(var h=e.pattern||s("ngfPattern",a,{$event:c}),j=g.length;j--;){if(!i.validatePattern(g[j],h)){f=e.reject;break}f=e.accept}else f=e.accept}d(f)}function q(b,c,e,f){function g(a,b){var c=k.defer();if(null!=a)if(a.isDirectory){var d=[i.emptyPromise()];if(m){var e={type:"directory"};e.name=e.path=(b||"")+a.name,n.push(e)}var f=a.createReader(),h=[],p=function(){f.readEntries(function(e){try{e.length?(h=h.concat(Array.prototype.slice.call(e||[],0)),p()):(angular.forEach(h.slice(0),function(c){n.length<=j&&l>=o&&d.push(g(c,(b?b:"")+a.name+"/"))}),k.all(d).then(function(){c.resolve()},function(a){c.reject(a)}))}catch(f){c.reject(f)}},function(a){c.reject(a)})};p()}else a.file(function(a){try{a.path=(b?b:"")+a.name,m&&(a=i.rename(a,a.path)),n.push(a),o+=a.size,c.resolve()}catch(d){c.reject(d)}},function(a){c.reject(a)});return c.promise}var j=i.getValidationAttr(d,a,"maxFiles");null==j&&(j=Number.MAX_VALUE);var l=i.getValidationAttr(d,a,"maxTotalSize");null==l&&(l=Number.MAX_VALUE);var m=s("ngfIncludeDir",a),n=[],o=0,p=[i.emptyPromise()];if(b&&b.length>0&&"file:"!==h.location.protocol)for(var q=0;q<b.length;q++){if(b[q].webkitGetAsEntry&&b[q].webkitGetAsEntry()&&b[q].webkitGetAsEntry().isDirectory){var r=b[q].webkitGetAsEntry();if(r.isDirectory&&!e)continue;null!=r&&p.push(g(r))}else{var t=b[q].getAsFile();null!=t&&(n.push(t),o+=t.size)}if(n.length>j||o>l||!f&&n.length>0)break}else if(null!=c)for(var u=0;u<c.length;u++){var v=c.item(u);if((v.type||v.size>0)&&(n.push(v),o+=v.size),n.length>j||o>l||!f&&n.length>0)break}var w=k.defer();return k.all(p).then(function(){if(f||m||!n.length)w.resolve(n);else{for(var a=0;n[a]&&"directory"===n[a].type;)a++;w.resolve([n[a]])}},function(a){w.reject(a)}),w.promise}var r=b(),s=function(a,b,c){return i.attrGetter(a,d,b,c)};if(s("dropAvailable")&&g(function(){a[s("dropAvailable")]?a[s("dropAvailable")].value=r:a[s("dropAvailable")]=r}),!r)return void(s("ngfHideOnDropNotAvailable",a)===!0&&c.css("display","none"));null==s("ngfSelect")&&i.registerModelChangeValidator(e,d,a);var t,u=null,v=f(s("ngfStopPropagation")),w=1;c[0].addEventListener("dragover",function(b){if(!l()&&i.shouldUpdateOn("drop",d,a)){if(b.preventDefault(),v(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var e=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===e||"linkMove"===e?"move":"copy"}g.cancel(u),t||(t="C",p(a,d,b,function(d){t=d,c.addClass(t),s("ngfDrag",a,{$isDragging:!0,$class:t,$event:b})}))}},!1),c[0].addEventListener("dragenter",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),v(a)&&b.stopPropagation())},!1),c[0].addEventListener("dragleave",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),
2094+v(a)&&b.stopPropagation(),u=g(function(){t&&c.removeClass(t),t=null,s("ngfDrag",a,{$isDragging:!1,$event:b})},w||100))},!1),c[0].addEventListener("drop",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),v(a)&&b.stopPropagation(),t&&c.removeClass(t),t=null,m(b.dataTransfer,b,"dropUrl"))},!1),c[0].addEventListener("paste",function(b){navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&s("ngfEnableFirefoxPaste",a)&&b.preventDefault(),!l()&&i.shouldUpdateOn("paste",d,a)&&m(b.clipboardData||b.originalEvent.clipboardData,b,"pasteUrl")},!1),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&s("ngfEnableFirefoxPaste",a)&&(c.attr("contenteditable",!0),c.on("keypress",function(a){a.metaKey||a.ctrlKey||a.preventDefault()}))}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a&&!/Edge\/12./i.test(navigator.userAgent)}ngFileUpload.directive("ngfDrop",["$parse","$timeout","$window","Upload","$http","$q",function(b,c,d,e,f,g){return{restrict:"AEC",require:"?ngModel",link:function(h,i,j,k){a(h,i,j,k,b,c,d,e,f,g)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(a,c,d){return function(e,f,g){if(b()){var h=a(d.attrGetter("ngfDropAvailable",g));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(),ngFileUpload.service("UploadExif",["UploadResize","$q",function(a,b){function c(a,b,c,d){switch(b){case 2:return a.transform(-1,0,0,1,c,0);case 3:return a.transform(-1,0,0,-1,c,d);case 4:return a.transform(1,0,0,-1,0,d);case 5:return a.transform(0,1,1,0,0,0);case 6:return a.transform(0,1,-1,0,d,0);case 7:return a.transform(0,-1,-1,0,d,c);case 8:return a.transform(0,-1,1,0,0,c)}}function d(a){for(var b="",c=new Uint8Array(a),d=c.byteLength,e=0;d>e;e++)b+=String.fromCharCode(c[e]);return window.btoa(b)}var e=a;return e.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&e.isResizeSupported()},e.readOrientation=function(a){var c=b.defer(),d=new FileReader,e=a.slice?a.slice(0,65536):a;return d.readAsArrayBuffer(e),d.onerror=function(a){return c.reject(a)},d.onload=function(a){var b={orientation:1},d=new DataView(this.result);if(65496!==d.getUint16(0,!1))return c.resolve(b);for(var e=d.byteLength,f=2;e>f;){var g=d.getUint16(f,!1);if(f+=2,65505===g){if(1165519206!==d.getUint32(f+=2,!1))return c.resolve(b);var h=18761===d.getUint16(f+=6,!1);f+=d.getUint32(f+4,h);var i=d.getUint16(f,h);f+=2;for(var j=0;i>j;j++)if(274===d.getUint16(f+12*j,h)){var k=d.getUint16(f+12*j+8,h);return k>=2&&8>=k&&(d.setUint16(f+12*j+8,1,h),b.fixedArrayBuffer=a.target.result),b.orientation=k,c.resolve(b)}}else{if(65280!==(65280&g))break;f+=d.getUint16(f,!1)}}return c.resolve(b)},c.promise},e.applyExifRotation=function(a){if(0!==a.type.indexOf("image/jpeg"))return e.emptyPromise(a);var f=b.defer();return e.readOrientation(a).then(function(b){return b.orientation<2||b.orientation>8?f.resolve(a):void e.dataUrl(a,!0).then(function(g){var h=document.createElement("canvas"),i=document.createElement("img");i.onload=function(){try{h.width=b.orientation>4?i.height:i.width,h.height=b.orientation>4?i.width:i.height;var g=h.getContext("2d");c(g,b.orientation,i.width,i.height),g.drawImage(i,0,0);var j=h.toDataURL(a.type||"image/WebP",.934);j=e.restoreExif(d(b.fixedArrayBuffer),j);var k=e.dataUrltoBlob(j,a.name);f.resolve(k)}catch(l){return f.reject(l)}},i.onerror=function(){f.reject()},i.src=g},function(a){f.reject(a)})},function(a){f.reject(a)}),f.promise},e.restoreExif=function(a,b){var c={};return c.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c.encode64=function(a){var b,c,d,e,f,g="",h="",i="",j=0;do b=a[j++],c=a[j++],h=a[j++],d=b>>2,e=(3&b)<<4|c>>4,f=(15&c)<<2|h>>6,i=63&h,isNaN(c)?f=i=64:isNaN(h)&&(i=64),g=g+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(e)+this.KEY_STR.charAt(f)+this.KEY_STR.charAt(i),b=c=h="",d=e=f=i="";while(j<a.length);return g},c.restore=function(a,b){a.match("data:image/jpeg;base64,")&&(a=a.replace("data:image/jpeg;base64,",""));var c=this.decode64(a),d=this.slice2Segments(c),e=this.exifManipulation(b,d);return"data:image/jpeg;base64,"+this.encode64(e)},c.exifManipulation=function(a,b){var c=this.getExifArray(b),d=this.insertExif(a,c);return new Uint8Array(d)},c.getExifArray=function(a){for(var b,c=0;c<a.length;c++)if(b=a[c],255===b[0]&225===b[1])return b;return[]},c.insertExif=function(a,b){var c=a.replace("data:image/jpeg;base64,",""),d=this.decode64(c),e=d.indexOf(255,3),f=d.slice(0,e),g=d.slice(e),h=f;return h=h.concat(b),h=h.concat(g)},c.slice2Segments=function(a){for(var b=0,c=[];;){if(255===a[b]&218===a[b+1])break;if(255===a[b]&216===a[b+1])b+=2;else{var d=256*a[b+2]+a[b+3],e=b+d+2,f=a.slice(b,e);c.push(f),b=e}if(b>a.length)break}return c},c.decode64=function(a){var b,c,d,e,f,g="",h="",i=0,j=[],k=/[^A-Za-z0-9\+\/\=]/g;k.exec(a)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."),a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do d=this.KEY_STR.indexOf(a.charAt(i++)),e=this.KEY_STR.indexOf(a.charAt(i++)),f=this.KEY_STR.indexOf(a.charAt(i++)),h=this.KEY_STR.indexOf(a.charAt(i++)),b=d<<2|e>>4,c=(15&e)<<4|f>>2,g=(3&f)<<6|h,j.push(b),64!==f&&j.push(c),64!==h&&j.push(g),b=c=g="",d=e=f=h="";while(i<a.length);return j},c.restore(a,b)},e}]);
2095\ No newline at end of file
2096diff --git a/xstatic/pkg/angular_lrdragndrop/__init__.py b/xstatic/pkg/angular_lrdragndrop/__init__.py
2097index cf9508f..206ee6a 100644
2098--- a/xstatic/pkg/angular_lrdragndrop/__init__.py
2099+++ b/xstatic/pkg/angular_lrdragndrop/__init__.py
2100@@ -17,7 +17,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
2101
2102 VERSION = '1.0.2' # version of the packaged files, please use the upstream
2103 # version number
2104-BUILD = '4' # our package build number, so we can release new builds
2105+BUILD = '6' # our package build number, so we can release new builds
2106 # with fixes for xstatic stuff.
2107 PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi
2108
2109diff --git a/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js b/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js
2110index 2b7c383..ce54176 100644
2111--- a/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js
2112+++ b/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js
2113@@ -2,11 +2,21 @@
2114 'use strict';
2115
2116 function isJqueryEventDataTransfer(){
2117- return window.jQuery && (-1 == window.jQuery.event.props.indexOf('dataTransfer'));
2118+ return window.jQuery && (!window.jQuery.event.special.dataTransfer ||
2119+ !window.jQuery.event.special.dataTransfer.props || -1 ===
2120+ window.jQuery.event.special.dataTransfer.props.indexOf('dataTransfer'));
2121 }
2122
2123 if (isJqueryEventDataTransfer()) {
2124- window.jQuery.event.props.push('dataTransfer');
2125+ if (!window.jQuery.event.special.dataTransfer) {
2126+ window.jQuery.event.special.dataTransfer = {
2127+ props: ['dataTransfer']
2128+ };
2129+ } else if (!window.jQuery.event.special.dataTransfer.props) {
2130+ window.jQuery.event.special.dataTransfer.props = ['dataTransfer'];
2131+ } else if (-1 === window.jQuery.event.special.dataTransfer.props.indexOf('dataTransfer')) {
2132+ window.jQuery.event.special.dataTransfer.props.push('dataTransfer');
2133+ }
2134 }
2135
2136 var module = ng.module('lrDragNDrop', []);
2137@@ -181,4 +191,4 @@
2138 }
2139 };
2140 }]);
2141-})(angular);
2142\ No newline at end of file
2143+})(angular);
2144diff --git a/xstatic/pkg/jquery/__init__.py b/xstatic/pkg/jquery/__init__.py
2145index d2a34ad..78dd92a 100644
2146--- a/xstatic/pkg/jquery/__init__.py
2147+++ b/xstatic/pkg/jquery/__init__.py
2148@@ -11,7 +11,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
2149 # please use a all-lowercase valid python
2150 # package name
2151
2152-VERSION = '1.12.4' # version of the packaged files, please use the upstream
2153+VERSION = '3.5.1' # version of the packaged files, please use the upstream
2154 # version number
2155 BUILD = '1' # our package build number, so we can release new builds
2156 # with fixes for xstatic stuff.
2157@@ -51,14 +51,26 @@ LOCATIONS = {
2158 ('jquery', 'http'): {
2159 'jquery.js': 'http://code.jquery.com/jquery-%s.js' % VERSION,
2160 'jquery.min.js': 'http://code.jquery.com/jquery-%s.min.js' % VERSION,
2161+ 'jquery.slim.js': 'http://code.jquery.com/jquery-%s.slim.js' % VERSION,
2162+ 'jquery.slim.min.js': 'http://code.jquery.com/jquery-%s.slim.min.js' % VERSION,
2163+ },
2164+ ('jquery', 'https'): {
2165+ 'jquery.js': 'https://code.jquery.com/jquery-%s.js' % VERSION,
2166+ 'jquery.min.js': 'https://code.jquery.com/jquery-%s.min.js' % VERSION,
2167+ 'jquery.slim.js': 'https://code.jquery.com/jquery-%s.slim.js' % VERSION,
2168+ 'jquery.slim.min.js': 'https://code.jquery.com/jquery-%s.slim.min.js' % VERSION,
2169 },
2170 ('microsoft', 'http'): {
2171 'jquery.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % VERSION,
2172 'jquery.min.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % VERSION,
2173+ 'jquery.slim.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.js' % VERSION,
2174+ 'jquery.slim.min.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.min.js' % VERSION,
2175 },
2176 ('microsoft', 'https'): {
2177 'jquery.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % VERSION,
2178 'jquery.min.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % VERSION,
2179+ 'jquery.slim.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.js' % VERSION,
2180+ 'jquery.slim.min.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.min.js' % VERSION,
2181 },
2182 }
2183
2184diff --git a/xstatic/pkg/jquery/data/jquery.js b/xstatic/pkg/jquery/data/jquery.js
2185index 7fc60fc..5093733 100644
2186--- a/xstatic/pkg/jquery/data/jquery.js
2187+++ b/xstatic/pkg/jquery/data/jquery.js
2188@@ -1,20 +1,22 @@
2189 /*!
2190- * jQuery JavaScript Library v1.12.4
2191- * http://jquery.com/
2192+ * jQuery JavaScript Library v3.5.1
2193+ * https://jquery.com/
2194 *
2195 * Includes Sizzle.js
2196- * http://sizzlejs.com/
2197+ * https://sizzlejs.com/
2198 *
2199- * Copyright jQuery Foundation and other contributors
2200+ * Copyright JS Foundation and other contributors
2201 * Released under the MIT license
2202- * http://jquery.org/license
2203+ * https://jquery.org/license
2204 *
2205- * Date: 2016-05-20T17:17Z
2206+ * Date: 2020-05-04T22:49Z
2207 */
2208+( function( global, factory ) {
2209
2210-(function( global, factory ) {
2211+ "use strict";
2212
2213 if ( typeof module === "object" && typeof module.exports === "object" ) {
2214+
2215 // For CommonJS and CommonJS-like environments where a proper `window`
2216 // is present, execute the factory and get jQuery.
2217 // For environments that do not have a `window` with a `document`
2218@@ -35,24 +37,30 @@
2219 }
2220
2221 // Pass this if window is not defined yet
2222-}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
2223+} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
2224
2225-// Support: Firefox 18+
2226-// Can't be in strict mode, several libs including ASP.NET trace
2227-// the stack via arguments.caller.callee and Firefox dies if
2228-// you try to trace through "use strict" call chains. (#13335)
2229-//"use strict";
2230-var deletedIds = [];
2231+// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
2232+// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
2233+// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
2234+// enough that all such attempts are guarded in a try block.
2235+"use strict";
2236
2237-var document = window.document;
2238+var arr = [];
2239+
2240+var getProto = Object.getPrototypeOf;
2241+
2242+var slice = arr.slice;
2243
2244-var slice = deletedIds.slice;
2245+var flat = arr.flat ? function( array ) {
2246+ return arr.flat.call( array );
2247+} : function( array ) {
2248+ return arr.concat.apply( [], array );
2249+};
2250
2251-var concat = deletedIds.concat;
2252
2253-var push = deletedIds.push;
2254+var push = arr.push;
2255
2256-var indexOf = deletedIds.indexOf;
2257+var indexOf = arr.indexOf;
2258
2259 var class2type = {};
2260
2261@@ -60,12 +68,86 @@ var toString = class2type.toString;
2262
2263 var hasOwn = class2type.hasOwnProperty;
2264
2265+var fnToString = hasOwn.toString;
2266+
2267+var ObjectFunctionString = fnToString.call( Object );
2268+
2269 var support = {};
2270
2271+var isFunction = function isFunction( obj ) {
2272+
2273+ // Support: Chrome <=57, Firefox <=52
2274+ // In some browsers, typeof returns "function" for HTML <object> elements
2275+ // (i.e., `typeof document.createElement( "object" ) === "function"`).
2276+ // We don't want to classify *any* DOM node as a function.
2277+ return typeof obj === "function" && typeof obj.nodeType !== "number";
2278+ };
2279+
2280+
2281+var isWindow = function isWindow( obj ) {
2282+ return obj != null && obj === obj.window;
2283+ };
2284+
2285+
2286+var document = window.document;
2287+
2288+
2289+
2290+ var preservedScriptAttributes = {
2291+ type: true,
2292+ src: true,
2293+ nonce: true,
2294+ noModule: true
2295+ };
2296+
2297+ function DOMEval( code, node, doc ) {
2298+ doc = doc || document;
2299+
2300+ var i, val,
2301+ script = doc.createElement( "script" );
2302+
2303+ script.text = code;
2304+ if ( node ) {
2305+ for ( i in preservedScriptAttributes ) {
2306+
2307+ // Support: Firefox 64+, Edge 18+
2308+ // Some browsers don't support the "nonce" property on scripts.
2309+ // On the other hand, just using `getAttribute` is not enough as
2310+ // the `nonce` attribute is reset to an empty string whenever it
2311+ // becomes browsing-context connected.
2312+ // See https://github.com/whatwg/html/issues/2369
2313+ // See https://html.spec.whatwg.org/#nonce-attributes
2314+ // The `node.getAttribute` check was added for the sake of
2315+ // `jQuery.globalEval` so that it can fake a nonce-containing node
2316+ // via an object.
2317+ val = node[ i ] || node.getAttribute && node.getAttribute( i );
2318+ if ( val ) {
2319+ script.setAttribute( i, val );
2320+ }
2321+ }
2322+ }
2323+ doc.head.appendChild( script ).parentNode.removeChild( script );
2324+ }
2325+
2326+
2327+function toType( obj ) {
2328+ if ( obj == null ) {
2329+ return obj + "";
2330+ }
2331+
2332+ // Support: Android <=2.3 only (functionish RegExp)
2333+ return typeof obj === "object" || typeof obj === "function" ?
2334+ class2type[ toString.call( obj ) ] || "object" :
2335+ typeof obj;
2336+}
2337+/* global Symbol */
2338+// Defining this global in .eslintrc.json would create a danger of using the global
2339+// unguarded in another place, it seems safer to define global only for this module
2340+
2341
2342
2343 var
2344- version = "1.12.4",
2345+ version = "3.5.1",
2346
2347 // Define a local copy of jQuery
2348 jQuery = function( selector, context ) {
2349@@ -73,19 +155,6 @@ var
2350 // The jQuery object is actually just the init constructor 'enhanced'
2351 // Need init if jQuery is called (just allow error to be thrown if not included)
2352 return new jQuery.fn.init( selector, context );
2353- },
2354-
2355- // Support: Android<4.1, IE<9
2356- // Make sure we trim BOM and NBSP
2357- rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
2358-
2359- // Matches dashed string for camelizing
2360- rmsPrefix = /^-ms-/,
2361- rdashAlpha = /-([\da-z])/gi,
2362-
2363- // Used by jQuery.camelCase as callback to replace()
2364- fcamelCase = function( all, letter ) {
2365- return letter.toUpperCase();
2366 };
2367
2368 jQuery.fn = jQuery.prototype = {
2369@@ -95,9 +164,6 @@ jQuery.fn = jQuery.prototype = {
2370
2371 constructor: jQuery,
2372
2373- // Start with an empty selector
2374- selector: "",
2375-
2376 // The default length of a jQuery object is 0
2377 length: 0,
2378
2379@@ -108,13 +174,14 @@ jQuery.fn = jQuery.prototype = {
2380 // Get the Nth element in the matched element set OR
2381 // Get the whole matched element set as a clean array
2382 get: function( num ) {
2383- return num != null ?
2384
2385- // Return just the one element from the set
2386- ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
2387+ // Return all the elements in a clean array
2388+ if ( num == null ) {
2389+ return slice.call( this );
2390+ }
2391
2392- // Return all the elements in a clean array
2393- slice.call( this );
2394+ // Return just the one element from the set
2395+ return num < 0 ? this[ num + this.length ] : this[ num ];
2396 },
2397
2398 // Take an array of elements and push it onto the stack
2399@@ -126,7 +193,6 @@ jQuery.fn = jQuery.prototype = {
2400
2401 // Add the old object onto the stack (as a reference)
2402 ret.prevObject = this;
2403- ret.context = this.context;
2404
2405 // Return the newly-formed element set
2406 return ret;
2407@@ -155,6 +221,18 @@ jQuery.fn = jQuery.prototype = {
2408 return this.eq( -1 );
2409 },
2410
2411+ even: function() {
2412+ return this.pushStack( jQuery.grep( this, function( _elem, i ) {
2413+ return ( i + 1 ) % 2;
2414+ } ) );
2415+ },
2416+
2417+ odd: function() {
2418+ return this.pushStack( jQuery.grep( this, function( _elem, i ) {
2419+ return i % 2;
2420+ } ) );
2421+ },
2422+
2423 eq: function( i ) {
2424 var len = this.length,
2425 j = +i + ( i < 0 ? len : 0 );
2426@@ -168,12 +246,12 @@ jQuery.fn = jQuery.prototype = {
2427 // For internal use only.
2428 // Behaves like an Array's method, not like a jQuery method.
2429 push: push,
2430- sort: deletedIds.sort,
2431- splice: deletedIds.splice
2432+ sort: arr.sort,
2433+ splice: arr.splice
2434 };
2435
2436 jQuery.extend = jQuery.fn.extend = function() {
2437- var src, copyIsArray, copy, name, options, clone,
2438+ var options, name, src, copy, copyIsArray, clone,
2439 target = arguments[ 0 ] || {},
2440 i = 1,
2441 length = arguments.length,
2442@@ -183,17 +261,17 @@ jQuery.extend = jQuery.fn.extend = function() {
2443 if ( typeof target === "boolean" ) {
2444 deep = target;
2445
2446- // skip the boolean and the target
2447+ // Skip the boolean and the target
2448 target = arguments[ i ] || {};
2449 i++;
2450 }
2451
2452 // Handle case when target is a string or something (possible in deep copy)
2453- if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
2454+ if ( typeof target !== "object" && !isFunction( target ) ) {
2455 target = {};
2456 }
2457
2458- // extend jQuery itself if only one argument is passed
2459+ // Extend jQuery itself if only one argument is passed
2460 if ( i === length ) {
2461 target = this;
2462 i--;
2463@@ -206,25 +284,28 @@ jQuery.extend = jQuery.fn.extend = function() {
2464
2465 // Extend the base object
2466 for ( name in options ) {
2467- src = target[ name ];
2468 copy = options[ name ];
2469
2470+ // Prevent Object.prototype pollution
2471 // Prevent never-ending loop
2472- if ( target === copy ) {
2473+ if ( name === "__proto__" || target === copy ) {
2474 continue;
2475 }
2476
2477 // Recurse if we're merging plain objects or arrays
2478 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
2479- ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
2480-
2481- if ( copyIsArray ) {
2482- copyIsArray = false;
2483- clone = src && jQuery.isArray( src ) ? src : [];
2484-
2485+ ( copyIsArray = Array.isArray( copy ) ) ) ) {
2486+ src = target[ name ];
2487+
2488+ // Ensure proper type for the source value
2489+ if ( copyIsArray && !Array.isArray( src ) ) {
2490+ clone = [];
2491+ } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
2492+ clone = {};
2493 } else {
2494- clone = src && jQuery.isPlainObject( src ) ? src : {};
2495+ clone = src;
2496 }
2497+ copyIsArray = false;
2498
2499 // Never move original objects, clone them
2500 target[ name ] = jQuery.extend( deep, clone, copy );
2501@@ -255,110 +336,40 @@ jQuery.extend( {
2502
2503 noop: function() {},
2504
2505- // See test/unit/core.js for details concerning isFunction.
2506- // Since version 1.3, DOM methods and functions like alert
2507- // aren't supported. They return false on IE (#2968).
2508- isFunction: function( obj ) {
2509- return jQuery.type( obj ) === "function";
2510- },
2511-
2512- isArray: Array.isArray || function( obj ) {
2513- return jQuery.type( obj ) === "array";
2514- },
2515-
2516- isWindow: function( obj ) {
2517- /* jshint eqeqeq: false */
2518- return obj != null && obj == obj.window;
2519- },
2520-
2521- isNumeric: function( obj ) {
2522-
2523- // parseFloat NaNs numeric-cast false positives (null|true|false|"")
2524- // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
2525- // subtraction forces infinities to NaN
2526- // adding 1 corrects loss of precision from parseFloat (#15100)
2527- var realStringObj = obj && obj.toString();
2528- return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
2529- },
2530-
2531- isEmptyObject: function( obj ) {
2532- var name;
2533- for ( name in obj ) {
2534- return false;
2535- }
2536- return true;
2537- },
2538-
2539 isPlainObject: function( obj ) {
2540- var key;
2541+ var proto, Ctor;
2542
2543- // Must be an Object.
2544- // Because of IE, we also have to check the presence of the constructor property.
2545- // Make sure that DOM nodes and window objects don't pass through, as well
2546- if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
2547+ // Detect obvious negatives
2548+ // Use toString instead of jQuery.type to catch host objects
2549+ if ( !obj || toString.call( obj ) !== "[object Object]" ) {
2550 return false;
2551 }
2552
2553- try {
2554-
2555- // Not own constructor property must be Object
2556- if ( obj.constructor &&
2557- !hasOwn.call( obj, "constructor" ) &&
2558- !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
2559- return false;
2560- }
2561- } catch ( e ) {
2562-
2563- // IE8,9 Will throw exceptions on certain host objects #9897
2564- return false;
2565- }
2566+ proto = getProto( obj );
2567
2568- // Support: IE<9
2569- // Handle iteration over inherited properties before own properties.
2570- if ( !support.ownFirst ) {
2571- for ( key in obj ) {
2572- return hasOwn.call( obj, key );
2573- }
2574+ // Objects with no prototype (e.g., `Object.create( null )`) are plain
2575+ if ( !proto ) {
2576+ return true;
2577 }
2578
2579- // Own properties are enumerated firstly, so to speed up,
2580- // if last one is own, then all properties are own.
2581- for ( key in obj ) {}
2582-
2583- return key === undefined || hasOwn.call( obj, key );
2584- },
2585-
2586- type: function( obj ) {
2587- if ( obj == null ) {
2588- return obj + "";
2589- }
2590- return typeof obj === "object" || typeof obj === "function" ?
2591- class2type[ toString.call( obj ) ] || "object" :
2592- typeof obj;
2593+ // Objects with prototype are plain iff they were constructed by a global Object function
2594+ Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
2595+ return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
2596 },
2597
2598- // Workarounds based on findings by Jim Driscoll
2599- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
2600- globalEval: function( data ) {
2601- if ( data && jQuery.trim( data ) ) {
2602+ isEmptyObject: function( obj ) {
2603+ var name;
2604
2605- // We use execScript on Internet Explorer
2606- // We use an anonymous function so that context is window
2607- // rather than jQuery in Firefox
2608- ( window.execScript || function( data ) {
2609- window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
2610- } )( data );
2611+ for ( name in obj ) {
2612+ return false;
2613 }
2614+ return true;
2615 },
2616
2617- // Convert dashed to camelCase; used by the css and data modules
2618- // Microsoft forgot to hump their vendor prefix (#9572)
2619- camelCase: function( string ) {
2620- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
2621- },
2622-
2623- nodeName: function( elem, name ) {
2624- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
2625+ // Evaluates a script in a provided context; falls back to the global one
2626+ // if not specified.
2627+ globalEval: function( code, options, doc ) {
2628+ DOMEval( code, { nonce: options && options.nonce }, doc );
2629 },
2630
2631 each: function( obj, callback ) {
2632@@ -382,13 +393,6 @@ jQuery.extend( {
2633 return obj;
2634 },
2635
2636- // Support: Android<4.1, IE<9
2637- trim: function( text ) {
2638- return text == null ?
2639- "" :
2640- ( text + "" ).replace( rtrim, "" );
2641- },
2642-
2643 // results is for internal usage only
2644 makeArray: function( arr, results ) {
2645 var ret = results || [];
2646@@ -408,43 +412,18 @@ jQuery.extend( {
2647 },
2648
2649 inArray: function( elem, arr, i ) {
2650- var len;
2651-
2652- if ( arr ) {
2653- if ( indexOf ) {
2654- return indexOf.call( arr, elem, i );
2655- }
2656-
2657- len = arr.length;
2658- i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
2659-
2660- for ( ; i < len; i++ ) {
2661-
2662- // Skip accessing in sparse arrays
2663- if ( i in arr && arr[ i ] === elem ) {
2664- return i;
2665- }
2666- }
2667- }
2668-
2669- return -1;
2670+ return arr == null ? -1 : indexOf.call( arr, elem, i );
2671 },
2672
2673+ // Support: Android <=4.0 only, PhantomJS 1 only
2674+ // push.apply(_, arraylike) throws on ancient WebKit
2675 merge: function( first, second ) {
2676 var len = +second.length,
2677 j = 0,
2678 i = first.length;
2679
2680- while ( j < len ) {
2681- first[ i++ ] = second[ j++ ];
2682- }
2683-
2684- // Support: IE<9
2685- // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
2686- if ( len !== len ) {
2687- while ( second[ j ] !== undefined ) {
2688- first[ i++ ] = second[ j++ ];
2689- }
2690+ for ( ; j < len; j++ ) {
2691+ first[ i++ ] = second[ j ];
2692 }
2693
2694 first.length = i;
2695@@ -500,76 +479,37 @@ jQuery.extend( {
2696 }
2697
2698 // Flatten any nested arrays
2699- return concat.apply( [], ret );
2700+ return flat( ret );
2701 },
2702
2703 // A global GUID counter for objects
2704 guid: 1,
2705
2706- // Bind a function to a context, optionally partially applying any
2707- // arguments.
2708- proxy: function( fn, context ) {
2709- var args, proxy, tmp;
2710-
2711- if ( typeof context === "string" ) {
2712- tmp = fn[ context ];
2713- context = fn;
2714- fn = tmp;
2715- }
2716-
2717- // Quick check to determine if target is callable, in the spec
2718- // this throws a TypeError, but we will just return undefined.
2719- if ( !jQuery.isFunction( fn ) ) {
2720- return undefined;
2721- }
2722-
2723- // Simulated bind
2724- args = slice.call( arguments, 2 );
2725- proxy = function() {
2726- return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
2727- };
2728-
2729- // Set the guid of unique handler to the same of original handler, so it can be removed
2730- proxy.guid = fn.guid = fn.guid || jQuery.guid++;
2731-
2732- return proxy;
2733- },
2734-
2735- now: function() {
2736- return +( new Date() );
2737- },
2738-
2739 // jQuery.support is not used in Core but other projects attach their
2740 // properties to it so it needs to exist.
2741 support: support
2742 } );
2743
2744-// JSHint would error on this code due to the Symbol not being defined in ES5.
2745-// Defining this global in .jshintrc would create a danger of using the global
2746-// unguarded in another place, it seems safer to just disable JSHint for these
2747-// three lines.
2748-/* jshint ignore: start */
2749 if ( typeof Symbol === "function" ) {
2750- jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
2751+ jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
2752 }
2753-/* jshint ignore: end */
2754
2755 // Populate the class2type map
2756 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
2757-function( i, name ) {
2758+function( _i, name ) {
2759 class2type[ "[object " + name + "]" ] = name.toLowerCase();
2760 } );
2761
2762 function isArrayLike( obj ) {
2763
2764- // Support: iOS 8.2 (not reproducible in simulator)
2765+ // Support: real iOS 8.2 only (not reproducible in simulator)
2766 // `in` check used to prevent JIT error (gh-2145)
2767 // hasOwn isn't used here due to false negatives
2768 // regarding Nodelist length in IE
2769 var length = !!obj && "length" in obj && obj.length,
2770- type = jQuery.type( obj );
2771+ type = toType( obj );
2772
2773- if ( type === "function" || jQuery.isWindow( obj ) ) {
2774+ if ( isFunction( obj ) || isWindow( obj ) ) {
2775 return false;
2776 }
2777
2778@@ -578,17 +518,16 @@ function isArrayLike( obj ) {
2779 }
2780 var Sizzle =
2781 /*!
2782- * Sizzle CSS Selector Engine v2.2.1
2783- * http://sizzlejs.com/
2784+ * Sizzle CSS Selector Engine v2.3.5
2785+ * https://sizzlejs.com/
2786 *
2787- * Copyright jQuery Foundation and other contributors
2788+ * Copyright JS Foundation and other contributors
2789 * Released under the MIT license
2790- * http://jquery.org/license
2791+ * https://js.foundation/
2792 *
2793- * Date: 2015-10-17
2794+ * Date: 2020-03-14
2795 */
2796-(function( window ) {
2797-
2798+( function( window ) {
2799 var i,
2800 support,
2801 Expr,
2802@@ -619,6 +558,7 @@ var i,
2803 classCache = createCache(),
2804 tokenCache = createCache(),
2805 compilerCache = createCache(),
2806+ nonnativeSelectorCache = createCache(),
2807 sortOrder = function( a, b ) {
2808 if ( a === b ) {
2809 hasDuplicate = true;
2810@@ -626,65 +566,72 @@ var i,
2811 return 0;
2812 },
2813
2814- // General-purpose constants
2815- MAX_NEGATIVE = 1 << 31,
2816-
2817 // Instance methods
2818- hasOwn = ({}).hasOwnProperty,
2819+ hasOwn = ( {} ).hasOwnProperty,
2820 arr = [],
2821 pop = arr.pop,
2822- push_native = arr.push,
2823+ pushNative = arr.push,
2824 push = arr.push,
2825 slice = arr.slice,
2826+
2827 // Use a stripped-down indexOf as it's faster than native
2828- // http://jsperf.com/thor-indexof-vs-for/5
2829+ // https://jsperf.com/thor-indexof-vs-for/5
2830 indexOf = function( list, elem ) {
2831 var i = 0,
2832 len = list.length;
2833 for ( ; i < len; i++ ) {
2834- if ( list[i] === elem ) {
2835+ if ( list[ i ] === elem ) {
2836 return i;
2837 }
2838 }
2839 return -1;
2840 },
2841
2842- booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
2843+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
2844+ "ismap|loop|multiple|open|readonly|required|scoped",
2845
2846 // Regular expressions
2847
2848 // http://www.w3.org/TR/css3-selectors/#whitespace
2849 whitespace = "[\\x20\\t\\r\\n\\f]",
2850
2851- // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
2852- identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
2853+ // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
2854+ identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
2855+ "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
2856
2857 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
2858 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
2859+
2860 // Operator (capture 2)
2861 "*([*^$|!~]?=)" + whitespace +
2862- // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
2863- "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
2864- "*\\]",
2865+
2866+ // "Attribute values must be CSS identifiers [capture 5]
2867+ // or strings [capture 3 or capture 4]"
2868+ "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
2869+ whitespace + "*\\]",
2870
2871 pseudos = ":(" + identifier + ")(?:\\((" +
2872+
2873 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
2874 // 1. quoted (capture 3; capture 4 or capture 5)
2875 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
2876+
2877 // 2. simple (capture 6)
2878 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
2879+
2880 // 3. anything else (capture 2)
2881 ".*" +
2882 ")\\)|)",
2883
2884 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
2885 rwhitespace = new RegExp( whitespace + "+", "g" ),
2886- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
2887+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
2888+ whitespace + "+$", "g" ),
2889
2890 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
2891- rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
2892-
2893- rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
2894+ rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
2895+ "*" ),
2896+ rdescend = new RegExp( whitespace + "|>" ),
2897
2898 rpseudo = new RegExp( pseudos ),
2899 ridentifier = new RegExp( "^" + identifier + "$" ),
2900@@ -695,16 +642,19 @@ var i,
2901 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
2902 "ATTR": new RegExp( "^" + attributes ),
2903 "PSEUDO": new RegExp( "^" + pseudos ),
2904- "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
2905- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
2906- "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
2907+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
2908+ whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
2909+ whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
2910 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
2911+
2912 // For use in libraries implementing .is()
2913 // We use this for POS matching in `select`
2914- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
2915- whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
2916+ "needsContext": new RegExp( "^" + whitespace +
2917+ "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
2918+ "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
2919 },
2920
2921+ rhtml = /HTML$/i,
2922 rinputs = /^(?:input|select|textarea|button)$/i,
2923 rheader = /^h\d$/i,
2924
2925@@ -714,47 +664,79 @@ var i,
2926 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
2927
2928 rsibling = /[+~]/,
2929- rescape = /'|\\/g,
2930-
2931- // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
2932- runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
2933- funescape = function( _, escaped, escapedWhitespace ) {
2934- var high = "0x" + escaped - 0x10000;
2935- // NaN means non-codepoint
2936- // Support: Firefox<24
2937- // Workaround erroneous numeric interpretation of +"0x"
2938- return high !== high || escapedWhitespace ?
2939- escaped :
2940+
2941+ // CSS escapes
2942+ // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
2943+ runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
2944+ funescape = function( escape, nonHex ) {
2945+ var high = "0x" + escape.slice( 1 ) - 0x10000;
2946+
2947+ return nonHex ?
2948+
2949+ // Strip the backslash prefix from a non-hex escape sequence
2950+ nonHex :
2951+
2952+ // Replace a hexadecimal escape sequence with the encoded Unicode code point
2953+ // Support: IE <=11+
2954+ // For values outside the Basic Multilingual Plane (BMP), manually construct a
2955+ // surrogate pair
2956 high < 0 ?
2957- // BMP codepoint
2958 String.fromCharCode( high + 0x10000 ) :
2959- // Supplemental Plane codepoint (surrogate pair)
2960 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
2961 },
2962
2963+ // CSS string/identifier serialization
2964+ // https://drafts.csswg.org/cssom/#common-serializing-idioms
2965+ rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
2966+ fcssescape = function( ch, asCodePoint ) {
2967+ if ( asCodePoint ) {
2968+
2969+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
2970+ if ( ch === "\0" ) {
2971+ return "\uFFFD";
2972+ }
2973+
2974+ // Control characters and (dependent upon position) numbers get escaped as code points
2975+ return ch.slice( 0, -1 ) + "\\" +
2976+ ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
2977+ }
2978+
2979+ // Other potentially-special ASCII characters get backslash-escaped
2980+ return "\\" + ch;
2981+ },
2982+
2983 // Used for iframes
2984 // See setDocument()
2985 // Removing the function wrapper causes a "Permission Denied"
2986 // error in IE
2987 unloadHandler = function() {
2988 setDocument();
2989- };
2990+ },
2991+
2992+ inDisabledFieldset = addCombinator(
2993+ function( elem ) {
2994+ return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
2995+ },
2996+ { dir: "parentNode", next: "legend" }
2997+ );
2998
2999 // Optimize for push.apply( _, NodeList )
3000 try {
3001 push.apply(
3002- (arr = slice.call( preferredDoc.childNodes )),
3003+ ( arr = slice.call( preferredDoc.childNodes ) ),
3004 preferredDoc.childNodes
3005 );
3006+
3007 // Support: Android<4.0
3008 // Detect silently failing push.apply
3009+ // eslint-disable-next-line no-unused-expressions
3010 arr[ preferredDoc.childNodes.length ].nodeType;
3011 } catch ( e ) {
3012 push = { apply: arr.length ?
3013
3014 // Leverage slice if possible
3015 function( target, els ) {
3016- push_native.apply( target, slice.call(els) );
3017+ pushNative.apply( target, slice.call( els ) );
3018 } :
3019
3020 // Support: IE<9
3021@@ -762,15 +744,16 @@ try {
3022 function( target, els ) {
3023 var j = target.length,
3024 i = 0;
3025+
3026 // Can't trust NodeList.length
3027- while ( (target[j++] = els[i++]) ) {}
3028+ while ( ( target[ j++ ] = els[ i++ ] ) ) {}
3029 target.length = j - 1;
3030 }
3031 };
3032 }
3033
3034 function Sizzle( selector, context, results, seed ) {
3035- var m, i, elem, nid, nidselect, match, groups, newSelector,
3036+ var m, i, elem, nid, match, groups, newSelector,
3037 newContext = context && context.ownerDocument,
3038
3039 // nodeType defaults to 9, since context defaults to document
3040@@ -787,24 +770,21 @@ function Sizzle( selector, context, results, seed ) {
3041
3042 // Try to shortcut find operations (as opposed to filters) in HTML documents
3043 if ( !seed ) {
3044-
3045- if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
3046- setDocument( context );
3047- }
3048+ setDocument( context );
3049 context = context || document;
3050
3051 if ( documentIsHTML ) {
3052
3053 // If the selector is sufficiently simple, try using a "get*By*" DOM method
3054 // (excepting DocumentFragment context, where the methods don't exist)
3055- if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
3056+ if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
3057
3058 // ID selector
3059- if ( (m = match[1]) ) {
3060+ if ( ( m = match[ 1 ] ) ) {
3061
3062 // Document context
3063 if ( nodeType === 9 ) {
3064- if ( (elem = context.getElementById( m )) ) {
3065+ if ( ( elem = context.getElementById( m ) ) ) {
3066
3067 // Support: IE, Opera, Webkit
3068 // TODO: identify versions
3069@@ -823,7 +803,7 @@ function Sizzle( selector, context, results, seed ) {
3070 // Support: IE, Opera, Webkit
3071 // TODO: identify versions
3072 // getElementById can match elements by name instead of ID
3073- if ( newContext && (elem = newContext.getElementById( m )) &&
3074+ if ( newContext && ( elem = newContext.getElementById( m ) ) &&
3075 contains( context, elem ) &&
3076 elem.id === m ) {
3077
3078@@ -833,12 +813,12 @@ function Sizzle( selector, context, results, seed ) {
3079 }
3080
3081 // Type selector
3082- } else if ( match[2] ) {
3083+ } else if ( match[ 2 ] ) {
3084 push.apply( results, context.getElementsByTagName( selector ) );
3085 return results;
3086
3087 // Class selector
3088- } else if ( (m = match[3]) && support.getElementsByClassName &&
3089+ } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
3090 context.getElementsByClassName ) {
3091
3092 push.apply( results, context.getElementsByClassName( m ) );
3093@@ -848,51 +828,62 @@ function Sizzle( selector, context, results, seed ) {
3094
3095 // Take advantage of querySelectorAll
3096 if ( support.qsa &&
3097- !compilerCache[ selector + " " ] &&
3098- (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
3099+ !nonnativeSelectorCache[ selector + " " ] &&
3100+ ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
3101
3102- if ( nodeType !== 1 ) {
3103- newContext = context;
3104- newSelector = selector;
3105-
3106- // qSA looks outside Element context, which is not what we want
3107- // Thanks to Andrew Dupont for this workaround technique
3108- // Support: IE <=8
3109+ // Support: IE 8 only
3110 // Exclude object elements
3111- } else if ( context.nodeName.toLowerCase() !== "object" ) {
3112+ ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
3113
3114- // Capture the context ID, setting it first if necessary
3115- if ( (nid = context.getAttribute( "id" )) ) {
3116- nid = nid.replace( rescape, "\\$&" );
3117- } else {
3118- context.setAttribute( "id", (nid = expando) );
3119+ newSelector = selector;
3120+ newContext = context;
3121+
3122+ // qSA considers elements outside a scoping root when evaluating child or
3123+ // descendant combinators, which is not what we want.
3124+ // In such cases, we work around the behavior by prefixing every selector in the
3125+ // list with an ID selector referencing the scope context.
3126+ // The technique has to be used as well when a leading combinator is used
3127+ // as such selectors are not recognized by querySelectorAll.
3128+ // Thanks to Andrew Dupont for this technique.
3129+ if ( nodeType === 1 &&
3130+ ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
3131+
3132+ // Expand context for sibling selectors
3133+ newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
3134+ context;
3135+
3136+ // We can use :scope instead of the ID hack if the browser
3137+ // supports it & if we're not changing the context.
3138+ if ( newContext !== context || !support.scope ) {
3139+
3140+ // Capture the context ID, setting it first if necessary
3141+ if ( ( nid = context.getAttribute( "id" ) ) ) {
3142+ nid = nid.replace( rcssescape, fcssescape );
3143+ } else {
3144+ context.setAttribute( "id", ( nid = expando ) );
3145+ }
3146 }
3147
3148 // Prefix every selector in the list
3149 groups = tokenize( selector );
3150 i = groups.length;
3151- nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
3152 while ( i-- ) {
3153- groups[i] = nidselect + " " + toSelector( groups[i] );
3154+ groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
3155+ toSelector( groups[ i ] );
3156 }
3157 newSelector = groups.join( "," );
3158-
3159- // Expand context for sibling selectors
3160- newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
3161- context;
3162 }
3163
3164- if ( newSelector ) {
3165- try {
3166- push.apply( results,
3167- newContext.querySelectorAll( newSelector )
3168- );
3169- return results;
3170- } catch ( qsaError ) {
3171- } finally {
3172- if ( nid === expando ) {
3173- context.removeAttribute( "id" );
3174- }
3175+ try {
3176+ push.apply( results,
3177+ newContext.querySelectorAll( newSelector )
3178+ );
3179+ return results;
3180+ } catch ( qsaError ) {
3181+ nonnativeSelectorCache( selector, true );
3182+ } finally {
3183+ if ( nid === expando ) {
3184+ context.removeAttribute( "id" );
3185 }
3186 }
3187 }
3188@@ -913,12 +904,14 @@ function createCache() {
3189 var keys = [];
3190
3191 function cache( key, value ) {
3192+
3193 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
3194 if ( keys.push( key + " " ) > Expr.cacheLength ) {
3195+
3196 // Only keep the most recent entries
3197 delete cache[ keys.shift() ];
3198 }
3199- return (cache[ key + " " ] = value);
3200+ return ( cache[ key + " " ] = value );
3201 }
3202 return cache;
3203 }
3204@@ -934,22 +927,24 @@ function markFunction( fn ) {
3205
3206 /**
3207 * Support testing using an element
3208- * @param {Function} fn Passed the created div and expects a boolean result
3209+ * @param {Function} fn Passed the created element and returns a boolean result
3210 */
3211 function assert( fn ) {
3212- var div = document.createElement("div");
3213+ var el = document.createElement( "fieldset" );
3214
3215 try {
3216- return !!fn( div );
3217- } catch (e) {
3218+ return !!fn( el );
3219+ } catch ( e ) {
3220 return false;
3221 } finally {
3222+
3223 // Remove from its parent by default
3224- if ( div.parentNode ) {
3225- div.parentNode.removeChild( div );
3226+ if ( el.parentNode ) {
3227+ el.parentNode.removeChild( el );
3228 }
3229+
3230 // release memory in IE
3231- div = null;
3232+ el = null;
3233 }
3234 }
3235
3236@@ -959,11 +954,11 @@ function assert( fn ) {
3237 * @param {Function} handler The method that will be applied
3238 */
3239 function addHandle( attrs, handler ) {
3240- var arr = attrs.split("|"),
3241+ var arr = attrs.split( "|" ),
3242 i = arr.length;
3243
3244 while ( i-- ) {
3245- Expr.attrHandle[ arr[i] ] = handler;
3246+ Expr.attrHandle[ arr[ i ] ] = handler;
3247 }
3248 }
3249
3250@@ -976,8 +971,7 @@ function addHandle( attrs, handler ) {
3251 function siblingCheck( a, b ) {
3252 var cur = b && a,
3253 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
3254- ( ~b.sourceIndex || MAX_NEGATIVE ) -
3255- ( ~a.sourceIndex || MAX_NEGATIVE );
3256+ a.sourceIndex - b.sourceIndex;
3257
3258 // Use IE sourceIndex if available on both nodes
3259 if ( diff ) {
3260@@ -986,7 +980,7 @@ function siblingCheck( a, b ) {
3261
3262 // Check if b follows a
3263 if ( cur ) {
3264- while ( (cur = cur.nextSibling) ) {
3265+ while ( ( cur = cur.nextSibling ) ) {
3266 if ( cur === b ) {
3267 return -1;
3268 }
3269@@ -1014,7 +1008,63 @@ function createInputPseudo( type ) {
3270 function createButtonPseudo( type ) {
3271 return function( elem ) {
3272 var name = elem.nodeName.toLowerCase();
3273- return (name === "input" || name === "button") && elem.type === type;
3274+ return ( name === "input" || name === "button" ) && elem.type === type;
3275+ };
3276+}
3277+
3278+/**
3279+ * Returns a function to use in pseudos for :enabled/:disabled
3280+ * @param {Boolean} disabled true for :disabled; false for :enabled
3281+ */
3282+function createDisabledPseudo( disabled ) {
3283+
3284+ // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
3285+ return function( elem ) {
3286+
3287+ // Only certain elements can match :enabled or :disabled
3288+ // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
3289+ // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
3290+ if ( "form" in elem ) {
3291+
3292+ // Check for inherited disabledness on relevant non-disabled elements:
3293+ // * listed form-associated elements in a disabled fieldset
3294+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
3295+ // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
3296+ // * option elements in a disabled optgroup
3297+ // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
3298+ // All such elements have a "form" property.
3299+ if ( elem.parentNode && elem.disabled === false ) {
3300+
3301+ // Option elements defer to a parent optgroup if present
3302+ if ( "label" in elem ) {
3303+ if ( "label" in elem.parentNode ) {
3304+ return elem.parentNode.disabled === disabled;
3305+ } else {
3306+ return elem.disabled === disabled;
3307+ }
3308+ }
3309+
3310+ // Support: IE 6 - 11
3311+ // Use the isDisabled shortcut property to check for disabled fieldset ancestors
3312+ return elem.isDisabled === disabled ||
3313+
3314+ // Where there is no isDisabled, check manually
3315+ /* jshint -W018 */
3316+ elem.isDisabled !== !disabled &&
3317+ inDisabledFieldset( elem ) === disabled;
3318+ }
3319+
3320+ return elem.disabled === disabled;
3321+
3322+ // Try to winnow out elements that can't be disabled before trusting the disabled property.
3323+ // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
3324+ // even exist on them, let alone have a boolean value.
3325+ } else if ( "label" in elem ) {
3326+ return elem.disabled === disabled;
3327+ }
3328+
3329+ // Remaining elements are neither :enabled nor :disabled
3330+ return false;
3331 };
3332 }
3333
3334@@ -1023,21 +1073,21 @@ function createButtonPseudo( type ) {
3335 * @param {Function} fn
3336 */
3337 function createPositionalPseudo( fn ) {
3338- return markFunction(function( argument ) {
3339+ return markFunction( function( argument ) {
3340 argument = +argument;
3341- return markFunction(function( seed, matches ) {
3342+ return markFunction( function( seed, matches ) {
3343 var j,
3344 matchIndexes = fn( [], seed.length, argument ),
3345 i = matchIndexes.length;
3346
3347 // Match elements found at the specified indexes
3348 while ( i-- ) {
3349- if ( seed[ (j = matchIndexes[i]) ] ) {
3350- seed[j] = !(matches[j] = seed[j]);
3351+ if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
3352+ seed[ j ] = !( matches[ j ] = seed[ j ] );
3353 }
3354 }
3355- });
3356- });
3357+ } );
3358+ } );
3359 }
3360
3361 /**
3362@@ -1058,10 +1108,13 @@ support = Sizzle.support = {};
3363 * @returns {Boolean} True iff elem is a non-HTML XML node
3364 */
3365 isXML = Sizzle.isXML = function( elem ) {
3366- // documentElement is verified for cases where it doesn't yet exist
3367- // (such as loading iframes in IE - #4833)
3368- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
3369- return documentElement ? documentElement.nodeName !== "HTML" : false;
3370+ var namespace = elem.namespaceURI,
3371+ docElem = ( elem.ownerDocument || elem ).documentElement;
3372+
3373+ // Support: IE <=8
3374+ // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
3375+ // https://bugs.jquery.com/ticket/4833
3376+ return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
3377 };
3378
3379 /**
3380@@ -1070,11 +1123,15 @@ isXML = Sizzle.isXML = function( elem ) {
3381 * @returns {Object} Returns the current document
3382 */
3383 setDocument = Sizzle.setDocument = function( node ) {
3384- var hasCompare, parent,
3385+ var hasCompare, subWindow,
3386 doc = node ? node.ownerDocument || node : preferredDoc;
3387
3388 // Return early if doc is invalid or already selected
3389- if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
3390+ // Support: IE 11+, Edge 17 - 18+
3391+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3392+ // two documents; shallow comparisons work.
3393+ // eslint-disable-next-line eqeqeq
3394+ if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
3395 return document;
3396 }
3397
3398@@ -1083,82 +1140,125 @@ setDocument = Sizzle.setDocument = function( node ) {
3399 docElem = document.documentElement;
3400 documentIsHTML = !isXML( document );
3401
3402- // Support: IE 9-11, Edge
3403+ // Support: IE 9 - 11+, Edge 12 - 18+
3404 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
3405- if ( (parent = document.defaultView) && parent.top !== parent ) {
3406- // Support: IE 11
3407- if ( parent.addEventListener ) {
3408- parent.addEventListener( "unload", unloadHandler, false );
3409+ // Support: IE 11+, Edge 17 - 18+
3410+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3411+ // two documents; shallow comparisons work.
3412+ // eslint-disable-next-line eqeqeq
3413+ if ( preferredDoc != document &&
3414+ ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
3415+
3416+ // Support: IE 11, Edge
3417+ if ( subWindow.addEventListener ) {
3418+ subWindow.addEventListener( "unload", unloadHandler, false );
3419
3420 // Support: IE 9 - 10 only
3421- } else if ( parent.attachEvent ) {
3422- parent.attachEvent( "onunload", unloadHandler );
3423+ } else if ( subWindow.attachEvent ) {
3424+ subWindow.attachEvent( "onunload", unloadHandler );
3425 }
3426 }
3427
3428+ // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
3429+ // Safari 4 - 5 only, Opera <=11.6 - 12.x only
3430+ // IE/Edge & older browsers don't support the :scope pseudo-class.
3431+ // Support: Safari 6.0 only
3432+ // Safari 6.0 supports :scope but it's an alias of :root there.
3433+ support.scope = assert( function( el ) {
3434+ docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
3435+ return typeof el.querySelectorAll !== "undefined" &&
3436+ !el.querySelectorAll( ":scope fieldset div" ).length;
3437+ } );
3438+
3439 /* Attributes
3440 ---------------------------------------------------------------------- */
3441
3442 // Support: IE<8
3443 // Verify that getAttribute really returns attributes and not properties
3444 // (excepting IE8 booleans)
3445- support.attributes = assert(function( div ) {
3446- div.className = "i";
3447- return !div.getAttribute("className");
3448- });
3449+ support.attributes = assert( function( el ) {
3450+ el.className = "i";
3451+ return !el.getAttribute( "className" );
3452+ } );
3453
3454 /* getElement(s)By*
3455 ---------------------------------------------------------------------- */
3456
3457 // Check if getElementsByTagName("*") returns only elements
3458- support.getElementsByTagName = assert(function( div ) {
3459- div.appendChild( document.createComment("") );
3460- return !div.getElementsByTagName("*").length;
3461- });
3462+ support.getElementsByTagName = assert( function( el ) {
3463+ el.appendChild( document.createComment( "" ) );
3464+ return !el.getElementsByTagName( "*" ).length;
3465+ } );
3466
3467 // Support: IE<9
3468 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
3469
3470 // Support: IE<10
3471 // Check if getElementById returns elements by name
3472- // The broken getElementById methods don't pick up programatically-set names,
3473+ // The broken getElementById methods don't pick up programmatically-set names,
3474 // so use a roundabout getElementsByName test
3475- support.getById = assert(function( div ) {
3476- docElem.appendChild( div ).id = expando;
3477+ support.getById = assert( function( el ) {
3478+ docElem.appendChild( el ).id = expando;
3479 return !document.getElementsByName || !document.getElementsByName( expando ).length;
3480- });
3481+ } );
3482
3483- // ID find and filter
3484+ // ID filter and find
3485 if ( support.getById ) {
3486- Expr.find["ID"] = function( id, context ) {
3487- if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
3488- var m = context.getElementById( id );
3489- return m ? [ m ] : [];
3490- }
3491- };
3492- Expr.filter["ID"] = function( id ) {
3493+ Expr.filter[ "ID" ] = function( id ) {
3494 var attrId = id.replace( runescape, funescape );
3495 return function( elem ) {
3496- return elem.getAttribute("id") === attrId;
3497+ return elem.getAttribute( "id" ) === attrId;
3498 };
3499 };
3500+ Expr.find[ "ID" ] = function( id, context ) {
3501+ if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
3502+ var elem = context.getElementById( id );
3503+ return elem ? [ elem ] : [];
3504+ }
3505+ };
3506 } else {
3507- // Support: IE6/7
3508- // getElementById is not reliable as a find shortcut
3509- delete Expr.find["ID"];
3510-
3511- Expr.filter["ID"] = function( id ) {
3512+ Expr.filter[ "ID" ] = function( id ) {
3513 var attrId = id.replace( runescape, funescape );
3514 return function( elem ) {
3515 var node = typeof elem.getAttributeNode !== "undefined" &&
3516- elem.getAttributeNode("id");
3517+ elem.getAttributeNode( "id" );
3518 return node && node.value === attrId;
3519 };
3520 };
3521+
3522+ // Support: IE 6 - 7 only
3523+ // getElementById is not reliable as a find shortcut
3524+ Expr.find[ "ID" ] = function( id, context ) {
3525+ if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
3526+ var node, i, elems,
3527+ elem = context.getElementById( id );
3528+
3529+ if ( elem ) {
3530+
3531+ // Verify the id attribute
3532+ node = elem.getAttributeNode( "id" );
3533+ if ( node && node.value === id ) {
3534+ return [ elem ];
3535+ }
3536+
3537+ // Fall back on getElementsByName
3538+ elems = context.getElementsByName( id );
3539+ i = 0;
3540+ while ( ( elem = elems[ i++ ] ) ) {
3541+ node = elem.getAttributeNode( "id" );
3542+ if ( node && node.value === id ) {
3543+ return [ elem ];
3544+ }
3545+ }
3546+ }
3547+
3548+ return [];
3549+ }
3550+ };
3551 }
3552
3553 // Tag
3554- Expr.find["TAG"] = support.getElementsByTagName ?
3555+ Expr.find[ "TAG" ] = support.getElementsByTagName ?
3556 function( tag, context ) {
3557 if ( typeof context.getElementsByTagName !== "undefined" ) {
3558 return context.getElementsByTagName( tag );
3559@@ -1173,12 +1273,13 @@ setDocument = Sizzle.setDocument = function( node ) {
3560 var elem,
3561 tmp = [],
3562 i = 0,
3563+
3564 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
3565 results = context.getElementsByTagName( tag );
3566
3567 // Filter out possible comments
3568 if ( tag === "*" ) {
3569- while ( (elem = results[i++]) ) {
3570+ while ( ( elem = results[ i++ ] ) ) {
3571 if ( elem.nodeType === 1 ) {
3572 tmp.push( elem );
3573 }
3574@@ -1190,7 +1291,7 @@ setDocument = Sizzle.setDocument = function( node ) {
3575 };
3576
3577 // Class
3578- Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
3579+ Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
3580 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
3581 return context.getElementsByClassName( className );
3582 }
3583@@ -1208,101 +1309,135 @@ setDocument = Sizzle.setDocument = function( node ) {
3584 // We allow this because of a bug in IE8/9 that throws an error
3585 // whenever `document.activeElement` is accessed on an iframe
3586 // So, we allow :focus to pass through QSA all the time to avoid the IE error
3587- // See http://bugs.jquery.com/ticket/13378
3588+ // See https://bugs.jquery.com/ticket/13378
3589 rbuggyQSA = [];
3590
3591- if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
3592+ if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
3593+
3594 // Build QSA regex
3595 // Regex strategy adopted from Diego Perini
3596- assert(function( div ) {
3597+ assert( function( el ) {
3598+
3599+ var input;
3600+
3601 // Select is set to empty string on purpose
3602 // This is to test IE's treatment of not explicitly
3603 // setting a boolean content attribute,
3604 // since its presence should be enough
3605- // http://bugs.jquery.com/ticket/12359
3606- docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
3607+ // https://bugs.jquery.com/ticket/12359
3608+ docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
3609 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
3610 "<option selected=''></option></select>";
3611
3612 // Support: IE8, Opera 11-12.16
3613 // Nothing should be selected when empty strings follow ^= or $= or *=
3614 // The test attribute must be unknown in Opera but "safe" for WinRT
3615- // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
3616- if ( div.querySelectorAll("[msallowcapture^='']").length ) {
3617+ // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
3618+ if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
3619 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
3620 }
3621
3622 // Support: IE8
3623 // Boolean attributes and "value" are not treated correctly
3624- if ( !div.querySelectorAll("[selected]").length ) {
3625+ if ( !el.querySelectorAll( "[selected]" ).length ) {
3626 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
3627 }
3628
3629 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
3630- if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
3631- rbuggyQSA.push("~=");
3632+ if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
3633+ rbuggyQSA.push( "~=" );
3634+ }
3635+
3636+ // Support: IE 11+, Edge 15 - 18+
3637+ // IE 11/Edge don't find elements on a `[name='']` query in some cases.
3638+ // Adding a temporary attribute to the document before the selection works
3639+ // around the issue.
3640+ // Interestingly, IE 10 & older don't seem to have the issue.
3641+ input = document.createElement( "input" );
3642+ input.setAttribute( "name", "" );
3643+ el.appendChild( input );
3644+ if ( !el.querySelectorAll( "[name='']" ).length ) {
3645+ rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
3646+ whitespace + "*(?:''|\"\")" );
3647 }
3648
3649 // Webkit/Opera - :checked should return selected option elements
3650 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
3651 // IE8 throws error here and will not see later tests
3652- if ( !div.querySelectorAll(":checked").length ) {
3653- rbuggyQSA.push(":checked");
3654+ if ( !el.querySelectorAll( ":checked" ).length ) {
3655+ rbuggyQSA.push( ":checked" );
3656 }
3657
3658 // Support: Safari 8+, iOS 8+
3659 // https://bugs.webkit.org/show_bug.cgi?id=136851
3660- // In-page `selector#id sibing-combinator selector` fails
3661- if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
3662- rbuggyQSA.push(".#.+[+~]");
3663+ // In-page `selector#id sibling-combinator selector` fails
3664+ if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
3665+ rbuggyQSA.push( ".#.+[+~]" );
3666 }
3667- });
3668
3669- assert(function( div ) {
3670+ // Support: Firefox <=3.6 - 5 only
3671+ // Old Firefox doesn't throw on a badly-escaped identifier.
3672+ el.querySelectorAll( "\\\f" );
3673+ rbuggyQSA.push( "[\\r\\n\\f]" );
3674+ } );
3675+
3676+ assert( function( el ) {
3677+ el.innerHTML = "<a href='' disabled='disabled'></a>" +
3678+ "<select disabled='disabled'><option/></select>";
3679+
3680 // Support: Windows 8 Native Apps
3681 // The type and name attributes are restricted during .innerHTML assignment
3682- var input = document.createElement("input");
3683+ var input = document.createElement( "input" );
3684 input.setAttribute( "type", "hidden" );
3685- div.appendChild( input ).setAttribute( "name", "D" );
3686+ el.appendChild( input ).setAttribute( "name", "D" );
3687
3688 // Support: IE8
3689 // Enforce case-sensitivity of name attribute
3690- if ( div.querySelectorAll("[name=d]").length ) {
3691+ if ( el.querySelectorAll( "[name=d]" ).length ) {
3692 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
3693 }
3694
3695 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
3696 // IE8 throws error here and will not see later tests
3697- if ( !div.querySelectorAll(":enabled").length ) {
3698+ if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
3699+ rbuggyQSA.push( ":enabled", ":disabled" );
3700+ }
3701+
3702+ // Support: IE9-11+
3703+ // IE's :disabled selector does not pick up the children of disabled fieldsets
3704+ docElem.appendChild( el ).disabled = true;
3705+ if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
3706 rbuggyQSA.push( ":enabled", ":disabled" );
3707 }
3708
3709+ // Support: Opera 10 - 11 only
3710 // Opera 10-11 does not throw on post-comma invalid pseudos
3711- div.querySelectorAll("*,:x");
3712- rbuggyQSA.push(",.*:");
3713- });
3714+ el.querySelectorAll( "*,:x" );
3715+ rbuggyQSA.push( ",.*:" );
3716+ } );
3717 }
3718
3719- if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
3720+ if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
3721 docElem.webkitMatchesSelector ||
3722 docElem.mozMatchesSelector ||
3723 docElem.oMatchesSelector ||
3724- docElem.msMatchesSelector) )) ) {
3725+ docElem.msMatchesSelector ) ) ) ) {
3726+
3727+ assert( function( el ) {
3728
3729- assert(function( div ) {
3730 // Check to see if it's possible to do matchesSelector
3731 // on a disconnected node (IE 9)
3732- support.disconnectedMatch = matches.call( div, "div" );
3733+ support.disconnectedMatch = matches.call( el, "*" );
3734
3735 // This should fail with an exception
3736 // Gecko does not error, returns false instead
3737- matches.call( div, "[s!='']:x" );
3738+ matches.call( el, "[s!='']:x" );
3739 rbuggyMatches.push( "!=", pseudos );
3740- });
3741+ } );
3742 }
3743
3744- rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
3745- rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
3746+ rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
3747+ rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
3748
3749 /* Contains
3750 ---------------------------------------------------------------------- */
3751@@ -1319,11 +1454,11 @@ setDocument = Sizzle.setDocument = function( node ) {
3752 adown.contains ?
3753 adown.contains( bup ) :
3754 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
3755- ));
3756+ ) );
3757 } :
3758 function( a, b ) {
3759 if ( b ) {
3760- while ( (b = b.parentNode) ) {
3761+ while ( ( b = b.parentNode ) ) {
3762 if ( b === a ) {
3763 return true;
3764 }
3765@@ -1352,7 +1487,11 @@ setDocument = Sizzle.setDocument = function( node ) {
3766 }
3767
3768 // Calculate position if both inputs belong to the same document
3769- compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
3770+ // Support: IE 11+, Edge 17 - 18+
3771+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3772+ // two documents; shallow comparisons work.
3773+ // eslint-disable-next-line eqeqeq
3774+ compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
3775 a.compareDocumentPosition( b ) :
3776
3777 // Otherwise we know they are disconnected
3778@@ -1360,13 +1499,24 @@ setDocument = Sizzle.setDocument = function( node ) {
3779
3780 // Disconnected nodes
3781 if ( compare & 1 ||
3782- (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
3783+ ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
3784
3785 // Choose the first element that is related to our preferred document
3786- if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
3787+ // Support: IE 11+, Edge 17 - 18+
3788+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3789+ // two documents; shallow comparisons work.
3790+ // eslint-disable-next-line eqeqeq
3791+ if ( a == document || a.ownerDocument == preferredDoc &&
3792+ contains( preferredDoc, a ) ) {
3793 return -1;
3794 }
3795- if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
3796+
3797+ // Support: IE 11+, Edge 17 - 18+
3798+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3799+ // two documents; shallow comparisons work.
3800+ // eslint-disable-next-line eqeqeq
3801+ if ( b == document || b.ownerDocument == preferredDoc &&
3802+ contains( preferredDoc, b ) ) {
3803 return 1;
3804 }
3805
3806@@ -1379,6 +1529,7 @@ setDocument = Sizzle.setDocument = function( node ) {
3807 return compare & 4 ? -1 : 1;
3808 } :
3809 function( a, b ) {
3810+
3811 // Exit early if the nodes are identical
3812 if ( a === b ) {
3813 hasDuplicate = true;
3814@@ -1394,8 +1545,14 @@ setDocument = Sizzle.setDocument = function( node ) {
3815
3816 // Parentless nodes are either documents or disconnected
3817 if ( !aup || !bup ) {
3818- return a === document ? -1 :
3819- b === document ? 1 :
3820+
3821+ // Support: IE 11+, Edge 17 - 18+
3822+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3823+ // two documents; shallow comparisons work.
3824+ /* eslint-disable eqeqeq */
3825+ return a == document ? -1 :
3826+ b == document ? 1 :
3827+ /* eslint-enable eqeqeq */
3828 aup ? -1 :
3829 bup ? 1 :
3830 sortInput ?
3831@@ -1409,26 +1566,32 @@ setDocument = Sizzle.setDocument = function( node ) {
3832
3833 // Otherwise we need full lists of their ancestors for comparison
3834 cur = a;
3835- while ( (cur = cur.parentNode) ) {
3836+ while ( ( cur = cur.parentNode ) ) {
3837 ap.unshift( cur );
3838 }
3839 cur = b;
3840- while ( (cur = cur.parentNode) ) {
3841+ while ( ( cur = cur.parentNode ) ) {
3842 bp.unshift( cur );
3843 }
3844
3845 // Walk down the tree looking for a discrepancy
3846- while ( ap[i] === bp[i] ) {
3847+ while ( ap[ i ] === bp[ i ] ) {
3848 i++;
3849 }
3850
3851 return i ?
3852+
3853 // Do a sibling check if the nodes have a common ancestor
3854- siblingCheck( ap[i], bp[i] ) :
3855+ siblingCheck( ap[ i ], bp[ i ] ) :
3856
3857 // Otherwise nodes in our document sort first
3858- ap[i] === preferredDoc ? -1 :
3859- bp[i] === preferredDoc ? 1 :
3860+ // Support: IE 11+, Edge 17 - 18+
3861+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3862+ // two documents; shallow comparisons work.
3863+ /* eslint-disable eqeqeq */
3864+ ap[ i ] == preferredDoc ? -1 :
3865+ bp[ i ] == preferredDoc ? 1 :
3866+ /* eslint-enable eqeqeq */
3867 0;
3868 };
3869
3870@@ -1440,16 +1603,10 @@ Sizzle.matches = function( expr, elements ) {
3871 };
3872
3873 Sizzle.matchesSelector = function( elem, expr ) {
3874- // Set document vars if needed
3875- if ( ( elem.ownerDocument || elem ) !== document ) {
3876- setDocument( elem );
3877- }
3878-
3879- // Make sure that attribute selectors are quoted
3880- expr = expr.replace( rattributeQuotes, "='$1']" );
3881+ setDocument( elem );
3882
3883 if ( support.matchesSelector && documentIsHTML &&
3884- !compilerCache[ expr + " " ] &&
3885+ !nonnativeSelectorCache[ expr + " " ] &&
3886 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
3887 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
3888
3889@@ -1458,32 +1615,46 @@ Sizzle.matchesSelector = function( elem, expr ) {
3890
3891 // IE 9's matchesSelector returns false on disconnected nodes
3892 if ( ret || support.disconnectedMatch ||
3893- // As well, disconnected nodes are said to be in a document
3894- // fragment in IE 9
3895- elem.document && elem.document.nodeType !== 11 ) {
3896+
3897+ // As well, disconnected nodes are said to be in a document
3898+ // fragment in IE 9
3899+ elem.document && elem.document.nodeType !== 11 ) {
3900 return ret;
3901 }
3902- } catch (e) {}
3903+ } catch ( e ) {
3904+ nonnativeSelectorCache( expr, true );
3905+ }
3906 }
3907
3908 return Sizzle( expr, document, null, [ elem ] ).length > 0;
3909 };
3910
3911 Sizzle.contains = function( context, elem ) {
3912+
3913 // Set document vars if needed
3914- if ( ( context.ownerDocument || context ) !== document ) {
3915+ // Support: IE 11+, Edge 17 - 18+
3916+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3917+ // two documents; shallow comparisons work.
3918+ // eslint-disable-next-line eqeqeq
3919+ if ( ( context.ownerDocument || context ) != document ) {
3920 setDocument( context );
3921 }
3922 return contains( context, elem );
3923 };
3924
3925 Sizzle.attr = function( elem, name ) {
3926+
3927 // Set document vars if needed
3928- if ( ( elem.ownerDocument || elem ) !== document ) {
3929+ // Support: IE 11+, Edge 17 - 18+
3930+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3931+ // two documents; shallow comparisons work.
3932+ // eslint-disable-next-line eqeqeq
3933+ if ( ( elem.ownerDocument || elem ) != document ) {
3934 setDocument( elem );
3935 }
3936
3937 var fn = Expr.attrHandle[ name.toLowerCase() ],
3938+
3939 // Don't get fooled by Object.prototype properties (jQuery #13807)
3940 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
3941 fn( elem, name, !documentIsHTML ) :
3942@@ -1493,11 +1664,15 @@ Sizzle.attr = function( elem, name ) {
3943 val :
3944 support.attributes || !documentIsHTML ?
3945 elem.getAttribute( name ) :
3946- (val = elem.getAttributeNode(name)) && val.specified ?
3947+ ( val = elem.getAttributeNode( name ) ) && val.specified ?
3948 val.value :
3949 null;
3950 };
3951
3952+Sizzle.escape = function( sel ) {
3953+ return ( sel + "" ).replace( rcssescape, fcssescape );
3954+};
3955+
3956 Sizzle.error = function( msg ) {
3957 throw new Error( "Syntax error, unrecognized expression: " + msg );
3958 };
3959@@ -1518,7 +1693,7 @@ Sizzle.uniqueSort = function( results ) {
3960 results.sort( sortOrder );
3961
3962 if ( hasDuplicate ) {
3963- while ( (elem = results[i++]) ) {
3964+ while ( ( elem = results[ i++ ] ) ) {
3965 if ( elem === results[ i ] ) {
3966 j = duplicates.push( i );
3967 }
3968@@ -1546,17 +1721,21 @@ getText = Sizzle.getText = function( elem ) {
3969 nodeType = elem.nodeType;
3970
3971 if ( !nodeType ) {
3972+
3973 // If no nodeType, this is expected to be an array
3974- while ( (node = elem[i++]) ) {
3975+ while ( ( node = elem[ i++ ] ) ) {
3976+
3977 // Do not traverse comment nodes
3978 ret += getText( node );
3979 }
3980 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
3981+
3982 // Use textContent for elements
3983 // innerText usage removed for consistency of new lines (jQuery #11153)
3984 if ( typeof elem.textContent === "string" ) {
3985 return elem.textContent;
3986 } else {
3987+
3988 // Traverse its children
3989 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
3990 ret += getText( elem );
3991@@ -1565,6 +1744,7 @@ getText = Sizzle.getText = function( elem ) {
3992 } else if ( nodeType === 3 || nodeType === 4 ) {
3993 return elem.nodeValue;
3994 }
3995+
3996 // Do not include comment or processing instruction nodes
3997
3998 return ret;
3999@@ -1592,19 +1772,21 @@ Expr = Sizzle.selectors = {
4000
4001 preFilter: {
4002 "ATTR": function( match ) {
4003- match[1] = match[1].replace( runescape, funescape );
4004+ match[ 1 ] = match[ 1 ].replace( runescape, funescape );
4005
4006 // Move the given value to match[3] whether quoted or unquoted
4007- match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
4008+ match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
4009+ match[ 5 ] || "" ).replace( runescape, funescape );
4010
4011- if ( match[2] === "~=" ) {
4012- match[3] = " " + match[3] + " ";
4013+ if ( match[ 2 ] === "~=" ) {
4014+ match[ 3 ] = " " + match[ 3 ] + " ";
4015 }
4016
4017 return match.slice( 0, 4 );
4018 },
4019
4020 "CHILD": function( match ) {
4021+
4022 /* matches from matchExpr["CHILD"]
4023 1 type (only|nth|...)
4024 2 what (child|of-type)
4025@@ -1615,22 +1797,25 @@ Expr = Sizzle.selectors = {
4026 7 sign of y-component
4027 8 y of y-component
4028 */
4029- match[1] = match[1].toLowerCase();
4030+ match[ 1 ] = match[ 1 ].toLowerCase();
4031+
4032+ if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
4033
4034- if ( match[1].slice( 0, 3 ) === "nth" ) {
4035 // nth-* requires argument
4036- if ( !match[3] ) {
4037- Sizzle.error( match[0] );
4038+ if ( !match[ 3 ] ) {
4039+ Sizzle.error( match[ 0 ] );
4040 }
4041
4042 // numeric x and y parameters for Expr.filter.CHILD
4043 // remember that false/true cast respectively to 0/1
4044- match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
4045- match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
4046+ match[ 4 ] = +( match[ 4 ] ?
4047+ match[ 5 ] + ( match[ 6 ] || 1 ) :
4048+ 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
4049+ match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
4050
4051- // other types prohibit arguments
4052- } else if ( match[3] ) {
4053- Sizzle.error( match[0] );
4054+ // other types prohibit arguments
4055+ } else if ( match[ 3 ] ) {
4056+ Sizzle.error( match[ 0 ] );
4057 }
4058
4059 return match;
4060@@ -1638,26 +1823,28 @@ Expr = Sizzle.selectors = {
4061
4062 "PSEUDO": function( match ) {
4063 var excess,
4064- unquoted = !match[6] && match[2];
4065+ unquoted = !match[ 6 ] && match[ 2 ];
4066
4067- if ( matchExpr["CHILD"].test( match[0] ) ) {
4068+ if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
4069 return null;
4070 }
4071
4072 // Accept quoted arguments as-is
4073- if ( match[3] ) {
4074- match[2] = match[4] || match[5] || "";
4075+ if ( match[ 3 ] ) {
4076+ match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
4077
4078 // Strip excess characters from unquoted arguments
4079 } else if ( unquoted && rpseudo.test( unquoted ) &&
4080+
4081 // Get excess from tokenize (recursively)
4082- (excess = tokenize( unquoted, true )) &&
4083+ ( excess = tokenize( unquoted, true ) ) &&
4084+
4085 // advance to the next closing parenthesis
4086- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
4087+ ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
4088
4089 // excess is a negative index
4090- match[0] = match[0].slice( 0, excess );
4091- match[2] = unquoted.slice( 0, excess );
4092+ match[ 0 ] = match[ 0 ].slice( 0, excess );
4093+ match[ 2 ] = unquoted.slice( 0, excess );
4094 }
4095
4096 // Return only captures needed by the pseudo filter method (type and argument)
4097@@ -1670,7 +1857,9 @@ Expr = Sizzle.selectors = {
4098 "TAG": function( nodeNameSelector ) {
4099 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
4100 return nodeNameSelector === "*" ?
4101- function() { return true; } :
4102+ function() {
4103+ return true;
4104+ } :
4105 function( elem ) {
4106 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
4107 };
4108@@ -1680,10 +1869,16 @@ Expr = Sizzle.selectors = {
4109 var pattern = classCache[ className + " " ];
4110
4111 return pattern ||
4112- (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
4113- classCache( className, function( elem ) {
4114- return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
4115- });
4116+ ( pattern = new RegExp( "(^|" + whitespace +
4117+ ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
4118+ className, function( elem ) {
4119+ return pattern.test(
4120+ typeof elem.className === "string" && elem.className ||
4121+ typeof elem.getAttribute !== "undefined" &&
4122+ elem.getAttribute( "class" ) ||
4123+ ""
4124+ );
4125+ } );
4126 },
4127
4128 "ATTR": function( name, operator, check ) {
4129@@ -1699,6 +1894,8 @@ Expr = Sizzle.selectors = {
4130
4131 result += "";
4132
4133+ /* eslint-disable max-len */
4134+
4135 return operator === "=" ? result === check :
4136 operator === "!=" ? result !== check :
4137 operator === "^=" ? check && result.indexOf( check ) === 0 :
4138@@ -1707,10 +1904,12 @@ Expr = Sizzle.selectors = {
4139 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
4140 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
4141 false;
4142+ /* eslint-enable max-len */
4143+
4144 };
4145 },
4146
4147- "CHILD": function( type, what, argument, first, last ) {
4148+ "CHILD": function( type, what, _argument, first, last ) {
4149 var simple = type.slice( 0, 3 ) !== "nth",
4150 forward = type.slice( -4 ) !== "last",
4151 ofType = what === "of-type";
4152@@ -1722,7 +1921,7 @@ Expr = Sizzle.selectors = {
4153 return !!elem.parentNode;
4154 } :
4155
4156- function( elem, context, xml ) {
4157+ function( elem, _context, xml ) {
4158 var cache, uniqueCache, outerCache, node, nodeIndex, start,
4159 dir = simple !== forward ? "nextSibling" : "previousSibling",
4160 parent = elem.parentNode,
4161@@ -1736,7 +1935,7 @@ Expr = Sizzle.selectors = {
4162 if ( simple ) {
4163 while ( dir ) {
4164 node = elem;
4165- while ( (node = node[ dir ]) ) {
4166+ while ( ( node = node[ dir ] ) ) {
4167 if ( ofType ?
4168 node.nodeName.toLowerCase() === name :
4169 node.nodeType === 1 ) {
4170@@ -1744,6 +1943,7 @@ Expr = Sizzle.selectors = {
4171 return false;
4172 }
4173 }
4174+
4175 // Reverse direction for :only-* (if we haven't yet done so)
4176 start = dir = type === "only" && !start && "nextSibling";
4177 }
4178@@ -1759,22 +1959,22 @@ Expr = Sizzle.selectors = {
4179
4180 // ...in a gzip-friendly way
4181 node = parent;
4182- outerCache = node[ expando ] || (node[ expando ] = {});
4183+ outerCache = node[ expando ] || ( node[ expando ] = {} );
4184
4185 // Support: IE <9 only
4186 // Defend against cloned attroperties (jQuery gh-1709)
4187 uniqueCache = outerCache[ node.uniqueID ] ||
4188- (outerCache[ node.uniqueID ] = {});
4189+ ( outerCache[ node.uniqueID ] = {} );
4190
4191 cache = uniqueCache[ type ] || [];
4192 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
4193 diff = nodeIndex && cache[ 2 ];
4194 node = nodeIndex && parent.childNodes[ nodeIndex ];
4195
4196- while ( (node = ++nodeIndex && node && node[ dir ] ||
4197+ while ( ( node = ++nodeIndex && node && node[ dir ] ||
4198
4199 // Fallback to seeking `elem` from the start
4200- (diff = nodeIndex = 0) || start.pop()) ) {
4201+ ( diff = nodeIndex = 0 ) || start.pop() ) ) {
4202
4203 // When found, cache indexes on `parent` and break
4204 if ( node.nodeType === 1 && ++diff && node === elem ) {
4205@@ -1784,16 +1984,18 @@ Expr = Sizzle.selectors = {
4206 }
4207
4208 } else {
4209+
4210 // Use previously-cached element index if available
4211 if ( useCache ) {
4212+
4213 // ...in a gzip-friendly way
4214 node = elem;
4215- outerCache = node[ expando ] || (node[ expando ] = {});
4216+ outerCache = node[ expando ] || ( node[ expando ] = {} );
4217
4218 // Support: IE <9 only
4219 // Defend against cloned attroperties (jQuery gh-1709)
4220 uniqueCache = outerCache[ node.uniqueID ] ||
4221- (outerCache[ node.uniqueID ] = {});
4222+ ( outerCache[ node.uniqueID ] = {} );
4223
4224 cache = uniqueCache[ type ] || [];
4225 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
4226@@ -1803,9 +2005,10 @@ Expr = Sizzle.selectors = {
4227 // xml :nth-child(...)
4228 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
4229 if ( diff === false ) {
4230+
4231 // Use the same loop as above to seek `elem` from the start
4232- while ( (node = ++nodeIndex && node && node[ dir ] ||
4233- (diff = nodeIndex = 0) || start.pop()) ) {
4234+ while ( ( node = ++nodeIndex && node && node[ dir ] ||
4235+ ( diff = nodeIndex = 0 ) || start.pop() ) ) {
4236
4237 if ( ( ofType ?
4238 node.nodeName.toLowerCase() === name :
4239@@ -1814,12 +2017,13 @@ Expr = Sizzle.selectors = {
4240
4241 // Cache the index of each encountered element
4242 if ( useCache ) {
4243- outerCache = node[ expando ] || (node[ expando ] = {});
4244+ outerCache = node[ expando ] ||
4245+ ( node[ expando ] = {} );
4246
4247 // Support: IE <9 only
4248 // Defend against cloned attroperties (jQuery gh-1709)
4249 uniqueCache = outerCache[ node.uniqueID ] ||
4250- (outerCache[ node.uniqueID ] = {});
4251+ ( outerCache[ node.uniqueID ] = {} );
4252
4253 uniqueCache[ type ] = [ dirruns, diff ];
4254 }
4255@@ -1840,6 +2044,7 @@ Expr = Sizzle.selectors = {
4256 },
4257
4258 "PSEUDO": function( pseudo, argument ) {
4259+
4260 // pseudo-class names are case-insensitive
4261 // http://www.w3.org/TR/selectors/#pseudo-classes
4262 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
4263@@ -1859,15 +2064,15 @@ Expr = Sizzle.selectors = {
4264 if ( fn.length > 1 ) {
4265 args = [ pseudo, pseudo, "", argument ];
4266 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
4267- markFunction(function( seed, matches ) {
4268+ markFunction( function( seed, matches ) {
4269 var idx,
4270 matched = fn( seed, argument ),
4271 i = matched.length;
4272 while ( i-- ) {
4273- idx = indexOf( seed, matched[i] );
4274- seed[ idx ] = !( matches[ idx ] = matched[i] );
4275+ idx = indexOf( seed, matched[ i ] );
4276+ seed[ idx ] = !( matches[ idx ] = matched[ i ] );
4277 }
4278- }) :
4279+ } ) :
4280 function( elem ) {
4281 return fn( elem, 0, args );
4282 };
4283@@ -1878,8 +2083,10 @@ Expr = Sizzle.selectors = {
4284 },
4285
4286 pseudos: {
4287+
4288 // Potentially complex pseudos
4289- "not": markFunction(function( selector ) {
4290+ "not": markFunction( function( selector ) {
4291+
4292 // Trim the selector passed to compile
4293 // to avoid treating leading and trailing
4294 // spaces as combinators
4295@@ -1888,39 +2095,40 @@ Expr = Sizzle.selectors = {
4296 matcher = compile( selector.replace( rtrim, "$1" ) );
4297
4298 return matcher[ expando ] ?
4299- markFunction(function( seed, matches, context, xml ) {
4300+ markFunction( function( seed, matches, _context, xml ) {
4301 var elem,
4302 unmatched = matcher( seed, null, xml, [] ),
4303 i = seed.length;
4304
4305 // Match elements unmatched by `matcher`
4306 while ( i-- ) {
4307- if ( (elem = unmatched[i]) ) {
4308- seed[i] = !(matches[i] = elem);
4309+ if ( ( elem = unmatched[ i ] ) ) {
4310+ seed[ i ] = !( matches[ i ] = elem );
4311 }
4312 }
4313- }) :
4314- function( elem, context, xml ) {
4315- input[0] = elem;
4316+ } ) :
4317+ function( elem, _context, xml ) {
4318+ input[ 0 ] = elem;
4319 matcher( input, null, xml, results );
4320+
4321 // Don't keep the element (issue #299)
4322- input[0] = null;
4323+ input[ 0 ] = null;
4324 return !results.pop();
4325 };
4326- }),
4327+ } ),
4328
4329- "has": markFunction(function( selector ) {
4330+ "has": markFunction( function( selector ) {
4331 return function( elem ) {
4332 return Sizzle( selector, elem ).length > 0;
4333 };
4334- }),
4335+ } ),
4336
4337- "contains": markFunction(function( text ) {
4338+ "contains": markFunction( function( text ) {
4339 text = text.replace( runescape, funescape );
4340 return function( elem ) {
4341- return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
4342+ return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
4343 };
4344- }),
4345+ } ),
4346
4347 // "Whether an element is represented by a :lang() selector
4348 // is based solely on the element's language value
4349@@ -1930,25 +2138,26 @@ Expr = Sizzle.selectors = {
4350 // The identifier C does not have to be a valid language name."
4351 // http://www.w3.org/TR/selectors/#lang-pseudo
4352 "lang": markFunction( function( lang ) {
4353+
4354 // lang value must be a valid identifier
4355- if ( !ridentifier.test(lang || "") ) {
4356+ if ( !ridentifier.test( lang || "" ) ) {
4357 Sizzle.error( "unsupported lang: " + lang );
4358 }
4359 lang = lang.replace( runescape, funescape ).toLowerCase();
4360 return function( elem ) {
4361 var elemLang;
4362 do {
4363- if ( (elemLang = documentIsHTML ?
4364+ if ( ( elemLang = documentIsHTML ?
4365 elem.lang :
4366- elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
4367+ elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
4368
4369 elemLang = elemLang.toLowerCase();
4370 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
4371 }
4372- } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
4373+ } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
4374 return false;
4375 };
4376- }),
4377+ } ),
4378
4379 // Miscellaneous
4380 "target": function( elem ) {
4381@@ -1961,29 +2170,30 @@ Expr = Sizzle.selectors = {
4382 },
4383
4384 "focus": function( elem ) {
4385- return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
4386+ return elem === document.activeElement &&
4387+ ( !document.hasFocus || document.hasFocus() ) &&
4388+ !!( elem.type || elem.href || ~elem.tabIndex );
4389 },
4390
4391 // Boolean properties
4392- "enabled": function( elem ) {
4393- return elem.disabled === false;
4394- },
4395-
4396- "disabled": function( elem ) {
4397- return elem.disabled === true;
4398- },
4399+ "enabled": createDisabledPseudo( false ),
4400+ "disabled": createDisabledPseudo( true ),
4401
4402 "checked": function( elem ) {
4403+
4404 // In CSS3, :checked should return both checked and selected elements
4405 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
4406 var nodeName = elem.nodeName.toLowerCase();
4407- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
4408+ return ( nodeName === "input" && !!elem.checked ) ||
4409+ ( nodeName === "option" && !!elem.selected );
4410 },
4411
4412 "selected": function( elem ) {
4413+
4414 // Accessing this property makes selected-by-default
4415 // options in Safari work properly
4416 if ( elem.parentNode ) {
4417+ // eslint-disable-next-line no-unused-expressions
4418 elem.parentNode.selectedIndex;
4419 }
4420
4421@@ -1992,6 +2202,7 @@ Expr = Sizzle.selectors = {
4422
4423 // Contents
4424 "empty": function( elem ) {
4425+
4426 // http://www.w3.org/TR/selectors/#empty-pseudo
4427 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
4428 // but not by others (comment: 8; processing instruction: 7; etc.)
4429@@ -2005,7 +2216,7 @@ Expr = Sizzle.selectors = {
4430 },
4431
4432 "parent": function( elem ) {
4433- return !Expr.pseudos["empty"]( elem );
4434+ return !Expr.pseudos[ "empty" ]( elem );
4435 },
4436
4437 // Element/input types
4438@@ -2029,57 +2240,62 @@ Expr = Sizzle.selectors = {
4439
4440 // Support: IE<8
4441 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
4442- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
4443+ ( ( attr = elem.getAttribute( "type" ) ) == null ||
4444+ attr.toLowerCase() === "text" );
4445 },
4446
4447 // Position-in-collection
4448- "first": createPositionalPseudo(function() {
4449+ "first": createPositionalPseudo( function() {
4450 return [ 0 ];
4451- }),
4452+ } ),
4453
4454- "last": createPositionalPseudo(function( matchIndexes, length ) {
4455+ "last": createPositionalPseudo( function( _matchIndexes, length ) {
4456 return [ length - 1 ];
4457- }),
4458+ } ),
4459
4460- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
4461+ "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
4462 return [ argument < 0 ? argument + length : argument ];
4463- }),
4464+ } ),
4465
4466- "even": createPositionalPseudo(function( matchIndexes, length ) {
4467+ "even": createPositionalPseudo( function( matchIndexes, length ) {
4468 var i = 0;
4469 for ( ; i < length; i += 2 ) {
4470 matchIndexes.push( i );
4471 }
4472 return matchIndexes;
4473- }),
4474+ } ),
4475
4476- "odd": createPositionalPseudo(function( matchIndexes, length ) {
4477+ "odd": createPositionalPseudo( function( matchIndexes, length ) {
4478 var i = 1;
4479 for ( ; i < length; i += 2 ) {
4480 matchIndexes.push( i );
4481 }
4482 return matchIndexes;
4483- }),
4484+ } ),
4485
4486- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4487- var i = argument < 0 ? argument + length : argument;
4488+ "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
4489+ var i = argument < 0 ?
4490+ argument + length :
4491+ argument > length ?
4492+ length :
4493+ argument;
4494 for ( ; --i >= 0; ) {
4495 matchIndexes.push( i );
4496 }
4497 return matchIndexes;
4498- }),
4499+ } ),
4500
4501- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
4502+ "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
4503 var i = argument < 0 ? argument + length : argument;
4504 for ( ; ++i < length; ) {
4505 matchIndexes.push( i );
4506 }
4507 return matchIndexes;
4508- })
4509+ } )
4510 }
4511 };
4512
4513-Expr.pseudos["nth"] = Expr.pseudos["eq"];
4514+Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
4515
4516 // Add button/input type pseudos
4517 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
4518@@ -2110,37 +2326,39 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
4519 while ( soFar ) {
4520
4521 // Comma and first run
4522- if ( !matched || (match = rcomma.exec( soFar )) ) {
4523+ if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
4524 if ( match ) {
4525+
4526 // Don't consume trailing commas as valid
4527- soFar = soFar.slice( match[0].length ) || soFar;
4528+ soFar = soFar.slice( match[ 0 ].length ) || soFar;
4529 }
4530- groups.push( (tokens = []) );
4531+ groups.push( ( tokens = [] ) );
4532 }
4533
4534 matched = false;
4535
4536 // Combinators
4537- if ( (match = rcombinators.exec( soFar )) ) {
4538+ if ( ( match = rcombinators.exec( soFar ) ) ) {
4539 matched = match.shift();
4540- tokens.push({
4541+ tokens.push( {
4542 value: matched,
4543+
4544 // Cast descendant combinators to space
4545- type: match[0].replace( rtrim, " " )
4546- });
4547+ type: match[ 0 ].replace( rtrim, " " )
4548+ } );
4549 soFar = soFar.slice( matched.length );
4550 }
4551
4552 // Filters
4553 for ( type in Expr.filter ) {
4554- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
4555- (match = preFilters[ type ]( match ))) ) {
4556+ if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
4557+ ( match = preFilters[ type ]( match ) ) ) ) {
4558 matched = match.shift();
4559- tokens.push({
4560+ tokens.push( {
4561 value: matched,
4562 type: type,
4563 matches: match
4564- });
4565+ } );
4566 soFar = soFar.slice( matched.length );
4567 }
4568 }
4569@@ -2157,6 +2375,7 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
4570 soFar.length :
4571 soFar ?
4572 Sizzle.error( selector ) :
4573+
4574 // Cache the tokens
4575 tokenCache( selector, groups ).slice( 0 );
4576 };
4577@@ -2166,24 +2385,28 @@ function toSelector( tokens ) {
4578 len = tokens.length,
4579 selector = "";
4580 for ( ; i < len; i++ ) {
4581- selector += tokens[i].value;
4582+ selector += tokens[ i ].value;
4583 }
4584 return selector;
4585 }
4586
4587 function addCombinator( matcher, combinator, base ) {
4588 var dir = combinator.dir,
4589- checkNonElements = base && dir === "parentNode",
4590+ skip = combinator.next,
4591+ key = skip || dir,
4592+ checkNonElements = base && key === "parentNode",
4593 doneName = done++;
4594
4595 return combinator.first ?
4596+
4597 // Check against closest ancestor/preceding element
4598 function( elem, context, xml ) {
4599- while ( (elem = elem[ dir ]) ) {
4600+ while ( ( elem = elem[ dir ] ) ) {
4601 if ( elem.nodeType === 1 || checkNonElements ) {
4602 return matcher( elem, context, xml );
4603 }
4604 }
4605+ return false;
4606 } :
4607
4608 // Check against all ancestor/preceding elements
4609@@ -2193,7 +2416,7 @@ function addCombinator( matcher, combinator, base ) {
4610
4611 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
4612 if ( xml ) {
4613- while ( (elem = elem[ dir ]) ) {
4614+ while ( ( elem = elem[ dir ] ) ) {
4615 if ( elem.nodeType === 1 || checkNonElements ) {
4616 if ( matcher( elem, context, xml ) ) {
4617 return true;
4618@@ -2201,31 +2424,36 @@ function addCombinator( matcher, combinator, base ) {
4619 }
4620 }
4621 } else {
4622- while ( (elem = elem[ dir ]) ) {
4623+ while ( ( elem = elem[ dir ] ) ) {
4624 if ( elem.nodeType === 1 || checkNonElements ) {
4625- outerCache = elem[ expando ] || (elem[ expando ] = {});
4626+ outerCache = elem[ expando ] || ( elem[ expando ] = {} );
4627
4628 // Support: IE <9 only
4629 // Defend against cloned attroperties (jQuery gh-1709)
4630- uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
4631+ uniqueCache = outerCache[ elem.uniqueID ] ||
4632+ ( outerCache[ elem.uniqueID ] = {} );
4633
4634- if ( (oldCache = uniqueCache[ dir ]) &&
4635+ if ( skip && skip === elem.nodeName.toLowerCase() ) {
4636+ elem = elem[ dir ] || elem;
4637+ } else if ( ( oldCache = uniqueCache[ key ] ) &&
4638 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
4639
4640 // Assign to newCache so results back-propagate to previous elements
4641- return (newCache[ 2 ] = oldCache[ 2 ]);
4642+ return ( newCache[ 2 ] = oldCache[ 2 ] );
4643 } else {
4644+
4645 // Reuse newcache so results back-propagate to previous elements
4646- uniqueCache[ dir ] = newCache;
4647+ uniqueCache[ key ] = newCache;
4648
4649 // A match means we're done; a fail means we have to keep checking
4650- if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
4651+ if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
4652 return true;
4653 }
4654 }
4655 }
4656 }
4657 }
4658+ return false;
4659 };
4660 }
4661
4662@@ -2234,20 +2462,20 @@ function elementMatcher( matchers ) {
4663 function( elem, context, xml ) {
4664 var i = matchers.length;
4665 while ( i-- ) {
4666- if ( !matchers[i]( elem, context, xml ) ) {
4667+ if ( !matchers[ i ]( elem, context, xml ) ) {
4668 return false;
4669 }
4670 }
4671 return true;
4672 } :
4673- matchers[0];
4674+ matchers[ 0 ];
4675 }
4676
4677 function multipleContexts( selector, contexts, results ) {
4678 var i = 0,
4679 len = contexts.length;
4680 for ( ; i < len; i++ ) {
4681- Sizzle( selector, contexts[i], results );
4682+ Sizzle( selector, contexts[ i ], results );
4683 }
4684 return results;
4685 }
4686@@ -2260,7 +2488,7 @@ function condense( unmatched, map, filter, context, xml ) {
4687 mapped = map != null;
4688
4689 for ( ; i < len; i++ ) {
4690- if ( (elem = unmatched[i]) ) {
4691+ if ( ( elem = unmatched[ i ] ) ) {
4692 if ( !filter || filter( elem, context, xml ) ) {
4693 newUnmatched.push( elem );
4694 if ( mapped ) {
4695@@ -2280,14 +2508,18 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
4696 if ( postFinder && !postFinder[ expando ] ) {
4697 postFinder = setMatcher( postFinder, postSelector );
4698 }
4699- return markFunction(function( seed, results, context, xml ) {
4700+ return markFunction( function( seed, results, context, xml ) {
4701 var temp, i, elem,
4702 preMap = [],
4703 postMap = [],
4704 preexisting = results.length,
4705
4706 // Get initial elements from seed or context
4707- elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
4708+ elems = seed || multipleContexts(
4709+ selector || "*",
4710+ context.nodeType ? [ context ] : context,
4711+ []
4712+ ),
4713
4714 // Prefilter to get matcher input, preserving a map for seed-results synchronization
4715 matcherIn = preFilter && ( seed || !selector ) ?
4716@@ -2295,6 +2527,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
4717 elems,
4718
4719 matcherOut = matcher ?
4720+
4721 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
4722 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
4723
4724@@ -2318,8 +2551,8 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
4725 // Un-match failing elements by moving them back to matcherIn
4726 i = temp.length;
4727 while ( i-- ) {
4728- if ( (elem = temp[i]) ) {
4729- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
4730+ if ( ( elem = temp[ i ] ) ) {
4731+ matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
4732 }
4733 }
4734 }
4735@@ -2327,25 +2560,27 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
4736 if ( seed ) {
4737 if ( postFinder || preFilter ) {
4738 if ( postFinder ) {
4739+
4740 // Get the final matcherOut by condensing this intermediate into postFinder contexts
4741 temp = [];
4742 i = matcherOut.length;
4743 while ( i-- ) {
4744- if ( (elem = matcherOut[i]) ) {
4745+ if ( ( elem = matcherOut[ i ] ) ) {
4746+
4747 // Restore matcherIn since elem is not yet a final match
4748- temp.push( (matcherIn[i] = elem) );
4749+ temp.push( ( matcherIn[ i ] = elem ) );
4750 }
4751 }
4752- postFinder( null, (matcherOut = []), temp, xml );
4753+ postFinder( null, ( matcherOut = [] ), temp, xml );
4754 }
4755
4756 // Move matched elements from seed to results to keep them synchronized
4757 i = matcherOut.length;
4758 while ( i-- ) {
4759- if ( (elem = matcherOut[i]) &&
4760- (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
4761+ if ( ( elem = matcherOut[ i ] ) &&
4762+ ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
4763
4764- seed[temp] = !(results[temp] = elem);
4765+ seed[ temp ] = !( results[ temp ] = elem );
4766 }
4767 }
4768 }
4769@@ -2363,14 +2598,14 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
4770 push.apply( results, matcherOut );
4771 }
4772 }
4773- });
4774+ } );
4775 }
4776
4777 function matcherFromTokens( tokens ) {
4778 var checkContext, matcher, j,
4779 len = tokens.length,
4780- leadingRelative = Expr.relative[ tokens[0].type ],
4781- implicitRelative = leadingRelative || Expr.relative[" "],
4782+ leadingRelative = Expr.relative[ tokens[ 0 ].type ],
4783+ implicitRelative = leadingRelative || Expr.relative[ " " ],
4784 i = leadingRelative ? 1 : 0,
4785
4786 // The foundational matcher ensures that elements are reachable from top-level context(s)
4787@@ -2382,38 +2617,43 @@ function matcherFromTokens( tokens ) {
4788 }, implicitRelative, true ),
4789 matchers = [ function( elem, context, xml ) {
4790 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
4791- (checkContext = context).nodeType ?
4792+ ( checkContext = context ).nodeType ?
4793 matchContext( elem, context, xml ) :
4794 matchAnyContext( elem, context, xml ) );
4795+
4796 // Avoid hanging onto element (issue #299)
4797 checkContext = null;
4798 return ret;
4799 } ];
4800
4801 for ( ; i < len; i++ ) {
4802- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
4803- matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
4804+ if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
4805+ matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
4806 } else {
4807- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
4808+ matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
4809
4810 // Return special upon seeing a positional matcher
4811 if ( matcher[ expando ] ) {
4812+
4813 // Find the next relative operator (if any) for proper handling
4814 j = ++i;
4815 for ( ; j < len; j++ ) {
4816- if ( Expr.relative[ tokens[j].type ] ) {
4817+ if ( Expr.relative[ tokens[ j ].type ] ) {
4818 break;
4819 }
4820 }
4821 return setMatcher(
4822 i > 1 && elementMatcher( matchers ),
4823 i > 1 && toSelector(
4824- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
4825- tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
4826+
4827+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
4828+ tokens
4829+ .slice( 0, i - 1 )
4830+ .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
4831 ).replace( rtrim, "$1" ),
4832 matcher,
4833 i < j && matcherFromTokens( tokens.slice( i, j ) ),
4834- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
4835+ j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
4836 j < len && toSelector( tokens )
4837 );
4838 }
4839@@ -2434,28 +2674,40 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
4840 unmatched = seed && [],
4841 setMatched = [],
4842 contextBackup = outermostContext,
4843+
4844 // We must always have either seed elements or outermost context
4845- elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
4846+ elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
4847+
4848 // Use integer dirruns iff this is the outermost matcher
4849- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
4850+ dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
4851 len = elems.length;
4852
4853 if ( outermost ) {
4854- outermostContext = context === document || context || outermost;
4855+
4856+ // Support: IE 11+, Edge 17 - 18+
4857+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
4858+ // two documents; shallow comparisons work.
4859+ // eslint-disable-next-line eqeqeq
4860+ outermostContext = context == document || context || outermost;
4861 }
4862
4863 // Add elements passing elementMatchers directly to results
4864 // Support: IE<9, Safari
4865 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
4866- for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
4867+ for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
4868 if ( byElement && elem ) {
4869 j = 0;
4870- if ( !context && elem.ownerDocument !== document ) {
4871+
4872+ // Support: IE 11+, Edge 17 - 18+
4873+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
4874+ // two documents; shallow comparisons work.
4875+ // eslint-disable-next-line eqeqeq
4876+ if ( !context && elem.ownerDocument != document ) {
4877 setDocument( elem );
4878 xml = !documentIsHTML;
4879 }
4880- while ( (matcher = elementMatchers[j++]) ) {
4881- if ( matcher( elem, context || document, xml) ) {
4882+ while ( ( matcher = elementMatchers[ j++ ] ) ) {
4883+ if ( matcher( elem, context || document, xml ) ) {
4884 results.push( elem );
4885 break;
4886 }
4887@@ -2467,8 +2719,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
4888
4889 // Track unmatched elements for set filters
4890 if ( bySet ) {
4891+
4892 // They will have gone through all possible matchers
4893- if ( (elem = !matcher && elem) ) {
4894+ if ( ( elem = !matcher && elem ) ) {
4895 matchedCount--;
4896 }
4897
4898@@ -2492,16 +2745,17 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
4899 // numerically zero.
4900 if ( bySet && i !== matchedCount ) {
4901 j = 0;
4902- while ( (matcher = setMatchers[j++]) ) {
4903+ while ( ( matcher = setMatchers[ j++ ] ) ) {
4904 matcher( unmatched, setMatched, context, xml );
4905 }
4906
4907 if ( seed ) {
4908+
4909 // Reintegrate element matches to eliminate the need for sorting
4910 if ( matchedCount > 0 ) {
4911 while ( i-- ) {
4912- if ( !(unmatched[i] || setMatched[i]) ) {
4913- setMatched[i] = pop.call( results );
4914+ if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
4915+ setMatched[ i ] = pop.call( results );
4916 }
4917 }
4918 }
4919@@ -2542,13 +2796,14 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
4920 cached = compilerCache[ selector + " " ];
4921
4922 if ( !cached ) {
4923+
4924 // Generate a function of recursive functions that can be used to check each element
4925 if ( !match ) {
4926 match = tokenize( selector );
4927 }
4928 i = match.length;
4929 while ( i-- ) {
4930- cached = matcherFromTokens( match[i] );
4931+ cached = matcherFromTokens( match[ i ] );
4932 if ( cached[ expando ] ) {
4933 setMatchers.push( cached );
4934 } else {
4935@@ -2557,7 +2812,10 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
4936 }
4937
4938 // Cache the compiled function
4939- cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
4940+ cached = compilerCache(
4941+ selector,
4942+ matcherFromGroupMatchers( elementMatchers, setMatchers )
4943+ );
4944
4945 // Save selector and tokenization
4946 cached.selector = selector;
4947@@ -2577,7 +2835,7 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
4948 select = Sizzle.select = function( selector, context, results, seed ) {
4949 var i, tokens, token, type, find,
4950 compiled = typeof selector === "function" && selector,
4951- match = !seed && tokenize( (selector = compiled.selector || selector) );
4952+ match = !seed && tokenize( ( selector = compiled.selector || selector ) );
4953
4954 results = results || [];
4955
4956@@ -2586,12 +2844,12 @@ select = Sizzle.select = function( selector, context, results, seed ) {
4957 if ( match.length === 1 ) {
4958
4959 // Reduce context if the leading compound selector is an ID
4960- tokens = match[0] = match[0].slice( 0 );
4961- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
4962- support.getById && context.nodeType === 9 && documentIsHTML &&
4963- Expr.relative[ tokens[1].type ] ) {
4964+ tokens = match[ 0 ] = match[ 0 ].slice( 0 );
4965+ if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
4966+ context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
4967
4968- context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
4969+ context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
4970+ .replace( runescape, funescape ), context ) || [] )[ 0 ];
4971 if ( !context ) {
4972 return results;
4973
4974@@ -2604,20 +2862,22 @@ select = Sizzle.select = function( selector, context, results, seed ) {
4975 }
4976
4977 // Fetch a seed set for right-to-left matching
4978- i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
4979+ i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
4980 while ( i-- ) {
4981- token = tokens[i];
4982+ token = tokens[ i ];
4983
4984 // Abort if we hit a combinator
4985- if ( Expr.relative[ (type = token.type) ] ) {
4986+ if ( Expr.relative[ ( type = token.type ) ] ) {
4987 break;
4988 }
4989- if ( (find = Expr.find[ type ]) ) {
4990+ if ( ( find = Expr.find[ type ] ) ) {
4991+
4992 // Search, expanding context for leading sibling combinators
4993- if ( (seed = find(
4994- token.matches[0].replace( runescape, funescape ),
4995- rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
4996- )) ) {
4997+ if ( ( seed = find(
4998+ token.matches[ 0 ].replace( runescape, funescape ),
4999+ rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
5000+ context
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches