@l10nmonster/server 3.0.0-alpha.15 → 3.0.0-alpha.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{a8 as Fe,u as Pe,a0 as Ae,r as l,ad as Ie,i as Oe,j as e,B as n,S as Z,A as Re,T as r,F as B,a9 as O,aa as R,ab as $,v as ee,V as f,ac as W,ak as $e,al as De,am as Le,an as Ne,ao as qe,ap as Ge,aq as Ee,$ as Me,L as Ue,h as _e,b as se,c as le,d as ie,e as ae,f as ce,l as Ye,m as Ve,n as He,o as Qe,p as Ke,q as de,s as he,t as ue}from"./vendor-BVSmEsOp.js";import{c as Je,f as xe}from"./index-Dl1WS_Lc.js";function te(d){return d.map(h=>typeof h=="string"?h:`{{${h.t}}}`).join("")}const Y=({columnName:d,label:h,value:s,onChange:I,onFocus:j,onBlur:S,inputRef:i,lowCardinalityOptions:P,placeholder:u})=>P&&P.length>0?e.jsxs(Ye,{value:s?[s]:[],onValueChange:a=>{},positioning:{strategy:"absolute",placement:"bottom-start",flip:!0,gutter:4},children:[e.jsxs(Ve,{size:"xs",bg:"yellow.subtle",onFocus:j,onBlur:S,ref:i,children:[e.jsx(r,{fontSize:"xs",flex:"1",textAlign:"left",color:s?"fg.default":"fg.muted",children:s||u}),e.jsx(He,{})]}),e.jsx(Qe,{children:e.jsxs(Ke,{zIndex:1e3,bg:"white",borderWidth:"1px",borderColor:"border.default",borderRadius:"md",shadow:"lg",maxH:"200px",overflow:"auto",children:[s&&e.jsxs(de,{item:"",value:"",onClick:()=>I(""),children:[e.jsx(he,{children:"---"}),e.jsx(ue,{})]}),P.slice().sort((a,V)=>a.localeCompare(V)).map(a=>e.jsxs(de,{item:a,value:a,onClick:()=>I(a),children:[e.jsx(he,{children:a}),e.jsx(ue,{})]},a))]})})]}):e.jsx(W,{size:"xs",placeholder:u,value:s,onChange:a=>I(a.target.value),onFocus:j,onBlur:S,ref:i,bg:"yellow.subtle"}),et=()=>{const{sourceLang:d,targetLang:h}=Fe();Pe();const[s,I]=Ae(),[j,S]=l.useState(new Set),[i,P]=l.useState(()=>({guid:s.get("guid")||"",nid:s.get("nid")||"",rid:s.get("rid")||"",sid:s.get("sid")||"",nsrc:s.get("nsrc")||"",ntgt:s.get("ntgt")||"",tconf:s.get("tconf")||"",q:s.get("q")||"",translationProvider:s.get("translationProvider")||"",jobGuid:s.get("jobGuid")||"",channel:s.get("channel")||"",minTS:s.get("minTS")||"",maxTS:s.get("maxTS")||""})),[u,re]=l.useState(()=>{const t=s.get("active");return t!==null?t==="1":!0}),[a,V]=l.useState(()=>s.get("showTechnicalColumns")==="1"),[b,ge]=l.useState(()=>s.get("showTNotes")==="1"),[g,pe]=l.useState(()=>s.get("showOnlyLeveraged")==="1"),[x,H]=l.useState(()=>({guid:s.get("guid")||"",nid:s.get("nid")||"",rid:s.get("rid")||"",sid:s.get("sid")||"",nsrc:s.get("nsrc")||"",ntgt:s.get("ntgt")||"",tconf:s.get("tconf")||"",q:s.get("q")||"",translationProvider:s.get("translationProvider")||"",jobGuid:s.get("jobGuid")||"",channel:s.get("channel")||"",minTS:s.get("minTS")||"",maxTS:s.get("maxTS")||""})),q=l.useRef(),k=l.useRef(),F=l.useRef(),D=l.useRef(null),m=l.useRef({}),[G,E]=l.useState(""),[M,U]=l.useState(""),[be,Q]=l.useState(!1),fe=l.useMemo(()=>["tmSearch",d,h,i,u,b,g],[d,h,i,u,b,g]),{data:K,isLoading:L,isError:me,error:je,fetchNextPage:ne,hasNextPage:J,isFetchingNextPage:X}=Ie({queryKey:fe,queryFn:async({pageParam:t=1})=>{const o=new URLSearchParams({sourceLang:d,targetLang:h,page:t.toString(),limit:"100",...Object.fromEntries(Object.entries(i).filter(([p,A])=>A.trim()!=="")),...u&&{active:"1"},...b&&{onlyTNotes:"1"}});if(i.minTS&&/^\d{1,2}\/\d{1,2}$/.test(i.minTS)){const p=new Date().getFullYear(),[A,w]=i.minTS.split("/"),N=new Date(`${p}-${A.padStart(2,"0")}-${w.padStart(2,"0")}T00:00:00`);o.set("minTS",N.getTime().toString())}if(i.maxTS&&/^\d{1,2}\/\d{1,2}$/.test(i.maxTS)){const p=new Date().getFullYear(),[A,w]=i.maxTS.split("/"),N=new Date(`${p}-${A.padStart(2,"0")}-${w.padStart(2,"0")}T23:59:59.999`);o.set("maxTS",N.getTime().toString())}return await xe(`/api/tm/search?${o}`)},getNextPageParam:(t,o)=>t.data.length===parseInt(t.limit)?o.length+1:void 0,staleTime:3e4,refetchOnWindowFocus:!1,placeholderData:t=>t}),{data:_={}}=Oe({queryKey:["lowCardinalityColumns",d,h],queryFn:()=>xe(`/api/tm/lowCardinalityColumns/${d}/${h}`),staleTime:300*1e3}),T=l.useMemo(()=>{let t=K?.pages.flatMap(o=>o.data)||[];return g&&(t=t.filter(o=>o.channel!==null&&o.channel!==void 0&&o.channel!=="")),t},[K,g]),Se=l.useCallback(t=>{L||X||(q.current&&q.current.disconnect(),q.current=new IntersectionObserver(o=>{o[0].isIntersecting&&J&&ne()}),t&&q.current.observe(t))},[L,X,J,ne]),v=l.useCallback(t=>{D.current=t},[]),y=l.useCallback(()=>{D.current=null},[]),C=l.useCallback((t,o,c,p,A)=>{const w=new URLSearchParams;Object.entries(t).forEach(([N,oe])=>{oe.trim()!==""&&w.set(N,oe)}),o?Object.keys(Object.fromEntries(w)).length>0&&w.set("active","1"):w.set("active","0"),c&&w.set("showTechnicalColumns","1"),p&&w.set("showTNotes","1"),A&&w.set("showOnlyLeveraged","1"),I(w,{replace:!0})},[I]),z=l.useCallback((t,o)=>{H(c=>({...c,[t]:o})),S(new Set),clearTimeout(k.current),k.current=setTimeout(()=>{const c={...i,[t]:o};P(c),clearTimeout(F.current),F.current=setTimeout(()=>{C(c,u,a,b,g)},200)},300)},[i,u,a,b,g,C]),Ce=(t,o)=>{const c=new Set(j);o?c.add(t):c.delete(t),S(c)},we=t=>{if(t){const o=new Set(T.map((c,p)=>p));S(o)}else S(new Set)},Te=()=>{const t=Array.from(j).map(o=>T[o]);Je(d,h,t),S(new Set)},ve=T.length>0&&j.size===T.length,ye=j.size>0&&j.size<T.length;l.useEffect(()=>{if(D.current&&m.current[D.current]){const t=m.current[D.current];setTimeout(()=>{if(t&&document.contains(t)&&(t.focus(),typeof t.setSelectionRange=="function"&&t.value)){const o=t.value.length;t.setSelectionRange(o,o)}},10)}},[T]);const ze=l.useCallback(t=>{re(t),C(i,t,a,b,g)},[i,a,b,g,C]),We=l.useCallback(t=>{ge(t),S(new Set),C(i,u,a,t,g)},[i,u,a,g,C]),Be=l.useCallback(t=>{pe(t),S(new Set),C(i,u,a,b,t)},[i,u,a,b,C]),ke=l.useCallback(t=>{V(t),C(i,u,t,b,g)},[i,u,b,g,C]);return l.useEffect(()=>()=>{k.current&&clearTimeout(k.current),F.current&&clearTimeout(F.current)},[]),L&&T.length===0&&!K?e.jsx(n,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(Z,{size:"xl"})}):me?e.jsx(n,{mt:5,px:6,children:e.jsx(Re,{status:"error",children:e.jsxs(n,{children:[e.jsx(r,{fontWeight:"bold",children:"Error"}),e.jsx(r,{children:je?.message||"Failed to fetch translation memory data"})]})})}):e.jsxs(n,{children:[e.jsx(n,{bg:"blue.subtle",borderBottom:"1px",borderColor:"blue.muted",shadow:"md",borderLeft:"4px",borderLeftColor:"blue.500",px:6,py:4,mb:6,children:e.jsxs(B,{align:"center",justify:"space-between",children:[e.jsxs(B,{align:"center",gap:3,children:[e.jsxs(r,{fontSize:"md",fontWeight:"semibold",color:"blue.700",children:[d," → ",h]}),L&&e.jsx(Z,{size:"sm"})]}),e.jsxs(B,{align:"center",gap:3,children:[e.jsxs(B,{align:"center",gap:2,children:[e.jsx(r,{fontSize:"sm",color:"blue.600",children:"Show Technical IDs"}),e.jsxs(O,{checked:a,onCheckedChange:t=>ke(t.checked),size:"sm",children:[e.jsx(R,{}),e.jsx($,{})]})]}),e.jsxs(B,{align:"center",gap:2,children:[e.jsx(r,{fontSize:"sm",color:"blue.600",children:"Only Leveraged"}),e.jsxs(O,{checked:g,onCheckedChange:t=>Be(t.checked),size:"sm",children:[e.jsx(R,{}),e.jsx($,{})]})]}),e.jsxs(B,{align:"center",gap:2,children:[e.jsx(r,{fontSize:"sm",color:"blue.600",children:"Only TNotes"}),e.jsxs(O,{checked:b,onCheckedChange:t=>We(t.checked),size:"sm",children:[e.jsx(R,{}),e.jsx($,{})]})]}),j.size>0&&e.jsxs(ee,{colorPalette:"blue",onClick:Te,children:["Add to Cart (",j.size," ",j.size===1?"TU":"TUs",")"]})]})]})}),e.jsxs(n,{mx:6,h:"calc(100vh - 180px)",bg:"white",borderRadius:"lg",shadow:"sm",overflow:"auto",children:[e.jsxs(n,{as:"table",w:"100%",fontSize:"sm",children:[e.jsx(n,{as:"thead",position:"sticky",top:0,bg:"blue.subtle",zIndex:1,borderBottom:"2px",borderColor:"blue.muted",shadow:"sm",children:e.jsxs(n,{as:"tr",children:[e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"60px",textAlign:"center",children:e.jsxs(O,{checked:ve,onCheckedChange:t=>we(t.checked),children:[e.jsx(R,{ref:t=>{t&&(t.indeterminate=ye)}}),e.jsx($,{})]})}),a&&e.jsxs(e.Fragment,{children:[e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"guid"}),e.jsx(W,{size:"xs",placeholder:"Filter GUID...",value:x.guid,onChange:t=>z("guid",t.target.value),onFocus:()=>v("guid"),onBlur:y,ref:t=>{t&&(m.current.guid=t)},bg:"yellow.subtle"},"guid-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"nid"}),e.jsx(W,{size:"xs",placeholder:"Filter NID...",value:x.nid,onChange:t=>z("nid",t.target.value),onFocus:()=>v("nid"),onBlur:y,ref:t=>{t&&(m.current.nid=t)},bg:"yellow.subtle"},"nid-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"jobGuid"}),e.jsx(W,{size:"xs",placeholder:"Filter Job GUID...",value:x.jobGuid,onChange:t=>z("jobGuid",t.target.value),onFocus:()=>v("jobGuid"),onBlur:y,ref:t=>{t&&(m.current.jobGuid=t)},bg:"yellow.subtle"},"jobGuid-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"150px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"rid"}),e.jsx(W,{size:"xs",placeholder:"Filter RID...",value:x.rid,onChange:t=>z("rid",t.target.value),onFocus:()=>v("rid"),onBlur:y,ref:t=>{t&&(m.current.rid=t)},bg:"yellow.subtle"},"rid-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"150px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"sid"}),e.jsx(W,{size:"xs",placeholder:"Filter SID...",value:x.sid,onChange:t=>z("sid",t.target.value),onFocus:()=>v("sid"),onBlur:y,ref:t=>{t&&(m.current.sid=t)},bg:"yellow.subtle"},"sid-input")]})})]}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Channel"}),e.jsx(Y,{columnName:"channel",label:"Channel",value:x.channel,onChange:t=>z("channel",t),onFocus:()=>v("channel"),onBlur:y,inputRef:t=>{t&&(m.current.channel=t)},lowCardinalityOptions:_.channel,placeholder:"Channel..."})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"350px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",textAlign:d?.startsWith("he")||d?.startsWith("ar")?"right":"left",children:"Source"}),e.jsx(W,{size:"xs",placeholder:"Filter source...",value:x.nsrc,onChange:t=>z("nsrc",t.target.value),onFocus:()=>v("nsrc"),onBlur:y,ref:t=>{t&&(m.current.nsrc=t)},bg:"yellow.subtle",dir:d?.startsWith("he")||d?.startsWith("ar")?"rtl":"ltr"},"nsrc-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"350px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",textAlign:h?.startsWith("he")||h?.startsWith("ar")?"right":"left",children:"Target"}),e.jsx(W,{size:"xs",placeholder:"Filter target...",value:x.ntgt,onChange:t=>z("ntgt",t.target.value),onFocus:()=>v("ntgt"),onBlur:y,ref:t=>{t&&(m.current.ntgt=t)},bg:"yellow.subtle",dir:h?.startsWith("he")||h?.startsWith("ar")?"rtl":"ltr"},"ntgt-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"60px",textAlign:"center",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"TConf"}),e.jsx(Y,{columnName:"tconf",label:"TConf",value:x.tconf,onChange:t=>z("tconf",t),onFocus:()=>v("tconf"),onBlur:y,inputRef:t=>{t&&(m.current.tconf=t)},lowCardinalityOptions:_.tconf,placeholder:"TConf..."})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"40px",textAlign:"center",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"q"}),e.jsx(Y,{columnName:"q",label:"Quality",value:x.q,onChange:t=>z("q",t),onFocus:()=>v("q"),onBlur:y,inputRef:t=>{t&&(m.current.q=t)},lowCardinalityOptions:_.q,placeholder:"Quality..."})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Provider"}),e.jsx(Y,{columnName:"translationProvider",label:"Provider",value:x.translationProvider,onChange:t=>z("translationProvider",t),onFocus:()=>v("translationProvider"),onBlur:y,inputRef:t=>{t&&(m.current.translationProvider=t)},lowCardinalityOptions:_.translationProvider,placeholder:"Provider..."})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"80px",textAlign:"center",children:e.jsxs(f,{gap:2,align:"center",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Active"}),e.jsxs(O,{checked:u,onCheckedChange:t=>ze(t.checked),size:"sm",children:[e.jsx(R,{}),e.jsx($,{})]})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"center",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Timestamp"}),e.jsxs($e,{open:be,onOpenChange:t=>{Q(t.open),t.open&&(E(x.minTS),U(x.maxTS))},children:[e.jsx(De,{asChild:!0,children:e.jsx(r,{fontSize:"xs",cursor:"pointer",color:"blue.600",textDecoration:"underline",_hover:{color:"blue.700"},px:2,py:1,children:x.minTS||x.maxTS?`${x.minTS||"start"} → ${x.maxTS||"end"}`:"Filter dates..."})}),e.jsx(Le,{children:e.jsxs(Ne,{children:[e.jsx(qe,{}),e.jsx(Ge,{children:e.jsx(r,{fontSize:"sm",fontWeight:"semibold",children:"Date Range Filter"})}),e.jsx(Ee,{children:e.jsxs(f,{gap:3,align:"stretch",children:[e.jsxs(n,{children:[e.jsx(r,{fontSize:"xs",mb:1,color:"fg.muted",children:"From"}),e.jsx(W,{type:"date",size:"sm",value:G?(()=>{const[t,o]=G.split("/");return`${new Date().getFullYear()}-${t?.padStart(2,"0")}-${o?.padStart(2,"0")}`})():"",onChange:t=>{if(t.target.value){const[o,c,p]=t.target.value.split("-");E(`${parseInt(c,10)}/${parseInt(p,10)}`),setTimeout(()=>t.target.blur(),0)}else E("")}})]}),e.jsxs(n,{children:[e.jsx(r,{fontSize:"xs",mb:1,color:"fg.muted",children:"To"}),e.jsx(W,{type:"date",size:"sm",value:M?(()=>{const[t,o]=M.split("/");return`${new Date().getFullYear()}-${t?.padStart(2,"0")}-${o?.padStart(2,"0")}`})():"",onChange:t=>{if(t.target.value){const[o,c,p]=t.target.value.split("-");U(`${parseInt(c,10)}/${parseInt(p,10)}`),setTimeout(()=>t.target.blur(),0)}else U("")}})]}),e.jsxs(Me,{gap:2,children:[e.jsx(ee,{size:"sm",variant:"outline",flex:1,onClick:()=>{H(t=>({...t,minTS:"",maxTS:""})),S(new Set),clearTimeout(k.current),k.current=setTimeout(()=>{const t={...i,minTS:"",maxTS:""};P(t),clearTimeout(F.current),F.current=setTimeout(()=>{C(t,u,a,b,g)},200)},300),E(""),U(""),Q(!1)},children:"Clear"}),e.jsx(ee,{size:"sm",colorPalette:"blue",flex:1,onClick:()=>{H(t=>({...t,minTS:G,maxTS:M})),S(new Set),clearTimeout(k.current),k.current=setTimeout(()=>{const t={...i,minTS:G,maxTS:M};P(t),clearTimeout(F.current),F.current=setTimeout(()=>{C(t,u,a,b,g)},200)},300),Q(!1)},children:"Apply"})]})]})})]})})]})]})})]})}),e.jsx(n,{as:"tbody",children:T.map((t,o)=>e.jsxs(n,{as:"tr",ref:o===T.length-20?Se:null,_hover:{bg:"gray.subtle"},children:[e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsxs(O,{checked:j.has(o),onCheckedChange:c=>Ce(o,c.checked),children:[e.jsx(R,{}),e.jsx($,{})]})}),a&&e.jsxs(e.Fragment,{children:[e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"blue.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",children:t.guid})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"purple.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",children:t.nid||""})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"green.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",cursor:"pointer",_hover:{textDecoration:"underline"},onClick:c=>{c.preventDefault(),window.open(`/job/${t.jobGuid}`,"_blank")},children:t.jobGuid})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",wordBreak:"break-all",whiteSpace:"normal",children:t.rid})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",wordBreak:"break-all",whiteSpace:"normal",children:t.sid})})]}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:t.channel?e.jsx(Ue,{as:_e,to:`/sources/${t.channel}?rid=${encodeURIComponent(t.rid)}&guid=${encodeURIComponent(t.guid)}`,fontSize:"xs",color:"blue.600",_hover:{textDecoration:"underline"},children:t.channel}):e.jsx(r,{fontSize:"xs",children:t.channel})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:t.notes?e.jsxs(se,{children:[e.jsx(le,{asChild:!0,children:e.jsx(r,{fontSize:"xs",noOfLines:2,cursor:"help",dir:d?.startsWith("he")||d?.startsWith("ar")?"rtl":"ltr",children:te(t.nsrc)})}),e.jsx(ie,{children:e.jsxs(ae,{maxW:"400px",bg:"yellow.100",borderWidth:"1px",borderColor:"yellow.300",shadow:"lg",children:[e.jsx(ce,{}),e.jsxs(n,{children:[t.notes.desc&&e.jsx(r,{fontSize:"sm",mb:2,whiteSpace:"pre-wrap",color:"black",children:t.notes.desc}),t.notes.ph&&e.jsxs(n,{children:[e.jsx(r,{fontSize:"xs",fontWeight:"bold",color:"gray.600",mb:1,children:"Placeholders:"}),Object.entries(t.notes.ph).map(([c,p])=>e.jsxs(n,{mb:1,children:[e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"blue.600",children:c}),e.jsxs(r,{fontSize:"xs",color:"gray.600",children:[p.desc," (e.g., ",p.sample,")"]})]},c))]})]})]})})]}):e.jsx(r,{fontSize:"xs",noOfLines:2,dir:d?.startsWith("he")||d?.startsWith("ar")?"rtl":"ltr",children:te(t.nsrc)})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",noOfLines:2,dir:h?.startsWith("he")||h?.startsWith("ar")?"rtl":"ltr",children:te(t.ntgt)})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:t.tnotes?e.jsxs(se,{children:[e.jsx(le,{asChild:!0,children:e.jsx(r,{fontSize:"xs",fontWeight:"bold",cursor:"help",children:t.tconf||""})}),e.jsx(ie,{children:e.jsxs(ae,{maxW:"400px",bg:"yellow.100",borderWidth:"1px",borderColor:"yellow.300",shadow:"lg",children:[e.jsx(ce,{}),e.jsx(r,{fontSize:"sm",whiteSpace:"pre-wrap",color:"black",children:t.tnotes})]})})]}):e.jsx(r,{fontSize:"xs",children:t.tconf||""})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsx(r,{fontSize:"xs",children:t.q})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",children:t.translationProvider})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:t.active===1&&e.jsx(r,{fontSize:"lg",color:"green.500",children:"✓"})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsx(r,{fontSize:"xs",color:"fg.muted",children:t.ts?new Date(t.ts).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""})})]},`${o}-${t.guid||t.nid||o}`))})]}),X&&e.jsx(B,{justify:"center",p:4,children:e.jsx(Z,{size:"md"})}),!J&&T.length>0&&e.jsx(B,{justify:"center",p:4,children:e.jsx(r,{color:"fg.muted",fontSize:"sm",children:"No more results"})}),T.length===0&&!L&&e.jsx(B,{justify:"center",p:8,children:e.jsx(r,{color:"fg.muted",children:"No translation units found for the current filters"})})]})]})};export{et as default};
1
+ import{a9 as Fe,u as Pe,a1 as Ae,r as l,ad as Ie,i as Oe,j as e,B as n,S as Z,A as Re,T as r,F as B,aa as O,ab as R,ac as $,v as ee,V as f,K as W,ak as $e,al as De,am as Le,an as Ne,ao as qe,ap as Ge,aq as Ee,a0 as Me,L as Ue,h as _e,b as se,c as le,d as ie,e as ae,f as ce,l as Ye,m as Ve,n as He,o as Qe,p as Ke,q as de,s as he,t as ue}from"./vendor-BAKw9_tP.js";import{c as Je,f as xe}from"./index-CuIl8QRT.js";function te(d){return d.map(h=>typeof h=="string"?h:`{{${h.t}}}`).join("")}const Y=({columnName:d,label:h,value:s,onChange:I,onFocus:j,onBlur:S,inputRef:i,lowCardinalityOptions:P,placeholder:u})=>P&&P.length>0?e.jsxs(Ye,{value:s?[s]:[],onValueChange:a=>{},positioning:{strategy:"absolute",placement:"bottom-start",flip:!0,gutter:4},children:[e.jsxs(Ve,{size:"xs",bg:"yellow.subtle",onFocus:j,onBlur:S,ref:i,children:[e.jsx(r,{fontSize:"xs",flex:"1",textAlign:"left",color:s?"fg.default":"fg.muted",children:s||u}),e.jsx(He,{})]}),e.jsx(Qe,{children:e.jsxs(Ke,{zIndex:1e3,bg:"white",borderWidth:"1px",borderColor:"border.default",borderRadius:"md",shadow:"lg",maxH:"200px",overflow:"auto",children:[s&&e.jsxs(de,{item:"",value:"",onClick:()=>I(""),children:[e.jsx(he,{children:"---"}),e.jsx(ue,{})]}),P.slice().sort((a,V)=>a.localeCompare(V)).map(a=>e.jsxs(de,{item:a,value:a,onClick:()=>I(a),children:[e.jsx(he,{children:a}),e.jsx(ue,{})]},a))]})})]}):e.jsx(W,{size:"xs",placeholder:u,value:s,onChange:a=>I(a.target.value),onFocus:j,onBlur:S,ref:i,bg:"yellow.subtle"}),et=()=>{const{sourceLang:d,targetLang:h}=Fe();Pe();const[s,I]=Ae(),[j,S]=l.useState(new Set),[i,P]=l.useState(()=>({guid:s.get("guid")||"",nid:s.get("nid")||"",rid:s.get("rid")||"",sid:s.get("sid")||"",nsrc:s.get("nsrc")||"",ntgt:s.get("ntgt")||"",tconf:s.get("tconf")||"",q:s.get("q")||"",translationProvider:s.get("translationProvider")||"",jobGuid:s.get("jobGuid")||"",channel:s.get("channel")||"",minTS:s.get("minTS")||"",maxTS:s.get("maxTS")||""})),[u,re]=l.useState(()=>{const t=s.get("active");return t!==null?t==="1":!0}),[a,V]=l.useState(()=>s.get("showTechnicalColumns")==="1"),[b,ge]=l.useState(()=>s.get("showTNotes")==="1"),[g,pe]=l.useState(()=>s.get("showOnlyLeveraged")==="1"),[x,H]=l.useState(()=>({guid:s.get("guid")||"",nid:s.get("nid")||"",rid:s.get("rid")||"",sid:s.get("sid")||"",nsrc:s.get("nsrc")||"",ntgt:s.get("ntgt")||"",tconf:s.get("tconf")||"",q:s.get("q")||"",translationProvider:s.get("translationProvider")||"",jobGuid:s.get("jobGuid")||"",channel:s.get("channel")||"",minTS:s.get("minTS")||"",maxTS:s.get("maxTS")||""})),q=l.useRef(),k=l.useRef(),F=l.useRef(),D=l.useRef(null),m=l.useRef({}),[G,E]=l.useState(""),[M,U]=l.useState(""),[be,Q]=l.useState(!1),fe=l.useMemo(()=>["tmSearch",d,h,i,u,b,g],[d,h,i,u,b,g]),{data:K,isLoading:L,isError:me,error:je,fetchNextPage:ne,hasNextPage:J,isFetchingNextPage:X}=Ie({queryKey:fe,queryFn:async({pageParam:t=1})=>{const o=new URLSearchParams({sourceLang:d,targetLang:h,page:t.toString(),limit:"100",...Object.fromEntries(Object.entries(i).filter(([p,A])=>A.trim()!=="")),...u&&{active:"1"},...b&&{onlyTNotes:"1"}});if(i.minTS&&/^\d{1,2}\/\d{1,2}$/.test(i.minTS)){const p=new Date().getFullYear(),[A,w]=i.minTS.split("/"),N=new Date(`${p}-${A.padStart(2,"0")}-${w.padStart(2,"0")}T00:00:00`);o.set("minTS",N.getTime().toString())}if(i.maxTS&&/^\d{1,2}\/\d{1,2}$/.test(i.maxTS)){const p=new Date().getFullYear(),[A,w]=i.maxTS.split("/"),N=new Date(`${p}-${A.padStart(2,"0")}-${w.padStart(2,"0")}T23:59:59.999`);o.set("maxTS",N.getTime().toString())}return await xe(`/api/tm/search?${o}`)},getNextPageParam:(t,o)=>t.data.length===parseInt(t.limit)?o.length+1:void 0,staleTime:3e4,refetchOnWindowFocus:!1,placeholderData:t=>t}),{data:_={}}=Oe({queryKey:["lowCardinalityColumns",d,h],queryFn:()=>xe(`/api/tm/lowCardinalityColumns/${d}/${h}`),staleTime:300*1e3}),T=l.useMemo(()=>{let t=K?.pages.flatMap(o=>o.data)||[];return g&&(t=t.filter(o=>o.channel!==null&&o.channel!==void 0&&o.channel!=="")),t},[K,g]),Se=l.useCallback(t=>{L||X||(q.current&&q.current.disconnect(),q.current=new IntersectionObserver(o=>{o[0].isIntersecting&&J&&ne()}),t&&q.current.observe(t))},[L,X,J,ne]),v=l.useCallback(t=>{D.current=t},[]),y=l.useCallback(()=>{D.current=null},[]),C=l.useCallback((t,o,c,p,A)=>{const w=new URLSearchParams;Object.entries(t).forEach(([N,oe])=>{oe.trim()!==""&&w.set(N,oe)}),o?Object.keys(Object.fromEntries(w)).length>0&&w.set("active","1"):w.set("active","0"),c&&w.set("showTechnicalColumns","1"),p&&w.set("showTNotes","1"),A&&w.set("showOnlyLeveraged","1"),I(w,{replace:!0})},[I]),z=l.useCallback((t,o)=>{H(c=>({...c,[t]:o})),S(new Set),clearTimeout(k.current),k.current=setTimeout(()=>{const c={...i,[t]:o};P(c),clearTimeout(F.current),F.current=setTimeout(()=>{C(c,u,a,b,g)},200)},300)},[i,u,a,b,g,C]),Ce=(t,o)=>{const c=new Set(j);o?c.add(t):c.delete(t),S(c)},we=t=>{if(t){const o=new Set(T.map((c,p)=>p));S(o)}else S(new Set)},Te=()=>{const t=Array.from(j).map(o=>T[o]);Je(d,h,t),S(new Set)},ve=T.length>0&&j.size===T.length,ye=j.size>0&&j.size<T.length;l.useEffect(()=>{if(D.current&&m.current[D.current]){const t=m.current[D.current];setTimeout(()=>{if(t&&document.contains(t)&&(t.focus(),typeof t.setSelectionRange=="function"&&t.value)){const o=t.value.length;t.setSelectionRange(o,o)}},10)}},[T]);const ze=l.useCallback(t=>{re(t),C(i,t,a,b,g)},[i,a,b,g,C]),We=l.useCallback(t=>{ge(t),S(new Set),C(i,u,a,t,g)},[i,u,a,g,C]),Be=l.useCallback(t=>{pe(t),S(new Set),C(i,u,a,b,t)},[i,u,a,b,C]),ke=l.useCallback(t=>{V(t),C(i,u,t,b,g)},[i,u,b,g,C]);return l.useEffect(()=>()=>{k.current&&clearTimeout(k.current),F.current&&clearTimeout(F.current)},[]),L&&T.length===0&&!K?e.jsx(n,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(Z,{size:"xl"})}):me?e.jsx(n,{mt:5,px:6,children:e.jsx(Re,{status:"error",children:e.jsxs(n,{children:[e.jsx(r,{fontWeight:"bold",children:"Error"}),e.jsx(r,{children:je?.message||"Failed to fetch translation memory data"})]})})}):e.jsxs(n,{children:[e.jsx(n,{bg:"blue.subtle",borderBottom:"1px",borderColor:"blue.muted",shadow:"md",borderLeft:"4px",borderLeftColor:"blue.500",px:6,py:4,mb:6,children:e.jsxs(B,{align:"center",justify:"space-between",children:[e.jsxs(B,{align:"center",gap:3,children:[e.jsxs(r,{fontSize:"md",fontWeight:"semibold",color:"blue.700",children:[d," → ",h]}),L&&e.jsx(Z,{size:"sm"})]}),e.jsxs(B,{align:"center",gap:3,children:[e.jsxs(B,{align:"center",gap:2,children:[e.jsx(r,{fontSize:"sm",color:"blue.600",children:"Show Technical IDs"}),e.jsxs(O,{checked:a,onCheckedChange:t=>ke(t.checked),size:"sm",children:[e.jsx(R,{}),e.jsx($,{})]})]}),e.jsxs(B,{align:"center",gap:2,children:[e.jsx(r,{fontSize:"sm",color:"blue.600",children:"Only Leveraged"}),e.jsxs(O,{checked:g,onCheckedChange:t=>Be(t.checked),size:"sm",children:[e.jsx(R,{}),e.jsx($,{})]})]}),e.jsxs(B,{align:"center",gap:2,children:[e.jsx(r,{fontSize:"sm",color:"blue.600",children:"Only TNotes"}),e.jsxs(O,{checked:b,onCheckedChange:t=>We(t.checked),size:"sm",children:[e.jsx(R,{}),e.jsx($,{})]})]}),j.size>0&&e.jsxs(ee,{colorPalette:"blue",onClick:Te,children:["Add to Cart (",j.size," ",j.size===1?"TU":"TUs",")"]})]})]})}),e.jsxs(n,{mx:6,h:"calc(100vh - 180px)",bg:"white",borderRadius:"lg",shadow:"sm",overflow:"auto",children:[e.jsxs(n,{as:"table",w:"100%",fontSize:"sm",children:[e.jsx(n,{as:"thead",position:"sticky",top:0,bg:"blue.subtle",zIndex:1,borderBottom:"2px",borderColor:"blue.muted",shadow:"sm",children:e.jsxs(n,{as:"tr",children:[e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"60px",textAlign:"center",children:e.jsxs(O,{checked:ve,onCheckedChange:t=>we(t.checked),children:[e.jsx(R,{ref:t=>{t&&(t.indeterminate=ye)}}),e.jsx($,{})]})}),a&&e.jsxs(e.Fragment,{children:[e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"guid"}),e.jsx(W,{size:"xs",placeholder:"Filter GUID...",value:x.guid,onChange:t=>z("guid",t.target.value),onFocus:()=>v("guid"),onBlur:y,ref:t=>{t&&(m.current.guid=t)},bg:"yellow.subtle"},"guid-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"nid"}),e.jsx(W,{size:"xs",placeholder:"Filter NID...",value:x.nid,onChange:t=>z("nid",t.target.value),onFocus:()=>v("nid"),onBlur:y,ref:t=>{t&&(m.current.nid=t)},bg:"yellow.subtle"},"nid-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"jobGuid"}),e.jsx(W,{size:"xs",placeholder:"Filter Job GUID...",value:x.jobGuid,onChange:t=>z("jobGuid",t.target.value),onFocus:()=>v("jobGuid"),onBlur:y,ref:t=>{t&&(m.current.jobGuid=t)},bg:"yellow.subtle"},"jobGuid-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"150px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"rid"}),e.jsx(W,{size:"xs",placeholder:"Filter RID...",value:x.rid,onChange:t=>z("rid",t.target.value),onFocus:()=>v("rid"),onBlur:y,ref:t=>{t&&(m.current.rid=t)},bg:"yellow.subtle"},"rid-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"150px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"sid"}),e.jsx(W,{size:"xs",placeholder:"Filter SID...",value:x.sid,onChange:t=>z("sid",t.target.value),onFocus:()=>v("sid"),onBlur:y,ref:t=>{t&&(m.current.sid=t)},bg:"yellow.subtle"},"sid-input")]})})]}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Channel"}),e.jsx(Y,{columnName:"channel",label:"Channel",value:x.channel,onChange:t=>z("channel",t),onFocus:()=>v("channel"),onBlur:y,inputRef:t=>{t&&(m.current.channel=t)},lowCardinalityOptions:_.channel,placeholder:"Channel..."})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"350px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",textAlign:d?.startsWith("he")||d?.startsWith("ar")?"right":"left",children:"Source"}),e.jsx(W,{size:"xs",placeholder:"Filter source...",value:x.nsrc,onChange:t=>z("nsrc",t.target.value),onFocus:()=>v("nsrc"),onBlur:y,ref:t=>{t&&(m.current.nsrc=t)},bg:"yellow.subtle",dir:d?.startsWith("he")||d?.startsWith("ar")?"rtl":"ltr"},"nsrc-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"350px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",textAlign:h?.startsWith("he")||h?.startsWith("ar")?"right":"left",children:"Target"}),e.jsx(W,{size:"xs",placeholder:"Filter target...",value:x.ntgt,onChange:t=>z("ntgt",t.target.value),onFocus:()=>v("ntgt"),onBlur:y,ref:t=>{t&&(m.current.ntgt=t)},bg:"yellow.subtle",dir:h?.startsWith("he")||h?.startsWith("ar")?"rtl":"ltr"},"ntgt-input")]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"60px",textAlign:"center",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"TConf"}),e.jsx(Y,{columnName:"tconf",label:"TConf",value:x.tconf,onChange:t=>z("tconf",t),onFocus:()=>v("tconf"),onBlur:y,inputRef:t=>{t&&(m.current.tconf=t)},lowCardinalityOptions:_.tconf,placeholder:"TConf..."})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"40px",textAlign:"center",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"q"}),e.jsx(Y,{columnName:"q",label:"Quality",value:x.q,onChange:t=>z("q",t),onFocus:()=>v("q"),onBlur:y,inputRef:t=>{t&&(m.current.q=t)},lowCardinalityOptions:_.q,placeholder:"Quality..."})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Provider"}),e.jsx(Y,{columnName:"translationProvider",label:"Provider",value:x.translationProvider,onChange:t=>z("translationProvider",t),onFocus:()=>v("translationProvider"),onBlur:y,inputRef:t=>{t&&(m.current.translationProvider=t)},lowCardinalityOptions:_.translationProvider,placeholder:"Provider..."})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"80px",textAlign:"center",children:e.jsxs(f,{gap:2,align:"center",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Active"}),e.jsxs(O,{checked:u,onCheckedChange:t=>ze(t.checked),size:"sm",children:[e.jsx(R,{}),e.jsx($,{})]})]})}),e.jsx(n,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"center",children:e.jsxs(f,{gap:2,align:"stretch",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Timestamp"}),e.jsxs($e,{open:be,onOpenChange:t=>{Q(t.open),t.open&&(E(x.minTS),U(x.maxTS))},children:[e.jsx(De,{asChild:!0,children:e.jsx(r,{fontSize:"xs",cursor:"pointer",color:"blue.600",textDecoration:"underline",_hover:{color:"blue.700"},px:2,py:1,children:x.minTS||x.maxTS?`${x.minTS||"start"} → ${x.maxTS||"end"}`:"Filter dates..."})}),e.jsx(Le,{children:e.jsxs(Ne,{children:[e.jsx(qe,{}),e.jsx(Ge,{children:e.jsx(r,{fontSize:"sm",fontWeight:"semibold",children:"Date Range Filter"})}),e.jsx(Ee,{children:e.jsxs(f,{gap:3,align:"stretch",children:[e.jsxs(n,{children:[e.jsx(r,{fontSize:"xs",mb:1,color:"fg.muted",children:"From"}),e.jsx(W,{type:"date",size:"sm",value:G?(()=>{const[t,o]=G.split("/");return`${new Date().getFullYear()}-${t?.padStart(2,"0")}-${o?.padStart(2,"0")}`})():"",onChange:t=>{if(t.target.value){const[o,c,p]=t.target.value.split("-");E(`${parseInt(c,10)}/${parseInt(p,10)}`),setTimeout(()=>t.target.blur(),0)}else E("")}})]}),e.jsxs(n,{children:[e.jsx(r,{fontSize:"xs",mb:1,color:"fg.muted",children:"To"}),e.jsx(W,{type:"date",size:"sm",value:M?(()=>{const[t,o]=M.split("/");return`${new Date().getFullYear()}-${t?.padStart(2,"0")}-${o?.padStart(2,"0")}`})():"",onChange:t=>{if(t.target.value){const[o,c,p]=t.target.value.split("-");U(`${parseInt(c,10)}/${parseInt(p,10)}`),setTimeout(()=>t.target.blur(),0)}else U("")}})]}),e.jsxs(Me,{gap:2,children:[e.jsx(ee,{size:"sm",variant:"outline",flex:1,onClick:()=>{H(t=>({...t,minTS:"",maxTS:""})),S(new Set),clearTimeout(k.current),k.current=setTimeout(()=>{const t={...i,minTS:"",maxTS:""};P(t),clearTimeout(F.current),F.current=setTimeout(()=>{C(t,u,a,b,g)},200)},300),E(""),U(""),Q(!1)},children:"Clear"}),e.jsx(ee,{size:"sm",colorPalette:"blue",flex:1,onClick:()=>{H(t=>({...t,minTS:G,maxTS:M})),S(new Set),clearTimeout(k.current),k.current=setTimeout(()=>{const t={...i,minTS:G,maxTS:M};P(t),clearTimeout(F.current),F.current=setTimeout(()=>{C(t,u,a,b,g)},200)},300),Q(!1)},children:"Apply"})]})]})})]})})]})]})})]})}),e.jsx(n,{as:"tbody",children:T.map((t,o)=>e.jsxs(n,{as:"tr",ref:o===T.length-20?Se:null,_hover:{bg:"gray.subtle"},children:[e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsxs(O,{checked:j.has(o),onCheckedChange:c=>Ce(o,c.checked),children:[e.jsx(R,{}),e.jsx($,{})]})}),a&&e.jsxs(e.Fragment,{children:[e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"blue.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",children:t.guid})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"purple.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",children:t.nid||""})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"green.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",cursor:"pointer",_hover:{textDecoration:"underline"},onClick:c=>{c.preventDefault(),window.open(`/job/${t.jobGuid}`,"_blank")},children:t.jobGuid})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",wordBreak:"break-all",whiteSpace:"normal",children:t.rid})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",wordBreak:"break-all",whiteSpace:"normal",children:t.sid})})]}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:t.channel?e.jsx(Ue,{as:_e,to:`/sources/${t.channel}?rid=${encodeURIComponent(t.rid)}&guid=${encodeURIComponent(t.guid)}`,fontSize:"xs",color:"blue.600",_hover:{textDecoration:"underline"},children:t.channel}):e.jsx(r,{fontSize:"xs",children:t.channel})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:t.notes?e.jsxs(se,{children:[e.jsx(le,{asChild:!0,children:e.jsx(r,{fontSize:"xs",noOfLines:2,cursor:"help",dir:d?.startsWith("he")||d?.startsWith("ar")?"rtl":"ltr",children:te(t.nsrc)})}),e.jsx(ie,{children:e.jsxs(ae,{maxW:"400px",bg:"yellow.100",borderWidth:"1px",borderColor:"yellow.300",shadow:"lg",children:[e.jsx(ce,{}),e.jsxs(n,{children:[t.notes.desc&&e.jsx(r,{fontSize:"sm",mb:2,whiteSpace:"pre-wrap",color:"black",children:t.notes.desc}),t.notes.ph&&e.jsxs(n,{children:[e.jsx(r,{fontSize:"xs",fontWeight:"bold",color:"gray.600",mb:1,children:"Placeholders:"}),Object.entries(t.notes.ph).map(([c,p])=>e.jsxs(n,{mb:1,children:[e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"blue.600",children:c}),e.jsxs(r,{fontSize:"xs",color:"gray.600",children:[p.desc," (e.g., ",p.sample,")"]})]},c))]})]})]})})]}):e.jsx(r,{fontSize:"xs",noOfLines:2,dir:d?.startsWith("he")||d?.startsWith("ar")?"rtl":"ltr",children:te(t.nsrc)})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",noOfLines:2,dir:h?.startsWith("he")||h?.startsWith("ar")?"rtl":"ltr",children:te(t.ntgt)})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:t.tnotes?e.jsxs(se,{children:[e.jsx(le,{asChild:!0,children:e.jsx(r,{fontSize:"xs",fontWeight:"bold",cursor:"help",children:t.tconf||""})}),e.jsx(ie,{children:e.jsxs(ae,{maxW:"400px",bg:"yellow.100",borderWidth:"1px",borderColor:"yellow.300",shadow:"lg",children:[e.jsx(ce,{}),e.jsx(r,{fontSize:"sm",whiteSpace:"pre-wrap",color:"black",children:t.tnotes})]})})]}):e.jsx(r,{fontSize:"xs",children:t.tconf||""})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsx(r,{fontSize:"xs",children:t.q})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",children:t.translationProvider})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:t.active===1&&e.jsx(r,{fontSize:"lg",color:"green.500",children:"✓"})}),e.jsx(n,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsx(r,{fontSize:"xs",color:"fg.muted",children:t.ts?new Date(t.ts).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""})})]},`${o}-${t.guid||t.nid||o}`))})]}),X&&e.jsx(B,{justify:"center",p:4,children:e.jsx(Z,{size:"md"})}),!J&&T.length>0&&e.jsx(B,{justify:"center",p:4,children:e.jsx(r,{color:"fg.muted",fontSize:"sm",children:"No more results"})}),T.length===0&&!L&&e.jsx(B,{justify:"center",p:8,children:e.jsx(r,{color:"fg.muted",children:"No translation units found for the current filters"})})]})]})};export{et as default};
@@ -0,0 +1 @@
1
+ import{i as p,j as e,B as t,S as m,A as u,T as r,V as a,F as l,G as j,g as n,a0 as x}from"./vendor-BAKw9_tP.js";import{f as S}from"./index-CuIl8QRT.js";const w=()=>{const{data:s,isLoading:g,error:c}=p({queryKey:["info"],queryFn:()=>S("/api/info")});return g?e.jsx(t,{display:"flex",justifyContent:"center",mt:20,children:e.jsx(m,{size:"xl"})}):c?e.jsx(t,{mt:10,px:6,children:e.jsx(u,{status:"error",children:e.jsxs(t,{children:[e.jsx(r,{fontWeight:"bold",children:"Error"}),e.jsx(r,{children:c})]})})}):e.jsx(t,{py:8,px:6,children:e.jsxs(a,{gap:8,align:"stretch",maxW:"6xl",mx:"auto",children:[s&&e.jsx(t,{p:8,borderWidth:"1px",borderRadius:"xl",bg:"white",shadow:"lg",width:"100%",maxW:"500px",mx:"auto",position:"relative",background:"linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%)",borderColor:"border.default",children:e.jsxs(l,{direction:"column",gap:4,children:[e.jsxs(l,{align:"center",gap:4,children:[e.jsx("img",{src:"/logo.svg",alt:"L10n Monster",width:"60",height:"60"}),e.jsx(t,{children:e.jsx(r,{fontSize:"xl",fontWeight:"bold",color:"fg.default",lineHeight:"1.2",children:s.description})})]}),e.jsxs(a,{gap:3,align:"stretch",children:[e.jsxs(t,{children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",textTransform:"uppercase",letterSpacing:"wide",mb:1,children:"Version"}),e.jsx(r,{fontSize:"lg",fontWeight:"semibold",color:"blue.600",children:s.version})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",textTransform:"uppercase",letterSpacing:"wide",mb:1,children:"Project Directory"}),e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"fg.muted",wordBreak:"break-all",lineHeight:"1.3",children:s.baseDir})]})]}),e.jsx(t,{position:"absolute",top:"-10px",right:"-10px",width:"80px",height:"80px",bg:"blue.subtle",borderRadius:"full",opacity:"0.5",zIndex:"-1"})]})}),s&&e.jsxs(j,{templateColumns:{base:"1fr",md:"repeat(2, 1fr)"},gap:6,children:[e.jsxs(t,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",borderColor:"border.default",children:[e.jsxs(r,{fontSize:"lg",fontWeight:"bold",mb:4,color:"fg.default",children:["Channels (",s.channels?.length||0,")"]}),e.jsxs(a,{gap:3,align:"stretch",maxH:"500px",overflow:"auto",children:[s.channels?.map((o,d)=>e.jsxs(t,{p:4,borderWidth:"1px",borderRadius:"md",borderColor:"border.subtle",bg:"bg.subtle",children:[e.jsxs(l,{justify:"space-between",align:"center",mb:3,children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",children:o.id}),e.jsxs(n,{variant:"subtle",colorPalette:"purple",fontSize:"xs",children:[o.translationPolicies," ",o.translationPolicies===1?"policy":"policies"]})]}),e.jsxs(x,{gap:4,mb:3,flexWrap:"wrap",children:[e.jsxs(t,{children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Source"}),e.jsx(n,{variant:"subtle",colorPalette:"blue",fontSize:"xs",children:o.source})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Target"}),e.jsx(n,{variant:"subtle",colorPalette:"green",fontSize:"xs",children:o.target})]})]}),o.formatHandlers&&o.formatHandlers.length>0&&e.jsxs(t,{children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:2,children:"Format Handlers"}),e.jsx(a,{gap:2,align:"stretch",children:o.formatHandlers.map((i,h)=>e.jsxs(t,{p:2,bg:"white",borderRadius:"sm",borderWidth:"1px",children:[e.jsxs(l,{justify:"space-between",align:"center",mb:1,children:[e.jsxs(r,{fontSize:"xs",fontWeight:"medium",children:[i.id,i.resourceFilter&&` (${i.resourceFilter})`]}),i.defaultMessageFormat&&e.jsx(n,{variant:"outline",colorPalette:"orange",size:"sm",children:i.defaultMessageFormat})]}),i.messageFormats&&i.messageFormats.length>0&&e.jsx(x,{gap:1,flexWrap:"wrap",children:i.messageFormats.map((f,b)=>e.jsx(n,{variant:"subtle",colorPalette:"gray",size:"sm",children:f},b))})]},h))})]})]},d)),(!s.channels||s.channels.length===0)&&e.jsx(r,{fontSize:"sm",color:"fg.muted",children:"No channels configured"})]})]}),e.jsxs(t,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",borderColor:"border.default",children:[e.jsxs(r,{fontSize:"lg",fontWeight:"bold",mb:4,color:"fg.default",children:["TM Stores (",s.tmStores?.length||0,")"]}),e.jsxs(a,{gap:3,align:"stretch",overflow:"auto",children:[s.tmStores?.map((o,d)=>e.jsxs(t,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"border.subtle",bg:"bg.subtle",children:[e.jsxs(l,{justify:"space-between",align:"center",mb:2,children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",children:o.id}),e.jsx(n,{variant:"subtle",colorPalette:"gray",fontSize:"xs",children:o.type})]}),e.jsxs(l,{gap:4,flexWrap:"wrap",fontSize:"xs",color:"fg.muted",children:[e.jsxs(r,{children:[e.jsx(r,{as:"span",fontWeight:"medium",children:"Access:"})," ",o.access]}),e.jsxs(r,{children:[e.jsx(r,{as:"span",fontWeight:"medium",children:"Partitioning:"})," ",o.partitioning]})]})]},d)),(!s.tmStores||s.tmStores.length===0)&&e.jsx(r,{fontSize:"sm",color:"fg.muted",children:"No TM stores configured"})]})]}),e.jsxs(t,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",borderColor:"border.default",children:[e.jsxs(r,{fontSize:"lg",fontWeight:"bold",mb:4,color:"fg.default",children:["Providers (",s.providers?.length||0,")"]}),e.jsxs(a,{gap:3,align:"stretch",maxH:"300px",overflow:"auto",children:[s.providers?.map((o,d)=>e.jsx(t,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"border.subtle",bg:"bg.subtle",children:e.jsxs(l,{justify:"space-between",align:"center",children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",children:o.id}),e.jsx(n,{variant:"subtle",colorPalette:"green",fontSize:"xs",children:o.type})]})},d)),(!s.providers||s.providers.length===0)&&e.jsx(r,{fontSize:"sm",color:"fg.muted",children:"No providers configured"})]})]}),e.jsxs(t,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",borderColor:"border.default",children:[e.jsxs(r,{fontSize:"lg",fontWeight:"bold",mb:4,color:"fg.default",children:["Snap Stores (",s.snapStores?.length||0,")"]}),e.jsxs(a,{gap:3,align:"stretch",maxH:"300px",overflow:"auto",children:[s.snapStores?.map((o,d)=>e.jsx(t,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"border.subtle",bg:"bg.subtle",children:e.jsxs(l,{justify:"space-between",align:"center",children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",children:o.id}),e.jsx(n,{variant:"subtle",colorPalette:"orange",fontSize:"xs",children:o.type})]})},d)),(!s.snapStores||s.snapStores.length===0)&&e.jsx(r,{fontSize:"sm",color:"fg.muted",children:"No snap stores configured"})]})]})]})]})})};export{w as default};
@@ -0,0 +1 @@
1
+ import{j as e,C as ze,a as Ce,T as r,B as t,F as y,b as ie,c as le,d as de,e as ae,f as ce,g as z,G,L as H,h as _,I as We,u as Te,V as w,r as S,i as Q,A as he,S as V,k as se,l as ve,m as Ae,n as Pe,o as Le,p as Re,q as $e,s as Me,t as Je,v as R,D,w as k,x as B,y as E,z as F,E as N,H as U,J as q,K as Ie,M as Oe}from"./vendor-BAKw9_tP.js";function Ue({children:o}){return e.jsx(e.Fragment,{children:o})}async function K(o,l={}){try{const a=await fetch(o,l);if(!a.ok){let n;try{n=await a.json()}catch{}const i=n?.message||`HTTP error! status: ${a.status}`,c=new Error(i);throw c.status=a.status,c.response=a,c}return await a.json()}catch(a){if(console.error("API Fetch Error:",a),a.status||a.response)throw a;const n=new Error(a.message||"Network error");throw n.originalError=a,n}}const qe=({project:o})=>{const{projectName:l,pairSummary:a,pairSummaryByStatus:n,translationStatus:i}=o,c={translated:n?.translated||0,"in flight":n?.["in flight"]||0,"low quality":n?.["low quality"]||0,untranslated:n?.untranslated||0},h=Object.values(c).reduce((u,j)=>u+j,0),g=h>0?Math.round(c.translated/h*100):0,x=h>0?Math.round(c["in flight"]/h*100):0,d=h>0?Math.round(c["low quality"]/h*100):0,b=h>0?Math.round(c.untranslated/h*100):0;return e.jsx(ze,{variant:"outline",bg:"yellow.subtle",children:e.jsxs(Ce,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",mb:2,children:l}),e.jsx(t,{mb:3,children:e.jsxs(y,{align:"center",gap:2,mb:1,children:[e.jsxs(ie,{children:[e.jsx(le,{asChild:!0,children:e.jsxs(t,{flex:"1",bg:"bg.muted",rounded:"full",height:"10px",cursor:"help",position:"relative",overflow:"hidden",children:[e.jsx(t,{position:"absolute",top:"0",left:"0",height:"100%",width:`${g}%`,bg:"green.solid",transition:"width 0.3s ease"}),e.jsx(t,{position:"absolute",top:"0",left:`${g}%`,height:"100%",width:`${x}%`,bg:"blue.solid",transition:"width 0.3s ease"}),e.jsx(t,{position:"absolute",top:"0",left:`${g+x}%`,height:"100%",width:`${d}%`,bg:"yellow.solid",transition:"width 0.3s ease"}),e.jsx(t,{position:"absolute",top:"0",left:`${g+x+d}%`,height:"100%",width:`${b}%`,bg:"red.solid",transition:"width 0.3s ease"})]})}),e.jsx(de,{children:e.jsxs(ae,{maxW:"300px",bg:"bg.default",borderWidth:"1px",borderColor:"border.default",shadow:"lg",zIndex:1e3,children:[e.jsx(ce,{}),e.jsxs(t,{p:2,children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",mb:2,color:"fg.default",children:"Translation Status Details"}),i&&i.length>0?e.jsx(t,{children:i.map((u,j)=>{const C=u.q===null?"untranslated":u.q===0?"in flight":u.q>=u.minQ?"translated":"low quality",W=C==="translated"?"green.solid":C==="in flight"?"blue.solid":C==="low quality"?"yellow.solid":"red.solid";return e.jsxs(y,{align:"center",gap:2,mb:1,children:[e.jsx(t,{w:"8px",h:"8px",bg:W,borderRadius:"full"}),e.jsxs(r,{fontSize:"xs",color:"fg.default",children:["Q: ",u.q||"null"," | Segs: ",u.seg," | Words: ",u.words," | Chars: ",u.chars]})]},j)})}):e.jsxs(t,{children:[e.jsxs(y,{align:"center",gap:2,mb:1,children:[e.jsx(t,{w:"8px",h:"8px",bg:"green.solid",borderRadius:"full"}),e.jsxs(r,{fontSize:"xs",color:"fg.default",children:["Translated: ",c.translated]})]}),e.jsxs(y,{align:"center",gap:2,mb:1,children:[e.jsx(t,{w:"8px",h:"8px",bg:"blue.solid",borderRadius:"full"}),e.jsxs(r,{fontSize:"xs",color:"fg.default",children:["In Flight: ",c["in flight"]]})]}),e.jsxs(y,{align:"center",gap:2,mb:1,children:[e.jsx(t,{w:"8px",h:"8px",bg:"yellow.solid",borderRadius:"full"}),e.jsxs(r,{fontSize:"xs",color:"fg.default",children:["Low Quality: ",c["low quality"]]})]}),e.jsxs(y,{align:"center",gap:2,children:[e.jsx(t,{w:"8px",h:"8px",bg:"red.solid",borderRadius:"full"}),e.jsxs(r,{fontSize:"xs",color:"fg.default",children:["Untranslated: ",c.untranslated]})]})]})]})]})})]}),e.jsxs(r,{fontSize:"sm",color:"fg.muted",minW:"45px",children:[g,"%"]})]})}),e.jsxs(y,{gap:2,flexWrap:"wrap",align:"center",children:[e.jsxs(z,{variant:"subtle",colorPalette:"blue",children:["Segments: ",a?.segs?.toLocaleString()||"0"]}),e.jsxs(z,{variant:"subtle",colorPalette:"green",children:["Words: ",a?.words?.toLocaleString()||"0"]}),e.jsxs(z,{variant:"subtle",colorPalette:"purple",children:["Chars: ",a?.chars?.toLocaleString()||"0"]}),c.untranslated>0&&e.jsxs(z,{variant:"solid",colorPalette:"red",children:["Untranslated: ",c.untranslated.toLocaleString()]}),c["low quality"]>0&&e.jsxs(z,{variant:"solid",colorPalette:"orange",children:["Low Quality: ",c["low quality"].toLocaleString()]})]})]})})},He=({item:o,channelId:l})=>{const a=i=>{const c=new Date,h=new Date(i),g=c-h,x=Math.floor(g/1e3),d=new Intl.RelativeTimeFormat("en",{numeric:"auto",style:"short"});return x<60?d.format(-x,"second"):x<3600?d.format(-Math.floor(x/60),"minute"):x<86400?d.format(-Math.floor(x/3600),"hour"):x<2592e3?d.format(-Math.floor(x/86400),"day"):x<31536e3?d.format(-Math.floor(x/2592e3),"month"):d.format(-Math.floor(x/31536e3),"year")},n=i=>new Date(i).toLocaleString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"});return e.jsx(t,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"border.default",bg:"yellow.subtle",w:"100%",children:e.jsxs(G,{templateColumns:"2fr 80px 3fr 80px 80px 100px",gap:4,alignItems:"center",children:[e.jsxs(t,{children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Project"}),e.jsx(H,{as:_,to:`/sources/${l}/${o.prj??"default"}`,fontSize:"sm",fontWeight:"semibold",color:"blue.600",_hover:{textDecoration:"underline"},children:o.prj??"default"})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Source"}),e.jsx(z,{colorPalette:"blue",size:"sm",children:o.sourceLang})]}),e.jsxs(t,{children:[e.jsxs(r,{fontSize:"xs",color:"fg.muted",mb:1,children:["Targets (",o.targetLangs.length,")"]}),e.jsx(y,{wrap:"wrap",gap:1,children:o.targetLangs.map(i=>e.jsx(z,{colorPalette:"green",size:"sm",children:i},i))})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Resources"}),e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:o.resCount.toLocaleString()})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Segments"}),e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"purple.600",children:o.segmentCount.toLocaleString()})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Modified"}),e.jsxs(ie,{children:[e.jsx(le,{asChild:!0,children:e.jsx(r,{fontSize:"xs",color:"fg.muted",cursor:"help",children:a(o.lastModified)})}),e.jsx(de,{children:e.jsxs(ae,{children:[e.jsx(ce,{}),e.jsx(r,{fontSize:"sm",children:n(o.lastModified)})]})})]})]})]})})},De=(o,l)=>o?{snapText:`Snapped on ${new Date(o).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`,importText:l?{text:"Imported from snap store ",store:l}:null}:{snapText:"Never snapped",importText:null},_e=({channelId:o,project:l,resource:a,onBackClick:n,backLabel:i="Back",snapTimestamp:c,snapStore:h,showSnapInfo:g=!1,extraContent:x=null})=>e.jsxs(t,{p:6,borderWidth:"2px",borderRadius:"lg",bg:"white",borderColor:"green.200",mb:6,children:[e.jsxs(t,{display:"flex",alignItems:"center",gap:3,flexWrap:"wrap",pb:4,borderBottom:"2px",borderColor:"green.100",children:[n&&e.jsx(We,{"aria-label":i,onClick:n,variant:"ghost",size:"sm",children:"←"}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",color:"fg.muted",mb:1,children:"Channel"}),e.jsx(r,{fontSize:"lg",fontWeight:"bold",color:"green.600",children:o})]}),l&&e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",color:"fg.muted",mb:1,children:"Project"}),e.jsx(r,{fontSize:"lg",fontWeight:"semibold",color:"blue.600",children:l})]}),a&&e.jsxs(t,{flex:"1",children:[e.jsx(r,{fontSize:"sm",color:"fg.muted",mb:1,children:"Resource"}),e.jsx(r,{fontSize:"lg",fontWeight:"semibold",color:"purple.600",wordBreak:"break-all",children:a})]}),g&&!l&&!a&&e.jsx(t,{flex:"1",textAlign:"right",children:(()=>{const{snapText:d,importText:b}=De(c,h);return e.jsxs(e.Fragment,{children:[e.jsx(r,{fontSize:"sm",color:"fg.muted",children:d}),b&&e.jsxs(r,{fontSize:"sm",color:"fg.muted",children:[b.text,e.jsx(r,{as:"span",fontWeight:"bold",color:"blue.600",children:b.store})]})]})})()})]}),x&&e.jsx(t,{mt:6,children:x})]});function ne(o){if(!o)return null;const l=/(https:\/\/[^\s]+)/g;return o.split(l).map((n,i)=>n.match(l)?e.jsx(r,{as:"a",href:n,target:"_blank",rel:"noopener noreferrer",color:"blue.600",textDecoration:"underline",_hover:{color:"blue.800"},children:n},`link-${i}`):n)}const xe="tmCart",ke=()=>{const o=sessionStorage.getItem(xe);return o?JSON.parse(o):{}},Be=o=>{sessionStorage.setItem(xe,JSON.stringify(o)),window.dispatchEvent(new Event("cartUpdated"))},Ee=(o,l,a,n=null)=>({guid:o.guid,channel:n||o.channel,sourceLang:l,targetLang:a,nsrc:o.nsrc,ntgt:o.ntgt}),ue=(o,l,a,n=null)=>{const i=ke(),c=`${o}|${l}`;i[c]||(i[c]={sourceLang:o,targetLang:l,tus:[]});const h=a.map(g=>Ee(g,o,l,n));i[c].tus.push(...h),Be(i)},Ge=ue,Qe=(o,l,a,n)=>{ue(o,l,n,a)},Fe=({sourceLang:o,targetLang:l,providers:a})=>{Te();const n=i=>{switch(i){case"done":return"green";case"pending":return"yellow";case"error":return"red";default:return"gray"}};return e.jsx(t,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",w:"100%",children:e.jsxs(w,{gap:4,align:"stretch",children:[e.jsx(t,{children:e.jsx(t,{mb:2,children:e.jsxs(H,{as:_,to:`/tm/${o}/${l}`,fontSize:"lg",fontWeight:"semibold",color:"blue.600",_hover:{textDecoration:"underline"},children:[o," → ",l]})})}),e.jsx(w,{gap:3,align:"stretch",children:a.map((i,c)=>e.jsx(t,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"border.default",bg:"yellow.subtle",children:e.jsxs(G,{templateColumns:{base:"minmax(0, 2fr) 1fr 1fr 1fr 1fr",md:"minmax(0, 3fr) 1fr 1fr 1fr 1fr"},gap:{base:1,md:2},alignItems:"center",overflow:"hidden",minWidth:"0",children:[e.jsxs(t,{minWidth:"0",overflow:"hidden",children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Provider"}),e.jsx(H,{as:_,to:`/tm/${o}/${l}?translationProvider=${encodeURIComponent(i.translationProvider)}`,fontSize:"sm",fontWeight:"semibold",color:"blue.600",_hover:{textDecoration:"underline",color:"blue.700"},noOfLines:1,title:i.translationProvider,children:i.translationProvider})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Status"}),e.jsx(z,{colorPalette:n(i.status),size:"sm",children:i.status})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"TUs"}),e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"purple.600",children:i.tuCount.toLocaleString()})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Unique"}),e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:i.distinctGuids.toLocaleString()})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(r,{fontSize:"xs",color:"fg.muted",mb:1,children:"Jobs"}),e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"teal.600",children:i.jobCount.toLocaleString()})]})]})},c))})]})})},Ve=({sourceLang:o,targetLang:l})=>{const[a,n]=S.useState(!1),i=S.useRef(null);S.useEffect(()=>{const x=new IntersectionObserver(d=>{d.forEach(b=>{b.isIntersecting&&(n(!0),x.disconnect())})},{rootMargin:"200px",threshold:0});return i.current&&x.observe(i.current),()=>x.disconnect()},[]);const{data:c,isLoading:h,error:g}=Q({queryKey:["tmStats",o,l],queryFn:()=>K(`/api/tm/stats/${o}/${l}`),enabled:a});return e.jsx(t,{ref:i,minH:"200px",children:g?e.jsx(he,{status:"error",children:e.jsxs(t,{children:[e.jsxs(r,{fontWeight:"bold",children:["Error loading ",o," → ",l]}),e.jsx(r,{children:g.message||"Unknown error"})]})}):h?e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",minH:"200px",p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:e.jsx(V,{size:"md"})}):c?e.jsx(Fe,{sourceLang:o,targetLang:l,providers:c}):a?e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",minH:"200px",p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:e.jsx(r,{color:"fg.muted",children:"No data available"})}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",minH:"200px",p:6,borderWidth:"1px",borderRadius:"lg",bg:"gray.50",shadow:"sm",children:e.jsx(r,{color:"fg.muted",fontSize:"sm",children:"Scroll down to load..."})})})},Ke=({providers:o,selectedProvider:l,onProviderSelect:a})=>{const n=Array.isArray(o)?o:[];return e.jsxs(t,{width:"25%",flexShrink:0,borderRight:"1px",borderColor:"border.default",p:4,bg:"yellow.subtle",minH:"70vh",children:[e.jsx(r,{fontSize:"lg",fontWeight:"bold",mb:4,children:"Providers"}),e.jsxs(w,{gap:2,align:"stretch",children:[n.map(i=>{const c=typeof i=="object"&&i?.id?i.id:i,h=typeof i=="object"&&i?.id?i.id:i,g=typeof i=="object"&&i?.type?i.type:null;return e.jsxs(t,{p:3,borderRadius:"md",cursor:"pointer",bg:l===h?"blue.subtle":"white",borderWidth:"1px",borderColor:l===h?"blue.600":"border.default",_hover:{bg:l===h?"blue.subtle":"gray.subtle"},onClick:()=>a(h),children:[e.jsx(r,{fontSize:"sm",fontWeight:"medium",noOfLines:2,children:c}),g&&e.jsx(r,{fontSize:"xs",color:"fg.muted",mt:1,children:g})]},h)}),n.length===0&&e.jsx(r,{color:"fg.muted",fontSize:"sm",textAlign:"center",mt:4,children:"No providers found"})]})]})},Ye=({providerId:o})=>{const{data:l,isLoading:a,error:n}=Q({queryKey:["provider",o],queryFn:()=>K(`/api/providers/${o}`),enabled:!!o});if(!o)return e.jsx(t,{width:"75%",p:6,textAlign:"center",children:e.jsx(r,{color:"fg.muted",children:"Select a provider to view details"})});if(a)return e.jsx(t,{width:"75%",p:6,display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(V,{size:"lg"})});if(n)return e.jsx(t,{width:"75%",p:6,children:e.jsx(he,{status:"error",children:e.jsxs(t,{children:[e.jsx(r,{fontWeight:"bold",children:"Error"}),e.jsx(r,{children:n?.message||"Failed to fetch provider details"})]})})});if(!l)return e.jsx(t,{width:"75%",p:6,textAlign:"center",children:e.jsx(r,{color:"fg.muted",children:"Provider not found"})});const{info:i,properties:c}=l,h=d=>{if(!d)return d;const b={31:"#ef4444",32:"#22c55e",33:"#eab308",34:"#3b82f6",35:"#a855f7",36:"#06b6d4",39:"inherit"},u=[];let j=0,C="inherit";const W=/\u001B\[([0-9;]*)m/g;let T;for(;(T=W.exec(d))!==null;){if(T.index>j){const p=d.slice(j,T.index);u.push(e.jsx("span",{style:{color:C},children:p},`${j}-text`))}const v=T[1];b[v]&&(C=b[v]),j=T.index+T[0].length}if(j<d.length){const v=d.slice(j);u.push(e.jsx("span",{style:{color:C},children:v},`${j}-text`))}return u.length>0?u:d},g=d=>Array.isArray(d)?d.map((b,u)=>e.jsxs(t,{display:"flex",alignItems:"flex-start",gap:2,children:[e.jsx(r,{fontSize:"sm",color:"fg.muted",mt:"1px",children:"•"}),e.jsx(r,{fontSize:"sm",flex:"1",children:h(b)})]},u)):e.jsx(r,{fontSize:"sm",children:h(d)}),x=d=>typeof d=="object"&&d!==null?!Array.isArray(d)&&Object.values(d).every(u=>typeof u=="string")&&Object.keys(d).length>0?e.jsx(t,{borderWidth:"1px",borderRadius:"md",overflow:"hidden",bg:"white",shadow:"sm",children:e.jsxs(t,{as:"table",w:"100%",fontSize:"sm",children:[e.jsx(t,{as:"thead",bg:"blue.subtle",borderBottom:"1px",borderColor:"border.default",children:e.jsxs(t,{as:"tr",children:[e.jsx(t,{as:"th",p:2,textAlign:"left",fontWeight:"semibold",color:"blue.600",children:"Key"}),e.jsx(t,{as:"th",p:2,textAlign:"left",fontWeight:"semibold",color:"blue.600",children:"Value"})]})}),e.jsx(t,{as:"tbody",children:Object.entries(d).sort(([u],[j])=>u.localeCompare(j)).map(([u,j])=>e.jsxs(t,{as:"tr",_hover:{bg:"gray.subtle"},children:[e.jsx(t,{as:"td",p:2,borderBottom:"1px",borderColor:"border.subtle",fontFamily:"mono",fontSize:"xs",children:u}),e.jsx(t,{as:"td",p:2,borderBottom:"1px",borderColor:"border.subtle",fontSize:"xs",children:j})]},u))})]})}):e.jsx(t,{as:"pre",fontSize:"xs",bg:"bg.muted",p:2,borderRadius:"md",overflow:"auto",maxH:"200px",children:JSON.stringify(d,null,2)}):e.jsx(r,{fontSize:"sm",children:String(d)});return e.jsx(t,{width:"75%",p:6,overflow:"auto",children:e.jsxs(w,{gap:6,align:"stretch",children:[e.jsx(t,{children:e.jsx(r,{fontSize:"2xl",fontWeight:"bold",mb:2,children:o})}),e.jsxs(t,{p:4,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:[e.jsx(r,{fontSize:"lg",fontWeight:"semibold",mb:4,children:"Properties"}),Object.keys(c).length===0?e.jsx(r,{color:"fg.muted",fontSize:"sm",children:"No properties available"}):e.jsx(w,{gap:4,align:"stretch",children:Object.entries(c).sort(([d],[b])=>d.localeCompare(b)).map(([d,b])=>e.jsxs(t,{children:[e.jsxs(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",mb:2,children:[d,":"]}),e.jsx(t,{pl:4,children:x(b)})]},d))})]}),e.jsxs(t,{p:4,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:[e.jsx(r,{fontSize:"lg",fontWeight:"semibold",mb:4,children:"Information"}),e.jsxs(G,{templateColumns:"auto 1fr",gap:3,alignItems:"start",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Type:"}),e.jsx(z,{colorPalette:"blue",size:"sm",children:i.type}),e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Cost per Word:"}),e.jsx(r,{fontSize:"sm",children:i.costPerWord}),e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Cost per MChar:"}),e.jsx(r,{fontSize:"sm",children:i.costPerMChar}),i.description&&e.jsxs(e.Fragment,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Description:"}),e.jsx(t,{children:g(i.description)})]})]})]})]})})},Ze=({langPairKey:o,tus:l,onRemoveTU:a})=>{const[n,i]=S.useState(""),[c,h]=S.useState(!1),[g,x]=S.useState(!1),[d,b]=S.useState(null),[u,j]=S.useState(""),[C,W]=S.useState(""),[T,v]=S.useState(""),[p,Y]=S.useState(null),[fe,Z]=S.useState(!1),{data:ge={},isLoading:be}=Q({queryKey:["info"],queryFn:()=>K("/api/info")}),je=ge.providers||[],X=se({mutationFn:async({sourceLang:s,targetLang:f,guids:m,provider:A})=>{const P=await fetch("/api/dispatcher/estimateJob",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceLang:s,targetLang:f,guids:m,provider:A})});if(!P.ok){const I=await P.json();throw new Error(I.message||"Failed to estimate job")}return P.json()}}),J=se({mutationFn:async({sourceLang:s,targetLang:f,guids:m,provider:A,jobName:P,instructions:I})=>{const O=await fetch("/api/dispatcher/startJob",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceLang:s,targetLang:f,guids:m,provider:A,jobName:P,instructions:I})});if(!O.ok){const we=await O.json();throw new Error(we.message||"Failed to start job")}return O.json()}});function ee(s){return s.map(f=>typeof f=="string"?f:`{{${f.t}}}`).join("")}const me=async()=>{if(!n){alert("Please select a provider first");return}const s=Array.isArray(l)?l:l.tus,f=typeof n=="object"&&n?.id?n.id:n;try{const m=s.map(P=>P.guid),A=await X.mutateAsync({sourceLang:$,targetLang:M,guids:m,provider:f});A?(b(A),j(""),W(""),h(!0)):(v(`Provider "${f}" did not accept any of the selected translation units.`),x(!0))}catch(m){v(`Failed to estimate job: ${m.message}`),x(!0)}},pe=s=>{i(s)},Se=async()=>{if(!d)return;const s=typeof n=="object"&&n?.id?n.id:n;try{const m=(await J.mutateAsync({sourceLang:$,targetLang:M,guids:d.guids,provider:s,jobName:u||void 0,instructions:C||void 0}))[0];Y(m),h(!1),Z(!0)}catch(f){v(`Failed to start job: ${f.message}`),x(!0)}},te=()=>{if(Z(!1),Y(null),b(null),j(""),W(""),d&&d.guids){const s=new Set(d.guids),f=Array.isArray(l)?l:l.tus;for(let m=f.length-1;m>=0;m--)s.has(f[m].guid)&&a(o,m)}},ye=s=>s===0?"Free":s==null?"Unknown":`$${s.toFixed(2)}`,L=Array.isArray(l)?l:l.tus,$=Array.isArray(l)?o.split("|")[0]||o.split("→")[0]:l.sourceLang,M=Array.isArray(l)?o.split("|")[1]||o.split("→").slice(1).join("→"):l.targetLang,re=L.some(s=>s.ntgt!==void 0),oe=L.some(s=>s.channel!==void 0);return e.jsxs(t,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:[e.jsxs(w,{gap:4,align:"stretch",children:[e.jsx(t,{children:e.jsxs(y,{align:"center",justify:"space-between",mb:2,children:[e.jsxs(y,{align:"center",gap:3,children:[e.jsx(z,{colorPalette:"blue",size:"sm",children:$}),e.jsx(r,{color:"fg.muted",fontSize:"lg",children:"→"}),e.jsx(z,{colorPalette:"green",size:"sm",children:M}),e.jsxs(y,{align:"center",gap:3,ml:4,children:[e.jsxs(ve,{size:"sm",width:"250px",value:n?[n]:[],onValueChange:s=>{},positioning:{strategy:"absolute",placement:"bottom-start",flip:!0,gutter:4},children:[e.jsxs(Ae,{children:[e.jsx(r,{fontSize:"sm",flex:"1",textAlign:"left",children:typeof n=="object"&&n?.id?n.id:n||"Select Provider"}),e.jsx(Pe,{})]}),e.jsx(Le,{children:e.jsx(Re,{zIndex:1e3,bg:"white",borderWidth:"1px",borderColor:"border.default",borderRadius:"md",shadow:"lg",minW:"250px",maxH:"200px",overflow:"auto",children:be?e.jsxs(t,{p:3,textAlign:"center",children:[e.jsx(V,{size:"sm"}),e.jsx(r,{fontSize:"sm",color:"fg.muted",mt:2,children:"Loading providers..."})]}):je.slice().sort((s,f)=>{const m=typeof s=="object"&&s?.id?s.id:s,A=typeof f=="object"&&f?.id?f.id:f;return m.localeCompare(A)}).map((s,f)=>e.jsxs($e,{item:s,value:s,onClick:()=>pe(s),children:[e.jsx(Me,{children:typeof s=="object"&&s?.id?s.id:s}),e.jsx(Je,{})]},`provider-${f}-${typeof s=="string"?s:JSON.stringify(s)}`))})})]}),e.jsx(R,{size:"sm",colorPalette:"blue",onClick:me,disabled:!n,loading:X.isPending,children:"Create Job"})]})]}),e.jsxs(r,{fontSize:"sm",color:"fg.muted",children:[L.length," ",L.length===1?"TU":"TUs"]})]})}),e.jsx(t,{bg:"white",borderRadius:"md",overflow:"auto",children:e.jsxs(t,{as:"table",w:"100%",fontSize:"sm",children:[e.jsx(t,{as:"thead",bg:"blue.subtle",borderBottom:"2px",borderColor:"blue.muted",shadow:"sm",children:e.jsxs(t,{as:"tr",children:[e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"left",minW:"120px",children:e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"GUID"})}),oe&&e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"left",minW:"120px",children:e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"CHANNEL"})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"left",minW:"350px",children:e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"SOURCE"})}),re&&e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"left",minW:"350px",children:e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"TARGET"})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"center",minW:"100px",children:e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"ACTION"})})]})}),e.jsx(t,{as:"tbody",children:L.map((s,f)=>e.jsxs(t,{as:"tr",_hover:{bg:"gray.subtle"},children:[e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"blue.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",children:s.guid})}),oe&&e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",children:s.channel||""})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",noOfLines:2,dir:$?.startsWith("he")||$?.startsWith("ar")?"rtl":"ltr",children:Array.isArray(s.nsrc)?ee(s.nsrc):s.nsrc})}),re&&e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(r,{fontSize:"xs",noOfLines:2,dir:M?.startsWith("he")||M?.startsWith("ar")?"rtl":"ltr",children:Array.isArray(s.ntgt)?ee(s.ntgt):s.ntgt||""})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsx(R,{size:"xs",colorPalette:"red",variant:"outline",onClick:()=>a(o,f),children:"Remove"})})]},`cart-tu-${f}-${typeof s.guid=="string"?s.guid:s.nid||f}`))})]})})]}),e.jsxs(D,{open:c,onOpenChange:s=>h(s.open),children:[e.jsx(k,{}),e.jsx(B,{children:e.jsxs(E,{maxW:"500px",children:[e.jsxs(F,{children:[e.jsx(N,{children:"Job Created Successfully"}),e.jsx(U,{})]}),e.jsx(q,{children:d&&e.jsxs(w,{gap:4,align:"stretch",children:[e.jsxs(t,{children:[e.jsxs(r,{fontSize:"lg",fontWeight:"bold",color:"green.600",mb:3,children:[d.guids?.length||0," TUs accepted out of ",L.length," sent"]}),e.jsxs(w,{gap:2,align:"stretch",children:[e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",display:"inline",children:"Provider: "}),e.jsx(r,{fontSize:"sm",color:"blue.600",fontFamily:"mono",display:"inline",children:typeof n=="object"&&n?.id?n.id:n})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",display:"inline",children:"Estimated Cost: "}),e.jsx(r,{fontSize:"sm",color:"green.600",fontWeight:"medium",display:"inline",children:ye(d.estimatedCost)})]}),d.statusDescription&&e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",display:"inline",children:"Status: "}),e.jsx(r,{fontSize:"sm",color:"fg.muted",display:"inline",children:ne(d.statusDescription)})]})]})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",mb:2,children:"Job Name (optional):"}),e.jsx(Ie,{placeholder:"Enter a name for this job...",value:u,onChange:s=>j(s.target.value)})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",mb:2,children:"Job Instructions (optional):"}),e.jsx(Oe,{placeholder:"Enter any specific instructions for this translation job...",value:C,onChange:s=>W(s.target.value),rows:3})]}),e.jsxs(y,{gap:3,children:[e.jsx(R,{colorPalette:"gray",variant:"outline",onClick:()=>{h(!1),b(null),j(""),W("")},flex:"1",disabled:J.isPending,children:"Cancel"}),e.jsx(R,{colorPalette:"green",onClick:Se,loading:J.isPending,flex:"1",children:"Push Job"})]})]})})]})})]}),e.jsxs(D,{open:g,onOpenChange:s=>x(s.open),children:[e.jsx(k,{}),e.jsx(B,{children:e.jsxs(E,{maxW:"400px",children:[e.jsxs(F,{children:[e.jsx(N,{children:"Job Creation Failed"}),e.jsx(U,{})]}),e.jsx(q,{children:e.jsxs(w,{gap:4,align:"stretch",children:[e.jsx(r,{color:"red.600",children:T}),e.jsx(R,{colorPalette:"red",onClick:()=>x(!1),w:"100%",children:"Close"})]})})]})})]}),e.jsxs(D,{open:fe,onOpenChange:s=>{s.open||te()},children:[e.jsx(k,{}),e.jsx(B,{children:e.jsxs(E,{maxW:"400px",children:[e.jsxs(F,{children:[e.jsx(N,{children:"Job Started Successfully"}),e.jsx(U,{})]}),e.jsx(q,{children:p&&e.jsxs(w,{gap:4,align:"stretch",children:[e.jsx(t,{children:e.jsxs(w,{gap:2,align:"stretch",children:[e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",display:"inline",children:"Job ID: "}),e.jsx(r,{fontSize:"sm",fontFamily:"mono",color:"blue.600",cursor:"pointer",_hover:{textDecoration:"underline"},onClick:s=>{s.preventDefault(),window.open(`/job/${p.jobGuid}`,"_blank")},display:"inline",children:p.jobGuid})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",display:"inline",children:"Provider: "}),e.jsx(r,{fontSize:"sm",color:"blue.600",fontFamily:"mono",display:"inline",children:p.translationProvider})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",display:"inline",children:"Language Pair: "}),e.jsxs(r,{fontSize:"sm",color:"purple.600",fontWeight:"medium",display:"inline",children:[p.sourceLang," → ",p.targetLang]})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",display:"inline",children:"Status: "}),e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:p.status==="completed"?"green.600":"orange.600",display:"inline",children:p.status.toUpperCase()})]}),p.statusDescription&&e.jsxs(t,{children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",mb:1,children:"Description:"}),e.jsx(r,{fontSize:"sm",color:"fg.muted",pl:2,borderLeft:"2px",borderColor:"blue.200",children:ne(p.statusDescription)})]})]})}),e.jsx(t,{children:e.jsx(R,{colorPalette:"blue",onClick:te,w:"100%",children:"Close & Remove TUs from Cart"})})]})})]})})]})]})};export{Ue as C,Ve as L,qe as P,He as S,_e as a,Qe as b,Ge as c,Ke as d,Ye as e,K as f,Ze as g,ne as r};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Welcome-DIrzw6Qn.js","assets/vendor-BAKw9_tP.js","assets/index-CuIl8QRT.js","assets/Status-D9oOpF1Y.js","assets/StatusDetail--8QtevHF.js","assets/Sources-C1PVA74-.js","assets/SourcesDetail-BPP_1C6K.js","assets/SourcesResource-DksVKNFW.js","assets/TM-CeatLxBS.js","assets/TMDetail-_oIVaxK5.js","assets/Providers-BR9owfvy.js","assets/Cart-DE4IB7O6.js","assets/Job-NxVVYeVu.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,N as P,T as m,v as R,h as f,r as n,Q as z,O as C,P as O,R as T,U as l,B as c,S as E,u as w,W as A,F as _,X as D,Y as I,Z as W,_ as M,$ as N}from"./vendor-BAKw9_tP.js";import{C as V}from"./index-CuIl8QRT.js";(function(){const x=document.createElement("link").relList;if(x&&x.supports&&x.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))j(r);new MutationObserver(r=>{for(const t of r)if(t.type==="childList")for(const s of t.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&j(s)}).observe(document,{childList:!0,subtree:!0});function h(r){const t={};return r.integrity&&(t.integrity=r.integrity),r.referrerPolicy&&(t.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?t.credentials="include":r.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function j(r){if(r.ep)return;r.ep=!0;const t=h(r);fetch(r.href,t)}})();const U="modulepreload",B=function(g){return"/"+g},v={},d=function(x,h,j){let r=Promise.resolve();if(h&&h.length>0){let y=function(i){return Promise.all(i.map(a=>Promise.resolve(a).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=s?.nonce||s?.getAttribute("nonce");r=y(h.map(i=>{if(i=B(i),i in v)return;v[i]=!0;const a=i.endsWith(".css"),b=a?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${b}`))return;const p=document.createElement("link");if(p.rel=a?"stylesheet":U,a||(p.as="script"),p.crossOrigin="",p.href=i,o&&p.setAttribute("nonce",o),document.head.appendChild(p),a)return new Promise((S,L)=>{p.addEventListener("load",S),p.addEventListener("error",()=>L(new Error(`Unable to preload CSS for ${i}`)))})}))}function t(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return r.then(s=>{for(const o of s||[])o.status==="rejected"&&t(o.reason);return x().catch(t)})},q=()=>e.jsxs(P,{maxWidth:"sm",textAlign:"center",mt:20,children:[e.jsx(m,{fontSize:"6xl",fontWeight:"bold",mb:4,children:"404"}),e.jsx(m,{fontSize:"2xl",fontWeight:"medium",mb:2,children:"Page Not Found"}),e.jsx(m,{color:"fg.muted",mb:8,children:"Sorry, the page you are looking for does not exist."}),e.jsx(R,{asChild:!0,colorPalette:"brand",size:"lg",children:e.jsx(f,{to:"/",children:"Go to Home"})})]}),F=n.lazy(()=>d(()=>import("./Welcome-DIrzw6Qn.js"),__vite__mapDeps([0,1,2]))),H=n.lazy(()=>d(()=>import("./Status-D9oOpF1Y.js"),__vite__mapDeps([3,1,2]))),k=n.lazy(()=>d(()=>import("./StatusDetail--8QtevHF.js"),__vite__mapDeps([4,1,2]))),$=n.lazy(()=>d(()=>import("./Sources-C1PVA74-.js"),__vite__mapDeps([5,1,2]))),Q=n.lazy(()=>d(()=>import("./SourcesDetail-BPP_1C6K.js"),__vite__mapDeps([6,1,2]))),G=n.lazy(()=>d(()=>import("./SourcesResource-DksVKNFW.js"),__vite__mapDeps([7,1,2]))),J=n.lazy(()=>d(()=>import("./TM-CeatLxBS.js"),__vite__mapDeps([8,1,2]))),K=n.lazy(()=>d(()=>import("./TMDetail-_oIVaxK5.js"),__vite__mapDeps([9,1,2]))),X=n.lazy(()=>d(()=>import("./Providers-BR9owfvy.js"),__vite__mapDeps([10,1,2]))),Y=n.lazy(()=>d(()=>import("./Cart-DE4IB7O6.js"),__vite__mapDeps([11,1,2]))),Z=n.lazy(()=>d(()=>import("./Job-NxVVYeVu.js"),__vite__mapDeps([12,1,2])));function u({children:g}){w();const x=A(),[h,j]=n.useState(0),r=()=>{try{const s=sessionStorage.getItem("tmCart");if(s){const o=JSON.parse(s),y=Object.values(o).reduce((i,a)=>Array.isArray(a)?i+a.length:i+(a.tus?a.tus.length:0),0);j(y)}else j(0)}catch{j(0)}};n.useEffect(()=>{r();const s=()=>r(),o=()=>r();return window.addEventListener("storage",s),window.addEventListener("cartUpdated",o),()=>{window.removeEventListener("storage",s),window.removeEventListener("cartUpdated",o)}},[]);const t=s=>s==="/"?x.pathname==="/":x.pathname.startsWith(s);return e.jsxs(c,{minH:"100vh",bg:"bg.muted",children:[e.jsx(c,{bg:"white",borderBottom:"1px",borderColor:"border.default",children:e.jsx(c,{px:6,py:3,children:e.jsxs(_,{align:"center",justify:"space-between",children:[e.jsxs(_,{align:"center",gap:3,children:[e.jsx("img",{src:"/logo.svg",alt:"L10n Monster",width:"32",height:"32"}),e.jsx(D,{size:"lg",color:"fg.default",children:"L10n Monster"})]}),e.jsxs(_,{align:"center",gap:4,css:{"& a":{textDecoration:"none",color:"inherit"}},children:[e.jsx(f,{to:"/",children:e.jsx(c,{cursor:"pointer",px:3,py:1,borderRadius:"md",bg:t("/")?"blue.subtle":"transparent",_hover:{bg:t("/")?"blue.subtle":"gray.subtle"},children:e.jsx(m,{fontSize:"md",fontWeight:"medium",children:"Home"})})}),e.jsx(f,{to:"/status",children:e.jsx(c,{cursor:"pointer",px:3,py:1,borderRadius:"md",bg:t("/status")?"blue.subtle":"transparent",_hover:{bg:t("/status")?"blue.subtle":"gray.subtle"},children:e.jsx(m,{fontSize:"md",fontWeight:"medium",children:"Status"})})}),e.jsx(f,{to:"/sources",children:e.jsx(c,{cursor:"pointer",px:3,py:1,borderRadius:"md",bg:t("/sources")?"blue.subtle":"transparent",_hover:{bg:t("/sources")?"blue.subtle":"gray.subtle"},children:e.jsx(m,{fontSize:"md",fontWeight:"medium",children:"Sources"})})}),e.jsx(f,{to:"/tm",children:e.jsx(c,{cursor:"pointer",px:3,py:1,borderRadius:"md",bg:t("/tm")?"blue.subtle":"transparent",_hover:{bg:t("/tm")?"blue.subtle":"gray.subtle"},children:e.jsx(m,{fontSize:"md",fontWeight:"medium",children:"TM"})})}),e.jsx(f,{to:"/providers",children:e.jsx(c,{cursor:"pointer",px:3,py:1,borderRadius:"md",bg:t("/providers")?"blue.subtle":"transparent",_hover:{bg:t("/providers")?"blue.subtle":"gray.subtle"},children:e.jsx(m,{fontSize:"md",fontWeight:"medium",children:"Providers"})})})]}),e.jsx(f,{to:"/cart",css:{textDecoration:"none",color:"inherit"},children:e.jsxs(_,{align:"center",gap:2,px:3,py:1,bg:t("/cart")?"blue.subtle":h>0?"blue.muted":"gray.muted",borderRadius:"md",cursor:"pointer",_hover:{bg:"blue.subtle"},children:[e.jsx(c,{fontSize:"lg",children:"🛒"}),e.jsxs(m,{fontSize:"md",fontWeight:"medium",children:[h," ",h===1?"TU":"TUs"]})]})})]})})}),e.jsx(n.Suspense,{fallback:e.jsx(c,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(E,{size:"xl"})}),children:g})]})}const ee=new z({defaultOptions:{queries:{staleTime:300*1e3,gcTime:600*1e3}}});function te(){return e.jsx(C,{client:ee,children:e.jsx(O,{children:e.jsx(n.Suspense,{fallback:e.jsx(c,{display:"flex",justifyContent:"center",alignItems:"center",minH:"100vh",children:e.jsx(E,{size:"xl"})}),children:e.jsxs(T,{children:[e.jsx(l,{path:"/job/:jobGuid",element:e.jsx(Z,{})}),e.jsx(l,{path:"/",element:e.jsx(u,{children:e.jsx(F,{})})}),e.jsx(l,{path:"/status",element:e.jsx(u,{children:e.jsx(H,{})})}),e.jsx(l,{path:"/status/:channelId/:sourceLang/:targetLang",element:e.jsx(u,{children:e.jsx(k,{})})}),e.jsx(l,{path:"/sources",element:e.jsx(u,{children:e.jsx($,{})})}),e.jsx(l,{path:"/sources/:channelId/:prj",element:e.jsx(u,{children:e.jsx(Q,{})})}),e.jsx(l,{path:"/sources/:channelId",element:e.jsx(u,{children:e.jsx(G,{})})}),e.jsx(l,{path:"/tm",element:e.jsx(u,{children:e.jsx(J,{})})}),e.jsx(l,{path:"/tm/:sourceLang/:targetLang",element:e.jsx(u,{children:e.jsx(K,{})})}),e.jsx(l,{path:"/providers",element:e.jsx(u,{children:e.jsx(X,{})})}),e.jsx(l,{path:"/cart",element:e.jsx(u,{children:e.jsx(Y,{})})}),e.jsx(l,{path:"*",element:e.jsx(q,{})})]})})})})}const re=I.createRoot(document.getElementById("root"));re.render(e.jsx(W.StrictMode,{children:e.jsx(M,{value:N,children:e.jsx(V,{children:e.jsx(te,{})})})}));