!function(t){t.fn.savy=function(e,i){const s="savy-";"load"==e?(t(this).each(function(){t(this).is(":radio")?(localStorage.getItem(s+t(this).attr("name"))&&(localStorage.getItem(s+t(this).attr("name"))==this.id?this.checked=!0:this.checked=!1),t(this).change(function(){localStorage.setItem(s+t(this).attr("name"),this.id)})):t(this).is(":checkbox")?(localStorage.getItem(s+this.id)&&(this.checked="1"==localStorage.getItem(s+this.id)),t(this).change(function(){localStorage.setItem(s+this.id,this.checked?"1":"0")})):t(this).is("input")||t(this).is("textarea")?(localStorage.getItem(s+this.id)&&(this.value=localStorage.getItem(s+this.id)),t(this).on("focus",function(){var e=setInterval(()=>{localStorage.setItem(s+this.id,this.value),t(this).is(":focus")||clearInterval(e)},500)})):t(this).is("select")&&(t(this).is("[multiple]")?(localStorage.getItem(s+this.id)?t(this).val(localStorage.getItem(s+this.id).split(",")):localStorage.setItem(s+this.id,t(this).val()),t(this).change(function(){localStorage.setItem(s+this.id,t(this).val())})):(localStorage.getItem(s+this.id)?t(this).val(localStorage.getItem("savy-"+this.id)):localStorage.setItem(s+this.id,t(this).val()),t(this).change(function(){localStorage.setItem(s+this.id,t(this).val())})))}),t.isFunction(i)&&i()):"destroy"==e?(t(this).each(function(){localStorage.getItem(s+this.id)&&localStorage.removeItem(s+this.id)}),t.isFunction(i)&&i()):console.error("savy action not defined please use $('.classname').savy('load') to trigger savy to save all inputs")}}(jQuery);