1import{aC as o}from"./index-0kZAOJX9.js";import{h as s}from"./Icon20_Subscribe-Cq8nONZx.js";import{A as t,z as n}from"./ui-components-Bkqosso1.js";import{o as e}from"./vendor-utils-tIUf6iEz.js";function a(a){const{needUnmountStop:i=!0,unlimited:l=!0,retryInterval:r=5e3}=a||{};let d=!1;const u=o({needUnmountStop:i,unlimited:l}),m=async(o,n)=>{const e=await s({task_type:n??1,pid:t.AppId,task_ids:o}),a={};return o.forEach((o=>{const s=e.find((s=>s.task_id===o));s&&(a[o]=s)})),a},c=o=>!o||1===(null==o?void 0:o.status),k=async o=>{const s={onDone:(s,t)=>{n().refreshCreditsInfo(3);const e=(null==o?void 0:o.onDone)||(null==a?void 0:a.onDone);null==e||e(s,t)},onTimeout:s=>{const t=(null==o?void 0:o.onTimeout)||(null==a?void 0:a.onTimeout);null==t||t(s)},onProgress:(s,t)=>{const n=(null==o?void 0:o.onProgress)||(null==a?void 0:a.onProgress);null==n||n(s,t)}};try{await u.loopByTaskIds({loopApi:m,taskType:null==o?void 0:o.taskType,continueCondition:c,maxRetries:(null==o?void 0:o.maxRetries)||(null==a?void 0:a.maxRetries),retryInterval:(null==o?void 0:o.retryInterval)||r,callbacks:s});d=!1}catch(t){d=!1}};return{startPolling:k,stopPolling:u.stopPolling,addTask:(o,s)=>{u.addTask(o);const t=(null==s?void 0:s.immediate)??!0;!d&&t&&(d=!0,k(e(s,"immediate")))},addTasks:(o,s)=>{u.addTasks(o);const t=(null==s?void 0:s.immediate)??!0;!d&&t&&(d=!0,k(e(s,"immediate")))},removeTask:o=>{u.removeTask(o)},clearTasks:u.clearTasks,getTaskStatus:u.getTaskStatus,getAllTasks:u.getAllTasks,taskList:u.taskList}}export{a as u};
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.