(function(n){"use strict";typeof define=="function"&&define.amd?define(["jquery"],n):n(typeof jQuery!="undefined"?jQuery:window.Zepto)})(function(n){"use strict";function u(t){var i=t.data;t.isDefaultPrevented()||(t.preventDefault(),n(t.target).ajaxSubmit(i))}function f(t){var r=t.target,u=n(r),f,i,e;if(!u.is("[type=submit],[type=image]")){if(f=u.closest("[type=submit]"),f.length===0)return;r=f[0]}i=this,i.clk=r,r.type=="image"&&(t.offsetX!==undefined?(i.clk_x=t.offsetX,i.clk_y=t.offsetY):typeof n.fn.offset=="function"?(e=u.offset(),i.clk_x=t.pageX-e.left,i.clk_y=t.pageY-e.top):(i.clk_x=t.pageX-r.offsetLeft,i.clk_y=t.pageY-r.offsetTop)),setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}function t(){if(n.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var i={},r;i.fileapi=n("").get(0).files!==undefined,i.formdata=window.FormData!==undefined,r=!!n.fn.prop,n.fn.attr2=function(){if(!r)return this.attr.apply(this,arguments);var n=this.prop.apply(this,arguments);return n&&n.jquery||typeof n=="string"?n:this.attr.apply(this,arguments)},n.fn.ajaxSubmit=function(u){function ot(t){for(var r=n.param(t,u.traditional).split("&"),o=r.length,e=[],f,i=0;i').val(o.extraData[i].value).appendTo(l)[0]):r.push(n('').val(o.extraData[i]).appendTo(l)[0]));o.iframeTarget||v.appendTo("body"),a.attachEvent?a.attachEvent("onload",b):a.addEventListener("load",b,!1),setTimeout(h,15);try{l.submit()}catch(w){c=document.createElement("form").submit,c.apply(l)}}finally{l.setAttribute("action",s),l.setAttribute("enctype",p),u?l.setAttribute("target",u):f.removeAttr("target"),n(r).remove()}}function b(i){var r,u,w,f,k,d,e,c,l;if(!s.aborted&&!lt){if(h=ot(a),h||(t("cannot access response document"),i=tt),i===ut&&s){s.abort("timeout"),y.reject(s,"timeout");return}if(i==tt&&s){s.abort("server abort"),y.reject(s,"error","server abort");return}if(h&&h.location.href!=o.iframeSrc||rt){a.detachEvent?a.detachEvent("onload",b):a.removeEventListener("load",b,!1),r="success";try{if(rt)throw"timeout";if(w=o.dataType=="xml"||h.XMLDocument||n.isXMLDoc(h),t("isXml="+w),!w&&window.opera&&(h.body===null||!h.body.innerHTML)&&--ct){t("requeing onLoad callback, DOM not available"),setTimeout(b,250);return}f=h.body?h.body:h.documentElement,s.responseText=f?f.innerHTML:null,s.responseXML=h.XMLDocument?h.XMLDocument:h,w&&(o.dataType="xml"),s.getResponseHeader=function(n){var t={"content-type":o.dataType};return t[n.toLowerCase()]},f&&(s.status=Number(f.getAttribute("status"))||s.status,s.statusText=f.getAttribute("statusText")||s.statusText),k=(o.dataType||"").toLowerCase(),d=/(json|script|text)/.test(k),d||o.textarea?(e=h.getElementsByTagName("textarea")[0],e?(s.responseText=e.value,s.status=Number(e.getAttribute("status"))||s.status,s.statusText=e.getAttribute("statusText")||s.statusText):d&&(c=h.getElementsByTagName("pre")[0],l=h.getElementsByTagName("body")[0],c?s.responseText=c.textContent?c.textContent:c.innerText:l&&(s.responseText=l.textContent?l.textContent:l.innerText))):k=="xml"&&!s.responseXML&&s.responseText&&(s.responseXML=at(s.responseText));try{ht=yt(s,k,o)}catch(nt){r="parsererror",s.error=u=nt||r}}catch(nt){t("error caught: ",nt),r="error",s.error=u=nt||r}s.aborted&&(t("upload aborted"),r=null),s.status&&(r=s.status>=200&&s.status<300||s.status===304?"success":"error"),r==="success"?(o.success&&o.success.call(o.context,ht,"success",s),y.resolve(s.responseText,"success",s),p&&n.event.trigger("ajaxSuccess",[s,o])):r&&(u===undefined&&(u=s.statusText),o.error&&o.error.call(o.context,s,r,u),y.reject(s,"error",u),p&&n.event.trigger("ajaxError",[s,o,u])),p&&n.event.trigger("ajaxComplete",[s,o]),p&&!--n.active&&n.event.trigger("ajaxStop"),o.complete&&o.complete.call(o.context,s,r),lt=!0,o.timeout&&clearTimeout(g),setTimeout(function(){o.iframeTarget?v.attr("src",o.iframeSrc):v.remove(),s.responseXML=null},100)}}}var l=f[0],it,nt,o,p,d,v,a,s,k,w,rt,g,y=n.Deferred(),ut,tt,ft,et,ht,h,ct,lt;if(y.abort=function(n){s.abort(n)},i)for(nt=0;nt'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),a=v[0],s={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(i){var r=i==="timeout"?"timeout":"aborted";t("aborting upload... "+r),this.aborted=1;try{a.contentWindow.document.execCommand&&a.contentWindow.document.execCommand("Stop")}catch(u){}v.attr("src",o.iframeSrc),s.error=r,o.error&&o.error.call(o.context,s,r,i),p&&n.event.trigger("ajaxError",[s,o,r]),o.complete&&o.complete.call(o.context,s,r)}},p=o.global,p&&0==n.active++&&n.event.trigger("ajaxStart"),p&&n.event.trigger("ajaxSend",[s,o]),o.beforeSend&&o.beforeSend.call(o.context,s,o)===!1)return o.global&&n.active--,y.reject(),y;if(s.aborted)return y.reject(),y;k=l.clk,k&&(w=k.name,w&&!k.disabled&&(o.extraData=o.extraData||{},o.extraData[w]=k.value,k.type=="image"&&(o.extraData[w+".x"]=l.clk_x,o.extraData[w+".y"]=l.clk_y))),ut=1,tt=2,ft=n("meta[name=csrf-token]").attr("content"),et=n("meta[name=csrf-param]").attr("content"),et&&ft&&(o.extraData=o.extraData||{},o.extraData[et]=ft),o.forceSync?st():setTimeout(st,10),ct=50;var at=n.parseXML||function(n,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(n)):t=(new DOMParser).parseFromString(n,"text/xml"),t&&t.documentElement&&t.documentElement.nodeName!="parsererror"?t:null},vt=n.parseJSON||function(s){return window.eval("("+s+")")},yt=function(t,i,r){var f=t.getResponseHeader("content-type")||"",e=i==="xml"||!i&&f.indexOf("xml")>=0,u=e?t.responseXML:t.responseText;return e&&u.documentElement.nodeName==="parsererror"&&n.error&&n.error("parsererror"),r&&r.dataFilter&&(u=r.dataFilter(u,i)),typeof u=="string"&&(i==="json"||!i&&f.indexOf("json")>=0?u=vt(u):(i==="script"||!i&&f.indexOf("javascript")>=0)&&n.globalEval(u)),u};return y}var e,b,o,f,a,v,c,p,s,l,h,d,g,nt,ut,y,w;if(!this.length)return t("ajaxSubmit: skipping submit process - no element selected"),this;if(f=this,typeof u=="function"?u={success:u}:u===undefined&&(u={}),e=u.type||this.attr2("method"),b=u.url||this.attr2("action"),o=typeof b=="string"?n.trim(b):"",o=o||window.location.href||"",o&&(o=(o.match(/^([^#]+)/)||[])[1]),u=n.extend(!0,{url:o,success:n.ajaxSettings.success,type:e||n.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},u),a={},this.trigger("form-pre-serialize",[this,u,a]),a.veto)return t("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(u.beforeSerialize&&u.beforeSerialize(this,u)===!1)return t("ajaxSubmit: submit aborted via beforeSerialize callback"),this;if(v=u.traditional,v===undefined&&(v=n.ajaxSettings.traditional),c=[],s=this.formToArray(u.semantic,c),u.data&&(u.extraData=u.data,p=n.param(u.data,v)),u.beforeSubmit&&u.beforeSubmit(s,this,u)===!1)return t("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[s,this,u,a]),a.veto)return t("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;l=n.param(s,v),p&&(l=l?l+"&"+p:p),u.type.toUpperCase()=="GET"?(u.url+=(u.url.indexOf("?")>=0?"&":"?")+l,u.data=null):u.data=l,h=[],u.resetForm&&h.push(function(){f.resetForm()}),u.clearForm&&h.push(function(){f.clearForm(u.includeHidden)}),!u.dataType&&u.target?(d=u.success||function(){},h.push(function(t){var i=u.replaceTarget?"replaceWith":"html";n(u.target)[i](t).each(d,arguments)})):u.success&&h.push(u.success),u.success=function(n,t,i){for(var o=u.context||this,r=0,e=h.length;r0,it="multipart/form-data",rt=f.attr("enctype")==it||f.attr("encoding")==it,k=i.fileapi&&i.formdata;for(t("fileAPI :"+k),ut=(tt||rt)&&!k,u.iframe!==!1&&(u.iframe||ut)?u.closeKeepAlive?n.get(u.closeKeepAlive,function(){y=ft(s)}):y=ft(s):y=(tt||rt)&&k?st(s):n.ajax(u),f.removeData("jqxhr").data("jqxhr",y),w=0;w