(function(){"use strict";var e;var a;page.using={types:["Processes","PageHeader","ProcessPhases","GoogleAnalyticsProvider"]};page.onLoad=function(){var a=this.url;var r=$el("processFrame");var i=r.contentWindow||r.contentDocument.window;if(a&&a.params&&a.params.name&&a.params._action){var o="Process: "+a.params.name;var l="Action: "+a.params._action;u8.services.googleAnalyticsProvider.sendCRMDataToGA(l,o)}var d={name:a.get(["name","process"]),page:page,element:$el("process"),elProcessWindow:i,collapseInactivePhases:a.getBoolean("collapseInactivePhases"),collapsePastPhases:a.getBoolean("collapsePastPhases"),onValidationError:n,onCreate:s,onStepChange:t,onStateChange:t};e=u8.services.processes.create(d)};function t(){if(!a||a._isDisposed){return}var t=a.getWidget("center");if(t){t.update()}var r=a.getWidget("left");if(!r){u8.Base.Dom.layout($("body")[0]);return}var s=e.step,i=e.storage.get("uid")||s&&!s.isSubStep()&&s.get("$in","uid")||null;if(i&&!u8.equalsRecordUid(i,r.uid)){r.uid=i;r.update()}u8.Base.Dom.layout($("body")[0])}function r(e){var t={type:"ProcessPhases",process:e};if(!e.phases||e.phases.length<=0){t=null}var r={type:"Header",uid:e.get("$in","uid"),element:{attr:{title:e.helpText}}};if(u8.services.texts.isTextId(e.header)){r.fixedText=($t(e.header)||"").replace(/\{1\}/g,"{RECORD}");r.model={flags:u8.Base.Widgets.Header.Flags.plain};delete e.header}else if(e.header){r.headerName=e.header;r.headerGroupName="Special"}else{r=null}var s=$widget("header");if(s){s.dispose()}var i;var n=[];var l=e.metrics;if(l){for(var d=0;d<l.length;d++){var p=l[d];var u=p.view;var c=u&&u.type;if(!c){continue}var g=p&&p.helpText||"";var v=p.view&&p.view.options||{};$.extend(v,{type:c,metrics:p,context:p,bindings:"@value",process:e,title:g,element:{attr:{title:g}},onClick:function(e){var a=$u(".Tooltip",e.page);a[0].show.bind(a[0],{element:e.element}).defer(0)}});n.push(v)}}if(n.length>0){i={items:n}}else{i=null}a=u8.widget("PageHeader",$el("header"),{parent:page,onIsExpandedChange:o,left:r,center:t,right:i,isDefault:true})}function s(e){var a=e;var t=u8.tools.clean($.extend({},page.url.params,{uid:page.url.getUid(),link:page.url.getLinkUid()}));t.in1=t.uid;a.execute(t,i);r(a);u8.tools.ready(page.children,function(){$("body").removeClass("loading")})}function i(){page.proceed({})}function n(e,a){var t=a.validationErrors,r;r=t.map(u8._.attr("error")).join("\n");page.notify(r)}function o(e){var a=e.getWidget("left");if(a){a.setCollapsed(!e.isExpanded)}}})();