var OmniFaces=OmniFaces||{EVENT:"omnifaces.event",VIEW_STATE_PARAM:"javax.faces.ViewState",CLIENT_WINDOW_PARAM:"javax.faces.ClientWindow"};
OmniFaces.Util=function(d,h){function k(a,c,b,e,f){e=e.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var d=0;d<e.length;d++){var h=e[d];if(a[c])a[c](h,f);else if(a[b])a[b]("on"+h,f)}}function g(a,c,b){var e=a[c];e&&(a[c]=function(){b();return e.apply(this,arguments)})}var f={addEventListener:function(a,c,b){k(a,"addEventListener","attachEvent",c,b)},removeEventListener:function(a,c,b){k(a,"removeEventListener","detachEvent",c,b)},addOnloadListener:function(a){if("complete"===h.readyState)setTimeout(a);
else if(d.addEventListener||d.attachEvent)f.addEventListener(d,"load",a);else if("function"===typeof d.onload){var c=d.onload;d.onload=function(){c();a()}}else d.onload=a},addSubmitListener:function(a){f.addEventListener(h,"submit",a);d.mojarra&&g(mojarra,"jsfcljs",a);d.myfaces&&g(myfaces.oam,"submitForm",a);d.PrimeFaces&&g(PrimeFaces,"addSubmitParam",a)},resolveFunction:function(a){return"function"!==typeof a&&(a=d[a]||function(){}),a},getFacesForm:function(){for(var a=0;a<h.forms.length;a++)if(h.forms[a]["javax.faces.ViewState"])return h.forms[a];
return null},updateParameter:function(a,c,b){var e=new RegExp("(^|[?\x26#])"+c+"\x3d.*?([\x26#]|$)","i");b?(c=c+"\x3d"+encodeURIComponent(b),a=a?a.match(e)?a.replace(e,"$1"+c+"$2"):a+("\x26"+c):c):a=a.replace(e,"$2");"\x26"==a.charAt(0)&&(a=a.substring(1));return a},loadScript:function(a,c,b,e,d){c=f.resolveFunction(c);var g=f.resolveFunction(b),k=f.resolveFunction(e),l=f.resolveFunction(d),m=h.createElement("script");b=h.head||h.documentElement;m.async=!0;m.src=a;m.setAttribute("crossorigin","anonymous");
m.onerror=function(){k()};m.onload=m.onreadystatechange=function(a,c){if(c||!m.readyState||/loaded|complete/.test(m.readyState)){m.onload=m.onreadystatechange=null;if(c)m.onerror();else g();m=null;l()}};c();b.insertBefore(m,null)}};return f}(window,document);
OmniFaces.Highlight=function(d,h){function k(){d.removeEventListener(this,"click input",k);var f=this.getAttribute("data-omnifaces-highlight-class");if(f){this.removeAttribute("data-omnifaces-highlight-class");f=new RegExp(" "+f,"g");this.className=this.className.replace(f,"");var a=this.getAttribute("data-omnifaces-highlight-label");a&&(this.removeAttribute("data-omnifaces-highlight-label"),a=g[this.id],a.className=a.className.replace(f,""))}}var g;return{apply:function(f,a,c){for(var b=h.getElementsByTagName("LABEL"),
e={},l=0;l<b.length;l++){var p=b[l],q=p.htmlFor;q&&(e[q]=p)}g=e;for(b=0;b<f.length;b++)if(l=f[b],e=h.getElementById(l),e||(l=h.getElementsByName(l))&&l.length&&(e=l[0]),e){e.className+=" "+a;e.setAttribute("data-omnifaces-highlight-class",a);if(l=g[e.id])l.className+=" "+a,e.setAttribute("data-omnifaces-highlight-label",!0);c&&(e.focus(),c=!1);d.addEventListener(e,"click input",k)}}}}(OmniFaces.Util,document);
OmniFaces.DeferredScript=function(d,h){function k(f){if(!(0>f||f>=g.length)){var a=g[f];d.loadScript(a.url,a.begin,a.success,a.error,function(){k(f+1)})}}var g=[];return{add:function(f,a,c,b){g.push({url:f,begin:a,success:c,error:b});1==g.length&&d.addOnloadListener(function(){k(0)})}}}(OmniFaces.Util,document);
OmniFaces.Unload=function(d,h,k,g){var f,a,c={init:function(b){if(k.XMLHttpRequest){if(null==f){var e=d.getFacesForm();if(!e){k.jsf&&"Development"!=jsf.getProjectStage()||!k.console||!console.error||console.error("OmniFaces @ViewScoped: cannot find a JSF form in the document. Unload will not work. Either add a JSF form, or use @RequestScoped instead.");return}d.addEventListener(k,"onpagehide"in k?"pagehide":"onbeforeunload"in k&&!k.onbeforeunload?"beforeunload":"unload",function(){if(a)c.reenable();
else try{var b=e.action,d=OmniFaces.EVENT+"\x3dunload\x26id\x3d"+f+"\x26"+OmniFaces.VIEW_STATE_PARAM+"\x3d"+encodeURIComponent(e[OmniFaces.VIEW_STATE_PARAM].value);if(h.sendBeacon)h.sendBeacon(b,new Blob([d],{type:"application/x-www-form-urlencoded"}));else{var g=new XMLHttpRequest;g.open("POST",b,!1);g.setRequestHeader("X-Requested-With","XMLHttpRequest");g.setRequestHeader("Content-Type","application/x-www-form-urlencoded");g.send(d)}}catch(n){}});d.addSubmitListener(function(){c.disable()})}f=
b;a=!1}},disable:function(){a=!0},reenable:function(){a=!1}};return c}(OmniFaces.Util,navigator,window,document);
OmniFaces.Push=function(d,h){function k(a,c,d,f,h,g,k){var b,e,l=this;l.open=function(){b&&1==b.readyState||(b=new WebSocket(a),b.onopen=function(a){null==e&&d(c);e=0},b.onmessage=function(a){var b=JSON.parse(a.data);f(b,c,a);if((a=k[b])&&a.length)for(b=0;b<a.length;b++)a[b]()},b.onclose=function(a){!b||1E3==a.code&&"Expired"==a.reason||1008==a.code||1005==a.code&&"Unknown channel"==a.reason||null==e||25<=e?g(a.code,c,a):(h(a.code,c,a),setTimeout(l.open,500*e++))})};l.close=function(){if(b){var a=
b;b=null;null==e;a.close()}}}function g(b){var c=a[b];if(c)return c;throw Error("Unknown channel: "+b);}var f=h.location.protocol.replace("http","ws")+"//",a={},c={init:function(b,e,g,p,q,n,m,r){n=d.resolveFunction(n);var l=e.split(/\?/)[0];if(h.WebSocket){if(!a[l]){var t=(b=b||"")&&0!=b.indexOf("/")?0==b.indexOf(":")?h.location.hostname:"":h.location.host;a[l]=new k(f+t+b+"/omnifaces.push/"+e,l,d.resolveFunction(g),d.resolveFunction(p),d.resolveFunction(q),n,m)}r&&c.open(l)}else n(-1,l)},open:function(a){g(a).open()},
close:function(a){g(a).close()}};return c}(OmniFaces.Util,window);
OmniFaces.InputFile=function(d,h){return{validate:function(k,g,f,a){if(!d.FileReader)return!0;h.getElementById(f).innerHTML="";for(f=0;f<g.files.length;f++){var c=g.files[f];if(c.size>a){a=c.name;var b;d.mojarra&&(b=g.form.enctype,g.form.enctype="application/x-www-form-urlencoded");g.type="text";g.type="file";a={fileName:a};a[OmniFaces.EVENT]="validationFailed";jsf.ajax.request(g.id,k,a);b&&(g.form.enctype=b);return!1}}return!0}}}(window,document);
OmniFaces.Form=function(d,h){d.addOnloadListener(function(){if(h.jsf){var d=jsf.getViewState;jsf.getViewState=function(g){var f=d(g);if("true"!=g.attributes["data-partialsubmit"])return f;var a=jsf.ajax.request.arguments?jsf.ajax.request.arguments[2].execute:null;if(!a||-1!=a.indexOf("@form")||-1!=a.indexOf("@all"))return f;var c=[];-1==a.indexOf("@none")&&(c=a.replace("@this",jsf.ajax.request.arguments[0].id).split(" ").map(encodeURIComponent),c.push(encodeURIComponent(g.id)));c.push(OmniFaces.VIEW_STATE_PARAM);
c.push(OmniFaces.CLIENT_WINDOW_PARAM);var b=[];f.replace(/([^=&]+)=([^&]*)/g,function(a,d,f){-1<c.indexOf(d)&&b.push(d+"\x3d"+f)});return b.join("\x26")}}})}(OmniFaces.Util,window);
OmniFaces.HashParam=function(d,h,k){function g(){if(!a){var c={execute:f,hash:h.location.hash.substring(1)};c[OmniFaces.EVENT]="setHashParamValues";jsf.ajax.request(d.getFacesForm(),null,c)}}var f,a;return{init:function(a){f=a;d.getFacesForm()?(h.location.hash&&g(),d.addEventListener(h,"hashchange",g)):h.jsf&&"Development"!=jsf.getProjectStage()||!h.console||!console.error||console.error("OmniFaces HashParam: cannot find a JSF form in the document. Setting hash parameter in bean will not work. Either add a JSF form, or use ViewParam instead.")},
update:function(c,b){a=!0;var e=h.location.hash;e&&"#"==e.charAt(0)&&(e=e.substring(1));c=d.updateParameter(e,c,b);c!=e&&(h.history&&h.history.pushState?(e=h.location.href.split(/#/,2)[0]+(c?"#":"")+c,history.pushState(null,k.title,e)):h.location.hash=c);a=!1}}}(OmniFaces.Util,window,document);