/**
 * Pattern Validation
 */
!function(e,n,r){"use strict";var t,a;if(e.uaMatch=function(e){e=e.toLowerCase();var n=/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[],r=/(ipad)/.exec(e)||/(iphone)/.exec(e)||/(android)/.exec(e)||/(windows phone)/.exec(e)||/(win)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/i.exec(e)||[];return{browser:n[3]||n[1]||"",version:n[2]||"0",platform:r[0]||""}},a={},(t=e.uaMatch(n.navigator.userAgent)).browser&&(a[t.browser]=!0,a.version=t.version,a.versionNumber=parseInt(t.version)),t.platform&&(a[t.platform]=!0),(a.android||a.ipad||a.iphone||a["windows phone"])&&(a.mobile=!0),(a.cros||a.mac||a.linux||a.win)&&(a.desktop=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),a.rv){t.browser="msie",a.msie=!0}if(a.opr){t.browser="opera",a.opera=!0}if(a.safari&&a.android){t.browser="android",a.android=!0}a.name=t.browser,a.platform=t.platform,e.browser=a}(jQuery,window),function(e){var n=(e.browser.msie?"paste":"input")+".mask",r=null!=window.orientation;e.mask={definitions:{9:"[0-9]*[\u0600-\u06FF]*",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn"},e.fn.extend({caret:function(e,n){if(0!=this.length){if("number"==typeof e)return n="number"==typeof n?n:e,this.each(function(){if(this.setSelectionRange)this.setSelectionRange(e,n);else if(this.createTextRange){var r=this.createTextRange();r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",e),r.select()}});if(this[0].setSelectionRange)e=this[0].selectionStart,n=this[0].selectionEnd;else if(document.selection&&document.selection.createRange){var r=document.selection.createRange();e=0-r.duplicate().moveStart("character",-1e5),n=e+r.text.length}return{begin:e,end:n}}},unmask:function(){return this.trigger("unmask")},mask:function(t,a){if(!t&&this.length>0)return e(this[0]).data(e.mask.dataName)();a=e.extend({placeholder:"_",completed:null},a);var i=e.mask.definitions,o=[],c=t.length,s=null,l=t.length;return e.each(t.split(""),function(e,n){"?"==n?(l--,c=e):i[n]?(o.push(new RegExp(i[n])),null==s&&(s=o.length-1)):o.push(null)}),this.trigger("unmask").each(function(){function u(e){for(var n=v.val(),r=-1,t=0,i=0;t<l;t++)if(o[t]){for(p[t]=a.placeholder;i++<n.length;){var u=n.charAt(i-1);if(o[t].test(u)){p[t]=u,r=t;break}}if(i>n.length)break}else p[t]==n.charAt(i)&&t!=c&&(i++,r=t);return!e&&r+1<c?(v.val(""),d(0,l)):(e||r+1>=c)&&(f(),e||v.val(v.val().substring(0,r+1))),c?t:s}function f(){return v.val(p.join("")).val()}function d(e,n){for(var r=e;r<n&&r<l;r++)o[r]&&(p[r]=a.placeholder)}function m(e,n){if(!(e<0)){for(var r=e,t=h(n);r<l;r++)if(o[r]){if(!(t<l&&o[r].test(p[t])))break;p[r]=p[t],p[t]=a.placeholder,t=h(t)}f(),v.caret(Math.max(s,e))}}function h(e){for(;++e<=l&&!o[e];);return e}var v=e(this),p=e.map(t.split(""),function(e,n){if("?"!=e)return i[e]?a.placeholder:e}),w=v.val();v.data(e.mask.dataName,function(){return e.map(p,function(e,n){return o[n]&&e!=a.placeholder?e:null}).join("")}),v.attr("readonly")||v.one("unmask",function(){v.unbind(".mask").removeData(e.mask.dataName)}).bind("focus.mask",function(){w=v.val();var n=u();f();var r=function(){n==t.length?v.caret(0,n):v.caret(n)};(e.browser.msie?r:function(){setTimeout(r,0)})()}).bind("blur.mask",function(){u(),v.val()!=w&&v.change()}).bind("keydown.mask",function(e){var n=e.which;if(8==n||46==n||r&&127==n){var t=v.caret(),a=t.begin,i=t.end;return i-a==0&&(a=46!=n?function(e){for(;--e>=0&&!o[e];);return e}(a):i=h(a-1),i=46==n?h(i):i),d(a,i),m(a,i-1),!1}if(27==n)return v.val(w),v.caret(0,u()),!1}).bind("keypress.mask",function(e){var n=e.which,r=v.caret();if(e.ctrlKey||e.altKey||e.metaKey||n<32)return!0;if(n){r.end-r.begin!=0&&(d(r.begin,r.end),m(r.begin,r.end-1));var t=h(r.begin-1);if(t<l){var i=String.fromCharCode(n);if(o[t].test(i)){(function(e){for(var n=e,r=a.placeholder;n<l;n++)if(o[n]){var t=h(n),i=p[n];if(p[n]=r,!(t<l&&o[t].test(i)))break;r=i}})(t),p[t]=i,f();var c=h(t);v.caret(c),a.completed&&c>=l&&a.completed.call(v)}}return!1}}).bind(n,function(){setTimeout(function(){v.caret(u(!0))},0)}),u()})}})}(jQuery);
