Merge ~corey.bryant/ubuntu/+source/horizon:master into ~ubuntu-openstack-dev/ubuntu/+source/horizon:master
- Git
- lp:~corey.bryant/ubuntu/+source/horizon
- master
- Merge into 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) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu OpenStack uploaders | Pending | ||
Review via email:
|
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
1 | diff --git a/debian/changelog b/debian/changelog | |||
2 | index 23ac026..070e696 100644 | |||
3 | --- a/debian/changelog | |||
4 | +++ b/debian/changelog | |||
5 | @@ -1,3 +1,10 @@ | |||
6 | 1 | horizon (4:23.2.0+git2023090509.7896fd8c-0ubuntu1) mantic; urgency=medium | ||
7 | 2 | |||
8 | 3 | * New upstream snapshot for OpenStack Bobcat. | ||
9 | 4 | * Refresh xstatic assets. | ||
10 | 5 | |||
11 | 6 | -- Corey Bryant <corey.bryant@canonical.com> Tue, 05 Sep 2023 09:20:32 -0400 | ||
12 | 7 | |||
13 | 1 | horizon (4:23.2.0+git2023071214.e6f39871-0ubuntu1) mantic; urgency=medium | 8 | horizon (4:23.2.0+git2023071214.e6f39871-0ubuntu1) mantic; urgency=medium |
14 | 2 | 9 | ||
15 | 3 | * d/gbp.conf, .launchpad.yaml: Sync from cloud-archive-tools for | 10 | * d/gbp.conf, .launchpad.yaml: Sync from cloud-archive-tools for |
16 | diff --git a/xstatic/pkg/angular_fileupload/__init__.py b/xstatic/pkg/angular_fileupload/__init__.py | |||
17 | index 43c9db9..b812f41 100644 | |||
18 | --- a/xstatic/pkg/angular_fileupload/__init__.py | |||
19 | +++ b/xstatic/pkg/angular_fileupload/__init__.py | |||
20 | @@ -11,7 +11,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar') | |||
21 | 11 | # please use a all-lowercase valid python | 11 | # please use a all-lowercase valid python |
22 | 12 | # package name | 12 | # package name |
23 | 13 | 13 | ||
25 | 14 | VERSION = '12.0.4' # version of the packaged files, please use the upstream | 14 | VERSION = '12.2.13' # version of the packaged files, please use the upstream |
26 | 15 | # version number | 15 | # version number |
27 | 16 | BUILD = '0' # our package build number, so we can release new builds | 16 | BUILD = '0' # our package build number, so we can release new builds |
28 | 17 | # with fixes for xstatic stuff. | 17 | # with fixes for xstatic stuff. |
29 | @@ -24,8 +24,8 @@ CLASSIFIERS = [] | |||
30 | 24 | KEYWORDS = '%s xstatic' % NAME | 24 | KEYWORDS = '%s xstatic' % NAME |
31 | 25 | 25 | ||
32 | 26 | # XStatic-* package maintainer: | 26 | # XStatic-* package maintainer: |
35 | 27 | MAINTAINER = 'Rob Cresswell' | 27 | MAINTAINER = 'Radomir Dopieralski' |
36 | 28 | MAINTAINER_EMAIL = 'robert.cresswell@outlook.com' | 28 | MAINTAINER_EMAIL = 'openstack@sheep.art.pl' |
37 | 29 | 29 | ||
38 | 30 | # this refers to the project homepage of the stuff we packaged: | 30 | # this refers to the project homepage of the stuff we packaged: |
39 | 31 | HOMEPAGE = 'https://github.com/danialfarid/angular-file-upload' | 31 | HOMEPAGE = 'https://github.com/danialfarid/angular-file-upload' |
40 | diff --git a/xstatic/pkg/angular_fileupload/data/FileAPI.min.js b/xstatic/pkg/angular_fileupload/data/FileAPI.min.js | |||
41 | index c7b0266..2afb71e 100644 | |||
42 | --- a/xstatic/pkg/angular_fileupload/data/FileAPI.min.js | |||
43 | +++ b/xstatic/pkg/angular_fileupload/data/FileAPI.min.js | |||
44 | @@ -1,4 +1,4 @@ | |||
46 | 1 | /*! 12.0.4 */ | 1 | /*! 12.2.13 */ |
47 | 2 | /*! FileAPI 2.0.7 - BSD | git://github.com/mailru/FileAPI.git | 2 | /*! FileAPI 2.0.7 - BSD | git://github.com/mailru/FileAPI.git |
48 | 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. |
49 | 4 | */ | 4 | */ |
50 | diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js | |||
51 | index fca2e64..e342351 100644 | |||
52 | --- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js | |||
53 | +++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.js | |||
54 | @@ -1,9 +1,9 @@ | |||
55 | 1 | /**! | 1 | /**! |
57 | 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, |
58 | 3 | * progress, resize, thumbnail, preview, validation and CORS | 3 | * progress, resize, thumbnail, preview, validation and CORS |
59 | 4 | * FileAPI Flash shim for old browsers not supporting FormData | 4 | * FileAPI Flash shim for old browsers not supporting FormData |
60 | 5 | * @author Danial <danial.farid@gmail.com> | 5 | * @author Danial <danial.farid@gmail.com> |
62 | 6 | * @version 12.0.4 | 6 | * @version 12.2.13 |
63 | 7 | */ | 7 | */ |
64 | 8 | 8 | ||
65 | 9 | (function () { | 9 | (function () { |
66 | @@ -424,7 +424,7 @@ if (!window.FileReader) { | |||
67 | 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, |
68 | 425 | * progress, resize, thumbnail, preview, validation and CORS | 425 | * progress, resize, thumbnail, preview, validation and CORS |
69 | 426 | * @author Danial <danial.farid@gmail.com> | 426 | * @author Danial <danial.farid@gmail.com> |
71 | 427 | * @version 12.0.4 | 427 | * @version 12.2.13 |
72 | 428 | */ | 428 | */ |
73 | 429 | 429 | ||
74 | 430 | if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | 430 | if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { |
75 | @@ -445,7 +445,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | |||
76 | 445 | 445 | ||
77 | 446 | var ngFileUpload = angular.module('ngFileUpload', []); | 446 | var ngFileUpload = angular.module('ngFileUpload', []); |
78 | 447 | 447 | ||
80 | 448 | ngFileUpload.version = '12.0.4'; | 448 | ngFileUpload.version = '12.2.13'; |
81 | 449 | 449 | ||
82 | 450 | ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) { | 450 | ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) { |
83 | 451 | var upload = this; | 451 | var upload = this; |
84 | @@ -512,10 +512,12 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |||
85 | 512 | function uploadWithAngular() { | 512 | function uploadWithAngular() { |
86 | 513 | $http(config).then(function (r) { | 513 | $http(config).then(function (r) { |
87 | 514 | if (resumeSupported && config._chunkSize && !config._finished && config._file) { | 514 | if (resumeSupported && config._chunkSize && !config._finished && config._file) { |
88 | 515 | var fileSize = config._file && config._file.size || 0; | ||
89 | 515 | notifyProgress({ | 516 | notifyProgress({ |
93 | 516 | loaded: config._end, | 517 | loaded: Math.min(config._end, fileSize), |
94 | 517 | total: config._file && config._file.size, | 518 | total: fileSize, |
95 | 518 | config: config, type: 'progress' | 519 | config: config, |
96 | 520 | type: 'progress' | ||
97 | 519 | } | 521 | } |
98 | 520 | ); | 522 | ); |
99 | 521 | upload.upload(config, true); | 523 | upload.upload(config, true); |
100 | @@ -554,6 +556,9 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |||
101 | 554 | } else if (config.resumeSize) { | 556 | } else if (config.resumeSize) { |
102 | 555 | config.resumeSize().then(function (size) { | 557 | config.resumeSize().then(function (size) { |
103 | 556 | config._start = size; | 558 | config._start = size; |
104 | 559 | if (config._chunkSize) { | ||
105 | 560 | config._end = config._start + config._chunkSize; | ||
106 | 561 | } | ||
107 | 557 | uploadWithAngular(); | 562 | uploadWithAngular(); |
108 | 558 | }, function (e) { | 563 | }, function (e) { |
109 | 559 | throw e; | 564 | throw e; |
110 | @@ -607,9 +612,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |||
111 | 607 | }; | 612 | }; |
112 | 608 | 613 | ||
113 | 609 | upload.promisesCount++; | 614 | upload.promisesCount++; |
117 | 610 | promise['finally'](function () { | 615 | if (promise['finally'] && promise['finally'] instanceof Function) { |
118 | 611 | upload.promisesCount--; | 616 | promise['finally'](function () { |
119 | 612 | }); | 617 | upload.promisesCount--; |
120 | 618 | }); | ||
121 | 619 | } | ||
122 | 613 | return promise; | 620 | return promise; |
123 | 614 | } | 621 | } |
124 | 615 | 622 | ||
125 | @@ -793,9 +800,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |||
126 | 793 | var arrayBufferView = new Uint8Array(resp.data); | 800 | var arrayBufferView = new Uint8Array(resp.data); |
127 | 794 | var type = resp.headers('content-type') || 'image/WebP'; | 801 | var type = resp.headers('content-type') || 'image/WebP'; |
128 | 795 | var blob = new window.Blob([arrayBufferView], {type: type}); | 802 | var blob = new window.Blob([arrayBufferView], {type: type}); |
129 | 803 | var matches = url.match(/.*\/(.+?)(\?.*)?$/); | ||
130 | 804 | if (matches.length > 1) { | ||
131 | 805 | blob.name = matches[1]; | ||
132 | 806 | } | ||
133 | 796 | defer.resolve(blob); | 807 | defer.resolve(blob); |
134 | 797 | //var split = type.split('[/;]'); | ||
135 | 798 | //blob.name = url.substring(0, 150).replace(/\W+/g, '') + '.' + (split.length > 1 ? split[1] : 'jpg'); | ||
136 | 799 | }, function (e) { | 808 | }, function (e) { |
137 | 800 | defer.reject(e); | 809 | defer.reject(e); |
138 | 801 | }); | 810 | }); |
139 | @@ -843,7 +852,7 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
140 | 843 | }; | 852 | }; |
141 | 844 | 853 | ||
142 | 845 | upload.shouldUpdateOn = function (type, attr, scope) { | 854 | upload.shouldUpdateOn = function (type, attr, scope) { |
144 | 846 | var modelOptions = upload.attrGetter('ngModelOptions', attr, scope); | 855 | var modelOptions = upload.attrGetter('ngfModelOptions', attr, scope); |
145 | 847 | if (modelOptions && modelOptions.updateOn) { | 856 | if (modelOptions && modelOptions.updateOn) { |
146 | 848 | return modelOptions.updateOn.split(' ').indexOf(type) > -1; | 857 | return modelOptions.updateOn.split(' ').indexOf(type) > -1; |
147 | 849 | } | 858 | } |
148 | @@ -893,13 +902,13 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
149 | 893 | return $q.all(promises); | 902 | return $q.all(promises); |
150 | 894 | } | 903 | } |
151 | 895 | 904 | ||
153 | 896 | function resize(files, attr, scope) { | 905 | function resizeFile(files, attr, scope, ngModel) { |
154 | 897 | var resizeVal = upload.attrGetter('ngfResize', attr, scope); | 906 | var resizeVal = upload.attrGetter('ngfResize', attr, scope); |
155 | 898 | if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise(); | 907 | if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise(); |
156 | 899 | if (resizeVal instanceof Function) { | 908 | if (resizeVal instanceof Function) { |
157 | 900 | var defer = $q.defer(); | 909 | var defer = $q.defer(); |
160 | 901 | resizeVal(files).then(function (p) { | 910 | return resizeVal(files).then(function (p) { |
161 | 902 | resizeWithParams(p, files, attr, scope).then(function (r) { | 911 | resizeWithParams(p, files, attr, scope, ngModel).then(function (r) { |
162 | 903 | defer.resolve(r); | 912 | defer.resolve(r); |
163 | 904 | }, function (e) { | 913 | }, function (e) { |
164 | 905 | defer.reject(e); | 914 | defer.reject(e); |
165 | @@ -908,27 +917,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
166 | 908 | defer.reject(e); | 917 | defer.reject(e); |
167 | 909 | }); | 918 | }); |
168 | 910 | } else { | 919 | } else { |
170 | 911 | return resizeWithParams(resizeVal, files, attr, scope); | 920 | return resizeWithParams(resizeVal, files, attr, scope, ngModel); |
171 | 912 | } | 921 | } |
172 | 913 | } | 922 | } |
173 | 914 | 923 | ||
175 | 915 | function resizeWithParams(param, files, attr, scope) { | 924 | function resizeWithParams(params, files, attr, scope, ngModel) { |
176 | 916 | var promises = [upload.emptyPromise()]; | 925 | var promises = [upload.emptyPromise()]; |
177 | 917 | 926 | ||
178 | 918 | function handleFile(f, i) { | 927 | function handleFile(f, i) { |
179 | 919 | if (f.type.indexOf('image') === 0) { | 928 | if (f.type.indexOf('image') === 0) { |
186 | 920 | if (param.pattern && !upload.validatePattern(f, param.pattern)) return; | 929 | if (params.pattern && !upload.validatePattern(f, params.pattern)) return; |
187 | 921 | var promise = upload.resize(f, param.width, param.height, param.quality, | 930 | params.resizeIf = function (width, height) { |
188 | 922 | param.type, param.ratio, param.centerCrop, function (width, height) { | 931 | return upload.attrGetter('ngfResizeIf', attr, scope, |
189 | 923 | return upload.attrGetter('ngfResizeIf', attr, scope, | 932 | {$width: width, $height: height, $file: f}); |
190 | 924 | {$width: width, $height: height, $file: f}); | 933 | }; |
191 | 925 | }, param.restoreExif !== false); | 934 | var promise = upload.resize(f, params); |
192 | 926 | promises.push(promise); | 935 | promises.push(promise); |
193 | 927 | promise.then(function (resizedFile) { | 936 | promise.then(function (resizedFile) { |
194 | 928 | files.splice(i, 1, resizedFile); | 937 | files.splice(i, 1, resizedFile); |
195 | 929 | }, function (e) { | 938 | }, function (e) { |
196 | 930 | f.$error = 'resize'; | 939 | f.$error = 'resize'; |
197 | 940 | (f.$errorMessages = (f.$errorMessages || {})).resize = true; | ||
198 | 931 | f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name); | 941 | f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name); |
199 | 942 | ngModel.$ngfValidations.push({name: 'resize', valid: false}); | ||
200 | 943 | upload.applyModelValidation(ngModel, files); | ||
201 | 932 | }); | 944 | }); |
202 | 933 | } | 945 | } |
203 | 934 | } | 946 | } |
204 | @@ -1015,18 +1027,6 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
205 | 1015 | return angular.isArray(v) ? v : [v]; | 1027 | return angular.isArray(v) ? v : [v]; |
206 | 1016 | } | 1028 | } |
207 | 1017 | 1029 | ||
208 | 1018 | function separateInvalids() { | ||
209 | 1019 | valids = []; | ||
210 | 1020 | invalids = []; | ||
211 | 1021 | angular.forEach(allNewFiles, function (file) { | ||
212 | 1022 | if (file.$error) { | ||
213 | 1023 | invalids.push(file); | ||
214 | 1024 | } else { | ||
215 | 1025 | valids.push(file); | ||
216 | 1026 | } | ||
217 | 1027 | }); | ||
218 | 1028 | } | ||
219 | 1029 | |||
220 | 1030 | function resizeAndUpdate() { | 1030 | function resizeAndUpdate() { |
221 | 1031 | function updateModel() { | 1031 | function updateModel() { |
222 | 1032 | $timeout(function () { | 1032 | $timeout(function () { |
223 | @@ -1036,17 +1036,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
224 | 1036 | }, options && options.debounce ? options.debounce.change || options.debounce : 0); | 1036 | }, options && options.debounce ? options.debounce.change || options.debounce : 0); |
225 | 1037 | } | 1037 | } |
226 | 1038 | 1038 | ||
228 | 1039 | resize(validateAfterResize ? allNewFiles : valids, attr, scope).then(function () { | 1039 | var resizingFiles = validateAfterResize ? allNewFiles : valids; |
229 | 1040 | resizeFile(resizingFiles, attr, scope, ngModel).then(function () { | ||
230 | 1040 | if (validateAfterResize) { | 1041 | if (validateAfterResize) { |
235 | 1041 | upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () { | 1042 | upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope) |
236 | 1042 | separateInvalids(); | 1043 | .then(function (validationResult) { |
237 | 1043 | updateModel(); | 1044 | valids = validationResult.validsFiles; |
238 | 1044 | }); | 1045 | invalids = validationResult.invalidsFiles; |
239 | 1046 | updateModel(); | ||
240 | 1047 | }); | ||
241 | 1045 | } else { | 1048 | } else { |
242 | 1046 | updateModel(); | 1049 | updateModel(); |
243 | 1047 | } | 1050 | } |
246 | 1048 | }, function (e) { | 1051 | }, function () { |
247 | 1049 | throw 'Could not resize files ' + e; | 1052 | for (var i = 0; i < resizingFiles.length; i++) { |
248 | 1053 | var f = resizingFiles[i]; | ||
249 | 1054 | if (f.$error === 'resize') { | ||
250 | 1055 | var index = valids.indexOf(f); | ||
251 | 1056 | if (index > -1) { | ||
252 | 1057 | valids.splice(index, 1); | ||
253 | 1058 | invalids.push(f); | ||
254 | 1059 | } | ||
255 | 1060 | updateModel(); | ||
256 | 1061 | } | ||
257 | 1062 | } | ||
258 | 1050 | }); | 1063 | }); |
259 | 1051 | } | 1064 | } |
260 | 1052 | 1065 | ||
261 | @@ -1076,13 +1089,15 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
262 | 1076 | 1089 | ||
263 | 1077 | var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope); | 1090 | var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope); |
264 | 1078 | 1091 | ||
267 | 1079 | var options = upload.attrGetter('ngModelOptions', attr, scope); | 1092 | var options = upload.attrGetter('ngfModelOptions', attr, scope); |
268 | 1080 | upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () { | 1093 | upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope) |
269 | 1094 | .then(function (validationResult) { | ||
270 | 1081 | if (noDelay) { | 1095 | if (noDelay) { |
271 | 1082 | update(allNewFiles, [], files, dupFiles, isSingleModel); | 1096 | update(allNewFiles, [], files, dupFiles, isSingleModel); |
272 | 1083 | } else { | 1097 | } else { |
273 | 1084 | if ((!options || !options.allowInvalid) && !validateAfterResize) { | 1098 | if ((!options || !options.allowInvalid) && !validateAfterResize) { |
275 | 1085 | separateInvalids(); | 1099 | valids = validationResult.validFiles; |
276 | 1100 | invalids = validationResult.invalidFiles; | ||
277 | 1086 | } else { | 1101 | } else { |
278 | 1087 | valids = allNewFiles; | 1102 | valids = allNewFiles; |
279 | 1088 | } | 1103 | } |
280 | @@ -1119,7 +1134,7 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
281 | 1119 | /** @namespace attr.ngfSelect */ | 1134 | /** @namespace attr.ngfSelect */ |
282 | 1120 | /** @namespace attr.ngfChange */ | 1135 | /** @namespace attr.ngfChange */ |
283 | 1121 | /** @namespace attr.ngModel */ | 1136 | /** @namespace attr.ngModel */ |
285 | 1122 | /** @namespace attr.ngModelOptions */ | 1137 | /** @namespace attr.ngfModelOptions */ |
286 | 1123 | /** @namespace attr.ngfMultiple */ | 1138 | /** @namespace attr.ngfMultiple */ |
287 | 1124 | /** @namespace attr.ngfCapture */ | 1139 | /** @namespace attr.ngfCapture */ |
288 | 1125 | /** @namespace attr.ngfValidate */ | 1140 | /** @namespace attr.ngfValidate */ |
289 | @@ -1139,6 +1154,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
290 | 1139 | function changeFn(evt) { | 1154 | function changeFn(evt) { |
291 | 1140 | if (upload.shouldUpdateOn('change', attr, scope)) { | 1155 | if (upload.shouldUpdateOn('change', attr, scope)) { |
292 | 1141 | var fileList = evt.__files_ || (evt.target && evt.target.files), files = []; | 1156 | var fileList = evt.__files_ || (evt.target && evt.target.files), files = []; |
293 | 1157 | /* Handle duplicate call in IE11 */ | ||
294 | 1158 | if (!fileList) return; | ||
295 | 1142 | for (var i = 0; i < fileList.length; i++) { | 1159 | for (var i = 0; i < fileList.length; i++) { |
296 | 1143 | files.push(fileList[i]); | 1160 | files.push(fileList[i]); |
297 | 1144 | } | 1161 | } |
298 | @@ -1150,31 +1167,39 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
299 | 1150 | upload.registerModelChangeValidator(ngModel, attr, scope); | 1167 | upload.registerModelChangeValidator(ngModel, attr, scope); |
300 | 1151 | 1168 | ||
301 | 1152 | var unwatches = []; | 1169 | var unwatches = []; |
312 | 1153 | unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () { | 1170 | if (attrGetter('ngfMultiple')) { |
313 | 1154 | fileElem.attr('multiple', attrGetter('ngfMultiple', scope)); | 1171 | unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () { |
314 | 1155 | })); | 1172 | fileElem.attr('multiple', attrGetter('ngfMultiple', scope)); |
315 | 1156 | unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () { | 1173 | })); |
316 | 1157 | fileElem.attr('capture', attrGetter('ngfCapture', scope)); | 1174 | } |
317 | 1158 | })); | 1175 | if (attrGetter('ngfCapture')) { |
318 | 1159 | unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () { | 1176 | unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () { |
319 | 1160 | fileElem.attr('accept', attrGetter('ngfAccept', scope)); | 1177 | fileElem.attr('capture', attrGetter('ngfCapture', scope)); |
320 | 1161 | })); | 1178 | })); |
321 | 1162 | attr.$observe('accept', function () { | 1179 | } |
322 | 1180 | if (attrGetter('ngfAccept')) { | ||
323 | 1181 | unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () { | ||
324 | 1182 | fileElem.attr('accept', attrGetter('ngfAccept', scope)); | ||
325 | 1183 | })); | ||
326 | 1184 | } | ||
327 | 1185 | unwatches.push(attr.$observe('accept', function () { | ||
328 | 1163 | fileElem.attr('accept', attrGetter('accept')); | 1186 | fileElem.attr('accept', attrGetter('accept')); |
343 | 1164 | }); | 1187 | })); |
344 | 1165 | unwatches.push(function () { | 1188 | function bindAttrToFileInput(fileElem, label) { |
345 | 1166 | if (attr.$$observers) delete attr.$$observers.accept; | 1189 | function updateId(val) { |
346 | 1167 | }); | 1190 | fileElem.attr('id', 'ngf-' + val); |
347 | 1168 | function bindAttrToFileInput(fileElem) { | 1191 | label.attr('id', 'ngf-label-' + val); |
348 | 1169 | if (elem !== fileElem) { | 1192 | } |
349 | 1170 | for (var i = 0; i < elem[0].attributes.length; i++) { | 1193 | |
350 | 1171 | var attribute = elem[0].attributes[i]; | 1194 | for (var i = 0; i < elem[0].attributes.length; i++) { |
351 | 1172 | if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') { | 1195 | var attribute = elem[0].attributes[i]; |
352 | 1173 | if (attribute.value == null || attribute.value === '') { | 1196 | if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') { |
353 | 1174 | if (attribute.name === 'required') attribute.value = 'required'; | 1197 | if (attribute.name === 'id') { |
354 | 1175 | if (attribute.name === 'multiple') attribute.value = 'multiple'; | 1198 | updateId(attribute.value); |
355 | 1176 | } | 1199 | unwatches.push(attr.$observe('id', updateId)); |
356 | 1177 | fileElem.attr(attribute.name, attribute.name === 'id' ? 'ngf-' + attribute.value : attribute.value); | 1200 | } else { |
357 | 1201 | fileElem.attr(attribute.name, (!attribute.value && (attribute.name === 'required' || | ||
358 | 1202 | attribute.name === 'multiple')) ? attribute.name : attribute.value); | ||
359 | 1178 | } | 1203 | } |
360 | 1179 | } | 1204 | } |
361 | 1180 | } | 1205 | } |
362 | @@ -1187,12 +1212,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
363 | 1187 | 1212 | ||
364 | 1188 | var fileElem = angular.element('<input type="file">'); | 1213 | var fileElem = angular.element('<input type="file">'); |
365 | 1189 | 1214 | ||
366 | 1190 | bindAttrToFileInput(fileElem); | ||
367 | 1191 | |||
368 | 1192 | var label = angular.element('<label>upload</label>'); | 1215 | var label = angular.element('<label>upload</label>'); |
369 | 1193 | label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden') | 1216 | label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden') |
370 | 1194 | .css('width', '0px').css('height', '0px').css('border', 'none') | 1217 | .css('width', '0px').css('height', '0px').css('border', 'none') |
371 | 1195 | .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1'); | 1218 | .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1'); |
372 | 1219 | bindAttrToFileInput(fileElem, label); | ||
373 | 1220 | |||
374 | 1196 | generatedElems.push({el: elem, ref: label}); | 1221 | generatedElems.push({el: elem, ref: label}); |
375 | 1197 | 1222 | ||
376 | 1198 | document.body.appendChild(label.append(fileElem)[0]); | 1223 | document.body.appendChild(label.append(fileElem)[0]); |
377 | @@ -1200,13 +1225,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
378 | 1200 | return fileElem; | 1225 | return fileElem; |
379 | 1201 | } | 1226 | } |
380 | 1202 | 1227 | ||
381 | 1203 | var initialTouchStartY = 0; | ||
382 | 1204 | |||
383 | 1205 | function clickHandler(evt) { | 1228 | function clickHandler(evt) { |
384 | 1206 | if (elem.attr('disabled')) return false; | 1229 | if (elem.attr('disabled')) return false; |
385 | 1207 | if (attrGetter('ngfSelectDisabled', scope)) return; | 1230 | if (attrGetter('ngfSelectDisabled', scope)) return; |
386 | 1208 | 1231 | ||
388 | 1209 | var r = handleTouch(evt); | 1232 | var r = detectSwipe(evt); |
389 | 1233 | // prevent the click if it is a swipe | ||
390 | 1210 | if (r != null) return r; | 1234 | if (r != null) return r; |
391 | 1211 | 1235 | ||
392 | 1212 | resetModel(evt); | 1236 | resetModel(evt); |
393 | @@ -1218,7 +1242,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
394 | 1218 | document.body.appendChild(fileElem.parent()[0]); | 1242 | document.body.appendChild(fileElem.parent()[0]); |
395 | 1219 | fileElem.bind('change', changeFn); | 1243 | fileElem.bind('change', changeFn); |
396 | 1220 | } | 1244 | } |
398 | 1221 | } catch(e){/*ignore*/} | 1245 | } catch (e) {/*ignore*/ |
399 | 1246 | } | ||
400 | 1222 | 1247 | ||
401 | 1223 | if (isDelayedClickSupported(navigator.userAgent)) { | 1248 | if (isDelayedClickSupported(navigator.userAgent)) { |
402 | 1224 | setTimeout(function () { | 1249 | setTimeout(function () { |
403 | @@ -1231,19 +1256,30 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
404 | 1231 | return false; | 1256 | return false; |
405 | 1232 | } | 1257 | } |
406 | 1233 | 1258 | ||
407 | 1234 | function handleTouch(evt) { | ||
408 | 1235 | var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches); | ||
409 | 1236 | if (evt.type === 'touchstart') { | ||
410 | 1237 | initialTouchStartY = touches ? touches[0].clientY : 0; | ||
411 | 1238 | return true; // don't block event default | ||
412 | 1239 | } else { | ||
413 | 1240 | evt.stopPropagation(); | ||
414 | 1241 | evt.preventDefault(); | ||
415 | 1242 | 1259 | ||
420 | 1243 | // prevent scroll from triggering event | 1260 | var initialTouchStartY = 0; |
421 | 1244 | if (evt.type === 'touchend') { | 1261 | var initialTouchStartX = 0; |
422 | 1245 | var currentLocation = touches ? touches[0].clientY : 0; | 1262 | |
423 | 1246 | if (Math.abs(currentLocation - initialTouchStartY) > 20) return false; | 1263 | function detectSwipe(evt) { |
424 | 1264 | var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches); | ||
425 | 1265 | if (touches) { | ||
426 | 1266 | if (evt.type === 'touchstart') { | ||
427 | 1267 | initialTouchStartX = touches[0].clientX; | ||
428 | 1268 | initialTouchStartY = touches[0].clientY; | ||
429 | 1269 | return true; // don't block event default | ||
430 | 1270 | } else { | ||
431 | 1271 | // prevent scroll from triggering event | ||
432 | 1272 | if (evt.type === 'touchend') { | ||
433 | 1273 | var currentX = touches[0].clientX; | ||
434 | 1274 | var currentY = touches[0].clientY; | ||
435 | 1275 | if ((Math.abs(currentX - initialTouchStartX) > 20) || | ||
436 | 1276 | (Math.abs(currentY - initialTouchStartY) > 20)) { | ||
437 | 1277 | evt.stopPropagation(); | ||
438 | 1278 | evt.preventDefault(); | ||
439 | 1279 | return false; | ||
440 | 1280 | } | ||
441 | 1281 | } | ||
442 | 1282 | return true; | ||
443 | 1247 | } | 1283 | } |
444 | 1248 | } | 1284 | } |
445 | 1249 | } | 1285 | } |
446 | @@ -1474,14 +1510,19 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
447 | 1474 | var size = resizeParams; | 1510 | var size = resizeParams; |
448 | 1475 | if (directiveName === 'ngfThumbnail') { | 1511 | if (directiveName === 'ngfThumbnail') { |
449 | 1476 | if (!size) { | 1512 | if (!size) { |
451 | 1477 | size = {width: elem[0].clientWidth, height: elem[0].clientHeight}; | 1513 | size = { |
452 | 1514 | width: elem[0].naturalWidth || elem[0].clientWidth, | ||
453 | 1515 | height: elem[0].naturalHeight || elem[0].clientHeight | ||
454 | 1516 | }; | ||
455 | 1478 | } | 1517 | } |
456 | 1479 | if (size.width === 0 && window.getComputedStyle) { | 1518 | if (size.width === 0 && window.getComputedStyle) { |
457 | 1480 | var style = getComputedStyle(elem[0]); | 1519 | var style = getComputedStyle(elem[0]); |
462 | 1481 | size = { | 1520 | if (style.width && style.width.indexOf('px') > -1 && style.height && style.height.indexOf('px') > -1) { |
463 | 1482 | width: parseInt(style.width.slice(0, -2)), | 1521 | size = { |
464 | 1483 | height: parseInt(style.height.slice(0, -2)) | 1522 | width: parseInt(style.width.slice(0, -2)), |
465 | 1484 | }; | 1523 | height: parseInt(style.height.slice(0, -2)) |
466 | 1524 | }; | ||
467 | 1525 | } | ||
468 | 1485 | } | 1526 | } |
469 | 1486 | } | 1527 | } |
470 | 1487 | 1528 | ||
471 | @@ -1496,7 +1537,11 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
472 | 1496 | if (file && file.type && file.type.search(getTagType(elem[0])) === 0 && | 1537 | if (file && file.type && file.type.search(getTagType(elem[0])) === 0 && |
473 | 1497 | (!isBackground || file.type.indexOf('image') === 0)) { | 1538 | (!isBackground || file.type.indexOf('image') === 0)) { |
474 | 1498 | if (size && Upload.isResizeSupported()) { | 1539 | if (size && Upload.isResizeSupported()) { |
476 | 1499 | Upload.resize(file, size.width, size.height, size.quality).then( | 1540 | size.resizeIf = function (width, height) { |
477 | 1541 | return Upload.attrGetter('ngfResizeIf', attr, scope, | ||
478 | 1542 | {$width: width, $height: height, $file: file}); | ||
479 | 1543 | }; | ||
480 | 1544 | Upload.resize(file, size).then( | ||
481 | 1500 | function (f) { | 1545 | function (f) { |
482 | 1501 | constructDataUrl(f); | 1546 | constructDataUrl(f); |
483 | 1502 | }, function (e) { | 1547 | }, function (e) { |
484 | @@ -1558,8 +1603,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
485 | 1558 | }]); | 1603 | }]); |
486 | 1559 | 1604 | ||
487 | 1560 | ngFileUpload.config(['$compileProvider', function ($compileProvider) { | 1605 | ngFileUpload.config(['$compileProvider', function ($compileProvider) { |
490 | 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):/); |
491 | 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):/); |
492 | 1563 | }]); | 1608 | }]); |
493 | 1564 | 1609 | ||
494 | 1565 | ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) { | 1610 | ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) { |
495 | @@ -1651,13 +1696,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
496 | 1651 | if (ngModel) { | 1696 | if (ngModel) { |
497 | 1652 | ngModel.$formatters.push(function (files) { | 1697 | ngModel.$formatters.push(function (files) { |
498 | 1653 | if (ngModel.$dirty) { | 1698 | if (ngModel.$dirty) { |
499 | 1699 | var filesArray = files; | ||
500 | 1654 | if (files && !angular.isArray(files)) { | 1700 | if (files && !angular.isArray(files)) { |
502 | 1655 | files = [files]; | 1701 | filesArray = [files]; |
503 | 1656 | } | 1702 | } |
506 | 1657 | upload.validate(files, 0, ngModel, attr, scope).then(function () { | 1703 | upload.validate(filesArray, 0, ngModel, attr, scope).then(function () { |
507 | 1658 | upload.applyModelValidation(ngModel, files); | 1704 | upload.applyModelValidation(ngModel, filesArray); |
508 | 1659 | }); | 1705 | }); |
509 | 1660 | } | 1706 | } |
510 | 1707 | return files; | ||
511 | 1661 | }); | 1708 | }); |
512 | 1662 | } | 1709 | } |
513 | 1663 | }; | 1710 | }; |
514 | @@ -1707,11 +1754,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
515 | 1707 | return upload.attrGetter(name, attr, scope, params); | 1754 | return upload.attrGetter(name, attr, scope, params); |
516 | 1708 | }; | 1755 | }; |
517 | 1709 | 1756 | ||
518 | 1757 | var ignoredErrors = (upload.attrGetter('ngfIgnoreInvalid', attr, scope) || '').split(' '); | ||
519 | 1758 | var runAllValidation = upload.attrGetter('ngfRunAllValidations', attr, scope); | ||
520 | 1759 | |||
521 | 1710 | if (files == null || files.length === 0) { | 1760 | if (files == null || files.length === 0) { |
523 | 1711 | return upload.emptyPromise(ngModel); | 1761 | return upload.emptyPromise({'validFiles': files, 'invalidFiles': []}); |
524 | 1712 | } | 1762 | } |
525 | 1713 | 1763 | ||
526 | 1714 | files = files.length === undefined ? [files] : files.slice(0); | 1764 | files = files.length === undefined ? [files] : files.slice(0); |
527 | 1765 | var invalidFiles = []; | ||
528 | 1715 | 1766 | ||
529 | 1716 | function validateSync(name, validationName, fn) { | 1767 | function validateSync(name, validationName, fn) { |
530 | 1717 | if (files) { | 1768 | if (files) { |
531 | @@ -1722,11 +1773,20 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
532 | 1722 | var val = upload.getValidationAttr(attr, scope, name, validationName, file); | 1773 | var val = upload.getValidationAttr(attr, scope, name, validationName, file); |
533 | 1723 | if (val != null) { | 1774 | if (val != null) { |
534 | 1724 | if (!fn(file, val, i)) { | 1775 | if (!fn(file, val, i)) { |
540 | 1725 | file.$error = name; | 1776 | if (ignoredErrors.indexOf(name) === -1) { |
541 | 1726 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; | 1777 | file.$error = name; |
542 | 1727 | file.$errorParam = val; | 1778 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; |
543 | 1728 | files.splice(i, 1); | 1779 | file.$errorParam = val; |
544 | 1729 | valid = false; | 1780 | if (invalidFiles.indexOf(file) === -1) { |
545 | 1781 | invalidFiles.push(file); | ||
546 | 1782 | } | ||
547 | 1783 | if (!runAllValidation) { | ||
548 | 1784 | files.splice(i, 1); | ||
549 | 1785 | } | ||
550 | 1786 | valid = false; | ||
551 | 1787 | } else { | ||
552 | 1788 | files.splice(i, 1); | ||
553 | 1789 | } | ||
554 | 1730 | } | 1790 | } |
555 | 1731 | } | 1791 | } |
556 | 1732 | } | 1792 | } |
557 | @@ -1737,9 +1797,6 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
558 | 1737 | } | 1797 | } |
559 | 1738 | } | 1798 | } |
560 | 1739 | 1799 | ||
561 | 1740 | validateSync('maxFiles', null, function (file, val, i) { | ||
562 | 1741 | return prevLength + i < val; | ||
563 | 1742 | }); | ||
564 | 1743 | validateSync('pattern', null, upload.validatePattern); | 1800 | validateSync('pattern', null, upload.validatePattern); |
565 | 1744 | validateSync('minSize', 'size.min', function (file, val) { | 1801 | validateSync('minSize', 'size.min', function (file, val) { |
566 | 1745 | return file.size + 0.1 >= upload.translateScalars(val); | 1802 | return file.size + 0.1 >= upload.translateScalars(val); |
567 | @@ -1762,44 +1819,58 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
568 | 1762 | }); | 1819 | }); |
569 | 1763 | 1820 | ||
570 | 1764 | if (!files.length) { | 1821 | if (!files.length) { |
572 | 1765 | return upload.emptyPromise(ngModel, ngModel.$ngfValidations); | 1822 | return upload.emptyPromise({'validFiles': [], 'invalidFiles': invalidFiles}); |
573 | 1766 | } | 1823 | } |
574 | 1767 | 1824 | ||
575 | 1768 | function validateAsync(name, validationName, type, asyncFn, fn) { | 1825 | function validateAsync(name, validationName, type, asyncFn, fn) { |
576 | 1769 | function resolveResult(defer, file, val) { | 1826 | function resolveResult(defer, file, val) { |
580 | 1770 | if (val != null) { | 1827 | function resolveInternal(fn) { |
581 | 1771 | asyncFn(file, val).then(function (d) { | 1828 | if (fn()) { |
582 | 1772 | if (!fn(d, val)) { | 1829 | if (ignoredErrors.indexOf(name) === -1) { |
583 | 1773 | file.$error = name; | 1830 | file.$error = name; |
584 | 1774 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; | 1831 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; |
585 | 1775 | file.$errorParam = val; | 1832 | file.$errorParam = val; |
587 | 1776 | defer.reject(); | 1833 | if (invalidFiles.indexOf(file) === -1) { |
588 | 1834 | invalidFiles.push(file); | ||
589 | 1835 | } | ||
590 | 1836 | if (!runAllValidation) { | ||
591 | 1837 | var i = files.indexOf(file); | ||
592 | 1838 | if (i > -1) files.splice(i, 1); | ||
593 | 1839 | } | ||
594 | 1840 | defer.resolve(false); | ||
595 | 1777 | } else { | 1841 | } else { |
597 | 1778 | defer.resolve(); | 1842 | var j = files.indexOf(file); |
598 | 1843 | if (j > -1) files.splice(j, 1); | ||
599 | 1844 | defer.resolve(true); | ||
600 | 1779 | } | 1845 | } |
601 | 1846 | } else { | ||
602 | 1847 | defer.resolve(true); | ||
603 | 1848 | } | ||
604 | 1849 | } | ||
605 | 1850 | |||
606 | 1851 | if (val != null) { | ||
607 | 1852 | asyncFn(file, val).then(function (d) { | ||
608 | 1853 | resolveInternal(function () { | ||
609 | 1854 | return !fn(d, val); | ||
610 | 1855 | }); | ||
611 | 1780 | }, function () { | 1856 | }, function () { |
620 | 1781 | if (attrGetter('ngfValidateForce', {$file: file})) { | 1857 | resolveInternal(function () { |
621 | 1782 | file.$error = name; | 1858 | return attrGetter('ngfValidateForce', {$file: file}); |
622 | 1783 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; | 1859 | }); |
615 | 1784 | file.$errorParam = val; | ||
616 | 1785 | defer.reject(); | ||
617 | 1786 | } else { | ||
618 | 1787 | defer.resolve(); | ||
619 | 1788 | } | ||
623 | 1789 | }); | 1860 | }); |
624 | 1790 | } else { | 1861 | } else { |
626 | 1791 | defer.resolve(); | 1862 | defer.resolve(true); |
627 | 1792 | } | 1863 | } |
628 | 1793 | } | 1864 | } |
629 | 1794 | 1865 | ||
631 | 1795 | var promises = [upload.emptyPromise()]; | 1866 | var promises = [upload.emptyPromise(true)]; |
632 | 1796 | if (files) { | 1867 | if (files) { |
633 | 1797 | files = files.length === undefined ? [files] : files; | 1868 | files = files.length === undefined ? [files] : files; |
634 | 1798 | angular.forEach(files, function (file) { | 1869 | angular.forEach(files, function (file) { |
635 | 1799 | var defer = $q.defer(); | 1870 | var defer = $q.defer(); |
636 | 1800 | promises.push(defer.promise); | 1871 | promises.push(defer.promise); |
637 | 1801 | if (type && (file.type == null || file.type.search(type) !== 0)) { | 1872 | if (type && (file.type == null || file.type.search(type) !== 0)) { |
639 | 1802 | defer.resolve(); | 1873 | defer.resolve(true); |
640 | 1803 | return; | 1874 | return; |
641 | 1804 | } | 1875 | } |
642 | 1805 | if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) { | 1876 | if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) { |
643 | @@ -1807,96 +1878,120 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
644 | 1807 | resolveResult(defer, file, | 1878 | resolveResult(defer, file, |
645 | 1808 | attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height})); | 1879 | attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height})); |
646 | 1809 | }, function () { | 1880 | }, function () { |
648 | 1810 | defer.reject(); | 1881 | defer.resolve(false); |
649 | 1811 | }); | 1882 | }); |
650 | 1812 | } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) { | 1883 | } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) { |
651 | 1813 | upload.mediaDuration(file).then(function (d) { | 1884 | upload.mediaDuration(file).then(function (d) { |
652 | 1814 | resolveResult(defer, file, | 1885 | resolveResult(defer, file, |
653 | 1815 | attrGetter('ngfDuration', {$file: file, $duration: d})); | 1886 | attrGetter('ngfDuration', {$file: file, $duration: d})); |
654 | 1816 | }, function () { | 1887 | }, function () { |
656 | 1817 | defer.reject(); | 1888 | defer.resolve(false); |
657 | 1818 | }); | 1889 | }); |
658 | 1819 | } else { | 1890 | } else { |
659 | 1820 | resolveResult(defer, file, | 1891 | resolveResult(defer, file, |
660 | 1821 | upload.getValidationAttr(attr, scope, name, validationName, file)); | 1892 | upload.getValidationAttr(attr, scope, name, validationName, file)); |
661 | 1822 | } | 1893 | } |
662 | 1823 | }); | 1894 | }); |
663 | 1824 | return $q.all(promises).then(function () { | ||
664 | 1825 | ngModel.$ngfValidations.push({name: name, valid: true}); | ||
665 | 1826 | }, function () { | ||
666 | 1827 | ngModel.$ngfValidations.push({name: name, valid: false}); | ||
667 | 1828 | }); | ||
668 | 1829 | } | 1895 | } |
669 | 1896 | var deffer = $q.defer(); | ||
670 | 1897 | $q.all(promises).then(function (values) { | ||
671 | 1898 | var isValid = true; | ||
672 | 1899 | for (var i = 0; i < values.length; i++) { | ||
673 | 1900 | if (!values[i]) { | ||
674 | 1901 | isValid = false; | ||
675 | 1902 | break; | ||
676 | 1903 | } | ||
677 | 1904 | } | ||
678 | 1905 | ngModel.$ngfValidations.push({name: name, valid: isValid}); | ||
679 | 1906 | deffer.resolve(isValid); | ||
680 | 1907 | }); | ||
681 | 1908 | return deffer.promise; | ||
682 | 1830 | } | 1909 | } |
683 | 1831 | 1910 | ||
684 | 1832 | var deffer = $q.defer(); | 1911 | var deffer = $q.defer(); |
685 | 1833 | var promises = []; | 1912 | var promises = []; |
686 | 1834 | 1913 | ||
688 | 1835 | promises.push(upload.happyPromise(validateAsync('maxHeight', 'height.max', /image/, | 1914 | promises.push(validateAsync('maxHeight', 'height.max', /image/, |
689 | 1836 | this.imageDimensions, function (d, val) { | 1915 | this.imageDimensions, function (d, val) { |
690 | 1837 | return d.height <= val; | 1916 | return d.height <= val; |
693 | 1838 | }))); | 1917 | })); |
694 | 1839 | promises.push(upload.happyPromise(validateAsync('minHeight', 'height.min', /image/, | 1918 | promises.push(validateAsync('minHeight', 'height.min', /image/, |
695 | 1840 | this.imageDimensions, function (d, val) { | 1919 | this.imageDimensions, function (d, val) { |
696 | 1841 | return d.height >= val; | 1920 | return d.height >= val; |
699 | 1842 | }))); | 1921 | })); |
700 | 1843 | promises.push(upload.happyPromise(validateAsync('maxWidth', 'width.max', /image/, | 1922 | promises.push(validateAsync('maxWidth', 'width.max', /image/, |
701 | 1844 | this.imageDimensions, function (d, val) { | 1923 | this.imageDimensions, function (d, val) { |
702 | 1845 | return d.width <= val; | 1924 | return d.width <= val; |
705 | 1846 | }))); | 1925 | })); |
706 | 1847 | promises.push(upload.happyPromise(validateAsync('minWidth', 'width.min', /image/, | 1926 | promises.push(validateAsync('minWidth', 'width.min', /image/, |
707 | 1848 | this.imageDimensions, function (d, val) { | 1927 | this.imageDimensions, function (d, val) { |
708 | 1849 | return d.width >= val; | 1928 | return d.width >= val; |
711 | 1850 | }))); | 1929 | })); |
712 | 1851 | promises.push(upload.happyPromise(validateAsync('dimensions', null, /image/, | 1930 | promises.push(validateAsync('dimensions', null, /image/, |
713 | 1852 | function (file, val) { | 1931 | function (file, val) { |
714 | 1853 | return upload.emptyPromise(val); | 1932 | return upload.emptyPromise(val); |
715 | 1854 | }, function (r) { | 1933 | }, function (r) { |
716 | 1855 | return r; | 1934 | return r; |
719 | 1856 | }))); | 1935 | })); |
720 | 1857 | promises.push(upload.happyPromise(validateAsync('ratio', null, /image/, | 1936 | promises.push(validateAsync('ratio', null, /image/, |
721 | 1858 | this.imageDimensions, function (d, val) { | 1937 | this.imageDimensions, function (d, val) { |
722 | 1859 | var split = val.toString().split(','), valid = false; | 1938 | var split = val.toString().split(','), valid = false; |
723 | 1860 | for (var i = 0; i < split.length; i++) { | 1939 | for (var i = 0; i < split.length; i++) { |
725 | 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) { |
726 | 1862 | valid = true; | 1941 | valid = true; |
727 | 1863 | } | 1942 | } |
728 | 1864 | } | 1943 | } |
729 | 1865 | return valid; | 1944 | return valid; |
732 | 1866 | }))); | 1945 | })); |
733 | 1867 | promises.push(upload.happyPromise(validateAsync('maxRatio', 'ratio.max', /image/, | 1946 | promises.push(validateAsync('maxRatio', 'ratio.max', /image/, |
734 | 1868 | this.imageDimensions, function (d, val) { | 1947 | this.imageDimensions, function (d, val) { |
735 | 1869 | return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001; | 1948 | return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001; |
738 | 1870 | }))); | 1949 | })); |
739 | 1871 | promises.push(upload.happyPromise(validateAsync('minRatio', 'ratio.min', /image/, | 1950 | promises.push(validateAsync('minRatio', 'ratio.min', /image/, |
740 | 1872 | this.imageDimensions, function (d, val) { | 1951 | this.imageDimensions, function (d, val) { |
741 | 1873 | return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001; | 1952 | return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001; |
744 | 1874 | }))); | 1953 | })); |
745 | 1875 | promises.push(upload.happyPromise(validateAsync('maxDuration', 'duration.max', /audio|video/, | 1954 | promises.push(validateAsync('maxDuration', 'duration.max', /audio|video/, |
746 | 1876 | this.mediaDuration, function (d, val) { | 1955 | this.mediaDuration, function (d, val) { |
747 | 1877 | return d <= upload.translateScalars(val); | 1956 | return d <= upload.translateScalars(val); |
750 | 1878 | }))); | 1957 | })); |
751 | 1879 | promises.push(upload.happyPromise(validateAsync('minDuration', 'duration.min', /audio|video/, | 1958 | promises.push(validateAsync('minDuration', 'duration.min', /audio|video/, |
752 | 1880 | this.mediaDuration, function (d, val) { | 1959 | this.mediaDuration, function (d, val) { |
753 | 1881 | return d >= upload.translateScalars(val); | 1960 | return d >= upload.translateScalars(val); |
756 | 1882 | }))); | 1961 | })); |
757 | 1883 | promises.push(upload.happyPromise(validateAsync('duration', null, /audio|video/, | 1962 | promises.push(validateAsync('duration', null, /audio|video/, |
758 | 1884 | function (file, val) { | 1963 | function (file, val) { |
759 | 1885 | return upload.emptyPromise(val); | 1964 | return upload.emptyPromise(val); |
760 | 1886 | }, function (r) { | 1965 | }, function (r) { |
761 | 1887 | return r; | 1966 | return r; |
763 | 1888 | }))); | 1967 | })); |
764 | 1889 | 1968 | ||
766 | 1890 | promises.push(upload.happyPromise(validateAsync('validateAsyncFn', null, null, | 1969 | promises.push(validateAsync('validateAsyncFn', null, null, |
767 | 1891 | function (file, val) { | 1970 | function (file, val) { |
768 | 1892 | return val; | 1971 | return val; |
769 | 1893 | }, function (r) { | 1972 | }, function (r) { |
770 | 1894 | return r === true || r === null || r === ''; | 1973 | return r === true || r === null || r === ''; |
772 | 1895 | }))); | 1974 | })); |
773 | 1896 | 1975 | ||
776 | 1897 | return $q.all(promises).then(function () { | 1976 | $q.all(promises).then(function () { |
777 | 1898 | deffer.resolve(ngModel, ngModel.$ngfValidations); | 1977 | |
778 | 1978 | if (runAllValidation) { | ||
779 | 1979 | for (var i = 0; i < files.length; i++) { | ||
780 | 1980 | var file = files[i]; | ||
781 | 1981 | if (file.$error) { | ||
782 | 1982 | files.splice(i--, 1); | ||
783 | 1983 | } | ||
784 | 1984 | } | ||
785 | 1985 | } | ||
786 | 1986 | |||
787 | 1987 | runAllValidation = false; | ||
788 | 1988 | validateSync('maxFiles', null, function (file, val, i) { | ||
789 | 1989 | return prevLength + i < val; | ||
790 | 1990 | }); | ||
791 | 1991 | |||
792 | 1992 | deffer.resolve({'validFiles': files, 'invalidFiles': invalidFiles}); | ||
793 | 1899 | }); | 1993 | }); |
794 | 1994 | return deffer.promise; | ||
795 | 1900 | }; | 1995 | }; |
796 | 1901 | 1996 | ||
797 | 1902 | upload.imageDimensions = function (file) { | 1997 | upload.imageDimensions = function (file) { |
798 | @@ -1921,8 +2016,8 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
799 | 1921 | .css('max-width', 'none !important').css('max-height', 'none !important'); | 2016 | .css('max-width', 'none !important').css('max-height', 'none !important'); |
800 | 1922 | 2017 | ||
801 | 1923 | function success() { | 2018 | function success() { |
804 | 1924 | var width = img[0].clientWidth; | 2019 | var width = img[0].naturalWidth || img[0].clientWidth; |
805 | 1925 | var height = img[0].clientHeight; | 2020 | var height = img[0].naturalHeight || img[0].clientHeight; |
806 | 1926 | img.remove(); | 2021 | img.remove(); |
807 | 1927 | file.$ngfWidth = width; | 2022 | file.$ngfWidth = width; |
808 | 1928 | file.$ngfHeight = height; | 2023 | file.$ngfHeight = height; |
809 | @@ -1936,23 +2031,23 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
810 | 1936 | 2031 | ||
811 | 1937 | img.on('load', success); | 2032 | img.on('load', success); |
812 | 1938 | img.on('error', error); | 2033 | img.on('error', error); |
813 | 1939 | var count = 0; | ||
814 | 1940 | 2034 | ||
816 | 1941 | function checkLoadError() { | 2035 | var secondsCounter = 0; |
817 | 2036 | function checkLoadErrorInCaseOfNoCallback() { | ||
818 | 1942 | $timeout(function () { | 2037 | $timeout(function () { |
819 | 1943 | if (img[0].parentNode) { | 2038 | if (img[0].parentNode) { |
820 | 1944 | if (img[0].clientWidth) { | 2039 | if (img[0].clientWidth) { |
821 | 1945 | success(); | 2040 | success(); |
823 | 1946 | } else if (count > 10) { | 2041 | } else if (secondsCounter++ > 10) { |
824 | 1947 | error(); | 2042 | error(); |
825 | 1948 | } else { | 2043 | } else { |
827 | 1949 | checkLoadError(); | 2044 | checkLoadErrorInCaseOfNoCallback(); |
828 | 1950 | } | 2045 | } |
829 | 1951 | } | 2046 | } |
830 | 1952 | }, 1000); | 2047 | }, 1000); |
831 | 1953 | } | 2048 | } |
832 | 1954 | 2049 | ||
834 | 1955 | checkLoadError(); | 2050 | checkLoadErrorInCaseOfNoCallback(); |
835 | 1956 | 2051 | ||
836 | 1957 | angular.element(document.getElementsByTagName('body')[0]).append(img); | 2052 | angular.element(document.getElementsByTagName('body')[0]).append(img); |
837 | 1958 | }, function () { | 2053 | }, function () { |
838 | @@ -2063,31 +2158,35 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
839 | 2063 | var deferred = $q.defer(); | 2158 | var deferred = $q.defer(); |
840 | 2064 | var canvasElement = document.createElement('canvas'); | 2159 | var canvasElement = document.createElement('canvas'); |
841 | 2065 | var imageElement = document.createElement('img'); | 2160 | var imageElement = document.createElement('img'); |
842 | 2161 | imageElement.setAttribute('style', 'visibility:hidden;position:fixed;z-index:-100000'); | ||
843 | 2162 | document.body.appendChild(imageElement); | ||
844 | 2066 | 2163 | ||
845 | 2067 | imageElement.onload = function () { | 2164 | imageElement.onload = function () { |
847 | 2068 | if (resizeIf != null && resizeIf(imageElement.width, imageElement.height) === false) { | 2165 | var imgWidth = imageElement.width, imgHeight = imageElement.height; |
848 | 2166 | imageElement.parentNode.removeChild(imageElement); | ||
849 | 2167 | if (resizeIf != null && resizeIf(imgWidth, imgHeight) === false) { | ||
850 | 2069 | deferred.reject('resizeIf'); | 2168 | deferred.reject('resizeIf'); |
851 | 2070 | return; | 2169 | return; |
852 | 2071 | } | 2170 | } |
853 | 2072 | try { | 2171 | try { |
854 | 2073 | if (ratio) { | 2172 | if (ratio) { |
855 | 2074 | var ratioFloat = upload.ratioToFloat(ratio); | 2173 | var ratioFloat = upload.ratioToFloat(ratio); |
857 | 2075 | var imgRatio = imageElement.width / imageElement.height; | 2174 | var imgRatio = imgWidth / imgHeight; |
858 | 2076 | if (imgRatio < ratioFloat) { | 2175 | if (imgRatio < ratioFloat) { |
860 | 2077 | width = imageElement.width; | 2176 | width = imgWidth; |
861 | 2078 | height = width / ratioFloat; | 2177 | height = width / ratioFloat; |
862 | 2079 | } else { | 2178 | } else { |
864 | 2080 | height = imageElement.height; | 2179 | height = imgHeight; |
865 | 2081 | width = height * ratioFloat; | 2180 | width = height * ratioFloat; |
866 | 2082 | } | 2181 | } |
867 | 2083 | } | 2182 | } |
868 | 2084 | if (!width) { | 2183 | if (!width) { |
870 | 2085 | width = imageElement.width; | 2184 | width = imgWidth; |
871 | 2086 | } | 2185 | } |
872 | 2087 | if (!height) { | 2186 | if (!height) { |
874 | 2088 | height = imageElement.height; | 2187 | height = imgHeight; |
875 | 2089 | } | 2188 | } |
877 | 2090 | var dimensions = calculateAspectRatioFit(imageElement.width, imageElement.height, width, height, centerCrop); | 2189 | var dimensions = calculateAspectRatioFit(imgWidth, imgHeight, width, height, centerCrop); |
878 | 2091 | canvasElement.width = Math.min(dimensions.width, width); | 2190 | canvasElement.width = Math.min(dimensions.width, width); |
879 | 2092 | canvasElement.height = Math.min(dimensions.height, height); | 2191 | canvasElement.height = Math.min(dimensions.height, height); |
880 | 2093 | var context = canvasElement.getContext('2d'); | 2192 | var context = canvasElement.getContext('2d'); |
881 | @@ -2100,6 +2199,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
882 | 2100 | } | 2199 | } |
883 | 2101 | }; | 2200 | }; |
884 | 2102 | imageElement.onerror = function () { | 2201 | imageElement.onerror = function () { |
885 | 2202 | imageElement.parentNode.removeChild(imageElement); | ||
886 | 2103 | deferred.reject(); | 2203 | deferred.reject(); |
887 | 2104 | }; | 2204 | }; |
888 | 2105 | imageElement.src = imagen; | 2205 | imageElement.src = imagen; |
889 | @@ -2136,14 +2236,15 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
890 | 2136 | }); | 2236 | }); |
891 | 2137 | } | 2237 | } |
892 | 2138 | 2238 | ||
894 | 2139 | upload.resize = function (file, width, height, quality, type, ratio, centerCrop, resizeIf, restoreExif) { | 2239 | upload.resize = function (file, options) { |
895 | 2140 | if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file); | 2240 | if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file); |
896 | 2141 | 2241 | ||
897 | 2142 | var deferred = $q.defer(); | 2242 | var deferred = $q.defer(); |
898 | 2143 | upload.dataUrl(file, true).then(function (url) { | 2243 | upload.dataUrl(file, true).then(function (url) { |
900 | 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, |
901 | 2245 | options.ratio, options.centerCrop, options.resizeIf) | ||
902 | 2145 | .then(function (dataUrl) { | 2246 | .then(function (dataUrl) { |
904 | 2146 | if (file.type === 'image/jpeg' && restoreExif) { | 2247 | if (file.type === 'image/jpeg' && options.restoreExif !== false) { |
905 | 2147 | try { | 2248 | try { |
906 | 2148 | dataUrl = upload.restoreExif(url, dataUrl); | 2249 | dataUrl = upload.restoreExif(url, dataUrl); |
907 | 2149 | } catch (e) { | 2250 | } catch (e) { |
908 | @@ -2172,13 +2273,13 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
909 | 2172 | }]); | 2273 | }]); |
910 | 2173 | 2274 | ||
911 | 2174 | (function () { | 2275 | (function () { |
914 | 2175 | ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$location', 'Upload', '$http', '$q', | 2276 | ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$window', 'Upload', '$http', '$q', |
915 | 2176 | function ($parse, $timeout, $location, Upload, $http, $q) { | 2277 | function ($parse, $timeout, $window, Upload, $http, $q) { |
916 | 2177 | return { | 2278 | return { |
917 | 2178 | restrict: 'AEC', | 2279 | restrict: 'AEC', |
918 | 2179 | require: '?ngModel', | 2280 | require: '?ngModel', |
919 | 2180 | link: function (scope, elem, attr, ngModel) { | 2281 | link: function (scope, elem, attr, ngModel) { |
921 | 2181 | linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, Upload, $http, $q); | 2282 | linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, Upload, $http, $q); |
922 | 2182 | } | 2283 | } |
923 | 2183 | }; | 2284 | }; |
924 | 2184 | }]); | 2285 | }]); |
925 | @@ -2203,7 +2304,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
926 | 2203 | }; | 2304 | }; |
927 | 2204 | }]); | 2305 | }]); |
928 | 2205 | 2306 | ||
930 | 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) { |
931 | 2207 | var available = dropAvailable(); | 2308 | var available = dropAvailable(); |
932 | 2208 | 2309 | ||
933 | 2209 | var attrGetter = function (name, scope, params) { | 2310 | var attrGetter = function (name, scope, params) { |
934 | @@ -2279,23 +2380,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
935 | 2279 | if (stopPropagation(scope)) evt.stopPropagation(); | 2380 | if (stopPropagation(scope)) evt.stopPropagation(); |
936 | 2280 | if (actualDragOverClass) elem.removeClass(actualDragOverClass); | 2381 | if (actualDragOverClass) elem.removeClass(actualDragOverClass); |
937 | 2281 | actualDragOverClass = null; | 2382 | actualDragOverClass = null; |
955 | 2282 | var items = evt.dataTransfer.items; | 2383 | extractFilesAndUpdateModel(evt.dataTransfer, evt, 'dropUrl'); |
939 | 2283 | var html; | ||
940 | 2284 | try { | ||
941 | 2285 | html = evt.dataTransfer && evt.dataTransfer.getData && evt.dataTransfer.getData('text/html'); | ||
942 | 2286 | } catch (e) {/* Fix IE11 that throw error calling getData */ | ||
943 | 2287 | } | ||
944 | 2288 | |||
945 | 2289 | extractFiles(items, evt.dataTransfer.files, attrGetter('ngfAllowDir', scope) !== false, | ||
946 | 2290 | attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) { | ||
947 | 2291 | if (files.length) { | ||
948 | 2292 | updateModel(files, evt); | ||
949 | 2293 | } else { | ||
950 | 2294 | extractFilesFromHtml('dropUrl', html).then(function (files) { | ||
951 | 2295 | updateModel(files, evt); | ||
952 | 2296 | }); | ||
953 | 2297 | } | ||
954 | 2298 | }); | ||
956 | 2299 | }, false); | 2384 | }, false); |
957 | 2300 | elem[0].addEventListener('paste', function (evt) { | 2385 | elem[0].addEventListener('paste', function (evt) { |
958 | 2301 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && | 2386 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && |
959 | @@ -2303,22 +2388,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
960 | 2303 | evt.preventDefault(); | 2388 | evt.preventDefault(); |
961 | 2304 | } | 2389 | } |
962 | 2305 | if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return; | 2390 | if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return; |
979 | 2306 | var files = []; | 2391 | extractFilesAndUpdateModel(evt.clipboardData || evt.originalEvent.clipboardData, evt, 'pasteUrl'); |
964 | 2307 | var clipboard = evt.clipboardData || evt.originalEvent.clipboardData; | ||
965 | 2308 | if (clipboard && clipboard.items) { | ||
966 | 2309 | for (var k = 0; k < clipboard.items.length; k++) { | ||
967 | 2310 | if (clipboard.items[k].type.indexOf('image') !== -1) { | ||
968 | 2311 | files.push(clipboard.items[k].getAsFile()); | ||
969 | 2312 | } | ||
970 | 2313 | } | ||
971 | 2314 | } | ||
972 | 2315 | if (files.length) { | ||
973 | 2316 | updateModel(files, evt); | ||
974 | 2317 | } else { | ||
975 | 2318 | extractFilesFromHtml('pasteUrl', clipboard).then(function (files) { | ||
976 | 2319 | updateModel(files, evt); | ||
977 | 2320 | }); | ||
978 | 2321 | } | ||
980 | 2322 | }, false); | 2392 | }, false); |
981 | 2323 | 2393 | ||
982 | 2324 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && | 2394 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && |
983 | @@ -2331,12 +2401,33 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
984 | 2331 | }); | 2401 | }); |
985 | 2332 | } | 2402 | } |
986 | 2333 | 2403 | ||
987 | 2404 | function extractFilesAndUpdateModel(source, evt, updateOnType) { | ||
988 | 2405 | if (!source) return; | ||
989 | 2406 | // html needs to be calculated on the same process otherwise the data will be wiped | ||
990 | 2407 | // after promise resolve or setTimeout. | ||
991 | 2408 | var html; | ||
992 | 2409 | try { | ||
993 | 2410 | html = source && source.getData && source.getData('text/html'); | ||
994 | 2411 | } catch (e) {/* Fix IE11 that throw error calling getData */ | ||
995 | 2412 | } | ||
996 | 2413 | extractFiles(source.items, source.files, attrGetter('ngfAllowDir', scope) !== false, | ||
997 | 2414 | attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) { | ||
998 | 2415 | if (files.length) { | ||
999 | 2416 | updateModel(files, evt); | ||
1000 | 2417 | } else { | ||
1001 | 2418 | extractFilesFromHtml(updateOnType, html).then(function (files) { | ||
1002 | 2419 | updateModel(files, evt); | ||
1003 | 2420 | }); | ||
1004 | 2421 | } | ||
1005 | 2422 | }); | ||
1006 | 2423 | } | ||
1007 | 2424 | |||
1008 | 2334 | function updateModel(files, evt) { | 2425 | function updateModel(files, evt) { |
1009 | 2335 | upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt); | 2426 | upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt); |
1010 | 2336 | } | 2427 | } |
1011 | 2337 | 2428 | ||
1012 | 2338 | function extractFilesFromHtml(updateOn, html) { | 2429 | function extractFilesFromHtml(updateOn, html) { |
1014 | 2339 | if (!upload.shouldUpdateOn(updateOn, attr, scope) || !html) return upload.rejectPromise([]); | 2430 | if (!upload.shouldUpdateOn(updateOn, attr, scope) || typeof html !== 'string') return upload.rejectPromise([]); |
1015 | 2340 | var urls = []; | 2431 | var urls = []; |
1016 | 2341 | html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) { | 2432 | html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) { |
1017 | 2342 | urls.push(src); | 2433 | urls.push(src); |
1018 | @@ -2387,8 +2478,14 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1019 | 2387 | } | 2478 | } |
1020 | 2388 | 2479 | ||
1021 | 2389 | function extractFiles(items, fileList, allowDir, multiple) { | 2480 | function extractFiles(items, fileList, allowDir, multiple) { |
1024 | 2390 | var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles') || Number.MAX_VALUE; | 2481 | var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles'); |
1025 | 2391 | var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize') || Number.MAX_VALUE; | 2482 | if (maxFiles == null) { |
1026 | 2483 | maxFiles = Number.MAX_VALUE; | ||
1027 | 2484 | } | ||
1028 | 2485 | var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize'); | ||
1029 | 2486 | if (maxTotalSize == null) { | ||
1030 | 2487 | maxTotalSize = Number.MAX_VALUE; | ||
1031 | 2488 | } | ||
1032 | 2392 | var includeDir = attrGetter('ngfIncludeDir', scope); | 2489 | var includeDir = attrGetter('ngfIncludeDir', scope); |
1033 | 2393 | var files = [], totalSize = 0; | 2490 | var files = [], totalSize = 0; |
1034 | 2394 | 2491 | ||
1035 | @@ -2399,7 +2496,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1036 | 2399 | var promises = [upload.emptyPromise()]; | 2496 | var promises = [upload.emptyPromise()]; |
1037 | 2400 | if (includeDir) { | 2497 | if (includeDir) { |
1038 | 2401 | var file = {type: 'directory'}; | 2498 | var file = {type: 'directory'}; |
1040 | 2402 | file.name = file.path = (path || '') + entry.name + entry.name; | 2499 | file.name = file.path = (path || '') + entry.name; |
1041 | 2403 | files.push(file); | 2500 | files.push(file); |
1042 | 2404 | } | 2501 | } |
1043 | 2405 | var dirReader = entry.createReader(); | 2502 | var dirReader = entry.createReader(); |
1044 | @@ -2453,7 +2550,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1045 | 2453 | 2550 | ||
1046 | 2454 | var promises = [upload.emptyPromise()]; | 2551 | var promises = [upload.emptyPromise()]; |
1047 | 2455 | 2552 | ||
1049 | 2456 | if (items && items.length > 0 && $location.protocol() !== 'file') { | 2553 | if (items && items.length > 0 && $window.location.protocol !== 'file:') { |
1050 | 2457 | for (var i = 0; i < items.length; i++) { | 2554 | for (var i = 0; i < items.length; i++) { |
1051 | 2458 | if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) { | 2555 | if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) { |
1052 | 2459 | var entry = items[i].webkitGetAsEntry(); | 2556 | var entry = items[i].webkitGetAsEntry(); |
1053 | 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 | |||
1054 | index f8c5ce8..4362546 100644 | |||
1055 | --- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.min.js | |||
1056 | +++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-all.min.js | |||
1057 | @@ -1,4 +1,3 @@ | |||
1058 | 1 | /*! 12.0.4 */ | ||
1059 | 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); | ||
1060 | 3 | |||
1061 | 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}]); | ||
1062 | 5 | \ No newline at end of file | 1 | \ No newline at end of file |
1063 | 2 | /*! 12.2.13 */ | ||
1064 | 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(){ | ||
1065 | 4 | h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].clientWidth?d():i++>10?f():g())},1e3)}var h=angular.element("<img>").attr("src",b).css("visibility","hidden").css("position","fixed").css("max-width","none !important").css("max-height","none !important");h.on("load",d),h.on("error",f);var i=0;g(),angular.element(document.getElementsByTagName("body")[0]).append(h)},function(){e.reject("load error")})}),a.$ngfDimensionPromise=e.promise,a.$ngfDimensionPromise["finally"](function(){delete a.$ngfDimensionPromise}),a.$ngfDimensionPromise},f.mediaDuration=function(a){if(a.$ngfDuration){var d=b.defer();return c(function(){d.resolve(a.$ngfDuration)}),d.promise}if(a.$ngfDurationPromise)return a.$ngfDurationPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?void e.reject("not media"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].duration;a.$ngfDuration=b,h.remove(),e.resolve(b)}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].duration?d():i>10?f():g())},1e3)}var h=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",b).css("visibility","none").css("position","fixed");h.on("loadedmetadata",d),h.on("error",f);var i=0;g(),angular.element(document.body).append(h)},function(){e.reject("load error")})}),a.$ngfDurationPromise=e.promise,a.$ngfDurationPromise["finally"](function(){delete a.$ngfDurationPromise}),a.$ngfDurationPromise},f}]),ngFileUpload.service("UploadResize",["UploadValidate","$q",function(a,b){var c=a,d=function(a,b,c,d,e){var f=e?Math.max(c/a,d/b):Math.min(c/a,d/b);return{width:a*f,height:b*f,marginX:a*f-c,marginY:b*f-d}},e=function(a,e,f,g,h,i,j,k){var l=b.defer(),m=document.createElement("canvas"),n=document.createElement("img");return n.setAttribute("style","visibility:hidden;position:fixed;z-index:-100000"),document.body.appendChild(n),n.onload=function(){var a=n.width,b=n.height;if(n.parentNode.removeChild(n),null!=k&&k(a,b)===!1)return void l.reject("resizeIf");try{if(i){var o=c.ratioToFloat(i),p=a/b;o>p?(e=a,f=e/o):(f=b,e=f*o)}e||(e=a),f||(f=b);var q=d(a,b,e,f,j);m.width=Math.min(q.width,e),m.height=Math.min(q.height,f);var r=m.getContext("2d");r.drawImage(n,Math.min(0,-q.marginX/2),Math.min(0,-q.marginY/2),q.width,q.height),l.resolve(m.toDataURL(h||"image/WebP",g||.934))}catch(s){l.reject(s)}},n.onerror=function(){n.parentNode.removeChild(n),l.reject()},n.src=a,l.promise};return c.dataUrltoBlob=function(a,b,c){for(var d=a.split(","),e=d[0].match(/:(.*?);/)[1],f=atob(d[1]),g=f.length,h=new Uint8Array(g);g--;)h[g]=f.charCodeAt(g);var i=new window.Blob([h],{type:e});return i.name=b,i.$ngfOrigSize=c,i},c.isResizeSupported=function(){var a=document.createElement("canvas");return window.atob&&a.getContext&&a.getContext("2d")&&window.Blob},c.isResizeSupported()&&Object.defineProperty(window.Blob.prototype,"name",{get:function(){return this.$ngfName},set:function(a){this.$ngfName=a},configurable:!0}),c.resize=function(a,d){if(0!==a.type.indexOf("image"))return c.emptyPromise(a);var f=b.defer();return c.dataUrl(a,!0).then(function(b){e(b,d.width,d.height,d.quality,d.type||a.type,d.ratio,d.centerCrop,d.resizeIf).then(function(e){if("image/jpeg"===a.type&&d.restoreExif!==!1)try{e=c.restoreExif(b,e)}catch(g){setTimeout(function(){throw g},1)}try{var h=c.dataUrltoBlob(e,a.name,a.size);f.resolve(h)}catch(g){f.reject(g)}},function(b){"resizeIf"===b&&f.resolve(a),f.reject(b)})},function(a){f.reject(a)}),f.promise},c}]),function(){function a(a,c,d,e,f,g,h,i,j,k){function l(){return c.attr("disabled")||s("ngfDropDisabled",a)}function m(b,c,d){if(b){var e;try{e=b&&b.getData&&b.getData("text/html")}catch(f){}q(b.items,b.files,s("ngfAllowDir",a)!==!1,s("multiple")||s("ngfMultiple",a)).then(function(a){a.length?n(a,c):o(d,e).then(function(a){n(a,c)})})}}function n(b,c){i.updateModel(e,d,a,s("ngfChange")||s("ngfDrop"),b,c)}function o(b,c){if(!i.shouldUpdateOn(b,d,a)||"string"!=typeof c)return i.rejectPromise([]);var e=[];c.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi,function(a,b,c){e.push(c)});var f=[],g=[];if(e.length){angular.forEach(e,function(a){f.push(i.urlToBlob(a).then(function(a){g.push(a)}))});var h=k.defer();return k.all(f).then(function(){h.resolve(g)},function(a){h.reject(a)}),h.promise}return i.emptyPromise()}function p(a,b,c,d){var e=s("ngfDragOverClass",a,{$event:c}),f="dragover";if(angular.isString(e))f=e;else if(e&&(e.delay&&(w=e.delay),e.accept||e.reject)){var g=c.dataTransfer.items;if(null!=g&&g.length)for(var h=e.pattern||s("ngfPattern",a,{$event:c}),j=g.length;j--;){if(!i.validatePattern(g[j],h)){f=e.reject;break}f=e.accept}else f=e.accept}d(f)}function q(b,c,e,f){function g(a,b){var c=k.defer();if(null!=a)if(a.isDirectory){var d=[i.emptyPromise()];if(m){var e={type:"directory"};e.name=e.path=(b||"")+a.name,n.push(e)}var f=a.createReader(),h=[],p=function(){f.readEntries(function(e){try{e.length?(h=h.concat(Array.prototype.slice.call(e||[],0)),p()):(angular.forEach(h.slice(0),function(c){n.length<=j&&l>=o&&d.push(g(c,(b?b:"")+a.name+"/"))}),k.all(d).then(function(){c.resolve()},function(a){c.reject(a)}))}catch(f){c.reject(f)}},function(a){c.reject(a)})};p()}else a.file(function(a){try{a.path=(b?b:"")+a.name,m&&(a=i.rename(a,a.path)),n.push(a),o+=a.size,c.resolve()}catch(d){c.reject(d)}},function(a){c.reject(a)});return c.promise}var j=i.getValidationAttr(d,a,"maxFiles");null==j&&(j=Number.MAX_VALUE);var l=i.getValidationAttr(d,a,"maxTotalSize");null==l&&(l=Number.MAX_VALUE);var m=s("ngfIncludeDir",a),n=[],o=0,p=[i.emptyPromise()];if(b&&b.length>0&&"file:"!==h.location.protocol)for(var q=0;q<b.length;q++){if(b[q].webkitGetAsEntry&&b[q].webkitGetAsEntry()&&b[q].webkitGetAsEntry().isDirectory){var r=b[q].webkitGetAsEntry();if(r.isDirectory&&!e)continue;null!=r&&p.push(g(r))}else{var t=b[q].getAsFile();null!=t&&(n.push(t),o+=t.size)}if(n.length>j||o>l||!f&&n.length>0)break}else if(null!=c)for(var u=0;u<c.length;u++){var v=c.item(u);if((v.type||v.size>0)&&(n.push(v),o+=v.size),n.length>j||o>l||!f&&n.length>0)break}var w=k.defer();return k.all(p).then(function(){if(f||m||!n.length)w.resolve(n);else{for(var a=0;n[a]&&"directory"===n[a].type;)a++;w.resolve([n[a]])}},function(a){w.reject(a)}),w.promise}var r=b(),s=function(a,b,c){return i.attrGetter(a,d,b,c)};if(s("dropAvailable")&&g(function(){a[s("dropAvailable")]?a[s("dropAvailable")].value=r:a[s("dropAvailable")]=r}),!r)return void(s("ngfHideOnDropNotAvailable",a)===!0&&c.css("display","none"));null==s("ngfSelect")&&i.registerModelChangeValidator(e,d,a);var t,u=null,v=f(s("ngfStopPropagation")),w=1;c[0].addEventListener("dragover",function(b){if(!l()&&i.shouldUpdateOn("drop",d,a)){if(b.preventDefault(),v(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var e=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===e||"linkMove"===e?"move":"copy"}g.cancel(u),t||(t="C",p(a,d,b,function(d){t=d,c.addClass(t),s("ngfDrag",a,{$isDragging:!0,$class:t,$event:b})}))}},!1),c[0].addEventListener("dragenter",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),v(a)&&b.stopPropagation())},!1),c[0].addEventListener("dragleave",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),v(a)&&b.stopPropagation(),u=g(function(){t&&c.removeClass(t),t=null,s("ngfDrag",a,{$isDragging:!1,$event:b})},w||100))},!1),c[0].addEventListener("drop",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),v(a)&&b.stopPropagation(),t&&c.removeClass(t),t=null,m(b.dataTransfer,b,"dropUrl"))},!1),c[0].addEventListener("paste",function(b){navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&s("ngfEnableFirefoxPaste",a)&&b.preventDefault(),!l()&&i.shouldUpdateOn("paste",d,a)&&m(b.clipboardData||b.originalEvent.clipboardData,b,"pasteUrl")},!1),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&s("ngfEnableFirefoxPaste",a)&&(c.attr("contenteditable",!0),c.on("keypress",function(a){a.metaKey||a.ctrlKey||a.preventDefault()}))}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a&&!/Edge\/12./i.test(navigator.userAgent)}ngFileUpload.directive("ngfDrop",["$parse","$timeout","$window","Upload","$http","$q",function(b,c,d,e,f,g){return{restrict:"AEC",require:"?ngModel",link:function(h,i,j,k){a(h,i,j,k,b,c,d,e,f,g)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(a,c,d){return function(e,f,g){if(b()){var h=a(d.attrGetter("ngfDropAvailable",g));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(),ngFileUpload.service("UploadExif",["UploadResize","$q",function(a,b){function c(a,b,c,d){switch(b){case 2:return a.transform(-1,0,0,1,c,0);case 3:return a.transform(-1,0,0,-1,c,d);case 4:return a.transform(1,0,0,-1,0,d);case 5:return a.transform(0,1,1,0,0,0);case 6:return a.transform(0,1,-1,0,d,0);case 7:return a.transform(0,-1,-1,0,d,c);case 8:return a.transform(0,-1,1,0,0,c)}}function d(a){for(var b="",c=new Uint8Array(a),d=c.byteLength,e=0;d>e;e++)b+=String.fromCharCode(c[e]);return window.btoa(b)}var e=a;return e.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&e.isResizeSupported()},e.readOrientation=function(a){var c=b.defer(),d=new FileReader,e=a.slice?a.slice(0,65536):a;return d.readAsArrayBuffer(e),d.onerror=function(a){return c.reject(a)},d.onload=function(a){var b={orientation:1},d=new DataView(this.result);if(65496!==d.getUint16(0,!1))return c.resolve(b);for(var e=d.byteLength,f=2;e>f;){var g=d.getUint16(f,!1);if(f+=2,65505===g){if(1165519206!==d.getUint32(f+=2,!1))return c.resolve(b);var h=18761===d.getUint16(f+=6,!1);f+=d.getUint32(f+4,h);var i=d.getUint16(f,h);f+=2;for(var j=0;i>j;j++)if(274===d.getUint16(f+12*j,h)){var k=d.getUint16(f+12*j+8,h);return k>=2&&8>=k&&(d.setUint16(f+12*j+8,1,h),b.fixedArrayBuffer=a.target.result),b.orientation=k,c.resolve(b)}}else{if(65280!==(65280&g))break;f+=d.getUint16(f,!1)}}return c.resolve(b)},c.promise},e.applyExifRotation=function(a){if(0!==a.type.indexOf("image/jpeg"))return e.emptyPromise(a);var f=b.defer();return e.readOrientation(a).then(function(b){return b.orientation<2||b.orientation>8?f.resolve(a):void e.dataUrl(a,!0).then(function(g){var h=document.createElement("canvas"),i=document.createElement("img");i.onload=function(){try{h.width=b.orientation>4?i.height:i.width,h.height=b.orientation>4?i.width:i.height;var g=h.getContext("2d");c(g,b.orientation,i.width,i.height),g.drawImage(i,0,0);var j=h.toDataURL(a.type||"image/WebP",.934);j=e.restoreExif(d(b.fixedArrayBuffer),j);var k=e.dataUrltoBlob(j,a.name);f.resolve(k)}catch(l){return f.reject(l)}},i.onerror=function(){f.reject()},i.src=g},function(a){f.reject(a)})},function(a){f.reject(a)}),f.promise},e.restoreExif=function(a,b){var c={};return c.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c.encode64=function(a){var b,c,d,e,f,g="",h="",i="",j=0;do b=a[j++],c=a[j++],h=a[j++],d=b>>2,e=(3&b)<<4|c>>4,f=(15&c)<<2|h>>6,i=63&h,isNaN(c)?f=i=64:isNaN(h)&&(i=64),g=g+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(e)+this.KEY_STR.charAt(f)+this.KEY_STR.charAt(i),b=c=h="",d=e=f=i="";while(j<a.length);return g},c.restore=function(a,b){a.match("data:image/jpeg;base64,")&&(a=a.replace("data:image/jpeg;base64,",""));var c=this.decode64(a),d=this.slice2Segments(c),e=this.exifManipulation(b,d);return"data:image/jpeg;base64,"+this.encode64(e)},c.exifManipulation=function(a,b){var c=this.getExifArray(b),d=this.insertExif(a,c);return new Uint8Array(d)},c.getExifArray=function(a){for(var b,c=0;c<a.length;c++)if(b=a[c],255===b[0]&225===b[1])return b;return[]},c.insertExif=function(a,b){var c=a.replace("data:image/jpeg;base64,",""),d=this.decode64(c),e=d.indexOf(255,3),f=d.slice(0,e),g=d.slice(e),h=f;return h=h.concat(b),h=h.concat(g)},c.slice2Segments=function(a){for(var b=0,c=[];;){if(255===a[b]&218===a[b+1])break;if(255===a[b]&216===a[b+1])b+=2;else{var d=256*a[b+2]+a[b+3],e=b+d+2,f=a.slice(b,e);c.push(f),b=e}if(b>a.length)break}return c},c.decode64=function(a){var b,c,d,e,f,g="",h="",i=0,j=[],k=/[^A-Za-z0-9\+\/\=]/g;k.exec(a)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."),a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do d=this.KEY_STR.indexOf(a.charAt(i++)),e=this.KEY_STR.indexOf(a.charAt(i++)),f=this.KEY_STR.indexOf(a.charAt(i++)),h=this.KEY_STR.indexOf(a.charAt(i++)),b=d<<2|e>>4,c=(15&e)<<4|f>>2,g=(3&f)<<6|h,j.push(b),64!==f&&j.push(c),64!==h&&j.push(g),b=c=g="",d=e=f=h="";while(i<a.length);return j},c.restore(a,b)},e}]); | ||
1066 | 6 | \ No newline at end of file | 5 | \ No newline at end of file |
1067 | diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js | |||
1068 | index b6192af..f1d033a 100644 | |||
1069 | --- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js | |||
1070 | +++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.js | |||
1071 | @@ -1,9 +1,9 @@ | |||
1072 | 1 | /**! | 1 | /**! |
1074 | 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, |
1075 | 3 | * progress, resize, thumbnail, preview, validation and CORS | 3 | * progress, resize, thumbnail, preview, validation and CORS |
1076 | 4 | * FileAPI Flash shim for old browsers not supporting FormData | 4 | * FileAPI Flash shim for old browsers not supporting FormData |
1077 | 5 | * @author Danial <danial.farid@gmail.com> | 5 | * @author Danial <danial.farid@gmail.com> |
1079 | 6 | * @version 12.0.4 | 6 | * @version 12.2.13 |
1080 | 7 | */ | 7 | */ |
1081 | 8 | 8 | ||
1082 | 9 | (function () { | 9 | (function () { |
1083 | 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 | |||
1084 | index b87b39d..9928c83 100644 | |||
1085 | --- a/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.min.js | |||
1086 | +++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload-shim.min.js | |||
1087 | @@ -1,2 +1,2 @@ | |||
1089 | 1 | /*! 12.0.4 */ | 1 | /*! 12.2.13 */ |
1090 | 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)}}); |
1091 | 3 | \ No newline at end of file | 3 | \ No newline at end of file |
1092 | diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload.js | |||
1093 | index 6b5547a..c6a9c43 100644 | |||
1094 | --- a/xstatic/pkg/angular_fileupload/data/ng-file-upload.js | |||
1095 | +++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload.js | |||
1096 | @@ -2,7 +2,7 @@ | |||
1097 | 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, |
1098 | 3 | * progress, resize, thumbnail, preview, validation and CORS | 3 | * progress, resize, thumbnail, preview, validation and CORS |
1099 | 4 | * @author Danial <danial.farid@gmail.com> | 4 | * @author Danial <danial.farid@gmail.com> |
1101 | 5 | * @version 12.0.4 | 5 | * @version 12.2.13 |
1102 | 6 | */ | 6 | */ |
1103 | 7 | 7 | ||
1104 | 8 | if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | 8 | if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { |
1105 | @@ -23,7 +23,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | |||
1106 | 23 | 23 | ||
1107 | 24 | var ngFileUpload = angular.module('ngFileUpload', []); | 24 | var ngFileUpload = angular.module('ngFileUpload', []); |
1108 | 25 | 25 | ||
1110 | 26 | ngFileUpload.version = '12.0.4'; | 26 | ngFileUpload.version = '12.2.13'; |
1111 | 27 | 27 | ||
1112 | 28 | ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) { | 28 | ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) { |
1113 | 29 | var upload = this; | 29 | var upload = this; |
1114 | @@ -90,10 +90,12 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |||
1115 | 90 | function uploadWithAngular() { | 90 | function uploadWithAngular() { |
1116 | 91 | $http(config).then(function (r) { | 91 | $http(config).then(function (r) { |
1117 | 92 | if (resumeSupported && config._chunkSize && !config._finished && config._file) { | 92 | if (resumeSupported && config._chunkSize && !config._finished && config._file) { |
1118 | 93 | var fileSize = config._file && config._file.size || 0; | ||
1119 | 93 | notifyProgress({ | 94 | notifyProgress({ |
1123 | 94 | loaded: config._end, | 95 | loaded: Math.min(config._end, fileSize), |
1124 | 95 | total: config._file && config._file.size, | 96 | total: fileSize, |
1125 | 96 | config: config, type: 'progress' | 97 | config: config, |
1126 | 98 | type: 'progress' | ||
1127 | 97 | } | 99 | } |
1128 | 98 | ); | 100 | ); |
1129 | 99 | upload.upload(config, true); | 101 | upload.upload(config, true); |
1130 | @@ -132,6 +134,9 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |||
1131 | 132 | } else if (config.resumeSize) { | 134 | } else if (config.resumeSize) { |
1132 | 133 | config.resumeSize().then(function (size) { | 135 | config.resumeSize().then(function (size) { |
1133 | 134 | config._start = size; | 136 | config._start = size; |
1134 | 137 | if (config._chunkSize) { | ||
1135 | 138 | config._end = config._start + config._chunkSize; | ||
1136 | 139 | } | ||
1137 | 135 | uploadWithAngular(); | 140 | uploadWithAngular(); |
1138 | 136 | }, function (e) { | 141 | }, function (e) { |
1139 | 137 | throw e; | 142 | throw e; |
1140 | @@ -185,9 +190,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |||
1141 | 185 | }; | 190 | }; |
1142 | 186 | 191 | ||
1143 | 187 | upload.promisesCount++; | 192 | upload.promisesCount++; |
1147 | 188 | promise['finally'](function () { | 193 | if (promise['finally'] && promise['finally'] instanceof Function) { |
1148 | 189 | upload.promisesCount--; | 194 | promise['finally'](function () { |
1149 | 190 | }); | 195 | upload.promisesCount--; |
1150 | 196 | }); | ||
1151 | 197 | } | ||
1152 | 191 | return promise; | 198 | return promise; |
1153 | 192 | } | 199 | } |
1154 | 193 | 200 | ||
1155 | @@ -371,9 +378,11 @@ ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, | |||
1156 | 371 | var arrayBufferView = new Uint8Array(resp.data); | 378 | var arrayBufferView = new Uint8Array(resp.data); |
1157 | 372 | var type = resp.headers('content-type') || 'image/WebP'; | 379 | var type = resp.headers('content-type') || 'image/WebP'; |
1158 | 373 | var blob = new window.Blob([arrayBufferView], {type: type}); | 380 | var blob = new window.Blob([arrayBufferView], {type: type}); |
1159 | 381 | var matches = url.match(/.*\/(.+?)(\?.*)?$/); | ||
1160 | 382 | if (matches.length > 1) { | ||
1161 | 383 | blob.name = matches[1]; | ||
1162 | 384 | } | ||
1163 | 374 | defer.resolve(blob); | 385 | defer.resolve(blob); |
1164 | 375 | //var split = type.split('[/;]'); | ||
1165 | 376 | //blob.name = url.substring(0, 150).replace(/\W+/g, '') + '.' + (split.length > 1 ? split[1] : 'jpg'); | ||
1166 | 377 | }, function (e) { | 386 | }, function (e) { |
1167 | 378 | defer.reject(e); | 387 | defer.reject(e); |
1168 | 379 | }); | 388 | }); |
1169 | @@ -421,7 +430,7 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
1170 | 421 | }; | 430 | }; |
1171 | 422 | 431 | ||
1172 | 423 | upload.shouldUpdateOn = function (type, attr, scope) { | 432 | upload.shouldUpdateOn = function (type, attr, scope) { |
1174 | 424 | var modelOptions = upload.attrGetter('ngModelOptions', attr, scope); | 433 | var modelOptions = upload.attrGetter('ngfModelOptions', attr, scope); |
1175 | 425 | if (modelOptions && modelOptions.updateOn) { | 434 | if (modelOptions && modelOptions.updateOn) { |
1176 | 426 | return modelOptions.updateOn.split(' ').indexOf(type) > -1; | 435 | return modelOptions.updateOn.split(' ').indexOf(type) > -1; |
1177 | 427 | } | 436 | } |
1178 | @@ -471,13 +480,13 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
1179 | 471 | return $q.all(promises); | 480 | return $q.all(promises); |
1180 | 472 | } | 481 | } |
1181 | 473 | 482 | ||
1183 | 474 | function resize(files, attr, scope) { | 483 | function resizeFile(files, attr, scope, ngModel) { |
1184 | 475 | var resizeVal = upload.attrGetter('ngfResize', attr, scope); | 484 | var resizeVal = upload.attrGetter('ngfResize', attr, scope); |
1185 | 476 | if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise(); | 485 | if (!resizeVal || !upload.isResizeSupported() || !files.length) return upload.emptyPromise(); |
1186 | 477 | if (resizeVal instanceof Function) { | 486 | if (resizeVal instanceof Function) { |
1187 | 478 | var defer = $q.defer(); | 487 | var defer = $q.defer(); |
1190 | 479 | resizeVal(files).then(function (p) { | 488 | return resizeVal(files).then(function (p) { |
1191 | 480 | resizeWithParams(p, files, attr, scope).then(function (r) { | 489 | resizeWithParams(p, files, attr, scope, ngModel).then(function (r) { |
1192 | 481 | defer.resolve(r); | 490 | defer.resolve(r); |
1193 | 482 | }, function (e) { | 491 | }, function (e) { |
1194 | 483 | defer.reject(e); | 492 | defer.reject(e); |
1195 | @@ -486,27 +495,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
1196 | 486 | defer.reject(e); | 495 | defer.reject(e); |
1197 | 487 | }); | 496 | }); |
1198 | 488 | } else { | 497 | } else { |
1200 | 489 | return resizeWithParams(resizeVal, files, attr, scope); | 498 | return resizeWithParams(resizeVal, files, attr, scope, ngModel); |
1201 | 490 | } | 499 | } |
1202 | 491 | } | 500 | } |
1203 | 492 | 501 | ||
1205 | 493 | function resizeWithParams(param, files, attr, scope) { | 502 | function resizeWithParams(params, files, attr, scope, ngModel) { |
1206 | 494 | var promises = [upload.emptyPromise()]; | 503 | var promises = [upload.emptyPromise()]; |
1207 | 495 | 504 | ||
1208 | 496 | function handleFile(f, i) { | 505 | function handleFile(f, i) { |
1209 | 497 | if (f.type.indexOf('image') === 0) { | 506 | if (f.type.indexOf('image') === 0) { |
1216 | 498 | if (param.pattern && !upload.validatePattern(f, param.pattern)) return; | 507 | if (params.pattern && !upload.validatePattern(f, params.pattern)) return; |
1217 | 499 | var promise = upload.resize(f, param.width, param.height, param.quality, | 508 | params.resizeIf = function (width, height) { |
1218 | 500 | param.type, param.ratio, param.centerCrop, function (width, height) { | 509 | return upload.attrGetter('ngfResizeIf', attr, scope, |
1219 | 501 | return upload.attrGetter('ngfResizeIf', attr, scope, | 510 | {$width: width, $height: height, $file: f}); |
1220 | 502 | {$width: width, $height: height, $file: f}); | 511 | }; |
1221 | 503 | }, param.restoreExif !== false); | 512 | var promise = upload.resize(f, params); |
1222 | 504 | promises.push(promise); | 513 | promises.push(promise); |
1223 | 505 | promise.then(function (resizedFile) { | 514 | promise.then(function (resizedFile) { |
1224 | 506 | files.splice(i, 1, resizedFile); | 515 | files.splice(i, 1, resizedFile); |
1225 | 507 | }, function (e) { | 516 | }, function (e) { |
1226 | 508 | f.$error = 'resize'; | 517 | f.$error = 'resize'; |
1227 | 518 | (f.$errorMessages = (f.$errorMessages || {})).resize = true; | ||
1228 | 509 | f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name); | 519 | f.$errorParam = (e ? (e.message ? e.message : e) + ': ' : '') + (f && f.name); |
1229 | 520 | ngModel.$ngfValidations.push({name: 'resize', valid: false}); | ||
1230 | 521 | upload.applyModelValidation(ngModel, files); | ||
1231 | 510 | }); | 522 | }); |
1232 | 511 | } | 523 | } |
1233 | 512 | } | 524 | } |
1234 | @@ -593,18 +605,6 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
1235 | 593 | return angular.isArray(v) ? v : [v]; | 605 | return angular.isArray(v) ? v : [v]; |
1236 | 594 | } | 606 | } |
1237 | 595 | 607 | ||
1238 | 596 | function separateInvalids() { | ||
1239 | 597 | valids = []; | ||
1240 | 598 | invalids = []; | ||
1241 | 599 | angular.forEach(allNewFiles, function (file) { | ||
1242 | 600 | if (file.$error) { | ||
1243 | 601 | invalids.push(file); | ||
1244 | 602 | } else { | ||
1245 | 603 | valids.push(file); | ||
1246 | 604 | } | ||
1247 | 605 | }); | ||
1248 | 606 | } | ||
1249 | 607 | |||
1250 | 608 | function resizeAndUpdate() { | 608 | function resizeAndUpdate() { |
1251 | 609 | function updateModel() { | 609 | function updateModel() { |
1252 | 610 | $timeout(function () { | 610 | $timeout(function () { |
1253 | @@ -614,17 +614,30 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
1254 | 614 | }, options && options.debounce ? options.debounce.change || options.debounce : 0); | 614 | }, options && options.debounce ? options.debounce.change || options.debounce : 0); |
1255 | 615 | } | 615 | } |
1256 | 616 | 616 | ||
1258 | 617 | resize(validateAfterResize ? allNewFiles : valids, attr, scope).then(function () { | 617 | var resizingFiles = validateAfterResize ? allNewFiles : valids; |
1259 | 618 | resizeFile(resizingFiles, attr, scope, ngModel).then(function () { | ||
1260 | 618 | if (validateAfterResize) { | 619 | if (validateAfterResize) { |
1265 | 619 | upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () { | 620 | upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope) |
1266 | 620 | separateInvalids(); | 621 | .then(function (validationResult) { |
1267 | 621 | updateModel(); | 622 | valids = validationResult.validsFiles; |
1268 | 622 | }); | 623 | invalids = validationResult.invalidsFiles; |
1269 | 624 | updateModel(); | ||
1270 | 625 | }); | ||
1271 | 623 | } else { | 626 | } else { |
1272 | 624 | updateModel(); | 627 | updateModel(); |
1273 | 625 | } | 628 | } |
1276 | 626 | }, function (e) { | 629 | }, function () { |
1277 | 627 | throw 'Could not resize files ' + e; | 630 | for (var i = 0; i < resizingFiles.length; i++) { |
1278 | 631 | var f = resizingFiles[i]; | ||
1279 | 632 | if (f.$error === 'resize') { | ||
1280 | 633 | var index = valids.indexOf(f); | ||
1281 | 634 | if (index > -1) { | ||
1282 | 635 | valids.splice(index, 1); | ||
1283 | 636 | invalids.push(f); | ||
1284 | 637 | } | ||
1285 | 638 | updateModel(); | ||
1286 | 639 | } | ||
1287 | 640 | } | ||
1288 | 628 | }); | 641 | }); |
1289 | 629 | } | 642 | } |
1290 | 630 | 643 | ||
1291 | @@ -654,13 +667,15 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE | |||
1292 | 654 | 667 | ||
1293 | 655 | var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope); | 668 | var validateAfterResize = upload.attrGetter('ngfValidateAfterResize', attr, scope); |
1294 | 656 | 669 | ||
1297 | 657 | var options = upload.attrGetter('ngModelOptions', attr, scope); | 670 | var options = upload.attrGetter('ngfModelOptions', attr, scope); |
1298 | 658 | upload.validate(allNewFiles, prevValidFiles.length, ngModel, attr, scope).then(function () { | 671 | upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope) |
1299 | 672 | .then(function (validationResult) { | ||
1300 | 659 | if (noDelay) { | 673 | if (noDelay) { |
1301 | 660 | update(allNewFiles, [], files, dupFiles, isSingleModel); | 674 | update(allNewFiles, [], files, dupFiles, isSingleModel); |
1302 | 661 | } else { | 675 | } else { |
1303 | 662 | if ((!options || !options.allowInvalid) && !validateAfterResize) { | 676 | if ((!options || !options.allowInvalid) && !validateAfterResize) { |
1305 | 663 | separateInvalids(); | 677 | valids = validationResult.validFiles; |
1306 | 678 | invalids = validationResult.invalidFiles; | ||
1307 | 664 | } else { | 679 | } else { |
1308 | 665 | valids = allNewFiles; | 680 | valids = allNewFiles; |
1309 | 666 | } | 681 | } |
1310 | @@ -697,7 +712,7 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1311 | 697 | /** @namespace attr.ngfSelect */ | 712 | /** @namespace attr.ngfSelect */ |
1312 | 698 | /** @namespace attr.ngfChange */ | 713 | /** @namespace attr.ngfChange */ |
1313 | 699 | /** @namespace attr.ngModel */ | 714 | /** @namespace attr.ngModel */ |
1315 | 700 | /** @namespace attr.ngModelOptions */ | 715 | /** @namespace attr.ngfModelOptions */ |
1316 | 701 | /** @namespace attr.ngfMultiple */ | 716 | /** @namespace attr.ngfMultiple */ |
1317 | 702 | /** @namespace attr.ngfCapture */ | 717 | /** @namespace attr.ngfCapture */ |
1318 | 703 | /** @namespace attr.ngfValidate */ | 718 | /** @namespace attr.ngfValidate */ |
1319 | @@ -717,6 +732,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1320 | 717 | function changeFn(evt) { | 732 | function changeFn(evt) { |
1321 | 718 | if (upload.shouldUpdateOn('change', attr, scope)) { | 733 | if (upload.shouldUpdateOn('change', attr, scope)) { |
1322 | 719 | var fileList = evt.__files_ || (evt.target && evt.target.files), files = []; | 734 | var fileList = evt.__files_ || (evt.target && evt.target.files), files = []; |
1323 | 735 | /* Handle duplicate call in IE11 */ | ||
1324 | 736 | if (!fileList) return; | ||
1325 | 720 | for (var i = 0; i < fileList.length; i++) { | 737 | for (var i = 0; i < fileList.length; i++) { |
1326 | 721 | files.push(fileList[i]); | 738 | files.push(fileList[i]); |
1327 | 722 | } | 739 | } |
1328 | @@ -728,31 +745,39 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1329 | 728 | upload.registerModelChangeValidator(ngModel, attr, scope); | 745 | upload.registerModelChangeValidator(ngModel, attr, scope); |
1330 | 729 | 746 | ||
1331 | 730 | var unwatches = []; | 747 | var unwatches = []; |
1342 | 731 | unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () { | 748 | if (attrGetter('ngfMultiple')) { |
1343 | 732 | fileElem.attr('multiple', attrGetter('ngfMultiple', scope)); | 749 | unwatches.push(scope.$watch(attrGetter('ngfMultiple'), function () { |
1344 | 733 | })); | 750 | fileElem.attr('multiple', attrGetter('ngfMultiple', scope)); |
1345 | 734 | unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () { | 751 | })); |
1346 | 735 | fileElem.attr('capture', attrGetter('ngfCapture', scope)); | 752 | } |
1347 | 736 | })); | 753 | if (attrGetter('ngfCapture')) { |
1348 | 737 | unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () { | 754 | unwatches.push(scope.$watch(attrGetter('ngfCapture'), function () { |
1349 | 738 | fileElem.attr('accept', attrGetter('ngfAccept', scope)); | 755 | fileElem.attr('capture', attrGetter('ngfCapture', scope)); |
1350 | 739 | })); | 756 | })); |
1351 | 740 | attr.$observe('accept', function () { | 757 | } |
1352 | 758 | if (attrGetter('ngfAccept')) { | ||
1353 | 759 | unwatches.push(scope.$watch(attrGetter('ngfAccept'), function () { | ||
1354 | 760 | fileElem.attr('accept', attrGetter('ngfAccept', scope)); | ||
1355 | 761 | })); | ||
1356 | 762 | } | ||
1357 | 763 | unwatches.push(attr.$observe('accept', function () { | ||
1358 | 741 | fileElem.attr('accept', attrGetter('accept')); | 764 | fileElem.attr('accept', attrGetter('accept')); |
1373 | 742 | }); | 765 | })); |
1374 | 743 | unwatches.push(function () { | 766 | function bindAttrToFileInput(fileElem, label) { |
1375 | 744 | if (attr.$$observers) delete attr.$$observers.accept; | 767 | function updateId(val) { |
1376 | 745 | }); | 768 | fileElem.attr('id', 'ngf-' + val); |
1377 | 746 | function bindAttrToFileInput(fileElem) { | 769 | label.attr('id', 'ngf-label-' + val); |
1378 | 747 | if (elem !== fileElem) { | 770 | } |
1379 | 748 | for (var i = 0; i < elem[0].attributes.length; i++) { | 771 | |
1380 | 749 | var attribute = elem[0].attributes[i]; | 772 | for (var i = 0; i < elem[0].attributes.length; i++) { |
1381 | 750 | if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') { | 773 | var attribute = elem[0].attributes[i]; |
1382 | 751 | if (attribute.value == null || attribute.value === '') { | 774 | if (attribute.name !== 'type' && attribute.name !== 'class' && attribute.name !== 'style') { |
1383 | 752 | if (attribute.name === 'required') attribute.value = 'required'; | 775 | if (attribute.name === 'id') { |
1384 | 753 | if (attribute.name === 'multiple') attribute.value = 'multiple'; | 776 | updateId(attribute.value); |
1385 | 754 | } | 777 | unwatches.push(attr.$observe('id', updateId)); |
1386 | 755 | fileElem.attr(attribute.name, attribute.name === 'id' ? 'ngf-' + attribute.value : attribute.value); | 778 | } else { |
1387 | 779 | fileElem.attr(attribute.name, (!attribute.value && (attribute.name === 'required' || | ||
1388 | 780 | attribute.name === 'multiple')) ? attribute.name : attribute.value); | ||
1389 | 756 | } | 781 | } |
1390 | 757 | } | 782 | } |
1391 | 758 | } | 783 | } |
1392 | @@ -765,12 +790,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1393 | 765 | 790 | ||
1394 | 766 | var fileElem = angular.element('<input type="file">'); | 791 | var fileElem = angular.element('<input type="file">'); |
1395 | 767 | 792 | ||
1396 | 768 | bindAttrToFileInput(fileElem); | ||
1397 | 769 | |||
1398 | 770 | var label = angular.element('<label>upload</label>'); | 793 | var label = angular.element('<label>upload</label>'); |
1399 | 771 | label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden') | 794 | label.css('visibility', 'hidden').css('position', 'absolute').css('overflow', 'hidden') |
1400 | 772 | .css('width', '0px').css('height', '0px').css('border', 'none') | 795 | .css('width', '0px').css('height', '0px').css('border', 'none') |
1401 | 773 | .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1'); | 796 | .css('margin', '0px').css('padding', '0px').attr('tabindex', '-1'); |
1402 | 797 | bindAttrToFileInput(fileElem, label); | ||
1403 | 798 | |||
1404 | 774 | generatedElems.push({el: elem, ref: label}); | 799 | generatedElems.push({el: elem, ref: label}); |
1405 | 775 | 800 | ||
1406 | 776 | document.body.appendChild(label.append(fileElem)[0]); | 801 | document.body.appendChild(label.append(fileElem)[0]); |
1407 | @@ -778,13 +803,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1408 | 778 | return fileElem; | 803 | return fileElem; |
1409 | 779 | } | 804 | } |
1410 | 780 | 805 | ||
1411 | 781 | var initialTouchStartY = 0; | ||
1412 | 782 | |||
1413 | 783 | function clickHandler(evt) { | 806 | function clickHandler(evt) { |
1414 | 784 | if (elem.attr('disabled')) return false; | 807 | if (elem.attr('disabled')) return false; |
1415 | 785 | if (attrGetter('ngfSelectDisabled', scope)) return; | 808 | if (attrGetter('ngfSelectDisabled', scope)) return; |
1416 | 786 | 809 | ||
1418 | 787 | var r = handleTouch(evt); | 810 | var r = detectSwipe(evt); |
1419 | 811 | // prevent the click if it is a swipe | ||
1420 | 788 | if (r != null) return r; | 812 | if (r != null) return r; |
1421 | 789 | 813 | ||
1422 | 790 | resetModel(evt); | 814 | resetModel(evt); |
1423 | @@ -796,7 +820,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1424 | 796 | document.body.appendChild(fileElem.parent()[0]); | 820 | document.body.appendChild(fileElem.parent()[0]); |
1425 | 797 | fileElem.bind('change', changeFn); | 821 | fileElem.bind('change', changeFn); |
1426 | 798 | } | 822 | } |
1428 | 799 | } catch(e){/*ignore*/} | 823 | } catch (e) {/*ignore*/ |
1429 | 824 | } | ||
1430 | 800 | 825 | ||
1431 | 801 | if (isDelayedClickSupported(navigator.userAgent)) { | 826 | if (isDelayedClickSupported(navigator.userAgent)) { |
1432 | 802 | setTimeout(function () { | 827 | setTimeout(function () { |
1433 | @@ -809,19 +834,30 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1434 | 809 | return false; | 834 | return false; |
1435 | 810 | } | 835 | } |
1436 | 811 | 836 | ||
1437 | 812 | function handleTouch(evt) { | ||
1438 | 813 | var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches); | ||
1439 | 814 | if (evt.type === 'touchstart') { | ||
1440 | 815 | initialTouchStartY = touches ? touches[0].clientY : 0; | ||
1441 | 816 | return true; // don't block event default | ||
1442 | 817 | } else { | ||
1443 | 818 | evt.stopPropagation(); | ||
1444 | 819 | evt.preventDefault(); | ||
1445 | 820 | 837 | ||
1450 | 821 | // prevent scroll from triggering event | 838 | var initialTouchStartY = 0; |
1451 | 822 | if (evt.type === 'touchend') { | 839 | var initialTouchStartX = 0; |
1452 | 823 | var currentLocation = touches ? touches[0].clientY : 0; | 840 | |
1453 | 824 | if (Math.abs(currentLocation - initialTouchStartY) > 20) return false; | 841 | function detectSwipe(evt) { |
1454 | 842 | var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches); | ||
1455 | 843 | if (touches) { | ||
1456 | 844 | if (evt.type === 'touchstart') { | ||
1457 | 845 | initialTouchStartX = touches[0].clientX; | ||
1458 | 846 | initialTouchStartY = touches[0].clientY; | ||
1459 | 847 | return true; // don't block event default | ||
1460 | 848 | } else { | ||
1461 | 849 | // prevent scroll from triggering event | ||
1462 | 850 | if (evt.type === 'touchend') { | ||
1463 | 851 | var currentX = touches[0].clientX; | ||
1464 | 852 | var currentY = touches[0].clientY; | ||
1465 | 853 | if ((Math.abs(currentX - initialTouchStartX) > 20) || | ||
1466 | 854 | (Math.abs(currentY - initialTouchStartY) > 20)) { | ||
1467 | 855 | evt.stopPropagation(); | ||
1468 | 856 | evt.preventDefault(); | ||
1469 | 857 | return false; | ||
1470 | 858 | } | ||
1471 | 859 | } | ||
1472 | 860 | return true; | ||
1473 | 825 | } | 861 | } |
1474 | 826 | } | 862 | } |
1475 | 827 | } | 863 | } |
1476 | @@ -1052,14 +1088,19 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1477 | 1052 | var size = resizeParams; | 1088 | var size = resizeParams; |
1478 | 1053 | if (directiveName === 'ngfThumbnail') { | 1089 | if (directiveName === 'ngfThumbnail') { |
1479 | 1054 | if (!size) { | 1090 | if (!size) { |
1481 | 1055 | size = {width: elem[0].clientWidth, height: elem[0].clientHeight}; | 1091 | size = { |
1482 | 1092 | width: elem[0].naturalWidth || elem[0].clientWidth, | ||
1483 | 1093 | height: elem[0].naturalHeight || elem[0].clientHeight | ||
1484 | 1094 | }; | ||
1485 | 1056 | } | 1095 | } |
1486 | 1057 | if (size.width === 0 && window.getComputedStyle) { | 1096 | if (size.width === 0 && window.getComputedStyle) { |
1487 | 1058 | var style = getComputedStyle(elem[0]); | 1097 | var style = getComputedStyle(elem[0]); |
1492 | 1059 | size = { | 1098 | if (style.width && style.width.indexOf('px') > -1 && style.height && style.height.indexOf('px') > -1) { |
1493 | 1060 | width: parseInt(style.width.slice(0, -2)), | 1099 | size = { |
1494 | 1061 | height: parseInt(style.height.slice(0, -2)) | 1100 | width: parseInt(style.width.slice(0, -2)), |
1495 | 1062 | }; | 1101 | height: parseInt(style.height.slice(0, -2)) |
1496 | 1102 | }; | ||
1497 | 1103 | } | ||
1498 | 1063 | } | 1104 | } |
1499 | 1064 | } | 1105 | } |
1500 | 1065 | 1106 | ||
1501 | @@ -1074,7 +1115,11 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1502 | 1074 | if (file && file.type && file.type.search(getTagType(elem[0])) === 0 && | 1115 | if (file && file.type && file.type.search(getTagType(elem[0])) === 0 && |
1503 | 1075 | (!isBackground || file.type.indexOf('image') === 0)) { | 1116 | (!isBackground || file.type.indexOf('image') === 0)) { |
1504 | 1076 | if (size && Upload.isResizeSupported()) { | 1117 | if (size && Upload.isResizeSupported()) { |
1506 | 1077 | Upload.resize(file, size.width, size.height, size.quality).then( | 1118 | size.resizeIf = function (width, height) { |
1507 | 1119 | return Upload.attrGetter('ngfResizeIf', attr, scope, | ||
1508 | 1120 | {$width: width, $height: height, $file: file}); | ||
1509 | 1121 | }; | ||
1510 | 1122 | Upload.resize(file, size).then( | ||
1511 | 1078 | function (f) { | 1123 | function (f) { |
1512 | 1079 | constructDataUrl(f); | 1124 | constructDataUrl(f); |
1513 | 1080 | }, function (e) { | 1125 | }, function (e) { |
1514 | @@ -1136,8 +1181,8 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |||
1515 | 1136 | }]); | 1181 | }]); |
1516 | 1137 | 1182 | ||
1517 | 1138 | ngFileUpload.config(['$compileProvider', function ($compileProvider) { | 1183 | ngFileUpload.config(['$compileProvider', function ($compileProvider) { |
1520 | 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):/); |
1521 | 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):/); |
1522 | 1141 | }]); | 1186 | }]); |
1523 | 1142 | 1187 | ||
1524 | 1143 | ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) { | 1188 | ngFileUpload.filter('ngfDataUrl', ['UploadDataUrl', '$sce', function (UploadDataUrl, $sce) { |
1525 | @@ -1229,13 +1274,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
1526 | 1229 | if (ngModel) { | 1274 | if (ngModel) { |
1527 | 1230 | ngModel.$formatters.push(function (files) { | 1275 | ngModel.$formatters.push(function (files) { |
1528 | 1231 | if (ngModel.$dirty) { | 1276 | if (ngModel.$dirty) { |
1529 | 1277 | var filesArray = files; | ||
1530 | 1232 | if (files && !angular.isArray(files)) { | 1278 | if (files && !angular.isArray(files)) { |
1532 | 1233 | files = [files]; | 1279 | filesArray = [files]; |
1533 | 1234 | } | 1280 | } |
1536 | 1235 | upload.validate(files, 0, ngModel, attr, scope).then(function () { | 1281 | upload.validate(filesArray, 0, ngModel, attr, scope).then(function () { |
1537 | 1236 | upload.applyModelValidation(ngModel, files); | 1282 | upload.applyModelValidation(ngModel, filesArray); |
1538 | 1237 | }); | 1283 | }); |
1539 | 1238 | } | 1284 | } |
1540 | 1285 | return files; | ||
1541 | 1239 | }); | 1286 | }); |
1542 | 1240 | } | 1287 | } |
1543 | 1241 | }; | 1288 | }; |
1544 | @@ -1285,11 +1332,15 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
1545 | 1285 | return upload.attrGetter(name, attr, scope, params); | 1332 | return upload.attrGetter(name, attr, scope, params); |
1546 | 1286 | }; | 1333 | }; |
1547 | 1287 | 1334 | ||
1548 | 1335 | var ignoredErrors = (upload.attrGetter('ngfIgnoreInvalid', attr, scope) || '').split(' '); | ||
1549 | 1336 | var runAllValidation = upload.attrGetter('ngfRunAllValidations', attr, scope); | ||
1550 | 1337 | |||
1551 | 1288 | if (files == null || files.length === 0) { | 1338 | if (files == null || files.length === 0) { |
1553 | 1289 | return upload.emptyPromise(ngModel); | 1339 | return upload.emptyPromise({'validFiles': files, 'invalidFiles': []}); |
1554 | 1290 | } | 1340 | } |
1555 | 1291 | 1341 | ||
1556 | 1292 | files = files.length === undefined ? [files] : files.slice(0); | 1342 | files = files.length === undefined ? [files] : files.slice(0); |
1557 | 1343 | var invalidFiles = []; | ||
1558 | 1293 | 1344 | ||
1559 | 1294 | function validateSync(name, validationName, fn) { | 1345 | function validateSync(name, validationName, fn) { |
1560 | 1295 | if (files) { | 1346 | if (files) { |
1561 | @@ -1300,11 +1351,20 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
1562 | 1300 | var val = upload.getValidationAttr(attr, scope, name, validationName, file); | 1351 | var val = upload.getValidationAttr(attr, scope, name, validationName, file); |
1563 | 1301 | if (val != null) { | 1352 | if (val != null) { |
1564 | 1302 | if (!fn(file, val, i)) { | 1353 | if (!fn(file, val, i)) { |
1570 | 1303 | file.$error = name; | 1354 | if (ignoredErrors.indexOf(name) === -1) { |
1571 | 1304 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; | 1355 | file.$error = name; |
1572 | 1305 | file.$errorParam = val; | 1356 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; |
1573 | 1306 | files.splice(i, 1); | 1357 | file.$errorParam = val; |
1574 | 1307 | valid = false; | 1358 | if (invalidFiles.indexOf(file) === -1) { |
1575 | 1359 | invalidFiles.push(file); | ||
1576 | 1360 | } | ||
1577 | 1361 | if (!runAllValidation) { | ||
1578 | 1362 | files.splice(i, 1); | ||
1579 | 1363 | } | ||
1580 | 1364 | valid = false; | ||
1581 | 1365 | } else { | ||
1582 | 1366 | files.splice(i, 1); | ||
1583 | 1367 | } | ||
1584 | 1308 | } | 1368 | } |
1585 | 1309 | } | 1369 | } |
1586 | 1310 | } | 1370 | } |
1587 | @@ -1315,9 +1375,6 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
1588 | 1315 | } | 1375 | } |
1589 | 1316 | } | 1376 | } |
1590 | 1317 | 1377 | ||
1591 | 1318 | validateSync('maxFiles', null, function (file, val, i) { | ||
1592 | 1319 | return prevLength + i < val; | ||
1593 | 1320 | }); | ||
1594 | 1321 | validateSync('pattern', null, upload.validatePattern); | 1378 | validateSync('pattern', null, upload.validatePattern); |
1595 | 1322 | validateSync('minSize', 'size.min', function (file, val) { | 1379 | validateSync('minSize', 'size.min', function (file, val) { |
1596 | 1323 | return file.size + 0.1 >= upload.translateScalars(val); | 1380 | return file.size + 0.1 >= upload.translateScalars(val); |
1597 | @@ -1340,44 +1397,58 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
1598 | 1340 | }); | 1397 | }); |
1599 | 1341 | 1398 | ||
1600 | 1342 | if (!files.length) { | 1399 | if (!files.length) { |
1602 | 1343 | return upload.emptyPromise(ngModel, ngModel.$ngfValidations); | 1400 | return upload.emptyPromise({'validFiles': [], 'invalidFiles': invalidFiles}); |
1603 | 1344 | } | 1401 | } |
1604 | 1345 | 1402 | ||
1605 | 1346 | function validateAsync(name, validationName, type, asyncFn, fn) { | 1403 | function validateAsync(name, validationName, type, asyncFn, fn) { |
1606 | 1347 | function resolveResult(defer, file, val) { | 1404 | function resolveResult(defer, file, val) { |
1610 | 1348 | if (val != null) { | 1405 | function resolveInternal(fn) { |
1611 | 1349 | asyncFn(file, val).then(function (d) { | 1406 | if (fn()) { |
1612 | 1350 | if (!fn(d, val)) { | 1407 | if (ignoredErrors.indexOf(name) === -1) { |
1613 | 1351 | file.$error = name; | 1408 | file.$error = name; |
1614 | 1352 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; | 1409 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; |
1615 | 1353 | file.$errorParam = val; | 1410 | file.$errorParam = val; |
1617 | 1354 | defer.reject(); | 1411 | if (invalidFiles.indexOf(file) === -1) { |
1618 | 1412 | invalidFiles.push(file); | ||
1619 | 1413 | } | ||
1620 | 1414 | if (!runAllValidation) { | ||
1621 | 1415 | var i = files.indexOf(file); | ||
1622 | 1416 | if (i > -1) files.splice(i, 1); | ||
1623 | 1417 | } | ||
1624 | 1418 | defer.resolve(false); | ||
1625 | 1355 | } else { | 1419 | } else { |
1627 | 1356 | defer.resolve(); | 1420 | var j = files.indexOf(file); |
1628 | 1421 | if (j > -1) files.splice(j, 1); | ||
1629 | 1422 | defer.resolve(true); | ||
1630 | 1357 | } | 1423 | } |
1631 | 1424 | } else { | ||
1632 | 1425 | defer.resolve(true); | ||
1633 | 1426 | } | ||
1634 | 1427 | } | ||
1635 | 1428 | |||
1636 | 1429 | if (val != null) { | ||
1637 | 1430 | asyncFn(file, val).then(function (d) { | ||
1638 | 1431 | resolveInternal(function () { | ||
1639 | 1432 | return !fn(d, val); | ||
1640 | 1433 | }); | ||
1641 | 1358 | }, function () { | 1434 | }, function () { |
1650 | 1359 | if (attrGetter('ngfValidateForce', {$file: file})) { | 1435 | resolveInternal(function () { |
1651 | 1360 | file.$error = name; | 1436 | return attrGetter('ngfValidateForce', {$file: file}); |
1652 | 1361 | (file.$errorMessages = (file.$errorMessages || {}))[name] = true; | 1437 | }); |
1645 | 1362 | file.$errorParam = val; | ||
1646 | 1363 | defer.reject(); | ||
1647 | 1364 | } else { | ||
1648 | 1365 | defer.resolve(); | ||
1649 | 1366 | } | ||
1653 | 1367 | }); | 1438 | }); |
1654 | 1368 | } else { | 1439 | } else { |
1656 | 1369 | defer.resolve(); | 1440 | defer.resolve(true); |
1657 | 1370 | } | 1441 | } |
1658 | 1371 | } | 1442 | } |
1659 | 1372 | 1443 | ||
1661 | 1373 | var promises = [upload.emptyPromise()]; | 1444 | var promises = [upload.emptyPromise(true)]; |
1662 | 1374 | if (files) { | 1445 | if (files) { |
1663 | 1375 | files = files.length === undefined ? [files] : files; | 1446 | files = files.length === undefined ? [files] : files; |
1664 | 1376 | angular.forEach(files, function (file) { | 1447 | angular.forEach(files, function (file) { |
1665 | 1377 | var defer = $q.defer(); | 1448 | var defer = $q.defer(); |
1666 | 1378 | promises.push(defer.promise); | 1449 | promises.push(defer.promise); |
1667 | 1379 | if (type && (file.type == null || file.type.search(type) !== 0)) { | 1450 | if (type && (file.type == null || file.type.search(type) !== 0)) { |
1669 | 1380 | defer.resolve(); | 1451 | defer.resolve(true); |
1670 | 1381 | return; | 1452 | return; |
1671 | 1382 | } | 1453 | } |
1672 | 1383 | if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) { | 1454 | if (name === 'dimensions' && upload.attrGetter('ngfDimensions', attr) != null) { |
1673 | @@ -1385,96 +1456,120 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
1674 | 1385 | resolveResult(defer, file, | 1456 | resolveResult(defer, file, |
1675 | 1386 | attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height})); | 1457 | attrGetter('ngfDimensions', {$file: file, $width: d.width, $height: d.height})); |
1676 | 1387 | }, function () { | 1458 | }, function () { |
1678 | 1388 | defer.reject(); | 1459 | defer.resolve(false); |
1679 | 1389 | }); | 1460 | }); |
1680 | 1390 | } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) { | 1461 | } else if (name === 'duration' && upload.attrGetter('ngfDuration', attr) != null) { |
1681 | 1391 | upload.mediaDuration(file).then(function (d) { | 1462 | upload.mediaDuration(file).then(function (d) { |
1682 | 1392 | resolveResult(defer, file, | 1463 | resolveResult(defer, file, |
1683 | 1393 | attrGetter('ngfDuration', {$file: file, $duration: d})); | 1464 | attrGetter('ngfDuration', {$file: file, $duration: d})); |
1684 | 1394 | }, function () { | 1465 | }, function () { |
1686 | 1395 | defer.reject(); | 1466 | defer.resolve(false); |
1687 | 1396 | }); | 1467 | }); |
1688 | 1397 | } else { | 1468 | } else { |
1689 | 1398 | resolveResult(defer, file, | 1469 | resolveResult(defer, file, |
1690 | 1399 | upload.getValidationAttr(attr, scope, name, validationName, file)); | 1470 | upload.getValidationAttr(attr, scope, name, validationName, file)); |
1691 | 1400 | } | 1471 | } |
1692 | 1401 | }); | 1472 | }); |
1693 | 1402 | return $q.all(promises).then(function () { | ||
1694 | 1403 | ngModel.$ngfValidations.push({name: name, valid: true}); | ||
1695 | 1404 | }, function () { | ||
1696 | 1405 | ngModel.$ngfValidations.push({name: name, valid: false}); | ||
1697 | 1406 | }); | ||
1698 | 1407 | } | 1473 | } |
1699 | 1474 | var deffer = $q.defer(); | ||
1700 | 1475 | $q.all(promises).then(function (values) { | ||
1701 | 1476 | var isValid = true; | ||
1702 | 1477 | for (var i = 0; i < values.length; i++) { | ||
1703 | 1478 | if (!values[i]) { | ||
1704 | 1479 | isValid = false; | ||
1705 | 1480 | break; | ||
1706 | 1481 | } | ||
1707 | 1482 | } | ||
1708 | 1483 | ngModel.$ngfValidations.push({name: name, valid: isValid}); | ||
1709 | 1484 | deffer.resolve(isValid); | ||
1710 | 1485 | }); | ||
1711 | 1486 | return deffer.promise; | ||
1712 | 1408 | } | 1487 | } |
1713 | 1409 | 1488 | ||
1714 | 1410 | var deffer = $q.defer(); | 1489 | var deffer = $q.defer(); |
1715 | 1411 | var promises = []; | 1490 | var promises = []; |
1716 | 1412 | 1491 | ||
1718 | 1413 | promises.push(upload.happyPromise(validateAsync('maxHeight', 'height.max', /image/, | 1492 | promises.push(validateAsync('maxHeight', 'height.max', /image/, |
1719 | 1414 | this.imageDimensions, function (d, val) { | 1493 | this.imageDimensions, function (d, val) { |
1720 | 1415 | return d.height <= val; | 1494 | return d.height <= val; |
1723 | 1416 | }))); | 1495 | })); |
1724 | 1417 | promises.push(upload.happyPromise(validateAsync('minHeight', 'height.min', /image/, | 1496 | promises.push(validateAsync('minHeight', 'height.min', /image/, |
1725 | 1418 | this.imageDimensions, function (d, val) { | 1497 | this.imageDimensions, function (d, val) { |
1726 | 1419 | return d.height >= val; | 1498 | return d.height >= val; |
1729 | 1420 | }))); | 1499 | })); |
1730 | 1421 | promises.push(upload.happyPromise(validateAsync('maxWidth', 'width.max', /image/, | 1500 | promises.push(validateAsync('maxWidth', 'width.max', /image/, |
1731 | 1422 | this.imageDimensions, function (d, val) { | 1501 | this.imageDimensions, function (d, val) { |
1732 | 1423 | return d.width <= val; | 1502 | return d.width <= val; |
1735 | 1424 | }))); | 1503 | })); |
1736 | 1425 | promises.push(upload.happyPromise(validateAsync('minWidth', 'width.min', /image/, | 1504 | promises.push(validateAsync('minWidth', 'width.min', /image/, |
1737 | 1426 | this.imageDimensions, function (d, val) { | 1505 | this.imageDimensions, function (d, val) { |
1738 | 1427 | return d.width >= val; | 1506 | return d.width >= val; |
1741 | 1428 | }))); | 1507 | })); |
1742 | 1429 | promises.push(upload.happyPromise(validateAsync('dimensions', null, /image/, | 1508 | promises.push(validateAsync('dimensions', null, /image/, |
1743 | 1430 | function (file, val) { | 1509 | function (file, val) { |
1744 | 1431 | return upload.emptyPromise(val); | 1510 | return upload.emptyPromise(val); |
1745 | 1432 | }, function (r) { | 1511 | }, function (r) { |
1746 | 1433 | return r; | 1512 | return r; |
1749 | 1434 | }))); | 1513 | })); |
1750 | 1435 | promises.push(upload.happyPromise(validateAsync('ratio', null, /image/, | 1514 | promises.push(validateAsync('ratio', null, /image/, |
1751 | 1436 | this.imageDimensions, function (d, val) { | 1515 | this.imageDimensions, function (d, val) { |
1752 | 1437 | var split = val.toString().split(','), valid = false; | 1516 | var split = val.toString().split(','), valid = false; |
1753 | 1438 | for (var i = 0; i < split.length; i++) { | 1517 | for (var i = 0; i < split.length; i++) { |
1755 | 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) { |
1756 | 1440 | valid = true; | 1519 | valid = true; |
1757 | 1441 | } | 1520 | } |
1758 | 1442 | } | 1521 | } |
1759 | 1443 | return valid; | 1522 | return valid; |
1762 | 1444 | }))); | 1523 | })); |
1763 | 1445 | promises.push(upload.happyPromise(validateAsync('maxRatio', 'ratio.max', /image/, | 1524 | promises.push(validateAsync('maxRatio', 'ratio.max', /image/, |
1764 | 1446 | this.imageDimensions, function (d, val) { | 1525 | this.imageDimensions, function (d, val) { |
1765 | 1447 | return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001; | 1526 | return (d.width / d.height) - upload.ratioToFloat(val) < 0.0001; |
1768 | 1448 | }))); | 1527 | })); |
1769 | 1449 | promises.push(upload.happyPromise(validateAsync('minRatio', 'ratio.min', /image/, | 1528 | promises.push(validateAsync('minRatio', 'ratio.min', /image/, |
1770 | 1450 | this.imageDimensions, function (d, val) { | 1529 | this.imageDimensions, function (d, val) { |
1771 | 1451 | return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001; | 1530 | return (d.width / d.height) - upload.ratioToFloat(val) > -0.0001; |
1774 | 1452 | }))); | 1531 | })); |
1775 | 1453 | promises.push(upload.happyPromise(validateAsync('maxDuration', 'duration.max', /audio|video/, | 1532 | promises.push(validateAsync('maxDuration', 'duration.max', /audio|video/, |
1776 | 1454 | this.mediaDuration, function (d, val) { | 1533 | this.mediaDuration, function (d, val) { |
1777 | 1455 | return d <= upload.translateScalars(val); | 1534 | return d <= upload.translateScalars(val); |
1780 | 1456 | }))); | 1535 | })); |
1781 | 1457 | promises.push(upload.happyPromise(validateAsync('minDuration', 'duration.min', /audio|video/, | 1536 | promises.push(validateAsync('minDuration', 'duration.min', /audio|video/, |
1782 | 1458 | this.mediaDuration, function (d, val) { | 1537 | this.mediaDuration, function (d, val) { |
1783 | 1459 | return d >= upload.translateScalars(val); | 1538 | return d >= upload.translateScalars(val); |
1786 | 1460 | }))); | 1539 | })); |
1787 | 1461 | promises.push(upload.happyPromise(validateAsync('duration', null, /audio|video/, | 1540 | promises.push(validateAsync('duration', null, /audio|video/, |
1788 | 1462 | function (file, val) { | 1541 | function (file, val) { |
1789 | 1463 | return upload.emptyPromise(val); | 1542 | return upload.emptyPromise(val); |
1790 | 1464 | }, function (r) { | 1543 | }, function (r) { |
1791 | 1465 | return r; | 1544 | return r; |
1793 | 1466 | }))); | 1545 | })); |
1794 | 1467 | 1546 | ||
1796 | 1468 | promises.push(upload.happyPromise(validateAsync('validateAsyncFn', null, null, | 1547 | promises.push(validateAsync('validateAsyncFn', null, null, |
1797 | 1469 | function (file, val) { | 1548 | function (file, val) { |
1798 | 1470 | return val; | 1549 | return val; |
1799 | 1471 | }, function (r) { | 1550 | }, function (r) { |
1800 | 1472 | return r === true || r === null || r === ''; | 1551 | return r === true || r === null || r === ''; |
1802 | 1473 | }))); | 1552 | })); |
1803 | 1553 | |||
1804 | 1554 | $q.all(promises).then(function () { | ||
1805 | 1555 | |||
1806 | 1556 | if (runAllValidation) { | ||
1807 | 1557 | for (var i = 0; i < files.length; i++) { | ||
1808 | 1558 | var file = files[i]; | ||
1809 | 1559 | if (file.$error) { | ||
1810 | 1560 | files.splice(i--, 1); | ||
1811 | 1561 | } | ||
1812 | 1562 | } | ||
1813 | 1563 | } | ||
1814 | 1564 | |||
1815 | 1565 | runAllValidation = false; | ||
1816 | 1566 | validateSync('maxFiles', null, function (file, val, i) { | ||
1817 | 1567 | return prevLength + i < val; | ||
1818 | 1568 | }); | ||
1819 | 1474 | 1569 | ||
1822 | 1475 | return $q.all(promises).then(function () { | 1570 | deffer.resolve({'validFiles': files, 'invalidFiles': invalidFiles}); |
1821 | 1476 | deffer.resolve(ngModel, ngModel.$ngfValidations); | ||
1823 | 1477 | }); | 1571 | }); |
1824 | 1572 | return deffer.promise; | ||
1825 | 1478 | }; | 1573 | }; |
1826 | 1479 | 1574 | ||
1827 | 1480 | upload.imageDimensions = function (file) { | 1575 | upload.imageDimensions = function (file) { |
1828 | @@ -1499,8 +1594,8 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
1829 | 1499 | .css('max-width', 'none !important').css('max-height', 'none !important'); | 1594 | .css('max-width', 'none !important').css('max-height', 'none !important'); |
1830 | 1500 | 1595 | ||
1831 | 1501 | function success() { | 1596 | function success() { |
1834 | 1502 | var width = img[0].clientWidth; | 1597 | var width = img[0].naturalWidth || img[0].clientWidth; |
1835 | 1503 | var height = img[0].clientHeight; | 1598 | var height = img[0].naturalHeight || img[0].clientHeight; |
1836 | 1504 | img.remove(); | 1599 | img.remove(); |
1837 | 1505 | file.$ngfWidth = width; | 1600 | file.$ngfWidth = width; |
1838 | 1506 | file.$ngfHeight = height; | 1601 | file.$ngfHeight = height; |
1839 | @@ -1514,23 +1609,23 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct | |||
1840 | 1514 | 1609 | ||
1841 | 1515 | img.on('load', success); | 1610 | img.on('load', success); |
1842 | 1516 | img.on('error', error); | 1611 | img.on('error', error); |
1843 | 1517 | var count = 0; | ||
1844 | 1518 | 1612 | ||
1846 | 1519 | function checkLoadError() { | 1613 | var secondsCounter = 0; |
1847 | 1614 | function checkLoadErrorInCaseOfNoCallback() { | ||
1848 | 1520 | $timeout(function () { | 1615 | $timeout(function () { |
1849 | 1521 | if (img[0].parentNode) { | 1616 | if (img[0].parentNode) { |
1850 | 1522 | if (img[0].clientWidth) { | 1617 | if (img[0].clientWidth) { |
1851 | 1523 | success(); | 1618 | success(); |
1853 | 1524 | } else if (count > 10) { | 1619 | } else if (secondsCounter++ > 10) { |
1854 | 1525 | error(); | 1620 | error(); |
1855 | 1526 | } else { | 1621 | } else { |
1857 | 1527 | checkLoadError(); | 1622 | checkLoadErrorInCaseOfNoCallback(); |
1858 | 1528 | } | 1623 | } |
1859 | 1529 | } | 1624 | } |
1860 | 1530 | }, 1000); | 1625 | }, 1000); |
1861 | 1531 | } | 1626 | } |
1862 | 1532 | 1627 | ||
1864 | 1533 | checkLoadError(); | 1628 | checkLoadErrorInCaseOfNoCallback(); |
1865 | 1534 | 1629 | ||
1866 | 1535 | angular.element(document.getElementsByTagName('body')[0]).append(img); | 1630 | angular.element(document.getElementsByTagName('body')[0]).append(img); |
1867 | 1536 | }, function () { | 1631 | }, function () { |
1868 | @@ -1641,31 +1736,35 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1869 | 1641 | var deferred = $q.defer(); | 1736 | var deferred = $q.defer(); |
1870 | 1642 | var canvasElement = document.createElement('canvas'); | 1737 | var canvasElement = document.createElement('canvas'); |
1871 | 1643 | var imageElement = document.createElement('img'); | 1738 | var imageElement = document.createElement('img'); |
1872 | 1739 | imageElement.setAttribute('style', 'visibility:hidden;position:fixed;z-index:-100000'); | ||
1873 | 1740 | document.body.appendChild(imageElement); | ||
1874 | 1644 | 1741 | ||
1875 | 1645 | imageElement.onload = function () { | 1742 | imageElement.onload = function () { |
1877 | 1646 | if (resizeIf != null && resizeIf(imageElement.width, imageElement.height) === false) { | 1743 | var imgWidth = imageElement.width, imgHeight = imageElement.height; |
1878 | 1744 | imageElement.parentNode.removeChild(imageElement); | ||
1879 | 1745 | if (resizeIf != null && resizeIf(imgWidth, imgHeight) === false) { | ||
1880 | 1647 | deferred.reject('resizeIf'); | 1746 | deferred.reject('resizeIf'); |
1881 | 1648 | return; | 1747 | return; |
1882 | 1649 | } | 1748 | } |
1883 | 1650 | try { | 1749 | try { |
1884 | 1651 | if (ratio) { | 1750 | if (ratio) { |
1885 | 1652 | var ratioFloat = upload.ratioToFloat(ratio); | 1751 | var ratioFloat = upload.ratioToFloat(ratio); |
1887 | 1653 | var imgRatio = imageElement.width / imageElement.height; | 1752 | var imgRatio = imgWidth / imgHeight; |
1888 | 1654 | if (imgRatio < ratioFloat) { | 1753 | if (imgRatio < ratioFloat) { |
1890 | 1655 | width = imageElement.width; | 1754 | width = imgWidth; |
1891 | 1656 | height = width / ratioFloat; | 1755 | height = width / ratioFloat; |
1892 | 1657 | } else { | 1756 | } else { |
1894 | 1658 | height = imageElement.height; | 1757 | height = imgHeight; |
1895 | 1659 | width = height * ratioFloat; | 1758 | width = height * ratioFloat; |
1896 | 1660 | } | 1759 | } |
1897 | 1661 | } | 1760 | } |
1898 | 1662 | if (!width) { | 1761 | if (!width) { |
1900 | 1663 | width = imageElement.width; | 1762 | width = imgWidth; |
1901 | 1664 | } | 1763 | } |
1902 | 1665 | if (!height) { | 1764 | if (!height) { |
1904 | 1666 | height = imageElement.height; | 1765 | height = imgHeight; |
1905 | 1667 | } | 1766 | } |
1907 | 1668 | var dimensions = calculateAspectRatioFit(imageElement.width, imageElement.height, width, height, centerCrop); | 1767 | var dimensions = calculateAspectRatioFit(imgWidth, imgHeight, width, height, centerCrop); |
1908 | 1669 | canvasElement.width = Math.min(dimensions.width, width); | 1768 | canvasElement.width = Math.min(dimensions.width, width); |
1909 | 1670 | canvasElement.height = Math.min(dimensions.height, height); | 1769 | canvasElement.height = Math.min(dimensions.height, height); |
1910 | 1671 | var context = canvasElement.getContext('2d'); | 1770 | var context = canvasElement.getContext('2d'); |
1911 | @@ -1678,6 +1777,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1912 | 1678 | } | 1777 | } |
1913 | 1679 | }; | 1778 | }; |
1914 | 1680 | imageElement.onerror = function () { | 1779 | imageElement.onerror = function () { |
1915 | 1780 | imageElement.parentNode.removeChild(imageElement); | ||
1916 | 1681 | deferred.reject(); | 1781 | deferred.reject(); |
1917 | 1682 | }; | 1782 | }; |
1918 | 1683 | imageElement.src = imagen; | 1783 | imageElement.src = imagen; |
1919 | @@ -1714,14 +1814,15 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1920 | 1714 | }); | 1814 | }); |
1921 | 1715 | } | 1815 | } |
1922 | 1716 | 1816 | ||
1924 | 1717 | upload.resize = function (file, width, height, quality, type, ratio, centerCrop, resizeIf, restoreExif) { | 1817 | upload.resize = function (file, options) { |
1925 | 1718 | if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file); | 1818 | if (file.type.indexOf('image') !== 0) return upload.emptyPromise(file); |
1926 | 1719 | 1819 | ||
1927 | 1720 | var deferred = $q.defer(); | 1820 | var deferred = $q.defer(); |
1928 | 1721 | upload.dataUrl(file, true).then(function (url) { | 1821 | upload.dataUrl(file, true).then(function (url) { |
1930 | 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, |
1931 | 1823 | options.ratio, options.centerCrop, options.resizeIf) | ||
1932 | 1723 | .then(function (dataUrl) { | 1824 | .then(function (dataUrl) { |
1934 | 1724 | if (file.type === 'image/jpeg' && restoreExif) { | 1825 | if (file.type === 'image/jpeg' && options.restoreExif !== false) { |
1935 | 1725 | try { | 1826 | try { |
1936 | 1726 | dataUrl = upload.restoreExif(url, dataUrl); | 1827 | dataUrl = upload.restoreExif(url, dataUrl); |
1937 | 1727 | } catch (e) { | 1828 | } catch (e) { |
1938 | @@ -1750,13 +1851,13 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1939 | 1750 | }]); | 1851 | }]); |
1940 | 1751 | 1852 | ||
1941 | 1752 | (function () { | 1853 | (function () { |
1944 | 1753 | ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$location', 'Upload', '$http', '$q', | 1854 | ngFileUpload.directive('ngfDrop', ['$parse', '$timeout', '$window', 'Upload', '$http', '$q', |
1945 | 1754 | function ($parse, $timeout, $location, Upload, $http, $q) { | 1855 | function ($parse, $timeout, $window, Upload, $http, $q) { |
1946 | 1755 | return { | 1856 | return { |
1947 | 1756 | restrict: 'AEC', | 1857 | restrict: 'AEC', |
1948 | 1757 | require: '?ngModel', | 1858 | require: '?ngModel', |
1949 | 1758 | link: function (scope, elem, attr, ngModel) { | 1859 | link: function (scope, elem, attr, ngModel) { |
1951 | 1759 | linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $location, Upload, $http, $q); | 1860 | linkDrop(scope, elem, attr, ngModel, $parse, $timeout, $window, Upload, $http, $q); |
1952 | 1760 | } | 1861 | } |
1953 | 1761 | }; | 1862 | }; |
1954 | 1762 | }]); | 1863 | }]); |
1955 | @@ -1781,7 +1882,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1956 | 1781 | }; | 1882 | }; |
1957 | 1782 | }]); | 1883 | }]); |
1958 | 1783 | 1884 | ||
1960 | 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) { |
1961 | 1785 | var available = dropAvailable(); | 1886 | var available = dropAvailable(); |
1962 | 1786 | 1887 | ||
1963 | 1787 | var attrGetter = function (name, scope, params) { | 1888 | var attrGetter = function (name, scope, params) { |
1964 | @@ -1857,23 +1958,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1965 | 1857 | if (stopPropagation(scope)) evt.stopPropagation(); | 1958 | if (stopPropagation(scope)) evt.stopPropagation(); |
1966 | 1858 | if (actualDragOverClass) elem.removeClass(actualDragOverClass); | 1959 | if (actualDragOverClass) elem.removeClass(actualDragOverClass); |
1967 | 1859 | actualDragOverClass = null; | 1960 | actualDragOverClass = null; |
1985 | 1860 | var items = evt.dataTransfer.items; | 1961 | extractFilesAndUpdateModel(evt.dataTransfer, evt, 'dropUrl'); |
1969 | 1861 | var html; | ||
1970 | 1862 | try { | ||
1971 | 1863 | html = evt.dataTransfer && evt.dataTransfer.getData && evt.dataTransfer.getData('text/html'); | ||
1972 | 1864 | } catch (e) {/* Fix IE11 that throw error calling getData */ | ||
1973 | 1865 | } | ||
1974 | 1866 | |||
1975 | 1867 | extractFiles(items, evt.dataTransfer.files, attrGetter('ngfAllowDir', scope) !== false, | ||
1976 | 1868 | attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) { | ||
1977 | 1869 | if (files.length) { | ||
1978 | 1870 | updateModel(files, evt); | ||
1979 | 1871 | } else { | ||
1980 | 1872 | extractFilesFromHtml('dropUrl', html).then(function (files) { | ||
1981 | 1873 | updateModel(files, evt); | ||
1982 | 1874 | }); | ||
1983 | 1875 | } | ||
1984 | 1876 | }); | ||
1986 | 1877 | }, false); | 1962 | }, false); |
1987 | 1878 | elem[0].addEventListener('paste', function (evt) { | 1963 | elem[0].addEventListener('paste', function (evt) { |
1988 | 1879 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && | 1964 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && |
1989 | @@ -1881,22 +1966,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
1990 | 1881 | evt.preventDefault(); | 1966 | evt.preventDefault(); |
1991 | 1882 | } | 1967 | } |
1992 | 1883 | if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return; | 1968 | if (isDisabled() || !upload.shouldUpdateOn('paste', attr, scope)) return; |
2009 | 1884 | var files = []; | 1969 | extractFilesAndUpdateModel(evt.clipboardData || evt.originalEvent.clipboardData, evt, 'pasteUrl'); |
1994 | 1885 | var clipboard = evt.clipboardData || evt.originalEvent.clipboardData; | ||
1995 | 1886 | if (clipboard && clipboard.items) { | ||
1996 | 1887 | for (var k = 0; k < clipboard.items.length; k++) { | ||
1997 | 1888 | if (clipboard.items[k].type.indexOf('image') !== -1) { | ||
1998 | 1889 | files.push(clipboard.items[k].getAsFile()); | ||
1999 | 1890 | } | ||
2000 | 1891 | } | ||
2001 | 1892 | } | ||
2002 | 1893 | if (files.length) { | ||
2003 | 1894 | updateModel(files, evt); | ||
2004 | 1895 | } else { | ||
2005 | 1896 | extractFilesFromHtml('pasteUrl', clipboard).then(function (files) { | ||
2006 | 1897 | updateModel(files, evt); | ||
2007 | 1898 | }); | ||
2008 | 1899 | } | ||
2010 | 1900 | }, false); | 1970 | }, false); |
2011 | 1901 | 1971 | ||
2012 | 1902 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && | 1972 | if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && |
2013 | @@ -1909,12 +1979,33 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
2014 | 1909 | }); | 1979 | }); |
2015 | 1910 | } | 1980 | } |
2016 | 1911 | 1981 | ||
2017 | 1982 | function extractFilesAndUpdateModel(source, evt, updateOnType) { | ||
2018 | 1983 | if (!source) return; | ||
2019 | 1984 | // html needs to be calculated on the same process otherwise the data will be wiped | ||
2020 | 1985 | // after promise resolve or setTimeout. | ||
2021 | 1986 | var html; | ||
2022 | 1987 | try { | ||
2023 | 1988 | html = source && source.getData && source.getData('text/html'); | ||
2024 | 1989 | } catch (e) {/* Fix IE11 that throw error calling getData */ | ||
2025 | 1990 | } | ||
2026 | 1991 | extractFiles(source.items, source.files, attrGetter('ngfAllowDir', scope) !== false, | ||
2027 | 1992 | attrGetter('multiple') || attrGetter('ngfMultiple', scope)).then(function (files) { | ||
2028 | 1993 | if (files.length) { | ||
2029 | 1994 | updateModel(files, evt); | ||
2030 | 1995 | } else { | ||
2031 | 1996 | extractFilesFromHtml(updateOnType, html).then(function (files) { | ||
2032 | 1997 | updateModel(files, evt); | ||
2033 | 1998 | }); | ||
2034 | 1999 | } | ||
2035 | 2000 | }); | ||
2036 | 2001 | } | ||
2037 | 2002 | |||
2038 | 1912 | function updateModel(files, evt) { | 2003 | function updateModel(files, evt) { |
2039 | 1913 | upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt); | 2004 | upload.updateModel(ngModel, attr, scope, attrGetter('ngfChange') || attrGetter('ngfDrop'), files, evt); |
2040 | 1914 | } | 2005 | } |
2041 | 1915 | 2006 | ||
2042 | 1916 | function extractFilesFromHtml(updateOn, html) { | 2007 | function extractFilesFromHtml(updateOn, html) { |
2044 | 1917 | if (!upload.shouldUpdateOn(updateOn, attr, scope) || !html) return upload.rejectPromise([]); | 2008 | if (!upload.shouldUpdateOn(updateOn, attr, scope) || typeof html !== 'string') return upload.rejectPromise([]); |
2045 | 1918 | var urls = []; | 2009 | var urls = []; |
2046 | 1919 | html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) { | 2010 | html.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (m, n, src) { |
2047 | 1920 | urls.push(src); | 2011 | urls.push(src); |
2048 | @@ -1965,8 +2056,14 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
2049 | 1965 | } | 2056 | } |
2050 | 1966 | 2057 | ||
2051 | 1967 | function extractFiles(items, fileList, allowDir, multiple) { | 2058 | function extractFiles(items, fileList, allowDir, multiple) { |
2054 | 1968 | var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles') || Number.MAX_VALUE; | 2059 | var maxFiles = upload.getValidationAttr(attr, scope, 'maxFiles'); |
2055 | 1969 | var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize') || Number.MAX_VALUE; | 2060 | if (maxFiles == null) { |
2056 | 2061 | maxFiles = Number.MAX_VALUE; | ||
2057 | 2062 | } | ||
2058 | 2063 | var maxTotalSize = upload.getValidationAttr(attr, scope, 'maxTotalSize'); | ||
2059 | 2064 | if (maxTotalSize == null) { | ||
2060 | 2065 | maxTotalSize = Number.MAX_VALUE; | ||
2061 | 2066 | } | ||
2062 | 1970 | var includeDir = attrGetter('ngfIncludeDir', scope); | 2067 | var includeDir = attrGetter('ngfIncludeDir', scope); |
2063 | 1971 | var files = [], totalSize = 0; | 2068 | var files = [], totalSize = 0; |
2064 | 1972 | 2069 | ||
2065 | @@ -1977,7 +2074,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
2066 | 1977 | var promises = [upload.emptyPromise()]; | 2074 | var promises = [upload.emptyPromise()]; |
2067 | 1978 | if (includeDir) { | 2075 | if (includeDir) { |
2068 | 1979 | var file = {type: 'directory'}; | 2076 | var file = {type: 'directory'}; |
2070 | 1980 | file.name = file.path = (path || '') + entry.name + entry.name; | 2077 | file.name = file.path = (path || '') + entry.name; |
2071 | 1981 | files.push(file); | 2078 | files.push(file); |
2072 | 1982 | } | 2079 | } |
2073 | 1983 | var dirReader = entry.createReader(); | 2080 | var dirReader = entry.createReader(); |
2074 | @@ -2031,7 +2128,7 @@ ngFileUpload.service('UploadResize', ['UploadValidate', '$q', function (UploadVa | |||
2075 | 2031 | 2128 | ||
2076 | 2032 | var promises = [upload.emptyPromise()]; | 2129 | var promises = [upload.emptyPromise()]; |
2077 | 2033 | 2130 | ||
2079 | 2034 | if (items && items.length > 0 && $location.protocol() !== 'file') { | 2131 | if (items && items.length > 0 && $window.location.protocol !== 'file:') { |
2080 | 2035 | for (var i = 0; i < items.length; i++) { | 2132 | for (var i = 0; i < items.length; i++) { |
2081 | 2036 | if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) { | 2133 | if (items[i].webkitGetAsEntry && items[i].webkitGetAsEntry() && items[i].webkitGetAsEntry().isDirectory) { |
2082 | 2037 | var entry = items[i].webkitGetAsEntry(); | 2134 | var entry = items[i].webkitGetAsEntry(); |
2083 | diff --git a/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js b/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js | |||
2084 | index e87a65e..4bfe942 100644 | |||
2085 | --- a/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js | |||
2086 | +++ b/xstatic/pkg/angular_fileupload/data/ng-file-upload.min.js | |||
2087 | @@ -1,3 +1,3 @@ | |||
2088 | 1 | /*! 12.0.4 */ | ||
2089 | 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){ | ||
2090 | 3 | return{restrict:"AEC",require:"?ngModel",link:function(h,i,j,k){a(h,i,j,k,b,c,d,e,f,g)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(a,c,d){return function(e,f,g){if(b()){var h=a(d.attrGetter("ngfDropAvailable",g));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(),ngFileUpload.service("UploadExif",["UploadResize","$q",function(a,b){function c(a,b,c,d){switch(b){case 2:return a.transform(-1,0,0,1,c,0);case 3:return a.transform(-1,0,0,-1,c,d);case 4:return a.transform(1,0,0,-1,0,d);case 5:return a.transform(0,1,1,0,0,0);case 6:return a.transform(0,1,-1,0,d,0);case 7:return a.transform(0,-1,-1,0,d,c);case 8:return a.transform(0,-1,1,0,0,c)}}function d(a){for(var b="",c=new Uint8Array(a),d=c.byteLength,e=0;d>e;e++)b+=String.fromCharCode(c[e]);return window.btoa(b)}var e=a;return e.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&e.isResizeSupported()},e.readOrientation=function(a){var c=b.defer(),d=new FileReader,e=a.slice?a.slice(0,65536):a;return d.readAsArrayBuffer(e),d.onerror=function(a){return c.reject(a)},d.onload=function(a){var b={orientation:1},d=new DataView(this.result);if(65496!==d.getUint16(0,!1))return c.resolve(b);for(var e=d.byteLength,f=2;e>f;){var g=d.getUint16(f,!1);if(f+=2,65505===g){if(1165519206!==d.getUint32(f+=2,!1))return c.resolve(b);var h=18761===d.getUint16(f+=6,!1);f+=d.getUint32(f+4,h);var i=d.getUint16(f,h);f+=2;for(var j=0;i>j;j++)if(274===d.getUint16(f+12*j,h)){var k=d.getUint16(f+12*j+8,h);return k>=2&&8>=k&&(d.setUint16(f+12*j+8,1,h),b.fixedArrayBuffer=a.target.result),b.orientation=k,c.resolve(b)}}else{if(65280!==(65280&g))break;f+=d.getUint16(f,!1)}}return c.resolve(b)},c.promise},e.applyExifRotation=function(a){if(0!==a.type.indexOf("image/jpeg"))return e.emptyPromise(a);var f=b.defer();return e.readOrientation(a).then(function(b){return b.orientation<2||b.orientation>8?f.resolve(a):void e.dataUrl(a,!0).then(function(g){var h=document.createElement("canvas"),i=document.createElement("img");i.onload=function(){try{h.width=b.orientation>4?i.height:i.width,h.height=b.orientation>4?i.width:i.height;var g=h.getContext("2d");c(g,b.orientation,i.width,i.height),g.drawImage(i,0,0);var j=h.toDataURL(a.type||"image/WebP",.934);j=e.restoreExif(d(b.fixedArrayBuffer),j);var k=e.dataUrltoBlob(j,a.name);f.resolve(k)}catch(l){return f.reject(l)}},i.onerror=function(){f.reject()},i.src=g},function(a){f.reject(a)})},function(a){f.reject(a)}),f.promise},e.restoreExif=function(a,b){var c={};return c.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c.encode64=function(a){var b,c,d,e,f,g="",h="",i="",j=0;do b=a[j++],c=a[j++],h=a[j++],d=b>>2,e=(3&b)<<4|c>>4,f=(15&c)<<2|h>>6,i=63&h,isNaN(c)?f=i=64:isNaN(h)&&(i=64),g=g+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(e)+this.KEY_STR.charAt(f)+this.KEY_STR.charAt(i),b=c=h="",d=e=f=i="";while(j<a.length);return g},c.restore=function(a,b){a.match("data:image/jpeg;base64,")&&(a=a.replace("data:image/jpeg;base64,",""));var c=this.decode64(a),d=this.slice2Segments(c),e=this.exifManipulation(b,d);return"data:image/jpeg;base64,"+this.encode64(e)},c.exifManipulation=function(a,b){var c=this.getExifArray(b),d=this.insertExif(a,c);return new Uint8Array(d)},c.getExifArray=function(a){for(var b,c=0;c<a.length;c++)if(b=a[c],255===b[0]&225===b[1])return b;return[]},c.insertExif=function(a,b){var c=a.replace("data:image/jpeg;base64,",""),d=this.decode64(c),e=d.indexOf(255,3),f=d.slice(0,e),g=d.slice(e),h=f;return h=h.concat(b),h=h.concat(g)},c.slice2Segments=function(a){for(var b=0,c=[];;){if(255===a[b]&218===a[b+1])break;if(255===a[b]&216===a[b+1])b+=2;else{var d=256*a[b+2]+a[b+3],e=b+d+2,f=a.slice(b,e);c.push(f),b=e}if(b>a.length)break}return c},c.decode64=function(a){var b,c,d,e,f,g="",h="",i=0,j=[],k=/[^A-Za-z0-9\+\/\=]/g;k.exec(a)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."),a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do d=this.KEY_STR.indexOf(a.charAt(i++)),e=this.KEY_STR.indexOf(a.charAt(i++)),f=this.KEY_STR.indexOf(a.charAt(i++)),h=this.KEY_STR.indexOf(a.charAt(i++)),b=d<<2|e>>4,c=(15&e)<<4|f>>2,g=(3&f)<<6|h,j.push(b),64!==f&&j.push(c),64!==h&&j.push(g),b=c=g="",d=e=f=h="";while(i<a.length);return j},c.restore(a,b)},e}]); | ||
2091 | 4 | \ No newline at end of file | 1 | \ No newline at end of file |
2092 | 2 | /*! 12.2.13 */ | ||
2093 | 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(), | ||
2094 | 4 | v(a)&&b.stopPropagation(),u=g(function(){t&&c.removeClass(t),t=null,s("ngfDrag",a,{$isDragging:!1,$event:b})},w||100))},!1),c[0].addEventListener("drop",function(b){!l()&&i.shouldUpdateOn("drop",d,a)&&(b.preventDefault(),v(a)&&b.stopPropagation(),t&&c.removeClass(t),t=null,m(b.dataTransfer,b,"dropUrl"))},!1),c[0].addEventListener("paste",function(b){navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&s("ngfEnableFirefoxPaste",a)&&b.preventDefault(),!l()&&i.shouldUpdateOn("paste",d,a)&&m(b.clipboardData||b.originalEvent.clipboardData,b,"pasteUrl")},!1),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&s("ngfEnableFirefoxPaste",a)&&(c.attr("contenteditable",!0),c.on("keypress",function(a){a.metaKey||a.ctrlKey||a.preventDefault()}))}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a&&!/Edge\/12./i.test(navigator.userAgent)}ngFileUpload.directive("ngfDrop",["$parse","$timeout","$window","Upload","$http","$q",function(b,c,d,e,f,g){return{restrict:"AEC",require:"?ngModel",link:function(h,i,j,k){a(h,i,j,k,b,c,d,e,f,g)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(a,c,d){return function(e,f,g){if(b()){var h=a(d.attrGetter("ngfDropAvailable",g));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(),ngFileUpload.service("UploadExif",["UploadResize","$q",function(a,b){function c(a,b,c,d){switch(b){case 2:return a.transform(-1,0,0,1,c,0);case 3:return a.transform(-1,0,0,-1,c,d);case 4:return a.transform(1,0,0,-1,0,d);case 5:return a.transform(0,1,1,0,0,0);case 6:return a.transform(0,1,-1,0,d,0);case 7:return a.transform(0,-1,-1,0,d,c);case 8:return a.transform(0,-1,1,0,0,c)}}function d(a){for(var b="",c=new Uint8Array(a),d=c.byteLength,e=0;d>e;e++)b+=String.fromCharCode(c[e]);return window.btoa(b)}var e=a;return e.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&e.isResizeSupported()},e.readOrientation=function(a){var c=b.defer(),d=new FileReader,e=a.slice?a.slice(0,65536):a;return d.readAsArrayBuffer(e),d.onerror=function(a){return c.reject(a)},d.onload=function(a){var b={orientation:1},d=new DataView(this.result);if(65496!==d.getUint16(0,!1))return c.resolve(b);for(var e=d.byteLength,f=2;e>f;){var g=d.getUint16(f,!1);if(f+=2,65505===g){if(1165519206!==d.getUint32(f+=2,!1))return c.resolve(b);var h=18761===d.getUint16(f+=6,!1);f+=d.getUint32(f+4,h);var i=d.getUint16(f,h);f+=2;for(var j=0;i>j;j++)if(274===d.getUint16(f+12*j,h)){var k=d.getUint16(f+12*j+8,h);return k>=2&&8>=k&&(d.setUint16(f+12*j+8,1,h),b.fixedArrayBuffer=a.target.result),b.orientation=k,c.resolve(b)}}else{if(65280!==(65280&g))break;f+=d.getUint16(f,!1)}}return c.resolve(b)},c.promise},e.applyExifRotation=function(a){if(0!==a.type.indexOf("image/jpeg"))return e.emptyPromise(a);var f=b.defer();return e.readOrientation(a).then(function(b){return b.orientation<2||b.orientation>8?f.resolve(a):void e.dataUrl(a,!0).then(function(g){var h=document.createElement("canvas"),i=document.createElement("img");i.onload=function(){try{h.width=b.orientation>4?i.height:i.width,h.height=b.orientation>4?i.width:i.height;var g=h.getContext("2d");c(g,b.orientation,i.width,i.height),g.drawImage(i,0,0);var j=h.toDataURL(a.type||"image/WebP",.934);j=e.restoreExif(d(b.fixedArrayBuffer),j);var k=e.dataUrltoBlob(j,a.name);f.resolve(k)}catch(l){return f.reject(l)}},i.onerror=function(){f.reject()},i.src=g},function(a){f.reject(a)})},function(a){f.reject(a)}),f.promise},e.restoreExif=function(a,b){var c={};return c.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c.encode64=function(a){var b,c,d,e,f,g="",h="",i="",j=0;do b=a[j++],c=a[j++],h=a[j++],d=b>>2,e=(3&b)<<4|c>>4,f=(15&c)<<2|h>>6,i=63&h,isNaN(c)?f=i=64:isNaN(h)&&(i=64),g=g+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(e)+this.KEY_STR.charAt(f)+this.KEY_STR.charAt(i),b=c=h="",d=e=f=i="";while(j<a.length);return g},c.restore=function(a,b){a.match("data:image/jpeg;base64,")&&(a=a.replace("data:image/jpeg;base64,",""));var c=this.decode64(a),d=this.slice2Segments(c),e=this.exifManipulation(b,d);return"data:image/jpeg;base64,"+this.encode64(e)},c.exifManipulation=function(a,b){var c=this.getExifArray(b),d=this.insertExif(a,c);return new Uint8Array(d)},c.getExifArray=function(a){for(var b,c=0;c<a.length;c++)if(b=a[c],255===b[0]&225===b[1])return b;return[]},c.insertExif=function(a,b){var c=a.replace("data:image/jpeg;base64,",""),d=this.decode64(c),e=d.indexOf(255,3),f=d.slice(0,e),g=d.slice(e),h=f;return h=h.concat(b),h=h.concat(g)},c.slice2Segments=function(a){for(var b=0,c=[];;){if(255===a[b]&218===a[b+1])break;if(255===a[b]&216===a[b+1])b+=2;else{var d=256*a[b+2]+a[b+3],e=b+d+2,f=a.slice(b,e);c.push(f),b=e}if(b>a.length)break}return c},c.decode64=function(a){var b,c,d,e,f,g="",h="",i=0,j=[],k=/[^A-Za-z0-9\+\/\=]/g;k.exec(a)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."),a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do d=this.KEY_STR.indexOf(a.charAt(i++)),e=this.KEY_STR.indexOf(a.charAt(i++)),f=this.KEY_STR.indexOf(a.charAt(i++)),h=this.KEY_STR.indexOf(a.charAt(i++)),b=d<<2|e>>4,c=(15&e)<<4|f>>2,g=(3&f)<<6|h,j.push(b),64!==f&&j.push(c),64!==h&&j.push(g),b=c=g="",d=e=f=h="";while(i<a.length);return j},c.restore(a,b)},e}]); | ||
2095 | 5 | \ No newline at end of file | 5 | \ No newline at end of file |
2096 | diff --git a/xstatic/pkg/angular_lrdragndrop/__init__.py b/xstatic/pkg/angular_lrdragndrop/__init__.py | |||
2097 | index cf9508f..206ee6a 100644 | |||
2098 | --- a/xstatic/pkg/angular_lrdragndrop/__init__.py | |||
2099 | +++ b/xstatic/pkg/angular_lrdragndrop/__init__.py | |||
2100 | @@ -17,7 +17,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar') | |||
2101 | 17 | 17 | ||
2102 | 18 | VERSION = '1.0.2' # version of the packaged files, please use the upstream | 18 | VERSION = '1.0.2' # version of the packaged files, please use the upstream |
2103 | 19 | # version number | 19 | # version number |
2105 | 20 | BUILD = '4' # our package build number, so we can release new builds | 20 | BUILD = '6' # our package build number, so we can release new builds |
2106 | 21 | # with fixes for xstatic stuff. | 21 | # with fixes for xstatic stuff. |
2107 | 22 | PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi | 22 | PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi |
2108 | 23 | 23 | ||
2109 | diff --git a/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js b/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js | |||
2110 | index 2b7c383..ce54176 100644 | |||
2111 | --- a/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js | |||
2112 | +++ b/xstatic/pkg/angular_lrdragndrop/data/lrdragndrop.js | |||
2113 | @@ -2,11 +2,21 @@ | |||
2114 | 2 | 'use strict'; | 2 | 'use strict'; |
2115 | 3 | 3 | ||
2116 | 4 | function isJqueryEventDataTransfer(){ | 4 | function isJqueryEventDataTransfer(){ |
2118 | 5 | return window.jQuery && (-1 == window.jQuery.event.props.indexOf('dataTransfer')); | 5 | return window.jQuery && (!window.jQuery.event.special.dataTransfer || |
2119 | 6 | !window.jQuery.event.special.dataTransfer.props || -1 === | ||
2120 | 7 | window.jQuery.event.special.dataTransfer.props.indexOf('dataTransfer')); | ||
2121 | 6 | } | 8 | } |
2122 | 7 | 9 | ||
2123 | 8 | if (isJqueryEventDataTransfer()) { | 10 | if (isJqueryEventDataTransfer()) { |
2125 | 9 | window.jQuery.event.props.push('dataTransfer'); | 11 | if (!window.jQuery.event.special.dataTransfer) { |
2126 | 12 | window.jQuery.event.special.dataTransfer = { | ||
2127 | 13 | props: ['dataTransfer'] | ||
2128 | 14 | }; | ||
2129 | 15 | } else if (!window.jQuery.event.special.dataTransfer.props) { | ||
2130 | 16 | window.jQuery.event.special.dataTransfer.props = ['dataTransfer']; | ||
2131 | 17 | } else if (-1 === window.jQuery.event.special.dataTransfer.props.indexOf('dataTransfer')) { | ||
2132 | 18 | window.jQuery.event.special.dataTransfer.props.push('dataTransfer'); | ||
2133 | 19 | } | ||
2134 | 10 | } | 20 | } |
2135 | 11 | 21 | ||
2136 | 12 | var module = ng.module('lrDragNDrop', []); | 22 | var module = ng.module('lrDragNDrop', []); |
2137 | @@ -181,4 +191,4 @@ | |||
2138 | 181 | } | 191 | } |
2139 | 182 | }; | 192 | }; |
2140 | 183 | }]); | 193 | }]); |
2141 | 184 | })(angular); | ||
2142 | 185 | \ No newline at end of file | 194 | \ No newline at end of file |
2143 | 195 | })(angular); | ||
2144 | diff --git a/xstatic/pkg/jquery/__init__.py b/xstatic/pkg/jquery/__init__.py | |||
2145 | index d2a34ad..78dd92a 100644 | |||
2146 | --- a/xstatic/pkg/jquery/__init__.py | |||
2147 | +++ b/xstatic/pkg/jquery/__init__.py | |||
2148 | @@ -11,7 +11,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar') | |||
2149 | 11 | # please use a all-lowercase valid python | 11 | # please use a all-lowercase valid python |
2150 | 12 | # package name | 12 | # package name |
2151 | 13 | 13 | ||
2153 | 14 | VERSION = '1.12.4' # version of the packaged files, please use the upstream | 14 | VERSION = '3.5.1' # version of the packaged files, please use the upstream |
2154 | 15 | # version number | 15 | # version number |
2155 | 16 | BUILD = '1' # our package build number, so we can release new builds | 16 | BUILD = '1' # our package build number, so we can release new builds |
2156 | 17 | # with fixes for xstatic stuff. | 17 | # with fixes for xstatic stuff. |
2157 | @@ -51,14 +51,26 @@ LOCATIONS = { | |||
2158 | 51 | ('jquery', 'http'): { | 51 | ('jquery', 'http'): { |
2159 | 52 | 'jquery.js': 'http://code.jquery.com/jquery-%s.js' % VERSION, | 52 | 'jquery.js': 'http://code.jquery.com/jquery-%s.js' % VERSION, |
2160 | 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, |
2161 | 54 | 'jquery.slim.js': 'http://code.jquery.com/jquery-%s.slim.js' % VERSION, | ||
2162 | 55 | 'jquery.slim.min.js': 'http://code.jquery.com/jquery-%s.slim.min.js' % VERSION, | ||
2163 | 56 | }, | ||
2164 | 57 | ('jquery', 'https'): { | ||
2165 | 58 | 'jquery.js': 'https://code.jquery.com/jquery-%s.js' % VERSION, | ||
2166 | 59 | 'jquery.min.js': 'https://code.jquery.com/jquery-%s.min.js' % VERSION, | ||
2167 | 60 | 'jquery.slim.js': 'https://code.jquery.com/jquery-%s.slim.js' % VERSION, | ||
2168 | 61 | 'jquery.slim.min.js': 'https://code.jquery.com/jquery-%s.slim.min.js' % VERSION, | ||
2169 | 54 | }, | 62 | }, |
2170 | 55 | ('microsoft', 'http'): { | 63 | ('microsoft', 'http'): { |
2171 | 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, |
2172 | 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, |
2173 | 66 | 'jquery.slim.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.js' % VERSION, | ||
2174 | 67 | 'jquery.slim.min.js': 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.min.js' % VERSION, | ||
2175 | 58 | }, | 68 | }, |
2176 | 59 | ('microsoft', 'https'): { | 69 | ('microsoft', 'https'): { |
2177 | 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, |
2178 | 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, |
2179 | 72 | 'jquery.slim.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.js' % VERSION, | ||
2180 | 73 | 'jquery.slim.min.js': 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-%s.slim.min.js' % VERSION, | ||
2181 | 62 | }, | 74 | }, |
2182 | 63 | } | 75 | } |
2183 | 64 | 76 | ||
2184 | diff --git a/xstatic/pkg/jquery/data/jquery.js b/xstatic/pkg/jquery/data/jquery.js | |||
2185 | index 7fc60fc..5093733 100644 | |||
2186 | --- a/xstatic/pkg/jquery/data/jquery.js | |||
2187 | +++ b/xstatic/pkg/jquery/data/jquery.js | |||
2188 | @@ -1,20 +1,22 @@ | |||
2189 | 1 | /*! | 1 | /*! |
2192 | 2 | * jQuery JavaScript Library v1.12.4 | 2 | * jQuery JavaScript Library v3.5.1 |
2193 | 3 | * http://jquery.com/ | 3 | * https://jquery.com/ |
2194 | 4 | * | 4 | * |
2195 | 5 | * Includes Sizzle.js | 5 | * Includes Sizzle.js |
2197 | 6 | * http://sizzlejs.com/ | 6 | * https://sizzlejs.com/ |
2198 | 7 | * | 7 | * |
2200 | 8 | * Copyright jQuery Foundation and other contributors | 8 | * Copyright JS Foundation and other contributors |
2201 | 9 | * Released under the MIT license | 9 | * Released under the MIT license |
2203 | 10 | * http://jquery.org/license | 10 | * https://jquery.org/license |
2204 | 11 | * | 11 | * |
2206 | 12 | * Date: 2016-05-20T17:17Z | 12 | * Date: 2020-05-04T22:49Z |
2207 | 13 | */ | 13 | */ |
2208 | 14 | ( function( global, factory ) { | ||
2209 | 14 | 15 | ||
2211 | 15 | (function( global, factory ) { | 16 | "use strict"; |
2212 | 16 | 17 | ||
2213 | 17 | if ( typeof module === "object" && typeof module.exports === "object" ) { | 18 | if ( typeof module === "object" && typeof module.exports === "object" ) { |
2214 | 19 | |||
2215 | 18 | // For CommonJS and CommonJS-like environments where a proper `window` | 20 | // For CommonJS and CommonJS-like environments where a proper `window` |
2216 | 19 | // is present, execute the factory and get jQuery. | 21 | // is present, execute the factory and get jQuery. |
2217 | 20 | // For environments that do not have a `window` with a `document` | 22 | // For environments that do not have a `window` with a `document` |
2218 | @@ -35,24 +37,30 @@ | |||
2219 | 35 | } | 37 | } |
2220 | 36 | 38 | ||
2221 | 37 | // Pass this if window is not defined yet | 39 | // Pass this if window is not defined yet |
2223 | 38 | }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { | 40 | } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { |
2224 | 39 | 41 | ||
2231 | 40 | // Support: Firefox 18+ | 42 | // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 |
2232 | 41 | // Can't be in strict mode, several libs including ASP.NET trace | 43 | // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode |
2233 | 42 | // the stack via arguments.caller.callee and Firefox dies if | 44 | // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common |
2234 | 43 | // you try to trace through "use strict" call chains. (#13335) | 45 | // enough that all such attempts are guarded in a try block. |
2235 | 44 | //"use strict"; | 46 | "use strict"; |
2230 | 45 | var deletedIds = []; | ||
2236 | 46 | 47 | ||
2238 | 47 | var document = window.document; | 48 | var arr = []; |
2239 | 49 | |||
2240 | 50 | var getProto = Object.getPrototypeOf; | ||
2241 | 51 | |||
2242 | 52 | var slice = arr.slice; | ||
2243 | 48 | 53 | ||
2245 | 49 | var slice = deletedIds.slice; | 54 | var flat = arr.flat ? function( array ) { |
2246 | 55 | return arr.flat.call( array ); | ||
2247 | 56 | } : function( array ) { | ||
2248 | 57 | return arr.concat.apply( [], array ); | ||
2249 | 58 | }; | ||
2250 | 50 | 59 | ||
2251 | 51 | var concat = deletedIds.concat; | ||
2252 | 52 | 60 | ||
2254 | 53 | var push = deletedIds.push; | 61 | var push = arr.push; |
2255 | 54 | 62 | ||
2257 | 55 | var indexOf = deletedIds.indexOf; | 63 | var indexOf = arr.indexOf; |
2258 | 56 | 64 | ||
2259 | 57 | var class2type = {}; | 65 | var class2type = {}; |
2260 | 58 | 66 | ||
2261 | @@ -60,12 +68,86 @@ var toString = class2type.toString; | |||
2262 | 60 | 68 | ||
2263 | 61 | var hasOwn = class2type.hasOwnProperty; | 69 | var hasOwn = class2type.hasOwnProperty; |
2264 | 62 | 70 | ||
2265 | 71 | var fnToString = hasOwn.toString; | ||
2266 | 72 | |||
2267 | 73 | var ObjectFunctionString = fnToString.call( Object ); | ||
2268 | 74 | |||
2269 | 63 | var support = {}; | 75 | var support = {}; |
2270 | 64 | 76 | ||
2271 | 77 | var isFunction = function isFunction( obj ) { | ||
2272 | 78 | |||
2273 | 79 | // Support: Chrome <=57, Firefox <=52 | ||
2274 | 80 | // In some browsers, typeof returns "function" for HTML <object> elements | ||
2275 | 81 | // (i.e., `typeof document.createElement( "object" ) === "function"`). | ||
2276 | 82 | // We don't want to classify *any* DOM node as a function. | ||
2277 | 83 | return typeof obj === "function" && typeof obj.nodeType !== "number"; | ||
2278 | 84 | }; | ||
2279 | 85 | |||
2280 | 86 | |||
2281 | 87 | var isWindow = function isWindow( obj ) { | ||
2282 | 88 | return obj != null && obj === obj.window; | ||
2283 | 89 | }; | ||
2284 | 90 | |||
2285 | 91 | |||
2286 | 92 | var document = window.document; | ||
2287 | 93 | |||
2288 | 94 | |||
2289 | 95 | |||
2290 | 96 | var preservedScriptAttributes = { | ||
2291 | 97 | type: true, | ||
2292 | 98 | src: true, | ||
2293 | 99 | nonce: true, | ||
2294 | 100 | noModule: true | ||
2295 | 101 | }; | ||
2296 | 102 | |||
2297 | 103 | function DOMEval( code, node, doc ) { | ||
2298 | 104 | doc = doc || document; | ||
2299 | 105 | |||
2300 | 106 | var i, val, | ||
2301 | 107 | script = doc.createElement( "script" ); | ||
2302 | 108 | |||
2303 | 109 | script.text = code; | ||
2304 | 110 | if ( node ) { | ||
2305 | 111 | for ( i in preservedScriptAttributes ) { | ||
2306 | 112 | |||
2307 | 113 | // Support: Firefox 64+, Edge 18+ | ||
2308 | 114 | // Some browsers don't support the "nonce" property on scripts. | ||
2309 | 115 | // On the other hand, just using `getAttribute` is not enough as | ||
2310 | 116 | // the `nonce` attribute is reset to an empty string whenever it | ||
2311 | 117 | // becomes browsing-context connected. | ||
2312 | 118 | // See https://github.com/whatwg/html/issues/2369 | ||
2313 | 119 | // See https://html.spec.whatwg.org/#nonce-attributes | ||
2314 | 120 | // The `node.getAttribute` check was added for the sake of | ||
2315 | 121 | // `jQuery.globalEval` so that it can fake a nonce-containing node | ||
2316 | 122 | // via an object. | ||
2317 | 123 | val = node[ i ] || node.getAttribute && node.getAttribute( i ); | ||
2318 | 124 | if ( val ) { | ||
2319 | 125 | script.setAttribute( i, val ); | ||
2320 | 126 | } | ||
2321 | 127 | } | ||
2322 | 128 | } | ||
2323 | 129 | doc.head.appendChild( script ).parentNode.removeChild( script ); | ||
2324 | 130 | } | ||
2325 | 131 | |||
2326 | 132 | |||
2327 | 133 | function toType( obj ) { | ||
2328 | 134 | if ( obj == null ) { | ||
2329 | 135 | return obj + ""; | ||
2330 | 136 | } | ||
2331 | 137 | |||
2332 | 138 | // Support: Android <=2.3 only (functionish RegExp) | ||
2333 | 139 | return typeof obj === "object" || typeof obj === "function" ? | ||
2334 | 140 | class2type[ toString.call( obj ) ] || "object" : | ||
2335 | 141 | typeof obj; | ||
2336 | 142 | } | ||
2337 | 143 | /* global Symbol */ | ||
2338 | 144 | // Defining this global in .eslintrc.json would create a danger of using the global | ||
2339 | 145 | // unguarded in another place, it seems safer to define global only for this module | ||
2340 | 146 | |||
2341 | 65 | 147 | ||
2342 | 66 | 148 | ||
2343 | 67 | var | 149 | var |
2345 | 68 | version = "1.12.4", | 150 | version = "3.5.1", |
2346 | 69 | 151 | ||
2347 | 70 | // Define a local copy of jQuery | 152 | // Define a local copy of jQuery |
2348 | 71 | jQuery = function( selector, context ) { | 153 | jQuery = function( selector, context ) { |
2349 | @@ -73,19 +155,6 @@ var | |||
2350 | 73 | // The jQuery object is actually just the init constructor 'enhanced' | 155 | // The jQuery object is actually just the init constructor 'enhanced' |
2351 | 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) |
2352 | 75 | return new jQuery.fn.init( selector, context ); | 157 | return new jQuery.fn.init( selector, context ); |
2353 | 76 | }, | ||
2354 | 77 | |||
2355 | 78 | // Support: Android<4.1, IE<9 | ||
2356 | 79 | // Make sure we trim BOM and NBSP | ||
2357 | 80 | rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | ||
2358 | 81 | |||
2359 | 82 | // Matches dashed string for camelizing | ||
2360 | 83 | rmsPrefix = /^-ms-/, | ||
2361 | 84 | rdashAlpha = /-([\da-z])/gi, | ||
2362 | 85 | |||
2363 | 86 | // Used by jQuery.camelCase as callback to replace() | ||
2364 | 87 | fcamelCase = function( all, letter ) { | ||
2365 | 88 | return letter.toUpperCase(); | ||
2366 | 89 | }; | 158 | }; |
2367 | 90 | 159 | ||
2368 | 91 | jQuery.fn = jQuery.prototype = { | 160 | jQuery.fn = jQuery.prototype = { |
2369 | @@ -95,9 +164,6 @@ jQuery.fn = jQuery.prototype = { | |||
2370 | 95 | 164 | ||
2371 | 96 | constructor: jQuery, | 165 | constructor: jQuery, |
2372 | 97 | 166 | ||
2373 | 98 | // Start with an empty selector | ||
2374 | 99 | selector: "", | ||
2375 | 100 | |||
2376 | 101 | // The default length of a jQuery object is 0 | 167 | // The default length of a jQuery object is 0 |
2377 | 102 | length: 0, | 168 | length: 0, |
2378 | 103 | 169 | ||
2379 | @@ -108,13 +174,14 @@ jQuery.fn = jQuery.prototype = { | |||
2380 | 108 | // Get the Nth element in the matched element set OR | 174 | // Get the Nth element in the matched element set OR |
2381 | 109 | // Get the whole matched element set as a clean array | 175 | // Get the whole matched element set as a clean array |
2382 | 110 | get: function( num ) { | 176 | get: function( num ) { |
2383 | 111 | return num != null ? | ||
2384 | 112 | 177 | ||
2387 | 113 | // Return just the one element from the set | 178 | // Return all the elements in a clean array |
2388 | 114 | ( num < 0 ? this[ num + this.length ] : this[ num ] ) : | 179 | if ( num == null ) { |
2389 | 180 | return slice.call( this ); | ||
2390 | 181 | } | ||
2391 | 115 | 182 | ||
2394 | 116 | // Return all the elements in a clean array | 183 | // Return just the one element from the set |
2395 | 117 | slice.call( this ); | 184 | return num < 0 ? this[ num + this.length ] : this[ num ]; |
2396 | 118 | }, | 185 | }, |
2397 | 119 | 186 | ||
2398 | 120 | // Take an array of elements and push it onto the stack | 187 | // Take an array of elements and push it onto the stack |
2399 | @@ -126,7 +193,6 @@ jQuery.fn = jQuery.prototype = { | |||
2400 | 126 | 193 | ||
2401 | 127 | // Add the old object onto the stack (as a reference) | 194 | // Add the old object onto the stack (as a reference) |
2402 | 128 | ret.prevObject = this; | 195 | ret.prevObject = this; |
2403 | 129 | ret.context = this.context; | ||
2404 | 130 | 196 | ||
2405 | 131 | // Return the newly-formed element set | 197 | // Return the newly-formed element set |
2406 | 132 | return ret; | 198 | return ret; |
2407 | @@ -155,6 +221,18 @@ jQuery.fn = jQuery.prototype = { | |||
2408 | 155 | return this.eq( -1 ); | 221 | return this.eq( -1 ); |
2409 | 156 | }, | 222 | }, |
2410 | 157 | 223 | ||
2411 | 224 | even: function() { | ||
2412 | 225 | return this.pushStack( jQuery.grep( this, function( _elem, i ) { | ||
2413 | 226 | return ( i + 1 ) % 2; | ||
2414 | 227 | } ) ); | ||
2415 | 228 | }, | ||
2416 | 229 | |||
2417 | 230 | odd: function() { | ||
2418 | 231 | return this.pushStack( jQuery.grep( this, function( _elem, i ) { | ||
2419 | 232 | return i % 2; | ||
2420 | 233 | } ) ); | ||
2421 | 234 | }, | ||
2422 | 235 | |||
2423 | 158 | eq: function( i ) { | 236 | eq: function( i ) { |
2424 | 159 | var len = this.length, | 237 | var len = this.length, |
2425 | 160 | j = +i + ( i < 0 ? len : 0 ); | 238 | j = +i + ( i < 0 ? len : 0 ); |
2426 | @@ -168,12 +246,12 @@ jQuery.fn = jQuery.prototype = { | |||
2427 | 168 | // For internal use only. | 246 | // For internal use only. |
2428 | 169 | // Behaves like an Array's method, not like a jQuery method. | 247 | // Behaves like an Array's method, not like a jQuery method. |
2429 | 170 | push: push, | 248 | push: push, |
2432 | 171 | sort: deletedIds.sort, | 249 | sort: arr.sort, |
2433 | 172 | splice: deletedIds.splice | 250 | splice: arr.splice |
2434 | 173 | }; | 251 | }; |
2435 | 174 | 252 | ||
2436 | 175 | jQuery.extend = jQuery.fn.extend = function() { | 253 | jQuery.extend = jQuery.fn.extend = function() { |
2438 | 176 | var src, copyIsArray, copy, name, options, clone, | 254 | var options, name, src, copy, copyIsArray, clone, |
2439 | 177 | target = arguments[ 0 ] || {}, | 255 | target = arguments[ 0 ] || {}, |
2440 | 178 | i = 1, | 256 | i = 1, |
2441 | 179 | length = arguments.length, | 257 | length = arguments.length, |
2442 | @@ -183,17 +261,17 @@ jQuery.extend = jQuery.fn.extend = function() { | |||
2443 | 183 | if ( typeof target === "boolean" ) { | 261 | if ( typeof target === "boolean" ) { |
2444 | 184 | deep = target; | 262 | deep = target; |
2445 | 185 | 263 | ||
2447 | 186 | // skip the boolean and the target | 264 | // Skip the boolean and the target |
2448 | 187 | target = arguments[ i ] || {}; | 265 | target = arguments[ i ] || {}; |
2449 | 188 | i++; | 266 | i++; |
2450 | 189 | } | 267 | } |
2451 | 190 | 268 | ||
2452 | 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) |
2454 | 192 | if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { | 270 | if ( typeof target !== "object" && !isFunction( target ) ) { |
2455 | 193 | target = {}; | 271 | target = {}; |
2456 | 194 | } | 272 | } |
2457 | 195 | 273 | ||
2459 | 196 | // extend jQuery itself if only one argument is passed | 274 | // Extend jQuery itself if only one argument is passed |
2460 | 197 | if ( i === length ) { | 275 | if ( i === length ) { |
2461 | 198 | target = this; | 276 | target = this; |
2462 | 199 | i--; | 277 | i--; |
2463 | @@ -206,25 +284,28 @@ jQuery.extend = jQuery.fn.extend = function() { | |||
2464 | 206 | 284 | ||
2465 | 207 | // Extend the base object | 285 | // Extend the base object |
2466 | 208 | for ( name in options ) { | 286 | for ( name in options ) { |
2467 | 209 | src = target[ name ]; | ||
2468 | 210 | copy = options[ name ]; | 287 | copy = options[ name ]; |
2469 | 211 | 288 | ||
2470 | 289 | // Prevent Object.prototype pollution | ||
2471 | 212 | // Prevent never-ending loop | 290 | // Prevent never-ending loop |
2473 | 213 | if ( target === copy ) { | 291 | if ( name === "__proto__" || target === copy ) { |
2474 | 214 | continue; | 292 | continue; |
2475 | 215 | } | 293 | } |
2476 | 216 | 294 | ||
2477 | 217 | // Recurse if we're merging plain objects or arrays | 295 | // Recurse if we're merging plain objects or arrays |
2478 | 218 | if ( deep && copy && ( jQuery.isPlainObject( copy ) || | 296 | if ( deep && copy && ( jQuery.isPlainObject( copy ) || |
2485 | 219 | ( copyIsArray = jQuery.isArray( copy ) ) ) ) { | 297 | ( copyIsArray = Array.isArray( copy ) ) ) ) { |
2486 | 220 | 298 | src = target[ name ]; | |
2487 | 221 | if ( copyIsArray ) { | 299 | |
2488 | 222 | copyIsArray = false; | 300 | // Ensure proper type for the source value |
2489 | 223 | clone = src && jQuery.isArray( src ) ? src : []; | 301 | if ( copyIsArray && !Array.isArray( src ) ) { |
2490 | 224 | 302 | clone = []; | |
2491 | 303 | } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { | ||
2492 | 304 | clone = {}; | ||
2493 | 225 | } else { | 305 | } else { |
2495 | 226 | clone = src && jQuery.isPlainObject( src ) ? src : {}; | 306 | clone = src; |
2496 | 227 | } | 307 | } |
2497 | 308 | copyIsArray = false; | ||
2498 | 228 | 309 | ||
2499 | 229 | // Never move original objects, clone them | 310 | // Never move original objects, clone them |
2500 | 230 | target[ name ] = jQuery.extend( deep, clone, copy ); | 311 | target[ name ] = jQuery.extend( deep, clone, copy ); |
2501 | @@ -255,110 +336,40 @@ jQuery.extend( { | |||
2502 | 255 | 336 | ||
2503 | 256 | noop: function() {}, | 337 | noop: function() {}, |
2504 | 257 | 338 | ||
2505 | 258 | // See test/unit/core.js for details concerning isFunction. | ||
2506 | 259 | // Since version 1.3, DOM methods and functions like alert | ||
2507 | 260 | // aren't supported. They return false on IE (#2968). | ||
2508 | 261 | isFunction: function( obj ) { | ||
2509 | 262 | return jQuery.type( obj ) === "function"; | ||
2510 | 263 | }, | ||
2511 | 264 | |||
2512 | 265 | isArray: Array.isArray || function( obj ) { | ||
2513 | 266 | return jQuery.type( obj ) === "array"; | ||
2514 | 267 | }, | ||
2515 | 268 | |||
2516 | 269 | isWindow: function( obj ) { | ||
2517 | 270 | /* jshint eqeqeq: false */ | ||
2518 | 271 | return obj != null && obj == obj.window; | ||
2519 | 272 | }, | ||
2520 | 273 | |||
2521 | 274 | isNumeric: function( obj ) { | ||
2522 | 275 | |||
2523 | 276 | // parseFloat NaNs numeric-cast false positives (null|true|false|"") | ||
2524 | 277 | // ...but misinterprets leading-number strings, particularly hex literals ("0x...") | ||
2525 | 278 | // subtraction forces infinities to NaN | ||
2526 | 279 | // adding 1 corrects loss of precision from parseFloat (#15100) | ||
2527 | 280 | var realStringObj = obj && obj.toString(); | ||
2528 | 281 | return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; | ||
2529 | 282 | }, | ||
2530 | 283 | |||
2531 | 284 | isEmptyObject: function( obj ) { | ||
2532 | 285 | var name; | ||
2533 | 286 | for ( name in obj ) { | ||
2534 | 287 | return false; | ||
2535 | 288 | } | ||
2536 | 289 | return true; | ||
2537 | 290 | }, | ||
2538 | 291 | |||
2539 | 292 | isPlainObject: function( obj ) { | 339 | isPlainObject: function( obj ) { |
2541 | 293 | var key; | 340 | var proto, Ctor; |
2542 | 294 | 341 | ||
2547 | 295 | // Must be an Object. | 342 | // Detect obvious negatives |
2548 | 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 |
2549 | 297 | // Make sure that DOM nodes and window objects don't pass through, as well | 344 | if ( !obj || toString.call( obj ) !== "[object Object]" ) { |
2546 | 298 | if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { | ||
2550 | 299 | return false; | 345 | return false; |
2551 | 300 | } | 346 | } |
2552 | 301 | 347 | ||
2566 | 302 | try { | 348 | proto = getProto( obj ); |
2554 | 303 | |||
2555 | 304 | // Not own constructor property must be Object | ||
2556 | 305 | if ( obj.constructor && | ||
2557 | 306 | !hasOwn.call( obj, "constructor" ) && | ||
2558 | 307 | !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { | ||
2559 | 308 | return false; | ||
2560 | 309 | } | ||
2561 | 310 | } catch ( e ) { | ||
2562 | 311 | |||
2563 | 312 | // IE8,9 Will throw exceptions on certain host objects #9897 | ||
2564 | 313 | return false; | ||
2565 | 314 | } | ||
2567 | 315 | 349 | ||
2574 | 316 | // Support: IE<9 | 350 | // Objects with no prototype (e.g., `Object.create( null )`) are plain |
2575 | 317 | // Handle iteration over inherited properties before own properties. | 351 | if ( !proto ) { |
2576 | 318 | if ( !support.ownFirst ) { | 352 | return true; |
2571 | 319 | for ( key in obj ) { | ||
2572 | 320 | return hasOwn.call( obj, key ); | ||
2573 | 321 | } | ||
2577 | 322 | } | 353 | } |
2578 | 323 | 354 | ||
2593 | 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 |
2594 | 325 | // if last one is own, then all properties are own. | 356 | Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; |
2595 | 326 | for ( key in obj ) {} | 357 | return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; |
2582 | 327 | |||
2583 | 328 | return key === undefined || hasOwn.call( obj, key ); | ||
2584 | 329 | }, | ||
2585 | 330 | |||
2586 | 331 | type: function( obj ) { | ||
2587 | 332 | if ( obj == null ) { | ||
2588 | 333 | return obj + ""; | ||
2589 | 334 | } | ||
2590 | 335 | return typeof obj === "object" || typeof obj === "function" ? | ||
2591 | 336 | class2type[ toString.call( obj ) ] || "object" : | ||
2592 | 337 | typeof obj; | ||
2596 | 338 | }, | 358 | }, |
2597 | 339 | 359 | ||
2602 | 340 | // Workarounds based on findings by Jim Driscoll | 360 | isEmptyObject: function( obj ) { |
2603 | 341 | // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context | 361 | var name; |
2600 | 342 | globalEval: function( data ) { | ||
2601 | 343 | if ( data && jQuery.trim( data ) ) { | ||
2604 | 344 | 362 | ||
2611 | 345 | // We use execScript on Internet Explorer | 363 | for ( name in obj ) { |
2612 | 346 | // We use an anonymous function so that context is window | 364 | return false; |
2607 | 347 | // rather than jQuery in Firefox | ||
2608 | 348 | ( window.execScript || function( data ) { | ||
2609 | 349 | window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation | ||
2610 | 350 | } )( data ); | ||
2613 | 351 | } | 365 | } |
2614 | 366 | return true; | ||
2615 | 352 | }, | 367 | }, |
2616 | 353 | 368 | ||
2625 | 354 | // Convert dashed to camelCase; used by the css and data modules | 369 | // Evaluates a script in a provided context; falls back to the global one |
2626 | 355 | // Microsoft forgot to hump their vendor prefix (#9572) | 370 | // if not specified. |
2627 | 356 | camelCase: function( string ) { | 371 | globalEval: function( code, options, doc ) { |
2628 | 357 | return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); | 372 | DOMEval( code, { nonce: options && options.nonce }, doc ); |
2621 | 358 | }, | ||
2622 | 359 | |||
2623 | 360 | nodeName: function( elem, name ) { | ||
2624 | 361 | return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); | ||
2629 | 362 | }, | 373 | }, |
2630 | 363 | 374 | ||
2631 | 364 | each: function( obj, callback ) { | 375 | each: function( obj, callback ) { |
2632 | @@ -382,13 +393,6 @@ jQuery.extend( { | |||
2633 | 382 | return obj; | 393 | return obj; |
2634 | 383 | }, | 394 | }, |
2635 | 384 | 395 | ||
2636 | 385 | // Support: Android<4.1, IE<9 | ||
2637 | 386 | trim: function( text ) { | ||
2638 | 387 | return text == null ? | ||
2639 | 388 | "" : | ||
2640 | 389 | ( text + "" ).replace( rtrim, "" ); | ||
2641 | 390 | }, | ||
2642 | 391 | |||
2643 | 392 | // results is for internal usage only | 396 | // results is for internal usage only |
2644 | 393 | makeArray: function( arr, results ) { | 397 | makeArray: function( arr, results ) { |
2645 | 394 | var ret = results || []; | 398 | var ret = results || []; |
2646 | @@ -408,43 +412,18 @@ jQuery.extend( { | |||
2647 | 408 | }, | 412 | }, |
2648 | 409 | 413 | ||
2649 | 410 | inArray: function( elem, arr, i ) { | 414 | inArray: function( elem, arr, i ) { |
2670 | 411 | var len; | 415 | return arr == null ? -1 : indexOf.call( arr, elem, i ); |
2651 | 412 | |||
2652 | 413 | if ( arr ) { | ||
2653 | 414 | if ( indexOf ) { | ||
2654 | 415 | return indexOf.call( arr, elem, i ); | ||
2655 | 416 | } | ||
2656 | 417 | |||
2657 | 418 | len = arr.length; | ||
2658 | 419 | i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; | ||
2659 | 420 | |||
2660 | 421 | for ( ; i < len; i++ ) { | ||
2661 | 422 | |||
2662 | 423 | // Skip accessing in sparse arrays | ||
2663 | 424 | if ( i in arr && arr[ i ] === elem ) { | ||
2664 | 425 | return i; | ||
2665 | 426 | } | ||
2666 | 427 | } | ||
2667 | 428 | } | ||
2668 | 429 | |||
2669 | 430 | return -1; | ||
2671 | 431 | }, | 416 | }, |
2672 | 432 | 417 | ||
2673 | 418 | // Support: Android <=4.0 only, PhantomJS 1 only | ||
2674 | 419 | // push.apply(_, arraylike) throws on ancient WebKit | ||
2675 | 433 | merge: function( first, second ) { | 420 | merge: function( first, second ) { |
2676 | 434 | var len = +second.length, | 421 | var len = +second.length, |
2677 | 435 | j = 0, | 422 | j = 0, |
2678 | 436 | i = first.length; | 423 | i = first.length; |
2679 | 437 | 424 | ||
2690 | 438 | while ( j < len ) { | 425 | for ( ; j < len; j++ ) { |
2691 | 439 | first[ i++ ] = second[ j++ ]; | 426 | first[ i++ ] = second[ j ]; |
2682 | 440 | } | ||
2683 | 441 | |||
2684 | 442 | // Support: IE<9 | ||
2685 | 443 | // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) | ||
2686 | 444 | if ( len !== len ) { | ||
2687 | 445 | while ( second[ j ] !== undefined ) { | ||
2688 | 446 | first[ i++ ] = second[ j++ ]; | ||
2689 | 447 | } | ||
2692 | 448 | } | 427 | } |
2693 | 449 | 428 | ||
2694 | 450 | first.length = i; | 429 | first.length = i; |
2695 | @@ -500,76 +479,37 @@ jQuery.extend( { | |||
2696 | 500 | } | 479 | } |
2697 | 501 | 480 | ||
2698 | 502 | // Flatten any nested arrays | 481 | // Flatten any nested arrays |
2700 | 503 | return concat.apply( [], ret ); | 482 | return flat( ret ); |
2701 | 504 | }, | 483 | }, |
2702 | 505 | 484 | ||
2703 | 506 | // A global GUID counter for objects | 485 | // A global GUID counter for objects |
2704 | 507 | guid: 1, | 486 | guid: 1, |
2705 | 508 | 487 | ||
2706 | 509 | // Bind a function to a context, optionally partially applying any | ||
2707 | 510 | // arguments. | ||
2708 | 511 | proxy: function( fn, context ) { | ||
2709 | 512 | var args, proxy, tmp; | ||
2710 | 513 | |||
2711 | 514 | if ( typeof context === "string" ) { | ||
2712 | 515 | tmp = fn[ context ]; | ||
2713 | 516 | context = fn; | ||
2714 | 517 | fn = tmp; | ||
2715 | 518 | } | ||
2716 | 519 | |||
2717 | 520 | // Quick check to determine if target is callable, in the spec | ||
2718 | 521 | // this throws a TypeError, but we will just return undefined. | ||
2719 | 522 | if ( !jQuery.isFunction( fn ) ) { | ||
2720 | 523 | return undefined; | ||
2721 | 524 | } | ||
2722 | 525 | |||
2723 | 526 | // Simulated bind | ||
2724 | 527 | args = slice.call( arguments, 2 ); | ||
2725 | 528 | proxy = function() { | ||
2726 | 529 | return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); | ||
2727 | 530 | }; | ||
2728 | 531 | |||
2729 | 532 | // Set the guid of unique handler to the same of original handler, so it can be removed | ||
2730 | 533 | proxy.guid = fn.guid = fn.guid || jQuery.guid++; | ||
2731 | 534 | |||
2732 | 535 | return proxy; | ||
2733 | 536 | }, | ||
2734 | 537 | |||
2735 | 538 | now: function() { | ||
2736 | 539 | return +( new Date() ); | ||
2737 | 540 | }, | ||
2738 | 541 | |||
2739 | 542 | // jQuery.support is not used in Core but other projects attach their | 488 | // jQuery.support is not used in Core but other projects attach their |
2740 | 543 | // properties to it so it needs to exist. | 489 | // properties to it so it needs to exist. |
2741 | 544 | support: support | 490 | support: support |
2742 | 545 | } ); | 491 | } ); |
2743 | 546 | 492 | ||
2744 | 547 | // JSHint would error on this code due to the Symbol not being defined in ES5. | ||
2745 | 548 | // Defining this global in .jshintrc would create a danger of using the global | ||
2746 | 549 | // unguarded in another place, it seems safer to just disable JSHint for these | ||
2747 | 550 | // three lines. | ||
2748 | 551 | /* jshint ignore: start */ | ||
2749 | 552 | if ( typeof Symbol === "function" ) { | 493 | if ( typeof Symbol === "function" ) { |
2751 | 553 | jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ]; | 494 | jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; |
2752 | 554 | } | 495 | } |
2753 | 555 | /* jshint ignore: end */ | ||
2754 | 556 | 496 | ||
2755 | 557 | // Populate the class2type map | 497 | // Populate the class2type map |
2756 | 558 | jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), | 498 | jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), |
2758 | 559 | function( i, name ) { | 499 | function( _i, name ) { |
2759 | 560 | class2type[ "[object " + name + "]" ] = name.toLowerCase(); | 500 | class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
2760 | 561 | } ); | 501 | } ); |
2761 | 562 | 502 | ||
2762 | 563 | function isArrayLike( obj ) { | 503 | function isArrayLike( obj ) { |
2763 | 564 | 504 | ||
2765 | 565 | // Support: iOS 8.2 (not reproducible in simulator) | 505 | // Support: real iOS 8.2 only (not reproducible in simulator) |
2766 | 566 | // `in` check used to prevent JIT error (gh-2145) | 506 | // `in` check used to prevent JIT error (gh-2145) |
2767 | 567 | // hasOwn isn't used here due to false negatives | 507 | // hasOwn isn't used here due to false negatives |
2768 | 568 | // regarding Nodelist length in IE | 508 | // regarding Nodelist length in IE |
2769 | 569 | var length = !!obj && "length" in obj && obj.length, | 509 | var length = !!obj && "length" in obj && obj.length, |
2771 | 570 | type = jQuery.type( obj ); | 510 | type = toType( obj ); |
2772 | 571 | 511 | ||
2774 | 572 | if ( type === "function" || jQuery.isWindow( obj ) ) { | 512 | if ( isFunction( obj ) || isWindow( obj ) ) { |
2775 | 573 | return false; | 513 | return false; |
2776 | 574 | } | 514 | } |
2777 | 575 | 515 | ||
2778 | @@ -578,17 +518,16 @@ function isArrayLike( obj ) { | |||
2779 | 578 | } | 518 | } |
2780 | 579 | var Sizzle = | 519 | var Sizzle = |
2781 | 580 | /*! | 520 | /*! |
2784 | 581 | * Sizzle CSS Selector Engine v2.2.1 | 521 | * Sizzle CSS Selector Engine v2.3.5 |
2785 | 582 | * http://sizzlejs.com/ | 522 | * https://sizzlejs.com/ |
2786 | 583 | * | 523 | * |
2788 | 584 | * Copyright jQuery Foundation and other contributors | 524 | * Copyright JS Foundation and other contributors |
2789 | 585 | * Released under the MIT license | 525 | * Released under the MIT license |
2791 | 586 | * http://jquery.org/license | 526 | * https://js.foundation/ |
2792 | 587 | * | 527 | * |
2794 | 588 | * Date: 2015-10-17 | 528 | * Date: 2020-03-14 |
2795 | 589 | */ | 529 | */ |
2798 | 590 | (function( window ) { | 530 | ( function( window ) { |
2797 | 591 | |||
2799 | 592 | var i, | 531 | var i, |
2800 | 593 | support, | 532 | support, |
2801 | 594 | Expr, | 533 | Expr, |
2802 | @@ -619,6 +558,7 @@ var i, | |||
2803 | 619 | classCache = createCache(), | 558 | classCache = createCache(), |
2804 | 620 | tokenCache = createCache(), | 559 | tokenCache = createCache(), |
2805 | 621 | compilerCache = createCache(), | 560 | compilerCache = createCache(), |
2806 | 561 | nonnativeSelectorCache = createCache(), | ||
2807 | 622 | sortOrder = function( a, b ) { | 562 | sortOrder = function( a, b ) { |
2808 | 623 | if ( a === b ) { | 563 | if ( a === b ) { |
2809 | 624 | hasDuplicate = true; | 564 | hasDuplicate = true; |
2810 | @@ -626,65 +566,72 @@ var i, | |||
2811 | 626 | return 0; | 566 | return 0; |
2812 | 627 | }, | 567 | }, |
2813 | 628 | 568 | ||
2814 | 629 | // General-purpose constants | ||
2815 | 630 | MAX_NEGATIVE = 1 << 31, | ||
2816 | 631 | |||
2817 | 632 | // Instance methods | 569 | // Instance methods |
2819 | 633 | hasOwn = ({}).hasOwnProperty, | 570 | hasOwn = ( {} ).hasOwnProperty, |
2820 | 634 | arr = [], | 571 | arr = [], |
2821 | 635 | pop = arr.pop, | 572 | pop = arr.pop, |
2823 | 636 | push_native = arr.push, | 573 | pushNative = arr.push, |
2824 | 637 | push = arr.push, | 574 | push = arr.push, |
2825 | 638 | slice = arr.slice, | 575 | slice = arr.slice, |
2826 | 576 | |||
2827 | 639 | // Use a stripped-down indexOf as it's faster than native | 577 | // Use a stripped-down indexOf as it's faster than native |
2829 | 640 | // http://jsperf.com/thor-indexof-vs-for/5 | 578 | // https://jsperf.com/thor-indexof-vs-for/5 |
2830 | 641 | indexOf = function( list, elem ) { | 579 | indexOf = function( list, elem ) { |
2831 | 642 | var i = 0, | 580 | var i = 0, |
2832 | 643 | len = list.length; | 581 | len = list.length; |
2833 | 644 | for ( ; i < len; i++ ) { | 582 | for ( ; i < len; i++ ) { |
2835 | 645 | if ( list[i] === elem ) { | 583 | if ( list[ i ] === elem ) { |
2836 | 646 | return i; | 584 | return i; |
2837 | 647 | } | 585 | } |
2838 | 648 | } | 586 | } |
2839 | 649 | return -1; | 587 | return -1; |
2840 | 650 | }, | 588 | }, |
2841 | 651 | 589 | ||
2843 | 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|" + |
2844 | 591 | "ismap|loop|multiple|open|readonly|required|scoped", | ||
2845 | 653 | 592 | ||
2846 | 654 | // Regular expressions | 593 | // Regular expressions |
2847 | 655 | 594 | ||
2848 | 656 | // http://www.w3.org/TR/css3-selectors/#whitespace | 595 | // http://www.w3.org/TR/css3-selectors/#whitespace |
2849 | 657 | whitespace = "[\\x20\\t\\r\\n\\f]", | 596 | whitespace = "[\\x20\\t\\r\\n\\f]", |
2850 | 658 | 597 | ||
2853 | 659 | // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier | 598 | // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram |
2854 | 660 | identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", | 599 | identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + |
2855 | 600 | "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", | ||
2856 | 661 | 601 | ||
2857 | 662 | // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors | 602 | // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
2858 | 663 | attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + | 603 | attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + |
2859 | 604 | |||
2860 | 664 | // Operator (capture 2) | 605 | // Operator (capture 2) |
2861 | 665 | "*([*^$|!~]?=)" + whitespace + | 606 | "*([*^$|!~]?=)" + whitespace + |
2865 | 666 | // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" | 607 | |
2866 | 667 | "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + | 608 | // "Attribute values must be CSS identifiers [capture 5] |
2867 | 668 | "*\\]", | 609 | // or strings [capture 3 or capture 4]" |
2868 | 610 | "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + | ||
2869 | 611 | whitespace + "*\\]", | ||
2870 | 669 | 612 | ||
2871 | 670 | pseudos = ":(" + identifier + ")(?:\\((" + | 613 | pseudos = ":(" + identifier + ")(?:\\((" + |
2872 | 614 | |||
2873 | 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: |
2874 | 672 | // 1. quoted (capture 3; capture 4 or capture 5) | 616 | // 1. quoted (capture 3; capture 4 or capture 5) |
2875 | 673 | "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + | 617 | "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
2876 | 618 | |||
2877 | 674 | // 2. simple (capture 6) | 619 | // 2. simple (capture 6) |
2878 | 675 | "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + | 620 | "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + |
2879 | 621 | |||
2880 | 676 | // 3. anything else (capture 2) | 622 | // 3. anything else (capture 2) |
2881 | 677 | ".*" + | 623 | ".*" + |
2882 | 678 | ")\\)|)", | 624 | ")\\)|)", |
2883 | 679 | 625 | ||
2884 | 680 | // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter | 626 | // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
2885 | 681 | rwhitespace = new RegExp( whitespace + "+", "g" ), | 627 | rwhitespace = new RegExp( whitespace + "+", "g" ), |
2887 | 682 | rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), | 628 | rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + |
2888 | 629 | whitespace + "+$", "g" ), | ||
2889 | 683 | 630 | ||
2890 | 684 | rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), | 631 | rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
2894 | 685 | rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), | 632 | rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + |
2895 | 686 | 633 | "*" ), | |
2896 | 687 | rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), | 634 | rdescend = new RegExp( whitespace + "|>" ), |
2897 | 688 | 635 | ||
2898 | 689 | rpseudo = new RegExp( pseudos ), | 636 | rpseudo = new RegExp( pseudos ), |
2899 | 690 | ridentifier = new RegExp( "^" + identifier + "$" ), | 637 | ridentifier = new RegExp( "^" + identifier + "$" ), |
2900 | @@ -695,16 +642,19 @@ var i, | |||
2901 | 695 | "TAG": new RegExp( "^(" + identifier + "|[*])" ), | 642 | "TAG": new RegExp( "^(" + identifier + "|[*])" ), |
2902 | 696 | "ATTR": new RegExp( "^" + attributes ), | 643 | "ATTR": new RegExp( "^" + attributes ), |
2903 | 697 | "PSEUDO": new RegExp( "^" + pseudos ), | 644 | "PSEUDO": new RegExp( "^" + pseudos ), |
2907 | 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)(?:\\(" + |
2908 | 699 | "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + | 646 | whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + |
2909 | 700 | "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), | 647 | whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
2910 | 701 | "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), | 648 | "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), |
2911 | 649 | |||
2912 | 702 | // For use in libraries implementing .is() | 650 | // For use in libraries implementing .is() |
2913 | 703 | // We use this for POS matching in `select` | 651 | // We use this for POS matching in `select` |
2916 | 704 | "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + | 652 | "needsContext": new RegExp( "^" + whitespace + |
2917 | 705 | whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) | 653 | "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + |
2918 | 654 | "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) | ||
2919 | 706 | }, | 655 | }, |
2920 | 707 | 656 | ||
2921 | 657 | rhtml = /HTML$/i, | ||
2922 | 708 | rinputs = /^(?:input|select|textarea|button)$/i, | 658 | rinputs = /^(?:input|select|textarea|button)$/i, |
2923 | 709 | rheader = /^h\d$/i, | 659 | rheader = /^h\d$/i, |
2924 | 710 | 660 | ||
2925 | @@ -714,47 +664,79 @@ var i, | |||
2926 | 714 | rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | 664 | rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
2927 | 715 | 665 | ||
2928 | 716 | rsibling = /[+~]/, | 666 | rsibling = /[+~]/, |
2940 | 717 | rescape = /'|\\/g, | 667 | |
2941 | 718 | 668 | // CSS escapes | |
2942 | 719 | // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters | 669 | // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
2943 | 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" ), |
2944 | 721 | funescape = function( _, escaped, escapedWhitespace ) { | 671 | funescape = function( escape, nonHex ) { |
2945 | 722 | var high = "0x" + escaped - 0x10000; | 672 | var high = "0x" + escape.slice( 1 ) - 0x10000; |
2946 | 723 | // NaN means non-codepoint | 673 | |
2947 | 724 | // Support: Firefox<24 | 674 | return nonHex ? |
2948 | 725 | // Workaround erroneous numeric interpretation of +"0x" | 675 | |
2949 | 726 | return high !== high || escapedWhitespace ? | 676 | // Strip the backslash prefix from a non-hex escape sequence |
2950 | 727 | escaped : | 677 | nonHex : |
2951 | 678 | |||
2952 | 679 | // Replace a hexadecimal escape sequence with the encoded Unicode code point | ||
2953 | 680 | // Support: IE <=11+ | ||
2954 | 681 | // For values outside the Basic Multilingual Plane (BMP), manually construct a | ||
2955 | 682 | // surrogate pair | ||
2956 | 728 | high < 0 ? | 683 | high < 0 ? |
2957 | 729 | // BMP codepoint | ||
2958 | 730 | String.fromCharCode( high + 0x10000 ) : | 684 | String.fromCharCode( high + 0x10000 ) : |
2959 | 731 | // Supplemental Plane codepoint (surrogate pair) | ||
2960 | 732 | String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); | 685 | String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
2961 | 733 | }, | 686 | }, |
2962 | 734 | 687 | ||
2963 | 688 | // CSS string/identifier serialization | ||
2964 | 689 | // https://drafts.csswg.org/cssom/#common-serializing-idioms | ||
2965 | 690 | rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, | ||
2966 | 691 | fcssescape = function( ch, asCodePoint ) { | ||
2967 | 692 | if ( asCodePoint ) { | ||
2968 | 693 | |||
2969 | 694 | // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER | ||
2970 | 695 | if ( ch === "\0" ) { | ||
2971 | 696 | return "\uFFFD"; | ||
2972 | 697 | } | ||
2973 | 698 | |||
2974 | 699 | // Control characters and (dependent upon position) numbers get escaped as code points | ||
2975 | 700 | return ch.slice( 0, -1 ) + "\\" + | ||
2976 | 701 | ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; | ||
2977 | 702 | } | ||
2978 | 703 | |||
2979 | 704 | // Other potentially-special ASCII characters get backslash-escaped | ||
2980 | 705 | return "\\" + ch; | ||
2981 | 706 | }, | ||
2982 | 707 | |||
2983 | 735 | // Used for iframes | 708 | // Used for iframes |
2984 | 736 | // See setDocument() | 709 | // See setDocument() |
2985 | 737 | // Removing the function wrapper causes a "Permission Denied" | 710 | // Removing the function wrapper causes a "Permission Denied" |
2986 | 738 | // error in IE | 711 | // error in IE |
2987 | 739 | unloadHandler = function() { | 712 | unloadHandler = function() { |
2988 | 740 | setDocument(); | 713 | setDocument(); |
2990 | 741 | }; | 714 | }, |
2991 | 715 | |||
2992 | 716 | inDisabledFieldset = addCombinator( | ||
2993 | 717 | function( elem ) { | ||
2994 | 718 | return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; | ||
2995 | 719 | }, | ||
2996 | 720 | { dir: "parentNode", next: "legend" } | ||
2997 | 721 | ); | ||
2998 | 742 | 722 | ||
2999 | 743 | // Optimize for push.apply( _, NodeList ) | 723 | // Optimize for push.apply( _, NodeList ) |
3000 | 744 | try { | 724 | try { |
3001 | 745 | push.apply( | 725 | push.apply( |
3003 | 746 | (arr = slice.call( preferredDoc.childNodes )), | 726 | ( arr = slice.call( preferredDoc.childNodes ) ), |
3004 | 747 | preferredDoc.childNodes | 727 | preferredDoc.childNodes |
3005 | 748 | ); | 728 | ); |
3006 | 729 | |||
3007 | 749 | // Support: Android<4.0 | 730 | // Support: Android<4.0 |
3008 | 750 | // Detect silently failing push.apply | 731 | // Detect silently failing push.apply |
3009 | 732 | // eslint-disable-next-line no-unused-expressions | ||
3010 | 751 | arr[ preferredDoc.childNodes.length ].nodeType; | 733 | arr[ preferredDoc.childNodes.length ].nodeType; |
3011 | 752 | } catch ( e ) { | 734 | } catch ( e ) { |
3012 | 753 | push = { apply: arr.length ? | 735 | push = { apply: arr.length ? |
3013 | 754 | 736 | ||
3014 | 755 | // Leverage slice if possible | 737 | // Leverage slice if possible |
3015 | 756 | function( target, els ) { | 738 | function( target, els ) { |
3017 | 757 | push_native.apply( target, slice.call(els) ); | 739 | pushNative.apply( target, slice.call( els ) ); |
3018 | 758 | } : | 740 | } : |
3019 | 759 | 741 | ||
3020 | 760 | // Support: IE<9 | 742 | // Support: IE<9 |
3021 | @@ -762,15 +744,16 @@ try { | |||
3022 | 762 | function( target, els ) { | 744 | function( target, els ) { |
3023 | 763 | var j = target.length, | 745 | var j = target.length, |
3024 | 764 | i = 0; | 746 | i = 0; |
3025 | 747 | |||
3026 | 765 | // Can't trust NodeList.length | 748 | // Can't trust NodeList.length |
3028 | 766 | while ( (target[j++] = els[i++]) ) {} | 749 | while ( ( target[ j++ ] = els[ i++ ] ) ) {} |
3029 | 767 | target.length = j - 1; | 750 | target.length = j - 1; |
3030 | 768 | } | 751 | } |
3031 | 769 | }; | 752 | }; |
3032 | 770 | } | 753 | } |
3033 | 771 | 754 | ||
3034 | 772 | function Sizzle( selector, context, results, seed ) { | 755 | function Sizzle( selector, context, results, seed ) { |
3036 | 773 | var m, i, elem, nid, nidselect, match, groups, newSelector, | 756 | var m, i, elem, nid, match, groups, newSelector, |
3037 | 774 | newContext = context && context.ownerDocument, | 757 | newContext = context && context.ownerDocument, |
3038 | 775 | 758 | ||
3039 | 776 | // nodeType defaults to 9, since context defaults to document | 759 | // nodeType defaults to 9, since context defaults to document |
3040 | @@ -787,24 +770,21 @@ function Sizzle( selector, context, results, seed ) { | |||
3041 | 787 | 770 | ||
3042 | 788 | // Try to shortcut find operations (as opposed to filters) in HTML documents | 771 | // Try to shortcut find operations (as opposed to filters) in HTML documents |
3043 | 789 | if ( !seed ) { | 772 | if ( !seed ) { |
3048 | 790 | 773 | setDocument( context ); | |
3045 | 791 | if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { | ||
3046 | 792 | setDocument( context ); | ||
3047 | 793 | } | ||
3049 | 794 | context = context || document; | 774 | context = context || document; |
3050 | 795 | 775 | ||
3051 | 796 | if ( documentIsHTML ) { | 776 | if ( documentIsHTML ) { |
3052 | 797 | 777 | ||
3053 | 798 | // If the selector is sufficiently simple, try using a "get*By*" DOM method | 778 | // If the selector is sufficiently simple, try using a "get*By*" DOM method |
3054 | 799 | // (excepting DocumentFragment context, where the methods don't exist) | 779 | // (excepting DocumentFragment context, where the methods don't exist) |
3056 | 800 | if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { | 780 | if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { |
3057 | 801 | 781 | ||
3058 | 802 | // ID selector | 782 | // ID selector |
3060 | 803 | if ( (m = match[1]) ) { | 783 | if ( ( m = match[ 1 ] ) ) { |
3061 | 804 | 784 | ||
3062 | 805 | // Document context | 785 | // Document context |
3063 | 806 | if ( nodeType === 9 ) { | 786 | if ( nodeType === 9 ) { |
3065 | 807 | if ( (elem = context.getElementById( m )) ) { | 787 | if ( ( elem = context.getElementById( m ) ) ) { |
3066 | 808 | 788 | ||
3067 | 809 | // Support: IE, Opera, Webkit | 789 | // Support: IE, Opera, Webkit |
3068 | 810 | // TODO: identify versions | 790 | // TODO: identify versions |
3069 | @@ -823,7 +803,7 @@ function Sizzle( selector, context, results, seed ) { | |||
3070 | 823 | // Support: IE, Opera, Webkit | 803 | // Support: IE, Opera, Webkit |
3071 | 824 | // TODO: identify versions | 804 | // TODO: identify versions |
3072 | 825 | // getElementById can match elements by name instead of ID | 805 | // getElementById can match elements by name instead of ID |
3074 | 826 | if ( newContext && (elem = newContext.getElementById( m )) && | 806 | if ( newContext && ( elem = newContext.getElementById( m ) ) && |
3075 | 827 | contains( context, elem ) && | 807 | contains( context, elem ) && |
3076 | 828 | elem.id === m ) { | 808 | elem.id === m ) { |
3077 | 829 | 809 | ||
3078 | @@ -833,12 +813,12 @@ function Sizzle( selector, context, results, seed ) { | |||
3079 | 833 | } | 813 | } |
3080 | 834 | 814 | ||
3081 | 835 | // Type selector | 815 | // Type selector |
3083 | 836 | } else if ( match[2] ) { | 816 | } else if ( match[ 2 ] ) { |
3084 | 837 | push.apply( results, context.getElementsByTagName( selector ) ); | 817 | push.apply( results, context.getElementsByTagName( selector ) ); |
3085 | 838 | return results; | 818 | return results; |
3086 | 839 | 819 | ||
3087 | 840 | // Class selector | 820 | // Class selector |
3089 | 841 | } else if ( (m = match[3]) && support.getElementsByClassName && | 821 | } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && |
3090 | 842 | context.getElementsByClassName ) { | 822 | context.getElementsByClassName ) { |
3091 | 843 | 823 | ||
3092 | 844 | push.apply( results, context.getElementsByClassName( m ) ); | 824 | push.apply( results, context.getElementsByClassName( m ) ); |
3093 | @@ -848,51 +828,62 @@ function Sizzle( selector, context, results, seed ) { | |||
3094 | 848 | 828 | ||
3095 | 849 | // Take advantage of querySelectorAll | 829 | // Take advantage of querySelectorAll |
3096 | 850 | if ( support.qsa && | 830 | if ( support.qsa && |
3099 | 851 | !compilerCache[ selector + " " ] && | 831 | !nonnativeSelectorCache[ selector + " " ] && |
3100 | 852 | (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { | 832 | ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && |
3101 | 853 | 833 | ||
3109 | 854 | if ( nodeType !== 1 ) { | 834 | // Support: IE 8 only |
3103 | 855 | newContext = context; | ||
3104 | 856 | newSelector = selector; | ||
3105 | 857 | |||
3106 | 858 | // qSA looks outside Element context, which is not what we want | ||
3107 | 859 | // Thanks to Andrew Dupont for this workaround technique | ||
3108 | 860 | // Support: IE <=8 | ||
3110 | 861 | // Exclude object elements | 835 | // Exclude object elements |
3112 | 862 | } else if ( context.nodeName.toLowerCase() !== "object" ) { | 836 | ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { |
3113 | 863 | 837 | ||
3119 | 864 | // Capture the context ID, setting it first if necessary | 838 | newSelector = selector; |
3120 | 865 | if ( (nid = context.getAttribute( "id" )) ) { | 839 | newContext = context; |
3121 | 866 | nid = nid.replace( rescape, "\\$&" ); | 840 | |
3122 | 867 | } else { | 841 | // qSA considers elements outside a scoping root when evaluating child or |
3123 | 868 | context.setAttribute( "id", (nid = expando) ); | 842 | // descendant combinators, which is not what we want. |
3124 | 843 | // In such cases, we work around the behavior by prefixing every selector in the | ||
3125 | 844 | // list with an ID selector referencing the scope context. | ||
3126 | 845 | // The technique has to be used as well when a leading combinator is used | ||
3127 | 846 | // as such selectors are not recognized by querySelectorAll. | ||
3128 | 847 | // Thanks to Andrew Dupont for this technique. | ||
3129 | 848 | if ( nodeType === 1 && | ||
3130 | 849 | ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { | ||
3131 | 850 | |||
3132 | 851 | // Expand context for sibling selectors | ||
3133 | 852 | newContext = rsibling.test( selector ) && testContext( context.parentNode ) || | ||
3134 | 853 | context; | ||
3135 | 854 | |||
3136 | 855 | // We can use :scope instead of the ID hack if the browser | ||
3137 | 856 | // supports it & if we're not changing the context. | ||
3138 | 857 | if ( newContext !== context || !support.scope ) { | ||
3139 | 858 | |||
3140 | 859 | // Capture the context ID, setting it first if necessary | ||
3141 | 860 | if ( ( nid = context.getAttribute( "id" ) ) ) { | ||
3142 | 861 | nid = nid.replace( rcssescape, fcssescape ); | ||
3143 | 862 | } else { | ||
3144 | 863 | context.setAttribute( "id", ( nid = expando ) ); | ||
3145 | 864 | } | ||
3146 | 869 | } | 865 | } |
3147 | 870 | 866 | ||
3148 | 871 | // Prefix every selector in the list | 867 | // Prefix every selector in the list |
3149 | 872 | groups = tokenize( selector ); | 868 | groups = tokenize( selector ); |
3150 | 873 | i = groups.length; | 869 | i = groups.length; |
3151 | 874 | nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; | ||
3152 | 875 | while ( i-- ) { | 870 | while ( i-- ) { |
3154 | 876 | groups[i] = nidselect + " " + toSelector( groups[i] ); | 871 | groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + |
3155 | 872 | toSelector( groups[ i ] ); | ||
3156 | 877 | } | 873 | } |
3157 | 878 | newSelector = groups.join( "," ); | 874 | newSelector = groups.join( "," ); |
3158 | 879 | |||
3159 | 880 | // Expand context for sibling selectors | ||
3160 | 881 | newContext = rsibling.test( selector ) && testContext( context.parentNode ) || | ||
3161 | 882 | context; | ||
3162 | 883 | } | 875 | } |
3163 | 884 | 876 | ||
3175 | 885 | if ( newSelector ) { | 877 | try { |
3176 | 886 | try { | 878 | push.apply( results, |
3177 | 887 | push.apply( results, | 879 | newContext.querySelectorAll( newSelector ) |
3178 | 888 | newContext.querySelectorAll( newSelector ) | 880 | ); |
3179 | 889 | ); | 881 | return results; |
3180 | 890 | return results; | 882 | } catch ( qsaError ) { |
3181 | 891 | } catch ( qsaError ) { | 883 | nonnativeSelectorCache( selector, true ); |
3182 | 892 | } finally { | 884 | } finally { |
3183 | 893 | if ( nid === expando ) { | 885 | if ( nid === expando ) { |
3184 | 894 | context.removeAttribute( "id" ); | 886 | context.removeAttribute( "id" ); |
3174 | 895 | } | ||
3185 | 896 | } | 887 | } |
3186 | 897 | } | 888 | } |
3187 | 898 | } | 889 | } |
3188 | @@ -913,12 +904,14 @@ function createCache() { | |||
3189 | 913 | var keys = []; | 904 | var keys = []; |
3190 | 914 | 905 | ||
3191 | 915 | function cache( key, value ) { | 906 | function cache( key, value ) { |
3192 | 907 | |||
3193 | 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) |
3194 | 917 | if ( keys.push( key + " " ) > Expr.cacheLength ) { | 909 | if ( keys.push( key + " " ) > Expr.cacheLength ) { |
3195 | 910 | |||
3196 | 918 | // Only keep the most recent entries | 911 | // Only keep the most recent entries |
3197 | 919 | delete cache[ keys.shift() ]; | 912 | delete cache[ keys.shift() ]; |
3198 | 920 | } | 913 | } |
3200 | 921 | return (cache[ key + " " ] = value); | 914 | return ( cache[ key + " " ] = value ); |
3201 | 922 | } | 915 | } |
3202 | 923 | return cache; | 916 | return cache; |
3203 | 924 | } | 917 | } |
3204 | @@ -934,22 +927,24 @@ function markFunction( fn ) { | |||
3205 | 934 | 927 | ||
3206 | 935 | /** | 928 | /** |
3207 | 936 | * Support testing using an element | 929 | * Support testing using an element |
3209 | 937 | * @param {Function} fn Passed the created div and expects a boolean result | 930 | * @param {Function} fn Passed the created element and returns a boolean result |
3210 | 938 | */ | 931 | */ |
3211 | 939 | function assert( fn ) { | 932 | function assert( fn ) { |
3213 | 940 | var div = document.createElement("div"); | 933 | var el = document.createElement( "fieldset" ); |
3214 | 941 | 934 | ||
3215 | 942 | try { | 935 | try { |
3218 | 943 | return !!fn( div ); | 936 | return !!fn( el ); |
3219 | 944 | } catch (e) { | 937 | } catch ( e ) { |
3220 | 945 | return false; | 938 | return false; |
3221 | 946 | } finally { | 939 | } finally { |
3222 | 940 | |||
3223 | 947 | // Remove from its parent by default | 941 | // Remove from its parent by default |
3226 | 948 | if ( div.parentNode ) { | 942 | if ( el.parentNode ) { |
3227 | 949 | div.parentNode.removeChild( div ); | 943 | el.parentNode.removeChild( el ); |
3228 | 950 | } | 944 | } |
3229 | 945 | |||
3230 | 951 | // release memory in IE | 946 | // release memory in IE |
3232 | 952 | div = null; | 947 | el = null; |
3233 | 953 | } | 948 | } |
3234 | 954 | } | 949 | } |
3235 | 955 | 950 | ||
3236 | @@ -959,11 +954,11 @@ function assert( fn ) { | |||
3237 | 959 | * @param {Function} handler The method that will be applied | 954 | * @param {Function} handler The method that will be applied |
3238 | 960 | */ | 955 | */ |
3239 | 961 | function addHandle( attrs, handler ) { | 956 | function addHandle( attrs, handler ) { |
3241 | 962 | var arr = attrs.split("|"), | 957 | var arr = attrs.split( "|" ), |
3242 | 963 | i = arr.length; | 958 | i = arr.length; |
3243 | 964 | 959 | ||
3244 | 965 | while ( i-- ) { | 960 | while ( i-- ) { |
3246 | 966 | Expr.attrHandle[ arr[i] ] = handler; | 961 | Expr.attrHandle[ arr[ i ] ] = handler; |
3247 | 967 | } | 962 | } |
3248 | 968 | } | 963 | } |
3249 | 969 | 964 | ||
3250 | @@ -976,8 +971,7 @@ function addHandle( attrs, handler ) { | |||
3251 | 976 | function siblingCheck( a, b ) { | 971 | function siblingCheck( a, b ) { |
3252 | 977 | var cur = b && a, | 972 | var cur = b && a, |
3253 | 978 | diff = cur && a.nodeType === 1 && b.nodeType === 1 && | 973 | diff = cur && a.nodeType === 1 && b.nodeType === 1 && |
3256 | 979 | ( ~b.sourceIndex || MAX_NEGATIVE ) - | 974 | a.sourceIndex - b.sourceIndex; |
3255 | 980 | ( ~a.sourceIndex || MAX_NEGATIVE ); | ||
3257 | 981 | 975 | ||
3258 | 982 | // Use IE sourceIndex if available on both nodes | 976 | // Use IE sourceIndex if available on both nodes |
3259 | 983 | if ( diff ) { | 977 | if ( diff ) { |
3260 | @@ -986,7 +980,7 @@ function siblingCheck( a, b ) { | |||
3261 | 986 | 980 | ||
3262 | 987 | // Check if b follows a | 981 | // Check if b follows a |
3263 | 988 | if ( cur ) { | 982 | if ( cur ) { |
3265 | 989 | while ( (cur = cur.nextSibling) ) { | 983 | while ( ( cur = cur.nextSibling ) ) { |
3266 | 990 | if ( cur === b ) { | 984 | if ( cur === b ) { |
3267 | 991 | return -1; | 985 | return -1; |
3268 | 992 | } | 986 | } |
3269 | @@ -1014,7 +1008,63 @@ function createInputPseudo( type ) { | |||
3270 | 1014 | function createButtonPseudo( type ) { | 1008 | function createButtonPseudo( type ) { |
3271 | 1015 | return function( elem ) { | 1009 | return function( elem ) { |
3272 | 1016 | var name = elem.nodeName.toLowerCase(); | 1010 | var name = elem.nodeName.toLowerCase(); |
3274 | 1017 | return (name === "input" || name === "button") && elem.type === type; | 1011 | return ( name === "input" || name === "button" ) && elem.type === type; |
3275 | 1012 | }; | ||
3276 | 1013 | } | ||
3277 | 1014 | |||
3278 | 1015 | /** | ||
3279 | 1016 | * Returns a function to use in pseudos for :enabled/:disabled | ||
3280 | 1017 | * @param {Boolean} disabled true for :disabled; false for :enabled | ||
3281 | 1018 | */ | ||
3282 | 1019 | function createDisabledPseudo( disabled ) { | ||
3283 | 1020 | |||
3284 | 1021 | // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable | ||
3285 | 1022 | return function( elem ) { | ||
3286 | 1023 | |||
3287 | 1024 | // Only certain elements can match :enabled or :disabled | ||
3288 | 1025 | // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled | ||
3289 | 1026 | // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled | ||
3290 | 1027 | if ( "form" in elem ) { | ||
3291 | 1028 | |||
3292 | 1029 | // Check for inherited disabledness on relevant non-disabled elements: | ||
3293 | 1030 | // * listed form-associated elements in a disabled fieldset | ||
3294 | 1031 | // https://html.spec.whatwg.org/multipage/forms.html#category-listed | ||
3295 | 1032 | // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled | ||
3296 | 1033 | // * option elements in a disabled optgroup | ||
3297 | 1034 | // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled | ||
3298 | 1035 | // All such elements have a "form" property. | ||
3299 | 1036 | if ( elem.parentNode && elem.disabled === false ) { | ||
3300 | 1037 | |||
3301 | 1038 | // Option elements defer to a parent optgroup if present | ||
3302 | 1039 | if ( "label" in elem ) { | ||
3303 | 1040 | if ( "label" in elem.parentNode ) { | ||
3304 | 1041 | return elem.parentNode.disabled === disabled; | ||
3305 | 1042 | } else { | ||
3306 | 1043 | return elem.disabled === disabled; | ||
3307 | 1044 | } | ||
3308 | 1045 | } | ||
3309 | 1046 | |||
3310 | 1047 | // Support: IE 6 - 11 | ||
3311 | 1048 | // Use the isDisabled shortcut property to check for disabled fieldset ancestors | ||
3312 | 1049 | return elem.isDisabled === disabled || | ||
3313 | 1050 | |||
3314 | 1051 | // Where there is no isDisabled, check manually | ||
3315 | 1052 | /* jshint -W018 */ | ||
3316 | 1053 | elem.isDisabled !== !disabled && | ||
3317 | 1054 | inDisabledFieldset( elem ) === disabled; | ||
3318 | 1055 | } | ||
3319 | 1056 | |||
3320 | 1057 | return elem.disabled === disabled; | ||
3321 | 1058 | |||
3322 | 1059 | // Try to winnow out elements that can't be disabled before trusting the disabled property. | ||
3323 | 1060 | // Some victims get caught in our net (label, legend, menu, track), but it shouldn't | ||
3324 | 1061 | // even exist on them, let alone have a boolean value. | ||
3325 | 1062 | } else if ( "label" in elem ) { | ||
3326 | 1063 | return elem.disabled === disabled; | ||
3327 | 1064 | } | ||
3328 | 1065 | |||
3329 | 1066 | // Remaining elements are neither :enabled nor :disabled | ||
3330 | 1067 | return false; | ||
3331 | 1018 | }; | 1068 | }; |
3332 | 1019 | } | 1069 | } |
3333 | 1020 | 1070 | ||
3334 | @@ -1023,21 +1073,21 @@ function createButtonPseudo( type ) { | |||
3335 | 1023 | * @param {Function} fn | 1073 | * @param {Function} fn |
3336 | 1024 | */ | 1074 | */ |
3337 | 1025 | function createPositionalPseudo( fn ) { | 1075 | function createPositionalPseudo( fn ) { |
3339 | 1026 | return markFunction(function( argument ) { | 1076 | return markFunction( function( argument ) { |
3340 | 1027 | argument = +argument; | 1077 | argument = +argument; |
3342 | 1028 | return markFunction(function( seed, matches ) { | 1078 | return markFunction( function( seed, matches ) { |
3343 | 1029 | var j, | 1079 | var j, |
3344 | 1030 | matchIndexes = fn( [], seed.length, argument ), | 1080 | matchIndexes = fn( [], seed.length, argument ), |
3345 | 1031 | i = matchIndexes.length; | 1081 | i = matchIndexes.length; |
3346 | 1032 | 1082 | ||
3347 | 1033 | // Match elements found at the specified indexes | 1083 | // Match elements found at the specified indexes |
3348 | 1034 | while ( i-- ) { | 1084 | while ( i-- ) { |
3351 | 1035 | if ( seed[ (j = matchIndexes[i]) ] ) { | 1085 | if ( seed[ ( j = matchIndexes[ i ] ) ] ) { |
3352 | 1036 | seed[j] = !(matches[j] = seed[j]); | 1086 | seed[ j ] = !( matches[ j ] = seed[ j ] ); |
3353 | 1037 | } | 1087 | } |
3354 | 1038 | } | 1088 | } |
3357 | 1039 | }); | 1089 | } ); |
3358 | 1040 | }); | 1090 | } ); |
3359 | 1041 | } | 1091 | } |
3360 | 1042 | 1092 | ||
3361 | 1043 | /** | 1093 | /** |
3362 | @@ -1058,10 +1108,13 @@ support = Sizzle.support = {}; | |||
3363 | 1058 | * @returns {Boolean} True iff elem is a non-HTML XML node | 1108 | * @returns {Boolean} True iff elem is a non-HTML XML node |
3364 | 1059 | */ | 1109 | */ |
3365 | 1060 | isXML = Sizzle.isXML = function( elem ) { | 1110 | isXML = Sizzle.isXML = function( elem ) { |
3370 | 1061 | // documentElement is verified for cases where it doesn't yet exist | 1111 | var namespace = elem.namespaceURI, |
3371 | 1062 | // (such as loading iframes in IE - #4833) | 1112 | docElem = ( elem.ownerDocument || elem ).documentElement; |
3372 | 1063 | var documentElement = elem && (elem.ownerDocument || elem).documentElement; | 1113 | |
3373 | 1064 | return documentElement ? documentElement.nodeName !== "HTML" : false; | 1114 | // Support: IE <=8 |
3374 | 1115 | // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes | ||
3375 | 1116 | // https://bugs.jquery.com/ticket/4833 | ||
3376 | 1117 | return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); | ||
3377 | 1065 | }; | 1118 | }; |
3378 | 1066 | 1119 | ||
3379 | 1067 | /** | 1120 | /** |
3380 | @@ -1070,11 +1123,15 @@ isXML = Sizzle.isXML = function( elem ) { | |||
3381 | 1070 | * @returns {Object} Returns the current document | 1123 | * @returns {Object} Returns the current document |
3382 | 1071 | */ | 1124 | */ |
3383 | 1072 | setDocument = Sizzle.setDocument = function( node ) { | 1125 | setDocument = Sizzle.setDocument = function( node ) { |
3385 | 1073 | var hasCompare, parent, | 1126 | var hasCompare, subWindow, |
3386 | 1074 | doc = node ? node.ownerDocument || node : preferredDoc; | 1127 | doc = node ? node.ownerDocument || node : preferredDoc; |
3387 | 1075 | 1128 | ||
3388 | 1076 | // Return early if doc is invalid or already selected | 1129 | // Return early if doc is invalid or already selected |
3390 | 1077 | if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { | 1130 | // Support: IE 11+, Edge 17 - 18+ |
3391 | 1131 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing | ||
3392 | 1132 | // two documents; shallow comparisons work. | ||
3393 | 1133 | // eslint-disable-next-line eqeqeq | ||
3394 | 1134 | if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { | ||
3395 | 1078 | return document; | 1135 | return document; |
3396 | 1079 | } | 1136 | } |
3397 | 1080 | 1137 | ||
3398 | @@ -1083,82 +1140,125 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3399 | 1083 | docElem = document.documentElement; | 1140 | docElem = document.documentElement; |
3400 | 1084 | documentIsHTML = !isXML( document ); | 1141 | documentIsHTML = !isXML( document ); |
3401 | 1085 | 1142 | ||
3403 | 1086 | // Support: IE 9-11, Edge | 1143 | // Support: IE 9 - 11+, Edge 12 - 18+ |
3404 | 1087 | // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) | 1144 | // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) |
3409 | 1088 | if ( (parent = document.defaultView) && parent.top !== parent ) { | 1145 | // Support: IE 11+, Edge 17 - 18+ |
3410 | 1089 | // Support: IE 11 | 1146 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
3411 | 1090 | if ( parent.addEventListener ) { | 1147 | // two documents; shallow comparisons work. |
3412 | 1091 | parent.addEventListener( "unload", unloadHandler, false ); | 1148 | // eslint-disable-next-line eqeqeq |
3413 | 1149 | if ( preferredDoc != document && | ||
3414 | 1150 | ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { | ||
3415 | 1151 | |||
3416 | 1152 | // Support: IE 11, Edge | ||
3417 | 1153 | if ( subWindow.addEventListener ) { | ||
3418 | 1154 | subWindow.addEventListener( "unload", unloadHandler, false ); | ||
3419 | 1092 | 1155 | ||
3420 | 1093 | // Support: IE 9 - 10 only | 1156 | // Support: IE 9 - 10 only |
3423 | 1094 | } else if ( parent.attachEvent ) { | 1157 | } else if ( subWindow.attachEvent ) { |
3424 | 1095 | parent.attachEvent( "onunload", unloadHandler ); | 1158 | subWindow.attachEvent( "onunload", unloadHandler ); |
3425 | 1096 | } | 1159 | } |
3426 | 1097 | } | 1160 | } |
3427 | 1098 | 1161 | ||
3428 | 1162 | // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, | ||
3429 | 1163 | // Safari 4 - 5 only, Opera <=11.6 - 12.x only | ||
3430 | 1164 | // IE/Edge & older browsers don't support the :scope pseudo-class. | ||
3431 | 1165 | // Support: Safari 6.0 only | ||
3432 | 1166 | // Safari 6.0 supports :scope but it's an alias of :root there. | ||
3433 | 1167 | support.scope = assert( function( el ) { | ||
3434 | 1168 | docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); | ||
3435 | 1169 | return typeof el.querySelectorAll !== "undefined" && | ||
3436 | 1170 | !el.querySelectorAll( ":scope fieldset div" ).length; | ||
3437 | 1171 | } ); | ||
3438 | 1172 | |||
3439 | 1099 | /* Attributes | 1173 | /* Attributes |
3440 | 1100 | ---------------------------------------------------------------------- */ | 1174 | ---------------------------------------------------------------------- */ |
3441 | 1101 | 1175 | ||
3442 | 1102 | // Support: IE<8 | 1176 | // Support: IE<8 |
3443 | 1103 | // Verify that getAttribute really returns attributes and not properties | 1177 | // Verify that getAttribute really returns attributes and not properties |
3444 | 1104 | // (excepting IE8 booleans) | 1178 | // (excepting IE8 booleans) |
3449 | 1105 | support.attributes = assert(function( div ) { | 1179 | support.attributes = assert( function( el ) { |
3450 | 1106 | div.className = "i"; | 1180 | el.className = "i"; |
3451 | 1107 | return !div.getAttribute("className"); | 1181 | return !el.getAttribute( "className" ); |
3452 | 1108 | }); | 1182 | } ); |
3453 | 1109 | 1183 | ||
3454 | 1110 | /* getElement(s)By* | 1184 | /* getElement(s)By* |
3455 | 1111 | ---------------------------------------------------------------------- */ | 1185 | ---------------------------------------------------------------------- */ |
3456 | 1112 | 1186 | ||
3457 | 1113 | // Check if getElementsByTagName("*") returns only elements | 1187 | // Check if getElementsByTagName("*") returns only elements |
3462 | 1114 | support.getElementsByTagName = assert(function( div ) { | 1188 | support.getElementsByTagName = assert( function( el ) { |
3463 | 1115 | div.appendChild( document.createComment("") ); | 1189 | el.appendChild( document.createComment( "" ) ); |
3464 | 1116 | return !div.getElementsByTagName("*").length; | 1190 | return !el.getElementsByTagName( "*" ).length; |
3465 | 1117 | }); | 1191 | } ); |
3466 | 1118 | 1192 | ||
3467 | 1119 | // Support: IE<9 | 1193 | // Support: IE<9 |
3468 | 1120 | support.getElementsByClassName = rnative.test( document.getElementsByClassName ); | 1194 | support.getElementsByClassName = rnative.test( document.getElementsByClassName ); |
3469 | 1121 | 1195 | ||
3470 | 1122 | // Support: IE<10 | 1196 | // Support: IE<10 |
3471 | 1123 | // Check if getElementById returns elements by name | 1197 | // Check if getElementById returns elements by name |
3473 | 1124 | // The broken getElementById methods don't pick up programatically-set names, | 1198 | // The broken getElementById methods don't pick up programmatically-set names, |
3474 | 1125 | // so use a roundabout getElementsByName test | 1199 | // so use a roundabout getElementsByName test |
3477 | 1126 | support.getById = assert(function( div ) { | 1200 | support.getById = assert( function( el ) { |
3478 | 1127 | docElem.appendChild( div ).id = expando; | 1201 | docElem.appendChild( el ).id = expando; |
3479 | 1128 | return !document.getElementsByName || !document.getElementsByName( expando ).length; | 1202 | return !document.getElementsByName || !document.getElementsByName( expando ).length; |
3481 | 1129 | }); | 1203 | } ); |
3482 | 1130 | 1204 | ||
3484 | 1131 | // ID find and filter | 1205 | // ID filter and find |
3485 | 1132 | if ( support.getById ) { | 1206 | if ( support.getById ) { |
3493 | 1133 | Expr.find["ID"] = function( id, context ) { | 1207 | Expr.filter[ "ID" ] = function( id ) { |
3487 | 1134 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { | ||
3488 | 1135 | var m = context.getElementById( id ); | ||
3489 | 1136 | return m ? [ m ] : []; | ||
3490 | 1137 | } | ||
3491 | 1138 | }; | ||
3492 | 1139 | Expr.filter["ID"] = function( id ) { | ||
3494 | 1140 | var attrId = id.replace( runescape, funescape ); | 1208 | var attrId = id.replace( runescape, funescape ); |
3495 | 1141 | return function( elem ) { | 1209 | return function( elem ) { |
3497 | 1142 | return elem.getAttribute("id") === attrId; | 1210 | return elem.getAttribute( "id" ) === attrId; |
3498 | 1143 | }; | 1211 | }; |
3499 | 1144 | }; | 1212 | }; |
3500 | 1213 | Expr.find[ "ID" ] = function( id, context ) { | ||
3501 | 1214 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { | ||
3502 | 1215 | var elem = context.getElementById( id ); | ||
3503 | 1216 | return elem ? [ elem ] : []; | ||
3504 | 1217 | } | ||
3505 | 1218 | }; | ||
3506 | 1145 | } else { | 1219 | } else { |
3512 | 1146 | // Support: IE6/7 | 1220 | Expr.filter[ "ID" ] = function( id ) { |
3508 | 1147 | // getElementById is not reliable as a find shortcut | ||
3509 | 1148 | delete Expr.find["ID"]; | ||
3510 | 1149 | |||
3511 | 1150 | Expr.filter["ID"] = function( id ) { | ||
3513 | 1151 | var attrId = id.replace( runescape, funescape ); | 1221 | var attrId = id.replace( runescape, funescape ); |
3514 | 1152 | return function( elem ) { | 1222 | return function( elem ) { |
3515 | 1153 | var node = typeof elem.getAttributeNode !== "undefined" && | 1223 | var node = typeof elem.getAttributeNode !== "undefined" && |
3517 | 1154 | elem.getAttributeNode("id"); | 1224 | elem.getAttributeNode( "id" ); |
3518 | 1155 | return node && node.value === attrId; | 1225 | return node && node.value === attrId; |
3519 | 1156 | }; | 1226 | }; |
3520 | 1157 | }; | 1227 | }; |
3521 | 1228 | |||
3522 | 1229 | // Support: IE 6 - 7 only | ||
3523 | 1230 | // getElementById is not reliable as a find shortcut | ||
3524 | 1231 | Expr.find[ "ID" ] = function( id, context ) { | ||
3525 | 1232 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { | ||
3526 | 1233 | var node, i, elems, | ||
3527 | 1234 | elem = context.getElementById( id ); | ||
3528 | 1235 | |||
3529 | 1236 | if ( elem ) { | ||
3530 | 1237 | |||
3531 | 1238 | // Verify the id attribute | ||
3532 | 1239 | node = elem.getAttributeNode( "id" ); | ||
3533 | 1240 | if ( node && node.value === id ) { | ||
3534 | 1241 | return [ elem ]; | ||
3535 | 1242 | } | ||
3536 | 1243 | |||
3537 | 1244 | // Fall back on getElementsByName | ||
3538 | 1245 | elems = context.getElementsByName( id ); | ||
3539 | 1246 | i = 0; | ||
3540 | 1247 | while ( ( elem = elems[ i++ ] ) ) { | ||
3541 | 1248 | node = elem.getAttributeNode( "id" ); | ||
3542 | 1249 | if ( node && node.value === id ) { | ||
3543 | 1250 | return [ elem ]; | ||
3544 | 1251 | } | ||
3545 | 1252 | } | ||
3546 | 1253 | } | ||
3547 | 1254 | |||
3548 | 1255 | return []; | ||
3549 | 1256 | } | ||
3550 | 1257 | }; | ||
3551 | 1158 | } | 1258 | } |
3552 | 1159 | 1259 | ||
3553 | 1160 | // Tag | 1260 | // Tag |
3555 | 1161 | Expr.find["TAG"] = support.getElementsByTagName ? | 1261 | Expr.find[ "TAG" ] = support.getElementsByTagName ? |
3556 | 1162 | function( tag, context ) { | 1262 | function( tag, context ) { |
3557 | 1163 | if ( typeof context.getElementsByTagName !== "undefined" ) { | 1263 | if ( typeof context.getElementsByTagName !== "undefined" ) { |
3558 | 1164 | return context.getElementsByTagName( tag ); | 1264 | return context.getElementsByTagName( tag ); |
3559 | @@ -1173,12 +1273,13 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3560 | 1173 | var elem, | 1273 | var elem, |
3561 | 1174 | tmp = [], | 1274 | tmp = [], |
3562 | 1175 | i = 0, | 1275 | i = 0, |
3563 | 1276 | |||
3564 | 1176 | // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too | 1277 | // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too |
3565 | 1177 | results = context.getElementsByTagName( tag ); | 1278 | results = context.getElementsByTagName( tag ); |
3566 | 1178 | 1279 | ||
3567 | 1179 | // Filter out possible comments | 1280 | // Filter out possible comments |
3568 | 1180 | if ( tag === "*" ) { | 1281 | if ( tag === "*" ) { |
3570 | 1181 | while ( (elem = results[i++]) ) { | 1282 | while ( ( elem = results[ i++ ] ) ) { |
3571 | 1182 | if ( elem.nodeType === 1 ) { | 1283 | if ( elem.nodeType === 1 ) { |
3572 | 1183 | tmp.push( elem ); | 1284 | tmp.push( elem ); |
3573 | 1184 | } | 1285 | } |
3574 | @@ -1190,7 +1291,7 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3575 | 1190 | }; | 1291 | }; |
3576 | 1191 | 1292 | ||
3577 | 1192 | // Class | 1293 | // Class |
3579 | 1193 | Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { | 1294 | Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { |
3580 | 1194 | if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { | 1295 | if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
3581 | 1195 | return context.getElementsByClassName( className ); | 1296 | return context.getElementsByClassName( className ); |
3582 | 1196 | } | 1297 | } |
3583 | @@ -1208,101 +1309,135 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3584 | 1208 | // We allow this because of a bug in IE8/9 that throws an error | 1309 | // We allow this because of a bug in IE8/9 that throws an error |
3585 | 1209 | // whenever `document.activeElement` is accessed on an iframe | 1310 | // whenever `document.activeElement` is accessed on an iframe |
3586 | 1210 | // So, we allow :focus to pass through QSA all the time to avoid the IE error | 1311 | // So, we allow :focus to pass through QSA all the time to avoid the IE error |
3588 | 1211 | // See http://bugs.jquery.com/ticket/13378 | 1312 | // See https://bugs.jquery.com/ticket/13378 |
3589 | 1212 | rbuggyQSA = []; | 1313 | rbuggyQSA = []; |
3590 | 1213 | 1314 | ||
3592 | 1214 | if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { | 1315 | if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { |
3593 | 1316 | |||
3594 | 1215 | // Build QSA regex | 1317 | // Build QSA regex |
3595 | 1216 | // Regex strategy adopted from Diego Perini | 1318 | // Regex strategy adopted from Diego Perini |
3597 | 1217 | assert(function( div ) { | 1319 | assert( function( el ) { |
3598 | 1320 | |||
3599 | 1321 | var input; | ||
3600 | 1322 | |||
3601 | 1218 | // Select is set to empty string on purpose | 1323 | // Select is set to empty string on purpose |
3602 | 1219 | // This is to test IE's treatment of not explicitly | 1324 | // This is to test IE's treatment of not explicitly |
3603 | 1220 | // setting a boolean content attribute, | 1325 | // setting a boolean content attribute, |
3604 | 1221 | // since its presence should be enough | 1326 | // since its presence should be enough |
3607 | 1222 | // http://bugs.jquery.com/ticket/12359 | 1327 | // https://bugs.jquery.com/ticket/12359 |
3608 | 1223 | docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + | 1328 | docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + |
3609 | 1224 | "<select id='" + expando + "-\r\\' msallowcapture=''>" + | 1329 | "<select id='" + expando + "-\r\\' msallowcapture=''>" + |
3610 | 1225 | "<option selected=''></option></select>"; | 1330 | "<option selected=''></option></select>"; |
3611 | 1226 | 1331 | ||
3612 | 1227 | // Support: IE8, Opera 11-12.16 | 1332 | // Support: IE8, Opera 11-12.16 |
3613 | 1228 | // Nothing should be selected when empty strings follow ^= or $= or *= | 1333 | // Nothing should be selected when empty strings follow ^= or $= or *= |
3614 | 1229 | // The test attribute must be unknown in Opera but "safe" for WinRT | 1334 | // The test attribute must be unknown in Opera but "safe" for WinRT |
3617 | 1230 | // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section | 1335 | // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
3618 | 1231 | if ( div.querySelectorAll("[msallowcapture^='']").length ) { | 1336 | if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { |
3619 | 1232 | rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); | 1337 | rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
3620 | 1233 | } | 1338 | } |
3621 | 1234 | 1339 | ||
3622 | 1235 | // Support: IE8 | 1340 | // Support: IE8 |
3623 | 1236 | // Boolean attributes and "value" are not treated correctly | 1341 | // Boolean attributes and "value" are not treated correctly |
3625 | 1237 | if ( !div.querySelectorAll("[selected]").length ) { | 1342 | if ( !el.querySelectorAll( "[selected]" ).length ) { |
3626 | 1238 | rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); | 1343 | rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
3627 | 1239 | } | 1344 | } |
3628 | 1240 | 1345 | ||
3629 | 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+ |
3632 | 1242 | if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { | 1347 | if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
3633 | 1243 | rbuggyQSA.push("~="); | 1348 | rbuggyQSA.push( "~=" ); |
3634 | 1349 | } | ||
3635 | 1350 | |||
3636 | 1351 | // Support: IE 11+, Edge 15 - 18+ | ||
3637 | 1352 | // IE 11/Edge don't find elements on a `[name='']` query in some cases. | ||
3638 | 1353 | // Adding a temporary attribute to the document before the selection works | ||
3639 | 1354 | // around the issue. | ||
3640 | 1355 | // Interestingly, IE 10 & older don't seem to have the issue. | ||
3641 | 1356 | input = document.createElement( "input" ); | ||
3642 | 1357 | input.setAttribute( "name", "" ); | ||
3643 | 1358 | el.appendChild( input ); | ||
3644 | 1359 | if ( !el.querySelectorAll( "[name='']" ).length ) { | ||
3645 | 1360 | rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + | ||
3646 | 1361 | whitespace + "*(?:''|\"\")" ); | ||
3647 | 1244 | } | 1362 | } |
3648 | 1245 | 1363 | ||
3649 | 1246 | // Webkit/Opera - :checked should return selected option elements | 1364 | // Webkit/Opera - :checked should return selected option elements |
3650 | 1247 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | 1365 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
3651 | 1248 | // IE8 throws error here and will not see later tests | 1366 | // IE8 throws error here and will not see later tests |
3654 | 1249 | if ( !div.querySelectorAll(":checked").length ) { | 1367 | if ( !el.querySelectorAll( ":checked" ).length ) { |
3655 | 1250 | rbuggyQSA.push(":checked"); | 1368 | rbuggyQSA.push( ":checked" ); |
3656 | 1251 | } | 1369 | } |
3657 | 1252 | 1370 | ||
3658 | 1253 | // Support: Safari 8+, iOS 8+ | 1371 | // Support: Safari 8+, iOS 8+ |
3659 | 1254 | // https://bugs.webkit.org/show_bug.cgi?id=136851 | 1372 | // https://bugs.webkit.org/show_bug.cgi?id=136851 |
3663 | 1255 | // In-page `selector#id sibing-combinator selector` fails | 1373 | // In-page `selector#id sibling-combinator selector` fails |
3664 | 1256 | if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { | 1374 | if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
3665 | 1257 | rbuggyQSA.push(".#.+[+~]"); | 1375 | rbuggyQSA.push( ".#.+[+~]" ); |
3666 | 1258 | } | 1376 | } |
3667 | 1259 | }); | ||
3668 | 1260 | 1377 | ||
3670 | 1261 | assert(function( div ) { | 1378 | // Support: Firefox <=3.6 - 5 only |
3671 | 1379 | // Old Firefox doesn't throw on a badly-escaped identifier. | ||
3672 | 1380 | el.querySelectorAll( "\\\f" ); | ||
3673 | 1381 | rbuggyQSA.push( "[\\r\\n\\f]" ); | ||
3674 | 1382 | } ); | ||
3675 | 1383 | |||
3676 | 1384 | assert( function( el ) { | ||
3677 | 1385 | el.innerHTML = "<a href='' disabled='disabled'></a>" + | ||
3678 | 1386 | "<select disabled='disabled'><option/></select>"; | ||
3679 | 1387 | |||
3680 | 1262 | // Support: Windows 8 Native Apps | 1388 | // Support: Windows 8 Native Apps |
3681 | 1263 | // The type and name attributes are restricted during .innerHTML assignment | 1389 | // The type and name attributes are restricted during .innerHTML assignment |
3683 | 1264 | var input = document.createElement("input"); | 1390 | var input = document.createElement( "input" ); |
3684 | 1265 | input.setAttribute( "type", "hidden" ); | 1391 | input.setAttribute( "type", "hidden" ); |
3686 | 1266 | div.appendChild( input ).setAttribute( "name", "D" ); | 1392 | el.appendChild( input ).setAttribute( "name", "D" ); |
3687 | 1267 | 1393 | ||
3688 | 1268 | // Support: IE8 | 1394 | // Support: IE8 |
3689 | 1269 | // Enforce case-sensitivity of name attribute | 1395 | // Enforce case-sensitivity of name attribute |
3691 | 1270 | if ( div.querySelectorAll("[name=d]").length ) { | 1396 | if ( el.querySelectorAll( "[name=d]" ).length ) { |
3692 | 1271 | rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); | 1397 | rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); |
3693 | 1272 | } | 1398 | } |
3694 | 1273 | 1399 | ||
3695 | 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) |
3696 | 1275 | // IE8 throws error here and will not see later tests | 1401 | // IE8 throws error here and will not see later tests |
3698 | 1276 | if ( !div.querySelectorAll(":enabled").length ) { | 1402 | if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { |
3699 | 1403 | rbuggyQSA.push( ":enabled", ":disabled" ); | ||
3700 | 1404 | } | ||
3701 | 1405 | |||
3702 | 1406 | // Support: IE9-11+ | ||
3703 | 1407 | // IE's :disabled selector does not pick up the children of disabled fieldsets | ||
3704 | 1408 | docElem.appendChild( el ).disabled = true; | ||
3705 | 1409 | if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { | ||
3706 | 1277 | rbuggyQSA.push( ":enabled", ":disabled" ); | 1410 | rbuggyQSA.push( ":enabled", ":disabled" ); |
3707 | 1278 | } | 1411 | } |
3708 | 1279 | 1412 | ||
3709 | 1413 | // Support: Opera 10 - 11 only | ||
3710 | 1280 | // Opera 10-11 does not throw on post-comma invalid pseudos | 1414 | // Opera 10-11 does not throw on post-comma invalid pseudos |
3714 | 1281 | div.querySelectorAll("*,:x"); | 1415 | el.querySelectorAll( "*,:x" ); |
3715 | 1282 | rbuggyQSA.push(",.*:"); | 1416 | rbuggyQSA.push( ",.*:" ); |
3716 | 1283 | }); | 1417 | } ); |
3717 | 1284 | } | 1418 | } |
3718 | 1285 | 1419 | ||
3720 | 1286 | if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || | 1420 | if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || |
3721 | 1287 | docElem.webkitMatchesSelector || | 1421 | docElem.webkitMatchesSelector || |
3722 | 1288 | docElem.mozMatchesSelector || | 1422 | docElem.mozMatchesSelector || |
3723 | 1289 | docElem.oMatchesSelector || | 1423 | docElem.oMatchesSelector || |
3725 | 1290 | docElem.msMatchesSelector) )) ) { | 1424 | docElem.msMatchesSelector ) ) ) ) { |
3726 | 1425 | |||
3727 | 1426 | assert( function( el ) { | ||
3728 | 1291 | 1427 | ||
3729 | 1292 | assert(function( div ) { | ||
3730 | 1293 | // Check to see if it's possible to do matchesSelector | 1428 | // Check to see if it's possible to do matchesSelector |
3731 | 1294 | // on a disconnected node (IE 9) | 1429 | // on a disconnected node (IE 9) |
3733 | 1295 | support.disconnectedMatch = matches.call( div, "div" ); | 1430 | support.disconnectedMatch = matches.call( el, "*" ); |
3734 | 1296 | 1431 | ||
3735 | 1297 | // This should fail with an exception | 1432 | // This should fail with an exception |
3736 | 1298 | // Gecko does not error, returns false instead | 1433 | // Gecko does not error, returns false instead |
3738 | 1299 | matches.call( div, "[s!='']:x" ); | 1434 | matches.call( el, "[s!='']:x" ); |
3739 | 1300 | rbuggyMatches.push( "!=", pseudos ); | 1435 | rbuggyMatches.push( "!=", pseudos ); |
3741 | 1301 | }); | 1436 | } ); |
3742 | 1302 | } | 1437 | } |
3743 | 1303 | 1438 | ||
3746 | 1304 | rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); | 1439 | rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); |
3747 | 1305 | rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); | 1440 | rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); |
3748 | 1306 | 1441 | ||
3749 | 1307 | /* Contains | 1442 | /* Contains |
3750 | 1308 | ---------------------------------------------------------------------- */ | 1443 | ---------------------------------------------------------------------- */ |
3751 | @@ -1319,11 +1454,11 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3752 | 1319 | adown.contains ? | 1454 | adown.contains ? |
3753 | 1320 | adown.contains( bup ) : | 1455 | adown.contains( bup ) : |
3754 | 1321 | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 | 1456 | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
3756 | 1322 | )); | 1457 | ) ); |
3757 | 1323 | } : | 1458 | } : |
3758 | 1324 | function( a, b ) { | 1459 | function( a, b ) { |
3759 | 1325 | if ( b ) { | 1460 | if ( b ) { |
3761 | 1326 | while ( (b = b.parentNode) ) { | 1461 | while ( ( b = b.parentNode ) ) { |
3762 | 1327 | if ( b === a ) { | 1462 | if ( b === a ) { |
3763 | 1328 | return true; | 1463 | return true; |
3764 | 1329 | } | 1464 | } |
3765 | @@ -1352,7 +1487,11 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3766 | 1352 | } | 1487 | } |
3767 | 1353 | 1488 | ||
3768 | 1354 | // Calculate position if both inputs belong to the same document | 1489 | // Calculate position if both inputs belong to the same document |
3770 | 1355 | compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? | 1490 | // Support: IE 11+, Edge 17 - 18+ |
3771 | 1491 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing | ||
3772 | 1492 | // two documents; shallow comparisons work. | ||
3773 | 1493 | // eslint-disable-next-line eqeqeq | ||
3774 | 1494 | compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? | ||
3775 | 1356 | a.compareDocumentPosition( b ) : | 1495 | a.compareDocumentPosition( b ) : |
3776 | 1357 | 1496 | ||
3777 | 1358 | // Otherwise we know they are disconnected | 1497 | // Otherwise we know they are disconnected |
3778 | @@ -1360,13 +1499,24 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3779 | 1360 | 1499 | ||
3780 | 1361 | // Disconnected nodes | 1500 | // Disconnected nodes |
3781 | 1362 | if ( compare & 1 || | 1501 | if ( compare & 1 || |
3783 | 1363 | (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { | 1502 | ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { |
3784 | 1364 | 1503 | ||
3785 | 1365 | // Choose the first element that is related to our preferred document | 1504 | // Choose the first element that is related to our preferred document |
3787 | 1366 | if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { | 1505 | // Support: IE 11+, Edge 17 - 18+ |
3788 | 1506 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing | ||
3789 | 1507 | // two documents; shallow comparisons work. | ||
3790 | 1508 | // eslint-disable-next-line eqeqeq | ||
3791 | 1509 | if ( a == document || a.ownerDocument == preferredDoc && | ||
3792 | 1510 | contains( preferredDoc, a ) ) { | ||
3793 | 1367 | return -1; | 1511 | return -1; |
3794 | 1368 | } | 1512 | } |
3796 | 1369 | if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { | 1513 | |
3797 | 1514 | // Support: IE 11+, Edge 17 - 18+ | ||
3798 | 1515 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing | ||
3799 | 1516 | // two documents; shallow comparisons work. | ||
3800 | 1517 | // eslint-disable-next-line eqeqeq | ||
3801 | 1518 | if ( b == document || b.ownerDocument == preferredDoc && | ||
3802 | 1519 | contains( preferredDoc, b ) ) { | ||
3803 | 1370 | return 1; | 1520 | return 1; |
3804 | 1371 | } | 1521 | } |
3805 | 1372 | 1522 | ||
3806 | @@ -1379,6 +1529,7 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3807 | 1379 | return compare & 4 ? -1 : 1; | 1529 | return compare & 4 ? -1 : 1; |
3808 | 1380 | } : | 1530 | } : |
3809 | 1381 | function( a, b ) { | 1531 | function( a, b ) { |
3810 | 1532 | |||
3811 | 1382 | // Exit early if the nodes are identical | 1533 | // Exit early if the nodes are identical |
3812 | 1383 | if ( a === b ) { | 1534 | if ( a === b ) { |
3813 | 1384 | hasDuplicate = true; | 1535 | hasDuplicate = true; |
3814 | @@ -1394,8 +1545,14 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3815 | 1394 | 1545 | ||
3816 | 1395 | // Parentless nodes are either documents or disconnected | 1546 | // Parentless nodes are either documents or disconnected |
3817 | 1396 | if ( !aup || !bup ) { | 1547 | if ( !aup || !bup ) { |
3820 | 1397 | return a === document ? -1 : | 1548 | |
3821 | 1398 | b === document ? 1 : | 1549 | // Support: IE 11+, Edge 17 - 18+ |
3822 | 1550 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing | ||
3823 | 1551 | // two documents; shallow comparisons work. | ||
3824 | 1552 | /* eslint-disable eqeqeq */ | ||
3825 | 1553 | return a == document ? -1 : | ||
3826 | 1554 | b == document ? 1 : | ||
3827 | 1555 | /* eslint-enable eqeqeq */ | ||
3828 | 1399 | aup ? -1 : | 1556 | aup ? -1 : |
3829 | 1400 | bup ? 1 : | 1557 | bup ? 1 : |
3830 | 1401 | sortInput ? | 1558 | sortInput ? |
3831 | @@ -1409,26 +1566,32 @@ setDocument = Sizzle.setDocument = function( node ) { | |||
3832 | 1409 | 1566 | ||
3833 | 1410 | // Otherwise we need full lists of their ancestors for comparison | 1567 | // Otherwise we need full lists of their ancestors for comparison |
3834 | 1411 | cur = a; | 1568 | cur = a; |
3836 | 1412 | while ( (cur = cur.parentNode) ) { | 1569 | while ( ( cur = cur.parentNode ) ) { |
3837 | 1413 | ap.unshift( cur ); | 1570 | ap.unshift( cur ); |
3838 | 1414 | } | 1571 | } |
3839 | 1415 | cur = b; | 1572 | cur = b; |
3841 | 1416 | while ( (cur = cur.parentNode) ) { | 1573 | while ( ( cur = cur.parentNode ) ) { |
3842 | 1417 | bp.unshift( cur ); | 1574 | bp.unshift( cur ); |
3843 | 1418 | } | 1575 | } |
3844 | 1419 | 1576 | ||
3845 | 1420 | // Walk down the tree looking for a discrepancy | 1577 | // Walk down the tree looking for a discrepancy |
3847 | 1421 | while ( ap[i] === bp[i] ) { | 1578 | while ( ap[ i ] === bp[ i ] ) { |
3848 | 1422 | i++; | 1579 | i++; |
3849 | 1423 | } | 1580 | } |
3850 | 1424 | 1581 | ||
3851 | 1425 | return i ? | 1582 | return i ? |
3852 | 1583 | |||
3853 | 1426 | // Do a sibling check if the nodes have a common ancestor | 1584 | // Do a sibling check if the nodes have a common ancestor |
3855 | 1427 | siblingCheck( ap[i], bp[i] ) : | 1585 | siblingCheck( ap[ i ], bp[ i ] ) : |
3856 | 1428 | 1586 | ||
3857 | 1429 | // Otherwise nodes in our document sort first | 1587 | // Otherwise nodes in our document sort first |
3860 | 1430 | ap[i] === preferredDoc ? -1 : | 1588 | // Support: IE 11+, Edge 17 - 18+ |
3861 | 1431 | bp[i] === preferredDoc ? 1 : | 1589 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
3862 | 1590 | // two documents; shallow comparisons work. | ||
3863 | 1591 | /* eslint-disable eqeqeq */ | ||
3864 | 1592 | ap[ i ] == preferredDoc ? -1 : | ||
3865 | 1593 | bp[ i ] == preferredDoc ? 1 : | ||
3866 | 1594 | /* eslint-enable eqeqeq */ | ||
3867 | 1432 | 0; | 1595 | 0; |
3868 | 1433 | }; | 1596 | }; |
3869 | 1434 | 1597 | ||
3870 | @@ -1440,16 +1603,10 @@ Sizzle.matches = function( expr, elements ) { | |||
3871 | 1440 | }; | 1603 | }; |
3872 | 1441 | 1604 | ||
3873 | 1442 | Sizzle.matchesSelector = function( elem, expr ) { | 1605 | Sizzle.matchesSelector = function( elem, expr ) { |
3881 | 1443 | // Set document vars if needed | 1606 | setDocument( elem ); |
3875 | 1444 | if ( ( elem.ownerDocument || elem ) !== document ) { | ||
3876 | 1445 | setDocument( elem ); | ||
3877 | 1446 | } | ||
3878 | 1447 | |||
3879 | 1448 | // Make sure that attribute selectors are quoted | ||
3880 | 1449 | expr = expr.replace( rattributeQuotes, "='$1']" ); | ||
3882 | 1450 | 1607 | ||
3883 | 1451 | if ( support.matchesSelector && documentIsHTML && | 1608 | if ( support.matchesSelector && documentIsHTML && |
3885 | 1452 | !compilerCache[ expr + " " ] && | 1609 | !nonnativeSelectorCache[ expr + " " ] && |
3886 | 1453 | ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && | 1610 | ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && |
3887 | 1454 | ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { | 1611 | ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
3888 | 1455 | 1612 | ||
3889 | @@ -1458,32 +1615,46 @@ Sizzle.matchesSelector = function( elem, expr ) { | |||
3890 | 1458 | 1615 | ||
3891 | 1459 | // IE 9's matchesSelector returns false on disconnected nodes | 1616 | // IE 9's matchesSelector returns false on disconnected nodes |
3892 | 1460 | if ( ret || support.disconnectedMatch || | 1617 | if ( ret || support.disconnectedMatch || |
3896 | 1461 | // As well, disconnected nodes are said to be in a document | 1618 | |
3897 | 1462 | // fragment in IE 9 | 1619 | // As well, disconnected nodes are said to be in a document |
3898 | 1463 | elem.document && elem.document.nodeType !== 11 ) { | 1620 | // fragment in IE 9 |
3899 | 1621 | elem.document && elem.document.nodeType !== 11 ) { | ||
3900 | 1464 | return ret; | 1622 | return ret; |
3901 | 1465 | } | 1623 | } |
3903 | 1466 | } catch (e) {} | 1624 | } catch ( e ) { |
3904 | 1625 | nonnativeSelectorCache( expr, true ); | ||
3905 | 1626 | } | ||
3906 | 1467 | } | 1627 | } |
3907 | 1468 | 1628 | ||
3908 | 1469 | return Sizzle( expr, document, null, [ elem ] ).length > 0; | 1629 | return Sizzle( expr, document, null, [ elem ] ).length > 0; |
3909 | 1470 | }; | 1630 | }; |
3910 | 1471 | 1631 | ||
3911 | 1472 | Sizzle.contains = function( context, elem ) { | 1632 | Sizzle.contains = function( context, elem ) { |
3912 | 1633 | |||
3913 | 1473 | // Set document vars if needed | 1634 | // Set document vars if needed |
3915 | 1474 | if ( ( context.ownerDocument || context ) !== document ) { | 1635 | // Support: IE 11+, Edge 17 - 18+ |
3916 | 1636 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing | ||
3917 | 1637 | // two documents; shallow comparisons work. | ||
3918 | 1638 | // eslint-disable-next-line eqeqeq | ||
3919 | 1639 | if ( ( context.ownerDocument || context ) != document ) { | ||
3920 | 1475 | setDocument( context ); | 1640 | setDocument( context ); |
3921 | 1476 | } | 1641 | } |
3922 | 1477 | return contains( context, elem ); | 1642 | return contains( context, elem ); |
3923 | 1478 | }; | 1643 | }; |
3924 | 1479 | 1644 | ||
3925 | 1480 | Sizzle.attr = function( elem, name ) { | 1645 | Sizzle.attr = function( elem, name ) { |
3926 | 1646 | |||
3927 | 1481 | // Set document vars if needed | 1647 | // Set document vars if needed |
3929 | 1482 | if ( ( elem.ownerDocument || elem ) !== document ) { | 1648 | // Support: IE 11+, Edge 17 - 18+ |
3930 | 1649 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing | ||
3931 | 1650 | // two documents; shallow comparisons work. | ||
3932 | 1651 | // eslint-disable-next-line eqeqeq | ||
3933 | 1652 | if ( ( elem.ownerDocument || elem ) != document ) { | ||
3934 | 1483 | setDocument( elem ); | 1653 | setDocument( elem ); |
3935 | 1484 | } | 1654 | } |
3936 | 1485 | 1655 | ||
3937 | 1486 | var fn = Expr.attrHandle[ name.toLowerCase() ], | 1656 | var fn = Expr.attrHandle[ name.toLowerCase() ], |
3938 | 1657 | |||
3939 | 1487 | // Don't get fooled by Object.prototype properties (jQuery #13807) | 1658 | // Don't get fooled by Object.prototype properties (jQuery #13807) |
3940 | 1488 | val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? | 1659 | val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
3941 | 1489 | fn( elem, name, !documentIsHTML ) : | 1660 | fn( elem, name, !documentIsHTML ) : |
3942 | @@ -1493,11 +1664,15 @@ Sizzle.attr = function( elem, name ) { | |||
3943 | 1493 | val : | 1664 | val : |
3944 | 1494 | support.attributes || !documentIsHTML ? | 1665 | support.attributes || !documentIsHTML ? |
3945 | 1495 | elem.getAttribute( name ) : | 1666 | elem.getAttribute( name ) : |
3947 | 1496 | (val = elem.getAttributeNode(name)) && val.specified ? | 1667 | ( val = elem.getAttributeNode( name ) ) && val.specified ? |
3948 | 1497 | val.value : | 1668 | val.value : |
3949 | 1498 | null; | 1669 | null; |
3950 | 1499 | }; | 1670 | }; |
3951 | 1500 | 1671 | ||
3952 | 1672 | Sizzle.escape = function( sel ) { | ||
3953 | 1673 | return ( sel + "" ).replace( rcssescape, fcssescape ); | ||
3954 | 1674 | }; | ||
3955 | 1675 | |||
3956 | 1501 | Sizzle.error = function( msg ) { | 1676 | Sizzle.error = function( msg ) { |
3957 | 1502 | throw new Error( "Syntax error, unrecognized expression: " + msg ); | 1677 | throw new Error( "Syntax error, unrecognized expression: " + msg ); |
3958 | 1503 | }; | 1678 | }; |
3959 | @@ -1518,7 +1693,7 @@ Sizzle.uniqueSort = function( results ) { | |||
3960 | 1518 | results.sort( sortOrder ); | 1693 | results.sort( sortOrder ); |
3961 | 1519 | 1694 | ||
3962 | 1520 | if ( hasDuplicate ) { | 1695 | if ( hasDuplicate ) { |
3964 | 1521 | while ( (elem = results[i++]) ) { | 1696 | while ( ( elem = results[ i++ ] ) ) { |
3965 | 1522 | if ( elem === results[ i ] ) { | 1697 | if ( elem === results[ i ] ) { |
3966 | 1523 | j = duplicates.push( i ); | 1698 | j = duplicates.push( i ); |
3967 | 1524 | } | 1699 | } |
3968 | @@ -1546,17 +1721,21 @@ getText = Sizzle.getText = function( elem ) { | |||
3969 | 1546 | nodeType = elem.nodeType; | 1721 | nodeType = elem.nodeType; |
3970 | 1547 | 1722 | ||
3971 | 1548 | if ( !nodeType ) { | 1723 | if ( !nodeType ) { |
3972 | 1724 | |||
3973 | 1549 | // If no nodeType, this is expected to be an array | 1725 | // If no nodeType, this is expected to be an array |
3975 | 1550 | while ( (node = elem[i++]) ) { | 1726 | while ( ( node = elem[ i++ ] ) ) { |
3976 | 1727 | |||
3977 | 1551 | // Do not traverse comment nodes | 1728 | // Do not traverse comment nodes |
3978 | 1552 | ret += getText( node ); | 1729 | ret += getText( node ); |
3979 | 1553 | } | 1730 | } |
3980 | 1554 | } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { | 1731 | } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
3981 | 1732 | |||
3982 | 1555 | // Use textContent for elements | 1733 | // Use textContent for elements |
3983 | 1556 | // innerText usage removed for consistency of new lines (jQuery #11153) | 1734 | // innerText usage removed for consistency of new lines (jQuery #11153) |
3984 | 1557 | if ( typeof elem.textContent === "string" ) { | 1735 | if ( typeof elem.textContent === "string" ) { |
3985 | 1558 | return elem.textContent; | 1736 | return elem.textContent; |
3986 | 1559 | } else { | 1737 | } else { |
3987 | 1738 | |||
3988 | 1560 | // Traverse its children | 1739 | // Traverse its children |
3989 | 1561 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { | 1740 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
3990 | 1562 | ret += getText( elem ); | 1741 | ret += getText( elem ); |
3991 | @@ -1565,6 +1744,7 @@ getText = Sizzle.getText = function( elem ) { | |||
3992 | 1565 | } else if ( nodeType === 3 || nodeType === 4 ) { | 1744 | } else if ( nodeType === 3 || nodeType === 4 ) { |
3993 | 1566 | return elem.nodeValue; | 1745 | return elem.nodeValue; |
3994 | 1567 | } | 1746 | } |
3995 | 1747 | |||
3996 | 1568 | // Do not include comment or processing instruction nodes | 1748 | // Do not include comment or processing instruction nodes |
3997 | 1569 | 1749 | ||
3998 | 1570 | return ret; | 1750 | return ret; |
3999 | @@ -1592,19 +1772,21 @@ Expr = Sizzle.selectors = { | |||
4000 | 1592 | 1772 | ||
4001 | 1593 | preFilter: { | 1773 | preFilter: { |
4002 | 1594 | "ATTR": function( match ) { | 1774 | "ATTR": function( match ) { |
4004 | 1595 | match[1] = match[1].replace( runescape, funescape ); | 1775 | match[ 1 ] = match[ 1 ].replace( runescape, funescape ); |
4005 | 1596 | 1776 | ||
4006 | 1597 | // Move the given value to match[3] whether quoted or unquoted | 1777 | // Move the given value to match[3] whether quoted or unquoted |
4008 | 1598 | match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); | 1778 | match[ 3 ] = ( match[ 3 ] || match[ 4 ] || |
4009 | 1779 | match[ 5 ] || "" ).replace( runescape, funescape ); | ||
4010 | 1599 | 1780 | ||
4013 | 1600 | if ( match[2] === "~=" ) { | 1781 | if ( match[ 2 ] === "~=" ) { |
4014 | 1601 | match[3] = " " + match[3] + " "; | 1782 | match[ 3 ] = " " + match[ 3 ] + " "; |
4015 | 1602 | } | 1783 | } |
4016 | 1603 | 1784 | ||
4017 | 1604 | return match.slice( 0, 4 ); | 1785 | return match.slice( 0, 4 ); |
4018 | 1605 | }, | 1786 | }, |
4019 | 1606 | 1787 | ||
4020 | 1607 | "CHILD": function( match ) { | 1788 | "CHILD": function( match ) { |
4021 | 1789 | |||
4022 | 1608 | /* matches from matchExpr["CHILD"] | 1790 | /* matches from matchExpr["CHILD"] |
4023 | 1609 | 1 type (only|nth|...) | 1791 | 1 type (only|nth|...) |
4024 | 1610 | 2 what (child|of-type) | 1792 | 2 what (child|of-type) |
4025 | @@ -1615,22 +1797,25 @@ Expr = Sizzle.selectors = { | |||
4026 | 1615 | 7 sign of y-component | 1797 | 7 sign of y-component |
4027 | 1616 | 8 y of y-component | 1798 | 8 y of y-component |
4028 | 1617 | */ | 1799 | */ |
4030 | 1618 | match[1] = match[1].toLowerCase(); | 1800 | match[ 1 ] = match[ 1 ].toLowerCase(); |
4031 | 1801 | |||
4032 | 1802 | if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { | ||
4033 | 1619 | 1803 | ||
4034 | 1620 | if ( match[1].slice( 0, 3 ) === "nth" ) { | ||
4035 | 1621 | // nth-* requires argument | 1804 | // nth-* requires argument |
4038 | 1622 | if ( !match[3] ) { | 1805 | if ( !match[ 3 ] ) { |
4039 | 1623 | Sizzle.error( match[0] ); | 1806 | Sizzle.error( match[ 0 ] ); |
4040 | 1624 | } | 1807 | } |
4041 | 1625 | 1808 | ||
4042 | 1626 | // numeric x and y parameters for Expr.filter.CHILD | 1809 | // numeric x and y parameters for Expr.filter.CHILD |
4043 | 1627 | // remember that false/true cast respectively to 0/1 | 1810 | // remember that false/true cast respectively to 0/1 |
4046 | 1628 | match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); | 1811 | match[ 4 ] = +( match[ 4 ] ? |
4047 | 1629 | match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); | 1812 | match[ 5 ] + ( match[ 6 ] || 1 ) : |
4048 | 1813 | 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); | ||
4049 | 1814 | match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); | ||
4050 | 1630 | 1815 | ||
4054 | 1631 | // other types prohibit arguments | 1816 | // other types prohibit arguments |
4055 | 1632 | } else if ( match[3] ) { | 1817 | } else if ( match[ 3 ] ) { |
4056 | 1633 | Sizzle.error( match[0] ); | 1818 | Sizzle.error( match[ 0 ] ); |
4057 | 1634 | } | 1819 | } |
4058 | 1635 | 1820 | ||
4059 | 1636 | return match; | 1821 | return match; |
4060 | @@ -1638,26 +1823,28 @@ Expr = Sizzle.selectors = { | |||
4061 | 1638 | 1823 | ||
4062 | 1639 | "PSEUDO": function( match ) { | 1824 | "PSEUDO": function( match ) { |
4063 | 1640 | var excess, | 1825 | var excess, |
4065 | 1641 | unquoted = !match[6] && match[2]; | 1826 | unquoted = !match[ 6 ] && match[ 2 ]; |
4066 | 1642 | 1827 | ||
4068 | 1643 | if ( matchExpr["CHILD"].test( match[0] ) ) { | 1828 | if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { |
4069 | 1644 | return null; | 1829 | return null; |
4070 | 1645 | } | 1830 | } |
4071 | 1646 | 1831 | ||
4072 | 1647 | // Accept quoted arguments as-is | 1832 | // Accept quoted arguments as-is |
4075 | 1648 | if ( match[3] ) { | 1833 | if ( match[ 3 ] ) { |
4076 | 1649 | match[2] = match[4] || match[5] || ""; | 1834 | match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; |
4077 | 1650 | 1835 | ||
4078 | 1651 | // Strip excess characters from unquoted arguments | 1836 | // Strip excess characters from unquoted arguments |
4079 | 1652 | } else if ( unquoted && rpseudo.test( unquoted ) && | 1837 | } else if ( unquoted && rpseudo.test( unquoted ) && |
4080 | 1838 | |||
4081 | 1653 | // Get excess from tokenize (recursively) | 1839 | // Get excess from tokenize (recursively) |
4083 | 1654 | (excess = tokenize( unquoted, true )) && | 1840 | ( excess = tokenize( unquoted, true ) ) && |
4084 | 1841 | |||
4085 | 1655 | // advance to the next closing parenthesis | 1842 | // advance to the next closing parenthesis |
4087 | 1656 | (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { | 1843 | ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { |
4088 | 1657 | 1844 | ||
4089 | 1658 | // excess is a negative index | 1845 | // excess is a negative index |
4092 | 1659 | match[0] = match[0].slice( 0, excess ); | 1846 | match[ 0 ] = match[ 0 ].slice( 0, excess ); |
4093 | 1660 | match[2] = unquoted.slice( 0, excess ); | 1847 | match[ 2 ] = unquoted.slice( 0, excess ); |
4094 | 1661 | } | 1848 | } |
4095 | 1662 | 1849 | ||
4096 | 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) |
4097 | @@ -1670,7 +1857,9 @@ Expr = Sizzle.selectors = { | |||
4098 | 1670 | "TAG": function( nodeNameSelector ) { | 1857 | "TAG": function( nodeNameSelector ) { |
4099 | 1671 | var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); | 1858 | var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
4100 | 1672 | return nodeNameSelector === "*" ? | 1859 | return nodeNameSelector === "*" ? |
4102 | 1673 | function() { return true; } : | 1860 | function() { |
4103 | 1861 | return true; | ||
4104 | 1862 | } : | ||
4105 | 1674 | function( elem ) { | 1863 | function( elem ) { |
4106 | 1675 | return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; | 1864 | return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
4107 | 1676 | }; | 1865 | }; |
4108 | @@ -1680,10 +1869,16 @@ Expr = Sizzle.selectors = { | |||
4109 | 1680 | var pattern = classCache[ className + " " ]; | 1869 | var pattern = classCache[ className + " " ]; |
4110 | 1681 | 1870 | ||
4111 | 1682 | return pattern || | 1871 | return pattern || |
4116 | 1683 | (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && | 1872 | ( pattern = new RegExp( "(^|" + whitespace + |
4117 | 1684 | classCache( className, function( elem ) { | 1873 | ")" + className + "(" + whitespace + "|$)" ) ) && classCache( |
4118 | 1685 | return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); | 1874 | className, function( elem ) { |
4119 | 1686 | }); | 1875 | return pattern.test( |
4120 | 1876 | typeof elem.className === "string" && elem.className || | ||
4121 | 1877 | typeof elem.getAttribute !== "undefined" && | ||
4122 | 1878 | elem.getAttribute( "class" ) || | ||
4123 | 1879 | "" | ||
4124 | 1880 | ); | ||
4125 | 1881 | } ); | ||
4126 | 1687 | }, | 1882 | }, |
4127 | 1688 | 1883 | ||
4128 | 1689 | "ATTR": function( name, operator, check ) { | 1884 | "ATTR": function( name, operator, check ) { |
4129 | @@ -1699,6 +1894,8 @@ Expr = Sizzle.selectors = { | |||
4130 | 1699 | 1894 | ||
4131 | 1700 | result += ""; | 1895 | result += ""; |
4132 | 1701 | 1896 | ||
4133 | 1897 | /* eslint-disable max-len */ | ||
4134 | 1898 | |||
4135 | 1702 | return operator === "=" ? result === check : | 1899 | return operator === "=" ? result === check : |
4136 | 1703 | operator === "!=" ? result !== check : | 1900 | operator === "!=" ? result !== check : |
4137 | 1704 | operator === "^=" ? check && result.indexOf( check ) === 0 : | 1901 | operator === "^=" ? check && result.indexOf( check ) === 0 : |
4138 | @@ -1707,10 +1904,12 @@ Expr = Sizzle.selectors = { | |||
4139 | 1707 | operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : | 1904 | operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : |
4140 | 1708 | operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : | 1905 | operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : |
4141 | 1709 | false; | 1906 | false; |
4142 | 1907 | /* eslint-enable max-len */ | ||
4143 | 1908 | |||
4144 | 1710 | }; | 1909 | }; |
4145 | 1711 | }, | 1910 | }, |
4146 | 1712 | 1911 | ||
4148 | 1713 | "CHILD": function( type, what, argument, first, last ) { | 1912 | "CHILD": function( type, what, _argument, first, last ) { |
4149 | 1714 | var simple = type.slice( 0, 3 ) !== "nth", | 1913 | var simple = type.slice( 0, 3 ) !== "nth", |
4150 | 1715 | forward = type.slice( -4 ) !== "last", | 1914 | forward = type.slice( -4 ) !== "last", |
4151 | 1716 | ofType = what === "of-type"; | 1915 | ofType = what === "of-type"; |
4152 | @@ -1722,7 +1921,7 @@ Expr = Sizzle.selectors = { | |||
4153 | 1722 | return !!elem.parentNode; | 1921 | return !!elem.parentNode; |
4154 | 1723 | } : | 1922 | } : |
4155 | 1724 | 1923 | ||
4157 | 1725 | function( elem, context, xml ) { | 1924 | function( elem, _context, xml ) { |
4158 | 1726 | var cache, uniqueCache, outerCache, node, nodeIndex, start, | 1925 | var cache, uniqueCache, outerCache, node, nodeIndex, start, |
4159 | 1727 | dir = simple !== forward ? "nextSibling" : "previousSibling", | 1926 | dir = simple !== forward ? "nextSibling" : "previousSibling", |
4160 | 1728 | parent = elem.parentNode, | 1927 | parent = elem.parentNode, |
4161 | @@ -1736,7 +1935,7 @@ Expr = Sizzle.selectors = { | |||
4162 | 1736 | if ( simple ) { | 1935 | if ( simple ) { |
4163 | 1737 | while ( dir ) { | 1936 | while ( dir ) { |
4164 | 1738 | node = elem; | 1937 | node = elem; |
4166 | 1739 | while ( (node = node[ dir ]) ) { | 1938 | while ( ( node = node[ dir ] ) ) { |
4167 | 1740 | if ( ofType ? | 1939 | if ( ofType ? |
4168 | 1741 | node.nodeName.toLowerCase() === name : | 1940 | node.nodeName.toLowerCase() === name : |
4169 | 1742 | node.nodeType === 1 ) { | 1941 | node.nodeType === 1 ) { |
4170 | @@ -1744,6 +1943,7 @@ Expr = Sizzle.selectors = { | |||
4171 | 1744 | return false; | 1943 | return false; |
4172 | 1745 | } | 1944 | } |
4173 | 1746 | } | 1945 | } |
4174 | 1946 | |||
4175 | 1747 | // Reverse direction for :only-* (if we haven't yet done so) | 1947 | // Reverse direction for :only-* (if we haven't yet done so) |
4176 | 1748 | start = dir = type === "only" && !start && "nextSibling"; | 1948 | start = dir = type === "only" && !start && "nextSibling"; |
4177 | 1749 | } | 1949 | } |
4178 | @@ -1759,22 +1959,22 @@ Expr = Sizzle.selectors = { | |||
4179 | 1759 | 1959 | ||
4180 | 1760 | // ...in a gzip-friendly way | 1960 | // ...in a gzip-friendly way |
4181 | 1761 | node = parent; | 1961 | node = parent; |
4183 | 1762 | outerCache = node[ expando ] || (node[ expando ] = {}); | 1962 | outerCache = node[ expando ] || ( node[ expando ] = {} ); |
4184 | 1763 | 1963 | ||
4185 | 1764 | // Support: IE <9 only | 1964 | // Support: IE <9 only |
4186 | 1765 | // Defend against cloned attroperties (jQuery gh-1709) | 1965 | // Defend against cloned attroperties (jQuery gh-1709) |
4187 | 1766 | uniqueCache = outerCache[ node.uniqueID ] || | 1966 | uniqueCache = outerCache[ node.uniqueID ] || |
4189 | 1767 | (outerCache[ node.uniqueID ] = {}); | 1967 | ( outerCache[ node.uniqueID ] = {} ); |
4190 | 1768 | 1968 | ||
4191 | 1769 | cache = uniqueCache[ type ] || []; | 1969 | cache = uniqueCache[ type ] || []; |
4192 | 1770 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; | 1970 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
4193 | 1771 | diff = nodeIndex && cache[ 2 ]; | 1971 | diff = nodeIndex && cache[ 2 ]; |
4194 | 1772 | node = nodeIndex && parent.childNodes[ nodeIndex ]; | 1972 | node = nodeIndex && parent.childNodes[ nodeIndex ]; |
4195 | 1773 | 1973 | ||
4197 | 1774 | while ( (node = ++nodeIndex && node && node[ dir ] || | 1974 | while ( ( node = ++nodeIndex && node && node[ dir ] || |
4198 | 1775 | 1975 | ||
4199 | 1776 | // Fallback to seeking `elem` from the start | 1976 | // Fallback to seeking `elem` from the start |
4201 | 1777 | (diff = nodeIndex = 0) || start.pop()) ) { | 1977 | ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
4202 | 1778 | 1978 | ||
4203 | 1779 | // When found, cache indexes on `parent` and break | 1979 | // When found, cache indexes on `parent` and break |
4204 | 1780 | if ( node.nodeType === 1 && ++diff && node === elem ) { | 1980 | if ( node.nodeType === 1 && ++diff && node === elem ) { |
4205 | @@ -1784,16 +1984,18 @@ Expr = Sizzle.selectors = { | |||
4206 | 1784 | } | 1984 | } |
4207 | 1785 | 1985 | ||
4208 | 1786 | } else { | 1986 | } else { |
4209 | 1987 | |||
4210 | 1787 | // Use previously-cached element index if available | 1988 | // Use previously-cached element index if available |
4211 | 1788 | if ( useCache ) { | 1989 | if ( useCache ) { |
4212 | 1990 | |||
4213 | 1789 | // ...in a gzip-friendly way | 1991 | // ...in a gzip-friendly way |
4214 | 1790 | node = elem; | 1992 | node = elem; |
4216 | 1791 | outerCache = node[ expando ] || (node[ expando ] = {}); | 1993 | outerCache = node[ expando ] || ( node[ expando ] = {} ); |
4217 | 1792 | 1994 | ||
4218 | 1793 | // Support: IE <9 only | 1995 | // Support: IE <9 only |
4219 | 1794 | // Defend against cloned attroperties (jQuery gh-1709) | 1996 | // Defend against cloned attroperties (jQuery gh-1709) |
4220 | 1795 | uniqueCache = outerCache[ node.uniqueID ] || | 1997 | uniqueCache = outerCache[ node.uniqueID ] || |
4222 | 1796 | (outerCache[ node.uniqueID ] = {}); | 1998 | ( outerCache[ node.uniqueID ] = {} ); |
4223 | 1797 | 1999 | ||
4224 | 1798 | cache = uniqueCache[ type ] || []; | 2000 | cache = uniqueCache[ type ] || []; |
4225 | 1799 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; | 2001 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
4226 | @@ -1803,9 +2005,10 @@ Expr = Sizzle.selectors = { | |||
4227 | 1803 | // xml :nth-child(...) | 2005 | // xml :nth-child(...) |
4228 | 1804 | // or :nth-last-child(...) or :nth(-last)?-of-type(...) | 2006 | // or :nth-last-child(...) or :nth(-last)?-of-type(...) |
4229 | 1805 | if ( diff === false ) { | 2007 | if ( diff === false ) { |
4230 | 2008 | |||
4231 | 1806 | // Use the same loop as above to seek `elem` from the start | 2009 | // Use the same loop as above to seek `elem` from the start |
4234 | 1807 | while ( (node = ++nodeIndex && node && node[ dir ] || | 2010 | while ( ( node = ++nodeIndex && node && node[ dir ] || |
4235 | 1808 | (diff = nodeIndex = 0) || start.pop()) ) { | 2011 | ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
4236 | 1809 | 2012 | ||
4237 | 1810 | if ( ( ofType ? | 2013 | if ( ( ofType ? |
4238 | 1811 | node.nodeName.toLowerCase() === name : | 2014 | node.nodeName.toLowerCase() === name : |
4239 | @@ -1814,12 +2017,13 @@ Expr = Sizzle.selectors = { | |||
4240 | 1814 | 2017 | ||
4241 | 1815 | // Cache the index of each encountered element | 2018 | // Cache the index of each encountered element |
4242 | 1816 | if ( useCache ) { | 2019 | if ( useCache ) { |
4244 | 1817 | outerCache = node[ expando ] || (node[ expando ] = {}); | 2020 | outerCache = node[ expando ] || |
4245 | 2021 | ( node[ expando ] = {} ); | ||
4246 | 1818 | 2022 | ||
4247 | 1819 | // Support: IE <9 only | 2023 | // Support: IE <9 only |
4248 | 1820 | // Defend against cloned attroperties (jQuery gh-1709) | 2024 | // Defend against cloned attroperties (jQuery gh-1709) |
4249 | 1821 | uniqueCache = outerCache[ node.uniqueID ] || | 2025 | uniqueCache = outerCache[ node.uniqueID ] || |
4251 | 1822 | (outerCache[ node.uniqueID ] = {}); | 2026 | ( outerCache[ node.uniqueID ] = {} ); |
4252 | 1823 | 2027 | ||
4253 | 1824 | uniqueCache[ type ] = [ dirruns, diff ]; | 2028 | uniqueCache[ type ] = [ dirruns, diff ]; |
4254 | 1825 | } | 2029 | } |
4255 | @@ -1840,6 +2044,7 @@ Expr = Sizzle.selectors = { | |||
4256 | 1840 | }, | 2044 | }, |
4257 | 1841 | 2045 | ||
4258 | 1842 | "PSEUDO": function( pseudo, argument ) { | 2046 | "PSEUDO": function( pseudo, argument ) { |
4259 | 2047 | |||
4260 | 1843 | // pseudo-class names are case-insensitive | 2048 | // pseudo-class names are case-insensitive |
4261 | 1844 | // http://www.w3.org/TR/selectors/#pseudo-classes | 2049 | // http://www.w3.org/TR/selectors/#pseudo-classes |
4262 | 1845 | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters | 2050 | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
4263 | @@ -1859,15 +2064,15 @@ Expr = Sizzle.selectors = { | |||
4264 | 1859 | if ( fn.length > 1 ) { | 2064 | if ( fn.length > 1 ) { |
4265 | 1860 | args = [ pseudo, pseudo, "", argument ]; | 2065 | args = [ pseudo, pseudo, "", argument ]; |
4266 | 1861 | return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? | 2066 | return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
4268 | 1862 | markFunction(function( seed, matches ) { | 2067 | markFunction( function( seed, matches ) { |
4269 | 1863 | var idx, | 2068 | var idx, |
4270 | 1864 | matched = fn( seed, argument ), | 2069 | matched = fn( seed, argument ), |
4271 | 1865 | i = matched.length; | 2070 | i = matched.length; |
4272 | 1866 | while ( i-- ) { | 2071 | while ( i-- ) { |
4275 | 1867 | idx = indexOf( seed, matched[i] ); | 2072 | idx = indexOf( seed, matched[ i ] ); |
4276 | 1868 | seed[ idx ] = !( matches[ idx ] = matched[i] ); | 2073 | seed[ idx ] = !( matches[ idx ] = matched[ i ] ); |
4277 | 1869 | } | 2074 | } |
4279 | 1870 | }) : | 2075 | } ) : |
4280 | 1871 | function( elem ) { | 2076 | function( elem ) { |
4281 | 1872 | return fn( elem, 0, args ); | 2077 | return fn( elem, 0, args ); |
4282 | 1873 | }; | 2078 | }; |
4283 | @@ -1878,8 +2083,10 @@ Expr = Sizzle.selectors = { | |||
4284 | 1878 | }, | 2083 | }, |
4285 | 1879 | 2084 | ||
4286 | 1880 | pseudos: { | 2085 | pseudos: { |
4287 | 2086 | |||
4288 | 1881 | // Potentially complex pseudos | 2087 | // Potentially complex pseudos |
4290 | 1882 | "not": markFunction(function( selector ) { | 2088 | "not": markFunction( function( selector ) { |
4291 | 2089 | |||
4292 | 1883 | // Trim the selector passed to compile | 2090 | // Trim the selector passed to compile |
4293 | 1884 | // to avoid treating leading and trailing | 2091 | // to avoid treating leading and trailing |
4294 | 1885 | // spaces as combinators | 2092 | // spaces as combinators |
4295 | @@ -1888,39 +2095,40 @@ Expr = Sizzle.selectors = { | |||
4296 | 1888 | matcher = compile( selector.replace( rtrim, "$1" ) ); | 2095 | matcher = compile( selector.replace( rtrim, "$1" ) ); |
4297 | 1889 | 2096 | ||
4298 | 1890 | return matcher[ expando ] ? | 2097 | return matcher[ expando ] ? |
4300 | 1891 | markFunction(function( seed, matches, context, xml ) { | 2098 | markFunction( function( seed, matches, _context, xml ) { |
4301 | 1892 | var elem, | 2099 | var elem, |
4302 | 1893 | unmatched = matcher( seed, null, xml, [] ), | 2100 | unmatched = matcher( seed, null, xml, [] ), |
4303 | 1894 | i = seed.length; | 2101 | i = seed.length; |
4304 | 1895 | 2102 | ||
4305 | 1896 | // Match elements unmatched by `matcher` | 2103 | // Match elements unmatched by `matcher` |
4306 | 1897 | while ( i-- ) { | 2104 | while ( i-- ) { |
4309 | 1898 | if ( (elem = unmatched[i]) ) { | 2105 | if ( ( elem = unmatched[ i ] ) ) { |
4310 | 1899 | seed[i] = !(matches[i] = elem); | 2106 | seed[ i ] = !( matches[ i ] = elem ); |
4311 | 1900 | } | 2107 | } |
4312 | 1901 | } | 2108 | } |
4316 | 1902 | }) : | 2109 | } ) : |
4317 | 1903 | function( elem, context, xml ) { | 2110 | function( elem, _context, xml ) { |
4318 | 1904 | input[0] = elem; | 2111 | input[ 0 ] = elem; |
4319 | 1905 | matcher( input, null, xml, results ); | 2112 | matcher( input, null, xml, results ); |
4320 | 2113 | |||
4321 | 1906 | // Don't keep the element (issue #299) | 2114 | // Don't keep the element (issue #299) |
4323 | 1907 | input[0] = null; | 2115 | input[ 0 ] = null; |
4324 | 1908 | return !results.pop(); | 2116 | return !results.pop(); |
4325 | 1909 | }; | 2117 | }; |
4327 | 1910 | }), | 2118 | } ), |
4328 | 1911 | 2119 | ||
4330 | 1912 | "has": markFunction(function( selector ) { | 2120 | "has": markFunction( function( selector ) { |
4331 | 1913 | return function( elem ) { | 2121 | return function( elem ) { |
4332 | 1914 | return Sizzle( selector, elem ).length > 0; | 2122 | return Sizzle( selector, elem ).length > 0; |
4333 | 1915 | }; | 2123 | }; |
4335 | 1916 | }), | 2124 | } ), |
4336 | 1917 | 2125 | ||
4338 | 1918 | "contains": markFunction(function( text ) { | 2126 | "contains": markFunction( function( text ) { |
4339 | 1919 | text = text.replace( runescape, funescape ); | 2127 | text = text.replace( runescape, funescape ); |
4340 | 1920 | return function( elem ) { | 2128 | return function( elem ) { |
4342 | 1921 | return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; | 2129 | return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; |
4343 | 1922 | }; | 2130 | }; |
4345 | 1923 | }), | 2131 | } ), |
4346 | 1924 | 2132 | ||
4347 | 1925 | // "Whether an element is represented by a :lang() selector | 2133 | // "Whether an element is represented by a :lang() selector |
4348 | 1926 | // is based solely on the element's language value | 2134 | // is based solely on the element's language value |
4349 | @@ -1930,25 +2138,26 @@ Expr = Sizzle.selectors = { | |||
4350 | 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." |
4351 | 1931 | // http://www.w3.org/TR/selectors/#lang-pseudo | 2139 | // http://www.w3.org/TR/selectors/#lang-pseudo |
4352 | 1932 | "lang": markFunction( function( lang ) { | 2140 | "lang": markFunction( function( lang ) { |
4353 | 2141 | |||
4354 | 1933 | // lang value must be a valid identifier | 2142 | // lang value must be a valid identifier |
4356 | 1934 | if ( !ridentifier.test(lang || "") ) { | 2143 | if ( !ridentifier.test( lang || "" ) ) { |
4357 | 1935 | Sizzle.error( "unsupported lang: " + lang ); | 2144 | Sizzle.error( "unsupported lang: " + lang ); |
4358 | 1936 | } | 2145 | } |
4359 | 1937 | lang = lang.replace( runescape, funescape ).toLowerCase(); | 2146 | lang = lang.replace( runescape, funescape ).toLowerCase(); |
4360 | 1938 | return function( elem ) { | 2147 | return function( elem ) { |
4361 | 1939 | var elemLang; | 2148 | var elemLang; |
4362 | 1940 | do { | 2149 | do { |
4364 | 1941 | if ( (elemLang = documentIsHTML ? | 2150 | if ( ( elemLang = documentIsHTML ? |
4365 | 1942 | elem.lang : | 2151 | elem.lang : |
4367 | 1943 | elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { | 2152 | elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { |
4368 | 1944 | 2153 | ||
4369 | 1945 | elemLang = elemLang.toLowerCase(); | 2154 | elemLang = elemLang.toLowerCase(); |
4370 | 1946 | return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; | 2155 | return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; |
4371 | 1947 | } | 2156 | } |
4373 | 1948 | } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); | 2157 | } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); |
4374 | 1949 | return false; | 2158 | return false; |
4375 | 1950 | }; | 2159 | }; |
4377 | 1951 | }), | 2160 | } ), |
4378 | 1952 | 2161 | ||
4379 | 1953 | // Miscellaneous | 2162 | // Miscellaneous |
4380 | 1954 | "target": function( elem ) { | 2163 | "target": function( elem ) { |
4381 | @@ -1961,29 +2170,30 @@ Expr = Sizzle.selectors = { | |||
4382 | 1961 | }, | 2170 | }, |
4383 | 1962 | 2171 | ||
4384 | 1963 | "focus": function( elem ) { | 2172 | "focus": function( elem ) { |
4386 | 1964 | return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); | 2173 | return elem === document.activeElement && |
4387 | 2174 | ( !document.hasFocus || document.hasFocus() ) && | ||
4388 | 2175 | !!( elem.type || elem.href || ~elem.tabIndex ); | ||
4389 | 1965 | }, | 2176 | }, |
4390 | 1966 | 2177 | ||
4391 | 1967 | // Boolean properties | 2178 | // Boolean properties |
4399 | 1968 | "enabled": function( elem ) { | 2179 | "enabled": createDisabledPseudo( false ), |
4400 | 1969 | return elem.disabled === false; | 2180 | "disabled": createDisabledPseudo( true ), |
4394 | 1970 | }, | ||
4395 | 1971 | |||
4396 | 1972 | "disabled": function( elem ) { | ||
4397 | 1973 | return elem.disabled === true; | ||
4398 | 1974 | }, | ||
4401 | 1975 | 2181 | ||
4402 | 1976 | "checked": function( elem ) { | 2182 | "checked": function( elem ) { |
4403 | 2183 | |||
4404 | 1977 | // In CSS3, :checked should return both checked and selected elements | 2184 | // In CSS3, :checked should return both checked and selected elements |
4405 | 1978 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked | 2185 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
4406 | 1979 | var nodeName = elem.nodeName.toLowerCase(); | 2186 | var nodeName = elem.nodeName.toLowerCase(); |
4408 | 1980 | return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); | 2187 | return ( nodeName === "input" && !!elem.checked ) || |
4409 | 2188 | ( nodeName === "option" && !!elem.selected ); | ||
4410 | 1981 | }, | 2189 | }, |
4411 | 1982 | 2190 | ||
4412 | 1983 | "selected": function( elem ) { | 2191 | "selected": function( elem ) { |
4413 | 2192 | |||
4414 | 1984 | // Accessing this property makes selected-by-default | 2193 | // Accessing this property makes selected-by-default |
4415 | 1985 | // options in Safari work properly | 2194 | // options in Safari work properly |
4416 | 1986 | if ( elem.parentNode ) { | 2195 | if ( elem.parentNode ) { |
4417 | 2196 | // eslint-disable-next-line no-unused-expressions | ||
4418 | 1987 | elem.parentNode.selectedIndex; | 2197 | elem.parentNode.selectedIndex; |
4419 | 1988 | } | 2198 | } |
4420 | 1989 | 2199 | ||
4421 | @@ -1992,6 +2202,7 @@ Expr = Sizzle.selectors = { | |||
4422 | 1992 | 2202 | ||
4423 | 1993 | // Contents | 2203 | // Contents |
4424 | 1994 | "empty": function( elem ) { | 2204 | "empty": function( elem ) { |
4425 | 2205 | |||
4426 | 1995 | // http://www.w3.org/TR/selectors/#empty-pseudo | 2206 | // http://www.w3.org/TR/selectors/#empty-pseudo |
4427 | 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), |
4428 | 1997 | // but not by others (comment: 8; processing instruction: 7; etc.) | 2208 | // but not by others (comment: 8; processing instruction: 7; etc.) |
4429 | @@ -2005,7 +2216,7 @@ Expr = Sizzle.selectors = { | |||
4430 | 2005 | }, | 2216 | }, |
4431 | 2006 | 2217 | ||
4432 | 2007 | "parent": function( elem ) { | 2218 | "parent": function( elem ) { |
4434 | 2008 | return !Expr.pseudos["empty"]( elem ); | 2219 | return !Expr.pseudos[ "empty" ]( elem ); |
4435 | 2009 | }, | 2220 | }, |
4436 | 2010 | 2221 | ||
4437 | 2011 | // Element/input types | 2222 | // Element/input types |
4438 | @@ -2029,57 +2240,62 @@ Expr = Sizzle.selectors = { | |||
4439 | 2029 | 2240 | ||
4440 | 2030 | // Support: IE<8 | 2241 | // Support: IE<8 |
4441 | 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" |
4443 | 2032 | ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); | 2243 | ( ( attr = elem.getAttribute( "type" ) ) == null || |
4444 | 2244 | attr.toLowerCase() === "text" ); | ||
4445 | 2033 | }, | 2245 | }, |
4446 | 2034 | 2246 | ||
4447 | 2035 | // Position-in-collection | 2247 | // Position-in-collection |
4449 | 2036 | "first": createPositionalPseudo(function() { | 2248 | "first": createPositionalPseudo( function() { |
4450 | 2037 | return [ 0 ]; | 2249 | return [ 0 ]; |
4452 | 2038 | }), | 2250 | } ), |
4453 | 2039 | 2251 | ||
4455 | 2040 | "last": createPositionalPseudo(function( matchIndexes, length ) { | 2252 | "last": createPositionalPseudo( function( _matchIndexes, length ) { |
4456 | 2041 | return [ length - 1 ]; | 2253 | return [ length - 1 ]; |
4458 | 2042 | }), | 2254 | } ), |
4459 | 2043 | 2255 | ||
4461 | 2044 | "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { | 2256 | "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { |
4462 | 2045 | return [ argument < 0 ? argument + length : argument ]; | 2257 | return [ argument < 0 ? argument + length : argument ]; |
4464 | 2046 | }), | 2258 | } ), |
4465 | 2047 | 2259 | ||
4467 | 2048 | "even": createPositionalPseudo(function( matchIndexes, length ) { | 2260 | "even": createPositionalPseudo( function( matchIndexes, length ) { |
4468 | 2049 | var i = 0; | 2261 | var i = 0; |
4469 | 2050 | for ( ; i < length; i += 2 ) { | 2262 | for ( ; i < length; i += 2 ) { |
4470 | 2051 | matchIndexes.push( i ); | 2263 | matchIndexes.push( i ); |
4471 | 2052 | } | 2264 | } |
4472 | 2053 | return matchIndexes; | 2265 | return matchIndexes; |
4474 | 2054 | }), | 2266 | } ), |
4475 | 2055 | 2267 | ||
4477 | 2056 | "odd": createPositionalPseudo(function( matchIndexes, length ) { | 2268 | "odd": createPositionalPseudo( function( matchIndexes, length ) { |
4478 | 2057 | var i = 1; | 2269 | var i = 1; |
4479 | 2058 | for ( ; i < length; i += 2 ) { | 2270 | for ( ; i < length; i += 2 ) { |
4480 | 2059 | matchIndexes.push( i ); | 2271 | matchIndexes.push( i ); |
4481 | 2060 | } | 2272 | } |
4482 | 2061 | return matchIndexes; | 2273 | return matchIndexes; |
4484 | 2062 | }), | 2274 | } ), |
4485 | 2063 | 2275 | ||
4488 | 2064 | "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { | 2276 | "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { |
4489 | 2065 | var i = argument < 0 ? argument + length : argument; | 2277 | var i = argument < 0 ? |
4490 | 2278 | argument + length : | ||
4491 | 2279 | argument > length ? | ||
4492 | 2280 | length : | ||
4493 | 2281 | argument; | ||
4494 | 2066 | for ( ; --i >= 0; ) { | 2282 | for ( ; --i >= 0; ) { |
4495 | 2067 | matchIndexes.push( i ); | 2283 | matchIndexes.push( i ); |
4496 | 2068 | } | 2284 | } |
4497 | 2069 | return matchIndexes; | 2285 | return matchIndexes; |
4499 | 2070 | }), | 2286 | } ), |
4500 | 2071 | 2287 | ||
4502 | 2072 | "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { | 2288 | "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { |
4503 | 2073 | var i = argument < 0 ? argument + length : argument; | 2289 | var i = argument < 0 ? argument + length : argument; |
4504 | 2074 | for ( ; ++i < length; ) { | 2290 | for ( ; ++i < length; ) { |
4505 | 2075 | matchIndexes.push( i ); | 2291 | matchIndexes.push( i ); |
4506 | 2076 | } | 2292 | } |
4507 | 2077 | return matchIndexes; | 2293 | return matchIndexes; |
4509 | 2078 | }) | 2294 | } ) |
4510 | 2079 | } | 2295 | } |
4511 | 2080 | }; | 2296 | }; |
4512 | 2081 | 2297 | ||
4514 | 2082 | Expr.pseudos["nth"] = Expr.pseudos["eq"]; | 2298 | Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; |
4515 | 2083 | 2299 | ||
4516 | 2084 | // Add button/input type pseudos | 2300 | // Add button/input type pseudos |
4517 | 2085 | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { | 2301 | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
4518 | @@ -2110,37 +2326,39 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) { | |||
4519 | 2110 | while ( soFar ) { | 2326 | while ( soFar ) { |
4520 | 2111 | 2327 | ||
4521 | 2112 | // Comma and first run | 2328 | // Comma and first run |
4523 | 2113 | if ( !matched || (match = rcomma.exec( soFar )) ) { | 2329 | if ( !matched || ( match = rcomma.exec( soFar ) ) ) { |
4524 | 2114 | if ( match ) { | 2330 | if ( match ) { |
4525 | 2331 | |||
4526 | 2115 | // Don't consume trailing commas as valid | 2332 | // Don't consume trailing commas as valid |
4528 | 2116 | soFar = soFar.slice( match[0].length ) || soFar; | 2333 | soFar = soFar.slice( match[ 0 ].length ) || soFar; |
4529 | 2117 | } | 2334 | } |
4531 | 2118 | groups.push( (tokens = []) ); | 2335 | groups.push( ( tokens = [] ) ); |
4532 | 2119 | } | 2336 | } |
4533 | 2120 | 2337 | ||
4534 | 2121 | matched = false; | 2338 | matched = false; |
4535 | 2122 | 2339 | ||
4536 | 2123 | // Combinators | 2340 | // Combinators |
4538 | 2124 | if ( (match = rcombinators.exec( soFar )) ) { | 2341 | if ( ( match = rcombinators.exec( soFar ) ) ) { |
4539 | 2125 | matched = match.shift(); | 2342 | matched = match.shift(); |
4541 | 2126 | tokens.push({ | 2343 | tokens.push( { |
4542 | 2127 | value: matched, | 2344 | value: matched, |
4543 | 2345 | |||
4544 | 2128 | // Cast descendant combinators to space | 2346 | // Cast descendant combinators to space |
4547 | 2129 | type: match[0].replace( rtrim, " " ) | 2347 | type: match[ 0 ].replace( rtrim, " " ) |
4548 | 2130 | }); | 2348 | } ); |
4549 | 2131 | soFar = soFar.slice( matched.length ); | 2349 | soFar = soFar.slice( matched.length ); |
4550 | 2132 | } | 2350 | } |
4551 | 2133 | 2351 | ||
4552 | 2134 | // Filters | 2352 | // Filters |
4553 | 2135 | for ( type in Expr.filter ) { | 2353 | for ( type in Expr.filter ) { |
4556 | 2136 | if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || | 2354 | if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || |
4557 | 2137 | (match = preFilters[ type ]( match ))) ) { | 2355 | ( match = preFilters[ type ]( match ) ) ) ) { |
4558 | 2138 | matched = match.shift(); | 2356 | matched = match.shift(); |
4560 | 2139 | tokens.push({ | 2357 | tokens.push( { |
4561 | 2140 | value: matched, | 2358 | value: matched, |
4562 | 2141 | type: type, | 2359 | type: type, |
4563 | 2142 | matches: match | 2360 | matches: match |
4565 | 2143 | }); | 2361 | } ); |
4566 | 2144 | soFar = soFar.slice( matched.length ); | 2362 | soFar = soFar.slice( matched.length ); |
4567 | 2145 | } | 2363 | } |
4568 | 2146 | } | 2364 | } |
4569 | @@ -2157,6 +2375,7 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) { | |||
4570 | 2157 | soFar.length : | 2375 | soFar.length : |
4571 | 2158 | soFar ? | 2376 | soFar ? |
4572 | 2159 | Sizzle.error( selector ) : | 2377 | Sizzle.error( selector ) : |
4573 | 2378 | |||
4574 | 2160 | // Cache the tokens | 2379 | // Cache the tokens |
4575 | 2161 | tokenCache( selector, groups ).slice( 0 ); | 2380 | tokenCache( selector, groups ).slice( 0 ); |
4576 | 2162 | }; | 2381 | }; |
4577 | @@ -2166,24 +2385,28 @@ function toSelector( tokens ) { | |||
4578 | 2166 | len = tokens.length, | 2385 | len = tokens.length, |
4579 | 2167 | selector = ""; | 2386 | selector = ""; |
4580 | 2168 | for ( ; i < len; i++ ) { | 2387 | for ( ; i < len; i++ ) { |
4582 | 2169 | selector += tokens[i].value; | 2388 | selector += tokens[ i ].value; |
4583 | 2170 | } | 2389 | } |
4584 | 2171 | return selector; | 2390 | return selector; |
4585 | 2172 | } | 2391 | } |
4586 | 2173 | 2392 | ||
4587 | 2174 | function addCombinator( matcher, combinator, base ) { | 2393 | function addCombinator( matcher, combinator, base ) { |
4588 | 2175 | var dir = combinator.dir, | 2394 | var dir = combinator.dir, |
4590 | 2176 | checkNonElements = base && dir === "parentNode", | 2395 | skip = combinator.next, |
4591 | 2396 | key = skip || dir, | ||
4592 | 2397 | checkNonElements = base && key === "parentNode", | ||
4593 | 2177 | doneName = done++; | 2398 | doneName = done++; |
4594 | 2178 | 2399 | ||
4595 | 2179 | return combinator.first ? | 2400 | return combinator.first ? |
4596 | 2401 | |||
4597 | 2180 | // Check against closest ancestor/preceding element | 2402 | // Check against closest ancestor/preceding element |
4598 | 2181 | function( elem, context, xml ) { | 2403 | function( elem, context, xml ) { |
4600 | 2182 | while ( (elem = elem[ dir ]) ) { | 2404 | while ( ( elem = elem[ dir ] ) ) { |
4601 | 2183 | if ( elem.nodeType === 1 || checkNonElements ) { | 2405 | if ( elem.nodeType === 1 || checkNonElements ) { |
4602 | 2184 | return matcher( elem, context, xml ); | 2406 | return matcher( elem, context, xml ); |
4603 | 2185 | } | 2407 | } |
4604 | 2186 | } | 2408 | } |
4605 | 2409 | return false; | ||
4606 | 2187 | } : | 2410 | } : |
4607 | 2188 | 2411 | ||
4608 | 2189 | // Check against all ancestor/preceding elements | 2412 | // Check against all ancestor/preceding elements |
4609 | @@ -2193,7 +2416,7 @@ function addCombinator( matcher, combinator, base ) { | |||
4610 | 2193 | 2416 | ||
4611 | 2194 | // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching | 2417 | // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
4612 | 2195 | if ( xml ) { | 2418 | if ( xml ) { |
4614 | 2196 | while ( (elem = elem[ dir ]) ) { | 2419 | while ( ( elem = elem[ dir ] ) ) { |
4615 | 2197 | if ( elem.nodeType === 1 || checkNonElements ) { | 2420 | if ( elem.nodeType === 1 || checkNonElements ) { |
4616 | 2198 | if ( matcher( elem, context, xml ) ) { | 2421 | if ( matcher( elem, context, xml ) ) { |
4617 | 2199 | return true; | 2422 | return true; |
4618 | @@ -2201,31 +2424,36 @@ function addCombinator( matcher, combinator, base ) { | |||
4619 | 2201 | } | 2424 | } |
4620 | 2202 | } | 2425 | } |
4621 | 2203 | } else { | 2426 | } else { |
4623 | 2204 | while ( (elem = elem[ dir ]) ) { | 2427 | while ( ( elem = elem[ dir ] ) ) { |
4624 | 2205 | if ( elem.nodeType === 1 || checkNonElements ) { | 2428 | if ( elem.nodeType === 1 || checkNonElements ) { |
4626 | 2206 | outerCache = elem[ expando ] || (elem[ expando ] = {}); | 2429 | outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
4627 | 2207 | 2430 | ||
4628 | 2208 | // Support: IE <9 only | 2431 | // Support: IE <9 only |
4629 | 2209 | // Defend against cloned attroperties (jQuery gh-1709) | 2432 | // Defend against cloned attroperties (jQuery gh-1709) |
4631 | 2210 | uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); | 2433 | uniqueCache = outerCache[ elem.uniqueID ] || |
4632 | 2434 | ( outerCache[ elem.uniqueID ] = {} ); | ||
4633 | 2211 | 2435 | ||
4635 | 2212 | if ( (oldCache = uniqueCache[ dir ]) && | 2436 | if ( skip && skip === elem.nodeName.toLowerCase() ) { |
4636 | 2437 | elem = elem[ dir ] || elem; | ||
4637 | 2438 | } else if ( ( oldCache = uniqueCache[ key ] ) && | ||
4638 | 2213 | oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { | 2439 | oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
4639 | 2214 | 2440 | ||
4640 | 2215 | // Assign to newCache so results back-propagate to previous elements | 2441 | // Assign to newCache so results back-propagate to previous elements |
4642 | 2216 | return (newCache[ 2 ] = oldCache[ 2 ]); | 2442 | return ( newCache[ 2 ] = oldCache[ 2 ] ); |
4643 | 2217 | } else { | 2443 | } else { |
4644 | 2444 | |||
4645 | 2218 | // Reuse newcache so results back-propagate to previous elements | 2445 | // Reuse newcache so results back-propagate to previous elements |
4647 | 2219 | uniqueCache[ dir ] = newCache; | 2446 | uniqueCache[ key ] = newCache; |
4648 | 2220 | 2447 | ||
4649 | 2221 | // A match means we're done; a fail means we have to keep checking | 2448 | // A match means we're done; a fail means we have to keep checking |
4651 | 2222 | if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { | 2449 | if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { |
4652 | 2223 | return true; | 2450 | return true; |
4653 | 2224 | } | 2451 | } |
4654 | 2225 | } | 2452 | } |
4655 | 2226 | } | 2453 | } |
4656 | 2227 | } | 2454 | } |
4657 | 2228 | } | 2455 | } |
4658 | 2456 | return false; | ||
4659 | 2229 | }; | 2457 | }; |
4660 | 2230 | } | 2458 | } |
4661 | 2231 | 2459 | ||
4662 | @@ -2234,20 +2462,20 @@ function elementMatcher( matchers ) { | |||
4663 | 2234 | function( elem, context, xml ) { | 2462 | function( elem, context, xml ) { |
4664 | 2235 | var i = matchers.length; | 2463 | var i = matchers.length; |
4665 | 2236 | while ( i-- ) { | 2464 | while ( i-- ) { |
4667 | 2237 | if ( !matchers[i]( elem, context, xml ) ) { | 2465 | if ( !matchers[ i ]( elem, context, xml ) ) { |
4668 | 2238 | return false; | 2466 | return false; |
4669 | 2239 | } | 2467 | } |
4670 | 2240 | } | 2468 | } |
4671 | 2241 | return true; | 2469 | return true; |
4672 | 2242 | } : | 2470 | } : |
4674 | 2243 | matchers[0]; | 2471 | matchers[ 0 ]; |
4675 | 2244 | } | 2472 | } |
4676 | 2245 | 2473 | ||
4677 | 2246 | function multipleContexts( selector, contexts, results ) { | 2474 | function multipleContexts( selector, contexts, results ) { |
4678 | 2247 | var i = 0, | 2475 | var i = 0, |
4679 | 2248 | len = contexts.length; | 2476 | len = contexts.length; |
4680 | 2249 | for ( ; i < len; i++ ) { | 2477 | for ( ; i < len; i++ ) { |
4682 | 2250 | Sizzle( selector, contexts[i], results ); | 2478 | Sizzle( selector, contexts[ i ], results ); |
4683 | 2251 | } | 2479 | } |
4684 | 2252 | return results; | 2480 | return results; |
4685 | 2253 | } | 2481 | } |
4686 | @@ -2260,7 +2488,7 @@ function condense( unmatched, map, filter, context, xml ) { | |||
4687 | 2260 | mapped = map != null; | 2488 | mapped = map != null; |
4688 | 2261 | 2489 | ||
4689 | 2262 | for ( ; i < len; i++ ) { | 2490 | for ( ; i < len; i++ ) { |
4691 | 2263 | if ( (elem = unmatched[i]) ) { | 2491 | if ( ( elem = unmatched[ i ] ) ) { |
4692 | 2264 | if ( !filter || filter( elem, context, xml ) ) { | 2492 | if ( !filter || filter( elem, context, xml ) ) { |
4693 | 2265 | newUnmatched.push( elem ); | 2493 | newUnmatched.push( elem ); |
4694 | 2266 | if ( mapped ) { | 2494 | if ( mapped ) { |
4695 | @@ -2280,14 +2508,18 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS | |||
4696 | 2280 | if ( postFinder && !postFinder[ expando ] ) { | 2508 | if ( postFinder && !postFinder[ expando ] ) { |
4697 | 2281 | postFinder = setMatcher( postFinder, postSelector ); | 2509 | postFinder = setMatcher( postFinder, postSelector ); |
4698 | 2282 | } | 2510 | } |
4700 | 2283 | return markFunction(function( seed, results, context, xml ) { | 2511 | return markFunction( function( seed, results, context, xml ) { |
4701 | 2284 | var temp, i, elem, | 2512 | var temp, i, elem, |
4702 | 2285 | preMap = [], | 2513 | preMap = [], |
4703 | 2286 | postMap = [], | 2514 | postMap = [], |
4704 | 2287 | preexisting = results.length, | 2515 | preexisting = results.length, |
4705 | 2288 | 2516 | ||
4706 | 2289 | // Get initial elements from seed or context | 2517 | // Get initial elements from seed or context |
4708 | 2290 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), | 2518 | elems = seed || multipleContexts( |
4709 | 2519 | selector || "*", | ||
4710 | 2520 | context.nodeType ? [ context ] : context, | ||
4711 | 2521 | [] | ||
4712 | 2522 | ), | ||
4713 | 2291 | 2523 | ||
4714 | 2292 | // Prefilter to get matcher input, preserving a map for seed-results synchronization | 2524 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
4715 | 2293 | matcherIn = preFilter && ( seed || !selector ) ? | 2525 | matcherIn = preFilter && ( seed || !selector ) ? |
4716 | @@ -2295,6 +2527,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS | |||
4717 | 2295 | elems, | 2527 | elems, |
4718 | 2296 | 2528 | ||
4719 | 2297 | matcherOut = matcher ? | 2529 | matcherOut = matcher ? |
4720 | 2530 | |||
4721 | 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, |
4722 | 2299 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? | 2532 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
4723 | 2300 | 2533 | ||
4724 | @@ -2318,8 +2551,8 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS | |||
4725 | 2318 | // Un-match failing elements by moving them back to matcherIn | 2551 | // Un-match failing elements by moving them back to matcherIn |
4726 | 2319 | i = temp.length; | 2552 | i = temp.length; |
4727 | 2320 | while ( i-- ) { | 2553 | while ( i-- ) { |
4730 | 2321 | if ( (elem = temp[i]) ) { | 2554 | if ( ( elem = temp[ i ] ) ) { |
4731 | 2322 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); | 2555 | matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); |
4732 | 2323 | } | 2556 | } |
4733 | 2324 | } | 2557 | } |
4734 | 2325 | } | 2558 | } |
4735 | @@ -2327,25 +2560,27 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS | |||
4736 | 2327 | if ( seed ) { | 2560 | if ( seed ) { |
4737 | 2328 | if ( postFinder || preFilter ) { | 2561 | if ( postFinder || preFilter ) { |
4738 | 2329 | if ( postFinder ) { | 2562 | if ( postFinder ) { |
4739 | 2563 | |||
4740 | 2330 | // Get the final matcherOut by condensing this intermediate into postFinder contexts | 2564 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
4741 | 2331 | temp = []; | 2565 | temp = []; |
4742 | 2332 | i = matcherOut.length; | 2566 | i = matcherOut.length; |
4743 | 2333 | while ( i-- ) { | 2567 | while ( i-- ) { |
4745 | 2334 | if ( (elem = matcherOut[i]) ) { | 2568 | if ( ( elem = matcherOut[ i ] ) ) { |
4746 | 2569 | |||
4747 | 2335 | // Restore matcherIn since elem is not yet a final match | 2570 | // Restore matcherIn since elem is not yet a final match |
4749 | 2336 | temp.push( (matcherIn[i] = elem) ); | 2571 | temp.push( ( matcherIn[ i ] = elem ) ); |
4750 | 2337 | } | 2572 | } |
4751 | 2338 | } | 2573 | } |
4753 | 2339 | postFinder( null, (matcherOut = []), temp, xml ); | 2574 | postFinder( null, ( matcherOut = [] ), temp, xml ); |
4754 | 2340 | } | 2575 | } |
4755 | 2341 | 2576 | ||
4756 | 2342 | // Move matched elements from seed to results to keep them synchronized | 2577 | // Move matched elements from seed to results to keep them synchronized |
4757 | 2343 | i = matcherOut.length; | 2578 | i = matcherOut.length; |
4758 | 2344 | while ( i-- ) { | 2579 | while ( i-- ) { |
4761 | 2345 | if ( (elem = matcherOut[i]) && | 2580 | if ( ( elem = matcherOut[ i ] ) && |
4762 | 2346 | (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { | 2581 | ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { |
4763 | 2347 | 2582 | ||
4765 | 2348 | seed[temp] = !(results[temp] = elem); | 2583 | seed[ temp ] = !( results[ temp ] = elem ); |
4766 | 2349 | } | 2584 | } |
4767 | 2350 | } | 2585 | } |
4768 | 2351 | } | 2586 | } |
4769 | @@ -2363,14 +2598,14 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS | |||
4770 | 2363 | push.apply( results, matcherOut ); | 2598 | push.apply( results, matcherOut ); |
4771 | 2364 | } | 2599 | } |
4772 | 2365 | } | 2600 | } |
4774 | 2366 | }); | 2601 | } ); |
4775 | 2367 | } | 2602 | } |
4776 | 2368 | 2603 | ||
4777 | 2369 | function matcherFromTokens( tokens ) { | 2604 | function matcherFromTokens( tokens ) { |
4778 | 2370 | var checkContext, matcher, j, | 2605 | var checkContext, matcher, j, |
4779 | 2371 | len = tokens.length, | 2606 | len = tokens.length, |
4782 | 2372 | leadingRelative = Expr.relative[ tokens[0].type ], | 2607 | leadingRelative = Expr.relative[ tokens[ 0 ].type ], |
4783 | 2373 | implicitRelative = leadingRelative || Expr.relative[" "], | 2608 | implicitRelative = leadingRelative || Expr.relative[ " " ], |
4784 | 2374 | i = leadingRelative ? 1 : 0, | 2609 | i = leadingRelative ? 1 : 0, |
4785 | 2375 | 2610 | ||
4786 | 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) |
4787 | @@ -2382,38 +2617,43 @@ function matcherFromTokens( tokens ) { | |||
4788 | 2382 | }, implicitRelative, true ), | 2617 | }, implicitRelative, true ), |
4789 | 2383 | matchers = [ function( elem, context, xml ) { | 2618 | matchers = [ function( elem, context, xml ) { |
4790 | 2384 | var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( | 2619 | var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
4792 | 2385 | (checkContext = context).nodeType ? | 2620 | ( checkContext = context ).nodeType ? |
4793 | 2386 | matchContext( elem, context, xml ) : | 2621 | matchContext( elem, context, xml ) : |
4794 | 2387 | matchAnyContext( elem, context, xml ) ); | 2622 | matchAnyContext( elem, context, xml ) ); |
4795 | 2623 | |||
4796 | 2388 | // Avoid hanging onto element (issue #299) | 2624 | // Avoid hanging onto element (issue #299) |
4797 | 2389 | checkContext = null; | 2625 | checkContext = null; |
4798 | 2390 | return ret; | 2626 | return ret; |
4799 | 2391 | } ]; | 2627 | } ]; |
4800 | 2392 | 2628 | ||
4801 | 2393 | for ( ; i < len; i++ ) { | 2629 | for ( ; i < len; i++ ) { |
4804 | 2394 | if ( (matcher = Expr.relative[ tokens[i].type ]) ) { | 2630 | if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { |
4805 | 2395 | matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; | 2631 | matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; |
4806 | 2396 | } else { | 2632 | } else { |
4808 | 2397 | matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); | 2633 | matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); |
4809 | 2398 | 2634 | ||
4810 | 2399 | // Return special upon seeing a positional matcher | 2635 | // Return special upon seeing a positional matcher |
4811 | 2400 | if ( matcher[ expando ] ) { | 2636 | if ( matcher[ expando ] ) { |
4812 | 2637 | |||
4813 | 2401 | // Find the next relative operator (if any) for proper handling | 2638 | // Find the next relative operator (if any) for proper handling |
4814 | 2402 | j = ++i; | 2639 | j = ++i; |
4815 | 2403 | for ( ; j < len; j++ ) { | 2640 | for ( ; j < len; j++ ) { |
4817 | 2404 | if ( Expr.relative[ tokens[j].type ] ) { | 2641 | if ( Expr.relative[ tokens[ j ].type ] ) { |
4818 | 2405 | break; | 2642 | break; |
4819 | 2406 | } | 2643 | } |
4820 | 2407 | } | 2644 | } |
4821 | 2408 | return setMatcher( | 2645 | return setMatcher( |
4822 | 2409 | i > 1 && elementMatcher( matchers ), | 2646 | i > 1 && elementMatcher( matchers ), |
4823 | 2410 | i > 1 && toSelector( | 2647 | i > 1 && toSelector( |
4826 | 2411 | // If the preceding token was a descendant combinator, insert an implicit any-element `*` | 2648 | |
4827 | 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 `*` |
4828 | 2650 | tokens | ||
4829 | 2651 | .slice( 0, i - 1 ) | ||
4830 | 2652 | .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) | ||
4831 | 2413 | ).replace( rtrim, "$1" ), | 2653 | ).replace( rtrim, "$1" ), |
4832 | 2414 | matcher, | 2654 | matcher, |
4833 | 2415 | i < j && matcherFromTokens( tokens.slice( i, j ) ), | 2655 | i < j && matcherFromTokens( tokens.slice( i, j ) ), |
4835 | 2416 | j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), | 2656 | j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), |
4836 | 2417 | j < len && toSelector( tokens ) | 2657 | j < len && toSelector( tokens ) |
4837 | 2418 | ); | 2658 | ); |
4838 | 2419 | } | 2659 | } |
4839 | @@ -2434,28 +2674,40 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { | |||
4840 | 2434 | unmatched = seed && [], | 2674 | unmatched = seed && [], |
4841 | 2435 | setMatched = [], | 2675 | setMatched = [], |
4842 | 2436 | contextBackup = outermostContext, | 2676 | contextBackup = outermostContext, |
4843 | 2677 | |||
4844 | 2437 | // We must always have either seed elements or outermost context | 2678 | // We must always have either seed elements or outermost context |
4846 | 2438 | elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), | 2679 | elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), |
4847 | 2680 | |||
4848 | 2439 | // Use integer dirruns iff this is the outermost matcher | 2681 | // Use integer dirruns iff this is the outermost matcher |
4850 | 2440 | dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), | 2682 | dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), |
4851 | 2441 | len = elems.length; | 2683 | len = elems.length; |
4852 | 2442 | 2684 | ||
4853 | 2443 | if ( outermost ) { | 2685 | if ( outermost ) { |
4855 | 2444 | outermostContext = context === document || context || outermost; | 2686 | |
4856 | 2687 | // Support: IE 11+, Edge 17 - 18+ | ||
4857 | 2688 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing | ||
4858 | 2689 | // two documents; shallow comparisons work. | ||
4859 | 2690 | // eslint-disable-next-line eqeqeq | ||
4860 | 2691 | outermostContext = context == document || context || outermost; | ||
4861 | 2445 | } | 2692 | } |
4862 | 2446 | 2693 | ||
4863 | 2447 | // Add elements passing elementMatchers directly to results | 2694 | // Add elements passing elementMatchers directly to results |
4864 | 2448 | // Support: IE<9, Safari | 2695 | // Support: IE<9, Safari |
4865 | 2449 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id | 2696 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
4867 | 2450 | for ( ; i !== len && (elem = elems[i]) != null; i++ ) { | 2697 | for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { |
4868 | 2451 | if ( byElement && elem ) { | 2698 | if ( byElement && elem ) { |
4869 | 2452 | j = 0; | 2699 | j = 0; |
4871 | 2453 | if ( !context && elem.ownerDocument !== document ) { | 2700 | |
4872 | 2701 | // Support: IE 11+, Edge 17 - 18+ | ||
4873 | 2702 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing | ||
4874 | 2703 | // two documents; shallow comparisons work. | ||
4875 | 2704 | // eslint-disable-next-line eqeqeq | ||
4876 | 2705 | if ( !context && elem.ownerDocument != document ) { | ||
4877 | 2454 | setDocument( elem ); | 2706 | setDocument( elem ); |
4878 | 2455 | xml = !documentIsHTML; | 2707 | xml = !documentIsHTML; |
4879 | 2456 | } | 2708 | } |
4882 | 2457 | while ( (matcher = elementMatchers[j++]) ) { | 2709 | while ( ( matcher = elementMatchers[ j++ ] ) ) { |
4883 | 2458 | if ( matcher( elem, context || document, xml) ) { | 2710 | if ( matcher( elem, context || document, xml ) ) { |
4884 | 2459 | results.push( elem ); | 2711 | results.push( elem ); |
4885 | 2460 | break; | 2712 | break; |
4886 | 2461 | } | 2713 | } |
4887 | @@ -2467,8 +2719,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { | |||
4888 | 2467 | 2719 | ||
4889 | 2468 | // Track unmatched elements for set filters | 2720 | // Track unmatched elements for set filters |
4890 | 2469 | if ( bySet ) { | 2721 | if ( bySet ) { |
4891 | 2722 | |||
4892 | 2470 | // They will have gone through all possible matchers | 2723 | // They will have gone through all possible matchers |
4894 | 2471 | if ( (elem = !matcher && elem) ) { | 2724 | if ( ( elem = !matcher && elem ) ) { |
4895 | 2472 | matchedCount--; | 2725 | matchedCount--; |
4896 | 2473 | } | 2726 | } |
4897 | 2474 | 2727 | ||
4898 | @@ -2492,16 +2745,17 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { | |||
4899 | 2492 | // numerically zero. | 2745 | // numerically zero. |
4900 | 2493 | if ( bySet && i !== matchedCount ) { | 2746 | if ( bySet && i !== matchedCount ) { |
4901 | 2494 | j = 0; | 2747 | j = 0; |
4903 | 2495 | while ( (matcher = setMatchers[j++]) ) { | 2748 | while ( ( matcher = setMatchers[ j++ ] ) ) { |
4904 | 2496 | matcher( unmatched, setMatched, context, xml ); | 2749 | matcher( unmatched, setMatched, context, xml ); |
4905 | 2497 | } | 2750 | } |
4906 | 2498 | 2751 | ||
4907 | 2499 | if ( seed ) { | 2752 | if ( seed ) { |
4908 | 2753 | |||
4909 | 2500 | // Reintegrate element matches to eliminate the need for sorting | 2754 | // Reintegrate element matches to eliminate the need for sorting |
4910 | 2501 | if ( matchedCount > 0 ) { | 2755 | if ( matchedCount > 0 ) { |
4911 | 2502 | while ( i-- ) { | 2756 | while ( i-- ) { |
4914 | 2503 | if ( !(unmatched[i] || setMatched[i]) ) { | 2757 | if ( !( unmatched[ i ] || setMatched[ i ] ) ) { |
4915 | 2504 | setMatched[i] = pop.call( results ); | 2758 | setMatched[ i ] = pop.call( results ); |
4916 | 2505 | } | 2759 | } |
4917 | 2506 | } | 2760 | } |
4918 | 2507 | } | 2761 | } |
4919 | @@ -2542,13 +2796,14 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { | |||
4920 | 2542 | cached = compilerCache[ selector + " " ]; | 2796 | cached = compilerCache[ selector + " " ]; |
4921 | 2543 | 2797 | ||
4922 | 2544 | if ( !cached ) { | 2798 | if ( !cached ) { |
4923 | 2799 | |||
4924 | 2545 | // Generate a function of recursive functions that can be used to check each element | 2800 | // Generate a function of recursive functions that can be used to check each element |
4925 | 2546 | if ( !match ) { | 2801 | if ( !match ) { |
4926 | 2547 | match = tokenize( selector ); | 2802 | match = tokenize( selector ); |
4927 | 2548 | } | 2803 | } |
4928 | 2549 | i = match.length; | 2804 | i = match.length; |
4929 | 2550 | while ( i-- ) { | 2805 | while ( i-- ) { |
4931 | 2551 | cached = matcherFromTokens( match[i] ); | 2806 | cached = matcherFromTokens( match[ i ] ); |
4932 | 2552 | if ( cached[ expando ] ) { | 2807 | if ( cached[ expando ] ) { |
4933 | 2553 | setMatchers.push( cached ); | 2808 | setMatchers.push( cached ); |
4934 | 2554 | } else { | 2809 | } else { |
4935 | @@ -2557,7 +2812,10 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { | |||
4936 | 2557 | } | 2812 | } |
4937 | 2558 | 2813 | ||
4938 | 2559 | // Cache the compiled function | 2814 | // Cache the compiled function |
4940 | 2560 | cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); | 2815 | cached = compilerCache( |
4941 | 2816 | selector, | ||
4942 | 2817 | matcherFromGroupMatchers( elementMatchers, setMatchers ) | ||
4943 | 2818 | ); | ||
4944 | 2561 | 2819 | ||
4945 | 2562 | // Save selector and tokenization | 2820 | // Save selector and tokenization |
4946 | 2563 | cached.selector = selector; | 2821 | cached.selector = selector; |
4947 | @@ -2577,7 +2835,7 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { | |||
4948 | 2577 | select = Sizzle.select = function( selector, context, results, seed ) { | 2835 | select = Sizzle.select = function( selector, context, results, seed ) { |
4949 | 2578 | var i, tokens, token, type, find, | 2836 | var i, tokens, token, type, find, |
4950 | 2579 | compiled = typeof selector === "function" && selector, | 2837 | compiled = typeof selector === "function" && selector, |
4952 | 2580 | match = !seed && tokenize( (selector = compiled.selector || selector) ); | 2838 | match = !seed && tokenize( ( selector = compiled.selector || selector ) ); |
4953 | 2581 | 2839 | ||
4954 | 2582 | results = results || []; | 2840 | results = results || []; |
4955 | 2583 | 2841 | ||
4956 | @@ -2586,12 +2844,12 @@ select = Sizzle.select = function( selector, context, results, seed ) { | |||
4957 | 2586 | if ( match.length === 1 ) { | 2844 | if ( match.length === 1 ) { |
4958 | 2587 | 2845 | ||
4959 | 2588 | // Reduce context if the leading compound selector is an ID | 2846 | // Reduce context if the leading compound selector is an ID |
4964 | 2589 | tokens = match[0] = match[0].slice( 0 ); | 2847 | tokens = match[ 0 ] = match[ 0 ].slice( 0 ); |
4965 | 2590 | if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && | 2848 | if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && |
4966 | 2591 | support.getById && context.nodeType === 9 && documentIsHTML && | 2849 | context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { |
4963 | 2592 | Expr.relative[ tokens[1].type ] ) { | ||
4967 | 2593 | 2850 | ||
4969 | 2594 | context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; | 2851 | context = ( Expr.find[ "ID" ]( token.matches[ 0 ] |
4970 | 2852 | .replace( runescape, funescape ), context ) || [] )[ 0 ]; | ||
4971 | 2595 | if ( !context ) { | 2853 | if ( !context ) { |
4972 | 2596 | return results; | 2854 | return results; |
4973 | 2597 | 2855 | ||
4974 | @@ -2604,20 +2862,22 @@ select = Sizzle.select = function( selector, context, results, seed ) { | |||
4975 | 2604 | } | 2862 | } |
4976 | 2605 | 2863 | ||
4977 | 2606 | // Fetch a seed set for right-to-left matching | 2864 | // Fetch a seed set for right-to-left matching |
4979 | 2607 | i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; | 2865 | i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; |
4980 | 2608 | while ( i-- ) { | 2866 | while ( i-- ) { |
4982 | 2609 | token = tokens[i]; | 2867 | token = tokens[ i ]; |
4983 | 2610 | 2868 | ||
4984 | 2611 | // Abort if we hit a combinator | 2869 | // Abort if we hit a combinator |
4986 | 2612 | if ( Expr.relative[ (type = token.type) ] ) { | 2870 | if ( Expr.relative[ ( type = token.type ) ] ) { |
4987 | 2613 | break; | 2871 | break; |
4988 | 2614 | } | 2872 | } |
4990 | 2615 | if ( (find = Expr.find[ type ]) ) { | 2873 | if ( ( find = Expr.find[ type ] ) ) { |
4991 | 2874 | |||
4992 | 2616 | // Search, expanding context for leading sibling combinators | 2875 | // Search, expanding context for leading sibling combinators |
4997 | 2617 | if ( (seed = find( | 2876 | if ( ( seed = find( |
4998 | 2618 | token.matches[0].replace( runescape, funescape ), | 2877 | token.matches[ 0 ].replace( runescape, funescape ), |
4999 | 2619 | rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context | 2878 | rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || |
5000 | 2620 | )) ) { | 2879 | context |
The diff has been truncated for viewing.