angular.module("jobbnorge.web",["jobbnorge.common","ngSanitize","youtube-embed"]),function(){"use strict";function t(t,r){return{get:function(i,u){return t.get(r.api(n)+"?jobId="+i+"&languageId="+u)},getJobInfo:function(i,u){return t.get(r.api(n+"/job-info")+"?jobId="+i+"&languageId="+u)},getLanguages:function(i){return i.jobId=i.jobId||0,i.templateId=i.templateId||0,t.get(r.api(n)+"/languages",{params:i})},getTemplate:function(n,u,f){return t.get(r.api(i)+"/"+n+"?languageId="+u+"&previewToken="+f)}}}var n="/joblisting",i=n+"/template";angular.module("jobbnorge.web").factory("JobListingApi",t);t.$inject=["$http","Url"]}(),function(){"use strict";function n(n,t,i,r,u,f,e,o,s,h,c,l){function b(){if(n.jobInfo&&n.jobInfo.jobScope)return"{0} ({1} {2})".format(s.localize(n.jobInfo.jobScope),n.positionCount,s.localize("stillinger").toLowerCase())}function k(){s.use(a.languageId);t.location.reload(!0)}function d(){var n=a.languageId,t=f("filter")(a.activeLanguages,function(t){return t.id===n})[0];return t.name}function p(n){s.use(n);t.location.reload(!0)}function g(){function i(i){n.jobInfo=i.data;n.jobScopePercentage&&(n.jobInfo.jobScope=n.jobScopePercentage+"% "+s.localize("stilling"));n.isInternal=n.jobInfo.jobAdvertisementScopeId==="2";n.jobInfo.municipalities=n.jobInfo.municipalities.sort();t.CandidateCaptureScriptID=n.jobInfo.candidateCaptureScriptId}function r(){}h.getJobInfo(a.jobId,a.languageId).then(i).catch(r)}function nt(){function t(t){var e,r;t.data.isPublished&&y&&(i.search({}),i.replace());t.data.jobScopePercentage&&(n.jobScopePercentage=t.data.jobScopePercentage);n.positionCount=t.data.positionCount;_.extend(a,t.data);a.activeLanguages=f();u();n.model=a;e=t.data.profileColor;e!=null&&(r=document.createElement("style"),r.innerHTML=".job-listing .component:nth-child(even) .section:not(.image-section) { background-color: #"+t.data.profileColor+"}.job-listing .apply-btn:hover, .job-listing .apply-btn:active, .job-listing .apply-btn:focus {background-color: #"+t.data.profileColor+"; border-color: #"+t.data.profileColor+"}",document.body.appendChild(r))}function r(){}function u(){n.showApplyButton=n.canApplyOnline&&a.isPublished||n.isPreview||v!==null?!0:!1;n.showAdvertisement=a.isPublished||n.isPreview||v!==null?!0:!1}function f(){var n=[];return _.each(a.activeLanguages,function(t){n.push({id:t,name:w[t-1].name})}),n}h.get(a.jobId,a.languageId).then(t).catch(r)}function tt(){function n(n){_.indexOf(n.data.activeLanguages,a.languageId)===-1&&(a.languageId=n.data.activeLanguages[0],p(n.data.activeLanguages[0]));nt();g()}function t(){}h.getLanguages({jobId:a.jobId}).then(n).catch(t)}var a={languageId:s.getLanguageId(),jobId:o.job.id},y=i.search().p||"0",v=i.search().hash||null,w=[{id:1,name:"Norsk Bokmål"},{id:2,name:"English"},{id:3,name:"Norsk Nynorsk"},{id:4,name:"Sámegiella"}];n.municipalityLimit=20;n.municipalityToggle=!0;n.jobScopePercentage=null;n.hasYoutubeConsent=l.hasConsent("cookie_cat_statistic")&&l.hasConsent("cookie_cat_marketing");n.playerVars={autoplay:0,modestbranding:1,playsinline:0,rel:0};n.logoUrl=o.common.frontpage+"logos/";n.pdfUrl=o.job.pdfUrl+"?p="+y;n.applyUrl=o.job.applyUrl;n.canApplyOnline=o.job.canApplyOnline;v!==null&&(n.applyUrl+="?invitation="+v,n.pdfUrl+="&hash="+v);n.isPreview=y==="1";n.changeLanguage=k;n.currentLanguageName=d;n.switchLanguage=p;n.getJobScopeString=b;n.showLanguages=!1;n.view0=c.commonClients("web/views/jobListingComponents/jobListingComponentIntro.html");n.view1=c.commonClients("web/views/jobListingComponents/jobListingComponentAbout.html");n.view2=c.commonClients("web/views/jobListingComponents/jobListingComponentText.html");n.view3=c.commonClients("web/views/jobListingComponents/jobListingComponentImage.html");n.view4=c.commonClients("web/views/jobListingComponents/jobListingComponentList.html");n.view5=c.commonClients("web/views/jobListingComponents/jobListingComponentTextImage.html");n.view6=c.commonClients("web/views/jobListingComponents/jobListingComponentTextVideo.html");tt();n.updateMunicipalityLimit=function(){n.municipalityLimit=null;n.municipalityToggle=!1}}angular.module("jobbnorge.web").controller("JobListing",n);n.$inject=["$scope","$window","$location","$sce","$anchorScroll","$filter","$timeout","Config","Localization","JobListingApi","Url","Cookie"]}(),function(){"use strict";function n(n,t,i,r,u,f,e,o){function l(){u.use(s.languageId);t.location.reload(!0)}function a(){var n=s.languageId,t=i("filter")(s.activeLanguages,function(t){return t.id===n})[0];return t.name}function h(n){u.use(n);t.location.reload(!0)}function v(){function n(n){_.indexOf(n.data.activeLanguages,s.languageId)===-1&&(s.languageId=n.data.activeLanguages[0],h(n.data.activeLanguages[0]));y()}f.getLanguages({templateId:s.id}).then(n)}function y(){function t(t){var u,r;_.extend(s,t.data);s.activeLanguages=i();s.logo=t.data.employerData.logo;n.model=s;u=t.data.profileColor;u!=null&&(r=document.createElement("style"),r.innerHTML=".job-listing .component:nth-child(even) .section:not(.image-section) { background-color: #"+t.data.profileColor+"}.job-listing .apply-btn:hover, .job-listing .apply-btn:active, .job-listing .apply-btn:focus {background-color: #"+t.data.profileColor+"; border-color: #"+t.data.profileColor+"}",document.body.appendChild(r))}function i(){var n=[];return _.each(s.activeLanguages,function(t){n.push({id:t,name:c[t-1].name})}),n}f.getTemplate(s.id,s.languageId,s.token).then(t)}var s={id:r.template.id,token:r.template.token,languageId:u.getLanguageId()},c=[{id:1,name:"Norsk Bokmål"},{id:2,name:"English"},{id:3,name:"Norsk Nynorsk"},{id:4,name:"Sámegiella"}];n.hasYoutubeConsent=o.hasConsent("cookie_cat_statistic")&&o.hasConsent("cookie_cat_marketing");n.playerVars={autoplay:0,modestbranding:1,playsinline:0,rel:0};n.logoUrl=r.common.frontpage+"logos/";n.changeLanguage=l;n.currentLanguageName=a;n.switchLanguage=h;n.showLanguages=!1;n.showApplyButton=!0;n.config=r;n.view0=e.commonClients("web/views/jobListingComponents/jobListingComponentIntro.html");n.view1=e.commonClients("web/views/jobListingComponents/jobListingComponentAbout.html");n.view2=e.commonClients("web/views/jobListingComponents/jobListingComponentText.html");n.view3=e.commonClients("web/views/jobListingComponents/jobListingComponentImage.html");n.view4=e.commonClients("web/views/jobListingComponents/jobListingComponentList.html");n.view5=e.commonClients("web/views/jobListingComponents/jobListingComponentTextImage.html");n.view6=e.commonClients("web/views/jobListingComponents/jobListingComponentTextVideo.html");v()}angular.module("jobbnorge.web").controller("JobListingTemplate",n);n.$inject=["$scope","$window","$filter","Config","Localization","JobListingApi","Url","Cookie"]}()