ng-file-upload
Advanced tools
Comparing version 6.2.0 to 6.2.1
@@ -1,2 +0,2 @@ | ||
/*! 6.2.0 */ | ||
/*! 6.2.1 */ | ||
/*! FileAPI 2.0.7 - BSD | git://github.com/mailru/FileAPI.git | ||
@@ -3,0 +3,0 @@ * 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. |
@@ -5,3 +5,3 @@ /**! | ||
* @author Danial <danial.farid@gmail.com> | ||
* @version 6.2.0 | ||
* @version 6.2.1 | ||
*/ | ||
@@ -434,3 +434,3 @@ | ||
* @author Danial <danial.farid@gmail.com> | ||
* @version 6.2.0 | ||
* @version 6.2.1 | ||
*/ | ||
@@ -456,3 +456,3 @@ | ||
ngFileUpload.version = '6.2.0'; | ||
ngFileUpload.version = '6.2.1'; | ||
ngFileUpload.defaults = {}; | ||
@@ -981,4 +981,6 @@ | ||
return function (file, disallowObjectUrl) { | ||
//return 'aaaa' + file + disallowObjectUrl + $sce + UploadDataUrl; | ||
if (file && !file.dataUrl && !angular.isString(file)) { | ||
if (angular.isString(file)) { | ||
return $sce.trustAsResourceUrl(file); | ||
} | ||
if (file && !file.dataUrl) { | ||
if (file.dataUrl === undefined && angular.isObject(file)) { | ||
@@ -985,0 +987,0 @@ file.dataUrl = null; |
@@ -1,2 +0,2 @@ | ||
/*! 6.2.0 */ | ||
!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={}),FileAPI.shouldLoad=window.XMLHttpRequest&&!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){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.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.hasFlash=b()}FileAPI.ngfFixIE=function(d,e,f,g){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var h=function(){if(d.attr("disabled"))d.$$ngfRefElem.removeClass("js-fileapi-wrapper");else{var b=d.$$ngfRefElem;b?f(d.$$ngfRefElem):(b=d.$$ngfRefElem=e(),b.addClass("js-fileapi-wrapper"),!a(d),setTimeout(function(){b.bind("mouseenter",h)},10),b.bind("change",function(a){i.apply(this,[a]),g.apply(this,[a])})),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")}};d.bind("mouseenter",h);var i=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.readAsArrayBuffer=function(a){FileAPI.readAsBinaryString(a,d)},this.readAsBinaryString=function(a){FileAPI.readAsBinaryString(a,d)},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="6.2.0",ngFileUpload.defaults={},ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{};var e=b.defer(),f=e.promise;return d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)}))},!1))}},a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)}),f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.progressFunc=a,f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(a){function b(c,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))c.append(e,d);else if("form"===a.sendFieldsAs)if(angular.isObject(d))for(var f in d)d.hasOwnProperty(f)&&b(c,d[f],e+"["+f+"]");else c.append(e,d);else d=angular.isString(d)?d:JSON.stringify(d),"json-blob"===a.sendFieldsAs?c.append(e,new Blob([d],{type:"application/json"})):c.append(e,d)}return 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(c){var d,e=new FormData,f={};for(d in a.fields)a.fields.hasOwnProperty(d)&&(f[d]=a.fields[d]);c&&(f.data=c);for(d in f)if(f.hasOwnProperty(d)){var g=f[d];a.formDataAppender?a.formDataAppender(e,d,g):b(e,g,d)}if(null!=a.file){var h=a.fileFormDataName||"file";if(angular.isArray(a.file))for(var i=angular.isString(h),j=0;j<a.file.length;j++)e.append(i?h:h[j],a.file[j],a.fileName&&a.fileName[j]||a.file[j].name);else e.append(h,a.file,a.fileName||a.file.name)}return e}),d(a)},this.http=function(b){return b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof Blob?b:a.defaults.transformRequest[0](arguments)},d(b)},this.setDefaults=function(a){ngFileUpload.defaults=a||{}},ngFileUpload.Upload=this}]),function(){function a(a,e,f,g,h,i,j){function k(){return"input"===e[0].tagName.toLowerCase()&&f.type&&"file"===f.type.toLowerCase()}function l(b){var j=b.__files_||b.target&&b.target.files;c.validate(a,h,f,j,b,function(c,j){e.$$ngfHasFile=!0,ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),c,j,b),0===c.length&&(b.target.value=c)})}function m(b){d(f,"ngfMultiple")&&b.attr("multiple",h(d(f,"ngfMultiple"))(a)),d(f,"ngfCapture")&&b.attr("capture",h(d(f,"ngfCapture"))(a)),d(f,"accept")&&b.attr("accept",d(f,"accept"));for(var c=0;c<e[0].attributes.length;c++){var g=e[0].attributes[c];(k()&&"type"!==g.name||"type"!==g.name&&"class"!==g.name&&"id"!==g.name&&"style"!==g.name)&&((null==g.value||""===g.value)&&("required"===g.name&&(g.value="required"),"multiple"===g.name&&(g.value="multiple")),b.attr(g.name,g.value))}}function n(b,c){if(!c&&(b||k()))return e.$$ngfRefElem||e;if(e.$$ngfProgramClick)return e;var d=angular.element('<input type="file">');return m(d),k()?(e.replaceWith(d),e=d,d.attr("__ngf_gen__",!0),j(e)(a)):(d.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"),e.$$ngfRefElem&&e.$$ngfRefElem.remove(),e.$$ngfRefElem=d,document.body.appendChild(d[0])),d}function o(b){e.$$ngfHasFile&&(ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),[],[],b,!0),delete e.$$ngfHasFile)}function p(c){function g(a){a&&!e.$$ngfProgramClick&&(e.$$ngfProgramClick=!0,t[0].click(),i(function(){delete e.$$ngfProgramClick},500)),!k()&&a||!s||e.bind("click touchstart touchend",p)}if(e.attr("disabled")||q)return!1;if(null!=c){var j=c.changedTouches||c.originalEvent&&c.originalEvent.changedTouches;if("touchstart"===c.type)return r=j?j[0].clientY:0,!0;if(c.stopPropagation(),c.preventDefault(),"touchend"===c.type){var m=j?j[0].clientY:0;if(Math.abs(m-r)>20)return!1}}var s=h(d(f,"ngfResetOnClick"))(a)!==!1,t=n(c,s);return t&&((!c||s)&&t.bind("change",l),c&&s&&h(d(f,"ngfResetModelOnClick"))(a)!==!1&&o(c),b(navigator.userAgent)?setTimeout(function(){g(c)},0):g(c)),!1}if(!e.attr("__ngf_gen__")){a.$on("$destroy",function(){e.$$ngfRefElem&&e.$$ngfRefElem.remove()});var q=!1;-1===d(f,"ngfSelect").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfSelect"),function(a){q=a===!1});var r=0;window.FileAPI&&window.FileAPI.ngfFixIE?window.FileAPI.ngfFixIE(e,n,m,l):p()}}function b(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=ngFileUpload.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)}ngFileUpload.getAttrWithDefaults=function(a,b){return null!=a[b]?a[b]:null==ngFileUpload.defaults[b]?ngFileUpload.defaults[b]:ngFileUpload.defaults[b].toString()};var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.updateModel=function(a,b,c,e,f,g,h,i,j,k){function l(){var k=a(d(f,"ngfKeep"))(c);if(k===!0){var l=(e.$modelValue||[]).slice(0);if(h&&h.length)if(a(d(f,"ngfKeepDistinct"))(c)===!0){for(var m=l.length,n=0;n<h.length;n++){for(var o=0;m>o&&h[n].name!==l[o].name;o++);o===m&&l.push(h[n])}h=l}else h=l.concat(h);else h=l}var p=h&&h.length?h[0]:null;if(e){var q=!a(d(f,"ngfMultiple"))(c)&&!d(f,"multiple")&&!k;b(function(){a(d(f,"ngModel")).assign(c,q?p:h)}),b(function(){e&&e.$setViewValue(q?p:null!=h&&0===h.length?null:h)})}var r=d(f,"ngfModel");r&&a(r).assign(c,h),d(f,"ngModelRejected")&&a(d(f,"ngModelRejected")).assign(c,i),g&&a(g)(c,{$files:h,$file:p,$rejectedFiles:i,$event:j})}k?l():b(function(){l()})}}(),function(){ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout",function(a,b){return a.dataUrl=function(a,c,d){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)?b(function(){var e=window.URL||window.webkitURL;if(e&&e.createObjectURL&&!d){var f;try{f=e.createObjectURL(a)}catch(g){c("",a)}f&&c(f,a)}else{var h=new FileReader;h.readAsDataURL(a),h.onload=function(d){b(function(){c(d.target.result,a)})}}}):c(null,a)},a}]),ngFileUpload.directive("ngfSrc",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("src","{{("+f.ngfSrc+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}"),f.$set("ngfSrc",null),b(e)(d)})}}}]),ngFileUpload.directive("ngfBackground",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("style",e.attr("style")+";background-image:url('{{("+f.ngfBackground+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}')"),f.$set("ngfBackground",null),b(e)(d)})}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/),a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d){return!c||c.dataUrl||angular.isString(c)?(c&&c.dataUrl?b.trustAsResourceUrl(c.dataUrl):c)||"":(void 0===c.dataUrl&&angular.isObject(c)&&(c.dataUrl=null,a.dataUrl(c,function(a,b){b.dataUrl=a},d)),"")}}])}(),function(){function a(b){if(b.length>2&&"/"===b[0]&&"/"===b[b.length-1])return b.substring(1,b.length-1);var c=b.split(","),d="";if(c.length>1)for(var e=0;e<c.length;e++)d+="("+a(c[e])+")",e<c.length-1&&(d+="|");else 0===b.indexOf(".")&&(b="*"+b),d="^"+b.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",d=d.replace(/\\\*/g,".*").replace(/\\\?/g,".");return d}function b(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1e3*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1e6*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1e9*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}ngFileUpload.service("Upload",["UploadDataUrl",function(c){var d=ngFileUpload.getAttrWithDefaults;return c.validate=function(a,b,c,e,f,g){function h(a,b){b?i.push(a):j.push(a),l++,l===e.length&&g(i,j)}if(null==d(c,"ngfValidate")&&null==d(c,"ngfAccept"))return g(e);for(var i=[],j=[],k=b(d(c,"ngfAccept"))(a,{$event:f}),l=0,m=0;m<e.length;m++){var n=e[m],o=b(d(c,"ngfValidate"))(a,{$file:n,$event:f});null==o||o!==!1&&!angular.isString(o)?null!=o||null!=k?(o=o||{},null!=k&&(o.accept=k),this.validateFile(n,o,h)):h(n,!0):(n.$error="validate",n.$errorParam=o,h(n,!1))}},c.validateFile=function(c,d,e){if(null==c)return e(c,!1);var f=d.accept;if(null!=d.accept&&angular.isString(d.accept)){var g=new RegExp(a(d.accept),"gi");if(f=null!=c.type&&g.test(c.type.toLowerCase())||null!=c.name&&g.test(c.name.toLowerCase()),!f)return c.$error="accept",e(c,!1)}else if(f===!1)return c.$error="accept",e(c,!1);if(null!=c.size&&d.size&&(d.size.max||d.size.min)){if(c.size>b(d.size.max))return c.$error="size.max",c.$errorParam=d.size.max,e(c,!1);if(c.size<b(d.size.min))return c.$error="size.min",c.$errorParam=d.size.min,e(c,!1)}if(!((d.width||d.height)&&0===c.type.indexOf("image")&&(this.imageDimensions(c,function(a,f){c.width=a,c.height=f,d.width&&(d.width.min||d.width.max)&&(d.width.max&&a>b(d.width.max)&&(c.$error="width.max",c.$errorParam=d.width.max),d.width.min&&a<b(d.width.min)&&(c.$error="width.min",c.$errorParam=d.width.min),a||d.width.soft||(c.$error=d.width.min?"width.min":"width.max",c.$errorParam=d.width.min||d.width.max)),d.height&&(d.height.min||d.height.max)&&(d.height.max&&f>b(d.height.max)&&(c.$error="height.max",c.$errorParam=d.height.max),d.height.min&&f<b(d.height.min)&&(c.$error="height.min",c.$errorParam=d.height.min),f||d.height.soft||(c.$error=d.height.min?"height.min":"height.max",c.$errorParam=d.height.min||d.height.max),e(c,!c.$error))}),d.width&&(d.width.min||d.width.max)||d.height&&(d.height.min||d.height.max))||d.duration&&(0===c.type.indexOf("audio")||0===c.type.indexOf("video"))&&(this.mediaDuration(c,function(a){c.duration=a,(d.duration.min||d.duration.max)&&(d.duration.max&&a>b(d.duration.max)&&(c.$error="duration.max",c.$errorParam=d.duration.max),d.duration.min&&a<b(d.duration.min)&&(c.$error="duration.min",c.$errorParam=d.duration.min),a||d.duration.soft||(c.$error=d.duration.min?"duration.min":"duration.max",c.$errorParam=d.duration.min||d.duration.max),e(c,!c.$error))}),d.duration.min||d.duration.max)))return e(c,!0)},c.imageDimensions=function(a,b){return 0!==a.type.indexOf("image")?!1:void c.dataUrl(a,function(c){var d=angular.element("<img>").attr("src",c).css("visibility","none").css("position","fixed");d.on("load error",function(){var c=d[0].clientWidth,e=d[0].clientHeight;d.remove(),b(c,e,a)}),angular.element(document.body).append(d)},!0)},c.mediaDuration=function(a,b){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?!1:void c.dataUrl(a,function(c){var d=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",c).css("visibility","none").css("position","fixed");d.on("loadedmetadata error",function(){var c=d[0].duration;d.remove(),b(c,a)}),angular.element(document.body).append(d)})},c}])}(),function(){function a(a,e,f,g,h,i,j){function k(a,b,e,f){var g=e.dataTransfer.items,i=[];if(null!=g)for(var j=0;j<g.length;j++)("file"===g[j].kind||""===g[j].kind)&&i.push(g[j]);c.validate(a,h,b,i,e,function(c,g){var i=h(d(b,"ngfDragOverClass"))(a,{$event:e});i&&(i.delay&&(r=i.delay),i.accept&&(i=g&&g.length?i.reject:i.accept)),f(i||d(b,"ngfDragOverClass")||"dragover")})}function l(b,d,e,g){function k(a,b,c){if(null!=b)if(b.isDirectory){var d=(c||"")+b.name;a.push({name:b.name,type:"directory",path:d});var e=b.createReader(),f=[];m++;var g=function(){e.readEntries(function(d){try{if(d.length)f=f.concat(Array.prototype.slice.call(d||[],0)),g();else{for(var e=0;e<f.length;e++)k(a,f[e],(c?c:"")+b.name+"/");m--}}catch(h){m--,console.error(h)}},function(){m--})};g()}else m++,b.file(function(b){try{m--,b.path=(c?c:"")+b.name,a.push(b)}catch(d){m--,console.error(d)}},function(){m--})}var l=[],m=0,n=b.dataTransfer.items;if(n&&n.length>0&&"file"!==j.protocol())for(var o=0;o<n.length;o++){if(n[o].webkitGetAsEntry&&n[o].webkitGetAsEntry()&&n[o].webkitGetAsEntry().isDirectory){var p=n[o].webkitGetAsEntry();if(p.isDirectory&&!e)continue;null!=p&&k(l,p)}else{var q=n[o].getAsFile();null!=q&&l.push(q)}if(!g&&l.length>0)break}else{var r=b.dataTransfer.files;if(null!=r)for(var s=0;s<r.length&&(l.push(r.item(s)),g||!(l.length>0));s++);}var t=0;!function u(e){i(function(){if(m)10*t++<2e4&&u(10);else{if(!g&&l.length>1){for(o=0;"directory"===l[o].type;)o++;l=[l[o]]}c.validate(a,h,f,l,b,function(a,b){d(a,b)})}},e||0)}()}var m=b();if(d(f,"dropAvailable")&&i(function(){a[d(f,"dropAvailable")]?a[d(f,"dropAvailable")].value=m:a[d(f,"dropAvailable")]=m}),!m)return void(h(d(f,"ngfHideOnDropNotAvailable"))(a)===!0&&e.css("display","none"));var n=!1;-1===d(f,"ngfDrop").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfDrop"),function(a){n=a===!1});var o,p=null,q=h(d(f,"ngfStopPropagation")),r=1;e[0].addEventListener("dragover",function(b){if(!e.attr("disabled")&&!n){if(b.preventDefault(),q(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var c=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===c||"linkMove"===c?"move":"copy"}i.cancel(p),o||(o="C",k(a,f,b,function(a){o=a,e.addClass(o)}))}},!1),e[0].addEventListener("dragenter",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation())},!1),e[0].addEventListener("dragleave",function(){e.attr("disabled")||n||(p=i(function(){e.removeClass(o),o=null},r||1))},!1),e[0].addEventListener("drop",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation(),e.removeClass(o),o=null,l(b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)},h(d(f,"ngfAllowDir"))(a)!==!1,d(f,"multiple")||h(d(f,"ngfMultiple"))(a)))},!1),e[0].addEventListener("paste",function(b){if(!e.attr("disabled")&&!n){var j=[],k=b.clipboardData||b.originalEvent.clipboardData;if(k&&k.items){for(var l=0;l<k.items.length;l++)-1!==k.items[l].type.indexOf("image")&&j.push(k.items[l].getAsFile());c.validate(a,h,f,j,b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)})}}},!1)}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a}var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout",function(a,c){return function(e,f,g){if(b()){var h=a(d(g,"ngfDropAvailable"));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(); | ||
/*! 6.2.1 */ | ||
!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={}),FileAPI.shouldLoad=window.XMLHttpRequest&&!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){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.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.hasFlash=b()}FileAPI.ngfFixIE=function(d,e,f,g){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var h=function(){if(d.attr("disabled"))d.$$ngfRefElem.removeClass("js-fileapi-wrapper");else{var b=d.$$ngfRefElem;b?f(d.$$ngfRefElem):(b=d.$$ngfRefElem=e(),b.addClass("js-fileapi-wrapper"),!a(d),setTimeout(function(){b.bind("mouseenter",h)},10),b.bind("change",function(a){i.apply(this,[a]),g.apply(this,[a])})),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")}};d.bind("mouseenter",h);var i=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.readAsArrayBuffer=function(a){FileAPI.readAsBinaryString(a,d)},this.readAsBinaryString=function(a){FileAPI.readAsBinaryString(a,d)},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="6.2.1",ngFileUpload.defaults={},ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{};var e=b.defer(),f=e.promise;return d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)}))},!1))}},a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)}),f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.progressFunc=a,f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(a){function b(c,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))c.append(e,d);else if("form"===a.sendFieldsAs)if(angular.isObject(d))for(var f in d)d.hasOwnProperty(f)&&b(c,d[f],e+"["+f+"]");else c.append(e,d);else d=angular.isString(d)?d:JSON.stringify(d),"json-blob"===a.sendFieldsAs?c.append(e,new Blob([d],{type:"application/json"})):c.append(e,d)}return 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(c){var d,e=new FormData,f={};for(d in a.fields)a.fields.hasOwnProperty(d)&&(f[d]=a.fields[d]);c&&(f.data=c);for(d in f)if(f.hasOwnProperty(d)){var g=f[d];a.formDataAppender?a.formDataAppender(e,d,g):b(e,g,d)}if(null!=a.file){var h=a.fileFormDataName||"file";if(angular.isArray(a.file))for(var i=angular.isString(h),j=0;j<a.file.length;j++)e.append(i?h:h[j],a.file[j],a.fileName&&a.fileName[j]||a.file[j].name);else e.append(h,a.file,a.fileName||a.file.name)}return e}),d(a)},this.http=function(b){return b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof Blob?b:a.defaults.transformRequest[0](arguments)},d(b)},this.setDefaults=function(a){ngFileUpload.defaults=a||{}},ngFileUpload.Upload=this}]),function(){function a(a,e,f,g,h,i,j){function k(){return"input"===e[0].tagName.toLowerCase()&&f.type&&"file"===f.type.toLowerCase()}function l(b){var j=b.__files_||b.target&&b.target.files;c.validate(a,h,f,j,b,function(c,j){e.$$ngfHasFile=!0,ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),c,j,b),0===c.length&&(b.target.value=c)})}function m(b){d(f,"ngfMultiple")&&b.attr("multiple",h(d(f,"ngfMultiple"))(a)),d(f,"ngfCapture")&&b.attr("capture",h(d(f,"ngfCapture"))(a)),d(f,"accept")&&b.attr("accept",d(f,"accept"));for(var c=0;c<e[0].attributes.length;c++){var g=e[0].attributes[c];(k()&&"type"!==g.name||"type"!==g.name&&"class"!==g.name&&"id"!==g.name&&"style"!==g.name)&&((null==g.value||""===g.value)&&("required"===g.name&&(g.value="required"),"multiple"===g.name&&(g.value="multiple")),b.attr(g.name,g.value))}}function n(b,c){if(!c&&(b||k()))return e.$$ngfRefElem||e;if(e.$$ngfProgramClick)return e;var d=angular.element('<input type="file">');return m(d),k()?(e.replaceWith(d),e=d,d.attr("__ngf_gen__",!0),j(e)(a)):(d.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"),e.$$ngfRefElem&&e.$$ngfRefElem.remove(),e.$$ngfRefElem=d,document.body.appendChild(d[0])),d}function o(b){e.$$ngfHasFile&&(ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),[],[],b,!0),delete e.$$ngfHasFile)}function p(c){function g(a){a&&!e.$$ngfProgramClick&&(e.$$ngfProgramClick=!0,t[0].click(),i(function(){delete e.$$ngfProgramClick},500)),!k()&&a||!s||e.bind("click touchstart touchend",p)}if(e.attr("disabled")||q)return!1;if(null!=c){var j=c.changedTouches||c.originalEvent&&c.originalEvent.changedTouches;if("touchstart"===c.type)return r=j?j[0].clientY:0,!0;if(c.stopPropagation(),c.preventDefault(),"touchend"===c.type){var m=j?j[0].clientY:0;if(Math.abs(m-r)>20)return!1}}var s=h(d(f,"ngfResetOnClick"))(a)!==!1,t=n(c,s);return t&&((!c||s)&&t.bind("change",l),c&&s&&h(d(f,"ngfResetModelOnClick"))(a)!==!1&&o(c),b(navigator.userAgent)?setTimeout(function(){g(c)},0):g(c)),!1}if(!e.attr("__ngf_gen__")){a.$on("$destroy",function(){e.$$ngfRefElem&&e.$$ngfRefElem.remove()});var q=!1;-1===d(f,"ngfSelect").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfSelect"),function(a){q=a===!1});var r=0;window.FileAPI&&window.FileAPI.ngfFixIE?window.FileAPI.ngfFixIE(e,n,m,l):p()}}function b(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=ngFileUpload.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)}ngFileUpload.getAttrWithDefaults=function(a,b){return null!=a[b]?a[b]:null==ngFileUpload.defaults[b]?ngFileUpload.defaults[b]:ngFileUpload.defaults[b].toString()};var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.updateModel=function(a,b,c,e,f,g,h,i,j,k){function l(){var k=a(d(f,"ngfKeep"))(c);if(k===!0){var l=(e.$modelValue||[]).slice(0);if(h&&h.length)if(a(d(f,"ngfKeepDistinct"))(c)===!0){for(var m=l.length,n=0;n<h.length;n++){for(var o=0;m>o&&h[n].name!==l[o].name;o++);o===m&&l.push(h[n])}h=l}else h=l.concat(h);else h=l}var p=h&&h.length?h[0]:null;if(e){var q=!a(d(f,"ngfMultiple"))(c)&&!d(f,"multiple")&&!k;b(function(){a(d(f,"ngModel")).assign(c,q?p:h)}),b(function(){e&&e.$setViewValue(q?p:null!=h&&0===h.length?null:h)})}var r=d(f,"ngfModel");r&&a(r).assign(c,h),d(f,"ngModelRejected")&&a(d(f,"ngModelRejected")).assign(c,i),g&&a(g)(c,{$files:h,$file:p,$rejectedFiles:i,$event:j})}k?l():b(function(){l()})}}(),function(){ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout",function(a,b){return a.dataUrl=function(a,c,d){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)?b(function(){var e=window.URL||window.webkitURL;if(e&&e.createObjectURL&&!d){var f;try{f=e.createObjectURL(a)}catch(g){c("",a)}f&&c(f,a)}else{var h=new FileReader;h.readAsDataURL(a),h.onload=function(d){b(function(){c(d.target.result,a)})}}}):c(null,a)},a}]),ngFileUpload.directive("ngfSrc",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("src","{{("+f.ngfSrc+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}"),f.$set("ngfSrc",null),b(e)(d)})}}}]),ngFileUpload.directive("ngfBackground",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("style",e.attr("style")+";background-image:url('{{("+f.ngfBackground+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}')"),f.$set("ngfBackground",null),b(e)(d)})}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/),a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d){return angular.isString(c)?b.trustAsResourceUrl(c):c&&!c.dataUrl?(void 0===c.dataUrl&&angular.isObject(c)&&(c.dataUrl=null,a.dataUrl(c,function(a,b){b.dataUrl=a},d)),""):(c&&c.dataUrl?b.trustAsResourceUrl(c.dataUrl):c)||""}}])}(),function(){function a(b){if(b.length>2&&"/"===b[0]&&"/"===b[b.length-1])return b.substring(1,b.length-1);var c=b.split(","),d="";if(c.length>1)for(var e=0;e<c.length;e++)d+="("+a(c[e])+")",e<c.length-1&&(d+="|");else 0===b.indexOf(".")&&(b="*"+b),d="^"+b.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",d=d.replace(/\\\*/g,".*").replace(/\\\?/g,".");return d}function b(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1e3*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1e6*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1e9*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}ngFileUpload.service("Upload",["UploadDataUrl",function(c){var d=ngFileUpload.getAttrWithDefaults;return c.validate=function(a,b,c,e,f,g){function h(a,b){b?i.push(a):j.push(a),l++,l===e.length&&g(i,j)}if(null==d(c,"ngfValidate")&&null==d(c,"ngfAccept"))return g(e);for(var i=[],j=[],k=b(d(c,"ngfAccept"))(a,{$event:f}),l=0,m=0;m<e.length;m++){var n=e[m],o=b(d(c,"ngfValidate"))(a,{$file:n,$event:f});null==o||o!==!1&&!angular.isString(o)?null!=o||null!=k?(o=o||{},null!=k&&(o.accept=k),this.validateFile(n,o,h)):h(n,!0):(n.$error="validate",n.$errorParam=o,h(n,!1))}},c.validateFile=function(c,d,e){if(null==c)return e(c,!1);var f=d.accept;if(null!=d.accept&&angular.isString(d.accept)){var g=new RegExp(a(d.accept),"gi");if(f=null!=c.type&&g.test(c.type.toLowerCase())||null!=c.name&&g.test(c.name.toLowerCase()),!f)return c.$error="accept",e(c,!1)}else if(f===!1)return c.$error="accept",e(c,!1);if(null!=c.size&&d.size&&(d.size.max||d.size.min)){if(c.size>b(d.size.max))return c.$error="size.max",c.$errorParam=d.size.max,e(c,!1);if(c.size<b(d.size.min))return c.$error="size.min",c.$errorParam=d.size.min,e(c,!1)}if(!((d.width||d.height)&&0===c.type.indexOf("image")&&(this.imageDimensions(c,function(a,f){c.width=a,c.height=f,d.width&&(d.width.min||d.width.max)&&(d.width.max&&a>b(d.width.max)&&(c.$error="width.max",c.$errorParam=d.width.max),d.width.min&&a<b(d.width.min)&&(c.$error="width.min",c.$errorParam=d.width.min),a||d.width.soft||(c.$error=d.width.min?"width.min":"width.max",c.$errorParam=d.width.min||d.width.max)),d.height&&(d.height.min||d.height.max)&&(d.height.max&&f>b(d.height.max)&&(c.$error="height.max",c.$errorParam=d.height.max),d.height.min&&f<b(d.height.min)&&(c.$error="height.min",c.$errorParam=d.height.min),f||d.height.soft||(c.$error=d.height.min?"height.min":"height.max",c.$errorParam=d.height.min||d.height.max),e(c,!c.$error))}),d.width&&(d.width.min||d.width.max)||d.height&&(d.height.min||d.height.max))||d.duration&&(0===c.type.indexOf("audio")||0===c.type.indexOf("video"))&&(this.mediaDuration(c,function(a){c.duration=a,(d.duration.min||d.duration.max)&&(d.duration.max&&a>b(d.duration.max)&&(c.$error="duration.max",c.$errorParam=d.duration.max),d.duration.min&&a<b(d.duration.min)&&(c.$error="duration.min",c.$errorParam=d.duration.min),a||d.duration.soft||(c.$error=d.duration.min?"duration.min":"duration.max",c.$errorParam=d.duration.min||d.duration.max),e(c,!c.$error))}),d.duration.min||d.duration.max)))return e(c,!0)},c.imageDimensions=function(a,b){return 0!==a.type.indexOf("image")?!1:void c.dataUrl(a,function(c){var d=angular.element("<img>").attr("src",c).css("visibility","none").css("position","fixed");d.on("load error",function(){var c=d[0].clientWidth,e=d[0].clientHeight;d.remove(),b(c,e,a)}),angular.element(document.body).append(d)},!0)},c.mediaDuration=function(a,b){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?!1:void c.dataUrl(a,function(c){var d=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",c).css("visibility","none").css("position","fixed");d.on("loadedmetadata error",function(){var c=d[0].duration;d.remove(),b(c,a)}),angular.element(document.body).append(d)})},c}])}(),function(){function a(a,e,f,g,h,i,j){function k(a,b,e,f){var g=e.dataTransfer.items,i=[];if(null!=g)for(var j=0;j<g.length;j++)("file"===g[j].kind||""===g[j].kind)&&i.push(g[j]);c.validate(a,h,b,i,e,function(c,g){var i=h(d(b,"ngfDragOverClass"))(a,{$event:e});i&&(i.delay&&(r=i.delay),i.accept&&(i=g&&g.length?i.reject:i.accept)),f(i||d(b,"ngfDragOverClass")||"dragover")})}function l(b,d,e,g){function k(a,b,c){if(null!=b)if(b.isDirectory){var d=(c||"")+b.name;a.push({name:b.name,type:"directory",path:d});var e=b.createReader(),f=[];m++;var g=function(){e.readEntries(function(d){try{if(d.length)f=f.concat(Array.prototype.slice.call(d||[],0)),g();else{for(var e=0;e<f.length;e++)k(a,f[e],(c?c:"")+b.name+"/");m--}}catch(h){m--,console.error(h)}},function(){m--})};g()}else m++,b.file(function(b){try{m--,b.path=(c?c:"")+b.name,a.push(b)}catch(d){m--,console.error(d)}},function(){m--})}var l=[],m=0,n=b.dataTransfer.items;if(n&&n.length>0&&"file"!==j.protocol())for(var o=0;o<n.length;o++){if(n[o].webkitGetAsEntry&&n[o].webkitGetAsEntry()&&n[o].webkitGetAsEntry().isDirectory){var p=n[o].webkitGetAsEntry();if(p.isDirectory&&!e)continue;null!=p&&k(l,p)}else{var q=n[o].getAsFile();null!=q&&l.push(q)}if(!g&&l.length>0)break}else{var r=b.dataTransfer.files;if(null!=r)for(var s=0;s<r.length&&(l.push(r.item(s)),g||!(l.length>0));s++);}var t=0;!function u(e){i(function(){if(m)10*t++<2e4&&u(10);else{if(!g&&l.length>1){for(o=0;"directory"===l[o].type;)o++;l=[l[o]]}c.validate(a,h,f,l,b,function(a,b){d(a,b)})}},e||0)}()}var m=b();if(d(f,"dropAvailable")&&i(function(){a[d(f,"dropAvailable")]?a[d(f,"dropAvailable")].value=m:a[d(f,"dropAvailable")]=m}),!m)return void(h(d(f,"ngfHideOnDropNotAvailable"))(a)===!0&&e.css("display","none"));var n=!1;-1===d(f,"ngfDrop").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfDrop"),function(a){n=a===!1});var o,p=null,q=h(d(f,"ngfStopPropagation")),r=1;e[0].addEventListener("dragover",function(b){if(!e.attr("disabled")&&!n){if(b.preventDefault(),q(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var c=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===c||"linkMove"===c?"move":"copy"}i.cancel(p),o||(o="C",k(a,f,b,function(a){o=a,e.addClass(o)}))}},!1),e[0].addEventListener("dragenter",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation())},!1),e[0].addEventListener("dragleave",function(){e.attr("disabled")||n||(p=i(function(){e.removeClass(o),o=null},r||1))},!1),e[0].addEventListener("drop",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation(),e.removeClass(o),o=null,l(b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)},h(d(f,"ngfAllowDir"))(a)!==!1,d(f,"multiple")||h(d(f,"ngfMultiple"))(a)))},!1),e[0].addEventListener("paste",function(b){if(!e.attr("disabled")&&!n){var j=[],k=b.clipboardData||b.originalEvent.clipboardData;if(k&&k.items){for(var l=0;l<k.items.length;l++)-1!==k.items[l].type.indexOf("image")&&j.push(k.items[l].getAsFile());c.validate(a,h,f,j,b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)})}}},!1)}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a}var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout",function(a,c){return function(e,f,g){if(b()){var h=a(d(g,"ngfDropAvailable"));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(); |
@@ -5,3 +5,3 @@ /**! | ||
* @author Danial <danial.farid@gmail.com> | ||
* @version 6.2.0 | ||
* @version 6.2.1 | ||
*/ | ||
@@ -8,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! 6.2.0 */ | ||
/*! 6.2.1 */ | ||
!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={}),FileAPI.shouldLoad=window.XMLHttpRequest&&!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){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.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.hasFlash=b()}FileAPI.ngfFixIE=function(d,e,f,g){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var h=function(){if(d.attr("disabled"))d.$$ngfRefElem.removeClass("js-fileapi-wrapper");else{var b=d.$$ngfRefElem;b?f(d.$$ngfRefElem):(b=d.$$ngfRefElem=e(),b.addClass("js-fileapi-wrapper"),!a(d),setTimeout(function(){b.bind("mouseenter",h)},10),b.bind("change",function(a){i.apply(this,[a]),g.apply(this,[a])})),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")}};d.bind("mouseenter",h);var i=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.readAsArrayBuffer=function(a){FileAPI.readAsBinaryString(a,d)},this.readAsBinaryString=function(a){FileAPI.readAsBinaryString(a,d)},this.readAsDataURL=function(a){FileAPI.readAsDataURL(a,d)},this.readAsText=function(a){FileAPI.readAsText(a,d)}}); |
/**! | ||
* AngularJS file upload/drop directive and service with progress and abort | ||
* @author Danial <danial.farid@gmail.com> | ||
* @version 6.2.0 | ||
* @version 6.2.1 | ||
*/ | ||
@@ -25,3 +25,3 @@ | ||
ngFileUpload.version = '6.2.0'; | ||
ngFileUpload.version = '6.2.1'; | ||
ngFileUpload.defaults = {}; | ||
@@ -550,4 +550,6 @@ | ||
return function (file, disallowObjectUrl) { | ||
//return 'aaaa' + file + disallowObjectUrl + $sce + UploadDataUrl; | ||
if (file && !file.dataUrl && !angular.isString(file)) { | ||
if (angular.isString(file)) { | ||
return $sce.trustAsResourceUrl(file); | ||
} | ||
if (file && !file.dataUrl) { | ||
if (file.dataUrl === undefined && angular.isObject(file)) { | ||
@@ -554,0 +556,0 @@ file.dataUrl = null; |
@@ -1,2 +0,2 @@ | ||
/*! 6.2.0 */ | ||
!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="6.2.0",ngFileUpload.defaults={},ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{};var e=b.defer(),f=e.promise;return d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)}))},!1))}},a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)}),f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.progressFunc=a,f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(a){function b(c,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))c.append(e,d);else if("form"===a.sendFieldsAs)if(angular.isObject(d))for(var f in d)d.hasOwnProperty(f)&&b(c,d[f],e+"["+f+"]");else c.append(e,d);else d=angular.isString(d)?d:JSON.stringify(d),"json-blob"===a.sendFieldsAs?c.append(e,new Blob([d],{type:"application/json"})):c.append(e,d)}return 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(c){var d,e=new FormData,f={};for(d in a.fields)a.fields.hasOwnProperty(d)&&(f[d]=a.fields[d]);c&&(f.data=c);for(d in f)if(f.hasOwnProperty(d)){var g=f[d];a.formDataAppender?a.formDataAppender(e,d,g):b(e,g,d)}if(null!=a.file){var h=a.fileFormDataName||"file";if(angular.isArray(a.file))for(var i=angular.isString(h),j=0;j<a.file.length;j++)e.append(i?h:h[j],a.file[j],a.fileName&&a.fileName[j]||a.file[j].name);else e.append(h,a.file,a.fileName||a.file.name)}return e}),d(a)},this.http=function(b){return b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof Blob?b:a.defaults.transformRequest[0](arguments)},d(b)},this.setDefaults=function(a){ngFileUpload.defaults=a||{}},ngFileUpload.Upload=this}]),function(){function a(a,e,f,g,h,i,j){function k(){return"input"===e[0].tagName.toLowerCase()&&f.type&&"file"===f.type.toLowerCase()}function l(b){var j=b.__files_||b.target&&b.target.files;c.validate(a,h,f,j,b,function(c,j){e.$$ngfHasFile=!0,ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),c,j,b),0===c.length&&(b.target.value=c)})}function m(b){d(f,"ngfMultiple")&&b.attr("multiple",h(d(f,"ngfMultiple"))(a)),d(f,"ngfCapture")&&b.attr("capture",h(d(f,"ngfCapture"))(a)),d(f,"accept")&&b.attr("accept",d(f,"accept"));for(var c=0;c<e[0].attributes.length;c++){var g=e[0].attributes[c];(k()&&"type"!==g.name||"type"!==g.name&&"class"!==g.name&&"id"!==g.name&&"style"!==g.name)&&((null==g.value||""===g.value)&&("required"===g.name&&(g.value="required"),"multiple"===g.name&&(g.value="multiple")),b.attr(g.name,g.value))}}function n(b,c){if(!c&&(b||k()))return e.$$ngfRefElem||e;if(e.$$ngfProgramClick)return e;var d=angular.element('<input type="file">');return m(d),k()?(e.replaceWith(d),e=d,d.attr("__ngf_gen__",!0),j(e)(a)):(d.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"),e.$$ngfRefElem&&e.$$ngfRefElem.remove(),e.$$ngfRefElem=d,document.body.appendChild(d[0])),d}function o(b){e.$$ngfHasFile&&(ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),[],[],b,!0),delete e.$$ngfHasFile)}function p(c){function g(a){a&&!e.$$ngfProgramClick&&(e.$$ngfProgramClick=!0,t[0].click(),i(function(){delete e.$$ngfProgramClick},500)),!k()&&a||!s||e.bind("click touchstart touchend",p)}if(e.attr("disabled")||q)return!1;if(null!=c){var j=c.changedTouches||c.originalEvent&&c.originalEvent.changedTouches;if("touchstart"===c.type)return r=j?j[0].clientY:0,!0;if(c.stopPropagation(),c.preventDefault(),"touchend"===c.type){var m=j?j[0].clientY:0;if(Math.abs(m-r)>20)return!1}}var s=h(d(f,"ngfResetOnClick"))(a)!==!1,t=n(c,s);return t&&((!c||s)&&t.bind("change",l),c&&s&&h(d(f,"ngfResetModelOnClick"))(a)!==!1&&o(c),b(navigator.userAgent)?setTimeout(function(){g(c)},0):g(c)),!1}if(!e.attr("__ngf_gen__")){a.$on("$destroy",function(){e.$$ngfRefElem&&e.$$ngfRefElem.remove()});var q=!1;-1===d(f,"ngfSelect").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfSelect"),function(a){q=a===!1});var r=0;window.FileAPI&&window.FileAPI.ngfFixIE?window.FileAPI.ngfFixIE(e,n,m,l):p()}}function b(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=ngFileUpload.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)}ngFileUpload.getAttrWithDefaults=function(a,b){return null!=a[b]?a[b]:null==ngFileUpload.defaults[b]?ngFileUpload.defaults[b]:ngFileUpload.defaults[b].toString()};var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.updateModel=function(a,b,c,e,f,g,h,i,j,k){function l(){var k=a(d(f,"ngfKeep"))(c);if(k===!0){var l=(e.$modelValue||[]).slice(0);if(h&&h.length)if(a(d(f,"ngfKeepDistinct"))(c)===!0){for(var m=l.length,n=0;n<h.length;n++){for(var o=0;m>o&&h[n].name!==l[o].name;o++);o===m&&l.push(h[n])}h=l}else h=l.concat(h);else h=l}var p=h&&h.length?h[0]:null;if(e){var q=!a(d(f,"ngfMultiple"))(c)&&!d(f,"multiple")&&!k;b(function(){a(d(f,"ngModel")).assign(c,q?p:h)}),b(function(){e&&e.$setViewValue(q?p:null!=h&&0===h.length?null:h)})}var r=d(f,"ngfModel");r&&a(r).assign(c,h),d(f,"ngModelRejected")&&a(d(f,"ngModelRejected")).assign(c,i),g&&a(g)(c,{$files:h,$file:p,$rejectedFiles:i,$event:j})}k?l():b(function(){l()})}}(),function(){ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout",function(a,b){return a.dataUrl=function(a,c,d){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)?b(function(){var e=window.URL||window.webkitURL;if(e&&e.createObjectURL&&!d){var f;try{f=e.createObjectURL(a)}catch(g){c("",a)}f&&c(f,a)}else{var h=new FileReader;h.readAsDataURL(a),h.onload=function(d){b(function(){c(d.target.result,a)})}}}):c(null,a)},a}]),ngFileUpload.directive("ngfSrc",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("src","{{("+f.ngfSrc+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}"),f.$set("ngfSrc",null),b(e)(d)})}}}]),ngFileUpload.directive("ngfBackground",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("style",e.attr("style")+";background-image:url('{{("+f.ngfBackground+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}')"),f.$set("ngfBackground",null),b(e)(d)})}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/),a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d){return!c||c.dataUrl||angular.isString(c)?(c&&c.dataUrl?b.trustAsResourceUrl(c.dataUrl):c)||"":(void 0===c.dataUrl&&angular.isObject(c)&&(c.dataUrl=null,a.dataUrl(c,function(a,b){b.dataUrl=a},d)),"")}}])}(),function(){function a(b){if(b.length>2&&"/"===b[0]&&"/"===b[b.length-1])return b.substring(1,b.length-1);var c=b.split(","),d="";if(c.length>1)for(var e=0;e<c.length;e++)d+="("+a(c[e])+")",e<c.length-1&&(d+="|");else 0===b.indexOf(".")&&(b="*"+b),d="^"+b.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",d=d.replace(/\\\*/g,".*").replace(/\\\?/g,".");return d}function b(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1e3*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1e6*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1e9*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}ngFileUpload.service("Upload",["UploadDataUrl",function(c){var d=ngFileUpload.getAttrWithDefaults;return c.validate=function(a,b,c,e,f,g){function h(a,b){b?i.push(a):j.push(a),l++,l===e.length&&g(i,j)}if(null==d(c,"ngfValidate")&&null==d(c,"ngfAccept"))return g(e);for(var i=[],j=[],k=b(d(c,"ngfAccept"))(a,{$event:f}),l=0,m=0;m<e.length;m++){var n=e[m],o=b(d(c,"ngfValidate"))(a,{$file:n,$event:f});null==o||o!==!1&&!angular.isString(o)?null!=o||null!=k?(o=o||{},null!=k&&(o.accept=k),this.validateFile(n,o,h)):h(n,!0):(n.$error="validate",n.$errorParam=o,h(n,!1))}},c.validateFile=function(c,d,e){if(null==c)return e(c,!1);var f=d.accept;if(null!=d.accept&&angular.isString(d.accept)){var g=new RegExp(a(d.accept),"gi");if(f=null!=c.type&&g.test(c.type.toLowerCase())||null!=c.name&&g.test(c.name.toLowerCase()),!f)return c.$error="accept",e(c,!1)}else if(f===!1)return c.$error="accept",e(c,!1);if(null!=c.size&&d.size&&(d.size.max||d.size.min)){if(c.size>b(d.size.max))return c.$error="size.max",c.$errorParam=d.size.max,e(c,!1);if(c.size<b(d.size.min))return c.$error="size.min",c.$errorParam=d.size.min,e(c,!1)}if(!((d.width||d.height)&&0===c.type.indexOf("image")&&(this.imageDimensions(c,function(a,f){c.width=a,c.height=f,d.width&&(d.width.min||d.width.max)&&(d.width.max&&a>b(d.width.max)&&(c.$error="width.max",c.$errorParam=d.width.max),d.width.min&&a<b(d.width.min)&&(c.$error="width.min",c.$errorParam=d.width.min),a||d.width.soft||(c.$error=d.width.min?"width.min":"width.max",c.$errorParam=d.width.min||d.width.max)),d.height&&(d.height.min||d.height.max)&&(d.height.max&&f>b(d.height.max)&&(c.$error="height.max",c.$errorParam=d.height.max),d.height.min&&f<b(d.height.min)&&(c.$error="height.min",c.$errorParam=d.height.min),f||d.height.soft||(c.$error=d.height.min?"height.min":"height.max",c.$errorParam=d.height.min||d.height.max),e(c,!c.$error))}),d.width&&(d.width.min||d.width.max)||d.height&&(d.height.min||d.height.max))||d.duration&&(0===c.type.indexOf("audio")||0===c.type.indexOf("video"))&&(this.mediaDuration(c,function(a){c.duration=a,(d.duration.min||d.duration.max)&&(d.duration.max&&a>b(d.duration.max)&&(c.$error="duration.max",c.$errorParam=d.duration.max),d.duration.min&&a<b(d.duration.min)&&(c.$error="duration.min",c.$errorParam=d.duration.min),a||d.duration.soft||(c.$error=d.duration.min?"duration.min":"duration.max",c.$errorParam=d.duration.min||d.duration.max),e(c,!c.$error))}),d.duration.min||d.duration.max)))return e(c,!0)},c.imageDimensions=function(a,b){return 0!==a.type.indexOf("image")?!1:void c.dataUrl(a,function(c){var d=angular.element("<img>").attr("src",c).css("visibility","none").css("position","fixed");d.on("load error",function(){var c=d[0].clientWidth,e=d[0].clientHeight;d.remove(),b(c,e,a)}),angular.element(document.body).append(d)},!0)},c.mediaDuration=function(a,b){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?!1:void c.dataUrl(a,function(c){var d=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",c).css("visibility","none").css("position","fixed");d.on("loadedmetadata error",function(){var c=d[0].duration;d.remove(),b(c,a)}),angular.element(document.body).append(d)})},c}])}(),function(){function a(a,e,f,g,h,i,j){function k(a,b,e,f){var g=e.dataTransfer.items,i=[];if(null!=g)for(var j=0;j<g.length;j++)("file"===g[j].kind||""===g[j].kind)&&i.push(g[j]);c.validate(a,h,b,i,e,function(c,g){var i=h(d(b,"ngfDragOverClass"))(a,{$event:e});i&&(i.delay&&(r=i.delay),i.accept&&(i=g&&g.length?i.reject:i.accept)),f(i||d(b,"ngfDragOverClass")||"dragover")})}function l(b,d,e,g){function k(a,b,c){if(null!=b)if(b.isDirectory){var d=(c||"")+b.name;a.push({name:b.name,type:"directory",path:d});var e=b.createReader(),f=[];m++;var g=function(){e.readEntries(function(d){try{if(d.length)f=f.concat(Array.prototype.slice.call(d||[],0)),g();else{for(var e=0;e<f.length;e++)k(a,f[e],(c?c:"")+b.name+"/");m--}}catch(h){m--,console.error(h)}},function(){m--})};g()}else m++,b.file(function(b){try{m--,b.path=(c?c:"")+b.name,a.push(b)}catch(d){m--,console.error(d)}},function(){m--})}var l=[],m=0,n=b.dataTransfer.items;if(n&&n.length>0&&"file"!==j.protocol())for(var o=0;o<n.length;o++){if(n[o].webkitGetAsEntry&&n[o].webkitGetAsEntry()&&n[o].webkitGetAsEntry().isDirectory){var p=n[o].webkitGetAsEntry();if(p.isDirectory&&!e)continue;null!=p&&k(l,p)}else{var q=n[o].getAsFile();null!=q&&l.push(q)}if(!g&&l.length>0)break}else{var r=b.dataTransfer.files;if(null!=r)for(var s=0;s<r.length&&(l.push(r.item(s)),g||!(l.length>0));s++);}var t=0;!function u(e){i(function(){if(m)10*t++<2e4&&u(10);else{if(!g&&l.length>1){for(o=0;"directory"===l[o].type;)o++;l=[l[o]]}c.validate(a,h,f,l,b,function(a,b){d(a,b)})}},e||0)}()}var m=b();if(d(f,"dropAvailable")&&i(function(){a[d(f,"dropAvailable")]?a[d(f,"dropAvailable")].value=m:a[d(f,"dropAvailable")]=m}),!m)return void(h(d(f,"ngfHideOnDropNotAvailable"))(a)===!0&&e.css("display","none"));var n=!1;-1===d(f,"ngfDrop").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfDrop"),function(a){n=a===!1});var o,p=null,q=h(d(f,"ngfStopPropagation")),r=1;e[0].addEventListener("dragover",function(b){if(!e.attr("disabled")&&!n){if(b.preventDefault(),q(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var c=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===c||"linkMove"===c?"move":"copy"}i.cancel(p),o||(o="C",k(a,f,b,function(a){o=a,e.addClass(o)}))}},!1),e[0].addEventListener("dragenter",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation())},!1),e[0].addEventListener("dragleave",function(){e.attr("disabled")||n||(p=i(function(){e.removeClass(o),o=null},r||1))},!1),e[0].addEventListener("drop",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation(),e.removeClass(o),o=null,l(b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)},h(d(f,"ngfAllowDir"))(a)!==!1,d(f,"multiple")||h(d(f,"ngfMultiple"))(a)))},!1),e[0].addEventListener("paste",function(b){if(!e.attr("disabled")&&!n){var j=[],k=b.clipboardData||b.originalEvent.clipboardData;if(k&&k.items){for(var l=0;l<k.items.length;l++)-1!==k.items[l].type.indexOf("image")&&j.push(k.items[l].getAsFile());c.validate(a,h,f,j,b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)})}}},!1)}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a}var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout",function(a,c){return function(e,f,g){if(b()){var h=a(d(g,"ngfDropAvailable"));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(); | ||
/*! 6.2.1 */ | ||
!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="6.2.1",ngFileUpload.defaults={},ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{};var e=b.defer(),f=e.promise;return d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)}))},!1))}},a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)}),f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.progressFunc=a,f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(a){function b(c,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))c.append(e,d);else if("form"===a.sendFieldsAs)if(angular.isObject(d))for(var f in d)d.hasOwnProperty(f)&&b(c,d[f],e+"["+f+"]");else c.append(e,d);else d=angular.isString(d)?d:JSON.stringify(d),"json-blob"===a.sendFieldsAs?c.append(e,new Blob([d],{type:"application/json"})):c.append(e,d)}return 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(c){var d,e=new FormData,f={};for(d in a.fields)a.fields.hasOwnProperty(d)&&(f[d]=a.fields[d]);c&&(f.data=c);for(d in f)if(f.hasOwnProperty(d)){var g=f[d];a.formDataAppender?a.formDataAppender(e,d,g):b(e,g,d)}if(null!=a.file){var h=a.fileFormDataName||"file";if(angular.isArray(a.file))for(var i=angular.isString(h),j=0;j<a.file.length;j++)e.append(i?h:h[j],a.file[j],a.fileName&&a.fileName[j]||a.file[j].name);else e.append(h,a.file,a.fileName||a.file.name)}return e}),d(a)},this.http=function(b){return b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof Blob?b:a.defaults.transformRequest[0](arguments)},d(b)},this.setDefaults=function(a){ngFileUpload.defaults=a||{}},ngFileUpload.Upload=this}]),function(){function a(a,e,f,g,h,i,j){function k(){return"input"===e[0].tagName.toLowerCase()&&f.type&&"file"===f.type.toLowerCase()}function l(b){var j=b.__files_||b.target&&b.target.files;c.validate(a,h,f,j,b,function(c,j){e.$$ngfHasFile=!0,ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),c,j,b),0===c.length&&(b.target.value=c)})}function m(b){d(f,"ngfMultiple")&&b.attr("multiple",h(d(f,"ngfMultiple"))(a)),d(f,"ngfCapture")&&b.attr("capture",h(d(f,"ngfCapture"))(a)),d(f,"accept")&&b.attr("accept",d(f,"accept"));for(var c=0;c<e[0].attributes.length;c++){var g=e[0].attributes[c];(k()&&"type"!==g.name||"type"!==g.name&&"class"!==g.name&&"id"!==g.name&&"style"!==g.name)&&((null==g.value||""===g.value)&&("required"===g.name&&(g.value="required"),"multiple"===g.name&&(g.value="multiple")),b.attr(g.name,g.value))}}function n(b,c){if(!c&&(b||k()))return e.$$ngfRefElem||e;if(e.$$ngfProgramClick)return e;var d=angular.element('<input type="file">');return m(d),k()?(e.replaceWith(d),e=d,d.attr("__ngf_gen__",!0),j(e)(a)):(d.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"),e.$$ngfRefElem&&e.$$ngfRefElem.remove(),e.$$ngfRefElem=d,document.body.appendChild(d[0])),d}function o(b){e.$$ngfHasFile&&(ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),[],[],b,!0),delete e.$$ngfHasFile)}function p(c){function g(a){a&&!e.$$ngfProgramClick&&(e.$$ngfProgramClick=!0,t[0].click(),i(function(){delete e.$$ngfProgramClick},500)),!k()&&a||!s||e.bind("click touchstart touchend",p)}if(e.attr("disabled")||q)return!1;if(null!=c){var j=c.changedTouches||c.originalEvent&&c.originalEvent.changedTouches;if("touchstart"===c.type)return r=j?j[0].clientY:0,!0;if(c.stopPropagation(),c.preventDefault(),"touchend"===c.type){var m=j?j[0].clientY:0;if(Math.abs(m-r)>20)return!1}}var s=h(d(f,"ngfResetOnClick"))(a)!==!1,t=n(c,s);return t&&((!c||s)&&t.bind("change",l),c&&s&&h(d(f,"ngfResetModelOnClick"))(a)!==!1&&o(c),b(navigator.userAgent)?setTimeout(function(){g(c)},0):g(c)),!1}if(!e.attr("__ngf_gen__")){a.$on("$destroy",function(){e.$$ngfRefElem&&e.$$ngfRefElem.remove()});var q=!1;-1===d(f,"ngfSelect").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfSelect"),function(a){q=a===!1});var r=0;window.FileAPI&&window.FileAPI.ngfFixIE?window.FileAPI.ngfFixIE(e,n,m,l):p()}}function b(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=ngFileUpload.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)}ngFileUpload.getAttrWithDefaults=function(a,b){return null!=a[b]?a[b]:null==ngFileUpload.defaults[b]?ngFileUpload.defaults[b]:ngFileUpload.defaults[b].toString()};var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.updateModel=function(a,b,c,e,f,g,h,i,j,k){function l(){var k=a(d(f,"ngfKeep"))(c);if(k===!0){var l=(e.$modelValue||[]).slice(0);if(h&&h.length)if(a(d(f,"ngfKeepDistinct"))(c)===!0){for(var m=l.length,n=0;n<h.length;n++){for(var o=0;m>o&&h[n].name!==l[o].name;o++);o===m&&l.push(h[n])}h=l}else h=l.concat(h);else h=l}var p=h&&h.length?h[0]:null;if(e){var q=!a(d(f,"ngfMultiple"))(c)&&!d(f,"multiple")&&!k;b(function(){a(d(f,"ngModel")).assign(c,q?p:h)}),b(function(){e&&e.$setViewValue(q?p:null!=h&&0===h.length?null:h)})}var r=d(f,"ngfModel");r&&a(r).assign(c,h),d(f,"ngModelRejected")&&a(d(f,"ngModelRejected")).assign(c,i),g&&a(g)(c,{$files:h,$file:p,$rejectedFiles:i,$event:j})}k?l():b(function(){l()})}}(),function(){ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout",function(a,b){return a.dataUrl=function(a,c,d){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)?b(function(){var e=window.URL||window.webkitURL;if(e&&e.createObjectURL&&!d){var f;try{f=e.createObjectURL(a)}catch(g){c("",a)}f&&c(f,a)}else{var h=new FileReader;h.readAsDataURL(a),h.onload=function(d){b(function(){c(d.target.result,a)})}}}):c(null,a)},a}]),ngFileUpload.directive("ngfSrc",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("src","{{("+f.ngfSrc+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}"),f.$set("ngfSrc",null),b(e)(d)})}}}]),ngFileUpload.directive("ngfBackground",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("style",e.attr("style")+";background-image:url('{{("+f.ngfBackground+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}')"),f.$set("ngfBackground",null),b(e)(d)})}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/),a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d){return angular.isString(c)?b.trustAsResourceUrl(c):c&&!c.dataUrl?(void 0===c.dataUrl&&angular.isObject(c)&&(c.dataUrl=null,a.dataUrl(c,function(a,b){b.dataUrl=a},d)),""):(c&&c.dataUrl?b.trustAsResourceUrl(c.dataUrl):c)||""}}])}(),function(){function a(b){if(b.length>2&&"/"===b[0]&&"/"===b[b.length-1])return b.substring(1,b.length-1);var c=b.split(","),d="";if(c.length>1)for(var e=0;e<c.length;e++)d+="("+a(c[e])+")",e<c.length-1&&(d+="|");else 0===b.indexOf(".")&&(b="*"+b),d="^"+b.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",d=d.replace(/\\\*/g,".*").replace(/\\\?/g,".");return d}function b(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1e3*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1e6*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1e9*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}ngFileUpload.service("Upload",["UploadDataUrl",function(c){var d=ngFileUpload.getAttrWithDefaults;return c.validate=function(a,b,c,e,f,g){function h(a,b){b?i.push(a):j.push(a),l++,l===e.length&&g(i,j)}if(null==d(c,"ngfValidate")&&null==d(c,"ngfAccept"))return g(e);for(var i=[],j=[],k=b(d(c,"ngfAccept"))(a,{$event:f}),l=0,m=0;m<e.length;m++){var n=e[m],o=b(d(c,"ngfValidate"))(a,{$file:n,$event:f});null==o||o!==!1&&!angular.isString(o)?null!=o||null!=k?(o=o||{},null!=k&&(o.accept=k),this.validateFile(n,o,h)):h(n,!0):(n.$error="validate",n.$errorParam=o,h(n,!1))}},c.validateFile=function(c,d,e){if(null==c)return e(c,!1);var f=d.accept;if(null!=d.accept&&angular.isString(d.accept)){var g=new RegExp(a(d.accept),"gi");if(f=null!=c.type&&g.test(c.type.toLowerCase())||null!=c.name&&g.test(c.name.toLowerCase()),!f)return c.$error="accept",e(c,!1)}else if(f===!1)return c.$error="accept",e(c,!1);if(null!=c.size&&d.size&&(d.size.max||d.size.min)){if(c.size>b(d.size.max))return c.$error="size.max",c.$errorParam=d.size.max,e(c,!1);if(c.size<b(d.size.min))return c.$error="size.min",c.$errorParam=d.size.min,e(c,!1)}if(!((d.width||d.height)&&0===c.type.indexOf("image")&&(this.imageDimensions(c,function(a,f){c.width=a,c.height=f,d.width&&(d.width.min||d.width.max)&&(d.width.max&&a>b(d.width.max)&&(c.$error="width.max",c.$errorParam=d.width.max),d.width.min&&a<b(d.width.min)&&(c.$error="width.min",c.$errorParam=d.width.min),a||d.width.soft||(c.$error=d.width.min?"width.min":"width.max",c.$errorParam=d.width.min||d.width.max)),d.height&&(d.height.min||d.height.max)&&(d.height.max&&f>b(d.height.max)&&(c.$error="height.max",c.$errorParam=d.height.max),d.height.min&&f<b(d.height.min)&&(c.$error="height.min",c.$errorParam=d.height.min),f||d.height.soft||(c.$error=d.height.min?"height.min":"height.max",c.$errorParam=d.height.min||d.height.max),e(c,!c.$error))}),d.width&&(d.width.min||d.width.max)||d.height&&(d.height.min||d.height.max))||d.duration&&(0===c.type.indexOf("audio")||0===c.type.indexOf("video"))&&(this.mediaDuration(c,function(a){c.duration=a,(d.duration.min||d.duration.max)&&(d.duration.max&&a>b(d.duration.max)&&(c.$error="duration.max",c.$errorParam=d.duration.max),d.duration.min&&a<b(d.duration.min)&&(c.$error="duration.min",c.$errorParam=d.duration.min),a||d.duration.soft||(c.$error=d.duration.min?"duration.min":"duration.max",c.$errorParam=d.duration.min||d.duration.max),e(c,!c.$error))}),d.duration.min||d.duration.max)))return e(c,!0)},c.imageDimensions=function(a,b){return 0!==a.type.indexOf("image")?!1:void c.dataUrl(a,function(c){var d=angular.element("<img>").attr("src",c).css("visibility","none").css("position","fixed");d.on("load error",function(){var c=d[0].clientWidth,e=d[0].clientHeight;d.remove(),b(c,e,a)}),angular.element(document.body).append(d)},!0)},c.mediaDuration=function(a,b){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?!1:void c.dataUrl(a,function(c){var d=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",c).css("visibility","none").css("position","fixed");d.on("loadedmetadata error",function(){var c=d[0].duration;d.remove(),b(c,a)}),angular.element(document.body).append(d)})},c}])}(),function(){function a(a,e,f,g,h,i,j){function k(a,b,e,f){var g=e.dataTransfer.items,i=[];if(null!=g)for(var j=0;j<g.length;j++)("file"===g[j].kind||""===g[j].kind)&&i.push(g[j]);c.validate(a,h,b,i,e,function(c,g){var i=h(d(b,"ngfDragOverClass"))(a,{$event:e});i&&(i.delay&&(r=i.delay),i.accept&&(i=g&&g.length?i.reject:i.accept)),f(i||d(b,"ngfDragOverClass")||"dragover")})}function l(b,d,e,g){function k(a,b,c){if(null!=b)if(b.isDirectory){var d=(c||"")+b.name;a.push({name:b.name,type:"directory",path:d});var e=b.createReader(),f=[];m++;var g=function(){e.readEntries(function(d){try{if(d.length)f=f.concat(Array.prototype.slice.call(d||[],0)),g();else{for(var e=0;e<f.length;e++)k(a,f[e],(c?c:"")+b.name+"/");m--}}catch(h){m--,console.error(h)}},function(){m--})};g()}else m++,b.file(function(b){try{m--,b.path=(c?c:"")+b.name,a.push(b)}catch(d){m--,console.error(d)}},function(){m--})}var l=[],m=0,n=b.dataTransfer.items;if(n&&n.length>0&&"file"!==j.protocol())for(var o=0;o<n.length;o++){if(n[o].webkitGetAsEntry&&n[o].webkitGetAsEntry()&&n[o].webkitGetAsEntry().isDirectory){var p=n[o].webkitGetAsEntry();if(p.isDirectory&&!e)continue;null!=p&&k(l,p)}else{var q=n[o].getAsFile();null!=q&&l.push(q)}if(!g&&l.length>0)break}else{var r=b.dataTransfer.files;if(null!=r)for(var s=0;s<r.length&&(l.push(r.item(s)),g||!(l.length>0));s++);}var t=0;!function u(e){i(function(){if(m)10*t++<2e4&&u(10);else{if(!g&&l.length>1){for(o=0;"directory"===l[o].type;)o++;l=[l[o]]}c.validate(a,h,f,l,b,function(a,b){d(a,b)})}},e||0)}()}var m=b();if(d(f,"dropAvailable")&&i(function(){a[d(f,"dropAvailable")]?a[d(f,"dropAvailable")].value=m:a[d(f,"dropAvailable")]=m}),!m)return void(h(d(f,"ngfHideOnDropNotAvailable"))(a)===!0&&e.css("display","none"));var n=!1;-1===d(f,"ngfDrop").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfDrop"),function(a){n=a===!1});var o,p=null,q=h(d(f,"ngfStopPropagation")),r=1;e[0].addEventListener("dragover",function(b){if(!e.attr("disabled")&&!n){if(b.preventDefault(),q(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var c=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===c||"linkMove"===c?"move":"copy"}i.cancel(p),o||(o="C",k(a,f,b,function(a){o=a,e.addClass(o)}))}},!1),e[0].addEventListener("dragenter",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation())},!1),e[0].addEventListener("dragleave",function(){e.attr("disabled")||n||(p=i(function(){e.removeClass(o),o=null},r||1))},!1),e[0].addEventListener("drop",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation(),e.removeClass(o),o=null,l(b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)},h(d(f,"ngfAllowDir"))(a)!==!1,d(f,"multiple")||h(d(f,"ngfMultiple"))(a)))},!1),e[0].addEventListener("paste",function(b){if(!e.attr("disabled")&&!n){var j=[],k=b.clipboardData||b.originalEvent.clipboardData;if(k&&k.items){for(var l=0;l<k.items.length;l++)-1!==k.items[l].type.indexOf("image")&&j.push(k.items[l].getAsFile());c.validate(a,h,f,j,b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)})}}},!1)}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a}var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout",function(a,c){return function(e,f,g){if(b()){var h=a(d(g,"ngfDropAvailable"));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(); |
@@ -1,2 +0,2 @@ | ||
/*! 6.2.0 */ | ||
/*! 6.2.1 */ | ||
/*! FileAPI 2.0.7 - BSD | git://github.com/mailru/FileAPI.git | ||
@@ -3,0 +3,0 @@ * 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. |
@@ -5,3 +5,3 @@ /**! | ||
* @author Danial <danial.farid@gmail.com> | ||
* @version 6.2.0 | ||
* @version 6.2.1 | ||
*/ | ||
@@ -434,3 +434,3 @@ | ||
* @author Danial <danial.farid@gmail.com> | ||
* @version 6.2.0 | ||
* @version 6.2.1 | ||
*/ | ||
@@ -456,3 +456,3 @@ | ||
ngFileUpload.version = '6.2.0'; | ||
ngFileUpload.version = '6.2.1'; | ||
ngFileUpload.defaults = {}; | ||
@@ -981,4 +981,6 @@ | ||
return function (file, disallowObjectUrl) { | ||
//return 'aaaa' + file + disallowObjectUrl + $sce + UploadDataUrl; | ||
if (file && !file.dataUrl && !angular.isString(file)) { | ||
if (angular.isString(file)) { | ||
return $sce.trustAsResourceUrl(file); | ||
} | ||
if (file && !file.dataUrl) { | ||
if (file.dataUrl === undefined && angular.isObject(file)) { | ||
@@ -985,0 +987,0 @@ file.dataUrl = null; |
@@ -1,2 +0,2 @@ | ||
/*! 6.2.0 */ | ||
!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={}),FileAPI.shouldLoad=window.XMLHttpRequest&&!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){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.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.hasFlash=b()}FileAPI.ngfFixIE=function(d,e,f,g){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var h=function(){if(d.attr("disabled"))d.$$ngfRefElem.removeClass("js-fileapi-wrapper");else{var b=d.$$ngfRefElem;b?f(d.$$ngfRefElem):(b=d.$$ngfRefElem=e(),b.addClass("js-fileapi-wrapper"),!a(d),setTimeout(function(){b.bind("mouseenter",h)},10),b.bind("change",function(a){i.apply(this,[a]),g.apply(this,[a])})),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")}};d.bind("mouseenter",h);var i=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.readAsArrayBuffer=function(a){FileAPI.readAsBinaryString(a,d)},this.readAsBinaryString=function(a){FileAPI.readAsBinaryString(a,d)},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="6.2.0",ngFileUpload.defaults={},ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{};var e=b.defer(),f=e.promise;return d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)}))},!1))}},a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)}),f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.progressFunc=a,f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(a){function b(c,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))c.append(e,d);else if("form"===a.sendFieldsAs)if(angular.isObject(d))for(var f in d)d.hasOwnProperty(f)&&b(c,d[f],e+"["+f+"]");else c.append(e,d);else d=angular.isString(d)?d:JSON.stringify(d),"json-blob"===a.sendFieldsAs?c.append(e,new Blob([d],{type:"application/json"})):c.append(e,d)}return 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(c){var d,e=new FormData,f={};for(d in a.fields)a.fields.hasOwnProperty(d)&&(f[d]=a.fields[d]);c&&(f.data=c);for(d in f)if(f.hasOwnProperty(d)){var g=f[d];a.formDataAppender?a.formDataAppender(e,d,g):b(e,g,d)}if(null!=a.file){var h=a.fileFormDataName||"file";if(angular.isArray(a.file))for(var i=angular.isString(h),j=0;j<a.file.length;j++)e.append(i?h:h[j],a.file[j],a.fileName&&a.fileName[j]||a.file[j].name);else e.append(h,a.file,a.fileName||a.file.name)}return e}),d(a)},this.http=function(b){return b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof Blob?b:a.defaults.transformRequest[0](arguments)},d(b)},this.setDefaults=function(a){ngFileUpload.defaults=a||{}},ngFileUpload.Upload=this}]),function(){function a(a,e,f,g,h,i,j){function k(){return"input"===e[0].tagName.toLowerCase()&&f.type&&"file"===f.type.toLowerCase()}function l(b){var j=b.__files_||b.target&&b.target.files;c.validate(a,h,f,j,b,function(c,j){e.$$ngfHasFile=!0,ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),c,j,b),0===c.length&&(b.target.value=c)})}function m(b){d(f,"ngfMultiple")&&b.attr("multiple",h(d(f,"ngfMultiple"))(a)),d(f,"ngfCapture")&&b.attr("capture",h(d(f,"ngfCapture"))(a)),d(f,"accept")&&b.attr("accept",d(f,"accept"));for(var c=0;c<e[0].attributes.length;c++){var g=e[0].attributes[c];(k()&&"type"!==g.name||"type"!==g.name&&"class"!==g.name&&"id"!==g.name&&"style"!==g.name)&&((null==g.value||""===g.value)&&("required"===g.name&&(g.value="required"),"multiple"===g.name&&(g.value="multiple")),b.attr(g.name,g.value))}}function n(b,c){if(!c&&(b||k()))return e.$$ngfRefElem||e;if(e.$$ngfProgramClick)return e;var d=angular.element('<input type="file">');return m(d),k()?(e.replaceWith(d),e=d,d.attr("__ngf_gen__",!0),j(e)(a)):(d.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"),e.$$ngfRefElem&&e.$$ngfRefElem.remove(),e.$$ngfRefElem=d,document.body.appendChild(d[0])),d}function o(b){e.$$ngfHasFile&&(ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),[],[],b,!0),delete e.$$ngfHasFile)}function p(c){function g(a){a&&!e.$$ngfProgramClick&&(e.$$ngfProgramClick=!0,t[0].click(),i(function(){delete e.$$ngfProgramClick},500)),!k()&&a||!s||e.bind("click touchstart touchend",p)}if(e.attr("disabled")||q)return!1;if(null!=c){var j=c.changedTouches||c.originalEvent&&c.originalEvent.changedTouches;if("touchstart"===c.type)return r=j?j[0].clientY:0,!0;if(c.stopPropagation(),c.preventDefault(),"touchend"===c.type){var m=j?j[0].clientY:0;if(Math.abs(m-r)>20)return!1}}var s=h(d(f,"ngfResetOnClick"))(a)!==!1,t=n(c,s);return t&&((!c||s)&&t.bind("change",l),c&&s&&h(d(f,"ngfResetModelOnClick"))(a)!==!1&&o(c),b(navigator.userAgent)?setTimeout(function(){g(c)},0):g(c)),!1}if(!e.attr("__ngf_gen__")){a.$on("$destroy",function(){e.$$ngfRefElem&&e.$$ngfRefElem.remove()});var q=!1;-1===d(f,"ngfSelect").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfSelect"),function(a){q=a===!1});var r=0;window.FileAPI&&window.FileAPI.ngfFixIE?window.FileAPI.ngfFixIE(e,n,m,l):p()}}function b(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=ngFileUpload.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)}ngFileUpload.getAttrWithDefaults=function(a,b){return null!=a[b]?a[b]:null==ngFileUpload.defaults[b]?ngFileUpload.defaults[b]:ngFileUpload.defaults[b].toString()};var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.updateModel=function(a,b,c,e,f,g,h,i,j,k){function l(){var k=a(d(f,"ngfKeep"))(c);if(k===!0){var l=(e.$modelValue||[]).slice(0);if(h&&h.length)if(a(d(f,"ngfKeepDistinct"))(c)===!0){for(var m=l.length,n=0;n<h.length;n++){for(var o=0;m>o&&h[n].name!==l[o].name;o++);o===m&&l.push(h[n])}h=l}else h=l.concat(h);else h=l}var p=h&&h.length?h[0]:null;if(e){var q=!a(d(f,"ngfMultiple"))(c)&&!d(f,"multiple")&&!k;b(function(){a(d(f,"ngModel")).assign(c,q?p:h)}),b(function(){e&&e.$setViewValue(q?p:null!=h&&0===h.length?null:h)})}var r=d(f,"ngfModel");r&&a(r).assign(c,h),d(f,"ngModelRejected")&&a(d(f,"ngModelRejected")).assign(c,i),g&&a(g)(c,{$files:h,$file:p,$rejectedFiles:i,$event:j})}k?l():b(function(){l()})}}(),function(){ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout",function(a,b){return a.dataUrl=function(a,c,d){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)?b(function(){var e=window.URL||window.webkitURL;if(e&&e.createObjectURL&&!d){var f;try{f=e.createObjectURL(a)}catch(g){c("",a)}f&&c(f,a)}else{var h=new FileReader;h.readAsDataURL(a),h.onload=function(d){b(function(){c(d.target.result,a)})}}}):c(null,a)},a}]),ngFileUpload.directive("ngfSrc",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("src","{{("+f.ngfSrc+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}"),f.$set("ngfSrc",null),b(e)(d)})}}}]),ngFileUpload.directive("ngfBackground",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("style",e.attr("style")+";background-image:url('{{("+f.ngfBackground+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}')"),f.$set("ngfBackground",null),b(e)(d)})}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/),a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d){return!c||c.dataUrl||angular.isString(c)?(c&&c.dataUrl?b.trustAsResourceUrl(c.dataUrl):c)||"":(void 0===c.dataUrl&&angular.isObject(c)&&(c.dataUrl=null,a.dataUrl(c,function(a,b){b.dataUrl=a},d)),"")}}])}(),function(){function a(b){if(b.length>2&&"/"===b[0]&&"/"===b[b.length-1])return b.substring(1,b.length-1);var c=b.split(","),d="";if(c.length>1)for(var e=0;e<c.length;e++)d+="("+a(c[e])+")",e<c.length-1&&(d+="|");else 0===b.indexOf(".")&&(b="*"+b),d="^"+b.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",d=d.replace(/\\\*/g,".*").replace(/\\\?/g,".");return d}function b(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1e3*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1e6*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1e9*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}ngFileUpload.service("Upload",["UploadDataUrl",function(c){var d=ngFileUpload.getAttrWithDefaults;return c.validate=function(a,b,c,e,f,g){function h(a,b){b?i.push(a):j.push(a),l++,l===e.length&&g(i,j)}if(null==d(c,"ngfValidate")&&null==d(c,"ngfAccept"))return g(e);for(var i=[],j=[],k=b(d(c,"ngfAccept"))(a,{$event:f}),l=0,m=0;m<e.length;m++){var n=e[m],o=b(d(c,"ngfValidate"))(a,{$file:n,$event:f});null==o||o!==!1&&!angular.isString(o)?null!=o||null!=k?(o=o||{},null!=k&&(o.accept=k),this.validateFile(n,o,h)):h(n,!0):(n.$error="validate",n.$errorParam=o,h(n,!1))}},c.validateFile=function(c,d,e){if(null==c)return e(c,!1);var f=d.accept;if(null!=d.accept&&angular.isString(d.accept)){var g=new RegExp(a(d.accept),"gi");if(f=null!=c.type&&g.test(c.type.toLowerCase())||null!=c.name&&g.test(c.name.toLowerCase()),!f)return c.$error="accept",e(c,!1)}else if(f===!1)return c.$error="accept",e(c,!1);if(null!=c.size&&d.size&&(d.size.max||d.size.min)){if(c.size>b(d.size.max))return c.$error="size.max",c.$errorParam=d.size.max,e(c,!1);if(c.size<b(d.size.min))return c.$error="size.min",c.$errorParam=d.size.min,e(c,!1)}if(!((d.width||d.height)&&0===c.type.indexOf("image")&&(this.imageDimensions(c,function(a,f){c.width=a,c.height=f,d.width&&(d.width.min||d.width.max)&&(d.width.max&&a>b(d.width.max)&&(c.$error="width.max",c.$errorParam=d.width.max),d.width.min&&a<b(d.width.min)&&(c.$error="width.min",c.$errorParam=d.width.min),a||d.width.soft||(c.$error=d.width.min?"width.min":"width.max",c.$errorParam=d.width.min||d.width.max)),d.height&&(d.height.min||d.height.max)&&(d.height.max&&f>b(d.height.max)&&(c.$error="height.max",c.$errorParam=d.height.max),d.height.min&&f<b(d.height.min)&&(c.$error="height.min",c.$errorParam=d.height.min),f||d.height.soft||(c.$error=d.height.min?"height.min":"height.max",c.$errorParam=d.height.min||d.height.max),e(c,!c.$error))}),d.width&&(d.width.min||d.width.max)||d.height&&(d.height.min||d.height.max))||d.duration&&(0===c.type.indexOf("audio")||0===c.type.indexOf("video"))&&(this.mediaDuration(c,function(a){c.duration=a,(d.duration.min||d.duration.max)&&(d.duration.max&&a>b(d.duration.max)&&(c.$error="duration.max",c.$errorParam=d.duration.max),d.duration.min&&a<b(d.duration.min)&&(c.$error="duration.min",c.$errorParam=d.duration.min),a||d.duration.soft||(c.$error=d.duration.min?"duration.min":"duration.max",c.$errorParam=d.duration.min||d.duration.max),e(c,!c.$error))}),d.duration.min||d.duration.max)))return e(c,!0)},c.imageDimensions=function(a,b){return 0!==a.type.indexOf("image")?!1:void c.dataUrl(a,function(c){var d=angular.element("<img>").attr("src",c).css("visibility","none").css("position","fixed");d.on("load error",function(){var c=d[0].clientWidth,e=d[0].clientHeight;d.remove(),b(c,e,a)}),angular.element(document.body).append(d)},!0)},c.mediaDuration=function(a,b){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?!1:void c.dataUrl(a,function(c){var d=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",c).css("visibility","none").css("position","fixed");d.on("loadedmetadata error",function(){var c=d[0].duration;d.remove(),b(c,a)}),angular.element(document.body).append(d)})},c}])}(),function(){function a(a,e,f,g,h,i,j){function k(a,b,e,f){var g=e.dataTransfer.items,i=[];if(null!=g)for(var j=0;j<g.length;j++)("file"===g[j].kind||""===g[j].kind)&&i.push(g[j]);c.validate(a,h,b,i,e,function(c,g){var i=h(d(b,"ngfDragOverClass"))(a,{$event:e});i&&(i.delay&&(r=i.delay),i.accept&&(i=g&&g.length?i.reject:i.accept)),f(i||d(b,"ngfDragOverClass")||"dragover")})}function l(b,d,e,g){function k(a,b,c){if(null!=b)if(b.isDirectory){var d=(c||"")+b.name;a.push({name:b.name,type:"directory",path:d});var e=b.createReader(),f=[];m++;var g=function(){e.readEntries(function(d){try{if(d.length)f=f.concat(Array.prototype.slice.call(d||[],0)),g();else{for(var e=0;e<f.length;e++)k(a,f[e],(c?c:"")+b.name+"/");m--}}catch(h){m--,console.error(h)}},function(){m--})};g()}else m++,b.file(function(b){try{m--,b.path=(c?c:"")+b.name,a.push(b)}catch(d){m--,console.error(d)}},function(){m--})}var l=[],m=0,n=b.dataTransfer.items;if(n&&n.length>0&&"file"!==j.protocol())for(var o=0;o<n.length;o++){if(n[o].webkitGetAsEntry&&n[o].webkitGetAsEntry()&&n[o].webkitGetAsEntry().isDirectory){var p=n[o].webkitGetAsEntry();if(p.isDirectory&&!e)continue;null!=p&&k(l,p)}else{var q=n[o].getAsFile();null!=q&&l.push(q)}if(!g&&l.length>0)break}else{var r=b.dataTransfer.files;if(null!=r)for(var s=0;s<r.length&&(l.push(r.item(s)),g||!(l.length>0));s++);}var t=0;!function u(e){i(function(){if(m)10*t++<2e4&&u(10);else{if(!g&&l.length>1){for(o=0;"directory"===l[o].type;)o++;l=[l[o]]}c.validate(a,h,f,l,b,function(a,b){d(a,b)})}},e||0)}()}var m=b();if(d(f,"dropAvailable")&&i(function(){a[d(f,"dropAvailable")]?a[d(f,"dropAvailable")].value=m:a[d(f,"dropAvailable")]=m}),!m)return void(h(d(f,"ngfHideOnDropNotAvailable"))(a)===!0&&e.css("display","none"));var n=!1;-1===d(f,"ngfDrop").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfDrop"),function(a){n=a===!1});var o,p=null,q=h(d(f,"ngfStopPropagation")),r=1;e[0].addEventListener("dragover",function(b){if(!e.attr("disabled")&&!n){if(b.preventDefault(),q(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var c=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===c||"linkMove"===c?"move":"copy"}i.cancel(p),o||(o="C",k(a,f,b,function(a){o=a,e.addClass(o)}))}},!1),e[0].addEventListener("dragenter",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation())},!1),e[0].addEventListener("dragleave",function(){e.attr("disabled")||n||(p=i(function(){e.removeClass(o),o=null},r||1))},!1),e[0].addEventListener("drop",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation(),e.removeClass(o),o=null,l(b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)},h(d(f,"ngfAllowDir"))(a)!==!1,d(f,"multiple")||h(d(f,"ngfMultiple"))(a)))},!1),e[0].addEventListener("paste",function(b){if(!e.attr("disabled")&&!n){var j=[],k=b.clipboardData||b.originalEvent.clipboardData;if(k&&k.items){for(var l=0;l<k.items.length;l++)-1!==k.items[l].type.indexOf("image")&&j.push(k.items[l].getAsFile());c.validate(a,h,f,j,b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)})}}},!1)}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a}var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout",function(a,c){return function(e,f,g){if(b()){var h=a(d(g,"ngfDropAvailable"));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(); | ||
/*! 6.2.1 */ | ||
!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={}),FileAPI.shouldLoad=window.XMLHttpRequest&&!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){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.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.hasFlash=b()}FileAPI.ngfFixIE=function(d,e,f,g){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var h=function(){if(d.attr("disabled"))d.$$ngfRefElem.removeClass("js-fileapi-wrapper");else{var b=d.$$ngfRefElem;b?f(d.$$ngfRefElem):(b=d.$$ngfRefElem=e(),b.addClass("js-fileapi-wrapper"),!a(d),setTimeout(function(){b.bind("mouseenter",h)},10),b.bind("change",function(a){i.apply(this,[a]),g.apply(this,[a])})),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")}};d.bind("mouseenter",h);var i=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.readAsArrayBuffer=function(a){FileAPI.readAsBinaryString(a,d)},this.readAsBinaryString=function(a){FileAPI.readAsBinaryString(a,d)},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="6.2.1",ngFileUpload.defaults={},ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{};var e=b.defer(),f=e.promise;return d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)}))},!1))}},a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)}),f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.progressFunc=a,f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(a){function b(c,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))c.append(e,d);else if("form"===a.sendFieldsAs)if(angular.isObject(d))for(var f in d)d.hasOwnProperty(f)&&b(c,d[f],e+"["+f+"]");else c.append(e,d);else d=angular.isString(d)?d:JSON.stringify(d),"json-blob"===a.sendFieldsAs?c.append(e,new Blob([d],{type:"application/json"})):c.append(e,d)}return 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(c){var d,e=new FormData,f={};for(d in a.fields)a.fields.hasOwnProperty(d)&&(f[d]=a.fields[d]);c&&(f.data=c);for(d in f)if(f.hasOwnProperty(d)){var g=f[d];a.formDataAppender?a.formDataAppender(e,d,g):b(e,g,d)}if(null!=a.file){var h=a.fileFormDataName||"file";if(angular.isArray(a.file))for(var i=angular.isString(h),j=0;j<a.file.length;j++)e.append(i?h:h[j],a.file[j],a.fileName&&a.fileName[j]||a.file[j].name);else e.append(h,a.file,a.fileName||a.file.name)}return e}),d(a)},this.http=function(b){return b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof Blob?b:a.defaults.transformRequest[0](arguments)},d(b)},this.setDefaults=function(a){ngFileUpload.defaults=a||{}},ngFileUpload.Upload=this}]),function(){function a(a,e,f,g,h,i,j){function k(){return"input"===e[0].tagName.toLowerCase()&&f.type&&"file"===f.type.toLowerCase()}function l(b){var j=b.__files_||b.target&&b.target.files;c.validate(a,h,f,j,b,function(c,j){e.$$ngfHasFile=!0,ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),c,j,b),0===c.length&&(b.target.value=c)})}function m(b){d(f,"ngfMultiple")&&b.attr("multiple",h(d(f,"ngfMultiple"))(a)),d(f,"ngfCapture")&&b.attr("capture",h(d(f,"ngfCapture"))(a)),d(f,"accept")&&b.attr("accept",d(f,"accept"));for(var c=0;c<e[0].attributes.length;c++){var g=e[0].attributes[c];(k()&&"type"!==g.name||"type"!==g.name&&"class"!==g.name&&"id"!==g.name&&"style"!==g.name)&&((null==g.value||""===g.value)&&("required"===g.name&&(g.value="required"),"multiple"===g.name&&(g.value="multiple")),b.attr(g.name,g.value))}}function n(b,c){if(!c&&(b||k()))return e.$$ngfRefElem||e;if(e.$$ngfProgramClick)return e;var d=angular.element('<input type="file">');return m(d),k()?(e.replaceWith(d),e=d,d.attr("__ngf_gen__",!0),j(e)(a)):(d.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"),e.$$ngfRefElem&&e.$$ngfRefElem.remove(),e.$$ngfRefElem=d,document.body.appendChild(d[0])),d}function o(b){e.$$ngfHasFile&&(ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),[],[],b,!0),delete e.$$ngfHasFile)}function p(c){function g(a){a&&!e.$$ngfProgramClick&&(e.$$ngfProgramClick=!0,t[0].click(),i(function(){delete e.$$ngfProgramClick},500)),!k()&&a||!s||e.bind("click touchstart touchend",p)}if(e.attr("disabled")||q)return!1;if(null!=c){var j=c.changedTouches||c.originalEvent&&c.originalEvent.changedTouches;if("touchstart"===c.type)return r=j?j[0].clientY:0,!0;if(c.stopPropagation(),c.preventDefault(),"touchend"===c.type){var m=j?j[0].clientY:0;if(Math.abs(m-r)>20)return!1}}var s=h(d(f,"ngfResetOnClick"))(a)!==!1,t=n(c,s);return t&&((!c||s)&&t.bind("change",l),c&&s&&h(d(f,"ngfResetModelOnClick"))(a)!==!1&&o(c),b(navigator.userAgent)?setTimeout(function(){g(c)},0):g(c)),!1}if(!e.attr("__ngf_gen__")){a.$on("$destroy",function(){e.$$ngfRefElem&&e.$$ngfRefElem.remove()});var q=!1;-1===d(f,"ngfSelect").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfSelect"),function(a){q=a===!1});var r=0;window.FileAPI&&window.FileAPI.ngfFixIE?window.FileAPI.ngfFixIE(e,n,m,l):p()}}function b(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=ngFileUpload.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)}ngFileUpload.getAttrWithDefaults=function(a,b){return null!=a[b]?a[b]:null==ngFileUpload.defaults[b]?ngFileUpload.defaults[b]:ngFileUpload.defaults[b].toString()};var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.updateModel=function(a,b,c,e,f,g,h,i,j,k){function l(){var k=a(d(f,"ngfKeep"))(c);if(k===!0){var l=(e.$modelValue||[]).slice(0);if(h&&h.length)if(a(d(f,"ngfKeepDistinct"))(c)===!0){for(var m=l.length,n=0;n<h.length;n++){for(var o=0;m>o&&h[n].name!==l[o].name;o++);o===m&&l.push(h[n])}h=l}else h=l.concat(h);else h=l}var p=h&&h.length?h[0]:null;if(e){var q=!a(d(f,"ngfMultiple"))(c)&&!d(f,"multiple")&&!k;b(function(){a(d(f,"ngModel")).assign(c,q?p:h)}),b(function(){e&&e.$setViewValue(q?p:null!=h&&0===h.length?null:h)})}var r=d(f,"ngfModel");r&&a(r).assign(c,h),d(f,"ngModelRejected")&&a(d(f,"ngModelRejected")).assign(c,i),g&&a(g)(c,{$files:h,$file:p,$rejectedFiles:i,$event:j})}k?l():b(function(){l()})}}(),function(){ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout",function(a,b){return a.dataUrl=function(a,c,d){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)?b(function(){var e=window.URL||window.webkitURL;if(e&&e.createObjectURL&&!d){var f;try{f=e.createObjectURL(a)}catch(g){c("",a)}f&&c(f,a)}else{var h=new FileReader;h.readAsDataURL(a),h.onload=function(d){b(function(){c(d.target.result,a)})}}}):c(null,a)},a}]),ngFileUpload.directive("ngfSrc",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("src","{{("+f.ngfSrc+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}"),f.$set("ngfSrc",null),b(e)(d)})}}}]),ngFileUpload.directive("ngfBackground",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("style",e.attr("style")+";background-image:url('{{("+f.ngfBackground+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}')"),f.$set("ngfBackground",null),b(e)(d)})}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/),a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d){return angular.isString(c)?b.trustAsResourceUrl(c):c&&!c.dataUrl?(void 0===c.dataUrl&&angular.isObject(c)&&(c.dataUrl=null,a.dataUrl(c,function(a,b){b.dataUrl=a},d)),""):(c&&c.dataUrl?b.trustAsResourceUrl(c.dataUrl):c)||""}}])}(),function(){function a(b){if(b.length>2&&"/"===b[0]&&"/"===b[b.length-1])return b.substring(1,b.length-1);var c=b.split(","),d="";if(c.length>1)for(var e=0;e<c.length;e++)d+="("+a(c[e])+")",e<c.length-1&&(d+="|");else 0===b.indexOf(".")&&(b="*"+b),d="^"+b.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",d=d.replace(/\\\*/g,".*").replace(/\\\?/g,".");return d}function b(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1e3*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1e6*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1e9*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}ngFileUpload.service("Upload",["UploadDataUrl",function(c){var d=ngFileUpload.getAttrWithDefaults;return c.validate=function(a,b,c,e,f,g){function h(a,b){b?i.push(a):j.push(a),l++,l===e.length&&g(i,j)}if(null==d(c,"ngfValidate")&&null==d(c,"ngfAccept"))return g(e);for(var i=[],j=[],k=b(d(c,"ngfAccept"))(a,{$event:f}),l=0,m=0;m<e.length;m++){var n=e[m],o=b(d(c,"ngfValidate"))(a,{$file:n,$event:f});null==o||o!==!1&&!angular.isString(o)?null!=o||null!=k?(o=o||{},null!=k&&(o.accept=k),this.validateFile(n,o,h)):h(n,!0):(n.$error="validate",n.$errorParam=o,h(n,!1))}},c.validateFile=function(c,d,e){if(null==c)return e(c,!1);var f=d.accept;if(null!=d.accept&&angular.isString(d.accept)){var g=new RegExp(a(d.accept),"gi");if(f=null!=c.type&&g.test(c.type.toLowerCase())||null!=c.name&&g.test(c.name.toLowerCase()),!f)return c.$error="accept",e(c,!1)}else if(f===!1)return c.$error="accept",e(c,!1);if(null!=c.size&&d.size&&(d.size.max||d.size.min)){if(c.size>b(d.size.max))return c.$error="size.max",c.$errorParam=d.size.max,e(c,!1);if(c.size<b(d.size.min))return c.$error="size.min",c.$errorParam=d.size.min,e(c,!1)}if(!((d.width||d.height)&&0===c.type.indexOf("image")&&(this.imageDimensions(c,function(a,f){c.width=a,c.height=f,d.width&&(d.width.min||d.width.max)&&(d.width.max&&a>b(d.width.max)&&(c.$error="width.max",c.$errorParam=d.width.max),d.width.min&&a<b(d.width.min)&&(c.$error="width.min",c.$errorParam=d.width.min),a||d.width.soft||(c.$error=d.width.min?"width.min":"width.max",c.$errorParam=d.width.min||d.width.max)),d.height&&(d.height.min||d.height.max)&&(d.height.max&&f>b(d.height.max)&&(c.$error="height.max",c.$errorParam=d.height.max),d.height.min&&f<b(d.height.min)&&(c.$error="height.min",c.$errorParam=d.height.min),f||d.height.soft||(c.$error=d.height.min?"height.min":"height.max",c.$errorParam=d.height.min||d.height.max),e(c,!c.$error))}),d.width&&(d.width.min||d.width.max)||d.height&&(d.height.min||d.height.max))||d.duration&&(0===c.type.indexOf("audio")||0===c.type.indexOf("video"))&&(this.mediaDuration(c,function(a){c.duration=a,(d.duration.min||d.duration.max)&&(d.duration.max&&a>b(d.duration.max)&&(c.$error="duration.max",c.$errorParam=d.duration.max),d.duration.min&&a<b(d.duration.min)&&(c.$error="duration.min",c.$errorParam=d.duration.min),a||d.duration.soft||(c.$error=d.duration.min?"duration.min":"duration.max",c.$errorParam=d.duration.min||d.duration.max),e(c,!c.$error))}),d.duration.min||d.duration.max)))return e(c,!0)},c.imageDimensions=function(a,b){return 0!==a.type.indexOf("image")?!1:void c.dataUrl(a,function(c){var d=angular.element("<img>").attr("src",c).css("visibility","none").css("position","fixed");d.on("load error",function(){var c=d[0].clientWidth,e=d[0].clientHeight;d.remove(),b(c,e,a)}),angular.element(document.body).append(d)},!0)},c.mediaDuration=function(a,b){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?!1:void c.dataUrl(a,function(c){var d=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",c).css("visibility","none").css("position","fixed");d.on("loadedmetadata error",function(){var c=d[0].duration;d.remove(),b(c,a)}),angular.element(document.body).append(d)})},c}])}(),function(){function a(a,e,f,g,h,i,j){function k(a,b,e,f){var g=e.dataTransfer.items,i=[];if(null!=g)for(var j=0;j<g.length;j++)("file"===g[j].kind||""===g[j].kind)&&i.push(g[j]);c.validate(a,h,b,i,e,function(c,g){var i=h(d(b,"ngfDragOverClass"))(a,{$event:e});i&&(i.delay&&(r=i.delay),i.accept&&(i=g&&g.length?i.reject:i.accept)),f(i||d(b,"ngfDragOverClass")||"dragover")})}function l(b,d,e,g){function k(a,b,c){if(null!=b)if(b.isDirectory){var d=(c||"")+b.name;a.push({name:b.name,type:"directory",path:d});var e=b.createReader(),f=[];m++;var g=function(){e.readEntries(function(d){try{if(d.length)f=f.concat(Array.prototype.slice.call(d||[],0)),g();else{for(var e=0;e<f.length;e++)k(a,f[e],(c?c:"")+b.name+"/");m--}}catch(h){m--,console.error(h)}},function(){m--})};g()}else m++,b.file(function(b){try{m--,b.path=(c?c:"")+b.name,a.push(b)}catch(d){m--,console.error(d)}},function(){m--})}var l=[],m=0,n=b.dataTransfer.items;if(n&&n.length>0&&"file"!==j.protocol())for(var o=0;o<n.length;o++){if(n[o].webkitGetAsEntry&&n[o].webkitGetAsEntry()&&n[o].webkitGetAsEntry().isDirectory){var p=n[o].webkitGetAsEntry();if(p.isDirectory&&!e)continue;null!=p&&k(l,p)}else{var q=n[o].getAsFile();null!=q&&l.push(q)}if(!g&&l.length>0)break}else{var r=b.dataTransfer.files;if(null!=r)for(var s=0;s<r.length&&(l.push(r.item(s)),g||!(l.length>0));s++);}var t=0;!function u(e){i(function(){if(m)10*t++<2e4&&u(10);else{if(!g&&l.length>1){for(o=0;"directory"===l[o].type;)o++;l=[l[o]]}c.validate(a,h,f,l,b,function(a,b){d(a,b)})}},e||0)}()}var m=b();if(d(f,"dropAvailable")&&i(function(){a[d(f,"dropAvailable")]?a[d(f,"dropAvailable")].value=m:a[d(f,"dropAvailable")]=m}),!m)return void(h(d(f,"ngfHideOnDropNotAvailable"))(a)===!0&&e.css("display","none"));var n=!1;-1===d(f,"ngfDrop").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfDrop"),function(a){n=a===!1});var o,p=null,q=h(d(f,"ngfStopPropagation")),r=1;e[0].addEventListener("dragover",function(b){if(!e.attr("disabled")&&!n){if(b.preventDefault(),q(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var c=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===c||"linkMove"===c?"move":"copy"}i.cancel(p),o||(o="C",k(a,f,b,function(a){o=a,e.addClass(o)}))}},!1),e[0].addEventListener("dragenter",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation())},!1),e[0].addEventListener("dragleave",function(){e.attr("disabled")||n||(p=i(function(){e.removeClass(o),o=null},r||1))},!1),e[0].addEventListener("drop",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation(),e.removeClass(o),o=null,l(b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)},h(d(f,"ngfAllowDir"))(a)!==!1,d(f,"multiple")||h(d(f,"ngfMultiple"))(a)))},!1),e[0].addEventListener("paste",function(b){if(!e.attr("disabled")&&!n){var j=[],k=b.clipboardData||b.originalEvent.clipboardData;if(k&&k.items){for(var l=0;l<k.items.length;l++)-1!==k.items[l].type.indexOf("image")&&j.push(k.items[l].getAsFile());c.validate(a,h,f,j,b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)})}}},!1)}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a}var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout",function(a,c){return function(e,f,g){if(b()){var h=a(d(g,"ngfDropAvailable"));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(); |
@@ -5,3 +5,3 @@ /**! | ||
* @author Danial <danial.farid@gmail.com> | ||
* @version 6.2.0 | ||
* @version 6.2.1 | ||
*/ | ||
@@ -8,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! 6.2.0 */ | ||
/*! 6.2.1 */ | ||
!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={}),FileAPI.shouldLoad=window.XMLHttpRequest&&!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){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.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.hasFlash=b()}FileAPI.ngfFixIE=function(d,e,f,g){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var h=function(){if(d.attr("disabled"))d.$$ngfRefElem.removeClass("js-fileapi-wrapper");else{var b=d.$$ngfRefElem;b?f(d.$$ngfRefElem):(b=d.$$ngfRefElem=e(),b.addClass("js-fileapi-wrapper"),!a(d),setTimeout(function(){b.bind("mouseenter",h)},10),b.bind("change",function(a){i.apply(this,[a]),g.apply(this,[a])})),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")}};d.bind("mouseenter",h);var i=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.readAsArrayBuffer=function(a){FileAPI.readAsBinaryString(a,d)},this.readAsBinaryString=function(a){FileAPI.readAsBinaryString(a,d)},this.readAsDataURL=function(a){FileAPI.readAsDataURL(a,d)},this.readAsText=function(a){FileAPI.readAsText(a,d)}}); |
/**! | ||
* AngularJS file upload/drop directive and service with progress and abort | ||
* @author Danial <danial.farid@gmail.com> | ||
* @version 6.2.0 | ||
* @version 6.2.1 | ||
*/ | ||
@@ -25,3 +25,3 @@ | ||
ngFileUpload.version = '6.2.0'; | ||
ngFileUpload.version = '6.2.1'; | ||
ngFileUpload.defaults = {}; | ||
@@ -550,4 +550,6 @@ | ||
return function (file, disallowObjectUrl) { | ||
//return 'aaaa' + file + disallowObjectUrl + $sce + UploadDataUrl; | ||
if (file && !file.dataUrl && !angular.isString(file)) { | ||
if (angular.isString(file)) { | ||
return $sce.trustAsResourceUrl(file); | ||
} | ||
if (file && !file.dataUrl) { | ||
if (file.dataUrl === undefined && angular.isObject(file)) { | ||
@@ -554,0 +556,0 @@ file.dataUrl = null; |
@@ -1,2 +0,2 @@ | ||
/*! 6.2.0 */ | ||
!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="6.2.0",ngFileUpload.defaults={},ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{};var e=b.defer(),f=e.promise;return d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)}))},!1))}},a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)}),f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.progressFunc=a,f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(a){function b(c,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))c.append(e,d);else if("form"===a.sendFieldsAs)if(angular.isObject(d))for(var f in d)d.hasOwnProperty(f)&&b(c,d[f],e+"["+f+"]");else c.append(e,d);else d=angular.isString(d)?d:JSON.stringify(d),"json-blob"===a.sendFieldsAs?c.append(e,new Blob([d],{type:"application/json"})):c.append(e,d)}return 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(c){var d,e=new FormData,f={};for(d in a.fields)a.fields.hasOwnProperty(d)&&(f[d]=a.fields[d]);c&&(f.data=c);for(d in f)if(f.hasOwnProperty(d)){var g=f[d];a.formDataAppender?a.formDataAppender(e,d,g):b(e,g,d)}if(null!=a.file){var h=a.fileFormDataName||"file";if(angular.isArray(a.file))for(var i=angular.isString(h),j=0;j<a.file.length;j++)e.append(i?h:h[j],a.file[j],a.fileName&&a.fileName[j]||a.file[j].name);else e.append(h,a.file,a.fileName||a.file.name)}return e}),d(a)},this.http=function(b){return b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof Blob?b:a.defaults.transformRequest[0](arguments)},d(b)},this.setDefaults=function(a){ngFileUpload.defaults=a||{}},ngFileUpload.Upload=this}]),function(){function a(a,e,f,g,h,i,j){function k(){return"input"===e[0].tagName.toLowerCase()&&f.type&&"file"===f.type.toLowerCase()}function l(b){var j=b.__files_||b.target&&b.target.files;c.validate(a,h,f,j,b,function(c,j){e.$$ngfHasFile=!0,ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),c,j,b),0===c.length&&(b.target.value=c)})}function m(b){d(f,"ngfMultiple")&&b.attr("multiple",h(d(f,"ngfMultiple"))(a)),d(f,"ngfCapture")&&b.attr("capture",h(d(f,"ngfCapture"))(a)),d(f,"accept")&&b.attr("accept",d(f,"accept"));for(var c=0;c<e[0].attributes.length;c++){var g=e[0].attributes[c];(k()&&"type"!==g.name||"type"!==g.name&&"class"!==g.name&&"id"!==g.name&&"style"!==g.name)&&((null==g.value||""===g.value)&&("required"===g.name&&(g.value="required"),"multiple"===g.name&&(g.value="multiple")),b.attr(g.name,g.value))}}function n(b,c){if(!c&&(b||k()))return e.$$ngfRefElem||e;if(e.$$ngfProgramClick)return e;var d=angular.element('<input type="file">');return m(d),k()?(e.replaceWith(d),e=d,d.attr("__ngf_gen__",!0),j(e)(a)):(d.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"),e.$$ngfRefElem&&e.$$ngfRefElem.remove(),e.$$ngfRefElem=d,document.body.appendChild(d[0])),d}function o(b){e.$$ngfHasFile&&(ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),[],[],b,!0),delete e.$$ngfHasFile)}function p(c){function g(a){a&&!e.$$ngfProgramClick&&(e.$$ngfProgramClick=!0,t[0].click(),i(function(){delete e.$$ngfProgramClick},500)),!k()&&a||!s||e.bind("click touchstart touchend",p)}if(e.attr("disabled")||q)return!1;if(null!=c){var j=c.changedTouches||c.originalEvent&&c.originalEvent.changedTouches;if("touchstart"===c.type)return r=j?j[0].clientY:0,!0;if(c.stopPropagation(),c.preventDefault(),"touchend"===c.type){var m=j?j[0].clientY:0;if(Math.abs(m-r)>20)return!1}}var s=h(d(f,"ngfResetOnClick"))(a)!==!1,t=n(c,s);return t&&((!c||s)&&t.bind("change",l),c&&s&&h(d(f,"ngfResetModelOnClick"))(a)!==!1&&o(c),b(navigator.userAgent)?setTimeout(function(){g(c)},0):g(c)),!1}if(!e.attr("__ngf_gen__")){a.$on("$destroy",function(){e.$$ngfRefElem&&e.$$ngfRefElem.remove()});var q=!1;-1===d(f,"ngfSelect").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfSelect"),function(a){q=a===!1});var r=0;window.FileAPI&&window.FileAPI.ngfFixIE?window.FileAPI.ngfFixIE(e,n,m,l):p()}}function b(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=ngFileUpload.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)}ngFileUpload.getAttrWithDefaults=function(a,b){return null!=a[b]?a[b]:null==ngFileUpload.defaults[b]?ngFileUpload.defaults[b]:ngFileUpload.defaults[b].toString()};var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.updateModel=function(a,b,c,e,f,g,h,i,j,k){function l(){var k=a(d(f,"ngfKeep"))(c);if(k===!0){var l=(e.$modelValue||[]).slice(0);if(h&&h.length)if(a(d(f,"ngfKeepDistinct"))(c)===!0){for(var m=l.length,n=0;n<h.length;n++){for(var o=0;m>o&&h[n].name!==l[o].name;o++);o===m&&l.push(h[n])}h=l}else h=l.concat(h);else h=l}var p=h&&h.length?h[0]:null;if(e){var q=!a(d(f,"ngfMultiple"))(c)&&!d(f,"multiple")&&!k;b(function(){a(d(f,"ngModel")).assign(c,q?p:h)}),b(function(){e&&e.$setViewValue(q?p:null!=h&&0===h.length?null:h)})}var r=d(f,"ngfModel");r&&a(r).assign(c,h),d(f,"ngModelRejected")&&a(d(f,"ngModelRejected")).assign(c,i),g&&a(g)(c,{$files:h,$file:p,$rejectedFiles:i,$event:j})}k?l():b(function(){l()})}}(),function(){ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout",function(a,b){return a.dataUrl=function(a,c,d){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)?b(function(){var e=window.URL||window.webkitURL;if(e&&e.createObjectURL&&!d){var f;try{f=e.createObjectURL(a)}catch(g){c("",a)}f&&c(f,a)}else{var h=new FileReader;h.readAsDataURL(a),h.onload=function(d){b(function(){c(d.target.result,a)})}}}):c(null,a)},a}]),ngFileUpload.directive("ngfSrc",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("src","{{("+f.ngfSrc+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}"),f.$set("ngfSrc",null),b(e)(d)})}}}]),ngFileUpload.directive("ngfBackground",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("style",e.attr("style")+";background-image:url('{{("+f.ngfBackground+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}')"),f.$set("ngfBackground",null),b(e)(d)})}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/),a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d){return!c||c.dataUrl||angular.isString(c)?(c&&c.dataUrl?b.trustAsResourceUrl(c.dataUrl):c)||"":(void 0===c.dataUrl&&angular.isObject(c)&&(c.dataUrl=null,a.dataUrl(c,function(a,b){b.dataUrl=a},d)),"")}}])}(),function(){function a(b){if(b.length>2&&"/"===b[0]&&"/"===b[b.length-1])return b.substring(1,b.length-1);var c=b.split(","),d="";if(c.length>1)for(var e=0;e<c.length;e++)d+="("+a(c[e])+")",e<c.length-1&&(d+="|");else 0===b.indexOf(".")&&(b="*"+b),d="^"+b.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",d=d.replace(/\\\*/g,".*").replace(/\\\?/g,".");return d}function b(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1e3*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1e6*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1e9*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}ngFileUpload.service("Upload",["UploadDataUrl",function(c){var d=ngFileUpload.getAttrWithDefaults;return c.validate=function(a,b,c,e,f,g){function h(a,b){b?i.push(a):j.push(a),l++,l===e.length&&g(i,j)}if(null==d(c,"ngfValidate")&&null==d(c,"ngfAccept"))return g(e);for(var i=[],j=[],k=b(d(c,"ngfAccept"))(a,{$event:f}),l=0,m=0;m<e.length;m++){var n=e[m],o=b(d(c,"ngfValidate"))(a,{$file:n,$event:f});null==o||o!==!1&&!angular.isString(o)?null!=o||null!=k?(o=o||{},null!=k&&(o.accept=k),this.validateFile(n,o,h)):h(n,!0):(n.$error="validate",n.$errorParam=o,h(n,!1))}},c.validateFile=function(c,d,e){if(null==c)return e(c,!1);var f=d.accept;if(null!=d.accept&&angular.isString(d.accept)){var g=new RegExp(a(d.accept),"gi");if(f=null!=c.type&&g.test(c.type.toLowerCase())||null!=c.name&&g.test(c.name.toLowerCase()),!f)return c.$error="accept",e(c,!1)}else if(f===!1)return c.$error="accept",e(c,!1);if(null!=c.size&&d.size&&(d.size.max||d.size.min)){if(c.size>b(d.size.max))return c.$error="size.max",c.$errorParam=d.size.max,e(c,!1);if(c.size<b(d.size.min))return c.$error="size.min",c.$errorParam=d.size.min,e(c,!1)}if(!((d.width||d.height)&&0===c.type.indexOf("image")&&(this.imageDimensions(c,function(a,f){c.width=a,c.height=f,d.width&&(d.width.min||d.width.max)&&(d.width.max&&a>b(d.width.max)&&(c.$error="width.max",c.$errorParam=d.width.max),d.width.min&&a<b(d.width.min)&&(c.$error="width.min",c.$errorParam=d.width.min),a||d.width.soft||(c.$error=d.width.min?"width.min":"width.max",c.$errorParam=d.width.min||d.width.max)),d.height&&(d.height.min||d.height.max)&&(d.height.max&&f>b(d.height.max)&&(c.$error="height.max",c.$errorParam=d.height.max),d.height.min&&f<b(d.height.min)&&(c.$error="height.min",c.$errorParam=d.height.min),f||d.height.soft||(c.$error=d.height.min?"height.min":"height.max",c.$errorParam=d.height.min||d.height.max),e(c,!c.$error))}),d.width&&(d.width.min||d.width.max)||d.height&&(d.height.min||d.height.max))||d.duration&&(0===c.type.indexOf("audio")||0===c.type.indexOf("video"))&&(this.mediaDuration(c,function(a){c.duration=a,(d.duration.min||d.duration.max)&&(d.duration.max&&a>b(d.duration.max)&&(c.$error="duration.max",c.$errorParam=d.duration.max),d.duration.min&&a<b(d.duration.min)&&(c.$error="duration.min",c.$errorParam=d.duration.min),a||d.duration.soft||(c.$error=d.duration.min?"duration.min":"duration.max",c.$errorParam=d.duration.min||d.duration.max),e(c,!c.$error))}),d.duration.min||d.duration.max)))return e(c,!0)},c.imageDimensions=function(a,b){return 0!==a.type.indexOf("image")?!1:void c.dataUrl(a,function(c){var d=angular.element("<img>").attr("src",c).css("visibility","none").css("position","fixed");d.on("load error",function(){var c=d[0].clientWidth,e=d[0].clientHeight;d.remove(),b(c,e,a)}),angular.element(document.body).append(d)},!0)},c.mediaDuration=function(a,b){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?!1:void c.dataUrl(a,function(c){var d=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",c).css("visibility","none").css("position","fixed");d.on("loadedmetadata error",function(){var c=d[0].duration;d.remove(),b(c,a)}),angular.element(document.body).append(d)})},c}])}(),function(){function a(a,e,f,g,h,i,j){function k(a,b,e,f){var g=e.dataTransfer.items,i=[];if(null!=g)for(var j=0;j<g.length;j++)("file"===g[j].kind||""===g[j].kind)&&i.push(g[j]);c.validate(a,h,b,i,e,function(c,g){var i=h(d(b,"ngfDragOverClass"))(a,{$event:e});i&&(i.delay&&(r=i.delay),i.accept&&(i=g&&g.length?i.reject:i.accept)),f(i||d(b,"ngfDragOverClass")||"dragover")})}function l(b,d,e,g){function k(a,b,c){if(null!=b)if(b.isDirectory){var d=(c||"")+b.name;a.push({name:b.name,type:"directory",path:d});var e=b.createReader(),f=[];m++;var g=function(){e.readEntries(function(d){try{if(d.length)f=f.concat(Array.prototype.slice.call(d||[],0)),g();else{for(var e=0;e<f.length;e++)k(a,f[e],(c?c:"")+b.name+"/");m--}}catch(h){m--,console.error(h)}},function(){m--})};g()}else m++,b.file(function(b){try{m--,b.path=(c?c:"")+b.name,a.push(b)}catch(d){m--,console.error(d)}},function(){m--})}var l=[],m=0,n=b.dataTransfer.items;if(n&&n.length>0&&"file"!==j.protocol())for(var o=0;o<n.length;o++){if(n[o].webkitGetAsEntry&&n[o].webkitGetAsEntry()&&n[o].webkitGetAsEntry().isDirectory){var p=n[o].webkitGetAsEntry();if(p.isDirectory&&!e)continue;null!=p&&k(l,p)}else{var q=n[o].getAsFile();null!=q&&l.push(q)}if(!g&&l.length>0)break}else{var r=b.dataTransfer.files;if(null!=r)for(var s=0;s<r.length&&(l.push(r.item(s)),g||!(l.length>0));s++);}var t=0;!function u(e){i(function(){if(m)10*t++<2e4&&u(10);else{if(!g&&l.length>1){for(o=0;"directory"===l[o].type;)o++;l=[l[o]]}c.validate(a,h,f,l,b,function(a,b){d(a,b)})}},e||0)}()}var m=b();if(d(f,"dropAvailable")&&i(function(){a[d(f,"dropAvailable")]?a[d(f,"dropAvailable")].value=m:a[d(f,"dropAvailable")]=m}),!m)return void(h(d(f,"ngfHideOnDropNotAvailable"))(a)===!0&&e.css("display","none"));var n=!1;-1===d(f,"ngfDrop").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfDrop"),function(a){n=a===!1});var o,p=null,q=h(d(f,"ngfStopPropagation")),r=1;e[0].addEventListener("dragover",function(b){if(!e.attr("disabled")&&!n){if(b.preventDefault(),q(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var c=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===c||"linkMove"===c?"move":"copy"}i.cancel(p),o||(o="C",k(a,f,b,function(a){o=a,e.addClass(o)}))}},!1),e[0].addEventListener("dragenter",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation())},!1),e[0].addEventListener("dragleave",function(){e.attr("disabled")||n||(p=i(function(){e.removeClass(o),o=null},r||1))},!1),e[0].addEventListener("drop",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation(),e.removeClass(o),o=null,l(b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)},h(d(f,"ngfAllowDir"))(a)!==!1,d(f,"multiple")||h(d(f,"ngfMultiple"))(a)))},!1),e[0].addEventListener("paste",function(b){if(!e.attr("disabled")&&!n){var j=[],k=b.clipboardData||b.originalEvent.clipboardData;if(k&&k.items){for(var l=0;l<k.items.length;l++)-1!==k.items[l].type.indexOf("image")&&j.push(k.items[l].getAsFile());c.validate(a,h,f,j,b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)})}}},!1)}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a}var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout",function(a,c){return function(e,f,g){if(b()){var h=a(d(g,"ngfDropAvailable"));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(); | ||
/*! 6.2.1 */ | ||
!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="6.2.1",ngFileUpload.defaults={},ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(a,b,c){function d(d){d.method=d.method||"POST",d.headers=d.headers||{};var e=b.defer(),f=e.promise;return d.headers.__setXHR_=function(){return function(a){a&&(d.__XHR=a,d.xhrFn&&d.xhrFn(a),a.upload.addEventListener("progress",function(a){a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)})},!1),a.upload.addEventListener("load",function(a){a.lengthComputable&&(a.config=d,e.notify?e.notify(a):f.progressFunc&&c(function(){f.progressFunc(a)}))},!1))}},a(d).then(function(a){e.resolve(a)},function(a){e.reject(a)},function(a){e.notify(a)}),f.success=function(a){return f.then(function(b){a(b.data,b.status,b.headers,d)}),f},f.error=function(a){return f.then(null,function(b){a(b.data,b.status,b.headers,d)}),f},f.progress=function(a){return f.progressFunc=a,f.then(null,null,function(b){a(b)}),f},f.abort=function(){return d.__XHR&&c(function(){d.__XHR.abort()}),f},f.xhr=function(a){return d.xhrFn=function(b){return function(){b&&b.apply(f,arguments),a.apply(f,arguments)}}(d.xhrFn),f},f}this.upload=function(a){function b(c,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))c.append(e,d);else if("form"===a.sendFieldsAs)if(angular.isObject(d))for(var f in d)d.hasOwnProperty(f)&&b(c,d[f],e+"["+f+"]");else c.append(e,d);else d=angular.isString(d)?d:JSON.stringify(d),"json-blob"===a.sendFieldsAs?c.append(e,new Blob([d],{type:"application/json"})):c.append(e,d)}return 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(c){var d,e=new FormData,f={};for(d in a.fields)a.fields.hasOwnProperty(d)&&(f[d]=a.fields[d]);c&&(f.data=c);for(d in f)if(f.hasOwnProperty(d)){var g=f[d];a.formDataAppender?a.formDataAppender(e,d,g):b(e,g,d)}if(null!=a.file){var h=a.fileFormDataName||"file";if(angular.isArray(a.file))for(var i=angular.isString(h),j=0;j<a.file.length;j++)e.append(i?h:h[j],a.file[j],a.fileName&&a.fileName[j]||a.file[j].name);else e.append(h,a.file,a.fileName||a.file.name)}return e}),d(a)},this.http=function(b){return b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof Blob?b:a.defaults.transformRequest[0](arguments)},d(b)},this.setDefaults=function(a){ngFileUpload.defaults=a||{}},ngFileUpload.Upload=this}]),function(){function a(a,e,f,g,h,i,j){function k(){return"input"===e[0].tagName.toLowerCase()&&f.type&&"file"===f.type.toLowerCase()}function l(b){var j=b.__files_||b.target&&b.target.files;c.validate(a,h,f,j,b,function(c,j){e.$$ngfHasFile=!0,ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),c,j,b),0===c.length&&(b.target.value=c)})}function m(b){d(f,"ngfMultiple")&&b.attr("multiple",h(d(f,"ngfMultiple"))(a)),d(f,"ngfCapture")&&b.attr("capture",h(d(f,"ngfCapture"))(a)),d(f,"accept")&&b.attr("accept",d(f,"accept"));for(var c=0;c<e[0].attributes.length;c++){var g=e[0].attributes[c];(k()&&"type"!==g.name||"type"!==g.name&&"class"!==g.name&&"id"!==g.name&&"style"!==g.name)&&((null==g.value||""===g.value)&&("required"===g.name&&(g.value="required"),"multiple"===g.name&&(g.value="multiple")),b.attr(g.name,g.value))}}function n(b,c){if(!c&&(b||k()))return e.$$ngfRefElem||e;if(e.$$ngfProgramClick)return e;var d=angular.element('<input type="file">');return m(d),k()?(e.replaceWith(d),e=d,d.attr("__ngf_gen__",!0),j(e)(a)):(d.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"),e.$$ngfRefElem&&e.$$ngfRefElem.remove(),e.$$ngfRefElem=d,document.body.appendChild(d[0])),d}function o(b){e.$$ngfHasFile&&(ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfSelect"),[],[],b,!0),delete e.$$ngfHasFile)}function p(c){function g(a){a&&!e.$$ngfProgramClick&&(e.$$ngfProgramClick=!0,t[0].click(),i(function(){delete e.$$ngfProgramClick},500)),!k()&&a||!s||e.bind("click touchstart touchend",p)}if(e.attr("disabled")||q)return!1;if(null!=c){var j=c.changedTouches||c.originalEvent&&c.originalEvent.changedTouches;if("touchstart"===c.type)return r=j?j[0].clientY:0,!0;if(c.stopPropagation(),c.preventDefault(),"touchend"===c.type){var m=j?j[0].clientY:0;if(Math.abs(m-r)>20)return!1}}var s=h(d(f,"ngfResetOnClick"))(a)!==!1,t=n(c,s);return t&&((!c||s)&&t.bind("change",l),c&&s&&h(d(f,"ngfResetModelOnClick"))(a)!==!1&&o(c),b(navigator.userAgent)?setTimeout(function(){g(c)},0):g(c)),!1}if(!e.attr("__ngf_gen__")){a.$on("$destroy",function(){e.$$ngfRefElem&&e.$$ngfRefElem.remove()});var q=!1;-1===d(f,"ngfSelect").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfSelect"),function(a){q=a===!1});var r=0;window.FileAPI&&window.FileAPI.ngfFixIE?window.FileAPI.ngfFixIE(e,n,m,l):p()}}function b(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=ngFileUpload.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)}ngFileUpload.getAttrWithDefaults=function(a,b){return null!=a[b]?a[b]:null==ngFileUpload.defaults[b]?ngFileUpload.defaults[b]:ngFileUpload.defaults[b].toString()};var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.updateModel=function(a,b,c,e,f,g,h,i,j,k){function l(){var k=a(d(f,"ngfKeep"))(c);if(k===!0){var l=(e.$modelValue||[]).slice(0);if(h&&h.length)if(a(d(f,"ngfKeepDistinct"))(c)===!0){for(var m=l.length,n=0;n<h.length;n++){for(var o=0;m>o&&h[n].name!==l[o].name;o++);o===m&&l.push(h[n])}h=l}else h=l.concat(h);else h=l}var p=h&&h.length?h[0]:null;if(e){var q=!a(d(f,"ngfMultiple"))(c)&&!d(f,"multiple")&&!k;b(function(){a(d(f,"ngModel")).assign(c,q?p:h)}),b(function(){e&&e.$setViewValue(q?p:null!=h&&0===h.length?null:h)})}var r=d(f,"ngfModel");r&&a(r).assign(c,h),d(f,"ngModelRejected")&&a(d(f,"ngModelRejected")).assign(c,i),g&&a(g)(c,{$files:h,$file:p,$rejectedFiles:i,$event:j})}k?l():b(function(){l()})}}(),function(){ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout",function(a,b){return a.dataUrl=function(a,c,d){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)?b(function(){var e=window.URL||window.webkitURL;if(e&&e.createObjectURL&&!d){var f;try{f=e.createObjectURL(a)}catch(g){c("",a)}f&&c(f,a)}else{var h=new FileReader;h.readAsDataURL(a),h.onload=function(d){b(function(){c(d.target.result,a)})}}}):c(null,a)},a}]),ngFileUpload.directive("ngfSrc",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("src","{{("+f.ngfSrc+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}"),f.$set("ngfSrc",null),b(e)(d)})}}}]),ngFileUpload.directive("ngfBackground",["$parse","$compile","$timeout",function(a,b,c){return{restrict:"AE",link:function(d,e,f){c(function(){e.attr("style",e.attr("style")+";background-image:url('{{("+f.ngfBackground+") | ngfDataUrl"+(a(f.ngfNoObjectUrl)(d)===!0?":true":"")+"}}')"),f.$set("ngfBackground",null),b(e)(d)})}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/),a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|local|file|data|blob):/)}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d){return angular.isString(c)?b.trustAsResourceUrl(c):c&&!c.dataUrl?(void 0===c.dataUrl&&angular.isObject(c)&&(c.dataUrl=null,a.dataUrl(c,function(a,b){b.dataUrl=a},d)),""):(c&&c.dataUrl?b.trustAsResourceUrl(c.dataUrl):c)||""}}])}(),function(){function a(b){if(b.length>2&&"/"===b[0]&&"/"===b[b.length-1])return b.substring(1,b.length-1);var c=b.split(","),d="";if(c.length>1)for(var e=0;e<c.length;e++)d+="("+a(c[e])+")",e<c.length-1&&(d+="|");else 0===b.indexOf(".")&&(b="*"+b),d="^"+b.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",d=d.replace(/\\\*/g,".*").replace(/\\\?/g,".");return d}function b(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1e3*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1e6*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1e9*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}ngFileUpload.service("Upload",["UploadDataUrl",function(c){var d=ngFileUpload.getAttrWithDefaults;return c.validate=function(a,b,c,e,f,g){function h(a,b){b?i.push(a):j.push(a),l++,l===e.length&&g(i,j)}if(null==d(c,"ngfValidate")&&null==d(c,"ngfAccept"))return g(e);for(var i=[],j=[],k=b(d(c,"ngfAccept"))(a,{$event:f}),l=0,m=0;m<e.length;m++){var n=e[m],o=b(d(c,"ngfValidate"))(a,{$file:n,$event:f});null==o||o!==!1&&!angular.isString(o)?null!=o||null!=k?(o=o||{},null!=k&&(o.accept=k),this.validateFile(n,o,h)):h(n,!0):(n.$error="validate",n.$errorParam=o,h(n,!1))}},c.validateFile=function(c,d,e){if(null==c)return e(c,!1);var f=d.accept;if(null!=d.accept&&angular.isString(d.accept)){var g=new RegExp(a(d.accept),"gi");if(f=null!=c.type&&g.test(c.type.toLowerCase())||null!=c.name&&g.test(c.name.toLowerCase()),!f)return c.$error="accept",e(c,!1)}else if(f===!1)return c.$error="accept",e(c,!1);if(null!=c.size&&d.size&&(d.size.max||d.size.min)){if(c.size>b(d.size.max))return c.$error="size.max",c.$errorParam=d.size.max,e(c,!1);if(c.size<b(d.size.min))return c.$error="size.min",c.$errorParam=d.size.min,e(c,!1)}if(!((d.width||d.height)&&0===c.type.indexOf("image")&&(this.imageDimensions(c,function(a,f){c.width=a,c.height=f,d.width&&(d.width.min||d.width.max)&&(d.width.max&&a>b(d.width.max)&&(c.$error="width.max",c.$errorParam=d.width.max),d.width.min&&a<b(d.width.min)&&(c.$error="width.min",c.$errorParam=d.width.min),a||d.width.soft||(c.$error=d.width.min?"width.min":"width.max",c.$errorParam=d.width.min||d.width.max)),d.height&&(d.height.min||d.height.max)&&(d.height.max&&f>b(d.height.max)&&(c.$error="height.max",c.$errorParam=d.height.max),d.height.min&&f<b(d.height.min)&&(c.$error="height.min",c.$errorParam=d.height.min),f||d.height.soft||(c.$error=d.height.min?"height.min":"height.max",c.$errorParam=d.height.min||d.height.max),e(c,!c.$error))}),d.width&&(d.width.min||d.width.max)||d.height&&(d.height.min||d.height.max))||d.duration&&(0===c.type.indexOf("audio")||0===c.type.indexOf("video"))&&(this.mediaDuration(c,function(a){c.duration=a,(d.duration.min||d.duration.max)&&(d.duration.max&&a>b(d.duration.max)&&(c.$error="duration.max",c.$errorParam=d.duration.max),d.duration.min&&a<b(d.duration.min)&&(c.$error="duration.min",c.$errorParam=d.duration.min),a||d.duration.soft||(c.$error=d.duration.min?"duration.min":"duration.max",c.$errorParam=d.duration.min||d.duration.max),e(c,!c.$error))}),d.duration.min||d.duration.max)))return e(c,!0)},c.imageDimensions=function(a,b){return 0!==a.type.indexOf("image")?!1:void c.dataUrl(a,function(c){var d=angular.element("<img>").attr("src",c).css("visibility","none").css("position","fixed");d.on("load error",function(){var c=d[0].clientWidth,e=d[0].clientHeight;d.remove(),b(c,e,a)}),angular.element(document.body).append(d)},!0)},c.mediaDuration=function(a,b){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?!1:void c.dataUrl(a,function(c){var d=angular.element(0===a.type.indexOf("audio")?"<audio>":"<video>").attr("src",c).css("visibility","none").css("position","fixed");d.on("loadedmetadata error",function(){var c=d[0].duration;d.remove(),b(c,a)}),angular.element(document.body).append(d)})},c}])}(),function(){function a(a,e,f,g,h,i,j){function k(a,b,e,f){var g=e.dataTransfer.items,i=[];if(null!=g)for(var j=0;j<g.length;j++)("file"===g[j].kind||""===g[j].kind)&&i.push(g[j]);c.validate(a,h,b,i,e,function(c,g){var i=h(d(b,"ngfDragOverClass"))(a,{$event:e});i&&(i.delay&&(r=i.delay),i.accept&&(i=g&&g.length?i.reject:i.accept)),f(i||d(b,"ngfDragOverClass")||"dragover")})}function l(b,d,e,g){function k(a,b,c){if(null!=b)if(b.isDirectory){var d=(c||"")+b.name;a.push({name:b.name,type:"directory",path:d});var e=b.createReader(),f=[];m++;var g=function(){e.readEntries(function(d){try{if(d.length)f=f.concat(Array.prototype.slice.call(d||[],0)),g();else{for(var e=0;e<f.length;e++)k(a,f[e],(c?c:"")+b.name+"/");m--}}catch(h){m--,console.error(h)}},function(){m--})};g()}else m++,b.file(function(b){try{m--,b.path=(c?c:"")+b.name,a.push(b)}catch(d){m--,console.error(d)}},function(){m--})}var l=[],m=0,n=b.dataTransfer.items;if(n&&n.length>0&&"file"!==j.protocol())for(var o=0;o<n.length;o++){if(n[o].webkitGetAsEntry&&n[o].webkitGetAsEntry()&&n[o].webkitGetAsEntry().isDirectory){var p=n[o].webkitGetAsEntry();if(p.isDirectory&&!e)continue;null!=p&&k(l,p)}else{var q=n[o].getAsFile();null!=q&&l.push(q)}if(!g&&l.length>0)break}else{var r=b.dataTransfer.files;if(null!=r)for(var s=0;s<r.length&&(l.push(r.item(s)),g||!(l.length>0));s++);}var t=0;!function u(e){i(function(){if(m)10*t++<2e4&&u(10);else{if(!g&&l.length>1){for(o=0;"directory"===l[o].type;)o++;l=[l[o]]}c.validate(a,h,f,l,b,function(a,b){d(a,b)})}},e||0)}()}var m=b();if(d(f,"dropAvailable")&&i(function(){a[d(f,"dropAvailable")]?a[d(f,"dropAvailable")].value=m:a[d(f,"dropAvailable")]=m}),!m)return void(h(d(f,"ngfHideOnDropNotAvailable"))(a)===!0&&e.css("display","none"));var n=!1;-1===d(f,"ngfDrop").search(/\W+\$files\W+/)&&a.$watch(d(f,"ngfDrop"),function(a){n=a===!1});var o,p=null,q=h(d(f,"ngfStopPropagation")),r=1;e[0].addEventListener("dragover",function(b){if(!e.attr("disabled")&&!n){if(b.preventDefault(),q(a)&&b.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var c=b.dataTransfer.effectAllowed;b.dataTransfer.dropEffect="move"===c||"linkMove"===c?"move":"copy"}i.cancel(p),o||(o="C",k(a,f,b,function(a){o=a,e.addClass(o)}))}},!1),e[0].addEventListener("dragenter",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation())},!1),e[0].addEventListener("dragleave",function(){e.attr("disabled")||n||(p=i(function(){e.removeClass(o),o=null},r||1))},!1),e[0].addEventListener("drop",function(b){e.attr("disabled")||n||(b.preventDefault(),q(a)&&b.stopPropagation(),e.removeClass(o),o=null,l(b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)},h(d(f,"ngfAllowDir"))(a)!==!1,d(f,"multiple")||h(d(f,"ngfMultiple"))(a)))},!1),e[0].addEventListener("paste",function(b){if(!e.attr("disabled")&&!n){var j=[],k=b.clipboardData||b.originalEvent.clipboardData;if(k&&k.items){for(var l=0;l<k.items.length;l++)-1!==k.items[l].type.indexOf("image")&&j.push(k.items[l].getAsFile());c.validate(a,h,f,j,b,function(c,e){ngFileUpload.updateModel(h,i,a,g,f,d(f,"ngfChange")||d(f,"ngfDrop"),c,e,b)})}}},!1)}function b(){var a=document.createElement("div");return"draggable"in a&&"ondrop"in a}var c,d=ngFileUpload.getAttrWithDefaults;ngFileUpload.directive("ngfDrop",["$parse","$timeout","$location","Upload",function(b,d,e,f){return c=f,{restrict:"AEC",require:"?ngModel",link:function(c,f,g,h){a(c,f,g,h,b,d,e)}}}]),ngFileUpload.directive("ngfNoFileDrop",function(){return function(a,c){b()&&c.css("display","none")}}),ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout",function(a,c){return function(e,f,g){if(b()){var h=a(d(g,"ngfDropAvailable"));c(function(){h(e),h.assign&&h.assign(e,!0)})}}}])}(); |
{ | ||
"name": "ng-file-upload", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"devDependencies": { | ||
@@ -5,0 +5,0 @@ "grunt": "^0.4.5", |
@@ -15,4 +15,5 @@ [![npm version](https://badge.fury.io/js/ng-file-upload.svg)](http://badge.fury.io/js/ng-file-upload) | ||
**Migration notes**: [version 3.0.x](https://github.com/danialfarid/ng-file-upload/releases/tag/3.0.0) [version 3.1.x](https://github.com/danialfarid/ng-file-upload/releases/tag/3.1.0) [version 3.2.x](https://github.com/danialfarid/ng-file-upload/releases/tag/3.2.3) [version 4.x.x](https://github.com/danialfarid/ng-file-upload/releases/tag/4.0.0) [version 5.x.x](https://github.com/danialfarid/ng-file-upload/releases/tag/5.0.0) [version 6.x.x](https://github.com/danialfarid/ng-file-upload/releases/tag/6.0.0) | ||
**Migration notes**: [version 3.0.x](https://github.com/danialfarid/ng-file-upload/releases/tag/3.0.0) [version 3.1.x](https://github.com/danialfarid/ng-file-upload/releases/tag/3.1.0) [version 3.2.x](https://github.com/danialfarid/ng-file-upload/releases/tag/3.2.3) [version 4.x.x](https://github.com/danialfarid/ng-file-upload/releases/tag/4.0.0) [version 5.x.x](https://github.com/danialfarid/ng-file-upload/releases/tag/5.0.0) [version 6.x.x](https://github.com/danialfarid/ng-file-upload/releases/tag/6.0.0) [version 6.2.x](https://github.com/danialfarid/ng-file-upload/releases/tag/6.2.0) | ||
Ask questions on [StackOverflow](http://stackoverflow.com/) under the [ng-file-upload](http://stackoverflow.com/tags/ng-file-upload/) tag.<br/> | ||
@@ -37,3 +38,3 @@ For bug report or feature request please search through existing [issues](https://github.com/danialfarid/ng-file-upload/issues) first then open a new one [here](https://github.com/danialfarid/ng-file-upload/issues/new). For faster response provide steps to reprodce/versions with a jsfiddle from [here](http://jsfiddle.net/ew4jakn5/). Need paid support contact [me](mailto:danial.farid@gmail.com).<br/> | ||
* abort/cancel upload | ||
* file type/size validation and `ng-required` support. | ||
* validation on file type/size, image width/height, video/audio duration and `ng-required` support. | ||
* show preview of selected images/audio/videos | ||
@@ -72,5 +73,6 @@ * supports CORS and direct upload of file's binary data using `Upload.$http()` | ||
<div class="button" ngf-select ng-model="file">Upload using model $watch</div> | ||
<div class="button" ngf-select ng-model="files" ngf-multiple="true">Upload multiple using model $watch</div> | ||
<div class="button" ngf-select ng-model="files" ngf-multiple="true" ngf-accept="'image/*" accept="image/*">Upload multiple images using model $watch</div> | ||
<div class="button" ngf-select ngf-change="upload($file)">Upload on file change</div> | ||
<div class="button" ngf-select ngf-change="upload($files)" ngf-multiple="true">Upload multiple on file change</div> | ||
<div class="button" ngf-select ngf-change="upload($files)" ngf-multiple="true" | ||
ngf-validate="{size: {min:'10KB', max:'20MB'}}">Upload multiple with size limitation</div> | ||
Drop File: | ||
@@ -82,5 +84,5 @@ <div ngf-drop ng-model="files" class="drop-box" | ||
Image thumbnail: <img ngf-src="file" ngf-default-src="'/thumb.jpg'" ngf-accept="'image/*'"> | ||
Audio preview: <audio controls ngf-src="file" ngf-accept="'audio/*'"></audio> | ||
Video preview: <video controls ngf-src="file" ngf-accept="'video/*'"></video> | ||
Image thumbnail: <img ngf-src="file || '/thumb.jpg'"> | ||
Audio preview: <audio controls ngf-src="file"></audio> | ||
Video preview: <video controls ngf-src="file"></video> | ||
</div> | ||
@@ -132,7 +134,8 @@ ``` | ||
ngf-capture="'camera'" or "'other'" // allows mobile devices to capture using camera | ||
accept="image/*" // see standard HTML file input accept attribute | ||
accept="image/*" // see standard HTML file input accept attribute (browser dependent) | ||
ngf-accept="'image/*'" // comma separated wildcard to filter files allowed | ||
ngf-validate="validate($file)" // custom validation, to reject return false or non-empty string for file.$error | ||
ngf-min-size='10' // minimum acceptable file size in bytes | ||
ngf-max-size='1000' // maximum acceptable file size in bytes | ||
ngf-validate="{size: {min: 10, max: '20MB'}, width: {min: 100, max:10000}, | ||
height: {min: 100, max: 300}, duration: {min: '10s', max: '5m'}, accept: '.jpg'}" | ||
or "validate($file)" | ||
// see notes below after the code | ||
ngf-keep="true" or "false" // default false, keep the previous ng-model files and append the new files | ||
@@ -156,3 +159,6 @@ ngf-keep-distinct="true" or "false" // default false, if ngf-keep is set, removes duplicate selected files | ||
ngf-accept="'.pdf,.jpg'" // comma separated wildcard to filter files allowed | ||
ngf-validate="validate($file)" // custom validation, to reject return false or non-empty string for file.$error | ||
ngf-validate="{size: {min: 10, max: '20MB'}, width: {min: 100, max:10000}, | ||
height: {min: 100, max: 300}, duration: {min: '10s', max: '5m'}, accept: '.jpg'}" | ||
or "validate($file)" | ||
// see notes below after the code | ||
ngf-allow-dir="true" or "false" // default true, allow dropping files only for Chrome webkit browser | ||
@@ -169,4 +175,2 @@ ngf-drag-over-class="{accept:'acceptClass', reject:'rejectClass', delay:100}" or "myDragOverClass" or | ||
ngf-hide-on-drop-not-available="true" or "false" // default false, hides element if file drag&drop is not supported | ||
ngf-min-size='10' // minimum acceptable file size in bytes | ||
ngf-max-size='1000' // maximum acceptable file size in bytes | ||
> | ||
@@ -184,9 +188,3 @@ Drop files here | ||
ngf-background="file" //sets background-image style to the file data url. | ||
ngf-default-src="'placeholder.jpg'" // default src in case no file is available | ||
ngf-default-background="'placeholder.jpg'" // default background-image style in case no file is available | ||
ngf-no-object-url="true or false" // see #887 to force base64 url generation instead of object url. Default false | ||
ngf-accept="'.pdf,.jpg'" // comma separated wildcard to filter files allowed | ||
ngf-validate="validate($file)" // custom validation, to reject return false or non-empty string for file.$error | ||
ngf-min-size='10' // minimum acceptable file size in bytes | ||
ngf-max-size='1000' // maximum acceptable file size in bytes | ||
> | ||
@@ -268,2 +266,23 @@ ``` | ||
**ngf-validate** | ||
Either an object containing the restrictions or a custom function. | ||
restriction object could have any of these fields to restrict the accepted files. The files that are not valid according to these rules will be assigned to `ng-model-rejected` model object. | ||
``` | ||
{ | ||
size: {min: 10, max: '2.5MB'}, | ||
width: {min: 100, max: 10000, soft: true}, | ||
height: {min: 100, max: 300, soft: true}, | ||
duration: {min: '10s', max: '5m', soft: false}, | ||
accept: 'image/*' | ||
} | ||
``` | ||
* `size` is to restrict the allowed file size, integer value will be in bytes, you can use shorthand string form with 'B', 'KB', 'MB', 'GB' endings.<br/> | ||
* `width` and `height` are to restrict the image file dimensions, values are in integer `px`. <br/> | ||
* `duration` is to restrict the audio or video duration, float values representing seconds, or you can use string ending in 's', 'm' or 'h' for seconds, minutes, or hours.<br/> | ||
* `soft` option true would allow the file to be accepted if loading of the file and calculating its width, height or duration fails. Default is false which make the file to be rejected if any of those values are specified but it cannot be calculated from the given file. | ||
For custom function return false or non-empty string to reject the file. The file.$error would be 'validate' and the file.$errorParam would be the string returned by the function for that file. | ||
**Upload multiple files**: Only for HTML5 FormData browsers (not IE8-9) if you pass an array of files to `file` option it will upload all of them together in one request. In this case the `fileFormDataName` could be an array of names or a single string. For Rails or depending on your server append square brackets to the end (i.e. `file[]`). | ||
@@ -285,5 +304,5 @@ Non-html5 browsers due to flash limitation will still upload array of files one by one in a separate request. You should iterate over files and send them one by one if you want cross browser solution. | ||
**ng-model-rejected**: | ||
You can find the reason for rejection using `file.$error` which would be one of these values `accept`, `minSize`, `maxSize`, `validate`, or a custom error returned by `ngf-validate` function. | ||
`accept` is for the case the file doesn't match the `ngf-accept` criteria. | ||
`validate` is for the case when the ngf-validate function returns false for that file. | ||
You can find the reason for rejection using `file.$error` which would be one of these values `accept`, `validate`, `size.min`, `size.max`, `width.min`, `width.max`, `height.min`, `height.max`, `duration.min`, `duration.max`. Extra information about the error is available through `file.$errorParam` which for example could be the maximum file limit in case the error is `size.max`. | ||
`accept` is for the case the file doesn't match the `ngf-accept` or `ngf-validate.accept` criteria. | ||
`validate` is for the case when the ngf-validate is a custom function and returns false or non empty string for that file. | ||
@@ -290,0 +309,0 @@ **Upload.setDefaults()**: |
@@ -76,4 +76,6 @@ (function () { | ||
return function (file, disallowObjectUrl) { | ||
//return 'aaaa' + file + disallowObjectUrl + $sce + UploadDataUrl; | ||
if (file && !file.dataUrl && !angular.isString(file)) { | ||
if (angular.isString(file)) { | ||
return $sce.trustAsResourceUrl(file); | ||
} | ||
if (file && !file.dataUrl) { | ||
if (file.dataUrl === undefined && angular.isObject(file)) { | ||
@@ -80,0 +82,0 @@ file.dataUrl = null; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3177243
25213
455