1import{b as P}from"./chunk-MCQML6YT.js";import{b as g}from"./chunk-XNXLFDZX.js";import{b as F}from"./chunk-KELMSLCR.js";import{a as M}from"./chunk-N6W3AF2G.js";import{a as s}from"./chunk-IENL4UJA.js";import{b as q}from"./chunk-JLWCQ6UT.js";import{V as I}from"./chunk-P4C42LQP.js";import{d as S}from"./chunk-RZZCZ2VH.js";import{C as D,Fa as n,H as B,K as N,V as w,_ as $,f as x,g as v,ma as l,s as u,ub as j}from"./chunk-SRTQBDBP.js";import{a as E}from"./chunk-EJD3L6HM.js";import{a as y,b as A,g as R}from"./chunk-T7NDVU76.js";var f=function(r){return r[r.IndividualContractReq=1]="IndividualContractReq",r[r.HourlyContract=2]="HourlyContract",r[r.RenewContract=3]="RenewContract",r[r.IndividualOffer=4]="IndividualOffer",r[r.HourlyContractConfirmation=5]="HourlyContractConfirmation",r[r.Mediation=6]="Mediation",r}(f||{});var H=(()=>{class r{constructor(){this.sessionStorageService=n(g),this.http=n(S)}GetAlternativeStep(e,t){let i=this.sessionStorageService.ServiceType;return this.http.get(s.apiUrl+`Steps/Alternative?serviceType=${i}&actionName=${e}&stepId=${t}`).pipe(u(o=>o.data))}getSteps(){let e=this.sessionStorageService.ServiceType?this.sessionStorageService.ServiceType:f.HourlyContractConfirmation;return this.http.get(s.apiUrl+`Steps/DynamicSteps?serviceType=${e}`).pipe(u(t=>t.data))}getFirstStep(e,t=null){let i=s.apiUrl+`Steps/FirstStep?serviceType=${e}`;return t&&(i+=`&Object=${t}`),this.http.get(i).pipe(u(o=>o.data))}getStepDetailsByActionName(e,t,i){let o=s.apiUrl+`Steps/StepDetailsByActionName?serviceType=${e}&actionName=${t}&StepId=${i}`;return this.http.get(o).pipe(u(a=>a.data))}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var k=function(r){return r[r.individual=1]="individual",r[r.hourly=2]="hourly",r[r.hourlycontract=5]="hourlycontract",r[r.individualOffers=4]="individualOffers",r[r.renewContract=3]="renewContract",r[r.mediation=6]="mediation",r}(k||{});var T=R(E());var V=(()=>{class r{constructor(){this.renderDeliverMethod=new x,this.http=n(S),this.userServices=n(P),this.langService=n(M),this.router=n(I),this.sessionStorageService=n(g)}getDeliverEmployeeMethods(e,t){return this.http.get(s.apiUrl+`IndividualContractRequest/DeliverEmployeeMethods?cityId=${e}&professionGroup=${t}`)}SelectPackageNext(e){let t=this.sessionStorageService.stepId;return this.http.post(s.apiUrl+`IndividualContractRequest/SelectPackageNext?selectEmployeeFromSite=${e}&stepId=${t}`,null)}openBlockedUser(e){T.default.fire({title:e?.stepDetailsVm?.description,icon:"info",confirmButtonText:this.langService.isLangArabic?"\u0645\u0648\u0627\u0641\u0642":"ok"}).then(t=>{this.router.navigate(["/contact-us"])})}openUnAvailableModal(e){T.default.fire({title:e?.stepDetailsVm?.description,iconHtml:`<img src="${F}" alt="success" />`,confirmButtonText:this.langService.isLangArabic?"\u062A\u0642\u062F\u064A\u0645 \u0637\u0644\u0628":"Add Lead"}).then(t=>{t.isConfirmed&&this.router.navigate(["/dashboard/lead/create"])})}getPricingByPromotionCode(e){return this.userServices.getUserData().pipe($(t=>(e.contactId=t?.crmUserId,this.http.post(s.apiUrl+"IndividualPricing/GetPricingByProfessionAndNationality",e))),u(t=>(this.packageProperties=JSON.parse(t.data.packageProperties),t.data)))}getHouseBuilding(e,t){return this.http.get(s.apiUrl+`HoueBuilding/HouseBuildingsForCity?cityId=${e}&professionGroupId=${t}`).pipe(u(i=>i))}getPricingByStepId(e,t,i){return this.http.get(s.apiUrl+`IndividualContractRequest/Pricing?StepId=${e}&ProfessionGroupId=${t}&ResourceGroupId=${i}`).pipe(u(o=>(this.packageProperties=JSON.parse(o.data.packageProperties),o)))}getNationalitiesByProfession(e){return this.http.get(s.apiUrl+`ResourceGroup/AvailableResourceGroupsWithCity?professionGroupId=${e}`)}getNationalitiesByProfessionWithCity(e,t){return this.http.get(s.apiUrl+`ResourceGroup/AvailableResourceGroupsWithCity?professionGroupId=${e}&cityId=${t}`)}getProfessions(){return this.http.get(s.apiUrl+"ProfessionGroups/AvailableProfessions").pipe(u(e=>e))}getDeliverMethodByStepId(e){return this.http.get(s.apiUrl+`IndividualContractRequest/WaysToChooseEmp?StepId=${e}`)}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();
1var C=R(E());var m=function(r){return r[r.Stratigy=1]="Stratigy",r[r.PageUi=2]="PageUi",r[r.PostAction=3]="PostAction",r[r.popUp=6]="popUp",r[r.renderSamePage=7]="renderSamePage",r}(m||{});var c=function(r){return r[r.checkAuthentication=0]="checkAuthentication",r[r.openBlockedUser=1]="openBlockedUser",r[r.notFound=2]="notFound",r[r.openUnAvailableModal=3]="openUnAvailableModal",r[r.postActionError=4]="postActionError",r[r.navigation=5]="navigation",r}(c||{});var G=(()=>{class r{constructor(){this.renderDeliverMethod$=new v(!1)}setRenderDeliverMethod(e){this.renderDeliverMethod$.next(e)}getRenderDeliverMethod(){return this.renderDeliverMethod$}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var b=function(r){return r[r.currency=1]="currency",r[r.string=2]="string",r[r.percent=3]="percent",r}(b||{}),z=function(r){return r.currency="currency",r.percent="percent",r.string="string",r}(z||{});var W=(()=>{class r{constructor(){this.http=n(S)}postRequestWithoutBody(e,t,i){let o=`${s.apiUrl}${i.controller}/${i.action}`,a=(e||"get").toLowerCase();return this.http.request(a,o,{params:t})}postRequestWithBody(e){let t=e.httpRequestParemeter,i=t&&typeof t=="object"&&"stepDetails"in t?t.stepDetails:t??e.stepDetails;if(!i?.controller||!i?.action)throw new Error("StepHttpService.postRequestWithBody: stepDetails.controller and action are required");let o=`${s.apiUrl}${i.controller}/${i.action}`;return this.http.post(o,e.body,{params:e.params??{}})}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var J=(()=>{class r{constructor(){this.activeComponentEvent=new v(""),this.activeComponentEvent$=this.activeComponentEvent.asObservable(),this.pricingValidations={activationAmount:e=>e.activationAmount&&e.activationAmount<e.contractAmount,activatioAmountAfterVat:e=>e.activationAmount&&e.activationAmount<e.contractAmount,VatAmountOfActivation:e=>e.activationAmount&&e.activationAmount<e.contractAmount,finalPriceToPay:e=>!!(e.finalPriceToPay&&e.finalPriceToPay>=e.finalPackagePrice),priceAfterTotalDiscount:e=>!!(e.priceAfterTotalDiscount&&e.packagePrice>e.priceAfterTotalDiscount),advancedAmount:e=>e.advancedAmount,advancedAmountAfterVat:e=>e.advancedAmount,packageName:e=>e.packageName,discount:e=>e.discount,packagePriceAfterDiscount:e=>e.discount,prePaid:e=>e.prePaid,monthlyPaidAmount:e=>e.prePaid,amountInsurance:e=>e.amountInsurance,packageDisplayName:e=>e.packageDisplayName,professionGroupName:e=>e.professionGroupName,totalDiscountAmount:e=>e.totalDiscountAmount,vatRate:e=>e.vatRate,discountWithVat:e=>e.discountWithVat,deliveryCost:e=>e.deliveryCost},this.nextStepResponse=new v(null),this.hourlyServiceAvailable=new v(!0),this.currentStepSubject=new v(null),this.currentStepSubject$=this.currentStepSubject.asObservable(),this.individualPricingService=n(V),this.router=n(I),this.translateService=n(q),this.sessionStorageService=n(g),this.userService=n(P),this.injector=n(j),this.stepHttpService=n(W),this.generalService=n(G),this.http=n(S)}setActiveComponent(e){this.activeComponentEvent.next(e)}excuteHttpRequestWithBody(e,t,i,o){let a=i.stepDetails!=null?s.apiUrl+i.stepDetails.controller+"/"+i.stepDetails.action:s.apiUrl+i.controller+"/"+i.action;return this.http.request(e,a,{params:t,body:o}).pipe(u(p=>p))}setCurrentStep(e){this.currentStepSubject.next(e)}loadPdf(e){return this.http.get(e,{responseType:"blob"})}getCityDistricts(e){return this.http.get(s.apiUrl+`City/CityDistricts?cityId=${e}`)}getActiveNationalities(){return this.http.get(s.apiUrl+"Nationality/ActiveNationalities")}getContactGender(){return this.http.get(s.apiUrl+"Contact/ContactGender")}getActiveCities(){return this.http.get(s.apiUrl+"City/ActiveCities")}isCurrency(e,t=null){return e&&t?t.type==b[b.currency]:!1}isPercent(e,t=null){return e&&t?t.type==b[b.percent]:!1}checkValidation(e,t){return!this.pricingValidations[t]||this.pricingValidations[t](e)}navigateToAuthAccordingToURL(e){if(e.baseUrl){let t={returnUrl:e.baseUrl};e.extra&&(t.extra=JSON.stringify(e.extra)),this.router.navigate(["/auth"],{queryParams:t})}else this.router.navigate(["/auth"],{queryParams:{returnUrl:e}})}showWarningMessageIfNotAuth(e){C.default.fire({title:e.warning,html:e.yourChangesWillNotBeSaved,showDenyButton:!1,confirmButtonText:e.accept})}checkAuthentication(e){this.translateService.get(["shouldLoginBeforeContinue","signIn","cancel","warning","yourChangesWillNotBeSaved","accept"]).subscribe(t=>{C.default.fire({title:t.shouldLoginBeforeContinue,showDenyButton:!0,confirmButtonText:t.signIn,denyButtonText:t.cancel}).then(i=>{i.isConfirmed?this.navigateToAuthAccordingToURL(e):i.isDenied&&this.showWarningMessageIfNotAuth(t)})})}postActionError(e){C.default.fire({title:e.message,showConfirmButton:!0,timer:5e3,confirmButtonText:localStorage.getItem("lang")=="ar"?"\u0645\u0648\u0627\u0641\u0642":"ok"})}isBase64(e){return/^[A-Za-z0-9+/=]+$/.test(e)&&e.length%4===0}checkStepEncryption(e){return!!(this.isBase64(e)&&e.startsWith("U2Fsd"))}dealWithNextStepResult(e){switch(e?.type){case c.checkAuthentication:this.checkAuthentication(e.data);break;case c.openBlockedUser:this.individualPricingService.openBlockedUser(e.data);break;case c.openUnAvailableModal:this.individualPricingService.openUnAvailableModal(e.data);break;case c.postActionError:this.postActionError(e.data);break;case c.navigation:break;case c.notFound:break}}getSessionStoragePropertyKey(e,t){let i=e;return i&&i.hasOwnProperty(t)?i[t]:null}getSessionStoragePropertyValue(e,t,i){let o=e;return o&&o.hasOwnProperty(t)?o[t][i]:null}getStepId(e){return this.sessionStorageService.stepId?this.sessionStorageService.stepId:e?.stepId}
1isServiceTypeHourlyOrIndividual(e){return e==f.HourlyContract||e==f.IndividualContractReq}createReturnUrl(e,t=null){let i,o=this.sessionStorageService.ServiceType,a=this.getStepId(e);if(!o)return null;if(i={baseUrl:this.router.url.split("?")[0].split("#")[0]},t)t.queryParams=A(y({},t.queryParams),{stepId:a}),i.extra=t;else{let d=this.router.routerState.snapshot.root.queryParams,h={queryParams:A(y({},d),{stepId:a})};i.extra=h}return i}openPopUpStep(e,t=null){switch(e.stepDetailsVm.action){case"SelectAndDeliverEmployee":this.isRenderDeliverMethod(!0);break;case"ContactHadStepsAnonymous":this.sessionStorageService.stepId=e?.stepId;let i=this.createReturnUrl(e.stepDetailsVm,t);this.handleNextStepResponse(c.checkAuthentication,i);break;case"ContactBlocked":this.handleNextStepResponse(c.openBlockedUser,i);break;case"UnAvailableEmployee":this.handleNextStepResponse(c.openUnAvailableModal,e);break;default:this.handleNextStepResponse(c.notFound,"Not found");break}}handlePopUpStepType(e,t){this.openPopUpStep(e,t)}handleRenderSamePageStepType(e,t){document.getElementById(e?.stepDetailsVm?.previousStepAction)?.remove(),this.openPopUpStep(e,t)}isRenderDeliverMethod(e){this.generalService.setRenderDeliverMethod(e)}setStepIdInSessionStorage(e){this.sessionStorageService.stepId=e}isUserNotAuthAndStepDetailsRequiresAuth(e){return e&&!this.isAuthenticated}handleNextStepResponse(e,t){this.nextStepResponse.next({type:e,data:t})}handlePageUiStepType(e,t){if(this.isRenderDeliverMethod(!1),this.setStepIdInSessionStorage(e.stepId),this.isAuthenticated=this.userService.isAuthenticatedSync(),this.isUserNotAuthAndStepDetailsRequiresAuth(e.stepDetailsVm.isAuthorized)){let i=this.createReturnUrl(e.stepDetailsVm,t);this.handleNextStepResponse(c.checkAuthentication,i);return}this.injector.get(O).navigateToStep(e.stepDetailsVm,t),this.handleNextStepResponse(c.navigation,"Navigation done")}handlePostActionStepType(e,t){this.stepHttpService.postRequestWithoutBody(e.stepDetailsVm.httpMethod,{stepId:e.stepId},e.stepDetailsVm).subscribe({next:i=>{this.openNextStep(i?.data,t)},error:i=>{this.handleNextStepResponse(c.postActionError,i)}})}openNextStep(e,t){switch(e?.stepDetailsVm.stepType){case m.popUp:this.handlePopUpStepType(e,t);break;case m.renderSamePage:this.handleRenderSamePageStepType(e,t);break;case m.PageUi:this.handlePageUiStepType(e,t);break;case m.PostAction:this.handlePostActionStepType(e,t);break;default:this.handleNextStepResponse(c.notFound,"this step type not found");break}return this.nextStepResponse}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var O=(()=>{class r{constructor(){this.currentStep=new v(null),this.sessionStorageService=n(g),this.stepsService=n(H),this.sharedService=n(J),this.router=n(I)}navigateToStepByActionName(e,t,i=null){let o=Number(this.sessionStorageService.ServiceType);this.stepsService.getStepDetailsByActionName(o,e,t).pipe(w(a=>a.pipe(N(1e3),B(3))),D(a=>a!==null),B(1)).subscribe(a=>{this.navigateToStep(a,i,t)})}navigateToNext(e,t=null,i,o){let p=0,d=()=>{this.stepsService.getStepDetailsByActionName(this.sessionStorageService.ServiceType,e,o).subscribe({next:h=>{if(h){if(h?.stepType==m.PageUi){this.navigateToStepByActionName(h.nextStepAction,o,t);return}}else p<5&&(p++,setTimeout(d,300))},error:h=>{p<5&&(p++,setTimeout(d,300))}})};d()}navigateToPrev(e,t,i,o=null){let p=0,d=()=>{this.stepsService.getStepDetailsByActionName(this.sessionStorageService.ServiceType,e,t).subscribe({next:h=>{if(h){if(h?.stepType==m.PageUi){this.navigateToStepByActionName(h.previousStepAction,t,o);return}}else p<5&&(p++,setTimeout(d,300))},error:h=>{p<5&&(p++,setTimeout(d,300))}})};d()}getServiceTypeFromSessionStorage(){return this.sessionStorageService.ServiceType}getStepIdFromLocalStorage(){return this.sessionStorageService.stepId}getStepUrl(e,t){return`${k[e]}/${t.name}`}setPreviousStepIfAvailableInSessionStorage(e){e.previousStepAction?(this.sessionStorageService.isPreviousAvailable=!0,this.sessionStorageService.previousStep=e.previousStepAction):this.sessionStorageService.isPreviousAvailable=!1}goToRenewContract(e,t){let o=this.router.url.includes("IndividualContract")?"/IndividualContract/":"/dashboard/",a=this.sessionStorageService.contractId;this.router.navigate([o+t],{queryParams:y({stepId:e},a&&{contractId:a})})}goToStepAccordingToStepId(e,t){e!=null?this.router.navigate([t],{queryParams:{stepId:e}}):this.router.navigate([t])}navigateByUrl(e,t,i,o){if(o){let a=A(y({},o),{queryParams:A(y({},o.queryParams),{stepId:t})});this.router.navigate([i],a)}else{if(e==f.RenewContract&&t){this.goToRenewContract(t,i);return}this.goToStepAccordingToStepId(t,i)}}navigateToStep(e,t=null,i=null){if(!e)return;this.sessionStorageService.currentStep=e.action;let o=this.getServiceTypeFromSessionStorage();if(!o)return;
1let a=i??(this.getStepIdFromLocalStorage()?this.getStepIdFromLocalStorage():e.stepId),p=this.getStepUrl(o,e);this.sharedService.setCurrentStep(e.action),this.setPreviousStepIfAvailableInSessionStorage(e),this.currentStep.next(e),this.navigateByUrl(o,a,p,t)}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{V as a,m as b,f as c,H as d,O as e,G as f,z as g,W as h,J as i};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.