import{wb as f,zb as x}from"./chunk-V2ECYACM.js";import{a as l,b as g,c as h,d as k}from"./chunk-RWCAFOHA.js";import{b as d,c as T}from"./chunk-YBNTOQCK.js";import{be as b,na as p,r as t,ta as c,xa as s}from"./chunk-WL5U2YIT.js";import{e as E}from"./chunk-ADEKKGI2.js";var n,j,S=E(()=>{p();g();b();x();k();T();n=(function(e){return e[e.success=200]="success",e[e.badRequest=400]="badRequest",e[e.notFound=404]="notFound",e[e.serverError=500]="serverError",e[e.forbidden=403]="forbidden",e})(n||{}),j=(()=>{let o=class o{constructor(r,i,a){this.dvlConfirmationService=r,this.applicationErrorService=i,this.translatorService=a}handleError(r,i=null){switch(console.error(r),r.status){case n.serverError:this.handleServerError(r);break;case n.forbidden:this.handleForbiddenError(r.error);break;case n.badRequest:this.handleBadRequest(r.error,this.translatorService.translate("lblError"));break;case n.notFound:this.handleBadRequest(r.error,this.translatorService.translate("lblError"),this.translatorService.translate(i)||"Item not found");break;default:this.handleGenericError(r)}return t()}handleBadRequest(r,i=this.translatorService.translate("AnErrorOccured"),a=this.translatorService.translate("AnErrorOccured")){typeof r=="string"&&(r={message:`${r}`}),this.dvlConfirmationService.confirm({intent:"default",actionMode:"ok",title:`${i}`,message:r?.Message||r?.message||a})}handleForbiddenError(r,i=this.translatorService.translate("ShowAccessDenied")){let a=r.translationKey?this.translatorService.translate(r.translationKey):r.Message||r.message;this.dvlConfirmationService.confirm({intent:"default",actionMode:"ok",title:`${i}`,message:a})}handleGenericError(r){this.sendToApplicationError(r.message,r.statusText)}handleServerError(r){r.error&&(r.error.exceptionMessage||r.error.message)?this.sendToApplicationError(r.error.message,r.statusText,r.error.exceptionMessage,r.error.exceptionType,r.error.stackTrace):this.handleGenericError(r)}sendToApplicationError(r,i,a,m,v){this.applicationErrorService.pushError(new l({message:r,statusText:i,exceptionMessage:a,exceptionType:m,stackTrace:v,fatal:!1}))}};o.\u0275fac=function(i){return new(i||o)(s(f),s(h),s(d))},o.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"});let e=o;return e})()});export{j as a,S as b};
