PageSourceSearch

https://app-revamp.ynmodata.com/chunk-2D2XVFOQ.js

js ynmodata.com collected 2026-10-01 23:43:04 UTC 4,051 bytes, 1 lines download raw bytes

1import{r as A}from"./chunk-IJPJQ6VW.js";import{M as N}from"./chunk-L6QVANHB.js";import{Da as T,G as m,Ha as p,I as h,Ja as b,M as k,Zd as E,da as S,ea as P,oa as _,q as u,sa as g}from"./chunk-CUJEUYRS.js";import{a as l,b as c}from"./chunk-5BGJS47I.js";var a=(function(i){return i.Pending="pending",i.Success="success",i.NotExist="not_exist",i})(a||{}),O=(function(i){return i.DOC="doc",i.PDF="pdf",i.IMPORT_TARGET="import-target-to-student-library",i.GENERATE_REPORT="generate-report",i.USERS_USAGE="users-usage-report",i.ATTENDANCE_REPORT="generate-attendance-report",i})(O||{});var M=(()=>{let n=class n{constructor(){this.http=g(E),this.destroyRef=g(T),this._tasks=p([]),this.tasks=this._tasks.asReadonly(),this._taskCompleted=p(null),this.taskCompleted=this._taskCompleted.asReadonly(),this.globalPollingSubscription=null,this.POLLING_INTERVAL=3e4,this.MAX_POLLING_DURATION=6e5,this.STORAGE_KEY="ynmo_task_queue",this.pollingStartTime=null,this.loadFromLocalStorage(),b(()=>{this.saveToLocalStorage()})}addTask(t,s=!0){let e=c(l({},t),{status:a.Pending});this._tasks.update(o=>[e,...o]),s&&this.ensurePollingIsActive()}removeTask(t){this._tasks.update(s=>s.filter(e=>e.id!==t)),this.checkAndStopPollingIfNeeded()}getTask(t){return this._tasks().find(s=>s.id===t)}hasTask(t){return this._tasks().some(s=>s.id===t)}getTasksByStatus(t){return this._tasks().filter(s=>s.status===t)}updateTaskStatus(t,s,e){this._tasks.update(o=>o.map(r=>r.id===t?c(l({},r),{status:s,data:e??r.data}):r)),this.checkAndStopPollingIfNeeded()}ensurePollingIsActive(){this.globalPollingSubscription&&!this.globalPollingSubscription.closed||(this.pollingStartTime=Date.now(),this.globalPollingSubscription=m(this.POLLING_INTERVAL).pipe(S(0),N(this.destroyRef),h(()=>Date.now()-(this.pollingStartTime||0)>this.MAX_POLLING_DURATION?(console.warn("Task polling timeout reached (10 minutes)"),this.stopGlobalPolling(),!1):!0),P(()=>{let t=this._tasks().filter(s=>s.status===a.Pending).map(s=>s.id);return t.length===0?(this.stopGlobalPolling(),u(null)):this.checkTasksStatus(t).pipe(k(s=>(console.error("Error polling tasks:",s),u(null))))}),h(t=>t!==null)).subscribe({next:t=>{t&&this.processBatchResponse(t)},error:t=>{console.error("Fatal error in global polling:",t)}}))}stopGlobalPolling(){this.globalPollingSubscription&&(this.globalPollingSubscription.unsubscribe(),this.globalPollingSubscription=null,this.pollingStartTime=null)}checkAndStopPollingIfNeeded(){this._tasks().some(s=>s.status===a.Pending)||this.stopGlobalPolling()}clearCompletedTasks(){let t=this._tasks().filter(s=>s.status===a.Success||s.status===a.NotExist).map(s=>s.id);this._tasks.update(s=>s.filter(e=>!t.includes(e.id)))}checkTasksStatus(t){let s=t.join(","),e=`${A}/v3/user/bg-task-status?task_ids=${s}`;return this.http.get(e)}processBatchResponse(t){let s=t.data.map(e=>e.id);t.data.forEach(e=>{let o=this.mapApiStatusToTaskStatus(e.status),r=this.getTask(e.id);if(!r)return;let I=r.status===a.Pending&&o===a.Success;this._tasks.update(R=>R.map(d=>{if(d.id===e.id){let f=c(l({},d),{status:o,data:e.data??d.data});return I&&this._taskCompleted.set(f),f}return d}))}),this._tasks.update(e=>e.map(o=>o.status===a.Pending&&!s.includes(o.id)?(console.warn(`Task ${o.id} not found in API response, marking as NotExist`),c(l({},o),{status:a.NotExist})):o)),this.checkAndStopPollingIfNeeded()}mapApiStatusToTaskStatus(t){switch(t){case"pending":return a.Pending;case"done":return a.Success;case"not_exist":return a.NotExist}}saveToLocalStorage(){let t=this._tasks();try{localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t))}catch(s){console.error("Failed to save tasks to localStorage:",s)}}loadFromLocalStorage(){try{let t=localStorage.getItem(this.STORAGE_KEY);if(!t)return;let s=JSON.parse(t);this._tasks.set(s),s.some(o=>o.status===a.Pending)&&this.ensurePollingIsActive()}catch(t){console.error("Failed to load tasks from localStorage:",t)}}};n.\u0275fac=function(s){return new(s||n)},n.\u0275prov=_({token:n,factory:n.\u0275fac,providedIn:"root"});let i=n;return i})();export{a,O as b,M as c};

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.