//>>built
define("dojox/rails",["dijit","dojo","dojox","dojo/require!dojo/NodeList-traverse"],function(A,d,t){d.provide("dojox.rails");d.require("dojo.NodeList-traverse");t.rails.live=function(b,m,n){d.isIE&&m.match(/^(on)?submit$/i)?t.rails.live(b,"click",function(e){e=e.target;var f=e.tagName.toLowerCase();if(("input"==f||"button"==f)&&"submit"==d.attr(e,"type").toLowerCase()&&(e=d.query(e).closest("form"),e.length))var u=d.connect(e[0],"submit",function(p){d.disconnect(u);n.call(p.target,p)})}):d.connect(d.body(),
m,function(e){var f=d.query(e.target).closest(b);f.length&&n.call(f[0],e)})};d.ready(function(b,m,n){return function(){var e=b.query,f=m.live,u=e("meta[name\x3dcsrf-token]").attr("content"),p=e("meta[name\x3dcsrf-param]").attr("content"),w=function(c,a){return d.place('\x3cform style\x3d"display:none" method\x3d"post" action\x3d"'+c+'"\x3e\x3cinput type\x3d"hidden" name\x3d"_method" value\x3d"'+a+'" /\x3e\x3cinput type\x3d"hidden" name\x3d"'+p+'" value\x3d"'+u+'" /\x3e\x3c/form\x3e',d.body())},y=
function(c){b.forEach(c,function(a){if(!b.attr(a,"disabled")){var g="input"==a.tagName.toLowerCase()?"value":"innerHTML",h=b.attr(a,"data-disable-with"),q=b.attr(a,g);b.attr(a,"disabled",!0);b.attr(a,"data-original-value",q);b.attr(a,g,h)}})},z={text:"text",json:"application/json","json-comment-optional":"text","json-comment-filtered":"text",javascript:"application/javascript",xml:"text/xml"},v=function(c){var a=c.target,g=a.tagName.toLowerCase(),h="form"==g.toLowerCase()?b.formToObject(a):{},q=b.attr(a,
"data-type")||"javascript",r=(b.attr(a,"method")||b.attr(a,"data-method")||"get").toLowerCase(),x=b.attr(a,"action")||b.attr(a,"href");"form"!=g&&"get"!=r&&(a=w(x,r),r="POST");c.preventDefault();b.publish("ajax:before",[a]);b.xhr(r,{url:x,headers:{Accept:z[q]},content:h,handleAs:q,load:function(k,l){b.publish("ajax:success",[a,k,l])},error:function(k,l){b.publish("ajax:failure",[a,k,l])},handle:function(k,l){b.publish("ajax:complete",[a,k,l])}});b.publish("ajax:after",[a])};f("*[data-confirm]","click",
function(c){n.confirm(b.attr(c.target,"data-confirm"))?b.attr(c.target,"data-remote")&&v(c):c.preventDefault()});b.subscribe("ajax:complete",function(c){e("*[data-disable-with][disabled]",c).forEach(function(a){var g="input"==a.tagName.toLowerCase()?"value":"innerHTML",h=b.attr(a,"data-original-value");b.attr(a,"disabled",!1);b.attr(a,"data-original-value",null);b.attr(a,g,h)})});f("a[data-remote]:not([data-confirm])","click",v);f("a[data-method]:not([data-remote])","click",function(c){var a=c.target;
a=w(a.href,d.attr(a,"data-method"));c.preventDefault();a.submit()});f("form","submit",function(c){var a=c.target,g=e("*[data-disable-with]",a);g.length&&y(g);b.attr(a,"data-remote")&&(c.preventDefault(),v(c))})}}(d,t.rails,d.global))});