").append(lt.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},lt.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){lt.fn[t]=function(e){return this.on(t,e)}}),lt.each(["get","post"],function(e,n){lt[n]=function(e,r,i,o){return lt.isFunction(r)&&(o=o||i,i=r,r=t),lt.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),lt.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Dn,type:"GET",isLocal:Bn.test(Ln[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Xn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":lt.parseJSON,"text xml":lt.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?D(D(e,lt.ajaxSettings),t):D(lt.ajaxSettings,e)},ajaxPrefilter:A(zn),ajaxTransport:A(Wn),ajax:function(e,n){function r(e,n,r,i){var o,p,y,b,w,k=n;2!==x&&(x=2,l&&clearTimeout(l),c=t,s=i||"",T.readyState=e>0?4:0,r&&(b=F(d,T,r)),e>=200&&300>e||304===e?(d.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(lt.lastModified[a]=w),w=T.getResponseHeader("etag"),w&&(lt.etag[a]=w)),204===e?(o=!0,k="nocontent"):304===e?(o=!0,k="notmodified"):(o=H(d,b),k=o.state,p=o.data,y=o.error,o=!y)):(y=k,(e||!k)&&(k="error",0>e&&(e=0))),T.status=e,T.statusText=(n||k)+"",o?m.resolveWith(f,[p,k,T]):m.rejectWith(f,[T,k,y]),T.statusCode(v),v=t,u&&h.trigger(o?"ajaxSuccess":"ajaxError",[T,d,o?p:y]),g.fireWith(f,[T,k]),u&&(h.trigger("ajaxComplete",[T,d]),--lt.active||lt.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=t),n=n||{};var i,o,a,s,l,u,c,p,d=lt.ajaxSetup({},n),f=d.context||d,h=d.context&&(f.nodeType||f.jquery)?lt(f):lt.event,m=lt.Deferred(),g=lt.Callbacks("once memory"),v=d.statusCode||{},y={},b={},x=0,w="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!p)for(p={};t=Mn.exec(s);)p[t[1].toLowerCase()]=t[2];t=p[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=b[n]=b[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)v[t]=[v[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),r(0,t),this}};if(m.promise(T).complete=g.add,T.success=T.done,T.error=T.fail,d.url=((e||d.url||Dn)+"").replace(qn,"").replace(Pn,Ln[1]+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=lt.trim(d.dataType||"*").toLowerCase().match(ct)||[""],null==d.crossDomain&&(i=Rn.exec(d.url.toLowerCase()),d.crossDomain=!(!i||i[1]===Ln[1]&&i[2]===Ln[2]&&(i[3]||("http:"===i[1]?80:443))==(Ln[3]||("http:"===Ln[1]?80:443)))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=lt.param(d.data,d.traditional)),L(zn,d,n,T),2===x)return T;u=d.global,u&&0===lt.active++&<.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!On.test(d.type),a=d.url,d.hasContent||(d.data&&(a=d.url+=(Hn.test(a)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=$n.test(a)?a.replace($n,"$1_="+Fn++):a+(Hn.test(a)?"&":"?")+"_="+Fn++)),d.ifModified&&(lt.lastModified[a]&&T.setRequestHeader("If-Modified-Since",lt.lastModified[a]),lt.etag[a]&&T.setRequestHeader("If-None-Match",lt.etag[a])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&T.setRequestHeader("Content-Type",d.contentType),T.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Xn+"; q=0.01":""):d.accepts["*"]);for(o in d.headers)T.setRequestHeader(o,d.headers[o]);if(d.beforeSend&&(d.beforeSend.call(f,T,d)===!1||2===x))return T.abort();w="abort";for(o in{success:1,error:1,complete:1})T[o](d[o]);if(c=L(Wn,d,n,T)){T.readyState=1,u&&h.trigger("ajaxSend",[T,d]),d.async&&d.timeout>0&&(l=setTimeout(function(){T.abort("timeout")},d.timeout));try{x=1,c.send(y,r)}catch(k){if(!(2>x))throw k;r(-1,k)}}else r(-1,"No Transport");return T},getScript:function(e,n){return lt.get(e,t,n,"script")},getJSON:function(e,t,n){return lt.get(e,t,n,"json")}}),lt.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return lt.globalEval(e),e}}}),lt.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),lt.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=V.head||lt("head")[0]||V.documentElement;return{send:function(t,i){n=V.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Qn=[],Vn=/(=)\?(?=&|$)|\?\?/;lt.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Qn.pop()||lt.expando+"_"+Fn++;return this[e]=!0,e}}),lt.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Vn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=lt.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Vn,"$1"+o):n.jsonp!==!1&&(n.url+=(Hn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||lt.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Qn.push(o)),s&<.isFunction(a)&&a(s[0]),s=a=t}),"script"):void 0});var Yn,Gn,Jn=0,Kn=e.ActiveXObject&&function(){var e;for(e in Yn)Yn[e](t,!0)};lt.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&q()||$()}:q,Gn=lt.ajaxSettings.xhr(),lt.support.cors=!!Gn&&"withCredentials"in Gn,Gn=lt.support.ajax=!!Gn,Gn&<.ajaxTransport(function(n){if(!n.crossDomain||lt.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=lt.noop,Kn&&delete Yn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(d){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(f){i||o(-1,f)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Jn,Kn&&(Yn||(Yn={},lt(e).unload(Kn)),Yn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Zn,er,tr=/^(?:toggle|show|hide)$/,nr=new RegExp("^(?:([+-])=|)("+ut+")([a-z%]*)$","i"),rr=/queueHooks$/,ir=[R],or={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=nr.exec(t),a=i.cur(),s=+a||0,l=1,u=20;if(o){if(n=+o[2],r=o[3]||(lt.cssNumber[e]?"":"px"),"px"!==r&&s){s=lt.css(i.elem,e,!0)||n||1;do l=l||".5",s/=l,lt.style(i.elem,e,s+r);while(l!==(l=i.cur()/a)&&1!==l&&--u)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};lt.Animation=lt.extend(O,{tweener:function(e,t){lt.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;i>r;r++)n=e[r],or[n]=or[n]||[],or[n].unshift(t)},prefilter:function(e,t){t?ir.unshift(e):ir.push(e)}}),lt.Tween=I,I.prototype={constructor:I,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(lt.cssNumber[n]?"":"px")},cur:function(){var e=I.propHooks[this.prop];return e&&e.get?e.get(this):I.propHooks._default.get(this)},run:function(e){var t,n=I.propHooks[this.prop];return this.pos=t=this.options.duration?lt.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):I.propHooks._default.set(this),this}},I.prototype.init.prototype=I.prototype,I.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=lt.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){lt.fx.step[e.prop]?lt.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[lt.cssProps[e.prop]]||lt.cssHooks[e.prop])?lt.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},I.propHooks.scrollTop=I.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},lt.each(["toggle","show","hide"],function(e,t){var n=lt.fn[t];lt.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(z(t,!0),e,r,i)}}),lt.fn.extend({fadeTo:function(e,t,n,r){return this.filter(T).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=lt.isEmptyObject(e),o=lt.speed(t,n,r),a=function(){var t=O(this,lt.extend({},e),o);a.finish=function(){t.stop(!0)},(i||lt._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=lt.timers,a=lt._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&rr.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&<.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=lt._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=lt.timers,a=r?r.length:0;for(n.finish=!0,lt.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),lt.each({slideDown:z("show"),slideUp:z("hide"),slideToggle:z("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){lt.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),lt.speed=function(e,t,n){var r=e&&"object"==typeof e?lt.extend({},e):{complete:n||!n&&t||lt.isFunction(e)&&e,duration:e,easing:n&&t||t&&!lt.isFunction(t)&&t};return r.duration=lt.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in lt.fx.speeds?lt.fx.speeds[r.duration]:lt.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){lt.isFunction(r.old)&&r.old.call(this),r.queue&<.dequeue(this,r.queue)},r},lt.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},lt.timers=[],lt.fx=I.prototype.init,lt.fx.tick=function(){var e,n=lt.timers,r=0;for(Zn=lt.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||lt.fx.stop(),Zn=t},lt.fx.timer=function(e){e()&<.timers.push(e)&<.fx.start()},lt.fx.interval=13,lt.fx.start=function(){er||(er=setInterval(lt.fx.tick,lt.fx.interval))},lt.fx.stop=function(){clearInterval(er),er=null},lt.fx.speeds={slow:600,fast:200,_default:400},lt.fx.step={},lt.expr&<.expr.filters&&(lt.expr.filters.animated=function(e){return lt.grep(lt.timers,function(t){return e===t.elem}).length}),lt.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){lt.offset.setOffset(this,e,t)});var n,r,i={top:0,left:0},o=this[0],a=o&&o.ownerDocument;if(a)return n=a.documentElement,lt.contains(n,o)?(typeof o.getBoundingClientRect!==Q&&(i=o.getBoundingClientRect()),r=W(a),{top:i.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:i.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):i},lt.offset={setOffset:function(e,t,n){var r=lt.css(e,"position");"static"===r&&(e.style.position="relative");var i,o,a=lt(e),s=a.offset(),l=lt.css(e,"top"),u=lt.css(e,"left"),c=("absolute"===r||"fixed"===r)&<.inArray("auto",[l,u])>-1,p={},d={};c?(d=a.position(),i=d.top,o=d.left):(i=parseFloat(l)||0,o=parseFloat(u)||0),lt.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(p.top=t.top-s.top+i),null!=t.left&&(p.left=t.left-s.left+o),"using"in t?t.using.call(e,p):a.css(p)}},lt.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===lt.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),lt.nodeName(e[0],"html")||(n=e.offset()),n.top+=lt.css(e[0],"borderTopWidth",!0),n.left+=lt.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-lt.css(r,"marginTop",!0),left:t.left-n.left-lt.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||V.documentElement;e&&!lt.nodeName(e,"html")&&"static"===lt.css(e,"position");)e=e.offsetParent;return e||V.documentElement})}}),lt.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);lt.fn[e]=function(i){return lt.access(this,function(e,i,o){var a=W(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?lt(a).scrollLeft():o,r?o:lt(a).scrollTop()):e[i]=o,void 0)},e,i,arguments.length,null)}}),lt.each({Height:"height",Width:"width"},function(e,n){lt.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){lt.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return lt.access(this,function(n,r,i){var o;return lt.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?lt.css(n,r,s):lt.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=lt,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return lt})})(window),function(e,t){var n=function(){var t=e._data(document,"events");return t&&t.click&&e.grep(t.click,function(e){return"rails"===e.namespace}).length};n()&&e.error("jquery-ujs has already been loaded!");var r;e.rails=r={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])",disableSelector:"input[data-disable-with], button[data-disable-with], textarea[data-disable-with]",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled",requiredInputSelector:"input[name][required]:not([disabled]),textarea[name][required]:not([disabled])",fileInputSelector:"input[type=file]",linkDisableSelector:"a[data-disable-with]",CSRFProtection:function(t){var n=e('meta[name="csrf-token"]').attr("content");n&&t.setRequestHeader("X-CSRF-Token",n)},fire:function(t,n,r){var i=e.Event(n);return t.trigger(i,r),i.result!==!1},confirm:function(e){return confirm(e)},ajax:function(t){return e.ajax(t)},href:function(e){return e.attr("href")},handleRemote:function(n){var i,o,a,s,l,u,c,p;if(r.fire(n,"ajax:before")){if(s=n.data("cross-domain"),l=s===t?null:s,u=n.data("with-credentials")||null,c=n.data("type")||e.ajaxSettings&&e.ajaxSettings.dataType,n.is("form")){i=n.attr("method"),o=n.attr("action"),a=n.serializeArray();var d=n.data("ujs:submit-button");d&&(a.push(d),n.data("ujs:submit-button",null))}else n.is(r.inputChangeSelector)?(i=n.data("method"),o=n.data("url"),a=n.serialize(),n.data("params")&&(a=a+"&"+n.data("params"))):(i=n.data("method"),o=r.href(n),a=n.data("params")||null);p={type:i||"GET",data:a,dataType:c,beforeSend:function(e,i){return i.dataType===t&&e.setRequestHeader("accept","*/*;q=0.5, "+i.accepts.script),r.fire(n,"ajax:beforeSend",[e,i])},success:function(e,t,r){n.trigger("ajax:success",[e,t,r])},complete:function(e,t){n.trigger("ajax:complete",[e,t])},error:function(e,t,r){n.trigger("ajax:error",[e,t,r])},crossDomain:l},u&&(p.xhrFields={withCredentials:u}),o&&(p.url=o);var f=r.ajax(p);return n.trigger("ajax:send",f),f}return!1},handleMethod:function(n){var i=r.href(n),o=n.data("method"),a=n.attr("target"),s=e("meta[name=csrf-token]").attr("content"),l=e("meta[name=csrf-param]").attr("content"),u=e('
'),c='
';l!==t&&s!==t&&(c+='
'),a&&u.attr("target",a),u.hide().append(c).appendTo("body"),u.submit()},disableFormElements:function(t){t.find(r.disableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with",t[n]()),t[n](t.data("disable-with")),t.prop("disabled",!0)})},enableFormElements:function(t){t.find(r.enableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with")&&t[n](t.data("ujs:enable-with")),t.prop("disabled",!1)})},allowAction:function(e){var t,n=e.data("confirm"),i=!1;return n?(r.fire(e,"confirm")&&(i=r.confirm(n),t=r.fire(e,"confirm:complete",[i])),i&&t):!0},blankInputs:function(t,n,r){var i,o,a=e(),s=n||"input,textarea",l=t.find(s);return l.each(function(){if(i=e(this),o=i.is("input[type=checkbox],input[type=radio]")?i.is(":checked"):i.val(),!o==!r){if(i.is("input[type=radio]")&&l.filter('input[type=radio]:checked[name="'+i.attr("name")+'"]').length)return!0;a=a.add(i)}}),a.length?a:!1},nonBlankInputs:function(e,t){return r.blankInputs(e,t,!0)},stopEverything:function(t){return e(t.target).trigger("ujs:everythingStopped"),t.stopImmediatePropagation(),!1},callFormSubmitBindings:function(n,r){var i=n.data("events"),o=!0;return i!==t&&i.submit!==t&&e.each(i.submit,function(e,t){return"function"==typeof t.handler?o=t.handler(r):void 0}),o},disableElement:function(e){e.data("ujs:enable-with",e.html()),e.html(e.data("disable-with")),e.bind("click.railsDisable",function(e){return r.stopEverything(e)})},enableElement:function(e){e.data("ujs:enable-with")!==t&&(e.html(e.data("ujs:enable-with")),e.data("ujs:enable-with",!1)),e.unbind("click.railsDisable")}},r.fire(e(document),"rails:attachBindings")&&(e.ajaxPrefilter(function(e,t,n){e.crossDomain||r.CSRFProtection(n)}),e(document).delegate(r.linkDisableSelector,"ajax:complete",function(){r.enableElement(e(this))}),e(document).delegate(r.linkClickSelector,"click.rails",function(n){var i=e(this),o=i.data("method"),a=i.data("params");if(!r.allowAction(i))return r.stopEverything(n);if(i.is(r.linkDisableSelector)&&r.disableElement(i),i.data("remote")!==t){if(!(!n.metaKey&&!n.ctrlKey||o&&"GET"!==o||a))return!0;var s=r.handleRemote(i);return s===!1?r.enableElement(i):s.error(function(){r.enableElement(i)}),!1}return i.data("method")?(r.handleMethod(i),!1):void 0}),e(document).delegate(r.inputChangeSelector,"change.rails",function(t){var n=e(this);return r.allowAction(n)?(r.handleRemote(n),!1):r.stopEverything(t)}),e(document).delegate(r.formSubmitSelector,"submit.rails",function(n){var i=e(this),o=i.data("remote")!==t,a=r.blankInputs(i,r.requiredInputSelector),s=r.nonBlankInputs(i,r.fileInputSelector);if(!r.allowAction(i))return r.stopEverything(n);if(a&&i.attr("novalidate")==t&&r.fire(i,"ajax:aborted:required",[a]))return r.stopEverything(n);if(o){if(s){setTimeout(function(){r.disableFormElements(i)},13);var l=r.fire(i,"ajax:aborted:file",[s]);return l||setTimeout(function(){r.enableFormElements(i)},13),l}return!e.support.submitBubbles&&"1.7">e().jquery&&r.callFormSubmitBindings(i,n)===!1?r.stopEverything(n):(r.handleRemote(i),!1)
}setTimeout(function(){r.disableFormElements(i)},13)}),e(document).delegate(r.formInputClickSelector,"click.rails",function(t){var n=e(this);if(!r.allowAction(n))return r.stopEverything(t);var i=n.attr("name"),o=i?{name:i,value:n.val()}:null;n.closest("form").data("ujs:submit-button",o)}),e(document).delegate(r.formSubmitSelector,"ajax:beforeSend.rails",function(t){this==t.target&&r.disableFormElements(e(this))}),e(document).delegate(r.formSubmitSelector,"ajax:complete.rails",function(t){this==t.target&&r.enableFormElements(e(this))}),e(function(){var t=e("meta[name=csrf-token]").attr("content"),n=e("meta[name=csrf-param]").attr("content");e('form input[name="'+n+'"]').val(t)}))}(jQuery),function(){function e(t,n,r){var i=e.resolve(t);if(null==i){r=r||t,n=n||"root";var o=new Error('Failed to require "'+r+'" from "'+n+'"');throw o.path=r,o.parent=n,o.require=!0,o}var a=e.modules[i];return a.exports||(a.exports={},a.client=a.component=!0,a.call(this,a.exports,e.relative(i),a)),a.exports}var t=Object.prototype.hasOwnProperty;e.modules={},e.aliases={},e.resolve=function(n){"/"===n.charAt(0)&&(n=n.slice(1));for(var r=n+"/index.js",i=[n,n+".js",n+".json",n+"/index.js",n+"/index.json"],o=0;i.length>o;o++){var n=i[o];if(t.call(e.modules,n))return n}return t.call(e.aliases,r)?e.aliases[r]:void 0},e.normalize=function(e,t){var n=[];if("."!=t.charAt(0))return t;e=e.split("/"),t=t.split("/");for(var r=0;t.length>r;++r)".."==t[r]?e.pop():"."!=t[r]&&""!=t[r]&&n.push(t[r]);return e.concat(n).join("/")},e.register=function(t,n){e.modules[t]=n},e.alias=function(n,r){if(!t.call(e.modules,n))throw new Error('Failed to alias "'+n+'", it does not exist');e.aliases[r]=n},e.relative=function(n){function r(e,t){for(var n=e.length;n--;)if(e[n]===t)return n;return-1}function i(t){var r=i.resolve(t);return e(r,n,t)}var o=e.normalize(n,"..");return i.resolve=function(t){var i=t.charAt(0);if("/"==i)return t.slice(1);if("."==i)return e.normalize(o,t);var a=n.split("/"),s=r(a,"deps")+1;return s||(s=0),t=a.slice(0,s+1).join("/")+"/deps/"+t},i.exists=function(n){return t.call(e.modules,i.resolve(n))},i},e.register("component-emitter/index.js",function(e,t,n){function r(e){return e?i(e):void 0}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}n.exports=r,r.prototype.on=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[e]=this._callbacks[e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){r.off(e,n),t.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},t._off=n,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=function(e,t){this._callbacks=this._callbacks||{};var n=this._callbacks[e];if(!n)return this;if(1==arguments.length)return delete this._callbacks[e],this;var r=n.indexOf(t._off||t);return~r&&n.splice(r,1),this},r.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks[e];if(n){n=n.slice(0);for(var r=0,i=n.length;i>r;++r)n[r].apply(this,t)}return this},r.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[e]||[]},r.prototype.hasListeners=function(e){return!!this.listeners(e).length}}),e.register("dropzone/index.js",function(e,t,n){n.exports=t("./lib/dropzone.js")}),e.register("dropzone/lib/dropzone.js",function(e,t,n){(function(){var e,r,i,o,a,s,l={}.hasOwnProperty,u=function(e,t){function n(){this.constructor=e}for(var r in t)l.call(t,r)&&(e[r]=t[r]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},c=[].slice,p=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};r="undefined"!=typeof Emitter&&null!==Emitter?Emitter:t("emitter"),a=function(){},e=function(e){function t(e,n){var r,i,o,a;if(this.element=e,this.version=t.version,this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,""),"string"==typeof this.element&&(this.element=document.querySelector(this.element)),!this.element||null==this.element.nodeType)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");if(t.instances.push(this),e.dropzone=this,r=null!=(a=t.optionsForElement(this.element))?a:{},i=function(){var e,t,n,r,i,o,a;for(r=arguments[0],n=arguments.length>=2?c.call(arguments,1):[],o=0,a=n.length;a>o;o++){t=n[o];for(e in t)i=t[e],r[e]=i}return r},this.options=i({},this.defaultOptions,r,null!=n?n:{}),null==this.options.url&&(this.options.url=this.element.action),!this.options.url)throw new Error("No URL provided.");if(this.options.method=this.options.method.toUpperCase(),this.options.forceFallback||!t.isBrowserSupported())return this.options.fallback.call(this);if((o=this.getExistingFallback())&&o.parentNode&&o.parentNode.removeChild(o),this.options.previewsContainer){if("string"==typeof this.options.previewsContainer?this.previewsContainer=document.querySelector(this.options.previewsContainer):null!=this.options.previewsContainer.nodeType&&(this.previewsContainer=this.options.previewsContainer),null==this.previewsContainer)throw new Error("Invalid `previewsContainer` option provided. Please provide a CSS selector or a plain HTML element.")}else this.previewsContainer=this.element;if(this.options.clickable&&(this.options.clickable===!0?this.clickableElement=this.element:"string"==typeof this.options.clickable?this.clickableElement=document.querySelector(this.options.clickable):null!=this.options.clickable.nodeType&&(this.clickableElement=this.options.clickable),!this.clickableElement))throw new Error("Invalid `clickable` element provided. Please set it to `true`, a plain HTML element or a valid CSS selector.");this.init()}return u(t,e),t.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","selectedfiles","addedfile","removedfile","thumbnail","error","processingfile","uploadprogress","sending","success","complete","reset"],t.prototype.defaultOptions={url:null,method:"post",parallelUploads:2,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:2,thumbnailWidth:100,thumbnailHeight:100,params:{},clickable:!0,enqueueForUpload:!0,previewsContainer:null,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",accept:function(e,t){return t()},init:function(){return a},forceFallback:!1,fallback:function(){var e,n,r,i,o,a;for(this.element.className=""+this.element.className+" browser-not-supported",a=this.element.getElementsByTagName("div"),i=0,o=a.length;o>i;i++)e=a[i],/(^| )message($| )/.test(e.className)&&(n=e,e.className="message");return n||(n=t.createElement('
'),this.element.appendChild(n)),r=n.getElementsByTagName("span")[0],r&&(r.textContent=this.options.dictFallbackMessage),this.element.appendChild(this.getFallbackForm())},drop:function(){return this.element.classList.remove("drag-hover")},dragstart:a,dragend:function(){return this.element.classList.remove("drag-hover")},dragenter:function(){return this.element.classList.add("drag-hover")},dragover:function(){return this.element.classList.add("drag-hover")},dragleave:function(){return this.element.classList.remove("drag-hover")},selectedfiles:function(){return this.element===this.previewsContainer?this.element.classList.add("started"):void 0},reset:function(){return this.element.classList.remove("started")},addedfile:function(e){return e.previewTemplate=t.createElement(this.options.previewTemplate),this.previewsContainer.appendChild(e.previewTemplate),e.previewTemplate.querySelector(".filename span").textContent=e.name,e.previewTemplate.querySelector(".details").appendChild(t.createElement('
'+this.filesize(e.size)+"
"))},removedfile:function(e){return e.previewTemplate.parentNode.removeChild(e.previewTemplate)},thumbnail:function(e,n){return e.previewTemplate.classList.remove("file-preview"),e.previewTemplate.classList.add("image-preview"),e.previewTemplate.querySelector(".details").appendChild(t.createElement('
'))},error:function(e,t){return e.previewTemplate.classList.add("error"),e.previewTemplate.querySelector(".error-message span").textContent=t},processingfile:function(e){return e.previewTemplate.classList.add("processing")},uploadprogress:function(e,t){return e.previewTemplate.querySelector(".progress .upload").style.width=""+t+"%"},sending:a,success:function(e){return e.previewTemplate.classList.add("success")},complete:a,previewTemplate:'
'},t.prototype.init=function(){var e,n,r,i,o,a,s,l=this;for("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".message")&&this.element.appendChild(t.createElement('
'+this.options.dictDefaultMessage+"
")),this.clickableElement&&(r=function(){return l.hiddenFileInput&&document.body.removeChild(l.hiddenFileInput),l.hiddenFileInput=document.createElement("input"),l.hiddenFileInput.setAttribute("type","file"),l.hiddenFileInput.setAttribute("multiple","multiple"),l.hiddenFileInput.style.display="none",document.body.appendChild(l.hiddenFileInput),l.hiddenFileInput.addEventListener("change",function(){var e;return e=l.hiddenFileInput.files,e.length&&(l.emit("selectedfiles",e),l.handleFiles(e)),r()})},r()),this.files=[],this.filesQueue=[],this.filesProcessing=[],this.URL=null!=(a=window.URL)?a:window.webkitURL,s=this.events,i=0,o=s.length;o>i;i++)e=s[i],this.on(e,this.options[e]);return n=function(e){return e.stopPropagation(),e.preventDefault?e.preventDefault():e.returnValue=!1},this.listeners=[{element:this.element,events:{dragstart:function(e){return l.emit("dragstart",e)},dragenter:function(e){return n(e),l.emit("dragenter",e)},dragover:function(e){return n(e),l.emit("dragover",e)},dragleave:function(e){return l.emit("dragleave",e)},drop:function(e){return n(e),l.drop(e),l.emit("drop",e)},dragend:function(e){return l.emit("dragend",e)}}}],this.clickableElement&&this.listeners.push({element:this.clickableElement,events:{click:function(e){return l.clickableElement!==l.element||e.target===l.element||t.elementInside(e.target,l.element.querySelector(".message"))?l.hiddenFileInput.click():void 0}}}),this.enable(),this.options.init.call(this)},t.prototype.getFallbackForm=function(){var e,n,r,i;return(e=this.getExistingFallback())?e:(r='
',this.options.dictFallbackText&&(r+="
"+this.options.dictFallbackText+"
"),r+='
',n=t.createElement(r),"FORM"!==this.element.tagName?(i=t.createElement('
'),i.appendChild(n)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=i?i:n)},t.prototype.getExistingFallback=function(){var e,t,n,r,i,o;for(t=function(e){var t,n,r;for(n=0,r=e.length;r>n;n++)if(t=e[n],/(^| )fallback($| )/.test(t.className))return t},o=["div","form"],r=0,i=o.length;i>r;r++)if(n=o[r],e=t(this.element.getElementsByTagName("div")))return e},t.prototype.setupEventListeners=function(){var e,t,n,r,i,o,a;for(o=this.listeners,a=[],r=0,i=o.length;i>r;r++)e=o[r],a.push(function(){var r,i;r=e.events,i=[];for(t in r)n=r[t],i.push(e.element.addEventListener(t,n,!1));return i}());return a},t.prototype.removeEventListeners=function(){var e,t,n,r,i,o,a;for(o=this.listeners,a=[],r=0,i=o.length;i>r;r++)e=o[r],a.push(function(){var r,i;r=e.events,i=[];for(t in r)n=r[t],i.push(e.element.removeEventListener(t,n,!1));return i}());return a},t.prototype.disable=function(){return this.clickableElement===this.element&&this.element.classList.remove("clickable"),this.removeEventListeners(),this.filesProcessing=[],this.filesQueue=[]},t.prototype.enable=function(){return this.clickableElement===this.element&&this.element.classList.add("clickable"),this.setupEventListeners()},t.prototype.filesize=function(e){var t;return e>=1e11?(e/=1e11,t="TB"):e>=1e8?(e/=1e8,t="GB"):e>=1e5?(e/=1e5,t="MB"):e>=100?(e/=100,t="KB"):(e=10*e,t="b"),"
"+Math.round(e)/10+" "+t},t.prototype.drop=function(e){var t;if(e.dataTransfer)return t=e.dataTransfer.files,this.emit("selectedfiles",t),t.length?this.handleFiles(t):void 0},t.prototype.handleFiles=function(e){var t,n,r,i;for(i=[],n=0,r=e.length;r>n;n++)t=e[n],i.push(this.addFile(t));return i},t.prototype.accept=function(e,t){return e.size>1024*1024*this.options.maxFilesize?t("File is too big ("+Math.round(e.size/1024/10.24)/100+"MB). Max filesize: "+this.options.maxFilesize+"MB"):this.options.accept.call(this,e,t)},t.prototype.addFile=function(e){var t=this;return this.files.push(e),this.emit("addedfile",e),this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1024*1024*this.options.maxThumbnailFilesize&&this.createThumbnail(e),this.accept(e,function(n){return n?t.errorProcessing(e,n):t.options.enqueueForUpload?(t.filesQueue.push(e),t.processQueue()):void 0})},t.prototype.removeFile=function(e){if(e.processing)throw new Error("Can't remove file currently processing");return this.files=s(this.files,e),this.filesQueue=s(this.filesQueue,e),this.emit("removedfile",e),0===this.files.length?this.emit("reset"):void 0},t.prototype.removeAllFiles=function(){var e,t,n,r;for(r=this.files.slice(),t=0,n=r.length;n>t;t++)e=r[t],0>p.call(this.filesProcessing,e)&&this.removeFile(e);return null},t.prototype.createThumbnail=function(e){var t,n=this;return t=new FileReader,t.onload=function(){var r;return r=new Image,r.onload=function(){var t,i,o,a,s,l,u,c,p,d,f,h,m;return t=document.createElement("canvas"),i=t.getContext("2d"),l=0,u=0,s=r.width,o=r.height,t.width=n.options.thumbnailWidth,t.height=n.options.thumbnailHeight,h=0,m=0,f=t.width,p=t.height,a=r.width/r.height,d=t.width/t.height,r.height
d?(o=r.height,s=o*d):(s=r.width,o=s/d),l=(r.width-s)/2,u=(r.height-o)/2,m=(t.height-p)/2,h=(t.width-f)/2,i.drawImage(r,l,u,s,o,h,m,f,p),c=t.toDataURL("image/png"),n.emit("thumbnail",e,c)},r.src=t.result},t.readAsDataURL(e)},t.prototype.processQueue=function(){var e,t,n;for(t=this.options.parallelUploads,n=this.filesProcessing.length,e=n;t>e;){if(!this.filesQueue.length)return;this.processFile(this.filesQueue.shift()),e++}},t.prototype.processFile=function(e){return this.filesProcessing.push(e),e.processing=!0,this.emit("processingfile",e),this.uploadFile(e)},t.prototype.uploadFile=function(e){var t,n,r,i,o,a,s,l,u,c,p,d,f,h,m=this;if(u=new XMLHttpRequest,u.open(this.options.method,this.options.url,!0),n=function(){return m.errorProcessing(e,u.responseText||"Server responded with "+u.status+" code.")},u.onload=function(t){var r,i;return(i=u.status)>=200&&300>i?(m.emit("uploadprogress",e,100),r=u.responseText,u.getResponseHeader("content-type")&&~u.getResponseHeader("content-type").indexOf("application/json")&&(r=JSON.parse(r)),m.finished(e,r,t)):n()},u.onerror=function(){return n()},s=null!=(d=u.upload)?d:u,s.onprogress=function(t){return m.emit("uploadprogress",e,Math.max(0,Math.min(100,100*(t.loaded/t.total))))},u.setRequestHeader("Accept","application/json"),u.setRequestHeader("Cache-Control","no-cache"),u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("X-File-Name",e.name),t=new FormData,this.options.params){f=this.options.params;for(a in f)l=f[a],t.append(a,l)}if("FORM"===this.element.tagName)for(h=this.element.querySelectorAll("input, textarea, select, button"),c=0,p=h.length;p>c;c++)r=h[c],i=r.getAttribute("name"),o=r.getAttribute("type"),(!o||"checkbox"!==o.toLowerCase()||r.checked)&&t.append(i,r.value);return this.emit("sending",e,u,t),t.append(this.options.paramName,e),u.send(t)},t.prototype.finished=function(e,t,n){return this.filesProcessing=s(this.filesProcessing,e),e.processing=!1,this.processQueue(),this.emit("success",e,t,n),this.emit("finished",e,t,n),this.emit("complete",e)},t.prototype.errorProcessing=function(e,t){return this.filesProcessing=s(this.filesProcessing,e),e.processing=!1,this.processQueue(),this.emit("error",e,t),this.emit("complete",e)},t}(r),e.version="2.0.12",e.options={},e.optionsForElement=function(t){return t.id?e.options[i(t.id)]:void 0},e.instances=[],e.forElement=function(e){var t;return"string"==typeof e&&(e=document.querySelector(e)),null!=(t=e.dropzone)?t:null},e.autoDiscover=!0,e.discover=function(){var t,n,r,i,o,a;if(e.autoDiscover){for(document.querySelectorAll?r=document.querySelectorAll(".dropzone"):(r=[],t=function(e){var t,n,i,o;for(o=[],n=0,i=e.length;i>n;n++)t=e[n],/(^| )dropzone($| )/.test(t.className)?o.push(r.push(t)):o.push(void 0);return o},t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))),a=[],i=0,o=r.length;o>i;i++)n=r[i],e.optionsForElement(n)!==!1?a.push(new e(n)):a.push(void 0);return a}},e.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i],e.isBrowserSupported=function(){var t,n,r,i,o;if(t=!0,window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(o=e.blacklistedBrowsers,r=0,i=o.length;i>r;r++)n=o[r],n.test(navigator.userAgent)&&(t=!1);else t=!1;else t=!1;return t},s=function(e,t){var n,r,i,o;for(o=[],r=0,i=e.length;i>r;r++)n=e[r],n!==t&&o.push(n);return o},i=function(e){return e.replace(/[\-_](\w)/g,function(e){return e[1].toUpperCase()})},e.createElement=function(e){var t;return t=document.createElement("div"),t.innerHTML=e,t.childNodes[0]},e.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(t){return this.each(function(){return new e(this,t)})}),"undefined"!=typeof n&&null!==n?n.exports=e:window.Dropzone=e,o=function(e,t){var n,r,i,o,a,s,l,u,c;if(i=!1,c=!0,r=e.document,u=r.documentElement,n=r.addEventListener?"addEventListener":"attachEvent",l=r.addEventListener?"removeEventListener":"detachEvent",s=r.addEventListener?"":"on",o=function(n){return"readystatechange"!==n.type||"complete"===r.readyState?(("load"===n.type?e:r)[l](s+n.type,o,!1),!i&&(i=!0)?t.call(e,n.type||n):void 0):void 0},a=function(){var e;try{u.doScroll("left")}catch(t){return e=t,setTimeout(a,50),void 0}return o("poll")},"complete"!==r.readyState){if(r.createEventObject&&u.doScroll){try{c=!e.frameElement}catch(p){}c&&a()}return r[n](s+"DOMContentLoaded",o,!1),r[n](s+"readystatechange",o,!1),e[n](s+"load",o,!1)}},o(window,e.discover)}).call(this)}),e.alias("component-emitter/index.js","dropzone/deps/emitter/index.js"),"object"==typeof exports?module.exports=e("dropzone"):"function"==typeof define&&define.amd?define(function(){return e("dropzone")}):window.Dropzone=e("dropzone")}();var addEvent=function(){return document.addEventListener?function(e,t,n){if(e&&e.nodeName||e===window)e.addEventListener(t,n,!1);else if(e&&e.length)for(var r=0;e.length>r;r++)addEvent(e[r],t,n)}:function(e,t,n){if(e&&e.nodeName||e===window)e.attachEvent("on"+t,function(){return n.call(e,window.event)});else if(e&&e.length)for(var r=0;e.length>r;r++)addEvent(e[r],t,n)}}();(function(){var e=document.createElement("pre");e.id="view-source",addEvent(window,"click",function(t){if("#view-source"==t.target.hash){if(!document.getElementById("view-source")){var n=new XMLHttpRequest;n.onreadystatechange=function(){4==this.readyState&&200==this.status&&(e.innerHTML=this.responseText.replace(/[<>]/g,function(e){return{"<":"<",">":">"}[e]}),prettyPrint())},document.body.appendChild(e),n.open("GET",window.location,!0),n.send()}document.body.className="view-source";var r=setInterval(function(){"#view-source"!=window.location.hash&&(clearInterval(r),document.body.className="")},200)}})})(),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}};this.AttachmentDragger=function(){function t(t,n,r){this.drag_selector=t,this.drop_selector=n,this.attribute=r,this.cancel=e(this.cancel,this),this.init=e(this.init,this),this.init()}return t.prototype.attribute=null,t.prototype.drag_items=null,t.prototype.init=function(){var e,t,n,r,i,o=this;for(this.drag_items=document.querySelectorAll(this.drag_selector),i=this.drag_items,n=0,r=i.length;r>n;n++)e=i[n],addEvent(e,"dragstart",function(e){return event.dataTransfer.setData(o.attribute,e.currentTarget[o.attribute])});return t=document.querySelector(this.drop_selector),addEvent(t,"dragover",this.cancel),addEvent(t,"dragenter",this.cancel),addEvent(t,"drop",function(e){var t,n;return e.preventDefault&&e.preventDefault(),e.currentTarget[o.attribute]!==e.dataTransfer.getData(o.attribute)&&(t=e.dataTransfer.getData(o.attribute),t.length>0&&(e.currentTarget[o.attribute]=e.dataTransfer.getData(o.attribute),n=new PersistenceManager,"src"===o.attribute&&n.save_image($(e.currentTarget)),"href"===o.attribute&&n.save_attachment($(e.currentTarget)))),!1})},t.prototype.cancel=function(e){return e.preventDefault&&e.currentTarget[this.attribute]!==e.dataTransfer.getData(this.attribute)&&e.preventDefault(),!1},t}()}.call(this),function(){var e=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};$(function(){return new AttachmentUploader($(".image_upload_box")),new AttachmentDragger("img[draggable=true]",".rubber_ring_image","src"),new AttachmentDragger("a[draggable=true]",".rubber_ring_attachment","href"),$(".remove_not_used_attachments").on("click",function(){var t,n,r,i,o,a,s,l,u,c,p,d,f;for(i=new PersistenceManager,a=function(){var e,t,n,i;for(n=$(".uploaded-images img"),i=[],e=0,t=n.length;t>e;e++)r=n[e],i.push($(r).attr("src"));return i}(),o=function(){var e,t,n,i;for(n=$(".uploaded-attachments a"),i=[],e=0,t=n.length;t>e;e++)r=n[e],i.push($(r).attr("href"));return i}(),l=function(){var e,t,n,i;for(n=$(".rubber_ring_image"),i=[],e=0,t=n.length;t>e;e++)r=n[e],i.push($(r).attr("src"));return i}(),s=function(){var e,t,n,i;for(n=$(".rubber_ring_attachment"),i=[],e=0,t=n.length;t>e;e++)r=n[e],i.push($(r).attr("href"));return i}(),u=0,p=a.length;p>u;u++)n=a[u],0>e.call(l,n)&&(i.remove_image(n),$('.uploaded-images img[src="'+n+'"]').remove());for(f=[],c=0,d=o.length;d>c;c++)t=o[c],0>e.call(s,t)?(i.remove_image(t),f.push($('.uploaded-attachments a[href="'+t+'"]').remove())):f.push(void 0);return f})})}.call(this),function(){this.AttachmentUploader=function(){function e(e){e.dropzone({url:App.add_attachment_path}),this.addListeners(e)}return e.prototype.addListeners=function(e){var t;return t=Dropzone.forElement(e.get(0)),t.on("sending",function(e,t,n){var r,i;return r=$("meta[name=csrf-param]").attr("content"),i=$("meta[name=csrf-token]").attr("content"),n.append(r,i),n.append("page_controller",App.controller),n.append("page_action",App.action)}),t.on("success",function(e,t){return"image"===t.type?($(".uploaded-images").append(''),new AttachmentDragger("img[draggable=true]",".rubber_ring_image","src")):($(".uploaded-attachments").append(' '+t.src.split("/").reverse()[0]+""),new AttachmentDragger("a[draggable=true]",".rubber_ring_attachment","href"))})},e}()}.call(this),function(){$(function(){return $("#rubber-ring-application a.dropdown").click(function(e){var t,n;return t=$(e.currentTarget),n=t.parent().siblings(".active").toggleClass().find("a").attr("id"),$("."+n).slideToggle(),$("."+t.attr("id")).slideToggle(),t.parent().toggleClass("active")})})}.call(this),function(){this.DuplicableEditor=function(){function e(e){this.action_btns=e,this.add_reset_btn_to_first_in_duplicable_group(null),this.pm=new PersistenceManager(e)}var t;return e.prototype.init=function(){var e=this;return $(".duplicable_holder").find(".duplicable:first").append(this.action_btns.duplicate_btn),$("body").on("click",".duplicate-content",function(t){var n;return n=$(t.currentTarget).parent(),e.duplicate(n)}),$(".duplicable_holder").find(".duplicable:first").siblings().append(this.action_btns.remove_duplicate_btn),$("body").on("click",".remove-duplicat",function(t){var n;return n=$(t.currentTarget).parent(),e.remove_duplicate(n)})},e.prototype.add_reset_btn_to_first_in_duplicable_group=function(e){var t=this;return null===e?$(".duplicable_holder").find(".duplicable:first").each(function(e,n){return 0===$(n).siblings().length?$(n).append(t.action_btns.reset_btn):void 0}):1===e.siblings().length?e.append(this.action_btns.reset_btn):void 0},e.prototype.duplicate=function(e){var n,r;return this.pm.save(e),n=e.clone(!0).appendTo(e.parent()),r=t(e),n.attr("data-cms",r),e.parent().children().not(":first").find(".duplicate-content, .reset-content").remove(),e.find(".reset-content").remove(),n.append(this.action_btns.remove_duplicate_btn),this.pm.save(n)},e.prototype.remove_duplicate=function(e){return this.pm.remove(e),this.add_reset_btn_to_first_in_duplicable_group(e.siblings().first()),e.remove()},t=function(e){var t,n;return t=0,n=e.attr("data-cms").split("_").reverse(),e.siblings().each(function(e,r){var i;return n=$(r).attr("data-cms").split("_").reverse(),i=parseInt(n[0],10),i>t&&(t=i),n[0]=t+1}),n.reverse().join("_")},e}()}.call(this),function(){$(function(){var e,t,n,r,i;return t={action_btns:{reset_btn:'',duplicate_btn:'',remove_duplicate_btn:''},reset_btn_exclusions:".duplicable, [data-cms=page_title]"},e=$("[contenteditable]"),i=new PersistenceManager(t.action_btns),n=new DuplicableEditor(t.action_btns),r=new LinkEditor(e),n.init(),r.init(),$("[contenteditable]").not(t.reset_btn_exclusions).append(t.action_btns.reset_btn),$("body").on("click",".reset-content",function(e){var t;return t=$(e.currentTarget).parent(),window.confirm("Really want to reset content?")?i.remove(t).then(function(){return window.location.reload(!0)}):void 0}),$(".rubber_ring_attachment").click(function(e){return e.preventDefault()}),$("body").on("focus","[contenteditable]",function(){var e;return e=$(this),e.data("before",e.html()),e}).on("blur","[contenteditable]",function(){var e;return e=$(this),e.data("before")!==e.html()&&(e.data("before",e.html()),e.trigger("change")),e}),e.change(function(e){var t;return t=$(e.currentTarget),i.save(t)}),e.not(".multi-line").keydown(function(e){return 13===e.keyCode?e.preventDefault():void 0})})}.call(this),function(){this.LinkEditor=function(){function e(e){this.editable_content=e}var t;return e.prototype.init=function(){var e;return e=$("#rubber-ring-application #edit-link"),this.editable_content.bind("click","a",function(n){var r;return r=$(t()),null!==r&&r.is("a")?(n.stopPropagation(),e.css({top:r.offset().top-e.height()-5,left:r.offset().left}).show(),e.data("node",r),$("#link-title").val(r.text()),$("#link-href").val(r.attr("href")),$("#link-preview").attr("href",r.attr("href"))):e.hide()}),$(document).bind("click",function(t){return t.stopPropagation(),$("#edit-link").is(":visible")&&0===$(t.target).parents("#edit-link").length?e.hide():void 0}),$("#link-title").bind("change",function(t){var n;return n=e.data("node"),n.text($(t.currentTarget).val()),n.parents("[contenteditable]").trigger("change")}),$("#link-href").bind("change",function(t){var n;return n=e.data("node"),n.add("#link-preview").attr("href",$(t.currentTarget).val()),n.parents("[contenteditable]").trigger("change")})},t=function(){var e;return window.getSelection?(e=window.getSelection().anchorNode,null!==e&&"#text"===e.nodeName?e.parentNode:e):void 0},e}()}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}};this.PersistenceManager=function(){function t(t){var n=this;this.action_btns=t,this.post_to_backend=e(this.post_to_backend,this),this.save_path=App.save_path,this.save_image_path=App.save_image_path,this.save_attachment_path=App.save_attachment_path,this.remove_path=App.remove_path,this.remove_attachment_path=App.remove_attachment_path,this.$alert=$(".alert-saved div"),this.$alert.bind("transitionend webkitTransitionEnd",function(){return n.$alert.removeClass("show")})}return t.prototype.save_path=null,t.prototype.remove_path=null,t.prototype.save_image_path=null,t.prototype.save_attachment_path=null,t.prototype.remove_attachment_path=null,t.prototype.$alert=null,t.prototype.post_object={page_controller:App.controller,page_action:App.action,page_path:document.location.pathname},t.prototype.save=function(e){var t,n;return t=e.attr("data-cms"),n=this.sanitize(e),this.post_object.content={},this.post_object.content[t]=n,this.post_to_backend(this.save_path,this.post_object)},t.prototype.save_image=function(e){var t;return t=e.attr("data-cms"),this.post_object.content={},this.post_object.content[t]=e.attr("src"),this.post_object.width=e.attr("width"),this.post_object.height=e.attr("height"),this.post_to_backend(this.save_image_path,this.post_object)},t.prototype.save_attachment=function(e){var t;return t=e.attr("data-cms"),this.post_object.content={},this.post_object.content[t]=e.attr("href"),this.post_to_backend(this.save_attachment_path,this.post_object)},t.prototype.sanitize=function(e){var t,n,r;e=e.html().trim().replace(/^[ \t\r\n]+/g,""),r=this.action_btns;for(t in r)n=r[t],e=e.replace(n,"").trim();return e},t.prototype.remove=function(e){var t,n;return t=e.attr("data-cms"),n=this.remove_path.replace(":key",t),this.post_object.key_to_remove=t,this.post_to_backend(n,this.post_object)},t.prototype.remove_image=function(e){return this.post_object.src_to_remove=e,this.post_to_backend(this.remove_attachment_path,this.post_object)},t.prototype.post_to_backend=function(e,t){var n=this;return $.post(e,t,function(){return n.$alert.addClass("show")})},t}()}.call(this);; TI"required_assets_digest; TI"%5f901a1eeb9adf79c2f519cec641c043; FI"
_version; TI"%a3b89b66a8471f3e75abb239e3b35c7d; F