/** * moxie - multi-runtime file api & xmlhttprequest l2 polyfill * v1.5.7 * * copyright 2013, moxiecode systems ab * released under gpl license. * * license: http://www.plupload.com/license * contributing: http://www.plupload.com/contributing * * date: 2017-11-03 */ !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.moxie};"function"==typeof define&&define.amd?define("moxie",[],i):"object"==typeof module&&module.exports?module.exports=i():e.moxie=i()}(this||window,function(){!function(e,t){"use strict";function i(e,t){for(var i,n=[],r=0;r0&&c(n,function(n,u){var c=-1!==h(e(n),["array","object"]);return n===r||t&&o[u]===r?!0:(c&&i&&(n=a(n)),e(o[u])===e(n)&&c?s(t,i,[o[u],n]):o[u]=n,void 0)})}),o}function u(e,t){function i(){this.constructor=e}for(var n in t)({}).hasownproperty.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.parent=t.prototype,e}function c(e,t){var i,n,r,o;if(e){try{i=e.length}catch(a){i=o}if(i===o||"number"!=typeof i){for(n in e)if(e.hasownproperty(n)&&t(e[n],n)===!1)return}else for(r=0;i>r;r++)if(t(e[r],r)===!1)return}}function l(t){var i;if(!t||"object"!==e(t))return!0;for(i in t)return!1;return!0}function d(t,i){function n(r){"function"===e(t[r])&&t[r](function(e){++ri;i++)if(t[i]===e)return i}return-1}function f(t,i){var n=[];"array"!==e(t)&&(t=[t]),"array"!==e(i)&&(i=[i]);for(var r in t)-1===h(t[r],i)&&n.push(t[r]);return n.length?n:!1}function p(e,t){var i=[];return c(e,function(e){-1!==h(e,t)&&i.push(e)}),i.length?i:null}function g(e){var t,i=[];for(t=0;ti;i++)n+=math.floor(65535*math.random()).tostring(32);return(t||"o_")+n+(e++).tostring(32)}}();return{guid:e,typeof:e,extend:t,extendif:i,extendimmutable:n,extendimmutableif:r,clone:o,inherit:u,each:c,isemptyobj:l,inseries:d,inparallel:m,inarray:h,arraydiff:f,arrayintersect:p,toarray:g,trim:x,sprintf:w,parsesizestr:v,delay:y}}),n("moxie/core/utils/encode",[],function(){var e=function(e){return unescape(encodeuricomponent(e))},t=function(e){return decodeuricomponent(escape(e))},i=function(e,i){if("function"==typeof window.atob)return i?t(window.atob(e)):window.atob(e);var n,r,o,a,s,u,c,l,d="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!e)return e;e+="";do a=d.indexof(e.charat(m++)),s=d.indexof(e.charat(m++)),u=d.indexof(e.charat(m++)),c=d.indexof(e.charat(m++)),l=a<<18|s<<12|u<<6|c,n=255&l>>16,r=255&l>>8,o=255&l,p[h++]=64==u?string.fromcharcode(n):64==c?string.fromcharcode(n,r):string.fromcharcode(n,r,o);while(m>18,s=63&l>>12,u=63&l>>6,c=63&l,p[h++]=d.charat(a)+d.charat(s)+d.charat(u)+d.charat(c);while(mn;n++)if(e[n]!=t[n]){if(e[n]=u(e[n]),t[n]=u(t[n]),e[n]t[n]){o=1;break}}if(!i)return o;switch(i){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var n=function(e){var t="",i="?",n="function",r="undefined",o="object",a="name",s="version",u={has:function(e,t){return-1!==t.tolowercase().indexof(e.tolowercase())},lowerize:function(e){return e.tolowercase()}},c={rgx:function(){for(var t,i,a,s,u,c,l,d=0,m=arguments;d0?2==u.length?t[u[0]]=typeof u[1]==n?u[1].call(this,l):u[1]:3==u.length?t[u[0]]=typeof u[1]!==n||u[1].exec&&u[1].test?l?l.replace(u[1],u[2]):e:l?u[1].call(this,l,u[2]):e:4==u.length&&(t[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):e):t[u]=l?l:e;break}if(c)break}return t},str:function(t,n){for(var r in n)if(typeof n[r]===o&&n[r].length>0){for(var a=0;a=")),i.use_blob_uri},use_data_uri:function(){var e=new image;return e.onload=function(){i.use_data_uri=1===e.width&&1===e.height},settimeout(function(){e.src="data:image/gif;base64,r0lgodlhaqabaiaaap8aaaaaach5baaaaaaalaaaaaabaaeaaaicraeaow=="},1),!1}(),use_data_uri_over32kb:function(){return i.use_data_uri&&("ie"!==a.browser||a.version>=9)},use_data_uri_of:function(e){return i.use_data_uri&&33e3>e||i.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.useragent.match(/(android (1.0|1.1|1.5|1.6|2.0|2.1))|(windows phone (os 7|8.0))|(xblwp)|(zunewp)|(w(eb)?osbrowser)|(webos)|(kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createelement("input");return e.setattribute("type","file"),i.use_fileinput=!e.disabled},use_webgl:function(){var e,n=document.createelement("canvas"),r=null;try{r=n.getcontext("webgl")||n.getcontext("experimental-webgl")}catch(o){}return r||(r=null),e=!!r,i.use_webgl=e,n=t,e}};return function(t){var n=[].slice.call(arguments);return n.shift(),"function"===e.typeof(i[t])?i[t].apply(this,n):!!i[t]}}(),o=(new n).getresult(),a={can:r,uaparser:n,browser:o.browser.name,version:o.browser.version,os:o.os.name,osversion:o.os.version,vercomp:i,swf_url:"../flash/moxie.swf",xap_url:"../silverlight/moxie.xap",global_event_dispatcher:"moxie.core.eventtarget.instance.dispatchevent"};return a.os=a.os,a}),n("moxie/core/exceptions",["moxie/core/utils/basic"],function(e){function t(e,t){var i;for(i in e)if(e[i]===t)return i;return null}return{runtimeerror:function(){function i(e,i){this.code=e,this.name=t(n,e),this.message=this.name+(i||": runtimeerror "+this.code)}var n={not_init_err:1,exception_err:3,not_supported_err:9,js_err:4};return e.extend(i,n),i.prototype=error.prototype,i}(),operationnotallowedexception:function(){function t(e){this.code=e,this.name="operationnotallowedexception"}return e.extend(t,{not_allowed_err:1}),t.prototype=error.prototype,t}(),imageerror:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": imageerror "+this.code}var n={wrong_format:1,max_resolution_err:2,invalid_meta_err:3};return e.extend(i,n),i.prototype=error.prototype,i}(),fileexception:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": fileexception "+this.code}var n={not_found_err:1,security_err:2,abort_err:3,not_readable_err:4,encoding_err:5,no_modification_allowed_err:6,invalid_state_err:7,syntax_err:8};return e.extend(i,n),i.prototype=error.prototype,i}(),domexception:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": domexception "+this.code}var n={index_size_err:1,domstring_size_err:2,hierarchy_request_err:3,wrong_document_err:4,invalid_character_err:5,no_data_allowed_err:6,no_modification_allowed_err:7,not_found_err:8,not_supported_err:9,inuse_attribute_err:10,invalid_state_err:11,syntax_err:12,invalid_modification_err:13,namespace_err:14,invalid_access_err:15,validation_err:16,type_mismatch_err:17,security_err:18,network_err:19,abort_err:20,url_mismatch_err:21,quota_exceeded_err:22,timeout_err:23,invalid_node_type_err:24,data_clone_err:25};return e.extend(i,n),i.prototype=error.prototype,i}(),eventexception:function(){function t(e){this.code=e,this.name="eventexception"}return e.extend(t,{unspecified_event_type_err:0}),t.prototype=error.prototype,t}()}}),n("moxie/core/utils/dom",["moxie/core/utils/env"],function(e){var t=function(e){return"string"!=typeof e?e:document.getelementbyid(e)},i=function(e,t){if(!e.classname)return!1;var i=new regexp("(^|\\s+)"+t+"(\\s+|$)");return i.test(e.classname)},n=function(e,t){i(e,t)||(e.classname=e.classname?e.classname.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.classname){var i=new regexp("(^|\\s+)"+t+"(\\s+|$)");e.classname=e.classname.replace(i,function(e,t,i){return" "===t&&" "===i?" ":""})}},o=function(e,t){return e.currentstyle?e.currentstyle[t]:window.getcomputedstyle?window.getcomputedstyle(e,null)[t]:void 0},a=function(t,i){function n(e){var t,i,n=0,r=0;return e&&(i=e.getboundingclientrect(),t="css1compat"===c.compatmode?c.documentelement:c.body,n=i.left+t.scrollleft,r=i.top+t.scrolltop),{x:n,y:r}}var r,o,a,s=0,u=0,c=document;if(t=t,i=i||c.body,t&&t.getboundingclientrect&&"ie"===e.browser&&(!c.documentmode||c.documentmode<8))return o=n(t),a=n(i),{x:o.x-a.x,y:o.y-a.y};for(r=t;r&&r!=i&&r.nodetype;)s+=r.offsetleft||0,u+=r.offsettop||0,r=r.offsetparent;for(r=t.parentnode;r&&r!=i&&r.nodetype;)s-=r.scrollleft||0,u-=r.scrolltop||0,r=r.parentnode;return{x:s,y:u}},s=function(e){return{w:e.offsetwidth||e.clientwidth,h:e.offsetheight||e.clientheight}};return{get:t,hasclass:i,addclass:n,removeclass:r,getstyle:o,getpos:a,getsize:s}}),n("moxie/core/eventtarget",["moxie/core/utils/env","moxie/core/exceptions","moxie/core/utils/basic"],function(e,t,i){function n(){this.uid=i.guid()}var r={};return i.extend(n.prototype,{init:function(){this.uid||(this.uid=i.guid("uid_"))},addeventlistener:function(e,t,n,o){var a,s=this;return this.hasownproperty("uid")||(this.uid=i.guid("uid_")),e=i.trim(e),/\s/.test(e)?(i.each(e.split(/\s+/),function(e){s.addeventlistener(e,t,n,o)}),void 0):(e=e.tolowercase(),n=parseint(n,10)||0,a=r[this.uid]&&r[this.uid][e]||[],a.push({fn:t,priority:n,scope:o||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][e]=a,void 0)},haseventlistener:function(e){var t;return e?(e=e.tolowercase(),t=r[this.uid]&&r[this.uid][e]):t=r[this.uid],t?t:!1},removeeventlistener:function(e,t){var n,o,a=this;if(e=e.tolowercase(),/\s/.test(e))return i.each(e.split(/\s+/),function(e){a.removeeventlistener(e,t)}),void 0;if(n=r[this.uid]&&r[this.uid][e]){if(t){for(o=n.length-1;o>=0;o--)if(n[o].fn===t){n.splice(o,1);break}}else n=[];n.length||(delete r[this.uid][e],i.isemptyobj(r[this.uid])&&delete r[this.uid])}},removealleventlisteners:function(){r[this.uid]&&delete r[this.uid]},dispatchevent:function(e){var n,o,a,s,u,c={},l=!0;if("string"!==i.typeof(e)){if(s=e,"string"!==i.typeof(s.type))throw new t.eventexception(t.eventexception.unspecified_event_type_err);e=s.type,s.total!==u&&s.loaded!==u&&(c.total=s.total,c.loaded=s.loaded),c.async=s.async||!1}if(-1!==e.indexof("::")?function(t){n=t[0],e=t[1]}(e.split("::")):n=this.uid,e=e.tolowercase(),o=r[n]&&r[n][e]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),c.type=e,a.unshift(c);var d=[];i.each(o,function(e){a[0].target=e.scope,c.async?d.push(function(t){settimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&i.inseries(d,function(e){l=!e})}return l},bindonce:function(e,t,i,n){var r=this;r.bind.call(this,e,function o(){return r.unbind(e,o),t.apply(this,arguments)},i,n)},bind:function(){this.addeventlistener.apply(this,arguments)},unbind:function(){this.removeeventlistener.apply(this,arguments)},unbindall:function(){this.removealleventlisteners.apply(this,arguments)},trigger:function(){return this.dispatchevent.apply(this,arguments)},handleeventprops:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.tolowercase();"function"===i.typeof(this[t])&&this[t].apply(this,arguments)}),i.each(e,function(e){e="on"+e.tolowercase(e),"undefined"===i.typeof(t[e])&&(t[e]=null)})}}),n.instance=new n,n}),n("moxie/runtime/runtime",["moxie/core/utils/env","moxie/core/utils/basic","moxie/core/utils/dom","moxie/core/eventtarget"],function(e,t,i,n){function r(e,n,o,s,u){var c,l=this,d=t.guid(n+"_"),m=u||"browser";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(m=r.getmode(s,e.preferred_caps,m)),c=function(){var e={};return{exec:function(t,i,n,r){return c[i]&&(e[t]||(e[t]={context:this,instance:new c[i]}),e[t].instance[n])?e[t].instance[n].apply(this,r):void 0},removeinstance:function(t){delete e[t]},removeallinstances:function(){var i=this;t.each(e,function(e,n){"function"===t.typeof(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeinstance(n)})}}}(),t.extend(this,{initialized:!1,uid:d,type:n,mode:r.getmode(s,e.required_caps,m),shimid:d+"_container",clients:0,options:e,can:function(e,i){var n=arguments[2]||o;if("string"===t.typeof(e)&&"undefined"===t.typeof(i)&&(e=r.parsecaps(e)),"object"===t.typeof(e)){for(var a in e)if(!this.can(a,e[a],n))return!1;return!0}return"function"===t.typeof(n[e])?n[e].call(this,i):i===n[e]},getshimcontainer:function(){var e,n=i.get(this.shimid);return n||(e=i.get(this.options.container)||document.body,n=document.createelement("div"),n.id=this.shimid,n.classname="moxie-shim moxie-shim-"+this.type,t.extend(n.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendchild(n),e=null),n},getshim:function(){return c},shimexec:function(e,t){var i=[].slice.call(arguments,2);return l.getshim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,i):l.shimexec.apply(this,arguments)},destroy:function(){if(l){var e=i.get(this.shimid);e&&e.parentnode.removechild(e),c&&c.removeallinstances(),this.unbindall(),delete a[this.uid],this.uid=null,d=l=c=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order="html5,flash,silverlight,html4",r.getruntime=function(e){return a[e]?a[e]:!1},r.addconstructor=function(e,t){t.prototype=n.instance,o[e]=t},r.getconstructor=function(e){return o[e]||null},r.getinfo=function(e){var t=r.getruntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parsecaps=function(e){var i={};return"string"!==t.typeof(e)?e||{}:(t.each(e.split(","),function(e){i[e]=!0}),i)},r.can=function(e,t){var i,n,o=r.getconstructor(e);return o?(i=new o({required_caps:t}),n=i.mode,i.destroy(),!!n):!1},r.thatcan=function(e,t){var i=(t||r.order).split(/\s*,\s*/);for(var n in i)if(r.can(i[n],e))return i[n];return null},r.getmode=function(e,i,n){var r=null;if("undefined"===t.typeof(n)&&(n="browser"),i&&!t.isemptyobj(e)){if(t.each(i,function(i,n){if(e.hasownproperty(n)){var o=e[n](i);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayintersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inarray(n,r)?n:r[0];if(r===!1)return!1}return n},r.getglobaleventtarget=function(){if(/^moxie\./.test(e.global_event_dispatcher)&&!e.can("access_global_ns")){var i=t.guid("moxie_event_target_");window[i]=function(e,t){n.instance.dispatchevent(e,t)},e.global_event_dispatcher=i}return e.global_event_dispatcher},r.captrue=function(){return!0},r.capfalse=function(){return!1},r.captest=function(e){return function(){return!!e}},r}),n("moxie/runtime/runtimeclient",["moxie/core/utils/env","moxie/core/exceptions","moxie/core/utils/basic","moxie/runtime/runtime"],function(e,t,i,n){return function(){var e;i.extend(this,{connectruntime:function(r){function o(i){var a,u;return i.length?(a=i.shift().tolowercase(),(u=n.getconstructor(a))?(e=new u(r),e.bind("init",function(){e.initialized=!0,settimeout(function(){e.clients++,s.ruid=e.uid,s.trigger("runtimeinit",e)},1)}),e.bind("error",function(){e.destroy(),o(i)}),e.bind("exception",function(e,i){var n=i.name+"(#"+i.code+")"+(i.message?", from: "+i.message:"");s.trigger("runtimeerror",new t.runtimeerror(t.runtimeerror.exception_err,n))}),e.mode?(e.init(),void 0):(e.trigger("error"),void 0)):(o(i),void 0)):(s.trigger("runtimeerror",new t.runtimeerror(t.runtimeerror.not_init_err)),e=null,void 0)}var a,s=this;if("string"===i.typeof(r)?a=r:"string"===i.typeof(r.ruid)&&(a=r.ruid),a){if(e=n.getruntime(a))return s.ruid=a,e.clients++,e;throw new t.runtimeerror(t.runtimeerror.not_init_err)}o((r.runtime_order||n.order).split(/\s*,\s*/))},disconnectruntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getruntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null},can:function(t){return e?e.can(t):!1}})}}),n("moxie/file/blob",["moxie/core/utils/basic","moxie/core/utils/encode","moxie/runtime/runtimeclient"],function(e,t,i){function n(o,a){function s(t,i,o){var a,s=r[this.uid];return"string"===e.typeof(s)&&s.length?(a=new n(null,{type:o,size:i-t}),a.detach(s.substr(t,a.size)),a):null}i.call(this),o&&this.connectruntime(o),a?"string"===e.typeof(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,i){return this.isdetached()?s.apply(this,arguments):this.getruntime().exec.call(this,"blob","slice",this.getsource(),e,t,i)},getsource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){if(this.ruid&&(this.getruntime().exec.call(this,"blob","destroy"),this.disconnectruntime(),this.ruid=null),e=e||"","data:"==e.substr(0,5)){var i=e.indexof(";base64,");this.type=e.substring(5,i),e=t.atob(e.substring(i+8))}this.size=e.length,r[this.uid]=e},isdetached:function(){return!this.ruid&&"string"===e.typeof(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return n}),n("moxie/core/i18n",["moxie/core/utils/basic"],function(e){var t={};return{addi18n:function(i){return e.extend(t,i)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e.typeof(t)?t:""})}}}),n("moxie/core/utils/mime",["moxie/core/utils/basic","moxie/core/i18n"],function(e,t){var i="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb xlt xla,application/vnd.ms-powerpoint,ppt pps pot ppa,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",n={},r={},o=function(e){var t,i,o,a=e.split(/,/);for(t=0;ta;a++)o+=string.fromcharcode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readasbinarystring:function(e){return n.call(this,"readasbinarystring",e)},readasdataurl:function(e){return n.call(this,"readasdataurl",e)},readastext:function(e){return n.call(this,"readastext",e)}})}}),n("moxie/xhr/formdata",["moxie/core/exceptions","moxie/core/utils/basic","moxie/file/blob"],function(e,t,i){function n(){var e,n=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeof(o);o instanceof i?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isnan(o)?a.append(r,"false"):n.push({name:r,value:o.tostring()})},hasblob:function(){return!!this.getblob()},getblob:function(){return e&&e.value||null},getblobname:function(){return e&&e.name||null},each:function(i){t.each(n,function(e){i(e.value,e.name)}),e&&i(e.value,e.name)},destroy:function(){e=null,n=[]}})}return n}),n("moxie/xhr/xmlhttprequest",["moxie/core/utils/basic","moxie/core/exceptions","moxie/core/eventtarget","moxie/core/utils/encode","moxie/core/utils/url","moxie/runtime/runtime","moxie/runtime/runtimetarget","moxie/file/blob","moxie/file/filereadersync","moxie/xhr/formdata","moxie/core/utils/env","moxie/core/utils/mime"],function(e,t,i,n,r,o,a,s,u,c,l,d){function m(){this.uid=e.guid("uid_")}function h(){function i(e,t){return i.hasownproperty(e)?1===arguments.length?l.can("define_property")?i[e]:a[e]:(l.can("define_property")?i[e]=t:a[e]=t,void 0):void 0}function u(t){function n(){_&&(_.destroy(),_=null),s.dispatchevent("loadend"),s=null}function r(r){_.bind("loadstart",function(e){i("readystate",h.loading),s.dispatchevent("readystatechange"),s.dispatchevent(e),l&&s.upload.dispatchevent(e)}),_.bind("progress",function(e){i("readystate")!==h.loading&&(i("readystate",h.loading),s.dispatchevent("readystatechange")),s.dispatchevent(e)}),_.bind("uploadprogress",function(e){l&&s.upload.dispatchevent({type:"progress",lengthcomputable:!1,total:e.total,loaded:e.loaded})}),_.bind("load",function(t){i("readystate",h.done),i("status",number(r.exec.call(_,"xmlhttprequest","getstatus")||0)),i("statustext",f[i("status")]||""),i("response",r.exec.call(_,"xmlhttprequest","getresponse",i("responsetype"))),~e.inarray(i("responsetype"),["text",""])?i("responsetext",i("response")):"document"===i("responsetype")&&i("responsexml",i("response")),u=r.exec.call(_,"xmlhttprequest","getallresponseheaders"),s.dispatchevent("readystatechange"),i("status")>0?(l&&s.upload.dispatchevent(t),s.dispatchevent(t)):(f=!0,s.dispatchevent("error")),n()}),_.bind("abort",function(e){s.dispatchevent(e),n()}),_.bind("error",function(e){f=!0,i("readystate",h.done),s.dispatchevent("readystatechange"),m=!0,s.dispatchevent(e),n()}),r.exec.call(_,"xmlhttprequest","send",{url:x,method:v,async:t,user:w,password:y,headers:s,mimetype:d,encoding:o,responsetype:s.responsetype,withcredentials:s.withcredentials,options:k},t)}var s=this;e=(new date).gettime(),_=new a,"string"==typeof k.required_caps&&(k.required_caps=o.parsecaps(k.required_caps)),k.required_caps=e.extend({},k.required_caps,{return_response_type:s.responsetype}),t instanceof c&&(k.required_caps.send_multipart=!0),e.isemptyobj(s)||(k.required_caps.send_custom_headers=!0),b||(k.required_caps.do_cors=!0),k.ruid?r(_.connectruntime(k)):(_.bind("runtimeinit",function(e,t){r(t)}),_.bind("runtimeerror",function(e,t){s.dispatchevent("runtimeerror",t)}),_.connectruntime(k))}function g(){i("responsetext",""),i("responsexml",null),i("response",null),i("status",0),i("statustext",""),e=b=null}var x,v,w,y,e,b,_,r,a=this,i={timeout:0,readystate:h.unsent,withcredentials:!1,status:0,statustext:"",responsetype:"",responsexml:null,responsetext:null,response:null},t=!0,s={},o=null,d=null,n=!1,c=!1,l=!1,m=!1,f=!1,b=!1,p=null,h=null,k={},u="";e.extend(this,i,{uid:e.guid("uid_"),upload:new m,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.domexception(t.domexception.syntax_err);if(/[\u0100-\uffff]/.test(o)||n.utf8_encode(o)!==o)throw new t.domexception(t.domexception.syntax_err);if(~e.inarray(o.touppercase(),["connect","delete","get","head","options","post","put","trace","track"])&&(v=o.touppercase()),~e.inarray(v,["connect","trace","track"]))throw new t.domexception(t.domexception.security_err);if(a=n.utf8_encode(a),l=r.parseurl(a),b=r.hassameorigin(l),x=r.resolveurl(a),(u||c)&&!b)throw new t.domexception(t.domexception.invalid_access_err);if(w=u||l.user,y=c||l.pass,t=s||!0,t===!1&&(i("timeout")||i("withcredentials")||""!==i("responsetype")))throw new t.domexception(t.domexception.invalid_access_err);n=!t,c=!1,s={},g.call(this),i("readystate",h.opened),this.dispatchevent("readystatechange")},setrequestheader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(i("readystate")!==h.opened||c)throw new t.domexception(t.domexception.invalid_state_err);if(/[\u0100-\uffff]/.test(r)||n.utf8_encode(r)!==r)throw new t.domexception(t.domexception.syntax_err);return r=e.trim(r).tolowercase(),~e.inarray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(s[r]?s[r]+=", "+o:s[r]=o,!0)},hasrequestheader:function(e){return e&&s[e.tolowercase()]||!1},getallresponseheaders:function(){return u||""},getresponseheader:function(t){return t=t.tolowercase(),f||~e.inarray(t,["set-cookie","set-cookie2"])?null:u&&""!==u&&(r||(r={},e.each(u.split(/\r\n/),function(t){var i=t.split(/:\s+/);2===i.length&&(i[0]=e.trim(i[0]),r[i[0].tolowercase()]={header:i[0],value:e.trim(i[1])})})),r.hasownproperty(t))?r[t].header+": "+r[t].value:null},overridemimetype:function(n){var r,o;if(~e.inarray(i("readystate"),[h.loading,h.done]))throw new t.domexception(t.domexception.invalid_state_err);if(n=e.trim(n.tolowercase()),/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(n=r[1],r[2]&&(o=r[2])),!d.mimes[n])throw new t.domexception(t.domexception.syntax_err);p=n,h=o},send:function(i,r){if(k="string"===e.typeof(r)?{ruid:r}:r?r:{},this.readystate!==h.opened||c)throw new t.domexception(t.domexception.invalid_state_err);if(i instanceof s)k.ruid=i.ruid,d=i.type||"application/octet-stream";else if(i instanceof c){if(i.hasblob()){var o=i.getblob();k.ruid=o.ruid,d=o.type||"application/octet-stream"}}else"string"==typeof i&&(o="utf-8",d="text/plain;charset=utf-8",i=n.utf8_encode(i));this.withcredentials||(this.withcredentials=k.required_caps&&k.required_caps.send_browser_cookies&&!b),l=!n&&this.upload.haseventlistener(),f=!1,m=!i,n||(c=!0),u.call(this,i)},abort:function(){if(f=!0,n=!1,~e.inarray(i("readystate"),[h.unsent,h.opened,h.done]))i("readystate",h.unsent);else{if(i("readystate",h.done),c=!1,!_)throw new t.domexception(t.domexception.invalid_state_err);_.getruntime().exec.call(_,"xmlhttprequest","abort",m),m=!0}},destroy:function(){_&&("function"===e.typeof(_.destroy)&&_.destroy(),_=null),this.unbindall(),this.upload&&(this.upload.unbindall(),this.upload=null)}}),this.handleeventprops(p.concat(["readystatechange"])),this.upload.handleeventprops(p)}var f={100:"continue",101:"switching protocols",102:"processing",200:"ok",201:"created",202:"accepted",203:"non-authoritative information",204:"no content",205:"reset content",206:"partial content",207:"multi-status",226:"im used",300:"multiple choices",301:"moved permanently",302:"found",303:"see other",304:"not modified",305:"use proxy",306:"reserved",307:"temporary redirect",400:"bad request",401:"unauthorized",402:"payment required",403:"forbidden",404:"not found",405:"method not allowed",406:"not acceptable",407:"proxy authentication required",408:"request timeout",409:"conflict",410:"gone",411:"length required",412:"precondition failed",413:"request entity too large",414:"request-uri too long",415:"unsupported media type",416:"requested range not satisfiable",417:"expectation failed",422:"unprocessable entity",423:"locked",424:"failed dependency",426:"upgrade required",500:"internal server error",501:"not implemented",502:"bad gateway",503:"service unavailable",504:"gateway timeout",505:"http version not supported",506:"variant also negotiates",507:"insufficient storage",510:"not extended"};m.prototype=i.instance;var p=["loadstart","progress","abort","error","load","timeout","loadend"];return h.unsent=0,h.opened=1,h.headers_received=2,h.loading=3,h.done=4,h.prototype=i.instance,h}),n("moxie/runtime/transporter",["moxie/core/utils/basic","moxie/core/utils/encode","moxie/runtime/runtimeclient","moxie/core/eventtarget"],function(e,t,i,n){function r(){function n(){l=d=0,c=this.result=null}function o(t,i){var n=this;u=i,n.bind("transportingprogress",function(t){d=t.loaded,l>d&&-1===e.inarray(n.state,[r.idle,r.done])&&a.call(n)},999),n.bind("transportingcomplete",function(){d=l,n.state=r.done,c=null,n.result=u.exec.call(n,"transporter","getasblob",t||"")},999),n.state=r.busy,n.trigger("transportingstarted"),a.call(n)}function a(){var e,i=this,n=l-d;m>n&&(m=n),e=t.btoa(c.substr(d,m)),u.exec.call(i,"transporter","receive",e,l)}var s,u,c,l,d,m;i.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.idle,result:null,transport:function(t,i,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),m=r.chunk_size,n.call(this),c=t,l=t.length,"string"===e.typeof(r)||r.ruid)o.call(a,i,this.connectruntime(r));else{var u=function(e,t){a.unbind("runtimeinit",u),o.call(a,i,t)};this.bind("runtimeinit",u),this.connectruntime(r)}},abort:function(){var e=this;e.state=r.idle,u&&(u.exec.call(e,"transporter","clear"),e.trigger("transportingaborted")),n.call(e)},destroy:function(){this.unbindall(),u=null,this.disconnectruntime(),n.call(this)}})}return r.idle=0,r.busy=1,r.done=2,r.prototype=n.instance,r}),n("moxie/image/image",["moxie/core/utils/basic","moxie/core/utils/dom","moxie/core/exceptions","moxie/file/filereadersync","moxie/xhr/xmlhttprequest","moxie/runtime/runtime","moxie/runtime/runtimeclient","moxie/runtime/transporter","moxie/core/utils/env","moxie/core/eventtarget","moxie/file/blob","moxie/file/file","moxie/core/utils/encode"],function(e,t,i,n,r,o,a,s,u,c,l,d,m){function h(){function n(e){try{return e||(e=this.exec("image","getinfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name),!0}catch(t){return this.trigger("error",t.code),!1}}function c(t){var n=e.typeof(t);try{if(t instanceof h){if(!t.size)throw new i.domexception(i.domexception.invalid_state_err);p.apply(this,arguments)}else if(t instanceof l){if(!~e.inarray(t.type,["image/jpeg","image/png"]))throw new i.imageerror(i.imageerror.wrong_format);g.apply(this,arguments)}else if(-1!==e.inarray(n,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===n)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):x.apply(this,arguments);else{if("node"!==n||"img"!==t.nodename.tolowercase())throw new i.domexception(i.domexception.type_mismatch_err);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r.code)}}function p(t,i){var n=this.connectruntime(t.ruid);this.ruid=n.uid,n.exec.call(this,"image","loadfromimage",t,"undefined"===e.typeof(i)?!0:i)}function g(t,i){function n(e){r.ruid=e.uid,e.exec.call(r,"image","loadfromblob",t)}var r=this;r.name=t.name||"",t.isdetached()?(this.bind("runtimeinit",function(e,t){n(t)}),i&&"string"==typeof i.required_caps&&(i.required_caps=o.parsecaps(i.required_caps)),this.connectruntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):n(this.connectruntime(t.ruid))}function x(e,t){var i,n=this;i=new r,i.open("get",e),i.responsetype="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("runtimeerror",function(e,t){n.trigger("runtimeerror",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var n,r,o=this,a={x:0,y:0,width:o.width,height:o.height},s=e.extendif({width:o.width,height:o.height,type:o.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveheaders:!0,resample:"default",multipass:!0},t);try{if(!o.size)throw new i.domexception(i.domexception.invalid_state_err);if(o.width>h.max_resize_width||o.height>h.max_resize_height)throw new i.imageerror(i.imageerror.max_resolution_err);if(n=o.meta&&o.meta.tiff&&o.meta.tiff.orientation||1,-1!==e.inarray(n,[5,6,7,8])){var u=s.width;s.width=s.height,s.height=u}if(s.crop){switch(r=math.max(s.width/o.width,s.height/o.height),t.fit?(a.width=math.min(math.ceil(s.width/r),o.width),a.height=math.min(math.ceil(s.height/r),o.height),r=s.width/a.width):(a.width=math.min(s.width,o.width),a.height=math.min(s.height,o.height),r=1),"boolean"==typeof s.crop&&(s.crop="cc"),s.crop.tolowercase().replace(/_/,"-")){case"rb":case"right-bottom":a.x=o.width-a.width,a.y=o.height-a.height;break;case"cb":case"center-bottom":a.x=math.floor((o.width-a.width)/2),a.y=o.height-a.height;break;case"lb":case"left-bottom":a.x=0,a.y=o.height-a.height;break;case"lt":case"left-top":a.x=0,a.y=0;break;case"ct":case"center-top":a.x=math.floor((o.width-a.width)/2),a.y=0;break;case"rt":case"right-top":a.x=o.width-a.width,a.y=0;break;case"rc":case"right-center":case"right-middle":a.x=o.width-a.width,a.y=math.floor((o.height-a.height)/2);break;case"lc":case"left-center":case"left-middle":a.x=0,a.y=math.floor((o.height-a.height)/2);break;case"cc":case"center-center":case"center-middle":default:a.x=math.floor((o.width-a.width)/2),a.y=math.floor((o.height-a.height)/2)}a.x=math.max(a.x,0),a.y=math.max(a.y,0)}else r=math.min(s.width/o.width,s.height/o.height),r>1&&!s.fit&&(r=1);this.exec("image","resize",a,r,s)}catch(c){o.trigger("error",c.code)}},downsize:function(t){var i,n={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,fit:!1,preserveheaders:!0,resample:"default"};i="object"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveheaders:arguments[3]}),this.resize(i)},crop:function(e,t,i){this.downsize(e,t,!0,i)},getascanvas:function(){if(!u.can("create_canvas"))throw new i.runtimeerror(i.runtimeerror.not_supported_err);return this.exec("image","getascanvas")},getasblob:function(e,t){if(!this.size)throw new i.domexception(i.domexception.invalid_state_err);return this.exec("image","getasblob",e||"image/jpeg",t||90)},getasdataurl:function(e,t){if(!this.size)throw new i.domexception(i.domexception.invalid_state_err);return this.exec("image","getasdataurl",e||"image/jpeg",t||90)},getasbinarystring:function(e,t){var i=this.getasdataurl(e,t);return m.atob(i.substring(i.indexof("base64,")+7))},embed:function(n,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getascanvas();if(l)return n.appendchild(l),l=null,o.destroy(),c.trigger("embedded"),void 0}var d=o.getasdataurl(t,r);if(!d)throw new i.imageerror(i.imageerror.wrong_format);if(u.can("use_data_uri_of",d.length))n.innerhtml='',o.destroy(),c.trigger("embedded");else{var h=new s;h.bind("transportingcomplete",function(){a=c.connectruntime(this.result.ruid),c.bind("embedded",function(){e.extend(a.getshimcontainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),a=null},999),a.exec.call(c,"imageview","display",this.result.uid,width,height),o.destroy()}),h.transport(m.atob(d.substring(d.indexof("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:n})}}var a,c=this,l=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,fit:!0,resample:"nearest"},r);try{if(!(n=t.get(n)))throw new i.domexception(i.domexception.invalid_node_type_err);if(!this.size)throw new i.domexception(i.domexception.invalid_state_err);this.width>h.max_resize_width||this.height>h.max_resize_height;var d=new h;return d.bind("resize",function(){o.call(this,l.type,l.quality)}),d.bind("load",function(){this.downsize(l)}),this.meta.thumb&&this.meta.thumb.width>=l.width&&this.meta.thumb.height>=l.height?d.load(this.meta.thumb.data):d.clone(this,!1),d}catch(f){this.trigger("error",f.code)}},destroy:function(){this.ruid&&(this.getruntime().exec.call(this,"image","destroy"),this.disconnectruntime()),this.meta&&this.meta.thumb&&this.meta.thumb.data.destroy(),this.unbindall()}}),this.handleeventprops(f),this.bind("load resize",function(){return n.call(this)},999)}var f=["progress","load","error","resize","embedded"];return h.max_resize_width=8192,h.max_resize_height=8192,h.prototype=c.instance,h}),n("moxie/runtime/html5/runtime",["moxie/core/utils/basic","moxie/core/exceptions","moxie/runtime/runtime","moxie/core/utils/env"],function(e,t,i,n){function o(t){var o=this,u=i.captest,c=i.captrue,l=e.extend({access_binary:u(window.filereader||window.file&&window.file.getasdataurl),access_image_binary:function(){return o.can("access_binary")&&!!s.image},display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/image")),do_cors:u(window.xmlhttprequest&&"withcredentials"in new xmlhttprequest),drag_and_drop:u(function(){var e=document.createelement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("ie"!==n.browser||n.vercomp(n.version,9,">"))}()),filter_by_extension:u(function(){return!("chrome"===n.browser&&n.vercomp(n.version,28,"<")||"ie"===n.browser&&n.vercomp(n.version,10,"<")||"safari"===n.browser&&n.vercomp(n.version,7,"<")||"firefox"===n.browser&&n.vercomp(n.version,37,"<"))}()),return_response_headers:c,return_response_type:function(e){return"json"===e&&window.json?!0:n.can("return_response_type",e)},return_status_code:c,report_upload_progress:u(window.xmlhttprequest&&(new xmlhttprequest).upload),resize_image:function(){return o.can("access_binary")&&n.can("create_canvas")},select_file:function(){return n.can("use_fileinput")&&window.file},select_folder:function(){return o.can("select_file")&&("chrome"===n.browser&&n.vercomp(n.version,21,">=")||"firefox"===n.browser&&n.vercomp(n.version,42,">="))},select_multiple:function(){return!(!o.can("select_file")||"safari"===n.browser&&"windows"===n.os||"ios"===n.os&&n.vercomp(n.osversion,"7.0.0",">")&&n.vercomp(n.osversion,"8.0.0","<"))},send_binary_string:u(window.xmlhttprequest&&((new xmlhttprequest).sendasbinary||window.uint8array&&window.arraybuffer)),send_custom_headers:u(window.xmlhttprequest),send_multipart:function(){return!!(window.xmlhttprequest&&(new xmlhttprequest).upload&&window.formdata)||o.can("send_binary_string")},slice_blob:u(window.file&&(file.prototype.mozslice||file.prototype.webkitslice||file.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&!("firefox"===n.browser&&n.vercomp(n.version,4,"<")||"opera"===n.browser&&n.vercomp(n.version,12,"<")||"ie"===n.browser&&n.vercomp(n.version,10,"<"))},upload_filesize:c,use_http_method:c},arguments[2]);i.call(this,t,arguments[1]||a,l),e.extend(this,{init:function(){this.trigger("init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getshim(),s)}var a="html5",s={};return i.addconstructor(a,o),s}),n("moxie/runtime/html5/file/blob",["moxie/runtime/html5/runtime","moxie/file/blob"],function(e,t){function i(){function e(e,t,i){var n;if(!window.file.prototype.slice)return(n=window.file.prototype.webkitslice||window.file.prototype.mozslice)?n.call(e,t,i):null;try{return e.slice(),e.slice(t,i)}catch(r){return e.slice(t,i-t)}}this.slice=function(){return new t(this.getruntime().uid,e.apply(this,arguments))},this.destroy=function(){this.getruntime().getshim().removeinstance(this.uid)}}return e.blob=i}),n("moxie/core/utils/events",["moxie/core/utils/basic"],function(e){function t(){this.returnvalue=!1}function i(){this.cancelbubble=!0}var n={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.tolowercase(),o.addeventlistener?(c=s,o.addeventlistener(a,c,!1)):o.attachevent&&(c=function(){var e=window.event;e.target||(e.target=e.srcelement),e.preventdefault=t,e.stoppropagation=i,s(e)},o.attachevent("on"+a,c)),o[r]||(o[r]=e.guid()),n.hasownproperty(o[r])||(n[o[r]]={}),l=n[o[r]],l.hasownproperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,i,o){var a,s;if(i=i.tolowercase(),t[r]&&n[t[r]]&&n[t[r]][i]){a=n[t[r]][i];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeeventlistener?t.removeeventlistener(i,a[u].func,!1):t.detachevent&&t.detachevent("on"+i,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete n[t[r]][i],e.isemptyobj(n[t[r]])){delete n[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,i){t&&t[r]&&e.each(n[t[r]],function(e,n){a(t,n,i)})};return{addevent:o,removeevent:a,removeallevents:s}}),n("moxie/runtime/html5/file/fileinput",["moxie/runtime/html5/runtime","moxie/file/file","moxie/core/utils/basic","moxie/core/utils/dom","moxie/core/utils/events","moxie/core/utils/mime","moxie/core/utils/env"],function(e,t,i,n,r,o,a){function s(){var e,s;i.extend(this,{init:function(u){var c,l,d,m,h,f,p=this,g=p.getruntime();e=u,d=o.extlist2mimes(e.accept,g.can("filter_by_extension")),l=g.getshimcontainer(),l.innerhtml='",c=n.get(g.uid),i.extend(c.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=n.get(e.browse_button),s=n.getstyle(m,"z-index")||"auto",g.can("summon_file_dialog")&&("static"===n.getstyle(m,"position")&&(m.style.position="relative"),r.addevent(m,"click",function(e){var t=n.get(g.uid);t&&!t.disabled&&t.click(),e.preventdefault()},p.uid),p.bind("refresh",function(){h=parseint(s,10)||1,n.get(e.browse_button).style.zindex=h,this.getruntime().getshimcontainer().style.zindex=h-1})),f=g.can("summon_file_dialog")?m:l,r.addevent(f,"mouseover",function(){p.trigger("mouseenter")},p.uid),r.addevent(f,"mouseout",function(){p.trigger("mouseleave")},p.uid),r.addevent(f,"mousedown",function(){p.trigger("mousedown")},p.uid),r.addevent(n.get(e.container),"mouseup",function(){p.trigger("mouseup")},p.uid),(g.can("summon_file_dialog")?c:m).setattribute("tabindex",-1),c.onchange=function x(){if(p.files=[],i.each(this.files,function(i){var n="";return e.directory&&"."==i.name?!0:(i.webkitrelativepath&&(n="/"+i.webkitrelativepath.replace(/^\//,"")),i=new t(g.uid,i),i.relativepath=n,p.files.push(i),void 0)}),"ie"!==a.browser&&"iemobile"!==a.browser)this.value="";else{var n=this.clonenode(!0);this.parentnode.replacechild(n,this),n.onchange=x}p.files.length&&p.trigger("change")},p.trigger({type:"ready",async:!0}),l=null},setoption:function(e,t){var i=this.getruntime(),r=n.get(i.uid);switch(e){case"accept":if(t){var a=t.mimes||o.extlist2mimes(t,i.can("filter_by_extension"));r.setattribute("accept",a.join(","))}else r.removeattribute("accept");break;case"directory":t&&i.can("select_folder")?(r.setattribute("directory",""),r.setattribute("webkitdirectory","")):(r.removeattribute("directory"),r.removeattribute("webkitdirectory"));break;case"multiple":t&&i.can("select_multiple")?r.setattribute("multiple",""):r.removeattribute("multiple")}},disable:function(e){var t,i=this.getruntime();(t=n.get(i.uid))&&(t.disabled=!!e)},destroy:function(){var t=this.getruntime(),i=t.getshim(),o=t.getshimcontainer(),a=e&&n.get(e.container),u=e&&n.get(e.browse_button);a&&r.removeallevents(a,this.uid),u&&(r.removeallevents(u,this.uid),u.style.zindex=s),o&&(r.removeallevents(o,this.uid),o.innerhtml=""),i.removeinstance(this.uid),e=o=a=u=i=null}})}return e.fileinput=s}),n("moxie/runtime/html5/file/filedrop",["moxie/runtime/html5/runtime","moxie/file/file","moxie/core/utils/basic","moxie/core/utils/dom","moxie/core/utils/events","moxie/core/utils/mime"],function(e,t,i,n,r,o){function a(){function e(e){if(!e.datatransfer||!e.datatransfer.types)return!1;var t=i.toarray(e.datatransfer.types||[]);return-1!==i.inarray("files",t)||-1!==i.inarray("public.file-url",t)||-1!==i.inarray("application/x-moz-file",t)}function a(e,i){if(u(e)){var n=new t(f,e);n.relativepath=i||"",p.push(n)}}function s(e){for(var t=[],n=0;n=")&&u.vercomp(u.version,7,"<"),f="android browser"===u.browser,p=!1;if(h=i.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").tolowercase(),m=c(),m.open(i.method,i.url,i.async,i.user,i.password),r instanceof o)r.isdetached()&&(p=!0),r=r.getsource();else if(r instanceof a){if(r.hasblob())if(r.getblob().isdetached())r=d.call(s,r),p=!0;else if((l||f)&&"blob"===t.typeof(r.getblob().getsource())&&window.filereader)return e.call(s,i,r),void 0;if(r instanceof a){var g=new window.formdata;r.each(function(e,t){e instanceof o?g.append(t,e.getsource()):g.append(t,e)}),r=g}}m.upload?(i.withcredentials&&(m.withcredentials=!0),m.addeventlistener("load",function(e){s.trigger(e)}),m.addeventlistener("error",function(e){s.trigger(e)}),m.addeventlistener("progress",function(e){s.trigger(e)}),m.upload.addeventlistener("progress",function(e){s.trigger({type:"uploadprogress",loaded:e.loaded,total:e.total})})):m.onreadystatechange=function(){switch(m.readystate){case 1:break;case 2:break;case 3:var e,t;try{n.hassameorigin(i.url)&&(e=m.getresponseheader("content-length")||0),m.responsetext&&(t=m.responsetext.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthcomputable:!!e,total:parseint(e,10),loaded:t});break;case 4:m.onreadystatechange=function(){};try{if(m.status>=200&&m.status<400){s.trigger("load");break}}catch(r){}s.trigger("error")}},t.isemptyobj(i.headers)||t.each(i.headers,function(e,t){m.setrequestheader(t,e)}),""!==i.responsetype&&"responsetype"in m&&(m.responsetype="json"!==i.responsetype||u.can("return_response_type","json")?i.responsetype:"text"),p?m.sendasbinary?m.sendasbinary(r):function(){for(var e=new uint8array(r.length),t=0;t0&&o.set(new uint8array(t.slice(0,e)),0),o.set(new uint8array(r),e),o.set(new uint8array(t.slice(e+n)),e+r.bytelength),this.clear(),t=o.buffer,i=new dataview(t);break}default:return t}},length:function(){return t?t.bytelength:0},clear:function(){i=t=null}})}function n(t){function i(e,i,n){n=3===arguments.length?n:t.length-i-1,t=t.substr(0,i)+e+t.substr(n+i)}e.extend(this,{readbyteat:function(e){return t.charcodeat(e)},writebyteat:function(e,t){i(string.fromcharcode(t),e,1)},segment:function(e,n,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,n);case 3:i(null!==r?r:"",e,n);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleendian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new error("you are trying to read outside the source boundaries.");for(n=this.littleendian?0:-8*(t-1),r=0,i=0;t>r;r++)i|=this.readbyteat(e+r)<this.length())throw new error("you are trying to write outside the source boundaries.");for(n=this.littleendian?0:-8*(i-1),r=0;i>r;r++)this.writebyteat(e+r,255&t>>math.abs(n+8*r))},byte:function(e){return this.read(e,1)},short:function(e){return this.read(e,2)},long:function(e){return this.read(e,4)},slong:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},char:function(e){return string.fromcharcode(this.read(e,1))},string:function(e,t){return this.asarray("char",e,t).join("")},asarray:function(e,t,i){for(var n=[],r=0;i>r;r++)n[r]=this[e](t+r);return n}}),t}),n("moxie/runtime/html5/image/jpegheaders",["moxie/runtime/html5/utils/binaryreader","moxie/core/exceptions"],function(e,t){return function i(n){var r,o,a,s=[],u=0;if(r=new e(n),65496!==r.short(0))throw r.clear(),new t.imageerror(t.imageerror.wrong_format);for(o=2;o<=r.length();)if(a=r.short(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;u=r.short(o+2)+2,a>=65505&&65519>=a&&s.push({hex:a,name:"app"+(15&a),start:o,length:u,segment:r.segment(o,u)}),o+=u}return r.clear(),{headers:s,restore:function(t){var i,n,r;for(r=new e(t),o=65504==r.short(2)?4+r.short(4):2,n=0,i=s.length;i>n;n++)r.segment(o,0,s[n].segment),o+=s[n].length;return t=r.segment(),r.clear(),t},strip:function(t){var n,r,o,a;for(o=new i(t),r=o.headers,o.purge(),n=new e(t),a=r.length;a--;)n.segment(r[a].start,r[a].length,"");return t=n.segment(),n.clear(),t},get:function(e){for(var t=[],i=0,n=s.length;n>i;i++)s[i].name===e.touppercase()&&t.push(s[i].segment);return t},set:function(e,t){var i,n,r,o=[];for("string"==typeof t?o.push(t):o=t,i=n=0,r=s.length;r>i&&(s[i].name===e.touppercase()&&(s[i].segment=o[n],s[i].length=o[n].length,n++),!(n>=o.length));i++);},purge:function(){this.headers=s=[]}}}}),n("moxie/runtime/html5/image/exifparser",["moxie/core/utils/basic","moxie/runtime/html5/utils/binaryreader","moxie/core/exceptions"],function(e,i,n){function r(o){function a(i,r){var o,a,s,u,c,m,h,f,p=this,g=[],x={},v={1:"byte",7:"undefined",2:"ascii",3:"short",4:"long",5:"rational",9:"slong",10:"srational"},w={byte:1,undefined:1,ascii:1,short:2,long:4,rational:8,slong:4,srational:8};for(o=p.short(i),a=0;o>a;a++)if(g=[],h=i+2+12*a,s=r[p.short(h)],s!==t){if(u=v[p.short(h+=2)],c=p.long(h+=2),m=w[u],!m)throw new n.imageerror(n.imageerror.invalid_meta_err);if(h+=4,m*c>4&&(h=p.long(h)+d.tiffheader),h+m*c>=this.length())throw new n.imageerror(n.imageerror.invalid_meta_err);"ascii"!==u?(g=p.asarray(u,h,c),f=1==c?g[0]:g,x[s]=l.hasownproperty(s)&&"object"!=typeof f?l[s][f]:f):x[s]=e.trim(p.string(h,c).replace(/\0$/,""))}return x}function s(e,t,i){var n,r,o,a=0;if("string"==typeof t){var s=c[e.tolowercase()];for(var u in s)if(s[u]===t){t=u;break}}n=d[e.tolowercase()+"ifd"],r=this.short(n);for(var l=0;r>l;l++)if(o=n+12*l+2,this.short(o)==t){a=o+8;break}if(!a)return!1;try{this.write(a,i,4)}catch(m){return!1}return!0}var u,c,l,d,m,h;if(i.call(this,o),c={tiff:{274:"orientation",270:"imagedescription",271:"make",272:"model",305:"software",34665:"exififdpointer",34853:"gpsinfoifdpointer"},exif:{36864:"exifversion",40961:"colorspace",40962:"pixelxdimension",40963:"pixelydimension",36867:"datetimeoriginal",33434:"exposuretime",33437:"fnumber",34855:"isospeedratings",37377:"shutterspeedvalue",37378:"aperturevalue",37383:"meteringmode",37384:"lightsource",37385:"flash",37386:"focallength",41986:"exposuremode",41987:"whitebalance",41990:"scenecapturetype",41988:"digitalzoomratio",41992:"contrast",41993:"saturation",41994:"sharpness"},gps:{0:"gpsversionid",1:"gpslatituderef",2:"gpslatitude",3:"gpslongituderef",4:"gpslongitude"},thumb:{513:"jpeginterchangeformat",514:"jpeginterchangeformatlength"}},l={colorspace:{1:"srgb",0:"uncalibrated"},meteringmode:{0:"unknown",1:"average",2:"centerweightedaverage",3:"spot",4:"multispot",5:"pattern",6:"partial",255:"other"},lightsource:{1:"daylight",2:"fliorescent",3:"tungsten",4:"flash",9:"fine weather",10:"cloudy weather",11:"shade",12:"daylight fluorescent (d 5700 - 7100k)",13:"day white fluorescent (n 4600 -5400k)",14:"cool white fluorescent (w 3900 - 4500k)",15:"white fluorescent (ww 3200 - 3700k)",17:"standard light a",18:"standard light b",19:"standard light c",20:"d55",21:"d65",22:"d75",23:"d50",24:"iso studio tungsten",255:"other"},flash:{0:"flash did not fire",1:"flash fired",5:"strobe return light not detected",7:"strobe return light detected",9:"flash fired, compulsory flash mode",13:"flash fired, compulsory flash mode, return light not detected",15:"flash fired, compulsory flash mode, return light detected",16:"flash did not fire, compulsory flash mode",24:"flash did not fire, auto mode",25:"flash fired, auto mode",29:"flash fired, auto mode, return light not detected",31:"flash fired, auto mode, return light detected",32:"no flash function",65:"flash fired, red-eye reduction mode",69:"flash fired, red-eye reduction mode, return light not detected",71:"flash fired, red-eye reduction mode, return light detected",73:"flash fired, compulsory flash mode, red-eye reduction mode",77:"flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"flash fired, auto mode, red-eye reduction mode",93:"flash fired, auto mode, return light not detected, red-eye reduction mode",95:"flash fired, auto mode, return light detected, red-eye reduction mode"},exposuremode:{0:"auto exposure",1:"manual exposure",2:"auto bracket"},whitebalance:{0:"auto white balance",1:"manual white balance"},scenecapturetype:{0:"standard",1:"landscape",2:"portrait",3:"night scene"},contrast:{0:"normal",1:"soft",2:"hard"},saturation:{0:"normal",1:"low saturation",2:"high saturation"},sharpness:{0:"normal",1:"soft",2:"hard"},gpslatituderef:{n:"north latitude",s:"south latitude"},gpslongituderef:{e:"east longitude",w:"west longitude"}},d={tiffheader:10},m=d.tiffheader,u={clear:this.clear},e.extend(this,{read:function(){try{return r.prototype.read.apply(this,arguments)}catch(e){throw new n.imageerror(n.imageerror.invalid_meta_err)}},write:function(){try{return r.prototype.write.apply(this,arguments)}catch(e){throw new n.imageerror(n.imageerror.invalid_meta_err)}},undefined:function(){return this.byte.apply(this,arguments)},rational:function(e){return this.long(e)/this.long(e+4)},srational:function(e){return this.slong(e)/this.slong(e+4)},ascii:function(e){return this.char(e)},tiff:function(){return h||null},exif:function(){var t=null;if(d.exififd){try{t=a.call(this,d.exififd,c.exif)}catch(i){return null}if(t.exifversion&&"array"===e.typeof(t.exifversion)){for(var n=0,r="";n=65472&&65475>=t)return n+=5,{height:e.short(n),width:e.short(n+=2)};i=e.short(n+=2),n+=i-2}return null}function s(){var e,t,i=d.thumb();return i&&(e=new n(i),t=a(e),e.clear(),t)?(t.data=i,t):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),m=l=d=c=null)}var c,l,d,m;if(c=new n(o),65496!==c.short(0))throw new t.imageerror(t.imageerror.wrong_format);l=new i(o);try{d=new r(l.get("app1")[0])}catch(h){}m=a.call(this),e.extend(this,{type:"image/jpeg",size:c.length(),width:m&&m.width||0,height:m&&m.height||0,setexif:function(t,i){return d?("object"===e.typeof(t)?e.each(t,function(e,t){d.setexif(t,e)}):d.setexif(t,i),l.set("app1",d.segment()),void 0):!1},writeheaders:function(){return arguments.length?l.restore(arguments[0]):l.restore(o)},stripheaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.tiff(),exif:d.exif(),gps:d.gps(),thumb:s()})}return o}),n("moxie/runtime/html5/image/png",["moxie/core/exceptions","moxie/core/utils/basic","moxie/runtime/html5/utils/binaryreader"],function(e,t,i){function n(n){function r(){var e,t;return e=a.call(this,8),"ihdr"==e.type?(t=e.start,{width:s.long(t),height:s.long(t+=4)}):null}function o(){s&&(s.clear(),n=l=u=c=s=null)}function a(e){var t,i,n,r;return t=s.long(e),i=s.string(e+=4,4),n=e+=4,r=s.long(e+t),{length:t,type:i,start:n,crc:r}}var s,u,c,l;s=new i(n),function(){var t=0,i=0,n=[35152,20039,3338,6666];for(i=0;ii.height?"width":"height",a=math.round(i[o]*n),s=!1;"nearest"!==r&&(.5>n||n>2)&&(n=.5>n?.5:2,s=!0);var u=t(i,n);return s?e(u,a/u[o],r):u}function t(e,t){var i=e.width,n=e.height,r=math.round(i*t),o=math.round(n*t),a=document.createelement("canvas");return a.width=r,a.height=o,a.getcontext("2d").drawimage(e,0,0,i,n,0,0,r,o),e=null,a}return{scale:e}}),n("moxie/runtime/html5/image/image",["moxie/runtime/html5/runtime","moxie/core/utils/basic","moxie/core/exceptions","moxie/core/utils/encode","moxie/file/blob","moxie/file/file","moxie/runtime/html5/image/imageinfo","moxie/runtime/html5/image/resizercanvas","moxie/core/utils/mime","moxie/core/utils/env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(){if(!v&&!g)throw new i.imageerror(i.domexception.invalid_state_err);return v||g}function c(){var t=e();return"canvas"==t.nodename.tolowercase()?t:(v=document.createelement("canvas"),v.width=t.width,v.height=t.height,v.getcontext("2d").drawimage(t,0,0),v)}function l(e){return n.atob(e.substring(e.indexof("base64,")+7))}function d(e,t){return"data:"+(t||"")+";base64,"+n.btoa(e)}function m(e){var t=this;g=new image,g.onerror=function(){p.call(this),t.trigger("error",i.imageerror.wrong_format)},g.onload=function(){t.trigger("load")},g.src="data:"==e.substr(0,5)?e:d(e,y.type)}function h(e,t){var n,r=this;return window.filereader?(n=new filereader,n.onload=function(){t.call(r,this.result)},n.onerror=function(){r.trigger("error",i.imageerror.wrong_format)},n.readasdataurl(e),void 0):t.call(this,e.getasdataurl())}function f(e,i){var n=math.pi/180,r=document.createelement("canvas"),o=r.getcontext("2d"),a=e.width,s=e.height;switch(t.inarray(i,[5,6,7,8])>-1?(r.width=s,r.height=a):(r.width=a,r.height=s),i){case 2:o.translate(a,0),o.scale(-1,1);break;case 3:o.translate(a,s),o.rotate(180*n);break;case 4:o.translate(0,s),o.scale(1,-1);break;case 5:o.rotate(90*n),o.scale(1,-1);break;case 6:o.rotate(90*n),o.translate(0,-s);break;case 7:o.rotate(90*n),o.translate(a,-s),o.scale(-1,1);break;case 8:o.rotate(-90*n),o.translate(-a,0)}return o.drawimage(e,0,0,a,s),r}function p(){x&&(x.purge(),x=null),w=g=v=y=null,b=!1}var g,x,v,w,y,e=this,b=!1,_=!0;t.extend(this,{loadfromblob:function(e){var t=this.getruntime(),n=arguments.length>1?arguments[1]:!0;if(!t.can("access_binary"))throw new i.runtimeerror(i.runtimeerror.not_supported_err);return y=e,e.isdetached()?(w=e.getsource(),m.call(this,w),void 0):(h.call(this,e.getsource(),function(e){n&&(w=l(e)),m.call(this,e)}),void 0)},loadfromimage:function(e,t){this.meta=e.meta,y=new o(null,{name:e.name,size:e.size,type:e.type}),m.call(this,t?w=e.getasbinarystring():e.getasdataurl())},getinfo:function(){var t,i=this.getruntime();return!x&&w&&i.can("access_image_binary")&&(x=new a(w)),t={width:e().width||0,height:e().height||0,type:y.type||u.getfilemime(y.name),size:w&&w.length||y.size||0,name:y.name||"",meta:null},_&&(t.meta=x&&x.meta||this.meta||{},!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof r||(t.meta.thumb.data=new r(null,{type:"image/jpeg",data:t.meta.thumb.data}))),t},resize:function(t,i,n){var r=document.createelement("canvas");if(r.width=t.width,r.height=t.height,r.getcontext("2d").drawimage(e(),t.x,t.y,t.width,t.height,0,0,r.width,r.height),v=s.scale(r,i),_=n.preserveheaders,!_){var o=this.meta&&this.meta.tiff&&this.meta.tiff.orientation||1;v=f(v,o)}this.width=v.width,this.height=v.height,b=!0,this.trigger("resize")},getascanvas:function(){return v||(v=c()),v.id=this.uid+"_canvas",v},getasblob:function(e,t){return e!==this.type?(b=!0,new o(null,{name:y.name||"",type:e,data:e.getasdataurl(e,t)})):new o(null,{name:y.name||"",type:e,data:e.getasbinarystring(e,t)})},getasdataurl:function(e){var t=arguments[1]||90;if(!b)return g.src;if(c(),"image/jpeg"!==e)return v.todataurl("image/png");try{return v.todataurl("image/jpeg",t/100)}catch(i){return v.todataurl("image/jpeg")}},getasbinarystring:function(e,t){if(!b)return w||(w=l(e.getasdataurl(e,t))),w;if("image/jpeg"!==e)w=l(e.getasdataurl(e,t));else{var i;t||(t=90),c();try{i=v.todataurl("image/jpeg",t/100)}catch(n){i=v.todataurl("image/jpeg")}w=l(i),x&&(w=x.stripheaders(w),_&&(x.meta&&x.meta.exif&&x.setexif({pixelxdimension:this.width,pixelydimension:this.height}),w=x.writeheaders(w)),x.purge(),x=null)}return b=!1,w},destroy:function(){e=null,p.call(this),this.getruntime().getshim().removeinstance(this.uid)}})}return e.image=c}),n("moxie/runtime/flash/runtime",["moxie/core/utils/basic","moxie/core/utils/env","moxie/core/utils/dom","moxie/core/exceptions","moxie/runtime/runtime"],function(e,t,i,n,o){function a(){var e;try{e=navigator.plugins["shockwave flash"],e=e.description}catch(t){try{e=new activexobject("shockwaveflash.shockwaveflash").getvariable("$version")}catch(i){e="0.0"}}return e=e.match(/\d+/g),parsefloat(e[0]+"."+e[1])}function s(e){var n=i.get(e);n&&"object"==n.nodename&&("ie"===t.browser?(n.style.display="none",function r(){4==n.readystate?u(e):settimeout(r,10)}()):n.parentnode.removechild(n))}function u(e){var t=i.get(e);if(t){for(var n in t)"function"==typeof t[n]&&(t[n]=null);t.parentnode.removechild(t)}}function c(u){var c,m=this;u=e.extend({swf_url:t.swf_url},u),o.call(this,u,l,{access_binary:function(e){return e&&"browser"===m.mode},access_image_binary:function(e){return e&&"browser"===m.mode},display_media:o.captest(r("moxie/image/image")),do_cors:o.captrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===m.mode},resize_image:o.captrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.json?!0:!e.arraydiff(t,["","text","document"])||"browser"===m.mode},return_status_code:function(t){return"browser"===m.mode||!e.arraydiff(t,[200,404])},select_file:o.captrue,select_multiple:o.captrue,send_binary_string:function(e){return e&&"browser"===m.mode},send_browser_cookies:function(e){return e&&"browser"===m.mode},send_custom_headers:function(e){return e&&"browser"===m.mode},send_multipart:o.captrue,slice_blob:function(e){return e&&"browser"===m.mode},stream_upload:function(e){return e&&"browser"===m.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parsesizestr(t)<=2097152||"client"===m.mode},use_http_method:function(t){return!e.arraydiff(t,["get","post"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arraydiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arraydiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},slice_blob:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parsesizestr(t)>=2097152?"client":"browser"}},"client"),a()<11.3&&(this.mode=!1),e.extend(this,{getshim:function(){return i.get(this.uid)},shimexec:function(e,t){var i=[].slice.call(arguments,2);return m.getshim().exec(this.uid,e,t,i)},init:function(){var i,r,a;a=this.getshimcontainer(),e.extend(a.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),i=''+''+''+''+"","ie"===t.browser?(r=document.createelement("div"),a.appendchild(r),r.outerhtml=i,r=a=null):a.innerhtml=i,c=settimeout(function(){m&&!m.initialized&&m.trigger("error",new n.runtimeerror(n.runtimeerror.not_init_err))},5e3)},destroy:function(e){return function(){s(m.uid),e.call(m),cleartimeout(c),u=c=e=m=null}}(this.destroy)},d)}var l="flash",d={};return o.addconstructor(l,c),d}),n("moxie/runtime/flash/file/blob",["moxie/runtime/flash/runtime","moxie/file/blob"],function(e,t){var i={slice:function(e,i,n,r){var o=this.getruntime();return 0>i?i=math.max(e.size+i,0):i>0&&(i=math.min(i,e.size)),0>n?n=math.max(e.size+n,0):n>0&&(n=math.min(n,e.size)),e=o.shimexec.call(this,"blob","slice",i,n,r||""),e&&(e=new t(o.uid,e)),e}};return e.blob=i}),n("moxie/runtime/flash/file/fileinput",["moxie/runtime/flash/runtime","moxie/file/file","moxie/core/utils/dom","moxie/core/utils/basic"],function(e,t,i,n){var r={init:function(e){var r=this,o=this.getruntime(),a=i.get(e.browse_button);a&&(a.setattribute("tabindex",-1),a=null),this.bind("change",function(){var e=o.shimexec.call(r,"fileinput","getfiles");r.files=[],n.each(e,function(e){r.files.push(new t(o.uid,e))})},999),this.getruntime().shimexec.call(this,"fileinput","init",{accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.fileinput=r}),n("moxie/runtime/flash/file/filereader",["moxie/runtime/flash/runtime","moxie/core/utils/encode"],function(e,t){function i(e,i){switch(i){case"readastext":return t.atob(e,"utf8");case"readasbinarystring":return t.atob(e);case"readasdataurl":return e}return null}var n={read:function(e,t){var n=this;return n.result="","readasdataurl"===e&&(n.result="data:"+(t.type||"")+";base64,"),n.bind("progress",function(t,r){r&&(n.result+=i(r,e))},999),n.getruntime().shimexec.call(this,"filereader","readasbase64",t.uid)}};return e.filereader=n}),n("moxie/runtime/flash/file/filereadersync",["moxie/runtime/flash/runtime","moxie/core/utils/encode"],function(e,t){function i(e,i){switch(i){case"readastext":return t.atob(e,"utf8");case"readasbinarystring":return t.atob(e);case"readasdataurl":return e}return null}var n={read:function(e,t){var n,r=this.getruntime();return(n=r.shimexec.call(this,"filereadersync","readasbase64",t.uid))?("readasdataurl"===e&&(n="data:"+(t.type||"")+";base64,"+n),i(n,e,t.type)):null}};return e.filereadersync=n}),n("moxie/runtime/flash/runtime/transporter",["moxie/runtime/flash/runtime","moxie/file/blob"],function(e,t){var i={getasblob:function(e){var i=this.getruntime(),n=i.shimexec.call(this,"transporter","getasblob",e);return n?new t(i.uid,n):null}};return e.transporter=i}),n("moxie/runtime/flash/xhr/xmlhttprequest",["moxie/runtime/flash/runtime","moxie/core/utils/basic","moxie/file/blob","moxie/file/file","moxie/file/filereadersync","moxie/runtime/flash/file/filereadersync","moxie/xhr/formdata","moxie/runtime/transporter","moxie/runtime/flash/runtime/transporter"],function(e,t,i,n,r,o,a,s){var u={send:function(e,n){function r(){e.transport=l.mode,l.shimexec.call(c,"xmlhttprequest","send",e,n)}function o(e,t){l.shimexec.call(c,"xmlhttprequest","appendblob",e,t.uid),n=null,r()}function u(e,t){var i=new s;i.bind("transportingcomplete",function(){t(this.result)}),i.transport(e.getsource(),e.type,{ruid:l.uid})}var c=this,l=c.getruntime();if(t.isemptyobj(e.headers)||t.each(e.headers,function(e,t){l.shimexec.call(c,"xmlhttprequest","setrequestheader",t,e.tostring())}),n instanceof a){var d;if(n.each(function(e,t){e instanceof i?d=t:l.shimexec.call(c,"xmlhttprequest","append",t,e)}),n.hasblob()){var m=n.getblob();m.isdetached()?u(m,function(e){m.destroy(),o(d,e)}):o(d,m)}else n=null,r()}else n instanceof i?n.isdetached()?u(n,function(e){n.destroy(),n=e.uid,r()}):(n=n.uid,r()):r()},getresponse:function(e){var i,o,a=this.getruntime();if(o=a.shimexec.call(this,"xmlhttprequest","getresponseasblob")){if(o=new n(a.uid,o),"blob"===e)return o;try{if(i=new r,~t.inarray(e,["","text"]))return i.readastext(o);if("json"===e&&window.json)return json.parse(i.readastext(o))}finally{o.destroy()}}return null},abort:function(){var e=this.getruntime();e.shimexec.call(this,"xmlhttprequest","abort"),this.dispatchevent("readystatechange"),this.dispatchevent("abort")}};return e.xmlhttprequest=u}),n("moxie/runtime/flash/image/image",["moxie/runtime/flash/runtime","moxie/core/utils/basic","moxie/runtime/transporter","moxie/file/blob","moxie/file/filereadersync"],function(e,t,i,n,r){var o={loadfromblob:function(e){function t(e){r.shimexec.call(n,"image","loadfromblob",e.uid),n=r=null}var n=this,r=n.getruntime();if(e.isdetached()){var o=new i;o.bind("transportingcomplete",function(){t(o.result.getsource())}),o.transport(e.getsource(),e.type,{ruid:r.uid})}else t(e.getsource())},loadfromimage:function(e){var t=this.getruntime();return t.shimexec.call(this,"image","loadfromimage",e.uid)},getinfo:function(){var e=this.getruntime(),t=e.shimexec.call(this,"image","getinfo");return t.meta&&t.meta.thumb&&t.meta.thumb.data&&!(e.meta.thumb.data instanceof n)&&(t.meta.thumb.data=new n(e.uid,t.meta.thumb.data)),t},getasblob:function(e,t){var i=this.getruntime(),r=i.shimexec.call(this,"image","getasblob",e,t);return r?new n(i.uid,r):null},getasdataurl:function(){var e,t=this.getruntime(),i=t.image.getasblob.apply(this,arguments);return i?(e=new r,e.readasdataurl(i)):null}};return e.image=o}),n("moxie/runtime/silverlight/runtime",["moxie/core/utils/basic","moxie/core/utils/env","moxie/core/utils/dom","moxie/core/exceptions","moxie/runtime/runtime"],function(e,t,i,n,o){function a(e){var t,i,n,r,o,a=!1,s=null,u=0;try{try{s=new activexobject("agcontrol.agcontrol"),s.isversionsupported(e)&&(a=!0),s=null}catch(c){var l=navigator.plugins["silverlight plug-in"];if(l){for(t=l.description,"1.0.30226.2"===t&&(t="2.0.30226.2"),i=t.split(".");i.length>3;)i.pop();for(;i.length<4;)i.push(0);for(n=e.split(".");n.length>4;)n.pop();do r=parseint(n[u],10),o=parseint(i[u],10),u++;while(u=r&&!isnan(r)&&(a=!0)}}}catch(d){a=!1}return a}function s(s){var l,d=this;s=e.extend({xap_url:t.xap_url},s),o.call(this,s,u,{access_binary:o.captrue,access_image_binary:o.captrue,display_media:o.captest(r("moxie/image/image")),do_cors:o.captrue,drag_and_drop:!1,report_upload_progress:o.captrue,resize_image:o.captrue,return_response_headers:function(e){return e&&"client"===d.mode},return_response_type:function(e){return"json"!==e?!0:!!window.json},return_status_code:function(t){return"client"===d.mode||!e.arraydiff(t,[200,404])},select_file:o.captrue,select_multiple:o.captrue,send_binary_string:o.captrue,send_browser_cookies:function(e){return e&&"browser"===d.mode},send_custom_headers:function(e){return e&&"client"===d.mode},send_multipart:o.captrue,slice_blob:o.captrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:o.captrue,use_http_method:function(t){return"client"===d.mode||!e.arraydiff(t,["get","post"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arraydiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arraydiff(t,["get","post"])?"client":["client","browser"]}}),a("2.0.31005.0")&&"opera"!==t.browser||(this.mode=!1),e.extend(this,{getshim:function(){return i.get(this.uid).content.moxie},shimexec:function(e,t){var i=[].slice.call(arguments,2);return d.getshim().exec(this.uid,e,t,i)},init:function(){var e;e=this.getshimcontainer(),e.innerhtml=''+''+''+''+''+''+"",l=settimeout(function(){d&&!d.initialized&&d.trigger("error",new n.runtimeerror(n.runtimeerror.not_init_err))},"windows"!==t.os?1e4:5e3)},destroy:function(e){return function(){e.call(d),cleartimeout(l),s=l=e=d=null}}(this.destroy)},c)}var u="silverlight",c={};return o.addconstructor(u,s),c}),n("moxie/runtime/silverlight/file/blob",["moxie/runtime/silverlight/runtime","moxie/core/utils/basic","moxie/runtime/flash/file/blob"],function(e,t,i){return e.blob=t.extend({},i)}),n("moxie/runtime/silverlight/file/fileinput",["moxie/runtime/silverlight/runtime","moxie/file/file","moxie/core/utils/dom","moxie/core/utils/basic"],function(e,t,i,n){function r(e){for(var t="",i=0;ii;i++)t=s.keys[i],a=s[t],a&&(/^(\d|[1-9]\d+)$/.test(a)?a=parseint(a,10):/^\d*\.\d+$/.test(a)&&(a=parsefloat(a)),r.meta[e][t]=a)}),r.meta&&r.meta.thumb&&r.meta.thumb.data&&!(e.meta.thumb.data instanceof i)&&(r.meta.thumb.data=new i(e.uid,r.meta.thumb.data))),r.width=parseint(o.width,10),r.height=parseint(o.height,10),r.size=parseint(o.size,10),r.type=o.type,r.name=o.name,r},resize:function(e,t,i){this.getruntime().shimexec.call(this,"image","resize",e.x,e.y,e.width,e.height,t,i.preserveheaders,i.resample)}})}),n("moxie/runtime/html4/runtime",["moxie/core/utils/basic","moxie/core/exceptions","moxie/runtime/runtime","moxie/core/utils/env"],function(e,t,i,n){function o(t){var o=this,u=i.captest,c=i.captrue;i.call(this,t,a,{access_binary:u(window.filereader||window.file&&file.getasdataurl),access_image_binary:!1,display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/image")),do_cors:!1,drag_and_drop:!1,filter_by_extension:u(function(){return!("chrome"===n.browser&&n.vercomp(n.version,28,"<")||"ie"===n.browser&&n.vercomp(n.version,10,"<")||"safari"===n.browser&&n.vercomp(n.version,7,"<")||"firefox"===n.browser&&n.vercomp(n.version,37,"<"))}()),resize_image:function(){return s.image&&o.can("access_binary")&&n.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.json?!0:!!~e.inarray(t,["text","document",""])},return_status_code:function(t){return!e.arraydiff(t,[200,404])},select_file:function(){return n.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return o.can("select_file")},summon_file_dialog:function(){return o.can("select_file")&&!("firefox"===n.browser&&n.vercomp(n.version,4,"<")||"opera"===n.browser&&n.vercomp(n.version,12,"<")||"ie"===n.browser&&n.vercomp(n.version,10,"<"))},upload_filesize:c,use_http_method:function(t){return!e.arraydiff(t,["get","post"])}}),e.extend(this,{init:function(){this.trigger("init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getshim(),s)}var a="html4",s={};return i.addconstructor(a,o),s}),n("moxie/runtime/html4/file/fileinput",["moxie/runtime/html4/runtime","moxie/file/file","moxie/core/utils/basic","moxie/core/utils/dom","moxie/core/utils/events","moxie/core/utils/mime","moxie/core/utils/env"],function(e,t,i,n,r,o,a){function s(){function e(){var o,c,d,m,h,f,p=this,g=p.getruntime();f=i.guid("uid_"),o=g.getshimcontainer(),s&&(d=n.get(s+"_form"),d&&(i.extend(d.style,{top:"100%"}),d.firstchild.setattribute("tabindex",-1))),m=document.createelement("form"),m.setattribute("id",f+"_form"),m.setattribute("method","post"),m.setattribute("enctype","multipart/form-data"),m.setattribute("encoding","multipart/form-data"),i.extend(m.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),h=document.createelement("input"),h.setattribute("id",f),h.setattribute("type","file"),h.setattribute("accept",l.join(",")),g.can("summon_file_dialog")&&h.setattribute("tabindex",-1),i.extend(h.style,{fontsize:"999px",opacity:0}),m.appendchild(h),o.appendchild(m),i.extend(h.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"ie"===a.browser&&a.vercomp(a.version,10,"<")&&i.extend(h.style,{filter:"progid:dximagetransform.microsoft.alpha(opacity=0)"}),h.onchange=function(){var i;this.value&&(i=this.files?this.files[0]:{name:this.value},i=new t(g.uid,i),this.onchange=function(){},e.call(p),p.files=[i],h.setattribute("id",i.uid),m.setattribute("id",i.uid+"_form"),p.trigger("change"),h=m=null)},g.can("summon_file_dialog")&&(c=n.get(u.browse_button),r.removeevent(c,"click",p.uid),r.addevent(c,"click",function(e){h&&!h.disabled&&h.click(),e.preventdefault()},p.uid)),s=f,o=d=c=null}var s,u,c,l=[];i.extend(this,{init:function(t){var i,a=this,s=a.getruntime();u=t,l=o.extlist2mimes(t.accept,s.can("filter_by_extension")),i=s.getshimcontainer(),function(){var e,o,l;e=n.get(t.browse_button),c=n.getstyle(e,"z-index")||"auto",s.can("summon_file_dialog")?("static"===n.getstyle(e,"position")&&(e.style.position="relative"),a.bind("refresh",function(){o=parseint(c,10)||1,n.get(u.browse_button).style.zindex=o,this.getruntime().getshimcontainer().style.zindex=o-1})):e.setattribute("tabindex",-1),l=s.can("summon_file_dialog")?e:i,r.addevent(l,"mouseover",function(){a.trigger("mouseenter")},a.uid),r.addevent(l,"mouseout",function(){a.trigger("mouseleave")},a.uid),r.addevent(l,"mousedown",function(){a.trigger("mousedown")},a.uid),r.addevent(n.get(t.container),"mouseup",function(){a.trigger("mouseup")},a.uid),e=null}(),e.call(this),i=null,a.trigger({type:"ready",async:!0})},setoption:function(e,t){var i,r=this.getruntime();"accept"==e&&(l=t.mimes||o.extlist2mimes(t,r.can("filter_by_extension"))),i=n.get(s),i&&i.setattribute("accept",l.join(","))},disable:function(e){var t;(t=n.get(s))&&(t.disabled=!!e)},destroy:function(){var e=this.getruntime(),t=e.getshim(),i=e.getshimcontainer(),o=u&&n.get(u.container),a=u&&n.get(u.browse_button);o&&r.removeallevents(o,this.uid),a&&(r.removeallevents(a,this.uid),a.style.zindex=c),i&&(r.removeallevents(i,this.uid),i.innerhtml=""),t.removeinstance(this.uid),s=l=u=i=o=a=t=null}})}return e.fileinput=s}),n("moxie/runtime/html4/file/filereader",["moxie/runtime/html4/runtime","moxie/runtime/html5/file/filereader"],function(e,t){return e.filereader=t}),n("moxie/runtime/html4/xhr/xmlhttprequest",["moxie/runtime/html4/runtime","moxie/core/utils/basic","moxie/core/utils/dom","moxie/core/utils/url","moxie/core/exceptions","moxie/core/utils/events","moxie/file/blob","moxie/xhr/formdata"],function(e,t,i,n,r,o,a,s){function u(){function e(e){var t,n,r,a,s=this,u=!1;if(l){if(t=l.id.replace(/_iframe$/,""),n=i.get(t+"_form")){for(r=n.getelementsbytagname("input"),a=r.length;a--;)switch(r[a].getattribute("type")){case"hidden":r[a].parentnode.removechild(r[a]);break;case"file":u=!0}r=[],u||n.parentnode.removechild(n),n=null}settimeout(function(){o.removeevent(l,"load",s.uid),l.parentnode&&l.parentnode.removechild(l);var t=s.getruntime().getshimcontainer();t.children.length||t.parentnode.removechild(t),t=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,m){function h(){var i=w.getshimcontainer()||document.body,r=document.createelement("div");r.innerhtml='',l=r.firstchild,i.appendchild(l),o.addevent(l,"load",function(){var i;try{i=l.contentwindow.document||l.contentdocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(i.title)?u=i.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(i.body.innerhtml),v.trigger({type:"progress",loaded:c.length,total:c.length}),x&&v.trigger({type:"uploadprogress",loaded:x.size||1025,total:x.size||1025}))}catch(r){if(!n.hassameorigin(d.url))return e.call(v,function(){v.trigger("error")}),void 0;u=404}e.call(v,function(){v.trigger("load")})},v.uid)}var f,p,g,x,v=this,w=v.getruntime();if(u=c=null,m instanceof s&&m.hasblob()){if(x=m.getblob(),f=x.uid,g=i.get(f),p=i.get(f+"_form"),!p)throw new r.domexception(r.domexception.not_found_err)}else f=t.guid("uid_"),p=document.createelement("form"),p.setattribute("id",f+"_form"),p.setattribute("method",d.method),p.setattribute("enctype","multipart/form-data"),p.setattribute("encoding","multipart/form-data"),w.getshimcontainer().appendchild(p);p.setattribute("target",f+"_iframe"),m instanceof s&&m.each(function(e,i){if(e instanceof a)g&&g.setattribute("name",i);else{var n=document.createelement("input");t.extend(n,{type:"hidden",name:i,value:e}),g?p.insertbefore(n,g):p.appendchild(n)}}),p.setattribute("action",d.url),h(),p.submit(),v.trigger("loadstart")},getstatus:function(){return u},getresponse:function(e){if("json"===e&&"string"===t.typeof(c)&&window.json)try{return json.parse(c.replace(/^\s*]*>/,"").replace(/<\/pre>\s*$/,""))}catch(i){return null}return c},abort:function(){var t=this;l&&l.contentwindow&&(l.contentwindow.stop?l.contentwindow.stop():l.contentwindow.document.execcommand?l.contentwindow.document.execcommand("stop"):l.src="about:blank"),e.call(this,function(){t.dispatchevent("abort")})},destroy:function(){this.getruntime().getshim().removeinstance(this.uid)}})}return e.xmlhttprequest=u}),n("moxie/runtime/html4/image/image",["moxie/runtime/html4/runtime","moxie/runtime/html5/image/image"],function(e,t){return e.image=t}),a(["moxie/core/utils/basic","moxie/core/utils/encode","moxie/core/utils/env","moxie/core/exceptions","moxie/core/utils/dom","moxie/core/eventtarget","moxie/runtime/runtime","moxie/runtime/runtimeclient","moxie/file/blob","moxie/core/i18n","moxie/core/utils/mime","moxie/file/fileinput","moxie/file/file","moxie/file/filedrop","moxie/file/filereader","moxie/core/utils/url","moxie/runtime/runtimetarget","moxie/xhr/formdata","moxie/xhr/xmlhttprequest","moxie/image/image","moxie/core/utils/events","moxie/runtime/html5/image/resizercanvas"])}(this)}); /** * plupload - multi-runtime file uploader * v2.3.6 * * copyright 2013, moxiecode systems ab * released under gpl license. * * license: http://www.plupload.com/license * contributing: http://www.plupload.com/contributing * * date: 2017-11-03 */ !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.plupload};"function"==typeof define&&define.amd?define("plupload",["./moxie"],i):"object"==typeof module&&module.exports?module.exports=i(require("./moxie")):e.plupload=i(e.moxie)}(this||window,function(e){!function(e,t,i){function n(e){function t(e,t,i){var r={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",cansendbinary:"send_binary",triggerdialog:"summon_file_dialog"};r[e]?n[r[e]]=t:i||(n[e]=t)}var i=e.required_features,n={};return"string"==typeof i?l.each(i.split(/\s*,\s*/),function(e){t(e,!0)}):"object"==typeof i?l.each(i,function(e,i){t(i,e)}):i===!0&&(e.chunk_size&&e.chunk_size>0&&(n.slice_blob=!0),l.isemptyobj(e.resize)&&e.multipart!==!1||(n.send_binary_string=!0),e.http_method&&(n.use_http_method=e.http_method),l.each(e,function(e,i){t(i,!!e,!0)})),n}var r=window.settimeout,s={},a=t.core.utils,o=t.runtime.runtime,l={version:"2.3.6",stopped:1,started:2,queued:1,uploading:2,failed:4,done:5,generic_error:-100,http_error:-200,io_error:-300,security_error:-400,init_error:-500,file_size_error:-600,file_extension_error:-601,file_duplicate_error:-602,image_format_error:-700,memory_error:-701,image_dimensions_error:-702,moxie:t,mimetypes:a.mime.mimes,ua:a.env,typeof:a.basic.typeof,extend:a.basic.extend,guid:a.basic.guid,getall:function(e){var t,i=[];"array"!==l.typeof(e)&&(e=[e]);for(var n=e.length;n--;)t=l.get(e[n]),t&&i.push(t);return i.length?i:null},get:a.dom.get,each:a.basic.each,getpos:a.dom.getpos,getsize:a.dom.getsize,xmlencode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g;return e?(""+e).replace(i,function(e){return t[e]?"&"+t[e]+";":e}):e},toarray:a.basic.toarray,inarray:a.basic.inarray,inseries:a.basic.inseries,addi18n:t.core.i18n.addi18n,translate:t.core.i18n.translate,sprintf:a.basic.sprintf,isemptyobj:a.basic.isemptyobj,hasclass:a.dom.hasclass,addclass:a.dom.addclass,removeclass:a.dom.removeclass,getstyle:a.dom.getstyle,addevent:a.events.addevent,removeevent:a.events.removeevent,removeallevents:a.events.removeallevents,cleanname:function(e){var t,i;for(i=[/[\300-\306]/g,"a",/[\340-\346]/g,"a",/\307/g,"c",/\347/g,"c",/[\310-\313]/g,"e",/[\350-\353]/g,"e",/[\314-\317]/g,"i",/[\354-\357]/g,"i",/\321/g,"n",/\361/g,"n",/[\322-\330]/g,"o",/[\362-\370]/g,"o",/[\331-\334]/g,"u",/[\371-\374]/g,"u"],t=0;t0?"&":"?")+i),e},formatsize:function(e){function t(e,t){return math.round(e*math.pow(10,t))/math.pow(10,t)}if(e===i||/\d/.test(e))return l.translate("n/a");var n=math.pow(1024,4);return e>n?t(e/n,1)+" "+l.translate("tb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("gb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("mb"):e>1024?math.round(e/1024)+" "+l.translate("kb"):e+" "+l.translate("b")},parsesize:a.basic.parsesizestr,predictruntime:function(e,t){var i,n;return i=new l.uploader(e),n=o.thatcan(i.getoption().required_features,t||e.runtimes),i.destroy(),n},addfilefilter:function(e,t){s[e]=t}};l.addfilefilter("mime_types",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger("error",{code:l.file_extension_error,message:l.translate("file extension error."),file:t}),i(!1)):i(!0)}),l.addfilefilter("max_file_size",function(e,t,i){var n;e=l.parsesize(e),t.size!==n&&e&&t.size>e?(this.trigger("error",{code:l.file_size_error,message:l.translate("file size error."),file:t}),i(!1)):i(!0)}),l.addfilefilter("prevent_duplicates",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger("error",{code:l.file_duplicate_error,message:l.translate("duplicate file error."),file:t}),i(!1),void 0;i(!0)}),l.addfilefilter("prevent_empty",function(e,t,n){e&&!t.size&&t.size!==i?(this.trigger("error",{code:l.file_size_error,message:l.translate("file size error."),file:t}),n(!1)):n(!0)}),l.uploader=function(e){function a(){var e,t,i=0;if(this.state==l.started){for(t=0;t0?math.ceil(100*(e.loaded/e.size)):100,d()}function d(){var e,t,n,r=0;for(i.reset(),e=0;es)&&(r+=n),i.loaded+=n):i.size=i,t.status==l.done?i.uploaded++:t.status==l.failed?i.failed++:i.queued++;i.size===i?i.percent=d.length>0?math.ceil(100*(i.uploaded/d.length)):0:(i.bytespersec=math.ceil(r/((+new date-s||1)/1e3)),i.percent=i.size>0?math.ceil(100*(i.loaded/i.size)):0)}function c(){var e=f[0]||p[0];return e?e.getruntime().uid:!1}function f(){this.bind("filesadded filesremoved",function(e){e.trigger("queuechanged"),e.refresh()}),this.bind("cancelupload",b),this.bind("beforeupload",m),this.bind("uploadfile",_),this.bind("uploadprogress",e),this.bind("statechanged",v),this.bind("queuechanged",d),this.bind("error",r),this.bind("fileuploaded",y),this.bind("destroy",z)}function p(e,i){var n=this,r=0,s=[],a={runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:x,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};l.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(a[t]=e[t])}),e.browse_button&&l.each(e.browse_button,function(i){s.push(function(s){var u=new t.file.fileinput(l.extend({},a,{accept:e.filters.mime_types,name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:i}));u.onready=function(){var e=o.getinfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),r++,f.push(this),s()},u.onchange=function(){n.addfile(this.files)},u.bind("mouseenter mouseleave mousedown mouseup",function(t){u||(e.browse_button_hover&&("mouseenter"===t.type?l.addclass(i,e.browse_button_hover):"mouseleave"===t.type&&l.removeclass(i,e.browse_button_hover)),e.browse_button_active&&("mousedown"===t.type?l.addclass(i,e.browse_button_active):"mouseup"===t.type&&l.removeclass(i,e.browse_button_active)))}),u.bind("mousedown",function(){n.trigger("browse")}),u.bind("error runtimeerror",function(){u=null,s()}),u.init()})}),e.drop_element&&l.each(e.drop_element,function(e){s.push(function(i){var s=new t.file.filedrop(l.extend({},a,{drop_zone:e}));s.onready=function(){var e=o.getinfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),dragdrop:e.can("drag_and_drop")}),r++,p.push(this),i()},s.ondrop=function(){n.addfile(this.files)},s.bind("error runtimeerror",function(){s=null,i()}),s.init()})}),l.inseries(s,function(){"function"==typeof i&&i(r)})}function g(e,n,r,s){var a=new t.image.image;try{a.onload=function(){n.width>this.width&&n.height>this.height&&n.quality===i&&n.preserve_headers&&!n.crop?(this.destroy(),s(e)):a.downsize(n.width,n.height,n.crop,n.preserve_headers)},a.onresize=function(){var t=this.getasblob(e.type,n.quality);this.destroy(),s(t)},a.bind("error runtimeerror",function(){this.destroy(),s(e)}),a.load(e,r)}catch(o){s(e)}}function h(e,i,r){function s(e,i,n){var r=o[e];switch(e){case"max_file_size":"max_file_size"===e&&(o.max_file_size=o.filters.max_file_size=i);break;case"chunk_size":(i=l.parsesize(i))&&(o[e]=i,o.send_file_name=!0);break;case"multipart":o[e]=i,i||(o.send_file_name=!0);break;case"http_method":o[e]="put"===i.touppercase()?"put":"post";break;case"unique_names":o[e]=i,i&&(o.send_file_name=!0);break;case"filters":"array"===l.typeof(i)&&(i={mime_types:i}),n?l.extend(o.filters,i):o.filters=i,i.mime_types&&("string"===l.typeof(i.mime_types)&&(i.mime_types=t.core.utils.mime.mimes2extlist(i.mime_types)),i.mime_types.regexp=function(e){var t=[];return l.each(e,function(e){l.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new regexp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new regexp("("+t.join("|")+")$","i")}(i.mime_types),o.filters.mime_types=i.mime_types);break;case"resize":o.resize=i?l.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":o.prevent_duplicates=o.filters.prevent_duplicates=!!i;break;case"container":case"browse_button":case"drop_element":i="container"===e?l.get(i):l.getall(i);case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":o[e]=i,n||(u=!0);break;default:o[e]=i}n||a.trigger("optionchanged",e,i,r)}var a=this,u=!1;"object"==typeof e?l.each(e,function(e,t){s(t,e,r)}):s(e,i,r),r?(o.required_features=n(l.extend({},o)),x=n(l.extend({},o,{required_features:!0}))):u&&(a.trigger("destroy"),p.call(a,o,function(e){e?(a.runtime=o.getinfo(c()).type,a.trigger("init",{runtime:a.runtime}),a.trigger("postinit")):a.trigger("error",{code:l.init_error,message:l.translate("init error.")})}))}function m(e,t){if(e.settings.unique_names){var i=t.name.match(/\.([^.]+)$/),n="part";i&&(n=i[1]),t.target_name=t.id+"."+n}}function _(e,i){function n(){c-->0?r(s,1e3):(i.loaded=p,e.trigger("error",{code:l.http_error,message:l.translate("http error."),file:i,response:t.responsetext,status:t.status,responseheaders:t.getallresponseheaders()}))}function s(){var t,n,r={};i.status===l.uploading&&e.state!==l.stopped&&(e.settings.send_file_name&&(r.name=i.target_name||i.name),d&&f.chunks&&o.size>d?(n=math.min(d,o.size-p),t=o.slice(p,p+n)):(n=o.size,t=o),d&&f.chunks&&(e.settings.send_chunk_number?(r.chunk=math.ceil(p/d),r.chunks=math.ceil(o.size/d)):(r.offset=p,r.total=o.size)),e.trigger("beforechunkupload",i,r,t,p)&&a(r,t,n))}function a(a,d,g){var m;t=new t.xhr.xmlhttprequest,t.upload&&(t.upload.onprogress=function(t){i.loaded=math.min(i.size,p+t.loaded),e.trigger("uploadprogress",i)}),t.onload=function(){return t.status<200||t.status>=400?(n(),void 0):(c=e.settings.max_retries,g=o.size?(i.size!=i.origsize&&(o.destroy(),o=null),e.trigger("uploadprogress",i),i.status=l.done,i.completetimestamp=+new date,e.trigger("fileuploaded",i,{response:t.responsetext,status:t.status,responseheaders:t.getallresponseheaders()})):r(s,1),void 0)},t.onerror=function(){n()},t.onloadend=function(){this.destroy()},e.settings.multipart&&f.multipart?(t.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){t.setrequestheader(t,e)}),m=new t.xhr.formdata,l.each(l.extend(a,e.settings.multipart_params),function(e,t){m.append(t,e)}),m.append(e.settings.file_data_name,d),t.send(m,h)):(u=l.buildurl(e.settings.url,l.extend(a,e.settings.multipart_params)),t.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){t.setrequestheader(t,e)}),t.hasrequestheader("content-type")||t.setrequestheader("content-type","application/octet-stream"),t.send(d,h))}var o,u=e.settings.url,d=e.settings.chunk_size,c=e.settings.max_retries,f=e.features,p=0,h={runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:x,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url};i.loaded&&(p=i.loaded=d?d*math.floor(i.loaded/d):0),o=i.getsource(),l.isemptyobj(e.settings.resize)||-1===l.inarray(o.type,["image/jpeg","image/png"])?s():g(o,e.settings.resize,h,function(e){o=e,i.size=e.size,s()})}function e(e,t){u(t)}function v(e){if(e.state==l.started)s=+new date;else if(e.state==l.stopped)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==l.uploading&&(e.files[t].status=l.queued,d())}function b(){t&&t.abort()}function y(e){d(),r(function(){a.call(e)},1)}function r(e,t){t.code===l.init_error?e.destroy():t.code===l.http_error&&(t.file.status=l.failed,t.file.completetimestamp=+new date,u(t.file),e.state==l.started&&(e.trigger("cancelupload"),r(function(){a.call(e)},1)))}function z(e){e.stop(),l.each(d,function(e){e.destroy()}),d=[],f.length&&(l.each(f,function(e){e.destroy()}),f=[]),p.length&&(l.each(p,function(e){e.destroy()}),p=[]),x={},u=!1,s=t=null,i.reset()}var o,s,i,t,w=l.guid(),d=[],x={},f=[],p=[],u=!1;o={chunk_size:0,file_data_name:"file",filters:{mime_types:[],max_file_size:0,prevent_duplicates:!1,prevent_empty:!0},flash_swf_url:"js/moxie.swf",http_method:"post",max_retries:0,multipart:!0,multi_selection:!0,resize:!1,runtimes:o.order,send_file_name:!0,send_chunk_number:!0,silverlight_xap_url:"js/moxie.xap"},h.call(this,e,null,!0),i=new l.queueprogress,l.extend(this,{id:w,uid:w,state:l.stopped,features:{},runtime:null,files:d,settings:o,total:i,init:function(){var e,t,i=this;return e=i.getoption("preinit"),"function"==typeof e?e(i):l.each(e,function(e,t){i.bind(t,e)}),f.call(i),l.each(["container","browse_button","drop_element"],function(e){return null===i.getoption(e)?(t={code:l.init_error,message:l.sprintf(l.translate("%s specified, but cannot be found."),e)},!1):void 0}),t?i.trigger("error",t):o.browse_button||o.drop_element?(p.call(i,o,function(e){var t=i.getoption("init");"function"==typeof t?t(i):l.each(t,function(e,t){i.bind(t,e)}),e?(i.runtime=o.getinfo(c()).type,i.trigger("init",{runtime:i.runtime}),i.trigger("postinit")):i.trigger("error",{code:l.init_error,message:l.translate("init error.")})}),void 0):i.trigger("error",{code:l.init_error,message:l.translate("you must specify either browse_button or drop_element.")})},setoption:function(e,t){h.call(this,e,t,!this.runtime)},getoption:function(e){return e?o[e]:o},refresh:function(){f.length&&l.each(f,function(e){e.trigger("refresh")}),this.trigger("refresh")},start:function(){this.state!=l.started&&(this.state=l.started,this.trigger("statechanged"),a.call(this))},stop:function(){this.state!=l.stopped&&(this.state=l.stopped,this.trigger("statechanged"),this.trigger("cancelupload"))},disablebrowse:function(){u=arguments[0]!==i?arguments[0]:!0,f.length&&l.each(f,function(e){e.disable(u)}),this.trigger("disablebrowse",u)},getfile:function(e){var t;for(t=d.length-1;t>=0;t--)if(d[t].id===e)return d[t]},addfile:function(e,i){function n(e,t){var i=[];l.each(u.settings.filters,function(t,n){s[n]&&i.push(function(i){s[n].call(u,t,e,function(e){i(!e)})})}),l.inseries(i,t)}function a(e){var s=l.typeof(e);if(e instanceof t.file.file){if(!e.ruid&&!e.isdetached()){if(!o)return!1;e.ruid=o,e.connectruntime(o)}a(new l.file(e))}else e instanceof t.file.blob?(a(e.getsource()),e.destroy()):e instanceof l.file?(i&&(e.name=i),d.push(function(t){n(e,function(i){i||(d.push(e),f.push(e),u.trigger("filefiltered",e)),r(t,1)})})):-1!==l.inarray(s,["file","blob"])?a(new t.file.file(null,e)):"node"===s&&"filelist"===l.typeof(e.files)?l.each(e.files,a):"array"===s&&(i=null,l.each(e,a))}var o,u=this,d=[],f=[];o=c(),a(e),d.length&&l.inseries(d,function(){f.length&&u.trigger("filesadded",f)})},removefile:function(e){for(var t="string"==typeof e?e:e.id,i=d.length-1;i>=0;i--)if(d[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=d.splice(e===i?0:e,t===i?d.length:t),r=!1;return this.state==l.started&&(l.each(n,function(e){return e.status===l.uploading?(r=!0,!1):void 0}),r&&this.stop()),this.trigger("filesremoved",n),l.each(n,function(e){e.destroy()}),r&&this.start(),n},dispatchevent:function(e){var t,i;if(e=e.tolowercase(),t=this.haseventlistener(e)){t.sort(function(e,t){return t.priority-e.priority}),i=[].slice.call(arguments),i.shift(),i.unshift(this);for(var n=0;n