define("qui/controls/utils/PasswordSecurity",["qui/controls/Control","qui/Locale","css!qui/controls/utils/PasswordSecurity.css"],function(t,s){"use strict";var e="quiqqer/controls";return new Class({Extends:t,Type:"qui/controls/utils/PasswordSecurity",Binds:["$keyup","$onInject"],options:{styles:!1},initialize:function(t,s){this.$Input=null,this.$Elm=null,this.$delay=!1,this.parent(t),this.addEvents({onInject:this.$onInject}),"undefined"!=typeof s&&this.bindInput(s)},bindInput:function(t){this.$Input&&this.$Input.removeEvent("keyup",this.$keyup),this.$Input=t,this.$Input.addEvent("keyup",this.$keyup),this.checkSecurity()},create:function(){return this.$Elm=new Element("div",{"class":"qui-utils-passwordsecurity"}),this.$Elm.setStyles({width:200}),this.getAttribute("styles")&&this.$Elm.setStyles(this.getAttribute("styles")),this.$Elm},$onInject:function(){this.checkSecurity()},$keyup:function(){this.$delay&&clearTimeout(this.$delay),this.$delay=this.checkSecurity.delay(300,this)},checkSecurity:function(){if(this.$Input){var t=this.getStrength(this.$Input.value);switch(t){case 1:this.$Elm.set({html:s.get(e,"html.password.strength1"),styles:{background:"#ff0000",color:"#fff"}});break;case 2:this.$Elm.set({html:s.get(e,"html.password.strength1"),styles:{background:"#ff2c00",color:"#fff"}});break;case 3:this.$Elm.set({html:s.get(e,"html.password.strength2"),styles:{background:"#ff4d00",color:"#fff"}});break;case 4:this.$Elm.set({html:s.get(e,"html.password.strength2"),styles:{background:"#ff7300",color:"#fff"}});break;case 5:this.$Elm.set({html:s.get(e,"html.password.strength2"),styles:{background:"#ff9900",color:"#fff"}});break;case 6:this.$Elm.set({html:s.get(e,"html.password.strength3"),styles:{background:"#ffc700",color:"#000"}});break;case 7:this.$Elm.set({html:s.get(e,"html.password.strength3"),styles:{background:"#ffff00",color:"#000"}});break;case 8:this.$Elm.set({html:s.get(e,"html.password.strength3"),styles:{background:"#b6ff00",color:"#000"}});break;case 9:this.$Elm.set({html:s.get(e,"html.password.strength4"),styles:{background:"#53e200",color:"#000"}});break;case 10:this.$Elm.set({html:s.get(e,"html.password.strength4"),styles:{background:"#00e200",color:"#000"}});break;default:this.$Elm.set({html:s.get(e,"html.password.strength1"),styles:{background:"#ff0000",color:"#fff"}})}}},getStrength:function(t){var s=t.length,e=s;s>5&&(s=5);var l=t.replace(/[0-9]/g,""),r=e-l.length;r>3&&(r=3);var n=t.replace(/[^a-zA-Z0-9]/g,""),h=e-n.length;h>3&&(h=3);var i=t.replace(/[A-Z]/g,""),c=e-i.length;c>3&&(c=3);var o=10*s-20+10*r+15*h+10*c;0>o&&(o=0),o>100&&(o=100),o=Math.ceil(o/10);var a=t.match(/(.)\1+$/);return a&&a[0]&&(o-=a[0].length),0>o&&(o=0),o}})});
//# sourceMappingURL=PasswordSecurity.js.map