1import{m as T,j as t,B as h,T as j,M as D,h as Q,a_ as E,g as B,r as m,ab as L,ac as M,fd as I,fe as N}from"./index-DD7wEX2k.js";import{P as q}from"./Page-mik8EZ_Q.js";import{Q as H}from"./QuickPublishProvider-DieFiLlw.js";import{Q as Y}from"./QuickPublishHeader-ImGgy_Xy.js";import{P as F,a as $}from"./ProgressError-KjSlaW4z.js";import{u as A}from"./useQuickListingProcess-CNX7Zf_z.js";import{C as W}from"./Card-CU05tOYa.js";import"./category-DUZbJLBl.js";import"./EbayFormatAndDuration-xR4mpbeI.js";import"./formik.esm-y-epKQ_W.js";import"./toString-BpP3vzIR.js";import"./formik-material-ui.es6-Brkbu6Gk.js";import"./RadioGroup-DH1Vw7cH.js";import"./RadioGroupContext-CcoEOJr4.js";import"./Switch-y6CmP1sJ.js";import"./Grid-eV9hG1VW.js";import"./Help-DIwhWvl8.js";import"./Radio-CiD3rp-4.js";import"./ArrowBack-DPKRexet.js";import"./HeaderPageTitle-y5EsJ77J.js";import"./QuickPublishGuide-Bi7Y7C-Q.js";import"./QuickPublishButton-ytqJnEz7.js";import"./AllProductContext-C2skYRpJ.js";import"./AddCircle-DX2bIQku.js";import"./FlashOn-Bqxnp7Mt.js";import"./ActionButtonMenu-BC9lDWO8.js";import"./ArrowDropDown-AeO9ZKDt.js";import"./ArrowDropUp-xVit32Pr.js";import"./utils-Bgys39Sh.js";import"./Publish-JkXB9gP0.js";import"./ToggleOn-DyW7ZvlH.js";import"./Delete-TaFDY8Lv.js";import"./AddCircleOutline-COf8fMgR.js";import"./Update-CQ15_MJp.js";import"./link-B9vAowY9.js";import"./CheckCircle-CmxgKwYs.js";import"./Error-7a3T13Bv.js";import"./ArrowForward-Bg5DeRrc.js";import"./ErrorOutline-D7mkD75C.js";const z=T(e=>({primaryText:{color:e.palette.primary.main},root:{backgroundColor:e.palette.background.dark,minHeight:"100%",paddingTop:e.spacing(3)}}));function G({imported:e=0,total:i=0,timeEstimate:l=1,initProcess:r={}}){const c=z(),a=!!(r!=null&&r.is_quick_listing_schedule)&&!!(r!=null&&r.schedule_id),f=(!e&&!i?r.imported/r.total:e/i)*100;return t.jsxs(h,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",p:4,width:"100%",children:[t.jsx(j,{variant:"h5",children:"Your products are being published from your Main Store to your Channel"}),t.jsx(j,{variant:"body2",color:"textSecondary",gutterBottom:!0,children:a?t.jsx(t.Fragment,{children:"You can safely leave this page â the process wonât be interrupted. If you want to create another publish process, please wait until this one is completed."}):t.jsx(t.Fragment,{children:"You can safely leave this page â weâre working in the background and it should only take a moment."})}),t.jsx(h,{mt:4,mb:2,children:t.jsx("img",{height:330,src:"/static/gif/quick_publish_progress.gif",alt:"publishing",style:{background:"#d5e5ff",borderRadius:10}})}),t.jsxs(h,{width:"80%",children:[t.jsxs(j,{variant:"subtitle2",children:["Working on"," ",t.jsxs("span",{className:c.primaryText,children:[e||(r==null?void 0:r.imported)||0," of ",i||(r==null?void 0:r.total)||0]})," ","products | About"," ",t.jsxs("span",{className:c.primaryText,children:[Math.max(1,Math.ceil(l))," minutes"]})," ","remaining"]}),t.jsx(D,{variant:"determinate",value:f})]}),t.jsx(h,{height:100})]})}const J=T(e=>({primaryText:{color:e.palette.primary.main},root:{backgroundColor:e.palette.background.dark,minHeight:"100%",paddingTop:e.spacing(3)},cardStyle:{marginTop:16}})),K=e=>e<=100?1e4:e<=300?15e3:e<=800?3e4:6e4;function Bt(){const e=J(),i=Q(),{channel_id:l,publish_id:r}=E(),{fetchingProcessList:c}=B(n=>n.account),a=A({channelId:l,processId:r,onlyRunning:!1}),u=a==null?void 0:a.total,[f,S]=m.useState(0),[R,_]=m.useState(0),[s,b]=m.useState({imported:0,total:0}),p=m.useRef(null),x=m.useRef(0);m.useEffect(()=>{if(!r)return;x.current=0;const n=async()=>{try{const o=(await I.get.getProgressDetail(r)).data.process;if(o){b(o);const k=o==null?void 0:o.imported,C=o==null?void 0:o.total,v=k-f;if(v>0){const y=(C-k)/v*15;_(y/60)}if(S(o?o==null?void 0:o.imported:0),o.imported===o.total||o.status==="Done"){clearInterval(p.current);const y=await I.get.getProgress();i(N(y.data))}}else b(null)}catch(g){console.log(g)}x.current+=1,x.current>=200&&p.current&&clearInterval(p.current)};n();const d=K(u);return p.current=setInterval(n,d),()=>{p.current&&clearInterval(p.current)}},[i,r]);const w=()=>{var n;if((a==null?void 0:a.status)==="Done"||(a==null?void 0:a.status)==="done"){const d=((n=s==null?void 0:s.products_status)==null?void 0:n.error)||{},g=s==null?void 0:s.imported;return d>=10&&d<u&&g<u?t.jsx(F,{channelId:l}):t.jsx($,{result:s,channelId:l})}return t.jsx(G,{initProcess:a,imported:s==null?void 0:s.imported,total:s==null?void 0:s.total,timeEstimate:R})};return!c&&!a?t.jsx(L,{to:`/quick-publish/${l}`}):t.jsx(q,{className:e.root,title:"Quick Publish",children:t.jsx(M,{children:t.jsxs(H,{
1children:[t.jsx(Y,{}),t.jsx(W,{className:e.cardStyle,children:w()})]})})})}export{Bt as default};
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.