-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path842.f35e4888a0bdb73c.js
1 lines (1 loc) · 11.5 KB
/
842.f35e4888a0bdb73c.js
1
"use strict";(self.webpackChunkangular_SIMAt=self.webpackChunkangular_SIMAt||[]).push([[842],{7445:(g,S,t)=>{t.d(S,{_1:()=>N,H:()=>G});var e=t(5e3),d=t(8306),p=t(8746),M=t(3151),m=t(4968),O=t(3099),u=t(8675),r=t(4004),a=t(1884),l=t(9808);const c=new e.OlP("An abstraction over global window object",{factory:()=>{const{defaultView:_}=(0,e.f3M)(l.K0);if(!_)throw new Error("Window is not available");return _}}),n=(new e.OlP("Shared Observable based on `window.requestAnimationFrame`",{factory:()=>{const{requestAnimationFrame:_,cancelAnimationFrame:R}=(0,e.f3M)(c);return new d.y(U=>{let L=NaN;const T=j=>{U.next(j),L=_(T)};return L=_(T),()=>{R(L)}}).pipe((0,O.B)())}}),new e.OlP("An abstraction over window.caches object",{factory:()=>(0,e.f3M)(c).caches}),new e.OlP("An abstraction over window.crypto object",{factory:()=>(0,e.f3M)(c).crypto}),new e.OlP("An abstraction over window.CSS object",{factory:()=>(0,e.f3M)(c).CSS||{escape:_=>_,supports:()=>!1}}),new e.OlP("An abstraction over window.history object",{factory:()=>(0,e.f3M)(c).history}),new e.OlP("An abstraction over window.localStorage object",{factory:()=>(0,e.f3M)(c).localStorage}),new e.OlP("An abstraction over window.location object",{factory:()=>(0,e.f3M)(c).location}),new e.OlP("An abstraction over window.navigator object",{factory:()=>(0,e.f3M)(c).navigator})),K=(new e.OlP("An abstraction over window.navigator.mediaDevices object",{factory:()=>(0,e.f3M)(n).mediaDevices}),new e.OlP("An abstraction over window.navigator.connection object",{factory:()=>(0,e.f3M)(n).connection||null}),new e.OlP("Shared Observable based on `document visibility changed`",{factory:()=>{const _=(0,e.f3M)(l.K0);return(0,m.R)(_,"visibilitychange").pipe((0,u.O)(0),(0,r.U)(()=>"hidden"!==_.visibilityState),(0,a.x)(),(0,M.d)({refCount:!1,bufferSize:1}))}}),new e.OlP("An abstraction over window.performance object",{factory:()=>(0,e.f3M)(c).performance}),new e.OlP("An abstraction over window.screen object",{factory:()=>(0,e.f3M)(c).screen}),new e.OlP("An abstraction over window.sessionStorage object",{factory:()=>(0,e.f3M)(c).sessionStorage}),new e.OlP("An abstraction over SpeechRecognition class",{factory:()=>{const _=(0,e.f3M)(c);return _.speechRecognition||_.webkitSpeechRecognition||null}}),new e.OlP("An abstraction over window.speechSynthesis object",{factory:()=>(0,e.f3M)(c).speechSynthesis}),new e.OlP("An abstraction over window.navigator.userAgent object",{factory:()=>(0,e.f3M)(n).userAgent}),new e.OlP("An abstraction over window.navigator.geolocation object",{factory:()=>(0,e.f3M)(n).geolocation})),G=new e.OlP("Token for an additional position options",{factory:()=>({})}),F=new e.OlP("Is Geolocation API supported?",{factory:()=>!!(0,e.f3M)(K)});let N=(()=>{class _ extends d.y{constructor(A,U,L){let T=0;return super(j=>{U||j.error("Geolocation is not supported in your browser"),T=A.watchPosition(w=>j.next(w),w=>j.error(w),L)}),this.pipe((0,p.x)(()=>A.clearWatch(T)),(0,M.d)({bufferSize:1,refCount:!0}))}}return _.\u0275fac=function(A){return new(A||_)(e.LFG(K),e.LFG(F),e.LFG(G))},_.\u0275prov=e.Yz7({token:_,factory:_.\u0275fac,providedIn:"root"}),_})()},9511:(g,S,t)=>{t.d(S,{f:()=>E});var e=t(5861),d=t(5963),p=t(4004),M=t(3151),m=t(1135),O=t(9300),u=t(2340),r=t(5e3),a=t(520),l=t(1271),c=t(629);let E=(()=>{class P{constructor(f,b,o){var h=this;this._http=f,this._snackbar=b,this._authService=o,this._time$=(0,d.H)(0,1e3).pipe((0,p.U)(n=>(this.TimeSubject.next(+this.TimeSubject.value+1e3),new Date)),(0,M.d)(1)),this._refreshTime$=(0,d.H)(0,6e4).pipe((0,p.U)(n=>{}),(0,M.d)(1)),this.TimeSubject=new m.X(+new Date),this.timer$.subscribe(()=>{}),this._refreshTime$.pipe((0,O.h)(()=>this._authService.isLoggedIn)).subscribe((0,e.Z)(function*(){try{yield h.getServerTime()}catch(n){h._snackbar.open(JSON.stringify(n),"error")}}))}get timer$(){return this._time$}get time$(){return this.TimeSubject.asObservable()}get currentTimestamp(){return this.TimeSubject.value}getServerTime(){return new Promise((f,b)=>{this._http.get(`${u.N.apiUrl}/get-time`,{responseType:"json"}).subscribe({next:o=>{this.TimeSubject.next(+new Date(o.Result)),f(o.Result)},error:o=>b(o.error),complete:()=>{}})})}}return P.\u0275fac=function(f){return new(f||P)(r.LFG(a.eN),r.LFG(l.ux),r.LFG(c.e))},P.\u0275prov=r.Yz7({token:P,factory:P.\u0275fac,providedIn:"root"}),P})()},8203:(g,S,t)=>{t.d(S,{H:()=>e});var e=(()=>{return(d=e||(e={})).in_range="Anda berada di dalam jangkauan presensi",d.out_range="Anda berada di luar jangkauan presensi",d.searching="Sedang mengambil lokasi",d.fetching="Sedang mengambil radius presensi",d.location_off="Akses lokasi mati",e;var d})()},2223:(g,S,t)=>{t.d(S,{v:()=>I});var e=t(5861),d=t(5963),p=t(4004),M=t(3151),m=t(1135),O=t(9300),u=t(2340),r=t(5e3),a=t(520),l=t(629),c=t(9511),E=t(1271),P=t(9808);let I=(()=>{class f{constructor(o,h,n,i,s){this._http=o,this._authService=h,this._timeService=n,this._snackbar=i,this._datePipe=s,this.apiUrl=`${u.N.apiUrl}/attendance`,this._refreshTime$=(0,d.H)(0,6e4).pipe((0,p.U)(v=>{}),(0,M.d)(1)),this.AttendanceStatusSubject=new m.X(null),this._refreshTime$.pipe((0,O.h)(()=>this._authService.isLoggedIn)).subscribe(()=>{this.getStatus()})}getStatus(){var o=this;return(0,e.Z)(function*(){var h,n;try{const i=yield o.status(o._authService.getUserData().id,o._datePipe.transform(o._timeService.currentTimestamp,"yyyy-MM-dd"));o.AttendanceStatusSubject.next(i)}catch(i){o._snackbar.open(null!==(n=null===(h=null==i?void 0:i.error)||void 0===h?void 0:h.Message)&&void 0!==n?n:JSON.stringify(i),"Error")}})()}get attendanceStatus$(){return this.AttendanceStatusSubject.asObservable()}get attendanceStatus(){return this.AttendanceStatusSubject.value}checkIn(o){const h=new FormData;return Object.keys(o).forEach(n=>{h.append(n,o[n])}),new Promise((n,i)=>{this._http.post(`${this.apiUrl}/checkIn`,h,{responseType:"json"}).subscribe({next:s=>n(s.Result),error:s=>i(s.error),complete:()=>{}})})}checkOut(o){const h=new FormData;return Object.keys(o).forEach(n=>{h.append(n,o[n])}),new Promise((n,i)=>{this._http.post(`${this.apiUrl}/checkOut`,h,{responseType:"json"}).subscribe({next:s=>n(s.Result),error:s=>i(s.error),complete:()=>{}})})}status(o,h){return new Promise((n,i)=>{this._http.post(`${this.apiUrl}/status`,{employee_id:o,date:h},{responseType:"json"}).subscribe({next:s=>n(s.Result),error:s=>i(s.error),complete:()=>{}})})}getAttendance(o,h,n){return new Promise((i,s)=>{this._http.get(`${this.apiUrl}/${o}?start_date=${encodeURIComponent(h)}&end_date=${encodeURIComponent(n)}`,{responseType:"json"}).subscribe({next:v=>i(v.Result),error:v=>s(v.error),complete:()=>{}})})}}return f.\u0275fac=function(o){return new(o||f)(r.LFG(a.eN),r.LFG(l.e),r.LFG(c.f),r.LFG(E.ux),r.LFG(P.uU))},f.\u0275prov=r.Yz7({token:f,factory:f.\u0275fac,providedIn:"root"}),f})()},1481:(g,S,t)=>{t.d(S,{a:()=>b});var e=t(5861),d=t(5963),p=t(4004),M=t(3151),m=t(1135),O=t(9300),u=t(5698),r=t(2340),a=t(8203),l=t(5e3),c=t(7445),E=t(704),P=t(629),I=t(1271),f=t(520);let b=(()=>{class o{constructor(n,i,s,v,D){this._geolocation=n,this._alertService=i,this._authService=s,this._snackBar=v,this._http=D,this._time$=(0,d.H)(0,5e3).pipe((0,p.U)(C=>{}),(0,M.d)(1)),this.LocationPermissionStatusSubject=new m.X(!1),this.CheckInOutCoordinateSubject=new m.X(null),this.PermissionStateSubject=new m.X("granted"),this.IsInValidLocationSubject=new m.X(!1),this.PositionStatusSubject=new m.X(a.H.location_off),this.PositionSubject=new m.X(null),this.init()}init(){var n=this;return(0,e.Z)(function*(){n._time$.pipe((0,O.h)(()=>n._authService.isLoggedIn)).subscribe((0,e.Z)(function*(){try{const i=(yield navigator.permissions.query({name:"geolocation"})).state;"denied"===i&&(n._snackBar.open("Gagal mendapat akses lokasi, izinkan akses lokasi untuk situs ini melalui pengaturan","OK"),n.updatePosition(null)),n.PermissionStateSubject.next(i),n.LocationPermissionStatusSubject.next("granted"===i)}catch(i){n.LocationPermissionStatusSubject.next(!1)}finally{n.updatePositionStatus()}}));try{yield n.getPosition(),n.LocationPermissionStatusSubject.next(!0)}catch(i){n.LocationPermissionStatusSubject.next(!1)}})()}getDistance(n,i){const s=B=>B*Math.PI/180;var D=s(i.lat-n.lat),C=s(i.lng-n.lng),y=Math.sin(D/2)*Math.sin(D/2)+Math.cos(s(n.lat))*Math.cos(s(i.lat))*Math.sin(C/2)*Math.sin(C/2);return 2*Math.atan2(Math.sqrt(y),Math.sqrt(1-y))*6378137}get position$(){return this._geolocation}get position(){return this.PositionSubject.value}get isLocationOn$(){return this.LocationPermissionStatusSubject.asObservable()}get checkInOutCoordinate$(){return this.CheckInOutCoordinateSubject.asObservable()}get isInValidLocation$(){return this.IsInValidLocationSubject.asObservable()}get isInValidLocation(){return this.IsInValidLocationSubject.value}get positionStatus$(){return this.PositionStatusSubject.asObservable()}get positionStatus(){return this.PositionStatusSubject.value}get checkInOutCoordinate(){return this.CheckInOutCoordinateSubject.value}get getPermissionState(){return this.PermissionStateSubject.value}get isLocationOn(){return this.LocationPermissionStatusSubject.value}updateCheckInOutCoordinate(n){this.CheckInOutCoordinateSubject.next(n),this.updatePositionStatus()}updatePosition(n){this.PositionSubject.next(n),this.updatePositionStatus()}updateDistance(n,i){const s=this.getDistance(n,i);this.IsInValidLocationSubject.next(!!this.checkInOutCoordinate&&s<=this.checkInOutCoordinate.radius),this.updatePositionStatus()}updatePositionStatus(){this.isLocationOn||this.position?this.isLocationOn&&!this.position?this.PositionStatusSubject.next(a.H.searching):this.isLocationOn&&this.position&&!this.checkInOutCoordinate?this.PositionStatusSubject.next(a.H.fetching):this.isLocationOn&&this.position&&!this.isInValidLocation?this.PositionStatusSubject.next(a.H.out_range):this.isLocationOn&&this.position&&this.isInValidLocation&&this.PositionStatusSubject.next(a.H.in_range):this.PositionStatusSubject.next(a.H.location_off)}getPosition(){var n=this;return(0,e.Z)(function*(){return new Promise((i,s)=>{n._geolocation.pipe((0,u.q)(1)).subscribe({next:v=>i(v),error:v=>s(v),complete:()=>{}})})})()}getCheckInOutCoordinate(){return new Promise((n,i)=>{this._http.get(`${r.N.apiUrl}/get-validation-location`,{responseType:"json"}).subscribe({next:s=>{var v;n(s.Result),this.updateCheckInOutCoordinate(null!==(v=s.Result)&&void 0!==v?v:null)},error:s=>i(s.error),complete:()=>{}})})}}return o.\u0275fac=function(n){return new(n||o)(l.LFG(c._1),l.LFG(E.c),l.LFG(P.e),l.LFG(I.ux),l.LFG(f.eN))},o.\u0275prov=l.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})()},3151:(g,S,t)=>{t.d(S,{d:()=>m});var e=t(7579),d=t(6063);class p extends e.x{constructor(u=1/0,r=1/0,a=d.l){super(),this._bufferSize=u,this._windowTime=r,this._timestampProvider=a,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,u),this._windowTime=Math.max(1,r)}next(u){const{isStopped:r,_buffer:a,_infiniteTimeWindow:l,_timestampProvider:c,_windowTime:E}=this;r||(a.push(u),!l&&a.push(c.now()+E)),this._trimBuffer(),super.next(u)}_subscribe(u){this._throwIfClosed(),this._trimBuffer();const r=this._innerSubscribe(u),{_infiniteTimeWindow:a,_buffer:l}=this,c=l.slice();for(let E=0;E<c.length&&!u.closed;E+=a?1:2)u.next(c[E]);return this._checkFinalizedStatuses(u),r}_trimBuffer(){const{_bufferSize:u,_timestampProvider:r,_buffer:a,_infiniteTimeWindow:l}=this,c=(l?1:2)*u;if(u<1/0&&c<a.length&&a.splice(0,a.length-c),!l){const E=r.now();let P=0;for(let I=1;I<a.length&&a[I]<=E;I+=2)P=I;P&&a.splice(0,P+1)}}}var M=t(3099);function m(O,u,r){let a,l=!1;return O&&"object"==typeof O?({bufferSize:a=1/0,windowTime:u=1/0,refCount:l=!1,scheduler:r}=O):a=null!=O?O:1/0,(0,M.B)({connector:()=>new p(a,u,r),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:l})}}}]);