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
diff --git a/debian/changelog b/debian/changelog
index 23ac026..070e696 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1horizon (4:23.2.0+git2023090509.7896fd8c-0ubuntu1) mantic; urgency=medium
2
3 * New upstream snapshot for OpenStack Bobcat.
4 * Refresh xstatic assets.
5
6 -- Corey Bryant <corey.bryant@canonical.com> Tue, 05 Sep 2023 09:20:32 -0400
7
1horizon (4:23.2.0+git2023071214.e6f39871-0ubuntu1) mantic; urgency=medium8horizon (4:23.2.0+git2023071214.e6f39871-0ubuntu1) mantic; urgency=medium
29
3 * d/gbp.conf, .launchpad.yaml: Sync from cloud-archive-tools for10 * d/gbp.conf, .launchpad.yaml: Sync from cloud-archive-tools for
diff --git a/xstatic/pkg/angular_fileupload/__init__.py b/xstatic/pkg/angular_fileupload/__init__.py
index 43c9db9..b812f41 100644
--- a/xstatic/pkg/angular_fileupload/__init__.py
+++ b/xstatic/pkg/angular_fileupload/__init__.py
@@ -11,7 +11,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
11 # please use a all-lowercase valid python11 # please use a all-lowercase valid python
12 # package name12 # package name
1313
14VERSION = '12.0.4' # version of the packaged files, please use the upstream14VERSION = '12.2.13' # version of the packaged files, please use the upstream
15 # version number15 # version number
16BUILD = '0' # our package build number, so we can release new builds16BUILD = '0' # our package build number, so we can release new builds
17 # with fixes for xstatic stuff.17 # with fixes for xstatic stuff.
@@ -24,8 +24,8 @@ CLASSIFIERS = []
24KEYWORDS = '%s xstatic' % NAME24KEYWORDS = '%s xstatic' % NAME
2525
26# XStatic-* package maintainer:26# XStatic-* package maintainer:
27MAINTAINER = 'Rob Cresswell'27MAINTAINER = 'Radomir Dopieralski'
28MAINTAINER_EMAIL = 'robert.cresswell@outlook.com'28MAINTAINER_EMAIL = 'openstack@sheep.art.pl'
2929
30# this refers to the project homepage of the stuff we packaged:30# this refers to the project homepage of the stuff we packaged:
31HOMEPAGE = 'https://github.com/danialfarid/angular-file-upload'31HOMEPAGE = 'https://github.com/danialfarid/angular-file-upload'
diff --git a/xstatic/pkg/angular_fileupload/data/FileAPI.min.js b/xstatic/pkg/angular_fileupload/data/FileAPI.min.js
index c7b0266..2afb71e 100644
--- a/xstatic/pkg/angular_fileupload/data/FileAPI.min.js
+++ b/xstatic/pkg/angular_fileupload/data/FileAPI.min.js
@@ -1,4 +1,4 @@
1/*! 12.0.4 */1/*! 12.2.13 */
2/*! FileAPI 2.0.7 - BSD | git://github.com/mailru/FileAPI.git2/*! FileAPI 2.0.7 - BSD | git://github.com/mailru/FileAPI.git
3 * 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.3 * 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.
4 */4 */
diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js
index fca2e64..e342351 100644
--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js
+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js
@@ -1,9 +1,9 @@
1/**!1/**!
2 * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,2 * AngularJS file upload directives and services. Supports: file upload/drop/paste, resume, cancel/abort,
3 * progress, resize, thumbnail, preview, validation and CORS3 * progress, resize, thumbnail, preview, validation and CORS
4 * FileAPI Flash shim for old browsers not supporting FormData4 * FileAPI Flash shim for old browsers not supporting FormData
5 * @author Danial <danial.farid@gmail.com>5 * @author Danial <danial.farid@gmail.com>
6 * @version 12.0.46 * @version 12.2.13
7 */7 */
88
9(function () {9(function () {
@@ -424,7 +424,7 @@ if (!window.FileReader) {
424 * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,424 * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
425 * progress, resize, thumbnail, preview, validation and CORS425 * progress, resize, thumbnail, preview, validation and CORS
426 * @author Danial <danial.farid@gmail.com>426 * @author Danial <danial.farid@gmail.com>
427 * @version 12.0.4427 * @version 12.2.13
428 */428 */
429429
430if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {430if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
@@ -445,7 +445,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
445445
446var ngFileUpload = angular.module('ngFileUpload', []);446var ngFileUpload = angular.module('ngFileUpload', []);
447447
448ngFileUpload.version = '12.0.4';448ngFileUpload.version = '12.2.13';
449449
450ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {450ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
451 var upload = this;451 var upload = this;
@@ -512,10 +512,12 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
512 function uploadWithAngular() {512 function uploadWithAngular() {
513 $http(config).then(function (r) {513 $http(config).then(function (r) {
514 if (resumeSupported && config._chunkSize && !config._finished && config._file) {514 if (resumeSupported && config._chunkSize && !config._finished && config._file) {
515 var fileSize = config._file && config._file.size || 0;
515 notifyProgress({516 notifyProgress({
516 loaded: config._end,517 loaded: Math.min(config._end, fileSize),
517 total: config._file && config._file.size,518 total: fileSize,
518 config: config, type: 'progress'519 config: config,
520 type: 'progress'
519 }521 }
520 );522 );
521 upload.upload(config, true);523 upload.upload(config, true);
@@ -554,6 +556,9 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
554 } else if (config.resumeSize) {556 } else if (config.resumeSize) {
555 config.resumeSize().then(function (size) {557 config.resumeSize().then(function (size) {
556 config._start = size;558 config._start = size;
559 if (config._chunkSize) {
560 config._end = config._start + config._chunkSize;
561 }
557 uploadWithAngular();562 uploadWithAngular();
558 }, function (e) {563 }, function (e) {
559 throw e;564 throw e;
@@ -607,9 +612,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
607 };612 };
608613
609 upload.promisesCount++;614 upload.promisesCount++;
610 promise['finally'](function () {615 if (promise['finally'] && promise['finally'] instanceof Function) {
611 upload.promisesCount--;616 promise['finally'](function () {
612 });617 upload.promisesCount--;
618 });
619 }
613 return promise;620 return promise;
614 }621 }
615622
@@ -793,9 +800,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
793 var arrayBufferView = new Uint8Array(resp.data);800 var arrayBufferView = new Uint8Array(resp.data);
794 var type = resp.headers('content-type') || 'image/WebP';801 var type = resp.headers('content-type') || 'image/WebP';
795 var blob = new window.Blob([arrayBufferView], {type: type});802 var blob = new window.Blob([arrayBufferView], {type: type});
803 var matches = url.match(/.*\/(.+?)(\?.*)?$/);
804 if (matches.length > 1) {
805 blob.name = matches[1];
806 }
796 defer.resolve(blob);807 defer.resolve(blob);
797 //var split = type.split('[/;]');
798 //blob.name = url.substring(0, 150).replace(/\W+/g, '') + '.' + (split.length > 1 ? split[1] : 'jpg');
799 }, function (e) {808 }, function (e) {
800 defer.reject(e);809 defer.reject(e);
801 });810 });
@@ -843,7 +852,7 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
843 };852 };
844853
845 upload.shouldUpdateOn = function (type, attr, scope) {854 upload.shouldUpdateOn = function (type, attr, scope) {
846 var modelOptions = upload.attrGetter('ngModelOptions', attr, scope);855 var modelOptions = upload.attrGetter('ngfModelOptions', attr, scope);
847 if (modelOptions && modelOptions.updateOn) {856 if (modelOptions && modelOptions.updateOn) {
848 return modelOptions.updateOn.split(' ').indexOf(type) > -1;857 return modelOptions.updateOn.split(' ').indexOf(type) > -1;
849 }858 }
@@ -893,13 +902,13 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
893 return $q.all(promises);902 return $q.all(promises);
894 }903 }
895904
896 function resize(files, attr, scope) {905 function resizeFile(files, attr, scope, ngModel) {
897 var resizeVal = upload.attrGetter('ngfResize', attr, scope);906 var resizeVal = upload.attrGetter('ngfResize', attr, scope);
898 if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise();907 if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise();
899 if (resizeVal instanceof Function) {908 if (resizeVal instanceof Function) {
900 var defer = $q.defer();909 var defer = $q.defer();
901 resizeVal(files).then(function (p) {910 return resizeVal(files).then(function (p) {
902 resizeWithParams(p, files, attr, scope).then(function (r) {911 resizeWithParams(p, files, attr, scope, ngModel).then(function (r) {
903 defer.resolve(r);912 defer.resolve(r);
904 }, function (e) {913 }, function (e) {
905 defer.reject(e);914 defer.reject(e);
@@ -908,27 +917,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
908 defer.reject(e);917 defer.reject(e);
909 });918 });
910 } else {919 } else {
911 return resizeWithParams(resizeVal, files, attr, scope);920 return resizeWithParams(resizeVal, files, attr, scope, ngModel);
912 }921 }
913 }922 }
914923
915 function resizeWithParams(param, files, attr, scope) {924 function resizeWithParams(params, files, attr, scope, ngModel) {
916 var promises = [upload.emptyPromise()];925 var promises = [upload.emptyPromise()];
917926
918 function handleFile(f, i) {927 function handleFile(f, i) {
919 if (f.type.indexOf('image') === 0) {928 if (f.type.indexOf('image') === 0) {
920 if (param.pattern && !upload.validatePattern(f, param.pattern)) return;929 if (params.pattern && !upload.validatePattern(f, params.pattern)) return;
921 var promise = upload.resize(f, param.width, param.height, param.quality,930 params.resizeIf = function (width, height) {
922 param.type, param.ratio, param.centerCrop, function (width, height) {931 return upload.attrGetter('ngfResizeIf', attr, scope,
923 return upload.attrGetter('ngfResizeIf', attr, scope,932 {$width: width, $height: height, $file: f});
924 {$width: width, $height: height, $file: f});933 };
925 }, param.restoreExif !== false);934 var promise = upload.resize(f, params);
926 promises.push(promise);935 promises.push(promise);
927 promise.then(function (resizedFile) {936 promise.then(function (resizedFile) {
928 files.splice(i, 1, resizedFile);937 files.splice(i, 1, resizedFile);
929 }, function (e) {938 }, function (e) {
930 f.$error = 'resize';939 f.$error = 'resize';
940 (f.$errorMessages = (f.$errorMessages || {})).resize = true;
931 f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name);941 f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name);
942 ngModel.$ngfValidations.push({name: 'resize', valid: false});
943 upload.applyModelValidation(ngModel, files);
932 });944 });
933 }945 }
934 }946 }
@@ -1015,18 +1027,6 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
1015 return angular.isArray(v) ? v : [v];1027 return angular.isArray(v) ? v : [v];
1016 }1028 }
10171029
1018 function separateInvalids() {
1019 valids = [];
1020 invalids = [];
1021 angular.forEach(allNewFiles, function (file) {
1022 if (file.$error) {
1023 invalids.push(file);
1024 } else {
1025 valids.push(file);
1026 }
1027 });
1028 }
1029
1030 function resizeAndUpdate() {1030 function resizeAndUpdate() {
1031 function updateModel() {1031 function updateModel() {
1032 $timeout(function () {1032 $timeout(function () {
@@ -1036,17 +1036,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
1036 }, options && options.debounce ? options.debounce.change || options.debounce : 0);1036 }, options && options.debounce ? options.debounce.change || options.debounce : 0);
1037 }1037 }
10381038
1039 resize(validateAfterResize ? allNewFiles : valids, attr, scope).then(function () {1039 var resizingFiles = validateAfterResize ? allNewFiles : valids;
1040 resizeFile(resizingFiles, attr, scope, ngModel).then(function () {
1040 if (validateAfterResize) {1041 if (validateAfterResize) {
1041 upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () {1042 upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
1042 separateInvalids();1043 .then(function (validationResult) {
1043 updateModel();1044 valids = validationResult.validsFiles;
1044 });1045 invalids = validationResult.invalidsFiles;
1046 updateModel();
1047 });
1045 } else {1048 } else {
1046 updateModel();1049 updateModel();
1047 }1050 }
1048 }, function (e) {1051 }, function () {
1049 throw 'Could not resize files ' + e;1052 for (var i = 0; i < resizingFiles.length; i++) {
1053 var f = resizingFiles[i];
1054 if (f.$error === 'resize') {
1055 var index = valids.indexOf(f);
1056 if (index > -1) {
1057 valids.splice(index, 1);
1058 invalids.push(f);
1059 }
1060 updateModel();
1061 }
1062 }
1050 });1063 });
1051 }1064 }
10521065
@@ -1076,13 +1089,15 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
10761089
1077 var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope);1090 var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope);
10781091
1079 var options = upload.attrGetter('ngModelOptions', attr, scope);1092 var options = upload.attrGetter('ngfModelOptions', attr, scope);
1080 upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () {1093 upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
1094 .then(function (validationResult) {
1081 if (noDelay) {1095 if (noDelay) {
1082 update(allNewFiles, [], files, dupFiles, isSingleModel);1096 update(allNewFiles, [], files, dupFiles, isSingleModel);
1083 } else {1097 } else {
1084 if ((!options || !options.allowInvalid) && !validateAfterResize) {1098 if ((!options || !options.allowInvalid) && !validateAfterResize) {
1085 separateInvalids();1099 valids = validationResult.validFiles;
1100 invalids = validationResult.invalidFiles;
1086 } else {1101 } else {
1087 valids = allNewFiles;1102 valids = allNewFiles;
1088 }1103 }
@@ -1119,7 +1134,7 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1119 /** @namespace attr.ngfSelect */1134 /** @namespace attr.ngfSelect */
1120 /** @namespace attr.ngfChange */1135 /** @namespace attr.ngfChange */
1121 /** @namespace attr.ngModel */1136 /** @namespace attr.ngModel */
1122 /** @namespace attr.ngModelOptions */1137 /** @namespace attr.ngfModelOptions */
1123 /** @namespace attr.ngfMultiple */1138 /** @namespace attr.ngfMultiple */
1124 /** @namespace attr.ngfCapture */1139 /** @namespace attr.ngfCapture */
1125 /** @namespace attr.ngfValidate */1140 /** @namespace attr.ngfValidate */
@@ -1139,6 +1154,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1139 function changeFn(evt) {1154 function changeFn(evt) {
1140 if (upload.shouldUpdateOn('change', attr, scope)) {1155 if (upload.shouldUpdateOn('change', attr, scope)) {
1141 var fileList = evt.__files_ || (evt.target && evt.target.files), files = [];1156 var fileList = evt.__files_ || (evt.target && evt.target.files), files = [];
1157 /* Handle duplicate call in IE11 */
1158 if (!fileList) return;
1142 for (var i = 0; i < fileList.length; i++) {1159 for (var i = 0; i < fileList.length; i++) {
1143 files.push(fileList[i]);1160 files.push(fileList[i]);
1144 }1161 }
@@ -1150,31 +1167,39 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1150 upload.registerModelChangeValidator(ngModel, attr, scope);1167 upload.registerModelChangeValidator(ngModel, attr, scope);
11511168
1152 var unwatches = [];1169 var unwatches = [];
1153 unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () {1170 if (attrGetter('ngfMultiple')) {
1154 fileElem.attr('multiple', attrGetter('ngfMultiple', scope));1171 unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () {
1155 }));1172 fileElem.attr('multiple', attrGetter('ngfMultiple', scope));
1156 unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () {1173 }));
1157 fileElem.attr('capture', attrGetter('ngfCapture', scope));1174 }
1158 }));1175 if (attrGetter('ngfCapture')) {
1159 unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () {1176 unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () {
1160 fileElem.attr('accept', attrGetter('ngfAccept', scope));1177 fileElem.attr('capture', attrGetter('ngfCapture', scope));
1161 }));1178 }));
1162 attr.$observe('accept', function () {1179 }
1180 if (attrGetter('ngfAccept')) {
1181 unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () {
1182 fileElem.attr('accept', attrGetter('ngfAccept', scope));
1183 }));
1184 }
1185 unwatches.push(attr.$observe('accept', function () {
1163 fileElem.attr('accept', attrGetter('accept'));1186 fileElem.attr('accept', attrGetter('accept'));
1164 });1187 }));
1165 unwatches.push(function () {1188 function bindAttrToFileInput(fileElem, label) {
1166 if (attr.$$observers) delete attr.$$observers.accept;1189 function updateId(val) {
1167 });1190 fileElem.attr('id', 'ngf-' + val);
1168 function bindAttrToFileInput(fileElem) {1191 label.attr('id', 'ngf-label-' + val);
1169 if (elem !== fileElem) {1192 }
1170 for (var i = 0; i < elem[0].attributes.length; i++) {1193
1171 var attribute = elem[0].attributes[i];1194 for (var i = 0; i < elem[0].attributes.length; i++) {
1172 if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') {1195 var attribute = elem[0].attributes[i];
1173 if (attribute.value == null || attribute.value === '') {1196 if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') {
1174 if (attribute.name === 'required') attribute.value = 'required';1197 if (attribute.name === 'id') {
1175 if (attribute.name === 'multiple') attribute.value = 'multiple';1198 updateId(attribute.value);
1176 }1199 unwatches.push(attr.$observe('id', updateId));
1177 fileElem.attr(attribute.name, attribute.name === 'id' ? 'ngf-' + attribute.value : attribute.value);1200 } else {
1201 fileElem.attr(attribute.name, (!attribute.value && (attribute.name === 'required' ||
1202 attribute.name === 'multiple')) ? attribute.name : attribute.value);
1178 }1203 }
1179 }1204 }
1180 }1205 }
@@ -1187,12 +1212,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
11871212
1188 var fileElem = angular.element('<input type="file">');1213 var fileElem = angular.element('<input type="file">');
11891214
1190 bindAttrToFileInput(fileElem);
1191
1192 var label = angular.element('<label>upload</label>');1215 var label = angular.element('<label>upload</label>');
1193 label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden')1216 label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden')
1194 .css('width', '0px').css('height', '0px').css('border', 'none')1217 .css('width', '0px').css('height', '0px').css('border', 'none')
1195 .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1');1218 .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1');
1219 bindAttrToFileInput(fileElem, label);
1220
1196 generatedElems.push({el: elem, ref: label});1221 generatedElems.push({el: elem, ref: label});
11971222
1198 document.body.appendChild(label.append(fileElem)[0]);1223 document.body.appendChild(label.append(fileElem)[0]);
@@ -1200,13 +1225,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1200 return fileElem;1225 return fileElem;
1201 }1226 }
12021227
1203 var initialTouchStartY = 0;
1204
1205 function clickHandler(evt) {1228 function clickHandler(evt) {
1206 if (elem.attr('disabled')) return false;1229 if (elem.attr('disabled')) return false;
1207 if (attrGetter('ngfSelectDisabled', scope)) return;1230 if (attrGetter('ngfSelectDisabled', scope)) return;
12081231
1209 var r = handleTouch(evt);1232 var r = detectSwipe(evt);
1233 // prevent the click if it is a swipe
1210 if (r != null) return r;1234 if (r != null) return r;
12111235
1212 resetModel(evt);1236 resetModel(evt);
@@ -1218,7 +1242,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1218 document.body.appendChild(fileElem.parent()[0]);1242 document.body.appendChild(fileElem.parent()[0]);
1219 fileElem.bind('change', changeFn);1243 fileElem.bind('change', changeFn);
1220 }1244 }
1221 } catch(e){/*ignore*/}1245 } catch (e) {/*ignore*/
1246 }
12221247
1223 if (isDelayedClickSupported(navigator.userAgent)) {1248 if (isDelayedClickSupported(navigator.userAgent)) {
1224 setTimeout(function () {1249 setTimeout(function () {
@@ -1231,19 +1256,30 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1231 return false;1256 return false;
1232 }1257 }
12331258
1234 function handleTouch(evt) {
1235 var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches);
1236 if (evt.type === 'touchstart') {
1237 initialTouchStartY = touches ? touches[0].clientY : 0;
1238 return true; // don't block event default
1239 } else {
1240 evt.stopPropagation();
1241 evt.preventDefault();
12421259
1243 // prevent scroll from triggering event1260 var initialTouchStartY = 0;
1244 if (evt.type === 'touchend') {1261 var initialTouchStartX = 0;
1245 var currentLocation = touches ? touches[0].clientY : 0;1262
1246 if (Math.abs(currentLocation - initialTouchStartY) > 20) return false;1263 function detectSwipe(evt) {
1264 var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches);
1265 if (touches) {
1266 if (evt.type === 'touchstart') {
1267 initialTouchStartX = touches[0].clientX;
1268 initialTouchStartY = touches[0].clientY;
1269 return true; // don't block event default
1270 } else {
1271 // prevent scroll from triggering event
1272 if (evt.type === 'touchend') {
1273 var currentX = touches[0].clientX;
1274 var currentY = touches[0].clientY;
1275 if ((Math.abs(currentX - initialTouchStartX) > 20) ||
1276 (Math.abs(currentY - initialTouchStartY) > 20)) {
1277 evt.stopPropagation();
1278 evt.preventDefault();
1279 return false;
1280 }
1281 }
1282 return true;
1247 }1283 }
1248 }1284 }
1249 }1285 }
@@ -1474,14 +1510,19 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1474 var size = resizeParams;1510 var size = resizeParams;
1475 if (directiveName === 'ngfThumbnail') {1511 if (directiveName === 'ngfThumbnail') {
1476 if (!size) {1512 if (!size) {
1477 size = {width: elem[0].clientWidth, height: elem[0].clientHeight};1513 size = {
1514 width: elem[0].naturalWidth || elem[0].clientWidth,
1515 height: elem[0].naturalHeight || elem[0].clientHeight
1516 };
1478 }1517 }
1479 if (size.width === 0 && window.getComputedStyle) {1518 if (size.width === 0 && window.getComputedStyle) {
1480 var style = getComputedStyle(elem[0]);1519 var style = getComputedStyle(elem[0]);
1481 size = {1520 if (style.width && style.width.indexOf('px') > -1 && style.height && style.height.indexOf('px') > -1) {
1482 width: parseInt(style.width.slice(0, -2)),1521 size = {
1483 height: parseInt(style.height.slice(0, -2))1522 width: parseInt(style.width.slice(0, -2)),
1484 };1523 height: parseInt(style.height.slice(0, -2))
1524 };
1525 }
1485 }1526 }
1486 }1527 }
14871528
@@ -1496,7 +1537,11 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1496 if (file && file.type && file.type.search(getTagType(elem[0])) === 0 &&1537 if (file && file.type && file.type.search(getTagType(elem[0])) === 0 &&
1497 (!isBackground || file.type.indexOf('image') === 0)) {1538 (!isBackground || file.type.indexOf('image') === 0)) {
1498 if (size && Upload.isResizeSupported()) {1539 if (size && Upload.isResizeSupported()) {
1499 Upload.resize(file, size.width, size.height, size.quality).then(1540 size.resizeIf = function (width, height) {
1541 return Upload.attrGetter('ngfResizeIf', attr, scope,
1542 {$width: width, $height: height, $file: file});
1543 };
1544 Upload.resize(file, size).then(
1500 function (f) {1545 function (f) {
1501 constructDataUrl(f);1546 constructDataUrl(f);
1502 }, function (e) {1547 }, function (e) {
@@ -1558,8 +1603,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1558 }]);1603 }]);
15591604
1560 ngFileUpload.config(['$compileProvider', function ($compileProvider) {1605 ngFileUpload.config(['$compileProvider', function ($compileProvider) {
1561 if ($compileProvider.imgSrcSanitizationWhitelist) $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/);1606 if ($compileProvider.imgSrcSanitizationWhitelist) $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
1562 if ($compileProvider.aHrefSanitizationWhitelist) $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/);1607 if ($compileProvider.aHrefSanitizationWhitelist) $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
1563 }]);1608 }]);
15641609
1565 ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) {1610 ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) {
@@ -1651,13 +1696,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1651 if (ngModel) {1696 if (ngModel) {
1652 ngModel.$formatters.push(function (files) {1697 ngModel.$formatters.push(function (files) {
1653 if (ngModel.$dirty) {1698 if (ngModel.$dirty) {
1699 var filesArray = files;
1654 if (files && !angular.isArray(files)) {1700 if (files && !angular.isArray(files)) {
1655 files = [files];1701 filesArray = [files];
1656 }1702 }
1657 upload.validate(files, 0, ngModel, attr, scope).then(function () {1703 upload.validate(filesArray, 0, ngModel, attr, scope).then(function () {
1658 upload.applyModelValidation(ngModel, files);1704 upload.applyModelValidation(ngModel, filesArray);
1659 });1705 });
1660 }1706 }
1707 return files;
1661 });1708 });
1662 }1709 }
1663 };1710 };
@@ -1707,11 +1754,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1707 return upload.attrGetter(name, attr, scope, params);1754 return upload.attrGetter(name, attr, scope, params);
1708 };1755 };
17091756
1757 var ignoredErrors = (upload.attrGetter('ngfIgnoreInvalid', attr, scope) || '').split(' ');
1758 var runAllValidation = upload.attrGetter('ngfRunAllValidations', attr, scope);
1759
1710 if (files == null || files.length === 0) {1760 if (files == null || files.length === 0) {
1711 return upload.emptyPromise(ngModel);1761 return upload.emptyPromise({'validFiles': files, 'invalidFiles': []});
1712 }1762 }
17131763
1714 files = files.length === undefined ? [files] : files.slice(0);1764 files = files.length === undefined ? [files] : files.slice(0);
1765 var invalidFiles = [];
17151766
1716 function validateSync(name, validationName, fn) {1767 function validateSync(name, validationName, fn) {
1717 if (files) {1768 if (files) {
@@ -1722,11 +1773,20 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1722 var val = upload.getValidationAttr(attr, scope, name, validationName, file);1773 var val = upload.getValidationAttr(attr, scope, name, validationName, file);
1723 if (val != null) {1774 if (val != null) {
1724 if (!fn(file, val, i)) {1775 if (!fn(file, val, i)) {
1725 file.$error = name;1776 if (ignoredErrors.indexOf(name) === -1) {
1726 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;1777 file.$error = name;
1727 file.$errorParam = val;1778 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
1728 files.splice(i, 1);1779 file.$errorParam = val;
1729 valid = false;1780 if (invalidFiles.indexOf(file) === -1) {
1781 invalidFiles.push(file);
1782 }
1783 if (!runAllValidation) {
1784 files.splice(i, 1);
1785 }
1786 valid = false;
1787 } else {
1788 files.splice(i, 1);
1789 }
1730 }1790 }
1731 }1791 }
1732 }1792 }
@@ -1737,9 +1797,6 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1737 }1797 }
1738 }1798 }
17391799
1740 validateSync('maxFiles', null, function (file, val, i) {
1741 return prevLength + i < val;
1742 });
1743 validateSync('pattern', null, upload.validatePattern);1800 validateSync('pattern', null, upload.validatePattern);
1744 validateSync('minSize', 'size.min', function (file, val) {1801 validateSync('minSize', 'size.min', function (file, val) {
1745 return file.size + 0.1 >= upload.translateScalars(val);1802 return file.size + 0.1 >= upload.translateScalars(val);
@@ -1762,44 +1819,58 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1762 });1819 });
17631820
1764 if (!files.length) {1821 if (!files.length) {
1765 return upload.emptyPromise(ngModel, ngModel.$ngfValidations);1822 return upload.emptyPromise({'validFiles': [], 'invalidFiles': invalidFiles});
1766 }1823 }
17671824
1768 function validateAsync(name, validationName, type, asyncFn, fn) {1825 function validateAsync(name, validationName, type, asyncFn, fn) {
1769 function resolveResult(defer, file, val) {1826 function resolveResult(defer, file, val) {
1770 if (val != null) {1827 function resolveInternal(fn) {
1771 asyncFn(file, val).then(function (d) {1828 if (fn()) {
1772 if (!fn(d, val)) {1829 if (ignoredErrors.indexOf(name) === -1) {
1773 file.$error = name;1830 file.$error = name;
1774 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;1831 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
1775 file.$errorParam = val;1832 file.$errorParam = val;
1776 defer.reject();1833 if (invalidFiles.indexOf(file) === -1) {
1834 invalidFiles.push(file);
1835 }
1836 if (!runAllValidation) {
1837 var i = files.indexOf(file);
1838 if (i > -1) files.splice(i, 1);
1839 }
1840 defer.resolve(false);
1777 } else {1841 } else {
1778 defer.resolve();1842 var j = files.indexOf(file);
1843 if (j > -1) files.splice(j, 1);
1844 defer.resolve(true);
1779 }1845 }
1846 } else {
1847 defer.resolve(true);
1848 }
1849 }
1850
1851 if (val != null) {
1852 asyncFn(file, val).then(function (d) {
1853 resolveInternal(function () {
1854 return !fn(d, val);
1855 });
1780 }, function () {1856 }, function () {
1781 if (attrGetter('ngfValidateForce', {$file: file})) {1857 resolveInternal(function () {
1782 file.$error = name;1858 return attrGetter('ngfValidateForce', {$file: file});
1783 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;1859 });
1784 file.$errorParam = val;
1785 defer.reject();
1786 } else {
1787 defer.resolve();
1788 }
1789 });1860 });
1790 } else {1861 } else {
1791 defer.resolve();1862 defer.resolve(true);
1792 }1863 }
1793 }1864 }
17941865
1795 var promises = [upload.emptyPromise()];1866 var promises = [upload.emptyPromise(true)];
1796 if (files) {1867 if (files) {
1797 files = files.length === undefined ? [files] : files;1868 files = files.length === undefined ? [files] : files;
1798 angular.forEach(files, function (file) {1869 angular.forEach(files, function (file) {
1799 var defer = $q.defer();1870 var defer = $q.defer();
1800 promises.push(defer.promise);1871 promises.push(defer.promise);
1801 if (type && (file.type == null || file.type.search(type) !== 0)) {1872 if (type && (file.type == null || file.type.search(type) !== 0)) {
1802 defer.resolve();1873 defer.resolve(true);
1803 return;1874 return;
1804 }1875 }
1805 if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) {1876 if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) {
@@ -1807,96 +1878,120 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1807 resolveResult(defer, file,1878 resolveResult(defer, file,
1808 attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height}));1879 attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height}));
1809 }, function () {1880 }, function () {
1810 defer.reject();1881 defer.resolve(false);
1811 });1882 });
1812 } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) {1883 } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) {
1813 upload.mediaDuration(file).then(function (d) {1884 upload.mediaDuration(file).then(function (d) {
1814 resolveResult(defer, file,1885 resolveResult(defer, file,
1815 attrGetter('ngfDuration', {$file: file, $duration: d}));1886 attrGetter('ngfDuration', {$file: file, $duration: d}));
1816 }, function () {1887 }, function () {
1817 defer.reject();1888 defer.resolve(false);
1818 });1889 });
1819 } else {1890 } else {
1820 resolveResult(defer, file,1891 resolveResult(defer, file,
1821 upload.getValidationAttr(attr, scope, name, validationName, file));1892 upload.getValidationAttr(attr, scope, name, validationName, file));
1822 }1893 }
1823 });1894 });
1824 return $q.all(promises).then(function () {
1825 ngModel.$ngfValidations.push({name: name, valid: true});
1826 }, function () {
1827 ngModel.$ngfValidations.push({name: name, valid: false});
1828 });
1829 }1895 }
1896 var deffer = $q.defer();
1897 $q.all(promises).then(function (values) {
1898 var isValid = true;
1899 for (var i = 0; i < values.length; i++) {
1900 if (!values[i]) {
1901 isValid = false;
1902 break;
1903 }
1904 }
1905 ngModel.$ngfValidations.push({name: name, valid: isValid});
1906 deffer.resolve(isValid);
1907 });
1908 return deffer.promise;
1830 }1909 }
18311910
1832 var deffer = $q.defer();1911 var deffer = $q.defer();
1833 var promises = [];1912 var promises = [];
18341913
1835 promises.push(upload.happyPromise(validateAsync('maxHeight', 'height.max', /image/,1914 promises.push(validateAsync('maxHeight', 'height.max', /image/,
1836 this.imageDimensions, function (d, val) {1915 this.imageDimensions, function (d, val) {
1837 return d.height <= val;1916 return d.height <= val;
1838 })));1917 }));
1839 promises.push(upload.happyPromise(validateAsync('minHeight', 'height.min', /image/,1918 promises.push(validateAsync('minHeight', 'height.min', /image/,
1840 this.imageDimensions, function (d, val) {1919 this.imageDimensions, function (d, val) {
1841 return d.height >= val;1920 return d.height >= val;
1842 })));1921 }));
1843 promises.push(upload.happyPromise(validateAsync('maxWidth', 'width.max', /image/,1922 promises.push(validateAsync('maxWidth', 'width.max', /image/,
1844 this.imageDimensions, function (d, val) {1923 this.imageDimensions, function (d, val) {
1845 return d.width <= val;1924 return d.width <= val;
1846 })));1925 }));
1847 promises.push(upload.happyPromise(validateAsync('minWidth', 'width.min', /image/,1926 promises.push(validateAsync('minWidth', 'width.min', /image/,
1848 this.imageDimensions, function (d, val) {1927 this.imageDimensions, function (d, val) {
1849 return d.width >= val;1928 return d.width >= val;
1850 })));1929 }));
1851 promises.push(upload.happyPromise(validateAsync('dimensions', null, /image/,1930 promises.push(validateAsync('dimensions', null, /image/,
1852 function (file, val) {1931 function (file, val) {
1853 return upload.emptyPromise(val);1932 return upload.emptyPromise(val);
1854 }, function (r) {1933 }, function (r) {
1855 return r;1934 return r;
1856 })));1935 }));
1857 promises.push(upload.happyPromise(validateAsync('ratio', null, /image/,1936 promises.push(validateAsync('ratio', null, /image/,
1858 this.imageDimensions, function (d, val) {1937 this.imageDimensions, function (d, val) {
1859 var split = val.toString().split(','), valid = false;1938 var split = val.toString().split(','), valid = false;
1860 for (var i = 0; i < split.length; i++) {1939 for (var i = 0; i < split.length; i++) {
1861 if (Math.abs((d.width / d.height) - upload.ratioToFloat(split[i])) < 0.0001) {1940 if (Math.abs((d.width / d.height) - upload.ratioToFloat(split[i])) < 0.01) {
1862 valid = true;1941 valid = true;
1863 }1942 }
1864 }1943 }
1865 return valid;1944 return valid;
1866 })));1945 }));
1867 promises.push(upload.happyPromise(validateAsync('maxRatio', 'ratio.max', /image/,1946 promises.push(validateAsync('maxRatio', 'ratio.max', /image/,
1868 this.imageDimensions, function (d, val) {1947 this.imageDimensions, function (d, val) {
1869 return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001;1948 return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001;
1870 })));1949 }));
1871 promises.push(upload.happyPromise(validateAsync('minRatio', 'ratio.min', /image/,1950 promises.push(validateAsync('minRatio', 'ratio.min', /image/,
1872 this.imageDimensions, function (d, val) {1951 this.imageDimensions, function (d, val) {
1873 return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001;1952 return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001;
1874 })));1953 }));
1875 promises.push(upload.happyPromise(validateAsync('maxDuration', 'duration.max', /audio|video/,1954 promises.push(validateAsync('maxDuration', 'duration.max', /audio|video/,
1876 this.mediaDuration, function (d, val) {1955 this.mediaDuration, function (d, val) {
1877 return d <= upload.translateScalars(val);1956 return d <= upload.translateScalars(val);
1878 })));1957 }));
1879 promises.push(upload.happyPromise(validateAsync('minDuration', 'duration.min', /audio|video/,1958 promises.push(validateAsync('minDuration', 'duration.min', /audio|video/,
1880 this.mediaDuration, function (d, val) {1959 this.mediaDuration, function (d, val) {
1881 return d >= upload.translateScalars(val);1960 return d >= upload.translateScalars(val);
1882 })));1961 }));
1883 promises.push(upload.happyPromise(validateAsync('duration', null, /audio|video/,1962 promises.push(validateAsync('duration', null, /audio|video/,
1884 function (file, val) {1963 function (file, val) {
1885 return upload.emptyPromise(val);1964 return upload.emptyPromise(val);
1886 }, function (r) {1965 }, function (r) {
1887 return r;1966 return r;
1888 })));1967 }));
18891968
1890 promises.push(upload.happyPromise(validateAsync('validateAsyncFn', null, null,1969 promises.push(validateAsync('validateAsyncFn', null, null,
1891 function (file, val) {1970 function (file, val) {
1892 return val;1971 return val;
1893 }, function (r) {1972 }, function (r) {
1894 return r === true || r === null || r === '';1973 return r === true || r === null || r === '';
1895 })));1974 }));
18961975
1897 return $q.all(promises).then(function () {1976 $q.all(promises).then(function () {
1898 deffer.resolve(ngModel, ngModel.$ngfValidations);1977
1978 if (runAllValidation) {
1979 for (var i = 0; i < files.length; i++) {
1980 var file = files[i];
1981 if (file.$error) {
1982 files.splice(i--, 1);
1983 }
1984 }
1985 }
1986
1987 runAllValidation = false;
1988 validateSync('maxFiles', null, function (file, val, i) {
1989 return prevLength + i < val;
1990 });
1991
1992 deffer.resolve({'validFiles': files, 'invalidFiles': invalidFiles});
1899 });1993 });
1994 return deffer.promise;
1900 };1995 };
19011996
1902 upload.imageDimensions = function (file) {1997 upload.imageDimensions = function (file) {
@@ -1921,8 +2016,8 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1921 .css('max-width', 'none !important').css('max-height', 'none !important');2016 .css('max-width', 'none !important').css('max-height', 'none !important');
19222017
1923 function success() {2018 function success() {
1924 var width = img[0].clientWidth;2019 var width = img[0].naturalWidth || img[0].clientWidth;
1925 var height = img[0].clientHeight;2020 var height = img[0].naturalHeight || img[0].clientHeight;
1926 img.remove();2021 img.remove();
1927 file.$ngfWidth = width;2022 file.$ngfWidth = width;
1928 file.$ngfHeight = height;2023 file.$ngfHeight = height;
@@ -1936,23 +2031,23 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
19362031
1937 img.on('load', success);2032 img.on('load', success);
1938 img.on('error', error);2033 img.on('error', error);
1939 var count = 0;
19402034
1941 function checkLoadError() {2035 var secondsCounter = 0;
2036 function checkLoadErrorInCaseOfNoCallback() {
1942 $timeout(function () {2037 $timeout(function () {
1943 if (img[0].parentNode) {2038 if (img[0].parentNode) {
1944 if (img[0].clientWidth) {2039 if (img[0].clientWidth) {
1945 success();2040 success();
1946 } else if (count > 10) {2041 } else if (secondsCounter++ > 10) {
1947 error();2042 error();
1948 } else {2043 } else {
1949 checkLoadError();2044 checkLoadErrorInCaseOfNoCallback();
1950 }2045 }
1951 }2046 }
1952 }, 1000);2047 }, 1000);
1953 }2048 }
19542049
1955 checkLoadError();2050 checkLoadErrorInCaseOfNoCallback();
19562051
1957 angular.element(document.getElementsByTagName('body')[0]).append(img);2052 angular.element(document.getElementsByTagName('body')[0]).append(img);
1958 }, function () {2053 }, function () {
@@ -2063,31 +2158,35 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2063 var deferred = $q.defer();2158 var deferred = $q.defer();
2064 var canvasElement = document.createElement('canvas');2159 var canvasElement = document.createElement('canvas');
2065 var imageElement = document.createElement('img');2160 var imageElement = document.createElement('img');
2161 imageElement.setAttribute('style', 'visibility:hidden;position:fixed;z-index:-100000');
2162 document.body.appendChild(imageElement);
20662163
2067 imageElement.onload = function () {2164 imageElement.onload = function () {
2068 if (resizeIf != null && resizeIf(imageElement.width, imageElement.height) === false) {2165 var imgWidth = imageElement.width, imgHeight = imageElement.height;
2166 imageElement.parentNode.removeChild(imageElement);
2167 if (resizeIf != null && resizeIf(imgWidth, imgHeight) === false) {
2069 deferred.reject('resizeIf');2168 deferred.reject('resizeIf');
2070 return;2169 return;
2071 }2170 }
2072 try {2171 try {
2073 if (ratio) {2172 if (ratio) {
2074 var ratioFloat = upload.ratioToFloat(ratio);2173 var ratioFloat = upload.ratioToFloat(ratio);
2075 var imgRatio = imageElement.width / imageElement.height;2174 var imgRatio = imgWidth / imgHeight;
2076 if (imgRatio < ratioFloat) {2175 if (imgRatio < ratioFloat) {
2077 width = imageElement.width;2176 width = imgWidth;
2078 height = width / ratioFloat;2177 height = width / ratioFloat;
2079 } else {2178 } else {
2080 height = imageElement.height;2179 height = imgHeight;
2081 width = height * ratioFloat;2180 width = height * ratioFloat;
2082 }2181 }
2083 }2182 }
2084 if (!width) {2183 if (!width) {
2085 width = imageElement.width;2184 width = imgWidth;
2086 }2185 }
2087 if (!height) {2186 if (!height) {
2088 height = imageElement.height;2187 height = imgHeight;
2089 }2188 }
2090 var dimensions = calculateAspectRatioFit(imageElement.width, imageElement.height, width, height, centerCrop);2189 var dimensions = calculateAspectRatioFit(imgWidth, imgHeight, width, height, centerCrop);
2091 canvasElement.width = Math.min(dimensions.width, width);2190 canvasElement.width = Math.min(dimensions.width, width);
2092 canvasElement.height = Math.min(dimensions.height, height);2191 canvasElement.height = Math.min(dimensions.height, height);
2093 var context = canvasElement.getContext('2d');2192 var context = canvasElement.getContext('2d');
@@ -2100,6 +2199,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2100 }2199 }
2101 };2200 };
2102 imageElement.onerror = function () {2201 imageElement.onerror = function () {
2202 imageElement.parentNode.removeChild(imageElement);
2103 deferred.reject();2203 deferred.reject();
2104 };2204 };
2105 imageElement.src = imagen;2205 imageElement.src = imagen;
@@ -2136,14 +2236,15 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2136 });2236 });
2137 }2237 }
21382238
2139 upload.resize = function (file, width, height, quality, type, ratio, centerCrop, resizeIf, restoreExif) {2239 upload.resize = function (file, options) {
2140 if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file);2240 if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file);
21412241
2142 var deferred = $q.defer();2242 var deferred = $q.defer();
2143 upload.dataUrl(file, true).then(function (url) {2243 upload.dataUrl(file, true).then(function (url) {
2144 resize(url, width, height, quality, type || file.type, ratio, centerCrop, resizeIf)2244 resize(url, options.width, options.height, options.quality, options.type || file.type,
2245 options.ratio, options.centerCrop, options.resizeIf)
2145 .then(function (dataUrl) {2246 .then(function (dataUrl) {
2146 if (file.type === 'image/jpeg' && restoreExif) {2247 if (file.type === 'image/jpeg' && options.restoreExif !== false) {
2147 try {2248 try {
2148 dataUrl = upload.restoreExif(url, dataUrl);2249 dataUrl = upload.restoreExif(url, dataUrl);
2149 } catch (e) {2250 } catch (e) {
@@ -2172,13 +2273,13 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2172}]);2273}]);
21732274
2174(function () {2275(function () {
2175 ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$location', 'Upload', '$http', '$q',2276 ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$window', 'Upload', '$http', '$q',
2176 function ($parse, $timeout, $location, Upload, $http, $q) {2277 function ($parse, $timeout, $window, Upload, $http, $q) {
2177 return {2278 return {
2178 restrict: 'AEC',2279 restrict: 'AEC',
2179 require: '?ngModel',2280 require: '?ngModel',
2180 link: function (scope, elem, attr, ngModel) {2281 link: function (scope, elem, attr, ngModel) {
2181 linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, Upload, $http, $q);2282 linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, Upload, $http, $q);
2182 }2283 }
2183 };2284 };
2184 }]);2285 }]);
@@ -2203,7 +2304,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2203 };2304 };
2204 }]);2305 }]);
22052306
2206 function linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, upload, $http, $q) {2307 function linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, upload, $http, $q) {
2207 var available = dropAvailable();2308 var available = dropAvailable();
22082309
2209 var attrGetter = function (name, scope, params) {2310 var attrGetter = function (name, scope, params) {
@@ -2279,23 +2380,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2279 if (stopPropagation(scope)) evt.stopPropagation();2380 if (stopPropagation(scope)) evt.stopPropagation();
2280 if (actualDragOverClass) elem.removeClass(actualDragOverClass);2381 if (actualDragOverClass) elem.removeClass(actualDragOverClass);
2281 actualDragOverClass = null;2382 actualDragOverClass = null;
2282 var items = evt.dataTransfer.items;2383 extractFilesAndUpdateModel(evt.dataTransfer, evt, 'dropUrl');
2283 var html;
2284 try {
2285 html = evt.dataTransfer && evt.dataTransfer.getData && evt.dataTransfer.getData('text/html');
2286 } catch (e) {/* Fix IE11 that throw error calling getData */
2287 }
2288
2289 extractFiles(items, evt.dataTransfer.files, attrGetter('ngfAllowDir', scope) !== false,
2290 attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) {
2291 if (files.length) {
2292 updateModel(files, evt);
2293 } else {
2294 extractFilesFromHtml('dropUrl', html).then(function (files) {
2295 updateModel(files, evt);
2296 });
2297 }
2298 });
2299 }, false);2384 }, false);
2300 elem[0].addEventListener('paste', function (evt) {2385 elem[0].addEventListener('paste', function (evt) {
2301 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&2386 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
@@ -2303,22 +2388,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2303 evt.preventDefault();2388 evt.preventDefault();
2304 }2389 }
2305 if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return;2390 if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return;
2306 var files = [];2391 extractFilesAndUpdateModel(evt.clipboardData || evt.originalEvent.clipboardData, evt, 'pasteUrl');
2307 var clipboard = evt.clipboardData || evt.originalEvent.clipboardData;
2308 if (clipboard && clipboard.items) {
2309 for (var k = 0; k < clipboard.items.length; k++) {
2310 if (clipboard.items[k].type.indexOf('image') !== -1) {
2311 files.push(clipboard.items[k].getAsFile());
2312 }
2313 }
2314 }
2315 if (files.length) {
2316 updateModel(files, evt);
2317 } else {
2318 extractFilesFromHtml('pasteUrl', clipboard).then(function (files) {
2319 updateModel(files, evt);
2320 });
2321 }
2322 }, false);2392 }, false);
23232393
2324 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&2394 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
@@ -2331,12 +2401,33 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2331 });2401 });
2332 }2402 }
23332403
2404 function extractFilesAndUpdateModel(source, evt, updateOnType) {
2405 if (!source) return;
2406 // html needs to be calculated on the same process otherwise the data will be wiped
2407 // after promise resolve or setTimeout.
2408 var html;
2409 try {
2410 html = source && source.getData && source.getData('text/html');
2411 } catch (e) {/* Fix IE11 that throw error calling getData */
2412 }
2413 extractFiles(source.items, source.files, attrGetter('ngfAllowDir', scope) !== false,
2414 attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) {
2415 if (files.length) {
2416 updateModel(files, evt);
2417 } else {
2418 extractFilesFromHtml(updateOnType, html).then(function (files) {
2419 updateModel(files, evt);
2420 });
2421 }
2422 });
2423 }
2424
2334 function updateModel(files, evt) {2425 function updateModel(files, evt) {
2335 upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt);2426 upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt);
2336 }2427 }
23372428
2338 function extractFilesFromHtml(updateOn, html) {2429 function extractFilesFromHtml(updateOn, html) {
2339 if (!upload.shouldUpdateOn(updateOn, attr, scope) || !html) return upload.rejectPromise([]);2430 if (!upload.shouldUpdateOn(updateOn, attr, scope) || typeof html !== 'string') return upload.rejectPromise([]);
2340 var urls = [];2431 var urls = [];
2341 html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) {2432 html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) {
2342 urls.push(src);2433 urls.push(src);
@@ -2387,8 +2478,14 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2387 }2478 }
23882479
2389 function extractFiles(items, fileList, allowDir, multiple) {2480 function extractFiles(items, fileList, allowDir, multiple) {
2390 var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles') || Number.MAX_VALUE;2481 var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles');
2391 var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize') || Number.MAX_VALUE;2482 if (maxFiles == null) {
2483 maxFiles = Number.MAX_VALUE;
2484 }
2485 var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize');
2486 if (maxTotalSize == null) {
2487 maxTotalSize = Number.MAX_VALUE;
2488 }
2392 var includeDir = attrGetter('ngfIncludeDir', scope);2489 var includeDir = attrGetter('ngfIncludeDir', scope);
2393 var files = [], totalSize = 0;2490 var files = [], totalSize = 0;
23942491
@@ -2399,7 +2496,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
2399 var promises = [upload.emptyPromise()];2496 var promises = [upload.emptyPromise()];
2400 if (includeDir) {2497 if (includeDir) {
2401 var file = {type: 'directory'};2498 var file = {type: 'directory'};
2402 file.name = file.path = (path || '') + entry.name + entry.name;2499 file.name = file.path = (path || '') + entry.name;
2403 files.push(file);2500 files.push(file);
2404 }2501 }
2405 var dirReader = entry.createReader();2502 var dirReader = entry.createReader();
@@ -2453,7 +2550,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
24532550
2454 var promises = [upload.emptyPromise()];2551 var promises = [upload.emptyPromise()];
24552552
2456 if (items && items.length > 0 && $location.protocol() !== 'file') {2553 if (items && items.length > 0 && $window.location.protocol !== 'file:') {
2457 for (var i = 0; i < items.length; i++) {2554 for (var i = 0; i < items.length; i++) {
2458 if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) {2555 if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) {
2459 var entry = items[i].webkitGetAsEntry();2556 var entry = items[i].webkitGetAsEntry();
diff --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
index f8c5ce8..4362546 100644
--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.min.js
+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.min.js
@@ -1,4 +1,3 @@
1/*! 12.0.4 */
2!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);
3
4}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}]);
5\ No newline at end of file1\ No newline at end of file
2/*! 12.2.13 */
3!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(){
4h.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}]);
6\ No newline at end of file5\ No newline at end of file
diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js
index b6192af..f1d033a 100644
--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js
+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js
@@ -1,9 +1,9 @@
1/**!1/**!
2 * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,2 * AngularJS file upload directives and services. Supports: file upload/drop/paste, resume, cancel/abort,
3 * progress, resize, thumbnail, preview, validation and CORS3 * progress, resize, thumbnail, preview, validation and CORS
4 * FileAPI Flash shim for old browsers not supporting FormData4 * FileAPI Flash shim for old browsers not supporting FormData
5 * @author Danial <danial.farid@gmail.com>5 * @author Danial <danial.farid@gmail.com>
6 * @version 12.0.46 * @version 12.2.13
7 */7 */
88
9(function () {9(function () {
diff --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
index b87b39d..9928c83 100644
--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.min.js
+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.min.js
@@ -1,2 +1,2 @@
1/*! 12.0.4 */1/*! 12.2.13 */
2!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)}});2!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)}});
3\ No newline at end of file3\ No newline at end of file
diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload.js
index 6b5547a..c6a9c43 100644
--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload.js
+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload.js
@@ -2,7 +2,7 @@
2 * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,2 * AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
3 * progress, resize, thumbnail, preview, validation and CORS3 * progress, resize, thumbnail, preview, validation and CORS
4 * @author Danial <danial.farid@gmail.com>4 * @author Danial <danial.farid@gmail.com>
5 * @version 12.0.45 * @version 12.2.13
6 */6 */
77
8if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {8if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
@@ -23,7 +23,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
2323
24var ngFileUpload = angular.module('ngFileUpload', []);24var ngFileUpload = angular.module('ngFileUpload', []);
2525
26ngFileUpload.version = '12.0.4';26ngFileUpload.version = '12.2.13';
2727
28ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {28ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
29 var upload = this;29 var upload = this;
@@ -90,10 +90,12 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
90 function uploadWithAngular() {90 function uploadWithAngular() {
91 $http(config).then(function (r) {91 $http(config).then(function (r) {
92 if (resumeSupported && config._chunkSize && !config._finished && config._file) {92 if (resumeSupported && config._chunkSize && !config._finished && config._file) {
93 var fileSize = config._file && config._file.size || 0;
93 notifyProgress({94 notifyProgress({
94 loaded: config._end,95 loaded: Math.min(config._end, fileSize),
95 total: config._file && config._file.size,96 total: fileSize,
96 config: config, type: 'progress'97 config: config,
98 type: 'progress'
97 }99 }
98 );100 );
99 upload.upload(config, true);101 upload.upload(config, true);
@@ -132,6 +134,9 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
132 } else if (config.resumeSize) {134 } else if (config.resumeSize) {
133 config.resumeSize().then(function (size) {135 config.resumeSize().then(function (size) {
134 config._start = size;136 config._start = size;
137 if (config._chunkSize) {
138 config._end = config._start + config._chunkSize;
139 }
135 uploadWithAngular();140 uploadWithAngular();
136 }, function (e) {141 }, function (e) {
137 throw e;142 throw e;
@@ -185,9 +190,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
185 };190 };
186191
187 upload.promisesCount++;192 upload.promisesCount++;
188 promise['finally'](function () {193 if (promise['finally'] && promise['finally'] instanceof Function) {
189 upload.promisesCount--;194 promise['finally'](function () {
190 });195 upload.promisesCount--;
196 });
197 }
191 return promise;198 return promise;
192 }199 }
193200
@@ -371,9 +378,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http,
371 var arrayBufferView = new Uint8Array(resp.data);378 var arrayBufferView = new Uint8Array(resp.data);
372 var type = resp.headers('content-type') || 'image/WebP';379 var type = resp.headers('content-type') || 'image/WebP';
373 var blob = new window.Blob([arrayBufferView], {type: type});380 var blob = new window.Blob([arrayBufferView], {type: type});
381 var matches = url.match(/.*\/(.+?)(\?.*)?$/);
382 if (matches.length > 1) {
383 blob.name = matches[1];
384 }
374 defer.resolve(blob);385 defer.resolve(blob);
375 //var split = type.split('[/;]');
376 //blob.name = url.substring(0, 150).replace(/\W+/g, '') + '.' + (split.length > 1 ? split[1] : 'jpg');
377 }, function (e) {386 }, function (e) {
378 defer.reject(e);387 defer.reject(e);
379 });388 });
@@ -421,7 +430,7 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
421 };430 };
422431
423 upload.shouldUpdateOn = function (type, attr, scope) {432 upload.shouldUpdateOn = function (type, attr, scope) {
424 var modelOptions = upload.attrGetter('ngModelOptions', attr, scope);433 var modelOptions = upload.attrGetter('ngfModelOptions', attr, scope);
425 if (modelOptions && modelOptions.updateOn) {434 if (modelOptions && modelOptions.updateOn) {
426 return modelOptions.updateOn.split(' ').indexOf(type) > -1;435 return modelOptions.updateOn.split(' ').indexOf(type) > -1;
427 }436 }
@@ -471,13 +480,13 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
471 return $q.all(promises);480 return $q.all(promises);
472 }481 }
473482
474 function resize(files, attr, scope) {483 function resizeFile(files, attr, scope, ngModel) {
475 var resizeVal = upload.attrGetter('ngfResize', attr, scope);484 var resizeVal = upload.attrGetter('ngfResize', attr, scope);
476 if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise();485 if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise();
477 if (resizeVal instanceof Function) {486 if (resizeVal instanceof Function) {
478 var defer = $q.defer();487 var defer = $q.defer();
479 resizeVal(files).then(function (p) {488 return resizeVal(files).then(function (p) {
480 resizeWithParams(p, files, attr, scope).then(function (r) {489 resizeWithParams(p, files, attr, scope, ngModel).then(function (r) {
481 defer.resolve(r);490 defer.resolve(r);
482 }, function (e) {491 }, function (e) {
483 defer.reject(e);492 defer.reject(e);
@@ -486,27 +495,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
486 defer.reject(e);495 defer.reject(e);
487 });496 });
488 } else {497 } else {
489 return resizeWithParams(resizeVal, files, attr, scope);498 return resizeWithParams(resizeVal, files, attr, scope, ngModel);
490 }499 }
491 }500 }
492501
493 function resizeWithParams(param, files, attr, scope) {502 function resizeWithParams(params, files, attr, scope, ngModel) {
494 var promises = [upload.emptyPromise()];503 var promises = [upload.emptyPromise()];
495504
496 function handleFile(f, i) {505 function handleFile(f, i) {
497 if (f.type.indexOf('image') === 0) {506 if (f.type.indexOf('image') === 0) {
498 if (param.pattern && !upload.validatePattern(f, param.pattern)) return;507 if (params.pattern && !upload.validatePattern(f, params.pattern)) return;
499 var promise = upload.resize(f, param.width, param.height, param.quality,508 params.resizeIf = function (width, height) {
500 param.type, param.ratio, param.centerCrop, function (width, height) {509 return upload.attrGetter('ngfResizeIf', attr, scope,
501 return upload.attrGetter('ngfResizeIf', attr, scope,510 {$width: width, $height: height, $file: f});
502 {$width: width, $height: height, $file: f});511 };
503 }, param.restoreExif !== false);512 var promise = upload.resize(f, params);
504 promises.push(promise);513 promises.push(promise);
505 promise.then(function (resizedFile) {514 promise.then(function (resizedFile) {
506 files.splice(i, 1, resizedFile);515 files.splice(i, 1, resizedFile);
507 }, function (e) {516 }, function (e) {
508 f.$error = 'resize';517 f.$error = 'resize';
518 (f.$errorMessages = (f.$errorMessages || {})).resize = true;
509 f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name);519 f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name);
520 ngModel.$ngfValidations.push({name: 'resize', valid: false});
521 upload.applyModelValidation(ngModel, files);
510 });522 });
511 }523 }
512 }524 }
@@ -593,18 +605,6 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
593 return angular.isArray(v) ? v : [v];605 return angular.isArray(v) ? v : [v];
594 }606 }
595607
596 function separateInvalids() {
597 valids = [];
598 invalids = [];
599 angular.forEach(allNewFiles, function (file) {
600 if (file.$error) {
601 invalids.push(file);
602 } else {
603 valids.push(file);
604 }
605 });
606 }
607
608 function resizeAndUpdate() {608 function resizeAndUpdate() {
609 function updateModel() {609 function updateModel() {
610 $timeout(function () {610 $timeout(function () {
@@ -614,17 +614,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
614 }, options && options.debounce ? options.debounce.change || options.debounce : 0);614 }, options && options.debounce ? options.debounce.change || options.debounce : 0);
615 }615 }
616616
617 resize(validateAfterResize ? allNewFiles : valids, attr, scope).then(function () {617 var resizingFiles = validateAfterResize ? allNewFiles : valids;
618 resizeFile(resizingFiles, attr, scope, ngModel).then(function () {
618 if (validateAfterResize) {619 if (validateAfterResize) {
619 upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () {620 upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
620 separateInvalids();621 .then(function (validationResult) {
621 updateModel();622 valids = validationResult.validsFiles;
622 });623 invalids = validationResult.invalidsFiles;
624 updateModel();
625 });
623 } else {626 } else {
624 updateModel();627 updateModel();
625 }628 }
626 }, function (e) {629 }, function () {
627 throw 'Could not resize files ' + e;630 for (var i = 0; i < resizingFiles.length; i++) {
631 var f = resizingFiles[i];
632 if (f.$error === 'resize') {
633 var index = valids.indexOf(f);
634 if (index > -1) {
635 valids.splice(index, 1);
636 invalids.push(f);
637 }
638 updateModel();
639 }
640 }
628 });641 });
629 }642 }
630643
@@ -654,13 +667,15 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
654667
655 var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope);668 var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope);
656669
657 var options = upload.attrGetter('ngModelOptions', attr, scope);670 var options = upload.attrGetter('ngfModelOptions', attr, scope);
658 upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () {671 upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope)
672 .then(function (validationResult) {
659 if (noDelay) {673 if (noDelay) {
660 update(allNewFiles, [], files, dupFiles, isSingleModel);674 update(allNewFiles, [], files, dupFiles, isSingleModel);
661 } else {675 } else {
662 if ((!options || !options.allowInvalid) && !validateAfterResize) {676 if ((!options || !options.allowInvalid) && !validateAfterResize) {
663 separateInvalids();677 valids = validationResult.validFiles;
678 invalids = validationResult.invalidFiles;
664 } else {679 } else {
665 valids = allNewFiles;680 valids = allNewFiles;
666 }681 }
@@ -697,7 +712,7 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
697 /** @namespace attr.ngfSelect */712 /** @namespace attr.ngfSelect */
698 /** @namespace attr.ngfChange */713 /** @namespace attr.ngfChange */
699 /** @namespace attr.ngModel */714 /** @namespace attr.ngModel */
700 /** @namespace attr.ngModelOptions */715 /** @namespace attr.ngfModelOptions */
701 /** @namespace attr.ngfMultiple */716 /** @namespace attr.ngfMultiple */
702 /** @namespace attr.ngfCapture */717 /** @namespace attr.ngfCapture */
703 /** @namespace attr.ngfValidate */718 /** @namespace attr.ngfValidate */
@@ -717,6 +732,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
717 function changeFn(evt) {732 function changeFn(evt) {
718 if (upload.shouldUpdateOn('change', attr, scope)) {733 if (upload.shouldUpdateOn('change', attr, scope)) {
719 var fileList = evt.__files_ || (evt.target && evt.target.files), files = [];734 var fileList = evt.__files_ || (evt.target && evt.target.files), files = [];
735 /* Handle duplicate call in IE11 */
736 if (!fileList) return;
720 for (var i = 0; i < fileList.length; i++) {737 for (var i = 0; i < fileList.length; i++) {
721 files.push(fileList[i]);738 files.push(fileList[i]);
722 }739 }
@@ -728,31 +745,39 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
728 upload.registerModelChangeValidator(ngModel, attr, scope);745 upload.registerModelChangeValidator(ngModel, attr, scope);
729746
730 var unwatches = [];747 var unwatches = [];
731 unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () {748 if (attrGetter('ngfMultiple')) {
732 fileElem.attr('multiple', attrGetter('ngfMultiple', scope));749 unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () {
733 }));750 fileElem.attr('multiple', attrGetter('ngfMultiple', scope));
734 unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () {751 }));
735 fileElem.attr('capture', attrGetter('ngfCapture', scope));752 }
736 }));753 if (attrGetter('ngfCapture')) {
737 unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () {754 unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () {
738 fileElem.attr('accept', attrGetter('ngfAccept', scope));755 fileElem.attr('capture', attrGetter('ngfCapture', scope));
739 }));756 }));
740 attr.$observe('accept', function () {757 }
758 if (attrGetter('ngfAccept')) {
759 unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () {
760 fileElem.attr('accept', attrGetter('ngfAccept', scope));
761 }));
762 }
763 unwatches.push(attr.$observe('accept', function () {
741 fileElem.attr('accept', attrGetter('accept'));764 fileElem.attr('accept', attrGetter('accept'));
742 });765 }));
743 unwatches.push(function () {766 function bindAttrToFileInput(fileElem, label) {
744 if (attr.$$observers) delete attr.$$observers.accept;767 function updateId(val) {
745 });768 fileElem.attr('id', 'ngf-' + val);
746 function bindAttrToFileInput(fileElem) {769 label.attr('id', 'ngf-label-' + val);
747 if (elem !== fileElem) {770 }
748 for (var i = 0; i < elem[0].attributes.length; i++) {771
749 var attribute = elem[0].attributes[i];772 for (var i = 0; i < elem[0].attributes.length; i++) {
750 if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') {773 var attribute = elem[0].attributes[i];
751 if (attribute.value == null || attribute.value === '') {774 if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') {
752 if (attribute.name === 'required') attribute.value = 'required';775 if (attribute.name === 'id') {
753 if (attribute.name === 'multiple') attribute.value = 'multiple';776 updateId(attribute.value);
754 }777 unwatches.push(attr.$observe('id', updateId));
755 fileElem.attr(attribute.name, attribute.name === 'id' ? 'ngf-' + attribute.value : attribute.value);778 } else {
779 fileElem.attr(attribute.name, (!attribute.value && (attribute.name === 'required' ||
780 attribute.name === 'multiple')) ? attribute.name : attribute.value);
756 }781 }
757 }782 }
758 }783 }
@@ -765,12 +790,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
765790
766 var fileElem = angular.element('<input type="file">');791 var fileElem = angular.element('<input type="file">');
767792
768 bindAttrToFileInput(fileElem);
769
770 var label = angular.element('<label>upload</label>');793 var label = angular.element('<label>upload</label>');
771 label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden')794 label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden')
772 .css('width', '0px').css('height', '0px').css('border', 'none')795 .css('width', '0px').css('height', '0px').css('border', 'none')
773 .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1');796 .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1');
797 bindAttrToFileInput(fileElem, label);
798
774 generatedElems.push({el: elem, ref: label});799 generatedElems.push({el: elem, ref: label});
775800
776 document.body.appendChild(label.append(fileElem)[0]);801 document.body.appendChild(label.append(fileElem)[0]);
@@ -778,13 +803,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
778 return fileElem;803 return fileElem;
779 }804 }
780805
781 var initialTouchStartY = 0;
782
783 function clickHandler(evt) {806 function clickHandler(evt) {
784 if (elem.attr('disabled')) return false;807 if (elem.attr('disabled')) return false;
785 if (attrGetter('ngfSelectDisabled', scope)) return;808 if (attrGetter('ngfSelectDisabled', scope)) return;
786809
787 var r = handleTouch(evt);810 var r = detectSwipe(evt);
811 // prevent the click if it is a swipe
788 if (r != null) return r;812 if (r != null) return r;
789813
790 resetModel(evt);814 resetModel(evt);
@@ -796,7 +820,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
796 document.body.appendChild(fileElem.parent()[0]);820 document.body.appendChild(fileElem.parent()[0]);
797 fileElem.bind('change', changeFn);821 fileElem.bind('change', changeFn);
798 }822 }
799 } catch(e){/*ignore*/}823 } catch (e) {/*ignore*/
824 }
800825
801 if (isDelayedClickSupported(navigator.userAgent)) {826 if (isDelayedClickSupported(navigator.userAgent)) {
802 setTimeout(function () {827 setTimeout(function () {
@@ -809,19 +834,30 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
809 return false;834 return false;
810 }835 }
811836
812 function handleTouch(evt) {
813 var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches);
814 if (evt.type === 'touchstart') {
815 initialTouchStartY = touches ? touches[0].clientY : 0;
816 return true; // don't block event default
817 } else {
818 evt.stopPropagation();
819 evt.preventDefault();
820837
821 // prevent scroll from triggering event838 var initialTouchStartY = 0;
822 if (evt.type === 'touchend') {839 var initialTouchStartX = 0;
823 var currentLocation = touches ? touches[0].clientY : 0;840
824 if (Math.abs(currentLocation - initialTouchStartY) > 20) return false;841 function detectSwipe(evt) {
842 var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches);
843 if (touches) {
844 if (evt.type === 'touchstart') {
845 initialTouchStartX = touches[0].clientX;
846 initialTouchStartY = touches[0].clientY;
847 return true; // don't block event default
848 } else {
849 // prevent scroll from triggering event
850 if (evt.type === 'touchend') {
851 var currentX = touches[0].clientX;
852 var currentY = touches[0].clientY;
853 if ((Math.abs(currentX - initialTouchStartX) > 20) ||
854 (Math.abs(currentY - initialTouchStartY) > 20)) {
855 evt.stopPropagation();
856 evt.preventDefault();
857 return false;
858 }
859 }
860 return true;
825 }861 }
826 }862 }
827 }863 }
@@ -1052,14 +1088,19 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1052 var size = resizeParams;1088 var size = resizeParams;
1053 if (directiveName === 'ngfThumbnail') {1089 if (directiveName === 'ngfThumbnail') {
1054 if (!size) {1090 if (!size) {
1055 size = {width: elem[0].clientWidth, height: elem[0].clientHeight};1091 size = {
1092 width: elem[0].naturalWidth || elem[0].clientWidth,
1093 height: elem[0].naturalHeight || elem[0].clientHeight
1094 };
1056 }1095 }
1057 if (size.width === 0 && window.getComputedStyle) {1096 if (size.width === 0 && window.getComputedStyle) {
1058 var style = getComputedStyle(elem[0]);1097 var style = getComputedStyle(elem[0]);
1059 size = {1098 if (style.width && style.width.indexOf('px') > -1 && style.height && style.height.indexOf('px') > -1) {
1060 width: parseInt(style.width.slice(0, -2)),1099 size = {
1061 height: parseInt(style.height.slice(0, -2))1100 width: parseInt(style.width.slice(0, -2)),
1062 };1101 height: parseInt(style.height.slice(0, -2))
1102 };
1103 }
1063 }1104 }
1064 }1105 }
10651106
@@ -1074,7 +1115,11 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1074 if (file && file.type && file.type.search(getTagType(elem[0])) === 0 &&1115 if (file && file.type && file.type.search(getTagType(elem[0])) === 0 &&
1075 (!isBackground || file.type.indexOf('image') === 0)) {1116 (!isBackground || file.type.indexOf('image') === 0)) {
1076 if (size && Upload.isResizeSupported()) {1117 if (size && Upload.isResizeSupported()) {
1077 Upload.resize(file, size.width, size.height, size.quality).then(1118 size.resizeIf = function (width, height) {
1119 return Upload.attrGetter('ngfResizeIf', attr, scope,
1120 {$width: width, $height: height, $file: file});
1121 };
1122 Upload.resize(file, size).then(
1078 function (f) {1123 function (f) {
1079 constructDataUrl(f);1124 constructDataUrl(f);
1080 }, function (e) {1125 }, function (e) {
@@ -1136,8 +1181,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
1136 }]);1181 }]);
11371182
1138 ngFileUpload.config(['$compileProvider', function ($compileProvider) {1183 ngFileUpload.config(['$compileProvider', function ($compileProvider) {
1139 if ($compileProvider.imgSrcSanitizationWhitelist) $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/);1184 if ($compileProvider.imgSrcSanitizationWhitelist) $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
1140 if ($compileProvider.aHrefSanitizationWhitelist) $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/);1185 if ($compileProvider.aHrefSanitizationWhitelist) $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);
1141 }]);1186 }]);
11421187
1143 ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) {1188 ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) {
@@ -1229,13 +1274,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1229 if (ngModel) {1274 if (ngModel) {
1230 ngModel.$formatters.push(function (files) {1275 ngModel.$formatters.push(function (files) {
1231 if (ngModel.$dirty) {1276 if (ngModel.$dirty) {
1277 var filesArray = files;
1232 if (files && !angular.isArray(files)) {1278 if (files && !angular.isArray(files)) {
1233 files = [files];1279 filesArray = [files];
1234 }1280 }
1235 upload.validate(files, 0, ngModel, attr, scope).then(function () {1281 upload.validate(filesArray, 0, ngModel, attr, scope).then(function () {
1236 upload.applyModelValidation(ngModel, files);1282 upload.applyModelValidation(ngModel, filesArray);
1237 });1283 });
1238 }1284 }
1285 return files;
1239 });1286 });
1240 }1287 }
1241 };1288 };
@@ -1285,11 +1332,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1285 return upload.attrGetter(name, attr, scope, params);1332 return upload.attrGetter(name, attr, scope, params);
1286 };1333 };
12871334
1335 var ignoredErrors = (upload.attrGetter('ngfIgnoreInvalid', attr, scope) || '').split(' ');
1336 var runAllValidation = upload.attrGetter('ngfRunAllValidations', attr, scope);
1337
1288 if (files == null || files.length === 0) {1338 if (files == null || files.length === 0) {
1289 return upload.emptyPromise(ngModel);1339 return upload.emptyPromise({'validFiles': files, 'invalidFiles': []});
1290 }1340 }
12911341
1292 files = files.length === undefined ? [files] : files.slice(0);1342 files = files.length === undefined ? [files] : files.slice(0);
1343 var invalidFiles = [];
12931344
1294 function validateSync(name, validationName, fn) {1345 function validateSync(name, validationName, fn) {
1295 if (files) {1346 if (files) {
@@ -1300,11 +1351,20 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1300 var val = upload.getValidationAttr(attr, scope, name, validationName, file);1351 var val = upload.getValidationAttr(attr, scope, name, validationName, file);
1301 if (val != null) {1352 if (val != null) {
1302 if (!fn(file, val, i)) {1353 if (!fn(file, val, i)) {
1303 file.$error = name;1354 if (ignoredErrors.indexOf(name) === -1) {
1304 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;1355 file.$error = name;
1305 file.$errorParam = val;1356 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
1306 files.splice(i, 1);1357 file.$errorParam = val;
1307 valid = false;1358 if (invalidFiles.indexOf(file) === -1) {
1359 invalidFiles.push(file);
1360 }
1361 if (!runAllValidation) {
1362 files.splice(i, 1);
1363 }
1364 valid = false;
1365 } else {
1366 files.splice(i, 1);
1367 }
1308 }1368 }
1309 }1369 }
1310 }1370 }
@@ -1315,9 +1375,6 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1315 }1375 }
1316 }1376 }
13171377
1318 validateSync('maxFiles', null, function (file, val, i) {
1319 return prevLength + i < val;
1320 });
1321 validateSync('pattern', null, upload.validatePattern);1378 validateSync('pattern', null, upload.validatePattern);
1322 validateSync('minSize', 'size.min', function (file, val) {1379 validateSync('minSize', 'size.min', function (file, val) {
1323 return file.size + 0.1 >= upload.translateScalars(val);1380 return file.size + 0.1 >= upload.translateScalars(val);
@@ -1340,44 +1397,58 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1340 });1397 });
13411398
1342 if (!files.length) {1399 if (!files.length) {
1343 return upload.emptyPromise(ngModel, ngModel.$ngfValidations);1400 return upload.emptyPromise({'validFiles': [], 'invalidFiles': invalidFiles});
1344 }1401 }
13451402
1346 function validateAsync(name, validationName, type, asyncFn, fn) {1403 function validateAsync(name, validationName, type, asyncFn, fn) {
1347 function resolveResult(defer, file, val) {1404 function resolveResult(defer, file, val) {
1348 if (val != null) {1405 function resolveInternal(fn) {
1349 asyncFn(file, val).then(function (d) {1406 if (fn()) {
1350 if (!fn(d, val)) {1407 if (ignoredErrors.indexOf(name) === -1) {
1351 file.$error = name;1408 file.$error = name;
1352 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;1409 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;
1353 file.$errorParam = val;1410 file.$errorParam = val;
1354 defer.reject();1411 if (invalidFiles.indexOf(file) === -1) {
1412 invalidFiles.push(file);
1413 }
1414 if (!runAllValidation) {
1415 var i = files.indexOf(file);
1416 if (i > -1) files.splice(i, 1);
1417 }
1418 defer.resolve(false);
1355 } else {1419 } else {
1356 defer.resolve();1420 var j = files.indexOf(file);
1421 if (j > -1) files.splice(j, 1);
1422 defer.resolve(true);
1357 }1423 }
1424 } else {
1425 defer.resolve(true);
1426 }
1427 }
1428
1429 if (val != null) {
1430 asyncFn(file, val).then(function (d) {
1431 resolveInternal(function () {
1432 return !fn(d, val);
1433 });
1358 }, function () {1434 }, function () {
1359 if (attrGetter('ngfValidateForce', {$file: file})) {1435 resolveInternal(function () {
1360 file.$error = name;1436 return attrGetter('ngfValidateForce', {$file: file});
1361 (file.$errorMessages = (file.$errorMessages || {}))[name] = true;1437 });
1362 file.$errorParam = val;
1363 defer.reject();
1364 } else {
1365 defer.resolve();
1366 }
1367 });1438 });
1368 } else {1439 } else {
1369 defer.resolve();1440 defer.resolve(true);
1370 }1441 }
1371 }1442 }
13721443
1373 var promises = [upload.emptyPromise()];1444 var promises = [upload.emptyPromise(true)];
1374 if (files) {1445 if (files) {
1375 files = files.length === undefined ? [files] : files;1446 files = files.length === undefined ? [files] : files;
1376 angular.forEach(files, function (file) {1447 angular.forEach(files, function (file) {
1377 var defer = $q.defer();1448 var defer = $q.defer();
1378 promises.push(defer.promise);1449 promises.push(defer.promise);
1379 if (type && (file.type == null || file.type.search(type) !== 0)) {1450 if (type && (file.type == null || file.type.search(type) !== 0)) {
1380 defer.resolve();1451 defer.resolve(true);
1381 return;1452 return;
1382 }1453 }
1383 if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) {1454 if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) {
@@ -1385,96 +1456,120 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1385 resolveResult(defer, file,1456 resolveResult(defer, file,
1386 attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height}));1457 attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height}));
1387 }, function () {1458 }, function () {
1388 defer.reject();1459 defer.resolve(false);
1389 });1460 });
1390 } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) {1461 } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) {
1391 upload.mediaDuration(file).then(function (d) {1462 upload.mediaDuration(file).then(function (d) {
1392 resolveResult(defer, file,1463 resolveResult(defer, file,
1393 attrGetter('ngfDuration', {$file: file, $duration: d}));1464 attrGetter('ngfDuration', {$file: file, $duration: d}));
1394 }, function () {1465 }, function () {
1395 defer.reject();1466 defer.resolve(false);
1396 });1467 });
1397 } else {1468 } else {
1398 resolveResult(defer, file,1469 resolveResult(defer, file,
1399 upload.getValidationAttr(attr, scope, name, validationName, file));1470 upload.getValidationAttr(attr, scope, name, validationName, file));
1400 }1471 }
1401 });1472 });
1402 return $q.all(promises).then(function () {
1403 ngModel.$ngfValidations.push({name: name, valid: true});
1404 }, function () {
1405 ngModel.$ngfValidations.push({name: name, valid: false});
1406 });
1407 }1473 }
1474 var deffer = $q.defer();
1475 $q.all(promises).then(function (values) {
1476 var isValid = true;
1477 for (var i = 0; i < values.length; i++) {
1478 if (!values[i]) {
1479 isValid = false;
1480 break;
1481 }
1482 }
1483 ngModel.$ngfValidations.push({name: name, valid: isValid});
1484 deffer.resolve(isValid);
1485 });
1486 return deffer.promise;
1408 }1487 }
14091488
1410 var deffer = $q.defer();1489 var deffer = $q.defer();
1411 var promises = [];1490 var promises = [];
14121491
1413 promises.push(upload.happyPromise(validateAsync('maxHeight', 'height.max', /image/,1492 promises.push(validateAsync('maxHeight', 'height.max', /image/,
1414 this.imageDimensions, function (d, val) {1493 this.imageDimensions, function (d, val) {
1415 return d.height <= val;1494 return d.height <= val;
1416 })));1495 }));
1417 promises.push(upload.happyPromise(validateAsync('minHeight', 'height.min', /image/,1496 promises.push(validateAsync('minHeight', 'height.min', /image/,
1418 this.imageDimensions, function (d, val) {1497 this.imageDimensions, function (d, val) {
1419 return d.height >= val;1498 return d.height >= val;
1420 })));1499 }));
1421 promises.push(upload.happyPromise(validateAsync('maxWidth', 'width.max', /image/,1500 promises.push(validateAsync('maxWidth', 'width.max', /image/,
1422 this.imageDimensions, function (d, val) {1501 this.imageDimensions, function (d, val) {
1423 return d.width <= val;1502 return d.width <= val;
1424 })));1503 }));
1425 promises.push(upload.happyPromise(validateAsync('minWidth', 'width.min', /image/,1504 promises.push(validateAsync('minWidth', 'width.min', /image/,
1426 this.imageDimensions, function (d, val) {1505 this.imageDimensions, function (d, val) {
1427 return d.width >= val;1506 return d.width >= val;
1428 })));1507 }));
1429 promises.push(upload.happyPromise(validateAsync('dimensions', null, /image/,1508 promises.push(validateAsync('dimensions', null, /image/,
1430 function (file, val) {1509 function (file, val) {
1431 return upload.emptyPromise(val);1510 return upload.emptyPromise(val);
1432 }, function (r) {1511 }, function (r) {
1433 return r;1512 return r;
1434 })));1513 }));
1435 promises.push(upload.happyPromise(validateAsync('ratio', null, /image/,1514 promises.push(validateAsync('ratio', null, /image/,
1436 this.imageDimensions, function (d, val) {1515 this.imageDimensions, function (d, val) {
1437 var split = val.toString().split(','), valid = false;1516 var split = val.toString().split(','), valid = false;
1438 for (var i = 0; i < split.length; i++) {1517 for (var i = 0; i < split.length; i++) {
1439 if (Math.abs((d.width / d.height) - upload.ratioToFloat(split[i])) < 0.0001) {1518 if (Math.abs((d.width / d.height) - upload.ratioToFloat(split[i])) < 0.01) {
1440 valid = true;1519 valid = true;
1441 }1520 }
1442 }1521 }
1443 return valid;1522 return valid;
1444 })));1523 }));
1445 promises.push(upload.happyPromise(validateAsync('maxRatio', 'ratio.max', /image/,1524 promises.push(validateAsync('maxRatio', 'ratio.max', /image/,
1446 this.imageDimensions, function (d, val) {1525 this.imageDimensions, function (d, val) {
1447 return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001;1526 return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001;
1448 })));1527 }));
1449 promises.push(upload.happyPromise(validateAsync('minRatio', 'ratio.min', /image/,1528 promises.push(validateAsync('minRatio', 'ratio.min', /image/,
1450 this.imageDimensions, function (d, val) {1529 this.imageDimensions, function (d, val) {
1451 return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001;1530 return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001;
1452 })));1531 }));
1453 promises.push(upload.happyPromise(validateAsync('maxDuration', 'duration.max', /audio|video/,1532 promises.push(validateAsync('maxDuration', 'duration.max', /audio|video/,
1454 this.mediaDuration, function (d, val) {1533 this.mediaDuration, function (d, val) {
1455 return d <= upload.translateScalars(val);1534 return d <= upload.translateScalars(val);
1456 })));1535 }));
1457 promises.push(upload.happyPromise(validateAsync('minDuration', 'duration.min', /audio|video/,1536 promises.push(validateAsync('minDuration', 'duration.min', /audio|video/,
1458 this.mediaDuration, function (d, val) {1537 this.mediaDuration, function (d, val) {
1459 return d >= upload.translateScalars(val);1538 return d >= upload.translateScalars(val);
1460 })));1539 }));
1461 promises.push(upload.happyPromise(validateAsync('duration', null, /audio|video/,1540 promises.push(validateAsync('duration', null, /audio|video/,
1462 function (file, val) {1541 function (file, val) {
1463 return upload.emptyPromise(val);1542 return upload.emptyPromise(val);
1464 }, function (r) {1543 }, function (r) {
1465 return r;1544 return r;
1466 })));1545 }));
14671546
1468 promises.push(upload.happyPromise(validateAsync('validateAsyncFn', null, null,1547 promises.push(validateAsync('validateAsyncFn', null, null,
1469 function (file, val) {1548 function (file, val) {
1470 return val;1549 return val;
1471 }, function (r) {1550 }, function (r) {
1472 return r === true || r === null || r === '';1551 return r === true || r === null || r === '';
1473 })));1552 }));
1553
1554 $q.all(promises).then(function () {
1555
1556 if (runAllValidation) {
1557 for (var i = 0; i < files.length; i++) {
1558 var file = files[i];
1559 if (file.$error) {
1560 files.splice(i--, 1);
1561 }
1562 }
1563 }
1564
1565 runAllValidation = false;
1566 validateSync('maxFiles', null, function (file, val, i) {
1567 return prevLength + i < val;
1568 });
14741569
1475 return $q.all(promises).then(function () {1570 deffer.resolve({'validFiles': files, 'invalidFiles': invalidFiles});
1476 deffer.resolve(ngModel, ngModel.$ngfValidations);
1477 });1571 });
1572 return deffer.promise;
1478 };1573 };
14791574
1480 upload.imageDimensions = function (file) {1575 upload.imageDimensions = function (file) {
@@ -1499,8 +1594,8 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
1499 .css('max-width', 'none !important').css('max-height', 'none !important');1594 .css('max-width', 'none !important').css('max-height', 'none !important');
15001595
1501 function success() {1596 function success() {
1502 var width = img[0].clientWidth;1597 var width = img[0].naturalWidth || img[0].clientWidth;
1503 var height = img[0].clientHeight;1598 var height = img[0].naturalHeight || img[0].clientHeight;
1504 img.remove();1599 img.remove();
1505 file.$ngfWidth = width;1600 file.$ngfWidth = width;
1506 file.$ngfHeight = height;1601 file.$ngfHeight = height;
@@ -1514,23 +1609,23 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct
15141609
1515 img.on('load', success);1610 img.on('load', success);
1516 img.on('error', error);1611 img.on('error', error);
1517 var count = 0;
15181612
1519 function checkLoadError() {1613 var secondsCounter = 0;
1614 function checkLoadErrorInCaseOfNoCallback() {
1520 $timeout(function () {1615 $timeout(function () {
1521 if (img[0].parentNode) {1616 if (img[0].parentNode) {
1522 if (img[0].clientWidth) {1617 if (img[0].clientWidth) {
1523 success();1618 success();
1524 } else if (count > 10) {1619 } else if (secondsCounter++ > 10) {
1525 error();1620 error();
1526 } else {1621 } else {
1527 checkLoadError();1622 checkLoadErrorInCaseOfNoCallback();
1528 }1623 }
1529 }1624 }
1530 }, 1000);1625 }, 1000);
1531 }1626 }
15321627
1533 checkLoadError();1628 checkLoadErrorInCaseOfNoCallback();
15341629
1535 angular.element(document.getElementsByTagName('body')[0]).append(img);1630 angular.element(document.getElementsByTagName('body')[0]).append(img);
1536 }, function () {1631 }, function () {
@@ -1641,31 +1736,35 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1641 var deferred = $q.defer();1736 var deferred = $q.defer();
1642 var canvasElement = document.createElement('canvas');1737 var canvasElement = document.createElement('canvas');
1643 var imageElement = document.createElement('img');1738 var imageElement = document.createElement('img');
1739 imageElement.setAttribute('style', 'visibility:hidden;position:fixed;z-index:-100000');
1740 document.body.appendChild(imageElement);
16441741
1645 imageElement.onload = function () {1742 imageElement.onload = function () {
1646 if (resizeIf != null && resizeIf(imageElement.width, imageElement.height) === false) {1743 var imgWidth = imageElement.width, imgHeight = imageElement.height;
1744 imageElement.parentNode.removeChild(imageElement);
1745 if (resizeIf != null && resizeIf(imgWidth, imgHeight) === false) {
1647 deferred.reject('resizeIf');1746 deferred.reject('resizeIf');
1648 return;1747 return;
1649 }1748 }
1650 try {1749 try {
1651 if (ratio) {1750 if (ratio) {
1652 var ratioFloat = upload.ratioToFloat(ratio);1751 var ratioFloat = upload.ratioToFloat(ratio);
1653 var imgRatio = imageElement.width / imageElement.height;1752 var imgRatio = imgWidth / imgHeight;
1654 if (imgRatio < ratioFloat) {1753 if (imgRatio < ratioFloat) {
1655 width = imageElement.width;1754 width = imgWidth;
1656 height = width / ratioFloat;1755 height = width / ratioFloat;
1657 } else {1756 } else {
1658 height = imageElement.height;1757 height = imgHeight;
1659 width = height * ratioFloat;1758 width = height * ratioFloat;
1660 }1759 }
1661 }1760 }
1662 if (!width) {1761 if (!width) {
1663 width = imageElement.width;1762 width = imgWidth;
1664 }1763 }
1665 if (!height) {1764 if (!height) {
1666 height = imageElement.height;1765 height = imgHeight;
1667 }1766 }
1668 var dimensions = calculateAspectRatioFit(imageElement.width, imageElement.height, width, height, centerCrop);1767 var dimensions = calculateAspectRatioFit(imgWidth, imgHeight, width, height, centerCrop);
1669 canvasElement.width = Math.min(dimensions.width, width);1768 canvasElement.width = Math.min(dimensions.width, width);
1670 canvasElement.height = Math.min(dimensions.height, height);1769 canvasElement.height = Math.min(dimensions.height, height);
1671 var context = canvasElement.getContext('2d');1770 var context = canvasElement.getContext('2d');
@@ -1678,6 +1777,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1678 }1777 }
1679 };1778 };
1680 imageElement.onerror = function () {1779 imageElement.onerror = function () {
1780 imageElement.parentNode.removeChild(imageElement);
1681 deferred.reject();1781 deferred.reject();
1682 };1782 };
1683 imageElement.src = imagen;1783 imageElement.src = imagen;
@@ -1714,14 +1814,15 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1714 });1814 });
1715 }1815 }
17161816
1717 upload.resize = function (file, width, height, quality, type, ratio, centerCrop, resizeIf, restoreExif) {1817 upload.resize = function (file, options) {
1718 if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file);1818 if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file);
17191819
1720 var deferred = $q.defer();1820 var deferred = $q.defer();
1721 upload.dataUrl(file, true).then(function (url) {1821 upload.dataUrl(file, true).then(function (url) {
1722 resize(url, width, height, quality, type || file.type, ratio, centerCrop, resizeIf)1822 resize(url, options.width, options.height, options.quality, options.type || file.type,
1823 options.ratio, options.centerCrop, options.resizeIf)
1723 .then(function (dataUrl) {1824 .then(function (dataUrl) {
1724 if (file.type === 'image/jpeg' && restoreExif) {1825 if (file.type === 'image/jpeg' && options.restoreExif !== false) {
1725 try {1826 try {
1726 dataUrl = upload.restoreExif(url, dataUrl);1827 dataUrl = upload.restoreExif(url, dataUrl);
1727 } catch (e) {1828 } catch (e) {
@@ -1750,13 +1851,13 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1750}]);1851}]);
17511852
1752(function () {1853(function () {
1753 ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$location', 'Upload', '$http', '$q',1854 ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$window', 'Upload', '$http', '$q',
1754 function ($parse, $timeout, $location, Upload, $http, $q) {1855 function ($parse, $timeout, $window, Upload, $http, $q) {
1755 return {1856 return {
1756 restrict: 'AEC',1857 restrict: 'AEC',
1757 require: '?ngModel',1858 require: '?ngModel',
1758 link: function (scope, elem, attr, ngModel) {1859 link: function (scope, elem, attr, ngModel) {
1759 linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, Upload, $http, $q);1860 linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, Upload, $http, $q);
1760 }1861 }
1761 };1862 };
1762 }]);1863 }]);
@@ -1781,7 +1882,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1781 };1882 };
1782 }]);1883 }]);
17831884
1784 function linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, upload, $http, $q) {1885 function linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, upload, $http, $q) {
1785 var available = dropAvailable();1886 var available = dropAvailable();
17861887
1787 var attrGetter = function (name, scope, params) {1888 var attrGetter = function (name, scope, params) {
@@ -1857,23 +1958,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1857 if (stopPropagation(scope)) evt.stopPropagation();1958 if (stopPropagation(scope)) evt.stopPropagation();
1858 if (actualDragOverClass) elem.removeClass(actualDragOverClass);1959 if (actualDragOverClass) elem.removeClass(actualDragOverClass);
1859 actualDragOverClass = null;1960 actualDragOverClass = null;
1860 var items = evt.dataTransfer.items;1961 extractFilesAndUpdateModel(evt.dataTransfer, evt, 'dropUrl');
1861 var html;
1862 try {
1863 html = evt.dataTransfer && evt.dataTransfer.getData && evt.dataTransfer.getData('text/html');
1864 } catch (e) {/* Fix IE11 that throw error calling getData */
1865 }
1866
1867 extractFiles(items, evt.dataTransfer.files, attrGetter('ngfAllowDir', scope) !== false,
1868 attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) {
1869 if (files.length) {
1870 updateModel(files, evt);
1871 } else {
1872 extractFilesFromHtml('dropUrl', html).then(function (files) {
1873 updateModel(files, evt);
1874 });
1875 }
1876 });
1877 }, false);1962 }, false);
1878 elem[0].addEventListener('paste', function (evt) {1963 elem[0].addEventListener('paste', function (evt) {
1879 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&1964 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
@@ -1881,22 +1966,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1881 evt.preventDefault();1966 evt.preventDefault();
1882 }1967 }
1883 if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return;1968 if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return;
1884 var files = [];1969 extractFilesAndUpdateModel(evt.clipboardData || evt.originalEvent.clipboardData, evt, 'pasteUrl');
1885 var clipboard = evt.clipboardData || evt.originalEvent.clipboardData;
1886 if (clipboard && clipboard.items) {
1887 for (var k = 0; k < clipboard.items.length; k++) {
1888 if (clipboard.items[k].type.indexOf('image') !== -1) {
1889 files.push(clipboard.items[k].getAsFile());
1890 }
1891 }
1892 }
1893 if (files.length) {
1894 updateModel(files, evt);
1895 } else {
1896 extractFilesFromHtml('pasteUrl', clipboard).then(function (files) {
1897 updateModel(files, evt);
1898 });
1899 }
1900 }, false);1970 }, false);
19011971
1902 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&1972 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 &&
@@ -1909,12 +1979,33 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1909 });1979 });
1910 }1980 }
19111981
1982 function extractFilesAndUpdateModel(source, evt, updateOnType) {
1983 if (!source) return;
1984 // html needs to be calculated on the same process otherwise the data will be wiped
1985 // after promise resolve or setTimeout.
1986 var html;
1987 try {
1988 html = source && source.getData && source.getData('text/html');
1989 } catch (e) {/* Fix IE11 that throw error calling getData */
1990 }
1991 extractFiles(source.items, source.files, attrGetter('ngfAllowDir', scope) !== false,
1992 attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) {
1993 if (files.length) {
1994 updateModel(files, evt);
1995 } else {
1996 extractFilesFromHtml(updateOnType, html).then(function (files) {
1997 updateModel(files, evt);
1998 });
1999 }
2000 });
2001 }
2002
1912 function updateModel(files, evt) {2003 function updateModel(files, evt) {
1913 upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt);2004 upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt);
1914 }2005 }
19152006
1916 function extractFilesFromHtml(updateOn, html) {2007 function extractFilesFromHtml(updateOn, html) {
1917 if (!upload.shouldUpdateOn(updateOn, attr, scope) || !html) return upload.rejectPromise([]);2008 if (!upload.shouldUpdateOn(updateOn, attr, scope) || typeof html !== 'string') return upload.rejectPromise([]);
1918 var urls = [];2009 var urls = [];
1919 html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) {2010 html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) {
1920 urls.push(src);2011 urls.push(src);
@@ -1965,8 +2056,14 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1965 }2056 }
19662057
1967 function extractFiles(items, fileList, allowDir, multiple) {2058 function extractFiles(items, fileList, allowDir, multiple) {
1968 var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles') || Number.MAX_VALUE;2059 var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles');
1969 var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize') || Number.MAX_VALUE;2060 if (maxFiles == null) {
2061 maxFiles = Number.MAX_VALUE;
2062 }
2063 var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize');
2064 if (maxTotalSize == null) {
2065 maxTotalSize = Number.MAX_VALUE;
2066 }
1970 var includeDir = attrGetter('ngfIncludeDir', scope);2067 var includeDir = attrGetter('ngfIncludeDir', scope);
1971 var files = [], totalSize = 0;2068 var files = [], totalSize = 0;
19722069
@@ -1977,7 +2074,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
1977 var promises = [upload.emptyPromise()];2074 var promises = [upload.emptyPromise()];
1978 if (includeDir) {2075 if (includeDir) {
1979 var file = {type: 'directory'};2076 var file = {type: 'directory'};
1980 file.name = file.path = (path || '') + entry.name + entry.name;2077 file.name = file.path = (path || '') + entry.name;
1981 files.push(file);2078 files.push(file);
1982 }2079 }
1983 var dirReader = entry.createReader();2080 var dirReader = entry.createReader();
@@ -2031,7 +2128,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa
20312128
2032 var promises = [upload.emptyPromise()];2129 var promises = [upload.emptyPromise()];
20332130
2034 if (items && items.length > 0 && $location.protocol() !== 'file') {2131 if (items && items.length > 0 && $window.location.protocol !== 'file:') {
2035 for (var i = 0; i < items.length; i++) {2132 for (var i = 0; i < items.length; i++) {
2036 if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) {2133 if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) {
2037 var entry = items[i].webkitGetAsEntry();2134 var entry = items[i].webkitGetAsEntry();
diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js
index e87a65e..4bfe942 100644
--- a/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js
+++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js
@@ -1,3 +1,3 @@
1/*! 12.0.4 */
2!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){
3return{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}]);
4\ No newline at end of file1\ No newline at end of file
2/*! 12.2.13 */
3!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(),
4v(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}]);
5\ No newline at end of file5\ No newline at end of file
diff --git a/xstatic/pkg/angular_lrdragndrop/__init__.py b/xstatic/pkg/angular_lrdragndrop/__init__.py
index cf9508f..206ee6a 100644
--- a/xstatic/pkg/angular_lrdragndrop/__init__.py
+++ b/xstatic/pkg/angular_lrdragndrop/__init__.py
@@ -17,7 +17,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
1717
18VERSION = '1.0.2' # version of the packaged files, please use the upstream18VERSION = '1.0.2' # version of the packaged files, please use the upstream
19 # version number19 # version number
20BUILD = '4' # our package build number, so we can release new builds20BUILD = '6' # our package build number, so we can release new builds
21 # with fixes for xstatic stuff.21 # with fixes for xstatic stuff.
22PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi22PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi
2323
diff --git a/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js b/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js
index 2b7c383..ce54176 100644
--- a/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js
+++ b/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js
@@ -2,11 +2,21 @@
2 'use strict';2 'use strict';
33
4 function isJqueryEventDataTransfer(){4 function isJqueryEventDataTransfer(){
5 return window.jQuery && (-1 == window.jQuery.event.props.indexOf('dataTransfer'));5 return window.jQuery && (!window.jQuery.event.special.dataTransfer ||
6 !window.jQuery.event.special.dataTransfer.props || -1 ===
7 window.jQuery.event.special.dataTransfer.props.indexOf('dataTransfer'));
6 }8 }
79
8 if (isJqueryEventDataTransfer()) {10 if (isJqueryEventDataTransfer()) {
9 window.jQuery.event.props.push('dataTransfer');11 if (!window.jQuery.event.special.dataTransfer) {
12 window.jQuery.event.special.dataTransfer = {
13 props: ['dataTransfer']
14 };
15 } else if (!window.jQuery.event.special.dataTransfer.props) {
16 window.jQuery.event.special.dataTransfer.props = ['dataTransfer'];
17 } else if (-1 === window.jQuery.event.special.dataTransfer.props.indexOf('dataTransfer')) {
18 window.jQuery.event.special.dataTransfer.props.push('dataTransfer');
19 }
10 }20 }
1121
12 var module = ng.module('lrDragNDrop', []);22 var module = ng.module('lrDragNDrop', []);
@@ -181,4 +191,4 @@
181 }191 }
182 };192 };
183 }]);193 }]);
184})(angular);
185\ No newline at end of file194\ No newline at end of file
195})(angular);
diff --git a/xstatic/pkg/jquery/__init__.py b/xstatic/pkg/jquery/__init__.py
index d2a34ad..78dd92a 100644
--- a/xstatic/pkg/jquery/__init__.py
+++ b/xstatic/pkg/jquery/__init__.py
@@ -11,7 +11,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
11 # please use a all-lowercase valid python11 # please use a all-lowercase valid python
12 # package name12 # package name
1313
14VERSION = '1.12.4' # version of the packaged files, please use the upstream14VERSION = '3.5.1' # version of the packaged files, please use the upstream
15 # version number15 # version number
16BUILD = '1' # our package build number, so we can release new builds16BUILD = '1' # our package build number, so we can release new builds
17 # with fixes for xstatic stuff.17 # with fixes for xstatic stuff.
@@ -51,14 +51,26 @@ LOCATIONS = {
51 ('jquery', 'http'): {51 ('jquery', 'http'): {
52 'jquery.js': 'http://code.jquery.com/jquery-%s.js' % VERSION,52 'jquery.js': 'http://code.jquery.com/jquery-%s.js' % VERSION,
53 'jquery.min.js': 'http://code.jquery.com/jquery-%s.min.js' % VERSION,53 'jquery.min.js': 'http://code.jquery.com/jquery-%s.min.js' % VERSION,
54 'jquery.slim.js': 'http://code.jquery.com/jquery-%s.slim.js' % VERSION,
55 'jquery.slim.min.js': 'http://code.jquery.com/jquery-%s.slim.min.js' % VERSION,
56 },
57 ('jquery', 'https'): {
58 'jquery.js': 'https://code.jquery.com/jquery-%s.js' % VERSION,
59 'jquery.min.js': 'https://code.jquery.com/jquery-%s.min.js' % VERSION,
60 'jquery.slim.js': 'https://code.jquery.com/jquery-%s.slim.js' % VERSION,
61 'jquery.slim.min.js': 'https://code.jquery.com/jquery-%s.slim.min.js' % VERSION,
54 },62 },
55 ('microsoft', 'http'): {63 ('microsoft', 'http'): {
56 'jquery.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % VERSION,64 'jquery.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % VERSION,
57 'jquery.min.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % VERSION,65 'jquery.min.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % VERSION,
66 'jquery.slim.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.js' % VERSION,
67 'jquery.slim.min.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.min.js' % VERSION,
58 },68 },
59 ('microsoft', 'https'): {69 ('microsoft', 'https'): {
60 'jquery.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % VERSION,70 'jquery.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.js' % VERSION,
61 'jquery.min.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % VERSION,71 'jquery.min.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.min.js' % VERSION,
72 'jquery.slim.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.js' % VERSION,
73 'jquery.slim.min.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.min.js' % VERSION,
62 },74 },
63}75}
6476
diff --git a/xstatic/pkg/jquery/data/jquery.js b/xstatic/pkg/jquery/data/jquery.js
index 7fc60fc..5093733 100644
--- a/xstatic/pkg/jquery/data/jquery.js
+++ b/xstatic/pkg/jquery/data/jquery.js
@@ -1,20 +1,22 @@
1/*!1/*!
2 * jQuery JavaScript Library v1.12.42 * jQuery JavaScript Library v3.5.1
3 * http://jquery.com/3 * https://jquery.com/
4 *4 *
5 * Includes Sizzle.js5 * Includes Sizzle.js
6 * http://sizzlejs.com/6 * https://sizzlejs.com/
7 *7 *
8 * Copyright jQuery Foundation and other contributors8 * Copyright JS Foundation and other contributors
9 * Released under the MIT license9 * Released under the MIT license
10 * http://jquery.org/license10 * https://jquery.org/license
11 *11 *
12 * Date: 2016-05-20T17:17Z12 * Date: 2020-05-04T22:49Z
13 */13 */
14( function( global, factory ) {
1415
15(function( global, factory ) {16 "use strict";
1617
17 if ( typeof module === "object" && typeof module.exports === "object" ) {18 if ( typeof module === "object" && typeof module.exports === "object" ) {
19
18 // For CommonJS and CommonJS-like environments where a proper `window`20 // For CommonJS and CommonJS-like environments where a proper `window`
19 // is present, execute the factory and get jQuery.21 // is present, execute the factory and get jQuery.
20 // For environments that do not have a `window` with a `document`22 // For environments that do not have a `window` with a `document`
@@ -35,24 +37,30 @@
35 }37 }
3638
37// Pass this if window is not defined yet39// Pass this if window is not defined yet
38}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {40} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
3941
40// Support: Firefox 18+42// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
41// Can't be in strict mode, several libs including ASP.NET trace43// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
42// the stack via arguments.caller.callee and Firefox dies if44// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
43// you try to trace through "use strict" call chains. (#13335)45// enough that all such attempts are guarded in a try block.
44//"use strict";46"use strict";
45var deletedIds = [];
4647
47var document = window.document;48var arr = [];
49
50var getProto = Object.getPrototypeOf;
51
52var slice = arr.slice;
4853
49var slice = deletedIds.slice;54var flat = arr.flat ? function( array ) {
55 return arr.flat.call( array );
56} : function( array ) {
57 return arr.concat.apply( [], array );
58};
5059
51var concat = deletedIds.concat;
5260
53var push = deletedIds.push;61var push = arr.push;
5462
55var indexOf = deletedIds.indexOf;63var indexOf = arr.indexOf;
5664
57var class2type = {};65var class2type = {};
5866
@@ -60,12 +68,86 @@ var toString = class2type.toString;
6068
61var hasOwn = class2type.hasOwnProperty;69var hasOwn = class2type.hasOwnProperty;
6270
71var fnToString = hasOwn.toString;
72
73var ObjectFunctionString = fnToString.call( Object );
74
63var support = {};75var support = {};
6476
77var isFunction = function isFunction( obj ) {
78
79 // Support: Chrome <=57, Firefox <=52
80 // In some browsers, typeof returns "function" for HTML <object> elements
81 // (i.e., `typeof document.createElement( "object" ) === "function"`).
82 // We don't want to classify *any* DOM node as a function.
83 return typeof obj === "function" && typeof obj.nodeType !== "number";
84 };
85
86
87var isWindow = function isWindow( obj ) {
88 return obj != null && obj === obj.window;
89 };
90
91
92var document = window.document;
93
94
95
96 var preservedScriptAttributes = {
97 type: true,
98 src: true,
99 nonce: true,
100 noModule: true
101 };
102
103 function DOMEval( code, node, doc ) {
104 doc = doc || document;
105
106 var i, val,
107 script = doc.createElement( "script" );
108
109 script.text = code;
110 if ( node ) {
111 for ( i in preservedScriptAttributes ) {
112
113 // Support: Firefox 64+, Edge 18+
114 // Some browsers don't support the "nonce" property on scripts.
115 // On the other hand, just using `getAttribute` is not enough as
116 // the `nonce` attribute is reset to an empty string whenever it
117 // becomes browsing-context connected.
118 // See https://github.com/whatwg/html/issues/2369
119 // See https://html.spec.whatwg.org/#nonce-attributes
120 // The `node.getAttribute` check was added for the sake of
121 // `jQuery.globalEval` so that it can fake a nonce-containing node
122 // via an object.
123 val = node[ i ] || node.getAttribute && node.getAttribute( i );
124 if ( val ) {
125 script.setAttribute( i, val );
126 }
127 }
128 }
129 doc.head.appendChild( script ).parentNode.removeChild( script );
130 }
131
132
133function toType( obj ) {
134 if ( obj == null ) {
135 return obj + "";
136 }
137
138 // Support: Android <=2.3 only (functionish RegExp)
139 return typeof obj === "object" || typeof obj === "function" ?
140 class2type[ toString.call( obj ) ] || "object" :
141 typeof obj;
142}
143/* global Symbol */
144// Defining this global in .eslintrc.json would create a danger of using the global
145// unguarded in another place, it seems safer to define global only for this module
146
65147
66148
67var149var
68 version = "1.12.4",150 version = "3.5.1",
69151
70 // Define a local copy of jQuery152 // Define a local copy of jQuery
71 jQuery = function( selector, context ) {153 jQuery = function( selector, context ) {
@@ -73,19 +155,6 @@ var
73 // The jQuery object is actually just the init constructor 'enhanced'155 // The jQuery object is actually just the init constructor 'enhanced'
74 // Need init if jQuery is called (just allow error to be thrown if not included)156 // Need init if jQuery is called (just allow error to be thrown if not included)
75 return new jQuery.fn.init( selector, context );157 return new jQuery.fn.init( selector, context );
76 },
77
78 // Support: Android<4.1, IE<9
79 // Make sure we trim BOM and NBSP
80 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
81
82 // Matches dashed string for camelizing
83 rmsPrefix = /^-ms-/,
84 rdashAlpha = /-([\da-z])/gi,
85
86 // Used by jQuery.camelCase as callback to replace()
87 fcamelCase = function( all, letter ) {
88 return letter.toUpperCase();
89 };158 };
90159
91jQuery.fn = jQuery.prototype = {160jQuery.fn = jQuery.prototype = {
@@ -95,9 +164,6 @@ jQuery.fn = jQuery.prototype = {
95164
96 constructor: jQuery,165 constructor: jQuery,
97166
98 // Start with an empty selector
99 selector: "",
100
101 // The default length of a jQuery object is 0167 // The default length of a jQuery object is 0
102 length: 0,168 length: 0,
103169
@@ -108,13 +174,14 @@ jQuery.fn = jQuery.prototype = {
108 // Get the Nth element in the matched element set OR174 // Get the Nth element in the matched element set OR
109 // Get the whole matched element set as a clean array175 // Get the whole matched element set as a clean array
110 get: function( num ) {176 get: function( num ) {
111 return num != null ?
112177
113 // Return just the one element from the set178 // Return all the elements in a clean array
114 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :179 if ( num == null ) {
180 return slice.call( this );
181 }
115182
116 // Return all the elements in a clean array183 // Return just the one element from the set
117 slice.call( this );184 return num < 0 ? this[ num + this.length ] : this[ num ];
118 },185 },
119186
120 // Take an array of elements and push it onto the stack187 // Take an array of elements and push it onto the stack
@@ -126,7 +193,6 @@ jQuery.fn = jQuery.prototype = {
126193
127 // Add the old object onto the stack (as a reference)194 // Add the old object onto the stack (as a reference)
128 ret.prevObject = this;195 ret.prevObject = this;
129 ret.context = this.context;
130196
131 // Return the newly-formed element set197 // Return the newly-formed element set
132 return ret;198 return ret;
@@ -155,6 +221,18 @@ jQuery.fn = jQuery.prototype = {
155 return this.eq( -1 );221 return this.eq( -1 );
156 },222 },
157223
224 even: function() {
225 return this.pushStack( jQuery.grep( this, function( _elem, i ) {
226 return ( i + 1 ) % 2;
227 } ) );
228 },
229
230 odd: function() {
231 return this.pushStack( jQuery.grep( this, function( _elem, i ) {
232 return i % 2;
233 } ) );
234 },
235
158 eq: function( i ) {236 eq: function( i ) {
159 var len = this.length,237 var len = this.length,
160 j = +i + ( i < 0 ? len : 0 );238 j = +i + ( i < 0 ? len : 0 );
@@ -168,12 +246,12 @@ jQuery.fn = jQuery.prototype = {
168 // For internal use only.246 // For internal use only.
169 // Behaves like an Array's method, not like a jQuery method.247 // Behaves like an Array's method, not like a jQuery method.
170 push: push,248 push: push,
171 sort: deletedIds.sort,249 sort: arr.sort,
172 splice: deletedIds.splice250 splice: arr.splice
173};251};
174252
175jQuery.extend = jQuery.fn.extend = function() {253jQuery.extend = jQuery.fn.extend = function() {
176 var src, copyIsArray, copy, name, options, clone,254 var options, name, src, copy, copyIsArray, clone,
177 target = arguments[ 0 ] || {},255 target = arguments[ 0 ] || {},
178 i = 1,256 i = 1,
179 length = arguments.length,257 length = arguments.length,
@@ -183,17 +261,17 @@ jQuery.extend = jQuery.fn.extend = function() {
183 if ( typeof target === "boolean" ) {261 if ( typeof target === "boolean" ) {
184 deep = target;262 deep = target;
185263
186 // skip the boolean and the target264 // Skip the boolean and the target
187 target = arguments[ i ] || {};265 target = arguments[ i ] || {};
188 i++;266 i++;
189 }267 }
190268
191 // Handle case when target is a string or something (possible in deep copy)269 // Handle case when target is a string or something (possible in deep copy)
192 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {270 if ( typeof target !== "object" && !isFunction( target ) ) {
193 target = {};271 target = {};
194 }272 }
195273
196 // extend jQuery itself if only one argument is passed274 // Extend jQuery itself if only one argument is passed
197 if ( i === length ) {275 if ( i === length ) {
198 target = this;276 target = this;
199 i--;277 i--;
@@ -206,25 +284,28 @@ jQuery.extend = jQuery.fn.extend = function() {
206284
207 // Extend the base object285 // Extend the base object
208 for ( name in options ) {286 for ( name in options ) {
209 src = target[ name ];
210 copy = options[ name ];287 copy = options[ name ];
211288
289 // Prevent Object.prototype pollution
212 // Prevent never-ending loop290 // Prevent never-ending loop
213 if ( target === copy ) {291 if ( name === "__proto__" || target === copy ) {
214 continue;292 continue;
215 }293 }
216294
217 // Recurse if we're merging plain objects or arrays295 // Recurse if we're merging plain objects or arrays
218 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||296 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
219 ( copyIsArray = jQuery.isArray( copy ) ) ) ) {297 ( copyIsArray = Array.isArray( copy ) ) ) ) {
220298 src = target[ name ];
221 if ( copyIsArray ) {299
222 copyIsArray = false;300 // Ensure proper type for the source value
223 clone = src && jQuery.isArray( src ) ? src : [];301 if ( copyIsArray && !Array.isArray( src ) ) {
224302 clone = [];
303 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
304 clone = {};
225 } else {305 } else {
226 clone = src && jQuery.isPlainObject( src ) ? src : {};306 clone = src;
227 }307 }
308 copyIsArray = false;
228309
229 // Never move original objects, clone them310 // Never move original objects, clone them
230 target[ name ] = jQuery.extend( deep, clone, copy );311 target[ name ] = jQuery.extend( deep, clone, copy );
@@ -255,110 +336,40 @@ jQuery.extend( {
255336
256 noop: function() {},337 noop: function() {},
257338
258 // See test/unit/core.js for details concerning isFunction.
259 // Since version 1.3, DOM methods and functions like alert
260 // aren't supported. They return false on IE (#2968).
261 isFunction: function( obj ) {
262 return jQuery.type( obj ) === "function";
263 },
264
265 isArray: Array.isArray || function( obj ) {
266 return jQuery.type( obj ) === "array";
267 },
268
269 isWindow: function( obj ) {
270 /* jshint eqeqeq: false */
271 return obj != null && obj == obj.window;
272 },
273
274 isNumeric: function( obj ) {
275
276 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
277 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
278 // subtraction forces infinities to NaN
279 // adding 1 corrects loss of precision from parseFloat (#15100)
280 var realStringObj = obj && obj.toString();
281 return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
282 },
283
284 isEmptyObject: function( obj ) {
285 var name;
286 for ( name in obj ) {
287 return false;
288 }
289 return true;
290 },
291
292 isPlainObject: function( obj ) {339 isPlainObject: function( obj ) {
293 var key;340 var proto, Ctor;
294341
295 // Must be an Object.342 // Detect obvious negatives
296 // Because of IE, we also have to check the presence of the constructor property.343 // Use toString instead of jQuery.type to catch host objects
297 // Make sure that DOM nodes and window objects don't pass through, as well344 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
298 if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
299 return false;345 return false;
300 }346 }
301347
302 try {348 proto = getProto( obj );
303
304 // Not own constructor property must be Object
305 if ( obj.constructor &&
306 !hasOwn.call( obj, "constructor" ) &&
307 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
308 return false;
309 }
310 } catch ( e ) {
311
312 // IE8,9 Will throw exceptions on certain host objects #9897
313 return false;
314 }
315349
316 // Support: IE<9350 // Objects with no prototype (e.g., `Object.create( null )`) are plain
317 // Handle iteration over inherited properties before own properties.351 if ( !proto ) {
318 if ( !support.ownFirst ) {352 return true;
319 for ( key in obj ) {
320 return hasOwn.call( obj, key );
321 }
322 }353 }
323354
324 // Own properties are enumerated firstly, so to speed up,355 // Objects with prototype are plain iff they were constructed by a global Object function
325 // if last one is own, then all properties are own.356 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
326 for ( key in obj ) {}357 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
327
328 return key === undefined || hasOwn.call( obj, key );
329 },
330
331 type: function( obj ) {
332 if ( obj == null ) {
333 return obj + "";
334 }
335 return typeof obj === "object" || typeof obj === "function" ?
336 class2type[ toString.call( obj ) ] || "object" :
337 typeof obj;
338 },358 },
339359
340 // Workarounds based on findings by Jim Driscoll360 isEmptyObject: function( obj ) {
341 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context361 var name;
342 globalEval: function( data ) {
343 if ( data && jQuery.trim( data ) ) {
344362
345 // We use execScript on Internet Explorer363 for ( name in obj ) {
346 // We use an anonymous function so that context is window364 return false;
347 // rather than jQuery in Firefox
348 ( window.execScript || function( data ) {
349 window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
350 } )( data );
351 }365 }
366 return true;
352 },367 },
353368
354 // Convert dashed to camelCase; used by the css and data modules369 // Evaluates a script in a provided context; falls back to the global one
355 // Microsoft forgot to hump their vendor prefix (#9572)370 // if not specified.
356 camelCase: function( string ) {371 globalEval: function( code, options, doc ) {
357 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );372 DOMEval( code, { nonce: options && options.nonce }, doc );
358 },
359
360 nodeName: function( elem, name ) {
361 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
362 },373 },
363374
364 each: function( obj, callback ) {375 each: function( obj, callback ) {
@@ -382,13 +393,6 @@ jQuery.extend( {
382 return obj;393 return obj;
383 },394 },
384395
385 // Support: Android<4.1, IE<9
386 trim: function( text ) {
387 return text == null ?
388 "" :
389 ( text + "" ).replace( rtrim, "" );
390 },
391
392 // results is for internal usage only396 // results is for internal usage only
393 makeArray: function( arr, results ) {397 makeArray: function( arr, results ) {
394 var ret = results || [];398 var ret = results || [];
@@ -408,43 +412,18 @@ jQuery.extend( {
408 },412 },
409413
410 inArray: function( elem, arr, i ) {414 inArray: function( elem, arr, i ) {
411 var len;415 return arr == null ? -1 : indexOf.call( arr, elem, i );
412
413 if ( arr ) {
414 if ( indexOf ) {
415 return indexOf.call( arr, elem, i );
416 }
417
418 len = arr.length;
419 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
420
421 for ( ; i < len; i++ ) {
422
423 // Skip accessing in sparse arrays
424 if ( i in arr && arr[ i ] === elem ) {
425 return i;
426 }
427 }
428 }
429
430 return -1;
431 },416 },
432417
418 // Support: Android <=4.0 only, PhantomJS 1 only
419 // push.apply(_, arraylike) throws on ancient WebKit
433 merge: function( first, second ) {420 merge: function( first, second ) {
434 var len = +second.length,421 var len = +second.length,
435 j = 0,422 j = 0,
436 i = first.length;423 i = first.length;
437424
438 while ( j < len ) {425 for ( ; j < len; j++ ) {
439 first[ i++ ] = second[ j++ ];426 first[ i++ ] = second[ j ];
440 }
441
442 // Support: IE<9
443 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
444 if ( len !== len ) {
445 while ( second[ j ] !== undefined ) {
446 first[ i++ ] = second[ j++ ];
447 }
448 }427 }
449428
450 first.length = i;429 first.length = i;
@@ -500,76 +479,37 @@ jQuery.extend( {
500 }479 }
501480
502 // Flatten any nested arrays481 // Flatten any nested arrays
503 return concat.apply( [], ret );482 return flat( ret );
504 },483 },
505484
506 // A global GUID counter for objects485 // A global GUID counter for objects
507 guid: 1,486 guid: 1,
508487
509 // Bind a function to a context, optionally partially applying any
510 // arguments.
511 proxy: function( fn, context ) {
512 var args, proxy, tmp;
513
514 if ( typeof context === "string" ) {
515 tmp = fn[ context ];
516 context = fn;
517 fn = tmp;
518 }
519
520 // Quick check to determine if target is callable, in the spec
521 // this throws a TypeError, but we will just return undefined.
522 if ( !jQuery.isFunction( fn ) ) {
523 return undefined;
524 }
525
526 // Simulated bind
527 args = slice.call( arguments, 2 );
528 proxy = function() {
529 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
530 };
531
532 // Set the guid of unique handler to the same of original handler, so it can be removed
533 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
534
535 return proxy;
536 },
537
538 now: function() {
539 return +( new Date() );
540 },
541
542 // jQuery.support is not used in Core but other projects attach their488 // jQuery.support is not used in Core but other projects attach their
543 // properties to it so it needs to exist.489 // properties to it so it needs to exist.
544 support: support490 support: support
545} );491} );
546492
547// JSHint would error on this code due to the Symbol not being defined in ES5.
548// Defining this global in .jshintrc would create a danger of using the global
549// unguarded in another place, it seems safer to just disable JSHint for these
550// three lines.
551/* jshint ignore: start */
552if ( typeof Symbol === "function" ) {493if ( typeof Symbol === "function" ) {
553 jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];494 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
554}495}
555/* jshint ignore: end */
556496
557// Populate the class2type map497// Populate the class2type map
558jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),498jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
559function( i, name ) {499function( _i, name ) {
560 class2type[ "[object " + name + "]" ] = name.toLowerCase();500 class2type[ "[object " + name + "]" ] = name.toLowerCase();
561} );501} );
562502
563function isArrayLike( obj ) {503function isArrayLike( obj ) {
564504
565 // Support: iOS 8.2 (not reproducible in simulator)505 // Support: real iOS 8.2 only (not reproducible in simulator)
566 // `in` check used to prevent JIT error (gh-2145)506 // `in` check used to prevent JIT error (gh-2145)
567 // hasOwn isn't used here due to false negatives507 // hasOwn isn't used here due to false negatives
568 // regarding Nodelist length in IE508 // regarding Nodelist length in IE
569 var length = !!obj && "length" in obj && obj.length,509 var length = !!obj && "length" in obj && obj.length,
570 type = jQuery.type( obj );510 type = toType( obj );
571511
572 if ( type === "function" || jQuery.isWindow( obj ) ) {512 if ( isFunction( obj ) || isWindow( obj ) ) {
573 return false;513 return false;
574 }514 }
575515
@@ -578,17 +518,16 @@ function isArrayLike( obj ) {
578}518}
579var Sizzle =519var Sizzle =
580/*!520/*!
581 * Sizzle CSS Selector Engine v2.2.1521 * Sizzle CSS Selector Engine v2.3.5
582 * http://sizzlejs.com/522 * https://sizzlejs.com/
583 *523 *
584 * Copyright jQuery Foundation and other contributors524 * Copyright JS Foundation and other contributors
585 * Released under the MIT license525 * Released under the MIT license
586 * http://jquery.org/license526 * https://js.foundation/
587 *527 *
588 * Date: 2015-10-17528 * Date: 2020-03-14
589 */529 */
590(function( window ) {530( function( window ) {
591
592var i,531var i,
593 support,532 support,
594 Expr,533 Expr,
@@ -619,6 +558,7 @@ var i,
619 classCache = createCache(),558 classCache = createCache(),
620 tokenCache = createCache(),559 tokenCache = createCache(),
621 compilerCache = createCache(),560 compilerCache = createCache(),
561 nonnativeSelectorCache = createCache(),
622 sortOrder = function( a, b ) {562 sortOrder = function( a, b ) {
623 if ( a === b ) {563 if ( a === b ) {
624 hasDuplicate = true;564 hasDuplicate = true;
@@ -626,65 +566,72 @@ var i,
626 return 0;566 return 0;
627 },567 },
628568
629 // General-purpose constants
630 MAX_NEGATIVE = 1 << 31,
631
632 // Instance methods569 // Instance methods
633 hasOwn = ({}).hasOwnProperty,570 hasOwn = ( {} ).hasOwnProperty,
634 arr = [],571 arr = [],
635 pop = arr.pop,572 pop = arr.pop,
636 push_native = arr.push,573 pushNative = arr.push,
637 push = arr.push,574 push = arr.push,
638 slice = arr.slice,575 slice = arr.slice,
576
639 // Use a stripped-down indexOf as it's faster than native577 // Use a stripped-down indexOf as it's faster than native
640 // http://jsperf.com/thor-indexof-vs-for/5578 // https://jsperf.com/thor-indexof-vs-for/5
641 indexOf = function( list, elem ) {579 indexOf = function( list, elem ) {
642 var i = 0,580 var i = 0,
643 len = list.length;581 len = list.length;
644 for ( ; i < len; i++ ) {582 for ( ; i < len; i++ ) {
645 if ( list[i] === elem ) {583 if ( list[ i ] === elem ) {
646 return i;584 return i;
647 }585 }
648 }586 }
649 return -1;587 return -1;
650 },588 },
651589
652 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",590 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
591 "ismap|loop|multiple|open|readonly|required|scoped",
653592
654 // Regular expressions593 // Regular expressions
655594
656 // http://www.w3.org/TR/css3-selectors/#whitespace595 // http://www.w3.org/TR/css3-selectors/#whitespace
657 whitespace = "[\\x20\\t\\r\\n\\f]",596 whitespace = "[\\x20\\t\\r\\n\\f]",
658597
659 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier598 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
660 identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",599 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
600 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
661601
662 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors602 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
663 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +603 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
604
664 // Operator (capture 2)605 // Operator (capture 2)
665 "*([*^$|!~]?=)" + whitespace +606 "*([*^$|!~]?=)" + whitespace +
666 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"607
667 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +608 // "Attribute values must be CSS identifiers [capture 5]
668 "*\\]",609 // or strings [capture 3 or capture 4]"
610 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
611 whitespace + "*\\]",
669612
670 pseudos = ":(" + identifier + ")(?:\\((" +613 pseudos = ":(" + identifier + ")(?:\\((" +
614
671 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:615 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
672 // 1. quoted (capture 3; capture 4 or capture 5)616 // 1. quoted (capture 3; capture 4 or capture 5)
673 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +617 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
618
674 // 2. simple (capture 6)619 // 2. simple (capture 6)
675 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +620 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
621
676 // 3. anything else (capture 2)622 // 3. anything else (capture 2)
677 ".*" +623 ".*" +
678 ")\\)|)",624 ")\\)|)",
679625
680 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter626 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
681 rwhitespace = new RegExp( whitespace + "+", "g" ),627 rwhitespace = new RegExp( whitespace + "+", "g" ),
682 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),628 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
629 whitespace + "+$", "g" ),
683630
684 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),631 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
685 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),632 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
686633 "*" ),
687 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),634 rdescend = new RegExp( whitespace + "|>" ),
688635
689 rpseudo = new RegExp( pseudos ),636 rpseudo = new RegExp( pseudos ),
690 ridentifier = new RegExp( "^" + identifier + "$" ),637 ridentifier = new RegExp( "^" + identifier + "$" ),
@@ -695,16 +642,19 @@ var i,
695 "TAG": new RegExp( "^(" + identifier + "|[*])" ),642 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
696 "ATTR": new RegExp( "^" + attributes ),643 "ATTR": new RegExp( "^" + attributes ),
697 "PSEUDO": new RegExp( "^" + pseudos ),644 "PSEUDO": new RegExp( "^" + pseudos ),
698 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +645 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
699 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +646 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
700 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),647 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
701 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),648 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
649
702 // For use in libraries implementing .is()650 // For use in libraries implementing .is()
703 // We use this for POS matching in `select`651 // We use this for POS matching in `select`
704 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +652 "needsContext": new RegExp( "^" + whitespace +
705 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )653 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
654 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
706 },655 },
707656
657 rhtml = /HTML$/i,
708 rinputs = /^(?:input|select|textarea|button)$/i,658 rinputs = /^(?:input|select|textarea|button)$/i,
709 rheader = /^h\d$/i,659 rheader = /^h\d$/i,
710660
@@ -714,47 +664,79 @@ var i,
714 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,664 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
715665
716 rsibling = /[+~]/,666 rsibling = /[+~]/,
717 rescape = /'|\\/g,667
718668 // CSS escapes
719 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters669 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
720 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),670 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
721 funescape = function( _, escaped, escapedWhitespace ) {671 funescape = function( escape, nonHex ) {
722 var high = "0x" + escaped - 0x10000;672 var high = "0x" + escape.slice( 1 ) - 0x10000;
723 // NaN means non-codepoint673
724 // Support: Firefox<24674 return nonHex ?
725 // Workaround erroneous numeric interpretation of +"0x"675
726 return high !== high || escapedWhitespace ?676 // Strip the backslash prefix from a non-hex escape sequence
727 escaped :677 nonHex :
678
679 // Replace a hexadecimal escape sequence with the encoded Unicode code point
680 // Support: IE <=11+
681 // For values outside the Basic Multilingual Plane (BMP), manually construct a
682 // surrogate pair
728 high < 0 ?683 high < 0 ?
729 // BMP codepoint
730 String.fromCharCode( high + 0x10000 ) :684 String.fromCharCode( high + 0x10000 ) :
731 // Supplemental Plane codepoint (surrogate pair)
732 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );685 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
733 },686 },
734687
688 // CSS string/identifier serialization
689 // https://drafts.csswg.org/cssom/#common-serializing-idioms
690 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
691 fcssescape = function( ch, asCodePoint ) {
692 if ( asCodePoint ) {
693
694 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
695 if ( ch === "\0" ) {
696 return "\uFFFD";
697 }
698
699 // Control characters and (dependent upon position) numbers get escaped as code points
700 return ch.slice( 0, -1 ) + "\\" +
701 ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
702 }
703
704 // Other potentially-special ASCII characters get backslash-escaped
705 return "\\" + ch;
706 },
707
735 // Used for iframes708 // Used for iframes
736 // See setDocument()709 // See setDocument()
737 // Removing the function wrapper causes a "Permission Denied"710 // Removing the function wrapper causes a "Permission Denied"
738 // error in IE711 // error in IE
739 unloadHandler = function() {712 unloadHandler = function() {
740 setDocument();713 setDocument();
741 };714 },
715
716 inDisabledFieldset = addCombinator(
717 function( elem ) {
718 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
719 },
720 { dir: "parentNode", next: "legend" }
721 );
742722
743// Optimize for push.apply( _, NodeList )723// Optimize for push.apply( _, NodeList )
744try {724try {
745 push.apply(725 push.apply(
746 (arr = slice.call( preferredDoc.childNodes )),726 ( arr = slice.call( preferredDoc.childNodes ) ),
747 preferredDoc.childNodes727 preferredDoc.childNodes
748 );728 );
729
749 // Support: Android<4.0730 // Support: Android<4.0
750 // Detect silently failing push.apply731 // Detect silently failing push.apply
732 // eslint-disable-next-line no-unused-expressions
751 arr[ preferredDoc.childNodes.length ].nodeType;733 arr[ preferredDoc.childNodes.length ].nodeType;
752} catch ( e ) {734} catch ( e ) {
753 push = { apply: arr.length ?735 push = { apply: arr.length ?
754736
755 // Leverage slice if possible737 // Leverage slice if possible
756 function( target, els ) {738 function( target, els ) {
757 push_native.apply( target, slice.call(els) );739 pushNative.apply( target, slice.call( els ) );
758 } :740 } :
759741
760 // Support: IE<9742 // Support: IE<9
@@ -762,15 +744,16 @@ try {
762 function( target, els ) {744 function( target, els ) {
763 var j = target.length,745 var j = target.length,
764 i = 0;746 i = 0;
747
765 // Can't trust NodeList.length748 // Can't trust NodeList.length
766 while ( (target[j++] = els[i++]) ) {}749 while ( ( target[ j++ ] = els[ i++ ] ) ) {}
767 target.length = j - 1;750 target.length = j - 1;
768 }751 }
769 };752 };
770}753}
771754
772function Sizzle( selector, context, results, seed ) {755function Sizzle( selector, context, results, seed ) {
773 var m, i, elem, nid, nidselect, match, groups, newSelector,756 var m, i, elem, nid, match, groups, newSelector,
774 newContext = context && context.ownerDocument,757 newContext = context && context.ownerDocument,
775758
776 // nodeType defaults to 9, since context defaults to document759 // nodeType defaults to 9, since context defaults to document
@@ -787,24 +770,21 @@ function Sizzle( selector, context, results, seed ) {
787770
788 // Try to shortcut find operations (as opposed to filters) in HTML documents771 // Try to shortcut find operations (as opposed to filters) in HTML documents
789 if ( !seed ) {772 if ( !seed ) {
790773 setDocument( context );
791 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
792 setDocument( context );
793 }
794 context = context || document;774 context = context || document;
795775
796 if ( documentIsHTML ) {776 if ( documentIsHTML ) {
797777
798 // If the selector is sufficiently simple, try using a "get*By*" DOM method778 // If the selector is sufficiently simple, try using a "get*By*" DOM method
799 // (excepting DocumentFragment context, where the methods don't exist)779 // (excepting DocumentFragment context, where the methods don't exist)
800 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {780 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
801781
802 // ID selector782 // ID selector
803 if ( (m = match[1]) ) {783 if ( ( m = match[ 1 ] ) ) {
804784
805 // Document context785 // Document context
806 if ( nodeType === 9 ) {786 if ( nodeType === 9 ) {
807 if ( (elem = context.getElementById( m )) ) {787 if ( ( elem = context.getElementById( m ) ) ) {
808788
809 // Support: IE, Opera, Webkit789 // Support: IE, Opera, Webkit
810 // TODO: identify versions790 // TODO: identify versions
@@ -823,7 +803,7 @@ function Sizzle( selector, context, results, seed ) {
823 // Support: IE, Opera, Webkit803 // Support: IE, Opera, Webkit
824 // TODO: identify versions804 // TODO: identify versions
825 // getElementById can match elements by name instead of ID805 // getElementById can match elements by name instead of ID
826 if ( newContext && (elem = newContext.getElementById( m )) &&806 if ( newContext && ( elem = newContext.getElementById( m ) ) &&
827 contains( context, elem ) &&807 contains( context, elem ) &&
828 elem.id === m ) {808 elem.id === m ) {
829809
@@ -833,12 +813,12 @@ function Sizzle( selector, context, results, seed ) {
833 }813 }
834814
835 // Type selector815 // Type selector
836 } else if ( match[2] ) {816 } else if ( match[ 2 ] ) {
837 push.apply( results, context.getElementsByTagName( selector ) );817 push.apply( results, context.getElementsByTagName( selector ) );
838 return results;818 return results;
839819
840 // Class selector820 // Class selector
841 } else if ( (m = match[3]) && support.getElementsByClassName &&821 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
842 context.getElementsByClassName ) {822 context.getElementsByClassName ) {
843823
844 push.apply( results, context.getElementsByClassName( m ) );824 push.apply( results, context.getElementsByClassName( m ) );
@@ -848,51 +828,62 @@ function Sizzle( selector, context, results, seed ) {
848828
849 // Take advantage of querySelectorAll829 // Take advantage of querySelectorAll
850 if ( support.qsa &&830 if ( support.qsa &&
851 !compilerCache[ selector + " " ] &&831 !nonnativeSelectorCache[ selector + " " ] &&
852 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {832 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
853833
854 if ( nodeType !== 1 ) {834 // Support: IE 8 only
855 newContext = context;
856 newSelector = selector;
857
858 // qSA looks outside Element context, which is not what we want
859 // Thanks to Andrew Dupont for this workaround technique
860 // Support: IE <=8
861 // Exclude object elements835 // Exclude object elements
862 } else if ( context.nodeName.toLowerCase() !== "object" ) {836 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
863837
864 // Capture the context ID, setting it first if necessary838 newSelector = selector;
865 if ( (nid = context.getAttribute( "id" )) ) {839 newContext = context;
866 nid = nid.replace( rescape, "\\$&" );840
867 } else {841 // qSA considers elements outside a scoping root when evaluating child or
868 context.setAttribute( "id", (nid = expando) );842 // descendant combinators, which is not what we want.
843 // In such cases, we work around the behavior by prefixing every selector in the
844 // list with an ID selector referencing the scope context.
845 // The technique has to be used as well when a leading combinator is used
846 // as such selectors are not recognized by querySelectorAll.
847 // Thanks to Andrew Dupont for this technique.
848 if ( nodeType === 1 &&
849 ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
850
851 // Expand context for sibling selectors
852 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
853 context;
854
855 // We can use :scope instead of the ID hack if the browser
856 // supports it & if we're not changing the context.
857 if ( newContext !== context || !support.scope ) {
858
859 // Capture the context ID, setting it first if necessary
860 if ( ( nid = context.getAttribute( "id" ) ) ) {
861 nid = nid.replace( rcssescape, fcssescape );
862 } else {
863 context.setAttribute( "id", ( nid = expando ) );
864 }
869 }865 }
870866
871 // Prefix every selector in the list867 // Prefix every selector in the list
872 groups = tokenize( selector );868 groups = tokenize( selector );
873 i = groups.length;869 i = groups.length;
874 nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
875 while ( i-- ) {870 while ( i-- ) {
876 groups[i] = nidselect + " " + toSelector( groups[i] );871 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
872 toSelector( groups[ i ] );
877 }873 }
878 newSelector = groups.join( "," );874 newSelector = groups.join( "," );
879
880 // Expand context for sibling selectors
881 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
882 context;
883 }875 }
884876
885 if ( newSelector ) {877 try {
886 try {878 push.apply( results,
887 push.apply( results,879 newContext.querySelectorAll( newSelector )
888 newContext.querySelectorAll( newSelector )880 );
889 );881 return results;
890 return results;882 } catch ( qsaError ) {
891 } catch ( qsaError ) {883 nonnativeSelectorCache( selector, true );
892 } finally {884 } finally {
893 if ( nid === expando ) {885 if ( nid === expando ) {
894 context.removeAttribute( "id" );886 context.removeAttribute( "id" );
895 }
896 }887 }
897 }888 }
898 }889 }
@@ -913,12 +904,14 @@ function createCache() {
913 var keys = [];904 var keys = [];
914905
915 function cache( key, value ) {906 function cache( key, value ) {
907
916 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)908 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
917 if ( keys.push( key + " " ) > Expr.cacheLength ) {909 if ( keys.push( key + " " ) > Expr.cacheLength ) {
910
918 // Only keep the most recent entries911 // Only keep the most recent entries
919 delete cache[ keys.shift() ];912 delete cache[ keys.shift() ];
920 }913 }
921 return (cache[ key + " " ] = value);914 return ( cache[ key + " " ] = value );
922 }915 }
923 return cache;916 return cache;
924}917}
@@ -934,22 +927,24 @@ function markFunction( fn ) {
934927
935/**928/**
936 * Support testing using an element929 * Support testing using an element
937 * @param {Function} fn Passed the created div and expects a boolean result930 * @param {Function} fn Passed the created element and returns a boolean result
938 */931 */
939function assert( fn ) {932function assert( fn ) {
940 var div = document.createElement("div");933 var el = document.createElement( "fieldset" );
941934
942 try {935 try {
943 return !!fn( div );936 return !!fn( el );
944 } catch (e) {937 } catch ( e ) {
945 return false;938 return false;
946 } finally {939 } finally {
940
947 // Remove from its parent by default941 // Remove from its parent by default
948 if ( div.parentNode ) {942 if ( el.parentNode ) {
949 div.parentNode.removeChild( div );943 el.parentNode.removeChild( el );
950 }944 }
945
951 // release memory in IE946 // release memory in IE
952 div = null;947 el = null;
953 }948 }
954}949}
955950
@@ -959,11 +954,11 @@ function assert( fn ) {
959 * @param {Function} handler The method that will be applied954 * @param {Function} handler The method that will be applied
960 */955 */
961function addHandle( attrs, handler ) {956function addHandle( attrs, handler ) {
962 var arr = attrs.split("|"),957 var arr = attrs.split( "|" ),
963 i = arr.length;958 i = arr.length;
964959
965 while ( i-- ) {960 while ( i-- ) {
966 Expr.attrHandle[ arr[i] ] = handler;961 Expr.attrHandle[ arr[ i ] ] = handler;
967 }962 }
968}963}
969964
@@ -976,8 +971,7 @@ function addHandle( attrs, handler ) {
976function siblingCheck( a, b ) {971function siblingCheck( a, b ) {
977 var cur = b && a,972 var cur = b && a,
978 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&973 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
979 ( ~b.sourceIndex || MAX_NEGATIVE ) -974 a.sourceIndex - b.sourceIndex;
980 ( ~a.sourceIndex || MAX_NEGATIVE );
981975
982 // Use IE sourceIndex if available on both nodes976 // Use IE sourceIndex if available on both nodes
983 if ( diff ) {977 if ( diff ) {
@@ -986,7 +980,7 @@ function siblingCheck( a, b ) {
986980
987 // Check if b follows a981 // Check if b follows a
988 if ( cur ) {982 if ( cur ) {
989 while ( (cur = cur.nextSibling) ) {983 while ( ( cur = cur.nextSibling ) ) {
990 if ( cur === b ) {984 if ( cur === b ) {
991 return -1;985 return -1;
992 }986 }
@@ -1014,7 +1008,63 @@ function createInputPseudo( type ) {
1014function createButtonPseudo( type ) {1008function createButtonPseudo( type ) {
1015 return function( elem ) {1009 return function( elem ) {
1016 var name = elem.nodeName.toLowerCase();1010 var name = elem.nodeName.toLowerCase();
1017 return (name === "input" || name === "button") && elem.type === type;1011 return ( name === "input" || name === "button" ) && elem.type === type;
1012 };
1013}
1014
1015/**
1016 * Returns a function to use in pseudos for :enabled/:disabled
1017 * @param {Boolean} disabled true for :disabled; false for :enabled
1018 */
1019function createDisabledPseudo( disabled ) {
1020
1021 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1022 return function( elem ) {
1023
1024 // Only certain elements can match :enabled or :disabled
1025 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
1026 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
1027 if ( "form" in elem ) {
1028
1029 // Check for inherited disabledness on relevant non-disabled elements:
1030 // * listed form-associated elements in a disabled fieldset
1031 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
1032 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
1033 // * option elements in a disabled optgroup
1034 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
1035 // All such elements have a "form" property.
1036 if ( elem.parentNode && elem.disabled === false ) {
1037
1038 // Option elements defer to a parent optgroup if present
1039 if ( "label" in elem ) {
1040 if ( "label" in elem.parentNode ) {
1041 return elem.parentNode.disabled === disabled;
1042 } else {
1043 return elem.disabled === disabled;
1044 }
1045 }
1046
1047 // Support: IE 6 - 11
1048 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1049 return elem.isDisabled === disabled ||
1050
1051 // Where there is no isDisabled, check manually
1052 /* jshint -W018 */
1053 elem.isDisabled !== !disabled &&
1054 inDisabledFieldset( elem ) === disabled;
1055 }
1056
1057 return elem.disabled === disabled;
1058
1059 // Try to winnow out elements that can't be disabled before trusting the disabled property.
1060 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1061 // even exist on them, let alone have a boolean value.
1062 } else if ( "label" in elem ) {
1063 return elem.disabled === disabled;
1064 }
1065
1066 // Remaining elements are neither :enabled nor :disabled
1067 return false;
1018 };1068 };
1019}1069}
10201070
@@ -1023,21 +1073,21 @@ function createButtonPseudo( type ) {
1023 * @param {Function} fn1073 * @param {Function} fn
1024 */1074 */
1025function createPositionalPseudo( fn ) {1075function createPositionalPseudo( fn ) {
1026 return markFunction(function( argument ) {1076 return markFunction( function( argument ) {
1027 argument = +argument;1077 argument = +argument;
1028 return markFunction(function( seed, matches ) {1078 return markFunction( function( seed, matches ) {
1029 var j,1079 var j,
1030 matchIndexes = fn( [], seed.length, argument ),1080 matchIndexes = fn( [], seed.length, argument ),
1031 i = matchIndexes.length;1081 i = matchIndexes.length;
10321082
1033 // Match elements found at the specified indexes1083 // Match elements found at the specified indexes
1034 while ( i-- ) {1084 while ( i-- ) {
1035 if ( seed[ (j = matchIndexes[i]) ] ) {1085 if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
1036 seed[j] = !(matches[j] = seed[j]);1086 seed[ j ] = !( matches[ j ] = seed[ j ] );
1037 }1087 }
1038 }1088 }
1039 });1089 } );
1040 });1090 } );
1041}1091}
10421092
1043/**1093/**
@@ -1058,10 +1108,13 @@ support = Sizzle.support = {};
1058 * @returns {Boolean} True iff elem is a non-HTML XML node1108 * @returns {Boolean} True iff elem is a non-HTML XML node
1059 */1109 */
1060isXML = Sizzle.isXML = function( elem ) {1110isXML = Sizzle.isXML = function( elem ) {
1061 // documentElement is verified for cases where it doesn't yet exist1111 var namespace = elem.namespaceURI,
1062 // (such as loading iframes in IE - #4833)1112 docElem = ( elem.ownerDocument || elem ).documentElement;
1063 var documentElement = elem && (elem.ownerDocument || elem).documentElement;1113
1064 return documentElement ? documentElement.nodeName !== "HTML" : false;1114 // Support: IE <=8
1115 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
1116 // https://bugs.jquery.com/ticket/4833
1117 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
1065};1118};
10661119
1067/**1120/**
@@ -1070,11 +1123,15 @@ isXML = Sizzle.isXML = function( elem ) {
1070 * @returns {Object} Returns the current document1123 * @returns {Object} Returns the current document
1071 */1124 */
1072setDocument = Sizzle.setDocument = function( node ) {1125setDocument = Sizzle.setDocument = function( node ) {
1073 var hasCompare, parent,1126 var hasCompare, subWindow,
1074 doc = node ? node.ownerDocument || node : preferredDoc;1127 doc = node ? node.ownerDocument || node : preferredDoc;
10751128
1076 // Return early if doc is invalid or already selected1129 // Return early if doc is invalid or already selected
1077 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {1130 // Support: IE 11+, Edge 17 - 18+
1131 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1132 // two documents; shallow comparisons work.
1133 // eslint-disable-next-line eqeqeq
1134 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
1078 return document;1135 return document;
1079 }1136 }
10801137
@@ -1083,82 +1140,125 @@ setDocument = Sizzle.setDocument = function( node ) {
1083 docElem = document.documentElement;1140 docElem = document.documentElement;
1084 documentIsHTML = !isXML( document );1141 documentIsHTML = !isXML( document );
10851142
1086 // Support: IE 9-11, Edge1143 // Support: IE 9 - 11+, Edge 12 - 18+
1087 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)1144 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1088 if ( (parent = document.defaultView) && parent.top !== parent ) {1145 // Support: IE 11+, Edge 17 - 18+
1089 // Support: IE 111146 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1090 if ( parent.addEventListener ) {1147 // two documents; shallow comparisons work.
1091 parent.addEventListener( "unload", unloadHandler, false );1148 // eslint-disable-next-line eqeqeq
1149 if ( preferredDoc != document &&
1150 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1151
1152 // Support: IE 11, Edge
1153 if ( subWindow.addEventListener ) {
1154 subWindow.addEventListener( "unload", unloadHandler, false );
10921155
1093 // Support: IE 9 - 10 only1156 // Support: IE 9 - 10 only
1094 } else if ( parent.attachEvent ) {1157 } else if ( subWindow.attachEvent ) {
1095 parent.attachEvent( "onunload", unloadHandler );1158 subWindow.attachEvent( "onunload", unloadHandler );
1096 }1159 }
1097 }1160 }
10981161
1162 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
1163 // Safari 4 - 5 only, Opera <=11.6 - 12.x only
1164 // IE/Edge & older browsers don't support the :scope pseudo-class.
1165 // Support: Safari 6.0 only
1166 // Safari 6.0 supports :scope but it's an alias of :root there.
1167 support.scope = assert( function( el ) {
1168 docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
1169 return typeof el.querySelectorAll !== "undefined" &&
1170 !el.querySelectorAll( ":scope fieldset div" ).length;
1171 } );
1172
1099 /* Attributes1173 /* Attributes
1100 ---------------------------------------------------------------------- */1174 ---------------------------------------------------------------------- */
11011175
1102 // Support: IE<81176 // Support: IE<8
1103 // Verify that getAttribute really returns attributes and not properties1177 // Verify that getAttribute really returns attributes and not properties
1104 // (excepting IE8 booleans)1178 // (excepting IE8 booleans)
1105 support.attributes = assert(function( div ) {1179 support.attributes = assert( function( el ) {
1106 div.className = "i";1180 el.className = "i";
1107 return !div.getAttribute("className");1181 return !el.getAttribute( "className" );
1108 });1182 } );
11091183
1110 /* getElement(s)By*1184 /* getElement(s)By*
1111 ---------------------------------------------------------------------- */1185 ---------------------------------------------------------------------- */
11121186
1113 // Check if getElementsByTagName("*") returns only elements1187 // Check if getElementsByTagName("*") returns only elements
1114 support.getElementsByTagName = assert(function( div ) {1188 support.getElementsByTagName = assert( function( el ) {
1115 div.appendChild( document.createComment("") );1189 el.appendChild( document.createComment( "" ) );
1116 return !div.getElementsByTagName("*").length;1190 return !el.getElementsByTagName( "*" ).length;
1117 });1191 } );
11181192
1119 // Support: IE<91193 // Support: IE<9
1120 support.getElementsByClassName = rnative.test( document.getElementsByClassName );1194 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
11211195
1122 // Support: IE<101196 // Support: IE<10
1123 // Check if getElementById returns elements by name1197 // Check if getElementById returns elements by name
1124 // The broken getElementById methods don't pick up programatically-set names,1198 // The broken getElementById methods don't pick up programmatically-set names,
1125 // so use a roundabout getElementsByName test1199 // so use a roundabout getElementsByName test
1126 support.getById = assert(function( div ) {1200 support.getById = assert( function( el ) {
1127 docElem.appendChild( div ).id = expando;1201 docElem.appendChild( el ).id = expando;
1128 return !document.getElementsByName || !document.getElementsByName( expando ).length;1202 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1129 });1203 } );
11301204
1131 // ID find and filter1205 // ID filter and find
1132 if ( support.getById ) {1206 if ( support.getById ) {
1133 Expr.find["ID"] = function( id, context ) {1207 Expr.filter[ "ID" ] = function( id ) {
1134 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1135 var m = context.getElementById( id );
1136 return m ? [ m ] : [];
1137 }
1138 };
1139 Expr.filter["ID"] = function( id ) {
1140 var attrId = id.replace( runescape, funescape );1208 var attrId = id.replace( runescape, funescape );
1141 return function( elem ) {1209 return function( elem ) {
1142 return elem.getAttribute("id") === attrId;1210 return elem.getAttribute( "id" ) === attrId;
1143 };1211 };
1144 };1212 };
1213 Expr.find[ "ID" ] = function( id, context ) {
1214 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1215 var elem = context.getElementById( id );
1216 return elem ? [ elem ] : [];
1217 }
1218 };
1145 } else {1219 } else {
1146 // Support: IE6/71220 Expr.filter[ "ID" ] = function( id ) {
1147 // getElementById is not reliable as a find shortcut
1148 delete Expr.find["ID"];
1149
1150 Expr.filter["ID"] = function( id ) {
1151 var attrId = id.replace( runescape, funescape );1221 var attrId = id.replace( runescape, funescape );
1152 return function( elem ) {1222 return function( elem ) {
1153 var node = typeof elem.getAttributeNode !== "undefined" &&1223 var node = typeof elem.getAttributeNode !== "undefined" &&
1154 elem.getAttributeNode("id");1224 elem.getAttributeNode( "id" );
1155 return node && node.value === attrId;1225 return node && node.value === attrId;
1156 };1226 };
1157 };1227 };
1228
1229 // Support: IE 6 - 7 only
1230 // getElementById is not reliable as a find shortcut
1231 Expr.find[ "ID" ] = function( id, context ) {
1232 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1233 var node, i, elems,
1234 elem = context.getElementById( id );
1235
1236 if ( elem ) {
1237
1238 // Verify the id attribute
1239 node = elem.getAttributeNode( "id" );
1240 if ( node && node.value === id ) {
1241 return [ elem ];
1242 }
1243
1244 // Fall back on getElementsByName
1245 elems = context.getElementsByName( id );
1246 i = 0;
1247 while ( ( elem = elems[ i++ ] ) ) {
1248 node = elem.getAttributeNode( "id" );
1249 if ( node && node.value === id ) {
1250 return [ elem ];
1251 }
1252 }
1253 }
1254
1255 return [];
1256 }
1257 };
1158 }1258 }
11591259
1160 // Tag1260 // Tag
1161 Expr.find["TAG"] = support.getElementsByTagName ?1261 Expr.find[ "TAG" ] = support.getElementsByTagName ?
1162 function( tag, context ) {1262 function( tag, context ) {
1163 if ( typeof context.getElementsByTagName !== "undefined" ) {1263 if ( typeof context.getElementsByTagName !== "undefined" ) {
1164 return context.getElementsByTagName( tag );1264 return context.getElementsByTagName( tag );
@@ -1173,12 +1273,13 @@ setDocument = Sizzle.setDocument = function( node ) {
1173 var elem,1273 var elem,
1174 tmp = [],1274 tmp = [],
1175 i = 0,1275 i = 0,
1276
1176 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too1277 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1177 results = context.getElementsByTagName( tag );1278 results = context.getElementsByTagName( tag );
11781279
1179 // Filter out possible comments1280 // Filter out possible comments
1180 if ( tag === "*" ) {1281 if ( tag === "*" ) {
1181 while ( (elem = results[i++]) ) {1282 while ( ( elem = results[ i++ ] ) ) {
1182 if ( elem.nodeType === 1 ) {1283 if ( elem.nodeType === 1 ) {
1183 tmp.push( elem );1284 tmp.push( elem );
1184 }1285 }
@@ -1190,7 +1291,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1190 };1291 };
11911292
1192 // Class1293 // Class
1193 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {1294 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
1194 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {1295 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1195 return context.getElementsByClassName( className );1296 return context.getElementsByClassName( className );
1196 }1297 }
@@ -1208,101 +1309,135 @@ setDocument = Sizzle.setDocument = function( node ) {
1208 // We allow this because of a bug in IE8/9 that throws an error1309 // We allow this because of a bug in IE8/9 that throws an error
1209 // whenever `document.activeElement` is accessed on an iframe1310 // whenever `document.activeElement` is accessed on an iframe
1210 // So, we allow :focus to pass through QSA all the time to avoid the IE error1311 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1211 // See http://bugs.jquery.com/ticket/133781312 // See https://bugs.jquery.com/ticket/13378
1212 rbuggyQSA = [];1313 rbuggyQSA = [];
12131314
1214 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {1315 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
1316
1215 // Build QSA regex1317 // Build QSA regex
1216 // Regex strategy adopted from Diego Perini1318 // Regex strategy adopted from Diego Perini
1217 assert(function( div ) {1319 assert( function( el ) {
1320
1321 var input;
1322
1218 // Select is set to empty string on purpose1323 // Select is set to empty string on purpose
1219 // This is to test IE's treatment of not explicitly1324 // This is to test IE's treatment of not explicitly
1220 // setting a boolean content attribute,1325 // setting a boolean content attribute,
1221 // since its presence should be enough1326 // since its presence should be enough
1222 // http://bugs.jquery.com/ticket/123591327 // https://bugs.jquery.com/ticket/12359
1223 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +1328 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1224 "<select id='" + expando + "-\r\\' msallowcapture=''>" +1329 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1225 "<option selected=''></option></select>";1330 "<option selected=''></option></select>";
12261331
1227 // Support: IE8, Opera 11-12.161332 // Support: IE8, Opera 11-12.16
1228 // Nothing should be selected when empty strings follow ^= or $= or *=1333 // Nothing should be selected when empty strings follow ^= or $= or *=
1229 // The test attribute must be unknown in Opera but "safe" for WinRT1334 // The test attribute must be unknown in Opera but "safe" for WinRT
1230 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section1335 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1231 if ( div.querySelectorAll("[msallowcapture^='']").length ) {1336 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
1232 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );1337 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1233 }1338 }
12341339
1235 // Support: IE81340 // Support: IE8
1236 // Boolean attributes and "value" are not treated correctly1341 // Boolean attributes and "value" are not treated correctly
1237 if ( !div.querySelectorAll("[selected]").length ) {1342 if ( !el.querySelectorAll( "[selected]" ).length ) {
1238 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );1343 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1239 }1344 }
12401345
1241 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+1346 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1242 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {1347 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1243 rbuggyQSA.push("~=");1348 rbuggyQSA.push( "~=" );
1349 }
1350
1351 // Support: IE 11+, Edge 15 - 18+
1352 // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1353 // Adding a temporary attribute to the document before the selection works
1354 // around the issue.
1355 // Interestingly, IE 10 & older don't seem to have the issue.
1356 input = document.createElement( "input" );
1357 input.setAttribute( "name", "" );
1358 el.appendChild( input );
1359 if ( !el.querySelectorAll( "[name='']" ).length ) {
1360 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1361 whitespace + "*(?:''|\"\")" );
1244 }1362 }
12451363
1246 // Webkit/Opera - :checked should return selected option elements1364 // Webkit/Opera - :checked should return selected option elements
1247 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked1365 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1248 // IE8 throws error here and will not see later tests1366 // IE8 throws error here and will not see later tests
1249 if ( !div.querySelectorAll(":checked").length ) {1367 if ( !el.querySelectorAll( ":checked" ).length ) {
1250 rbuggyQSA.push(":checked");1368 rbuggyQSA.push( ":checked" );
1251 }1369 }
12521370
1253 // Support: Safari 8+, iOS 8+1371 // Support: Safari 8+, iOS 8+
1254 // https://bugs.webkit.org/show_bug.cgi?id=1368511372 // https://bugs.webkit.org/show_bug.cgi?id=136851
1255 // In-page `selector#id sibing-combinator selector` fails1373 // In-page `selector#id sibling-combinator selector` fails
1256 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {1374 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1257 rbuggyQSA.push(".#.+[+~]");1375 rbuggyQSA.push( ".#.+[+~]" );
1258 }1376 }
1259 });
12601377
1261 assert(function( div ) {1378 // Support: Firefox <=3.6 - 5 only
1379 // Old Firefox doesn't throw on a badly-escaped identifier.
1380 el.querySelectorAll( "\\\f" );
1381 rbuggyQSA.push( "[\\r\\n\\f]" );
1382 } );
1383
1384 assert( function( el ) {
1385 el.innerHTML = "<a href='' disabled='disabled'></a>" +
1386 "<select disabled='disabled'><option/></select>";
1387
1262 // Support: Windows 8 Native Apps1388 // Support: Windows 8 Native Apps
1263 // The type and name attributes are restricted during .innerHTML assignment1389 // The type and name attributes are restricted during .innerHTML assignment
1264 var input = document.createElement("input");1390 var input = document.createElement( "input" );
1265 input.setAttribute( "type", "hidden" );1391 input.setAttribute( "type", "hidden" );
1266 div.appendChild( input ).setAttribute( "name", "D" );1392 el.appendChild( input ).setAttribute( "name", "D" );
12671393
1268 // Support: IE81394 // Support: IE8
1269 // Enforce case-sensitivity of name attribute1395 // Enforce case-sensitivity of name attribute
1270 if ( div.querySelectorAll("[name=d]").length ) {1396 if ( el.querySelectorAll( "[name=d]" ).length ) {
1271 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );1397 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1272 }1398 }
12731399
1274 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)1400 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1275 // IE8 throws error here and will not see later tests1401 // IE8 throws error here and will not see later tests
1276 if ( !div.querySelectorAll(":enabled").length ) {1402 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
1403 rbuggyQSA.push( ":enabled", ":disabled" );
1404 }
1405
1406 // Support: IE9-11+
1407 // IE's :disabled selector does not pick up the children of disabled fieldsets
1408 docElem.appendChild( el ).disabled = true;
1409 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1277 rbuggyQSA.push( ":enabled", ":disabled" );1410 rbuggyQSA.push( ":enabled", ":disabled" );
1278 }1411 }
12791412
1413 // Support: Opera 10 - 11 only
1280 // Opera 10-11 does not throw on post-comma invalid pseudos1414 // Opera 10-11 does not throw on post-comma invalid pseudos
1281 div.querySelectorAll("*,:x");1415 el.querySelectorAll( "*,:x" );
1282 rbuggyQSA.push(",.*:");1416 rbuggyQSA.push( ",.*:" );
1283 });1417 } );
1284 }1418 }
12851419
1286 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||1420 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
1287 docElem.webkitMatchesSelector ||1421 docElem.webkitMatchesSelector ||
1288 docElem.mozMatchesSelector ||1422 docElem.mozMatchesSelector ||
1289 docElem.oMatchesSelector ||1423 docElem.oMatchesSelector ||
1290 docElem.msMatchesSelector) )) ) {1424 docElem.msMatchesSelector ) ) ) ) {
1425
1426 assert( function( el ) {
12911427
1292 assert(function( div ) {
1293 // Check to see if it's possible to do matchesSelector1428 // Check to see if it's possible to do matchesSelector
1294 // on a disconnected node (IE 9)1429 // on a disconnected node (IE 9)
1295 support.disconnectedMatch = matches.call( div, "div" );1430 support.disconnectedMatch = matches.call( el, "*" );
12961431
1297 // This should fail with an exception1432 // This should fail with an exception
1298 // Gecko does not error, returns false instead1433 // Gecko does not error, returns false instead
1299 matches.call( div, "[s!='']:x" );1434 matches.call( el, "[s!='']:x" );
1300 rbuggyMatches.push( "!=", pseudos );1435 rbuggyMatches.push( "!=", pseudos );
1301 });1436 } );
1302 }1437 }
13031438
1304 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );1439 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
1305 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );1440 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
13061441
1307 /* Contains1442 /* Contains
1308 ---------------------------------------------------------------------- */1443 ---------------------------------------------------------------------- */
@@ -1319,11 +1454,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1319 adown.contains ?1454 adown.contains ?
1320 adown.contains( bup ) :1455 adown.contains( bup ) :
1321 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 161456 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1322 ));1457 ) );
1323 } :1458 } :
1324 function( a, b ) {1459 function( a, b ) {
1325 if ( b ) {1460 if ( b ) {
1326 while ( (b = b.parentNode) ) {1461 while ( ( b = b.parentNode ) ) {
1327 if ( b === a ) {1462 if ( b === a ) {
1328 return true;1463 return true;
1329 }1464 }
@@ -1352,7 +1487,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1352 }1487 }
13531488
1354 // Calculate position if both inputs belong to the same document1489 // Calculate position if both inputs belong to the same document
1355 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?1490 // Support: IE 11+, Edge 17 - 18+
1491 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1492 // two documents; shallow comparisons work.
1493 // eslint-disable-next-line eqeqeq
1494 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
1356 a.compareDocumentPosition( b ) :1495 a.compareDocumentPosition( b ) :
13571496
1358 // Otherwise we know they are disconnected1497 // Otherwise we know they are disconnected
@@ -1360,13 +1499,24 @@ setDocument = Sizzle.setDocument = function( node ) {
13601499
1361 // Disconnected nodes1500 // Disconnected nodes
1362 if ( compare & 1 ||1501 if ( compare & 1 ||
1363 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {1502 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
13641503
1365 // Choose the first element that is related to our preferred document1504 // Choose the first element that is related to our preferred document
1366 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {1505 // Support: IE 11+, Edge 17 - 18+
1506 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1507 // two documents; shallow comparisons work.
1508 // eslint-disable-next-line eqeqeq
1509 if ( a == document || a.ownerDocument == preferredDoc &&
1510 contains( preferredDoc, a ) ) {
1367 return -1;1511 return -1;
1368 }1512 }
1369 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {1513
1514 // Support: IE 11+, Edge 17 - 18+
1515 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1516 // two documents; shallow comparisons work.
1517 // eslint-disable-next-line eqeqeq
1518 if ( b == document || b.ownerDocument == preferredDoc &&
1519 contains( preferredDoc, b ) ) {
1370 return 1;1520 return 1;
1371 }1521 }
13721522
@@ -1379,6 +1529,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1379 return compare & 4 ? -1 : 1;1529 return compare & 4 ? -1 : 1;
1380 } :1530 } :
1381 function( a, b ) {1531 function( a, b ) {
1532
1382 // Exit early if the nodes are identical1533 // Exit early if the nodes are identical
1383 if ( a === b ) {1534 if ( a === b ) {
1384 hasDuplicate = true;1535 hasDuplicate = true;
@@ -1394,8 +1545,14 @@ setDocument = Sizzle.setDocument = function( node ) {
13941545
1395 // Parentless nodes are either documents or disconnected1546 // Parentless nodes are either documents or disconnected
1396 if ( !aup || !bup ) {1547 if ( !aup || !bup ) {
1397 return a === document ? -1 :1548
1398 b === document ? 1 :1549 // Support: IE 11+, Edge 17 - 18+
1550 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1551 // two documents; shallow comparisons work.
1552 /* eslint-disable eqeqeq */
1553 return a == document ? -1 :
1554 b == document ? 1 :
1555 /* eslint-enable eqeqeq */
1399 aup ? -1 :1556 aup ? -1 :
1400 bup ? 1 :1557 bup ? 1 :
1401 sortInput ?1558 sortInput ?
@@ -1409,26 +1566,32 @@ setDocument = Sizzle.setDocument = function( node ) {
14091566
1410 // Otherwise we need full lists of their ancestors for comparison1567 // Otherwise we need full lists of their ancestors for comparison
1411 cur = a;1568 cur = a;
1412 while ( (cur = cur.parentNode) ) {1569 while ( ( cur = cur.parentNode ) ) {
1413 ap.unshift( cur );1570 ap.unshift( cur );
1414 }1571 }
1415 cur = b;1572 cur = b;
1416 while ( (cur = cur.parentNode) ) {1573 while ( ( cur = cur.parentNode ) ) {
1417 bp.unshift( cur );1574 bp.unshift( cur );
1418 }1575 }
14191576
1420 // Walk down the tree looking for a discrepancy1577 // Walk down the tree looking for a discrepancy
1421 while ( ap[i] === bp[i] ) {1578 while ( ap[ i ] === bp[ i ] ) {
1422 i++;1579 i++;
1423 }1580 }
14241581
1425 return i ?1582 return i ?
1583
1426 // Do a sibling check if the nodes have a common ancestor1584 // Do a sibling check if the nodes have a common ancestor
1427 siblingCheck( ap[i], bp[i] ) :1585 siblingCheck( ap[ i ], bp[ i ] ) :
14281586
1429 // Otherwise nodes in our document sort first1587 // Otherwise nodes in our document sort first
1430 ap[i] === preferredDoc ? -1 :1588 // Support: IE 11+, Edge 17 - 18+
1431 bp[i] === preferredDoc ? 1 :1589 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1590 // two documents; shallow comparisons work.
1591 /* eslint-disable eqeqeq */
1592 ap[ i ] == preferredDoc ? -1 :
1593 bp[ i ] == preferredDoc ? 1 :
1594 /* eslint-enable eqeqeq */
1432 0;1595 0;
1433 };1596 };
14341597
@@ -1440,16 +1603,10 @@ Sizzle.matches = function( expr, elements ) {
1440};1603};
14411604
1442Sizzle.matchesSelector = function( elem, expr ) {1605Sizzle.matchesSelector = function( elem, expr ) {
1443 // Set document vars if needed1606 setDocument( elem );
1444 if ( ( elem.ownerDocument || elem ) !== document ) {
1445 setDocument( elem );
1446 }
1447
1448 // Make sure that attribute selectors are quoted
1449 expr = expr.replace( rattributeQuotes, "='$1']" );
14501607
1451 if ( support.matchesSelector && documentIsHTML &&1608 if ( support.matchesSelector && documentIsHTML &&
1452 !compilerCache[ expr + " " ] &&1609 !nonnativeSelectorCache[ expr + " " ] &&
1453 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&1610 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1454 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {1611 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
14551612
@@ -1458,32 +1615,46 @@ Sizzle.matchesSelector = function( elem, expr ) {
14581615
1459 // IE 9's matchesSelector returns false on disconnected nodes1616 // IE 9's matchesSelector returns false on disconnected nodes
1460 if ( ret || support.disconnectedMatch ||1617 if ( ret || support.disconnectedMatch ||
1461 // As well, disconnected nodes are said to be in a document1618
1462 // fragment in IE 91619 // As well, disconnected nodes are said to be in a document
1463 elem.document && elem.document.nodeType !== 11 ) {1620 // fragment in IE 9
1621 elem.document && elem.document.nodeType !== 11 ) {
1464 return ret;1622 return ret;
1465 }1623 }
1466 } catch (e) {}1624 } catch ( e ) {
1625 nonnativeSelectorCache( expr, true );
1626 }
1467 }1627 }
14681628
1469 return Sizzle( expr, document, null, [ elem ] ).length > 0;1629 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1470};1630};
14711631
1472Sizzle.contains = function( context, elem ) {1632Sizzle.contains = function( context, elem ) {
1633
1473 // Set document vars if needed1634 // Set document vars if needed
1474 if ( ( context.ownerDocument || context ) !== document ) {1635 // Support: IE 11+, Edge 17 - 18+
1636 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1637 // two documents; shallow comparisons work.
1638 // eslint-disable-next-line eqeqeq
1639 if ( ( context.ownerDocument || context ) != document ) {
1475 setDocument( context );1640 setDocument( context );
1476 }1641 }
1477 return contains( context, elem );1642 return contains( context, elem );
1478};1643};
14791644
1480Sizzle.attr = function( elem, name ) {1645Sizzle.attr = function( elem, name ) {
1646
1481 // Set document vars if needed1647 // Set document vars if needed
1482 if ( ( elem.ownerDocument || elem ) !== document ) {1648 // Support: IE 11+, Edge 17 - 18+
1649 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1650 // two documents; shallow comparisons work.
1651 // eslint-disable-next-line eqeqeq
1652 if ( ( elem.ownerDocument || elem ) != document ) {
1483 setDocument( elem );1653 setDocument( elem );
1484 }1654 }
14851655
1486 var fn = Expr.attrHandle[ name.toLowerCase() ],1656 var fn = Expr.attrHandle[ name.toLowerCase() ],
1657
1487 // Don't get fooled by Object.prototype properties (jQuery #13807)1658 // Don't get fooled by Object.prototype properties (jQuery #13807)
1488 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?1659 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1489 fn( elem, name, !documentIsHTML ) :1660 fn( elem, name, !documentIsHTML ) :
@@ -1493,11 +1664,15 @@ Sizzle.attr = function( elem, name ) {
1493 val :1664 val :
1494 support.attributes || !documentIsHTML ?1665 support.attributes || !documentIsHTML ?
1495 elem.getAttribute( name ) :1666 elem.getAttribute( name ) :
1496 (val = elem.getAttributeNode(name)) && val.specified ?1667 ( val = elem.getAttributeNode( name ) ) && val.specified ?
1497 val.value :1668 val.value :
1498 null;1669 null;
1499};1670};
15001671
1672Sizzle.escape = function( sel ) {
1673 return ( sel + "" ).replace( rcssescape, fcssescape );
1674};
1675
1501Sizzle.error = function( msg ) {1676Sizzle.error = function( msg ) {
1502 throw new Error( "Syntax error, unrecognized expression: " + msg );1677 throw new Error( "Syntax error, unrecognized expression: " + msg );
1503};1678};
@@ -1518,7 +1693,7 @@ Sizzle.uniqueSort = function( results ) {
1518 results.sort( sortOrder );1693 results.sort( sortOrder );
15191694
1520 if ( hasDuplicate ) {1695 if ( hasDuplicate ) {
1521 while ( (elem = results[i++]) ) {1696 while ( ( elem = results[ i++ ] ) ) {
1522 if ( elem === results[ i ] ) {1697 if ( elem === results[ i ] ) {
1523 j = duplicates.push( i );1698 j = duplicates.push( i );
1524 }1699 }
@@ -1546,17 +1721,21 @@ getText = Sizzle.getText = function( elem ) {
1546 nodeType = elem.nodeType;1721 nodeType = elem.nodeType;
15471722
1548 if ( !nodeType ) {1723 if ( !nodeType ) {
1724
1549 // If no nodeType, this is expected to be an array1725 // If no nodeType, this is expected to be an array
1550 while ( (node = elem[i++]) ) {1726 while ( ( node = elem[ i++ ] ) ) {
1727
1551 // Do not traverse comment nodes1728 // Do not traverse comment nodes
1552 ret += getText( node );1729 ret += getText( node );
1553 }1730 }
1554 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {1731 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1732
1555 // Use textContent for elements1733 // Use textContent for elements
1556 // innerText usage removed for consistency of new lines (jQuery #11153)1734 // innerText usage removed for consistency of new lines (jQuery #11153)
1557 if ( typeof elem.textContent === "string" ) {1735 if ( typeof elem.textContent === "string" ) {
1558 return elem.textContent;1736 return elem.textContent;
1559 } else {1737 } else {
1738
1560 // Traverse its children1739 // Traverse its children
1561 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {1740 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1562 ret += getText( elem );1741 ret += getText( elem );
@@ -1565,6 +1744,7 @@ getText = Sizzle.getText = function( elem ) {
1565 } else if ( nodeType === 3 || nodeType === 4 ) {1744 } else if ( nodeType === 3 || nodeType === 4 ) {
1566 return elem.nodeValue;1745 return elem.nodeValue;
1567 }1746 }
1747
1568 // Do not include comment or processing instruction nodes1748 // Do not include comment or processing instruction nodes
15691749
1570 return ret;1750 return ret;
@@ -1592,19 +1772,21 @@ Expr = Sizzle.selectors = {
15921772
1593 preFilter: {1773 preFilter: {
1594 "ATTR": function( match ) {1774 "ATTR": function( match ) {
1595 match[1] = match[1].replace( runescape, funescape );1775 match[ 1 ] = match[ 1 ].replace( runescape, funescape );
15961776
1597 // Move the given value to match[3] whether quoted or unquoted1777 // Move the given value to match[3] whether quoted or unquoted
1598 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );1778 match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
1779 match[ 5 ] || "" ).replace( runescape, funescape );
15991780
1600 if ( match[2] === "~=" ) {1781 if ( match[ 2 ] === "~=" ) {
1601 match[3] = " " + match[3] + " ";1782 match[ 3 ] = " " + match[ 3 ] + " ";
1602 }1783 }
16031784
1604 return match.slice( 0, 4 );1785 return match.slice( 0, 4 );
1605 },1786 },
16061787
1607 "CHILD": function( match ) {1788 "CHILD": function( match ) {
1789
1608 /* matches from matchExpr["CHILD"]1790 /* matches from matchExpr["CHILD"]
1609 1 type (only|nth|...)1791 1 type (only|nth|...)
1610 2 what (child|of-type)1792 2 what (child|of-type)
@@ -1615,22 +1797,25 @@ Expr = Sizzle.selectors = {
1615 7 sign of y-component1797 7 sign of y-component
1616 8 y of y-component1798 8 y of y-component
1617 */1799 */
1618 match[1] = match[1].toLowerCase();1800 match[ 1 ] = match[ 1 ].toLowerCase();
1801
1802 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
16191803
1620 if ( match[1].slice( 0, 3 ) === "nth" ) {
1621 // nth-* requires argument1804 // nth-* requires argument
1622 if ( !match[3] ) {1805 if ( !match[ 3 ] ) {
1623 Sizzle.error( match[0] );1806 Sizzle.error( match[ 0 ] );
1624 }1807 }
16251808
1626 // numeric x and y parameters for Expr.filter.CHILD1809 // numeric x and y parameters for Expr.filter.CHILD
1627 // remember that false/true cast respectively to 0/11810 // remember that false/true cast respectively to 0/1
1628 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );1811 match[ 4 ] = +( match[ 4 ] ?
1629 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );1812 match[ 5 ] + ( match[ 6 ] || 1 ) :
1813 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
1814 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
16301815
1631 // other types prohibit arguments1816 // other types prohibit arguments
1632 } else if ( match[3] ) {1817 } else if ( match[ 3 ] ) {
1633 Sizzle.error( match[0] );1818 Sizzle.error( match[ 0 ] );
1634 }1819 }
16351820
1636 return match;1821 return match;
@@ -1638,26 +1823,28 @@ Expr = Sizzle.selectors = {
16381823
1639 "PSEUDO": function( match ) {1824 "PSEUDO": function( match ) {
1640 var excess,1825 var excess,
1641 unquoted = !match[6] && match[2];1826 unquoted = !match[ 6 ] && match[ 2 ];
16421827
1643 if ( matchExpr["CHILD"].test( match[0] ) ) {1828 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
1644 return null;1829 return null;
1645 }1830 }
16461831
1647 // Accept quoted arguments as-is1832 // Accept quoted arguments as-is
1648 if ( match[3] ) {1833 if ( match[ 3 ] ) {
1649 match[2] = match[4] || match[5] || "";1834 match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
16501835
1651 // Strip excess characters from unquoted arguments1836 // Strip excess characters from unquoted arguments
1652 } else if ( unquoted && rpseudo.test( unquoted ) &&1837 } else if ( unquoted && rpseudo.test( unquoted ) &&
1838
1653 // Get excess from tokenize (recursively)1839 // Get excess from tokenize (recursively)
1654 (excess = tokenize( unquoted, true )) &&1840 ( excess = tokenize( unquoted, true ) ) &&
1841
1655 // advance to the next closing parenthesis1842 // advance to the next closing parenthesis
1656 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {1843 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
16571844
1658 // excess is a negative index1845 // excess is a negative index
1659 match[0] = match[0].slice( 0, excess );1846 match[ 0 ] = match[ 0 ].slice( 0, excess );
1660 match[2] = unquoted.slice( 0, excess );1847 match[ 2 ] = unquoted.slice( 0, excess );
1661 }1848 }
16621849
1663 // Return only captures needed by the pseudo filter method (type and argument)1850 // Return only captures needed by the pseudo filter method (type and argument)
@@ -1670,7 +1857,9 @@ Expr = Sizzle.selectors = {
1670 "TAG": function( nodeNameSelector ) {1857 "TAG": function( nodeNameSelector ) {
1671 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();1858 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1672 return nodeNameSelector === "*" ?1859 return nodeNameSelector === "*" ?
1673 function() { return true; } :1860 function() {
1861 return true;
1862 } :
1674 function( elem ) {1863 function( elem ) {
1675 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;1864 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1676 };1865 };
@@ -1680,10 +1869,16 @@ Expr = Sizzle.selectors = {
1680 var pattern = classCache[ className + " " ];1869 var pattern = classCache[ className + " " ];
16811870
1682 return pattern ||1871 return pattern ||
1683 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&1872 ( pattern = new RegExp( "(^|" + whitespace +
1684 classCache( className, function( elem ) {1873 ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
1685 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );1874 className, function( elem ) {
1686 });1875 return pattern.test(
1876 typeof elem.className === "string" && elem.className ||
1877 typeof elem.getAttribute !== "undefined" &&
1878 elem.getAttribute( "class" ) ||
1879 ""
1880 );
1881 } );
1687 },1882 },
16881883
1689 "ATTR": function( name, operator, check ) {1884 "ATTR": function( name, operator, check ) {
@@ -1699,6 +1894,8 @@ Expr = Sizzle.selectors = {
16991894
1700 result += "";1895 result += "";
17011896
1897 /* eslint-disable max-len */
1898
1702 return operator === "=" ? result === check :1899 return operator === "=" ? result === check :
1703 operator === "!=" ? result !== check :1900 operator === "!=" ? result !== check :
1704 operator === "^=" ? check && result.indexOf( check ) === 0 :1901 operator === "^=" ? check && result.indexOf( check ) === 0 :
@@ -1707,10 +1904,12 @@ Expr = Sizzle.selectors = {
1707 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :1904 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1708 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :1905 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1709 false;1906 false;
1907 /* eslint-enable max-len */
1908
1710 };1909 };
1711 },1910 },
17121911
1713 "CHILD": function( type, what, argument, first, last ) {1912 "CHILD": function( type, what, _argument, first, last ) {
1714 var simple = type.slice( 0, 3 ) !== "nth",1913 var simple = type.slice( 0, 3 ) !== "nth",
1715 forward = type.slice( -4 ) !== "last",1914 forward = type.slice( -4 ) !== "last",
1716 ofType = what === "of-type";1915 ofType = what === "of-type";
@@ -1722,7 +1921,7 @@ Expr = Sizzle.selectors = {
1722 return !!elem.parentNode;1921 return !!elem.parentNode;
1723 } :1922 } :
17241923
1725 function( elem, context, xml ) {1924 function( elem, _context, xml ) {
1726 var cache, uniqueCache, outerCache, node, nodeIndex, start,1925 var cache, uniqueCache, outerCache, node, nodeIndex, start,
1727 dir = simple !== forward ? "nextSibling" : "previousSibling",1926 dir = simple !== forward ? "nextSibling" : "previousSibling",
1728 parent = elem.parentNode,1927 parent = elem.parentNode,
@@ -1736,7 +1935,7 @@ Expr = Sizzle.selectors = {
1736 if ( simple ) {1935 if ( simple ) {
1737 while ( dir ) {1936 while ( dir ) {
1738 node = elem;1937 node = elem;
1739 while ( (node = node[ dir ]) ) {1938 while ( ( node = node[ dir ] ) ) {
1740 if ( ofType ?1939 if ( ofType ?
1741 node.nodeName.toLowerCase() === name :1940 node.nodeName.toLowerCase() === name :
1742 node.nodeType === 1 ) {1941 node.nodeType === 1 ) {
@@ -1744,6 +1943,7 @@ Expr = Sizzle.selectors = {
1744 return false;1943 return false;
1745 }1944 }
1746 }1945 }
1946
1747 // Reverse direction for :only-* (if we haven't yet done so)1947 // Reverse direction for :only-* (if we haven't yet done so)
1748 start = dir = type === "only" && !start && "nextSibling";1948 start = dir = type === "only" && !start && "nextSibling";
1749 }1949 }
@@ -1759,22 +1959,22 @@ Expr = Sizzle.selectors = {
17591959
1760 // ...in a gzip-friendly way1960 // ...in a gzip-friendly way
1761 node = parent;1961 node = parent;
1762 outerCache = node[ expando ] || (node[ expando ] = {});1962 outerCache = node[ expando ] || ( node[ expando ] = {} );
17631963
1764 // Support: IE <9 only1964 // Support: IE <9 only
1765 // Defend against cloned attroperties (jQuery gh-1709)1965 // Defend against cloned attroperties (jQuery gh-1709)
1766 uniqueCache = outerCache[ node.uniqueID ] ||1966 uniqueCache = outerCache[ node.uniqueID ] ||
1767 (outerCache[ node.uniqueID ] = {});1967 ( outerCache[ node.uniqueID ] = {} );
17681968
1769 cache = uniqueCache[ type ] || [];1969 cache = uniqueCache[ type ] || [];
1770 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];1970 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1771 diff = nodeIndex && cache[ 2 ];1971 diff = nodeIndex && cache[ 2 ];
1772 node = nodeIndex && parent.childNodes[ nodeIndex ];1972 node = nodeIndex && parent.childNodes[ nodeIndex ];
17731973
1774 while ( (node = ++nodeIndex && node && node[ dir ] ||1974 while ( ( node = ++nodeIndex && node && node[ dir ] ||
17751975
1776 // Fallback to seeking `elem` from the start1976 // Fallback to seeking `elem` from the start
1777 (diff = nodeIndex = 0) || start.pop()) ) {1977 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
17781978
1779 // When found, cache indexes on `parent` and break1979 // When found, cache indexes on `parent` and break
1780 if ( node.nodeType === 1 && ++diff && node === elem ) {1980 if ( node.nodeType === 1 && ++diff && node === elem ) {
@@ -1784,16 +1984,18 @@ Expr = Sizzle.selectors = {
1784 }1984 }
17851985
1786 } else {1986 } else {
1987
1787 // Use previously-cached element index if available1988 // Use previously-cached element index if available
1788 if ( useCache ) {1989 if ( useCache ) {
1990
1789 // ...in a gzip-friendly way1991 // ...in a gzip-friendly way
1790 node = elem;1992 node = elem;
1791 outerCache = node[ expando ] || (node[ expando ] = {});1993 outerCache = node[ expando ] || ( node[ expando ] = {} );
17921994
1793 // Support: IE <9 only1995 // Support: IE <9 only
1794 // Defend against cloned attroperties (jQuery gh-1709)1996 // Defend against cloned attroperties (jQuery gh-1709)
1795 uniqueCache = outerCache[ node.uniqueID ] ||1997 uniqueCache = outerCache[ node.uniqueID ] ||
1796 (outerCache[ node.uniqueID ] = {});1998 ( outerCache[ node.uniqueID ] = {} );
17971999
1798 cache = uniqueCache[ type ] || [];2000 cache = uniqueCache[ type ] || [];
1799 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];2001 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
@@ -1803,9 +2005,10 @@ Expr = Sizzle.selectors = {
1803 // xml :nth-child(...)2005 // xml :nth-child(...)
1804 // or :nth-last-child(...) or :nth(-last)?-of-type(...)2006 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1805 if ( diff === false ) {2007 if ( diff === false ) {
2008
1806 // Use the same loop as above to seek `elem` from the start2009 // Use the same loop as above to seek `elem` from the start
1807 while ( (node = ++nodeIndex && node && node[ dir ] ||2010 while ( ( node = ++nodeIndex && node && node[ dir ] ||
1808 (diff = nodeIndex = 0) || start.pop()) ) {2011 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
18092012
1810 if ( ( ofType ?2013 if ( ( ofType ?
1811 node.nodeName.toLowerCase() === name :2014 node.nodeName.toLowerCase() === name :
@@ -1814,12 +2017,13 @@ Expr = Sizzle.selectors = {
18142017
1815 // Cache the index of each encountered element2018 // Cache the index of each encountered element
1816 if ( useCache ) {2019 if ( useCache ) {
1817 outerCache = node[ expando ] || (node[ expando ] = {});2020 outerCache = node[ expando ] ||
2021 ( node[ expando ] = {} );
18182022
1819 // Support: IE <9 only2023 // Support: IE <9 only
1820 // Defend against cloned attroperties (jQuery gh-1709)2024 // Defend against cloned attroperties (jQuery gh-1709)
1821 uniqueCache = outerCache[ node.uniqueID ] ||2025 uniqueCache = outerCache[ node.uniqueID ] ||
1822 (outerCache[ node.uniqueID ] = {});2026 ( outerCache[ node.uniqueID ] = {} );
18232027
1824 uniqueCache[ type ] = [ dirruns, diff ];2028 uniqueCache[ type ] = [ dirruns, diff ];
1825 }2029 }
@@ -1840,6 +2044,7 @@ Expr = Sizzle.selectors = {
1840 },2044 },
18412045
1842 "PSEUDO": function( pseudo, argument ) {2046 "PSEUDO": function( pseudo, argument ) {
2047
1843 // pseudo-class names are case-insensitive2048 // pseudo-class names are case-insensitive
1844 // http://www.w3.org/TR/selectors/#pseudo-classes2049 // http://www.w3.org/TR/selectors/#pseudo-classes
1845 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters2050 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
@@ -1859,15 +2064,15 @@ Expr = Sizzle.selectors = {
1859 if ( fn.length > 1 ) {2064 if ( fn.length > 1 ) {
1860 args = [ pseudo, pseudo, "", argument ];2065 args = [ pseudo, pseudo, "", argument ];
1861 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?2066 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1862 markFunction(function( seed, matches ) {2067 markFunction( function( seed, matches ) {
1863 var idx,2068 var idx,
1864 matched = fn( seed, argument ),2069 matched = fn( seed, argument ),
1865 i = matched.length;2070 i = matched.length;
1866 while ( i-- ) {2071 while ( i-- ) {
1867 idx = indexOf( seed, matched[i] );2072 idx = indexOf( seed, matched[ i ] );
1868 seed[ idx ] = !( matches[ idx ] = matched[i] );2073 seed[ idx ] = !( matches[ idx ] = matched[ i ] );
1869 }2074 }
1870 }) :2075 } ) :
1871 function( elem ) {2076 function( elem ) {
1872 return fn( elem, 0, args );2077 return fn( elem, 0, args );
1873 };2078 };
@@ -1878,8 +2083,10 @@ Expr = Sizzle.selectors = {
1878 },2083 },
18792084
1880 pseudos: {2085 pseudos: {
2086
1881 // Potentially complex pseudos2087 // Potentially complex pseudos
1882 "not": markFunction(function( selector ) {2088 "not": markFunction( function( selector ) {
2089
1883 // Trim the selector passed to compile2090 // Trim the selector passed to compile
1884 // to avoid treating leading and trailing2091 // to avoid treating leading and trailing
1885 // spaces as combinators2092 // spaces as combinators
@@ -1888,39 +2095,40 @@ Expr = Sizzle.selectors = {
1888 matcher = compile( selector.replace( rtrim, "$1" ) );2095 matcher = compile( selector.replace( rtrim, "$1" ) );
18892096
1890 return matcher[ expando ] ?2097 return matcher[ expando ] ?
1891 markFunction(function( seed, matches, context, xml ) {2098 markFunction( function( seed, matches, _context, xml ) {
1892 var elem,2099 var elem,
1893 unmatched = matcher( seed, null, xml, [] ),2100 unmatched = matcher( seed, null, xml, [] ),
1894 i = seed.length;2101 i = seed.length;
18952102
1896 // Match elements unmatched by `matcher`2103 // Match elements unmatched by `matcher`
1897 while ( i-- ) {2104 while ( i-- ) {
1898 if ( (elem = unmatched[i]) ) {2105 if ( ( elem = unmatched[ i ] ) ) {
1899 seed[i] = !(matches[i] = elem);2106 seed[ i ] = !( matches[ i ] = elem );
1900 }2107 }
1901 }2108 }
1902 }) :2109 } ) :
1903 function( elem, context, xml ) {2110 function( elem, _context, xml ) {
1904 input[0] = elem;2111 input[ 0 ] = elem;
1905 matcher( input, null, xml, results );2112 matcher( input, null, xml, results );
2113
1906 // Don't keep the element (issue #299)2114 // Don't keep the element (issue #299)
1907 input[0] = null;2115 input[ 0 ] = null;
1908 return !results.pop();2116 return !results.pop();
1909 };2117 };
1910 }),2118 } ),
19112119
1912 "has": markFunction(function( selector ) {2120 "has": markFunction( function( selector ) {
1913 return function( elem ) {2121 return function( elem ) {
1914 return Sizzle( selector, elem ).length > 0;2122 return Sizzle( selector, elem ).length > 0;
1915 };2123 };
1916 }),2124 } ),
19172125
1918 "contains": markFunction(function( text ) {2126 "contains": markFunction( function( text ) {
1919 text = text.replace( runescape, funescape );2127 text = text.replace( runescape, funescape );
1920 return function( elem ) {2128 return function( elem ) {
1921 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;2129 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
1922 };2130 };
1923 }),2131 } ),
19242132
1925 // "Whether an element is represented by a :lang() selector2133 // "Whether an element is represented by a :lang() selector
1926 // is based solely on the element's language value2134 // is based solely on the element's language value
@@ -1930,25 +2138,26 @@ Expr = Sizzle.selectors = {
1930 // The identifier C does not have to be a valid language name."2138 // The identifier C does not have to be a valid language name."
1931 // http://www.w3.org/TR/selectors/#lang-pseudo2139 // http://www.w3.org/TR/selectors/#lang-pseudo
1932 "lang": markFunction( function( lang ) {2140 "lang": markFunction( function( lang ) {
2141
1933 // lang value must be a valid identifier2142 // lang value must be a valid identifier
1934 if ( !ridentifier.test(lang || "") ) {2143 if ( !ridentifier.test( lang || "" ) ) {
1935 Sizzle.error( "unsupported lang: " + lang );2144 Sizzle.error( "unsupported lang: " + lang );
1936 }2145 }
1937 lang = lang.replace( runescape, funescape ).toLowerCase();2146 lang = lang.replace( runescape, funescape ).toLowerCase();
1938 return function( elem ) {2147 return function( elem ) {
1939 var elemLang;2148 var elemLang;
1940 do {2149 do {
1941 if ( (elemLang = documentIsHTML ?2150 if ( ( elemLang = documentIsHTML ?
1942 elem.lang :2151 elem.lang :
1943 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {2152 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
19442153
1945 elemLang = elemLang.toLowerCase();2154 elemLang = elemLang.toLowerCase();
1946 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;2155 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1947 }2156 }
1948 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );2157 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
1949 return false;2158 return false;
1950 };2159 };
1951 }),2160 } ),
19522161
1953 // Miscellaneous2162 // Miscellaneous
1954 "target": function( elem ) {2163 "target": function( elem ) {
@@ -1961,29 +2170,30 @@ Expr = Sizzle.selectors = {
1961 },2170 },
19622171
1963 "focus": function( elem ) {2172 "focus": function( elem ) {
1964 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);2173 return elem === document.activeElement &&
2174 ( !document.hasFocus || document.hasFocus() ) &&
2175 !!( elem.type || elem.href || ~elem.tabIndex );
1965 },2176 },
19662177
1967 // Boolean properties2178 // Boolean properties
1968 "enabled": function( elem ) {2179 "enabled": createDisabledPseudo( false ),
1969 return elem.disabled === false;2180 "disabled": createDisabledPseudo( true ),
1970 },
1971
1972 "disabled": function( elem ) {
1973 return elem.disabled === true;
1974 },
19752181
1976 "checked": function( elem ) {2182 "checked": function( elem ) {
2183
1977 // In CSS3, :checked should return both checked and selected elements2184 // In CSS3, :checked should return both checked and selected elements
1978 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked2185 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1979 var nodeName = elem.nodeName.toLowerCase();2186 var nodeName = elem.nodeName.toLowerCase();
1980 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);2187 return ( nodeName === "input" && !!elem.checked ) ||
2188 ( nodeName === "option" && !!elem.selected );
1981 },2189 },
19822190
1983 "selected": function( elem ) {2191 "selected": function( elem ) {
2192
1984 // Accessing this property makes selected-by-default2193 // Accessing this property makes selected-by-default
1985 // options in Safari work properly2194 // options in Safari work properly
1986 if ( elem.parentNode ) {2195 if ( elem.parentNode ) {
2196 // eslint-disable-next-line no-unused-expressions
1987 elem.parentNode.selectedIndex;2197 elem.parentNode.selectedIndex;
1988 }2198 }
19892199
@@ -1992,6 +2202,7 @@ Expr = Sizzle.selectors = {
19922202
1993 // Contents2203 // Contents
1994 "empty": function( elem ) {2204 "empty": function( elem ) {
2205
1995 // http://www.w3.org/TR/selectors/#empty-pseudo2206 // http://www.w3.org/TR/selectors/#empty-pseudo
1996 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),2207 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1997 // but not by others (comment: 8; processing instruction: 7; etc.)2208 // but not by others (comment: 8; processing instruction: 7; etc.)
@@ -2005,7 +2216,7 @@ Expr = Sizzle.selectors = {
2005 },2216 },
20062217
2007 "parent": function( elem ) {2218 "parent": function( elem ) {
2008 return !Expr.pseudos["empty"]( elem );2219 return !Expr.pseudos[ "empty" ]( elem );
2009 },2220 },
20102221
2011 // Element/input types2222 // Element/input types
@@ -2029,57 +2240,62 @@ Expr = Sizzle.selectors = {
20292240
2030 // Support: IE<82241 // Support: IE<8
2031 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"2242 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2032 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );2243 ( ( attr = elem.getAttribute( "type" ) ) == null ||
2244 attr.toLowerCase() === "text" );
2033 },2245 },
20342246
2035 // Position-in-collection2247 // Position-in-collection
2036 "first": createPositionalPseudo(function() {2248 "first": createPositionalPseudo( function() {
2037 return [ 0 ];2249 return [ 0 ];
2038 }),2250 } ),
20392251
2040 "last": createPositionalPseudo(function( matchIndexes, length ) {2252 "last": createPositionalPseudo( function( _matchIndexes, length ) {
2041 return [ length - 1 ];2253 return [ length - 1 ];
2042 }),2254 } ),
20432255
2044 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {2256 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
2045 return [ argument < 0 ? argument + length : argument ];2257 return [ argument < 0 ? argument + length : argument ];
2046 }),2258 } ),
20472259
2048 "even": createPositionalPseudo(function( matchIndexes, length ) {2260 "even": createPositionalPseudo( function( matchIndexes, length ) {
2049 var i = 0;2261 var i = 0;
2050 for ( ; i < length; i += 2 ) {2262 for ( ; i < length; i += 2 ) {
2051 matchIndexes.push( i );2263 matchIndexes.push( i );
2052 }2264 }
2053 return matchIndexes;2265 return matchIndexes;
2054 }),2266 } ),
20552267
2056 "odd": createPositionalPseudo(function( matchIndexes, length ) {2268 "odd": createPositionalPseudo( function( matchIndexes, length ) {
2057 var i = 1;2269 var i = 1;
2058 for ( ; i < length; i += 2 ) {2270 for ( ; i < length; i += 2 ) {
2059 matchIndexes.push( i );2271 matchIndexes.push( i );
2060 }2272 }
2061 return matchIndexes;2273 return matchIndexes;
2062 }),2274 } ),
20632275
2064 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {2276 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2065 var i = argument < 0 ? argument + length : argument;2277 var i = argument < 0 ?
2278 argument + length :
2279 argument > length ?
2280 length :
2281 argument;
2066 for ( ; --i >= 0; ) {2282 for ( ; --i >= 0; ) {
2067 matchIndexes.push( i );2283 matchIndexes.push( i );
2068 }2284 }
2069 return matchIndexes;2285 return matchIndexes;
2070 }),2286 } ),
20712287
2072 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {2288 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2073 var i = argument < 0 ? argument + length : argument;2289 var i = argument < 0 ? argument + length : argument;
2074 for ( ; ++i < length; ) {2290 for ( ; ++i < length; ) {
2075 matchIndexes.push( i );2291 matchIndexes.push( i );
2076 }2292 }
2077 return matchIndexes;2293 return matchIndexes;
2078 })2294 } )
2079 }2295 }
2080};2296};
20812297
2082Expr.pseudos["nth"] = Expr.pseudos["eq"];2298Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
20832299
2084// Add button/input type pseudos2300// Add button/input type pseudos
2085for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {2301for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
@@ -2110,37 +2326,39 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2110 while ( soFar ) {2326 while ( soFar ) {
21112327
2112 // Comma and first run2328 // Comma and first run
2113 if ( !matched || (match = rcomma.exec( soFar )) ) {2329 if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
2114 if ( match ) {2330 if ( match ) {
2331
2115 // Don't consume trailing commas as valid2332 // Don't consume trailing commas as valid
2116 soFar = soFar.slice( match[0].length ) || soFar;2333 soFar = soFar.slice( match[ 0 ].length ) || soFar;
2117 }2334 }
2118 groups.push( (tokens = []) );2335 groups.push( ( tokens = [] ) );
2119 }2336 }
21202337
2121 matched = false;2338 matched = false;
21222339
2123 // Combinators2340 // Combinators
2124 if ( (match = rcombinators.exec( soFar )) ) {2341 if ( ( match = rcombinators.exec( soFar ) ) ) {
2125 matched = match.shift();2342 matched = match.shift();
2126 tokens.push({2343 tokens.push( {
2127 value: matched,2344 value: matched,
2345
2128 // Cast descendant combinators to space2346 // Cast descendant combinators to space
2129 type: match[0].replace( rtrim, " " )2347 type: match[ 0 ].replace( rtrim, " " )
2130 });2348 } );
2131 soFar = soFar.slice( matched.length );2349 soFar = soFar.slice( matched.length );
2132 }2350 }
21332351
2134 // Filters2352 // Filters
2135 for ( type in Expr.filter ) {2353 for ( type in Expr.filter ) {
2136 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||2354 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
2137 (match = preFilters[ type ]( match ))) ) {2355 ( match = preFilters[ type ]( match ) ) ) ) {
2138 matched = match.shift();2356 matched = match.shift();
2139 tokens.push({2357 tokens.push( {
2140 value: matched,2358 value: matched,
2141 type: type,2359 type: type,
2142 matches: match2360 matches: match
2143 });2361 } );
2144 soFar = soFar.slice( matched.length );2362 soFar = soFar.slice( matched.length );
2145 }2363 }
2146 }2364 }
@@ -2157,6 +2375,7 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2157 soFar.length :2375 soFar.length :
2158 soFar ?2376 soFar ?
2159 Sizzle.error( selector ) :2377 Sizzle.error( selector ) :
2378
2160 // Cache the tokens2379 // Cache the tokens
2161 tokenCache( selector, groups ).slice( 0 );2380 tokenCache( selector, groups ).slice( 0 );
2162};2381};
@@ -2166,24 +2385,28 @@ function toSelector( tokens ) {
2166 len = tokens.length,2385 len = tokens.length,
2167 selector = "";2386 selector = "";
2168 for ( ; i < len; i++ ) {2387 for ( ; i < len; i++ ) {
2169 selector += tokens[i].value;2388 selector += tokens[ i ].value;
2170 }2389 }
2171 return selector;2390 return selector;
2172}2391}
21732392
2174function addCombinator( matcher, combinator, base ) {2393function addCombinator( matcher, combinator, base ) {
2175 var dir = combinator.dir,2394 var dir = combinator.dir,
2176 checkNonElements = base && dir === "parentNode",2395 skip = combinator.next,
2396 key = skip || dir,
2397 checkNonElements = base && key === "parentNode",
2177 doneName = done++;2398 doneName = done++;
21782399
2179 return combinator.first ?2400 return combinator.first ?
2401
2180 // Check against closest ancestor/preceding element2402 // Check against closest ancestor/preceding element
2181 function( elem, context, xml ) {2403 function( elem, context, xml ) {
2182 while ( (elem = elem[ dir ]) ) {2404 while ( ( elem = elem[ dir ] ) ) {
2183 if ( elem.nodeType === 1 || checkNonElements ) {2405 if ( elem.nodeType === 1 || checkNonElements ) {
2184 return matcher( elem, context, xml );2406 return matcher( elem, context, xml );
2185 }2407 }
2186 }2408 }
2409 return false;
2187 } :2410 } :
21882411
2189 // Check against all ancestor/preceding elements2412 // Check against all ancestor/preceding elements
@@ -2193,7 +2416,7 @@ function addCombinator( matcher, combinator, base ) {
21932416
2194 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching2417 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2195 if ( xml ) {2418 if ( xml ) {
2196 while ( (elem = elem[ dir ]) ) {2419 while ( ( elem = elem[ dir ] ) ) {
2197 if ( elem.nodeType === 1 || checkNonElements ) {2420 if ( elem.nodeType === 1 || checkNonElements ) {
2198 if ( matcher( elem, context, xml ) ) {2421 if ( matcher( elem, context, xml ) ) {
2199 return true;2422 return true;
@@ -2201,31 +2424,36 @@ function addCombinator( matcher, combinator, base ) {
2201 }2424 }
2202 }2425 }
2203 } else {2426 } else {
2204 while ( (elem = elem[ dir ]) ) {2427 while ( ( elem = elem[ dir ] ) ) {
2205 if ( elem.nodeType === 1 || checkNonElements ) {2428 if ( elem.nodeType === 1 || checkNonElements ) {
2206 outerCache = elem[ expando ] || (elem[ expando ] = {});2429 outerCache = elem[ expando ] || ( elem[ expando ] = {} );
22072430
2208 // Support: IE <9 only2431 // Support: IE <9 only
2209 // Defend against cloned attroperties (jQuery gh-1709)2432 // Defend against cloned attroperties (jQuery gh-1709)
2210 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});2433 uniqueCache = outerCache[ elem.uniqueID ] ||
2434 ( outerCache[ elem.uniqueID ] = {} );
22112435
2212 if ( (oldCache = uniqueCache[ dir ]) &&2436 if ( skip && skip === elem.nodeName.toLowerCase() ) {
2437 elem = elem[ dir ] || elem;
2438 } else if ( ( oldCache = uniqueCache[ key ] ) &&
2213 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {2439 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
22142440
2215 // Assign to newCache so results back-propagate to previous elements2441 // Assign to newCache so results back-propagate to previous elements
2216 return (newCache[ 2 ] = oldCache[ 2 ]);2442 return ( newCache[ 2 ] = oldCache[ 2 ] );
2217 } else {2443 } else {
2444
2218 // Reuse newcache so results back-propagate to previous elements2445 // Reuse newcache so results back-propagate to previous elements
2219 uniqueCache[ dir ] = newCache;2446 uniqueCache[ key ] = newCache;
22202447
2221 // A match means we're done; a fail means we have to keep checking2448 // A match means we're done; a fail means we have to keep checking
2222 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {2449 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
2223 return true;2450 return true;
2224 }2451 }
2225 }2452 }
2226 }2453 }
2227 }2454 }
2228 }2455 }
2456 return false;
2229 };2457 };
2230}2458}
22312459
@@ -2234,20 +2462,20 @@ function elementMatcher( matchers ) {
2234 function( elem, context, xml ) {2462 function( elem, context, xml ) {
2235 var i = matchers.length;2463 var i = matchers.length;
2236 while ( i-- ) {2464 while ( i-- ) {
2237 if ( !matchers[i]( elem, context, xml ) ) {2465 if ( !matchers[ i ]( elem, context, xml ) ) {
2238 return false;2466 return false;
2239 }2467 }
2240 }2468 }
2241 return true;2469 return true;
2242 } :2470 } :
2243 matchers[0];2471 matchers[ 0 ];
2244}2472}
22452473
2246function multipleContexts( selector, contexts, results ) {2474function multipleContexts( selector, contexts, results ) {
2247 var i = 0,2475 var i = 0,
2248 len = contexts.length;2476 len = contexts.length;
2249 for ( ; i < len; i++ ) {2477 for ( ; i < len; i++ ) {
2250 Sizzle( selector, contexts[i], results );2478 Sizzle( selector, contexts[ i ], results );
2251 }2479 }
2252 return results;2480 return results;
2253}2481}
@@ -2260,7 +2488,7 @@ function condense( unmatched, map, filter, context, xml ) {
2260 mapped = map != null;2488 mapped = map != null;
22612489
2262 for ( ; i < len; i++ ) {2490 for ( ; i < len; i++ ) {
2263 if ( (elem = unmatched[i]) ) {2491 if ( ( elem = unmatched[ i ] ) ) {
2264 if ( !filter || filter( elem, context, xml ) ) {2492 if ( !filter || filter( elem, context, xml ) ) {
2265 newUnmatched.push( elem );2493 newUnmatched.push( elem );
2266 if ( mapped ) {2494 if ( mapped ) {
@@ -2280,14 +2508,18 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2280 if ( postFinder && !postFinder[ expando ] ) {2508 if ( postFinder && !postFinder[ expando ] ) {
2281 postFinder = setMatcher( postFinder, postSelector );2509 postFinder = setMatcher( postFinder, postSelector );
2282 }2510 }
2283 return markFunction(function( seed, results, context, xml ) {2511 return markFunction( function( seed, results, context, xml ) {
2284 var temp, i, elem,2512 var temp, i, elem,
2285 preMap = [],2513 preMap = [],
2286 postMap = [],2514 postMap = [],
2287 preexisting = results.length,2515 preexisting = results.length,
22882516
2289 // Get initial elements from seed or context2517 // Get initial elements from seed or context
2290 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),2518 elems = seed || multipleContexts(
2519 selector || "*",
2520 context.nodeType ? [ context ] : context,
2521 []
2522 ),
22912523
2292 // Prefilter to get matcher input, preserving a map for seed-results synchronization2524 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2293 matcherIn = preFilter && ( seed || !selector ) ?2525 matcherIn = preFilter && ( seed || !selector ) ?
@@ -2295,6 +2527,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2295 elems,2527 elems,
22962528
2297 matcherOut = matcher ?2529 matcherOut = matcher ?
2530
2298 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,2531 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2299 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?2532 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
23002533
@@ -2318,8 +2551,8 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2318 // Un-match failing elements by moving them back to matcherIn2551 // Un-match failing elements by moving them back to matcherIn
2319 i = temp.length;2552 i = temp.length;
2320 while ( i-- ) {2553 while ( i-- ) {
2321 if ( (elem = temp[i]) ) {2554 if ( ( elem = temp[ i ] ) ) {
2322 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);2555 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
2323 }2556 }
2324 }2557 }
2325 }2558 }
@@ -2327,25 +2560,27 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2327 if ( seed ) {2560 if ( seed ) {
2328 if ( postFinder || preFilter ) {2561 if ( postFinder || preFilter ) {
2329 if ( postFinder ) {2562 if ( postFinder ) {
2563
2330 // Get the final matcherOut by condensing this intermediate into postFinder contexts2564 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2331 temp = [];2565 temp = [];
2332 i = matcherOut.length;2566 i = matcherOut.length;
2333 while ( i-- ) {2567 while ( i-- ) {
2334 if ( (elem = matcherOut[i]) ) {2568 if ( ( elem = matcherOut[ i ] ) ) {
2569
2335 // Restore matcherIn since elem is not yet a final match2570 // Restore matcherIn since elem is not yet a final match
2336 temp.push( (matcherIn[i] = elem) );2571 temp.push( ( matcherIn[ i ] = elem ) );
2337 }2572 }
2338 }2573 }
2339 postFinder( null, (matcherOut = []), temp, xml );2574 postFinder( null, ( matcherOut = [] ), temp, xml );
2340 }2575 }
23412576
2342 // Move matched elements from seed to results to keep them synchronized2577 // Move matched elements from seed to results to keep them synchronized
2343 i = matcherOut.length;2578 i = matcherOut.length;
2344 while ( i-- ) {2579 while ( i-- ) {
2345 if ( (elem = matcherOut[i]) &&2580 if ( ( elem = matcherOut[ i ] ) &&
2346 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {2581 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
23472582
2348 seed[temp] = !(results[temp] = elem);2583 seed[ temp ] = !( results[ temp ] = elem );
2349 }2584 }
2350 }2585 }
2351 }2586 }
@@ -2363,14 +2598,14 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2363 push.apply( results, matcherOut );2598 push.apply( results, matcherOut );
2364 }2599 }
2365 }2600 }
2366 });2601 } );
2367}2602}
23682603
2369function matcherFromTokens( tokens ) {2604function matcherFromTokens( tokens ) {
2370 var checkContext, matcher, j,2605 var checkContext, matcher, j,
2371 len = tokens.length,2606 len = tokens.length,
2372 leadingRelative = Expr.relative[ tokens[0].type ],2607 leadingRelative = Expr.relative[ tokens[ 0 ].type ],
2373 implicitRelative = leadingRelative || Expr.relative[" "],2608 implicitRelative = leadingRelative || Expr.relative[ " " ],
2374 i = leadingRelative ? 1 : 0,2609 i = leadingRelative ? 1 : 0,
23752610
2376 // The foundational matcher ensures that elements are reachable from top-level context(s)2611 // The foundational matcher ensures that elements are reachable from top-level context(s)
@@ -2382,38 +2617,43 @@ function matcherFromTokens( tokens ) {
2382 }, implicitRelative, true ),2617 }, implicitRelative, true ),
2383 matchers = [ function( elem, context, xml ) {2618 matchers = [ function( elem, context, xml ) {
2384 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (2619 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2385 (checkContext = context).nodeType ?2620 ( checkContext = context ).nodeType ?
2386 matchContext( elem, context, xml ) :2621 matchContext( elem, context, xml ) :
2387 matchAnyContext( elem, context, xml ) );2622 matchAnyContext( elem, context, xml ) );
2623
2388 // Avoid hanging onto element (issue #299)2624 // Avoid hanging onto element (issue #299)
2389 checkContext = null;2625 checkContext = null;
2390 return ret;2626 return ret;
2391 } ];2627 } ];
23922628
2393 for ( ; i < len; i++ ) {2629 for ( ; i < len; i++ ) {
2394 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {2630 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
2395 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];2631 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
2396 } else {2632 } else {
2397 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );2633 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
23982634
2399 // Return special upon seeing a positional matcher2635 // Return special upon seeing a positional matcher
2400 if ( matcher[ expando ] ) {2636 if ( matcher[ expando ] ) {
2637
2401 // Find the next relative operator (if any) for proper handling2638 // Find the next relative operator (if any) for proper handling
2402 j = ++i;2639 j = ++i;
2403 for ( ; j < len; j++ ) {2640 for ( ; j < len; j++ ) {
2404 if ( Expr.relative[ tokens[j].type ] ) {2641 if ( Expr.relative[ tokens[ j ].type ] ) {
2405 break;2642 break;
2406 }2643 }
2407 }2644 }
2408 return setMatcher(2645 return setMatcher(
2409 i > 1 && elementMatcher( matchers ),2646 i > 1 && elementMatcher( matchers ),
2410 i > 1 && toSelector(2647 i > 1 && toSelector(
2411 // If the preceding token was a descendant combinator, insert an implicit any-element `*`2648
2412 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })2649 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2650 tokens
2651 .slice( 0, i - 1 )
2652 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2413 ).replace( rtrim, "$1" ),2653 ).replace( rtrim, "$1" ),
2414 matcher,2654 matcher,
2415 i < j && matcherFromTokens( tokens.slice( i, j ) ),2655 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2416 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),2656 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
2417 j < len && toSelector( tokens )2657 j < len && toSelector( tokens )
2418 );2658 );
2419 }2659 }
@@ -2434,28 +2674,40 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2434 unmatched = seed && [],2674 unmatched = seed && [],
2435 setMatched = [],2675 setMatched = [],
2436 contextBackup = outermostContext,2676 contextBackup = outermostContext,
2677
2437 // We must always have either seed elements or outermost context2678 // We must always have either seed elements or outermost context
2438 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),2679 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
2680
2439 // Use integer dirruns iff this is the outermost matcher2681 // Use integer dirruns iff this is the outermost matcher
2440 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),2682 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
2441 len = elems.length;2683 len = elems.length;
24422684
2443 if ( outermost ) {2685 if ( outermost ) {
2444 outermostContext = context === document || context || outermost;2686
2687 // Support: IE 11+, Edge 17 - 18+
2688 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2689 // two documents; shallow comparisons work.
2690 // eslint-disable-next-line eqeqeq
2691 outermostContext = context == document || context || outermost;
2445 }2692 }
24462693
2447 // Add elements passing elementMatchers directly to results2694 // Add elements passing elementMatchers directly to results
2448 // Support: IE<9, Safari2695 // Support: IE<9, Safari
2449 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id2696 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2450 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {2697 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2451 if ( byElement && elem ) {2698 if ( byElement && elem ) {
2452 j = 0;2699 j = 0;
2453 if ( !context && elem.ownerDocument !== document ) {2700
2701 // Support: IE 11+, Edge 17 - 18+
2702 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2703 // two documents; shallow comparisons work.
2704 // eslint-disable-next-line eqeqeq
2705 if ( !context && elem.ownerDocument != document ) {
2454 setDocument( elem );2706 setDocument( elem );
2455 xml = !documentIsHTML;2707 xml = !documentIsHTML;
2456 }2708 }
2457 while ( (matcher = elementMatchers[j++]) ) {2709 while ( ( matcher = elementMatchers[ j++ ] ) ) {
2458 if ( matcher( elem, context || document, xml) ) {2710 if ( matcher( elem, context || document, xml ) ) {
2459 results.push( elem );2711 results.push( elem );
2460 break;2712 break;
2461 }2713 }
@@ -2467,8 +2719,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
24672719
2468 // Track unmatched elements for set filters2720 // Track unmatched elements for set filters
2469 if ( bySet ) {2721 if ( bySet ) {
2722
2470 // They will have gone through all possible matchers2723 // They will have gone through all possible matchers
2471 if ( (elem = !matcher && elem) ) {2724 if ( ( elem = !matcher && elem ) ) {
2472 matchedCount--;2725 matchedCount--;
2473 }2726 }
24742727
@@ -2492,16 +2745,17 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2492 // numerically zero.2745 // numerically zero.
2493 if ( bySet && i !== matchedCount ) {2746 if ( bySet && i !== matchedCount ) {
2494 j = 0;2747 j = 0;
2495 while ( (matcher = setMatchers[j++]) ) {2748 while ( ( matcher = setMatchers[ j++ ] ) ) {
2496 matcher( unmatched, setMatched, context, xml );2749 matcher( unmatched, setMatched, context, xml );
2497 }2750 }
24982751
2499 if ( seed ) {2752 if ( seed ) {
2753
2500 // Reintegrate element matches to eliminate the need for sorting2754 // Reintegrate element matches to eliminate the need for sorting
2501 if ( matchedCount > 0 ) {2755 if ( matchedCount > 0 ) {
2502 while ( i-- ) {2756 while ( i-- ) {
2503 if ( !(unmatched[i] || setMatched[i]) ) {2757 if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
2504 setMatched[i] = pop.call( results );2758 setMatched[ i ] = pop.call( results );
2505 }2759 }
2506 }2760 }
2507 }2761 }
@@ -2542,13 +2796,14 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2542 cached = compilerCache[ selector + " " ];2796 cached = compilerCache[ selector + " " ];
25432797
2544 if ( !cached ) {2798 if ( !cached ) {
2799
2545 // Generate a function of recursive functions that can be used to check each element2800 // Generate a function of recursive functions that can be used to check each element
2546 if ( !match ) {2801 if ( !match ) {
2547 match = tokenize( selector );2802 match = tokenize( selector );
2548 }2803 }
2549 i = match.length;2804 i = match.length;
2550 while ( i-- ) {2805 while ( i-- ) {
2551 cached = matcherFromTokens( match[i] );2806 cached = matcherFromTokens( match[ i ] );
2552 if ( cached[ expando ] ) {2807 if ( cached[ expando ] ) {
2553 setMatchers.push( cached );2808 setMatchers.push( cached );
2554 } else {2809 } else {
@@ -2557,7 +2812,10 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2557 }2812 }
25582813
2559 // Cache the compiled function2814 // Cache the compiled function
2560 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );2815 cached = compilerCache(
2816 selector,
2817 matcherFromGroupMatchers( elementMatchers, setMatchers )
2818 );
25612819
2562 // Save selector and tokenization2820 // Save selector and tokenization
2563 cached.selector = selector;2821 cached.selector = selector;
@@ -2577,7 +2835,7 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2577select = Sizzle.select = function( selector, context, results, seed ) {2835select = Sizzle.select = function( selector, context, results, seed ) {
2578 var i, tokens, token, type, find,2836 var i, tokens, token, type, find,
2579 compiled = typeof selector === "function" && selector,2837 compiled = typeof selector === "function" && selector,
2580 match = !seed && tokenize( (selector = compiled.selector || selector) );2838 match = !seed && tokenize( ( selector = compiled.selector || selector ) );
25812839
2582 results = results || [];2840 results = results || [];
25832841
@@ -2586,12 +2844,12 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2586 if ( match.length === 1 ) {2844 if ( match.length === 1 ) {
25872845
2588 // Reduce context if the leading compound selector is an ID2846 // Reduce context if the leading compound selector is an ID
2589 tokens = match[0] = match[0].slice( 0 );2847 tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2590 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&2848 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2591 support.getById && context.nodeType === 9 && documentIsHTML &&2849 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2592 Expr.relative[ tokens[1].type ] ) {
25932850
2594 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];2851 context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
2852 .replace( runescape, funescape ), context ) || [] )[ 0 ];
2595 if ( !context ) {2853 if ( !context ) {
2596 return results;2854 return results;
25972855
@@ -2604,20 +2862,22 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2604 }2862 }
26052863
2606 // Fetch a seed set for right-to-left matching2864 // Fetch a seed set for right-to-left matching
2607 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;2865 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
2608 while ( i-- ) {2866 while ( i-- ) {
2609 token = tokens[i];2867 token = tokens[ i ];
26102868
2611 // Abort if we hit a combinator2869 // Abort if we hit a combinator
2612 if ( Expr.relative[ (type = token.type) ] ) {2870 if ( Expr.relative[ ( type = token.type ) ] ) {
2613 break;2871 break;
2614 }2872 }
2615 if ( (find = Expr.find[ type ]) ) {2873 if ( ( find = Expr.find[ type ] ) ) {
2874
2616 // Search, expanding context for leading sibling combinators2875 // Search, expanding context for leading sibling combinators
2617 if ( (seed = find(2876 if ( ( seed = find(
2618 token.matches[0].replace( runescape, funescape ),2877 token.matches[ 0 ].replace( runescape, funescape ),
2619 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context2878 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
2620 )) ) {2879 context
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches