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;df||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;ba){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